openmausbot 0.1.98 → 0.1.100

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 (397) hide show
  1. package/dist/assets/{ActivityPanel-H6D3SD39.js → ActivityPanel-CA9zfl3_.js} +1 -1
  2. package/dist/assets/BotSettingsDialog-3i_izROu.js +7 -0
  3. package/dist/assets/{CloudBackendPicker-iezpJFpF.js → CloudBackendPicker-BR42-xBg.js} +1 -1
  4. package/dist/assets/{ComputerPanel-DZPj-IWu.js → ComputerPanel-CvThnFmt.js} +1 -1
  5. package/dist/assets/{DesktopViewer-utONms1p.js → DesktopViewer-CqovWUic.js} +1 -1
  6. package/dist/assets/InspectorPanel-Cbjm86gt.js +5 -0
  7. package/dist/assets/{KeyboardShortcutsModal-gk9mvHj_.js → KeyboardShortcutsModal-X13pVrkh.js} +1 -1
  8. package/dist/assets/{LocalVmWorkspace-DLIvd2kC.js → LocalVmWorkspace-BGD3Tvd3.js} +1 -1
  9. package/dist/assets/{MacLocalControl-bJv8yiPB.js → MacLocalControl-ExdXHVUv.js} +1 -1
  10. package/dist/assets/NewBotDialog-ftDBMjWR.js +2 -0
  11. package/dist/assets/RemoteAgentSettingsPanel-BUHLV_vC.js +1 -0
  12. package/dist/assets/RoutinesPage-Buk5-r3o.js +1 -0
  13. package/dist/assets/{RoutinesSection-Dny9ra-c.js → RoutinesSection-NyReOXr8.js} +1 -1
  14. package/dist/assets/{SettingsModal-gC6XJJmt.js → SettingsModal-DkkhdxKM.js} +3 -3
  15. package/dist/assets/{TeamMapPage-B6fuu4r_.js → TeamMapPage-BIxeHoy3.js} +1 -1
  16. package/dist/assets/{TriggersPanel-j0qTP2CO.js → TriggersPanel-m5iqc43H.js} +1 -1
  17. package/dist/assets/{VisibilitySection-DT0FqPvu.js → VisibilitySection-y8Adk-c4.js} +1 -1
  18. package/dist/assets/WebhooksPanel-G_NWjHOP.js +3 -0
  19. package/dist/assets/{abnfDiagram-O67JEVCF-BsjcFX0-.js → abnfDiagram-O67JEVCF-D56ZgyPf.js} +1 -1
  20. package/dist/assets/{activity-BxOkayvD.js → activity-D_puBfZo.js} +1 -1
  21. package/dist/assets/{arc-CJNA94c6.js → arc-DzduGHbq.js} +1 -1
  22. package/dist/assets/{architectureDiagram-NJMV4G6O-dz2ud7lP.js → architectureDiagram-NJMV4G6O-C4NS6DQF.js} +1 -1
  23. package/dist/assets/{blockDiagram-BEXU5L5S-ChBEALoR.js → blockDiagram-BEXU5L5S-BNvsskiE.js} +1 -1
  24. package/dist/assets/{brain-CFZ7PEXc.js → brain-oq48IgWl.js} +1 -1
  25. package/dist/assets/{c4Diagram-YGBWAQC7-KZNRKDQe.js → c4Diagram-YGBWAQC7-ch3B7xZy.js} +1 -1
  26. package/dist/assets/channel-CmFDMHrN.js +1 -0
  27. package/dist/assets/{chunk-2Q5K7J3B-BLLwmCET.js → chunk-2Q5K7J3B-D9dL9ZS7.js} +1 -1
  28. package/dist/assets/{chunk-3FUC2YCW-CQxyreBZ.js → chunk-3FUC2YCW-DmLUUuNr.js} +2 -2
  29. package/dist/assets/{chunk-5VM5RSS4-D6sFMW0u.js → chunk-5VM5RSS4-B90ODeo2.js} +1 -1
  30. package/dist/assets/{chunk-GTNCS2PH-BaZ1YgLF.js → chunk-GTNCS2PH-BtlGIG3W.js} +1 -1
  31. package/dist/assets/{chunk-GWA4HPMP-CcalphmC.js → chunk-GWA4HPMP-CurBwFFG.js} +1 -1
  32. package/dist/assets/{chunk-JWPE2WC7-CSk8R3ve.js → chunk-JWPE2WC7-DTjNNXcd.js} +1 -1
  33. package/dist/assets/{chunk-NETBCI7D-CTmLjA57.js → chunk-NETBCI7D-xS7hOqBJ.js} +1 -1
  34. package/dist/assets/{chunk-WEXAMYUT-CM9Z77Ne.js → chunk-WEXAMYUT-DJZBSyA9.js} +1 -1
  35. package/dist/assets/{chunk-XXDRQBXY-B1fxpMS2.js → chunk-XXDRQBXY-CbiNRzjt.js} +1 -1
  36. package/dist/assets/{classDiagram-v2-NBCMYWYE-DCCyoLpj.js → classDiagram-v2-NBCMYWYE-DyON9tUb.js} +1 -1
  37. package/dist/assets/core-CRkAXD3N.js +12 -0
  38. package/dist/assets/{cose-bilkent-JH36ORCC-KyImBKvE.js → cose-bilkent-JH36ORCC-C7UwNnp8.js} +1 -1
  39. package/dist/assets/cpp-DddhVWhK.js +1 -0
  40. package/dist/assets/{cynefin-OW5HDTMX-fsZc6MGa.js → cynefin-OW5HDTMX-Dv1GTekc.js} +1 -1
  41. package/dist/assets/{cynefinDiagram-VND7K2PF-CGmHsShB.js → cynefinDiagram-VND7K2PF-CKgpyZxo.js} +1 -1
  42. package/dist/assets/{dagre-6A5THRUB-Dah1h-CH.js → dagre-6A5THRUB-BY3cYc8R.js} +1 -1
  43. package/dist/assets/{diagram-22UHCM2B-BIu71OyV.js → diagram-22UHCM2B-D71jBFCO.js} +1 -1
  44. package/dist/assets/{diagram-3UASUU5V-gxhUB_Mu.js → diagram-3UASUU5V-Bc3i6JGD.js} +1 -1
  45. package/dist/assets/{diagram-ATOU4E4O-CBhusUBn.js → diagram-ATOU4E4O-BPDSHISG.js} +1 -1
  46. package/dist/assets/{diagram-CDSNMT55-BdPrc86x.js → diagram-CDSNMT55-xuCT1v32.js} +1 -1
  47. package/dist/assets/{diagram-MLGK6HIB-Clp110R_.js → diagram-MLGK6HIB-LEDTXDPg.js} +1 -1
  48. package/dist/assets/{diagram-MPIPVDR6-DJKfbugw.js → diagram-MPIPVDR6-B0kfscRD.js} +1 -1
  49. package/dist/assets/{ebnfDiagram-ZINNZB2B-DnsltoBu.js → ebnfDiagram-ZINNZB2B-B-Z0HLzJ.js} +1 -1
  50. package/dist/assets/{elk-276RUBZZ-jWdq6gqH.js → elk-276RUBZZ-Bzypn7lU.js} +1 -1
  51. package/dist/assets/engine-javascript-D5Xfc425.js +141 -0
  52. package/dist/assets/{erDiagram-OPXOYQCR-DArPVf8u.js → erDiagram-OPXOYQCR-vl1xKmbS.js} +1 -1
  53. package/dist/assets/{flowDiagram-KWPJA3E3-D2HZ-2f7.js → flowDiagram-KWPJA3E3-DQXCXm7z.js} +1 -1
  54. package/dist/assets/{ganttDiagram-FUAMR5RP--o0KIxEo.js → ganttDiagram-FUAMR5RP-B0wwnP2j.js} +1 -1
  55. package/dist/assets/{gitGraphDiagram-X574FWY7-CsoXr2D7.js → gitGraphDiagram-X574FWY7-HfEVZRuR.js} +1 -1
  56. package/dist/assets/{image-plus-BbVjGHin.js → image-plus-D9o3v9bi.js} +1 -1
  57. package/dist/assets/{index-C3NqfdVU.js → index-CyM91z0J.js} +205 -205
  58. package/dist/assets/{index-BrPW5HDO.css → index-DbN_Hfjs.css} +1 -1
  59. package/dist/assets/{infoDiagram-VRGFBTTK-g-6lNp7r.js → infoDiagram-VRGFBTTK-BcCklxlu.js} +1 -1
  60. package/dist/assets/{ishikawaDiagram-OU5B5YK6-B1d6qVTV.js → ishikawaDiagram-OU5B5YK6-Bw7Fp8yZ.js} +1 -1
  61. package/dist/assets/{journeyDiagram-ZHPQQLJL-BTPuiU6T.js → journeyDiagram-ZHPQQLJL-BqFaTPiB.js} +1 -1
  62. package/dist/assets/{kanban-definition-PNTS6WVX-bDDuRJvP.js → kanban-definition-PNTS6WVX-BdGyimUh.js} +1 -1
  63. package/dist/assets/{linear-BVVKbEMy.js → linear-DezKjgv7.js} +1 -1
  64. package/dist/assets/{mermaid.core-JJdoKyKB.js → mermaid.core-97L7xtx0.js} +5 -5
  65. package/dist/assets/{mindmap-definition-NLK3R4M7-B4aE3T0q.js → mindmap-definition-NLK3R4M7-DP6qz87C.js} +1 -1
  66. package/dist/assets/{page-visible-BBo_Zm8g.js → page-visible-BehtKJDm.js} +1 -1
  67. package/dist/assets/{pegDiagram-GJSIUBJH-DFKQWpR7.js → pegDiagram-GJSIUBJH-CsYSloVz.js} +1 -1
  68. package/dist/assets/{pieDiagram-5QR66LMP-Iv7OKVJi.js → pieDiagram-5QR66LMP-CFI2Dcix.js} +1 -1
  69. package/dist/assets/{quadrantDiagram-O4NWA36T-U2YnfwBk.js → quadrantDiagram-O4NWA36T-DqTdAE5z.js} +1 -1
  70. package/dist/assets/{railroadDiagram-XR7U4H2S-CuPy6RqM.js → railroadDiagram-XR7U4H2S-t_rszRIF.js} +1 -1
  71. package/dist/assets/{remote-desktop-panel-BNEj7tUx.js → remote-desktop-panel-WTaz_HI9.js} +1 -1
  72. package/dist/assets/{requirementDiagram-PLB6GJNP-bMI5AK7T.js → requirementDiagram-PLB6GJNP-1MU-l7p8.js} +1 -1
  73. package/dist/assets/ruby-Ct1eTYOr.js +1 -0
  74. package/dist/assets/{sankeyDiagram-IPEJSGJF-BKcFE2WQ.js → sankeyDiagram-IPEJSGJF-CtkrwAvo.js} +1 -1
  75. package/dist/assets/{sequenceDiagram-PO4LG4MO-Bn9q88kl.js → sequenceDiagram-PO4LG4MO-CJOwBubv.js} +1 -1
  76. package/dist/assets/{sizeCapture-INFHLROL-Cvmdq9HD.js → sizeCapture-INFHLROL-DhQVhKCc.js} +1 -1
  77. package/dist/assets/{stateDiagram-v2-GCMORJYK-JJQYw3eQ.js → stateDiagram-v2-GCMORJYK-CaQK9yA9.js} +1 -1
  78. package/dist/assets/{swimlanes-2SLR337P-BkSCBEwp.js → swimlanes-2SLR337P-Ct8cqf01.js} +1 -1
  79. package/dist/assets/swimlanesDiagram-TC7HE7FX-BBUcFKOA.js +8 -0
  80. package/dist/assets/{timeline-definition-EJHVYXUP-DsaM4GHr.js → timeline-definition-EJHVYXUP-qim2Km3q.js} +1 -1
  81. package/dist/assets/{usecaseDiagram-POWQR4AR-3FOwLq7B.js → usecaseDiagram-POWQR4AR-BIzcxmgX.js} +1 -1
  82. package/dist/assets/{user-DcZBnAuv.js → user-EQ8rI0f4.js} +1 -1
  83. package/dist/assets/{vennDiagram-UO4OBE2U-DyNjJsKt.js → vennDiagram-UO4OBE2U-BFEuz8Ba.js} +1 -1
  84. package/dist/assets/{wardleyDiagram-VNRHLVJA-Y4ZMcnBC.js → wardleyDiagram-VNRHLVJA-JRkAN01c.js} +1 -1
  85. package/dist/assets/{xychartDiagram-PMCCYNJV-BXZpg955.js → xychartDiagram-PMCCYNJV-WBsvmu0R.js} +1 -1
  86. package/dist/index.html +2 -2
  87. package/dist-server/drivers/agents-proxy.js +10 -9
  88. package/dist-server/index.js +1483 -813
  89. package/dist-server/openmausbot.js +248 -152
  90. package/dist-server/pair-cli.js +248 -152
  91. package/dist-server/server/activity.js +2 -0
  92. package/dist-server/server/checkpoints.js +55 -39
  93. package/dist-server/server/direct-apply.js +20 -0
  94. package/dist-server/server/drivers/agents-call.js +1 -1
  95. package/dist-server/server/drivers/agents-catalog.js +11 -8
  96. package/dist-server/server/drivers/codex.js +147 -24
  97. package/dist-server/server/drivers/device-auth.js +5 -4
  98. package/dist-server/server/drivers/openai-chat.js +5 -4
  99. package/dist-server/server/harness/registry.js +63 -45
  100. package/dist-server/server/index.js +203 -23
  101. package/dist-server/server/mcp-oauth.js +125 -47
  102. package/dist-server/server/mcp-probe.js +18 -10
  103. package/dist-server/server/message-file.js +95 -3
  104. package/dist-server/server/model-requests.js +55 -4
  105. package/dist-server/server/profile-requests.js +80 -4
  106. package/dist-server/server/request-auth.js +1 -0
  107. package/dist-server/server/routes/undo.js +17 -0
  108. package/dist-server/server/routine-requests.js +210 -6
  109. package/dist-server/server/setup-mode.js +1 -1
  110. package/dist-server/server/skill-learn.js +2 -2
  111. package/dist-server/server/skills.js +30 -0
  112. package/dist-server/server/system-prompt.js +1 -1
  113. package/dist-server/server/turn-continuation.js +13 -18
  114. package/dist-server/server/workspace-backup.js +6 -1
  115. package/dist-server/workspace-backup.worker.js +1 -1
  116. package/package.json +1 -1
  117. package/skills/create-verification-skill/SKILL.md +9 -8
  118. package/skills/create-verification-skill/manifest.json +1 -1
  119. package/dist/assets/BotSettingsDialog-Dqz_AiBZ.js +0 -7
  120. package/dist/assets/InspectorPanel-OVaBVrzC.js +0 -5
  121. package/dist/assets/NewBotDialog-1qGOAdUM.js +0 -2
  122. package/dist/assets/RemoteAgentSettingsPanel-DqKr0HkO.js +0 -1
  123. package/dist/assets/RoutinesPage-BM2D4qGi.js +0 -1
  124. package/dist/assets/WebhooksPanel--YQyCjKO.js +0 -3
  125. package/dist/assets/abap-BdImnpbu.js +0 -1
  126. package/dist/assets/actionscript-3-B3316cI-.js +0 -1
  127. package/dist/assets/ada-bCR0ucgS.js +0 -1
  128. package/dist/assets/ahk-CsyLZFj1.js +0 -1
  129. package/dist/assets/ahk2-8Zs4aa1G.js +0 -1
  130. package/dist/assets/andromeeda-C4gqWexZ.js +0 -1
  131. package/dist/assets/angular-html-DA-rfuFy.js +0 -1
  132. package/dist/assets/angular-ts-BrjP3tb8.js +0 -1
  133. package/dist/assets/apache-Pmp26Uib.js +0 -1
  134. package/dist/assets/apex-DhZFqWV2.js +0 -1
  135. package/dist/assets/apl-CORt7UWP.js +0 -1
  136. package/dist/assets/applescript-Co6uUVPk.js +0 -1
  137. package/dist/assets/ara-BRHolxvo.js +0 -1
  138. package/dist/assets/asciidoc-CSVQ5wI8.js +0 -1
  139. package/dist/assets/asm-D_Q5rh1f.js +0 -1
  140. package/dist/assets/astro-HNnZUWAn.js +0 -1
  141. package/dist/assets/aurora-x-D-2ljcwZ.js +0 -1
  142. package/dist/assets/awk-DMzUqQB5.js +0 -1
  143. package/dist/assets/ayu-dark-DYE7WIF3.js +0 -1
  144. package/dist/assets/ayu-light-BA47KaF1.js +0 -1
  145. package/dist/assets/ayu-mirage-32ctXXKs.js +0 -1
  146. package/dist/assets/ballerina-BFfxhgS-.js +0 -1
  147. package/dist/assets/bat-CickPsom.js +0 -1
  148. package/dist/assets/beancount-k_qm7-4y.js +0 -1
  149. package/dist/assets/berry-uYugtg8r.js +0 -1
  150. package/dist/assets/bibtex-CHM0blh-.js +0 -1
  151. package/dist/assets/bicep-Bmn6On1c.js +0 -1
  152. package/dist/assets/bird2-Bx8U0n9b.js +0 -1
  153. package/dist/assets/blade-2xfisSek.js +0 -1
  154. package/dist/assets/bsl-DlhNcFeZ.js +0 -1
  155. package/dist/assets/c3-Dp5svz6Z.js +0 -1
  156. package/dist/assets/cadence-Bv_4Rxtq.js +0 -1
  157. package/dist/assets/cairo-KRGpt6FW.js +0 -1
  158. package/dist/assets/catppuccin-frappe-CZL1YF0i.js +0 -1
  159. package/dist/assets/catppuccin-latte-DH-8KZSZ.js +0 -1
  160. package/dist/assets/catppuccin-macchiato-B7yYVSCf.js +0 -1
  161. package/dist/assets/catppuccin-mocha-Ct7hS0mc.js +0 -1
  162. package/dist/assets/channel-WhFyujhZ.js +0 -1
  163. package/dist/assets/chapel-DTp_pixX.js +0 -1
  164. package/dist/assets/clarity-Dn5IMItf.js +0 -1
  165. package/dist/assets/clojure-P80f7IUj.js +0 -1
  166. package/dist/assets/cmake-D1j8_8rp.js +0 -1
  167. package/dist/assets/cobol-nBiQ_Alo.js +0 -1
  168. package/dist/assets/codeowners-Bp6g37R7.js +0 -1
  169. package/dist/assets/codeql-DsOJ9woJ.js +0 -1
  170. package/dist/assets/coffee-Ch7k5sss.js +0 -1
  171. package/dist/assets/common-lisp-Cg-RD9OK.js +0 -1
  172. package/dist/assets/coq-C7JzOVbR.js +0 -1
  173. package/dist/assets/cpp-BMRokrvK.js +0 -1
  174. package/dist/assets/crystal-DGywbUpC.js +0 -1
  175. package/dist/assets/csv-fuZLfV_i.js +0 -1
  176. package/dist/assets/cue-D82EKSYY.js +0 -1
  177. package/dist/assets/cypher-COkxafJQ.js +0 -1
  178. package/dist/assets/d-85-TOEBH.js +0 -1
  179. package/dist/assets/dark-plus-C3mMm8J8.js +0 -1
  180. package/dist/assets/dax-CEL-wOlO.js +0 -1
  181. package/dist/assets/desktop-BmXAJ9_W.js +0 -1
  182. package/dist/assets/dotenv-Da5cRb03.js +0 -1
  183. package/dist/assets/dracula-BzJJZx-M.js +0 -1
  184. package/dist/assets/dracula-soft-BXkSAIEj.js +0 -1
  185. package/dist/assets/dream-maker-BtqSS_iP.js +0 -1
  186. package/dist/assets/edge-FbVlp4U3.js +0 -1
  187. package/dist/assets/elixir-CkH2-t6x.js +0 -1
  188. package/dist/assets/elm-DbKCFpqz.js +0 -1
  189. package/dist/assets/emacs-lisp-C_m_b--Z.js +0 -1
  190. package/dist/assets/erb-DXfck5VN.js +0 -1
  191. package/dist/assets/erlang-DsQrWhSR.js +0 -1
  192. package/dist/assets/everforest-dark-BgDCqdQA.js +0 -1
  193. package/dist/assets/everforest-light-C8M2exoo.js +0 -1
  194. package/dist/assets/fennel-BYunw83y.js +0 -1
  195. package/dist/assets/fluent-C4IJs8-o.js +0 -1
  196. package/dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
  197. package/dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
  198. package/dist/assets/fsharp-CXgrBDvD.js +0 -1
  199. package/dist/assets/gdresource-TyuKm33G.js +0 -1
  200. package/dist/assets/gdscript-DqcFQ5yU.js +0 -1
  201. package/dist/assets/gdshader-DkwncUOv.js +0 -1
  202. package/dist/assets/genie-D0YGMca9.js +0 -1
  203. package/dist/assets/gherkin-DyxjwDmM.js +0 -1
  204. package/dist/assets/git-commit-F4YmCXRG.js +0 -1
  205. package/dist/assets/git-rebase-r7XF79zn.js +0 -1
  206. package/dist/assets/github-dark-DHJKELXO.js +0 -1
  207. package/dist/assets/github-dark-dimmed-DH5Ifo-i.js +0 -1
  208. package/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +0 -1
  209. package/dist/assets/github-light-DAi9KRSo.js +0 -1
  210. package/dist/assets/github-light-high-contrast-BfjtVDDH.js +0 -1
  211. package/dist/assets/gleam-BspZqrRM.js +0 -1
  212. package/dist/assets/glimmer-js-ByusRIyA.js +0 -1
  213. package/dist/assets/glimmer-ts-BfAWNZQY.js +0 -1
  214. package/dist/assets/glsl-DplSGwfg.js +0 -1
  215. package/dist/assets/gn-n2N0HUVH.js +0 -1
  216. package/dist/assets/gnuplot-DdkO51Og.js +0 -1
  217. package/dist/assets/groovy-gcz8RCvz.js +0 -1
  218. package/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +0 -1
  219. package/dist/assets/gruvbox-dark-medium-GsRaNv29.js +0 -1
  220. package/dist/assets/gruvbox-dark-soft-CVdnzihN.js +0 -1
  221. package/dist/assets/gruvbox-light-hard-CH1njM8p.js +0 -1
  222. package/dist/assets/gruvbox-light-medium-DRw_LuNl.js +0 -1
  223. package/dist/assets/gruvbox-light-soft-hJgmCMqR.js +0 -1
  224. package/dist/assets/hack-BWmVpMyf.js +0 -1
  225. package/dist/assets/haml-D5jkg6IW.js +0 -1
  226. package/dist/assets/handlebars-BpdQsYii.js +0 -1
  227. package/dist/assets/haskell-Df6bDoY_.js +0 -1
  228. package/dist/assets/haxe-CfZj7gIn.js +0 -1
  229. package/dist/assets/hcl-BWvSN4gD.js +0 -1
  230. package/dist/assets/hjson-D5-asLiD.js +0 -1
  231. package/dist/assets/hlsl-D3lLCCz7.js +0 -1
  232. package/dist/assets/horizon-BUw7H-hv.js +0 -1
  233. package/dist/assets/horizon-bright-CUuTKBJd.js +0 -1
  234. package/dist/assets/houston-DnULxvSX.js +0 -1
  235. package/dist/assets/html-derivative-DlHx6ybY.js +0 -1
  236. package/dist/assets/http-jrhK8wxY.js +0 -1
  237. package/dist/assets/hurl-irOxFIW8.js +0 -1
  238. package/dist/assets/hxml-2-FPmUDs.js +0 -1
  239. package/dist/assets/hy-DFXneXwc.js +0 -1
  240. package/dist/assets/imba-DGztddWO.js +0 -1
  241. package/dist/assets/index-CJTp9JEp.js +0 -153
  242. package/dist/assets/ini-BEwlwnbL.js +0 -1
  243. package/dist/assets/jinja-f2NsQr07.js +0 -1
  244. package/dist/assets/jison-wvAkD_A8.js +0 -1
  245. package/dist/assets/jsonl-DcaNXYhu.js +0 -1
  246. package/dist/assets/jsonnet-DFQXde-d.js +0 -1
  247. package/dist/assets/jssm-C2t-YnRu.js +0 -1
  248. package/dist/assets/julia-5Bft2YPA.js +0 -1
  249. package/dist/assets/just-Cwhn7H3k.js +0 -1
  250. package/dist/assets/kanagawa-dragon-BuwD2xS4.js +0 -1
  251. package/dist/assets/kanagawa-lotus-C3DzagqV.js +0 -1
  252. package/dist/assets/kanagawa-wave-DFGoQZhC.js +0 -1
  253. package/dist/assets/kdl-DV7GczEv.js +0 -1
  254. package/dist/assets/kusto-wEQ09or8.js +0 -1
  255. package/dist/assets/laserwave-DUszq2jm.js +0 -1
  256. package/dist/assets/latex-D5pSuvFb.js +0 -1
  257. package/dist/assets/lean-BZvkOJ9d.js +0 -1
  258. package/dist/assets/light-plus-B7mTdjB0.js +0 -1
  259. package/dist/assets/liquid-C0sCDyMI.js +0 -1
  260. package/dist/assets/llvm-BZoOZj88.js +0 -1
  261. package/dist/assets/log-2UxHyX5q.js +0 -1
  262. package/dist/assets/logo-BtOb2qkB.js +0 -1
  263. package/dist/assets/luau-BnpPk5vE.js +0 -1
  264. package/dist/assets/marko-DjSrsDqO.js +0 -1
  265. package/dist/assets/material-theme-D5KoaKCx.js +0 -1
  266. package/dist/assets/material-theme-darker-BfHTSMKl.js +0 -1
  267. package/dist/assets/material-theme-lighter-B0m2ddpp.js +0 -1
  268. package/dist/assets/material-theme-ocean-CyktbL80.js +0 -1
  269. package/dist/assets/material-theme-palenight-Csfq5Kiy.js +0 -1
  270. package/dist/assets/matlab-D7o27uSR.js +0 -1
  271. package/dist/assets/mdc-D1_yUvq7.js +0 -1
  272. package/dist/assets/mermaid-CQcHuHx7.js +0 -1
  273. package/dist/assets/min-dark-CafNBF8u.js +0 -1
  274. package/dist/assets/min-light-CTRr51gU.js +0 -1
  275. package/dist/assets/mipsasm-CKIfxQSi.js +0 -1
  276. package/dist/assets/mojo-DJz3ZmWd.js +0 -1
  277. package/dist/assets/monokai-BRVnQi9A.js +0 -1
  278. package/dist/assets/moonbit-CHtswR0a.js +0 -1
  279. package/dist/assets/move-el3G9tDJ.js +0 -1
  280. package/dist/assets/narrat-DRg8JJMk.js +0 -1
  281. package/dist/assets/nextflow-C-mBbutL.js +0 -1
  282. package/dist/assets/nextflow-groovy-vE_lwT2v.js +0 -1
  283. package/dist/assets/nginx-BpAMiNFr.js +0 -1
  284. package/dist/assets/night-owl-C39BiMTA.js +0 -1
  285. package/dist/assets/night-owl-light-CMTm3GFP.js +0 -1
  286. package/dist/assets/nim-BIad80T-.js +0 -1
  287. package/dist/assets/nix-CwoSXNpI.js +0 -1
  288. package/dist/assets/nord-Ddv68eIx.js +0 -1
  289. package/dist/assets/nsis-BlV79W_Q.js +0 -1
  290. package/dist/assets/nushell-D3jzshHO.js +0 -1
  291. package/dist/assets/objective-c-DXmwc3jG.js +0 -1
  292. package/dist/assets/objective-cpp-CLxacb5B.js +0 -1
  293. package/dist/assets/ocaml-C0hk2d4L.js +0 -1
  294. package/dist/assets/odin-BBf5iR-q.js +0 -1
  295. package/dist/assets/one-dark-pro-DVMEJ2y_.js +0 -1
  296. package/dist/assets/one-light-C3Wv6jpd.js +0 -1
  297. package/dist/assets/openscad-C4EeE6gA.js +0 -1
  298. package/dist/assets/org-DM6o9KBp.js +0 -1
  299. package/dist/assets/pascal-D93ZcfNL.js +0 -1
  300. package/dist/assets/perl-B9cMNwum.js +0 -1
  301. package/dist/assets/pkl-u5AG7uiY.js +0 -1
  302. package/dist/assets/plastic-3e1v2bzS.js +0 -1
  303. package/dist/assets/plsql-ChMvpjG-.js +0 -1
  304. package/dist/assets/po-BTJTHyun.js +0 -1
  305. package/dist/assets/poimandres-CS3Unz2-.js +0 -1
  306. package/dist/assets/polar-C0HS_06l.js +0 -1
  307. package/dist/assets/postcss-CXtECtnM.js +0 -1
  308. package/dist/assets/powerquery-CEu0bR-o.js +0 -1
  309. package/dist/assets/prisma-Vru482bI.js +0 -1
  310. package/dist/assets/prolog-CbFg5uaA.js +0 -1
  311. package/dist/assets/pug-DKIMFp6K.js +0 -1
  312. package/dist/assets/puppet-BMWR74SV.js +0 -1
  313. package/dist/assets/purescript-CklMAg4u.js +0 -1
  314. package/dist/assets/qml-3beO22l8.js +0 -1
  315. package/dist/assets/qmldir-C8lEn-DE.js +0 -1
  316. package/dist/assets/qss-IeuSbFQv.js +0 -1
  317. package/dist/assets/racket-BqYA7rlc.js +0 -1
  318. package/dist/assets/raku-DXvB9xmW.js +0 -1
  319. package/dist/assets/razor-BjBPvh-w.js +0 -1
  320. package/dist/assets/rbs-CpoqiR4B.js +0 -1
  321. package/dist/assets/red-hvxz__6c.js +0 -1
  322. package/dist/assets/reg-C-SQnVFl.js +0 -1
  323. package/dist/assets/regexp-CDVJQ6XC.js +0 -1
  324. package/dist/assets/rel-C3B-1QV4.js +0 -1
  325. package/dist/assets/riscv-BM1_JUlF.js +0 -1
  326. package/dist/assets/ron-D8l8udqQ.js +0 -1
  327. package/dist/assets/rose-pine-5qJOZa0Y.js +0 -1
  328. package/dist/assets/rose-pine-dawn-zx0QlTCp.js +0 -1
  329. package/dist/assets/rose-pine-moon-C9pEdX9L.js +0 -1
  330. package/dist/assets/rosmsg-BJDFO7_C.js +0 -1
  331. package/dist/assets/rst-bs7f0vWN.js +0 -1
  332. package/dist/assets/ruby-C0TQ7zu5.js +0 -1
  333. package/dist/assets/sas-DEy46yEz.js +0 -1
  334. package/dist/assets/scala-CqE71os6.js +0 -1
  335. package/dist/assets/scheme-C98Dy4si.js +0 -1
  336. package/dist/assets/sdbl-DVxCFoDh.js +0 -1
  337. package/dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
  338. package/dist/assets/shellsession-BADoaaVG.js +0 -1
  339. package/dist/assets/slack-dark-BthQWCQV.js +0 -1
  340. package/dist/assets/slack-ochin-DqwNpetd.js +0 -1
  341. package/dist/assets/smalltalk-BOQMe2GC.js +0 -1
  342. package/dist/assets/smithy-cds9vsN8.js +0 -1
  343. package/dist/assets/snazzy-light-Bw305WKR.js +0 -1
  344. package/dist/assets/solarized-dark-CpvCGNkr.js +0 -1
  345. package/dist/assets/solarized-light-Dlz6yCKv.js +0 -1
  346. package/dist/assets/solidity-DijEV5ha.js +0 -1
  347. package/dist/assets/soy-8wufbnw4.js +0 -1
  348. package/dist/assets/sparql-rVzFXLq3.js +0 -1
  349. package/dist/assets/splunk-BtCnVYZw.js +0 -1
  350. package/dist/assets/ssh-config-_ykCGR6B.js +0 -1
  351. package/dist/assets/stata-DI20mbqo.js +0 -1
  352. package/dist/assets/stylus-BEDo0Tqx.js +0 -1
  353. package/dist/assets/surrealql-Cjom0U5J.js +0 -1
  354. package/dist/assets/svelte-Cy7k_4gC.js +0 -1
  355. package/dist/assets/swimlanesDiagram-TC7HE7FX-CmTirbVT.js +0 -8
  356. package/dist/assets/synthwave-84-CbfX1IO0.js +0 -1
  357. package/dist/assets/system-verilog-0hqHdDBg.js +0 -1
  358. package/dist/assets/systemd-4A_iFExJ.js +0 -1
  359. package/dist/assets/talonscript-CkByrt1z.js +0 -1
  360. package/dist/assets/tasl-QIJgUcNo.js +0 -1
  361. package/dist/assets/tcl-dwOrl1Do.js +0 -1
  362. package/dist/assets/templ-DhtptRzy.js +0 -1
  363. package/dist/assets/terraform-BETggiCN.js +0 -1
  364. package/dist/assets/tex-D96PA37w.js +0 -1
  365. package/dist/assets/tokyo-night-hegEt444.js +0 -1
  366. package/dist/assets/ts-tags-D351s5mN.js +0 -1
  367. package/dist/assets/tsv-B_m7g4N7.js +0 -1
  368. package/dist/assets/turtle-BsS91CYL.js +0 -1
  369. package/dist/assets/twig-27uCiNez.js +0 -1
  370. package/dist/assets/typespec-CAFt9gP4.js +0 -1
  371. package/dist/assets/typst-BUadGCkm.js +0 -1
  372. package/dist/assets/v-BGw2Nkan.js +0 -1
  373. package/dist/assets/vala-CsfeWuGM.js +0 -1
  374. package/dist/assets/vb-Cu-pLBUe.js +0 -1
  375. package/dist/assets/verilog-nZwndyjY.js +0 -1
  376. package/dist/assets/vesper-DRje8inN.js +0 -1
  377. package/dist/assets/vhdl-CeAyd5Ju.js +0 -1
  378. package/dist/assets/viml-CJc9bBzg.js +0 -1
  379. package/dist/assets/vitesse-black-Bkuqu6BP.js +0 -1
  380. package/dist/assets/vitesse-dark-D0r3Knsf.js +0 -1
  381. package/dist/assets/vitesse-light-CVO1_9PV.js +0 -1
  382. package/dist/assets/vue-BqiEGhQt.js +0 -1
  383. package/dist/assets/vue-html-AaS7Mt5G.js +0 -1
  384. package/dist/assets/vue-vine-BoDAl6tE.js +0 -1
  385. package/dist/assets/vyper-CDx5xZoG.js +0 -1
  386. package/dist/assets/wasm-CG6Dc4jp.js +0 -1
  387. package/dist/assets/wenyan-BV7otONQ.js +0 -1
  388. package/dist/assets/wgsl-Dx-B1_4e.js +0 -1
  389. package/dist/assets/wikitext-BhOHFoWU.js +0 -1
  390. package/dist/assets/wit-5i3qLPDT.js +0 -1
  391. package/dist/assets/wolfram-lXgVvXCa.js +0 -1
  392. package/dist/assets/xsl-CtQFsRM5.js +0 -1
  393. package/dist/assets/zenscript-DVFEvuxE.js +0 -1
  394. package/dist/assets/zig-VOosw3JB.js +0 -1
  395. /package/dist/assets/{shellscript-Yzrsuije.js → bash-Yzrsuije.js} +0 -0
  396. /package/dist/assets/{docker-BcOcwvcX.js → dockerfile-BcOcwvcX.js} +0 -0
  397. /package/dist/assets/{make-CHLpvVh8.js → makefile-CHLpvVh8.js} +0 -0
