@rubytech/create-sitedesk-code 0.1.518 → 0.1.519

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 (226) hide show
  1. package/dist/__tests__/edge-bind-template-wiring.test.js +37 -0
  2. package/dist/__tests__/samba-provision.test.js +103 -1
  3. package/dist/index.js +19 -4
  4. package/dist/samba-provision.js +72 -0
  5. package/package.json +1 -1
  6. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +69 -19
  7. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
  8. package/payload/platform/plugins/docs/references/admin-ui.md +43 -5
  9. package/payload/platform/plugins/docs/references/samba.md +2 -0
  10. package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +7 -3
  11. package/payload/platform/scripts/check-no-esm-require.mjs +5 -3
  12. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts.map +1 -1
  13. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js +5 -3
  14. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js.map +1 -1
  15. package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -1
  16. package/payload/platform/services/telegram-channel/dist/instructions.js +13 -10
  17. package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
  18. package/payload/platform/services/webchat-channel/dist/instructions.d.ts +6 -2
  19. package/payload/platform/services/webchat-channel/dist/instructions.d.ts.map +1 -1
  20. package/payload/platform/services/webchat-channel/dist/instructions.js +66 -32
  21. package/payload/platform/services/webchat-channel/dist/instructions.js.map +1 -1
  22. package/payload/platform/services/webchat-channel/dist/notification.d.ts +2 -1
  23. package/payload/platform/services/webchat-channel/dist/notification.d.ts.map +1 -1
  24. package/payload/platform/services/webchat-channel/dist/notification.js +11 -4
  25. package/payload/platform/services/webchat-channel/dist/notification.js.map +1 -1
  26. package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
  27. package/payload/platform/services/webchat-channel/dist/server.js +30 -14
  28. package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
  29. package/payload/platform/services/webchat-channel/dist/turn-follow.d.ts.map +1 -1
  30. package/payload/platform/services/webchat-channel/dist/turn-follow.js +11 -5
  31. package/payload/platform/services/webchat-channel/dist/turn-follow.js.map +1 -1
  32. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +6 -3
  33. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
  34. package/payload/platform/services/whatsapp-channel/dist/notification.js +9 -5
  35. package/payload/platform/services/whatsapp-channel/dist/notification.js.map +1 -1
  36. package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
  37. package/payload/platform/services/whatsapp-channel/dist/server.js +6 -1
  38. package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
  39. package/payload/platform/services/whatsapp-channel/dist/targets.d.ts.map +1 -1
  40. package/payload/platform/services/whatsapp-channel/dist/targets.js +8 -2
  41. package/payload/platform/services/whatsapp-channel/dist/targets.js.map +1 -1
  42. package/payload/platform/templates/systemd/edge.service.template +1 -1
  43. package/payload/server/chunk-PXNY2TAP.js +1980 -0
  44. package/payload/server/chunk-TIIWMF5G.js +4837 -0
  45. package/payload/server/{chunk-S6HYTIU3.js → chunk-UX2FRNO7.js} +72 -2031
  46. package/payload/server/manager-B6OFOXSW.js +61 -0
  47. package/payload/server/maxy-edge.js +5 -3
  48. package/payload/server/package.json +2 -1
  49. package/payload/server/public/activity.html +5 -5
  50. package/payload/server/public/agents.html +4 -4
  51. package/payload/server/public/assets/{AdminLoginScreens-CDpNkwkf.js → AdminLoginScreens-BZPbCk8g.js} +1 -1
  52. package/payload/server/public/assets/AdminLoginScreens-BZPbCk8g.js.br +0 -0
  53. package/payload/server/public/assets/AdminLoginScreens-BZPbCk8g.js.gz +0 -0
  54. package/payload/server/public/assets/AdminShell-Bpo_wgxm.js +2 -0
  55. package/payload/server/public/assets/AdminShell-Bpo_wgxm.js.br +0 -0
  56. package/payload/server/public/assets/AdminShell-Bpo_wgxm.js.gz +0 -0
  57. package/payload/server/public/assets/{activity-BE9gv5xL.js → activity-DOsfKzT3.js} +1 -1
  58. package/payload/server/public/assets/activity-DOsfKzT3.js.br +0 -0
  59. package/payload/server/public/assets/activity-DOsfKzT3.js.gz +0 -0
  60. package/payload/server/public/assets/admin-COgD1z5a.js +1 -0
  61. package/payload/server/public/assets/admin-COgD1z5a.js.br +0 -0
  62. package/payload/server/public/assets/admin-COgD1z5a.js.gz +0 -0
  63. package/payload/server/public/assets/{agents-B-x0Ai2v.js → agents-DqDnZTH_.js} +1 -1
  64. package/payload/server/public/assets/agents-DqDnZTH_.js.br +0 -0
  65. package/payload/server/public/assets/agents-DqDnZTH_.js.gz +0 -0
  66. package/payload/server/public/assets/{browser-ZEQUkPfs.js → browser-FL17Dfp0.js} +1 -1
  67. package/payload/server/public/assets/browser-FL17Dfp0.js.br +0 -0
  68. package/payload/server/public/assets/browser-FL17Dfp0.js.gz +0 -0
  69. package/payload/server/public/assets/calendar-CLfLvsnV.js +1 -0
  70. package/payload/server/public/assets/calendar-CLfLvsnV.js.br +0 -0
  71. package/payload/server/public/assets/calendar-CLfLvsnV.js.gz +0 -0
  72. package/payload/server/public/assets/chat-DYq4FxMG.js +1 -0
  73. package/payload/server/public/assets/chat-DYq4FxMG.js.br +0 -0
  74. package/payload/server/public/assets/chat-DYq4FxMG.js.gz +0 -0
  75. package/payload/server/public/assets/chevron-left-DWt5cdUo.js +1 -0
  76. package/payload/server/public/assets/chevron-right-B9suVrYy.js +1 -0
  77. package/payload/server/public/assets/chevron-right-B9suVrYy.js.br +0 -0
  78. package/payload/server/public/assets/clock-DW6qVXtv.js +1 -0
  79. package/payload/server/public/assets/clock-DW6qVXtv.js.br +0 -0
  80. package/payload/server/public/assets/clock-DW6qVXtv.js.gz +0 -0
  81. package/payload/server/public/assets/data-C8rbOgds.js +1 -0
  82. package/payload/server/public/assets/data-C8rbOgds.js.br +0 -0
  83. package/payload/server/public/assets/data-C8rbOgds.js.gz +0 -0
  84. package/payload/server/public/assets/{file-text-BTV6EdBv.js → file-text-DNm0AzUz.js} +1 -1
  85. package/payload/server/public/assets/file-text-DNm0AzUz.js.br +0 -0
  86. package/payload/server/public/assets/file-text-DNm0AzUz.js.gz +0 -0
  87. package/payload/server/public/assets/{graph-hD_gPbbL.js → graph-fAvmlVzh.js} +3 -3
  88. package/payload/server/public/assets/graph-fAvmlVzh.js.br +0 -0
  89. package/payload/server/public/assets/graph-fAvmlVzh.js.gz +0 -0
  90. package/payload/server/public/assets/{graph-labels-CY1T19PY.js → graph-labels-CwdkCxfs.js} +1 -1
  91. package/payload/server/public/assets/graph-labels-CwdkCxfs.js.br +0 -0
  92. package/payload/server/public/assets/graph-labels-CwdkCxfs.js.gz +0 -0
  93. package/payload/server/public/assets/{maximize-2-BFV9VKHO.js → maximize-2-B6tAPhC2.js} +1 -1
  94. package/payload/server/public/assets/maximize-2-B6tAPhC2.js.br +0 -0
  95. package/payload/server/public/assets/maximize-2-B6tAPhC2.js.gz +0 -0
  96. package/payload/server/public/assets/operator-CTKvBVjk.js +1 -0
  97. package/payload/server/public/assets/operator-CTKvBVjk.js.br +0 -0
  98. package/payload/server/public/assets/operator-CTKvBVjk.js.gz +0 -0
  99. package/payload/server/public/assets/page-BWoNW3sa.js +32 -0
  100. package/payload/server/public/assets/page-BWoNW3sa.js.br +0 -0
  101. package/payload/server/public/assets/page-BWoNW3sa.js.gz +0 -0
  102. package/payload/server/public/assets/page-O5HkHQw4.js +1 -0
  103. package/payload/server/public/assets/page-O5HkHQw4.js.br +0 -0
  104. package/payload/server/public/assets/page-O5HkHQw4.js.gz +0 -0
  105. package/payload/server/public/assets/{public-D6Tnj5LU.js → public-BF1rnVPa.js} +1 -1
  106. package/payload/server/public/assets/public-BF1rnVPa.js.br +0 -0
  107. package/payload/server/public/assets/public-BF1rnVPa.js.gz +0 -0
  108. package/payload/server/public/assets/{rotate-ccw-C-RfQUza.js → rotate-ccw-B8TqfCy4.js} +1 -1
  109. package/payload/server/public/assets/rotate-ccw-B8TqfCy4.js.br +0 -0
  110. package/payload/server/public/assets/rotate-ccw-B8TqfCy4.js.gz +0 -0
  111. package/payload/server/public/assets/{routines-NIMElUzV.js → routines-4R7BLZyH.js} +1 -1
  112. package/payload/server/public/assets/routines-4R7BLZyH.js.br +0 -0
  113. package/payload/server/public/assets/routines-4R7BLZyH.js.gz +0 -0
  114. package/payload/server/public/assets/{skills-N0ZlHosx.js → skills-CQ9Qs2tg.js} +1 -1
  115. package/payload/server/public/assets/skills-CQ9Qs2tg.js.br +0 -0
  116. package/payload/server/public/assets/skills-CQ9Qs2tg.js.gz +0 -0
  117. package/payload/server/public/assets/tasks-DePyOrRk.js +1 -0
  118. package/payload/server/public/assets/tasks-DePyOrRk.js.br +0 -0
  119. package/payload/server/public/assets/tasks-DePyOrRk.js.gz +0 -0
  120. package/payload/server/public/assets/{time-entry-format-jQxlRPoI.js → time-entry-format-D9gtnG01.js} +1 -1
  121. package/payload/server/public/assets/time-entry-format-D9gtnG01.js.br +0 -0
  122. package/payload/server/public/assets/time-entry-format-D9gtnG01.js.gz +0 -0
  123. package/payload/server/public/assets/{triangle-alert-wUS4rpzv.js → triangle-alert-DAtm2mLL.js} +1 -1
  124. package/payload/server/public/assets/triangle-alert-DAtm2mLL.js.br +0 -0
  125. package/payload/server/public/assets/triangle-alert-DAtm2mLL.js.gz +0 -0
  126. package/payload/server/public/assets/{useCopyFeedback-BRix_wIl.js → useCopyFeedback-uMJT-p6i.js} +1 -1
  127. package/payload/server/public/assets/useCopyFeedback-uMJT-p6i.js.br +0 -0
  128. package/payload/server/public/assets/useCopyFeedback-uMJT-p6i.js.gz +0 -0
  129. package/payload/server/public/assets/useSubAccountSwitcher-BufCPDDH.js +14 -0
  130. package/payload/server/public/assets/useSubAccountSwitcher-BufCPDDH.js.br +0 -0
  131. package/payload/server/public/assets/useSubAccountSwitcher-BufCPDDH.js.gz +0 -0
  132. package/payload/server/public/assets/useSubAccountSwitcher-iCzsV96x.css +1 -0
  133. package/payload/server/public/assets/useSubAccountSwitcher-iCzsV96x.css.br +0 -0
  134. package/payload/server/public/assets/useSubAccountSwitcher-iCzsV96x.css.gz +0 -0
  135. package/payload/server/public/assets/useVoiceRecorder-BFrPC-s7.js +2 -0
  136. package/payload/server/public/assets/useVoiceRecorder-BFrPC-s7.js.br +0 -0
  137. package/payload/server/public/assets/useVoiceRecorder-BFrPC-s7.js.gz +0 -0
  138. package/payload/server/public/assets/{wrench-sDivAjhf.js → wrench-CYgaN7K9.js} +1 -1
  139. package/payload/server/public/assets/wrench-CYgaN7K9.js.br +1 -0
  140. package/payload/server/public/assets/wrench-CYgaN7K9.js.gz +0 -0
  141. package/payload/server/public/browser.html +4 -4
  142. package/payload/server/public/calendar.html +7 -7
  143. package/payload/server/public/chat.html +13 -13
  144. package/payload/server/public/data.html +11 -11
  145. package/payload/server/public/graph.html +9 -9
  146. package/payload/server/public/index.html +14 -14
  147. package/payload/server/public/operator.html +14 -14
  148. package/payload/server/public/public.html +13 -13
  149. package/payload/server/public/routines.html +6 -6
  150. package/payload/server/public/skills.html +5 -5
  151. package/payload/server/public/tasks.html +6 -6
  152. package/payload/server/server.js +6100 -9940
  153. package/payload/server/public/assets/AdminLoginScreens-CDpNkwkf.js.br +0 -0
  154. package/payload/server/public/assets/AdminLoginScreens-CDpNkwkf.js.gz +0 -0
  155. package/payload/server/public/assets/AdminShell-TSa8KgID.js +0 -2
  156. package/payload/server/public/assets/AdminShell-TSa8KgID.js.br +0 -0
  157. package/payload/server/public/assets/AdminShell-TSa8KgID.js.gz +0 -0
  158. package/payload/server/public/assets/activity-BE9gv5xL.js.br +0 -0
  159. package/payload/server/public/assets/activity-BE9gv5xL.js.gz +0 -0
  160. package/payload/server/public/assets/admin-Cb0BZriv.js +0 -1
  161. package/payload/server/public/assets/admin-Cb0BZriv.js.br +0 -0
  162. package/payload/server/public/assets/admin-Cb0BZriv.js.gz +0 -0
  163. package/payload/server/public/assets/agents-B-x0Ai2v.js.br +0 -0
  164. package/payload/server/public/assets/agents-B-x0Ai2v.js.gz +0 -0
  165. package/payload/server/public/assets/browser-ZEQUkPfs.js.br +0 -0
  166. package/payload/server/public/assets/browser-ZEQUkPfs.js.gz +0 -0
  167. package/payload/server/public/assets/calendar-DsRxrW0G.js +0 -1
  168. package/payload/server/public/assets/calendar-DsRxrW0G.js.br +0 -0
  169. package/payload/server/public/assets/calendar-DsRxrW0G.js.gz +0 -0
  170. package/payload/server/public/assets/chat-BS9B9lDo.js +0 -1
  171. package/payload/server/public/assets/chat-BS9B9lDo.js.br +0 -1
  172. package/payload/server/public/assets/chat-BS9B9lDo.js.gz +0 -0
  173. package/payload/server/public/assets/chevron-left-DLtGuH6K.js +0 -1
  174. package/payload/server/public/assets/chevron-right-CY_trg5L.js +0 -1
  175. package/payload/server/public/assets/chevron-right-CY_trg5L.js.br +0 -0
  176. package/payload/server/public/assets/clock-oM5driJm.js +0 -1
  177. package/payload/server/public/assets/clock-oM5driJm.js.br +0 -0
  178. package/payload/server/public/assets/clock-oM5driJm.js.gz +0 -0
  179. package/payload/server/public/assets/data-Cio6PO0F.js +0 -1
  180. package/payload/server/public/assets/data-Cio6PO0F.js.br +0 -2
  181. package/payload/server/public/assets/data-Cio6PO0F.js.gz +0 -0
  182. package/payload/server/public/assets/file-text-BTV6EdBv.js.br +0 -0
  183. package/payload/server/public/assets/file-text-BTV6EdBv.js.gz +0 -0
  184. package/payload/server/public/assets/graph-hD_gPbbL.js.br +0 -0
  185. package/payload/server/public/assets/graph-hD_gPbbL.js.gz +0 -0
  186. package/payload/server/public/assets/graph-labels-CY1T19PY.js.br +0 -0
  187. package/payload/server/public/assets/graph-labels-CY1T19PY.js.gz +0 -0
  188. package/payload/server/public/assets/maximize-2-BFV9VKHO.js.br +0 -0
  189. package/payload/server/public/assets/maximize-2-BFV9VKHO.js.gz +0 -0
  190. package/payload/server/public/assets/operator-Dxze8CwV.js +0 -1
  191. package/payload/server/public/assets/operator-Dxze8CwV.js.br +0 -0
  192. package/payload/server/public/assets/operator-Dxze8CwV.js.gz +0 -0
  193. package/payload/server/public/assets/page-Bi86QF6_.js +0 -32
  194. package/payload/server/public/assets/page-Bi86QF6_.js.br +0 -0
  195. package/payload/server/public/assets/page-Bi86QF6_.js.gz +0 -0
  196. package/payload/server/public/assets/page-BnXly9aN.js +0 -1
  197. package/payload/server/public/assets/page-BnXly9aN.js.br +0 -0
  198. package/payload/server/public/assets/page-BnXly9aN.js.gz +0 -0
  199. package/payload/server/public/assets/public-D6Tnj5LU.js.br +0 -0
  200. package/payload/server/public/assets/public-D6Tnj5LU.js.gz +0 -0
  201. package/payload/server/public/assets/rotate-ccw-C-RfQUza.js.br +0 -0
  202. package/payload/server/public/assets/rotate-ccw-C-RfQUza.js.gz +0 -0
  203. package/payload/server/public/assets/routines-NIMElUzV.js.br +0 -0
  204. package/payload/server/public/assets/routines-NIMElUzV.js.gz +0 -0
  205. package/payload/server/public/assets/skills-N0ZlHosx.js.br +0 -0
  206. package/payload/server/public/assets/skills-N0ZlHosx.js.gz +0 -0
  207. package/payload/server/public/assets/tasks-BsB_0duv.js +0 -1
  208. package/payload/server/public/assets/tasks-BsB_0duv.js.br +0 -0
  209. package/payload/server/public/assets/tasks-BsB_0duv.js.gz +0 -0
  210. package/payload/server/public/assets/time-entry-format-jQxlRPoI.js.br +0 -0
  211. package/payload/server/public/assets/time-entry-format-jQxlRPoI.js.gz +0 -0
  212. package/payload/server/public/assets/triangle-alert-wUS4rpzv.js.br +0 -0
  213. package/payload/server/public/assets/triangle-alert-wUS4rpzv.js.gz +0 -0
  214. package/payload/server/public/assets/useCopyFeedback-BRix_wIl.js.br +0 -0
  215. package/payload/server/public/assets/useCopyFeedback-BRix_wIl.js.gz +0 -0
  216. package/payload/server/public/assets/useSubAccountSwitcher-DWMWxvYo.js +0 -14
  217. package/payload/server/public/assets/useSubAccountSwitcher-DWMWxvYo.js.br +0 -0
  218. package/payload/server/public/assets/useSubAccountSwitcher-DWMWxvYo.js.gz +0 -0
  219. package/payload/server/public/assets/useSubAccountSwitcher-UQQDcj0B.css +0 -1
  220. package/payload/server/public/assets/useSubAccountSwitcher-UQQDcj0B.css.br +0 -0
  221. package/payload/server/public/assets/useSubAccountSwitcher-UQQDcj0B.css.gz +0 -0
  222. package/payload/server/public/assets/useVoiceRecorder-1TAfCP2k.js +0 -2
  223. package/payload/server/public/assets/useVoiceRecorder-1TAfCP2k.js.br +0 -0
  224. package/payload/server/public/assets/useVoiceRecorder-1TAfCP2k.js.gz +0 -0
  225. package/payload/server/public/assets/wrench-sDivAjhf.js.br +0 -0
  226. package/payload/server/public/assets/wrench-sDivAjhf.js.gz +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CltuBf4Z.js";import{B as t,F as n,K as r,P as i,T as a,U as o,W as s,_ as c,g as l,p as u}from"./useSubAccountSwitcher-DWMWxvYo.js";import{T as d,_ as f,b as p,t as m}from"./AdminShell-TSa8KgID.js";var h=i(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=i(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),_=s(),v=e(r(),1);function y(e){if(!e.startsWith(`mcp__`))return e;let t=e.slice(5),n=t.indexOf(`__`);if(n<0)return e;let r=t.slice(n+2);return r.length>0?r:e}var b=t(),x={read:`read`,write_local:`writes`,exec:`runs`,external:`sends`},S={read:`tool-chip-read`,write_local:`tool-chip-write_local`,exec:`tool-chip-exec`,external:`tool-chip-external`,unresolved:`tool-chip-unresolved`};function C({label:e,body:t}){return(0,b.jsxs)(`div`,{className:`agent-doc`,children:[(0,b.jsx)(`span`,{className:`agent-doc-label`,children:e}),(0,b.jsx)(`pre`,{className:`skill-body`,children:t.trim()||`Empty.`})]})}function w({summary:e,publicBaseUrl:t,accountId:n,adminFetch:r,onClose:i,onDeleted:o,onToggled:s}){let u=e.kind===`specialist`,d=e.origin===`shipped`,[m]=(0,v.useState)(n),[_,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(!0),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;E(!0),O(null);let n=e.origin===`shipped`?`?origin=shipped`:e.kind===`specialist`&&e.plugin?`?plugin=${encodeURIComponent(e.plugin)}`:``;return r(`/api/admin/agents/${encodeURIComponent(e.slug)}${n}`).then(async e=>{if(!t){if(!e.ok)throw Error(`HTTP ${e.status}`);w((await e.json()).agent)}}).catch(e=>{t||O(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{t||E(!1)}),()=>{t=!0}},[r,e.slug]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!j&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[j,i]);let L=(0,v.useCallback)(async()=>{M(!0),O(null);try{let t=await r(`/api/admin/agents/${encodeURIComponent(e.slug)}?accountId=${encodeURIComponent(m??``)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}o(e)}catch(e){O(e instanceof Error?e.message:`Delete failed`),M(!1),A(!1)}},[r,e,m,o]),R=(0,v.useCallback)(async()=>{let t=e.disabled?`enable`:`disable`;I(!0),O(null);try{let n=await r(`/api/admin/agents/${encodeURIComponent(e.slug)}/${t}?accountId=${encodeURIComponent(m??``)}`,{method:`POST`,headers:{"content-type":`application/json`}});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}s(),i()}catch(e){O(e instanceof Error?e.message:`${t} failed`),I(!1),P(!1)}},[r,e,m,s,i]),z=u?null:_,B=u?_:null;return(0,b.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{j||i()},children:(0,b.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Agent detail`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,b.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,b.jsx)(p,{size:13}),` `,u?`Specialist`:`Agent`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:i,"aria-label":`Close`,autoFocus:!0,disabled:j,children:(0,b.jsx)(l,{size:16})})]}),(0,b.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,b.jsx)(`div`,{className:`cal-modal-title`,children:e.displayName}),(0,b.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[!u&&(0,b.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,b.jsxs)(`span`,{children:[`/`,e.slug]}),e.risk&&(0,b.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,children:e.risk===`green`?`Read only`:e.risk===`amber`?`Writes`:`Runs`}),e.disabled&&(0,b.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.unresolved.length>0&&(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[`Forced to Runs: no declared risk class for `,e.unresolved.join(`, `),`.`]})}),T&&(0,b.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,b.jsx)(a,{size:14,className:`spin`}),(0,b.jsx)(`span`,{children:`Loading…`})]}),z&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[z.status,z.model?` · ${z.model}`:``]})}),(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`a`,{href:`${t}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`cal-link`,children:[(0,b.jsx)(f,{size:13}),` Open agent`]})}),z.present.identity&&(0,b.jsx)(C,{label:`Identity`,body:z.identity}),z.present.soul&&(0,b.jsx)(C,{label:`Soul`,body:z.soul}),z.present.knowledge&&(0,b.jsx)(C,{label:`Knowledge`,body:z.knowledge}),z.present.knowledgeSummary&&(0,b.jsx)(C,{label:`Knowledge summary`,body:z.knowledgeSummary}),z.knowledgeKeywords.length>0&&(0,b.jsxs)(`div`,{className:`skill-refs`,children:[(0,b.jsx)(`span`,{className:`skill-refs-label`,children:`Knowledge keywords`}),z.knowledgeKeywords.map(e=>(0,b.jsx)(`span`,{className:`skill-ref`,children:e},e))]})]}),B&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[e.plugin,B.model?` · ${B.model}`:``]})}),B.description&&(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsx)(`span`,{children:B.description})}),B.byTool.length>0&&(0,b.jsxs)(`div`,{className:`chip-refs`,children:[(0,b.jsxs)(`span`,{className:`skill-refs-label`,children:[`Tools (`,B.byTool.length,`)`,B.riskiestTool?` · riskiest: ${y(B.riskiestTool)}`:``]}),(0,b.jsx)(`div`,{className:`chip-row`,children:B.byTool.map(({tool:e,risk:t})=>(0,b.jsx)(`span`,{"data-testid":`tool-chip-${e}`,className:`tool-chip ${S[t??`unresolved`]}`,title:t?`${e} — ${x[t]}`:`${e} — no declared risk class`,children:y(e)},e))})]}),B.skills.length>0&&(0,b.jsxs)(`div`,{className:`chip-refs`,children:[(0,b.jsx)(`span`,{className:`skill-refs-label`,children:`Skills`}),(0,b.jsx)(`div`,{className:`chip-row`,children:B.skills.map(e=>(0,b.jsx)(`span`,{className:`tool-chip tool-chip-skill`,children:e},e))})]}),(0,b.jsx)(C,{label:`System prompt`,body:B.systemPrompt})]})]}),D&&(0,b.jsx)(`div`,{className:`cal-modal-error`,children:D}),(0,b.jsx)(`div`,{className:`cal-modal-actions`,children:d?N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:e.disabled?`Put this agent back in the dispatchable set?`:`Stop this agent being dispatched?`}),(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:R,disabled:F,children:[F?(0,b.jsx)(a,{size:14,className:`spin`}):e.disabled?(0,b.jsx)(g,{size:14}):(0,b.jsx)(h,{size:14}),e.disabled?` Enable`:` Disable`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>P(!1),disabled:F,children:`Cancel`})]}):(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>P(!0),disabled:F||T||!m,children:e.disabled?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g,{size:14}),` Enable`]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h,{size:14}),` Disable`]})}):u?(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Edit in chat via agent-builder.`}):(0,b.jsxs)(b.Fragment,{children:[!k&&(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>A(!0),disabled:j||T||!m,children:[(0,b.jsx)(c,{size:14}),` Delete`]}),k&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this agent?`}),(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:L,disabled:j,children:[j?(0,b.jsx)(a,{size:14,className:`spin`}):(0,b.jsx)(c,{size:14}),` Delete`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>A(!1),disabled:j,children:`Cancel`})]})]})})]})})}var T=`maxy-admin-session-key`,E={green:`Read only`,amber:`Writes`,red:`Runs`},D={shipped:`Shipped`,specialist:`Specialist`,public:`Public`};function O(){let[e,t]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0),[s,c]=(0,v.useState)(null),[l,f]=(0,v.useState)(void 0),[p,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(T)}catch{}if(!n){i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),_(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),i(!0)}}).catch(()=>{e||(t(n),i(!0))}),()=>{e=!0}},[]);let y=(0,v.useCallback)(()=>{try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`},[]),[x,S]=(0,v.useState)(!1),C=(0,v.useCallback)(async()=>{S(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`}return e}finally{S(!1)}},[]);return r?e?(0,b.jsx)(u,{cacheKey:e,surface:`agents`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=agents`);try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`},children:(0,b.jsx)(m,{cacheKey:e,businessName:a,sessionId:s,onLogout:y,onDisconnect:C,disconnecting:x,userName:l,userAvatar:p,role:g,children:(0,b.jsx)(k,{cacheKey:e})})}):(0,b.jsx)(`div`,{className:`cal-page`,children:(0,b.jsxs)(`div`,{className:`cal-empty`,children:[(0,b.jsx)(`p`,{children:`You are not signed in.`}),(0,b.jsxs)(`p`,{children:[`Open the `,(0,b.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,b.jsx)(n,{surface:`gate`})}function k({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:r}=o({initialCacheKey:e,surface:`agents`}),[i,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(0),[f,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(!1),[T,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(``);(0,v.useEffect)(()=>{M(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]);let N=(0,v.useCallback)(()=>{let e=!1;return x(!0),O(null),t(`/api/admin/agents`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();s(Array.isArray(n.agents)?n.agents:[]),l(typeof n.skipped==`number`?n.skipped:0),d(typeof n.specialistsSkipped==`number`?n.specialistsSkipped:0),g(typeof n.accountId==`string`?n.accountId:null),m(n.riskSurfaceFailed===!0)}).catch(t=>{e||(O(t instanceof Error?t.message:`Failed to load`),s([]))}).finally(()=>{e||(x(!1),C(!0))}),()=>{e=!0}},[t]);(0,v.useEffect)(()=>N(),[N,r]);let P=(0,v.useCallback)(e=>{s(t=>t.filter(t=>t.slug!==e.slug)),A(null),N()},[N]);return S?(0,b.jsxs)(`div`,{className:`cal-page`,children:[(0,b.jsx)(`header`,{className:`cal-header`,children:(0,b.jsxs)(`div`,{className:`cal-nav`,children:[(0,b.jsxs)(`span`,{className:`cal-range-label`,children:[(0,b.jsx)(p,{size:16}),` Agents`]}),_&&(0,b.jsx)(a,{size:16,className:`spin`})]})}),(0,b.jsxs)(`div`,{className:`cal-body`,children:[T&&(0,b.jsxs)(`div`,{className:`cal-error`,children:[`Could not load agents: `,T]}),f&&(0,b.jsx)(`div`,{className:`cal-error`,children:`The plugin registry could not be read, so every agent below is shown at the highest risk regardless of the tools it declares. These badges are not derived.`}),c+u>0&&(0,b.jsxs)(`div`,{className:`cal-error`,children:[c+u,` agent`,c+u===1?``:`s`,` could not be read (malformed config or frontmatter).`]}),!T&&!_&&i.length===0&&(0,b.jsx)(`div`,{className:`cal-empty`,children:(0,b.jsx)(`p`,{children:`No agents yet. Ask in chat to create one.`})}),i.length>0&&(0,b.jsx)(`div`,{className:`routine-list`,children:i.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`routine-card`,onClick:()=>A(e),children:[(0,b.jsxs)(`span`,{className:`routine-card-title`,children:[e.displayName,e.risk&&(0,b.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,"data-testid":`agent-risk-badge`,children:E[e.risk]}),(0,b.jsx)(`span`,{className:`agent-kind-pill agent-origin-${e.origin}`,children:D[e.origin]}),e.disabled&&(0,b.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.kind===`specialist`?(0,b.jsxs)(`span`,{className:`routine-card-sched`,children:[`/`,e.slug]}):(0,b.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,b.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),` /`,e.slug]}),(0,b.jsx)(`span`,{className:`routine-card-meta`,children:e.origin===`public`?e.status:e.riskiestTool?`riskiest tool: ${y(e.riskiestTool)}`:e.plugin})]},`${e.origin}:${e.slug}`))})]}),k&&(0,b.jsx)(w,{summary:k,publicBaseUrl:j,accountId:h,adminFetch:t,onClose:()=>A(null),onDeleted:P,onToggled:N})]}):(0,b.jsx)(n,{surface:`gate`})}(0,_.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(O,{}));
