decocms 3.31.0 → 3.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/client/assets/{AlertCircle-A2M1Yk61.js → AlertCircle-CNjNg2wb.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CjvxrowT.js → ArrowUpRight-7-SM74wR.js} +1 -1
  3. package/dist/client/assets/{Check-Cl07asRj.js → Check-CkY-NLLZ.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Ck9u9W7w.js → CheckCircle-DYKqL__C.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Ce3UdjOo.js → ChevronDown-B8XrNXeE.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-SeayBU0G.js → ChevronLeft-B6gErU0k.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-C8KzXj8H.js → ChevronRight-BJRYs8bt.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-zA2iz0JQ.js → ChevronUp-CgxnjYlU.js} +1 -1
  9. package/dist/client/assets/{Container-B3y5dlGc.js → Container-Dt-ev6Gi.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-_g_anHKb.js → DotsVertical-BwZzHCbU.js} +1 -1
  11. package/dist/client/assets/{Eye-lcuSJE4l.js → Eye-Co-ItdFE.js} +1 -1
  12. package/dist/client/assets/{FilterLines-EpjZnXUA.js → FilterLines-DwPmuK2v.js} +1 -1
  13. package/dist/client/assets/{Globe01-CfZP4vCY.js → Globe01-BnLBFtky.js} +1 -1
  14. package/dist/client/assets/{HardDrive-75MAycL-.js → HardDrive-DmPQQU2w.js} +1 -1
  15. package/dist/client/assets/{Key01-DyeMqFvi.js → Key01-BuFH2ztD.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-DwKLO_V_.js → LayoutLeft-DOdRMzln.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-r7kaLetr.js → LinkExternal01-ZepkFy5p.js} +1 -1
  18. package/dist/client/assets/{Monitor01-C_pzVd4h.js → Monitor01-5IIvvy6H.js} +1 -1
  19. package/dist/client/assets/{Palette-DdA_ILd6.js → Palette-Cu3PTFf5.js} +1 -1
  20. package/dist/client/assets/{Play-CnkDDouZ.js → Play-4vubxqND.js} +1 -1
  21. package/dist/client/assets/{Plus-Dx1SIiMT.js → Plus-DrYyBDmj.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-C3I3Y9Tu.js → RefreshCcw01-eSV0Gr10.js} +1 -1
  23. package/dist/client/assets/{SearchMd-DFhUmylG.js → SearchMd-Dq0euRWv.js} +1 -1
  24. package/dist/client/assets/{Settings02-CWkfxXGQ.js → Settings02-B_z2JeIq.js} +1 -1
  25. package/dist/client/assets/{Shield01-CbvWDrmE.js → Shield01-Dmf7TklI.js} +1 -1
  26. package/dist/client/assets/{Star01-DkpG4lGE.js → Star01-ChWAyIjY.js} +1 -1
  27. package/dist/client/assets/{Stars01-CJ8FecuG.js → Stars01-DbI-YGmK.js} +1 -1
  28. package/dist/client/assets/{Stars02-bH2-rrrk.js → Stars02-WR3K9Daq.js} +1 -1
  29. package/dist/client/assets/{Sun-CLmK6D64.js → Sun-BIJajZBA.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-CDVzg25U.js → SwitchHorizontal01-BjyN-RbX.js} +1 -1
  31. package/dist/client/assets/{Tool01-Cm1sVqXs.js → Tool01-Nn7pl58k.js} +1 -1
  32. package/dist/client/assets/{Trash01-CA4jg9ww.js → Trash01-BW2v6vxa.js} +1 -1
  33. package/dist/client/assets/{Upload01-BbVOBYlS.js → Upload01-CyW8Wv9e.js} +1 -1
  34. package/dist/client/assets/{User01-CMz2xYx2.js → User01-BBVMvdD1.js} +1 -1
  35. package/dist/client/assets/{Users01-DBOuOgB6.js → Users01-3QXDJ7kM.js} +1 -1
  36. package/dist/client/assets/{Users03-DIxLvYmx.js → Users03-Dc2Q2YCx.js} +1 -1
  37. package/dist/client/assets/{X-8-D5pATw.js → X-BUrHvnq3.js} +1 -1
  38. package/dist/client/assets/{XCircle-D0Uf6feY.js → XCircle-Bz32In76.js} +1 -1
  39. package/dist/client/assets/{XClose-Cnj8fI9u.js → XClose-D4SdKRIc.js} +1 -1
  40. package/dist/client/assets/{Zap-mYMK3ZBL.js → Zap-DAhQN3Qe.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-qMfSZ8L9.js → ZapSquare-DdYqdyu4.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-aYAC7hBe.js → ZoomOut-BP5vTMyD.js} +1 -1
  43. package/dist/client/assets/{access-gate-daLhvTar.js → access-gate-CGZv0aLQ.js} +1 -1
  44. package/dist/client/assets/{accordion-Cm248afD.js → accordion-CGxHoi6P.js} +1 -1
  45. package/dist/client/assets/add-section-modal-DLCZWYmt.js +1 -0
  46. package/dist/client/assets/agent-capabilities-BOt7wU7l.js +3 -0
  47. package/dist/client/assets/{agent-icon-cetEWq0Z.js → agent-icon-DbC1U9Lv.js} +1 -1
  48. package/dist/client/assets/{agent-icons-CK-xDflz.js → agent-icons-B273VQSG.js} +2 -2
  49. package/dist/client/assets/{agents-list-Da1iRt5l.js → agents-list-Dpi-AAFb.js} +1 -1
  50. package/dist/client/assets/{ai-providers-BJhgs18P.js → ai-providers-DGbRuhig.js} +1 -1
  51. package/dist/client/assets/{alert-BBTJrkK5.js → alert-dB15ZxT2.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DokKbPq-.js → alert-dialog-CstddcEP.js} +2 -2
  53. package/dist/client/assets/app-editor-Cq82w23j.js +1 -0
  54. package/dist/client/assets/{auth-catchall-CVFro2W9.js → auth-catchall-2_Uziri1.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-Bsctr1_-.js → auth-split-layout-BBSUM3P9.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-D23Bvwkx.js → automation-list-row-DeSlvYhB.js} +1 -1
  57. package/dist/client/assets/{automation-runs-BMMJyRtq.js → automation-runs-D6XH4v3a.js} +1 -1
  58. package/dist/client/assets/{automations-DoosX3yK.js → automations-DouKICLt.js} +1 -1
  59. package/dist/client/assets/{avatar-Bg8Fajzf.js → avatar-Glcqg-C7.js} +1 -1
  60. package/dist/client/assets/{badge-CWyTrVve.js → badge-CjjK5Sr7.js} +1 -1
  61. package/dist/client/assets/{brand-context-D5dCbA6y.js → brand-context-DdQVWL7M.js} +1 -1
  62. package/dist/client/assets/{buckets-C3jVEHjb.js → buckets-DVxXOURG.js} +1 -1
  63. package/dist/client/assets/{calendar-D2buY6we.js → calendar-D0KKVHnd.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-Co02--jW.js → capability-load-error-B_GRCsfG.js} +1 -1
  65. package/dist/client/assets/{card-BVDRUeiB.js → card-DeDg0Mpx.js} +1 -1
  66. package/dist/client/assets/{chat-context-CpxV-LEc.js → chat-context-Dd9y-6Y-.js} +1 -1
  67. package/dist/client/assets/{checkbox-C0OD5DTK.js → checkbox-D292XxeM.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-pLKti1nS.js → cli-auth-success-DF9o-evj.js} +1 -1
  69. package/dist/client/assets/{collection-detail-Bx5cx6Tv.js → collection-detail-ZNirTQKs.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-Dpa_fFcT.js → collection-display-button-BHNg4RzF.js} +1 -1
  71. package/dist/client/assets/{collection-search-DHln9QoJ.js → collection-search-CFFTRK3x.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-CTiIT2dF.js → collection-table-wrapper-CJC6Vyfs.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-BaiyS1az.js → collection-tabs-Da8fu2pB.js} +1 -1
  74. package/dist/client/assets/{collections-Deko--Yp.js → collections-CWnO7g9J.js} +1 -1
  75. package/dist/client/assets/{command-3qLn4P52.js → command-Dm1ALJPS.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-BoRQM4OA.js → connect-desktop-dialog-CNaHa2Dn.js} +1 -1
  77. package/dist/client/assets/{connection-card-ZCt-smg_.js → connection-card-J_g5yRQM.js} +1 -1
  78. package/dist/client/assets/{connection-detail-DipDTh4H.js → connection-detail-CtdPxsW2.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-B6JNJh-A.js → connection-form-helpers-0bmqzhLl.js} +1 -1
  80. package/dist/client/assets/connections-P_p0V_Q0.js +1 -0
  81. package/dist/client/assets/decopilot-sse-pool-BemyIcDl.js +1 -0
  82. package/dist/client/assets/{dialog-BnOLdErK.js → dialog-B4Gk40Ec.js} +1 -1
  83. package/dist/client/assets/{domain-settings-CwC_r-qt.js → domain-settings-BDb8F-pn.js} +1 -1
  84. package/dist/client/assets/{drawer-Be_zu0QX.js → drawer-C8AwBmXm.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-mHDT-XH7.js → dropdown-menu-D2S2HMhI.js} +1 -1
  86. package/dist/client/assets/{dynamic-plugin-layout-BGkekAkH.js → dynamic-plugin-layout-Dg3kd-lT.js} +1 -1
  87. package/dist/client/assets/{empty-state-CeDRg4Pp.js → empty-state-BEPxxZyq.js} +1 -1
  88. package/dist/client/assets/{empty-state-CpfaS4oL.js → empty-state-ZcLmoTrQ.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-bN8kltS6.js → extract-connection-data-Cdme2PYD.js} +1 -1
  90. package/dist/client/assets/{features-4Hsf4UEQ.js → features-Dg5ySgax.js} +1 -1
  91. package/dist/client/assets/file-explorer-NmtOY4n0.js +2 -0
  92. package/dist/client/assets/{file-type-icon-DHQvk0za.js → file-type-icon-ByhQy2rW.js} +1 -1
  93. package/dist/client/assets/{files-Bp_B54JG.js → files-CGUJegiW.js} +1 -1
  94. package/dist/client/assets/{form-C_FOfVah.js → form-DzqpARCW.js} +1 -1
  95. package/dist/client/assets/{general-Dwpcwhzc.js → general-BaZ3r2GW.js} +1 -1
  96. package/dist/client/assets/{generate-id-CQZwmjfI.js → generate-id-DCN1LrlB.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-Cd_kXw_v.js → github-repo-picker-DifHpnDV.js} +1 -1
  98. package/dist/client/assets/{header-tab-button-yQ_OLTia.js → header-tab-button-CyQ_CUpS.js} +1 -1
  99. package/dist/client/assets/{hover-card-CHj7OURi.js → hover-card-fQ5zGcbl.js} +1 -1
  100. package/dist/client/assets/{image-field-D7PJzfsZ.js → image-field-_Av_lLAg.js} +1 -1
  101. package/dist/client/assets/{index-Cvm5sLsh.js → index--VFF-Fa0.js} +1 -1
  102. package/dist/client/assets/{index-fYs9lCK5.js → index-0pKQiQw5.js} +4 -4
  103. package/dist/client/assets/{index-D0AW3RJr.js → index-Bkgvp8b5.js} +1 -1
  104. package/dist/client/assets/{index-bcXz_XDV.js → index-BlbwvYId.js} +1 -1
  105. package/dist/client/assets/{index-CR5thpY0.js → index-Brb5zXrs.js} +1 -1
  106. package/dist/client/assets/{index-Dw2PpfWw.js → index-CDPDznJw.js} +1 -1
  107. package/dist/client/assets/{index-C93oJ98C.js → index-CDa8r-Ay.js} +1 -1
  108. package/dist/client/assets/index-CXYYh-WP.js +1 -0
  109. package/dist/client/assets/{index-CXrzfY3D.js → index-D3IoOs9k.js} +1 -1
  110. package/dist/client/assets/{index-CVroQ5fV.js → index-D7vPwljU.js} +1 -1
  111. package/dist/client/assets/index-D_v0xAjK.js +8 -0
  112. package/dist/client/assets/{index-DHxOddsj.js → index-DjCrtoJM.js} +3 -3
  113. package/dist/client/assets/{index-DhrBeRkU.js → index-H-an7LFa.js} +1 -1
  114. package/dist/client/assets/{index-DdL0ZJ74.js → index-grq1eXi6.js} +1 -1
  115. package/dist/client/assets/{index-redirect-CNjnlL2S.js → index-redirect-DtYqdHDy.js} +1 -1
  116. package/dist/client/assets/index-snZrdd2U.js +1 -0
  117. package/dist/client/assets/{input-C3YblD3D.js → input-odGTsdHi.js} +1 -1
  118. package/dist/client/assets/{integration-icon-DNnbE81S.js → integration-icon-CYVpZTf5.js} +1 -1
  119. package/dist/client/assets/{label-g7a72jJD.js → label-CO8q2BMX.js} +1 -1
  120. package/dist/client/assets/{layout-Bac2NmXP.js → layout-mA5Rj_u2.js} +1 -1
  121. package/dist/client/assets/{login-Dy8BMo_0.js → login-BdTiL4Ph.js} +1 -1
  122. package/dist/client/assets/{members-DnAomETO.js → members-K2LSrSOy.js} +1 -1
  123. package/dist/client/assets/monaco-editor-DKpM33ac.js +9 -0
  124. package/dist/client/assets/{monitoring-stats-row-BXLdNMMZ.js → monitoring-stats-row-C1HQhYEp.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-1VcaC9dS.js → oauth-callback-RCth5FgJ.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-MiK5yD8w.js → oauth-callback-ai-provider-Bx_f4SNv.js} +1 -1
  127. package/dist/client/assets/{onboarding-BGq8QKH-.js → onboarding-Cw0yv-ax.js} +1 -1
  128. package/dist/client/assets/{org-install-DZd3jGKm.js → org-install-C5oIAlaU.js} +1 -1
  129. package/dist/client/assets/{org-layout-BsR_SirN.js → org-layout-AJN3IVEY.js} +1 -1
  130. package/dist/client/assets/{org-plugin-layout-DiqJAM1g.js → org-plugin-layout-DeLJrvoA.js} +1 -1
  131. package/dist/client/assets/{page-seo-form-D30yiy8Q.js → page-seo-form-2v7yqwmW.js} +1 -1
  132. package/dist/client/assets/page-seo-sheet-DEYwDlV3.js +1 -0
  133. package/dist/client/assets/{pair-CV7DGW5V.js → pair-C9I7jtDw.js} +6 -6
  134. package/dist/client/assets/{plugin-empty-state-rraryswS.js → plugin-empty-state-BllJH9a8.js} +1 -1
  135. package/dist/client/assets/{plugin-header-B1uUxTrr.js → plugin-header-pbmKrc1L.js} +1 -1
  136. package/dist/client/assets/{plugin-layout-DmiyMdB_.js → plugin-layout-DRXLQokx.js} +1 -1
  137. package/dist/client/assets/{popover-8cVh6gq0.js → popover-ChUM3TFy.js} +1 -1
  138. package/dist/client/assets/{post-editor-C7P1dXNH.js → post-editor-DBJSrVd6.js} +2 -2
  139. package/dist/client/assets/{primitives-BsgolKyl.js → primitives-CDySgipF.js} +1 -1
  140. package/dist/client/assets/{profile-D4w-Z3ol.js → profile-C7vJk0Kt.js} +1 -1
  141. package/dist/client/assets/project-app-view-iV-1n2vK.js +1 -0
  142. package/dist/client/assets/record-editor-bmEKAE4B.js +1 -0
  143. package/dist/client/assets/registry-CT2kzs1z.js +2 -0
  144. package/dist/client/assets/registry-layout-CBGi99kW.js +27 -0
  145. package/dist/client/assets/{require-capability-skg99hPH.js → require-capability-XeIce_Pd.js} +1 -1
  146. package/dist/client/assets/{required-auth-layout-Cidb--Hk.js → required-auth-layout-BBVKG7Ms.js} +1 -1
  147. package/dist/client/assets/{reset-password-CNhRvj5g.js → reset-password-CZ2_k_ln.js} +1 -1
  148. package/dist/client/assets/{resizable-BT48Uzms.js → resizable-DYZX4GYZ.js} +1 -1
  149. package/dist/client/assets/roles-eO3gNPsn.js +1 -0
  150. package/dist/client/assets/save-referenced-block-erNAPeZK.js +1 -0
  151. package/dist/client/assets/{save-status-DsIS1sld.js → save-status-DGCu0Kou.js} +1 -1
  152. package/dist/client/assets/{schema-form-oJE4kcAX.js → schema-form-CnMZQoIC.js} +1 -1
  153. package/dist/client/assets/{scroll-area-D2NfEZKG.js → scroll-area-D-xuBg8S.js} +1 -1
  154. package/dist/client/assets/{search-input-wg0ktmKr.js → search-input-BOFnCDgB.js} +1 -1
  155. package/dist/client/assets/{secrets-YPZEWZE9.js → secrets-BLYQN7Zp.js} +1 -1
  156. package/dist/client/assets/{sections-editor-CDk8QiTt.js → sections-editor-BFS_rZo4.js} +2 -2
  157. package/dist/client/assets/{select-LvZkQCcv.js → select-B1gidrpT.js} +1 -1
  158. package/dist/client/assets/{select-model-Bvdn_l3a.js → select-model-CCz1D052.js} +1 -1
  159. package/dist/client/assets/seo-editor-ClvdYMyV.js +1 -0
  160. package/dist/client/assets/{settings-layout-Cn8PAm-f.js → settings-layout-ParxM_Ja.js} +1 -1
  161. package/dist/client/assets/{settings-section-BiebCtcC.js → settings-section-DDBr5t6q.js} +1 -1
  162. package/dist/client/assets/{sheet-4GES45T2.js → sheet-BwcUAu7J.js} +1 -1
  163. package/dist/client/assets/{shell-controls-pFVNS2Vn.js → shell-controls-a5C7q3sv.js} +1 -1
  164. package/dist/client/assets/{shell-layout-DtkuyxW9.js → shell-layout-jPbG1TxD.js} +1 -1
  165. package/dist/client/assets/shell-route-loading-CrwP7Moq.js +1 -0
  166. package/dist/client/assets/{sidebar-BY-0S2nV.js → sidebar-D0YkKw2Q.js} +1 -1
  167. package/dist/client/assets/{skeleton-B2rX4p4v.js → skeleton-BnLuwQl0.js} +1 -1
  168. package/dist/client/assets/{sortable.esm-C0tZpwHI.js → sortable.esm-DHNuKLSF.js} +1 -1
  169. package/dist/client/assets/{spinner-WtoCvpNX.js → spinner-C_dp5faG.js} +1 -1
  170. package/dist/client/assets/{sso-4MYeJHQK.js → sso-Dv0vfQwF.js} +1 -1
  171. package/dist/client/assets/{store-BTeo8TpT.js → store-CzOlrmK7.js} +1 -1
  172. package/dist/client/assets/store-registry-BBiSNL3g.js +2 -0
  173. package/dist/client/assets/{studio-tools-CH7dZ7HT.js → studio-tools-C1zamUp1.js} +1 -1
  174. package/dist/client/assets/{switch-BOtiDaPh.js → switch-Co2WNb8L.js} +1 -1
  175. package/dist/client/assets/{tab-id-DaQY5Du1.js → tab-id-Br9ttHTZ.js} +1 -1
  176. package/dist/client/assets/{table-kq85oeWE.js → table-DXm5sFe0.js} +1 -1
  177. package/dist/client/assets/{tabs-D_XRbq3N.js → tabs-Bhgl3qMn.js} +1 -1
  178. package/dist/client/assets/{task-status-BlpPmTT-.js → task-status-BYl9XRWC.js} +1 -1
  179. package/dist/client/assets/{textarea-CxRmk2pV.js → textarea-DkHK4zFC.js} +1 -1
  180. package/dist/client/assets/{toggle-group-B_ZhC8rH.js → toggle-group-i9f6SFf7.js} +1 -1
  181. package/dist/client/assets/{toolbar-BptUton3.js → toolbar-CJqhxN0I.js} +1 -1
  182. package/dist/client/assets/{tools-list-BXxC0BJ6.js → tools-list-C1LX0lcn.js} +1 -1
  183. package/dist/client/assets/{tooltip-6OktDyzD.js → tooltip-MvXJgTec.js} +1 -1
  184. package/dist/client/assets/{types-k3mlT_jb.js → types-B5hLLDbz.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-Czs3LwMV.js → use-ai-providers-BsaGHbRZ.js} +1 -1
  186. package/dist/client/assets/{use-automations-6FHnA6mT.js → use-automations-CsEWrXaA.js} +1 -1
  187. package/dist/client/assets/{use-capability-B2GMKCxl.js → use-capability-COL6vTbP.js} +1 -1
  188. package/dist/client/assets/{use-clock-tick-DRfafiJJ.js → use-clock-tick-DOOx6g7A.js} +1 -1
  189. package/dist/client/assets/{use-collections-3gcbdMo5.js → use-collections-BTo2RzuF.js} +1 -1
  190. package/dist/client/assets/{use-connection-Cygt3JAU.js → use-connection-C7K5Qf-S.js} +1 -1
  191. package/dist/client/assets/{use-copy-BzO5OLbn.js → use-copy-CGrsfbTf.js} +1 -1
  192. package/dist/client/assets/{use-create-virtual-mcp-BJIgmNjf.js → use-create-virtual-mcp-D9KVCrT1.js} +1 -1
  193. package/dist/client/assets/{use-debounced-autosave-rTdfYQSA.js → use-debounced-autosave-6YBhwe_F.js} +1 -1
  194. package/dist/client/assets/{use-delete-connection-BwHDAibo.js → use-delete-connection-BfZlr78w.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-C_uUU82K.js → use-file-configs-2cFOqoXA.js} +1 -1
  196. package/dist/client/assets/use-infinite-scroll-CHxQ8pHV.js +1 -0
  197. package/dist/client/assets/{use-list-state-CAT0PD89.js → use-list-state-ohTb0Oa4.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-Bbkq-Btq.js → use-mcp-client-Wf5qUXFF.js} +1 -1
  199. package/dist/client/assets/{use-mcp-prompts-C2IR7B-B.js → use-mcp-prompts-C3LVS9Ph.js} +1 -1
  200. package/dist/client/assets/{use-mcp-tools-BiO0x3bS.js → use-mcp-tools-CHOFkJhf.js} +1 -1
  201. package/dist/client/assets/{use-members-Ct7TKvLy.js → use-members-DPGvEZAM.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-7jnPTeCV.js → use-navigate-to-agent-Cyv38GW6.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-DwSMx4xq.js → use-org-auth-client-DEFpPA_h.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-HULZXLZY.js → use-org-sso-DXk1g-4_.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-C24SP1RJ.js → use-organization-roles-CgzLzx7m.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-6ykeD7wG.js → use-organization-settings-DYscqYOA.js} +1 -1
  207. package/dist/client/assets/{use-registry-connections-Cw0Uu9HN.js → use-registry-connections-BWH6CWaF.js} +1 -1
  208. package/dist/client/assets/{use-secrets-Dn7Z2olr.js → use-secrets-C2K4Jrkd.js} +1 -1
  209. package/dist/client/assets/{use-status-sounds-BMl-h7wF.js → use-status-sounds-CFQ4LNhs.js} +1 -1
  210. package/dist/client/assets/{use-view-mode-DS8kaEq4.js → use-view-mode-Dg3ZmYU0.js} +1 -1
  211. package/dist/client/assets/{use-virtual-mcp-C6pMpGrR.js → use-virtual-mcp-3Wk6GVmY.js} +1 -1
  212. package/dist/client/assets/useInfiniteQuery-DiweShIv.js +1 -0
  213. package/dist/client/assets/{useRouterState-Dnb9kW5z.js → useRouterState-DyL85Esh.js} +1 -1
  214. package/dist/client/assets/useSuspenseInfiniteQuery-BHYoMCUL.js +1 -0
  215. package/dist/client/assets/{user-TO91q8is.js → user-CNkzK1zV.js} +1 -1
  216. package/dist/client/assets/{view-mode-toggle-X2TTOWIg.js → view-mode-toggle-Do2GCdol.js} +1 -1
  217. package/dist/client/assets/{watch-sse-pool-CuN8_Ws2.js → watch-sse-pool-WsArg2kN.js} +1 -1
  218. package/dist/client/assets/{workflow-Bof_Hi_L.js → workflow-C2UTibro.js} +1 -1
  219. package/dist/client/assets/workflow-detail-B3lltIYe.js +1 -0
  220. package/dist/client/index.html +1 -1
  221. package/dist/server/cli.js +387 -387
  222. package/dist/server/migrate.js +52 -52
  223. package/dist/server/server.js +265 -265
  224. package/package.json +1 -1
  225. package/dist/client/assets/add-section-modal-BEtlbcy-.js +0 -1
  226. package/dist/client/assets/agent-capabilities-CFuGvMed.js +0 -3
  227. package/dist/client/assets/app-editor-DqK_iwlT.js +0 -1
  228. package/dist/client/assets/connections-DzNM9iR8.js +0 -1
  229. package/dist/client/assets/decopilot-sse-pool-8baykh62.js +0 -1
  230. package/dist/client/assets/file-explorer-Bm3G3AJO.js +0 -2
  231. package/dist/client/assets/index-Bq-oI4jf.js +0 -8
  232. package/dist/client/assets/index-DeWy5Ckp.js +0 -1
  233. package/dist/client/assets/index-jA2TneF4.js +0 -1
  234. package/dist/client/assets/infiniteQueryObserver-Da-l1Mrb.js +0 -1
  235. package/dist/client/assets/monaco-editor-CVjkFUXK.js +0 -9
  236. package/dist/client/assets/page-seo-sheet-DHjVYqZY.js +0 -1
  237. package/dist/client/assets/project-app-view-MmHyDgpb.js +0 -1
  238. package/dist/client/assets/record-editor-LCb43Ehs.js +0 -1
  239. package/dist/client/assets/registry-DRQ1oW7y.js +0 -2
  240. package/dist/client/assets/registry-layout-C-3QWp3D.js +0 -27
  241. package/dist/client/assets/roles-9lGr_fMG.js +0 -1
  242. package/dist/client/assets/save-referenced-block-Uk3HPmEZ.js +0 -1
  243. package/dist/client/assets/seo-editor-CZ4NCpV7.js +0 -1
  244. package/dist/client/assets/shell-route-loading-B6fsTD_h.js +0 -1
  245. package/dist/client/assets/store-registry-B8aDVYEg.js +0 -2
  246. package/dist/client/assets/use-infinite-scroll-D7Lz32GP.js +0 -1
  247. package/dist/client/assets/useInfiniteQuery-DnxNK7B2.js +0 -1
  248. package/dist/client/assets/useSuspenseInfiniteQuery-Bdpr4GcQ.js +0 -1
  249. package/dist/client/assets/workflow-detail-xblJkXWm.js +0 -1
