@decocms/mesh 2.59.2 → 2.59.4

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 (174) hide show
  1. package/dist/client/assets/{AlertCircle--GzH2vta.js → AlertCircle-DcHEglIM.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-DzpTEYvO.js → ArrowLeft-Dlm4CF9d.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BfBrilbk.js → ArrowUp-CC-2uYGu.js} +1 -1
  4. package/dist/client/assets/Calendar-PdB3o_9d.js +1 -0
  5. package/dist/client/assets/{Check-CXkamnnr.js → Check-BzMGOxMB.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-DaqG_J6Z.js → ChevronDown-BV0rwdFr.js} +1 -1
  7. package/dist/client/assets/{Code01-BNQVP8-g.js → Code01-KWN4ist8.js} +1 -1
  8. package/dist/client/assets/{Copy01-CpBgXJFP.js → Copy01-DH_iV9-n.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-BDAFctKq.js → DotsHorizontal-CFL9xkGv.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-D5MnD2QZ.js → DotsVertical-DOgWrY6o.js} +1 -1
  11. package/dist/client/assets/{Download01-4Tu3o0-K.js → Download01-npnn9kWB.js} +1 -1
  12. package/dist/client/assets/{Edit01-7Ak8JL9W.js → Edit01-CH6U7DHj.js} +1 -1
  13. package/dist/client/assets/File02-Cuc-ZPtg.js +1 -0
  14. package/dist/client/assets/{File06-C7QVLRp6.js → File06-BUwGdOjl.js} +1 -1
  15. package/dist/client/assets/{FilterLines-UNZ5Kk_X.js → FilterLines-ia0H5bBk.js} +1 -1
  16. package/dist/client/assets/{Grid01-C_dMOr-7.js → Grid01-DmaR0g3f.js} +1 -1
  17. package/dist/client/assets/{Home02-Cfg1gm8U.js → Home02-Cagj2miO.js} +1 -1
  18. package/dist/client/assets/{Image01-C6IcS9Ip.js → Image01-BCcbzsoK.js} +1 -1
  19. package/dist/client/assets/{Inbox01-D1IW7Je7.js → Inbox01-DoVQ3gCk.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-Dwuc2RiH.js → InfoCircle-qTETvFXb.js} +1 -1
  21. package/dist/client/assets/{Key01-CrwOIsjX.js → Key01-CHZQ8Cf-.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-yVEf-2cT.js → LinkExternal01-Cq8yx7fP.js} +1 -1
  23. package/dist/client/assets/{List-d88_8fTd.js → List-DZ53jWcW.js} +1 -1
  24. package/dist/client/assets/{Loading01-Bf56vlFv.js → Loading01-Bo9vDQAp.js} +1 -1
  25. package/dist/client/assets/{Lock01-CQ0bp8OP.js → Lock01-C1QZkjy0.js} +1 -1
  26. package/dist/client/assets/{Pin01-DBKe5RmK.js → Pin01-NWg5BL2M.js} +1 -1
  27. package/dist/client/assets/Play-D2yqwct8.js +1 -0
  28. package/dist/client/assets/{Plus-CcqPpwU0.js → Plus-DAW17Fqf.js} +1 -1
  29. package/dist/client/assets/{SearchMd-Ns-pswyj.js → SearchMd-D9E7kgub.js} +1 -1
  30. package/dist/client/assets/{Share07-B5yrbjwk.js → Share07-CN4FUsWW.js} +1 -1
  31. package/dist/client/assets/{Terminal-qZhwvVsv.js → Terminal-1HZulC_H.js} +1 -1
  32. package/dist/client/assets/Tool01-Ir04gLyn.js +1 -0
  33. package/dist/client/assets/{Trash01-DVYV3BJw.js → Trash01-BUkAP1vf.js} +1 -1
  34. package/dist/client/assets/{Upload01-CCAaxnrW.js → Upload01-DPPzM8Sw.js} +1 -1
  35. package/dist/client/assets/{Users03-CSRHEIl2.js → Users03-DscKVk_U.js} +1 -1
  36. package/dist/client/assets/{X-Dz8JZ2ZX.js → X-DyyqPnhR.js} +1 -1
  37. package/dist/client/assets/{XClose-BhgPfyG3.js → XClose-nvPI0OtD.js} +1 -1
  38. package/dist/client/assets/agent-detail-pV-lC3Zh.js +1 -0
  39. package/dist/client/assets/{agents-4MJAHJGV.js → agents-DepniFRU.js} +1 -1
  40. package/dist/client/assets/{alert-dialog-5t1wq8Xl.js → alert-dialog-QzYPe_ae.js} +3 -3
  41. package/dist/client/assets/{auth-catchall-CTOFzXVU.js → auth-catchall-COlMpx6Y.js} +1 -1
  42. package/dist/client/assets/{avatar-Cx4ORVtq.js → avatar-KkS1NpLz.js} +1 -1
  43. package/dist/client/assets/{badge-DfeUgg96.js → badge-CfH2vrIM.js} +1 -1
  44. package/dist/client/assets/{binder-Dh-m11Sm.js → binder-Cyeq_Zec.js} +1 -1
  45. package/dist/client/assets/{button-C83AQWC1.js → button-D_0RTXDt.js} +1 -1
  46. package/dist/client/assets/{card-CbXWWn3M.js → card-BmOa96dk.js} +1 -1
  47. package/dist/client/assets/{checkbox-DcPieRc5.js → checkbox-CUtYbeQD.js} +1 -1
  48. package/dist/client/assets/{circle-alert-ChrxIBwd.js → circle-alert-BnmazpCh.js} +1 -1
  49. package/dist/client/assets/collapsible-0N2BB6Bm.js +23 -0
  50. package/dist/client/assets/{collection-detail-B_qs3xwg.js → collection-detail-CeAvZaUS.js} +4 -4
  51. package/dist/client/assets/{collection-display-button-DlAEKbje.js → collection-display-button-Cm0zQnM_.js} +1 -1
  52. package/dist/client/assets/{collection-header-Fc9BtUxQ.js → collection-header-CbT_At3k.js} +1 -1
  53. package/dist/client/assets/{collection-page-DvzZtNQd.js → collection-page-CpAhF9Tg.js} +1 -1
  54. package/dist/client/assets/collection-search-DRZ8ScZP.js +1 -0
  55. package/dist/client/assets/{collection-tab-BB_A78nH.js → collection-tab-CyuO9CaU.js} +1 -1
  56. package/dist/client/assets/{collection-table-wrapper-Ch8oh2UW.js → collection-table-wrapper-CspbeKNx.js} +1 -1
  57. package/dist/client/assets/connect-Dx3Myol5.js +1 -0
  58. package/dist/client/assets/{connection-card-BZU7F7-m.js → connection-card-C6VYrDSx.js} +1 -1
  59. package/dist/client/assets/connection-detail-BAO1w9SL.js +1 -0
  60. package/dist/client/assets/{connections-dluTnyJM.js → connections-xwpD87cp.js} +1 -1
  61. package/dist/client/assets/{constants-ytntCGH9.js → constants-D8fdcBr8.js} +1 -1
  62. package/dist/client/assets/constants-rfrR0uMr.js +1 -0
  63. package/dist/client/assets/{create-organization-dialog-GjXRxTaj.js → create-organization-dialog-D96wehG4.js} +1 -1
  64. package/dist/client/assets/{dialog-D_ebnPDF.js → dialog-B-A0vnh-.js} +1 -1
  65. package/dist/client/assets/dropdown-menu-CMmh8IDN.js +1 -0
  66. package/dist/client/assets/{dynamic-plugin-layout-DrCIvG61.js → dynamic-plugin-layout-D5OcFZH0.js} +1 -1
  67. package/dist/client/assets/{empty-state-CxA9hap0.js → empty-state-BS0aVQHO.js} +1 -1
  68. package/dist/client/assets/{empty-state-Cr5g6Vh9.js → empty-state-DKQ_J1zp.js} +1 -1
  69. package/dist/client/assets/{env-vars-editor-DXJo5cdV.js → env-vars-editor-BFfuzqB5.js} +1 -1
  70. package/dist/client/assets/{error-boundary-Dg0Af8BA.js → error-boundary-ynZ9rF8y.js} +1 -1
  71. package/dist/client/assets/{extract-connection-data-BYPMZtVW.js → extract-connection-data-5Dbbyfmc.js} +1 -1
  72. package/dist/client/assets/file-browser-DWYmbjoP.js +2 -0
  73. package/dist/client/assets/{form-BISYEAnP.js → form-DngqlMy0.js} +1 -1
  74. package/dist/client/assets/grid-view-DBdpM4tG.js +1 -0
  75. package/dist/client/assets/home-Dh3O7N9x.js +1 -0
  76. package/dist/client/assets/index-B8BaCPuX.js +25 -0
  77. package/dist/client/assets/index-BWcrkV98.js +1 -0
  78. package/dist/client/assets/index-BtGsFE3_.js +233 -0
  79. package/dist/client/assets/{index-B-pYSGnK.js → index-C_CYTppS.js} +1 -1
  80. package/dist/client/assets/index-CqeIU8-o.css +1 -0
  81. package/dist/client/assets/index-DaiP89U7.js +1 -0
  82. package/dist/client/assets/{index-C8OOnmm1.js → index-Dho9MRVw.js} +2 -2
  83. package/dist/client/assets/{infiniteQueryObserver-B1N6PF-z.js → infiniteQueryObserver-DDmbfPGP.js} +1 -1
  84. package/dist/client/assets/{input-CrR0FEof.js → input-trZWilTG.js} +1 -1
  85. package/dist/client/assets/layout-BZ8_9wgI.js +1 -0
  86. package/dist/client/assets/localstorage-keys-B7V7cQcH.js +1 -0
  87. package/dist/client/assets/{login-BFXWEB6t.js → login-D61ut3BQ.js} +1 -1
  88. package/dist/client/assets/{mcp-oauth-BkqLXiLL.js → mcp-oauth-kjSe-9sd.js} +1 -1
  89. package/dist/client/assets/{mcp-server-card-CkDDvd5o.js → mcp-server-card-DkR0AaJs.js} +1 -1
  90. package/dist/client/assets/{mcp-server-detail-CuItqIIY.js → mcp-server-detail-Bq0lDMH3.js} +2 -2
  91. package/dist/client/assets/members-DqAGtLhZ.js +3 -0
  92. package/dist/client/assets/{monaco-editor-gim9RLZ3.js → monaco-editor-KzPiR_VS.js} +4 -4
  93. package/dist/client/assets/{monitoring-AmN2oTrM.js → monitoring-DkEahA8B.js} +5 -5
  94. package/dist/client/assets/{oauth-callback-BO8hRY4t.js → oauth-callback-C_OPSpWp.js} +1 -1
  95. package/dist/client/assets/page-BQkgsSw9.js +1 -0
  96. package/dist/client/assets/{page-BcZkyr2a.js → page-DWOf0lbq.js} +1 -1
  97. package/dist/client/assets/{pin-to-sidebar-button-DbV8w54G.js → pin-to-sidebar-button-Cdnz6iok.js} +1 -1
  98. package/dist/client/assets/plugin-empty-state-Dr-6CK5g.js +1 -0
  99. package/dist/client/assets/plugin-header-CAC6QLaV.js +1 -0
  100. package/dist/client/assets/plugins-57qT4Dil.js +1 -0
  101. package/dist/client/assets/popover-Bkt9Kfhi.js +1 -0
  102. package/dist/client/assets/{registry-utils-DekIcM3F.js → registry-utils-tiv71gSA.js} +1 -1
  103. package/dist/client/assets/{resizable-V4jINWPU.js → resizable-BdOXbYHL.js} +1 -1
  104. package/dist/client/assets/{resource-tabs-BsRvwnyx.js → resource-tabs-G-U5EIhm.js} +1 -1
  105. package/dist/client/assets/select-reGYS0Ly.js +1 -0
  106. package/dist/client/assets/settings-zvu2qyde.js +1 -0
  107. package/dist/client/assets/shell-layout-C-8OlUFV.js +3 -0
  108. package/dist/client/assets/{spinner-CwfYynNt.js → spinner-E8mBz_Z6.js} +1 -1
  109. package/dist/client/assets/{store-invite-BErtY6PV.js → store-invite-DnYGNBjx.js} +1 -1
  110. package/dist/client/assets/switch-t5mcsF2Z.js +1 -0
  111. package/dist/client/assets/{textarea-DRMuRqUv.js → textarea-x7X_L353.js} +1 -1
  112. package/dist/client/assets/{tools-list-DesNUyav.js → tools-list-DQZuaE9M.js} +1 -1
  113. package/dist/client/assets/tooltip-Cw2xVvTD.js +1 -0
  114. package/dist/client/assets/typewriter-title-BK26jx8M.js +16 -0
  115. package/dist/client/assets/use-binding-BVBmgj67.js +23 -0
  116. package/dist/client/assets/use-collections-CVO4vm4G.js +1 -0
  117. package/dist/client/assets/{use-connection-TLrid9RM.js → use-connection-BU-nKbTz.js} +1 -1
  118. package/dist/client/assets/{use-create-virtual-mcp-Bi6QQFl1.js → use-create-virtual-mcp-Cr2fOp7g.js} +1 -1
  119. package/dist/client/assets/use-deco-chat-open-D-b5da72.js +1 -0
  120. package/dist/client/assets/{use-list-state-DuKw_MMV.js → use-list-state-ClsnlmlI.js} +1 -1
  121. package/dist/client/assets/use-mcp-prompts-B5zcyY9X.js +1 -0
  122. package/dist/client/assets/{use-members-g_5Yt7ve.js → use-members-CVUMGKct.js} +1 -1
  123. package/dist/client/assets/{use-mobile-DQ806XzQ.js → use-mobile-VoJXvE1W.js} +1 -1
  124. package/dist/client/assets/use-organization-settings-CeE0FyqT.js +1 -0
  125. package/dist/client/assets/{use-virtual-mcp-C8lLKpyG.js → use-virtual-mcp-DbjvrtSR.js} +1 -1
  126. package/dist/client/assets/useInfiniteQuery-CVAyTLiO.js +1 -0
  127. package/dist/client/assets/useMutation-Lj_Cbq0P.js +1 -0
  128. package/dist/client/assets/useQuery-C2zqJzGD.js +1 -0
  129. package/dist/client/assets/useSuspenseInfiniteQuery-BS0TxHG_.js +1 -0
  130. package/dist/client/assets/{view-mode-toggle-jPeow5hv.js → view-mode-toggle-BagEO4CJ.js} +1 -1
  131. package/dist/client/assets/{workflow-pPSpZECL.js → workflow-BuhbYm_s.js} +1 -1
  132. package/dist/client/index.html +2 -2
  133. package/dist/server/cli.js +169 -169
  134. package/dist/server/migrate.js +176 -176
  135. package/dist/server/server.js +160 -160
  136. package/package.json +1 -1
  137. package/dist/client/assets/FlipBackward-Cc_OirbM.js +0 -1
  138. package/dist/client/assets/Play-l95VP5u9.js +0 -1
  139. package/dist/client/assets/agent-detail-nBBUtMd0.js +0 -1
  140. package/dist/client/assets/collection-search-bOTNZP0b.js +0 -1
  141. package/dist/client/assets/connect-DYIKCRWy.js +0 -1
  142. package/dist/client/assets/connection-detail-D3-I_W38.js +0 -1
  143. package/dist/client/assets/constants-CnfPGmdA.js +0 -1
  144. package/dist/client/assets/dropdown-menu-CzQCi3DZ.js +0 -1
  145. package/dist/client/assets/file-browser-2RP-n1Xp.js +0 -2
  146. package/dist/client/assets/grid-view-BzgHSliB.js +0 -1
  147. package/dist/client/assets/home-CZ1MSx2E.js +0 -1
  148. package/dist/client/assets/index-CIvJ2wFV.js +0 -255
  149. package/dist/client/assets/index-CmUKmcyS.js +0 -1
  150. package/dist/client/assets/index-HgNYu27A.js +0 -1
  151. package/dist/client/assets/index-c6ju_hIh.js +0 -25
  152. package/dist/client/assets/index-cFLiAqt_.css +0 -1
  153. package/dist/client/assets/layout-BGZtLEwK.js +0 -1
  154. package/dist/client/assets/localstorage-keys-N4jrVxvr.js +0 -1
  155. package/dist/client/assets/members-C3Nvqq2t.js +0 -3
  156. package/dist/client/assets/page-D-IBJ4SW.js +0 -1
  157. package/dist/client/assets/plugin-empty-state-Df2LAyPv.js +0 -1
  158. package/dist/client/assets/plugin-header-e5FObvvx.js +0 -1
  159. package/dist/client/assets/plugins-BOsIh96E.js +0 -1
  160. package/dist/client/assets/popover-B2yKs5LA.js +0 -1
  161. package/dist/client/assets/select-BlFReF6r.js +0 -1
  162. package/dist/client/assets/settings-cRTESMAX.js +0 -1
  163. package/dist/client/assets/shell-layout-BfC0vVyw.js +0 -3
  164. package/dist/client/assets/switch-DjW_2nBx.js +0 -1
  165. package/dist/client/assets/tool-set-selector-Btgo2YwH.js +0 -1
  166. package/dist/client/assets/tooltip-aHeHMhKh.js +0 -1
  167. package/dist/client/assets/typewriter-title-DRU6uRKP.js +0 -16
  168. package/dist/client/assets/use-binding-C2mDgpbB.js +0 -23
  169. package/dist/client/assets/use-collections-CkAaybvR.js +0 -1
  170. package/dist/client/assets/use-mcp-prompts-D5tApqEs.js +0 -1
  171. package/dist/client/assets/use-organization-settings-C-IzAdi1.js +0 -1
  172. package/dist/client/assets/useInfiniteQuery-BUOCgX3w.js +0 -1
  173. package/dist/client/assets/useMutation-C4aXMLv3.js +0 -1
  174. package/dist/client/assets/useQuery-DNOH3p7p.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as V,u as je,g as W,K as le,o as fs,n as Xe,s as ue,ae as Ms,ad as Ds,Y as qe,k as Ts,h as zs,ab as J,j as t,c as de,q as ks}from"./index-C8OOnmm1.js";import{C as Us}from"./collection-header-Fc9BtUxQ.js";import{C as es}from"./collection-page-DvzZtNQd.js";import{C as Ze}from"./collection-search-bOTNZP0b.js";import{C as Bs}from"./collection-table-wrapper-Ch8oh2UW.js";import{T as Vs}from"./tool-set-selector-Btgo2YwH.js";import{u as ls}from"./use-members-g_5Yt7ve.js";import{u as Is}from"./useQuery-DNOH3p7p.js";import{u as fe}from"./useMutation-C4aXMLv3.js";import{b as Gs}from"./use-connection-TLrid9RM.js";import{A as Ce}from"./avatar-Cx4ORVtq.js";import{B as ve}from"./badge-DfeUgg96.js";import{c as re,B as ee}from"./button-C83AQWC1.js";import{C as $s}from"./checkbox-DcPieRc5.js";import{f as Ee,a as Te,b as Ie,c as Se,d as ye,e as Oe,A as Ae,g as we}from"./alert-dialog-5t1wq8Xl.js";import{D as Ss,f as ys,a as Os,b as Fs,c as Ks,e as Qs}from"./dialog-D_ebnPDF.js";import{D as as,a as cs,b as ds,c as Ke,d as qs,e as Zs,f as Hs,g as Ys}from"./dropdown-menu-CzQCi3DZ.js";import{i as Xs}from"./DotsHorizontal-BDAFctKq.js";import{i as As}from"./Loading01-Bf56vlFv.js";import{i as Js}from"./Lock01-CQ0bp8OP.js";import{s as ss}from"./Plus-CcqPpwU0.js";import{s as ws}from"./Trash01-DVYV3BJw.js";import{i as hs}from"./X-Dz8JZ2ZX.js";import{I as Ws}from"./input-CrR0FEof.js";import{S as Ve}from"./switch-DjW_2nBx.js";import{b as _e,c as Re,T as Le,a as Pe}from"./tooltip-aHeHMhKh.js";import{E as Je}from"./empty-state-Cr5g6Vh9.js";import{E as et}from"./error-boundary-Dg0Af8BA.js";import{a as st,F as gs,b as ps,c as tt,d as xs,f as bs}from"./form-BISYEAnP.js";import{S as ts,a as ns,b as rs,c as is,d as os}from"./select-BlFReF6r.js";import{T as nt}from"./textarea-DRMuRqUv.js";import{a as rt,u as it}from"./constants-ytntCGH9.js";import{C as Cs}from"./card-CbXWWn3M.js";import{i as _s}from"./DotsVertical-D5MnD2QZ.js";import{i as ot}from"./Key01-CrwOIsjX.js";import{s as lt}from"./XClose-BhgPfyG3.js";import"./collection-display-button-DlAEKbje.js";import"./ArrowUp-BfBrilbk.js";import"./Check-CXkamnnr.js";import"./Grid01-C_dMOr-7.js";import"./List-d88_8fTd.js";import"./view-mode-toggle-jPeow5hv.js";import"./SearchMd-Ns-pswyj.js";import"./ArrowLeft-DzpTEYvO.js";import"./use-collections-CkAaybvR.js";import"./ChevronDown-DaqG_J6Z.js";const ms=({size:s=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));ms.displayName="Shield01";const Rs=({size:s=24,color:e="currentColor",...n})=>V.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},V.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Rs.displayName="SwitchHorizontal01";const Ls=[{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:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",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"}],at={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",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",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"};function ct(){const s={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Ls)s[e.category]?.push(e);return s}function dt(){return Ls.map(s=>({value:s.name,label:at[s.name],dangerous:s.dangerous}))}const js=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function mt(s){return s.replace(/-/g," ")}function ut(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const o=[];let a=!1;const i=new Set;let f=!1;for(const[l,g]of Object.entries(s)){if(l==="self"){g.includes("*")?n=!0:e.push(...g);continue}if(l==="*"){if(a=!0,g.includes("*"))f=!0;else for(const E of g)i.add(E);continue}if(o.push(l),g.includes("*"))f=!0;else for(const E of g)i.add(E)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:o,allowsAllConnections:a,toolNames:Array.from(i),allowsAllTools:f}}function us(){const{locator:s}=je(),{data:e,isLoading:n,error:o,refetch:a}=Is({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await W.organization.listRoles();return l?.error?(console.error("[useOrganizationRoles] API error:",l.error),[]):l?.data??[]}catch(l){return console.error("[useOrganizationRoles] Fetch error:",l),[]}},staleTime:3e4}),i=js.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const g=l.role;if(!g||js.some(C=>C.value===g))continue;const{staticPermissions:E,allowsAllStaticPermissions:h,connectionIds:O,allowsAllConnections:d,toolNames:I,allowsAllTools:u}=ut(l.permission);i.push({id:l.id,role:g,label:mt(g),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:h?-1:E.length,allowsAllStaticPermissions:h,connectionCount:d?-1:O.length,allowsAllConnections:d,toolCount:u?-1:I.length,allowsAllTools:u})}const f=i.filter(l=>!l.isBuiltin);return{roles:i,customRoles:f,builtinRoles:i.filter(l=>l.isBuiltin),isLoading:n,error:o,refetch:a}}const ft=fs({role:fs({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:Ds(),staticPermissions:Xe(ue()),toolSet:Ms(ue(),Xe(ue())),memberIds:Xe(ue())});function Ps(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const ht=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],We=["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 gt(s){if(!s)return"bg-neutral-400";let e=0;for(let o=0;o<s.length;o++){const a=s.charCodeAt(o);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%We.length;return We[n]??We[0]}function Ge(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function pt(s){const e=de.c(39),{allowAllStaticPermissions:n,staticPermissions:o,onAllowAllChange:a,onPermissionsChange:i,readOnly:f}=s,l=f===void 0?!1:f,[g,E]=V.useState(""),h=V.useDeferredValue(g);let O,d,I,u,C;if(e[0]!==n||e[1]!==h||e[2]!==a||e[3]!==i||e[4]!==l||e[5]!==g||e[6]!==o){const p=ct(),c=dt(),N=c.filter(T=>T.label.toLowerCase().includes(h.toLowerCase())),S=T=>{if(o.includes(T))i(o.filter(R=>R!==T));else{const R=[...o,T];R.length===c.length?(a(!0),i([])):i(R)}};I="flex flex-col h-full",e[12]!==g?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(Ze,{value:g,onChange:E,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=g,e[13]=u):u=e[13];const L=!l&&"hover:bg-muted/50 cursor-pointer";let y;e[14]!==L?(y=re("flex items-center justify-between px-4 py-3 rounded-lg",L),e[14]=L,e[15]=y):y=e[15];let w;e[16]!==n||e[17]!==a||e[18]!==i||e[19]!==l?(w=()=>{if(l)return;a(!n),i([])},e[16]=n,e[17]=a,e[18]=i,e[19]=l,e[20]=w):w=e[20];let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=A):A=e[21];let P;e[22]!==n||e[23]!==a||e[24]!==i||e[25]!==l?(P=t.jsx("div",{onClick:Nt,children:l?t.jsx(_e,{children:t.jsxs(Re,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ve,{checked:n,disabled:l,onCheckedChange:T=>{l||(a(T),i([]))}})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ve,{checked:n,disabled:l,onCheckedChange:T=>{l||(a(T),i([]))}})}),e[22]=n,e[23]=a,e[24]=i,e[25]=l,e[26]=P):P=e[26],e[27]!==P||e[28]!==y||e[29]!==w?(C=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:y,onClick:w,children:[A,P]})}),e[27]=P,e[28]=y,e[29]=w,e[30]=C):C=e[30],O="flex-1 overflow-auto",d=Object.entries(p).map(T=>{const[R,D]=T,v=N.filter(m=>D.some(M=>M.name===m.value));return v.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:R}),t.jsx("div",{className:"space-y-1",children:v.map(m=>t.jsxs("div",{className:re("flex items-center justify-between gap-3 px-4 py-3",!l&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!l)if(n){a(!1);const M=c.map(jt);i(M.filter(G=>G!==m.value))}else S(m.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:m.label})}),t.jsx("div",{onClick:Ct,children:l?t.jsx(_e,{children:t.jsxs(Re,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ve,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(bt);i(M.filter(G=>G!==m.value))}else S(m.value)}})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ve,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(xt);i(M.filter(G=>G!==m.value))}else S(m.value)}})})]},m.value))})]},R)}),e[0]=n,e[1]=h,e[2]=a,e[3]=i,e[4]=l,e[5]=g,e[6]=o,e[7]=O,e[8]=d,e[9]=I,e[10]=u,e[11]=C}else O=e[7],d=e[8],I=e[9],u=e[10],C=e[11];let x;e[31]!==O||e[32]!==d?(x=t.jsx("div",{className:O,children:d}),e[31]=O,e[32]=d,e[33]=x):x=e[33];let j;return e[34]!==I||e[35]!==u||e[36]!==C||e[37]!==x?(j=t.jsxs("div",{className:I,children:[u,C,x]}),e[34]=I,e[35]=u,e[36]=C,e[37]=x,e[38]=j):j=e[38],j}function xt(s){return s.value}function bt(s){return s.value}function Ct(s){return s.stopPropagation()}function jt(s){return s.value}function Nt(s){return s.stopPropagation()}function vt(s){const e=de.c(56),{open:n,onOpenChange:o,selectedMemberIds:a,onAddMembers:i}=s,[f,l]=V.useState(""),g=V.useDeferredValue(f);let E;e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0];const[h,O]=V.useState(E),{data:d}=ls();let I,u,C,x,j,p,c,N,S,L,y;if(e[1]!==d?.data?.members||e[2]!==g||e[3]!==i||e[4]!==o||e[5]!==n||e[6]!==h||e[7]!==f||e[8]!==a){const M=d?.data?.members??[];let G;e[20]!==g?(G=k=>{const r=g.toLowerCase();return k.user?.name?.toLowerCase().includes(r)||k.user?.email?.toLowerCase().includes(r)},e[20]=g,e[21]=G):G=e[21];const se=M.filter(G),F=Et;let K;e[22]!==a?(K=k=>a.includes(k),e[22]=a,e[23]=K):K=e[23];const Q=K;let H;e[24]!==h?(H=k=>{h.includes(k)?O(h.filter(r=>r!==k)):O([...h,k])},e[24]=h,e[25]=H):H=e[25];const ne=H;let te;e[26]!==i||e[27]!==o||e[28]!==h?(te=()=>{i(h),O([]),o(!1)},e[26]=i,e[27]=o,e[28]=h,e[29]=te):te=e[29],C=te,u=Ee,L=n,y=o,I=Te,N="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs(Ie,{className:"px-6 pt-6",children:[t.jsx(Se,{children:"Add Members to Role"}),t.jsx(ye,{children:"Select members to add to this role."})]}),e[30]=S):S=e[30],p="flex flex-col h-80",e[31]!==f?(c=t.jsx(Ze,{value:f,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=f,e[32]=c):c=e[32],x="flex-1 overflow-auto",j=se.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:f?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:se.map(k=>{const r=F(k),b=Q(k.id),$=h.includes(k.id);return t.jsxs("label",{className:re("flex items-center gap-3 p-2 rounded-lg",!r||b?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx($s,{checked:$||b,onCheckedChange:()=>{r&&!b&&ne(k.id)},disabled:!r||b}),t.jsx(Ce,{url:k.user?.image??void 0,fallback:Ps(k.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.user?.email})]}),!r&&t.jsx(ve,{variant:"secondary",className:"shrink-0",children:"Owner"}),b&&r&&t.jsx(ve,{variant:"outline",className:"shrink-0",children:"Added"})]},k.id)})}),e[1]=d?.data?.members,e[2]=g,e[3]=i,e[4]=o,e[5]=n,e[6]=h,e[7]=f,e[8]=a,e[9]=I,e[10]=u,e[11]=C,e[12]=x,e[13]=j,e[14]=p,e[15]=c,e[16]=N,e[17]=S,e[18]=L,e[19]=y}else I=e[9],u=e[10],C=e[11],x=e[12],j=e[13],p=e[14],c=e[15],N=e[16],S=e[17],L=e[18],y=e[19];let w;e[33]!==x||e[34]!==j?(w=t.jsx("div",{className:x,children:j}),e[33]=x,e[34]=j,e[35]=w):w=e[35];let A;e[36]!==w||e[37]!==p||e[38]!==c?(A=t.jsxs("div",{className:p,children:[c,w]}),e[36]=w,e[37]=p,e[38]=c,e[39]=A):A=e[39];let P;e[40]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Ae,{children:"Cancel"}),e[40]=P):P=e[40];const T=h.length===0,R=h.length>0&&`(${h.length})`;let D;e[41]!==C||e[42]!==T||e[43]!==R?(D=t.jsxs(Oe,{className:"px-6 pb-6",children:[P,t.jsxs(we,{onClick:C,disabled:T,children:["Add ",R]})]}),e[41]=C,e[42]=T,e[43]=R,e[44]=D):D=e[44];let v;e[45]!==I||e[46]!==A||e[47]!==D||e[48]!==N||e[49]!==S?(v=t.jsxs(I,{className:N,children:[S,A,D]}),e[45]=I,e[46]=A,e[47]=D,e[48]=N,e[49]=S,e[50]=v):v=e[50];let m;return e[51]!==u||e[52]!==v||e[53]!==L||e[54]!==y?(m=t.jsx(u,{open:L,onOpenChange:y,children:v}),e[51]=u,e[52]=v,e[53]=L,e[54]=y,e[55]=m):m=e[55],m}function Et(s){return s.role!=="owner"}function Tt(s){const e=de.c(40),{memberIds:n,onMemberIdsChange:o,readOnly:a}=s,i=a===void 0?!1:a,[f,l]=V.useState(""),g=V.useDeferredValue(f),[E,h]=V.useState(!1),{data:O}=ls();let d,I,u,C,x;if(e[0]!==O?.data?.members||e[1]!==g||e[2]!==n||e[3]!==o||e[4]!==i||e[5]!==f){const N=O?.data?.members??[];let S;e[11]!==n?(S=v=>n.includes(v.id),e[11]=n,e[12]=S):S=e[12];const L=N.filter(S);let y;e[13]!==g?(y=v=>{const m=g.toLowerCase();return v.user?.name?.toLowerCase().includes(m)||v.user?.email?.toLowerCase().includes(m)},e[13]=g,e[14]=y):y=e[14];const w=L.filter(y);let A;e[15]!==n||e[16]!==o?(A=v=>{o(n.filter(m=>m!==v))},e[15]=n,e[16]=o,e[17]=A):A=e[17];const P=A;let T;e[18]!==n||e[19]!==o?(T=v=>{o([...n,...v])},e[18]=n,e[19]=o,e[20]=T):T=e[20],d=T,C="flex flex-col h-full";let R;e[21]!==f?(R=t.jsx(Ze,{value:f,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=f,e[22]=R):R=e[22];let D;e[23]!==i?(D=i?t.jsx("div",{className:"pr-4",children:t.jsx(_e,{children:t.jsxs(Re,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(ss,{size:16}),"Add Member"]})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[t.jsx(ss,{size:16}),"Add Member"]})}),e[23]=i,e[24]=D):D=e[24],e[25]!==R||e[26]!==D?(x=t.jsxs("div",{className:"flex items-center border-b border-border",children:[R,D]}),e[25]=R,e[26]=D,e[27]=x):x=e[27],I="flex-1 overflow-auto",u=L.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):w.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',f,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:w.map(v=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(Ce,{url:v.user?.image??void 0,fallback:Ps(v.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.user?.email})]}),i?t.jsx(_e,{children:t.jsxs(Re,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(hs,{size:16})})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>P(v.id),children:t.jsx(hs,{size:16})})]},v.id))}),e[0]=O?.data?.members,e[1]=g,e[2]=n,e[3]=o,e[4]=i,e[5]=f,e[6]=d,e[7]=I,e[8]=u,e[9]=C,e[10]=x}else d=e[6],I=e[7],u=e[8],C=e[9],x=e[10];let j;e[28]!==I||e[29]!==u?(j=t.jsx("div",{className:I,children:u}),e[28]=I,e[29]=u,e[30]=j):j=e[30];let p;e[31]!==E||e[32]!==d||e[33]!==n?(p=t.jsx(vt,{open:E,onOpenChange:h,selectedMemberIds:n,onAddMembers:d}),e[31]=E,e[32]=d,e[33]=n,e[34]=p):p=e[34];let c;return e[35]!==C||e[36]!==x||e[37]!==j||e[38]!==p?(c=t.jsxs("div",{className:C,children:[x,j,p]}),e[35]=C,e[36]=x,e[37]=j,e[38]=p,e[39]=c):c=e[39],c}function It(s){const e=de.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(As,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let o;return e[1]!==s?(o=t.jsx(V.Suspense,{fallback:n,children:t.jsx(Tt,{...s})}),e[1]=s,e[2]=o):o=e[2],o}const St={owner:[],admin:[],user:[]};function $e(s,e){const n=s==="owner"||s==="admin",o=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:St[s],toolSet:{},memberIds:o.map(a=>a.id)}}function yt({trigger:s,onSuccess:e}){const[n,o]=V.useState(!1),[a,i]=V.useState("mcp"),{locator:f}=je(),l=qe(),g=Gs()??[],{customRoles:E,refetch:h}=us(),{data:O}=Is({queryKey:le.members(f),queryFn:()=>W.organization.listMembers()}),d=Ts({resolver:zs(ft),defaultValues:Ge()}),I=d.formState.isValid,u=d.formState.isDirty,[C,x]=V.useState(null),[j,p]=V.useState(null),c=!d.watch("role.id")&&!d.watch("role.slug")&&!j,[N,S]=V.useState(null),[L,y]=V.useState(!1),[w,A]=V.useState(null),P=r=>{const b=r.permission||{},$=b.self||[],oe=$.includes("*"),ie=oe?[]:$.filter(z=>z!=="*"),Y={};for(const[z,U]of Object.entries(b))if(z!=="self")if(z==="*")for(const Z of g)U.includes("*")?Y[Z.id]=Z.tools?.map(ae=>ae.name)??[]:Y[Z.id]=U;else{const Z=g.find(ae=>ae.id===z);Z&&(U.includes("*")?Y[z]=Z.tools?.map(ae=>ae.name)??[]:Y[z]=U)}const me=(O?.data?.members??[]).filter(z=>z.role===r.role).map(z=>z.id);return{role:{id:r.id,slug:r.role,label:r.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:Y,memberIds:me}},T=r=>{const b=P(r);d.reset(b),x(r.id??null),p(null)},R=()=>{d.reset(Ge()),x(null),p(null),i("mcp")},D=r=>{u&&I?(A(()=>()=>T(r)),y(!0)):T(r)},v=async()=>{u&&I&&await H(),R()},m=r=>{if(u&&I)A(()=>()=>{const b=$e(r,O?.data?.members??[]);d.reset(b),p(r),x(null),i("org")}),y(!0);else{const b=$e(r,O?.data?.members??[]);d.reset(b),p(r),x(null),i("org")}},M=r=>{if(!r&&d.formState.isDirty&&I){A(()=>()=>{o(!1),d.reset(Ge()),p(null)}),y(!0);return}if(o(r),!r)d.reset(Ge()),p(null),x(null);else{const b=E[0];if(b)T(b);else{const $=$e("user",O?.data?.members??[]);d.reset($),p("user"),x(null),i("org")}}},G=()=>{y(!1),w&&(w(),A(null))},se=r=>{const b={};r.allowAllStaticPermissions?b.self=["*"]:r.staticPermissions.length>0&&(b.self=r.staticPermissions);for(const[$,oe]of Object.entries(r.toolSet))if(oe.length>0){const Y=g.find(q=>q.id===$)?.tools?.map(q=>q.name)??[];Y.length>0&&Y.every(q=>oe.includes(q))?b[$]=["*"]:b[$]=oe}return b},F=fe({mutationFn:async r=>{const b=se(r),$=r.role.slug||r.role.label.toLowerCase().replace(/\s+/g,"-");if(r.role.slug&&!r.role.id){const Y=(O?.data?.members??[]).filter(z=>z.role===r.role.slug).map(z=>z.id),q=r.memberIds.filter(z=>!Y.includes(z)),me=Y.filter(z=>!r.memberIds.includes(z));for(const z of q){const U=await W.organization.updateMemberRole({memberId:z,role:[r.role.slug]});if(U?.error)throw new Error(U.error.message)}for(const z of me){const U=await W.organization.updateMemberRole({memberId:z,role:["user"]});if(U?.error)throw new Error(U.error.message)}return r}else if(r.role.id){const ie=await W.organization.updateRole({roleId:r.role.id,data:{permission:b}});if(ie?.error)throw new Error(ie.error.message);const q=(O?.data?.members??[]).filter(U=>U.role===r.role.slug).map(U=>U.id),me=r.memberIds.filter(U=>!q.includes(U)),z=q.filter(U=>!r.memberIds.includes(U));for(const U of me){const Z=await W.organization.updateMemberRole({memberId:U,role:[r.role.slug]});if(Z?.error)throw new Error(Z.error.message)}for(const U of z){const Z=await W.organization.updateMemberRole({memberId:U,role:["user"]});if(Z?.error)throw new Error(Z.error.message)}return r}else{const ie=await W.organization.createRole({role:$,permission:b});if(ie?.error)throw new Error(ie.error.message);for(const Y of r.memberIds){const q=await W.organization.updateMemberRole({memberId:Y,role:[$]});if(q?.error)throw new Error(q.error.message)}return{...r,role:{...r.role,id:ie.data?.roleData?.id,slug:$}}}},onSuccess:(r,b)=>{l.invalidateQueries({queryKey:le.members(f)}),l.invalidateQueries({queryKey:le.organizationRoles(f)});const $=!b.role.id&&!b.role.slug,oe=b.role.slug&&!b.role.id;J.success(oe?"Members updated successfully!":$?"Role created successfully!":"Role updated successfully!"),h(),d.reset(r),r.role.id&&x(r.role.id),e?.()},onError:r=>{J.error(r instanceof Error?r.message:"Failed to save role")}}),K=fe({mutationFn:async r=>{const b=await W.organization.deleteRole({roleId:r});if(b?.error)throw new Error(b.error.message);return b?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(f)}),l.invalidateQueries({queryKey:le.organizationRoles(f)}),J.success("Role deleted successfully!"),h(),N?.id===C){const r=E.filter(b=>b.id!==N?.id);if(r[0])T(r[0]);else{const b=$e("user",O?.data?.members??[]);d.reset(b),p("user"),x(null),i("org")}}},onError:r=>{J.error(r instanceof Error?r.message:"Failed to delete role")}}),Q=F.isPending||K.isPending,H=async()=>{const r=d.getValues();if(!r.role.label.trim()){J.error("Role name is required"),d.setFocus("role.label");return}await F.mutateAsync(r)},ne=d.handleSubmit(r=>{if(!r.role.label.trim()){J.error("Role name is required"),d.setFocus("role.label");return}F.mutate(r)}),te=r=>{r.id&&S({id:r.id,label:r.label})},k=()=>{N?.id&&K.mutate(N.id),S(null)};return t.jsxs(Ss,{open:n,onOpenChange:M,children:[t.jsx(ys,{asChild:!0,children:s}),t.jsx(Os,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[ht.map(r=>{const b=j===r.role;return t.jsxs("div",{className:re("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>m(r.role),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",r.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsx(Js,{size:14,className:"text-muted-foreground shrink-0"})]},r.role)}),E.map(r=>{const b=C===r.id;return t.jsxs("div",{className:re("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>D(r),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",gt(r.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsxs(as,{children:[t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:re("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",b&&"opacity-100 pointer-events-auto"),onClick:$=>$.stopPropagation(),children:t.jsx(Xs,{size:14})})}),t.jsx(ds,{align:"end",children:t.jsxs(Ke,{className:"text-destructive",onClick:$=>{$.stopPropagation(),te(r)},children:[t.jsx(ws,{size:16}),"Delete"]})})]})]},r.id)}),c&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(Ws,{...d.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}),t.jsx(ve,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:v,disabled:Q||u,className:"w-full h-10",children:[t.jsx(ss,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!j&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("mcp"),className:re("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("org"),className:re("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("members"),className:re("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!j&&t.jsx(Vs,{toolSet:d.watch("toolSet"),onToolSetChange:r=>d.setValue("toolSet",r,{shouldDirty:!0})}),a==="org"&&t.jsx(pt,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:r=>d.setValue("allowAllStaticPermissions",r,{shouldDirty:!0}),onPermissionsChange:r=>d.setValue("staticPermissions",r,{shouldDirty:!0}),readOnly:!!j}),a==="members"&&t.jsx(It,{memberIds:d.watch("memberIds"),onMemberIdsChange:r=>d.setValue("memberIds",r,{shouldDirty:!0}),readOnly:j==="owner"})]}),(!j||j!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>M(!1),disabled:Q,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:ne,disabled:Q||!I||!d.formState.isDirty,className:"h-10",children:F.isPending?"Saving...":c?"Create Role":"Save Changes"})]})]})]})}),t.jsx(Ee,{open:N!==null,onOpenChange:r=>!r&&S(null),children:t.jsxs(Te,{children:[t.jsxs(Ie,{children:[t.jsx(Se,{children:"Delete Role"}),t.jsxs(ye,{children:['Are you sure you want to delete the "',N?.label,'" role? This action cannot be undone.']})]}),t.jsxs(Oe,{children:[t.jsx(Ae,{children:"Cancel"}),t.jsx(we,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Ee,{open:L,onOpenChange:y,children:t.jsxs(Te,{children:[t.jsxs(Ie,{children:[t.jsx(Se,{children:"Discard Changes"}),t.jsx(ye,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(Oe,{children:[t.jsx(Ae,{onClick:()=>A(null),children:"Keep Editing"}),t.jsx(we,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const Ot=ue().email("Invalid email address");function At(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function wt({trigger:s}){const[e,n]=V.useState(!1),{locator:o}=je(),a=qe(),{data:i}=W.useSession(),f=i?.user?.email,{roles:l,isLoading:g}=us(),E=l.filter(p=>p.role!=="owner"),h=Ts({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),O=h.watch("emailsText"),d=h.watch("role"),u=At(O).filter(p=>{const c=Ot.safeParse(p).success,N=!f||p!==f.toLowerCase();return c&&N}),C=fe({mutationFn:async({emails:p,role:c})=>{if(!c)throw new Error("Please select a role");const N=await Promise.allSettled(p.map(async L=>{const y=await W.organization.inviteMember({email:L,role:c});if(y.error)throw new Error(y.error.message);return y.data})),S=N.filter(L=>L.status==="rejected");if(S.length>0)throw new Error(`Failed to invite ${S.length} member${S.length>1?"s":""}`);return N},onSuccess:(p,{emails:c})=>{a.invalidateQueries({queryKey:le.members(o)}),a.invalidateQueries({queryKey:le.invitations(o)}),J.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),h.reset({emailsText:"",role:"user"}),n(!1)},onError:p=>{J.error(p instanceof Error?p.message:"Failed to invite members")}}),x=p=>{if(u.length===0){J.error("Please enter at least one valid email address");return}if(!p.role){J.error("Please select a role");return}C.mutate({emails:u,role:p.role})},j=u.length>0&&!!d;return t.jsxs(Ss,{open:e,onOpenChange:n,children:[t.jsx(ys,{asChild:!0,children:s}),t.jsxs(Os,{className:"sm:max-w-lg",children:[t.jsx(Fs,{children:t.jsx(Ks,{children:"Invite members"})}),t.jsx(st,{...h,children:t.jsxs("form",{onSubmit:h.handleSubmit(x),className:"space-y-4",children:[t.jsx(gs,{control:h.control,name:"emailsText",render:({field:p})=>t.jsxs(ps,{children:[t.jsx(tt,{children:"Email addresses"}),t.jsx(xs,{children:t.jsx(nt,{...p,disabled:C.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"})}),t.jsx(bs,{})]})}),t.jsx(gs,{control:h.control,name:"role",render:({field:p})=>t.jsxs(ps,{children:[t.jsx(xs,{children:t.jsxs(ts,{value:p.value,onValueChange:p.onChange,disabled:C.isPending||g,children:[t.jsx(ns,{className:"w-full",children:t.jsx(rs,{placeholder:"Select a role"})}),t.jsx(is,{children:E.map(c=>{const N=[];return c.isBuiltin||(c.allowsAllStaticPermissions?N.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&N.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?N.push("All connections"):c.connectionCount&&c.connectionCount>0&&N.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?N.push("all tools"):c.toolCount&&c.toolCount>0&&N.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),t.jsx(os,{value:c.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:c.label}),!c.isBuiltin&&N.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:N.join(", ")})]})},c.role)})})]})}),t.jsx(bs,{})]})}),t.jsxs(Qs,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{h.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:C.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:C.isPending||!j,children:C.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function _t(){const s=de.c(9),{org:e,locator:n}=je();let o;s[0]!==e.id?(o={connectionId:rt,orgId:e.id},s[0]=e.id,s[1]=o):o=s[1];const a=it(o);let i;s[2]!==n?(i=le.invitations(n),s[2]=n,s[3]=i):i=s[3];let f;s[4]!==a?(f=async()=>{const g=await a.callTool({name:"ORGANIZATION_GET",arguments:{}});return(g.structuredContent??g)?.invitations??[]},s[4]=a,s[5]=f):f=s[5];let l;return s[6]!==i||s[7]!==f?(l={queryKey:i,queryFn:f},s[6]=i,s[7]=f,s[8]=l):l=s[8],ks(l)}function Rt(){const s=de.c(5),{locator:e}=je(),n=qe();let o;s[0]!==e||s[1]!==n?(o={mutationFn:Pt,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),J.success("Invitation cancelled")},onError:Lt},s[0]=e,s[1]=n,s[2]=o):o=s[2];const a=fe(o);let i;return s[3]!==a?(i={cancel:a},s[3]=a,s[4]=i):i=s[4],i}function Lt(s){J.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Pt(s){const e=await W.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const Ns=["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"],Mt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Qe(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Dt(s){const e=new Map;for(const[n,o]of Object.entries(Mt))e.set(n,o);for(let n=0;n<s.length;n++){const o=s[n];o&&!e.has(o.role)&&e.set(o.role,Ns[n%Ns.length]??"bg-neutral-400")}return e}function zt(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Fe(s){const e=de.c(79),{role:n,memberId:o,isOwner:a,roleColorMap:i,selectableRoles:f,onRoleChange:l,size:g,className:E}=s,h=g===void 0?"xs":g;let O,d,I,u,C,x,j,p,c,N,S;if(e[0]!==E||e[1]!==a||e[2]!==o||e[3]!==l||e[4]!==n||e[5]!==i||e[6]!==f||e[7]!==h){S=Symbol.for("react.early_return_sentinel");e:{const v=i.get(n)??"bg-neutral-400";if(a){let m;e[19]!==o||e[20]!==l?(m=k=>l(o,k),e[19]=o,e[20]=l,e[21]=m):m=e[21];let M;e[22]!==n?(M=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const G=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:re("size-2 rounded-full shrink-0",v)}),M]});let se;e[24]!==G?(se=t.jsx(rs,{children:G}),e[24]=G,e[25]=se):se=e[25];let F;e[26]!==E||e[27]!==h||e[28]!==se?(F=t.jsx(ns,{size:h,className:E,children:se}),e[26]=E,e[27]=h,e[28]=se,e[29]=F):F=e[29];let K;if(e[30]!==i||e[31]!==f){let k;e[33]!==i?(k=r=>{const b=i.get(r.role)??"bg-neutral-400";return t.jsx(os,{value:r.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",b)}),t.jsx("span",{className:"capitalize",children:r.label})]})},r.role)},e[33]=i,e[34]=k):k=e[34],K=f.map(k),e[30]=i,e[31]=f,e[32]=K}else K=e[32];let Q;e[35]!==K?(Q=t.jsx(is,{children:K}),e[35]=K,e[36]=Q):Q=e[36];let H;e[37]!==a||e[38]!==n||e[39]!==m||e[40]!==F||e[41]!==Q?(H=t.jsx(Le,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(ts,{value:n,onValueChange:m,disabled:a,children:[F,Q]})})}),e[37]=a,e[38]=n,e[39]=m,e[40]=F,e[41]=Q,e[42]=H):H=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Pe,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=ne):ne=e[43];let te;e[44]!==H?(te=t.jsx(_e,{children:t.jsxs(Re,{children:[H,ne]})}),e[44]=H,e[45]=te):te=e[45],S=te;break e}I=ts,p=n,e[46]!==o||e[47]!==l?(c=m=>l(o,m),e[46]=o,e[47]=l,e[48]=c):c=e[48],N=a,d=ns,x=h,j=E,O=rs,C="flex items-center gap-2 min-w-0",u=re("size-2 rounded-full shrink-0",v)}e[0]=E,e[1]=a,e[2]=o,e[3]=l,e[4]=n,e[5]=i,e[6]=f,e[7]=h,e[8]=O,e[9]=d,e[10]=I,e[11]=u,e[12]=C,e[13]=x,e[14]=j,e[15]=p,e[16]=c,e[17]=N,e[18]=S}else O=e[8],d=e[9],I=e[10],u=e[11],C=e[12],x=e[13],j=e[14],p=e[15],c=e[16],N=e[17],S=e[18];if(S!==Symbol.for("react.early_return_sentinel"))return S;let L;e[49]!==u?(L=t.jsx("div",{className:u}),e[49]=u,e[50]=L):L=e[50];let y;e[51]!==n?(y=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=y):y=e[52];let w;e[53]!==L||e[54]!==y||e[55]!==C?(w=t.jsxs("div",{className:C,children:[L,y]}),e[53]=L,e[54]=y,e[55]=C,e[56]=w):w=e[56];let A;e[57]!==O||e[58]!==w?(A=t.jsx(O,{children:w}),e[57]=O,e[58]=w,e[59]=A):A=e[59];let P;e[60]!==d||e[61]!==A||e[62]!==x||e[63]!==j?(P=t.jsx(d,{size:x,className:j,children:A}),e[60]=d,e[61]=A,e[62]=x,e[63]=j,e[64]=P):P=e[64];let T;if(e[65]!==i||e[66]!==f){let v;e[68]!==i?(v=m=>{const M=i.get(m.role)??"bg-neutral-400";return t.jsx(os,{value:m.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",M)}),t.jsx("span",{className:"capitalize",children:m.label})]})},m.role)},e[68]=i,e[69]=v):v=e[69],T=f.map(v),e[65]=i,e[66]=f,e[67]=T}else T=e[67];let R;e[70]!==T?(R=t.jsx(is,{children:T}),e[70]=T,e[71]=R):R=e[71];let D;return e[72]!==I||e[73]!==P||e[74]!==R||e[75]!==p||e[76]!==c||e[77]!==N?(D=t.jsxs(I,{value:p,onValueChange:c,disabled:N,children:[P,R]}),e[72]=I,e[73]=P,e[74]=R,e[75]=p,e[76]=c,e[77]=N,e[78]=D):D=e[78],D}function vs(s){const e=de.c(51),{member:n,roles:o,onChangeRole:a,onRemove:i,isUpdating:f}=s,l=f===void 0?!1:f,g=n.role==="owner";let E,h,O,d,I,u,C,x,j;if(e[0]!==g||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==o){let P;e[15]!==n.role?(P=m=>m.role!==n.role&&m.role!=="owner",e[15]=n.role,e[16]=P):P=e[16];const T=o.filter(P);d=as;let R;e[17]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(_s,{size:20}),e[17]=R):R=e[17],e[18]!==g?(j=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:g,onClick:Ut,children:R})}),e[18]=g,e[19]=j):j=e[19],O=ds,C="end",x=kt,h=qs;let D;e[20]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(Rs,{size:16}),e[20]=D):D=e[20],e[21]!==l?(u=t.jsxs(Zs,{disabled:l,children:[D,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],E=Hs;let v;e[23]!==l||e[24]!==n.id||e[25]!==a?(v=m=>{const M=[];return m.isBuiltin||(m.allowsAllStaticPermissions?M.push("Full org access"):m.staticPermissionCount&&m.staticPermissionCount>0&&M.push(`${m.staticPermissionCount} org perm${m.staticPermissionCount!==1?"s":""}`),m.allowsAllConnections?M.push("All connections"):m.connectionCount&&m.connectionCount>0&&M.push(`${m.connectionCount} connection${m.connectionCount!==1?"s":""}`),(m.connectionCount!==0||m.allowsAllConnections)&&(m.allowsAllTools?M.push("all tools"):m.toolCount&&m.toolCount>0&&M.push(`${m.toolCount} tool${m.toolCount!==1?"s":""}`))),t.jsxs(Ke,{onClick:G=>{G.stopPropagation(),a(n.id,m.role)},disabled:l,children:[m.isBuiltin?t.jsx(ms,{size:16}):t.jsx(ot,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:m.label}),!m.isBuiltin&&M.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},m.role)},e[23]=l,e[24]=n.id,e[25]=a,e[26]=v):v=e[26],I=T.map(v),e[0]=g,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=o,e[6]=E,e[7]=h,e[8]=O,e[9]=d,e[10]=I,e[11]=u,e[12]=C,e[13]=x,e[14]=j}else E=e[6],h=e[7],O=e[8],d=e[9],I=e[10],u=e[11],C=e[12],x=e[13],j=e[14];let p;e[27]!==E||e[28]!==I?(p=t.jsx(E,{children:I}),e[27]=E,e[28]=I,e[29]=p):p=e[29];let c;e[30]!==h||e[31]!==u||e[32]!==p?(c=t.jsxs(h,{children:[u,p]}),e[30]=h,e[31]=u,e[32]=p,e[33]=c):c=e[33];let N;e[34]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ys,{}),e[34]=N):N=e[34];let S;e[35]!==n.id||e[36]!==i?(S=P=>{P.stopPropagation(),i(n.id)},e[35]=n.id,e[36]=i,e[37]=S):S=e[37];let L;e[38]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(ws,{size:16}),e[38]=L):L=e[38];let y;e[39]!==S?(y=t.jsxs(Ke,{variant:"destructive",onClick:S,children:[L,"Remove Member"]}),e[39]=S,e[40]=y):y=e[40];let w;e[41]!==O||e[42]!==y||e[43]!==C||e[44]!==x||e[45]!==c?(w=t.jsxs(O,{align:C,onClick:x,children:[c,N,y]}),e[41]=O,e[42]=y,e[43]=C,e[44]=x,e[45]=c,e[46]=w):w=e[46];let A;return e[47]!==d||e[48]!==w||e[49]!==j?(A=t.jsxs(d,{children:[j,w]}),e[47]=d,e[48]=w,e[49]=j,e[50]=A):A=e[50],A}function kt(s){return s.stopPropagation()}function Ut(s){return s.stopPropagation()}function Es(s){const e=de.c(8),{invitationId:n,onCancel:o,isCancelling:a}=s,i=a===void 0?!1:a;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Vt,children:t.jsx(_s,{size:20})})}),e[0]=f):f=e[0];let l;e[1]!==n||e[2]!==o?(l=h=>{h.stopPropagation(),o(n)},e[1]=n,e[2]=o,e[3]=l):l=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(lt,{size:16}),e[4]=g):g=e[4];let E;return e[5]!==i||e[6]!==l?(E=t.jsxs(as,{children:[f,t.jsx(ds,{align:"end",onClick:Bt,children:t.jsxs(Ke,{variant:"destructive",onClick:l,disabled:i,children:[g,"Cancel Invitation"]})})]}),e[5]=i,e[6]=l,e[7]=E):E=e[7],E}function Bt(s){return s.stopPropagation()}function Vt(s){return s.stopPropagation()}function Gt(){const s=de.c(74),{data:e}=ls(),{data:n}=_t(),o=Rt(),a=qe(),{locator:i}=je(),[f,l]=V.useState(null),[g,E]=V.useState(null),[h,O]=V.useState(""),[d,I]=V.useState("table"),[u,C]=V.useState("member"),[x,j]=V.useState("asc"),p=e?.data?.members;let c;s[0]!==u?(c=_=>{u===_?j(sn):(C(_),j("asc"))},s[0]=u,s[1]=c):c=s[1];const N=c;let S=p??[],L=n??[];if(h){const _=h.toLowerCase();S=S.filter(B=>B.user?.name?.toLowerCase().includes(_)||B.user?.email?.toLowerCase().includes(_)||B.role?.toLowerCase().includes(_)),L=L.filter(B=>B.email?.toLowerCase().includes(_)||B.role?.toLowerCase().includes(_))}if(u&&x){let _;s[2]!==x||s[3]!==u?(_=(B,X)=>{let ce,Ne;e:switch(u){case"member":{ce=B.user?.name||"",Ne=X.user?.name||"";break e}case"role":{ce=B.role||"",Ne=X.role||"";break e}case"joined":{ce=B.createdAt?typeof B.createdAt=="string"?B.createdAt:B.createdAt.toISOString():"",Ne=X.createdAt?typeof X.createdAt=="string"?X.createdAt:X.createdAt.toISOString():"";break e}default:return 0}return x==="asc"?ce.localeCompare(Ne):Ne.localeCompare(ce)},s[2]=x,s[3]=u,s[4]=_):_=s[4],S=[...S].sort(_)}const y=S;let w;s[5]!==i||s[6]!==a?(w={mutationFn:en,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),J.success("Member has been removed from the organization"),l(null)},onError:Wt},s[5]=i,s[6]=a,s[7]=w):w=s[7];const A=fe(w);let P;s[8]!==i||s[9]!==a?(P={mutationFn:Jt,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),J.success("Member's role has been updated")},onError:Xt},s[8]=i,s[9]=a,s[10]=P):P=s[10];const T=fe(P);let R;s[11]!==i||s[12]!==a?(R={mutationFn:Yt,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(i)}),J.success("Invitation role has been updated")},onError:Ht},s[11]=i,s[12]=a,s[13]=R):R=s[13];const D=fe(R),{roles:v,customRoles:m}=us();let M;s[14]!==m?(M=Dt(m),s[14]=m,s[15]=M):M=s[15];const G=M;let se;s[16]!==v?(se=v.filter(Zt),s[16]=v,s[17]=se):se=s[17];const F=se;let K;s[18]===Symbol.for("react.memo_cache_sentinel")?(K={id:"member",header:"Member",render:qt,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=K):K=s[18];let Q;s[19]!==G||s[20]!==F||s[21]!==D||s[22]!==T?(Q={id:"role",header:"Role",render:_=>_.type==="member"?t.jsx(Fe,{role:_.data.role,memberId:_.data.id,isOwner:_.data.role==="owner",roleColorMap:G,selectableRoles:F,onRoleChange:(B,X)=>T.mutate({memberId:B,role:X}),className:"w-36"}):t.jsx(Fe,{role:_.data.role,memberId:_.data.id,isOwner:!1,roleColorMap:G,selectableRoles:F,onRoleChange:(B,X)=>D.mutate({invitationId:B,role:X,email:_.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=G,s[20]=F,s[21]=D,s[22]=T,s[23]=Q):Q=s[23];let H;s[24]===Symbol.for("react.memo_cache_sentinel")?(H={id:"joined",header:"Joined",render:Qt,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=H):H=s[24];let ne;s[25]!==o.cancel.isPending||s[26]!==v||s[27]!==T?(ne={id:"actions",header:"",render:_=>_.type==="member"?t.jsx(vs,{member:_.data,roles:v,onChangeRole:(B,X)=>T.mutate({memberId:B,role:X}),onRemove:l,isUpdating:T.isPending}):t.jsx(Es,{invitationId:_.data.id,onCancel:E,isCancelling:o.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=o.cancel.isPending,s[26]=v,s[27]=T,s[28]=ne):ne=s[28];let te;s[29]!==Q||s[30]!==ne?(te=[K,Q,H,ne],s[29]=Q,s[30]=ne,s[31]=te):te=s[31];const k=te;let r;s[32]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(yt,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(ms,{size:16}),"Manage Roles"]})}),s[32]=r):r=s[32];let b;s[33]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[r,t.jsx(wt,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=b):b=s[33];const $=b,oe=[...y.map(Kt),...L.filter(Ft).map($t)],ie=es,Y=!!g;let q;s[34]===Symbol.for("react.memo_cache_sentinel")?(q=()=>E(null),s[34]=q):q=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Ie,{children:[t.jsx(Se,{children:"Cancel Invitation"}),t.jsx(ye,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),s[35]=me):me=s[35];let z;s[36]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(Ae,{children:"Keep Invitation"}),s[36]=z):z=s[36];let U;s[37]!==o.cancel||s[38]!==g?(U=()=>{g&&(o.cancel.mutate(g),E(null))},s[37]=o.cancel,s[38]=g,s[39]=U):U=s[39];let Z;s[40]!==o.cancel.isPending||s[41]!==U?(Z=t.jsxs(Te,{children:[me,t.jsxs(Oe,{children:[z,t.jsx(we,{onClick:U,disabled:o.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=o.cancel.isPending,s[41]=U,s[42]=Z):Z=s[42];let ae;s[43]!==Y||s[44]!==Z?(ae=t.jsx(Ee,{open:Y,onOpenChange:q,children:Z}),s[43]=Y,s[44]=Z,s[45]=ae):ae=s[45];const He=!!f;let Me;s[46]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>l(null),s[46]=Me):Me=s[46];let De;s[47]===Symbol.for("react.memo_cache_sentinel")?(De=t.jsxs(Ie,{children:[t.jsx(Se,{children:"Remove Member"}),t.jsx(ye,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=De):De=s[47];let ze;s[48]===Symbol.for("react.memo_cache_sentinel")?(ze=t.jsx(Ae,{children:"Cancel"}),s[48]=ze):ze=s[48];let he;s[49]!==f||s[50]!==A?(he=()=>f&&A.mutate(f),s[49]=f,s[50]=A,s[51]=he):he=s[51];let ge;s[52]!==A.isPending||s[53]!==he?(ge=t.jsxs(Te,{children:[De,t.jsxs(Oe,{children:[ze,t.jsx(we,{onClick:he,disabled:A.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=A.isPending,s[53]=he,s[54]=ge):ge=s[54];let pe;s[55]!==He||s[56]!==ge?(pe=t.jsx(Ee,{open:He,onOpenChange:Me,children:ge}),s[55]=He,s[56]=ge,s[57]=pe):pe=s[57];let ke;s[58]===Symbol.for("react.memo_cache_sentinel")?(ke=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[58]=ke):ke=s[58];let xe;s[59]!==N||s[60]!==x||s[61]!==u||s[62]!==d?(xe=t.jsx(Us,{title:"Members",viewMode:d,onViewModeChange:I,sortKey:u,sortDirection:x,onSort:N,sortOptions:ke,ctaButton:$}),s[59]=N,s[60]=x,s[61]=u,s[62]=d,s[63]=xe):xe=s[63];let Ue;s[64]===Symbol.for("react.memo_cache_sentinel")?(Ue=_=>{_.key==="Escape"&&(O(""),_.target.blur())},s[64]=Ue):Ue=s[64];let be;s[65]!==h?(be=t.jsx(Ze,{value:h,onChange:O,placeholder:"Search members...",onKeyDown:Ue}),s[65]=h,s[66]=be):be=s[66];const Ye=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(Je,{title:"No members found",description:h?`No members match "${h}"`:"Invite members to get started."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:oe.map(_=>{if(_.type==="invitation")return t.jsxs(Cs,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(Es,{invitationId:_.data.id,onCancel:E,isCancelling:o.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{fallback:Qe(_.data.email),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:_.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(ve,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(Fe,{role:_.data.role,memberId:_.data.id,isOwner:!1,roleColorMap:G,selectableRoles:F,onRoleChange:(X,ce)=>D.mutate({invitationId:X,role:ce,email:_.data.email}),className:"w-fit"})]})]})]},`inv-${_.data.id}`);const B=_.data;return t.jsxs(Cs,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(vs,{member:B,roles:v,onChangeRole:(X,ce)=>T.mutate({memberId:X,role:ce}),onRemove:l,isUpdating:T.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{url:B.user?.image??void 0,fallback:Qe(B.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:B.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:B.user?.email}),t.jsx(Fe,{role:B.role,memberId:B.id,isOwner:B.role==="owner",roleColorMap:G,selectableRoles:F,onRoleChange:(X,ce)=>T.mutate({memberId:X,role:ce}),className:"w-fit"})]})]})]},B.id)})})}):t.jsx(Bs,{columns:k,data:oe,isLoading:!1,sortKey:u,sortDirection:x,onSort:N,emptyState:h?t.jsx(Je,{title:"No members found",description:`No members match "${h}"`}):t.jsx(Je,{title:"No members found",description:"Invite members to get started."})});let Be;return s[67]!==ie||s[68]!==ae||s[69]!==pe||s[70]!==xe||s[71]!==be||s[72]!==Ye?(Be=t.jsxs(ie,{children:[ae,pe,xe,be,Ye]}),s[67]=ie,s[68]=ae,s[69]=pe,s[70]=xe,s[71]=be,s[72]=Ye,s[73]=Be):Be=s[73],Be}function $t(s){return{type:"invitation",data:s}}function Ft(s){return s.status==="pending"}function Kt(s){return{type:"member",data:s}}function Qt(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?zt(s.data.createdAt):"N/A"}):t.jsx(ve,{variant:"outline",children:"Pending"})}function qt(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{url:s.data.user?.image??void 0,fallback:Qe(s.data.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.user?.name||"Unknown"}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.data.user?.email})]})]}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{fallback:Qe(s.data.email),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.email}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Zt(s){return s.role!=="owner"}function Ht(s){J.error(s instanceof Error?s.message:"Failed to update invitation role")}async function Yt(s){const{invitationId:e,role:n,email:o}=s,a=await W.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const i=await W.organization.inviteMember({email:o,role:n});if(i?.error)throw new Error(i.error.message)}function Xt(s){J.error(s instanceof Error?s.message:"Failed to update role")}async function Jt(s){const{memberId:e,role:n}=s,o=await W.organization.updateMemberRole({memberId:e,role:[n]});if(o?.error)throw new Error(o.error.message)}function Wt(s){J.error(s instanceof Error?s.message:"Failed to remove member")}async function en(s){const e=await W.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function sn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Hn(){const s=de.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(et,{fallback:e,children:t.jsx(V.Suspense,{fallback:t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(As,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(Gt,{})})}),s[1]=n):n=s[1],n}export{Hn as default};
@@ -1 +0,0 @@
1
- import{c as b,j as s,r as $,u as ie,g as le,ab as Y}from"./index-C8OOnmm1.js";import{u as X,S as Q,V as re,C as x}from"./index-CIvJ2wFV.js";import{T as ne,i as oe,a as ae,t as ce}from"./typewriter-title-DRU6uRKP.js";import{E as me}from"./error-boundary-Dg0Af8BA.js";import{I as Z}from"./empty-state-Cr5g6Vh9.js";import{P as de,a as fe,b as ue}from"./popover-B2yKs5LA.js";import{c as ee,B as A}from"./button-C83AQWC1.js";import{i as he,b as xe}from"./constants-ytntCGH9.js";import{b as pe}from"./use-virtual-mcp-C8lLKpyG.js";import{i as je}from"./Grid01-C_dMOr-7.js";import{t as te}from"./Users03-CSRHEIl2.js";import{T as q,a as G,c as K}from"./tooltip-aHeHMhKh.js";import{c as ge}from"./Pin01-DBKe5RmK.js";import{s as be}from"./Plus-CcqPpwU0.js";import{i as ye}from"./Share07-B5yrbjwk.js";import"./X-Dz8JZ2ZX.js";import"./use-collections-CkAaybvR.js";import"./useMutation-C4aXMLv3.js";import"./useQuery-DNOH3p7p.js";import"./use-connection-TLrid9RM.js";import"./use-binding-C2mDgpbB.js";import"./binder-Dh-m11Sm.js";import"./monaco-editor-gim9RLZ3.js";import"./infiniteQueryObserver-B1N6PF-z.js";import"./spinner-CwfYynNt.js";import"./localstorage-keys-N4jrVxvr.js";import"./input-CrR0FEof.js";import"./select-BlFReF6r.js";import"./Check-CXkamnnr.js";import"./ChevronDown-DaqG_J6Z.js";import"./File06-C7QVLRp6.js";import"./Image01-C6IcS9Ip.js";import"./SearchMd-Ns-pswyj.js";import"./use-mcp-prompts-D5tApqEs.js";import"./dialog-D_ebnPDF.js";import"./form-BISYEAnP.js";import"./AlertCircle--GzH2vta.js";import"./ArrowUp-BfBrilbk.js";import"./Edit01-7Ak8JL9W.js";import"./Copy01-CpBgXJFP.js";import"./Terminal-qZhwvVsv.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-DVYV3BJw.js";import"./use-create-virtual-mcp-Bi6QQFl1.js";function _e(e){const t=b.c(15),{agent:i}=e,{setVirtualMcpId:h}=X();let l;t[0]!==i.id||t[1]!==h?(l=()=>{h(i.id)},t[0]=i.id,t[1]=h,t[2]=l):l=t[2];const r=l;let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=ee("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=a):a=t[3];const c=`Select agent ${i.title}`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(te,{size:20}),t[4]=d):d=t[4];let n;t[5]!==i.icon||t[6]!==i.title?(n=s.jsx(Z,{icon:i.icon,name:i.title,fallbackIcon:d}),t[5]=i.icon,t[6]=i.title,t[7]=n):n=t[7];let o;t[8]!==i.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:i.title}),t[8]=i.title,t[9]=o):o=t[9];let m;return t[10]!==r||t[11]!==c||t[12]!==n||t[13]!==o?(m=s.jsxs("button",{type:"button",onClick:r,className:a,"aria-label":c,children:[n,o]}),t[10]=r,t[11]=c,t[12]=n,t[13]=o,t[14]=m):m=t[14],m}function Ne(e){const t=b.c(14),{virtualMcps:i,selectedVirtualMcpId:h,onVirtualMcpChange:l}=e,[r,a]=$.useState(!1),c=$.useRef(null);let d,n;t[0]!==r?(d=()=>{r&&setTimeout(()=>{c.current?.focus()},0)},n=[r],t[0]=r,t[1]=d,t[2]=n):(d=t[1],n=t[2]),$.useEffect(d,n);let o;t[3]!==l?(o=J=>{l(J),a(!1)},t[3]=l,t[4]=o):o=t[4];const m=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=ee("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(de,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"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(je,{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 p;t[7]!==m||t[8]!==h||t[9]!==i?(p=s.jsx(fe,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(re,{virtualMcps:i,selectedVirtualMcpId:h,onVirtualMcpChange:m,searchInputRef:c})}),t[7]=m,t[8]=h,t[9]=i,t[10]=p):p=t[10];let g;return t[11]!==r||t[12]!==p?(g=s.jsxs(ue,{open:r,onOpenChange:a,children:[u,p]}),t[11]=r,t[12]=p,t[13]=g):g=t[13],g}function Se(){const e=b.c(20),t=pe(),{selectedVirtualMcp:i,setVirtualMcpId:h}=X();let l,r,a,c,d,n;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const p=t.filter(we).slice(0,6);if(p.length===0){d=null;break e}n=t.map(Ce),a="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=c):c=e[7],l="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",r=p.map(ve)}e[0]=t,e[1]=l,e[2]=r,e[3]=a,e[4]=c,e[5]=d,e[6]=n}else l=e[1],r=e[2],a=e[3],c=e[4],d=e[5],n=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;const o=i?.id??null;let m;e[8]!==h||e[9]!==o||e[10]!==n?(m=s.jsx(Ne,{virtualMcps:n,selectedVirtualMcpId:o,onVirtualMcpChange:h}),e[8]=h,e[9]=o,e[10]=n,e[11]=m):m=e[11];let f;e[12]!==l||e[13]!==r||e[14]!==m?(f=s.jsxs("div",{className:l,children:[r,m]}),e[12]=l,e[13]=r,e[14]=m,e[15]=f):f=e[15];let u;return e[16]!==a||e[17]!==c||e[18]!==f?(u=s.jsxs("div",{className:a,children:[c,f]}),e[16]=a,e[17]=c,e[18]=f,e[19]=u):u=e[19],u}function ve(e){return s.jsx(_e,{agent:e},e.id??"default")}function Ce(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function we(e){return e.id!==null&&!he(e.id)}function ke(){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(ze)})]}),e[1]=i):i=e[1],i}function ze(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 Te(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx($.Suspense,{fallback:s.jsx(ke,{}),children:s.jsx(Se,{})}),e[0]=t):t=e[0],t}function Me(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Ie(){const e=b.c(60),{org:t}=ie(),{data:i}=le.useSession(),{modelsConnections:h,isChatEmpty:l,activeThreadId:r,setActiveThreadId:a,threads:c,selectedVirtualMcp:d}=X();let n;if(e[0]!==r||e[1]!==c){let j;e[3]!==r?(j=se=>se.id===r,e[3]=r,e[4]=j):j=e[4],n=c.find(j),e[0]=r,e[1]=c,e[2]=n}else n=e[2];const o=n,[m,f]=$.useState(!1);let u;e[5]!==i?.user?.name?(u=i?.user?.name?.split(" ")[0]||"there",e[5]=i?.user?.name,e[6]=u):u=e[6];const p=u;let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=Me(),e[7]=g):g=e[7];const J=g;let V;e[8]!==t.id?(V=xe(t.id),e[8]=t.id,e[9]=V):V=e[9];const E=d??V;if(h.length===0){let j;return e[10]!==t?(j=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(x.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=j):j=e[11],j}let y;e[12]!==o||e[13]!==l?(y=s.jsx(x.Header.Left,{children:!l&&o?.title?s.jsx(ne,{text:o.title,className:"text-sm font-medium text-foreground"}):s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[12]=o,e[13]=l,e[14]=y):y=e[14];let _;e[15]!==a?(_=()=>a(crypto.randomUUID()),e[15]=a,e[16]=_):_=e[16];let H;e[17]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(be,{size:16}),e[17]=H):H=e[17];let N;e[18]!==l||e[19]!==_?(N=s.jsx(q,{asChild:!0,children:s.jsx(A,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:_,disabled:l,"aria-label":"New chat",children:H})}),e[18]=l,e[19]=_,e[20]=N):N=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(G,{children:"New chat"}),e[21]=R):R=e[21];let S;e[22]!==N?(S=s.jsxs(K,{children:[N,R]}),e[22]=N,e[23]=S):S=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=()=>f(!0),e[24]=O):O=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsxs(K,{children:[s.jsx(q,{asChild:!0,children:s.jsx(A,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:O,"aria-label":"Chat history",children:s.jsx(oe,{size:16})})}),s.jsx(G,{children:"Chat history"})]}),e[25]=B):B=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(ge,{size:16}),e[26]=L):L=e[26];let v;e[27]!==l?(v=s.jsx(q,{asChild:!0,children:s.jsx(A,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:$e,disabled:l,"aria-label":"Pin chat",children:L})}),e[27]=l,e[28]=v):v=e[28];let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(G,{children:"Pin chat"}),e[29]=D):D=e[29];let C;e[30]!==v?(C=s.jsxs(K,{children:[v,D]}),e[30]=v,e[31]=C):C=e[31];let F;e[32]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(ye,{size:16}),e[32]=F):F=e[32];let w;e[33]!==l?(w=s.jsx(q,{asChild:!0,children:s.jsx(A,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Pe,disabled:l,"aria-label":"Share chat",children:F})}),e[33]=l,e[34]=w):w=e[34];let U;e[35]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(G,{children:"Share chat"}),e[35]=U):U=e[35];let k;e[36]!==w?(k=s.jsxs(K,{children:[w,U]}),e[36]=w,e[37]=k):k=e[37];let z;e[38]!==C||e[39]!==k||e[40]!==S?(z=s.jsxs(x.Header.Right,{children:[S,B,C,k]}),e[38]=C,e[39]=k,e[40]=S,e[41]=z):z=e[41];let T;e[42]!==z||e[43]!==y?(T=s.jsxs(x.Header,{children:[y,z]}),e[42]=z,e[43]=y,e[44]=T):T=e[44];let M;e[45]!==E||e[46]!==l||e[47]!==p?(M=l?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 gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(Z,{icon:E.icon,name:E.title,size:"md",fallbackIcon:s.jsx(te,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[J," ",p,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(x.Input,{})}),s.jsx(x.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Te,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(x.Main,{children:s.jsx(x.Messages,{minHeightOffset:280})}),s.jsx(x.Footer,{children:s.jsx(x.Input,{})})]}),e[45]=E,e[46]=l,e[47]=p,e[48]=M):M=e[48];let I;e[49]!==a?(I=j=>{a(j),f(!1)},e[49]=a,e[50]=I):I=e[50];let P;e[51]!==r||e[52]!==m||e[53]!==I||e[54]!==c?(P=s.jsx(ae,{open:m,onOpenChange:f,threads:c,activeThreadId:r,onThreadSelect:I}),e[51]=r,e[52]=m,e[53]=I,e[54]=c,e[55]=P):P=e[55];let W;return e[56]!==T||e[57]!==M||e[58]!==P?(W=s.jsxs(x,{children:[T,M,P]}),e[56]=T,e[57]=M,e[58]=P,e[59]=W):W=e[59],W}function Pe(){Y.info("Share feature coming soon")}function $e(){Y.info("Pin feature coming soon")}function Ae(e){const t=b.c(14),{error:i,onRetry:h}=e,l=i?.message?.includes("401")||i?.message?.toLowerCase().includes("unauthorized");let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(x.Header,{children:[s.jsx(x.Header.Left,{children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),s.jsx(x.Header.Right,{})]}),t[0]=r):r=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(ce,{className:"h-6 w-6 text-destructive"})}),t[1]=a):a=t[1];const c=l?"Unable to load models":"Something went wrong";let d;t[2]!==c?(d=s.jsx("h3",{className:"text-lg font-medium",children:c}),t[2]=c,t[3]=d):d=t[3];const n=l?"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 o;t[4]!==n?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[4]=n,t[5]=o):o=t[5];let m;t[6]!==d||t[7]!==o?(m=s.jsxs("div",{className:"space-y-2",children:[d,o]}),t[6]=d,t[7]=o,t[8]=m):m=t[8];let f;t[9]!==h?(f=s.jsx(A,{variant:"outline",onClick:h,children:"Try again"}),t[9]=h,t[10]=f):f=t[10];let u;return t[11]!==m||t[12]!==f?(u=s.jsxs(x,{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:[a,m,f]})})]}),t[11]=m,t[12]=f,t[13]=u):u=t[13],u}function kt(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(x.Skeleton,{}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(me,{fallback:Ve,children:s.jsx($.Suspense,{fallback:t,children:s.jsx(x.Provider,{children:s.jsx(Ie,{})})})}),e[1]=i):i=e[1],i}function Ve(e){const{error:t,resetError:i}=e;return s.jsx(Ae,{error:t,onRetry:i})}export{kt as default};
@@ -1 +0,0 @@
1
- import{c as n,j as t,$ as o}from"./index-C8OOnmm1.js";function c(){const s=n.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(o,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No storage connected"}),t.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an S3-compatible storage service to browse and manage files."})]}),s[0]=e):e=s[0],e}export{c as default};
@@ -1 +0,0 @@
1
- import{c as w,j as s,r as S,$ as v}from"./index-C8OOnmm1.js";import{i as _}from"./Check-CXkamnnr.js";import{t as $}from"./ChevronDown-DaqG_J6Z.js";function k(x){const e=w.c(32),{connections:l,selectedConnectionId:r,onConnectionChange:N}=x,[n,y]=S.useState(!1),C=S.useRef(null);let p;if(e[0]!==l||e[1]!==r){let t;e[3]!==r?(t=u=>u.id===r,e[3]=r,e[4]=t):t=e[4],p=l.find(t),e[0]=l,e[1]=r,e[2]=p}else p=e[2];const i=p;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=t=>{C.current?.contains(t.relatedTarget)||y(!1)},e[5]=b):b=e[5];const R=b;if(l.length===1){let t;e[6]!==i?(t=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[6]=i,e[7]=t):t=e[7];const u=i?.title||"Storage";let f;e[8]!==u?(f=s.jsx("span",{children:u}),e[8]=u,e[9]=f):f=e[9];let h;return e[10]!==t||e[11]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t,f]}),e[10]=t,e[11]=f,e[12]=h):h=e[12],h}let o;e[13]!==n?(o=()=>y(!n),e[13]=n,e[14]=o):o=e[14];let c;e[15]!==i?(c=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[15]=i,e[16]=c):c=e[16];const z=i?.title||"Select storage";let a;e[17]!==z?(a=s.jsx("span",{children:z}),e[17]=z,e[18]=a):a=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx($,{size:14}),e[19]=j):j=e[19];let d;e[20]!==o||e[21]!==c||e[22]!==a?(d=s.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md border border-border bg-background hover:bg-accent transition-colors",children:[c,a,j]}),e[20]=o,e[21]=c,e[22]=a,e[23]=d):d=e[23];let m;e[24]!==l||e[25]!==n||e[26]!==N||e[27]!==r?(m=n&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-48 rounded-md border border-border bg-popover p-1 shadow-md",children:l.map(t=>s.jsxs("button",{type:"button",onClick:()=>{N(t.id),y(!1)},className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent transition-colors",children:[t.icon?s.jsx("img",{src:t.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),s.jsx("span",{className:"flex-1 text-left",children:t.title}),t.id===r&&s.jsx(_,{size:14,className:"text-primary"})]},t.id))}),e[24]=l,e[25]=n,e[26]=N,e[27]=r,e[28]=m):m=e[28];let g;return e[29]!==d||e[30]!==m?(g=s.jsxs("div",{className:"relative",ref:C,onBlur:R,children:[d,m]}),e[29]=d,e[30]=m,e[31]=g):g=e[31],g}function O(x){const e=w.c(2);let l;return e[0]!==x?(l=s.jsx("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:s.jsx(k,{...x})}),e[0]=x,e[1]=l):l=e[1],l}export{O as default};
@@ -1 +0,0 @@
1
- import{r as x,c as u,j as r,B as L,u as O,l as A,ac as R,aP as h,ab as N,aZ as D}from"./index-C8OOnmm1.js";import{C as I}from"./collection-header-Fc9BtUxQ.js";import{C as M}from"./collection-page-DvzZtNQd.js";import{u as F,a as H}from"./use-organization-settings-C-IzAdi1.js";import{c as f,B as b}from"./button-C83AQWC1.js";import{S as T}from"./switch-DjW_2nBx.js";import{i as W}from"./ArrowLeft-DzpTEYvO.js";import"./collection-display-button-DlAEKbje.js";import"./dropdown-menu-CzQCi3DZ.js";import"./Grid01-C_dMOr-7.js";import"./ArrowUp-BfBrilbk.js";import"./Check-CXkamnnr.js";import"./List-d88_8fTd.js";import"./tooltip-aHeHMhKh.js";import"./view-mode-toggle-jPeow5hv.js";import"./useMutation-C4aXMLv3.js";import"./constants-ytntCGH9.js";const S=({size:a=24,color:e="currentColor",...s})=>x.createElement("svg",{viewBox:"0 0 24 24",width:a,height:a,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},x.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function Z(a){const e=u.c(4);let s;e[0]!==a?({...s}=a,e[0]=a,e[1]=s):s=e[1];let t;return e[2]!==s?(t=r.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...s}),e[2]=s,e[3]=t):t=e[3],t}function q(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==t||e[6]!==i?(n=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function C(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("inline-flex items-center gap-1.5",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==t||e[6]!==i?(n=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function G(a){const e=u.c(10);let s,t,i;e[0]!==a?({asChild:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const n=s?L:"a";let o;e[4]!==t?(o=f("hover:text-foreground transition-colors",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==i||e[8]!==o?(d=r.jsx(n,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=n,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function J(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("text-foreground font-normal",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==t||e[6]!==i?(n=r.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function K(a){const e=u.c(12);let s,t,i;e[0]!==a?({children:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let n;e[4]!==t?(n=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=n):n=e[5];let o;e[6]!==s?(o=s??r.jsx(S,{}),e[6]=s,e[7]=o):o=e[7];let d;return e[8]!==i||e[9]!==n||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:n,...i,children:o}),e[8]=i,e[9]=n,e[10]=o,e[11]=d):d=e[11],d}function me(){const{org:a}=O(),e=A(),s=F(a.id),{update:t}=H(a.id),[i,n]=x.useState({}),[o,d]=x.useState(!1),p=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:p.includes(l)},P=()=>{const l=new Set(p);for(const[c,m]of Object.entries(i))m?l.add(c):l.delete(c);return Array.from(l)},j=Object.keys(i).length>0,w=(l,c)=>{const m=p.includes(l);n(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},y=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:P()}),n({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{n({})},B=l=>D.find(c=>c.pluginId===l),z=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(M,{children:[r.jsx(I,{title:r.jsx(Z,{children:r.jsxs(q,{children:[r.jsx(C,{children:r.jsx(G,{asChild:!0,children:r.jsx(R,{to:"/$org/settings",params:{org:a.slug},children:"Settings"})})}),r.jsx(K,{}),r.jsx(C,{children:r.jsx(J,{children:"Plugins"})})]})}),leftElement:r.jsx(b,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:a.slug}}),children:r.jsx(W,{className:"size-4"})})}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"flex h-full",children:r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"p-5 max-w-2xl",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization."})}),r.jsx("div",{className:"divide-y divide-border border-y border-border",children:h.map(l=>{const c=B(l.id),m=z(l.id),g=k(l.id);return r.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c?.icon&&r.jsx("div",{className:"flex-shrink-0 text-muted-foreground [&>svg]:size-4",children:c.icon}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:c?.label??l.id}),m&&r.jsx("p",{className:"text-xs text-muted-foreground",children:m})]})]}),r.jsx(T,{checked:g,onCheckedChange:v=>w(l.id,v),disabled:o})]},l.id)})}),h.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),r.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[r.jsx(b,{onClick:y,disabled:!j||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),j&&r.jsx(b,{variant:"outline",onClick:E,disabled:o,children:"Cancel"})]})]})})})})})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{r as i,ah as $,j as c,ai as z,aj as L,ak as A,al as _,am as g,an as j,ao as w,ap as G,aq as E,ar as H,as as K,at as q,au as U,av as V,aw as W,ax as Z,ay as B,az as J,c as R}from"./index-C8OOnmm1.js";import{c as Q}from"./button-C83AQWC1.js";var m="Popover",[b]=q(m,[E]),P=E(),[X,d]=b(m),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:a,modal:s=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:a,caller:m});return c.jsx(z,{...p,children:c.jsx(X,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(C=>!C),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:s,children:o})})};N.displayName=m;var F="PopoverAnchor",Y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),a=P(o),{onCustomAnchorAdd:s,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(s(),()=>p()),[s,p]),c.jsx(j,{...a,...r,ref:e})});Y.displayName=F;var y="PopoverTrigger",S=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(y,o),a=P(o),s=A(e,n.triggerRef),p=c.jsx(_.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:s,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(j,{asChild:!0,...a,children:p})});S.displayName=y;var O="PopoverPortal",[ee,oe]=b(O,{forceMount:void 0}),D=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,a=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(w,{present:o||a.open,children:c.jsx(G,{asChild:!0,container:n,children:r})})})};D.displayName=O;var v="PopoverContent",M=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,a=d(v,t.__scopePopover);return c.jsx(w,{present:r||a.open,children:a.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});M.displayName=v;var te=U("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=A(e,r),a=i.useRef(!1);return i.useEffect(()=>{const s=r.current;if(s)return H(s)},[]),c.jsx(K,{as:te,allowPinchZoom:!0,children:c.jsx(k,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,s=>{s.preventDefault(),a.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,s=>{const p=s.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,s=>s.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(k,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||o.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=a.target;o.triggerRef.current?.contains(s)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),k=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),C=P(o);return V(),c.jsx(W,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:a,children:c.jsx(Z,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(B,{"data-state":I(f.open),role:"dialog",id:f.contentId,...C,...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)"}})})})}),T="PopoverClose",ae=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(T,o);return c.jsx(_.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});ae.displayName=T;var se="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(J,{...n,...r,ref:e})});ce.displayName=se;function I(t){return t?"open":"closed"}var ie=N,pe=S,le=D,ue=M;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(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(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 Pe(t){const e=R.c(12);let o,r,n,a;e[0]!==t?({className:o,align:n,sideOffset:a,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=a):(o=e[1],r=e[2],n=e[3],a=e[4]);const s=n===void 0?"center":n,p=a===void 0?4:a;let l;e[5]!==o?(l=Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==s||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:s,sideOffset:p,className:l,...r})}),e[7]=s,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ge as P,Pe as a,ve as b};
@@ -1 +0,0 @@
1
- import{r as c,b9 as rt,ah as Ne,j as d,ai as st,aj as be,ak as k,an as lt,al as j,am as P,be as $,ap as at,Z as _e,aq as Ee,bf as it,aA as ct,bg as dt,ar as ut,av as pt,as as ft,aw as mt,ax as ht,at as vt,au as gt,ay as xt,az as St,c as ee}from"./index-C8OOnmm1.js";import{V as wt}from"./tooltip-aHeHMhKh.js";import{i as Ct}from"./Check-CXkamnnr.js";import{t as Re}from"./ChevronDown-DaqG_J6Z.js";import{c as oe}from"./button-C83AQWC1.js";function Pe(n,[e,t]){return Math.min(t,Math.max(e,n))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=it(J),[ne]=vt(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[U,M]=c.useState(!1),re=rt(u),[_,O]=Ne({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[F,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(lt,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:P(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var _t="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=n=>d.jsx(at,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?_e.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=gt("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,U]=c.useState(null),[M,re]=c.useState(null),_=k(e,f=>U(f)),[O,F]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return ut(x)},[x]),pt();const E=c.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(ft,{as:jt,allowPinchZoom:!0,children:d.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,_=>h(_)),b=ue(t),w=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const _=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const I=q.left-O.left,N=F.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-F.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ie,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[U,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Ue=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[b,w]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=c.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=ct(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ft;function et(n){return n===""||n===void 0}function tt(n){const e=dt(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Ue,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 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] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(n){const e=ee.c(25);let t,o,r,i,s;e[0]!==n?({className:o,children:t,position:i,hideScrollButtons:s,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(t=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const l=i===void 0?"popper":i,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==r||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",className:h,position:l,...r,children:[g,S,p]})}),e[18]=l,e[19]=r,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(Ct,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e};
@@ -1 +0,0 @@
1
- import{r as y,l as $,u as B,Y as D,k as P,h as K,ab as C,K as I,g as Q,j as s,ac as A,c as Y,o as H,s as L}from"./index-C8OOnmm1.js";import{C as T}from"./collection-header-Fc9BtUxQ.js";import{C as W}from"./collection-page-DvzZtNQd.js";import{u as Z}from"./useMutation-C4aXMLv3.js";import{B as w}from"./button-C83AQWC1.js";import{a as G,F as k,b as R,c as E,d as O,f as M,e as J}from"./form-BISYEAnP.js";import{I as U}from"./input-CrR0FEof.js";import{i as V}from"./Grid01-C_dMOr-7.js";import{i as X}from"./Upload01-CCAaxnrW.js";import{i as _}from"./X-Dz8JZ2ZX.js";import"./collection-display-button-DlAEKbje.js";import"./dropdown-menu-CzQCi3DZ.js";import"./ArrowUp-BfBrilbk.js";import"./Check-CXkamnnr.js";import"./List-d88_8fTd.js";import"./tooltip-aHeHMhKh.js";import"./view-mode-toggle-jPeow5hv.js";const q=({size:d=24,color:e="currentColor",...r})=>y.createElement("svg",{viewBox:"0 0 24 24",width:d,height:d,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},y.createElement("path",{d:"m2 14.5 9.642 4.821c.131.066.197.099.266.111.06.012.123.012.184 0 .069-.012.135-.045.266-.11L22 14.5m-20-5 9.642-4.821c.131-.066.197-.098.266-.111a.5.5 0 0 1 .184 0c.069.013.135.045.266.111L22 9.5l-9.642 4.821a1.028 1.028 0 0 1-.266.111.501.501 0 0 1-.184 0c-.069-.012-.135-.045-.266-.11L2 9.5Z"}));q.displayName="LayersTwo01";const ee=H({name:L().min(1,"Name is required").max(255,"Name is too long"),slug:L().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:L().optional()});function se(d){const e=Y.c(24),{value:r,onChange:a,name:m}=d,o=y.useRef(null);let u;e[0]!==a?(u=z=>{const F=z.target.files?.[0];if(F){if(F.size>2097152){C.error("Image must be smaller than 2MB");return}const c=new FileReader;c.onerror=()=>{const N=c.error;console.error("FileReader error:",N),C.error(N?.message||"Failed to read image file. Please try again."),o.current&&(o.current.value="")},c.onloadend=()=>{if(c.readyState===FileReader.DONE&&c.result){const N=c.result;a(N)}},c.readAsDataURL(F)}},e[0]=a,e[1]=u):u=e[1];const j=u;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current?.click()},e[2]=l):l=e[2];const t=l;let i;e[3]!==a?(i=z=>{z.stopPropagation(),a("")},e[3]=a,e[4]=i):i=e[4];const n=i;let g;e[5]!==j?(g=s.jsx("input",{type:"file",ref:o,className:"hidden",accept:"image/*",onChange:j}),e[5]=j,e[6]=g):g=e[6];let x;e[7]!==n||e[8]!==m||e[9]!==r?(x=r?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:r,alt:m||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:n,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(_,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:t,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(X,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=n,e[8]=m,e[9]=r,e[10]=x):x=e[10];const S=r?"Change Logo":"Upload Logo";let h;e[11]!==S?(h=s.jsx(w,{type:"button",variant:"outline",size:"sm",onClick:t,className:"mb-2",children:S}),e[11]=S,e[12]=h):h=e[12];let f;e[13]!==n||e[14]!==r?(f=r&&s.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"ml-2",children:"Remove"}),e[13]=n,e[14]=r,e[15]=f):f=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=v):v=e[16];let p;e[17]!==h||e[18]!==f?(p=s.jsxs("div",{className:"flex-1",children:[h,f,v]}),e[17]=h,e[18]=f,e[19]=p):p=e[19];let b;return e[20]!==p||e[21]!==g||e[22]!==x?(b=s.jsxs("div",{className:"flex items-start gap-4",children:[g,x,p]}),e[20]=p,e[21]=g,e[22]=x,e[23]=b):b=e[23],b}function ve(){const d=$(),{org:e}=B(),r=D(),[a,m]=y.useState(!1),o=P({resolver:K(ee),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),u=Z({mutationFn:async t=>{const i={name:t.name,slug:t.slug};t.logo&&(i.logo=t.logo);const n=await Q.organization.update({organizationId:e.id,data:i});if(n?.error)throw new Error(n.error.message||"Failed to update organization");return n},onSuccess:t=>{r.invalidateQueries({queryKey:I.organizations()}),r.invalidateQueries({queryKey:I.activeOrganization(e.slug)}),C.success("Organization settings updated successfully"),t?.data?.slug&&t.data.slug!==e.slug&&d({to:"/$org/settings",params:{org:t.data.slug}})},onError:t=>{C.error(t instanceof Error?t.message:"Failed to update organization")},onSettled:()=>{m(!1)}}),j=t=>{m(!0),u.mutate(t)},l=o.formState.isDirty;return s.jsxs(W,{children:[s.jsx(T,{title:"Settings"}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"p-5 max-w-2xl",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),s.jsx(G,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(j),className:"space-y-6",children:[s.jsx(k,{control:o.control,name:"name",render:({field:t})=>s.jsxs(R,{children:[s.jsx(E,{children:"Organization Name"}),s.jsx(O,{children:s.jsx(U,{placeholder:"My Organization",...t,disabled:a})}),s.jsx(M,{})]})}),s.jsx(k,{control:o.control,name:"slug",render:({field:t})=>s.jsxs(R,{children:[s.jsx(E,{children:"Organization Slug"}),s.jsx(O,{children:s.jsx(U,{placeholder:"my-organization",...t,disabled:a,onChange:i=>{const n=i.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");t.onChange(n)}})}),s.jsx(J,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(M,{})]})}),s.jsx(k,{control:o.control,name:"logo",render:({field:t})=>s.jsxs(R,{children:[s.jsx(E,{children:"Logo"}),s.jsx(O,{children:s.jsx(se,{value:t.value,onChange:t.onChange,name:o.watch("name")})}),s.jsx(M,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(w,{type:"submit",disabled:!l||a,className:"min-w-24",children:a?"Saving...":"Save Changes"}),l&&s.jsx(w,{type:"button",variant:"outline",onClick:()=>o.reset(),disabled:a,children:"Cancel"})]})]})}),s.jsxs("div",{className:"border-t border-border pt-6 mt-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"More Settings"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Additional configuration options for your organization."})]}),s.jsx("div",{className:"mt-4",children:s.jsxs(A,{to:"/$org/settings/plugins",params:{org:e.slug},className:"flex items-center justify-between p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors group",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(q,{className:"h-5 w-5 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-foreground",children:"Plugins"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization"})]})]}),s.jsx(V,{className:"h-5 w-5 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]})})})})})]})}export{ve as default};
@@ -1,3 +0,0 @@
1
- import{r as w,bd as dt,g as J,j as a,l as me,ab as Y,c as h,B as mt,t as ft,u as fe,bj as xe,L as Ne,aZ as ut,bF as pt,a as Oe,bg as Te,bG as ae,bH as ht,b as xt,S as Me,d as gt,e as bt,N as jt,q as vt,P as wt,K as St,O as Nt,aO as Ae}from"./index-C8OOnmm1.js";import{B as Z,c as $}from"./button-C83AQWC1.js";import{b as Ee,P as Re,a as De}from"./popover-B2yKs5LA.js";import{B as ye}from"./badge-DfeUgg96.js";import{i as ce}from"./Check-CXkamnnr.js";import{n as Ce}from"./Inbox01-D1IW7Je7.js";import{s as _e}from"./XClose-BhgPfyG3.js";import{E as Pe}from"./error-boundary-Dg0Af8BA.js";import{i as yt}from"./File06-C7QVLRp6.js";import{i as de}from"./X-Dz8JZ2ZX.js";import{u as ie}from"./use-mobile-DQ806XzQ.js";import{S as Ct,b as _t,c as kt,d as It,e as zt,T as $t,i as Ot,f as Tt,t as Mt}from"./typewriter-title-DRU6uRKP.js";import{a as Le,b as He,T as Ue,c as Be}from"./tooltip-aHeHMhKh.js";import{S as We,i as At,a as Et,C as R,u as Rt}from"./index-CIvJ2wFV.js";import{u as ge,a as Dt}from"./use-organization-settings-C-IzAdi1.js";import{n as Pt,I as pe}from"./empty-state-Cr5g6Vh9.js";import{a as Lt}from"./Home02-Cfg1gm8U.js";import{t as Ve}from"./Users03-CSRHEIl2.js";import{C as Ht}from"./create-organization-dialog-GjXRxTaj.js";import{I as Ut}from"./input-CrR0FEof.js";import{A as ne}from"./avatar-Cx4ORVtq.js";import{c as Bt}from"./Grid01-C_dMOr-7.js";import{a as Wt,b as Vt,D as Ft,c as Kt,g as ke}from"./dropdown-menu-CzQCi3DZ.js";import{a as Fe}from"./Copy01-CpBgXJFP.js";import{n as Ie}from"./LinkExternal01-yVEf-2cT.js";import{c as Gt,b as Zt,g as qt,a as Yt,D as Jt}from"./dialog-D_ebnPDF.js";import{L as Xt}from"./form-BISYEAnP.js";import{S as Qt}from"./switch-DjW_2nBx.js";import{i as es}from"./Code01-BNQVP8-g.js";import{u as be,L as je}from"./localstorage-keys-N4jrVxvr.js";import{R as Ke,a as ts,b as ss}from"./resizable-V4jINWPU.js";import{b as ns}from"./constants-ytntCGH9.js";import{s as as}from"./Plus-CcqPpwU0.js";import"./SearchMd-Ns-pswyj.js";import"./use-virtual-mcp-C8lLKpyG.js";import"./use-collections-CkAaybvR.js";import"./useMutation-C4aXMLv3.js";import"./useQuery-DNOH3p7p.js";import"./use-connection-TLrid9RM.js";import"./use-binding-C2mDgpbB.js";import"./binder-Dh-m11Sm.js";import"./monaco-editor-gim9RLZ3.js";import"./infiniteQueryObserver-B1N6PF-z.js";import"./spinner-CwfYynNt.js";import"./select-BlFReF6r.js";import"./ChevronDown-DaqG_J6Z.js";import"./Image01-C6IcS9Ip.js";import"./use-mcp-prompts-D5tApqEs.js";import"./AlertCircle--GzH2vta.js";import"./ArrowUp-BfBrilbk.js";import"./Edit01-7Ak8JL9W.js";import"./Terminal-qZhwvVsv.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-DVYV3BJw.js";import"./use-create-virtual-mcp-Bi6QQFl1.js";import"./alert-dialog-5t1wq8Xl.js";const Ge=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));Ge.displayName="BarChart10";const Ze=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M15 21v-5.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C14.24 14 13.96 14 13.4 14h-2.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C9 14.76 9 15.04 9 15.6V21M3 7a3 3 0 0 0 6 0 3 3 0 1 0 6 0 3 3 0 1 0 6 0M6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3H6.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21Z"}));Ze.displayName="Building02";const qe=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M2 12h20M2 12c0 5.523 4.477 10 10 10M2 12C2 6.477 6.477 2 12 2m10 10c0 5.523-4.477 10-10 10m10-10c0-5.523-4.477-10-10-10m0 0a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10"}));qe.displayName="Globe01";const Ye=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.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"}));Ye.displayName="LayoutRight";const Je=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.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 21H9"}));Je.displayName="LogOut01";const Xe=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"m2 7 8.165 5.715c.661.463.992.695 1.351.784a2 2 0 0 0 .968 0c.36-.09.69-.32 1.351-.784L22 7M6.8 20h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 4 18.88 4 17.2 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v6.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 20 5.12 20 6.8 20Z"}));Xe.displayName="Mail01";const ve=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),w.createElement("path",{d:"M18.727 14.727a1.5 1.5 0 0 0 .3 1.655l.055.054a1.816 1.816 0 0 1 0 2.573 1.818 1.818 0 0 1-2.573 0l-.055-.055a1.5 1.5 0 0 0-1.654-.3 1.5 1.5 0 0 0-.91 1.373v.155a1.818 1.818 0 1 1-3.636 0V20.1a1.5 1.5 0 0 0-.981-1.373 1.5 1.5 0 0 0-1.655.3l-.054.055a1.818 1.818 0 0 1-3.106-1.287 1.818 1.818 0 0 1 .533-1.286l.054-.055a1.5 1.5 0 0 0 .3-1.654 1.5 1.5 0 0 0-1.372-.91h-.155a1.818 1.818 0 1 1 0-3.636H3.9a1.5 1.5 0 0 0 1.373-.981 1.5 1.5 0 0 0-.3-1.655l-.055-.054A1.818 1.818 0 1 1 7.491 4.99l.054.054a1.5 1.5 0 0 0 1.655.3h.073a1.5 1.5 0 0 0 .909-1.372v-.155a1.818 1.818 0 0 1 3.636 0V3.9a1.499 1.499 0 0 0 .91 1.373 1.5 1.5 0 0 0 1.654-.3l.054-.055a1.817 1.817 0 0 1 2.573 0 1.819 1.819 0 0 1 0 2.573l-.055.054a1.5 1.5 0 0 0-.3 1.655v.073a1.5 1.5 0 0 0 1.373.909h.155a1.818 1.818 0 0 1 0 3.636H20.1a1.499 1.499 0 0 0-1.373.91Z"}));ve.displayName="Settings01";const Qe=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M4 21.817C4.603 22 5.416 22 6.8 22h10.4c1.384 0 2.197 0 2.8-.183m-16 0a2.18 2.18 0 0 1-.362-.144 3 3 0 0 1-1.311-1.311C2 19.72 2 18.88 2 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h10.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 4.28 22 5.12 22 6.8v10.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311 2.18 2.18 0 0 1-.362.144m-16 0c0-.809.005-1.237.077-1.597a4 4 0 0 1 3.143-3.143C7.606 17 8.07 17 9 17h6c.93 0 1.394 0 1.78.077a4 4 0 0 1 3.143 3.143c.072.36.077.788.077 1.597M16 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}));Qe.displayName="UserSquare";const et=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M13 2 4.093 12.688c-.348.418-.523.628-.525.804a.5.5 0 0 0 .185.397c.138.111.41.111.955.111H12l-1 8 8.907-10.688c.348-.418.523-.628.525-.804a.5.5 0 0 0-.185-.397c-.138-.111-.41-.111-.955-.111H12l1-8Z"}));et.displayName="Zap";function is({invitation:t,onStatusChange:e}){const[s,n]=w.useState(!1),[i,r]=w.useState(!1),l=me(),o=async()=>{n(!0);try{const b=await J.organization.acceptInvitation({invitationId:t.id});if(b.error)Y.error(b.error.message),n(!1);else{e(t.id,"accepted");const j=await J.organization.setActive({organizationId:t.organizationId});j?.data?.slug?(Y.success("Invitation accepted!"),l({to:"/$org",params:{org:j.data.slug}})):(Y.success("Invitation accepted! Redirecting..."),l({to:"/"}))}}catch{Y.error("Failed to accept invitation"),n(!1)}},c=async()=>{r(!0);try{const b=await J.organization.rejectInvitation({invitationId:t.id});b.error?(Y.error(b.error.message),r(!1)):(Y.success("Invitation rejected"),e(t.id,"rejected"),r(!1))}catch{Y.error("Failed to reject invitation"),r(!1)}},d=t.organizationName||t.organizationId,m=t.status==="pending",u=t.status==="accepted",p=t.status==="rejected";return a.jsxs("div",{className:$("flex items-center gap-3 px-3 py-2 h-12 border-b border-border/50 last:border-b-0",!m&&"opacity-50"),children:[a.jsx("div",{className:"shrink-0 size-5 flex items-center justify-center",children:a.jsx(Xe,{size:16,className:"text-muted-foreground"})}),a.jsxs("p",{className:"flex-1 text-sm text-foreground min-w-0 whitespace-nowrap overflow-hidden",children:["You have been invited to ",a.jsx("span",{className:"font-semibold inline-block max-w-[200px] truncate align-bottom",children:d})]}),a.jsx("div",{className:"flex items-center gap-1 shrink-0",children:m?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"ghost",size:"icon",onClick:c,disabled:s||i,className:"h-8 w-8",children:a.jsx(_e,{size:14})}),a.jsx(Z,{variant:"outline",size:"icon",onClick:o,disabled:s||i,className:"h-8 w-8",children:a.jsx(ce,{size:14})})]}):u?a.jsxs(ye,{variant:"outline",className:"h-6 px-2 text-xs",children:[a.jsx(ce,{size:12}),"Accepted"]}):p?a.jsxs(ye,{variant:"outline",className:"h-6 px-2 text-xs",children:[a.jsx(_e,{size:12}),"Declined"]}):null})]})}function rs(){const[t,e]=w.useState(!1),s=w.useContext(dt),{data:n}=s.hooks.useListUserInvitations(),{data:i}=J.useListOrganizations(),[r,l]=w.useState({}),m=(n??[]).filter(f=>new Date(f.expiresAt)>new Date).map(f=>{const g=(i??[]).find(x=>x.id===f.organizationId);return{...f,organizationSlug:g?.slug||f.organizationSlug,organizationName:g?.name||f.organizationName}}).map(f=>({...f,status:r[f.id]||f.status})),u=[...m].sort((f,g)=>{const x={pending:0,accepted:1,rejected:2};return(x[f.status]??999)-(x[g.status]??999)}),b=m.filter(f=>f.status==="pending").length>0,j=(f,g)=>{l(x=>({...x,[f]:g}))};return a.jsxs(Ee,{open:t,onOpenChange:e,children:[a.jsx(Re,{asChild:!0,children:a.jsxs(Z,{variant:"ghost",size:"sm",className:"relative h-7 w-7 p-0","aria-label":"Inbox",children:[a.jsx(Ce,{size:18,className:"text-muted-foreground"}),b&&a.jsx("span",{className:"absolute bottom-1 right-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-background"})]})}),a.jsxs(De,{align:"end",className:"w-[480px] p-0 overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-border",children:a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Inbox"})}),a.jsx("div",{className:"max-h-96 overflow-auto",children:u.length>0?u.map(f=>a.jsx(is,{invitation:f,onStatusChange:j},f.id)):a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Ce,{size:32,className:"text-muted-foreground/40 mb-2"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No invitations at the moment"})]})})]})]})}const ls="sidebar_state",os=3600*24*7,cs="16rem",ds="18rem",ms="3rem",fs="b",tt=w.createContext(null);function we(){const t=w.useContext(tt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function us(t){const e=h.c(21),{defaultOpen:s,open:n,onOpenChange:i,children:r}=t,l=s===void 0?!0:s,o=ie(),[c,d]=w.useState(!1),[m,u]=w.useState(l),p=n??m;let b;e[0]!==p||e[1]!==i?(b=z=>{const C=typeof z=="function"?z(p):z;i?i(C):u(C),document.cookie=`${ls}=${C}; path=/; max-age=${os}`},e[0]=p,e[1]=i,e[2]=b):b=e[2];const j=b;let f;e[3]!==o||e[4]!==j?(f=()=>o?d(hs):j(ps),e[3]=o,e[4]=j,e[5]=f):f=e[5];const g=f;let x,v;e[6]!==g?(x=()=>{const z=C=>{if(C.key===fs&&(C.metaKey||C.ctrlKey)){const I=C.target;if(I.tagName==="INPUT"||I.tagName==="TEXTAREA"||I.isContentEditable)return;C.preventDefault(),g()}};return globalThis.addEventListener("keydown",z),()=>globalThis.removeEventListener("keydown",z)},v=[g],e[6]=g,e[7]=x,e[8]=v):(x=e[7],v=e[8]),w.useEffect(x,v);const S=p?"expanded":"collapsed";let _;e[9]!==o||e[10]!==p||e[11]!==c||e[12]!==j||e[13]!==S||e[14]!==g?(_={state:S,open:p,setOpen:j,isMobile:o,openMobile:c,setOpenMobile:d,toggleSidebar:g},e[9]=o,e[10]=p,e[11]=c,e[12]=j,e[13]=S,e[14]=g,e[15]=_):_=e[15];const N=_;let k;e[16]!==r?(k=a.jsx(He,{delayDuration:0,children:r}),e[16]=r,e[17]=k):k=e[17];let y;return e[18]!==N||e[19]!==k?(y=a.jsx(tt.Provider,{value:N,children:k}),e[18]=N,e[19]=k,e[20]=y):y=e[20],y}function ps(t){return!t}function hs(t){return!t}function xs(t){const e=h.c(14);let s,n,i,r;e[0]!==t?({className:n,style:r,children:s,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r):(s=e[1],n=e[2],i=e[3],r=e[4]);let l;e[5]!==r?(l={"--sidebar-width":cs,"--sidebar-width-icon":ms,...r},e[5]=r,e[6]=l):l=e[6];const o=l;let c;e[7]!==n?(c=$("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",n),e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==s||e[10]!==i||e[11]!==o||e[12]!==c?(d=a.jsx("div",{"data-slot":"sidebar-wrapper",style:o,className:c,...i,children:s}),e[9]=s,e[10]=i,e[11]=o,e[12]=c,e[13]=d):d=e[13],d}function gs(t){const e=h.c(46);let s,n,i,r,l,o;e[0]!==t?({side:r,variant:l,collapsible:o,className:n,children:s,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=l,e[6]=o):(s=e[1],n=e[2],i=e[3],r=e[4],l=e[5],o=e[6]);const c=r===void 0?"left":r,d=l===void 0?"sidebar":l,m=o===void 0?"offcanvas":o,{isMobile:u,state:p,openMobile:b,setOpenMobile:j}=we();if(m==="none"){let C;e[7]!==n?(C=$("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),e[7]=n,e[8]=C):C=e[8];let I;return e[9]!==s||e[10]!==i||e[11]!==C?(I=a.jsx("div",{"data-slot":"sidebar",className:C,...i,children:s}),e[9]=s,e[10]=i,e[11]=C,e[12]=I):I=e[12],I}if(u){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C={"--sidebar-width":ds},e[13]=C):C=e[13];let I;e[14]===Symbol.for("react.memo_cache_sentinel")?(I=a.jsxs(_t,{className:"sr-only",children:[a.jsx(kt,{children:"Sidebar"}),a.jsx(It,{children:"Displays the mobile sidebar."})]}),e[14]=I):I=e[14];let T;e[15]!==s?(T=a.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=T):T=e[16];let O;e[17]!==c||e[18]!==T?(O=a.jsxs(zt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:C,side:c,children:[I,T]}),e[17]=c,e[18]=T,e[19]=O):O=e[19];let M;return e[20]!==b||e[21]!==i||e[22]!==j||e[23]!==O?(M=a.jsx(Ct,{open:b,onOpenChange:j,...i,children:O}),e[20]=b,e[21]=i,e[22]=j,e[23]=O,e[24]=M):M=e[24],M}const f=p==="collapsed"?m:"",g=d==="floating"||d==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let x;e[25]!==g?(x=$("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",g),e[25]=g,e[26]=x):x=e[26];let v;e[27]!==x?(v=a.jsx("div",{"data-slot":"sidebar-gap",className:x}),e[27]=x,e[28]=v):v=e[28];const S=c==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",_=d==="floating"||d==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let N;e[29]!==n||e[30]!==S||e[31]!==_?(N=$("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",S,_,n),e[29]=n,e[30]=S,e[31]=_,e[32]=N):N=e[32];let k;e[33]!==s?(k=a.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border py-2 flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s}),e[33]=s,e[34]=k):k=e[34];let y;e[35]!==i||e[36]!==N||e[37]!==k?(y=a.jsx("div",{"data-slot":"sidebar-container",className:N,...i,children:k}),e[35]=i,e[36]=N,e[37]=k,e[38]=y):y=e[38];let z;return e[39]!==c||e[40]!==p||e[41]!==y||e[42]!==f||e[43]!==v||e[44]!==d?(z=a.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":p,"data-collapsible":f,"data-variant":d,"data-side":c,"data-slot":"sidebar",children:[v,y]}),e[39]=c,e[40]=p,e[41]=y,e[42]=f,e[43]=v,e[44]=d,e[45]=z):z=e[45],z}function bs(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("main",{"data-slot":"sidebar-inset",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function js(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("h-4 m-0! w-full",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("div",{"data-sidebar":"separator",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function vs(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function ws(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Ss(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("w-full text-sm",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Ns(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function ue(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("group/menu-item relative",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}const ys=ft("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,colors] transition-colors duration-150 ease-out hover:transition-none focus-visible:ring-2 active:bg-sidebar-accent/75 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent/75 [&>span:last-child]:truncate [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-muted-foreground",{variants:{variant:{default:"hover:bg-sidebar-accent text-sidebar-foreground/80 active:text-sidebar-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-7 text-sm font-[450]",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function st(t){const e=h.c(28);let s,n,i,r,l,o,c;e[0]!==t?({asChild:i,isActive:r,variant:l,size:o,tooltip:c,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=l,e[6]=o,e[7]=c):(s=e[1],n=e[2],i=e[3],r=e[4],l=e[5],o=e[6],c=e[7]);const d=i===void 0?!1:i,m=r===void 0?!1:r,u=l===void 0?"default":l,p=o===void 0?"default":o,b=d?mt:"button",{isMobile:j,state:f}=we();let g;e[8]!==s||e[9]!==p||e[10]!==u?(g=$(ys({variant:u,size:p}),s),e[8]=s,e[9]=p,e[10]=u,e[11]=g):g=e[11];let x;e[12]!==b||e[13]!==m||e[14]!==n||e[15]!==p||e[16]!==g?(x=a.jsx(b,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":p,"data-active":m,className:g,...n}),e[12]=b,e[13]=m,e[14]=n,e[15]=p,e[16]=g,e[17]=x):x=e[17];const v=x;if(!c)return v;if(typeof c=="string"){let y;e[18]!==c?(y={children:c},e[18]=c,e[19]=y):y=e[19],c=y}let S;e[20]!==v?(S=a.jsx(Ue,{asChild:!0,children:v}),e[20]=v,e[21]=S):S=e[21];const _=f!=="collapsed"||j;let N;e[22]!==_||e[23]!==c?(N=a.jsx(Le,{side:"right",align:"center",hidden:_,...c}),e[22]=_,e[23]=c,e[24]=N):N=e[24];let k;return e[25]!==S||e[26]!==N?(k=a.jsxs(Be,{children:[S,N]}),e[25]=S,e[26]=N,e[27]=k):k=e[27],k}function Cs(t){const e=h.c(26),{item:s}=t,n=me(),{org:i}=fe(),r=ge(i.id),l=Dt(i.id);let o;e[0]!==l.update||e[1]!==s.url||e[2]!==r?.sidebar_items?(o=async()=>{const _=(r?.sidebar_items||[]).filter(N=>N.url!==s.url);await l.update.mutateAsync({sidebar_items:_})},e[0]=l.update,e[1]=s.url,e[2]=r?.sidebar_items,e[3]=o):o=e[3];const c=o;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=/^https?:\/\/.+/,e[4]=d):d=e[4];let m;e[5]!==s.icon?(m=d.test(s.icon),e[5]=s.icon,e[6]=m):m=e[6];const u=m;let p;e[7]!==s.url||e[8]!==n?(p=()=>{n({to:s.url})},e[7]=s.url,e[8]=n,e[9]=p):p=e[9];const b=s.title;let j;e[10]!==u||e[11]!==s.icon||e[12]!==s.title?(j=a.jsx("div",{className:"flex items-center justify-center shrink-0",children:u?a.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):a.jsx(yt,{size:16,className:"text-muted-foreground group-hover/item:text-foreground transition-colors"})}),e[10]=u,e[11]=s.icon,e[12]=s.title,e[13]=j):j=e[13];let f;e[14]!==s.title?(f=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=f):f=e[15];let g;e[16]!==f?(g=a.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:a.jsx("span",{className:"truncate text-sm w-full capitalize",children:f})}),e[16]=f,e[17]=g):g=e[17];let x;e[18]!==c?(x=a.jsx(de,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:S=>{S.preventDefault(),S.stopPropagation(),c()}}),e[18]=c,e[19]=x):x=e[19];let v;return e[20]!==s.title||e[21]!==p||e[22]!==j||e[23]!==g||e[24]!==x?(v=a.jsx(ue,{children:a.jsxs(st,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:p,tooltip:b,children:[j,g,x]})}),e[20]=s.title,e[21]=p,e[22]=j,e[23]=g,e[24]=x,e[25]=v):v=e[25],v}function _s(){const t=h.c(4),{org:e}=fe(),n=ge(e.id)?.sidebar_items;if(!n?.length)return null;let i;t[0]!==n?(i=n.map(ks),t[0]=n,t[1]=i):i=t[1];let r;return t[2]!==i?(r=a.jsx(nt,{children:i}),t[2]=i,t[3]=r):r=t[3],r}function ks(t){return a.jsx(Cs,{item:t},t.url)}function ze(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(ue,{children:a.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:a.jsx(We,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function nt(t){const e=h.c(4),{children:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(js,{className:"my-2 -ml-1"}),e[0]=n):n=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(ue,{children:a.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-0 text-xs font-medium h-6 text-muted-foreground flex items-center justify-between",children:a.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=i):i=e[1];let r;return e[2]!==s?(r=a.jsxs(a.Fragment,{children:[n,i,s]}),e[2]=s,e[3]=r):r=e[3],r}function Is(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(w.Suspense,{fallback:a.jsxs(nt,{children:[a.jsx(ze,{}),a.jsx(ze,{})]}),children:a.jsx(_s,{})}),t[0]=e):e=t[0],e}function zs(){const t=h.c(14),{locator:e,org:s}=fe(),n=me(),i=xe(),{org:r}=Ne.parse(e);let l;t[0]!==e?(l=Ne.isOrgAdminProject(e),t[0]=e,t[1]=l):l=t[1];const o=l,c=ge(s.id);let d;t[2]!==c?.enabled_plugins?(d=c?.enabled_plugins??[],t[2]=c?.enabled_plugins,t[3]=d):d=t[3];const m=d;let u;t[4]!==m?(u=y=>m.includes(y.pluginId),t[4]=m,t[5]=u):u=t[5];const p=ut.filter(u),b=i.location.pathname===`/${r}`||i.location.pathname===`/${r}/`;let j;t[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(Lt,{}),t[6]=j):j=t[6];let f;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(Ze,{}),t[7]=f):f=t[7];let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(Pt,{}),t[8]=g):g=t[8];let x;t[9]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(Ve,{}),t[9]=x):x=t[9];let v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(et,{}),t[10]=v):v=t[10];let S;t[11]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsx(Ge,{}),t[11]=S):S=t[11];let _;t[12]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(Qe,{}),t[12]=_):_=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(ve,{}),t[13]=N):N=t[13];const k=[{key:"home",label:"Home",icon:j,onClick:()=>{b?window.dispatchEvent(new CustomEvent("reset-home-view")):n({to:"/$org",params:{org:r}})}},{key:"store",label:"Store",icon:f,onClick:()=>n({to:"/$org/store",params:{org:r}})},...p.map(y=>({key:y.pluginId,label:y.label,icon:y.icon,onClick:()=>n({to:"/$org/$pluginId",params:{org:r,pluginId:y.pluginId}})})),{key:"mcps",label:"Connections",icon:g,onClick:()=>n({to:"/$org/mcps",params:{org:r}})},{key:"agents",label:"Agents",icon:x,onClick:()=>n({to:"/$org/agents",params:{org:r}})},{key:"workflow",label:"Workflows",icon:v,onClick:()=>n({to:"/$org/workflows",params:{org:r}})},{key:"monitoring",label:"Monitoring",icon:S,onClick:()=>n({to:"/$org/monitoring",params:{org:r}})},{key:"members",label:"Members",icon:_,onClick:()=>n({to:"/$org/members",params:{org:r}})},{key:"settings",label:"Settings",icon:N,onClick:()=>n({to:"/$org/settings",params:{org:r}})}];return o?k:[]}function at(t){const e=h.c(10),{navigationItems:s,footer:n,additionalContent:i,variant:r,collapsible:l}=t,o=r===void 0?"sidebar":r,c=l===void 0?"icon":l;let d;e[0]!==s?(d=s.map($s),e[0]=s,e[1]=d):d=e[1];let m;e[2]!==i||e[3]!==d?(m=a.jsx(vs,{className:"flex-1 overflow-x-hidden",children:a.jsx(ws,{className:"font-medium",children:a.jsx(Ss,{children:a.jsxs(Ns,{className:"gap-0.5",children:[d,i]})})})}),e[2]=i,e[3]=d,e[4]=m):m=e[4];let u;return e[5]!==c||e[6]!==n||e[7]!==m||e[8]!==o?(u=a.jsxs(gs,{variant:o,collapsible:c,children:[m,n]}),e[5]=c,e[6]=n,e[7]=m,e[8]=o,e[9]=u):u=e[9],u}function $s(t){return a.jsx(ue,{children:a.jsxs(st,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[a.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),a.jsx("span",{className:"truncate",children:t.label})]})},t.key)}at.Skeleton=function(){return a.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>a.jsx("div",{className:"w-full h-8",children:a.jsx(We,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function Os(){const t=h.c(3),e=zs();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(Pe,{children:a.jsx(w.Suspense,{fallback:null,children:a.jsx(Is,{})})}),t[0]=s):s=t[0];let n;return t[1]!==e?(n=a.jsx(at,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=n):n=t[2],n}function Ts(t){const e=h.c(12);let s,n,i,r;e[0]!==t?({className:s,orientation:i,decorative:r,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r):(s=e[1],n=e[2],i=e[3],r=e[4]);const l=i===void 0?"horizontal":i,o=r===void 0?!0:r;let c;e[5]!==s?(c=$("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==l||e[9]!==n||e[10]!==c?(d=a.jsx(pt,{"data-slot":"separator-root",decorative:o,orientation:l,className:c,...n}),e[7]=o,e[8]=l,e[9]=n,e[10]=c,e[11]=d):d=e[11],d}const it=w.createContext(null);function Ms(){const t=w.useContext(it);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function As(t){const e=h.c(10),{children:s,onItemHover:n}=t,[i,r]=w.useState(null);let l;e[0]!==n?(l=u=>{r(u),n?.(u)},e[0]=n,e[1]=l):l=e[1];const o=l;let c;e[2]!==i||e[3]!==o?(c={hoveredItem:i,setHoveredItem:o},e[2]=i,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==s?(d=a.jsx(Ee,{children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==c||e[8]!==d?(m=a.jsx(it.Provider,{value:c,children:d}),e[7]=c,e[8]=d,e[9]=m):m=e[9],m}function Es(t){const e=h.c(6),{children:s,onClick:n}=t;let i;e[0]!==s||e[1]!==n?(i=a.jsx(Z,{variant:"link",className:"p-0.5 h-auto",onClick:n,type:"button",children:s}),e[0]=s,e[1]=n,e[2]=i):i=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(Re,{asChild:!0,children:a.jsx(Z,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:a.jsx(At,{size:16,className:"opacity-50"})})}),e[3]=r):r=e[3];let l;return e[4]!==i?(l=a.jsxs("div",{className:"flex items-center gap-1",children:[i,r]}),e[4]=i,e[5]=l):l=e[5],l}function Rs(t){const e=h.c(8),{item:s,fallback:n}=t,i=n===void 0?"":n,r=s?.avatarUrl??"",l=s?.name??i;let o;e[0]!==r||e[1]!==l?(o=a.jsx(ne,{url:r,fallback:l,size:"xs",objectFit:"contain"}),e[0]=r,e[1]=l,e[2]=o):o=e[2];const c=s?.name??i;let d;e[3]!==c?(d=a.jsx("span",{children:c}),e[3]=c,e[4]=d):d=e[4];let m;return e[5]!==o||e[6]!==d?(m=a.jsxs("div",{className:"flex items-center gap-2",children:[o,d]}),e[5]=o,e[6]=d,e[7]=m):m=e[7],m}function Ds(t){const e=h.c(6),{children:s,align:n}=t,i=n===void 0?"start":n,l=w.Children.toArray(s).filter(Ps).length===1?"280px":"480px";let o;e[0]!==l?(o={width:l},e[0]=l,e[1]=o):o=e[1];let c;return e[2]!==i||e[3]!==s||e[4]!==o?(c=a.jsx(De,{align:i,className:"p-0 flex items-start",style:o,children:s}),e[2]=i,e[3]=s,e[4]=o,e[5]=c):c=e[5],c}function Ps(t){return w.isValidElement(t)&&(t.type===lt||t.type===rt)}function rt(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}const lt=rt;function Ls(t){const e=h.c(6),{placeholder:s,value:n,onChange:i}=t,r=s===void 0?"Search...":s;let l;e[0]!==i?(l=c=>i(c.target.value),e[0]=i,e[1]=l):l=e[1];let o;return e[2]!==r||e[3]!==l||e[4]!==n?(o=a.jsx(Ut,{placeholder:r,value:n,onChange:l,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=r,e[3]=l,e[4]=n,e[5]=o):o=e[5],o}function Hs(t){const e=h.c(6),{children:s,emptyMessage:n}=t,i=n===void 0?"No items found.":n,r=w.Children.count(s)>0;let l;e[0]!==i||e[1]!==r?(l=!r&&a.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:i}),e[0]=i,e[1]=r,e[2]=l):l=e[2];let o;return e[3]!==s||e[4]!==l?(o=a.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[l,s]}),e[3]=s,e[4]=l,e[5]=o):o=e[5],o}function Us(t){const e=h.c(15),{item:s,onClick:n,onHover:i,children:r}=t,l=Ms();let o;e[0]!==l||e[1]!==s||e[2]!==i?(o=()=>{l.setHoveredItem(s.slug),i?.(s)},e[0]=l,e[1]=s,e[2]=i,e[3]=o):o=e[3];const c=o;let d;e[4]!==s||e[5]!==n?(d=()=>n(s),e[4]=s,e[5]=n,e[6]=d):d=e[6];let m;e[7]!==r||e[8]!==s.avatarUrl||e[9]!==s.name?(m=r||a.jsxs(a.Fragment,{children:[a.jsx(ne,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),a.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=r,e[8]=s.avatarUrl,e[9]=s.name,e[10]=m):m=e[10];let u;return e[11]!==c||e[12]!==d||e[13]!==m?(u=a.jsx(Z,{onClick:d,onMouseEnter:c,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:m}),e[11]=c,e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function Bs(t){const e=h.c(2),{children:s}=t;let n;return e[0]!==s?(n=a.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ws(t){const e=h.c(11),{onClick:s,icon:n,children:i,variant:r}=t,o=(r===void 0?"default":r)==="muted"&&"text-muted-foreground";let c;e[0]!==o?(c=$("w-full justify-start font-normal",o),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==n?(d=n&&a.jsx("span",{className:"[&>svg]:size-4",children:n}),e[2]=n,e[3]=d):d=e[3];let m;e[4]!==i?(m=a.jsx("span",{children:i}),e[4]=i,e[5]=m):m=e[5];let u;return e[6]!==s||e[7]!==c||e[8]!==d||e[9]!==m?(u=a.jsxs(Z,{variant:"ghost",size:"sm",className:c,onClick:s,children:[d,m]}),e[6]=s,e[7]=c,e[8]=d,e[9]=m,e[10]=u):u=e[10],u}function Vs(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(Ts,{}),t[0]=e):e=t[0],e}function Fs(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const H=Object.assign(As,{Trigger:Es,CurrentItem:Rs,Content:Ds,Panel:lt,Search:Ls,Items:Hs,Item:Us,Actions:Bs,Action:Ws,Separator:Vs,Skeleton:Fs});function he(){const t=h.c(59);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=Oe(e),{data:n}=J.useListOrganizations(),i=me();let r;t[1]!==s||t[2]!==n?(r=n?.find(A=>A.slug===s),t[1]=s,t[2]=n,t[3]=r):r=t[3];const l=r,[o,c]=w.useState(""),[d,m]=w.useState(!1);let u,p,b,j,f,g,x,v;if(t[4]!==l||t[5]!==i||t[6]!==s||t[7]!==o||t[8]!==n){const E=(n?(()=>{const P=n.filter(L=>L.name.toLowerCase().includes(o.toLowerCase()));if(s){const L=P.findIndex(K=>K.slug===s);if(L>0){const K=P[L];K&&(P.splice(L,1),P.unshift(K))}}return P})():[]).map(Ks);let D;t[17]!==l?(D=l?{slug:l.slug,name:l.name,avatarUrl:l.logo}:void 0,t[17]=l,t[18]=D):D=t[18];const W=D;j=H;let V;t[19]!==i||t[20]!==s?(V=()=>i({to:"/$org",params:{org:s??""}}),t[19]=i,t[20]=s,t[21]=V):V=t[21];let U;t[22]!==W?(U=a.jsx(H.CurrentItem,{item:W}),t[22]=W,t[23]=U):U=t[23],t[24]!==V||t[25]!==U?(v=a.jsx(H.Trigger,{onClick:V,children:U}),t[24]=V,t[25]=U,t[26]=v):v=t[26],b=H.Content,p=H.Panel,t[27]!==o?(x=a.jsx(H.Search,{placeholder:"Search organizations...",value:o,onChange:c}),t[27]=o,t[28]=x):x=t[28],u=H.Items,f="No organizations found.";let F;t[29]!==i?(F=P=>a.jsx(H.Item,{item:P,onClick:L=>i({to:"/$org",params:{org:L.slug}})},P.slug),t[29]=i,t[30]=F):F=t[30],g=E.map(F),t[4]=l,t[5]=i,t[6]=s,t[7]=o,t[8]=n,t[9]=u,t[10]=p,t[11]=b,t[12]=j,t[13]=f,t[14]=g,t[15]=x,t[16]=v}else u=t[9],p=t[10],b=t[11],j=t[12],f=t[13],g=t[14],x=t[15],v=t[16];let S;t[31]!==u||t[32]!==f||t[33]!==g?(S=a.jsx(u,{emptyMessage:f,children:g}),t[31]=u,t[32]=f,t[33]=g,t[34]=S):S=t[34];let _,N;t[35]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(H.Actions,{children:a.jsx(H.Action,{onClick:()=>m(!0),variant:"muted",children:"+ Create organization"})}),N=a.jsx(H.Separator,{}),t[35]=_,t[36]=N):(_=t[35],N=t[36]);let k;t[37]!==i?(k=()=>i({to:"/"}),t[37]=i,t[38]=k):k=t[38];let y;t[39]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsx(Bt,{}),t[39]=y):y=t[39];let z;t[40]!==k?(z=a.jsx(H.Actions,{children:a.jsx(H.Action,{onClick:k,icon:y,children:"See all organizations"})}),t[40]=k,t[41]=z):z=t[41];let C;t[42]!==p||t[43]!==z||t[44]!==x||t[45]!==S?(C=a.jsxs(p,{children:[x,S,_,N,z]}),t[42]=p,t[43]=z,t[44]=x,t[45]=S,t[46]=C):C=t[46];let I;t[47]!==b||t[48]!==C?(I=a.jsx(b,{children:C}),t[47]=b,t[48]=C,t[49]=I):I=t[49];let T;t[50]!==j||t[51]!==I||t[52]!==v?(T=a.jsxs(j,{children:[v,I]}),t[50]=j,t[51]=I,t[52]=v,t[53]=T):T=t[53];let O;t[54]!==d?(O=a.jsx(Ht,{open:d,onOpenChange:m}),t[54]=d,t[55]=O):O=t[55];let M;return t[56]!==T||t[57]!==O?(M=a.jsxs(a.Fragment,{children:[T,O]}),t[56]=T,t[57]=O,t[58]=M):M=t[58],M}function Ks(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}he.Skeleton=H.Skeleton;function Gs({prop:t,defaultProp:e,onChange:s=()=>{}}){const[n,i]=Zs({defaultProp:e,onChange:s}),r=t!==void 0,l=r?t:n,o=Te(s),c=w.useCallback(d=>{if(r){const u=typeof d=="function"?d(t):d;u!==t&&o(u)}else i(d)},[r,t,i,o]);return[l,c]}function Zs({defaultProp:t,onChange:e}){const s=w.useState(t),[n]=s,i=w.useRef(n),r=Te(e);return w.useEffect(()=>{i.current!==n&&(r(n),i.current=n)},[n,i,r]),s}function qs(t){const e=h.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n=a.jsx(ae.Root,{"data-slot":"drawer",...s}),e[2]=s,e[3]=n):n=e[3],n}function Ys(t){const e=h.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n=a.jsx(ae.Trigger,{"data-slot":"drawer-trigger",...s}),e[2]=s,e[3]=n):n=e[3],n}function Js(t){const e=h.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n=a.jsx(ae.Portal,{"data-slot":"drawer-portal",...s}),e[2]=s,e[3]=n):n=e[3],n}function Xs(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx(ae.Overlay,{"data-slot":"drawer-overlay",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Qs(t){const e=h.c(12);let s,n,i;e[0]!==t?({className:n,children:s,...i}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(Xs,{}),e[4]=r):r=e[4];let l;e[5]!==n?(l=$("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",n),e[5]=n,e[6]=l):l=e[6];let o;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=o):o=e[7];let c;return e[8]!==s||e[9]!==i||e[10]!==l?(c=a.jsxs(Js,{"data-slot":"drawer-portal",children:[r,a.jsxs(ae.Content,{"data-slot":"drawer-content",className:l,...i,children:[o,s]})]}),e[8]=s,e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function en(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("flex flex-col gap-1.5 px-4 py-2",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx("div",{"data-slot":"drawer-header",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function tn(t){const e=h.c(8);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);let i;e[3]!==s?(i=$("text-foreground font-semibold",s),e[3]=s,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=a.jsx(ae.Title,{"data-slot":"drawer-title",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}const ot=w.createContext({setOpen:()=>{}}),sn=()=>w.useContext(ot),nn=t=>{const e=h.c(25);let s,n,i,r,l;e[0]!==t?({children:s,defaultOpen:n,open:r,onOpenChange:i,...l}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i,e[4]=r,e[5]=l):(s=e[1],n=e[2],i=e[3],r=e[4],l=e[5]);const o=n??!1;let c;e[6]!==i||e[7]!==r||e[8]!==o?(c={prop:r,defaultProp:o,onChange:i},e[6]=i,e[7]=r,e[8]=o,e[9]=c):c=e[9];const[d,m]=Gs(c);let u;e[10]!==m?(u={setOpen:m},e[10]=m,e[11]=u):u=e[11];let p;e[12]!==s||e[13]!==d||e[14]!==l||e[15]!==m?(p=a.jsx(qs,{open:d,onOpenChange:m,...l,children:s}),e[12]=s,e[13]=d,e[14]=l,e[15]=m,e[16]=p):p=e[16];let b;e[17]!==d||e[18]!==l||e[19]!==m||e[20]!==p?(b=a.jsx(Ft,{open:d,onOpenChange:m,...l,children:p}),e[17]=d,e[18]=l,e[19]=m,e[20]=p,e[21]=b):b=e[21];let j;return e[22]!==u||e[23]!==b?(j=a.jsx(ot.Provider,{value:u,children:b}),e[22]=u,e[23]=b,e[24]=j):j=e[24],j},an=t=>{const{children:e,title:s,...n}=t,i=ie(),{className:r,...l}=n;return i?a.jsxs(Qs,{...l,children:[a.jsx(en,{className:"hidden",children:a.jsx(tn,{children:s})}),a.jsx("div",{className:$("flex flex-col gap-2 p-2 py-4",r),children:e})]}):a.jsx(Vt,{...n,children:e})},rn=t=>{const{children:e,...s}=t,{setOpen:n}=sn(),i=ie(),{className:r,...l}=s;return i?a.jsx("div",{...l,onClick:o=>{n(!1);const{onClick:c}=l;c?.(o)},className:$("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),children:e}):a.jsx(Kt,{...s,children:e})},ln=t=>{const e=h.c(7);let s,n;e[0]!==t?({children:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);const i=ie();let r;return e[3]!==s||e[4]!==i||e[5]!==n?(r=i?a.jsx(Ys,{asChild:!0,children:s}):a.jsx(Wt,{...n,children:s}),e[3]=s,e[4]=i,e[5]=n,e[6]=r):r=e[6],r},on=t=>{const e=h.c(7);let s,n;e[0]!==t?({className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n):(s=e[1],n=e[2]);const i=ie();let r;return e[3]!==s||e[4]!==i||e[5]!==n?(r=i?a.jsx(ke,{className:$(s),...n}):a.jsx(ke,{className:$(s),...n}),e[3]=s,e[4]=i,e[5]=n,e[6]=r):r=e[6],r};function cn(t){const e=h.c(11),{user:s,trigger:n,align:i,children:r}=t,l=i===void 0?"start":i;let o;e[0]!==n||e[1]!==s?(o=n(s),e[0]=n,e[1]=s,e[2]=o):o=e[2];let c;e[3]!==o?(c=a.jsx(ln,{asChild:!0,children:a.jsx("div",{children:o})}),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==r?(d=a.jsx(an,{side:"top",align:l,className:"md:w-[240px]",children:r}),e[5]=l,e[6]=r,e[7]=d):d=e[7];let m;return e[8]!==c||e[9]!==d?(m=a.jsxs(nn,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=m):m=e[10],m}function dn(t){const e=h.c(8),{children:s,onClick:n,className:i,asChild:r}=t;let l;e[0]!==r||e[1]!==s||e[2]!==n?(l=r?s:a.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:n,children:s}),e[0]=r,e[1]=s,e[2]=n,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==i||e[6]!==l?(o=a.jsx(rn,{asChild:r,className:i,children:l}),e[4]=r,e[5]=i,e[6]=l,e[7]=o):o=e[7],o}function mn(t){const e=h.c(2),{className:s}=t;let n;return e[0]!==s?(n=a.jsx(on,{className:s}),e[0]=s,e[1]=n):n=e[1],n}function fn(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const G=Object.assign(cn,{Item:dn,Separator:mn,Skeleton:fn});function un(t){const e=h.c(48),{open:s,onOpenChange:n,user:i,userImage:r}=t,[l,o]=Et(),[c,d]=w.useState(!1);let m;e[0]!==i.id?(m=()=>{navigator.clipboard.writeText(i.id),d(!0),setTimeout(()=>d(!1),2e3)},e[0]=i.id,e[1]=m):m=e[1];const u=m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(Gt,{className:"text-base",children:"Profile Settings"}),e[2]=p):p=e[2];let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsxs(Zt,{className:"px-6 pt-6 pb-4 border-b border-border shrink-0 relative",children:[p,a.jsxs(qt,{className:"absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[a.jsx(de,{size:16}),a.jsx("span",{className:"sr-only",children:"Close"})]})]}),e[3]=b):b=e[3];const j=i.name||"U";let f;e[4]!==j||e[5]!==r?(f=a.jsx(ne,{url:r,fallback:j,shape:"circle",size:"xl",className:"h-16 w-16"}),e[4]=j,e[5]=r,e[6]=f):f=e[6];const g=i.name||"User";let x;e[7]!==g?(x=a.jsx("span",{className:"text-base font-medium text-foreground",children:g}),e[7]=g,e[8]=x):x=e[8];let v;e[9]!==i.email?(v=a.jsx("span",{className:"text-sm text-muted-foreground",children:i.email}),e[9]=i.email,e[10]=v):v=e[10];let S;e[11]!==x||e[12]!==v?(S=a.jsxs("div",{className:"flex flex-col gap-1",children:[x,v]}),e[11]=x,e[12]=v,e[13]=S):S=e[13];let _;e[14]!==f||e[15]!==S?(_=a.jsxs("div",{className:"flex items-center gap-4",children:[f,S]}),e[14]=f,e[15]=S,e[16]=_):_=e[16];let N;e[17]!==l||e[18]!==o?(N=()=>o(!l),e[17]=l,e[18]=o,e[19]=N):N=e[19];let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",children:[a.jsxs(Xt,{className:"text-sm font-medium text-foreground flex items-center gap-2 pointer-events-none",children:[a.jsx(es,{size:16,className:"text-muted-foreground"}),"Developer Mode"]}),a.jsx("p",{className:"text-xs text-muted-foreground pointer-events-none",children:"Show technical details like JSON input/output for tool calls"})]}),e[20]=k):k=e[20];let y;e[21]!==l||e[22]!==o?(y=a.jsx("div",{onClick:pn,children:a.jsx(Qt,{checked:l,onCheckedChange:o})}),e[21]=l,e[22]=o,e[23]=y):y=e[23];let z;e[24]!==N||e[25]!==y?(z=a.jsxs("button",{type:"button",onClick:N,className:"flex items-center justify-between gap-4 p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors text-left w-full cursor-pointer",children:[k,y]}),e[24]=N,e[25]=y,e[26]=z):z=e[26];let C;e[27]!==_||e[28]!==z?(C=a.jsxs("div",{className:"p-5 space-y-6 min-h-[225px]",children:[_,z]}),e[27]=_,e[28]=z,e[29]=C):C=e[29];let I;e[30]!==i.id?(I=a.jsx("span",{className:"font-mono text-xs",children:i.id}),e[30]=i.id,e[31]=I):I=e[31];let T;e[32]!==c?(T=c?a.jsx(ce,{size:14,className:"text-green-600"}):a.jsx(Fe,{size:14,className:"opacity-0 group-hover:opacity-100 transition-opacity"}),e[32]=c,e[33]=T):T=e[33];let O;e[34]!==u||e[35]!==I||e[36]!==T?(O=a.jsx(Ue,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:u,className:"group flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[I,T]})}),e[34]=u,e[35]=I,e[36]=T,e[37]=O):O=e[37];let M;e[38]===Symbol.for("react.memo_cache_sentinel")?(M=a.jsx(Le,{side:"top",children:a.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[38]=M):M=e[38];let A;e[39]!==O?(A=a.jsx("div",{className:"border-t border-border px-5 py-4 flex items-center shrink-0",children:a.jsx(He,{children:a.jsxs(Be,{children:[O,M]})})}),e[39]=O,e[40]=A):A=e[40];let E;e[41]!==C||e[42]!==A?(E=a.jsxs(Yt,{className:"sm:max-w-lg sm:max-h-[85vh] p-0 flex flex-col",closeButtonClassName:"hidden",children:[b,a.jsxs("div",{className:"flex flex-col",children:[C,A]})]}),e[41]=C,e[42]=A,e[43]=E):E=e[43];let D;return e[44]!==n||e[45]!==s||e[46]!==E?(D=a.jsx(Jt,{open:s,onOpenChange:n,children:E}),e[44]=n,e[45]=s,e[46]=E,e[47]=D):D=e[47],D}function pn(t){return t.stopPropagation()}function hn(t){const e=h.c(47),{user:s,userImage:n}=t,[i,r]=w.useState(!1),[l,o]=w.useState(!1);let c;e[0]!==s.email||e[1]!==s.id||e[2]!==s.name?(c=()=>{const D=`ID: ${s.id}
2
- Name: ${s.name||"N/A"}
3
- Email: ${s.email}`;navigator.clipboard.writeText(D),o(!0),Y.success("User info copied to clipboard"),setTimeout(()=>o(!1),2e3)},e[0]=s.email,e[1]=s.id,e[2]=s.name,e[3]=c):c=e[3];const d=c;let m;e[4]!==s.email||e[5]!==s.name||e[6]!==n?(m=()=>a.jsx(ne,{url:n,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all h-7 w-7"}),e[4]=s.email,e[5]=s.name,e[6]=n,e[7]=m):m=e[7];const u=s.name||s.email||"U";let p;e[8]!==u||e[9]!==n?(p=a.jsx(ne,{url:n,fallback:u,shape:"circle",size:"sm"}),e[8]=u,e[9]=n,e[10]=p):p=e[10];const b=s.name||"User";let j;e[11]!==b?(j=a.jsx("div",{className:"text-sm font-medium truncate",children:b}),e[11]=b,e[12]=j):j=e[12];let f;e[13]!==s.email?(f=a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.email}),e[13]=s.email,e[14]=f):f=e[14];let g;e[15]!==j||e[16]!==f?(g=a.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[j,f]}),e[15]=j,e[16]=f,e[17]=g):g=e[17];let x;e[18]!==l?(x=a.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:l?a.jsx(ce,{size:16,className:"text-green-600"}):a.jsx(Fe,{size:16,className:"text-muted-foreground"})}),e[18]=l,e[19]=x):x=e[19];let v;e[20]!==p||e[21]!==g||e[22]!==x?(v=a.jsxs("div",{className:"group flex items-center gap-3 w-full py-1",children:[p,g,x]}),e[20]=p,e[21]=g,e[22]=x,e[23]=v):v=e[23];let S;e[24]!==d||e[25]!==v?(S=a.jsx(G.Item,{onClick:d,children:v}),e[24]=d,e[25]=v,e[26]=S):S=e[26];let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(G.Separator,{}),e[27]=_):_=e[27];let N,k;e[28]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsxs(G.Item,{onClick:()=>r(!0),children:[a.jsx(ve,{className:"text-muted-foreground",size:18}),"Profile Settings"]}),k=a.jsx(G.Separator,{}),e[28]=N,e[29]=k):(N=e[28],k=e[29]);let y;e[30]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsx(ht,{className:"w-4 h-4 text-muted-foreground"}),e[30]=y):y=e[30];let z;e[31]===Symbol.for("react.memo_cache_sentinel")?(z=a.jsx(G.Item,{asChild:!0,children:a.jsxs("a",{href:"https://github.com/decocms/admin",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[y,"decocms/admin",a.jsx(Ie,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[31]=z):z=e[31];let C;e[32]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(qe,{className:"text-muted-foreground",size:18}),e[32]=C):C=e[32];let I,T;e[33]===Symbol.for("react.memo_cache_sentinel")?(I=a.jsx(G.Item,{asChild:!0,children:a.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[C,"Homepage",a.jsx(Ie,{size:18,className:"ml-auto text-muted-foreground"})]})}),T=a.jsx(G.Separator,{}),e[33]=I,e[34]=T):(I=e[33],T=e[34]);let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=a.jsxs(G.Item,{onClick:xn,children:[a.jsx(Je,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[35]=O):O=e[35];let M;e[36]!==S||e[37]!==m||e[38]!==s?(M=a.jsxs(G,{user:s,trigger:m,align:"end",children:[S,_,N,k,z,I,T,O]}),e[36]=S,e[37]=m,e[38]=s,e[39]=M):M=e[39];let A;e[40]!==i||e[41]!==s||e[42]!==n?(A=i&&a.jsx(un,{open:i,onOpenChange:r,user:s,userImage:n}),e[40]=i,e[41]=s,e[42]=n,e[43]=A):A=e[43];let E;return e[44]!==M||e[45]!==A?(E=a.jsxs(a.Fragment,{children:[M,A]}),e[44]=M,e[45]=A,e[46]=E):E=e[46],E}function xn(){return J.signOut()}function gn(){const t=h.c(7),{data:e}=J.useSession();if(!e?.user){let c;return t[0]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx(ne,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer h-7 w-7",muted:!0}),t[0]=c):c=t[0],c}const s=e.user,n=s.name??void 0;let i;t[1]!==n||t[2]!==s?(i={...s,name:n},t[1]=n,t[2]=s,t[3]=i):i=t[3];const r=i,l=s.image;let o;return t[4]!==l||t[5]!==r?(o=a.jsx(hn,{user:r,userImage:l}),t[4]=l,t[5]=r,t[6]=o):o=t[6],o}function Se(){const t=h.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=je.decoChatOpen(),t[0]=e):e=t[0];const[s,n]=be(e,bn);let i;return t[1]!==s||t[2]!==n?(i=[s,n],t[1]=s,t[2]=n,t[3]=i):i=t[3],i}function bn(t){return!!(t??!1)}function jn(){const t=h.c(2),s=xe().location.href;let n;return t[0]!==s?(n=a.jsx(jt,{to:"/login",search:{next:s},replace:!0}),t[0]=s,t[1]=n):n=t[1],n}function vn(t){const e=h.c(6),{children:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(xt,{children:a.jsx(Me,{})}),e[0]=n):n=e[0];let i;e[1]!==s?(i=a.jsx(gt,{children:s}),e[1]=s,e[2]=i):i=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(bt,{children:a.jsx(jn,{})}),e[3]=r):r=e[3];let l;return e[4]!==i?(l=a.jsxs(a.Fragment,{children:[n,i,r]}),e[4]=i,e[5]=l):l=e[5],l}function wn(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function Sn(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("flex items-center justify-center px-2.5 h-full border-r border-border",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function Nn(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("flex items-center gap-2 px-2 h-full",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function yn(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("flex items-center gap-2 px-2 h-full flex-1",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function Cn(t){const e=h.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=$("flex items-center gap-2 px-2 h-full ml-auto",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=a.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function _n(){const t=h.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:a.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:a.jsx("div",{className:"w-32 h-6 bg-muted rounded-md animate-pulse"})}),t[1]=s):s=t[1];let n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsxs("div",{className:"fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",children:[e,s,a.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:a.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=n):n=t[2],n}const oe=Object.assign(wn,{Sidebar:Sn,Left:Nn,Center:yn,Right:Cn,Skeleton:_n});function ct(){const t=h.c(3),{toggleSidebar:e}=we();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(Ye,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:18}),t[0]=s):s=t[0];let n;return t[1]!==e?(n=a.jsx(a.Fragment,{children:a.jsx(Z,{onClick:e,size:"icon",variant:"ghost",className:"w-7 h-7 rounded-md",children:s})}),t[1]=e,t[2]=n):n=t[2],n}ct.Skeleton=function(){return a.jsx("div",{className:"w-7 h-7 bg-muted rounded-md animate-pulse"})};function kn(){const t=h.c(81),{org:e}=fe(),[,s]=Se(),{selectedVirtualMcp:n,modelsConnections:i,isChatEmpty:r,activeThreadId:l,setActiveThreadId:o,threads:c}=Rt();let d;if(t[0]!==l||t[1]!==c){let B;t[3]!==l?(B=q=>q.id===l,t[3]=l,t[4]=B):B=t[4],d=c.find(B),t[0]=l,t[1]=c,t[2]=d}else d=t[2];const m=d,[u,p]=w.useState(!1);let b;t[5]!==e.id?(b=ns(e.id),t[5]=e.id,t[6]=b):b=t[6];const f=n??b;if(i.length===0){let B;t[7]!==f.icon||t[8]!==f.title?(B=a.jsx(pe,{icon:f.icon,name:f.title,size:"xs",className:"size-5 rounded-md aspect-square shrink-0"}),t[7]=f.icon,t[8]=f.title,t[9]=B):B=t[9];let q;t[10]!==f.title?(q=a.jsx("span",{className:"text-sm font-medium",children:f.title}),t[10]=f.title,t[11]=q):q=t[11];let X;t[12]!==B||t[13]!==q?(X=a.jsxs(R.Header.Left,{children:[B,q]}),t[12]=B,t[13]=q,t[14]=X):X=t[14];let Q;t[15]!==s?(Q=()=>s(!1),t[15]=s,t[16]=Q):Q=t[16];let re;t[17]===Symbol.for("react.memo_cache_sentinel")?(re=a.jsx(de,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[17]=re):re=t[17];let ee;t[18]!==Q?(ee=a.jsx(R.Header.Right,{children:a.jsx("button",{type:"button",onClick:Q,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:re})}),t[18]=Q,t[19]=ee):ee=t[19];let te;t[20]!==X||t[21]!==ee?(te=a.jsxs(R.Header,{children:[X,ee]}),t[20]=X,t[21]=ee,t[22]=te):te=t[22];let se;t[23]!==e?(se=a.jsx(R.Main,{className:"flex flex-col items-center",children:a.jsx(R.EmptyState,{children:a.jsx(R.NoLlmBindingEmptyState,{title:"No model provider connected",description:"Connect to a model provider to unlock AI-powered features.",org:e})})}),t[23]=e,t[24]=se):se=t[24];let le;return t[25]!==te||t[26]!==se?(le=a.jsxs(R,{children:[te,se]}),t[25]=te,t[26]=se,t[27]=le):le=t[27],le}const g=u?"opacity-0 -translate-x-4 pointer-events-none":"opacity-100 translate-x-0";let x;t[28]!==g?(x=$("absolute inset-0 flex flex-col transition-all duration-300 ease-in-out",g),t[28]=g,t[29]=x):x=t[29];let v;t[30]!==f.icon||t[31]!==f.title?(v=a.jsx(pe,{icon:f.icon,name:f.title,size:"xs",className:"size-5 rounded-md aspect-square shrink-0"}),t[30]=f.icon,t[31]=f.title,t[32]=v):v=t[32];let S;t[33]!==m||t[34]!==f.title||t[35]!==r?(S=!r&&m?.title?a.jsx($t,{text:m.title,className:"text-sm font-medium text-foreground"}):a.jsx("span",{className:"text-sm font-medium text-foreground",children:f.title}),t[33]=m,t[34]=f.title,t[35]=r,t[36]=S):S=t[36];let _;t[37]!==v||t[38]!==S?(_=a.jsxs(R.Header.Left,{children:[v,S]}),t[37]=v,t[38]=S,t[39]=_):_=t[39];let N;t[40]!==o?(N=()=>o(crypto.randomUUID()),t[40]=o,t[41]=N):N=t[41];let k;t[42]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(as,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[42]=k):k=t[42];let y;t[43]!==N?(y=a.jsx("button",{type:"button",onClick:N,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:k}),t[43]=N,t[44]=y):y=t[44];let z;t[45]===Symbol.for("react.memo_cache_sentinel")?(z=()=>p(!0),t[45]=z):z=t[45];let C;t[46]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx("button",{type:"button",onClick:z,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"Chat history",children:a.jsx(Ot,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),t[46]=C):C=t[46];let I;t[47]!==s?(I=()=>s(!1),t[47]=s,t[48]=I):I=t[48];let T;t[49]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(de,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[49]=T):T=t[49];let O;t[50]!==I?(O=a.jsx("button",{type:"button",onClick:I,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:T}),t[50]=I,t[51]=O):O=t[51];let M;t[52]!==O||t[53]!==y?(M=a.jsxs(R.Header.Right,{children:[y,C,O]}),t[52]=O,t[53]=y,t[54]=M):M=t[54];let A;t[55]!==M||t[56]!==_?(A=a.jsxs(R.Header,{children:[_,M]}),t[55]=M,t[56]=_,t[57]=A):A=t[57];let E;t[58]!==f.description||t[59]!==f.icon||t[60]!==f.title||t[61]!==r?(E=a.jsx(R.Main,{children:r?a.jsx(R.EmptyState,{children:a.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[a.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-0 text-center",children:[a.jsx(pe,{icon:f.icon,name:f.title,size:"lg",fallbackIcon:a.jsx(Ve,{size:32}),className:"size-[60px]! rounded-[18px]!"}),a.jsx("h3",{className:"text-xl font-medium text-foreground",children:f.title}),a.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:f.description??"Ask anything about configuring model providers or using MCP Mesh."})]}),a.jsx(R.IceBreakers,{})]})}):a.jsx(R.Messages,{minHeightOffset:280})}),t[58]=f.description,t[59]=f.icon,t[60]=f.title,t[61]=r,t[62]=E):E=t[62];let D;t[63]===Symbol.for("react.memo_cache_sentinel")?(D=a.jsx(R.Footer,{children:a.jsx(R.Input,{})}),t[63]=D):D=t[63];let W;t[64]!==A||t[65]!==E||t[66]!==x?(W=a.jsxs("div",{className:x,children:[A,E,D]}),t[64]=A,t[65]=E,t[66]=x,t[67]=W):W=t[67];const V=u?"opacity-100 translate-x-0":"opacity-0 translate-x-4 pointer-events-none";let U;t[68]!==V?(U=$("absolute inset-0 flex flex-col transition-all duration-300 ease-in-out",V),t[68]=V,t[69]=U):U=t[69];let F;t[70]===Symbol.for("react.memo_cache_sentinel")?(F=()=>p(!1),t[70]=F):F=t[70];let P;t[71]!==l||t[72]!==o||t[73]!==c?(P=a.jsx(Tt,{threads:c,activeThreadId:l,onThreadSelect:o,onClose:F}),t[71]=l,t[72]=o,t[73]=c,t[74]=P):P=t[74];let L;t[75]!==U||t[76]!==P?(L=a.jsx("div",{className:U,children:P}),t[75]=U,t[76]=P,t[77]=L):L=t[77];let K;return t[78]!==W||t[79]!==L?(K=a.jsxs(R,{className:"relative overflow-hidden",children:[W,L]}),t[78]=W,t[79]=L,t[80]=K):K=t[80],K}function In(){const t=h.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(R.Skeleton,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(R.Skeleton,{}),t[1]=s):s=t[1];let n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx(Pe,{fallback:e,children:a.jsx(w.Suspense,{fallback:s,children:a.jsx(R.Provider,{children:a.jsx(kn,{})})})}),t[2]=n):n=t[2],n}function $e({showSidebarToggle:t=!1,showOrgSwitcher:e=!1,showDecoChat:s=!1,disableDecoChat:n=!1}){const[i,r]=Se(),l=w.useRef(n);n&&i&&l.current!==n&&r(!1),l.current=n;const o=()=>{n||r(c=>!c)};return a.jsxs(oe,{children:[t&&a.jsx(oe.Sidebar,{children:a.jsx(ct,{})}),a.jsx(oe.Left,{children:e&&a.jsx(w.Suspense,{fallback:a.jsx(he.Skeleton,{}),children:a.jsx(he,{})})}),a.jsxs(oe.Right,{className:"gap-2",children:[a.jsx(rs,{}),s&&!n&&a.jsxs(Z,{size:"sm",variant:"default",onClick:o,className:"h-7 gap-2",children:[a.jsx(Mt,{size:16}),"Chat"]}),a.jsx(gn,{})]})]})}function zn(t){const e=h.c(10),{children:s,className:n}=t,[,i]=w.useTransition();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je.decoChatPanelWidth(),e[0]=r):r=e[0];const[l,o]=be(r,30);let c;e[1]!==o?(c=p=>i(()=>o(p)),e[1]=o,e[2]=c):c=e[2];const d=c;let m;e[3]!==n?(m=$("min-w-0",n),e[3]=n,e[4]=m):m=e[4];let u;return e[5]!==l||e[6]!==s||e[7]!==d||e[8]!==m?(u=a.jsx(Ke,{defaultSize:l,minSize:20,className:m,onResize:d,children:s}),e[5]=l,e[6]=s,e[7]=d,e[8]=m,e[9]=u):u=e[9],u}function $n(t){const e=h.c(5),{children:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=je.sidebarOpen(),e[0]=n):n=e[0];const[i,r]=be(n,!0);let l;return e[1]!==s||e[2]!==r||e[3]!==i?(l=a.jsx(us,{open:i,onOpenChange:r,children:s}),e[1]=s,e[2]=r,e[3]=i,e[4]=l):l=e[4],l}function On(t){const e=h.c(12),{disableChat:s}=t,n=s===void 0?!1:s,[i]=Se(),r=i&&!n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ke,{className:"bg-background",children:a.jsx(Ae,{})}),e[0]=l):l=e[0];let o;e[1]!==n||e[2]!==r?(o=!n&&a.jsx(ts,{withHandle:r}),e[1]=n,e[2]=r,e[3]=o):o=e[3];const c=r?"max-w-none":"max-w-0";let d;e[4]!==c?(d=$(c),e[4]=c,e[5]=d):d=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(In,{}),e[6]=m):m=e[6];let u;e[7]!==d?(u=a.jsx(zn,{className:d,children:m}),e[7]=d,e[8]=u):u=e[8];let p;return e[9]!==o||e[10]!==u?(p=a.jsxs(ss,{direction:"horizontal",children:[l,o,u]}),e[9]=o,e[10]=u,e[11]=p):p=e[11],p}function Tn(){const t=h.c(22);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=Oe(e),n=xe(),i=n.location.pathname===`/${s}`||n.location.pathname===`/${s}/`;let r;t[1]!==s?(r=St.activeOrganization(s),t[1]=s,t[2]=r):r=t[2];let l;t[3]!==s?(l=async()=>{if(!s)return null;const{data:f}=await J.organization.setActive({organizationSlug:s});return{org:f,project:{slug:Nt}}},t[3]=s,t[4]=l):l=t[4];let o;t[5]!==r||t[6]!==l?(o={queryKey:r,queryFn:l,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=r,t[6]=l,t[7]=o):o=t[7];const{data:c}=vt(o);if(!c){let f;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx($e,{}),t[8]=f):f=t[8];let g;return t[9]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsxs("div",{className:"min-h-screen bg-background",children:[f,a.jsx("div",{className:"pt-12",children:a.jsx(Ae,{})})]}),t[9]=g):g=t[9],g}let d;t[10]!==i?(d=a.jsx($e,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0,disableDecoChat:i}),t[10]=i,t[11]=d):d=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m={"--sidebar-width":"13rem","--sidebar-width-mobile":"11rem"},t[12]=m):m=t[12];let u;t[13]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Os,{}),t[13]=u):u=t[13];let p;t[14]!==i?(p=a.jsxs(xs,{className:"flex-1 bg-sidebar",style:m,children:[u,a.jsx(bs,{className:"pt-12",children:a.jsx(On,{disableChat:i})})]}),t[14]=i,t[15]=p):p=t[15];let b;t[16]!==d||t[17]!==p?(b=a.jsx($n,{children:a.jsxs("div",{className:"flex flex-col h-screen",children:[d,p]})}),t[16]=d,t[17]=p,t[18]=b):b=t[18];let j;return t[19]!==c||t[20]!==b?(j=a.jsx(wt,{...c,children:b}),t[19]=c,t[20]=b,t[21]=j):j=t[21],j}function Ea(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(vn,{children:a.jsx(w.Suspense,{fallback:a.jsx(Me,{}),children:a.jsx(Tn,{})})}),t[0]=e):e=t[0],e}export{Ea as default};
@@ -1 +0,0 @@
1
- import{r as c,j as i,al as C,ak as y,ah as T,am as I,aA as M,aB as A,at as H,c as z}from"./index-C8OOnmm1.js";import{c as g}from"./button-C83AQWC1.js";var b="Switch",[U]=H(b),[q,L]=U(b),E=c.forwardRef((s,e)=>{const{__scopeSwitch:t,name:r,checked:a,defaultChecked:n,required:o,disabled:d,value:u="on",onCheckedChange:k,form:l,...w}=s,[p,h]=c.useState(null),v=y(e,m=>h(m)),x=c.useRef(!1),S=p?l||!!p.closest("form"):!0,[f,N]=T({prop:a,defaultProp:n??!1,onChange:k,caller:b});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":o,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...w,ref:v,onClick:I(s.onClick,m=>{N(B=>!B),S&&(x.current=m.isPropagationStopped(),x.current||m.stopPropagation())})}),S&&i.jsx(_,{control:p,bubbles:!x.current,name:r,value:u,checked:f,required:o,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});E.displayName=b;var P="SwitchThumb",R=c.forwardRef((s,e)=>{const{__scopeSwitch:t,...r}=s,a=L(P,t);return i.jsx(C.span,{"data-state":j(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});R.displayName=P;var O="SwitchBubbleInput",_=c.forwardRef(({__scopeSwitch:s,control:e,checked:t,bubbles:r=!0,...a},n)=>{const o=c.useRef(null),d=y(o,n),u=M(t),k=A(e);return c.useEffect(()=>{const l=o.current;if(!l)return;const w=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&h){const v=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(v)}},[u,t,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...a,tabIndex:-1,ref:d,style:{...a.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_.displayName=O;function j(s){return s?"checked":"unchecked"}var $=E,D=R;function X(s){const e=z.c(9);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(D,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==a?(o=i.jsx($,{"data-slot":"switch",className:a,...r,children:n}),e[6]=r,e[7]=a,e[8]=o):o=e[8],o}export{X as S};
@@ -1 +0,0 @@
1
- import{r as N,c as F,j as t,p as A}from"./index-C8OOnmm1.js";import{I as R}from"./empty-state-Cr5g6Vh9.js";import{C as B}from"./checkbox-DcPieRc5.js";import{c as T,B as V}from"./button-C83AQWC1.js";import{i as L}from"./ArrowLeft-DzpTEYvO.js";import{b as q}from"./use-connection-TLrid9RM.js";import{C as G}from"./collection-search-bOTNZP0b.js";const H=N.memo(function(S){const e=F.c(21),{connection:o,isSelected:a,hasToolsEnabled:p,activeToolsCount:l,totalToolsCount:h,onSelect:g,onToggle:m}=S,f=a?"bg-accent/50":"hover:bg-muted/50";let r;e[0]!==f?(r=T("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",f),e[0]=f,e[1]=r):r=e[1];let i;e[2]!==o.icon||e[3]!==o.title?(i=t.jsx(R,{icon:o.icon,name:o.title,size:"xs"}),e[2]=o.icon,e[3]=o.title,e[4]=i):i=e[4];let u;e[5]!==o.title?(u=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.title})}),e[5]=o.title,e[6]=u):u=e[6];let c;e[7]!==g||e[8]!==i||e[9]!==u?(c=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:g,children:[i,u]}),e[7]=g,e[8]=i,e[9]=u,e[10]=c):c=e[10];let x;e[11]!==l||e[12]!==o.tools||e[13]!==p||e[14]!==m||e[15]!==h?(x=o.tools&&o.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[l,"/",h]}),t.jsx(B,{checked:p,onCheckedChange:m,onClick:K})]}),e[11]=l,e[12]=o.tools,e[13]=p,e[14]=m,e[15]=h,e[16]=x):x=e[16];let j;return e[17]!==r||e[18]!==c||e[19]!==x?(j=t.jsxs("div",{className:r,children:[c,x]}),e[17]=r,e[18]=c,e[19]=x,e[20]=j):j=e[20],j}),J=N.memo(function(S){const e=F.c(18),{connectionId:o,tool:a,isSelected:p,onToggle:l}=S,h=`tool-${o}-${a.name}`,g=p?"text-foreground":"text-muted-foreground";let m;e[0]!==g?(m=T("text-sm font-medium",g),e[0]=g,e[1]=m):m=e[1];let f;e[2]!==m||e[3]!==a.name?(f=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:m,children:a.name})}),e[2]=m,e[3]=a.name,e[4]=f):f=e[4];let r;e[5]!==a.description?(r=a.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),e[5]=a.description,e[6]=r):r=e[6];let i;e[7]!==f||e[8]!==r?(i=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,r]}),e[7]=f,e[8]=r,e[9]=i):i=e[9];const u=`tool-${o}-${a.name}`;let c;e[10]!==p||e[11]!==l||e[12]!==u?(c=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(B,{id:u,checked:p,onCheckedChange:l,onClick:W})}),e[10]=p,e[11]=l,e[12]=u,e[13]=c):c=e[13];let x;return e[14]!==h||e[15]!==i||e[16]!==c?(x=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:h,children:[i,c]}),e[14]=h,e[15]=i,e[16]=c,e[17]=x):x=e[17],x});function oe({toolSet:d,onToolSetChange:S,excludeVirtualMcpId:e}){const[o,a]=N.useState(""),p=N.useDeferredValue(o),[l,h]=N.useState("all"),[g,m]=N.useState(!1),f=N.useRef(new Set(Object.keys(d))),r=q({searchTerm:p.trim()||void 0}),i=e?r.filter(s=>s.connection_type!=="VIRTUAL"?!0:A(s.connection_url)!==e):r,u=f.current,c=[...u.values()].map(s=>i.find(n=>n.id===s)).filter(s=>s!==void 0),x=i.filter(s=>!u.has(s.id)),j=[...c,...x],I=s=>{const n=d[s];return n!==void 0&&n.length>0},$=j.filter(s=>{if(l==="all")return!0;const n=I(s.id);return l==="selected"?n:l==="unselected"?!n:!0}),[M,E]=N.useState(j[0]?.id??null),b=M?j.find(s=>s.id===M)??null:null,z=b?.tools??[],D=(s,n)=>d[s]?.includes(n)??!1,O=(s,n)=>{const v=d[s]??[],k=v.includes(n),y={...d};if(k){const w=v.filter(C=>C!==n);w.length===0?delete y[s]:y[s]=w}else y[s]=[...v,n];S(y)},P=s=>{const n=j.find(C=>C.id===s);if(!n?.tools)return;const v=d[s]??[],k=n.tools.map(C=>C.name),y=v.length>0&&k.every(C=>v.includes(C)),w={...d};y?delete w[s]:(w[s]=k,E(s)),S(w)},Q=s=>{E(s),m(!0)},U=()=>{m(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:T("w-full md:w-80 border-r border-border flex flex-col",g&&"hidden md:flex"),children:[t.jsx(G,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>h("all"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",l==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>h("selected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",l==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>h("unselected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",l==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:$.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:o?"No connections found":l==="selected"?"No servers selected":l==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:$.map(s=>{const n=s.tools?.length??0,v=d[s.id]?.length??0;return t.jsx(H,{connection:s,isSelected:M===s.id,hasToolsEnabled:I(s.id),activeToolsCount:v,totalToolsCount:n,onSelect:()=>Q(s.id),onToggle:()=>P(s.id)},s.id)})})})]}),t.jsx("div",{className:T("flex-1 flex-col",g?"flex":"hidden md:flex"),children:b?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:U,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(L,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(R,{icon:b.icon,name:b.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:b.title}),b.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:z.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:z.map(s=>t.jsx(J,{connectionId:b.id,tool:s,isSelected:D(b.id,s.name),onToggle:()=>O(b.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function K(d){return d.stopPropagation()}function W(d){return d.stopPropagation()}export{oe as T};
@@ -1 +0,0 @@
1
- import{r as a,j as c,al as S,aj as J,ah as Q,ai as Z,ak as H,an as ee,am as C,ao as $,ap as te,aq as G,ax as oe,ay as re,at as ne,aM as se,az as ae,c as j}from"./index-C8OOnmm1.js";import{c as ie}from"./button-C83AQWC1.js";var le=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ce="VisuallyHidden",z=a.forwardRef((o,e)=>c.jsx(S.span,{...o,ref:e,style:{...le,...o.style}}));z.displayName=ce;var ue=z,[O]=ne("Tooltip",[G]),D=G(),V="TooltipProvider",de=700,L="tooltip.open",[pe,k]=O(V),F=o=>{const{__scopeTooltip:e,delayDuration:t=de,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=a.useRef(!0),d=a.useRef(!1),i=a.useRef(0);return a.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsx(pe,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};F.displayName=V;var R="Tooltip",[fe,_]=O(R),Y=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:d}=o,i=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),x=J(),f=a.useRef(0),h=l??i.disableHoverableContent,m=d??i.delayDuration,g=a.useRef(!1),[y,T]=Q({prop:r,defaultProp:n??!1,onChange:I=>{I?(i.onOpen(),document.dispatchEvent(new CustomEvent(L))):i.onClose(),s?.(I)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,T(!0)},[T]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,T(!1)},[T]),M=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,T(!0),f.current=0},m)},[m,T]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(Z,{...p,children:c.jsx(fe,{scope:e,contentId:x,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{i.isOpenDelayedRef.current?M():E()},[i.isOpenDelayedRef,M,E]),onTriggerLeave:a.useCallback(()=>{h?P():(window.clearTimeout(f.current),f.current=0)},[P,h]),onOpen:E,onClose:P,disableHoverableContent:h,children:t})})};Y.displayName=R;var A="TooltipTrigger",B=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(A,t),s=k(A,t),l=D(t),d=a.useRef(null),i=H(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(ee,{asChild:!0,...l,children:c.jsx(S.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});B.displayName=A;var N="TooltipPortal",[ve,xe]=O(N,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(N,e);return c.jsx(ve,{scope:e,forceMount:t,children:c.jsx($,{present:t||s.open,children:c.jsx(te,{asChild:!0,container:n,children:r})})})};U.displayName=N;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=xe(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return c.jsx($,{present:r||l.open,children:l.disableHoverableContent?c.jsx(W,{side:n,...s,ref:e}):c.jsx(he,{side:n,...s,ref:e})})}),he=a.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=H(e,n),[l,d]=a.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,x=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((h,m)=>{const g=h.currentTarget,y={x:h.clientX,y:h.clientY},T=ye(y,g.getBoundingClientRect()),w=Ce(y,T),E=be(m.getBoundingClientRect()),P=Ee([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>x(),[x]),a.useEffect(()=>{if(i&&u){const h=g=>f(g,u),m=g=>f(g,i);return i.addEventListener("pointerleave",h),u.addEventListener("pointerleave",m),()=>{i.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",m)}}},[i,u,f,x]),a.useEffect(()=>{if(l){const h=m=>{const g=m.target,y={x:m.clientX,y:m.clientY},T=i?.contains(g)||u?.contains(g),w=!we(y,l);T?x():w&&(x(),p())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[i,u,l,p,x]),c.jsx(W,{...o,ref:s})}),[ge,me]=O(R,{isInside:!1}),Te=se("TooltipContent"),W=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...d}=o,i=_(b,t),p=D(t),{onClose:u}=i;return a.useEffect(()=>(document.addEventListener(L,u),()=>document.removeEventListener(L,u)),[u]),a.useEffect(()=>{if(i.trigger){const v=x=>{x.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[i.trigger,u]),c.jsx(oe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(re,{"data-state":i.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Te,{children:r}),c.jsx(ge,{scope:t,isInside:!0,children:c.jsx(ue,{id:i.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var X="TooltipArrow",K=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return me(X,t).isInside?null:c.jsx(ae,{...n,...r,ref:e})});K.displayName=X;function ye(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ce(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function be(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function we(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const d=e[s],i=e[l],p=d.x,u=d.y,v=i.x,x=i.y;u>r!=x>r&&t<(v-p)*(r-u)/(x-u)+p&&(n=!n)}return n}function Ee(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Pe(e)}function Pe(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Re=F,_e=Y,je=B,Oe=U,De=q,Le=K;function Ae(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(Re,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Me(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(Ae,{children:c.jsx(_e,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Ie(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(je,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function Se(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let d;e[5]!==r?(d=ie("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Le,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=i):i=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==d?(p=c.jsx(Oe,{children:c.jsxs(De,{"data-slot":"tooltip-content",sideOffset:l,className:d,...n,children:[t,i]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{Ie as T,le as V,Se as a,Ae as b,Me as c};