@decocms/mesh 2.141.0 → 2.142.0

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 (202) hide show
  1. package/dist/client/assets/{AlertCircle-CeyEXSoj.js → AlertCircle-Zx531KAn.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-CrcoQJqu.js → AlignLeft-CGBbKVHK.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-D730s0Gv.js → ArrowDown-BX-IIy5w.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-CLP9Pek3.js → ArrowLeft-D4dc0UBb.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Dq6OU0Wi.js → ArrowUp-dcB4aDLZ.js} +1 -1
  6. package/dist/client/assets/{Check-Bra2mpbB.js → Check-DXoRcZpn.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BPfWQi5L.js → CheckCircle-BP8hgPfe.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-CXZx9paJ.js → CheckDone01-ca6APAHc.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-DNjRDns-.js → CheckVerified02-C_Ewexdw.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-DaSct-5t.js → ChevronDown-D04Buvau.js} +1 -1
  11. package/dist/client/assets/{ChevronLeft-DgayRUs6.js → ChevronLeft-C8cqrSli.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-CIJzl8ei.js → ChevronRight-CkAAxLvD.js} +1 -1
  13. package/dist/client/assets/{Clock-C-pPW7F3.js → Clock-DwwOuQI4.js} +1 -1
  14. package/dist/client/assets/{Code01-Dr2rEb4l.js → Code01-BLJKgev-.js} +1 -1
  15. package/dist/client/assets/{Container-BQAhl1Ij.js → Container-CSl1es2V.js} +1 -1
  16. package/dist/client/assets/{Copy01-wvio6GZB.js → Copy01-B4eRdmVC.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-DTe8Fji9.js → Dataflow03-SiitV-oV.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-dwN0TeON.js → DotsHorizontal-DzRIJPXY.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-COjc-1zo.js → DotsVertical-B6bpYQLL.js} +1 -1
  20. package/dist/client/assets/{Download01-Cgcu3XsW.js → Download01-DDnPOFFT.js} +1 -1
  21. package/dist/client/assets/{Edit01-9TEaueyu.js → Edit01-CoWrVJPj.js} +1 -1
  22. package/dist/client/assets/{Edit05-Aay9qpeK.js → Edit05-BUQBpzoO.js} +1 -1
  23. package/dist/client/assets/{Eye-BvUkkA1x.js → Eye-DNSEDYe8.js} +1 -1
  24. package/dist/client/assets/{File02-_Z_LhG0B.js → File02-BXS3LEA8.js} +1 -1
  25. package/dist/client/assets/{File06-8djhGUgF.js → File06-h52WT7aG.js} +1 -1
  26. package/dist/client/assets/{FilterLines-BpgGX9yW.js → FilterLines-CsjQLyQm.js} +1 -1
  27. package/dist/client/assets/{Globe01-cdbxnKif.js → Globe01-CSEqx1SJ.js} +1 -1
  28. package/dist/client/assets/{Globe02-BNWDh1xg.js → Globe02-YyAAQROb.js} +1 -1
  29. package/dist/client/assets/{Grid01-BTxljTvU.js → Grid01-Ju9gLjOW.js} +1 -1
  30. package/dist/client/assets/{Hash02-GCSnB6Ea.js → Hash02-TG1GIkeV.js} +1 -1
  31. package/dist/client/assets/{Home02-BNGdtTCt.js → Home02-TzIRlDMK.js} +1 -1
  32. package/dist/client/assets/{Image01-D6NJnYhS.js → Image01-PGP5Jz22.js} +1 -1
  33. package/dist/client/assets/{Inbox01-C5ZLulCH.js → Inbox01-CjHNjCjB.js} +1 -1
  34. package/dist/client/assets/{InfoCircle-WfpfNr5k.js → InfoCircle-CVW6wgFf.js} +1 -1
  35. package/dist/client/assets/{Key01-DCAZcJB7.js → Key01-9PzzeBlc.js} +1 -1
  36. package/dist/client/assets/{LayersTwo01-DfZQJvAF.js → LayersTwo01-XOG8qRvr.js} +1 -1
  37. package/dist/client/assets/{LayoutLeft-BbQAgJQI.js → LayoutLeft-BcthWHLG.js} +1 -1
  38. package/dist/client/assets/{Link01-6A-UyGFE.js → Link01-2BHrruNj.js} +1 -1
  39. package/dist/client/assets/{LinkExternal01-CcNqfW_-.js → LinkExternal01-CxAidvQ-.js} +1 -1
  40. package/dist/client/assets/{List-DYrVMPII.js → List-Bj4VjFJ6.js} +1 -1
  41. package/dist/client/assets/{Loading01-BI2pQIQK.js → Loading01-DF5pxnn8.js} +1 -1
  42. package/dist/client/assets/{Lock01-iA8k6E0L.js → Lock01-CPqKu_Mb.js} +1 -1
  43. package/dist/client/assets/{Play-DYKv-3LY.js → Play-CUMfSU-t.js} +1 -1
  44. package/dist/client/assets/{Plus-D8K5219B.js → Plus-CEtl-Eq7.js} +1 -1
  45. package/dist/client/assets/{RefreshCcw01-B2GUxp8e.js → RefreshCcw01-Bcbx9L0j.js} +1 -1
  46. package/dist/client/assets/{Save01-CD75pRkt.js → Save01-BtoFb1Cg.js} +1 -1
  47. package/dist/client/assets/{SearchMd-ChZ8IPer.js → SearchMd-u1QGwQkU.js} +1 -1
  48. package/dist/client/assets/{Settings01-D9LfVzNX.js → Settings01-C1oZxROY.js} +1 -1
  49. package/dist/client/assets/{Shield01-CcJa1Vfw.js → Shield01-DoZAYqqP.js} +1 -1
  50. package/dist/client/assets/{Terminal-BmCZxpDC.js → Terminal-DobKmqGm.js} +1 -1
  51. package/dist/client/assets/{Trash01-BUR32hk8.js → Trash01-c47UOodj.js} +1 -1
  52. package/dist/client/assets/{Upload01-CAAshTy5.js → Upload01-C3K15n1N.js} +1 -1
  53. package/dist/client/assets/{Users03-t-Eb-Q_F.js → Users03-Z0r1cCGf.js} +1 -1
  54. package/dist/client/assets/{X-BQQzz9s2.js → X-CT_P09q2.js} +1 -1
  55. package/dist/client/assets/{XCircle-Cap9XfpO.js → XCircle-BNAlXeL2.js} +1 -1
  56. package/dist/client/assets/{XClose-Dj2rcAfJ.js → XClose-BIpOBHWg.js} +1 -1
  57. package/dist/client/assets/{Zap-CUDe-Alo.js → Zap-BYVebEYM.js} +1 -1
  58. package/dist/client/assets/{agent-connections-preview-3Zz2CLn-.js → agent-connections-preview-B76ZYrs2.js} +1 -1
  59. package/dist/client/assets/{agent-detail-DV-MsiIN.js → agent-detail-ean34cyZ.js} +1 -1
  60. package/dist/client/assets/{agents-hw52w_aJ.js → agents-avEyjtsq.js} +1 -1
  61. package/dist/client/assets/{alert-dialog-B7Vj8wIN.js → alert-dialog-DXvhyacf.js} +1 -1
  62. package/dist/client/assets/{auth-catchall-CVH3rpJ8.js → auth-catchall-FvylLzD9.js} +1 -1
  63. package/dist/client/assets/{avatar-BjR7vcEh.js → avatar-DGDgNwX-.js} +1 -1
  64. package/dist/client/assets/{badge-BvxQUv5d.js → badge-DtcA_2rB.js} +1 -1
  65. package/dist/client/assets/{binder-D8_pfz0c.js → binder-CaZ6b20X.js} +1 -1
  66. package/dist/client/assets/{breadcrumb-CujpR_MZ.js → breadcrumb-DPLSdTx1.js} +1 -1
  67. package/dist/client/assets/{card-BnvIiB1g.js → card-Bz05CYUR.js} +1 -1
  68. package/dist/client/assets/{chart-CJtIITmU.js → chart-DYrz9LTc.js} +1 -1
  69. package/dist/client/assets/{checkbox-CfbjtS8Q.js → checkbox-JiwlvimE.js} +1 -1
  70. package/dist/client/assets/{circle-alert-92VS9QNj.js → circle-alert-CtnOwoV2.js} +1 -1
  71. package/dist/client/assets/{collapsible-rlPjAYfz.js → collapsible-Dz6kdDQx.js} +1 -1
  72. package/dist/client/assets/{collection-detail-DTIsN11e.js → collection-detail-CBGjxXPP.js} +1 -1
  73. package/dist/client/assets/{collection-display-button-DonrYXGs.js → collection-display-button-CXc-TgEJ.js} +1 -1
  74. package/dist/client/assets/{collection-search-BRnhIyqo.js → collection-search-Dl5JvsI0.js} +1 -1
  75. package/dist/client/assets/{collection-tab-sxOyMOJ1.js → collection-tab-BlE4CTwD.js} +1 -1
  76. package/dist/client/assets/{collection-table-wrapper-C9H2IYz6.js → collection-table-wrapper-eN4uWzLn.js} +1 -1
  77. package/dist/client/assets/{collection-tabs-BLzjBVUw.js → collection-tabs-CK4RWFd-.js} +1 -1
  78. package/dist/client/assets/{command-CyzcC-hg.js → command-BzF9LDzy.js} +1 -1
  79. package/dist/client/assets/{connect-DJVdJQyo.js → connect-B1CrEofK.js} +1 -1
  80. package/dist/client/assets/{connection-card-Z0jbSyHU.js → connection-card-CC22E-3G.js} +1 -1
  81. package/dist/client/assets/{connection-detail-cQXLAHkT.js → connection-detail-B-ICGeJ4.js} +1 -1
  82. package/dist/client/assets/{connection-status-BlekJeQH.js → connection-status-B1K3m1_w.js} +1 -1
  83. package/dist/client/assets/{connections-DcUAbwbI.js → connections-BuggzhbD.js} +1 -1
  84. package/dist/client/assets/{constants-Dm_YJHHh.js → constants-CRvMLa9p.js} +1 -1
  85. package/dist/client/assets/constants-I25hmjxi.js +1 -0
  86. package/dist/client/assets/{create-organization-dialog-CtlEPJzP.js → create-organization-dialog-DIZjTiis.js} +1 -1
  87. package/dist/client/assets/{create-project-dialog-BxzjYULd.js → create-project-dialog-Dut0dyR9.js} +1 -1
  88. package/dist/client/assets/{danger-CCLfXgtM.js → danger-Dare7pC6.js} +1 -1
  89. package/dist/client/assets/{danger-zone-DRhmEbL7.js → danger-zone-_BODcOmd.js} +1 -1
  90. package/dist/client/assets/{decopilot-events-ppuEAQXv.js → decopilot-events-bTg09qGr.js} +1 -1
  91. package/dist/client/assets/{dependencies-C7S5Q2d8.js → dependencies-BT9TgTWZ.js} +1 -1
  92. package/dist/client/assets/{dialog-V5-7uM9k.js → dialog-DSCIUn11.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-DhJeGl-I.js → dropdown-menu-DMgECNP1.js} +1 -1
  94. package/dist/client/assets/{dynamic-plugin-layout-CWhhphkI.js → dynamic-plugin-layout-CXCsSgRX.js} +1 -1
  95. package/dist/client/assets/{editable-task-title-Dyz3EXnS.js → editable-task-title-DKlfwqLm.js} +1 -1
  96. package/dist/client/assets/{empty-state-DCJLh0XB.js → empty-state-C64F3xDv.js} +1 -1
  97. package/dist/client/assets/{env-vars-editor-C56Egqy3.js → env-vars-editor-ClFO22Eh.js} +1 -1
  98. package/dist/client/assets/{extract-connection-data-Cb5Cn1YK.js → extract-connection-data-CrY_sL6W.js} +1 -1
  99. package/dist/client/assets/{file-browser-B-J9CyYH.js → file-browser-DSHBHgjG.js} +2 -2
  100. package/dist/client/assets/{form-BBAUUGww.js → form-CVLoDgzL.js} +1 -1
  101. package/dist/client/assets/{general-CiL7f9UQ.js → general-CYKgldaV.js} +1 -1
  102. package/dist/client/assets/{grid-view-Dixskjfv.js → grid-view-DvrbtUer.js} +1 -1
  103. package/dist/client/assets/{home-T185-fO8.js → home-BuzXHaZj.js} +1 -1
  104. package/dist/client/assets/{icon-picker-D7lX1VYO.js → icon-picker-5LH0UiWF.js} +1 -1
  105. package/dist/client/assets/{index-B9cZ8O6i.js → index-6Z25-w5a.js} +1 -1
  106. package/dist/client/assets/{index-CVG_d4yA.js → index-A_CnuSis.js} +1 -1
  107. package/dist/client/assets/{index-D18UlrU_.js → index-B7Bu7nQ7.js} +1 -1
  108. package/dist/client/assets/{index-DF_qvYHR.js → index-BCf_VMXY.js} +1 -1
  109. package/dist/client/assets/{index-BXzn0fV_.js → index-Cg5VAr11.js} +1 -1
  110. package/dist/client/assets/{index-DY_8JcsL.js → index-Co1xrsbj.js} +1 -1
  111. package/dist/client/assets/{index-vkhk47fC.js → index-CoyJj2VR.js} +1 -1
  112. package/dist/client/assets/{index-pgKDpBki.js → index-KAycGEnT.js} +3 -3
  113. package/dist/client/assets/{index-BsKpFK6R.js → index-jBnBTTB0.js} +1 -1
  114. package/dist/client/assets/{infiniteQueryObserver-CQfzmS7X.js → infiniteQueryObserver-DctmDFEe.js} +1 -1
  115. package/dist/client/assets/{input-BJSjp7-P.js → input-s8rw5Kfa.js} +1 -1
  116. package/dist/client/assets/{integration-icon-Bh8tJtce.js → integration-icon-BAlg7muO.js} +1 -1
  117. package/dist/client/assets/{label-vf98zSbN.js → label-lqq4AMOf.js} +1 -1
  118. package/dist/client/assets/{layout-YIwjbnTp.js → layout-BdJDt40T.js} +1 -1
  119. package/dist/client/assets/{layout-C5jONK7z.js → layout-CaxeqVAE.js} +1 -1
  120. package/dist/client/assets/{localstorage-keys-DBdiYnka.js → localstorage-keys-DK1Id_ip.js} +1 -1
  121. package/dist/client/assets/{login-BgRo2XAR.js → login--Bk_liKs.js} +1 -1
  122. package/dist/client/assets/{markdown-Br_cwNit.js → markdown-HCjujTl2.js} +1 -1
  123. package/dist/client/assets/{mcp-app-renderer-CUDmsxDc.js → mcp-app-renderer-Bconp3w4.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-D2_g2iQ3.js → mcp-oauth-DcSxwlYK.js} +1 -1
  125. package/dist/client/assets/{mcp-server-card-BIb-sr8t.js → mcp-server-card-B0UwO4c6.js} +1 -1
  126. package/dist/client/assets/{mcp-server-detail-umJmA6Hf.js → mcp-server-detail-zb689o0t.js} +2 -2
  127. package/dist/client/assets/{members-B8ytQqBf.js → members-A9Co33Fe.js} +1 -1
  128. package/dist/client/assets/{monaco-editor-cmFLTFFa.js → monaco-editor-BGkR3-IA.js} +1 -1
  129. package/dist/client/assets/{monitoring-Y4RhEfJi.js → monitoring-DtdfvOM5.js} +1 -1
  130. package/dist/client/assets/{monitoring-dashboard-edit-B1b_izuH.js → monitoring-dashboard-edit-GWWMfh0m.js} +1 -1
  131. package/dist/client/assets/{monitoring-dashboard-view-D91GHQli.js → monitoring-dashboard-view-Cm896dO-.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-CkMlDc9V.js → oauth-callback-BSGOfJmL.js} +1 -1
  133. package/dist/client/assets/{page-BQN594H_.js → page-BjfHsKND.js} +1 -1
  134. package/dist/client/assets/{page-jQQCdu0_.js → page-PU0vqAHP.js} +1 -1
  135. package/dist/client/assets/{plugin-empty-state-CvKe2eFG.js → plugin-empty-state-BdIJtKhO.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-8glCRu7k.js → plugin-empty-state-CNAE295F.js} +1 -1
  137. package/dist/client/assets/{plugin-header-BINlxFpc.js → plugin-header-BO6BGJC7.js} +1 -1
  138. package/dist/client/assets/{plugin-header-BBvns4oF.js → plugin-header-C3hBljo3.js} +1 -1
  139. package/dist/client/assets/plugins-BttmmeIz.js +1 -0
  140. package/dist/client/assets/{popover-CKnAPgyb.js → popover-DSO1tjgf.js} +1 -1
  141. package/dist/client/assets/{project-app-view-DK8fUX-l.js → project-app-view-DEVHaVoM.js} +1 -1
  142. package/dist/client/assets/{project-layout-BALZLj4X.js → project-layout-BZqAcTC3.js} +1 -1
  143. package/dist/client/assets/{project-plugins-Bj1bV66o.js → project-plugins-DkIXV878.js} +1 -1
  144. package/dist/client/assets/{projects-list-Df4ohsie.js → projects-list-DD9bayAR.js} +1 -1
  145. package/dist/client/assets/{readme-viewer-BRRJxput.js → readme-viewer-DEgSduvy.js} +1 -1
  146. package/dist/client/assets/{registry-layout-DsOQKg7X.js → registry-layout-BbOZb50w.js} +1 -1
  147. package/dist/client/assets/{registry-utils-bSQASXXu.js → registry-utils-BJRD11-o.js} +1 -1
  148. package/dist/client/assets/{reports-layout-VIixnRRq.js → reports-layout-0fvVXIA9.js} +1 -1
  149. package/dist/client/assets/{reset-password-9_dzcPjp.js → reset-password-BBFIx6IU.js} +1 -1
  150. package/dist/client/assets/{resizable-ClRo9tEF.js → resizable-FDnvuXI8.js} +1 -1
  151. package/dist/client/assets/{save-actions-Bid6YjFg.js → save-actions-BrexEzhw.js} +1 -1
  152. package/dist/client/assets/{scroll-area-C7Jh7ETR.js → scroll-area-BoIKmmj_.js} +1 -1
  153. package/dist/client/assets/{select-MKaUo6o5.js → select-XWfX294J.js} +1 -1
  154. package/dist/client/assets/{shell-layout-DrPAQ5jV.js → shell-layout-CfqRN6gC.js} +2 -2
  155. package/dist/client/assets/{sidebar-settings-4HQ0h8G6.js → sidebar-settings-CYnkTQwX.js} +1 -1
  156. package/dist/client/assets/{skeleton-YJfePU6v.js → skeleton-l9u4bmPQ.js} +1 -1
  157. package/dist/client/assets/{spinner-_SEN9vi4.js → spinner-CQhhuHCn.js} +1 -1
  158. package/dist/client/assets/{store-invite-Di8JOemb.js → store-invite-QKjyJOdx.js} +1 -1
  159. package/dist/client/assets/{switch-DhN0oNOe.js → switch-BTH5DtNC.js} +1 -1
  160. package/dist/client/assets/{table-C5_4tjrD.js → table-CObvzzoK.js} +1 -1
  161. package/dist/client/assets/{tabs-DW6Vwt7O.js → tabs-B62zcrrU.js} +1 -1
  162. package/dist/client/assets/tasks-DBMv6koR.js +1 -0
  163. package/dist/client/assets/{tasks-panel-ORUfjwGu.js → tasks-panel-jUSk_q_P.js} +1 -1
  164. package/dist/client/assets/{textarea-BvpI-WDT.js → textarea-CKFVaVym.js} +1 -1
  165. package/dist/client/assets/{time-range-picker-Bd4ADfiZ.js → time-range-picker-C2BX3Ytm.js} +1 -1
  166. package/dist/client/assets/{toggle-group-JxDUkkEj.js → toggle-group-BWymC1w6.js} +1 -1
  167. package/dist/client/assets/{tools-list-BQpfUfWd.js → tools-list-CBKDjlC9.js} +1 -1
  168. package/dist/client/assets/{tooltip-DH8hxvf2.js → tooltip-BD36KVkP.js} +1 -1
  169. package/dist/client/assets/{topbar-portal-Djvgwkqc.js → topbar-portal-CyJ7_aXv.js} +1 -1
  170. package/dist/client/assets/{types-Dr4up3fI.js → types-CgRNzZIg.js} +1 -1
  171. package/dist/client/assets/{use-binding-PixlLrYo.js → use-binding-eAl0-ngZ.js} +1 -1
  172. package/dist/client/assets/{use-collections-xijD0anf.js → use-collections-ROKIiOzV.js} +1 -1
  173. package/dist/client/assets/{use-connection-DKYOa494.js → use-connection-DWTVYLGI.js} +1 -1
  174. package/dist/client/assets/{use-copy-MZ1Maw_m.js → use-copy-Cxp-hpbY.js} +1 -1
  175. package/dist/client/assets/{use-create-virtual-mcp-BphKQ0RK.js → use-create-virtual-mcp-CWXwWPev.js} +1 -1
  176. package/dist/client/assets/{use-install-from-registry-BFX_cpLN.js → use-install-from-registry-CzqEIQq2.js} +1 -1
  177. package/dist/client/assets/{use-list-state-BtIJ-ja-.js → use-list-state-cW6KZE3t.js} +1 -1
  178. package/dist/client/assets/{use-llm-CEKPubl8.js → use-llm-D0wV35M9.js} +1 -1
  179. package/dist/client/assets/{use-mcp-resources-MxJcH4JX.js → use-mcp-resources-BTKxmEpv.js} +1 -1
  180. package/dist/client/assets/{use-mcp-tools-yCWWKbHl.js → use-mcp-tools-DkmUq8XI.js} +1 -1
  181. package/dist/client/assets/{use-members-AoYrzLX-.js → use-members-Bksy3767.js} +1 -1
  182. package/dist/client/assets/{use-mobile-ByMXtX6G.js → use-mobile-C7Xn-ZVB.js} +1 -1
  183. package/dist/client/assets/{use-project-DKVek4SF.js → use-project-BZjOe5ok.js} +1 -1
  184. package/dist/client/assets/{use-settings-modal-Dv44bpGw.js → use-settings-modal-BpLqrFwi.js} +1 -1
  185. package/dist/client/assets/{use-view-mode-xttGyEwW.js → use-view-mode-DxCF7P6S.js} +1 -1
  186. package/dist/client/assets/{use-virtual-mcp-CxEMO48x.js → use-virtual-mcp-DrNWNgvb.js} +1 -1
  187. package/dist/client/assets/useInfiniteQuery-Clfr9I7T.js +1 -0
  188. package/dist/client/assets/{useMutation-B1zBeDkg.js → useMutation-Ctk5b8uR.js} +1 -1
  189. package/dist/client/assets/useQuery-DCrAUBx5.js +1 -0
  190. package/dist/client/assets/useSuspenseInfiniteQuery-CG43fx0v.js +1 -0
  191. package/dist/client/assets/{user-CAFKngPC.js → user-BU3jjBpz.js} +1 -1
  192. package/dist/client/assets/{workflow-HCVF9XrN.js → workflow-BNkb2XNC.js} +1 -1
  193. package/dist/client/index.html +1 -1
  194. package/dist/server/cli.js +307 -307
  195. package/dist/server/server.js +275 -275
  196. package/package.json +1 -1
  197. package/dist/client/assets/constants-5ioK-fWT.js +0 -1
  198. package/dist/client/assets/plugins-BCUVhdgb.js +0 -1
  199. package/dist/client/assets/tasks-CGmW35Jv.js +0 -1
  200. package/dist/client/assets/useInfiniteQuery-Bdn29uSf.js +0 -1
  201. package/dist/client/assets/useQuery-D2_PHjUY.js +0 -1
  202. package/dist/client/assets/useSuspenseInfiniteQuery-CquX6rh3.js +0 -1
