@xopcai/xopc 0.0.252 → 0.0.254

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 (220) hide show
  1. package/dist/browser-ext/dist/background.js +59 -13
  2. package/dist/browser-ext/dist/content.js +0 -5
  3. package/dist/browser-ext/manifest.json +2 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/plugin.js +3 -2
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{activity-store-w3eq3YpP.js → activity-store-Ci5Rxmi_.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-k039rbUz.js → agent-avatar-dicebear-D82jpmFL.js} +1 -1
  9. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-vul32IsP.js +1 -0
  10. package/dist/gateway/static/root/assets/{agents-Bmth_bSQ.js → agents-p3kWyz1T.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-2joIfbrH.js → api-CXIzQJ2Z.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-ByJ4kiD0.js → app-management-settings-panel-mhxcQpkQ.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-BK2Jga-B.js → appearance-settings-BIMwACUF.js} +1 -1
  14. package/dist/gateway/static/root/assets/apps-page-CJFJKNwS.js +1 -0
  15. package/dist/gateway/static/root/assets/{archive-plugin-DMDKtYpi.js → archive-plugin-C63Xp_sU.js} +1 -1
  16. package/dist/gateway/static/root/assets/{attachment-load-B764Ql3Z.js → attachment-load-D12KYOav.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automations-page-D-sO8CZe.js → automations-page-DXj0o5CY.js} +1 -1
  18. package/dist/gateway/static/root/assets/automations-workspace-B2wxcpgq.js +6 -0
  19. package/dist/gateway/static/root/assets/{binary-plugins-fxtzYRpv.js → binary-plugins-Bcv8hun6.js} +1 -1
  20. package/dist/gateway/static/root/assets/{block-editor-Bcjtvckh.js → block-editor-C61LqK_-.js} +50 -50
  21. package/dist/gateway/static/root/assets/{browser-automation-inputs-BSmnusjD.js → browser-automation-inputs-CAclu735.js} +1 -1
  22. package/dist/gateway/static/root/assets/{browser-automations-page-DC_OQIBk.js → browser-automations-page-BITfKX8L.js} +2 -2
  23. package/dist/gateway/static/root/assets/browser-settings-page-BMjY8cyv.js +8 -0
  24. package/dist/gateway/static/root/assets/capabilities-settings-panel-wB3Vgmp3.js +7 -0
  25. package/dist/gateway/static/root/assets/channels-settings-U5ffzu4r.js +1 -0
  26. package/dist/gateway/static/root/assets/{channels-status-swr-BuWjIG_a.js → channels-status-swr-Cmbx0E8O.js} +1 -1
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-5SevEo_I.js → chat-terminal-dock-CNBgHN9U.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-BGaF--m5.js +2 -0
  29. package/dist/gateway/static/root/assets/{cron-expression-DtsfalBM.js → cron-expression-DCTN4QAG.js} +1 -1
  30. package/dist/gateway/static/root/assets/{date-picker-tDEQV5TP.js → date-picker-BuEyUxZn.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dependency-picker-HhNwg0Y2.js → dependency-picker-l6IXzk0C.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-acU4Li-C.js → desktop-pet-cGn_20DO.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-settings-R84AR0Pe.js → desktop-pet-settings-DIfccDKS.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-CrLlRkSN.js → extension-debug-page-CTS5RP_D.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-BH5lmZXE.js → extension-page-Dg9YssYH.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-BscjNAd1.js → extension-settings-page-CWZYL8Fi.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-9HidFZUd.js → gateway-config-swr-Chsr5wGH.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-settings-vHI_Que8.js +1 -0
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DRCPXONr.js → gateway-startup-retry-C9ynH6VV.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-K5Zhl2rx.js → heartbeat-settings-WUhSfvob.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page-CYjlMzPx.js +1 -0
  42. package/dist/gateway/static/root/assets/{image-generation-api-CR6Kle8H.js → image-generation-api-D_TsVe7h.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-BBlJYVxR.js +74 -0
  44. package/dist/gateway/static/root/assets/index-_I0dD2LN.css +2 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B1QR49-7.js → keyboard-shortcuts-settings-DGBf6YfD.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-CLlIl83V.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-C74It-T8.js → local-apps-page-DGWP_xsQ.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-BfZGZKSs.js → locale-store-B2v8mNJw.js} +1 -1
  49. package/dist/gateway/static/root/assets/logs-page-DuhCigiB.js +2 -0
  50. package/dist/gateway/static/root/assets/{management-settings-1kNnYL97.js → management-settings-DUAZ-dtt.js} +1 -1
  51. package/dist/gateway/static/root/assets/markdown-view-DBWu9d_n.js +201 -0
  52. package/dist/gateway/static/root/assets/{media-plugins-B5c0AoS1.js → media-plugins-CsUjcIBy.js} +1 -1
  53. package/dist/gateway/static/root/assets/messages-ChSTFZR5.js +3 -0
  54. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CsIZqK51.js → mobile-pairing-wizard-Dxu8twiQ.js} +1 -1
  55. package/dist/gateway/static/root/assets/note-detail-panel-DMdbaTZp.js +5 -0
  56. package/dist/gateway/static/root/assets/notes-page-xe_vX0nM.js +8 -0
  57. package/dist/gateway/static/root/assets/{page-tabs-CqJN6Ljz.js → page-tabs-YeJKwV-7.js} +1 -1
  58. package/dist/gateway/static/root/assets/{preview-open-alternatives-DqRIGxf4.js → preview-open-alternatives-BfJ3jMDG.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-DE2nPE_K.js → product-open-page-B7NRGPox.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-hG7ELibZ.js +1 -0
  61. package/dist/gateway/static/root/assets/projects-page-C5G2ET4w.js +1 -0
  62. package/dist/gateway/static/root/assets/{registry-api-Bpy8XX-5.js → registry-api-B9OZUdwC.js} +1 -1
  63. package/dist/gateway/static/root/assets/{remote-access-hub-Dnd73xWt.js → remote-access-hub-DTO-faxH.js} +1 -1
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bb4b74-P.js → runtime-tools-settings-panel-uJ8Br3ZL.js} +1 -1
  65. package/dist/gateway/static/root/assets/{schema-form-DoPU5j3J.js → schema-form-CXwn6up5.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-CwzsUCgP.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-Djc3EdoO.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-Ci-9WajJ.js → settings-form-section-YVNYsR0U.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-CL_2F95D.js → settings-page-cHqrIdVR.js} +1 -1
  70. package/dist/gateway/static/root/assets/setup-status-panel-MUAMcZLD.js +1 -0
  71. package/dist/gateway/static/root/assets/{share-preview-page-XUA3oKQX.js → share-preview-page-DnjSDQru.js} +1 -1
  72. package/dist/gateway/static/root/assets/shares-settings-C7A0aywX.js +1 -0
  73. package/dist/gateway/static/root/assets/skill-reload-api-D1xSGJAQ.js +1 -0
  74. package/dist/gateway/static/root/assets/{skills-page-sXXAZDc9.js → skills-page-DkrGEdiY.js} +1 -1
  75. package/dist/gateway/static/root/assets/{skills-page.utils-DD79Bl1I.js → skills-page.utils-CqZbiZuK.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-BEH64qBV.js → system-settings-panel-Dmw0RfxZ.js} +1 -1
  77. package/dist/gateway/static/root/assets/task-detail-page-BvZSCLUH.js +1 -0
  78. package/dist/gateway/static/root/assets/{theme-store-CISSxU1c.js → theme-store-CubltMKm.js} +1 -1
  79. package/dist/gateway/static/root/assets/{tunnel-api-DrKDhnJm.js → tunnel-api-CiieC6HP.js} +1 -1
  80. package/dist/gateway/static/root/assets/{use-autosave-CPYePL-Q.js → use-autosave-XQ3SuyB9.js} +1 -1
  81. package/dist/gateway/static/root/assets/user-model-page-BKJC7tyW.js +2 -0
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-DKqzrCXx.js → voice-api-key-field-D4QzVgdt.js} +1 -1
  83. package/dist/gateway/static/root/assets/{voice-config-api-e9xWjwBX.js → voice-config-api-B1ZbyVmF.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-discovery-overlay-kTQug6bq.js → work-discovery-overlay-D5Tf8GRZ.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-m9SKj_GT.js → workflow-run-setup-panel-BW9p8Maz.js} +2 -2
  86. package/dist/gateway/static/root/assets/workflows-page-DuqRodIc.js +5 -0
  87. package/dist/gateway/static/root/index.html +10 -10
  88. package/dist/package.js +1 -1
  89. package/dist/packages/realtime-protocol/src/voice.js +6 -1
  90. package/dist/src/agent/agent-manager.js +24 -7
  91. package/dist/src/agent/background-review/run-background-review.js +1 -1
  92. package/dist/src/agent/embedded/execution-context.d.ts +2 -1
  93. package/dist/src/agent/embedded/execution-context.js +10 -4
  94. package/dist/src/agent/embedded/index.d.ts +1 -1
  95. package/dist/src/agent/embedded/index.js +2 -2
  96. package/dist/src/agent/embedded/model-runtime.js +1 -1
  97. package/dist/src/agent/embedded/run-for-session.js +5 -4
  98. package/dist/src/agent/embedded/run-turn.js +22 -3
  99. package/dist/src/agent/embedded/types.d.ts +1 -1
  100. package/dist/src/agent/image/tool-model-config.js +1 -1
  101. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  102. package/dist/src/agent/service/direct-turn-helpers.js +6 -3
  103. package/dist/src/agent/service/process-direct-streaming.js +6 -3
  104. package/dist/src/agent/service.d.ts +2 -0
  105. package/dist/src/agent/service.js +23 -9
  106. package/dist/src/agent/session/session-inspector.js +1 -1
  107. package/dist/src/agent/skills/hub-lock.js +1 -1
  108. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  109. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +17 -2
  110. package/dist/src/agent/tools/browser/tool/schemas.d.ts +85 -1
  111. package/dist/src/agent/tools/browser/tool/schemas.js +212 -5
  112. package/dist/src/agent/tools/clarify-tool.d.ts +17 -3
  113. package/dist/src/agent/tools/clarify-tool.js +27 -32
  114. package/dist/src/agent/tools/cli-clarify.js +23 -8
  115. package/dist/src/agent/tools/factory.js +14 -4
  116. package/dist/src/ai-assist/text-assist.js +1 -1
  117. package/dist/src/auth/credentials.js +2 -2
  118. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  119. package/dist/src/auth/profiles/store.js +1 -1
  120. package/dist/src/auth/sync-provider-auth.js +2 -2
  121. package/dist/src/automations/domain/validation.d.ts +4 -4
  122. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  123. package/dist/src/browser/drivers/extension-driver.d.ts +4 -4
  124. package/dist/src/browser/drivers/extension-driver.js +20 -8
  125. package/dist/src/browser/drivers/playwright-driver.js +1 -1
  126. package/dist/src/browser/providers/browser-ext-install.d.ts +3 -0
  127. package/dist/src/browser/providers/browser-ext-install.js +19 -4
  128. package/dist/src/browser/providers/extension.d.ts +14 -1
  129. package/dist/src/browser/providers/extension.js +89 -11
  130. package/dist/src/browser/providers/playwright-install.js +8 -12
  131. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  132. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  133. package/dist/src/cli/commands/models.js +1 -1
  134. package/dist/src/config/index.js +4 -4
  135. package/dist/src/config/loader.js +2 -2
  136. package/dist/src/config/models-json.js +1 -1
  137. package/dist/src/extensions/lockfile.js +1 -1
  138. package/dist/src/gateway/agents-admin.js +1 -1
  139. package/dist/src/gateway/chat-stream/mapper.js +5 -1
  140. package/dist/src/gateway/chat-stream/protocol.d.ts +5 -1
  141. package/dist/src/gateway/clarify-runtime.d.ts +7 -5
  142. package/dist/src/gateway/clarify-runtime.js +8 -11
  143. package/dist/src/gateway/ephemeral-clarification-waiter.d.ts +17 -0
  144. package/dist/src/gateway/ephemeral-clarification-waiter.js +46 -0
  145. package/dist/src/gateway/file-path-classifier.js +1 -1
  146. package/dist/src/gateway/heartbeat/service.js +1 -1
  147. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  148. package/dist/src/gateway/hono/routes/agent-stream.js +44 -18
  149. package/dist/src/gateway/hono/routes/browser.js +149 -27
  150. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  151. package/dist/src/gateway/hono/routes/models.js +1 -1
  152. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -2
  153. package/dist/src/gateway/hono/routes/side-chats.js +24 -4
  154. package/dist/src/gateway/security/gateway-scopes.js +1 -1
  155. package/dist/src/gateway/service/agent-runner.d.ts +25 -36
  156. package/dist/src/gateway/service/agent-runner.js +103 -32
  157. package/dist/src/gateway/service/config-coordinator.js +1 -1
  158. package/dist/src/gateway/service/run-gateway-agent.js +5 -2
  159. package/dist/src/gateway/service/session-input-coordinator.js +4 -1
  160. package/dist/src/gateway/service/sessions-api.js +1 -1
  161. package/dist/src/gateway/service.d.ts +4 -2
  162. package/dist/src/gateway/service.js +36 -20
  163. package/dist/src/gateway/side-chat/manager.d.ts +2 -1
  164. package/dist/src/gateway/side-chat/manager.js +5 -4
  165. package/dist/src/gateway/side-chat/run-service.d.ts +5 -1
  166. package/dist/src/gateway/side-chat/run-service.js +24 -23
  167. package/dist/src/gateway/side-chat/types.d.ts +3 -1
  168. package/dist/src/heartbeat/index.js +1 -1
  169. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  170. package/dist/src/providers/index.js +2 -2
  171. package/dist/src/providers/model-registry.js +1 -1
  172. package/dist/src/providers/model-thinking.js +57 -20
  173. package/dist/src/providers/register-runtime-providers.js +1 -1
  174. package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +41 -0
  175. package/dist/src/storage/sqlite/clarification-wait-repository.js +418 -0
  176. package/dist/src/storage/sqlite/index.d.ts +2 -1
  177. package/dist/src/storage/sqlite/index.js +2 -1
  178. package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +60 -0
  179. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  180. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  181. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  182. package/dist/src/storage/sqlite/schema.js +1 -1
  183. package/dist/src/storage/sqlite/session-input-repository.d.ts +11 -6
  184. package/dist/src/tui/tui-startup-resources.js +1 -1
  185. package/dist/src/tui/tui.js +1 -1
  186. package/dist/src/voice/realtime/agentEngine.js +7 -2
  187. package/dist/src/voice/realtime/runtime.types.d.ts +5 -0
  188. package/dist/src/work-discovery/service.js +1 -1
  189. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  190. package/package.json +3 -3
  191. package/skills/creative/hatch-pet/SKILL.md +1 -1
  192. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4J4oq8p.js +0 -1
  193. package/dist/gateway/static/root/assets/apps-page-B3ky7cWU.js +0 -1
  194. package/dist/gateway/static/root/assets/automations-workspace-Ds5-_-9z.js +0 -6
  195. package/dist/gateway/static/root/assets/browser-settings-page-C1FojyG6.js +0 -3
  196. package/dist/gateway/static/root/assets/capabilities-settings-panel-Bs59UCut.js +0 -7
  197. package/dist/gateway/static/root/assets/channels-settings-CM9vNmoo.js +0 -1
  198. package/dist/gateway/static/root/assets/connectors-page-BPZ44D-V.js +0 -2
  199. package/dist/gateway/static/root/assets/gateway-settings-BxLcW6ij.js +0 -1
  200. package/dist/gateway/static/root/assets/home-page-CZAg9RBv.js +0 -1
  201. package/dist/gateway/static/root/assets/index-D4Ykja-U.js +0 -72
  202. package/dist/gateway/static/root/assets/index-zIJ3AXgR.css +0 -2
  203. package/dist/gateway/static/root/assets/local-app-workbench-page-wicoV-ti.js +0 -2
  204. package/dist/gateway/static/root/assets/logs-page-xX-7S49A.js +0 -2
  205. package/dist/gateway/static/root/assets/markdown-view-DjiwT28p.js +0 -201
  206. package/dist/gateway/static/root/assets/messages-DaIwVWar.js +0 -3
  207. package/dist/gateway/static/root/assets/note-detail-panel-CfWxopl4.js +0 -5
  208. package/dist/gateway/static/root/assets/notes-page-CYN-LCHJ.js +0 -8
  209. package/dist/gateway/static/root/assets/project-detail-page-B5G3LzDq.js +0 -1
  210. package/dist/gateway/static/root/assets/projects-page-CuVK2mKu.js +0 -1
  211. package/dist/gateway/static/root/assets/sessions-page-XL4LyKZe.js +0 -1
  212. package/dist/gateway/static/root/assets/settings-advanced-gate-0ForzDSS.js +0 -1
  213. package/dist/gateway/static/root/assets/setup-status-panel-DVws6XZc.js +0 -1
  214. package/dist/gateway/static/root/assets/shares-settings-BwDvcacF.js +0 -1
  215. package/dist/gateway/static/root/assets/skill-reload-api-BJjrATqE.js +0 -1
  216. package/dist/gateway/static/root/assets/task-detail-page-0jxMi75O.js +0 -1
  217. package/dist/gateway/static/root/assets/user-model-page-B6zLDfDl.js +0 -2
  218. package/dist/gateway/static/root/assets/workflows-page-Bcd1XqP7.js +0 -5
  219. package/dist/src/gateway/clarify-bridge.d.ts +0 -46
  220. package/dist/src/gateway/clarify-bridge.js +0 -111
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./messages-DaIwVWar.js";import{n as a}from"./locale-store-BfZGZKSs.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Go as c,Jt as l,Ks as u,Kt as d,Yt as f,ac as p,ou as m,qt as h,sa as g}from"./index-D4Ykja-U.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-Ci-9WajJ.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(l),[r,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),u=async t=>{if(!t){n(f({enabled:!1})),o(null);return}c(!0);try{let t=await d();if(t!==`granted`){o(t===`unsupported`?e.unsupported:e.denied);return}n(f({enabled:!0})),o(await h(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(f(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(m,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?u(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=a(e=>e.language),t=i(e),n=t.systemSettings,[l,d]=(0,x.useReducer)(g,L),{behavior:f,perms:m,loadError:h,permFeedback:A,permBusy:N,refreshing:R}=l,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){d({type:`patch`,patch:{loadError:null}});try{d({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){d({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){d({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{d({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{d({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&z&&B()},[z,B]),!s()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);d({type:`patch`,patch:{behavior:t}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}d({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){d({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){d({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){d({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),d({type:`patch`,patch:{perms:await z.getPermissions()}}),d({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{d({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{d({type:`patch`,patch:{permFeedback:null}}),d({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?d({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):d({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{d({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),d({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();d({type:`patch`,patch:{perms:await z.getPermissions()}}),d({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{d({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){d({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),d({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();d({type:`patch`,patch:{perms:await z.getPermissions()}}),d({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{d({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){d({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),d({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();d({type:`patch`,patch:{perms:await z.getPermissions()}}),d({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{d({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){d({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),d({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();d({type:`patch`,patch:{perms:await z.getPermissions()}}),d({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){d({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{d({type:`patch`,patch:{permBusy:!1}})}}},Y=f?f.platform===`win32`?n.permissionsHintWin:f.platform===`linux`?n.permissionsHintLinux:f.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),h?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,A?(0,C.jsx)(`p`,{className:o(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.mobileAccess.flow.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.mobileAccess.flow.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f?.backgroundSupported,checked:!!f?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f||N,checked:!!f?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),f&&m?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),f.platform===`darwin`&&!f.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:o(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void V(),children:[(0,C.jsx)(p,{className:o(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(f.platform).map(({key:t,pane:i})=>{let a=F(e,m[t]),s=n.perm[t],l=m[t]===`unknown`?I(e,t,f.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,m[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,m[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,m[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,m[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,m[t],f.platform)?(0,C.jsxs)(`button`,{type:`button`,className:o(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void W(i),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./messages-ChSTFZR5.js";import{n as a}from"./locale-store-B2v8mNJw.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Bt as c,Go as l,Ht as u,Ks as d,Vt as f,ac as p,sa as m,su as h,zt as g}from"./index-BBlJYVxR.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-YVNYsR0U.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(f),[r,o]=(0,x.useState)(null),[s,l]=(0,x.useState)(!1),d=async t=>{if(!t){n(u({enabled:!1})),o(null);return}l(!0);try{let t=await g();if(t!==`granted`){o(t===`unsupported`?e.unsupported:e.denied);return}n(u({enabled:!0})),o(await c(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{l(!1)}},p=e=>{n(u(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(h,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?d(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=a(e=>e.language),t=i(e),n=t.systemSettings,[c,u]=(0,x.useReducer)(m,L),{behavior:f,perms:h,loadError:g,permFeedback:A,permBusy:N,refreshing:R}=c,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){u({type:`patch`,patch:{loadError:null}});try{u({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){u({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){u({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{u({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{u({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&z&&B()},[z,B]),!s()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);u({type:`patch`,patch:{behavior:t}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}u({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){u({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{u({type:`patch`,patch:{permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?u({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):u({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},Y=f?f.platform===`win32`?n.permissionsHintWin:f.platform===`linux`?n.permissionsHintLinux:f.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),g?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:g}):null,A?(0,C.jsx)(`p`,{className:o(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.mobileAccess.flow.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.mobileAccess.flow.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f?.backgroundSupported,checked:!!f?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f||N,checked:!!f?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!f,checked:!!f?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),f&&h?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),f.platform===`darwin`&&!f.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:o(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,l.press),onClick:()=>void V(),children:[(0,C.jsx)(p,{className:o(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(f.platform).map(({key:t,pane:i})=>{let a=F(e,h[t]),s=n.perm[t],c=h[t]===`unknown`?I(e,t,f.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,h[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,l.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,h[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,l.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,h[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,l.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,h[t],f.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:o(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,l.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,h[t],f.platform)?(0,C.jsxs)(`button`,{type:`button`,className:o(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,l.press),onClick:()=>void W(i),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,l as o,p as s,t as c}from"./chunk-KS7C4IRE-BaASWQor.js";import{i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CpzYSoz7.js";import{n as h,r as g}from"./popover-select-C-Hj-nXR.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{d as ee,p as te,t as ne}from"./markdown-view-DBWu9d_n.js";import{t as re}from"./x-B_N4OPjy.js";import{n as ie,s as y}from"./locale-store-B2v8mNJw.js";import{t as b}from"./cn-JdwAhgNB.js";import{t as x}from"./button-CtTvuElV.js";import{t as S}from"./skeleton-BwbyijEw.js";import{Bl as ae,Di as C,Hn as oe,Jo as w,Ki as se,Ko as ce,Lt as T,N as le,Qo as ue,Qr as E,Tr as de,Va as fe,Yo as pe,Zr as me,dn as D,ds as he,fn as O,fs as ge,gl as k,gn as _e,ha as ve,hl as ye,hn as A,kc as j,ls as M,mn as N,ms as P,n as F,pc as I,pn as be,ps as xe,pu as Se,rs as Ce,ss as we,wl as Te,yc as Ee,zl as De}from"./index-BBlJYVxR.js";import{t as Oe}from"./date-picker-BuEyUxZn.js";import{t as ke}from"./dependency-picker-l6IXzk0C.js";var L=e(t(),1),Ae=e(n(),1),R=r();function je(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Me(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var z=i();function Ne(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Pe(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(S,{className:`h-32 rounded-2xl`}),(0,z.jsx)(S,{className:`h-52 rounded-2xl`}),(0,z.jsx)(S,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Fe(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ie(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var B=[`backlog`,`ready`,`active`,`review`,`closed`],V=[`low`,`normal`,`high`,`critical`],Le=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,z.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=B.map(e=>(0,z.jsx)(g,{value:e,disabled:d(e),children:Ne(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let _;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(_=(0,z.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,_]}),t[17]=f,t[18]=_,t[19]=v):v=t[19],v}),Re=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=V.map(e=>(0,z.jsx)(g,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,z.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),ze=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,z.jsx)(Oe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Be=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let l;t[2]===s?l=t[3]:(l=e=>s(e.target.value),t[2]=s,t[3]=l);let u;t[4]===a?u=t[5]:(u=(0,z.jsx)(g,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=u);let d;t[6]===o?d=t[7]:(d=o.map(rt),t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==n?(f=(0,z.jsxs)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:l,children:[u,d]}),t[8]=r,t[9]=l,t[10]=u,t[11]=d,t[12]=n,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}),Ve=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(it),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,z.jsx)(ke,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),He=`xopc.taskDetail.chatPanelPercent`,Ue=42;function We(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ue:Math.min(r,Math.max(n,e))}function Ge(){try{let e=Number(window.localStorage.getItem(He));return Number.isFinite(e)&&e>=30&&e<=60?e:Ue}catch{return Ue}}function Ke(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?_:t===`failed`?ae:De,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,z.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function qe({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=s(),a=o(),l=ie(e=>e.language),u=y(e=>e.token),d=(0,L.useMemo)(()=>P(l),[l]),f=fe(e=>e.setPageHeader),p=fe(e=>e.clearPageHeader),m=E(e=>e.open),h=E(e=>e.sessionKeyOverride),g=E(e=>e.openForSession),re=oe(e=>e.setOpen),{data:S,error:ae,mutate:T,lastChange:me,conversationLoading:De,conversationError:Oe}=ce(e),[ke,R]=(0,L.useState)(null),[Ne,B]=(0,L.useState)(null),[V,qe]=(0,L.useState)(()=>new Set),[Je,Ye]=(0,L.useState)([]),[U,Xe]=(0,L.useState)(null),[Ze,Qe]=(0,L.useState)([]),[$e,W]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[nt,G]=(0,L.useState)(!1),[rt,it]=(0,L.useState)(``),[at,ot]=(0,L.useState)(Ge),[st,ct]=(0,L.useState)(!1),lt=(0,L.useRef)(null),ut=(0,L.useRef)(!1),dt=(0,L.useRef)(!1),ft=(0,L.useRef)(``),pt=(0,L.useRef)(null),mt=(0,L.useRef)(null),ht=(0,L.useRef)(null),gt=(0,L.useRef)(S),[_t,K]=(0,L.useState)(null),[vt,yt]=(0,L.useState)(null),[bt,xt]=(0,L.useState)(!1),St=(0,L.useMemo)(()=>({link:d.linkDependencies,linked:d.linkedDependencies,searchPlaceholder:d.dependencySearchPlaceholder,noMatches:d.noDependencyMatches,noCandidates:d.noDependencyCandidates,remove:d.removeDependency}),[d.dependencySearchPlaceholder,d.linkDependencies,d.linkedDependencies,d.noDependencyCandidates,d.noDependencyMatches,d.removeDependency]),Ct=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,wt=(0,L.useMemo)(()=>ee(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);gt.current=S;let q=(0,L.useCallback)((e,t)=>{qe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),K(null),W(!1),G(!1),yt(null),xt(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return ve().then(t=>{e&&Qe(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,L.useEffect)(()=>{if(!me||me.source===`user`)return;yt(me);let e=window.setTimeout(()=>yt(null),3500);return()=>window.clearTimeout(e)},[me]),(0,L.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){ht.current=null,Xe(null),Ye(n);return}ht.current!==t&&(ht.current=t,Xe(null));let r=!0;return se(t).then(t=>{if(!r)return;Xe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ye([...i.values()])}).catch(()=>{r&&Ye(n)}),()=>{r=!1}},[Ct,S?.task.projectId,e]);let J=(0,L.useCallback)(async(t,n=`command`)=>{let r=gt.current;if(r){q(n,!0),B(null);try{await T(await pe(e,t,r.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(n,!1)}}},[d.actionFailed,T,q,e]),Y=(0,L.useCallback)(async(t,n)=>{let r=gt.current;if(!r)return!1;n&&q(n,!0),B(null);try{return await T(M(e,t,r.task.version),{optimisticData:Me(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(d.actionFailed),!1}finally{n&&q(n,!1)}},[d.actionFailed,T,q,e]),Tt=async()=>{if(!S)return;if(ut.current){ut.current=!1;return}let e=et.trim(),t=pt.current;if(je(t,S.task.version,S.task.title,e)){K(`title`);return}if(!e||e===S.task.title){tt(S.task.title),W(!1);return}await Y({title:e})&&(K(null),W(!1))},Et=async()=>{if(!S)return;if(dt.current){dt.current=!1;return}let e=rt.trim(),t=mt.current;if(je(t,S.task.version,S.task.body??``,e)){K(`description`);return}if(rt===ft.current||e===(S.task.body??``).trim()){G(!1);return}await Y({body:e||null})&&(K(null),G(!1))},Dt=(0,L.useCallback)(async e=>{let t=gt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Ot=(0,L.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),kt=(0,L.useCallback)(e=>{Y({dueAt:Ie(e)},`dueAt`)},[Y]),At=(0,L.useCallback)(e=>{ot(e);try{window.localStorage.setItem(He,String(e))}catch{}},[]),jt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=lt.current?.clientWidth??0;At(We(e.key===`Home`?Ue:at+(e.key===`ArrowLeft`?2:-2),t))},[at,At]),Mt=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=lt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ct(!0);let i=at,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=We((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}ct(!1),At(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[at,At]),Nt=(0,L.useCallback)(async t=>{let n=gt.current;if(n){q(`dependencies`,!0),B(null);try{await T(await he(e,t,n.task.version),{revalidate:!1})}catch{B(d.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[d.dependencyUpdateFailed,T,q,e]),Pt=(0,L.useCallback)(async t=>{let n=gt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),B(null);try{await T(await Ce(e,t,n.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[d.actionFailed,T,q,e]),Ft=(0,L.useCallback)(async()=>{q(`delete`,!0),B(null);try{await ue(e),r?r():a(wt,{replace:!0})}catch(e){B(e instanceof Error?e.message:d.actionFailed)}finally{q(`delete`,!1)}},[d.actionFailed,a,r,wt,q,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return f({startExtra:(0,z.jsx)(c,{to:wt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":d.backToWork,children:(0,z.jsx)(Se,{className:`size-4`})}),main:S?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${d.taskLabel}`:d.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d.detailStatuses[Ke(S)]})]}):null,end:(0,z.jsx)(`div`,{ref:R,className:`flex min-w-0 items-center justify-end`})}),p},[p,d.backToWork,d.detailStatuses,d.taskLabel,S,t,U,wt,f]),ae&&!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:d.taskNotFound});if(!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(Pe,{})});let It=S.waits[0],Lt=It?.kind===`paused`?It:void 0,X=S.receipts[0],Rt=d.detailStatuses[Ke(S)],zt=d.detailStatusDescriptions[Ke(S)],Bt=S.task.body?.trim()||S.task.contract?.objective.trim(),Vt=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),Ht=S.allowedCommands.includes(`mark_ready`),Ut=S.allowedCommands.includes(`start`),Wt=S.allowedCommands.includes(`add_wait`),Gt=S.task.phase===`review`&&S.allowedCommands.includes(`close`),Kt=S.allowedCommands.includes(`reopen`),Z=S.conversation.activeSessionKey,qt=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,Jt=Ze.find(e=>e.id===qt),Yt=!!(Z&&m&&h===Z),Xt=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Zt=S.task.contract?.acceptanceCriteria??[],Qt=Zt.filter(e=>Vt.get(e)===`passed`).length,$t=S.task.contract?.expectedOutputs??[],en=S.task.contract?.constraints??[],tn=S.task.contract?.approvalRequired??[],nn=S.task.contract?.assumptions??[],rn=S.task.contract?.risks??[],Q=(...e)=>!!vt?.changedFields.some(t=>e.includes(t)),an=e=>t===`modal`&&n?xe(n,e):te(`/tasks/${e}`,wt),on=S.allowedCommands.includes(`move`),$=V.has(`command`),sn=V.has(`delete`),cn=S.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),ln=cn!==void 0,un=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ht?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,z.jsx)(I,{className:`size-4`}),d.scheduleTask]}):null,Lt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Lt.id}),children:[(0,z.jsx)(I,{className:`size-4`}),d.resumeTask]}):null,!It&&Ut&&qt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:qt}}),children:[(0,z.jsx)(I,{className:`size-4`}),d.runTask]}):null,Gt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,z.jsx)(_,{className:`size-4`}),d.approveTask]}):null,Kt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(I,{className:`size-4`}),d.reopenTask]}):null,!It&&Wt?(0,z.jsxs)(x,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,z.jsx)(Ee,{className:`size-4`}),d.pauseTask]}):null,(0,z.jsxs)(N,{children:[(0,z.jsx)(_e,{asChild:!0,children:(0,z.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||sn,"aria-label":d.moreActions,children:(0,z.jsx)(Te,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(be,{children:(0,z.jsxs)(D,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[cn?(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),B(null),T(w(e,cn.id,cn.version),{revalidate:!1}).catch(()=>B(d.actionFailed)).finally(()=>q(`command`,!1))},children:d.cancelActiveRun}):null,cn?(0,z.jsx)(A,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:d.cancelTask}),(0,z.jsx)(A,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(ln){B(d.deleteActiveTaskBlocked);return}xt(!0)},children:d.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(x,{type:`button`,variant:`ghost`,className:b(`h-8 shrink-0 px-2 text-xs`,Yt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Yt,onClick:()=>{re(Z,!1),g(Z)},children:[(0,z.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(c,{to:ge(e),children:[(0,z.jsx)(v,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,z.jsxs)(`div`,{ref:lt,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${st?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${at}%`},children:[t===`page`&&ke?(0,Ae.createPortal)(un,ke):null,(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:b(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:d.taskLabel}),vt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:vt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),$e?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void Tt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,tt(S.task.title),W(!1),queueMicrotask(()=>{ut.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,z.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{pt.current={value:S.task.title,version:S.task.version},K(null),tt(S.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:S.task.title})}),_t===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(S.task.title),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:et.trim()}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Ne?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Ne}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDescription}),nt?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:rt,onChange:e=>it(e.target.value),onBlur:()=>void Et(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),dt.current=!0,it(S.task.body??S.task.contract?.objective??``),G(!1),queueMicrotask(()=>{dt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,z.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=S.task.body??S.task.contract?.objective??``;ft.current=e,mt.current={value:S.task.body??``,version:S.task.version},K(null),it(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Bt&&Bt!==S.task.title?Bt:d.noTaskDescription})}),_t===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{it(S.task.body??``),K(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:rt.trim()||null}).then(e=>{e&&(K(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),S.attention.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:Xt?d.needsAttention:d.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:S.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.successDefinition}),Zt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:d.criteriaProgress.replace(`{{verified}}`,String(Qt)).replace(`{{total}}`,String(Zt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:d.noDefinition,verificationByCriterion:Vt})})]}),$t.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:d.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:d.noDefinition})})]}):null,tn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:tn,empty:d.noDefinition})})]}):null,nn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:nn,empty:d.noDefinition})})]}):null,rn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:rn,empty:d.noDefinition})})]}):null]}),X?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.latestResult}),(0,z.jsx)(ne,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[d.receiptStatuses[X.status],` · `,d.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:d.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:X.remainingWork,empty:d.noRemainingWork})})]}):null,X.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(x,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void we(X.runId,`helpful`),children:d.doneWell}),(0,z.jsx)(x,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void we(X.runId,`not_helpful`),children:d.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(v,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),S.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:d.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:d.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,S.context.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:S.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[d.contextRoleLabels[e.role],` · `,d.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Le,{value:S.task.phase,disabled:V.has(`phase`),canMove:on,canApprove:Gt,canReopen:Kt,language:l,label:d.taskPhase,onChange:Dt}),(0,z.jsx)(Re,{value:S.task.priority,disabled:V.has(`priority`),label:d.priority,labels:d.priorityLabels,onChange:Ot}),(0,z.jsx)(ze,{value:Fe(S.task.dueAt),disabled:V.has(`dueAt`),label:d.dueDate,onChange:kt}),(0,z.jsx)(Be,{value:S.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:d.executorLabel,unassignedLabel:d.unassigned,agents:Ze,onChange:Pt}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:d.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(k,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Rt}),(0,z.jsx)(`p`,{children:zt}),(0,z.jsx)(`p`,{className:`mt-2`,children:d.updatedAt.replace(`{{date}}`,de(S.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependencies}),(0,z.jsx)(Ve,{candidates:Je,selected:S.dependencies,disabled:V.has(`dependencies`),labels:St,onChange:Nt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependents}),S.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(e=>(0,z.jsx)(c,{to:an(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependents})]})]})]})]})]})]}),(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(at),tabIndex:0,onPointerDown:Mt,onKeyDown:jt,onDoubleClick:()=>At(Ue),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${st?`bg-surface-hover`:``}`,children:(0,z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,z.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[qt?(0,z.jsx)(le,{agentId:qt,avatar:Jt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Jt?.name??qt??d.unassigned,` · `,Rt]})]})]})}),t===`modal`?un:null]}),Z?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(F,{embedded:!0,sessionKey:Z,taskId:e})}):De?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,z.jsx)(C,{open:bt,title:d.deleteTaskTitle,description:d.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:d.confirmDeleteTask,cancelLabel:d.keepTask,destructive:!0,onConfirm:()=>{xt(!1),Ft()},onCancel:()=>xt(!1)})]})}function Je(){let e=(0,R.c)(2),{taskId:t}=a(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(qe,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ye(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=ie(G),{data:o}=ce(n),s=o?.conversation.activeSessionKey??null,h=E(nt),g=E(tt),_=E(et),ee=E(W),te=oe($e),ne=me(Qe),y=me(Ze),x=h?g:0,S;t[0]!==i||t[1]!==y?(S=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=S):S=t[2];let ae=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==y?(C=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=C):C=t[5];let w;t[6]!==ae||t[7]!==C?(w=(0,z.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":ae,onClick:C}),t[6]=ae,t[7]=C,t[8]=w):w=t[8];let se=h?`true`:`false`,le=`${x/2}px`,ue=`${x}px`,de;t[9]!==le||t[10]!==ue?(de={"--task-detail-workspace-offset":le,"--task-detail-workspace-width":ue},t[9]=le,t[10]=ue,t[11]=de):de=t[11];let fe=de,pe=a===`zh`?`任务详情`:`Task details`,D;t[12]===pe?D=t[13]:(D=(0,z.jsx)(p,{className:`font-medium text-fg`,children:pe}),t[12]=pe,t[13]=D);let he=a===`zh`?`查看并操作任务详情`:`View and manage task details`,O;t[14]===he?O=t[15]:(O=(0,z.jsx)(l,{className:`sr-only`,children:he}),t[14]=he,t[15]=O);let k;t[16]!==s||t[17]!==a||t[18]!==ee||t[19]!==te||t[20]!==n||t[21]!==h||t[22]!==_?(k=s?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:b(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,h&&_===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":h&&_===s,onClick:()=>{te(s,!1),ee(s)},children:(0,z.jsx)(ye,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(c,{to:ge(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,z.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=ee,t[19]=te,t[20]=n,t[21]=h,t[22]=_,t[23]=k):k=t[23];let _e=a===`zh`?`关闭任务详情`:`Close task details`,ve;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[24]=ve):ve=t[24];let A;t[25]===_e?A=t[26]:(A=(0,z.jsx)(u,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":_e,children:ve}),t[25]=_e,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==D||t[31]!==O||t[32]!==j?(M=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[D,O,j]}),t[30]=D,t[31]=O,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==i||t[35]!==y?(N=()=>{y(null),i()},t[34]=i,t[35]=y,t[36]=N):N=t[36];let P;t[37]!==r||t[38]!==N||t[39]!==n?(P=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(qe,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:N})}),t[37]=r,t[38]=N,t[39]=n,t[40]=P):P=t[40];let F;t[41]!==M||t[42]!==P||t[43]!==se||t[44]!==fe?(F=(0,z.jsxs)(f,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:fe,onEscapeKeyDown:Xe,onInteractOutside:U,children:[M,P]}),t[41]=M,t[42]=P,t[43]=se,t[44]=fe,t[45]=F):F=t[45];let I;t[46]!==ne||t[47]!==h||t[48]!==g||t[49]!==_?(I=ne?(0,z.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:h?g:0},children:(0,z.jsx)(T,{allowOutsideChat:!0,sessionKey:_??void 0})}):null,t[46]=ne,t[47]=h,t[48]=g,t[49]=_,t[50]=I):I=t[50];let be;t[51]!==F||t[52]!==I||t[53]!==w?(be=(0,z.jsxs)(d,{children:[w,F,I]}),t[51]=F,t[52]=I,t[53]=w,t[54]=be):be=t[54];let xe;return t[55]!==S||t[56]!==be?(xe=(0,z.jsx)(m,{modal:!1,open:!0,onOpenChange:S,children:be}),t[55]=S,t[56]=be,t[57]=xe):xe=t[57],xe}function U(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Xe(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ze(e){return e.setPath}function Qe(e){return e.path}function $e(e){return e.setOpen}function W(e){return e.openForSession}function et(e){return e.sessionKeyOverride}function tt(e){return e.widthPx}function nt(e){return e.open}function G(e){return e.language}function rt(e){return(0,z.jsx)(g,{value:e.id,children:e.name||e.id},e.id)}function it(e){return e.id}export{Ye as TaskDetailModal,Je as TaskDetailPage};
@@ -1 +1 @@
1
- import{f as e}from"./locale-store-BfZGZKSs.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#f7f8fa`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#14171c`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
1
+ import{f as e}from"./locale-store-B2v8mNJw.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#f7f8fa`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#14171c`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u 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"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-DaIwVWar.js";import{a as c,i as l,n as u,r as d,s as ee}from"./locale-store-BfZGZKSs.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-CtTvuElV.js";import{n as h,r as g}from"./gateway-config-swr-9HidFZUd.js";import{t as _}from"./skeleton-BwbyijEw.js";import{Ga as v,di as y,no as b,uc as x}from"./index-D4Ykja-U.js";import{n as te,t as ne}from"./settings-form-section-Ci-9WajJ.js";async function S(){return(await c(d(`/api/devices`))).devices}async function C(){let e=await c(d(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersions:e.protocolVersions}}async function w(){try{return{kind:`ready`,setup:(await c(d(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({protocolVersion:3})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function T(e){return c(d(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function E(e){await c(d(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function D(e,t){await c(d(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function O(e){await c(d(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}var k=e(t(),1),re=n(),A=r();function j(e){let t=(0,re.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=v(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,A.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,A.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}async function M(){let e=await l(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ie(e=`serve`){let t=await l(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function N(){let e=await l(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var ae=`https://tailscale.com/download`;function P(e){let t=(0,re.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,A.jsx)(`a`,{href:ae,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function oe({embedded:e=!1}){let t=u(e=>e.language),n=s(t).remoteAccess.tailscale,r=(0,k.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:s(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!ee(e=>e.token),[c,l]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),{data:h,mutate:g,isLoading:v}=p(i?`exposure-status`:null,M,{refreshInterval:3e4}),b=h?.tailscale.hostname,S=h?.tailscale.active===!0,C=h?.tailscale.cliAvailable!==!1,w=b?`https://${b}/`:null,T=(0,k.useCallback)(async()=>{l(!0),f(null);try{await ie(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]),E=(0,k.useCallback)(async()=>{l(!0),f(null);try{await N(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]);if(!i)return null;let D=(0,A.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,A.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,A.jsxs)(`span`,{children:[n.stepInstallBefore,(0,A.jsx)(P,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,A.jsx)(`span`,{children:n.stepEnable})]}),(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,A.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,A.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,A.jsx)(P,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,v&&!h?(0,A.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,A.jsx)(_,{className:`h-20 rounded-lg`}),(0,A.jsx)(_,{className:`h-20 rounded-lg`})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(ne,{children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),w?(0,A.jsx)(`div`,{className:`mt-3`,children:(0,A.jsx)(y,{text:w,labels:r})}):null,d?(0,A.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:d}):null,(0,A.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,A.jsxs)(m,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void E(),children:[c?(0,A.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,A.jsxs)(m,{type:`button`,disabled:c||!C,onClick:()=>void T(),children:[c?(0,A.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,A.jsx)(x,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,A.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,A.jsx)(j,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?D:(0,A.jsxs)(ne,{children:[(0,A.jsx)(te,{icon:a,title:n.title,subtitle:n.subtitle}),D]})}async function se(e){let t=await l(d(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ce(e){await c(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function F(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function le(){return(0,k.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||F(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function ue(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function de(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function I(){let e=(0,re.c)(85),t=u(pe),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!ee(fe),c=le(),l=g(i).data?.payload?.config,d;e[2]===l?d=e[3]:(d=de(l),e[2]=l,e[3]=d);let p=d,[_,v]=(0,k.useState)(``),y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y={busy:!1,result:null},e[4]=y):y=e[4];let[b,x]=(0,k.useState)(y),S;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(S={busy:!1,error:null},e[5]=S):S=e[5];let[C,w]=(0,k.useState)(S),T,E;e[6]!==p||e[7]!==c||e[8]!==_?(T=()=>{_||(p?v(p):c&&v(c))},E=[p,c,_],e[6]=p,e[7]=c,e[8]=_,e[9]=T,e[10]=E):(T=e[9],E=e[10]),(0,k.useEffect)(T,E);let D;bb0:{let t;e[11]===_?t=e[12]:(t=_.trim(),e[11]=_,e[12]=t);let n=t;if(n){D=n;break bb0}D=p??c??``}let O=D,j=!p&&!!c&&O===c,M;e[13]!==_||e[14]!==O?(M=async()=>{let e=_.trim()||O;if(e){x({busy:!0,result:null});try{x({busy:!1,result:await se(e)})}catch(e){let t=e;x({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=_,e[14]=O,e[15]=M):M=e[15];let ie=M,N;e[16]===O?N=e[17]:(N=async()=>{let e=O.trim();if(e){w({busy:!0,error:null});try{await ce(e),await h(),w({busy:!1,error:null})}catch(e){let t=e;w({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=O,e[17]=N);let ae=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{w({busy:!0,error:null});try{await ce(null),await h(),v(``),x({busy:!1,result:null}),w({busy:!1,error:null})}catch(e){let t=e;w({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let oe=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,A.jsx)(te,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,A.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=f(ue(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{v(e.target.value),x({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==_||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,A.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:_,onChange:R}),e[26]=_,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===ie?B=e[31]:(B=()=>void ie(),e[30]=ie,e[31]=B);let V;e[32]!==_||e[33]!==b.busy?(V=b.busy||!_.trim(),e[32]=_,e[33]=b.busy,e[34]=V):V=e[34];let H;e[35]===b.busy?H=e[36]:(H=b.busy?(0,A.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=b.busy,e[36]=H);let he=b.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,A.jsxs)(m,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,A.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,A.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,A.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,A.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,A.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==b.result||e[53]!==r.probeStatus?(q=b.result?(0,A.jsx)(me,{result:b.result,labels:r.probeStatus}):null,e[52]=b.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==O||e[57]!==ae||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==C.busy?(J=O&&p!==O?(0,A.jsxs)(m,{type:`button`,onClick:()=>void ae(),disabled:C.busy,children:[C.busy?(0,A.jsx)(o,{className:`size-3.5 animate-spin`}):null,C.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=O,e[57]=ae,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=C.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==C.busy?(Y=p?(0,A.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>void oe(),disabled:C.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=C.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===C.error?Z=e[70]:(Z=C.error?(0,A.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:C.error}):null,e[69]=C.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,A.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,A.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,A.jsxs)(ne,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function fe(e){return e.token}function pe(e){return e.language}function me(e){let t=(0,re.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,A.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,A.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,A.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,A.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,A.jsxs)(A.Fragment,{children:[` — `,(0,A.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,A.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function L(){return c(d(`/api/tunnel/status`))}async function R(){await c(d(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function z(){await c(d(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function B(){return c(d(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function V(e){return c(d(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function H(){let e=(await c(d(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function he(e){await c(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{T as _,H as a,I as c,j as d,E as f,C as g,S as h,R as i,oe as l,D as m,he as n,B as o,w as p,z as r,V as s,L as t,M as u,O as v};
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"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-ChSTFZR5.js";import{a as c,i as l,n as u,r as d,s as ee}from"./locale-store-B2v8mNJw.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-CtTvuElV.js";import{n as h,r as g}from"./gateway-config-swr-Chsr5wGH.js";import{t as _}from"./skeleton-BwbyijEw.js";import{Ga as v,di as y,no as b,uc as x}from"./index-BBlJYVxR.js";import{n as te,t as ne}from"./settings-form-section-YVNYsR0U.js";async function S(){return(await c(d(`/api/devices`))).devices}async function C(){let e=await c(d(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersions:e.protocolVersions}}async function w(){try{return{kind:`ready`,setup:(await c(d(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({protocolVersion:3})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function T(e){return c(d(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function E(e){await c(d(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function D(e,t){await c(d(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function O(e){await c(d(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}var k=e(t(),1),re=n(),A=r();function j(e){let t=(0,re.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=v(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=f(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,A.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,A.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}async function M(){let e=await l(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ie(e=`serve`){let t=await l(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function N(){let e=await l(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var ae=`https://tailscale.com/download`;function P(e){let t=(0,re.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,A.jsx)(`a`,{href:ae,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function oe({embedded:e=!1}){let t=u(e=>e.language),n=s(t).remoteAccess.tailscale,r=(0,k.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:s(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!ee(e=>e.token),[c,l]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),{data:h,mutate:g,isLoading:v}=p(i?`exposure-status`:null,M,{refreshInterval:3e4}),b=h?.tailscale.hostname,S=h?.tailscale.active===!0,C=h?.tailscale.cliAvailable!==!1,w=b?`https://${b}/`:null,T=(0,k.useCallback)(async()=>{l(!0),f(null);try{await ie(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]),E=(0,k.useCallback)(async()=>{l(!0),f(null);try{await N(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]);if(!i)return null;let D=(0,A.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,A.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,A.jsxs)(`span`,{children:[n.stepInstallBefore,(0,A.jsx)(P,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,A.jsx)(`span`,{children:n.stepEnable})]}),(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,A.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,A.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,A.jsx)(P,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,v&&!h?(0,A.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,A.jsx)(_,{className:`h-20 rounded-lg`}),(0,A.jsx)(_,{className:`h-20 rounded-lg`})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(ne,{children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),w?(0,A.jsx)(`div`,{className:`mt-3`,children:(0,A.jsx)(y,{text:w,labels:r})}):null,d?(0,A.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:d}):null,(0,A.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,A.jsxs)(m,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void E(),children:[c?(0,A.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,A.jsxs)(m,{type:`button`,disabled:c||!C,onClick:()=>void T(),children:[c?(0,A.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,A.jsx)(x,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,A.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,A.jsx)(j,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?D:(0,A.jsxs)(ne,{children:[(0,A.jsx)(te,{icon:a,title:n.title,subtitle:n.subtitle}),D]})}async function se(e){let t=await l(d(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ce(e){await c(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function F(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function le(){return(0,k.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||F(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function ue(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function de(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function I(){let e=(0,re.c)(85),t=u(pe),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!ee(fe),c=le(),l=g(i).data?.payload?.config,d;e[2]===l?d=e[3]:(d=de(l),e[2]=l,e[3]=d);let p=d,[_,v]=(0,k.useState)(``),y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y={busy:!1,result:null},e[4]=y):y=e[4];let[b,x]=(0,k.useState)(y),S;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(S={busy:!1,error:null},e[5]=S):S=e[5];let[C,w]=(0,k.useState)(S),T,E;e[6]!==p||e[7]!==c||e[8]!==_?(T=()=>{_||(p?v(p):c&&v(c))},E=[p,c,_],e[6]=p,e[7]=c,e[8]=_,e[9]=T,e[10]=E):(T=e[9],E=e[10]),(0,k.useEffect)(T,E);let D;bb0:{let t;e[11]===_?t=e[12]:(t=_.trim(),e[11]=_,e[12]=t);let n=t;if(n){D=n;break bb0}D=p??c??``}let O=D,j=!p&&!!c&&O===c,M;e[13]!==_||e[14]!==O?(M=async()=>{let e=_.trim()||O;if(e){x({busy:!0,result:null});try{x({busy:!1,result:await se(e)})}catch(e){let t=e;x({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=_,e[14]=O,e[15]=M):M=e[15];let ie=M,N;e[16]===O?N=e[17]:(N=async()=>{let e=O.trim();if(e){w({busy:!0,error:null});try{await ce(e),await h(),w({busy:!1,error:null})}catch(e){let t=e;w({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=O,e[17]=N);let ae=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{w({busy:!0,error:null});try{await ce(null),await h(),v(``),x({busy:!1,result:null}),w({busy:!1,error:null})}catch(e){let t=e;w({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let oe=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,A.jsx)(te,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,A.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=f(ue(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{v(e.target.value),x({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==_||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,A.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:_,onChange:R}),e[26]=_,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===ie?B=e[31]:(B=()=>void ie(),e[30]=ie,e[31]=B);let V;e[32]!==_||e[33]!==b.busy?(V=b.busy||!_.trim(),e[32]=_,e[33]=b.busy,e[34]=V):V=e[34];let H;e[35]===b.busy?H=e[36]:(H=b.busy?(0,A.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=b.busy,e[36]=H);let he=b.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,A.jsxs)(m,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,A.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,A.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,A.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,A.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,A.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==b.result||e[53]!==r.probeStatus?(q=b.result?(0,A.jsx)(me,{result:b.result,labels:r.probeStatus}):null,e[52]=b.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==O||e[57]!==ae||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==C.busy?(J=O&&p!==O?(0,A.jsxs)(m,{type:`button`,onClick:()=>void ae(),disabled:C.busy,children:[C.busy?(0,A.jsx)(o,{className:`size-3.5 animate-spin`}):null,C.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=O,e[57]=ae,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=C.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==C.busy?(Y=p?(0,A.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>void oe(),disabled:C.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=C.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===C.error?Z=e[70]:(Z=C.error?(0,A.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:C.error}):null,e[69]=C.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,A.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,A.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,A.jsxs)(ne,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function fe(e){return e.token}function pe(e){return e.language}function me(e){let t=(0,re.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,A.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,A.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,A.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,A.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,A.jsxs)(A.Fragment,{children:[` — `,(0,A.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,A.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function L(){return c(d(`/api/tunnel/status`))}async function R(){await c(d(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function z(){await c(d(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function B(){return c(d(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function V(e){return c(d(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function H(){let e=(await c(d(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function he(e){await c(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{T as _,H as a,I as c,j as d,E as f,C as g,S as h,R as i,oe as l,D as m,he as n,B as o,w as p,z as r,V as s,L as t,M as u,O as v};
@@ -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"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{n as o}from"./locale-store-BfZGZKSs.js";import{t as s}from"./cn-JdwAhgNB.js";import{Gl as c}from"./index-D4Ykja-U.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=o(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=s(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
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"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{n as o}from"./locale-store-B2v8mNJw.js";import{t as s}from"./cn-JdwAhgNB.js";import{Kl as c}from"./index-BBlJYVxR.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=o(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=s(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./x-B_N4OPjy.js";import{n as g}from"./locale-store-B2v8mNJw.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CtTvuElV.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$ as b,$l as x,Al as S,Cs as C,Dl as w,Il as T,Mc as E,Nc as D,Q as ee,Ql as te,Us as ne,Va as re,X as O,Xc as ie,Y as ae,Yl as k,Z as oe,_c as A,ac as se,au as ce,ec as le,et as ue,hu as j,tt as de,ul as M,ws as fe}from"./index-BBlJYVxR.js";import{t as pe}from"./page-tabs-YeJKwV-7.js";var N=n(),P=e(t(),1),F=r(),I={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},L=[`candidate`,`needs_review`,`conflicted`,`stale`],me=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),he=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function R(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function z(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function ge(e){return{callName:z(e.profile.callName)??``,role:z(e.profile.role)??``,pronouns:z(e.profile.pronouns)??``,timezone:z(e.profile.timezone)??``,locale:z(e.profile.locale)??``}}function _e(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function ve(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function B(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function V(e,t){if(e.validTo){let n=R(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ye(e,t){let n=R(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function H(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function U(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function xe(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function W(e){let t=(0,N.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,F.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,F.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,F.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,F.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,F.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function G(e){let t=(0,N.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,F.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,F.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Se({open:e,profile:t,language:n,saving:r,onOpenChange:d,onSave:g}){let _=I[n],[y,b]=(0,P.useState)(t);(0,P.useEffect)(()=>{e&&b(t)},[e,t]);let x=e=>{e.preventDefault(),g({callName:y.callName.trim(),role:y.role.trim(),pronouns:y.pronouns.trim(),timezone:y.timezone.trim(),locale:y.locale.trim()})},S=(e,t,n)=>(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,F.jsx)(`input`,{value:y[e],onChange:t=>b(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),C=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return y.locale&&!C.includes(y.locale)&&C.push(y.locale),(0,F.jsx)(u,{open:e,onOpenChange:d,children:(0,F.jsxs)(s,{children:[(0,F.jsx)(i,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,F.jsx)(c,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,F.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:x,children:[(0,F.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(l,{className:`font-semibold text-fg`,children:_.editProfile}),(0,F.jsx)(a,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.editProfileHint})]}),(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":_.cancel,children:(0,F.jsx)(h,{className:`size-4`})})})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[S(`callName`,_.callName,_.callNamePlaceholder),S(`role`,_.role,_.rolePlaceholder),S(`pronouns`,_.pronouns,_.pronounsPlaceholder),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.locale}),(0,F.jsxs)(f,{value:y.locale,onChange:e=>b(t=>({...t,locale:e.target.value})),children:[(0,F.jsx)(p,{value:``,children:_.notProvided}),C.map(e=>(0,F.jsx)(p,{value:e,children:_e(e,n)},e))]})]}),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.timezone}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{value:y.timezone,onChange:e=>b(t=>({...t,timezone:e.target.value})),placeholder:O(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,F.jsx)(v,{className:`shrink-0 whitespace-nowrap`,onClick:()=>b(e=>({...e,timezone:O()})),children:_.useDeviceTimezone})]})]})]})}),(0,F.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{disabled:r,children:_.cancel})}),(0,F.jsxs)(v,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,F.jsx)(m,{className:`size-4 animate-spin`}):null,r?_.saving:_.saveProfile]})]})]})})]})})}function Ce(e){let t=(0,N.c)(28),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onAction:u,onCorrect:f}=e,p=I[r],m;t[0]===n.status?m=t[1]:(m=L.includes(n.status),t[0]=n.status,t[1]=m);let g=m,_;t[2]!==n||t[3]!==r?(_=be(n,r),t[2]=n,t[3]=r,t[4]=_):_=t[4];let y=_,b=`rounded-xl border p-4 ${g?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,x;t[5]!==i||t[6]!==y||t[7]!==o||t[8]!==a||t[9]!==n||t[10]!==r||t[11]!==g||t[12]!==u||t[13]!==l||t[14]!==f||t[15]!==s||t[16]!==c||t[17]!==p.cancel||t[18]!==p.confirm||t[19]!==p.correct||t[20]!==p.correctionPlaceholder||t[21]!==p.notTrue||t[22]!==p.save||t[23]!==p.stopUsing?(x=a?(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:p.correctionPlaceholder}),(0,F.jsx)(`textarea`,{id:`assertion-${n.id}`,value:o,onChange:e=>s(e.target.value),placeholder:p.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,onClick:l,children:p.cancel}),(0,F.jsx)(v,{variant:`primary`,className:`h-8`,disabled:!o.trim()||i,onClick:f,children:p.save})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,F.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(E,{className:`size-3.5`}),B(n,r)]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(T,{className:`size-3.5`}),V(n,r)]}),n.scope.type===`global`?null:(0,F.jsx)(`span`,{children:H(n.scope,r)}),y?(0,F.jsx)(`span`,{children:y}):null]}),(0,F.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:g?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`active`),children:[(0,F.jsx)(d,{className:`size-3.5`}),p.confirm]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(A,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`rejected`),children:[(0,F.jsx)(h,{className:`size-3.5`}),p.notTrue]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(A,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`archived`),children:[(0,F.jsx)(j,{className:`size-3.5`}),p.stopUsing]})]})})]}),t[5]=i,t[6]=y,t[7]=o,t[8]=a,t[9]=n,t[10]=r,t[11]=g,t[12]=u,t[13]=l,t[14]=f,t[15]=s,t[16]=c,t[17]=p.cancel,t[18]=p.confirm,t[19]=p.correct,t[20]=p.correctionPlaceholder,t[21]=p.notTrue,t[22]=p.save,t[23]=p.stopUsing,t[24]=x):x=t[24];let S;return t[25]!==b||t[26]!==x?(S=(0,F.jsx)(`article`,{className:b,children:x}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function we(e){let t=(0,N.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=I[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,F.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Te(e){let t=(0,N.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=I[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=R(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
2
+ `),t[3]=n.content,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,F.jsx)(ce,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),t[5]=m):m=t[5];let h=`whitespace-pre-wrap text-sm leading-6 text-fg ${a?``:`line-clamp-2`}`,g;t[6]!==n.content||t[7]!==h?(g=(0,F.jsx)(`p`,{className:h,children:n.content}),t[6]=n.content,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==n.scope||t[10]!==r?(_=H(n.scope,r),t[9]=n.scope,t[10]=r,t[11]=_):_=t[11];let y;t[12]===_?y=t[13]:(y=(0,F.jsx)(`span`,{children:_}),t[12]=_,t[13]=y);let b;t[14]===d?b=t[15]:(b=d?(0,F.jsx)(`span`,{children:d}):null,t[14]=d,t[15]=b);let x;t[16]!==y||t[17]!==b?(x=(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[y,b]}),t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==x||t[20]!==g?(S=(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,x]}),t[19]=x,t[20]=g,t[21]=S):S=t[21];let C;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==c.collapse||t[26]!==c.expand?(C=p?(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1 px-2`,onClick:o,children:[(0,F.jsx)(`span`,{className:`hidden sm:inline`,children:a?c.collapse:c.expand}),(0,F.jsx)(k,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})]}):null,t[22]=p,t[23]=a,t[24]=o,t[25]=c.collapse,t[26]=c.expand,t[27]=C):C=t[27];let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(j,{className:`size-3.5`}),t[28]=w):w=t[28];let T;t[29]!==i||t[30]!==s||t[31]!==c.archive?(T=(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,disabled:i,onClick:s,"aria-label":c.archive,title:c.archive,children:w}),t[29]=i,t[30]=s,t[31]=c.archive,t[32]=T):T=t[32];let E;t[33]!==C||t[34]!==T?(E=(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[C,T]}),t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;return t[36]!==S||t[37]!==E?(D=(0,F.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,S,E]})}),t[36]=S,t[37]=E,t[38]=D):D=t[38],D}function Ee(){let e=g(e=>e.language),t=I[e],n=re(e=>e.setPageHeader),r=re(e=>e.clearPageHeader),{data:i,error:a,isLoading:o,mutate:s}=_(`/api/user-model`,oe),[c,l]=(0,P.useState)(`overview`),[u,f]=(0,P.useState)(),[p,m]=(0,P.useState)(),[O,k]=(0,P.useState)(),[A,j]=(0,P.useState)(``),[N,z]=(0,P.useState)(``),[B,V]=(0,P.useState)(24),[be,H]=(0,P.useState)(),[Ee,K]=(0,P.useState)(!1);(0,P.useEffect)(()=>(n({startExtra:null,main:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,F.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:null}),r),[r,n,t]);let q=async(e,n)=>{f(e),m(void 0);try{await n(),await s()}catch{m(t.actionFailed)}finally{f(void 0)}},De=(e,t)=>{q(e.id,()=>ee(e.id,t))},Oe=e=>{q(e.id,async()=>{await ae(e.id,A.trim()),k(void 0),j(``)})},ke=async e=>{f(`profile`),m(void 0);try{await de(e),await s(),K(!1)}catch{m(t.actionFailed)}finally{f(void 0)}};if(o)return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(y,{className:`h-10 w-72 rounded-xl`}),(0,F.jsx)(y,{className:`h-72 rounded-xl`}),(0,F.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,F.jsx)(y,{className:`h-80 rounded-xl`}),(0,F.jsx)(y,{className:`h-80 rounded-xl`})]})]});if(a||!i)return(0,F.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,F.jsx)(x,{className:`size-6 text-fg-subtle`}),(0,F.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,F.jsx)(v,{onClick:()=>void s(),children:t.tryAgain})]});let J=[...i.assertions].sort((e,t)=>{let n=Number(L.includes(t.status))-Number(L.includes(e.status));if(n)return n;let r=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-r||t.recordedAt-e.recordedAt}).filter(e=>!me.has(e.predicate)),Y=ge(i),Ae=Y.callName||(e===`zh`?`你`:`You`),je=J.filter(e=>L.includes(e.status)),Me=J.filter(e=>e.status===`active`),Ne=Me.filter(e=>e.authority===`user_explicit`).length,Pe=Me.length-Ne,Fe=i.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),X=Fe.find(e=>e.rank===`primary`)??Fe[0],Ie=xe(X,i.goals,e),Le=X?.targetType===`goal`?i.goals.find(e=>e.id===X.targetId):void 0,Re=i.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>X?.targetType!==`goal`||e.id!==X.targetId),ze=i.rules.filter(e=>e.status!==`archived`),Be=[...Me].sort((e,t)=>t.recordedAt-e.recordedAt),Z=i.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),Ve=N.trim().toLocaleLowerCase(),Q=Z.filter(t=>!Ve||t.content.toLocaleLowerCase().includes(Ve)||U(t.kind,e).toLocaleLowerCase().includes(Ve)),He=[{key:`identity`,title:t.identity,icon:C,items:J.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:S,items:J.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:M,items:J.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:T,items:J.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:ne,items:J.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),Ue=he.map(e=>({kind:e,count:Z.filter(t=>t.kind===e).length})).filter(e=>e.count>0),We=Q.slice(0,B),Ge=he.map(e=>({kind:e,items:We.filter(t=>t.kind===e),totalCount:Q.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),$=t=>(0,F.jsx)(Ce,{item:t,language:e,busy:u===t.id,editing:O===t.id,draft:O===t.id?A:``,onDraftChange:j,onEdit:()=>{k(t.id),j(t.statement)},onCancel:()=>{k(void 0),j(``)},onAction:e=>De(t,e),onCorrect:()=>Oe(t)},t.id),Ke=i.maintenance.lastRun?R(i.maintenance.lastRun.finishedAt??i.maintenance.lastRun.startedAt,e,!0):null,qe=i.maintenance.lastRun?i.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Ke}`:t.maintenanceFailed:t.maintenanceReady;return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(pe,{items:[{id:`overview`,label:t.overview,icon:ne},{id:`understanding`,label:t.understanding,icon:C,count:J.length},{id:`knowledge`,label:t.knowledge,icon:ce,count:Z.length}],activeTab:c,onChange:l,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`}),p?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,F.jsx)(`span`,{children:p}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>m(void 0),"aria-label":t.cancel,children:(0,F.jsx)(h,{className:`size-4`})})]}):null,c===`overview`?(0,F.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-5`,children:[(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_21rem] lg:gap-10`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,F.jsx)(ne,{className:`size-3.5`}),(0,F.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex items-center gap-4`,children:[(0,F.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-active text-lg font-semibold text-fg sm:size-20 sm:text-xl`,children:ve(Ae)}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:Ae}),(0,F.jsx)(`p`,{className:`mt-1 truncate text-sm text-fg-muted`,children:Y.role||t.notProvided})]}),(0,F.jsxs)(v,{className:`shrink-0`,onClick:()=>K(!0),children:[(0,F.jsx)(fe,{className:`size-4`}),t.editProfile]})]}),(0,F.jsx)(`p`,{className:`mt-6 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,F.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-xl border border-edge bg-edge-subtle`,children:(0,F.jsx)(`div`,{className:`grid gap-px sm:grid-cols-3`,children:[{icon:ie,label:t.locale,value:Y.locale?_e(Y.locale,e):t.notProvided},{icon:D,label:t.timezone,value:Y.timezone||t.notProvided},{icon:C,label:t.pronouns,value:Y.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-4 py-3.5`,children:[(0,F.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,F.jsx)(e,{className:`size-3.5`}),t]}),(0,F.jsx)(`p`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})})]}),(0,F.jsxs)(`div`,{className:`flex min-h-52 flex-col rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,F.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),Ie?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`mt-4 text-xl font-semibold leading-7 tracking-tight text-fg`,children:Ie}),Le?.desiredOutcome?(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Le.desiredOutcome}):null,X?(0,F.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:ye(X.validTo,e)}):null]}):(0,F.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,F.jsx)(te,{className:`size-5 text-fg-subtle`}),(0,F.jsx)(`span`,{children:t.noPriority})]}),Re.length?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,F.jsx)(`div`,{className:`mt-2 space-y-2`,children:Re.slice(0,3).map(e=>(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,F.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-3`,children:[{icon:E,label:t.explicit,hint:t.explicitHint,count:Ne},{icon:x,label:t.learned,hint:t.learnedHint,count:Pe},{icon:d,label:t.pending,hint:t.pendingHint,count:je.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,F.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`border-t border-edge-subtle sm:border-l sm:border-t-0`:``}`,children:[(0,F.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,F.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]})]},t))})]}),je.length?(0,F.jsx)(W,{title:t.confirmTogether,hint:t.confirmHint,children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:je.map($)})}):null,(0,F.jsx)(W,{title:t.howWeWork,hint:t.howWeWorkHint,children:ze.length?ze.map(t=>(0,F.jsx)(we,{rule:t,language:e,busy:u===t.id,onToggle:()=>void q(t.id,()=>ue(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,F.jsx)(G,{icon:(0,F.jsx)(M,{className:`size-5`}),children:t.noRules})}),(0,F.jsx)(W,{title:t.recent,hint:t.recentHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`understanding`),children:t.seeAll}),children:Be.length?(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:Be.slice(0,6).map($)}):(0,F.jsx)(G,{icon:(0,F.jsx)(x,{className:`size-5`}),children:t.emptyGroup})}),(0,F.jsx)(W,{title:t.workMemory,hint:t.workMemoryHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`knowledge`),children:t.seeAll}),children:Ue.length?(0,F.jsx)(`div`,{className:`grid gap-px bg-edge-subtle sm:grid-cols-2 lg:grid-cols-4`,children:Ue.slice(0,4).map(({kind:t,count:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-5 py-4`,children:[(0,F.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U(t,e)})]},t))}):(0,F.jsx)(G,{icon:(0,F.jsx)(w,{className:`size-5`}),children:t.noKnowledge})}),(0,F.jsxs)(`footer`,{className:`flex items-center justify-between gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(se,{className:`size-3.5`}),qe]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,onClick:()=>void s(),children:[(0,F.jsx)(se,{className:`size-3.5`}),t.refresh]})]})]}):null,c===`understanding`?(0,F.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-5`,children:[(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-5 shadow-surface sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,F.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]})}),He.length?He.map(({key:e,title:t,icon:n,items:r})=>(0,F.jsx)(W,{title:t,action:(0,F.jsx)(n,{className:`size-4 text-fg-subtle`}),children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:r.map($)})},e)):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(x,{className:`size-5`}),children:t.emptyGroup})})]}):null,c===`knowledge`?(0,F.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,F.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.allMemory}),(0,F.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[Z.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,F.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,F.jsx)(le,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,F.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,F.jsx)(`input`,{type:`search`,value:N,onChange:e=>{z(e.target.value),V(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),Q.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`space-y-4`,children:Ge.map(({kind:t,items:n,totalCount:r})=>(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-3 sm:px-6`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:U(t,e)}),(0,F.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,F.jsx)(`div`,{children:n.map(t=>(0,F.jsx)(Te,{item:t,language:e,busy:u===t.id,expanded:be===t.id,onToggle:()=>H(e=>e===t.id?void 0:t.id),onArchive:()=>void q(t.id,()=>b(t.id,`archived`))},t.id))})]},t))}),Q.length>B?(0,F.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,F.jsx)(v,{onClick:()=>V(e=>e+24),children:t.showMore})}):null]}):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(le,{className:`size-5`}),children:N.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,F.jsx)(Se,{open:Ee,profile:Y,language:e,saving:u===`profile`,onOpenChange:K,onSave:e=>void ke(e)})]})}export{Ee as UserModelPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{Xa as i}from"./index-D4Ykja-U.js";import{m as a}from"./voice-config-api-e9xWjwBX.js";var o=t();e();var s=n();function c(e){let t=(0,o.c)(15),{kind:n,providerId:c,fieldId:u,value:d,onChange:f,labels:p,placeholder:m,className:h}=e,g=m===void 0?`sk-...`:m,_;t[0]!==n||t[1]!==c?(_=()=>a({kind:n,provider:c}).then(l),t[0]=n,t[1]=c,t[2]=_):_=t[2];let v=_,y;t[3]===h?y=t[4]:(y=r(`flex min-w-0 flex-col gap-1.5`,h),t[3]=h,t[4]=y);let b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==g||t[9]!==v||t[10]!==d?(b=(0,s.jsx)(i,{id:u,value:d,onChange:f,placeholder:g,labels:p,reveal:v,loadFailedLabel:p.loadFailed,maskedHelp:p.maskedHelp,notInConfigFile:p.notInConfigFile,inputClassName:`text-xs`}),t[5]=u,t[6]=p,t[7]=f,t[8]=g,t[9]=v,t[10]=d,t[11]=b):b=t[11];let x;return t[12]!==y||t[13]!==b?(x=(0,s.jsx)(`div`,{className:y,children:b}),t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function l(e){return e.apiKey??null}export{c as t};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{Xa as i}from"./index-BBlJYVxR.js";import{m as a}from"./voice-config-api-B1ZbyVmF.js";var o=t();e();var s=n();function c(e){let t=(0,o.c)(15),{kind:n,providerId:c,fieldId:u,value:d,onChange:f,labels:p,placeholder:m,className:h}=e,g=m===void 0?`sk-...`:m,_;t[0]!==n||t[1]!==c?(_=()=>a({kind:n,provider:c}).then(l),t[0]=n,t[1]=c,t[2]=_):_=t[2];let v=_,y;t[3]===h?y=t[4]:(y=r(`flex min-w-0 flex-col gap-1.5`,h),t[3]=h,t[4]=y);let b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==g||t[9]!==v||t[10]!==d?(b=(0,s.jsx)(i,{id:u,value:d,onChange:f,placeholder:g,labels:p,reveal:v,loadFailedLabel:p.loadFailed,maskedHelp:p.maskedHelp,notInConfigFile:p.notInConfigFile,inputClassName:`text-xs`}),t[5]=u,t[6]=p,t[7]=f,t[8]=g,t[9]=v,t[10]=d,t[11]=b):b=t[11];let x;return t[12]!==y||t[13]!==b?(x=(0,s.jsx)(`div`,{className:y,children:b}),t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function l(e){return e.apiKey??null}export{c as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-BfZGZKSs.js";import{n}from"./gateway-config-swr-9HidFZUd.js";var r=`xopc-local-voice-model-install-started`;async function i(){return(await e(t(`/api/voice/realtime/status`))).payload}async function a(n){let r=await e(t(`/api/voice/realtime/preview`),{method:`POST`,signal:n});if(r.payload.sampleRate!==24e3)throw Error(`Unsupported preview sample rate`);return Uint8Array.from(atob(r.payload.audio),e=>e.charCodeAt(0)).buffer}async function o(n,r,i){let a=new URLSearchParams({provider:n,model:r});return i&&a.set(`purpose`,i),(await e(t(`/api/voice/tts-voices?${a.toString()}`))).payload?.voices??[]}function s(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function c(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`}}}}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function d(e){let t=s();if(!l(e))return t;let n=u(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(l(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function p(e){let t=c();if(!l(e))return t;let n=f(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function m(e){return{...e}}function h(e){return{...e}}function g(e){let t=l(e)?e:{},n=l(t.voice)?t.voice:{},r=l(n.input)?n.input:{},i=l(r.refinement)?r.refinement:{},a=l(n.realtime)?n.realtime:{},o=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:d(t.stt),tts:p(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:o,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}},realtime:{enabled:a.enabled===!0,defaultEngine:a.defaultEngine===`omni`?`omni`:`agent`,silenceDurationMs:typeof a.silenceDurationMs==`number`?a.silenceDurationMs:1200,idleTimeoutMs:typeof a.idleTimeoutMs==`number`?a.idleTimeoutMs:6e4,maxDictationMs:typeof a.maxDictationMs==`number`?a.maxDictationMs:6e5,maxConversationMs:typeof a.maxConversationMs==`number`?a.maxConversationMs:36e5,bargeIn:a.bargeIn!==!1,...l(a.tts)&&(a.tts.provider===`alibaba`||a.tts.provider===`xopc-cloud`)?{tts:{provider:a.tts.provider,...typeof a.tts.voice==`string`?{voice:a.tts.voice}:{}}}:{},...l(a.omni)?{omni:{...a.omni}}:{}}}}}async function _(){return g((await e(t(`/api/config`))).payload?.config??{})}async function v(r){await e(t(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:m(r.stt),tts:h(r.tts),voice:r.voice})}),r.voice.languageMode===`auto`&&await e(t(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:r.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),n()}async function y(){let n=await e(t(`/api/voice/models`));if(!n.payload?.models)throw Error(`Missing voice models payload`);return n.payload.models}async function b(){let n=await e(t(`/api/voice/providers`));if(!n.payload?.providers)throw Error(`Missing voice providers payload`);return n.payload}async function x(){let n=await e(t(`/api/voice/stt-providers`));if(!n.payload?.providers)throw Error(`Missing STT providers payload`);return n.payload}async function S(){let n=await e(t(`/api/voice/local/status`));if(!n.payload)throw Error(`Missing local voice status payload`);return n.payload}async function C(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}/install`),{method:`POST`,body:`{}`})}async function w(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}`),{method:`DELETE`})}async function T(n,r){let i=await e(t(`/api/voice/tts-test`),{method:`POST`,signal:r,body:JSON.stringify(n)});if(i.ok===!1){let e=typeof i.error==`string`?i.error:i.error?.message;throw Error(e||`TTS test failed`)}if(!i.payload||typeof i.payload.audio!=`string`||!i.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return i.payload}async function E(n){let r=await e(t(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(n)});if(!r.payload)throw Error(`Missing reveal payload`);return r.payload}export{y as a,x as c,v as d,a as f,T as h,o as i,C as l,E as m,S as n,b as o,w as p,i as r,_ as s,r as t,g as u};
1
+ import{a as e,r as t}from"./locale-store-B2v8mNJw.js";import{n}from"./gateway-config-swr-Chsr5wGH.js";var r=`xopc-local-voice-model-install-started`;async function i(){return(await e(t(`/api/voice/realtime/status`))).payload}async function a(n){let r=await e(t(`/api/voice/realtime/preview`),{method:`POST`,signal:n});if(r.payload.sampleRate!==24e3)throw Error(`Unsupported preview sample rate`);return Uint8Array.from(atob(r.payload.audio),e=>e.charCodeAt(0)).buffer}async function o(n,r,i){let a=new URLSearchParams({provider:n,model:r});return i&&a.set(`purpose`,i),(await e(t(`/api/voice/tts-voices?${a.toString()}`))).payload?.voices??[]}function s(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function c(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`}}}}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function d(e){let t=s();if(!l(e))return t;let n=u(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(l(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function p(e){let t=c();if(!l(e))return t;let n=f(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function m(e){return{...e}}function h(e){return{...e}}function g(e){let t=l(e)?e:{},n=l(t.voice)?t.voice:{},r=l(n.input)?n.input:{},i=l(r.refinement)?r.refinement:{},a=l(n.realtime)?n.realtime:{},o=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:d(t.stt),tts:p(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:o,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}},realtime:{enabled:a.enabled===!0,defaultEngine:a.defaultEngine===`omni`?`omni`:`agent`,silenceDurationMs:typeof a.silenceDurationMs==`number`?a.silenceDurationMs:1200,idleTimeoutMs:typeof a.idleTimeoutMs==`number`?a.idleTimeoutMs:6e4,maxDictationMs:typeof a.maxDictationMs==`number`?a.maxDictationMs:6e5,maxConversationMs:typeof a.maxConversationMs==`number`?a.maxConversationMs:36e5,bargeIn:a.bargeIn!==!1,...l(a.tts)&&(a.tts.provider===`alibaba`||a.tts.provider===`xopc-cloud`)?{tts:{provider:a.tts.provider,...typeof a.tts.voice==`string`?{voice:a.tts.voice}:{}}}:{},...l(a.omni)?{omni:{...a.omni}}:{}}}}}async function _(){return g((await e(t(`/api/config`))).payload?.config??{})}async function v(r){await e(t(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:m(r.stt),tts:h(r.tts),voice:r.voice})}),r.voice.languageMode===`auto`&&await e(t(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:r.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),n()}async function y(){let n=await e(t(`/api/voice/models`));if(!n.payload?.models)throw Error(`Missing voice models payload`);return n.payload.models}async function b(){let n=await e(t(`/api/voice/providers`));if(!n.payload?.providers)throw Error(`Missing voice providers payload`);return n.payload}async function x(){let n=await e(t(`/api/voice/stt-providers`));if(!n.payload?.providers)throw Error(`Missing STT providers payload`);return n.payload}async function S(){let n=await e(t(`/api/voice/local/status`));if(!n.payload)throw Error(`Missing local voice status payload`);return n.payload}async function C(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}/install`),{method:`POST`,body:`{}`})}async function w(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}`),{method:`DELETE`})}async function T(n,r){let i=await e(t(`/api/voice/tts-test`),{method:`POST`,signal:r,body:JSON.stringify(n)});if(i.ok===!1){let e=typeof i.error==`string`?i.error:i.error?.message;throw Error(e||`TTS test failed`)}if(!i.payload||typeof i.payload.audio!=`string`||!i.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return i.payload}async function E(n){let r=await e(t(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(n)});if(!r.payload)throw Error(`Missing reveal payload`);return r.payload}export{y as a,x as c,v as d,a as f,T as h,o as i,C as l,E as m,S as n,b as o,w as p,i as r,_ as s,r as t,g as u};
@@ -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{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-DaIwVWar.js";import{n as f}from"./locale-store-BfZGZKSs.js";import{t as p}from"./button-CtTvuElV.js";import{Q as m,q as h,ro as g}from"./index-D4Ykja-U.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=f(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=d(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(c,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(a,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(h,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(o,{children:[z,(0,y.jsx)(s,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(l,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./messages-ChSTFZR5.js";import{n as f}from"./locale-store-B2v8mNJw.js";import{t as p}from"./button-CtTvuElV.js";import{B as m,G as h,ro as g}from"./index-BBlJYVxR.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=f(C),w=h(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=d(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(i,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(c,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(a,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(m,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(o,{children:[z,(0,y.jsx)(s,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(l,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};