@xopcai/xopc 0.0.344 → 0.0.346

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 (205) hide show
  1. package/dist/browser-ext/dist/assets/{auth-BsvblhQz.js → auth-CFiOJ_rf.js} +1 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DRFs0Jjv.js → agent-avatar-dicebear-M2vuj6W3.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-C9J-ILd0.js → agent-defaults-settings-panel-B_d0WGFm.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-plugin-dialog-CGstiK5S.js → agent-plugin-dialog-egTQDEeV.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agents-DS-CV-xB.js → agents-BbwmG8Kl.js} +6 -6
  11. package/dist/gateway/static/root/assets/{agents-admin-api-BTYHoqlW.js → agents-admin-api-Dlw9XxYa.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-znCRRKVF.js → app-management-settings-panel-IxWZDAeT.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-DSUujN-S.js → appearance-settings-C56szwjn.js} +1 -1
  14. package/dist/gateway/static/root/assets/{apps-page-7uOjQp30.js → apps-page-Cqoc4xoi.js} +1 -1
  15. package/dist/gateway/static/root/assets/{archive-plugin-DV01jcWu.js → archive-plugin-Ce3TNO-R.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automations-page-D_Ts5PDI.js → automations-page-4so9_Bya.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automations-workspace-Dg7IuWeB.js → automations-workspace-CP3GH1iA.js} +1 -1
  18. package/dist/gateway/static/root/assets/{binary-plugins-CEoIySYJ.js → binary-plugins-l6tKp21u.js} +1 -1
  19. package/dist/gateway/static/root/assets/{block-editor-4bv_tjfg.js → block-editor-cj2RNjQs.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-automation-inputs-UYRx7nE_.js → browser-automation-inputs-C9W2EklQ.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-automations-page-EtXgro_V.js → browser-automations-page-CbTkFxIX.js} +1 -1
  22. package/dist/gateway/static/root/assets/{browser-settings-page-Bf45sjmd.js → browser-settings-page-KMfDs9dO.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capabilities-B-2wxCUQ.js → capabilities-Co9ZxHHB.js} +1 -1
  24. package/dist/gateway/static/root/assets/{capabilities-page-YjIv97Sw.js → capabilities-page-cm2Q7EfF.js} +2 -2
  25. package/dist/gateway/static/root/assets/{capabilities-settings-panel-Ch2iNnfI.js → capabilities-settings-panel-CIe5qsxW.js} +1 -1
  26. package/dist/gateway/static/root/assets/{capability-header-actions-DJKC0sss.js → capability-header-actions-D2ASOs4Z.js} +1 -1
  27. package/dist/gateway/static/root/assets/{channels-BWZmepe_.js → channels-D-DnLz_c.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-DLBqdgS-.js → chat-terminal-dock-DaQrqzCz.js} +1 -1
  29. package/dist/gateway/static/root/assets/computer-settings-page-C-59NTyH.js +1 -0
  30. package/dist/gateway/static/root/assets/{connector-service-page-CYE4gX1g.js → connector-service-page-Cq7t7AJq.js} +1 -1
  31. package/dist/gateway/static/root/assets/{connectors-page-dJDZx96_.js → connectors-page-BH53KX8Y.js} +1 -1
  32. package/dist/gateway/static/root/assets/{date-picker-BM9HDlUj.js → date-picker-CcfRQKmj.js} +1 -1
  33. package/dist/gateway/static/root/assets/{dependency-picker-BybqITjG.js → dependency-picker-b9Tif8dg.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-CYoJiTna.js → desktop-pet-BHe6Cb51.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-settings-CXcTdFHs.js → desktop-pet-settings-wgA6yOo1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{device-pairing-wizard-DnkRc3SQ.js → device-pairing-wizard-fv8c6u1o.js} +1 -1
  37. package/dist/gateway/static/root/assets/{directory-picker-path-field-BNC2UnEM.js → directory-picker-path-field-DM2YpM4N.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-debug-page-CHU0dr2j.js → extension-debug-page-B-Y_Zk8L.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-page-DXjPSQIh.js → extension-page-BC1m3MlB.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-settings-page-DqFNPQsx.js → extension-settings-page-Cu3cfeJj.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-DcE8n_ZS.js → gateway-config-swr-ukBQYwfH.js} +1 -1
  42. package/dist/gateway/static/root/assets/gateway-realtime-DvNfXjan.js +1 -0
  43. package/dist/gateway/static/root/assets/gateway-realtime-store-DGQMXjfI.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-settings-BJVKTwIx.js → gateway-settings-pxmn3b8n.js} +1 -1
  45. package/dist/gateway/static/root/assets/{gateway-startup-retry-CCPlq9Lk.js → gateway-startup-retry-CVpOj205.js} +1 -1
  46. package/dist/gateway/static/root/assets/{home-page-B2imtrmi.js → home-page-DOsvv2rU.js} +1 -1
  47. package/dist/gateway/static/root/assets/{image-generation-api-D1Uh-05P.js → image-generation-api-zxx0qG9z.js} +1 -1
  48. package/dist/gateway/static/root/assets/{imports-page-CsypWC3J.js → imports-page-CWYDLeqJ.js} +1 -1
  49. package/dist/gateway/static/root/assets/index-DsIQD44S.js +106 -0
  50. package/dist/gateway/static/root/assets/index-y6kxoLV2.css +1 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CSzm05SM.js → keyboard-shortcuts-settings-BEkTI6mv.js} +1 -1
  52. package/dist/gateway/static/root/assets/{local-app-workbench-page-BulzWHzC.js → local-app-workbench-page-aSXZL05r.js} +1 -1
  53. package/dist/gateway/static/root/assets/{local-apps-page-BQ2QlJNH.js → local-apps-page-BJThsekO.js} +1 -1
  54. package/dist/gateway/static/root/assets/{local-session-drafts-D9DeB55u.js → local-session-drafts-Dt_Yx7kq.js} +1 -1
  55. package/dist/gateway/static/root/assets/{locale-store-B0WmWiCo.js → locale-store-B008NR-f.js} +1 -1
  56. package/dist/gateway/static/root/assets/{logs-page-harzpOPJ.js → logs-page-WlqqTmpk.js} +1 -1
  57. package/dist/gateway/static/root/assets/{management-settings-BXKeyT_O.js → management-settings-j_npowOA.js} +1 -1
  58. package/dist/gateway/static/root/assets/{markdown-view-CSADmLmZ.js → markdown-view-BjDzimRP.js} +1 -1
  59. package/dist/gateway/static/root/assets/{media-plugins-CMe8YQ8l.js → media-plugins-DhYWGP6O.js} +1 -1
  60. package/dist/gateway/static/root/assets/messages-aVTaD9Mj.js +3 -0
  61. package/dist/gateway/static/root/assets/{note-detail-panel-DD9n9tnf.js → note-detail-panel-CYcNB2Pf.js} +3 -3
  62. package/dist/gateway/static/root/assets/{notes-page-B5NcvMau.js → notes-page-4D1-mt6Y.js} +1 -1
  63. package/dist/gateway/static/root/assets/{page-context-capture-button-BwFIuZqk.js → page-context-capture-button-BfmOqRGN.js} +1 -1
  64. package/dist/gateway/static/root/assets/{page-tabs-DH4JI3t_.js → page-tabs-aFGUXE53.js} +1 -1
  65. package/dist/gateway/static/root/assets/{preview-open-alternatives-D3Wsh5jh.js → preview-open-alternatives-BCEnqJTC.js} +1 -1
  66. package/dist/gateway/static/root/assets/{product-open-page-iigCUM2g.js → product-open-page-DHcx6kDT.js} +1 -1
  67. package/dist/gateway/static/root/assets/{project-detail-page-C19aDnSV.js → project-detail-page-ChKkovsq.js} +1 -1
  68. package/dist/gateway/static/root/assets/{projects-page-aWOL4_py.js → projects-page-Lt3HXMRm.js} +1 -1
  69. package/dist/gateway/static/root/assets/{registry-api-Bw0ZkSav.js → registry-api-EPj5O77m.js} +1 -1
  70. package/dist/gateway/static/root/assets/{remote-access-hub-CGLJFrLG.js → remote-access-hub-B94Vc-fj.js} +1 -1
  71. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-ArGdQMYT.js → runtime-tools-settings-panel-DNU19xEH.js} +1 -1
  72. package/dist/gateway/static/root/assets/{scenes-page-WB5cZttQ.js → scenes-page-BgzfnfOB.js} +1 -1
  73. package/dist/gateway/static/root/assets/{schema-form-Bzga2Tq0.js → schema-form-MKBLqh8C.js} +1 -1
  74. package/dist/gateway/static/root/assets/session-api-D5BlAIge.js +1 -0
  75. package/dist/gateway/static/root/assets/session-manager-DcFS0yfO.js +16 -0
  76. package/dist/gateway/static/root/assets/{sessions-page-DCs83Gg-.js → sessions-page-sYWhgEMH.js} +1 -1
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-alf3atpI.js +1 -0
  78. package/dist/gateway/static/root/assets/{settings-form-section-DMchToFl.js → settings-form-section-C2gcfyxy.js} +1 -1
  79. package/dist/gateway/static/root/assets/{settings-page-Dh-S9_GO.js → settings-page-CYd6_yBb.js} +1 -1
  80. package/dist/gateway/static/root/assets/{setup-status-panel-kFPkdt3z.js → setup-status-panel-CUbH_YtB.js} +1 -1
  81. package/dist/gateway/static/root/assets/{share-preview-page-CrVC0BzQ.js → share-preview-page-Dxwq4fx1.js} +1 -1
  82. package/dist/gateway/static/root/assets/{shares-settings-ZesbsEGA.js → shares-settings-CqwHm0Mf.js} +1 -1
  83. package/dist/gateway/static/root/assets/{skill-api-Deb8HqtR.js → skill-api-C9k6G-tI.js} +1 -1
  84. package/dist/gateway/static/root/assets/skill-reload-api-D9bB-ANm.js +1 -0
  85. package/dist/gateway/static/root/assets/{skills-page-Bgs9jaCc.js → skills-page-CFiCgbAs.js} +1 -1
  86. package/dist/gateway/static/root/assets/{system-settings-panel-CwD47-_i.js → system-settings-panel-1tXKr0cJ.js} +1 -1
  87. package/dist/gateway/static/root/assets/task-detail-page-BBQ3sk4y.js +1 -0
  88. package/dist/gateway/static/root/assets/{tasks-QQJXsiER.js → tasks-BH8_WMUF.js} +1 -1
  89. package/dist/gateway/static/root/assets/{tunnel-api-DtL__Vgg.js → tunnel-api-COo0rSrc.js} +1 -1
  90. package/dist/gateway/static/root/assets/{usage-page-DZ01CsLl.js → usage-page-DHXG-2Rr.js} +1 -1
  91. package/dist/gateway/static/root/assets/{use-autosave-XBFnwLd0.js → use-autosave-CJfX4SWk.js} +1 -1
  92. package/dist/gateway/static/root/assets/{user-model-page-ByACaDBG.js → user-model-page-d-Gjs-EX.js} +1 -1
  93. package/dist/gateway/static/root/assets/{voice-api-key-field-NaIj9rQC.js → voice-api-key-field-D0gWz3iO.js} +1 -1
  94. package/dist/gateway/static/root/assets/{voice-config-api-st1q4lqP.js → voice-config-api-BnnUzr07.js} +1 -1
  95. package/dist/gateway/static/root/assets/{work-discovery-overlay-D418eqa5.js → work-discovery-overlay-CDAZKFVO.js} +1 -1
  96. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CSXIidqw.js → workflow-run-setup-panel-Db0lk_9G.js} +1 -1
  97. package/dist/gateway/static/root/assets/{workflows-page-nGttfQ1r.js → workflows-page-Dj89Gagd.js} +1 -1
  98. package/dist/gateway/static/root/index.html +16 -16
  99. package/dist/package.js +1 -1
  100. package/dist/packages/endpoint-tools-protocol/src/index.js +2 -1
  101. package/dist/packages/gateway-contract/src/sessions.js +11 -0
  102. package/dist/packages/gateway-contract/src/tasks.js +1 -0
  103. package/dist/src/agent/memory/context-budget.d.ts +2 -0
  104. package/dist/src/agent/memory/context-budget.js +23 -2
  105. package/dist/src/agent/memory/context-recovery.js +2 -2
  106. package/dist/src/agent/service/direct-turn-helpers.js +2 -2
  107. package/dist/src/agent/service/process-direct-streaming.js +16 -2
  108. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -0
  109. package/dist/src/agent/tasks/task-judge-service.js +55 -33
  110. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  111. package/dist/src/agent/tool-manuals/computer.js +2 -2
  112. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  113. package/dist/src/agent/tool-manuals/xopc-use.js +28 -2
  114. package/dist/src/agent/tools/computer-use-tool.d.ts +0 -2
  115. package/dist/src/agent/tools/computer-use-tool.js +31 -19
  116. package/dist/src/agent/tools/factory.js +2 -3
  117. package/dist/src/agent/tools/xopc-use-tool.js +179 -8
  118. package/dist/src/capabilities/runtime/dispatcher.d.ts +2 -0
  119. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  120. package/dist/src/computer/broker.d.ts +6 -0
  121. package/dist/src/computer/broker.js +14 -0
  122. package/dist/src/computer/errors.js +2 -1
  123. package/dist/src/computer/model-adapter.js +3 -3
  124. package/dist/src/gateway/chat-stream/mapper.d.ts +3 -0
  125. package/dist/src/gateway/chat-stream/mapper.js +5 -1
  126. package/dist/src/gateway/chat-stream/protocol.d.ts +3 -0
  127. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  128. package/dist/src/gateway/hono/routes/sessions.js +19 -2
  129. package/dist/src/gateway/hono/routes/tasks.js +93 -0
  130. package/dist/src/gateway/service/active-execution.js +1 -1
  131. package/dist/src/gateway/service/run-gateway-agent.js +5 -1
  132. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
  133. package/dist/src/gateway/service.d.ts +2 -1
  134. package/dist/src/gateway/service.js +70 -6
  135. package/dist/src/gateway/session-context-summary.js +17 -0
  136. package/dist/src/home-intelligence/host.js +2 -2
  137. package/dist/src/session/client-history.d.ts +7 -1
  138. package/dist/src/session/client-history.js +51 -1
  139. package/dist/src/session/store.js +10 -2
  140. package/dist/src/session/types.d.ts +1 -0
  141. package/dist/src/storage/sqlite/index.d.ts +1 -1
  142. package/dist/src/storage/sqlite/index.js +2 -2
  143. package/dist/src/storage/sqlite/migrations/224_task_origin_links.sql +8 -0
  144. package/dist/src/storage/sqlite/migrations/225_task_collaboration.sql +32 -0
  145. package/dist/src/storage/sqlite/migrations/226_task_main_updates.sql +9 -0
  146. package/dist/src/storage/sqlite/migrations/227_task_main_update_decisions.sql +8 -0
  147. package/dist/src/storage/sqlite/migrations/228_task_main_agent_links.sql +14 -0
  148. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  149. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  150. package/dist/src/storage/sqlite/schema.js +1 -1
  151. package/dist/src/storage/sqlite/session-input-repository.d.ts +9 -0
  152. package/dist/src/storage/sqlite/session-input-repository.js +28 -1
  153. package/dist/src/storage/sqlite/session-repository.js +11 -0
  154. package/dist/src/tasks/capabilities/write.js +2 -0
  155. package/dist/src/tasks/index.js +2 -2
  156. package/dist/src/tasks/task-application-service.js +19 -1
  157. package/dist/src/tasks/task-collaboration-delivery.d.ts +9 -0
  158. package/dist/src/tasks/task-collaboration-delivery.js +100 -0
  159. package/dist/src/tasks/task-collaboration-repository.d.ts +52 -0
  160. package/dist/src/tasks/task-collaboration-repository.js +151 -0
  161. package/dist/src/tasks/task-context-assembler.d.ts +2 -0
  162. package/dist/src/tasks/task-context-assembler.js +23 -1
  163. package/dist/src/tasks/task-main-agent-repository.d.ts +10 -0
  164. package/dist/src/tasks/task-main-agent-repository.js +30 -0
  165. package/dist/src/tasks/task-main-update-decision-service.d.ts +21 -0
  166. package/dist/src/tasks/task-main-update-decision-service.js +118 -0
  167. package/dist/src/tasks/task-main-update-delivery.d.ts +16 -0
  168. package/dist/src/tasks/task-main-update-delivery.js +64 -0
  169. package/dist/src/tasks/task-main-update-input.d.ts +20 -0
  170. package/dist/src/tasks/task-main-update-input.js +37 -0
  171. package/dist/src/tasks/task-orchestration-metrics.d.ts +17 -0
  172. package/dist/src/tasks/task-orchestration-metrics.js +61 -0
  173. package/dist/src/tasks/task-origin-repository.d.ts +14 -0
  174. package/dist/src/tasks/task-origin-repository.js +29 -0
  175. package/dist/src/tasks/task-run-dispatcher.d.ts +3 -0
  176. package/dist/src/tasks/task-run-dispatcher.js +65 -7
  177. package/dist/src/tasks/task-run-repository.d.ts +2 -0
  178. package/dist/src/tasks/task-run-repository.js +12 -1
  179. package/dist/src/tasks/task-sidebar-hierarchy.d.ts +14 -0
  180. package/dist/src/tasks/task-sidebar-hierarchy.js +49 -0
  181. package/dist/src/tui/chat-history.js +8 -0
  182. package/dist/src/tui/tui-session-snapshot.js +4 -3
  183. package/dist/src/tui/tui.js +1 -1
  184. package/dist/src/voice/realtime/agentBroker.d.ts +4 -0
  185. package/dist/src/voice/realtime/agentBroker.js +9 -3
  186. package/dist/src/voice/realtime/agentEngine.js +47 -13
  187. package/dist/src/voice/realtime/engine.d.ts +5 -0
  188. package/dist/src/voice/realtime/omniEngine.js +66 -12
  189. package/dist/src/voice/realtime/playback-echo.js +2 -0
  190. package/dist/src/voice/realtime/runtime.d.ts +6 -0
  191. package/dist/src/voice/realtime/runtime.js +12 -0
  192. package/dist/src/voice/realtime/turnPolicy.d.ts +1 -0
  193. package/dist/src/voice/realtime/turnPolicy.js +3 -0
  194. package/package.json +3 -3
  195. package/dist/gateway/static/root/assets/computer-settings-page-CciQtKpz.js +0 -1
  196. package/dist/gateway/static/root/assets/gateway-realtime-BeUJkjA3.js +0 -1
  197. package/dist/gateway/static/root/assets/gateway-realtime-store-C-8wwbt_.js +0 -1
  198. package/dist/gateway/static/root/assets/index-Ca6iqaCn.css +0 -1
  199. package/dist/gateway/static/root/assets/index-DqQgdJHd.js +0 -106
  200. package/dist/gateway/static/root/assets/messages-CTKYRqR-.js +0 -3
  201. package/dist/gateway/static/root/assets/session-api-BY3dAGBn.js +0 -1
  202. package/dist/gateway/static/root/assets/session-manager-D10sD8IN.js +0 -16
  203. package/dist/gateway/static/root/assets/settings-advanced-gate-yIwyFL-A.js +0 -1
  204. package/dist/gateway/static/root/assets/skill-reload-api-DvWOrc3C.js +0 -1
  205. package/dist/gateway/static/root/assets/task-detail-page-DFEM3Xbj.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-CTKYRqR-.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d}from"./locale-store-B0WmWiCo.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-CS04eWY9.js";import{a as b,i as x,o as S,r as C}from"./dist-io9jFpN72.js";import{t as w}from"./skeleton-BwbyijEw.js";import{Bc as T,Bo as E,Bu as D,Ci as O,Du as k,Fs as A,Gs as j,Hs as M,Hu as N,Js as P,Ks as F,Ma as I,Mc as ee,Pi as L,Ps as R,Vi as te,Vs as z,Wu as B,Xs as V,Yl as H,_n as U,bn as W,pi as G,qc as K,qs as ne,r as re,rc as ie,sl as ae,vn as oe,wi as se,xl as ce,xo as le,yn as ue,zu as de}from"./index-DqQgdJHd.js";import{n as fe}from"./tab-completion-input-D64VNmiA.js";var q=e(t(),1),J=n(),Y=r(),pe=12e3;function me(e){let t=(0,J.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,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=u(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,Y.jsx)(`div`,{className:u(`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]=c,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`,N;t[12]===M?N=t[13]:(N=u(M),t[12]=M,t[13]=N);let P=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,Y.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||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?(I=f.voiceActive?(0,Y.jsx)(ue,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:l,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=l,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]=I):I=t[31];let R=D&&`hidden`,te=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`,z;t[32]!==R||t[33]!==te?(z=u(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,te),t[32]=R,t[33]=te,t[34]=z):z=t[34];let B;t[35]===h?B=t[36]:(B=e=>h(e.target.value),t[35]=h,t[36]=B);let V=!w,H;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]!==z||t[45]!==B||t[46]!==V?(H=(0,Y.jsx)(fe,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:he,placeholder:o.intentPlaceholder,maxLength:pe,autoFocus:V}),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]=z,t[45]=B,t[46]=V,t[47]=H):H=t[47];let U=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,W;t[48]!==s||t[49]!==_||t[50]!==U?(W=(0,Y.jsx)(L,{attachments:s,topPadded:!1,onRemove:_,className:U}),t[48]=s,t[49]=_,t[50]=U,t[51]=W):W=t[51];let G;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(G=w?null:(0,Y.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{children:o.shortcut}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,pe.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=G):G=t[55];let K;t[56]!==I||t[57]!==H||t[58]!==W||t[59]!==G||t[60]!==N||t[61]!==F?(K=(0,Y.jsxs)(`div`,{className:N,children:[F,I,H,W,G]}),t[56]=I,t[57]=H,t[58]=W,t[59]=G,t[60]=N,t[61]=F,t[62]=K):K=t[62];let ne=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,re;t[63]===ne?re=t[64]:(re=u(`flex shrink-0 items-center gap-2 border-t`,ne),t[63]=ne,t[64]=re);let ie=!w&&`mr-auto`,oe;t[65]===ie?oe=t[66]:(oe=u(`flex items-center gap-1`,ie),t[65]=ie,t[66]=oe);let ce=l||d,le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[67]=le):le=t[67];let de;t[68]!==o.attachTitle||t[69]!==g||t[70]!==ce?(de=(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ce,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:le}),t[68]=o.attachTitle,t[69]=g,t[70]=ce,t[71]=de):de=t[71];let q;t[72]!==l||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(q=f.voiceActive?null:(0,Y.jsx)(se,{disabled:l,chat:p,onStart:f.startVoiceInput}),t[72]=l,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=q):q=t[76];let me;t[77]!==oe||t[78]!==de||t[79]!==q?(me=(0,Y.jsxs)(`div`,{className:oe,children:[de,q]}),t[77]=oe,t[78]=de,t[79]=q,t[80]=me):me=t[80];let X;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(X=w?(0,Y.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]=X):X=t[84];let ge=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Z=!E||l||f.voiceActive,_e=w?`size-3.5`:`size-4`,ve;t[85]===_e?ve=t[86]:(ve=(0,Y.jsx)(ee,{className:_e,"aria-hidden":!0}),t[85]=_e,t[86]=ve);let ye;t[87]!==o.submit||t[88]!==ge||t[89]!==Z||t[90]!==ve?(ye=(0,Y.jsxs)(y,{type:`submit`,variant:`primary`,className:ge,disabled:Z,children:[ve,o.submit]}),t[87]=o.submit,t[88]=ge,t[89]=Z,t[90]=ve,t[91]=ye):ye=t[91];let Q;t[92]!==re||t[93]!==me||t[94]!==X||t[95]!==ye?(Q=(0,Y.jsxs)(`div`,{className:re,children:[me,X,ye]}),t[92]=re,t[93]=me,t[94]=X,t[95]=ye,t[96]=Q):Q=t[96];let be;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==K||t[102]!==Q||t[103]!==A||t[104]!==j?(be=(0,Y.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,K,Q]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=K,t[102]=Q,t[103]=A,t[104]=j,t[105]=be):be=t[105],be}function he(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function X(e){let t=(0,J.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function ge(e){let t=(0,J.c)(69),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.sceneAction||t[7]!==r.sceneHint||t[8]!==r.why||t[9]!==i||t[10]!==n.capabilities||t[11]!==n.continuation||t[12]!==n.estimatedMinutes||t[13]!==n.outcome||t[14]!==n.rationale||t[15]!==n.title){let e=n.capabilities.filter(_e),d;t[22]===r.aiLabel?d=t[23]:(d=(0,Y.jsx)(`span`,{children:r.aiLabel}),t[22]=r.aiLabel,t[23]=d);let f;t[24]!==r.minutes||t[25]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[24]=r.minutes,t[25]=n.estimatedMinutes,t[26]=f):f=t[26];let p;t[27]!==d||t[28]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[27]=d,t[28]=f,t[29]=p):p=t[29];let m;t[30]!==r.history||t[31]!==i?(m=(0,Y.jsx)(X,{label:r.history,onClick:i}),t[30]=r.history,t[31]=i,t[32]=m):m=t[32],t[33]!==m||t[34]!==p?(a=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[33]=m,t[34]=p,t[35]=a):a=t[35],t[36]===n.title?o=t[37]:(o=(0,Y.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[36]=n.title,t[37]=o),t[38]===n.outcome?s=t[39]:(s=(0,Y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[38]=n.outcome,t[39]=s);let h;t[40]===r.why?h=t[41]:(h=(0,Y.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[40]=r.why,t[41]=h),t[42]!==n.rationale||t[43]!==h?(c=(0,Y.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[42]=n.rationale,t[43]=h,t[44]=c):c=t[44],t[45]!==r.automationAction||t[46]!==r.automationHint||t[47]!==r.sceneAction||t[48]!==r.sceneHint||t[49]!==n.continuation?(l=n.continuation?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.continuation.kind===`automation`?r.automationHint:r.sceneHint}),(0,Y.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n.continuation.kind===`automation`?r.automationAction:r.sceneAction})]}):null,t[45]=r.automationAction,t[46]=r.automationHint,t[47]=r.sceneAction,t[48]=r.sceneHint,t[49]=n.continuation,t[50]=l):l=t[50],u=e.length>0?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.sceneAction,t[7]=r.sceneHint,t[8]=r.why,t[9]=i,t[10]=n.capabilities,t[11]=n.continuation,t[12]=n.estimatedMinutes,t[13]=n.outcome,t[14]=n.rationale,t[15]=n.title,t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u}else a=t[16],o=t[17],s=t[18],c=t[19],l=t[20],u=t[21];let d;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(N,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[51]=d):d=t[51];let f;t[52]===r.evidence?f=t[53]:(f=(0,Y.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[52]=r.evidence,t[53]=f);let p;t[54]===n.evidence?p=t[55]:(p=n.evidence.map(Z),t[54]=n.evidence,t[55]=p);let m;t[56]===p?m=t[57]:(m=(0,Y.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[56]=p,t[57]=m);let h;t[58]!==m||t[59]!==f?(h=(0,Y.jsxs)(`details`,{className:`mt-4 group`,children:[f,m]}),t[58]=m,t[59]=f,t[60]=h):h=t[60];let g;return t[61]!==a||t[62]!==h||t[63]!==o||t[64]!==s||t[65]!==c||t[66]!==l||t[67]!==u?(g=(0,Y.jsxs)(Y.Fragment,{children:[a,o,s,c,l,u,h]}),t[61]=a,t[62]=h,t[63]=o,t[64]=s,t[65]=c,t[66]=l,t[67]=u,t[68]=g):g=t[68],g}function Z(e){return(0,Y.jsx)(`li`,{children:e.href?(0,Y.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function _e(e){return e.readiness!==`ready`}function ve(e){let t=(0,J.c)(130),{advisor:n,copy:r,busy:i,onRefresh:o,onAction:s,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,b;t[7]===g[0]?.id?b=t[8]:(b=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=b);let x=g[0]?.id,S;if(t[9]!==n.state||t[10]!==x?(S=[n.state,x],t[9]=n.state,t[10]=x,t[11]=S):S=t[11],(0,q.useEffect)(b,S),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(a,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let o;t[17]!==n||t[18]!==i?(o=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=o):o=t[19];let s;t[20]!==r.history||t[21]!==u?(s=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=s):s=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,Y.jsx)(y,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Y.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==s||t[27]!==l?(d=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[s,l]}),t[26]=s,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==o?(p=(0,Y.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,o,d]})}),t[29]=d,t[30]=o,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,Y.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let C=d?.opportunityId===v.id?d.value:void 0,w;t[56]!==n.stale||t[57]!==r.refreshing?(w=n.stale?(0,Y.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Y.jsx)(K,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=w):w=t[58];let E;t[59]!==r||t[60]!==u||t[61]!==v?(E=(0,Y.jsx)(ge,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=E):E=t[62];let D;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==s||t[69]!==v||t[70]!==C?(D=C?.state===`needs_setup`?(0,Y.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:C.blockers.map(ye)}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[C.recoveryActions.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),C.degradedAction?(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=s,t[69]=v,t[70]=C,t[71]=D):D=t[71];let O;t[72]!==i||t[73]!==r.start||t[74]!==s||t[75]!==v?(O=v.actions.canStart?(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`start`),children:[(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=s,t[75]=v,t[76]=O):O=t[76];let k;t[77]!==i||t[78]!==r.discuss||t[79]!==s||t[80]!==v?(k=v.actions.canDiscuss?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`discuss`),children:[(0,Y.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=s,t[80]=v,t[81]=k):k=t[81];let A;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(K,{className:`size-4`,"aria-hidden":!0}),t[82]=A):A=t[82];let j;t[83]!==i||t[84]!==r.refresh||t[85]!==o?(j=(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:o,title:r.refresh,children:[A,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=o,t[86]=j):j=t[86];let M;t[87]===r.feedback?M=t[88]:(M=(0,Y.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=M);let N;t[89]===r.alreadyDone?N=t[90]:(N=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=N);let P;t[91]===r.irrelevant?P=t[92]:(P=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=P);let F;t[93]===r.later?F=t[94]:(F=[`too_early`,r.later],t[93]=r.later,t[94]=F);let I;t[95]===r.sourceIncorrect?I=t[96]:(I=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=I);let L;t[97]===r.lessLikeThis?L=t[98]:(L=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=L);let R;t[99]!==N||t[100]!==P||t[101]!==F||t[102]!==I||t[103]!==L?(R=[N,P,F,I,L],t[99]=N,t[100]=P,t[101]=F,t[102]=I,t[103]=L,t[104]=R):R=t[104];let te=R,z;t[105]!==c||t[106]!==v||t[107]!==te?(z=(0,Y.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:te.map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=te,t[108]=z):z=t[108];let B;t[109]!==M||t[110]!==z?(B=(0,Y.jsxs)(`details`,{className:`relative ml-auto`,children:[M,z]}),t[109]=M,t[110]=z,t[111]=B):B=t[111];let V;t[112]!==k||t[113]!==j||t[114]!==B||t[115]!==O?(V=(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[O,k,j,B]}),t[112]=k,t[113]=j,t[114]=B,t[115]=O,t[116]=V):V=t[116];let H;t[117]!==V||t[118]!==w||t[119]!==E||t[120]!==D?(H=(0,Y.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[w,E,D,V]}),t[117]=V,t[118]=w,t[119]=E,t[120]=D,t[121]=H):H=t[121];let U;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(U=g.length>1?(0,Y.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=U):U=t[125];let W;return t[126]!==r.aiLabel||t[127]!==H||t[128]!==U?(W=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[H,U]}),t[126]=r.aiLabel,t[127]=H,t[128]=U,t[129]=W):W=t[129],W}function ye(e){return(0,Y.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Q=new Set([`started`,`discussing`,`completed`]);function be(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(xe)}),e[0]=t):t=e[0],t}function xe(e){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Y.jsx)(w,{className:`h-4 w-24 rounded`}),(0,Y.jsx)(w,{className:`h-5 w-4/5 rounded`}),(0,Y.jsx)(w,{className:`h-4 w-3/5 rounded`})]},e)}function Se(e){let t=(0,J.c)(11),{open:n,refreshKey:r,onOpenChange:a,onReevaluate:s}=e,u=d(we),b=l(u).projectsPage.home,x=i(),[S,C]=(0,q.useState)(`all`),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[0]=w):w=t[0];let[T,E]=(0,q.useState)(w),[D,O]=(0,q.useState)(!1),[A,j]=(0,q.useState)(),P;t[1]===n?P=t[2]:(P=()=>{if(!n)return;let e=!0;return O(!0),j(void 0),M().then(t=>{e&&E(t.items)}).catch(t=>{e&&j(t instanceof Error?t.message:String(t))}).finally(()=>{e&&O(!1)}),()=>{e=!1}},t[1]=n,t[2]=P);let F;t[3]!==n||t[4]!==r?(F=[n,r],t[3]=n,t[4]=r,t[5]=F):F=t[5],(0,q.useEffect)(P,F);let I=T.filter(e=>S===`all`||(S===`adopted`?Q.has(e.status):!Q.has(e.status))),ee=new Intl.DateTimeFormat(u===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(u===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of I){let t=ee.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let te=[...R.entries()],z=e=>e.feedbackKind===`already_done`?b.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?b.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?b.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?b.advisorHistoryStatusLessLikeThis:{available:b.advisorHistoryStatusAvailable,started:b.advisorHistoryStatusStarted,discussing:b.advisorHistoryStatusDiscussing,completed:b.advisorHistoryStatusCompleted,snoozed:b.advisorHistoryStatusSnoozed,dismissed:b.advisorHistoryStatusDismissed,expired:b.advisorHistoryStatusExpired,superseded:b.advisorHistoryStatusSuperseded}[e.status],B=e=>{if(e.href){a(!1),x(e.href);return}e.status===`discussing`&&(a(!1),x(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},V;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=V):V=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Y.jsx)(H,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[8]=W):W=t[8];let G=D?(0,Y.jsx)(be,{}):A?(0,Y.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Y.jsx)(`p`,{children:b.advisorHistoryLoadFailed}),(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>a(!1),children:b.advisorHistoryClose})]}):te.length===0?(0,Y.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Y.jsx)(H,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:b.advisorHistoryEmpty}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.advisorHistoryEmptyHint})]}):(0,Y.jsx)(`div`,{className:`space-y-6`,children:te.map(e=>{let[t,n]=e;return(0,Y.jsxs)(`section`,{"aria-label":t,children:[(0,Y.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Y.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:z(e)}),(0,Y.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Y.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),b.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Y.jsxs)(`details`,{className:`group mt-3`,children:[(0,Y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[b.advisorHistoryEvidence,(0,Y.jsx)(N,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(Ce)})]}),t||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>B(e),children:[(0,Y.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?b.advisorHistoryContinueDiscussion:b.advisorHistoryViewProgress]}):null,n?(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{a(!1),s()},children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),b.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ne;return t[9]===G?ne=t[10]:(ne=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:G}),t[9]=G,t[10]=ne),(0,Y.jsx)(v,{open:n,onOpenChange:a,children:(0,Y.jsxs)(h,{children:[V,(0,Y.jsxs)(g,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[U,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(_,{className:`text-base font-semibold text-fg`,children:b.advisorHistoryTitle}),(0,Y.jsx)(p,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.advisorHistoryDescription})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":b.advisorHistoryClose,children:W})})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Y.jsx)(`div`,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":b.advisorHistoryFilterLabel,children:[[`all`,b.advisorHistoryFilterAll],[`adopted`,b.advisorHistoryFilterAdopted],[`other`,b.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${S===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":S===t,onClick:()=>C(t),children:n},t)})})}),ne]})]})})}function Ce(e){return(0,Y.jsx)(`li`,{children:e.observation},e.id)}function we(e){return e.language}function Te(e,t){return e.replace(`{{count}}`,String(t))}function $(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Te(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Ee={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function De(e){let t=(0,J.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=$(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let d=l;if(!d)return null;let f=n.state!==`refreshing`,p=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${d.label}`,h;t[3]===d.refreshing?h=t[4]:(h=d.refreshing?(0,Y.jsx)(K,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=d.refreshing,t[4]=h);let g=Ee[d.tone],_;t[5]===g?_=t[6]:(_=u(`size-1.5 shrink-0 rounded-full`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Y.jsx)(`span`,{className:_,"aria-hidden":!0}),t[7]=_,t[8]=v);let w;t[9]!==i.label||t[10]!==d.label?(w=(0,Y.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,d.label]}),t[9]=i.label,t[10]=d.label,t[11]=w):w=t[11];let T;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==w?(T=(0,Y.jsx)(S,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[h,v,w]})}),t[12]=m,t[13]=h,t[14]=v,t[15]=w,t[16]=T):T=t[16];let E;t[17]===d.refreshing?E=t[18]:(E=(0,Y.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:d.refreshing?(0,Y.jsx)(K,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=d.refreshing,t[18]=E);let D;t[19]===d.label?D=t[20]:(D=(0,Y.jsx)(`p`,{className:`font-semibold text-fg`,children:d.label}),t[19]=d.label,t[20]=D);let O;t[21]===d.detail?O=t[22]:(O=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[21]=d.detail,t[22]=O);let k;t[23]!==D||t[24]!==O?(k=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]===a?j=t[30]:(j=()=>{c(!1),a()},t[29]=a,t[30]=j);let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[31]=M):M=t[31];let N;t[32]!==i.history||t[33]!==j?(N=(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:j,children:[M,i.history]}),t[32]=i.history,t[33]=j,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==f||t[37]!==o||t[38]!==p?(P=f?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),p]}):null,t[35]=r,t[36]=f,t[37]=o,t[38]=p,t[39]=P):P=t[39];let F;t[40]!==N||t[41]!==P?(F=(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[N,P]}),t[40]=N,t[41]=P,t[42]=F):F=t[42];let I;t[43]!==A||t[44]!==F?(I=(0,Y.jsx)(x,{children:(0,Y.jsxs)(C,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Oe,children:[A,F]})}),t[43]=A,t[44]=F,t[45]=I):I=t[45];let L;return t[46]!==s||t[47]!==I||t[48]!==T?(L=(0,Y.jsxs)(b,{open:s,onOpenChange:c,children:[T,I]}),t[46]=s,t[47]=I,t[48]=T,t[49]=L):L=t[49],L}function Oe(e){return e.preventDefault()}function ke(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ae(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(w,{className:`h-10 w-3/5 rounded-xl`}),(0,Y.jsx)(w,{className:`h-5 w-4/5 rounded-lg`})]}),(0,Y.jsx)(w,{className:`h-64 rounded-2xl`}),(0,Y.jsx)(w,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function je(e){let t=(0,J.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} ${G(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,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,Y.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,Y.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,Y.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 Me(e){let t=(0,J.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,Y.jsx)(B,{className:`size-4`,"aria-hidden":!0}):(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsx)(D,{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,Y.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 Ne(){let e=d(e=>e.language),t=l(e),n=t.projectsPage,r=ie(e),a=i(),o=le(e=>e.setPageHeader),u=le(e=>e.clearPageHeader),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(!0),[w,T]=(0,q.useState)(null),[D,k]=(0,q.useState)(!1),[M,N]=(0,q.useState)(``),[ee,L]=(0,q.useState)(null),[B,H]=(0,q.useState)(!1),[G,K]=(0,q.useState)(),[ae,se]=(0,q.useState)(!1),[ce,ue]=(0,q.useState)(0),[fe,J]=(0,q.useState)(),[pe,he]=(0,q.useState)(),[X,ge]=(0,q.useState)(!1),Z=O({chat:t.chat}),_e=(0,q.useRef)(null),ye=E({disabled:X,chat:t.chat,onTranscript:e=>{N(t=>W(t,e)),window.setTimeout(()=>_e.current?.focus(),0)}}),{phase:Q,voiceActive:be,startVoiceInput:xe,cancelVoiceInput:Ce,confirmVoiceInput:we,retryVoiceInput:Te}=ye,$=(0,q.useCallback)(async(t=!1)=>{t&&C(!0),T(null);try{x(await z(e))}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e]);(0,q.useEffect)(()=>{$(!0)},[$]),(0,q.useEffect)(()=>{if(!fe)return;let e=window.setTimeout(()=>J(void 0),8e3);return()=>window.clearTimeout(e)},[fe]),(0,q.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,$()},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`,`home-advisor-updated`],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)}},[$]);let Ee=(0,q.useCallback)(async e=>{if(!(e.length===0||X)){ge(!0);try{await Z.processFiles(e)}finally{ge(!1)}}},[X,Z.processFiles]),Oe=(0,q.useCallback)(async e=>{let t=te(e.clipboardData);t.length!==0&&(e.preventDefault(),await Ee(t))},[Ee]),Ne=(0,q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Z.setIsDragging(!0))},[Z.setIsDragging]),Pe=(0,q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&Z.setIsDragging(!1)},[Z.setIsDragging]),Fe=(0,q.useCallback)(async e=>{e.preventDefault(),Z.setIsDragging(!1),await Ee(Array.from(e.dataTransfer.files))},[Z.setIsDragging,Ee]),Ie=(0,q.useCallback)(e=>{e.preventDefault();let t=Z.wireAttachmentsPayload(),n=I(M,t.length>0?re(t):void 0,{projectScope:`none`});n&&(k(!1),N(``),Z.clearAttachments(),a(n))},[Z.clearAttachments,Z.wireAttachmentsPayload,M,a]),Le=Z.attachments.length>=10,Re={attachTitle:Le?ke(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${Z.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},ze=(0,q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Be=!!(b&&b.needsUser.length===0&&b.backgroundCount===0),Ve=!!(b&&b.needsUser.length===0),He=Ve||D;(0,q.useEffect)(()=>{!He&&be&&Ce()},[Ce,He,be]),(0,q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!He||X||(e.preventDefault(),Q===`recording`?we():Q===`idle`?(_e.current?.focus(),xe()):Q===`error`&&Te())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!He||!be||(e.preventDefault(),Ce(),_e.current?.focus())};return window.addEventListener(oe,e),window.addEventListener(U,t),()=>{window.removeEventListener(oe,e),window.removeEventListener(U,t)}},[X,Ce,He,we,Te,xe,be,Q]);let Ue=(0,q.useCallback)(e=>{e||Ce(),k(e)},[Ce]),We=(0,q.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}L(t),T(null),(async()=>{try{e.type===`connector_decision`?await F({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await ne({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await R({kind:e.subjectKind,runId:e.runId}),await $()}catch(e){T(e instanceof Error?e.message:String(e))}finally{L(null)}})()},[$,a]),Ge=(0,q.useCallback)(()=>{H(!0),K(void 0),he(void 0),T(null),j(e).then(()=>$()).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[e,$]),Ke=(0,q.useCallback)((e,t)=>{H(!0),T(null),A(e,t).then(async t=>{if(t.outcome===`needs_setup`){he({opportunityId:e.id,value:t.preflight});return}if(he(void 0),ue(e=>e+1),t.outcome===`task`){K({title:n.home.advisorStartedTitle,detail:ke(n.home.advisorStartedDetail,{title:e.title}),href:t.href}),await $();return}a(t.href)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[$,a,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),qe=(0,q.useCallback)((e,t)=>{H(!0),K(void 0),he(void 0),T(null),P(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(J({opportunityId:e.id,idempotencyKey:t}),ue(e=>e+1),$())).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[$]),Je=(0,q.useCallback)(()=>{if(!fe)return;let e=fe;J(void 0),H(!0),T(null),V(e.opportunityId,e.idempotencyKey).then(()=>(ue(e=>e+1),$())).catch(t=>{J(e),T(t instanceof Error?t.message:String(t))}).finally(()=>H(!1))},[fe,$]),Ye=(0,q.useCallback)((e,t)=>{a(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[a]),Xe=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[b?(0,Y.jsx)(De,{advisor:b.advisor,busy:B,copy:ze,onOpenHistory:()=>se(!0),onRefresh:Ge}):null,Ve?null:(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>k(!0),children:[(0,Y.jsx)(s,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[B,ze,r.newWork,b,Ge,Ve]);(0,q.useLayoutEffect)(()=>(o({startExtra:null,main:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Xe}),()=>u()),[u,Xe,o,n.title]);let Ze=b?.needsUser.length??0,Qe=b?.backgroundCount??0,$e=Ze>0?ke(n.home.attentionTitle,{count:Ze}):Qe>0?n.home.clearTitle:n.home.idleTitle,et=Ze>0?Qe>0?ke(n.home.attentionIntroWithBackground,{count:Qe}):n.home.attentionIntro:Qe>0?ke(n.home.clearIntro,{count:Qe}):n.home.idleIntro;return(0,Y.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,Y.jsx)(`input`,{ref:Z.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Ee(Array.from(t)),e.target.value=``}}),(0,Y.jsx)(v,{open:D,onOpenChange:Ue,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(g,{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-overlay shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Y.jsx)(p,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.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,Y.jsx)(c,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsx)(me,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:_e,intent:M,labels:{...Re,submit:r.submit},attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Le,voice:ye,chat:t.chat,cancelAction:(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:N,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void Oe(e),onDragOver:Ne,onDragLeave:Pe,onDrop:e=>void Fe(e),onSubmit:Ie})]})]})}),(0,Y.jsx)(Se,{open:ae,refreshKey:ce,onOpenChange:se,onReevaluate:Ge}),w?(0,Y.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,Y.jsx)(`span`,{children:w}),(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,S?(0,Y.jsx)(Ae,{}):b?(0,Y.jsxs)(`div`,{className:Be?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,Y.jsxs)(`section`,{className:Be?`w-full text-center`:`max-w-3xl`,children:[(0,Y.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:$e}),(0,Y.jsx)(`p`,{className:Be?`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:et})]}),Ve?(0,Y.jsx)(me,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:_e,intent:M,labels:Re,attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Le,voice:ye,chat:t.chat,onIntentChange:N,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void Oe(e),onDragOver:Ne,onDragLeave:Pe,onDrop:e=>void Fe(e),onSubmit:Ie}):null,(0,Y.jsx)(ve,{advisor:b.advisor,busy:B,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,sceneHint:n.home.advisorSceneHint,sceneAction:n.home.advisorSceneAction,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Ge,onAction:Ke,onFeedback:qe,onClarification:Ye,onOpenHistory:()=>se(!0),preflight:pe,receipt:G}),b.needsUser.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,Y.jsx)(de,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:b.needsUser.map(t=>(0,Y.jsx)(je,{item:t,busy:ee===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:We},t.id))})]}):null,b.background.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,Y.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ke(n.home.backgroundCount,{count:b.backgroundCount})})]}),(0,Y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:b.background.map(e=>(0,Y.jsx)(Me,{item:e,onAction:We},e.id))})]}):null]}):null,fe?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Je,children:n.home.advisorUndo})]}):null]})}export{Ne 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{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-aVTaD9Mj.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d}from"./locale-store-B008NR-f.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-CS04eWY9.js";import{a as b,i as x,o as S,r as C}from"./dist-io9jFpN72.js";import{t as w}from"./skeleton-BwbyijEw.js";import{Bc as T,Bo as E,Bu as D,Ci as O,Du as k,Fs as A,Gs as j,Hs as M,Hu as N,Js as P,Ks as F,Ma as I,Mc as ee,Pi as L,Ps as R,Vi as te,Vs as z,Wu as B,Xs as V,Yl as H,_n as U,bn as W,pi as G,qc as K,qs as ne,r as re,rc as ie,sl as ae,vn as oe,wi as se,xl as ce,xo as le,yn as ue,zu as de}from"./index-DsIQD44S.js";import{n as fe}from"./tab-completion-input-D64VNmiA.js";var q=e(t(),1),J=n(),Y=r(),pe=12e3;function me(e){let t=(0,J.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,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=u(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,Y.jsx)(`div`,{className:u(`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]=c,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`,N;t[12]===M?N=t[13]:(N=u(M),t[12]=M,t[13]=N);let P=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,Y.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||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?(I=f.voiceActive?(0,Y.jsx)(ue,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:l,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=l,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]=I):I=t[31];let R=D&&`hidden`,te=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`,z;t[32]!==R||t[33]!==te?(z=u(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,te),t[32]=R,t[33]=te,t[34]=z):z=t[34];let B;t[35]===h?B=t[36]:(B=e=>h(e.target.value),t[35]=h,t[36]=B);let V=!w,H;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]!==z||t[45]!==B||t[46]!==V?(H=(0,Y.jsx)(fe,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:he,placeholder:o.intentPlaceholder,maxLength:pe,autoFocus:V}),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]=z,t[45]=B,t[46]=V,t[47]=H):H=t[47];let U=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,W;t[48]!==s||t[49]!==_||t[50]!==U?(W=(0,Y.jsx)(L,{attachments:s,topPadded:!1,onRemove:_,className:U}),t[48]=s,t[49]=_,t[50]=U,t[51]=W):W=t[51];let G;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(G=w?null:(0,Y.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{children:o.shortcut}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,pe.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=G):G=t[55];let K;t[56]!==I||t[57]!==H||t[58]!==W||t[59]!==G||t[60]!==N||t[61]!==F?(K=(0,Y.jsxs)(`div`,{className:N,children:[F,I,H,W,G]}),t[56]=I,t[57]=H,t[58]=W,t[59]=G,t[60]=N,t[61]=F,t[62]=K):K=t[62];let ne=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,re;t[63]===ne?re=t[64]:(re=u(`flex shrink-0 items-center gap-2 border-t`,ne),t[63]=ne,t[64]=re);let ie=!w&&`mr-auto`,oe;t[65]===ie?oe=t[66]:(oe=u(`flex items-center gap-1`,ie),t[65]=ie,t[66]=oe);let ce=l||d,le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[67]=le):le=t[67];let de;t[68]!==o.attachTitle||t[69]!==g||t[70]!==ce?(de=(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ce,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:le}),t[68]=o.attachTitle,t[69]=g,t[70]=ce,t[71]=de):de=t[71];let q;t[72]!==l||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(q=f.voiceActive?null:(0,Y.jsx)(se,{disabled:l,chat:p,onStart:f.startVoiceInput}),t[72]=l,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=q):q=t[76];let me;t[77]!==oe||t[78]!==de||t[79]!==q?(me=(0,Y.jsxs)(`div`,{className:oe,children:[de,q]}),t[77]=oe,t[78]=de,t[79]=q,t[80]=me):me=t[80];let X;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(X=w?(0,Y.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]=X):X=t[84];let ge=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Z=!E||l||f.voiceActive,_e=w?`size-3.5`:`size-4`,ve;t[85]===_e?ve=t[86]:(ve=(0,Y.jsx)(ee,{className:_e,"aria-hidden":!0}),t[85]=_e,t[86]=ve);let ye;t[87]!==o.submit||t[88]!==ge||t[89]!==Z||t[90]!==ve?(ye=(0,Y.jsxs)(y,{type:`submit`,variant:`primary`,className:ge,disabled:Z,children:[ve,o.submit]}),t[87]=o.submit,t[88]=ge,t[89]=Z,t[90]=ve,t[91]=ye):ye=t[91];let Q;t[92]!==re||t[93]!==me||t[94]!==X||t[95]!==ye?(Q=(0,Y.jsxs)(`div`,{className:re,children:[me,X,ye]}),t[92]=re,t[93]=me,t[94]=X,t[95]=ye,t[96]=Q):Q=t[96];let be;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==K||t[102]!==Q||t[103]!==A||t[104]!==j?(be=(0,Y.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,K,Q]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=K,t[102]=Q,t[103]=A,t[104]=j,t[105]=be):be=t[105],be}function he(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function X(e){let t=(0,J.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function ge(e){let t=(0,J.c)(69),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.sceneAction||t[7]!==r.sceneHint||t[8]!==r.why||t[9]!==i||t[10]!==n.capabilities||t[11]!==n.continuation||t[12]!==n.estimatedMinutes||t[13]!==n.outcome||t[14]!==n.rationale||t[15]!==n.title){let e=n.capabilities.filter(_e),d;t[22]===r.aiLabel?d=t[23]:(d=(0,Y.jsx)(`span`,{children:r.aiLabel}),t[22]=r.aiLabel,t[23]=d);let f;t[24]!==r.minutes||t[25]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[24]=r.minutes,t[25]=n.estimatedMinutes,t[26]=f):f=t[26];let p;t[27]!==d||t[28]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[27]=d,t[28]=f,t[29]=p):p=t[29];let m;t[30]!==r.history||t[31]!==i?(m=(0,Y.jsx)(X,{label:r.history,onClick:i}),t[30]=r.history,t[31]=i,t[32]=m):m=t[32],t[33]!==m||t[34]!==p?(a=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[33]=m,t[34]=p,t[35]=a):a=t[35],t[36]===n.title?o=t[37]:(o=(0,Y.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[36]=n.title,t[37]=o),t[38]===n.outcome?s=t[39]:(s=(0,Y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[38]=n.outcome,t[39]=s);let h;t[40]===r.why?h=t[41]:(h=(0,Y.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[40]=r.why,t[41]=h),t[42]!==n.rationale||t[43]!==h?(c=(0,Y.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[42]=n.rationale,t[43]=h,t[44]=c):c=t[44],t[45]!==r.automationAction||t[46]!==r.automationHint||t[47]!==r.sceneAction||t[48]!==r.sceneHint||t[49]!==n.continuation?(l=n.continuation?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.continuation.kind===`automation`?r.automationHint:r.sceneHint}),(0,Y.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n.continuation.kind===`automation`?r.automationAction:r.sceneAction})]}):null,t[45]=r.automationAction,t[46]=r.automationHint,t[47]=r.sceneAction,t[48]=r.sceneHint,t[49]=n.continuation,t[50]=l):l=t[50],u=e.length>0?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.sceneAction,t[7]=r.sceneHint,t[8]=r.why,t[9]=i,t[10]=n.capabilities,t[11]=n.continuation,t[12]=n.estimatedMinutes,t[13]=n.outcome,t[14]=n.rationale,t[15]=n.title,t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u}else a=t[16],o=t[17],s=t[18],c=t[19],l=t[20],u=t[21];let d;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(N,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[51]=d):d=t[51];let f;t[52]===r.evidence?f=t[53]:(f=(0,Y.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[52]=r.evidence,t[53]=f);let p;t[54]===n.evidence?p=t[55]:(p=n.evidence.map(Z),t[54]=n.evidence,t[55]=p);let m;t[56]===p?m=t[57]:(m=(0,Y.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[56]=p,t[57]=m);let h;t[58]!==m||t[59]!==f?(h=(0,Y.jsxs)(`details`,{className:`mt-4 group`,children:[f,m]}),t[58]=m,t[59]=f,t[60]=h):h=t[60];let g;return t[61]!==a||t[62]!==h||t[63]!==o||t[64]!==s||t[65]!==c||t[66]!==l||t[67]!==u?(g=(0,Y.jsxs)(Y.Fragment,{children:[a,o,s,c,l,u,h]}),t[61]=a,t[62]=h,t[63]=o,t[64]=s,t[65]=c,t[66]=l,t[67]=u,t[68]=g):g=t[68],g}function Z(e){return(0,Y.jsx)(`li`,{children:e.href?(0,Y.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function _e(e){return e.readiness!==`ready`}function ve(e){let t=(0,J.c)(130),{advisor:n,copy:r,busy:i,onRefresh:o,onAction:s,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,b;t[7]===g[0]?.id?b=t[8]:(b=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=b);let x=g[0]?.id,S;if(t[9]!==n.state||t[10]!==x?(S=[n.state,x],t[9]=n.state,t[10]=x,t[11]=S):S=t[11],(0,q.useEffect)(b,S),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(a,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let o;t[17]!==n||t[18]!==i?(o=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=o):o=t[19];let s;t[20]!==r.history||t[21]!==u?(s=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=s):s=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,Y.jsx)(y,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Y.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==s||t[27]!==l?(d=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[s,l]}),t[26]=s,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==o?(p=(0,Y.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,o,d]})}),t[29]=d,t[30]=o,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,Y.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let C=d?.opportunityId===v.id?d.value:void 0,w;t[56]!==n.stale||t[57]!==r.refreshing?(w=n.stale?(0,Y.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Y.jsx)(K,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=w):w=t[58];let E;t[59]!==r||t[60]!==u||t[61]!==v?(E=(0,Y.jsx)(ge,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=E):E=t[62];let D;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==s||t[69]!==v||t[70]!==C?(D=C?.state===`needs_setup`?(0,Y.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:C.blockers.map(ye)}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[C.recoveryActions.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),C.degradedAction?(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=s,t[69]=v,t[70]=C,t[71]=D):D=t[71];let O;t[72]!==i||t[73]!==r.start||t[74]!==s||t[75]!==v?(O=v.actions.canStart?(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`start`),children:[(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=s,t[75]=v,t[76]=O):O=t[76];let k;t[77]!==i||t[78]!==r.discuss||t[79]!==s||t[80]!==v?(k=v.actions.canDiscuss?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>s(v,`discuss`),children:[(0,Y.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=s,t[80]=v,t[81]=k):k=t[81];let A;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(K,{className:`size-4`,"aria-hidden":!0}),t[82]=A):A=t[82];let j;t[83]!==i||t[84]!==r.refresh||t[85]!==o?(j=(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:o,title:r.refresh,children:[A,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=o,t[86]=j):j=t[86];let M;t[87]===r.feedback?M=t[88]:(M=(0,Y.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=M);let N;t[89]===r.alreadyDone?N=t[90]:(N=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=N);let P;t[91]===r.irrelevant?P=t[92]:(P=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=P);let F;t[93]===r.later?F=t[94]:(F=[`too_early`,r.later],t[93]=r.later,t[94]=F);let I;t[95]===r.sourceIncorrect?I=t[96]:(I=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=I);let L;t[97]===r.lessLikeThis?L=t[98]:(L=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=L);let R;t[99]!==N||t[100]!==P||t[101]!==F||t[102]!==I||t[103]!==L?(R=[N,P,F,I,L],t[99]=N,t[100]=P,t[101]=F,t[102]=I,t[103]=L,t[104]=R):R=t[104];let te=R,z;t[105]!==c||t[106]!==v||t[107]!==te?(z=(0,Y.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:te.map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=te,t[108]=z):z=t[108];let B;t[109]!==M||t[110]!==z?(B=(0,Y.jsxs)(`details`,{className:`relative ml-auto`,children:[M,z]}),t[109]=M,t[110]=z,t[111]=B):B=t[111];let V;t[112]!==k||t[113]!==j||t[114]!==B||t[115]!==O?(V=(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[O,k,j,B]}),t[112]=k,t[113]=j,t[114]=B,t[115]=O,t[116]=V):V=t[116];let H;t[117]!==V||t[118]!==w||t[119]!==E||t[120]!==D?(H=(0,Y.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[w,E,D,V]}),t[117]=V,t[118]=w,t[119]=E,t[120]=D,t[121]=H):H=t[121];let U;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(U=g.length>1?(0,Y.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=U):U=t[125];let W;return t[126]!==r.aiLabel||t[127]!==H||t[128]!==U?(W=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[H,U]}),t[126]=r.aiLabel,t[127]=H,t[128]=U,t[129]=W):W=t[129],W}function ye(e){return(0,Y.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Q=new Set([`started`,`discussing`,`completed`]);function be(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(xe)}),e[0]=t):t=e[0],t}function xe(e){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Y.jsx)(w,{className:`h-4 w-24 rounded`}),(0,Y.jsx)(w,{className:`h-5 w-4/5 rounded`}),(0,Y.jsx)(w,{className:`h-4 w-3/5 rounded`})]},e)}function Se(e){let t=(0,J.c)(11),{open:n,refreshKey:r,onOpenChange:a,onReevaluate:s}=e,u=d(we),b=l(u).projectsPage.home,x=i(),[S,C]=(0,q.useState)(`all`),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[0]=w):w=t[0];let[T,E]=(0,q.useState)(w),[D,O]=(0,q.useState)(!1),[A,j]=(0,q.useState)(),P;t[1]===n?P=t[2]:(P=()=>{if(!n)return;let e=!0;return O(!0),j(void 0),M().then(t=>{e&&E(t.items)}).catch(t=>{e&&j(t instanceof Error?t.message:String(t))}).finally(()=>{e&&O(!1)}),()=>{e=!1}},t[1]=n,t[2]=P);let F;t[3]!==n||t[4]!==r?(F=[n,r],t[3]=n,t[4]=r,t[5]=F):F=t[5],(0,q.useEffect)(P,F);let I=T.filter(e=>S===`all`||(S===`adopted`?Q.has(e.status):!Q.has(e.status))),ee=new Intl.DateTimeFormat(u===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(u===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of I){let t=ee.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let te=[...R.entries()],z=e=>e.feedbackKind===`already_done`?b.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?b.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?b.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?b.advisorHistoryStatusLessLikeThis:{available:b.advisorHistoryStatusAvailable,started:b.advisorHistoryStatusStarted,discussing:b.advisorHistoryStatusDiscussing,completed:b.advisorHistoryStatusCompleted,snoozed:b.advisorHistoryStatusSnoozed,dismissed:b.advisorHistoryStatusDismissed,expired:b.advisorHistoryStatusExpired,superseded:b.advisorHistoryStatusSuperseded}[e.status],B=e=>{if(e.href){a(!1),x(e.href);return}e.status===`discussing`&&(a(!1),x(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},V;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=V):V=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Y.jsx)(H,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[8]=W):W=t[8];let G=D?(0,Y.jsx)(be,{}):A?(0,Y.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Y.jsx)(`p`,{children:b.advisorHistoryLoadFailed}),(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>a(!1),children:b.advisorHistoryClose})]}):te.length===0?(0,Y.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Y.jsx)(H,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:b.advisorHistoryEmpty}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.advisorHistoryEmptyHint})]}):(0,Y.jsx)(`div`,{className:`space-y-6`,children:te.map(e=>{let[t,n]=e;return(0,Y.jsxs)(`section`,{"aria-label":t,children:[(0,Y.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Y.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:z(e)}),(0,Y.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Y.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),b.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Y.jsxs)(`details`,{className:`group mt-3`,children:[(0,Y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[b.advisorHistoryEvidence,(0,Y.jsx)(N,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(Ce)})]}),t||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>B(e),children:[(0,Y.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?b.advisorHistoryContinueDiscussion:b.advisorHistoryViewProgress]}):null,n?(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{a(!1),s()},children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),b.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ne;return t[9]===G?ne=t[10]:(ne=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:G}),t[9]=G,t[10]=ne),(0,Y.jsx)(v,{open:n,onOpenChange:a,children:(0,Y.jsxs)(h,{children:[V,(0,Y.jsxs)(g,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[U,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(_,{className:`text-base font-semibold text-fg`,children:b.advisorHistoryTitle}),(0,Y.jsx)(p,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.advisorHistoryDescription})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":b.advisorHistoryClose,children:W})})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Y.jsx)(`div`,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":b.advisorHistoryFilterLabel,children:[[`all`,b.advisorHistoryFilterAll],[`adopted`,b.advisorHistoryFilterAdopted],[`other`,b.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${S===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":S===t,onClick:()=>C(t),children:n},t)})})}),ne]})]})})}function Ce(e){return(0,Y.jsx)(`li`,{children:e.observation},e.id)}function we(e){return e.language}function Te(e,t){return e.replace(`{{count}}`,String(t))}function $(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Te(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Ee={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function De(e){let t=(0,J.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=$(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let d=l;if(!d)return null;let f=n.state!==`refreshing`,p=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${d.label}`,h;t[3]===d.refreshing?h=t[4]:(h=d.refreshing?(0,Y.jsx)(K,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=d.refreshing,t[4]=h);let g=Ee[d.tone],_;t[5]===g?_=t[6]:(_=u(`size-1.5 shrink-0 rounded-full`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Y.jsx)(`span`,{className:_,"aria-hidden":!0}),t[7]=_,t[8]=v);let w;t[9]!==i.label||t[10]!==d.label?(w=(0,Y.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,d.label]}),t[9]=i.label,t[10]=d.label,t[11]=w):w=t[11];let T;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==w?(T=(0,Y.jsx)(S,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[h,v,w]})}),t[12]=m,t[13]=h,t[14]=v,t[15]=w,t[16]=T):T=t[16];let E;t[17]===d.refreshing?E=t[18]:(E=(0,Y.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:d.refreshing?(0,Y.jsx)(K,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=d.refreshing,t[18]=E);let D;t[19]===d.label?D=t[20]:(D=(0,Y.jsx)(`p`,{className:`font-semibold text-fg`,children:d.label}),t[19]=d.label,t[20]=D);let O;t[21]===d.detail?O=t[22]:(O=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[21]=d.detail,t[22]=O);let k;t[23]!==D||t[24]!==O?(k=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]===a?j=t[30]:(j=()=>{c(!1),a()},t[29]=a,t[30]=j);let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[31]=M):M=t[31];let N;t[32]!==i.history||t[33]!==j?(N=(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:j,children:[M,i.history]}),t[32]=i.history,t[33]=j,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==f||t[37]!==o||t[38]!==p?(P=f?(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),p]}):null,t[35]=r,t[36]=f,t[37]=o,t[38]=p,t[39]=P):P=t[39];let F;t[40]!==N||t[41]!==P?(F=(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[N,P]}),t[40]=N,t[41]=P,t[42]=F):F=t[42];let I;t[43]!==A||t[44]!==F?(I=(0,Y.jsx)(x,{children:(0,Y.jsxs)(C,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Oe,children:[A,F]})}),t[43]=A,t[44]=F,t[45]=I):I=t[45];let L;return t[46]!==s||t[47]!==I||t[48]!==T?(L=(0,Y.jsxs)(b,{open:s,onOpenChange:c,children:[T,I]}),t[46]=s,t[47]=I,t[48]=T,t[49]=L):L=t[49],L}function Oe(e){return e.preventDefault()}function ke(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ae(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(w,{className:`h-10 w-3/5 rounded-xl`}),(0,Y.jsx)(w,{className:`h-5 w-4/5 rounded-lg`})]}),(0,Y.jsx)(w,{className:`h-64 rounded-2xl`}),(0,Y.jsx)(w,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function je(e){let t=(0,J.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} ${G(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,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,Y.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,Y.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,Y.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 Me(e){let t=(0,J.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,Y.jsx)(B,{className:`size-4`,"aria-hidden":!0}):(0,Y.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,Y.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,Y.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,Y.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,Y.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,Y.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,Y.jsx)(D,{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,Y.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 Ne(){let e=d(e=>e.language),t=l(e),n=t.projectsPage,r=ie(e),a=i(),o=le(e=>e.setPageHeader),u=le(e=>e.clearPageHeader),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(!0),[w,T]=(0,q.useState)(null),[D,k]=(0,q.useState)(!1),[M,N]=(0,q.useState)(``),[ee,L]=(0,q.useState)(null),[B,H]=(0,q.useState)(!1),[G,K]=(0,q.useState)(),[ae,se]=(0,q.useState)(!1),[ce,ue]=(0,q.useState)(0),[fe,J]=(0,q.useState)(),[pe,he]=(0,q.useState)(),[X,ge]=(0,q.useState)(!1),Z=O({chat:t.chat}),_e=(0,q.useRef)(null),ye=E({disabled:X,chat:t.chat,onTranscript:e=>{N(t=>W(t,e)),window.setTimeout(()=>_e.current?.focus(),0)}}),{phase:Q,voiceActive:be,startVoiceInput:xe,cancelVoiceInput:Ce,confirmVoiceInput:we,retryVoiceInput:Te}=ye,$=(0,q.useCallback)(async(t=!1)=>{t&&C(!0),T(null);try{x(await z(e))}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e]);(0,q.useEffect)(()=>{$(!0)},[$]),(0,q.useEffect)(()=>{if(!fe)return;let e=window.setTimeout(()=>J(void 0),8e3);return()=>window.clearTimeout(e)},[fe]),(0,q.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,$()},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`,`home-advisor-updated`],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)}},[$]);let Ee=(0,q.useCallback)(async e=>{if(!(e.length===0||X)){ge(!0);try{await Z.processFiles(e)}finally{ge(!1)}}},[X,Z.processFiles]),Oe=(0,q.useCallback)(async e=>{let t=te(e.clipboardData);t.length!==0&&(e.preventDefault(),await Ee(t))},[Ee]),Ne=(0,q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Z.setIsDragging(!0))},[Z.setIsDragging]),Pe=(0,q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&Z.setIsDragging(!1)},[Z.setIsDragging]),Fe=(0,q.useCallback)(async e=>{e.preventDefault(),Z.setIsDragging(!1),await Ee(Array.from(e.dataTransfer.files))},[Z.setIsDragging,Ee]),Ie=(0,q.useCallback)(e=>{e.preventDefault();let t=Z.wireAttachmentsPayload(),n=I(M,t.length>0?re(t):void 0,{projectScope:`none`});n&&(k(!1),N(``),Z.clearAttachments(),a(n))},[Z.clearAttachments,Z.wireAttachmentsPayload,M,a]),Le=Z.attachments.length>=10,Re={attachTitle:Le?ke(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${Z.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},ze=(0,q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Be=!!(b&&b.needsUser.length===0&&b.backgroundCount===0),Ve=!!(b&&b.needsUser.length===0),He=Ve||D;(0,q.useEffect)(()=>{!He&&be&&Ce()},[Ce,He,be]),(0,q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!He||X||(e.preventDefault(),Q===`recording`?we():Q===`idle`?(_e.current?.focus(),xe()):Q===`error`&&Te())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!He||!be||(e.preventDefault(),Ce(),_e.current?.focus())};return window.addEventListener(oe,e),window.addEventListener(U,t),()=>{window.removeEventListener(oe,e),window.removeEventListener(U,t)}},[X,Ce,He,we,Te,xe,be,Q]);let Ue=(0,q.useCallback)(e=>{e||Ce(),k(e)},[Ce]),We=(0,q.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}L(t),T(null),(async()=>{try{e.type===`connector_decision`?await F({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await ne({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await R({kind:e.subjectKind,runId:e.runId}),await $()}catch(e){T(e instanceof Error?e.message:String(e))}finally{L(null)}})()},[$,a]),Ge=(0,q.useCallback)(()=>{H(!0),K(void 0),he(void 0),T(null),j(e).then(()=>$()).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[e,$]),Ke=(0,q.useCallback)((e,t)=>{H(!0),T(null),A(e,t).then(async t=>{if(t.outcome===`needs_setup`){he({opportunityId:e.id,value:t.preflight});return}if(he(void 0),ue(e=>e+1),t.outcome===`task`){K({title:n.home.advisorStartedTitle,detail:ke(n.home.advisorStartedDetail,{title:e.title}),href:t.href}),await $();return}a(t.href)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[$,a,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),qe=(0,q.useCallback)((e,t)=>{H(!0),K(void 0),he(void 0),T(null),P(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(J({opportunityId:e.id,idempotencyKey:t}),ue(e=>e+1),$())).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>H(!1))},[$]),Je=(0,q.useCallback)(()=>{if(!fe)return;let e=fe;J(void 0),H(!0),T(null),V(e.opportunityId,e.idempotencyKey).then(()=>(ue(e=>e+1),$())).catch(t=>{J(e),T(t instanceof Error?t.message:String(t))}).finally(()=>H(!1))},[fe,$]),Ye=(0,q.useCallback)((e,t)=>{a(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[a]),Xe=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[b?(0,Y.jsx)(De,{advisor:b.advisor,busy:B,copy:ze,onOpenHistory:()=>se(!0),onRefresh:Ge}):null,Ve?null:(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>k(!0),children:[(0,Y.jsx)(s,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[B,ze,r.newWork,b,Ge,Ve]);(0,q.useLayoutEffect)(()=>(o({startExtra:null,main:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Xe}),()=>u()),[u,Xe,o,n.title]);let Ze=b?.needsUser.length??0,Qe=b?.backgroundCount??0,$e=Ze>0?ke(n.home.attentionTitle,{count:Ze}):Qe>0?n.home.clearTitle:n.home.idleTitle,et=Ze>0?Qe>0?ke(n.home.attentionIntroWithBackground,{count:Qe}):n.home.attentionIntro:Qe>0?ke(n.home.clearIntro,{count:Qe}):n.home.idleIntro;return(0,Y.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,Y.jsx)(`input`,{ref:Z.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Ee(Array.from(t)),e.target.value=``}}),(0,Y.jsx)(v,{open:D,onOpenChange:Ue,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(g,{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-overlay shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Y.jsx)(p,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.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,Y.jsx)(c,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsx)(me,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:_e,intent:M,labels:{...Re,submit:r.submit},attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Le,voice:ye,chat:t.chat,cancelAction:(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:N,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void Oe(e),onDragOver:Ne,onDragLeave:Pe,onDrop:e=>void Fe(e),onSubmit:Ie})]})]})}),(0,Y.jsx)(Se,{open:ae,refreshKey:ce,onOpenChange:se,onReevaluate:Ge}),w?(0,Y.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,Y.jsx)(`span`,{children:w}),(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,S?(0,Y.jsx)(Ae,{}):b?(0,Y.jsxs)(`div`,{className:Be?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,Y.jsxs)(`section`,{className:Be?`w-full text-center`:`max-w-3xl`,children:[(0,Y.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:$e}),(0,Y.jsx)(`p`,{className:Be?`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:et})]}),Ve?(0,Y.jsx)(me,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:_e,intent:M,labels:Re,attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Le,voice:ye,chat:t.chat,onIntentChange:N,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void Oe(e),onDragOver:Ne,onDragLeave:Pe,onDrop:e=>void Fe(e),onSubmit:Ie}):null,(0,Y.jsx)(ve,{advisor:b.advisor,busy:B,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,sceneHint:n.home.advisorSceneHint,sceneAction:n.home.advisorSceneAction,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Ge,onAction:Ke,onFeedback:qe,onClarification:Ye,onOpenHistory:()=>se(!0),preflight:pe,receipt:G}),b.needsUser.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,Y.jsx)(de,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:b.needsUser.map(t=>(0,Y.jsx)(je,{item:t,busy:ee===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:We},t.id))})]}):null,b.background.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,Y.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ke(n.home.backgroundCount,{count:b.backgroundCount})})]}),(0,Y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:b.background.map(e=>(0,Y.jsx)(Me,{item:e,onAction:We},e.id))})]}):null]}):null,fe?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Je,children:n.home.advisorUndo})]}):null]})}export{Ne as HomePage};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-B0WmWiCo.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-B008NR-f.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-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-CTKYRqR-.js";import{t as u}from"./cn-JdwAhgNB.js";import{a as d,n as f,r as p}from"./locale-store-B0WmWiCo.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BGTk37IG.js";import{t as x}from"./button-CS04eWY9.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Bc as w,Hu as T,au as E,el as D,qu as O,ul as k}from"./index-DqQgdJHd.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M}from"./settings-loading-skeleton-CAmWMaOT.js";var N=e(t(),1);async function P(e,t,n){return(await d(p(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(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&&I(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 B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:s,locked:d,error:p,onClose:T,onRefresh:D,onSubmit:A}=e,j=l(f(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=j.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===T?Y=t[18]:(Y=e=>{e||T()},t[17]=T,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${C}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=u(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,S),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=p&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:p}),(0,B.jsx)(x,{variant:`secondary`,disabled:d,onClick:D,children:j.refresh})]}),$;t[22]!==p||t[23]!==i?($=!i&&!p&&(0,B.jsx)(M,{sections:2}),t[22]=p,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:j.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:w,title:j.personalSetup,description:j.personalSetupHint,items:G,selected:a,open:P,disabled:d,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:k,title:j.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:O,title:j.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:E,title:j.kinds.project,description:j.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:d,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:d,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:j.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[j.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=x,ke=!i||!a.size||s,Ae=s?j.importing:d?j.retry:j.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==A||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:A,children:Ae}),t[29]=Oe,t[30]=A,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(b,{open:n,onOpenChange:Y,children:(0,B.jsxs)(_,{children:[X,(0,B.jsxs)(v,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(y,{className:`text-xl font-semibold text-fg`,children:j.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(h,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j.chooseHint})]}),(0,B.jsx)(g,{asChild:!0,children:(0,B.jsx)(x,{variant:`ghost`,"aria-label":j.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.runningHint}),d&&!s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,onClick:T,children:s?j.close:j.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=l(f(fe)).imports,[o,s]=(0,N.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>s(U),t[0]=c):c=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(D,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=d):d=t[1];let p=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===p?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:p}),t[2]=p,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(T,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(x,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:c,children:[d,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=f(pe),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=a.imports,[s,c]=(0,N.useState)(),[u,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(d(G),!s)try{c(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let S;t[12]!==_||t[13]!==v||t[14]!==b?(S=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=S):S=t[15];let C;t[16]===g?C=t[17]:(C=()=>void g(),t[16]=g,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(x,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==S?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[S,w]}),t[21]=w,t[22]=S,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let D;t[26]!==p||t[27]!==u||t[28]!==s?(D=u&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(M,{sections:1})}),t[26]=p,t[27]=u,t[28]=s,t[29]=D):D=t[29];let O;return t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,D]}),t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33],O}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:d,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==l||t[4]!==s?(h=()=>l(!s),t[3]=l,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,S;t[15]===b?S=t[16]:(S=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=S);let C;t[17]===S?C=t[18]:(C=(0,B.jsx)(T,{"aria-hidden":`true`,className:S}),t[17]=S,t[18]=C);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==C?(w=(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,C]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=C,t[24]=w):w=t[24];let E=c||!m.availableCount,D;t[25]!==d||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==E||t[29]!==r?(D=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:E,onChange:d}),t[25]=d,t[26]=m.checked,t[27]=m.indeterminate,t[28]=E,t[29]=r,t[30]=D):D=t[30];let O;t[31]!==w||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,D]}),t[31]=w,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==O||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:c,onToggleAll:d}=e,p=l(f(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let S=b,C=Y(i,g),w=C.slice(0,v),E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>h(ge),t[3]=E):E=t[3];let D;t[4]===n?D=t[5]:(D=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=D);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==S.availableCount||t[10]!==S.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[S.selectedCount,`/`,S.availableCount]}),t[9]=S.availableCount,t[10]=S.selectedCount,t[11]=k):k=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(T,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:E,children:[D,O,k,M]}),t[16]=m,t[17]=D,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=s||!S.availableCount,R;t[22]!==d||t[23]!==S.checked||t[24]!==S.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:S.checked,indeterminate:S.indeterminate,disabled:I,onChange:d}),t[22]=d,t[23]=S.checked,t[24]=S.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:p.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>c(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:p.noMatches}),w.length<C.length&&(0,B.jsx)(x,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:p.showMore.replace(`{count}`,String(C.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,c=l(f(ye)).imports,[u,d]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,u,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(J,{value:u,label:c.searchWithin.replace(`{group}`,c.kinds.project),onChange:e=>{d(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),S;t[8]===b?S=t[9]:(S=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=S);let C=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:c.noMatches}),w=_.length<g.length&&(0,B.jsx)(x,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:c.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==S||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C,w]}),t[10]=v,t[11]=S,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,c=l(f(we)).imports,[d,p]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=x,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>p(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let S=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[c.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,c.chosenCount.replace(`{count}`,String(h))]}),C=d&&`rotate-180`,w;t[13]===C?w=t[14]:(w=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=w);let E;t[15]===w?E=t[16]:(E=(0,B.jsx)(T,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=E);let D;t[17]!==g||t[18]!==d||t[19]!==S||t[20]!==E||t[21]!==_||t[22]!==b?(D=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":d,onClick:_,children:[b,S,E]}),t[17]=g,t[18]=d,t[19]=S,t[20]=E,t[21]=_,t[22]=b,t[23]=D):D=t[23];let O=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":O,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==D||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[D,M]}),t[38]=D,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==d||t[46]!==a||t[47]!==c?(L=d&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:c.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=d,t[46]=a,t[47]=c,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let c=`${r}…`,l;t[3]===i?l=t[4]:(l=e=>i(e.target.value),t[3]=i,t[4]=l);let u;t[5]!==r||t[6]!==c||t[7]!==l||t[8]!==n?(u=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:c,"aria-label":r,onChange:l,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=c,t[7]=l,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==o||t[11]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12],d}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=f(Te),c;t[0]===s?c=t[1]:(c=l(s),t[0]=s,t[1]=c);let u=c.imports,[d,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==d?(v=async function(){if(_(Q),!d)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=d,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let S;t[9]===o?S=t[10]:(S=e=>o(e.target.checked),t[9]=o,t[10]=S);let C;t[11]!==i||t[12]!==b||t[13]!==S?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:S}),t[11]=i,t[12]=b,t[13]=S,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]!==C||t[23]!==E?(D=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=D):D=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==u||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(x,{variant:`ghost`,"aria-label":`${u.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:u.preview}),t[25]=r.name,t[26]=r.status,t[27]=u,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;t[33]===r.description?A=t[34]:(A=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=A);let j;t[35]!==r.status||t[36]!==r.targetName||t[37]!==u?(j=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[u.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=u,t[38]=j):j=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==d||t[42]!==m||t[43]!==g||t[44]!==u?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:d.text}),d.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:u.previewTruncated})]}):(0,B.jsx)(M,{sections:1})}),t[41]=d,t[42]=m,t[43]=g,t[44]=u,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==A||t[48]!==j||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,A,j,L,R]}),t[46]=k,t[47]=A,t[48]=j,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=l(f(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[c,u]=(0,N.useState)(!1),[d,p]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,S]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(0),k=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),k.current?.abort()}},[D]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){k.current?.abort();let t=new AbortController;k.current=t,s(e),u(!0),p(void 0),h(new Set),E(``),S(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(p(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!d||!m.size||F.current)return;F.current=!0,_(!0),E(``),w(``);let e=v??{inventoryId:d.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),u(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),u(!0),p(void 0),h(new Set),E(``),y(void 0),S(e.id),k.current?.abort();let t=new AbortController;k.current=t;try{let n=await P(`/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)}),p({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(x,{variant:`ghost`,onClick:()=>O(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(M,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.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:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.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,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(x,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),v&&r===t.id?u(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.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,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(x,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(x,{variant:`ghost`,className:`mt-3`,onClick:()=>O(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:d,selected:m,onSelected:h,busy:g,locked:g||!!v,error:T,onClose:()=>{k.current?.abort(),u(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ 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-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-aVTaD9Mj.js";import{t as u}from"./cn-JdwAhgNB.js";import{a as d,n as f,r as p}from"./locale-store-B008NR-f.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BGTk37IG.js";import{t as x}from"./button-CS04eWY9.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Bc as w,Hu as T,au as E,el as D,qu as O,ul as k}from"./index-DsIQD44S.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M}from"./settings-loading-skeleton-CAmWMaOT.js";var N=e(t(),1);async function P(e,t,n){return(await d(p(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(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&&I(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 B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:s,locked:d,error:p,onClose:T,onRefresh:D,onSubmit:A}=e,j=l(f(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=j.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===T?Y=t[18]:(Y=e=>{e||T()},t[17]=T,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${C}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=u(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,S),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=p&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:p}),(0,B.jsx)(x,{variant:`secondary`,disabled:d,onClick:D,children:j.refresh})]}),$;t[22]!==p||t[23]!==i?($=!i&&!p&&(0,B.jsx)(M,{sections:2}),t[22]=p,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:j.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:w,title:j.personalSetup,description:j.personalSetupHint,items:G,selected:a,open:P,disabled:d,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:k,title:j.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:O,title:j.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:E,title:j.kinds.project,description:j.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:d,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:d,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:j.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[j.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=x,ke=!i||!a.size||s,Ae=s?j.importing:d?j.retry:j.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==A||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:A,children:Ae}),t[29]=Oe,t[30]=A,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(b,{open:n,onOpenChange:Y,children:(0,B.jsxs)(_,{children:[X,(0,B.jsxs)(v,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(y,{className:`text-xl font-semibold text-fg`,children:j.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(h,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j.chooseHint})]}),(0,B.jsx)(g,{asChild:!0,children:(0,B.jsx)(x,{variant:`ghost`,"aria-label":j.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.runningHint}),d&&!s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,onClick:T,children:s?j.close:j.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=l(f(fe)).imports,[o,s]=(0,N.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>s(U),t[0]=c):c=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(D,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=d):d=t[1];let p=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===p?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:p}),t[2]=p,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(T,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(x,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:c,children:[d,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=f(pe),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=a.imports,[s,c]=(0,N.useState)(),[u,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(d(G),!s)try{c(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let S;t[12]!==_||t[13]!==v||t[14]!==b?(S=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=S):S=t[15];let C;t[16]===g?C=t[17]:(C=()=>void g(),t[16]=g,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(x,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==S?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[S,w]}),t[21]=w,t[22]=S,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let D;t[26]!==p||t[27]!==u||t[28]!==s?(D=u&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(M,{sections:1})}),t[26]=p,t[27]=u,t[28]=s,t[29]=D):D=t[29];let O;return t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,D]}),t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33],O}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:d,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==l||t[4]!==s?(h=()=>l(!s),t[3]=l,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,S;t[15]===b?S=t[16]:(S=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=S);let C;t[17]===S?C=t[18]:(C=(0,B.jsx)(T,{"aria-hidden":`true`,className:S}),t[17]=S,t[18]=C);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==C?(w=(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,C]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=C,t[24]=w):w=t[24];let E=c||!m.availableCount,D;t[25]!==d||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==E||t[29]!==r?(D=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:E,onChange:d}),t[25]=d,t[26]=m.checked,t[27]=m.indeterminate,t[28]=E,t[29]=r,t[30]=D):D=t[30];let O;t[31]!==w||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,D]}),t[31]=w,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==O||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:c,onToggleAll:d}=e,p=l(f(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let S=b,C=Y(i,g),w=C.slice(0,v),E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>h(ge),t[3]=E):E=t[3];let D;t[4]===n?D=t[5]:(D=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=D);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==S.availableCount||t[10]!==S.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[S.selectedCount,`/`,S.availableCount]}),t[9]=S.availableCount,t[10]=S.selectedCount,t[11]=k):k=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(T,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(x,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:E,children:[D,O,k,M]}),t[16]=m,t[17]=D,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=s||!S.availableCount,R;t[22]!==d||t[23]!==S.checked||t[24]!==S.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:S.checked,indeterminate:S.indeterminate,disabled:I,onChange:d}),t[22]=d,t[23]=S.checked,t[24]=S.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:p.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>c(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:p.noMatches}),w.length<C.length&&(0,B.jsx)(x,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:p.showMore.replace(`{count}`,String(C.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,c=l(f(ye)).imports,[u,d]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,u,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(J,{value:u,label:c.searchWithin.replace(`{group}`,c.kinds.project),onChange:e=>{d(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),S;t[8]===b?S=t[9]:(S=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=S);let C=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:c.noMatches}),w=_.length<g.length&&(0,B.jsx)(x,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:c.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==S||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C,w]}),t[10]=v,t[11]=S,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,c=l(f(we)).imports,[d,p]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=x,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>p(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let S=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[c.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,c.chosenCount.replace(`{count}`,String(h))]}),C=d&&`rotate-180`,w;t[13]===C?w=t[14]:(w=u(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=w);let E;t[15]===w?E=t[16]:(E=(0,B.jsx)(T,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=E);let D;t[17]!==g||t[18]!==d||t[19]!==S||t[20]!==E||t[21]!==_||t[22]!==b?(D=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":d,onClick:_,children:[b,S,E]}),t[17]=g,t[18]=d,t[19]=S,t[20]=E,t[21]=_,t[22]=b,t[23]=D):D=t[23];let O=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":O,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==D||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[D,M]}),t[38]=D,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==d||t[46]!==a||t[47]!==c?(L=d&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:c.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=d,t[46]=a,t[47]=c,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let c=`${r}…`,l;t[3]===i?l=t[4]:(l=e=>i(e.target.value),t[3]=i,t[4]=l);let u;t[5]!==r||t[6]!==c||t[7]!==l||t[8]!==n?(u=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:c,"aria-label":r,onChange:l,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=c,t[7]=l,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==o||t[11]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12],d}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=f(Te),c;t[0]===s?c=t[1]:(c=l(s),t[0]=s,t[1]=c);let u=c.imports,[d,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==d?(v=async function(){if(_(Q),!d)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=d,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let S;t[9]===o?S=t[10]:(S=e=>o(e.target.checked),t[9]=o,t[10]=S);let C;t[11]!==i||t[12]!==b||t[13]!==S?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:S}),t[11]=i,t[12]=b,t[13]=S,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]!==C||t[23]!==E?(D=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=D):D=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==u||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(x,{variant:`ghost`,"aria-label":`${u.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:u.preview}),t[25]=r.name,t[26]=r.status,t[27]=u,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;t[33]===r.description?A=t[34]:(A=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=A);let j;t[35]!==r.status||t[36]!==r.targetName||t[37]!==u?(j=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[u.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=u,t[38]=j):j=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==d||t[42]!==m||t[43]!==g||t[44]!==u?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:d.text}),d.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:u.previewTruncated})]}):(0,B.jsx)(M,{sections:1})}),t[41]=d,t[42]=m,t[43]=g,t[44]=u,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==A||t[48]!==j||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,A,j,L,R]}),t[46]=k,t[47]=A,t[48]=j,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=l(f(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[c,u]=(0,N.useState)(!1),[d,p]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,S]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(0),k=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),k.current?.abort()}},[D]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){k.current?.abort();let t=new AbortController;k.current=t,s(e),u(!0),p(void 0),h(new Set),E(``),S(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(p(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!d||!m.size||F.current)return;F.current=!0,_(!0),E(``),w(``);let e=v??{inventoryId:d.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),u(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),u(!0),p(void 0),h(new Set),E(``),y(void 0),S(e.id),k.current?.abort();let t=new AbortController;k.current=t;try{let n=await P(`/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)}),p({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(x,{variant:`ghost`,onClick:()=>O(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(M,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.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:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.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,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(x,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),v&&r===t.id?u(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.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,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(x,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(x,{variant:`ghost`,className:`mt-3`,onClick:()=>O(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:d,selected:m,onSelected:h,busy:g,locked:g||!!v,error:T,onClose:()=>{k.current?.abort(),u(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};