@@ -1 +1 @@
1
- import{r as i,I as $,j as c,aY as H,aH as L,M as A,J as _,T as g,aW as b,W as j,aX as z,aZ as w,b2 as G,b3 as W,X as K,b4 as X,b5 as Z,b6 as J,a_ as U,a$ as V,b1 as Y,c as R,v as q}from"./index-pgKDpBki.js";var C="Popover",[E]=K(C,[w]),P=w(),[B,d]=E(C),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:s,modal:a=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:s,caller:C});return c.jsx(H,{...p,children:c.jsx(B,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:a,children:o})})};N.displayName=C;var F="PopoverAnchor",Q=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),s=P(o),{onCustomAnchorAdd:a,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(a(),()=>p()),[a,p]),c.jsx(b,{...s,...r,ref:e})});Q.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(S,o),s=P(o),a=A(e,n.triggerRef),p=c.jsx(_.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":k(n.open),...r,ref:a,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(b,{asChild:!0,...s,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=E(O,{forceMount:void 0}),M=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,s=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(j,{present:o||s.open,children:c.jsx(z,{asChild:!0,container:n,children:r})})})};M.displayName=O;var v="PopoverContent",D=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,s=d(v,t.__scopePopover);return c.jsx(j,{present:r||s.open,children:s.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});D.displayName=v;var te=X("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=A(e,r),s=i.useRef(!1);return i.useEffect(()=>{const a=r.current;if(a)return G(a)},[]),c.jsx(W,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,a=>{a.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,a=>{const p=a.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||o.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),m=P(o);return Z(),c.jsx(J,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(U,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(V,{"data-state":k(f.open),role:"dialog",id:f.contentId,...m,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),I="PopoverClose",se=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(I,o);return c.jsx(_.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});se.displayName=I;var ae="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(Y,{...n,...r,ref:e})});ce.displayName=ae;function k(t){return t?"open":"closed"}var ie=N,pe=y,le=M,ue=D;function fe(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(12);let o,r,n,s;e[0]!==t?({className:o,align:n,sideOffset:s,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=s):(o=e[1],r=e[2],n=e[3],s=e[4]);const a=n===void 0?"center":n,p=s===void 0?4:s;let l;e[5]!==o?(l=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==a||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:a,sideOffset:p,className:l,...r})}),e[7]=a,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ge as P,fe as a,ve as b};
1
+ import{r as i,I as $,j as c,aY as H,aH as L,M as A,J as _,T as g,aW as b,W as j,aX as z,aZ as w,b2 as G,b3 as W,X as K,b4 as X,b5 as Z,b6 as J,a_ as U,a$ as V,b1 as Y,c as R,v as q}from"./index-KAycGEnT.js";var C="Popover",[E]=K(C,[w]),P=w(),[B,d]=E(C),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:s,modal:a=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:s,caller:C});return c.jsx(H,{...p,children:c.jsx(B,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:a,children:o})})};N.displayName=C;var F="PopoverAnchor",Q=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),s=P(o),{onCustomAnchorAdd:a,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(a(),()=>p()),[a,p]),c.jsx(b,{...s,...r,ref:e})});Q.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(S,o),s=P(o),a=A(e,n.triggerRef),p=c.jsx(_.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":k(n.open),...r,ref:a,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(b,{asChild:!0,...s,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=E(O,{forceMount:void 0}),M=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,s=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(j,{present:o||s.open,children:c.jsx(z,{asChild:!0,container:n,children:r})})})};M.displayName=O;var v="PopoverContent",D=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,s=d(v,t.__scopePopover);return c.jsx(j,{present:r||s.open,children:s.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});D.displayName=v;var te=X("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=A(e,r),s=i.useRef(!1);return i.useEffect(()=>{const a=r.current;if(a)return G(a)},[]),c.jsx(W,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,a=>{a.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,a=>{const p=a.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||o.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),m=P(o);return Z(),c.jsx(J,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(U,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(V,{"data-state":k(f.open),role:"dialog",id:f.contentId,...m,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),I="PopoverClose",se=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(I,o);return c.jsx(_.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});se.displayName=I;var ae="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(Y,{...n,...r,ref:e})});ce.displayName=ae;function k(t){return t?"open":"closed"}var ie=N,pe=y,le=M,ue=D;function fe(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(12);let o,r,n,s;e[0]!==t?({className:o,align:n,sideOffset:s,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=s):(o=e[1],r=e[2],n=e[3],s=e[4]);const a=n===void 0?"center":n,p=s===void 0?4:s;let l;e[5]!==o?(l=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==a||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:a,sideOffset:p,className:l,...r})}),e[7]=a,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ge as P,fe as a,ve as b};
@@ -1 +1 @@
1
- import{c as x,e as N,j as i,r as I,E as _,u as P}from"./index-pgKDpBki.js";import{u as C}from"./use-connection-DKYOa494.js";import{u as M}from"./constants-Dm_YJHHh.js";import{u as R}from"./use-mcp-tools-yCWWKbHl.js";import{M as $}from"./mcp-app-renderer-CUDmsxDc.js";import{g as b,M as h}from"./types-Dr4up3fI.js";import"./use-collections-xijD0anf.js";import"./useMutation-B1zBeDkg.js";import"./useQuery-D2_PHjUY.js";import"./use-mcp-resources-MxJcH4JX.js";const j={};function y(t){const e=x.c(10),{client:o,resourceURI:m,tool:a}=t;let n;e[0]!==o||e[1]!==a.name?(n={client:o,toolName:a.name,toolArguments:j},e[0]=o,e[1]=a.name,e[2]=n):n=e[2];const{data:l}=R(n),c=a;let s;e[3]!==c?(s={tool:c},e[3]=c,e[4]=s):s=e[4];let f;return e[5]!==o||e[6]!==m||e[7]!==s||e[8]!==l?(f=i.jsx($,{resourceURI:m,toolInfo:s,toolInput:j,toolResult:l,displayMode:"fullscreen",minHeight:h.fullscreen.minHeight,maxHeight:h.fullscreen.maxHeight,client:o,className:"h-full"}),e[5]=o,e[6]=m,e[7]=s,e[8]=l,e[9]=f):f=e[9],f}function v(t){const e=x.c(16),{connectionId:o,toolName:m}=t,{org:a}=P();let n;e[0]!==o||e[1]!==a.id?(n={connectionId:o,orgId:a.id},e[0]=o,e[1]=a.id,e[2]=n):n=e[2];const l=M(n),c=C(o),s=decodeURIComponent(m);let f,d;if(e[3]!==c?.tools||e[4]!==s){let r;e[7]!==s?(r=g=>g.name===s,e[7]=s,e[8]=r):r=e[8],d=(c?.tools??[]).find(r),f=d?._meta?b(d._meta):void 0,e[3]=c?.tools,e[4]=s,e[5]=f,e[6]=d}else f=e[5],d=e[6];const u=f;if(!c){let r;return e[9]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Connection not found"})}),e[9]=r):r=e[9],r}if(!d||!u){let r;return e[10]!==s?(r=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',s,'" not found or has no UI']})}),e[10]=s,e[11]=r):r=e[11],r}let p;return e[12]!==l||e[13]!==u||e[14]!==d?(p=i.jsx(y,{client:l,resourceURI:u,tool:d}),e[12]=l,e[13]=u,e[14]=d,e[15]=p):p=e[15],p}function D(){const t=x.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/apps/$connectionId/$toolName"},t[0]=e):e=t[0];const{connectionId:o,toolName:m}=N(e),a=`${o}:${m}`;let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[i.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),t[1]=n):n=t[1];let l;t[2]!==o||t[3]!==m?(l=i.jsx(I.Suspense,{fallback:n,children:i.jsx(v,{connectionId:o,toolName:m})}),t[2]=o,t[3]=m,t[4]=l):l=t[4];let c;return t[5]!==a||t[6]!==l?(c=i.jsx(_,{fallback:void 0,children:l},a),t[5]=a,t[6]=l,t[7]=c):c=t[7],c}export{D as default};
1
+ import{c as x,e as N,j as i,r as I,E as _,u as P}from"./index-KAycGEnT.js";import{u as C}from"./use-connection-DWTVYLGI.js";import{u as M}from"./constants-CRvMLa9p.js";import{u as R}from"./use-mcp-tools-DkmUq8XI.js";import{M as $}from"./mcp-app-renderer-Bconp3w4.js";import{g as b,M as h}from"./types-CgRNzZIg.js";import"./use-collections-ROKIiOzV.js";import"./useMutation-Ctk5b8uR.js";import"./useQuery-DCrAUBx5.js";import"./use-mcp-resources-BTKxmEpv.js";const j={};function y(t){const e=x.c(10),{client:o,resourceURI:m,tool:a}=t;let n;e[0]!==o||e[1]!==a.name?(n={client:o,toolName:a.name,toolArguments:j},e[0]=o,e[1]=a.name,e[2]=n):n=e[2];const{data:l}=R(n),c=a;let s;e[3]!==c?(s={tool:c},e[3]=c,e[4]=s):s=e[4];let f;return e[5]!==o||e[6]!==m||e[7]!==s||e[8]!==l?(f=i.jsx($,{resourceURI:m,toolInfo:s,toolInput:j,toolResult:l,displayMode:"fullscreen",minHeight:h.fullscreen.minHeight,maxHeight:h.fullscreen.maxHeight,client:o,className:"h-full"}),e[5]=o,e[6]=m,e[7]=s,e[8]=l,e[9]=f):f=e[9],f}function v(t){const e=x.c(16),{connectionId:o,toolName:m}=t,{org:a}=P();let n;e[0]!==o||e[1]!==a.id?(n={connectionId:o,orgId:a.id},e[0]=o,e[1]=a.id,e[2]=n):n=e[2];const l=M(n),c=C(o),s=decodeURIComponent(m);let f,d;if(e[3]!==c?.tools||e[4]!==s){let r;e[7]!==s?(r=g=>g.name===s,e[7]=s,e[8]=r):r=e[8],d=(c?.tools??[]).find(r),f=d?._meta?b(d._meta):void 0,e[3]=c?.tools,e[4]=s,e[5]=f,e[6]=d}else f=e[5],d=e[6];const u=f;if(!c){let r;return e[9]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Connection not found"})}),e[9]=r):r=e[9],r}if(!d||!u){let r;return e[10]!==s?(r=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',s,'" not found or has no UI']})}),e[10]=s,e[11]=r):r=e[11],r}let p;return e[12]!==l||e[13]!==u||e[14]!==d?(p=i.jsx(y,{client:l,resourceURI:u,tool:d}),e[12]=l,e[13]=u,e[14]=d,e[15]=p):p=e[15],p}function D(){const t=x.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/apps/$connectionId/$toolName"},t[0]=e):e=t[0];const{connectionId:o,toolName:m}=N(e),a=`${o}:${m}`;let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[i.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),t[1]=n):n=t[1];let l;t[2]!==o||t[3]!==m?(l=i.jsx(I.Suspense,{fallback:n,children:i.jsx(v,{connectionId:o,toolName:m})}),t[2]=o,t[3]=m,t[4]=l):l=t[4];let c;return t[5]!==a||t[6]!==l?(c=i.jsx(_,{fallback:void 0,children:l},a),t[5]=a,t[6]=l,t[7]=c):c=t[7],c}export{D as default};
@@ -1 +1 @@
1
- import{r as v,c as I,d as st,j as s,v as ue,t as Pe,aD as fs,o as xs,s as Ge,b as at,u as me,n as At,l as ps,k as hs,K as mt,B as ce,c4 as Pt,O as Ee,P as It,S as Ze,e as gs,aG as vs}from"./index-pgKDpBki.js";import{u as Et}from"./use-project-DKVek4SF.js";import{c as ys,d as bs,b as js,a as Ot,D as Lt}from"./dialog-V5-7uM9k.js";import{i as Dt}from"./X-BQQzz9s2.js";import{S as ne}from"./skeleton-YJfePU6v.js";import{t as Ns,i as rt,u as Ss}from"./use-settings-modal-Dv44bpGw.js";import{A as Tt}from"./avatar-BjR7vcEh.js";import{t as ws}from"./Settings01-D9LfVzNX.js";import{i as Cs}from"./Zap-CUDe-Alo.js";import{a as ks,b as _s,c as As,T as Ps}from"./tooltip-DH8hxvf2.js";import{i as Is}from"./Check-Bra2mpbB.js";import{a as Es}from"./Copy01-wvio6GZB.js";import{S as Le}from"./switch-DhN0oNOe.js";import{S as Os,a as Ls,d as Re,c as Ds}from"./select-MKaUo6o5.js";import{i as Ts}from"./Code01-Dr2rEb4l.js";import{i as zs}from"./Shield01-CcJa1Vfw.js";import{u as zt,a as $s,T as We,b as Fe,c as Ms}from"./tabs-DW6Vwt7O.js";import{u as Bs}from"./useMutation-B1zBeDkg.js";import{a as Gs,F as Ue,b as Ve,c as Ke,d as Ye,f as He,e as Rs}from"./form-BBAUUGww.js";import{I as Ie}from"./input-BJSjp7-P.js";import{i as Ws}from"./Upload01-CAAshTy5.js";import{P as Fs}from"./project-plugins-Bj1bV66o.js";import{u as Us,a as Vs,b as Ks,i as ie,r as lt,D as $t,c as Me,d as fe,s as ft,e as xt,Z as Mt,g as Bt,f as Gt,h as Rt,j as _e,k as nt,l as Be,m as it,n as Ys,o as Hs,p as Wt,q as ot,t as ct,v as Ft,w as qs,x as Ut,y as pt,z as Qs,A as Xs,B as Js,R as Zs,S as ea,C as ta,E as sa,F as Vt,G as aa,H as ra,I as la,J as na,K as ia,L as oa,M as ca,N as da,O as De,P as ua,Q as ht,T as gt,U as vt,V as ma,W as Kt,X as fa,Y as Ne,_ as xa,$ as pa,a0 as ha,a1 as ga,a2 as va,a3 as qe,a4 as ya,a5 as Te,a6 as ba,a7 as J,a8 as Yt,a9 as ja,aa as Na,ab as Sa,ac as wa,ad as Ca,ae as ka,af as _a,ag as Aa,ah as Pa,ai as Ia,aj as Ea,ak as Oa,al as La,am as Da,an as Ta,ao as za,ap as $a,aq as Ma}from"./chart-CJtIITmU.js";import{L as Ae}from"./label-vf98zSbN.js";import{B as Ba}from"./badge-BvxQUv5d.js";import{i as Ga}from"./AlertCircle-CeyEXSoj.js";import{s as Ht}from"./Plus-D8K5219B.js";import{s as Ra}from"./RefreshCcw01-B2GUxp8e.js";import{u as ke,a as dt,K as Wa}from"./constants-Dm_YJHHh.js";import{b as Fa}from"./use-connection-DKYOa494.js";import{b as oe,a as qt}from"./use-mcp-tools-yCWWKbHl.js";import{u as Ua}from"./use-members-AoYrzLX-.js";import{c as Va,A as Ka}from"./use-binding-PixlLrYo.js";import"./useQuery-D2_PHjUY.js";import"./index-D18UlrU_.js";import"./ChevronDown-DaSct-5t.js";import"./localstorage-keys-DBdiYnka.js";import"./Container-BQAhl1Ij.js";import"./use-install-from-registry-BFX_cpLN.js";import"./extract-connection-data-Cb5Cn1YK.js";import"./constants-5ioK-fWT.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-bSQASXXu.js";import"./generate-id-Dyweu44Y.js";import"./Loading01-BI2pQIQK.js";import"./index-DY_8JcsL.js";import"./use-collections-xijD0anf.js";import"./binder-D8_pfz0c.js";const Qt=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.createElement("path",{d:"M10 2v4.66c0 .218 0 .326-.033.413a.47.47 0 0 1-.138.198c-.07.06-.183.102-.409.185a7.5 7.5 0 1 0 5.16 0c-.226-.083-.339-.125-.409-.185a.469.469 0 0 1-.138-.198C14 6.986 14 6.878 14 6.66V2M8.5 2h7"}));Qt.displayName="Beaker01";const Xt=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.createElement("path",{d:"M9.354 21c.705.622 1.632 1 2.646 1s1.94-.378 2.646-1M18 8A6 6 0 1 0 6 8c0 3.09-.78 5.206-1.65 6.605-.735 1.18-1.102 1.771-1.089 1.936.015.182.054.252.2.36.133.099.732.099 1.928.099H18.61c1.196 0 1.795 0 1.927-.098.147-.11.186-.179.2-.361.014-.165-.353-.755-1.088-1.936C18.78 13.206 18 11.09 18 8Z"}));Xt.displayName="Bell01";function Ya(t){const e=I.c(26),{activeSection:r,onNavigate:a}=t,{data:n}=st.useSession(),l=n?.user,i=l?.image,o=l?.name??"Profile",d=l?.name??"U";let m;e[0]!==d||e[1]!==i?(m=s.jsx(Tt,{url:i,fallback:d,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=d,e[1]=i,e[2]=m):m=e[2];let c;e[3]!==o||e[4]!==m?(c={key:"account.profile",label:o,icon:m},e[3]=o,e[4]=m,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={key:"account.preferences",label:"Preferences",icon:s.jsx(ws,{size:14})},e[6]=u):u=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={key:"account.experimental",label:"Experimental",icon:s.jsx(Qt,{size:14})},e[7]=f):f=e[7];let x;e[8]!==c?(x=[c,u,f],e[8]=c,e[9]=x):x=e[9];const p=x;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h={key:"org.general",label:"General",icon:s.jsx(Ns,{size:14})},e[10]=h):h=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g={key:"org.plugins",label:"Features",icon:s.jsx(Cs,{size:14})},e[11]=g):g=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=[h,g,{key:"org.billing",label:"Billing",icon:s.jsx(rt,{size:14})}],e[12]=y):y=e[12];const w=y;let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Account"}),e[13]=N):N=e[13];let b;e[14]!==p||e[15]!==r||e[16]!==a?(b=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[N,p.map(k=>s.jsxs("button",{type:"button",onClick:()=>a(k.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",r===k.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:k.icon}),s.jsx("span",{className:"truncate",children:k.label})]},k.key))]}),e[14]=p,e[15]=r,e[16]=a,e[17]=b):b=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=S):S=e[18];let j;e[19]!==r||e[20]!==a?(j=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[S,w.map(k=>s.jsxs("button",{type:"button",onClick:()=>a(k.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",r===k.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:k.icon}),s.jsx("span",{className:"truncate",children:k.label})]},k.key))]}),e[19]=r,e[20]=a,e[21]=j):j=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.141.0"]})}),e[22]=C):C=e[22];let _;return e[23]!==b||e[24]!==j?(_=s.jsxs("div",{className:"w-52 shrink-0 border-r border-border bg-sidebar/50 overflow-y-auto py-3 flex flex-col gap-4",children:[b,j,C]}),e[23]=b,e[24]=j,e[25]=_):_=e[25],_}function Ha(){const t=I.c(32),{data:e}=st.useSession(),[r,a]=v.useState(!1),n=e?.user,l=n?.image;let i;t[0]!==n?(i=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},t[0]=n,t[1]=i):i=t[1];const o=i;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Profile"})}),t[2]=d):d=t[2];const m=n?.name??"U";let c;t[3]!==m||t[4]!==l?(c=s.jsx(Tt,{url:l,fallback:m,shape:"circle",size:"xl",className:"size-16 shrink-0"}),t[3]=m,t[4]=l,t[5]=c):c=t[5];const u=n?.name??"User";let f;t[6]!==u?(f=s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:u}),t[6]=u,t[7]=f):f=t[7];const x=n?.email;let p;t[8]!==x?(p=s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),t[8]=x,t[9]=p):p=t[9];let h;t[10]!==f||t[11]!==p?(h=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[f,p]}),t[10]=f,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==c||t[14]!==h?(g=s.jsxs("div",{className:"flex items-center gap-4",children:[c,h]}),t[13]=c,t[14]=h,t[15]=g):g=t[15];let y;t[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=y):y=t[16];let w;t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("p",{className:"text-sm text-muted-foreground",children:"User ID"}),t[17]=w):w=t[17];const N=n?.id;let b;t[18]!==N?(b=s.jsx("span",{className:"font-mono text-sm",children:N}),t[18]=N,t[19]=b):b=t[19];let S;t[20]!==r?(S=r?s.jsx(Is,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Es,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=r,t[21]=S):S=t[21];let j;t[22]!==o||t[23]!==b||t[24]!==S?(j=s.jsx(ks,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:o,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,S]})}),t[22]=o,t[23]=b,t[24]=S,t[25]=j):j=t[25];let C;t[26]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(_s,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=C):C=t[26];let _;t[27]!==j?(_=s.jsxs("div",{className:"flex flex-col",children:[y,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(As,{children:s.jsxs(Ps,{children:[j,C]})})]})]}),t[27]=j,t[28]=_):_=t[28];let k;return t[29]!==_||t[30]!==g?(k=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,_]}),t[29]=_,t[30]=g,t[31]=k):k=t[31],k}function Qe(t){const e=I.c(27),{icon:r,label:a,description:n,control:l,onClick:i,disabled:o}=t,d=o?void 0:i,m=i?"button":void 0,c=i&&!o?0:void 0;let u;e[0]!==o||e[1]!==i?(u=i&&!o?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),i())}:void 0,e[0]=o,e[1]=i,e[2]=u):u=e[2];const f=i&&!o?"pointer":void 0;let x;e[3]!==f?(x={cursor:f},e[3]=f,e[4]=x):x=e[4];let p;e[5]!==r?(p=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:r}),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==a?(h=s.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[7]=a,e[8]=h):h=e[8];let g;e[9]!==n?(g=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:n}),e[9]=n,e[10]=g):g=e[10];let y;e[11]!==h||e[12]!==g?(y=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=y):y=e[13];let w;e[14]!==y||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,y]}),e[14]=y,e[15]=p,e[16]=w):w=e[16];let N;e[17]!==l?(N=s.jsx("div",{onClick:qa,className:"shrink-0",children:l}),e[17]=l,e[18]=N):N=e[18];let b;return e[19]!==d||e[20]!==w||e[21]!==N||e[22]!==m||e[23]!==c||e[24]!==u||e[25]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0",onClick:d,role:m,tabIndex:c,onKeyDown:u,style:x,children:[w,N]}),e[19]=d,e[20]=w,e[21]=N,e[22]=m,e[23]=c,e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function qa(t){return t.stopPropagation()}function yt(){const t=I.c(35),[e,r]=zt();let a;t[0]!==r?(a=async C=>{if(C&&await Notification.requestPermission()!=="granted"){Pe.error("Notifications denied. Please enable them in your browser settings."),r(Xa);return}r(_=>({..._,enableNotifications:C}))},t[0]=r,t[1]=a):a=t[1];const n=a;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Preferences"})}),t[2]=l):l=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ts,{size:16}),t[3]=i):i=t[3];let o;t[4]!==r?(o=()=>r(Qa),t[4]=r,t[5]=o):o=t[5];let d;t[6]!==r?(d=C=>r(_=>({..._,devMode:C})),t[6]=r,t[7]=d):d=t[7];let m;t[8]!==e.devMode||t[9]!==d?(m=s.jsx(Le,{checked:e.devMode,onCheckedChange:d}),t[8]=e.devMode,t[9]=d,t[10]=m):m=t[10];let c;t[11]!==o||t[12]!==m?(c=s.jsx(Qe,{icon:i,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:o,control:m}),t[11]=o,t[12]=m,t[13]=c):c=t[13];let u;t[14]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Xt,{size:16}),t[14]=u):u=t[14];let f;t[15]!==n||t[16]!==e.enableNotifications?(f=s.jsx(Qe,{icon:u,label:"Notifications",description:"Play a sound and show a notification when chat messages complete while the app is unfocused.",disabled:typeof Notification>"u",onClick:()=>n(!e.enableNotifications),control:s.jsx(Le,{disabled:typeof Notification>"u",checked:e.enableNotifications,onCheckedChange:n})}),t[15]=n,t[16]=e.enableNotifications,t[17]=f):f=t[17];let x;t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(zs,{size:16}),t[18]=x):x=t[18];let p;t[19]!==r?(p=C=>r(_=>({..._,toolApprovalLevel:C})),t[19]=r,t[20]=p):p=t[20];let h;t[21]===Symbol.for("react.memo_cache_sentinel")?(h={none:"Always ask",readonly:"Skip read-only",yolo:"Auto-approve all"},t[21]=h):h=t[21];const g=h[e.toolApprovalLevel];let y;t[22]!==g?(y=s.jsx(Ls,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=y):y=t[23];let w;t[24]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Re,{value:"none",textValue:"Always ask",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Always ask"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Require approval for all tool calls"})]})}),t[24]=w):w=t[24];let N;t[25]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Re,{value:"readonly",textValue:"Skip read-only",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Skip read-only"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),t[25]=N):N=t[25];let b;t[26]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs(Ds,{children:[w,N,s.jsx(Re,{value:"yolo",textValue:"Auto-approve all",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Auto-approve all"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all tools without approval"})]})})]}),t[26]=b):b=t[26];let S;t[27]!==e.toolApprovalLevel||t[28]!==p||t[29]!==y?(S=s.jsx(Qe,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(Os,{value:e.toolApprovalLevel,onValueChange:p,children:[y,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=y,t[30]=S):S=t[30];let j;return t[31]!==S||t[32]!==c||t[33]!==f?(j=s.jsxs("div",{className:"flex flex-col gap-6",children:[l,s.jsxs("div",{className:"flex flex-col",children:[c,f,S]})]}),t[31]=S,t[32]=c,t[33]=f,t[34]=j):j=t[34],j}function Qa(t){return{...t,devMode:!t.devMode}}function Xa(t){return{...t,enableNotifications:!1}}function Ja(t){const e=I.c(22),{icon:r,label:a,description:n,checked:l,onCheckedChange:i}=t;let o;e[0]!==l||e[1]!==i?(o=()=>i(!l),e[0]=l,e[1]=i,e[2]=o):o=e[2];let d;e[3]!==r?(d=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:r}),e[3]=r,e[4]=d):d=e[4];let m;e[5]!==a?(m=s.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[5]=a,e[6]=m):m=e[6];let c;e[7]!==n?(c=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:n}),e[7]=n,e[8]=c):c=e[8];let u;e[9]!==m||e[10]!==c?(u=s.jsxs("div",{className:"min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=u):u=e[11];let f;e[12]!==d||e[13]!==u?(f=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14];let x;e[15]!==l||e[16]!==i?(x=s.jsx("div",{onClick:Za,className:"shrink-0",children:s.jsx(Le,{checked:l,onCheckedChange:i})}),e[15]=l,e[16]=i,e[17]=x):x=e[17];let p;return e[18]!==o||e[19]!==f||e[20]!==x?(p=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0 cursor-pointer",onClick:o,children:[f,x]}),e[18]=o,e[19]=f,e[20]=x,e[21]=p):p=e[21],p}function Za(t){return t.stopPropagation()}function er(){const t=I.c(7),[e,r]=zt();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Experimental"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"These features are unstable and may change or stop working at any time."})]}),t[0]=a):a=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(fs,{size:16}),t[1]=n):n=t[1];let l;t[2]!==r?(l=o=>r(d=>({...d,experimental_projects:o})),t[2]=r,t[3]=l):l=t[3];let i;return t[4]!==e.experimental_projects||t[5]!==l?(i=s.jsxs("div",{className:"flex flex-col gap-6",children:[a,s.jsx("div",{className:"flex flex-col rounded-lg border border-border bg-muted/25 px-4",children:s.jsx(Ja,{icon:n,label:"Projects",description:"Enable the projects feature in the sidebar.",checked:e.experimental_projects,onCheckedChange:l})})]}),t[4]=e.experimental_projects,t[5]=l,t[6]=i):i=t[6],i}const tr=xs({name:Ge().min(1,"Name is required").max(255,"Name is too long"),slug:Ge().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:Ge().optional()});function sr(t){const e=I.c(24),{value:r,onChange:a,name:n}=t,l=v.useRef(null);let i;e[0]!==a?(i=b=>{const S=b.target.files?.[0];if(S){if(S.size>2097152){Pe.error("Image must be smaller than 2MB");return}const j=new FileReader;j.onerror=()=>{const C=j.error;console.error("FileReader error:",C),Pe.error(C?.message||"Failed to read image file. Please try again."),l.current&&(l.current.value="")},j.onloadend=()=>{if(j.readyState===FileReader.DONE&&j.result){const C=j.result;a(C)}},j.readAsDataURL(S)}},e[0]=a,e[1]=i):i=e[1];const o=i;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{l.current?.click()},e[2]=d):d=e[2];const m=d;let c;e[3]!==a?(c=b=>{b.stopPropagation(),a("")},e[3]=a,e[4]=c):c=e[4];const u=c;let f;e[5]!==o?(f=s.jsx("input",{type:"file",ref:l,className:"hidden",accept:"image/*",onChange:o}),e[5]=o,e[6]=f):f=e[6];let x;e[7]!==u||e[8]!==n||e[9]!==r?(x=r?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:r,alt:n||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:u,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(Dt,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:m,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(Ws,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=u,e[8]=n,e[9]=r,e[10]=x):x=e[10];const p=r?"Change Logo":"Upload Logo";let h;e[11]!==p?(h=s.jsx(ce,{type:"button",variant:"outline",size:"sm",onClick:m,className:"mb-2",children:p}),e[11]=p,e[12]=h):h=e[12];let g;e[13]!==u||e[14]!==r?(g=r&&s.jsx(ce,{type:"button",variant:"ghost",size:"sm",onClick:u,className:"ml-2",children:"Remove"}),e[13]=u,e[14]=r,e[15]=g):g=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=y):y=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,y]}),e[17]=h,e[18]=g,e[19]=w):w=e[19];let N;return e[20]!==w||e[21]!==f||e[22]!==x?(N=s.jsxs("div",{className:"flex items-start gap-4",children:[f,x,w]}),e[20]=w,e[21]=f,e[22]=x,e[23]=N):N=e[23],N}function ar(){const t=at(),{org:e,project:r}=me(),a=At(),[n,l]=v.useState(!1),i=ps({resolver:hs(tr),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),o=Bs({mutationFn:async c=>{const u={name:c.name,slug:c.slug};c.logo&&(u.logo=c.logo);const f=await st.organization.update({organizationId:e.id,data:u});if(f?.error)throw new Error(f.error.message||"Failed to update organization");return f},onSuccess:c=>{a.invalidateQueries({queryKey:mt.organizations()}),a.invalidateQueries({queryKey:mt.activeOrganization(e.slug)}),Pe.success("Organization settings updated successfully"),c?.data?.slug&&c.data.slug!==e.slug&&t({to:"/$org/$project/settings",params:{org:c.data.slug,project:r.slug}})},onError:c=>{Pe.error(c instanceof Error?c.message:"Failed to update organization")},onSettled:()=>{l(!1)}}),d=c=>{l(!0),o.mutate(c)},m=i.formState.isDirty;return s.jsx(Gs,{...i,children:s.jsxs("form",{onSubmit:i.handleSubmit(d),className:"space-y-6",children:[s.jsx(Ue,{control:i.control,name:"name",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Organization Name"}),s.jsx(Ye,{children:s.jsx(Ie,{placeholder:"My Organization",...c,disabled:n})}),s.jsx(He,{})]})}),s.jsx(Ue,{control:i.control,name:"slug",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Organization Slug"}),s.jsx(Ye,{children:s.jsx(Ie,{placeholder:"my-organization",...c,disabled:n,onChange:u=>{const f=u.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");c.onChange(f)}})}),s.jsx(Rs,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(He,{})]})}),s.jsx(Ue,{control:i.control,name:"logo",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Logo"}),s.jsx(Ye,{children:s.jsx(sr,{value:c.value,onChange:c.onChange,name:i.watch("name")})}),s.jsx(He,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(ce,{type:"submit",disabled:!m||n,className:"min-w-24",children:n?"Saving...":"Save Changes"}),m&&s.jsx(ce,{type:"button",variant:"outline",onClick:()=>i.reset(),disabled:n,children:"Cancel"})]})]})})}function rr(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Organization"})}),s.jsx(ar,{})]}),t[0]=e):e=t[0],e}var bt=function(e,r){for(var a=arguments.length,n=new Array(a>2?a-2:0),l=2;l<a;l++)n[l-2]=arguments[l];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var i=0;console.warn(r.replace(/%s/g,()=>n[i++]))}},lr=["x1","y1","x2","y2","key"],nr=["offset"],ir=["xAxisId","yAxisId"],or=["xAxisId","yAxisId"];function jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(r),!0).forEach(function(a){cr(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function cr(t,e,r){return(e=dr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dr(t){var e=ur(t,"string");return typeof e=="symbol"?e:e+""}function ur(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xe(){return xe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},xe.apply(null,arguments)}function ze(t,e){if(t==null)return{};var r,a,n=mr(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mr(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}var fr=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:r,x:a,y:n,width:l,height:i,ry:o}=t;return v.createElement("rect",{x:a,y:n,ry:o,width:l,height:i,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Jt(t){var{option:e,lineItemProps:r}=t,a;if(v.isValidElement(e))a=v.cloneElement(e,r);else if(typeof e=="function")a=e(r);else{var n,{x1:l,y1:i,x2:o,y2:d,key:m}=r,c=ze(r,lr),u=(n=nt(c))!==null&&n!==void 0?n:{},{offset:f}=u,x=ze(u,nr);a=v.createElement("line",xe({},x,{x1:l,y1:i,x2:o,y2:d,fill:"none",key:m}))}return a}function xr(t){var{x:e,width:r,horizontal:a=!0,horizontalPoints:n}=t;if(!a||!n||!n.length)return null;var{xAxisId:l,yAxisId:i}=t,o=ze(t,ir),d=n.map((m,c)=>{var u=Z(Z({},o),{},{x1:e,y1:m,x2:e+r,y2:m,key:"line-".concat(c),index:c});return v.createElement(Jt,{key:"line-".concat(c),option:a,lineItemProps:u})});return v.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function pr(t){var{y:e,height:r,vertical:a=!0,verticalPoints:n}=t;if(!a||!n||!n.length)return null;var{xAxisId:l,yAxisId:i}=t,o=ze(t,or),d=n.map((m,c)=>{var u=Z(Z({},o),{},{x1:m,y1:e,x2:m,y2:e+r,key:"line-".concat(c),index:c});return v.createElement(Jt,{option:a,lineItemProps:u,key:"line-".concat(c)})});return v.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function hr(t){var{horizontalFill:e,fillOpacity:r,x:a,y:n,width:l,height:i,horizontalPoints:o,horizontal:d=!0}=t;if(!d||!e||!e.length||o==null)return null;var m=o.map(u=>Math.round(u+n-n)).sort((u,f)=>u-f);n!==m[0]&&m.unshift(0);var c=m.map((u,f)=>{var x=m[f+1],p=x==null,h=p?n+i-u:x-u;if(h<=0)return null;var g=f%e.length;return v.createElement("rect",{key:"react-".concat(f),y:u,x:a,height:h,width:l,stroke:"none",fill:e[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function gr(t){var{vertical:e=!0,verticalFill:r,fillOpacity:a,x:n,y:l,width:i,height:o,verticalPoints:d}=t;if(!e||!r||!r.length)return null;var m=d.map(u=>Math.round(u+n-n)).sort((u,f)=>u-f);n!==m[0]&&m.unshift(0);var c=m.map((u,f)=>{var x=m[f+1],p=x==null,h=p?n+i-u:x-u;if(h<=0)return null;var g=f%r.length;return v.createElement("rect",{key:"react-".concat(f),x:u,y:l,width:h,height:o,stroke:"none",fill:r[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var vr=(t,e)=>{var{xAxis:r,width:a,height:n,offset:l}=t;return Bt(Gt(Z(Z(Z({},_e),r),{},{ticks:Rt(r),viewBox:{x:0,y:0,width:a,height:n}})),l.left,l.left+l.width,e)},yr=(t,e)=>{var{yAxis:r,width:a,height:n,offset:l}=t;return Bt(Gt(Z(Z(Z({},_e),r),{},{ticks:Rt(r),viewBox:{x:0,y:0,width:a,height:n}})),l.top,l.top+l.height,e)},br={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:$t.grid};function Zt(t){var e=Us(),r=Vs(),a=Ks(),n=Z(Z({},lt(t,br)),{},{x:ie(t.x)?t.x:a.left,y:ie(t.y)?t.y:a.top,width:ie(t.width)?t.width:a.width,height:ie(t.height)?t.height:a.height}),{xAxisId:l,yAxisId:i,x:o,y:d,width:m,height:c,syncWithTicks:u,horizontalValues:f,verticalValues:x}=n,p=Me(),h=fe(k=>ft(k,"xAxis",l,p)),g=fe(k=>ft(k,"yAxis",i,p));if(!xt(m)||!xt(c)||!ie(o)||!ie(d))return null;var y=n.verticalCoordinatesGenerator||vr,w=n.horizontalCoordinatesGenerator||yr,{horizontalPoints:N,verticalPoints:b}=n;if((!N||!N.length)&&typeof w=="function"){var S=f&&f.length,j=w({yAxis:g?Z(Z({},g),{},{ticks:S?f:g.ticks}):void 0,width:e??m,height:r??c,offset:a},S?!0:u);bt(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(N=j)}if((!b||!b.length)&&typeof y=="function"){var C=x&&x.length,_=y({xAxis:h?Z(Z({},h),{},{ticks:C?x:h.ticks}):void 0,width:e??m,height:r??c,offset:a},C?!0:u);bt(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(b=_)}return v.createElement(Mt,{zIndex:n.zIndex},v.createElement("g",{className:"recharts-cartesian-grid"},v.createElement(fr,{fill:n.fill,fillOpacity:n.fillOpacity,x:n.x,y:n.y,width:n.width,height:n.height,ry:n.ry}),v.createElement(hr,xe({},n,{horizontalPoints:N})),v.createElement(gr,xe({},n,{verticalPoints:b})),v.createElement(xr,xe({},n,{offset:a,horizontalPoints:N,xAxis:h,yAxis:g})),v.createElement(pr,xe({},n,{offset:a,verticalPoints:b,xAxis:h,yAxis:g}))))}Zt.displayName="CartesianGrid";var es=(t,e,r)=>Wt(t,"xAxis",ot(t,e),r),ts=(t,e,r)=>Ft(t,"xAxis",ot(t,e),r),ss=(t,e,r)=>Wt(t,"yAxis",ct(t,e),r),as=(t,e,r)=>Ft(t,"yAxis",ct(t,e),r),jr=Be([it,es,ss,ts,as],(t,e,r,a,n)=>Ut(t,"xAxis")?pt(e,a,!1):pt(r,n,!1)),Nr=(t,e)=>e,rs=Be([Qs,Nr],(t,e)=>t.filter(r=>r.type==="area").find(r=>r.id===e)),ls=t=>{var e=it(t),r=Ut(e,"xAxis");return r?"yAxis":"xAxis"},Sr=(t,e)=>{var r=ls(t);return r==="yAxis"?ct(t,e):ot(t,e)},wr=(t,e,r)=>Xs(t,ls(t),Sr(t,e),r),Cr=Be([rs,wr],(t,e)=>{var r;if(!(t==null||e==null)){var{stackId:a}=t,n=qs(t);if(!(a==null||n==null)){var l=(r=e[a])===null||r===void 0?void 0:r.stackedData,i=l?.find(o=>o.key===n);if(i!=null)return i.map(o=>[o[0],o[1]])}}}),kr=Be([it,es,ss,ts,as,Cr,Ys,jr,rs,Hs],(t,e,r,a,n,l,i,o,d,m)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:f}=i;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||r==null||a==null||n==null||a.length===0||n.length===0||o==null)){var{data:x}=d,p;if(x&&x.length>0?p=x:p=c?.slice(u,f+1),p!=null)return Kr({layout:t,xAxis:e,yAxis:r,xAxisTicks:a,yAxisTicks:n,dataStartIndex:u,areaSettings:d,stackedData:l,displayedData:p,chartBaseValue:m,bandSize:o})}}),_r=["id"],Ar=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function pe(){return pe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},pe.apply(null,arguments)}function ns(t,e){if(t==null)return{};var r,a,n=Pr(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Pr(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function Nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Se(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nt(Object(r),!0).forEach(function(a){Ir(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function Ir(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=Or(t,"string");return typeof e=="symbol"?e:e+""}function Or(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $e(t,e){return t&&t!=="none"?t:e}var Lr=t=>{var{dataKey:e,name:r,stroke:a,fill:n,legendType:l,hide:i}=t;return[{inactive:i,dataKey:e,type:l,color:$e(a,n),value:Vt(r,e),payload:t}]},Dr=v.memo(t=>{var{dataKey:e,data:r,stroke:a,strokeWidth:n,fill:l,name:i,hide:o,unit:d,tooltipType:m,id:c}=t,u={dataDefinedOnItem:r,getPosition:ra,settings:{stroke:a,strokeWidth:n,fill:l,dataKey:e,nameKey:void 0,name:Vt(i,e),hide:o,type:m,color:$e(a,l),unit:d,graphicalItemId:c}};return v.createElement(aa,{tooltipEntrySettings:u})});function Tr(t){var{clipPathId:e,points:r,props:a}=t,{needClip:n,dot:l,dataKey:i}=a,o=nt(a);return v.createElement(ya,{points:r,dot:l,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:i,baseProps:o,needClip:n,clipPathId:e})}function zr(t){var{showLabels:e,children:r,points:a}=t,n=a.map(l=>{var i,o,d={x:(i=l.x)!==null&&i!==void 0?i:0,y:(o=l.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Se(Se({},d),{},{value:l.value,payload:l.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return v.createElement(ga,{value:e?n:void 0},r)}function St(t){var{points:e,baseLine:r,needClip:a,clipPathId:n,props:l}=t,{layout:i,type:o,stroke:d,connectNulls:m,isRange:c}=l,{id:u}=l,f=ns(l,_r),x=nt(f),p=va(f);return v.createElement(v.Fragment,null,e?.length>1&&v.createElement(De,{clipPath:a?"url(#clipPath-".concat(n,")"):void 0},v.createElement(qe,pe({},p,{id:u,points:e,connectNulls:m,type:o,baseLine:r,layout:i,stroke:"none",className:"recharts-area-area"})),d!=="none"&&v.createElement(qe,pe({},x,{className:"recharts-area-curve",layout:i,type:o,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&Array.isArray(r)&&v.createElement(qe,pe({},x,{className:"recharts-area-curve",layout:i,type:o,connectNulls:m,fill:"none",points:r}))),v.createElement(Tr,{points:e,props:f,clipPathId:n}))}function $r(t){var e,r,{alpha:a,baseLine:n,points:l,strokeWidth:i}=t,o=(e=l[0])===null||e===void 0?void 0:e.y,d=(r=l[l.length-1])===null||r===void 0?void 0:r.y;if(!Te(o)||!Te(d))return null;var m=a*Math.abs(o-d),c=Math.max(...l.map(u=>u.x||0));return ie(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(u=>u.x||0),c)),ie(c)?v.createElement("rect",{x:0,y:o<d?o:o-m,width:c+(i?parseInt("".concat(i),10):1),height:Math.floor(m)}):null}function Mr(t){var e,r,{alpha:a,baseLine:n,points:l,strokeWidth:i}=t,o=(e=l[0])===null||e===void 0?void 0:e.x,d=(r=l[l.length-1])===null||r===void 0?void 0:r.x;if(!Te(o)||!Te(d))return null;var m=a*Math.abs(o-d),c=Math.max(...l.map(u=>u.y||0));return ie(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(u=>u.y||0),c)),ie(c)?v.createElement("rect",{x:o<d?o:o-m,y:0,width:m,height:Math.floor(c+(i?parseInt("".concat(i),10):1))}):null}function Br(t){var{alpha:e,layout:r,points:a,baseLine:n,strokeWidth:l}=t;return r==="vertical"?v.createElement($r,{alpha:e,points:a,baseLine:n,strokeWidth:l}):v.createElement(Mr,{alpha:e,points:a,baseLine:n,strokeWidth:l})}function Gr(t){var{needClip:e,clipPathId:r,props:a,previousPointsRef:n,previousBaselineRef:l}=t,{points:i,baseLine:o,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:u,onAnimationStart:f,onAnimationEnd:x}=a,p=v.useMemo(()=>({points:i,baseLine:o}),[i,o]),h=ma(p,"recharts-area-"),g=Kt(),[y,w]=v.useState(!1),N=!y,b=v.useCallback(()=>{typeof x=="function"&&x(),w(!1)},[x]),S=v.useCallback(()=>{typeof f=="function"&&f(),w(!0)},[f]);if(g==null)return null;var j=n.current,C=l.current;return v.createElement(zr,{showLabels:N,points:i},a.children,v.createElement(fa,{animationId:h,begin:m,duration:c,isActive:d,easing:u,onAnimationEnd:b,onAnimationStart:S,key:h},_=>{if(j){var k=j.length/i.length,E=_===1?i:i.map((A,O)=>{var D=Math.floor(O*k);if(j[D]){var L=j[D];return Se(Se({},A),{},{x:Ne(L.x,A.x,_),y:Ne(L.y,A.y,_)})}return A}),z;return ie(o)?z=Ne(C,o,_):xa(o)||pa(o)?z=Ne(C,0,_):z=o.map((A,O)=>{var D=Math.floor(O*k);if(Array.isArray(C)&&C[D]){var L=C[D];return Se(Se({},A),{},{x:Ne(L.x,A.x,_),y:Ne(L.y,A.y,_)})}return A}),_>0&&(n.current=E,l.current=z),v.createElement(St,{points:E,baseLine:z,needClip:e,clipPathId:r,props:a})}return _>0&&(n.current=i,l.current=o),v.createElement(De,null,d&&v.createElement("defs",null,v.createElement("clipPath",{id:"animationClipPath-".concat(r)},v.createElement(Br,{alpha:_,points:i,baseLine:o,layout:g,strokeWidth:a.strokeWidth}))),v.createElement(De,{clipPath:"url(#animationClipPath-".concat(r,")")},v.createElement(St,{points:i,baseLine:o,needClip:e,clipPathId:r,props:a})))}),v.createElement(ha,{label:a.label}))}function Rr(t){var{needClip:e,clipPathId:r,props:a}=t,n=v.useRef(null),l=v.useRef();return v.createElement(Gr,{needClip:e,clipPathId:r,props:a,previousPointsRef:n,previousBaselineRef:l})}class Wr extends v.PureComponent{render(){var{hide:e,dot:r,points:a,className:n,top:l,left:i,needClip:o,xAxisId:d,yAxisId:m,width:c,height:u,id:f,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Pt("recharts-area",n),g=f,{r:y,strokeWidth:w}=ca(r),N=da(r),b=y*2+w,S=o?"url(#clipPath-".concat(N?"":"dots-").concat(g,")"):void 0;return v.createElement(Mt,{zIndex:p},v.createElement(De,{className:h},o&&v.createElement("defs",null,v.createElement(ua,{clipPathId:g,xAxisId:d,yAxisId:m}),!N&&v.createElement("clipPath",{id:"clipPath-dots-".concat(g)},v.createElement("rect",{x:i-b/2,y:l-b/2,width:c+b,height:u+b}))),v.createElement(Rr,{needClip:o,clipPathId:g,props:this.props})),v.createElement(ht,{points:a,mainColor:$e(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(x)&&v.createElement(ht,{points:x,mainColor:$e(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}}var Fr={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:$t.area};function Ur(t){var e,{activeDot:r,animationBegin:a,animationDuration:n,animationEasing:l,connectNulls:i,dot:o,fill:d,fillOpacity:m,hide:c,isAnimationActive:u,legendType:f,stroke:x,xAxisId:p,yAxisId:h}=t,g=ns(t,Ar),y=la(),w=na(),{needClip:N}=ia(p,h),b=Me(),{points:S,isRange:j,baseLine:C}=(e=fe(O=>kr(O,t.id,b)))!==null&&e!==void 0?e:{},_=oa();if(y!=="horizontal"&&y!=="vertical"||_==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:k,width:E,x:z,y:A}=_;return!S||!S.length?null:v.createElement(Wr,pe({},g,{activeDot:r,animationBegin:a,animationDuration:n,animationEasing:l,baseLine:C,connectNulls:i,dot:o,fill:d,fillOpacity:m,height:k,hide:c,layout:y,isAnimationActive:u,isRange:j,legendType:f,needClip:N,points:S,stroke:x,width:E,left:z,top:A,xAxisId:p,yAxisId:h}))}var Vr=(t,e,r,a,n)=>{var l=r??e;if(ie(l))return l;var i=t==="horizontal"?n:a,o=i.scale.domain();if(i.type==="number"){var d=Math.max(o[0],o[1]),m=Math.min(o[0],o[1]);return l==="dataMin"?m:l==="dataMax"||d<0?d:Math.max(Math.min(o[0],o[1]),0)}return l==="dataMin"?o[0]:l==="dataMax"?o[1]:o[0]};function Kr(t){var{areaSettings:{connectNulls:e,baseValue:r,dataKey:a},stackedData:n,layout:l,chartBaseValue:i,xAxis:o,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:u,yAxisTicks:f,bandSize:x}=t,p=n&&n.length,h=Vr(l,i,r,o,d),g=l==="horizontal",y=!1,w=m.map((b,S)=>{var j,C,_,k;if(p)k=n[c+S];else{var E=gt(b,a);Array.isArray(E)?(k=E,y=!0):k=[h,E]}var z=(j=(C=k)===null||C===void 0?void 0:C[1])!==null&&j!==void 0?j:null,A=z==null||p&&!e&&gt(b,a)==null;if(g){var O;return{x:vt({axis:o,ticks:u,bandSize:x,entry:b,index:S}),y:A?null:(O=d.scale.map(z))!==null&&O!==void 0?O:null,value:k,payload:b}}return{x:A?null:(_=o.scale.map(z))!==null&&_!==void 0?_:null,y:vt({axis:d,ticks:f,bandSize:x,entry:b,index:S}),value:k,payload:b}}),N;return p||y?N=w.map(b=>{var S,j=Array.isArray(b.value)?b.value[0]:null;if(g){var C;return{x:b.x,y:j!=null&&b.y!=null&&(C=d.scale.map(j))!==null&&C!==void 0?C:null,payload:b.payload}}return{x:j!=null&&(S=o.scale.map(j))!==null&&S!==void 0?S:null,y:b.y,payload:b.payload}}):N=g?d.scale.map(h):o.scale.map(h),{points:w,baseLine:N??0,isRange:y}}function Yr(t){var e=lt(t,Fr),r=Me();return v.createElement(Zs,{id:e.id,type:"area"},a=>v.createElement(v.Fragment,null,v.createElement(ea,{legendPayload:Lr(e)}),v.createElement(Dr,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:a}),v.createElement(ta,{type:"area",id:a,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:sa(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:r,connectNulls:e.connectNulls}),v.createElement(Ur,pe({},e,{id:a}))))}var is=v.memo(Yr,Js);is.displayName="Area";var Hr=["type"],qr=["dangerouslySetInnerHTML","ticks","scale"],Qr=["id","scale"];function et(){return et=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},et.apply(null,arguments)}function wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Ct(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wt(Object(r),!0).forEach(function(a){Xr(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function Xr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jr(t){var e=Zr(t,"string");return typeof e=="symbol"?e:e+""}function Zr(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tt(t,e){if(t==null)return{};var r,a,n=el(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function el(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function tl(t){var e=Yt(),r=v.useRef(null),a=Kt(),{type:n}=t,l=tt(t,Hr),i=Oa(a,"yAxis",n),o=v.useMemo(()=>{if(i!=null)return Ct(Ct({},l),{},{type:i})},[i,l]);return v.useLayoutEffect(()=>{o!=null&&(r.current===null?e(ja(o)):r.current!==o&&e(Na({prev:r.current,next:o})),r.current=o)},[o,e]),v.useLayoutEffect(()=>()=>{r.current&&(e(Sa(r.current)),r.current=null)},[e]),null}function sl(t){var{yAxisId:e,className:r,width:a,label:n}=t,l=v.useRef(null),i=v.useRef(null),o=fe(wa),d=Me(),m=Yt(),c="yAxis",u=fe(j=>Ca(j,e)),f=fe(j=>ka(j,e)),x=fe(j=>_a(j,c,e,d)),p=fe(j=>Aa(j,e));if(v.useLayoutEffect(()=>{if(!(a!=="auto"||!u||Pa(n)||v.isValidElement(n)||p==null)){var j=l.current;if(j){var C=j.getCalculatedWidth();Math.round(u.width)!==Math.round(C)&&m(Ia({id:e,width:C}))}}},[x,u,m,n,e,a,p]),u==null||f==null||p==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:y}=t,w=tt(t,qr),{id:N,scale:b}=p,S=tt(p,Qr);return v.createElement(Ea,et({},w,S,{ref:l,labelRef:i,x:f.x,y:f.y,tickTextProps:a==="auto"?{width:void 0}:{width:a},width:u.width,height:u.height,className:Pt("recharts-".concat(c," ").concat(c),r),viewBox:o,ticks:x,axisType:c,axisId:e}))}var al={allowDataOverflow:J.allowDataOverflow,allowDecimals:J.allowDecimals,allowDuplicatedCategory:J.allowDuplicatedCategory,angle:J.angle,axisLine:_e.axisLine,hide:!1,includeHidden:J.includeHidden,interval:J.interval,label:!1,minTickGap:J.minTickGap,mirror:J.mirror,orientation:J.orientation,padding:J.padding,reversed:J.reversed,scale:J.scale,tick:J.tick,tickCount:J.tickCount,tickLine:_e.tickLine,tickSize:_e.tickSize,type:J.type,niceTicks:J.niceTicks,width:J.width,yAxisId:0},rl=t=>{var e=lt(t,al);return v.createElement(v.Fragment,null,v.createElement(tl,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),v.createElement(sl,e))},os=v.memo(rl,ba);os.displayName="YAxis";var ll=["axis"],nl=v.forwardRef((t,e)=>v.createElement(La,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:ll,tooltipPayloadSearcher:Da,categoricalChartProps:t,ref:e}));const we="$.providerMetadata.openrouter.usage.cost";function ut(t){const e=new Date,r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=new Date(r);a.setDate(a.getDate()+1);const n=new Date(r),l=t==="7d"?7:t==="30d"?30:90;return n.setDate(n.getDate()-l),{startDate:n.toISOString(),endDate:a.toISOString()}}function Ce(t){return t.structuredContent}function V(t){return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}const cs="gateway-chip-period";function il(){try{const t=localStorage.getItem(cs);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function ol(t){try{localStorage.setItem(cs,t)}catch{}}const cl={low:"Low confidence",medium:"Medium confidence",high:"High confidence"},dl={daily:"daily",weekly:"weekly",monthly:"monthly"},ul=[5,10,25,50,100],ml=[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"none",label:"No reset"}];function fl(t){const e=I.c(51),{open:r,onOpenChange:a,connectionId:n,currentLimitUsd:l,billingMode:i,currentLimitPeriod:o}=t,{org:d}=me(),[m,c]=v.useState(null),[u,f]=v.useState(""),[x,p]=v.useState(null),[h,g]=v.useState(null),[y,w]=v.useState(o??"none");let N;e[0]!==n||e[1]!==d.id?(N={connectionId:n,orgId:d.id},e[0]=n,e[1]=d.id,e[2]=N):N=e[2];const b=ke(N);let S;e[3]!==b?(S={client:b},e[3]=b,e[4]=S):S=e[4];const{mutate:j,isPending:C}=qt(S),_=At(),k=i==="postpaid";let E;e[5]!==u?(E=u?Number.parseFloat(u):null,e[5]=u,e[6]=E):E=e[6];const A=m??E,O=y==="none"?null:y,D=k&&A!=null&&A===l&&O===o;let L;e[7]!==b?(L=Wa.mcpToolCall(b,"GATEWAY_USAGE",JSON.stringify({})),e[7]=b,e[8]=L):L=e[8];const G=L;let K;e[9]!==G||e[10]!==_?(K=async()=>{await _.invalidateQueries({queryKey:G,exact:!0}),await _.refetchQueries({queryKey:G,exact:!0,type:"active"})},e[9]=G,e[10]=_,e[11]=K):K=e[11];const F=K;let T,$;e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==A||e[16]!==k||e[17]!==y||e[18]!==j||e[19]!==a||e[20]!==F?($=()=>{if(!A||A<=0)return;const B=k?A:l+A;g(null);const ae={limit_usd:B,billing_mode:i,return_url:window.location.href};k&&(ae.limit_period=y),j({name:"GATEWAY_SET_LIMIT",arguments:ae},{onSuccess:async re=>{const te=re.structuredContent;te?.checkout_url||await F(),te?.checkout_url?p(te.checkout_url):T()},onError:re=>{g(re.message??"Failed to update limit.")}})},T=()=>{c(null),f(""),p(null),g(null),w(o??"none"),a(!1)},e[12]=i,e[13]=o,e[14]=l,e[15]=A,e[16]=k,e[17]=y,e[18]=j,e[19]=a,e[20]=F,e[21]=T,e[22]=$):(T=e[21],$=e[22]);const Y=k?"Configure Spending Limit":"Add Credit",H=k?"Set a spending limit for your AI Gateway. The limit resets automatically based on the selected period.":"Choose how much credit to add to your AI Gateway.",M=k?"New limit":"Select amount",U=k?"Set Limit":"Continue";let q;e[23]!==Y?(q=s.jsx(ys,{children:Y}),e[23]=Y,e[24]=q):q=e[24];let ee;e[25]!==H?(ee=s.jsx(bs,{children:H}),e[25]=H,e[26]=ee):ee=e[26];let R;e[27]!==q||e[28]!==ee?(R=s.jsxs(js,{children:[q,ee]}),e[27]=q,e[28]=ee,e[29]=R):R=e[29];let W;e[30]!==M||e[31]!==x||e[32]!==U||e[33]!==l||e[34]!==u||e[35]!==A||e[36]!==h||e[37]!==$||e[38]!==C||e[39]!==k||e[40]!==D||e[41]!==y||e[42]!==m?(W=x?s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment link is ready. Click below to complete the purchase. You'll be redirected back here after payment."}),s.jsx(ce,{asChild:!0,className:"gap-2",children:s.jsxs("a",{href:x,children:[s.jsx(rt,{size:15}),"Complete Payment"]})})]}):s.jsxs("div",{className:"flex flex-col gap-5 pt-2",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Ae,{className:"text-xs text-muted-foreground",children:M}),s.jsx("div",{className:"grid grid-cols-5 gap-2",children:ul.map(B=>s.jsxs("button",{type:"button",onClick:()=>{c(B),f("")},className:ue("rounded-md border px-3 py-2 text-sm font-medium transition-colors",m===B?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:["$",B]},B))})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Ae,{htmlFor:"custom-amount",className:"text-xs text-muted-foreground",children:k?"Or enter the exact new limit":"Or enter a custom amount"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),s.jsx(Ie,{id:"custom-amount",type:"number",min:"0.01",step:"0.01",placeholder:"0.00",className:"pl-7",value:u,onChange:B=>{f(B.target.value),c(null)}})]})]}),k&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Ae,{className:"text-xs text-muted-foreground",children:"Reset period"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:ml.map(B=>{const{value:ae,label:re}=B;return s.jsx("button",{type:"button",onClick:()=>w(ae),className:ue("rounded-md border px-2 py-2 text-xs font-medium transition-colors",y===ae?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:re},ae)})})]}),h&&s.jsx("p",{className:"text-xs text-destructive",children:h}),s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:k?s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:l>0?V(l):"none"})]}):s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:V(l)})]})}),s.jsx(ce,{onClick:$,disabled:C||!A||A<=0||D,className:"gap-2",children:C?"Updating...":U})]})]}),e[30]=M,e[31]=x,e[32]=U,e[33]=l,e[34]=u,e[35]=A,e[36]=h,e[37]=$,e[38]=C,e[39]=k,e[40]=D,e[41]=y,e[42]=m,e[43]=W):W=e[43];let Q;e[44]!==R||e[45]!==W?(Q=s.jsxs(Ot,{className:"sm:max-w-md",children:[R,W]}),e[44]=R,e[45]=W,e[46]=Q):Q=e[46];let se;return e[47]!==T||e[48]!==r||e[49]!==Q?(se=s.jsx(Lt,{open:r,onOpenChange:T,children:Q}),e[47]=T,e[48]=r,e[49]=Q,e[50]=se):se=e[50],se}function xl(t){const e=I.c(22),{estimation:r}=t;if(!r)return null;const{estimatedDaysRemaining:a,estimatedDepletionDate:n,avgDailySpend:l}=r;if(a==null)return null;let i;e[0]!==n?(i=n?new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=n,e[1]=i):i=e[1];const o=i,d=a!==1?"s":"";let m;e[2]!==a||e[3]!==d?(m=s.jsxs("span",{className:"tabular-nums font-medium text-foreground",children:["~",a," day",d," ","remaining"]}),e[2]=a,e[3]=d,e[4]=m):m=e[4];let c;e[5]!==o?(c=o&&s.jsxs("span",{children:["(until ",o,")"]}),e[5]=o,e[6]=c):c=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),e[7]=u):u=e[7];let f;e[8]!==l?(f=V(l),e[8]=l,e[9]=f):f=e[9];let x;e[10]!==f?(x=s.jsxs("span",{className:"tabular-nums",children:["avg ",f,"/day"]}),e[10]=f,e[11]=x):x=e[11];let p;e[12]!==r.resetsBeforeDepletion?(p=r.resetsBeforeDepletion&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),s.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Resets before depletion"})]}),e[12]=r.resetsBeforeDepletion,e[13]=p):p=e[13];const h=cl[r.confidence];let g;e[14]!==h?(g=s.jsx(Ba,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 font-normal",children:h}),e[14]=h,e[15]=g):g=e[15];let y;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(y=s.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[m,c,u,x,p,g]}),e[16]=g,e[17]=m,e[18]=c,e[19]=x,e[20]=p,e[21]=y):y=e[21],y}function pl(t){const e=I.c(37),{usage:r,limit:a,limitPeriod:n,onConfigureLimit:l,connectionId:i,alert:o}=t,d=a.total!=null&&a.total>0;let m;e[0]!==d||e[1]!==a.remaining||e[2]!==a.total?(m=d?Math.min(100,Math.round((a.total-(a.remaining??0))/a.total*100)):null,e[0]=d,e[1]=a.remaining,e[2]=a.total,e[3]=m):m=e[3];const c=m;let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Spending"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[4]=u):u=e[4];let f;e[5]!==r.total?(f=V(r.total),e[5]=r.total,e[6]=f):f=e[6];let x;e[7]!==f?(x=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:f}),e[7]=f,e[8]=x):x=e[8];let p;e[9]!==d||e[10]!==a.total||e[11]!==n?(p=d&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",V(a.total)," limit",n&&s.jsxs("span",{className:"ml-1.5 inline-flex items-center gap-1",children:[s.jsx(Ra,{size:10}),dl[n]]})]}),e[9]=d,e[10]=a.total,e[11]=n,e[12]=p):p=e[12];let h;e[13]!==d?(h=!d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"No limit configured"}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==x||e[16]!==p||e[17]!==h?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[u,x,p,h]}),e[15]=x,e[16]=p,e[17]=h,e[18]=g):g=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ht,{size:16}),e[19]=y):y=e[19];const w=d?"Configure Limit":"Set Limit";let N;e[20]!==l||e[21]!==w?(N=s.jsxs(ce,{onClick:l,variant:"outline",className:"gap-2",children:[y,w]}),e[20]=l,e[21]=w,e[22]=N):N=e[22];let b;e[23]!==N||e[24]!==g?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[g,N]}),e[23]=N,e[24]=g,e[25]=b):b=e[25];let S;e[26]!==d||e[27]!==a.reset||e[28]!==c?(S=d&&c!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ue("h-full rounded-full transition-all",c>=90?"bg-destructive":c>=70?"bg-amber-500":"bg-primary"),style:{width:`${c}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[c,"% used",a.reset&&s.jsxs("span",{className:"ml-2",children:["· resets ",a.reset]})]})]}),e[26]=d,e[27]=a.reset,e[28]=c,e[29]=S):S=e[29];let j;e[30]!==o||e[31]!==i?(j=s.jsx(ds,{connectionId:i,alert:o,billingMode:"postpaid"}),e[30]=o,e[31]=i,e[32]=j):j=e[32];let C;return e[33]!==b||e[34]!==S||e[35]!==j?(C=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[b,S,j]}),e[33]=b,e[34]=S,e[35]=j,e[36]=C):C=e[36],C}function hl(t){const e=I.c(30),{available:r,total:a,estimation:n,onAddCredit:l,connectionId:i,alert:o}=t,d=a>0?Math.max(0,Math.min(100,(a-r)/a*100)):0;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Available Credit"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[0]=m):m=e[0];let c;e[1]!==r?(c=V(r),e[1]=r,e[2]=c):c=e[2];let u;e[3]!==c?(u=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:c}),e[3]=c,e[4]=u):u=e[4];let f;e[5]!==a?(f=a>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",V(a)," total"]}),e[5]=a,e[6]=f):f=e[6];let x;e[7]!==u||e[8]!==f?(x=s.jsxs("div",{className:"flex flex-col gap-1",children:[m,u,f]}),e[7]=u,e[8]=f,e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Ht,{size:16}),e[10]=p):p=e[10];let h;e[11]!==l?(h=s.jsxs(ce,{onClick:l,className:"gap-2 px-5",children:[p,"Add Credit"]}),e[11]=l,e[12]=h):h=e[12];let g;e[13]!==x||e[14]!==h?(g=s.jsxs("div",{className:"flex items-center justify-between",children:[x,h]}),e[13]=x,e[14]=h,e[15]=g):g=e[15];let y;e[16]!==r||e[17]!==a||e[18]!==d?(y=a>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${d}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[V(Math.max(0,a-r))," used"]})]}),e[16]=r,e[17]=a,e[18]=d,e[19]=y):y=e[19];let w;e[20]!==n?(w=s.jsx(xl,{estimation:n}),e[20]=n,e[21]=w):w=e[21];let N;e[22]!==o||e[23]!==i?(N=s.jsx(ds,{connectionId:i,alert:o,billingMode:"prepaid"}),e[22]=o,e[23]=i,e[24]=N):N=e[24];let b;return e[25]!==w||e[26]!==N||e[27]!==g||e[28]!==y?(b=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[g,y,w,N]}),e[25]=w,e[26]=N,e[27]=g,e[28]=y,e[29]=b):b=e[29],b}function ds(t){const e=I.c(78),{connectionId:r,alert:a,billingMode:n}=t,{org:l}=me(),[i,o]=v.useState(!1),[d,m]=v.useState(a.enabled),[c,u]=v.useState(String(a.threshold_usd)),[f,x]=v.useState(a.email??""),[p,h]=v.useState(!1),[g,y]=v.useState(null);let w;e[0]!==r||e[1]!==l.id?(w={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=w):w=e[2];const N=ke(w);let b;e[3]!==N?(b={client:N},e[3]=N,e[4]=b):b=e[4];const{mutate:S,isPending:j}=qt(b),C=d!==a.enabled||c!==String(a.threshold_usd)||f!==(a.email??"");let _;e[5]!==f||e[6]!==d||e[7]!==S||e[8]!==c?(_=()=>{y(null),h(!1);const X=parseFloat(c);if(d&&(!f||!f.includes("@"))){y("A valid email is required to enable alerts.");return}if(Number.isNaN(X)||X<=0){y("Threshold must be a positive number.");return}S({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:X,...f?{email:f}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:he=>{y(he.message??"Failed to save alert config.")}})},e[5]=f,e[6]=d,e[7]=S,e[8]=c,e[9]=_):_=e[9];const k=_,E=n==="postpaid"?"Usage Alert":"Low-Balance Alert",z=n==="postpaid"?"Get notified when spending reaches a threshold":"Get notified when credit drops below a threshold";if(!i){let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>o(!0),e[10]=X):X=e[10];let he;e[11]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsx("div",{className:"flex items-center justify-center size-7 rounded-md bg-muted shrink-0",children:s.jsx(Ga,{size:14,className:"text-muted-foreground"})}),e[11]=he):he=e[11];let ge;e[12]!==E?(ge=s.jsx("p",{className:"text-xs font-medium text-foreground",children:E}),e[12]=E,e[13]=ge):ge=e[13];let ve;e[14]!==a.enabled||e[15]!==a.threshold_usd||e[16]!==n?(ve=a.enabled?n==="postpaid"?`Enabled · Alert at ${V(a.threshold_usd)}`:`Enabled · Alert below ${V(a.threshold_usd)}`:n==="postpaid"?"Get notified before your spending limit runs out":"Get notified before your credit balance runs out",e[14]=a.enabled,e[15]=a.threshold_usd,e[16]=n,e[17]=ve):ve=e[17];let ye;e[18]!==ve?(ye=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:ve}),e[18]=ve,e[19]=ye):ye=e[19];let be;e[20]!==ge||e[21]!==ye?(be=s.jsxs("div",{className:"flex-1 min-w-0",children:[ge,ye]}),e[20]=ge,e[21]=ye,e[22]=be):be=e[22];let je;e[23]!==a.enabled?(je=a.enabled&&s.jsx("span",{className:"shrink-0 rounded-full bg-green-500/15 px-2 py-0.5 text-[10px] font-medium text-green-600 dark:text-green-400",children:"On"}),e[23]=a.enabled,e[24]=je):je=e[24];let Oe;return e[25]!==je||e[26]!==be?(Oe=s.jsxs("button",{type:"button",onClick:X,className:"mt-4 flex items-center gap-3 rounded-lg border border-dashed border-border/60 px-4 py-3 w-full text-left transition-colors hover:bg-muted/50 hover:border-border",children:[he,be,je]}),e[25]=je,e[26]=be,e[27]=Oe):Oe=e[27],Oe}let A;e[28]!==E?(A=s.jsx("p",{className:"text-xs font-medium text-foreground",children:E}),e[28]=E,e[29]=A):A=e[29];let O;e[30]!==z?(O=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:z}),e[30]=z,e[31]=O):O=e[31];let D;e[32]!==A||e[33]!==O?(D=s.jsxs("div",{children:[A,O]}),e[32]=A,e[33]=O,e[34]=D):D=e[34];let L;e[35]!==d?(L=s.jsx(Le,{checked:d,onCheckedChange:m}),e[35]=d,e[36]=L):L=e[36];let G;e[37]!==D||e[38]!==L?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[D,L]}),e[37]=D,e[38]=L,e[39]=G):G=e[39];const K=!d&&"opacity-50 pointer-events-none";let F;e[40]!==K?(F=ue("flex flex-col gap-3 transition-opacity",K),e[40]=K,e[41]=F):F=e[41];const T=n==="postpaid"?"Notify at":"Notify below";let $;e[42]!==T?($=s.jsx(Ae,{htmlFor:"alert-threshold",className:"text-[11px] text-muted-foreground",children:T}),e[42]=T,e[43]=$):$=e[43];let Y;e[44]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e[44]=Y):Y=e[44];let H;e[45]===Symbol.for("react.memo_cache_sentinel")?(H=X=>u(X.target.value),e[45]=H):H=e[45];let M;e[46]!==c?(M=s.jsxs("div",{className:"relative",children:[Y,s.jsx(Ie,{id:"alert-threshold",type:"number",min:"1",step:"1",className:"h-8 pl-7 text-xs",value:c,onChange:H})]}),e[46]=c,e[47]=M):M=e[47];let U;e[48]!==$||e[49]!==M?(U=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[$,M]}),e[48]=$,e[49]=M,e[50]=U):U=e[50];let q;e[51]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ae,{htmlFor:"alert-email",className:"text-[11px] text-muted-foreground",children:"Notification email"}),e[51]=q):q=e[51];let ee;e[52]===Symbol.for("react.memo_cache_sentinel")?(ee=X=>x(X.target.value),e[52]=ee):ee=e[52];let R;e[53]!==f?(R=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[q,s.jsx(Ie,{id:"alert-email",type:"email",placeholder:"you@example.com",className:"h-8 text-xs",value:f,onChange:ee})]}),e[53]=f,e[54]=R):R=e[54];let W;e[55]!==U||e[56]!==R?(W=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[U,R]}),e[55]=U,e[56]=R,e[57]=W):W=e[57];let Q;e[58]!==g?(Q=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=Q):Q=e[59];let se;e[60]!==F||e[61]!==W||e[62]!==Q?(se=s.jsxs("div",{className:F,children:[W,Q]}),e[60]=F,e[61]=W,e[62]=Q,e[63]=se):se=e[63];let B;e[64]!==p?(B=p&&s.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Saved"}),e[64]=p,e[65]=B):B=e[65];let ae;e[66]===Symbol.for("react.memo_cache_sentinel")?(ae=s.jsx(ce,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>o(!1),children:"Cancel"}),e[66]=ae):ae=e[66];const re=j||!C,te=j?"Saving...":"Save Alert";let le;e[67]!==k||e[68]!==re||e[69]!==te?(le=s.jsx(ce,{size:"sm",className:"h-7 text-xs",onClick:k,disabled:re,children:te}),e[67]=k,e[68]=re,e[69]=te,e[70]=le):le=e[70];let de;e[71]!==B||e[72]!==le?(de=s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[B,ae,le]}),e[71]=B,e[72]=le,e[73]=de):de=e[73];let P;return e[74]!==se||e[75]!==de||e[76]!==G?(P=s.jsxs("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-border bg-muted/20 p-4",children:[G,se,de]}),e[74]=se,e[75]=de,e[76]=G,e[77]=P):P=e[77],P}const gl={cost:{label:"Cost",color:"var(--chart-1)"}};function vl(){const t=I.c(54),{org:e}=me(),[r,a]=v.useState("7d");let n;t[0]!==r?(n=ut(r),t[0]=r,t[1]=n):n=t[1];const l=n;let i;t[2]!==e.id?(i={connectionId:dt,orgId:e.id},t[2]=e.id,t[3]=i):i=t[3];const o=ke(i);let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d={type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"sum",interval:"1d"}},t[4]=d):d=t[4];let m;t[5]!==l?(m={widget:d,timeRange:l,skipCount:!0},t[5]=l,t[6]=m):m=t[6];let c;t[7]!==o||t[8]!==m?(c={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:Ce},t[7]=o,t[8]=m,t[9]=c):c=t[9];const{data:u}=oe(c);let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f={type:"metric",source:{path:we,from:"output"},aggregation:{fn:"count_all"}},t[10]=f):f=t[10];let x;t[11]!==l?(x={widget:f,timeRange:l,skipCount:!0},t[11]=l,t[12]=x):x=t[12];let p;t[13]!==o||t[14]!==x?(p={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:Ce},t[13]=o,t[14]=x,t[15]=p):p=t[15];const{data:h}=oe(p);let g;t[16]===Symbol.for("react.memo_cache_sentinel")?(g={type:"metric",source:{path:we,from:"output"},aggregation:{fn:"sum",groupByColumn:"connection_title",limit:10}},t[16]=g):g=t[16];let y;t[17]!==l?(y={widget:g,timeRange:l,skipCount:!0},t[17]=l,t[18]=y):y=t[18];let w;t[19]!==o||t[20]!==y?(w={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:y,staleTime:6e4,select:Ce},t[19]=o,t[20]=y,t[21]=w):w=t[21];const{data:N}=oe(w);let b;t[22]!==u?.timeseries?(b=u?.timeseries??[],t[22]=u?.timeseries,t[23]=b):b=t[23];let S;t[24]!==b?(S=b.map(wl),t[24]=b,t[25]=S):S=t[25];const j=S;let C;if(t[26]!==h?.value||t[27]!==j||t[28]!==N?.groups||t[29]!==u?.timeseries||t[30]!==r){const _=(u?.timeseries??[]).reduce(Sl,0),k=h?.value??0,E=(N?.groups??[]).filter(Nl).sort(jl).slice(0,5),z=r==="7d"?"last 7 days":r==="30d"?"last 30 days":"last 90 days";let A;t[32]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Usage"}),t[32]=A):A=t[32];const O=V(_);let D;t[33]!==O?(D=s.jsx("p",{className:"text-2xl font-bold tabular-nums text-foreground tracking-tight",children:O}),t[33]=O,t[34]=D):D=t[34];let L;t[35]!==z?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:z}),t[35]=z,t[36]=L):L=t[36];let G;t[37]!==D||t[38]!==L?(G=s.jsxs("div",{className:"flex items-baseline gap-2",children:[D,L]}),t[37]=D,t[38]=L,t[39]=G):G=t[39];let K;t[40]!==k?(K=k.toLocaleString(),t[40]=k,t[41]=K):K=t[41];let F;t[42]!==K?(F=s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[K," tool calls"]}),t[42]=K,t[43]=F):F=t[43];let T;t[44]!==G||t[45]!==F?(T=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[A,G,F]}),t[44]=G,t[45]=F,t[46]=T):T=t[46];let $;t[47]!==r?($=s.jsx(us,{period:r,onPeriodChange:a}),t[47]=r,t[48]=$):$=t[48];let Y;t[49]!==T||t[50]!==$?(Y=s.jsxs("div",{className:"flex items-center justify-between",children:[T,$]}),t[49]=T,t[50]=$,t[51]=Y):Y=t[51];let H;t[52]!==j?(H=j.length>0?s.jsx(Ta,{config:gl,className:"h-[200px] w-full",children:s.jsxs(nl,{data:j,margin:{top:4,right:4,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"fillCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"var(--color-cost)",stopOpacity:.3}),s.jsx("stop",{offset:"95%",stopColor:"var(--color-cost)",stopOpacity:0})]})}),s.jsx(Zt,{vertical:!1,strokeDasharray:"3 3"}),s.jsx(za,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,fontSize:11,interval:"preserveStartEnd"}),s.jsx(os,{tickLine:!1,axisLine:!1,tickMargin:4,fontSize:11,tickFormatter:bl}),s.jsx($a,{content:s.jsx(Ma,{formatter:yl})}),s.jsx(is,{type:"monotone",dataKey:"cost",stroke:"var(--color-cost)",fill:"url(#fillCost)",strokeWidth:2})]})}):s.jsx("div",{className:"h-[200px] flex items-center justify-center text-xs text-muted-foreground",children:"No usage data available for this period"}),t[52]=j,t[53]=H):H=t[53],C=s.jsxs("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5",children:[Y,H,E.length>0&&s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Cost by Connection"}),s.jsx("div",{className:"flex flex-col gap-1.5",children:E.map((M,U)=>{const q=_>0?Math.min(M.value/_*100,100):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:M.key}),s.jsx("div",{className:"relative h-1.5 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-sm",style:{width:`${q}%`,backgroundColor:`var(--chart-${U%5+1})`}})}),s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:V(M.value)})]},M.key)})})]})]}),t[26]=h?.value,t[27]=j,t[28]=N?.groups,t[29]=u?.timeseries,t[30]=r,t[31]=C}else C=t[31];return C}function yl(t){return V(t)}function bl(t){return`$${t}`}function jl(t,e){return e.value-t.value}function Nl(t){return t.value>0}function Sl(t,e){return t+e.value}function wl(t){return{date:new Date(t.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),cost:t.value}}function Cl(){const t=I.c(6),[e,r]=v.useState(il);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=m=>{r(m),ol(m)},t[0]=a):a=t[0];const n=a;let l,i;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Sidebar Display Period"}),i=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which usage period is shown in the sidebar when no limit is set."}),t[1]=l,t[2]=i):(l=t[1],i=t[2]);let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=["daily","weekly","monthly"],t[3]=o):o=t[3];let d;return t[4]!==e?(d=s.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-5",children:[l,i,s.jsx("div",{className:"flex gap-2 mt-1",children:o.map(m=>s.jsx("button",{type:"button",onClick:()=>n(m),className:ue("rounded-md border px-3 py-1.5 text-xs font-medium capitalize transition-colors",e===m?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted text-muted-foreground"),children:m},m))})]}),t[4]=e,t[5]=d):d=t[5],d}function Xe(t){const e=I.c(20),{label:r,value:a,subValue:n,maxValue:l,color:i}=t,o=i===void 0?"bg-chart-1":i;let d;e[0]!==a?(d=parseFloat(a.replace(/[^0-9.]/g,""))||0,e[0]=a,e[1]=d):d=e[1];const m=d,c=l>0?Math.min(m/l*100,100):0;let u;e[2]!==r?(u=s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:r}),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==o?(f=ue("h-full transition-all duration-500 ease-out",o),e[4]=o,e[5]=f):f=e[5];const x=`${c}%`;let p;e[6]!==x?(p={width:x},e[6]=x,e[7]=p):p=e[7];let h;e[8]!==f||e[9]!==p?(h=s.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:f,style:p})}),e[8]=f,e[9]=p,e[10]=h):h=e[10];let g;e[11]!==a?(g=s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:a}),e[11]=a,e[12]=g):g=e[12];let y;e[13]!==n?(y=n&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:n}),e[13]=n,e[14]=y):y=e[14];let w;return e[15]!==u||e[16]!==h||e[17]!==g||e[18]!==y?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[u,h,g,y]}),e[15]=u,e[16]=h,e[17]=g,e[18]=y,e[19]=w):w=e[19],w}function Je(t){const e=I.c(8),{title:r,children:a,empty:n}=t;let l;e[0]!==r?(l=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:r}),e[0]=r,e[1]=l):l=e[1];let i;e[2]!==a||e[3]!==n?(i=n?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No data available for this period"}):a,e[2]=a,e[3]=n,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[l,i]}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}const kt={"7d":"7 days","30d":"30 days","90d":"90 days"};function us(t){const e=I.c(4),{period:r,onPeriodChange:a}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Object.keys(kt),e[0]=n):n=e[0];let l;return e[1]!==a||e[2]!==r?(l=s.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 self-start",children:n.map(i=>s.jsx("button",{type:"button",onClick:()=>a(i),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",r===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:kt[i]},i))}),e[1]=a,e[2]=r,e[3]=l):l=e[3],l}function _t(t,e){const r=new Map(e.map(a=>[a.key,a.value]));return t.map(a=>({key:a.key,cost:a.value,calls:r.get(a.key)??0})).sort((a,n)=>n.cost-a.cost)}function kl(){const t=I.c(27),{org:e}=me(),[r,a]=v.useState("7d"),n=ut(r),{data:l}=Ua(),i=l?.data?.members??[],o=new Map(i.map(Ol));let d;t[0]!==e.id?(d={connectionId:dt,orgId:e.id},t[0]=e.id,t[1]=d):d=t[1];const m=ke(d),c=P=>({client:m,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:{widget:{type:"table",source:{path:we,from:"output"},aggregation:{fn:P.fn,...P.groupByColumn&&{groupByColumn:P.groupByColumn},...P.limit&&{limit:P.limit}}},timeRange:n,skipCount:!0},staleTime:6e4,select:Ce}),{data:u,isLoading:f}=oe(c({fn:"sum",groupByColumn:"connection_title",limit:20})),{data:x,isLoading:p}=oe(c({fn:"count_all",groupByColumn:"connection_title",limit:20})),{data:h,isLoading:g}=oe(c({fn:"sum",groupByColumn:"user_id",limit:20})),{data:y,isLoading:w}=oe(c({fn:"count_all",groupByColumn:"user_id",limit:20})),{data:N,isLoading:b}=oe(c({fn:"sum",groupByColumn:"tool_name",limit:20}));let S;t[2]===Symbol.for("react.memo_cache_sentinel")?(S={fn:"count_all",groupByColumn:"tool_name",limit:20},t[2]=S):S=t[2];const{data:j,isLoading:C}=oe(c(S));if(f||p||g||w||b||C){let P;t[3]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(ne,{className:"h-8 w-48"}),t[3]=P):P=t[3];let X;return t[4]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs("div",{className:"flex flex-col gap-4",children:[P,s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:Array.from({length:3}).map(El)})]}),t[4]=X):X=t[4],X}const k=_t(u?.groups??[],x?.groups??[]),E=_t(h?.groups??[],y?.groups??[]).map(P=>({...P,key:o.get(P.key)??P.key})),z=j?.groups??[],A=new Map((N?.groups??[]).map(Il)),O=z.map(P=>({name:P.key,calls:P.value,cost:A.get(P.key)??0})).sort(Pl).slice(0,20),D=k.reduce(Al,0),L=k.reduce(_l,0),G=k[0]?.cost??1,K=E[0]?.cost??1,F=O[0]?.calls??1;let T;t[5]!==r?(T=s.jsx(us,{period:r,onPeriodChange:a}),t[5]=r,t[6]=T):T=t[6];const $="grid grid-cols-1 gap-4 sm:grid-cols-2",Y=k.length===0,H=k.slice(0,8).map(P=>s.jsx(Xe,{label:P.key,value:V(P.cost),subValue:`${P.calls.toLocaleString()} calls`,maxValue:G,color:"bg-chart-1"},P.key));let M;t[7]!==H?(M=s.jsx("div",{className:"space-y-2.5",children:H}),t[7]=H,t[8]=M):M=t[8];let U;t[9]!==Y||t[10]!==M?(U=s.jsx(Je,{title:"Cost by Connection",empty:Y,children:M}),t[9]=Y,t[10]=M,t[11]=U):U=t[11];const q=E.length===0,ee=E.slice(0,8).map(P=>s.jsx(Xe,{label:P.key,value:V(P.cost),subValue:`${P.calls.toLocaleString()} calls`,maxValue:K,color:"bg-chart-4"},P.key));let R;t[12]!==ee?(R=s.jsx("div",{className:"space-y-2.5",children:ee}),t[12]=ee,t[13]=R):R=t[13];let W;t[14]!==R||t[15]!==q?(W=s.jsx(Je,{title:"Cost by User",empty:q,children:R}),t[14]=R,t[15]=q,t[16]=W):W=t[16];const Q=Je,se="Top Tools",B=O.length===0,ae="space-y-2.5",re=O.slice(0,8).map(P=>s.jsx(Xe,{label:P.name,value:P.calls.toLocaleString(),subValue:P.cost>0?V(P.cost):void 0,maxValue:F,color:"bg-chart-3"},P.name));let te;t[17]!==re?(te=s.jsx("div",{className:ae,children:re}),t[17]=re,t[18]=te):te=t[18];let le;t[19]!==Q||t[20]!==B||t[21]!==te?(le=s.jsx(Q,{title:se,empty:B,children:te}),t[19]=Q,t[20]=B,t[21]=te,t[22]=le):le=t[22];let de;return t[23]!==W||t[24]!==le||t[25]!==U?(de=s.jsxs("div",{className:$,children:[U,W,le]}),t[23]=W,t[24]=le,t[25]=U,t[26]=de):de=t[26],s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:["Total:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:V(D)})]}),s.jsxs("span",{className:"text-muted-foreground",children:["Calls:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:L.toLocaleString()})]})]}),T]}),de]})}function _l(t,e){return t+e.calls}function Al(t,e){return t+e.cost}function Pl(t,e){return e.calls-t.calls}function Il(t){return[t.key,t.value]}function El(t,e){return s.jsx(ne,{className:"h-40 rounded-xl"},e)}function Ol(t){return[t.userId,t.user.name??t.user.email]}function Ll(t,e){const r=new Map;for(const a of t){const l=new Date(a.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),i=r.get(l)??{cost:0,calls:0};r.set(l,{cost:i.cost+a.value,calls:i.calls})}for(const a of e){const l=new Date(a.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),i=r.get(l)??{cost:0,calls:0};r.set(l,{cost:i.cost,calls:i.calls+a.value})}return Array.from(r.entries()).map(([a,n])=>({month:a,...n})).reverse()}function Dl(){const t=I.c(27),{org:e}=me();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=ut("90d"),t[0]=r):r=t[0];const a=r;let n;t[1]!==e.id?(n={connectionId:dt,orgId:e.id},t[1]=e.id,t[2]=n):n=t[2];const l=ke(n);let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={widget:{type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"sum",interval:"1d"}},timeRange:a,skipCount:!0},t[3]=i):i=t[3];let o;t[4]!==l?(o={client:l,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:i,staleTime:6e4,select:Ce},t[4]=l,t[5]=o):o=t[5];const{data:d,isLoading:m}=oe(o);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c={widget:{type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"count_all",interval:"1d"}},timeRange:a,skipCount:!0},t[6]=c):c=t[6];let u;t[7]!==l?(u={client:l,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:c,staleTime:6e4,select:Ce},t[7]=l,t[8]=u):u=t[8];const{data:f,isLoading:x}=oe(u);if(m||x){let S;return t[9]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(ne,{className:"h-8 w-48"}),s.jsx(ne,{className:"h-48 rounded-xl"})]}),t[9]=S):S=t[9],S}let p,h,g,y,w;if(t[10]!==f?.timeseries||t[11]!==d?.timeseries){const S=Ll(d?.timeseries??[],f?.timeseries??[]);w="flex flex-col gap-4",t[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs (last 90 days)"}),t[17]=p):p=t[17],h="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[18]=g):g=t[18],y=S.length===0?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No usage data available for this period"}):s.jsxs("div",{className:"w-full",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 pb-1.5 border-b border-border text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:[s.jsx("span",{children:"Month"}),s.jsx("span",{className:"text-right",children:"Cost"}),s.jsx("span",{className:"text-right",children:"Calls"})]}),s.jsx("div",{className:"divide-y divide-border",children:S.map(Tl)})]}),t[10]=f?.timeseries,t[11]=d?.timeseries,t[12]=p,t[13]=h,t[14]=g,t[15]=y,t[16]=w}else p=t[12],h=t[13],g=t[14],y=t[15],w=t[16];let N;t[19]!==h||t[20]!==g||t[21]!==y?(N=s.jsxs("div",{className:h,children:[g,y]}),t[19]=h,t[20]=g,t[21]=y,t[22]=N):N=t[22];let b;return t[23]!==p||t[24]!==N||t[25]!==w?(b=s.jsxs("div",{className:w,children:[p,N]}),t[23]=p,t[24]=N,t[25]=w,t[26]=b):b=t[26],b}function Tl(t){return s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 py-2 text-xs",children:[s.jsx("span",{className:"text-foreground font-medium",children:t.month}),s.jsx("span",{className:"text-right tabular-nums text-foreground",children:V(t.cost)}),s.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.calls.toLocaleString()})]},t.month)}function zl(t){const e=I.c(31),{connectionId:r}=t,{org:a}=me(),[n,l]=v.useState(!1);let i;e[0]!==r||e[1]!==a.id?(i={connectionId:r,orgId:a.id},e[0]=r,e[1]=a.id,e[2]=i):i=e[2];const o=ke(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==o?(m={client:o,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:$l},e[4]=o,e[5]=m):m=e[5];const{data:c,isLoading:u}=oe(m);if(u){let E;return e[6]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(ne,{className:"h-36 rounded-xl"}),e[6]=E):E=e[6],E}if(!c)return null;const f=c.limit.remaining??0,x=c.limit.total??0,p=c.usage,h=c.billing.mode,g=c.billing.limitPeriod??null,y=c.estimation??null;let w;e[7]!==c.alert?(w=c.alert??{enabled:!1,threshold_usd:10,email:null},e[7]=c.alert,e[8]=w):w=e[8];const N=w,b=c.limit,S=h==="postpaid"&&(x==null||x===0);let j;e[9]!==N||e[10]!==f||e[11]!==h||e[12]!==r||e[13]!==y||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(j=h==="postpaid"?s.jsx(pl,{usage:p,limit:b,limitPeriod:g,onConfigureLimit:()=>l(!0),connectionId:r,alert:N}):s.jsx(hl,{available:f,total:x,estimation:y,onAddCredit:()=>l(!0),connectionId:r,alert:N}),e[9]=N,e[10]=f,e[11]=h,e[12]=r,e[13]=y,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=j):j=e[18];let C;e[19]!==S?(C=S&&s.jsx(Cl,{}),e[19]=S,e[20]=C):C=e[20];let _;e[21]!==h||e[22]!==r||e[23]!==n||e[24]!==g||e[25]!==x?(_=s.jsx(fl,{open:n,onOpenChange:l,connectionId:r,currentLimitUsd:x,billingMode:h,currentLimitPeriod:g}),e[21]=h,e[22]=r,e[23]=n,e[24]=g,e[25]=x,e[26]=_):_=e[26];let k;return e[27]!==j||e[28]!==C||e[29]!==_?(k=s.jsxs(s.Fragment,{children:[j,C,_]}),e[27]=j,e[28]=C,e[29]=_,e[30]=k):k=e[30],k}function $l(t){return t.structuredContent}function Ml(t){const e=I.c(20),{gatewayConnectionId:r}=t,[a,n]=v.useState("summary");let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),e[0]=l):l=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs($s,{variant:"underline",children:[s.jsx(We,{value:"summary",variant:"underline",children:"Summary"}),s.jsx(We,{value:"breakdown",variant:"underline",children:"Breakdown"}),s.jsx(We,{value:"history",variant:"underline",children:"History"})]}),e[1]=i):i=e[1];let o;e[2]!==r?(o=r&&s.jsx(zl,{connectionId:r}),e[2]=r,e[3]=o):o=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(vl,{}),e[4]=d):d=e[4];let m;e[5]!==o?(m=s.jsxs(Fe,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[o,d]}),e[5]=o,e[6]=m):m=e[6];let c;e[7]!==a?(c=a==="breakdown"&&s.jsx(kl,{}),e[7]=a,e[8]=c):c=e[8];let u;e[9]!==c?(u=s.jsx(Fe,{value:"breakdown",className:"pt-2",children:c}),e[9]=c,e[10]=u):u=e[10];let f;e[11]!==a?(f=a==="history"&&s.jsx(Dl,{}),e[11]=a,e[12]=f):f=e[12];let x;e[13]!==f?(x=s.jsx(Fe,{value:"history",className:"pt-2",children:f}),e[13]=f,e[14]=x):x=e[14];let p;return e[15]!==a||e[16]!==m||e[17]!==u||e[18]!==x?(p=s.jsxs(s.Fragment,{children:[l,s.jsxs(Ms,{value:a,onValueChange:n,variant:"underline",children:[i,m,u,x]})]}),e[15]=a,e[16]=m,e[17]=u,e[18]=x,e[19]=p):p=e[19],p}function Bl(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx(ne,{className:"h-5 w-32"}),s.jsx(ne,{className:"h-4 w-64 mt-1.5"})]}),s.jsx(ne,{className:"h-28 rounded-xl"}),s.jsx(ne,{className:"h-[260px] rounded-lg"})]}),t[0]=e):e=t[0],e}function Gl(){const t=I.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),t[0]=e):e=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex items-center justify-center size-10 rounded-full bg-muted",children:s.jsx(rt,{size:20,className:"text-muted-foreground"})}),t[1]=r):r=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex flex-col gap-6",children:[e,s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 rounded-lg border border-dashed border-border",children:[r,s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-[300px]",children:"Unable to load billing data. Please try again later."})]})]})]}),t[2]=a):a=t[2],a}class Rl extends v.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){}render(){return this.state.hasError?s.jsx(Gl,{}):this.props.children}}function Wl(){const t=I.c(4),e=Fa();let r;t[0]!==e?(r=e.find(Fl),t[0]=e,t[1]=r):r=t[1];const n=r?.id??null;let l;return t[2]!==n?(l=s.jsx(Ml,{gatewayConnectionId:n}),t[2]=n,t[3]=l):l=t[3],l}function Fl(t){return Va(t,Ka)}function Ul(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-col gap-6",children:s.jsx(Rl,{children:s.jsx(v.Suspense,{fallback:s.jsx(Bl,{}),children:s.jsx(Wl,{})})})}),t[0]=e):e=t[0],e}function ms(){const t=I.c(3);let e,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ne,{className:"h-6 w-48"}),r=s.jsx(ne,{className:"h-4 w-80"}),t[0]=e,t[1]=r):(e=t[0],r=t[1]);let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[e,r,s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsx(ne,{className:"h-12 w-full"}),s.jsx(ne,{className:"h-12 w-full"})]})]}),t[2]=a):a=t[2],a}function Vl(t){const e=I.c(14),{projectSlug:r,children:a}=t,{org:n}=me(),{data:l,isLoading:i}=Et(n.id,r);if(i||!l){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ms,{}),e[0]=u):u=e[0],u}const o=r===Ee;let d;e[1]!==l.description||e[2]!==l.enabledPlugins||e[3]!==l.id||e[4]!==l.name||e[5]!==l.organizationId||e[6]!==l.slug||e[7]!==l.ui||e[8]!==o?(d={id:l.id,organizationId:l.organizationId,slug:l.slug,name:l.name,description:l.description,enabledPlugins:l.enabledPlugins,ui:l.ui,isOrgAdmin:o},e[1]=l.description,e[2]=l.enabledPlugins,e[3]=l.id,e[4]=l.name,e[5]=l.organizationId,e[6]=l.slug,e[7]=l.ui,e[8]=o,e[9]=d):d=e[9];const m=d;let c;return e[10]!==a||e[11]!==m||e[12]!==n?(c=s.jsx(It,{org:n,project:m,children:a}),e[10]=a,e[11]=m,e[12]=n,e[13]=c):c=e[13],c}function Kl(t){const e=I.c(7),{section:r}=t;switch(r){case"account.profile":{let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Ha,{}),e[0]=a):a=e[0],a}case"account.preferences":{let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(yt,{}),e[1]=a):a=e[1],a}case"account.experimental":{let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(er,{}),e[2]=a):a=e[2],a}case"org.general":{let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(rr,{}),e[3]=a):a=e[3],a}case"org.plugins":{let a;return e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Vl,{projectSlug:Ee,children:s.jsx(Fs,{})}),e[4]=a):a=e[4],a}case"org.billing":{let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Ul,{}),e[5]=a):a=e[5],a}default:{let a;return e[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(yt,{}),e[6]=a):a=e[6],a}}}function Yl(){const t=I.c(23),{isOpen:e,activeSection:r,open:a,close:n}=Ss();let l;t[0]!==n?(l=g=>!g&&n(),t[0]=n,t[1]=l):l=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=i):i=t[2];let o;t[3]!==r||t[4]!==a?(o=s.jsx(v.Suspense,{fallback:i,children:s.jsx(Ya,{activeSection:r,onNavigate:a})}),t[3]=r,t[4]=a,t[5]=o):o=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Dt,{size:16}),m=s.jsx("span",{className:"sr-only",children:"Close"}),t[6]=d,t[7]=m):(d=t[6],m=t[7]);let c;t[8]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:"sticky top-4 float-right mr-4 mt-4 z-10 rounded-md p-1 opacity-70 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-ring",children:[d,m]}),t[8]=n,t[9]=c):c=t[9];let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ms,{}),t[10]=u):u=t[10];let f;t[11]!==r?(f=s.jsx("div",{className:"p-8",children:s.jsx(v.Suspense,{fallback:u,children:s.jsx(Kl,{section:r})})}),t[11]=r,t[12]=f):f=t[12];let x;t[13]!==c||t[14]!==f?(x=s.jsxs("div",{className:"flex-1 overflow-y-auto min-w-0 relative",children:[c,f]}),t[13]=c,t[14]=f,t[15]=x):x=t[15];let p;t[16]!==o||t[17]!==x?(p=s.jsx(Ot,{className:"sm:max-w-[1100px] h-[85vh] p-0 overflow-hidden flex flex-col gap-0",closeButtonClassName:"hidden",children:s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o,x]})}),t[16]=o,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==l||t[21]!==p?(h=s.jsx(Lt,{open:e,onOpenChange:l,children:p}),t[19]=e,t[20]=l,t[21]=p,t[22]=h):h=t[22],h}function Hl(t){const e=I.c(12),{projectSlug:r,orgSlug:a,error:n}=t,l=at();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=i):i=e[0];let o;e[1]!==r?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',r,'".']}),e[1]=r,e[2]=o):o=e[2];let d;e[3]!==n.message?(d=s.jsx("p",{className:"text-sm text-muted-foreground",children:n.message}),e[3]=n.message,e[4]=d):d=e[4];let m;e[5]!==l||e[6]!==a?(m=s.jsx(ce,{variant:"link",onClick:()=>l({to:"/$org/$project",params:{org:a,project:Ee}}),children:"Go to organization home"}),e[5]=l,e[6]=a,e[7]=m):m=e[7];let c;return e[8]!==o||e[9]!==d||e[10]!==m?(c=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[i,o,d,m]}),e[8]=o,e[9]=d,e[10]=m,e[11]=c):c=e[11],c}function ql(t){const e=I.c(9),{projectSlug:r,orgSlug:a}=t,n=at();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h1",{className:"text-xl font-semibold",children:"Project not found"}),e[0]=l):l=e[0];let i;e[1]!==r?(i=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',r,'" does not exist in this organization.']}),e[1]=r,e[2]=i):i=e[2];let o;e[3]!==n||e[4]!==a?(o=s.jsx(ce,{variant:"link",onClick:()=>n({to:"/$org/$project",params:{org:a,project:Ee}}),children:"Go to organization home"}),e[3]=n,e[4]=a,e[5]=o):o=e[5];let d;return e[6]!==i||e[7]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[l,i,o]}),e[6]=i,e[7]=o,e[8]=d):d=e[8],d}function Ql(){const t=I.c(23);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const r=gs(e),{org:a}=me(),n=r.org,l=r.project,{data:i,isLoading:o,error:d}=Et(a.id,l);if(o){let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ze,{}),t[1]=h):h=t[1],h}if(d){let h;return t[2]!==d||t[3]!==n||t[4]!==l?(h=s.jsx(Hl,{projectSlug:l,orgSlug:n,error:d}),t[2]=d,t[3]=n,t[4]=l,t[5]=h):h=t[5],h}if(!i){let h;return t[6]!==n||t[7]!==l?(h=s.jsx(ql,{projectSlug:l,orgSlug:n}),t[6]=n,t[7]=l,t[8]=h):h=t[8],h}const m=i.slug===Ee;let c;t[9]!==i.description||t[10]!==i.enabledPlugins||t[11]!==i.id||t[12]!==i.name||t[13]!==i.organizationId||t[14]!==i.slug||t[15]!==i.ui||t[16]!==m?(c={id:i.id,organizationId:i.organizationId,slug:i.slug,name:i.name,description:i.description,enabledPlugins:i.enabledPlugins,ui:i.ui,isOrgAdmin:m},t[9]=i.description,t[10]=i.enabledPlugins,t[11]=i.id,t[12]=i.name,t[13]=i.organizationId,t[14]=i.slug,t[15]=i.ui,t[16]=m,t[17]=c):c=t[17];const u=c;let f,x;t[18]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(v.Suspense,{fallback:s.jsx(Ze,{}),children:s.jsx(vs,{})}),x=s.jsx(Yl,{}),t[18]=f,t[19]=x):(f=t[18],x=t[19]);let p;return t[20]!==u||t[21]!==a?(p=s.jsxs(It,{org:a,project:u,children:[f,x]}),t[20]=u,t[21]=a,t[22]=p):p=t[22],p}function Kn(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(v.Suspense,{fallback:s.jsx(Ze,{}),children:s.jsx(Ql,{})}),t[0]=e):e=t[0],e}export{Kn as default};
1
+ import{r as v,c as I,d as st,j as s,v as ue,t as Pe,aD as fs,o as xs,s as Ge,b as at,u as me,n as At,l as ps,k as hs,K as mt,B as ce,c4 as Pt,O as Ee,P as It,S as Ze,e as gs,aG as vs}from"./index-KAycGEnT.js";import{u as Et}from"./use-project-BZjOe5ok.js";import{c as ys,d as bs,b as js,a as Ot,D as Lt}from"./dialog-DSCIUn11.js";import{i as Dt}from"./X-CT_P09q2.js";import{S as ne}from"./skeleton-l9u4bmPQ.js";import{t as Ns,i as rt,u as Ss}from"./use-settings-modal-BpLqrFwi.js";import{A as Tt}from"./avatar-DGDgNwX-.js";import{t as ws}from"./Settings01-C1oZxROY.js";import{i as Cs}from"./Zap-BYVebEYM.js";import{a as ks,b as _s,c as As,T as Ps}from"./tooltip-BD36KVkP.js";import{i as Is}from"./Check-DXoRcZpn.js";import{a as Es}from"./Copy01-B4eRdmVC.js";import{S as Le}from"./switch-BTH5DtNC.js";import{S as Os,a as Ls,d as Re,c as Ds}from"./select-XWfX294J.js";import{i as Ts}from"./Code01-BLJKgev-.js";import{i as zs}from"./Shield01-DoZAYqqP.js";import{u as zt,a as $s,T as We,b as Fe,c as Ms}from"./tabs-B62zcrrU.js";import{u as Bs}from"./useMutation-Ctk5b8uR.js";import{a as Gs,F as Ue,b as Ve,c as Ke,d as Ye,f as He,e as Rs}from"./form-CVLoDgzL.js";import{I as Ie}from"./input-s8rw5Kfa.js";import{i as Ws}from"./Upload01-C3K15n1N.js";import{P as Fs}from"./project-plugins-DkIXV878.js";import{u as Us,a as Vs,b as Ks,i as ie,r as lt,D as $t,c as Me,d as fe,s as ft,e as xt,Z as Mt,g as Bt,f as Gt,h as Rt,j as _e,k as nt,l as Be,m as it,n as Ys,o as Hs,p as Wt,q as ot,t as ct,v as Ft,w as qs,x as Ut,y as pt,z as Qs,A as Xs,B as Js,R as Zs,S as ea,C as ta,E as sa,F as Vt,G as aa,H as ra,I as la,J as na,K as ia,L as oa,M as ca,N as da,O as De,P as ua,Q as ht,T as gt,U as vt,V as ma,W as Kt,X as fa,Y as Ne,_ as xa,$ as pa,a0 as ha,a1 as ga,a2 as va,a3 as qe,a4 as ya,a5 as Te,a6 as ba,a7 as J,a8 as Yt,a9 as ja,aa as Na,ab as Sa,ac as wa,ad as Ca,ae as ka,af as _a,ag as Aa,ah as Pa,ai as Ia,aj as Ea,ak as Oa,al as La,am as Da,an as Ta,ao as za,ap as $a,aq as Ma}from"./chart-DYrz9LTc.js";import{L as Ae}from"./label-lqq4AMOf.js";import{B as Ba}from"./badge-DtcA_2rB.js";import{i as Ga}from"./AlertCircle-Zx531KAn.js";import{s as Ht}from"./Plus-CEtl-Eq7.js";import{s as Ra}from"./RefreshCcw01-Bcbx9L0j.js";import{u as ke,a as dt,K as Wa}from"./constants-CRvMLa9p.js";import{b as Fa}from"./use-connection-DWTVYLGI.js";import{b as oe,a as qt}from"./use-mcp-tools-DkmUq8XI.js";import{u as Ua}from"./use-members-Bksy3767.js";import{c as Va,A as Ka}from"./use-binding-eAl0-ngZ.js";import"./useQuery-DCrAUBx5.js";import"./index-B7Bu7nQ7.js";import"./ChevronDown-D04Buvau.js";import"./localstorage-keys-DK1Id_ip.js";import"./Container-CSl1es2V.js";import"./use-install-from-registry-CzqEIQq2.js";import"./extract-connection-data-CrY_sL6W.js";import"./constants-I25hmjxi.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-BJRD11-o.js";import"./generate-id-Dyweu44Y.js";import"./Loading01-DF5pxnn8.js";import"./index-Co1xrsbj.js";import"./use-collections-ROKIiOzV.js";import"./binder-CaZ6b20X.js";const Qt=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.createElement("path",{d:"M10 2v4.66c0 .218 0 .326-.033.413a.47.47 0 0 1-.138.198c-.07.06-.183.102-.409.185a7.5 7.5 0 1 0 5.16 0c-.226-.083-.339-.125-.409-.185a.469.469 0 0 1-.138-.198C14 6.986 14 6.878 14 6.66V2M8.5 2h7"}));Qt.displayName="Beaker01";const Xt=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.createElement("path",{d:"M9.354 21c.705.622 1.632 1 2.646 1s1.94-.378 2.646-1M18 8A6 6 0 1 0 6 8c0 3.09-.78 5.206-1.65 6.605-.735 1.18-1.102 1.771-1.089 1.936.015.182.054.252.2.36.133.099.732.099 1.928.099H18.61c1.196 0 1.795 0 1.927-.098.147-.11.186-.179.2-.361.014-.165-.353-.755-1.088-1.936C18.78 13.206 18 11.09 18 8Z"}));Xt.displayName="Bell01";function Ya(t){const e=I.c(26),{activeSection:r,onNavigate:a}=t,{data:n}=st.useSession(),l=n?.user,i=l?.image,o=l?.name??"Profile",d=l?.name??"U";let m;e[0]!==d||e[1]!==i?(m=s.jsx(Tt,{url:i,fallback:d,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=d,e[1]=i,e[2]=m):m=e[2];let c;e[3]!==o||e[4]!==m?(c={key:"account.profile",label:o,icon:m},e[3]=o,e[4]=m,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={key:"account.preferences",label:"Preferences",icon:s.jsx(ws,{size:14})},e[6]=u):u=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={key:"account.experimental",label:"Experimental",icon:s.jsx(Qt,{size:14})},e[7]=f):f=e[7];let x;e[8]!==c?(x=[c,u,f],e[8]=c,e[9]=x):x=e[9];const p=x;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h={key:"org.general",label:"General",icon:s.jsx(Ns,{size:14})},e[10]=h):h=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g={key:"org.plugins",label:"Features",icon:s.jsx(Cs,{size:14})},e[11]=g):g=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=[h,g,{key:"org.billing",label:"Billing",icon:s.jsx(rt,{size:14})}],e[12]=y):y=e[12];const w=y;let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Account"}),e[13]=N):N=e[13];let b;e[14]!==p||e[15]!==r||e[16]!==a?(b=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[N,p.map(k=>s.jsxs("button",{type:"button",onClick:()=>a(k.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",r===k.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:k.icon}),s.jsx("span",{className:"truncate",children:k.label})]},k.key))]}),e[14]=p,e[15]=r,e[16]=a,e[17]=b):b=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=S):S=e[18];let j;e[19]!==r||e[20]!==a?(j=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[S,w.map(k=>s.jsxs("button",{type:"button",onClick:()=>a(k.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",r===k.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:k.icon}),s.jsx("span",{className:"truncate",children:k.label})]},k.key))]}),e[19]=r,e[20]=a,e[21]=j):j=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.142.0"]})}),e[22]=C):C=e[22];let _;return e[23]!==b||e[24]!==j?(_=s.jsxs("div",{className:"w-52 shrink-0 border-r border-border bg-sidebar/50 overflow-y-auto py-3 flex flex-col gap-4",children:[b,j,C]}),e[23]=b,e[24]=j,e[25]=_):_=e[25],_}function Ha(){const t=I.c(32),{data:e}=st.useSession(),[r,a]=v.useState(!1),n=e?.user,l=n?.image;let i;t[0]!==n?(i=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},t[0]=n,t[1]=i):i=t[1];const o=i;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Profile"})}),t[2]=d):d=t[2];const m=n?.name??"U";let c;t[3]!==m||t[4]!==l?(c=s.jsx(Tt,{url:l,fallback:m,shape:"circle",size:"xl",className:"size-16 shrink-0"}),t[3]=m,t[4]=l,t[5]=c):c=t[5];const u=n?.name??"User";let f;t[6]!==u?(f=s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:u}),t[6]=u,t[7]=f):f=t[7];const x=n?.email;let p;t[8]!==x?(p=s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),t[8]=x,t[9]=p):p=t[9];let h;t[10]!==f||t[11]!==p?(h=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[f,p]}),t[10]=f,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==c||t[14]!==h?(g=s.jsxs("div",{className:"flex items-center gap-4",children:[c,h]}),t[13]=c,t[14]=h,t[15]=g):g=t[15];let y;t[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=y):y=t[16];let w;t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("p",{className:"text-sm text-muted-foreground",children:"User ID"}),t[17]=w):w=t[17];const N=n?.id;let b;t[18]!==N?(b=s.jsx("span",{className:"font-mono text-sm",children:N}),t[18]=N,t[19]=b):b=t[19];let S;t[20]!==r?(S=r?s.jsx(Is,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Es,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=r,t[21]=S):S=t[21];let j;t[22]!==o||t[23]!==b||t[24]!==S?(j=s.jsx(ks,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:o,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,S]})}),t[22]=o,t[23]=b,t[24]=S,t[25]=j):j=t[25];let C;t[26]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(_s,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=C):C=t[26];let _;t[27]!==j?(_=s.jsxs("div",{className:"flex flex-col",children:[y,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(As,{children:s.jsxs(Ps,{children:[j,C]})})]})]}),t[27]=j,t[28]=_):_=t[28];let k;return t[29]!==_||t[30]!==g?(k=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,_]}),t[29]=_,t[30]=g,t[31]=k):k=t[31],k}function Qe(t){const e=I.c(27),{icon:r,label:a,description:n,control:l,onClick:i,disabled:o}=t,d=o?void 0:i,m=i?"button":void 0,c=i&&!o?0:void 0;let u;e[0]!==o||e[1]!==i?(u=i&&!o?S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),i())}:void 0,e[0]=o,e[1]=i,e[2]=u):u=e[2];const f=i&&!o?"pointer":void 0;let x;e[3]!==f?(x={cursor:f},e[3]=f,e[4]=x):x=e[4];let p;e[5]!==r?(p=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:r}),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==a?(h=s.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[7]=a,e[8]=h):h=e[8];let g;e[9]!==n?(g=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:n}),e[9]=n,e[10]=g):g=e[10];let y;e[11]!==h||e[12]!==g?(y=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=y):y=e[13];let w;e[14]!==y||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,y]}),e[14]=y,e[15]=p,e[16]=w):w=e[16];let N;e[17]!==l?(N=s.jsx("div",{onClick:qa,className:"shrink-0",children:l}),e[17]=l,e[18]=N):N=e[18];let b;return e[19]!==d||e[20]!==w||e[21]!==N||e[22]!==m||e[23]!==c||e[24]!==u||e[25]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0",onClick:d,role:m,tabIndex:c,onKeyDown:u,style:x,children:[w,N]}),e[19]=d,e[20]=w,e[21]=N,e[22]=m,e[23]=c,e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function qa(t){return t.stopPropagation()}function yt(){const t=I.c(35),[e,r]=zt();let a;t[0]!==r?(a=async C=>{if(C&&await Notification.requestPermission()!=="granted"){Pe.error("Notifications denied. Please enable them in your browser settings."),r(Xa);return}r(_=>({..._,enableNotifications:C}))},t[0]=r,t[1]=a):a=t[1];const n=a;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Preferences"})}),t[2]=l):l=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ts,{size:16}),t[3]=i):i=t[3];let o;t[4]!==r?(o=()=>r(Qa),t[4]=r,t[5]=o):o=t[5];let d;t[6]!==r?(d=C=>r(_=>({..._,devMode:C})),t[6]=r,t[7]=d):d=t[7];let m;t[8]!==e.devMode||t[9]!==d?(m=s.jsx(Le,{checked:e.devMode,onCheckedChange:d}),t[8]=e.devMode,t[9]=d,t[10]=m):m=t[10];let c;t[11]!==o||t[12]!==m?(c=s.jsx(Qe,{icon:i,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:o,control:m}),t[11]=o,t[12]=m,t[13]=c):c=t[13];let u;t[14]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Xt,{size:16}),t[14]=u):u=t[14];let f;t[15]!==n||t[16]!==e.enableNotifications?(f=s.jsx(Qe,{icon:u,label:"Notifications",description:"Play a sound and show a notification when chat messages complete while the app is unfocused.",disabled:typeof Notification>"u",onClick:()=>n(!e.enableNotifications),control:s.jsx(Le,{disabled:typeof Notification>"u",checked:e.enableNotifications,onCheckedChange:n})}),t[15]=n,t[16]=e.enableNotifications,t[17]=f):f=t[17];let x;t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(zs,{size:16}),t[18]=x):x=t[18];let p;t[19]!==r?(p=C=>r(_=>({..._,toolApprovalLevel:C})),t[19]=r,t[20]=p):p=t[20];let h;t[21]===Symbol.for("react.memo_cache_sentinel")?(h={none:"Always ask",readonly:"Skip read-only",yolo:"Auto-approve all"},t[21]=h):h=t[21];const g=h[e.toolApprovalLevel];let y;t[22]!==g?(y=s.jsx(Ls,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=y):y=t[23];let w;t[24]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Re,{value:"none",textValue:"Always ask",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Always ask"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Require approval for all tool calls"})]})}),t[24]=w):w=t[24];let N;t[25]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Re,{value:"readonly",textValue:"Skip read-only",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Skip read-only"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),t[25]=N):N=t[25];let b;t[26]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs(Ds,{children:[w,N,s.jsx(Re,{value:"yolo",textValue:"Auto-approve all",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Auto-approve all"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all tools without approval"})]})})]}),t[26]=b):b=t[26];let S;t[27]!==e.toolApprovalLevel||t[28]!==p||t[29]!==y?(S=s.jsx(Qe,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(Os,{value:e.toolApprovalLevel,onValueChange:p,children:[y,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=y,t[30]=S):S=t[30];let j;return t[31]!==S||t[32]!==c||t[33]!==f?(j=s.jsxs("div",{className:"flex flex-col gap-6",children:[l,s.jsxs("div",{className:"flex flex-col",children:[c,f,S]})]}),t[31]=S,t[32]=c,t[33]=f,t[34]=j):j=t[34],j}function Qa(t){return{...t,devMode:!t.devMode}}function Xa(t){return{...t,enableNotifications:!1}}function Ja(t){const e=I.c(22),{icon:r,label:a,description:n,checked:l,onCheckedChange:i}=t;let o;e[0]!==l||e[1]!==i?(o=()=>i(!l),e[0]=l,e[1]=i,e[2]=o):o=e[2];let d;e[3]!==r?(d=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:r}),e[3]=r,e[4]=d):d=e[4];let m;e[5]!==a?(m=s.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[5]=a,e[6]=m):m=e[6];let c;e[7]!==n?(c=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:n}),e[7]=n,e[8]=c):c=e[8];let u;e[9]!==m||e[10]!==c?(u=s.jsxs("div",{className:"min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=u):u=e[11];let f;e[12]!==d||e[13]!==u?(f=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14];let x;e[15]!==l||e[16]!==i?(x=s.jsx("div",{onClick:Za,className:"shrink-0",children:s.jsx(Le,{checked:l,onCheckedChange:i})}),e[15]=l,e[16]=i,e[17]=x):x=e[17];let p;return e[18]!==o||e[19]!==f||e[20]!==x?(p=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0 cursor-pointer",onClick:o,children:[f,x]}),e[18]=o,e[19]=f,e[20]=x,e[21]=p):p=e[21],p}function Za(t){return t.stopPropagation()}function er(){const t=I.c(7),[e,r]=zt();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Experimental"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"These features are unstable and may change or stop working at any time."})]}),t[0]=a):a=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(fs,{size:16}),t[1]=n):n=t[1];let l;t[2]!==r?(l=o=>r(d=>({...d,experimental_projects:o})),t[2]=r,t[3]=l):l=t[3];let i;return t[4]!==e.experimental_projects||t[5]!==l?(i=s.jsxs("div",{className:"flex flex-col gap-6",children:[a,s.jsx("div",{className:"flex flex-col rounded-lg border border-border bg-muted/25 px-4",children:s.jsx(Ja,{icon:n,label:"Projects",description:"Enable the projects feature in the sidebar.",checked:e.experimental_projects,onCheckedChange:l})})]}),t[4]=e.experimental_projects,t[5]=l,t[6]=i):i=t[6],i}const tr=xs({name:Ge().min(1,"Name is required").max(255,"Name is too long"),slug:Ge().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:Ge().optional()});function sr(t){const e=I.c(24),{value:r,onChange:a,name:n}=t,l=v.useRef(null);let i;e[0]!==a?(i=b=>{const S=b.target.files?.[0];if(S){if(S.size>2097152){Pe.error("Image must be smaller than 2MB");return}const j=new FileReader;j.onerror=()=>{const C=j.error;console.error("FileReader error:",C),Pe.error(C?.message||"Failed to read image file. Please try again."),l.current&&(l.current.value="")},j.onloadend=()=>{if(j.readyState===FileReader.DONE&&j.result){const C=j.result;a(C)}},j.readAsDataURL(S)}},e[0]=a,e[1]=i):i=e[1];const o=i;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{l.current?.click()},e[2]=d):d=e[2];const m=d;let c;e[3]!==a?(c=b=>{b.stopPropagation(),a("")},e[3]=a,e[4]=c):c=e[4];const u=c;let f;e[5]!==o?(f=s.jsx("input",{type:"file",ref:l,className:"hidden",accept:"image/*",onChange:o}),e[5]=o,e[6]=f):f=e[6];let x;e[7]!==u||e[8]!==n||e[9]!==r?(x=r?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:r,alt:n||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:u,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(Dt,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:m,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(Ws,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=u,e[8]=n,e[9]=r,e[10]=x):x=e[10];const p=r?"Change Logo":"Upload Logo";let h;e[11]!==p?(h=s.jsx(ce,{type:"button",variant:"outline",size:"sm",onClick:m,className:"mb-2",children:p}),e[11]=p,e[12]=h):h=e[12];let g;e[13]!==u||e[14]!==r?(g=r&&s.jsx(ce,{type:"button",variant:"ghost",size:"sm",onClick:u,className:"ml-2",children:"Remove"}),e[13]=u,e[14]=r,e[15]=g):g=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=y):y=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,y]}),e[17]=h,e[18]=g,e[19]=w):w=e[19];let N;return e[20]!==w||e[21]!==f||e[22]!==x?(N=s.jsxs("div",{className:"flex items-start gap-4",children:[f,x,w]}),e[20]=w,e[21]=f,e[22]=x,e[23]=N):N=e[23],N}function ar(){const t=at(),{org:e,project:r}=me(),a=At(),[n,l]=v.useState(!1),i=ps({resolver:hs(tr),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),o=Bs({mutationFn:async c=>{const u={name:c.name,slug:c.slug};c.logo&&(u.logo=c.logo);const f=await st.organization.update({organizationId:e.id,data:u});if(f?.error)throw new Error(f.error.message||"Failed to update organization");return f},onSuccess:c=>{a.invalidateQueries({queryKey:mt.organizations()}),a.invalidateQueries({queryKey:mt.activeOrganization(e.slug)}),Pe.success("Organization settings updated successfully"),c?.data?.slug&&c.data.slug!==e.slug&&t({to:"/$org/$project/settings",params:{org:c.data.slug,project:r.slug}})},onError:c=>{Pe.error(c instanceof Error?c.message:"Failed to update organization")},onSettled:()=>{l(!1)}}),d=c=>{l(!0),o.mutate(c)},m=i.formState.isDirty;return s.jsx(Gs,{...i,children:s.jsxs("form",{onSubmit:i.handleSubmit(d),className:"space-y-6",children:[s.jsx(Ue,{control:i.control,name:"name",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Organization Name"}),s.jsx(Ye,{children:s.jsx(Ie,{placeholder:"My Organization",...c,disabled:n})}),s.jsx(He,{})]})}),s.jsx(Ue,{control:i.control,name:"slug",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Organization Slug"}),s.jsx(Ye,{children:s.jsx(Ie,{placeholder:"my-organization",...c,disabled:n,onChange:u=>{const f=u.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");c.onChange(f)}})}),s.jsx(Rs,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(He,{})]})}),s.jsx(Ue,{control:i.control,name:"logo",render:({field:c})=>s.jsxs(Ve,{children:[s.jsx(Ke,{children:"Logo"}),s.jsx(Ye,{children:s.jsx(sr,{value:c.value,onChange:c.onChange,name:i.watch("name")})}),s.jsx(He,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(ce,{type:"submit",disabled:!m||n,className:"min-w-24",children:n?"Saving...":"Save Changes"}),m&&s.jsx(ce,{type:"button",variant:"outline",onClick:()=>i.reset(),disabled:n,children:"Cancel"})]})]})})}function rr(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Organization"})}),s.jsx(ar,{})]}),t[0]=e):e=t[0],e}var bt=function(e,r){for(var a=arguments.length,n=new Array(a>2?a-2:0),l=2;l<a;l++)n[l-2]=arguments[l];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var i=0;console.warn(r.replace(/%s/g,()=>n[i++]))}},lr=["x1","y1","x2","y2","key"],nr=["offset"],ir=["xAxisId","yAxisId"],or=["xAxisId","yAxisId"];function jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(r),!0).forEach(function(a){cr(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function cr(t,e,r){return(e=dr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dr(t){var e=ur(t,"string");return typeof e=="symbol"?e:e+""}function ur(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xe(){return xe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},xe.apply(null,arguments)}function ze(t,e){if(t==null)return{};var r,a,n=mr(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mr(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}var fr=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:r,x:a,y:n,width:l,height:i,ry:o}=t;return v.createElement("rect",{x:a,y:n,ry:o,width:l,height:i,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Jt(t){var{option:e,lineItemProps:r}=t,a;if(v.isValidElement(e))a=v.cloneElement(e,r);else if(typeof e=="function")a=e(r);else{var n,{x1:l,y1:i,x2:o,y2:d,key:m}=r,c=ze(r,lr),u=(n=nt(c))!==null&&n!==void 0?n:{},{offset:f}=u,x=ze(u,nr);a=v.createElement("line",xe({},x,{x1:l,y1:i,x2:o,y2:d,fill:"none",key:m}))}return a}function xr(t){var{x:e,width:r,horizontal:a=!0,horizontalPoints:n}=t;if(!a||!n||!n.length)return null;var{xAxisId:l,yAxisId:i}=t,o=ze(t,ir),d=n.map((m,c)=>{var u=Z(Z({},o),{},{x1:e,y1:m,x2:e+r,y2:m,key:"line-".concat(c),index:c});return v.createElement(Jt,{key:"line-".concat(c),option:a,lineItemProps:u})});return v.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function pr(t){var{y:e,height:r,vertical:a=!0,verticalPoints:n}=t;if(!a||!n||!n.length)return null;var{xAxisId:l,yAxisId:i}=t,o=ze(t,or),d=n.map((m,c)=>{var u=Z(Z({},o),{},{x1:m,y1:e,x2:m,y2:e+r,key:"line-".concat(c),index:c});return v.createElement(Jt,{option:a,lineItemProps:u,key:"line-".concat(c)})});return v.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function hr(t){var{horizontalFill:e,fillOpacity:r,x:a,y:n,width:l,height:i,horizontalPoints:o,horizontal:d=!0}=t;if(!d||!e||!e.length||o==null)return null;var m=o.map(u=>Math.round(u+n-n)).sort((u,f)=>u-f);n!==m[0]&&m.unshift(0);var c=m.map((u,f)=>{var x=m[f+1],p=x==null,h=p?n+i-u:x-u;if(h<=0)return null;var g=f%e.length;return v.createElement("rect",{key:"react-".concat(f),y:u,x:a,height:h,width:l,stroke:"none",fill:e[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function gr(t){var{vertical:e=!0,verticalFill:r,fillOpacity:a,x:n,y:l,width:i,height:o,verticalPoints:d}=t;if(!e||!r||!r.length)return null;var m=d.map(u=>Math.round(u+n-n)).sort((u,f)=>u-f);n!==m[0]&&m.unshift(0);var c=m.map((u,f)=>{var x=m[f+1],p=x==null,h=p?n+i-u:x-u;if(h<=0)return null;var g=f%r.length;return v.createElement("rect",{key:"react-".concat(f),x:u,y:l,width:h,height:o,stroke:"none",fill:r[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var vr=(t,e)=>{var{xAxis:r,width:a,height:n,offset:l}=t;return Bt(Gt(Z(Z(Z({},_e),r),{},{ticks:Rt(r),viewBox:{x:0,y:0,width:a,height:n}})),l.left,l.left+l.width,e)},yr=(t,e)=>{var{yAxis:r,width:a,height:n,offset:l}=t;return Bt(Gt(Z(Z(Z({},_e),r),{},{ticks:Rt(r),viewBox:{x:0,y:0,width:a,height:n}})),l.top,l.top+l.height,e)},br={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:$t.grid};function Zt(t){var e=Us(),r=Vs(),a=Ks(),n=Z(Z({},lt(t,br)),{},{x:ie(t.x)?t.x:a.left,y:ie(t.y)?t.y:a.top,width:ie(t.width)?t.width:a.width,height:ie(t.height)?t.height:a.height}),{xAxisId:l,yAxisId:i,x:o,y:d,width:m,height:c,syncWithTicks:u,horizontalValues:f,verticalValues:x}=n,p=Me(),h=fe(k=>ft(k,"xAxis",l,p)),g=fe(k=>ft(k,"yAxis",i,p));if(!xt(m)||!xt(c)||!ie(o)||!ie(d))return null;var y=n.verticalCoordinatesGenerator||vr,w=n.horizontalCoordinatesGenerator||yr,{horizontalPoints:N,verticalPoints:b}=n;if((!N||!N.length)&&typeof w=="function"){var S=f&&f.length,j=w({yAxis:g?Z(Z({},g),{},{ticks:S?f:g.ticks}):void 0,width:e??m,height:r??c,offset:a},S?!0:u);bt(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(N=j)}if((!b||!b.length)&&typeof y=="function"){var C=x&&x.length,_=y({xAxis:h?Z(Z({},h),{},{ticks:C?x:h.ticks}):void 0,width:e??m,height:r??c,offset:a},C?!0:u);bt(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(b=_)}return v.createElement(Mt,{zIndex:n.zIndex},v.createElement("g",{className:"recharts-cartesian-grid"},v.createElement(fr,{fill:n.fill,fillOpacity:n.fillOpacity,x:n.x,y:n.y,width:n.width,height:n.height,ry:n.ry}),v.createElement(hr,xe({},n,{horizontalPoints:N})),v.createElement(gr,xe({},n,{verticalPoints:b})),v.createElement(xr,xe({},n,{offset:a,horizontalPoints:N,xAxis:h,yAxis:g})),v.createElement(pr,xe({},n,{offset:a,verticalPoints:b,xAxis:h,yAxis:g}))))}Zt.displayName="CartesianGrid";var es=(t,e,r)=>Wt(t,"xAxis",ot(t,e),r),ts=(t,e,r)=>Ft(t,"xAxis",ot(t,e),r),ss=(t,e,r)=>Wt(t,"yAxis",ct(t,e),r),as=(t,e,r)=>Ft(t,"yAxis",ct(t,e),r),jr=Be([it,es,ss,ts,as],(t,e,r,a,n)=>Ut(t,"xAxis")?pt(e,a,!1):pt(r,n,!1)),Nr=(t,e)=>e,rs=Be([Qs,Nr],(t,e)=>t.filter(r=>r.type==="area").find(r=>r.id===e)),ls=t=>{var e=it(t),r=Ut(e,"xAxis");return r?"yAxis":"xAxis"},Sr=(t,e)=>{var r=ls(t);return r==="yAxis"?ct(t,e):ot(t,e)},wr=(t,e,r)=>Xs(t,ls(t),Sr(t,e),r),Cr=Be([rs,wr],(t,e)=>{var r;if(!(t==null||e==null)){var{stackId:a}=t,n=qs(t);if(!(a==null||n==null)){var l=(r=e[a])===null||r===void 0?void 0:r.stackedData,i=l?.find(o=>o.key===n);if(i!=null)return i.map(o=>[o[0],o[1]])}}}),kr=Be([it,es,ss,ts,as,Cr,Ys,jr,rs,Hs],(t,e,r,a,n,l,i,o,d,m)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:f}=i;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||r==null||a==null||n==null||a.length===0||n.length===0||o==null)){var{data:x}=d,p;if(x&&x.length>0?p=x:p=c?.slice(u,f+1),p!=null)return Kr({layout:t,xAxis:e,yAxis:r,xAxisTicks:a,yAxisTicks:n,dataStartIndex:u,areaSettings:d,stackedData:l,displayedData:p,chartBaseValue:m,bandSize:o})}}),_r=["id"],Ar=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function pe(){return pe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},pe.apply(null,arguments)}function ns(t,e){if(t==null)return{};var r,a,n=Pr(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Pr(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function Nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Se(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nt(Object(r),!0).forEach(function(a){Ir(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function Ir(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=Or(t,"string");return typeof e=="symbol"?e:e+""}function Or(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $e(t,e){return t&&t!=="none"?t:e}var Lr=t=>{var{dataKey:e,name:r,stroke:a,fill:n,legendType:l,hide:i}=t;return[{inactive:i,dataKey:e,type:l,color:$e(a,n),value:Vt(r,e),payload:t}]},Dr=v.memo(t=>{var{dataKey:e,data:r,stroke:a,strokeWidth:n,fill:l,name:i,hide:o,unit:d,tooltipType:m,id:c}=t,u={dataDefinedOnItem:r,getPosition:ra,settings:{stroke:a,strokeWidth:n,fill:l,dataKey:e,nameKey:void 0,name:Vt(i,e),hide:o,type:m,color:$e(a,l),unit:d,graphicalItemId:c}};return v.createElement(aa,{tooltipEntrySettings:u})});function Tr(t){var{clipPathId:e,points:r,props:a}=t,{needClip:n,dot:l,dataKey:i}=a,o=nt(a);return v.createElement(ya,{points:r,dot:l,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:i,baseProps:o,needClip:n,clipPathId:e})}function zr(t){var{showLabels:e,children:r,points:a}=t,n=a.map(l=>{var i,o,d={x:(i=l.x)!==null&&i!==void 0?i:0,y:(o=l.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Se(Se({},d),{},{value:l.value,payload:l.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return v.createElement(ga,{value:e?n:void 0},r)}function St(t){var{points:e,baseLine:r,needClip:a,clipPathId:n,props:l}=t,{layout:i,type:o,stroke:d,connectNulls:m,isRange:c}=l,{id:u}=l,f=ns(l,_r),x=nt(f),p=va(f);return v.createElement(v.Fragment,null,e?.length>1&&v.createElement(De,{clipPath:a?"url(#clipPath-".concat(n,")"):void 0},v.createElement(qe,pe({},p,{id:u,points:e,connectNulls:m,type:o,baseLine:r,layout:i,stroke:"none",className:"recharts-area-area"})),d!=="none"&&v.createElement(qe,pe({},x,{className:"recharts-area-curve",layout:i,type:o,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&Array.isArray(r)&&v.createElement(qe,pe({},x,{className:"recharts-area-curve",layout:i,type:o,connectNulls:m,fill:"none",points:r}))),v.createElement(Tr,{points:e,props:f,clipPathId:n}))}function $r(t){var e,r,{alpha:a,baseLine:n,points:l,strokeWidth:i}=t,o=(e=l[0])===null||e===void 0?void 0:e.y,d=(r=l[l.length-1])===null||r===void 0?void 0:r.y;if(!Te(o)||!Te(d))return null;var m=a*Math.abs(o-d),c=Math.max(...l.map(u=>u.x||0));return ie(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(u=>u.x||0),c)),ie(c)?v.createElement("rect",{x:0,y:o<d?o:o-m,width:c+(i?parseInt("".concat(i),10):1),height:Math.floor(m)}):null}function Mr(t){var e,r,{alpha:a,baseLine:n,points:l,strokeWidth:i}=t,o=(e=l[0])===null||e===void 0?void 0:e.x,d=(r=l[l.length-1])===null||r===void 0?void 0:r.x;if(!Te(o)||!Te(d))return null;var m=a*Math.abs(o-d),c=Math.max(...l.map(u=>u.y||0));return ie(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(u=>u.y||0),c)),ie(c)?v.createElement("rect",{x:o<d?o:o-m,y:0,width:m,height:Math.floor(c+(i?parseInt("".concat(i),10):1))}):null}function Br(t){var{alpha:e,layout:r,points:a,baseLine:n,strokeWidth:l}=t;return r==="vertical"?v.createElement($r,{alpha:e,points:a,baseLine:n,strokeWidth:l}):v.createElement(Mr,{alpha:e,points:a,baseLine:n,strokeWidth:l})}function Gr(t){var{needClip:e,clipPathId:r,props:a,previousPointsRef:n,previousBaselineRef:l}=t,{points:i,baseLine:o,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:u,onAnimationStart:f,onAnimationEnd:x}=a,p=v.useMemo(()=>({points:i,baseLine:o}),[i,o]),h=ma(p,"recharts-area-"),g=Kt(),[y,w]=v.useState(!1),N=!y,b=v.useCallback(()=>{typeof x=="function"&&x(),w(!1)},[x]),S=v.useCallback(()=>{typeof f=="function"&&f(),w(!0)},[f]);if(g==null)return null;var j=n.current,C=l.current;return v.createElement(zr,{showLabels:N,points:i},a.children,v.createElement(fa,{animationId:h,begin:m,duration:c,isActive:d,easing:u,onAnimationEnd:b,onAnimationStart:S,key:h},_=>{if(j){var k=j.length/i.length,E=_===1?i:i.map((A,O)=>{var D=Math.floor(O*k);if(j[D]){var L=j[D];return Se(Se({},A),{},{x:Ne(L.x,A.x,_),y:Ne(L.y,A.y,_)})}return A}),z;return ie(o)?z=Ne(C,o,_):xa(o)||pa(o)?z=Ne(C,0,_):z=o.map((A,O)=>{var D=Math.floor(O*k);if(Array.isArray(C)&&C[D]){var L=C[D];return Se(Se({},A),{},{x:Ne(L.x,A.x,_),y:Ne(L.y,A.y,_)})}return A}),_>0&&(n.current=E,l.current=z),v.createElement(St,{points:E,baseLine:z,needClip:e,clipPathId:r,props:a})}return _>0&&(n.current=i,l.current=o),v.createElement(De,null,d&&v.createElement("defs",null,v.createElement("clipPath",{id:"animationClipPath-".concat(r)},v.createElement(Br,{alpha:_,points:i,baseLine:o,layout:g,strokeWidth:a.strokeWidth}))),v.createElement(De,{clipPath:"url(#animationClipPath-".concat(r,")")},v.createElement(St,{points:i,baseLine:o,needClip:e,clipPathId:r,props:a})))}),v.createElement(ha,{label:a.label}))}function Rr(t){var{needClip:e,clipPathId:r,props:a}=t,n=v.useRef(null),l=v.useRef();return v.createElement(Gr,{needClip:e,clipPathId:r,props:a,previousPointsRef:n,previousBaselineRef:l})}class Wr extends v.PureComponent{render(){var{hide:e,dot:r,points:a,className:n,top:l,left:i,needClip:o,xAxisId:d,yAxisId:m,width:c,height:u,id:f,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Pt("recharts-area",n),g=f,{r:y,strokeWidth:w}=ca(r),N=da(r),b=y*2+w,S=o?"url(#clipPath-".concat(N?"":"dots-").concat(g,")"):void 0;return v.createElement(Mt,{zIndex:p},v.createElement(De,{className:h},o&&v.createElement("defs",null,v.createElement(ua,{clipPathId:g,xAxisId:d,yAxisId:m}),!N&&v.createElement("clipPath",{id:"clipPath-dots-".concat(g)},v.createElement("rect",{x:i-b/2,y:l-b/2,width:c+b,height:u+b}))),v.createElement(Rr,{needClip:o,clipPathId:g,props:this.props})),v.createElement(ht,{points:a,mainColor:$e(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(x)&&v.createElement(ht,{points:x,mainColor:$e(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}}var Fr={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:$t.area};function Ur(t){var e,{activeDot:r,animationBegin:a,animationDuration:n,animationEasing:l,connectNulls:i,dot:o,fill:d,fillOpacity:m,hide:c,isAnimationActive:u,legendType:f,stroke:x,xAxisId:p,yAxisId:h}=t,g=ns(t,Ar),y=la(),w=na(),{needClip:N}=ia(p,h),b=Me(),{points:S,isRange:j,baseLine:C}=(e=fe(O=>kr(O,t.id,b)))!==null&&e!==void 0?e:{},_=oa();if(y!=="horizontal"&&y!=="vertical"||_==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:k,width:E,x:z,y:A}=_;return!S||!S.length?null:v.createElement(Wr,pe({},g,{activeDot:r,animationBegin:a,animationDuration:n,animationEasing:l,baseLine:C,connectNulls:i,dot:o,fill:d,fillOpacity:m,height:k,hide:c,layout:y,isAnimationActive:u,isRange:j,legendType:f,needClip:N,points:S,stroke:x,width:E,left:z,top:A,xAxisId:p,yAxisId:h}))}var Vr=(t,e,r,a,n)=>{var l=r??e;if(ie(l))return l;var i=t==="horizontal"?n:a,o=i.scale.domain();if(i.type==="number"){var d=Math.max(o[0],o[1]),m=Math.min(o[0],o[1]);return l==="dataMin"?m:l==="dataMax"||d<0?d:Math.max(Math.min(o[0],o[1]),0)}return l==="dataMin"?o[0]:l==="dataMax"?o[1]:o[0]};function Kr(t){var{areaSettings:{connectNulls:e,baseValue:r,dataKey:a},stackedData:n,layout:l,chartBaseValue:i,xAxis:o,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:u,yAxisTicks:f,bandSize:x}=t,p=n&&n.length,h=Vr(l,i,r,o,d),g=l==="horizontal",y=!1,w=m.map((b,S)=>{var j,C,_,k;if(p)k=n[c+S];else{var E=gt(b,a);Array.isArray(E)?(k=E,y=!0):k=[h,E]}var z=(j=(C=k)===null||C===void 0?void 0:C[1])!==null&&j!==void 0?j:null,A=z==null||p&&!e&&gt(b,a)==null;if(g){var O;return{x:vt({axis:o,ticks:u,bandSize:x,entry:b,index:S}),y:A?null:(O=d.scale.map(z))!==null&&O!==void 0?O:null,value:k,payload:b}}return{x:A?null:(_=o.scale.map(z))!==null&&_!==void 0?_:null,y:vt({axis:d,ticks:f,bandSize:x,entry:b,index:S}),value:k,payload:b}}),N;return p||y?N=w.map(b=>{var S,j=Array.isArray(b.value)?b.value[0]:null;if(g){var C;return{x:b.x,y:j!=null&&b.y!=null&&(C=d.scale.map(j))!==null&&C!==void 0?C:null,payload:b.payload}}return{x:j!=null&&(S=o.scale.map(j))!==null&&S!==void 0?S:null,y:b.y,payload:b.payload}}):N=g?d.scale.map(h):o.scale.map(h),{points:w,baseLine:N??0,isRange:y}}function Yr(t){var e=lt(t,Fr),r=Me();return v.createElement(Zs,{id:e.id,type:"area"},a=>v.createElement(v.Fragment,null,v.createElement(ea,{legendPayload:Lr(e)}),v.createElement(Dr,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:a}),v.createElement(ta,{type:"area",id:a,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:sa(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:r,connectNulls:e.connectNulls}),v.createElement(Ur,pe({},e,{id:a}))))}var is=v.memo(Yr,Js);is.displayName="Area";var Hr=["type"],qr=["dangerouslySetInnerHTML","ticks","scale"],Qr=["id","scale"];function et(){return et=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},et.apply(null,arguments)}function wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function Ct(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wt(Object(r),!0).forEach(function(a){Xr(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function Xr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jr(t){var e=Zr(t,"string");return typeof e=="symbol"?e:e+""}function Zr(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tt(t,e){if(t==null)return{};var r,a,n=el(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function el(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}function tl(t){var e=Yt(),r=v.useRef(null),a=Kt(),{type:n}=t,l=tt(t,Hr),i=Oa(a,"yAxis",n),o=v.useMemo(()=>{if(i!=null)return Ct(Ct({},l),{},{type:i})},[i,l]);return v.useLayoutEffect(()=>{o!=null&&(r.current===null?e(ja(o)):r.current!==o&&e(Na({prev:r.current,next:o})),r.current=o)},[o,e]),v.useLayoutEffect(()=>()=>{r.current&&(e(Sa(r.current)),r.current=null)},[e]),null}function sl(t){var{yAxisId:e,className:r,width:a,label:n}=t,l=v.useRef(null),i=v.useRef(null),o=fe(wa),d=Me(),m=Yt(),c="yAxis",u=fe(j=>Ca(j,e)),f=fe(j=>ka(j,e)),x=fe(j=>_a(j,c,e,d)),p=fe(j=>Aa(j,e));if(v.useLayoutEffect(()=>{if(!(a!=="auto"||!u||Pa(n)||v.isValidElement(n)||p==null)){var j=l.current;if(j){var C=j.getCalculatedWidth();Math.round(u.width)!==Math.round(C)&&m(Ia({id:e,width:C}))}}},[x,u,m,n,e,a,p]),u==null||f==null||p==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:y}=t,w=tt(t,qr),{id:N,scale:b}=p,S=tt(p,Qr);return v.createElement(Ea,et({},w,S,{ref:l,labelRef:i,x:f.x,y:f.y,tickTextProps:a==="auto"?{width:void 0}:{width:a},width:u.width,height:u.height,className:Pt("recharts-".concat(c," ").concat(c),r),viewBox:o,ticks:x,axisType:c,axisId:e}))}var al={allowDataOverflow:J.allowDataOverflow,allowDecimals:J.allowDecimals,allowDuplicatedCategory:J.allowDuplicatedCategory,angle:J.angle,axisLine:_e.axisLine,hide:!1,includeHidden:J.includeHidden,interval:J.interval,label:!1,minTickGap:J.minTickGap,mirror:J.mirror,orientation:J.orientation,padding:J.padding,reversed:J.reversed,scale:J.scale,tick:J.tick,tickCount:J.tickCount,tickLine:_e.tickLine,tickSize:_e.tickSize,type:J.type,niceTicks:J.niceTicks,width:J.width,yAxisId:0},rl=t=>{var e=lt(t,al);return v.createElement(v.Fragment,null,v.createElement(tl,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),v.createElement(sl,e))},os=v.memo(rl,ba);os.displayName="YAxis";var ll=["axis"],nl=v.forwardRef((t,e)=>v.createElement(La,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:ll,tooltipPayloadSearcher:Da,categoricalChartProps:t,ref:e}));const we="$.providerMetadata.openrouter.usage.cost";function ut(t){const e=new Date,r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=new Date(r);a.setDate(a.getDate()+1);const n=new Date(r),l=t==="7d"?7:t==="30d"?30:90;return n.setDate(n.getDate()-l),{startDate:n.toISOString(),endDate:a.toISOString()}}function Ce(t){return t.structuredContent}function V(t){return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}const cs="gateway-chip-period";function il(){try{const t=localStorage.getItem(cs);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function ol(t){try{localStorage.setItem(cs,t)}catch{}}const cl={low:"Low confidence",medium:"Medium confidence",high:"High confidence"},dl={daily:"daily",weekly:"weekly",monthly:"monthly"},ul=[5,10,25,50,100],ml=[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"none",label:"No reset"}];function fl(t){const e=I.c(51),{open:r,onOpenChange:a,connectionId:n,currentLimitUsd:l,billingMode:i,currentLimitPeriod:o}=t,{org:d}=me(),[m,c]=v.useState(null),[u,f]=v.useState(""),[x,p]=v.useState(null),[h,g]=v.useState(null),[y,w]=v.useState(o??"none");let N;e[0]!==n||e[1]!==d.id?(N={connectionId:n,orgId:d.id},e[0]=n,e[1]=d.id,e[2]=N):N=e[2];const b=ke(N);let S;e[3]!==b?(S={client:b},e[3]=b,e[4]=S):S=e[4];const{mutate:j,isPending:C}=qt(S),_=At(),k=i==="postpaid";let E;e[5]!==u?(E=u?Number.parseFloat(u):null,e[5]=u,e[6]=E):E=e[6];const A=m??E,O=y==="none"?null:y,D=k&&A!=null&&A===l&&O===o;let L;e[7]!==b?(L=Wa.mcpToolCall(b,"GATEWAY_USAGE",JSON.stringify({})),e[7]=b,e[8]=L):L=e[8];const G=L;let K;e[9]!==G||e[10]!==_?(K=async()=>{await _.invalidateQueries({queryKey:G,exact:!0}),await _.refetchQueries({queryKey:G,exact:!0,type:"active"})},e[9]=G,e[10]=_,e[11]=K):K=e[11];const F=K;let T,$;e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==A||e[16]!==k||e[17]!==y||e[18]!==j||e[19]!==a||e[20]!==F?($=()=>{if(!A||A<=0)return;const B=k?A:l+A;g(null);const ae={limit_usd:B,billing_mode:i,return_url:window.location.href};k&&(ae.limit_period=y),j({name:"GATEWAY_SET_LIMIT",arguments:ae},{onSuccess:async re=>{const te=re.structuredContent;te?.checkout_url||await F(),te?.checkout_url?p(te.checkout_url):T()},onError:re=>{g(re.message??"Failed to update limit.")}})},T=()=>{c(null),f(""),p(null),g(null),w(o??"none"),a(!1)},e[12]=i,e[13]=o,e[14]=l,e[15]=A,e[16]=k,e[17]=y,e[18]=j,e[19]=a,e[20]=F,e[21]=T,e[22]=$):(T=e[21],$=e[22]);const Y=k?"Configure Spending Limit":"Add Credit",H=k?"Set a spending limit for your AI Gateway. The limit resets automatically based on the selected period.":"Choose how much credit to add to your AI Gateway.",M=k?"New limit":"Select amount",U=k?"Set Limit":"Continue";let q;e[23]!==Y?(q=s.jsx(ys,{children:Y}),e[23]=Y,e[24]=q):q=e[24];let ee;e[25]!==H?(ee=s.jsx(bs,{children:H}),e[25]=H,e[26]=ee):ee=e[26];let R;e[27]!==q||e[28]!==ee?(R=s.jsxs(js,{children:[q,ee]}),e[27]=q,e[28]=ee,e[29]=R):R=e[29];let W;e[30]!==M||e[31]!==x||e[32]!==U||e[33]!==l||e[34]!==u||e[35]!==A||e[36]!==h||e[37]!==$||e[38]!==C||e[39]!==k||e[40]!==D||e[41]!==y||e[42]!==m?(W=x?s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment link is ready. Click below to complete the purchase. You'll be redirected back here after payment."}),s.jsx(ce,{asChild:!0,className:"gap-2",children:s.jsxs("a",{href:x,children:[s.jsx(rt,{size:15}),"Complete Payment"]})})]}):s.jsxs("div",{className:"flex flex-col gap-5 pt-2",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Ae,{className:"text-xs text-muted-foreground",children:M}),s.jsx("div",{className:"grid grid-cols-5 gap-2",children:ul.map(B=>s.jsxs("button",{type:"button",onClick:()=>{c(B),f("")},className:ue("rounded-md border px-3 py-2 text-sm font-medium transition-colors",m===B?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:["$",B]},B))})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Ae,{htmlFor:"custom-amount",className:"text-xs text-muted-foreground",children:k?"Or enter the exact new limit":"Or enter a custom amount"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),s.jsx(Ie,{id:"custom-amount",type:"number",min:"0.01",step:"0.01",placeholder:"0.00",className:"pl-7",value:u,onChange:B=>{f(B.target.value),c(null)}})]})]}),k&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Ae,{className:"text-xs text-muted-foreground",children:"Reset period"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:ml.map(B=>{const{value:ae,label:re}=B;return s.jsx("button",{type:"button",onClick:()=>w(ae),className:ue("rounded-md border px-2 py-2 text-xs font-medium transition-colors",y===ae?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:re},ae)})})]}),h&&s.jsx("p",{className:"text-xs text-destructive",children:h}),s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:k?s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:l>0?V(l):"none"})]}):s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:V(l)})]})}),s.jsx(ce,{onClick:$,disabled:C||!A||A<=0||D,className:"gap-2",children:C?"Updating...":U})]})]}),e[30]=M,e[31]=x,e[32]=U,e[33]=l,e[34]=u,e[35]=A,e[36]=h,e[37]=$,e[38]=C,e[39]=k,e[40]=D,e[41]=y,e[42]=m,e[43]=W):W=e[43];let Q;e[44]!==R||e[45]!==W?(Q=s.jsxs(Ot,{className:"sm:max-w-md",children:[R,W]}),e[44]=R,e[45]=W,e[46]=Q):Q=e[46];let se;return e[47]!==T||e[48]!==r||e[49]!==Q?(se=s.jsx(Lt,{open:r,onOpenChange:T,children:Q}),e[47]=T,e[48]=r,e[49]=Q,e[50]=se):se=e[50],se}function xl(t){const e=I.c(22),{estimation:r}=t;if(!r)return null;const{estimatedDaysRemaining:a,estimatedDepletionDate:n,avgDailySpend:l}=r;if(a==null)return null;let i;e[0]!==n?(i=n?new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=n,e[1]=i):i=e[1];const o=i,d=a!==1?"s":"";let m;e[2]!==a||e[3]!==d?(m=s.jsxs("span",{className:"tabular-nums font-medium text-foreground",children:["~",a," day",d," ","remaining"]}),e[2]=a,e[3]=d,e[4]=m):m=e[4];let c;e[5]!==o?(c=o&&s.jsxs("span",{children:["(until ",o,")"]}),e[5]=o,e[6]=c):c=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),e[7]=u):u=e[7];let f;e[8]!==l?(f=V(l),e[8]=l,e[9]=f):f=e[9];let x;e[10]!==f?(x=s.jsxs("span",{className:"tabular-nums",children:["avg ",f,"/day"]}),e[10]=f,e[11]=x):x=e[11];let p;e[12]!==r.resetsBeforeDepletion?(p=r.resetsBeforeDepletion&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),s.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Resets before depletion"})]}),e[12]=r.resetsBeforeDepletion,e[13]=p):p=e[13];const h=cl[r.confidence];let g;e[14]!==h?(g=s.jsx(Ba,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 font-normal",children:h}),e[14]=h,e[15]=g):g=e[15];let y;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(y=s.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[m,c,u,x,p,g]}),e[16]=g,e[17]=m,e[18]=c,e[19]=x,e[20]=p,e[21]=y):y=e[21],y}function pl(t){const e=I.c(37),{usage:r,limit:a,limitPeriod:n,onConfigureLimit:l,connectionId:i,alert:o}=t,d=a.total!=null&&a.total>0;let m;e[0]!==d||e[1]!==a.remaining||e[2]!==a.total?(m=d?Math.min(100,Math.round((a.total-(a.remaining??0))/a.total*100)):null,e[0]=d,e[1]=a.remaining,e[2]=a.total,e[3]=m):m=e[3];const c=m;let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Spending"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[4]=u):u=e[4];let f;e[5]!==r.total?(f=V(r.total),e[5]=r.total,e[6]=f):f=e[6];let x;e[7]!==f?(x=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:f}),e[7]=f,e[8]=x):x=e[8];let p;e[9]!==d||e[10]!==a.total||e[11]!==n?(p=d&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",V(a.total)," limit",n&&s.jsxs("span",{className:"ml-1.5 inline-flex items-center gap-1",children:[s.jsx(Ra,{size:10}),dl[n]]})]}),e[9]=d,e[10]=a.total,e[11]=n,e[12]=p):p=e[12];let h;e[13]!==d?(h=!d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"No limit configured"}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==x||e[16]!==p||e[17]!==h?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[u,x,p,h]}),e[15]=x,e[16]=p,e[17]=h,e[18]=g):g=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ht,{size:16}),e[19]=y):y=e[19];const w=d?"Configure Limit":"Set Limit";let N;e[20]!==l||e[21]!==w?(N=s.jsxs(ce,{onClick:l,variant:"outline",className:"gap-2",children:[y,w]}),e[20]=l,e[21]=w,e[22]=N):N=e[22];let b;e[23]!==N||e[24]!==g?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[g,N]}),e[23]=N,e[24]=g,e[25]=b):b=e[25];let S;e[26]!==d||e[27]!==a.reset||e[28]!==c?(S=d&&c!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ue("h-full rounded-full transition-all",c>=90?"bg-destructive":c>=70?"bg-amber-500":"bg-primary"),style:{width:`${c}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[c,"% used",a.reset&&s.jsxs("span",{className:"ml-2",children:["· resets ",a.reset]})]})]}),e[26]=d,e[27]=a.reset,e[28]=c,e[29]=S):S=e[29];let j;e[30]!==o||e[31]!==i?(j=s.jsx(ds,{connectionId:i,alert:o,billingMode:"postpaid"}),e[30]=o,e[31]=i,e[32]=j):j=e[32];let C;return e[33]!==b||e[34]!==S||e[35]!==j?(C=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[b,S,j]}),e[33]=b,e[34]=S,e[35]=j,e[36]=C):C=e[36],C}function hl(t){const e=I.c(30),{available:r,total:a,estimation:n,onAddCredit:l,connectionId:i,alert:o}=t,d=a>0?Math.max(0,Math.min(100,(a-r)/a*100)):0;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Available Credit"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[0]=m):m=e[0];let c;e[1]!==r?(c=V(r),e[1]=r,e[2]=c):c=e[2];let u;e[3]!==c?(u=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:c}),e[3]=c,e[4]=u):u=e[4];let f;e[5]!==a?(f=a>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",V(a)," total"]}),e[5]=a,e[6]=f):f=e[6];let x;e[7]!==u||e[8]!==f?(x=s.jsxs("div",{className:"flex flex-col gap-1",children:[m,u,f]}),e[7]=u,e[8]=f,e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Ht,{size:16}),e[10]=p):p=e[10];let h;e[11]!==l?(h=s.jsxs(ce,{onClick:l,className:"gap-2 px-5",children:[p,"Add Credit"]}),e[11]=l,e[12]=h):h=e[12];let g;e[13]!==x||e[14]!==h?(g=s.jsxs("div",{className:"flex items-center justify-between",children:[x,h]}),e[13]=x,e[14]=h,e[15]=g):g=e[15];let y;e[16]!==r||e[17]!==a||e[18]!==d?(y=a>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${d}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[V(Math.max(0,a-r))," used"]})]}),e[16]=r,e[17]=a,e[18]=d,e[19]=y):y=e[19];let w;e[20]!==n?(w=s.jsx(xl,{estimation:n}),e[20]=n,e[21]=w):w=e[21];let N;e[22]!==o||e[23]!==i?(N=s.jsx(ds,{connectionId:i,alert:o,billingMode:"prepaid"}),e[22]=o,e[23]=i,e[24]=N):N=e[24];let b;return e[25]!==w||e[26]!==N||e[27]!==g||e[28]!==y?(b=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[g,y,w,N]}),e[25]=w,e[26]=N,e[27]=g,e[28]=y,e[29]=b):b=e[29],b}function ds(t){const e=I.c(78),{connectionId:r,alert:a,billingMode:n}=t,{org:l}=me(),[i,o]=v.useState(!1),[d,m]=v.useState(a.enabled),[c,u]=v.useState(String(a.threshold_usd)),[f,x]=v.useState(a.email??""),[p,h]=v.useState(!1),[g,y]=v.useState(null);let w;e[0]!==r||e[1]!==l.id?(w={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=w):w=e[2];const N=ke(w);let b;e[3]!==N?(b={client:N},e[3]=N,e[4]=b):b=e[4];const{mutate:S,isPending:j}=qt(b),C=d!==a.enabled||c!==String(a.threshold_usd)||f!==(a.email??"");let _;e[5]!==f||e[6]!==d||e[7]!==S||e[8]!==c?(_=()=>{y(null),h(!1);const X=parseFloat(c);if(d&&(!f||!f.includes("@"))){y("A valid email is required to enable alerts.");return}if(Number.isNaN(X)||X<=0){y("Threshold must be a positive number.");return}S({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:X,...f?{email:f}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:he=>{y(he.message??"Failed to save alert config.")}})},e[5]=f,e[6]=d,e[7]=S,e[8]=c,e[9]=_):_=e[9];const k=_,E=n==="postpaid"?"Usage Alert":"Low-Balance Alert",z=n==="postpaid"?"Get notified when spending reaches a threshold":"Get notified when credit drops below a threshold";if(!i){let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>o(!0),e[10]=X):X=e[10];let he;e[11]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsx("div",{className:"flex items-center justify-center size-7 rounded-md bg-muted shrink-0",children:s.jsx(Ga,{size:14,className:"text-muted-foreground"})}),e[11]=he):he=e[11];let ge;e[12]!==E?(ge=s.jsx("p",{className:"text-xs font-medium text-foreground",children:E}),e[12]=E,e[13]=ge):ge=e[13];let ve;e[14]!==a.enabled||e[15]!==a.threshold_usd||e[16]!==n?(ve=a.enabled?n==="postpaid"?`Enabled · Alert at ${V(a.threshold_usd)}`:`Enabled · Alert below ${V(a.threshold_usd)}`:n==="postpaid"?"Get notified before your spending limit runs out":"Get notified before your credit balance runs out",e[14]=a.enabled,e[15]=a.threshold_usd,e[16]=n,e[17]=ve):ve=e[17];let ye;e[18]!==ve?(ye=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:ve}),e[18]=ve,e[19]=ye):ye=e[19];let be;e[20]!==ge||e[21]!==ye?(be=s.jsxs("div",{className:"flex-1 min-w-0",children:[ge,ye]}),e[20]=ge,e[21]=ye,e[22]=be):be=e[22];let je;e[23]!==a.enabled?(je=a.enabled&&s.jsx("span",{className:"shrink-0 rounded-full bg-green-500/15 px-2 py-0.5 text-[10px] font-medium text-green-600 dark:text-green-400",children:"On"}),e[23]=a.enabled,e[24]=je):je=e[24];let Oe;return e[25]!==je||e[26]!==be?(Oe=s.jsxs("button",{type:"button",onClick:X,className:"mt-4 flex items-center gap-3 rounded-lg border border-dashed border-border/60 px-4 py-3 w-full text-left transition-colors hover:bg-muted/50 hover:border-border",children:[he,be,je]}),e[25]=je,e[26]=be,e[27]=Oe):Oe=e[27],Oe}let A;e[28]!==E?(A=s.jsx("p",{className:"text-xs font-medium text-foreground",children:E}),e[28]=E,e[29]=A):A=e[29];let O;e[30]!==z?(O=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:z}),e[30]=z,e[31]=O):O=e[31];let D;e[32]!==A||e[33]!==O?(D=s.jsxs("div",{children:[A,O]}),e[32]=A,e[33]=O,e[34]=D):D=e[34];let L;e[35]!==d?(L=s.jsx(Le,{checked:d,onCheckedChange:m}),e[35]=d,e[36]=L):L=e[36];let G;e[37]!==D||e[38]!==L?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[D,L]}),e[37]=D,e[38]=L,e[39]=G):G=e[39];const K=!d&&"opacity-50 pointer-events-none";let F;e[40]!==K?(F=ue("flex flex-col gap-3 transition-opacity",K),e[40]=K,e[41]=F):F=e[41];const T=n==="postpaid"?"Notify at":"Notify below";let $;e[42]!==T?($=s.jsx(Ae,{htmlFor:"alert-threshold",className:"text-[11px] text-muted-foreground",children:T}),e[42]=T,e[43]=$):$=e[43];let Y;e[44]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e[44]=Y):Y=e[44];let H;e[45]===Symbol.for("react.memo_cache_sentinel")?(H=X=>u(X.target.value),e[45]=H):H=e[45];let M;e[46]!==c?(M=s.jsxs("div",{className:"relative",children:[Y,s.jsx(Ie,{id:"alert-threshold",type:"number",min:"1",step:"1",className:"h-8 pl-7 text-xs",value:c,onChange:H})]}),e[46]=c,e[47]=M):M=e[47];let U;e[48]!==$||e[49]!==M?(U=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[$,M]}),e[48]=$,e[49]=M,e[50]=U):U=e[50];let q;e[51]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ae,{htmlFor:"alert-email",className:"text-[11px] text-muted-foreground",children:"Notification email"}),e[51]=q):q=e[51];let ee;e[52]===Symbol.for("react.memo_cache_sentinel")?(ee=X=>x(X.target.value),e[52]=ee):ee=e[52];let R;e[53]!==f?(R=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[q,s.jsx(Ie,{id:"alert-email",type:"email",placeholder:"you@example.com",className:"h-8 text-xs",value:f,onChange:ee})]}),e[53]=f,e[54]=R):R=e[54];let W;e[55]!==U||e[56]!==R?(W=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[U,R]}),e[55]=U,e[56]=R,e[57]=W):W=e[57];let Q;e[58]!==g?(Q=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=Q):Q=e[59];let se;e[60]!==F||e[61]!==W||e[62]!==Q?(se=s.jsxs("div",{className:F,children:[W,Q]}),e[60]=F,e[61]=W,e[62]=Q,e[63]=se):se=e[63];let B;e[64]!==p?(B=p&&s.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Saved"}),e[64]=p,e[65]=B):B=e[65];let ae;e[66]===Symbol.for("react.memo_cache_sentinel")?(ae=s.jsx(ce,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>o(!1),children:"Cancel"}),e[66]=ae):ae=e[66];const re=j||!C,te=j?"Saving...":"Save Alert";let le;e[67]!==k||e[68]!==re||e[69]!==te?(le=s.jsx(ce,{size:"sm",className:"h-7 text-xs",onClick:k,disabled:re,children:te}),e[67]=k,e[68]=re,e[69]=te,e[70]=le):le=e[70];let de;e[71]!==B||e[72]!==le?(de=s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[B,ae,le]}),e[71]=B,e[72]=le,e[73]=de):de=e[73];let P;return e[74]!==se||e[75]!==de||e[76]!==G?(P=s.jsxs("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-border bg-muted/20 p-4",children:[G,se,de]}),e[74]=se,e[75]=de,e[76]=G,e[77]=P):P=e[77],P}const gl={cost:{label:"Cost",color:"var(--chart-1)"}};function vl(){const t=I.c(54),{org:e}=me(),[r,a]=v.useState("7d");let n;t[0]!==r?(n=ut(r),t[0]=r,t[1]=n):n=t[1];const l=n;let i;t[2]!==e.id?(i={connectionId:dt,orgId:e.id},t[2]=e.id,t[3]=i):i=t[3];const o=ke(i);let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d={type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"sum",interval:"1d"}},t[4]=d):d=t[4];let m;t[5]!==l?(m={widget:d,timeRange:l,skipCount:!0},t[5]=l,t[6]=m):m=t[6];let c;t[7]!==o||t[8]!==m?(c={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:Ce},t[7]=o,t[8]=m,t[9]=c):c=t[9];const{data:u}=oe(c);let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f={type:"metric",source:{path:we,from:"output"},aggregation:{fn:"count_all"}},t[10]=f):f=t[10];let x;t[11]!==l?(x={widget:f,timeRange:l,skipCount:!0},t[11]=l,t[12]=x):x=t[12];let p;t[13]!==o||t[14]!==x?(p={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:Ce},t[13]=o,t[14]=x,t[15]=p):p=t[15];const{data:h}=oe(p);let g;t[16]===Symbol.for("react.memo_cache_sentinel")?(g={type:"metric",source:{path:we,from:"output"},aggregation:{fn:"sum",groupByColumn:"connection_title",limit:10}},t[16]=g):g=t[16];let y;t[17]!==l?(y={widget:g,timeRange:l,skipCount:!0},t[17]=l,t[18]=y):y=t[18];let w;t[19]!==o||t[20]!==y?(w={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:y,staleTime:6e4,select:Ce},t[19]=o,t[20]=y,t[21]=w):w=t[21];const{data:N}=oe(w);let b;t[22]!==u?.timeseries?(b=u?.timeseries??[],t[22]=u?.timeseries,t[23]=b):b=t[23];let S;t[24]!==b?(S=b.map(wl),t[24]=b,t[25]=S):S=t[25];const j=S;let C;if(t[26]!==h?.value||t[27]!==j||t[28]!==N?.groups||t[29]!==u?.timeseries||t[30]!==r){const _=(u?.timeseries??[]).reduce(Sl,0),k=h?.value??0,E=(N?.groups??[]).filter(Nl).sort(jl).slice(0,5),z=r==="7d"?"last 7 days":r==="30d"?"last 30 days":"last 90 days";let A;t[32]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Usage"}),t[32]=A):A=t[32];const O=V(_);let D;t[33]!==O?(D=s.jsx("p",{className:"text-2xl font-bold tabular-nums text-foreground tracking-tight",children:O}),t[33]=O,t[34]=D):D=t[34];let L;t[35]!==z?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:z}),t[35]=z,t[36]=L):L=t[36];let G;t[37]!==D||t[38]!==L?(G=s.jsxs("div",{className:"flex items-baseline gap-2",children:[D,L]}),t[37]=D,t[38]=L,t[39]=G):G=t[39];let K;t[40]!==k?(K=k.toLocaleString(),t[40]=k,t[41]=K):K=t[41];let F;t[42]!==K?(F=s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[K," tool calls"]}),t[42]=K,t[43]=F):F=t[43];let T;t[44]!==G||t[45]!==F?(T=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[A,G,F]}),t[44]=G,t[45]=F,t[46]=T):T=t[46];let $;t[47]!==r?($=s.jsx(us,{period:r,onPeriodChange:a}),t[47]=r,t[48]=$):$=t[48];let Y;t[49]!==T||t[50]!==$?(Y=s.jsxs("div",{className:"flex items-center justify-between",children:[T,$]}),t[49]=T,t[50]=$,t[51]=Y):Y=t[51];let H;t[52]!==j?(H=j.length>0?s.jsx(Ta,{config:gl,className:"h-[200px] w-full",children:s.jsxs(nl,{data:j,margin:{top:4,right:4,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"fillCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"var(--color-cost)",stopOpacity:.3}),s.jsx("stop",{offset:"95%",stopColor:"var(--color-cost)",stopOpacity:0})]})}),s.jsx(Zt,{vertical:!1,strokeDasharray:"3 3"}),s.jsx(za,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,fontSize:11,interval:"preserveStartEnd"}),s.jsx(os,{tickLine:!1,axisLine:!1,tickMargin:4,fontSize:11,tickFormatter:bl}),s.jsx($a,{content:s.jsx(Ma,{formatter:yl})}),s.jsx(is,{type:"monotone",dataKey:"cost",stroke:"var(--color-cost)",fill:"url(#fillCost)",strokeWidth:2})]})}):s.jsx("div",{className:"h-[200px] flex items-center justify-center text-xs text-muted-foreground",children:"No usage data available for this period"}),t[52]=j,t[53]=H):H=t[53],C=s.jsxs("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5",children:[Y,H,E.length>0&&s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Cost by Connection"}),s.jsx("div",{className:"flex flex-col gap-1.5",children:E.map((M,U)=>{const q=_>0?Math.min(M.value/_*100,100):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:M.key}),s.jsx("div",{className:"relative h-1.5 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-sm",style:{width:`${q}%`,backgroundColor:`var(--chart-${U%5+1})`}})}),s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:V(M.value)})]},M.key)})})]})]}),t[26]=h?.value,t[27]=j,t[28]=N?.groups,t[29]=u?.timeseries,t[30]=r,t[31]=C}else C=t[31];return C}function yl(t){return V(t)}function bl(t){return`$${t}`}function jl(t,e){return e.value-t.value}function Nl(t){return t.value>0}function Sl(t,e){return t+e.value}function wl(t){return{date:new Date(t.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),cost:t.value}}function Cl(){const t=I.c(6),[e,r]=v.useState(il);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=m=>{r(m),ol(m)},t[0]=a):a=t[0];const n=a;let l,i;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Sidebar Display Period"}),i=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which usage period is shown in the sidebar when no limit is set."}),t[1]=l,t[2]=i):(l=t[1],i=t[2]);let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=["daily","weekly","monthly"],t[3]=o):o=t[3];let d;return t[4]!==e?(d=s.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-5",children:[l,i,s.jsx("div",{className:"flex gap-2 mt-1",children:o.map(m=>s.jsx("button",{type:"button",onClick:()=>n(m),className:ue("rounded-md border px-3 py-1.5 text-xs font-medium capitalize transition-colors",e===m?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted text-muted-foreground"),children:m},m))})]}),t[4]=e,t[5]=d):d=t[5],d}function Xe(t){const e=I.c(20),{label:r,value:a,subValue:n,maxValue:l,color:i}=t,o=i===void 0?"bg-chart-1":i;let d;e[0]!==a?(d=parseFloat(a.replace(/[^0-9.]/g,""))||0,e[0]=a,e[1]=d):d=e[1];const m=d,c=l>0?Math.min(m/l*100,100):0;let u;e[2]!==r?(u=s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:r}),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==o?(f=ue("h-full transition-all duration-500 ease-out",o),e[4]=o,e[5]=f):f=e[5];const x=`${c}%`;let p;e[6]!==x?(p={width:x},e[6]=x,e[7]=p):p=e[7];let h;e[8]!==f||e[9]!==p?(h=s.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:f,style:p})}),e[8]=f,e[9]=p,e[10]=h):h=e[10];let g;e[11]!==a?(g=s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:a}),e[11]=a,e[12]=g):g=e[12];let y;e[13]!==n?(y=n&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:n}),e[13]=n,e[14]=y):y=e[14];let w;return e[15]!==u||e[16]!==h||e[17]!==g||e[18]!==y?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[u,h,g,y]}),e[15]=u,e[16]=h,e[17]=g,e[18]=y,e[19]=w):w=e[19],w}function Je(t){const e=I.c(8),{title:r,children:a,empty:n}=t;let l;e[0]!==r?(l=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:r}),e[0]=r,e[1]=l):l=e[1];let i;e[2]!==a||e[3]!==n?(i=n?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No data available for this period"}):a,e[2]=a,e[3]=n,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[l,i]}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}const kt={"7d":"7 days","30d":"30 days","90d":"90 days"};function us(t){const e=I.c(4),{period:r,onPeriodChange:a}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Object.keys(kt),e[0]=n):n=e[0];let l;return e[1]!==a||e[2]!==r?(l=s.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 self-start",children:n.map(i=>s.jsx("button",{type:"button",onClick:()=>a(i),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",r===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:kt[i]},i))}),e[1]=a,e[2]=r,e[3]=l):l=e[3],l}function _t(t,e){const r=new Map(e.map(a=>[a.key,a.value]));return t.map(a=>({key:a.key,cost:a.value,calls:r.get(a.key)??0})).sort((a,n)=>n.cost-a.cost)}function kl(){const t=I.c(27),{org:e}=me(),[r,a]=v.useState("7d"),n=ut(r),{data:l}=Ua(),i=l?.data?.members??[],o=new Map(i.map(Ol));let d;t[0]!==e.id?(d={connectionId:dt,orgId:e.id},t[0]=e.id,t[1]=d):d=t[1];const m=ke(d),c=P=>({client:m,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:{widget:{type:"table",source:{path:we,from:"output"},aggregation:{fn:P.fn,...P.groupByColumn&&{groupByColumn:P.groupByColumn},...P.limit&&{limit:P.limit}}},timeRange:n,skipCount:!0},staleTime:6e4,select:Ce}),{data:u,isLoading:f}=oe(c({fn:"sum",groupByColumn:"connection_title",limit:20})),{data:x,isLoading:p}=oe(c({fn:"count_all",groupByColumn:"connection_title",limit:20})),{data:h,isLoading:g}=oe(c({fn:"sum",groupByColumn:"user_id",limit:20})),{data:y,isLoading:w}=oe(c({fn:"count_all",groupByColumn:"user_id",limit:20})),{data:N,isLoading:b}=oe(c({fn:"sum",groupByColumn:"tool_name",limit:20}));let S;t[2]===Symbol.for("react.memo_cache_sentinel")?(S={fn:"count_all",groupByColumn:"tool_name",limit:20},t[2]=S):S=t[2];const{data:j,isLoading:C}=oe(c(S));if(f||p||g||w||b||C){let P;t[3]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(ne,{className:"h-8 w-48"}),t[3]=P):P=t[3];let X;return t[4]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs("div",{className:"flex flex-col gap-4",children:[P,s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:Array.from({length:3}).map(El)})]}),t[4]=X):X=t[4],X}const k=_t(u?.groups??[],x?.groups??[]),E=_t(h?.groups??[],y?.groups??[]).map(P=>({...P,key:o.get(P.key)??P.key})),z=j?.groups??[],A=new Map((N?.groups??[]).map(Il)),O=z.map(P=>({name:P.key,calls:P.value,cost:A.get(P.key)??0})).sort(Pl).slice(0,20),D=k.reduce(Al,0),L=k.reduce(_l,0),G=k[0]?.cost??1,K=E[0]?.cost??1,F=O[0]?.calls??1;let T;t[5]!==r?(T=s.jsx(us,{period:r,onPeriodChange:a}),t[5]=r,t[6]=T):T=t[6];const $="grid grid-cols-1 gap-4 sm:grid-cols-2",Y=k.length===0,H=k.slice(0,8).map(P=>s.jsx(Xe,{label:P.key,value:V(P.cost),subValue:`${P.calls.toLocaleString()} calls`,maxValue:G,color:"bg-chart-1"},P.key));let M;t[7]!==H?(M=s.jsx("div",{className:"space-y-2.5",children:H}),t[7]=H,t[8]=M):M=t[8];let U;t[9]!==Y||t[10]!==M?(U=s.jsx(Je,{title:"Cost by Connection",empty:Y,children:M}),t[9]=Y,t[10]=M,t[11]=U):U=t[11];const q=E.length===0,ee=E.slice(0,8).map(P=>s.jsx(Xe,{label:P.key,value:V(P.cost),subValue:`${P.calls.toLocaleString()} calls`,maxValue:K,color:"bg-chart-4"},P.key));let R;t[12]!==ee?(R=s.jsx("div",{className:"space-y-2.5",children:ee}),t[12]=ee,t[13]=R):R=t[13];let W;t[14]!==R||t[15]!==q?(W=s.jsx(Je,{title:"Cost by User",empty:q,children:R}),t[14]=R,t[15]=q,t[16]=W):W=t[16];const Q=Je,se="Top Tools",B=O.length===0,ae="space-y-2.5",re=O.slice(0,8).map(P=>s.jsx(Xe,{label:P.name,value:P.calls.toLocaleString(),subValue:P.cost>0?V(P.cost):void 0,maxValue:F,color:"bg-chart-3"},P.name));let te;t[17]!==re?(te=s.jsx("div",{className:ae,children:re}),t[17]=re,t[18]=te):te=t[18];let le;t[19]!==Q||t[20]!==B||t[21]!==te?(le=s.jsx(Q,{title:se,empty:B,children:te}),t[19]=Q,t[20]=B,t[21]=te,t[22]=le):le=t[22];let de;return t[23]!==W||t[24]!==le||t[25]!==U?(de=s.jsxs("div",{className:$,children:[U,W,le]}),t[23]=W,t[24]=le,t[25]=U,t[26]=de):de=t[26],s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:["Total:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:V(D)})]}),s.jsxs("span",{className:"text-muted-foreground",children:["Calls:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:L.toLocaleString()})]})]}),T]}),de]})}function _l(t,e){return t+e.calls}function Al(t,e){return t+e.cost}function Pl(t,e){return e.calls-t.calls}function Il(t){return[t.key,t.value]}function El(t,e){return s.jsx(ne,{className:"h-40 rounded-xl"},e)}function Ol(t){return[t.userId,t.user.name??t.user.email]}function Ll(t,e){const r=new Map;for(const a of t){const l=new Date(a.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),i=r.get(l)??{cost:0,calls:0};r.set(l,{cost:i.cost+a.value,calls:i.calls})}for(const a of e){const l=new Date(a.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),i=r.get(l)??{cost:0,calls:0};r.set(l,{cost:i.cost,calls:i.calls+a.value})}return Array.from(r.entries()).map(([a,n])=>({month:a,...n})).reverse()}function Dl(){const t=I.c(27),{org:e}=me();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=ut("90d"),t[0]=r):r=t[0];const a=r;let n;t[1]!==e.id?(n={connectionId:dt,orgId:e.id},t[1]=e.id,t[2]=n):n=t[2];const l=ke(n);let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={widget:{type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"sum",interval:"1d"}},timeRange:a,skipCount:!0},t[3]=i):i=t[3];let o;t[4]!==l?(o={client:l,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:i,staleTime:6e4,select:Ce},t[4]=l,t[5]=o):o=t[5];const{data:d,isLoading:m}=oe(o);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c={widget:{type:"timeseries",source:{path:we,from:"output"},aggregation:{fn:"count_all",interval:"1d"}},timeRange:a,skipCount:!0},t[6]=c):c=t[6];let u;t[7]!==l?(u={client:l,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:c,staleTime:6e4,select:Ce},t[7]=l,t[8]=u):u=t[8];const{data:f,isLoading:x}=oe(u);if(m||x){let S;return t[9]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(ne,{className:"h-8 w-48"}),s.jsx(ne,{className:"h-48 rounded-xl"})]}),t[9]=S):S=t[9],S}let p,h,g,y,w;if(t[10]!==f?.timeseries||t[11]!==d?.timeseries){const S=Ll(d?.timeseries??[],f?.timeseries??[]);w="flex flex-col gap-4",t[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs (last 90 days)"}),t[17]=p):p=t[17],h="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[18]=g):g=t[18],y=S.length===0?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No usage data available for this period"}):s.jsxs("div",{className:"w-full",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 pb-1.5 border-b border-border text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:[s.jsx("span",{children:"Month"}),s.jsx("span",{className:"text-right",children:"Cost"}),s.jsx("span",{className:"text-right",children:"Calls"})]}),s.jsx("div",{className:"divide-y divide-border",children:S.map(Tl)})]}),t[10]=f?.timeseries,t[11]=d?.timeseries,t[12]=p,t[13]=h,t[14]=g,t[15]=y,t[16]=w}else p=t[12],h=t[13],g=t[14],y=t[15],w=t[16];let N;t[19]!==h||t[20]!==g||t[21]!==y?(N=s.jsxs("div",{className:h,children:[g,y]}),t[19]=h,t[20]=g,t[21]=y,t[22]=N):N=t[22];let b;return t[23]!==p||t[24]!==N||t[25]!==w?(b=s.jsxs("div",{className:w,children:[p,N]}),t[23]=p,t[24]=N,t[25]=w,t[26]=b):b=t[26],b}function Tl(t){return s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 py-2 text-xs",children:[s.jsx("span",{className:"text-foreground font-medium",children:t.month}),s.jsx("span",{className:"text-right tabular-nums text-foreground",children:V(t.cost)}),s.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.calls.toLocaleString()})]},t.month)}function zl(t){const e=I.c(31),{connectionId:r}=t,{org:a}=me(),[n,l]=v.useState(!1);let i;e[0]!==r||e[1]!==a.id?(i={connectionId:r,orgId:a.id},e[0]=r,e[1]=a.id,e[2]=i):i=e[2];const o=ke(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==o?(m={client:o,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:$l},e[4]=o,e[5]=m):m=e[5];const{data:c,isLoading:u}=oe(m);if(u){let E;return e[6]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(ne,{className:"h-36 rounded-xl"}),e[6]=E):E=e[6],E}if(!c)return null;const f=c.limit.remaining??0,x=c.limit.total??0,p=c.usage,h=c.billing.mode,g=c.billing.limitPeriod??null,y=c.estimation??null;let w;e[7]!==c.alert?(w=c.alert??{enabled:!1,threshold_usd:10,email:null},e[7]=c.alert,e[8]=w):w=e[8];const N=w,b=c.limit,S=h==="postpaid"&&(x==null||x===0);let j;e[9]!==N||e[10]!==f||e[11]!==h||e[12]!==r||e[13]!==y||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(j=h==="postpaid"?s.jsx(pl,{usage:p,limit:b,limitPeriod:g,onConfigureLimit:()=>l(!0),connectionId:r,alert:N}):s.jsx(hl,{available:f,total:x,estimation:y,onAddCredit:()=>l(!0),connectionId:r,alert:N}),e[9]=N,e[10]=f,e[11]=h,e[12]=r,e[13]=y,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=j):j=e[18];let C;e[19]!==S?(C=S&&s.jsx(Cl,{}),e[19]=S,e[20]=C):C=e[20];let _;e[21]!==h||e[22]!==r||e[23]!==n||e[24]!==g||e[25]!==x?(_=s.jsx(fl,{open:n,onOpenChange:l,connectionId:r,currentLimitUsd:x,billingMode:h,currentLimitPeriod:g}),e[21]=h,e[22]=r,e[23]=n,e[24]=g,e[25]=x,e[26]=_):_=e[26];let k;return e[27]!==j||e[28]!==C||e[29]!==_?(k=s.jsxs(s.Fragment,{children:[j,C,_]}),e[27]=j,e[28]=C,e[29]=_,e[30]=k):k=e[30],k}function $l(t){return t.structuredContent}function Ml(t){const e=I.c(20),{gatewayConnectionId:r}=t,[a,n]=v.useState("summary");let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),e[0]=l):l=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs($s,{variant:"underline",children:[s.jsx(We,{value:"summary",variant:"underline",children:"Summary"}),s.jsx(We,{value:"breakdown",variant:"underline",children:"Breakdown"}),s.jsx(We,{value:"history",variant:"underline",children:"History"})]}),e[1]=i):i=e[1];let o;e[2]!==r?(o=r&&s.jsx(zl,{connectionId:r}),e[2]=r,e[3]=o):o=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(vl,{}),e[4]=d):d=e[4];let m;e[5]!==o?(m=s.jsxs(Fe,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[o,d]}),e[5]=o,e[6]=m):m=e[6];let c;e[7]!==a?(c=a==="breakdown"&&s.jsx(kl,{}),e[7]=a,e[8]=c):c=e[8];let u;e[9]!==c?(u=s.jsx(Fe,{value:"breakdown",className:"pt-2",children:c}),e[9]=c,e[10]=u):u=e[10];let f;e[11]!==a?(f=a==="history"&&s.jsx(Dl,{}),e[11]=a,e[12]=f):f=e[12];let x;e[13]!==f?(x=s.jsx(Fe,{value:"history",className:"pt-2",children:f}),e[13]=f,e[14]=x):x=e[14];let p;return e[15]!==a||e[16]!==m||e[17]!==u||e[18]!==x?(p=s.jsxs(s.Fragment,{children:[l,s.jsxs(Ms,{value:a,onValueChange:n,variant:"underline",children:[i,m,u,x]})]}),e[15]=a,e[16]=m,e[17]=u,e[18]=x,e[19]=p):p=e[19],p}function Bl(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx(ne,{className:"h-5 w-32"}),s.jsx(ne,{className:"h-4 w-64 mt-1.5"})]}),s.jsx(ne,{className:"h-28 rounded-xl"}),s.jsx(ne,{className:"h-[260px] rounded-lg"})]}),t[0]=e):e=t[0],e}function Gl(){const t=I.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),t[0]=e):e=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex items-center justify-center size-10 rounded-full bg-muted",children:s.jsx(rt,{size:20,className:"text-muted-foreground"})}),t[1]=r):r=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex flex-col gap-6",children:[e,s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 rounded-lg border border-dashed border-border",children:[r,s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-[300px]",children:"Unable to load billing data. Please try again later."})]})]})]}),t[2]=a):a=t[2],a}class Rl extends v.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){}render(){return this.state.hasError?s.jsx(Gl,{}):this.props.children}}function Wl(){const t=I.c(4),e=Fa();let r;t[0]!==e?(r=e.find(Fl),t[0]=e,t[1]=r):r=t[1];const n=r?.id??null;let l;return t[2]!==n?(l=s.jsx(Ml,{gatewayConnectionId:n}),t[2]=n,t[3]=l):l=t[3],l}function Fl(t){return Va(t,Ka)}function Ul(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-col gap-6",children:s.jsx(Rl,{children:s.jsx(v.Suspense,{fallback:s.jsx(Bl,{}),children:s.jsx(Wl,{})})})}),t[0]=e):e=t[0],e}function ms(){const t=I.c(3);let e,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ne,{className:"h-6 w-48"}),r=s.jsx(ne,{className:"h-4 w-80"}),t[0]=e,t[1]=r):(e=t[0],r=t[1]);let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[e,r,s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsx(ne,{className:"h-12 w-full"}),s.jsx(ne,{className:"h-12 w-full"})]})]}),t[2]=a):a=t[2],a}function Vl(t){const e=I.c(14),{projectSlug:r,children:a}=t,{org:n}=me(),{data:l,isLoading:i}=Et(n.id,r);if(i||!l){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ms,{}),e[0]=u):u=e[0],u}const o=r===Ee;let d;e[1]!==l.description||e[2]!==l.enabledPlugins||e[3]!==l.id||e[4]!==l.name||e[5]!==l.organizationId||e[6]!==l.slug||e[7]!==l.ui||e[8]!==o?(d={id:l.id,organizationId:l.organizationId,slug:l.slug,name:l.name,description:l.description,enabledPlugins:l.enabledPlugins,ui:l.ui,isOrgAdmin:o},e[1]=l.description,e[2]=l.enabledPlugins,e[3]=l.id,e[4]=l.name,e[5]=l.organizationId,e[6]=l.slug,e[7]=l.ui,e[8]=o,e[9]=d):d=e[9];const m=d;let c;return e[10]!==a||e[11]!==m||e[12]!==n?(c=s.jsx(It,{org:n,project:m,children:a}),e[10]=a,e[11]=m,e[12]=n,e[13]=c):c=e[13],c}function Kl(t){const e=I.c(7),{section:r}=t;switch(r){case"account.profile":{let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Ha,{}),e[0]=a):a=e[0],a}case"account.preferences":{let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(yt,{}),e[1]=a):a=e[1],a}case"account.experimental":{let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(er,{}),e[2]=a):a=e[2],a}case"org.general":{let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(rr,{}),e[3]=a):a=e[3],a}case"org.plugins":{let a;return e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Vl,{projectSlug:Ee,children:s.jsx(Fs,{})}),e[4]=a):a=e[4],a}case"org.billing":{let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Ul,{}),e[5]=a):a=e[5],a}default:{let a;return e[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(yt,{}),e[6]=a):a=e[6],a}}}function Yl(){const t=I.c(23),{isOpen:e,activeSection:r,open:a,close:n}=Ss();let l;t[0]!==n?(l=g=>!g&&n(),t[0]=n,t[1]=l):l=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=i):i=t[2];let o;t[3]!==r||t[4]!==a?(o=s.jsx(v.Suspense,{fallback:i,children:s.jsx(Ya,{activeSection:r,onNavigate:a})}),t[3]=r,t[4]=a,t[5]=o):o=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Dt,{size:16}),m=s.jsx("span",{className:"sr-only",children:"Close"}),t[6]=d,t[7]=m):(d=t[6],m=t[7]);let c;t[8]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:"sticky top-4 float-right mr-4 mt-4 z-10 rounded-md p-1 opacity-70 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-ring",children:[d,m]}),t[8]=n,t[9]=c):c=t[9];let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ms,{}),t[10]=u):u=t[10];let f;t[11]!==r?(f=s.jsx("div",{className:"p-8",children:s.jsx(v.Suspense,{fallback:u,children:s.jsx(Kl,{section:r})})}),t[11]=r,t[12]=f):f=t[12];let x;t[13]!==c||t[14]!==f?(x=s.jsxs("div",{className:"flex-1 overflow-y-auto min-w-0 relative",children:[c,f]}),t[13]=c,t[14]=f,t[15]=x):x=t[15];let p;t[16]!==o||t[17]!==x?(p=s.jsx(Ot,{className:"sm:max-w-[1100px] h-[85vh] p-0 overflow-hidden flex flex-col gap-0",closeButtonClassName:"hidden",children:s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o,x]})}),t[16]=o,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==l||t[21]!==p?(h=s.jsx(Lt,{open:e,onOpenChange:l,children:p}),t[19]=e,t[20]=l,t[21]=p,t[22]=h):h=t[22],h}function Hl(t){const e=I.c(12),{projectSlug:r,orgSlug:a,error:n}=t,l=at();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=i):i=e[0];let o;e[1]!==r?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',r,'".']}),e[1]=r,e[2]=o):o=e[2];let d;e[3]!==n.message?(d=s.jsx("p",{className:"text-sm text-muted-foreground",children:n.message}),e[3]=n.message,e[4]=d):d=e[4];let m;e[5]!==l||e[6]!==a?(m=s.jsx(ce,{variant:"link",onClick:()=>l({to:"/$org/$project",params:{org:a,project:Ee}}),children:"Go to organization home"}),e[5]=l,e[6]=a,e[7]=m):m=e[7];let c;return e[8]!==o||e[9]!==d||e[10]!==m?(c=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[i,o,d,m]}),e[8]=o,e[9]=d,e[10]=m,e[11]=c):c=e[11],c}function ql(t){const e=I.c(9),{projectSlug:r,orgSlug:a}=t,n=at();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h1",{className:"text-xl font-semibold",children:"Project not found"}),e[0]=l):l=e[0];let i;e[1]!==r?(i=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',r,'" does not exist in this organization.']}),e[1]=r,e[2]=i):i=e[2];let o;e[3]!==n||e[4]!==a?(o=s.jsx(ce,{variant:"link",onClick:()=>n({to:"/$org/$project",params:{org:a,project:Ee}}),children:"Go to organization home"}),e[3]=n,e[4]=a,e[5]=o):o=e[5];let d;return e[6]!==i||e[7]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[l,i,o]}),e[6]=i,e[7]=o,e[8]=d):d=e[8],d}function Ql(){const t=I.c(23);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const r=gs(e),{org:a}=me(),n=r.org,l=r.project,{data:i,isLoading:o,error:d}=Et(a.id,l);if(o){let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ze,{}),t[1]=h):h=t[1],h}if(d){let h;return t[2]!==d||t[3]!==n||t[4]!==l?(h=s.jsx(Hl,{projectSlug:l,orgSlug:n,error:d}),t[2]=d,t[3]=n,t[4]=l,t[5]=h):h=t[5],h}if(!i){let h;return t[6]!==n||t[7]!==l?(h=s.jsx(ql,{projectSlug:l,orgSlug:n}),t[6]=n,t[7]=l,t[8]=h):h=t[8],h}const m=i.slug===Ee;let c;t[9]!==i.description||t[10]!==i.enabledPlugins||t[11]!==i.id||t[12]!==i.name||t[13]!==i.organizationId||t[14]!==i.slug||t[15]!==i.ui||t[16]!==m?(c={id:i.id,organizationId:i.organizationId,slug:i.slug,name:i.name,description:i.description,enabledPlugins:i.enabledPlugins,ui:i.ui,isOrgAdmin:m},t[9]=i.description,t[10]=i.enabledPlugins,t[11]=i.id,t[12]=i.name,t[13]=i.organizationId,t[14]=i.slug,t[15]=i.ui,t[16]=m,t[17]=c):c=t[17];const u=c;let f,x;t[18]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(v.Suspense,{fallback:s.jsx(Ze,{}),children:s.jsx(vs,{})}),x=s.jsx(Yl,{}),t[18]=f,t[19]=x):(f=t[18],x=t[19]);let p;return t[20]!==u||t[21]!==a?(p=s.jsxs(It,{org:a,project:u,children:[f,x]}),t[20]=u,t[21]=a,t[22]=p):p=t[22],p}function Kn(){const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(v.Suspense,{fallback:s.jsx(Ze,{}),children:s.jsx(Ql,{})}),t[0]=e):e=t[0],e}export{Kn as default};