1
+ import{o as e}from"./chunk-CltuBf4Z.js";import{E as t,F as n,G as r,I as i,V as a,W as o,_ as s,m as c,q as l,v as u}from"./useSubAccountSwitcher-BufCPDDH.js";import{T as d,_ as f,b as p,t as m}from"./AdminShell-Bpo_wgxm.js";var h=n(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=n(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),_=r(),v=e(l(),1);function y(e){if(!e.startsWith(`mcp__`))return e;let t=e.slice(5),n=t.indexOf(`__`);if(n<0)return e;let r=t.slice(n+2);return r.length>0?r:e}var b=a(),x={read:`read`,write_local:`writes`,exec:`runs`,external:`sends`},S={read:`tool-chip-read`,write_local:`tool-chip-write_local`,exec:`tool-chip-exec`,external:`tool-chip-external`,unresolved:`tool-chip-unresolved`};function C({label:e,body:t}){return(0,b.jsxs)(`div`,{className:`agent-doc`,children:[(0,b.jsx)(`span`,{className:`agent-doc-label`,children:e}),(0,b.jsx)(`pre`,{className:`skill-body`,children:t.trim()||`Empty.`})]})}function w({summary:e,publicBaseUrl:n,accountId:r,adminFetch:i,onClose:a,onDeleted:o,onToggled:c}){let l=e.kind===`specialist`,d=e.origin===`shipped`,[m]=(0,v.useState)(r),[_,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(!0),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!1;E(!0),O(null);let n=e.origin===`shipped`?`?origin=shipped`:e.kind===`specialist`&&e.plugin?`?plugin=${encodeURIComponent(e.plugin)}`:``;return i(`/api/admin/agents/${encodeURIComponent(e.slug)}${n}`).then(async e=>{if(!t){if(!e.ok)throw Error(`HTTP ${e.status}`);w((await e.json()).agent)}}).catch(e=>{t||O(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{t||E(!1)}),()=>{t=!0}},[i,e.slug]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!j&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[j,a]);let L=(0,v.useCallback)(async()=>{M(!0),O(null);try{let t=await i(`/api/admin/agents/${encodeURIComponent(e.slug)}?accountId=${encodeURIComponent(m??``)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}o(e)}catch(e){O(e instanceof Error?e.message:`Delete failed`),M(!1),A(!1)}},[i,e,m,o]),R=(0,v.useCallback)(async()=>{let t=e.disabled?`enable`:`disable`;I(!0),O(null);try{let n=await i(`/api/admin/agents/${encodeURIComponent(e.slug)}/${t}?accountId=${encodeURIComponent(m??``)}`,{method:`POST`,headers:{"content-type":`application/json`}});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}c(),a()}catch(e){O(e instanceof Error?e.message:`${t} failed`),I(!1),P(!1)}},[i,e,m,c,a]),z=l?null:_,B=l?_:null;return(0,b.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{j||a()},children:(0,b.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Agent detail`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,b.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,b.jsx)(p,{size:13}),` `,l?`Specialist`:`Agent`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:a,"aria-label":`Close`,autoFocus:!0,disabled:j,children:(0,b.jsx)(s,{size:16})})]}),(0,b.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,b.jsx)(`div`,{className:`cal-modal-title`,children:e.displayName}),(0,b.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[!l&&(0,b.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,b.jsxs)(`span`,{children:[`/`,e.slug]}),e.risk&&(0,b.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,children:e.risk===`green`?`Read only`:e.risk===`amber`?`Writes`:`Runs`}),e.disabled&&(0,b.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.unresolved.length>0&&(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[`Forced to Runs: no declared risk class for `,e.unresolved.join(`, `),`.`]})}),T&&(0,b.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,b.jsx)(t,{size:14,className:`spin`}),(0,b.jsx)(`span`,{children:`Loading…`})]}),z&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[z.status,z.model?` · ${z.model}`:``]})}),(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`a`,{href:`${n}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`cal-link`,children:[(0,b.jsx)(f,{size:13}),` Open agent`]})}),z.present.identity&&(0,b.jsx)(C,{label:`Identity`,body:z.identity}),z.present.soul&&(0,b.jsx)(C,{label:`Soul`,body:z.soul}),z.present.knowledge&&(0,b.jsx)(C,{label:`Knowledge`,body:z.knowledge}),z.present.knowledgeSummary&&(0,b.jsx)(C,{label:`Knowledge summary`,body:z.knowledgeSummary}),z.knowledgeKeywords.length>0&&(0,b.jsxs)(`div`,{className:`skill-refs`,children:[(0,b.jsx)(`span`,{className:`skill-refs-label`,children:`Knowledge keywords`}),z.knowledgeKeywords.map(e=>(0,b.jsx)(`span`,{className:`skill-ref`,children:e},e))]})]}),B&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsxs)(`span`,{children:[e.plugin,B.model?` · ${B.model}`:``]})}),B.description&&(0,b.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,b.jsx)(`span`,{children:B.description})}),B.byTool.length>0&&(0,b.jsxs)(`div`,{className:`chip-refs`,children:[(0,b.jsxs)(`span`,{className:`skill-refs-label`,children:[`Tools (`,B.byTool.length,`)`,B.riskiestTool?` · riskiest: ${y(B.riskiestTool)}`:``]}),(0,b.jsx)(`div`,{className:`chip-row`,children:B.byTool.map(({tool:e,risk:t})=>(0,b.jsx)(`span`,{"data-testid":`tool-chip-${e}`,className:`tool-chip ${S[t??`unresolved`]}`,title:t?`${e} — ${x[t]}`:`${e} — no declared risk class`,children:y(e)},e))})]}),B.skills.length>0&&(0,b.jsxs)(`div`,{className:`chip-refs`,children:[(0,b.jsx)(`span`,{className:`skill-refs-label`,children:`Skills`}),(0,b.jsx)(`div`,{className:`chip-row`,children:B.skills.map(e=>(0,b.jsx)(`span`,{className:`tool-chip tool-chip-skill`,children:e},e))})]}),(0,b.jsx)(C,{label:`System prompt`,body:B.systemPrompt})]})]}),D&&(0,b.jsx)(`div`,{className:`cal-modal-error`,children:D}),(0,b.jsx)(`div`,{className:`cal-modal-actions`,children:d?N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:e.disabled?`Put this agent back in the dispatchable set?`:`Stop this agent being dispatched?`}),(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:R,disabled:F,children:[F?(0,b.jsx)(t,{size:14,className:`spin`}):e.disabled?(0,b.jsx)(g,{size:14}):(0,b.jsx)(h,{size:14}),e.disabled?` Enable`:` Disable`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>P(!1),disabled:F,children:`Cancel`})]}):(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>P(!0),disabled:F||T||!m,children:e.disabled?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g,{size:14}),` Enable`]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h,{size:14}),` Disable`]})}):l?(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Edit in chat via agent-builder.`}):(0,b.jsxs)(b.Fragment,{children:[!k&&(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>A(!0),disabled:j||T||!m,children:[(0,b.jsx)(u,{size:14}),` Delete`]}),k&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this agent?`}),(0,b.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:L,disabled:j,children:[j?(0,b.jsx)(t,{size:14,className:`spin`}):(0,b.jsx)(u,{size:14}),` Delete`]}),(0,b.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>A(!1),disabled:j,children:`Cancel`})]})]})})]})})}var T=`maxy-admin-session-key`,E={green:`Read only`,amber:`Writes`,red:`Runs`},D={shipped:`Shipped`,specialist:`Specialist`,public:`Public`};function O(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(!1),[a,o]=(0,v.useState)(void 0),[s,l]=(0,v.useState)(null),[u,f]=(0,v.useState)(void 0),[p,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(T)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&l(e.sessionId??null),_(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let y=(0,v.useCallback)(()=>{try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`},[]),[x,S]=(0,v.useState)(!1),C=(0,v.useCallback)(async()=>{S(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`}return e}finally{S(!1)}},[]);return n?e?(0,b.jsx)(c,{cacheKey:e,surface:`agents`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=agents`);try{sessionStorage.removeItem(T)}catch{}window.location.href=`/`},children:(0,b.jsx)(m,{cacheKey:e,businessName:a,sessionId:s,onLogout:y,onDisconnect:C,disconnecting:x,userName:u,userAvatar:p,role:g,children:(0,b.jsx)(k,{cacheKey:e})})}):(0,b.jsx)(`div`,{className:`cal-page`,children:(0,b.jsxs)(`div`,{className:`cal-empty`,children:[(0,b.jsx)(`p`,{children:`You are not signed in.`}),(0,b.jsxs)(`p`,{children:[`Open the `,(0,b.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,b.jsx)(i,{surface:`gate`})}function k({cacheKey:e}){let{adminFetch:n,sessionRefetchNonce:r}=o({initialCacheKey:e,surface:`agents`}),[a,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(0),[f,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(!1),[T,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(``);(0,v.useEffect)(()=>{M(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]);let N=(0,v.useCallback)(()=>{let e=!1;return x(!0),O(null),n(`/api/admin/agents`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();s(Array.isArray(n.agents)?n.agents:[]),l(typeof n.skipped==`number`?n.skipped:0),d(typeof n.specialistsSkipped==`number`?n.specialistsSkipped:0),g(typeof n.accountId==`string`?n.accountId:null),m(n.riskSurfaceFailed===!0)}).catch(t=>{e||(O(t instanceof Error?t.message:`Failed to load`),s([]))}).finally(()=>{e||(x(!1),C(!0))}),()=>{e=!0}},[n]);(0,v.useEffect)(()=>N(),[N,r]);let P=(0,v.useCallback)(e=>{s(t=>t.filter(t=>t.slug!==e.slug)),A(null),N()},[N]);return S?(0,b.jsxs)(`div`,{className:`cal-page`,children:[(0,b.jsx)(`header`,{className:`cal-header`,children:(0,b.jsxs)(`div`,{className:`cal-nav`,children:[(0,b.jsxs)(`span`,{className:`cal-range-label`,children:[(0,b.jsx)(p,{size:16}),` Agents`]}),_&&(0,b.jsx)(t,{size:16,className:`spin`})]})}),(0,b.jsxs)(`div`,{className:`cal-body`,children:[T&&(0,b.jsxs)(`div`,{className:`cal-error`,children:[`Could not load agents: `,T]}),f&&(0,b.jsx)(`div`,{className:`cal-error`,children:`The plugin registry could not be read, so every agent below is shown at the highest risk regardless of the tools it declares. These badges are not derived.`}),c+u>0&&(0,b.jsxs)(`div`,{className:`cal-error`,children:[c+u,` agent`,c+u===1?``:`s`,` could not be read (malformed config or frontmatter).`]}),!T&&!_&&a.length===0&&(0,b.jsx)(`div`,{className:`cal-empty`,children:(0,b.jsx)(`p`,{children:`No agents yet. Ask in chat to create one.`})}),a.length>0&&(0,b.jsx)(`div`,{className:`routine-list`,children:a.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`routine-card`,onClick:()=>A(e),children:[(0,b.jsxs)(`span`,{className:`routine-card-title`,children:[e.displayName,e.risk&&(0,b.jsx)(`span`,{className:`agent-risk-badge agent-risk-${e.risk}`,"data-testid":`agent-risk-badge`,children:E[e.risk]}),(0,b.jsx)(`span`,{className:`agent-kind-pill agent-origin-${e.origin}`,children:D[e.origin]}),e.disabled&&(0,b.jsx)(`span`,{className:`agent-kind-pill agent-disabled-pill`,children:`Disabled`})]}),e.kind===`specialist`?(0,b.jsxs)(`span`,{className:`routine-card-sched`,children:[`/`,e.slug]}):(0,b.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,b.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),` /`,e.slug]}),(0,b.jsx)(`span`,{className:`routine-card-meta`,children:e.origin===`public`?e.status:e.riskiestTool?`riskiest tool: ${y(e.riskiestTool)}`:e.plugin})]},`${e.origin}:${e.slug}`))})]}),k&&(0,b.jsx)(w,{summary:k,publicBaseUrl:j,accountId:h,adminFetch:n,onClose:()=>A(null),onDeleted:P,onToggled:N})]}):(0,b.jsx)(i,{surface:`gate`})}(0,_.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(O,{}));
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CltuBf4Z.js";import{B as t,D as n,I as r,K as i,T as a,W as o,m as s,p as c}from"./useSubAccountSwitcher-DWMWxvYo.js";import{T as l,_ as u,t as d}from"./AdminShell-TSa8KgID.js";var f=o(),p=e(i(),1),m=t(),h=`maxy-vnc-popout`;function g(){let[e,t]=(0,p.useState)(null),[i,o]=(0,p.useState)(!1),[c,l]=(0,p.useState)(null),d=s(null);(0,p.useEffect)(()=>{let e=!1;return fetch(`/vnc-viewer.html`,{method:`HEAD`}).then(n=>{e||(console.info(`[browser-page] op=viewer-probe available=${n.ok}`),t(n.ok))}).catch(()=>{e||(console.info(`[browser-page] op=viewer-probe available=false`),t(!1))}),()=>{e=!0}},[]);let f=(0,p.useCallback)(()=>{window.open(`/vnc-popout.html?title=${encodeURIComponent(r.productName)}`,h,`width=1024,height=768`)},[]),g=(0,p.useCallback)(async()=>{o(!0),l(null);try{let e=await d(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(!1)}},[d]);return e===null?(0,m.jsx)(`div`,{className:`vnc-surface`,children:(0,m.jsxs)(`div`,{className:`data-loading`,children:[(0,m.jsx)(a,{size:18,className:`spin`}),` Checking viewer…`]})}):e?(0,m.jsxs)(`div`,{className:`vnc-surface`,children:[(0,m.jsxs)(`div`,{className:`vnc-surface__toolbar`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:g,disabled:i,children:[i?(0,m.jsx)(a,{size:14,className:`spin`}):(0,m.jsx)(n,{size:14}),` Launch browser`]}),(0,m.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:f,children:[(0,m.jsx)(u,{size:14}),` Pop out`]}),c&&(0,m.jsx)(`span`,{className:`vnc-surface__error`,children:c})]}),(0,m.jsx)(`div`,{className:`vnc-surface__viewport`,children:(0,m.jsx)(`iframe`,{className:`vnc-surface__iframe`,src:`/vnc-viewer.html`,title:`VNC viewer`})})]}):(0,m.jsx)(`div`,{className:`vnc-surface`,children:(0,m.jsxs)(`div`,{className:`vnc-surface__unavailable`,children:[(0,m.jsx)(n,{size:28,strokeWidth:1.75}),(0,m.jsx)(`p`,{children:`VNC surface not available on this platform.`})]})})}function _(){let[e,t]=(0,p.useState)(null),[r,i]=(0,p.useState)(!1),[o,s]=(0,p.useState)(void 0),[u,f]=(0,p.useState)(null),[h,_]=(0,p.useState)(void 0),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null);(0,p.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&s(e.businessName),e.sessionId!==void 0&&f(e.sessionId??null),x(e.role??null),_(e.userName===void 0?null:e.userName),y(e.avatar??null)}catch{}t(n),i(!0)}}).catch(()=>{e||(t(n),i(!0))}),()=>{e=!0}},[]);let S=(0,p.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[C,w]=(0,p.useState)(!1),T=(0,p.useCallback)(async()=>{w(!0);try{let e=await l();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return r?e?(0,m.jsx)(c,{cacheKey:e,surface:`browser`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=browser`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,m.jsx)(d,{cacheKey:e,businessName:o,sessionId:u,onLogout:S,onDisconnect:T,disconnecting:C,userName:h,userAvatar:v,role:b,children:(0,m.jsxs)(`div`,{className:`data-page`,children:[(0,m.jsx)(`header`,{className:`data-header`,children:(0,m.jsxs)(`h1`,{className:`data-title`,children:[(0,m.jsx)(n,{size:18}),` Browser`]})}),(0,m.jsx)(g,{})]})})}):(0,m.jsxs)(`div`,{className:`data-page`,children:[(0,m.jsx)(`header`,{className:`data-header`,children:(0,m.jsxs)(`h1`,{className:`data-title`,children:[(0,m.jsx)(n,{size:18}),` Browser`]})}),(0,m.jsxs)(`div`,{className:`data-empty`,children:[(0,m.jsx)(`p`,{children:`You are not signed in.`}),(0,m.jsxs)(`p`,{children:[`Open the `,(0,m.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,m.jsx)(`div`,{className:`data-page`,children:(0,m.jsxs)(`div`,{className:`data-loading`,children:[(0,m.jsx)(a,{size:18,className:`spin`}),` Loading…`]})})}(0,f.createRoot)(document.getElementById(`root`)).render((0,m.jsx)(_,{}));
1
+ import{o as e}from"./chunk-CltuBf4Z.js";import{E as t,G as n,L as r,O as i,V as a,h as o,m as s,q as c}from"./useSubAccountSwitcher-BufCPDDH.js";import{T as l,_ as u,t as d}from"./AdminShell-Bpo_wgxm.js";var f=n(),p=e(c(),1),m=a(),h=`maxy-vnc-popout`;function g(){let[e,n]=(0,p.useState)(null),[a,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(null),d=o(null);(0,p.useEffect)(()=>{let e=!1;return fetch(`/vnc-viewer.html`,{method:`HEAD`}).then(t=>{e||(console.info(`[browser-page] op=viewer-probe available=${t.ok}`),n(t.ok))}).catch(()=>{e||(console.info(`[browser-page] op=viewer-probe available=false`),n(!1))}),()=>{e=!0}},[]);let f=(0,p.useCallback)(()=>{window.open(`/vnc-popout.html?title=${encodeURIComponent(r.productName)}`,h,`width=1024,height=768`)},[]),g=(0,p.useCallback)(async()=>{s(!0),l(null);try{let e=await d(`/api/admin/browser/launch`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`Launch failed (${e.status})`)}}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},[d]);return e===null?(0,m.jsx)(`div`,{className:`vnc-surface`,children:(0,m.jsxs)(`div`,{className:`data-loading`,children:[(0,m.jsx)(t,{size:18,className:`spin`}),` Checking viewer…`]})}):e?(0,m.jsxs)(`div`,{className:`vnc-surface`,children:[(0,m.jsxs)(`div`,{className:`vnc-surface__toolbar`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:g,disabled:a,children:[a?(0,m.jsx)(t,{size:14,className:`spin`}):(0,m.jsx)(i,{size:14}),` Launch browser`]}),(0,m.jsxs)(`button`,{type:`button`,className:`vnc-surface__btn`,onClick:f,children:[(0,m.jsx)(u,{size:14}),` Pop out`]}),c&&(0,m.jsx)(`span`,{className:`vnc-surface__error`,children:c})]}),(0,m.jsx)(`div`,{className:`vnc-surface__viewport`,children:(0,m.jsx)(`iframe`,{className:`vnc-surface__iframe`,src:`/vnc-viewer.html`,title:`VNC viewer`})})]}):(0,m.jsx)(`div`,{className:`vnc-surface`,children:(0,m.jsxs)(`div`,{className:`vnc-surface__unavailable`,children:[(0,m.jsx)(i,{size:28,strokeWidth:1.75}),(0,m.jsx)(`p`,{children:`VNC surface not available on this platform.`})]})})}function _(){let[e,n]=(0,p.useState)(null),[r,a]=(0,p.useState)(!1),[o,c]=(0,p.useState)(void 0),[u,f]=(0,p.useState)(null),[h,_]=(0,p.useState)(void 0),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null);(0,p.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){n(null),a(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&c(e.businessName),e.sessionId!==void 0&&f(e.sessionId??null),x(e.role??null),_(e.userName===void 0?null:e.userName),y(e.avatar??null)}catch{}n(t),a(!0)}}).catch(()=>{e||(n(t),a(!0))}),()=>{e=!0}},[]);let S=(0,p.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[C,w]=(0,p.useState)(!1),T=(0,p.useCallback)(async()=>{w(!0);try{let e=await l();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return r?e?(0,m.jsx)(s,{cacheKey:e,surface:`browser`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=browser`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,m.jsx)(d,{cacheKey:e,businessName:o,sessionId:u,onLogout:S,onDisconnect:T,disconnecting:C,userName:h,userAvatar:v,role:b,children:(0,m.jsxs)(`div`,{className:`data-page`,children:[(0,m.jsx)(`header`,{className:`data-header`,children:(0,m.jsxs)(`h1`,{className:`data-title`,children:[(0,m.jsx)(i,{size:18}),` Browser`]})}),(0,m.jsx)(g,{})]})})}):(0,m.jsxs)(`div`,{className:`data-page`,children:[(0,m.jsx)(`header`,{className:`data-header`,children:(0,m.jsxs)(`h1`,{className:`data-title`,children:[(0,m.jsx)(i,{size:18}),` Browser`]})}),(0,m.jsxs)(`div`,{className:`data-empty`,children:[(0,m.jsx)(`p`,{children:`You are not signed in.`}),(0,m.jsxs)(`p`,{children:[`Open the `,(0,m.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,m.jsx)(`div`,{className:`data-page`,children:(0,m.jsxs)(`div`,{className:`data-loading`,children:[(0,m.jsx)(t,{size:18,className:`spin`}),` Loading…`]})})}(0,f.createRoot)(document.getElementById(`root`)).render((0,m.jsx)(_,{}));
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CltuBf4Z.js";import{A as t,C as n,E as r,F as i,G as a,I as o,V as s,W as c,_ as l,m as u,q as d,v as f}from"./useSubAccountSwitcher-BufCPDDH.js";import{T as p,_ as m,t as h}from"./AdminShell-Bpo_wgxm.js";import{t as g}from"./chevron-left-DWt5cdUo.js";import{t as _}from"./chevron-right-B9suVrYy.js";import{t as v}from"./clock-DW6qVXtv.js";var y=i(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),b=i(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),x=i(`sticky-note`,[[`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`}]]),S=i(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),C=i(`users`,[[`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`}]]),w=a(),T=e(d(),1);function E(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function D(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function O(e){let t=E(e),n=t.getDay();return D(t,n===0?-6:1-n)}function k(e){let t=O(e);return Array.from({length:7},(e,n)=>D(t,n))}function A(e){let t=O(new Date(e.getFullYear(),e.getMonth(),1));return Array.from({length:42},(e,n)=>D(t,n))}function j(){return Array.from({length:24},(e,t)=>t)}function M(e){let t=e.getFullYear();return Array.from({length:12},(e,n)=>new Date(t,n,1))}function N(e,t){switch(e){case`day`:{let e=E(t);return{from:e,to:D(e,1)}}case`week`:{let e=O(t);return{from:e,to:D(e,7)}}case`month`:{let e=O(new Date(t.getFullYear(),t.getMonth(),1));return{from:e,to:D(e,42)}}case`year`:return{from:new Date(t.getFullYear(),0,1),to:new Date(t.getFullYear()+1,0,1)}}}function P(e,t,n){switch(e){case`day`:return D(t,n);case`week`:return D(t,n*7);case`month`:return new Date(t.getFullYear(),t.getMonth()+n,1);case`year`:return new Date(t.getFullYear()+n,t.getMonth(),1)}}function F(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function I(e,t){return{role:`button`,tabIndex:0,onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}}}var L=s(),ee=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],R=3;function z(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function B({anchor:e,meetings:t,onSelect:n}){let r=A(e),i=e.getMonth(),a=new Date;return(0,L.jsxs)(`div`,{className:`cal-month`,children:[(0,L.jsx)(`div`,{className:`cal-weekday-row`,children:ee.map(e=>(0,L.jsx)(`div`,{className:`cal-weekday`,children:e},e))}),(0,L.jsx)(`div`,{className:`cal-month-grid`,children:r.map(e=>{let r=t.filter(t=>F(new Date(t.startsAt),e)).sort((e,t)=>e.startsAt.localeCompare(t.startsAt)),o=e.getMonth()!==i,s=F(e,a);return(0,L.jsxs)(`div`,{className:`cal-cell${o?` cal-cell-out`:``}${s?` cal-cell-today`:``}`,children:[(0,L.jsx)(`div`,{className:`cal-cell-num`,children:e.getDate()}),r.slice(0,R).map(e=>(0,L.jsxs)(`div`,{className:`cal-chip`,title:e.title??`Untitled`,...I(e,n),children:[!e.isAllDay&&(0,L.jsx)(`span`,{className:`cal-chip-time`,children:z(new Date(e.startsAt))}),e.title??`Untitled`]},e.meetingId)),r.length>R&&(0,L.jsxs)(`div`,{className:`cal-more`,children:[`+`,r.length-R,` more`]})]},e.toISOString())})})]})}var V=1440,H=1.8;function U(e){return e.getHours()*60+e.getMinutes()}function W(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function G({day:e,meetings:t,hourHeight:n,onSelect:r}){let i=n*24,a=t.filter(t=>!t.isAllDay&&F(new Date(t.startsAt),e));return(0,L.jsx)(`div`,{className:`cal-day-col`,children:(0,L.jsxs)(`div`,{className:`cal-hours`,style:{height:`${i}px`},children:[Array.from({length:24},(e,t)=>(0,L.jsx)(`div`,{className:`cal-hour-line`,style:{top:`${t*n}px`}},t)),a.map(t=>{let n=new Date(t.startsAt),i=t.endsAt?new Date(t.endsAt):new Date(n.getTime()+30*6e4),a=U(n),o=F(i,e)?U(i):V,s=a/V*100,c=Math.max((o-a)/V*100,H);return(0,L.jsxs)(`div`,{className:`cal-event`,style:{top:`${s}%`,height:`${c}%`},title:t.title??`Untitled`,...I(t,r),children:[(0,L.jsx)(`span`,{className:`cal-event-time`,children:W(n)}),(0,L.jsx)(`span`,{className:`cal-event-title`,children:t.title??`Untitled`})]},t.meetingId)})]})})}var K=44;function q(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function J({anchor:e,meetings:t,onSelect:n}){let r=k(e),i=new Date;return(0,L.jsxs)(`div`,{className:`cal-timed`,children:[(0,L.jsxs)(`div`,{className:`cal-day-headrow`,children:[(0,L.jsx)(`div`,{className:`cal-timed-gutter`}),r.map(e=>(0,L.jsxs)(`div`,{className:`cal-day-head${F(e,i)?` cal-day-head-today`:``}`,children:[(0,L.jsx)(`span`,{className:`cal-day-head-name`,children:e.toLocaleDateString([],{weekday:`short`})}),(0,L.jsx)(`span`,{className:`cal-day-head-num`,children:e.getDate()})]},e.toISOString()))]}),(0,L.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,L.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),r.map(e=>(0,L.jsx)(`div`,{className:`cal-allday-cell`,children:t.filter(t=>t.isAllDay&&F(new Date(t.startsAt),e)).map(e=>(0,L.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...I(e,n),children:e.title??`Untitled`},e.meetingId))},e.toISOString()))]}),(0,L.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,L.jsx)(`div`,{className:`cal-timed-gutter`,children:j().map(e=>(0,L.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${K}px`},children:e===0?``:q(e)},e))}),r.map(e=>(0,L.jsx)(G,{day:e,meetings:t,hourHeight:K,onSelect:n},e.toISOString()))]})]})}var Y=52;function X(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString([],{hour:`numeric`})}function Z({anchor:e,meetings:t,onSelect:n}){let r=t.filter(t=>t.isAllDay&&F(new Date(t.startsAt),e));return(0,L.jsxs)(`div`,{className:`cal-timed cal-timed-single`,children:[(0,L.jsxs)(`div`,{className:`cal-allday-band`,children:[(0,L.jsx)(`div`,{className:`cal-timed-gutter`,children:`All-day`}),(0,L.jsx)(`div`,{className:`cal-allday-cell`,children:r.map(e=>(0,L.jsx)(`div`,{className:`cal-allday-chip`,title:e.title??`Untitled`,...I(e,n),children:e.title??`Untitled`},e.meetingId))})]}),(0,L.jsxs)(`div`,{className:`cal-timed-cols`,children:[(0,L.jsx)(`div`,{className:`cal-timed-gutter`,children:j().map(e=>(0,L.jsx)(`div`,{className:`cal-hour-label`,style:{height:`${Y}px`},children:e===0?``:X(e)},e))}),(0,L.jsx)(G,{day:e,meetings:t,hourHeight:Y,onSelect:n})]})]})}var te=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function ne(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function re({anchor:e,meetings:t,onPickMonth:n}){let r=new Date,i=new Set(t.map(e=>ne(new Date(e.startsAt))));return(0,L.jsx)(`div`,{className:`cal-year`,children:(0,L.jsx)(`div`,{className:`cal-year-grid`,children:M(e).map(e=>{let t=A(e),a=e.getMonth();return(0,L.jsxs)(`button`,{type:`button`,className:`cal-mini`,onClick:()=>n(e),title:e.toLocaleDateString([],{month:`long`,year:`numeric`}),children:[(0,L.jsx)(`div`,{className:`cal-mini-title`,children:e.toLocaleDateString([],{month:`long`})}),(0,L.jsx)(`div`,{className:`cal-mini-weekrow`,children:te.map((e,t)=>(0,L.jsx)(`span`,{className:`cal-mini-weekday`,children:e},t))}),(0,L.jsx)(`div`,{className:`cal-mini-grid`,children:t.map(e=>{let t=e.getMonth()!==a,n=F(e,r),o=!t&&i.has(ne(e));return(0,L.jsxs)(`span`,{className:`cal-mini-day${t?` cal-mini-day-out`:``}${n?` cal-mini-day-today`:``}`,children:[e.getDate(),o&&(0,L.jsx)(`span`,{className:`cal-mini-dot`})]},e.toISOString())})})]},a)})})})}var ie={meeting:`Meeting`,event:`Event`,task:`Task`};function ae(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function oe(e){return new Date(e).toISOString()}function Q(e){return Math.floor(new Date(e).getTime()/6e4)}function se(e){let t=new Date(e.startsAt);if(e.isAllDay)return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});let n=t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return e.endsAt?`${n} · ${r} – ${new Date(e.endsAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}`:`${n} · ${r}`}function ce(e){if(!e)return null;let t=e.match(/filename="([^"]+)"/);return t?t[1]:null}function le(e,t){return e.email??`${e.name??`unknown`}-${t}`}function ue({a:e}){let t=e.name||e.email||`Unknown`,n=e.name&&e.email?e.email:null;return(0,L.jsxs)(`span`,{className:`cal-attendee-lines`,children:[(0,L.jsx)(`span`,{className:`cal-attendee-name`,children:t}),n&&(0,L.jsx)(`span`,{className:`cal-attendee-email`,children:n})]})}function de({meeting:e,adminFetch:i,onClose:a,onSaved:o,onDeleted:s}){let c=e.kind===`meeting`,[u,d]=(0,T.useState)(!1),[p,m]=(0,T.useState)(!1),[h,g]=(0,T.useState)(!1),[_,w]=(0,T.useState)(!1),[E,D]=(0,T.useState)(null),[O,k]=(0,T.useState)(e),[A,j]=(0,T.useState)(e.title??``),[M,N]=(0,T.useState)(ae(e.startsAt)),[P,F]=(0,T.useState)(e.endsAt?ae(e.endsAt):``),[I,ee]=(0,T.useState)(e.location??``),[R,z]=(0,T.useState)(e.privateNote??``),[B,V]=(0,T.useState)(``),[H,U]=(0,T.useState)(``);(0,T.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!_&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,a]);let W=(0,T.useCallback)(()=>{let e={},t=A.trim();t!==(O.title??``)&&(e.title=t);let n=oe(M);Q(n)!==Q(O.startsAt)&&(e.startsAt=n);let r=P?oe(P):null;(r===null?O.endsAt!==null:O.endsAt===null||Q(r)!==Q(O.endsAt))&&(e.endsAt=r);let i=I.trim()||null;i!==(O.location??null)&&(e.location=i);let a=R.trim()||null;return a!==(O.privateNote??null)&&(e.privateNote=a),e},[A,M,P,I,R,O]),G=(0,T.useCallback)(async()=>{let t=W();if(Object.keys(t).length===0){d(!1);return}w(!0),D(null);try{let n=await i(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();k(r.meeting),o(r.meeting),d(!1)}catch(e){D(e instanceof Error?e.message:`Save failed`)}finally{w(!1)}},[i,W,e.meetingId,o]),K=(0,T.useCallback)(async()=>{let t=B.trim(),n=H.trim();if(!(!t&&!n)){w(!0),D(null);try{let r=await i(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t||void 0,email:n||void 0})});if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.json();k(a.meeting),o(a.meeting),V(``),U(``)}catch(e){D(e instanceof Error?e.message:`Add failed`)}finally{w(!1)}}},[i,B,H,e.meetingId,o]),q=(0,T.useCallback)(async t=>{let n=t.email?{email:t.email}:{name:t.name};w(!0),D(null);try{let t=await i(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/attendees`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();k(r.meeting),o(r.meeting)}catch(e){D(e instanceof Error?e.message:`Remove failed`)}finally{w(!1)}},[i,e.meetingId,o]),J=(0,T.useCallback)(async()=>{w(!0),D(null);try{let t=await i(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);s(e.meetingId)}catch(e){D(e instanceof Error?e.message:`Delete failed`),w(!1)}},[i,e.meetingId,s]),Y=(0,T.useCallback)(async t=>{g(!1),w(!0),D(null);try{let n=await i(`/api/admin/calendar/meetings/${encodeURIComponent(e.meetingId)}/ics?attendees=${t?`1`:`0`}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),a=ce(n.headers.get(`content-disposition`))??`meeting.ics`,o=URL.createObjectURL(r),s=document.createElement(`a`);s.href=o,s.download=a,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}catch(e){D(e instanceof Error?e.message:`Download failed`)}finally{w(!1)}},[i,e.meetingId]),X=ie[e.kind??`meeting`],Z=B.trim().length>0||H.trim().length>0;return(0,L.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{_||a()},children:(0,L.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":u?`Edit meeting`:`Meeting detail`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,L.jsx)(`span`,{className:`cal-modal-kind`,children:X}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:a,"aria-label":`Close`,autoFocus:!0,disabled:_,children:(0,L.jsx)(l,{size:16})})]}),!u&&(0,L.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,L.jsx)(`div`,{className:`cal-modal-title`,children:O.title??`Untitled`}),(0,L.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,L.jsx)(v,{size:14}),(0,L.jsx)(`span`,{children:se(O)})]}),O.location&&(0,L.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,L.jsx)(b,{size:14}),(0,L.jsx)(`span`,{children:O.location})]}),O.attendees.length>0&&(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,L.jsx)(C,{size:14}),(0,L.jsx)(`div`,{className:`cal-modal-attendees`,children:O.attendees.map((e,t)=>(0,L.jsx)(`div`,{className:`cal-attendee-row`,children:(0,L.jsx)(ue,{a:e})},le(e,t)))})]}),O.privateNote&&(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-row-top`,children:[(0,L.jsx)(x,{size:14}),(0,L.jsx)(`span`,{className:`cal-modal-note`,children:O.privateNote})]}),(0,L.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,L.jsx)(y,{size:14}),(0,L.jsx)(`span`,{children:X})]})]}),u&&(0,L.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Title`}),(0,L.jsx)(`input`,{type:`text`,value:A,onChange:e=>j(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Start`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:M,onChange:e=>N(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`End`}),(0,L.jsx)(`input`,{type:`datetime-local`,value:P,onChange:e=>F(e.target.value),disabled:_})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Location`}),(0,L.jsx)(`input`,{type:`text`,value:I,onChange:e=>ee(e.target.value),disabled:_})]}),(0,L.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Attendees`}),(0,L.jsxs)(`div`,{className:`cal-modal-attendees cal-modal-attendees-edit`,children:[O.attendees.length===0&&(0,L.jsx)(`div`,{className:`cal-attendee-empty`,children:`No attendees yet.`}),O.attendees.map((e,t)=>(0,L.jsxs)(`div`,{className:`cal-attendee-row cal-attendee-row-edit`,children:[(0,L.jsx)(ue,{a:e}),(0,L.jsx)(`button`,{type:`button`,className:`cal-attendee-remove`,onClick:()=>q(e),disabled:_,"aria-label":`Remove ${e.name||e.email||`attendee`}`,children:(0,L.jsx)(l,{size:13})})]},le(e,t)))]}),(0,L.jsxs)(`div`,{className:`cal-attendee-add`,children:[(0,L.jsx)(`input`,{type:`text`,placeholder:`Name`,value:B,onChange:e=>V(e.target.value),disabled:_,"aria-label":`Attendee name`}),(0,L.jsx)(`input`,{type:`email`,placeholder:`Email`,value:H,onChange:e=>U(e.target.value),disabled:_,"aria-label":`Attendee email`}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn cal-attendee-add-btn`,onClick:K,disabled:_||!Z,"aria-label":`Add attendee`,children:_?(0,L.jsx)(r,{size:13,className:`spin`}):(0,L.jsx)(S,{size:13})})]})]}),(0,L.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,L.jsx)(`span`,{children:`Private note`}),(0,L.jsx)(`textarea`,{className:`cal-modal-textarea`,value:R,onChange:e=>z(e.target.value),disabled:_,rows:3,placeholder:`Only you and your team can see this.`})]})]}),E&&(0,L.jsx)(`div`,{className:`cal-modal-error`,children:E}),c&&(0,L.jsxs)(`div`,{className:`cal-modal-actions`,children:[!u&&!p&&!h&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>d(!0),disabled:_,children:[(0,L.jsx)(n,{size:14}),` Edit`]}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>m(!0),disabled:_,children:[(0,L.jsx)(f,{size:14}),` Delete`]}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-download`,onClick:()=>{O.attendees.length>0?g(!0):Y(!1)},disabled:_,children:[_?(0,L.jsx)(r,{size:14,className:`spin`}):(0,L.jsx)(t,{size:14}),` Download`]})]}),h&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Include attendees in the file?`}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:()=>Y(!0),disabled:_,children:[_?(0,L.jsx)(r,{size:14,className:`spin`}):null,` Yes`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>Y(!1),disabled:_,children:`No`}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>g(!1),disabled:_,children:`Cancel`})]}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:G,disabled:_,children:[_?(0,L.jsx)(r,{size:14,className:`spin`}):null,` Save`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{d(!1),D(null)},disabled:_,children:`Cancel`})]}),p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this meeting?`}),(0,L.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:J,disabled:_,children:[_?(0,L.jsx)(r,{size:14,className:`spin`}):null,` Delete`]}),(0,L.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>m(!1),disabled:_,children:`Cancel`})]})]})]})})}var $=`maxy-admin-session-key`,fe=[`day`,`week`,`month`,`year`];function pe(e,t){switch(e){case`day`:return t.toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`week`:{let{from:e,to:n}=N(`week`,t),r=new Date(n.getTime()-1);return`${e.toLocaleDateString([],{day:`numeric`,month:`short`})} – ${r.toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})}`}case`month`:return t.toLocaleDateString([],{month:`long`,year:`numeric`});case`year`:return String(t.getFullYear())}}function me(){let[e,t]=(0,T.useState)(null),[n,r]=(0,T.useState)(!1),[i,a]=(0,T.useState)(void 0),[s,c]=(0,T.useState)(null),[l,d]=(0,T.useState)(void 0),[f,m]=(0,T.useState)(null),[g,_]=(0,T.useState)(null);(0,T.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem($)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),_(e.role??null),d(e.userName===void 0?null:e.userName),m(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let v=(0,T.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[y,b]=(0,T.useState)(!1),x=(0,T.useCallback)(async()=>{b(!0);try{let e=await p();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{b(!1)}},[]);return n?e?(0,L.jsx)(u,{cacheKey:e,surface:`calendar`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=calendar`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,L.jsx)(h,{cacheKey:e,businessName:i,sessionId:s,onLogout:v,onDisconnect:x,disconnecting:y,userName:l,userAvatar:f,role:g,children:(0,L.jsx)(he,{cacheKey:e})})}):(0,L.jsx)(`div`,{className:`cal-page`,children:(0,L.jsxs)(`div`,{className:`cal-empty`,children:[(0,L.jsx)(`p`,{children:`You are not signed in.`}),(0,L.jsxs)(`p`,{children:[`Open the `,(0,L.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,L.jsx)(o,{surface:`gate`})}function he({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:n}=c({initialCacheKey:e,surface:`calendar`}),[i,a]=(0,T.useState)(`month`),[s,l]=(0,T.useState)(()=>new Date),[u,d]=(0,T.useState)([]),[f,p]=(0,T.useState)(!1),[h,v]=(0,T.useState)(!1),[y,b]=(0,T.useState)(null),[x,S]=(0,T.useState)(null),[C,w]=(0,T.useState)(null);(0,T.useEffect)(()=>{let e=!1;return t(`/api/admin/calendar/booking-link`).then(async t=>{if(e||!t.ok)return;let n=await t.json();typeof n.bookingDomain==`string`&&n.bookingDomain&&w(n.bookingDomain)}).catch(()=>{}),()=>{e=!0}},[t]),(0,T.useEffect)(()=>{let e=!1,{from:n,to:r}=N(i,s);return p(!0),b(null),t(`/api/admin/calendar/meetings?from=${encodeURIComponent(n.toISOString())}&to=${encodeURIComponent(r.toISOString())}`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();d(Array.isArray(n.meetings)?n.meetings:[])}).catch(t=>{e||(b(t instanceof Error?t.message:`Failed to load`),d([]))}).finally(()=>{e||(p(!1),v(!0))}),()=>{e=!0}},[i,s,n,t]);let E=(0,T.useCallback)(()=>l(new Date),[]),D=(0,T.useCallback)(()=>l(e=>P(i,e,-1)),[i]),O=(0,T.useCallback)(()=>l(e=>P(i,e,1)),[i]),k=(0,T.useCallback)(e=>{l(e),a(`month`)},[]);(0,T.useEffect)(()=>{S(null)},[i,s]);let A=(0,T.useCallback)(e=>{d(t=>t.map(t=>t.meetingId===e.meetingId?e:t)),S(e)},[]),j=(0,T.useCallback)(e=>{d(t=>t.filter(t=>t.meetingId!==e)),S(null)},[]);return h?(0,L.jsxs)(`div`,{className:`cal-page`,children:[(0,L.jsxs)(`header`,{className:`cal-header`,children:[(0,L.jsxs)(`div`,{className:`cal-nav`,children:[(0,L.jsx)(`span`,{className:`cal-range-label`,children:pe(i,s)}),(0,L.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:D,"aria-label":`Previous`,children:(0,L.jsx)(g,{size:18})}),(0,L.jsx)(`button`,{type:`button`,className:`cal-nav-btn`,onClick:O,"aria-label":`Next`,children:(0,L.jsx)(_,{size:18})}),(0,L.jsx)(`button`,{type:`button`,className:`cal-today-btn`,onClick:E,children:`Today`}),f&&(0,L.jsx)(r,{size:16,className:`spin`})]}),(0,L.jsx)(`div`,{className:`cal-views`,children:fe.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`cal-view-btn${e===i?` cal-view-btn-active`:``}`,onClick:()=>a(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),C&&(0,L.jsxs)(`a`,{className:`cal-booking-link`,href:`https://${C}`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,L.jsx)(m,{size:14}),` Booking page`]})]}),(0,L.jsxs)(`div`,{className:`cal-body`,children:[y&&(0,L.jsxs)(`div`,{className:`cal-error`,children:[`Could not load the calendar: `,y]}),i===`day`&&(0,L.jsx)(Z,{anchor:s,meetings:u,onSelect:S}),i===`week`&&(0,L.jsx)(J,{anchor:s,meetings:u,onSelect:S}),i===`month`&&(0,L.jsx)(B,{anchor:s,meetings:u,onSelect:S}),i===`year`&&(0,L.jsx)(re,{anchor:s,meetings:u,onPickMonth:k})]}),x&&(0,L.jsx)(de,{meeting:x,adminFetch:t,onClose:()=>S(null),onSaved:A,onDeleted:j})]}):(0,L.jsx)(o,{surface:`gate`})}(0,w.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(me,{}));
@@ -0,0 +1 @@
1
+ import{G as e,V as t}from"./useSubAccountSwitcher-BufCPDDH.js";import"./useVoiceRecorder-BFrPC-s7.js";import"./AdminShell-Bpo_wgxm.js";import{n}from"./page-BWoNW3sa.js";import"./useCopyFeedback-uMJT-p6i.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -0,0 +1 @@
1
+ import{F as e}from"./useSubAccountSwitcher-BufCPDDH.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{F as e}from"./useSubAccountSwitcher-BufCPDDH.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{F as e}from"./useSubAccountSwitcher-BufCPDDH.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{G as e,V as t}from"./useSubAccountSwitcher-BufCPDDH.js";import"./useVoiceRecorder-BFrPC-s7.js";import{t as n}from"./page-O5HkHQw4.js";import"./graph-labels-CwdkCxfs.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +1 @@
1
- import{P as e}from"./useSubAccountSwitcher-DWMWxvYo.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
1
+ import{F as e}from"./useSubAccountSwitcher-BufCPDDH.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};