xaq-cli 0.0.0 → 0.1.0-nightly.72

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 (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/dist/admin-5gThRwgj.js +162 -0
  4. package/dist/admin-5gThRwgj.js.map +1 -0
  5. package/dist/admin-Btrm8mCd.js +218 -0
  6. package/dist/admin-Btrm8mCd.js.map +1 -0
  7. package/dist/admin-CWofnT_Q.js +2 -0
  8. package/dist/api-BFpElwqK.js +89 -0
  9. package/dist/api-BFpElwqK.js.map +1 -0
  10. package/dist/audit-BB7jK9Z5.js +2 -0
  11. package/dist/audit-BVYknW2i.js +79 -0
  12. package/dist/audit-BVYknW2i.js.map +1 -0
  13. package/dist/auth-CXmBdMqw.js +2 -0
  14. package/dist/auth-D-GmwNv-.js +550 -0
  15. package/dist/auth-D-GmwNv-.js.map +1 -0
  16. package/dist/brand--ZB8jTn1.js +32 -0
  17. package/dist/brand--ZB8jTn1.js.map +1 -0
  18. package/dist/bus-Cz0flS37.js +12 -0
  19. package/dist/bus-Cz0flS37.js.map +1 -0
  20. package/dist/bus-OKIGut72.js +2 -0
  21. package/dist/cli.js +234 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/commands-BNVLjYXA.js +167 -0
  24. package/dist/commands-BNVLjYXA.js.map +1 -0
  25. package/dist/commands-CdA6-WE7.js +112 -0
  26. package/dist/commands-CdA6-WE7.js.map +1 -0
  27. package/dist/config-C9XmYZWO.js +94 -0
  28. package/dist/config-C9XmYZWO.js.map +1 -0
  29. package/dist/config-CNVi0v5t.js +2 -0
  30. package/dist/connect-TtJ9n0Rw.js +362 -0
  31. package/dist/connect-TtJ9n0Rw.js.map +1 -0
  32. package/dist/content-C1lKMxFS.js +1170 -0
  33. package/dist/content-C1lKMxFS.js.map +1 -0
  34. package/dist/content-worker.js +28 -0
  35. package/dist/content-worker.js.map +1 -0
  36. package/dist/crypto-fv2fj3S8.js +75 -0
  37. package/dist/crypto-fv2fj3S8.js.map +1 -0
  38. package/dist/db-BEUEUPyP.js +561 -0
  39. package/dist/db-BEUEUPyP.js.map +1 -0
  40. package/dist/db-Q5BQuwga.js +2 -0
  41. package/dist/errors-FbMS3QBo.js +39 -0
  42. package/dist/errors-FbMS3QBo.js.map +1 -0
  43. package/dist/filter-Ck6OMxvu.js +158 -0
  44. package/dist/filter-Ck6OMxvu.js.map +1 -0
  45. package/dist/hermes-CKyzt1mH.js +3 -0
  46. package/dist/hermes-DHnDTYJp.js +1023 -0
  47. package/dist/hermes-DHnDTYJp.js.map +1 -0
  48. package/dist/import-DsN5NZT3.js +910 -0
  49. package/dist/import-DsN5NZT3.js.map +1 -0
  50. package/dist/instance-CwWbFbJ8.js +2 -0
  51. package/dist/instance-Dj9TpJB2.js +195 -0
  52. package/dist/instance-Dj9TpJB2.js.map +1 -0
  53. package/dist/listen-B9iO7HgQ.js +1568 -0
  54. package/dist/listen-B9iO7HgQ.js.map +1 -0
  55. package/dist/listen-CXVKG9XD.js +2 -0
  56. package/dist/manage-Bo6COB4p.js +477 -0
  57. package/dist/manage-Bo6COB4p.js.map +1 -0
  58. package/dist/manage-DoXqvjnU.js +2 -0
  59. package/dist/mcpheader-B8c5YO1B.js +2 -0
  60. package/dist/mcpheader-C9H4vudu.js +185 -0
  61. package/dist/mcpheader-C9H4vudu.js.map +1 -0
  62. package/dist/mcpsetup-BnHudwpq.js +2 -0
  63. package/dist/mcpsetup-DXXo2qjf.js +1053 -0
  64. package/dist/mcpsetup-DXXo2qjf.js.map +1 -0
  65. package/dist/node-check-CjTk6VNL.js +24 -0
  66. package/dist/node-check-CjTk6VNL.js.map +1 -0
  67. package/dist/paths-d-C2kdjo.js +2 -0
  68. package/dist/paths-yzOKD6ow.js +46 -0
  69. package/dist/paths-yzOKD6ow.js.map +1 -0
  70. package/dist/profile-CcMZ4hn7.js +2 -0
  71. package/dist/profile-NmMKAczz.js +222 -0
  72. package/dist/profile-NmMKAczz.js.map +1 -0
  73. package/dist/prompt-CKMQx_MJ.js +114 -0
  74. package/dist/prompt-CKMQx_MJ.js.map +1 -0
  75. package/dist/recipes-C7TIDlRj.js +3 -0
  76. package/dist/recipes-DG_-doGq.js +314 -0
  77. package/dist/recipes-DG_-doGq.js.map +1 -0
  78. package/dist/send-Dk-t8ia-.js +108 -0
  79. package/dist/send-Dk-t8ia-.js.map +1 -0
  80. package/dist/server-CDqDp1q3.js +20640 -0
  81. package/dist/server-CDqDp1q3.js.map +1 -0
  82. package/dist/service-BVn3soZZ.js +766 -0
  83. package/dist/service-BVn3soZZ.js.map +1 -0
  84. package/dist/service-BaWGPmSd.js +2 -0
  85. package/dist/service-C7jfo-Ex.js +457 -0
  86. package/dist/service-C7jfo-Ex.js.map +1 -0
  87. package/dist/service-DxDyKDQ-.js +2 -0
  88. package/dist/settings-B5qSHxRM.js +134 -0
  89. package/dist/settings-B5qSHxRM.js.map +1 -0
  90. package/dist/settings-DQvZaMN1.js +2 -0
  91. package/dist/setup-token-CwuSzfLK.js +48 -0
  92. package/dist/setup-token-CwuSzfLK.js.map +1 -0
  93. package/dist/skill/SKILL.md +445 -0
  94. package/dist/skill-1UQj3qgW.js +69 -0
  95. package/dist/skill-1UQj3qgW.js.map +1 -0
  96. package/dist/skill-pelq18JQ.js +2 -0
  97. package/dist/ssrf-BlVpGZ7C.js +181 -0
  98. package/dist/ssrf-BlVpGZ7C.js.map +1 -0
  99. package/dist/types-BhJDbSzE.js +135 -0
  100. package/dist/types-BhJDbSzE.js.map +1 -0
  101. package/dist/ui-B8Sd4Y7Y.js +81 -0
  102. package/dist/ui-B8Sd4Y7Y.js.map +1 -0
  103. package/dist/urls-Dp8pBGMU.js +2 -0
  104. package/dist/urls-U_LfYV61.js +27 -0
  105. package/dist/urls-U_LfYV61.js.map +1 -0
  106. package/dist/version-BxH7OuWD.js +20 -0
  107. package/dist/version-BxH7OuWD.js.map +1 -0
  108. package/dist/web/assets/_agentId-DonOCOlC.js +1 -0
  109. package/dist/web/assets/_app-B7t5lEia.js +1 -0
  110. package/dist/web/assets/_app-DMTGqYpM.js +65 -0
  111. package/dist/web/assets/_connectionId-DR5vFXOg.js +1 -0
  112. package/dist/web/assets/_webhookId-LfUlsULp.js +1 -0
  113. package/dist/web/assets/account-status-CEszs13C.js +1 -0
  114. package/dist/web/assets/accounts-5m7aiXuZ.js +1 -0
  115. package/dist/web/assets/accounts-list-YfJzThZa.js +1 -0
  116. package/dist/web/assets/activity-DOIe7SAg.js +1 -0
  117. package/dist/web/assets/add-connection-C8JR-13R.js +1 -0
  118. package/dist/web/assets/agent-create-form-CPxnPYH4.js +1 -0
  119. package/dist/web/assets/agents-B2Qj5KxT.js +1 -0
  120. package/dist/web/assets/approvals-BGaVaoFy.js +1 -0
  121. package/dist/web/assets/approve._id-BLrQnzPM.js +1 -0
  122. package/dist/web/assets/arrow-left-DZVAXoKj.js +1 -0
  123. package/dist/web/assets/arrow-right-C2zcqRr2.js +1 -0
  124. package/dist/web/assets/attention-gO9Nw5uW.js +1 -0
  125. package/dist/web/assets/audit-BPXXre8S.js +1 -0
  126. package/dist/web/assets/audit-bits-CGyIprzK.js +1 -0
  127. package/dist/web/assets/bell-ring-ig3zn1iS.js +1 -0
  128. package/dist/web/assets/bot-Zk76q_39.js +1 -0
  129. package/dist/web/assets/calendar-notice-DsCfq3VJ.js +1 -0
  130. package/dist/web/assets/calendar-plus-Cycfkk0y.js +1 -0
  131. package/dist/web/assets/calendar-setup-Pn61Wj1n.js +2 -0
  132. package/dist/web/assets/card-GSO5o-Ug.js +1 -0
  133. package/dist/web/assets/check-check-Ds1bPIGv.js +1 -0
  134. package/dist/web/assets/checkbox-B937U-Fd.js +1 -0
  135. package/dist/web/assets/chevron-right-Cqh4mDk1.js +1 -0
  136. package/dist/web/assets/chips-input-2xWDofmE.js +1 -0
  137. package/dist/web/assets/choice-cards-CgAIqBGX.js +1 -0
  138. package/dist/web/assets/circle-x-DcU-0zVh.js +1 -0
  139. package/dist/web/assets/command-khhto70y.js +1 -0
  140. package/dist/web/assets/common-BPZV8TFb.js +1 -0
  141. package/dist/web/assets/connect-agent-guide-CJdw31p2.js +1 -0
  142. package/dist/web/assets/connect-host-lr2c3xWh.js +6 -0
  143. package/dist/web/assets/connection-row-DYx_5o0c.js +1 -0
  144. package/dist/web/assets/connections-C4NOFb5R.js +1 -0
  145. package/dist/web/assets/data-table-kW1pkRB5.js +1 -0
  146. package/dist/web/assets/empty-DzTDioBP.js +1 -0
  147. package/dist/web/assets/events-C9zJnPKK.js +1 -0
  148. package/dist/web/assets/eye-B9gT1QSq.js +1 -0
  149. package/dist/web/assets/eye-off-Diktqz_g.js +1 -0
  150. package/dist/web/assets/field-C6ejurju.js +1 -0
  151. package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  152. package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  153. package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  154. package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  155. package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  156. package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  157. package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  158. package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  159. package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  160. package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  161. package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  162. package/dist/web/assets/get-started-C38bq1gZ.js +2 -0
  163. package/dist/web/assets/hidden-chars-Dr9TxfvF.js +1 -0
  164. package/dist/web/assets/index-DGzo3kGh.js +11 -0
  165. package/dist/web/assets/index-zKOCQLGX.css +2 -0
  166. package/dist/web/assets/input-CWwJgozn.js +1 -0
  167. package/dist/web/assets/input-group-HG8OXcJ4.js +1 -0
  168. package/dist/web/assets/label-multi-select-sH8mllw8.js +1 -0
  169. package/dist/web/assets/labels-B5UqVwFo.js +1 -0
  170. package/dist/web/assets/laptop-BxJ4Nbj7.js +1 -0
  171. package/dist/web/assets/last-call-D-O5O94z.js +1 -0
  172. package/dist/web/assets/listener-handled-HNCuVrQ7.js +1 -0
  173. package/dist/web/assets/login-DaeKclcf.js +1 -0
  174. package/dist/web/assets/mail-C5fm2pTC.js +1 -0
  175. package/dist/web/assets/mcp-call-UoOTPFyh.js +1 -0
  176. package/dist/web/assets/mcp-call-card-Cr-OEDX2.js +3 -0
  177. package/dist/web/assets/message-square-quote-se8Bf3RP.js +1 -0
  178. package/dist/web/assets/mutations-CLPqJ6cj.js +1 -0
  179. package/dist/web/assets/network-igNw0VVx.js +1 -0
  180. package/dist/web/assets/pairing-XjuaVr2u.js +1 -0
  181. package/dist/web/assets/pairing-notifier-KPzOEZSO.js +1 -0
  182. package/dist/web/assets/paperclip-znS4iTrg.js +1 -0
  183. package/dist/web/assets/password-input-DV3aqcNf.js +1 -0
  184. package/dist/web/assets/pause-o-dK3khK.js +1 -0
  185. package/dist/web/assets/pencil-DkPFAhEq.js +1 -0
  186. package/dist/web/assets/play-DvCHND93.js +1 -0
  187. package/dist/web/assets/plug-CXAniEiR.js +1 -0
  188. package/dist/web/assets/plug-zap-BwR-l5wb.js +1 -0
  189. package/dist/web/assets/plus-B_TUslu3.js +1 -0
  190. package/dist/web/assets/preload-helper-Cc_aKyUb.js +1 -0
  191. package/dist/web/assets/public-url-rF2Xjyel.js +1 -0
  192. package/dist/web/assets/queries-Cv3nXx0U.js +42 -0
  193. package/dist/web/assets/refresh-cw-Ch5FNrby.js +1 -0
  194. package/dist/web/assets/revealed-keys-C_9NtJPY.js +1 -0
  195. package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  196. package/dist/web/assets/rotate-ccw-B-mzPDk0.js +1 -0
  197. package/dist/web/assets/search-CTVKGomS.js +1 -0
  198. package/dist/web/assets/select-Bb806bpq.js +1 -0
  199. package/dist/web/assets/send-DuMVuYs1.js +1 -0
  200. package/dist/web/assets/settings-BWauhfFf.js +1 -0
  201. package/dist/web/assets/setup-B7bNKQOp.js +1 -0
  202. package/dist/web/assets/sheet-CYPwpUsH.js +1 -0
  203. package/dist/web/assets/shield-alert-CSYB-ThV.js +1 -0
  204. package/dist/web/assets/shield-check-BulpsYqK.js +1 -0
  205. package/dist/web/assets/sparkles-CUTiob4K.js +1 -0
  206. package/dist/web/assets/stamp-BNXUGNa3.js +1 -0
  207. package/dist/web/assets/step-url-51aMNak-.js +1 -0
  208. package/dist/web/assets/stream-Du7fY5_Y.js +1 -0
  209. package/dist/web/assets/tag-I5_-1jFL.js +1 -0
  210. package/dist/web/assets/terminal-BvxDFTJc.js +1 -0
  211. package/dist/web/assets/test-email-button-DYi7V_6X.js +1 -0
  212. package/dist/web/assets/toggle-group-Bdo1gmQ1.js +1 -0
  213. package/dist/web/assets/trash-Ci0aICEl.js +1 -0
  214. package/dist/web/assets/use-delivery-speed-BBh7W2q6.js +1 -0
  215. package/dist/web/assets/use-label-names-BXicesnP.js +1 -0
  216. package/dist/web/assets/use-sign-out-CPrY_oVO.js +1 -0
  217. package/dist/web/assets/useInfiniteQuery-DJLIM8yJ.js +1 -0
  218. package/dist/web/assets/useQuery-MrTwwNy5.js +1 -0
  219. package/dist/web/assets/useRouterState-D4OBK8l5.js +1 -0
  220. package/dist/web/assets/webhook-DjeeZiNC.js +1 -0
  221. package/dist/web/assets/webhook-bits-jw-y2D3u.js +1 -0
  222. package/dist/web/assets/webhook-sheet-B8h0skDe.js +34 -0
  223. package/dist/web/assets/webhooks-Cfsdpoyd.js +1 -0
  224. package/dist/web/assets/x-MF2TZ9aG.js +1 -0
  225. package/dist/web/favicon.svg +1 -0
  226. package/dist/web/index.html +27 -0
  227. package/package.json +98 -1
@@ -0,0 +1 @@
1
+ import{A as e,D as t,Ht as n,M as r,N as i,T as a,Ut as o,bt as s,ft as c,gt as l,h as u,n as d,s as f,t as p,w as m,yt as h}from"./queries-Cv3nXx0U.js";import{t as g}from"./useQuery-MrTwwNy5.js";import{n as _}from"./x-MF2TZ9aG.js";import{t as v}from"./arrow-left-DZVAXoKj.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./card-GSO5o-Ug.js";import{F as T,I as E,L as D,d as O,f as k,o as A,s as j}from"./common-BPZV8TFb.js";import{t as M}from"./trash-Ci0aICEl.js";import{t as N}from"./network-igNw0VVx.js";import{t as P}from"./pause-o-dK3khK.js";import{t as F}from"./refresh-cw-Ch5FNrby.js";import{i as I,r as L}from"./connection-row-DYx_5o0c.js";import{Tt as R,kt as z,r as B}from"./index-DGzo3kGh.js";import{n as V,r as H,t as U}from"./hidden-chars-Dr9TxfvF.js";var W=o();function G(){let{connectionId:a}=B.useParams(),o=s(),c=g(d.connection(a)),l=g(d.heldTools(a)),y=T(6e4),{askDisable:b,askRemove:x}=L(),{reconnect:C,dialog:V}=I(),H=n(),U=_({mutationFn:()=>t(`/api/connections/${encodeURIComponent(a)}/refresh`,{method:`POST`}),onSuccess:e=>{e.ok?r.success(`Tools refreshed`):r.error(`Couldn't list the tools`,{description:e.error??void 0}),H.invalidateQueries({queryKey:p.connection(a)}),H.invalidateQueries({queryKey:p.connections})},onError:t=>e(t,`Couldn't refresh the tools`)});if(c.isPending)return(0,W.jsx)(E,{className:`h-64 rounded-xl`});if(c.isError)return(0,W.jsx)(j,{error:c.error,onRetry:()=>void c.refetch()});let G=c.data,q=f(G,y);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(i,{variant:`ghost`,size:`sm`,className:`-ml-2 self-start`,asChild:!0,children:(0,W.jsxs)(h,{to:`/connections`,children:[(0,W.jsx)(v,{}),` Connections`]})}),(0,W.jsx)(A,{title:(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[G.name,` `,(0,W.jsx)(k,{tone:q.tone,children:q.label}),G.privateTarget&&(0,W.jsxs)(D,{variant:`outline`,children:[(0,W.jsx)(N,{}),` Private network: `,u(G.privateTarget)]})]}),description:q.description,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(i,{variant:q.action===`reconnect`?`default`:`outline`,onClick:()=>C(G),children:[(0,W.jsx)(R,{}),` Reconnect`]}),G.status!==`disabled`&&(0,W.jsxs)(i,{variant:`outline`,disabled:U.isPending,onClick:()=>U.mutate(),children:[U.isPending?(0,W.jsx)(m,{}):(0,W.jsx)(F,{}),` Refresh tools`]}),G.status!==`disabled`&&(0,W.jsxs)(i,{variant:`outline`,onClick:()=>b(G),children:[(0,W.jsx)(P,{}),` Disable`]}),(0,W.jsxs)(i,{variant:`outline`,className:`text-critical`,onClick:()=>x(G,()=>void o({to:`/connections`})),children:[(0,W.jsx)(M,{}),` Remove`]})]})}),V,(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-sm text-muted-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Tools as `,(0,W.jsxs)(`code`,{className:`font-mono text-foreground`,children:[G.slug,`__…`]})]}),(0,W.jsxs)(`span`,{children:[G.tools.active,` tool`,G.tools.active===1?``:`s`]}),(0,W.jsxs)(`span`,{children:[G.agents,` agent`,G.agents===1?``:`s`]}),G.url&&(0,W.jsx)(`span`,{className:`break-all`,children:G.url}),(0,W.jsxs)(`span`,{children:[`Connected `,(0,W.jsx)(O,{date:G.createdAt})]})]}),(0,W.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`held-heading`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{id:`held-heading`,className:`text-lg font-semibold tracking-tight`,children:`Changed tools`}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`xaq pinned every tool when you connected. A tool whose definition changes, or a new one, is held: agents can't call it until you accept. The other tools keep working.`})]}),l.isPending?(0,W.jsx)(E,{className:`h-32 rounded-xl`}):l.isError?(0,W.jsx)(j,{error:l.error,onRetry:()=>void l.refetch()}):l.data.length===0?(0,W.jsx)(w,{children:(0,W.jsxs)(S,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,W.jsx)(z,{className:`size-4 text-success`}),` No changes. Every tool matches what was pinned.`]})}):l.data.map(e=>(0,W.jsx)(K,{connectionId:G.id,connectionName:G.name,tool:e},e.name))]})]})}function K({connectionId:o,connectionName:s,tool:c}){let u=n(),d=_({mutationFn:()=>t(`/api/connections/${encodeURIComponent(o)}/held/${encodeURIComponent(c.name)}/accept`,{body:{candidateHash:c.candidateHash}}),onSuccess:()=>r.success(`${c.name} is accepted`,{description:`Agents can call it again.`}),onError:t=>{t instanceof a&&t.status===409?r.warning(`${c.name} changed again`,{description:`Here's its newest version. Review it before accepting.`}):e(t,`Couldn't accept the change`)},onSettled:()=>{for(let e of[p.connections,p.overview])u.invalidateQueries({queryKey:e})}}),f=H(c.candidate.description,c.candidate.title,JSON.stringify(c.candidate.inputSchema));return(0,W.jsxs)(w,{children:[(0,W.jsxs)(x,{children:[(0,W.jsxs)(C,{className:`flex flex-wrap items-center gap-2 font-mono text-base`,children:[c.name,(0,W.jsx)(D,{variant:`secondary`,children:c.heldReason===`new`?`New tool`:`Changed`})]}),(0,W.jsxs)(b,{children:[c.heldReason===`new`?`${s} added this tool after you connected.`:`${s} changed this tool's definition.`,` Noticed`,` `,(0,W.jsx)(O,{date:c.updatedAt}),`. Agents see it as `,(0,W.jsx)(`code`,{className:`font-mono`,children:c.exposedName}),`.`]})]}),(0,W.jsxs)(S,{className:`space-y-2`,children:[f&&(0,W.jsx)(U,{what:`This definition`}),(0,W.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:c.pinned?`Before (−) and after (+): description, arguments and the rest`:`The new definition`}),(0,W.jsx)(q,{lines:c.diff})]}),(0,W.jsx)(y,{className:`justify-end border-t`,children:(0,W.jsxs)(i,{disabled:d.isPending,onClick:()=>d.mutate(),children:[d.isPending?(0,W.jsx)(m,{}):(0,W.jsx)(l,{}),` Accept`]})})]})}function q({lines:e}){return e.length?(0,W.jsx)(`pre`,{className:`max-h-[70svh] overflow-y-auto rounded-md border bg-muted/30 py-2 font-mono text-xs leading-relaxed break-words whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.map((e,t)=>(0,W.jsxs)(`div`,{className:c(`px-3`,e.op===`+`&&`bg-success/10 text-foreground`,e.op===`-`&&`bg-critical/10 text-muted-foreground line-through`),children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`mr-2 inline-block w-3 select-none`,children:e.op===`-`?`−`:e.op}),(0,W.jsx)(`span`,{className:`sr-only`,children:e.op===`+`?`Added: `:e.op===`-`?`Removed: `:``}),(0,W.jsx)(V,{text:e.text})]},t))}):(0,W.jsx)(`div`,{className:`rounded-md border bg-muted/30 px-3 py-2 text-xs text-muted-foreground italic`,children:`(empty)`})}export{G as component};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,Ht as n,N as r,Ut as i,Wt as a,bt as o,ft as s,n as c,t as l,w as u,yt as d}from"./queries-Cv3nXx0U.js";import{t as f}from"./useQuery-MrTwwNy5.js";import{t as p}from"./useInfiniteQuery-DJLIM8yJ.js";import{n as m,t as h}from"./data-table-kW1pkRB5.js";import{t as g}from"./arrow-left-DZVAXoKj.js";import{t as ee}from"./bot-Zk76q_39.js";import{i as _,n as v,o as y,s as b,t as x}from"./select-Bb806bpq.js";import{i as te}from"./label-multi-select-sH8mllw8.js";import{i as S,o as C,r as w,s as T,t as E}from"./card-GSO5o-Ug.js";import{C as D,I as O,L as ne,d as k,i as A,r as j,s as M,w as N}from"./common-BPZV8TFb.js";import{n as re,t as ie}from"./trash-Ci0aICEl.js";import{n as P,t as ae}from"./send-DuMVuYs1.js";import{t as oe}from"./pencil-DkPFAhEq.js";import{t as se}from"./rotate-ccw-B-mzPDk0.js";import{l as ce}from"./field-C6ejurju.js";import{n as F}from"./chips-input-2xWDofmE.js";import{ct as I,dt as L,ft as R,it as z,lt as B,t as V,ut as H}from"./index-DGzo3kGh.js";import{t as U}from"./mutations-CLPqJ6cj.js";import{i as W,n as G,o as le,r as ue,t as de}from"./empty-DzTDioBP.js";import{c as K}from"./labels-B5UqVwFo.js";import{i as q,r as fe,t as J}from"./webhook-bits-jw-y2D3u.js";import{n as pe}from"./use-label-names-BXicesnP.js";import{i as me,n as he,r as ge,t as _e}from"./webhook-sheet-B8h0skDe.js";var Y=e(a(),1),X=i(),Z=m();function Q(){return U({mutationFn:e=>t(`/api/deliveries/${encodeURIComponent(e.id)}/replay`,{method:`POST`}),invalidate:[l.deliveries,l.webhooks],success:e=>e.status===`succeeded`?`Replayed: delivered`:e.status===`pending`?`Replay queued`:`Replay ${K[e.status].label.toLowerCase()}`,errorTitle:`Couldn't replay`})}function $({delivery:e}){return(0,X.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,X.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivery`}),(0,X.jsx)(`dd`,{className:`font-mono break-all`,children:e.id}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Event`}),(0,X.jsxs)(`dd`,{className:`font-mono break-all`,children:[e.eventId,` · `,e.eventType]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`First attempt`}),(0,X.jsx)(`dd`,{children:D(e.createdAt)}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last update`}),(0,X.jsx)(`dd`,{children:D(e.updatedAt)}),e.nextAttemptAt&&e.status===`pending`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next retry`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(k,{date:e.nextAttemptAt})})]})]}),e.lastError&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Error`}),(0,X.jsx)(`pre`,{className:`rounded-md border border-critical/30 bg-critical/5 p-2 font-mono text-xs whitespace-pre-wrap break-words`,children:e.lastError})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:[`Response body `,e.lastStatusCode!=null&&`(HTTP ${e.lastStatusCode})`]}),e.lastResponse?(0,X.jsx)(`pre`,{className:`max-h-60 overflow-auto rounded-md border bg-background p-2 font-mono text-xs whitespace-pre-wrap break-words`,children:e.lastResponse}):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Empty`})]})]})}function ve({delivery:e}){let t=Q();return(0,X.jsxs)(r,{variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(e),children:[t.isPending?(0,X.jsx)(u,{}):(0,X.jsx)(se,{}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:`Replay`})]})}var ye=[Z.accessor(`status`,{header:`Status`,cell:e=>(0,X.jsx)(J,{status:e.getValue()})}),Z.accessor(`eventType`,{header:`Event`,cell:e=>(0,X.jsx)(`code`,{className:`font-mono text-xs`,children:e.getValue()}),meta:{className:`hidden md:table-cell`}}),Z.accessor(`lastStatusCode`,{header:`Code`,cell:e=>(0,X.jsx)(`span`,{className:s(`font-mono tabular`,q(e.getValue())),children:e.getValue()??`—`})}),Z.accessor(`attempts`,{header:`Attempts`,cell:e=>(0,X.jsx)(`span`,{className:`tabular`,children:e.getValue()}),meta:{className:`hidden text-right sm:table-cell`}}),Z.accessor(`durationMs`,{header:`Duration`,cell:e=>(0,X.jsx)(`span`,{className:`text-muted-foreground tabular`,children:N(e.getValue())}),meta:{className:`hidden text-right sm:table-cell`}}),Z.accessor(`updatedAt`,{header:`When`,cell:e=>(0,X.jsx)(k,{date:e.getValue(),className:`text-xs`})}),Z.display({id:`replay`,header:()=>(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`}),cell:e=>(0,X.jsx)(ve,{delivery:e.row.original}),meta:{className:`w-0 text-right`}})];function be({webhookId:e}){let[t,n]=(0,Y.useState)(),i=p(c.deliveries(e,t)),a=i.data?.pages.flatMap(e=>e.items)??[];return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:`Delivery log`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every attempt to deliver an event, newest first. Click a row for the response.`})]}),(0,X.jsxs)(x,{value:t??`all`,onValueChange:e=>n(e===`all`?void 0:e),children:[(0,X.jsx)(y,{className:`w-40`,"aria-label":`Status`,children:(0,X.jsx)(b,{})}),(0,X.jsxs)(v,{children:[(0,X.jsx)(_,{value:`all`,children:`All statuses`}),Object.keys(K).map(e=>(0,X.jsx)(_,{value:e,children:K[e].label},e))]})]})]}),i.isPending?(0,X.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,X.jsx)(O,{className:`h-10`},e))}):i.isError?(0,X.jsx)(M,{error:i.error,onRetry:()=>void i.refetch()}):(0,X.jsx)(h,{columns:ye,data:a,getRowId:e=>e.id,rowClassName:e=>e.status===`dead`||e.status===`failed`?`bg-critical/5`:void 0,renderExpanded:e=>(0,X.jsx)($,{delivery:e}),empty:t?(0,X.jsxs)(X.Fragment,{children:[`No `,K[t].label.toLowerCase(),` deliveries.`]}):(0,X.jsxs)(X.Fragment,{children:[`No deliveries yet. Use `,(0,X.jsx)(ne,{variant:`outline`,children:`Send test`}),` to try the endpoint now.`]})}),i.hasNextPage&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsxs)(r,{variant:`outline`,onClick:()=>void i.fetchNextPage(),disabled:i.isFetchingNextPage,children:[i.isFetchingNextPage&&(0,X.jsx)(u,{}),` Load older deliveries`]})})]})}function xe({webhookId:e}){let i=n(),[a,o]=(0,Y.useState)(),[c,d]=(0,Y.useState)(),[f,p]=(0,Y.useState)(!1),m=async()=>{p(!0),d(void 0);try{o(await t(`/api/webhooks/${encodeURIComponent(e)}/test`,{method:`POST`})),i.invalidateQueries({queryKey:l.deliveries}),i.invalidateQueries({queryKey:l.webhooks})}catch(e){o(void 0),d(e)}finally{p(!1)}},h=a?.status===`succeeded`;return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsxs)(r,{variant:`outline`,onClick:m,disabled:f,children:[f?(0,X.jsx)(u,{}):(0,X.jsx)(ae,{}),` Send test event`]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Delivers a sample message.received payload, signed like the real thing.`})]}),c!==void 0&&(0,X.jsx)(A,{error:c,title:`Couldn't send the test`}),a&&(0,X.jsxs)(`div`,{className:s(`space-y-3 rounded-lg border p-3`,h?`border-success/30 bg-success/5`:`border-critical/30 bg-critical/5`),children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[(0,X.jsx)(J,{status:a.status}),(0,X.jsx)(`span`,{className:s(`font-mono`,q(a.lastStatusCode)),children:a.lastStatusCode==null?`No response`:`HTTP ${a.lastStatusCode}`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:N(a.durationMs)}),(0,X.jsx)(`span`,{className:`font-medium`,children:h?`Your endpoint accepted it.`:`Your endpoint didn't accept it.`})]}),(0,X.jsx)($,{delivery:a})]})]})}function Se(){let{webhookId:e}=V.useParams(),t=f(c.webhooks()),n=t.data?.find(t=>t.id===e);return t.isPending?(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(O,{className:`h-16 w-80`}),(0,X.jsx)(O,{className:`h-48 rounded-xl`})]}):t.isError?(0,X.jsx)(M,{error:t.error,onRetry:()=>void t.refetch()}):n?(0,X.jsx)(Ce,{webhook:n}):(0,X.jsx)(E,{children:(0,X.jsxs)(de,{children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(le,{children:`Webhook not found`}),(0,X.jsx)(ue,{children:`It may have been deleted.`})]}),(0,X.jsx)(G,{children:(0,X.jsx)(r,{asChild:!0,children:(0,X.jsx)(d,{to:`/webhooks`,children:`All webhooks`})})})]})})}function Ce({webhook:e}){let n=o(),i=f(c.agents()),a=f(c.accounts()),s=pe(a.data??[]),u=te(e.filter.calendarIds?.length?e.filter.accountIds??(a.data??[]).map(e=>e.id):[]),[p,m]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(),v=i.data?.find(t=>t.id===e.agentId),y=`/api/webhooks/${encodeURIComponent(e.id)}`,b=U({mutationFn:e=>t(y,{method:`PATCH`,body:{enabled:e}}),invalidate:[l.webhooks],success:(e,t)=>t?`Webhook enabled`:`Webhook paused`,errorTitle:`Couldn't update the webhook`}),x=U({mutationFn:()=>t(`${y}/rotate-secret`,{method:`POST`}),invalidate:[l.webhooks],errorTitle:!1,onSuccess:e=>_(e.secret)}),D=U({mutationFn:()=>t(y,{method:`DELETE`}),invalidate:[l.webhooks],success:`Webhook "${e.name}" deleted`,errorTitle:!1,onSuccess:()=>void n({to:`/webhooks`})});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(r,{variant:`ghost`,size:`sm`,asChild:!0,className:`-ml-2 text-muted-foreground`,children:(0,X.jsxs)(d,{to:`/webhooks`,children:[(0,X.jsx)(g,{}),` Webhooks`]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,X.jsx)(`h1`,{className:`truncate text-2xl font-semibold tracking-tight`,children:e.name}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[v&&(0,X.jsxs)(d,{to:`/agents/$agentId`,params:{agentId:v.id},className:`flex items-center gap-1 hover:text-foreground hover:underline`,children:[(0,X.jsx)(ee,{className:`size-3.5`}),` `,v.name]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1 font-mono`,children:[(0,X.jsx)(P,{className:`size-3.5`}),` `,e.secretPrefix,`…`]}),(0,X.jsxs)(`span`,{children:[`Created `,(0,X.jsx)(k,{date:e.createdAt})]})]}),(0,X.jsx)(fe,{webhook:e,className:`pt-1`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(F,{id:`wh-enabled`,checked:e.enabled,disabled:b.isPending,onCheckedChange:e=>b.mutate(e)}),(0,X.jsx)(ce,{htmlFor:`wh-enabled`,children:e.enabled?`Enabled`:`Paused`})]}),(0,X.jsxs)(r,{variant:`outline`,onClick:()=>m(!0),children:[(0,X.jsx)(oe,{}),` Edit`]}),(0,X.jsxs)(I,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsx)(r,{variant:`outline`,size:`icon`,"aria-label":`Webhook actions`,children:(0,X.jsx)(re,{})})}),(0,X.jsxs)(B,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(H,{onSelect:()=>z({title:`Rotate the signing secret?`,description:`A new secret is created and signatures made with the old one stop verifying. Update your receiver right after.`,confirmLabel:`Rotate secret`,onConfirm:()=>x.mutateAsync()}),children:[(0,X.jsx)(P,{}),` Rotate secret…`]}),(0,X.jsx)(L,{}),(0,X.jsxs)(H,{variant:`destructive`,onSelect:()=>z({title:`Delete ${e.name}?`,description:`Pending retries are cancelled and the delivery log is removed. This can't be undone.`,confirmLabel:`Delete webhook`,destructive:!0,onConfirm:()=>D.mutateAsync()}),children:[(0,X.jsx)(ie,{}),` Delete webhook…`]})]})]})]})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,X.jsxs)(E,{children:[(0,X.jsxs)(C,{children:[(0,X.jsx)(T,{children:`What it sends`}),(0,X.jsx)(S,{children:`POSTs JSON to:`})]}),(0,X.jsxs)(w,{className:`space-y-3`,children:[(0,X.jsx)(j,{value:e.url}),(0,X.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:he(e,a.data??[],s,u).map(e=>(0,X.jsx)(`li`,{children:e},e))})]})]}),(0,X.jsxs)(E,{children:[(0,X.jsxs)(C,{children:[(0,X.jsx)(T,{children:`Test it`}),(0,X.jsx)(S,{children:`Check your endpoint is reachable and verifies the signature.`})]}),(0,X.jsx)(w,{children:(0,X.jsx)(xe,{webhookId:e.id})})]})]}),(0,X.jsx)(be,{webhookId:e.id}),(0,X.jsxs)(E,{children:[(0,X.jsx)(C,{children:(0,X.jsx)(T,{children:`Verifying signatures`})}),(0,X.jsx)(w,{children:(0,X.jsx)(me,{})})]}),(0,X.jsx)(_e,{open:p,onOpenChange:m,webhook:e}),(0,X.jsx)(ge,{secret:h,title:`New signing secret`,description:`The old secret no longer verifies. Update your receiver with this one.`,onClose:()=>_(void 0)})]})}export{Se as component};
@@ -0,0 +1 @@
1
+ import{Ut as e}from"./queries-Cv3nXx0U.js";import{f as t}from"./common-BPZV8TFb.js";import{nt as n,rt as r,tt as i}from"./index-DGzo3kGh.js";import{t as a}from"./labels-B5UqVwFo.js";var o=e();function s({status:e}){let s=a[e];return(0,o.jsxs)(i,{children:[(0,o.jsx)(r,{asChild:!0,children:(0,o.jsx)(`span`,{tabIndex:0,className:`rounded-4xl outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(t,{tone:s.tone,children:s.label})})}),(0,o.jsx)(n,{children:s.description})]})}function c({view:e}){return(0,o.jsxs)(i,{children:[(0,o.jsx)(r,{asChild:!0,children:(0,o.jsx)(`span`,{tabIndex:0,className:`rounded-4xl outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(t,{tone:e.tone,children:e.label})})}),(0,o.jsx)(n,{className:`max-w-xs`,children:e.description})]})}function l({email:e,className:t}){return(0,o.jsx)(`span`,{"aria-hidden":!0,className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-medium uppercase ${t??``}`,children:e.slice(0,1)})}export{s as n,c as r,l as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ht as t,M as n,Ut as r,Wt as i,bt as a,n as o,t as s}from"./queries-Cv3nXx0U.js";import{t as c}from"./useQuery-MrTwwNy5.js";import{c as l,l as u,u as d}from"./card-GSO5o-Ug.js";import{o as f}from"./common-BPZV8TFb.js";import{n as p,t as m}from"./accounts-list-YfJzThZa.js";import{Ot as h,Q as g}from"./index-DGzo3kGh.js";import{t as _}from"./calendar-notice-DsCfq3VJ.js";import{o as v}from"./public-url-rF2Xjyel.js";var y=e(i()),b=r();function x(){let{connected:e,error:r}=g.useSearch(),i=a({from:g.fullPath}),o=t();return(0,y.useEffect)(()=>{(e||r)&&(e&&n.success(`${e} is connected`,{description:`Mail starts syncing now.`}),r&&n.error(`Couldn't connect the account`,{description:`Google sign-in didn't complete. Try connecting the account again.`,duration:1e4}),o.invalidateQueries({queryKey:s.accounts}),i({search:{},replace:!0}))},[e,r,i,o]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f,{title:`Gmail accounts`,description:`Mailboxes (and their Google Calendars, once added) xaq syncs. Credentials stay here; agents get access per account through grants.`,actions:(0,b.jsx)(p,{})}),(0,b.jsx)(S,{}),(0,b.jsx)(_,{}),(0,b.jsx)(m,{})]})}function S(){let e=c(o.settings()),t=window.location.origin,n=e.data?v(t,e.data.publicUrl):null;return n?(0,b.jsxs)(l,{variant:`info`,className:`mb-4`,children:[(0,b.jsx)(h,{}),(0,b.jsxs)(d,{children:[`Google sign-in returns to `,n]}),(0,b.jsx)(u,{children:(0,b.jsxs)(`p`,{children:[`You opened the console at `,t,`, and its saved address is `,n,`. Both reach xaq on this computer and connecting works from either. For the smoothest sign-in, open the console at`,` `,(0,b.jsx)(`a`,{href:`${n}/accounts`,className:`font-medium text-foreground underline underline-offset-4`,children:n}),` `,`(you may need to sign in there once).`]})})]}):null}export{x as component};
@@ -0,0 +1 @@
1
+ import{D as e,N as t,Ut as n,_t as r,n as i,t as a,yt as o}from"./queries-Cv3nXx0U.js";import{t as s}from"./useQuery-MrTwwNy5.js";import{t as c}from"./bot-Zk76q_39.js";import{t as l}from"./calendar-plus-Cycfkk0y.js";import{t as u}from"./card-GSO5o-Ug.js";import{F as d,I as f,d as p,s as m}from"./common-BPZV8TFb.js";import{n as h,t as g}from"./trash-Ci0aICEl.js";import{n as _}from"./connect-host-lr2c3xWh.js";import{t as v}from"./pause-o-dK3khK.js";import{t as y}from"./play-DvCHND93.js";import{t as b}from"./refresh-cw-Ch5FNrby.js";import{Et as x,Tt as S,b as C,ct as w,dt as T,ft as E,it as D,lt as O,ut as k}from"./index-DGzo3kGh.js";import{t as A}from"./mutations-CLPqJ6cj.js";import{a as j,i as M,r as N}from"./calendar-setup-Pn61Wj1n.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./empty-DzTDioBP.js";import{n as B,r as V,t as H}from"./account-status-CEszs13C.js";var U={name:`mail-plus`,size:24,node:[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]};U.node;var W=r(U),G=[a.accounts,a.setupState,a.overview,a.agents],K=(e,t=``)=>`/api/accounts/${encodeURIComponent(e)}${t}`;function q(){return{resync:A({mutationFn:t=>e(K(t.id,`/resync`),{method:`POST`}),invalidate:G,success:(e,t)=>`Resync started for ${t.email}`,errorTitle:`Couldn't resync`}),pause:A({mutationFn:t=>e(K(t.id,`/pause`),{method:`POST`}),invalidate:G,success:(e,t)=>`${t.email} paused`,errorTitle:`Couldn't pause`}),resume:A({mutationFn:t=>e(K(t.id,`/resume`),{method:`POST`}),invalidate:G,success:(e,t)=>`${t.email} resumed`,errorTitle:`Couldn't resume`}),remove:A({mutationFn:t=>e(K(t.id),{method:`DELETE`}),invalidate:G,success:(e,t)=>`${t.email} removed`,errorTitle:!1})}}var J=n();function Y({account:e,showWatch:n}){let{resync:r,pause:a,resume:u,remove:f}=q(),m=()=>_({reauthAccountId:e.id,email:e.email}),C=d(6e4),A=e.watchExpiresAt?new Date(e.watchExpiresAt).getTime()-C:null,j=A!==null&&A<432e5,P=s(i.agents()),F=(P.data??[]).filter(t=>t.grants.some(t=>t.accountId===e.id)),I=e.status===`active`,L=X(e),R=()=>N(e);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,J.jsx)(H,{email:e.email}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.email}),(0,J.jsx)(B,{status:e.status}),L&&(0,J.jsx)(V,{view:L})]}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-muted-foreground`,children:[e.displayName&&(0,J.jsx)(`span`,{className:`truncate`,children:e.displayName}),(0,J.jsxs)(`span`,{children:[`Last sync `,(0,J.jsx)(p,{date:e.lastSyncAt,fallback:`never`})]}),n&&I&&(0,J.jsxs)(`span`,{className:j?`text-warning`:void 0,children:[`Gmail watch `,A===null?``:A<0?`expired `:`renews `,(0,J.jsx)(p,{date:e.watchExpiresAt,fallback:`not set`})]}),(0,J.jsxs)(`span`,{children:[`Connected `,(0,J.jsx)(p,{date:e.createdAt})]})]}),P.isSuccess&&(0,J.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(c,{className:`size-3.5 shrink-0`}),F.length?(0,J.jsx)(`span`,{className:`truncate`,children:F.map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0&&`, `,(0,J.jsx)(o,{to:`/agents/$agentId`,params:{agentId:e.id},className:`text-foreground hover:underline`,children:e.name})]},e.id))}):(0,J.jsx)(`span`,{children:`No agent has access yet`})]}),L?.tone===`bad`&&(0,J.jsxs)(`p`,{className:`mt-2 flex max-w-3xl items-start gap-1.5 rounded-md bg-critical/[0.06] px-2.5 py-1.5 text-xs text-foreground/90`,children:[(0,J.jsx)(x,{className:`mt-px size-3.5 shrink-0 text-critical`}),(0,J.jsx)(`span`,{className:`break-words`,children:L.description})]}),e.lastError&&(0,J.jsxs)(`p`,{className:`mt-2 flex max-w-3xl items-start gap-1.5 rounded-md bg-critical/[0.06] px-2.5 py-1.5 text-xs text-foreground/90`,children:[(0,J.jsx)(x,{className:`mt-px size-3.5 shrink-0 text-critical`}),(0,J.jsx)(`span`,{className:`break-words`,children:e.lastError})]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end sm:self-center`,children:[e.status===`needs_reauth`&&(0,J.jsxs)(t,{size:`sm`,onClick:m,children:[(0,J.jsx)(S,{}),` Reconnect`]}),L?.fix===`consent`&&L.tone===`warn`&&e.status!==`needs_reauth`&&(0,J.jsxs)(t,{size:`sm`,variant:`outline`,onClick:R,children:[(0,J.jsx)(l,{}),` Add Calendar`]}),L?.fix===`enable_api`&&(0,J.jsx)(t,{size:`sm`,variant:`outline`,onClick:()=>M(`api`),children:`Turn on Calendar API`}),e.status===`paused`&&(0,J.jsxs)(t,{size:`sm`,variant:`outline`,disabled:u.isPending,onClick:()=>u.mutate(e),children:[(0,J.jsx)(y,{}),` Resume`]}),(0,J.jsxs)(w,{children:[(0,J.jsx)(E,{asChild:!0,children:(0,J.jsx)(t,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${e.email}`,children:(0,J.jsx)(h,{})})}),(0,J.jsxs)(O,{align:`end`,className:`w-48`,children:[(0,J.jsxs)(k,{onSelect:m,children:[(0,J.jsx)(S,{}),` Reconnect`]}),L?.fix===`consent`&&(0,J.jsxs)(k,{onSelect:R,children:[(0,J.jsx)(l,{}),` Add Google Calendar`]}),(0,J.jsxs)(k,{disabled:e.status===`paused`,onSelect:()=>r.mutate(e),children:[(0,J.jsx)(b,{}),` Resync now`]}),e.status===`paused`?(0,J.jsxs)(k,{onSelect:()=>u.mutate(e),children:[(0,J.jsx)(y,{}),` Resume`]}):(0,J.jsxs)(k,{onSelect:()=>a.mutate(e),children:[(0,J.jsx)(v,{}),` Pause`]}),(0,J.jsx)(T,{}),(0,J.jsxs)(k,{variant:`destructive`,onSelect:()=>D({title:`Remove ${e.email}?`,destructive:!0,confirmLabel:`Remove account`,description:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{children:`xaq stops syncing this mailbox, revokes its Google token and deletes every agent grant for it. Agents lose access immediately.`}),(0,J.jsx)(`p`,{children:`Mail in Gmail isn't touched. You can connect the account again later, but you'll need to recreate its grants.`})]}),onConfirm:()=>f.mutateAsync(e)}),children:[(0,J.jsx)(g,{}),` Remove…`]})]})]})]})]})}function X(e){let t=s(i.calendarSetup()),n=t.data?.accounts.find(t=>t.accountId===e.id),r=t.data?.enabled??!1;if(n)return j({...n,error:e.calendar?.error},r);if(!t.isSuccess&&!e.calendar)return null;let a=e.calendar??{status:`not_granted`,missingScopes:[...C.calendar],error:null};return j({...a,syncedCalendars:0,push:!1},r)}function Z({label:e=`Connect Gmail account`,variant:n=`default`}){return(0,J.jsxs)(t,{variant:n,onClick:()=>_(),children:[(0,J.jsx)(W,{}),` `,e]})}function Q(){let e=s(i.accounts()),t=s(i.settings()).data?.ingestMode===`pubsub`;return e.isPending?(0,J.jsx)(u,{className:`gap-0 divide-y py-0`,children:[0,1].map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,J.jsx)(f,{className:`size-9 rounded-full`}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,J.jsx)(f,{className:`h-4 w-48`}),(0,J.jsx)(f,{className:`h-3 w-64`})]})]},e))}):e.isError?(0,J.jsx)(m,{error:e.error,onRetry:()=>void e.refetch()}):e.data.length?(0,J.jsx)(u,{className:`gap-0 divide-y py-0`,children:e.data.map(e=>(0,J.jsx)(Y,{account:e,showWatch:t},e.id))}):(0,J.jsx)(u,{children:(0,J.jsxs)(z,{children:[(0,J.jsxs)(F,{children:[(0,J.jsx)(P,{variant:`icon`,children:(0,J.jsx)(W,{})}),(0,J.jsx)(L,{children:`No Gmail accounts yet`}),(0,J.jsx)(R,{children:`Connect a mailbox to start syncing mail. xaq holds the credentials; agents only get the access you grant them.`})]}),(0,J.jsx)(I,{children:(0,J.jsx)(Z,{})})]})})}export{Z as n,W as r,Q as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,D as n,Ht as r,N as i,S as a,Ut as o,Wt as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,l as g,n as _,o as v,r as y,t as ee,u as b,w as x,x as S}from"./queries-Cv3nXx0U.js";import{t as C}from"./useQuery-MrTwwNy5.js";import{t as te}from"./arrow-left-DZVAXoKj.js";import{t as w}from"./arrow-right-C2zcqRr2.js";import{c as T,l as E,u as D}from"./card-GSO5o-Ug.js";import{I as O,a as k,i as A,r as j,s as ne}from"./common-BPZV8TFb.js";import{n as M,t as N}from"./shield-check-BulpsYqK.js";import{n as re}from"./connect-host-lr2c3xWh.js";import{t as P}from"./network-igNw0VVx.js";import{t as F}from"./plug-CXAniEiR.js";import{t as I}from"./search-CTVKGomS.js";import{n as ie,o as ae}from"./connection-row-DYx_5o0c.js";import{t as L}from"./checkbox-B937U-Fd.js";import{a as R,i as oe,n as z,r as B,t as V}from"./field-C6ejurju.js";import{t as H}from"./choice-cards-CgAIqBGX.js";import{a as U,i as W,n as G,o as K,r as se,s as ce}from"./mutations-CLPqJ6cj.js";import{t as q}from"./input-CWwJgozn.js";import{t as J}from"./password-input-DV3aqcNf.js";var Y=e(s(),1),X=o(),Z=null;function le(e={}){Z?.(e)}var Q=encodeURIComponent;function ue(){let e=r(),[t,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(`pick`),[c,l]=(0,Y.useState)(f()),[u,m]=(0,Y.useState)(),[h,g]=(0,Y.useState)(null),y=(0,Y.useRef)(void 0),x=C({..._.presets(),enabled:t}),S=C({..._.connections(),enabled:t}),T=(S.data??[]).map(e=>e.slug),E=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>{E.current=t=>{y.current=t.onDone,l(f()),g(null),s(t.start?`setup`:`pick`),a(!0),t.start&&t.start!==`custom`&&(m(t.start),e.fetchQuery(_.presets()).then(e=>{let n=e.find(e=>e.id===t.start);l(f(n??null)),n||s(`pick`)}).catch(()=>s(`pick`)).finally(()=>m(void 0)))}}),(0,Y.useEffect)(()=>(Z=e=>E.current(e),()=>{Z=null}),[]);let D=t=>{t&&n(`/api/connections/${Q(t.id)}`,{method:`DELETE`}).catch(()=>void 0).finally(()=>void e.invalidateQueries({queryKey:ee.connections}))},k=()=>{D(h),g(null)},A=e=>{e||(k(),l(f())),a(e)},j=e=>{if(k(),e?.id===`google`)return A(!1),re();l(f(e)),s(`setup`)},M=e=>l(t=>({...t,...e})),N=b(c,T),P=N.filter(e=>!e.startsWith(`Pick at least one agent`)),I=c.name.trim()||c.preset?.displayName||c.slug||`the server`,L=()=>{let t=c,r=h,i=y.current;g(null),l(f()),a(!1);let o=d(t),s=v(t),u=r?.id??null,m=!!r;ae({name:I,onDone:i,run:async()=>{if(!u)u=(await n(`/api/connections`,{body:o})).id;else if(m&&r){let i=await e.fetchQuery(_.agents()),a=p(t,r,i.map(e=>e.id));a.patch&&await n(`/api/connections/${Q(u)}`,{method:`PATCH`,body:a.patch}),await n(`/api/connections/${Q(u)}/grants`,{method:`PUT`,body:a.grants}),m=!1}let i=s??{};s=null;let a=await n(`/api/connections/${Q(u)}/connect`,{body:i});return{connectionId:u,result:a}}})},R=o===`pick`?`Add a connection`:o===`access`?`What can agents do with ${I}?`:c.preset?`Connect ${c.preset.displayName}`:`Connect an MCP server`;return(0,X.jsx)(G,{open:t,onOpenChange:A,children:(0,X.jsxs)(se,{className:`max-h-[92svh] overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(K,{children:[(0,X.jsx)(ce,{children:R}),(0,X.jsx)(W,{children:o===`pick`?`xaq keeps the sign-in. Agents get its tools through their one xaq connection, never the credentials.`:o===`access`?`You can change this later, for all agents or one at a time on an agent's page.`:c.preset?`Gives your agents ${c.preset.displayName}'s tools.`:`Paste the server's address. xaq checks how it signs in.`})]}),o===`pick`&&(x.isPending?(0,X.jsx)(O,{className:`h-48`}):x.isError?(0,X.jsx)(ne,{error:x.error,onRetry:()=>void x.refetch()}):(0,X.jsx)(de,{presets:x.data,onPick:j})),o===`setup`&&(u?(0,X.jsx)(O,{className:`h-48`}):(0,X.jsx)(fe,{draft:c,set:M,taken:T,existing:c.preset?(S.data??[]).find(e=>e.preset===c.preset.id&&e.slug===c.slug)??null:null,onReuse:e=>{A(!1),ie(e)},created:h,onCreated:g,onDropCreated:()=>{D(h),g(null)}})),o===`access`&&(0,X.jsx)(he,{draft:c,set:M}),(0,X.jsxs)(U,{className:`gap-2`,children:[o!==`pick`&&(0,X.jsxs)(i,{variant:`ghost`,onClick:()=>{o===`setup`&&k(),s(o===`access`?`setup`:`pick`)},className:`sm:mr-auto`,children:[(0,X.jsx)(te,{}),` Back`]}),o===`setup`&&(0,X.jsxs)(i,{disabled:P.length>0,onClick:()=>s(`access`),title:P[0],children:[`Continue `,(0,X.jsx)(w,{})]}),o===`access`&&(0,X.jsxs)(i,{disabled:N.length>0,onClick:L,title:N[0],children:[(0,X.jsx)(F,{}),` Connect `,I]})]})]})})}function de({presets:e,onPick:t}){let n=`flex w-full items-start gap-3 rounded-lg border bg-card p-3 text-left text-sm outline-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring`;return(0,X.jsxs)(`ul`,{className:`space-y-2`,children:[e.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,className:n,onClick:()=>t(e),children:[(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted font-semibold`,children:e.displayName.slice(0,1)}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:e.displayName}),e.url&&(0,X.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.url})]}),(0,X.jsx)(w,{className:`mt-1 size-4 shrink-0 text-muted-foreground`})]})},e.id)),(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,className:n,onClick:()=>t(null),children:[(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,X.jsx)(M,{className:`size-4`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:`Another MCP server`}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Any remote MCP server, by its address. On this computer or your network works too.`})]}),(0,X.jsx)(w,{className:`mt-1 size-4 shrink-0 text-muted-foreground`})]})})]})}function fe({draft:e,set:t,taken:n,created:r,onCreated:o,onDropCreated:s,existing:l,onReuse:u}){let d=g(e),f=e.slug&&!l?a(e.slug,r?n.filter(e=>e!==r.slug):n):null,p=e.preset?m(e.preset.setupSteps,e.inputs):{},_=!!e.preset||!!e.probe&&d?.kind!==`private`;return(0,X.jsxs)(oe,{children:[l&&(0,X.jsxs)(T,{variant:`info`,children:[(0,X.jsx)(F,{}),(0,X.jsxs)(D,{children:[`You already have `,l.name]}),(0,X.jsxs)(E,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{children:`Use it again: reconnecting signs in anew and keeps its access settings. To add a second one, give it another short name below.`}),(0,X.jsxs)(i,{size:`sm`,onClick:()=>u(l),children:[`Reconnect `,l.name]})]})]}),!e.preset&&(0,X.jsx)(pe,{draft:e,set:t,created:r,onCreated:o,onDropCreated:s}),e.preset?.setupSteps.length?(0,X.jsx)(`ol`,{className:`space-y-4`,children:e.preset.setupSteps.map((n,r)=>(0,X.jsx)(me,{n:r+1,step:n,value:n.input?e.inputs[n.input.key]??``:``,problem:n.input&&e.inputs[n.input.key]?p[n.input.key]:void 0,onChange:r=>n.input&&t({inputs:{...e.inputs,[n.input.key]:r}})},n.id))}):null,d?.kind===`header`&&(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[10rem_1fr]`,children:[(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:`conn-header-name`,children:`Header`}),(0,X.jsx)(q,{id:`conn-header-name`,autoComplete:`off`,className:`font-mono`,value:e.headerName,onChange:e=>t({headerName:e.target.value})})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:`conn-header`,children:`API key or token`}),(0,X.jsx)(J,{id:`conn-header`,autoComplete:`off`,value:e.headerValue,onChange:e=>t({headerValue:e.target.value})})]}),(0,X.jsxs)(z,{className:`sm:col-span-2`,children:[`Stored encrypted and sent with every request; agents never see it. For `,(0,X.jsx)(`code`,{className:`font-mono`,children:`Authorization`}),`, a bare token gets “Bearer ” in front.`]})]}),d?.kind===`oauth`&&(0,X.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,X.jsx)(N,{className:`mt-0.5 size-4 shrink-0`}),`After the next page, a window opens to sign in`,e.preset?` to ${e.preset.displayName}`:``,` and approve access.`]}),_&&(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:`conn-name`,children:`Name`}),(0,X.jsx)(q,{id:`conn-name`,value:e.name,maxLength:100,placeholder:e.preset?.displayName??h(e.url),onChange:n=>t(c(e,n.target.value))})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:`conn-slug`,children:`Short name`}),(0,X.jsx)(q,{id:`conn-slug`,value:e.slug,maxLength:24,onChange:e=>t({slug:e.target.value.toLowerCase(),slugEdited:!0}),"aria-invalid":!!f,className:`font-mono`}),f?(0,X.jsx)(B,{children:f}):(0,X.jsxs)(z,{children:[`Agents see its tools as `,(0,X.jsxs)(`code`,{className:`font-mono`,children:[e.slug||`name`,`__search`]}),` and so on.`]})]})]})]})}function pe({draft:e,set:r,created:a,onCreated:o,onDropCreated:s}){let[c,l]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),m=async i=>{l(!0),p(void 0);try{let a=e.url.trim();r({probe:await n(`/api/connections/probe`,{body:{url:a,...i?{connectionId:i}:{}}}),slug:e.slug||t(a)})}catch(e){p(e),r({probe:null})}finally{l(!1)}},_=async()=>{l(!0),p(void 0);try{let i=e.slug||t(e.url)||`local`,s=a??await n(`/api/connections`,{body:{...d({...e,slug:i}),agentIds:[]}});o(await n(`/api/connections/${Q(s.id)}/private-target`,{method:`PUT`,body:{allow:!0}})),r({createdId:s.id,privateAllowed:!0,slug:i}),l(!1),await m(s.id)}catch(e){p(e),l(!1)}},v=e.probe,y=g(e);return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(`form`,{onSubmit:t=>{t.preventDefault(),e.url.trim()&&m(a?.id)},children:(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:`conn-url`,children:`Server address`}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(q,{id:`conn-url`,inputMode:`url`,autoComplete:`off`,placeholder:`https://mcp.example.com/mcp`,value:e.url,disabled:!!a,onChange:e=>r({url:e.target.value,probe:null})}),(0,X.jsxs)(i,{type:`submit`,variant:`outline`,disabled:!e.url.trim()||c,children:[c?(0,X.jsx)(x,{}):(0,X.jsx)(I,{}),` Check`]})]}),a?(0,X.jsxs)(z,{children:[`Allowed on your private network: `,h(e.url),`.`,` `,(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-foreground underline underline-offset-4`,onClick:()=>{s(),r({createdId:null,privateAllowed:!1,probe:null})},children:`Use another address`})]}):(0,X.jsx)(z,{children:`The address you'd give an MCP client, usually ending in /mcp.`})]})}),f!==void 0&&(0,X.jsx)(A,{error:f}),v&&y?.kind!==`private`&&(0,X.jsxs)(T,{variant:v.reachable&&!v.blocked?`success`:`destructive`,children:[(0,X.jsx)(N,{}),(0,X.jsx)(D,{children:v.reachable&&!v.blocked?`Found it`:`Couldn't use this address`}),(0,X.jsx)(E,{children:(0,X.jsx)(`p`,{children:S(v)})})]}),v&&y?.kind===`private`&&(0,X.jsxs)(T,{variant:`warning`,children:[(0,X.jsx)(P,{}),(0,X.jsx)(D,{children:`This is on your private network`}),(0,X.jsxs)(E,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{children:S(v)}),(0,X.jsx)(`p`,{children:u(e.url)}),(0,X.jsxs)(i,{size:`sm`,disabled:c,onClick:()=>void _(),children:[c&&(0,X.jsx)(x,{}),` Allow `,h(e.url)]})]})]})]})}function $({text:e}){return e.split(/(`[^`]+`)/).map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,X.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-[0.85em]`,children:e.slice(1,-1)},t):e)}function me({n:e,step:t,value:n,problem:r,onChange:i}){let a=`setup-${t.id}`;return(0,X.jsxs)(`li`,{className:`flex gap-3`,children:[(0,X.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full border text-xs font-medium tabular`,"aria-hidden":!0,children:e}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 text-sm`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:t.title}),t.body&&(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:(0,X.jsx)($,{text:t.body})}),t.link&&(0,X.jsx)(k,{href:t.link.url,children:t.link.label}),t.copy&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.copy.label}),(0,X.jsx)(j,{value:t.copy.value,label:`Copy ${t.copy.label.toLowerCase()}`})]}),t.input&&(0,X.jsxs)(V,{children:[(0,X.jsx)(R,{htmlFor:a,children:t.input.label}),t.input.secret?(0,X.jsx)(J,{id:a,autoComplete:`off`,placeholder:t.input.placeholder,value:n,onChange:e=>i(e.target.value),"aria-invalid":!!r}):(0,X.jsx)(q,{id:a,autoComplete:`off`,placeholder:t.input.placeholder,value:n,onChange:e=>i(e.target.value),"aria-invalid":!!r}),r&&(0,X.jsx)(B,{children:r})]})]})]})}function he({draft:e,set:t}){return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsx)(ge,{value:e.level,onChange:e=>t({level:e})}),(0,X.jsx)(_e,{value:e.agents,onChange:e=>t({agents:e})})]})}function ge({value:e,onChange:t}){return(0,X.jsx)(H,{"aria-label":`Access level`,value:e,onChange:t,choices:y.map(e=>({value:e,title:l[e].label,description:l[e].description,badge:e===`ask`?(0,X.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] font-medium text-muted-foreground`,children:`Recommended`}):void 0}))})}function _e({value:e,onChange:t}){let n=C(_.agents()).data??[],r=e===`all`,i=r?[]:e;return(0,X.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,X.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Which agents get it`}),(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(L,{checked:r,onCheckedChange:e=>t(e?`all`:n.map(e=>e.id))}),`All agents`]}),!r&&(0,X.jsxs)(`ul`,{className:`space-y-1.5 pl-6`,children:[n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(L,{checked:i.includes(e.id),onCheckedChange:n=>t(n?[...i,e.id]:i.filter(t=>t!==e.id))}),e.name]})},e.id)),n.length===0&&(0,X.jsx)(`li`,{className:`text-sm text-muted-foreground`,children:`No agents yet. You can give it to agents later on their pages.`})]})]})}export{le as n,ue as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,N as n,Ut as r,Wt as i,n as a,t as o,w as s}from"./queries-Cv3nXx0U.js";import{t as c}from"./useQuery-MrTwwNy5.js";import{d as l,f as u,u as d}from"./pairing-XjuaVr2u.js";import{i as f}from"./common-BPZV8TFb.js";import{t as p}from"./checkbox-B937U-Fd.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./field-C6ejurju.js";import{t as x}from"./choice-cards-CgAIqBGX.js";import{t as S}from"./mutations-CLPqJ6cj.js";import{n as C,t as w}from"./input-CWwJgozn.js";import{r as T}from"./revealed-keys-C_9NtJPY.js";var E=e(i(),1),D=r();function O({onCreated:e,defaultName:r=``,submitLabel:i=`Create agent`,onCancel:O}){let k=c(a.accounts()),[A,j]=(0,E.useState)(r),[M,N]=(0,E.useState)(``),[P,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(d[0].id),[R,z]=(0,E.useState)(!1),B=P??(k.data??[]).map(e=>e.id),V=S({mutationFn:e=>t(`/api/agents`,{body:e}),invalidate:[o.agents,o.setupState,o.overview],success:e=>`Agent "${e.agent.name}" created`,errorTitle:!1,onSuccess:t=>{T(t.agent.id,t.apiKey),e(t)}}),H=A.trim()?A.trim().length>80?`Keep it under 80 characters.`:null:`Give the agent a name.`,U=e=>{if(e.preventDefault(),z(!0),H)return;let t=d.find(e=>e.id===I);V.mutate({name:A.trim(),description:M.trim()||null,grants:B.map(e=>l(e,u(t)))})},W=(e,t)=>F(t?[...new Set([...B,e])]:B.filter(t=>t!==e));return(0,D.jsx)(`form`,{onSubmit:U,noValidate:!0,children:(0,D.jsxs)(h,{children:[(0,D.jsxs)(b,{"data-invalid":R&&!!H,children:[(0,D.jsx)(m,{htmlFor:`agent-name`,children:`Name`}),(0,D.jsx)(w,{id:`agent-name`,autoFocus:!0,placeholder:`e.g. Support triage, Claude Code on laptop`,value:A,onChange:e=>j(e.target.value),"aria-invalid":R&&!!H}),R&&H?(0,D.jsx)(v,{children:H}):(0,D.jsx)(g,{children:`Shown in audit logs and approval requests.`})]}),(0,D.jsxs)(b,{children:[(0,D.jsxs)(m,{htmlFor:`agent-desc`,children:[`Description `,(0,D.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,D.jsx)(C,{id:`agent-desc`,rows:2,placeholder:`What does this agent do?`,value:M,onChange:e=>N(e.target.value)})]}),(0,D.jsxs)(y,{children:[(0,D.jsx)(_,{variant:`label`,children:`Mailboxes it can use`}),k.data?.length?(0,D.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:k.data.map(e=>(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-lg border p-2.5 text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,children:[(0,D.jsx)(p,{checked:B.includes(e.id),onCheckedChange:t=>W(e.id,t===!0)}),(0,D.jsx)(`span`,{className:`truncate`,children:e.email})]},e.id))}):(0,D.jsx)(g,{children:`No Gmail accounts connected yet. You can create the agent now and grant access later.`})]}),B.length>0&&(0,D.jsxs)(y,{children:[(0,D.jsx)(_,{variant:`label`,children:`Starting permissions`}),(0,D.jsx)(g,{children:`Fine-tune capabilities, labels, recipients and limits per mailbox afterwards.`}),(0,D.jsx)(x,{"aria-label":`Starting permissions`,value:I,onChange:L,columns:2,choices:d.map(e=>({value:e.id,title:e.label,description:e.description}))})]}),V.isError&&(0,D.jsx)(f,{error:V.error,title:`Couldn't create the agent`}),(0,D.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[O&&(0,D.jsx)(n,{type:`button`,variant:`ghost`,onClick:O,children:`Cancel`}),(0,D.jsxs)(n,{type:`submit`,disabled:V.isPending,children:[V.isPending&&(0,D.jsx)(s,{}),i]})]})]})})}export{O as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{N as t,Ut as n,Wt as r,_t as i,bt as a,ft as o,n as s,yt as c}from"./queries-Cv3nXx0U.js";import{t as l}from"./useQuery-MrTwwNy5.js";import{l as u}from"./pairing-XjuaVr2u.js";import{c as d,t as f}from"./connect-agent-guide-CJdw31p2.js";import{t as p}from"./bot-Zk76q_39.js";import{t as m}from"./chevron-right-Cqh4mDk1.js";import{t as h}from"./card-GSO5o-Ug.js";import{I as g,d as _,f as v,o as y,s as b,u as x}from"./common-BPZV8TFb.js";import{n as S}from"./send-DuMVuYs1.js";import{t as C}from"./mail-C5fm2pTC.js";import{t as w}from"./plug-zap-BwR-l5wb.js";import{t as T}from"./plus-B_TUslu3.js";import{a as E}from"./index-DGzo3kGh.js";import{a as D,c as O,i as k,n as A,o as j,r as M,s as N}from"./mutations-CLPqJ6cj.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./empty-DzTDioBP.js";import{t as B}from"./agent-create-form-CPxnPYH4.js";import{r as V}from"./attention-gO9Nw5uW.js";var H={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};H.node;var U=i(H),W=n();function G({agent:e,accounts:t}){let n=e=>t.find(t=>t.id===e)?.email??`Removed account`,r=e.listeners.filter(e=>e.connected);return(0,W.jsx)(h,{className:o(`gap-0 py-0 transition-colors hover:bg-muted/30`,e.disabled&&`bg-muted/20`),children:(0,W.jsxs)(c,{to:`/agents/$agentId`,params:{agentId:e.id},className:`flex h-full flex-col gap-3 rounded-xl p-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-muted`,children:(0,W.jsx)(p,{className:`size-4`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:o(`truncate font-medium`,e.disabled&&`text-muted-foreground`),title:e.name,children:e.name}),e.disabled&&(0,W.jsx)(v,{tone:`idle`,children:`Disabled`})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,title:e.description??void 0,children:e.description||`No description`})]}),(0,W.jsx)(m,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,W.jsx)(`div`,{className:`space-y-1.5 text-xs`,children:e.grants.length?e.grants.map(e=>(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-muted-foreground`,children:[(0,W.jsx)(C,{className:`mt-px size-3.5 shrink-0`}),(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsx)(`span`,{className:`block truncate text-foreground`,title:n(e.accountId),children:n(e.accountId)}),(0,W.jsxs)(`span`,{className:`block break-words`,children:[u(e),e.labelScope&&` · ${e.labelScope.length} label${e.labelScope.length===1?``:`s`}`]})]})]},e.id)):(0,W.jsx)(`div`,{className:`text-warning`,children:`No mailbox access yet`})}),(0,W.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-4 gap-y-1 border-t pt-3 text-xs text-muted-foreground`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono`,children:[(0,W.jsx)(S,{className:`size-3.5`}),e.keyPrefix,`…`]}),(0,W.jsxs)(`span`,{children:[`Last used `,(0,W.jsx)(_,{date:e.lastUsedAt,fallback:`never`})]}),r.length>0&&(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[(0,W.jsx)(x,{tone:`good`}),(0,W.jsxs)(`span`,{className:`break-words`,children:[`Listening on `,r.map(e=>e.client.hostname??e.consumer).join(`, `)]})]})]})]})})}function K({open:e,onOpenChange:n}){return(0,W.jsx)(A,{open:e,onOpenChange:n,children:(0,W.jsxs)(M,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-2xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,W.jsxs)(j,{children:[(0,W.jsx)(N,{children:`Connect an agent`}),(0,W.jsx)(k,{children:`The agent asks for access from its own terminal and you approve it here. Its key never passes through your clipboard.`})]}),e&&(0,W.jsx)(f,{}),(0,W.jsx)(D,{children:(0,W.jsx)(t,{variant:`ghost`,onClick:()=>n(!1),children:`Close`})})]})})}var q=e(r(),1);function J({trigger:e}){let[n,r]=(0,q.useState)(!1),[i,o]=(0,q.useState)(),s=a(),c=e=>{r(e),e||setTimeout(()=>o(void 0),200)};return(0,W.jsxs)(A,{open:n,onOpenChange:e=>i&&!e?void 0:c(e),children:[(0,W.jsx)(O,{asChild:!0,children:e??(0,W.jsxs)(t,{children:[(0,W.jsx)(T,{}),` New agent`]})}),(0,W.jsx)(M,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-2xl`,onInteractOutside:e=>i&&e.preventDefault(),onEscapeKeyDown:e=>i&&e.preventDefault(),showCloseButton:!i,children:i?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j,{children:[(0,W.jsxs)(N,{children:[i.agent.name,` is ready`]}),(0,W.jsx)(k,{children:`Save the key, then add xaq to your agent with one of the snippets below.`})]}),(0,W.jsx)(d,{res:i}),(0,W.jsxs)(D,{children:[(0,W.jsxs)(t,{variant:`outline`,onClick:()=>{c(!1),s({to:`/agents/$agentId`,params:{agentId:i.agent.id}})},children:[(0,W.jsx)(U,{}),` Fine-tune permissions`]}),(0,W.jsx)(t,{onClick:()=>c(!1),children:`I've saved the key`})]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j,{children:[(0,W.jsx)(N,{children:`New agent`}),(0,W.jsx)(k,{children:`Each agent gets its own API key and its own permissions per mailbox.`})]}),(0,W.jsx)(B,{onCreated:o,onCancel:()=>c(!1)})]})})]})}function Y(){let e=l(s.agents()),n=l(s.accounts()),r=l(s.pairings(`pending`)),{connect:i}=E.useSearch(),o=a({from:E.fullPath}),c=e=>void o({search:{connect:e||void 0},replace:!0}),u=(0,W.jsxs)(t,{onClick:()=>c(!0),children:[(0,W.jsx)(w,{}),` Connect an agent`]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(y,{title:`Agents`,description:`Each agent has its own key and its own permissions per mailbox. Connect one from its own terminal, or create one here and paste its key.`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(J,{trigger:(0,W.jsxs)(t,{variant:`outline`,children:[(0,W.jsx)(T,{}),` Create with key`]})}),u]})}),(0,W.jsx)(V,{pairings:r.data??[]}),e.isPending?(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,W.jsx)(g,{className:`h-44 rounded-xl`},e))}):e.isError?(0,W.jsx)(b,{error:e.error,onRetry:()=>void e.refetch()}):e.data.length===0?(0,W.jsx)(h,{children:(0,W.jsxs)(z,{children:[(0,W.jsxs)(F,{children:[(0,W.jsx)(P,{variant:`icon`,children:(0,W.jsx)(p,{})}),(0,W.jsx)(L,{children:`No agents yet`}),(0,W.jsx)(R,{children:`The easiest way: run one command on the machine where Claude Code, Codex, Cursor or Hermes runs, then approve it here. No keys to copy.`})]}),(0,W.jsxs)(I,{className:`flex-row flex-wrap justify-center`,children:[u,(0,W.jsx)(J,{trigger:(0,W.jsxs)(t,{variant:`outline`,children:[(0,W.jsx)(T,{}),` Create with key`]})})]})]})}):(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:e.data.map(e=>(0,W.jsx)(G,{agent:e,accounts:n.data??[]},e.id))}),(0,W.jsx)(K,{open:!!i,onOpenChange:c})]})}export{Y as component};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,D as n,Ht as r,M as i,N as a,Ut as o,Wt as s,_t as c,bt as l,ft as u,gt as d,n as f,t as p,w as m,yt as h}from"./queries-Cv3nXx0U.js";import{t as g}from"./useQuery-MrTwwNy5.js";import{n as _,t as v}from"./x-MF2TZ9aG.js";import{t as y}from"./arrow-right-C2zcqRr2.js";import{a as ee,n as te,o as ne,r as re,s as ie,t as ae}from"./pairing-XjuaVr2u.js";import{t as oe}from"./bot-Zk76q_39.js";import{t as se}from"./chevron-right-Cqh4mDk1.js";import{c as ce,l as b,o as le,s as x}from"./label-multi-select-sH8mllw8.js";import{a as ue,c as S,l as C,o as de,r as fe,t as w,u as T}from"./card-GSO5o-Ug.js";import{t as pe}from"./circle-x-DcU-0zVh.js";import{t as me}from"./message-square-quote-se8Bf3RP.js";import{I as E,L as he,S as D,c as O,d as ge,o as _e,s as k,v as ve}from"./common-BPZV8TFb.js";import{n as ye}from"./send-DuMVuYs1.js";import{c as A,l as be,n as xe,o as Se,r as Ce,s as j,u as M}from"./mcp-call-card-Cr-OEDX2.js";import{t as we}from"./mail-C5fm2pTC.js";import{t as Te}from"./stamp-BNXUGNa3.js";import{Ot as Ee,Z as N,kt as De}from"./index-DGzo3kGh.js";import{n as Oe}from"./input-CWwJgozn.js";import{a as P,i as F,n as ke,o as I,r as L,t as R}from"./empty-DzTDioBP.js";import{a as z,d as B}from"./labels-B5UqVwFo.js";import{i as Ae,r as V}from"./mcp-call-UoOTPFyh.js";import{n as H,r as U,t as je}from"./hidden-chars-Dr9TxfvF.js";var W={name:`calendar-clock`,size:24,node:[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]};W.node;var Me=c(W),G={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};G.node;var Ne=c(G),Pe={name:`sticky-note`,size:24,node:[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]};Pe.node;var Fe=c(Pe),Ie={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};Ie.node;var Le=c(Ie),K=e(s(),1),q=e=>!!e.calendar&&e.kind.startsWith(`calendar.`),Re={"calendar.create":`wants to add an event to`,"calendar.update":`wants to change an event on`,"calendar.delete":`wants to delete an event from`,"calendar.rsvp":`wants to answer an invitation on`},ze=e=>Re[e.kind],Be={Title:`the title`,When:`the time`,Where:`the place`,"Video call":`the video call`,Repeats:`the repeat rule`},Ve=e=>`“${e}”`,He=e=>e?`Yes`:null,J=e=>e.length<2?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`,Ue=e=>`${e} ${e===1?`person`:`people`}`,We=/(?:Z|[+-]\d{2}:\d{2})$/i;function Ge(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=Object.fromEntries(n.formatToParts(e).map(e=>[e.type,Number(e.value)]));return Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)-(e-(e%1e3+1e3)%1e3)}function Y(e,t){if(We.test(e))return e;let n=Date.parse(`${e}Z`);if(Number.isNaN(n))return e;let r=n-Ge(n,t);return new Date(n-Ge(r,t)).toISOString()}function X(e,t){if(!e.start)return null;let n={start:e.start,end:e.end??e.start,allDay:!!e.allDay};if(n.allDay||!e.timeZone)return D(n,t);let r=e.timeZone;try{return`${D({...n,start:Y(n.start,r),end:Y(n.end,r)},{...t,timeZone:r})} (${r})`}catch{return D(n,t)}}var Z=e=>e?e.attendees.filter(e=>!e.resource).map(e=>e.email):[],Ke=e=>e?.length?e.join(`; `):null;function qe(e,t={}){let n=e.calendar,r=n.change,i=n.before,a=n.calendarName||n.calendarId,o=r.summary??i?.summary??e.subject??``,s=o?Ve(o):`an untitled event`,c=[],l=[],u=[],d=null;if(e.kind===`calendar.rsvp`)c.push(`Answers ${Ve(z[n.response??`accepted`])} to ${s}${i?.organizer?`, organized by ${ve(i.organizer)}`:``}.`),l.push({label:`Event`,before:i?.summary??null,after:i?.summary??null,changed:!1},{label:`When`,before:i?X(i,t):null,after:i?X(i,t):null,changed:!1},{label:`Your answer`,before:i?.selfResponse?z[i.selfResponse]:null,after:n.response?z[n.response]:null,changed:!0}),u=Z(i);else if(e.kind===`calendar.delete`)c.push(`Deletes ${s} from ${a}${i?.recurring?`, every occurrence of the series`:``}.`),l.push({label:`Title`,before:i?.summary??null,after:null,changed:!0},{label:`When`,before:i?X(i,t):null,after:null,changed:!0},{label:`Where`,before:i?.location??null,after:null,changed:!0}),u=Z(i);else{let o=[{label:`Title`,key:`summary`,before:i?.summary??null,after:r.summary??i?.summary??null},{label:`When`,key:`when`,before:i?X(i,t):null,after:X({start:r.start??i?.start,end:r.end??i?.end,allDay:r.allDay??i?.allDay,timeZone:r.start!==void 0&&r.timeZone||i?.timeZone},t)},{label:`Where`,key:`location`,before:i?.location??null,after:r.location??i?.location??null},{label:`Video call`,key:`addConference`,before:i?.conferenceUrl?`Yes`:null,after:He(r.addConference)??(i?.conferenceUrl?`Yes`:null)},{label:`Repeats`,key:`recurrence`,before:i?.recurring?`Yes`:null,after:Ke(r.recurrence)??(i?.recurring?`Yes`:null)}],f=r.start!==void 0||r.end!==void 0||r.allDay!==void 0;for(let t of o){let n=e.kind===`calendar.create`||(t.key===`when`?f:r[t.key]!==void 0);(t.after!==null||e.kind!==`calendar.create`&&t.before!==null)&&l.push({label:t.label,before:e.kind===`calendar.create`?null:t.before,after:t.after,changed:n})}if(d=r.description??null,u=r.attendees??Z(i),e.kind===`calendar.create`)c.push(`Creates ${s} on ${a}${l.find(e=>e.label===`When`)?.after?`, ${l.find(e=>e.label===`When`).after}`:``}.`);else{let e=l.filter(e=>e.changed).map(e=>Be[e.label]??e.label.toLowerCase());r.description!==void 0&&e.push(`the description`),r.attendees!==void 0&&e.push(`the guests`),c.push(`Changes ${e.length?J(e):`nothing visible`} of ${s} on ${a}.`)}r.addConference&&c.push(`Adds a Google Meet link.`);let p=r.attendees?r.attendees.filter(e=>!Z(i).includes(e)):[],m=r.attendees&&i?Z(i).filter(e=>!r.attendees.includes(e)):[];p.length&&c.push(`Invites ${J(p)}.`),m.length&&c.push(`Removes ${J(m)} from the guest list.`),p.length&&!n.notifyAttendees&&c.push(`New guests see the event on their calendars even without an email.`)}let f=e.accountEmail.toLowerCase();return u=u.filter(e=>e.toLowerCase()!==f),c.push(n.notified.length?`Google emails ${Ue(n.notified.length)} about it.`:n.notifyAttendees?`Nobody is emailed.`:`Nobody is emailed: the agent turned notifications off.`),{calendar:a,title:o,effects:c,rows:l,description:d,guests:u,moreGuests:!(e.kind===`calendar.create`||r.attendees)&&i?Math.max(0,i.attendeeCount-i.attendees.length):0,emailed:n.notified,comment:e.kind===`calendar.rsvp`&&e.body?e.body:null}}function Je(e){let t=e.calendar,n=t.before;return[e.subject,e.body,e.reason,t.calendarName,t.change.summary,t.change.description,t.change.location,...t.change.attendees??[],...t.change.recurrence??[],...t.notified,n?.summary,n?.location,n?.organizer?.name,...(n?.attendees??[]).flatMap(e=>[e.email,e.name])]}var Q=o();function Ye({approval:e}){let t=qe(e),n=e.kind!==`calendar.create`;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5 rounded-lg border bg-muted/30 p-3`,children:[(0,Q.jsxs)(O,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(Me,{className:`size-3.5`}),` What applying does`]}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-sm`,children:t.effects.map(e=>(0,Q.jsx)(`li`,{className:`break-words`,children:(0,Q.jsx)(H,{text:e})},e))})]}),(0,Q.jsx)(`dl`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-1.5 text-sm`,children:t.rows.map(t=>(0,Q.jsxs)(`div`,{className:`contents`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:t.label}),(0,Q.jsx)(`dd`,{className:u(`min-w-0 break-words`,!t.changed&&`text-muted-foreground`),children:n&&t.changed&&t.before!==t.after?(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-1.5`,children:[t.before===null?(0,Q.jsx)(`span`,{className:`text-muted-foreground italic`,children:`none`}):(0,Q.jsx)(`del`,{className:`text-muted-foreground`,children:(0,Q.jsx)(H,{text:t.before})}),(0,Q.jsx)(y,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-label":`becomes`}),t.after===null?(0,Q.jsx)(`span`,{className:`font-medium italic`,children:e.kind===`calendar.delete`?`deleted`:`none`}):(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(H,{text:t.after})})]}):(0,Q.jsx)(H,{text:t.after??t.before??`—`})})]},t.label))}),t.description!==null&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(O,{children:e.kind===`calendar.update`?`New description`:`Description`}),(0,Q.jsx)(A,{body:t.description})]}),t.comment&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(O,{children:`Comment to the organizer`}),(0,Q.jsx)(A,{body:t.comment})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(Xe,{icon:we,title:`Emailed by Google (${t.emailed.length})`,items:t.emailed,empty:e.calendar.notifyAttendees?`Nobody`:`Nobody: notifications are off`}),e.kind!==`calendar.rsvp`&&(0,Q.jsx)(Xe,{icon:Le,title:`${e.kind===`calendar.delete`?`Guests`:`Guests who see the event`} (${t.guests.length+t.moreGuests})`,items:t.guests,more:t.moreGuests,empty:`No guests`})]})]})}function Xe({icon:e,title:t,items:n,more:r=0,empty:i}){return(0,Q.jsxs)(`div`,{className:`space-y-1.5 rounded-lg border p-3`,children:[(0,Q.jsxs)(O,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(e,{className:`size-3.5`}),` `,t]}),n.length?(0,Q.jsxs)(`ul`,{className:`space-y-0.5 text-sm`,children:[n.map(e=>(0,Q.jsx)(`li`,{className:`break-all`,children:(0,Q.jsx)(H,{text:e})},e)),r>0&&(0,Q.jsxs)(`li`,{className:`text-muted-foreground`,children:[`and `,r,` more Google didn't list`]})]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]})}function Ze({approval:e}){let o=q(e)?e:null,s=r(),[c,l]=(0,K.useState)(``),[u,f]=(0,K.useState)(!1),g=_({mutationFn:t=>n(`/api/approvals/${encodeURIComponent(e.id)}/${t}`,{body:c.trim()?{note:c.trim()}:{}}),onSuccess:(t,n)=>{s.setQueryData([...p.approvals,`pending`],t=>t?.filter(t=>t.id!==e.id)),s.invalidateQueries({queryKey:p.approvals}),s.invalidateQueries({queryKey:p.overview}),o?n===`reject`?i.success(`Discarded`,{description:`Nothing reached Google Calendar. The agent is told it was rejected.`}):t.status===`failed`?i.error(`Approved, but applying failed`,{description:t.error??void 0}):i.success(`Applied to Google Calendar`,{description:`"${e.subject||`(no title)`}" is updated.`}):n===`reject`?i.success(`Rejected`,{description:`The draft was deleted and the agent is told it was rejected.`}):t.status===`failed`?i.error(`Approved, but sending failed`,{description:t.error??void 0}):i.success(`Approved and sent`,{description:`"${e.subject||`(no subject)`}" is on its way.`})},onError:e=>t(e,`Couldn't record the decision`)}),y=g.isPending?g.variables:void 0;return(0,Q.jsxs)(w,{children:[(0,Q.jsx)(de,{className:`gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-sm`,children:[(0,Q.jsxs)(h,{to:`/agents/$agentId`,params:{agentId:e.agentId},className:`flex items-center gap-1.5 font-medium hover:underline`,children:[(0,Q.jsx)(oe,{className:`size-4 text-muted-foreground`}),e.agentName]}),o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:ze(o)}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:(0,Q.jsx)(H,{text:o.calendar.calendarName||o.calendar.calendarId})}),(o.calendar.calendarName||o.calendar.calendarId)!==e.accountEmail&&(0,Q.jsxs)(`span`,{className:`truncate text-muted-foreground`,children:[`(`,e.accountEmail,`)`]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`wants to send from`}),(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.accountEmail})]}),(0,Q.jsx)(he,{variant:`secondary`,children:B[e.kind]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ge,{date:e.createdAt}),(0,Q.jsx)(be,{expiresAt:e.expiresAt})]})]})}),(0,Q.jsxs)(fe,{className:`space-y-4`,children:[(o?U(...Je(o)):U(e.subject,e.body,e.reason,...[...e.to,...e.cc,...e.bcc].flatMap(e=>[e.name,e.email]),...e.attachments.map(e=>e.filename)))&&(0,Q.jsx)(je,{what:o?`This change`:void 0}),e.reason&&(0,Q.jsxs)(`div`,{className:`flex gap-2 rounded-lg border-l-2 border-chart-1 bg-chart-1/5 px-3 py-2 text-sm`,children:[(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-chart-1`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Agent's reason`}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:(0,Q.jsx)(H,{text:e.reason})})]})]}),o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`text-base font-semibold break-words`,children:e.subject?(0,Q.jsx)(H,{text:e.subject}):(0,Q.jsx)(`span`,{className:`text-muted-foreground italic`,children:`(no title)`})}),(0,Q.jsx)(Ye,{approval:o})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{approval:e}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`text-base font-semibold break-words`,children:e.subject?(0,Q.jsx)(H,{text:e.subject}):(0,Q.jsx)(`span`,{className:`text-muted-foreground italic`,children:`(no subject)`})}),(0,Q.jsx)(A,{body:e.body})]}),(0,Q.jsx)(j,{items:e.attachments})]}),u&&(0,Q.jsx)(Oe,{autoFocus:!0,rows:2,maxLength:2e3,placeholder:`Optional note. The agent sees it with your decision (e.g. why you rejected).`,value:c,onChange:e=>l(e.target.value),"aria-label":`Decision note`})]}),(0,Q.jsxs)(ue,{className:`flex-wrap justify-between gap-2 border-t`,children:[(0,Q.jsxs)(a,{variant:`ghost`,size:`sm`,onClick:()=>f(!u),"aria-expanded":u,children:[(0,Q.jsx)(Fe,{}),` `,u?`Hide note`:`Add a note`]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(a,{variant:`outline`,disabled:g.isPending,onClick:()=>g.mutate(`reject`),children:[y===`reject`?(0,Q.jsx)(m,{}):(0,Q.jsx)(v,{}),` `,o?`Discard`:`Reject`]}),(0,Q.jsxs)(a,{disabled:g.isPending,onClick:()=>g.mutate(`approve`),children:[y===`approve`?(0,Q.jsx)(m,{}):(0,Q.jsx)(d,{}),` `,o?`Apply`:`Approve & send`]})]})]})]})}function Qe({items:e}){return(0,Q.jsx)(w,{className:`gap-0 py-0`,children:(0,Q.jsx)(`ul`,{className:`divide-y`,children:e.map(e=>(0,Q.jsx)($e,{approval:e},e.id))})})}function $e({approval:e}){let[t,n]=(0,K.useState)(!1),r=V(e);return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex w-full items-center gap-3 px-4 py-3 text-left outline-none hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Se,{status:e.status,kind:e.kind}),(0,Q.jsx)(`span`,{children:r?Ae(r.status,r.call.outcomeUnknown)??`Tool call`:B[e.kind]}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Q.jsx)(`span`,{className:`truncate`,children:r?e.agentName:`${e.agentName} via ${e.accountEmail}`})]}),(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:r?(0,Q.jsx)(`span`,{className:`font-mono`,children:r.call.tool}):e.subject?(0,Q.jsx)(H,{text:e.subject}):q(e)?`(no title)`:`(no subject)`}),(e.decisionNote||e.error)&&(0,Q.jsx)(`div`,{className:u(`truncate text-xs`,e.error?`text-critical`:`text-muted-foreground`),children:e.error??`Note: ${e.decisionNote}`})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ge,{date:e.decidedAt??e.expiresAt}),(0,Q.jsx)(se,{className:u(`size-4 transition-transform`,t&&`rotate-90`)})]})]}),t&&(0,Q.jsxs)(`div`,{className:`space-y-3 border-t bg-muted/20 px-4 py-3`,children:[e.reason&&(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent's reason: `}),(0,Q.jsx)(H,{text:e.reason})]}),e.decisionNote&&(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Your note: `}),e.decisionNote]}),e.error&&(0,Q.jsx)(`p`,{className:`text-sm text-critical`,children:e.error}),r?(0,Q.jsx)(Ce,{id:r.id}):q(e)?(0,Q.jsx)(Ye,{approval:e}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{approval:e}),(0,Q.jsx)(A,{body:e.body}),(0,Q.jsx)(j,{items:e.attachments})]})]})]})}var $=({n:e})=>e>0?(0,Q.jsx)(he,{variant:`secondary`,className:`ml-1 h-4 min-w-4 bg-warning/25 px-1 tabular`,children:e}):null;function et(){let e=N.useSearch(),t=e.pairing?`access`:e.tab??`messages`,n=l({from:N.fullPath}),r=g(f.approvals(`pending`)),i=g({...f.approvals(),enabled:t===`history`}),o=g(f.pairings()),s=g(f.accounts()),c=(i.data??[]).filter(e=>e.status!==`pending`),u=r.data?.length??0,d=(o.data??[]).filter(e=>e.status===`pending`),p=(o.data??[]).filter(e=>e.status!==`pending`).slice(0,8),[m,_]=(0,K.useState)(null),v=e.pairing&&o.data?ie(e.pairing,o.data):void 0,y=v?.kind===`pending`?v.p:void 0,[oe,se]=(0,K.useState)(null);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_e,{title:`Approvals`,description:`Decisions only you can make: messages agents want to send, calendar changes they want to make, and agents asking for access.`}),(0,Q.jsxs)(le,{value:t,onValueChange:e=>void n({search:{tab:e===`messages`?void 0:e},replace:!0}),children:[(0,Q.jsx)(`div`,{className:`-mx-1 overflow-x-auto px-1 pb-1`,children:(0,Q.jsxs)(ce,{children:[(0,Q.jsxs)(b,{value:`messages`,children:[`Requests `,(0,Q.jsx)($,{n:u})]}),(0,Q.jsxs)(b,{value:`access`,children:[`Agent access `,(0,Q.jsx)($,{n:d.length})]}),(0,Q.jsx)(b,{value:`history`,children:`History`})]})}),(0,Q.jsxs)(x,{value:`messages`,className:`mt-4 space-y-4`,children:[(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:`Sends, calendar changes and risky tool calls from agents set to ask you first. Approving sends the draft, applies the change or runs the call; rejecting deletes the draft or discards the change. Unanswered requests expire.`}),r.isPending?(0,Q.jsx)(E,{className:`h-80 rounded-xl`}):r.isError?(0,Q.jsx)(k,{error:r.error,onRetry:()=>void r.refetch()}):u===0?(0,Q.jsx)(w,{children:(0,Q.jsx)(R,{children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(P,{variant:`icon`,children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(I,{children:`Nothing waiting`}),(0,Q.jsx)(L,{children:`When an agent whose send mode is “Needs approval” sends a message, or one set to ask first changes a calendar, it waits here. The sidebar shows a count when something's pending.`})]})})}):r.data.map(e=>{let t=V(e);return t?(0,Q.jsx)(xe,{approval:t},e.id):(0,Q.jsx)(Ze,{approval:e},e.id)})]}),(0,Q.jsxs)(x,{value:`access`,className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:[`Agents that ran `,(0,Q.jsx)(`code`,{className:`font-mono text-foreground`,children:`npx xaq-cli connect`}),` and are waiting for you. Names, hosts and reasons come from the agent itself. Approve only requests you started, after checking the code in your terminal.`]}),v?.kind===`denied`?(0,Q.jsxs)(S,{children:[(0,Q.jsx)(pe,{}),(0,Q.jsxs)(T,{children:[`You denied `,(0,Q.jsx)(H,{text:v.p.name})]}),(0,Q.jsxs)(C,{children:[ne(v.p.decisionNote),` Changed your mind? Run connect again for a new request.`]})]}):v?.kind===`approved`?(0,Q.jsxs)(S,{variant:`success`,children:[(0,Q.jsx)(De,{}),(0,Q.jsxs)(T,{children:[`You approved `,(0,Q.jsx)(H,{text:v.p.name})]}),(0,Q.jsx)(C,{children:(0,Q.jsxs)(`p`,{children:[`Its key is ready for the agent's terminal.`,` `,v.p.agentId&&(0,Q.jsx)(h,{to:`/agents/$agentId`,params:{agentId:v.p.agentId},className:`font-medium text-foreground underline underline-offset-4`,children:`Open agent`})]})})]}):v?.kind===`gone`?(0,Q.jsxs)(S,{children:[(0,Q.jsx)(Ee,{}),(0,Q.jsx)(T,{children:`That request isn't waiting anymore`}),(0,Q.jsx)(C,{children:`It expired (codes last 10 minutes) or doesn't exist. If your terminal is still waiting, check the code it shows; otherwise run connect again.`})]}):null,o.isPending?(0,Q.jsx)(E,{className:`h-64 rounded-xl`}):o.isError?(0,Q.jsx)(k,{error:o.error,onRetry:()=>void o.refetch()}):(0,Q.jsxs)(Q.Fragment,{children:[d.length>0&&(0,Q.jsx)(ae,{pending:d,onFound:e=>{se(e.userCode),n({search:{pairing:e.userCode},replace:!0})}}),d.length===0?(0,Q.jsx)(w,{children:(0,Q.jsxs)(R,{children:[(0,Q.jsxs)(F,{children:[(0,Q.jsx)(P,{variant:`icon`,children:(0,Q.jsx)(ye,{})}),(0,Q.jsx)(I,{children:`No agents waiting for access`}),(0,Q.jsxs)(L,{children:[`Run `,(0,Q.jsx)(`code`,{className:`font-mono`,children:`npx xaq-cli connect`}),` on the agent's machine. Its request shows up here instantly.`]})]}),(0,Q.jsx)(ke,{children:(0,Q.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(h,{to:`/agents`,search:{connect:!0},children:`How to connect an agent`})})})]})}):d.map(e=>(0,Q.jsx)(re,{p:e,accounts:s.data??[],highlighted:e.id===y?.id?oe===e.userCode?`found`:`link`:void 0,onApprove:()=>_({p:e})},e.id)),(0,Q.jsx)(ee,{items:p})]})]}),(0,Q.jsx)(x,{value:`history`,className:`mt-4`,children:i.isPending?(0,Q.jsx)(E,{className:`h-60 rounded-xl`}):i.isError?(0,Q.jsx)(k,{error:i.error,onRetry:()=>void i.refetch()}):c.length===0?(0,Q.jsx)(w,{children:(0,Q.jsx)(R,{children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(P,{variant:`icon`,children:(0,Q.jsx)(Ne,{})}),(0,Q.jsx)(I,{children:`No decisions yet`}),(0,Q.jsx)(L,{children:`Approved, rejected and expired messages and calendar changes are listed here.`})]})})}):(0,Q.jsx)(Qe,{items:c})})]}),(0,Q.jsx)(te,{p:m?.p??null,accounts:s.data??[],onOpenChange:e=>!e&&_(null)})]})}export{et as component};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{E as t,Ht as n,N as r,T as i,Ut as a,Wt as o,_t as s,bt as c,ft as l,n as u,t as d,yt as f}from"./queries-Cv3nXx0U.js";import{t as p}from"./useQuery-MrTwwNy5.js";import{t as m}from"./useRouterState-D4OBK8l5.js";import{t as h}from"./bot-Zk76q_39.js";import{c as g,l as _,u as v}from"./card-GSO5o-Ug.js";import{t as y}from"./circle-x-DcU-0zVh.js";import{n as b}from"./message-square-quote-se8Bf3RP.js";import{F as x,I as S,s as C}from"./common-BPZV8TFb.js";import{a as w,i as T,l as E,t as D}from"./mcp-call-card-Cr-OEDX2.js";import{kt as O,o as k,ot as A,st as j}from"./index-DGzo3kGh.js";import{l as M,o as N}from"./mcp-call-UoOTPFyh.js";var P={name:`circle-slash`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]};P.node;var F=s(P),I=e(o()),L=a();function R(){let{id:e}=k.useParams(),r=p(u.approval(e)),a=c(),o=n(),s=m({select:e=>e.location.href});return(0,I.useEffect)(()=>{let e=()=>{o.setQueryData(d.setupStatus,{claimed:!0,authenticated:!1}),a({to:`/login`,search:{redirect:s}})};return window.addEventListener(t,e),()=>window.removeEventListener(t,e)},[a,o,s]),(0,L.jsxs)(`div`,{className:`min-h-svh bg-muted/40`,children:[(0,L.jsxs)(`header`,{className:`mx-auto flex max-w-lg items-center justify-between px-4 pt-4`,children:[(0,L.jsxs)(f,{to:`/`,className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,L.jsx)(A,{className:`size-7`}),` xaq`]}),(0,L.jsx)(j,{})]}),(0,L.jsx)(`main`,{className:`mx-auto max-w-lg space-y-4 p-4 pb-10`,children:r.isPending?(0,L.jsx)(S,{className:`h-96 rounded-xl`}):r.isError?r.error instanceof i&&r.error.status===404?(0,L.jsx)(V,{icon:F,title:`This request doesn't exist`,description:`It may have been removed with its connection. Nothing will run.`}):(0,L.jsx)(C,{error:r.error,onRetry:()=>void r.refetch()}):(0,L.jsx)(z,{data:r.data})})]})}function z({data:e}){return M(e)?(0,L.jsx)(B,{view:e},e.approval.id):(0,L.jsx)(V,{icon:b,title:`Open this in the console`,description:`This request is a message or calendar change. Review it on the Approvals page.`,children:(0,L.jsx)(r,{size:`lg`,className:`w-full`,asChild:!0,children:(0,L.jsx)(f,{to:`/approvals`,children:`Open Approvals`})})})}function B({view:e}){let[t,n]=(0,I.useState)(null),i=w(e,(e,t)=>{e.kind===`mcp.call`&&n({res:e,d:t})}),a=t?.res??e.approval,o=x(1e3),s=a.status===`pending`&&Date.parse(a.expiresAt)<=o,c=e.connection?.name??`a removed connection`;if(a.status!==`pending`||s){let e=N(s?{...a,status:`expired`}:a,t?.d??null);return(0,L.jsxs)(V,{icon:e.tone===`good`?O:e.tone===`bad`?y:F,tone:e.tone,title:t?e.title:`Already decided: ${e.title.toLowerCase()}`,description:e.description,children:[(0,L.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:a.call.tool}),` on `,c,`, asked by `,a.agentName,`.`]}),(0,L.jsx)(r,{variant:`outline`,size:`lg`,className:`w-full`,asChild:!0,children:(0,L.jsx)(f,{to:`/approvals`,children:`Open the console`})})]})}let l=t?.res.status===`pending`?N(t.res,t.d):null;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`h1`,{className:`flex flex-wrap items-center gap-2 text-xl font-semibold tracking-tight`,children:[(0,L.jsx)(h,{className:`size-5 text-muted-foreground`}),` `,a.agentName,` wants to use `,c]}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This action can't be undone, so it waits for you. `,(0,L.jsx)(E,{expiresAt:a.expiresAt}),`.`]})]}),l&&(0,L.jsxs)(g,{variant:`destructive`,children:[(0,L.jsx)(y,{}),(0,L.jsx)(v,{children:l.title}),(0,L.jsx)(_,{children:l.description})]}),(0,L.jsx)(`div`,{className:`rounded-xl border bg-card p-4`,children:(0,L.jsx)(D,{view:e,uncapped:!0})}),(0,L.jsx)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-muted/90 px-4 py-4 backdrop-blur`,children:(0,L.jsx)(T,{view:e,d:i,large:!0})})]})}function V({icon:e,tone:t=`idle`,title:n,description:r,children:i}){return(0,L.jsxs)(`div`,{className:`space-y-5 rounded-xl border bg-card px-5 py-10 text-center`,role:`status`,children:[(0,L.jsx)(e,{className:l(`mx-auto size-14`,t===`good`?`text-success`:t===`bad`?`text-critical`:`text-muted-foreground`)}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:n}),r&&(0,L.jsx)(`p`,{className:`text-sm text-balance text-muted-foreground`,children:r})]}),i]})}export{R as component};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{N as e,Ut as t,yt as n}from"./queries-Cv3nXx0U.js";import{t as r}from"./arrow-right-C2zcqRr2.js";import{r as i,t as a}from"./card-GSO5o-Ug.js";import{n as o}from"./send-DuMVuYs1.js";import{n as s}from"./connect-host-lr2c3xWh.js";import{t as c}from"./stamp-BNXUGNa3.js";import{Et as l,Tt as u}from"./index-DGzo3kGh.js";import{n as d}from"./account-status-CEszs13C.js";import{r as f}from"./mcp-call-UoOTPFyh.js";var p=t();function m({accounts:t}){let r=t.filter(e=>e.status===`needs_reauth`||e.status===`error`);return r.length?(0,p.jsx)(a,{className:`border-critical/30 bg-critical/[0.03]`,children:(0,p.jsxs)(i,{className:`space-y-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,p.jsx)(l,{className:`size-4 text-critical`}),r.length===1?`An account needs attention`:`${r.length} accounts need attention`]}),(0,p.jsx)(`ul`,{className:`divide-y`,children:r.map(t=>(0,p.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2`,children:[(0,p.jsxs)(`div`,{className:`min-w-56 flex-1`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t.email}),(0,p.jsx)(d,{status:t.status})]}),t.lastError&&(0,p.jsx)(`p`,{className:`mt-0.5 text-xs break-words text-muted-foreground`,children:t.lastError})]}),t.status===`needs_reauth`?(0,p.jsxs)(e,{size:`sm`,onClick:()=>s({reauthAccountId:t.id,email:t.email}),children:[(0,p.jsx)(u,{}),` Reconnect`]}):(0,p.jsx)(e,{size:`sm`,variant:`outline`,asChild:!0,children:(0,p.jsx)(n,{to:`/accounts`,children:`View`})})]},t.id))})]})}):null}function h({approvals:t}){if(!t.length)return null;let o=t[0],s=f(o),l=t.some(e=>f(e))?[`request`,`requests`]:[`message`,`messages`];return(0,p.jsx)(a,{className:`border-warning/40 bg-warning/[0.06]`,children:(0,p.jsxs)(i,{className:`flex flex-wrap items-center gap-3`,children:[(0,p.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-lg bg-warning/20`,children:(0,p.jsx)(c,{className:`size-4`})}),(0,p.jsxs)(`div`,{className:`min-w-48 flex-1`,children:[(0,p.jsx)(`div`,{className:`font-medium`,children:t.length===1?`1 ${l[0]} is waiting for your approval`:`${t.length} ${l[1]} are waiting for your approval`}),(0,p.jsxs)(`p`,{className:`truncate text-sm text-muted-foreground`,children:[o.agentName,`: `,s?s.call.tool:`“${o.subject||`(no subject)`}”`,t.length>1&&` and more`]})]}),(0,p.jsx)(e,{asChild:!0,children:(0,p.jsxs)(n,{to:`/approvals`,children:[`Review `,(0,p.jsx)(r,{})]})})]})})}function g({pairings:t}){let s=t.filter(e=>e.status===`pending`);if(!s.length)return null;let c=s[0];return(0,p.jsx)(a,{className:`border-warning/40 bg-warning/[0.06]`,children:(0,p.jsxs)(i,{className:`flex flex-wrap items-center gap-3`,children:[(0,p.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-lg bg-warning/20`,children:(0,p.jsx)(o,{className:`size-4`})}),(0,p.jsxs)(`div`,{className:`min-w-48 flex-1`,children:[(0,p.jsx)(`div`,{className:`font-medium`,children:s.length===1?`An agent is asking for access`:`${s.length} agents are asking for access`}),(0,p.jsxs)(`p`,{className:`truncate text-sm text-muted-foreground`,children:[c.name,c.ip&&` · from ${c.ip}`,s.length>1&&` and more`]})]}),(0,p.jsx)(e,{asChild:!0,children:(0,p.jsxs)(n,{to:`/approvals`,search:{tab:`access`},children:[`Review `,(0,p.jsx)(r,{})]})})]})})}export{h as n,g as r,m as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ht as t,N as n,Ut as r,Wt as i,_t as a,bt as o,n as s,w as c}from"./queries-Cv3nXx0U.js";import{t as l}from"./useQuery-MrTwwNy5.js";import{t as u}from"./useInfiniteQuery-DJLIM8yJ.js";import{n as d,t as f}from"./data-table-kW1pkRB5.js";import{i as p,n as m,o as h,s as g,t as _}from"./select-Bb806bpq.js";import{C as v,I as y,d as b,o as x,s as S,t as C,w}from"./common-BPZV8TFb.js";import{i as T,n as E,r as D,t as O}from"./audit-bits-CGyIprzK.js";import{t as k}from"./search-CTVKGomS.js";import{X as A}from"./index-DGzo3kGh.js";import{n as j}from"./stream-Du7fY5_Y.js";import{i as M,n as N,t as P}from"./input-group-HG8OXcJ4.js";var F={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};F.node;var I=a(F),L=e(i(),1),R=r(),z=d();function B({entries:e,accounts:t,empty:n}){let r=(0,L.useMemo)(()=>{let e=e=>e?t.find(t=>t.id===e)?.email??e:`—`;return[z.accessor(`ts`,{header:`Time`,cell:e=>(0,R.jsx)(b,{date:e.getValue(),className:`text-xs`}),meta:{className:`w-28`}}),z.display({id:`actor`,header:`Actor`,cell:e=>(0,R.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,R.jsx)(E,{entry:e.row.original}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:hidden`,children:[(0,R.jsx)(O,{action:e.row.original.action}),e.row.original.outcome!==`ok`&&(0,R.jsx)(T,{outcome:e.row.original.outcome})]})]}),meta:{className:`max-w-56`}}),z.accessor(`action`,{header:`Action`,cell:e=>(0,R.jsx)(O,{action:e.getValue()}),meta:{className:`hidden sm:table-cell`}}),z.accessor(`accountId`,{header:`Account`,cell:t=>(0,R.jsx)(`span`,{className:`block max-w-48 truncate text-muted-foreground`,children:e(t.getValue())}),meta:{className:`hidden lg:table-cell`}}),z.accessor(`outcome`,{header:`Outcome`,meta:{className:`hidden whitespace-normal sm:table-cell`},cell:e=>(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(T,{outcome:e.getValue()}),e.row.original.outcome!==`ok`&&e.row.original.reason&&(0,R.jsx)(`span`,{className:`hidden md:inline`,children:(0,R.jsx)(D,{reason:e.row.original.reason,action:e.row.original.action})})]})}),z.accessor(`durationMs`,{header:`Duration`,cell:e=>(0,R.jsx)(`span`,{className:`text-muted-foreground tabular`,children:w(e.getValue())}),meta:{className:`hidden text-right sm:table-cell`}})]},[t]);return(0,R.jsx)(f,{columns:r,data:e,getRowId:e=>String(e.id),empty:n,rowClassName:e=>e.outcome===`denied`?`bg-warning/5`:e.outcome===`error`?`bg-critical/5`:void 0,renderExpanded:e=>(0,R.jsx)(V,{entry:e,email:t.find(t=>t.id===e.accountId)?.email})})}function V({entry:e,email:t}){return(0,R.jsxs)(`div`,{className:`min-w-0 space-y-3 text-sm`,children:[e.reason&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:e.outcome===`denied`?`Blocked by`:`Reason`}),(0,R.jsx)(D,{reason:e.reason,action:e.action})]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs`,children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`When`}),(0,R.jsx)(`dd`,{children:v(e.ts)}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`Actor`}),(0,R.jsxs)(`dd`,{className:`font-mono break-all`,children:[e.actorType,e.actorId&&` · ${e.actorId}`]}),e.accountId&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`Account`}),(0,R.jsx)(`dd`,{className:`break-all`,children:t??e.accountId})]}),e.target&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`Target`}),(0,R.jsx)(`dd`,{className:`font-mono break-all`,children:e.target})]}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`Entry`}),(0,R.jsxs)(`dd`,{className:`font-mono`,children:[`#`,e.id]})]}),e.detail&&Object.keys(e.detail).length>0&&(0,R.jsx)(C,{code:JSON.stringify(e.detail,null,2),wrap:`anywhere`})]})}function H(){let{agentId:e,outcome:r}=A.useSearch(),i=o({from:A.fullPath}),a=t(),[d,f]=(0,L.useState)(``),[v,b]=(0,L.useState)(0),C=l(s.agents()),w=l(s.accounts()),T=s.audit({agentId:e,outcome:r}),E=u(T);j(t=>{t.kind===`audit`&&(e&&t.data.actorId!==e||r&&t.data.outcome!==r||b(e=>e+1))});let D=()=>{b(0),a.resetQueries({queryKey:T.queryKey})},O=e=>{b(0),i({search:t=>({...t,...e}),replace:!0})},F=d.trim().toLowerCase(),z=(E.data?.pages.flatMap(e=>e.items)??[]).filter(e=>!F||e.action.toLowerCase().includes(F)),V=!!(e||r||F);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(x,{title:`Audit log`,description:`Every tool call agents make and every change made in this console. Denied rows show which guardrail blocked the action.`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(_,{value:e??`all`,onValueChange:e=>O({agentId:e===`all`?void 0:e}),children:[(0,R.jsx)(h,{className:`w-full sm:w-52`,"aria-label":`Agent`,children:(0,R.jsx)(g,{})}),(0,R.jsxs)(m,{children:[(0,R.jsx)(p,{value:`all`,children:`All actors`}),C.data?.map(e=>(0,R.jsx)(p,{value:e.id,children:e.name},e.id))]})]}),(0,R.jsxs)(_,{value:r??`all`,onValueChange:e=>O({outcome:e===`all`?void 0:e}),children:[(0,R.jsx)(h,{className:`w-full sm:w-40`,"aria-label":`Outcome`,children:(0,R.jsx)(g,{})}),(0,R.jsxs)(m,{children:[(0,R.jsx)(p,{value:`all`,children:`Any outcome`}),(0,R.jsx)(p,{value:`ok`,children:`OK`}),(0,R.jsx)(p,{value:`denied`,children:`Denied`}),(0,R.jsx)(p,{value:`error`,children:`Error`})]})]}),(0,R.jsxs)(P,{className:`w-full sm:w-60`,children:[(0,R.jsx)(N,{children:(0,R.jsx)(k,{})}),(0,R.jsx)(M,{placeholder:`Filter by action…`,value:d,onChange:e=>f(e.target.value),"aria-label":`Filter by action`})]}),V&&(0,R.jsx)(n,{variant:`ghost`,size:`sm`,onClick:()=>{f(``),O({agentId:void 0,outcome:void 0})},children:`Clear filters`})]}),v>0&&(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsxs)(n,{size:`sm`,variant:`secondary`,onClick:D,className:`rounded-full shadow-sm`,children:[(0,R.jsx)(I,{}),` `,v,` new entr`,v===1?`y`:`ies`]})}),E.isPending?(0,R.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:8},(e,t)=>(0,R.jsx)(y,{className:`h-10`},t))}):E.isError?(0,R.jsx)(S,{error:E.error,onRetry:()=>void E.refetch()}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(B,{entries:z,accounts:w.data??[],empty:V?F&&E.hasNextPage?`No matching entries in the loaded pages. Load more to search further back.`:`No entries match these filters.`:`Nothing recorded yet. Agent tool calls and console changes will show up here.`}),E.hasNextPage&&(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsxs)(n,{variant:`outline`,onClick:()=>void E.fetchNextPage(),disabled:E.isFetchingNextPage,children:[E.isFetchingNextPage&&(0,R.jsx)(c,{}),` Load older entries`]})})]})]})}export{H as component};
@@ -0,0 +1 @@
1
+ import{Ut as e,_t as t}from"./queries-Cv3nXx0U.js";import{t as n}from"./bot-Zk76q_39.js";import{f as r}from"./common-BPZV8TFb.js";import{l as i,n as a}from"./labels-B5UqVwFo.js";var o={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};o.node;var s=t(o),c={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};c.node;var l=t(c),u=e();function d({outcome:e}){let t=a[e];return(0,u.jsx)(r,{tone:t.tone,children:t.label})}function f({entry:e}){let t=e.actorType===`agent`?n:e.actorType===`admin`?l:s,r=e.actorType===`admin`?`Admin`:e.actorType===`system`?e.actorName??`System`:e.actorName??e.actorId??`Unknown agent`;return(0,u.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,u.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,u.jsx)(`span`,{className:`truncate`,children:r})]})}function p({reason:e,action:t}){if(!e)return null;let n=t?.startsWith(`pairing.`)&&e===`rate_limit`?`Too many requests from this address`:i[e];return(0,u.jsxs)(`span`,{className:`inline-flex max-w-full flex-wrap items-baseline gap-x-1.5 rounded-md bg-warning/15 px-1.5 py-0.5 text-xs`,children:[(0,u.jsx)(`code`,{className:`font-mono break-all`,children:e}),n&&(0,u.jsx)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:n})]})}function m({action:e}){return(0,u.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})}export{d as i,f as n,p as r,m as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{D as e,Ht as t,N as n,Ut as r,n as i,t as a}from"./queries-Cv3nXx0U.js";import{t as o}from"./useQuery-MrTwwNy5.js";import{t as s}from"./calendar-plus-Cycfkk0y.js";import{c,d as l,l as u,u as d}from"./card-GSO5o-Ug.js";import{a as f,m as p}from"./common-BPZV8TFb.js";import{Et as m,Ot as h}from"./index-DGzo3kGh.js";import{t as g}from"./mutations-CLPqJ6cj.js";import{i as _,o as v}from"./calendar-setup-Pn61Wj1n.js";var y=r(),b={error:l,warning:m,info:h},x={error:`destructive`,warning:`warning`,info:`info`};function S({className:r}){let l=t(),m=o(i.setupState()),h=g({mutationFn:()=>e(`/api/google/calendar`,{method:`PATCH`,body:{dismissed:!0}}),invalidate:[a.setupState],success:`Hidden. Add Google Calendar any time from Settings or Accounts.`,errorTitle:`Couldn't hide the notice`,onSuccess:e=>l.setQueryData(a.calendarSetup,e)}),S=v(m.data?.warnings??[]);if(!S)return null;let C=S.code===`calendar_not_added`?s:b[S.severity];return(0,y.jsxs)(c,{variant:x[S.severity],className:r,children:[(0,y.jsx)(C,{}),(0,y.jsx)(d,{children:S.title}),(0,y.jsxs)(u,{className:`space-y-2`,children:[(0,y.jsx)(`p`,{children:p(S.body)}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[S.action&&(0,y.jsx)(n,{size:`sm`,variant:S.severity===`info`?`default`:`outline`,onClick:()=>_(S.action?.page),children:S.action.label}),S.url&&(0,y.jsx)(f,{href:S.url,children:`Open in Google Cloud`}),S.dismissible&&(0,y.jsx)(n,{size:`sm`,variant:`ghost`,disabled:h.isPending,onClick:()=>h.mutate(),children:`Not now`})]})]})]})}export{S as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`calendar-plus`,size:24,node:[[`path`,{d:`M16 18h6`,key:`987eiv`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M19 15v6`,key:`10aioa`}],[`path`,{d:`M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3`,key:`jgwkxf`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,D as n,Ht as r,N as i,Ut as a,Wt as o,ft as s,n as c,t as l,w as u,yt as d}from"./queries-Cv3nXx0U.js";import{t as f}from"./useQuery-MrTwwNy5.js";import{t as p}from"./calendar-plus-Cycfkk0y.js";import{c as m,d as h,l as g,u as _}from"./card-GSO5o-Ug.js";import{I as v,L as y,f as b,i as x,m as S,s as ee,t as C}from"./common-BPZV8TFb.js";import{a as w,d as T,f as E,n as te,s as D,u as O}from"./connect-host-lr2c3xWh.js";import{Dt as ne,it as k,kt as A,x as j}from"./index-DGzo3kGh.js";import{a as M,i as N,n as P,o as F,r as I,s as re}from"./mutations-CLPqJ6cj.js";var L=e(o(),1),R=[`api`,`scopes`,`accounts`];function ie(e){return e.step===`off`||e.step===`enable_api`?`api`:`accounts`}var z={"https://www.googleapis.com/auth/calendar.events":`events`,"https://www.googleapis.com/auth/calendar.calendarlist.readonly":`calendar list`,"https://www.googleapis.com/auth/calendar.events.freebusy":`free/busy`};function B(e){let t=e.map(e=>z[e]??e);return t.length<=1?t[0]??``:`${t.slice(0,-1).join(`, `)} and ${t.at(-1)}`}var V=e=>e.missingScopes.length>=Object.keys(z).length,H=`Mail works as usual.`;function U(e,t){switch(e.status){case`active`:return{label:`Calendar`,tone:`good`,description:e.syncedCalendars>0?`Google Calendar is added. ${e.syncedCalendars===1?`1 calendar syncs`:`${e.syncedCalendars} calendars sync`} ${e.push?`in real time`:`by polling`}.`:`Google Calendar is added. Agents can use it once their access includes Calendar.`,fix:null};case`api_disabled`:return{label:`Calendar API off`,tone:`bad`,description:`The Google Calendar API is turned off in the Google Cloud project. ${H}`,fix:`enable_api`};case`error`:return{label:`Calendar error`,tone:`bad`,description:`${e.error??`Calendar sync failed.`} It retries on the next poll. ${H}`,fix:null};case`not_granted`:return V(e)?t?{label:`No Calendar yet`,tone:`warn`,description:`Google Calendar isn't added to this account yet. ${H}`,fix:`consent`}:{label:`Mail only`,tone:`idle`,description:`Google Calendar isn't added to this account. ${H}`,fix:`consent`}:{label:`Calendar: partly allowed`,tone:`warn`,description:`Google wasn't allowed ${B(e.missingScopes)} for this account (a box was unticked). ${H}`,fix:`consent`}}}function W(e,t){return e?{active:`added`,api_disabled:`api_disabled`,error:`error`,not_granted:V(e)?t?`declined`:`not_finished`:`partial`}[e.status]:`not_finished`}var G={added:{title:e=>`Google Calendar is added to ${e}`,tone:`good`,body:`Mail kept working throughout.`},partial:{title:e=>`Some Calendar permissions weren't allowed for ${e}`,tone:`warn`,body:`Google's screen has a checkbox per permission and one was unticked. Try again and tick every Calendar box (or Select all). Mail works as usual.`},declined:{title:e=>`Calendar wasn't allowed for ${e}`,tone:`warn`,body:`The Calendar boxes on Google's screen were unticked. Try again and tick them (or Select all). Mail works as usual.`},not_finished:{title:e=>`Calendar isn't added to ${e} yet`,tone:`idle`,body:`The Google sign-in didn't finish. Nothing changed: mail works as usual. Try again when you're ready.`},api_disabled:{title:()=>`Google says the Calendar API is still off`,tone:`bad`,body:`The permissions are granted, but the Calendar API isn't enabled in the project yet. Turn it on (step 1), wait a minute, then check again. Mail works as usual.`},error:{title:e=>`Calendar is added to ${e}, but Google answered with an error`,tone:`bad`,body:`xaq retries on the next poll. Mail works as usual.`}};function K(e){return!!e?.enabled&&e.api!==`disabled`}var q=[`calendar_api_disabled`,`calendar_sync_failing`,`calendar_scope_missing`,`calendar_not_added`],J=e=>q.includes(e.code);function ae(e){let t=e.filter(J),n=e=>t.find(t=>t.code===e),r=n(`calendar_api_disabled`);if(r)return{code:r.code,severity:r.severity,title:r.message,body:r.hint,url:r.url,action:{label:`Turn on the Calendar API`,page:`api`},dismissible:!1};let i=t.filter(e=>e.code===`calendar_sync_failing`);if(i.length)return{code:`calendar_sync_failing`,severity:`error`,title:i.length===1?i[0].message:`Calendar sync is failing for ${i.length} accounts`,body:i.length===1?i[0].hint:i.map(e=>e.message).join(` `),action:null,dismissible:!1};let a=t.filter(e=>e.code===`calendar_scope_missing`);if(a.length)return{code:`calendar_scope_missing`,severity:a.some(e=>e.severity===`error`)?`error`:`warning`,title:a.length===1?a[0].message:`${a.length} accounts don't have Google Calendar yet`,body:`Mail works as usual on them. Add Calendar to each with a short Google sign-in that asks only for the Calendar permissions.`,action:{label:`Add Calendar to accounts`,page:`accounts`},dismissible:!1};let o=n(`calendar_not_added`);return o?{code:o.code,severity:`info`,title:`New: Google Calendar for your agents`,body:`Agents can read your calendars, find free time, schedule events and answer invitations, with the same per-agent access rules and approvals as mail. Adding it takes a few minutes and never interrupts mail.`,action:{label:`Add Google Calendar`},dismissible:!0}:null}var Y=a(),oe={api:`Calendar API`,scopes:`Sign-in screen`,accounts:`Accounts`},X=null;function Z(e){X?.({page:e})}function se(e){X?.({consent:e})}var Q=e=>n(`/api/google/calendar`,{method:`PATCH`,body:e}),ce=()=>n(`/api/google/calendar/check`,{method:`POST`});function le(){let e=r(),[n,a]=(0,L.useState)(!1),[o,d]=(0,L.useState)(`api`),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),_=f({...c.calendarSetup(),enabled:n}),y=f(c.setupState()),b=t=>{e.setQueryData(l.calendarSetup,t);for(let t of[l.setupState,l.accounts])e.invalidateQueries({queryKey:t})},x=async()=>{g(`check`);try{let e=await ce();return b(e),e}catch(n){return t(n,`Couldn't check Google Calendar`),e.invalidateQueries({queryKey:l.calendarSetup}),null}finally{g(null)}},S=async(e,t)=>{d(`accounts`),a(!0);let n=await x();m({accountId:e.id,email:e.email,confirmed:t}),n&&W(n.accounts.find(t=>t.accountId===e.id),t)===`api_disabled`&&d(`api`)},C=e=>{m(null),a(!1),te({reauthAccountId:e.id,email:e.email,scopes:[`calendar`],handBack:!0,onDone:t=>void S(e,t),onCancel:t=>void S(e,t?.code===`oauth_calendar_not_granted`)})},w=(0,L.useRef)(()=>{});(0,L.useEffect)(()=>{w.current=t=>{let n=e.getQueryData(l.calendarSetup);if(`consent`in t&&K(n))return C(t.consent);m(null),d(`page`in t&&t.page||(n?ie(n):`api`)),a(!0)}}),(0,L.useEffect)(()=>(X=e=>w.current(e),()=>{X=null}),[]);let T=async()=>{if(_.data&&!_.data.enabled){g(`enable`);try{b(await Q({enabled:!0}))}catch(e){return t(e,`Couldn't turn on Google Calendar`)}finally{g(null)}}d(`accounts`)},E=async()=>{if(!_.data?.enabled)return d(`scopes`);_.data.api===`disabled`&&await x(),d(`accounts`)},D=_.data,O=R.indexOf(o),k=y.data?.gcpProjectId??null,A=y.data?.warnings.find(e=>e.code===`calendar_api_disabled`);return(0,Y.jsx)(P,{open:n,onOpenChange:a,children:(0,Y.jsxs)(I,{className:`max-h-[90vh] overflow-y-auto sm:max-w-xl`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsx)(re,{children:`Add Google Calendar`}),(0,Y.jsx)(N,{children:`Three short steps. Mail keeps working throughout, and agents get Calendar only once you add it to their access.`})]}),(0,Y.jsx)(`ol`,{className:`grid grid-cols-3 gap-1.5`,"aria-label":`Steps`,children:R.map((e,t)=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>e===`accounts`?void T():d(e),disabled:!D,"aria-current":e===o?`step`:void 0,className:s(`w-full space-y-1.5 rounded-sm text-left text-xs text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,e===o&&`font-medium text-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:s(`block h-1 rounded-full`,t<=O?`bg-primary`:`bg-muted`)}),(0,Y.jsxs)(`span`,{className:`block`,children:[(0,Y.jsxs)(`span`,{className:`tabular`,children:[t+1,`.`]}),` `,oe[e]]})]})},e))}),_.isPending?(0,Y.jsx)(v,{className:`h-48 rounded-lg`}):_.isError?(0,Y.jsx)(ee,{error:_.error,onRetry:()=>void _.refetch()}):o===`api`?(0,Y.jsx)($,{s:_.data,project:k,warningUrl:A?.url,result:p}):o===`scopes`?(0,Y.jsx)(ue,{s:_.data,appType:y.data?.googleAppType??null,project:k}):(0,Y.jsx)(de,{s:_.data,result:p,checking:h===`check`,onConsent:C,onApi:()=>d(`api`),onDone:()=>a(!1)}),(0,Y.jsxs)(M,{className:`gap-2 sm:justify-between`,children:[(0,Y.jsx)(i,{variant:`ghost`,onClick:()=>O>0?d(R[O-1]):a(!1),children:O>0?`Back`:`Close`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(o===`accounts`||D?.api===`disabled`)&&(0,Y.jsxs)(i,{variant:`outline`,disabled:!D||h!==null,onClick:()=>void x(),children:[h===`check`?(0,Y.jsx)(u,{}):(0,Y.jsx)(ne,{}),` Check again`]}),o===`api`&&(0,Y.jsx)(i,{disabled:!D||h!==null,onClick:()=>void E(),children:D?.api===`disabled`?`It's on now, continue`:`Done, continue`}),o===`scopes`&&(0,Y.jsxs)(i,{disabled:!D||h!==null,onClick:()=>void T(),children:[h===`enable`&&(0,Y.jsx)(u,{}),` Continue`]}),o===`accounts`&&(0,Y.jsx)(i,{onClick:()=>a(!1),children:D?.step===`done`?`Done`:`Finish later`})]})]})]})})}function $({s:e,project:t,warningUrl:n,result:r}){let i=n??e.enableApiUrl??(t?j.enableCalendar(t):`https://console.cloud.google.com/flows/enableapi?apiid=calendar-json.googleapis.com`),a=e.enableApiCommand??`gcloud services enable calendar-json.googleapis.com`;return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[e.api===`disabled`&&(0,Y.jsxs)(m,{variant:`destructive`,children:[(0,Y.jsx)(h,{}),(0,Y.jsx)(_,{children:r?G.api_disabled.title(r.email):`Google says the Calendar API is off in the project`}),(0,Y.jsx)(g,{children:(0,Y.jsx)(`p`,{children:`Turn it on below, wait a minute, then click Check again. Mail works as usual meanwhile.`})})]}),(0,Y.jsx)(O,{children:(0,Y.jsxs)(T,{title:(0,Y.jsxs)(Y.Fragment,{children:[`Enable the Google Calendar API`,t?(0,Y.jsxs)(Y.Fragment,{children:[` in `,(0,Y.jsx)(`code`,{className:`font-mono`,children:t})]}):null]}),done:e.api===`enabled`,expect:(0,Y.jsxs)(Y.Fragment,{children:[`“API enabled” on the Google Calendar API page (or a `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Manage`}),` button, if it already was).`]}),children:[(0,Y.jsxs)(`p`,{children:[`Open the link (it preselects the project), confirm the project, then click `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Next`}),` and`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Enable`}),`.`]}),(0,Y.jsx)(w,{href:i,variant:`default`,children:`Enable the Calendar API`}),(0,Y.jsx)(`p`,{children:`Or run this in Cloud Shell:`}),(0,Y.jsx)(C,{code:a,wrap:!0,copyLabel:`Copy command`}),e.api===`unknown`&&(0,Y.jsx)(`p`,{className:`text-xs`,children:`xaq can only confirm this once an account has Calendar access (step 3), so continue once it's enabled.`})]})})]})}function ue({s:e,appType:t,project:n}){let r=e.dataAccessUrl??(n?j.authScopes(n):null);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(y,{variant:`outline`,children:t===`external`?`Recommended`:`Optional`}),t===`external`?`Your app is External: listing the scopes makes Google's sign-in screen name them.`:`Your app is Internal: this only changes what Google Cloud lists. Skip it if you like.`]}),(0,Y.jsx)(O,{children:(0,Y.jsxs)(T,{title:`Add the three Calendar scopes on the Data Access page`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(E,{items:[`Google Auth Platform`,`Data Access`,`Add or remove scopes`]}),`, paste these under “Manually add scopes”, then`,` `,(0,Y.jsx)(E,{items:[`Add to table`,`Update`,`Save`]}),`.`]}),(0,Y.jsx)(C,{code:e.scopes.join(`
2
+ `),wrap:!0,copyLabel:`Copy scopes`}),r?(0,Y.jsx)(w,{href:r,children:`Open Data Access`}):(0,Y.jsx)(`p`,{className:`text-xs`,children:`Open your project in Google Cloud first.`}),(0,Y.jsx)(D,{children:`the three scopes under “Your sensitive scopes” after Save.`})]})}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Google doesn't tell xaq whether this was done. Continue turns Calendar on: from then on, connecting or reconnecting an account asks for Calendar too.`})]})}function de({s:e,result:t,checking:n,onConsent:r,onApi:a,onDone:o}){let l=f(c.accounts()),h=e=>l.data?.find(t=>t.id===e);return e.accounts.length?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`One short Google sign-in per account. Google asks only for the Calendar permissions; Gmail and real-time delivery stay as they are, and mail keeps arriving while you do it.`}),(0,Y.jsx)(`ul`,{className:`divide-y rounded-lg border`,children:e.accounts.map(o=>{let c=U({...o,error:h(o.accountId)?.calendar?.error},e.enabled),l=t?.accountId===o.accountId,d=l?W(o,t.confirmed):null,f=d?G[d]:null,m=h(o.accountId)?.status===`needs_reauth`;return(0,Y.jsxs)(`li`,{className:`space-y-2 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:o.email}),l&&n?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,role:`status`,children:[(0,Y.jsx)(u,{}),` Checking with Google…`]}):o.status===`active`?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-success`,children:[(0,Y.jsx)(A,{className:`size-4`}),` Calendar added`]}):(0,Y.jsx)(b,{tone:c.tone,children:c.label}),c.fix===`consent`&&(0,Y.jsxs)(i,{size:`sm`,variant:l?`outline`:`default`,disabled:n,onClick:()=>r({id:o.accountId,email:o.email}),children:[(0,Y.jsx)(p,{}),` `,l?`Try again`:`Add Calendar`]}),c.fix===`enable_api`&&(0,Y.jsx)(i,{size:`sm`,variant:`outline`,onClick:a,children:`Turn on the API`})]}),f&&!n?(0,Y.jsxs)(`p`,{className:s(`text-xs`,f.tone===`good`?`text-success`:f.tone===`bad`?`text-critical`:`text-muted-foreground`),role:`status`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[f.title(o.email),`.`]}),` `,f.body]}):o.status===`active`?null:(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c.description,m&&` Its Google sign-in also needs renewing: this sign-in does both.`]})]},o.accountId)})}),e.step===`done`&&(0,Y.jsxs)(m,{variant:`success`,children:[(0,Y.jsx)(A,{}),(0,Y.jsx)(_,{children:`Google Calendar is added`}),(0,Y.jsxs)(g,{children:[(0,Y.jsxs)(`p`,{children:[`Next, choose which agents may use it: open an agent, then `,(0,Y.jsx)(E,{items:[`Access`,`Calendar`]}),`. Reading and writing are separate, and writes can wait for your approval.`]}),(0,Y.jsx)(`div`,{className:`pt-1`,children:(0,Y.jsx)(i,{size:`sm`,variant:`outline`,asChild:!0,onClick:o,children:(0,Y.jsx)(d,{to:`/agents`,children:`Go to Agents`})})})]})]})]}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts are connected yet. Accounts you connect from now on get Calendar with the same sign-in.`})}function fe(){let e=r(),t=f(c.calendarSetup()),n=()=>k({title:`Turn off Google Calendar?`,confirmLabel:`Turn off`,description:(0,Y.jsx)(`p`,{children:`Connecting and reconnecting accounts asks for Gmail only again. Calendar access accounts already granted stays with them. Turn it back on any time with Add Google Calendar.`}),onConfirm:async()=>{e.setQueryData(l.calendarSetup,await Q({enabled:!1})),e.invalidateQueries({queryKey:l.setupState})}});if(t.isPending)return(0,Y.jsx)(v,{className:`h-10 rounded-lg`});if(t.isError)return(0,Y.jsx)(x,{error:t.error,title:`Couldn't load the Google Calendar setup`});let a=t.data,o=a.accounts.filter(e=>e.status===`active`).length,s=a.enabled?a.step===`enable_api`?`Google says the Calendar API is off in the project.`:a.accounts.length?`Added to ${o} of ${a.accounts.length} account${a.accounts.length===1?``:`s`}.`:`On: accounts you connect get Calendar too.`:`Not added. Agents use Gmail only.`;return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm`,children:S(s)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a.enabled&&(0,Y.jsx)(i,{type:`button`,variant:`ghost`,onClick:n,children:`Turn off`}),(0,Y.jsxs)(i,{type:`button`,variant:a.step===`done`?`outline`:`default`,onClick:()=>Z(),children:[(0,Y.jsx)(p,{}),` `,a.enabled?a.step===`done`?`Review`:`Continue setup`:`Add Google Calendar`]})]})]})}export{U as a,Z as i,fe as n,ae as o,se as r,le as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{Ut as e,Wt as t,_t as n,ft as r,pt as i}from"./queries-Cv3nXx0U.js";var a={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};a.node;var o=n(a);t();var s=e(),c=i(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`,warning:`border-warning/40 bg-warning/10 text-foreground *:data-[slot=alert-description]:text-foreground/80 *:[svg]:text-warning`,success:`border-success/30 bg-success/10 text-foreground *:data-[slot=alert-description]:text-foreground/80 *:[svg]:text-success`,info:`border-chart-1/30 bg-chart-1/5 text-foreground *:data-[slot=alert-description]:text-foreground/80 *:[svg]:text-chart-1`}},defaultVariants:{variant:`default`}});function l({className:e,variant:t,...n}){return(0,s.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:r(c({variant:t}),e),...n})}function u({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`alert-title`,className:r(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function d({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`alert-description`,className:r(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function f({className:e,size:t=`default`,...n}){return(0,s.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:r(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function p({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-header`,className:r(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function m({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-title`,className:r(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function h({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function g({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-action`,className:r(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function _({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-content`,className:r(`px-(--card-spacing)`,e),...t})}function v({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`card-footer`,className:r(`flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)`,e),...t})}export{v as a,l as c,o as d,h as i,d as l,g as n,p as o,_ as r,m as s,f as t,u};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`check-check`,size:24,node:[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Ut as n,Wt as r,at as i,dt as a,et as o,ft as s,gt as c,it as l,tt as u,z as d}from"./queries-Cv3nXx0U.js";var f=e(r(),1),p=n(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Checkbox`,[_,v]=l(g),[y,b]=_(g);function x(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:s,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:m}=e,[h,_]=o({prop:n,defaultProp:i??!1,onChange:l,caller:g}),[v,b]=f.useState(null),[x,S]=f.useState(null),[C,w]=f.useState(null),T=!v||!!s||!!v.closest(`form`),E={checked:h,disabled:a,setChecked:_,control:v,setControl:b,name:c,form:s,value:d,userClick:C,onUserClick:w,required:u,defaultChecked:!A(i)&&i,isFormControl:T,bubbleInput:x,setBubbleInput:S};return(0,p.jsx)(y,{scope:t,...E,children:k(m)?m(E):r})}h(x,`CheckboxProvider`);var S=`CheckboxTrigger`,C=f.forwardRef(h(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o){let{control:s,value:c,disabled:l,checked:d,required:m,setControl:g,setChecked:_,onUserClick:v,isFormControl:y,bubbleInput:x}=b(S,e),C=a(o,g),w=f.useRef(d);return f.useEffect(()=>{let e=s?.form;if(e){let t=h(()=>_(w.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[s,_]),(0,p.jsx)(i.button,{type:`button`,role:`checkbox`,"aria-checked":A(d)?`mixed`:d,"aria-required":m,"data-state":j(d),"data-disabled":l?``:void 0,disabled:l,value:c,...r,ref:C,onKeyDown:u(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:u(n,e=>{let t=e.isPropagationStopped();v({requestedChecked:A(d)?!0:!d,hasConsumerStoppedPropagation:t}),_(e=>A(e)?!0:!e),x&&y&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),w=f.forwardRef(h(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(x,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(C,{...d,ref:t,__scopeCheckbox:n}),e&&(0,p.jsx)(O,{__scopeCheckbox:n})]})})},`Checkbox`)),T=`CheckboxIndicator`,E=f.forwardRef(h(function(e,n){let{__scopeCheckbox:r,forceMount:a,...o}=e,s=b(T,r);return(0,p.jsx)(t,{present:a||A(s.checked)||s.checked===!0,children:(0,p.jsx)(i.span,{"data-state":j(s.checked),"data-disabled":s.disabled?``:void 0,...o,ref:n,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),D=`CheckboxBubbleInput`,O=f.forwardRef(h(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:o,userClick:s,checked:c,defaultChecked:l,required:m,disabled:h,name:g,value:_,form:v,bubbleInput:y,setBubbleInput:x}=b(D,e),S=a(r,x),C=d(o),w=f.useRef(!1),T=f.useRef(c),E=f.useRef(s),O=f.useRef(null);f.useEffect(()=>{let e=y;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=T.current!==c;T.current=c;let i=s!==null&&s!==E.current;if(E.current=s,i)O.current=r?null:s,r&&(e.indeterminate=A(c),n.call(e,!A(c)&&c)),e.dispatchEvent(new Event(`click`,{bubbles:!s.hasConsumerStoppedPropagation}));else if(r){let t=O.current;O.current=null;let r=t?.requestedChecked===c;w.current=!0,e.indeterminate=A(c),n.call(e,!A(c)&&c),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),w.current=!1}},[y,c,s]);let k=f.useRef(!A(c)&&c);return(0,p.jsx)(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:l??k.current,required:m,disabled:h,name:g,value:_,form:v,...n,tabIndex:-1,ref:S,onClick:u(t,e=>{w.current&&e.stopPropagation()}),style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function k(e){return typeof e==`function`}h(k,`isFunction`);function A(e){return e===`indeterminate`}h(A,`isIndeterminate`);function j(e){return A(e)?`indeterminate`:e?`checked`:`unchecked`}h(j,`getState`);function M({className:e,...t}){return(0,p.jsx)(w,{"data-slot":`checkbox`,className:s(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,p.jsx)(E,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,p.jsx)(c,{})})})}export{M as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ut as t,Wt as n,at as r,dt as i,et as a,ft as o,it as s,tt as c,z as l}from"./queries-Cv3nXx0U.js";import{t as u}from"./x-MF2TZ9aG.js";import{L as d}from"./common-BPZV8TFb.js";var f=e(n(),1),p=t(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Switch`,[_,v]=s(g),[y,b]=_(g);function x(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:m}=e,[h,_]=a({prop:n,defaultProp:i??!1,onChange:l,caller:g}),[v,b]=f.useState(null),[x,S]=f.useState(null),[C,w]=f.useState(null),T={checked:h,setChecked:_,disabled:o,control:v,setControl:b,name:c,form:s,value:d,userClick:C,onUserClick:w,required:u,defaultChecked:i,isFormControl:!v||!!s||!!v.closest(`form`),bubbleInput:x,setBubbleInput:S};return(0,p.jsx)(y,{scope:t,...T,children:k(m)?m(T):r})}h(x,`SwitchProvider`);var S=`SwitchTrigger`,C=f.forwardRef(h(function({__scopeSwitch:e,onClick:t,...n},a){let{control:o,form:s,value:l,disabled:u,checked:d,required:m,setControl:g,setChecked:_,onUserClick:v,isFormControl:y,bubbleInput:x}=b(S,e),C=i(a,g),w=f.useRef(d);return f.useEffect(()=>{let e=s?o?.ownerDocument.getElementById(s):o?.form;if(e instanceof HTMLFormElement){let t=h(()=>_(w.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,s,_]),(0,p.jsx)(r.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":m,"data-state":A(d),"data-disabled":u?``:void 0,disabled:u,value:l,...n,ref:C,onClick:c(t,e=>{let t=e.isPropagationStopped();v({requestedChecked:!d,hasConsumerStoppedPropagation:t}),_(e=>!e),x&&y&&(t||e.stopPropagation())})})},`SwitchTrigger`)),w=f.forwardRef(h(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(x,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(C,{...d,ref:t,__scopeSwitch:n}),e&&(0,p.jsx)(O,{__scopeSwitch:n})]})})},`Switch`)),T=`SwitchThumb`,E=f.forwardRef(h(function(e,t){let{__scopeSwitch:n,...i}=e,a=b(T,n);return(0,p.jsx)(r.span,{"data-state":A(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})},`SwitchThumb`)),D=`SwitchBubbleInput`,O=f.forwardRef(h(function({__scopeSwitch:e,onClick:t,...n},a){let{control:o,userClick:s,checked:u,defaultChecked:d,required:m,disabled:h,name:g,value:_,form:v,bubbleInput:y,setBubbleInput:x}=b(D,e),S=i(a,x),C=l(o),w=f.useRef(!1),T=f.useRef(u),E=f.useRef(s),O=f.useRef(null);f.useEffect(()=>{let e=y;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=T.current!==u;T.current=u;let i=s!==null&&s!==E.current;if(E.current=s,i)O.current=r?null:s,r&&n.call(e,u),e.dispatchEvent(new Event(`click`,{bubbles:!s.hasConsumerStoppedPropagation}));else if(r){let t=O.current;O.current=null;let r=t?.requestedChecked===u;w.current=!0,n.call(e,u),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),w.current=!1}},[y,u,s]);let k=f.useRef(u);return(0,p.jsx)(r.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:d??k.current,required:m,disabled:h,name:g,value:_,form:v,...n,tabIndex:-1,ref:S,onClick:c(t,e=>{w.current&&e.stopPropagation()}),style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function k(e){return typeof e==`function`}h(k,`isFunction`);function A(e){return e?`checked`:`unchecked`}h(A,`getState`);function j({className:e,size:t=`default`,...n}){return(0,p.jsx)(w,{"data-slot":`switch`,"data-size":t,className:o(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,p.jsx)(E,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function M({id:e,value:t,onChange:n,placeholder:r,validate:i,className:a,onPendingChange:s,"aria-describedby":c}){let[l,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(null),_=!!l.trim(),v=(0,f.useRef)(s);(0,f.useEffect)(()=>{v.current=s}),(0,f.useEffect)(()=>{v.current?.(_)},[_]),(0,f.useEffect)(()=>()=>v.current?.(!1),[]);let y=e=>{let r=e.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean);if(!r.length)return!0;for(let e of r){let t=i?.(e)??null;if(t)return g(`${e}: ${t}`),!1}return n([...new Set([...t,...r])]),m(``),g(null),!0};return(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsxs)(`div`,{className:o(`flex min-h-8 w-full flex-wrap items-center gap-1 rounded-lg border border-input px-1.5 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring dark:bg-input/30`,h&&`border-destructive ring-3 ring-destructive/20`,a),onClick:e=>e.currentTarget.querySelector(`input`)?.focus(),children:[t.map(e=>(0,p.jsxs)(d,{variant:`secondary`,className:`h-6 gap-1 pr-1 font-mono text-xs font-normal`,children:[e,(0,p.jsx)(`button`,{type:`button`,className:`rounded-sm p-0.5 text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,"aria-label":`Remove ${e}`,onClick:()=>n(t.filter(t=>t!==e)),children:(0,p.jsx)(u,{className:`size-3`})})]},e)),(0,p.jsx)(`input`,{id:e,className:`h-6 min-w-32 flex-1 bg-transparent px-1 font-mono text-sm outline-none placeholder:font-sans placeholder:text-muted-foreground`,value:l,placeholder:t.length?``:r,"aria-invalid":!!h,"aria-describedby":c,onChange:e=>{m(e.target.value),g(null)},onKeyDown:e=>{e.key===`Enter`||e.key===`,`||e.key===` `&&l.trim()?(e.preventDefault(),y(l)):e.key===`Backspace`&&!l&&t.length&&n(t.slice(0,-1))},onBlur:()=>l.trim()&&y(l),onPaste:e=>{let t=e.clipboardData.getData(`text`);/[\s,;]/.test(t)&&(e.preventDefault(),y(l+t))}})]}),h?(0,p.jsx)(`p`,{className:`text-xs text-destructive`,children:h}):_&&(0,p.jsxs)(`p`,{className:`text-xs text-warning`,children:[`Press Enter to add “`,l.trim(),`”, or clear it.`]})]})}export{j as n,M as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ut as t,Wt as n,Z as r,at as i,dt as a,et as o,ft as s,it as c,tt as l,z as u}from"./queries-Cv3nXx0U.js";import{ht as d,mt as f,pt as p}from"./index-DGzo3kGh.js";var m=e(n(),1),h=t(),g=Object.defineProperty,_=(e,t)=>g(e,`name`,{value:t,configurable:!0}),v=`Radio`,[y,b]=c(v),[x,S]=y(v);function C(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=m.useState(null),[p,g]=m.useState(null),[v,y]=m.useState(null),b={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,userClick:v,onUserClick:y,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:g,onCheck:_(()=>s?.(),`onCheck`)};return(0,h.jsx)(x,{scope:t,...b,children:O(u)?u(b):r})}_(C,`RadioProvider`);var w=`RadioTrigger`,T=m.forwardRef(_(function({__scopeRadio:e,onClick:t,...n},r){let{checked:o,disabled:s,value:c,setControl:u,onCheck:d,onUserClick:f,isFormControl:p,bubbleInput:m}=S(w,e),g=a(r,u);return(0,h.jsx)(i.button,{type:`button`,role:`radio`,"aria-checked":o,"data-state":k(o),"data-disabled":s?``:void 0,disabled:s,value:c,...n,ref:g,onClick:l(t,e=>{let t=e.isPropagationStopped();o||(f({hasConsumerStoppedPropagation:t}),d()),m&&p&&(t||e.stopPropagation())})})},`RadioTrigger`)),E=`RadioBubbleInput`,D=m.forwardRef(_(function({__scopeRadio:e,onClick:t,...n},r){let{control:o,checked:s,required:c,disabled:d,name:f,value:p,form:g,bubbleInput:_,setBubbleInput:v,userClick:y}=S(E,e),b=a(r,v),x=u(o),C=m.useRef(!1),w=m.useRef(s),T=m.useRef(y),D=m.useRef(null);m.useEffect(()=>{let e=_;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=w.current!==s;w.current=s;let i=y!==null&&y!==T.current;if(T.current=y,i)D.current=r?null:y,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!y.hasConsumerStoppedPropagation}));else if(r){let t=D.current;D.current=null;let r=s&&t!==null;C.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),C.current=!1}},[_,s,y]);let O=m.useRef(s);return(0,h.jsx)(i.input,{type:`radio`,"aria-hidden":!0,defaultChecked:O.current,required:c,disabled:d,name:f,value:p,form:g,...n,tabIndex:-1,ref:b,onClick:l(t,e=>{C.current&&e.stopPropagation()}),style:{...n.style,...x,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function O(e){return typeof e==`function`}_(O,`isFunction`);function k(e){return e?`checked`:`unchecked`}_(k,`getState`);var A=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],j=`RadioGroup`,[M,N]=c(j,[d,b]),P=d(),F=b(),[I,L]=M(j),R=m.forwardRef(_(function(e,t){let{__scopeRadioGroup:n,name:s,form:c,defaultValue:l,value:u,required:d=!1,disabled:f=!1,orientation:g,dir:v,loop:y=!0,onValueChange:b,...x}=e,S=P(n),C=r(v),[w,T]=o({prop:u,defaultProp:l??null,onChange:b,caller:j}),[E,D]=m.useState(null),O=a(t,D),k=m.useRef(w);return m.useEffect(()=>{let e=c?E?.ownerDocument.getElementById(c):E?.closest(`form`);if(e instanceof HTMLFormElement){let t=_(()=>T(k.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[E,c,T]),(0,h.jsx)(I,{scope:n,name:s,form:c,required:d,disabled:f,value:w,onValueChange:T,children:(0,h.jsx)(p,{asChild:!0,...S,orientation:g,dir:C,loop:y,children:(0,h.jsx)(i.div,{role:`radiogroup`,"aria-required":d,"aria-orientation":g,"data-disabled":f?``:void 0,dir:C,...x,ref:O})})})},`RadioGroup`)),z=`RadioGroupItemProvider`,B=`RadioGroupItemTrigger`;function V(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=L(z,t),s=F(t),c=o.disabled||r;return(0,h.jsx)(C,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}_(V,`RadioGroupItemProvider`);var H=m.forwardRef(_(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=P(n),o=F(n),{checked:s,disabled:c}=S(B,o.__scopeRadio),u=m.useRef(null),d=a(t,u),p=m.useRef(!1);return m.useEffect(()=>{let e=_(e=>{A.includes(e.key)&&(p.current=!0)},`handleKeyDown`),t=_(()=>p.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,h.jsx)(f,{asChild:!0,...i,focusable:!c,active:s,children:(0,h.jsx)(T,{...o,...r,ref:d,onKeyDown:l(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:l(r.onFocus,()=>{p.current&&u.current?.click()})})})},`RadioGroupItemTrigger`)),U=m.forwardRef(_(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,h.jsx)(V,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(H,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,h.jsx)(W,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),W=m.forwardRef(_(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=F(n);return(0,h.jsx)(D,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`));function G({value:e,onChange:t,choices:n,className:r,columns:i=1,"aria-label":a}){return(0,h.jsx)(R,{value:e??``,onValueChange:e=>t(e),"aria-label":a,className:s(`grid gap-2`,i===2&&`sm:grid-cols-2`,r),children:n.map(e=>(0,h.jsxs)(U,{value:e.value,className:s(`group flex w-full items-start gap-3 rounded-lg border bg-card p-3 text-left text-sm transition-colors outline-none`,`hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-ring`,`data-[state=checked]:border-primary data-[state=checked]:bg-muted/40 data-[state=checked]:ring-1 data-[state=checked]:ring-primary`),children:[(0,h.jsx)(`span`,{"aria-hidden":!0,className:`mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border border-muted-foreground/60 group-data-[state=checked]:border-primary`,children:(0,h.jsx)(`span`,{className:`size-2 rounded-full bg-primary opacity-0 transition-opacity group-data-[state=checked]:opacity-100`})}),(0,h.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 font-medium`,children:[e.icon&&(0,h.jsx)(e.icon,{className:`size-4 text-muted-foreground`}),e.title,e.badge]}),e.description&&(0,h.jsx)(`span`,{className:`block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]},e.value))})}export{G as t};
@@ -0,0 +1 @@
1
+ import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{Ut as e,ft as t}from"./queries-Cv3nXx0U.js";import{n}from"./common-BPZV8TFb.js";var r=e();function i({code:e,label:i,className:a}){let o=e.split(/(\s+)/);return(0,r.jsxs)(`div`,{className:t(`flex min-w-0 items-start gap-1 rounded-lg border bg-muted/40 py-1 pr-1 pl-3`,a),children:[(0,r.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-x-auto py-1.5 font-mono text-xs leading-relaxed whitespace-pre-wrap text-foreground`,children:o.map((e,t)=>/^\s+$/.test(e)?e:(0,r.jsx)(`span`,{className:`whitespace-nowrap`,children:e},t))}),(0,r.jsx)(n,{value:e,label:`Copy ${i}`})]})}export{i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{M as t,N as n,Ut as r,Wt as i,_t as a,ft as o,gt as s,k as c,pt as l,st as u}from"./queries-Cv3nXx0U.js";import{c as d,d as f,l as p,r as m,t as ee,u as te}from"./card-GSO5o-Ug.js";import{Dt as ne,nt as h,rt as g,tt as _}from"./index-DGzo3kGh.js";var v={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};v.node;var y=a(v),b={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};b.node;var x=a(b),S=e(i(),1),C=r(),re=l(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function w({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?u:`span`;return(0,C.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:o(re({variant:t}),e),...r})}function T({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`skeleton`,className:o(`animate-pulse rounded-md bg-muted`,e),...t})}var E=new Set,D=Date.now(),O;function ie(e){return E.add(e),O??=setInterval(()=>{D=Date.now();for(let e of E)e()},1e3),()=>{E.delete(e),!E.size&&O&&(clearInterval(O),O=void 0)}}function k(e=1e3){return(0,S.useSyncExternalStore)(ie,()=>Math.floor(D/e)*e)}var ae=/(?<=[/?&,])(?=[^/])/;function oe(e){return e.split(/(\s+)/).filter(e=>e!==``).map(e=>/^\s+$/.test(e)?{space:e}:{segments:e.split(ae)})}var A=6048e5,se=864e5,j=6e4,ce=525600,le=43200,ue=1440,M=Symbol.for(`constructDateFrom`);function N(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&M in e?e[M](t):e instanceof Date?new e.constructor(t):new Date(t)}function P(e,t){return N(t||e,e)}var de={};function F(){return de}function I(e){let t=P(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}function L(e,...t){let n=N.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function fe(e,t){let n=+P(e)-P(t);return n<0?-1:n>0?1:n}function pe(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}var me={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},he=(e,t,n)=>{let r,i=me[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function R(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ge={date:R({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:R({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:R({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},_e={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},ve=(e,t,n,r)=>_e[e];function z(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var ye={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:z({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:z({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:z({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:z({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:z({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function B(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?xe(s,e=>e.test(o)):be(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function be(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function xe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Se(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var V={code:`en-US`,formatDistance:he,formatLong:ge,formatRelative:ve,localize:ye,match:{ordinalNumber:Se({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:B({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:B({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:B({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:B({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:B({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ce(e,t,n){let r=F(),i=n?.locale??r.locale??V,a=fe(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=L(n?.in,...a>0?[t,e]:[e,t]),l=pe(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/j,f=(u-(I(c)-I(s)))/j,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}if(m===`day`){let e=l(f/ue);return i.formatDistance(`xDays`,e,o)}if(m===`month`){let e=l(f/le);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}{let e=l(f/ce);return i.formatDistance(`xYears`,e,o)}}var we=new Intl.NumberFormat(`en`),Te=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),H=e=>e==null?`—`:we.format(e),Ee=e=>e==null?`—`:Te.format(e);function De(e){return e==null||Number.isNaN(e)?`—`:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(e<1e4?2:1)} s`:U(e)}function U(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:i?`${i}m ${t%60}s`:`${t}s`}function Oe(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:`${(e/1024**2).toFixed(1)} MB`}function W(e){if(e==null||e===``)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var ke=1e4;function Ae(e,t=Date.now()){let n=W(e);if(!n)return`—`;let r=t-n.getTime();return r>-2e3&&r<ke?`just now`:Ce(n,t,{addSuffix:!0})}function G(e){let t=W(e);return t?t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`}):`—`}function je(e){return e?e.name?`${e.name} <${e.email}>`:e.email:`—`}function Me(e){return e?e.name||e.email:`—`}var Ne=(e,t,n=t+`s`)=>`${H(e)} ${e===1?t:n}`;function Pe(e,t){if(!t)return e;let n=e=>e.trim().toLowerCase().replace(/\.(local|lan|home)$/,``),r=n(e),i=n(t);return r===i||r.endsWith(` on ${i}`)?e:`${e} on ${t}`}function Fe(e){let t=e.active===e.total?H(e.total):`${H(e.active)} of ${H(e.total)}`;if(!e.total)return{value:t,hint:`Connect Gmail`,connect:!0};if(e.needsAttention)return{value:t,hint:e.needsAttention===1?`1 needs attention`:`${e.needsAttention} need attention`,tone:`critical`};let n=e.total-e.active;return{value:t,hint:n?`${n} paused`:e.total===1?`active`:`all active`}}var Ie=864e5,K=e=>e.replace(/[\u2009\u202f]/g,` `);function Le(e,t={}){let n=W(e.start);if(!n)return e.start||`—`;let r=W(e.end)??n,i=new Date(t.now??Date.now()).getUTCFullYear();if(e.allDay){let e=new Date(Math.max(n.getTime(),r.getTime()-Ie)),a=n.getUTCFullYear()!==i||e.getUTCFullYear()!==i?`numeric`:void 0,o=e.getTime()===n.getTime(),s=new Intl.DateTimeFormat(t.locale,{timeZone:`UTC`,month:`short`,day:`numeric`,year:a,weekday:o?`short`:void 0});return K(`${o?s.format(n):s.formatRange(n,e)} (all day)`)}let a=n.getFullYear()===i?void 0:`numeric`,o=new Intl.DateTimeFormat(t.locale,{timeZone:t.timeZone,weekday:`short`,month:`short`,day:`numeric`,year:a,hour:`numeric`,minute:`2-digit`});return K(r.getTime()>n.getTime()?o.formatRange(n,r):o.format(n))}function Re({title:e,description:t,actions:n}){return(0,C.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e}),t&&(0,C.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:t})]}),n&&(0,C.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n})]})}async function ze(e,t){if(window.isSecureContext&&navigator.clipboard)return navigator.clipboard.writeText(e);let n=document.createElement(`textarea`);n.value=e,n.readOnly=!0,n.style.cssText=`position:fixed;top:0;left:0;opacity:0;pointer-events:none`,t.after(n),n.select();let r=document.execCommand(`copy`);if(n.remove(),t.focus(),!r)throw Error(`Copy failed`)}function Be(e){let[n,r]=(0,S.useState)(!1);return{copied:n,onClick:async n=>{n.stopPropagation();try{await ze(e,n.currentTarget)}catch{t.error(`Couldn't copy`,{description:`Select the text and copy it with your keyboard instead.`});return}r(!0),setTimeout(()=>r(!1),1500)}}}function q({value:e,label:t=`Copy`,className:r,withText:i,variant:a=`ghost`}){let{copied:c,onClick:l}=Be(e),u=(0,C.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:c?`Copied`:``});return i?(0,C.jsxs)(n,{type:`button`,variant:a,size:`sm`,className:r,onClick:l,"aria-label":c?void 0:t,children:[c?(0,C.jsx)(s,{}):(0,C.jsx)(y,{}),c?`Copied`:i===!0?t:i,u]}):(0,C.jsxs)(_,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsxs)(n,{type:`button`,variant:a,size:`icon-sm`,className:o(`text-muted-foreground`,r),"aria-label":c?`Copied`:t,onClick:l,children:[c?(0,C.jsx)(s,{}):(0,C.jsx)(y,{}),u]})}),(0,C.jsx)(h,{children:c?`Copied`:t})]})}function J({text:e}){return oe(e).map((e,t)=>`space`in e?e.space:(0,C.jsx)(`span`,{children:e.segments.map((e,t)=>(0,C.jsxs)(S.Fragment,{children:[t>0&&(0,C.jsx)(`wbr`,{}),(0,C.jsx)(`span`,{className:`whitespace-nowrap`,children:e})]},t))},t))}function Ve({value:e,className:t,size:n=`default`,label:r=`Copy`}){return(0,C.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-1 rounded-lg border bg-muted/40 pl-3 text-foreground`,n===`lg`?`py-1.5 pr-1.5`:`py-0.5 pr-0.5`,t),children:[(0,C.jsx)(`code`,{className:o(`min-w-0 flex-1 overflow-x-auto py-1 font-mono whitespace-pre-wrap select-all`,n===`lg`?`text-sm`:`text-[13px]`),children:(0,C.jsx)(J,{text:e})}),(0,C.jsx)(q,{value:e,label:r,withText:n===`lg`&&`Copy`,variant:n===`lg`?`outline`:`ghost`})]})}function Y({code:e,className:t,title:n,wrap:r,copyLabel:i=`Copy`}){return(0,C.jsxs)(`div`,{className:o(`overflow-hidden rounded-lg border bg-muted/40`,t),children:[n&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b bg-muted/40 py-1 pr-1 pl-3 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{className:`truncate font-mono`,children:n}),(0,C.jsx)(q,{value:e,label:i})]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(`pre`,{className:o(`overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground`,!n&&`pr-10`,r&&`whitespace-pre-wrap`,r===`anywhere`&&`[overflow-wrap:anywhere]`),children:r===!0?(0,C.jsx)(J,{text:e}):e}),!n&&(0,C.jsx)(q,{value:e,label:i,className:`absolute top-1.5 right-1.5`})]})]})}function He({label:e,value:t,hint:n,icon:r,loading:i,tone:a}){return(0,C.jsx)(ee,{className:`gap-0 py-4`,children:(0,C.jsxs)(m,{className:`space-y-1.5 px-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-sm text-muted-foreground`,children:[(0,C.jsx)(`span`,{className:`min-w-0 leading-snug break-words`,children:e}),r&&(0,C.jsx)(r,{className:o(`mt-0.5 size-4 shrink-0`,a&&Ue[a])})]}),i?(0,C.jsx)(T,{className:`h-8 w-20`}):(0,C.jsx)(`div`,{className:`text-2xl font-semibold tracking-tight tabular`,children:t}),n&&(0,C.jsx)(`div`,{className:`text-xs leading-snug break-words text-muted-foreground`,children:n})]})})}var X={good:`bg-success`,warn:`bg-warning`,bad:`bg-critical`,idle:`bg-muted-foreground/50`,info:`bg-chart-1`},Ue={good:`text-success`,warn:`text-warning`,bad:`text-critical`,idle:`text-muted-foreground`,info:`text-chart-1`};function Z({tone:e,pulse:t,className:n}){return(0,C.jsxs)(`span`,{className:o(`relative inline-flex size-2 shrink-0`,n),"aria-hidden":!0,children:[t&&(0,C.jsx)(`span`,{className:o(`absolute inset-0 animate-ping rounded-full opacity-60`,X[e])}),(0,C.jsx)(`span`,{className:o(`relative inline-flex size-2 rounded-full`,X[e])})]})}function We({tone:e,children:t,className:n,pulse:r}){return(0,C.jsxs)(w,{variant:`outline`,className:o(`gap-1.5 font-normal`,n),children:[(0,C.jsx)(Z,{tone:e,pulse:r,className:`size-1.5 [&>span]:size-1.5`}),t]})}function Ge({date:e,className:t,fallback:n=`—`}){return k(15e3),e?(0,C.jsxs)(_,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsx)(`time`,{dateTime:e,className:o(`whitespace-nowrap underline decoration-dotted decoration-muted-foreground/40 underline-offset-4`,t),children:Ae(e)})}),(0,C.jsx)(h,{children:G(e)})]}):(0,C.jsx)(`span`,{className:o(`text-muted-foreground`,t),children:n})}function Ke({href:e,children:t,className:n}){return(0,C.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:o(`inline-flex items-center gap-1 font-medium text-foreground underline underline-offset-4 hover:text-chart-1`,n),children:[t,(0,C.jsx)(x,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,C.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})}function Q(e){let t=e.split(/(https:\/\/[^\s)]+[^\s).,;:])/);return t.length===1?e:t.map((e,t)=>t%2?(0,C.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline underline-offset-3`,children:[e,(0,C.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]},t):e)}function $({error:e,title:t,children:n,className:r}){let{message:i,hint:a}=c(e);return(0,C.jsxs)(d,{variant:`destructive`,className:r,children:[(0,C.jsx)(f,{}),(0,C.jsx)(te,{children:t??i}),(0,C.jsxs)(p,{children:[t&&(0,C.jsx)(`p`,{children:i}),a&&(0,C.jsx)(`p`,{className:`text-foreground/80`,children:Q(a)}),n]})]})}function qe({error:e,onRetry:t,className:r}){return(0,C.jsx)($,{error:e,title:`Couldn't load this`,className:r,children:t&&(0,C.jsx)(`div`,{className:`pt-2`,children:(0,C.jsxs)(n,{size:`sm`,variant:`outline`,onClick:t,children:[(0,C.jsx)(ne,{}),` Try again`]})})})}function Je({children:e,className:t}){return(0,C.jsx)(`div`,{className:o(`text-xs font-medium tracking-wide text-muted-foreground uppercase`,t),children:e})}export{F as A,G as C,V as D,Ne as E,k as F,T as I,w as L,N as M,se as N,L as O,A as P,x as R,Le as S,H as T,je as _,Ke as a,Ee as b,Je as c,Ge as d,We as f,Pe as g,Fe as h,$ as i,P as j,I as k,He as l,Q as m,q as n,Re as o,J as p,Ve as r,qe as s,Y as t,Z as u,Me as v,De as w,U as x,Oe as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ut as t,Wt as n,_t as r,ft as i,n as a,yt as o}from"./queries-Cv3nXx0U.js";import{t as s}from"./useQuery-MrTwwNy5.js";import{i as c}from"./pairing-XjuaVr2u.js";import{t as l}from"./bell-ring-ig3zn1iS.js";import{c as u,l as d,o as f,s as p}from"./label-multi-select-sH8mllw8.js";import{c as m,l as h,u as g}from"./card-GSO5o-Ug.js";import{a as _,c as v,n as y,r as b,t as x}from"./common-BPZV8TFb.js";import{t as S}from"./shield-check-BulpsYqK.js";import{n as C}from"./send-DuMVuYs1.js";import{t as w}from"./shield-alert-CSYB-ThV.js";import{t as T}from"./sparkles-CUTiob4K.js";import{t as E}from"./terminal-BvxDFTJc.js";import{t as D}from"./checkbox-B937U-Fd.js";import{A as O,D as k,M as A,N as j,O as M,j as N,k as P}from"./index-DGzo3kGh.js";import{t as F}from"./command-khhto70y.js";var I={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};I.node;var L=r(I),R=t();function z(e,t){let n=`${e}/mcp`;return{claude:`claude mcp add --transport http --scope user xaq ${A(n)} \\\n --header "Authorization: Bearer ${t}"`,codexToml:`[mcp_servers.xaq]\nurl = ${JSON.stringify(n)}\nbearer_token_env_var = "XAQ_API_KEY"`,codexEnv:`export XAQ_API_KEY="${t}"`,cursor:JSON.stringify({mcpServers:{xaq:{url:n,headers:{Authorization:`Bearer ${t}`}}}},null,2),generic:JSON.stringify({mcpServers:{xaq:{type:`http`,url:n,headers:{Authorization:`Bearer ${t}`}}}},null,2),hermes:`mcp_servers:\n xaq:\n url: ${JSON.stringify(n)}\n headers:\n Authorization: "Bearer ${t}"`,skill:`${k} skill install --url ${A(e)}`,mcpUrl:n,skillUrl:`${e}/skill.md`}}function B({apiKey:e}){let t=s(a.settings()).data?.publicUrl??window.location.origin,n=z(t,e??`<your-xaq-key>`);return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[j(t)===`insecure`&&(0,R.jsxs)(m,{variant:`destructive`,children:[(0,R.jsx)(w,{}),(0,R.jsxs)(g,{children:[new URL(t).host,` is plain http`]}),(0,R.jsx)(h,{children:`With these settings the agent's key and every email it reads cross the network unencrypted. Use https or Tailscale for the public URL (Settings) before connecting agents on other machines.`})]}),!e&&(0,R.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(C,{className:`mt-px size-3.5 shrink-0`}),(0,R.jsxs)(`span`,{children:[`Replace `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`<your-xaq-key>`}),` with the agent's API key. Keys are only shown once; if you've lost it, rotate the key to get a new one.`]})]}),(0,R.jsxs)(f,{defaultValue:`claude`,children:[(0,R.jsx)(`div`,{className:`-mx-1 overflow-x-auto px-1 pb-1`,children:(0,R.jsxs)(u,{children:[(0,R.jsx)(d,{value:`claude`,children:`Claude Code`}),(0,R.jsx)(d,{value:`codex`,children:`Codex`}),(0,R.jsx)(d,{value:`cursor`,children:`Cursor`}),(0,R.jsx)(d,{value:`hermes`,children:`Hermes`}),(0,R.jsx)(d,{value:`generic`,children:`Other MCP`}),(0,R.jsx)(d,{value:`skill`,children:`Skill`})]})}),(0,R.jsxs)(p,{value:`claude`,className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run in a terminal on the machine where Claude Code runs:`}),(0,R.jsx)(x,{code:n.claude,wrap:!0})]}),(0,R.jsxs)(p,{value:`codex`,className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Add to `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`~/.codex/config.toml`}),`:`]}),(0,R.jsx)(x,{code:n.codexToml,title:`~/.codex/config.toml`}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Then set the key in your shell profile (Codex reads it from the environment):`}),(0,R.jsx)(x,{code:n.codexEnv,title:`~/.zshrc or ~/.bashrc`})]}),(0,R.jsxs)(p,{value:`cursor`,className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Add to `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`~/.cursor/mcp.json`}),` (or the project's`,` `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`.cursor/mcp.json`}),`):`]}),(0,R.jsx)(x,{code:n.cursor,title:`~/.cursor/mcp.json`})]}),(0,R.jsxs)(p,{value:`hermes`,className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Add to `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`~/.hermes/config.yaml`}),`, then restart Hermes:`]}),(0,R.jsx)(x,{code:n.hermes,title:`~/.hermes/config.yaml`})]}),(0,R.jsxs)(p,{value:`generic`,className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Any MCP client with Streamable HTTP support: server URL `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:n.mcpUrl}),` with a bearer token.`]}),(0,R.jsx)(x,{code:n.generic,title:`mcp.json`})]}),(0,R.jsxs)(p,{value:`skill`,className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The xaq skill teaches agents how to use the tools well: triage, replying in threads, handling approvals and treating email content as untrusted data. Install it next to your agent:`}),(0,R.jsx)(x,{code:n.skill,wrap:!0}),(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Or read it first: `,(0,R.jsx)(_,{href:n.skillUrl,children:n.skillUrl})]})]})]})]})}function V({apiKey:e}){return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(b,{value:e,size:`lg`}),(0,R.jsxs)(m,{variant:`warning`,children:[(0,R.jsx)(w,{}),(0,R.jsx)(g,{children:`Copy this key now. It won't be shown again.`}),(0,R.jsx)(h,{children:`xaq only stores a hash of it. Treat it like a password: anyone with it can act as this agent within its grants. If it leaks or gets lost, rotate the key.`})]})]})}function H({res:e}){return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(v,{children:[`API key for `,e.agent.name]}),(0,R.jsx)(V,{apiKey:e.apiKey})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(v,{children:`Connect your agent`}),(0,R.jsx)(B,{apiKey:e.apiKey})]})]})}var U=e(n(),1);function W({publicUrl:e,accepted:t,onAcceptedChange:n,className:r}){return j(e)===`insecure`?(0,R.jsxs)(m,{variant:`destructive`,className:r,children:[(0,R.jsx)(w,{}),(0,R.jsxs)(g,{children:[new URL(e).host,` is plain http: agent traffic would be unencrypted`]}),(0,R.jsxs)(h,{children:[(0,R.jsxs)(`p`,{children:[`The agent's API key, the skill it reads and every email event would cross the network in the clear, readable and changeable by anyone in between. `,(0,R.jsx)(`code`,{className:`font-mono`,children:`connect`}),` and `,(0,R.jsx)(`code`,{className:`font-mono`,children:`listen`}),` refuse this address unless you add`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`--insecure`}),`.`]}),(0,R.jsxs)(`p`,{className:`text-foreground/80`,children:[`Put xaq behind https (a reverse proxy or tunnel), or reach it over Tailscale, then update the`,` `,(0,R.jsx)(o,{to:`/settings`,hash:`public-url`,className:`font-medium underline underline-offset-4`,children:`public URL`}),`.`]}),(0,R.jsxs)(`label`,{className:`mt-1 flex cursor-pointer items-center gap-2 text-foreground`,children:[(0,R.jsx)(D,{checked:t,onCheckedChange:e=>n(e===!0)}),`I understand the risk: include `,(0,R.jsx)(`code`,{className:`font-mono`,children:`--insecure`}),` in the commands`]})]})]}):null}function G({n:e,icon:t,title:n,children:r}){return(0,R.jsxs)(`li`,{className:`relative grid grid-cols-[2rem_1fr] gap-x-3 pb-6 last:pb-0`,children:[(0,R.jsx)(`span`,{className:`absolute top-8 bottom-1 left-4 w-px bg-border [li:last-child>&]:hidden`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`relative flex size-8 items-center justify-center rounded-full border bg-background text-muted-foreground`,children:[(0,R.jsx)(t,{className:`size-4`}),(0,R.jsxs)(`span`,{className:`sr-only`,children:[`Step `,e]})]}),(0,R.jsxs)(`div`,{className:`min-w-0 space-y-2 pt-1`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:n}),r]})]})}function K({value:e,onChange:t,className:n}){return(0,R.jsx)(f,{value:e,onValueChange:e=>t(e),className:n,children:(0,R.jsx)(`div`,{className:`-mx-1 overflow-x-auto px-1 pb-1`,children:(0,R.jsx)(u,{"aria-label":`Your agent's tool`,className:`max-w-full flex-wrap justify-start group-data-horizontal/tabs:h-auto`,children:P.map(e=>(0,R.jsx)(d,{value:e,children:O[e]},e))})})})}var q=e=>e===`other`?`your agent`:O[e];function J(){let e=s(a.settings());return{publicUrl:e.data?.publicUrl??window.location.origin,settings:e.data}}function Y(){let{settings:e}=J();return!e||e.pairingEnabled?null:(0,R.jsxs)(m,{children:[(0,R.jsx)(w,{}),(0,R.jsx)(g,{children:`Pairing is turned off`}),(0,R.jsx)(h,{children:(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`code`,{className:`font-mono`,children:`connect`}),` will be refused until you turn on`,` `,(0,R.jsx)(o,{to:`/settings`,hash:`pairing`,className:`font-medium text-foreground underline underline-offset-4`,children:`Accept pairing requests`}),` `,`in Settings. You can still create an agent and copy its key yourself.`]})})]})}function X(){return(0,R.jsxs)(R.Fragment,{children:[`Connected it with `,(0,R.jsx)(`code`,{className:`font-mono text-foreground`,children:`--profile <name>`}),`? Add the same flag to these commands.`]})}function Z({c:e,tool:t}){let n=q(t);return(0,R.jsxs)(`ol`,{className:`space-y-3 text-sm`,children:[e.hermesRoute&&(0,R.jsxs)(`li`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`0. Create the Hermes route.`}),` `,(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Once, with your Hermes gateway's webhook platform on. Use the platform Hermes should tell you on.`})]}),(0,R.jsx)(F,{code:e.hermesRoute,label:`hermes route command`})]}),(0,R.jsxs)(`li`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`1. Try it.`}),` `,(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Runs in this terminal until you press Ctrl-C.`})]}),(0,R.jsx)(F,{code:e.listenTry,label:`listen command`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t===`other`?`This test command only confirms each email (a ✓ line per email). Swap in your own script for the service.`:`${t===`hermes`?`Forwards each new email you receive to ${n}`:`Starts ${n} for each new email you receive`} (not mail you send; Promotions, Social and Forums are skipped). ${M[t].note}`})]}),(0,R.jsxs)(`li`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`2. Keep it running.`}),` `,(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Installs a background service that starts at login and survives closing the terminal.`})]}),(0,R.jsx)(F,{code:e.listenService,label:`service install command`}),t===`other`&&(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replace /path/to/handle-email.sh with your script. `,M.other.note]})]}),(0,R.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:(0,R.jsx)(X,{})})]})}function Q({c:e}){return(0,R.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium`,children:[(0,R.jsx)(T,{className:`size-4 text-chart-1`}),` Or let the agent set itself up`]}),(0,R.jsx)(`p`,{className:`mb-2 text-sm text-muted-foreground`,children:`Tell your agent:`}),(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-2 rounded-md border bg-background py-1.5 pr-1.5 pl-3 sm:flex-row`,children:[(0,R.jsxs)(`p`,{className:`min-w-0 flex-1 py-1 text-sm break-words`,children:[`“`,e.selfSetup,`”`]}),(0,R.jsx)(y,{value:e.selfSetup,label:`Copy prompt`,withText:!0,variant:`outline`,className:`self-end sm:self-auto`})]}),(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`It reads the skill, runs connect for you, and its request shows up here to approve.`})]})}function $({className:e,variant:t=`full`,onApproved:n}){let{publicUrl:r}=J(),[a,o]=(0,U.useState)(`claude-code`),[s,u]=(0,U.useState)(!1),d=j(r)===`insecure`,f=N(r,a,s),p=q(a);return(0,R.jsxs)(`div`,{className:i(`space-y-5`,e),children:[(0,R.jsx)(Y,{}),(0,R.jsx)(W,{publicUrl:r,accepted:s,onAcceptedChange:u}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:`Which tool does your agent run in?`}),(0,R.jsx)(K,{value:a,onChange:o}),(0,R.jsxs)(`ol`,{children:[(0,R.jsxs)(G,{n:1,icon:E,title:`Run this on the machine where ${p} runs`,children:[(0,R.jsx)(F,{code:f.connect,label:`connect command`}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`It prints a code like `,(0,R.jsx)(`span`,{className:`font-mono`,children:`K7QM-2XPD`}),` and waits for you. Keep the terminal open.`,a===`other`?` It then shows how to point your agent's MCP client at xaq.`:` --setup-mcp then adds xaq to ${p}; the key is saved on that machine and never shown.`]})]}),(0,R.jsx)(G,{n:2,icon:S,title:`Approve it here with the code from your terminal`,children:(0,R.jsx)(c,{onApproved:n})}),t===`full`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(G,{n:3,icon:L,title:`Teach ${p} the rules`,children:[(0,R.jsx)(F,{code:f.skillInstall,label:`skill install command`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Installs the xaq skill: how to triage, reply in threads, wait for approvals, and treat email content as untrusted.`})]}),(0,R.jsx)(G,{n:4,icon:l,title:(0,R.jsxs)(R.Fragment,{children:[`Wake it on new mail `,(0,R.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),children:(0,R.jsx)(Z,{c:f,tool:a})})]})]})]}),!d&&(0,R.jsx)(Q,{c:f})]})}export{K as a,H as c,X as i,V as l,W as n,q as o,Z as r,J as s,$ as t,B as u};