@@ -1 +0,0 @@
1
- import{k as ht,dG as At,r as m,g as oe,j as e,Q as kn,a8 as Et,S as zt,dH as Xn,B as Ye,t as x,d as De,dI as es,dJ as Dt,c as C,dK as ln,bA as qe,bB as jn,dL as Mt,F as Le,dM as nt,dN as pt,dO as Ge,dP as ts,u as rt,av as ns,b7 as Lt,ba as ss,W as as,P as dn,dQ as rs,aA as wn,X as ze,q as is,dR as os,v as Nn,w as Sn,aB as cn,E as Qe,dS as ls,T as ds,dT as Rt,dU as un,dV as cs,bM as us,a2 as Cn,a1 as xs,dW as ps,Y as ms,dX as hs}from"./index-C3NqfdVU.js";import{k as gs,b as bs}from"./WebhooksPanel--YQyCjKO.js";const fs=[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]],Dn=ht("repeat-2",fs);const ys=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]],It=ht("user-round-plus",ys);const vs=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],gt=ht("users-round",vs);const ks=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Ot=ht("video",ks),le=5,Xe=30,js=12,ws=12;function ne(t){const n=new Date(t);return n.setHours(0,0,0,0),n.getTime()}function pe(t,n){const s=new Date(t);return s.setDate(s.getDate()+n),s.getTime()}function Ns(t){const n=new Date(ne(t));return n.setDate(n.getDate()-(n.getDay()+6)%7),n.getTime()}function Me(t,n){const[s,o]=n.split(":").map(Number),l=new Date(t);return l.setHours(s,o,0,0),l.getTime()}function tt(t){return new Date(t-new Date(t).getTimezoneOffset()*6e4).toISOString().slice(0,10)}function bt(t){return new Date(t-new Date(t).getTimezoneOffset()*6e4).toISOString().slice(11,16)}function Nt(t,n,s){return s!=null&&t===tt(s)&&n===bt(s)?s:new Date(`${t}T${n}`).getTime()}function Ss(t,n){return Math.ceil((t+n*6e4)/6e4)*6e4}function Mn(t,n,s){return s?.everyMinutes===n?s.anchorAt:Ss(t,n)}function xn(t,n,s){const o=Mn(t,n,s);if(o>t)return o;const l=n*6e4;return o+(Math.floor((t-o)/l)+1)*l}function Cs(t,n=le){return Math.max(0,Math.min(1440-n,Math.round(t/n)*n))}function Ds(t){const n=l=>l.at+Math.max(15,l.durationMinutes)*6e4,s=[...t].sort((l,p)=>l.at-p.at||n(l)-n(p)||l.id.localeCompare(p.id)),o=new Map;for(let l=0;l<s.length;){const p=[];let g=s[l].at;for(;l<s.length;){const c=s[l];if(p.length>0&&c.at>=g)break;p.push(c),g=Math.max(g,n(c)),l+=1}const u=[],r=p.map(c=>{const y=u.findIndex(F=>F<=c.at),v=y===-1?u.length:y;return u[v]=n(c),{id:c.id,column:v}}),a=Math.max(1,u.length);for(const c of r)o.set(c.id,{column:c.column,columns:a})}return o}function Ms(t){if(t===0)return"GMT+0";const n=t>0?"+":"-",s=Math.abs(t),o=Math.floor(s/60),l=s%60;return`GMT${n}${o}${l?`:${String(l).padStart(2,"0")}`:""}`}function ut(t,n,s,o){const l=Cs((n-s)/o*60),p=new Date(t);return p.setHours(Math.floor(l/60),l%60,0,0),p.getTime()}function pn(t,n,s){if(t.type==="cron")throw new Error("Edit this routine's schedule to change its cron timing.");if(t.type==="once")return{type:"once",at:s};if(t.type==="interval")return{...t,anchorAt:t.anchorAt+(s-n)};const o=Math.round((ne(s)-ne(n))/864e5);return{type:"daily",time:bt(s),weekdays:t.weekdays.map(l=>((l+o)%7+7)%7).sort()}}function mn(t,n,s,o){const l=new Map(t.map(a=>[a.id,a])),p=new Map,u=n.filter(a=>a.scheduledFor>=s&&a.scheduledFor<o).sort((a,c)=>c.scheduledFor-a.scheduledFor).filter(a=>{if(a.status==="queued"||a.status==="running"||a.status==="waiting")return!0;const c=p.get(a.routineId)??0;return c>=js?!1:(p.set(a.routineId,c+1),!0)}).map(a=>({id:`run-${a.id}`,at:a.scheduledFor,durationMinutes:Xe,routine:l.get(a.routineId)??null,run:a})),r=(a,c)=>n.some(y=>y.routineId===a&&Math.abs(y.scheduledFor-c)<6e4);for(const a of t)if(a.enabled){if(a.schedule.type==="cron"){if(a.nextRunAt==null)continue;for(let c=ne(Math.max(s,a.nextRunAt));c<o;c=pe(c,1)){const y=Math.max(c,s,a.createdAt,a.nextRunAt)-1,v=At(a.schedule,y,ws);if(!v.length||v[0]>=o)break;c=ne(v[0]);const F=Math.min(o,pe(c,1));for(const h of v){if(h>=F)break;r(a.id,h)||u.push({id:`next-${a.id}-${h}`,at:h,durationMinutes:Xe,routine:a,run:null})}}continue}if(a.schedule.type==="once"){const c=a.schedule.at;c>=s&&c<o&&!r(a.id,c)&&u.push({id:`next-${a.id}-${c}`,at:c,durationMinutes:Xe,routine:a,run:null});continue}if(a.schedule.type==="interval"){const c=a.nextRunAt;c!=null&&c>=s&&c<o&&!r(a.id,c)&&u.push({id:`next-${a.id}-${c}`,at:c,durationMinutes:Xe,routine:a,run:null});continue}for(let c=ne(s);c<o;c=pe(c,1)){if(!a.schedule.weekdays.includes(new Date(c).getDay()))continue;const y=Me(c,a.schedule.time);y>=s&&y<o&&y>=a.createdAt&&!r(a.id,y)&&u.push({id:`next-${a.id}-${y}`,at:y,durationMinutes:Xe,routine:a,run:null})}}return u.sort((a,c)=>a.at-c.at)}function Rs(t,n){const s=pe(t,n-1),o=new Date(t),l=new Date(s);return n===1?o.toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"}):o.getMonth()===l.getMonth()?`${o.toLocaleDateString([],{month:"long"})} ${o.getDate()} – ${l.getDate()}, ${l.getFullYear()}`:`${o.toLocaleDateString([],{month:"short",day:"numeric"})} – ${l.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})}`}const hn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Is=["January","February","March","April","May","June","July","August","September","October","November","December"];function $s(t){const[n,s,o,l,p]=t.expression.trim().split(/\s+/);let g=`Cron ${t.expression}`;if(/^\d+$/.test(n??"")&&/^\d+$/.test(s??"")){const u=`${s.padStart(2,"0")}:${n.padStart(2,"0")}`,r=/^\d+$/.test(o??"")?Number(o):null;if(p==="*"&&l==="*")o==="*"?g=`Every day at ${u}`:o==="L"?g=`Monthly on the last day at ${u}`:r!==null&&(g=`Monthly on day ${r} at ${u}`);else if(p==="*"&&/^\d+$/.test(l??"")&&r!==null){const a=Is[Number(l)-1];a&&(g=`Yearly on ${a} ${r} at ${u}`)}else if(o==="*"&&l==="*")if(p==="1-5"||p?.toUpperCase()==="MON-FRI")g=`Every weekday at ${u}`;else if(/^[0-7]$/.test(p??""))g=`Weekly on ${hn[Number(p)%7]} at ${u}`;else{const a=/^([0-7])#([1-5]|L)$/i.exec(p??"");a&&(g=`Monthly on the ${a[2].toUpperCase()==="L"?"last":["","first","second","third","fourth","fifth"][Number(a[2])]} ${hn[Number(a[1])%7]} at ${u}`)}}return`${g} · ${t.timeZone}`}const Ee=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function se(t){return new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function ft(t){return new Date(t).toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}function ga(t){const n=new Date(t);return new Date().toDateString()===n.toDateString()?se(t):n.toLocaleDateString([],{month:"short",day:"numeric"})}function st(t){return t<60?`${t} min`:t%60===0?`${t/60} hr`:`${Math.floor(t/60)} hr ${t%60} min`}function Rn(t){return t<60?`Every ${t} min`:t===60?"Every hour":t%60===0?`Every ${t/60} hr`:`Every ${Math.floor(t/60)} hr ${t%60} min`}function Ts(t){const n=[];if(t.weekdays&&t.weekdays.length<7&&n.push(t.weekdays.join(",")==="1,2,3,4,5"?"weekdays":t.weekdays.map(s=>Ee[s]).join(", ")),t.window){const s=o=>{const[l,p]=o.split(":").map(Number);return se(new Date(2e3,0,1,l,p).getTime())};n.push(`${s(t.window.start)}–${s(t.window.end)}`)}return t.endsAt!=null&&n.push(`until ${new Date(t.endsAt).toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})}`),n}function yt(t){if(t.type==="cron")return $s(t);if(t.type==="once")return`${ft(t.at)}, ${se(t.at)}`;if(t.type==="interval")return[Rn(t.everyMinutes),...Ts(t)].join(" · ");const n=t.weekdays;return`${n.length===7?"Every day":n.join(",")==="1,2,3,4,5"?"Every weekday":n.length===1?`Weekly on ${Ee[n[0]]}`:n.map(o=>Ee[o]).join(", ")} at ${se(Me(Date.now(),t.time))}`}const As=m.createContext({request:oe});function Es(){return m.useContext(As)}const zs=["M","T","W","T","F","S","S"];function St(t){const n=new Date(t);return new Date(n.getFullYear(),n.getMonth(),1)}function gn(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function bn(t,n){return new Date(t.getFullYear(),t.getMonth()+n,1)}function Ls({anchor:t,onSelect:n}){const[s,o]=m.useState(()=>St(t));m.useEffect(()=>{o(St(t))},[t]);const l=m.useMemo(()=>{const r=St(s),a=(r.getDay()+6)%7,c=new Date(r);return c.setDate(r.getDate()-a),Array.from({length:42},(y,v)=>{const F=new Date(c);return F.setDate(c.getDate()+v),F})},[s]),p=new Date(t),g=new Date,u=s.toLocaleDateString(void 0,{month:"long",year:"numeric"});return e.jsxs("section",{"aria-label":"Mini calendar",className:"select-none px-3 py-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsx("div",{className:"text-[12.5px] font-semibold text-ink",children:u}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{type:"button",onClick:()=>o(r=>bn(r,-1)),className:"flex size-7 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-raised hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60","aria-label":"Previous month",children:e.jsx(kn,{size:15,"aria-hidden":"true"})}),e.jsx("button",{type:"button",onClick:()=>o(r=>bn(r,1)),className:"flex size-7 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-raised hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60","aria-label":"Next month",children:e.jsx(Et,{size:15,"aria-hidden":"true"})})]})]}),e.jsx("div",{className:"grid grid-cols-7","aria-hidden":"true",children:zs.map((r,a)=>e.jsx("div",{className:"flex h-6 items-center justify-center text-[9px] font-semibold uppercase tracking-[0.08em] text-ink-tertiary",children:r},`${r}-${a}`))}),e.jsx("div",{className:"grid grid-cols-7 gap-y-0.5",children:l.map(r=>{const a=gn(r,p),c=gn(r,g),y=r.getMonth()!==s.getMonth(),v=r.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});return e.jsx("button",{type:"button",onClick:()=>n(r.getTime()),"aria-label":v,"aria-current":c?"date":void 0,"aria-pressed":a,className:"group flex h-7 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60",children:e.jsx("span",{className:`flex size-6 items-center justify-center rounded-full text-[10.5px] transition-colors ${a?"bg-accent font-semibold text-white shadow-sm":c?"font-semibold text-accent group-hover:bg-accent/12":y?"text-ink-tertiary group-hover:bg-raised group-hover:text-ink":"text-ink group-hover:bg-raised"}`,children:r.getDate()})},`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`)})})]})}const Os="application/x-openmaus-bot";function Ps({bots:t,anchor:n,onSelectDate:s}){const[o,l]=m.useState(""),p=m.useMemo(()=>{const u=o.trim().toLocaleLowerCase();return u?t.filter(r=>`${r.name} ${r.title} ${r.description}`.toLocaleLowerCase().includes(u)):t},[t,o]),g=(u,r)=>{u.dataTransfer.effectAllowed="copy",u.dataTransfer.setData(Os,r.id),u.dataTransfer.setData("text/plain",r.id)};return e.jsxs("aside",{"aria-label":"Schedule sidebar",className:"flex h-full w-[320px] shrink-0 flex-col overflow-hidden border-r border-hairline/40 bg-panel",children:[e.jsx(Ls,{anchor:n,onSelect:s}),e.jsx("div",{className:"mx-4 border-t border-hairline/40"}),e.jsxs("section",{"aria-labelledby":"calendar-bots-heading",className:"flex min-h-0 flex-1 flex-col px-3 pb-3 pt-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[e.jsxs("div",{id:"calendar-bots-heading",className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.11em] text-ink-secondary",children:[e.jsx(gt,{size:13,"aria-hidden":"true"}),"My bots"]}),e.jsx("span",{className:"rounded-full bg-raised px-1.5 py-0.5 text-[9px] tabular-nums text-ink-secondary",children:t.length})]}),e.jsxs("label",{className:"relative mb-2 block",children:[e.jsx("span",{className:"sr-only",children:"Search bots"}),e.jsx(zt,{size:13,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-ink-tertiary","aria-hidden":"true"}),e.jsx("input",{value:o,onChange:u=>l(u.target.value),type:"search",placeholder:"Search bots",className:"h-8 w-full rounded-lg border border-hairline/45 bg-control/55 pl-8 pr-2.5 text-[11.5px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/60 focus:bg-control"})]}),e.jsxs("div",{role:"list","aria-label":"Bots available to schedule",className:"min-h-0 flex-1 space-y-0.5 overflow-y-auto pr-0.5",children:[p.map(u=>e.jsxs("div",{draggable:!0,onDragStart:r=>g(r,u),role:"listitem",className:"group flex cursor-grab items-center gap-2 rounded-xl px-2 py-2 transition-colors hover:bg-raised/80 active:cursor-grabbing","aria-label":`Drag ${u.name} onto the schedule`,title:`Drag ${u.name} onto the schedule`,children:[e.jsx(Xn,{size:13,className:"shrink-0 text-ink-secondary/35 transition-colors group-hover:text-ink-secondary","aria-hidden":"true"}),e.jsx(Ye,{bot:u,size:27,animated:!1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[11.5px] font-medium text-ink",children:u.name}),e.jsx("div",{className:"truncate text-[9.5px] text-ink-tertiary",children:u.title||"BotAgent"})]}),e.jsx("span",{className:"shrink-0 rounded-full border border-hairline/50 px-1.5 py-0.5 text-[8.5px] text-ink-tertiary opacity-0 transition-opacity group-hover:opacity-100",children:"Drag"})]},u.id)),p.length===0&&e.jsx("div",{className:"px-3 py-8 text-center text-[11px] leading-relaxed text-ink-secondary",children:t.length===0?"Create a bot to schedule work.":"No bots match your search."})]}),e.jsx("p",{className:"mt-2 px-2 text-[9.5px] leading-relaxed text-ink-tertiary",children:"Drag a bot onto any time to schedule it."})]})]})}function Fs({routines:t,runs:n,bots:s,loading:o,error:l,onOpen:p,onLogs:g}){const u=[...t].sort((r,a)=>Number(a.enabled)-Number(r.enabled)||(r.nextRunAt??1/0)-(a.nextRunAt??1/0)||r.name.localeCompare(a.name));return e.jsxs("div",{className:"space-y-3","aria-label":x("routines.list"),children:[l&&e.jsx("div",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:x("routines.loadError")}),o&&e.jsxs("p",{role:"status",className:"flex items-center gap-2 p-3 text-[12px] text-ink-secondary",children:[e.jsx(De,{size:14,className:"animate-spin"}),x("routines.loading")]}),!o&&!l&&u.length===0&&e.jsxs("div",{className:"rounded-xl border border-dashed border-hairline/50 p-5 text-center text-[13px] text-ink-secondary",children:[e.jsx(Dn,{size:20,className:"mx-auto mb-2 opacity-60"}),x("routines.empty")]}),u.map(r=>{const a=es(r.id,n),c=s?.find(y=>y.id===r.botId);return e.jsxs("article",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","aria-label":r.name,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>p(r),className:"min-w-0 flex-1 text-left hover:text-accent",children:[e.jsx("span",{className:"block truncate text-[13px] font-semibold text-ink",children:r.name}),e.jsxs("span",{className:"mt-1 block text-[11.5px] leading-relaxed text-ink-secondary",children:[c&&`${c.name} · `,yt(r.schedule)]})]}),e.jsx("span",{className:C("shrink-0 rounded-full bg-inset px-2 py-0.5 text-[10px]",r.enabled&&r.nextRunAt!=null?"text-accent":"text-ink-secondary"),children:Dt(r)})]}),ln(r)!==Dt(r)&&e.jsx("div",{className:"mt-2 text-[11.5px] text-ink-secondary",children:ln(r)}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-2",children:[e.jsx("div",{className:"min-w-0 text-[11.5px]",children:a?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:jn(a),children:x("routines.latestRun",{status:qe(a)})}),e.jsx("span",{className:"block text-[10.5px] text-ink-secondary",children:Mt(a.finishedAt??a.startedAt??a.scheduledFor)})]}):e.jsx("span",{className:"text-ink-secondary",children:x("routines.neverRun")})}),e.jsxs("button",{type:"button",onClick:()=>g(r),"aria-label":x("routines.logsFor",{name:r.name}),className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Le,{size:12}),x("routines.logs")]})]}),a&&(a.attention||a.error||a.output)&&e.jsx("p",{className:C("mt-2 line-clamp-2 whitespace-pre-wrap text-[11.5px] leading-relaxed",a.error?"text-danger":"text-ink-secondary"),children:a.attention||a.error||a.output}),!!r.failureStreak&&e.jsx("p",{className:"mt-2 text-[11.5px] text-danger",children:x("routines.failureStreak",{count:r.failureStreak})}),!!r.skippedRuns&&e.jsxs("p",{className:"mt-2 text-[11.5px] text-ink-secondary",children:[x("routines.skippedRuns",{count:r.skippedRuns}),r.lastSkippedAt!=null&&e.jsxs(e.Fragment,{children:[" · ",x("routines.lastSkipped",{date:Mt(r.lastSkippedAt)})]})]})]},r.id)})]})}function Bs({runs:t,bots:n,loading:s,error:o,routineId:l,status:p,onStatusChange:g,onClearRoutine:u,onOpen:r}){const[a,c]=m.useState(""),[y,v]=m.useState(50),F=t.filter(h=>(!l||h.routineId===l)&&(p==="all"||(p==="problems"?nt(h):h.status===p))&&`${h.routineName} ${n.find(P=>P.id===h.botId)?.name??""} ${h.output??""} ${h.error??""} ${h.attention??""}`.toLowerCase().includes(a.trim().toLowerCase())).sort((h,P)=>pt(P)-pt(h));return e.jsxs("section",{className:"mx-auto w-full max-w-5xl space-y-4 p-4 sm:p-6","aria-label":x("routines.logs"),children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:x("routines.logs")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:x("routines.logsHint")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("label",{className:"flex min-w-[180px] flex-1 items-center gap-2 rounded-lg border border-hairline/50 bg-panel px-3 py-2 text-ink-secondary focus-within:border-focus",children:[e.jsx(zt,{size:14}),e.jsx("input",{"aria-label":x("routines.searchLogs"),placeholder:x("routines.searchLogs"),value:a,onChange:h=>{c(h.target.value),v(50)},className:"min-w-0 flex-1 bg-transparent text-[12px] text-ink outline-none"})]}),e.jsxs("select",{"aria-label":x("routines.filterStatus"),value:p,onChange:h=>{g(h.target.value),v(50)},className:"rounded-lg border border-hairline/50 bg-panel px-3 py-2 text-[12px] text-ink",children:[e.jsx("option",{value:"all",children:x("routines.allStatuses")}),e.jsx("option",{value:"problems",children:x("routines.status.problems")}),["queued","running","waiting","completed","failed","missed","cancelled"].map(h=>e.jsx("option",{value:h,children:x(`routines.status.${h}`)},h))]})]}),l&&e.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[x("routines.filteredRoutine"),e.jsx("button",{type:"button",onClick:u,className:"text-accent hover:underline",children:x("routines.showAll")})]}),o&&e.jsxs("p",{role:"alert",className:"flex items-center gap-2 rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:[e.jsx(Ge,{size:14}),x("routines.loadError")]}),s&&e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx(De,{size:14,className:"animate-spin"}),x("routines.loading")]}),!s&&!o&&F.length===0&&e.jsxs("div",{className:"rounded-xl border border-dashed border-hairline/50 p-10 text-center text-[13px] text-ink-secondary",children:[e.jsx(Le,{size:24,className:"mx-auto mb-3 opacity-50"}),t.length?x("routines.noMatchingRuns"):x("routines.noRuns")]}),e.jsx("div",{className:"space-y-2",children:F.slice(0,y).map(h=>{const P=n.find(U=>U.id===h.botId);return e.jsxs("button",{type:"button",onClick:()=>r(h),"aria-label":x("routines.openRun",{name:h.routineName,status:qe(h)})+(nt(h)&&!h.seenAt?` · ${x("routines.unread")}`:""),className:"block w-full rounded-xl border border-hairline/40 bg-card p-4 text-left hover:border-accent/40 hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-semibold text-ink",children:h.routineName}),e.jsxs("span",{className:"mt-1 block text-[11px] text-ink-secondary",children:[P?.name??x("routines.unavailableBot")," · ",Mt(h.scheduledFor)," · ",x(`routines.trigger.${h.triggerSource??(h.manual?"manual":"schedule")}`)]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[nt(h)&&!h.seenAt&&e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-danger",title:x("routines.unread")}),e.jsx("span",{className:C("text-[11.5px] font-medium",jn(h)),children:qe(h)})]})]}),e.jsx("p",{className:C("mt-2 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed",h.error?"text-danger":"text-ink-secondary"),children:h.attention||h.error||h.output||x("routines.noOutput")})]},h.id)})}),F.length>y&&e.jsx("button",{type:"button",onClick:()=>v(h=>h+50),className:"rounded-lg bg-raised px-4 py-2 text-[12px] text-ink",children:x("routines.loadMore")})]})}function In({bot:t,value:n,allowCurrent:s=!1,onChange:o}){const l=m.useId(),p=(t?.tasks??[]).filter(r=>!r.routineRunId),g=typeof n=="string"&&!p.some(r=>r.threadId===n),u=[...t?.projects??[],{id:"",name:x("folder.none")}];return e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsx("label",{htmlFor:l,className:"block text-[12px] font-medium text-ink",children:x("routines.results.label")}),e.jsxs("select",{id:l,"aria-describedby":`${l}-help`,disabled:!t,value:n??(n===null?"new":"current"),onChange:r=>o(r.target.value==="new"?null:r.target.value==="current"?void 0:r.target.value),className:"w-full min-w-0 rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent disabled:opacity-50",children:[s&&e.jsx("option",{value:"current",children:x("routines.results.keep")}),e.jsx("option",{value:"new",children:x("routines.results.main")}),g&&e.jsx("option",{value:n,disabled:!0,children:x("routines.results.unavailable")}),u.map(r=>{const a=p.filter(c=>r.id?c.projectId===r.id:!t?.projects?.some(y=>y.id===c.projectId));return a.length?e.jsx("optgroup",{label:r.name,children:a.map(c=>e.jsx("option",{value:c.threadId,children:c.title},c.threadId))},r.id):null})]}),e.jsx("p",{id:`${l}-help`,className:"text-[11px] leading-relaxed text-ink-secondary",children:x("routines.results.mainHelp")})]})}const et="min-w-0 rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent [color-scheme:dark]",_s=Array.from({length:12},(t,n)=>new Intl.DateTimeFormat("en",{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1)))),Hs=["UTC",...typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[]];function $n({runs:t,timeZone:n,paused:s=!1}){if(!t.length)return null;const o=new Intl.DateTimeFormat(void 0,{timeZone:n,weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return e.jsxs("div",{className:"space-y-1 text-[11px] leading-relaxed text-ink-secondary","aria-label":s?"Paused schedule preview":"Next scheduled runs",children:[e.jsxs("div",{className:"font-medium",children:[s?"Paused — schedule preview":"Next runs"," · ",n]}),t.map(l=>e.jsx("div",{children:e.jsx("time",{dateTime:new Date(l).toISOString(),children:o.format(l)})},l)),e.jsx("div",{className:"pt-1",children:"Clock changes: skipped times shift forward; repeated times run once."})]})}function Ws({schedule:t,paused:n=!1}){const s=m.useMemo(()=>{try{return At(t,Date.now(),3)}catch{return[]}},[t]);return e.jsx($n,{runs:s,timeZone:t.timeZone,paused:n})}function Ys({choice:t,value:n,onChange:s,runs:o,error:l}){const p=g=>s({...n,...g});return e.jsxs("div",{className:"space-y-3",children:[t==="cron"?e.jsxs("label",{className:"block space-y-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{children:"Cron expression"}),e.jsx("input",{value:n.expression,onChange:g=>p({expression:g.target.value}),placeholder:"0 9 1 * *",spellCheck:!1,autoComplete:"off","aria-invalid":!!l,"aria-describedby":"routine-cron-help routine-cron-error",className:C(et,"w-full font-mono")}),e.jsx("span",{id:"routine-cron-help",className:"block text-[11px]",children:"Minute · hour · day of month · month · day of week. For example, 0 9 1 * * runs at 9 am on the first of each month."})]}):e.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[t==="yearly"&&e.jsxs("label",{className:"space-y-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:"Month"}),e.jsx("select",{value:n.month,onChange:g=>p({month:g.target.value}),className:et,children:_s.map((g,u)=>e.jsx("option",{value:String(u+1),children:g},g))})]}),e.jsxs("label",{className:"space-y-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:"Day of month"}),e.jsxs("select",{value:n.day,onChange:g=>p({day:g.target.value}),className:et,children:[Array.from({length:31},(g,u)=>e.jsx("option",{value:String(u+1),children:u+1},u+1)),e.jsx("option",{value:"L",children:"Last day"})]})]}),e.jsxs("label",{className:"space-y-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:"Time"}),e.jsx("input",{type:"time",step:60,value:n.time,onChange:g=>p({time:g.target.value}),className:et})]})]}),t!=="cron"&&Number(n.day)>28&&e.jsx("p",{className:"text-[11px] text-ink-secondary",children:"Months without this date are skipped. Choose Last day to always use the end of the month."}),e.jsxs("label",{className:"block space-y-1.5 text-[11.5px] text-ink-secondary",children:[e.jsx("span",{children:"Time zone"}),e.jsx("input",{list:"routine-time-zones",value:n.timeZone,onChange:g=>p({timeZone:g.target.value}),placeholder:"America/New_York",spellCheck:!1,autoComplete:"off","aria-invalid":!!l,"aria-describedby":"routine-cron-error",className:C(et,"block w-full")})]}),e.jsx("datalist",{id:"routine-time-zones",children:Hs.map(g=>e.jsx("option",{value:g},g))}),l&&e.jsx("p",{id:"routine-cron-error",role:"alert",className:"text-[11.5px] text-danger",children:l}),!l&&e.jsx($n,{runs:o,timeZone:n.timeZone.trim()})]})}const Ae=t=>["monthly","yearly","cron"].includes(t);function Tn(t){const n=t.trim().split(/\s+/);if(n.length!==5)return null;const[s,o,l,p,g]=n;return!/^\d+$/.test(s)||Number(s)>59||!/^\d+$/.test(o)||Number(o)>23||!(l==="L"||/^\d+$/.test(l)&&Number(l)>=1&&Number(l)<=31)||!(p==="*"||/^\d+$/.test(p)&&Number(p)>=1&&Number(p)<=12)||g!=="*"?null:{day:l==="L"?l:String(Number(l)),month:p,time:`${String(Number(o)).padStart(2,"0")}:${String(Number(s)).padStart(2,"0")}`}}function qs(t){const n=Tn(t.expression);return n?n.month==="*"?"monthly":"yearly":"cron"}function Gs(t,n){const s=t?.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone,o=t&&Tn(t.expression);let l;try{l=new Intl.DateTimeFormat("en-US",{timeZone:s,month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(n)}catch{l=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(n)}const p=r=>l.find(a=>a.type===r).value,g=o?.time??`${p("hour")}:${p("minute")}`,u=o?.day??p("day");return{expression:t?.expression??`${Number(g.slice(3))} ${Number(g.slice(0,2))} ${u} * *`,timeZone:s,day:u,month:o&&o.month!=="*"?String(Number(o.month)):p("month"),time:g}}function Us(t,n,s,o){try{if(t!=="cron"&&!/^\d{2}:\d{2}$/.test(n.time))throw new Error("Choose a time for this routine.");const[l,p]=n.time.split(":"),g=o??{type:"cron",timeZone:n.timeZone,expression:t==="cron"?n.expression:`${Number(p)} ${Number(l)} ${n.day} ${t==="yearly"?n.month:"*"} *`},u=ts(g,s);return{schedule:o??u,runs:At(u,s,3),error:""}}catch(l){return{schedule:null,runs:[],error:l instanceof Error?l.message:String(l)}}}const Ks='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function An(t,n){const s=m.useRef(n);s.current=n,m.useEffect(()=>{const o=t.current;if(!o)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null;o.contains(document.activeElement)||o.focus();const p=()=>Array.from(o.querySelectorAll(Ks)).filter(u=>!u.hasAttribute("hidden")),g=u=>{if(u.defaultPrevented)return;if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),s.current();return}if(u.key!=="Tab")return;const r=p();if(!r.length)return u.preventDefault();const a=r[0],c=r[r.length-1];u.shiftKey&&(document.activeElement===a||!o.contains(document.activeElement)||document.activeElement===o)?(u.preventDefault(),c.focus()):!u.shiftKey&&document.activeElement===c&&(u.preventDefault(),a.focus())};return o.addEventListener("keydown",g),()=>{o.removeEventListener("keydown",g),l?.focus()}},[t])}const Q=64,Js=["Su","Mo","Tu","We","Th","Fr","Sa"],$t=[0,1,2,3,4,5,6],mt=[1,2,3,4,5],Ct=[5,10,15,30,60],fn=Array.from({length:240/le},(t,n)=>(n+1)*le),yn="application/x-openmaus-bot",xt="application/x-openmaus-calendar-event";function En(t,n){return t?t.memberIds.flatMap(s=>{const o=n.find(l=>l.id===s);return o&&!o.hidden?[o]:[]}):[]}function Vs(t){return t.dm?!1:!(Object.prototype.hasOwnProperty.call(t,"setupCompletedAt")||Object.prototype.hasOwnProperty.call(t,"setupSkippedAt"))||t.setupCompletedAt!=null||t.setupSkippedAt!=null||(t.messages?.length??0)>0}function vn(t,n,s){const o=En(t,n),l=t?.defaultResponder.kind==="member"?t.defaultResponder.botId:void 0;return o.find(p=>p.id===s)??o.find(p=>p.id===l)??o.find(p=>p.chiefOfStaff)??o[0]}function at(){const t=new Date(Date.now()+36e5);return t.setMinutes(0,0,0),t.getTime()}function Zs(t,n){return!!(t&&t.length===n.length&&t.every((s,o)=>s===n[o]))}function Qs(t){return t.type!=="interval"||!t.weekdays||t.weekdays.length===7?"every-day":Zs(t.weekdays,mt)?"weekdays":"custom"}function Xs(t){const n=new Date(`${t}T00:00`);return n.setHours(23,59,59,999),n.getTime()}function ea(t,n){return t.type==="once"?"none":t.type==="interval"?"interval":t.type==="cron"?qs(t):t.weekdays.length===7?"daily":t.weekdays.join(",")==="1,2,3,4,5"?"weekdays":t.weekdays.length===1&&t.weekdays[0]===new Date(n).getDay()?"weekly":"custom"}function zn(t,n,s){if(t==="none")return{type:"once",at:n};const o=t==="daily"?$t:t==="weekdays"?mt:t==="weekly"?[new Date(n).getDay()]:s;return{type:"daily",time:bt(n),weekdays:[...o].sort()}}function ta(t,n,s,o,l){return t==="interval"?{type:"interval",everyMinutes:o,...l}:zn(t,n,s)}function na(t,n,s){const o=[];for(const l of t){if(l.schedule.type==="once"){l.schedule.at>=n&&l.schedule.at<s&&o.push({id:`call-${l.id}-${l.schedule.at}`,at:l.schedule.at,durationMinutes:l.durationMinutes,call:l});continue}for(let p=ne(n);p<s;p=pe(p,1)){if(!l.schedule.weekdays.includes(new Date(p).getDay()))continue;const g=Me(p,l.schedule.time);g>=n&&g<s&&g>=l.createdAt&&o.push({id:`call-${l.id}-${g}`,at:g,durationMinutes:l.durationMinutes,call:l})}}return o.sort((l,p)=>l.at-p.at)}function Ln(t){return t==="running"?"working":t==="waiting"?"curious":t==="completed"?"proud":t==="failed"||t==="missed"?"sad":t==="cancelled"?"sleeping":"drowsy"}function On({attachments:t,onRemove:n}){return t.length?e.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>e.jsxs("div",{className:"flex max-w-[260px] items-center gap-2 rounded-lg border border-hairline/50 bg-inset px-2.5 py-2 text-[12px] text-ink",children:[e.jsx(Le,{size:14,className:"shrink-0 text-accent"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),n&&e.jsx("button",{type:"button",onClick:()=>n(s.id),className:"rounded p-0.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":`Remove ${s.name}`,children:e.jsx(ze,{size:12})})]},s.id))}):null}function Tt({bots:t,selected:n,multiple:s,locked:o,onChange:l}){const[p,g]=m.useState(""),u=t.filter(r=>`${r.name} ${r.title}`.toLowerCase().includes(p.toLowerCase()));return e.jsxs("div",{className:"rounded-xl border border-hairline/50 bg-inset/60 p-2",children:[!o&&t.length>5&&e.jsxs("label",{className:"mb-2 flex items-center gap-2 rounded-lg border border-transparent bg-panel px-2.5 py-2 text-ink-secondary focus-within:border-focus",children:[e.jsx(zt,{size:14}),e.jsx("input",{value:p,onChange:r=>g(r.target.value),placeholder:"Find a bot",className:"min-w-0 flex-1 bg-transparent text-[12px] text-ink outline-none placeholder:text-ink-tertiary"})]}),e.jsx("div",{className:"grid max-h-48 grid-cols-1 gap-1 overflow-y-auto sm:grid-cols-2",children:u.map(r=>{const a=n.includes(r.id);return e.jsxs("button",{type:"button",disabled:o,onClick:()=>l(s?a?n.filter(c=>c!==r.id):[...n,r.id]:[r.id]),className:C("flex min-w-0 items-center gap-2 rounded-lg px-2 py-2 text-left transition",a?"bg-accent/12 ring-1 ring-accent/50":"hover:bg-raised",o&&"cursor-default"),children:[e.jsx(Ye,{bot:r,state:a?"happy":"idle",size:32,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-medium text-ink",children:r.name}),a&&e.jsx(Cn,{size:14,className:"shrink-0 text-accent"})]},r.id)})})]})}function sa(t){return t.flatMap(n=>n.kind==="paste"||n.kind==="citation"?[]:[{id:n.id,kind:n.kind,name:n.name,path:n.path,size:n.size}])}function Pn({seed:t,bots:n,lockedBotId:s,defaultRunOn:o,routinesOnly:l=!1,onClose:p,onSavedCall:g}){const{state:u,dispatch:r}=rt(),a=t.routine,{request:c}=Es(),y=t.call,[v,F]=m.useState(l?"routine":t.kind),[h]=m.useState(()=>Date.now()),[P,U]=m.useState(a?.name??y?.name??t.name??""),[Y,G]=m.useState(a?.prompt??y?.description??t.description??""),z=a?.schedule.type==="once"?a.schedule.at:a?.schedule.type==="daily"?Me(t.at,a.schedule.time):a?.schedule.type==="interval"?a.schedule.anchorAt:y?.schedule.type==="once"?y.schedule.at:y?.schedule.type==="daily"?Me(t.at,y.schedule.time):t.at,b=a?.schedule??y?.schedule??{type:"once",at:z},[j,L]=m.useState(tt(z)),[f,N]=m.useState(bt(z)),[E,S]=m.useState(a?.durationMinutes??y?.durationMinutes??t.durationMinutes),[T,A]=m.useState(a?.timeoutMinutes??null),[k,I]=m.useState(!!a),[q,_]=m.useState(a?.overlap??"skip"),[V,J]=m.useState(!!a?.continuity),[$,B]=m.useState(ea(b,z)),[ie,ae]=m.useState(()=>Gs(b.type==="cron"?b:void 0,z)),[je,me]=m.useState(!1),[he,Ue]=m.useState(b.type==="daily"?b.weekdays:[new Date(z).getDay()]),[O,ge]=m.useState(b.type==="interval"?b.everyMinutes:15),[re,ce]=m.useState(()=>Qs(b)),[de,we]=m.useState(()=>b.type==="interval"&&b.weekdays?.length?b.weekdays:[...$t]),[be,w]=m.useState(b.type==="interval"&&b.window?"custom":"all-day"),[Z,Re]=m.useState(b.type==="interval"?b.window?.start??"09:00":"09:00"),[X,Ke]=m.useState(b.type==="interval"?b.window?.end??"17:00":"17:00"),[Oe,Pe]=m.useState(b.type==="interval"&&b.endsAt!=null?"on-date":"never"),[fe,Je]=m.useState(()=>b.type==="interval"&&b.endsAt!=null?tt(b.endsAt):tt(pe(ne(Math.max(Date.now(),z)),7))),[K,Ie]=m.useState(s?[s]:a?[a.botId]:y?.botIds??t.botIds),[it,$e]=m.useState(a?a.resultsThreadId:t.resultsThreadId??null),Fe=d=>{d[0]!==K[0]&&$e(null),Ie(d)},[ee,vt]=m.useState(a?.target??"bot"),[Ne,Be]=m.useState(a?.groupId??""),[i,D]=m.useState(a?.runOn??o??"maus"),[R,ye]=m.useState(a?.target==="room-goal"?[]:a?.attachments??y?.attachments??[]),[Se,H]=m.useState(!1),[_e,Pt]=m.useState(""),[Ft,Bt]=m.useState(""),[Fn,_t]=m.useState(0),ot=Fn>0,Ht=m.useRef(null),Bn=!!(u.config?.box.configured&&K.length>0&&K.every(d=>bs(u.instances,n.find(M=>M.id===d)?.modelSelection.instanceId)?.snapshot.state==="available")),Ve=u.groups.filter(Vs),lt=Ve.find(d=>d.id===Ne),kt=En(lt,u.bots),ue=v==="routine"&&ee==="room-goal",Wt=u.config?.cloudHome===!0,dt=Nt(j,f,a||y?z:void 0),_n=dt+E*6e4,jt=K.flatMap(d=>n.find(M=>M.id===d)??[]),Yt=m.useRef(null),Ze=$==="interval"&&(!Number.isInteger(O)||O<5||O>1440),He=$==="interval"&&re==="custom"&&de.length===0,qt=Nt("2000-01-01",X)-Nt("2000-01-01",Z),xe=$==="interval"&&be==="custom"&&(!Z||!X||!Number.isFinite(qt)||qt<O*6e4),wt=a?.schedule.type==="interval"?a.schedule:void 0,Gt=xn(h,Math.max(5,O||5),wt),We=Oe==="on-date"?Xs(fe):null,Te=$==="interval"&&Oe==="on-date"&&(We==null||!Number.isSafeInteger(We)||We<Gt),Ut=re==="every-day"?void 0:re==="weekdays"?mt:de,Hn=be==="custom"?{start:Z,end:X}:void 0,Ce=Ae($)?Us($,ie,h,!je&&b.type==="cron"?b:void 0):null,Kt=d=>{d==="interval"&&!k&&(A(M=>M??30),I(!0)),Ae(d)&&(d==="cron"&&Ce?.schedule&&ae(M=>({...M,expression:Ce.schedule.expression})),me(!0)),B(d)},Wn=d=>{d==="custom"&&re!=="custom"&&we(re==="weekdays"?[...mt]:[...$t]),ce(d)},Jt=d=>{if(vt(d),d==="bot"){Be("");return}D("maus"),ye([]),Bt("");const M=lt??Ve[0];Be(M?.id??"");const W=vn(M,u.bots,K[0]);Fe(W?[W.id]:[])},Yn=d=>{const M=Ve.find(ve=>ve.id===d);Be(d);const W=vn(M,u.bots,K[0]);Fe(W?[W.id]:[])},qn=async d=>{if(!(!d?.length||ue)){_t(M=>M+1);try{const M=await ps(Array.from(d),{allowImages:!0,getPath:hs,uploadImage:ms}),W=sa(M.attachments);W.length&&(ye(ve=>[...ve,...W].slice(0,20)),i==="cloud"&&D("maus")),M.notice&&Bt(M.notice)}finally{_t(M=>Math.max(0,M-1))}}},Gn=async()=>{if(!ot){H(!0),Pt("");try{if(v==="routine"||l){const d=Date.now(),M=Mn(d,O,wt);if($==="interval"&&We!=null&&We<xn(d,O,wt))throw new Error("Choose an end date after the first run.");const W=Ae($)?Ce?.schedule:ta($,dt,he,O,{anchorAt:M,weekdays:Ut?[...Ut].sort():null,window:Hn??null,endsAt:We});if(!W)throw new Error(Ce?.error||"Choose a valid schedule.");const ve={name:P,prompt:Y,target:ee,botId:s??K[0]??"",groupId:ee==="room-goal"?Ne:null,runOn:ee==="room-goal"?"maus":i,enabled:a?void 0:!0,schedule:W,durationMinutes:E,timeoutMinutes:T,overlap:q,continuity:ee==="bot"&&$!=="none"&&V,attachments:ee==="room-goal"?[]:R,...ee==="bot"?{resultsThreadId:it}:{}},Qn=await c(a?`/api/routines/${a.id}`:"/api/routines",{method:a?"PATCH":"POST",body:JSON.stringify(ve)});r({type:"routinePatched",routine:Qn.routine})}else{if($==="interval"||Ae($))throw new Error("Choose a supported call schedule.");const d=zn($,dt,he),M={name:P,description:Y,botIds:K,schedule:d,durationMinutes:E,attachments:R},W=await oe(y?`/api/calendar-calls/${y.id}`:"/api/calendar-calls",{method:y?"PATCH":"POST",body:JSON.stringify(M)});g(W.call)}p()}catch(d){Pt(d instanceof Error?d.message:String(d))}finally{H(!1)}}},Un=!!(P.trim()&&(v==="call"||Y.trim())&&(!s||K[0]===s)&&(v==="call"?K.length>0:ee==="room-goal"?Ne&&K[0]&&kt.some(d=>d.id===K[0]):K.length>0)&&!Ze&&!He&&!xe&&!Te&&!Ce?.error),Kn=!l&&!a&&!y&&!s,te=Lt(),[ct,Jn]=m.useState(()=>!["none","daily","weekdays","weekly"].includes($)||ee==="room-goal"||R.length>0||i==="cloud"||T!=null||q==="queue");An(Yt,p);const Vt=Kn&&e.jsxs("div",{className:C(te&&"ml-10","inline-flex rounded-lg bg-inset p-1"),children:[e.jsx("button",{type:"button",onClick:()=>{F("routine"),Ie(d=>d.slice(0,1))},className:C("rounded-md px-4 py-1.5 text-[12.5px] font-medium",v==="routine"?"bg-raised text-ink shadow":"text-ink-secondary"),children:"Routine"}),e.jsx("button",{type:"button",onClick:()=>{F("call"),($==="interval"||Ae($))&&B("none")},className:C("rounded-md px-4 py-1.5 text-[12.5px] font-medium",v==="call"?"bg-raised text-ink shadow":"text-ink-secondary"),children:"Call"})]}),Zt=v==="routine"&&!s&&e.jsxs("div",{className:C(te&&"ml-10"),children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wider text-ink-secondary",children:"Routine type"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>Jt("bot"),className:C("flex items-start gap-3 rounded-xl border p-3 text-left transition",ee==="bot"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx(It,{size:17,className:C("mt-0.5 shrink-0",ee==="bot"?"text-accent":"text-ink-secondary")}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[12.5px] font-medium text-ink",children:"Bot task"}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:"One bot owns and completes each run."})]})]}),e.jsxs("button",{type:"button",onClick:()=>Jt("room-goal"),className:C("flex items-start gap-3 rounded-xl border p-3 text-left transition",ee==="room-goal"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx(un,{size:17,className:C("mt-0.5 shrink-0",ee==="room-goal"?"text-accent":"text-ink-secondary")}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[12.5px] font-medium text-ink",children:"Team goal"}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:"A lead coordinates the group until the goal settles."})]})]})]})]}),Qt=$!=="interval"&&!Ae($)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v==="routine"&&$==="none"&&e.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:"Starts"}),v==="routine"&&$==="weekly"&&e.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:"On"}),(v==="call"||$==="none"||$==="weekly")&&e.jsx("input",{type:"date",value:j,onChange:d=>L(d.target.value),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]"}),e.jsx("input",{type:"time",step:le*60,value:f,onChange:d=>N(d.target.value),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]"}),v==="call"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[12px] text-ink-secondary",children:"to"}),e.jsx("span",{className:"rounded-lg border border-hairline/40 bg-inset/60 px-3 py-2 text-[13px] text-ink",children:se(_n)}),e.jsx("select",{"aria-label":"Call duration",value:E,onChange:d=>S(Number(d.target.value)),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent",children:fn.map(d=>e.jsx("option",{value:d,children:st(d)},d))})]})]}),Xt=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Dn,{size:14,className:"text-ink-secondary"}),e.jsxs("select",{"aria-label":"Repeat",value:$,onChange:d=>Kt(d.target.value),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"none",children:"Does not repeat"}),v==="routine"&&e.jsx("option",{value:"interval",children:"Every X minutes"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekdays",children:"Every weekday (Monday to Friday)"}),e.jsxs("option",{value:"weekly",children:["Weekly on ",Ee[new Date(dt).getDay()]]}),e.jsx("option",{value:"custom",children:"Selected weekdays"}),v==="routine"&&e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"yearly",children:"Yearly"}),e.jsx("option",{value:"cron",children:"Custom cron (advanced)"})]})]})]}),en=v==="routine"&&e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Runs while OpenMausBot is open on this computer — it cannot wake a sleeping Mac. A run missed by less than 12 hours still happens when the app is back; for 24/7, run OpenMausBot on a VPS."}),tn=e.jsxs(e.Fragment,{children:[Ae($)&&v==="routine"&&Ce&&e.jsx(Ys,{choice:$,value:ie,onChange:d=>{ae(d),me(!0)},runs:Ce.runs,error:Ce.error}),$==="custom"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ee.map((d,M)=>e.jsx("button",{type:"button",onClick:()=>Ue(W=>W.includes(M)?W.length===1?W:W.filter(ve=>ve!==M):[...W,M].sort()),className:C("size-8 rounded-full text-[10px] font-semibold",he.includes(M)?"bg-accent text-white":"bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:d[0]},d))}),$==="interval"&&v==="routine"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] text-ink",children:[e.jsx("span",{className:"font-medium",children:"Runs every"}),e.jsxs("select",{value:Ct.includes(O)?String(O):"custom",onChange:d=>ge(d.target.value==="custom"?0:Number(d.target.value)),"aria-label":"How often this routine runs",className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] tabular-nums text-ink outline-none focus:border-accent",children:[Ct.map(d=>e.jsx("option",{value:d,children:d},d)),e.jsx("option",{value:"custom",children:"Custom…"})]}),!Ct.includes(O)&&e.jsx("input",{type:"number",min:5,max:1440,step:1,value:O||"",onChange:d=>ge(Number(d.target.value)),"aria-label":"Custom interval in minutes","aria-invalid":Ze,"aria-describedby":Ze?"routine-interval-error":"routine-interval-help",autoFocus:!0,className:C("w-20 rounded-lg border bg-inset px-3 py-2 text-[12.5px] tabular-nums text-ink outline-none focus:border-accent",Ze?"border-danger/70":"border-hairline/50")}),e.jsx("span",{children:"minutes"})]}),e.jsxs("div",{className:"grid items-center gap-2 text-[12.5px] text-ink sm:flex sm:flex-wrap",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:"On"}),e.jsxs("select",{value:re,onChange:d=>Wn(d.target.value),"aria-label":"Days this interval runs","aria-invalid":He,"aria-describedby":He?"routine-interval-days-error":void 0,className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"every-day",children:"Every day"}),e.jsx("option",{value:"weekdays",children:"Weekdays"}),e.jsx("option",{value:"custom",children:"Custom…"})]})]}),e.jsx("span",{"aria-hidden":"true",className:"hidden text-ink-secondary sm:inline",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:"During"}),e.jsxs("select",{value:be,onChange:d=>w(d.target.value),"aria-label":"Hours this interval runs","aria-invalid":xe,"aria-describedby":xe?"routine-interval-window-error":void 0,className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"all-day",children:"All day"}),e.jsx("option",{value:"custom",children:"Custom hours…"})]})]}),e.jsx("span",{"aria-hidden":"true",className:"hidden text-ink-secondary sm:inline",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:"Ends"}),e.jsxs("select",{value:Oe,onChange:d=>Pe(d.target.value),"aria-label":"When this interval ends","aria-invalid":Te,"aria-describedby":Te?"routine-interval-end-error":void 0,className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"on-date",children:"On a date…"})]})]})]}),re==="custom"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium text-ink-secondary",children:"Choose the days"}),e.jsx("div",{role:"group","aria-label":"Custom interval days","aria-invalid":He,"aria-describedby":He?"routine-interval-days-error":void 0,className:"flex flex-wrap gap-1.5",children:Ee.map((d,M)=>e.jsx("button",{type:"button",onClick:()=>we(W=>W.includes(M)?W.filter(ve=>ve!==M):[...W,M].sort()),"aria-label":`${d}, ${de.includes(M)?"selected":"not selected"}`,"aria-pressed":de.includes(M),className:C("size-8 rounded-full text-[10px] font-semibold",de.includes(M)?"bg-accent text-white":"bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:Js[M]},d))})]}),be==="custom"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{className:"font-medium text-ink-secondary",children:"Run between"}),e.jsx("input",{"aria-label":"Interval window start","aria-invalid":xe,"aria-describedby":xe?"routine-interval-window-error":void 0,type:"time",step:le*60,value:Z,onChange:d=>Re(d.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",xe?"border-danger/70":"border-hairline/50")}),e.jsx("span",{className:"text-ink-secondary",children:"and"}),e.jsx("input",{"aria-label":"Interval window end","aria-invalid":xe,"aria-describedby":xe?"routine-interval-window-error":void 0,type:"time",step:le*60,value:X,onChange:d=>Ke(d.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",xe?"border-danger/70":"border-hairline/50")})]}),Oe==="on-date"&&e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{className:"font-medium text-ink-secondary",children:"Stop scheduling after"}),e.jsx("input",{"aria-label":"Interval end date","aria-invalid":Te,"aria-describedby":Te?"routine-interval-end-error":void 0,type:"date",min:tt(Gt),value:fe,onChange:d=>Je(d.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",Te?"border-danger/70":"border-hairline/50")})]}),Ze&&e.jsx("div",{id:"routine-interval-error",className:"text-[11px] text-danger",children:"Choose a whole number from 5 to 1,440 minutes."}),He&&e.jsx("div",{id:"routine-interval-days-error",className:"text-[11px] text-danger",children:"Choose at least one day."}),xe&&e.jsxs("div",{id:"routine-interval-window-error",className:"text-[11px] text-danger",children:["Choose a same-day window at least ",O||5," minutes long."]}),Te&&e.jsx("div",{id:"routine-interval-end-error",className:"text-[11px] text-danger",children:"Choose an end date after the first run."}),e.jsx("div",{id:"routine-interval-help",className:"text-[11px] leading-relaxed text-ink-secondary",children:x(q==="queue"?"routines.overlapQueueHelp":"routines.overlapSkipHelp")})]})]}),nn=v==="routine"&&e.jsxs("details",{className:"rounded-xl border border-hairline/40 bg-inset/40 px-3 py-2.5",children:[e.jsxs("summary",{className:"cursor-pointer select-none text-[11.5px] font-medium text-ink-secondary hover:text-ink",children:["Advanced · ",T==null?"no run limit":`${st(T)} run limit`]}),e.jsxs("div",{className:"mt-3 border-t border-hairline/35 pt-3",children:[e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{children:"Stop if still running after"}),e.jsxs("select",{"aria-label":"Routine safety limit",value:T??"",onChange:d=>A(d.target.value?Number(d.target.value):null),className:"rounded-lg border border-hairline/50 bg-panel px-3 py-2 text-[12px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"No limit"}),fn.map(d=>e.jsx("option",{value:d,children:st(d)},d))]})]}),e.jsx("div",{className:"mt-1.5 text-[10.5px] leading-relaxed text-ink-secondary",children:"Optional. The clock starts when work actually begins and does not control how often the routine starts."}),$!=="none"&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{children:x("routines.overlapLabel")}),e.jsxs("select",{"aria-label":x("routines.overlapLabel"),value:q,onChange:d=>_(d.target.value==="queue"?"queue":"skip"),className:"rounded-lg border border-hairline/50 bg-panel px-3 py-2 text-[12px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"skip",children:x("routines.overlapSkip")}),e.jsx("option",{value:"queue",children:x("routines.overlapQueue")})]})]}),e.jsx("p",{className:"mt-1.5 text-[10.5px] leading-relaxed text-ink-secondary",children:x(q==="queue"?"routines.overlapQueueHelp":"routines.overlapSkipHelp")})]})]})]}),Vn=v==="routine"&&!ue&&$!=="none"&&e.jsxs("label",{className:C("flex items-start gap-3 rounded-xl border border-hairline/40 bg-inset/40 px-3.5 py-3",te&&"ml-8"),children:[e.jsx("input",{type:"checkbox","aria-label":x("routines.continuityLabel"),checked:V,onChange:d=>J(d.target.checked),className:"mt-0.5 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[12.5px] font-medium text-ink",children:x("routines.continuityLabel")}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:x("routines.continuityHelp")})]})]}),sn=v==="routine"&&!ue&&e.jsx("div",{className:C(te&&"ml-8"),children:e.jsx(In,{bot:n.find(d=>d.id===K[0]),value:it,allowCurrent:!!a,onChange:$e})}),an=e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(cs,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),ue?e.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-hairline/50 bg-inset px-3.5 py-3",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:"Use the group’s shared context"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-ink-secondary",children:"Team goals cannot carry routine attachments. Put shared context in the goal instructions or the group instructions."})]}):e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsx("input",{ref:Ht,type:"file",multiple:!0,className:"hidden",onChange:d=>{qn(d.target.files),d.target.value=""}}),e.jsx("button",{type:"button",onClick:()=>Ht.current?.click(),className:"rounded-lg border border-hairline/50 px-3 py-2 text-[12.5px] font-medium text-ink hover:bg-raised",children:"Add attachment"}),e.jsx(On,{attachments:R,onRemove:d=>ye(M=>M.filter(W=>W.id!==d))}),e.jsx("div",{className:"text-[11px] leading-relaxed text-ink-secondary",children:v==="routine"?"Attachments are passed to each local routine run and excluded from shared team files.":jt.length>1?"References will be shared in the group when the event starts.":"References stay with the event and are available when you join the group."}),Ft&&e.jsx("div",{className:"text-[11.5px] text-warning",children:Ft})]})]}),rn=v==="routine"&&e.jsxs("div",{className:"flex items-start gap-4",children:[ue?e.jsx(un,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):i==="cloud"?e.jsx(Nn,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):e.jsx(Sn,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("div",{className:"min-w-0 flex-1",children:ue?e.jsxs("div",{className:"rounded-xl border border-accent/35 bg-accent/[0.07] p-3",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:Wt?"Runs on My Cloud":"Runs on this computer"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-ink-secondary",children:"OpenMausBot keeps the group and its member hand-offs together for the full goal."})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>D("maus"),className:C("rounded-xl border p-3 text-left",i==="maus"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:"Bot’s current setup"}),e.jsx("div",{className:"mt-1 text-[11px] text-ink-secondary",children:"Keeps its model and configured computer, including a self-hosted VPS."})]}),e.jsxs("button",{type:"button",disabled:!Bn||R.length>0,onClick:()=>D("cloud"),className:C("rounded-xl border p-3 text-left disabled:cursor-not-allowed disabled:opacity-45",i==="cloud"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:x("routines.runsOn.boat")}),e.jsx("div",{className:"mt-1 text-[11px] text-ink-secondary",children:x(Wt?"routines.runsOn.boatHintCloudHome":"routines.runsOn.boatHint")})]})]})})]}),Zn=!te&&v==="routine"?x(a?"routines.editor.edit":"routines.editor.new"):a||y?"Edit event":"New event",on=[["none","routines.repeat.once"],["daily","routines.repeat.daily"],["weekdays","routines.repeat.weekdays"],["weekly","routines.repeat.weekly"]];return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm",onMouseDown:d=>d.target===d.currentTarget&&p(),children:e.jsxs("div",{ref:Yt,role:"dialog","aria-modal":"true","aria-label":a||y?"Edit calendar event":"Create calendar event",tabIndex:-1,className:"max-h-[94vh] w-full max-w-[760px] overflow-y-auto rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"sticky top-0 z-20 flex items-center justify-between border-b border-hairline/40 bg-panel/95 px-5 py-3.5 backdrop-blur",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:Zn}),e.jsx("button",{onClick:p,className:"rounded-full p-2 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":"Close",children:e.jsx(ze,{size:18})})]}),e.jsxs("div",{className:"space-y-5 px-5 py-5 sm:px-8",children:[te&&Vt,te&&Zt,e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"mt-3 size-4 shrink-0 rounded bg-accent"}),e.jsx("input",{autoFocus:!0,value:P,onChange:d=>U(d.target.value),placeholder:v==="routine"?te?"Add title":x("routines.editor.titlePlaceholder"):"Add call title",className:"min-w-0 flex-1 border-b border-hairline/60 bg-transparent px-1 pb-2 text-[22px] font-medium text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),te?e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(Rt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[Qt,Xt,en,tn,nn]})]}):e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(Rt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:x("routines.editor.when")}),Qt,e.jsx("div",{role:"group","aria-label":x("routines.editor.repeat"),className:"flex flex-wrap gap-1.5",children:on.map(([d,M])=>e.jsx("button",{type:"button","aria-pressed":$===d,onClick:()=>Kt(d),className:C("rounded-full border px-3 py-1.5 text-[12px] font-medium transition",$===d?"border-accent-border bg-accent/15 text-accent-text":"border-hairline/50 bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:x(M)},d))}),!on.some(([d])=>d===$)&&e.jsx("div",{className:"text-[11.5px] text-ink-secondary",children:x("routines.editor.customRepeat")})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[ue?e.jsx(gt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):e.jsx(It,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("div",{className:"min-w-0 flex-1",children:ue?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"routine-goal-room",className:"mb-2 block text-[12.5px] font-medium text-ink",children:"Choose a group"}),Ve.length>0?e.jsxs("select",{id:"routine-goal-room",value:Ne,onChange:d=>Yn(d.target.value),className:"w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2.5 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"Select a group"}),Ve.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id))]}):e.jsx("div",{className:"rounded-xl border border-dashed border-hairline/60 bg-inset px-3.5 py-3 text-[11.5px] leading-relaxed text-ink-secondary",children:"Create a group from the sidebar first, then come back to schedule its goal."})]}),lt&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[12.5px] font-medium text-ink",children:"Choose the lead"}),kt.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{bots:kt,selected:K,multiple:!1,onChange:Fe}),e.jsxs("div",{className:"mt-2 text-[11.5px] text-ink-secondary",children:["The lead coordinates ",lt.name," and assigns work to its active members."]})]}):e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/10 px-3.5 py-3 text-[11.5px] text-warning",children:"This group has no active members. Add or restore a bot before scheduling the goal."})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-2 text-[12.5px] font-medium text-ink",children:v==="routine"?te?"Assign a bot":x("routines.editor.who"):"Add guests"}),n.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{bots:n,selected:K,multiple:v==="call",locked:!!s,onChange:Fe}),e.jsx("div",{className:"mt-2 text-[11.5px] text-ink-secondary",children:v==="routine"?"This bot owns each scheduled run.":`${jt.length||"No"} bot${jt.length===1?"":"s"} invited to the call.`})]}):e.jsxs("button",{type:"button",onClick:()=>{r({type:"toggleNewBot",open:!0}),p()},className:"w-full rounded-xl border border-dashed border-accent/45 bg-accent/[0.06] px-4 py-4 text-left hover:bg-accent/10",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-accent",children:"Create your first bot"}),e.jsx("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:"A calendar event needs at least one bot."})]})]})})]}),te&&sn,e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(Le,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("textarea",{value:Y,onChange:d=>G(d.target.value),rows:5,placeholder:ue?"What should the team accomplish?":v==="routine"?te?"Add instructions for the bot":x("routines.editor.instructionsPlaceholder"):"Add description or agenda",className:"min-w-0 flex-1 resize-y rounded-xl border border-hairline/50 bg-inset px-3.5 py-3 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),Vn,te&&an,te&&rn,!te&&e.jsxs("div",{children:[e.jsxs("button",{type:"button","aria-expanded":ct,"aria-controls":"routine-more-options",onClick:()=>Jn(d=>!d),className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-[12.5px] font-medium text-accent-text hover:bg-raised",children:[e.jsx(Et,{size:14,className:C("transition-transform",ct&&"rotate-90")}),x(ct?"routines.editor.fewer":"routines.editor.more")]}),ct&&e.jsxs("div",{id:"routine-more-options",className:"mt-3 space-y-5 rounded-xl border border-hairline/40 bg-inset/30 p-4",children:[Vt,Zt,e.jsxs("div",{className:"space-y-3",children:[Xt,en,tn,nn]}),sn,an,rn]})]}),_e&&e.jsxs("div",{className:"ml-10 flex items-start gap-2 rounded-xl border border-danger/30 bg-danger/10 px-3 py-2.5 text-[12.5px] text-danger",children:[e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0"}),_e]})]}),e.jsxs("div",{className:"sticky bottom-0 flex items-center justify-end gap-2 border-t border-hairline/40 bg-panel/95 px-5 py-3.5 backdrop-blur",children:[e.jsx("button",{onClick:p,className:"rounded-lg px-4 py-2 text-[12.5px] text-ink-secondary hover:bg-raised hover:text-ink",children:"Cancel"}),e.jsxs("button",{onClick:Gn,disabled:Se||ot||!Un,className:"flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[12.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",children:[(Se||ot)&&e.jsx(De,{size:14,className:"animate-spin"}),ot?"Attaching…":a||y?"Save":v==="call"?"Schedule call":ue?"Schedule team goal":"Schedule routine"]})]})]})})}function aa({seed:t,bots:n,routinesOnly:s=!1,onClose:o,onMore:l,onSavedRoutine:p,onSavedCall:g}){const{dispatch:u}=rt(),[r,a]=m.useState(s?"routine":t.kind),[c,y]=m.useState(t.name??""),[v,F]=m.useState(t.description??""),[h,P]=m.useState(t.botIds.length?t.botIds:n[0]?[n[0].id]:[]),[U,Y]=m.useState(t.resultsThreadId??null),G=k=>{k[0]!==h[0]&&Y(null),P(k)},[z,b]=m.useState(!1),[j,L]=m.useState(""),f=m.useRef(null),[N,E]=m.useState(null),S=r==="routine"?30:t.durationMinutes;m.useLayoutEffect(()=>{if(!t.anchor){E(null);return}const k=f.current;if(!k)return;const I=()=>{const _=k.getBoundingClientRect();let V=t.anchor.x+12,J=t.anchor.y+12;V+_.width>window.innerWidth-12&&(V=t.anchor.x-_.width-12),J+_.height>window.innerHeight-12&&(J=t.anchor.y-_.height-12),E({left:Math.max(12,Math.min(V,window.innerWidth-_.width-12)),top:Math.max(12,Math.min(J,window.innerHeight-_.height-12))})};return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[r,t.anchor]);const T=async()=>{b(!0),L("");try{if(r==="routine"||s){const k=await oe("/api/routines",{method:"POST",body:JSON.stringify({name:c,prompt:v,botId:h[0],runOn:"maus",enabled:!0,schedule:{type:"once",at:t.at},durationMinutes:S,attachments:[],resultsThreadId:U})});p(k.routine)}else{const k=await oe("/api/calendar-calls",{method:"POST",body:JSON.stringify({name:c,description:v,botIds:h,schedule:{type:"once",at:t.at},durationMinutes:S})});g(k.call)}o()}catch(k){L(k instanceof Error?k.message:String(k))}finally{b(!1)}},A=!!(c.trim()&&h.length&&(r==="call"||v.trim()));return e.jsxs("div",{ref:f,role:"dialog","aria-label":"Quick create",style:N??void 0,className:C("fixed z-50 max-h-[calc(100vh-24px)] w-[min(430px,calc(100vw-24px))] overflow-y-auto rounded-2xl border border-hairline/60 bg-panel shadow-2xl",!N&&"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"),children:[e.jsxs("div",{className:"flex items-center justify-between bg-raised/70 px-4 py-2.5",children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:"New calendar event"}),e.jsx("button",{onClick:o,className:"rounded-full p-1.5 text-ink-secondary hover:bg-inset hover:text-ink","aria-label":"Close",children:e.jsx(ze,{size:16})})]}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsx("input",{autoFocus:!0,value:c,onChange:k=>y(k.target.value),placeholder:"Add title",onKeyDown:k=>{k.key==="Enter"&&A&&T()},className:"w-full border-b border-hairline/60 bg-transparent pb-2 text-[18px] font-medium text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"}),!s&&e.jsxs("div",{className:"flex items-center gap-1 border-b border-hairline/35 pb-2",children:[e.jsx("button",{type:"button",onClick:()=>{a("routine"),P(k=>k.slice(0,1))},className:C("rounded-lg px-3 py-1.5 text-[12px] font-medium",r==="routine"?"bg-accent/15 text-accent":"text-ink-secondary hover:bg-raised hover:text-ink"),children:"Routine"}),e.jsx("button",{type:"button",onClick:()=>a("call"),className:C("rounded-lg px-3 py-1.5 text-[12px] font-medium",r==="call"?"bg-accent/15 text-accent":"text-ink-secondary hover:bg-raised hover:text-ink"),children:"Call"})]}),e.jsxs("div",{className:"flex items-start gap-3 text-[12.5px] text-ink",children:[e.jsx(Rt,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{children:[e.jsx("div",{children:ft(t.at)}),e.jsxs("div",{className:"mt-0.5 text-ink-secondary",children:[se(t.at),r==="call"?` – ${se(t.at+S*6e4)}`:""]})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(It,{size:16,className:"mt-2.5 shrink-0 text-ink-secondary"}),n.length===0?e.jsxs("button",{type:"button",onClick:()=>{u({type:"toggleNewBot",open:!0}),o()},className:"min-w-0 flex-1 rounded-xl border border-dashed border-accent/45 bg-accent/[0.06] px-3 py-3 text-left hover:bg-accent/10",children:[e.jsx("div",{className:"text-[12px] font-medium text-accent",children:"Create your first bot"}),e.jsx("div",{className:"mt-0.5 text-[10.5px] text-ink-secondary",children:"Then come back to schedule it."})]}):r==="routine"?e.jsxs("select",{value:h[0]??"",onChange:k=>G([k.target.value]),className:"min-w-0 flex-1 rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"Assign a bot"}),n.map(k=>e.jsx("option",{value:k.id,children:k.name},k.id))]}):e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Tt,{bots:n,selected:h,multiple:!0,onChange:G})})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Le,{size:16,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("textarea",{value:v,onChange:k=>F(k.target.value),rows:3,placeholder:r==="routine"?"What should the bot do?":"Add a description (optional)",className:"min-w-0 flex-1 resize-none rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[12.5px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),r==="routine"&&e.jsx(In,{bot:n.find(k=>k.id===h[0]),value:U,onChange:k=>Y(k??null)}),j&&e.jsx("div",{className:"rounded-lg bg-danger/10 px-3 py-2 text-[11.5px] text-danger",children:j})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-hairline/40 px-4 py-3",children:[e.jsx("button",{onClick:()=>l({...t,kind:r,botIds:h,name:c,description:v,durationMinutes:S,resultsThreadId:U}),title:"Choose repeating schedules and other options",className:"rounded-lg px-3 py-2 text-[12px] font-medium text-accent hover:bg-accent/10",children:"More options"}),e.jsxs("button",{onClick:T,disabled:!A||z,className:"flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",children:[z&&e.jsx(De,{size:13,className:"animate-spin"}),"Save"]})]})]})}function ra({item:t,bots:n,groups:s,compact:o,layout:l,selected:p=!1,onOpen:g,onResize:u}){const r=t.kind==="call",a=t.kind==="routine"?t.routine:null,c=t.kind==="routine"?t.run:null,y=!r&&(c?.target??a?.target)==="room-goal",v=y?s.find(A=>A.id===(c?.groupId??a?.groupId)):void 0,h=(r?t.call.botIds:[c?.botId??a?.botId??""]).flatMap(A=>n.find(k=>k.id===A)??[]),P=h[0],U=r?t.call.name:c?.routineName??a?.name??"Routine",Y=r?"var(--color-accent)":P?us[P.color]:"var(--color-ink-tertiary)",G=!!(a&&!c&&!a.enabled),[z,b]=m.useState(t.durationMinutes);m.useEffect(()=>b(t.durationMinutes),[t.durationMinutes]);const j=c?.status,L=c?qe(c):void 0,f=r||!!(a&&!c&&!G&&a.schedule.type!=="cron"),N=r?t.call.schedule:a?.schedule,E=!!(N&&N.type!=="once"),S=N?.type==="interval"?Rn(N.everyMinutes):null,T=A=>{A.preventDefault(),A.stopPropagation();const k=A.clientY,I=z;let q=I;const _=J=>{q=Math.max(le,Math.min(240,Math.round((I+(J.clientY-k)/Q*60)/le)*le)),b(q)},V=()=>{if(document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",V),q!==t.durationMinutes){if(E&&!window.confirm("Resize this entire recurring series?")){b(t.durationMinutes);return}u(q)}};document.addEventListener("pointermove",_),document.addEventListener("pointerup",V,{once:!0})};return e.jsxs("button",{"data-event-card":!0,type:"button",draggable:f,title:a?.schedule.type==="cron"?"Open this routine to edit its repeating schedule and time zone.":void 0,onDragStart:A=>{if(!f)return A.preventDefault();A.dataTransfer.effectAllowed="move",A.dataTransfer.setData(xt,JSON.stringify({kind:t.kind,id:r?t.call.id:a.id,at:t.at}))},onClick:A=>{A.stopPropagation(),g()},"aria-pressed":p,"aria-label":`${U}, ${se(t.at)}${G?`, ${x("routines.pausedSchedule")}`:L?`, ${L}`:""}`,className:C("group absolute z-10 overflow-hidden rounded-md border border-l-[3px] text-left transition hover:z-20 focus:z-20 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",z<30?"px-1.5 py-0":"px-1.5 py-1",G&&"border-dashed opacity-70",j==="cancelled"&&"opacity-55",(j==="failed"||j==="missed")&&"border-danger/60",p&&"z-20 ring-2 ring-accent ring-offset-1 ring-offset-app"),style:{left:`calc(${l.column/l.columns*100}% + 2px)`,width:`calc(${100/l.columns}% - 4px)`,top:`${(new Date(t.at).getHours()*60+new Date(t.at).getMinutes())/60*Q}px`,height:`${Math.max(16,z/60*Q)}px`,background:`color-mix(in srgb, ${Y} ${G?6:16}%, var(--color-card))`,borderColor:`color-mix(in srgb, ${Y} 40%, transparent)`,borderLeftColor:Y,color:`color-mix(in srgb, ${Y} 55%, var(--color-ink))`},children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[z>=30&&(r?e.jsx(Ot,{size:o?11:13,className:"mt-0.5 shrink-0"}):P?e.jsx(Ye,{bot:P,state:j?Ln(j):G?"sleeping":"idle",size:o?18:22,animated:j==="running"||j==="waiting"}):null),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:C("truncate text-[11px] font-semibold",z<30?"leading-none":"leading-tight"),children:U}),z>=30&&e.jsxs("div",{className:"mt-0.5 truncate text-[9.5px] opacity-80",children:[se(t.at)," · ",G?x("routines.pausedSchedule"):S??(r?`${h.length} bot${h.length===1?"":"s"}`:y?`Team goal · ${v?.name??"Group"}${L?` · ${L}`:""}`:L??P?.name)]})]}),z>=30&&h.length>1&&e.jsxs("span",{className:"rounded bg-inset/60 px-1 py-0.5 text-[8px]",children:["+",h.length-1]})]}),r&&e.jsx("div",{onPointerDown:T,className:"absolute inset-x-1 bottom-0 h-1.5 cursor-ns-resize rounded-full opacity-0 transition group-hover:opacity-100","aria-label":"Resize event",children:e.jsx("div",{className:"mx-auto mt-0.5 h-0.5 w-5 rounded-full bg-current opacity-50"})})]})}function ia({anchor:t,days:n,items:s,bots:o,groups:l,selectedId:p,onOpen:g,onCreate:u,onMove:r,onResize:a}){const c=m.useRef(null),[y,v]=m.useState(null),[F,h]=m.useState(null),P=ne(Date.now()),U=Array.from({length:n},(f,N)=>pe(t,N)),Y=n===7?64:n===3?180:280,G=`64px repeat(${n}, minmax(${Y}px, 1fr))`,z=64+n*Y;m.useEffect(()=>{const f=c.current;if(!f)return;const N=new Date,E=U.includes(P)?Math.max(0,N.getHours()-2):7;f.scrollTo({top:E*Q})},[n]);const b=(f,N)=>{if(f.button!==0||f.target.closest("[data-event-card]"))return;const E=f.currentTarget.getBoundingClientRect(),S=ut(N,f.clientY,E.top,Q);let T=S+30*6e4;v({day:N,start:S,end:T});const A=I=>{const q=ut(N,I.clientY,E.top,Q);T=Math.max(S+le*6e4,q+le*6e4),v({day:N,start:S,end:T})},k=I=>{document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",k),v(null),u({kind:"routine",at:S,durationMinutes:Math.max(le,Math.round((T-S)/6e4)),botIds:[],anchor:{x:I.clientX,y:I.clientY}})};document.addEventListener("pointermove",A),document.addEventListener("pointerup",k,{once:!0})},j=(f,N)=>{f.preventDefault(),h(null);const E=f.currentTarget.getBoundingClientRect(),S=ut(N,f.clientY,E.top,Q),T=f.dataTransfer.getData(yn);if(T)return u({kind:"routine",at:S,durationMinutes:30,botIds:[T],anchor:{x:f.clientX,y:f.clientY}});const A=f.dataTransfer.getData(xt);if(A)try{const k=JSON.parse(A);r(k,S)}catch{}},L=(f,N)=>{if(!f.dataTransfer.types.includes(yn)&&!f.dataTransfer.types.includes(xt))return;f.preventDefault(),f.dataTransfer.dropEffect=f.dataTransfer.types.includes(xt)?"move":"copy";const E=f.currentTarget.getBoundingClientRect(),S=ut(N,f.clientY,E.top,Q);h(T=>T?.day===N&&T.at===S?T:{day:N,at:S})};return e.jsxs("div",{ref:c,className:"min-h-0 flex-1 overflow-auto border-l border-t border-hairline/40 bg-app",children:[e.jsxs("div",{className:"sticky top-0 z-30 grid bg-app/95 backdrop-blur",style:{gridTemplateColumns:G,minWidth:z},children:[e.jsx("div",{className:"border-b border-r border-hairline/40 px-2 py-3 text-center text-[9px] uppercase tracking-wider text-ink-secondary",children:Ms(-new Date(t).getTimezoneOffset())}),U.map(f=>{const N=new Date(f),E=f===P;return e.jsxs("div",{role:"columnheader",className:C("border-b border-r border-hairline/40 px-2 py-2 text-center last:border-r-0",E&&"bg-accent/[0.035]"),children:[e.jsx("div",{className:C("text-[10px] font-medium uppercase tracking-[0.14em]",E?"text-accent":"text-ink-secondary"),children:Ee[N.getDay()]}),e.jsx("div",{className:C("mx-auto mt-1 flex size-8 items-center justify-center rounded-full text-[15px] font-medium",E?"bg-accent text-accent-ink":"text-ink"),children:N.getDate()})]},f)})]}),e.jsxs("div",{role:"grid","aria-label":"Routine and call calendar",onDragEnd:()=>h(null),className:"relative grid",style:{height:Q*24,gridTemplateColumns:G,minWidth:z},children:[e.jsx("div",{className:"relative border-r border-hairline/40",children:Array.from({length:24},(f,N)=>e.jsx("div",{className:"absolute right-2 -translate-y-1/2 text-[9.5px] tabular-nums text-ink-tertiary",style:{top:N*Q},children:N===0?"":new Date(2e3,0,1,N).toLocaleTimeString([],{hour:"numeric"})},N))}),U.map(f=>{const N=new Date,E=(N.getHours()*60+N.getMinutes())/60*Q,S=s.filter(I=>ne(I.at)===f),T=Ds(S),A=y?.day===f?y:null,k=F?.day===f?F:null;return e.jsxs("div",{role:"gridcell","aria-label":`${ft(f)} calendar`,onPointerDown:I=>b(I,f),onDragOver:I=>L(I,f),onDragLeave:I=>{(!(I.relatedTarget instanceof Node)||!I.currentTarget.contains(I.relatedTarget))&&h(null)},onDrop:I=>j(I,f),className:C("relative border-r border-hairline/40 last:border-r-0",f===P&&"bg-accent/[0.025]"),children:[Array.from({length:48},(I,q)=>e.jsx("div",{className:C("pointer-events-none absolute inset-x-0 border-t",q%2===0?"border-hairline/30":"border-hairline/10"),style:{top:q/2*Q}},q)),f===P&&e.jsxs("div",{className:"pointer-events-none absolute inset-x-0 z-20 flex items-center",style:{top:E},children:[e.jsx("span",{className:"-ml-1 size-2 rounded-full bg-danger"}),e.jsx("span",{className:"h-px flex-1 bg-danger/80"})]}),A&&e.jsx("div",{className:"pointer-events-none absolute inset-x-1 z-10 rounded-md border border-accent/70 bg-accent/20",style:{top:(new Date(A.start).getHours()*60+new Date(A.start).getMinutes())/60*Q,height:Math.max(16,(A.end-A.start)/36e5*Q)}}),k&&e.jsx("div",{className:"pointer-events-none absolute inset-x-1 z-20 rounded-md border border-accent/80 bg-accent/25 shadow-sm",style:{top:(new Date(k.at).getHours()*60+new Date(k.at).getMinutes())/60*Q,height:Q/2},children:e.jsx("div",{className:"px-2 py-1 text-[9.5px] font-medium text-accent",children:se(k.at)})}),S.map(I=>e.jsx(ra,{item:I,bots:o,groups:l,compact:n===7,layout:T.get(I.id)??{column:0,columns:1},selected:I.id===p,onOpen:()=>g(I),onResize:q=>a(I,q)},I.id))]},f)})]})]})}function oa({item:t,bots:n,onClose:s,onEdit:o,onCallChanged:l,onOpenRoom:p,onOpenRun:g}){const{state:u,dispatch:r}=rt(),a=Lt(),[c,y]=m.useState(!1),v=m.useRef(!1),[F,h]=m.useState(!1),[P,U]=m.useState(void 0),[Y,G]=m.useState(""),z=t.kind==="call",b=t.kind==="routine"?t.routine:null,j=P===void 0?t.kind==="routine"?t.run:null:P&&(u.routineRuns.find(w=>w.id===P.id)??P),L=t.kind==="call"?t.call:null,f=!z&&(j?.target??b?.target)==="room-goal",N=f?j?.groupId??b?.groupId:void 0,E=u.groups.find(w=>w.id===N),S=j?.executionThreadId??j?.threadId,T=L?.botIds??[j?.botId??b?.botId??""],A=T.flatMap(w=>n.find(Z=>Z.id===w)??[]),k=A[0],I=f?E:k,q=!!(S&&(I?.threadId===S||I?.tasks?.some(w=>w.threadId===S))),_=j?j.resultsThreadId??j.sourceThreadId:b?.resultsThreadId,V=_&&[...u.bots,...u.groups].some(w=>w.threadId===_||w.tasks?.some(Z=>Z.threadId===_)),J=L?.name??j?.routineName??b?.name??"Routine",$=L?.description??j?.prompt??b?.prompt??"",B=L?.attachments??j?.attachments??b?.attachments??[],ie=L?.botIds.length===1?k?.id:void 0,ae=j?j.timeoutMinutes:b?.timeoutMinutes,je=()=>{S&&(f&&N?(r({type:"switchGroupTask",groupId:N,threadId:S}),p(N)):k&&(r({type:"select",id:k.id}),r({type:"switchTask",botId:k.id,threadId:S})),s())},me=async(w,Z="POST",Re)=>{y(!0),G("");try{const X=await oe(w,{method:Z,...Re?{body:JSON.stringify(Re)}:{}});X.routine&&r({type:"routinePatched",routine:X.routine}),X.run&&r({type:"routineRunPatched",run:X.run})}catch(X){G(X instanceof Error?X.message:String(X))}finally{y(!1)}},he=()=>{!b||c||v.current||(v.current=!0,h(!0),U(null),y(!0),G(""),r({type:"runRoutine",routineId:b.id,onStarted:U,onError:w=>G(w instanceof Error?w.message:String(w)),onSettled:()=>{v.current=!1,h(!1),y(!1)}}))},Ue=async()=>{if(L){y(!0),G("");try{const{group:w}=await oe(`/api/calendar-calls/${L.id}/room`,{method:"POST"});r({type:"groupPatched",group:w}),p(w.id)}catch(w){G(w instanceof Error?w.message:String(w))}finally{y(!1)}}},O=async()=>{window.confirm(`Delete “${J}”?`)&&(L?(await oe(`/api/calendar-calls/${L.id}`,{method:"DELETE"}),l(L.id)):b&&r({type:"deleteRoutine",routineId:b.id}),s())},ge=b?.id??j?.routineId,re=ge?u.routineRuns.filter(w=>w.routineId===ge).sort((w,Z)=>pt(Z)-pt(w)).slice(0,3):[],ce=j?.runOn??b?.runOn,de=os({roomGoal:f,runOn:ce,computer:k?.computer,cloudHome:u.config?.cloudHome===!0}),we=_?[...u.bots,...u.groups].find(w=>w.threadId===_||w.tasks?.some(Z=>Z.threadId===_)):void 0,be=_?we?.tasks?.find(w=>w.threadId===_)?.title??we?.name??x("routines.results.missing"):x("routines.results.main");return e.jsxs("aside",{"aria-label":x("routines.drawer.label"),className:"flex h-full w-[min(310px,100vw)] shrink-0 flex-col border-l border-hairline/40 bg-panel",children:[e.jsxs("div",{className:"flex items-start gap-3 border-b border-hairline/40 px-4 py-3.5",children:[z?e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent-text",children:e.jsx(Ot,{size:16})}):f?e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent-text",children:e.jsx(gt,{size:16})}):k&&e.jsx(Ye,{bot:k,state:j?Ln(j.status):b?.enabled===!1?"sleeping":"idle",size:36,animated:!1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"break-words text-[15px] font-semibold leading-snug text-ink",children:J}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[b&&e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[10.5px] font-medium",b.enabled?"bg-success/15 text-success":"bg-inset text-ink-secondary"),children:Dt(b)}),e.jsxs("span",{className:"text-[11px] text-ink-secondary",children:[ft(t.at)," · ",se(t.at),z?` – ${se(t.at+t.durationMinutes*6e4)}`:""]})]})]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-full p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":x("routines.drawer.close"),children:e.jsx(ze,{size:16})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[j&&e.jsxs("div",{role:"status","aria-live":"polite",className:"rounded-xl border border-hairline/40 bg-inset p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] font-medium text-ink",children:[j.status==="running"&&e.jsx(De,{size:13,className:"animate-spin text-accent"}),qe(j)]}),j.output&&e.jsx("div",{className:"mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[11.5px] leading-relaxed text-ink-secondary",children:j.output}),j.error&&e.jsx("div",{className:"mt-2 text-[11.5px] text-danger",children:j.error})]}),j?.attention&&e.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5 text-warning",children:[e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0"}),e.jsx("div",{className:"min-w-0 whitespace-pre-wrap text-[11.5px] leading-relaxed",children:j.attention})]}),j?.status==="waiting"&&!j.attention&&e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5 text-[11.5px] text-warning",children:"This run is waiting. Open its execution thread for more context."}),e.jsx(ke,{label:z?x("routines.drawer.guests"):f?x("routines.drawer.lead"):x("routines.drawer.bot"),children:e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[A.map(w=>e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-hairline/50 bg-inset py-0.5 pl-0.5 pr-2.5",children:[e.jsx(Ye,{bot:w,state:"idle",size:22,animated:!1}),e.jsx("span",{className:"text-[12px] text-ink",children:w.name})]},w.id)),A.length===0&&e.jsx("span",{className:"text-[12.5px] text-ink-secondary",children:x("routines.unavailableBot")})]})}),f&&e.jsx(ke,{label:x("routines.drawer.group"),children:e.jsx("div",{className:"text-[12.5px] text-ink",children:E?.name??"Group unavailable"})}),(b||L)&&e.jsxs(ke,{label:x("routines.drawer.schedule"),children:[e.jsx("div",{className:"text-[12.5px] text-ink",children:yt((b??L).schedule)}),b?.schedule.type==="cron"&&e.jsx("div",{className:"mt-2",children:e.jsx(Ws,{schedule:b.schedule,paused:!b.enabled})})]}),$&&e.jsx(ke,{label:z?x("routines.drawer.agenda"):x("routines.drawer.what"),children:e.jsx("div",{className:"whitespace-pre-wrap text-[12.5px] leading-relaxed text-ink",children:$})}),!z&&e.jsxs(ke,{label:x("routines.drawer.runsOn"),children:[e.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] text-ink",children:[ce==="cloud"?e.jsx(Nn,{size:14,className:"mt-0.5 shrink-0 text-ink-secondary"}):e.jsx(Sn,{size:14,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsx("span",{children:de.label})]}),e.jsx("div",{className:"mt-0.5 text-[11px] leading-relaxed text-ink-secondary",children:de.hint})]}),!z&&!f&&e.jsx(ke,{label:x("routines.results.label"),children:e.jsx("div",{className:"text-[12.5px] text-ink",children:be})}),B.length>0&&e.jsxs(ke,{label:"Attachments",children:[e.jsx(On,{attachments:B}),L&&e.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-ink-secondary",children:L.botIds.length>1?"These references will be shared in the group when the event starts.":"These references stay with the event and are available when you join the group."})]}),a&&!z&&e.jsx(ke,{label:x("routines.drawer.runLimit"),children:e.jsx("div",{className:"text-[12.5px] text-ink",children:ae==null?"No time limit":`Stops if still running after ${st(ae)}`})}),!z&&e.jsx(ke,{label:x("routines.logs"),action:b&&e.jsxs("button",{type:"button",onClick:()=>{r({type:"showRoutines",section:"logs",routineId:b.id,botId:b.botId}),s()},className:"flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-accent-text hover:bg-raised",children:[e.jsx(Le,{size:11}),x("routines.drawer.allRuns")]}),children:re.length===0?e.jsx("div",{className:"text-[12px] text-ink-secondary",children:x("routines.drawer.noRuns")}):e.jsx("div",{className:"space-y-1",children:re.map(w=>e.jsx(da,{run:w,current:w.id===j?.id,onOpen:()=>g?.(w)},w.id))})}),Y&&e.jsx("div",{role:"alert",className:"rounded-lg bg-danger/10 px-3 py-2 text-[11.5px] text-danger",children:Y})]}),e.jsxs("div",{className:"space-y-2 border-t border-hairline/40 px-4 py-3",children:[b&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:he,disabled:c,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110 disabled:opacity-50",children:[F?e.jsx(De,{size:13,className:"animate-spin"}):e.jsx(cn,{size:13}),F?x("routines.starting"):x("routines.runNow")]}),e.jsxs("button",{disabled:c,onClick:()=>{me(`/api/routines/${b.id}`,"PATCH",{enabled:!b.enabled})},title:b.enabled?"Pause routine":"Resume routine",className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-hairline/50 bg-control px-3 py-2 text-[12px] font-medium text-ink hover:bg-raised-hover disabled:opacity-40",children:[b.enabled?e.jsx(wn,{size:13}):e.jsx(cn,{size:13}),b.enabled?x("routines.pause"):x("routines.resume")]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[ie&&e.jsxs("button",{onClick:()=>p(ie),className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110",children:[e.jsx(Qe,{size:13}),"Join group"]}),L&&L.botIds.length>1&&e.jsxs("button",{onClick:Ue,disabled:c,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110 disabled:opacity-50",children:[e.jsx(Qe,{size:13}),"Join group"]}),f&&E&&!S&&e.jsxs("button",{onClick:()=>{p(E.id),s()},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Qe,{size:13}),"Open group"]}),q&&e.jsxs("button",{onClick:je,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Qe,{size:13}),f?"Open group thread":"Open thread"]}),V&&_&&e.jsxs("button",{type:"button",onClick:()=>{ls(r,{botId:T[0],threadId:_},u),s()},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Qe,{size:13}),x("routines.results.open")]}),j&&["queued","running","waiting"].includes(j.status)&&e.jsxs("button",{onClick:()=>{me(`/api/routine-runs/${j.id}/cancel`)},disabled:c,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[e.jsx(ze,{size:13}),"Cancel run"]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(b||L)&&e.jsx("button",{onClick:o,className:"rounded-lg px-2.5 py-1.5 text-[12px] font-medium text-ink hover:bg-raised",children:x("routines.edit")}),(b||L)&&e.jsx("button",{onClick:()=>{O()},className:"rounded-lg p-2 text-ink-secondary hover:bg-danger/10 hover:text-danger",title:x("routines.delete"),"aria-label":x("routines.delete"),children:e.jsx(ds,{size:14})})]})]})]})]})}function ke({label:t,action:n,children:s}){return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-[10.5px] font-semibold uppercase tracking-wider text-ink-tertiary",children:t}),n]}),s]})}function la(t){if(t.startedAt==null||t.finishedAt==null||t.finishedAt<t.startedAt)return null;const n=Math.round((t.finishedAt-t.startedAt)/1e3);return n<60?`${n}s`:st(Math.round(n/60))}function da({run:t,current:n,onOpen:s}){const o=t.startedAt??t.scheduledFor,l=la(t),p=t.status==="completed"&&(!t.goalStatus||t.goalStatus==="completed"),g=nt(t)||t.goalStatus==="failed"||t.goalStatus==="blocked",u=["queued","running","waiting"].includes(t.status);return e.jsxs("button",{type:"button",onClick:s,"aria-label":x("routines.openRun",{name:t.routineName,status:qe(t)}),"aria-current":n||void 0,className:C("flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-raised",n&&"bg-raised"),children:[p?e.jsx(Cn,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}):g?e.jsx(xs,{size:14,className:"shrink-0 text-danger","aria-hidden":"true"}):u?e.jsx(De,{size:14,className:"shrink-0 animate-spin text-accent","aria-hidden":"true"}):e.jsx(Ge,{size:14,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] text-ink",children:new Date(o).toLocaleDateString([],{month:"short",day:"numeric"})}),e.jsxs("span",{className:"shrink-0 text-[11px] tabular-nums text-ink-secondary",children:[se(o),l?` · ${l}`:""]})]})}function ca({routines:t,bots:n,groups:s,onClose:o,onEdit:l,onOpenRoom:p}){const{dispatch:g}=rt(),u=m.useRef(null);return An(u,o),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-3",onMouseDown:r=>r.target===r.currentTarget&&o(),children:e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Paused routines",tabIndex:-1,className:"w-full max-w-[520px] rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[16px] font-semibold text-ink",children:"Paused routines"}),e.jsx("div",{className:"mt-0.5 text-[11.5px] text-ink-secondary",children:"History is kept; no new tasks will run."})]}),e.jsx("button",{onClick:o,className:"rounded-full p-2 text-ink-secondary hover:bg-raised","aria-label":x("routines.paused.close"),children:e.jsx(ze,{size:17})})]}),e.jsx("div",{className:"max-h-[55vh] space-y-1 overflow-y-auto p-3",children:t.map(r=>{const a=n.find(y=>y.id===r.botId),c=r.target==="room-goal"?s.find(y=>y.id===r.groupId):void 0;return e.jsxs("div",{className:"flex items-center gap-3 rounded-xl px-3 py-2.5 hover:bg-raised/60",children:[c?e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/12 text-accent",children:e.jsx(gt,{size:17})}):a&&e.jsx(Ye,{bot:a,state:"sleeping",size:36,animated:!1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12.5px] font-medium text-ink",children:r.name}),e.jsxs("div",{className:"mt-0.5 truncate text-[10.5px] text-ink-secondary",children:[c?`Team goal · ${c.name} · `:"",yt(r.schedule)]})]}),c&&e.jsx("button",{onClick:()=>{p(c.id),o()},className:"rounded-lg px-2 py-1.5 text-[11px] text-ink-secondary hover:bg-inset",children:"Group"}),e.jsx("button",{onClick:()=>g({type:"updateRoutine",routineId:r.id,patch:{enabled:!0}}),className:"rounded-lg bg-accent/15 px-2.5 py-1.5 text-[11px] font-medium text-accent",children:"Resume"}),e.jsx("button",{onClick:()=>l(r),className:"rounded-lg px-2 py-1.5 text-[11px] text-ink-secondary hover:bg-inset",children:"Edit"})]},r.id)})})]})})}function ua({routine:t,bots:n,lockedBotId:s,defaultRunOn:o,onClose:l}){const p=t?.schedule.type==="once"?t.schedule.at:t?.schedule.type==="daily"?Me(Date.now(),t.schedule.time):t?.schedule.type==="interval"?t.schedule.anchorAt:t?.schedule.type==="cron"?t.nextRunAt??at():at();return e.jsx(Pn,{seed:{kind:"routine",at:p,durationMinutes:t?.durationMinutes??30,botIds:s?[s]:t?[t.botId]:[],routine:t},bots:n,lockedBotId:s,defaultRunOn:o,onClose:l,onSavedCall:()=>{}})}function xa({onBack:t,onOpenRoom:n}){const{state:s,dispatch:o}=rt(),{capabilities:l}=ns(),p=Lt(),g=window.ogb?.remoteClient?.active===!0,u=m.useRef(null),[r,a]=m.useState(s.routinesFocus?.section==="logs"?"logs":"calendar"),[c,y]=m.useState(s.routinesFocus?.view==="list"?"list":"week"),[v,F]=m.useState(()=>ne(Date.now())),[h,P]=m.useState(s.routinesFocus?.botId??"all"),[U,Y]=m.useState(s.routinesFocus?.routineId),[G,z]=m.useState(s.routinesFocus?.runStatus??"all"),[b,j]=m.useState([]),[L,f]=m.useState(null),[N,E]=m.useState(null),[S,T]=m.useState(null),[A,k]=m.useState(!1),[I,q]=m.useState(0),[_,V]=m.useState(""),J=s.bots.filter(i=>!i.hidden),$=p&&!g,B=r==="webhooks"&&!$?"calendar":r,ie=c==="day"?1:7,ae=ie===7?Ns(v):ne(v),je=pe(ae,ie),me=B==="calendar"&&c!=="list";m.useEffect(()=>{const i=s.routinesFocus;a(i?.section==="logs"?"logs":"calendar"),y(i?.view==="list"?"list":"week"),P(i?.botId??"all"),Y(i?.routineId),z(i?.runStatus??"all")},[s.routinesFocus]);const he=m.useCallback(async()=>{try{const i=await oe("/api/calendar-calls");j(i.calls??[])}catch(i){V(i instanceof Error?i.message:String(i))}},[]);m.useEffect(()=>{g||he()},[he,g]),m.useEffect(()=>{u.current?.focus({preventScroll:!0})},[]);const Ue=m.useMemo(()=>{const i=mn(s.routines,s.routineRuns,ae,je).map(H=>({...H,kind:"routine"})),D=Date.now(),R=s.routines.filter(H=>!H.enabled),ye=mn(R.map(H=>({...H,enabled:!0})),s.routineRuns,ae,je).filter(H=>!H.run&&H.at>=D).map(H=>({...H,id:`paused-${H.id}`,routine:R.find(_e=>_e.id===H.routine?.id)??H.routine,kind:"routine"})),Se=na(b,ae,je).map(H=>({...H,kind:"call"}));return[...i,...ye,...Se].filter(H=>h==="all"||(H.kind==="call"?H.call.botIds.includes(h):(H.routine?.botId??H.run?.botId)===h)).sort((H,_e)=>H.at-_e.at)},[s.routines,s.routineRuns,b,ae,je,h]),O=S?.kind==="call"?(()=>{const i=b.find(D=>D.id===S.call.id);return i?{...S,call:i}:null})():S?.kind==="routine"?{...S,routine:S.routine?s.routines.find(i=>i.id===S.routine?.id)??null:null,run:S.run?s.routineRuns.find(i=>i.id===S.run?.id)??S.run:null}:null,ge=s.routines.filter(i=>!i.enabled&&(i.schedule.type!=="once"||i.schedule.at>Date.now())),re=s.routineRuns.filter(i=>["queued","running","waiting"].includes(i.status)).length,ce=s.routineRuns.filter(i=>nt(i)&&!i.seenAt).length,de=s.routines.filter(i=>h==="all"||i.botId===h),we=s.routineRuns.filter(i=>h==="all"||i.botId===h),be=i=>i.schedule.type==="once"?i.schedule.at:i.schedule.type==="interval"?i.schedule.anchorAt:i.schedule.type==="cron"?i.nextRunAt??at():Me(Date.now(),i.schedule.time),w=i=>T({kind:"routine",id:i.id,at:i.nextRunAt??be(i),durationMinutes:i.durationMinutes,routine:i,run:null}),Z=i=>{Y(i.id),a("logs")},Re=i=>{T({kind:"routine",id:i.id,at:i.scheduledFor,durationMinutes:i.durationMinutes??30,routine:s.routines.find(D=>D.id===i.routineId)??null,run:i}),["failed","missed"].includes(i.status)&&!i.seenAt&&o({type:"markRoutineRunSeen",runId:i.id})},X=i=>{T(i),i.kind==="routine"&&i.run&&["failed","missed"].includes(i.run.status)&&!i.run.seenAt&&o({type:"markRoutineRunSeen",runId:i.run.id})},Ke=l.windowChrome==="mac-inset",Oe=Ke?{WebkitAppRegion:"drag"}:void 0,Pe=Ke?{WebkitAppRegion:"no-drag"}:void 0,fe=i=>{a("calendar"),y(i),F(D=>ne(D))},Je=m.useCallback(()=>F(ne(Date.now())),[]),K=m.useCallback(()=>q(0),[]),Ie=m.useCallback(i=>{T(null),f({kind:"routine",at:at(),durationMinutes:30,botIds:[],...i})},[]),it=()=>{if(r==="webhooks"&&a("calendar"),p)return Ie({kind:"routine"});T(null),E({kind:"routine",at:at(),durationMinutes:30,botIds:h!=="all"?[h]:[]})};m.useEffect(()=>{const i=D=>{if(!D.target?.matches("input, textarea, select, [contenteditable=true]")){if(D.key==="Escape"){f(null),E(null),T(null);return}B!=="calendar"||D.metaKey||D.ctrlKey||D.altKey||(D.key.toLowerCase()==="c"&&(D.preventDefault(),Ie()),D.key.toLowerCase()==="t"&&Je(),(D.key==="1"||D.key.toLowerCase()==="d")&&fe("day"),D.key.toLowerCase()==="w"&&fe("week"),D.key.toLowerCase()==="l"&&fe("list"))}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[B,Ie,Je,v]);const $e=i=>j(D=>D.some(R=>R.id===i.id)?D.map(R=>R.id===i.id?i:R):[i,...D]),Fe=async(i,D)=>{if(D!==i.at)try{if(i.kind==="routine"){const R=s.routines.find(Se=>Se.id===i.id);if(!R)return;if(R.schedule.type==="cron")throw new Error("Open this routine to edit its repeating schedule and time zone.");if(R.schedule.type!=="once"&&!window.confirm("Move this entire recurring series?"))return;const ye=await oe(`/api/routines/${R.id}`,{method:"PATCH",body:JSON.stringify({schedule:pn(R.schedule,i.at,D)})});o({type:"routinePatched",routine:ye.routine})}else{const R=b.find(Se=>Se.id===i.id);if(!R||R.schedule.type==="daily"&&!window.confirm("Move this entire recurring series?"))return;const ye=await oe(`/api/calendar-calls/${R.id}`,{method:"PATCH",body:JSON.stringify({schedule:pn(R.schedule,i.at,D)})});$e(ye.call)}}catch(R){V(R instanceof Error?R.message:String(R))}},ee=async(i,D)=>{try{if(i.kind==="routine"&&i.routine){const R=await oe(`/api/routines/${i.routine.id}`,{method:"PATCH",body:JSON.stringify({durationMinutes:D})});o({type:"routinePatched",routine:R.routine})}else if(i.kind==="call"){const R=await oe(`/api/calendar-calls/${i.call.id}`,{method:"PATCH",body:JSON.stringify({durationMinutes:D})});$e(R.call)}}catch(R){V(R instanceof Error?R.message:String(R))}},vt=()=>{if(!O)return;const i=O.kind==="call"?{kind:"call",at:O.at,durationMinutes:O.call.durationMinutes,botIds:O.call.botIds,call:O.call}:{kind:"routine",at:O.at,durationMinutes:O.routine?.durationMinutes??O.run?.durationMinutes??30,botIds:[O.routine?.botId??O.run?.botId??""].filter(Boolean),routine:O.routine??void 0};T(null),E(i)},Ne=i=>C("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-[12px] font-medium",i?"bg-raised text-ink shadow-sm":"text-ink-secondary hover:text-ink"),Be=!!O&&B!=="webhooks";return e.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app animate-workspace-in",children:[e.jsxs("header",{className:C("shrink-0 border-b border-hairline/35 bg-app py-3 pr-4",Ke?"pl-[86px]":"pl-4"),style:Oe,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",ref:u,onClick:t,"aria-label":"Back",title:"Back",className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink",style:Pe,children:e.jsx(ss,{size:18})}),e.jsx("h1",{"data-tour":"automations-page",className:"mr-1 text-[18px] font-semibold tracking-tight text-ink",children:x("routines.title")}),me&&e.jsxs("div",{className:"flex min-w-0 items-center gap-1",style:Pe,children:[e.jsx("button",{type:"button",onClick:()=>F(i=>pe(i,-ie)),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":x("routines.previous"),children:e.jsx(kn,{size:16})}),e.jsx("button",{type:"button",onClick:()=>F(i=>pe(i,ie)),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":x("routines.next"),children:e.jsx(Et,{size:16})}),e.jsx("div",{className:"min-w-0 truncate px-1 text-[14px] font-medium text-ink","aria-live":"polite",children:Rs(ae,ie)}),e.jsx("button",{type:"button",onClick:Je,className:"ml-1 rounded-lg border border-hairline/50 bg-panel px-2.5 py-1 text-[12px] font-medium text-ink hover:bg-raised",children:x("routines.today")})]}),e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",style:Pe,children:[e.jsxs("div",{role:"group",className:"flex items-center rounded-lg border border-hairline/50 bg-panel p-0.5","aria-label":x("routines.view.label"),children:[e.jsx("button",{type:"button","aria-pressed":B==="calendar"&&c==="day",onClick:()=>fe("day"),className:Ne(B==="calendar"&&c==="day"),children:x("routines.view.day")}),e.jsx("button",{type:"button","aria-pressed":B==="calendar"&&c==="week",onClick:()=>fe("week"),className:Ne(B==="calendar"&&c==="week"),children:x("routines.view.week")}),e.jsx("button",{type:"button","aria-pressed":B==="calendar"&&c==="list",onClick:()=>fe("list"),className:Ne(B==="calendar"&&c==="list"),children:x("routines.view.list")})]}),e.jsxs("button",{type:"button","aria-pressed":B==="logs",onClick:()=>{if(B==="logs"){a("calendar");return}a("logs"),Y(void 0)},className:C("flex items-center gap-1.5 rounded-lg border border-hairline/50 px-2.5 py-1.5 text-[12px] font-medium",B==="logs"?"bg-raised text-ink":"bg-panel text-ink-secondary hover:text-ink"),children:[e.jsx(Le,{size:13}),x("routines.logs"),ce>0&&e.jsx("span",{className:"rounded-full bg-danger/10 px-1.5 text-[9px] text-danger",children:ce})]}),$&&e.jsxs("button",{type:"button","aria-pressed":B==="webhooks",onClick:()=>a(B==="webhooks"?"calendar":"webhooks"),className:C("flex items-center gap-1.5 rounded-lg border border-hairline/50 px-2.5 py-1.5 text-[12px] font-medium",B==="webhooks"?"bg-raised text-ink":"bg-panel text-ink-secondary hover:text-ink"),children:[e.jsx(as,{size:13}),x("routines.webhooks"),s.webhooks.length>0&&e.jsx("span",{className:"rounded-full bg-accent/15 px-1.5 text-[9px] text-accent-text",children:s.webhooks.length})]}),B==="webhooks"?e.jsxs("button",{type:"button",disabled:J.length===0,onClick:()=>q(i=>i+1),className:"flex items-center gap-1.5 rounded-lg bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110 disabled:opacity-40",children:[e.jsx(dn,{size:15,"aria-hidden":"true"}),x("routines.newWebhook")]}):e.jsxs("button",{type:"button",onClick:it,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110",children:[e.jsx(dn,{size:15,"aria-hidden":"true"}),x("routines.newRoutine")]})]})]}),B!=="webhooks"&&e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",style:Pe,children:[ce>0&&e.jsxs("button",{type:"button",onClick:()=>o({type:"markAllRoutineRunsSeen"}),className:"flex items-center gap-1.5 rounded-lg border border-hairline/50 bg-panel px-2.5 py-1.5 text-[11.5px] text-ink-secondary hover:bg-raised hover:text-ink",title:x("routines.markAllSeen"),"aria-label":x("routines.markAllSeen"),children:[e.jsx(rs,{size:12}),x("routines.markAllSeen")]}),re>0&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-accent/10 px-2.5 py-1.5 text-[10.5px] text-accent-text",children:[e.jsx(De,{size:11,className:"animate-spin"}),re," active"]}),ce>0&&e.jsxs("button",{type:"button",onClick:()=>o({type:"showRoutines",section:"logs",runStatus:"problems"}),className:"flex items-center gap-1.5 rounded-full bg-danger/10 px-2.5 py-1.5 text-[10.5px] text-danger",title:"Open problem run logs","aria-label":"Open problem run logs",children:[e.jsx(Ge,{size:11}),ce]}),ge.length>0&&e.jsxs("button",{type:"button",onClick:()=>k(!0),"aria-label":"View paused routines",className:"flex items-center gap-1.5 rounded-full border border-hairline/50 px-2.5 py-1.5 text-[10.5px] text-ink-secondary hover:bg-raised",children:[e.jsx(wn,{size:11}),ge.length]}),e.jsx("div",{className:"ml-auto flex items-center gap-2",children:e.jsxs("select",{"aria-label":"Filter schedule by bot",value:h,onChange:i=>{P(i.target.value),Y(void 0)},className:"max-w-[180px] rounded-lg border border-hairline/50 bg-panel px-2.5 py-1.5 text-[11.5px] text-ink outline-none focus:border-accent",children:[e.jsx("option",{value:"all",children:"All bots"}),J.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})}),_&&e.jsxs("button",{type:"button",onClick:()=>V(""),className:"flex items-center gap-1.5 rounded-lg bg-danger/10 px-2.5 py-1.5 text-[10.5px] text-danger",children:[e.jsx(Ge,{size:11}),_,e.jsx(ze,{size:11})]}),me&&s.routinesLoadState==="error"&&e.jsx("p",{role:"alert",className:"w-full text-[11.5px] text-danger",children:x("routines.loadError")}),me&&s.routinesLoadState==="loading"&&s.routines.length===0&&e.jsx("p",{role:"status",className:"w-full text-[11.5px] text-ink-secondary",children:x("routines.loading")})]})]}),e.jsx(pa,{}),e.jsxs("div",{className:"@container/routines relative flex min-h-0 flex-1",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:B==="webhooks"?e.jsx(gs,{bots:J,createRequest:I,onCreateHandled:K}):B==="logs"?e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Bs,{runs:we,bots:s.bots,loading:s.routinesLoadState==="loading"&&we.length===0,error:s.routinesLoadState==="error",routineId:U,status:G,onStatusChange:z,onClearRoutine:()=>Y(void 0),onOpen:Re})}):c==="list"?e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto w-full max-w-4xl space-y-5 p-4 sm:p-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:x("routines.title")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:"All schedules, including paused and finished routines."})]}),e.jsx(Fs,{routines:de,runs:s.routineRuns,bots:s.bots,loading:s.routinesLoadState==="loading"&&de.length===0,error:s.routinesLoadState==="error",onOpen:w,onLogs:Z}),!g&&b.some(i=>h==="all"||i.botIds.includes(h))&&e.jsxs("section",{className:"space-y-2","aria-label":"Scheduled calls",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-ink",children:"Scheduled calls"}),b.filter(i=>h==="all"||i.botIds.includes(h)).map(i=>e.jsxs("button",{type:"button",onClick:()=>T({kind:"call",id:i.id,at:i.schedule.type==="once"?i.schedule.at:Me(Date.now(),i.schedule.time),durationMinutes:i.durationMinutes,call:i}),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card p-4 text-left hover:bg-raised",children:[e.jsx(Ot,{size:17,className:"text-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium text-ink",children:i.name}),e.jsx("span",{className:"mt-1 block text-[11.5px] text-ink-secondary",children:yt(i.schedule)})]})]},i.id))]})]})}):e.jsxs("div",{className:"flex min-h-0 flex-1",children:[!Be&&e.jsx("div",{className:"hidden shrink-0 @min-[1040px]/routines:block",children:e.jsx(Ps,{bots:J,anchor:v,onSelectDate:i=>F(ne(i))})}),e.jsx(ia,{anchor:ae,days:ie,items:Ue,bots:s.bots,groups:s.groups,selectedId:O?.id,onOpen:X,onCreate:Ie,onMove:(i,D)=>{Fe(i,D)},onResize:(i,D)=>{ee(i,D)}})]})}),Be&&O&&e.jsx("div",{className:"absolute inset-y-0 right-0 z-30 flex shadow-2xl @min-[760px]/routines:static @min-[760px]/routines:shadow-none",children:e.jsx(oa,{item:O,bots:s.bots,onClose:()=>T(null),onEdit:vt,onOpenRun:Re,onCallChanged:i=>{i?j(D=>D.filter(R=>R.id!==i)):he()},onOpenRoom:n},`${O.kind}:${O.id}`)})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/25",onMouseDown:()=>f(null)}),e.jsx(aa,{seed:L,bots:J,routinesOnly:g,onClose:()=>f(null),onMore:i=>{f(null),E(i)},onSavedRoutine:i=>o({type:"routinePatched",routine:i}),onSavedCall:$e})]}),N&&e.jsx(Pn,{seed:N,bots:J,routinesOnly:g,onClose:()=>E(null),onSavedCall:$e}),A&&e.jsx(ca,{routines:ge,bots:s.bots,groups:s.groups,onClose:()=>k(!1),onEdit:i=>{k(!1),E({kind:"routine",at:be(i),durationMinutes:i.durationMinutes,botIds:[i.botId],routine:i})},onOpenRoom:n})]})}function pa(){const t=typeof window<"u"?window.ogb?.routines:void 0,[n,s]=m.useState(null),[o,l]=m.useState(!1);if(m.useEffect(()=>{if(!t)return;let g=!1;const u=()=>t.wakeState().then(a=>{g||s(a)}).catch(()=>{});u();const r=window.setInterval(u,3e4);return()=>{g=!0,window.clearInterval(r)}},[t]),!t||!n)return null;const p=n.keepAwake?n.onBattery?"On battery, so not holding; plug in to keep it awake.":n.hold?n.reason==="running"?"Holding it awake now: a routine is running.":`Holding it awake now: a routine is due at ${n.at?se(n.at):"the top of the hour"}.`:"Holds it awake for the hour before a routine and while one runs, while plugged in. A closed lid still sleeps.":"Off — this computer may sleep through a scheduled routine.";return e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-hairline/35 bg-panel/60 px-4 py-2.5",children:[e.jsxs("div",{className:"min-w-0 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx("span",{className:"font-medium text-ink",children:"Keep this computer awake for routines."})," ",p]}),e.jsx(is,{checked:n.keepAwake,disabled:o,"aria-label":"Keep this computer awake for scheduled routines",onClick:()=>{l(!0),t.keepAwake(!n.keepAwake).then(s).catch(()=>{}).finally(()=>l(!1))},className:"shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}const ba=Object.freeze(Object.defineProperty({__proto__:null,RoutineEditor:ua,RoutinesPage:xa},Symbol.toStringTag,{value:"Module"}));export{As as B,Fs as R,ua as a,An as b,ba as c,yt as s,Es as u,ga as w};
@@ -1,3 +0,0 @@
1
- import{k as ee,u as $,r as x,j as e,az as te,P as se,B as D,W as J,c as N,aA as ne,aB as F,aC as ae,T as ie,o as G,x as re,d as Y,w as Z,a7 as oe,E as de,X as ce,v as le,g as I}from"./index-C3NqfdVU.js";const xe=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],V=ee("rotate-cw",xe);function me(t){return t?.computerMcp===!0}const ue="this bot's cloud computer is being used by an active turn — interrupt it first";function pe(t){return t.includes(ue)}function Re(t){return t.status===409&&["this bot's cloud computer is being changed — wait for it to finish","the VPS is being prepared — try again shortly","VPS connection settings are being updated — wait for them to finish","Boat account settings are being updated — wait for them to finish"].includes(t.message)}function ze(t){if(!t||typeof t!="object")return!1;const{status:s,message:n}=t;return s!==void 0&&s!==409?!1:typeof n=="string"&&pe(n)}function Pe(t){if(!t||typeof t!="object")return null;const s=t;return typeof s.png!="string"||!s.png||!/^[A-Za-z0-9+/=]+$/.test(s.png)||s.format!=="png"&&s.format!=="jpeg"?null:`data:${s.format==="jpeg"?"image/jpeg":"image/png"};base64,${s.png}`}function he(t){return{computerMcp:t?.capabilities?.computerMcp}}function fe(t,s){const n=s?t.find(d=>d.instanceId===s):void 0;return n&&me(he(n))?n:void 0}const q="omb-webhook-credentials";function be(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t;return[s.endpointUrl,s.secret,s.url].every(n=>typeof n=="string"&&n.length>0)}function _(t){try{const s=t?.getItem(q),n=s?JSON.parse(s):null;return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(d=>be(d[1])))}catch{return{}}}function B(t,s,n){const d=_(t);d[s]=n;try{t?.setItem(q,JSON.stringify(d))}catch{}}function ge(t,s){const n=_(t);delete n[s];try{t?.setItem(q,JSON.stringify(n))}catch{}}function M(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}function ye(t){return{enabled:t?.enabled??!0,verificationPending:t?.verificationPending??!1}}const W=3,L=50;function ve(t){const s=t.trim();if(!s)return null;if(!/^\d+$/.test(s))return;const n=Number(s);return n>=1&&n<=L?n:void 0}function je(t){if(!t)return"Never";const s=Math.max(0,Date.now()-t);return s<6e4?"Just now":s<60*6e4?`${Math.floor(s/6e4)}m ago`:s<1440*6e4?`${Math.floor(s/36e5)}h ago`:new Date(t).toLocaleDateString([],{month:"short",day:"numeric"})}function ke(t){const s=t.prompt?.match(/^Event: (.+)$/m)?.[1]?.trim()||"Webhook event",n=t.prompt?.match(/\[UNTRUSTED WEBHOOK EVENT DATA\]\n([\s\S]*?)\n\[\/UNTRUSTED WEBHOOK EVENT DATA\]/)?.[1]??"",d=n.indexOf(`
2
-
3
- `),f=(d>=0?n.slice(d+2):n).replace(/\s+/g," ").trim();return{eventName:s,preview:f.slice(0,240)}}function X(t,s){return t.trim().split(/[.!?\n]/)[0]?.trim().slice(0,60)||`${s?.name??"MAUS"} webhook`}function Ne(t){return t.verificationPending?{label:"Waiting for test",tone:"text-accent",dot:"bg-accent animate-pulse"}:t.verifiedAt&&!t.enabled?{label:"Ready to enable",tone:"text-warning",dot:"bg-warning"}:t.enabled?{label:"Active",tone:"text-success",dot:"bg-success"}:{label:"Paused",tone:"text-ink-secondary",dot:"bg-ink-secondary/50"}}function we(t,s){return t==="rejected"||s?.status==="failed"||s?.status==="missed"?"text-danger":s&&["queued","running","waiting"].includes(s.status)?"text-accent":s?.status==="completed"||t==="captured"||t==="accepted"?"text-success":"text-ink-secondary"}function Se(t,s){return s?s.status==="waiting"?"Needs you":s.status[0].toUpperCase()+s.status.slice(1):t==="captured"?"Test received":t==="duplicate"?"Duplicate":t==="ignored"?"Ignored":t==="rejected"?"Rejected":"Accepted"}function Q(t){return`curl -sS '${t.url}' --json '{"task":"A customer wrote: This app saved me hours. Write a short thank-you reply."}'`}function Ce({webhook:t,bots:s,onClose:n,onCredential:d}){const{state:f,dispatch:b}=$(),[u,o]=x.useState(t?.botId??s[0]?.id??""),[y,S]=x.useState(t?.name??""),[w,k]=x.useState(t?.prompt??""),[T,A]=x.useState(t?.runOn??"maus"),[R,c]=x.useState((t?.eventTypes??[]).join(", ")),[p,m]=x.useState(t?.maxPendingRuns?.toString()??""),[l,a]=x.useState(!1),[g,C]=x.useState(""),E=x.useRef(null),z=x.useRef(n);z.current=n;const U=!!(f.config?.box.configured&&fe(f.instances,s.find(i=>i.id===u)?.modelSelection.instanceId)?.snapshot.state==="available");x.useEffect(()=>{const i=E.current;if(!i)return;const v=document.activeElement instanceof HTMLElement?document.activeElement:null,P=()=>Array.from(i.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(j=>!j.hasAttribute("hidden"));(i.querySelector("[data-initial-focus]")??P()[0]??i).focus();const h=j=>{if(j.key==="Escape"){j.preventDefault(),j.stopPropagation(),z.current();return}if(j.key!=="Tab")return;const O=P();if(!O.length)return j.preventDefault();const K=O[0],H=O[O.length-1];j.shiftKey&&(document.activeElement===K||!i.contains(document.activeElement))?(j.preventDefault(),H.focus()):!j.shiftKey&&document.activeElement===H&&(j.preventDefault(),K.focus())};return i.addEventListener("keydown",h),()=>{i.removeEventListener("keydown",h),v?.getClientRects().length?v.focus():document.querySelector('summary[aria-label="Create an automation"]')?.focus()}},[]);const r=async()=>{const i=s.find(h=>h.id===u),v=ve(p);if(v===void 0){C(`Unfinished tasks at once must be a whole number from 1 to ${L}.`);return}const P={name:y.trim()||X(w,i),prompt:w.trim(),botId:u,runOn:T,...ye(t),eventTypes:R.split(",").map(h=>h.trim()).filter(Boolean),maxPendingRuns:v};a(!0),C("");try{const h=await I(t?`/api/webhooks/${t.id}`:"/api/webhooks",{method:t?"PATCH":"POST",body:JSON.stringify(P)});b({type:"webhookPatched",webhook:h.webhook}),n(),h.credential&&d(h.credential,h.webhook.id)}catch(h){C(h instanceof Error?h.message:String(h))}finally{a(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-5 backdrop-blur-sm",onMouseDown:i=>i.target===i.currentTarget&&n(),children:e.jsxs("div",{ref:E,role:"dialog","aria-modal":"true","aria-label":t?"Edit webhook":"New webhook",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[590px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[17px] font-semibold text-ink",children:t?"Edit webhook":"New webhook"}),e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:"Each request starts a new task in the MAUS chat."})]}),e.jsx("button",{onClick:n,"aria-label":"Close webhook editor",className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(ce,{size:18})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-secondary",children:"Who receives the tasks?"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:s.map(i=>e.jsxs("button",{type:"button","data-initial-focus":u===i.id?"":void 0,onClick:()=>o(i.id),className:N("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",u===i.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[e.jsx(D,{bot:i,state:u===i.id?"happy":"idle",size:38,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:i.name})]},i.id))})]}),e.jsxs("div",{className:"rounded-xl border border-accent/20 bg-accent/5 px-3.5 py-3 text-[11.5px] leading-relaxed text-ink-secondary",children:["Send the task in the request: ",e.jsx("code",{className:"text-ink",children:'{"task":"Check the failed build"}'}),". The MAUS keeps its model, tools, permissions, and computer setup."]}),e.jsxs("details",{className:"group rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",open:!!t,children:[e.jsx("summary",{className:"cursor-pointer text-[12.5px] font-medium text-ink",children:"Advanced options"}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"mb-1.5 block text-[11.5px] font-medium text-ink-secondary",children:["Name ",e.jsx("span",{className:"font-normal",children:"· optional"})]}),e.jsx("input",{value:y,onChange:i=>S(i.target.value),placeholder:X(w,s.find(i=>i.id===u)),className:"w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70"})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"mb-1.5 block text-[11.5px] font-medium text-ink-secondary",children:["Default instructions ",e.jsx("span",{className:"font-normal",children:"· optional"})]}),e.jsx("textarea",{value:w,onChange:i=>k(i.target.value),rows:3,placeholder:"For every event, summarize what happened and suggest the next step…",className:"w-full resize-y rounded-xl border border-hairline/60 bg-panel px-3.5 py-3 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70"}),e.jsx("span",{className:"mt-1.5 block text-[10.5px] leading-relaxed text-ink-secondary",children:"Use this only when every event needs the same handling rule. Otherwise the request’s task is used."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[11.5px] font-medium text-ink-secondary",children:"Run on"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>A("maus"),className:N("rounded-xl border p-3 text-left",T==="maus"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:e.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] font-medium text-ink",children:[e.jsx(Z,{size:14}),"This computer"]})}),e.jsx("button",{type:"button",disabled:!U&&T!=="cloud",onClick:()=>A("cloud"),className:N("rounded-xl border p-3 text-left disabled:cursor-not-allowed disabled:opacity-45",T==="cloud"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:e.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] font-medium text-ink",children:[e.jsx(le,{size:14}),"Cloud computer"]})})]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"mb-1.5 block text-[11.5px] font-medium text-ink-secondary",children:["Only accept event types ",e.jsx("span",{className:"font-normal",children:"· optional"})]}),e.jsx("input",{value:R,onChange:i=>c(i.target.value),placeholder:"push, workflow_run",className:"w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70"}),e.jsx("span",{className:"mt-1.5 block text-[10.5px] text-ink-secondary",children:"Comma-separated values from the sender’s event-type header."})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"mb-1.5 block text-[11.5px] font-medium text-ink-secondary",children:["Unfinished tasks at once ",e.jsx("span",{className:"font-normal",children:"· optional"})]}),e.jsx("input",{type:"number",inputMode:"numeric",min:1,max:L,step:1,value:p,onChange:i=>m(i.target.value),placeholder:String(W),className:"w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70"}),e.jsxs("span",{className:"mt-1.5 block text-[10.5px] text-ink-secondary",children:["How many of this webhook’s tasks can be queued or running together. More requests get HTTP 429 until one finishes. Leave blank for ",W,"."]})]})]})]}),g&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:g})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[e.jsx("button",{onClick:n,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:"Cancel"}),e.jsxs("button",{disabled:l||!u,onClick:()=>{r()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[l&&e.jsx(Y,{size:14,className:"animate-spin"}),t?"Save changes":"Create webhook"]})]})]})})}function Ee(t,s,n){const d=new Map(n.map(o=>[o.id,o])),f=new Set(s.map(o=>o.runId).filter(Boolean)),b=s.filter(o=>o.webhookId===t.id).map(o=>({id:o.id,at:o.receivedAt,outcome:o.outcome,eventName:o.eventName||(o.outcome==="rejected"?"Rejected request":"Webhook event"),preview:o.preview||"",reason:o.reason,run:o.runId?d.get(o.runId):void 0})),u=n.filter(o=>o.webhookId===t.id&&!f.has(o.id)).map(o=>{const y=ke(o);return{id:o.id,at:o.scheduledFor,outcome:"accepted",eventName:y.eventName,preview:y.preview,run:o}});return[...b,...u].sort((o,y)=>y.at-o.at).slice(0,30)}function Te(){const{dispatch:t}=$(),[s,n]=x.useState(()=>_(M())),[d,f]=x.useState(null),b=x.useRef(!1),[u,o]=x.useState(null),[y,S]=x.useState("command"),[w,k]=x.useState("");return{credentials:s,setCredentials:n,rememberCredential:(c,p)=>{B(M(),c,p),n(m=>({...m,[c]:p}))},working:d,copiedId:u,copiedKind:y,error:w,setError:k,invoke:async(c,p)=>{if(!b.current){b.current=!0,f(`${c.id}:${p}`),k("");try{if(p==="delete"){if(!window.confirm(`Delete “${c.name}”? Existing thread history will stay available.`))return;await I(`/api/webhooks/${c.id}`,{method:"DELETE"}),t({type:"webhookDeleted",webhookId:c.id}),ge(M(),c.id),n(m=>{const l={...m};return delete l[c.id],l})}else{const m=!c.enabled;if(m&&c.verificationPending)throw new Error("Send a request before turning this webhook on");const l=await I(`/api/webhooks/${c.id}`,{method:"PATCH",body:JSON.stringify({enabled:m,verificationPending:!1})});t({type:"webhookPatched",webhook:l.webhook})}}catch(m){k(m instanceof Error?m.message:String(m))}finally{b.current=!1,f(null)}}},createAndCopyCommand:async(c,p=!1,m="command")=>{if(!b.current){b.current=!0,f(`${c.id}:command`),k("");try{if(p&&!window.confirm("Replace this private URL? Every previously copied command will stop working."))return;let l=p?void 0:s[c.id];if(!l){const a=await I(`/api/webhooks/${c.id}/rotate`,{method:"POST"});l=a.credential,t({type:"webhookPatched",webhook:a.webhook}),n(g=>({...g,[c.id]:l})),B(M(),c.id,l)}if(!l)throw new Error("Could not create a terminal command");await navigator.clipboard.writeText(m==="link"?l.url:Q(l)),o(c.id),S(m),setTimeout(()=>o(a=>a===c.id?null:a),1800)}catch(l){k(l instanceof Error?l.message:String(l))}finally{b.current=!1,f(null)}}}}}function Me({bots:t,createRequest:s,onCreateHandled:n}){const{state:d,dispatch:f}=$(),[b,u]=x.useState(null),{credentials:o,setCredentials:y,working:S,copiedId:w,error:k,setError:T,invoke:A,createAndCopyCommand:R}=Te(),[c,p]=x.useState(d.webhooks[0]?.id??null),[m,l]=x.useState("setup");x.useEffect(()=>{d.webhooks.length?(!c||!d.webhooks.some(r=>r.id===c))&&p(d.webhooks[0].id):p(null)},[c,d.webhooks]),x.useEffect(()=>{s>0&&(u("new"),n())},[s,n]);const a=d.webhooks.find(r=>r.id===c)??null,g=a?t.find(r=>r.id===a.botId):void 0,C=x.useMemo(()=>a?Ee(a,d.webhookAttempts,d.routineRuns):[],[a,d.routineRuns,d.webhookAttempts]),E=d.webhookIngress,z=a?o[a.id]:void 0,U=z?Q(z):"";return e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 md:p-6",children:[e.jsxs("div",{className:"mx-auto max-w-[1120px] space-y-4",children:[k&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:k}),E&&!E.available&&e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-danger/25 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-danger"}),"Webhook receiver unavailable",E.error?`: ${E.error}`:"."]}),d.webhooks.length===0?e.jsxs("div",{className:"border-t border-hairline/40 px-6 py-16 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-2xl bg-accent/10 text-accent",children:e.jsx(te,{size:23})}),e.jsx("h3",{className:"text-[16px] font-semibold text-ink",children:"Create your first webhook"}),e.jsx("p",{className:"mx-auto mt-2 max-w-[420px] text-[12.5px] leading-relaxed text-ink-secondary",children:"Choose a MAUS, copy one command, and every request becomes a new task in its chat."}),e.jsxs("button",{onClick:()=>u("new"),disabled:t.length===0,className:"mt-5 inline-flex items-center gap-2 rounded-xl bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[e.jsx(se,{size:15}),"Create webhook"]}),t.length===0&&e.jsx("p",{className:"mt-3 text-[12px] text-warning",children:"Create a MAUS first, then come back here."})]}):a&&e.jsxs("div",{className:"min-h-[580px] overflow-hidden rounded-2xl border border-hairline/45 bg-panel/25 md:grid md:grid-cols-[250px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"border-b border-hairline/40 bg-inset/35 p-2.5 md:border-r md:border-b-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-ink-secondary",children:"Your webhooks"}),e.jsx("span",{className:"text-[10px] tabular-nums text-ink-secondary",children:d.webhooks.length})]}),e.jsx("nav",{className:"flex gap-1 overflow-x-auto md:block md:space-y-1 md:overflow-visible",children:d.webhooks.map(r=>{const i=t.find(P=>P.id===r.botId),v=Ne(r);return e.jsxs("button",{onClick:()=>{p(r.id),l("setup"),T("")},className:N("flex min-w-[210px] items-center gap-2.5 rounded-xl px-2.5 py-2.5 text-left transition-colors md:w-full md:min-w-0",r.id===a.id?"bg-raised text-ink shadow-sm":"text-ink-secondary hover:bg-raised/55 hover:text-ink"),children:[i?e.jsx(D,{bot:i,state:r.enabled?"idle":"sleeping",size:36,animated:!1,label:i.name}):e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(J,{size:16})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[12.5px] font-medium",children:r.name}),e.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:N("size-1.5 rounded-full",v.dot)}),e.jsx("span",{className:v.tone,children:v.label})]})]})]},r.id)})})]}),e.jsxs("section",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 px-5 pt-5 md:px-7 md:pt-6",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[g?e.jsx(D,{bot:g,state:a.enabled?"idle":"sleeping",size:44,animated:!1,label:g.name}):e.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(J,{size:18})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"truncate text-[17px] font-semibold text-ink",children:a.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[10.5px] text-ink-secondary",children:[e.jsx("span",{children:g?.name??"Deleted MAUS"}),e.jsx("span",{children:"·"}),e.jsx("span",{children:a.runOn==="cloud"?"Cloud computer":"This computer"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!a.verificationPending&&e.jsxs("button",{disabled:!!S,onClick:()=>{A(a,"toggle")},className:N("flex items-center gap-1.5 rounded-lg px-3 py-2 text-[11.5px] font-medium",a.enabled?"bg-raised text-ink-secondary hover:text-ink":"bg-accent text-white hover:brightness-110"),children:[a.enabled?e.jsx(ne,{size:13}):e.jsx(F,{size:13}),a.enabled?"Pause":"Enable"]}),e.jsxs("details",{className:"relative",children:[e.jsx("summary",{className:"list-none rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(ae,{size:17})}),e.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-[180px] rounded-xl border border-hairline/50 bg-card p-1.5 shadow-2xl",children:[e.jsx("button",{onClick:()=>u(a),className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-[12px] text-ink hover:bg-raised",children:"Edit settings"}),e.jsxs("button",{onClick:()=>{A(a,"delete")},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-[12px] text-danger hover:bg-danger/10",children:[e.jsx(ie,{size:13}),"Delete"]})]})]})]})]}),e.jsxs("div",{className:"mt-5 flex gap-5 border-b border-hairline/35 px-5 md:px-7",children:[e.jsx("button",{onClick:()=>l("setup"),className:N("border-b-2 px-0.5 pb-3 text-[12px] font-medium",m==="setup"?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"),children:"Setup"}),e.jsxs("button",{onClick:()=>l("activity"),className:N("flex items-center gap-1.5 border-b-2 px-0.5 pb-3 text-[12px] font-medium",m==="activity"?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"),children:["Activity",C.length>0&&e.jsx("span",{className:"rounded-full bg-raised px-1.5 py-0.5 text-[9px] tabular-nums text-ink-secondary",children:C.length})]})]}),m==="setup"?e.jsx("div",{className:"px-5 py-6 md:px-7",children:e.jsxs("div",{className:"max-w-[720px]",children:[e.jsx("h4",{className:"text-[14px] font-semibold text-ink",children:"Send a task"}),e.jsxs("p",{className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary",children:["Copy this command into Terminal and press Return. It starts a real task in ",g?.name??"this MAUS","'s chat; edit the task text for whatever you want done."]}),z?e.jsxs("div",{className:"mt-4 overflow-hidden rounded-xl border border-hairline/45 bg-inset",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/45 px-3.5 py-2",children:[e.jsx("span",{className:"text-[9.5px] font-medium uppercase tracking-wider text-ink-secondary",children:"Terminal"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("button",{onClick:()=>{R(a)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[10.5px] font-medium text-ink-secondary hover:bg-raised hover:text-ink",children:[w===a.id?e.jsx(G,{size:12,className:"text-success"}):e.jsx(re,{size:12}),w===a.id?"Copied":"Copy command"]}),e.jsx("button",{onClick:()=>{R(a,!0)},className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",title:"Rotate private URL",children:e.jsx(V,{size:12})})]})]}),e.jsx("pre",{className:"overflow-x-auto p-4 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-ink-secondary",children:U})]}):e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"max-w-[560px] text-[10.5px] leading-relaxed text-ink-secondary",children:"The private URL is shown once. Generate a replacement to copy your webhook command; any older command for this webhook will stop working."}),e.jsxs("button",{disabled:!!S||!E?.available,onClick:()=>{R(a)},className:"mt-3 flex items-center gap-2 rounded-xl bg-accent px-3.5 py-2.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[S===`${a.id}:command`?e.jsx(Y,{size:14,className:"animate-spin"}):e.jsx(V,{size:14}),"Generate new private URL"]})]}),e.jsxs("div",{className:"mt-3 flex items-start gap-2 text-[10.5px] leading-relaxed text-ink-secondary",children:[e.jsx(Z,{size:12,className:"mt-0.5 shrink-0"}),e.jsx("span",{children:"Keep OpenMausBot open so it can receive requests."})]}),a.verificationSample&&!a.enabled&&e.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3 border-y border-success/20 bg-success/5 px-3.5 py-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] font-medium text-success",children:[e.jsx(G,{size:13}),"Request received"]}),e.jsx("p",{className:"mt-1 max-w-[520px] truncate font-mono text-[10px] text-ink-secondary",children:a.verificationSample.preview||"Empty payload"})]}),e.jsxs("button",{disabled:!!S,onClick:()=>{A(a,"toggle")},className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[11px] font-medium text-white hover:brightness-110",children:[e.jsx(F,{size:12}),"Turn on"]})]}),e.jsx("div",{className:"mt-7 border-t border-hairline/35 pt-5",children:e.jsxs("div",{className:"grid gap-4 text-[11.5px] sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-ink-secondary",children:"Tasks go to"}),e.jsx("div",{className:"mt-1.5 font-medium text-ink",children:g?.name??"Deleted MAUS"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-ink-secondary",children:"Runs on"}),e.jsx("div",{className:"mt-1.5 font-medium text-ink",children:a.runOn==="cloud"?"Cloud computer":"This computer"})]})]})}),e.jsxs("details",{className:"group mt-5 border-t border-hairline/35 pt-4",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between text-[11.5px] font-medium text-ink",children:[e.jsx("span",{children:"Advanced"}),e.jsx(oe,{size:14,className:"text-ink-secondary transition-transform group-open:rotate-180"})]}),e.jsxs("div",{className:"mt-4 space-y-3 text-[10.5px] leading-relaxed text-ink-secondary",children:[a.prompt?e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:"Default instruction:"})," ",a.prompt]}):e.jsx("p",{children:"The task or message sent with each request becomes the MAUS instruction."}),a.eventTypes?.length?e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:"Accepted events:"})," ",a.eventTypes.join(", ")]}):e.jsx("p",{children:"All event types are accepted."}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-ink",children:"Unfinished tasks at once:"})," ",a.maxPendingRuns??W,". More requests get HTTP 429 until one finishes."]}),e.jsx("button",{onClick:()=>u(a),className:"rounded-lg border border-hairline/50 px-3 py-2 text-[11px] font-medium text-ink hover:bg-raised",children:"Edit settings"})]})]})]})}):e.jsxs("div",{className:"px-5 py-5 md:px-7",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h4",{className:"text-[13px] font-semibold text-ink",children:"Recent deliveries"}),e.jsx("p",{className:"mt-1 text-[10.5px] text-ink-secondary",children:"Accepted and rejected requests update automatically."})]}),e.jsx("div",{className:"border-t border-hairline/35",children:C.length===0?e.jsx("div",{className:"px-2 py-12 text-center text-[11.5px] text-ink-secondary",children:"No requests yet. Use the command in Setup to send one."}):C.map(r=>e.jsxs("div",{className:"flex items-center gap-2.5 border-b border-hairline/25 px-1 py-3.5",children:[e.jsx("span",{className:N("size-2 shrink-0 rounded-full",r.outcome==="rejected"||r.run?.status==="failed"?"bg-danger":r.run&&["queued","running","waiting"].includes(r.run.status)?"animate-pulse bg-accent":r.outcome==="ignored"||r.outcome==="duplicate"?"bg-ink-secondary/50":"bg-success")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11.5px]",children:[e.jsx("span",{className:"truncate font-medium text-ink",children:r.eventName}),e.jsxs("span",{className:"shrink-0 text-ink-secondary",children:["· ",je(r.at)]})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] text-ink-tertiary",children:r.reason||r.preview||"Empty payload"})]}),e.jsx("span",{className:N("shrink-0 text-[10px] font-medium",we(r.outcome,r.run)),children:Se(r.outcome,r.run)}),r.run?.threadId&&g&&e.jsxs("button",{onClick:()=>{f({type:"select",id:g.id}),f({type:"switchTask",botId:g.id,threadId:r.run.threadId})},className:"flex shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-[10.5px] text-ink-secondary hover:bg-raised hover:text-ink",title:"Open this execution in the MAUS chat",children:[e.jsx(de,{size:11}),"Open chat"]})]},r.id))})]})]})]})]}),b&&e.jsx(Ce,{webhook:b==="new"?void 0:b,bots:t,onClose:()=>u(null),onCredential:(r,i)=>{B(M(),i,r),y(v=>({...v,[i]:r})),p(i),l("setup")}})]})}export{V as R,Ce as W,je as a,fe as b,W as c,we as d,ye as e,X as f,me as g,he as h,Re as i,ze as j,Me as k,Se as o,Pe as r,Ne as s,Q as t,Te as u,Ee as w};
@@ -1 +0,0 @@
1
- const e=Object.freeze(JSON.parse('{"displayName":"ABAP","fileTypes":["abap","ABAP"],"foldingStartMarker":"/\\\\*\\\\*|\\\\{\\\\s*$","foldingStopMarker":"\\\\*\\\\*/|^\\\\s*}","name":"abap","patterns":[{"captures":{"1":{"name":"punctuation.definition.comment.abap"}},"match":"^\\\\*.*\\\\n?","name":"comment.line.full.abap"},{"captures":{"1":{"name":"punctuation.definition.comment.abap"}},"match":"\\".*\\\\n?","name":"comment.line.partial.abap"},{"match":"(?<!\\\\S)##.*?(?=([,.:\\\\s]))","name":"comment.line.pragma.abap"},{"match":"(?i)(?<=[-~\\\\s])(?<=[-=]>)([/_a-z][/-9_a-z]*)(?=\\\\s+(?:|[-*+/]|&&?)=\\\\s+)","name":"variable.other.abap"},{"match":"\\\\b[0-9]+(\\\\b|[,.])","name":"constant.numeric.abap"},{"match":"(?i)(^|\\\\s+)((P(?:UBLIC|RIVATE|ROTECTED))\\\\sSECTION)(?=\\\\s+|[.:])","name":"storage.modifier.class.abap"},{"begin":"(?<!\\\\\\\\)(\\\\|)(.*?)","beginCaptures":{"1":{"name":"constant.character.escape.abap"}},"end":"(?<!\\\\\\\\)(\\\\||(\\\\\\\\\\\\\\\\\\\\|))","endCaptures":{"1":{"name":"constant.character.escape.abap"}},"name":"string.interpolated.abap","patterns":[{"match":"(\\\\{ )|( })","name":"constant.character.escape"},{"match":"\\\\\\\\\\\\|","name":"constant.character.escape.abap"},{"match":"(?i)(?<=\\\\s)(align|alpha|case|country|currency|date|decimals|exponent|number|pad|sign|style|time|timestamp|timezone|width|xsd|zero)(?=\\\\s=)","name":"entity.name.property.stringtemplate.abap"},{"match":"(?i)(?<==\\\\s)(center|engineering|environment|in|iso|left|leftplus|leftspace|lower|no|out|raw|right|rightplus|rightspace|scale_preserving|scale_preserving_scientific|scientific|scientific_with_leading_zero|sign_as_postfix|simple|space|upper|user|yes)(?=\\\\s)","name":"entity.value.property.stringtemplate.abap"}]},{"begin":"\'","end":"\'","name":"string.quoted.single.abap","patterns":[{"match":"\'\'","name":"constant.character.escape.abap"}]},{"begin":"`","end":"`","name":"string.quoted.single.abap","patterns":[{"match":"``","name":"constant.character.escape.abap"}]},{"begin":"(?i)^\\\\s*(class)\\\\s([/_a-z][/-9_a-z]*)","beginCaptures":{"1":{"name":"storage.type.block.abap"},"2":{"name":"entity.name.type.block.abap"}},"end":"\\\\s*\\\\.\\\\s*\\\\n?","name":"meta.block.begin.implementation.abap","patterns":[{"match":"(?i)(^|\\\\s+)(definition|implementation|public|inheriting\\\\s+from|final|deferred|abstract|shared\\\\s+memory\\\\s+enabled|(global|local)*\\\\s*friends|(create\\\\s+(p(?:ublic|rotected|rivate)))|for\\\\s+behavior\\\\s+of|for\\\\s+testing|risk\\\\s+level\\\\s+(critical|dangerous|harmless))|duration\\\\s(short|medium|long)(?=\\\\s+|\\\\.)","name":"storage.modifier.class.abap"},{"begin":"(?=[A-Z_a-z][0-9A-Z_a-z]*)","contentName":"entity.name.type.block.abap","end":"(?![0-9A-Z_a-z])","patterns":[{"include":"#generic_names"}]}]},{"begin":"(?i)^\\\\s*(method)\\\\s(?:([/_a-z][/-9_a-z]*)~)?([/_a-z][/-9_a-z]*)","beginCaptures":{"1":{"name":"storage.type.block.abap"},"2":{"name":"entity.name.type.abap"},"3":{"name":"entity.name.function.abap"}},"end":"\\\\s*\\\\.\\\\s*\\\\n?","patterns":[{"match":"(?i)(?<=^|\\\\s)(BY(?:\\\\s+DATABASE(\\\\s+PROCEDURE|\\\\s+FUNCTION|\\\\s+GRAPH\\\\s+WORKSPACE)|\\\\s+KERNEL\\\\s+MODULE))(?=\\\\s+|\\\\.)","name":"storage.modifier.method.abap"},{"match":"(?i)(?<=^|\\\\s)(FOR\\\\s+(HDB|LLANG))(?=\\\\s+|\\\\.)","name":"storage.modifier.method.abap"},{"match":"(?i)(?<=\\\\s)(OPTIONS\\\\s+(READ-ONLY|DETERMINISTIC|SUPPRESS\\\\s+SYNTAX\\\\s+ERRORS))(?=\\\\s+|\\\\.)","name":"storage.modifier.method.abap"},{"match":"(?i)(?<=^|\\\\s)(LANGUAGE\\\\s+(SQLSCRIPT|SQL|GRAPH))(?=\\\\s+|\\\\.)","name":"storage.modifier.method.abap"},{"captures":{"1":{"name":"storage.modifier.method.abap"}},"match":"(?i)(?<=\\\\s)(USING)\\\\s+([/_a-z][/-9=>_a-z]*)+(?=\\\\s+|\\\\.)"},{"begin":"(?=[A-Z_a-z][0-9A-Z_a-z]*)","end":"(?![0-9A-Z_a-z])","patterns":[{"include":"#generic_names"}]}]},{"begin":"(?i)^\\\\s*(INTERFACE)\\\\s([/_a-z][/-9_a-z]*)","beginCaptures":{"1":{"name":"storage.type.block.abap"},"2":{"name":"entity.name.type.abap"}},"end":"\\\\s*\\\\.\\\\s*\\\\n?","patterns":[{"match":"(?i)(?<=^|\\\\s)(DEFERRED|PUBLIC)(?=\\\\s+|\\\\.)","name":"storage.modifier.method.abap"}]},{"begin":"(?i)^\\\\s*(FORM)\\\\s([/_a-z][-/-9?_a-z]*)","beginCaptures":{"1":{"name":"storage.type.block.abap"},"2":{"name":"entity.name.type.abap"}},"end":"\\\\s*\\\\.\\\\s*\\\\n?","patterns":[{"match":"(?i)(?<=^|\\\\s)(USING|TABLES|CHANGING|RAISING|IMPLEMENTATION|DEFINITION)(?=\\\\s+|\\\\.)","name":"storage.modifier.form.abap"},{"include":"#abaptypes"},{"include":"#keywords_followed_by_braces"}]},{"match":"(?i)(end(?:class|method|form|interface))","name":"storage.type.block.end.abap"},{"match":"(?i)(<[A-Z_a-z][0-9A-Z_a-z]*>)","name":"variable.other.field.symbol.abap"},{"include":"#keywords"},{"include":"#abap_constants"},{"include":"#reserved_names"},{"include":"#operators"},{"include":"#builtin_functions"},{"include":"#abaptypes"},{"include":"#system_fields"},{"include":"#sql_functions"},{"include":"#sql_types"}],"repository":{"abap_constants":{"match":"(?i)(?<=\\\\s)(initial|null|@?space|@?abap_true|@?abap_false|@?abap_undefined|table_line|%_final|%_hints|%_predefined|col_background|col_group|col_heading|col_key|col_negative|col_normal|col_positive|col_total|adabas|as400|db2|db6|hdb|oracle|sybase|mssqlnt|pos_low|pos_high)(?=[,.\\\\s])","name":"constant.language.abap"},"abaptypes":{"patterns":[{"match":"(?i)\\\\s(abap_bool|string|xstring|any|clike|csequence|numeric|xsequence|decfloat|decfloat16|decfloat34|utclong|simple|int8|[cdfinptx])(?=[,.\\\\s])","name":"support.type.abap"},{"match":"(?i)\\\\s(TYPE|REF|TO|LIKE|LINE|OF|STRUCTURE|STANDARD|SORTED|HASHED|INDEX|TABLE|WITH|UNIQUE|NON-UNIQUE|SECONDARY|DEFAULT|KEY)(?=[,.\\\\s])","name":"keyword.control.simple.abap"}]},"arithmetic_operator":{"match":"(?i)(?<=\\\\s)([-*+]|\\\\*\\\\*|[%/]|DIV|MOD|BIT-AND|BIT-OR|BIT-XOR|BIT-NOT)(?=\\\\s)","name":"keyword.control.simple.abap"},"builtin_functions":{"match":"(?i)(?<=\\\\s)(abs|sign|ceil|floor|trunc|frac|acos|asin|atan|cos|sin|tan|cosh|sinh|tanh|exp|log|log10|sqrt|strlen|xstrlen|charlen|lines|numofchar|dbmaxlen|round|rescale|nmax|nmin|cmax|cmin|boolc|boolx|xsdbool|contains|contains_any_of|contains_any_not_of|matches|line_exists|ipow|char_off|count|count_any_of|count_any_not_of|distance|condense|concat_lines_of|escape|find|find_end|find_any_of|find_any_not_of|insert|match|repeat|replace|reverse|segment|shift_left|shift_right|substring|substring_after|substring_from|substring_before|substring_to|to_upper|to_lower|to_mixed|from_mixed|translate|bit-set|line_index)(?=\\\\()","name":"entity.name.function.builtin.abap"},"comparison_operator":{"match":"(?i)(?<=\\\\s)([<>]|<=|>=|=|<>|eq|ne|lt|le|gt|ge|cs|cp|co|cn|ca|na|ns|np|byte-co|byte-cn|byte-ca|byte-na|byte-cs|byte-ns|[moz])(?=\\\\s)","name":"keyword.control.simple.abap"},"control_keywords":{"match":"(?i)(^|\\\\s)(at|case|catch|continue|do|elseif|else|endat|endcase|endcatch|enddo|endif|endloop|endon|endtry|endwhile|if|loop|on|raise|try|while)(?=[.:\\\\s])","name":"keyword.control.flow.abap"},"generic_names":{"match":"[A-Z_a-z][0-9A-Z_a-z]*"},"keywords":{"patterns":[{"include":"#main_keywords"},{"include":"#text_symbols"},{"include":"#control_keywords"},{"include":"#keywords_followed_by_braces"}]},"keywords_followed_by_braces":{"captures":{"1":{"name":"keyword.control.simple.abap"},"2":{"name":"variable.other.abap"}},"match":"(?i)\\\\b(data|value|field-symbol|final|reference|resumable)\\\\((<?[/_a-z][/-9_a-z]*>?)\\\\)"},"logical_operator":{"match":"(?i)(?<=\\\\s)(not|or|and)(?=\\\\s)","name":"keyword.control.simple.abap"},"main_keywords":{"match":"(?i)(?<=^|\\\\s)(abap-source|abstract|accept|accepting|access|according|action|activation|actual|add|add-corresponding|adjacent|after|alias|aliases|all|allocate|amdp|analysis|analyzer|append|appending|application|archive|area|arithmetic|as|ascending|assert|assign|assigned|assigning|association|asynchronous|at|attributes|authority|authority-check|authorization|auto|back|background|backward|badi|base|before|begin|behavior|between|binary|bit|blanks??|blocks??|bound|boundaries|bounds|boxed|break|break-point|buffer|by|bypassing|byte|byte-order|call|calling|cast|casting|cds|centered|change|changing|channels|char-to-hex|character|check|checkbox|cid|circular|class|class-data|class-events|class-methods??|class-pool|cleanup|clear|clients??|clock|clone|close|cnt|code|collect|color|column|comments??|commit|common|communication|comparing|components??|compression|compute|concatenate|cond|condense|condition|connection|constants??|contexts??|controls??|conv|conversion|convert|copy|corresponding|count|country|cover|create|currency|current|cursor|customer-function|data|database|datainfo|dataset|date|daylight|ddl|deallocate|decimals|declarations|deep|default|deferred|define|delete|deleting|demand|descending|describe|destination|detail|determine|dialog|did|directory|discarding|display|display-mode|distance|distinct|divide|divide-corresponding|dummy|duplicates??|duration|during|dynpro|edit|editor-call|empty|enabled|enabling|encoding|end|end-enhancement-section|end-of-definition|end-of-page|end-of-selection|end-test-injection|end-test-seam|endenhancement|endexec|endfunction|endian|ending|endmodule|endprovide|endselect|endwith|enhancement|enhancement-point|enhancement-section|enhancements|entities|entity|entries|entry|enum|equiv|errors|escape|escaping|events??|exact|except|exception|exception-table|exceptions|excluding|exec|execute|exists|exit|exit-command|expanding|explicit|exponent|export|exporting|extended|extension|extract|fail|failed|features|fetch|field|field-groups|field-symbols|fields|file|fill|filters??|final|find|first|first-line|fixed-point|flush|following|for|format|forward|found|frames??|free|from|full|function|function-pool|generate|get|giving|graph|groups??|handler??|hashed|having|headers??|heading|help-id|help-request|hide|hint|hold|hotspot|icon|id|identification|identifier|ignore|ignoring|immediately|implemented|implicit|import|importing|in|inactive|incl|includes??|including|increment|index|index-line|indicators|infotypes|inheriting|init|initial|initialization|inner|input|insert|instances??|intensified|interface|interface-pool|interfaces|internal|intervals|into|inverse|inverted-date|is|job|join|keep|keeping|kernel|keys??|keywords|kind|language|last|late|layout|leading|leave|left|left-justified|legacy|length|let|levels??|like|line|line-count|line-selection|line-size|linefeed|lines|link|list|list-processing|listbox|load|load-of-program|locale??|locks??|log-point|logical|lower|mapped|mapping|margin|mark|mask|match|matchcode|maximum|members|memory|mesh|message|message-id|messages|messaging|methods??|mode|modif|modifier|modify|module|move|move-corresponding|multiply|multiply-corresponding|name|nametab|native|nested|nesting|new|new-line|new-page|new-section|next|no-display|no-extension|no-gaps??|no-grouping|no-heading|no-scrolling|no-sign|no-title|no-zero|nodes|non-unicode|non-unique|number|objects??|objmgr|obligatory|occurences??|occurrences??|occurs|of|offset|on|only|open|optional|options??|order|others|out|outer|output|output-length|overflow|overlay|pack|package|padding|page|parameter|parameter-table|parameters|part|partially|pcre|perform|performing|permissions|pf-status|places|pool|position|pragmas|preceding|precompiled|preferred|preserving|primary|print|print-control|private|privileged|procedure|process|program|property|protected|provide|push|pushbutton|put|query|queue-only|queueonly|quickinfo|radiobutton|raising|ranges??|read|read-only|received??|receiving|redefinition|reduce|ref|reference|refresh|regex|reject|renaming|replace|replacement|replacing|report|reported|request|requested|required|reserve|reset|resolution|respecting|response|restore|results??|resumable|resume|retry|return|returning|right|right-justified|rollback|rows|rp-provide-from-last|run|sap|sap-spool|save|saving|scan|screen|scroll|scroll-boundary|scrolling|search|seconds|section|select|select-options|selection|selection-screen|selection-sets??|selection-table|selections|send|separated??|session|set|shared|shift|shortdump|shortdump-id|sign|simple|simulation|single|size|skip|skipping|smart|some|sort|sortable|sorted|source|specified|split|spool|spots|sql|stable|stamp|standard|start-of-selection|starting|state|statements??|statics??|statusinfo|step|step-loop|stop|structures??|style|subkey|submatches|submit|subroutine|subscreen|substring|subtract|subtract-corresponding|suffix|sum|summary|supplied|supply|suppress|switch|symbol|syntax-check|syntax-trace|system-call|system-exceptions|tab|tabbed|tables??|tableview|tabstrip|target|tasks??|test|test-injection|test-seam|testing|text|textpool|then|throw|times??|title|titlebar|to|tokens|top-lines|top-of-page|trace-file|trace-table|trailing|transaction|transfer|transformation|translate|transporting|trmac|truncate|truncation|type|type-pools??|types|uline|unassign|unbounded|under|unicode|union|unique|unit|unix|unpack|until|unwind|up|update|upper|user|user-command|using|utf-8|uuid|valid|validate|value|value-request|values|vary|varying|version|via|visible|wait|when|where|windows??|with|with-heading|with-title|without|word|work|workspace|write|xml|zone)(?=[,.:\\\\s])","name":"keyword.control.simple.abap"},"operators":{"patterns":[{"include":"#other_operator"},{"include":"#arithmetic_operator"},{"include":"#comparison_operator"},{"include":"#logical_operator"}]},"other_operator":{"match":"(?<=\\\\s)(&&?|\\\\?=|\\\\+=|-=|/=|\\\\*=|&&=|&=)(?=\\\\s)","name":"keyword.control.simple.abap"},"reserved_names":{"match":"(?i)(?<=\\\\s)(me|super)(?=[,.\\\\s]|->)","name":"constant.language.abap"},"sql_functions":{"match":"(?i)(?<=\\\\s)(abap_system_timezone|abap_user_timezone|abs|add_days|add_months|allow_precision_loss|as_geo_json|avg|bintohex|cast|ceil|coalesce|concat_with_space|concat|corr_spearman|corr|count|currency_conversion|datn_add_days|datn_add_months|datn_days_between|dats_add_days|dats_add_months|dats_days_between|dats_from_datn|dats_is_valid|dats_tims_to_tstmp|dats_to_datn|dayname|days_between|dense_rank|division|div|extract_day|extract_hour|extract_minute|extract_month|extract_second|extract_year|first_value|floor|grouping|hextobin|initcap|instr|is_valid|lag|last_value|lead|left|length|like_regexpr|locate_regexpr_after|locate_regexpr|locate|lower|lpad|ltrim|max|median|min|mod|monthname|ntile|occurrences_regexpr|over|product|rank|replace_regexpr|replace|rigth|round|row_number|rpad|rtrim|stddev|string_agg|substring_regexpr|substring|sum|tims_from_timn|tims_is_valid|tims_to_timn|to_blob|to_clob|tstmp_add_seconds|tstmp_current_utctimestamp|tstmp_is_valid|tstmp_seconds_between|tstmp_to_dats|tstmp_to_dst|tstmp_to_tims|tstmpl_from_utcl|tstmpl_to_utcl|unit_conversion|upper|utcl_add_seconds|utcl_current|utcl_seconds_between|uuid|var|weekday)(?=\\\\()","name":"entity.name.function.sql.abap"},"sql_types":{"match":"(?i)(?<=\\\\s)(char|clnt|cuky|curr|datn|dats|dec|decfloat16|decfloat34|fltp|int1|int2|int4|int8|lang|numc|quan|raw|sstring|timn|tims|unit|utclong)(?=[()\\\\s])","name":"entity.name.type.sql.abap"},"system_fields":{"captures":{"1":{"name":"variable.language.abap"},"2":{"name":"variable.language.abap"}},"match":"(?i)\\\\b(sy)-(abcde|batch|binpt|calld|callr|colno|cpage|cprog|cucol|curow|datar|datlo|datum|dayst|dbcnt|dbnam|dbsysc|dyngr|dynnr|fdayw|fdpos|host|index|langu|ldbpg|lilli|linct|linno|linsz|lisel|listi|loopc|lsind|macol|mandt|marow|modno|msgid|msgli|msgno|msgty|msgv[1-4]|opsysc|pagno|pfkey|repid|saprl|scols|slset|spono|srows|staco|staro|stepl|subrc|sysid|tabix|tcode|tfill|timlo|title|tleng|tvar[0-9]|tzone|ucomm|uline|uname|uzeit|vline|wtitl|zonlo)(?=[.\\\\s])"},"text_symbols":{"captures":{"1":{"name":"keyword.control.simple.abap"},"2":{"name":"constant.numeric.abap"}},"match":"(?i)(?<=^|\\\\s)(text)-([0-9A-Z]{1,3})(?=[,.:\\\\s])"}},"scopeName":"source.abap"}')),a=[e];export{a as default};
@@ -1 +0,0 @@
1
- const e=Object.freeze(JSON.parse(`{"displayName":"ActionScript","fileTypes":["as"],"name":"actionscript-3","patterns":[{"include":"#comments"},{"include":"#package"},{"include":"#class"},{"include":"#interface"},{"include":"#namespace_declaration"},{"include":"#import"},{"include":"#mxml"},{"include":"#strings"},{"include":"#regexp"},{"include":"#variable_declaration"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#other_operators"},{"include":"#arithmetic_operators"},{"include":"#logical_operators"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#control_keywords"},{"include":"#other_keywords"},{"include":"#use_namespace"},{"include":"#functions"},{"include":"#primitive_functions"},{"include":"#function_call"}],"repository":{"arithmetic_operators":{"match":"([-%+/]|(?<!:)\\\\*)","name":"keyword.operator.actionscript.3"},"array_access_operators":{"match":"([]\\\\[])","name":"keyword.operator.actionscript.3"},"class":{"begin":"(^|\\\\s+|;)(\\\\b(dynamic|final|abstract)\\\\b\\\\s+)?(\\\\b(internal|public)\\\\b\\\\s+)?(\\\\b(dynamic|final|abstract)\\\\b\\\\s+)?(?=\\\\bclass\\\\b)","beginCaptures":{"3":{"name":"storage.modifier.actionscript.3"},"5":{"name":"storage.modifier.actionscript.3"},"7":{"name":"storage.modifier.actionscript.3"}},"end":"}","name":"meta.class.actionscript.3","patterns":[{"include":"#class_declaration"},{"include":"#declaration_code_block"},{"include":"#metadata"},{"include":"#method"},{"include":"#comments"},{"include":"#strings"},{"include":"#regexp"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#other_operators"},{"include":"#other_keywords"},{"include":"#use_namespace"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#arithmetic_operators"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#variable_declaration"},{"include":"#object_literal"},{"include":"#conditional_compilation"},{"include":"#primitive_functions"},{"include":"#function_call"}]},"class_declaration":{"begin":"\\\\b(class)\\\\b\\\\s+([$.0-9A-Z_a-z]+|\\\\*)","beginCaptures":{"1":{"name":"storage.type.class.actionscript.3"},"2":{"name":"entity.name.class.actionscript.3"}},"end":"\\\\{","name":"meta.class_declaration.actionscript.3","patterns":[{"include":"#extends"},{"include":"#implements"},{"include":"#comments"}]},"comments":{"patterns":[{"begin":"/\\\\*\\\\*(?!/)","end":"\\\\*/","name":"comment.block.documentation.actionscript.3","patterns":[{"match":"@(copy|default|eventType|example|exampleText|includeExample|inheritDoc|internal|param|private|return|see|since|throws)\\\\b","name":"keyword.other.documentation.actionscript.3.asdoc"}]},{"begin":"/\\\\*","end":"\\\\*/","name":"comment.block.actionscript.3"},{"match":"//.*","name":"comment.line.actionscript.3"}]},"conditional_compilation":{"captures":{"2":{"name":"constant.other.actionscript.3"},"3":{"name":"constant.other.actionscript.3"}},"match":"(^|\\\\s+|;)\\\\b(\\\\w+)\\\\b::\\\\b(\\\\w+)\\\\b","name":"meta.conditional.actionscript.3"},"control_keywords":{"match":"\\\\b(if|else|do|while|for|each|continue|return|switch|case|default|break|try|catch|finally|throw|with)\\\\b","name":"keyword.control.actionscript.3"},"declaration_code_block":{"begin":"\\\\{","end":"}","name":"meta.code_block.actionscript.3","patterns":[{"include":"#method"},{"include":"#variable_declaration"},{"include":"#comments"},{"include":"#strings"},{"include":"#regexp"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#other_operators"},{"include":"#arithmetic_operators"},{"include":"#logical_operators"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#control_keywords"},{"include":"#other_keywords"},{"include":"#use_namespace"},{"include":"#functions"},{"include":"#import"},{"include":"#primitive_functions"},{"include":"#function_call"}]},"dynamic_type":{"captures":{"1":{"name":"support.type.actionscript.3"}},"match":"(?<=:)\\\\s*(\\\\*)"},"escapes":{"match":"\\\\\\\\(x\\\\h{2}|[012][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)","name":"constant.character.escape.actionscript.3"},"extends":{"captures":{"1":{"name":"keyword.other.actionscript.3"},"2":{"name":"entity.other.inherited-class.actionscript.3"},"3":{"name":"entity.other.inherited-class.actionscript.3"}},"match":"\\\\b(extends)\\\\b\\\\s+([$.0-9A-Z_a-z]+)\\\\s*(?:,\\\\s*([$.0-9A-Z_a-z]+))*\\\\s*","name":"meta.extends.actionscript.3"},"function_arguments":{"begin":"\\\\(","end":"\\\\)","name":"meta.function_arguments.actionscript.3","patterns":[{"include":"#parameters"},{"include":"#comments"}]},"function_call":{"captures":{"1":{"name":"entity.name.function.actionscript.3"}},"match":"\\\\b([$0-9A-Z_a-z]+)(?=\\\\s*\\\\()"},"functions":{"begin":"\\\\b(function)\\\\b(?:\\\\s+\\\\b([gs]et)\\\\b\\\\s+)?\\\\s*([$0-9A-Z_a-z]+\\\\b)?","beginCaptures":{"1":{"name":"storage.type.function.actionscript.3"},"2":{"name":"storage.modifier.actionscript.3"},"3":{"name":"entity.name.function.actionscript.3"}},"end":"($|;|(?=\\\\{))","name":"meta.function.actionscript.3","patterns":[{"include":"#function_arguments"},{"include":"#return_type"},{"include":"#comments"}]},"guess_constant":{"captures":{"1":{"name":"constant.other.actionscript.3"}},"match":"\\\\b([$A-Z][0-9A-Z_]+)\\\\b"},"guess_type":{"captures":{"1":{"name":"support.type.actionscript.3"}},"match":"\\\\b((?:[$0-9A-Z_a-z]+\\\\.)*[A-Z][0-9A-Z]*[a-z]+[$0-9A-Z_a-z]*)\\\\b"},"implements":{"captures":{"1":{"name":"keyword.other.actionscript.3"},"2":{"name":"entity.other.inherited-class.actionscript.3"},"3":{"name":"entity.other.inherited-class.actionscript.3"}},"match":"\\\\b(implements)\\\\b\\\\s+([$.0-9A-Z_a-z]+)\\\\s*(?:,\\\\s*([$.0-9A-Z_a-z]+))*\\\\s*","name":"meta.implements.actionscript.3"},"import":{"captures":{"2":{"name":"keyword.control.import.actionscript.3"},"3":{"name":"support.type.actionscript.3"}},"match":"(^|\\\\s+|;)\\\\b(import)\\\\b\\\\s+([$.0-9A-Z_a-z]+(?:\\\\.\\\\*)?)\\\\s*(?=;|$)","name":"meta.import.actionscript.3"},"interface":{"begin":"(^|\\\\s+|;)(\\\\b(internal|public)\\\\b\\\\s+)?(?=\\\\binterface\\\\b)","beginCaptures":{"3":{"name":"storage.modifier.actionscript.3"}},"end":"}","name":"meta.interface.actionscript.3","patterns":[{"include":"#interface_declaration"},{"include":"#metadata"},{"include":"#functions"},{"include":"#comments"}]},"interface_declaration":{"begin":"\\\\b(interface)\\\\b\\\\s+([$.0-9A-Z_a-z]+)","beginCaptures":{"1":{"name":"storage.type.interface.actionscript.3"},"2":{"name":"entity.name.class.actionscript.3"}},"end":"\\\\{","name":"meta.class_declaration.actionscript.3","patterns":[{"include":"#extends"},{"include":"#comments"}]},"language_constants":{"match":"\\\\b(true|false|null|Infinity|-Infinity|NaN|undefined)\\\\b","name":"constant.language.actionscript.3"},"language_variables":{"match":"\\\\b(super|this|arguments)\\\\b","name":"variable.language.actionscript.3"},"local_code_block":{"begin":"\\\\{","end":"}","name":"meta.code_block.actionscript.3","patterns":[{"include":"#local_code_block"},{"include":"#comments"},{"include":"#strings"},{"include":"#regexp"},{"include":"#variable_declaration"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#other_operators"},{"include":"#arithmetic_operators"},{"include":"#logical_operators"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#control_keywords"},{"include":"#other_keywords"},{"include":"#use_namespace"},{"include":"#functions"},{"include":"#import"},{"include":"#primitive_functions"},{"include":"#function_call"}]},"logical_operators":{"match":"([!\\\\&<>?^|~])","name":"keyword.operator.actionscript.3"},"metadata":{"begin":"(?<=(?:^|[;{}]|\\\\*/)\\\\s*)\\\\[\\\\s*\\\\b([$A-Z_a-z][$0-9A-Z_a-z]+)\\\\b","beginCaptures":{"1":{"name":"keyword.other.actionscript.3"}},"end":"]","name":"meta.metadata_info.actionscript.3","patterns":[{"include":"#metadata_info"}]},"metadata_info":{"begin":"\\\\(","end":"\\\\)","patterns":[{"include":"#strings"},{"captures":{"1":{"name":"variable.parameter.actionscript.3"},"2":{"name":"keyword.operator.actionscript.3"}},"match":"(\\\\w+)\\\\s*(=)"}]},"method":{"begin":"(^|\\\\s+)((\\\\w+)\\\\s+)?((\\\\w+)\\\\s+)?((\\\\w+)\\\\s+)?((\\\\w+)\\\\s+)?(?=\\\\bfunction\\\\b)","beginCaptures":{"3":{"name":"storage.modifier.actionscript.3"},"5":{"name":"storage.modifier.actionscript.3"},"7":{"name":"storage.modifier.actionscript.3"},"8":{"name":"storage.modifier.actionscript.3"}},"end":"(?<=([;}]))","name":"meta.method.actionscript.3","patterns":[{"include":"#functions"},{"include":"#local_code_block"}]},"mxml":{"begin":"<!\\\\[CDATA\\\\[","end":"]]>","name":"meta.cdata.actionscript.3","patterns":[{"include":"#comments"},{"include":"#import"},{"include":"#metadata"},{"include":"#class"},{"include":"#namespace_declaration"},{"include":"#use_namespace"},{"include":"#class_declaration"},{"include":"#method"},{"include":"#comments"},{"include":"#strings"},{"include":"#regexp"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#other_keywords"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#other_operators"},{"include":"#arithmetic_operators"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#variable_declaration"},{"include":"#primitive_functions"},{"include":"#function_call"}]},"namespace_declaration":{"captures":{"2":{"name":"storage.modifier.actionscript.3"},"3":{"name":"storage.modifier.actionscript.3"}},"match":"((\\\\w+)\\\\s+)?(namespace)\\\\s+[$0-9A-Z_a-z]+","name":"meta.namespace_declaration.actionscript.3"},"numbers":{"match":"\\\\b((0([Xx])\\\\h*)|(([0-9]+\\\\.?[0-9]*)|(\\\\.[0-9]+))(([Ee])([-+])?[0-9]+)?)([Ll]|UL|ul|[FUfu])?\\\\b","name":"constant.numeric.actionscript.3"},"object_literal":{"begin":"\\\\{","end":"}","name":"meta.object_literal.actionscript.3","patterns":[{"include":"#object_literal"},{"include":"#comments"},{"include":"#strings"},{"include":"#regexp"},{"include":"#numbers"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#language_constants"},{"include":"#language_variables"},{"include":"#guess_type"},{"include":"#guess_constant"},{"include":"#array_access_operators"},{"include":"#vector_creation_operators"},{"include":"#functions"},{"include":"#primitive_functions"},{"include":"#function_call"}]},"other_keywords":{"match":"\\\\b(as|delete|in|instanceof|is|native|new|to|typeof)\\\\b","name":"keyword.other.actionscript.3"},"other_operators":{"match":"([.=])","name":"keyword.operator.actionscript.3"},"package":{"begin":"(^|\\\\s+)(package)\\\\b","beginCaptures":{"2":{"name":"keyword.other.actionscript.3"}},"end":"}","name":"meta.package.actionscript.3","patterns":[{"include":"#package_name"},{"include":"#variable_declaration"},{"include":"#method"},{"include":"#comments"},{"include":"#return_type"},{"include":"#import"},{"include":"#use_namespace"},{"include":"#strings"},{"include":"#numbers"},{"include":"#language_constants"},{"include":"#metadata"},{"include":"#class"},{"include":"#interface"},{"include":"#namespace_declaration"}]},"package_name":{"begin":"(?<=package)\\\\s+([._\\\\w]*)\\\\b","end":"\\\\{","name":"meta.package_name.actionscript.3"},"parameters":{"begin":"(\\\\.\\\\.\\\\.)?\\\\s*([$A-Z_a-z][$0-9A-Z_a-z]*)(?:\\\\s*(:)\\\\s*(?:([$A-Za-z][$0-9A-Z_a-z]+(?:\\\\.[$A-Za-z][$0-9A-Z_a-z]+)*)(?:\\\\.<([$A-Za-z][$0-9A-Z_a-z]+(?:\\\\.[$A-Za-z][$0-9A-Z_a-z]+)*)>)?|(\\\\*)))?(?:\\\\s*(=))?","beginCaptures":{"1":{"name":"keyword.operator.actionscript.3"},"2":{"name":"variable.parameter.actionscript.3"},"3":{"name":"keyword.operator.actionscript.3"},"4":{"name":"support.type.actionscript.3"},"5":{"name":"support.type.actionscript.3"},"6":{"name":"support.type.actionscript.3"},"7":{"name":"keyword.operator.actionscript.3"}},"end":",|(?=\\\\))","patterns":[{"include":"#strings"},{"include":"#numbers"},{"include":"#language_constants"},{"include":"#comments"},{"include":"#primitive_types"},{"include":"#primitive_error_types"},{"include":"#dynamic_type"},{"include":"#guess_type"},{"include":"#guess_constant"}]},"primitive_error_types":{"captures":{"1":{"name":"support.class.error.actionscript.3"}},"match":"\\\\b((Argument|Definition|Eval|Internal|Range|Reference|Security|Syntax|Type|URI|Verify)?Error)\\\\b"},"primitive_functions":{"captures":{"1":{"name":"support.function.actionscript.3"}},"match":"\\\\b(decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|isFinite|isNaN|isXMLName|parseFloat|parseInt|trace|unescape)(?=\\\\s*\\\\()"},"primitive_types":{"captures":{"1":{"name":"support.class.builtin.actionscript.3"}},"match":"\\\\b(Array|Boolean|Class|Date|Function|int|JSON|Math|Namespace|Number|Object|QName|RegExp|String|uint|Vector|XML|XMLList|\\\\*(?<=a))\\\\b"},"regexp":{"begin":"(?<=[(,:=\\\\[]|^|return|&&|\\\\|\\\\||!)\\\\s*(/)(?![*+/?{}])","end":"$|(/)[gim]*","name":"string.regex.actionscript.3","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.actionscript.3"},{"match":"\\\\[(\\\\\\\\]|[^]])*]","name":"constant.character.class.actionscript.3"}]},"return_type":{"captures":{"1":{"name":"keyword.operator.actionscript.3"},"2":{"name":"support.type.actionscript.3"},"3":{"name":"support.type.actionscript.3"},"4":{"name":"support.type.actionscript.3"}},"match":"(:)\\\\s*([$A-Za-z][$0-9A-Z_a-z]+(?:\\\\.[$A-Za-z][$0-9A-Z_a-z]+)*)(?:\\\\.<([$A-Za-z][$0-9A-Z_a-z]+(?:\\\\.[$A-Za-z][$0-9A-Z_a-z]+)*)>)?|(\\\\*)"},"strings":{"patterns":[{"begin":"@\\"","end":"\\"","name":"string.quoted.verbatim.actionscript.3"},{"begin":"\\"","end":"\\"","name":"string.quoted.double.actionscript.3","patterns":[{"include":"#escapes"}]},{"begin":"'","end":"'","name":"string.quoted.single.actionscript.3","patterns":[{"include":"#escapes"}]}]},"use_namespace":{"captures":{"2":{"name":"keyword.other.actionscript.3"},"3":{"name":"keyword.other.actionscript.3"},"4":{"name":"storage.modifier.actionscript.3"}},"match":"(^|\\\\s+|;)(use\\\\s+)?(namespace)\\\\s+(\\\\w+)\\\\s*(;|$)"},"variable_declaration":{"captures":{"2":{"name":"storage.modifier.actionscript.3"},"4":{"name":"storage.modifier.actionscript.3"},"6":{"name":"storage.modifier.actionscript.3"},"7":{"name":"storage.modifier.actionscript.3"},"8":{"name":"keyword.operator.actionscript.3"}},"match":"((static)\\\\s+)?((\\\\w+)\\\\s+)?((static)\\\\s+)?(const|var)\\\\s+[$0-9A-Z_a-z]+(?:\\\\s*(:))?","name":"meta.variable_declaration.actionscript.3"},"vector_creation_operators":{"match":"([<>])","name":"keyword.operator.actionscript.3"}},"scopeName":"source.actionscript.3","aliases":["actionscript","as3"]}`)),t=[e];export{t as default};