@xopcai/xopc 0.0.270 → 0.0.273

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 (255) hide show
  1. package/README.md +1 -5
  2. package/README.zh-CN.md +1 -5
  3. package/dist/browser-ext/dist/assets/{auth-cwEj8rFb.js → auth-DkwOUI6_.js} +132 -33
  4. package/dist/browser-ext/dist/background.js +2 -2
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +46 -32
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/gateway/static/root/assets/{activity-store-D_0FmdRj.js → activity-store-cF7IX2RP.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-IZvEXak_.js → agent-avatar-dicebear-BrgxX8nG.js} +1 -1
  11. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DvhuRCLA.js +1 -0
  12. package/dist/gateway/static/root/assets/agents-C0By2FIo.js +1 -0
  13. package/dist/gateway/static/root/assets/{api-O3TTQ4qN.js → api-CYkdUpkx.js} +1 -1
  14. package/dist/gateway/static/root/assets/app-link-BiBXVEvp.js +1 -0
  15. package/dist/gateway/static/root/assets/{app-management-settings-panel-Cqqsbzri.js → app-management-settings-panel-DfoNzWIa.js} +1 -1
  16. package/dist/gateway/static/root/assets/{appearance-settings-DaJyf32s.js → appearance-settings-czbLdCqj.js} +1 -1
  17. package/dist/gateway/static/root/assets/apps-page-BSJXKWcE.js +1 -0
  18. package/dist/gateway/static/root/assets/{archive-plugin-kDPnDTJI.js → archive-plugin-D14P13mX.js} +1 -1
  19. package/dist/gateway/static/root/assets/{attachment-load-CJ3VceKS.js → attachment-load-Dok_B1Gv.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-JwMtU8XB.js → automations-page-DM7ZEewI.js} +1 -1
  21. package/dist/gateway/static/root/assets/automations-workspace--1TsZf3O.js +6 -0
  22. package/dist/gateway/static/root/assets/{binary-plugins-DzyZXLBX.js → binary-plugins-CxNg6InF.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-kTt3gYIJ.js → block-editor-D22VcYnC.js} +3 -3
  24. package/dist/gateway/static/root/assets/{browser-automation-inputs-BKohPYR4.js → browser-automation-inputs-6NWTLEpd.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-automations-page-ktQfFPk-.js → browser-automations-page-BrqySdbW.js} +2 -2
  26. package/dist/gateway/static/root/assets/browser-settings-page-DOHgQer_.js +8 -0
  27. package/dist/gateway/static/root/assets/capabilities-settings-panel-Bpse_5K-.js +8 -0
  28. package/dist/gateway/static/root/assets/channels-settings-yHsY174W.js +1 -0
  29. package/dist/gateway/static/root/assets/{channels-status-swr-DrqzYmDr.js → channels-status-swr-BUZimNmp.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-CIFGGLGa.js → chat-terminal-dock-CZPBNpMI.js} +2 -2
  31. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
  32. package/dist/gateway/static/root/assets/connectors-page-B_wLKGnH.js +2 -0
  33. package/dist/gateway/static/root/assets/cron-expression-C26e13YU.js +2 -0
  34. package/dist/gateway/static/root/assets/date-picker-Da_0QyLe.js +1 -0
  35. package/dist/gateway/static/root/assets/{dependency-picker-D3vNIjRI.js → dependency-picker-D_djqzy7.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-fQwRb_3p.js → desktop-pet-Celmbw-T.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-settings-DfOJ-GvT.js → desktop-pet-settings-CqNNgF45.js} +1 -1
  38. package/dist/gateway/static/root/assets/device-pairing-wizard-B5_w9qlm.js +1 -0
  39. package/dist/gateway/static/root/assets/{extension-debug-page-Cn53jB5-.js → extension-debug-page-ku3kCjvH.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-page-IDpLCxpC.js → extension-page-C7FpHwL4.js} +1 -1
  41. package/dist/gateway/static/root/assets/extension-settings-page-OMj2tU2_.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-config-swr-B7dcmP7Q.js → gateway-config-swr-6eb1vKE1.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-settings-CH-6vkgN.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry-JGhGMhVZ.js → gateway-startup-retry-DUFFCU8H.js} +1 -1
  45. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
  46. package/dist/gateway/static/root/assets/heartbeat-settings-CSFzOACM.js +1 -0
  47. package/dist/gateway/static/root/assets/home-page-BJebAKB-.js +1 -0
  48. package/dist/gateway/static/root/assets/{image-generation-api-BJLX7Qrh.js → image-generation-api-C1cHRBRp.js} +1 -1
  49. package/dist/gateway/static/root/assets/index-C6OWYFtQ.js +74 -0
  50. package/dist/gateway/static/root/assets/index-DKy1Qn1_.css +2 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CBvMTFFx.js → keyboard-shortcuts-settings-BuvD3iv8.js} +1 -1
  52. package/dist/gateway/static/root/assets/local-app-workbench-page-CaC4-THD.js +2 -0
  53. package/dist/gateway/static/root/assets/{local-apps-page-APCMNDvU.js → local-apps-page-DdJ8zwBp.js} +1 -1
  54. package/dist/gateway/static/root/assets/locale-store-BBSCIl4I.js +1 -0
  55. package/dist/gateway/static/root/assets/logs-page-BaR2he0K.js +2 -0
  56. package/dist/gateway/static/root/assets/management-settings-r-iYWZFY.js +1 -0
  57. package/dist/gateway/static/root/assets/markdown-view-c5vtnYe8.js +201 -0
  58. package/dist/gateway/static/root/assets/{media-plugins-C10byeaa.js → media-plugins-D_a6GDY6.js} +1 -1
  59. package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
  60. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
  61. package/dist/gateway/static/root/assets/{messages-D0V_bgRP.js → messages-DjuBdDCn.js} +3 -3
  62. package/dist/gateway/static/root/assets/note-detail-panel-BV6nbgac.js +5 -0
  63. package/dist/gateway/static/root/assets/notes-page-BmLKoWwi.js +8 -0
  64. package/dist/gateway/static/root/assets/{page-tabs-qQ36zncF.js → page-tabs-C7Le9bSI.js} +1 -1
  65. package/dist/gateway/static/root/assets/popover-select-Dz_Qis2R.js +1 -0
  66. package/dist/gateway/static/root/assets/{preview-open-alternatives-BiAJvvCo.js → preview-open-alternatives-B2pOxJBK.js} +1 -1
  67. package/dist/gateway/static/root/assets/{proactive-card-CcNBqHoH.js → proactive-card-BlQ1vCtV.js} +1 -1
  68. package/dist/gateway/static/root/assets/{proactive-page-C3K61jve.js → proactive-page-CghKTfYa.js} +1 -1
  69. package/dist/gateway/static/root/assets/{product-open-page-CunnDP4w.js → product-open-page-DpjiHgwu.js} +1 -1
  70. package/dist/gateway/static/root/assets/project-detail-page-CV8Lh296.js +1 -0
  71. package/dist/gateway/static/root/assets/projects-page-COweOaJP.js +1 -0
  72. package/dist/gateway/static/root/assets/{registry-api-0JSegbNl.js → registry-api-CyQ4k1Ux.js} +1 -1
  73. package/dist/gateway/static/root/assets/remote-access-hub-ChPPGVU5.js +1 -0
  74. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bu_mwBTr.js → runtime-tools-settings-panel-Bl4ArLHf.js} +2 -2
  75. package/dist/gateway/static/root/assets/{schema-form-BE0sgZyz.js → schema-form-KQFmfWd4.js} +1 -1
  76. package/dist/gateway/static/root/assets/sessions-page-DgmHibOK.js +1 -0
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-DV7kMco2.js +1 -0
  78. package/dist/gateway/static/root/assets/{settings-form-section-CBo517lV.js → settings-form-section-Dbnls9ty.js} +1 -1
  79. package/dist/gateway/static/root/assets/{settings-page-DBPimx93.js → settings-page-CDKirYRG.js} +1 -1
  80. package/dist/gateway/static/root/assets/setup-status-panel-SQmtWoOs.js +1 -0
  81. package/dist/gateway/static/root/assets/{share-preview-page-DdV75VTe.js → share-preview-page-DwgLjS1m.js} +1 -1
  82. package/dist/gateway/static/root/assets/shares-settings-Cs5bUrYw.js +1 -0
  83. package/dist/gateway/static/root/assets/skill-reload-api-DyKrjq7F.js +1 -0
  84. package/dist/gateway/static/root/assets/{skills-page-Cn_-nvRo.js → skills-page-Bd0_ED_p.js} +1 -1
  85. package/dist/gateway/static/root/assets/skills-page.utils-rA-XT-YG.js +1 -0
  86. package/dist/gateway/static/root/assets/system-settings-panel-CSkMrHLz.js +1 -0
  87. package/dist/gateway/static/root/assets/task-detail-page-CEQU-L_G.js +1 -0
  88. package/dist/gateway/static/root/assets/{theme-store-1wryLgBQ.js → theme-store-DWpIEWen.js} +1 -1
  89. package/dist/gateway/static/root/assets/tunnel-api-COJcGnEi.js +1 -0
  90. package/dist/gateway/static/root/assets/{use-autosave-N_lm4FdD.js → use-autosave-DkQAIAuB.js} +1 -1
  91. package/dist/gateway/static/root/assets/user-model-page-BQAU55lf.js +2 -0
  92. package/dist/gateway/static/root/assets/{voice-api-key-field-DMsyVfri.js → voice-api-key-field-BrqcH0P-.js} +1 -1
  93. package/dist/gateway/static/root/assets/{voice-config-api-QWVmiAp3.js → voice-config-api-BJ95Z3pT.js} +1 -1
  94. package/dist/gateway/static/root/assets/{work-discovery-overlay-BC0vAxp1.js → work-discovery-overlay-vfTWKm13.js} +1 -1
  95. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cz9jQIlP.js → workflow-run-setup-panel-CHdr_ng9.js} +2 -2
  96. package/dist/gateway/static/root/assets/workflows-page-hwRJD7vR.js +6 -0
  97. package/dist/gateway/static/root/index.html +16 -11
  98. package/dist/package.js +1 -1
  99. package/dist/packages/gateway-contract/src/device-pairing.js +2 -1
  100. package/dist/packages/gateway-contract/src/session-identity.js +37 -0
  101. package/dist/src/agent/memory/compaction-chunks.d.ts +18 -0
  102. package/dist/src/agent/memory/compaction-chunks.js +53 -0
  103. package/dist/src/agent/memory/compaction-request.d.ts +12 -0
  104. package/dist/src/agent/memory/compaction-request.js +72 -0
  105. package/dist/src/agent/memory/compaction.d.ts +3 -0
  106. package/dist/src/agent/memory/compaction.js +166 -118
  107. package/dist/src/agent/service.js +1 -0
  108. package/dist/src/browser/native-messaging-host.js +3 -1
  109. package/dist/src/browser/providers/browser-ext-install.d.ts +6 -0
  110. package/dist/src/browser/providers/browser-ext-install.js +16 -1
  111. package/dist/src/cli/bin.js +2 -2
  112. package/dist/src/cli/commands/agent.js +2 -2
  113. package/dist/src/cli/commands/auth.js +1 -1
  114. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  115. package/dist/src/cli/commands/extension-dev.js +1 -1
  116. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  117. package/dist/src/cli/commands/extension.js +1 -1
  118. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  119. package/dist/src/cli/commands/gateway/run-foreground.js +8 -5
  120. package/dist/src/cli/commands/gateway/service.js +4 -3
  121. package/dist/src/cli/commands/gateway/token.js +28 -1
  122. package/dist/src/cli/commands/gateway-ssh-tunnel.js +1 -1
  123. package/dist/src/cli/commands/models.js +2 -2
  124. package/dist/src/cli/commands/onboard.js +1 -1
  125. package/dist/src/cli/commands/platform.js +1 -1
  126. package/dist/src/cli/commands/profile.js +1 -1
  127. package/dist/src/cli/commands/tunnel.js +6 -1
  128. package/dist/src/cli/commands/update.js +1 -1
  129. package/dist/src/cli/extension-cli-register.js +1 -1
  130. package/dist/src/config/index.js +1 -1
  131. package/dist/src/gateway/device-routes.js +4 -3
  132. package/dist/src/gateway/heartbeat/service.js +1 -1
  133. package/dist/src/gateway/hono/app.js +1 -0
  134. package/dist/src/gateway/hono/middleware/auth.d.ts +1 -2
  135. package/dist/src/gateway/hono/middleware/auth.js +49 -31
  136. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +11 -15
  137. package/dist/src/gateway/hono/routes/browser-session.d.ts +3 -0
  138. package/dist/src/gateway/hono/routes/browser-session.js +43 -0
  139. package/dist/src/gateway/hono/routes/browser.js +26 -0
  140. package/dist/src/gateway/hono/routes/devices.js +61 -96
  141. package/dist/src/gateway/hono/routes/exposure.js +3 -7
  142. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  143. package/dist/src/gateway/hono/routes/models.js +60 -1
  144. package/dist/src/gateway/hono/routes/notes.js +3 -7
  145. package/dist/src/gateway/hono/routes/sessions.js +11 -0
  146. package/dist/src/gateway/hono/routes/shares.js +8 -20
  147. package/dist/src/gateway/hono/routes/site-shares.js +4 -8
  148. package/dist/src/gateway/hono/routes/tunnel.js +13 -13
  149. package/dist/src/gateway/image-generation-setup.d.ts +17 -0
  150. package/dist/src/gateway/image-generation-setup.js +30 -21
  151. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  152. package/dist/src/gateway/rate-limit/buckets.js +10 -0
  153. package/dist/src/gateway/run-loop.js +1 -1
  154. package/dist/src/gateway/runtime-config.js +2 -0
  155. package/dist/src/gateway/security/browser-session.d.ts +5 -0
  156. package/dist/src/gateway/security/browser-session.js +45 -0
  157. package/dist/src/gateway/security/gateway-principal.d.ts +1 -0
  158. package/dist/src/gateway/server.js +1 -1
  159. package/dist/src/gateway/service.d.ts +1 -0
  160. package/dist/src/gateway/service.js +11 -1
  161. package/dist/src/heartbeat/index.js +1 -1
  162. package/dist/src/infra/rate-limit/keyed-store.d.ts +3 -0
  163. package/dist/src/infra/rate-limit/keyed-store.js +9 -2
  164. package/dist/src/proactive/policy/service.d.ts +1 -1
  165. package/dist/src/realtime/runtime.d.ts +2 -1
  166. package/dist/src/realtime/runtime.js +9 -3
  167. package/dist/src/realtime/tickets.d.ts +1 -0
  168. package/dist/src/realtime/tickets.js +3 -0
  169. package/dist/src/session/store.d.ts +2 -0
  170. package/dist/src/session/store.js +17 -2
  171. package/dist/src/session/types.d.ts +2 -1
  172. package/dist/src/storage/sqlite/browser-session-repository.d.ts +17 -0
  173. package/dist/src/storage/sqlite/browser-session-repository.js +54 -0
  174. package/dist/src/storage/sqlite/device-pairing-approval.js +3 -4
  175. package/dist/src/storage/sqlite/device-pairing-repository.d.ts +4 -10
  176. package/dist/src/storage/sqlite/device-pairing-repository.js +10 -62
  177. package/dist/src/storage/sqlite/index.d.ts +1 -1
  178. package/dist/src/storage/sqlite/index.js +2 -2
  179. package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +8 -0
  180. package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +40 -0
  181. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  182. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  183. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  184. package/dist/src/storage/sqlite/schema.js +1 -1
  185. package/dist/src/storage/sqlite/session-identity-sql.d.ts +2 -0
  186. package/dist/src/storage/sqlite/session-identity-sql.js +18 -0
  187. package/dist/src/storage/sqlite/session-repository.js +26 -22
  188. package/dist/src/tunnel/auth-policy.d.ts +3 -0
  189. package/dist/src/tunnel/auth-policy.js +8 -0
  190. package/dist/src/tunnel/broker-client.d.ts +5 -15
  191. package/dist/src/tunnel/broker-client.js +37 -49
  192. package/dist/src/tunnel/frpc-binary.d.ts +8 -6
  193. package/dist/src/tunnel/frpc-binary.js +76 -88
  194. package/dist/src/tunnel/frpc-config.d.ts +2 -1
  195. package/dist/src/tunnel/frpc-config.js +29 -12
  196. package/dist/src/tunnel/frpc-release.d.ts +27 -0
  197. package/dist/src/tunnel/frpc-release.js +30 -0
  198. package/dist/src/tunnel/gateway-lifecycle.js +8 -2
  199. package/dist/src/tunnel/index.js +2 -1
  200. package/dist/src/tunnel/registration-proof.d.ts +19 -0
  201. package/dist/src/tunnel/registration-proof.js +37 -0
  202. package/dist/src/tunnel/tunnel-persist.js +3 -1
  203. package/dist/src/tunnel/tunnel-service.d.ts +1 -0
  204. package/dist/src/tunnel/tunnel-service.js +35 -8
  205. package/dist/src/tunnel/tunnel-state.js +11 -5
  206. package/dist/src/tunnel/tunnel-types.d.ts +2 -0
  207. package/dist/src/tunnel/well-known.js +5 -1
  208. package/dist/src/user-context/config.js +2 -2
  209. package/dist/src/utils/logger/redact.js +4 -0
  210. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  211. package/dist/src/voice/realtime/runtime.js +17 -1
  212. package/dist/src/voice/realtime/runtime.types.d.ts +1 -0
  213. package/dist/src/workflows/service/workflow-run-service.js +2 -0
  214. package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
  215. package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
  216. package/package.json +3 -3
  217. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CE3ygr3l.js +0 -1
  218. package/dist/gateway/static/root/assets/agents-DzG2qw-c.js +0 -1
  219. package/dist/gateway/static/root/assets/apps-page-B4lX6yoT.js +0 -1
  220. package/dist/gateway/static/root/assets/automations-workspace-BiNBewg0.js +0 -6
  221. package/dist/gateway/static/root/assets/browser-settings-page-Dgdt5uVL.js +0 -8
  222. package/dist/gateway/static/root/assets/capabilities-settings-panel-BpDW-R9f.js +0 -7
  223. package/dist/gateway/static/root/assets/channels-settings-DU4EQnR0.js +0 -1
  224. package/dist/gateway/static/root/assets/connectors-page-CfJqy284.js +0 -2
  225. package/dist/gateway/static/root/assets/cron-expression-BNwbnrEb.js +0 -2
  226. package/dist/gateway/static/root/assets/date-picker-DKyirU4K.js +0 -1
  227. package/dist/gateway/static/root/assets/extension-settings-page-B1dds2bP.js +0 -1
  228. package/dist/gateway/static/root/assets/gateway-settings-pp9jN0wl.js +0 -1
  229. package/dist/gateway/static/root/assets/heartbeat-settings-B8_zTyev.js +0 -1
  230. package/dist/gateway/static/root/assets/home-page-g1KdAdLb.js +0 -1
  231. package/dist/gateway/static/root/assets/index-1zRt56Zt.css +0 -2
  232. package/dist/gateway/static/root/assets/index-OMnem2nr.js +0 -74
  233. package/dist/gateway/static/root/assets/local-app-workbench-page-bj75v2ZE.js +0 -2
  234. package/dist/gateway/static/root/assets/locale-store-BThkG0W5.js +0 -1
  235. package/dist/gateway/static/root/assets/logs-page-BX7n39zV.js +0 -2
  236. package/dist/gateway/static/root/assets/management-settings-CM62j8ZX.js +0 -1
  237. package/dist/gateway/static/root/assets/markdown-view-BwjpJVPs.js +0 -201
  238. package/dist/gateway/static/root/assets/mobile-pairing-wizard-BCWfwVx3.js +0 -1
  239. package/dist/gateway/static/root/assets/note-detail-panel-koOqb0gX.js +0 -5
  240. package/dist/gateway/static/root/assets/notes-page-BH54rY3B.js +0 -8
  241. package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +0 -1
  242. package/dist/gateway/static/root/assets/project-detail-page-SL2g8MZY.js +0 -1
  243. package/dist/gateway/static/root/assets/projects-page-BtxazT5J.js +0 -1
  244. package/dist/gateway/static/root/assets/remote-access-hub-BSb7b67A.js +0 -1
  245. package/dist/gateway/static/root/assets/sessions-page-ljcS2KVz.js +0 -1
  246. package/dist/gateway/static/root/assets/settings-advanced-gate-CR9Y9LQm.js +0 -1
  247. package/dist/gateway/static/root/assets/setup-status-panel-J3AnooPW.js +0 -1
  248. package/dist/gateway/static/root/assets/shares-settings-AAm4Iwcp.js +0 -1
  249. package/dist/gateway/static/root/assets/skill-reload-api-pRCjP5sm.js +0 -1
  250. package/dist/gateway/static/root/assets/skills-page.utils-CfVAc_lu.js +0 -1
  251. package/dist/gateway/static/root/assets/system-settings-panel-B-pzalp-.js +0 -1
  252. package/dist/gateway/static/root/assets/task-detail-page-CmrLy3PO.js +0 -1
  253. package/dist/gateway/static/root/assets/tunnel-api-Cgpnm2fL.js +0 -1
  254. package/dist/gateway/static/root/assets/user-model-page-u3QLDX6L.js +0 -2
  255. package/dist/gateway/static/root/assets/workflows-page-DA6OOK6X.js +0 -6
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{n as p,r as m,t as h}from"./popover-select-CKBYnT3c.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./loader-circle-CifKLtgG.js";import{t as v}from"./plus-Q2yW6OE7.js";import{t as y}from"./x-B_N4OPjy.js";import{n as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-D0V_bgRP.js";import{a as S,n as C,r as w,s as T}from"./locale-store-BThkG0W5.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-B11EPpor.js";import{n as O,r as k}from"./gateway-config-swr-B7dcmP7Q.js";import{i as A,o as j}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as M}from"./electron-env-DH5wF8X8.js";import{a as N,i as P,n as F,r as I,t as L}from"./dist-DLmwHyAh.js";import{$o as R,B as z,Bo as B,Cn as V,Dc as H,Fo as U,G as W,Go as ee,H as te,Ho as ne,Hs as re,Ic as ie,Io as ae,Jo as oe,Js as G,K as se,Ki as ce,Ko as le,Lo as ue,Ms as K,Pl as de,Po as fe,Ql as pe,Qo as me,R as he,Ro as ge,So as _e,Tc as ve,U as ye,Ul as be,Uo as xe,Vo as Se,W as Ce,Wo as we,Xo as q,Yo as J,Zo as Te,Zs as Ee,as as De,bn as Oe,dc as ke,dl as Ae,es as je,eu as Me,fu as Ne,hc as Pe,ic as Fe,is as Ie,ls as Y,lu as Le,ns as Re,os as ze,pc as Be,qi as Ve,qo as He,rl as Ue,rs as We,sc as Ge,so as Ke,ss as qe,ts as Je,uc as Ye,uu as Xe,vc as Ze,vn as Qe,xn as $e,yn as et,z as tt,zo as nt,zs as rt}from"./index-OMnem2nr.js";import{t as it}from"./page-tabs-qQ36zncF.js";var X=e(t(),1),Z=n(),Q=r();function at(e){let t=(0,Z.c)(57),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,s,c,l,u,d,f;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o){let e=n.capabilities.filter(ot),p=e.slice(0,2),m=Math.max(0,e.length-p.length),h=o.connect,_;t[11]!==n||t[12]!==o?(_=Ce(n,o),t[11]=n,t[12]=o,t[13]=_):_=t[13];let v=_,y=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,b;t[14]!==h||t[15]!==n||t[16]!==i?(b=e=>(0,Q.jsxs)(D,{type:`button`,variant:`primary`,className:E(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,Q.jsx)(ie,{className:`size-4`}),h]}),t[14]=h,t[15]=n,t[16]=i,t[17]=b):b=t[17],s=b,f=`group flex min-h-[8.75rem] flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,c=`flex min-w-0 flex-1 flex-col`;let x;t[18]===n?x=t[19]:(x=(0,Q.jsx)(se,{connector:n}),t[18]=n,t[19]=x);let S;t[20]!==n||t[21]!==a?(S=a?(0,Q.jsx)(`button`,{type:`button`,className:`block max-w-full truncate text-left text-sm font-semibold text-fg hover:underline`,onClick:()=>a(n),children:n.displayName}):(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[20]=n,t[21]=a,t[22]=S):S=t[22];let C;t[23]===y?C=t[24]:(C=y?(0,Q.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:y}):null,t[23]=y,t[24]=C);let w;t[25]!==C||t[26]!==S?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[25]=C,t[26]=S,t[27]=w):w=t[27];let T;t[28]!==w||t[29]!==x?(T=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[x,w]}),t[28]=w,t[29]=x,t[30]=T):T=t[30];let O;t[31]!==r||t[32]!==s?(O=r?null:(0,Q.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 sm:flex`,children:s()}),t[31]=r,t[32]=s,t[33]=O):O=t[33];let k;t[34]!==r||t[35]!==o.connectedBadge?(k=r?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(g,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[34]=r,t[35]=o.connectedBadge,t[36]=k):k=t[36];let A;t[37]!==O||t[38]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],t[40]!==T||t[41]!==A?(l=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,A]}),t[40]=T,t[41]=A,t[42]=l):l=t[42],t[43]===v?u=t[44]:(u=(0,Q.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:v,children:v}),t[43]=v,t[44]=u),d=p.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorCapabilityLabels[e]??e},e)),m>0?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,m]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];let p;t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==d?(p=(0,Q.jsxs)(`div`,{className:c,children:[l,u,d]}),t[45]=c,t[46]=l,t[47]=u,t[48]=d,t[49]=p):p=t[49];let m;t[50]!==r||t[51]!==s?(m=r?null:(0,Q.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:s(`w-full`)}),t[50]=r,t[51]=s,t[52]=m):m=t[52];let h;return t[53]!==f||t[54]!==p||t[55]!==m?(h=(0,Q.jsxs)(`div`,{className:f,children:[p,m]}),t[53]=f,t[54]=p,t[55]=m,t[56]=h):h=t[56],h}function ot(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var st=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function ct(e,t){return t.some(t=>t.connectorId===e.id)}var lt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ut(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:E(`size-10 shrink-0 rounded-xl`,lt)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:E(`h-4 min-w-0 flex-1`,lt)}),(0,Q.jsx)(`div`,{className:E(`h-8 w-[4.5rem] shrink-0 rounded-lg`,lt)})]}),(0,Q.jsx)(`div`,{className:E(`h-3 w-full`,lt)}),(0,Q.jsx)(`div`,{className:E(`h-3 w-[88%]`,lt)})]})]})}),e[1]=n):n=e[1],n}var dt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ft(){let e=(0,Z.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:E(`size-10 shrink-0 rounded-xl`,dt)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,Q.jsx)(`div`,{className:E(`h-4 w-48 max-w-full`,dt)}),(0,Q.jsx)(`div`,{className:E(`h-3 w-72 max-w-full`,dt)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(`div`,{className:E(`h-9 w-20 rounded-lg`,dt)}),(0,Q.jsx)(`div`,{className:E(`h-9 w-20 rounded-lg`,dt)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsx)(`div`,{className:E(`h-8 w-20 rounded-md`,dt)}),(0,Q.jsx)(`div`,{className:E(`h-8 w-24 rounded-md`,dt)}),(0,Q.jsx)(`div`,{className:E(`h-8 w-28 rounded-md`,dt)})]}),(0,Q.jsx)(`div`,{className:E(`mt-3 h-20 rounded-xl`,dt)})]}),e[3]=i):i=e[3],i}var pt=[`understand`,`act`,`reach`];function mt(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function ht(e){return mt(e)[0]??`act`}function gt(e,t){let n=t?ht(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function _t(e,t){return t.connectorCapabilityLabels[e]??e}function vt(e,t){if(e.runtime.type===`mcp`)return W(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`channel`?e.runtime.channelId:e.runtime.type===`nativeTool`?e.runtime.toolsetId:e.runtime.sourceKind;return W(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function yt(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function bt(e){let t=(0,Z.c)(9),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,12).map(xt),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Q.jsxs)(`section`,{children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function xt(e){return(0,Q.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function St({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[a,p]=(0,X.useState)(!1),m=Ce(e,i),[h,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),S=mt(e),C=[...(e.setup.secrets??[]).filter(e=>e.required),...(e.setup.config??[]).filter(e=>e.required)],w=e.capabilities.filter(e=>!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)),T=async()=>{p(!0),x(null);try{v(await oe(e))}catch(e){v(null),x(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,Q.jsx)(f,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(l,{children:[(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(u,{className:E(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(se,{connector:e,size:`lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:e.displayName}),t?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(g,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,Q.jsx)(s,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:m})]})]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Y.focusRingPanel),"aria-label":i.modalClose,children:(0,Q.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,children:[S.length?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorWhyConnect}),(0,Q.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:S.map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.connectorBenefitHeadings[e]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.connectorBenefitHints[e]})]},e))})]}):null,(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsx)(Ae,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.detailPermissions}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:yt(e,i)})]})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.connectorSetupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length?W(i.connectorRequiredInputsCount,{count:String(C.length)}):i.connectorSetupNone})]})]}),(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:i.connectorTechnicalDetails}),(0,Q.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:vt(e,i)})]}),w.length?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:w.map(e=>(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:_t(e,i)},e))}):null,(0,Q.jsxs)(D,{variant:`secondary`,disabled:a,onClick:()=>void T(),children:[a?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(K,{className:`size-4`}),i.connectorPreviewButton]}),b?(0,Q.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b}):null,h?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(bt,{title:i.detailTools,items:h.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Q.jsx)(bt,{title:i.detailResources,items:h.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description}))}),(0,Q.jsx)(bt,{title:i.detailPrompts,items:h.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description}))})]}):null]})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{variant:`secondary`,children:i.modalClose})}),t?null:(0,Q.jsxs)(D,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,Q.jsx)(ie,{className:`size-4`}),i.connect]})]})]})]})})}var Ct=E(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_e);function wt(e){let t=(0,Z.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:a,onSave:p,onClose:m,t:h,mcp:g}=e,v;t[0]===m?v=t[1]:(v=e=>{e||m()},t[0]=m,t[1]=v);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=E(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[3]=x):x=t[3];let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,Q.jsx)(ve,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=S):S=t[4];let C;t[5]===h.runtimeSettingsTitle?C=t[6]:(C=(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:h.runtimeSettingsTitle}),t[5]=h.runtimeSettingsTitle,t[6]=C);let w;t[7]===h.runtimeSettingsHint?w=t[8]:(w=(0,Q.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:h.runtimeSettingsHint}),t[7]=h.runtimeSettingsHint,t[8]=w);let T;t[9]!==C||t[10]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[S,(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[C,w]})]}),t[9]=C,t[10]=w,t[11]=T):T=t[11];let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=E(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Y.focusRingPanel),t[12]=O):O=t[12];let k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=k):k=t[13];let A;t[14]===h.modalClose?A=t[15]:(A=(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:O,"aria-label":h.modalClose,children:k})}),t[14]=h.modalClose,t[15]=A);let j;t[16]!==A||t[17]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[T,A]}),t[16]=A,t[17]=T,t[18]=j):j=t[18];let M;t[19]===g.idleTtlLabel?M=t[20]:(M=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:g.idleTtlLabel}),t[19]=g.idleTtlLabel,t[20]=M);let N;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=E(Ct,`w-40 flex-none`),t[21]=N):N=t[21];let P=r??``,F;t[22]===a?F=t[23]:(F=e=>{let t=e.currentTarget.value.trim();a(t===``?void 0:Number.parseInt(t,10))},t[22]=a,t[23]=F);let I;t[24]!==g.idleTtlPlaceholder||t[25]!==P||t[26]!==F?(I=(0,Q.jsx)(`input`,{type:`number`,min:0,className:N,value:P,placeholder:g.idleTtlPlaceholder,onChange:F}),t[24]=g.idleTtlPlaceholder,t[25]=P,t[26]=F,t[27]=I):I=t[27];let L;t[28]===g.idleTtlHint?L=t[29]:(L=(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:g.idleTtlHint}),t[28]=g.idleTtlHint,t[29]=L);let R;t[30]!==M||t[31]!==I||t[32]!==L?(R=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Q.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[M,I,L]})}),t[30]=M,t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==m||t[35]!==i||t[36]!==h.modalCancel?(z=(0,Q.jsx)(D,{type:`button`,variant:`secondary`,disabled:i,onClick:m,children:h.modalCancel}),t[34]=m,t[35]=i,t[36]=h.modalCancel,t[37]=z):z=t[37];let B;t[38]===p?B=t[39]:(B=()=>void p(),t[38]=p,t[39]=B);let V;t[40]===i?V=t[41]:(V=i?(0,Q.jsx)(_,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=V);let H;t[42]!==g.save||t[43]!==i||t[44]!==B||t[45]!==V?(H=(0,Q.jsxs)(D,{type:`button`,variant:`primary`,disabled:i,onClick:B,children:[V,g.save]}),t[42]=g.save,t[43]=i,t[44]=B,t[45]=V,t[46]=H):H=t[46];let U;t[47]!==z||t[48]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[z,H]}),t[47]=z,t[48]=H,t[49]=U):U=t[49];let W;t[50]!==j||t[51]!==R||t[52]!==U?(W=(0,Q.jsxs)(l,{children:[b,(0,Q.jsxs)(u,{className:x,children:[j,R,U]})]}),t[50]=j,t[51]=R,t[52]=U,t[53]=W):W=t[53];let ee;return t[54]!==n||t[55]!==v||t[56]!==W?(ee=(0,Q.jsx)(f,{open:n,onOpenChange:v,children:W}),t[54]=n,t[55]=v,t[56]=W,t[57]=ee):ee=t[57],ee}var Tt=(0,X.memo)(function(e){let t=(0,Z.c)(12),{value:n,onChange:r,placeholder:i,className:a}=e,o;t[0]===a?o=t[1]:(o=E(`relative flex min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=e=>r(e.currentTarget.value),t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c||t[7]!==n?(l=(0,Q.jsx)(`input`,{type:`search`,"aria-label":i,enterKeyHint:`search`,value:n,onChange:c,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=i,t[6]=c,t[7]=n,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,Q.jsxs)(`label`,{className:o,children:[s,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}),Et=(0,X.memo)(function(e){let t=(0,Z.c)(20),{onBrowseCatalog:n,onAddCustomServer:r,addLabel:i,browseLabel:a,customLabel:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ne,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=c):c=t[1];let l;t[2]===i?l=t[3]:(l=(0,Q.jsx)(V,{asChild:!0,children:(0,Q.jsxs)(D,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[s,i,c]})}),t[2]=i,t[3]=l);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=E(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Y.transition),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(G,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]!==a||t[7]!==n?(f=(0,Q.jsxs)(et,{className:u,onSelect:n,children:[d,a]}),t[6]=a,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=E(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Y.transition),t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(K,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[10]=m):m=t[10];let h;t[11]!==o||t[12]!==r?(h=(0,Q.jsxs)(et,{className:p,onSelect:r,children:[m,o]}),t[11]=o,t[12]=r,t[13]=h):h=t[13];let g;t[14]!==f||t[15]!==h?(g=(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(Qe,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[f,h]})}),t[14]=f,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==g||t[18]!==l?(_=(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:(0,Q.jsxs)($e,{children:[l,g]})}),t[17]=g,t[18]=l,t[19]=_):_=t[19],_}),Dt=/^([^:=]+)[:=](.*)$/;function Ot(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Dt.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function kt(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function At(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function jt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function Mt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||jt(t)&&(r[e]=t);return r}function Nt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function Pt(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function Ft(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=Nt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=Pt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=kt(e.headers);return n&&(t.headers=n),e.transport===`streamable-http`&&e.auth===`oauth`&&(t.auth={type:`oauth`,...e.oauthClientId.trim()?{clientId:e.oauthClientId.trim()}:{}}),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function It(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0,o=t.auth&&typeof t.auth==`object`&&!Array.isArray(t.auth)?t.auth:void 0,s=o?.type===`oauth`?`oauth`:`none`;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:At(a),auth:s,oauthClientId:typeof o?.clientId==`string`?o.clientId:``,connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function Lt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],auth:`none`,oauthClientId:``,connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function Rt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||jt(t)?[]:[It(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function zt(e){return Ft(e)}async function Bt(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=Ft(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await S(w(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),O()}async function Vt(e,t,n=``){let r=await S(w(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!r.payload)throw Error(r.error??`MCP OAuth request failed`);return r.payload}function Ht(e){return Vt(e,`GET`)}function Ut(e){return Vt(e,`POST`,`/start`)}function Wt(e){return Vt(e,`DELETE`)}function Gt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Kt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function qt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function Jt(e,t){let n=await S(w(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=Gt(n.payload.tools),i=Kt(n.payload.resources),a=qt(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function Yt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Xt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function Zt(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function Qt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}function $t(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function en({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),b=$t(e),x=e.transport===`streamable-http`&&e.auth===`oauth`;(0,X.useEffect)(()=>{if(!x){g(null);return}let t=!1,n=async()=>{try{let n=await Ht(e.id.trim());t||(g(n),n.status===`error`&&n.session?.error&&m(n.session.error),n.status===`connected`&&m(null))}catch(e){t||m(e instanceof Error?e.message:String(e))}};n();let r=window.setInterval(()=>{h?.status===`authorizing`&&n()},1e3);return()=>{t=!0,window.clearInterval(r)}},[h?.status,e.id,x]);let S=(0,X.useCallback)(async()=>{y(!0),m(null);let n=z();try{let r=await Ut(e.id.trim());g(r),r.status===`error`&&r.session?.error&&m(r.session.error),r.status===`connected`&&m(null);let i=r.session?.authorizationUrl;i?await tt(i,n)||m(t.oauthOpenFailed):he(n)}catch(e){he(n),m(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e.id,t.oauthOpenFailed]),C=(0,X.useCallback)(async()=>{y(!0),m(null);try{g(await Wt(e.id.trim()))}catch(e){m(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e.id]),w=(0,X.useCallback)(async()=>{o(!0),m(null);try{let t=await Jt(e.id.trim());f({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){m(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),T=(0,X.useCallback)(async()=>{c(!0),m(null);try{await i()}catch(e){m(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`px-4 py-3.5 hover:bg-surface-hover/50`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 text-left`,onClick:r,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]}),x&&h?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:t.oauthStatus[h.status===`not_configured`?`disconnected`:h.status]}):null]}),b?(0,Q.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:b,children:b}):null,p?(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:p}):null,d?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:W(n.customCapabilitySummary,{tools:String(d.toolCount),resources:String(d.resourceCount),prompts:String(d.promptCount)})}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[x&&h?.status!==`connected`?(0,Q.jsxs)(D,{variant:`secondary`,disabled:v,onClick:()=>void S(),children:[v?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(Ue,{className:`size-4`}),h?.status===`authorizing`?t.oauthOpenAuthorization:t.oauthConnect]}):(0,Q.jsxs)(D,{variant:`secondary`,disabled:a,onClick:()=>void w(),children:[a?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(H,{className:`size-4`}),t.testConnection]}),x&&h?.status===`connected`?(0,Q.jsxs)(D,{variant:`ghost`,disabled:v,onClick:()=>void C(),children:[v?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(rt,{className:`size-4`}),t.oauthDisconnect]}):null,(0,Q.jsxs)(D,{variant:`ghost`,disabled:s,onClick:()=>u(!0),children:[s?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(re,{className:`size-4`}),t.removeServer]})]})]}),(0,Q.jsx)(Ve,{open:l,title:n.removeConfirmTitle.replace(`{{name}}`,e.id.trim()||t.cardUntitled),description:n.removeConfirmDescription,confirmLabel:t.removeServer,cancelLabel:n.modalCancel,destructive:!0,onConfirm:()=>{u(!1),T()},onCancel:()=>{s||u(!1)}})]})}function tn(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function nn(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||tn(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
2
- `).toLowerCase().includes(r)}function rn(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function an(e){let t=(0,Z.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:a}=e,[o,s]=(0,X.useState)(``),c;if(t[0]!==o||t[1]!==r||t[2]!==n){let e;t[4]!==o||t[5]!==r?(e=e=>nn(e,o,r),t[4]=o,t[5]=r,t[6]=e):e=t[6],c=n.filter(e),t[0]=o,t[1]=r,t[2]=n,t[3]=c}else c=t[3];let l=c,u;t[7]===o?u=t[8]:(u=o.trim(),t[7]=o,t[8]=u);let d=u.length>0,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=E(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,_e),m=e=>s(e.target.value),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]!==o||t[13]!==i?(h=(0,Q.jsxs)(`div`,{className:`relative`,children:[f,(0,Q.jsx)(`input`,{type:`search`,value:o,placeholder:i,"aria-label":i,className:p,onChange:m})]}),t[12]=o,t[13]=i,t[14]=h):h=t[14];let g;t[15]!==l.length||t[16]!==d||t[17]!==n.length?(g=d?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[l.length,` / `,n.length]}):null,t[15]=l.length,t[16]=d,t[17]=n.length,t[18]=g):g=t[18];let _;t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[h,g]}),t[19]=h,t[20]=g,t[21]=_):_=t[21];let v;t[22]!==l||t[23]!==a||t[24]!==r?(v=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:l.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map((e,t)=>{let n=e.shortName||rn(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,Q.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=l,t[23]=a,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==_||t[27]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[_,v]}),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function on(e){let t=(0,Z.c)(38),{open:n,onOpenChange:r,serverId:i,title:a,subtitle:p,searchPlaceholder:m,searchEmptyLabel:h,emptyLabel:g,closeLabel:_,tools:v,stripPrefix:b}=e,x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(o,{className:E(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,j)}),t[0]=x):x=t[0];let S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=E(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,A,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=S):S=t[1];let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(K,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=C):C=t[2];let w;t[3]===a?w=t[4]:(w=(0,Q.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[C,a]}),t[3]=a,t[4]=w);let T;t[5]!==i||t[6]!==p||t[7]!==v.length?(T=p.replace(`{{serverId}}`,i).replace(`{{count}}`,String(v.length)),t[5]=i,t[6]=p,t[7]=v.length,t[8]=T):T=t[8];let O;t[9]===T?O=t[10]:(O=(0,Q.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[9]=T,t[10]=O);let k;t[11]!==w||t[12]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[w,O]}),t[11]=w,t[12]=O,t[13]=k):k=t[13];let M;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[14]=M):M=t[14];let N;t[15]===_?N=t[16]:(N=(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":_,children:M})}),t[15]=_,t[16]=N);let P;t[17]!==k||t[18]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[k,N]}),t[17]=k,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==g||t[21]!==n||t[22]!==h||t[23]!==m||t[24]!==i||t[25]!==b||t[26]!==v?(F=v.length>0?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(an,{tools:v,stripPrefix:b,searchPlaceholder:m,searchEmptyLabel:h},`${i}-${n?`open`:`closed`}`)}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g})}),t[20]=g,t[21]=n,t[22]=h,t[23]=m,t[24]=i,t[25]=b,t[26]=v,t[27]=F):F=t[27];let I;t[28]===_?I=t[29]:(I=(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{type:`button`,variant:`secondary`,children:_})})}),t[28]=_,t[29]=I);let L;t[30]!==P||t[31]!==F||t[32]!==I?(L=(0,Q.jsxs)(l,{children:[x,(0,Q.jsxs)(u,{className:S,children:[P,F,I]})]}),t[30]=P,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==r||t[35]!==n||t[36]!==L?(R=(0,Q.jsx)(f,{open:n,onOpenChange:r,children:L}),t[34]=r,t[35]=n,t[36]=L,t[37]=R):R=t[37],R}function sn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function cn(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?e.isDefault===t.isDefault?sn(t)-sn(e):e.isDefault?-1:1:e.isCurrentAuthorization?-1:1}function ln(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(cn);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>cn(e.primary,t.primary))}var un=E(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_e);function dn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function fn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function pn(e,t,n){return e.status===`connected`?W(n.composioHealthConnected,{count:String(t)}):e.status===`reauthorization_required`?n.composioHealthReconnect:e.status===`disconnected`?n.composioHealthDisconnected:e.errorCode===`missing_credential`?n.composioHealthMissingCredential:e.errorCode===`unauthorized`?n.composioHealthUnauthorized:e.errorCode===`forbidden`?n.composioHealthForbidden:e.errorCode===`network`?n.composioHealthNetwork:e.errorCode===`timeout`?n.composioHealthTimeout:n.composioHealthDegraded}function mn(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function hn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function gn({instance:e,t,onChanged:n}){let r=dn(e),[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)([]),[u,d]=(0,X.useState)(null),[f,h]=(0,X.useState)([]),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)([]),[w,T]=(0,X.useState)({}),[O,k]=(0,X.useState)(`read`),[A,j]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(!1),[L,z]=(0,X.useState)(null),V=(0,X.useMemo)(()=>ln(i),[i]),H=(0,X.useCallback)(async()=>{if(!(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)){j(!0),P(null);try{let[e,t,n,i,o,c]=await Promise.all([we(),Se(r),B(r),nt(r),He(),ne(r)]),[u,f]=await Promise.allSettled([ee(r),le(20)]),p=e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase());a(p),s(u.status===`fulfilled`?u.value:[]),l(f.status===`fulfilled`?f.value.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase()):[]),I(u.status===`rejected`||f.status===`rejected`),k(t),d(n.policy),h(n.agents),y(i),C(o),x(c);let m=ln(p).map(e=>e.primary).filter(e=>!!e.accountId),g=await Promise.allSettled(m.map(async e=>[e.accountId,await xe(e.accountId)]));T(Object.fromEntries(g.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[e.materialized,r]);(0,X.useEffect)(()=>{H()},[H]);let U=(0,X.useCallback)(async()=>{if(r){j(!0),P(null);try{let t=await je(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(M()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`);await qe(r,t.connectionId),await Promise.all([n?.(),H()])}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[e.connectorId,H,n,r]),te=(0,X.useCallback)(async t=>{j(!0),P(null);try{await De(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),H()])}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(!1)}},[e.config,e.instanceId,H,n]),ie=(0,X.useCallback)(async e=>{if(r){k(e),P(null);try{await me(r,e)}catch(e){P(e instanceof Error?e.message:String(e)),await H()}}},[H,r]),ae=(0,X.useCallback)(async e=>{if(r){P(null);try{d(await Ie(r,e))}catch(e){P(e instanceof Error?e.message:String(e))}}},[r]),oe=(0,X.useCallback)(e=>{if(!u)return;let t=u.allowedAgentIds.includes(e);t&&u.allowedAgentIds.length===1||ae({allowedAgentIds:t?u.allowedAgentIds.filter(t=>t!==e):[...u.allowedAgentIds,e]})},[ae,u]),G=(0,X.useCallback)(async e=>{j(!0),P(null);try{await e(),await H()}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(!1)}},[H]);if(!r)return null;if(e.materialized.type===`composio`&&e.materialized.role===`credential`)return(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioApiKeyStored});let se=V.filter(e=>e.primary.status===`active`).length,ce=se>0?t.composioAddAccount:t.composioConnectAccount,ue=v?.status===`connected`,K=b?.requiresCustomAuthConfig===!0,de=b?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[];return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:E(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,ue?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[ue?(0,Q.jsx)(g,{className:`size-3.5`}):(0,Q.jsx)(Le,{className:`size-3.5`}),ue?t.connectionReady:v?t.connectionNeedsSetup:t.connectionChecking]}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:W(t.composioAccountCount,{count:String(V.length)})})]}),(0,Q.jsxs)(D,{variant:`primary`,className:`shrink-0`,disabled:A,onClick:()=>void U(),children:[A?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(Ae,{className:`size-4`}),ce]})]}),N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:N}):null,v&&!ue?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:pn(v,se,t)}),v.recovery===`none`?null:(0,Q.jsx)(D,{variant:`secondary`,disabled:A,onClick:()=>void(v.recovery===`retry`?H():U()),children:v.recovery===`retry`?t.composioRetry:t.composioReconnectAccount})]}):null,K&&de.length===0?(0,Q.jsx)(`p`,{className:`rounded-xl border border-amber-500/25 bg-amber-500/5 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:t.composioAuthConfigEmpty}):null,u?(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-start`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAccessTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O===`read`?t.composioAccessReadHint:O===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,Q.jsxs)(p,{value:O,onChange:e=>void ie(e.currentTarget.value),children:[(0,Q.jsx)(m,{value:`read`,children:t.composioAccessReadOnly}),(0,Q.jsx)(m,{value:`write`,children:t.composioAccessReadWrite}),O===`admin`?(0,Q.jsx)(m,{value:`admin`,children:t.composioAccessAdminCurrent}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioConfirmationPolicy}),(0,Q.jsxs)(p,{value:u.confirmationPolicy,onChange:e=>void ae({confirmationPolicy:e.currentTarget.value}),children:[(0,Q.jsx)(m,{value:`writes`,children:t.composioConfirmWrites}),(0,Q.jsx)(m,{value:`always`,children:t.composioConfirmAlways}),u.confirmationPolicy===`never`?(0,Q.jsx)(m,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,Q.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAllowedAgents}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:E(`rounded-full border px-2.5 py-1 text-xs transition-colors`,u.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void ae({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),f.map(e=>(0,Q.jsx)(`button`,{type:`button`,className:E(`rounded-full border px-2.5 py-1 text-xs transition-colors`,u.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>oe(e.id),children:e.name},e.id))]})]})]}):null,(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.composioConnectedAccounts}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:W(t.composioAccountCount,{count:String(V.length)})})]}),(0,Q.jsxs)(D,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A,onClick:()=>void H(),children:[(0,Q.jsx)(Ze,{className:E(`size-3.5`,A&&`animate-spin`)}),t.refresh]})]}),V.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:V.map(e=>{let i=e.primary,a=S.find(e=>i.accountId?e.accountId===i.accountId:e.connectionId===i.id),o=i.accountId?w[i.accountId]:void 0;return(0,Q.jsxs)(`article`,{className:`px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i.alias??i.workspace??i.accountEmail??i.username??t.composioUnnamedAuthorization}),i.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-muted`,children:t.composioDefaultAccount}):null]}),(0,Q.jsx)(`p`,{className:E(`mt-1 text-xs`,i.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:mn(i.status,t)}),a?(0,Q.jsx)(`p`,{className:E(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:W(t.connectorLearningStatus,{status:hn(a,o,t),count:String(a.candidatesCreated)})}):null]}),i.status===`active`?(0,Q.jsxs)(D,{variant:`secondary`,className:`h-8 shrink-0 px-2.5 text-xs`,disabled:A,onClick:()=>void G(async()=>{if(!i.accountId)throw Error(`Connector account is unavailable.`);await R(i.accountId),await n?.()}),children:[(0,Q.jsx)(Ze,{className:`size-3.5`}),t.composioSyncNow]}):null]}),(0,Q.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,Q.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[o?(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:A,onChange:e=>void G(()=>ze(i.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o.proactiveEnabled,disabled:A||!o.scanEnabled,onChange:e=>void G(()=>ze(i.accountId,{proactiveEnabled:e.currentTarget.checked}))}),t.connectorProactiveUse]}),o.scanEnabled?(0,Q.jsxs)(`label`,{className:`sm:col-span-2`,children:[t.connectorScanInterval,(0,Q.jsxs)(p,{className:`mt-1`,value:String(o.intervalMinutes??30),disabled:A,onChange:e=>void G(()=>ze(i.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,Q.jsxs)(m,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,Q.jsxs)(m,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,Q.jsxs)(m,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,Q.jsxs)(m,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null,(0,Q.jsxs)(`label`,{className:`block`,children:[t.composioAccountAlias,(0,Q.jsx)(`input`,{className:E(un,`mt-1 h-8 py-1 text-xs`),defaultValue:i.alias??``,onBlur:e=>{e.currentTarget.value!==(i.alias??``)&&G(()=>We(i.id,{alias:e.currentTarget.value}))}})]}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:e.authorizations.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,Q.jsx)(D,{variant:`ghost`,className:`size-7 shrink-0 p-0 text-danger`,title:t.composioRevoke,disabled:A,onClick:()=>z(e.id),children:(0,Q.jsx)(re,{className:`size-3.5`})})]},e.id))}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Q.jsx)(D,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:A||i.isDefault||i.status!==`active`,onClick:()=>void G(async()=>{await We(i.id,{isDefault:!0}),await Ie(r,{selectedConnectionIds:[i.id]})}),children:(0,Q.jsx)(Ee,{className:E(`size-4`,i.isDefault&&`fill-current`)})}),(0,Q.jsx)(D,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:A,onClick:()=>void G(()=>J(i.id)),children:(0,Q.jsx)(Ze,{className:`size-4`})})]})]})]})]},e.key)})}):(0,Q.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioConnectionsEmpty})})]}),(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:t.composioAdvancedSettings}),(0,Q.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[F?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.composioDiagnosticsUnavailable}):null,b?(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAuthConfigTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:K?t.composioAuthConfigRequiredHint:t.composioAuthConfigOptionalHint})]}),(0,Q.jsx)(`a`,{className:`text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:t.composioAuthConfigManage})]}),(0,Q.jsxs)(p,{className:`mt-3`,value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:A,onChange:e=>void te(e.currentTarget.value),children:[K?null:(0,Q.jsx)(m,{value:``,children:t.composioAuthConfigManaged}),K&&typeof e.config?.authConfigId!=`string`?(0,Q.jsx)(m,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,de.map(e=>(0,Q.jsxs)(m,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`]},e.id))]})]}):null,(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.length?o.slice(0,8).map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[fn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})})]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:c.length?c.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})})]})]})]})]}),(0,Q.jsx)(Ve,{open:L!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=L;z(null),e&&G(()=>Te(e))},onCancel:()=>z(null)})]})}var _n=E(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_e);function vn(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function yn(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function bn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function xn(e){let t=(0,Z.c)(12),{title:n,description:r,meta:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,Q.jsx)(I,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(`p`,{tabIndex:0,title:r,className:E(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,Q.jsx)(F,{children:(0,Q.jsx)(L,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:i}):null,t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,o]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function Sn({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:a}){let[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,O]=(0,X.useState)(null),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`health`),[N,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(()=>yn(t,e)),[L,R]=(0,X.useState)(null),z=t?.setup.config??[],B=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&z.length>0&&(t?.setup.secrets??[]).length===0,V=k?k.toolCount:e.usage.lastToolCount,U=e.materialized.type===`mcp`,ee=e.materialized.type===`composio`,te=e.materialized.type===`memorySource`,ne=t?Ce(t,i):null,ie=(0,X.useMemo)(()=>{let t=[[`health`,Ge,i.detailHealth],[`tools`,K,`${i.detailTools} ${k?k.toolCount:e.usage.lastToolCount??``}`],[`resources`,be,`${i.detailResources} ${k?k.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,de,`${i.detailPrompts} ${k?k.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,Ae,i.detailPermissions]];return B?[...t,[`config`,be,i.connectorConfigLabel]]:t},[k,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,B,i]),ae=(0,X.useCallback)(async()=>{m(!0),R(null);try{let t=await Re(e.instanceId);A(t),t.toolCount>0&&M(`tools`),r()}catch(e){R(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e.instanceId,r]),oe=(0,X.useCallback)(async()=>{g(!0),R(null);try{await q(e.instanceId),await r(),n()}catch(e){R(e instanceof Error?e.message:String(e)),g(!1)}},[e.instanceId,r,n]),G=(0,X.useCallback)(async()=>{if(!(!t||!B)){S(!0),R(null);try{let n={};for(let e of t.setup.config??[]){let t=bn(e.type,F[e.key]??``);t!==void 0&&(n[e.key]=t)}await De(e.instanceId,{config:n}),await r(),M(`health`)}catch(e){R(e instanceof Error?e.message:String(e))}finally{S(!1)}}},[F,t,e.instanceId,r,B]),ce=(0,X.useCallback)(async()=>{w(!0),O(null),R(null);try{O((await Je(e.connectorId)).recordIds.length),await r()}catch(e){R(e instanceof Error?e.message:String(e))}finally{w(!1)}},[e.connectorId,r]);return(0,Q.jsxs)(f,{open:!0,onOpenChange:e=>{e||n()},children:[(0,Q.jsxs)(l,{children:[(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(u,{className:E(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(se,{connector:t,size:`lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Q.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:ne??(e.materialized.type===`mcp`?W(i.mcpServerRuntime,{serverId:e.materialized.serverId}):W(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:E(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Y.focusRingPanel),"aria-label":i.modalClose,children:[(0,Q.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[L?(0,Q.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:L}):null,U?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,className:E(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,j===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>M(e),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,Q.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[j===`health`?(0,Q.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Q.jsxs)(`p`,{children:[i.statusLabel,` `,(0,Q.jsx)(`span`,{className:k?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:vn(k?.status??e.usage.lastHealthStatus,i)})]}),(0,Q.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),k?.action?(0,Q.jsx)(`p`,{children:k.action}):null]}):null,j===`tools`?k?.tools.length?(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:W(i.toolsAvailable,{count:String(k.tools.length)})}),(0,Q.jsx)(D,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>P(!0),children:a.viewAllTools})]}),(0,Q.jsx)(`div`,{className:`grid gap-2`,children:k.tools.slice(0,8).map(e=>(0,Q.jsx)(xn,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:V?W(i.toolsLastCheckSummary,{count:String(V)}):i.toolsRunTestHint}),(0,Q.jsxs)(D,{type:`button`,variant:`secondary`,disabled:p,onClick:()=>void ae(),children:[p?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(H,{className:`size-4`}),i.test]})]}):null,j===`resources`?k?.resources.length?(0,Q.jsx)(`div`,{className:`grid gap-2`,children:k.resources.slice(0,8).map(e=>(0,Q.jsx)(xn,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,j===`prompts`?k?.prompts.length?(0,Q.jsx)(`div`,{className:`grid gap-2`,children:k.prompts.slice(0,8).map(e=>(0,Q.jsx)(xn,{title:e.title??e.name,description:e.description,meta:e.argumentCount?W(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,j===`permissions`?(0,Q.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:W(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,Q.jsx)(`p`,{children:e.materialized.type===`mcp`?W(i.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):W(i.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,Q.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,j===`config`&&B?(0,Q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,Q.jsx)(`input`,{className:_n,value:F[e.key]??``,placeholder:e.placeholder,onChange:t=>I(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]})]}):null,ee?(0,Q.jsx)(gn,{instance:e,t:i,onChanged:r}):null,te?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-4 text-sm`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),ne?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ne}):null,T===null?null:(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:W(i.connectedSourceSynced,{count:String(T)})})]}),(0,Q.jsxs)(D,{disabled:C,onClick:()=>void ce(),children:[C?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(be,{className:`size-4`}),i.composioSyncNow]})]}),B?(0,Q.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:z.map(e=>(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,Q.jsx)(`input`,{className:_n,value:F[e.key]??``,placeholder:e.placeholder,onChange:t=>I(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!U&&!ee&&!te?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:(0,Q.jsx)(`p`,{children:i.connectorPolicyHint})}):null,(0,Q.jsxs)(`details`,{className:`mt-5 rounded-xl border border-danger/20 bg-danger/5`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-danger`,children:i.dangerZone}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-danger/15 px-4 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.removeConnectorHint}),(0,Q.jsxs)(D,{variant:`secondary`,className:`shrink-0 border-danger/30 text-danger hover:bg-danger/10`,disabled:h,onClick:()=>b(!0),children:[h?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(re,{className:`size-4`}),i.remove]})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Q.jsx)(D,{variant:`secondary`,onClick:n,children:i.modalClose}),(U&&j===`config`||te)&&B?(0,Q.jsxs)(D,{variant:`primary`,disabled:x,onClick:()=>void G(),children:[x?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(Pe,{className:`size-4`}),i.modalSave]}):null,U?(0,Q.jsxs)(D,{variant:`secondary`,disabled:p,onClick:()=>void ae(),children:[p?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(H,{className:`size-4`}),i.test]}):null]})]})]}),e.materialized.type===`mcp`?(0,Q.jsx)(on,{open:N,onOpenChange:P,serverId:e.materialized.serverId,title:W(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:a.toolsDialogSearchPlaceholder,searchEmptyLabel:a.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:a.toolsDialogClose,tools:k?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null,(0,Q.jsx)(Ve,{open:v,title:W(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{b(!1),oe()},onCancel:()=>{h||b(!1)}})]})}function Cn(e){let t=(0,Z.c)(55),{instance:n,definition:r,highlighted:i,onOpenDetails:a,t:o}=e,s=i===void 0?!1:i,c;t[0]!==r||t[1]!==n?(c=gt(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c.state,u;t[3]!==r||t[4]!==o?(u=r?Ce(r,o):null,t[3]=r,t[4]=o,t[5]=u):u=t[5];let d=u,f,p,m,h,_,v,y,b,x;if(t[6]!==l||t[7]!==r||t[8]!==s||t[9]!==n||t[10]!==a||t[11]!==o.connectionChecking||t[12]!==o.connectionNeedsSetup||t[13]!==o.connectionReady){f=l===`ready`?{label:o.connectionReady,Icon:g,className:`text-emerald-700 dark:text-emerald-300`}:l===`needs_setup`?{label:o.connectionNeedsSetup,Icon:Le,className:`text-amber-700 dark:text-amber-300`}:{label:o.connectionChecking,Icon:pe,className:`text-fg-muted`},b=`button`;let e=s&&`bg-accent-soft ring-2 ring-inset ring-accent/40`;t[23]===e?x=t[24]:(x=E(`flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-surface-hover/60`,Y.transition,Y.focusRingPanel,e),t[23]=e,t[24]=x),t[25]!==n||t[26]!==a?(p=()=>a(n),t[25]=n,t[26]=a,t[27]=p):p=t[27],t[28]===r?m=t[29]:(m=(0,Q.jsx)(se,{connector:r}),t[28]=r,t[29]=m),y=`min-w-0 flex-1`,_=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?v=t[31]:(v=(0,Q.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=v),h=E(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,f.className),t[6]=l,t[7]=r,t[8]=s,t[9]=n,t[10]=a,t[11]=o.connectionChecking,t[12]=o.connectionNeedsSetup,t[13]=o.connectionReady,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=_,t[19]=v,t[20]=y,t[21]=b,t[22]=x}else f=t[14],p=t[15],m=t[16],h=t[17],_=t[18],v=t[19],y=t[20],b=t[21],x=t[22];let S;t[32]===f.Icon?S=t[33]:(S=(0,Q.jsx)(f.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=f.Icon,t[33]=S);let C;t[34]!==f.label||t[35]!==S||t[36]!==h?(C=(0,Q.jsxs)(`span`,{className:h,children:[S,f.label]}),t[34]=f.label,t[35]=S,t[36]=h,t[37]=C):C=t[37];let w;t[38]!==C||t[39]!==_||t[40]!==v?(w=(0,Q.jsxs)(`div`,{className:_,children:[v,C]}),t[38]=C,t[39]=_,t[40]=v,t[41]=w):w=t[41];let T;t[42]===d?T=t[43]:(T=d?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:d}):null,t[42]=d,t[43]=T);let D;t[44]!==w||t[45]!==T||t[46]!==y?(D=(0,Q.jsxs)(`div`,{className:y,children:[w,T]}),t[44]=w,t[45]=T,t[46]=y,t[47]=D):D=t[47];let O;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Xe,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=O):O=t[48];let k;return t[49]!==p||t[50]!==m||t[51]!==D||t[52]!==b||t[53]!==x?(k=(0,Q.jsxs)(`button`,{type:b,className:x,onClick:p,children:[m,D,O]}),t[49]=p,t[50]=m,t[51]=D,t[52]=b,t[53]=x,t[54]=k):k=t[54],k}function wn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Lt(r)}function Tn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function En(){return E(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_e)}function Dn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,keyPlaceholder:o,valuePlaceholder:s,headers:c,onChange:l}){let u=(e,t)=>{l(c.map((n,r)=>r===e?{...n,...t}:n))},d=()=>{l([...c,{key:``,value:``}])},f=e=>{let t=c.filter((t,n)=>n!==e);l(t.length>0?t:[{key:``,value:``}])},p=async()=>{try{let e=await b();if(!e){window.alert(a);return}let t=Ot(e);if(!t?.length){window.alert(a);return}l(t)}catch{window.alert(a)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{children:e}),t?(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,Q.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void p(),children:[(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{className:E(En(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:o,onChange:e=>u(t,{key:e.target.value})}),(0,Q.jsx)(`input`,{className:E(En(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:s,onChange:e=>u(t,{value:e.target.value})}),(0,Q.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:c.length<=1&&!e.key&&!e.value,onClick:()=>f(t),"aria-label":r,children:(0,Q.jsx)(re,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},Tn(e,t,c)))}),(0,Q.jsxs)(`button`,{type:`button`,className:E(`self-start text-sm text-accent hover:underline`,Y.press),onClick:d,children:[`+ `,n]})]})}var On=[`stdio`,`sse`,`streamable-http`],kn=[`none`,`oauth`];function An(e){let t=(0,Z.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,Q.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,Q.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function $(){return E(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_e)}function jn(e){let t=(0,Z.c)(37),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:o}=e,s=o===void 0?`all`:o,c=s===`all`||s===`basic`,l=s===`all`||s===`advanced`,u;t[0]!==a||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==c||t[5]!==r?(u=c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:r.transportLabel,required:!0,children:(0,Q.jsx)(p,{className:$(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:On.map(e=>(0,Q.jsx)(m,{value:e,children:r.transportLabels[e]},e))})}),(0,Q.jsxs)(An,{label:r.serverIdLabel,required:!0,children:[(0,Q.jsx)(`input`,{className:$(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:a}):null]})]}):null,t[0]=a,t[1]=i,t[2]=n.id,t[3]=n.transport,t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==n.argsText||t[9]!==n.auth||t[10]!==n.command||t[11]!==n.cwd||t[12]!==n.envJson||t[13]!==n.headers||t[14]!==n.oauthClientId||t[15]!==n.transport||t[16]!==n.url||t[17]!==l||t[18]!==c||t[19]!==r||t[20]!==s?(d=n.transport===`stdio`?(0,Q.jsxs)(Q.Fragment,{children:[c?(0,Q.jsx)(`div`,{className:s===`basic`?`md:col-span-2`:void 0,children:(0,Q.jsx)(An,{label:r.commandLabel,required:!0,children:(0,Q.jsx)(`input`,{className:$(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:r.argsLabel,description:r.argsHint,children:(0,Q.jsx)(`input`,{className:$(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,Q.jsx)(An,{label:r.cwdLabel,children:(0,Q.jsx)(`input`,{className:$(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,Q.jsx)(An,{label:r.envLabel,description:r.envHint,children:(0,Q.jsx)(`textarea`,{className:E($(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[c?(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:(0,Q.jsx)(An,{label:r.urlLabel,required:!0,children:(0,Q.jsx)(`input`,{className:E($(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,c&&n.transport===`streamable-http`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:r.authLabel,description:r.authHint,children:(0,Q.jsx)(p,{className:$(),value:n.auth,onChange:e=>{let t=e.target.value;i({auth:t,headers:t===`oauth`?n.headers.filter(Nn):n.headers})},children:kn.map(e=>(0,Q.jsx)(m,{value:e,children:r.authLabels[e]},e))})}),n.auth===`oauth`?(0,Q.jsx)(An,{label:r.oauthClientIdLabel,description:r.oauthClientIdHint,children:(0,Q.jsx)(`input`,{className:E($(),`font-mono text-xs`),value:n.oauthClientId,placeholder:r.oauthClientIdPlaceholder,onChange:e=>i({oauthClientId:e.target.value})})}):null]}):null,l?(0,Q.jsx)(Dn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:n.auth===`oauth`?e.filter(Mn):e})}):null]}),t[7]=i,t[8]=n.argsText,t[9]=n.auth,t[10]=n.command,t[11]=n.cwd,t[12]=n.envJson,t[13]=n.headers,t[14]=n.oauthClientId,t[15]=n.transport,t[16]=n.url,t[17]=l,t[18]=c,t[19]=r,t[20]=s,t[21]=d):d=t[21];let f;t[22]!==i||t[23]!==n||t[24]!==l||t[25]!==r?(f=l?(0,Q.jsx)(An,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,Q.jsx)(`input`,{type:`number`,min:1,max:600,className:$(),value:Yt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Xt(e.target.value)})})}):null,t[22]=i,t[23]=n,t[24]=l,t[25]=r,t[26]=f):f=t[26];let h;t[27]!==i||t[28]!==n||t[29]!==l||t[30]!==r?(h=l?(0,Q.jsx)(An,{label:r.requestTimeoutLabel,description:r.requestTimeoutHint,children:(0,Q.jsx)(`input`,{type:`number`,min:1,max:14400,className:$(),value:Zt(n),placeholder:r.requestTimeoutPlaceholder,onChange:e=>i({requestTimeoutMs:Qt(e.target.value)})})}):null,t[27]=i,t[28]=n,t[29]=l,t[30]=r,t[31]=h):h=t[31];let g;return t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==h?(g=(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[u,d,f,h]}),t[32]=u,t[33]=d,t[34]=f,t[35]=h,t[36]=g):g=t[36],g}function Mn(e){return e.key.trim().toLowerCase()!==`authorization`}function Nn(e){return e.key.trim().toLowerCase()!==`authorization`}function Pn(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function Fn(e){let t=(0,Z.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=Pn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o=n.name===a?a:n.name,s;t[3]===n.description?s=t[4]:(s=n.description?.trim(),t[3]=n.description,t[4]=s);let c=s,l;t[5]!==a||t[6]!==o?(l=(0,Q.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:o,children:a}),t[5]=a,t[6]=o,t[7]=l):l=t[7];let u;t[8]===c?u=t[9]:(u=c?(0,Q.jsx)(I,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(`p`,{tabIndex:0,title:c,className:E(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:c})}),(0,Q.jsx)(F,{children:(0,Q.jsx)(L,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:c})})})]})}):null,t[8]=c,t[9]=u);let d;return t[10]!==l||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function In({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:a,managedServerIds:p,t:m,cs:h,onClose:v,onSaved:b}){let[x,S]=(0,X.useState)(n),[C,w]=(0,X.useState)(!1),[T,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)({status:`idle`}),[F,I]=(0,X.useState)(null),L=n.id.trim(),R=x.id.trim()!==L&&p.has(x.id.trim())||p.has(x.id.trim())&&t===`add`?m.reservedServerId:void 0,z=x.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===x.id.trim())?h.duplicateServerId:void 0,B=x.id.trim().length>0&&!R&&!z&&(x.transport===`stdio`?x.command.trim().length>0:x.url.trim().length>0),V=!(x.transport===`streamable-http`&&x.auth===`oauth`),U=$t(x),W=(0,X.useCallback)(async()=>{if(x.id.trim()){O(!0),A(null),P({status:`loading`});try{P({status:`ok`,tools:(await Jt(x.id.trim(),zt(x))).tools})}catch(e){P({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{O(!1)}}},[x]),ee=(0,X.useCallback)(async()=>{if(!(!B||C)){w(!0),A(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(x),await Bt({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Mt(a)),await b(),v()}catch(e){A(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[B,a,r,n.clientKey,t,v,b,L,x,C,i]);return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{open:e,onOpenChange:e=>{e||v()},children:(0,Q.jsxs)(l,{children:[(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(u,{className:E(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(d,{className:`text-base font-semibold text-fg`,children:t===`add`?h.addCustomServerTitle:h.editCustomServerTitle}),(0,Q.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?h.addCustomServerHint:h.editCustomServerHint})]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:E(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Y.focusRingPanel),"aria-label":h.modalClose,children:[(0,Q.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:h.modalClose})]})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(ke,{className:`size-4 text-accent`,"aria-hidden":!0}),x.id.trim()||m.cardUntitled]}),(0,Q.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:U||(x.transport===`stdio`?m.commandLabel:m.urlLabel)})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:m.transportLabels[x.transport]})]})}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.connectorBasicConfigTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:h.connectorBasicConfigHint})]}),(0,Q.jsx)(jn,{row:x,t:m,variant:`basic`,onUpdate:e=>{S(t=>({...t,...e})),A(null)},idConflictMessage:R??z})]}),N.status===`ok`?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),N.tools.length===0?m.toolsEmpty:m.toolsTitle.replace(`{{count}}`,String(N.tools.length))]}),N.tools.length>0?(0,Q.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>I(N.tools),children:m.viewAllTools}):null]}),N.tools.length>0?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-2`,children:N.tools.slice(0,6).map((e,t)=>(0,Q.jsx)(Fn,{tool:e,serverId:x.id},e.name||`tool-${t}`))}):null]}):null,N.status===`error`?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:N.message}):null,k?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:k}):null,(0,Q.jsxs)(`details`,{open:j,onToggle:e=>M(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(Ne,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`group-open:hidden`,children:h.connectorShowAdvancedConfig}),(0,Q.jsx)(`span`,{className:`hidden group-open:inline`,children:h.connectorHideAdvancedConfig})]}),(0,Q.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,Q.jsx)(jn,{row:x,t:m,variant:`advanced`,onUpdate:e=>{S(t=>({...t,...e})),A(null)}})})]})]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Q.jsxs)(D,{variant:`secondary`,disabled:!x.id.trim()||T||!V,title:V?void 0:m.oauthSaveBeforeTest,onClick:()=>void W(),children:[T?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(H,{className:`size-4`}),m.testConnection]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{variant:`secondary`,children:h.modalCancel})}),(0,Q.jsxs)(D,{variant:`primary`,disabled:!B||C,onClick:()=>void ee(),children:[C?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),C?m.saving:h.modalSave]})]})]})]})}),F?(0,Q.jsx)(on,{open:!0,onOpenChange:e=>{e||I(null)},serverId:x.id,title:m.toolsDialogTitle,subtitle:m.toolsDialogSubtitle,searchPlaceholder:m.toolsDialogSearchPlaceholder,searchEmptyLabel:m.toolsDialogSearchEmpty,emptyLabel:m.toolsEmpty,closeLabel:m.toolsDialogClose,tools:F,stripPrefix:`${x.id.trim()}__`}):null]}):null}var Ln=`builtin`,Rn=`composio`,zn=`xopc-store`;function Bn(e){return Ln}function Vn(e){return!(e.runtime.type===`composio`&&e.runtime.role===`credential`)}function Hn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function Un(e,t,n){return e.filter(e=>Hn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Wn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function Gn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}function Kn(e){let t=e.connectorManifest;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(n.contractVersion!==1||n.id!==e.name)return null;let r=n.runtime,i=n.auth;if(!r||typeof r!=`object`||Array.isArray(r)||!i||typeof i!=`object`||Array.isArray(i))return null;let a=r,o=i;if(a.type!==`mcp`||typeof a.serverId!=`string`)return null;let s=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(String(n.category??``))?n.category:`custom`,c=o.mode===`oauth`?{mode:`oauth`,...typeof o.clientId==`string`?{clientId:o.clientId}:{}}:o.mode===`apiKey`?{mode:`apiKey`}:{mode:`none`};return{id:e.name,version:e.latestVersion??`store`,displayName:typeof n.displayName==`string`?n.displayName:e.name,description:typeof n.description==`string`?n.description:e.description,category:s,kind:`mcp`,source:`store`,capabilities:Array.isArray(n.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],tags:Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[`store`],auth:c,setup:n.setup&&typeof n.setup==`object`&&!Array.isArray(n.setup)?n.setup:{},runtime:{type:`mcp`,serverId:a.serverId}}}function qn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Jn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function Yn(){let e=x(C(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=T(e=>e.token),o=!!r,s=i(),[c,l]=a(),u=c.get(`understanding`)===`1`,d=Jn(c.get(`returnTo`)),f=c.get(`tab`),[p,m]=(0,X.useState)(!u&&f===`connected`?`connected`:`discover`),g=(0,X.useRef)(!1),[v,y]=(0,X.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[b,S]=(0,X.useState)(!1),[w,O]=(0,X.useState)(!1),[A,j]=(0,X.useState)(1),[M,N]=(0,X.useState)(void 0),[P,F]=(0,X.useState)(``),[I,L]=(0,X.useState)(u?c.get(`connector`)??``:``),[R,z]=(0,X.useState)(Bn(u?`understanding`:`default`)),[B,V]=(0,X.useState)(`name`),[H,W]=(0,X.useState)(u?`understand`:`all`),[ee,ne]=(0,X.useState)(null),[re,ie]=(0,X.useState)(null),[oe,G]=(0,X.useState)(null),[se,le]=(0,X.useState)(null),[K,de]=(0,X.useState)(null),[pe,me]=(0,X.useState)(null),[he,_e]=(0,X.useState)(!1),[ve,be]=(0,X.useState)(void 0),[xe,Se]=(0,X.useState)(!1),{data:Ce,mutate:we}=k(o),q=Ce?.payload?.config,J=(0,X.useMemo)(()=>q===void 0?null:Rt(q),[q]),Te=J?.servers??[],Ee=v.instances.length+Te.length;(0,X.useEffect)(()=>{J&&be(J.sessionIdleTtlMinutes)},[J]);let De=(0,X.useCallback)(async()=>{if(!r){y({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}y(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([U(),ae()]);y(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){y({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,X.useEffect)(()=>{De()},[De]),(0,X.useEffect)(()=>{g.current||v.loading||o&&!J||(m(u?`discover`:Ee>0?`connected`:`discover`),g.current=!0)},[o,Ee,J,u,v.loading]);let Oe=(0,X.useCallback)(e=>{g.current=!0,m(e)},[]),ke=(0,X.useMemo)(()=>[{id:Rn,displayName:t.composioSourceName},{id:zn,displayName:t.storeSourceName}],[t.composioSourceName,t.storeSourceName]),Ae=(0,X.useCallback)(async e=>{if(!o||R===`builtin`){y(e=>({...e,registryCatalog:[]})),j(1),N(void 0);return}let t=I.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=R===`all`?ke:ke.filter(e=>e.id===R);if(i.length!==0){S(!0),r?y(e=>({...e,error:null})):(j(1),N(void 0),y(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await fe({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await ue({q:t||void 0,page:n,pageSize:24,sort:B===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=Kn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=qn(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));j(n),N(o),y(e=>({...e,registryCatalog:r?qn([...e.registryCatalog,...a]):a}))}catch(e){y(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{S(!1)}}},[B,I,R,o,ke]);(0,X.useEffect)(()=>{if(p!==`discover`||v.loading)return;if(R===`builtin`){y(e=>({...e,registryCatalog:[]})),j(1),N(void 0);return}let e=window.setTimeout(()=>{Ae()},I.trim()?350:0);return()=>window.clearTimeout(e)},[I,R,Ae,v.loading,p]);let je=(0,X.useMemo)(()=>new Set(v.instances.map(e=>e.connectorId)),[v.instances]),Me=(0,X.useMemo)(()=>new Map([...v.catalog,...v.registryCatalog].map(e=>[e.id,e])),[v.catalog,v.registryCatalog]);(0,X.useEffect)(()=>{if(v.loading)return;let e=c.get(`connector`),t=c.get(`instance`);if(!e&&!t)return;let n=v.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)g.current=!0,F(``),G(n.instanceId),le(n),m(`connected`);else if(e){let t=Me.get(e);if(!t)return;g.current=!0,z(Bn(u?`understanding`:`default`)),L(``),ie(t),m(`discover`)}let r=new URLSearchParams(c);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),l(r,{replace:!0})},[Me,u,c,l,v.instances,v.loading]);let Ne=(0,X.useCallback)(async e=>{O(!0),y(e=>({...e,error:null}));try{let t=await ge(e);ne(te(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){y(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{O(!1)}},[]),Pe=(0,X.useMemo)(()=>new Set(v.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[v.instances]),Ie=(0,X.useCallback)(async e=>{if(!J||q===void 0)return;let t=Te.filter(t=>t.clientKey!==e.clientKey);await Bt({sessionIdleTtlMinutes:J.sessionIdleTtlMinutes,servers:t},Mt(q)),await we(),await De()},[q,Te,De,J,we]),Y=(0,X.useCallback)(()=>{me({mode:`add`,row:wn(Te,Pe)})},[Te,Pe]),Le=(0,X.useCallback)(async()=>{if(!(!J||q===void 0||xe)){Se(!0);try{await Bt({sessionIdleTtlMinutes:ve,servers:Te},Mt(q)),await we(),_e(!1)}finally{Se(!1)}}},[q,Te,n.saved,J,we,ve,xe]),Re=Ke(e=>e.setPageHeader),ze=Ke(e=>e.clearPageHeader),Be=(0,X.useMemo)(()=>(0,Q.jsx)(Et,{onBrowseCatalog:()=>Oe(`discover`),onAddCustomServer:Y,addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced}),[t,Y,Oe]);(0,X.useLayoutEffect)(()=>(Re({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:Be}),()=>ze()),[ze,t.title,Be,Re]);let Ve=(0,X.useMemo)(()=>v.instances.map(e=>({instance:e,value:gt(e,Me.get(e.connectorId))})),[Me,v.instances]),He=(0,X.useMemo)(()=>new Map(Ve.map(({instance:e,value:t})=>[e.instanceId,t])),[Ve]),Ue=(0,X.useMemo)(()=>v.instances.filter(e=>Wn(e,P)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=He.get(e.instanceId)?.state??`checking`,i=He.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[P,He,v.instances]),We=(0,X.useMemo)(()=>Ue.filter(e=>He.get(e.instanceId)?.state===`needs_setup`),[He,Ue]),Ge=(0,X.useMemo)(()=>Ue.filter(e=>He.get(e.instanceId)?.state!==`needs_setup`),[He,Ue]),qe=(0,X.useMemo)(()=>Te.filter(e=>Gn(e,P)),[P,Te]),Je=Ue.length+qe.length,Xe=(0,X.useMemo)(()=>v.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&Vn(e)),[v.catalog]),Ze=(0,X.useMemo)(()=>R===`builtin`?Xe:R===`all`?qn([...Xe,...v.registryCatalog]):v.registryCatalog,[Xe,R,v.registryCatalog]),Qe=(0,X.useMemo)(()=>{let e=u?Ze.filter(e=>e.understanding?.mode===`activity`):Ze;return Un(H===`all`?e:e.filter(e=>mt(e).includes(H)),I,B)},[B,I,Ze,u,H]),$e=(0,X.useMemo)(()=>pt.filter(e=>Ze.some(t=>mt(t).includes(e))),[Ze]);(0,X.useEffect)(()=>{H!==`all`&&!$e.includes(H)&&W(`all`)},[$e,H]);let et=p===`discover`&&R!==`builtin`&&!!(M&&A<M),tt=(0,X.useMemo)(()=>v.instances.find(e=>e.instanceId===oe)??se,[oe,se,v.instances]),nt=(0,X.useMemo)(()=>[{value:`all`,label:t.discoverSourceAll},{value:Ln,label:t.discoverSourceBuiltin},...ke.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,ke]),rt=[{id:`connected`,label:t.tabConnected,count:Ee},{id:`discover`,label:t.tabDiscover}];return(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[o?null:(0,Q.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),u?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:t.understandingSetupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.understandingSetupHint})]}),(0,Q.jsx)(D,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>s(d),children:t.understandingSetupDone})]}):null,(0,Q.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(it,{items:rt,activeTab:p,onChange:Oe,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),v.error?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:v.error}):null,p===`connected`&&o?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ee>5||P?(0,Q.jsx)(Tt,{value:P,onChange:F,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}):(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsx)(ce,{className:`size-9 shrink-0 p-0`,loading:v.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:De})]}),v.loading?(0,Q.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:st.slice(0,3).map(e=>(0,Q.jsx)(ft,{},e))}):Ee===0?(0,Q.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,Q.jsx)(D,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Oe(`discover`),children:t.addFromCatalog})]}):Je===0?(0,Q.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[We.length?(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.needsAttentionTitle}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-amber-700 dark:text-amber-300`,children:We.length})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-amber-500/25 bg-amber-500/5`,children:We.map(e=>(0,Q.jsx)(Cn,{instance:e,definition:Me.get(e.connectorId),highlighted:e.instanceId===K,onOpenDetails:e=>{de(null),G(e.instanceId),le(e)},t},e.instanceId))})]}):null,Ge.length?(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectedServicesTitle}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:Ge.length})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:Ge.map(e=>(0,Q.jsx)(Cn,{instance:e,definition:Me.get(e.connectorId),highlighted:e.instanceId===K,onOpenDetails:e=>{de(null),G(e.instanceId),le(e)},t},e.instanceId))})]}):null,qe.length||!P.trim()?(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer px-4 py-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.customIntegrationsTitle}),(0,Q.jsx)(`span`,{className:`ml-2 text-xs tabular-nums text-fg-subtle`,children:qe.length}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.customIntegrationsHint})]}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-4 py-3`,children:[(0,Q.jsx)(D,{type:`button`,variant:`secondary`,className:`h-8 text-xs`,onClick:Y,children:t.addCustomServerAdvanced}),(0,Q.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>_e(!0),children:[(0,Q.jsx)(Ye,{className:`size-3.5`}),t.runtimeSettings]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:qe.map(e=>(0,Q.jsx)(en,{row:e,t:n,cs:t,onEdit:()=>me({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Ie(e)},e.clientKey))})]})]}):null]})]}):null,p===`discover`&&o?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[u?null:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.taskFilterAria,children:[`all`,...$e].map(e=>(0,Q.jsx)(`button`,{type:`button`,className:E(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,H===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":H===e,onClick:()=>W(e),children:e===`all`?t.taskAll:t.connectorBenefitHeadings[e]},e))}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,Q.jsx)(Tt,{value:I,onChange:L,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,Q.jsxs)(`details`,{className:`relative shrink-0 lg:ml-auto`,children:[(0,Q.jsxs)(`summary`,{className:`flex h-9 cursor-pointer list-none items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),t.filters]}),(0,Q.jsxs)(`div`,{className:E(`mt-2 grid min-w-[15rem] grid-cols-1 gap-2 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover sm:absolute sm:right-0 sm:z-10`,!u&&`sm:min-w-[24rem] sm:grid-cols-2`),children:[u?null:(0,Q.jsx)(h,{value:R,options:nt,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:z}),(0,Q.jsx)(h,{value:B,options:[{value:`name`,label:t.sortName},{value:`source`,label:t.sortSource}],placeholder:t.sortName,allowEmpty:!1,ariaLabel:t.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>V(e)})]})]})]}),(v.loading||b)&&Qe.length===0?(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:st.map(e=>(0,Q.jsx)(ut,{},e))}):Qe.length===0?(0,Q.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,Q.jsxs)(`div`,{className:`relative`,children:[b?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,Q.jsx)(_,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:Qe.map(e=>(0,Q.jsx)(at,{connector:e,installed:je.has(e.id)||ct(e,v.instances),onInstall:e=>{if(e.source===`store`){Ne(e.id);return}ne(te(e))},onOpenDetails:e.source===`store`?void 0:ie,t},e.id))}),et?(0,Q.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Q.jsxs)(D,{type:`button`,variant:`secondary`,disabled:b||w,onClick:()=>void Ae({page:A+1,append:!0}),children:[b?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),ee?(0,Q.jsx)(ye,{draft:ee,onChange:ne,onClose:()=>ne(null),t,onInstalled:async e=>{await De(),await we(),de(e.instanceId),Oe(`connected`)}}):null,re?(0,Q.jsx)(St,{connector:re,installed:je.has(re.id)||ct(re,v.instances),onClose:()=>ie(null),onInstall:e=>ne(te(e)),t}):null,tt?(0,Q.jsx)(Sn,{instance:tt,definition:Me.get(tt.connectorId),onClose:()=>{G(null),le(null)},onChanged:De,t,mcp:n}):null,pe?(0,Q.jsx)(In,{open:!0,mode:pe.mode,initialRow:pe.row,existingCustomServers:Te,sessionIdleTtlMinutes:ve,config:q,managedServerIds:Pe,t:n,cs:t,onClose:()=>me(null),onSaved:async()=>{await we(),await De(),Oe(`connected`)}},`${pe.mode}-${pe.row.clientKey}`):null,(0,Q.jsx)(wt,{open:he,sessionIdleTtlMinutes:ve,saving:xe,onChange:be,onSave:Le,onClose:()=>_e(!1),t,mcp:n})]})})}export{Yn as ConnectorsPage};
@@ -1,2 +0,0 @@
1
- import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./check-DUBLcKHA.js";import{f as o,o as s,p as c}from"./popover-select-CKBYnT3c.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d,r as f}from"./settings-shell-layer-context-DCp6ykjQ.js";import{Ql as p}from"./index-OMnem2nr.js";var m=r(),h=e(n(),1),g=i(),_=Array.from({length:24},(e,t)=>t);function v(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function y(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function ee(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function te(e){let t=(0,m.c)(80),{value:n,onChange:r,disabled:i,allowEmpty:te,clearLabel:b,ariaLabel:x,ariaLabelledBy:ie,className:ae,triggerClassName:oe,id:se,name:ce,minuteStep:le}=e,ue=te===void 0?!1:te,de=le===void 0?1:le,S=v(n),fe=S??y(),[pe,me]=(0,h.useState)(!1),[C,he]=(0,h.useState)(fe.hour),[w,ge]=(0,h.useState)(fe.minute),_e=(0,h.useRef)([]),T=(0,h.useRef)([]),E=d(),ve=f(),ye=s(E,ve!==null),be=Math.max(1,Math.min(60,Math.round(de))),xe=Array.from({length:Math.ceil(60/be)},(e,t)=>t*be).filter(re),Se;t[0]===r?Se=t[1]:(Se=(e,t,n)=>{let i=n===void 0?!1:n;he(e),ge(t),r(ee(e,t)),i&&me(!1)},t[0]=r,t[1]=Se);let Ce=Se,we=ne,D;t[2]===ae?D=t[3]:(D=u(`relative min-w-0`,ae),t[2]=ae,t[3]=D);let Te=c,O;t[4]===n?O=t[5]:(O=e=>{if(e){let e=v(n)??y();he(e.hour),ge(e.minute)}me(e)},t[4]=n,t[5]=O);let Ee=ue&&n&&`pr-9`,De=i&&`cursor-not-allowed opacity-50 hover:border-edge`,Oe;t[6]!==Ee||t[7]!==De||t[8]!==oe?(Oe=u(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,Ee,De,oe),t[6]=Ee,t[7]=De,t[8]=oe,t[9]=Oe):Oe=t[9];let ke;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,g.jsx)(p,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=ke):ke=t[10];let Ae=!S&&`text-fg-subtle`,je;t[11]===Ae?je=t[12]:(je=u(`tabular-nums`,Ae),t[11]=Ae,t[12]=je);let Me=S?ee(S.hour,S.minute):`--:--`,k;t[13]!==je||t[14]!==Me?(k=(0,g.jsx)(`span`,{className:je,children:Me}),t[13]=je,t[14]=Me,t[15]=k):k=t[15];let Ne;t[16]!==x||t[17]!==ie||t[18]!==i||t[19]!==se||t[20]!==k||t[21]!==Oe?(Ne=(0,g.jsx)(o,{asChild:!0,children:(0,g.jsxs)(`button`,{id:se,type:`button`,disabled:i,"aria-label":x,"aria-labelledby":ie,"aria-haspopup":`listbox`,className:Oe,children:[ke,k]})}),t[16]=x,t[17]=ie,t[18]=i,t[19]=se,t[20]=k,t[21]=Oe,t[22]=Ne):Ne=t[22];let Pe=c,Fe=ve??void 0,Ie=c,Le=u(ye,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),A=e=>{e.preventDefault(),requestAnimationFrame(()=>_e.current[C]?.focus())},Re;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,g.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=Re):Re=t[23];let j=x??`HH:mm`,M;t[24]===j?M=t[25]:(M=(0,g.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[Re,j]}),t[24]=j,t[25]=M);let N;t[26]!==C||t[27]!==w?(N=ee(C,w),t[26]=C,t[27]=w,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,g.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,g.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let ze;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=ze):ze=t[34];let Be=`${x??`HH:mm`} HH`,Ve=_.map((e,t)=>(0,g.jsx)(`button`,{ref:e=>{_e.current[t]=e},type:`button`,role:`option`,"aria-selected":C===e,tabIndex:C===e?0:-1,className:u(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,C===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(e,w),onKeyDown:e=>we(e,_,C,e=>Ce(e,w),_e),children:String(e).padStart(2,`0`)},e)),He;t[35]!==Be||t[36]!==Ve?(He=(0,g.jsxs)(`div`,{className:`pr-2`,children:[ze,(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Be,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ve})]}),t[35]=Be,t[36]=Ve,t[37]=He):He=t[37];let I;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=I):I=t[38];let Ue=`${x??`HH:mm`} MM`,We=xe.map((e,t)=>(0,g.jsxs)(`button`,{ref:e=>{T.current[t]=e},type:`button`,role:`option`,"aria-selected":w===e,tabIndex:w===e?0:-1,className:u(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,w===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(C,e,!0),onKeyDown:e=>we(e,xe,w,e=>Ce(C,e),T),children:[(0,g.jsx)(a,{className:u(`absolute left-0.5 size-3`,w!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),L;t[39]!==Ue||t[40]!==We?(L=(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Ue,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:We}),t[39]=Ue,t[40]=We,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,g.jsxs)(`div`,{className:`pl-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==He||t[46]!==R?(z=(0,g.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[He,R]}),t[45]=He,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==Ie.Content||t[49]!==Le||t[50]!==A||t[51]!==F||t[52]!==z?(B=(0,g.jsxs)(Ie.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Le,onOpenAutoFocus:A,children:[F,z]}),t[48]=Ie.Content,t[49]=Le,t[50]=A,t[51]=F,t[52]=z,t[53]=B):B=t[53];let Ge;t[54]!==Pe.Portal||t[55]!==Fe||t[56]!==B?(Ge=(0,g.jsx)(Pe.Portal,{container:Fe,children:B}),t[54]=Pe.Portal,t[55]=Fe,t[56]=B,t[57]=Ge):Ge=t[57];let Ke;t[58]!==pe||t[59]!==Ne||t[60]!==Ge||t[61]!==Te.Root||t[62]!==O?(Ke=(0,g.jsxs)(Te.Root,{open:pe,onOpenChange:O,children:[Ne,Ge]}),t[58]=pe,t[59]=Ne,t[60]=Ge,t[61]=Te.Root,t[62]=O,t[63]=Ke):Ke=t[63];let V;t[64]!==ue||t[65]!==x||t[66]!==b||t[67]!==i||t[68]!==r||t[69]!==n?(V=ue&&n?(0,g.jsx)(`button`,{type:`button`,disabled:i,"aria-label":b??x,title:b,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,g.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=ue,t[65]=x,t[66]=b,t[67]=i,t[68]=r,t[69]=n,t[70]=V):V=t[70];let H;t[71]!==i||t[72]!==ce||t[73]!==n?(H=ce?(0,g.jsx)(`input`,{type:`hidden`,name:ce,value:n,disabled:i}):null,t[71]=i,t[72]=ce,t[73]=n,t[74]=H):H=t[74];let qe;return t[75]!==D||t[76]!==Ke||t[77]!==V||t[78]!==H?(qe=(0,g.jsxs)(`div`,{className:D,children:[Ke,V,H]}),t[75]=D,t[76]=Ke,t[77]=V,t[78]=H,t[79]=qe):qe=t[79],qe}function ne(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function re(e){return e<60}var b=t((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),x=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronField=void 0,e.CronField=class e{#e=!1;#t=!1;#n=!1;#r=[];options={rawValue:``};static get min(){throw Error(`min must be overridden`)}static get max(){throw Error(`max must be overridden`)}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(t,n={rawValue:``}){if(!Array.isArray(t))throw Error(`${this.constructor.name} Validation error, values is not an array`);if(!(t.length>0))throw Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...n,rawValue:n.rawValue??``},this.#r=t.sort(e.sorter),this.#n=this.options.wildcard===void 0?this.#i():this.options.wildcard,this.#e=this.options.rawValue.includes(`L`)||t.includes(`L`),this.#t=this.options.rawValue.includes(`?`)||t.includes(`?`)}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#r}static sorter(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?e-t:!n&&!r?e.localeCompare(t):n?-1:1}static findNearestValueInList(e,t,n=!1){if(n){for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}for(let n=0;n<e.length;n++)if(e[n]>t)return e[n];return null}findNearestValue(e,t=!1){return this.constructor.findNearestValueInList(this.values,e,t)}serialize(){return{wildcard:this.#n,values:this.#r}}validate(){let e,t=this.chars.length>0?` or chars ${this.chars.join(``)}`:``,n=e=>t=>RegExp(`^\\d{0,2}${t}$`).test(e);if(!this.#r.every(t=>(e=t,typeof t==`number`?t>=this.min&&t<=this.max:this.chars.some(n(t)))))throw Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${t}`);let r=this.#r.find((e,t)=>this.#r.indexOf(e)!==t);if(r)throw Error(`${this.constructor.name} Validation error, duplicate values found: ${r}`)}#i(){return this.options.rawValue.length>0?[`*`,`?`].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,t)=>t+this.min).every(e=>this.#r.includes(e))}}})),ie=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfMonth=void 0;var t=x(),n=1,r=31,i=Object.freeze([`L`]);e.CronDayOfMonth=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ae=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfWeek=void 0;var t=x(),n=0,r=7,i=Object.freeze([`L`]);e.CronDayOfWeek=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}}})),oe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronHour=void 0;var t=x(),n=0,r=23,i=Object.freeze([]);e.CronHour=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),se=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMinute=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronMinute=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ce=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{},n=class extends t{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},r=class extends t{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},i=class extends t{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},a=class extends t{},o=class extends t{constructor(e){super(`Invalid unit ${e}`)}},s=class extends t{},c=class extends t{constructor(){super(`Zone is an abstract class`)}},l=`numeric`,u=`short`,d=`long`,f={year:l,month:l,day:l},p={year:l,month:u,day:l},m={year:l,month:u,day:l,weekday:u},h={year:l,month:d,day:l},g={year:l,month:d,day:l,weekday:d},_={hour:l,minute:l},v={hour:l,minute:l,second:l},y={hour:l,minute:l,second:l,timeZoneName:u},ee={hour:l,minute:l,second:l,timeZoneName:d},te={hour:l,minute:l,hourCycle:`h23`},ne={hour:l,minute:l,second:l,hourCycle:`h23`},re={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:u},b={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:d},x={year:l,month:l,day:l,hour:l,minute:l},ie={year:l,month:l,day:l,hour:l,minute:l,second:l},ae={year:l,month:u,day:l,hour:l,minute:l},oe={year:l,month:u,day:l,hour:l,minute:l,second:l},se={year:l,month:u,day:l,weekday:u,hour:l,minute:l},ce={year:l,month:d,day:l,hour:l,minute:l,timeZoneName:u},le={year:l,month:d,day:l,hour:l,minute:l,second:l,timeZoneName:u},ue={year:l,month:d,day:l,weekday:d,hour:l,minute:l,timeZoneName:d},de={year:l,month:d,day:l,weekday:d,hour:l,minute:l,second:l,timeZoneName:d},S=class{get type(){throw new c}get name(){throw new c}get ianaName(){return this.name}get isUniversal(){throw new c}offsetName(e,t){throw new c}formatOffset(e,t){throw new c}offset(e){throw new c}equals(e){throw new c}get isValid(){throw new c}},fe=null,pe=class e extends S{static get instance(){return fe===null&&(fe=new e),fe}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}},me=new Map;function C(e){let t=me.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),me.set(e,t)),t}var he={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function w(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function ge(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=he[t];t===`era`?r[a]=i:W(a)||(r[a]=parseInt(i,10))}return r}var _e=new Map,T=class e extends S{static create(t){let n=_e.get(t);return n===void 0&&_e.set(t,n=new e(t)),n}static resetCache(){_e.clear(),me.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n,this.name)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=C(this.name),[r,i,a,o,s,c,l]=n.formatToParts?ge(n,t):w(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=Dt({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}},E={};function ve(e,t={}){let n=JSON.stringify([e,t]),r=E[n];return r||(r=new Intl.ListFormat(e,t),E[n]=r),r}var ye=new Map;function be(e,t={}){let n=JSON.stringify([e,t]),r=ye.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),ye.set(n,r)),r}var xe=new Map;function Se(e,t={}){let n=JSON.stringify([e,t]),r=xe.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),xe.set(n,r)),r}var Ce=new Map;function we(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=Ce.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),Ce.set(i,a)),a}var D=null;function Te(){return D||(D=new Intl.DateTimeFormat().resolvedOptions().locale,D)}var O=new Map;function Ee(e){let t=O.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),O.set(e,t)),t}var De=new Map;function Oe(e){let t=De.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Le,...t}),De.set(e,t)}return t}function ke(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=be(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=be(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function Ae(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function je(e){let t=[];for(let n=1;n<=12;n++){let r=$.utc(2009,n,1);t.push(e(r))}return t}function Me(e){let t=[];for(let n=1;n<=7;n++){let r=$.utc(2016,11,13+n);t.push(e(r))}return t}function k(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function Ne(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||Ee(e.locale).numberingSystem===`latn`}var Pe=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=Se(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return K(this.floor?Math.floor(e):Ct(e,3),this.padTo)}},Fe=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&T.create(n).valid?(r=n,this.dt=e):(r=`UTC`,this.dt=e.offset===0?e:e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type===`system`?this.dt=e:e.zone.type===`iana`?(this.dt=e,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=be(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(``):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Ie=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&ft()&&(this.rtf=we(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):en(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Le={firstDay:1,minimalDays:4,weekend:[6,7]},A=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||V.defaultLocale;return new e(o||(a?`en-US`:Te()),n||V.defaultNumberingSystem,r||V.defaultOutputCalendar,vt(i)||V.defaultWeekSettings,o)}static resetCache(){D=null,ye.clear(),xe.clear(),Ce.clear(),O.clear(),De.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=ke(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=Ae(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??=Ne(this),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,vt(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return k(this,e,Bt,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=je(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return k(this,e,Wt,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=Me(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return k(this,void 0,()=>Gt,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[$.utc(2016,11,13,9),$.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return k(this,e,Yt,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[$.utc(-40,1,1),$.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Pe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Fe(e,this.intl,t)}relFormatter(e={}){return new Ie(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ve(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||Ee(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:pt()?Oe(this.locale):Le}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Re=null,j=class e extends S{static get utcInstance(){return Re===null&&(Re=new e(0)),Re}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Mt(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${Ft(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${Ft(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return Ft(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},M=class extends S{constructor(e){super(),this.zoneName=e}get type(){return`invalid`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return``}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function N(e,t){if(W(e)||e===null)return t;if(e instanceof S)return e;if(ut(e)){let n=e.toLowerCase();return n==="default"?t:n===`local`||n===`system`?pe.instance:n===`utc`||n===`gmt`?j.utcInstance:j.parseSpecifier(n)||T.create(e)}else if(ct(e))return j.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new M(e)}var P={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},F={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ze=P.hanidec.replace(/[\[|\]]/g,``).split(``);function Be(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(P.hanidec)!==-1)t+=ze.indexOf(e[n]);else for(let e in F){let[n,i]=F[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}var Ve=new Map;function He(){Ve.clear()}function I({numberingSystem:e},t=``){let n=e||`latn`,r=Ve.get(n);r===void 0&&(r=new Map,Ve.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${P[n]}${t}`),r.set(t,i)),i}var Ue=()=>Date.now(),We=`system`,L=null,R=null,z=null,B=60,Ge,Ke=null,V=class{static get now(){return Ue}static set now(e){Ue=e}static set defaultZone(e){We=e}static get defaultZone(){return N(We,pe.instance)}static get defaultLocale(){return L}static set defaultLocale(e){L=e}static get defaultNumberingSystem(){return R}static set defaultNumberingSystem(e){R=e}static get defaultOutputCalendar(){return z}static set defaultOutputCalendar(e){z=e}static get defaultWeekSettings(){return Ke}static set defaultWeekSettings(e){Ke=vt(e)}static get twoDigitCutoffYear(){return B}static set twoDigitCutoffYear(e){B=e%100}static get throwOnInvalid(){return Ge}static set throwOnInvalid(e){Ge=e}static resetCaches(){A.resetCache(),T.resetCache(),$.resetCache(),He()}},H=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},qe=[0,31,59,90,120,151,181,212,243,273,304,334],Je=[0,31,60,91,121,152,182,213,244,274,305,335];function U(e,t){return new H(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Ye(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Xe(e,t,n){return n+(wt(e)?Je:qe)[t-1]}function Ze(e,t){let n=wt(e)?Je:qe,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function Qe(e,t){return(e-t+7)%7+1}function $e(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=Xe(r,i,a),s=Qe(Ye(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=kt(l,t,n)):c>kt(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...It(e)}}function et(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=Qe(Ye(r,1,t),n),s=Tt(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=Tt(l)):c>s?(l=r+1,c-=Tt(r)):l=r;let{month:u,day:d}=Ze(l,c);return{year:l,month:u,day:d,...It(e)}}function tt(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:Xe(t,n,r),...It(e)}}function nt(e){let{year:t,ordinal:n}=e,{month:r,day:i}=Ze(t,n);return{year:t,month:r,day:i,...It(e)}}function rt(e,t){if(!W(e.localWeekday)||!W(e.localWeekNumber)||!W(e.localWeekYear)){if(!W(e.weekday)||!W(e.weekNumber)||!W(e.weekYear))throw new a(`Cannot mix locale-based week fields with ISO-based week fields`);return W(e.localWeekday)||(e.weekday=e.localWeekday),W(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),W(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function it(e,t=4,n=1){let r=lt(e.weekYear),i=G(e.weekNumber,1,kt(e.weekYear,t,n)),a=G(e.weekday,1,7);return r?i?a?!1:U(`weekday`,e.weekday):U(`week`,e.weekNumber):U(`weekYear`,e.weekYear)}function at(e){let t=lt(e.year),n=G(e.ordinal,1,Tt(e.year));return t?n?!1:U(`ordinal`,e.ordinal):U(`year`,e.year)}function ot(e){let t=lt(e.year),n=G(e.month,1,12),r=G(e.day,1,Et(e.year,e.month));return t?n?r?!1:U(`day`,e.day):U(`month`,e.month):U(`year`,e.year)}function st(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=G(t,0,23)||t===24&&n===0&&r===0&&i===0,o=G(n,0,59),s=G(r,0,59),c=G(i,0,999);return a?o?s?c?!1:U(`millisecond`,i):U(`second`,r):U(`minute`,n):U(`hour`,t)}function W(e){return e===void 0}function ct(e){return typeof e==`number`}function lt(e){return typeof e==`number`&&e%1==0}function ut(e){return typeof e==`string`}function dt(e){return Object.prototype.toString.call(e)===`[object Date]`}function ft(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function pt(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function mt(e){return Array.isArray(e)?e:[e]}function ht(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function gt(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function _t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vt(e){if(e==null)return null;if(typeof e!=`object`)throw new s(`Week settings must be an object`);if(!G(e.firstDay,1,7)||!G(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!G(e,1,7)))throw new s(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function G(e,t,n){return lt(e)&&e>=t&&e<=n}function yt(e,t){return e-t*Math.floor(e/t)}function K(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function bt(e){if(!(W(e)||e===null||e===``))return parseInt(e,10)}function xt(e){if(!(W(e)||e===null||e===``))return parseFloat(e)}function St(e){if(!(W(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function Ct(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function wt(e){return e%4==0&&(e%100!=0||e%400==0)}function Tt(e){return wt(e)?366:365}function Et(e,t){let n=yt(t-1,12)+1,r=e+(t-n)/12;return n===2?wt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Dt(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Ot(e,t,n){return-Qe(Ye(e,1,t),n)+t-1}function kt(e,t=4,n=1){let r=Ot(e,t,n),i=Ot(e+1,t,n);return(Tt(e)-r+i)/7}function At(e){return e>99?e:e>V.twoDigitCutoffYear?1900+e:2e3+e}function jt(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Mt(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Nt(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new s(`Invalid unit value ${e}`);return t}function Pt(e,t){let n={};for(let r in e)if(_t(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=Nt(i)}return n}function Ft(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${K(n,2)}:${K(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${K(n,2)}${K(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function It(e){return gt(e,[`hour`,`minute`,`second`,`millisecond`])}var Lt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Rt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],zt=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function Bt(e){switch(e){case`narrow`:return[...zt];case`short`:return[...Rt];case`long`:return[...Lt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`];case`2-digit`:return[`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`12`];default:return null}}var Vt=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],Ht=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Ut=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Wt(e){switch(e){case`narrow`:return[...Ut];case`short`:return[...Ht];case`long`:return[...Vt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}var Gt=[`AM`,`PM`],Kt=[`Before Christ`,`Anno Domini`],qt=[`BC`,`AD`],Jt=[`B`,`A`];function Yt(e){switch(e){case`narrow`:return[...Jt];case`short`:return[...qt];case`long`:return[...Kt];default:return null}}function Xt(e){return Gt[e.hour<12?0:1]}function Zt(e,t){return Wt(t)[e.weekday-1]}function Qt(e,t){return Bt(t)[e.month-1]}function $t(e,t){return Yt(t)[e.year<0?0:1]}function en(e,t,n=`always`,r=!1){let i={years:[`year`,`yr.`],quarters:[`quarter`,`qtr.`],months:[`month`,`mo.`],weeks:[`week`,`wk.`],days:[`day`,`day`,`days`],hours:[`hour`,`hr.`],minutes:[`minute`,`min.`],seconds:[`second`,`sec.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function tn(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}var nn={D:f,DD:p,DDD:h,DDDD:g,t:_,tt:v,ttt:y,tttt:ee,T:te,TT:ne,TTT:re,TTTT:b,f:x,ff:ae,fff:ce,ffff:ue,F:ie,FF:oe,FFF:le,FFFF:de},q=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return nn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return K(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?Xt(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?Qt(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?Zt(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?$t(t,e):a({era:e},`era`);return tn(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return tn(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}},rn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function an(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function on(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function sn(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function cn(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=bt(t[n+i]);return[r,null,n+i]}}var ln=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,un=`(?:${ln.source}?(?:\\[(${rn.source})\\])?)?`,dn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,fn=RegExp(`${dn.source}${un}`),pn=RegExp(`(?:[Tt]${fn.source})?`),mn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,gn=/(\d{4})-?(\d{3})/,_n=cn(`weekYear`,`weekNumber`,`weekDay`),vn=cn(`year`,`ordinal`),yn=/(\d{4})-(\d\d)-(\d\d)/,bn=RegExp(`${dn.source} ?(?:${ln.source}|(${rn.source}))?`),xn=RegExp(`(?: ${bn.source})?`);function Sn(e,t,n){let r=e[t];return W(r)?n:bt(r)}function Cn(e,t){return[{year:Sn(e,t),month:Sn(e,t+1,1),day:Sn(e,t+2,1)},null,t+3]}function wn(e,t){return[{hours:Sn(e,t,0),minutes:Sn(e,t+1,0),seconds:Sn(e,t+2,0),milliseconds:St(e[t+3])},null,t+4]}function Tn(e,t){let n=!e[t]&&!e[t+1],r=Mt(e[t+1],e[t+2]);return[{},n?null:j.instance(r),t+3]}function En(e,t){return[{},e[t]?T.create(e[t]):null,t+1]}var Dn=RegExp(`^T?${dn.source}$`),On=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function kn(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(xt(n)),months:f(xt(r)),weeks:f(xt(i)),days:f(xt(a)),hours:f(xt(o)),minutes:f(xt(s)),seconds:f(xt(c),c===`-0`),milliseconds:f(St(l),d)}]}var An={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function jn(e,t,n,r,i,a,o){let s={year:t.length===2?At(bt(t)):bt(t),month:Rt.indexOf(n)+1,day:bt(r),hour:bt(i),minute:bt(a)};return o&&(s.second=bt(o)),e&&(s.weekday=e.length>3?Vt.indexOf(e)+1:Ht.indexOf(e)+1),s}var Mn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Nn(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=jn(t,i,r,n,a,o,s),p;return p=c?An[c]:l?0:Mt(u,d),[f,new j(p)]}function Pn(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}var Fn=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,In=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ln=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Rn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,i,r,n,a,o,s),j.utcInstance]}function zn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,s,n,r,i,a,o),j.utcInstance]}var Bn=an(mn,pn),Vn=an(hn,pn),Hn=an(gn,pn),Un=an(fn),Wn=on(Cn,wn,Tn,En),Gn=on(_n,wn,Tn,En),Kn=on(vn,wn,Tn,En),qn=on(wn,Tn,En);function Jn(e){return sn(e,[Bn,Wn],[Vn,Gn],[Hn,Kn],[Un,qn])}function Yn(e){return sn(Pn(e),[Mn,Nn])}function Xn(e){return sn(e,[Fn,Rn],[In,Rn],[Ln,zn])}function Zn(e){return sn(e,[On,kn])}var Qn=on(wn);function $n(e){return sn(e,[Dn,Qn])}var er=an(yn,xn),tr=an(bn),nr=on(wn,Tn,En);function rr(e){return sn(e,[er,Wn],[tr,nr])}var ir=`Invalid Duration`,ar={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},or={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ar},J=146097/400,sr=146097/4800,cr={years:{quarters:4,months:12,weeks:J/7,days:J,hours:J*24,minutes:J*24*60,seconds:J*24*60*60,milliseconds:J*24*60*60*1e3},quarters:{months:3,weeks:J/28,days:J/4,hours:J*24/4,minutes:J*24*60/4,seconds:J*24*60*60/4,milliseconds:J*24*60*60*1e3/4},months:{weeks:sr/7,days:sr,hours:sr*24,minutes:sr*24*60,seconds:sr*24*60*60,milliseconds:sr*24*60*60*1e3},...ar},lr=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],ur=lr.slice(0).reverse();function Y(e,t,n=!1){return new X({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function dr(e,t){let n=t.milliseconds??0;for(let r of ur.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function fr(e,t){let n=dr(e,t)<0?-1:1;lr.reduceRight((r,i)=>{if(W(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),lr.reduce((n,r)=>{if(W(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function pr(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var X=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?cr:or;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||A.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new s(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Pt(t,e.normalizeUnit),loc:A.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(ct(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new s(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=Zn(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=$n(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Duration is invalid`);let r=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new i(r);return new e({invalid:r})}static normalizeUnit(e){let t={year:`years`,years:`years`,quarter:`quarters`,quarters:`quarters`,month:`months`,months:`months`,week:`weeks`,weeks:`weeks`,day:`days`,days:`days`,hour:`hours`,hours:`hours`,minute:`minutes`,minutes:`minutes`,second:`seconds`,seconds:`seconds`,millisecond:`milliseconds`,milliseconds:`milliseconds`}[e&&e.toLowerCase()];if(!t)throw new o(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?q.create(this.loc,n).formatDurationFromString(this,e):ir}toHuman(e={}){if(!this.isValid)return ir;let t=e.showZeros!==!1,n=lr.map(n=>{let r=this.values[n];return W(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e=`P`;return this.years!==0&&(e+=this.years+`Y`),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+`M`),this.weeks!==0&&(e+=this.weeks+`W`),this.days!==0&&(e+=this.days+`D`),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+=`T`),this.hours!==0&&(e+=this.hours+`H`),this.minutes!==0&&(e+=this.minutes+`M`),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ct(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},$.fromMillis(t,{zone:`UTC`}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?dr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of lr)(_t(n.values,e)||_t(this.values,e))&&(r[e]=n.get(e)+this.get(e));return Y(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=Nt(e(this.values[n],n));return Y(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Pt(t,e.normalizeUnit)};return Y(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return Y(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return fr(this.matrix,e),Y(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=pr(this.normalize().shiftToAll().toObject());return Y(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of lr)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;ct(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else ct(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return fr(this.matrix,n),Y(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo(`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Y(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=pr(this.values);return Y(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of lr)if(!t(this.values[n],e.values[n]))return!1;return!0}},mr=`Invalid Interval`;function hr(e,t){return!e||!e.isValid?gr.invalid(`missing or invalid start`):!t||!t.isValid?gr.invalid(`missing or invalid end`):t<e?gr.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var gr=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Interval is invalid`);let i=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new r(i);return new e({invalid:i})}static fromDateTimes(t,n){let r=_i(t),i=_i(n);return hr(r,i)??new e({start:r,end:i})}static after(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=$.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=$.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=X.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=X.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e=`milliseconds`){return this.isValid?this.toDuration(e).get(e):NaN}count(e=`milliseconds`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t!=null&&t.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(_i).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=X.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:mr}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=f,t={}){return this.isValid?q.create(this.s.loc.clone(t),e).formatInterval(this):mr}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:mr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:mr}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:mr}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:mr}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):X.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},_r=class{static hasDST(e=V.defaultZone){let t=$.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return T.isValidZone(e)}static normalizeZone(e){return N(e,V.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return A.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return A.create(t,null,`gregory`).eras(e)}static features(){return{relative:ft(),localeWeek:pt()}}};function vr(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(X.fromMillis(r).as(`days`))}function yr(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=vr(e,t);return(n-n%7)/7}],[`days`,vr]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function br(e,t,n,r){let[i,a,o,s]=yr(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=X.fromObject(a,r);return l.length>0?X.fromMillis(c,r).shiftTo(...l).plus(u):u}var xr=`missing Intl.DateTimeFormat.formatToParts support`;function Z(e,t=e=>e){return{regex:e,deser:([e])=>t(Be(e))}}var Sr=`[ \xA0]`,Cr=new RegExp(Sr,`g`);function wr(e){return e.replace(/\./g,`\\.?`).replace(Cr,Sr)}function Tr(e){return e.replace(/\./g,``).replace(Cr,` `).toLowerCase()}function Q(e,t){return e===null?null:{regex:RegExp(e.map(wr).join(`|`)),deser:([n])=>e.findIndex(e=>Tr(n)===Tr(e))+t}}function Er(e,t){return{regex:e,deser:([,e,t])=>Mt(e,t),groups:t}}function Dr(e){return{regex:e,deser:([e])=>e}}function Or(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function kr(e,t){let n=I(t),r=I(t,`{2}`),i=I(t,`{3}`),a=I(t,`{4}`),o=I(t,`{6}`),s=I(t,`{1,2}`),c=I(t,`{1,3}`),l=I(t,`{1,6}`),u=I(t,`{1,9}`),d=I(t,`{2,4}`),f=I(t,`{4,6}`),p=e=>({regex:RegExp(Or(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return Q(t.eras(`short`),0);case`GG`:return Q(t.eras(`long`),0);case`y`:return Z(l);case`yy`:return Z(d,At);case`yyyy`:return Z(a);case`yyyyy`:return Z(f);case`yyyyyy`:return Z(o);case`M`:return Z(s);case`MM`:return Z(r);case`MMM`:return Q(t.months(`short`,!0),1);case`MMMM`:return Q(t.months(`long`,!0),1);case`L`:return Z(s);case`LL`:return Z(r);case`LLL`:return Q(t.months(`short`,!1),1);case`LLLL`:return Q(t.months(`long`,!1),1);case`d`:return Z(s);case`dd`:return Z(r);case`o`:return Z(c);case`ooo`:return Z(i);case`HH`:return Z(r);case`H`:return Z(s);case`hh`:return Z(r);case`h`:return Z(s);case`mm`:return Z(r);case`m`:return Z(s);case`q`:return Z(s);case`qq`:return Z(r);case`s`:return Z(s);case`ss`:return Z(r);case`S`:return Z(c);case`SSS`:return Z(i);case`u`:return Dr(u);case`uu`:return Dr(s);case`uuu`:return Z(n);case`a`:return Q(t.meridiems(),0);case`kkkk`:return Z(a);case`kk`:return Z(d,At);case`W`:return Z(s);case`WW`:return Z(r);case`E`:case`c`:return Z(n);case`EEE`:return Q(t.weekdays(`short`,!1),1);case`EEEE`:return Q(t.weekdays(`long`,!1),1);case`ccc`:return Q(t.weekdays(`short`,!0),1);case`cccc`:return Q(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return Er(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return Er(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return Dr(/[a-z_+-/]{1,256}?/i);case` `:return Dr(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:xr};return m.token=e,m}var Ar={year:{"2-digit":`yy`,numeric:`yyyyy`},month:{numeric:`M`,"2-digit":`MM`,short:`MMM`,long:`MMMM`},day:{numeric:`d`,"2-digit":`dd`},weekday:{short:`EEE`,long:`EEEE`},dayperiod:`a`,dayPeriod:`a`,hour12:{numeric:`h`,"2-digit":`hh`},hour24:{numeric:`H`,"2-digit":`HH`},minute:{numeric:`m`,"2-digit":`mm`},second:{numeric:`s`,"2-digit":`ss`},timeZoneName:{long:`ZZZZZ`,short:`ZZZ`}};function jr(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=Ar[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function Mr(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Nr(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(_t(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function Pr(e){let t=e=>{switch(e){case`S`:return`millisecond`;case`s`:return`second`;case`m`:return`minute`;case`h`:case`H`:return`hour`;case`d`:return`day`;case`o`:return`ordinal`;case`L`:case`M`:return`month`;case`y`:return`year`;case`E`:case`c`:return`weekday`;case`W`:return`weekNumber`;case`k`:return`weekYear`;case`q`:return`quarter`;default:return null}},n=null,r;return W(e.z)||(n=T.create(e.z)),W(e.Z)||(n||=new j(e.Z),r=e.Z),W(e.q)||(e.M=(e.q-1)*3+1),W(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),W(e.u)||(e.S=St(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}var Fr=null;function Ir(){return Fr||=$.fromMillis(1555555555555),Fr}function Lr(e,t){if(e.literal)return e;let n=Hr(q.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function Rr(e,t){return Array.prototype.concat(...e.map(e=>Lr(e,t)))}var zr=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Rr(q.parseFormat(t),e),this.units=this.tokens.map(t=>kr(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=Mr(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Nr(e,this.regex,this.handlers),[r,i,o]=n?Pr(n):[null,null,void 0];if(_t(n,`a`)&&_t(n,`H`))throw new a(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Br(e,t,n){return new zr(e,n).explainFromTokens(t)}function Vr(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=Br(e,t,n);return[r,i,a,o]}function Hr(e,t){if(!e)return null;let n=q.create(t,e).dtFormatter(Ir()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>jr(t,e,i))}var Ur=`Invalid DateTime`,Wr=864e13;function Gr(e){return new H(`unsupported zone`,`the zone "${e.name}" is not supported`)}function Kr(e){return e.weekData===null&&(e.weekData=$e(e.c)),e.weekData}function qr(e){return e.localWeekData===null&&(e.localWeekData=$e(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Jr(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new $({...n,...t,old:n})}function Yr(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Xr(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Zr(e,t,n){return Yr(Dt(e),t,n)}function Qr(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,Et(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=X.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=Yr(Dt(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function $r(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=$.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return $.invalid(new H(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function ei(e,t,n=!0){return e.isValid?q.create(A.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function ti(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=K(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=K(e.c.month),n===`month`)return i;i+=`-`}else if(i+=K(e.c.month),n===`month`)return i;return i+=K(e.c.day),i}function ni(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=K(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=K(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=K(e.c.second))}else{if(c+=K(e.c.minute),o===`minute`)break;s&&(c+=K(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=K(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=K(Math.trunc(-e.o/60)),c+=`:`,c+=K(Math.trunc(-e.o%60))):(c+=`+`,c+=K(Math.trunc(e.o/60)),c+=`:`,c+=K(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}var ri={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ii={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ai={ordinal:1,hour:0,minute:0,second:0,millisecond:0},oi=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],si=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],ci=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function li(e){let t={year:`year`,years:`year`,month:`month`,months:`month`,day:`day`,days:`day`,hour:`hour`,hours:`hour`,minute:`minute`,minutes:`minute`,quarter:`quarter`,quarters:`quarter`,second:`second`,seconds:`second`,millisecond:`millisecond`,milliseconds:`millisecond`,weekday:`weekday`,weekdays:`weekday`,weeknumber:`weekNumber`,weeksnumber:`weekNumber`,weeknumbers:`weekNumber`,weekyear:`weekYear`,weekyears:`weekYear`,ordinal:`ordinal`}[e.toLowerCase()];if(!t)throw new o(e);return t}function ui(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return li(e)}}function di(e){if(hi===void 0&&(hi=V.now()),e.type!==`iana`)return e.offset(hi);let t=e.name,n=gi.get(t);return n===void 0&&(n=e.offset(hi),gi.set(t,n)),n}function fi(e,t){let n=N(t.zone,V.defaultZone);if(!n.isValid)return $.invalid(Gr(n));let r=A.fromObject(t),i,a;if(W(e.year))i=V.now();else{for(let t of oi)W(e[t])&&(e[t]=ri[t]);let t=ot(e)||st(e);if(t)return $.invalid(t);let r=di(n);[i,a]=Zr(e,r,n)}return new $({ts:i,zone:n,loc:r,o:a})}function pi(e,t,n){let r=W(n.round)?!0:n.round,i=W(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=Ct(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function mi(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}var hi,gi=new Map,$=class e{constructor(e){let t=e.zone||V.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new H(`invalid input`):null)||(t.isValid?null:Gr(t));this.ts=W(e.ts)?V.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=ct(e.o)&&!e.old?e.o:t.offset(this.ts);r=Xr(this.ts,a),n=Number.isNaN(r.year)?new H(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||A.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return e.zone=j.utcInstance,fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=dt(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=N(n.zone,V.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:A.fromObject(n)}):e.invalid(Gr(i))}static fromMillis(t,n={}){if(!ct(t))throw new s(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-864e13||t>Wr?e.invalid(`Timestamp out of range`):new e({ts:t,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)})}static fromSeconds(t,n={}){if(ct(t))return new e({ts:t*1e3,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)});throw new s(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t||={};let r=N(n.zone,V.defaultZone);if(!r.isValid)return e.invalid(Gr(r));let i=A.fromObject(n),o=Pt(t,ui),{minDaysInFirstWeek:s,startOfWeek:c}=rt(o,i),l=V.now(),u=W(n.specificOffset)?r.offset(l):n.specificOffset,d=!W(o.ordinal),f=!W(o.year),p=!W(o.month)||!W(o.day),m=f||p,h=o.weekYear||o.weekNumber;if((m||d)&&h)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(p&&d)throw new a(`Can't mix ordinal dates with month/day`);let g=h||o.weekday&&!m,_,v,y=Xr(l,u);g?(_=si,v=ii,y=$e(y,s,c)):d?(_=ci,v=ai,y=tt(y)):(_=oi,v=ri);let ee=!1;for(let e of _){let t=o[e];W(t)?ee?o[e]=v[e]:o[e]=y[e]:ee=!0}let te=(g?it(o,s,c):d?at(o):ot(o))||st(o);if(te)return e.invalid(te);let[ne,re]=Zr(g?et(o,s,c):d?nt(o):o,u,r),b=new e({ts:ne,zone:r,o:re,loc:i});return o.weekday&&m&&t.weekday!==b.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${o.weekday} and a date of ${b.toISO()}`):b.isValid?b:e.invalid(b.invalid)}static fromISO(e,t={}){let[n,r]=Jn(e);return $r(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=Yn(e);return $r(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=Xn(e);return $r(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,c,l,u]=Vr(A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return u?e.invalid(u):$r(o,c,r,`format ${n}`,t,l)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=rr(e);return $r(n,r,t,`SQL`,e)}static invalid(t,r=null){if(!t)throw new s(`need to specify a reason the DateTime is invalid`);let i=t instanceof H?t:new H(t,r);if(V.throwOnInvalid)throw new n(i);return new e({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Hr(e,A.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return Rr(q.parseFormat(e),A.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){hi=void 0,gi.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Kr(this).weekYear:NaN}get weekNumber(){return this.isValid?Kr(this).weekNumber:NaN}get weekday(){return this.isValid?Kr(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?qr(this).weekday:NaN}get localWeekNumber(){return this.isValid?qr(this).weekNumber:NaN}get localWeekYear(){return this.isValid?qr(this).weekYear:NaN}get ordinal(){return this.isValid?tt(this.c).ordinal:NaN}get monthShort(){return this.isValid?_r.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?_r.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?_r.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?_r.weekdays(`long`,{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:`short`,locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:`long`,locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=Dt(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=Xr(s,a),u=Xr(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[Jr(this,{ts:s}),Jr(this,{ts:c})]:[this]}get isInLeapYear(){return wt(this.year)}get daysInMonth(){return Et(this.year,this.month)}get daysInYear(){return this.isValid?Tt(this.year):NaN}get weeksInWeekYear(){return this.isValid?kt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?kt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=q.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(j.instance(e),t)}toLocal(){return this.setZone(V.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=N(t,V.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=Zr(r,n,t)}return Jr(this,{ts:e,zone:t})}else return e.invalid(Gr(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Jr(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Pt(e,ui),{minDaysInFirstWeek:n,startOfWeek:r}=rt(t,this.loc),i=!W(t.weekYear)||!W(t.weekNumber)||!W(t.weekday),o=!W(t.ordinal),s=!W(t.year),c=!W(t.month)||!W(t.day),l=s||c,u=t.weekYear||t.weekNumber;if((l||o)&&u)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(c&&o)throw new a(`Can't mix ordinal dates with month/day`);let d;i?d=et({...$e(this.c,n,r),...t},n,r):W(t.ordinal)?(d={...this.toObject(),...t},W(t.day)&&(d.day=Math.min(Et(d.year,d.month),d.day))):d=nt({...tt(this.c),...t});let[f,p]=Zr(d,this.o,this.zone);return Jr(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e);return Jr(this,Qr(this,t))}minus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e).negate();return Jr(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=X.normalizeUnit(e);switch(r){case`years`:n.month=1;case`quarters`:case`months`:n.day=1;case`weeks`:case`days`:n.hour=0;case`hours`:n.minute=0;case`minutes`:n.second=0;case`seconds`:n.millisecond=0;break}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?q.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ur}toLocaleString(e=f,t={}){return this.isValid?q.create(this.loc.clone(t),e).formatDateTime(this):Ur}toLocaleParts(e={}){return this.isValid?q.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=li(a);let o=e===`extended`,s=ti(this,o,a);return oi.indexOf(a)>=3&&(s+=`T`),s+=ni(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?ti(this,e===`extended`,li(t)):null}toISOWeekDate(){return ei(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=li(o),(r&&oi.indexOf(o)>=3?`T`:``)+ni(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return ei(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return ei(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?ti(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),ei(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ur}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return X.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=mt(t).map(X.normalizeUnit),a=e.valueOf()>this.valueOf(),o=br(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?gr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),pi(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?pi(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new s(`min requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new s(`max requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return Br(A.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new zr(A.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new s(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:c,zone:l,specificOffset:u,invalidReason:d}=n.explainFromTokens(t);return d?e.invalid(d):$r(c,l,r,`format ${n.format}`,t,u)}static get DATE_SHORT(){return f}static get DATE_MED(){return p}static get DATE_MED_WITH_WEEKDAY(){return m}static get DATE_FULL(){return h}static get DATE_HUGE(){return g}static get TIME_SIMPLE(){return _}static get TIME_WITH_SECONDS(){return v}static get TIME_WITH_SHORT_OFFSET(){return y}static get TIME_WITH_LONG_OFFSET(){return ee}static get TIME_24_SIMPLE(){return te}static get TIME_24_WITH_SECONDS(){return ne}static get TIME_24_WITH_SHORT_OFFSET(){return re}static get TIME_24_WITH_LONG_OFFSET(){return b}static get DATETIME_SHORT(){return x}static get DATETIME_SHORT_WITH_SECONDS(){return ie}static get DATETIME_MED(){return ae}static get DATETIME_MED_WITH_SECONDS(){return oe}static get DATETIME_MED_WITH_WEEKDAY(){return se}static get DATETIME_FULL(){return ce}static get DATETIME_FULL_WITH_SECONDS(){return le}static get DATETIME_HUGE(){return ue}static get DATETIME_HUGE_WITH_SECONDS(){return de}};function _i(e){if($.isDateTime(e))return e;if(e&&e.valueOf&&ct(e.valueOf()))return $.fromJSDate(e);if(e&&typeof e==`object`)return $.fromObject(e);throw new s(`Unknown datetime argument: ${e}, of type ${typeof e}`)}e.DateTime=$,e.Duration=X,e.FixedOffsetZone=j,e.IANAZone=T,e.Info=_r,e.Interval=gr,e.InvalidZone=M,e.Settings=V,e.SystemZone=pe,e.VERSION=`3.7.2`,e.Zone=S})),le=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;var t=ce(),n;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.Day=`Day`,e.Month=`Month`,e.Year=`Year`})(n||(e.TimeUnit=n={}));var r;(function(e){e.Add=`Add`,e.Subtract=`Subtract`})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var i=class i{#e;#t=null;#n=null;#r={add:{[n.Year]:this.addYear.bind(this),[n.Month]:this.addMonth.bind(this),[n.Day]:this.addDay.bind(this),[n.Hour]:this.addHour.bind(this),[n.Minute]:this.addMinute.bind(this),[n.Second]:this.addSecond.bind(this)},subtract:{[n.Year]:this.subtractYear.bind(this),[n.Month]:this.subtractMonth.bind(this),[n.Day]:this.subtractDay.bind(this),[n.Hour]:this.subtractHour.bind(this),[n.Minute]:this.subtractMinute.bind(this),[n.Second]:this.subtractSecond.bind(this)}};constructor(e,n){let r={zone:n};if(e?e instanceof i?(this.#e=e.#e,this.#t=e.#t,this.#n=e.#n):e instanceof Date?this.#e=t.DateTime.fromJSDate(e,r):typeof e==`number`?this.#e=t.DateTime.fromMillis(e,r):(this.#e=t.DateTime.fromISO(e,r),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(e,`EEE, d MMM yyyy HH:mm:ss`,r))):this.#e=t.DateTime.local(),!this.#e.isValid)throw Error(`CronDate: unhandled timestamp: ${e}`);n&&n!==this.#e.zoneName&&(this.#e=this.#e.setZone(n))}static#i(e){return e%4==0&&e%100!=0||e%400==0}get dstStart(){return this.#t}set dstStart(e){this.#t=e}get dstEnd(){return this.#n}set dstEnd(e){this.#n=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf(`month`)}addDay(){this.#e=this.#e.plus({days:1}).startOf(`day`)}addHour(){this.#e=this.#e.plus({hours:1}).startOf(`hour`)}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf(`minute`)}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf(`month`).startOf(`second`)}subtractDay(){this.#e=this.#e.minus({days:1}).endOf(`day`).startOf(`second`)}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf(`hour`).startOf(`second`)}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf(`minute`).startOf(`second`)}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){this.#r.add[e]()}subtractUnit(e){this.#r.subtract[e]()}invokeDateOperation(e,t){if(e===r.Add){this.addUnit(t);return}if(e===r.Subtract){this.subtractUnit(t);return}throw Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf(`day`)}setEndOfDay(){this.#e=this.#e.endOf(`day`)}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#a().day}getUTCFullYear(){return this.#a().year}getUTCDay(){let e=this.#a().weekday;return e===7?0:e}getUTCMonth(){return this.#a().month-1}getUTCHours(){return this.#a().hour}getUTCMinutes(){return this.#a().minute}getUTCSeconds(){return this.#a().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:t,month:n}=this.#e;if(n===2){let r=i.#i(this.#e.year);return t===e.DAYS_IN_MONTH[n-1]-+!r}return t===e.DAYS_IN_MONTH[n-1]}isLastWeekdayOfMonth(){let{day:t,month:n}=this.#e,r;return r=n===2?e.DAYS_IN_MONTH[n-1]-+!i.#i(this.#e.year):e.DAYS_IN_MONTH[n-1],t>r-7}applyDateOperation(e,t,r){if(t===n.Month||t===n.Day){this.invokeDateOperation(e,t);return}let i=this.getHours();this.invokeDateOperation(e,t);let a=this.getHours(),o=a-i;o===2?r!==24&&(this.dstStart=a):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&r!==24&&(this.dstEnd=a)}#a(){return this.#e.toUTC()}};e.CronDate=i,e.default=i})),ue=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMonth=void 0;var t=le(),n=x(),r=1,i=12,a=Object.freeze([]);e.CronMonth=class extends n.CronField{static get min(){return r}static get max(){return i}static get chars(){return a}static get daysInMonth(){return t.DAYS_IN_MONTH}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),de=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronSecond=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronSecond=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),S=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(b(),e),n(ie(),e),n(ae(),e),n(x(),e),n(oe(),e),n(se(),e),n(ue(),e),n(de(),e)})),fe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronFieldCollection=void 0;var t=S();e.CronFieldCollection=class e{#e;#t;#n;#r;#i;#a;static from(n,r){return new e({second:this.resolveField(t.CronSecond,n.second,r.second),minute:this.resolveField(t.CronMinute,n.minute,r.minute),hour:this.resolveField(t.CronHour,n.hour,r.hour),dayOfMonth:this.resolveField(t.CronDayOfMonth,n.dayOfMonth,r.dayOfMonth),month:this.resolveField(t.CronMonth,n.month,r.month),dayOfWeek:this.resolveField(t.CronDayOfWeek,n.dayOfWeek,r.dayOfWeek)})}static resolveField(e,n,r){return r?r instanceof t.CronField?r:new e(r):n}constructor({second:e,minute:n,hour:r,dayOfMonth:i,month:a,dayOfWeek:o}){if(!e)throw Error(`Validation error, Field second is missing`);if(!n)throw Error(`Validation error, Field minute is missing`);if(!r)throw Error(`Validation error, Field hour is missing`);if(!i)throw Error(`Validation error, Field dayOfMonth is missing`);if(!a)throw Error(`Validation error, Field month is missing`);if(!o)throw Error(`Validation error, Field dayOfWeek is missing`);if(a.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=t.CronMonth.daysInMonth[a.values[0]-1]))throw Error(`Invalid explicit day of month definition`);this.#e=e,this.#t=n,this.#n=r,this.#i=a,this.#a=o,this.#r=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#r}get month(){return this.#i}get dayOfWeek(){return this.#a}static compactField(e){if(e.length===0)return[];let t=[],n;return e.forEach((e,r,i)=>{if(n===void 0){n={start:e,count:1};return}let a=i[r-1]||n.start,o=i[r+1];if(e===`L`||e===`W`){t.push(n),t.push({start:e,count:1}),n=void 0;return}if(n.step===void 0&&o!==void 0){let t=e-a;if(t<=o-e){n={...n,count:2,end:e,step:t};return}n.step=1}e-(n.end??0)===n.step?(n.count++,n.end=e):(n.count===1?t.push({start:n.start,count:1}):n.count===2?(t.push({start:n.start,count:1}),t.push({start:n.end??a,count:1})):t.push(n),n={start:e,count:1})}),n&&t.push(n),t}static#o(e,t,n){let r=t.step;return r?r===1&&t.start===e.min&&t.end&&t.end>=n?e.hasQuestionMarkChar?`?`:`*`:r!==1&&t.start===e.min&&t.end&&t.end>=n-r+1?`*/${r}`:null:null}static#s(e,t){let n=e.step;if(n===1)return`${e.start}-${e.end}`;let r=e.start===0?e.count-1:e.count;if(!n)throw Error(`Unexpected range step`);if(!e.end)throw Error(`Unexpected range end`);if(n*r>e.end){let t=(t,r)=>{if(typeof e.start!=`number`)throw Error(`Unexpected range start`);return r%n===0?e.start+r:null};if(typeof e.start!=`number`)throw Error(`Unexpected range start`);let r={length:e.end-e.start+1};return Array.from(r,t).filter(e=>e!==null).join(`,`)}return e.end===t-n+1?`${e.start}/${n}`:`${e.start}-${e.end}/${n}`}stringifyField(n){let r=n.max,i=n.values;if(n instanceof t.CronDayOfWeek){r=6;let e=this.#a.values;i=e[e.length-1]===7?e.slice(0,-1):e}n instanceof t.CronDayOfMonth&&(r=this.#i.values.length===1?t.CronMonth.daysInMonth[this.#i.values[0]-1]:n.max);let a=e.compactField(i);if(a.length===1){let t=e.#o(n,a[0],r);if(t)return t}return a.map(i=>{let a=i.count===1?i.start.toString():e.#s(i,r);return n instanceof t.CronDayOfWeek&&n.nthDay>0?`${a}#${n.nthDay}`:a}).join(`,`)}stringify(e=!1){let t=[];return e&&t.push(this.stringifyField(this.#e)),t.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#a)),t.join(` `)}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#r.serialize(),month:this.#i.serialize(),dayOfWeek:this.#a.serialize()}}}})),pe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var t=le();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=`Out of the time span range`,e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=`Invalid expression, loop limit exceeded`;var n=1e4,r=class r{#e;#t;#n;#r;#i;#a;#o=null;#s=!1;constructor(e,n){this.#e=n,this.#t=n.tz,this.#r=n.startDate?new t.CronDate(n.startDate,this.#t):null,this.#i=n.endDate?new t.CronDate(n.endDate,this.#t):null;let r=n.currentDate??n.startDate;if(r){let e=new t.CronDate(r,this.#t);this.#r&&e.getTime()<this.#r.getTime()?r=this.#r:this.#i&&e.getTime()>this.#i.getTime()&&(r=this.#i)}this.#n=new t.CronDate(r,this.#t),this.#a=e}get fields(){return this.#a}static fieldsToExpression(e,t){return new r(e,t||{})}static#c(e,t){return t.some(t=>t===e)}#l(e,t){return e[t?e.length-1:0]}#u(e){let n=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#o===n)return this.#s;let r=new t.CronDate(e);r.setStartOfDay();let i=new t.CronDate(e);return i.setEndOfDay(),this.#o=n,this.#s=r.getUTCOffset()!==i.getUTCOffset(),this.#s}#d(e,n,r){let i=this.#a.second.values,a=e.getSeconds(),o=this.#a.second.findNearestValue(a,r);if(o!==null){e.setSeconds(o);return}e.applyDateOperation(n,t.TimeUnit.Minute,this.#a.hour.values.length),e.setSeconds(this.#l(i,r))}#f(e,n,r){let i=this.#a.minute.values,a=this.#a.second.values,o=e.getMinutes(),s=this.#a.minute.findNearestValue(o,r);if(s!==null){e.setMinutes(s),e.setSeconds(this.#l(a,r));return}e.applyDateOperation(n,t.TimeUnit.Hour,this.#a.hour.values.length),e.setMinutes(this.#l(i,r)),e.setSeconds(this.#l(a,r))}static#p(e,t){let n=t.isLastWeekdayOfMonth();return e.some(e=>{let r=parseInt(e.toString().charAt(0),10)%7;if(Number.isNaN(r))throw Error(`Invalid last weekday of the month expression: ${e}`);return t.getDay()===r&&n})}next(){return this.#_()}prev(){return this.#_(!0)}hasNext(){let e=this.#n;try{return this.#_(),!0}catch{return!1}finally{this.#n=e}}hasPrev(){let e=this.#n;try{return this.#_(!0),!0}catch{return!1}finally{this.#n=e}}take(e){let t=[];if(e>=0)for(let n=0;n<e;n++)try{t.push(this.next())}catch{return t}else for(let n=0;n>e;n--)try{t.push(this.prev())}catch{return t}return t}reset(e){this.#n=new t.CronDate(e||this.#e.currentDate)}stringify(e=!1){return this.#a.stringify(e)}includesDate(e){let{second:n,minute:r,hour:i,month:a}=this.#a,o=new t.CronDate(e,this.#t);return!(!n.values.includes(o.getSeconds())||!r.values.includes(o.getMinutes())||!i.values.includes(o.getHours())||!a.values.includes(o.getMonth()+1)||!this.#m(o)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(o.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(e){let t=this.#a.dayOfMonth.isWildcard,n=!t,i=this.#a.dayOfWeek.isWildcard,a=!i,o=r.#c(e.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),s=r.#c(e.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#p(this.#a.dayOfWeek.values,e);return!!(n&&a&&(o||s)||o&&!a||t&&!i&&s)}#h(e,n,i){let a=this.#a.hour.values,o=a,s=e.getHours(),c=r.#c(s,a),l=e.dstStart===s,u=e.dstEnd===s;if(l)return r.#c(s-1,a)?!0:(e.invokeDateOperation(n,t.TimeUnit.Hour),!1);if(u&&!i)return e.dstEnd=null,e.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,o.length),!1;if(c)return!0;e.dstStart=null;let d=this.#a.hour.findNearestValue(s,i);if(d===null)return e.applyDateOperation(n,t.TimeUnit.Day,o.length),!1;if(this.#u(e)){let r=i?s-d:d-s;for(let i=0;i<r;i++)e.applyDateOperation(n,t.TimeUnit.Hour,o.length)}else e.setHours(d);return e.setMinutes(this.#l(this.#a.minute.values,i)),e.setSeconds(this.#l(this.#a.second.values,i)),!1}#g(t){if(!this.#r&&!this.#i)return;let n=t.getTime();if(this.#r&&n<this.#r.getTime()||this.#i&&n>this.#i.getTime())throw Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#_(i=!1){let a=i?t.DateMathOp.Subtract:t.DateMathOp.Add,o=new t.CronDate(this.#n),s=o.getTime(),c=0;for(;++c<n;){if(this.#g(o),!this.#m(o)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(o.getDate()/7)===this.#a.dayOfWeek.nthDay)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(o.getMonth()+1,this.#a.month.values)){o.applyDateOperation(a,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#h(o,a,i)){if(!r.#c(o.getMinutes(),this.#a.minute.values)){this.#f(o,a,i);continue}if(!r.#c(o.getSeconds(),this.#a.second.values)){this.#d(o,a,i);continue}if(s===o.getTime()){(a===`Add`||o.getMilliseconds()===0)&&o.applyDateOperation(a,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(c>n)throw Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return o.getMilliseconds()!==0&&o.setMilliseconds(0),this.#n=o,o}[Symbol.iterator](){return{next:()=>({value:this.#_(),done:!this.hasNext()})}}};e.CronExpression=r,e.default=r})),me=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.seededRandom=r;function t(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>t>>>0}function n(e){return()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function r(e){return n(e?t(e)():Math.floor(Math.random()*1e10))}})),C=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpressionParser=e.DayOfWeek=e.Months=e.CronUnit=e.PredefinedExpressions=void 0;var t=fe(),n=pe(),r=me(),i=S(),a;(function(e){e[`@yearly`]=`0 0 0 1 1 *`,e[`@annually`]=`0 0 0 1 1 *`,e[`@monthly`]=`0 0 0 1 * *`,e[`@weekly`]=`0 0 0 * * 0`,e[`@daily`]=`0 0 0 * * *`,e[`@hourly`]=`0 0 * * * *`,e[`@minutely`]=`0 * * * * *`,e[`@secondly`]=`* * * * * *`,e[`@weekdays`]=`0 0 0 * * 1-5`,e[`@weekends`]=`0 0 0 * * 0,6`})(a||(e.PredefinedExpressions=a={}));var o;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.DayOfMonth=`DayOfMonth`,e.Month=`Month`,e.DayOfWeek=`DayOfWeek`})(o||(e.CronUnit=o={}));var s;(function(e){e[e.jan=1]=`jan`,e[e.feb=2]=`feb`,e[e.mar=3]=`mar`,e[e.apr=4]=`apr`,e[e.may=5]=`may`,e[e.jun=6]=`jun`,e[e.jul=7]=`jul`,e[e.aug=8]=`aug`,e[e.sep=9]=`sep`,e[e.oct=10]=`oct`,e[e.nov=11]=`nov`,e[e.dec=12]=`dec`})(s||(e.Months=s={}));var c;(function(e){e[e.sun=0]=`sun`,e[e.mon=1]=`mon`,e[e.tue=2]=`tue`,e[e.wed=3]=`wed`,e[e.thu=4]=`thu`,e[e.fri=5]=`fri`,e[e.sat=6]=`sat`})(c||(e.DayOfWeek=c={})),e.CronExpressionParser=class e{static parse(s,c={}){let{strict:l=!1,hashSeed:u}=c,d=(0,r.seededRandom)(u);s=a[s]||s;let f=e.#e(s,l);if(!(f.dayOfMonth===`*`||f.dayOfWeek===`*`||!l))throw Error(`Cannot use both dayOfMonth and dayOfWeek together in strict mode!`);let p=e.#t(o.Second,f.second,i.CronSecond.constraints,d),m=e.#t(o.Minute,f.minute,i.CronMinute.constraints,d),h=e.#t(o.Hour,f.hour,i.CronHour.constraints,d),g=e.#t(o.Month,f.month,i.CronMonth.constraints,d),_=e.#t(o.DayOfMonth,f.dayOfMonth,i.CronDayOfMonth.constraints,d),{dayOfWeek:v,nthDayOfWeek:y}=e.#u(f.dayOfWeek),ee=e.#t(o.DayOfWeek,v,i.CronDayOfWeek.constraints,d),te=new t.CronFieldCollection({second:new i.CronSecond(p,{rawValue:f.second}),minute:new i.CronMinute(m,{rawValue:f.minute}),hour:new i.CronHour(h,{rawValue:f.hour}),dayOfMonth:new i.CronDayOfMonth(_,{rawValue:f.dayOfMonth}),month:new i.CronMonth(g,{rawValue:f.month}),dayOfWeek:new i.CronDayOfWeek(ee,{rawValue:f.dayOfWeek,nthDayOfWeek:y})});return new n.CronExpression(te,{...c,expression:s})}static#e(e,t){if(t&&!e.length)throw Error(`Invalid cron expression`);e||=`0 * * * * *`;let n=e.trim().split(/\s+/);if(t&&n.length<6)throw Error(`Invalid cron expression, expected 6 fields`);if(n.length>6)throw Error(`Invalid cron expression, too many fields`);let r=[`*`,`*`,`*`,`*`,`*`,`0`];n.length<r.length&&n.unshift(...r.slice(n.length));let[i,a,o,s,c,l]=n;return{second:i,minute:a,hour:o,dayOfMonth:s,month:c,dayOfWeek:l}}static#t(e,t,n,r){if((e===o.Month||e===o.DayOfWeek)&&(t=t.replace(/[a-z]{3}/gi,e=>{e=e.toLowerCase();let t=s[e]||c[e];if(t===void 0)throw Error(`Validation error, cannot resolve alias "${e}"`);return t.toString()})),!n.validChars.test(t))throw Error(`Invalid characters, got value: ${t}`);return t=this.#n(t,n),t=this.#r(t,n,r),this.#i(e,t,n)}static#n(e,t){return e.replace(/[*?]/g,t.min+`-`+t.max)}static#r(e,t,n){let r=n();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(e,n,i,a)=>{if(n&&i&&a){let e=parseInt(n,10),o=parseInt(i,10),s=parseInt(a,10);if(e>o)throw Error(`Invalid range: ${e}-${o}, min > max`);if(s<=0)throw Error(`Invalid step: ${s}, must be positive`);let c=Math.max(e,t.min),l=Math.floor(r*s),u=[];for(let e=Math.floor(c/s)*s+l;e<=o;e+=s)e>=c&&u.push(e);return u.join(`,`)}else if(n&&i){let e=parseInt(n,10),t=parseInt(i,10);if(e>t)throw Error(`Invalid range: ${e}-${t}, min > max`);return String(Math.floor(r*(t-e+1))+e)}else if(a){let e=parseInt(a,10);if(e<=0)throw Error(`Invalid step: ${e}, must be positive`);let n=Math.floor(r*e),i=[];for(let r=Math.floor(t.min/e)*e+n;r<=t.max;r+=e)r>=t.min&&i.push(r);return i.join(`,`)}else return String(Math.floor(r*(t.max-t.min+1)+t.min))})}static#i(t,n,r){let i=[];function a(n,r){if(Array.isArray(n))i.push(...n);else if(e.#d(r,n))i.push(n);else{let e=parseInt(n.toString(),10);if(!(e>=r.min&&e<=r.max))throw Error(`Constraint error, got value ${n} expected range ${r.min}-${r.max}`);i.push(t===o.DayOfWeek?e%7:n)}}return n.split(`,`).forEach(n=>{if(!(n.length>0))throw Error(`Invalid list value format`);a(e.#a(t,n,r),r)}),i}static#a(t,n,r){let i=n.split(`/`);if(i.length>2)throw Error(`Invalid repeat: ${n}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${r.max}`),e.#l(t,i[0],parseInt(i[1],10),r)):e.#l(t,n,1,r)}static#o(e,t,n){if(!(!isNaN(e)&&!isNaN(t)&&e>=n.min&&t<=n.max))throw Error(`Constraint error, got range ${e}-${t} expected range ${n.min}-${n.max}`);if(e>t)throw Error(`Invalid range: ${e}-${t}, min(${e}) > max(${t})`)}static#s(e){if(!(!isNaN(e)&&e>0))throw Error(`Constraint error, cannot repeat at every ${e} time.`)}static#c(e,t,n,r){let i=[];e===o.DayOfWeek&&n%7==0&&i.push(0);for(let e=t;e<=n;e+=r)i.indexOf(e)===-1&&i.push(e);return i}static#l(e,t,n,r){let i=t.split(`-`);if(i.length<=1)return isNaN(+t)?t:+t;let[a,o]=i.map(e=>parseInt(e,10));return this.#o(a,o,r),this.#s(n),this.#c(e,a,o,n)}static#u(e){let t=e.split(`#`);if(t.length<=1)return{dayOfWeek:t[0]};let n=+t[t.length-1],r=e.match(/([,-/])/);if(r!==null)throw Error(`Constraint error, invalid dayOfWeek \`#\` and \`${r?.[0]}\` special characters are incompatible`);if(!(t.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw Error(`Constraint error, invalid dayOfWeek occurrence number (#)`);return{dayOfWeek:t[0],nthDayOfWeek:n}}static#d(e,t){return e.chars.some(e=>t.toString().includes(e))}}})),he=t(((e,t)=>{t.exports={}})),w=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})();Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=void 0;var i=C();e.CronFileParser=class e{static async parseFile(t){let{readFile:n}=await Promise.resolve().then(()=>r(he())),i=await n(t,`utf8`);return e.#e(i)}static parseFileSync(t){let{readFileSync:n}=he(),r=n(t,`utf8`);return e.#e(r)}static#e(t){let n=t.split(`
2
- `),r={variables:{},expressions:[],errors:{}};for(let t of n){let n=t.trim();if(n.length===0||n.startsWith(`#`))continue;let i=n.match(/^(.*)=(.*)$/);if(i){let[,e,t]=i;r.variables[e]=t.replace(/["']/g,``);continue}try{let t=e.#t(n);r.expressions.push(t.interval)}catch(e){r.errors[n]=e}}return r}static#t(e){let t=e.split(` `);return{interval:i.CronExpressionParser.parse(t.slice(0,5).join(` `)),command:t.slice(5,t.length)}}}})),ge=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;var r=C(),i=le();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return i.CronDate}});var a=fe();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var o=pe();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return o.CronExpression}});var s=C();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var c=w();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return c.CronFileParser}}),n(S(),e),e.default=r.CronExpressionParser})),_e=ge();function T(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function E(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function ve(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function ye(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function be(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function xe(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:T(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=_e.CronExpressionParser.parse(t).fields,r=E(e.minute.values),i=E(e.hour.values),a=E(e.dayOfMonth.values),o=E(e.month.values),s=E(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=ve(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=ve(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],c=a[0],l=`${e}-${String(s).padStart(2,`0`)}-${String(c).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:l,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:be(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function Se(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${ye(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}export{ge as a,ve as i,xe as n,te as o,E as r,Se as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,o as a,p as ee,s as te}from"./popover-select-CKBYnT3c.js";import{n as ne}from"./locale-store-BThkG0W5.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as re,r as ie}from"./settings-shell-layer-context-DCp6ykjQ.js";import{du as ae,pu as oe,uu as se}from"./index-OMnem2nr.js";var ce=e(t(),1),le=n();function s(e){return String(e).padStart(2,`0`)}function ue(e){return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}function de(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function fe(e,t){let n=de(e);return n?t===`zh`?`${n.getFullYear()}/${s(n.getMonth()+1)}/${s(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var c=r();function pe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function l(e){let t=(0,le.c)(103),{value:n,onChange:r,disabled:s,className:l,ariaLabel:ve,placeholder:ye}=e,u=ne(_e),d=u===`zh`?`zh-CN`:`en`,f;t[0]===n?f=t[1]:(f=de(n),t[0]=n,t[1]=f);let p=f,[m,be]=(0,ce.useState)(!1),h;t[2]===p?h=t[3]:(h=()=>p??new Date,t[2]=p,t[3]=h);let[g,xe]=(0,ce.useState)(h),Se=ie(),Ce=a(re(),Se!==null),_=+(u===`zh`),v,y;t[4]!==m||t[5]!==n?(v=()=>{if(!m)return;let e=de(n);e&&xe(e)},y=[m,n],t[4]=m,t[5]=n,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,ce.useEffect)(v,y);let b;t[8]!==g||t[9]!==_?(b=pe(g,_),t[8]=g,t[9]=_,t[10]=b):b=t[10];let we=b,x;if(t[11]!==d||t[12]!==_){let e=new Date(2026,7,23,12);x=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+_+n),new Intl.DateTimeFormat(d,{weekday:`narrow`}).format(r)}),t[11]=d,t[12]=_,t[13]=x}else x=t[13];let Te=x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=ue(new Date),t[14]=S):S=t[14];let C=S,w;t[15]===p?w=t[16]:(w=p?ue(p):``,t[15]=p,t[16]=w);let T=w,E;t[17]!==d||t[18]!==g?(E=new Intl.DateTimeFormat(d,{year:`numeric`,month:`long`}).format(g),t[17]=d,t[18]=g,t[19]=E):E=t[19];let Ee=E,D;t[20]===r?D=t[21]:(D=e=>{r(e),be(!1)},t[20]=r,t[21]=D);let O=D,De=ee,Oe=s&&`cursor-not-allowed opacity-50`,k;t[22]!==l||t[23]!==Oe?(k=o(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,Oe,l),t[22]=l,t[23]=Oe,t[24]=k):k=t[24];let ke=!n&&`text-fg-subtle`,A;t[25]===ke?A=t[26]:(A=o(`min-w-0 truncate tabular-nums`,ke),t[25]=ke,t[26]=A);let j;t[27]!==u||t[28]!==ye||t[29]!==n?(j=fe(n,u)||ye||(u===`zh`?`选择日期`:`Select date`),t[27]=u,t[28]=ye,t[29]=n,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,c.jsx)(`span`,{className:A,children:j}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,c.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=N):N=t[34];let P;t[35]!==ve||t[36]!==s||t[37]!==k||t[38]!==M?(P=(0,c.jsx)(i,{asChild:!0,children:(0,c.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":ve,className:k,children:[M,N]})}),t[35]=ve,t[36]=s,t[37]=k,t[38]=M,t[39]=P):P=t[39];let Ae=ee,je=Se??void 0,Me=ee,Ne=o(Ce,`w-[19rem] rounded-2xl bg-surface-panel p-3 shadow-float outline-none`),Pe=u===`zh`?`上个月`:`Previous month`,F,I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>xe(ge),I=(0,c.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[40]=F,t[41]=I):(F=t[40],I=t[41]);let L;t[42]===Pe?L=t[43]:(L=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Pe,onClick:F,children:I}),t[42]=Pe,t[43]=L);let R;t[44]===Ee?R=t[45]:(R=(0,c.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Ee}),t[44]=Ee,t[45]=R);let Fe=u===`zh`?`下个月`:`Next month`,z,B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>xe(he),B=(0,c.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t[46]=z,t[47]=B):(z=t[46],B=t[47]);let V;t[48]===Fe?V=t[49]:(V=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Fe,onClick:z,children:B}),t[48]=Fe,t[49]=V);let H;t[50]!==L||t[51]!==R||t[52]!==V?(H=(0,c.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[L,R,V]}),t[50]=L,t[51]=R,t[52]=V,t[53]=H):H=t[53];let U;t[54]===Te?U=t[55]:(U=(0,c.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:Te.map(me)}),t[54]=Te,t[55]=U);let W;if(t[56]!==we||t[57]!==d||t[58]!==O||t[59]!==T||t[60]!==C||t[61]!==g){let e;t[63]!==d||t[64]!==O||t[65]!==T||t[66]!==C||t[67]!==g?(e=e=>{let t=ue(e),n=t===T,r=t===C,i=e.getMonth()!==g.getMonth();return(0,c.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-label":new Intl.DateTimeFormat(d,{dateStyle:`full`}).format(e),className:o(`mx-auto flex size-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i&&`text-fg-disabled`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-white hover:bg-accent-hover`),onClick:()=>O(t),children:e.getDate()},t)},t[63]=d,t[64]=O,t[65]=T,t[66]=C,t[67]=g,t[68]=e):e=t[68],W=we.map(e),t[56]=we,t[57]=d,t[58]=O,t[59]=T,t[60]=C,t[61]=g,t[62]=W}else W=t[62];let G;t[69]===W?G=t[70]:(G=(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:W}),t[69]=W,t[70]=G);let Ie=!n,K;t[71]===O?K=t[72]:(K=()=>O(``),t[71]=O,t[72]=K);let Le=u===`zh`?`清除`:`Clear`,q;t[73]!==Ie||t[74]!==K||t[75]!==Le?(q=(0,c.jsx)(`button`,{type:`button`,disabled:Ie,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:K,children:Le}),t[73]=Ie,t[74]=K,t[75]=Le,t[76]=q):q=t[76];let J;t[77]!==O||t[78]!==C?(J=()=>O(C),t[77]=O,t[78]=C,t[79]=J):J=t[79];let Re=u===`zh`?`今天`:`Today`,Y;t[80]!==J||t[81]!==Re?(Y=(0,c.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80`,onClick:J,children:Re}),t[80]=J,t[81]=Re,t[82]=Y):Y=t[82];let X;t[83]!==q||t[84]!==Y?(X=(0,c.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[q,Y]}),t[83]=q,t[84]=Y,t[85]=X):X=t[85];let ze;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,c.jsx)(te,{className:`fill-surface-panel`}),t[86]=ze):ze=t[86];let Z;t[87]!==Me.Content||t[88]!==Ne||t[89]!==H||t[90]!==U||t[91]!==G||t[92]!==X?(Z=(0,c.jsxs)(Me.Content,{align:`start`,sideOffset:6,collisionPadding:12,className:Ne,children:[H,U,G,X,ze]}),t[87]=Me.Content,t[88]=Ne,t[89]=H,t[90]=U,t[91]=G,t[92]=X,t[93]=Z):Z=t[93];let Q;t[94]!==Ae.Portal||t[95]!==je||t[96]!==Z?(Q=(0,c.jsx)(Ae.Portal,{container:je,children:Z}),t[94]=Ae.Portal,t[95]=je,t[96]=Z,t[97]=Q):Q=t[97];let $;return t[98]!==m||t[99]!==De.Root||t[100]!==P||t[101]!==Q?($=(0,c.jsxs)(De.Root,{open:m,onOpenChange:be,children:[P,Q]}),t[98]=m,t[99]=De.Root,t[100]=P,t[101]=Q,t[102]=$):$=t[102],$}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as o,r as s}from"./popover-select-CKBYnT3c.js";import{t as c}from"./messages-D0V_bgRP.js";import{a as l,i as u,n as d,r as f,s as p}from"./locale-store-BThkG0W5.js";import{t as m}from"./cn-JdwAhgNB.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{t as g}from"./button-B11EPpor.js";import{So as _,Ur as v,bo as y,xo as b,za as x}from"./index-OMnem2nr.js";import{t as S}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as C,t as w}from"./use-autosave-N_lm4FdD.js";import{c as T,d as E,s as D}from"./voice-config-api-QWVmiAp3.js";import{t as O}from"./voice-api-key-field-DMsyVfri.js";import{t as k}from"./schema-form-BE0sgZyz.js";var A=e(t(),1),j=n(),M=r();function N(e){let t=(0,j.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function P(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function F(){return m(b,y)}function I(){return m(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_,`dark:border-edge`)}function L(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function R({providerId:e,voiceSettings:t,mutateVoice:n}){let r=c(d(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,l={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:u}=h(f(`/api/voice/stt-providers`),T,{revalidateOnFocus:!1}),p=(0,A.useMemo)(()=>u?.providers.find(t=>t.id===e),[e,u]),g=p?.configured??!1,_=p?.models??[],v=_[0]?.id??p?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,A.useMemo)(()=>L(t,e,v),[v,e,t]),x=(0,A.useRef)(!1),[S,D]=(0,A.useState)(null),k=S??b,j=(0,A.useRef)(k);j.current=k;let P=b,R=w({value:k,dirty:k.apiKey!==P.apiKey||k.model!==P.model,onSave:(0,A.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await E(i),await n(i,!1),x.current=JSON.stringify(j.current)!==JSON.stringify(r),D(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),z=_.length>0?_:k.model?[{id:k.model,name:k.model}]:[];return(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:R.onBlurCapture,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(C,{status:R.status,error:R.error}),(0,M.jsx)(`span`,{className:m(`rounded-full px-2 py-0.5 text-xs font-medium`,g?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:g?a.configured:a.notConfigured})]})]}),(0,M.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,M.jsxs)(`div`,{className:m(`flex flex-col gap-1.5`,y),children:[(0,M.jsx)(N,{children:i.stt.apiKey}),(0,M.jsx)(O,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:k.apiKey,onChange:e=>{x.current=!0,D(t=>({...t??b,apiKey:e}))},labels:l,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,M.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,M.jsxs)(`div`,{className:m(`flex flex-col gap-1.5`,y),children:[(0,M.jsx)(N,{children:i.stt.model}),z.length>0?(0,M.jsx)(o,{className:F(),value:k.model,onChange:e=>{x.current=!0,D(t=>({...t??b,model:e.target.value})),R.saveNow({...k,model:e.target.value})},children:z.map(e=>(0,M.jsx)(s,{value:e.id,children:e.name},e.id))}):(0,M.jsx)(`input`,{className:I(),value:k.model,onChange:e=>{x.current=!0,D(t=>({...t??b,model:e.target.value}))}})]})]})]})}function z(e){let t=(0,j.c)(13),{extensionId:n}=e,r=d(V),i=p(B),a;t[0]===n?a=t[1]:(a=()=>l(f(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:s}=h(i&&n?`ext-stt-detail-${n}`:null,a),c;t[2]===o?c=t[3]:(c=P(o),t[2]=o,t[3]=c);let u=c,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:g,mutate:_,isLoading:v}=h(i?`voice-settings-ext-stt`:null,D,m);if(!i)return null;if(s||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(S,{rows:2}),t[5]=e):e=t[5],e}if(!u){let e=r===`zh`?`该扩展未声明 mediaUnderstandingProviders。`:`This extension does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!g)return null;let y=`${n}:${u}`,b;return t[8]!==_||t[9]!==u||t[10]!==y||t[11]!==g?(b=(0,M.jsx)(R,{providerId:u,voiceSettings:g,mutateVoice:_},y),t[8]=_,t[9]=u,t[10]=y,t[11]=g,t[12]=b):b=t[12],b}function B(e){return!!e.token}function V(e){return e.language}function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e){let t={};if(e.type!==`object`||!H(e.properties))return t;for(let[n,r]of Object.entries(e.properties))H(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function W(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function G({extensionId:e}){let t=p(e=>!!e.token),{data:n,error:r}=h(t&&e?`ext-detail-${e}`:null,()=>l(f(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:o}=h(t&&e?`ext-cfg-${e}`:null,()=>l(f(`/api/extensions/${encodeURIComponent(e)}/config`))),s=n?.manifest?.configSchema,c=(0,A.useMemo)(()=>s&&s.type===`object`?U(s):{},[s]),d=(0,A.useMemo)(()=>({...c,...i??{}}),[c,i]),[m,_]=(0,A.useReducer)(W,{localValues:{},isDirty:!1}),v=(0,A.useRef)(!1),y=(0,A.useRef)(m.localValues);y.current=m.localValues;let b=(0,A.useRef)(d);!v.current&&b.current!==d&&(b.current=d,_({type:`sync`,value:d}));let x=(0,A.useCallback)(e=>{v.current=!0,_({type:`change`,value:e})},[]),S=(0,A.useCallback)(()=>{!s||s.type!==`object`||(v.current=!0,_({type:`reset-defaults`,value:{...U(s)}}))},[s]),T=(0,A.useCallback)(async t=>{if(!e)return;let n=await u(f(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),_({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),E=w({value:m.localValues,dirty:m.isDirty,onSave:T});if(!t)return null;if(r||o){let e=r??o;return(0,M.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!s||s.type!==`object`?null:(0,M.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 rounded-xl bg-surface-base p-4`,onBlurCapture:E.onBlurCapture,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(C,{status:E.status,error:E.error}),(0,M.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,M.jsx)(k,{schema:s,values:m.localValues,onChange:x})]})}function K(){let e=(0,j.c)(38),t=d(q),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),l=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(J,{message:`No extension ID provided.`}),e[2]=t):t=e[2],t}let u,f,p;if(e[3]!==o||e[4]!==l||e[5]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=l.find(t),!u){let t=`Extension "${o}" not found or is not available in this workspace.`,n;e[11]===t?n=e[12]:(n=(0,M.jsx)(J,{message:t}),e[11]=t,e[12]=n),p=n;break bb0}let n=u.ui?.contributions?.settingsPanels;f=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=l,e[5]=s,e[6]=u,e[7]=f,e[8]=p}else u=e[6],f=e[7],p=e[8];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m=f,h=!!(m&&u.ui),g=!!u.hasConfigSchema,_=u.kind===`media-provider`;if(!g&&!h&&!_){let t=`Extension "${o}" has no settings panels or config schema.`,n;return e[13]===t?n=e[14]:(n=(0,M.jsx)(J,{message:t}),e[13]=t,e[14]=n),n}let y=m?.title??`${u.name} Settings`,b;e[15]===y?b=e[16]:(b=(0,M.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:y}),e[15]=y,e[16]=b);let S;e[17]!==_||e[18]!==r?(S=_?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,M.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,M.jsx)(a,{to:`/settings/capabilities/voice`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[17]=_,e[18]=r,e[19]=S):S=e[19];let C;e[20]!==o||e[21]!==_?(C=_?(0,M.jsx)(z,{extensionId:o}):null,e[20]=o,e[21]=_,e[22]=C):C=e[22];let w;e[23]!==o||e[24]!==g?(w=g?(0,M.jsx)(G,{extensionId:o}):null,e[23]=o,e[24]=g,e[25]=w):w=e[25];let T;e[26]!==u.name||e[27]!==u.ui||e[28]!==o||e[29]!==h||e[30]!==m?(T=h&&m&&u.ui?(0,M.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,M.jsx)(v,{extensionId:o,extensionName:u.name,entrypoint:m.entrypoint,permissions:u.ui?.permissions,title:m.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[26]=u.name,e[27]=u.ui,e[28]=o,e[29]=h,e[30]=m,e[31]=T):T=e[31];let E;return e[32]!==b||e[33]!==S||e[34]!==C||e[35]!==w||e[36]!==T?(E=(0,M.jsxs)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,children:[b,S,C,w,T]}),e[32]=b,e[33]=S,e[34]=C,e[35]=w,e[36]=T,e[37]=E):E=e[37],E}function q(e){return e.language}function J(e){let t=(0,j.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,M.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,children:(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{K as ExtensionSettingsPage};