@xopcai/xopc 0.0.172 → 0.0.174

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 (223) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-C3Y-bESI.js → activity-store-CyEDJeIt.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CPyev9P7.js → agent-avatar-dicebear-DF7Bol6I.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-B7qEr_Rw.js → api-DYunqroX.js} +1 -1
  7. package/dist/gateway/static/root/assets/api-DwyUxpgY.js +1 -0
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-Br_9-7fs.js → app-management-settings-panel-B4xJyvDu.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-uyLcRPai.js → appearance-settings-B2PQxRiu.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-B19REnR5.js → archive-plugin-DWhBmmjD.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-DLWCC4Yi.js → attachment-load-BOpZfa_I.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-ky5S5lly.js → automation-suggestion-card-Byu3I7Rs.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-CtPEzLlo.js → binary-plugins-6AG1qatz.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-CQVR4Xij.js → block-editor-CJhrn98_.js} +5 -5
  17. package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CimCGbhq.js → browser-workflow-inputs-CBVb4mt9.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-DewuCw3p.js → browser-workflows-page-Cq4XUKbu.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +7 -0
  21. package/dist/gateway/static/root/assets/{capability-presets-api-B5RTs-Az.js → capability-presets-api-hbW4NAKO.js} +1 -1
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +1 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-Czu0YzIZ.js → channel-recipient-api-CzMjHb17.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-Di3gnR_D.js → connector-logo-B9Au6gMZ.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +2 -0
  28. package/dist/gateway/static/root/assets/copy-VueTIC2x.js +1 -0
  29. package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-C3L6AI8_.js → desktop-pet-settings-CNff5TFb.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-Dvq4iG6P.js → directory-picker-path-field-Bf956uo-.js} +1 -1
  32. package/dist/gateway/static/root/assets/dreaming-settings-CHM8FE1g.js +3 -0
  33. package/dist/gateway/static/root/assets/{extension-debug-page-BecQjU0J.js → extension-debug-page-ZqM_0eUs.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BeVkPSm-.js → extension-page-D4hvXOMM.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-DMoo2mKx.js → extension-settings-page-GsqxaJjA.js} +1 -1
  36. package/dist/gateway/static/root/assets/focus-detail-page-CE6uwrl1.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-config-api-Bthb3_6v.js → gateway-config-api-B4THmgnS.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-Bh8nPvJQ.js → gateway-settings-CPv-MxGE.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-D3USVm9D.js → gateway-startup-retry-MP3K71pP.js} +1 -1
  40. package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +1 -0
  41. package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +4 -0
  42. package/dist/gateway/static/root/assets/{goals-config-api-C_2QWBtb.js → goals-config-api-DCcDuIjG.js} +1 -1
  43. package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +2 -0
  44. package/dist/gateway/static/root/assets/{goals-settings-DhL643tc.js → goals-settings-o9QMXvNq.js} +1 -1
  45. package/dist/gateway/static/root/assets/{heartbeat-settings-COVFwp7C.js → heartbeat-settings-DixwpXnH.js} +1 -1
  46. package/dist/gateway/static/root/assets/{image-generation-api-BNQlnwpU.js → image-generation-api-BOGH9FGi.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-CfXiRNN5.css +1 -0
  48. package/dist/gateway/static/root/assets/index-eyttVNS_.js +212 -0
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DfdJRJVy.js → keyboard-shortcuts-settings-D4o4ZPF6.js} +1 -1
  50. package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +2 -0
  51. package/dist/gateway/static/root/assets/{local-apps-page-BvCPOgoi.js → local-apps-page-GzMmpO7G.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-BP0vD37A.js → locale-store-CAuhEGCn.js} +1 -1
  53. package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +7 -0
  54. package/dist/gateway/static/root/assets/{markdown-split-YO1rDk9m.js → markdown-split-CIX8D1pv.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-CU_RRf-q.js → media-plugins-Bp3eIA45.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +3 -0
  57. package/dist/gateway/static/root/assets/{notes-page-CeFiOK3S.js → notes-page-RVFiYAoO.js} +1 -1
  58. package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +4 -0
  59. package/dist/gateway/static/root/assets/{page-tabs-tiHmRJUA.js → page-tabs-BGAYH3Ef.js} +1 -1
  60. package/dist/gateway/static/root/assets/{preview-open-alternatives-CU6XgaCz.js → preview-open-alternatives-BM6pDkHp.js} +1 -1
  61. package/dist/gateway/static/root/assets/{product-open-page-Dn4_qor4.js → product-open-page-BiMetEmn.js} +1 -1
  62. package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +1 -0
  63. package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +1 -0
  64. package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +1 -0
  65. package/dist/gateway/static/root/assets/{save-bar-controls-edDUIbXo.js → save-bar-controls-BdjV8MK5.js} +1 -1
  66. package/dist/gateway/static/root/assets/{schedule-field-DqJO_5Yb.js → schedule-field-ChlqXU46.js} +1 -1
  67. package/dist/gateway/static/root/assets/{schema-form-CMh0jzy5.js → schema-form-DDKf5ZSH.js} +1 -1
  68. package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +1 -0
  69. package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +1 -0
  70. package/dist/gateway/static/root/assets/{settings-form-section-Bb0Bc3nJ.js → settings-form-section-CPG0KGVs.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DQhADvz1.js → settings-loading-skeleton-DRSDHucM.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-page-b0M5HukN.js → settings-page-CeB7_xD0.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-layout-hvjtIjvh.js → settings-page-layout-BENrkwd0.js} +1 -1
  74. package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +1 -0
  75. package/dist/gateway/static/root/assets/{share-preview-page-rbeaOpTg.js → share-preview-page-DIzczJkG.js} +1 -1
  76. package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +1 -0
  77. package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +1 -0
  78. package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +2 -0
  79. package/dist/gateway/static/root/assets/{system-settings-panel-BHo_hgnL.js → system-settings-panel-Dp4d5Q1B.js} +1 -1
  80. package/dist/gateway/static/root/assets/{theme-store-C3KnnjcU.js → theme-store-CbGc1laW.js} +1 -1
  81. package/dist/gateway/static/root/assets/{time-picker-D-G-uwVJ.js → time-picker-BhgCeDuO.js} +1 -1
  82. package/dist/gateway/static/root/assets/{typed-models-lib-DtRnG-YI.js → typed-models-lib-DwPk3OPL.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-channel-catalog-CWWItX2g.js → use-channel-catalog-CXrEu2dw.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +1 -0
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-BTnltQHZ.js → voice-api-key-field-DFoA79LB.js} +1 -1
  86. package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +1 -0
  87. package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +1 -0
  88. package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +1 -0
  89. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D7vKChFZ.js → workflow-run-setup-panel-BuniGPO0.js} +2 -2
  90. package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.js +11 -0
  91. package/dist/gateway/static/root/index.html +7 -7
  92. package/dist/package.js +1 -1
  93. package/dist/src/agent/agent-manager.d.ts +3 -1
  94. package/dist/src/agent/agent-manager.js +4 -3
  95. package/dist/src/agent/capabilities/definitions.d.ts +2 -1
  96. package/dist/src/agent/capabilities/definitions.js +3 -1
  97. package/dist/src/agent/prompt/sections/tooling.js +4 -0
  98. package/dist/src/agent/service.d.ts +2 -1
  99. package/dist/src/agent/service.js +26 -0
  100. package/dist/src/agent/skills/hub-pull.js +1 -1
  101. package/dist/src/agent/skills/index.js +1 -1
  102. package/dist/src/agent/skills/install-target.js +1 -1
  103. package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.d.ts +64 -0
  104. package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +27 -18
  105. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  106. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  107. package/dist/src/agent/skills/marketplace/search.d.ts +46 -0
  108. package/dist/src/agent/skills/marketplace/search.js +193 -0
  109. package/dist/src/agent/skills/skill-tool-gating.js +2 -1
  110. package/dist/src/agent/tools/delegate-tool.js +2 -0
  111. package/dist/src/agent/tools/factory.d.ts +4 -2
  112. package/dist/src/agent/tools/factory.js +11 -5
  113. package/dist/src/agent/tools/index.d.ts +2 -1
  114. package/dist/src/agent/tools/index.js +2 -1
  115. package/dist/src/agent/tools/skill-install-tool.d.ts +17 -0
  116. package/dist/src/agent/tools/skill-install-tool.js +76 -8
  117. package/dist/src/agent/tools/skills-marketplace-search-tool.d.ts +17 -0
  118. package/dist/src/agent/tools/skills-marketplace-search-tool.js +77 -0
  119. package/dist/src/browser/providers/cloakbrowser.js +1 -1
  120. package/dist/src/capabilities/store-connector.js +1 -1
  121. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  122. package/dist/src/config/agent-profile.js +1 -1
  123. package/dist/src/extensions/api.js +1 -1
  124. package/dist/src/extensions/install.js +1 -1
  125. package/dist/src/focuses/candidate-repository.d.ts +15 -0
  126. package/dist/src/focuses/candidate-repository.js +91 -0
  127. package/dist/src/focuses/index.d.ts +7 -0
  128. package/dist/src/focuses/index.js +7 -0
  129. package/dist/src/focuses/insight-repository.d.ts +22 -0
  130. package/dist/src/focuses/insight-repository.js +77 -0
  131. package/dist/src/focuses/prompts.d.ts +2 -0
  132. package/dist/src/focuses/prompts.js +18 -0
  133. package/dist/src/focuses/reconciler.d.ts +5 -0
  134. package/dist/src/focuses/reconciler.js +26 -0
  135. package/dist/src/focuses/repository.d.ts +61 -0
  136. package/dist/src/focuses/repository.js +214 -0
  137. package/dist/src/focuses/run-processor.d.ts +18 -0
  138. package/dist/src/focuses/run-processor.js +162 -0
  139. package/dist/src/focuses/service.d.ts +42 -0
  140. package/dist/src/focuses/service.js +241 -0
  141. package/dist/src/focuses/types.d.ts +89 -0
  142. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  143. package/dist/src/gateway/agent-builtin-tools.js +2 -0
  144. package/dist/src/gateway/agents-admin.js +1 -1
  145. package/dist/src/gateway/hono/routes/commands-skills.js +2 -2
  146. package/dist/src/gateway/hono/routes/focuses.d.ts +3 -0
  147. package/dist/src/gateway/hono/routes/focuses.js +319 -0
  148. package/dist/src/gateway/hono/routes/home.js +15 -17
  149. package/dist/src/gateway/hono/routes/index.js +2 -0
  150. package/dist/src/gateway/hono/routes/projects.js +2 -103
  151. package/dist/src/gateway/hono/routes/work-discovery.js +0 -239
  152. package/dist/src/gateway/service/marketplace-service.js +1 -1
  153. package/dist/src/gateway/service.d.ts +1 -1
  154. package/dist/src/gateway/service.js +15 -11
  155. package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +126 -0
  156. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  157. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  158. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  159. package/dist/src/storage/sqlite/schema.js +1 -1
  160. package/dist/src/work-discovery/index.d.ts +0 -2
  161. package/dist/src/work-discovery/index.js +1 -3
  162. package/dist/src/work-discovery/service.d.ts +0 -30
  163. package/dist/src/work-discovery/service.js +1 -35
  164. package/dist/src/work-discovery/thread-service.d.ts +5 -0
  165. package/dist/src/work-discovery/thread-service.js +36 -88
  166. package/package.json +1 -1
  167. package/skills/tools/find-skills/SKILL.md +18 -428
  168. package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +0 -2
  169. package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +0 -1
  170. package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +0 -6
  171. package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +0 -8
  172. package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +0 -7
  173. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BgchTh81.js +0 -1
  174. package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +0 -1
  175. package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +0 -1
  176. package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +0 -2
  177. package/dist/gateway/static/root/assets/desktop-pet-D-ZUNHhn.js +0 -1
  178. package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +0 -3
  179. package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +0 -1
  180. package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +0 -4
  181. package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +0 -2
  182. package/dist/gateway/static/root/assets/index-C_XSKOH6.css +0 -1
  183. package/dist/gateway/static/root/assets/index-DUasAutC.js +0 -212
  184. package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +0 -2
  185. package/dist/gateway/static/root/assets/logs-page-dNL0Y1dA.js +0 -7
  186. package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +0 -3
  187. package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +0 -4
  188. package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +0 -1
  189. package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +0 -1
  190. package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +0 -1
  191. package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +0 -1
  192. package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +0 -1
  193. package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +0 -1
  194. package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +0 -1
  195. package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +0 -1
  196. package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +0 -2
  197. package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +0 -1
  198. package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +0 -1
  199. package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +0 -1
  200. package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +0 -1
  201. package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +0 -11
  202. package/dist/src/proactive/calendar-signals.d.ts +0 -4
  203. package/dist/src/proactive/calendar-signals.js +0 -120
  204. package/dist/src/proactive/focus-service.d.ts +0 -62
  205. package/dist/src/proactive/focus-service.js +0 -173
  206. package/dist/src/proactive/index.d.ts +0 -7
  207. package/dist/src/proactive/index.js +0 -7
  208. package/dist/src/proactive/insight-repository.d.ts +0 -21
  209. package/dist/src/proactive/insight-repository.js +0 -109
  210. package/dist/src/proactive/run-processor.d.ts +0 -19
  211. package/dist/src/proactive/run-processor.js +0 -146
  212. package/dist/src/proactive/trial-expiry-reconciler.d.ts +0 -5
  213. package/dist/src/proactive/trial-expiry-reconciler.js +0 -30
  214. package/dist/src/proactive/types.d.ts +0 -66
  215. package/dist/src/proactive/value-score.d.ts +0 -13
  216. package/dist/src/proactive/value-score.js +0 -30
  217. package/dist/src/proactive/watch-repository.d.ts +0 -28
  218. package/dist/src/proactive/watch-repository.js +0 -129
  219. package/dist/src/work-discovery/governance.d.ts +0 -25
  220. package/dist/src/work-discovery/governance.js +0 -96
  221. package/dist/src/work-discovery/thread-repository.d.ts +0 -34
  222. package/dist/src/work-discovery/thread-repository.js +0 -112
  223. /package/dist/src/{proactive → focuses}/types.js +0 -0
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./copy-to-clipboard-HOJ79TWv.js";import{t as l}from"./messages-BiBdO1-O.js";import{a as u,i as d,l as f,n as p,o as m,r as h,s as g}from"./locale-store-CAuhEGCn.js";import{a as _,i as v}from"./vendor-swr-BIWyz7Rc.js";import{$o as y,Go as b,Ho as x,Js as S,Nt as C,Oc as w,Os as T,Ri as E,Sc as D,Uc as O,Un as k,Uo as A,Vo as j,Wl as M,Wo as N,Ws as P,Zl as F,_i as I,_u as L,bs as R,cc as z,ci as B,di as V,fi as H,gi as ee,gl as te,hi as ne,hu as U,kl as W,ks as G,li as K,ls as q,mi as J,no as re,nr as ie,oc as ae,oi as Y,ou as X,pc as oe,pi as se,ro as ce,si as le,tl as ue,to as de,ui as fe,us as pe,vi as me,wo as he,zo as ge}from"./index-eyttVNS_.js";import{n as _e,r as ve,t as ye}from"./settings-page-layout-BENrkwd0.js";import{t as be}from"./settings-advanced-gate-DcDLS0xV.js";import{n as xe,r as Se,t as Ce}from"./settings-form-section-CPG0KGVs.js";import{t as we}from"./browser-BLJWD7WI.js";import{t as Te}from"./page-tabs-BGAYH3Ef.js";var Z=n(),Q=e(t(),1),$=r();function Ee(e){let t=(0,Z.c)(26),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:c,defaultOpen:l,advancedOnly:u}=e,d=u===void 0?!1:u,[f,p]=(0,Q.useState)(l??!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>p(e.currentTarget.open),t[0]=m):m=t[0];let h;t[1]===c?h=t[2]:(h=s(`group rounded-2xl bg-surface-base open:pb-1`,c),t[1]=c,t[2]=h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(L,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[4]=i,t[5]=_);let v;t[6]===n?v=t[7]:(v=(0,$.jsx)(`span`,{className:`group-open:hidden`,children:n}),t[6]=n,t[7]=v);let y;t[8]===r?y=t[9]:(y=(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:r}),t[8]=r,t[9]=y);let b;t[10]!==_||t[11]!==v||t[12]!==y?(b=(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-2xl px-4 py-3.5 text-sm font-medium text-fg transition-colors hover:text-fg group-open:rounded-b-none [&::-webkit-details-marker]:hidden`,children:[g,_,v,y]}),t[10]=_,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]===a?x=t[15]:(x=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[14]=a,t[15]=x);let S;t[16]!==o||t[17]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[x,o]}),t[16]=o,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==f||t[20]!==S||t[21]!==h||t[22]!==b?(C=(0,$.jsxs)(`details`,{open:f,onToggle:m,className:h,children:[b,S]}),t[19]=f,t[20]=S,t[21]=h,t[22]=b,t[23]=C):C=t[23];let w=C;if(d){let e;return t[24]===w?e=t[25]:(e=(0,$.jsx)(be,{children:w}),t[24]=w,t[25]=e),e}return w}function De(e,t){let{mutate:n}=_(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{await Promise.all([n(`tunnel-pair-context`),n(`tunnel-pair`),n(`tunnel-status`),de()])},[n]);return{busy:r,error:a,confirmOpen:s,setConfirmOpen:c,runEnableLanPairing:(0,Q.useCallback)(async()=>{if(!(!e||r)){i(!0),o(null);try{let n=await fe();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await Y();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await le(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await B():n.context;if(!r?.pairingReady)throw Error(`LAN pairing is still not ready after restart`);return await l(),t?.(r),c(!1),r}catch(e){return o(e instanceof Error?e.message:`Enable LAN pairing failed`),null}finally{i(!1)}}},[r,e,t,l]),clearError:()=>o(null)}}function Oe(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,T,`dark:border-edge`)}function ke(e){let t=(0,Z.c)(122),{pairQr:n,gatewayToken:r,streamlined:i,lanOnly:o,onRefreshQr:c}=e,u=i===void 0?!1:i,d=o===void 0?!1:o,f=p(Me),m;t[0]===f?m=t[1]:(m=l(f),t[0]=f,t[1]=m);let h=m,g=h.tunnelSettings,_=d?h.remoteAccess.lan:null,v;t[2]!==h.clipboard.copyFailed||t[3]!==g.pairCopied||t[4]!==g.pairCopyLink?(v={copy:g.pairCopyLink,copied:g.pairCopied,copyFailed:h.clipboard.copyFailed},t[2]=h.clipboard.copyFailed,t[3]=g.pairCopied,t[4]=g.pairCopyLink,t[5]=v):v=t[5];let y=v,{tunnelActive:b,tunnelStatus:x,tunnelQr:S,pairContext:C,pairBaseUrl:w,setPairBaseUrl:T,applySuggestedPairUrl:O,applyCandidateUrl:k,resetPairBaseFromContext:A,baseOk:j,localhostWarn:M,pairingBlocked:N,deepLink:P,qrPayload:F,qrDataUrl:I,qrGenFailed:L,encoding:R}=n,z;t[6]===A?z=t[7]:(z=e=>{A(e.recommended.url)},t[6]=A,t[7]=z);let B=De(r,z),V,H,ee,te,ne;if(t[8]!==k||t[9]!==O||t[10]!==j||t[11]!==B||t[12]!==r||t[13]!==_||t[14]!==d||t[15]!==M||t[16]!==c||t[17]!==w||t[18]!==C?.candidates||t[19]!==C?.recommended||t[20]!==N||t[21]!==T||t[22]!==u||t[23]!==g.pairBaseUrlHint||t[24]!==g.pairBaseUrlLabel||t[25]!==g.pairBaseUrlPlaceholder||t[26]!==g.pairBlockedLoopbackBody||t[27]!==g.pairBlockedNextSteps||t[28]!==g.pairBlockedTitle||t[29]!==g.pairCandidatesTitle||t[30]!==g.pairEnableLanButton||t[31]!==g.pairEnableLanEnabling||t[32]!==g.pairEnableLanSecurityAuditLink||t[33]!==g.pairInvalidBaseUrl||t[34]!==g.pairLocalhostWarning||t[35]!==g.pairSelectCandidateHint||t[36]!==g.pairSelectCandidateTitle||t[37]!==g.pairSubtitle||t[38]!==g.pairSuggestedLanLabel||t[39]!==g.pairTitle||t[40]!==g.pairTunnelActive||t[41]!==g.pairTunnelLanUrl||t[42]!==g.pairTunnelPublicUrl||t[43]!==g.pairUseSuggestedUrl||t[44]!==g.pairWaitingForTunnel||t[45]!==g.refreshQr||t[46]!==b||t[47]!==S||t[48]!==x?.publicUrl){ne=Symbol.for(`react.early_return_sentinel`);bb0:{let e=C?.candidates.filter(je)??[],n=d?(e.find(Ae)?.url??e[0]?.url??``).trim():C?.recommended.url?.trim()??``,i=(d||!b)&&e.length>1,o=function(t){if(e.length===0)return null;let n=t===`amber`?`text-amber-950 dark:text-amber-100`:`text-fg`,r=t===`amber`?`text-amber-950/80 dark:text-amber-200/90`:`text-fg-muted`;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:s(`text-xs font-medium`,r),children:i?g.pairSelectCandidateTitle:g.pairCandidatesTitle}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:s(`w-full rounded-md border px-2 py-1.5 text-left font-mono text-[11px] transition-colors`,t===`amber`?`border-amber-300/70 hover:bg-amber-100/80 dark:border-amber-800 dark:hover:bg-amber-950/50`:`border-edge hover:bg-surface-panel`,w.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>k(e.url),children:[e.label?`${e.label}: `:``,e.url]})},e.url))}),i?(0,$.jsx)(`p`,{className:s(`mt-1 text-[11px] leading-relaxed`,r),children:g.pairSelectCandidateHint}):null]})};if(V=u&&!d,V&&!b){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ae,{className:`size-4 text-accent`,strokeWidth:1.75}),t[54]=e):e=t[54];let n;t[55]===g.pairTitle?n=t[56]:(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[e,g.pairTitle]}),t[55]=g.pairTitle,t[56]=n);let r;t[57]===g.pairWaitingForTunnel?r=t[58]:(r=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:g.pairWaitingForTunnel}),t[57]=g.pairWaitingForTunnel,t[58]=r);let i;t[59]!==n||t[60]!==r?(i=(0,$.jsxs)(Ce,{children:[n,r]}),t[59]=n,t[60]=r,t[61]=i):i=t[61],ne=i;break bb0}let l=_?.pairTitle??g.pairTitle,f=d?_?.pairSubtitle??g.pairSubtitle:b?g.pairTunnelActive:g.pairSubtitle,p=!!(c&&(d||u&&b)),m=V?`mb-2`:`mb-3`,h;t[62]===m?h=t[63]:(h=s(`flex flex-wrap items-start justify-between gap-2`,m),t[62]=m,t[63]=h);let v;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(ae,{className:`size-4 text-accent`,strokeWidth:1.75}),t[64]=v):v=t[64];let y;t[65]===l?y=t[66]:(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[v,l]}),t[65]=l,t[66]=y);let E;t[67]!==V||t[68]!==f||t[69]!==g.pairSubtitle?(E=V?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:g.pairSubtitle}):(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:f}),t[67]=V,t[68]=f,t[69]=g.pairSubtitle,t[70]=E):E=t[70];let A;t[71]!==y||t[72]!==E?(A=(0,$.jsxs)(`div`,{children:[y,E]}),t[71]=y,t[72]=E,t[73]=A):A=t[73];let P;t[74]!==c||t[75]!==p||t[76]!==g.refreshQr?(P=p?(0,$.jsxs)(G,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void c(),children:[(0,$.jsx)(D,{className:`size-4`}),g.refreshQr]}):null,t[74]=c,t[75]=p,t[76]=g.refreshQr,t[77]=P):P=t[77],t[78]!==h||t[79]!==A||t[80]!==P?(H=(0,$.jsxs)(`div`,{className:h,children:[A,P]}),t[78]=h,t[79]=A,t[80]=P,t[81]=H):H=t[81],ee=N?(0,$.jsxs)(`div`,{className:`mb-3 space-y-3 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-900/50 dark:bg-amber-950/30`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-950 dark:text-amber-100`,children:g.pairBlockedTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:g.pairBlockedLoopbackBody})]}),n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-amber-950/80 dark:text-amber-200/90`,children:g.pairSuggestedLanLabel}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-amber-950 dark:text-amber-100`,children:n})]}),(0,$.jsx)(G,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:O,children:g.pairUseSuggestedUrl})]}):null,e.length>0?o(`amber`):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:(0,$.jsxs)(G,{type:`button`,className:`w-full sm:w-auto`,disabled:B.busy||!r,onClick:()=>B.setConfirmOpen(!0),children:[B.busy?(0,$.jsx)(ue,{className:`size-3.5 animate-spin`}):null,B.busy?g.pairEnableLanEnabling:g.pairEnableLanButton]})}),B.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:B.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:d?_?.pairBlockedNextSteps??g.pairBlockedNextSteps:g.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(a,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:g.pairEnableLanSecurityAuditLink}),d&&_?.pairPublicTabLink?(0,$.jsx)(a,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:_.pairPublicTabLink}):null]})]}):null,te=b&&!d?V?null:(0,$.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.pairTunnelPublicUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:x?.publicUrl})]}),S?.lanUrl?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.pairTunnelLanUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:S.lanUrl})]}):null]}):(0,$.jsxs)(`div`,{className:`mb-3 space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`tunnel-mobile-pair-base`,children:g.pairBaseUrlLabel}),(0,$.jsx)(`input`,{id:`tunnel-mobile-pair-base`,className:s(Oe(),`font-mono text-xs`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:n||g.pairBaseUrlPlaceholder,value:w,onChange:e=>T(e.target.value)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:g.pairBaseUrlHint}),!j&&w.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:g.pairInvalidBaseUrl}):null,M?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:g.pairLocalhostWarning}):null,i?o(`neutral`):null]})}t[8]=k,t[9]=O,t[10]=j,t[11]=B,t[12]=r,t[13]=_,t[14]=d,t[15]=M,t[16]=c,t[17]=w,t[18]=C?.candidates,t[19]=C?.recommended,t[20]=N,t[21]=T,t[22]=u,t[23]=g.pairBaseUrlHint,t[24]=g.pairBaseUrlLabel,t[25]=g.pairBaseUrlPlaceholder,t[26]=g.pairBlockedLoopbackBody,t[27]=g.pairBlockedNextSteps,t[28]=g.pairBlockedTitle,t[29]=g.pairCandidatesTitle,t[30]=g.pairEnableLanButton,t[31]=g.pairEnableLanEnabling,t[32]=g.pairEnableLanSecurityAuditLink,t[33]=g.pairInvalidBaseUrl,t[34]=g.pairLocalhostWarning,t[35]=g.pairSelectCandidateHint,t[36]=g.pairSelectCandidateTitle,t[37]=g.pairSubtitle,t[38]=g.pairSuggestedLanLabel,t[39]=g.pairTitle,t[40]=g.pairTunnelActive,t[41]=g.pairTunnelLanUrl,t[42]=g.pairTunnelPublicUrl,t[43]=g.pairUseSuggestedUrl,t[44]=g.pairWaitingForTunnel,t[45]=g.refreshQr,t[46]=b,t[47]=S,t[48]=x?.publicUrl,t[49]=V,t[50]=H,t[51]=ee,t[52]=te,t[53]=ne}else V=t[49],H=t[50],ee=t[51],te=t[52],ne=t[53];if(ne!==Symbol.for(`react.early_return_sentinel`))return ne;let U;t[82]===g.pairSecurityNote?U=t[83]:(U=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:g.pairSecurityNote}),t[82]=g.pairSecurityNote,t[83]=U);let W;t[84]!==y||t[85]!==P||t[86]!==R||t[87]!==N||t[88]!==I||t[89]!==L||t[90]!==g.pairEncoding||t[91]!==g.pairImageError||t[92]!==g.pairQrDisabled?(W=P?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[I&&!L?(0,$.jsx)(`img`,{src:I,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,R?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.pairEncoding}):null,L?(0,$.jsx)(`p`,{className:`text-center text-sm text-fg-muted sm:text-left`,children:g.pairImageError}):null,(0,$.jsx)(E,{text:P,labels:y})]}):N?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.pairQrDisabled}):null,t[84]=y,t[85]=P,t[86]=R,t[87]=N,t[88]=I,t[89]=L,t[90]=g.pairEncoding,t[91]=g.pairImageError,t[92]=g.pairQrDisabled,t[93]=W):W=t[93];let K;t[94]!==V||t[95]!==F||t[96]!==g.deeplinkTitle?(K=F&&!V?(0,$.jsxs)(`details`,{className:`mt-3 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:g.deeplinkTitle}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:F})]}):null,t[94]=V,t[95]=F,t[96]=g.deeplinkTitle,t[97]=K):K=t[97];let q;t[98]!==V||t[99]!==g.pairMobileProbeHint||t[100]!==g.pairSchemeHint?(q=V?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:g.pairSchemeHint}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-fg-subtle`,children:g.pairMobileProbeHint})]}),t[98]=V,t[99]=g.pairMobileProbeHint,t[100]=g.pairSchemeHint,t[101]=q):q=t[101];let J,re;t[102]===B?(J=t[103],re=t[104]):(J=()=>void B.runEnableLanPairing(),re=()=>{B.busy||B.setConfirmOpen(!1)},t[102]=B,t[103]=J,t[104]=re);let Y;t[105]!==B.confirmOpen||t[106]!==g.consentCancel||t[107]!==g.pairEnableLanButton||t[108]!==g.pairEnableLanConfirmBody||t[109]!==g.pairEnableLanConfirmTitle||t[110]!==J||t[111]!==re?(Y=(0,$.jsx)(ie,{open:B.confirmOpen,title:g.pairEnableLanConfirmTitle,description:g.pairEnableLanConfirmBody,confirmLabel:g.pairEnableLanButton,cancelLabel:g.consentCancel,onConfirm:J,onCancel:re}),t[105]=B.confirmOpen,t[106]=g.consentCancel,t[107]=g.pairEnableLanButton,t[108]=g.pairEnableLanConfirmBody,t[109]=g.pairEnableLanConfirmTitle,t[110]=J,t[111]=re,t[112]=Y):Y=t[112];let X;return t[113]!==U||t[114]!==W||t[115]!==K||t[116]!==q||t[117]!==Y||t[118]!==H||t[119]!==ee||t[120]!==te?(X=(0,$.jsx)(Ce,{children:(0,$.jsxs)($.Fragment,{children:[H,ee,te,U,W,K,q,Y]})}),t[113]=U,t[114]=W,t[115]=K,t[116]=q,t[117]=Y,t[118]=H,t[119]=ee,t[120]=te,t[121]=X):X=t[121],X}function Ae(e){return e.reachable}function je(e){return e.kind===`lan`}function Me(e){return e.language}function Ne(e){let t=(0,Z.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:c,cancelLabel:l,onConfirm:u,onCancel:d}=e,[f,p]=(0,Q.useState)(!1),m;t[0]===d?m=t[1]:(m=e=>{e||(p(!1),d())},t[0]=d,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(A,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,pe)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=s(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,q),t[3]=g):g=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let v;t[6]===i?v=t[7]:(v=(0,$.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=v);let y;t[8]===a?y=t[9]:(y=a.map(Pe),t[8]=a,t[9]=y);let S;t[10]===y?S=t[11]:(S=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=S);let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>p(e.target.checked),t[12]=C):C=t[12];let w;t[13]===f?w=t[14]:(w=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:f,onChange:C}),t[13]=f,t[14]=w);let T;t[15]===o?T=t[16]:(T=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=T);let E;t[17]!==T||t[18]!==w?(E=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[w,T]}),t[17]=T,t[18]=w,t[19]=E):E=t[19];let D;t[20]!==l||t[21]!==d?(D=(0,$.jsx)(G,{type:`button`,variant:`secondary`,onClick:d,children:l}),t[20]=l,t[21]=d,t[22]=D):D=t[22];let O=!f,k;t[23]!==c||t[24]!==u||t[25]!==O?(k=(0,$.jsx)(G,{type:`button`,disabled:O,onClick:u,children:c}),t[23]=c,t[24]=u,t[25]=O,t[26]=k):k=t[26];let M;t[27]!==D||t[28]!==k?(M=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=M):M=t[29];let P;t[30]!==E||t[31]!==M||t[32]!==_||t[33]!==v||t[34]!==S?(P=(0,$.jsxs)(N,{children:[h,(0,$.jsxs)(j,{className:g,onOpenAutoFocus:Fe,children:[_,v,S,E,M]})]}),t[30]=E,t[31]=M,t[32]=_,t[33]=v,t[34]=S,t[35]=P):P=t[35];let F;return t[36]!==n||t[37]!==m||t[38]!==P?(F=(0,$.jsx)(ge,{open:n,onOpenChange:m,children:P}),t[36]=n,t[37]=m,t[38]=P,t[39]=F):F=t[39],F}function Pe(e){return(0,$.jsx)(`li`,{children:e},e)}function Fe(e){return e.preventDefault()}function Ie(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Le=[`preparing_frpc`,`registering`,`starting_frpc`];function Re(e){return e?e===`reconnecting_frpc`?Le.indexOf(`starting_frpc`):Le.indexOf(e):-1}function ze(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Le.indexOf(e),i=Re(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Be(e,t,n){let r=n.startProgress;return ze(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ve(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function He(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ue(e){let t=(0,Z.c)(31),{status:n,t:r}=e,[,i]=(0,Q.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(We),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let c=n.startProgress?.startedAt,l;if(t[3]!==n.state||t[4]!==c?(l=[n.state,c],t[3]=n.state,t[4]=c,t[5]=l):l=t[5],(0,Q.useEffect)(a,l),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let u,d,f,p,m;if(t[6]!==n||t[7]!==r){let e=He(n.startProgress?.startedAt);u=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,d=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let c=Le.map(e=>{let t=ze(e,n),i=Be(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(o,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(ue,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(X,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:s(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ve(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:s(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[Ie(n.frpcDownload.bytesReceived),` /`,` `,Ie(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===c?p=t[21]:(p=(0,$.jsx)(`ol`,{className:`space-y-2`,children:c}),t[20]=c,t[21]=p),m=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[22]!==u||t[23]!==r.publicUrlPendingNotice?(h=u?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=u,t[23]=r.publicUrlPendingNotice,t[24]=h):h=t[24];let g;return t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h?(g=(0,$.jsxs)(`div`,{className:d,children:[f,p,m,h]}),t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g):g=t[30],g}function We(e){return e+1}function Ge(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function Ke(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function qe(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function Je(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Ye(e){let t=(0,Z.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:c,showConsentExpired:l,copyLabels:u,startDisabled:d,startDisabledReason:f,stepLabel:p,onStart:m,onStop:h}=e,g=d===void 0?!1:d,_,v,y,b,x,S,C;t[0]!==r||t[1]!==o?(C=Ke(r),_=r.enabled||o,v=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=s(Se(),`space-y-4`),t[9]=S):S=t[9],x=`flex flex-wrap items-start justify-between gap-3`,b=`flex items-center gap-2`,y=s(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,qe(C)),t[0]=r,t[1]=o,t[2]=_,t[3]=v,t[4]=y,t[5]=b,t[6]=x,t[7]=S,t[8]=C):(_=t[2],v=t[3],y=t[4],b=t[5],x=t[6],S=t[7],C=t[8]);let T=C===`connected`&&`bg-emerald-500`,D=C===`progress`&&`bg-amber-500 animate-pulse`,O=C===`error`&&`bg-red-500`,k=C===`off`&&`bg-fg-subtle`,A;t[10]!==T||t[11]!==D||t[12]!==O||t[13]!==k?(A=s(`size-1.5 rounded-full`,T,D,O,k),t[10]=T,t[11]=D,t[12]=O,t[13]=k,t[14]=A):A=t[14];let j;t[15]===A?j=t[16]:(j=(0,$.jsx)(`span`,{className:A,"aria-hidden":!0}),t[15]=A,t[16]=j);let M;t[17]!==i||t[18]!==r||t[19]!==n?(M=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):Ge(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=M):M=t[20];let N;t[21]!==j||t[22]!==M||t[23]!==y?(N=(0,$.jsxs)(`span`,{className:y,children:[j,M]}),t[21]=j,t[22]=M,t[23]=y,t[24]=N):N=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,Je(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let I;t[29]!==N||t[30]!==F||t[31]!==b?(I=(0,$.jsxs)(`div`,{className:b,children:[N,F]}),t[29]=N,t[30]=F,t[31]=b,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(W,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=L):L=t[33];let R;t[34]!==I||t[35]!==x?(R=(0,$.jsxs)(`div`,{className:x,children:[I,L]}),t[34]=I,t[35]=x,t[36]=R):R=t[36];let z;t[37]===a?z=t[38]:(z=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=z);let B;t[39]!==l||t[40]!==n.consentExpiredBanner?(B=l?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=l,t[40]=n.consentExpiredBanner,t[41]=B):B=t[41];let V;t[42]!==_||t[43]!==u||t[44]!==m||t[45]!==h||t[46]!==v||t[47]!==r||t[48]!==g||t[49]!==f||t[50]!==o||t[51]!==p||t[52]!==c||t[53]!==n?(V=_?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(E,{label:n.publicUrlLabel,text:r.publicUrl,labels:u})}):null,v?(0,$.jsx)(Ue,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(G,{type:`button`,variant:`secondary`,disabled:c,onClick:h,children:[c?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(G,{type:`button`,disabled:o,onClick:m,children:[o?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):(0,$.jsx)(w,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(P,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),g&&f?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:f}):null,(0,$.jsxs)(G,{type:`button`,disabled:o||g,onClick:m,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):(0,$.jsx)(w,{className:`size-4`}),n.start]})]}),t[42]=_,t[43]=u,t[44]=m,t[45]=h,t[46]=v,t[47]=r,t[48]=g,t[49]=f,t[50]=o,t[51]=p,t[52]=c,t[53]=n,t[54]=V):V=t[54];let H;return t[55]!==R||t[56]!==z||t[57]!==B||t[58]!==V||t[59]!==S?(H=(0,$.jsxs)(`section`,{className:S,children:[R,z,B,V]}),t[55]=R,t[56]=z,t[57]=B,t[58]=V,t[59]=S,t[60]=H):H=t[60],H}var Xe=`https://console.xopc.ai/keys/tunnel`,Ze={reconfiguring:!1};function Qe(e){let t=(0,Z.c)(84),{t:n,brokerSecretFromEnv:r,brokerSecretMissing:i,brokerSecretConfiguredInConfig:a,brokerSecretMaskedValue:c,brokerSecretDraft:l,savingBrokerSecret:u,brokerSecretNotice:d,copyFailedLabel:f,onDraftChange:p,onSave:m,onClear:h,sectionRef:g}=e,_=(0,Q.useId)(),v=i&&!r,y=!v,[b,x]=(0,Q.useReducer)(C,Ze),{reconfiguring:S}=b,w;t[0]!==a||t[1]!==l||t[2]!==r||t[3]!==S?(w=a&&!r&&!S&&!l.trim(),t[0]=a,t[1]=l,t[2]=r,t[3]=S,t[4]=w):w=t[4];let T=w,E;t[5]!==n.copied||t[6]!==n.copyKey||t[7]!==n.hideKey||t[8]!==n.showKey?(E={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[5]=n.copied,t[6]=n.copyKey,t[7]=n.hideKey,t[8]=n.showKey,t[9]=E):E=t[9];let D=E,O;t[10]===l?O=t[11]:(O=l.trim().length>0&&!k(l.trim()),t[10]=l,t[11]=O);let A=O,j;t[12]===p?j=t[13]:(j=()=>{x({type:`patch`,patch:{reconfiguring:!1}}),p(``)},t[12]=p,t[13]=j);let N=j,P=v&&`ring-1 ring-amber-500/30`,F;t[14]===P?F=t[15]:(F=s(P),t[14]=P,t[15]=F);let I=y?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:v?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,L;t[16]===I?L=t[17]:(L=s(`flex size-9 shrink-0 items-center justify-center rounded-lg`,I),t[16]=I,t[17]=L);let z;t[18]===y?z=t[19]:(z=y?(0,$.jsx)(o,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[18]=y,t[19]=z);let B;t[20]!==L||t[21]!==z?(B=(0,$.jsx)(`span`,{className:L,children:z}),t[20]=L,t[21]=z,t[22]=B):B=t[22];let V=y?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,H;t[23]===V?H=t[24]:(H=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:V}),t[23]=V,t[24]=H);let ee=y?n.brokerSecretReadyHint:n.brokerSecretHint,ne;t[25]===ee?ne=t[26]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:ee}),t[25]=ee,t[26]=ne);let U;t[27]!==v||t[28]!==n.brokerSecretMissingHint?(U=v?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[27]=v,t[28]=n.brokerSecretMissingHint,t[29]=U):U=t[29];let W;t[30]!==H||t[31]!==ne||t[32]!==U?(W=(0,$.jsxs)(`div`,{children:[H,ne,U]}),t[30]=H,t[31]=ne,t[32]=U,t[33]=W):W=t[33];let K;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(M,{className:`size-3`,"aria-hidden":!0}),t[34]=K):K=t[34];let q;t[35]===n.brokerSecretConsoleLink?q=t[36]:(q=(0,$.jsxs)(`a`,{href:Xe,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,K]}),t[35]=n.brokerSecretConsoleLink,t[36]=q);let J;t[37]!==r||t[38]!==n.brokerSecretEnvHint?(J=r?(0,$.jsx)(`p`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-muted shadow-surface`,children:n.brokerSecretEnvHint}):null,t[37]=r,t[38]=n.brokerSecretEnvHint,t[39]=J):J=t[39];let re;t[40]!==a||t[41]!==l||t[42]!==r||t[43]!==c||t[44]!==A||t[45]!==N||t[46]!==f||t[47]!==_||t[48]!==v||t[49]!==h||t[50]!==p||t[51]!==m||t[52]!==S||t[53]!==u||t[54]!==D||t[55]!==T||t[56]!==n.brokerSecretCancelReconfigure||t[57]!==n.brokerSecretClear||t[58]!==n.brokerSecretMaskedHelp||t[59]!==n.brokerSecretNotInConfigFile||t[60]!==n.brokerSecretPlaceholder||t[61]!==n.brokerSecretReconfigure||t[62]!==n.brokerSecretRevealFailed||t[63]!==n.brokerSecretSave||t[64]!==n.brokerSecretSaveAndContinue||t[65]!==n.brokerSecretTitle?(re=T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:_,children:n.brokerSecretTitle}),(0,$.jsx)(R,{id:_,value:c,labels:D,reveal:$e,loadFailedLabel:f||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(G,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>{x({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(G,{type:`button`,variant:`ghost`,disabled:u,onClick:h,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:_,children:n.brokerSecretTitle}),(0,$.jsx)(R,{id:_,value:l,onChange:p,placeholder:n.brokerSecretPlaceholder,labels:D,disabled:u}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(G,{type:`button`,disabled:u||!A,onClick:m,children:[u?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):null,v?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),a||r?(0,$.jsx)(G,{type:`button`,variant:`ghost`,disabled:u,onClick:h,children:n.brokerSecretClear}):null,S?(0,$.jsx)(G,{type:`button`,variant:`ghost`,disabled:u,onClick:N,children:n.brokerSecretCancelReconfigure}):null]})]}),t[40]=a,t[41]=l,t[42]=r,t[43]=c,t[44]=A,t[45]=N,t[46]=f,t[47]=_,t[48]=v,t[49]=h,t[50]=p,t[51]=m,t[52]=S,t[53]=u,t[54]=D,t[55]=T,t[56]=n.brokerSecretCancelReconfigure,t[57]=n.brokerSecretClear,t[58]=n.brokerSecretMaskedHelp,t[59]=n.brokerSecretNotInConfigFile,t[60]=n.brokerSecretPlaceholder,t[61]=n.brokerSecretReconfigure,t[62]=n.brokerSecretRevealFailed,t[63]=n.brokerSecretSave,t[64]=n.brokerSecretSaveAndContinue,t[65]=n.brokerSecretTitle,t[66]=re):re=t[66];let ie;t[67]===d?ie=t[68]:(ie=d?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:d}):null,t[67]=d,t[68]=ie);let ae;t[69]!==W||t[70]!==q||t[71]!==J||t[72]!==re||t[73]!==ie?(ae=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[W,q,J,re,ie]}),t[69]=W,t[70]=q,t[71]=J,t[72]=re,t[73]=ie,t[74]=ae):ae=t[74];let Y;t[75]!==B||t[76]!==ae?(Y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[B,ae]}),t[75]=B,t[76]=ae,t[77]=Y):Y=t[77];let X;t[78]!==Y||t[79]!==F?(X=(0,$.jsx)(Ce,{className:F,children:Y}),t[78]=Y,t[79]=F,t[80]=X):X=t[80];let oe;return t[81]!==g||t[82]!==X?(oe=(0,$.jsx)(`div`,{ref:g,id:`tunnel-broker-secret-setup`,children:X}),t[81]=g,t[82]=X,t[83]=oe):oe=t[83],oe}function $e(){return ee().then(et)}function et(e){return e.registrationSecret??null}function tt(e){let t=(0,Z.c)(10),{language:n,label:r,section:i,className:a}=e,o;t[0]!==n||t[1]!==i?(o=y(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let c;t[3]===a?c=t[4]:(c=s(`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`,a),t[3]=a,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(M,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==o||t[8]!==c?(u=(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=o,t[8]=c,t[9]=u):u=t[9],u}var nt=e(we(),1),rt={width:216,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function it(e){return nt.toDataURL(e,rt)}function at(e){let t=e?.candidates??[],n=t.find(e=>e.kind===`lan`&&e.reachable),r=t.find(e=>e.kind===`lan`);return(n??r)?.url?.trim()??``}function ot(e,t){let n=t.trim();return!n||!e?!1:e.candidates.some(e=>e.kind===`tunnel`&&e.url.trim()===n)}function st(e,t){return e?t?at(e)||e.recommended.url?.trim()||``:e.recommended.url?.trim()||``:``}function ct(e,t){let n=t?.preferLan===!0,r=!!e,{mutate:i}=_(),a=(0,Q.useRef)(!1),{data:o}=v(r?`tunnel-status`:null,se,{refreshInterval:6e4}),{data:s,mutate:c}=v(r?`tunnel-pair-context`:null,V,{refreshInterval:6e4});(0,Q.useEffect)(()=>{let e=()=>{i(`tunnel-status`),i(`tunnel-qr`),i(`tunnel-pair`),i(`tunnel-pair-context`)};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[i]);let l=o?.state===`connected`&&!!o.publicUrl?.trim(),f=l&&!n,{data:p,mutate:m}=v(f&&r?`tunnel-qr`:null,H,{refreshInterval:4*6e4}),{data:h,mutate:g}=v(!f&&r&&s?.pairingReady?`tunnel-pair`:null,K,{refreshInterval:4*6e4}),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(s!==C.pairContext||n!==C.preferLan)){w({pairContext:s,preferLan:n});let e=st(s,n);y!==e&&b(e)}let T=(0,Q.useCallback)(e=>{a.current=!0,b(e)},[]),E=(0,Q.useCallback)(()=>{let e=st(s,n);e&&(a.current=!0,b(e))},[s,n]),D=(0,Q.useCallback)(e=>{let t=e.trim();t&&(a.current=!0,b(t))},[]),O=(0,Q.useCallback)(e=>{a.current=!1,b(e?.trim()||st(s,n))},[s,n]),k=y.trim(),A=(0,Q.useMemo)(()=>{try{let e=new URL(k);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[k]),j=A&&u(k),M=!f&&!!(s&&!s.pairingReady&&s.blockReason===`GATEWAY_LOOPBACK_ONLY`),N=!f&&A&&!j&&!!h?.pairingSecret&&(s?.pairingReady===!0||!M),P=(0,Q.useMemo)(()=>{let e=at(s);return n?e||(k&&!ot(s,k)?k:``):k},[s,n,k]),F=(0,Q.useMemo)(()=>{if(!e)return``;if(x.trim())return x.trim();if(f&&p?.qrPayload?.trim())return p.qrPayload.trim();if(!N||!h?.pairingSecret)return``;let t=s?.candidates.find(e=>e.kind===`tunnel`&&e.reachable),r=s?.candidates.find(e=>e.kind===`lan`&&e.reachable),i=n?P:t?.url??k;return i?d({baseUrl:i,pairingSecret:h.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,P,h?.pairingSecret,N,x,n,k,f,p?.qrPayload,s?.candidates]),I=he(()=>it(F),[F],{enabled:!!F,initial:null,errorData:null}),L=F?I.data:null,R=!!(F&&I.error!==null&&!I.loading);return{tunnelActive:l,tunnelStatus:o,tunnelQr:p,pairContext:s,pairBaseUrl:y,setPairBaseUrl:T,applySuggestedPairUrl:E,applyCandidateUrl:D,baseOk:A,localhostWarn:j,pairingBlocked:M,deepLink:F,qrPayload:F,qrDataUrl:L,qrGenFailed:R,encoding:!!(F&&!L&&!R),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){S(e.trim()),m({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:p?.lanUrl??null},!1);return}S(``),await c(),f?await m():s?.pairingReady&&await g()},[g,c,m,s?.pairingReady,p?.lanUrl,o?.publicUrl,f]),resetPairBaseFromContext:O}}var lt={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,brokerSecretNotice:null};function ut({embedded:e=!1}){let t=p(e=>e.language),n=l(t).tunnelSettings,r=f(e=>e.token),i=!!r,[a,o]=(0,Q.useReducer)(C,lt),{actionError:c,starting:u,stopping:d,savingAutoStart:m,consentOpen:h,autoStartConfirmOpen:g,releaseConfirmOpen:_,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,brokerSecretNotice:S}=a,w=(0,Q.useRef)(null),T=ct(r??``),{data:E}=re(i),{data:D,error:O,isLoading:A,mutate:j}=v(i?`tunnel-status`:null,se,{refreshInterval:e=>u?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),M=(0,Q.useMemo)(()=>{let e=E?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return D?.config?.autoStart===!0},[E,D?.config?.autoStart]),N=(0,Q.useMemo)(()=>{let e=E?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[E]),P=k(N),F=D?.registrationSecret?.source===`env`,L=D?.registrationSecret?.source===`missing`,R=D?.registrationSecret?.configured===!0;(0,Q.useEffect)(()=>{let e=()=>{j()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[j]);let z=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),B=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{actionError:null}}),o({type:`patch`,patch:{starting:!0}});try{let e=await I();await j(),de(),await T.refreshQr(e.qrPayload)}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{starting:!1}})}},[j,T.refreshQr]),V=(0,Q.useCallback)(()=>{if(!R){o({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),w.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(D?.consentRequired){o({type:`patch`,patch:{consentOpen:!0}});return}B()},[R,D?.consentRequired,B,n.brokerSecretRequiredBeforeStart]),H=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{consentOpen:!1}}),o({type:`patch`,patch:{actionError:null}});try{await ne(),await Promise.all([j(),B()])}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[j,B]),ee=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{actionError:null}}),o({type:`patch`,patch:{stopping:!0}});try{await me(),await Promise.all([T.refreshQr(),j()]),de()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{stopping:!1}})}},[j,T.refreshQr]),te=(0,Q.useCallback)(async e=>{o({type:`patch`,patch:{savingAutoStart:!0}}),o({type:`patch`,patch:{actionError:null}});try{await J({autoStart:e}),de()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingAutoStart:!1}})}},[]),U=(0,Q.useCallback)(()=>{if(M){te(!1);return}if(D?.consentRequired){o({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!D?.canAutoStart){o({type:`patch`,patch:{actionError:n.autoStartHint}});return}o({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[te,D?.canAutoStart,D?.consentRequired,n,M]),K=(0,Q.useCallback)(async()=>{let e=b.trim();if(e){o({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await J({registrationSecret:e}),o({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),de(),await j(),o({type:`patch`,patch:{actionError:null}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,j,n.brokerSecretSaved]),q=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await J({registrationSecret:null}),o({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),de(),await j()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{savingBrokerSecret:!1}})}},[j,n.brokerSecretCleared]),ae=(0,Q.useCallback)(async()=>{o({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await me({release:!0}),await Promise.all([T.refreshQr(),j()]),de()}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{o({type:`patch`,patch:{releasing:!1}})}},[j,T.refreshQr]),Y=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!i)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=D??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:M,brokerUrl:`https://frp.xopc.ai/api`}},oe=D?.consentRequired&&(X.enabled||M||D?.consent?.acceptedAt),ce=(0,$.jsx)(Qe,{t:n,brokerSecretFromEnv:F,brokerSecretMissing:L,brokerSecretConfiguredInConfig:P,brokerSecretMaskedValue:P?N:``,brokerSecretDraft:b,savingBrokerSecret:x,brokerSecretNotice:S,copyFailedLabel:l(t).clipboard.copyFailed,onDraftChange:e=>o({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void K(),onClear:()=>void q(),sectionRef:w}),le=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ne,{open:h,title:n.consentTitle,intro:n.consentIntro,bullets:z,checkboxLabel:n.consentCheckbox,confirmLabel:oe?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void H(),onCancel:()=>o({type:`patch`,patch:{consentOpen:!1}})},h?`consent-open`:`consent-closed`),(0,$.jsx)(ie,{open:g,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{o({type:`patch`,patch:{autoStartConfirmOpen:!1}}),te(!0)},onCancel:()=>o({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(ie,{open:_,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void ae(),onCancel:()=>o({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[c?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c}):null,ce,(0,$.jsx)(Ye,{t:n,status:X,isLoading:A,statusErr:O,starting:u,stopping:d,showConsentExpired:!!oe,copyLabels:Y,startDisabled:!R,startDisabledReason:R?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:V,onStop:()=>void ee()}),(0,$.jsx)(ke,{pairQr:T,gatewayToken:r??``,streamlined:!0,onRefreshQr:()=>void T.refreshQr()}),(0,$.jsxs)(Ee,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:s(`flex items-center gap-3 text-sm text-fg`,!M&&!D?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:M,disabled:m||!M&&!D?.canAutoStart,onChange:U}),n.autoStart]}),!D?.canAutoStart&&!M?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(G,{type:`button`,variant:`secondary`,disabled:y||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>o({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Ee,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(tt,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),le]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),c?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c}):null,ce,(0,$.jsx)(Ye,{t:n,status:X,isLoading:A,statusErr:O,starting:u,stopping:d,showConsentExpired:!!oe,copyLabels:Y,startDisabled:!R,startDisabledReason:R?void 0:n.brokerSecretRequiredBeforeStart,onStart:V,onStop:()=>void ee()}),(0,$.jsx)(ke,{pairQr:T,gatewayToken:r??``}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(G,{type:`button`,variant:`secondary`,disabled:y||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>o({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(ue,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(Ce,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:s(`flex items-center gap-3 text-sm text-fg`,!M&&!D?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:M,disabled:m||!M&&!D?.canAutoStart,onChange:U}),n.autoStart]}),!D?.canAutoStart&&!M?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(tt,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),le]})}async function dt(){let e=await m(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ft(e=`serve`){let t=await m(`/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 pt(){let e=await m(`/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 mt=`https://tailscale.com/download`;function ht(e){let t=(0,Z.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:mt,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function gt({embedded:e=!1}){let t=p(e=>e.language),n=l(t).remoteAccess.tailscale,r=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!f(e=>e.token),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),{data:u,mutate:d,isLoading:m}=v(i?`exposure-status`:null,dt,{refreshInterval:3e4}),h=u?.tailscale.hostname,g=u?.tailscale.active===!0,_=u?.tailscale.cliAvailable!==!1,y=h?`https://${h}/`:null,b=(0,Q.useCallback)(async()=>{o(!0),c(null);try{await ft(`serve`),await d()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[d]),x=(0,Q.useCallback)(async()=>{o(!0),c(null);try{await pt(),await d()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[d]);if(!i)return null;let S=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.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,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(ht,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.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,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.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,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&u?.tailscale.cliAvailable===!1?(0,$.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,$.jsx)(ht,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,m&&!u?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(ce,{className:`h-20 rounded-lg`}),(0,$.jsx)(ce,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Ce,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g?n.statusActive:n.statusOff}),y?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(E,{text:y,labels:r})}):null,s?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:s}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g?(0,$.jsxs)(G,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void x(),children:[a?(0,$.jsx)(ue,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(G,{type:`button`,disabled:a||!_,onClick:()=>void b(),children:[a?(0,$.jsx)(ue,{className:`mr-1 size-4 animate-spin`}):(0,$.jsx)(w,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)(tt,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?S:(0,$.jsxs)(Ce,{children:[(0,$.jsx)(xe,{icon:W,title:n.title,subtitle:n.subtitle}),S]})}function _t(){let e=(0,Z.c)(26),t=p(yt),n=f(vt),r;e[0]===t?r=e[1]:(r=l(t),e[0]=t,e[1]=r);let i=r.remoteAccess.lan,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={preferLan:!0},e[2]=o):o=e[2];let s=ct(n??``,o),c;e[3]!==i.subtitle||e[4]!==i.title?(c=(0,$.jsx)(xe,{icon:oe,title:i.title,subtitle:i.subtitle}),e[3]=i.subtitle,e[4]=i.title,e[5]=c):c=e[5];let u;e[6]===i.body?u=e[7]:(u=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.body}),e[6]=i.body,e[7]=u);let d;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),e[8]=d):d=e[8];let m;e[9]===i.link?m=e[10]:(m=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[i.link,d]}),e[9]=i.link,e[10]=m);let h;e[11]!==u||e[12]!==m?(h=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[u,m]}),e[11]=u,e[12]=m,e[13]=h):h=e[13];let g;e[14]!==c||e[15]!==h?(g=(0,$.jsxs)(Ce,{children:[c,h]}),e[14]=c,e[15]=h,e[16]=g):g=e[16];let _=n??``,v;e[17]===s?v=e[18]:(v=()=>void s.refreshQr(),e[17]=s,e[18]=v);let y;e[19]!==s||e[20]!==_||e[21]!==v?(y=(0,$.jsx)(ke,{pairQr:s,gatewayToken:_,lanOnly:!0,onRefreshQr:v}),e[19]=s,e[20]=_,e[21]=v,e[22]=y):y=e[22];let b;return e[23]!==y||e[24]!==g?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g,y]}),e[23]=y,e[24]=g,e[25]=b):b=e[25],b}function vt(e){return e.token}function yt(e){return e.language}function bt(e){let t=(0,Z.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=p(xt),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,u]=(0,Q.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{await c(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(u(!0),setTimeout(()=>u(!1),2e3))},t[2]=d):d=t[2];let f=d,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=m):m=t[3];let h,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>void f(),g=(0,$.jsx)(F,{className:`mr-1 size-4`}),t[4]=h,t[5]=g):(h=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(G,{type:`button`,variant:`ghost`,onClick:h,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=y):y=t[10];let b;t[11]!==v||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[m,v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(xe,{icon:S,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(Ce,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(xe,{icon:S,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let w;t[25]===x?w=t[26]:(w=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=w);let T;return t[27]!==C||t[28]!==w?(T=(0,$.jsxs)(Ce,{children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function xt(e){return e.language}function St(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(bt,{embedded:!0}),e[0]=t):t=e[0],t}function Ct(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function wt(e){let t=(0,Z.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ct(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Tt(e){let t=(0,Z.c)(32),{onOpenTab:n}=e,r=p(Ot),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!f(Dt),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:u}=v(o?`exposure-status`:null,dt,c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:15e3},t[3]=d):d=t[3];let{data:m}=v(o?`tunnel-status`:null,se,d),h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h={refreshInterval:6e4},t[4]=h):h=t[4];let{data:g}=v(o?`tunnel-pair-context`:null,V,h);if(!o)return null;let _=u?.tailscale.active===!0,y=m?.state,b=m?.enabled&&y===`connected`,x=m?.enabled&&(y===`connecting`||y===`reconnecting`||!!m?.startProgress||!!m?.frpcDownload),C=(g?.candidates??[]).some(Et),w=_?`active`:`off`,T=_?a.statusActive:a.statusOff,E;t[5]!==a.tailscaleCardTitle||t[6]!==w||t[7]!==T?(E={tab:`tailscale`,icon:W,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[5]=a.tailscaleCardTitle,t[6]=w,t[7]=T,t[8]=E):E=t[8];let D=b?`active`:x?`connecting`:`off`,k=b?a.statusActive:x?a.statusConnecting:a.statusOff,A;t[9]!==a.publicCardTitle||t[10]!==D||t[11]!==k?(A={tab:`public`,icon:O,title:a.publicCardTitle,kind:D,statusLabel:k},t[9]=a.publicCardTitle,t[10]=D,t[11]=k,t[12]=A):A=t[12];let j=C?`active`:`off`,M=C?a.statusActive:a.statusOff,N;t[13]!==a.reverseProxyCardTitle||t[14]!==j||t[15]!==M?(N={tab:`reverse-proxy`,icon:z,title:a.reverseProxyCardTitle,kind:j,statusLabel:M},t[13]=a.reverseProxyCardTitle,t[14]=j,t[15]=M,t[16]=N):N=t[16];let P;t[17]!==a.sshCardStatus||t[18]!==a.sshCardTitle?(P={tab:`ssh`,icon:S,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[17]=a.sshCardStatus,t[18]=a.sshCardTitle,t[19]=P):P=t[19];let F;t[20]!==a.lanCardStatus||t[21]!==a.lanCardTitle?(F={tab:`lan`,icon:oe,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[20]=a.lanCardStatus,t[21]=a.lanCardTitle,t[22]=F):F=t[22];let I;t[23]!==A||t[24]!==N||t[25]!==P||t[26]!==F||t[27]!==E?(I=[E,A,N,P,F],t[23]=A,t[24]=N,t[25]=P,t[26]=F,t[27]=E,t[28]=I):I=t[28];let L=I,R;return t[29]!==L||t[30]!==n?(R=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:L.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:s(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(wt,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[29]=L,t[30]=n,t[31]=R):R=t[31],R}function Et(e){return e.kind===`reverse-proxy`}function Dt(e){return e.token}function Ot(e){return e.language}function kt(e){let t=(0,Z.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:c,recommendedLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=s(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=u):u=t[0];let d;t[1]===a?d=t[2]:(d=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=d);let f;t[3]===n?f=t[4]:(f=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=f);let p;t[5]!==i||t[6]!==l?(p=i&&l?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:l}):null,t[5]=i,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==f||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,g,_]}),t[17]=d,t[18]=g,t[19]=v):v=t[19];let y;t[20]===c?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:c}),t[20]=c,t[21]=y);let b;return t[22]!==o||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:u,children:[v,y]}),t[22]=o,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function At(e){let t=(0,Z.c)(83),{onOpenTab:n}=e,r=p(Nt),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!f(Mt),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:u}=v(s?`exposure-status`:null,dt,c),d;t[3]===u?.conflicts?d=t[4]:(d=u?.conflicts??[],t[3]=u?.conflicts,t[4]=d);let m=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let h;t[7]===n?h=t[8]:(h=(0,$.jsx)(Tt,{onOpenTab:n}),t[7]=n,t[8]=h);let g;t[9]!==m||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(g=m.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:m.map(jt)})]}):null,t[9]=m,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=g):g=t[12];let _;t[13]===o.pickMethod?_=t[14]:(_=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=_);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(kt,{icon:W,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:y}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let C;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==x?(C=(0,$.jsx)(kt,{icon:O,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:x}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=x,t[29]=C):C=t[29];let w;t[30]===n?w=t[31]:(w=()=>n(`reverse-proxy`),t[30]=n,t[31]=w);let T;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==w?(T=(0,$.jsx)(kt,{icon:z,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:w}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=w,t[36]=T):T=t[36];let E;t[37]===n?E=t[38]:(E=()=>n(`ssh`),t[37]=n,t[38]=E);let D;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==E?(D=(0,$.jsx)(kt,{icon:S,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:E}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=E,t[43]=D):D=t[43];let k;t[44]===n?k=t[45]:(k=()=>n(`lan`),t[44]=n,t[45]=k);let A;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==k?(A=(0,$.jsx)(kt,{icon:oe,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:k}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==C||t[52]!==T||t[53]!==D||t[54]!==A||t[55]!==b?(j=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,C,T,D,A]}),t[51]=C,t[52]=T,t[53]=D,t[54]=A,t[55]=b,t[56]=j):j=t[56];let M;t[57]!==j||t[58]!==_?(M=(0,$.jsxs)(`div`,{children:[_,j]}),t[57]=j,t[58]=_,t[59]=M):M=t[59];let N;t[60]===o.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=N);let P;t[62]===a.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=P);let F;t[64]===a.advanced.proxyBody?F=t[65]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=F);let I;t[66]!==r||t[67]!==a.advanced.proxyDocs?(I=(0,$.jsx)(tt,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=I):I=t[68];let L;t[69]!==P||t[70]!==F||t[71]!==I?(L=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,F,I]}),t[69]=P,t[70]=F,t[71]=I,t[72]=L):L=t[72];let R;t[73]!==o.docsLink||t[74]!==r?(R=(0,$.jsx)(tt,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=R):R=t[75];let B;return t[76]!==M||t[77]!==N||t[78]!==L||t[79]!==R||t[80]!==h||t[81]!==g?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,g,M,N,L,R]}),t[76]=M,t[77]=N,t[78]=L,t[79]=R,t[80]=h,t[81]=g,t[82]=B):B=t[82],B}function jt(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Mt(e){return e.token}function Nt(e){return e.language}async function Pt(e){let t=await m(h(`/api/tunnel/pair/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 Ft(e){await g(h(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function It(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 Lt(){return(0,Q.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`)||It(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function Rt(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,T,`dark:border-edge`)}function zt(e){return(e?.candidates.find(e=>e.kind===`reverse-proxy`))?.url?.trim()||null}function Bt(e){return(e?.candidates.find(e=>e.kind===`lan`&&e.reachable))?.url?.trim()||null}function Vt(){let e=p(e=>e.language),t=l(e).remoteAccess.reverseProxy,n=!!f(e=>e.token),r=Lt(),{mutate:i}=_(),{data:a,mutate:o}=v(n?`tunnel-pair-context`:null,V,{refreshInterval:6e4}),c=zt(a),[u,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)({busy:!1,result:null}),[y,b]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{u||(c?m(c):r&&m(r))},[c,r,u]);let x=(0,Q.useMemo)(()=>u.trim()||(c??r??``),[c,r,u]),S=!c&&!!r&&x===r,C=Bt(a),{data:w,mutate:T}=v(n&&x?[`reverse-proxy-pair`,x]:null,()=>K(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),O=(0,Q.useMemo)(()=>!x||!w?.pairingSecret?``:d({baseUrl:x,pairingSecret:w.pairingSecret,lanUrl:C}),[x,C,w?.pairingSecret]),k=he(()=>it(O),[O],{enabled:!!O,initial:null,errorData:null}),A=(0,Q.useCallback)(async()=>{let e=u.trim()||x;if(e){g({busy:!0,result:null});try{g({busy:!1,result:await Pt(e)})}catch(e){g({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[u,x]),j=(0,Q.useCallback)(async()=>{let e=x.trim();if(e){b({busy:!0,error:null});try{await Ft(e),await o(),await i(`tunnel-pair-context`),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[x,i,o]),M=(0,Q.useCallback)(async()=>{b({busy:!0,error:null});try{await Ft(null),await o(),await i(`tunnel-pair-context`),m(``),g({busy:!1,result:null}),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}},[i,o]),N=(0,Q.useCallback)(async()=>{await T()},[T]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Ce,{children:[(0,$.jsx)(xe,{icon:W,title:t.title,subtitle:t.subtitle}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:t.urlLabel}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:s(Rt(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:t.urlPlaceholder,value:u,onChange:e=>{m(e.target.value),g({busy:!1,result:null})}}),(0,$.jsxs)(G,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void A(),disabled:h.busy||!u.trim(),children:[h.busy?(0,$.jsx)(ue,{className:`size-3.5 animate-spin`}):null,h.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),S&&r?(0,$.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,$.jsx)(`div`,{className:`font-medium`,children:t.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:r}),(0,$.jsx)(`p`,{className:`mt-1`,children:t.autoDetectedHint})]}):null,h.result?(0,$.jsx)(Ht,{result:h.result,labels:t.probeStatus}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x&&c!==x?(0,$.jsxs)(G,{type:`button`,onClick:()=>void j(),disabled:y.busy,children:[y.busy?(0,$.jsx)(ue,{className:`size-3.5 animate-spin`}):null,y.busy?t.saving:t.saveAsDefault]}):null,c?(0,$.jsx)(G,{type:`button`,variant:`ghost`,onClick:()=>void M(),disabled:y.busy,children:t.clear}):null]}),y.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:y.error}):null,(0,$.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:t.certWarning})]})]}),(0,$.jsxs)(Ce,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:t.qrTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.qrSubtitle})]}),O?(0,$.jsxs)(G,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void N(),children:[(0,$.jsx)(D,{className:`size-4`}),t.refreshQr]}):null]}),x?w?.pairingSecret?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[(0,$.jsxs)(`div`,{className:`break-all font-mono text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`baseUrl:`}),` `,x,C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,C]}):null]}),k.data?(0,$.jsx)(`img`,{src:k.data,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):k.loading?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.encoding}):null,(0,$.jsx)(E,{text:O,labels:{copy:t.copyLink,copied:t.copied,copyFailed:l(e).clipboard.copyFailed}})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.mintingSecret}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUrlYet})]})]}):null}function Ht(e){let t=(0,Z.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.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,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.mobileReady||t[5]!==n.mobilePairing?(a=n.mobilePairing?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.mobileReady})]}):null,t[4]=r.mobileReady,t[5]=n.mobilePairing,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.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,$.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,$.jsxs)($.Fragment,{children:[` — `,(0,$.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,$.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}var Ut=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Wt(e){return e&&Ut.includes(e)?e:`guide`}function Gt(e,t){return e.tabs[t]}function Kt(e,t){return e.tabIntro[t]}function qt(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function Jt(e){let t=(0,Z.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(At,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(gt,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ut,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Vt,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(St,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(_t,{}),t[6]=e):e=t[6],e}}}function Yt(){let e=(0,Z.c)(2),t=p(Zt),n=l(t).remoteAccess,r=!!f(Xt),[a,o]=i(),s=Wt(a.get(`tab`)),c;e[0]===o?c=e[1]:(c=e=>{o(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[0]=o,e[1]=c);let u=c,d=Kt(n,s),m=Ut.map(e=>({id:e,label:Gt(n,e)}));return(0,$.jsxs)(ve,{children:[(0,$.jsx)(_e,{title:n.pageTitle,subtitle:n.pageSubtitle,meta:(0,$.jsx)(tt,{language:t,label:n.docsLink,section:qt(s),className:`mt-1`})}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Te,{items:m,activeTab:s,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ye,{id:s,activeTab:s,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Gt(n,s),hint:s===`public`?void 0:d,children:(0,$.jsx)(Jt,{tab:s,onOpenTab:u})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.guide.needToken})]})}function Xt(e){return e.token}function Zt(e){return e.language}export{Yt as RemoteAccessHub};
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./messages-BWtP5TFz.js";import{n as o,p as s}from"./locale-store-BP0vD37A.js";import{Ps as c,al as l}from"./index-DUasAutC.js";var u=e(t(),1);function d(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var f=s((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...d(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...d(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...d(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...d(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}}));function p({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=f(e=>e.registerSection),c=f(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}var m=n(),h=r();function g(){let e=(0,m.c)(26),t=a(o(S)).capabilitiesSettings.saveBar,n=f(x),r=f(b),s=f(y),d=f(v),p=f(_),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],e[0]=g):g=e[0];let[C,w]=(0,u.useState)(g),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===d?D=e[2]:(D=async()=>{w([]),E(!1);let e=await d();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=d,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,h.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===p?M=e[5]:(M=()=>p(),e[4]=p,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,h.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,h.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,h.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(s)):T?t.savedSummary:t.cleanSummary}),B]})}function _(e){return e.discardAll}function v(e){return e.saveAll}function y(e){return e.dirtyCount}function b(e){return e.anySaving}function x(e){return e.anyDirty}function S(e){return e.language}export{p as n,f as r,g 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"./cn-JdwAhgNB.js";import{t as a}from"./messages-BiBdO1-O.js";import{n as o,p as s}from"./locale-store-CAuhEGCn.js";import{ks as c,tl as l}from"./index-eyttVNS_.js";var u=e(t(),1);function d(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var f=s((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...d(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...d(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...d(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...d(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}}));function p({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=f(e=>e.registerSection),c=f(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}var m=n(),h=r();function g(){let e=(0,m.c)(26),t=a(o(S)).capabilitiesSettings.saveBar,n=f(x),r=f(b),s=f(y),d=f(v),p=f(_),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],e[0]=g):g=e[0];let[C,w]=(0,u.useState)(g),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===d?D=e[2]:(D=async()=>{w([]),E(!1);let e=await d();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=d,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,h.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===p?M=e[5]:(M=()=>p(),e[4]=p,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,h.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,h.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,h.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(s)):T?t.savedSummary:t.cleanSummary}),B]})}function _(e){return e.discardAll}function v(e){return e.saveAll}function y(e){return e.dirtyCount}function b(e){return e.anySaving}function x(e){return e.anyDirty}function S(e){return e.language}export{p as n,f as r,g 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"./cn-JdwAhgNB.js";import{As as a,Ms as o,Ps as s,ls as c,ss as l}from"./index-DUasAutC.js";import{t as u}from"./time-picker-D-G-uwVJ.js";import{n as d,t as f}from"./cron-expression-B3B1eqnr.js";var p=n(),m=e(t(),1),h=r(),g=Array.from({length:60},(e,t)=>t),_=i(o,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,a),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,a),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,a);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:a=!0}){let o=(0,m.useMemo)(()=>d(e),[e]),[s,p]=(0,m.useReducer)(C,o,x),w=(0,m.useRef)(e);w.current!==e&&(w.current=e,p({type:`reset`,state:o}));let T=(0,m.useCallback)(e=>{let n={...s,...e};p({type:`replace`,state:n});let r=S(n),i=S(s);Object.keys(r).some(e=>r[e]!==i[e])&&t(f(r))},[t,s]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=s,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{if(!e)return;let[t,n]=e.split(`:`).map(e=>parseInt(e,10));Number.isNaN(t)||Number.isNaN(n)||T({minute:n,hour:t})},B=(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,h.jsxs)(l,{className:_,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,h.jsx)(c,{value:`no_repeat`,children:n.modeNoRepeat}),(0,h.jsx)(c,{value:`interval`,children:n.modeInterval}),(0,h.jsx)(c,{value:`hourly`,children:n.modeHourly}),(0,h.jsx)(c,{value:`daily`,children:n.modeDaily}),(0,h.jsx)(c,{value:`weekly`,children:n.modeWeekly}),(0,h.jsx)(c,{value:`monthly`,children:n.modeMonthly}),(0,h.jsx)(c,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel})]}),E===`interval`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(l,{className:i(_,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,h.jsx)(c,{value:`minutes`,children:n.intervalKindMinutes}),(0,h.jsx)(c,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:g.map(e=>(0,h.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel}),E===`weekly`&&(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel}),E===`monthly`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,h.jsx)(c,{value:e,children:e},e))}),(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel})]}),E===`hourly`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:g.map(e=>(0,h.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,h.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,h.jsxs)(`div`,{className:`pt-1`,children:[(0,h.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,a),O=i(o,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:a=1}){let o=(0,m.useMemo)(()=>new Set(i),[i]),s=(0,m.useMemo)(()=>o.has(e)?String(e):``,[o,e]),[u,d]=(0,m.useState)(null),f=(0,m.useRef)(e);f.current!==e&&(f.current=e,d(null));let p=Math.max(a,Math.round(e/1e3)),g=u===null?String(p):u;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(`input`,{type:`number`,min:a,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=a&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<a?a*1e3:e*1e3),d(null)}}),(0,h.jsxs)(l,{className:O,disabled:r,value:s,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,h.jsx)(c,{value:``,children:n.presets.custom}),i.map(e=>(0,h.jsx)(c,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,a),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,p.c)(57),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,h.jsx)(s,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let o;t[6]===i.start?o=t[7]:(o=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=o);let c;t[8]!==r||t[9]!==n?(c=e=>r({...n,start:e}),t[8]=r,t[9]=n,t[10]=c):c=t[10];let l;t[11]!==a||t[12]!==i.start||t[13]!==c||t[14]!==n.start?(l=(0,h.jsx)(u,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.start,onChange:c,ariaLabel:i.start}),t[11]=a,t[12]=i.start,t[13]=c,t[14]=n.start,t[15]=l):l=t[15];let d;t[16]!==o||t[17]!==l?(d=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[o,l]}),t[16]=o,t[17]=l,t[18]=d):d=t[18];let f;t[19]===i.end?f=t[20]:(f=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[19]=i.end,t[20]=f);let m;t[21]!==r||t[22]!==n?(m=e=>r({...n,end:e}),t[21]=r,t[22]=n,t[23]=m):m=t[23];let g;t[24]!==a||t[25]!==i.end||t[26]!==m||t[27]!==n.end?(g=(0,h.jsx)(u,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.end,onChange:m,ariaLabel:i.end}),t[24]=a,t[25]=i.end,t[26]=m,t[27]=n.end,t[28]=g):g=t[28];let _;t[29]!==f||t[30]!==g?(_=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[f,g]}),t[29]=f,t[30]=g,t[31]=_):_=t[31];let v;t[32]===i.timezone?v=t[33]:(v=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[32]=i.timezone,t[33]=v);let y;t[34]!==r||t[35]!==n?(y=e=>r({...n,timezone:e.target.value}),t[34]=r,t[35]=n,t[36]=y):y=t[36];let b;t[37]!==a||t[38]!==y||t[39]!==n.timezone?(b=(0,h.jsx)(`input`,{type:`text`,disabled:a,className:j,value:n.timezone,onChange:y,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[37]=a,t[38]=y,t[39]=n.timezone,t[40]=b):b=t[40];let x;t[41]!==b||t[42]!==v?(x=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[v,b]}),t[41]=b,t[42]=v,t[43]=x):x=t[43];let S;t[44]!==x||t[45]!==d||t[46]!==_?(S=(0,h.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[d,_,x]}),t[44]=x,t[45]=d,t[46]=_,t[47]=S):S=t[47];let C;t[48]===r?C=t[49]:(C=()=>r(null),t[48]=r,t[49]=C);let w;t[50]!==a||t[51]!==i.clear||t[52]!==C?(w=(0,h.jsx)(s,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:C,children:i.clear}),t[50]=a,t[51]=i.clear,t[52]=C,t[53]=w):w=t[53];let T;return t[54]!==S||t[55]!==w?(T=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[S,w]}),t[54]=S,t[55]=w,t[56]=T):T=t[56],T}function P(e){let t=(0,p.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,h.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,h.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,h.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let f;t[25]===a?f=t[26]:(f=a?(0,h.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=f);let m;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==f?(m=(0,h.jsxs)(`div`,{className:s,children:[c,l,u,d,f]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f,t[33]=m):m=t[33],m}export{E as n,P 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"./cn-JdwAhgNB.js";import{Ds as a,Ts as o,is as s,ks as c,ns as l}from"./index-eyttVNS_.js";import{t as u}from"./time-picker-BhgCeDuO.js";import{n as d,t as f}from"./cron-expression-B3B1eqnr.js";var p=n(),m=e(t(),1),h=r(),g=Array.from({length:60},(e,t)=>t),_=i(a,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,o),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,o),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,o);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:a=!0}){let o=(0,m.useMemo)(()=>d(e),[e]),[c,p]=(0,m.useReducer)(C,o,x),w=(0,m.useRef)(e);w.current!==e&&(w.current=e,p({type:`reset`,state:o}));let T=(0,m.useCallback)(e=>{let n={...c,...e};p({type:`replace`,state:n});let r=S(n),i=S(c);Object.keys(r).some(e=>r[e]!==i[e])&&t(f(r))},[t,c]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=c,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{if(!e)return;let[t,n]=e.split(`:`).map(e=>parseInt(e,10));Number.isNaN(t)||Number.isNaN(n)||T({minute:n,hour:t})},B=(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,h.jsxs)(l,{className:_,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,h.jsx)(s,{value:`no_repeat`,children:n.modeNoRepeat}),(0,h.jsx)(s,{value:`interval`,children:n.modeInterval}),(0,h.jsx)(s,{value:`hourly`,children:n.modeHourly}),(0,h.jsx)(s,{value:`daily`,children:n.modeDaily}),(0,h.jsx)(s,{value:`weekly`,children:n.modeWeekly}),(0,h.jsx)(s,{value:`monthly`,children:n.modeMonthly}),(0,h.jsx)(s,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel})]}),E===`interval`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(l,{className:i(_,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,h.jsx)(s,{value:`minutes`,children:n.intervalKindMinutes}),(0,h.jsx)(s,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:g.map(e=>(0,h.jsx)(s,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel}),E===`weekly`&&(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel}),E===`monthly`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,h.jsx)(s,{value:e,children:e},e))}),(0,h.jsx)(u,{disabled:r,className:`min-w-[6.5rem] shrink-0`,triggerClassName:`h-9 border-edge-subtle px-2`,value:R,onChange:z,ariaLabel:n.scheduleTimeLabel})]}),E===`hourly`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:i(_,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:g.map(e=>(0,h.jsx)(s,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,h.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,h.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,h.jsxs)(`div`,{className:`pt-1`,children:[(0,h.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,o),O=i(a,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:a=1}){let o=(0,m.useMemo)(()=>new Set(i),[i]),c=(0,m.useMemo)(()=>o.has(e)?String(e):``,[o,e]),[u,d]=(0,m.useState)(null),f=(0,m.useRef)(e);f.current!==e&&(f.current=e,d(null));let p=Math.max(a,Math.round(e/1e3)),g=u===null?String(p):u;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(`input`,{type:`number`,min:a,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=a&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<a?a*1e3:e*1e3),d(null)}}),(0,h.jsxs)(l,{className:O,disabled:r,value:c,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,h.jsx)(s,{value:``,children:n.presets.custom}),i.map(e=>(0,h.jsx)(s,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,o),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,p.c)(57),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let o;t[6]===i.start?o=t[7]:(o=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=o);let s;t[8]!==r||t[9]!==n?(s=e=>r({...n,start:e}),t[8]=r,t[9]=n,t[10]=s):s=t[10];let l;t[11]!==a||t[12]!==i.start||t[13]!==s||t[14]!==n.start?(l=(0,h.jsx)(u,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.start,onChange:s,ariaLabel:i.start}),t[11]=a,t[12]=i.start,t[13]=s,t[14]=n.start,t[15]=l):l=t[15];let d;t[16]!==o||t[17]!==l?(d=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[o,l]}),t[16]=o,t[17]=l,t[18]=d):d=t[18];let f;t[19]===i.end?f=t[20]:(f=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[19]=i.end,t[20]=f);let m;t[21]!==r||t[22]!==n?(m=e=>r({...n,end:e}),t[21]=r,t[22]=n,t[23]=m):m=t[23];let g;t[24]!==a||t[25]!==i.end||t[26]!==m||t[27]!==n.end?(g=(0,h.jsx)(u,{disabled:a,className:`mt-1 w-full`,triggerClassName:`h-9 border-edge-subtle px-2.5`,value:n.end,onChange:m,ariaLabel:i.end}),t[24]=a,t[25]=i.end,t[26]=m,t[27]=n.end,t[28]=g):g=t[28];let _;t[29]!==f||t[30]!==g?(_=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[f,g]}),t[29]=f,t[30]=g,t[31]=_):_=t[31];let v;t[32]===i.timezone?v=t[33]:(v=(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[32]=i.timezone,t[33]=v);let y;t[34]!==r||t[35]!==n?(y=e=>r({...n,timezone:e.target.value}),t[34]=r,t[35]=n,t[36]=y):y=t[36];let b;t[37]!==a||t[38]!==y||t[39]!==n.timezone?(b=(0,h.jsx)(`input`,{type:`text`,disabled:a,className:j,value:n.timezone,onChange:y,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[37]=a,t[38]=y,t[39]=n.timezone,t[40]=b):b=t[40];let x;t[41]!==b||t[42]!==v?(x=(0,h.jsxs)(`label`,{className:`block min-w-0`,children:[v,b]}),t[41]=b,t[42]=v,t[43]=x):x=t[43];let S;t[44]!==x||t[45]!==d||t[46]!==_?(S=(0,h.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[d,_,x]}),t[44]=x,t[45]=d,t[46]=_,t[47]=S):S=t[47];let C;t[48]===r?C=t[49]:(C=()=>r(null),t[48]=r,t[49]=C);let w;t[50]!==a||t[51]!==i.clear||t[52]!==C?(w=(0,h.jsx)(c,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:C,children:i.clear}),t[50]=a,t[51]=i.clear,t[52]=C,t[53]=w):w=t[53];let T;return t[54]!==S||t[55]!==w?(T=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[S,w]}),t[54]=S,t[55]=w,t[56]=T):T=t[56],T}function P(e){let t=(0,p.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,h.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,h.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,h.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,h.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let f;t[25]===a?f=t[26]:(f=a?(0,h.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=f);let m;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==f?(m=(0,h.jsxs)(`div`,{className:s,children:[c,l,u,d,f]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f,t[33]=m):m=t[33],m}export{E as n,P as t};
@@ -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{Ss as i,Ts as a,ls as o,ss as s}from"./index-DUasAutC.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:r,value:o,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===u?i=t[3]:(i=e=>u(e.target.value),t[2]=u,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(_),t[4]=r.enum,t[5]=a);let c;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(c=(0,l.jsx)(s,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:o,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==o?(n=(0,l.jsx)(a,{value:o,onChange:u,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=o,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==o?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:o,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=o,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(o,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=i,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=i,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w 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{_s as i,bs as a,is as o,ns as s}from"./index-eyttVNS_.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:r,value:o,onChange:u,disabled:d}=e,f=typeof r.description==`string`?r.description:void 0,p=(typeof r[`x-placeholder`]==`string`?r[`x-placeholder`]:null)||f,m=r.format;if(Array.isArray(r.enum)&&r.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let i;t[2]===u?i=t[3]:(i=e=>u(e.target.value),t[2]=u,t[3]=i);let a;t[4]===r.enum?a=t[5]:(a=r.enum.map(_),t[4]=r.enum,t[5]=a);let c;t[6]!==d||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(c=(0,l.jsx)(s,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:o,disabled:d,onChange:i,children:a}),t[6]=d,t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==o?(n=(0,l.jsx)(a,{value:o,onChange:u,placeholder:p,labels:i,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=o,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==o?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:o,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=o,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(o,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:i,onChange:a,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==a||t[7]!==i?(y=(e,t)=>{a({...i,[e]:t})},t[6]=a,t[7]=i,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==i){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=r(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==i?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:i[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=i,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=i,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-BiBdO1-O.js";import{l as s,n as c,r as l,s as u}from"./locale-store-CAuhEGCn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$a as f,Ac as p,Bo as m,Cs as h,Fc as g,Go as _,Gs as v,It as y,Iu as b,Jl as x,Lu as S,Ms as ee,Mt as C,Nt as w,Os as T,Pc as E,Pl as D,Qn as O,Ss as k,Uo as A,Vo as j,Wo as M,Yc as N,Yl as P,Zn as F,_a as I,ba as te,ca as L,da as R,dc as z,fa as B,fl as V,ga as ne,hc as re,hl as H,is as U,js as ie,jt as W,ks as G,la as ae,ls as oe,ma as se,no as K,ns as ce,ou as le,pa as ue,pl as de,qc as q,ro as J,to as Y,ua as fe,us as pe,va as me,ya as he,zo as ge}from"./index-eyttVNS_.js";import{t as _e}from"./settings-advanced-gate-DcDLS0xV.js";import{n as ve,t as ye}from"./settings-form-section-CPG0KGVs.js";import{t as be}from"./page-tabs-BGAYH3Ef.js";import{n as xe,t as Se}from"./save-bar-controls-BdjV8MK5.js";import{n as Ce,r as we}from"./segmented-styles-BL8oLBEp.js";var X=e(t(),1),Te=n(),Z=r();function Ee(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function De(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Oe(e){let t=(0,Te.c)(105),{session:n,variant:r,labels:i,sessionAgentId:o,sessionAgentAvatar:s,onOpen:c,onAction:l}=e,u;t[0]!==i.unnamedSession||t[1]!==n.name?(u=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=u):u=t[2];let d=u,f;t[3]===n.name?f=t[4]:(f=n.name?.trim(),t[3]=n.name,t[4]=f);let p=!!f,m=n.status===`archived`,h=n.status===`pinned`,_=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,y;t[5]===_?y=t[6]:(y=a(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,_),t[5]=_,t[6]=y);let ee;t[7]===c?ee=t[8]:(ee=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[7]=c,t[8]=ee);let C=r===`list`&&`sm:py-3`,w;t[9]===C?w=t[10]:(w=a(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,C),t[9]=C,t[10]=w);let T;t[11]===n.sourceChannel?T=t[12]:(T=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=T);let D;t[13]===h?D=t[14]:(D=h?(0,Z.jsx)(g,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=h,t[14]=D);let O;t[15]===n.updatedAt?O=t[16]:(O=Ee(n.updatedAt),t[15]=n.updatedAt,t[16]=O);let A;t[17]===O?A=t[18]:(A=(0,Z.jsx)(`span`,{children:O}),t[17]=O,t[18]=A);let j;t[19]!==A||t[20]!==D?(j=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[D,A]}),t[19]=A,t[20]=D,t[21]=j):j=t[21];let M;t[22]!==j||t[23]!==w||t[24]!==T?(M=(0,Z.jsxs)(`div`,{className:w,children:[T,j]}),t[22]=j,t[23]=w,t[24]=T,t[25]=M):M=t[25];let P=r===`list`&&`sm:py-3`,F;t[26]===P?F=t[27]:(F=a(`min-w-0 flex-1 px-3 py-2`,P),t[26]=P,t[27]=F);let I=r===`list`&&`sm:items-start`,L;t[28]===I?L=t[29]:(L=a(`flex gap-3`,I),t[28]=I,t[29]=L);let R;t[30]!==s||t[31]!==o?(R=(0,Z.jsx)(te,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=s,t[31]=o,t[32]=R):R=t[32];let z;t[33]===d?z=t[34]:(z=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:d,children:d}),t[33]=d,t[34]=z);let B;t[35]!==n.key||t[36]!==p?(B=p?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=p,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let ne;t[41]!==L||t[42]!==R||t[43]!==V?(ne=(0,Z.jsxs)(`div`,{className:L,children:[R,V]}),t[41]=L,t[42]=R,t[43]=V,t[44]=ne):ne=t[44];let re;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(N,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=re):re=t[45];let H;t[46]===n.messageCount?H=t[47]:(H=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[re,n.messageCount]}),t[46]=n.messageCount,t[47]=H);let U;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ie,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=U):U=t[48];let W;t[49]===n.estimatedTokens?W=t[50]:(W=De(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=W);let G;t[51]===W?G=t[52]:(G=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[U,W]}),t[51]=W,t[52]=G);let ae;t[53]!==H||t[54]!==G?(ae=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[H,G]}),t[53]=H,t[54]=G,t[55]=ae):ae=t[55];let oe;t[56]===n.tags?oe=t[57]:(oe=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(je),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=oe);let se;t[58]!==F||t[59]!==ne||t[60]!==ae||t[61]!==oe?(se=(0,Z.jsxs)(`div`,{className:F,children:[ne,ae,oe]}),t[58]=F,t[59]=ne,t[60]=ae,t[61]=oe,t[62]=se):se=t[62];let K;t[63]===l?K=t[64]:(K=()=>l(`continue`),t[63]=l,t[64]=K);let ce;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(N,{className:`size-4`,strokeWidth:1.75}),t[65]=ce):ce=t[65];let le;t[66]!==i.continueChat||t[67]!==K?(le=(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.continueChat,"aria-label":i.continueChat,onClick:K,children:ce}),t[66]=i.continueChat,t[67]=K,t[68]=le):le=t[68];let ue;t[69]!==m||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==l?(ue=m?(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>l(`unarchive`),children:(0,Z.jsx)(S,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.archive,"aria-label":i.archive,onClick:()=>l(`archive`),children:(0,Z.jsx)(b,{className:`size-4`,strokeWidth:1.75})}),t[69]=m,t[70]=i.archive,t[71]=i.unarchive,t[72]=l,t[73]=ue):ue=t[73];let de;t[74]!==h||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==l?(de=h?(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.unpin,"aria-label":i.unpin,onClick:()=>l(`unpin`),children:(0,Z.jsx)(E,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.pin,"aria-label":i.pin,onClick:()=>l(`pin`),children:(0,Z.jsx)(g,{className:`size-4`,strokeWidth:1.75})}),t[74]=h,t[75]=i.pin,t[76]=i.unpin,t[77]=l,t[78]=de):de=t[78];let q;t[79]===l?q=t[80]:(q=()=>l(`export`),t[79]=l,t[80]=q);let J;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(x,{className:`size-4`,strokeWidth:1.75}),t[81]=J):J=t[81];let Y;t[82]!==i.export||t[83]!==q?(Y=(0,Z.jsx)(`button`,{type:`button`,className:k,title:i.export,"aria-label":i.export,onClick:q,children:J}),t[82]=i.export,t[83]=q,t[84]=Y):Y=t[84];let fe;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(fe=a(k,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=fe):fe=t[85];let pe;t[86]===l?pe=t[87]:(pe=()=>l(`delete`),t[86]=l,t[87]=pe);let me;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(v,{className:`size-4`,strokeWidth:1.75}),t[88]=me):me=t[88];let he;t[89]!==i.delete||t[90]!==pe?(he=(0,Z.jsx)(`button`,{type:`button`,className:fe,title:i.delete,"aria-label":i.delete,onClick:pe,children:me}),t[89]=i.delete,t[90]=pe,t[91]=he):he=t[91];let ge;t[92]!==le||t[93]!==ue||t[94]!==de||t[95]!==Y||t[96]!==he?(ge=(0,Z.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:Ae,onKeyDown:ke,children:[le,ue,de,Y,he]}),t[92]=le,t[93]=ue,t[94]=de,t[95]=Y,t[96]=he,t[97]=ge):ge=t[97];let _e;return t[98]!==c||t[99]!==M||t[100]!==se||t[101]!==y||t[102]!==ge||t[103]!==ee?(_e=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:y,onClick:c,onKeyDown:ee,children:[M,se,ge]}),t[98]=c,t[99]=M,t[100]=se,t[101]=y,t[102]=ge,t[103]=ee,t[104]=_e):_e=t[104],_e}function ke(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function je(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}var Me={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:2e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ne(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pe(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function Fe(e){let t=Ne(e)?e:{},n=Ne(t.userContext)?t.userContext:{},r=Ne(n.memory)?n.memory:{},i=Ne(r.retention)?r.retention:{},a=Ne(i.compaction)?i.compaction:{},o=Me,s=typeof a.model==`string`&&a.model.trim()?a.model.trim():void 0,c=Array.isArray(a.postCompactionSections)&&a.postCompactionSections.length<=12&&a.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(a.postCompactionSections.map(e=>e.trim()))]:[...o.postCompactionSections];return{enabled:typeof a.enabled==`boolean`?a.enabled:o.enabled,triggerThreshold:Pe(a.triggerThreshold,o.triggerThreshold,.1,.98),reserveTokens:Q(a.reserveTokens,o.reserveTokens,1024),minMessagesBeforeCompact:Q(a.minMessagesBeforeCompact,o.minMessagesBeforeCompact,2),keepRecentTokens:Q(a.keepRecentTokens,o.keepRecentTokens,1e3),recentTurnsPreserve:Q(a.recentTurnsPreserve,o.recentTurnsPreserve,1,12),summaryMaxTokens:Q(a.summaryMaxTokens,o.summaryMaxTokens,256),summaryChunkTokens:Q(a.summaryChunkTokens,o.summaryChunkTokens,1e3),summaryTimeoutMs:Q(a.summaryTimeoutMs,o.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(a.summaryRetries,o.summaryRetries,0,5),qualityGuard:typeof a.qualityGuard==`boolean`?a.qualityGuard:o.qualityGuard,...s?{model:s}:{},minToolResultKeepChars:Q(a.minToolResultKeepChars,o.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(a.maxActiveTranscriptBytes,o.maxActiveTranscriptBytes,64e3),postCompactionSections:c}}function Ie(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Le(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{memory:{retention:{compaction:t}}}}}async function Re(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify(Le(e))}),await Y()}var ze=128e3,Be={balanced:Me,preserve:{...Me,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Me,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Ve=W();function He(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,T,`dark:border-edge`)}function Ue(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function We(e){let t=Ue(e);for(let[e,n]of Object.entries(Be))if(t===Ue(n))return e;return`custom`}function Ge(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Te.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=He(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Ke(e){let t=(0,Te.c)(19),{label:n,hint:r,checked:i,disabled:o,onChange:s}=e,c=o?`cursor-not-allowed opacity-55`:`cursor-pointer`,l;t[0]===c?l=t[1]:(l=a(`flex items-start gap-2 text-sm text-fg`,c),t[0]=c,t[1]=l);let u;t[2]===s?u=t[3]:(u=e=>s(e.target.checked),t[2]=s,t[3]=u);let d;t[4]!==i||t[5]!==o||t[6]!==u?(d=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:o,onChange:u}),t[4]=i,t[5]=o,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==l||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:l,children:[d,m]}),t[15]=l,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function qe({hasToken:e}){let t=o(c(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=K(e),{data:i=[],isLoading:s}=d(e?F:null,O,{revalidateOnFocus:!1}),l=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Fe(n.payload.config),[n]),[u,f]=(0,X.useReducer)(Ve,{form:null,baseline:null}),[m,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),S=(0,X.useRef)(!1),w=(0,X.useRef)(null);C({enabled:e,parsed:l,dirty:S.current,trackedParsedRef:w,dispatch:f,onResetDirty:()=>{S.current=!1}});let T=u.form,E=u.baseline,D=!!(T&&E&&JSON.stringify(T)!==JSON.stringify(E)),k=(0,X.useCallback)(e=>{S.current=!0,v(null),f({type:`patch`,patch:e})},[]),A=(0,X.useCallback)(()=>{S.current=!1,v(null),x(``),f({type:`discard`})},[]),j=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),M=(0,X.useCallback)(async()=>{if(!T)return;let e=Ie(T);if(e){let n=t.invalidValue.replace(`{{field}}`,j(e));throw v(n),Error(n)}g(!0),v(null);try{await Re(T),S.current=!1,f({type:`saved`,value:T})}catch(e){let n=e instanceof Error?e.message:t.saveError;throw v(n),Error(n)}finally{g(!1)}},[j,T,t.invalidValue,t.saveError]);if(xe({id:`context-compaction`,dirty:D,saving:m,save:M,discard:A}),!e||!T)return r?(0,Z.jsx)(ye,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(J,{className:`h-5 w-48`}),(0,Z.jsx)(J,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(J,{className:`h-36 w-full rounded-xl`})]})}):null;let N=We(T),P=Math.max(0,ze-T.reserveTokens),I=Math.min(Math.floor(ze*T.triggerThreshold),P),te=Math.min(100,I/ze*100),L=Math.min(100,P/ze*100),R=T.model?i.find(e=>e.id===T.model):void 0,z=R?.contextWindow&&T.summaryChunkTokens+T.summaryMaxTokens+4096>R.contextWindow,B=T.keepRecentTokens+T.reserveTokens>I,V=Math.round(T.summaryTimeoutMs*(T.summaryRetries+1)/1e3),ne=e=>{let t=Be[e];k({...t,...T.model?{model:T.model}:{model:void 0},postCompactionSections:T.postCompactionSections})},re={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},H=()=>{let e=b.trim();!e||T.postCompactionSections.includes(e)||T.postCompactionSections.length>=12||(k({postCompactionSections:[...T.postCompactionSections,e]}),x(``))};return(0,Z.jsxs)(ye,{children:[(0,Z.jsx)(ve,{icon:q,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:T.enabled,onChange:e=>k({enabled:e.target.checked})}),T.enabled?t.enabled:t.disabled]})}),_?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:_}):null,T.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!T.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),N===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,className:a(`rounded-xl border px-3 py-3 text-left`,h.transition,h.focusRingPanel,N===e?`border-accent/50 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg hover:bg-surface-hover`),onClick:()=>ne(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:re[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:re[e].hint})]},e))})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-hover/35 p-4 dark:border-edge`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(I)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${te}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(P)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${L}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((T.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>k({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Ge(T.reserveTokens)),value:T.reserveTokens,min:1024,step:1024,onChange:e=>k({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:T.recentTurnsPreserve,min:1,max:12,onChange:e=>k({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Ge(T.keepRecentTokens)),value:T.keepRecentTokens,min:1e3,step:1e3,onChange:e=>k({keepRecentTokens:Math.floor(e)})})]}),B?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(y,{value:T.model??``,disabled:!T.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:s,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>k({model:e})}),T.model?(0,Z.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>k({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(Ke,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:T.qualityGuard,onChange:e=>k({qualityGuard:e})})]}),T.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning}),(0,Z.jsx)(_e,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 border-t border-edge pt-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:T.minMessagesBeforeCompact,min:2,onChange:e=>k({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((T.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>k({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:T.summaryMaxTokens,min:256,step:256,onChange:e=>k({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:T.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>k({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(V)),value:T.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>k({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:T.summaryRetries,min:0,max:5,onChange:e=>k({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:T.minToolResultKeepChars,min:200,step:100,onChange:e=>k({minToolResultKeepChars:Math.floor(e)})})]}),z?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`border-t border-edge pt-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),T.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:T.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:a(`text-fg-muted hover:text-fg`,h.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>k({postCompactionSections:T.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:He(),value:b,maxLength:120,disabled:T.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),H())}}),(0,Z.jsxs)(G,{type:`button`,variant:`secondary`,disabled:!b.trim()||T.postCompactionSections.length>=12,onClick:H,children:[(0,Z.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]}),(0,Z.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Z.jsx)(G,{type:`button`,variant:`secondary`,disabled:!D||m,onClick:A,children:t.discard}),(0,Z.jsx)(G,{type:`button`,variant:`primary`,disabled:!D||m,onClick:()=>void M().catch(()=>{}),children:m?t.saving:t.save})]})]})}function Je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function Xe(e){let t=Je(e)?e:{},n=Je(t.session)?t.session:{},r=Je(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:Ye(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Ze(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),Y()}function Qe(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,T,`dark:border-edge`)}var $e=W();function et({hasToken:e}){let t=o(c(e=>e.language)).sessions.config,{data:n,isLoading:r}=K(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Xe(n.payload.config),[n]),[a,s]=(0,X.useReducer)($e,{form:null,baseline:null}),l=a.form,u=a.baseline,[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),h=(0,X.useRef)(!1),g=(0,X.useRef)(null);C({enabled:e,parsed:i,dirty:h.current,trackedParsedRef:g,dispatch:s,onResetDirty:()=>{h.current=!1}});let _=!!(l&&u&&JSON.stringify(l)!==JSON.stringify(u)),v=(0,X.useCallback)(e=>{h.current=!0,s({type:`patch`,patch:e})},[]),y=(0,X.useCallback)(()=>{h.current=!1,m(null),s({type:`discard`})},[]),b=(0,X.useCallback)(async()=>{if(l){f(!0),m(null);try{await Ze(l),h.current=!1,s({type:`saved`,value:l})}catch(e){let n=e instanceof Error?e.message:t.saveError;throw m(n),Error(n)}finally{f(!1)}}},[l,t.saveError]);return xe({id:`session-storage`,dirty:_,saving:d,save:b,discard:y}),!e||!l?r?(0,Z.jsx)(ye,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(J,{className:`h-5 w-40`}),(0,Z.jsx)(J,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(ye,{children:[(0,Z.jsx)(ve,{icon:P,title:t.title,subtitle:t.hint}),(0,Z.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Z.jsx)(G,{type:`button`,variant:`secondary`,disabled:!_||d,onClick:y,children:t.discard}),(0,Z.jsx)(G,{type:`button`,variant:`primary`,disabled:!_||d,onClick:()=>void b().catch(()=>{}),children:d?t.saving:t.save})]}),p?(0,Z.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:p}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(ce,{className:Qe(),value:l.dmScope,onChange:e=>v({dmScope:e.target.value}),children:[(0,Z.jsx)(U,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(U,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(U,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(U,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:Qe(),value:l.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:Qe(),value:l.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();v({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function tt(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function nt(e){let t=(0,Te.c)(60),{open:n,loading:r,session:i,sessionAgentId:o,sessionAgentAvatar:s,labels:c,onClose:l,onArchive:u,onUnarchive:d,onPin:f,onUnpin:p,onExport:h,onDelete:g}=e,v=i?.status===`archived`,y=i?.status===`pinned`,b;t[0]===l?b=t[1]:(b=e=>!e&&l(),t[0]=l,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(A,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=x):x=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=a(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,oe,`dark:border-edge`),t[3]=S):S=t[3];let C;t[4]!==i||t[5]!==s||t[6]!==o?(C=i&&o?(0,Z.jsx)(te,{agentId:o,avatar:s,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=s,t[6]=o,t[7]=C):C=t[7];let w;t[8]!==c.unnamedSession||t[9]!==i?.name?(w=i?.name?.trim()||c.unnamedSession,t[8]=c.unnamedSession,t[9]=i?.name,t[10]=w):w=t[10];let T;t[11]===w?T=t[12]:(T=(0,Z.jsx)(_,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:w}),t[11]=w,t[12]=T);let E;t[13]!==C||t[14]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[C,T]}),t[13]=C,t[14]=T,t[15]=E):E=t[15];let D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(ee,{className:`size-5`,strokeWidth:1.75}),t[16]=D):D=t[16];let O;t[17]===c.close?O=t[18]:(O=(0,Z.jsx)(m,{asChild:!0,children:(0,Z.jsx)(G,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:D})}),t[17]=c.close,t[18]=O);let k;t[19]!==E||t[20]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[E,O]}),t[19]=E,t[20]=O,t[21]=k):k=t[21];let N;t[22]!==c.detailLoading||t[23]!==c.detailMessages||t[24]!==r||t[25]!==i?(N=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:c.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(rt)})]}):null,t[22]=c.detailLoading,t[23]=c.detailMessages,t[24]=r,t[25]=i,t[26]=N):N=t[26];let P;t[27]===N?P=t[28]:(P=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:N}),t[27]=N,t[28]=P);let F;t[29]!==c.detailExport||t[30]!==h?(F=(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:h,children:c.detailExport}),t[29]=c.detailExport,t[30]=h,t[31]=F):F=t[31];let I;t[32]!==v||t[33]!==c.archive||t[34]!==c.unarchive||t[35]!==u||t[36]!==d?(I=v?(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:c.unarchive}):(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:c.archive}),t[32]=v,t[33]=c.archive,t[34]=c.unarchive,t[35]=u,t[36]=d,t[37]=I):I=t[37];let L;t[38]!==y||t[39]!==c.pin||t[40]!==c.unpin||t[41]!==f||t[42]!==p?(L=y?(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:c.unpin}):(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:c.pin}),t[38]=y,t[39]=c.pin,t[40]=c.unpin,t[41]=f,t[42]=p,t[43]=L):L=t[43];let R;t[44]!==c.delete||t[45]!==g?(R=(0,Z.jsx)(G,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:g,children:c.delete}),t[44]=c.delete,t[45]=g,t[46]=R):R=t[46];let z;t[47]!==F||t[48]!==I||t[49]!==L||t[50]!==R?(z=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[F,I,L,R]})}),t[47]=F,t[48]=I,t[49]=L,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==k||t[53]!==P||t[54]!==z?(B=(0,Z.jsxs)(M,{children:[x,(0,Z.jsxs)(j,{className:S,"aria-describedby":void 0,children:[k,P,z]})]}),t[52]=k,t[53]=P,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==b||t[58]!==B?(V=(0,Z.jsx)(ge,{open:n,onOpenChange:b,children:B}),t[56]=n,t[57]=b,t[58]=B,t[59]=V):V=t[59],V}function rt(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:tt(e.content)})]},`${e.timestamp??``}-${e.role}-${tt(e.content).slice(0,24)}`)}var it=20;function at(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ot=new Set([`all`,`active`,`pinned`,`archived`]),st=new Set([`grid`,`list`]),ct=[`sessions`,`settings`];function lt(e){return e&&ct.includes(e)?e:`sessions`}function ut(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function dt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function ft(e){let t=(0,Te.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=ct.map(e=>({id:e,label:ut(n,e),icon:e===`sessions`?H:z})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(be,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function pt(e){let t=(0,Te.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ut(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:dt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function mt(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ot.has(t)?t:`all`,viewMode:st.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function ht(){let e=o(c(e=>e.language)),t=e.sessions,n=s(e=>e.token),r=!!n,{data:l,mutate:u}=d(r?[`gateway-chat-agents`,n]:null,f,{revalidateOnFocus:!1}),p=l?.defaultId??`main`,m=l?.items??[],[v,y]=i(),x=lt(v.get(`tab`)),S=(0,X.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),y(t,{replace:!0})},[v,y]),[ee,C]=(0,X.useReducer)(w,v,mt),{searchInput:T,debouncedSearch:E,statusFilter:O,viewMode:k,channelFilter:N,sessions:P,loading:F,error:te,hasMore:z,stats:U,detailOpen:ie,detailLoading:W,detailSession:K,confirmOpen:ce,confirmKey:q}=ee;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=T.trim();E!==e&&C({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[T,E]);let J=v.toString(),Y=(0,X.useRef)(J);if(Y.current!==J){Y.current=J;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ot.has(t)?t:`all`,a=st.has(n)?n:`grid`,o=e.trim();C({type:`patch`,patch:{...T===e?{}:{searchInput:e},...E===o?{}:{debouncedSearch:o},...O===i?{}:{statusFilter:i},...k===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(v),t=E.trim();t?e.set(`q`,t):e.delete(`q`),O===`all`?e.delete(`status`):e.set(`status`,O),k===`grid`?e.delete(`view`):e.set(`view`,k),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==v.toString()&&y(e,{replace:!0})},[E,v,y,O,k,N]),(0,X.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{C({type:`patch`,patch:{loading:!0,error:null}});try{let t=await ue({limit:it,offset:0,...E?{search:E}:{},...O===`all`?{}:{status:O},...N?{channel:N}:{}});if(e)return;C({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||C({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||C({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,E,O,N,t.loadError]),(0,X.useEffect)(()=>{!r||x!==`sessions`||B().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,X.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void u();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,u]),(0,X.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||C({type:`patch`,patch:{sessions:P.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:K&&K.key===t.key?{...K,name:t.name}:K}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,P,K]);let _e=(0,X.useCallback)(async()=>{if(!(!r||F||!z)){C({type:`patch`,patch:{loading:!0,error:null}});try{let e=await ue({limit:it,offset:P.length,...E?{search:E}:{},...O===`all`?{}:{status:O},...N?{channel:N}:{}});C({type:`patch`,patch:{sessions:[...P,...e.items],hasMore:e.hasMore}})}catch(e){C({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{C({type:`patch`,patch:{loading:!1}})}}},[r,F,z,P.length,E,O,N,t.loadError]),ve=(0,X.useCallback)((e,t)=>{C({type:`patch`,patch:{sessions:P.map(n=>n.key===e?{...n,status:t}:n),detailSession:K&&K.key===e?{...K,status:t}:K}})},[P,K]),ye=(0,X.useCallback)(async e=>{C({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{C({type:`patch`,patch:{detailSession:await R(e)}})}catch{C({type:`patch`,patch:{detailOpen:!1}})}finally{C({type:`patch`,patch:{detailLoading:!1}})}},[]),be=e=>{ye(e)},xe=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){C({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await L(e),ve(e,`archived`);break;case`unarchive`:await ne(e),ve(e,`active`);break;case`pin`:await se(e),ve(e,`pinned`);break;case`unpin`:await I(e),ve(e,`active`);break;case`export`:{let t=await fe(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}B().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await ae(e),C({type:`patch`,patch:{sessions:P.filter(t=>t.key!==e),detailSession:K?.key===e?null:K,...K?.key===e?{detailOpen:!1}:{}}}),B().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ee={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},De={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},ke=[{key:`all`,label:t.filterAll,icon:H},{key:`active`,label:t.filterActive,icon:le},{key:`pinned`,label:t.filterPinned,icon:g},{key:`archived`,label:t.filterArchived,icon:b}],Ae=(()=>{let e=Object.entries(U?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Z.jsx)(ft,{s:t,activeTab:x,onChange:S}),(0,Z.jsx)(pt,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(qe,{hasToken:r}),(0,Z.jsx)(et,{hasToken:r})]})}),(0,Z.jsxs)(pt,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ke.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":O===e,onClick:()=>C({type:`patch`,patch:{statusFilter:e}}),className:a(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,h.transition,h.focusRingPanel,O===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(re,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:T,onChange:e=>C({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":E||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>C({type:`patch`,patch:{channelFilter:``}}),className:a(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,h.transition,h.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Ae.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>C({type:`patch`,patch:{channelFilter:e}}),className:a(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,h.transition,h.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,U?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:U.byChannel[e]})]},e))]}),U?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[U.totalSessions,t.totalSessions],[U.activeSessions,t.activeSessions],[U.pinnedSessions,t.pinnedSessions],[U.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,te?(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:te}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:at(t.sessionCount,{count:P.length})}),(0,Z.jsxs)(`div`,{className:we,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(G,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":k===`grid`,onClick:()=>C({type:`patch`,patch:{viewMode:`grid`}}),className:a(Ce,`size-7 p-0`,k===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,k===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(de,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(G,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":k===`list`,onClick:()=>C({type:`patch`,patch:{viewMode:`list`}}),className:a(Ce,`size-9 p-0`,k===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,k===`list`&&`text-accent-fg`),children:(0,Z.jsx)(V,{className:`size-3.5`,strokeWidth:1.5})})]})]}),F&&P.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):P.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(D,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(G,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:a(`grid min-w-0 gap-3`,k===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":E||void 0,children:P.map(e=>{let t=he(e,p);return(0,Z.jsx)(Oe,{session:e,variant:k,labels:Ee,sessionAgentId:t,sessionAgentAvatar:me(t,m),onOpen:()=>be(e.key),onAction:t=>void xe(e.key,t)},e.key)})}),z?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(G,{type:`button`,variant:`secondary`,disabled:F,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(nt,{open:ie,loading:W,session:K,sessionAgentId:K?he(K,p):void 0,sessionAgentAvatar:K?me(he(K,p),m):void 0,labels:De,onClose:()=>{C({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>K&&void xe(K.key,`archive`),onUnarchive:()=>K&&void xe(K.key,`unarchive`),onPin:()=>K&&void xe(K.key,`pin`),onUnpin:()=>K&&void xe(K.key,`unpin`),onExport:()=>K&&void xe(K.key,`export`),onDelete:()=>K&&C({type:`patch`,patch:{confirmKey:K.key,confirmOpen:!0}})}),(0,Z.jsx)(ge,{open:ce,onOpenChange:e=>C({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(M,{children:[(0,Z.jsx)(A,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Z.jsxs)(j,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,oe),children:[(0,Z.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:q?at(t.deleteSessionMessage,{name:P.find(e=>e.key===q)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(G,{type:`button`,variant:`secondary`,onClick:()=>C({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(G,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{q&&Te(q),C({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{ht as SessionsPage};
@@ -0,0 +1 @@
1
+ import{ni as e}from"./index-eyttVNS_.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Bc as r,Os as i}from"./index-DUasAutC.js";var a=e();function o(){return`rounded-2xl border border-edge-subtle bg-surface-base px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(6),{children:r,className:i,id:c}=e,l;t[0]===i?l=t[1]:(l=n(o(),i),t[0]=i,t[1]=l);let u;return t[2]!==r||t[3]!==c||t[4]!==l?(u=(0,s.jsx)(`section`,{id:c,className:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u):u=t[5],u}var l=`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted transition-colors dark:bg-surface-hover/70`;function u(e){let t=(0,a.c)(29),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v;t[2]===h?v=t[3]:(v=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press),t[2]=h,t[3]=v);let y=v,b=!!(m&&h),x;t[4]===p?x=t[5]:(x=n(`mb-5 flex items-start gap-3`,p),t[4]=p,t[5]=x);let S;t[6]!==m||t[7]!==h||t[8]!==_||t[9]!==y||t[10]!==b?(S=m?b?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:y,children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(r,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:y,children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[6]=m,t[7]=h,t[8]=_,t[9]=y,t[10]=b,t[11]=S):S=t[11];let C;t[12]===c?C=t[13]:(C=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[12]=c,t[13]=C);let w;t[14]!==C||t[15]!==f?(w=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[C,f]}),t[14]=C,t[15]=f,t[16]=w):w=t[16];let T;t[17]===u?T=t[18]:(T=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[17]=u,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]===d?D=t[23]:(D=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[22]=d,t[23]=D);let O;return t[24]!==x||t[25]!==S||t[26]!==E||t[27]!==D?(O=(0,s.jsxs)(`div`,{className:x,children:[S,E,D]}),t[24]=x,t[25]=S,t[26]=E,t[27]=D,t[28]=O):O=t[28],O}export{u as n,o as r,c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Cs as r,Ic as i}from"./index-eyttVNS_.js";var a=e();function o(){return`rounded-2xl border border-edge-subtle bg-surface-base px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(6),{children:r,className:i,id:c}=e,l;t[0]===i?l=t[1]:(l=n(o(),i),t[0]=i,t[1]=l);let u;return t[2]!==r||t[3]!==c||t[4]!==l?(u=(0,s.jsx)(`section`,{id:c,className:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u):u=t[5],u}var l=`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted transition-colors dark:bg-surface-hover/70`;function u(e){let t=(0,a.c)(29),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v;t[2]===h?v=t[3]:(v=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,r.press),t[2]=h,t[3]=v);let y=v,b=!!(m&&h),x;t[4]===p?x=t[5]:(x=n(`mb-5 flex items-start gap-3`,p),t[4]=p,t[5]=x);let S;t[6]!==m||t[7]!==h||t[8]!==_||t[9]!==y||t[10]!==b?(S=m?b?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:y,children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(i,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:y,children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[6]=m,t[7]=h,t[8]=_,t[9]=y,t[10]=b,t[11]=S):S=t[11];let C;t[12]===c?C=t[13]:(C=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[12]=c,t[13]=C);let w;t[14]!==C||t[15]!==f?(w=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[C,f]}),t[14]=C,t[15]=f,t[16]=w):w=t[16];let T;t[17]===u?T=t[18]:(T=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[17]=u,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]===d?D=t[23]:(D=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[22]=d,t[23]=D);let O;return t[24]!==x||t[25]!==S||t[26]!==E||t[27]!==D?(O=(0,s.jsxs)(`div`,{className:x,children:[S,E,D]}),t[24]=x,t[25]=S,t[26]=E,t[27]=D,t[28]=O):O=t[28],O}export{u as n,o as r,c as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{io as n}from"./index-DUasAutC.js";var r=e(),i=t();function a(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,s;return t[0]===a?s=t[1]:(s=(0,i.jsx)(`div`,{className:`flex flex-col gap-2.5`,"aria-busy":`true`,children:Array.from({length:a}).map(o)}),t[0]=a,t[1]=s),s}function o(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-48 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-72 max-w-full`})]},t)}function s(e){let t=(0,r.c)(3),{sections:a}=e,o=a===void 0?2:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-6 w-48 max-w-full`}),(0,i.jsx)(n,{className:`h-4 w-80 max-w-full`})]}),t[0]=s):s=t[0];let l;return t[1]===o?l=t[2]:(l=(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,"aria-busy":`true`,children:[s,Array.from({length:o}).map(c)]}),t[1]=o,t[2]=l),l}function c(e,t){return(0,i.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-5 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-4 w-72 max-w-full`}),(0,i.jsx)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:Array.from({length:4}).map(l)})]},t)}function l(e,t){return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-3 w-24`}),(0,i.jsx)(n,{className:`h-10 w-full rounded-lg`})]},t)}function u(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:Array.from({length:a}).map(d)}),t[0]=a,t[1]=o),o}function d(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-64 max-w-full`})]},t)}export{s as n,a as r,u as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{ro as n}from"./index-eyttVNS_.js";var r=e(),i=t();function a(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,s;return t[0]===a?s=t[1]:(s=(0,i.jsx)(`div`,{className:`flex flex-col gap-2.5`,"aria-busy":`true`,children:Array.from({length:a}).map(o)}),t[0]=a,t[1]=s),s}function o(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-48 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-72 max-w-full`})]},t)}function s(e){let t=(0,r.c)(3),{sections:a}=e,o=a===void 0?2:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-6 w-48 max-w-full`}),(0,i.jsx)(n,{className:`h-4 w-80 max-w-full`})]}),t[0]=s):s=t[0];let l;return t[1]===o?l=t[2]:(l=(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,"aria-busy":`true`,children:[s,Array.from({length:o}).map(c)]}),t[1]=o,t[2]=l),l}function c(e,t){return(0,i.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-5 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-4 w-72 max-w-full`}),(0,i.jsx)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:Array.from({length:4}).map(l)})]},t)}function l(e,t){return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(n,{className:`h-3 w-24`}),(0,i.jsx)(n,{className:`h-10 w-full rounded-lg`})]},t)}function u(e){let t=(0,r.c)(2),{rows:n}=e,a=n===void 0?3:n,o;return t[0]===a?o=t[1]:(o=(0,i.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:Array.from({length:a}).map(d)}),t[0]=a,t[1]=o),o}function d(e,t){return(0,i.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,i.jsx)(n,{className:`h-4 w-40 max-w-full`}),(0,i.jsx)(n,{className:`mt-2 h-3 w-64 max-w-full`})]},t)}export{s as n,a 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{d as i,r as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./messages-BWtP5TFz.js";import{n as s}from"./locale-store-BP0vD37A.js";import{Co as c,So as l,_o as u,bo as d,do as f,fo as p,go as m,ho as h,mo as g,po as _,vo as v,xo as y,yo as b}from"./index-DUasAutC.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`capability-presets`,`gateway`,`heartbeat`,`remote-access`,`shares`,`goals`,`dreams`],T=(0,S.lazy)(()=>y().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>p().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>b().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>c().then(e=>({default:e.SystemSettingsPanel}))),k=(0,S.lazy)(()=>g().then(e=>({default:e.DesktopPetSettings}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.AppManagementSettingsPanel}))),j=(0,S.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),M=(0,S.lazy)(()=>v().then(e=>({default:e.HeartbeatSettingsPanel}))),N=(0,S.lazy)(()=>d().then(e=>({default:e.RemoteAccessHub}))),P=(0,S.lazy)(()=>l().then(e=>({default:e.SharesSettingsPanel}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.DreamingSettingsPanel}))),I=(0,S.lazy)(()=>u().then(e=>({default:e.GoalsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.CapabilityPresetsSettingsPanel})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=s(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(s===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(s===`capability-presets`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[15]=t):t=e[15],d=t;break bb0}if(s===`heartbeat`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(s===`remote-access`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(s===`shares`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[18]=t):t=e[18],d=t;break bb0}if(s===`dreams`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[19]=t):t=e[19],d=t;break bb0}if(s===`goals`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,r as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./messages-BiBdO1-O.js";import{n as s}from"./locale-store-CAuhEGCn.js";import{So as c,_o as l,bo as u,do as d,fo as f,go as p,ho as m,mo as h,po as g,uo as _,vo as v,xo as y,yo as b}from"./index-eyttVNS_.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`capability-presets`,`gateway`,`heartbeat`,`remote-access`,`shares`,`goals`,`dreams`],T=(0,S.lazy)(()=>u().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>d().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>v().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>c().then(e=>({default:e.SystemSettingsPanel}))),k=(0,S.lazy)(()=>g().then(e=>({default:e.DesktopPetSettings}))),A=(0,S.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),j=(0,S.lazy)(()=>m().then(e=>({default:e.GatewaySettingsPanel}))),M=(0,S.lazy)(()=>l().then(e=>({default:e.HeartbeatSettingsPanel}))),N=(0,S.lazy)(()=>b().then(e=>({default:e.RemoteAccessHub}))),P=(0,S.lazy)(()=>y().then(e=>({default:e.SharesSettingsPanel}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.DreamingSettingsPanel}))),I=(0,S.lazy)(()=>p().then(e=>({default:e.GoalsSettingsPanel}))),L=(0,S.lazy)(()=>f().then(e=>({default:e.CapabilityPresetsSettingsPanel})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=s(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(s===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(s===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(s===`capability-presets`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[14]=t):t=e[14],d=t;break bb0}if(s===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[15]=t):t=e[15],d=t;break bb0}if(s===`heartbeat`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(s===`remote-access`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(s===`shares`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[18]=t):t=e[18],d=t;break bb0}if(s===`dreams`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[19]=t):t=e[19],d=t;break bb0}if(s===`goals`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Jl as r}from"./index-DUasAutC.js";var i=e(),a=t();function o(e){let t=(0,i.c)(14),r,o,s,c,l;t[0]===e?(r=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({children:r,className:o,gap:c,padding:l,...s}=e,t[0]=e,t[1]=r,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=c===void 0?`gap-4`:c,d=l===void 0?`px-3 py-6 sm:px-5 xl:px-6`:l,f;t[6]!==o||t[7]!==u||t[8]!==d?(f=n(`flex min-h-full w-full flex-col bg-surface-panel`,u,d,o),t[6]=o,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==r||t[11]!==s||t[12]!==f?(p=(0,a.jsx)(`div`,{className:f,...s,children:r}),t[10]=r,t[11]=s,t[12]=f,t[13]=p):p=t[13],p}function s(e){let t=(0,i.c)(20),{title:o,subtitle:s,docsLink:c,docsLabel:l,meta:u,actions:d,className:f}=e,p;t[0]===f?p=t[1]:(p=n(`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,f),t[0]=f,t[1]=p);let m;t[2]===o?m=t[3]:(m=(0,a.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:o}),t[2]=o,t[3]=m);let h;t[4]===s?h=t[5]:(h=s?(0,a.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null,t[4]=s,t[5]=h);let g;t[6]!==l||t[7]!==c?(g=c&&l?(0,a.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[l,(0,a.jsx)(r,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[6]=l,t[7]=c,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,a.jsxs)(`div`,{className:`min-w-0`,children:[m,h,g,u]}),t[9]=u,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===d?v=t[15]:(v=d?(0,a.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:d}):null,t[14]=d,t[15]=v);let y;return t[16]!==p||t[17]!==_||t[18]!==v?(y=(0,a.jsxs)(`header`,{className:p,children:[_,v]}),t[16]=p,t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function c(e){let t=(0,i.c)(13),{id:r,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0?!0:d,g=f===void 0?!0:f;if(o!==r)return null;let _=`${c}-${r}`,v=`${s}-${r}`,y=g&&`rounded-2xl border border-edge-subtle bg-surface-base px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,a.jsxs)(`div`,{className:`mb-5`,children:[l?(0,a.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,a.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,a.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{s as n,o as r,c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Wl as r}from"./index-eyttVNS_.js";var i=e(),a=t();function o(e){let t=(0,i.c)(14),r,o,s,c,l;t[0]===e?(r=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({children:r,className:o,gap:c,padding:l,...s}=e,t[0]=e,t[1]=r,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=c===void 0?`gap-4`:c,d=l===void 0?`px-3 py-6 sm:px-5 xl:px-6`:l,f;t[6]!==o||t[7]!==u||t[8]!==d?(f=n(`flex min-h-full w-full flex-col bg-surface-panel`,u,d,o),t[6]=o,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==r||t[11]!==s||t[12]!==f?(p=(0,a.jsx)(`div`,{className:f,...s,children:r}),t[10]=r,t[11]=s,t[12]=f,t[13]=p):p=t[13],p}function s(e){let t=(0,i.c)(20),{title:o,subtitle:s,docsLink:c,docsLabel:l,meta:u,actions:d,className:f}=e,p;t[0]===f?p=t[1]:(p=n(`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,f),t[0]=f,t[1]=p);let m;t[2]===o?m=t[3]:(m=(0,a.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:o}),t[2]=o,t[3]=m);let h;t[4]===s?h=t[5]:(h=s?(0,a.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null,t[4]=s,t[5]=h);let g;t[6]!==l||t[7]!==c?(g=c&&l?(0,a.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[l,(0,a.jsx)(r,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[6]=l,t[7]=c,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,a.jsxs)(`div`,{className:`min-w-0`,children:[m,h,g,u]}),t[9]=u,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===d?v=t[15]:(v=d?(0,a.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2`,children:d}):null,t[14]=d,t[15]=v);let y;return t[16]!==p||t[17]!==_||t[18]!==v?(y=(0,a.jsxs)(`header`,{className:p,children:[_,v]}),t[16]=p,t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function c(e){let t=(0,i.c)(13),{id:r,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0?!0:d,g=f===void 0?!0:f;if(o!==r)return null;let _=`${c}-${r}`,v=`${s}-${r}`,y=g&&`rounded-2xl border border-edge-subtle bg-surface-base px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=n(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,a.jsxs)(`div`,{className:`mb-5`,children:[l?(0,a.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,a.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,a.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{s as n,o as r,c as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-BiBdO1-O.js";import{l as s,n as c,r as l,s as u}from"./locale-store-CAuhEGCn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$r as f,Cs as p,Hn as m,Qn as h,Ru as g,Sc as _,Ws as v,Zn as y,ec as b,hu as x,ir as S,no as C,ou as w,pu as T,su as E,tl as ee,vl as D,xs as O}from"./index-eyttVNS_.js";import{n as k,r as A}from"./settings-page-layout-BENrkwd0.js";import{n as j}from"./settings-loading-skeleton-DRSDHucM.js";import{n as M,t as N}from"./settings-form-section-CPG0KGVs.js";var P=e(t(),1),F=n();function I(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&O(e)).length}function L(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=typeof n.defaultPreset==`string`&&n.defaultPreset.trim()?n.defaultPreset.trim():`default`,i=n.capabilityPresets,a=i&&typeof i==`object`&&!Array.isArray(i)?i[r]:void 0,o=a&&typeof a==`object`&&!Array.isArray(a)?a.models:void 0;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o,c=s.roles;if(!c||typeof c!=`object`||Array.isArray(c))return``;let l=c,u=typeof s.defaultRole==`string`&&s.defaultRole.trim()?s.defaultRole.trim():Object.keys(l)[0],d=u?l[u]:void 0;if(!d||typeof d!=`object`||Array.isArray(d))return``;let f=d.model;return typeof f==`string`?f.trim():``}function R(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function z(e){if(!e||typeof e!=`object`)return{enabled:!1,backend:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,backend:`extension`};let n=t;return{enabled:n.enabled===!0,backend:typeof n.backend==`string`&&n.backend.trim()?n.backend.trim():`extension`}}function B(e){return e?`pass`:`fail`}function V(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function H(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function te(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:V(e.id),source:`doctor`})).toSorted((e,t)=>H(t.status)-H(e.status)||e.label.localeCompare(t.label))}function U(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:V(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function ne(e){let t=I(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=L(e.config),o=a.length>0,s=e.hasToken&&e.sseConnected,c=R(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=te(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:B(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:B(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:B(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=U({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function re(e){return z(e)}function W(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function ie(){return l(`/api/doctor`)}async function ae(){return((await u(ie())).checks??[]).map(W).filter(e=>e!==null)}function oe(){return l(`/api/logs/health`)}async function se(){return u(oe())}function G(e){return e?`pass`:`warn`}function K(e){return`/settings/agent-browser?tab=${encodeURIComponent(e)}`}function ce(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function q(e){if(!e.enabled)return[];if(e.backend===`local`){let e=await u(l(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:G(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:K(`local`)}]}if(e.backend===`cloakbrowser`){let e=await u(l(`/api/browser/cloakbrowser/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-cloakbrowser`,label:`Browser: CloakBrowser`,status:G(t),message:t?`CloakBrowser ${e.payload?.version??``}`.trim():`CloakBrowser is not installed.`,path:K(`cloakbrowser`)}]}if(e.backend===`extension`){let e=await u(l(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:K(`extension`)}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser backend "${e.backend}" is not checked on this overview.`,path:K(e.backend||`overview`)}]}function J(){let e=(0,F.c)(57),t=s(me),n=c(pe),r;e[0]===n?r=e[1]:(r=o(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,l=S(fe),{data:u,error:f,isLoading:p,mutate:g}=C(!!t),_;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_={revalidateOnFocus:!1},e[2]=_):_=e[2];let{data:v,error:b,isLoading:x,mutate:w}=d(t?`setup-checklist-skills`:null,de,_),T;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},e[3]=T):T=e[3];let{data:E,error:ee,isLoading:D,mutate:O}=d(t?`setup-checklist-provider-meta`:null,m,T),k;e[4]===t?k=e[5]:(k=t?ie():null,e[4]=t,e[5]=k);let A;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[6]=A):A=e[6];let{data:j,error:M,isLoading:N,mutate:P}=d(k,ae,A),I;e[7]===t?I=e[8]:(I=t?oe():null,e[7]=t,e[8]=I);let L;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[9]=L):L=e[9];let{data:R,isLoading:z,mutate:B}=d(I,se,L);u?.payload?.config;let V=u?.payload?.config,H;e[10]===V?H=e[11]:(H=re(V),e[10]=V,e[11]=H);let te=t?H:null,U;e[12]===te?U=e[13]:(U=ce(te),e[12]=te,e[13]=U);let W;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1},e[14]=W):W=e[14];let{data:G,isLoading:K,mutate:q}=d(U,ue,W),J;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(J={revalidateOnFocus:!1},e[15]=J):J=e[15],d(t?y:null,h,J);let Y=!t||!p&&!x&&!D&&!N&&!z&&!K,X=!!(f||b||ee||M),Z;bb0:{if(!t||!Y){Z=null;break bb0}let n=v?.catalog?.length??0,r;if(e[16]!==G||e[17]!==u?.payload?.config||e[18]!==j||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==R||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==E||e[33]!==n||e[34]!==l||e[35]!==t){let o=E?.filter(le).length??0,s=E?.length??0,c;e[37]===a.providersConfigured?c=e[38]:(c=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=c);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=ne({hasToken:!!t,sseConnected:l,config:u?.payload?.config,skillCount:n,providerMeta:s>0?{configured:o,total:s}:null,doctorChecks:j,logsHealth:R,browserDiagnostics:G,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:c,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=G,e[17]=u?.payload?.config,e[18]=j,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=R,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=E,e[33]=n,e[34]=l,e[35]=t,e[36]=r}else r=e[36];Z=r}let he=Z,Q;e[45]!==q||e[46]!==g||e[47]!==P||e[48]!==B||e[49]!==O||e[50]!==w?(Q=async()=>{await Promise.all([g(),w(),O(),P(),B(),q()])},e[45]=q,e[46]=g,e[47]=P,e[48]=B,e[49]=O,e[50]=w,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==X||e[53]!==Y||e[54]!==ge||e[55]!==he?($={ready:Y,error:X,snapshot:he,refresh:ge},e[52]=X,e[53]=Y,e[54]=ge,e[55]=he,e[56]=$):$=e[56],$}function le(e){return e.configured}function ue(e){let[,t]=e;return q(t)}function de(){return f()}function fe(e){return e.connectionState===`connected`}function pe(e){return e.language}function me(e){return e.token}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?T:e===`warn`?v:e===`fail`?E:D}function he(e,t){return e===`blocked`?{icon:E,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:v,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:w,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:T,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,F.c)(48),{tier:n,issueCount:r,onRunDoctor:s,ready:l,doctorRunning:u,doctorRunState:d}=e,f=c(ge),m,h,g,v,y,b,S,C,w,T,E;if(t[0]!==r||t[1]!==f||t[2]!==n){h=o(f).setupStatus;let e=he(n,h),s=e.icon,c=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,l=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=c?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(c)?.scrollIntoView({block:`start`,behavior:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(x,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:l,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(x,{className:`size-4`,"aria-hidden":!0})]}),E=a(`rounded-xl p-4`,e.className),T=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,C=`flex min-w-0 gap-3`,w=(0,Y.jsx)(s,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),y=`min-w-0`,b=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),S=(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),g=`mt-2 text-xs opacity-75`,v=h.health.issueCount.replace(`{{count}}`,String(r)),t[0]=r,t[1]=f,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=v,t[7]=y,t[8]=b,t[9]=S,t[10]=C,t[11]=w,t[12]=T,t[13]=E}else m=t[3],h=t[4],g=t[5],v=t[6],y=t[7],b=t[8],S=t[9],C=t[10],w=t[11],T=t[12],E=t[13];let D;t[14]!==g||t[15]!==v?(D=(0,Y.jsx)(`p`,{className:g,children:v}),t[14]=g,t[15]=v,t[16]=D):D=t[16];let O;t[17]!==D||t[18]!==y||t[19]!==b||t[20]!==S?(O=(0,Y.jsxs)(`div`,{className:y,children:[b,S,D]}),t[17]=D,t[18]=y,t[19]=b,t[20]=S,t[21]=O):O=t[21];let k;t[22]!==O||t[23]!==C||t[24]!==w?(k=(0,Y.jsxs)(`div`,{className:C,children:[w,O]}),t[22]=O,t[23]=C,t[24]=w,t[25]=k):k=t[25];let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=a(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,p.press),t[26]=A):A=t[26];let j=!l||u,M;t[27]===u?M=t[28]:(M=u?(0,Y.jsx)(ee,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[27]=u,t[28]=M);let N=u?h.health.runDoctorRunning:h.health.runDoctor,P;t[29]!==u||t[30]!==s||t[31]!==j||t[32]!==M||t[33]!==N?(P=(0,Y.jsxs)(`button`,{type:`button`,className:A,onClick:s,disabled:j,"aria-busy":u,children:[M,N]}),t[29]=u,t[30]=s,t[31]=j,t[32]=M,t[33]=N,t[34]=P):P=t[34];let I;t[35]!==m||t[36]!==P?(I=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,P]}),t[35]=m,t[36]=P,t[37]=I):I=t[37];let L;t[38]!==k||t[39]!==I||t[40]!==T?(L=(0,Y.jsxs)(`div`,{className:T,children:[k,I]}),t[38]=k,t[39]=I,t[40]=T,t[41]=L):L=t[41];let R=u?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:d===`error`?h.health.doctorFailedMessage:h.health.doctorIdleMessage,z;t[42]===R?z=t[43]:(z=(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:R}),t[42]=R,t[43]=z);let B;return t[44]!==L||t[45]!==z||t[46]!==E?(B=(0,Y.jsxs)(`section`,{className:E,children:[L,z]}),t[44]=L,t[45]=z,t[46]=E,t[47]=B):B=t[47],B}function ge(e){return e.language}function $(e){let t=(0,F.c)(34),{issue:n,fixLabel:r}=e,o;t[0]===n.status?o=t[1]:(o=Z(n.status),t[0]=n.status,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=(0,Y.jsx)(s,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=s,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.status?u=t[7]:(u=a(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[6]=n.status,t[7]=u);let d;t[8]!==n.status||t[9]!==u?(d=(0,Y.jsx)(`span`,{className:u,children:n.status}),t[8]=n.status,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.message?p=t[15]:(p=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=p);let m;t[16]===n.hints[0]?m=t[17]:(m=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=m);let h;t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==r||t[23]!==n.path?(g=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(x,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==c||t[27]!==h?(_=(0,Y.jsxs)(Y.Fragment,{children:[c,h,g]}),t[25]=g,t[26]=c,t[27]=h,t[28]=_):_=t[28];let v=_;if(n.path){let e;return t[29]!==v||t[30]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[29]=v,t[30]=n.path,t[31]=e):e=t[31],e}let y;return t[32]===v?y=t[33]:(y=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:v}),t[32]=v,t[33]=y),y}function _e(e){let t=(0,F.c)(27),{item:n,labels:r}=e,o;t[0]===n.status?o=t[1]:(o=Z(n.status),t[0]=n.status,t[1]=o);let s=o,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=a(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===s?u=t[5]:(u=(0,Y.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[4]=s,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(x,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function ve(e){let t=(0,F.c)(29),{signal:n,fixLabel:r}=e,o;t[0]===n.status?o=t[1]:(o=Z(n.status),t[0]=n.status,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=(0,Y.jsx)(s,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=s,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.message?u=t[7]:(u=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n.status?f=t[12]:(f=a(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[11]=n.status,t[12]=f);let p;t[13]!==n.status||t[14]!==f?(p=(0,Y.jsx)(`span`,{className:f,children:n.status}),t[13]=n.status,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==c||t[20]!==d||t[21]!==p||t[22]!==m?(h=(0,Y.jsxs)(Y.Fragment,{children:[c,d,p,m]}),t[19]=c,t[20]=d,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:g}),t[27]=g,t[28]=_),_}function ye(){let e=o(c(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[s,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(`idle`),f=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],m=async()=>{if(!(s||!t)){l(!0),d(`idle`);try{await i(),d(`success`)}catch{d(`error`)}finally{l(!1)}}};return(0,Y.jsxs)(A,{gap:`gap-6`,children:[(0,Y.jsx)(k,{title:e.title,subtitle:e.subtitle,actions:(0,Y.jsxs)(`button`,{type:`button`,className:a(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,p.press),onClick:()=>void m(),disabled:!t||s,"aria-busy":s,children:[(0,Y.jsx)(_,{className:a(`size-4`,(!t||s)&&`animate-spin`),"aria-hidden":!0}),s?e.health.runDoctorRunning:e.refresh]})}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(j,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void m(),doctorRunning:s,doctorRunState:u}),(0,Y.jsxs)(N,{id:`next-steps`,children:[(0,Y.jsx)(M,{icon:r.issues.length?v:g,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsxs)(N,{children:[(0,Y.jsx)(M,{icon:b,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),f.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:f.map(t=>(0,Y.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ye as SetupStatusPanel};