@@ -0,0 +1 @@
1
+ import{e as N,c as K,j as s,l as Vt,r as T,t as Z,q as fe,b as Ce,X as Ss,K as Wt,n as qt,f as Oe,g as Ns,d as Dn,P as En,Y as Fn,Z as Gn,T as Ln,W as Bn,I as Hn,H as Un,a as Kn,B as $t,$ as Vn,a0 as Wn,o as Ae,a1 as qn,a2 as Yn,a3 as Xn,G as Qn,a4 as Zn,a5 as Jn,a6 as er,a7 as tr,a8 as xt,a9 as sr,aa as nr,ab as rr,ac as or,ad as ir,ae as lr,af as Cs,ag as ar,ah as cr,ai as dr,aj as ur,ak as mr,al as fr,am as xr,an as pr,ao as hr,ap as gr,aq as br,p as jr,E as ws}from"./index-DjCrtoJM.js";import{u as vr}from"./useRouterState-DyL85Esh.js";import{c as yr,i as _r,a as Sr}from"./ZoomOut-BP5vTMyD.js";import{u as Xe,c as xe,d as ke,e as Pt,f as zt,g as $e,h as ks,i as Is,j as Nr,k as Cr,l as Bt}from"./sidebar-D0YkKw2Q.js";import{T as we}from"./toolbar-CJqhxN0I.js";import{u as Ms,T as Ve,a as We,b as qe,c as ts}from"./tooltip-MvXJgTec.js";import{S as Se}from"./skeleton-BnLuwQl0.js";import{P as Rt,a as ut,b as Dt}from"./popover-ChUM3TFy.js";import{b as As,a as $s,D as Ts}from"./drawer-C8AwBmXm.js";import{i as Os}from"./SearchMd-Dq0euRWv.js";import{s as wr}from"./Star01-ChWAyIjY.js";import{s as Ne}from"./Plus-DrYyBDmj.js";import{i as kr,a as Ps,u as zs,g as Ir}from"./use-mcp-client-Wf5qUXFF.js";import{a as Rs,u as pt,b as Mr}from"./use-virtual-mcp-3Wk6GVmY.js";import{u as Ar}from"./use-create-virtual-mcp-D9KVCrT1.js";import{I as $r,a as Tr,u as Or,W as Pr,H as zr,S as Rr,G as Dr}from"./github-repo-picker-DifHpnDV.js";import{A as Te,W as ss,X as ns,Y as Ds,Z as Er,_ as Fr,$ as Gr}from"./agent-icon-DbC1U9Lv.js";import{u as Es,d as Lr,k as Fs}from"./tab-id-Br9ttHTZ.js";import{r as Br,a as Hr,R as Ur,b as Kr,u as Gs}from"./shell-layout-jPbG1TxD.js";import{u as Vr,a as Wr,b as qr,s as Yr,c as Xr,r as Qr,d as Zr,e as Jr,f as eo,p as to,T as Ls,g as so,h as no,i as ro,j as oo,k as io,l as lo,m as ao,n as co,S as rs,o as Bs}from"./use-navigate-to-agent-Cyv38GW6.js";import{A as os}from"./avatar-Glcqg-C7.js";import{i as Hs}from"./Check-CkY-NLLZ.js";import{a as is}from"./Eye-Co-ItdFE.js";import{n as uo,i as mo}from"./Globe01-BnLBFtky.js";import{i as fo,a as Us}from"./ZapSquare-DdYqdyu4.js";import{i as xo}from"./Monitor01-5IIvvy6H.js";import{n as po,a as ho}from"./Sun-BIJajZBA.js";import{a as ht}from"./Settings02-B_z2JeIq.js";import{i as go}from"./Shield01-Dmf7TklI.js";import{a as bo}from"./Users03-Dc2Q2YCx.js";import{s as Ks}from"./XClose-D4SdKRIc.js";import{f as jo,a as vo,b as yo,c as _o,d as So,e as No,A as Co}from"./alert-dialog-CstddcEP.js";import{F as wo,a as ko,b as Io,c as Mo,d as Ao,e as $o,f as To}from"./form-DzqpARCW.js";import{I as Oo}from"./input-odGTsdHi.js";import{S as Po}from"./spinner-C_dp5faG.js";import"./index-Bkgvp8b5.js";import{i as zo,a as Ro}from"./RefreshCcw01-eSV0Gr10.js";import{n as Yt}from"./Stars02-WR3K9Daq.js";import{A as Vs,g as Do,u as Eo,a as ls,K as Fo,P as Go,s as Lo,S as Bo,v as Ho,D as Uo,c as Ko,b as Vo,C as Wo}from"./sortable.esm-DHNuKLSF.js";import{i as Xt}from"./ChevronRight-BJRYs8bt.js";import{u as Ws}from"./use-mcp-tools-CHOFkJhf.js";import{u as qs}from"./use-ai-providers-BsaGHbRZ.js";import{i as qo}from"./FilterLines-DwPmuK2v.js";import{t as Yo}from"./Users01-3QXDJ7kM.js";import{b as as,c as Ys,S as cs,a as ds,d as us}from"./select-B1gidrpT.js";import{b as Xo,c as Qo,e as Zo,a as Jo,D as ei}from"./dialog-B4Gk40Ec.js";import{C as ti,e as si,c as ni,d as ri,b as oi}from"./command-Dm1ALJPS.js";import{u as Xs}from"./studio-tools-C1zamUp1.js";import{i as Qs}from"./Zap-DAhQN3Qe.js";import{u as ii}from"./use-org-auth-client-DEFpPA_h.js";import{H as li,a as ai,b as ci}from"./hover-card-fQ5zGcbl.js";import{g as di,S as ui}from"./task-status-BYl9XRWC.js";import{u as mi,f as fi}from"./use-clock-tick-DOOx6g7A.js";import{t as Zs}from"./ChevronDown-B8XrNXeE.js";function xi(t){const e=N.c(21),{value:n,onChange:r,placeholder:o,onKeyDown:i,className:l,isSearching:a,disabled:c}=t,d=o===void 0?"Search...":o;let u;e[0]!==l?(u=K("shrink-0 w-full border-b border-border h-12",l),e[0]=l,e[1]=u):u=e[1];const m=c?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==m?(f=K("flex items-center gap-2.5 h-12 px-4",m),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a?(g=a?s.jsx(Vt,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(Os,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=g):g=e[5];let h;e[6]!==r?(h=j=>r(j.target.value),e[6]=r,e[7]=h):h=e[7];let x;e[8]!==c||e[9]!==i||e[10]!==d||e[11]!==h||e[12]!==n?(x=s.jsx("input",{type:"text",value:n,onChange:h,onKeyDown:i,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=i,e[10]=d,e[11]=h,e[12]=n,e[13]=x):x=e[13];let p;e[14]!==f||e[15]!==g||e[16]!==x?(p=s.jsxs("label",{className:f,children:[g,x]}),e[14]=f,e[15]=g,e[16]=x,e[17]=p):p=e[17];let b;return e[18]!==u||e[19]!==p?(b=s.jsx("div",{className:u,children:p}),e[18]=u,e[19]=p,e[20]=b):b=e[20],b}const pi="Select an existing agent";function hi(t){const e=N.c(5),{children:n}=t;let r;e[0]!==n?(r=s.jsx(Ve,{asChild:!0,children:n}),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(We,{side:"right",sideOffset:8,children:pi}),e[2]=o):o=e[2];let i;return e[3]!==r?(i=s.jsxs(qe,{defaultOpen:!0,delayDuration:0,children:[r,o]}),e[3]=r,e[4]=i):i=e[4],i}function gi(){const t=N.c(5),{enableDecoImport:e}=Ss(),{data:n}=Ce.useSession();let r;t[0]!==n?.user?.email?(r=Wt.decoProfile(n?.user?.email),t[0]=n?.user?.email,t[1]=r):r=t[1];const o=!!e&&!!n?.user?.email;let i;t[2]!==r||t[3]!==o?(i={queryKey:r,queryFn:bi,enabled:o,staleTime:3e5},t[2]=r,t[3]=o,t[4]=i):i=t[4];const{data:l}=qt(i);return l?.isDecoUser??!1}async function bi(){const t=await fetch("/api/deco-sites/profile");return t.ok?t.json():{isDecoUser:!1}}function ji(t){const e=Oe(),{create:n}=Es(),{locator:r}=fe(),o=Ns({strict:!1}),i=Dn({strict:!1});return async l=>{const a=crypto.randomUUID(),c=l===i.virtualmcpid?Br(t,r,o.taskId??""):null;try{await n({id:a,virtual_mcp_id:l,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:l}})}}function vi(t){const e=N.c(9),{agent:n,onClick:r}=t;let o;e[0]!==n.icon||e[1]!==n.title?(o=s.jsx(Te,{icon:n.icon,name:n.title,size:"md",className:"transition-transform group-hover:scale-105"}),e[0]=n.icon,e[1]=n.title,e[2]=o):o=e[2];let i;e[3]!==n.title?(i=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground line-clamp-2 w-full",children:n.title}),e[3]=n.title,e[4]=i):i=e[4];let l;return e[5]!==r||e[6]!==o||e[7]!==i?(l=s.jsxs("button",{type:"button",onClick:r,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[o,i]}),e[5]=r,e[6]=o,e[7]=i,e[8]=l):l=e[8],l}function yi(t){const e=N.c(65),{onClose:n,onOpenImportDeco:r,onOpenGithubImport:o}=t,[i,l]=T.useState(""),a=Rs(),{org:c}=fe(),{data:d}=Ce.useSession(),u=d?.user?.id??"anon",m=a.filter(Ni).map(Si),f=Wr();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={navigateOnCreate:!0},e[0]=g):g=e[0];const{createVirtualMCP:h,isCreating:x}=Ar(g),{createFromTemplate:p,isCreating:b}=Or(),j=gi(),y=ji(c.slug),v=i.toLowerCase(),_=a.filter(_i).filter(le=>!i||le.title.toLowerCase().includes(v)),k=le=>{qr({orgId:c.id,userId:u},le.id,m),f(),n(),l(""),y(le.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let C;e[1]!==i?(C=s.jsx(xi,{value:i,onChange:l,placeholder:"Search agents..."}),e[1]=i,e[2]=C):C=e[2];const I="overflow-y-auto flex-1 min-h-0 px-3 pb-3";let A;e[3]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("div",{className:"px-1 pt-3 pb-2",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Agents"})}),e[3]=A):A=e[3];const z="grid grid-cols-3 gap-1";let $;e[4]!==h||e[5]!==n?($=async()=>{Z("agent_create_new_clicked",{source:"browse_popover"}),await h(),n()},e[4]=h,e[5]=n,e[6]=$):$=e[6];let w,P;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(Ne,{size:16,className:"text-muted-foreground"})}),P=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Create new"}),e[7]=w,e[8]=P):(w=e[7],P=e[8]);let H;e[9]!==x||e[10]!==$?(H=s.jsxs("button",{type:"button",disabled:x,onClick:$,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[w,P]}),e[9]=x,e[10]=$,e[11]=H):H=e[11];let O;e[12]!==p||e[13]!==n?(O=async()=>{Z("agent_create_clicked",{source:"browse_popover",method:"website"}),await p(Pr),n()},e[12]=p,e[13]=n,e[14]=O):O=e[14];let L,R;e[15]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(wr,{className:"size-5 text-muted-foreground"})}),R=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Start Website"}),e[15]=L,e[16]=R):(L=e[15],R=e[16]);let B;e[17]!==b||e[18]!==O?(B=s.jsxs("button",{type:"button",disabled:b,onClick:O,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[L,R]}),e[17]=b,e[18]=O,e[19]=B):B=e[19];let D;e[20]!==p||e[21]!==n?(D=async()=>{Z("agent_create_clicked",{source:"browse_popover",method:"hydrogen"}),await p(zr),n()},e[20]=p,e[21]=n,e[22]=D):D=e[22];let G,F;e[23]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx("img",{src:Rr,alt:"",className:"size-5 object-contain"})}),F=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Shopify Headless Store"}),e[23]=G,e[24]=F):(G=e[23],F=e[24]);let E;e[25]!==b||e[26]!==D?(E=s.jsxs("button",{type:"button",disabled:b,onClick:D,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[G,F]}),e[25]=b,e[26]=D,e[27]=E):E=e[27];let V;e[28]!==n||e[29]!==o?(V=()=>{Z("agent_import_clicked",{source:"github"}),o(),n()},e[28]=n,e[29]=o,e[30]=V):V=e[30];let W,X;e[31]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(Dr,{className:"size-5 text-muted-foreground"})}),X=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import GitHub"}),e[31]=W,e[32]=X):(W=e[31],X=e[32]);let re;e[33]!==V?(re=s.jsxs("button",{type:"button",onClick:V,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[W,X]}),e[33]=V,e[34]=re):re=e[34];let Y;e[35]!==j||e[36]!==n||e[37]!==r?(Y=j&&s.jsxs("button",{type:"button",onClick:()=>{Z("agent_import_clicked",{source:"deco"}),r(),n()},className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"",className:"size-5 object-contain"})}),s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import deco.cx"})]}),e[35]=j,e[36]=n,e[37]=r,e[38]=Y):Y=e[38];const oe=_.map(le=>s.jsx(vi,{agent:le,onClick:()=>k(le)},le.id));let q;e[39]!==H||e[40]!==B||e[41]!==E||e[42]!==re||e[43]!==Y||e[44]!==oe?(q=s.jsxs("div",{className:z,children:[H,B,E,re,Y,oe]}),e[39]=H,e[40]=B,e[41]=E,e[42]=re,e[43]=Y,e[44]=oe,e[45]=q):q=e[45];let J;e[46]!==x||e[47]!==i||e[48]!==_.length?(J=_.length===0&&!x&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:i?"No agents found":"No agents yet"}),e[46]=x,e[47]=i,e[48]=_.length,e[49]=J):J=e[49];let Q;e[50]!==q||e[51]!==J||e[52]!==A?(Q=s.jsxs("div",{className:I,children:[A,q,J]}),e[50]=q,e[51]=J,e[52]=A,e[53]=Q):Q=e[53];let ee;e[54]!==c.slug?(ee={org:c.slug},e[54]=c.slug,e[55]=ee):ee=e[55];let te;e[56]!==n?(te=()=>n(),e[56]=n,e[57]=te):te=e[57];let se;e[58]!==ee||e[59]!==te?(se=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(En,{to:"/$org/settings/agents",params:ee,onClick:te,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[58]=ee,e[59]=te,e[60]=se):se=e[60];let ie;return e[61]!==Q||e[62]!==C||e[63]!==se?(ie=s.jsxs("div",{className:S,children:[C,Q,se]}),e[61]=Q,e[62]=C,e[63]=se,e[64]=ie):ie=e[64],ie}function _i(t){return!kr(t.id)}function Si(t){return t.id}function Ni(t){return t.pinned}function Js(t){const e=N.c(26);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:r}=n,o=r===void 0?!1:r,[i,l]=T.useState(!1),[a,c]=T.useState(!1),[d,u]=T.useState(!1),m=Ms(),{setOpenMobile:f}=Xe(),g=Vr(),h=g?"border border-border":void 0;let x;e[2]!==g?(x=I=>g?s.jsx(hi,{children:I}):I,e[2]=g,e[3]=x):x=e[3];const p=x;let b;e[4]!==m||e[5]!==f?(b=()=>{l(!1),m&&f(!1)},e[4]=m,e[5]=f,e[6]=b):b=e[6];const j=b;let y;e[7]!==j||e[8]!==i?(y=i&&s.jsx(T.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Se,{className:"h-4 w-24"})}),children:s.jsx(yi,{onClose:j,onOpenImportDeco:()=>c(!0),onOpenGithubImport:()=>{u(!0),j()}})}),e[7]=j,e[8]=i,e[9]=y):y=e[9];const v=y;let _;e[10]!==o||e[11]!==h||e[12]!==g||e[13]!==m||e[14]!==i||e[15]!==v||e[16]!==p?(_=m?s.jsxs(s.Fragment,{children:[o?p(s.jsx(we,{"aria-label":"Browse agents",className:K(h),onClick:()=>{Z("agent_browser_opened",{surface:"mobile_drawer"}),l(!0)},children:s.jsx(Ne,{className:"size-4"})})):s.jsx(xe,{children:p(s.jsxs(ke,{tooltip:g?void 0:"Browse agents",className:K(h),onClick:()=>{Z("agent_browser_opened",{surface:"mobile_drawer"}),l(!0)},children:[s.jsx(Ne,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(As,{open:i,onOpenChange:l,direction:"bottom",children:s.jsxs($s,{className:"max-h-[85dvh] p-0",children:[s.jsx(Ts,{className:"sr-only",children:"Browse agents"}),v]})})]}):s.jsxs(Rt,{open:i,onOpenChange:I=>{I&&!i&&Z("agent_browser_opened",{surface:"desktop_popover"}),l(I)},children:[o?p(s.jsx(ut,{asChild:!0,children:s.jsx(we,{"aria-label":"Browse agents",className:K(h),children:s.jsx(Ne,{className:"size-4"})})})):s.jsx(xe,{children:p(s.jsx(ut,{asChild:!0,children:s.jsxs(ke,{tooltip:g?void 0:"Browse agents",className:K(h),children:[s.jsx(Ne,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Dt,{className:"w-[380px] p-0 overflow-hidden",side:"right",align:"start",children:v})]}),e[10]=o,e[11]=h,e[12]=g,e[13]=m,e[14]=i,e[15]=v,e[16]=p,e[17]=_):_=e[17];let k;e[18]!==a?(k=s.jsx($r,{open:a,onOpenChange:c}),e[18]=a,e[19]=k):k=e[19];let S;e[20]!==d?(S=s.jsx(Tr,{open:d,onOpenChange:u}),e[20]=d,e[21]=S):S=e[21];let C;return e[22]!==_||e[23]!==k||e[24]!==S?(C=s.jsxs(s.Fragment,{children:[_,k,S]}),e[22]=_,e[23]=k,e[24]=S,e[25]=C):C=e[25],C}function en(){const t=N.c(24),{org:e}=fe(),n=Oe(),o=vr().location.pathname,i=e.slug,{state:l,isMobile:a}=Xe(),c=!a&&l==="collapsed";let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yr,{className:"size-4!"}),t[0]=d):d=t[0];const u=o===`/${i}`||o===`/${i}/`;let m;t[1]!==n||t[2]!==i?(m=()=>{n({to:"/$org",params:{org:i}})},t[1]=n,t[2]=i,t[3]=m):m=t[3];let f;t[4]!==u||t[5]!==m?(f={key:"home",label:"Home",icon:d,isActive:u,onClick:m},t[4]=u,t[5]=m,t[6]=f):f=t[6];const g=f;let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(_r,{className:"size-4!"}),t[7]=h):h=t[7];let x;t[8]!==o||t[9]!==i?(x=o.startsWith(`/${i}/files`),t[8]=o,t[9]=i,t[10]=x):x=t[10];let p;t[11]!==n||t[12]!==i?(p=()=>{n({to:"/$org/files",params:{org:i}})},t[11]=n,t[12]=i,t[13]=p):p=t[13];let b;t[14]!==x||t[15]!==p?(b={key:"files",label:"Library",icon:h,isActive:x,onClick:p},t[14]=x,t[15]=p,t[16]=b):b=t[16];const j=b;let y;t[17]!==j||t[18]!==g?(y={type:"items",items:[g,j]},t[17]=j,t[18]=g,t[19]=y):y=t[19];let v;if(t[20]!==c||t[21]!==y){if(v=[y],c){let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_={type:"custom",key:"new-task",content:s.jsx(Pt,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(zt,{children:s.jsx($e,{className:"gap-1.5",children:s.jsx(Js,{})})})})},t[23]=_):_=t[23],v.push(_)}t[20]=c,t[21]=y,t[22]=v}else v=t[22];return v}function Tt(t){const e=N.c(12);let n,r,o,i;e[0]!==t?({className:n,orientation:o,decorative:i,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i):(n=e[1],r=e[2],o=e[3],i=e[4]);const l=o===void 0?"horizontal":o,a=i===void 0?!0:i;let c;e[5]!==n?(c=K("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",n),e[5]=n,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==c?(d=s.jsx(Fn,{"data-slot":"separator-root",decorative:a,orientation:l,className:c,...r}),e[7]=a,e[8]=l,e[9]=r,e[10]=c,e[11]=d):d=e[11],d}function tn(t){const e=N.c(3),{children:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=r):r=e[0];let o;return e[1]!==n?(o=s.jsxs(Pt,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[r,s.jsx(zt,{children:s.jsx($e,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=o):o=e[2],o}function sn(t){const e=N.c(18),{item:n}=t,{isMobile:r,setOpenMobile:o}=Xe();let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=()=>{Z("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:r}),n.onClick?.(),r&&o(!1)},e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const l=i,a=n.key,c=n.isActive&&"z-10";let d;e[4]!==c?(d=K(c),e[4]=c,e[5]=d):d=e[5];let u;e[6]!==n.label?(u=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=u):u=e[7];let m;e[8]!==l||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==u?(m=s.jsxs(ke,{onClick:l,isActive:n.isActive,tooltip:n.label,children:[n.icon,u]}),e[8]=l,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=u,e[13]=m):m=e[13];let f;return e[14]!==n.key||e[15]!==d||e[16]!==m?(f=s.jsx(xe,{className:d,children:m},a),e[14]=n.key,e[15]=d,e[16]=m,e[17]=f):f=e[17],f}function Ci(t){const e=N.c(12),{section:n}=t;switch(n.type){case"divider":{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ks,{className:"my-2"}),e[0]=r):r=e[0],r}case"spacer":{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex-1"}),e[1]=r):r=e[1],r}case"group":{const r=n.group.label,o=n.group.defaultExpanded;let i;e[2]!==n.group.items?(i=n.group.items.map(ki),e[2]=n.group.items,e[3]=i):i=e[3];let l;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==i?(l=s.jsx(tn,{label:r,defaultExpanded:o,children:i}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=i,e[7]=l):l=e[7],l}case"items":{let r;e[8]!==n.items?(r=n.items.map(wi),e[8]=n.items,e[9]=r):r=e[9];let o;return e[10]!==r?(o=s.jsx(Pt,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(zt,{children:s.jsx($e,{className:"gap-1.5",children:r})})}),e[10]=r,e[11]=o):o=e[11],o}case"custom":return n.content}}function wi(t){return s.jsx(sn,{item:t},t.key)}function ki(t){return s.jsx(sn,{item:t},t.key)}function Ii(t){const e=N.c(14),{sections:n,footer:r,additionalContent:o,variant:i,contentClassName:l}=t,a=i===void 0?"sidebar":i;let c;e[0]!==l?(c=K("flex flex-col flex-1 px-2 py-2 gap-0.5",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==n?(d=n.map(Mi),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==o?(u=o&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:o}),e[4]=o,e[5]=u):u=e[5];let m;e[6]!==c||e[7]!==d||e[8]!==u?(m=s.jsxs(Is,{className:c,children:[d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=m):m=e[9];let f;return e[10]!==r||e[11]!==m||e[12]!==a?(f=s.jsxs(Nr,{variant:a,children:[m,r]}),e[10]=r,e[11]=m,e[12]=a,e[13]=f):f=e[13],f}function Mi(t,e){return s.jsx(Ci,{section:t},e)}function nn(t){const e=N.c(2);let n;return e[0]!==t?(n=s.jsx(Ii,{...t}),e[0]=t,e[1]=n):n=e[1],n}nn.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(Se,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function Ai(){const t=N.c(7),n=Ss().logo??Gn,r=typeof n=="string"?n:n.light,o=typeof n=="string"?n:n.dark;let i;t[0]!==r?(i=s.jsx("img",{src:r,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=r,t[1]=i):i=t[1];let l;t[2]!==o?(l=s.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=o,t[3]=l):l=t[3];let a;return t[4]!==i||t[5]!==l?(a=s.jsxs(Cr,{className:"flex flex-row items-center shrink-0 h-12 px-3 pb-0",children:[i,l]}),t[4]=i,t[5]=l,t[6]=a):a=t[6],a}function ms(t){const e=N.c(18),{item:n,onClose:r}=t,o=n.isActive&&"z-10";let i;e[0]!==o?(i=K(o),e[0]=o,e[1]=i):i=e[1];let l;e[2]!==n||e[3]!==r?(l=()=>{n.onClick?.(),r()},e[2]=n,e[3]=r,e[4]=l):l=e[4];let a;e[5]!==n.icon?(a=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=a):a=e[6];let c;e[7]!==n.label?(c=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=c):c=e[8];let d;e[9]!==n.isActive||e[10]!==n.label||e[11]!==l||e[12]!==a||e[13]!==c?(d=s.jsxs(ke,{onClick:l,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,c]}),e[9]=n.isActive,e[10]=n.label,e[11]=l,e[12]=a,e[13]=c,e[14]=d):d=e[14];let u;return e[15]!==i||e[16]!==d?(u=s.jsx(xe,{className:i,children:d}),e[15]=i,e[16]=d,e[17]=u):u=e[17],u}function $i(t){const e=N.c(18),{section:n,onClose:r}=t;switch(n.type){case"divider":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ks,{className:"my-2"}),e[0]=o):o=e[0],o}case"spacer":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1"}),e[1]=o):o=e[1],o}case"group":{const o=n.group.label,i=n.group.defaultExpanded;let l;if(e[2]!==r||e[3]!==n.group.items){let c;e[5]!==r?(c=d=>s.jsx(ms,{item:d,onClose:r},d.key),e[5]=r,e[6]=c):c=e[6],l=n.group.items.map(c),e[2]=r,e[3]=n.group.items,e[4]=l}else l=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==l?(a=s.jsx(tn,{label:o,defaultExpanded:i,children:l}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=l,e[10]=a):a=e[10],a}case"items":{let o;if(e[11]!==r||e[12]!==n.items){let l;e[14]!==r?(l=a=>s.jsx(ms,{item:a,onClose:r},a.key),e[14]=r,e[15]=l):l=e[15],o=n.items.map(l),e[11]=r,e[12]=n.items,e[13]=o}else o=e[13];let i;return e[16]!==o?(i=s.jsx(Pt,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(zt,{children:s.jsx($e,{className:"gap-1.5",children:o})})}),e[16]=o,e[17]=i):i=e[17],i}case"custom":return n.content}}function Ti(t){const e=N.c(14),{sections:n,onClose:r,footer:o,additionalContent:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(T.Suspense,{fallback:s.jsx("div",{className:"h-10 shrink-0"}),children:s.jsx(Ai,{})}),e[0]=l):l=e[0];let a;if(e[1]!==r||e[2]!==n){let m;e[4]!==r?(m=(f,g)=>s.jsx($i,{section:f,onClose:r},g),e[4]=r,e[5]=m):m=e[5],a=n.map(m),e[1]=r,e[2]=n,e[3]=a}else a=e[3];let c;e[6]!==i?(c=i&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:i}),e[6]=i,e[7]=c):c=e[7];let d;e[8]!==a||e[9]!==c?(d=s.jsxs(Is,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[a,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[l,d,o]}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}function rn(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Oi=Ln({name:Bn().min(2,"Organization name is required")});function Pi(t){const e=N.c(41),{open:n,onOpenChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={resolver:Hn(Oi),defaultValues:{name:""}},e[0]=o):o=e[0];const i=Un(o);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={mutationFn:Ri,onSuccess:zi},e[1]=l):l=e[1];const a=Kn(l),c=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs(yo,{children:[s.jsx(_o,{children:"Create a new organization"}),s.jsx(So,{children:"Set up a new organization to collaborate with others."})]}),e[2]=d):d=e[2];let u;if(e[3]!==a||e[4]!==i){let S;e[6]!==a?(S=C=>a.mutateAsync(C),e[6]=a,e[7]=S):S=e[7],u=i.handleSubmit(S),e[3]=a,e[4]=i,e[5]=u}else u=e[5];let m;e[8]!==i.formState.isSubmitting?(m=S=>{const{field:C}=S;return s.jsxs(Io,{children:[s.jsx(Mo,{children:"Organization Name"}),s.jsx(Ao,{children:s.jsx(Oo,{...C,placeholder:"Acme Inc.",disabled:i.formState.isSubmitting})}),s.jsx($o,{children:"The name of your company or organization"}),C.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",rn(C.value)]})]}),s.jsx(To,{})]})},e[8]=i.formState.isSubmitting,e[9]=m):m=e[9];let f;e[10]!==i.control||e[11]!==m?(f=s.jsx(wo,{control:i.control,name:"name",render:m}),e[10]=i.control,e[11]=m,e[12]=f):f=e[12];let g;e[13]!==c?(g=c&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=g):g=e[14];let h;e[15]!==a||e[16]!==i?(h=()=>{a.reset(),i.reset()},e[15]=a,e[16]=i,e[17]=h):h=e[17];let x;e[18]!==i.formState.isSubmitting||e[19]!==h?(x=s.jsx(jo,{disabled:i.formState.isSubmitting,onClick:h,children:"Cancel"}),e[18]=i.formState.isSubmitting,e[19]=h,e[20]=x):x=e[20];const p=!i.formState.isValid||i.formState.isSubmitting;let b;e[21]!==i.formState.isSubmitting?(b=i.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Po,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=i.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==p||e[24]!==b?(j=s.jsx($t,{type:"submit",variant:"default",disabled:p,children:b}),e[23]=p,e[24]=b,e[25]=j):j=e[25];let y;e[26]!==j||e[27]!==x?(y=s.jsxs(No,{children:[x,j]}),e[26]=j,e[27]=x,e[28]=y):y=e[28];let v;e[29]!==y||e[30]!==u||e[31]!==f||e[32]!==g?(v=s.jsxs("form",{className:"space-y-6",onSubmit:u,autoComplete:"off",children:[f,g,y]}),e[29]=y,e[30]=u,e[31]=f,e[32]=g,e[33]=v):v=e[33];let _;e[34]!==i||e[35]!==v?(_=s.jsxs(vo,{children:[d,s.jsx(ko,{...i,children:v})]}),e[34]=i,e[35]=v,e[36]=_):_=e[36];let k;return e[37]!==r||e[38]!==n||e[39]!==_?(k=s.jsx(Co,{open:n,onOpenChange:r,children:_}),e[37]=r,e[38]=n,e[39]=_,e[40]=k):k=e[40],k}function zi(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function Ri(t){const e=rn(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await Ce.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const r=n?.data?.slug??e;if(!r)throw new Error("Failed to create organization");return{orgSlug:r}}function Ht(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function Di(t){const e=N.c(13),{org:n,size:r}=t,o=r===void 0?"sm":r,i=o==="xs"?"size-5":"size-6",l=o==="xs"?"text-[9px]":"text-xs";let a;e[0]!==i?(a=K(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==n.logo||e[3]!==n.name?(c=n.logo?void 0:Ht(n.name),e[2]=n.logo,e[3]=n.name,e[4]=c):c=e[4];let d;e[5]!==n.logo||e[6]!==n.name||e[7]!==l?(d=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:K("font-semibold leading-none",l),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=l,e[8]=d):d=e[8];let u;return e[9]!==a||e[10]!==c||e[11]!==d?(u=s.jsx("div",{className:a,style:c,children:d}),e[9]=a,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function wt(t){const e=N.c(22),{item:n,onClose:r}=t;if(n.href){const c=n.external?"_blank":void 0,d=n.external?"noopener noreferrer":void 0;let u;e[0]!==n.icon?(u=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[0]=n.icon,e[1]=u):u=e[1];let m;e[2]!==n.label?(m=s.jsx("span",{className:"flex-1",children:n.label}),e[2]=n.label,e[3]=m):m=e[3];let f;return e[4]!==n.href||e[5]!==r||e[6]!==c||e[7]!==d||e[8]!==u||e[9]!==m?(f=s.jsxs("a",{href:n.href,target:c,rel:d,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:r,children:[u,m]}),e[4]=n.href,e[5]=r,e[6]=c,e[7]=d,e[8]=u,e[9]=m,e[10]=f):f=e[10],f}let o;e[11]!==n||e[12]!==r?(o=()=>{n.onClick?.(),r()},e[11]=n,e[12]=r,e[13]=o):o=e[13];let i;e[14]!==n.icon?(i=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=i):i=e[15];let l;e[16]!==n.label?(l=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=l):l=e[17];let a;return e[18]!==o||e[19]!==i||e[20]!==l?(a=s.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[i,l]}),e[18]=o,e[19]=i,e[20]=l,e[21]=a):a=e[21],a}function fs(t){const e=N.c(31),{orgParam:n,onSelectOrg:r,onCreateOrg:o}=t,{data:i}=Xn();let l;e[0]!==n?(l=(w,P)=>w.slug===n?-1:P.slug===n?1:w.name.localeCompare(P.name),e[0]=n,e[1]=l):l=e[1];const a=[...i??[]].sort(l),[c,d]=T.useState(!1),[u,m]=T.useState(""),f=u.toLowerCase(),g=f?a.filter(w=>w.name.toLowerCase().includes(f)||w.slug.toLowerCase().includes(f)):a;let h;e[2]!==c?(h=function(){c&&m(""),d(Ei)},e[2]=c,e[3]=h):h=e[3];const x=h;let p;e[4]!==u||e[5]!==c||e[6]!==x?(p=c?s.jsx("input",{autoFocus:!0,type:"text",value:u,onChange:w=>m(w.target.value),onKeyDown:w=>w.key==="Escape"&&x(),placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}):s.jsx("span",{className:"text-sm font-medium text-muted-foreground/60",children:"Your Organizations"}),e[4]=u,e[5]=c,e[6]=x,e[7]=p):p=e[7];let b;e[8]!==c?(b=c?s.jsx(Ks,{size:16}):s.jsx(Os,{size:16}),e[8]=c,e[9]=b):b=e[9];let j;e[10]!==b||e[11]!==x?(j=s.jsx("button",{type:"button",onClick:x,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:b}),e[10]=b,e[11]=x,e[12]=j):j=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ne,{size:16}),e[13]=y):y=e[13];let v;e[14]!==o?(v=s.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:y}),e[14]=o,e[15]=v):v=e[15];let _;e[16]!==j||e[17]!==v?(_=s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j,v]}),e[16]=j,e[17]=v,e[18]=_):_=e[18];let k;e[19]!==p||e[20]!==_?(k=s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[p,_]}),e[19]=p,e[20]=_,e[21]=k):k=e[21];const S="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",C=g.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:u?`No organizations match "${u}"`:"No organizations available"});let I;e[22]!==r||e[23]!==n?(I=w=>s.jsxs("button",{type:"button",onClick:()=>r(w.slug),className:K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",w.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(Di,{org:w,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:w.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:w.slug})]}),w.slug===n&&s.jsx(Hs,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},w.id),e[22]=r,e[23]=n,e[24]=I):I=e[24];const A=g.map(I);let z;e[25]!==C||e[26]!==A?(z=s.jsxs("div",{className:S,children:[C,A]}),e[25]=C,e[26]=A,e[27]=z):z=e[27];let $;return e[28]!==z||e[29]!==k?($=s.jsxs(s.Fragment,{children:[k,z]}),e[28]=z,e[29]=k,e[30]=$):$=e[30],$}function Ei(t){return!t}function xs(t){const e=N.c(142),{user:n,userImage:r,menuItems:o,signOutItem:i,themeOptions:l,preferences:a,setPreferences:c,orgParam:d,onSelectOrg:u,onCreateOrg:m,close:f,isMobile:g,open:h}=t;if(g){const q=n?.name??"U";let J;e[0]!==q||e[1]!==r?(J=s.jsx(os,{url:r,fallback:q,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=q,e[1]=r,e[2]=J):J=e[2];const Q=n?.name??"User";let ee;e[3]!==Q?(ee=s.jsx("p",{className:"text-sm font-medium truncate",children:Q}),e[3]=Q,e[4]=ee):ee=e[4];const te=n?.email;let se;e[5]!==te?(se=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:te}),e[5]=te,e[6]=se):se=e[6];let ie;e[7]!==ee||e[8]!==se?(ie=s.jsxs("div",{className:"flex-1 min-w-0",children:[ee,se]}),e[7]=ee,e[8]=se,e[9]=ie):ie=e[9];let le;e[10]!==n?(le=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(Bi)},e[10]=n,e[11]=le):le=e[11];let Ie;e[12]===Symbol.for("react.memo_cache_sentinel")?(Ie=s.jsx(is,{size:14}),e[12]=Ie):Ie=e[12];let Pe;e[13]!==le?(Pe=s.jsx(Ve,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:le,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:Ie})}),e[13]=le,e[14]=Pe):Pe=e[14];let ze;e[15]===Symbol.for("react.memo_cache_sentinel")?(ze=s.jsx(We,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=ze):ze=e[15];let pe;e[16]!==Pe?(pe=s.jsx(ts,{delayDuration:300,children:s.jsxs(qe,{children:[Pe,ze]})}),e[16]=Pe,e[17]=pe):pe=e[17];let Re;e[18]!==pe||e[19]!==J||e[20]!==ie?(Re=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[J,ie,pe]}),e[18]=pe,e[19]=J,e[20]=ie,e[21]=Re):Re=e[21];const mt=String(h);let De;e[22]!==m||e[23]!==u||e[24]!==d||e[25]!==mt?(De=s.jsx("div",{className:"border-b border-border pb-2",children:s.jsx(fs,{orgParam:d,onSelectOrg:u,onCreateOrg:m},mt)}),e[22]=m,e[23]=u,e[24]=d,e[25]=mt,e[26]=De):De=e[26];let Ee;if(e[27]!==f||e[28]!==o){let de;e[30]!==f?(de=He=>s.jsx(wt,{item:He,onClose:f},He.key),e[30]=f,e[31]=de):de=e[31],Ee=o.map(de),e[27]=f,e[28]=o,e[29]=Ee}else Ee=e[29];let Me;e[32]!==f||e[33]!==i?(Me=s.jsx(wt,{item:i,onClose:f}),e[32]=f,e[33]=i,e[34]=Me):Me=e[34];let ae;e[35]!==Ee||e[36]!==Me?(ae=s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[Ee,Me]}),e[35]=Ee,e[36]=Me,e[37]=ae):ae=e[37];let Fe;e[38]!==De||e[39]!==ae?(Fe=s.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[De,ae]}),e[38]=De,e[39]=ae,e[40]=Fe):Fe=e[40];let Ge;if(e[41]!==a.theme||e[42]!==c||e[43]!==l){let de;e[45]!==a.theme||e[46]!==c?(de=He=>{const{value:ye,icon:Ue,label:Ke}=He;return s.jsx("button",{type:"button","aria-label":Ke,onClick:()=>c(Qe=>({...Qe,theme:ye})),className:K("size-8 rounded-md flex items-center justify-center transition-colors",a.theme===ye?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Ue},ye)},e[45]=a.theme,e[46]=c,e[47]=de):de=e[47],Ge=l.map(de),e[41]=a.theme,e[42]=c,e[43]=l,e[44]=Ge}else Ge=e[44];let Ye;e[48]!==Ge?(Ye=s.jsx("div",{className:"flex items-center gap-0.5",children:Ge}),e[48]=Ge,e[49]=Ye):Ye=e[49];const ft=a.enableSounds?"Disable sounds":"Enable sounds";let be;e[50]!==c?(be=()=>c(Li),e[50]=c,e[51]=be):be=e[51];const je=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let ue;e[52]!==je?(ue=K("size-8 rounded-md flex items-center justify-center transition-colors",je),e[52]=je,e[53]=ue):ue=e[53];let he;e[54]!==a.enableSounds?(he=a.enableSounds?s.jsx(ss,{size:14}):s.jsx(ns,{size:14}),e[54]=a.enableSounds,e[55]=he):he=e[55];let me;e[56]!==ft||e[57]!==be||e[58]!==ue||e[59]!==he?(me=s.jsx("button",{type:"button","aria-label":ft,onClick:be,className:ue,children:he}),e[56]=ft,e[57]=be,e[58]=ue,e[59]=he,e[60]=me):me=e[60];let Le;e[61]===Symbol.for("react.memo_cache_sentinel")?(Le=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","3.31.1"]}),e[61]=Le):Le=e[61];let ge;e[62]!==me?(ge=s.jsxs("div",{className:"flex items-center gap-2",children:[me,Le]}),e[62]=me,e[63]=ge):ge=e[63];let ve;e[64]!==Ye||e[65]!==ge?(ve=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Ye,ge]}),e[64]=Ye,e[65]=ge,e[66]=ve):ve=e[66];let Be;return e[67]!==Re||e[68]!==Fe||e[69]!==ve?(Be=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[Re,Fe,ve]}),e[67]=Re,e[68]=Fe,e[69]=ve,e[70]=Be):Be=e[70],Be}const x=n?.name??"U";let p;e[71]!==x||e[72]!==r?(p=s.jsx(os,{url:r,fallback:x,shape:"circle",size:"sm",className:"shrink-0"}),e[71]=x,e[72]=r,e[73]=p):p=e[73];const b=n?.name??"User";let j;e[74]!==b?(j=s.jsx("p",{className:"text-sm font-medium truncate",children:b}),e[74]=b,e[75]=j):j=e[75];const y=n?.email;let v;e[76]!==y?(v=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y}),e[76]=y,e[77]=v):v=e[77];let _;e[78]!==j||e[79]!==v?(_=s.jsxs("div",{className:"flex-1 min-w-0",children:[j,v]}),e[78]=j,e[79]=v,e[80]=_):_=e[80];let k;e[81]!==n?(k=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(Gi)},e[81]=n,e[82]=k):k=e[82];let S;e[83]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(is,{size:14}),e[83]=S):S=e[83];let C;e[84]!==k?(C=s.jsx(Ve,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:k,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:S})}),e[84]=k,e[85]=C):C=e[85];let I;e[86]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(We,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[86]=I):I=e[86];let A;e[87]!==C?(A=s.jsx(ts,{delayDuration:300,children:s.jsxs(qe,{children:[C,I]})}),e[87]=C,e[88]=A):A=e[88];let z;e[89]!==A||e[90]!==p||e[91]!==_?(z=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[p,_,A]}),e[89]=A,e[90]=p,e[91]=_,e[92]=z):z=e[92];let $;if(e[93]!==f||e[94]!==o){let q;e[96]!==f?(q=J=>s.jsx(wt,{item:J,onClose:f},J.key),e[96]=f,e[97]=q):q=e[97],$=o.map(q),e[93]=f,e[94]=o,e[95]=$}else $=e[95];let w;e[98]!==f||e[99]!==i?(w=s.jsx(wt,{item:i,onClose:f}),e[98]=f,e[99]=i,e[100]=w):w=e[100];let P;e[101]!==$||e[102]!==w?(P=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[$,w]}),e[101]=$,e[102]=w,e[103]=P):P=e[103];let H;if(e[104]!==a.theme||e[105]!==c||e[106]!==l){let q;e[108]!==a.theme||e[109]!==c?(q=J=>{const{value:Q,icon:ee,label:te}=J;return s.jsx("button",{type:"button","aria-label":te,onClick:()=>c(se=>({...se,theme:Q})),className:K("size-7 rounded-md flex items-center justify-center transition-colors",a.theme===Q?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:ee},Q)},e[108]=a.theme,e[109]=c,e[110]=q):q=e[110],H=l.map(q),e[104]=a.theme,e[105]=c,e[106]=l,e[107]=H}else H=e[107];let O;e[111]!==H?(O=s.jsx("div",{className:"flex items-center gap-0.5",children:H}),e[111]=H,e[112]=O):O=e[112];const L=a.enableSounds?"Disable sounds":"Enable sounds";let R;e[113]!==c?(R=()=>c(Fi),e[113]=c,e[114]=R):R=e[114];const B=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let D;e[115]!==B?(D=K("size-7 rounded-md flex items-center justify-center transition-colors",B),e[115]=B,e[116]=D):D=e[116];let G;e[117]!==a.enableSounds?(G=a.enableSounds?s.jsx(ss,{size:14}):s.jsx(ns,{size:14}),e[117]=a.enableSounds,e[118]=G):G=e[118];let F;e[119]!==L||e[120]!==R||e[121]!==D||e[122]!==G?(F=s.jsx("button",{type:"button","aria-label":L,onClick:R,className:D,children:G}),e[119]=L,e[120]=R,e[121]=D,e[122]=G,e[123]=F):F=e[123];let E;e[124]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","3.31.1"]}),e[124]=E):E=e[124];let V;e[125]!==F?(V=s.jsxs("div",{className:"flex items-center gap-2",children:[F,E]}),e[125]=F,e[126]=V):V=e[126];let W;e[127]!==O||e[128]!==V?(W=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[O,V]}),e[127]=O,e[128]=V,e[129]=W):W=e[129];let X;e[130]!==z||e[131]!==P||e[132]!==W?(X=s.jsxs("div",{className:"w-60 shrink-0 flex flex-col border-r border-border bg-sidebar/75",children:[z,P,W]}),e[130]=z,e[131]=P,e[132]=W,e[133]=X):X=e[133];const re=String(h);let Y;e[134]!==m||e[135]!==u||e[136]!==d||e[137]!==re?(Y=s.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:s.jsx(fs,{orgParam:d,onSelectOrg:u,onCreateOrg:m},re)}),e[134]=m,e[135]=u,e[136]=d,e[137]=re,e[138]=Y):Y=e[138];let oe;return e[139]!==X||e[140]!==Y?(oe=s.jsxs("div",{className:"flex min-h-[380px] w-full overflow-hidden",children:[X,Y]}),e[139]=X,e[140]=Y,e[141]=oe):oe=e[141],oe}function Fi(t){return{...t,enableSounds:!t.enableSounds}}function Gi(){Ae.success("User ID copied")}function Li(t){return{...t,enableSounds:!t.enableSounds}}function Bi(){Ae.success("User ID copied")}function Ut(){const t=N.c(44),{data:e}=Ce.useSession(),{org:n}=fe(),r=Oe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org",shouldThrow:!1},t[0]=o):o=t[0];const l=Vn(o)?.params.org,[a,c]=Wn(),d=Ms(),[u,m]=T.useState(!1),[f,g]=T.useState(!1),h=e?.user,x=h?.image;let p;t[1]!==r?(p=X=>{m(!1),r({to:"/$org",params:{org:X}})},t[1]=r,t[2]=p):p=t[2];const b=p;let j;t[3]===Symbol.for("react.memo_cache_sentinel")?(j=()=>m(!1),t[3]=j):j=t[3];const y=j;let v;t[4]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ht,{size:16}),t[4]=v):v=t[4];let _;t[5]!==r||t[6]!==l?(_={key:"preferences",label:"Preferences",icon:v,onClick:()=>{r({to:"/$org/settings/profile",params:{org:l??""}})}},t[5]=r,t[6]=l,t[7]=_):_=t[7];let k;t[8]!==n||t[9]!==r?(k=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(uo,{size:16}),onClick:()=>{r({to:"/$org/install",params:{org:n.slug}})}}]:[],t[8]=n,t[9]=r,t[10]=k):k=t[10];let S;t[11]===Symbol.for("react.memo_cache_sentinel")?(S={key:"terms",label:"Terms of Use",icon:s.jsx(Sr,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[11]=S):S=t[11];let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C={key:"privacy",label:"Privacy Policy",icon:s.jsx(go,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[12]=C):C=t[12];let I;t[13]===Symbol.for("react.memo_cache_sentinel")?(I={key:"github",label:"decocms/studio",icon:s.jsx(qn,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[13]=I):I=t[13];let A;t[14]===Symbol.for("react.memo_cache_sentinel")?(A={key:"community",label:"Community",icon:s.jsx(bo,{size:16}),href:"https://decocms.com/discord",external:!0},t[14]=A):A=t[14];let z;t[15]===Symbol.for("react.memo_cache_sentinel")?(z={key:"homepage",label:"Homepage",icon:s.jsx(mo,{size:16}),href:"https://decocms.com",external:!0},t[15]=z):z=t[15];let $;t[16]!==_||t[17]!==k?($=[_,...k,S,C,I,A,z],t[16]=_,t[17]=k,t[18]=$):$=t[18];const w=$;let P;t[19]===Symbol.for("react.memo_cache_sentinel")?(P={key:"logout",label:"Sign out",icon:s.jsx(fo,{size:16}),onClick:Ui},t[19]=P):P=t[19];const H=P;let O;t[20]===Symbol.for("react.memo_cache_sentinel")?(O={value:"light",icon:s.jsx(po,{size:14}),label:"Light theme"},t[20]=O):O=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L={value:"dark",icon:s.jsx(ho,{size:14}),label:"Dark theme"},t[21]=L):L=t[21];let R;t[22]===Symbol.for("react.memo_cache_sentinel")?(R=[O,L,{value:"system",icon:s.jsx(xo,{size:14}),label:"System theme"}],t[22]=R):R=t[22];const B=R;let D;t[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{m(!1),g(!0)},t[23]=D):D=t[23];let G;t[24]!==b||t[25]!==d||t[26]!==w||t[27]!==u||t[28]!==l||t[29]!==a||t[30]!==c||t[31]!==h||t[32]!==x?(G={user:h,userImage:x,menuItems:w,signOutItem:H,themeOptions:B,preferences:a,setPreferences:c,orgParam:l,onSelectOrg:b,onCreateOrg:D,close:y,isMobile:d,open:u},t[24]=b,t[25]=d,t[26]=w,t[27]=u,t[28]=l,t[29]=a,t[30]=c,t[31]=h,t[32]=x,t[33]=G):G=t[33];const F=G;let E;t[34]!==n||t[35]!==d||t[36]!==u||t[37]!==F?(E=d?s.jsxs(As,{open:u,onOpenChange:m,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>m(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx("div",{className:"shrink-0 size-5 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:n?.logo?void 0:Ht(n?.name??""),children:n?.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:"font-semibold leading-none text-[8px]",children:(n?.name??"?").slice(0,2).toUpperCase()})}),s.jsx("span",{className:"truncate",children:n?.name??"Account"})]}),s.jsxs($s,{className:"h-[80dvh] p-0",children:[s.jsx(Ts,{className:"sr-only",children:"Account"}),s.jsx(xs,{...F})]})]}):s.jsxs(Rt,{open:u,onOpenChange:m,children:[s.jsx(ut,{asChild:!0,children:s.jsxs(ke,{tooltip:n?.name??"Account",className:"rounded-md",children:[s.jsx("div",{className:"shrink-0 size-6 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:n?.logo?void 0:Ht(n?.name??""),children:n?.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:"font-semibold leading-none text-[9px]",children:(n?.name??"?").slice(0,2).toUpperCase()})}),s.jsx("span",{className:"truncate",children:n?.name??"Account"})]})}),s.jsx(Dt,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[520px] p-0 flex max-h-[520px]",onCloseAutoFocus:Hi,children:s.jsx(xs,{...F})})]}),t[34]=n,t[35]=d,t[36]=u,t[37]=F,t[38]=E):E=t[38];let V;t[39]!==f?(V=s.jsx(Pi,{open:f,onOpenChange:g}),t[39]=f,t[40]=V):V=t[40];let W;return t[41]!==E||t[42]!==V?(W=s.jsxs(s.Fragment,{children:[E,V]}),t[41]=E,t[42]=V,t[43]=W):W=t[43],W}function Hi(t){return t.preventDefault()}function Ui(){Z("signed_out",{source:"account_popover"}),Yn(),Ce.signOut()}function Ki({invitation:t}){const[e,n]=T.useState(!1),[r,o]=T.useState(!1),i=Qn(),l=async()=>{n(!0);try{const d=await Ce.organization.acceptInvitation({invitationId:t.id});if(d.error){Ae.error(d.error.message),n(!1);return}}catch{Ae.error("Failed to accept invitation"),n(!1);return}Ae.success("Invitation accepted!"),Zn();let c;try{c=(await Ce.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{o(!0);try{const c=await Ce.organization.rejectInvitation({invitationId:t.id});c.error?(Ae.error(c.error.message),o(!1)):(Ae.success("Invitation declined"),i.invalidateQueries())}catch{Ae.error("Failed to decline invitation"),o(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),s.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx($t,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:l,disabled:e||r,"aria-label":"Accept invitation",children:s.jsx(Hs,{size:14})}),s.jsx($t,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||r,"aria-label":"Decline invitation",children:s.jsx(Ks,{size:14})})]})]})}function Vi(t){const e=N.c(14),{release:n,isSeen:r,onSelect:o}=t;let i;e[0]!==r?(i=!r&&s.jsx("span",{"aria-label":"New release",className:"absolute left-2 top-1/2 -translate-y-1/2 size-1.5 rounded-full bg-primary"}),e[0]=r,e[1]=i):i=e[1];let l;e[2]!==n.eyebrow?(l=n.eyebrow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.eyebrow}),e[2]=n.eyebrow,e[3]=l):l=e[3];let a;e[4]!==n.title?(a=s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[4]=n.title,e[5]=a):a=e[5];let c;e[6]!==l||e[7]!==a?(c=s.jsxs("div",{className:"flex-1 min-w-0",children:[l,a]}),e[6]=l,e[7]=a,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Xt,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=d):d=e[9];let u;return e[10]!==o||e[11]!==i||e[12]!==c?(u=s.jsxs("button",{type:"button",onClick:o,className:"relative w-full flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors text-left",children:[i,c,d]}),e[10]=o,e[11]=i,e[12]=c,e[13]=u):u=e[13],u}function Wi(){const t=T.useContext(Jn),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date)}function on(){const t=N.c(10),{isSeen:e,markSeen:n,unseenCount:r}=Hr(),o=Wi();let i;if(t[0]!==e||t[1]!==o){const c=[...o].sort(Xi).map(Yi);let d;t[3]!==e?(d=m=>({type:"release",release:m,isSeen:e(m.id)}),t[3]=e,t[4]=d):d=t[4];const u=[...Ur].sort(qi).map(d);i=[...c,...u],t[0]=e,t[1]=o,t[2]=i}else i=t[2];const l=r+o.length;let a;return t[5]!==n||t[6]!==o||t[7]!==i||t[8]!==l?(a={items:i,pendingInvitations:o,redDotCount:l,markReleaseSeen:n},t[5]=n,t[6]=o,t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function qi(t,e){return new Date(e.date).getTime()-new Date(t.date).getTime()}function Yi(t){return{type:"invitation",invitation:t}}function Xi(t,e){return new Date(t.expiresAt).getTime()-new Date(e.expiresAt).getTime()}class ln extends T.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function an(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Qi(){const t=N.c(25),e=Oe(),{org:n}=fe();let r;t[0]!==n.id||t[1]!==n.slug?(r={connectionId:Ps,orgId:n.id,orgSlug:n.slug},t[0]=n.id,t[1]=n.slug,t[2]=r):r=t[2];const o=zs(r);let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={providerId:"deco"},t[3]=i):i=t[3];let l;t[4]!==o?(l={client:o,toolName:"AI_PROVIDER_CREDITS",toolArguments:i,staleTime:6e4,select:Zi},t[4]=o,t[5]=l):l=t[5];const{data:a,isPending:c,isError:d}=Ws(l),u=a?.balanceCents!=null?a.balanceCents/100:null;let m;t[6]!==u||t[7]!==d||t[8]!==c?(m=c||d||u==null?"Credits":`Credits: $${u.toFixed(2)}`,t[6]=u,t[7]=d,t[8]=c,t[9]=m):m=t[9];const f=m;let g;t[10]!==u?(g=K(u!=null&&an(u)),t[10]=u,t[11]=g):g=t[11];let h;t[12]!==e||t[13]!==n.slug?(h=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[12]=e,t[13]=n.slug,t[14]=h):h=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ds,{}),t[15]=x):x=t[15];let p;t[16]!==u?(p=u!=null?`$${u.toFixed(2)}`:"Credits",t[16]=u,t[17]=p):p=t[17];let b;t[18]!==p?(b=s.jsx("span",{children:p}),t[18]=p,t[19]=b):b=t[19];let j;return t[20]!==g||t[21]!==h||t[22]!==b||t[23]!==f?(j=s.jsx($e,{children:s.jsx(xe,{children:s.jsxs(ke,{tooltip:f,className:g,onClick:h,children:[x,b]})})}),t[20]=g,t[21]=h,t[22]=b,t[23]=f,t[24]=j):j=t[24],j}function Zi(t){return t.structuredContent}function Ji(){const t=N.c(1);if(!qs().some(el))return null;let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Qi,{}),t[0]=r):r=t[0],r}function el(t){return t.providerId==="deco"}function tl(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ln,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(Ji,{})})}),t[0]=e):e=t[0],e}function sl(){const t=N.c(25),e=Oe(),{org:n}=fe();let r;t[0]!==n.id||t[1]!==n.slug?(r={connectionId:Ps,orgId:n.id,orgSlug:n.slug},t[0]=n.id,t[1]=n.slug,t[2]=r):r=t[2];const o=zs(r);let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={providerId:"deco"},t[3]=i):i=t[3];let l;t[4]!==o?(l={client:o,toolName:"AI_PROVIDER_CREDITS",toolArguments:i,staleTime:6e4,select:nl},t[4]=o,t[5]=l):l=t[5];const{data:a,isPending:c,isError:d}=Ws(l),u=a?.balanceCents!=null?a.balanceCents/100:null;let m;t[6]!==u||t[7]!==d||t[8]!==c?(m=c||d||u==null?"Credits":`Credits: $${u.toFixed(2)}`,t[6]=u,t[7]=d,t[8]=c,t[9]=m):m=t[9];const f=m;let g;t[10]!==e||t[11]!==n.slug?(g=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[10]=e,t[11]=n.slug,t[12]=g):g=t[12];let h;t[13]!==u?(h=K(u!=null&&an(u)),t[13]=u,t[14]=h):h=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ds,{className:"size-4"}),t[15]=x):x=t[15];let p;t[16]!==g||t[17]!==h||t[18]!==f?(p=s.jsx(Ve,{asChild:!0,children:s.jsx(we,{"aria-label":f,onClick:g,className:h,children:x})}),t[16]=g,t[17]=h,t[18]=f,t[19]=p):p=t[19];let b;t[20]!==f?(b=s.jsx(We,{side:"top",children:f}),t[20]=f,t[21]=b):b=t[21];let j;return t[22]!==p||t[23]!==b?(j=s.jsxs(qe,{delayDuration:300,children:[p,b]}),t[22]=p,t[23]=b,t[24]=j):j=t[24],j}function nl(t){return t.structuredContent}function rl(){const t=N.c(1);if(!qs().some(ol))return null;let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(sl,{}),t[0]=r):r=t[0],r}function ol(t){return t.providerId==="deco"}function il(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ln,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(rl,{})})}),t[0]=e):e=t[0],e}function cn(t){const e=N.c(15),{children:n}=t,{items:r,markReleaseSeen:o}=on(),[i,l]=T.useState(null);let a;if(e[0]!==r||e[1]!==i){let x;e[3]!==i?(x=p=>p.type==="release"&&p.release.id===i,e[3]=i,e[4]=x):x=e[4],a=r.find(x),e[0]=r,e[1]=i,e[2]=a}else a=e[2];const c=a,d=c?.type==="release"?c.release:null;let u;e[5]!==o?(u=x=>{l(x),o(x)},e[5]=o,e[6]=u):u=e[6];const m=u;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x||l(null)},e[7]=f):f=e[7];let g;e[8]!==m||e[9]!==r||e[10]!==d?(g=s.jsx(Dt,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b border-border shrink-0",children:[s.jsx($t,{size:"icon",variant:"ghost","aria-label":"Back to inbox",className:"size-7 text-muted-foreground",onClick:()=>l(null),children:s.jsx(zo,{size:16})}),s.jsx("h3",{className:"text-sm font-medium truncate",children:d.title})]}),s.jsx("div",{className:"overflow-y-auto flex-1 p-5",children:s.jsx(Kr,{release:d})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:s.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),r.length===0?s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[s.jsx(Yt,{size:24,className:"text-muted-foreground/50"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Nothing here yet"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Invitations and release updates will appear here"})]}):s.jsx("div",{className:"overflow-y-auto flex-1",children:r.map(x=>x.type==="invitation"?s.jsx(Ki,{invitation:x.invitation},`inv-${x.invitation.id}`):s.jsx(Vi,{release:x.release,isSeen:x.isSeen,onSelect:()=>m(x.release.id)},`rel-${x.release.id}`))})]})}),e[8]=m,e[9]=r,e[10]=d,e[11]=g):g=e[11];let h;return e[12]!==n||e[13]!==g?(h=s.jsxs(Rt,{onOpenChange:f,children:[n,g]}),e[12]=n,e[13]=g,e[14]=h):h=e[14],h}function dn(){const{redDotCount:t}=on();return t>0}function ll(){const t=N.c(6),e=dn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Yt,{}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{children:"Inbox"}),t[3]=o):o=t[3];let i;return t[4]!==r?(i=s.jsx(cn,{children:s.jsx(ut,{asChild:!0,children:s.jsxs(ke,{tooltip:"Inbox",className:"relative",children:[n,r,o]})})}),t[4]=r,t[5]=i):i=t[5],i}function al(){const t=N.c(8),e=dn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Yt,{className:"size-4"}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-0.5 right-0.5 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let o;t[3]!==r?(o=s.jsx(ut,{asChild:!0,children:s.jsx(Ve,{asChild:!0,children:s.jsxs(we,{"aria-label":"Inbox",children:[n,r]})})}),t[3]=r,t[4]=o):o=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(We,{side:"top",children:"Inbox"}),t[5]=i):i=t[5];let l;return t[6]!==o?(l=s.jsx(cn,{children:s.jsxs(qe,{delayDuration:300,children:[o,i]})}),t[6]=o,t[7]=l):l=t[7],l}function cl(){const t=N.c(3),[e,n]=T.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(ke,{tooltip:"Connections",onClick:()=>{Z("connections_dialog_opened",{source:"sidebar_footer",mode:"browse"}),n(!0)},children:[s.jsx(Us,{}),s.jsx("span",{children:"Connections"})]}),t[0]=r):r=t[0];let o;return t[1]!==e?(o=s.jsxs(s.Fragment,{children:[r,s.jsx(Vs,{mode:"browse",open:e,onOpenChange:n,defaultTab:"all"})]}),t[1]=e,t[2]=o):o=t[2],o}function dl(){const t=N.c(3),[e,n]=T.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(qe,{delayDuration:300,children:[s.jsx(Ve,{asChild:!0,children:s.jsx(we,{"aria-label":"Connections",onClick:()=>{Z("connections_dialog_opened",{source:"sidebar_footer",mode:"browse"}),n(!0)},children:s.jsx(Us,{className:"size-4"})})}),s.jsx(We,{side:"top",children:"Connections"})]}),t[0]=r):r=t[0];let o;return t[1]!==e?(o=s.jsxs(s.Fragment,{children:[r,s.jsx(Vs,{mode:"browse",open:e,onOpenChange:n,defaultTab:"all"})]}),t[1]=e,t[2]=o):o=t[2],o}function ul(){const t=N.c(7),e=Oe(),{org:n}=fe();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let o,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ht,{}),i=s.jsx("span",{children:"Settings"}),t[3]=o,t[4]=i):(o=t[3],i=t[4]);let l;return t[5]!==r?(l=s.jsxs(ke,{tooltip:"Settings",onClick:r,children:[o,i]}),t[5]=r,t[6]=l):l=t[6],l}function ml(){const t=N.c(9),e=Oe(),{org:n}=fe();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ht,{className:"size-4"}),t[3]=o):o=t[3];let i;t[4]!==r?(i=s.jsx(Ve,{asChild:!0,children:s.jsx(we,{"aria-label":"Settings",onClick:r,children:o})}),t[4]=r,t[5]=i):i=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(We,{side:"top",children:"Settings"}),t[6]=l):l=t[6];let a;return t[7]!==i?(a=s.jsxs(qe,{delayDuration:300,children:[i,l]}),t[7]=i,t[8]=a):a=t[8],a}function fl(){const t=N.c(6),{state:e}=Xe();if(e==="collapsed"){let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(tl,{}),t[0]=o):o=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(xe,{children:s.jsx(cl,{})}),t[1]=i):i=t[1];let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(xe,{children:s.jsx(ll,{})}),t[2]=l):l=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(xe,{children:s.jsx(ul,{})}),t[3]=a):a=t[3];let c;return t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(Bt,{className:"px-2 pb-3 gap-1",children:[o,s.jsxs($e,{children:[i,l,a,s.jsx(xe,{children:s.jsx(Ut,{})})]})]}),t[4]=c):c=t[4],c}let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Bt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx($e,{children:s.jsx(xe,{children:s.jsx(Ut,{})})})}),s.jsx(ml,{}),s.jsx(al,{}),s.jsx(dl,{}),s.jsx(il,{})]})}),t[5]=r):r=t[5],r}function xl(){const t=N.c(8),e=Oe(),{org:n}=fe(),{setOpenMobile:r}=Xe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx($e,{children:s.jsx(xe,{children:s.jsx(Ut,{})})})}),t[0]=o):o=t[0];let i;t[1]!==e||t[2]!==n.slug||t[3]!==r?(i=()=>{e({to:"/$org/settings",params:{org:n.slug}}),r(!1)},t[1]=e,t[2]=n.slug,t[3]=r,t[4]=i):i=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ht,{className:"size-4"}),t[5]=l):l=t[5];let a;return t[6]!==i?(a=s.jsx(Bt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[o,s.jsx(we,{"aria-label":"Settings",onClick:i,children:l})]})}),t[6]=i,t[7]=a):a=t[7],a}function pl(t){const e=N.c(8),{virtualMcpId:n,size:r,showAutomationBadge:o}=t,i=r===void 0?"sm":r;let l;e[0]!==i||e[1]!==n?(l=n?s.jsx(hl,{virtualMcpId:n,size:i}):s.jsx(Te,{icon:null,name:"?",size:i}),e[0]=i,e[1]=n,e[2]=l):l=e[2];let a;e[3]!==o?(a=o&&s.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:s.jsx(Qs,{size:10,className:"text-white"})}),e[3]=o,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=s.jsxs("div",{className:"relative shrink-0",children:[l,a]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function hl(t){const e=N.c(6),{virtualMcpId:n,size:r}=t,o=pt(n);if(!o){let a;return e[0]!==r?(a=s.jsx(Te,{icon:null,name:"?",size:r}),e[0]=r,e[1]=a):a=e[1],a}const i=o.icon??null;let l;return e[2]!==o.title||e[3]!==r||e[4]!==i?(l=s.jsx(Te,{icon:i,name:o.title,size:r}),e[2]=o.title,e[3]=r,e[4]=i,e[5]=l):l=e[5],l}function gl(t){const e=N.c(36),{open:n,onOpenChange:r}=t,[o,i]=T.useState(""),{org:l}=fe(),{setTaskId:a}=Gs(),c=Xs();let d,u,m;e[0]!==l.id||e[1]!==o?(m=o.trim(),u=qt,d=Wt.globalSearch(l.id,m),e[0]=l.id,e[1]=o,e[2]=d,e[3]=u,e[4]=m):(d=e[2],u=e[3],m=e[4]);const f=n&&m.length>0;let g;e[5]!==c||e[6]!==m?(g=async()=>await c.call("GLOBAL_SEARCH",{query:m,limit:20}),e[5]=c,e[6]=m,e[7]=g):g=e[7];let h;e[8]!==d||e[9]!==f||e[10]!==g?(h={queryKey:d,enabled:f,queryFn:g,staleTime:1e4},e[8]=d,e[9]=f,e[10]=g,e[11]=h):h=e[11];const{data:x,isFetching:p}=u(h);let b;e[12]!==x?.items?(b=x?.items??[],e[12]=x?.items,e[13]=b):b=e[13];const j=b;let y;e[14]!==r?(y=w=>{w||i(""),r(w)},e[14]=r,e[15]=y):y=e[15];const v=y;let _;e[16]!==v||e[17]!==a?(_=w=>{v(!1),a(w.id,w.virtual_mcp_id??void 0)},e[16]=v,e[17]=a,e[18]=_):_=e[18];const k=_;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs(Xo,{className:"sr-only",children:[s.jsx(Qo,{children:"Search"}),s.jsx(Zo,{children:"Search across your organization's resources."})]}),e[19]=S):S=e[19];let C;e[20]!==o?(C=s.jsx(ni,{value:o,onValueChange:i,placeholder:"Search..."}),e[20]=o,e[21]=C):C=e[21];let I;e[22]!==k||e[23]!==p||e[24]!==j||e[25]!==m?(I=m?p&&j.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):j.length===0?s.jsx(ti,{children:"No results."}):j.map(w=>w.type==="thread"?s.jsxs(si,{value:`thread:${w.id}:${w.title}`,onSelect:()=>k(w),className:"gap-2.5",children:[s.jsx(pl,{virtualMcpId:w.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:w.title||"Untitled thread"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(w.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${w.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=k,e[23]=p,e[24]=j,e[25]=m,e[26]=I):I=e[26];let A;e[27]!==I?(A=s.jsx(ri,{children:I}),e[27]=I,e[28]=A):A=e[28];let z;e[29]!==C||e[30]!==A?(z=s.jsxs(Jo,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,s.jsxs(oi,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[C,A]})]}),e[29]=C,e[30]=A,e[31]=z):z=e[31];let $;return e[32]!==v||e[33]!==n||e[34]!==z?($=s.jsx(ei,{open:n,onOpenChange:v,children:z}),e[32]=v,e[33]=n,e[34]=z,e[35]=$):$=e[35],$}function bl(t){return t==="owner"||t==="admin"}function jl(){const t=N.c(11),{locator:e}=fe(),n=ii(),{data:r}=Ce.useSession(),o=r?.user?.id;let i;t[0]!==e?(i=Wt.members(e),t[0]=e,t[1]=i):i=t[1];let l;t[2]!==n?(l=()=>n.organization.listMembers(),t[2]=n,t[3]=l):l=t[3];const a=!!o;let c;t[4]!==i||t[5]!==l||t[6]!==a?(c={queryKey:i,queryFn:l,enabled:a,staleTime:6e4},t[4]=i,t[5]=l,t[6]=a,t[7]=c):c=t[7];const{data:d}=qt(c);let u;if(t[8]!==d?.data?.members||t[9]!==o){const f=(d?.data?.members??[]).find(g=>g.userId===o)?.role;u=bl(f??void 0),t[8]=d?.data?.members,t[9]=o,t[10]=u}else u=t[10];return u}var Qt="ContextMenu",[vl]=ar(Qt,[Cs]),ce=Cs(),[yl,un]=vl(Qt),mn=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:o,modal:i=!0}=t,[l,a]=T.useState(!1),c=ce(e),d=ir(r),u=T.useCallback(m=>{a(m),d(m)},[d]);return s.jsx(yl,{scope:e,open:l,onOpenChange:u,modal:i,children:s.jsx(lr,{...c,dir:o,open:l,onOpenChange:u,modal:i,children:n})})};mn.displayName=Qt;var fn="ContextMenuTrigger",xn=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=t,i=un(fn,n),l=ce(n),a=T.useRef({x:0,y:0}),c=T.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),d=T.useRef(0),u=T.useCallback(()=>window.clearTimeout(d.current),[]),m=f=>{a.current={x:f.clientX,y:f.clientY},i.onOpenChange(!0)};return T.useEffect(()=>u,[u]),T.useEffect(()=>{r&&u()},[r,u]),s.jsxs(s.Fragment,{children:[s.jsx(er,{...l,virtualRef:c}),s.jsx(tr.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:xt(t.onContextMenu,f=>{u(),m(f),f.preventDefault()}),onPointerDown:r?t.onPointerDown:xt(t.onPointerDown,kt(f=>{u(),d.current=window.setTimeout(()=>m(f),700)})),onPointerMove:r?t.onPointerMove:xt(t.onPointerMove,kt(u)),onPointerCancel:r?t.onPointerCancel:xt(t.onPointerCancel,kt(u)),onPointerUp:r?t.onPointerUp:xt(t.onPointerUp,kt(u))})]})});xn.displayName=fn;var _l="ContextMenuPortal",pn=t=>{const{__scopeContextMenu:e,...n}=t,r=ce(e);return s.jsx(rr,{...r,...n})};pn.displayName=_l;var hn="ContextMenuContent",gn=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=un(hn,n),i=ce(n),l=T.useRef(!1);return s.jsx(or,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),!a.defaultPrevented&&l.current&&a.preventDefault(),l.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),!a.defaultPrevented&&!o.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gn.displayName=hn;var Sl="ContextMenuGroup",Nl=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(cr,{...o,...r,ref:e})});Nl.displayName=Sl;var Cl="ContextMenuLabel",wl=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(dr,{...o,...r,ref:e})});wl.displayName=Cl;var kl="ContextMenuItem",bn=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(sr,{...o,...r,ref:e})});bn.displayName=kl;var Il="ContextMenuCheckboxItem",Ml=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(ur,{...o,...r,ref:e})});Ml.displayName=Il;var Al="ContextMenuRadioGroup",$l=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(mr,{...o,...r,ref:e})});$l.displayName=Al;var Tl="ContextMenuRadioItem",Ol=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(fr,{...o,...r,ref:e})});Ol.displayName=Tl;var Pl="ContextMenuItemIndicator",zl=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(xr,{...o,...r,ref:e})});zl.displayName=Pl;var Rl="ContextMenuSeparator",jn=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(nr,{...o,...r,ref:e})});jn.displayName=Rl;var Dl="ContextMenuArrow",El=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(pr,{...o,...r,ref:e})});El.displayName=Dl;var Fl="ContextMenuSubTrigger",Gl=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(hr,{...o,...r,ref:e})});Gl.displayName=Fl;var Ll="ContextMenuSubContent",Bl=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=ce(n);return s.jsx(gr,{...o,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Bl.displayName=Ll;function kt(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Hl=mn,Ul=xn,Kl=pn,Vl=gn,Wl=bn,ql=jn;function vn(t){const e=N.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=s.jsx(Hl,{"data-slot":"context-menu",...n}),e[2]=n,e[3]=r):r=e[3],r}function yn(t){const e=N.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=s.jsx(Ul,{"data-slot":"context-menu-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function _n(t){const e=N.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=K("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 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==r||e[6]!==o?(i=s.jsx(Kl,{children:s.jsx(Vl,{"data-slot":"context-menu-content",className:o,...r})}),e[5]=r,e[6]=o,e[7]=i):i=e[7],i}function It(t){const e=N.c(12);let n,r,o,i;e[0]!==t?({className:n,inset:r,variant:i,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i):(n=e[1],r=e[2],o=e[3],i=e[4]);const l=i===void 0?"default":i;let a;e[5]!==n?(a=K("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-sm 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",n),e[5]=n,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==o||e[9]!==a||e[10]!==l?(c=s.jsx(Wl,{"data-slot":"context-menu-item","data-inset":r,"data-variant":l,className:a,...o}),e[7]=r,e[8]=o,e[9]=a,e[10]=l,e[11]=c):c=e[11],c}function ps(t){const e=N.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=K("bg-border -mx-1 my-1 h-px",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==r||e[6]!==o?(i=s.jsx(ql,{"data-slot":"context-menu-separator",className:o,...r}),e[5]=r,e[6]=o,e[7]=i):i=e[7],i}function Sn(t){const e=N.c(26),{virtualMcpId:n,isOrgPinned:r,canManageOrgPin:o,onNewTaskInGroup:i,onShowSettings:l,onToggleOrgPin:a,onHideGroup:c}=t;let d;e[0]!==i||e[1]!==n?(d=()=>i(n),e[0]=i,e[1]=n,e[2]=d):d=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ne,{size:14,className:"mr-2"}),e[3]=u):u=e[3];let m;e[4]!==d?(m=s.jsxs(It,{onSelect:d,children:[u,"New task"]}),e[4]=d,e[5]=m):m=e[5];let f;e[6]!==l||e[7]!==n?(f=()=>l(n),e[6]=l,e[7]=n,e[8]=f):f=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ht,{size:14,className:"mr-2"}),e[9]=g):g=e[9];let h;e[10]!==f?(h=s.jsxs(It,{onSelect:f,children:[g,"Settings"]}),e[10]=f,e[11]=h):h=e[11];let x;e[12]!==o||e[13]!==r||e[14]!==a||e[15]!==n?(x=o&&s.jsxs(s.Fragment,{children:[s.jsx(ps,{}),s.jsxs(It,{onSelect:()=>a(n,!r),children:[s.jsx(Er,{size:14,className:"mr-2"}),r?"Unpin for all members":"Pin for all members"]})]}),e[12]=o,e[13]=r,e[14]=a,e[15]=n,e[16]=x):x=e[16];let p;e[17]!==r||e[18]!==c||e[19]!==n?(p=!r&&s.jsxs(s.Fragment,{children:[s.jsx(ps,{}),s.jsxs(It,{onSelect:()=>c(n),children:[s.jsx(Ro,{size:14,className:"mr-2"}),"Hide"]})]}),e[17]=r,e[18]=c,e[19]=n,e[20]=p):p=e[20];let b;return e[21]!==m||e[22]!==h||e[23]!==x||e[24]!==p?(b=s.jsxs(s.Fragment,{children:[m,h,x,p]}),e[21]=m,e[22]=h,e[23]=x,e[24]=p,e[25]=b):b=e[25],b}function Yl(t){return t==="ephemeral"||t.startsWith("thread:")}function Et(t){const e=N.c(45),{task:n,isActive:r,onClick:o,onArchive:i,showAutomationBadge:l,showAgentIcon:a,hideStatusIdle:c}=t,d=di(n.status),u=d.icon,m=n.metadata?.kind==="tool_call_run",f=pt(m?void 0:n.virtual_mcp_id);let g;e[0]!==f?(g=Do(f),e[0]=f,e[1]=g):g=e[1];const h=g;mi(6e4);const x=l||!!n.trigger_id,p=n.id,b="button",j=0;let y;e[2]!==o?(y=F=>{F.target===F.currentTarget&&(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),o())},e[2]=o,e[3]=y):y=e[3];const v=r?"bg-accent text-accent-foreground":"hover:bg-accent/60";let _;e[4]!==v?(_=K("group/row flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-colors","focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",v),e[4]=v,e[5]=_):_=e[5];let k;e[6]!==m||e[7]!==a||e[8]!==f?.icon||e[9]!==f?.title?(k=a&&!m&&s.jsx(Te,{icon:f?.icon??null,name:f?.title??"?",size:"2xs"}),e[6]=m,e[7]=a,e[8]=f?.icon,e[9]=f?.title,e[10]=k):k=e[10];let S;e[11]!==x?(S=x&&s.jsx(Qs,{size:12,"aria-label":"Automation-triggered",className:"shrink-0 text-blue-500"}),e[11]=x,e[12]=S):S=e[12];const C=n.title||"Untitled task";let I;e[13]!==C?(I=s.jsx("div",{className:"text-sm text-foreground truncate",children:C}),e[13]=C,e[14]=I):I=e[14];let A;e[15]!==I||e[16]!==S?(A=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[S,I]}),e[15]=I,e[16]=S,e[17]=A):A=e[17];let z;e[18]!==h||e[19]!==r||e[20]!==n.branch||e[21]!==n.updated_at?(z=n.updated_at&&s.jsxs("div",{className:K("flex items-center gap-1 text-[11px] min-w-0",r?"text-accent-foreground/70":"text-muted-foreground/60"),children:[n.branch&&!Yl(n.branch)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-mono",children:n.branch}),s.jsx("span",{className:"shrink-0",children:"·"})]}):h?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"truncate",children:[h.owner,"/",h.name]}),s.jsx("span",{className:"shrink-0",children:"·"})]}):null,s.jsx("span",{className:"shrink-0",children:fi(new Date(n.updated_at))})]}),e[18]=h,e[19]=r,e[20]=n.branch,e[21]=n.updated_at,e[22]=z):z=e[22];let $;e[23]!==A||e[24]!==z?($=s.jsxs("div",{className:"flex-1 min-w-0",children:[A,z]}),e[23]=A,e[24]=z,e[25]=$):$=e[25];const w="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",P=!c&&s.jsx("span",{className:"[grid-area:slot] flex size-7 items-center justify-center pointer-events-none transition-opacity group-hover/row:opacity-0","aria-label":d.label,children:s.jsx(u,{size:14,className:K(d.iconClassName,n.status==="in_progress"&&"animate-spin")})});let H;e[26]!==i?(H=F=>{F.stopPropagation(),i()},e[26]=i,e[27]=H):H=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(br,{size:14}),e[28]=O):O=e[28];let L;e[29]!==H?(L=s.jsx(Ve,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Archive task",onClick:H,className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:O})}),e[29]=H,e[30]=L):L=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(We,{side:"right",children:"Archive"}),e[31]=R):R=e[31];let B;e[32]!==L?(B=s.jsxs(qe,{children:[L,R]}),e[32]=L,e[33]=B):B=e[33];let D;e[34]!==P||e[35]!==B?(D=s.jsxs("div",{className:w,children:[P,B]}),e[34]=P,e[35]=B,e[36]=D):D=e[36];let G;return e[37]!==o||e[38]!==$||e[39]!==D||e[40]!==y||e[41]!==_||e[42]!==k||e[43]!==n.id?(G=s.jsxs("div",{"data-task-id":p,role:b,tabIndex:j,onClick:o,onKeyDown:y,className:_,children:[k,$,D]}),e[37]=o,e[38]=$,e[39]=D,e[40]=y,e[41]=_,e[42]=k,e[43]=n.id,e[44]=G):G=e[44],G}function Zt(t){const e=N.c(10),{onClick:n,isFetching:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=K("flex items-center gap-2 px-2 py-1.5 rounded-md text-sm text-muted-foreground","hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[0]=o):o=e[0];let i;e[1]!==r?(i=r&&s.jsx(Vt,{size:14,className:"animate-spin"}),e[1]=r,e[2]=i):i=e[2];const l=r?"Loading…":"Show more";let a;e[3]!==l?(a=s.jsx("span",{children:l}),e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==r||e[6]!==n||e[7]!==i||e[8]!==a?(c=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:r,className:o,children:[i,a]}),e[5]=r,e[6]=n,e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function Xl(t,e,n,r){return[t,e,n,r.type,r.member,r.currentUserId??""].join("|")}function Ql(t){return t.member==="mine"&&!t.currentUserId}const Nn=4;let At=0;const Kt=[];function Zl(){for(;At<Nn&&Kt.length>0;){const t=Kt.shift();t&&t()}}function Cn(t){return new Promise((e,n)=>{const r=()=>{At++,t().then(e,n).finally(()=>{At--,Zl()})};At<Nn?r():Kt.push(r)})}const Ft=10;function hs(t,e,n,r,o){const i={hidden:!1};t==="agent"&&(i.virtual_mcp_id=e),r.member==="mine"&&r.currentUserId&&(i.created_by=r.currentUserId),r.type==="automation"&&(i.has_trigger=!0),r.type==="manual"&&(i.has_trigger=!1);const l={where:i,limit:o,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return t==="status"&&(l.status=e),l}function Jl(t,e,n,r){let o=0;for(const i of t)Jt(i,e,n,r)&&o++;return o}function Lt(t,e,n,r){return Jl(t,e,n,r)}function ea(t,e,n){const r=new Map;for(const o of t){const i=o.virtual_mcp_id;i&&Jt(o,e,i,n)&&r.set(i,(r.get(i)??0)+1)}return r}function ta(t,e){return!!(t>=Ft||t===0&&e)}function gs(t,e){return t<e}function sa(t,e){return e===!1?!1:e===!0?!0:t}function Jt(t,e,n,r){return!(t.hidden||e==="agent"&&t.virtual_mcp_id!==n||e==="status"&&(t.status??"completed")!==n||r.member==="mine"&&r.currentUserId&&t.created_by!==r.currentUserId||r.type==="automation"&&!t.trigger_id||r.type==="manual"&&t.trigger_id)}const Ot=new Map,Mt=new Map;function na(t,e){return e?t>=Ft?!0:null:!1}function bs(t){return Ot.get(t)}function ra(t,e){Ot.set(t,e)}function oa(t,e,n){const r=Ot.get(t);if(r!==void 0){n(r);return}let o=Mt.get(t);o||(o=Cn(e).then(i=>(Ot.set(t,i),Mt.delete(t),i)).catch(()=>(Mt.delete(t),Promise.reject(new Error("group probe failed")))),Mt.set(t,o)),o.then(n,()=>n(!1))}function js(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Ft,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function ia(t,e,n,r,o){let i=0;for(const l of t)e.has(l.id)||Jt(l,n,r,o)&&i++;return i}function es(t,e,n,r){const o=N.c(8),{org:i}=fe(),l=Xl(i.id,t,e,n);let a;o[0]!==n?(a=Ql(n),o[0]=n,o[1]=a):a=o[1];const c=a,[d,u]=T.useState({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==l&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});const m=Lr(),{threads:f,hasMore:g}=Fs(),h=r??Lt(f,t,e,n),x=ta(h,g),p=na(h,g),b=Xs();if(d.identity===l&&d.serverHasMore===null){const S=p??bs(l);S!==void 0&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:S})}!c&&d.identity===l&&d.serverHasMore===null&&p===null&&bs(l)===void 0&&d.probeSubscribedIdentity!==l&&(u(S=>S.identity===l?{...S,isProbing:!0,probeSubscribedIdentity:l}:S),oa(l,async()=>{const S=hs(t,e,0,n,1),C=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:I}=js(C),A=Lt(m.threads.get(),t,e,n);return I===void 0?!1:gs(A,I)},S=>{u(C=>C.identity!==l?C:{...C,isProbing:!1,serverHasMore:S})}));const y=async function(){if(d.isFetching||d.isProbing||c)return;const C=l;u(I=>I.identity===C?{...I,isFetching:!0}:I);try{const I=Lt(f,t,e,n),A=hs(t,e,I,n,Ft),z=await Cn(()=>b.call("COLLECTION_THREADS_LIST",A)),{items:$,hasMore:w,totalCount:P}=js(z),H=new Set(f.map(la)),O=ia($,H,t,e,n),L=I;m.mergeThreads($),u(R=>{if(R.identity!==C)return R;let B;return P!==void 0?B=gs(L+O,P):B=$.length===0||O===0?!1:w,ra(C,B),{...R,isFetching:!1,serverHasMore:B}})}catch(I){const A=I,z=A instanceof Error?A.message:String(A);Ae.error(`Could not load more tasks: ${z}`),u($=>$.identity===C?{...$,isFetching:!1}:$)}},v=d.isFetching||d.isProbing,_=!c&&!v&&sa(x,d.serverHasMore);let k;return o[2]!==v||o[3]!==y||o[4]!==_||o[5]!==d.isProbing||o[6]!==d.serverHasMore?(k={hasMore:_,isFetching:v,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:y},o[2]=v,o[3]=y,o[4]=_,o[5]=d.isProbing,o[6]=d.serverHasMore,o[7]=k):k=o[7],k}function la(t){return t.id}function wn(t){const e=N.c(61),{virtualMcpId:n,threads:r,activeTaskId:o,filters:i,onSelectTask:l,onArchiveTask:a,onNewTaskInGroup:c,onShowSettings:d,onHideGroup:u,isOrgPinned:m,canManageOrgPin:f,onToggleOrgPin:g,sortable:h,groupVisibleCount:x}=t,p=m===void 0?!1:m,b=f===void 0?!1:f,j=pt(n),y=r[0];let v;e[0]!==y||e[1]!==c||e[2]!==l||e[3]!==n?(v=()=>{y?l(y):c(n)},e[0]=y,e[1]=c,e[2]=l,e[3]=n,e[4]=v):v=e[4];const _=v,k=h?.isDragging?!1:void 0;let S;e[5]!==h?.isDragging||e[6]!==n?(S=q=>{h?.isDragging||q&&Z("sidebar_group_hover_popover_opened",{virtual_mcp_id:n})},e[5]=h?.isDragging,e[6]=n,e[7]=S):S=e[7];const C=!!(y&&o&&y.id===o),I=h?"Drag to reorder":void 0;let A;e[8]!==h?(A=h?{...h.attributes,...h.listeners}:{},e[8]=h,e[9]=A):A=e[9];const z=h&&"cursor-pointer active:cursor-grabbing touch-none",$=h?.isDragging&&"cursor-grabbing";let w;e[10]!==$||e[11]!==z?(w=K("group-data-[state=collapsed]/sidebar:!size-10 group-data-[state=collapsed]/sidebar:!max-w-none group-data-[state=collapsed]/sidebar:!overflow-visible group-data-[state=collapsed]/sidebar:[&_svg]:opacity-100",z,$),e[10]=$,e[11]=z,e[12]=w):w=e[12];const P=j?.icon??null,H=j?.title??"?";let O;e[13]!==P||e[14]!==H?(O=s.jsx(Te,{icon:P,name:H,size:"sm+",className:"rounded-lg"}),e[13]=P,e[14]=H,e[15]=O):O=e[15];let L;e[16]!==_||e[17]!==w||e[18]!==O||e[19]!==C||e[20]!==I||e[21]!==A?(L=s.jsx(xe,{children:s.jsx(yn,{asChild:!0,children:s.jsx(li,{asChild:!0,children:s.jsx(ke,{onClick:_,isActive:C,title:I,...A,className:w,children:O})})})}),e[16]=_,e[17]=w,e[18]=O,e[19]=C,e[20]=I,e[21]=A,e[22]=L):L=e[22];const R=g??aa;let B;e[23]!==b||e[24]!==p||e[25]!==u||e[26]!==c||e[27]!==d||e[28]!==R||e[29]!==n?(B=s.jsx(_n,{className:"w-56",children:s.jsx(Sn,{virtualMcpId:n,isOrgPinned:p,canManageOrgPin:b,onNewTaskInGroup:c,onShowSettings:d,onToggleOrgPin:R,onHideGroup:u})}),e[23]=b,e[24]=p,e[25]=u,e[26]=c,e[27]=d,e[28]=R,e[29]=n,e[30]=B):B=e[30];let D;e[31]!==L||e[32]!==B?(D=s.jsxs(vn,{children:[L,B]}),e[31]=L,e[32]=B,e[33]=D):D=e[33];const G=j?.title??"Agent";let F;e[34]!==G?(F=s.jsx("span",{className:"truncate",children:G}),e[34]=G,e[35]=F):F=e[35];let E;e[36]!==c||e[37]!==n?(E=()=>c(n),e[36]=c,e[37]=n,e[38]=E):E=e[38];let V;e[39]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(Ne,{size:14}),e[39]=V):V=e[39];let W;e[40]!==E?(W=s.jsx("button",{type:"button","aria-label":"New task in this agent",onClick:E,className:"flex size-6 items-center justify-center rounded-md hover:bg-accent text-muted-foreground hover:text-foreground",children:V}),e[40]=E,e[41]=W):W=e[41];let X;e[42]!==F||e[43]!==W?(X=s.jsxs("div",{className:"flex items-center justify-between px-1 pb-1 text-xs font-medium",children:[F,W]}),e[42]=F,e[43]=W,e[44]=X):X=e[44];let re;e[45]!==o||e[46]!==i||e[47]!==x||e[48]!==a||e[49]!==l||e[50]!==r||e[51]!==n?(re=s.jsx(ca,{virtualMcpId:n,threads:r,activeTaskId:o,filters:i,groupVisibleCount:x,onSelectTask:l,onArchiveTask:a}),e[45]=o,e[46]=i,e[47]=x,e[48]=a,e[49]=l,e[50]=r,e[51]=n,e[52]=re):re=e[52];let Y;e[53]!==X||e[54]!==re?(Y=s.jsxs(ai,{side:"right",align:"start",sideOffset:8,className:"w-72 p-2",children:[X,re]}),e[53]=X,e[54]=re,e[55]=Y):Y=e[55];let oe;return e[56]!==D||e[57]!==Y||e[58]!==k||e[59]!==S?(oe=s.jsxs(ci,{open:k,openDelay:120,closeDelay:150,onOpenChange:S,children:[D,Y]}),e[56]=D,e[57]=Y,e[58]=k,e[59]=S,e[60]=oe):oe=e[60],oe}function aa(){}function ca(t){const e=N.c(6),{virtualMcpId:n,threads:r,activeTaskId:o,filters:i,groupVisibleCount:l,onSelectTask:a,onArchiveTask:c}=t,d=es("agent",n,i,l);let u;return e[0]!==o||e[1]!==c||e[2]!==a||e[3]!==d||e[4]!==r?(u=s.jsx("div",{className:"flex flex-col gap-0.5 max-h-[60vh] overflow-y-auto",children:r.length===0&&!d.hasMore&&!d.isFetching?s.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No tasks yet"}):s.jsxs(s.Fragment,{children:[r.map(m=>s.jsx(Et,{task:m,isActive:o===m.id,onClick:()=>a(m),onArchive:()=>c(m),showAutomationBadge:!!m.trigger_id},m.id)),(d.hasMore||d.isFetching)&&s.jsx(Zt,{onClick:()=>{d.loadMore()},isFetching:d.isFetching})]})}),e[0]=o,e[1]=c,e[2]=a,e[3]=d,e[4]=r,e[5]=u):u=e[5],u}function da(t,e,n,r,o,i,l){const a=N.c(18),c=l===void 0?"expanded":l;let d;a[0]===Symbol.for("react.memo_cache_sentinel")?(d={activationConstraint:{distance:8}},a[0]=d):d=a[0];let u;a[1]===Symbol.for("react.memo_cache_sentinel")?(u={coordinateGetter:Lo},a[1]=u):u=a[1];const m=Eo(ls(Go,d),ls(Fo,u));let f;a[2]!==r||a[3]!==o||a[4]!==e||a[5]!==t?(f=Yr(t,e,r,o),a[2]=r,a[3]=o,a[4]=e,a[5]=t,a[6]=f):f=a[6];const g=f;let h;a[7]!==i||a[8]!==n||a[9]!==o||a[10]!==e||a[11]!==g||a[12]!==c?(h=b=>{const{active:j,over:y}=b;if(!y||j.id===y.id)return;const v=String(j.id),_=String(y.id);if(!Xr(v,_,o))return;const k=Qr(g,v,_),S=Zr(e,n,o,k);e==="org"?Jr(n.orgId,S):eo(n,S),Z("sidebar_group_reordered",{virtual_mcp_id:v,over_virtual_mcp_id:_,surface:c,section:e}),i()},a[7]=i,a[8]=n,a[9]=o,a[10]=e,a[11]=g,a[12]=c,a[13]=h):h=a[13];const x=h;let p;return a[14]!==x||a[15]!==m||a[16]!==g?(p={sensors:m,sortableIds:g,handleDragEnd:x},a[14]=x,a[15]=m,a[16]=g,a[17]=p):p=a[17],p}function ua(t){const e=N.c(2),{collapsed:n}=t;if(n===void 0?!1:n){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"mx-auto my-1 h-px w-6 shrink-0 bg-border"}),e[0]=i):i=e[0],i}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{role:"separator","aria-orientation":"horizontal",className:"my-1.5 h-px w-full shrink-0 bg-border"}),e[1]=o):o=e[1],o}function ma(t){const e=N.c(12),{id:n,children:r}=t;let o;e[0]!==n?(o={id:n},e[0]=n,e[1]=o):o=e[1];const{attributes:i,listeners:l,setNodeRef:a,transform:c,transition:d,isDragging:u}=Vo(o);let m;if(e[2]!==i||e[3]!==r||e[4]!==u||e[5]!==l||e[6]!==a||e[7]!==c||e[8]!==d){const g={transform:Wo.Transform.toString(c),transition:d,zIndex:u?100:void 0};m=r({setNodeRef:a,style:g,isDragging:u,attributes:i,listeners:l}),e[2]=i,e[3]=r,e[4]=u,e[5]=l,e[6]=a,e[7]=c,e[8]=d,e[9]=m}else m=e[9];let f;return e[10]!==m?(f=s.jsx(s.Fragment,{children:m}),e[10]=m,e[11]=f):f=e[11],f}function vs(t){const e=N.c(18),{section:n,groups:r,orderScope:o,decopilotId:i,orgPinnedIds:l,onReorder:a,surface:c,renderGroup:d,renderSortable:u,renderFixed:m}=t,{sensors:f,sortableIds:g,handleDragEnd:h}=da(r,n,o,i,l,a,c);if(r.length===0)return null;const x=g;let p;if(e[0]!==r||e[1]!==m||e[2]!==d||e[3]!==u||e[4]!==g){let y;e[6]!==m||e[7]!==d||e[8]!==u||e[9]!==g?(y=v=>{const _=d(v);return g.includes(v.virtualMcpId)?s.jsx(ma,{id:v.virtualMcpId,children:k=>{const{setNodeRef:S,style:C,isDragging:I,attributes:A,listeners:z}=k;return s.jsx("div",{ref:S,style:C,className:K(I&&"opacity-50"),children:u(_,{attributes:A,listeners:z,isDragging:I})})}},v.virtualMcpId):s.jsx("div",{children:m(_)},v.virtualMcpId)},e[6]=m,e[7]=d,e[8]=u,e[9]=g,e[10]=y):y=e[10],p=r.map(y),e[0]=r,e[1]=m,e[2]=d,e[3]=u,e[4]=g,e[5]=p}else p=e[5];let b;e[11]!==x||e[12]!==p?(b=s.jsx(Bo,{items:x,strategy:Ho,children:p}),e[11]=x,e[12]=p,e[13]=b):b=e[13];let j;return e[14]!==h||e[15]!==f||e[16]!==b?(j=s.jsx(Uo,{sensors:f,collisionDetection:Ko,onDragEnd:h,children:b}),e[14]=h,e[15]=f,e[16]=b,e[17]=j):j=e[17],j}function kn(t){const e=N.c(23),{groups:n,orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,surface:a,collapsedSeparator:c,renderGroup:d,renderSortable:u,renderFixed:m}=t;let f;if(e[0]!==c||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==i||e[6]!==m||e[7]!==d||e[8]!==u||e[9]!==a){const{decopilot:g,orgPinned:h,user:x,toolCallRuns:p}=to(n,o,i),b=h.length>0&&x.length>0;let j;e[11]!==o||e[12]!==l||e[13]!==r||e[14]!==i||e[15]!==m||e[16]!==d||e[17]!==u||e[18]!==a?(j={orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,surface:a,renderGroup:d,renderSortable:u,renderFixed:m},e[11]=o,e[12]=l,e[13]=r,e[14]=i,e[15]=m,e[16]=d,e[17]=u,e[18]=a,e[19]=j):j=e[19];const y=j;let v;e[20]!==c||e[21]!==b?(v=b&&s.jsx(ua,{collapsed:c}),e[20]=c,e[21]=b,e[22]=v):v=e[22],f=s.jsxs(s.Fragment,{children:[g&&m(d(g)),s.jsx(vs,{section:"org",groups:h,...y}),v,s.jsx(vs,{section:"user",groups:x,...y}),p&&m(d(p))]}),e[0]=c,e[1]=o,e[2]=n,e[3]=l,e[4]=r,e[5]=i,e[6]=m,e[7]=d,e[8]=u,e[9]=a,e[10]=f}else f=e[10];return f}function fa(t){const e=N.c(7),{groups:n,orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,renderGroup:a}=t;let c;return e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==r||e[4]!==i||e[5]!==a?(c=s.jsx(kn,{groups:n,orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,surface:"collapsed_rail",collapsedSeparator:!0,renderGroup:a,renderFixed:pa,renderSortable:xa}),e[0]=o,e[1]=n,e[2]=l,e[3]=r,e[4]=i,e[5]=a,e[6]=c):c=e[6],c}function xa(t,e){return s.jsx(wn,{...t,sortable:{attributes:e.attributes,listeners:e.listeners,isDragging:e.isDragging}},t.virtualMcpId)}function pa(t){return s.jsx(wn,{...t},t.virtualMcpId)}const ha="sidebar.group.expanded.";function In(t,e){const n=N.c(3),[r,o]=jr(`${ha}${t}`,e);let i;return n[0]!==r||n[1]!==o?(i=[r,o],n[0]=r,n[1]=o,n[2]=i):i=n[2],i}function Mn(t){const e=N.c(59),{virtualMcpId:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,onNewTaskInGroup:a,onShowSettings:c,onHideGroup:d,isOrgPinned:u,canManageOrgPin:m,onToggleOrgPin:f,filters:g,groupVisibleCount:h,sortable:x}=t,p=u===void 0?!1:u,b=m===void 0?!1:m,[j,y]=In(n,!1),v=n===Ls,_=x?.isDragging??!1;let k;e[0]!==j||e[1]!==y?(k=function(){y(!j)},e[0]=j,e[1]=y,e[2]=k):k=e[2];const S=k;let C;e[3]!==v||e[4]!==x?(C=x&&!v?{...x.attributes,...x.listeners}:{},e[3]=v,e[4]=x,e[5]=C):C=e[5];let I;e[6]!==S?(I=E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),S())},e[6]=S,e[7]=I):I=e[7];const A=x&&!v&&"touch-none active:cursor-grabbing",z=_&&"shadow-md bg-accent/40 cursor-grabbing";let $;e[8]!==A||e[9]!==z?($=K("group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground","cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",A,z),e[8]=A,e[9]=z,e[10]=$):$=e[10];let w;e[11]!==v||e[12]!==n?(w=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(ba,{virtualMcpId:n,isToolCallRuns:v})}),e[11]=v,e[12]=n,e[13]=w):w=e[13];let P;e[14]!==j?(P=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:j?s.jsx(Zs,{size:14}):s.jsx(Xt,{size:14})}),e[14]=j,e[15]=P):P=e[15];let H;e[16]!==P||e[17]!==w?(H=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[w,P]}),e[16]=P,e[17]=w,e[18]=H):H=e[18];let O;e[19]!==v||e[20]!==n?(O=s.jsx("span",{className:"flex-1 truncate",children:s.jsx(va,{virtualMcpId:n,isToolCallRuns:v})}),e[19]=v,e[20]=n,e[21]=O):O=e[21];let L;e[22]!==v||e[23]!==a||e[24]!==n?(L=!v&&s.jsx("button",{type:"button","aria-label":"New task in this agent",onClick:E=>{E.stopPropagation(),a(n)},className:"opacity-0 group-hover/group:opacity-100 focus-visible:opacity-100 transition-opacity flex size-7 items-center justify-center rounded-md hover:bg-accent text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:s.jsx(Ne,{size:14})}),e[22]=v,e[23]=a,e[24]=n,e[25]=L):L=e[25];let R;e[26]!==j||e[27]!==S||e[28]!==H||e[29]!==O||e[30]!==L||e[31]!==C||e[32]!==I||e[33]!==$?(R=s.jsxs("div",{...C,role:"button",tabIndex:0,"aria-expanded":j,onClick:S,onKeyDown:I,className:$,children:[H,O,L]}),e[26]=j,e[27]=S,e[28]=H,e[29]=O,e[30]=L,e[31]=C,e[32]=I,e[33]=$,e[34]=R):R=e[34];const B=R;let D;e[35]!==b||e[36]!==B||e[37]!==p||e[38]!==v||e[39]!==d||e[40]!==a||e[41]!==c||e[42]!==f||e[43]!==n?(D=v?B:s.jsxs(vn,{children:[s.jsx(yn,{asChild:!0,children:B}),s.jsx(_n,{className:"w-56",children:s.jsx(Sn,{virtualMcpId:n,isOrgPinned:p,canManageOrgPin:b,onNewTaskInGroup:a,onShowSettings:c,onToggleOrgPin:f??ga,onHideGroup:d})})]}),e[35]=b,e[36]=B,e[37]=p,e[38]=v,e[39]=d,e[40]=a,e[41]=c,e[42]=f,e[43]=n,e[44]=D):D=e[44];let G;e[45]!==o||e[46]!==j||e[47]!==g||e[48]!==h||e[49]!==v||e[50]!==l||e[51]!==a||e[52]!==i||e[53]!==r||e[54]!==n?(G=j&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:v?r.map(E=>s.jsx(Et,{task:E,isActive:o===E.id,onClick:()=>i(E),onArchive:()=>l(E),showAutomationBadge:!!E.trigger_id},E.id)):s.jsx(_a,{virtualMcpId:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,onNewTaskInGroup:a,filters:g,groupVisibleCount:h})}),e[45]=o,e[46]=j,e[47]=g,e[48]=h,e[49]=v,e[50]=l,e[51]=a,e[52]=i,e[53]=r,e[54]=n,e[55]=G):G=e[55];let F;return e[56]!==D||e[57]!==G?(F=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[D,G]}),e[56]=D,e[57]=G,e[58]=F):F=e[58],F}function ga(){}function ba(t){const e=N.c(3),{virtualMcpId:n,isToolCallRuns:r}=t;if(r){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Te,{icon:null,name:"⚙",size:"2xs"}),e[0]=i):i=e[0],i}let o;return e[1]!==n?(o=s.jsx(ja,{virtualMcpId:n}),e[1]=n,e[2]=o):o=e[2],o}function ja(t){const e=N.c(4),{virtualMcpId:n}=t,r=pt(n);if(!r){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Te,{icon:null,name:"?",size:"2xs"}),e[0]=l):l=e[0],l}const o=r.icon??null;let i;return e[1]!==r.title||e[2]!==o?(i=s.jsx(Te,{icon:o,name:r.title,size:"2xs"}),e[1]=r.title,e[2]=o,e[3]=i):i=e[3],i}function va(t){const e=N.c(3),{virtualMcpId:n,isToolCallRuns:r}=t;if(r){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(s.Fragment,{children:"Automation runs"}),e[0]=i):i=e[0],i}let o;return e[1]!==n?(o=s.jsx(ya,{virtualMcpId:n}),e[1]=n,e[2]=o):o=e[2],o}function ya(t){const e=N.c(2),{virtualMcpId:n}=t,o=pt(n)?.title??"Agent";let i;return e[0]!==o?(i=s.jsx(s.Fragment,{children:o}),e[0]=o,e[1]=i):i=e[1],i}function _a(t){const e=N.c(10),{virtualMcpId:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,onNewTaskInGroup:a,filters:c,groupVisibleCount:d}=t,u=es("agent",n,c,d),{isFetching:m,isProbing:f,loadMore:g,serverHasMore:h}=u,[x,p]=T.useState(!1);!x&&r.length===0&&h===!0&&!m&&!f&&(p(!0),queueMicrotask(()=>{g()}));const{hasMore:b}=u;let j;return e[0]!==o||e[1]!==b||e[2]!==m||e[3]!==g||e[4]!==l||e[5]!==a||e[6]!==i||e[7]!==r||e[8]!==n?(j=s.jsx(s.Fragment,{children:r.length===0?s.jsxs("button",{type:"button",onClick:()=>a(n),className:"flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm text-muted-foreground hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[s.jsx(Ne,{size:14}),s.jsx("span",{children:"New thread"})]}):s.jsxs(s.Fragment,{children:[r.map(y=>s.jsx(Et,{task:y,isActive:o===y.id,onClick:()=>i(y),onArchive:()=>l(y),showAutomationBadge:!!y.trigger_id},y.id)),(b||m)&&s.jsx(Zt,{onClick:()=>{g()},isFetching:m})]})}),e[0]=o,e[1]=b,e[2]=m,e[3]=g,e[4]=l,e[5]=a,e[6]=i,e[7]=r,e[8]=n,e[9]=j):j=e[9],j}function Sa(t){const e=N.c(16),{status:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,filters:a}=t,{isFetching:c,isProbing:d,loadMore:u,hasMore:m,serverHasMore:f}=es("status",n,a),[g,h]=T.useState(!1);!g&&r.length===0&&f===!0&&!c&&!d&&(h(!0),queueMicrotask(()=>{u()}));let x;if(e[0]!==o||e[1]!==l||e[2]!==i||e[3]!==r){let j;e[5]!==o||e[6]!==l||e[7]!==i?(j=y=>s.jsx(Et,{task:y,isActive:o===y.id,onClick:()=>i(y),onArchive:()=>l(y),showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0},y.id),e[5]=o,e[6]=l,e[7]=i,e[8]=j):j=e[8],x=r.map(j),e[0]=o,e[1]=l,e[2]=i,e[3]=r,e[4]=x}else x=e[4];let p;e[9]!==m||e[10]!==c||e[11]!==u?(p=(m||c)&&s.jsx(Zt,{onClick:()=>{u()},isFetching:c}),e[9]=m,e[10]=c,e[11]=u,e[12]=p):p=e[12];let b;return e[13]!==x||e[14]!==p?(b=s.jsxs(s.Fragment,{children:[x,p]}),e[13]=x,e[14]=p,e[15]=b):b=e[15],b}function Na(t){const e=N.c(35),{status:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,filters:a}=t,c=ui[n],d=c.icon,[u,m]=In(`status-${n}`,!1);let f;e[0]!==u||e[1]!==m?(f=function(){m(!u)},e[0]=u,e[1]=m,e[2]=f):f=e[2];const g=f;let h;e[3]!==g?(h=S=>{S.target===S.currentTarget&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g())},e[3]=g,e[4]=h):h=e[4];let x;e[5]!==d||e[6]!==c.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(d,{size:12,className:c.iconClassName})}),e[5]=d,e[6]=c.iconClassName,e[7]=x):x=e[7];let p;e[8]!==u?(p=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:u?s.jsx(Zs,{size:14}):s.jsx(Xt,{size:14})}),e[8]=u,e[9]=p):p=e[9];let b;e[10]!==x||e[11]!==p?(b=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[x,p]}),e[10]=x,e[11]=p,e[12]=b):b=e[12];let j;e[13]!==c.label?(j=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=j):j=e[14];let y;e[15]!==r.length?(y=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:r.length})}),e[15]=r.length,e[16]=y):y=e[16];let v;e[17]!==u||e[18]!==g||e[19]!==h||e[20]!==b||e[21]!==j||e[22]!==y?(v=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":u,onClick:g,onKeyDown:h,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[b,j,y]}),e[17]=u,e[18]=g,e[19]=h,e[20]=b,e[21]=j,e[22]=y,e[23]=v):v=e[23];let _;e[24]!==o||e[25]!==u||e[26]!==a||e[27]!==l||e[28]!==i||e[29]!==n||e[30]!==r?(_=u&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(Sa,{status:n,threads:r,activeTaskId:o,onSelectTask:i,onArchiveTask:l,filters:a})}),e[24]=o,e[25]=u,e[26]=a,e[27]=l,e[28]=i,e[29]=n,e[30]=r,e[31]=_):_=e[31];let k;return e[32]!==v||e[33]!==_?(k=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[v,_]}),e[32]=v,e[33]=_,e[34]=k):k=e[34],k}function Ca(t){const e=N.c(7),{groups:n,orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,renderGroup:a}=t;let c;return e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==r||e[4]!==i||e[5]!==a?(c=s.jsx(kn,{groups:n,orderScope:r,decopilotId:o,orgPinnedIds:i,onReorder:l,surface:"expanded",renderGroup:a,renderFixed:ka,renderSortable:wa}),e[0]=o,e[1]=n,e[2]=l,e[3]=r,e[4]=i,e[5]=a,e[6]=c):c=e[6],c}function wa(t,e){return s.jsx(Mn,{...t,sortable:e},t.virtualMcpId)}function ka(t){return s.jsx(Mn,{...t},t.virtualMcpId)}function Ia(t,e,n,r){return[t.orgId,t.userId,r,n.slice().sort().join(","),e.map(o=>o.virtualMcpId).sort().join(",")].join("|")}function Ma(t,e,n,r,o){const i=N.c(5),l=Ia(t,e,r,o),[a,c]=T.useState("");a!==l&&(so(t,e,n,r),c(l));let d;return i[0]!==n||i[1]!==r||i[2]!==t||i[3]!==e?(d=no(t,e,n,r),i[0]=n,i[1]=r,i[2]=t,i[3]=e,i[4]=d):d=i[4],d}const An={all:"All tasks",manual:"Chats",automation:"Automation"},$n={all:"All members",mine:"Mine only"},ys={agent:"Agent",status:"Status"};function Tn(){const t=N.c(92),{data:e}=Ce.useSession(),n=e?.user?.id,r=n??"anon",{org:o}=fe(),i=Ir(o.id).id,a=Rs().filter(Ga).map(Fa),c=jl(),d=Mr();let u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u={},t[0]=u):u=t[0];const[m,f]=T.useState(u),g=new Set(a),h={},x=[];let p;t[1]!==m?(p=Object.entries(m),t[1]=m,t[2]=p):p=t[2];for(const[M,U]of p)g.has(M)!==U?h[M]=U:x.push(M);x.length>0&&f(M=>{const U={...M};for(const ne of x)delete U[ne];return U});const b=new Set(a);for(const[M,U]of Object.entries(h))U?b.add(M):b.delete(M);const j=[...b],y=new Set(j),{threads:v}=Fs(),_=v.filter(Ea),{hide:k}=Es(),S=Oe(),{setTaskId:C,createNewTask:I}=Gs();let A;t[3]===Symbol.for("react.memo_cache_sentinel")?(A={strict:!1},t[3]=A):A=t[3];const $=Ns(A).taskId??null,w=[..._].sort(Da),[P,H]=T.useState("all"),[O,L]=T.useState("mine"),[R,B]=T.useState("agent"),[D,G]=T.useState(!1),[F,E]=T.useState(!1),[V,W]=T.useState(0),X=ro(),re=V+X;let Y;t[4]!==o.id||t[5]!==r?(Y={orgId:o.id,userId:r},t[4]=o.id,t[5]=r,t[6]=Y):Y=t[6];const oe=Y,q={type:P,member:O,currentUserId:n??null},J=ea(w,"agent",q),Q=Ma(oe,oo(w,i),i,j,re);let ee;t[7]!==n||t[8]!==O?(ee=M=>O==="mine"&&n?M.filter(U=>U.created_by===n):M,t[7]=n,t[8]=O,t[9]=ee):ee=t[9];const te=ee;let se;t[10]!==P?(se=M=>P==="automation"?M.filter(Ra):P==="manual"?M.filter(za):M,t[10]=P,t[11]=se):se=t[11];const ie=se,le=M=>{const U=M.id===$;if(k(M.id),!U)return;const ne=w.find(_e=>_e.id!==M.id&&_e.virtual_mcp_id===M.virtual_mcp_id);ne?C(ne.id,ne.virtual_mcp_id):S({to:"/$org",params:{org:o.slug}})};let Ie;t[12]!==I?(Ie=M=>{Z("sidebar_group_new_clicked",{virtual_mcp_id:M}),I(M)},t[12]=I,t[13]=Ie):Ie=t[13];const Pe=Ie,ze=io();let pe;t[14]!==ze?(pe=M=>{Z("sidebar_group_settings_clicked",{virtual_mcp_id:M}),ze(M,{search:{main:"instructions"}})},t[14]=ze,t[15]=pe):pe=t[15];const Re=pe,mt=M=>{if(y.has(M))return;Z("sidebar_group_hide_clicked",{virtual_mcp_id:M});const U=Q.find(ne=>ne.virtualMcpId===M);if(U)for(const ne of U.threads)k(ne.id);ao(oe,M,j),W(Pa)},De=async(M,U)=>{if(c&&h[M]===void 0){Z("sidebar_group_org_pin_toggled",{virtual_mcp_id:M,pinned:U}),f(ne=>({...ne,[M]:U}));try{await d.update.mutateAsync({id:M,data:{pinned:U}})}catch{co(oe,M,!U),f(ne=>{const _e={...ne};return delete _e[M],_e})}}},Ee=M=>{const U=M===i||M===Ls;return{isOrgPinned:y.has(M),canManageOrgPin:U?!1:c,onToggleOrgPin:U?void 0:De}},Me=M=>{const U=ie(te(M.threads));return{virtualMcpId:M.virtualMcpId,threads:U,activeTaskId:$,filters:q,groupVisibleCount:J.get(M.virtualMcpId)??0,onSelectTask:ne=>C(ne.id,ne.virtual_mcp_id),onArchiveTask:le,onNewTaskInGroup:Pe,onShowSettings:Re,onHideGroup:mt,...Ee(M.virtualMcpId)}},ae=P!=="all"||O!=="mine",{state:Fe,isMobile:Ge}=Xe();if(Fe==="collapsed"&&!Ge){let M;if(t[16]!==ae||t[17]!==Q||t[18]!==te||t[19]!==ie){let dt;t[21]!==ae||t[22]!==te||t[23]!==ie?(dt=zn=>{const Rn=ie(te(zn.threads));return!(ae&&Rn.length===0)},t[21]=ae,t[22]=te,t[23]=ie,t[24]=dt):dt=t[24],M=Q.filter(dt),t[16]=ae,t[17]=Q,t[18]=te,t[19]=ie,t[20]=M}else M=t[20];const U=M,ne=R==="agent"&&Q.length===0;let _e;t[25]!==ne?(_e=s.jsx(rs,{value:ne}),t[25]=ne,t[26]=_e):_e=t[26];let Ct;return t[27]===Symbol.for("react.memo_cache_sentinel")?(Ct=()=>W(Oa),t[27]=Ct):Ct=t[27],s.jsxs(s.Fragment,{children:[_e,s.jsx($e,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:s.jsx(fa,{groups:U,orderScope:oe,decopilotId:i,orgPinnedIds:j,onReorder:Ct,renderGroup:dt=>Me(dt)})})]})}const ft="flex flex-col h-full min-h-0",be=R==="agent"&&Q.length===0;let je;t[28]!==be?(je=s.jsx(rs,{value:be}),t[28]=be,t[29]=je):je=t[29];let ue;t[30]!==G?(ue=()=>{Z("tasks_panel_search_opened"),E(!0),G(!0)},t[30]=G,t[31]=ue):ue=t[31];let he;t[32]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsx(Fr,{size:16}),t[32]=he):he=t[32];let me;t[33]!==ue?(me=s.jsx(we,{"aria-label":"Search threads",onClick:ue,children:he}),t[33]=ue,t[34]=me):me=t[34];const Le=ys[R==="agent"?"status":"agent"];let ge;t[35]!==Le?(ge=Le.toLowerCase(),t[35]=Le,t[36]=ge):ge=t[36];const ve=`Group by ${ge}`,Be=ys[R];let de;t[37]!==Be?(de=Be.toLowerCase(),t[37]=Be,t[38]=de):de=t[38];const He=`Grouped by ${de}`;let ye,Ue;t[39]!==R?(ye=()=>{const M=R==="agent"?"status":"agent";Z("tasks_panel_group_by_changed",{to_value:M}),B(M)},Ue=R==="agent"?s.jsx(Yo,{size:16}):s.jsx(Gr,{size:16}),t[39]=R,t[40]=ye,t[41]=Ue):(ye=t[40],Ue=t[41]);let Ke;t[42]!==ve||t[43]!==He||t[44]!==ye||t[45]!==Ue?(Ke=s.jsx(we,{"aria-label":ve,title:He,onClick:ye,children:Ue}),t[42]=ve,t[43]=He,t[44]=ye,t[45]=Ue,t[46]=Ke):Ke=t[46];let Qe;t[47]===Symbol.for("react.memo_cache_sentinel")?(Qe=s.jsx(qo,{size:16}),t[47]=Qe):Qe=t[47];let Ze;t[48]!==ae?(Ze=ae&&s.jsx("span",{className:"absolute top-0.5 right-0.5 size-2 rounded-full bg-red-500 ring-1 ring-sidebar pointer-events-none"}),t[48]=ae,t[49]=Ze):Ze=t[49];let Je;t[50]!==Ze?(Je=s.jsx(ut,{asChild:!0,children:s.jsxs(we,{"aria-label":"Filter tasks",children:[Qe,Ze]})}),t[50]=Ze,t[51]=Je):Je=t[51];let et;t[52]!==O?(et=M=>{const U=M;U!==O&&Z("tasks_panel_member_filter_changed",{to_value:U}),L(U)},t[52]=O,t[53]=et):et=t[53];let gt;t[54]===Symbol.for("react.memo_cache_sentinel")?(gt=s.jsx(cs,{size:"sm",className:"w-full",children:s.jsx(ds,{})}),t[54]=gt):gt=t[54];let bt;t[55]===Symbol.for("react.memo_cache_sentinel")?(bt=Object.keys($n),t[55]=bt):bt=t[55];let jt;t[56]===Symbol.for("react.memo_cache_sentinel")?(jt=s.jsx(as,{children:bt.map(Ta)}),t[56]=jt):jt=t[56];let tt;t[57]!==O||t[58]!==et?(tt=s.jsx(_s,{label:"Members",children:s.jsxs(us,{value:O,onValueChange:et,children:[gt,jt]})}),t[57]=O,t[58]=et,t[59]=tt):tt=t[59];let st;t[60]!==P?(st=M=>{const U=M;U!==P&&Z("tasks_panel_filter_changed",{to_value:U}),H(U)},t[60]=P,t[61]=st):st=t[61];let vt;t[62]===Symbol.for("react.memo_cache_sentinel")?(vt=s.jsx(cs,{size:"sm",className:"w-full",children:s.jsx(ds,{})}),t[62]=vt):vt=t[62];let yt;t[63]===Symbol.for("react.memo_cache_sentinel")?(yt=Object.keys(An),t[63]=yt):yt=t[63];let _t;t[64]===Symbol.for("react.memo_cache_sentinel")?(_t=s.jsx(as,{children:yt.map($a)}),t[64]=_t):_t=t[64];let nt;t[65]!==st||t[66]!==P?(nt=s.jsx(_s,{label:"Type",children:s.jsxs(us,{value:P,onValueChange:st,children:[vt,_t]})}),t[65]=st,t[66]=P,t[67]=nt):nt=t[67];let rt;t[68]!==tt||t[69]!==nt?(rt=s.jsx(Dt,{align:"start",sideOffset:8,collisionPadding:16,className:"w-72 p-3",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[tt,nt]})}),t[68]=tt,t[69]=nt,t[70]=rt):rt=t[70];let ot;t[71]!==Je||t[72]!==rt?(ot=s.jsxs(Rt,{children:[Je,rt]}),t[71]=Je,t[72]=rt,t[73]=ot):ot=t[73];let it;t[74]!==me||t[75]!==Ke||t[76]!==ot?(it=s.jsxs("div",{className:"flex items-center gap-0.5",children:[me,Ke,ot]}),t[74]=me,t[75]=Ke,t[76]=ot,t[77]=it):it=t[77];let St;t[78]===Symbol.for("react.memo_cache_sentinel")?(St=s.jsx(Js,{compact:!0}),t[78]=St):St=t[78];let lt;t[79]!==it?(lt=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[it,St]}),t[79]=it,t[80]=lt):lt=t[80];const Pn="flex-1 min-h-0 overflow-y-auto overscroll-contain flex flex-col gap-0.5 -mr-2 pr-2",Gt=R==="status"?s.jsx(s.Fragment,{children:lo(ie(te(w))).map(M=>s.jsx(Na,{status:M.status,threads:M.threads,activeTaskId:$,onSelectTask:U=>C(U.id,U.virtual_mcp_id),onArchiveTask:le,filters:q},M.status))}):s.jsx(Ca,{groups:Q,orderScope:oe,decopilotId:i,orgPinnedIds:j,onReorder:()=>W(Aa),renderGroup:M=>({...Me(M)})});let at;t[81]!==Gt?(at=s.jsx("div",{className:Pn,children:Gt}),t[81]=Gt,t[82]=at):at=t[82];let ct;t[83]!==F||t[84]!==D||t[85]!==G?(ct=F&&s.jsx(gl,{open:D,onOpenChange:G}),t[83]=F,t[84]=D,t[85]=G,t[86]=ct):ct=t[86];let Nt;return t[87]!==je||t[88]!==lt||t[89]!==at||t[90]!==ct?(Nt=s.jsxs("div",{className:ft,children:[je,lt,at,ct]}),t[87]=je,t[88]=lt,t[89]=at,t[90]=ct,t[91]=Nt):Nt=t[91],Nt}function Aa(t){return t+1}function $a(t){return s.jsx(Ys,{value:t,children:An[t]},t)}function Ta(t){return s.jsx(Ys,{value:t,children:$n[t]},t)}function Oa(t){return t+1}function Pa(t){return t+1}function za(t){return!t.trigger_id}function Ra(t){return!!t.trigger_id}function Da(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Ea(t){return!t.hidden}function Fa(t){return t.id}function Ga(t){return t.pinned}function _s(t){const e=N.c(7),{label:n,children:r}=t;let o;e[0]!==n?(o=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==r?(i=s.jsx("div",{className:"w-36 shrink-0",children:r}),e[2]=r,e[3]=i):i=e[3];let l;return e[4]!==o||e[5]!==i?(l=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o,i]}),e[4]=o,e[5]=i,e[6]=l):l=e[6],l}const La=5,Ba=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function On(){const t=N.c(3),{state:e}=Xe();if(e==="collapsed"){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:La}).map(Ka)}),t[0]=o):o=t[0],o}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Se,{className:"size-6 rounded-md"}),s.jsx(Se,{className:"size-6 rounded-md"}),s.jsx(Se,{className:"size-6 rounded-md"})]}),s.jsx(Se,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:Ba.map(Ha)})]}),t[2]=r):r=t[2],r}function Ha(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(Se,{className:"size-5 rounded-full shrink-0"}),s.jsx(Se,{className:K("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(Ua)})]},e)}function Ua(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(Se,{className:"h-3 flex-1 rounded-sm"})},e)}function Ka(t,e){return s.jsx(Se,{className:"size-10 rounded-lg mx-auto"},e)}function Vc(){const t=N.c(4),e=en();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(fl,{}),t[0]=n):n=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ws,{children:s.jsxs(T.Suspense,{fallback:s.jsxs(s.Fragment,{children:[s.jsx(Tt,{className:"mb-2"}),s.jsx(On,{})]}),children:[s.jsx(Tt,{className:"mb-2"}),s.jsx(Tn,{})]})}),t[1]=r):r=t[1];let o;return t[2]!==e?(o=s.jsx(Bs,{children:s.jsx(nn,{sections:e,footer:n,additionalContent:r})}),t[2]=e,t[3]=o):o=t[3],o}function Wc(t){const e=N.c(5),{onClose:n}=t,r=en();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(xl,{}),e[0]=o):o=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ws,{children:s.jsxs(T.Suspense,{fallback:s.jsxs(s.Fragment,{children:[s.jsx(Tt,{className:"mb-2"}),s.jsx(On,{})]}),children:[s.jsx(Tt,{className:"mb-2"}),s.jsx(Tn,{})]})}),e[1]=i):i=e[1];let l;return e[2]!==n||e[3]!==r?(l=s.jsx(Bs,{children:s.jsx(Ti,{sections:r,onClose:n,footer:o,additionalContent:i})}),e[2]=n,e[3]=r,e[4]=l):l=e[4],l}function qc(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{"data-testid":"shell-route-loading",className:"absolute inset-0 flex items-center justify-center",children:s.jsx(Vt,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}export{yn as C,Vc as S,Wc as a,qc as b,It as c,ps as d,_n as e,vn as f};
@@ -1 +1 @@
1
- import{e as S,c as w,j as r,r as T,bn as A,bt as H,B as P}from"./index-DHxOddsj.js";import{i as R}from"./LayoutLeft-DwKLO_V_.js";import{u as V,c as D,a as B,T as E,b as z}from"./tooltip-6OktDyzD.js";import{b as W,d as G,S as L,c as q,a as F}from"./sheet-4GES45T2.js";const J="15rem",K="18rem",Q="4.5rem",k=T.createContext(null);function O(){const l=T.useContext(k);if(!l)throw new Error("useSidebar must be used within a SidebarProvider.");return l}function se(l){const e=S.c(19),{children:t,defaultOpen:s,open:a,onOpenChange:i}=l,d=s===void 0?!1:s,n=V(),[o,h]=T.useState(d),[u,g]=T.useState(!1),c=a!==void 0,b=c?a:o;let N;e[0]!==c||e[1]!==i?(N=_=>{c||h(_),i?.(_)},e[0]=c,e[1]=i,e[2]=N):N=e[2];const f=N;let j;e[3]!==n||e[4]!==b||e[5]!==f?(j=()=>{n?g(U):f(!b)},e[3]=n,e[4]=b,e[5]=f,e[6]=j):j=e[6];const y=j,m=b?"expanded":"collapsed";let p;e[7]!==n||e[8]!==b||e[9]!==u||e[10]!==f||e[11]!==m||e[12]!==y?(p={state:m,open:b,setOpen:f,isMobile:n,openMobile:u,setOpenMobile:g,toggleSidebar:y},e[7]=n,e[8]=b,e[9]=u,e[10]=f,e[11]=m,e[12]=y,e[13]=p):p=e[13];const v=p;let x;e[14]!==t?(x=r.jsx(D,{delayDuration:0,children:t}),e[14]=t,e[15]=x):x=e[15];let C;return e[16]!==v||e[17]!==x?(C=r.jsx(k.Provider,{value:v,children:x}),e[16]=v,e[17]=x,e[18]=C):C=e[18],C}function U(l){return!l}function ie(l){const e=S.c(14);let t,s,a,i;e[0]!==l?({className:s,style:i,children:t,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i):(t=e[1],s=e[2],a=e[3],i=e[4]);let d;e[5]!==i?(d={"--sidebar-width":J,"--sidebar-width-icon":Q,...i},e[5]=i,e[6]=d):d=e[6];const n=d;let o;e[7]!==s?(o=w("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",s),e[7]=s,e[8]=o):o=e[8];let h;return e[9]!==t||e[10]!==a||e[11]!==n||e[12]!==o?(h=r.jsx("div",{"data-slot":"sidebar-wrapper",style:n,className:o,...a,children:t}),e[9]=t,e[10]=a,e[11]=n,e[12]=o,e[13]=h):h=e[13],h}function le(l){const e=S.c(36);let t,s,a,i,d;e[0]!==l?({side:i,variant:d,className:s,children:t,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i,e[5]=d):(t=e[1],s=e[2],a=e[3],i=e[4],d=e[5]);const n=i===void 0?"left":i,o=d===void 0?"sidebar":d,{isMobile:h,state:u,openMobile:g,setOpenMobile:c}=O();if(h){let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C={"--sidebar-width":K},e[6]=C):C=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsxs(G,{className:"sr-only",children:[r.jsx(L,{children:"Sidebar"}),r.jsx(q,{children:"Displays the mobile sidebar."})]}),e[7]=_):_=e[7];let $;e[8]!==t?($=r.jsx("div",{className:"flex h-full w-full flex-col",children:t}),e[8]=t,e[9]=$):$=e[9];let M;e[10]!==n||e[11]!==$?(M=r.jsxs(F,{"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:n,children:[_,$]}),e[10]=n,e[11]=$,e[12]=M):M=e[12];let I;return e[13]!==g||e[14]!==a||e[15]!==c||e[16]!==M?(I=r.jsx(W,{open:g,onOpenChange:c,...a,children:M}),e[13]=g,e[14]=a,e[15]=c,e[16]=M,e[17]=I):I=e[17],I}const b=u==="expanded",N=b?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let f;e[18]!==N?(f=w("group/sidebar peer text-sidebar-foreground hidden md:flex flex-col shrink-0 overflow-hidden","transition-[width] duration-150 ease-out motion-reduce:transition-none",N),e[18]=N,e[19]=f):f=e[19];const j=b?void 0:"icon",y=b?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let m;e[20]!==s||e[21]!==y?(m=w("flex flex-col h-full transition-[width] duration-150 ease-out motion-reduce:transition-none",y,s),e[20]=s,e[21]=y,e[22]=m):m=e[22];let p;e[23]!==t?(p=r.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar flex h-full w-full flex-col",children:t}),e[23]=t,e[24]=p):p=e[24];let v;e[25]!==a||e[26]!==m||e[27]!==p?(v=r.jsx("div",{"data-slot":"sidebar-container",className:m,...a,children:p}),e[25]=a,e[26]=m,e[27]=p,e[28]=v):v=e[28];let x;return e[29]!==n||e[30]!==u||e[31]!==f||e[32]!==j||e[33]!==v||e[34]!==o?(x=r.jsx("div",{className:f,"data-state":u,"data-collapsible":j,"data-variant":o,"data-side":n,"data-slot":"sidebar",children:v}),e[29]=n,e[30]=u,e[31]=f,e[32]=j,e[33]=v,e[34]=o,e[35]=x):x=e[35],x}function re(l){const e=S.c(18);let t,s,a;e[0]!==l?({className:t,onClick:s,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a):(t=e[1],s=e[2],a=e[3]);const{toggleSidebar:i}=O();let d;e[4]!==t?(d=w("size-7",t),e[4]=t,e[5]=d):d=e[5];let n;e[6]!==s||e[7]!==i?(n=b=>{s?.(b),i()},e[6]=s,e[7]=i,e[8]=n):n=e[8];let o,h;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(R,{}),h=r.jsx("span",{className:"sr-only",children:"Toggle Sidebar"}),e[9]=o,e[10]=h):(o=e[9],h=e[10]);let u;e[11]!==a||e[12]!==d||e[13]!==n?(u=r.jsx(E,{asChild:!0,children:r.jsxs(P,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:d,onClick:n,...a,children:[o,h]})}),e[11]=a,e[12]=d,e[13]=n,e[14]=u):u=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsxs(B,{side:"bottom",className:"flex items-center gap-1.5",children:["Collapse sidebar",r.jsx("span",{className:"flex items-center gap-0.5",children:["⌘","B"].map(X)})]}),e[15]=g):g=e[15];let c;return e[16]!==u?(c=r.jsx(D,{delayDuration:300,children:r.jsxs(z,{children:[u,g]})}),e[16]=u,e[17]=c):c=e[17],c}function X(l){return r.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 h-5 px-1 rounded-sm border border-white/20 bg-white/10 text-white/70 text-xs font-mono",children:l},l)}function ne(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("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",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("main",{"data-slot":"sidebar-inset",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function oe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function de(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function ce(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("h-4 m-0! w-full",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-sidebar":"separator",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function fe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex min-h-0 flex-1 flex-col gap-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function ue(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function pe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("w-full text-sm overflow-visible",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function be(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex w-full min-w-0 list-none flex-col gap-1 group-data-[state=collapsed]/sidebar:items-center",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function me(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("group/menu-item relative w-full list-none",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}const Y=H("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg py-0 pr-0.5 pl-1.5 text-left text-sm outline-0 outline-sidebar-ring transition-[width,height,padding] duration-150 ease-out motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground 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 data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate group-data-[state=collapsed]/sidebar:[&>span:last-child]:hidden [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:opacity-60 hover:[&_svg]:opacity-100",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background ring-1 ring-sidebar-border hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:ring-sidebar-accent"},size:{default:"group-data-[state=expanded]/sidebar:h-8 group-data-[state=expanded]/sidebar:px-2 group-data-[state=collapsed]/sidebar:w-full! group-data-[state=collapsed]/sidebar:aspect-square! group-data-[state=collapsed]/sidebar:max-w-[calc(var(--sidebar-width-icon)-1rem)]! group-data-[state=collapsed]/sidebar:h-auto! group-data-[state=collapsed]/sidebar:p-0! group-data-[state=collapsed]/sidebar:mx-auto group-data-[state=collapsed]/sidebar:justify-center text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm p-0!"}},defaultVariants:{variant:"default",size:"default"}});function xe(l){const e=S.c(28);let t,s,a,i,d,n,o;e[0]!==l?({asChild:a,isActive:i,variant:d,size:n,tooltip:o,className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i,e[5]=d,e[6]=n,e[7]=o):(t=e[1],s=e[2],a=e[3],i=e[4],d=e[5],n=e[6],o=e[7]);const h=a===void 0?!1:a,u=i===void 0?!1:i,g=d===void 0?"default":d,c=n===void 0?"default":n,b=h?A:"button",{isMobile:N}=O();let f;e[8]!==t||e[9]!==c||e[10]!==g?(f=w(Y({variant:g,size:c}),t),e[8]=t,e[9]=c,e[10]=g,e[11]=f):f=e[11];let j;e[12]!==b||e[13]!==u||e[14]!==s||e[15]!==c||e[16]!==f?(j=r.jsx(b,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":c,"data-active":u,className:f,...s}),e[12]=b,e[13]=u,e[14]=s,e[15]=c,e[16]=f,e[17]=j):j=e[17];const y=j;if(!o)return y;if(typeof o=="string"){let x;e[18]!==o?(x={children:o},e[18]=o,e[19]=x):x=e[19],o=x}let m;e[20]!==y?(m=r.jsx(E,{asChild:!0,children:y}),e[20]=y,e[21]=m):m=e[21];let p;e[22]!==N||e[23]!==o?(p=r.jsx(B,{side:"right",align:"center",hidden:N,...o}),e[22]=N,e[23]=o,e[24]=p):p=e[24];let v;return e[25]!==m||e[26]!==p?(v=r.jsxs(z,{children:[m,p]}),e[25]=m,e[26]=p,e[27]=v):v=e[27],v}export{ne as S,ie as a,se as b,me as c,xe as d,ue as e,pe as f,be as g,ce as h,fe as i,le as j,oe as k,de as l,re as m,O as u};
1
+ import{e as S,c as w,j as r,r as T,bn as A,bt as H,B as P}from"./index-DjCrtoJM.js";import{i as R}from"./LayoutLeft-DOdRMzln.js";import{u as V,c as D,a as B,T as E,b as z}from"./tooltip-MvXJgTec.js";import{b as W,d as G,S as L,c as q,a as F}from"./sheet-BwcUAu7J.js";const J="15rem",K="18rem",Q="4.5rem",k=T.createContext(null);function O(){const l=T.useContext(k);if(!l)throw new Error("useSidebar must be used within a SidebarProvider.");return l}function se(l){const e=S.c(19),{children:t,defaultOpen:s,open:a,onOpenChange:i}=l,d=s===void 0?!1:s,n=V(),[o,h]=T.useState(d),[u,g]=T.useState(!1),c=a!==void 0,b=c?a:o;let N;e[0]!==c||e[1]!==i?(N=_=>{c||h(_),i?.(_)},e[0]=c,e[1]=i,e[2]=N):N=e[2];const f=N;let j;e[3]!==n||e[4]!==b||e[5]!==f?(j=()=>{n?g(U):f(!b)},e[3]=n,e[4]=b,e[5]=f,e[6]=j):j=e[6];const y=j,m=b?"expanded":"collapsed";let p;e[7]!==n||e[8]!==b||e[9]!==u||e[10]!==f||e[11]!==m||e[12]!==y?(p={state:m,open:b,setOpen:f,isMobile:n,openMobile:u,setOpenMobile:g,toggleSidebar:y},e[7]=n,e[8]=b,e[9]=u,e[10]=f,e[11]=m,e[12]=y,e[13]=p):p=e[13];const v=p;let x;e[14]!==t?(x=r.jsx(D,{delayDuration:0,children:t}),e[14]=t,e[15]=x):x=e[15];let C;return e[16]!==v||e[17]!==x?(C=r.jsx(k.Provider,{value:v,children:x}),e[16]=v,e[17]=x,e[18]=C):C=e[18],C}function U(l){return!l}function ie(l){const e=S.c(14);let t,s,a,i;e[0]!==l?({className:s,style:i,children:t,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i):(t=e[1],s=e[2],a=e[3],i=e[4]);let d;e[5]!==i?(d={"--sidebar-width":J,"--sidebar-width-icon":Q,...i},e[5]=i,e[6]=d):d=e[6];const n=d;let o;e[7]!==s?(o=w("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",s),e[7]=s,e[8]=o):o=e[8];let h;return e[9]!==t||e[10]!==a||e[11]!==n||e[12]!==o?(h=r.jsx("div",{"data-slot":"sidebar-wrapper",style:n,className:o,...a,children:t}),e[9]=t,e[10]=a,e[11]=n,e[12]=o,e[13]=h):h=e[13],h}function le(l){const e=S.c(36);let t,s,a,i,d;e[0]!==l?({side:i,variant:d,className:s,children:t,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i,e[5]=d):(t=e[1],s=e[2],a=e[3],i=e[4],d=e[5]);const n=i===void 0?"left":i,o=d===void 0?"sidebar":d,{isMobile:h,state:u,openMobile:g,setOpenMobile:c}=O();if(h){let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C={"--sidebar-width":K},e[6]=C):C=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsxs(G,{className:"sr-only",children:[r.jsx(L,{children:"Sidebar"}),r.jsx(q,{children:"Displays the mobile sidebar."})]}),e[7]=_):_=e[7];let $;e[8]!==t?($=r.jsx("div",{className:"flex h-full w-full flex-col",children:t}),e[8]=t,e[9]=$):$=e[9];let M;e[10]!==n||e[11]!==$?(M=r.jsxs(F,{"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:n,children:[_,$]}),e[10]=n,e[11]=$,e[12]=M):M=e[12];let I;return e[13]!==g||e[14]!==a||e[15]!==c||e[16]!==M?(I=r.jsx(W,{open:g,onOpenChange:c,...a,children:M}),e[13]=g,e[14]=a,e[15]=c,e[16]=M,e[17]=I):I=e[17],I}const b=u==="expanded",N=b?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let f;e[18]!==N?(f=w("group/sidebar peer text-sidebar-foreground hidden md:flex flex-col shrink-0 overflow-hidden","transition-[width] duration-150 ease-out motion-reduce:transition-none",N),e[18]=N,e[19]=f):f=e[19];const j=b?void 0:"icon",y=b?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let m;e[20]!==s||e[21]!==y?(m=w("flex flex-col h-full transition-[width] duration-150 ease-out motion-reduce:transition-none",y,s),e[20]=s,e[21]=y,e[22]=m):m=e[22];let p;e[23]!==t?(p=r.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar flex h-full w-full flex-col",children:t}),e[23]=t,e[24]=p):p=e[24];let v;e[25]!==a||e[26]!==m||e[27]!==p?(v=r.jsx("div",{"data-slot":"sidebar-container",className:m,...a,children:p}),e[25]=a,e[26]=m,e[27]=p,e[28]=v):v=e[28];let x;return e[29]!==n||e[30]!==u||e[31]!==f||e[32]!==j||e[33]!==v||e[34]!==o?(x=r.jsx("div",{className:f,"data-state":u,"data-collapsible":j,"data-variant":o,"data-side":n,"data-slot":"sidebar",children:v}),e[29]=n,e[30]=u,e[31]=f,e[32]=j,e[33]=v,e[34]=o,e[35]=x):x=e[35],x}function re(l){const e=S.c(18);let t,s,a;e[0]!==l?({className:t,onClick:s,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a):(t=e[1],s=e[2],a=e[3]);const{toggleSidebar:i}=O();let d;e[4]!==t?(d=w("size-7",t),e[4]=t,e[5]=d):d=e[5];let n;e[6]!==s||e[7]!==i?(n=b=>{s?.(b),i()},e[6]=s,e[7]=i,e[8]=n):n=e[8];let o,h;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(R,{}),h=r.jsx("span",{className:"sr-only",children:"Toggle Sidebar"}),e[9]=o,e[10]=h):(o=e[9],h=e[10]);let u;e[11]!==a||e[12]!==d||e[13]!==n?(u=r.jsx(E,{asChild:!0,children:r.jsxs(P,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:d,onClick:n,...a,children:[o,h]})}),e[11]=a,e[12]=d,e[13]=n,e[14]=u):u=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsxs(B,{side:"bottom",className:"flex items-center gap-1.5",children:["Collapse sidebar",r.jsx("span",{className:"flex items-center gap-0.5",children:["⌘","B"].map(X)})]}),e[15]=g):g=e[15];let c;return e[16]!==u?(c=r.jsx(D,{delayDuration:300,children:r.jsxs(z,{children:[u,g]})}),e[16]=u,e[17]=c):c=e[17],c}function X(l){return r.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 h-5 px-1 rounded-sm border border-white/20 bg-white/10 text-white/70 text-xs font-mono",children:l},l)}function ne(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("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",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("main",{"data-slot":"sidebar-inset",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function oe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function de(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function ce(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("h-4 m-0! w-full",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-sidebar":"separator",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function fe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex min-h-0 flex-1 flex-col gap-2",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function ue(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function pe(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("w-full text-sm overflow-visible",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function be(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("flex w-full min-w-0 list-none flex-col gap-1 group-data-[state=collapsed]/sidebar:items-center",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function me(l){const e=S.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=w("group/menu-item relative w-full list-none",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=r.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}const Y=H("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg py-0 pr-0.5 pl-1.5 text-left text-sm outline-0 outline-sidebar-ring transition-[width,height,padding] duration-150 ease-out motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground 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 data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate group-data-[state=collapsed]/sidebar:[&>span:last-child]:hidden [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:opacity-60 hover:[&_svg]:opacity-100",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background ring-1 ring-sidebar-border hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:ring-sidebar-accent"},size:{default:"group-data-[state=expanded]/sidebar:h-8 group-data-[state=expanded]/sidebar:px-2 group-data-[state=collapsed]/sidebar:w-full! group-data-[state=collapsed]/sidebar:aspect-square! group-data-[state=collapsed]/sidebar:max-w-[calc(var(--sidebar-width-icon)-1rem)]! group-data-[state=collapsed]/sidebar:h-auto! group-data-[state=collapsed]/sidebar:p-0! group-data-[state=collapsed]/sidebar:mx-auto group-data-[state=collapsed]/sidebar:justify-center text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm p-0!"}},defaultVariants:{variant:"default",size:"default"}});function xe(l){const e=S.c(28);let t,s,a,i,d,n,o;e[0]!==l?({asChild:a,isActive:i,variant:d,size:n,tooltip:o,className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i,e[5]=d,e[6]=n,e[7]=o):(t=e[1],s=e[2],a=e[3],i=e[4],d=e[5],n=e[6],o=e[7]);const h=a===void 0?!1:a,u=i===void 0?!1:i,g=d===void 0?"default":d,c=n===void 0?"default":n,b=h?A:"button",{isMobile:N}=O();let f;e[8]!==t||e[9]!==c||e[10]!==g?(f=w(Y({variant:g,size:c}),t),e[8]=t,e[9]=c,e[10]=g,e[11]=f):f=e[11];let j;e[12]!==b||e[13]!==u||e[14]!==s||e[15]!==c||e[16]!==f?(j=r.jsx(b,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":c,"data-active":u,className:f,...s}),e[12]=b,e[13]=u,e[14]=s,e[15]=c,e[16]=f,e[17]=j):j=e[17];const y=j;if(!o)return y;if(typeof o=="string"){let x;e[18]!==o?(x={children:o},e[18]=o,e[19]=x):x=e[19],o=x}let m;e[20]!==y?(m=r.jsx(E,{asChild:!0,children:y}),e[20]=y,e[21]=m):m=e[21];let p;e[22]!==N||e[23]!==o?(p=r.jsx(B,{side:"right",align:"center",hidden:N,...o}),e[22]=N,e[23]=o,e[24]=p):p=e[24];let v;return e[25]!==m||e[26]!==p?(v=r.jsxs(z,{children:[m,p]}),e[25]=m,e[26]=p,e[27]=v):v=e[27],v}export{ne as S,ie as a,se as b,me as c,xe as d,ue as e,pe as f,be as g,ce as h,fe as i,le as j,oe as k,de as l,re as m,O as u};
@@ -1 +1 @@
1
- import{e as n,c,j as i}from"./index-DHxOddsj.js";function m(o){const e=n.c(8);let s,t;e[0]!==o?({className:s,...t}=o,e[0]=o,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let l;e[3]!==s?(l=c("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==t||e[6]!==l?(a=i.jsx("div",{"data-slot":"skeleton",className:l,...t}),e[5]=t,e[6]=l,e[7]=a):a=e[7],a}export{m as S};
1
+ import{e as n,c,j as i}from"./index-DjCrtoJM.js";function m(o){const e=n.c(8);let s,t;e[0]!==o?({className:s,...t}=o,e[0]=o,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let l;e[3]!==s?(l=c("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==t||e[6]!==l?(a=i.jsx("div",{"data-slot":"skeleton",className:l,...t}),e[5]=t,e[6]=l,e[7]=a):a=e[7],a}export{m as S};
@@ -1,4 +1,4 @@
1
- import{q as an,b as kn,u as gr,H as mr,I as vr,j as i,B as He,o as Le,r as u,G as br,f as xr,l as It,M as Kt,J as Yt,t as ne,K as At,e as yr,p as wr,L as Cr,c as Sr,b5 as $,aU as ft}from"./index-DHxOddsj.js";import{g as Dr}from"./connection-slug-eyAPH6o3.js";import{u as Tn,a as _n,g as jr,C as Ht}from"./connection-card-ZCt-smg_.js";import{C as Rr}from"./collection-search-DHln9QoJ.js";import{C as Nr}from"./collection-tabs-BaiyS1az.js";import{g as Ir}from"./generate-id-CQZwmjfI.js";import{D as On,a as Mn,b as Pn,c as Ln,e as Ar,d as Er}from"./dialog-BnOLdErK.js";import{b as kr,a as Tr,c as _r,D as Or,d as Mr,e as Pr,f as Lr}from"./drawer-Be_zu0QX.js";import{u as zr,b as Wt,T as qt,a as Gt}from"./tooltip-6OktDyzD.js";import{F as De,b as je,c as Re,d as Ne,f as Ie,a as hn}from"./form-C_FOfVah.js";import{I as Ye}from"./input-C3YblD3D.js";import{d as Fr,S as $r,a as Br,b as Vr,c as ut}from"./select-LvZkQCcv.js";import{T as Xr}from"./textarea-CxRmk2pV.js";import{b as zn}from"./use-connection-Cygt3JAU.js";import{n as Et}from"./Container-B3y5dlGc.js";import{s as Jt}from"./Star01-DkpG4lGE.js";import{S as Ur}from"./agent-icon-cetEWq0Z.js";import{s as Kr}from"./XClose-Cnj8fI9u.js";import{c as Yr,i as St,a as pn,E as Hr,p as Wr,b as qr,d as Gr}from"./connection-form-helpers-B6JNJh-A.js";import{u as gn}from"./use-infinite-scroll-D7Lz32GP.js";import{u as Jr}from"./useSuspenseInfiniteQuery-Bdpr4GcQ.js";import{a as Qr,u as Zr}from"./use-mcp-client-Bbkq-Btq.js";import{g as eo,e as to,a as no}from"./extract-connection-data-bN8kltS6.js";import{B as Dt}from"./badge-CWyTrVve.js";import{c as Qt}from"./XCircle-D0Uf6feY.js";import{i as mn}from"./Check-Cl07asRj.js";import{s as ro}from"./Plus-Dx1SIiMT.js";function oo({open:t,onOpenChange:e,onCreated:n}){const{org:r}=an(),{data:o}=kn.useSession(),{stdioEnabled:s}=gr(),a=zr(),c=zn(),l=Tn(),h=_n(l,"").items,d=mr({resolver:vr(Yr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=d.watch("ui_type"),v=d.watch("connection_url"),N=d.watch("npx_package"),x=St({uiType:m,connectionUrl:v??"",npxPackage:N??""})??pn({uiType:m,connectionUrl:v??"",registryItems:h}),b=g=>{const p=g.trim();if(!p)return;const y=!!d.formState.dirtyFields.title,T=!!d.formState.dirtyFields.description,I=!!d.formState.dirtyFields.env_vars,S=O=>{if(O&&(!y&&!d.getValues("title").trim()&&O.title&&d.setValue("title",O.title,{shouldDirty:!1}),!T&&!(d.getValues("description")??"").trim()&&O.description&&d.setValue("description",O.description,{shouldDirty:!1}),!I&&O.envVarKeys?.length)){const K=d.getValues("env_vars")??[],B=new Set(K.map(V=>V.key)),P=O.envVarKeys.filter(V=>!B.has(V));P.length>0&&d.setValue("env_vars",[...K,...P.map(V=>({key:V,value:""}))],{shouldDirty:!0})}},A=Wr(p);if(A&&s){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",A.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),S(St({uiType:"NPX",npxPackage:A.packageName}));return}if(p.startsWith("http://")||p.startsWith("https://")){const O=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";d.setValue("ui_type",O,{shouldDirty:!0}),d.setValue("connection_url",p,{shouldDirty:!0}),S(St({uiType:O,connectionUrl:p})??pn({uiType:O,connectionUrl:p,registryItems:h}));return}m==="NPX"&&S(St({uiType:"NPX",npxPackage:p}))},R=g=>{g||d.reset(),e(g)},w=async g=>{let p,y=null,T=null,I=null;g.ui_type==="NPX"?(p="STDIO",y="",I=qr(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(p="STDIO",y="",I=Gr(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(p=g.ui_type,y=g.connection_url||"",T=g.connection_token||null);const S=Ir("conn");try{await c.create.mutateAsync({id:S,title:g.title,description:g.description||null,connection_type:p,connection_url:y,connection_token:T,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:I,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),n?.(S)}catch{Le.error("Failed to create connection")}},C="Create Connection",j="Create a custom connection in your organization. Fill in the details below.",k=d.formState.isSubmitting?"Saving...":"Create Connection",E=i.jsxs("div",{className:"grid gap-4",children:[i.jsx(De,{control:d.control,name:"ui_type",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Type *"}),i.jsxs(Fr,{value:g.value,onValueChange:g.onChange,children:[i.jsx(Ne,{children:i.jsx($r,{children:i.jsx(Br,{})})}),i.jsxs(Vr,{children:[i.jsx(ut,{value:"HTTP",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"HTTP"]})}),i.jsx(ut,{value:"SSE",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"SSE"]})}),i.jsx(ut,{value:"Websocket",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"Websocket"]})}),s&&i.jsxs(i.Fragment,{children:[i.jsx(ut,{value:"NPX",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Et,{className:"w-4 h-4"}),"NPX Package"]})}),i.jsx(ut,{value:"STDIO",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Ur,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),i.jsx(Ie,{})]})}),m==="NPX"&&i.jsx(De,{control:d.control,name:"npx_package",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"NPM Package *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"@perplexity-ai/mcp-server",...g,value:g.value??"",onPaste:p=>{const y=p.clipboardData.getData("text");y&&(p.preventDefault(),d.setValue("npx_package",y.trim(),{shouldDirty:!0}),b(y))},onBlur:p=>{b(p.target.value),g.onBlur()}})}),i.jsx(Ie,{})]})}),m==="STDIO"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[i.jsx(De,{control:d.control,name:"stdio_command",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Command *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"node, bun, python...",...g,value:g.value??""})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"stdio_args",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Arguments"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"arg1 arg2 --flag value",...g,value:g.value??""})}),i.jsx(Ie,{})]})})]}),i.jsx(De,{control:d.control,name:"stdio_cwd",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Working Directory"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"/path/to/project (optional)",...g,value:g.value??""})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),i.jsx(Ie,{})]})})]}),(m==="NPX"||m==="STDIO")&&i.jsx(De,{control:d.control,name:"env_vars",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Environment Variables"}),i.jsx(Ne,{children:i.jsx(Hr,{value:g.value??[],onChange:g.onChange})}),i.jsx(Ie,{})]})}),m!=="NPX"&&m!=="STDIO"&&i.jsxs(i.Fragment,{children:[i.jsx(De,{control:d.control,name:"connection_url",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"URL *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"https://example.com/mcp",...g,value:g.value??"",onPaste:p=>{const y=p.clipboardData.getData("text");y&&(p.preventDefault(),d.setValue("connection_url",y.trim(),{shouldDirty:!0}),b(y))},onBlur:p=>{b(p.target.value),g.onBlur()}})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"connection_token",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:x?.token?.label??"Token (optional)"}),i.jsx(Ne,{children:i.jsx(Ye,{type:"password",placeholder:x?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...g,value:g.value??""})}),x?.token?.helperText&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[x.token.helperText,x.id==="github"&&i.jsxs(i.Fragment,{children:[" ","·"," ",i.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),i.jsx(Ie,{})]})})]}),i.jsx(De,{control:d.control,name:"title",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Name *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"My Connection",...g})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"description",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Description"}),i.jsx(Ne,{children:i.jsx(Xr,{placeholder:"A brief description of this connection",rows:3,...g,value:g.value??""})}),i.jsx(Ie,{})]})})]});return a?i.jsx(kr,{open:t,onOpenChange:R,children:i.jsxs(Tr,{className:"max-h-[90vh]",children:[i.jsx(_r,{className:"pb-2",children:i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{className:"flex-1 text-left",children:[i.jsx(Or,{children:C}),i.jsx(Mr,{className:"mt-1",children:j})]}),i.jsx(Pr,{asChild:!0,children:i.jsx(He,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:i.jsx(Kr,{size:16})})})]})}),i.jsx(hn,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(w),children:[i.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:E}),i.jsx(Lr,{children:i.jsx(He,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:k})})]})})]})}):i.jsx(On,{open:t,onOpenChange:R,children:i.jsxs(Mn,{className:"sm:max-w-[525px]",children:[i.jsxs(Pn,{children:[i.jsx(Ln,{children:C}),i.jsx(Ar,{children:j})]}),i.jsx(hn,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(w),children:[i.jsx("div",{className:"py-4",children:E}),i.jsxs(Er,{children:[i.jsx(He,{type:"button",variant:"outline",onClick:()=>R(!1),children:"Cancel"}),i.jsx(He,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:k})]})]})})]})})}function so(t){const e=yr.c(73),{mode:n,agentId:r,addedConnectionIds:o,onAdd:s,onCloneAndAdd:a,onConnectAndAdd:c,connectingItemId:l,search:f,onCreateConnection:h,onBrowseNavigate:d,defaultTab:m}=t,v=n===void 0?"add":n,N=m===void 0?"connected":m,{org:x}=an(),b=u.useDeferredValue(f),R=f!==b,w=b.trim().toLowerCase();let C;e[0]!==N?(C=D=>D??N,e[0]=N,e[1]=C):C=e[1];const[j,k]=wr(Cr.connectionsTab(x.slug)+(N==="all"?":home-modal":":agent-modal"),C);let E;e[2]!==j||e[3]!==k?(E=D=>{D!==j&&ne("connections_dialog_tab_changed",{to_tab:D}),k(D)},e[2]=j,e[3]=k,e[4]=E):E=e[4];const g=E;let p;e[5]!==x.id||e[6]!==x.slug?(p={connectionId:Qr,orgId:x.id,orgSlug:x.slug},e[5]=x.id,e[6]=x.slug,e[7]=p):p=e[7];const y=Zr(p);let T,I,S;if(e[8]!==y||e[9]!==b||e[10]!==x.id){S=b?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b.trim()},{field:["description"],operator:"contains",value:b.trim()}]}:void 0;const D={...S&&{where:S},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},L=JSON.stringify(D);I=Jr,T=At.collectionListInfinite(y,x.id,"","CONNECTIONS",L),e[8]=y,e[9]=b,e[10]=x.id,e[11]=T,e[12]=I,e[13]=S}else T=e[11],I=e[12],S=e[13];let A;e[14]!==y||e[15]!==S?(A=async D=>{const{pageParam:L}=D,de=L===void 0?0:L;return(await y.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...S&&{where:S},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:de}})).structuredContent},e[14]=y,e[15]=S,e[16]=A):A=e[16];let O;e[17]!==T||e[18]!==A?(O={queryKey:T,queryFn:A,initialPageParam:0,getNextPageParam:fo,staleTime:3e4},e[17]=T,e[18]=A,e[19]=O):O=e[19];const{data:K,fetchNextPage:B,hasNextPage:P,isFetchingNextPage:V}=I(O),re=K?.pages.flatMap(uo)??[],xe=jr(re),qe=new Set(re.filter(lo).map(co)),X=Tn(),H=_n(X,b),he=gn(H.loadMore,H.hasMore,H.isLoadingMore),Ae=gn(B,P??!1,V),z=j==="all"||!!w,Ke=z?H.items.filter(D=>{const L=eo(D);if(L&&qe.has(L))return!1;if(!w)return!0;const de=D._meta?.["mcp.mesh"];return[D.title,D.description,D.name,D.server?.title,D.server?.description,D.server?.name,de?.friendly_name,de?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(w)}):[],Z=Ke.filter(ao),q=Ke.filter(io);let M;e[20]!==o?(M=D=>D.some(L=>o.has(L.id)),e[20]=o,e[21]=M):M=e[21];const Ee=M;let G;e[22]!==o||e[23]!==r||e[24]!==l||e[25]!==Ee||e[26]!==v||e[27]!==s||e[28]!==d||e[29]!==a?(G=(D,L,de,Fe,me)=>{const Ze=Ee(me),$e=me.find(F=>!o.has(F.id)),te=me[0];if(v==="browse"){const F=Dr(te);return i.jsx(Ht,{connection:{title:L,icon:de,description:me.length>1?`${me.length} instances`:Fe??void 0},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs(Dt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[i.jsx(mn,{size:11})," Connected"]}),onClick:()=>{ne("connection_browse_clicked",{app_name:te.app_name??null,connection_id:te.id,instances_count:me.length}),d?.(F)}},D)}return i.jsx(Ht,{connection:{title:L,icon:de,description:Fe},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs("div",{className:"flex items-center gap-1.5",children:[Ze&&i.jsxs(Dt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[i.jsx(mn,{size:11})," Added"]}),i.jsx(He,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:F=>{F.stopPropagation(),$e?(ne("connection_add_clicked",{action:"use_existing",app_name:te.app_name??null,connection_id:$e.id}),r&&ne("agent_connection_attached",{agent_id:r,connection_id:$e.id,app_name:te.app_name??null,mode:"existing"}),s($e.id)):(ne("connection_add_clicked",{action:"clone",app_name:te.app_name??null,base_connection_id:te.id}),a(te))},children:"Add"})]})},D)},e[22]=o,e[23]=r,e[24]=l,e[25]=Ee,e[26]=v,e[27]=s,e[28]=d,e[29]=a,e[30]=G):G=e[30];const pe=G;let ee;e[31]!==l||e[32]!==v||e[33]!==c?(ee=D=>{const L=D._meta?.["mcp.mesh"],de=L?.friendlyName||L?.friendly_name||D.server?.title||D.title||D.server?.name||D.name||D.id||"",Fe=D.server?.description||D.description||null,me=D.server?.icons?.[0]?.src||no(D.server?.repository)||null,Ze=L?.official===!0,$e=L?.verified===!0,te=L?.owner==="deco";return i.jsx(Ht,{connection:{title:de,description:Fe,icon:me},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs("div",{className:"flex items-center gap-1.5",children:[te&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:i.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),i.jsx(Gt,{children:"Built and maintained by Deco"})]}),!te&&Ze&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx(Dt,{variant:"outline",size:"icon",children:i.jsx(Qt,{})})}),i.jsx(Gt,{children:"Built and maintained by the official vendor"})]}),!te&&!Ze&&$e&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx(Dt,{variant:"outline",size:"icon",children:i.jsx(Qt,{})})}),i.jsx(Gt,{children:"Verified by the Deco team"})]}),i.jsx(He,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:F=>{F.stopPropagation(),ne("connection_add_clicked",{action:"connect_new",registry_item_id:D.id,app_name:L?.friendlyName||D.server?.name||D.name||null}),c(D)},children:l===D.id?i.jsx(It,{size:14,className:"animate-spin"}):v==="browse"?"Connect":"Add"})]})},`catalog-${D.id}`)},e[31]=l,e[32]=v,e[33]=c,e[34]=ee):ee=e[34];const ke=ee,ye=!w&&i.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[i.jsx(Nr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:D=>g(D)}),i.jsxs(He,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{ne("connections_dialog_custom_clicked"),h()},children:[i.jsx(ro,{size:12}),"Custom Connection"]})]}),Ge=R&&"opacity-50 pointer-events-none";let Te;e[35]!==Ge?(Te=Sr("flex-1 overflow-auto p-5 transition-opacity duration-150",Ge),e[35]=Ge,e[36]=Te):Te=e[36];const st="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let oe;e[37]!==pe?(oe=D=>{if(D.type==="group")return pe(D.key,D.title,D.icon,null,D.connections);const L=D.connection;return pe(L.id,L.title,L.icon,L.description??null,[L])},e[37]=pe,e[38]=oe):oe=e[38];const ze=xe.map(oe);let ge;e[39]!==Ae?(ge=i.jsx("div",{ref:Ae,className:"col-span-full h-1"}),e[39]=Ae,e[40]=ge):ge=e[40];let _e;e[41]!==V?(_e=V&&i.jsx("div",{className:"col-span-full flex justify-center py-6",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=V,e[42]=_e):_e=e[42];const Je=z&&Z.length>0&&i.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[i.jsx(Qt,{size:13,className:"text-muted-foreground shrink-0"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),i.jsx("div",{className:"flex-1 h-px bg-border"})]}),it=z&&Z.map(ke),at=z&&q.length>0&&i.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[i.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),i.jsx("div",{className:"flex-1 h-px bg-border"})]}),we=z&&q.map(ke);let se;e[43]!==he||e[44]!==X||e[45]!==z?(se=z&&X.length>0&&i.jsx("div",{ref:he,className:"col-span-full h-1"}),e[43]=he,e[44]=X,e[45]=z,e[46]=se):se=e[46];let le;e[47]!==H.isLoadingMore||e[48]!==z?(le=z&&H.isLoadingMore&&i.jsx("div",{className:"col-span-full flex justify-center py-6",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=z,e[49]=le):le=e[49];let Oe;e[50]!==ze||e[51]!==ge||e[52]!==_e||e[53]!==Je||e[54]!==it||e[55]!==at||e[56]!==we||e[57]!==se||e[58]!==le?(Oe=i.jsxs("div",{className:st,children:[ze,ge,_e,Je,it,at,we,se,le]}),e[50]=ze,e[51]=ge,e[52]=_e,e[53]=Je,e[54]=it,e[55]=at,e[56]=we,e[57]=se,e[58]=le,e[59]=Oe):Oe=e[59];let J;e[60]!==j||e[61]!==xe.length||e[62]!==q||e[63]!==f||e[64]!==Z?(J=xe.length===0&&Z.length===0&&q.length===0&&i.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:f?`No connections match "${f}"`:j==="connected"?"No connections yet":"No connections available"}),e[60]=j,e[61]=xe.length,e[62]=q,e[63]=f,e[64]=Z,e[65]=J):J=e[65];let Me;e[66]!==Te||e[67]!==Oe||e[68]!==J?(Me=i.jsxs("div",{className:Te,children:[Oe,J]}),e[66]=Te,e[67]=Oe,e[68]=J,e[69]=Me):Me=e[69];let Qe;return e[70]!==ye||e[71]!==Me?(Qe=i.jsxs(i.Fragment,{children:[ye,Me]}),e[70]=ye,e[71]=Me,e[72]=Qe):Qe=e[72],Qe}function io(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function ao(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function co(t){return t.app_name}function lo(t){return t.app_name}function uo(t){return t?.items??[]}function fo(t,e){if(t?.hasMore)return e.reduce(ho,0)}function ho(t,e){return t+(e?.items?.length??0)}function Ai({open:t,onOpenChange:e,defaultTab:n,initialSearch:r="",...o}){const s=o.mode??"add",a="agentId"in o?o.agentId:void 0,c="addedConnectionIds"in o?o.addedConnectionIds??new Set:new Set,l="onAdd"in o&&o.onAdd?o.onAdd:p=>{},f=(p,y,T)=>{a&&ne("agent_connection_attached",{agent_id:a,connection_id:p,app_name:y,mode:T})},[h,d]=u.useState(null),[m,v]=u.useState(r),[N,x]=u.useState(!1),{org:b}=an(),{data:R}=kn.useSession(),w=zn(),C=br(),j=xr(),k=p=>{e(!1),j({to:"/$org/settings/connections/$appSlug",params:{org:b.slug,appSlug:p}})},E=async p=>{d(p.app_name??p.id);try{const T=`${p.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,S=(await w.create.mutateAsync({title:T,description:p.description??null,connection_type:p.connection_type,connection_url:p.connection_url??null,connection_token:null,icon:p.icon??null,app_name:p.app_name??null,app_id:p.app_id??null,connection_headers:p.connection_headers??null})).id,A=new URL(`/api/${b.slug}/mcp/${S}`,window.location.origin),O=await Kt({url:A.href,token:null,orgId:b.id});if(O.supportsOAuth&&!O.isAuthenticated){const{token:K,tokenInfo:B,error:P}=await Yt({connectionId:S,orgSlug:b.slug,scope:"offline_access"});if(P||!K){ne("connection_oauth_failed",{connection_id:S,flow:"clone",error:P??"no_token"}),Le.error(`Authentication failed: ${P??"no token received"}`),await w.delete.mutateAsync(S);return}if(ne("connection_oauth_succeeded",{connection_id:S,flow:"clone"}),B)try{(await fetch(`/api/${b.slug}/connections/${S}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:B.accessToken,refreshToken:B.refreshToken,expiresIn:B.expiresIn,scope:B.scope,clientId:B.clientId,clientSecret:B.clientSecret,tokenEndpoint:B.tokenEndpoint})})).ok?await w.update.mutateAsync({id:S,data:{}}):await w.update.mutateAsync({id:S,data:{connection_token:K}})}catch{await w.update.mutateAsync({id:S,data:{connection_token:K}})}else await w.update.mutateAsync({id:S,data:{connection_token:K}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(A.href,null)})}f(S,p.app_name??null,"clone"),l(S)}catch(y){console.error("Failed to add connection:",y),Le.error("Failed to add connection")}finally{d(null)}},g=async p=>{if(!(!b||!R?.user?.id)){d(p.id);try{const y=to(p,b.id,R.user.id,{remoteIndex:0}),T=y.connection_type==="STDIO",I=!!y.connection_url,S=T&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!S){Le.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:A}=await w.create.mutateAsync(y),O=new URL(`/api/${b.slug}/mcp/${A}`,window.location.origin),K=await Kt({url:O.href,token:null,orgId:b.id});if(K.supportsOAuth&&!K.isAuthenticated){const{token:B,tokenInfo:P,error:V}=await Yt({connectionId:A,orgSlug:b.slug,scope:"offline_access"});if(V||!B){ne("connection_oauth_failed",{connection_id:A,flow:"connect_new",error:V??"no_token"}),Le.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${V??"no token received"})`}),f(A,y.app_name??null,"new"),l(A);return}if(ne("connection_oauth_succeeded",{connection_id:A,flow:"connect_new"}),P)try{(await fetch(`/api/${b.slug}/connections/${A}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:P.accessToken,refreshToken:P.refreshToken,expiresIn:P.expiresIn,scope:P.scope,clientId:P.clientId,clientSecret:P.clientSecret,tokenEndpoint:P.tokenEndpoint})})).ok?await w.update.mutateAsync({id:A,data:{}}):await w.update.mutateAsync({id:A,data:{connection_token:B}})}catch{await w.update.mutateAsync({id:A,data:{connection_token:B}})}else await w.update.mutateAsync({id:A,data:{connection_token:B}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(O.href,null)}),Le.success("Connected and authenticated")}else Le.success("Connected");f(A,y.app_name??null,"new"),l(A)}catch(y){console.error("Failed to connect:",y),Le.error("Failed to connect")}finally{d(null)}}};return i.jsxs(On,{open:t,onOpenChange:e,children:[i.jsxs(Mn,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[i.jsx(Pn,{className:"px-6 pt-5 pb-0 shrink-0",children:i.jsx(Ln,{className:"text-base font-semibold",children:s==="browse"?"Connections":"Add Connection"})}),i.jsx("div",{className:"pt-3 shrink-0",children:i.jsx(Rr,{value:m,onChange:v,placeholder:"Search connections..."})}),i.jsx(u.Suspense,{fallback:i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),children:i.jsx(so,{mode:s,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:E,onConnectAndAdd:g,connectingItemId:h,search:m,onCreateConnection:()=>x(!0),onBrowseNavigate:k,defaultTab:n})})]}),i.jsx(oo,{open:N,onOpenChange:x,onCreated:async p=>{x(!1);const y=new URL(`/api/${b.slug}/mcp/${p}`,window.location.origin),T=await Kt({url:y.href,token:null,orgId:b.id});if(T.supportsOAuth&&!T.isAuthenticated){const{token:I,tokenInfo:S,error:A}=await Yt({connectionId:p,orgSlug:b.slug,scope:"offline_access"});if(A||!I){ne("connection_oauth_failed",{connection_id:p,flow:"custom_create",error:A??"no_token"}),Le.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${A??"no token received"})`}),f(p,null,"custom"),l(p),e(!1);return}if(ne("connection_oauth_succeeded",{connection_id:p,flow:"custom_create"}),S)try{(await fetch(`/api/${b.slug}/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:S.accessToken,refreshToken:S.refreshToken,expiresIn:S.expiresIn,scope:S.scope,clientId:S.clientId,clientSecret:S.clientSecret,tokenEndpoint:S.tokenEndpoint})})).ok?await w.update.mutateAsync({id:p,data:{}}):await w.update.mutateAsync({id:p,data:{connection_token:I}})}catch{await w.update.mutateAsync({id:p,data:{connection_token:I}})}else await w.update.mutateAsync({id:p,data:{connection_token:I}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(y.href,null)})}f(p,null,"custom"),l(p),e(!1)}})]})}function Ei(t){const e=t?.metadata?.githubRepo;return e?e.connectionId?t?.connections?.some(r=>r.connection_id===e.connectionId)?e:null:e:null}function po(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return u.useMemo(()=>r=>{e.forEach(o=>o(r))},e)}const zt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nt(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function cn(t){return"nodeType"in t}function Q(t){var e,n;return t?nt(t)?t:cn(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function ln(t){const{Document:e}=Q(t);return t instanceof e}function xt(t){return nt(t)?!1:t instanceof Q(t).HTMLElement}function Fn(t){return t instanceof Q(t).SVGElement}function rt(t){return t?nt(t)?t.document:cn(t)?ln(t)?t:xt(t)||Fn(t)?t.ownerDocument:document:document:document}const ve=zt?u.useLayoutEffect:u.useEffect;function Ft(t){const e=u.useRef(t);return ve(()=>{e.current=t}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function go(){const t=u.useRef(null),e=u.useCallback((r,o)=>{t.current=setInterval(r,o)},[]),n=u.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function mt(t,e){e===void 0&&(e=[t]);const n=u.useRef(t);return ve(()=>{n.current!==t&&(n.current=t)},e),n}function yt(t,e){const n=u.useRef();return u.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Tt(t){const e=Ft(t),n=u.useRef(null),r=u.useCallback(o=>{o!==n.current&&e?.(o,n.current),n.current=o},[]);return[n,r]}function _t(t){const e=u.useRef();return u.useEffect(()=>{e.current=t},[t]),e.current}let Zt={};function wt(t,e){return u.useMemo(()=>{if(e)return e;const n=Zt[t]==null?0:Zt[t]+1;return Zt[t]=n,t+"-"+n},[t,e])}function $n(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const c=Object.entries(a);for(const[l,f]of c){const h=s[l];h!=null&&(s[l]=h+t*f)}return s},{...e})}}const tt=$n(1),vt=$n(-1);function mo(t){return"clientX"in t&&"clientY"in t}function $t(t){if(!t)return!1;const{KeyboardEvent:e}=Q(t.target);return e&&t instanceof e}function vo(t){if(!t)return!1;const{TouchEvent:e}=Q(t.target);return e&&t instanceof e}function Ot(t){if(vo(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return mo(t)?{x:t.clientX,y:t.clientY}:null}const We=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[We.Translate.toString(t),We.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),vn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bo(t){return t.matches(vn)?t:t.querySelector(vn)}const xo={display:"none"};function yo(t){let{id:e,value:n}=t;return $.createElement("div",{id:e,style:xo},n)}function wo(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return $.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Co(){const[t,e]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const Bn=u.createContext(null);function So(t){const e=u.useContext(Bn);u.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Do(){const[t]=u.useState(()=>new Set),e=u.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[u.useCallback(r=>{let{type:o,event:s}=r;t.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,s)})},[t]),e]}const jo={draggable:`
1
+ import{q as an,b as kn,u as gr,H as mr,I as vr,j as i,B as He,o as Le,r as u,G as br,f as xr,l as It,M as Kt,J as Yt,t as ne,K as At,e as yr,p as wr,L as Cr,c as Sr,b5 as $,aU as ft}from"./index-DjCrtoJM.js";import{g as Dr}from"./connection-slug-eyAPH6o3.js";import{u as Tn,a as _n,g as jr,C as Ht}from"./connection-card-J_g5yRQM.js";import{C as Rr}from"./collection-search-CFFTRK3x.js";import{C as Nr}from"./collection-tabs-Da8fu2pB.js";import{g as Ir}from"./generate-id-DCN1LrlB.js";import{D as On,a as Mn,b as Pn,c as Ln,e as Ar,d as Er}from"./dialog-B4Gk40Ec.js";import{b as kr,a as Tr,c as _r,D as Or,d as Mr,e as Pr,f as Lr}from"./drawer-C8AwBmXm.js";import{u as zr,b as Wt,T as qt,a as Gt}from"./tooltip-MvXJgTec.js";import{F as De,b as je,c as Re,d as Ne,f as Ie,a as hn}from"./form-DzqpARCW.js";import{I as Ye}from"./input-odGTsdHi.js";import{d as Fr,S as $r,a as Br,b as Vr,c as ut}from"./select-B1gidrpT.js";import{T as Xr}from"./textarea-DkHK4zFC.js";import{b as zn}from"./use-connection-C7K5Qf-S.js";import{n as Et}from"./Container-Dt-ev6Gi.js";import{s as Jt}from"./Star01-ChWAyIjY.js";import{S as Ur}from"./agent-icon-DbC1U9Lv.js";import{s as Kr}from"./XClose-D4SdKRIc.js";import{c as Yr,i as St,a as pn,E as Hr,p as Wr,b as qr,d as Gr}from"./connection-form-helpers-0bmqzhLl.js";import{u as gn}from"./use-infinite-scroll-CHxQ8pHV.js";import{u as Jr}from"./useSuspenseInfiniteQuery-BHYoMCUL.js";import{a as Qr,u as Zr}from"./use-mcp-client-Wf5qUXFF.js";import{g as eo,e as to,a as no}from"./extract-connection-data-Cdme2PYD.js";import{B as Dt}from"./badge-CjjK5Sr7.js";import{c as Qt}from"./XCircle-Bz32In76.js";import{i as mn}from"./Check-CkY-NLLZ.js";import{s as ro}from"./Plus-DrYyBDmj.js";function oo({open:t,onOpenChange:e,onCreated:n}){const{org:r}=an(),{data:o}=kn.useSession(),{stdioEnabled:s}=gr(),a=zr(),c=zn(),l=Tn(),h=_n(l,"").items,d=mr({resolver:vr(Yr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=d.watch("ui_type"),v=d.watch("connection_url"),N=d.watch("npx_package"),x=St({uiType:m,connectionUrl:v??"",npxPackage:N??""})??pn({uiType:m,connectionUrl:v??"",registryItems:h}),b=g=>{const p=g.trim();if(!p)return;const y=!!d.formState.dirtyFields.title,T=!!d.formState.dirtyFields.description,I=!!d.formState.dirtyFields.env_vars,S=O=>{if(O&&(!y&&!d.getValues("title").trim()&&O.title&&d.setValue("title",O.title,{shouldDirty:!1}),!T&&!(d.getValues("description")??"").trim()&&O.description&&d.setValue("description",O.description,{shouldDirty:!1}),!I&&O.envVarKeys?.length)){const K=d.getValues("env_vars")??[],B=new Set(K.map(V=>V.key)),P=O.envVarKeys.filter(V=>!B.has(V));P.length>0&&d.setValue("env_vars",[...K,...P.map(V=>({key:V,value:""}))],{shouldDirty:!0})}},A=Wr(p);if(A&&s){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",A.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),S(St({uiType:"NPX",npxPackage:A.packageName}));return}if(p.startsWith("http://")||p.startsWith("https://")){const O=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";d.setValue("ui_type",O,{shouldDirty:!0}),d.setValue("connection_url",p,{shouldDirty:!0}),S(St({uiType:O,connectionUrl:p})??pn({uiType:O,connectionUrl:p,registryItems:h}));return}m==="NPX"&&S(St({uiType:"NPX",npxPackage:p}))},R=g=>{g||d.reset(),e(g)},w=async g=>{let p,y=null,T=null,I=null;g.ui_type==="NPX"?(p="STDIO",y="",I=qr(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(p="STDIO",y="",I=Gr(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(p=g.ui_type,y=g.connection_url||"",T=g.connection_token||null);const S=Ir("conn");try{await c.create.mutateAsync({id:S,title:g.title,description:g.description||null,connection_type:p,connection_url:y,connection_token:T,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:I,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),n?.(S)}catch{Le.error("Failed to create connection")}},C="Create Connection",j="Create a custom connection in your organization. Fill in the details below.",k=d.formState.isSubmitting?"Saving...":"Create Connection",E=i.jsxs("div",{className:"grid gap-4",children:[i.jsx(De,{control:d.control,name:"ui_type",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Type *"}),i.jsxs(Fr,{value:g.value,onValueChange:g.onChange,children:[i.jsx(Ne,{children:i.jsx($r,{children:i.jsx(Br,{})})}),i.jsxs(Vr,{children:[i.jsx(ut,{value:"HTTP",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"HTTP"]})}),i.jsx(ut,{value:"SSE",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"SSE"]})}),i.jsx(ut,{value:"Websocket",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Jt,{className:"w-4 h-4"}),"Websocket"]})}),s&&i.jsxs(i.Fragment,{children:[i.jsx(ut,{value:"NPX",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Et,{className:"w-4 h-4"}),"NPX Package"]})}),i.jsx(ut,{value:"STDIO",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Ur,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),i.jsx(Ie,{})]})}),m==="NPX"&&i.jsx(De,{control:d.control,name:"npx_package",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"NPM Package *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"@perplexity-ai/mcp-server",...g,value:g.value??"",onPaste:p=>{const y=p.clipboardData.getData("text");y&&(p.preventDefault(),d.setValue("npx_package",y.trim(),{shouldDirty:!0}),b(y))},onBlur:p=>{b(p.target.value),g.onBlur()}})}),i.jsx(Ie,{})]})}),m==="STDIO"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[i.jsx(De,{control:d.control,name:"stdio_command",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Command *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"node, bun, python...",...g,value:g.value??""})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"stdio_args",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Arguments"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"arg1 arg2 --flag value",...g,value:g.value??""})}),i.jsx(Ie,{})]})})]}),i.jsx(De,{control:d.control,name:"stdio_cwd",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Working Directory"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"/path/to/project (optional)",...g,value:g.value??""})}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),i.jsx(Ie,{})]})})]}),(m==="NPX"||m==="STDIO")&&i.jsx(De,{control:d.control,name:"env_vars",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Environment Variables"}),i.jsx(Ne,{children:i.jsx(Hr,{value:g.value??[],onChange:g.onChange})}),i.jsx(Ie,{})]})}),m!=="NPX"&&m!=="STDIO"&&i.jsxs(i.Fragment,{children:[i.jsx(De,{control:d.control,name:"connection_url",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"URL *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"https://example.com/mcp",...g,value:g.value??"",onPaste:p=>{const y=p.clipboardData.getData("text");y&&(p.preventDefault(),d.setValue("connection_url",y.trim(),{shouldDirty:!0}),b(y))},onBlur:p=>{b(p.target.value),g.onBlur()}})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"connection_token",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:x?.token?.label??"Token (optional)"}),i.jsx(Ne,{children:i.jsx(Ye,{type:"password",placeholder:x?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...g,value:g.value??""})}),x?.token?.helperText&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[x.token.helperText,x.id==="github"&&i.jsxs(i.Fragment,{children:[" ","·"," ",i.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),i.jsx(Ie,{})]})})]}),i.jsx(De,{control:d.control,name:"title",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Name *"}),i.jsx(Ne,{children:i.jsx(Ye,{placeholder:"My Connection",...g})}),i.jsx(Ie,{})]})}),i.jsx(De,{control:d.control,name:"description",render:({field:g})=>i.jsxs(je,{children:[i.jsx(Re,{children:"Description"}),i.jsx(Ne,{children:i.jsx(Xr,{placeholder:"A brief description of this connection",rows:3,...g,value:g.value??""})}),i.jsx(Ie,{})]})})]});return a?i.jsx(kr,{open:t,onOpenChange:R,children:i.jsxs(Tr,{className:"max-h-[90vh]",children:[i.jsx(_r,{className:"pb-2",children:i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{className:"flex-1 text-left",children:[i.jsx(Or,{children:C}),i.jsx(Mr,{className:"mt-1",children:j})]}),i.jsx(Pr,{asChild:!0,children:i.jsx(He,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:i.jsx(Kr,{size:16})})})]})}),i.jsx(hn,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(w),children:[i.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:E}),i.jsx(Lr,{children:i.jsx(He,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:k})})]})})]})}):i.jsx(On,{open:t,onOpenChange:R,children:i.jsxs(Mn,{className:"sm:max-w-[525px]",children:[i.jsxs(Pn,{children:[i.jsx(Ln,{children:C}),i.jsx(Ar,{children:j})]}),i.jsx(hn,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(w),children:[i.jsx("div",{className:"py-4",children:E}),i.jsxs(Er,{children:[i.jsx(He,{type:"button",variant:"outline",onClick:()=>R(!1),children:"Cancel"}),i.jsx(He,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:k})]})]})})]})})}function so(t){const e=yr.c(73),{mode:n,agentId:r,addedConnectionIds:o,onAdd:s,onCloneAndAdd:a,onConnectAndAdd:c,connectingItemId:l,search:f,onCreateConnection:h,onBrowseNavigate:d,defaultTab:m}=t,v=n===void 0?"add":n,N=m===void 0?"connected":m,{org:x}=an(),b=u.useDeferredValue(f),R=f!==b,w=b.trim().toLowerCase();let C;e[0]!==N?(C=D=>D??N,e[0]=N,e[1]=C):C=e[1];const[j,k]=wr(Cr.connectionsTab(x.slug)+(N==="all"?":home-modal":":agent-modal"),C);let E;e[2]!==j||e[3]!==k?(E=D=>{D!==j&&ne("connections_dialog_tab_changed",{to_tab:D}),k(D)},e[2]=j,e[3]=k,e[4]=E):E=e[4];const g=E;let p;e[5]!==x.id||e[6]!==x.slug?(p={connectionId:Qr,orgId:x.id,orgSlug:x.slug},e[5]=x.id,e[6]=x.slug,e[7]=p):p=e[7];const y=Zr(p);let T,I,S;if(e[8]!==y||e[9]!==b||e[10]!==x.id){S=b?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b.trim()},{field:["description"],operator:"contains",value:b.trim()}]}:void 0;const D={...S&&{where:S},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},L=JSON.stringify(D);I=Jr,T=At.collectionListInfinite(y,x.id,"","CONNECTIONS",L),e[8]=y,e[9]=b,e[10]=x.id,e[11]=T,e[12]=I,e[13]=S}else T=e[11],I=e[12],S=e[13];let A;e[14]!==y||e[15]!==S?(A=async D=>{const{pageParam:L}=D,de=L===void 0?0:L;return(await y.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...S&&{where:S},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:de}})).structuredContent},e[14]=y,e[15]=S,e[16]=A):A=e[16];let O;e[17]!==T||e[18]!==A?(O={queryKey:T,queryFn:A,initialPageParam:0,getNextPageParam:fo,staleTime:3e4},e[17]=T,e[18]=A,e[19]=O):O=e[19];const{data:K,fetchNextPage:B,hasNextPage:P,isFetchingNextPage:V}=I(O),re=K?.pages.flatMap(uo)??[],xe=jr(re),qe=new Set(re.filter(lo).map(co)),X=Tn(),H=_n(X,b),he=gn(H.loadMore,H.hasMore,H.isLoadingMore),Ae=gn(B,P??!1,V),z=j==="all"||!!w,Ke=z?H.items.filter(D=>{const L=eo(D);if(L&&qe.has(L))return!1;if(!w)return!0;const de=D._meta?.["mcp.mesh"];return[D.title,D.description,D.name,D.server?.title,D.server?.description,D.server?.name,de?.friendly_name,de?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(w)}):[],Z=Ke.filter(ao),q=Ke.filter(io);let M;e[20]!==o?(M=D=>D.some(L=>o.has(L.id)),e[20]=o,e[21]=M):M=e[21];const Ee=M;let G;e[22]!==o||e[23]!==r||e[24]!==l||e[25]!==Ee||e[26]!==v||e[27]!==s||e[28]!==d||e[29]!==a?(G=(D,L,de,Fe,me)=>{const Ze=Ee(me),$e=me.find(F=>!o.has(F.id)),te=me[0];if(v==="browse"){const F=Dr(te);return i.jsx(Ht,{connection:{title:L,icon:de,description:me.length>1?`${me.length} instances`:Fe??void 0},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs(Dt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[i.jsx(mn,{size:11})," Connected"]}),onClick:()=>{ne("connection_browse_clicked",{app_name:te.app_name??null,connection_id:te.id,instances_count:me.length}),d?.(F)}},D)}return i.jsx(Ht,{connection:{title:L,icon:de,description:Fe},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs("div",{className:"flex items-center gap-1.5",children:[Ze&&i.jsxs(Dt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[i.jsx(mn,{size:11})," Added"]}),i.jsx(He,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:F=>{F.stopPropagation(),$e?(ne("connection_add_clicked",{action:"use_existing",app_name:te.app_name??null,connection_id:$e.id}),r&&ne("agent_connection_attached",{agent_id:r,connection_id:$e.id,app_name:te.app_name??null,mode:"existing"}),s($e.id)):(ne("connection_add_clicked",{action:"clone",app_name:te.app_name??null,base_connection_id:te.id}),a(te))},children:"Add"})]})},D)},e[22]=o,e[23]=r,e[24]=l,e[25]=Ee,e[26]=v,e[27]=s,e[28]=d,e[29]=a,e[30]=G):G=e[30];const pe=G;let ee;e[31]!==l||e[32]!==v||e[33]!==c?(ee=D=>{const L=D._meta?.["mcp.mesh"],de=L?.friendlyName||L?.friendly_name||D.server?.title||D.title||D.server?.name||D.name||D.id||"",Fe=D.server?.description||D.description||null,me=D.server?.icons?.[0]?.src||no(D.server?.repository)||null,Ze=L?.official===!0,$e=L?.verified===!0,te=L?.owner==="deco";return i.jsx(Ht,{connection:{title:de,description:Fe,icon:me},fallbackIcon:i.jsx(Et,{}),headerActionsAlwaysVisible:!0,headerActions:i.jsxs("div",{className:"flex items-center gap-1.5",children:[te&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:i.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),i.jsx(Gt,{children:"Built and maintained by Deco"})]}),!te&&Ze&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx(Dt,{variant:"outline",size:"icon",children:i.jsx(Qt,{})})}),i.jsx(Gt,{children:"Built and maintained by the official vendor"})]}),!te&&!Ze&&$e&&i.jsxs(Wt,{children:[i.jsx(qt,{asChild:!0,children:i.jsx(Dt,{variant:"outline",size:"icon",children:i.jsx(Qt,{})})}),i.jsx(Gt,{children:"Verified by the Deco team"})]}),i.jsx(He,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:F=>{F.stopPropagation(),ne("connection_add_clicked",{action:"connect_new",registry_item_id:D.id,app_name:L?.friendlyName||D.server?.name||D.name||null}),c(D)},children:l===D.id?i.jsx(It,{size:14,className:"animate-spin"}):v==="browse"?"Connect":"Add"})]})},`catalog-${D.id}`)},e[31]=l,e[32]=v,e[33]=c,e[34]=ee):ee=e[34];const ke=ee,ye=!w&&i.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[i.jsx(Nr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:D=>g(D)}),i.jsxs(He,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{ne("connections_dialog_custom_clicked"),h()},children:[i.jsx(ro,{size:12}),"Custom Connection"]})]}),Ge=R&&"opacity-50 pointer-events-none";let Te;e[35]!==Ge?(Te=Sr("flex-1 overflow-auto p-5 transition-opacity duration-150",Ge),e[35]=Ge,e[36]=Te):Te=e[36];const st="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let oe;e[37]!==pe?(oe=D=>{if(D.type==="group")return pe(D.key,D.title,D.icon,null,D.connections);const L=D.connection;return pe(L.id,L.title,L.icon,L.description??null,[L])},e[37]=pe,e[38]=oe):oe=e[38];const ze=xe.map(oe);let ge;e[39]!==Ae?(ge=i.jsx("div",{ref:Ae,className:"col-span-full h-1"}),e[39]=Ae,e[40]=ge):ge=e[40];let _e;e[41]!==V?(_e=V&&i.jsx("div",{className:"col-span-full flex justify-center py-6",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=V,e[42]=_e):_e=e[42];const Je=z&&Z.length>0&&i.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[i.jsx(Qt,{size:13,className:"text-muted-foreground shrink-0"}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),i.jsx("div",{className:"flex-1 h-px bg-border"})]}),it=z&&Z.map(ke),at=z&&q.length>0&&i.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[i.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),i.jsx("div",{className:"flex-1 h-px bg-border"})]}),we=z&&q.map(ke);let se;e[43]!==he||e[44]!==X||e[45]!==z?(se=z&&X.length>0&&i.jsx("div",{ref:he,className:"col-span-full h-1"}),e[43]=he,e[44]=X,e[45]=z,e[46]=se):se=e[46];let le;e[47]!==H.isLoadingMore||e[48]!==z?(le=z&&H.isLoadingMore&&i.jsx("div",{className:"col-span-full flex justify-center py-6",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=z,e[49]=le):le=e[49];let Oe;e[50]!==ze||e[51]!==ge||e[52]!==_e||e[53]!==Je||e[54]!==it||e[55]!==at||e[56]!==we||e[57]!==se||e[58]!==le?(Oe=i.jsxs("div",{className:st,children:[ze,ge,_e,Je,it,at,we,se,le]}),e[50]=ze,e[51]=ge,e[52]=_e,e[53]=Je,e[54]=it,e[55]=at,e[56]=we,e[57]=se,e[58]=le,e[59]=Oe):Oe=e[59];let J;e[60]!==j||e[61]!==xe.length||e[62]!==q||e[63]!==f||e[64]!==Z?(J=xe.length===0&&Z.length===0&&q.length===0&&i.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:f?`No connections match "${f}"`:j==="connected"?"No connections yet":"No connections available"}),e[60]=j,e[61]=xe.length,e[62]=q,e[63]=f,e[64]=Z,e[65]=J):J=e[65];let Me;e[66]!==Te||e[67]!==Oe||e[68]!==J?(Me=i.jsxs("div",{className:Te,children:[Oe,J]}),e[66]=Te,e[67]=Oe,e[68]=J,e[69]=Me):Me=e[69];let Qe;return e[70]!==ye||e[71]!==Me?(Qe=i.jsxs(i.Fragment,{children:[ye,Me]}),e[70]=ye,e[71]=Me,e[72]=Qe):Qe=e[72],Qe}function io(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function ao(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function co(t){return t.app_name}function lo(t){return t.app_name}function uo(t){return t?.items??[]}function fo(t,e){if(t?.hasMore)return e.reduce(ho,0)}function ho(t,e){return t+(e?.items?.length??0)}function Ai({open:t,onOpenChange:e,defaultTab:n,initialSearch:r="",...o}){const s=o.mode??"add",a="agentId"in o?o.agentId:void 0,c="addedConnectionIds"in o?o.addedConnectionIds??new Set:new Set,l="onAdd"in o&&o.onAdd?o.onAdd:p=>{},f=(p,y,T)=>{a&&ne("agent_connection_attached",{agent_id:a,connection_id:p,app_name:y,mode:T})},[h,d]=u.useState(null),[m,v]=u.useState(r),[N,x]=u.useState(!1),{org:b}=an(),{data:R}=kn.useSession(),w=zn(),C=br(),j=xr(),k=p=>{e(!1),j({to:"/$org/settings/connections/$appSlug",params:{org:b.slug,appSlug:p}})},E=async p=>{d(p.app_name??p.id);try{const T=`${p.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,S=(await w.create.mutateAsync({title:T,description:p.description??null,connection_type:p.connection_type,connection_url:p.connection_url??null,connection_token:null,icon:p.icon??null,app_name:p.app_name??null,app_id:p.app_id??null,connection_headers:p.connection_headers??null})).id,A=new URL(`/api/${b.slug}/mcp/${S}`,window.location.origin),O=await Kt({url:A.href,token:null,orgId:b.id});if(O.supportsOAuth&&!O.isAuthenticated){const{token:K,tokenInfo:B,error:P}=await Yt({connectionId:S,orgSlug:b.slug,scope:"offline_access"});if(P||!K){ne("connection_oauth_failed",{connection_id:S,flow:"clone",error:P??"no_token"}),Le.error(`Authentication failed: ${P??"no token received"}`),await w.delete.mutateAsync(S);return}if(ne("connection_oauth_succeeded",{connection_id:S,flow:"clone"}),B)try{(await fetch(`/api/${b.slug}/connections/${S}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:B.accessToken,refreshToken:B.refreshToken,expiresIn:B.expiresIn,scope:B.scope,clientId:B.clientId,clientSecret:B.clientSecret,tokenEndpoint:B.tokenEndpoint})})).ok?await w.update.mutateAsync({id:S,data:{}}):await w.update.mutateAsync({id:S,data:{connection_token:K}})}catch{await w.update.mutateAsync({id:S,data:{connection_token:K}})}else await w.update.mutateAsync({id:S,data:{connection_token:K}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(A.href,null)})}f(S,p.app_name??null,"clone"),l(S)}catch(y){console.error("Failed to add connection:",y),Le.error("Failed to add connection")}finally{d(null)}},g=async p=>{if(!(!b||!R?.user?.id)){d(p.id);try{const y=to(p,b.id,R.user.id,{remoteIndex:0}),T=y.connection_type==="STDIO",I=!!y.connection_url,S=T&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!S){Le.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:A}=await w.create.mutateAsync(y),O=new URL(`/api/${b.slug}/mcp/${A}`,window.location.origin),K=await Kt({url:O.href,token:null,orgId:b.id});if(K.supportsOAuth&&!K.isAuthenticated){const{token:B,tokenInfo:P,error:V}=await Yt({connectionId:A,orgSlug:b.slug,scope:"offline_access"});if(V||!B){ne("connection_oauth_failed",{connection_id:A,flow:"connect_new",error:V??"no_token"}),Le.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${V??"no token received"})`}),f(A,y.app_name??null,"new"),l(A);return}if(ne("connection_oauth_succeeded",{connection_id:A,flow:"connect_new"}),P)try{(await fetch(`/api/${b.slug}/connections/${A}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:P.accessToken,refreshToken:P.refreshToken,expiresIn:P.expiresIn,scope:P.scope,clientId:P.clientId,clientSecret:P.clientSecret,tokenEndpoint:P.tokenEndpoint})})).ok?await w.update.mutateAsync({id:A,data:{}}):await w.update.mutateAsync({id:A,data:{connection_token:B}})}catch{await w.update.mutateAsync({id:A,data:{connection_token:B}})}else await w.update.mutateAsync({id:A,data:{connection_token:B}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(O.href,null)}),Le.success("Connected and authenticated")}else Le.success("Connected");f(A,y.app_name??null,"new"),l(A)}catch(y){console.error("Failed to connect:",y),Le.error("Failed to connect")}finally{d(null)}}};return i.jsxs(On,{open:t,onOpenChange:e,children:[i.jsxs(Mn,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[i.jsx(Pn,{className:"px-6 pt-5 pb-0 shrink-0",children:i.jsx(Ln,{className:"text-base font-semibold",children:s==="browse"?"Connections":"Add Connection"})}),i.jsx("div",{className:"pt-3 shrink-0",children:i.jsx(Rr,{value:m,onChange:v,placeholder:"Search connections..."})}),i.jsx(u.Suspense,{fallback:i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(It,{size:24,className:"animate-spin text-muted-foreground"})}),children:i.jsx(so,{mode:s,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:E,onConnectAndAdd:g,connectingItemId:h,search:m,onCreateConnection:()=>x(!0),onBrowseNavigate:k,defaultTab:n})})]}),i.jsx(oo,{open:N,onOpenChange:x,onCreated:async p=>{x(!1);const y=new URL(`/api/${b.slug}/mcp/${p}`,window.location.origin),T=await Kt({url:y.href,token:null,orgId:b.id});if(T.supportsOAuth&&!T.isAuthenticated){const{token:I,tokenInfo:S,error:A}=await Yt({connectionId:p,orgSlug:b.slug,scope:"offline_access"});if(A||!I){ne("connection_oauth_failed",{connection_id:p,flow:"custom_create",error:A??"no_token"}),Le.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${A??"no token received"})`}),f(p,null,"custom"),l(p),e(!1);return}if(ne("connection_oauth_succeeded",{connection_id:p,flow:"custom_create"}),S)try{(await fetch(`/api/${b.slug}/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:S.accessToken,refreshToken:S.refreshToken,expiresIn:S.expiresIn,scope:S.scope,clientId:S.clientId,clientSecret:S.clientSecret,tokenEndpoint:S.tokenEndpoint})})).ok?await w.update.mutateAsync({id:p,data:{}}):await w.update.mutateAsync({id:p,data:{connection_token:I}})}catch{await w.update.mutateAsync({id:p,data:{connection_token:I}})}else await w.update.mutateAsync({id:p,data:{connection_token:I}});await C.invalidateQueries({queryKey:At.isMCPAuthenticated(y.href,null)})}f(p,null,"custom"),l(p),e(!1)}})]})}function Ei(t){const e=t?.metadata?.githubRepo;return e?e.connectionId?t?.connections?.some(r=>r.connection_id===e.connectionId)?e:null:e:null}function po(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return u.useMemo(()=>r=>{e.forEach(o=>o(r))},e)}const zt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nt(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function cn(t){return"nodeType"in t}function Q(t){var e,n;return t?nt(t)?t:cn(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function ln(t){const{Document:e}=Q(t);return t instanceof e}function xt(t){return nt(t)?!1:t instanceof Q(t).HTMLElement}function Fn(t){return t instanceof Q(t).SVGElement}function rt(t){return t?nt(t)?t.document:cn(t)?ln(t)?t:xt(t)||Fn(t)?t.ownerDocument:document:document:document}const ve=zt?u.useLayoutEffect:u.useEffect;function Ft(t){const e=u.useRef(t);return ve(()=>{e.current=t}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function go(){const t=u.useRef(null),e=u.useCallback((r,o)=>{t.current=setInterval(r,o)},[]),n=u.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function mt(t,e){e===void 0&&(e=[t]);const n=u.useRef(t);return ve(()=>{n.current!==t&&(n.current=t)},e),n}function yt(t,e){const n=u.useRef();return u.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Tt(t){const e=Ft(t),n=u.useRef(null),r=u.useCallback(o=>{o!==n.current&&e?.(o,n.current),n.current=o},[]);return[n,r]}function _t(t){const e=u.useRef();return u.useEffect(()=>{e.current=t},[t]),e.current}let Zt={};function wt(t,e){return u.useMemo(()=>{if(e)return e;const n=Zt[t]==null?0:Zt[t]+1;return Zt[t]=n,t+"-"+n},[t,e])}function $n(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const c=Object.entries(a);for(const[l,f]of c){const h=s[l];h!=null&&(s[l]=h+t*f)}return s},{...e})}}const tt=$n(1),vt=$n(-1);function mo(t){return"clientX"in t&&"clientY"in t}function $t(t){if(!t)return!1;const{KeyboardEvent:e}=Q(t.target);return e&&t instanceof e}function vo(t){if(!t)return!1;const{TouchEvent:e}=Q(t.target);return e&&t instanceof e}function Ot(t){if(vo(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return mo(t)?{x:t.clientX,y:t.clientY}:null}const We=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[We.Translate.toString(t),We.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),vn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bo(t){return t.matches(vn)?t:t.querySelector(vn)}const xo={display:"none"};function yo(t){let{id:e,value:n}=t;return $.createElement("div",{id:e,style:xo},n)}function wo(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return $.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Co(){const[t,e]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const Bn=u.createContext(null);function So(t){const e=u.useContext(Bn);u.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Do(){const[t]=u.useState(()=>new Set),e=u.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[u.useCallback(r=>{let{type:o,event:s}=r;t.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,s)})},[t]),e]}const jo={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -1 +1 @@
1
- import{e as C,c as d,bt as u,j as l}from"./index-DHxOddsj.js";const m=u("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function h(f){const e=C.c(10),{variant:c,size:o}=f;let t;e[0]!==o||e[1]!==c?(t=d(m({variant:c,size:o})),e[0]=o,e[1]=c,e[2]=t):t=e[2];let a,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i=l.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=a,e[4]=i):(a=e[3],i=e[4]);let s;e[5]!==t?(s=l.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a,i]}),e[5]=t,e[6]=s):s=e[6];let r;e[7]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=r):r=e[7];let n;return e[8]!==s?(n=l.jsxs("div",{role:"status",children:[s,r]}),e[8]=s,e[9]=n):n=e[9],n}export{h as S};
1
+ import{e as C,c as d,bt as u,j as l}from"./index-DjCrtoJM.js";const m=u("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function h(f){const e=C.c(10),{variant:c,size:o}=f;let t;e[0]!==o||e[1]!==c?(t=d(m({variant:c,size:o})),e[0]=o,e[1]=c,e[2]=t):t=e[2];let a,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i=l.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=a,e[4]=i):(a=e[3],i=e[4]);let s;e[5]!==t?(s=l.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a,i]}),e[5]=t,e[6]=s):s=e[6];let r;e[7]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=r):r=e[7];let n;return e[8]!==s?(n=l.jsxs("div",{role:"status",children:[s,r]}),e[8]=s,e[9]=n):n=e[9],n}export{h as S};
@@ -1 +1 @@
1
- import{q as D,r as v,j as e,B as p,t as S,o as c,e as N}from"./index-DHxOddsj.js";import{D as k}from"./domain-settings-CwC_r-qt.js";import{P as f}from"./index-CVroQ5fV.js";import{I as l}from"./input-C3YblD3D.js";import{S as z}from"./switch-BOtiDaPh.js";import{a as P,b as R,c as A,d as T}from"./use-org-sso-HULZXLZY.js";import{c as q,S as y,a as C,b as r,d as O}from"./settings-section-BiebCtcC.js";import{s as F}from"./Trash01-CA4jg9ww.js";import{R as L}from"./require-capability-skg99hPH.js";import"./studio-tools-CH7dZ7HT.js";import"./sidebar-BY-0S2nV.js";import"./LayoutLeft-DwKLO_V_.js";import"./tooltip-6OktDyzD.js";import"./sheet-4GES45T2.js";import"./X-8-D5pATw.js";import"./card-BVDRUeiB.js";import"./ArrowUpRight-CjvxrowT.js";import"./use-capability-B2GMKCxl.js";import"./access-gate-daLhvTar.js";import"./capability-load-error-Co02--jW.js";function B(){const{org:t}=D(),{data:a,isLoading:E}=P(t.id,t.slug),x=R(t.id,t.slug),h=A(t.id,t.slug),j=T(t.id,t.slug),[s,d]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[m,g]=v.useState(!1),u=a?.configured&&a.config,o=a?.config,I=()=>{o&&d({issuer:o.issuer,clientId:o.clientId,clientSecret:"",discoveryEndpoint:o.discoveryEndpoint??"",domain:o.domain,scopes:o.scopes.join(" ")}),g(!0)},b=async()=>{if(!s.issuer||!s.clientId||!s.domain){c.error("Issuer, Client ID, and Domain are required");return}if(!u&&!s.clientSecret){c.error("Client Secret is required for initial setup");return}try{await x.mutateAsync({issuer:s.issuer,clientId:s.clientId,clientSecret:s.clientSecret,discoveryEndpoint:s.discoveryEndpoint||void 0,scopes:s.scopes.split(/\s+/).filter(Boolean),domain:s.domain,enforced:o?.enforced??!1}),S(u?"sso_config_updated":"sso_configured",{organization_id:t.id,email_domain:s.domain}),c.success("SSO configuration saved"),g(!1)}catch(i){c.error(i instanceof Error?i.message:"Failed to save SSO config")}},w=async()=>{if(confirm("Are you sure you want to remove SSO configuration?"))try{await h.mutateAsync(),S("sso_config_removed",{organization_id:t.id}),c.success("SSO configuration removed"),g(!1)}catch{c.error("Failed to remove SSO config")}},_=async i=>{try{await j.mutateAsync(i),S("sso_enforcement_toggled",{organization_id:t.id,enforced:i}),c.success(i?"SSO enforcement enabled":"SSO enforcement disabled")}catch{c.error("Failed to toggle SSO enforcement")}};return e.jsx(f,{children:e.jsx(f.Content,{children:e.jsx(f.Body,{children:e.jsxs(q,{children:[e.jsx(f.Title,{children:"Security"}),e.jsx(k,{}),E?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."}):e.jsxs(e.Fragment,{children:[u&&!m&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Provider",action:e.jsx("span",{className:"font-medium",children:o.issuer})}),e.jsx(r,{title:"Client ID",action:e.jsx("span",{className:"font-mono text-xs",children:o.clientId})}),e.jsx(r,{title:"Domain",action:e.jsx("span",{className:"font-medium",children:o.domain})}),e.jsx(r,{title:"Scopes",action:e.jsx("span",{className:"font-mono text-xs",children:o.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(r,{title:"Enforce SSO",description:"Require all members to authenticate via SSO",action:e.jsx(z,{checked:o.enforced,onCheckedChange:_,disabled:j.isPending})}),e.jsxs(O,{children:[e.jsxs(p,{variant:"ghost",size:"sm",onClick:w,disabled:h.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(F,{size:14}),"Remove"]}),e.jsx(p,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${t.slug}/sso/authorize`,"_blank")},children:"Test SSO"}),e.jsx(p,{variant:"outline",size:"sm",onClick:I,children:"Edit configuration"})]})]})}),(!u||m)&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Issuer URL",description:"The OIDC issuer URL of your identity provider.",action:e.jsx(l,{id:"sso-issuer",placeholder:"https://login.microsoftonline.com/{tenant}/v2.0",value:s.issuer,onChange:i=>d(n=>({...n,issuer:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client ID",action:e.jsx(l,{id:"sso-client-id",placeholder:"your-client-id",value:s.clientId,onChange:i=>d(n=>({...n,clientId:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client Secret",description:m&&u?"Leave empty to keep current":void 0,action:e.jsx(l,{id:"sso-client-secret",type:"password",placeholder:"your-client-secret",value:s.clientSecret,onChange:i=>d(n=>({...n,clientSecret:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Email Domain",description:"The email domain this SSO provider covers.",action:e.jsx(l,{id:"sso-domain",placeholder:"company.com",value:s.domain,onChange:i=>d(n=>({...n,domain:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Scopes",action:e.jsx(l,{id:"sso-scopes",placeholder:"openid email profile",value:s.scopes,onChange:i=>d(n=>({...n,scopes:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Discovery Endpoint",description:"Optional — auto-detected from issuer if omitted.",action:e.jsx(l,{id:"sso-discovery",placeholder:"Auto-detected from issuer",value:s.discoveryEndpoint,onChange:i=>d(n=>({...n,discoveryEndpoint:i.target.value})),className:"w-[280px]"})}),e.jsxs(O,{children:[m&&e.jsx(p,{variant:"outline",size:"sm",onClick:()=>g(!1),children:"Cancel"}),e.jsx(p,{onClick:b,disabled:x.isPending,size:"sm",children:x.isPending?"Saving...":m?"Update":"Configure SSO"})]})]})})]})]})})})})}function ae(){const t=N.c(1);let a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx(L,{capability:"org:manage",area:"security",children:e.jsx(B,{})}),t[0]=a):a=t[0],a}export{ae as default};
1
+ import{q as D,r as v,j as e,B as p,t as S,o as c,e as N}from"./index-DjCrtoJM.js";import{D as k}from"./domain-settings-BDb8F-pn.js";import{P as f}from"./index-D7vPwljU.js";import{I as l}from"./input-odGTsdHi.js";import{S as z}from"./switch-Co2WNb8L.js";import{a as P,b as R,c as A,d as T}from"./use-org-sso-DXk1g-4_.js";import{c as q,S as y,a as C,b as r,d as O}from"./settings-section-DDBr5t6q.js";import{s as F}from"./Trash01-BW2v6vxa.js";import{R as L}from"./require-capability-XeIce_Pd.js";import"./studio-tools-C1zamUp1.js";import"./sidebar-D0YkKw2Q.js";import"./LayoutLeft-DOdRMzln.js";import"./tooltip-MvXJgTec.js";import"./sheet-BwcUAu7J.js";import"./X-BUrHvnq3.js";import"./card-DeDg0Mpx.js";import"./ArrowUpRight-7-SM74wR.js";import"./use-capability-COL6vTbP.js";import"./access-gate-CGZv0aLQ.js";import"./capability-load-error-B_GRCsfG.js";function B(){const{org:t}=D(),{data:a,isLoading:E}=P(t.id,t.slug),x=R(t.id,t.slug),h=A(t.id,t.slug),j=T(t.id,t.slug),[s,d]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[m,g]=v.useState(!1),u=a?.configured&&a.config,o=a?.config,I=()=>{o&&d({issuer:o.issuer,clientId:o.clientId,clientSecret:"",discoveryEndpoint:o.discoveryEndpoint??"",domain:o.domain,scopes:o.scopes.join(" ")}),g(!0)},b=async()=>{if(!s.issuer||!s.clientId||!s.domain){c.error("Issuer, Client ID, and Domain are required");return}if(!u&&!s.clientSecret){c.error("Client Secret is required for initial setup");return}try{await x.mutateAsync({issuer:s.issuer,clientId:s.clientId,clientSecret:s.clientSecret,discoveryEndpoint:s.discoveryEndpoint||void 0,scopes:s.scopes.split(/\s+/).filter(Boolean),domain:s.domain,enforced:o?.enforced??!1}),S(u?"sso_config_updated":"sso_configured",{organization_id:t.id,email_domain:s.domain}),c.success("SSO configuration saved"),g(!1)}catch(i){c.error(i instanceof Error?i.message:"Failed to save SSO config")}},w=async()=>{if(confirm("Are you sure you want to remove SSO configuration?"))try{await h.mutateAsync(),S("sso_config_removed",{organization_id:t.id}),c.success("SSO configuration removed"),g(!1)}catch{c.error("Failed to remove SSO config")}},_=async i=>{try{await j.mutateAsync(i),S("sso_enforcement_toggled",{organization_id:t.id,enforced:i}),c.success(i?"SSO enforcement enabled":"SSO enforcement disabled")}catch{c.error("Failed to toggle SSO enforcement")}};return e.jsx(f,{children:e.jsx(f.Content,{children:e.jsx(f.Body,{children:e.jsxs(q,{children:[e.jsx(f.Title,{children:"Security"}),e.jsx(k,{}),E?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."}):e.jsxs(e.Fragment,{children:[u&&!m&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Provider",action:e.jsx("span",{className:"font-medium",children:o.issuer})}),e.jsx(r,{title:"Client ID",action:e.jsx("span",{className:"font-mono text-xs",children:o.clientId})}),e.jsx(r,{title:"Domain",action:e.jsx("span",{className:"font-medium",children:o.domain})}),e.jsx(r,{title:"Scopes",action:e.jsx("span",{className:"font-mono text-xs",children:o.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(r,{title:"Enforce SSO",description:"Require all members to authenticate via SSO",action:e.jsx(z,{checked:o.enforced,onCheckedChange:_,disabled:j.isPending})}),e.jsxs(O,{children:[e.jsxs(p,{variant:"ghost",size:"sm",onClick:w,disabled:h.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(F,{size:14}),"Remove"]}),e.jsx(p,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${t.slug}/sso/authorize`,"_blank")},children:"Test SSO"}),e.jsx(p,{variant:"outline",size:"sm",onClick:I,children:"Edit configuration"})]})]})}),(!u||m)&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Issuer URL",description:"The OIDC issuer URL of your identity provider.",action:e.jsx(l,{id:"sso-issuer",placeholder:"https://login.microsoftonline.com/{tenant}/v2.0",value:s.issuer,onChange:i=>d(n=>({...n,issuer:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client ID",action:e.jsx(l,{id:"sso-client-id",placeholder:"your-client-id",value:s.clientId,onChange:i=>d(n=>({...n,clientId:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client Secret",description:m&&u?"Leave empty to keep current":void 0,action:e.jsx(l,{id:"sso-client-secret",type:"password",placeholder:"your-client-secret",value:s.clientSecret,onChange:i=>d(n=>({...n,clientSecret:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Email Domain",description:"The email domain this SSO provider covers.",action:e.jsx(l,{id:"sso-domain",placeholder:"company.com",value:s.domain,onChange:i=>d(n=>({...n,domain:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Scopes",action:e.jsx(l,{id:"sso-scopes",placeholder:"openid email profile",value:s.scopes,onChange:i=>d(n=>({...n,scopes:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Discovery Endpoint",description:"Optional — auto-detected from issuer if omitted.",action:e.jsx(l,{id:"sso-discovery",placeholder:"Auto-detected from issuer",value:s.discoveryEndpoint,onChange:i=>d(n=>({...n,discoveryEndpoint:i.target.value})),className:"w-[280px]"})}),e.jsxs(O,{children:[m&&e.jsx(p,{variant:"outline",size:"sm",onClick:()=>g(!1),children:"Cancel"}),e.jsx(p,{onClick:b,disabled:x.isPending,size:"sm",children:x.isPending?"Saving...":m?"Update":"Configure SSO"})]})]})})]})]})})})})}function ae(){const t=N.c(1);let a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx(L,{capability:"org:manage",area:"security",children:e.jsx(B,{})}),t[0]=a):a=t[0],a}export{ae as default};