@decocms/mesh 2.135.1 → 2.136.1

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 (228) hide show
  1. package/dist/client/assets/{AlertCircle-C0eftc-S.js → AlertCircle-CXJCnY_R.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-y_Ps49tB.js → AlignLeft-Ckpqqq7X.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-BVK-2NZv.js → ArrowDown-BXCgJapO.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-BNX_fMaj.js → ArrowLeft-ihbjidrQ.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-N8lcMBug.js → ArrowUp-B3tPpNuu.js} +1 -1
  6. package/dist/client/assets/{Check-Cjs4C9GE.js → Check-G22LpKFd.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-KfoOm4QY.js → CheckCircle-Dl3Eh5mw.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-BesDn4jt.js → CheckDone01-DQOA8kaK.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-dNCcvCnV.js → CheckVerified02-C58oaMz8.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-jKZz68gN.js → ChevronDown-DAk1F2Sn.js} +1 -1
  11. package/dist/client/assets/{ChevronLeft-DrJ63fdN.js → ChevronLeft-CGPjZdmg.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-O5hZNhHU.js → ChevronRight-BT7U8Kip.js} +1 -1
  13. package/dist/client/assets/{Clock-CZrEpwOM.js → Clock-CPO-Cqx6.js} +1 -1
  14. package/dist/client/assets/{Code01-DVgdcTZ1.js → Code01-UXkm6aqY.js} +1 -1
  15. package/dist/client/assets/{Container-BADgIox6.js → Container-CyEPuAYL.js} +1 -1
  16. package/dist/client/assets/{Copy01-CwZDv92A.js → Copy01-tzx60ICS.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-BD9MOeSH.js → Dataflow03-mD5gBD1P.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-M2BFmBhE.js → DotsHorizontal-9qiIYu_T.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-B7FmF1Xu.js → DotsVertical-DHxrk-2J.js} +1 -1
  20. package/dist/client/assets/{Download01-9ocXQLzr.js → Download01-DM18IWVp.js} +1 -1
  21. package/dist/client/assets/{Edit01-kvm_TgXf.js → Edit01-D3PaS600.js} +1 -1
  22. package/dist/client/assets/{Edit05-D4Vt7tOt.js → Edit05-B64h7zay.js} +1 -1
  23. package/dist/client/assets/{Eye-BCmEvczH.js → Eye-C_LYW9jG.js} +1 -1
  24. package/dist/client/assets/{File02-CK_RNTh6.js → File02-CY9LI3Y-.js} +1 -1
  25. package/dist/client/assets/{File06-B3E-bjor.js → File06-Dy7xo8XS.js} +1 -1
  26. package/dist/client/assets/{FilterLines-DAyCv-Xk.js → FilterLines-BvkJQ7ij.js} +1 -1
  27. package/dist/client/assets/{Globe01-jKd57I4x.js → Globe01-39jWI59e.js} +1 -1
  28. package/dist/client/assets/{Globe02-D-yCMf5N.js → Globe02-X-Xm1ngz.js} +1 -1
  29. package/dist/client/assets/{Grid01-DRBx9FRw.js → Grid01-DTf5JuyC.js} +1 -1
  30. package/dist/client/assets/{Hash02-CyfLltcT.js → Hash02-AH6eTaow.js} +1 -1
  31. package/dist/client/assets/{Home02-BcZSV_S0.js → Home02-DzIcdgJH.js} +1 -1
  32. package/dist/client/assets/{Image01-Dg_KnZBd.js → Image01-Dvb2vnmH.js} +1 -1
  33. package/dist/client/assets/{Inbox01-nkL2-2Zq.js → Inbox01-CsvPcK33.js} +1 -1
  34. package/dist/client/assets/{InfoCircle-Ipgqrfv0.js → InfoCircle-D2mDfen0.js} +1 -1
  35. package/dist/client/assets/{Key01-CyP1-GBg.js → Key01-C3Fh3hes.js} +1 -1
  36. package/dist/client/assets/{LayersTwo01-rKs-Uww3.js → LayersTwo01-CRgWs3EX.js} +1 -1
  37. package/dist/client/assets/{LayoutLeft-BH3urRkN.js → LayoutLeft-C-0_xlw0.js} +1 -1
  38. package/dist/client/assets/{Link01-D-1AbdDy.js → Link01-C74Jreax.js} +1 -1
  39. package/dist/client/assets/{LinkExternal01-DIMSPk19.js → LinkExternal01-D6xwQf32.js} +1 -1
  40. package/dist/client/assets/{List-BzhQuBp2.js → List-DJEz6yKj.js} +1 -1
  41. package/dist/client/assets/{Loading01-BSgMOGt8.js → Loading01-B3gOoSbd.js} +1 -1
  42. package/dist/client/assets/{Lock01-T7BR0zuk.js → Lock01-CodP_ius.js} +1 -1
  43. package/dist/client/assets/{Play-CBKoaI1n.js → Play-CxAaQi_l.js} +1 -1
  44. package/dist/client/assets/{Plus-kcfCg7FH.js → Plus-Bo0L9uYY.js} +1 -1
  45. package/dist/client/assets/{RefreshCcw01-DiAOUquJ.js → RefreshCcw01-v6pXwg6P.js} +1 -1
  46. package/dist/client/assets/{Save01-CgyWcG00.js → Save01-CU3VjXKO.js} +1 -1
  47. package/dist/client/assets/{SearchMd-DyDznS8C.js → SearchMd-Cpf31N-H.js} +1 -1
  48. package/dist/client/assets/{Settings01-B90Jx8ZC.js → Settings01-BmEB9pVn.js} +1 -1
  49. package/dist/client/assets/{Shield01-B2Y9HIu6.js → Shield01-CqrrEAw-.js} +1 -1
  50. package/dist/client/assets/{Terminal-BxQK5nsd.js → Terminal-BS-6VR5p.js} +1 -1
  51. package/dist/client/assets/{Trash01-Dhrt1Goe.js → Trash01-HuK-pEft.js} +1 -1
  52. package/dist/client/assets/{Upload01-Dja0ZgIT.js → Upload01-DcyyJb_e.js} +1 -1
  53. package/dist/client/assets/{Users03-DHATZiFL.js → Users03-CPWgVi4r.js} +1 -1
  54. package/dist/client/assets/{X-BpJJDPzv.js → X-uHaUni9w.js} +1 -1
  55. package/dist/client/assets/{XCircle-D52fnGO6.js → XCircle-C4iqiznn.js} +1 -1
  56. package/dist/client/assets/{XClose-DcdK3w1e.js → XClose-DGYV-4S5.js} +1 -1
  57. package/dist/client/assets/{Zap-CP5UH1Dw.js → Zap-5c_DBEtK.js} +1 -1
  58. package/dist/client/assets/{agent-connections-preview-v4ndb6aJ.js → agent-connections-preview-BsjSZYGn.js} +1 -1
  59. package/dist/client/assets/agent-detail-BxRuQLTH.js +2 -0
  60. package/dist/client/assets/agents-KBFzt520.js +1 -0
  61. package/dist/client/assets/{alert-dialog-PSmHhGOE.js → alert-dialog-D3oCqQtu.js} +2 -2
  62. package/dist/client/assets/{auth-catchall-CplMsxXE.js → auth-catchall-bz6gJ41s.js} +1 -1
  63. package/dist/client/assets/{avatar-VPsqzp0K.js → avatar-rYlL0ZoJ.js} +1 -1
  64. package/dist/client/assets/{badge-DSAomO1_.js → badge-CxJArm69.js} +1 -1
  65. package/dist/client/assets/{binder-8_Oel13A.js → binder-BXDCztlr.js} +1 -1
  66. package/dist/client/assets/{breadcrumb-Dxn3nF83.js → breadcrumb-CGrLS5HH.js} +1 -1
  67. package/dist/client/assets/{card-CRGkE-QK.js → card-CAORA3L1.js} +1 -1
  68. package/dist/client/assets/{chart-B-ayLZ8-.js → chart-DX1_yJHY.js} +1 -1
  69. package/dist/client/assets/{checkbox-Dj6Qb3KC.js → checkbox-BCSzUsPR.js} +1 -1
  70. package/dist/client/assets/{circle-alert-DcuI5GGM.js → circle-alert-B4C3d1aQ.js} +1 -1
  71. package/dist/client/assets/{collapsible-D2Mpu85K.js → collapsible-sQONDG4w.js} +1 -1
  72. package/dist/client/assets/{collection-detail-FNWcZVfu.js → collection-detail-B42SRwNb.js} +3 -3
  73. package/dist/client/assets/collection-display-button-M7dfC2Rf.js +1 -0
  74. package/dist/client/assets/{collection-search-FSS_Lkwz.js → collection-search-q4T1hb73.js} +1 -1
  75. package/dist/client/assets/collection-tab-e-VwhAzh.js +1 -0
  76. package/dist/client/assets/collection-table-wrapper-DXH0yXJC.js +1 -0
  77. package/dist/client/assets/{collection-tabs-CK4hfCPZ.js → collection-tabs-BbVq4J-5.js} +1 -1
  78. package/dist/client/assets/{command-BK3ZFocj.js → command-CPQN970u.js} +1 -1
  79. package/dist/client/assets/{connect-D2cFEIR8.js → connect-BGH3KdkD.js} +1 -1
  80. package/dist/client/assets/{connection-card-GLkE1rwd.js → connection-card-DTiOZbAC.js} +1 -1
  81. package/dist/client/assets/connection-detail-DznxU3SC.js +1 -0
  82. package/dist/client/assets/connections-AQfSUAp3.js +1 -0
  83. package/dist/client/assets/{constants-3MhIA0pZ.js → constants-D9bRXDQp.js} +1 -1
  84. package/dist/client/assets/constants-DvJZMaim.js +1 -0
  85. package/dist/client/assets/{create-organization-dialog-CR8t2T4R.js → create-organization-dialog-Bs4zbKG7.js} +1 -1
  86. package/dist/client/assets/{create-project-dialog-DFaC5_HT.js → create-project-dialog-BkL7vqeo.js} +1 -1
  87. package/dist/client/assets/{danger-BEh_Y1ce.js → danger-C_vn0auF.js} +1 -1
  88. package/dist/client/assets/{danger-zone-CpwKIZ0p.js → danger-zone-CdUOoCFt.js} +1 -1
  89. package/dist/client/assets/{decopilot-events-CA9aFPSQ.js → decopilot-events-DHSwekTa.js} +1 -1
  90. package/dist/client/assets/dependencies-DTmw6OGT.js +1 -0
  91. package/dist/client/assets/{dialog-CPWJMuHX.js → dialog-Baq_fjtR.js} +1 -1
  92. package/dist/client/assets/{dropdown-menu-DW1GDWfN.js → dropdown-menu-CSqO4Mxn.js} +1 -1
  93. package/dist/client/assets/dynamic-plugin-layout-d0KDA7MF.js +1 -0
  94. package/dist/client/assets/{editable-task-title-D4gyoQ4x.js → editable-task-title-HUenZvZX.js} +1 -1
  95. package/dist/client/assets/{empty-state-boxcABsi.js → empty-state-BPClkF2j.js} +1 -1
  96. package/dist/client/assets/{env-vars-editor-x5YLFI-P.js → env-vars-editor-DDp7f4JN.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-D40JrSD8.js → extract-connection-data-BkJeK0tX.js} +1 -1
  98. package/dist/client/assets/{file-browser-CrcClgQC.js → file-browser-DVzV35Ko.js} +2 -2
  99. package/dist/client/assets/{form-7Q-FsNtX.js → form-C5R0_qWR.js} +1 -1
  100. package/dist/client/assets/{general-C0buekt8.js → general-mBNwCpsS.js} +1 -1
  101. package/dist/client/assets/{grid-view-J96VhXfb.js → grid-view-7eQhfO8f.js} +1 -1
  102. package/dist/client/assets/{home-H46nCwT5.js → home-okrTp5Gh.js} +1 -1
  103. package/dist/client/assets/{icon-picker-DPVWLIZ3.js → icon-picker-DevrZ9IQ.js} +1 -1
  104. package/dist/client/assets/{index-CsXxowFD.js → index-B-STjJpH.js} +1 -1
  105. package/dist/client/assets/{index-ZgdunwGI.js → index-BK6i23a9.js} +1 -1
  106. package/dist/client/assets/{index-D7M37zt-.js → index-BWSvBz7o.js} +1 -1
  107. package/dist/client/assets/{index-3zbyfLqi.js → index-B_0vsVr1.js} +3 -3
  108. package/dist/client/assets/{index-DqzqEzLf.js → index-ByA6j7_H.js} +1 -1
  109. package/dist/client/assets/{index-DziKeC8s.js → index-CvEIDmnk.js} +1 -1
  110. package/dist/client/assets/index-D6E08wfB.css +1 -0
  111. package/dist/client/assets/index-DYY56DJY.js +1 -0
  112. package/dist/client/assets/{index-DZgOYNf-.js → index-QCmdl8uj.js} +1 -1
  113. package/dist/client/assets/{index-CW624IAb.js → index-UbeVlDrq.js} +1 -1
  114. package/dist/client/assets/{infiniteQueryObserver-DkOiuhUg.js → infiniteQueryObserver-DKiK82rX.js} +1 -1
  115. package/dist/client/assets/{input-DVv1wKLp.js → input-CW7SVowR.js} +1 -1
  116. package/dist/client/assets/{integration-icon-_0Y5dukY.js → integration-icon-DAFtApWT.js} +1 -1
  117. package/dist/client/assets/{label-CfzCa7Vm.js → label-DWU1nKSS.js} +1 -1
  118. package/dist/client/assets/{layout-DemCWqB_.js → layout-CzVwolFw.js} +1 -1
  119. package/dist/client/assets/{layout-CFi42XXk.js → layout-DEcRD72T.js} +1 -1
  120. package/dist/client/assets/{localstorage-keys-D2dx16dH.js → localstorage-keys-BAzeyS9J.js} +1 -1
  121. package/dist/client/assets/{login-BXUbt1kV.js → login-OPfY3bsF.js} +1 -1
  122. package/dist/client/assets/{markdown-89WWPNXO.js → markdown-DCSB9ejV.js} +1 -1
  123. package/dist/client/assets/{mcp-app-renderer-MJ3LmhBP.js → mcp-app-renderer-BtuEhdWL.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-CPAKRpWT.js → mcp-oauth-D8pA0WRM.js} +1 -1
  125. package/dist/client/assets/{mcp-server-card-gl2xF4cu.js → mcp-server-card-D7xlSyX7.js} +1 -1
  126. package/dist/client/assets/mcp-server-detail-DdKXdUu2.js +2 -0
  127. package/dist/client/assets/members-YKyOsCaT.js +3 -0
  128. package/dist/client/assets/{monaco-editor-Qwuf1rYM.js → monaco-editor-zyWgiZEt.js} +1 -1
  129. package/dist/client/assets/{monitoring-C-vcUHdF.js → monitoring-SM_c8qxT.js} +2 -2
  130. package/dist/client/assets/monitoring-dashboard-edit-cexdjvMw.js +1 -0
  131. package/dist/client/assets/{monitoring-dashboard-view-D7MwbzDH.js → monitoring-dashboard-view-C3qQNwfm.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-BnBZDVD6.js → oauth-callback-1SC3hH5y.js} +1 -1
  133. package/dist/client/assets/page-DfTTOYQt.js +1 -0
  134. package/dist/client/assets/page-hoODnFtN.js +1 -0
  135. package/dist/client/assets/{plugin-empty-state-DfdPh9Ts.js → plugin-empty-state-Cl_h_OgT.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-BuLjcm9B.js → plugin-empty-state-Doboc7Tq.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CKLaOHoT.js → plugin-header-C4Dfehzm.js} +1 -1
  138. package/dist/client/assets/{plugin-header-Bi-8qclQ.js → plugin-header-DNeaPoeS.js} +1 -1
  139. package/dist/client/assets/plugins-H9eiCXso.js +1 -0
  140. package/dist/client/assets/popover-BNZ96bFv.js +1 -0
  141. package/dist/client/assets/project-app-view-Bsbq4Qf_.js +1 -0
  142. package/dist/client/assets/project-layout-B4cnkESa.js +1 -0
  143. package/dist/client/assets/{project-plugins-B1sb2cJf.js → project-plugins-CqDaIw1P.js} +1 -1
  144. package/dist/client/assets/{projects-list-D0DH8k1c.js → projects-list-CgsVuZof.js} +1 -1
  145. package/dist/client/assets/{readme-viewer-BvJA0DXw.js → readme-viewer-CKidIXa3.js} +1 -1
  146. package/dist/client/assets/{registry-layout-BJCo3ZwE.js → registry-layout-oUh5Zl7W.js} +2 -2
  147. package/dist/client/assets/{registry-utils-Cx5oa6Ne.js → registry-utils-DXJps8H7.js} +1 -1
  148. package/dist/client/assets/{reports-layout-DYTNa8h-.js → reports-layout-CFJRqv-Q.js} +2 -2
  149. package/dist/client/assets/{reset-password-DFzqJN6I.js → reset-password-ZQI9gTW6.js} +1 -1
  150. package/dist/client/assets/{resizable-PA9Y3YAt.js → resizable-CWRglWOX.js} +1 -1
  151. package/dist/client/assets/{save-actions-CXaB5WYr.js → save-actions-eGQZXGI3.js} +1 -1
  152. package/dist/client/assets/{scroll-area-DoXCMB9j.js → scroll-area-By1z4ZyY.js} +1 -1
  153. package/dist/client/assets/{select-DaTaxi5W.js → select-CYY4CENz.js} +1 -1
  154. package/dist/client/assets/shell-layout-DMKfJTmj.js +3 -0
  155. package/dist/client/assets/{sidebar-settings-BZwWXZuX.js → sidebar-settings-ILgspCqY.js} +1 -1
  156. package/dist/client/assets/{skeleton-C9OYLAME.js → skeleton-C4ZMp7sl.js} +1 -1
  157. package/dist/client/assets/{spinner-RGw-eBKN.js → spinner-oA3jiJW_.js} +1 -1
  158. package/dist/client/assets/{store-invite-Fvga4enp.js → store-invite-Bfy0Alsf.js} +1 -1
  159. package/dist/client/assets/{switch-CKTW0M5S.js → switch-BSc4dVNg.js} +1 -1
  160. package/dist/client/assets/{table-Dr33PlEJ.js → table-RFgqEt_E.js} +1 -1
  161. package/dist/client/assets/{tabs-t9dEapgX.js → tabs-BZ-xfLNG.js} +1 -1
  162. package/dist/client/assets/tasks-Cy-gkHRX.js +1 -0
  163. package/dist/client/assets/{tasks-panel-DLy55FSi.js → tasks-panel-C7RwVTDD.js} +1 -1
  164. package/dist/client/assets/{textarea-CNTbi5Nk.js → textarea-4HpXofT0.js} +1 -1
  165. package/dist/client/assets/{time-range-picker-Do8ix4-A.js → time-range-picker-Cx2A-Fs_.js} +1 -1
  166. package/dist/client/assets/{toggle-group-Ck1YCESf.js → toggle-group-CVFHcp8K.js} +1 -1
  167. package/dist/client/assets/tools-list-BYphEqhu.js +1 -0
  168. package/dist/client/assets/{tooltip-CzsT_Xmu.js → tooltip-Cz-bAWiO.js} +1 -1
  169. package/dist/client/assets/{topbar-portal-pZDSuDEC.js → topbar-portal-DOwsTUY4.js} +1 -1
  170. package/dist/client/assets/{types-BFBQ7LBo.js → types-B46wd5bS.js} +1 -1
  171. package/dist/client/assets/{use-binding-Cz4OU82g.js → use-binding-Dz1SRdBY.js} +1 -1
  172. package/dist/client/assets/use-collections-vccihohV.js +1 -0
  173. package/dist/client/assets/use-connection-DeEn4qfI.js +1 -0
  174. package/dist/client/assets/{use-copy-C0vtJ5Ye.js → use-copy-CykDvxn6.js} +1 -1
  175. package/dist/client/assets/{use-create-virtual-mcp-CsNENE7l.js → use-create-virtual-mcp-DB14T-Ft.js} +1 -1
  176. package/dist/client/assets/use-install-from-registry-BeHRHLDl.js +1 -0
  177. package/dist/client/assets/{use-list-state-DUq5hUJc.js → use-list-state-ykkfYLR3.js} +1 -1
  178. package/dist/client/assets/use-llm-B_iPCa-K.js +1 -0
  179. package/dist/client/assets/{use-mcp-resources-DjDOJ-nS.js → use-mcp-resources-Rqzq7A0J.js} +1 -1
  180. package/dist/client/assets/{use-mcp-tools-WZlm0cnW.js → use-mcp-tools-BXihKxpu.js} +1 -1
  181. package/dist/client/assets/{use-members-BLjJfltI.js → use-members-DAcqcxDX.js} +1 -1
  182. package/dist/client/assets/{use-mobile-CzcHKmhL.js → use-mobile-B2VAoWT2.js} +1 -1
  183. package/dist/client/assets/{use-project-CIyZUlkd.js → use-project-D96OXk4y.js} +1 -1
  184. package/dist/client/assets/{use-settings-modal-BU5fs4m_.js → use-settings-modal-CouKpdi3.js} +1 -1
  185. package/dist/client/assets/{use-view-mode-BadETRuZ.js → use-view-mode-DyK0fMBe.js} +1 -1
  186. package/dist/client/assets/use-virtual-mcp-OwU65kyR.js +1 -0
  187. package/dist/client/assets/useInfiniteQuery-Cl9EtkM0.js +1 -0
  188. package/dist/client/assets/{useMutation-CqJLXgOK.js → useMutation-lBFQDcxE.js} +1 -1
  189. package/dist/client/assets/useQuery-DcRkCB2j.js +1 -0
  190. package/dist/client/assets/useSuspenseInfiniteQuery-DdSDu-rZ.js +1 -0
  191. package/dist/client/assets/{user-vKqDbtP6.js → user-C73vNaiS.js} +1 -1
  192. package/dist/client/assets/workflow-S9BhswBs.js +1 -0
  193. package/dist/client/index.html +2 -2
  194. package/dist/server/cli.js +1 -1
  195. package/dist/server/migrate.js +1 -1
  196. package/dist/server/server.js +1 -1
  197. package/package.json +1 -1
  198. package/dist/client/assets/agent-detail-DyOlL9jH.js +0 -2
  199. package/dist/client/assets/agents-CB6IRof4.js +0 -1
  200. package/dist/client/assets/collection-tab-FKeWJS1r.js +0 -1
  201. package/dist/client/assets/collection-table-wrapper-C3jcR2VW.js +0 -1
  202. package/dist/client/assets/connection-detail-PegJ7rZR.js +0 -1
  203. package/dist/client/assets/connections-C18lG_Ow.js +0 -1
  204. package/dist/client/assets/constants-Csevqii0.js +0 -1
  205. package/dist/client/assets/dependencies-mwSdsJgD.js +0 -1
  206. package/dist/client/assets/dynamic-plugin-layout-CY4G5d8i.js +0 -1
  207. package/dist/client/assets/index-Cr3FYIgR.css +0 -1
  208. package/dist/client/assets/index-DFlYm7QG.js +0 -1
  209. package/dist/client/assets/mcp-server-detail-CzmUyYsJ.js +0 -2
  210. package/dist/client/assets/members-BjMeazP1.js +0 -3
  211. package/dist/client/assets/monitoring-dashboard-edit-DdMgOlQK.js +0 -1
  212. package/dist/client/assets/page-BNQcXJwH.js +0 -1
  213. package/dist/client/assets/page-DvC0ZQe5.js +0 -1
  214. package/dist/client/assets/plugins-cGh_gky2.js +0 -1
  215. package/dist/client/assets/popover-7xIJyxqf.js +0 -1
  216. package/dist/client/assets/project-app-view-C_PL72tZ.js +0 -1
  217. package/dist/client/assets/project-layout-DIwsntjO.js +0 -1
  218. package/dist/client/assets/shell-layout-BqF7J7La.js +0 -3
  219. package/dist/client/assets/tasks-OJAbxkK1.js +0 -1
  220. package/dist/client/assets/tools-list-DLfR0anP.js +0 -1
  221. package/dist/client/assets/use-connection-Dlr-wAwU.js +0 -1
  222. package/dist/client/assets/use-install-from-registry-C_roXw8y.js +0 -1
  223. package/dist/client/assets/use-llm-B6AzV9Iw.js +0 -1
  224. package/dist/client/assets/use-virtual-mcp-BjGr5L6n.js +0 -1
  225. package/dist/client/assets/useInfiniteQuery-CGGEgi5q.js +0 -1
  226. package/dist/client/assets/useQuery-DWLTdDjg.js +0 -1
  227. package/dist/client/assets/useSuspenseInfiniteQuery-YGfVGowO.js +0 -1
  228. package/dist/client/assets/workflow--wyybZpA.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as D,c as oe,v as H,j as s,p as Yt,B as ie,u as je,d as me,K as ue,o as Et,aF as Xe,s as Ce,bI as vt,bO as yt,n as Me,l as kt,k as Wt,t as le,m as Xt,E as es}from"./index-3zbyfLqi.js";import{C as ts,a as ss}from"./collection-table-wrapper-C3jcR2VW.js";import{C as De,E as ct}from"./collection-search-FSS_Lkwz.js";import{P as ve}from"./index-DZgOYNf-.js";import{B as ns,a as os,b as rs,c as is}from"./breadcrumb-Dxn3nF83.js";import{I as zt}from"./integration-icon-_0Y5dukY.js";import{C as ze}from"./checkbox-Dj6Qb3KC.js";import{i as ls}from"./ArrowLeft-BNX_fMaj.js";import{h as Ut}from"./use-connection-Dlr-wAwU.js";import{u as bt}from"./use-members-BLjJfltI.js";import{u as it}from"./useQuery-DWLTdDjg.js";import{u as Ee}from"./useMutation-CqJLXgOK.js";import{u as as,a as cs}from"./use-llm-B6AzV9Iw.js";import{A as Pe}from"./avatar-VPsqzp0K.js";import{B as ye}from"./badge-DSAomO1_.js";import{f as Ue,a as Ve,b as Ge,c as Be,d as $e,e as Fe,A as Ke,h as Qe}from"./alert-dialog-PSmHhGOE.js";import{D as Vt,f as Gt,a as Bt,b as ds,c as ms,e as us}from"./dialog-CPWJMuHX.js";import{D as Ct,a as jt,b as Tt,c as nt,d as fs,e as hs,f as gs,g as xs}from"./dropdown-menu-DW1GDWfN.js";import{i as ps}from"./DotsHorizontal-M2BFmBhE.js";import{i as He}from"./Loading01-BSgMOGt8.js";import{i as bs}from"./Lock01-T7BR0zuk.js";import{s as ot}from"./Plus-kcfCg7FH.js";import{s as $t}from"./Trash01-Dhrt1Goe.js";import{i as St}from"./X-BpJJDPzv.js";import{I as Cs}from"./input-DVv1wKLp.js";import{S as Ne}from"./switch-CKTW0M5S.js";import{c as Se,T as Oe,a as Ie,b as Ae}from"./tooltip-CzsT_Xmu.js";import{a as js,F as Ot,b as It,c as Ts,d as At,f as _t}from"./form-7Q-FsNtX.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-DaTaxi5W.js";import{T as Ns}from"./textarea-CNTbi5Nk.js";import{a as qe,u as Je}from"./constants-3MhIA0pZ.js";import{C as wt}from"./card-CRGkE-QK.js";import{i as Ft}from"./DotsVertical-B7FmF1Xu.js";import{i as Es}from"./Key01-CyP1-GBg.js";import{i as Kt}from"./Shield01-B2Y9HIu6.js";import{s as Qt}from"./XClose-DcdK3w1e.js";import{C as dt,e as mt,f as Rt,d as vs,a as ys,b as Ss,c as Os}from"./command-BK3ZFocj.js";import{P as Is,a as As,b as _s}from"./popover-7xIJyxqf.js";import{t as ws}from"./ChevronDown-jKZz68gN.js";import"./ArrowDown-BVK-2NZv.js";import"./ArrowUp-N8lcMBug.js";import"./Check-Cjs4C9GE.js";import"./Grid01-DRBx9FRw.js";import"./List-BzhQuBp2.js";import"./table-Dr33PlEJ.js";import"./SearchMd-DyDznS8C.js";import"./localstorage-keys-D2dx16dH.js";import"./ChevronRight-O5hZNhHU.js";import"./Container-BADgIox6.js";import"./use-binding-Cz4OU82g.js";import"./binder-8_Oel13A.js";import"./index-DziKeC8s.js";import"./label-CfzCa7Vm.js";import"./index-DqzqEzLf.js";const Ht=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Ht.displayName="SwitchHorizontal01";const qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"MONITORING_DASHBOARD_CREATE",description:"Create monitoring dashboards",category:"Monitoring"},{name:"MONITORING_DASHBOARD_GET",description:"View dashboard details",category:"Monitoring"},{name:"MONITORING_DASHBOARD_LIST",description:"List monitoring dashboards",category:"Monitoring"},{name:"MONITORING_DASHBOARD_UPDATE",description:"Update monitoring dashboards",category:"Monitoring"},{name:"MONITORING_DASHBOARD_DELETE",description:"Delete monitoring dashboards",category:"Monitoring",dangerous:!0},{name:"MONITORING_DASHBOARD_QUERY",description:"Query dashboard widget data",category:"Monitoring"},{name:"MONITORING_WIDGET_PREVIEW",description:"Preview widget aggregation",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"},{name:"PROJECT_LIST",description:"List projects in organization",category:"Projects"},{name:"PROJECT_GET",description:"View project details",category:"Projects"},{name:"PROJECT_CREATE",description:"Create new project",category:"Projects"},{name:"PROJECT_UPDATE",description:"Update project",category:"Projects"},{name:"PROJECT_DELETE",description:"Delete project",category:"Projects",dangerous:!0},{name:"PROJECT_PLUGIN_CONFIG_GET",description:"View project plugin configuration",category:"Projects"},{name:"PROJECT_PLUGIN_CONFIG_UPDATE",description:"Update project plugin configuration",category:"Projects"},{name:"PROJECT_CONNECTION_LIST",description:"List project connections",category:"Projects"},{name:"PROJECT_CONNECTION_ADD",description:"Add connection to project",category:"Projects"},{name:"PROJECT_CONNECTION_REMOVE",description:"Remove connection from project",category:"Projects"},{name:"PROJECT_PINNED_VIEWS_UPDATE",description:"Update project pinned sidebar views",category:"Projects"}],Rs={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",MONITORING_DASHBOARD_CREATE:"Create monitoring dashboards",MONITORING_DASHBOARD_GET:"View dashboard details",MONITORING_DASHBOARD_LIST:"List monitoring dashboards",MONITORING_DASHBOARD_UPDATE:"Update monitoring dashboards",MONITORING_DASHBOARD_DELETE:"Delete monitoring dashboards",MONITORING_DASHBOARD_QUERY:"Query dashboard widget data",MONITORING_WIDGET_PREVIEW:"Preview widget aggregation",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags",PROJECT_LIST:"List projects",PROJECT_GET:"View project details",PROJECT_CREATE:"Create project",PROJECT_UPDATE:"Update project",PROJECT_DELETE:"Delete project",PROJECT_PLUGIN_CONFIG_GET:"View plugin config",PROJECT_PLUGIN_CONFIG_UPDATE:"Update plugin config",PROJECT_CONNECTION_LIST:"List project connections",PROJECT_CONNECTION_ADD:"Add project connection",PROJECT_CONNECTION_REMOVE:"Remove project connection",PROJECT_PINNED_VIEWS_UPDATE:"Update pinned views"};function Ls(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[],Projects:[]};for(const e of qt)t[e.category]?.push(e);return t}function Ps(){return qt.map(t=>({value:t.name,label:Rs[t.name],dangerous:t.dangerous}))}const Ms=D.memo(function(e){const n=oe.c(21),{connection:o,isSelected:l,hasToolsEnabled:r,activeToolsCount:d,totalToolsCount:i,onSelect:f,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let b;n[0]!==m?(b=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=b):b=n[1];let a;n[2]!==o.icon||n[3]!==o.title?(a=s.jsx(zt,{icon:o.icon,name:o.title,size:"xs"}),n[2]=o.icon,n[3]=o.title,n[4]=a):a=n[4];let T;n[5]!==o.title?(T=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.title})}),n[5]=o.title,n[6]=T):T=n[6];let h;n[7]!==f||n[8]!==a||n[9]!==T?(h=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:f,children:[a,T]}),n[7]=f,n[8]=a,n[9]=T,n[10]=h):h=n[10];let E;n[11]!==d||n[12]!==o.tools||n[13]!==r||n[14]!==x||n[15]!==i?(E=o.tools&&o.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",i]}),s.jsx(ze,{checked:r,onCheckedChange:x,onClick:zs})]}),n[11]=d,n[12]=o.tools,n[13]=r,n[14]=x,n[15]=i,n[16]=E):E=n[16];let p;return n[17]!==b||n[18]!==h||n[19]!==E?(p=s.jsxs("div",{className:b,children:[h,E]}),n[17]=b,n[18]=h,n[19]=E,n[20]=p):p=n[20],p}),Ds=D.memo(function(e){const n=oe.c(18),{connectionId:o,tool:l,isSelected:r,onToggle:d}=e,i=`tool-${o}-${l.name}`,f=r?"text-foreground":"text-muted-foreground";let x;n[0]!==f?(x=H("text-sm font-medium",f),n[0]=f,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let b;n[5]!==l.description?(b=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=b):b=n[6];let a;n[7]!==m||n[8]!==b?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,b]}),n[7]=m,n[8]=b,n[9]=a):a=n[9];const T=`tool-${o}-${l.name}`;let h;n[10]!==r||n[11]!==d||n[12]!==T?(h=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ze,{id:T,checked:r,onCheckedChange:d,onClick:Us})}),n[10]=r,n[11]=d,n[12]=T,n[13]=h):h=n[13];let E;return n[14]!==i||n[15]!==a||n[16]!==h?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[a,h]}),n[14]=i,n[15]=a,n[16]=h,n[17]=E):E=n[17],E});function ks({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[o,l]=D.useState(""),r=D.useDeferredValue(o),[d,i]=D.useState("all"),[f,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),b=Ut({searchTerm:r.trim()||void 0}),a=n?b.filter(g=>g.connection_type!=="VIRTUAL"?!0:Yt(g.connection_url)!==n):b,T=m.current,h=[...T.values()].map(g=>a.find(_=>_.id===g)).filter(g=>g!==void 0),E=a.filter(g=>!T.has(g.id)),p=[...h,...E],v=g=>{const _=t[g];return _!==void 0&&_.length>0},j=p.filter(g=>{if(d==="all")return!0;const _=v(g.id);return d==="selected"?_:d==="unselected"?!_:!0}),[u,y]=D.useState(p[0]?.id??null),N=u?p.find(g=>g.id===u)??null:null,P=N?.tools??[],O=(g,_)=>t[g]?.includes(_)??!1,A=(g,_)=>{const S=t[g]??[],C=S.includes(_),M={...t};if(C){const z=S.filter(G=>G!==_);z.length===0?delete M[g]:M[g]=z}else M[g]=[...S,_];e(M)},R=g=>{const _=p.find(G=>G.id===g);if(!_?.tools)return;const S=t[g]??[],C=_.tools.map(G=>G.name),M=S.length>0&&C.every(G=>S.includes(G)),z={...t};M?delete z[g]:(z[g]=C,y(g)),e(z)},I=g=>{y(g),x(!0)},L=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[s.jsx(De,{value:o,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:j.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:o?"No connections found":d==="selected"?"No servers selected":d==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:j.map(g=>{const _=g.tools?.length??0,S=t[g.id]?.length??0;return s.jsx(Ms,{connection:g,isSelected:u===g.id,hasToolsEnabled:v(g.id),activeToolsCount:S,totalToolsCount:_,onSelect:()=>I(g.id),onToggle:()=>R(g.id)},g.id)})})})]}),s.jsx("div",{className:H("flex-1 flex-col",f?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:L,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(ls,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(g=>s.jsx(Ds,{connectionId:N.id,tool:g,isSelected:O(N.id,g.name),onToggle:()=>A(N.id,g.name)},g.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function zs(t){return t.stopPropagation()}function Us(t){return t.stopPropagation()}const Lt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Vs(t){return t.replace(/-/g," ")}function Gs(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1,modelCount:0,allowsAllModels:!1};const e=[];let n=!1;const o=[];let l=!1;const r=new Set;let d=!1,i=0,f=!1;for(const[x,m]of Object.entries(t)){if(x==="self"){m.includes("*")?n=!0:e.push(...m);continue}if(x==="models"){m.includes("*:*")?f=!0:i=m.length;continue}if(x==="*"){if(l=!0,m.includes("*"))d=!0;else for(const b of m)r.add(b);continue}if(o.push(x),m.includes("*"))d=!0;else for(const b of m)r.add(b)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:o,allowsAllConnections:l,toolNames:Array.from(r),allowsAllTools:d,modelCount:i,allowsAllModels:f}}function Nt(){const{locator:t}=je(),{data:e,isLoading:n,error:o,refetch:l}=it({queryKey:ue.organizationRoles(t),queryFn:async()=>{try{const i=await me.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),r=Lt.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const f=i.role;if(!f||Lt.some(v=>v.value===f))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:b,allowsAllConnections:a,toolNames:T,allowsAllTools:h,modelCount:E,allowsAllModels:p}=Gs(i.permission);r.push({id:i.id,role:f,label:Vs(f),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:a?-1:b.length,allowsAllConnections:a,toolCount:h?-1:T.length,allowsAllTools:h,modelCount:p?-1:E,allowsAllModels:p})}const d=r.filter(i=>!i.isBuiltin);return{roles:r,customRoles:d,builtinRoles:r.filter(i=>i.isBuiltin),isLoading:n,error:o,refetch:l}}const Bs=Et({role:Et({id:Ce().optional(),slug:Ce().optional(),label:Ce()}),allowAllStaticPermissions:yt(),staticPermissions:Xe(Ce()),toolSet:vt(Ce(),Xe(Ce())),allowAllModels:yt(),modelSet:vt(Ce(),Xe(Ce())),memberIds:Xe(Ce())});function Jt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const $s=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Fs(t){if(!t)return"bg-neutral-400";let e=0;for(let o=0;o<t.length;o++){const l=t.charCodeAt(o);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function et(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ks(t){const e=oe.c(39),{allowAllStaticPermissions:n,staticPermissions:o,onAllowAllChange:l,onPermissionsChange:r,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f);let b,a,T,h,E;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==r||e[4]!==i||e[5]!==f||e[6]!==o){const j=Ls(),u=Ps(),y=u.filter(L=>L.label.toLowerCase().includes(m.toLowerCase())),N=L=>{if(o.includes(L))r(o.filter(g=>g!==L));else{const g=[...o,L];g.length===u.length?(l(!0),r([])):r(g)}};T="flex flex-col h-full",e[12]!==f?(h=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=f,e[13]=h):h=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let O;e[14]!==P?(O=H("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=O):O=e[15];let A;e[16]!==n||e[17]!==l||e[18]!==r||e[19]!==i?(A=()=>{if(i)return;l(!n),r([])},e[16]=n,e[17]=l,e[18]=r,e[19]=i,e[20]=A):A=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=R):R=e[21];let I;e[22]!==n||e[23]!==l||e[24]!==r||e[25]!==i?(I=s.jsx("div",{onClick:Zs,children:i?s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ne,{checked:n,disabled:i,onCheckedChange:L=>{i||(l(L),r([]))}})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ne,{checked:n,disabled:i,onCheckedChange:L=>{i||(l(L),r([]))}})}),e[22]=n,e[23]=l,e[24]=r,e[25]=i,e[26]=I):I=e[26],e[27]!==I||e[28]!==O||e[29]!==A?(E=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:O,onClick:A,children:[R,I]})}),e[27]=I,e[28]=O,e[29]=A,e[30]=E):E=e[30],b="flex-1 overflow-auto",a=Object.entries(j).map(L=>{const[g,_]=L,S=y.filter(C=>_.some(M=>M.name===C.value));return S.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:g}),s.jsx("div",{className:"space-y-1",children:S.map(C=>s.jsxs("div",{className:H("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const M=u.map(Js);r(M.filter(z=>z!==C.value))}else N(C.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:C.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ne,{checked:n||o.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(Hs);r(M.filter(z=>z!==C.value))}else N(C.value)}})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ne,{checked:n||o.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(Qs);r(M.filter(z=>z!==C.value))}else N(C.value)}})})]},C.value))})]},g)}),e[0]=n,e[1]=m,e[2]=l,e[3]=r,e[4]=i,e[5]=f,e[6]=o,e[7]=b,e[8]=a,e[9]=T,e[10]=h,e[11]=E}else b=e[7],a=e[8],T=e[9],h=e[10],E=e[11];let p;e[31]!==b||e[32]!==a?(p=s.jsx("div",{className:b,children:a}),e[31]=b,e[32]=a,e[33]=p):p=e[33];let v;return e[34]!==T||e[35]!==h||e[36]!==E||e[37]!==p?(v=s.jsxs("div",{className:T,children:[h,E,p]}),e[34]=T,e[35]=h,e[36]=E,e[37]=p,e[38]=v):v=e[38],v}function Qs(t){return t.value}function Hs(t){return t.value}function qs(t){return t.stopPropagation()}function Js(t){return t.value}function Zs(t){return t.stopPropagation()}function Ys(t){const e=oe.c(45),{connection:n,selectedModels:o,allowAllModels:l,onToggleModel:r,onToggleConnectionAll:d,allConnectionModelsSelected:i,searchQuery:f,readOnly:x}=t;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={pageSize:999},e[0]=m):m=e[0];const b=cs(n.id,m);let a;e[1]!==b||e[2]!==f?(a=f.trim()?b.filter(A=>A.title.toLowerCase().includes(f.toLowerCase())||A.id.toLowerCase().includes(f.toLowerCase())||A.provider?.toLowerCase().includes(f.toLowerCase())):b,e[1]=b,e[2]=f,e[3]=a):a=e[3];const T=a;if(T.length===0)return null;let h;e[4]!==i||e[5]!==l||e[6]!==T||e[7]!==o?(h=l||i||o.includes("*")&&!l||T.every(A=>o.includes(A.id)||o.includes("*")),e[4]=i,e[5]=l,e[6]=T,e[7]=o,e[8]=h):h=e[8];const E=h;let p;e[9]!==n.icon||e[10]!==n.title?(p=n.icon?s.jsx("img",{src:n.icon,alt:n.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:n.title.slice(0,1).toUpperCase()}),e[9]=n.icon,e[10]=n.title,e[11]=p):p=e[11];let v;e[12]!==n.title?(v=s.jsx("h4",{className:"text-sm font-medium text-muted-foreground/75",children:n.title}),e[12]=n.title,e[13]=v):v=e[13];let j;e[14]!==p||e[15]!==v?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[p,v]}),e[14]=p,e[15]=v,e[16]=j):j=e[16];let u;e[17]!==E||e[18]!==l||e[19]!==n.id||e[20]!==b||e[21]!==d||e[22]!==x?(u=!x&&!l&&s.jsx(Ne,{checked:E,onCheckedChange:()=>d(n.id,b)}),e[17]=E,e[18]=l,e[19]=n.id,e[20]=b,e[21]=d,e[22]=x,e[23]=u):u=e[23];let y;e[24]!==j||e[25]!==u?(y=s.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[j,u]}),e[24]=j,e[25]=u,e[26]=y):y=e[26];let N;if(e[27]!==l||e[28]!==n.id||e[29]!==T||e[30]!==r||e[31]!==x||e[32]!==o){let A;e[34]!==l||e[35]!==n.id||e[36]!==r||e[37]!==x||e[38]!==o?(A=R=>{const I=l||o.includes("*")||o.includes(R.id);return s.jsxs("div",{className:H("flex items-center justify-between gap-3 px-4 py-3",!x&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{x||l||r(n.id,R.id)},children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[R.logo&&s.jsx("img",{src:R.logo,className:"w-4 h-4 shrink-0 rounded-sm",alt:R.title}),s.jsx("span",{className:"text-sm truncate",children:R.title})]}),s.jsx("div",{onClick:Ws,children:x?s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ne,{checked:I,disabled:!0})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ne,{checked:I,disabled:x||l,onCheckedChange:()=>{x||l||r(n.id,R.id)}})})]},R.id)},e[34]=l,e[35]=n.id,e[36]=r,e[37]=x,e[38]=o,e[39]=A):A=e[39],N=T.map(A),e[27]=l,e[28]=n.id,e[29]=T,e[30]=r,e[31]=x,e[32]=o,e[33]=N}else N=e[33];let P;e[40]!==N?(P=s.jsx("div",{className:"space-y-1",children:N}),e[40]=N,e[41]=P):P=e[41];let O;return e[42]!==P||e[43]!==y?(O=s.jsxs("div",{className:"mb-6 last:mb-0",children:[y,P]}),e[42]=P,e[43]=y,e[44]=O):O=e[44],O}function Ws(t){return t.stopPropagation()}function Xs(){const t=oe.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(He,{className:"size-4 animate-spin"}),"Loading models..."]}),t[0]=e):e=t[0],e}function en(t){const e=oe.c(39),{allowAllModels:n,modelSet:o,onAllowAllChange:l,onModelSetChange:r,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f),b=as();let a;e[0]!==o||e[1]!==r?(a=(I,L)=>{const g=o[I]??[],_={...o};if(g.includes(L)){const S=g.filter(C=>C!==L);S.length===0?delete _[I]:_[I]=S}else _[I]=[...g,L];r(_)},e[0]=o,e[1]=r,e[2]=a):a=e[2];const T=a;let h;e[3]!==o||e[4]!==r?(h=(I,L)=>{const g=o[I]??[],_=L.map(sn),S=g.includes("*")||_.every(M=>g.includes(M)),C={...o};S?delete C[I]:C[I]=_,r(C)},e[3]=o,e[4]=r,e[5]=h):h=e[5];const E=h;let p;e[6]!==f?(p=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search models...",className:"border-b-0"})}),e[6]=f,e[7]=p):p=e[7];const v=!i&&"hover:bg-muted/50 cursor-pointer";let j;e[8]!==v?(j=H("flex items-center justify-between px-4 py-3 rounded-lg",v),e[8]=v,e[9]=j):j=e[9];let u;e[10]!==n||e[11]!==l||e[12]!==r||e[13]!==i?(u=()=>{if(i)return;const I=!n;l(I),I&&r({})},e[10]=n,e[11]=l,e[12]=r,e[13]=i,e[14]=u):u=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[15]=y):y=e[15];let N;e[16]!==n||e[17]!==l||e[18]!==r||e[19]!==i?(N=s.jsx("div",{onClick:tn,children:i?s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ne,{checked:n,disabled:!0})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ne,{checked:n,onCheckedChange:I=>{i||(l(I),I&&r({}))}})}),e[16]=n,e[17]=l,e[18]=r,e[19]=i,e[20]=N):N=e[20];let P;e[21]!==j||e[22]!==u||e[23]!==N?(P=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:j,onClick:u,children:[y,N]})}),e[21]=j,e[22]=u,e[23]=N,e[24]=P):P=e[24];let O;e[25]!==n||e[26]!==m||e[27]!==b||e[28]!==o||e[29]!==i||e[30]!==E||e[31]!==T?(O=b.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):b.map(I=>s.jsx(D.Suspense,{fallback:s.jsx(Xs,{}),children:s.jsx(Ys,{connection:I,selectedModels:o[I.id]??[],allowAllModels:n,onToggleModel:T,onToggleConnectionAll:E,allConnectionModelsSelected:(o[I.id]??[]).includes("*"),searchQuery:m,readOnly:i})},I.id)),e[25]=n,e[26]=m,e[27]=b,e[28]=o,e[29]=i,e[30]=E,e[31]=T,e[32]=O):O=e[32];let A;e[33]!==O?(A=s.jsx("div",{className:"flex-1 overflow-auto",children:O}),e[33]=O,e[34]=A):A=e[34];let R;return e[35]!==P||e[36]!==A||e[37]!==p?(R=s.jsxs("div",{className:"flex flex-col h-full",children:[p,P,A]}),e[35]=P,e[36]=A,e[37]=p,e[38]=R):R=e[38],R}function tn(t){return t.stopPropagation()}function sn(t){return t.id}function nn(t){const e=oe.c(56),{open:n,onOpenChange:o,selectedMemberIds:l,onAddMembers:r}=t,[d,i]=D.useState(""),f=D.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,b]=D.useState(x),{data:a}=bt();let T,h,E,p,v,j,u,y,N,P,O;if(e[1]!==a?.data?.members||e[2]!==f||e[3]!==r||e[4]!==o||e[5]!==n||e[6]!==m||e[7]!==d||e[8]!==l){const M=a?.data?.members??[];let z;e[20]!==f?(z=U=>{const c=f.toLowerCase();return U.user?.name?.toLowerCase().includes(c)||U.user?.email?.toLowerCase().includes(c)},e[20]=f,e[21]=z):z=e[21];const G=M.filter(z),K=on;let W;e[22]!==l?(W=U=>l.includes(U),e[22]=l,e[23]=W):W=e[23];const X=W;let ee;e[24]!==m?(ee=U=>{m.includes(U)?b(m.filter(c=>c!==U)):b([...m,U])},e[24]=m,e[25]=ee):ee=e[25];const re=ee;let te;e[26]!==r||e[27]!==o||e[28]!==m?(te=()=>{r(m),b([]),o(!1)},e[26]=r,e[27]=o,e[28]=m,e[29]=te):te=e[29],E=te,h=Ue,P=n,O=o,T=Ve,y="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ge,{className:"px-6 pt-6",children:[s.jsx(Be,{children:"Add Members to Role"}),s.jsx($e,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],j="flex flex-col h-80",e[31]!==d?(u=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=d,e[32]=u):u=e[32],p="flex-1 overflow-auto",v=G.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:G.map(U=>{const c=K(U),w=X(U.id),V=m.includes(U.id);return s.jsxs("label",{className:H("flex items-center gap-3 p-2 rounded-lg",!c||w?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(ze,{checked:V||w,onCheckedChange:()=>{c&&!w&&re(U.id)},disabled:!c||w}),s.jsx(Pe,{url:U.user?.image??void 0,fallback:Jt(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!c&&s.jsx(ye,{variant:"secondary",className:"shrink-0",children:"Owner"}),w&&c&&s.jsx(ye,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=a?.data?.members,e[2]=f,e[3]=r,e[4]=o,e[5]=n,e[6]=m,e[7]=d,e[8]=l,e[9]=T,e[10]=h,e[11]=E,e[12]=p,e[13]=v,e[14]=j,e[15]=u,e[16]=y,e[17]=N,e[18]=P,e[19]=O}else T=e[9],h=e[10],E=e[11],p=e[12],v=e[13],j=e[14],u=e[15],y=e[16],N=e[17],P=e[18],O=e[19];let A;e[33]!==p||e[34]!==v?(A=s.jsx("div",{className:p,children:v}),e[33]=p,e[34]=v,e[35]=A):A=e[35];let R;e[36]!==A||e[37]!==j||e[38]!==u?(R=s.jsxs("div",{className:j,children:[u,A]}),e[36]=A,e[37]=j,e[38]=u,e[39]=R):R=e[39];let I;e[40]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Ke,{children:"Cancel"}),e[40]=I):I=e[40];const L=m.length===0,g=m.length>0&&`(${m.length})`;let _;e[41]!==E||e[42]!==L||e[43]!==g?(_=s.jsxs(Fe,{className:"px-6 pb-6",children:[I,s.jsxs(Qe,{onClick:E,disabled:L,children:["Add ",g]})]}),e[41]=E,e[42]=L,e[43]=g,e[44]=_):_=e[44];let S;e[45]!==T||e[46]!==R||e[47]!==_||e[48]!==y||e[49]!==N?(S=s.jsxs(T,{className:y,children:[N,R,_]}),e[45]=T,e[46]=R,e[47]=_,e[48]=y,e[49]=N,e[50]=S):S=e[50];let C;return e[51]!==h||e[52]!==S||e[53]!==P||e[54]!==O?(C=s.jsx(h,{open:P,onOpenChange:O,children:S}),e[51]=h,e[52]=S,e[53]=P,e[54]=O,e[55]=C):C=e[55],C}function on(t){return t.role!=="owner"}function rn(t){const e=oe.c(40),{memberIds:n,onMemberIdsChange:o,readOnly:l}=t,r=l===void 0?!1:l,[d,i]=D.useState(""),f=D.useDeferredValue(d),[x,m]=D.useState(!1),{data:b}=bt();let a,T,h,E,p;if(e[0]!==b?.data?.members||e[1]!==f||e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==d){const y=b?.data?.members??[];let N;e[11]!==n?(N=S=>n.includes(S.id),e[11]=n,e[12]=N):N=e[12];const P=y.filter(N);let O;e[13]!==f?(O=S=>{const C=f.toLowerCase();return S.user?.name?.toLowerCase().includes(C)||S.user?.email?.toLowerCase().includes(C)},e[13]=f,e[14]=O):O=e[14];const A=P.filter(O);let R;e[15]!==n||e[16]!==o?(R=S=>{o(n.filter(C=>C!==S))},e[15]=n,e[16]=o,e[17]=R):R=e[17];const I=R;let L;e[18]!==n||e[19]!==o?(L=S=>{o([...n,...S])},e[18]=n,e[19]=o,e[20]=L):L=e[20],a=L,E="flex flex-col h-full";let g;e[21]!==d?(g=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=d,e[22]=g):g=e[22];let _;e[23]!==r?(_=r?s.jsx("div",{className:"pr-4",children:s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(ot,{size:16}),"Add Member"]})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(ot,{size:16}),"Add Member"]})}),e[23]=r,e[24]=_):_=e[24],e[25]!==g||e[26]!==_?(p=s.jsxs("div",{className:"flex items-center border-b border-border",children:[g,_]}),e[25]=g,e[26]=_,e[27]=p):p=e[27],T="flex-1 overflow-auto",h=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):A.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:A.map(S=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Pe,{url:S.user?.image??void 0,fallback:Jt(S.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:S.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.user?.email})]}),r?s.jsx(Se,{children:s.jsxs(Oe,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Ae,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>I(S.id),children:s.jsx(St,{size:16})})]},S.id))}),e[0]=b?.data?.members,e[1]=f,e[2]=n,e[3]=o,e[4]=r,e[5]=d,e[6]=a,e[7]=T,e[8]=h,e[9]=E,e[10]=p}else a=e[6],T=e[7],h=e[8],E=e[9],p=e[10];let v;e[28]!==T||e[29]!==h?(v=s.jsx("div",{className:T,children:h}),e[28]=T,e[29]=h,e[30]=v):v=e[30];let j;e[31]!==x||e[32]!==a||e[33]!==n?(j=s.jsx(nn,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:a}),e[31]=x,e[32]=a,e[33]=n,e[34]=j):j=e[34];let u;return e[35]!==E||e[36]!==p||e[37]!==v||e[38]!==j?(u=s.jsxs("div",{className:E,children:[p,v,j]}),e[35]=E,e[36]=p,e[37]=v,e[38]=j,e[39]=u):u=e[39],u}function ln(t){const e=oe.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let o;return e[1]!==t?(o=s.jsx(D.Suspense,{fallback:n,children:s.jsx(rn,{...t})}),e[1]=t,e[2]=o):o=e[2],o}const an={owner:[],admin:[],user:[]};function tt(t,e){const n=t==="owner"||t==="admin",o=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:an[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:o.map(l=>l.id)}}function cn({trigger:t,onSuccess:e}){const[n,o]=D.useState(!1),[l,r]=D.useState("mcp"),{locator:d}=je(),i=Me(),f=Ut()??[],{customRoles:x,refetch:m}=Nt(),{data:b}=it({queryKey:ue.members(d),queryFn:()=>me.organization.listMembers()}),a=kt({resolver:Wt(Bs),defaultValues:et()}),T=a.formState.isValid,h=a.formState.isDirty,[E,p]=D.useState(null),[v,j]=D.useState(null),u=!a.watch("role.id")&&!a.watch("role.slug")&&!v,[y,N]=D.useState(null),[P,O]=D.useState(!1),[A,R]=D.useState(null),I=c=>{const w=c.permission||{},V=w.self||[],fe=V.includes("*"),Z=fe?[]:V.filter(B=>B!=="*"),Y={};for(const[B,se]of Object.entries(w))if(!(B==="self"||B==="models"))if(B==="*")for(const ne of f)se.includes("*")?Y[ne.id]=ne.tools?.map(ae=>ae.name)??[]:Y[ne.id]=se;else{const ne=f.find(ae=>ae.id===B);ne&&(se.includes("*")?Y[B]=ne.tools?.map(ae=>ae.name)??[]:Y[B]=se)}const q=w.models||[],he=q.length===0||q.includes("*:*"),J={};if(!he)for(const B of q){const se=B.indexOf(":");if(se===-1)continue;const ne=B.slice(0,se),ae=B.slice(se+1);J[ne]||(J[ne]=[]),J[ne].push(ae)}const ce=(b?.data?.members??[]).filter(B=>B.role===c.role).map(B=>B.id);return{role:{id:c.id,slug:c.role,label:c.label},allowAllStaticPermissions:fe,staticPermissions:Z,toolSet:Y,allowAllModels:he,modelSet:J,memberIds:ce}},L=c=>{const w=I(c);a.reset(w),p(c.id??null),j(null)},g=()=>{a.reset(et()),p(null),j(null),r("mcp")},_=c=>{h&&T?(R(()=>()=>L(c)),O(!0)):L(c)},S=async()=>{h&&T&&await ee(),g()},C=c=>{if(h&&T)R(()=>()=>{const w=tt(c,b?.data?.members??[]);a.reset(w),j(c),p(null),r("org")}),O(!0);else{const w=tt(c,b?.data?.members??[]);a.reset(w),j(c),p(null),r("org")}},M=c=>{if(!c&&a.formState.isDirty&&T){R(()=>()=>{o(!1),a.reset(et()),j(null)}),O(!0);return}if(o(c),!c)a.reset(et()),j(null),p(null);else{const w=x[0];if(w)L(w);else{const V=tt("user",b?.data?.members??[]);a.reset(V),j("user"),p(null),r("org")}}},z=()=>{O(!1),A&&(A(),R(null))},G=c=>{const w={};c.allowAllStaticPermissions?w.self=["*"]:c.staticPermissions.length>0&&(w.self=c.staticPermissions);for(const[V,fe]of Object.entries(c.toolSet))if(fe.length>0){const Y=f.find(q=>q.id===V)?.tools?.map(q=>q.name)??[];Y.length>0&&Y.every(q=>fe.includes(q))?w[V]=["*"]:w[V]=fe}if(c.allowAllModels)w.models=["*:*"];else{const V=[];for(const[fe,Z]of Object.entries(c.modelSet))if(Z.length>0)for(const Y of Z)V.push(`${fe}:${Y}`);w.models=V}return w},K=Ee({mutationFn:async c=>{const w=G(c),V=c.role.slug||c.role.label.toLowerCase().replace(/\s+/g,"-");if(c.role.slug&&!c.role.id){const Y=(b?.data?.members??[]).filter(J=>J.role===c.role.slug).map(J=>J.id),q=c.memberIds.filter(J=>!Y.includes(J)),he=Y.filter(J=>!c.memberIds.includes(J));for(const J of q){const Q=await me.organization.updateMemberRole({memberId:J,role:[c.role.slug]});if(Q?.error)throw new Error(Q.error.message)}for(const J of he){const Q=await me.organization.updateMemberRole({memberId:J,role:["user"]});if(Q?.error)throw new Error(Q.error.message)}return c}else if(c.role.id){const Z=await me.organization.updateRole({roleId:c.role.id,data:{permission:w}});if(Z?.error)throw new Error(Z.error.message);const q=(b?.data?.members??[]).filter(Q=>Q.role===c.role.slug).map(Q=>Q.id),he=c.memberIds.filter(Q=>!q.includes(Q)),J=q.filter(Q=>!c.memberIds.includes(Q));for(const Q of he){const ce=await me.organization.updateMemberRole({memberId:Q,role:[c.role.slug]});if(ce?.error)throw new Error(ce.error.message)}for(const Q of J){const ce=await me.organization.updateMemberRole({memberId:Q,role:["user"]});if(ce?.error)throw new Error(ce.error.message)}return c}else{const Z=await me.organization.createRole({role:V,permission:w});if(Z?.error)throw new Error(Z.error.message);for(const Y of c.memberIds){const q=await me.organization.updateMemberRole({memberId:Y,role:[V]});if(q?.error)throw new Error(q.error.message)}return{...c,role:{...c.role,id:Z.data?.roleData?.id,slug:V}}}},onSuccess:(c,w)=>{i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)});const V=!w.role.id&&!w.role.slug,fe=w.role.slug&&!w.role.id;le.success(fe?"Members updated successfully!":V?"Role created successfully!":"Role updated successfully!"),m(),a.reset(c),c.role.id&&p(c.role.id),e?.()},onError:c=>{le.error(c instanceof Error?c.message:"Failed to save role")}}),W=Ee({mutationFn:async c=>{const w=await me.organization.deleteRole({roleId:c});if(w?.error)throw new Error(w.error.message);return w?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)}),le.success("Role deleted successfully!"),m(),y?.id===E){const c=x.filter(w=>w.id!==y?.id);if(c[0])L(c[0]);else{const w=tt("user",b?.data?.members??[]);a.reset(w),j("user"),p(null),r("org")}}},onError:c=>{le.error(c instanceof Error?c.message:"Failed to delete role")}}),X=K.isPending||W.isPending,ee=async()=>{const c=a.getValues();if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}await K.mutateAsync(c)},re=a.handleSubmit(c=>{if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}K.mutate(c)}),te=c=>{c.id&&N({id:c.id,label:c.label})},U=()=>{y?.id&&W.mutate(y.id),N(null)};return s.jsxs(Vt,{open:n,onOpenChange:M,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsx(Bt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[$s.map(c=>{const w=v===c.role;return s.jsxs("div",{className:H("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",w?"bg-accent":"hover:bg-muted/50"),onClick:()=>C(c.role),children:[s.jsx("div",{className:H("shrink-0 size-3 rounded-full",c.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsx(bs,{size:14,className:"text-muted-foreground shrink-0"})]},c.role)}),x.map(c=>{const w=E===c.id;return s.jsxs("div",{className:H("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",w?"bg-accent":"hover:bg-muted/50"),onClick:()=>_(c),children:[s.jsx("div",{className:H("shrink-0 size-3 rounded-full",Fs(c.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:H("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",w&&"opacity-100 pointer-events-auto"),onClick:V=>V.stopPropagation(),children:s.jsx(ps,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(nt,{className:"text-destructive",onClick:V=>{V.stopPropagation(),te(c)},children:[s.jsx($t,{size:16}),"Delete"]})})]})]},c.id)}),u&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(Cs,{...a.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(ye,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:S,disabled:X||h,className:"w-full h-10",children:[s.jsx(ot,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!v&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>r("mcp"),className:H("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>r("org"),className:H("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>r("models"),className:H("h-7 rounded-lg px-2 border border-input transition-colors",l==="models"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Models"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>r("members"),className:H("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!v&&s.jsx(ks,{toolSet:a.watch("toolSet"),onToolSetChange:c=>a.setValue("toolSet",c,{shouldDirty:!0})}),l==="org"&&s.jsx(Ks,{allowAllStaticPermissions:a.watch("allowAllStaticPermissions"),staticPermissions:a.watch("staticPermissions"),onAllowAllChange:c=>a.setValue("allowAllStaticPermissions",c,{shouldDirty:!0}),onPermissionsChange:c=>a.setValue("staticPermissions",c,{shouldDirty:!0}),readOnly:!!v}),l==="models"&&s.jsx(en,{allowAllModels:a.watch("allowAllModels"),modelSet:a.watch("modelSet"),onAllowAllChange:c=>a.setValue("allowAllModels",c,{shouldDirty:!0}),onModelSetChange:c=>a.setValue("modelSet",c,{shouldDirty:!0}),readOnly:!!v}),l==="members"&&s.jsx(ln,{memberIds:a.watch("memberIds"),onMemberIdsChange:c=>a.setValue("memberIds",c,{shouldDirty:!0}),readOnly:v==="owner"})]}),(!v||v!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>M(!1),disabled:X,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:re,disabled:X||!T||!a.formState.isDirty,className:"h-10",children:K.isPending?"Saving...":u?"Create Role":"Save Changes"})]})]})]})}),s.jsx(Ue,{open:y!==null,onOpenChange:c=>!c&&N(null),children:s.jsxs(Ve,{children:[s.jsxs(Ge,{children:[s.jsx(Be,{children:"Delete Role"}),s.jsxs($e,{children:['Are you sure you want to delete the "',y?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{children:"Cancel"}),s.jsx(Qe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(Ue,{open:P,onOpenChange:O,children:s.jsxs(Ve,{children:[s.jsxs(Ge,{children:[s.jsx(Be,{children:"Discard Changes"}),s.jsx($e,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{onClick:()=>R(null),children:"Keep Editing"}),s.jsx(Qe,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const dn=Ce().email("Invalid email address");function mn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function un({trigger:t}){const[e,n]=D.useState(!1),{locator:o}=je(),l=Me(),{data:r}=me.useSession(),d=r?.user?.email,{roles:i,isLoading:f}=Nt(),x=i.filter(j=>j.role!=="owner"),m=kt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),b=m.watch("emailsText"),a=m.watch("role"),h=mn(b).filter(j=>{const u=dn.safeParse(j).success,y=!d||j!==d.toLowerCase();return u&&y}),E=Ee({mutationFn:async({emails:j,role:u})=>{if(!u)throw new Error("Please select a role");const y=await Promise.allSettled(j.map(async P=>{const O=await me.organization.inviteMember({email:P,role:u});if(O.error)throw new Error(O.error.message);return O.data})),N=y.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return y},onSuccess:(j,{emails:u})=>{l.invalidateQueries({queryKey:ue.members(o)}),l.invalidateQueries({queryKey:ue.invitations(o)}),le.success(u.length===1?"Member invited successfully!":`${u.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:j=>{le.error(j instanceof Error?j.message:"Failed to invite members")}}),p=j=>{if(h.length===0){le.error("Please enter at least one valid email address");return}if(!j.role){le.error("Please select a role");return}E.mutate({emails:h,role:j.role})},v=h.length>0&&!!a;return s.jsxs(Vt,{open:e,onOpenChange:n,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsxs(Bt,{className:"sm:max-w-lg",children:[s.jsx(ds,{children:s.jsx(ms,{children:"Invite members"})}),s.jsx(js,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(p),className:"space-y-4",children:[s.jsx(Ot,{control:m.control,name:"emailsText",render:({field:j})=>s.jsxs(It,{children:[s.jsx(Ts,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Ns,{...j,disabled:E.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
- e.g. user1@example.com, user2@example.com
3
- or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(_t,{})]})}),s.jsx(Ot,{control:m.control,name:"role",render:({field:j})=>s.jsxs(It,{children:[s.jsx(At,{children:s.jsxs(ft,{value:j.value,onValueChange:j.onChange,disabled:E.isPending||f,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(u=>{const y=[];return u.isBuiltin||(u.allowsAllStaticPermissions?y.push("Full org access"):u.staticPermissionCount&&u.staticPermissionCount>0&&y.push(`${u.staticPermissionCount} org perm${u.staticPermissionCount!==1?"s":""}`),u.allowsAllConnections?y.push("All connections"):u.connectionCount&&u.connectionCount>0&&y.push(`${u.connectionCount} connection${u.connectionCount!==1?"s":""}`),(u.connectionCount!==0||u.allowsAllConnections)&&(u.allowsAllTools?y.push("all tools"):u.toolCount&&u.toolCount>0&&y.push(`${u.toolCount} tool${u.toolCount!==1?"s":""}`))),s.jsx(pt,{value:u.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:u.label}),!u.isBuiltin&&y.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})},u.role)})})]})}),s.jsx(_t,{})]})}),s.jsxs(us,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:E.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:E.isPending||!v,children:E.isPending?"Inviting...":`Invite ${h.length||0} Member${h.length!==1?"s":""}`})]})]})})]})]})}function fn(){const t=oe.c(9),{org:e,locator:n}=je();let o;t[0]!==e.id?(o={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=o):o=t[1];const l=Je(o);let r;t[2]!==n?(r=ue.invitations(n),t[2]=n,t[3]=r):r=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(f.structuredContent??f)?.invitations??[]},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==r||t[7]!==d?(i={queryKey:r,queryFn:d},t[6]=r,t[7]=d,t[8]=i):i=t[8],Xt(i)}function hn(){const t=oe.c(5),{locator:e}=je(),n=Me();let o;t[0]!==e||t[1]!==n?(o={mutationFn:xn,onSuccess:()=>{n.invalidateQueries({queryKey:ue.invitations(e)}),le.success("Invitation cancelled")},onError:gn},t[0]=e,t[1]=n,t[2]=o):o=t[2];const l=Ee(o);let r;return t[3]!==l?(r={cancel:l},t[3]=l,t[4]=r):r=t[4],r}function gn(t){le.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function xn(t){const e=await me.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function pn(){const t=oe.c(9),{org:e,locator:n}=je();let o;t[0]!==e.id?(o={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=o):o=t[1];const l=Je(o);let r;t[2]!==n?(r=ue.tags(n),t[2]=n,t[3]=r):r=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"TAGS_LIST",arguments:{}});return(f.structuredContent??f).tags},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==r||t[7]!==d?(i={queryKey:r,queryFn:d,staleTime:3e4},t[6]=r,t[7]=d,t[8]=i):i=t[8],it(i)}function bn(){const t=oe.c(10),e=Me(),{org:n,locator:o}=je();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const r=Je(l);let d;t[2]!==r?(d=async x=>{const m=await r.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=r,t[3]=d):d=t[3];let i;t[4]!==o||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ue.tags(o)})},t[4]=o,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:Cn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ee(f)}function Cn(t){le.error(t instanceof Error?t.message:"Failed to create tag")}function jn(t){const e=oe.c(12),{org:n,locator:o}=je();let l;e[0]!==n.id?(l={connectionId:qe,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const r=Je(l);let d;e[2]!==o||e[3]!==t?(d=ue.memberTags(o,t),e[2]=o,e[3]=t,e[4]=d):d=e[4];let i;e[5]!==r||e[6]!==t?(i=async()=>{const m=await r.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=r,e[6]=t,e[7]=i):i=e[7];const f=!!t;let x;return e[8]!==d||e[9]!==i||e[10]!==f?(x={queryKey:d,queryFn:i,staleTime:3e4,enabled:f},e[8]=d,e[9]=i,e[10]=f,e[11]=x):x=e[11],it(x)}function Tn(){const t=oe.c(10),e=Me(),{org:n,locator:o}=je();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const r=Je(l);let d;t[2]!==r?(d=async x=>{const{memberId:m,tagIds:b}=x,a=await r.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:b}});return a.structuredContent??a},t[2]=r,t[3]=d):d=t[3];let i;t[4]!==o||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ue.memberTags(o,m.memberId)})},t[4]=o,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:Nn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ee(f)}function Nn(t){le.error(t instanceof Error?t.message:"Failed to update member tags")}function Zt(t){const e=oe.c(44),{memberId:n,className:o,disabled:l,placeholder:r,maxDisplay:d}=t,i=l===void 0?!1:l,f=r===void 0?"Add tags...":r,x=d===void 0?2:d,[m,b]=D.useState(!1),[a,T]=D.useState(""),{data:h,isLoading:E}=pn(),p=h===void 0?[]:h,{data:v,isLoading:j}=jn(n),u=v===void 0?[]:v,y=bn(),N=Tn(),P=E||j,O=u.map(vn);let A;e[0]!==a?(A=F=>F.name.toLowerCase().includes(a.toLowerCase()),e[0]=a,e[1]=A):A=e[1];const R=p.filter(A);let I;e[2]!==a?(I=F=>F.name.toLowerCase()===a.toLowerCase(),e[2]=a,e[3]=I):I=e[3];const L=p.find(I),g=a.trim()&&!L,_=async F=>{const be=O.includes(F.id)?O.filter(_e=>_e!==F.id):[...O,F.id];await N.mutateAsync({memberId:n,tagIds:be})},S=async()=>{if(!a.trim())return;const F=await y.mutateAsync(a.trim());await N.mutateAsync({memberId:n,tagIds:[...O,F.id]}),T("")},C=async F=>{const xe=O.filter(be=>be!==F);await N.mutateAsync({memberId:n,tagIds:xe})},M=y.isPending||N.isPending,z=As;let G;e[4]!==m?(G=()=>b(!m),e[4]=m,e[5]=G):G=e[5];let K;e[6]!==o?(K=H("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",o),e[6]=o,e[7]=K):K=e[7];const W=i||P,X=P?s.jsx(He,{size:14,className:"animate-spin text-muted-foreground"}):u.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[u.slice(0,x).map(En),u.length>x&&s.jsxs(ye,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",u.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:f});let ee;e[8]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(ws,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=ee):ee=e[8];let re;e[9]!==W||e[10]!==X||e[11]!==G||e[12]!==K?(re=s.jsx(_s,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:G,className:K,disabled:W,children:[X,ee]})}),e[9]=W,e[10]=X,e[11]=G,e[12]=K,e[13]=re):re=e[13];const te=Is,U="w-56 p-0",c="start";let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=()=>b(!1),e[14]=w):w=e[14];const V=Ss,fe=!1;let Z;e[15]!==a?(Z=s.jsx(Os,{placeholder:"Search or create...",value:a,onValueChange:T,className:"h-9"}),e[15]=a,e[16]=Z):Z=e[16];const Y=ys,q=u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(dt,{heading:"Selected",children:u.map(F=>s.jsx(mt,{onSelect:()=>_(F),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]}),s.jsx("button",{onClick:xe=>{xe.stopPropagation(),C(F.id)},className:"opacity-50 hover:opacity-100",disabled:M,children:s.jsx(Qt,{size:14})})]})},F.id))}),s.jsx(Rt,{})]}),he=dt,J="Available",Q=R.length===0&&!g&&s.jsx(vs,{children:"No tags found."}),ce=R.filter(F=>!O.includes(F.id)).map(F=>s.jsx(mt,{onSelect:()=>_(F),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]})},F.id));let B;e[17]!==he||e[18]!==Q||e[19]!==ce?(B=s.jsxs(he,{heading:J,children:[Q,ce]}),e[17]=he,e[18]=Q,e[19]=ce,e[20]=B):B=e[20];let se;e[21]!==S||e[22]!==M||e[23]!==a||e[24]!==g?(se=g&&s.jsxs(s.Fragment,{children:[s.jsx(Rt,{}),s.jsx(dt,{children:s.jsx(mt,{onSelect:S,className:"cursor-pointer",disabled:M,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[M?s.jsx(He,{size:14,className:"animate-spin"}):s.jsx(ot,{size:14}),s.jsxs("span",{children:['Create "',a.trim(),'"']})]})})})]}),e[21]=S,e[22]=M,e[23]=a,e[24]=g,e[25]=se):se=e[25];let ne;e[26]!==Y||e[27]!==q||e[28]!==B||e[29]!==se?(ne=s.jsxs(Y,{children:[q,B,se]}),e[26]=Y,e[27]=q,e[28]=B,e[29]=se,e[30]=ne):ne=e[30];let ae;e[31]!==V||e[32]!==Z||e[33]!==ne?(ae=s.jsxs(V,{shouldFilter:fe,children:[Z,ne]}),e[31]=V,e[32]=Z,e[33]=ne,e[34]=ae):ae=e[34];let ge;e[35]!==te||e[36]!==w||e[37]!==ae?(ge=s.jsx(te,{className:U,align:c,onEscapeKeyDown:w,children:ae}),e[35]=te,e[36]=w,e[37]=ae,e[38]=ge):ge=e[38];let Te;return e[39]!==z||e[40]!==m||e[41]!==re||e[42]!==ge?(Te=s.jsxs(z,{open:m,onOpenChange:b,children:[re,ge]}),e[39]=z,e[40]=m,e[41]=re,e[42]=ge,e[43]=Te):Te=e[43],Te}function En(t){return s.jsx(ye,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function vn(t){return t.id}const Pt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],yn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Sn(t){const e=new Map;for(const[n,o]of Object.entries(yn))e.set(n,o);for(let n=0;n<t.length;n++){const o=t[n];o&&!e.has(o.role)&&e.set(o.role,Pt[n%Pt.length]??"bg-neutral-400")}return e}function On(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function st(t){const e=oe.c(79),{role:n,memberId:o,isOwner:l,roleColorMap:r,selectableRoles:d,onRoleChange:i,size:f,className:x}=t,m=f===void 0?"xs":f;let b,a,T,h,E,p,v,j,u,y,N;if(e[0]!==x||e[1]!==l||e[2]!==o||e[3]!==i||e[4]!==n||e[5]!==r||e[6]!==d||e[7]!==m){N=Symbol.for("react.early_return_sentinel");e:{const S=r.get(n)??"bg-neutral-400";if(l){let C;e[19]!==o||e[20]!==i?(C=U=>i(o,U),e[19]=o,e[20]=i,e[21]=C):C=e[21];let M;e[22]!==n?(M=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const z=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:H("size-2 rounded-full shrink-0",S)}),M]});let G;e[24]!==z?(G=s.jsx(gt,{children:z}),e[24]=z,e[25]=G):G=e[25];let K;e[26]!==x||e[27]!==m||e[28]!==G?(K=s.jsx(ht,{size:m,className:x,children:G}),e[26]=x,e[27]=m,e[28]=G,e[29]=K):K=e[29];let W;if(e[30]!==r||e[31]!==d){let U;e[33]!==r?(U=c=>{const w=r.get(c.role)??"bg-neutral-400";return s.jsx(pt,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:H("size-3 rounded-full",w)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[33]=r,e[34]=U):U=e[34],W=d.map(U),e[30]=r,e[31]=d,e[32]=W}else W=e[32];let X;e[35]!==W?(X=s.jsx(xt,{children:W}),e[35]=W,e[36]=X):X=e[36];let ee;e[37]!==l||e[38]!==n||e[39]!==C||e[40]!==K||e[41]!==X?(ee=s.jsx(Ie,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:C,disabled:l,children:[K,X]})})}),e[37]=l,e[38]=n,e[39]=C,e[40]=K,e[41]=X,e[42]=ee):ee=e[42];let re;e[43]===Symbol.for("react.memo_cache_sentinel")?(re=s.jsx(Ae,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=re):re=e[43];let te;e[44]!==ee?(te=s.jsx(Se,{children:s.jsxs(Oe,{children:[ee,re]})}),e[44]=ee,e[45]=te):te=e[45],N=te;break e}T=ft,j=n,e[46]!==o||e[47]!==i?(u=C=>i(o,C),e[46]=o,e[47]=i,e[48]=u):u=e[48],y=l,a=ht,p=m,v=x,b=gt,E="flex items-center gap-2 min-w-0",h=H("size-2 rounded-full shrink-0",S)}e[0]=x,e[1]=l,e[2]=o,e[3]=i,e[4]=n,e[5]=r,e[6]=d,e[7]=m,e[8]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=E,e[13]=p,e[14]=v,e[15]=j,e[16]=u,e[17]=y,e[18]=N}else b=e[8],a=e[9],T=e[10],h=e[11],E=e[12],p=e[13],v=e[14],j=e[15],u=e[16],y=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let P;e[49]!==h?(P=s.jsx("div",{className:h}),e[49]=h,e[50]=P):P=e[50];let O;e[51]!==n?(O=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=O):O=e[52];let A;e[53]!==P||e[54]!==O||e[55]!==E?(A=s.jsxs("div",{className:E,children:[P,O]}),e[53]=P,e[54]=O,e[55]=E,e[56]=A):A=e[56];let R;e[57]!==b||e[58]!==A?(R=s.jsx(b,{children:A}),e[57]=b,e[58]=A,e[59]=R):R=e[59];let I;e[60]!==a||e[61]!==R||e[62]!==p||e[63]!==v?(I=s.jsx(a,{size:p,className:v,children:R}),e[60]=a,e[61]=R,e[62]=p,e[63]=v,e[64]=I):I=e[64];let L;if(e[65]!==r||e[66]!==d){let S;e[68]!==r?(S=C=>{const M=r.get(C.role)??"bg-neutral-400";return s.jsx(pt,{value:C.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:H("size-3 rounded-full",M)}),s.jsx("span",{className:"capitalize",children:C.label})]})},C.role)},e[68]=r,e[69]=S):S=e[69],L=d.map(S),e[65]=r,e[66]=d,e[67]=L}else L=e[67];let g;e[70]!==L?(g=s.jsx(xt,{children:L}),e[70]=L,e[71]=g):g=e[71];let _;return e[72]!==T||e[73]!==I||e[74]!==g||e[75]!==j||e[76]!==u||e[77]!==y?(_=s.jsxs(T,{value:j,onValueChange:u,disabled:y,children:[I,g]}),e[72]=T,e[73]=I,e[74]=g,e[75]=j,e[76]=u,e[77]=y,e[78]=_):_=e[78],_}function Mt(t){const e=oe.c(51),{member:n,roles:o,onChangeRole:l,onRemove:r,isUpdating:d}=t,i=d===void 0?!1:d,f=n.role==="owner";let x,m,b,a,T,h,E,p,v;if(e[0]!==f||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==o){let I;e[15]!==n.role?(I=C=>C.role!==n.role&&C.role!=="owner",e[15]=n.role,e[16]=I):I=e[16];const L=o.filter(I);a=Ct;let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ft,{size:20}),e[17]=g):g=e[17],e[18]!==f?(v=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:f,onClick:An,children:g})}),e[18]=f,e[19]=v):v=e[19],b=Tt,E="end",p=In,m=fs;let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ht,{size:16}),e[20]=_):_=e[20],e[21]!==i?(h=s.jsxs(hs,{disabled:i,children:[_,"Change Role"]}),e[21]=i,e[22]=h):h=e[22],x=gs;let S;e[23]!==i||e[24]!==n.id||e[25]!==l?(S=C=>{const M=[];return C.isBuiltin||(C.allowsAllStaticPermissions?M.push("Full org access"):C.staticPermissionCount&&C.staticPermissionCount>0&&M.push(`${C.staticPermissionCount} org perm${C.staticPermissionCount!==1?"s":""}`),C.allowsAllConnections?M.push("All connections"):C.connectionCount&&C.connectionCount>0&&M.push(`${C.connectionCount} connection${C.connectionCount!==1?"s":""}`),(C.connectionCount!==0||C.allowsAllConnections)&&(C.allowsAllTools?M.push("all tools"):C.toolCount&&C.toolCount>0&&M.push(`${C.toolCount} tool${C.toolCount!==1?"s":""}`))),s.jsxs(nt,{onClick:z=>{z.stopPropagation(),l(n.id,C.role)},disabled:i,children:[C.isBuiltin?s.jsx(Kt,{size:16}):s.jsx(Es,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:C.label}),!C.isBuiltin&&M.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},C.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=S):S=e[26],T=L.map(S),e[0]=f,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=o,e[6]=x,e[7]=m,e[8]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=E,e[13]=p,e[14]=v}else x=e[6],m=e[7],b=e[8],a=e[9],T=e[10],h=e[11],E=e[12],p=e[13],v=e[14];let j;e[27]!==x||e[28]!==T?(j=s.jsx(x,{children:T}),e[27]=x,e[28]=T,e[29]=j):j=e[29];let u;e[30]!==m||e[31]!==h||e[32]!==j?(u=s.jsxs(m,{children:[h,j]}),e[30]=m,e[31]=h,e[32]=j,e[33]=u):u=e[33];let y;e[34]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(xs,{}),e[34]=y):y=e[34];let N;e[35]!==n.id||e[36]!==r?(N=I=>{I.stopPropagation(),r(n.id)},e[35]=n.id,e[36]=r,e[37]=N):N=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx($t,{size:16}),e[38]=P):P=e[38];let O;e[39]!==N?(O=s.jsxs(nt,{variant:"destructive",onClick:N,children:[P,"Remove Member"]}),e[39]=N,e[40]=O):O=e[40];let A;e[41]!==b||e[42]!==O||e[43]!==E||e[44]!==p||e[45]!==u?(A=s.jsxs(b,{align:E,onClick:p,children:[u,y,O]}),e[41]=b,e[42]=O,e[43]=E,e[44]=p,e[45]=u,e[46]=A):A=e[46];let R;return e[47]!==a||e[48]!==A||e[49]!==v?(R=s.jsxs(a,{children:[v,A]}),e[47]=a,e[48]=A,e[49]=v,e[50]=R):R=e[50],R}function In(t){return t.stopPropagation()}function An(t){return t.stopPropagation()}function Dt(t){const e=oe.c(8),{invitationId:n,onCancel:o,isCancelling:l}=t,r=l===void 0?!1:l;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:wn,children:s.jsx(Ft,{size:20})})}),e[0]=d):d=e[0];let i;e[1]!==n||e[2]!==o?(i=m=>{m.stopPropagation(),o(n)},e[1]=n,e[2]=o,e[3]=i):i=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Qt,{size:16}),e[4]=f):f=e[4];let x;return e[5]!==r||e[6]!==i?(x=s.jsxs(Ct,{children:[d,s.jsx(Tt,{align:"end",onClick:_n,children:s.jsxs(nt,{variant:"destructive",onClick:i,disabled:r,children:[f,"Cancel Invitation"]})})]}),e[5]=r,e[6]=i,e[7]=x):x=e[7],x}function _n(t){return t.stopPropagation()}function wn(t){return t.stopPropagation()}function Rn(){const t=oe.c(79),{data:e}=bt(),{data:n}=fn(),o=hn(),l=Me(),{locator:r}=je(),[d,i]=D.useState(null),[f,x]=D.useState(null),[m,b]=D.useState(""),[a,T]=D.useState("table"),[h,E]=D.useState("member"),[p,v]=D.useState("asc"),j=e?.data?.members;let u;t[0]!==h?(u=k=>{h===k?v(Qn):(E(k),v("asc"))},t[0]=h,t[1]=u):u=t[1];const y=u;let N=j??[],P=n??[];if(m){const k=m.toLowerCase();N=N.filter($=>$.user?.name?.toLowerCase().includes(k)||$.user?.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k)),P=P.filter($=>$.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k))}if(h&&p){let k;t[2]!==p||t[3]!==h?(k=($,de)=>{let pe,ke;e:switch(h){case"member":{pe=$.user?.name||"",ke=de.user?.name||"";break e}case"role":{pe=$.role||"",ke=de.role||"";break e}case"joined":{pe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",ke=de.createdAt?typeof de.createdAt=="string"?de.createdAt:de.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?pe.localeCompare(ke):ke.localeCompare(pe)},t[2]=p,t[3]=h,t[4]=k):k=t[4],N=[...N].sort(k)}const O=N;let A;t[5]!==r||t[6]!==l?(A={mutationFn:Kn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(r)}),le.success("Member has been removed from the organization"),i(null)},onError:Fn},t[5]=r,t[6]=l,t[7]=A):A=t[7];const R=Ee(A);let I;t[8]!==r||t[9]!==l?(I={mutationFn:$n,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(r)}),le.success("Member's role has been updated")},onError:Bn},t[8]=r,t[9]=l,t[10]=I):I=t[10];const L=Ee(I);let g;t[11]!==r||t[12]!==l?(g={mutationFn:Gn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.invitations(r)}),le.success("Invitation role has been updated")},onError:Vn},t[11]=r,t[12]=l,t[13]=g):g=t[13];const _=Ee(g),{roles:S,customRoles:C}=Nt();let M;t[14]!==C?(M=Sn(C),t[14]=C,t[15]=M):M=t[15];const z=M;let G;t[16]!==S?(G=S.filter(Un),t[16]=S,t[17]=G):G=t[17];const K=G;let W;t[18]===Symbol.for("react.memo_cache_sentinel")?(W={id:"member",header:"Member",render:zn,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=W):W=t[18];let X;t[19]!==z||t[20]!==K||t[21]!==_||t[22]!==L?(X={id:"role",header:"Role",render:k=>k.type==="member"?s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:k.data.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>L.mutate({memberId:$,role:de}),className:"w-36"}):s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>_.mutate({invitationId:$,role:de,email:k.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=z,t[20]=K,t[21]=_,t[22]=L,t[23]=X):X=t[23];let ee,re;t[24]===Symbol.for("react.memo_cache_sentinel")?(ee={id:"tags",header:"Tags",render:kn,cellClassName:"w-40 shrink-0"},re={id:"joined",header:"Joined",render:Dn,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=ee,t[25]=re):(ee=t[24],re=t[25]);let te;t[26]!==o.cancel.isPending||t[27]!==S||t[28]!==L?(te={id:"actions",header:"",render:k=>k.type==="member"?s.jsx(Mt,{member:k.data,roles:S,onChangeRole:($,de)=>L.mutate({memberId:$,role:de}),onRemove:i,isUpdating:L.isPending}):s.jsx(Dt,{invitationId:k.data.id,onCancel:x,isCancelling:o.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=o.cancel.isPending,t[27]=S,t[28]=L,t[29]=te):te=t[29];let U;t[30]!==te||t[31]!==X?(U=[W,X,ee,re,te],t[30]=te,t[31]=X,t[32]=U):U=t[32];const c=U;let w;t[33]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(cn,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(Kt,{size:16}),"Manage Roles"]})}),t[33]=w):w=t[33];let V;t[34]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs("div",{className:"flex items-center gap-2",children:[w,s.jsx(un,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=V):V=t[34];const fe=V,Z=[...O.map(Mn),...P.filter(Pn).map(Ln)],Y=ve,q=!!f;let he;t[35]===Symbol.for("react.memo_cache_sentinel")?(he=()=>x(null),t[35]=he):he=t[35];let J;t[36]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsxs(Ge,{children:[s.jsx(Be,{children:"Cancel Invitation"}),s.jsx($e,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=J):J=t[36];let Q;t[37]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Ke,{children:"Keep Invitation"}),t[37]=Q):Q=t[37];let ce;t[38]!==o.cancel||t[39]!==f?(ce=()=>{f&&(o.cancel.mutate(f),x(null))},t[38]=o.cancel,t[39]=f,t[40]=ce):ce=t[40];let B;t[41]!==o.cancel.isPending||t[42]!==ce?(B=s.jsxs(Ve,{children:[J,s.jsxs(Fe,{children:[Q,s.jsx(Qe,{onClick:ce,disabled:o.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=o.cancel.isPending,t[42]=ce,t[43]=B):B=t[43];let se;t[44]!==q||t[45]!==B?(se=s.jsx(Ue,{open:q,onOpenChange:he,children:B}),t[44]=q,t[45]=B,t[46]=se):se=t[46];const ne=!!d;let ae;t[47]===Symbol.for("react.memo_cache_sentinel")?(ae=()=>i(null),t[47]=ae):ae=t[47];let ge;t[48]===Symbol.for("react.memo_cache_sentinel")?(ge=s.jsxs(Ge,{children:[s.jsx(Be,{children:"Remove Member"}),s.jsx($e,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=ge):ge=t[48];let Te;t[49]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Ke,{children:"Cancel"}),t[49]=Te):Te=t[49];let F;t[50]!==d||t[51]!==R?(F=()=>d&&R.mutate(d),t[50]=d,t[51]=R,t[52]=F):F=t[52];let xe;t[53]!==R.isPending||t[54]!==F?(xe=s.jsxs(Ve,{children:[ge,s.jsxs(Fe,{children:[Te,s.jsx(Qe,{onClick:F,disabled:R.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=R.isPending,t[54]=F,t[55]=xe):xe=t[55];let be;t[56]!==ne||t[57]!==xe?(be=s.jsx(Ue,{open:ne,onOpenChange:ae,children:xe}),t[56]=ne,t[57]=xe,t[58]=be):be=t[58];let _e;t[59]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(ve.Header.Left,{children:s.jsx(ns,{children:s.jsx(os,{children:s.jsx(rs,{children:s.jsx(is,{children:"Members"})})})})}),t[59]=_e):_e=t[59];let Ze;t[60]===Symbol.for("react.memo_cache_sentinel")?(Ze=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=Ze):Ze=t[60];let we;t[61]!==y||t[62]!==p||t[63]!==h||t[64]!==a?(we=s.jsxs(ve.Header,{children:[_e,s.jsxs(ve.Header.Right,{children:[s.jsx(ts,{viewMode:a,onViewModeChange:T,sortKey:h,sortDirection:p,onSort:y,sortOptions:Ze}),fe]})]}),t[61]=y,t[62]=p,t[63]=h,t[64]=a,t[65]=we):we=t[65];let Ye;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ye=k=>{k.key==="Escape"&&(b(""),k.target.blur())},t[66]=Ye):Ye=t[66];let Re;t[67]!==m?(Re=s.jsx(De,{value:m,onChange:b,placeholder:"Search members...",onKeyDown:Ye}),t[67]=m,t[68]=Re):Re=t[68];const lt=ve,at=a==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:Z.length===0?s.jsx(ct,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:Z.map(k=>{if(k.type==="invitation")return s.jsxs(wt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Dt,{invitationId:k.data.id,onCancel:x,isCancelling:o.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{fallback:rt(k.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:k.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(ye,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>_.mutate({invitationId:de,role:pe,email:k.data.email}),className:"w-fit"})]})]})]},`inv-${k.data.id}`);const $=k.data;return s.jsxs(wt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Mt,{member:$,roles:S,onChangeRole:(de,pe)=>L.mutate({memberId:de,role:pe}),onRemove:i,isUpdating:L.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{url:$.user?.image??void 0,fallback:rt($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(st,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>L.mutate({memberId:de,role:pe}),className:"w-fit"}),s.jsx(Zt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:c,data:Z,isLoading:!1,sortKey:h,sortDirection:p,onSort:y,emptyState:m?s.jsx(ct,{title:"No members found",description:`No members match "${m}"`}):s.jsx(ct,{title:"No members found",description:"Invite members to get started."})});let Le;t[69]!==lt.Content||t[70]!==at?(Le=s.jsx(lt.Content,{children:at}),t[69]=lt.Content,t[70]=at,t[71]=Le):Le=t[71];let We;return t[72]!==Y||t[73]!==se||t[74]!==be||t[75]!==we||t[76]!==Re||t[77]!==Le?(We=s.jsxs(Y,{children:[se,be,we,Re,Le]}),t[72]=Y,t[73]=se,t[74]=be,t[75]=we,t[76]=Re,t[77]=Le,t[78]=We):We=t[78],We}function Ln(t){return{type:"invitation",data:t}}function Pn(t){return t.status==="pending"}function Mn(t){return{type:"member",data:t}}function Dn(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?On(t.data.createdAt):"N/A"}):s.jsx(ye,{variant:"outline",children:"Pending"})}function kn(t){return t.type==="member"?s.jsx(Zt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function zn(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{url:t.data.user?.image??void 0,fallback:rt(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{fallback:rt(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Un(t){return t.role!=="owner"}function Vn(t){le.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Gn(t){const{invitationId:e,role:n,email:o}=t,l=await me.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const r=await me.organization.inviteMember({email:o,role:n});if(r?.error)throw new Error(r.error.message)}function Bn(t){le.error(t instanceof Error?t.message:"Failed to update role")}async function $n(t){const{memberId:e,role:n}=t,o=await me.organization.updateMemberRole({memberId:e,role:[n]});if(o?.error)throw new Error(o.error.message)}function Fn(t){le.error(t instanceof Error?t.message:"Failed to remove member")}async function Kn(t){const e=await me.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function Qn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function qo(){const t=oe.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ve,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(es,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(ve,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(He,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Rn,{})})}),t[1]=n):n=t[1],n}export{qo as default};
@@ -1 +0,0 @@
1
- import{r as C,c as we,e as Be,j as t,$ as Fe,E as Te,u as Ee,n as Me,m as Re,K as ve,aD as ze,B as re,t as pe}from"./index-3zbyfLqi.js";import{h as $e}from"./use-connection-Dlr-wAwU.js";import{u as Oe,a as Ae}from"./constants-3MhIA0pZ.js";import{I as le}from"./input-DVv1wKLp.js";import{I as ke}from"./integration-icon-_0Y5dukY.js";import{C as We}from"./checkbox-Dj6Qb3KC.js";import{a as Le,b as Ve,P as Ue}from"./popover-7xIJyxqf.js";import{i as Ge}from"./AlignLeft-y_Ps49tB.js";import{t as Ie}from"./ChevronDown-jKZz68gN.js";import{S as je,a as be,b as ye,c as Ne,d as w,n as Ke}from"./select-DaTaxi5W.js";import{s as qe}from"./Hash02-CyfLltcT.js";import{i as He}from"./Play-CBKoaI1n.js";import{s as Qe}from"./Plus-kcfCg7FH.js";import{s as Je}from"./Trash01-Dhrt1Goe.js";import{T as Ye,a as Se}from"./toggle-group-Ck1YCESf.js";import{a as Ze,V as Xe}from"./layout-DemCWqB_.js";import{S as et}from"./save-actions-CXaB5WYr.js";import{B as tt,a as st,b as Pe,d as rt,e as lt,c as at}from"./breadcrumb-Dxn3nF83.js";import"./useMutation-CqJLXgOK.js";import"./Container-BADgIox6.js";import"./Check-Cjs4C9GE.js";import"./index-DziKeC8s.js";import"./index-DZgOYNf-.js";import"./localstorage-keys-D2dx16dH.js";import"./useQuery-DWLTdDjg.js";import"./tooltip-CzsT_Xmu.js";import"./Save01-CgyWcG00.js";import"./Loading01-BSgMOGt8.js";import"./ChevronRight-O5hZNhHU.js";const _e=({size:l=24,color:e="currentColor",...s})=>C.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},C.createElement("path",{d:"M8 15v2m4-6v6m4-10v10m-8.2 4h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C18.72 3 17.88 3 16.2 3H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21Z"}));_e.displayName="BarChartSquare02";function De(l){return{id:l.id,name:l.name,type:l.type,sourcePath:l.source.path,sourceFrom:l.source.from,aggregationFn:l.aggregation.fn,groupBy:l.aggregation.groupBy||"",interval:l.aggregation.interval||""}}function it(l){return{id:l.id,name:l.name,type:l.type,source:{path:l.sourcePath,from:l.sourceFrom},aggregation:{fn:l.aggregationFn,groupBy:l.type==="table"&&l.groupBy?l.groupBy:void 0,interval:l.type==="timeseries"&&l.interval?l.interval:void 0}}}const Ce={id:crypto.randomUUID(),name:"",type:"metric",sourcePath:"$.usage.total_tokens",sourceFrom:"output",aggregationFn:"sum",groupBy:"",interval:""};function nt(l){const e=we.c(36),{result:s,widget:o}=l;if(s.error){let i;return e[0]!==s.error?(i=t.jsx("div",{className:"text-sm text-destructive bg-destructive/10 rounded p-3",children:s.error}),e[0]=s.error,e[1]=i):i=e[1],i}if(o.type==="metric"){const i=s.value??0;let d;e[2]!==i?(d=i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(2)}K`:typeof i=="number"?i.toFixed(2):String(i),e[2]=i,e[3]=d):d=e[3];const c=d;let m;e[4]!==c?(m=t.jsx("div",{className:"text-3xl font-bold tabular-nums",children:c}),e[4]=c,e[5]=m):m=e[5];const x=s.matchedRecords??0;let h;e[6]!==x?(h=t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[x," records matched"]}),e[6]=x,e[7]=h):h=e[7];let f;return e[8]!==m||e[9]!==h?(f=t.jsxs("div",{className:"text-center py-4",children:[m,h]}),e[8]=m,e[9]=h,e[10]=f):f=e[10],f}if(o.type==="table"&&s.groups){let i;e[11]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("thead",{className:"bg-muted/50 sticky top-0",children:t.jsxs("tr",{children:[t.jsx("th",{className:"text-left px-3 py-1.5 text-xs font-medium",children:"Key"}),t.jsx("th",{className:"text-right px-3 py-1.5 text-xs font-medium",children:"Value"})]})}),e[11]=i):i=e[11];let d;e[12]!==s.groups?(d=s.groups.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:2,className:"px-3 py-4 text-center text-muted-foreground text-xs",children:"No data"})}):s.groups.slice(0,10).map(ct),e[12]=s.groups,e[13]=d):d=e[13];let c;e[14]!==d?(c=t.jsxs("table",{className:"w-full text-sm",children:[i,t.jsx("tbody",{children:d})]}),e[14]=d,e[15]=c):c=e[15];let m;e[16]!==s.groups.length?(m=s.groups.length>10&&t.jsxs("div",{className:"text-xs text-muted-foreground text-center py-2",children:["+",s.groups.length-10," more rows"]}),e[16]=s.groups.length,e[17]=m):m=e[17];let x;return e[18]!==c||e[19]!==m?(x=t.jsxs("div",{className:"max-h-[200px] overflow-auto",children:[c,m]}),e[18]=c,e[19]=m,e[20]=x):x=e[20],x}if(o.type==="timeseries"&&s.timeseries){let i;e[21]!==s.timeseries?(i=Math.max(...s.timeseries.map(ot),1),e[21]=s.timeseries,e[22]=i):i=e[22];const d=i;let c;if(e[23]!==d||e[24]!==s.timeseries){let f;e[26]!==d?(f=(u,N)=>t.jsx("div",{className:"flex-1 bg-primary/80 rounded-t",style:{height:`${u.value/d*100}%`,minHeight:u.value>0?"2px":"0px"},title:`${new Date(u.timestamp).toLocaleString()}: ${u.value}`},N),e[26]=d,e[27]=f):f=e[27],c=s.timeseries.slice(-24).map(f),e[23]=d,e[24]=s.timeseries,e[25]=c}else c=e[25];let m;e[28]!==c?(m=t.jsx("div",{className:"flex items-end gap-0.5 h-[80px]",children:c}),e[28]=c,e[29]=m):m=e[29];let x;e[30]!==s.timeseries.length?(x=t.jsxs("div",{className:"text-xs text-muted-foreground text-center mt-2",children:[s.timeseries.length," data points"]}),e[30]=s.timeseries.length,e[31]=x):x=e[31];let h;return e[32]!==m||e[33]!==x?(h=t.jsxs("div",{className:"py-2",children:[m,x]}),e[32]=m,e[33]=x,e[34]=h):h=e[34],h}let j;return e[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No preview data"}),e[35]=j):j=e[35],j}function ot(l){return l.value}function ct(l,e){return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-1.5 font-mono text-xs",children:l.key}),t.jsx("td",{className:"px-3 py-1.5 text-right tabular-nums text-xs",children:l.value.toLocaleString()})]},e)}function mt(l){const e=we.c(113),{widget:s,onChange:o,onRemove:j,canRemove:i,onMoveUp:d,onMoveDown:c,canMoveUp:m,canMoveDown:x,onPreview:h,previewResult:f,isPreviewing:u}=l,N=!m;let z;e[0]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(Ke,{size:14}),e[0]=z):z=e[0];let D;e[1]!==d||e[2]!==N?(D=t.jsx(re,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:d,disabled:N,children:z}),e[1]=d,e[2]=N,e[3]=D):D=e[3];const ae=!x;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Ie,{size:14}),e[4]=g):g=e[4];let p;e[5]!==c||e[6]!==ae?(p=t.jsx(re,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:c,disabled:ae,children:g}),e[5]=c,e[6]=ae,e[7]=p):p=e[7];let k;e[8]!==D||e[9]!==p?(k=t.jsxs("div",{className:"flex items-center gap-0.5",children:[D,p]}),e[8]=D,e[9]=p,e[10]=k):k=e[10];let S;e[11]!==s.type?(S=t.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:s.type}),e[11]=s.type,e[12]=S):S=e[12];let F;e[13]!==s.name?(F=s.name&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-muted-foreground",children:"·"}),t.jsx("span",{className:"text-sm font-medium",children:s.name})]}),e[13]=s.name,e[14]=F):F=e[14];let _;e[15]!==k||e[16]!==S||e[17]!==F?(_=t.jsxs("div",{className:"flex items-center gap-2",children:[k,S,F]}),e[15]=k,e[16]=S,e[17]=F,e[18]=_):_=e[18];let P;e[19]!==u?(P=u?t.jsx(Fe,{size:14,className:"animate-spin"}):t.jsx(He,{size:14}),e[19]=u,e[20]=P):P=e[20];let B;e[21]!==u||e[22]!==h||e[23]!==P?(B=t.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,disabled:u,children:P}),e[21]=u,e[22]=h,e[23]=P,e[24]=B):B=e[24];const $=!i,ie=i?"visible":"hidden";let T;e[25]!==ie?(T={visibility:ie},e[25]=ie,e[26]=T):T=e[26];let O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(Je,{size:14}),e[27]=O):O=e[27];let E;e[28]!==j||e[29]!==$||e[30]!==T?(E=t.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,disabled:$,style:T,children:O}),e[28]=j,e[29]=$,e[30]=T,e[31]=E):E=e[31];let M;e[32]!==B||e[33]!==E?(M=t.jsxs("div",{className:"flex items-center gap-1",children:[B,E]}),e[32]=B,e[33]=E,e[34]=M):M=e[34];let R;e[35]!==_||e[36]!==M?(R=t.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b bg-muted/30",children:[_,M]}),e[35]=_,e[36]=M,e[37]=R):R=e[37];let r;e[38]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Widget Name"}),e[38]=r):r=e[38];let a;e[39]!==o||e[40]!==s?(a=b=>o({...s,name:b.target.value}),e[39]=o,e[40]=s,e[41]=a):a=e[41];let n;e[42]!==a||e[43]!==s.name?(n=t.jsxs("div",{children:[r,t.jsx(le,{placeholder:"e.g., Total Tokens",value:s.name,onChange:a})]}),e[42]=a,e[43]=s.name,e[44]=n):n=e[44];let v;e[45]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Type"}),e[45]=v):v=e[45];let y;e[46]!==o||e[47]!==s?(y=b=>{b&&o({...s,type:b,groupBy:b==="table"?s.groupBy:"",interval:b==="timeseries"?s.interval||"1h":""})},e[46]=o,e[47]=s,e[48]=y):y=e[48];let I;e[49]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(Se,{value:"metric",className:"flex-1 h-full data-[state=on]:!bg-accent/70","aria-label":"Metric",children:t.jsx(qe,{size:14})}),e[49]=I):I=e[49];let A;e[50]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Se,{value:"timeseries",className:"flex-1 h-full data-[state=on]:!bg-accent/70","aria-label":"Timeseries",children:t.jsx(_e,{size:14})}),e[50]=A):A=e[50];let ne;e[51]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Se,{value:"table",className:"flex-1 h-full data-[state=on]:!bg-accent/70","aria-label":"Table",children:t.jsx(Ge,{size:14})}),e[51]=ne):ne=e[51];let W;e[52]!==y||e[53]!==s.type?(W=t.jsxs("div",{children:[v,t.jsxs(Ye,{type:"single",variant:"outline",size:"sm",value:s.type,onValueChange:y,className:"w-full h-10",children:[I,A,ne]})]}),e[52]=y,e[53]=s.type,e[54]=W):W=e[54];let L;e[55]!==n||e[56]!==W?(L=t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n,W]}),e[55]=n,e[56]=W,e[57]=L):L=e[57];let oe;e[58]===Symbol.for("react.memo_cache_sentinel")?(oe=t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"JSONPath Expression"}),e[58]=oe):oe=e[58];let V;e[59]!==o||e[60]!==s?(V=b=>o({...s,sourcePath:b.target.value}),e[59]=o,e[60]=s,e[61]=V):V=e[61];let U;e[62]!==V||e[63]!==s.sourcePath?(U=t.jsx(le,{placeholder:"$.usage.total_tokens",value:s.sourcePath,onChange:V,className:"font-mono text-sm"}),e[62]=V,e[63]=s.sourcePath,e[64]=U):U=e[64];let G;e[65]!==s.sourceFrom?(G=t.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path to extract from tool call ",s.sourceFrom]}),e[65]=s.sourceFrom,e[66]=G):G=e[66];let K;e[67]!==U||e[68]!==G?(K=t.jsxs("div",{children:[oe,U,G]}),e[67]=U,e[68]=G,e[69]=K):K=e[69];let ce;e[70]===Symbol.for("react.memo_cache_sentinel")?(ce=t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Extract From"}),e[70]=ce):ce=e[70];let q;e[71]!==o||e[72]!==s?(q=b=>o({...s,sourceFrom:b}),e[71]=o,e[72]=s,e[73]=q):q=e[73];let me;e[74]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx(be,{children:t.jsx(ye,{})}),e[74]=me):me=e[74];let de;e[75]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsxs(Ne,{children:[t.jsx(w,{value:"output",children:"Output"}),t.jsx(w,{value:"input",children:"Input"})]}),e[75]=de):de=e[75];let H;e[76]!==q||e[77]!==s.sourceFrom?(H=t.jsxs("div",{children:[ce,t.jsxs(je,{value:s.sourceFrom,onValueChange:q,children:[me,de]})]}),e[76]=q,e[77]=s.sourceFrom,e[78]=H):H=e[78];let ue;e[79]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Aggregation"}),e[79]=ue):ue=e[79];let Q;e[80]!==o||e[81]!==s?(Q=b=>o({...s,aggregationFn:b}),e[80]=o,e[81]=s,e[82]=Q):Q=e[82];let xe;e[83]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(be,{children:t.jsx(ye,{})}),e[83]=xe):xe=e[83];let he;e[84]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsxs(Ne,{children:[t.jsx(w,{value:"sum",children:"Sum"}),t.jsx(w,{value:"avg",children:"Average"}),t.jsx(w,{value:"min",children:"Minimum"}),t.jsx(w,{value:"max",children:"Maximum"}),t.jsx(w,{value:"count",children:"Count"}),t.jsx(w,{value:"last",children:"Last"})]}),e[84]=he):he=e[84];let J;e[85]!==Q||e[86]!==s.aggregationFn?(J=t.jsxs("div",{children:[ue,t.jsxs(je,{value:s.aggregationFn,onValueChange:Q,children:[xe,he]})]}),e[85]=Q,e[86]=s.aggregationFn,e[87]=J):J=e[87];let Y;e[88]!==H||e[89]!==J?(Y=t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[H,J]}),e[88]=H,e[89]=J,e[90]=Y):Y=e[90];let Z;e[91]!==o||e[92]!==s?(Z=s.type==="table"&&t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Group By (JSONPath)"}),t.jsx(le,{placeholder:"$.model",value:s.groupBy,onChange:b=>o({...s,groupBy:b.target.value}),className:"font-mono text-sm"})]}),e[91]=o,e[92]=s,e[93]=Z):Z=e[93];let X;e[94]!==o||e[95]!==s?(X=s.type==="timeseries"&&t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Time Interval"}),t.jsxs(je,{value:s.interval||"1h",onValueChange:b=>o({...s,interval:b}),children:[t.jsx(be,{children:t.jsx(ye,{})}),t.jsxs(Ne,{children:[t.jsx(w,{value:"15m",children:"15 minutes"}),t.jsx(w,{value:"1h",children:"1 hour"}),t.jsx(w,{value:"1d",children:"1 day"})]})]})]}),e[94]=o,e[95]=s,e[96]=X):X=e[96];let ee;e[97]!==L||e[98]!==K||e[99]!==Y||e[100]!==Z||e[101]!==X?(ee=t.jsxs("div",{className:"space-y-4",children:[L,K,Y,Z,X]}),e[97]=L,e[98]=K,e[99]=Y,e[100]=Z,e[101]=X,e[102]=ee):ee=e[102];let fe;e[103]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("div",{className:"px-3 py-2 border-b text-xs font-medium text-muted-foreground",children:"Preview (last 24h)"}),e[103]=fe):fe=e[103];let te;e[104]!==f||e[105]!==s?(te=t.jsxs("div",{className:"border rounded-lg bg-muted/20 flex flex-col",children:[fe,t.jsx("div",{className:"p-3 flex-1 flex items-center justify-center",children:f?t.jsx(nt,{result:f,widget:s}):t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:'Click "Preview" to test your aggregation'})})]}),e[104]=f,e[105]=s,e[106]=te):te=e[106];let se;e[107]!==ee||e[108]!==te?(se=t.jsx("div",{className:"p-4",children:t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[ee,te]})}),e[107]=ee,e[108]=te,e[109]=se):se=e[109];let ge;return e[110]!==R||e[111]!==se?(ge=t.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[R,se]}),e[110]=R,e[111]=se,e[112]=ge):ge=e[112],ge}function dt({dashboardId:l}){const{org:e,project:s,locator:o}=Ee(),j=Me(),i=Oe({connectionId:Ae,orgId:e.id}),d=$e(),{data:c}=Re({queryKey:ve.monitoringDashboardDetails(o,l),queryFn:async()=>{if(!i)throw new Error("MCP client not available");const r=await i.callTool({name:"MONITORING_DASHBOARD_GET",arguments:{id:l}});return r.structuredContent??r}}),[m,x]=C.useState(c?.name??""),[h,f]=C.useState(c?.description??""),[u,N]=C.useState(c?.widgets?.map(De)??[{...Ce}]),[z,D]=C.useState(!1),[ae,g]=C.useState(!1),[p,k]=C.useState(c?.filters?.connectionIds??[]),[S,F]=C.useState(c?.filters?.toolNames?.[0]??""),[_,P]=C.useState({}),[B,$]=C.useState(new Set),ie=()=>{N([...u,{...Ce,id:crypto.randomUUID()}]),g(!0)},T=r=>{N(u.filter((a,n)=>n!==r)),g(!0)},O=(r,a)=>{const n=[...u];n[r]=a,N(n),g(!0),P(v=>{const y={...v};return delete y[a.id],y})},E=async r=>{if(i){$(a=>new Set(a).add(r.id));try{const a=new Date,n=new Date(a.getTime()-1440*60*1e3),v={};p.length>0&&(v.connectionIds=p),S.trim()&&(v.toolNames=[S.trim()]);const I=(await i.callTool({name:"MONITORING_WIDGET_PREVIEW",arguments:{widget:{type:r.type,source:{path:r.sourcePath,from:r.sourceFrom},aggregation:{fn:r.aggregationFn,groupBy:r.type==="table"&&r.groupBy?r.groupBy:void 0,interval:r.type==="timeseries"&&r.interval?r.interval:void 0},filter:Object.keys(v).length>0?v:void 0},timeRange:{startDate:n.toISOString(),endDate:a.toISOString()}}})).structuredContent;P(A=>({...A,[r.id]:{value:I?.value,groups:I?.groups,timeseries:I?.timeseries,matchedRecords:I?.matchedRecords??0}}))}catch(a){console.error("Preview failed:",a),P(n=>({...n,[r.id]:{error:"Preview failed. Check your JSONPath expression."}}))}finally{$(a=>{const n=new Set(a);return n.delete(r.id),n})}}},M=async()=>{if(i){if(!m.trim()){pe.error("Please enter a dashboard name");return}if(u.some(r=>!r.name.trim())){pe.error("Please enter a name for all widgets");return}D(!0);try{const r={};p.length>0&&(r.connectionIds=p),S.trim()&&(r.toolNames=[S.trim()]),await i.callTool({name:"MONITORING_DASHBOARD_UPDATE",arguments:{id:l,name:m.trim(),description:h.trim()||null,filters:Object.keys(r).length>0?r:null,widgets:u.map(it)}}),pe.success("Dashboard saved"),g(!1),j.invalidateQueries({queryKey:ve.monitoringDashboards(o)}),j.invalidateQueries({queryKey:ve.monitoringDashboardDetails(o,l)})}catch(r){pe.error("Failed to save dashboard"),console.error(r)}finally{D(!1)}}};if(!c)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Dashboard not found"});const R=t.jsx(tt,{children:t.jsxs(st,{children:[t.jsx(Pe,{children:t.jsx(rt,{asChild:!0,children:t.jsx(ze,{to:"/$org/$project/monitoring",params:{org:e.slug,project:s.slug},search:{tab:"dashboards"},children:"Monitoring"})})}),t.jsx(lt,{}),t.jsx(Pe,{children:t.jsxs(at,{children:["Edit ",c.name]})})]})});return t.jsxs(Ze,{breadcrumb:R,children:[t.jsx(Xe,{children:t.jsx(et,{onSave:M,onUndo:()=>{x(c?.name??""),f(c?.description??""),N(c?.widgets?.map(De)??[{...Ce}]),k(c?.filters?.connectionIds??[]),F(c?.filters?.toolNames?.[0]??""),g(!1)},isDirty:ae,isSaving:z})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:t.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Dashboard Name"}),t.jsx(le,{placeholder:"e.g., LLM Usage Overview",value:m,onChange:r=>{x(r.target.value),g(!0)}})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Description"}),t.jsx(le,{placeholder:"What does this dashboard show?",value:h,onChange:r=>{f(r.target.value),g(!0)}})]})]}),t.jsxs("div",{className:"border rounded-lg p-4 bg-muted/30",children:[t.jsxs("h2",{className:"text-sm font-medium mb-3",children:["Dashboard Filters",t.jsx("span",{className:"text-muted-foreground font-normal ml-2",children:"(applied to all widgets)"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Servers"}),t.jsxs(Le,{children:[t.jsx(Ve,{asChild:!0,children:t.jsxs(re,{variant:"outline",className:"w-full justify-between font-normal",children:[t.jsx("span",{className:"flex items-center gap-2 truncate",children:p.length===0?t.jsx("span",{className:"text-muted-foreground",children:"All servers"}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"flex items-center -space-x-1",children:p.slice(0,3).map(r=>{const a=(d??[]).find(n=>n.id===r);return a?t.jsx(ke,{icon:a.icon,name:a.title||a.id,size:"xs"},r):null})}),t.jsxs("span",{children:[p.length," server",p.length!==1?"s":""]})]})}),t.jsx(Ie,{size:14,className:"text-muted-foreground shrink-0"})]})}),t.jsxs(Ue,{align:"start",className:"w-72 p-1",children:[t.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:(d??[]).map(r=>{const a=p.includes(r.id);return t.jsxs("button",{type:"button",className:"flex items-center gap-3 w-full rounded-md px-2 py-2 text-sm hover:bg-muted transition-colors",onClick:()=>{k(n=>a?n.filter(v=>v!==r.id):[...n,r.id]),g(!0)},children:[t.jsx(We,{checked:a}),t.jsx(ke,{icon:r.icon,name:r.title||r.id,size:"xs"}),t.jsx("span",{className:"truncate",children:r.title||r.id})]},r.id)})}),p.length>0&&t.jsx("div",{className:"border-t p-1",children:t.jsx("button",{type:"button",className:"w-full text-xs text-muted-foreground hover:text-foreground py-1.5 transition-colors",onClick:()=>{k([]),g(!0)},children:"Clear selection"})})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium block mb-1.5",children:"Tool Name Filter"}),t.jsx(le,{placeholder:"e.g., openai_chat",value:S,onChange:r=>{F(r.target.value),g(!0)},className:"font-mono text-sm"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Filter to specific tool names (partial match)"})]})]})]}),t.jsxs("div",{className:"mt-12",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-lg font-medium",children:"Widgets"}),t.jsxs(re,{variant:"outline",size:"sm",onClick:ie,children:[t.jsx(Qe,{size:14,className:"mr-1.5"}),"Add Widget"]})]}),t.jsx("div",{className:"space-y-4",children:u.map((r,a)=>t.jsx(mt,{widget:r,onChange:n=>O(a,n),onRemove:()=>T(a),canRemove:u.length>1,onMoveUp:()=>{const n=[...u],v=n[a-1],y=n[a];n[a-1]=y,n[a]=v,N(n),g(!0)},onMoveDown:()=>{const n=[...u],v=n[a],y=n[a+1];n[a]=y,n[a+1]=v,N(n),g(!0)},canMoveUp:a>0,canMoveDown:a<u.length-1,onPreview:()=>E(r),previewResult:_[r.id]??null,isPreviewing:B.has(r.id)},r.id))})]})]})})]})}function Wt(){const l=we.c(5);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},l[0]=e):e=l[0];const{dashboardId:s}=Be(e);let o;l[1]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Failed to load dashboard editor"}),l[1]=o):o=l[1];let j;l[2]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Fe,{size:24,className:"animate-spin text-muted-foreground"})}),l[2]=j):j=l[2];let i;return l[3]!==s?(i=t.jsx(Te,{fallback:o,children:t.jsx(C.Suspense,{fallback:j,children:t.jsx(dt,{dashboardId:s})})}),l[3]=s,l[4]=i):i=l[4],i}export{Wt as default};
@@ -1 +0,0 @@
1
- import{r as j,c as b,j as s,v as D,E as ee,u as te,d as se,B as ie}from"./index-3zbyfLqi.js";import{V as le,C as h}from"./index-CW624IAb.js";import{E as re,C as Z}from"./editable-task-title-D4gyoQ4x.js";import{a as G}from"./tasks-panel-DLy55FSi.js";import{u as U,a as oe}from"./collapsible-D2Mpu85K.js";import{I as J}from"./integration-icon-_0Y5dukY.js";import{b as ne,P as ae,a as ce}from"./popover-7xIJyxqf.js";import{S as q}from"./skeleton-C9OYLAME.js";import{i as me,d as de}from"./constants-3MhIA0pZ.js";import{b as fe}from"./use-virtual-mcp-BjGr5L6n.js";import{i as ue}from"./ChevronRight-O5hZNhHU.js";import{t as Q}from"./Users03-DHATZiFL.js";import{P as $}from"./index-DZgOYNf-.js";import{R,a as F,b as K}from"./resizable-PA9Y3YAt.js";import"./spinner-RGw-eBKN.js";import"./tooltip-CzsT_Xmu.js";import"./index-DziKeC8s.js";import"./decopilot-events-CA9aFPSQ.js";import"./useQuery-DWLTdDjg.js";import"./dialog-CPWJMuHX.js";import"./X-BpJJDPzv.js";import"./form-7Q-FsNtX.js";import"./label-CfzCa7Vm.js";import"./input-DVv1wKLp.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-N8lcMBug.js";import"./ChevronDown-jKZz68gN.js";import"./Edit01-kvm_TgXf.js";import"./XCircle-D52fnGO6.js";import"./AlertCircle-C0eftc-S.js";import"./select-DaTaxi5W.js";import"./Check-Cjs4C9GE.js";import"./tabs-t9dEapgX.js";import"./localstorage-keys-D2dx16dH.js";import"./useMutation-CqJLXgOK.js";import"./ArrowLeft-BNX_fMaj.js";import"./use-copy-C0vtJ5Ye.js";import"./badge-DSAomO1_.js";import"./Code01-DVgdcTZ1.js";import"./SearchMd-DyDznS8C.js";import"./use-create-virtual-mcp-CsNENE7l.js";import"./use-mcp-resources-DjDOJ-nS.js";import"./Copy01-CwZDv92A.js";import"./marked.esm-BaswSlok.js";import"./markdown-89WWPNXO.js";import"./mcp-app-renderer-MJ3LmhBP.js";import"./types-BFBQ7LBo.js";import"./Eye-BCmEvczH.js";import"./Globe02-D-yCMf5N.js";import"./LayersTwo01-rKs-Uww3.js";import"./XClose-DcdK3w1e.js";import"./collection-search-FSS_Lkwz.js";import"./Loading01-BSgMOGt8.js";import"./use-connection-Dlr-wAwU.js";import"./generate-id-Dyweu44Y.js";import"./Clock-CZrEpwOM.js";import"./Trash01-Dhrt1Goe.js";import"./CheckCircle-KfoOm4QY.js";import"./ChevronLeft-DrJ63fdN.js";import"./user-vKqDbtP6.js";import"./avatar-VPsqzp0K.js";import"./format-time-CMKyl-GC.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-kcfCg7FH.js";import"./use-llm-B6AzV9Iw.js";import"./use-binding-Cz4OU82g.js";import"./binder-8_Oel13A.js";import"./checkbox-Dj6Qb3KC.js";import"./AlignLeft-y_Ps49tB.js";import"./Image01-Dg_KnZBd.js";import"./RefreshCcw01-DiAOUquJ.js";import"./Settings01-B90Jx8ZC.js";import"./useSuspenseInfiniteQuery-YGfVGowO.js";import"./infiniteQueryObserver-DkOiuhUg.js";import"./Container-BADgIox6.js";const X=({size:e=24,color:t="currentColor",...i})=>j.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},j.createElement("path",{d:"M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"}));X.displayName="LayoutRight";const Y=({size:e=24,color:t="currentColor",...i})=>j.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},j.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Y.displayName="MessageChatSquare";function pe(e){const t=b.c(15),{agent:i}=e,{setVirtualMcpId:p}=U();let c;t[0]!==i.id||t[1]!==p?(c=()=>{p(i.id)},t[0]=i.id,t[1]=p,t[2]=c):c=t[2];const r=c;let m;t[3]===Symbol.for("react.memo_cache_sentinel")?(m=D("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=m):m=t[3];const f=`Select agent ${i.title}`;let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Q,{size:20}),t[4]=o):o=t[4];let n;t[5]!==i.icon||t[6]!==i.title?(n=s.jsx(J,{icon:i.icon,name:i.title,fallbackIcon:o}),t[5]=i.icon,t[6]=i.title,t[7]=n):n=t[7];let l;t[8]!==i.title?(l=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:i.title}),t[8]=i.title,t[9]=l):l=t[9];let a;return t[10]!==r||t[11]!==f||t[12]!==n||t[13]!==l?(a=s.jsxs("button",{type:"button",onClick:r,className:m,"aria-label":f,children:[n,l]}),t[10]=r,t[11]=f,t[12]=n,t[13]=l,t[14]=a):a=t[14],a}function xe(e){const t=b.c(14),{virtualMcps:i,selectedVirtualMcpId:p,onVirtualMcpChange:c}=e,[r,m]=j.useState(!1),f=j.useRef(null);let o,n;t[0]!==r?(o=()=>{r&&setTimeout(()=>{f.current?.focus()},0)},n=[r],t[0]=r,t[1]=o,t[2]=n):(o=t[1],n=t[2]),j.useEffect(o,n);let l;t[3]!==c?(l=N=>{c(N),m(!1)},t[3]=c,t[4]=l):l=t[4];const a=l;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=D("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ne,{asChild:!0,children:s.jsxs("button",{type:"button",className:d,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(ue,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let x;t[7]!==a||t[8]!==p||t[9]!==i?(x=s.jsx(ae,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(le,{virtualMcps:i,selectedVirtualMcpId:p,onVirtualMcpChange:a,searchInputRef:f})}),t[7]=a,t[8]=p,t[9]=i,t[10]=x):x=t[10];let A;return t[11]!==r||t[12]!==x?(A=s.jsxs(ce,{open:r,onOpenChange:m,children:[u,x]}),t[11]=r,t[12]=x,t[13]=A):A=t[13],A}function he(){const e=b.c(20),t=fe(),{selectedVirtualMcp:i,setVirtualMcpId:p}=U();let c,r,m,f,o,n;if(e[0]!==t){o=Symbol.for("react.early_return_sentinel");e:{const x=t.filter(be).slice(0,6);if(x.length===0){o=null;break e}n=t.map(ge),m="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=f):f=e[7],c="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",r=x.map(je)}e[0]=t,e[1]=c,e[2]=r,e[3]=m,e[4]=f,e[5]=o,e[6]=n}else c=e[1],r=e[2],m=e[3],f=e[4],o=e[5],n=e[6];if(o!==Symbol.for("react.early_return_sentinel"))return o;const l=i?.id??null;let a;e[8]!==p||e[9]!==l||e[10]!==n?(a=s.jsx(xe,{virtualMcps:n,selectedVirtualMcpId:l,onVirtualMcpChange:p}),e[8]=p,e[9]=l,e[10]=n,e[11]=a):a=e[11];let d;e[12]!==c||e[13]!==r||e[14]!==a?(d=s.jsxs("div",{className:c,children:[r,a]}),e[12]=c,e[13]=r,e[14]=a,e[15]=d):d=e[15];let u;return e[16]!==m||e[17]!==f||e[18]!==d?(u=s.jsxs("div",{className:m,children:[f,d]}),e[16]=m,e[17]=f,e[18]=d,e[19]=u):u=e[19],u}function je(e){return s.jsx(pe,{agent:e},e.id??"default")}function ge(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function be(e){return e.id!==null&&!me(e.id)}function Ne(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(q,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Ce)})]}),e[1]=i):i=e[1],i}function Ce(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(q,{className:"size-6 rounded-md shrink-0"}),s.jsx(q,{className:"h-4 w-full"})]},t)}function ve(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(j.Suspense,{fallback:s.jsx(Ne,{}),children:s.jsx(he,{})}),e[0]=t):t=e[0],t}function Se(){const e=b.c(50),{org:t}=te(),{data:i}=se.useSession(),{modelsConnections:p,isChatEmpty:c,activeTaskId:r,tasks:m,selectedVirtualMcp:f}=oe();let o;if(e[0]!==r||e[1]!==m){let g;e[3]!==r?(g=P=>P.id===r,e[3]=r,e[4]=g):g=e[4],o=m.find(g),e[0]=r,e[1]=m,e[2]=o}else o=e[2];const n=o,[l,a]=j.useState(!1);let d;e[5]!==i?.user?.name?(d=i?.user?.name?.split(" ")[0]||"there",e[5]=i?.user?.name,e[6]=d):d=e[6];const u=d;let x;e[7]!==t.id?(x=de(t.id),e[7]=t.id,e[8]=x):x=e[8];const N=f??x;if(p.length===0){let g,P;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(R,{defaultSize:20,minSize:10,id:"tasks",order:1,children:s.jsx(G,{})}),P=s.jsx(F,{className:"bg-border/30"}),e[9]=g,e[10]=P):(g=e[9],P=e[10]);const W=l?50:80;let V;e[11]!==t?(V=s.jsx("div",{className:"flex flex-col h-full bg-background items-center justify-center",children:s.jsx(h.NoLlmBindingEmptyState,{org:t})}),e[11]=t,e[12]=V):V=e[12];let E;e[13]!==W||e[14]!==V?(E=s.jsx(R,{defaultSize:W,minSize:30,id:"main",order:2,children:V}),e[13]=W,e[14]=V,e[15]=E):E=e[15];let I;e[16]!==l?(I=l&&s.jsxs(s.Fragment,{children:[s.jsx(F,{className:"bg-border/30"}),s.jsx(R,{defaultSize:30,minSize:15,id:"context",order:3,children:s.jsx(Z,{onClose:()=>a(!1)})})]}),e[16]=l,e[17]=I):I=e[17];let B;return e[18]!==E||e[19]!==I?(B=s.jsxs(K,{direction:"horizontal",className:"size-full",children:[g,P,E,I]}),e[18]=E,e[19]=I,e[20]=B):B=e[20],B}let H,L;e[21]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(R,{defaultSize:20,minSize:10,id:"tasks",order:1,children:s.jsx(G,{})}),L=s.jsx(F,{className:"bg-border/30"}),e[21]=H,e[22]=L):(H=e[21],L=e[22]);const O=l?50:80;let C;e[23]!==n?(C=n?.title&&s.jsx(re,{taskId:n.id,text:n.title,className:"text-sm font-medium text-foreground"}),e[23]=n,e[24]=C):C=e[24];let v;e[25]!==C?(v=s.jsx($.Header.Left,{className:"gap-2",children:C}),e[25]=C,e[26]=v):v=e[26];let S;e[27]!==c||e[28]!==l?(S=!c&&s.jsx("button",{type:"button",onClick:()=>a(ye),className:D("flex size-7 items-center justify-center rounded-md border border-input hover:bg-accent transition-colors",l&&"bg-accent"),title:"Toggle context panel",children:s.jsx(X,{size:14,className:"text-muted-foreground"})}),e[27]=c,e[28]=l,e[29]=S):S=e[29];let y;e[30]!==S?(y=s.jsx($.Header.Right,{className:"gap-1",children:S}),e[30]=S,e[31]=y):y=e[31];let k;e[32]!==v||e[33]!==y?(k=s.jsxs($.Header,{className:"flex-none z-10 bg-background",children:[v,y]}),e[32]=v,e[33]=y,e[34]=k):k=e[34];let _;e[35]!==N||e[36]!==c||e[37]!==u?(_=c?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx(J,{icon:N.icon,name:N.title,size:"md",fallbackIcon:s.jsx(Q,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsx("div",{className:"text-center mb-8",children:s.jsxs("p",{className:"text-xl font-medium text-foreground",children:["What's on your mind, ",u,"?"]})}),s.jsx("div",{className:"w-full",children:s.jsx(h.Input,{})}),s.jsx(h.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(ve,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(h.Main,{children:s.jsx(h.Messages,{})}),s.jsx(h.Footer,{children:s.jsx(h.Input,{onOpenContextPanel:()=>a(!0)})})]}),e[35]=N,e[36]=c,e[37]=u,e[38]=_):_=e[38];let z;e[39]!==k||e[40]!==_?(z=s.jsxs(h,{className:"h-full bg-background",children:[k,_]}),e[39]=k,e[40]=_,e[41]=z):z=e[41];let w;e[42]!==z||e[43]!==O?(w=s.jsx(R,{defaultSize:O,minSize:30,id:"main",order:2,children:z}),e[42]=z,e[43]=O,e[44]=w):w=e[44];let M;e[45]!==l?(M=l&&s.jsxs(s.Fragment,{children:[s.jsx(F,{className:"bg-border/30"}),s.jsx(R,{defaultSize:30,minSize:15,id:"context",order:3,children:s.jsx(Z,{onClose:()=>a(!1)})})]}),e[45]=l,e[46]=M):M=e[46];let T;return e[47]!==w||e[48]!==M?(T=s.jsxs(K,{direction:"horizontal",className:"size-full",children:[H,L,w,M]}),e[47]=w,e[48]=M,e[49]=T):T=e[49],T}function ye(e){return!e}function ke(e){const t=b.c(14),{error:i,onRetry:p}=e,c=i?.message?.includes("401")||i?.message?.toLowerCase().includes("unauthorized");let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs($.Header,{className:"flex-none",children:[s.jsx($.Header.Left,{className:"gap-2"}),s.jsx($.Header.Right,{className:"gap-1"})]}),t[0]=r):r=t[0];let m;t[1]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(Y,{className:"h-6 w-6 text-destructive"})}),t[1]=m):m=t[1];const f=c?"Unable to load models":"Something went wrong";let o;t[2]!==f?(o=s.jsx("h3",{className:"text-lg font-medium",children:f}),t[2]=f,t[3]=o):o=t[3];const n=c?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":i?.message||"An unexpected error occurred";let l;t[4]!==n?(l=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[4]=n,t[5]=l):l=t[5];let a;t[6]!==o||t[7]!==l?(a=s.jsxs("div",{className:"space-y-2",children:[o,l]}),t[6]=o,t[7]=l,t[8]=a):a=t[8];let d;t[9]!==p?(d=s.jsx(ie,{variant:"outline",onClick:p,children:"Try again"}),t[9]=p,t[10]=d):d=t[10];let u;return t[11]!==a||t[12]!==d?(u=s.jsxs(h,{children:[r,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[m,a,d]})})]}),t[11]=a,t[12]=d,t[13]=u):u=t[13],u}function Kt(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ee,{fallback:_e,children:s.jsx(j.Suspense,{fallback:s.jsx(h.Skeleton,{}),children:s.jsx(Se,{})})}),e[0]=t):t=e[0],t}function _e(e){const{error:t,resetError:i}=e;return s.jsx(ke,{error:t,onRetry:i})}export{Kt as default};
@@ -1 +0,0 @@
1
- import{c as Q,r as U,u as re,K as ie,b_ as we,j as t,v as oe,B as Y,b as de,_ as me,$ as ue,O as fe,d as Ie,aC as Te,b$ as ne,E as Re,aE as Pe}from"./index-3zbyfLqi.js";import{P as X}from"./index-DZgOYNf-.js";import{B as $e,a as ke,b as ze,c as Le}from"./breadcrumb-Dxn3nF83.js";import{i as xe}from"./FilterLines-DAyCv-Xk.js";import{n as ge}from"./Inbox01-nkL2-2Zq.js";import{i as se}from"./Loading01-BSgMOGt8.js";import{i as pe}from"./SearchMd-DyDznS8C.js";import{u as he}from"./useQuery-DWLTdDjg.js";import{u as Fe}from"./useInfiniteQuery-CGGEgi5q.js";import{a as Ee,f as _e,b as Oe}from"./registry-utils-Cx5oa6Ne.js";import{u as je,W as Ke,a as Ae,h as Me,b as Be}from"./constants-3MhIA0pZ.js";import{f as De,g as ye,h as Ge}from"./use-connection-Dlr-wAwU.js";import{s as We}from"./slugify-CEUa2lfQ.js";import{C as Ve,E as qe}from"./collection-search-FSS_Lkwz.js";import{M as ae}from"./mcp-server-card-gl2xF4cu.js";import{I as Ue}from"./input-DVv1wKLp.js";import{a as ve,b as be,P as Ne}from"./popover-7xIJyxqf.js";import{i as Ce}from"./Check-Cjs4C9GE.js";import{t as Se}from"./ChevronDown-jKZz68gN.js";import{s as te}from"./XClose-DcdK3w1e.js";import{s as He}from"./Plus-kcfCg7FH.js";import{u as Je}from"./use-binding-Cz4OU82g.js";import{L as Qe,u as Ye}from"./localstorage-keys-D2dx16dH.js";import"./tooltip-CzsT_Xmu.js";import"./index-DziKeC8s.js";import"./ChevronRight-O5hZNhHU.js";import"./infiniteQueryObserver-DkOiuhUg.js";import"./useMutation-CqJLXgOK.js";import"./CheckVerified02-dNCcvCnV.js";import"./Globe02-D-yCMf5N.js";import"./Lock01-T7BR0zuk.js";import"./Terminal-BxQK5nsd.js";import"./card-CRGkE-QK.js";import"./integration-icon-_0Y5dukY.js";import"./Container-BADgIox6.js";import"./github-icon-Dp3wHhYE.js";import"./binder-8_Oel13A.js";function Ze(s,e){const r=Q.c(4),[l,d]=U.useState(s),n=U.useRef(null),i=U.useRef(!0);let c,a;return r[0]!==e||r[1]!==s?(c=()=>{if(i.current){i.current=!1;return}return n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{d(s)},e),()=>{n.current&&clearTimeout(n.current)}},a=[s,e],r[0]=e,r[1]=s,r[2]=c,r[3]=a):(c=r[2],a=r[3]),U.useEffect(c,a),l}function Xe(s){const e=Q.c(14),r=U.useRef(null),l=`scroll-position:${s}`,d=U.useRef(null);let n;e[0]!==l?(n=()=>{r.current&&sessionStorage.setItem(l,String(r.current.scrollTop))},e[0]=l,e[1]=n):n=e[1];const i=n;let c;e[2]!==l?(c=()=>{if(d.current===l)return;const j=sessionStorage.getItem(l);if(j&&r.current){const S=Number.parseInt(j,10);r.current.scrollTop=S}d.current=l},e[2]=l,e[3]=c):c=e[3];const a=c;let g;e[4]!==a||e[5]!==l?(g=()=>{d.current!==l&&a()},e[4]=a,e[5]=l,e[6]=g):g=e[6];const I=g;let o;e[7]!==a||e[8]!==l?(o=j=>{r.current=j,j&&d.current!==l&&requestAnimationFrame(()=>{a()})},e[7]=a,e[8]=l,e[9]=o):o=e[9];const p=o;let m;return e[10]!==I||e[11]!==i||e[12]!==p?(m={scrollRef:p,saveScrollPosition:i,handleScroll:I},e[10]=I,e[11]=i,e[12]=p,e[13]=m):m=e[13],m}const et=24;function tt(s){const e=Q.c(54),{registryId:r,listToolName:l,filtersToolName:d,search:n}=s,{org:i}=re();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[0]=c):c=e[0];const[a,g]=U.useState(c);let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=[],e[1]=I):I=e[1];const[o,p]=U.useState(I),m=r||null;let j;e[2]!==i.id||e[3]!==m?(j={connectionId:m,orgId:i.id},e[2]=i.id,e[3]=m,e[4]=j):j=e[4];const S=je(j),R=!!d;let b;e[5]!==d||e[6]!==r?(b=ie.toolCall(r,d||"no-filters","{}"),e[5]=d,e[6]=r,e[7]=b):b=e[7];let N;e[8]!==S||e[9]!==d?(N=async()=>{if(!d)return{tags:[],categories:[]};const f=await S.callTool({name:d,arguments:{}});return f.structuredContent??f},e[8]=S,e[9]=d,e[10]=N):N=e[10];let P;e[11]!==b||e[12]!==N?(P={queryKey:b,queryFn:N,staleTime:36e5,retry:2},e[11]=b,e[12]=N,e[13]=P):P=e[13];const{data:$}=he(P);let h,C,k;if(e[14]!==l||e[15]!==r||e[16]!==n||e[17]!==o||e[18]!==a){const f=n?.trim()?{operator:"or",conditions:[{field:["name"],operator:"contains",value:n},{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}:void 0;h={limit:et,...a.length>0&&{tags:a},...o.length>0&&{categories:o},...f&&{where:f}},k=Fe,C=ie.toolCall(r,l,JSON.stringify(h)),e[14]=l,e[15]=r,e[16]=n,e[17]=o,e[18]=a,e[19]=h,e[20]=C,e[21]=k}else h=e[19],C=e[20],k=e[21];let v;e[22]!==S||e[23]!==h||e[24]!==l?(v=async f=>{const{pageParam:Z}=f,le=Z?{...h,cursor:Z}:h,ee=await S.callTool({name:l,arguments:le});return ee.structuredContent??ee},e[22]=S,e[23]=h,e[24]=l,e[25]=v):v=e[25];let z;e[26]!==v||e[27]!==C?(z={queryKey:C,queryFn:v,initialPageParam:void 0,getNextPageParam:st,staleTime:36e5,placeholderData:we,retry:2},e[26]=v,e[27]=C,e[28]=z):z=e[28];const{data:w,fetchNextPage:x,hasNextPage:y,isFetchingNextPage:u,isFetching:T,isLoading:L,error:F}=k(z);let O;e:{if(!w?.pages||w.pages.length===0){O=null;break e}const f=w.pages[0];if(typeof f=="object"&&f!==null&&"totalCount"in f&&typeof f.totalCount=="number"){O=f.totalCount;break e}O=null}const K=O,E=w?.pages;let G;e[29]!==E?(G=Ee(E),e[29]=E,e[30]=G):G=e[30];const H=G;let W;e[31]!==n||e[32]!==o.length||e[33]!==a.length?(W=a.length>0||o.length>0||!!n?.trim(),e[31]=n,e[32]=o.length,e[33]=a.length,e[34]=W):W=e[34];const D=W,B=T&&!u&&!L&&D;let A;e[35]!==x||e[36]!==y||e[37]!==u?(A=()=>{y&&!u&&x()},e[35]=x,e[36]=y,e[37]=u,e[38]=A):A=e[38];const V=A,_=y??!1,M=R?$?.tags:void 0,q=R?$?.categories:void 0;let J;return e[39]!==D||e[40]!==T||e[41]!==u||e[42]!==B||e[43]!==L||e[44]!==H||e[45]!==F||e[46]!==V||e[47]!==o||e[48]!==a||e[49]!==_||e[50]!==M||e[51]!==q||e[52]!==K?(J={items:H,totalCount:K,hasMore:_,isLoadingMore:u,isFiltering:B,isInitialLoading:L,isFetching:T,error:F,loadMore:V,availableTags:M,availableCategories:q,selectedTags:a,selectedCategories:o,setSelectedTags:g,setSelectedCategories:p,hasActiveFilters:D},e[39]=D,e[40]=T,e[41]=u,e[42]=B,e[43]=L,e[44]=H,e[45]=F,e[46]=V,e[47]=o,e[48]=a,e[49]=_,e[50]=M,e[51]=q,e[52]=K,e[53]=J):J=e[53],J}function st(s){if(typeof s=="object"&&s!==null){const e=s.nextCursor||s.cursor;if(e)return e}}function rt(s,e){return[...s].sort((r,l)=>l.count-r.count).slice(0,e)}function ce(s){const e=Q.c(52),{label:r,items:l,selectedItems:d,onToggle:n,onClear:i}=s,[c,a]=U.useState(""),[g,I]=U.useState(!1);let o,p,m,j,S,R,b,N,P,$,h;if(e[0]!==l||e[1]!==r||e[2]!==n||e[3]!==g||e[4]!==c||e[5]!==d){const x=[...c?l.filter(E=>E.value.toLowerCase().includes(c.toLowerCase())):l].sort(lt);m=d.length,p=ve,P=g,$=I;let y;e[17]!==r?(y=t.jsx("span",{children:r}),e[17]=r,e[18]=y):y=e[18];let u;e[19]!==m?(u=m>0&&t.jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-1.5 py-0.5 text-[10px] font-medium",children:m}),e[19]=m,e[20]=u):u=e[20];let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Se,{size:14,className:"opacity-50"}),e[21]=T):T=e[21],e[22]!==u||e[23]!==y?(h=t.jsx(be,{asChild:!0,children:t.jsxs(Y,{variant:"outline",size:"sm",className:"h-7 px-3 gap-1.5 text-xs font-normal flex-1",children:[y,u,T]})}),e[22]=u,e[23]=y,e[24]=h):h=e[24],o=Ne,R="w-64 p-0",b="start";let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(pe,{size:16,className:"text-muted-foreground shrink-0"}),e[25]=L):L=e[25];let F;e[26]!==r?(F=r.toLowerCase(),e[26]=r,e[27]=F):F=e[27];const O=`Search ${F}...`;let K;e[28]===Symbol.for("react.memo_cache_sentinel")?(K=E=>a(E.target.value),e[28]=K):K=e[28],e[29]!==c||e[30]!==O?(N=t.jsx("div",{className:"shrink-0 w-full border-b border-border h-10",children:t.jsxs("label",{className:"flex items-center gap-2.5 h-10 px-4 cursor-text",children:[L,t.jsx(Ue,{type:"text",placeholder:O,value:c,onChange:K,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=c,e[30]=O,e[31]=N):N=e[31],j="max-h-64 overflow-y-auto p-1 flex flex-col gap-1",S=x.length===0?t.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground text-center",children:"No results found"}):x.map(E=>{const G=d.includes(E.value);return t.jsxs("button",{onClick:()=>n(E.value),className:oe("w-full flex items-center justify-between px-2 py-1.5 text-sm rounded cursor-pointer transition-colors",G?"bg-accent/50 text-foreground":"hover:bg-muted text-foreground"),children:[t.jsxs("span",{className:"truncate flex items-center gap-2",children:[G&&t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0"}),E.value]}),t.jsx("span",{className:"text-xs text-muted-foreground ml-2 shrink-0",children:E.count})]},E.value)}),e[0]=l,e[1]=r,e[2]=n,e[3]=g,e[4]=c,e[5]=d,e[6]=o,e[7]=p,e[8]=m,e[9]=j,e[10]=S,e[11]=R,e[12]=b,e[13]=N,e[14]=P,e[15]=$,e[16]=h}else o=e[6],p=e[7],m=e[8],j=e[9],S=e[10],R=e[11],b=e[12],N=e[13],P=e[14],$=e[15],h=e[16];let C;e[32]!==j||e[33]!==S?(C=t.jsx("div",{className:j,children:S}),e[32]=j,e[33]=S,e[34]=C):C=e[34];let k;e[35]!==r||e[36]!==i||e[37]!==m?(k=m>0&&t.jsx("div",{className:"p-2 border-t border-border",children:t.jsxs(Y,{variant:"ghost",size:"sm",onClick:i,className:"w-full text-xs text-muted-foreground hover:text-foreground",children:["Clear ",r.toLowerCase()]})}),e[35]=r,e[36]=i,e[37]=m,e[38]=k):k=e[38];let v;e[39]!==o||e[40]!==k||e[41]!==R||e[42]!==b||e[43]!==N||e[44]!==C?(v=t.jsxs(o,{className:R,align:b,children:[N,C,k]}),e[39]=o,e[40]=k,e[41]=R,e[42]=b,e[43]=N,e[44]=C,e[45]=v):v=e[45];let z;return e[46]!==p||e[47]!==v||e[48]!==P||e[49]!==$||e[50]!==h?(z=t.jsxs(p,{open:P,onOpenChange:$,children:[h,v]}),e[46]=p,e[47]=v,e[48]=P,e[49]=$,e[50]=h,e[51]=z):z=e[51],z}function lt(s,e){return e.count-s.count}function nt(s){const e=Q.c(67),{availableTags:r,availableCategories:l,selectedTags:d,selectedCategories:n,onTagChange:i,onCategoryChange:c}=s,a=r&&r.length>0||l&&l.length>0,g=d.length>0||n.length>0;if(!a)return null;let I;e[0]!==i||e[1]!==d?(I=y=>{d.includes(y)?i(d.filter(u=>u!==y)):i([...d,y])},e[0]=i,e[1]=d,e[2]=I):I=e[2];const o=I;let p;e[3]!==c||e[4]!==n?(p=y=>{n.includes(y)?c(n.filter(u=>u!==y)):c([...n,y])},e[3]=c,e[4]=n,e[5]=p):p=e[5];const m=p;let j;e[6]!==c||e[7]!==i?(j=()=>{i([]),c([])},e[6]=c,e[7]=i,e[8]=j):j=e[8];const S=j;let R,b,N,P,$,h,C;if(e[9]!==l||e[10]!==r||e[11]!==c||e[12]!==i||e[13]!==n||e[14]!==d||e[15]!==m||e[16]!==o){const y=l?rt(l,6):[];R=n,b=d,C=new Set(y.map(it)),$="flex items-center border-b border-border";let u;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:t.jsx(xe,{size:16})}),e[24]=u):u=e[24];let T;e[25]!==l||e[26]!==c||e[27]!==n||e[28]!==m?(T=l&&l.length>0&&t.jsx(ce,{label:"Categories",items:l,selectedItems:n,onToggle:m,onClear:()=>c([])}),e[25]=l,e[26]=c,e[27]=n,e[28]=m,e[29]=T):T=e[29];let L;e[30]!==r||e[31]!==i||e[32]!==d||e[33]!==o?(L=r&&r.length>0&&t.jsx(ce,{label:"Tags",items:r,selectedItems:d,onToggle:o,onClear:()=>i([])}),e[30]=r,e[31]=i,e[32]=d,e[33]=o,e[34]=L):L=e[34],e[35]!==L||e[36]!==T?(h=t.jsxs("div",{className:"flex items-center gap-3 flex-wrap px-5 py-3 border-r border-border",children:[u,T,L]}),e[35]=L,e[36]=T,e[37]=h):h=e[37],N="flex items-center gap-3 flex-wrap px-5 py-3";let F;e[38]!==n||e[39]!==m?(F=O=>{const K=n.includes(O.value);return t.jsxs("div",{onClick:()=>m(O.value),className:oe("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer",K?"bg-primary text-primary-foreground hover:bg-primary/80":"bg-muted hover:bg-accent text-muted-foreground"),children:[t.jsx("span",{children:O.value}),K&&t.jsx("span",{onClick:E=>{E.stopPropagation(),m(O.value)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:t.jsx(te,{size:12})})]},O.value)},e[38]=n,e[39]=m,e[40]=F):F=e[40],P=y.map(F),e[9]=l,e[10]=r,e[11]=c,e[12]=i,e[13]=n,e[14]=d,e[15]=m,e[16]=o,e[17]=R,e[18]=b,e[19]=N,e[20]=P,e[21]=$,e[22]=h,e[23]=C}else R=e[17],b=e[18],N=e[19],P=e[20],$=e[21],h=e[22],C=e[23];let k;if(e[41]!==R||e[42]!==m||e[43]!==C){let y;e[45]!==C?(y=T=>!C.has(T),e[45]=C,e[46]=y):y=e[46];let u;e[47]!==m?(u=T=>t.jsxs("div",{onClick:()=>m(T),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[t.jsx("span",{children:T}),t.jsx("span",{onClick:L=>{L.stopPropagation(),m(T)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:t.jsx(te,{size:12})})]},`cat-${T}`),e[47]=m,e[48]=u):u=e[48],k=R.filter(y).map(u),e[41]=R,e[42]=m,e[43]=C,e[44]=k}else k=e[44];let v;if(e[49]!==b||e[50]!==o){let y;e[52]!==o?(y=u=>t.jsxs("div",{onClick:()=>o(u),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[t.jsx("span",{children:u}),t.jsx("span",{onClick:T=>{T.stopPropagation(),o(u)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:t.jsx(te,{size:12})})]},`tag-${u}`),e[52]=o,e[53]=y):y=e[53],v=b.map(y),e[49]=b,e[50]=o,e[51]=v}else v=e[51];let z;e[54]!==S||e[55]!==g?(z=g&&t.jsxs(Y,{variant:"ghost",size:"sm",onClick:S,className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1 px-2",children:[t.jsx(te,{size:14}),"Clear all"]}),e[54]=S,e[55]=g,e[56]=z):z=e[56];let w;e[57]!==z||e[58]!==N||e[59]!==P||e[60]!==k||e[61]!==v?(w=t.jsxs("div",{className:N,children:[P,k,v,z]}),e[57]=z,e[58]=N,e[59]=P,e[60]=k,e[61]=v,e[62]=w):w=e[62];let x;return e[63]!==w||e[64]!==$||e[65]!==h?(x=t.jsxs("div",{className:$,children:[h,w]}),e[63]=w,e[64]=$,e[65]=h,e[66]=x):x=e[66],x}function it(s){return s.value}function ot(s,e){if(!e)return s;const r=e.toLowerCase();return s.filter(l=>(l.name||l.title||"").toLowerCase().includes(r)||(l.description||l.server?.description||"").toLowerCase().includes(r))}function at(s){return s.verified===!0||s._meta?.["mcp.mesh"]?.verified===!0}function ct(s){const e=Q.c(55),{registryId:r,listToolName:l,filtersToolName:d,storePrivateOnly:n}=s,[i,c]=U.useState(""),a=Ze(i,300),g=de(),{org:I}=re(),{scrollRef:o,saveScrollPosition:p,handleScroll:m}=Xe(`store-discovery:${r}`);let j;e[0]!==a||e[1]!==d||e[2]!==l||e[3]!==r?(j={registryId:r,listToolName:l,filtersToolName:d,search:a},e[0]=a,e[1]=d,e[2]=l,e[3]=r,e[4]=j):j=e[4];const{items:S,hasMore:R,isLoadingMore:b,isInitialLoading:N,isFetching:P,error:$,loadMore:h,availableTags:C,availableCategories:k,selectedTags:v,selectedCategories:z,setSelectedTags:w,setSelectedCategories:x,hasActiveFilters:y}=tt(j);let u,T,L,F;if(e[5]!==a||e[6]!==P||e[7]!==N||e[8]!==S||e[9]!==i||e[10]!==n){const _=i?ot(S,i):S;F=n?_.filter(mt):_,u=(i!==a||P)&&!N&&!!i,L=F.filter(at),T=F.filter(M=>!L.find(q=>q.id===M.id)),e[5]=a,e[6]=P,e[7]=N,e[8]=S,e[9]=i,e[10]=n,e[11]=u,e[12]=T,e[13]=L,e[14]=F}else u=e[11],T=e[12],L=e[13],F=e[14];const O=T;let K;e[15]!==g||e[16]!==I.slug||e[17]!==r||e[18]!==p?(K=_=>{p();const M=We(_.name||_.title||_.server?.title||""),q=typeof _.id=="string"&&_.id.includes("/"),J=typeof _.server?.name=="string"&&_.server.name.includes("/"),f=q&&!J?_.id:_.server?.name||_.id||"";g({to:"/$org/$project/store/$appName",params:{org:I.slug,project:fe,appName:M},search:{registryId:r,serverName:f}})},e[15]=g,e[16]=I.slug,e[17]=r,e[18]=p,e[19]=K):K=e[19];const E=K;let G;e[20]!==m||e[21]!==R||e[22]!==b||e[23]!==h?(G=_=>{if(m(),!R||b)return;const M=_.currentTarget;M.scrollHeight-M.scrollTop-M.clientHeight<200&&h()},e[20]=m,e[21]=R,e[22]=b,e[23]=h,e[24]=G):G=e[24];const H=G;let W;e[25]!==u||e[26]!==i?(W=t.jsx(Ve,{value:i,onChange:c,placeholder:"Search for an MCP Server...",isSearching:u}),e[25]=u,e[26]=i,e[27]=W):W=e[27];let D;e[28]!==k||e[29]!==C||e[30]!==z||e[31]!==v||e[32]!==x||e[33]!==w?(D=t.jsx(nt,{availableTags:C,availableCategories:k,selectedTags:v,selectedCategories:z,onTagChange:w,onCategoryChange:x}),e[28]=k,e[29]=C,e[30]=z,e[31]=v,e[32]=x,e[33]=w,e[34]=D):D=e[34];let B;e[35]!==O||e[36]!==$||e[37]!==E||e[38]!==y||e[39]!==R||e[40]!==N||e[41]!==b||e[42]!==u||e[43]!==i||e[44]!==L||e[45]!==F?(B=t.jsx("div",{className:"p-5",children:t.jsx("div",{children:$&&!N?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(me,{className:"size-8 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Registry unavailable"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-sm mx-auto",children:"Could not load items from this registry. It may be temporarily offline."}),$.message&&t.jsx("p",{className:"text-xs text-muted-foreground/60 font-mono max-w-md mx-auto truncate",children:$.message})]}),t.jsxs(Y,{variant:"outline",size:"sm",onClick:dt,children:[t.jsx(ue,{className:"size-4"}),"Try again"]})]}):N?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(se,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):F.length===0&&!y?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(ge,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),t.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):F.length===0&&y&&!i?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(xe,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No matching items"}),t.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters to find more results."})]}):i&&F.length===0&&!u?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(pe,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),t.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):t.jsxs("div",{className:"flex flex-col gap-8",children:[u&&F.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(se,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching..."})]}),L.length>0&&t.jsx(ae,{items:L,title:"Verified",onItemClick:E}),O.length>0&&t.jsx(ae,{items:O,title:L.length>0?"All":"",onItemClick:E}),R&&b&&t.jsx("div",{className:"flex justify-center py-8",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx(se,{size:20,className:"animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[35]=O,e[36]=$,e[37]=E,e[38]=y,e[39]=R,e[40]=N,e[41]=b,e[42]=u,e[43]=i,e[44]=L,e[45]=F,e[46]=B):B=e[46];let A;e[47]!==H||e[48]!==o||e[49]!==B?(A=t.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",onScroll:H,children:B}),e[47]=H,e[48]=o,e[49]=B,e[50]=A):A=e[50];let V;return e[51]!==W||e[52]!==D||e[53]!==A?(V=t.jsxs("div",{className:"flex flex-col h-full",children:[W,D,A]}),e[51]=W,e[52]=D,e[53]=A,e[54]=V):V=e[54],V}function dt(){return window.location.reload()}function mt(s){return s.is_public!==!0}function ut(s){const e=Q.c(11),{registryId:r,storePrivateOnly:l}=s,d=De(r),n=d?.tools;let i;e[0]!==n?(i=_e(n),e[0]=n,e[1]=i):i=e[1];const c=i;if(!c){let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"bg-muted p-3 rounded-full",children:t.jsx(ge,{className:"size-8 text-muted-foreground"})}),e[2]=m):m=e[2];let j;return e[3]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-12 text-center space-y-4",children:[m,t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Registry not available"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-sm mx-auto",children:"This registry does not support listing store items, or the connection is not responding."})]})]}),e[3]=j):j=e[3],j}const a=d?.tools;let g;e[4]!==a?(g=Oe(a),e[4]=a,e[5]=g):g=e[5];const o=g||void 0;let p;return e[6]!==c||e[7]!==r||e[8]!==l||e[9]!==o?(p=t.jsx(ct,{registryId:r,listToolName:c,filtersToolName:o,storePrivateOnly:l}),e[6]=c,e[7]=r,e[8]=l,e[9]=o,e[10]=p):p=e[10],p}function ft(s){const e=Q.c(43),{registries:r,value:l,onValueChange:d,onAddWellKnown:n,wellKnownRegistries:i,placeholder:c}=s,a=c===void 0?"Select a registry...":c,[g,I]=U.useState(!1);let o,p,m,j,S,R,b,N;if(e[0]!==g||e[1]!==a||e[2]!==r||e[3]!==l){let w;e[12]!==l?(w=y=>y.id===l,e[12]=l,e[13]=w):w=e[13];const x=r.find(w);p=ve,b=g,N=I,o=be,R=!0,m="button",e[14]===Symbol.for("react.memo_cache_sentinel")?(j=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] h-7 min-w-[160px]"),e[14]=j):j=e[14],S=x?t.jsxs("span",{className:"flex items-center gap-2",children:[x.icon?t.jsx("img",{src:x.icon,alt:x.name,className:"w-4 h-4 rounded"}):t.jsx("span",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:x.name.slice(0,1).toUpperCase()}),t.jsx("span",{children:x.name})]}):t.jsx("span",{className:"text-muted-foreground",children:a}),e[0]=g,e[1]=a,e[2]=r,e[3]=l,e[4]=o,e[5]=p,e[6]=m,e[7]=j,e[8]=S,e[9]=R,e[10]=b,e[11]=N}else o=e[4],p=e[5],m=e[6],j=e[7],S=e[8],R=e[9],b=e[10],N=e[11];let P;e[15]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Se,{className:"size-4 opacity-50"}),e[15]=P):P=e[15];let $;e[16]!==m||e[17]!==j||e[18]!==S?($=t.jsxs("button",{type:m,className:j,children:[S,P]}),e[16]=m,e[17]=j,e[18]=S,e[19]=$):$=e[19];let h;e[20]!==o||e[21]!==R||e[22]!==$?(h=t.jsx(o,{asChild:R,children:$}),e[20]=o,e[21]=R,e[22]=$,e[23]=h):h=e[23];let C;if(e[24]!==d||e[25]!==r||e[26]!==l){let w;e[28]!==d||e[29]!==l?(w=x=>t.jsxs("button",{type:"button",onClick:()=>{d(x.id??x.name),I(!1)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[x.icon?t.jsx("img",{src:x.icon,alt:x.name,className:"w-4 h-4 rounded"}):t.jsx("span",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:x.name.slice(0,1).toUpperCase()}),t.jsx("span",{children:x.name})]}),l===(x.id??x.name)&&t.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:t.jsx(Ce,{className:"size-4"})})]},x.id??x.name),e[28]=d,e[29]=l,e[30]=w):w=e[30],C=r.map(w),e[24]=d,e[25]=r,e[26]=l,e[27]=C}else C=e[27];let k;e[31]!==n||e[32]!==i?(k=i.length>0&&t.jsxs("div",{className:"border-t border-border pt-1 mt-1",children:[t.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),i.map(w=>t.jsxs("button",{type:"button",onClick:()=>{n(w),I(!1)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[w.icon?t.jsx("img",{src:w.icon,alt:w.title,className:"w-4 h-4 rounded"}):t.jsx("span",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:w.title.slice(0,1).toUpperCase()}),t.jsx("span",{className:"flex-1",children:w.title})]}),t.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:t.jsx(He,{size:16})})]},w.id??w.title))]}),e[31]=n,e[32]=i,e[33]=k):k=e[33];let v;e[34]!==C||e[35]!==k?(v=t.jsxs(Ne,{align:"end",className:"w-auto min-w-[200px] p-1",children:[C,k]}),e[34]=C,e[35]=k,e[36]=v):v=e[36];let z;return e[37]!==p||e[38]!==h||e[39]!==v||e[40]!==b||e[41]!==N?(z=t.jsxs(p,{open:b,onOpenChange:N,children:[h,v]}),e[37]=p,e[38]=h,e[39]=v,e[40]=b,e[41]=N,e[42]=z):z=e[42],z}function xt({registries:s,onConnected:e}){const r=ye(),{org:{slug:l}}=re(),{data:d}=Ie.useSession(),n=de(),[i,c]=U.useState(!1),a=s[0],g=async()=>{if(!(!a||!d?.user?.id)){c(!0);try{const o=await r.create.mutateAsync(a);e?.(o.id)}finally{c(!1)}}},I=()=>{n({to:"/$org/$project/mcps",params:{org:l,project:fe},search:{action:"create"}})};return t.jsx(qe,{image:t.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use Connections from the community.",actions:t.jsxs(t.Fragment,{children:[t.jsxs(Y,{variant:"outline",onClick:g,disabled:i||!a,children:[a?.icon&&t.jsx("img",{src:a.icon,alt:"",className:"size-4"}),i?"Installing...":"Install Registry"]}),t.jsx(Y,{variant:"outline",onClick:I,children:"Custom Connection"})]})})}function gt(s){const e=Q.c(15),{error:r,onRetry:l,registryName:d}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(me,{className:"h-6 w-6 text-destructive"})}),e[0]=n):n=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("h3",{className:"text-lg font-medium",children:"Unable to load store"}),e[1]=i):i=e[1];let c;e[2]!==d?(c=t.jsxs("p",{className:"text-sm text-muted-foreground max-w-sm mx-auto",children:["The ",t.jsx("strong",{children:d})," registry is currently unreachable. This may be a temporary issue — try again in a moment."]}),e[2]=d,e[3]=c):c=e[3];let a;e[4]!==r?(a=r?.message&&t.jsx("p",{className:"text-xs text-muted-foreground/60 font-mono max-w-md mx-auto truncate",children:r.message}),e[4]=r,e[5]=a):a=e[5];let g;e[6]!==c||e[7]!==a?(g=t.jsxs("div",{className:"space-y-2",children:[i,c,a]}),e[6]=c,e[7]=a,e[8]=g):g=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ue,{className:"size-4"}),e[9]=I):I=e[9];let o;e[10]!==l?(o=t.jsxs(Y,{variant:"outline",size:"sm",onClick:l,children:[I,"Try again"]}),e[10]=l,e[11]=o):o=e[11];let p;return e[12]!==g||e[13]!==o?(p=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[n,g,o]}),e[12]=g,e[13]=o,e[14]=p):p=e[14],p}function ts(){const s=Q.c(49),{org:e,project:r}=re(),l=Ge(),d=ye(),n=Te(),i=n.location.pathname.includes("/store/")&&n.location.pathname.split("/").length>3,c=Je(l);let a;s[0]!==e.id?(a=Ke.SELF(e.id),s[0]=e.id,s[1]=a):a=s[1];const g=a,I=r.enabledPlugins,o=I==null||I.includes(ne),p=c.filter(f=>f.id!==g?!0:o);let m;s[2]!==g?(m=f=>f.id===g,s[2]=g,s[3]=m):m=s[3];const j=p.some(m);let S;s[4]!==e.id?(S={connectionId:Ae,orgId:e.id},s[4]=e.id,s[5]=S):S=s[5];const R=je(S);let b;s[6]!==r.id||s[7]!==R?(b=async()=>{const f=await R.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:r.id,pluginId:ne}});return f.structuredContent??f},s[6]=r.id,s[7]=R,s[8]=b):b=s[8];const{data:N}=he({queryKey:ie.projectPluginConfig(r.id??"",ne),queryFn:b,enabled:j&&!!r.id,staleTime:6e4}),P=N?.config?.settings;let $;s[9]!==P||s[10]!==g?($=f=>f.id===g&&P?{id:f.id,name:P.registryName||f.title,icon:P.registryIcon||f.icon||void 0}:{id:f.id,name:f.title,icon:f.icon||void 0},s[9]=P,s[10]=g,s[11]=$):$=s[11];const h=p.map($);let C;s[12]!==e.slug?(C=Qe.selectedRegistry(e.slug),s[12]=e.slug,s[13]=C):C=s[13];const[k,v]=Ye(C,ht);let z;s[14]!==k?(z=f=>f.id===k,s[14]=k,s[15]=z):z=s[15];const x=p.find(z)?.id||p[0]?.id||"",y=x===g&&P?.storePrivateOnly===!0;let u;s[16]!==e.id?(u=Me(e.id),s[16]=e.id,s[17]=u):u=s[17];let T;s[18]!==u?(T=[u],s[18]=u,s[19]=T):T=s[19];const L=T;let F;s[20]===Symbol.for("react.memo_cache_sentinel")?(F=[Be()],s[20]=F):F=s[20];const O=F;let K;s[21]!==d.create||s[22]!==v?(K=async f=>{const Z=await d.create.mutateAsync(f);v(Z.id)},s[21]=d.create,s[22]=v,s[23]=K):K=s[23];const E=K,G=new Set(p.map(pt)),H=L.filter(f=>f.id&&!G.has(f.id)),W=O.filter(f=>f.id&&!G.has(f.id));if(i){let f;return s[24]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Pe,{}),s[24]=f):f=s[24],f}let D;s[25]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(X.Header.Left,{children:t.jsx($e,{children:t.jsx(ke,{children:t.jsx(ze,{children:t.jsx(Le,{children:"Store"})})})})}),s[25]=D):D=s[25];let B;s[26]!==E?(B=async f=>E(f),s[26]=E,s[27]=B):B=s[27];let A;s[28]!==H||s[29]!==x||s[30]!==h||s[31]!==v||s[32]!==B?(A=t.jsxs(X.Header,{children:[D,t.jsx(X.Header.Right,{children:t.jsx(ft,{wellKnownRegistries:H,registries:h,value:x,onValueChange:v,onAddWellKnown:B,placeholder:"Select store..."})})]}),s[28]=H,s[29]=x,s[30]=h,s[31]=v,s[32]=B,s[33]=A):A=s[33];let V;s[34]!==x||s[35]!==h?(V=f=>{const{error:Z,resetError:le}=f;return t.jsx(gt,{error:Z,onRetry:le,registryName:h.find(ee=>ee.id===x)?.name??"registry"})},s[34]=x,s[35]=h,s[36]=V):V=s[36];let _;s[37]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(se,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),s[37]=_):_=s[37];let M;s[38]!==W||s[39]!==x||s[40]!==v||s[41]!==y?(M=t.jsx(U.Suspense,{fallback:_,children:x?t.jsx(ut,{registryId:x,storePrivateOnly:y}):t.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:t.jsx(xt,{registries:W,onConnected:f=>{v(f)}})})}),s[38]=W,s[39]=x,s[40]=v,s[41]=y,s[42]=M):M=s[42];let q;s[43]!==V||s[44]!==M?(q=t.jsx(X.Content,{children:t.jsx(Re,{fallback:V,children:M})}),s[43]=V,s[44]=M,s[45]=q):q=s[45];let J;return s[46]!==A||s[47]!==q?(J=t.jsxs(X,{children:[A,q]}),s[46]=A,s[47]=q,s[48]=J):J=s[48],J}function pt(s){return s.id}function ht(s){return s??""}export{ts as default};
@@ -1 +0,0 @@
1
- import{c as r,j as i}from"./index-3zbyfLqi.js";import{P as m}from"./project-plugins-B1sb2cJf.js";import"./useQuery-DWLTdDjg.js";import"./useMutation-CqJLXgOK.js";import"./constants-3MhIA0pZ.js";import"./switch-CKTW0M5S.js";import"./label-CfzCa7Vm.js";import"./Container-BADgIox6.js";import"./use-connection-Dlr-wAwU.js";import"./use-binding-Cz4OU82g.js";import"./binder-8_Oel13A.js";import"./use-install-from-registry-C_roXw8y.js";import"./extract-connection-data-D40JrSD8.js";import"./constants-Csevqii0.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-Cx5oa6Ne.js";import"./generate-id-Dyweu44Y.js";import"./Loading01-BSgMOGt8.js";import"./Plus-kcfCg7FH.js";import"./select-DaTaxi5W.js";import"./index-DziKeC8s.js";import"./Check-Cjs4C9GE.js";import"./ChevronDown-jKZz68gN.js";function q(){const o=r.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(m,{}),o[0]=t):t=o[0],t}export{q as default};
@@ -1 +0,0 @@
1
- import{r as i,G as $,j as c,aY as H,aH as G,I as A,H as _,M as g,aW as b,T as j,aX as L,aZ as w,b2 as z,b3 as K,U,b4 as W,b5 as Z,b6 as V,a_ as X,a$ as Y,b1 as q,c as R,v as B}from"./index-3zbyfLqi.js";var C="Popover",[E]=U(C,[w]),P=w(),[J,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(J,{scope:e,contentId:G(),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(L,{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=W("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 z(a)},[]),c.jsx(K,{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(V,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(X,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(Y,{"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(q,{...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=B("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 +0,0 @@
1
- import{c as x,e as N,j as i,r as I,E as _,u as P}from"./index-3zbyfLqi.js";import{f as C}from"./use-connection-Dlr-wAwU.js";import{u as M}from"./constants-3MhIA0pZ.js";import{u as R}from"./use-mcp-tools-WZlm0cnW.js";import{M as $}from"./mcp-app-renderer-MJ3LmhBP.js";import{g as b,M as h}from"./types-BFBQ7LBo.js";import"./useMutation-CqJLXgOK.js";import"./useQuery-DWLTdDjg.js";import"./use-mcp-resources-DjDOJ-nS.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 w(){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{w as default};