decocms 4.167.3 → 4.167.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/client/assets/{AlertCircle-Cicq6Btx.js → AlertCircle-BXOs8pgi.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DFQ9anBg.js → AreaChart-C8CciM_k.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-LHPBhEbp.js → ArrowUp-BFGzDO5k.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-DKu3sDw2.js → ArrowUpRight-h69wSa4W.js} +1 -1
  5. package/dist/client/assets/{Check-f04bRoaY.js → Check-CKtI4hGn.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BDYEoc2A.js → CheckCircle-CP9SNP9d.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-DyPoUAwG.js → ChevronDown-DfcP5Y1G.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-ByYfkUuJ.js → ChevronRight-BIlAcWT5.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DTBO0YIR.js → ChevronUp-SkDgfV9P.js} +1 -1
  10. package/dist/client/assets/{Copy01-BK7unRe5.js → Copy01-CjgXfC24.js} +1 -1
  11. package/dist/client/assets/{CpuChip01-OzAhABj8.js → CpuChip01-t2Y6TVWu.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-BOoWejjN.js → DotsVertical-DTkYQ2kM.js} +1 -1
  13. package/dist/client/assets/{Eye-Dq2AhBpY.js → Eye-D7uVxsd6.js} +1 -1
  14. package/dist/client/assets/{FilterLines-DFF1TYW3.js → FilterLines-FPJrIJmP.js} +1 -1
  15. package/dist/client/assets/{HardDrive-PxX2eS0f.js → HardDrive-DLAbk7yi.js} +1 -1
  16. package/dist/client/assets/{Key01-QIc7SJsy.js → Key01-BNEdMwqa.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-DVCUfMEo.js → LayoutLeft-pwNqM9Bq.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-Chyou-nB.js → LinkExternal01-CUFmEJ-r.js} +1 -1
  19. package/dist/client/assets/{LogOut01-CZ8M0-Mw.js → LogOut01-CL5erPho.js} +1 -1
  20. package/dist/client/assets/{Monitor01-DdYMBVN1.js → Monitor01-BTT_gkH0.js} +1 -1
  21. package/dist/client/assets/{Palette-C1L2ofpt.js → Palette-D4hJdFvA.js} +1 -1
  22. package/dist/client/assets/{Play-Dx9zbgtK.js → Play-BPaNNVsN.js} +1 -1
  23. package/dist/client/assets/{Plus-DQSqgbXS.js → Plus-DigHRvrB.js} +1 -1
  24. package/dist/client/assets/{SearchLg-B6WGS6K3.js → SearchLg-CcVjy7cv.js} +1 -1
  25. package/dist/client/assets/{SearchMd-CN5YBDRF.js → SearchMd-UJHWms5O.js} +1 -1
  26. package/dist/client/assets/{Settings02-CgZPcZ7w.js → Settings02-C2z8V4b1.js} +1 -1
  27. package/dist/client/assets/{Shield01-DZ6YvlwA.js → Shield01-CE6E4vWT.js} +1 -1
  28. package/dist/client/assets/{Star01-DUGGdLzq.js → Star01-Cw9ulDl8.js} +1 -1
  29. package/dist/client/assets/{Stars01-D-dQK92H.js → Stars01-DqE2p9rj.js} +1 -1
  30. package/dist/client/assets/{Stars02-DxJUAXG3.js → Stars02-DKPhD_jS.js} +1 -1
  31. package/dist/client/assets/{Sun-BgsS0p54.js → Sun-quy8cVor.js} +1 -1
  32. package/dist/client/assets/{SwitchHorizontal01-D1lq-Kdk.js → SwitchHorizontal01-B7BlklUe.js} +1 -1
  33. package/dist/client/assets/{Tool01-Cck98cEb.js → Tool01-d6PLxuqZ.js} +1 -1
  34. package/dist/client/assets/{Tool02-DA9UyLwr.js → Tool02-CG-MJEAZ.js} +1 -1
  35. package/dist/client/assets/{Trash01-gdb_rf-l.js → Trash01-BEfNCj7H.js} +1 -1
  36. package/dist/client/assets/{TrendUp01-7inJIhQA.js → TrendUp01-CTjYh8Ln.js} +1 -1
  37. package/dist/client/assets/{Upload01-Cgd-iRGv.js → Upload01-CSguqWGj.js} +1 -1
  38. package/dist/client/assets/{User01-CZDBfvD7.js → User01-CN3QhMor.js} +1 -1
  39. package/dist/client/assets/{Users01-DBliec9J.js → Users01-ALInePB-.js} +1 -1
  40. package/dist/client/assets/{Users03-BISCNzBj.js → Users03-DBjTudH5.js} +1 -1
  41. package/dist/client/assets/{X-D0Coarkj.js → X-DvW6lnRi.js} +1 -1
  42. package/dist/client/assets/{XCircle-BOvwYwxn.js → XCircle-Fr7R0JyH.js} +1 -1
  43. package/dist/client/assets/{XClose-CLWdXIS8.js → XClose-yYL9HV11.js} +1 -1
  44. package/dist/client/assets/{Zap-tSUs1L-J.js → Zap-B2AmO5T-.js} +1 -1
  45. package/dist/client/assets/{ZapSquare-DIplYvne.js → ZapSquare-DHGjnuEa.js} +1 -1
  46. package/dist/client/assets/{access-gate-BxWFFSaK.js → access-gate-8z-Zjc69.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-BMIGGLcT.js → add-section-modal-DsiOPGLK.js} +1 -1
  48. package/dist/client/assets/{agent-icon-BCrD15Ca.js → agent-icon-D0v0CAMQ.js} +1 -1
  49. package/dist/client/assets/{agents-list-DwxjQQvs.js → agents-list-DYxy5a5k.js} +1 -1
  50. package/dist/client/assets/{ai-providers-C83ykFah.js → ai-providers-DMeor9A-.js} +1 -1
  51. package/dist/client/assets/{alert-DTTMLF4J.js → alert-6lmsmlPy.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DnqyXHfM.js → alert-dialog-DctPzbrJ.js} +1 -1
  53. package/dist/client/assets/{app-editor-CKcRsram.js → app-editor-BSi2b5c2.js} +1 -1
  54. package/dist/client/assets/{auth-DSQBrdmM.js → auth-CVt7QHVR.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-B97ls6YQ.js → auth-catchall-BBAoqWD1.js} +1 -1
  56. package/dist/client/assets/{auth-entry-Dwk49HpM.js → auth-entry-BGQZOuqe.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-DzOiwh9h.js → auth-split-layout-CjrJN_23.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-DNq2co04.js → authenticate-and-persist-oauth-DiCc1vu0.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-BPnZRF4k.js → automation-list-row-2xdC3lws.js} +1 -1
  60. package/dist/client/assets/{automation-runs-B4NS8rzb.js → automation-runs-BQK2qG6I.js} +1 -1
  61. package/dist/client/assets/{automations-CsNjYA-Y.js → automations-BQP8aSA2.js} +1 -1
  62. package/dist/client/assets/{avatar-BCLsXL4H.js → avatar-DNua1J9J.js} +1 -1
  63. package/dist/client/assets/{badge-x-7WrvvC.js → badge-p90WsvMa.js} +1 -1
  64. package/dist/client/assets/{block-document-Dulfsr2U.js → block-document-gAmyXvk5.js} +1 -1
  65. package/dist/client/assets/{brand-context-CQ1Tf8Wp.js → brand-context-BfD_K-Ti.js} +1 -1
  66. package/dist/client/assets/{buckets-DpPCYRzR.js → buckets-CFmjd9DE.js} +1 -1
  67. package/dist/client/assets/{bulk-category-panel-49uMqDM0.js → bulk-category-panel-CyIrpC-y.js} +1 -1
  68. package/dist/client/assets/{calendar-hqlz1PlK.js → calendar-CsE8P_v6.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-BJzI4xu7.js → capability-load-error-BwIQSVk2.js} +1 -1
  70. package/dist/client/assets/{card-Bpzcw64L.js → card-CAY4LRtc.js} +1 -1
  71. package/dist/client/assets/{category-editor-CMwI6qt5.js → category-editor-08CLTJQC.js} +1 -1
  72. package/dist/client/assets/{chat-context-C9AlLzvl.js → chat-context-CZ8b18Fc.js} +1 -1
  73. package/dist/client/assets/{checkbox-6ZWRDMwE.js → checkbox-CpkMAAxs.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-BCDlr0k_.js → cli-auth-success-CGJ8yhJu.js} +1 -1
  75. package/dist/client/assets/{collection-detail-CysnnRnu.js → collection-detail-5DB4iz01.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-ygeEvxMu.js → collection-display-button-CdVHGe1g.js} +1 -1
  77. package/dist/client/assets/{collection-search-DycU0jmq.js → collection-search-BXhZ3O1D.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-CjkX3yqr.js → collection-table-wrapper-BzYCc6H4.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-T9RTywR0.js → collection-tabs-BMBpTAbo.js} +1 -1
  80. package/dist/client/assets/{command-B7brqxOl.js → command-BOE7MzSb.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-CblBjVbU.js → commerce-onboarding-B0diSDM4.js} +1 -1
  82. package/dist/client/assets/{companions-core-BhrI4a_V.js → companions-core-BmlZqb3z.js} +1 -1
  83. package/dist/client/assets/{connect-CNQIhHCL.js → connect-NJbaa1Dq.js} +1 -1
  84. package/dist/client/assets/{connection-r-zOTtxQ.js → connection-BvHGO9d1.js} +1 -1
  85. package/dist/client/assets/{connection-card-Dda8Ri7q.js → connection-card-DdoyOAg3.js} +1 -1
  86. package/dist/client/assets/{connection-detail-CAn_PAZA.js → connection-detail-w7-8BS05.js} +1 -1
  87. package/dist/client/assets/{connection-form-helpers-CNWz3mpZ.js → connection-form-helpers-D6bw0HEg.js} +1 -1
  88. package/dist/client/assets/{connections-CDFhUmuB.js → connections-WZ8-STzM.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-B6LhhEZg.js → decopilot-sse-pool-B682c9RZ.js} +1 -1
  90. package/dist/client/assets/{dialog-C9ETdGjn.js → dialog-CRj0zBQ_.js} +1 -1
  91. package/dist/client/assets/{domain-settings-Bt64UwZm.js → domain-settings-D51GX1ZP.js} +1 -1
  92. package/dist/client/assets/{drawer-BD7_0pOG.js → drawer-ZyqfN_k8.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-DdMA7Vq_.js → dropdown-menu-BaxzJoD1.js} +1 -1
  94. package/dist/client/assets/{empty-state-z-_UrQKo.js → empty-state-CX0ihzR5.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-DHczjTgR.js → extract-connection-data-DY9nlWot.js} +1 -1
  96. package/dist/client/assets/{file-explorer-3inNuldH.js → file-explorer-DTnN5mkB.js} +1 -1
  97. package/dist/client/assets/{form-DgrZJrh8.js → form-r7LLoRlt.js} +1 -1
  98. package/dist/client/assets/{general-BJVuOdS3.js → general-BPd6Q1nT.js} +1 -1
  99. package/dist/client/assets/{github-repo-picker-CnOqewLh.js → github-repo-picker-C4LbYEVp.js} +1 -1
  100. package/dist/client/assets/{hooks-DObrp1-C.js → hooks-C_nIzkQJ.js} +1 -1
  101. package/dist/client/assets/{index-Bzzv6eR3.js → index-B6b7-ndb.js} +1 -1
  102. package/dist/client/assets/{index-KTtpS5-N.js → index-BD1XIck_.js} +3 -3
  103. package/dist/client/assets/{index-MCBhNmxf.js → index-BDYacwdo.js} +1 -1
  104. package/dist/client/assets/{index-DBRPKLYM.js → index-BF6I2QS7.js} +1 -1
  105. package/dist/client/assets/{index-CNiVaCVz.js → index-Bur1TB7U.js} +1 -1
  106. package/dist/client/assets/{index-Bp_Qr2P5.js → index-CKKq15hA.js} +1 -1
  107. package/dist/client/assets/{index-CckLDzub.js → index-CsMY3E0n.js} +3 -3
  108. package/dist/client/assets/{index-BlRoNOHG.js → index-D56QVQ2L.js} +1 -1
  109. package/dist/client/assets/{index-CYNEwkBg.js → index-DauQBNEJ.js} +1 -1
  110. package/dist/client/assets/{index-CjKkPBSN.js → index-Y5IRZDB7.js} +5 -5
  111. package/dist/client/assets/{index-Z21w6ntf.js → index-bW9oPKeA.js} +1 -1
  112. package/dist/client/assets/{index-redirect-z4SbsFlA.js → index-redirect-Di0ZRgqA.js} +1 -1
  113. package/dist/client/assets/{input-BvaZWiGU.js → input-Bxlv4wq5.js} +1 -1
  114. package/dist/client/assets/{integration-icon-BbHwHD7u.js → integration-icon-BnGA9SX5.js} +1 -1
  115. package/dist/client/assets/{invite-member-dialog-D6Hncu3i.js → invite-member-dialog-CIwtalGm.js} +1 -1
  116. package/dist/client/assets/{label-DpC2facL.js → label-CPAOOmgU.js} +1 -1
  117. package/dist/client/assets/{layout-Cgzdlx0N.js → layout-msWgxbNB.js} +1 -1
  118. package/dist/client/assets/{login-Bqz5s29p.js → login-C36k4ZEx.js} +1 -1
  119. package/dist/client/assets/{mcp-oauth-z-__qP-h.js → mcp-oauth-BBshTxEG.js} +1 -1
  120. package/dist/client/assets/{members-BHNhTcuL.js → members-BJnujW0k.js} +1 -1
  121. package/dist/client/assets/{monaco-editor-T9BnbZT1.js → monaco-editor-pAlq3Hbk.js} +1 -1
  122. package/dist/client/assets/{monitoring-stats-row-DXVxvpKp.js → monitoring-stats-row-BG7ttYuz.js} +1 -1
  123. package/dist/client/assets/{multi-select-C5N55_nd.js → multi-select-qotXRxVG.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-B0NiBgJ4.js → oauth-callback-DGSSyNOQ.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-DplmQape.js → oauth-callback-ai-provider-DUZnMuan.js} +1 -1
  126. package/dist/client/assets/{onboarding-BdHNcZPg.js → onboarding-CHd3Ety4.js} +1 -1
  127. package/dist/client/assets/{org-layout-CpiV0los.js → org-layout-DTr6NF05.js} +1 -1
  128. package/dist/client/assets/{organization-choice-BzOTSkAu.js → organization-choice-CeJCjdWH.js} +1 -1
  129. package/dist/client/assets/{orgs-BcpdNkjd.js → orgs-BwxsxSe_.js} +1 -1
  130. package/dist/client/assets/{page-seo-form-DTa98sr_.js → page-seo-form-D0xtD3rR.js} +1 -1
  131. package/dist/client/assets/{popover-DX_G7AK7.js → popover-DJARnKJN.js} +1 -1
  132. package/dist/client/assets/{post-editor-BcHvsAs5.js → post-editor-B3yOO9Jy.js} +1 -1
  133. package/dist/client/assets/{primitives--73nNxNp.js → primitives-BmYJCXvO.js} +1 -1
  134. package/dist/client/assets/{profile-DQMbGEbQ.js → profile-BA45RqWa.js} +1 -1
  135. package/dist/client/assets/project-app-view-D64d6xFs.js +1 -0
  136. package/dist/client/assets/record-editor-CkXMC3NF.js +1 -0
  137. package/dist/client/assets/{redirect-editor-0PFZQzYm.js → redirect-editor-cTl0Zx_4.js} +1 -1
  138. package/dist/client/assets/registry-VbA6qBLr.js +2 -0
  139. package/dist/client/assets/{registry-layout-Cb10cHP1.js → registry-layout-CwYqOrKQ.js} +1 -1
  140. package/dist/client/assets/{reports-DX2Lse0N.js → reports-krQamnYh.js} +1 -1
  141. package/dist/client/assets/{require-capability-UNqd8cTc.js → require-capability-CFPLqPWb.js} +1 -1
  142. package/dist/client/assets/{required-auth-layout-cIXJFYDi.js → required-auth-layout-BB-yluZd.js} +1 -1
  143. package/dist/client/assets/{reset-password-DyS3Fz7b.js → reset-password-tBeq6iDe.js} +1 -1
  144. package/dist/client/assets/{roles-AGB5SElb.js → roles-CN9bPOqD.js} +1 -1
  145. package/dist/client/assets/{search-input-DZBNMAR1.js → search-input-DoOBid5A.js} +1 -1
  146. package/dist/client/assets/{secrets-ClWwtDuq.js → secrets-CdSh-98G.js} +1 -1
  147. package/dist/client/assets/{sections-editor-WIl_ikde.js → sections-editor-BSuE7v7K.js} +1 -1
  148. package/dist/client/assets/{select-uD0cTgkh.js → select-Bv-2ewD2.js} +1 -1
  149. package/dist/client/assets/{select-model-DoKrAOGg.js → select-model-DGHQ7XQO.js} +1 -1
  150. package/dist/client/assets/{self-tool-result-DiA23XPu.js → self-tool-result-BJVDpzHC.js} +1 -1
  151. package/dist/client/assets/{seo-editor-DsCsef7r.js → seo-editor-BiXc5-eM.js} +1 -1
  152. package/dist/client/assets/{settings-layout-B4RC50w_.js → settings-layout-2gF7ZghW.js} +1 -1
  153. package/dist/client/assets/{settings-section-fwn-im7I.js → settings-section-DlAvH5Ow.js} +1 -1
  154. package/dist/client/assets/{shell-controls-CRIMT49r.js → shell-controls-ui9DsV1B.js} +1 -1
  155. package/dist/client/assets/{shell-layout-3vEmXYAK.js → shell-layout-_reN3Shc.js} +1 -1
  156. package/dist/client/assets/{sidebar-jLNWMsPH.js → sidebar-ChD8CCYT.js} +1 -1
  157. package/dist/client/assets/{skeleton-B44NoZN3.js → skeleton-C65ogTvo.js} +1 -1
  158. package/dist/client/assets/{spinner-CXf1Qx7i.js → spinner-_TqSaOQN.js} +1 -1
  159. package/dist/client/assets/{sso-Du8GVIBZ.js → sso-BqBxDadH.js} +1 -1
  160. package/dist/client/assets/{store-9-zqXO_5.js → store-T98vssIu.js} +1 -1
  161. package/dist/client/assets/store-registry-BcExQn86.js +2 -0
  162. package/dist/client/assets/{studio-tools-BB_5IEtF.js → studio-tools-DfsuYmJt.js} +1 -1
  163. package/dist/client/assets/{switch-C3QbEtEB.js → switch-lfu04CGM.js} +1 -1
  164. package/dist/client/assets/{tab-id-CBUh52o8.js → tab-id-BqPdm69o.js} +1 -1
  165. package/dist/client/assets/{table-Bg1d64zP.js → table-C2TMn1li.js} +1 -1
  166. package/dist/client/assets/{tabs-D_z_XTCK.js → tabs-oVlPQ_HA.js} +1 -1
  167. package/dist/client/assets/{textarea-CO_8K2AK.js → textarea-Bn4a6Dgo.js} +1 -1
  168. package/dist/client/assets/{toggle-group-D6b4XzrC.js → toggle-group-BRzf8EHW.js} +1 -1
  169. package/dist/client/assets/{toolbar-BFM5BlTU.js → toolbar-DYLo2f04.js} +1 -1
  170. package/dist/client/assets/{tooltip-kvNY_Zlt.js → tooltip-Cpi2mja1.js} +1 -1
  171. package/dist/client/assets/{use-ai-providers-BOEUgaK6.js → use-ai-providers-DFQIA0YS.js} +1 -1
  172. package/dist/client/assets/{use-automations-BkN-CygW.js → use-automations-CwyD7KUw.js} +1 -1
  173. package/dist/client/assets/{use-autosave-D8ctgvBJ.js → use-autosave-DEblj-jV.js} +1 -1
  174. package/dist/client/assets/{use-capability-CGIswx3e.js → use-capability-Cc8HiELK.js} +1 -1
  175. package/dist/client/assets/{use-clock-tick-wRFIIDnf.js → use-clock-tick--ht2pzb8.js} +1 -1
  176. package/dist/client/assets/{use-connection-DzkSa9xt.js → use-connection-CSBpX4PU.js} +1 -1
  177. package/dist/client/assets/{use-copy-HtfZJ1BU.js → use-copy-DTInUOoW.js} +1 -1
  178. package/dist/client/assets/{use-create-virtual-mcp-CQmW9zDz.js → use-create-virtual-mcp-CMUKV_-M.js} +1 -1
  179. package/dist/client/assets/{use-debounced-autosave-oBotAb_R.js → use-debounced-autosave-2vwUh_VG.js} +1 -1
  180. package/dist/client/assets/{use-debounced-value-CHrKB74_.js → use-debounced-value-CwhSCFuf.js} +1 -1
  181. package/dist/client/assets/{use-deco-credits-yERkW46h.js → use-deco-credits-DvYCBBFc.js} +1 -1
  182. package/dist/client/assets/{use-decopilot-events-Bxnrix6_.js → use-decopilot-events-DM97rtIw.js} +1 -1
  183. package/dist/client/assets/{use-delete-connection-x0u7HZiw.js → use-delete-connection-B58V-_B1.js} +1 -1
  184. package/dist/client/assets/{use-deployment-admin-mQHHYcCc.js → use-deployment-admin-CF8Zio-a.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-bsVDHd5B.js → use-file-configs-Eq9DEvtL.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-BtrAR-G0.js → use-infinite-scroll-BhWnCwa_.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-C5PYC5O7.js → use-join-requests-Babs1XE8.js} +1 -1
  188. package/dist/client/assets/{use-mcp-auth-status-CqSXfDuC.js → use-mcp-auth-status-8kwewAjR.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-DsGe28fL.js → use-mcp-client-CpOZK5-l.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-CKYOWKm4.js → use-mcp-tools-CqY2nbaz.js} +1 -1
  191. package/dist/client/assets/{use-members-DmcMStkp.js → use-members-DsksLoYY.js} +1 -1
  192. package/dist/client/assets/{use-mobile-Fy04CvB1.js → use-mobile-ieOqtEHL.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-ChK8XZgk.js → use-navigate-to-agent-DBGPkYj0.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-DWjjH9tE.js → use-org-auth-client-BU-wvvoc.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-BPVS9mge.js → use-org-sso-DOw7Tfv8.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-SLqFRSqw.js → use-organization-roles-Dcy4uPK8.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-BZXqOB8A.js → use-organization-settings-CVw_W4UD.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-CZe25fCH.js → use-registry-connections-BPju-Y9r.js} +1 -1
  199. package/dist/client/assets/{use-secrets-bg3TRPzG.js → use-secrets-CaSIcPta.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-bWBSm9U2.js → use-status-sounds-BgT_jGkq.js} +1 -1
  201. package/dist/client/assets/{use-tags-CAuhxiJo.js → use-tags-C7XcT7ZI.js} +1 -1
  202. package/dist/client/assets/{use-view-mode-C0jrsZRt.js → use-view-mode-ChsGe0PO.js} +1 -1
  203. package/dist/client/assets/{use-virtual-mcp-BmVj-UAd.js → use-virtual-mcp-6MeqW-FL.js} +1 -1
  204. package/dist/client/assets/useInfiniteQuery-D_QXkkfk.js +1 -0
  205. package/dist/client/assets/{useQueries-VBPdYlce.js → useQueries-B5JmsTek.js} +1 -1
  206. package/dist/client/assets/{useRouterState-CIal-NIB.js → useRouterState-Ch85_6Dg.js} +1 -1
  207. package/dist/client/assets/useSuspenseInfiniteQuery-C2EK0lz_.js +1 -0
  208. package/dist/client/assets/{users-OTlsCOkv.js → users-CAHjBk9x.js} +1 -1
  209. package/dist/client/assets/{variant-calendar-KVnOvmDJ.js → variant-calendar-DwnAVLtp.js} +1 -1
  210. package/dist/client/assets/{view-mode-toggle-kxFvMgL6.js → view-mode-toggle-D9-ncCO8.js} +1 -1
  211. package/dist/client/index.html +1 -1
  212. package/dist/server/cli.js +2 -2
  213. package/dist/server/server.js +2 -2
  214. package/package.json +1 -1
  215. package/dist/client/assets/project-app-view-B1Fm6vhL.js +0 -1
  216. package/dist/client/assets/record-editor-Cfk4BC9N.js +0 -1
  217. package/dist/client/assets/registry-DMJUy1tJ.js +0 -2
  218. package/dist/client/assets/store-registry-DPHDPP76.js +0 -2
  219. package/dist/client/assets/useInfiniteQuery-DtYcV9jc.js +0 -1
  220. package/dist/client/assets/useSuspenseInfiniteQuery-D4g2oYT_.js +0 -1
@@ -1 +1 @@
1
- import{r as x,aB as b,j as c,ay as m,aE as k,ax as p,bK as A,bL as T,aD as M,bJ as S,aA as D,bC as F,c as C,m as P}from"./index-CckLDzub.js";var j="Toggle",_=x.forwardRef((a,e)=>{const{pressed:l,defaultPressed:s,onPressedChange:n,...r}=a,[t,o]=b({prop:l,onChange:n,defaultProp:s??!1,caller:j});return c.jsx(m.button,{type:"button","aria-pressed":t,"data-state":t?"on":"off","data-disabled":a.disabled?"":void 0,...r,ref:e,onClick:k(a.onClick,()=>{a.disabled||o(!t)})})});_.displayName=j;var v="ToggleGroup",[w]=D(v,[T]),I=T(),h=p.forwardRef((a,e)=>{const{type:l,...s}=a;if(l==="single"){const n=s;return c.jsx($,{...n,ref:e})}if(l==="multiple"){const n=s;return c.jsx(B,{...n,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${v}\``)});h.displayName=v;var[z,y]=w(v),$=p.forwardRef((a,e)=>{const{value:l,defaultValue:s,onValueChange:n=()=>{},...r}=a,[t,o]=b({prop:l,defaultProp:s??"",onChange:n,caller:v});return c.jsx(z,{scope:a.__scopeToggleGroup,type:"single",value:p.useMemo(()=>t?[t]:[],[t]),onItemActivate:o,onItemDeactivate:p.useCallback(()=>o(""),[o]),children:c.jsx(R,{...r,ref:e})})}),B=p.forwardRef((a,e)=>{const{value:l,defaultValue:s,onValueChange:n=()=>{},...r}=a,[t,o]=b({prop:l,defaultProp:s??[],onChange:n,caller:v}),i=p.useCallback(u=>o((g=[])=>[...g,u]),[o]),d=p.useCallback(u=>o((g=[])=>g.filter(V=>V!==u)),[o]);return c.jsx(z,{scope:a.__scopeToggleGroup,type:"multiple",value:t,onItemActivate:i,onItemDeactivate:d,children:c.jsx(R,{...r,ref:e})})});h.displayName=v;var[L,O]=w(v),R=p.forwardRef((a,e)=>{const{__scopeToggleGroup:l,disabled:s=!1,rovingFocus:n=!0,orientation:r,dir:t,loop:o=!0,...i}=a,d=I(l),u=M(t),g={role:"group",dir:u,...i};return c.jsx(L,{scope:l,rovingFocus:n,disabled:s,children:n?c.jsx(S,{asChild:!0,...d,orientation:r,dir:u,loop:o,children:c.jsx(m.div,{...g,ref:e})}):c.jsx(m.div,{...g,ref:e})})}),f="ToggleGroupItem",E=p.forwardRef((a,e)=>{const l=y(f,a.__scopeToggleGroup),s=O(f,a.__scopeToggleGroup),n=I(a.__scopeToggleGroup),r=l.value.includes(a.value),t=s.disabled||a.disabled,o={...a,pressed:r,disabled:t},i=p.useRef(null);return s.rovingFocus?c.jsx(A,{asChild:!0,...n,focusable:!t,active:r,ref:i,children:c.jsx(G,{...o,ref:e})}):c.jsx(G,{...o,ref:e})});E.displayName=f;var G=p.forwardRef((a,e)=>{const{__scopeToggleGroup:l,value:s,...n}=a,r=y(f,l),t={role:"radio","aria-checked":a.pressed,"aria-pressed":void 0},o=r.type==="single"?t:void 0;return c.jsx(_,{...o,...n,ref:e,onPressedChange:i=>{i?r.onItemActivate(s):r.onItemDeactivate(s)}})}),H=h,J=E;const K=F("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),N=x.createContext({size:"default",variant:"default"});function q(a){const e=C.c(20);let l,s,n,r,t;e[0]!==a?({className:s,variant:t,size:r,children:l,...n}=a,e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=t):(l=e[1],s=e[2],n=e[3],r=e[4],t=e[5]);let o;e[6]!==s?(o=P("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",s),e[6]=s,e[7]=o):o=e[7];let i;e[8]!==r||e[9]!==t?(i={variant:t,size:r},e[8]=r,e[9]=t,e[10]=i):i=e[10];let d;e[11]!==l||e[12]!==i?(d=c.jsx(N.Provider,{value:i,children:l}),e[11]=l,e[12]=i,e[13]=d):d=e[13];let u;return e[14]!==n||e[15]!==r||e[16]!==o||e[17]!==d||e[18]!==t?(u=c.jsx(H,{"data-slot":"toggle-group","data-variant":t,"data-size":r,className:o,...n,children:d}),e[14]=n,e[15]=r,e[16]=o,e[17]=d,e[18]=t,e[19]=u):u=e[19],u}function Q(a){const e=C.c(18);let l,s,n,r,t;e[0]!==a?({className:s,children:l,variant:t,size:r,...n}=a,e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=t):(l=e[1],s=e[2],n=e[3],r=e[4],t=e[5]);const o=x.useContext(N),i=o.variant||t,d=o.size||r;let u;e[6]!==s||e[7]!==o.size||e[8]!==o.variant||e[9]!==r||e[10]!==t?(u=P(K({variant:o.variant||t,size:o.size||r}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",s),e[6]=s,e[7]=o.size,e[8]=o.variant,e[9]=r,e[10]=t,e[11]=u):u=e[11];let g;return e[12]!==l||e[13]!==n||e[14]!==i||e[15]!==d||e[16]!==u?(g=c.jsx(J,{"data-slot":"toggle-group-item","data-variant":i,"data-size":d,className:u,...n,children:l}),e[12]=l,e[13]=n,e[14]=i,e[15]=d,e[16]=u,e[17]=g):g=e[17],g}export{Q as T,q as a};
1
+ import{r as x,aB as b,j as c,ay as m,aE as k,ax as p,bK as A,bL as T,aD as M,bJ as S,aA as D,bC as F,c as C,m as P}from"./index-CsMY3E0n.js";var j="Toggle",_=x.forwardRef((a,e)=>{const{pressed:l,defaultPressed:s,onPressedChange:n,...r}=a,[t,o]=b({prop:l,onChange:n,defaultProp:s??!1,caller:j});return c.jsx(m.button,{type:"button","aria-pressed":t,"data-state":t?"on":"off","data-disabled":a.disabled?"":void 0,...r,ref:e,onClick:k(a.onClick,()=>{a.disabled||o(!t)})})});_.displayName=j;var v="ToggleGroup",[w]=D(v,[T]),I=T(),h=p.forwardRef((a,e)=>{const{type:l,...s}=a;if(l==="single"){const n=s;return c.jsx($,{...n,ref:e})}if(l==="multiple"){const n=s;return c.jsx(B,{...n,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${v}\``)});h.displayName=v;var[z,y]=w(v),$=p.forwardRef((a,e)=>{const{value:l,defaultValue:s,onValueChange:n=()=>{},...r}=a,[t,o]=b({prop:l,defaultProp:s??"",onChange:n,caller:v});return c.jsx(z,{scope:a.__scopeToggleGroup,type:"single",value:p.useMemo(()=>t?[t]:[],[t]),onItemActivate:o,onItemDeactivate:p.useCallback(()=>o(""),[o]),children:c.jsx(R,{...r,ref:e})})}),B=p.forwardRef((a,e)=>{const{value:l,defaultValue:s,onValueChange:n=()=>{},...r}=a,[t,o]=b({prop:l,defaultProp:s??[],onChange:n,caller:v}),i=p.useCallback(u=>o((g=[])=>[...g,u]),[o]),d=p.useCallback(u=>o((g=[])=>g.filter(V=>V!==u)),[o]);return c.jsx(z,{scope:a.__scopeToggleGroup,type:"multiple",value:t,onItemActivate:i,onItemDeactivate:d,children:c.jsx(R,{...r,ref:e})})});h.displayName=v;var[L,O]=w(v),R=p.forwardRef((a,e)=>{const{__scopeToggleGroup:l,disabled:s=!1,rovingFocus:n=!0,orientation:r,dir:t,loop:o=!0,...i}=a,d=I(l),u=M(t),g={role:"group",dir:u,...i};return c.jsx(L,{scope:l,rovingFocus:n,disabled:s,children:n?c.jsx(S,{asChild:!0,...d,orientation:r,dir:u,loop:o,children:c.jsx(m.div,{...g,ref:e})}):c.jsx(m.div,{...g,ref:e})})}),f="ToggleGroupItem",E=p.forwardRef((a,e)=>{const l=y(f,a.__scopeToggleGroup),s=O(f,a.__scopeToggleGroup),n=I(a.__scopeToggleGroup),r=l.value.includes(a.value),t=s.disabled||a.disabled,o={...a,pressed:r,disabled:t},i=p.useRef(null);return s.rovingFocus?c.jsx(A,{asChild:!0,...n,focusable:!t,active:r,ref:i,children:c.jsx(G,{...o,ref:e})}):c.jsx(G,{...o,ref:e})});E.displayName=f;var G=p.forwardRef((a,e)=>{const{__scopeToggleGroup:l,value:s,...n}=a,r=y(f,l),t={role:"radio","aria-checked":a.pressed,"aria-pressed":void 0},o=r.type==="single"?t:void 0;return c.jsx(_,{...o,...n,ref:e,onPressedChange:i=>{i?r.onItemActivate(s):r.onItemDeactivate(s)}})}),H=h,J=E;const K=F("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),N=x.createContext({size:"default",variant:"default"});function q(a){const e=C.c(20);let l,s,n,r,t;e[0]!==a?({className:s,variant:t,size:r,children:l,...n}=a,e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=t):(l=e[1],s=e[2],n=e[3],r=e[4],t=e[5]);let o;e[6]!==s?(o=P("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",s),e[6]=s,e[7]=o):o=e[7];let i;e[8]!==r||e[9]!==t?(i={variant:t,size:r},e[8]=r,e[9]=t,e[10]=i):i=e[10];let d;e[11]!==l||e[12]!==i?(d=c.jsx(N.Provider,{value:i,children:l}),e[11]=l,e[12]=i,e[13]=d):d=e[13];let u;return e[14]!==n||e[15]!==r||e[16]!==o||e[17]!==d||e[18]!==t?(u=c.jsx(H,{"data-slot":"toggle-group","data-variant":t,"data-size":r,className:o,...n,children:d}),e[14]=n,e[15]=r,e[16]=o,e[17]=d,e[18]=t,e[19]=u):u=e[19],u}function Q(a){const e=C.c(18);let l,s,n,r,t;e[0]!==a?({className:s,children:l,variant:t,size:r,...n}=a,e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=t):(l=e[1],s=e[2],n=e[3],r=e[4],t=e[5]);const o=x.useContext(N),i=o.variant||t,d=o.size||r;let u;e[6]!==s||e[7]!==o.size||e[8]!==o.variant||e[9]!==r||e[10]!==t?(u=P(K({variant:o.variant||t,size:o.size||r}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",s),e[6]=s,e[7]=o.size,e[8]=o.variant,e[9]=r,e[10]=t,e[11]=u):u=e[11];let g;return e[12]!==l||e[13]!==n||e[14]!==i||e[15]!==d||e[16]!==u?(g=c.jsx(J,{"data-slot":"toggle-group-item","data-variant":i,"data-size":d,className:u,...n,children:l}),e[12]=l,e[13]=n,e[14]=i,e[15]=d,e[16]=u,e[17]=g):g=e[17],g}export{Q as T,q as a};
@@ -1 +1 @@
1
- import{c as u,m as T,j as i,r as g,b as j,f as k,ag as p,L as N,aI as y,b6 as L}from"./index-CckLDzub.js";function B(t){const e=u.c(14);let l,s,o,n,r;e[0]!==t?({active:l,className:s,ref:n,type:r,...o}=t,e[0]=t,e[1]=l,e[2]=s,e[3]=o,e[4]=n,e[5]=r):(l=e[1],s=e[2],o=e[3],n=e[4],r=e[5]);const c=r===void 0?"button":r,a=l?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let f;e[6]!==s||e[7]!==a?(f=T("relative flex size-10 md:size-7 shrink-0 items-center justify-center rounded-md transition-colors","max-md:[&_svg]:size-5","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",a,s),e[6]=s,e[7]=a,e[8]=f):f=e[8];let b;return e[9]!==o||e[10]!==n||e[11]!==f||e[12]!==c?(b=i.jsx("button",{ref:n,type:c,className:f,...o}),e[9]=o,e[10]=n,e[11]=f,e[12]=c,e[13]=b):b=e[13],b}const S=g.createContext(null);function x(){const t=g.use(S);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function v(t){const e=u.c(8),{children:l}=t,[s,o]=g.useState(null),[n,r]=g.useState(null),[c,a]=g.useState(null),[f,b]=g.useState(null);let d;e[0]!==c||e[1]!==f||e[2]!==n||e[3]!==s?(d={togglesEl:s,setTogglesEl:o,tabsEl:n,setTabsEl:r,centerEl:c,setCenterEl:a,rightEl:f,setRightEl:b},e[0]=c,e[1]=f,e[2]=n,e[3]=s,e[4]=d):d=e[4];let h;return e[5]!==l||e[6]!==d?(h=i.jsx(S,{value:d,children:l}),e[5]=l,e[6]=d,e[7]=h):h=e[7],h}function m(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx(v,{children:i.jsx("div",{className:"flex flex-col h-full min-h-0",children:l})}),e[0]=l,e[1]=s):s=e[1],s}function $(t){const e=u.c(10);let l,s,o;e[0]!==t?({children:l,className:s,...o}=t,e[0]=t,e[1]=l,e[2]=s,e[3]=o):(l=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=T("relative z-10 shrink-0 grid grid-cols-3 items-center pl-1 pr-2 h-12 bg-sidebar",s),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==l||e[7]!==o||e[8]!==n?(r=i.jsx("div",{className:n,...o,children:l}),e[6]=l,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function C(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:l}),e[0]=l,e[1]=s):s=e[1],s}function R(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx("div",{className:"flex items-center justify-end gap-0.5 min-w-0 justify-self-end",children:l}),e[0]=l,e[1]=s):s=e[1],s}function _(){const t=u.c(13),e=j(),s=y().logo??L,o=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let r;t[0]!==e?(r=e("agentShellLayout.toolbar.logo"),t[0]=e,t[1]=r):r=t[1];let c;t[2]!==o||t[3]!==r?(c=i.jsx("img",{src:o,alt:r,className:"size-6 object-contain dark:hidden"}),t[2]=o,t[3]=r,t[4]=c):c=t[4];let a;t[5]!==e?(a=e("agentShellLayout.toolbar.logo"),t[5]=e,t[6]=a):a=t[6];let f;t[7]!==n||t[8]!==a?(f=i.jsx("img",{src:n,alt:a,className:"size-6 object-contain hidden dark:block"}),t[7]=n,t[8]=a,t[9]=f):f=t[9];let b;return t[10]!==c||t[11]!==f?(b=i.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[c,f]}),t[10]=c,t[11]=f,t[12]=b):b=t[12],b}function E(){const t=u.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(g.Suspense,{fallback:i.jsx("span",{className:"shrink-0 size-6 mx-2"}),children:i.jsx(_,{})}),t[0]=e):e=t[0],e}function z(){const t=u.c(12),e=j();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org"},t[0]=l):l=t[0];const{org:s}=k(l);let o;t[1]!==s?(o={org:s},t[1]=s,t[2]=o):o=t[2];let n;t[3]!==e?(n=e("agentShellLayout.toolbar.backToHome"),t[3]=e,t[4]=n):n=t[4];let r;t[5]!==e?(r=e("agentShellLayout.toolbar.backToHome"),t[5]=e,t[6]=r):r=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(E,{}),t[7]=c):c=t[7];let a;return t[8]!==o||t[9]!==n||t[10]!==r?(a=i.jsx(N,{to:"/$org",params:o,"aria-label":n,title:r,className:"flex items-center shrink-0 cursor-pointer pl-1",children:c}),t[8]=o,t[9]=n,t[10]=r,t[11]=a):a=t[11],a}function P(){const t=u.c(2),{setCenterEl:e}=x();let l;return t[0]!==e?(l=i.jsx("div",{ref:e,className:"min-w-0 flex items-center justify-center gap-2"}),t[0]=e,t[1]=l):l=t[1],l}function w(t){const e=u.c(3),{children:l}=t,{centerEl:s}=x();if(!s)return null;let o;return e[0]!==s||e[1]!==l?(o=p.createPortal(l,s),e[0]=s,e[1]=l,e[2]=o):o=e[2],o}function H(t){const e=u.c(5),{className:l}=t,{setTabsEl:s}=x();let o;e[0]!==l?(o=T("shrink-0 flex items-center",l),e[0]=l,e[1]=o):o=e[1];let n;return e[2]!==s||e[3]!==o?(n=i.jsx("div",{ref:s,className:o}),e[2]=s,e[3]=o,e[4]=n):n=e[4],n}function I(t){const e=u.c(3),{children:l}=t,{tabsEl:s}=x();if(!s)return null;let o;return e[0]!==l||e[1]!==s?(o=p.createPortal(l,s),e[0]=l,e[1]=s,e[2]=o):o=e[2],o}function D(t){const e=u.c(5),{className:l}=t,{setTogglesEl:s}=x();let o;e[0]!==l?(o=T("contents",l),e[0]=l,e[1]=o):o=e[1];let n;return e[2]!==s||e[3]!==o?(n=i.jsx("div",{ref:s,className:o}),e[2]=s,e[3]=o,e[4]=n):n=e[4],n}function O(){const t=u.c(2),{setRightEl:e}=x();let l;return t[0]!==e?(l=i.jsx("div",{ref:e,className:"flex items-center justify-end gap-0.5 shrink-0"}),t[0]=e,t[1]=l):l=t[1],l}m.Provider=v;m.Header=$;m.LeftColumn=C;m.RightColumn=R;m.Logo=E;m.LogoLink=z;m.CenterSlot=P;m.Center=w;m.TabsSlot=H;m.Tabs=I;m.TogglesSlot=D;m.RightSlot=O;export{B as T,m as a};
1
+ import{c as u,m as T,j as i,r as g,b as j,f as k,ag as p,L as N,aI as y,b6 as L}from"./index-CsMY3E0n.js";function B(t){const e=u.c(14);let l,s,o,n,r;e[0]!==t?({active:l,className:s,ref:n,type:r,...o}=t,e[0]=t,e[1]=l,e[2]=s,e[3]=o,e[4]=n,e[5]=r):(l=e[1],s=e[2],o=e[3],n=e[4],r=e[5]);const c=r===void 0?"button":r,a=l?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let f;e[6]!==s||e[7]!==a?(f=T("relative flex size-10 md:size-7 shrink-0 items-center justify-center rounded-md transition-colors","max-md:[&_svg]:size-5","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",a,s),e[6]=s,e[7]=a,e[8]=f):f=e[8];let b;return e[9]!==o||e[10]!==n||e[11]!==f||e[12]!==c?(b=i.jsx("button",{ref:n,type:c,className:f,...o}),e[9]=o,e[10]=n,e[11]=f,e[12]=c,e[13]=b):b=e[13],b}const S=g.createContext(null);function x(){const t=g.use(S);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function v(t){const e=u.c(8),{children:l}=t,[s,o]=g.useState(null),[n,r]=g.useState(null),[c,a]=g.useState(null),[f,b]=g.useState(null);let d;e[0]!==c||e[1]!==f||e[2]!==n||e[3]!==s?(d={togglesEl:s,setTogglesEl:o,tabsEl:n,setTabsEl:r,centerEl:c,setCenterEl:a,rightEl:f,setRightEl:b},e[0]=c,e[1]=f,e[2]=n,e[3]=s,e[4]=d):d=e[4];let h;return e[5]!==l||e[6]!==d?(h=i.jsx(S,{value:d,children:l}),e[5]=l,e[6]=d,e[7]=h):h=e[7],h}function m(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx(v,{children:i.jsx("div",{className:"flex flex-col h-full min-h-0",children:l})}),e[0]=l,e[1]=s):s=e[1],s}function $(t){const e=u.c(10);let l,s,o;e[0]!==t?({children:l,className:s,...o}=t,e[0]=t,e[1]=l,e[2]=s,e[3]=o):(l=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=T("relative z-10 shrink-0 grid grid-cols-3 items-center pl-1 pr-2 h-12 bg-sidebar",s),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==l||e[7]!==o||e[8]!==n?(r=i.jsx("div",{className:n,...o,children:l}),e[6]=l,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function C(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:l}),e[0]=l,e[1]=s):s=e[1],s}function R(t){const e=u.c(2),{children:l}=t;let s;return e[0]!==l?(s=i.jsx("div",{className:"flex items-center justify-end gap-0.5 min-w-0 justify-self-end",children:l}),e[0]=l,e[1]=s):s=e[1],s}function _(){const t=u.c(13),e=j(),s=y().logo??L,o=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let r;t[0]!==e?(r=e("agentShellLayout.toolbar.logo"),t[0]=e,t[1]=r):r=t[1];let c;t[2]!==o||t[3]!==r?(c=i.jsx("img",{src:o,alt:r,className:"size-6 object-contain dark:hidden"}),t[2]=o,t[3]=r,t[4]=c):c=t[4];let a;t[5]!==e?(a=e("agentShellLayout.toolbar.logo"),t[5]=e,t[6]=a):a=t[6];let f;t[7]!==n||t[8]!==a?(f=i.jsx("img",{src:n,alt:a,className:"size-6 object-contain hidden dark:block"}),t[7]=n,t[8]=a,t[9]=f):f=t[9];let b;return t[10]!==c||t[11]!==f?(b=i.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[c,f]}),t[10]=c,t[11]=f,t[12]=b):b=t[12],b}function E(){const t=u.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(g.Suspense,{fallback:i.jsx("span",{className:"shrink-0 size-6 mx-2"}),children:i.jsx(_,{})}),t[0]=e):e=t[0],e}function z(){const t=u.c(12),e=j();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org"},t[0]=l):l=t[0];const{org:s}=k(l);let o;t[1]!==s?(o={org:s},t[1]=s,t[2]=o):o=t[2];let n;t[3]!==e?(n=e("agentShellLayout.toolbar.backToHome"),t[3]=e,t[4]=n):n=t[4];let r;t[5]!==e?(r=e("agentShellLayout.toolbar.backToHome"),t[5]=e,t[6]=r):r=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(E,{}),t[7]=c):c=t[7];let a;return t[8]!==o||t[9]!==n||t[10]!==r?(a=i.jsx(N,{to:"/$org",params:o,"aria-label":n,title:r,className:"flex items-center shrink-0 cursor-pointer pl-1",children:c}),t[8]=o,t[9]=n,t[10]=r,t[11]=a):a=t[11],a}function P(){const t=u.c(2),{setCenterEl:e}=x();let l;return t[0]!==e?(l=i.jsx("div",{ref:e,className:"min-w-0 flex items-center justify-center gap-2"}),t[0]=e,t[1]=l):l=t[1],l}function w(t){const e=u.c(3),{children:l}=t,{centerEl:s}=x();if(!s)return null;let o;return e[0]!==s||e[1]!==l?(o=p.createPortal(l,s),e[0]=s,e[1]=l,e[2]=o):o=e[2],o}function H(t){const e=u.c(5),{className:l}=t,{setTabsEl:s}=x();let o;e[0]!==l?(o=T("shrink-0 flex items-center",l),e[0]=l,e[1]=o):o=e[1];let n;return e[2]!==s||e[3]!==o?(n=i.jsx("div",{ref:s,className:o}),e[2]=s,e[3]=o,e[4]=n):n=e[4],n}function I(t){const e=u.c(3),{children:l}=t,{tabsEl:s}=x();if(!s)return null;let o;return e[0]!==l||e[1]!==s?(o=p.createPortal(l,s),e[0]=l,e[1]=s,e[2]=o):o=e[2],o}function D(t){const e=u.c(5),{className:l}=t,{setTogglesEl:s}=x();let o;e[0]!==l?(o=T("contents",l),e[0]=l,e[1]=o):o=e[1];let n;return e[2]!==s||e[3]!==o?(n=i.jsx("div",{ref:s,className:o}),e[2]=s,e[3]=o,e[4]=n):n=e[4],n}function O(){const t=u.c(2),{setRightEl:e}=x();let l;return t[0]!==e?(l=i.jsx("div",{ref:e,className:"flex items-center justify-end gap-0.5 shrink-0"}),t[0]=e,t[1]=l):l=t[1],l}m.Provider=v;m.Header=$;m.LeftColumn=C;m.RightColumn=R;m.Logo=E;m.LogoLink=z;m.CenterSlot=P;m.Center=w;m.TabsSlot=H;m.Tabs=I;m.TogglesSlot=D;m.RightSlot=O;export{B as T,m as a};
@@ -1 +1 @@
1
- import{r as a,j as c,ay as S,aF as J,aB as Q,c$ as Z,aC as H,d0 as ee,aE as C,bM as $,d1 as te,d2 as G,d3 as oe,d4 as re,aA as ne,d5 as se,d6 as ae,c as j,m as ie}from"./index-CckLDzub.js";var le=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ce="VisuallyHidden",F=a.forwardRef((o,e)=>c.jsx(S.span,{...o,ref:e,style:{...le,...o.style}}));F.displayName=ce;var ue=F,[O]=ne("Tooltip",[G]),D=G(),V="TooltipProvider",de=700,A="tooltip.open",[pe,k]=O(V),z=o=>{const{__scopeTooltip:e,delayDuration:t=de,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=a.useRef(!0),d=a.useRef(!1),i=a.useRef(0);return a.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsx(pe,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};z.displayName=V;var R="Tooltip",[fe,_]=O(R),B=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:d}=o,i=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),x=J(),f=a.useRef(0),h=l??i.disableHoverableContent,T=d??i.delayDuration,g=a.useRef(!1),[y,m]=Q({prop:r,defaultProp:n??!1,onChange:I=>{I?(i.onOpen(),document.dispatchEvent(new CustomEvent(A))):i.onClose(),s?.(I)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,m(!0)},[m]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m(!1)},[m]),M=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,m(!0),f.current=0},T)},[T,m]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(Z,{...p,children:c.jsx(fe,{scope:e,contentId:x,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{i.isOpenDelayedRef.current?M():E()},[i.isOpenDelayedRef,M,E]),onTriggerLeave:a.useCallback(()=>{h?P():(window.clearTimeout(f.current),f.current=0)},[P,h]),onOpen:E,onClose:P,disableHoverableContent:h,children:t})})};B.displayName=R;var L="TooltipTrigger",Y=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=D(t),d=a.useRef(null),i=H(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(ee,{asChild:!0,...l,children:c.jsx(S.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});Y.displayName=L;var N="TooltipPortal",[ve,xe]=O(N,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(N,e);return c.jsx(ve,{scope:e,forceMount:t,children:c.jsx($,{present:t||s.open,children:c.jsx(te,{asChild:!0,container:n,children:r})})})};U.displayName=N;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=xe(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return c.jsx($,{present:r||l.open,children:l.disableHoverableContent?c.jsx(W,{side:n,...s,ref:e}):c.jsx(he,{side:n,...s,ref:e})})}),he=a.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=H(e,n),[l,d]=a.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,x=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((h,T)=>{const g=h.currentTarget,y={x:h.clientX,y:h.clientY},m=ye(y,g.getBoundingClientRect()),w=Ce(y,m),E=be(T.getBoundingClientRect()),P=Ee([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>x(),[x]),a.useEffect(()=>{if(i&&u){const h=g=>f(g,u),T=g=>f(g,i);return i.addEventListener("pointerleave",h),u.addEventListener("pointerleave",T),()=>{i.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",T)}}},[i,u,f,x]),a.useEffect(()=>{if(l){const h=T=>{const g=T.target,y={x:T.clientX,y:T.clientY},m=i?.contains(g)||u?.contains(g),w=!we(y,l);m?x():w&&(x(),p())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[i,u,l,p,x]),c.jsx(W,{...o,ref:s})}),[ge,Te]=O(R,{isInside:!1}),me=se("TooltipContent"),W=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...d}=o,i=_(b,t),p=D(t),{onClose:u}=i;return a.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),a.useEffect(()=>{if(i.trigger){const v=x=>{x.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[i.trigger,u]),c.jsx(oe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(re,{"data-state":i.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(me,{children:r}),c.jsx(ge,{scope:t,isInside:!0,children:c.jsx(ue,{id:i.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var X="TooltipArrow",K=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return Te(X,t).isInside?null:c.jsx(ae,{...n,...r,ref:e})});K.displayName=X;function ye(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ce(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function be(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function we(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const d=e[s],i=e[l],p=d.x,u=d.y,v=i.x,x=i.y;u>r!=x>r&&t<(v-p)*(r-u)/(x-u)+p&&(n=!n)}return n}function Ee(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Pe(e)}function Pe(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Re=z,_e=B,je=Y,Oe=U,De=q,Ae=K;function Le(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(Re,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ne(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(Le,{children:c.jsx(_e,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Me(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(je,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function Ie(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let d;e[5]!==r?(d=ie("notranslate bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ae,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=i):i=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==d?(p=c.jsx(Oe,{children:c.jsxs(De,{"data-slot":"tooltip-content",sideOffset:l,translate:"no",className:d,...n,children:[t,i]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{Me as T,le as V,Ie as a,Le as b,Ne as c};
1
+ import{r as a,j as c,ay as S,aF as J,aB as Q,c$ as Z,aC as H,d0 as ee,aE as C,bM as $,d1 as te,d2 as G,d3 as oe,d4 as re,aA as ne,d5 as se,d6 as ae,c as j,m as ie}from"./index-CsMY3E0n.js";var le=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ce="VisuallyHidden",F=a.forwardRef((o,e)=>c.jsx(S.span,{...o,ref:e,style:{...le,...o.style}}));F.displayName=ce;var ue=F,[O]=ne("Tooltip",[G]),D=G(),V="TooltipProvider",de=700,A="tooltip.open",[pe,k]=O(V),z=o=>{const{__scopeTooltip:e,delayDuration:t=de,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=a.useRef(!0),d=a.useRef(!1),i=a.useRef(0);return a.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsx(pe,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};z.displayName=V;var R="Tooltip",[fe,_]=O(R),B=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:d}=o,i=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),x=J(),f=a.useRef(0),h=l??i.disableHoverableContent,T=d??i.delayDuration,g=a.useRef(!1),[y,m]=Q({prop:r,defaultProp:n??!1,onChange:I=>{I?(i.onOpen(),document.dispatchEvent(new CustomEvent(A))):i.onClose(),s?.(I)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,m(!0)},[m]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m(!1)},[m]),M=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,m(!0),f.current=0},T)},[T,m]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(Z,{...p,children:c.jsx(fe,{scope:e,contentId:x,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{i.isOpenDelayedRef.current?M():E()},[i.isOpenDelayedRef,M,E]),onTriggerLeave:a.useCallback(()=>{h?P():(window.clearTimeout(f.current),f.current=0)},[P,h]),onOpen:E,onClose:P,disableHoverableContent:h,children:t})})};B.displayName=R;var L="TooltipTrigger",Y=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=D(t),d=a.useRef(null),i=H(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(ee,{asChild:!0,...l,children:c.jsx(S.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});Y.displayName=L;var N="TooltipPortal",[ve,xe]=O(N,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(N,e);return c.jsx(ve,{scope:e,forceMount:t,children:c.jsx($,{present:t||s.open,children:c.jsx(te,{asChild:!0,container:n,children:r})})})};U.displayName=N;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=xe(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return c.jsx($,{present:r||l.open,children:l.disableHoverableContent?c.jsx(W,{side:n,...s,ref:e}):c.jsx(he,{side:n,...s,ref:e})})}),he=a.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=H(e,n),[l,d]=a.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,x=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((h,T)=>{const g=h.currentTarget,y={x:h.clientX,y:h.clientY},m=ye(y,g.getBoundingClientRect()),w=Ce(y,m),E=be(T.getBoundingClientRect()),P=Ee([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>x(),[x]),a.useEffect(()=>{if(i&&u){const h=g=>f(g,u),T=g=>f(g,i);return i.addEventListener("pointerleave",h),u.addEventListener("pointerleave",T),()=>{i.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",T)}}},[i,u,f,x]),a.useEffect(()=>{if(l){const h=T=>{const g=T.target,y={x:T.clientX,y:T.clientY},m=i?.contains(g)||u?.contains(g),w=!we(y,l);m?x():w&&(x(),p())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[i,u,l,p,x]),c.jsx(W,{...o,ref:s})}),[ge,Te]=O(R,{isInside:!1}),me=se("TooltipContent"),W=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...d}=o,i=_(b,t),p=D(t),{onClose:u}=i;return a.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),a.useEffect(()=>{if(i.trigger){const v=x=>{x.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[i.trigger,u]),c.jsx(oe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(re,{"data-state":i.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(me,{children:r}),c.jsx(ge,{scope:t,isInside:!0,children:c.jsx(ue,{id:i.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var X="TooltipArrow",K=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return Te(X,t).isInside?null:c.jsx(ae,{...n,...r,ref:e})});K.displayName=X;function ye(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ce(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function be(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function we(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const d=e[s],i=e[l],p=d.x,u=d.y,v=i.x,x=i.y;u>r!=x>r&&t<(v-p)*(r-u)/(x-u)+p&&(n=!n)}return n}function Ee(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Pe(e)}function Pe(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Re=z,_e=B,je=Y,Oe=U,De=q,Ae=K;function Le(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(Re,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ne(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(Le,{children:c.jsx(_e,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Me(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(je,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function Ie(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let d;e[5]!==r?(d=ie("notranslate bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ae,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=i):i=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==d?(p=c.jsx(Oe,{children:c.jsxs(De,{"data-slot":"tooltip-content",sideOffset:l,translate:"no",className:d,...n,children:[t,i]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{Me as T,le as V,Ie as a,Le as b,Ne as c};
@@ -1 +1 @@
1
- import{c as p,F as m,K as h,n as y,x as R}from"./index-CckLDzub.js";import{u as S,c as D}from"./studio-tools-BB_5IEtF.js";const P=["deco","anthropic","openrouter","llmapi","google","openai-compatible"],M=new Set(P);function O(o){return M.has(o)}const A={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],llmapi:["claude-haiku-4-5","claude-haiku","gpt-4o-mini"],google:["gemini-2.5-flash","gemini-3-flash"]},v={anthropic:["claude-sonnet-5","claude-sonnet"],openrouter:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude"],llmapi:["claude-sonnet-4-6","claude-sonnet"],google:["gemini-3-pro","gemini-3-flash"]},L={anthropic:["claude-opus-4-8","claude-sonnet-5","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8:extended","anthropic/claude-opus-4.8","anthropic/claude-sonnet-5:extended","anthropic/claude-sonnet-5","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],llmapi:["claude-opus-4-8","claude-opus","claude-sonnet-4-6"],google:["gemini-3-pro"]},T={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],llmapi:["gemini-2.5-flash-image","gpt-image-1"],google:["gemini-2.0-flash-image"]},x={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},K={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function _(o){return o.toLowerCase().replace(/[^a-z0-9]/g,"")}function w(o){return _(o).includes("deepresearch")}const q=["sonar","searchpreview","online"];function I(o){const e=_(o);return e.includes("deepresearch")?!1:q.some(t=>e.includes(t))}function C(o){return o.asyncResearch!==!0&&I(o.modelId)}function F(o){return o.asyncResearch===!0||w(o.modelId)||I(o.modelId)}function u(o,e,t,n){for(const i of t){const s=o.find(a=>a.modelId===i);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}for(const i of t){const s=o.find(a=>a.modelId.includes(i));if(s)return{keyId:e,modelId:s.modelId,title:s.title}}if(n){const i=o.find(n);if(i)return{keyId:e,modelId:i.modelId,title:i.title}}return null}function b(o,e){const t={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const n of o){const i=e[n.id]??[],s=n.providerId;t.chat.fast||(t.chat.fast=u(i,n.id,A[s]??[])),t.chat.smart||(t.chat.smart=u(i,n.id,v[s]??[])),t.chat.thinking||(t.chat.thinking=u(i,n.id,L[s]??[])),t.image||(t.image=u(i,n.id,T[s]??[],a=>a.capabilities?.includes("image")===!0)),t.webSearch||(t.webSearch=u(i,n.id,x[s]??[],C)),t.deepResearch||(t.deepResearch=u(i,n.id,K[s]??[],F))}return t}function H(o,e){return{queryKey:h.aiProviderKeys(e),staleTime:6e4,queryFn:async()=>await D(o,"AI_PROVIDER_KEY_LIST",{})}}function z(){const o=p.c(7),{org:e}=m(),t=S();let n;o[0]!==e.id?(n=h.aiProviders(e.id),o[0]=e.id,o[1]=n):n=o[1];let i;o[2]!==t?(i=async()=>await t.call("AI_PROVIDERS_LIST",{}),o[2]=t,o[3]=i):i=o[3];let s;o[4]!==n||o[5]!==i?(s={queryKey:n,staleTime:1/0,queryFn:i},o[4]=n,o[5]=i,o[6]=s):s=o[6];const{data:a}=R(s);return a}function N(){const o=p.c(5),{org:e}=m();let t;o[0]!==e.id||o[1]!==e.slug?(t=H(e.slug,e.id),o[0]=e.id,o[1]=e.slug,o[2]=t):t=o[2];const{data:n}=R(t);let i;return o[3]!==n?.keys?(i=n?.keys??[],o[3]=n?.keys,o[4]=i):i=o[4],i}function B(){const o=p.c(2),e=N();let t;return o[0]!==e?(t=e.filter(Q),o[0]=e,o[1]=t):t=o[1],t}function Q(o){return O(o.providerId)}function E(o){const e=p.c(15),{org:t}=m(),n=S();let i;e[0]!==o||e[1]!==t.id?(i=h.aiProviderModels(t.id,o??""),e[0]=o,e[1]=t.id,e[2]=i):i=e[2];const s=!!o;let a;e[3]!==o||e[4]!==n?(a=async()=>await n.call("AI_PROVIDERS_LIST_MODELS",{keyId:o??""}),e[3]=o,e[4]=n,e[5]=a):a=e[5];let r;e[6]!==i||e[7]!==s||e[8]!==a?(r={queryKey:i,enabled:s,staleTime:6e4,queryFn:a},e[6]=i,e[7]=s,e[8]=a,e[9]=r):r=e[9];const{data:l,isLoading:c}=y(r);let d;e[10]!==l?.models?(d=l?.models??[],e[10]=l?.models,e[11]=d):d=e[11];const g=!!o&&c;let f;return e[12]!==d||e[13]!==g?(f={models:d,isLoading:g},e[12]=d,e[13]=g,e[14]=f):f=e[14],f}function G(o){const e=p.c(8),t=o[0],n=o[1],i=o[2],{models:s}=E(t?.id),{models:a}=E(n?.id),{models:r}=E(i?.id);let l;if(e[0]!==t||e[1]!==n||e[2]!==i||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==r){const c={};t?.id&&(c[t.id]=s),n?.id&&(c[n.id]=a),i?.id&&(c[i.id]=r),l=b(o,c),e[0]=t,e[1]=n,e[2]=i,e[3]=o,e[4]=s,e[5]=a,e[6]=r,e[7]=l}else l=e[7];return l}function Y(o){const e=p.c(11),{org:t}=m(),n=S();let i;e[0]!==o||e[1]!==t.id?(i=h.aiProviderModels(t.id,o),e[0]=o,e[1]=t.id,e[2]=i):i=e[2];let s;e[3]!==o||e[4]!==n?(s=async()=>await n.call("AI_PROVIDERS_LIST_MODELS",{keyId:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5];let a;e[6]!==i||e[7]!==s?(a={queryKey:i,staleTime:6e4,queryFn:s},e[6]=i,e[7]=s,e[8]=a):a=e[8];const{data:r}=R(a);let l;return e[9]!==r?.models?(l=r?.models??[],e[9]=r?.models,e[10]=l):l=e[10],l}export{G as a,E as b,F as c,N as d,O as e,z as f,Y as g,C as i,b as p,B as u};
1
+ import{c as p,F as m,K as h,n as y,x as R}from"./index-CsMY3E0n.js";import{u as S,c as D}from"./studio-tools-DfsuYmJt.js";const P=["deco","anthropic","openrouter","llmapi","google","openai-compatible"],M=new Set(P);function O(o){return M.has(o)}const A={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],llmapi:["claude-haiku-4-5","claude-haiku","gpt-4o-mini"],google:["gemini-2.5-flash","gemini-3-flash"]},v={anthropic:["claude-sonnet-5","claude-sonnet"],openrouter:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude"],llmapi:["claude-sonnet-4-6","claude-sonnet"],google:["gemini-3-pro","gemini-3-flash"]},L={anthropic:["claude-opus-4-8","claude-sonnet-5","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8:extended","anthropic/claude-opus-4.8","anthropic/claude-sonnet-5:extended","anthropic/claude-sonnet-5","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],llmapi:["claude-opus-4-8","claude-opus","claude-sonnet-4-6"],google:["gemini-3-pro"]},T={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],llmapi:["gemini-2.5-flash-image","gpt-image-1"],google:["gemini-2.0-flash-image"]},x={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},K={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function _(o){return o.toLowerCase().replace(/[^a-z0-9]/g,"")}function w(o){return _(o).includes("deepresearch")}const q=["sonar","searchpreview","online"];function I(o){const e=_(o);return e.includes("deepresearch")?!1:q.some(t=>e.includes(t))}function C(o){return o.asyncResearch!==!0&&I(o.modelId)}function F(o){return o.asyncResearch===!0||w(o.modelId)||I(o.modelId)}function u(o,e,t,n){for(const i of t){const s=o.find(a=>a.modelId===i);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}for(const i of t){const s=o.find(a=>a.modelId.includes(i));if(s)return{keyId:e,modelId:s.modelId,title:s.title}}if(n){const i=o.find(n);if(i)return{keyId:e,modelId:i.modelId,title:i.title}}return null}function b(o,e){const t={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const n of o){const i=e[n.id]??[],s=n.providerId;t.chat.fast||(t.chat.fast=u(i,n.id,A[s]??[])),t.chat.smart||(t.chat.smart=u(i,n.id,v[s]??[])),t.chat.thinking||(t.chat.thinking=u(i,n.id,L[s]??[])),t.image||(t.image=u(i,n.id,T[s]??[],a=>a.capabilities?.includes("image")===!0)),t.webSearch||(t.webSearch=u(i,n.id,x[s]??[],C)),t.deepResearch||(t.deepResearch=u(i,n.id,K[s]??[],F))}return t}function H(o,e){return{queryKey:h.aiProviderKeys(e),staleTime:6e4,queryFn:async()=>await D(o,"AI_PROVIDER_KEY_LIST",{})}}function z(){const o=p.c(7),{org:e}=m(),t=S();let n;o[0]!==e.id?(n=h.aiProviders(e.id),o[0]=e.id,o[1]=n):n=o[1];let i;o[2]!==t?(i=async()=>await t.call("AI_PROVIDERS_LIST",{}),o[2]=t,o[3]=i):i=o[3];let s;o[4]!==n||o[5]!==i?(s={queryKey:n,staleTime:1/0,queryFn:i},o[4]=n,o[5]=i,o[6]=s):s=o[6];const{data:a}=R(s);return a}function N(){const o=p.c(5),{org:e}=m();let t;o[0]!==e.id||o[1]!==e.slug?(t=H(e.slug,e.id),o[0]=e.id,o[1]=e.slug,o[2]=t):t=o[2];const{data:n}=R(t);let i;return o[3]!==n?.keys?(i=n?.keys??[],o[3]=n?.keys,o[4]=i):i=o[4],i}function B(){const o=p.c(2),e=N();let t;return o[0]!==e?(t=e.filter(Q),o[0]=e,o[1]=t):t=o[1],t}function Q(o){return O(o.providerId)}function E(o){const e=p.c(15),{org:t}=m(),n=S();let i;e[0]!==o||e[1]!==t.id?(i=h.aiProviderModels(t.id,o??""),e[0]=o,e[1]=t.id,e[2]=i):i=e[2];const s=!!o;let a;e[3]!==o||e[4]!==n?(a=async()=>await n.call("AI_PROVIDERS_LIST_MODELS",{keyId:o??""}),e[3]=o,e[4]=n,e[5]=a):a=e[5];let r;e[6]!==i||e[7]!==s||e[8]!==a?(r={queryKey:i,enabled:s,staleTime:6e4,queryFn:a},e[6]=i,e[7]=s,e[8]=a,e[9]=r):r=e[9];const{data:l,isLoading:c}=y(r);let d;e[10]!==l?.models?(d=l?.models??[],e[10]=l?.models,e[11]=d):d=e[11];const g=!!o&&c;let f;return e[12]!==d||e[13]!==g?(f={models:d,isLoading:g},e[12]=d,e[13]=g,e[14]=f):f=e[14],f}function G(o){const e=p.c(8),t=o[0],n=o[1],i=o[2],{models:s}=E(t?.id),{models:a}=E(n?.id),{models:r}=E(i?.id);let l;if(e[0]!==t||e[1]!==n||e[2]!==i||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==r){const c={};t?.id&&(c[t.id]=s),n?.id&&(c[n.id]=a),i?.id&&(c[i.id]=r),l=b(o,c),e[0]=t,e[1]=n,e[2]=i,e[3]=o,e[4]=s,e[5]=a,e[6]=r,e[7]=l}else l=e[7];return l}function Y(o){const e=p.c(11),{org:t}=m(),n=S();let i;e[0]!==o||e[1]!==t.id?(i=h.aiProviderModels(t.id,o),e[0]=o,e[1]=t.id,e[2]=i):i=e[2];let s;e[3]!==o||e[4]!==n?(s=async()=>await n.call("AI_PROVIDERS_LIST_MODELS",{keyId:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5];let a;e[6]!==i||e[7]!==s?(a={queryKey:i,staleTime:6e4,queryFn:s},e[6]=i,e[7]=s,e[8]=a):a=e[8];const{data:r}=R(a);let l;return e[9]!==r?.models?(l=r?.models??[],e[9]=r?.models,e[10]=l):l=e[10],l}export{G as a,E as b,F as c,N as d,O as e,z as f,Y as g,C as i,b as p,B as u};
@@ -1 +1 @@
1
- import{c as U,F as q,K as T,n as I,o as x,e as y,t as m}from"./index-CckLDzub.js";import{S as z,u as J}from"./use-mcp-client-DsGe28fL.js";import{u as Q}from"./studio-tools-BB_5IEtF.js";function V(t){if(t.paramsSchema&&typeof t.paramsSchema=="object")return t;const e={};if(Array.isArray(t.params))for(const s of t.params)e[s.name]={type:s.type,description:s.description,enum:s.enum};else t.params&&typeof t.params=="object"&&Object.assign(e,t.params);return{type:t.type,description:t.description,paramsSchema:e}}function st(t){const e=U.c(12),{org:s}=q(),l=t??z;let a;e[0]!==s.id||e[1]!==s.slug||e[2]!==l?(a={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=l,e[3]=a):a=e[3];const i=J(a);let n;e[4]!==t?(n=T.toolCall(t??"","TRIGGER_LIST",""),e[4]=t,e[5]=n):n=e[5];let o;e[6]!==i?(o=async()=>{const d=await i.callTool({name:"TRIGGER_LIST",arguments:{}});return(d.structuredContent??d).triggers.map(V)},e[6]=i,e[7]=o):o=e[7];const c=!!t;let r;return e[8]!==n||e[9]!==o||e[10]!==c?(r={queryKey:n,queryFn:o,enabled:c,staleTime:3e4},e[8]=n,e[9]=o,e[10]=c,e[11]=r):r=e[11],I(r)}function it(t){const e=U.c(9),{org:s}=q(),l=Q();let a;e[0]!==s.id||e[1]!==t?(a=T.automations(s.id,t),e[0]=s.id,e[1]=t,e[2]=a):a=e[2];let i;e[3]!==l||e[4]!==t?(i=async()=>(await l.call("AUTOMATION_LIST",t!=null?{virtual_mcp_id:t}:{})).automations,e[3]=l,e[4]=t,e[5]=i):i=e[5];let n;return e[6]!==a||e[7]!==i?(n={queryKey:a,queryFn:i,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n):n=e[8],I(n)}function ot(t){const e=U.c(10),{org:s}=q(),l=Q();let a;e[0]!==t||e[1]!==s.id?(a=T.automation(s.id,t),e[0]=t,e[1]=s.id,e[2]=a):a=e[2];let i;e[3]!==t||e[4]!==l?(i=async()=>(await l.call("AUTOMATION_GET",{id:t})).automation,e[3]=t,e[4]=l,e[5]=i):i=e[5];const n=!!t;let o;return e[6]!==a||e[7]!==i||e[8]!==n?(o={queryKey:a,queryFn:i,enabled:n,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n,e[9]=o):o=e[9],I(o)}function at(t,e){const s=U.c(12),{org:l}=q(),a=Q();let i;s[0]!==t||s[1]!==l.id||s[2]!==e?(i=T.automationRunStats(l.id,t,JSON.stringify(e??{})),s[0]=t,s[1]=l.id,s[2]=e,s[3]=i):i=s[3];let n;s[4]!==t||s[5]!==e||s[6]!==a?(n=async()=>await a.call("AUTOMATION_RUN_STATS",{automation_id:t,...e?.startDate?{startDate:e.startDate}:{},...e?.endDate?{endDate:e.endDate}:{}}),s[4]=t,s[5]=e,s[6]=a,s[7]=n):n=s[7];const o=!!t;let c;return s[8]!==i||s[9]!==n||s[10]!==o?(c={queryKey:i,queryFn:n,enabled:o,staleTime:3e4},s[8]=i,s[9]=n,s[10]=o,s[11]=c):c=s[11],I(c)}function nt(t){return{name:"New Automation",messages:[],models:{tier:"smart"},temperature:.5,active:!0,virtual_mcp_id:t}}function lt(){const t=U.c(64),{org:e}=q(),s=Q(),l=x();let a;t[0]!==e||t[1]!==l?(a=()=>l.invalidateQueries({queryKey:T.automationsAll(e.id)}),t[0]=e,t[1]=l,t[2]=a):a=t[2];const i=a;let n;t[3]!==e||t[4]!==l?(n=u=>l.invalidateQueries({queryKey:T.automation(e.id,u)}),t[3]=e,t[4]=l,t[5]=n):n=t[5];const o=n;let c;t[6]!==s?(c=async u=>await s.call("AUTOMATION_CREATE",u),t[6]=s,t[7]=c):c=t[7];let r;t[8]!==i?(r=()=>{i(),m.success("Automation created successfully")},t[8]=i,t[9]=r):r=t[9];let d;t[10]!==c||t[11]!==r?(d={mutationFn:c,onSuccess:r,onError:X},t[10]=c,t[11]=r,t[12]=d):d=t[12];const D=y(d);let A;t[13]!==s?(A=async u=>await s.call("AUTOMATION_UPDATE",u),t[13]=s,t[14]=A):A=t[14];let p;t[15]!==i||t[16]!==o?(p=(u,f)=>{i(),typeof f.id=="string"&&o(f.id),m.success("Automation updated successfully")},t[15]=i,t[16]=o,t[17]=p):p=t[17];let G;t[18]!==A||t[19]!==p?(G={mutationFn:A,onSuccess:p,onError:W},t[18]=A,t[19]=p,t[20]=G):G=t[20];const j=y(G);let g;t[21]!==s?(g=async u=>await s.call("AUTOMATION_DELETE",{id:u}),t[21]=s,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==e||t[25]!==l?(_=(u,f)=>{l.removeQueries({queryKey:T.automation(e.id,f)}),i(),m.success("Automation deleted successfully")},t[23]=i,t[24]=e,t[25]=l,t[26]=_):_=t[26];let $;t[27]!==g||t[28]!==_?($={mutationFn:g,onSuccess:_,onError:H},t[27]=g,t[28]=_,t[29]=$):$=t[29];const k=y($);let S;t[30]!==s?(S=async u=>await s.call("AUTOMATION_TRIGGER_ADD",u),t[30]=s,t[31]=S):S=t[31];let E;t[32]!==i||t[33]!==o?(E=u=>{i(),o(u.automation_id)},t[32]=i,t[33]=o,t[34]=E):E=t[34];let K;t[35]!==S||t[36]!==E?(K={mutationFn:S,onSuccess:E},t[35]=S,t[36]=E,t[37]=K):K=t[37];const P=y(K);let O;t[38]!==s?(O=async u=>await s.call("AUTOMATION_TRIGGER_ROTATE_TOKEN",{trigger_id:u.trigger_id}),t[38]=s,t[39]=O):O=t[39];let R;t[40]!==i||t[41]!==o?(R=(u,f)=>{i(),o(f.automation_id)},t[40]=i,t[41]=o,t[42]=R):R=t[42];let C;t[43]!==O||t[44]!==R?(C={mutationFn:O,onSuccess:R},t[43]=O,t[44]=R,t[45]=C):C=t[45];const h=y(C);let F;t[46]!==s?(F=async u=>await s.call("AUTOMATION_TRIGGER_REMOVE",{trigger_id:u.trigger_id}),t[46]=s,t[47]=F):F=t[47];let N;t[48]!==i||t[49]!==o?(N=(u,f)=>{i(),o(f.automation_id)},t[48]=i,t[49]=o,t[50]=N):N=t[50];let b;t[51]!==F||t[52]!==N?(b={mutationFn:F,onSuccess:N},t[51]=F,t[52]=N,t[53]=b):b=t[53];const v=y(b);let L;t[54]!==s?(L={mutationFn:async u=>await s.call("AUTOMATION_RUN",{id:u}),onSuccess:B,onError:Y},t[54]=s,t[55]=L):L=t[55];const w=y(L);let M;return t[56]!==D||t[57]!==k||t[58]!==w||t[59]!==P||t[60]!==v||t[61]!==h||t[62]!==j?(M={create:D,update:j,remove:k,triggerAdd:P,triggerRemove:v,triggerRotateToken:h,run:w},t[56]=D,t[57]=k,t[58]=w,t[59]=P,t[60]=v,t[61]=h,t[62]=j,t[63]=M):M=t[63],M}function Y(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to run automation: ${e}`)}function B(t){t.skipped?m.info(`Automation skipped: ${t.skipped}`):t.error?m.error(`Automation failed: ${t.error}`):m.success("Automation triggered")}function H(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to delete automation: ${e}`)}function W(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to update automation: ${e}`)}function X(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to create automation: ${e}`)}export{st as a,ot as b,it as c,nt as d,at as e,lt as u};
1
+ import{c as U,F as q,K as T,n as I,o as x,e as y,t as m}from"./index-CsMY3E0n.js";import{S as z,u as J}from"./use-mcp-client-CpOZK5-l.js";import{u as Q}from"./studio-tools-DfsuYmJt.js";function V(t){if(t.paramsSchema&&typeof t.paramsSchema=="object")return t;const e={};if(Array.isArray(t.params))for(const s of t.params)e[s.name]={type:s.type,description:s.description,enum:s.enum};else t.params&&typeof t.params=="object"&&Object.assign(e,t.params);return{type:t.type,description:t.description,paramsSchema:e}}function st(t){const e=U.c(12),{org:s}=q(),l=t??z;let a;e[0]!==s.id||e[1]!==s.slug||e[2]!==l?(a={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=l,e[3]=a):a=e[3];const i=J(a);let n;e[4]!==t?(n=T.toolCall(t??"","TRIGGER_LIST",""),e[4]=t,e[5]=n):n=e[5];let o;e[6]!==i?(o=async()=>{const d=await i.callTool({name:"TRIGGER_LIST",arguments:{}});return(d.structuredContent??d).triggers.map(V)},e[6]=i,e[7]=o):o=e[7];const c=!!t;let r;return e[8]!==n||e[9]!==o||e[10]!==c?(r={queryKey:n,queryFn:o,enabled:c,staleTime:3e4},e[8]=n,e[9]=o,e[10]=c,e[11]=r):r=e[11],I(r)}function it(t){const e=U.c(9),{org:s}=q(),l=Q();let a;e[0]!==s.id||e[1]!==t?(a=T.automations(s.id,t),e[0]=s.id,e[1]=t,e[2]=a):a=e[2];let i;e[3]!==l||e[4]!==t?(i=async()=>(await l.call("AUTOMATION_LIST",t!=null?{virtual_mcp_id:t}:{})).automations,e[3]=l,e[4]=t,e[5]=i):i=e[5];let n;return e[6]!==a||e[7]!==i?(n={queryKey:a,queryFn:i,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n):n=e[8],I(n)}function ot(t){const e=U.c(10),{org:s}=q(),l=Q();let a;e[0]!==t||e[1]!==s.id?(a=T.automation(s.id,t),e[0]=t,e[1]=s.id,e[2]=a):a=e[2];let i;e[3]!==t||e[4]!==l?(i=async()=>(await l.call("AUTOMATION_GET",{id:t})).automation,e[3]=t,e[4]=l,e[5]=i):i=e[5];const n=!!t;let o;return e[6]!==a||e[7]!==i||e[8]!==n?(o={queryKey:a,queryFn:i,enabled:n,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n,e[9]=o):o=e[9],I(o)}function at(t,e){const s=U.c(12),{org:l}=q(),a=Q();let i;s[0]!==t||s[1]!==l.id||s[2]!==e?(i=T.automationRunStats(l.id,t,JSON.stringify(e??{})),s[0]=t,s[1]=l.id,s[2]=e,s[3]=i):i=s[3];let n;s[4]!==t||s[5]!==e||s[6]!==a?(n=async()=>await a.call("AUTOMATION_RUN_STATS",{automation_id:t,...e?.startDate?{startDate:e.startDate}:{},...e?.endDate?{endDate:e.endDate}:{}}),s[4]=t,s[5]=e,s[6]=a,s[7]=n):n=s[7];const o=!!t;let c;return s[8]!==i||s[9]!==n||s[10]!==o?(c={queryKey:i,queryFn:n,enabled:o,staleTime:3e4},s[8]=i,s[9]=n,s[10]=o,s[11]=c):c=s[11],I(c)}function nt(t){return{name:"New Automation",messages:[],models:{tier:"smart"},temperature:.5,active:!0,virtual_mcp_id:t}}function lt(){const t=U.c(64),{org:e}=q(),s=Q(),l=x();let a;t[0]!==e||t[1]!==l?(a=()=>l.invalidateQueries({queryKey:T.automationsAll(e.id)}),t[0]=e,t[1]=l,t[2]=a):a=t[2];const i=a;let n;t[3]!==e||t[4]!==l?(n=u=>l.invalidateQueries({queryKey:T.automation(e.id,u)}),t[3]=e,t[4]=l,t[5]=n):n=t[5];const o=n;let c;t[6]!==s?(c=async u=>await s.call("AUTOMATION_CREATE",u),t[6]=s,t[7]=c):c=t[7];let r;t[8]!==i?(r=()=>{i(),m.success("Automation created successfully")},t[8]=i,t[9]=r):r=t[9];let d;t[10]!==c||t[11]!==r?(d={mutationFn:c,onSuccess:r,onError:X},t[10]=c,t[11]=r,t[12]=d):d=t[12];const D=y(d);let A;t[13]!==s?(A=async u=>await s.call("AUTOMATION_UPDATE",u),t[13]=s,t[14]=A):A=t[14];let p;t[15]!==i||t[16]!==o?(p=(u,f)=>{i(),typeof f.id=="string"&&o(f.id),m.success("Automation updated successfully")},t[15]=i,t[16]=o,t[17]=p):p=t[17];let G;t[18]!==A||t[19]!==p?(G={mutationFn:A,onSuccess:p,onError:W},t[18]=A,t[19]=p,t[20]=G):G=t[20];const j=y(G);let g;t[21]!==s?(g=async u=>await s.call("AUTOMATION_DELETE",{id:u}),t[21]=s,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==e||t[25]!==l?(_=(u,f)=>{l.removeQueries({queryKey:T.automation(e.id,f)}),i(),m.success("Automation deleted successfully")},t[23]=i,t[24]=e,t[25]=l,t[26]=_):_=t[26];let $;t[27]!==g||t[28]!==_?($={mutationFn:g,onSuccess:_,onError:H},t[27]=g,t[28]=_,t[29]=$):$=t[29];const k=y($);let S;t[30]!==s?(S=async u=>await s.call("AUTOMATION_TRIGGER_ADD",u),t[30]=s,t[31]=S):S=t[31];let E;t[32]!==i||t[33]!==o?(E=u=>{i(),o(u.automation_id)},t[32]=i,t[33]=o,t[34]=E):E=t[34];let K;t[35]!==S||t[36]!==E?(K={mutationFn:S,onSuccess:E},t[35]=S,t[36]=E,t[37]=K):K=t[37];const P=y(K);let O;t[38]!==s?(O=async u=>await s.call("AUTOMATION_TRIGGER_ROTATE_TOKEN",{trigger_id:u.trigger_id}),t[38]=s,t[39]=O):O=t[39];let R;t[40]!==i||t[41]!==o?(R=(u,f)=>{i(),o(f.automation_id)},t[40]=i,t[41]=o,t[42]=R):R=t[42];let C;t[43]!==O||t[44]!==R?(C={mutationFn:O,onSuccess:R},t[43]=O,t[44]=R,t[45]=C):C=t[45];const h=y(C);let F;t[46]!==s?(F=async u=>await s.call("AUTOMATION_TRIGGER_REMOVE",{trigger_id:u.trigger_id}),t[46]=s,t[47]=F):F=t[47];let N;t[48]!==i||t[49]!==o?(N=(u,f)=>{i(),o(f.automation_id)},t[48]=i,t[49]=o,t[50]=N):N=t[50];let b;t[51]!==F||t[52]!==N?(b={mutationFn:F,onSuccess:N},t[51]=F,t[52]=N,t[53]=b):b=t[53];const v=y(b);let L;t[54]!==s?(L={mutationFn:async u=>await s.call("AUTOMATION_RUN",{id:u}),onSuccess:B,onError:Y},t[54]=s,t[55]=L):L=t[55];const w=y(L);let M;return t[56]!==D||t[57]!==k||t[58]!==w||t[59]!==P||t[60]!==v||t[61]!==h||t[62]!==j?(M={create:D,update:j,remove:k,triggerAdd:P,triggerRemove:v,triggerRotateToken:h,run:w},t[56]=D,t[57]=k,t[58]=w,t[59]=P,t[60]=v,t[61]=h,t[62]=j,t[63]=M):M=t[63],M}function Y(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to run automation: ${e}`)}function B(t){t.skipped?m.info(`Automation skipped: ${t.skipped}`):t.error?m.error(`Automation failed: ${t.error}`):m.success("Automation triggered")}function H(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to delete automation: ${e}`)}function W(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to update automation: ${e}`)}function X(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to create automation: ${e}`)}export{st as a,ot as b,it as c,nt as d,at as e,lt as u};
@@ -1 +1 @@
1
- import{c as T,r as o}from"./index-CckLDzub.js";const y=700;function x(r,l,_){const e=T.c(7),f=y,[a,m]=o.useState(r),[i,S]=o.useState(r),[A,d]=o.useState(!1),t=o.useRef(null);r!==i&&(S(r),A||m(r));let s;e[0]!==f||e[1]!==l?(s=u=>{m(u),d(!0),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,d(!1),l(u)},f)},e[0]=f,e[1]=l,e[2]=s):s=e[2];const p=s;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{m(u),t.current&&clearTimeout(t.current),t.current=null,d(!1)},e[3]=c):c=e[3];const E=c;let n;return e[4]!==a||e[5]!==p?(n=[a,p,E],e[4]=a,e[5]=p,e[6]=n):n=e[6],n}export{x as u};
1
+ import{c as T,r as o}from"./index-CsMY3E0n.js";const y=700;function x(r,l,_){const e=T.c(7),f=y,[a,m]=o.useState(r),[i,S]=o.useState(r),[A,d]=o.useState(!1),t=o.useRef(null);r!==i&&(S(r),A||m(r));let s;e[0]!==f||e[1]!==l?(s=u=>{m(u),d(!0),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,d(!1),l(u)},f)},e[0]=f,e[1]=l,e[2]=s):s=e[2];const p=s;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{m(u),t.current&&clearTimeout(t.current),t.current=null,d(!1)},e[3]=c):c=e[3];const E=c;let n;return e[4]!==a||e[5]!==p?(n=[a,p,E],e[4]=a,e[5]=p,e[6]=n):n=e[6],n}export{x as u};
@@ -1 +1 @@
1
- import{c as u,F as m,n as g,K as p}from"./index-CckLDzub.js";const b=new Set(["owner","admin"]);function d(){const e=u.c(11),{org:r,locator:c}=m();let o;e[0]!==c?(o=p.myCapabilities(c),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=async()=>{const f=await fetch(`/api/auth/custom/my-capabilities/${encodeURIComponent(r.slug)}`,{credentials:"include"});if(!f.ok)throw new Error(`my-capabilities request failed: ${f.status}`);return await f.json()},e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i={queryKey:o,queryFn:a,staleTime:3e4,retry:2},e[4]=o,e[5]=a,e[6]=i):i=e[6];const{data:s,isLoading:l,isError:n}=g(i);let t;return e[7]!==s||e[8]!==n||e[9]!==l?(t={data:s,loading:l,error:n},e[7]=s,e[8]=n,e[9]=l,e[10]=t):t=e[10],t}function _(e){const r=u.c(8),{data:c,loading:o,error:a}=d();if(o){let t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!0,error:!1,reason:"loading"},r[0]=t):t=r[0],t}if(a){let t;return r[1]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!0,reason:"error"},r[1]=t):t=r[1],t}const i=c?.role??null;if(!i){let t;return r[2]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!1,reason:"denied"},r[2]=t):t=r[2],t}if(i==="owner"){let t;return r[3]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"owner"},r[3]=t):t=r[3],t}if(i==="admin"){let t;return r[4]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"admin"},r[4]=t):t=r[4],t}const s=c?.capabilities?.[e]===!0,l=s?"role":"denied";let n;return r[5]!==s||r[6]!==l?(n={granted:s,loading:!1,error:!1,reason:l},r[5]=s,r[6]=l,r[7]=n):n=r[7],n}function S(){const e=u.c(10),{data:r,loading:c,error:o}=d(),a=r?.role??void 0;let i;e[0]!==a?(i=a?b.has(a):!1,e[0]=a,e[1]=i):i=e[1];const s=i;let l;e[2]!==r?.capabilities?(l=r?.capabilities??{},e[2]=r?.capabilities,e[3]=l):l=e[3];const n=l;let t;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a||e[8]!==n?(t={capabilities:n,loading:c,error:o,isPrivileged:s,roleSlug:a},e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=n,e[9]=t):t=e[9],t}export{S as a,_ as u};
1
+ import{c as u,F as m,n as g,K as p}from"./index-CsMY3E0n.js";const b=new Set(["owner","admin"]);function d(){const e=u.c(11),{org:r,locator:c}=m();let o;e[0]!==c?(o=p.myCapabilities(c),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=async()=>{const f=await fetch(`/api/auth/custom/my-capabilities/${encodeURIComponent(r.slug)}`,{credentials:"include"});if(!f.ok)throw new Error(`my-capabilities request failed: ${f.status}`);return await f.json()},e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i={queryKey:o,queryFn:a,staleTime:3e4,retry:2},e[4]=o,e[5]=a,e[6]=i):i=e[6];const{data:s,isLoading:l,isError:n}=g(i);let t;return e[7]!==s||e[8]!==n||e[9]!==l?(t={data:s,loading:l,error:n},e[7]=s,e[8]=n,e[9]=l,e[10]=t):t=e[10],t}function _(e){const r=u.c(8),{data:c,loading:o,error:a}=d();if(o){let t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!0,error:!1,reason:"loading"},r[0]=t):t=r[0],t}if(a){let t;return r[1]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!0,reason:"error"},r[1]=t):t=r[1],t}const i=c?.role??null;if(!i){let t;return r[2]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!1,reason:"denied"},r[2]=t):t=r[2],t}if(i==="owner"){let t;return r[3]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"owner"},r[3]=t):t=r[3],t}if(i==="admin"){let t;return r[4]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"admin"},r[4]=t):t=r[4],t}const s=c?.capabilities?.[e]===!0,l=s?"role":"denied";let n;return r[5]!==s||r[6]!==l?(n={granted:s,loading:!1,error:!1,reason:l},r[5]=s,r[6]=l,r[7]=n):n=r[7],n}function S(){const e=u.c(10),{data:r,loading:c,error:o}=d(),a=r?.role??void 0;let i;e[0]!==a?(i=a?b.has(a):!1,e[0]=a,e[1]=i):i=e[1];const s=i;let l;e[2]!==r?.capabilities?(l=r?.capabilities??{},e[2]=r?.capabilities,e[3]=l):l=e[3];const n=l;let t;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a||e[8]!==n?(t={capabilities:n,loading:c,error:o,isPrivileged:s,roleSlug:a},e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=n,e[9]=t):t=e[9],t}export{S as a,_ as u};
@@ -1 +1 @@
1
- import{i as a}from"./AlertCircle-Cicq6Btx.js";import{i as c}from"./CheckCircle-BDYEoc2A.js";import{i as u}from"./DotsVertical-BOoWejjN.js";import{aU as m}from"./agent-icon-BCrD15Ca.js";import{k as b,c as d,r as f}from"./index-CckLDzub.js";import{a as p}from"./XCircle-BOvwYwxn.js";const g={requires_action:{label:"Needs review",verb:"Waiting for your review",icon:a,iconClassName:"text-warning",labelColor:"text-warning"},failed:{label:"Failed",verb:"Something went wrong",icon:p,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{label:"Timed out",verb:"Stopped responding",icon:m,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{label:"Running",verb:"Agent is working",icon:b,iconClassName:"text-primary",labelColor:"text-primary"},completed:{label:"Done",verb:"Completed",icon:c,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},v={label:"Unknown",verb:"Unknown status",icon:u,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function $(r){return g[r??"completed"]??v}const i=new Map;function s(r){let t=i.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},i.set(r,t)),t}function x(r,t){const e=s(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const o of e.subscribers)o()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function y(r){const t=d.c(3),e=r===void 0?6e4:r;let o,n;return t[0]!==e?(o=l=>x(e,l),n=()=>s(e).tick,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),f.useSyncExternalStore(o,n,C)}function C(){return 0}export{g as S,$ as g,y as u};
1
+ import{i as a}from"./AlertCircle-BXOs8pgi.js";import{i as c}from"./CheckCircle-CP9SNP9d.js";import{i as u}from"./DotsVertical-DTkYQ2kM.js";import{aU as m}from"./agent-icon-D0v0CAMQ.js";import{k as b,c as d,r as f}from"./index-CsMY3E0n.js";import{a as p}from"./XCircle-Fr7R0JyH.js";const g={requires_action:{label:"Needs review",verb:"Waiting for your review",icon:a,iconClassName:"text-warning",labelColor:"text-warning"},failed:{label:"Failed",verb:"Something went wrong",icon:p,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{label:"Timed out",verb:"Stopped responding",icon:m,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{label:"Running",verb:"Agent is working",icon:b,iconClassName:"text-primary",labelColor:"text-primary"},completed:{label:"Done",verb:"Completed",icon:c,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},v={label:"Unknown",verb:"Unknown status",icon:u,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function $(r){return g[r??"completed"]??v}const i=new Map;function s(r){let t=i.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},i.set(r,t)),t}function x(r,t){const e=s(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const o of e.subscribers)o()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function y(r){const t=d.c(3),e=r===void 0?6e4:r;let o,n;return t[0]!==e?(o=l=>x(e,l),n=()=>s(e).tick,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),f.useSyncExternalStore(o,n,C)}function C(){return 0}export{g as S,$ as g,y as u};
@@ -1 +1 @@
1
- import{c as f,F as C,d_ as S,bd as p,bc as T}from"./index-CckLDzub.js";import{S as I,u as A}from"./use-mcp-client-DsGe28fL.js";function v(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const O=A(a);return S(u.id,"CONNECTIONS",O,N)}function E(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=A(i);return p(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
1
+ import{c as f,F as C,d_ as S,bd as p,bc as T}from"./index-CsMY3E0n.js";import{S as I,u as A}from"./use-mcp-client-CpOZK5-l.js";function v(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const O=A(a);return S(u.id,"CONNECTIONS",O,N)}function E(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=A(i);return p(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
@@ -1 +1 @@
1
- import{c as i,r as n}from"./index-CckLDzub.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
1
+ import{c as i,r as n}from"./index-CsMY3E0n.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
@@ -1 +1 @@
1
- import{c as g}from"./index-CckLDzub.js";import{b as f}from"./use-virtual-mcp-BmVj-UAd.js";import{c as p}from"./use-navigate-to-agent-ChK8XZgk.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
1
+ import{c as g}from"./index-CsMY3E0n.js";import{b as f}from"./use-virtual-mcp-6MeqW-FL.js";import{c as p}from"./use-navigate-to-agent-DBGPkYj0.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
@@ -1 +1 @@
1
- import{r as u}from"./index-CckLDzub.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
1
+ import{r as u}from"./index-CsMY3E0n.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
@@ -1 +1 @@
1
- import{c as m,r as n}from"./index-CckLDzub.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
1
+ import{c as m,r as n}from"./index-CsMY3E0n.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
@@ -1 +1 @@
1
- import{Y as Kt,Z as Ut,c as $,b as V,_ as pt,$ as ht,e as Gt,j as t,a as ae,B as ne,r as R,aJ as qt,d as st,s as Xt,m as X,t as K,w as Wt,k as ke,p as H,F as oe,f as ot,u as it,L as Qt,D as Yt,I as Jt,G as Zt,K as at,o as en,n as tn}from"./index-CckLDzub.js";import{t as xt}from"./ChevronDown-DyPoUAwG.js";import{A as jt,j as nn,a4 as sn}from"./agent-icon-BCrD15Ca.js";import{T as Ce,a as ye,c as Se}from"./tooltip-kvNY_Zlt.js";import{u as vt,d as bt,c as Ct}from"./sidebar-jLNWMsPH.js";import{a as rt,i as on,f as an,S as rn,u as ln}from"./use-mcp-client-DsGe28fL.js";import{a as cn,u as dn}from"./use-virtual-mcp-BmVj-UAd.js";import{a as Le,b as yt,P as St}from"./popover-DX_G7AK7.js";import{i as Ee}from"./Check-f04bRoaY.js";import{s as we}from"./Plus-DQSqgbXS.js";import{i as wt}from"./SearchMd-CN5YBDRF.js";import{s as Nt}from"./XClose-CLWdXIS8.js";import{A as un,a as mn,b as fn,c as gn,e as pn,f as hn,g as xn}from"./alert-dialog-DnqyXHfM.js";import{F as Q,a as nt,b as Y,c as J,d as Z,f as jn,e as ee}from"./form-DgrZJrh8.js";import{I as ie}from"./input-BvaZWiGU.js";import{S as vn}from"./spinner-CXf1Qx7i.js";import{T as _t}from"./toolbar-BFM5BlTU.js";import{S as bn}from"./skeleton-B44NoZN3.js";import{D as Dt,a as kt,b as At,c as Cn,e as yn,f as Sn,g as wn}from"./drawer-BD7_0pOG.js";import{u as It}from"./use-mobile-Fy04CvB1.js";import{a as Nn,G as _n}from"./github-repo-picker-CnOqewLh.js";import{g as Dn,b as kn,a as Pt}from"./hooks-DObrp1-C.js";import{u as An,g as In,a as Pn,b as Tn}from"./use-navigate-to-agent-ChK8XZgk.js";import{a as On,c as Tt}from"./agent-capabilities-cXfbMfjV.js";import{u as Ot}from"./shell-layout-3vEmXYAK.js";import{f as zn}from"./reusable-new-chat-CouMjkYR.js";import{C as Mn}from"./collection-search-DycU0jmq.js";import{g as $n,a as Fn,b as Bn,e as Ln}from"./extract-connection-data-DHczjTgR.js";import{u as zt,a as Mt,g as En,C as Ye}from"./connection-card-Dda8Ri7q.js";import{e as $t,d as Ft,a as Bt,b as Lt,h as Vn,c as Hn}from"./dialog-C9ETdGjn.js";import{S as Rn,a as Kn,b as Un,c as Gn,d as De}from"./select-uD0cTgkh.js";import{T as qn}from"./textarea-CO_8K2AK.js";import{b as Et}from"./use-connection-DzkSa9xt.js";import{a as Be,b as Je}from"./Tool02-DA9UyLwr.js";import{s as Ze}from"./Star01-DUGGdLzq.js";import{c as Xn,i as $e,a as ut,E as Wn,p as Qn,b as Yn,d as Jn}from"./connection-form-helpers-CNWz3mpZ.js";import{a as et}from"./authenticate-and-persist-oauth-DNq2co04.js";import{g as Zn}from"./connection-slug-eyAPH6o3.js";import{C as es}from"./collection-tabs-T9RTywR0.js";import{u as mt}from"./use-infinite-scroll-BtrAR-G0.js";import{B as Fe}from"./badge-x-7WrvvC.js";import{u as ts}from"./useSuspenseInfiniteQuery-D4g2oYT_.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as ns}from"./studio-tools-BB_5IEtF.js";import{u as ss}from"./use-ai-providers-BOEUgaK6.js";function ft(n){return n.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const os=Kt({name:Ut().min(2,"Organization name is required")});function is(n){const e=$.c(66),{open:s,onOpenChange:o}=n,i=V();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={resolver:pt(os),defaultValues:{name:""}},e[0]=a):a=e[0];const r=ht(a);let d;e[1]!==i?(d=async E=>{const M=ft(E.name);if(!M)throw new Error(i("common.createOrganizationDialog.invalidSlug"));const G=await ae.organization.create({name:E.name,slug:M});if(G?.error)throw new Error(G.error.message||i("common.createOrganizationDialog.failedToCreate"));const U=G?.data?.slug??M;if(!U)throw new Error(i("common.createOrganizationDialog.failedToCreate"));return{orgSlug:U}},e[1]=i,e[2]=d):d=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=as,e[3]=c):c=e[3];let m;e[4]!==d?(m={mutationFn:d,onSuccess:c},e[4]=d,e[5]=m):m=e[5];const u=Gt(m);let p;e[6]!==u.error||e[7]!==i?(p=u.error instanceof Error?u.error.message:u.error?i("common.createOrganizationDialog.failedToCreateGeneric"):null,e[6]=u.error,e[7]=i,e[8]=p):p=e[8];const l=p;let x;e[9]!==i?(x=i("common.createOrganizationDialog.title"),e[9]=i,e[10]=x):x=e[10];let y;e[11]!==x?(y=t.jsx(un,{children:x}),e[11]=x,e[12]=y):y=e[12];let h;e[13]!==i?(h=i("common.createOrganizationDialog.description"),e[13]=i,e[14]=h):h=e[14];let f;e[15]!==h?(f=t.jsx(mn,{children:h}),e[15]=h,e[16]=f):f=e[16];let j;e[17]!==y||e[18]!==f?(j=t.jsxs(fn,{children:[y,f]}),e[17]=y,e[18]=f,e[19]=j):j=e[19];let v;if(e[20]!==u||e[21]!==r){let E;e[23]!==u?(E=M=>u.mutateAsync(M),e[23]=u,e[24]=E):E=e[24],v=r.handleSubmit(E),e[20]=u,e[21]=r,e[22]=v}else v=e[22];let b;e[25]!==r.formState.isSubmitting||e[26]!==i?(b=E=>{const{field:M}=E;return t.jsxs(Y,{children:[t.jsx(J,{children:i("common.createOrganizationDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{...M,placeholder:i("common.createOrganizationDialog.namePlaceholder"),disabled:r.formState.isSubmitting})}),t.jsx(jn,{children:i("common.createOrganizationDialog.nameDescription")}),M.value&&t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[i("common.createOrganizationDialog.urlLabel")," ",t.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ft(M.value)]})]}),t.jsx(ee,{})]})},e[25]=r.formState.isSubmitting,e[26]=i,e[27]=b):b=e[27];let w;e[28]!==r.control||e[29]!==b?(w=t.jsx(Q,{control:r.control,name:"name",render:b}),e[28]=r.control,e[29]=b,e[30]=w):w=e[30];let N;e[31]!==l?(N=l&&t.jsx("div",{className:"text-destructive text-sm mt-2",children:l}),e[31]=l,e[32]=N):N=e[32];const P=r.formState.isSubmitting;let O;e[33]!==u||e[34]!==r?(O=()=>{u.reset(),r.reset()},e[33]=u,e[34]=r,e[35]=O):O=e[35];let g;e[36]!==i?(g=i("common.createOrganizationDialog.cancel"),e[36]=i,e[37]=g):g=e[37];let _;e[38]!==r.formState.isSubmitting||e[39]!==O||e[40]!==g?(_=t.jsx(gn,{disabled:P,onClick:O,children:g}),e[38]=r.formState.isSubmitting,e[39]=O,e[40]=g,e[41]=_):_=e[41];const T=!r.formState.isValid||r.formState.isSubmitting;let S;e[42]!==r.formState.isSubmitting||e[43]!==i?(S=r.formState.isSubmitting?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(vn,{size:"xs"})," ",i("common.createOrganizationDialog.creating")]}):i("common.createOrganizationDialog.createButton"),e[42]=r.formState.isSubmitting,e[43]=i,e[44]=S):S=e[44];let C;e[45]!==T||e[46]!==S?(C=t.jsx(ne,{type:"submit",variant:"default",disabled:T,children:S}),e[45]=T,e[46]=S,e[47]=C):C=e[47];let I;e[48]!==_||e[49]!==C?(I=t.jsxs(pn,{children:[_,C]}),e[48]=_,e[49]=C,e[50]=I):I=e[50];let k;e[51]!==v||e[52]!==w||e[53]!==N||e[54]!==I?(k=t.jsxs("form",{className:"space-y-6",onSubmit:v,autoComplete:"off",children:[w,N,I]}),e[51]=v,e[52]=w,e[53]=N,e[54]=I,e[55]=k):k=e[55];let A;e[56]!==r||e[57]!==k?(A=t.jsx(nt,{...r,children:k}),e[56]=r,e[57]=k,e[58]=A):A=e[58];let z;e[59]!==j||e[60]!==A?(z=t.jsxs(hn,{children:[j,A]}),e[59]=j,e[60]=A,e[61]=z):z=e[61];let L;return e[62]!==o||e[63]!==s||e[64]!==z?(L=t.jsx(xn,{open:s,onOpenChange:o,children:z}),e[62]=o,e[63]=s,e[64]=z,e[65]=L):L=e[65],L}function as(n){const{orgSlug:e}=n;window.location.href=`/${e}`}function Vt(){const n=R.useContext(qt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date),refetch:()=>s?.()}}function rs(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=$.c(13),{org:s,size:o}=n,i=o===void 0?"sm":o,a=i==="xs"?"size-5":"size-6",r=i==="xs"?"text-[9px]":"text-xs";let d;e[0]!==a?(d=X(a,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:rs(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let m;e[5]!==s.logo||e[6]!==s.name||e[7]!==r?(m=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:X("font-semibold leading-none",r),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=r,e[8]=m):m=e[8];let u;return e[9]!==d||e[10]!==c||e[11]!==m?(u=t.jsx("div",{className:d,style:c,children:m}),e[9]=d,e[10]=c,e[11]=m,e[12]=u):u=e[12],u}function ls({invitation:n,onChanged:e}){const s=V(),[o,i]=R.useState(!1),a=n.organizationName??s("header.orgSwitcher.unknownOrganization"),r=async()=>{i(!0);try{const m=await ae.organization.acceptInvitation({invitationId:n.id});if(m.error){K.error(m.error.message),i(!1);return}}catch{K.error(s("header.orgSwitcher.failedToAcceptInvitation")),i(!1);return}K.success(s("header.orgSwitcher.joined",{name:a})),Wt();let c;try{c=(await ae.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},d=async()=>{i(!0);try{const c=await ae.organization.rejectInvitation({invitationId:n.id});if(c.error){K.error(c.error.message),i(!1);return}K.success(s("header.orgSwitcher.invitationDeclined")),i(!1),e()}catch{K.error(s("header.orgSwitcher.failedToDeclineInvitation")),i(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(lt,{org:{name:a},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:a}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ne,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:r,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(ne,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:d,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:a}),children:t.jsx(Nt,{size:14})})]})]})}function cs(n){const e=$.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:i}=n,a=V(),{data:r}=Xt(),{invitations:d,refetch:c}=Vt();let m;e[0]!==s?(m=(k,A)=>k.slug===s?-1:A.slug===s?1:k.name.localeCompare(A.name),e[0]=s,e[1]=m):m=e[1];const u=[...r??[]].sort(m),[p,l]=R.useState(""),x=p.toLowerCase(),y=x?u.filter(k=>k.name.toLowerCase().includes(x)||k.slug.toLowerCase().includes(x)):u;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(wt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=h):h=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[3]=f):f=e[3];let j;e[4]!==p?(j=k=>k.key==="Escape"&&p&&l(""),e[4]=p,e[5]=j):j=e[5];let v;e[6]!==a?(v=a("header.orgSwitcher.searchOrganizations"),e[6]=a,e[7]=v):v=e[7];let b;e[8]!==p||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:p,onChange:f,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=p,e[9]=j,e[10]=v,e[11]=b):b=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{size:16}),e[12]=w):w=e[12];let N;e[13]!==i?(N=t.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:w}),e[13]=i,e[14]=N):N=e[14];let P;e[15]!==b||e[16]!==N?(P=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[h,b,N]}),e[15]=b,e[16]=N,e[17]=P):P=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let g;e[18]!==d||e[19]!==p||e[20]!==c?(g=!p&&d.map(k=>t.jsx(ls,{invitation:k,onChanged:c},k.id)),e[18]=d,e[19]=p,e[20]=c,e[21]=g):g=e[21];const _=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:p?a("header.orgSwitcher.noOrganizationsMatch",{query:p}):a("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=k=>t.jsxs("button",{type:"button",onClick:()=>o(k.slug),className:X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",k.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:k,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.slug})]}),k.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},k.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const S=y.map(T);let C;e[25]!==g||e[26]!==_||e[27]!==S?(C=t.jsxs("div",{className:O,children:[g,_,S]}),e[25]=g,e[26]=_,e[27]=S,e[28]=C):C=e[28];let I;return e[29]!==C||e[30]!==P?(I=t.jsxs(t.Fragment,{children:[P,C]}),e[29]=C,e[30]=P,e[31]=I):I=e[31],I}function ds(n){const e=$.c(22),{trigger:s,orgParam:o,align:i,side:a}=n,r=i===void 0?"start":i,d=a===void 0?"bottom":a,c=st(),[m,u]=R.useState(!1),[p,l]=R.useState(!1);let x;e[0]!==s?(x=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=x):x=e[1];const y=String(m);let h;e[2]!==c?(h=P=>{u(!1),c({to:"/$org",params:{org:P}})},e[2]=c,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{u(!1),l(!0)},e[4]=f):f=e[4];let j;e[5]!==o||e[6]!==y||e[7]!==h?(j=t.jsx(cs,{orgParam:o,onSelectOrg:h,onCreateOrg:f},y),e[5]=o,e[6]=y,e[7]=h,e[8]=j):j=e[8];let v;e[9]!==r||e[10]!==d||e[11]!==j?(v=t.jsx(yt,{side:d,align:r,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:ms,onCloseAutoFocus:us,children:j}),e[9]=r,e[10]=d,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==m||e[14]!==x||e[15]!==v?(b=t.jsxs(St,{open:m,onOpenChange:u,children:[x,v]}),e[13]=m,e[14]=x,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==p?(w=t.jsx(is,{open:p,onOpenChange:l}),e[17]=p,e[18]=w):w=e[18];let N;return e[19]!==w||e[20]!==b?(N=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=N):N=e[21],N}function us(n){return n.preventDefault()}function ms(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function fs(n){const e=$.c(21),{value:s,onChange:o,placeholder:i,onKeyDown:a,className:r,isSearching:d,disabled:c}=n,m=i===void 0?"Search...":i;let u;e[0]!==r?(u=X("shrink-0 w-full border-b border-border h-12",r),e[0]=r,e[1]=u):u=e[1];const p=c?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==p?(l=X("flex items-center gap-2.5 h-12 px-4",p),e[2]=p,e[3]=l):l=e[3];let x;e[4]!==d?(x=d?t.jsx(ke,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(wt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=d,e[5]=x):x=e[5];let y;e[6]!==o?(y=v=>o(v.target.value),e[6]=o,e[7]=y):y=e[7];let h;e[8]!==c||e[9]!==a||e[10]!==m||e[11]!==y||e[12]!==s?(h=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:a,placeholder:m,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]=a,e[10]=m,e[11]=y,e[12]=s,e[13]=h):h=e[13];let f;e[14]!==l||e[15]!==x||e[16]!==h?(f=t.jsxs("label",{className:l,children:[x,h]}),e[14]=l,e[15]=x,e[16]=h,e[17]=f):f=e[17];let j;return e[18]!==u||e[19]!==f?(j=t.jsx("div",{className:u,children:f}),e[18]=u,e[19]=f,e[20]=j):j=e[20],j}function gs(n,e,s){if(!s)return null;const o=Dn(n,e);return o?o.threads.get().find(a=>a.id===s)?.branch??null:null}function ps(n){const e=$.c(6),{value:s,onChange:o}=n,i=V();let a;e[0]!==i?(a=i("sidebar.agentsSection.searchAgents"),e[0]=i,e[1]=a):a=e[1];let r;return e[2]!==o||e[3]!==a||e[4]!==s?(r=t.jsx(fs,{value:s,onChange:o,placeholder:a}),e[2]=o,e[3]=a,e[4]=s,e[5]=r):r=e[5],r}function hs(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=$.c(10),{org:s,onClose:o}=n,i=V();let a;e[0]!==s.slug?(a={org:s.slug},e[0]=s.slug,e[1]=a):a=e[1];let r;e[2]!==o?(r=()=>o(),e[2]=o,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sidebar.agentsSection.seeAllAgents"),e[4]=i,e[5]=d):d=e[5];let c;return e[6]!==a||e[7]!==r||e[8]!==d?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Qt,{to:"/$org/settings/agents",params:a,onClick:r,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:d})}),e[6]=a,e[7]=r,e[8]=d,e[9]=c):c=e[9],c}function js(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Ht,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function vs(n){const e=$.c(11),{onImportFromGithub:s}=n,o=V();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_n,{className:"size-3.5"}),e[0]=i):i=e[0];let a;e[1]!==o?(a=o("sidebar.agentsSection.import"),e[1]=o,e[2]=a):a=e[2];let r;e[3]!==s||e[4]!==a?(r=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[i,a]}),e[3]=s,e[4]=a,e[5]=r):r=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=d):d=e[7];let c;return e[8]!==r||e[9]!==d?(c=t.jsx(Ht,{action:r,children:d}),e[8]=r,e[9]=d,e[10]=c):c=e[10],c}function bs(n){const e=$.c(11),{setOpen:s,emptyCtaClass:o}=n,i=V();let a;e[0]!==i?(a=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=a):a=e[1];let r;e[2]!==o?(r=X(o),e[2]=o,e[3]=r):r=e[3];let d;e[4]!==s?(d=()=>{H("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=d):d=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[6]=c):c=e[6];let m;return e[7]!==a||e[8]!==r||e[9]!==d?(m=t.jsx(_t,{"aria-label":a,className:r,onClick:d,children:c}),e[7]=a,e[8]=r,e[9]=d,e[10]=m):m=e[10],m}function Cs(n){const e=$.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:i}=n,a=V();let r;e[0]!==o||e[1]!==a?(r=o?void 0:a("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==i?(d=X(i),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==s?(c=()=>{H("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(we,{}),e[7]=m):m=e[7];let u;e[8]!==a?(u=a("sidebar.agentsSection.newAgent"),e[8]=a,e[9]=u):u=e[9];let p;e[10]!==u?(p=t.jsx("span",{children:u}),e[10]=u,e[11]=p):p=e[11];let l;return e[12]!==r||e[13]!==d||e[14]!==c||e[15]!==p?(l=t.jsx(bt,{children:t.jsxs(Ct,{tooltip:r,className:d,onClick:c,children:[m,p]})}),e[12]=r,e[13]=d,e[14]=c,e[15]=p,e[16]=l):l=e[16],l}function ys(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(At,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function Ss(n){const e=$.c(8),{emptyCtaClass:s}=n,o=V();let i;e[0]!==o?(i=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==s?(a=X(s),e[2]=s,e[3]=a):a=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(we,{className:"size-4"}),e[4]=r):r=e[4];let d;return e[5]!==i||e[6]!==a?(d=t.jsx(_t,{"aria-label":i,className:a,children:r}),e[5]=i,e[6]=a,e[7]=d):d=e[7],d}function ws(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:i}=n,a=V();let r;e[0]!==o||e[1]!==a?(r=o?void 0:a("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==i?(d=X(i),e[3]=i,e[4]=d):d=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{}),e[5]=c):c=e[5];let m;e[6]!==a?(m=a("sidebar.agentsSection.newAgent"),e[6]=a,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsx("span",{children:m}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==r||e[11]!==d||e[12]!==u?(p=t.jsx(Le,{asChild:!0,children:t.jsxs(Ct,{tooltip:r,className:d,children:[c,u]})}),e[10]=r,e[11]=d,e[12]=u,e[13]=p):p=e[13];let l;e[14]!==p||e[15]!==s?(l=s(p),e[14]=p,e[15]=s,e[16]=l):l=e[16];let x;return e[17]!==l?(x=t.jsx(bt,{children:l}),e[17]=l,e[18]=x):x=e[18],x}function Ns(n){const e=$.c(9),{children:s}=n,o=V();let i;e[0]!==s?(i=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==o?(a=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=a):a=e[3];let r;e[4]!==a?(r=t.jsx(ye,{side:"right",sideOffset:8,children:a}),e[4]=a,e[5]=r):r=e[5];let d;return e[6]!==i||e[7]!==r?(d=t.jsxs(Se,{defaultOpen:!0,delayDuration:0,children:[i,r]}),e[6]=i,e[7]=r,e[8]=d):d=e[8],d}function _s(n){const e=st(),{create:s}=kn(),{locator:o}=oe(),i=ot({strict:!1}),a=it({strict:!1});return async r=>{const d=crypto.randomUUID(),c=r===a.virtualmcpid?gs(n,o,i.taskId??""):null;try{await s({id:d,virtual_mcp_id:r,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:d},search:{virtualmcpid:r}})}}function tt(n){const e=$.c(20),{agent:s,selected:o,onClick:i}=n,a=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let r;e[0]!==a?(r=X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",a),e[0]=a,e[1]=r):r=e[1];let d;e[2]!==s.icon||e[3]!==s.title?(d=t.jsx(jt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=d):d=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let m;e[7]!==s.description?(m=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=m):m=e[8];let u;e[9]!==c||e[10]!==m?(u=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,m]}),e[9]=c,e[10]=m,e[11]=u):u=e[11];let p;e[12]!==o?(p=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=p):p=e[13];let l;return e[14]!==i||e[15]!==r||e[16]!==d||e[17]!==u||e[18]!==p?(l=t.jsxs("button",{type:"button",onClick:i,className:r,children:[d,u,p]}),e[14]=i,e[15]=r,e[16]=d,e[17]=u,e[18]=p,e[19]=l):l=e[19],l}function Ht(n){const e=$.c(5),{children:s,action:o}=n;let i;e[0]!==s?(i=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==o||e[3]!==i?(a=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[i,o]}),e[2]=o,e[3]=i,e[4]=a):a=e[4],a}function Ds(n){const e=$.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:i,onImportFromGithub:a}=n,[r,d]=R.useState(""),c=cn(),m=c??[],{org:u}=oe(),{data:p}=ae.useSession(),l=p?.user?.id??"anon",x=In(c),y=Pn(),h=_s(u.slug),f=On(c),j=r.toLowerCase(),v=m.filter(Ps).filter(B=>!f.has(B.id)).filter(Is).filter(B=>!r||B.title.toLowerCase().includes(j)),b=v.filter(As),w=v.filter(ks),N=rt(u.id),P=!r||N.title.toLowerCase().includes(j),O=!!(o&&P);let g;e[0]!==s||e[1]!==o?(g=()=>{o?.(null),s(),d("")},e[0]=s,e[1]=o,e[2]=g):g=e[2];const _=g,T=B=>{if(o){o(B.id),s(),d("");return}Tn({orgId:u.id,userId:l},B.id,x),y(),s(),d(""),h(B.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let C;e[3]!==r?(C=t.jsx(ps,{value:r,onChange:d}),e[3]=r,e[4]=C):C=e[4];const I="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",k=o&&P&&N&&t.jsx(tt,{agent:N,selected:!i||i===N.id,onClick:_}),A=(b.length>0||!r)&&t.jsx(vs,{onImportFromGithub:a}),z=b.map(B=>t.jsx(tt,{agent:B,selected:o?i===B.id:void 0,onClick:()=>T(B)},B.id)),L=w.length>0&&t.jsx(js,{}),E=w.map(B=>t.jsx(tt,{agent:B,selected:o?i===B.id:void 0,onClick:()=>T(B)},B.id));let M;e[5]!==O||e[6]!==r||e[7]!==v.length?(M=v.length===0&&!O&&r&&t.jsx(hs,{}),e[5]=O,e[6]=r,e[7]=v.length,e[8]=M):M=e[8];let G;e[9]!==M||e[10]!==k||e[11]!==A||e[12]!==z||e[13]!==L||e[14]!==E?(G=t.jsxs("div",{className:I,children:[k,A,z,L,E,M]}),e[9]=M,e[10]=k,e[11]=A,e[12]=z,e[13]=L,e[14]=E,e[15]=G):G=e[15];let U;e[16]!==s||e[17]!==u?(U=t.jsx(xs,{org:u,onClose:s}),e[16]=s,e[17]=u,e[18]=U):U=e[18];let de;return e[19]!==G||e[20]!==U||e[21]!==C?(de=t.jsxs("div",{className:S,children:[C,G,U]}),e[19]=G,e[20]=U,e[21]=C,e[22]=de):de=e[22],de}function ks(n){return!Tt(n.metadata)}function As(n){return Tt(n.metadata)}function Is(n){return!an(n.id)}function Ps(n){return!on(n.id)}function Ts(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:i,onSelectAgent:a,selectedAgentId:r,side:d,align:c}=s,m=o===void 0?!1:o,u=d===void 0?"right":d,p=c===void 0?"start":c,[l,x]=R.useState(!1),[y,h]=R.useState(!1),f=It(),{setOpenMobile:j}=vt(),v=An(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(Ns,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const N=w;let P;e[4]!==f||e[5]!==j?(P=()=>{x(!1),f&&j(!1)},e[4]=f,e[5]=j,e[6]=P):P=e[6];const O=P;let g;e[7]!==O?(g=()=>{O(),h(!0)},e[7]=O,e[8]=g):g=e[8];const _=g;let T;e[9]!==O||e[10]!==_||e[11]!==a||e[12]!==l||e[13]!==r?(T=l&&t.jsx(R.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(bn,{className:"h-4 w-24"})}),children:t.jsx(Ds,{onClose:O,onSelectAgent:a,selectedAgentId:r,onImportFromGithub:_})}),e[9]=O,e[10]=_,e[11]=a,e[12]=l,e[13]=r,e[14]=T):T=e[14];const S=T;let C;e[15]!==p||e[16]!==m||e[17]!==b||e[18]!==v||e[19]!==f||e[20]!==l||e[21]!==S||e[22]!==u||e[23]!==i||e[24]!==N?(C=f?t.jsxs(t.Fragment,{children:[i?t.jsx("button",{type:"button",onClick:()=>x(!0),className:"contents",children:i}):m?N(t.jsx(bs,{setOpen:x,emptyCtaClass:b})):t.jsx(Cs,{setOpen:x,highlightEmpty:v,emptyCtaClass:b}),t.jsx(Dt,{open:l,onOpenChange:x,direction:"bottom",children:t.jsxs(kt,{className:"max-h-[85dvh] p-0",children:[t.jsx(ys,{}),S]})})]}):t.jsxs(St,{open:l,onOpenChange:A=>{A&&!l&&H("agent_browser_opened",{surface:"desktop_popover"}),x(A)},children:[i?t.jsx(Le,{asChild:!0,children:i}):m?N(t.jsx(Le,{asChild:!0,children:t.jsx(Ss,{emptyCtaClass:b})})):t.jsx(ws,{wrapEmptyHint:N,highlightEmpty:v,emptyCtaClass:b}),t.jsx(yt,{className:"w-[380px] p-0 overflow-hidden",side:u,align:p,children:S})]}),e[15]=p,e[16]=m,e[17]=b,e[18]=v,e[19]=f,e[20]=l,e[21]=S,e[22]=u,e[23]=i,e[24]=N,e[25]=C):C=e[25];let I;e[26]!==y?(I=t.jsx(Nn,{open:y,onOpenChange:h,mode:"agent"}),e[26]=y,e[27]=I):I=e[27];let k;return e[28]!==I||e[29]!==C?(k=t.jsxs(t.Fragment,{children:[C,I]}),e[28]=I,e[29]=C,e[30]=k):k=e[30],k}const Os="inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function zs(n){const e=$.c(29),{agentId:s,fallback:o,onOpenHome:i,onPick:a}=n,r=V(),d=dn(s)??o??null;let c,m,u,p,l;e[0]!==d?.title||e[1]!==i||e[2]!==r?(l=d?.title??r("header.shellBreadcrumb.superAgentDefaultName"),p="flex min-w-0 items-center gap-0",c="button",m=i,u=r("header.shellBreadcrumb.openAgentHome",{name:l}),e[0]=d?.title,e[1]=i,e[2]=r,e[3]=c,e[4]=m,e[5]=u,e[6]=p,e[7]=l):(c=e[3],m=e[4],u=e[5],p=e[6],l=e[7]);const x=d?.icon??null;let y;e[8]!==x||e[9]!==l?(y=t.jsx(jt,{icon:x,name:l,size:"xs"}),e[8]=x,e[9]=l,e[10]=y):y=e[10];let h;e[11]!==c||e[12]!==m||e[13]!==u||e[14]!==y?(h=t.jsx("button",{type:c,onClick:m,"aria-label":u,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=m,e[13]=u,e[14]=y,e[15]=h):h=e[15];let f;e[16]!==l?(f=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:l}),e[16]=l,e[17]=f):f=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==f?(v=t.jsxs("button",{type:"button",className:Os,children:[f,j]}),e[19]=f,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==a||e[23]!==v?(b=t.jsx(Ts,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:a,trigger:v}),e[21]=s,e[22]=a,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==p||e[27]!==h?(w=t.jsxs("div",{className:p,children:[h,b]}),e[25]=b,e[26]=p,e[27]=h,e[28]=w):w=e[28],w}function Fo(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,i=V(),{org:a}=oe(),{state:r,isMobile:d}=vt(),c=Vt().invitations.length>0,m=r==="collapsed"||d;let u;e[2]!==c||e[3]!==a.name||e[4]!==i?(u=c?i("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:a.name}):i("header.shellBreadcrumb.switchOrganization",{name:a.name}),e[2]=c,e[3]=a.name,e[4]=i,e[5]=u):u=e[5];let p;e[6]!==a?(p=t.jsx(lt,{org:a,size:"sm"}),e[6]=a,e[7]=p):p=e[7];let l;e[8]!==c||e[9]!==m?(l=c&&t.jsx("span",{className:X("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",m?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=m,e[10]=l):l=e[10];let x;e[11]!==p||e[12]!==l?(x=t.jsxs("span",{className:"relative inline-flex",children:[p,l]}),e[11]=p,e[12]=l,e[13]=x):x=e[13];let y;e[14]!==a.name||e[15]!==o?(y=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:a.name}),e[14]=a.name,e[15]=o,e[16]=y):y=e[16];let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=h):h=e[17];let f;e[18]!==u||e[19]!==x||e[20]!==y?(f=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":u,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[x,y,h]})}),e[18]=u,e[19]=x,e[20]=y,e[21]=f):f=e[21];let j;e[22]!==a.slug||e[23]!==f?(j=t.jsx(ds,{orgParam:a.slug,trigger:f}),e[22]=a.slug,e[23]=f,e[24]=j):j=e[24];let v;e[25]!==a.name?(v=t.jsx(ye,{side:"bottom",children:a.name}),e[25]=a.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Se,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Bo(n){const e=$.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:i}=oe();let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[2]=a):a=e[2];const r=ot(a);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},e[3]=d):d=e[3];const c=it(d),{threads:m}=Pt(),{data:u}=ae.useSession(),{setTaskId:p,createNewTask:l}=Ot();let x;e[4]!==i.id?(x=rt(i.id),e[4]=i.id,e[5]=x):x=e[5];const y=x,h=y.id,f=r.taskId?c.virtualmcpid??h:h;let j;e[6]!==l||e[7]!==h||e[8]!==o||e[9]!==u?.user?.id||e[10]!==p||e[11]!==m?(j=O=>{const g=O??h,_=zn(m,g,u?.user?.id);_?p(_.id,g):l(g),o?.()},e[6]=l,e[7]=h,e[8]=o,e[9]=u?.user?.id,e[10]=p,e[11]=m,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=f===h?y:void 0;let N;e[14]!==f||e[15]!==v?(N=()=>v(f),e[14]=f,e[15]=v,e[16]=N):N=e[16];let P;return e[17]!==f||e[18]!==v||e[19]!==w||e[20]!==N?(P=t.jsx(R.Suspense,{fallback:b,children:t.jsx(zs,{agentId:f,fallback:w,onOpenHome:N,onPick:v})}),e[17]=f,e[18]=v,e[19]=w,e[20]=N,e[21]=P):P=e[21],P}function Lo(){const n=$.c(24),e=V(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const i=ot(o);let a;n[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},n[1]=a):a=n[1];const r=it(a),{threads:d}=Pt(),{createNewTask:c}=Ot();let m;n[2]!==s.id?(m=rt(s.id),n[2]=s.id,n[3]=m):m=n[3];const u=m.id,p=i.taskId?r.virtualmcpid??u:u;let l;n[4]!==i.taskId||n[5]!==d?(l=(i.taskId?d.find(P=>P.id===i.taskId)?.branch:null)??null,n[4]=i.taskId,n[5]=d,n[6]=l):l=n[6];const x=l;let y;n[7]!==p||n[8]!==c||n[9]!==x?(y=()=>{c(p,x)},n[7]=p,n[8]=c,n[9]=x,n[10]=y):y=n[10];const h=y;let f;n[11]!==e?(f=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=f):f=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(nn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==h||n[15]!==f?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:h,"aria-label":f,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:j})}),n[14]=h,n[15]=f,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let N;return n[21]!==v||n[22]!==w?(N=t.jsxs(Se,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=N):N=n[23],N}function Ms({open:n,onOpenChange:e,onCreated:s}){const o=V(),{org:i}=oe(),{data:a}=ae.useSession(),{stdioEnabled:r}=Yt(),d=It(),c=Et(),m=zt(),p=Mt(m,"").items,l=ht({resolver:pt(Xn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),x=l.watch("ui_type"),y=l.watch("connection_url"),h=l.watch("npx_package"),f=$e({uiType:x,connectionUrl:y??"",npxPackage:h??""})??ut({uiType:x,connectionUrl:y??"",registryItems:p}),j=g=>{const _=g.trim();if(!_)return;const T=!!l.formState.dirtyFields.title,S=!!l.formState.dirtyFields.description,C=!!l.formState.dirtyFields.env_vars,I=A=>{if(A&&(!T&&!l.getValues("title").trim()&&A.title&&l.setValue("title",A.title,{shouldDirty:!1}),!S&&!(l.getValues("description")??"").trim()&&A.description&&l.setValue("description",A.description,{shouldDirty:!1}),!C&&A.envVarKeys?.length)){const z=l.getValues("env_vars")??[],L=new Set(z.map(M=>M.key)),E=A.envVarKeys.filter(M=>!L.has(M));E.length>0&&l.setValue("env_vars",[...z,...E.map(M=>({key:M,value:""}))],{shouldDirty:!0})}},k=Qn(_);if(k&&r){l.setValue("ui_type","NPX",{shouldDirty:!0}),l.setValue("npx_package",k.packageName,{shouldDirty:!0}),l.setValue("connection_url","",{shouldDirty:!0}),l.setValue("connection_token",null,{shouldDirty:!0}),I($e({uiType:"NPX",npxPackage:k.packageName}));return}if(_.startsWith("http://")||_.startsWith("https://")){const A=x==="HTTP"||x==="SSE"||x==="Websocket"?x:"HTTP";l.setValue("ui_type",A,{shouldDirty:!0}),l.setValue("connection_url",_,{shouldDirty:!0}),I($e({uiType:A,connectionUrl:_})??ut({uiType:A,connectionUrl:_,registryItems:p}));return}x==="NPX"&&I($e({uiType:"NPX",npxPackage:_}))},v=g=>{g||l.reset(),e(g)},b=async g=>{let _,T=null,S=null,C=null;g.ui_type==="NPX"?(_="STDIO",T="",C=Yn(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(_="STDIO",T="",C=Jn(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(_=g.ui_type,T=g.connection_url||"",S=g.connection_token||null);const I=$n("conn");try{await c.create.mutateAsync({id:I,title:g.title,description:g.description||null,connection_type:_,connection_url:T,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:a?.user?.id||"system",organization_id:i.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),l.reset(),e(!1),s?.(I)}catch{K.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),N=o("connections.createConnectionDialog.description"),P=l.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:l.control,name:"ui_type",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs(Rn,{value:g.value,onValueChange:g.onChange,children:[t.jsx(Z,{children:t.jsx(Kn,{children:t.jsx(Un,{})})}),t.jsxs(Gn,{children:[t.jsx(De,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(De,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(De,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),r&&t.jsxs(t.Fragment,{children:[t.jsx(De,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(De,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(sn,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),x==="NPX"&&t.jsx(Q,{control:l.control,name:"npx_package",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...g,value:g.value??"",onPaste:_=>{const T=_.clipboardData.getData("text");T&&(_.preventDefault(),l.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:_=>{j(_.target.value),g.onBlur()}})}),t.jsx(ee,{})]})}),x==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:l.control,name:"stdio_command",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...g,value:g.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"stdio_args",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...g,value:g.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"stdio_cwd",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...g,value:g.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(x==="NPX"||x==="STDIO")&&t.jsx(Q,{control:l.control,name:"env_vars",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Wn,{value:g.value??[],onChange:g.onChange})}),t.jsx(ee,{})]})}),x!=="NPX"&&x!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:l.control,name:"connection_url",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...g,value:g.value??"",onPaste:_=>{const T=_.clipboardData.getData("text");T&&(_.preventDefault(),l.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:_=>{j(_.target.value),g.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"connection_token",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:f?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:f?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...g,value:g.value??""})}),f?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.token.helperText,f.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"title",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...g})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"description",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(qn,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...g,value:g.value??""})}),t.jsx(ee,{})]})})]});return d?t.jsx(Dt,{open:n,onOpenChange:v,children:t.jsxs(kt,{className:"max-h-[90vh]",children:[t.jsx(Cn,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(At,{children:w}),t.jsx(yn,{className:"mt-1",children:N})]}),t.jsx(Sn,{asChild:!0,children:t.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Nt,{size:16})})})]})}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(wn,{children:t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"w-full",children:P})})]})})]})}):t.jsx($t,{open:n,onOpenChange:v,children:t.jsxs(Ft,{className:"sm:max-w-[525px]",children:[t.jsxs(Bt,{children:[t.jsx(Lt,{children:w}),t.jsx(Vn,{children:N})]}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Hn,{children:[t.jsx(ne,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"min-w-40",children:P})]})]})})]})})}function $s(n){const e=$.c(72),{mode:s,agentId:o,addedConnectionIds:i,onAdd:a,onCloneAndAdd:r,onConnectAndAdd:d,connectingItemId:c,search:m,onCreateConnection:u,onBrowseNavigate:p,defaultTab:l}=n,x=s===void 0?"add":s,y=l===void 0?"connected":l,h=V(),{org:f}=oe(),j=R.useDeferredValue(m),v=m!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let N;e[2]!==y?(N=D=>D??y,e[2]=y,e[3]=N):N=e[3];const[P,O]=Jt(Zt.connectionsTab(f.slug)+(y==="all"?":home-modal":":agent-modal"),N);let g;e[4]!==P||e[5]!==O?(g=D=>{D!==P&&H("connections_dialog_tab_changed",{to_tab:D}),O(D)},e[4]=P,e[5]=O,e[6]=g):g=e[6];const _=g;let T;e[7]!==f.id||e[8]!==f.slug?(T={connectionId:rn,orgId:f.id,orgSlug:f.slug},e[7]=f.id,e[8]=f.slug,e[9]=T):T=e[9];const S=ln(T),C=j?.trim().split(/\s+/).filter(Boolean)??[],I=C.length>0?{operator:"or",conditions:C.flatMap(Ks)}:void 0,k={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(k),{data:z,fetchNextPage:L,hasNextPage:E,isFetchingNextPage:M}=ts({queryKey:at.collectionListInfinite(S,f.id,"","CONNECTIONS",A),queryFn:async D=>{const{pageParam:F}=D,se=F===void 0?0:F;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:Hs,staleTime:3e4}),G=z?.pages.flatMap(Vs)??[],U=En(G),de=new Set(G.filter(Es).map(Ls)),B=zt(),re=Mt(B,j),He=mt(re.loadMore,re.hasMore,re.isLoadingMore),Re=mt(L,E??!1,M),W=P==="all"||!!w,ct=W?re.items.filter(D=>{const F=Fn(D);if(F&&de.has(F))return!1;if(!w)return!0;const se=Ve(D._meta),le=[D.title,D.description,D.name,D.server?.title,D.server?.description,D.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return C.some(te=>le.includes(te.toLowerCase()))}):[],Ne=ct.filter(Bs),_e=ct.filter(Fs);let Ae;e[10]!==i?(Ae=D=>D.some(F=>i.has(F.id)),e[10]=i,e[11]=Ae):Ae=e[11];const Ke=Ae;let Ie;e[12]!==i||e[13]!==o||e[14]!==c||e[15]!==Ke||e[16]!==x||e[17]!==a||e[18]!==p||e[19]!==r||e[20]!==h?(Ie=(D,F,se,le,te)=>{const Me=Ke(te),be=te.find(ce=>!i.has(ce.id)),q=te[0];if(x==="browse"){const ce=Zn(q);return t.jsx(Ye,{connection:{title:F,icon:se,description:te.length>1?`${te.length} instances`:le??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",h("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{H("connection_browse_clicked",{app_name:q.app_name??null,connection_id:q.id,instances_count:te.length}),p?.(ce)}},D)}return t.jsx(Ye,{connection:{title:F,icon:se,description:le},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Me&&t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",h("virtualMcp.connectionDialogContent.added")]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ce=>{ce.stopPropagation(),be?(H("connection_add_clicked",{action:"use_existing",app_name:q.app_name??null,connection_id:be.id}),o&&H("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:q.app_name??null,mode:"existing"}),a(be.id)):(H("connection_add_clicked",{action:"clone",app_name:q.app_name??null,base_connection_id:q.id}),r(q))},children:h("virtualMcp.connectionDialogContent.add")})]})},D)},e[12]=i,e[13]=o,e[14]=c,e[15]=Ke,e[16]=x,e[17]=a,e[18]=p,e[19]=r,e[20]=h,e[21]=Ie):Ie=e[21];const Pe=Ie;let Te;e[22]!==c||e[23]!==x||e[24]!==d||e[25]!==h?(Te=D=>{const F=Ve(D._meta),se=F?.friendlyName||F?.friendly_name||D.server?.title||D.title||D.server?.name||D.name||D.id||"",le=D.server?.description||D.description||null,te=D.server?.icons?.[0]?.src||Bn(D.server?.repository)||null,Me=F?.official===!0,be=F?.verified===!0,q=F?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:le,icon:te},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[q&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:h("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.builtByDeco")})]}),!q&&Me&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!q&&!Me&&be&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ce=>{ce.stopPropagation(),H("connection_add_clicked",{action:"connect_new",registry_item_id:D.id,app_name:F?.friendlyName||D.server?.name||D.name||null}),d(D)},children:c===D.id?t.jsx(ke,{size:14,className:"animate-spin"}):h(x==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${D.id}`)},e[22]=c,e[23]=x,e[24]=d,e[25]=h,e[26]=Te):Te=e[26];const dt=Te;let ue;e[27]!==P||e[28]!==_||e[29]!==u||e[30]!==w||e[31]!==h?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(es,{tabs:[{id:"all",label:h("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:h("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:P,onTabChange:D=>_(D)}),t.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{H("connections_dialog_custom_clicked"),u()},children:[t.jsx(we,{size:12}),h("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=P,e[28]=_,e[29]=u,e[30]=w,e[31]=h,e[32]=ue):ue=e[32];const Ue=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ue?(me=X("flex-1 overflow-auto p-5 transition-opacity duration-150",Ue),e[33]=Ue,e[34]=me):me=e[34];const Rt="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[35]!==Pe?(Oe=D=>{if(D.type==="group")return Pe(D.key,D.title,D.icon,null,D.connections);const F=D.connection;return Pe(F.id,F.title,F.icon,F.description??null,[F])},e[35]=Pe,e[36]=Oe):Oe=e[36];const Ge=U.map(Oe);let fe;e[37]!==Re?(fe=t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[37]=Re,e[38]=fe):fe=e[38];let ge;e[39]!==M?(ge=M&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=M,e[40]=ge):ge=e[40];const qe=W&&Ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(Je,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:h("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=W&&Ne.map(dt),We=W&&_e.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:h("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Qe=W&&_e.map(dt);let pe;e[41]!==He||e[42]!==B||e[43]!==W?(pe=W&&B.length>0&&t.jsx("div",{ref:He,className:"col-span-full h-1"}),e[41]=He,e[42]=B,e[43]=W,e[44]=pe):pe=e[44];let he;e[45]!==re.isLoadingMore||e[46]!==W?(he=W&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=re.isLoadingMore,e[46]=W,e[47]=he):he=e[47];let xe;e[48]!==Ge||e[49]!==fe||e[50]!==ge||e[51]!==qe||e[52]!==Xe||e[53]!==We||e[54]!==Qe||e[55]!==pe||e[56]!==he?(xe=t.jsxs("div",{className:Rt,children:[Ge,fe,ge,qe,Xe,We,Qe,pe,he]}),e[48]=Ge,e[49]=fe,e[50]=ge,e[51]=qe,e[52]=Xe,e[53]=We,e[54]=Qe,e[55]=pe,e[56]=he,e[57]=xe):xe=e[57];let je;e[58]!==P||e[59]!==U.length||e[60]!==_e||e[61]!==m||e[62]!==h||e[63]!==Ne?(je=U.length===0&&Ne.length===0&&_e.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:m?h("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:m}):h(P==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=P,e[59]=U.length,e[60]=_e,e[61]=m,e[62]=h,e[63]=Ne,e[64]=je):je=e[64];let ve;e[65]!==me||e[66]!==xe||e[67]!==je?(ve=t.jsxs("div",{className:me,children:[xe,je]}),e[65]=me,e[66]=xe,e[67]=je,e[68]=ve):ve=e[68];let ze;return e[69]!==ue||e[70]!==ve?(ze=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=ze):ze=e[71],ze}function Fs(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Bs(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function Ls(n){return n.app_name}function Es(n){return n.app_name}function Vs(n){return n?.items??[]}function Hs(n,e){if(n?.hasMore)return e.reduce(Rs,0)}function Rs(n,e){return n+(e?.items?.length??0)}function Ks(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Eo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...i}){const a=V(),r=i.mode??"add",d="agentId"in i?i.agentId:void 0,c="addedConnectionIds"in i?i.addedConnectionIds??new Set:new Set,m="onAdd"in i&&i.onAdd?i.onAdd:S=>{},u=(S,C,I)=>{d&&H("agent_connection_attached",{agent_id:d,connection_id:S,app_name:C,mode:I})},[p,l]=R.useState(null),[x,y]=R.useState(o),[h,f]=R.useState(!1),{org:j}=oe(),{data:v}=ae.useSession(),b=Et(),w=en(),N=st(),P=S=>{e(!1),N({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:S}})},O=()=>{w.invalidateQueries({predicate:S=>{const C=S.queryKey;return C[1]===j.id&&C[3]==="collection"&&C[4]==="CONNECTIONS"}})},g=async(S,C)=>{H("connection_oauth_succeeded",{connection_id:S,flow:C});const I=new URL(`/api/${j.slug}/mcp/${S}`,window.location.origin);await w.invalidateQueries({queryKey:at.isMCPAuthenticated(I.href,null)}),O()},_=async S=>{l(S.app_name??S.id);try{const I=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:I,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,z=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:L=>b.update.mutateAsync({id:A,data:{connection_token:L}}).then(()=>{})});if(z.ran&&!z.ok){H("connection_oauth_failed",{connection_id:A,flow:"clone",error:z.error??"no_token"}),K.error(a("virtualMcp.addConnectionDialog.authenticationFailedError",{error:z.error??"no token received"})),await b.delete.mutateAsync(A);return}z.ran&&await g(A,"clone"),u(A,S.app_name??null,"clone"),m(A)}catch(C){console.error("Failed to add connection:",C),K.error(a("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{l(null)}},T=async S=>{if(!(!j||!v?.user?.id)){l(S.id);try{const C=Ln(S,j.id,v.user.id,{remoteIndex:0}),I=C.connection_type==="STDIO",k=!!C.connection_url,A=I&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!k&&!A){K.error(a("virtualMcp.addConnectionDialog.mcpServerConnectionError")),l(null);return}const{id:z}=await b.create.mutateAsync(C),L=await et({connectionId:z,orgId:j.id,orgSlug:j.slug,persistFallback:E=>b.update.mutateAsync({id:z,data:{connection_token:E}}).then(()=>{})});if(L.ran&&!L.ok){H("connection_oauth_failed",{connection_id:z,flow:"connect_new",error:L.error??"no_token"}),K.warning(a("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:a("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),u(z,C.app_name??null,"new"),m(z);return}L.ran?(await g(z,"connect_new"),K.success(a("virtualMcp.addConnectionDialog.connectedAuthenticated"))):K.success(a("virtualMcp.addConnectionDialog.connected")),u(z,C.app_name??null,"new"),m(z)}catch(C){console.error("Failed to connect:",C),K.error(a("virtualMcp.addConnectionDialog.failedToConnect"))}finally{l(null)}}};return t.jsxs($t,{open:n,onOpenChange:e,children:[t.jsxs(Ft,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Bt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Lt,{className:"text-base font-semibold",children:a(r==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Mn,{value:x,onChange:y,placeholder:a("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(R.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx($s,{mode:r,agentId:d,addedConnectionIds:c,onAdd:m,onCloneAndAdd:_,onConnectAndAdd:T,connectingItemId:p,search:x,onCreateConnection:()=>f(!0),onBrowseNavigate:P,defaultTab:s})})]}),t.jsx(Ms,{open:h,onOpenChange:f,onCreated:async S=>{f(!1);const C=await et({connectionId:S,orgId:j.id,orgSlug:j.slug,persistFallback:I=>b.update.mutateAsync({id:S,data:{connection_token:I}}).then(()=>{})});if(C.ran&&!C.ok){H("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:C.error??"no_token"}),K.warning(a("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:a("virtualMcp.addConnectionDialog.signInFailedDescription",{error:C.error??"no token received"})}),u(S,null,"custom"),m(S),e(!1);return}C.ran&&await g(S,"custom_create"),u(S,null,"custom"),m(S),e(!1)}})]})}const gt=new Map;function Vo(){const{org:n}=oe(),e=ns(),s=ss(),o=s.find(f=>f.providerId==="deco"),{data:i,isLoading:a,refetch:r,isFetching:d}=tn({queryKey:at.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=i?.balanceCents??null,m=c!=null?c/100:null,u=R.useRef(new Map);if(c!=null){const f=gt.get(n.id);u.current.get(n.id)&&f!=null&&c>f&&H("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-f,previous_balance_cents:f,new_balance_cents:c}),gt.set(n.id,c),u.current.set(n.id,!0)}const p=!!o,l=c!=null&&c>0,x=c!=null&&c===0,y=c!=null&&c===200,h=s.length>0&&s.every(f=>f.providerId==="deco");return{hasDecoKey:p,decoKeyId:o?.id??null,balanceCents:c,balanceDollars:m,hasCredits:l,isZeroBalance:x,isInitialFreeCredit:y,hasOnlyDecoProvider:h,isLoading:a,isFetching:d,refetch:r}}export{Bo as A,Lo as N,Fo as O,Eo as a,ds as b,lt as c,Vo as u};
1
+ import{Y as Kt,Z as Ut,c as $,b as V,_ as pt,$ as ht,e as Gt,j as t,a as ae,B as ne,r as R,aJ as qt,d as st,s as Xt,m as X,t as K,w as Wt,k as ke,p as H,F as oe,f as ot,u as it,L as Qt,D as Yt,I as Jt,G as Zt,K as at,o as en,n as tn}from"./index-CsMY3E0n.js";import{t as xt}from"./ChevronDown-DfcP5Y1G.js";import{A as jt,j as nn,a4 as sn}from"./agent-icon-D0v0CAMQ.js";import{T as Ce,a as ye,c as Se}from"./tooltip-Cpi2mja1.js";import{u as vt,d as bt,c as Ct}from"./sidebar-ChD8CCYT.js";import{a as rt,i as on,f as an,S as rn,u as ln}from"./use-mcp-client-CpOZK5-l.js";import{a as cn,u as dn}from"./use-virtual-mcp-6MeqW-FL.js";import{a as Le,b as yt,P as St}from"./popover-DJARnKJN.js";import{i as Ee}from"./Check-CKtI4hGn.js";import{s as we}from"./Plus-DigHRvrB.js";import{i as wt}from"./SearchMd-UJHWms5O.js";import{s as Nt}from"./XClose-yYL9HV11.js";import{A as un,a as mn,b as fn,c as gn,e as pn,f as hn,g as xn}from"./alert-dialog-DctPzbrJ.js";import{F as Q,a as nt,b as Y,c as J,d as Z,f as jn,e as ee}from"./form-r7LLoRlt.js";import{I as ie}from"./input-Bxlv4wq5.js";import{S as vn}from"./spinner-_TqSaOQN.js";import{T as _t}from"./toolbar-DYLo2f04.js";import{S as bn}from"./skeleton-C65ogTvo.js";import{D as Dt,a as kt,b as At,c as Cn,e as yn,f as Sn,g as wn}from"./drawer-ZyqfN_k8.js";import{u as It}from"./use-mobile-ieOqtEHL.js";import{a as Nn,G as _n}from"./github-repo-picker-C4LbYEVp.js";import{g as Dn,b as kn,a as Pt}from"./hooks-C_nIzkQJ.js";import{u as An,g as In,a as Pn,b as Tn}from"./use-navigate-to-agent-DBGPkYj0.js";import{a as On,c as Tt}from"./agent-capabilities-cXfbMfjV.js";import{u as Ot}from"./shell-layout-_reN3Shc.js";import{f as zn}from"./reusable-new-chat-CouMjkYR.js";import{C as Mn}from"./collection-search-BXhZ3O1D.js";import{g as $n,a as Fn,b as Bn,e as Ln}from"./extract-connection-data-DY9nlWot.js";import{u as zt,a as Mt,g as En,C as Ye}from"./connection-card-DdoyOAg3.js";import{e as $t,d as Ft,a as Bt,b as Lt,h as Vn,c as Hn}from"./dialog-CRj0zBQ_.js";import{S as Rn,a as Kn,b as Un,c as Gn,d as De}from"./select-Bv-2ewD2.js";import{T as qn}from"./textarea-Bn4a6Dgo.js";import{b as Et}from"./use-connection-CSBpX4PU.js";import{a as Be,b as Je}from"./Tool02-CG-MJEAZ.js";import{s as Ze}from"./Star01-Cw9ulDl8.js";import{c as Xn,i as $e,a as ut,E as Wn,p as Qn,b as Yn,d as Jn}from"./connection-form-helpers-D6bw0HEg.js";import{a as et}from"./authenticate-and-persist-oauth-DiCc1vu0.js";import{g as Zn}from"./connection-slug-eyAPH6o3.js";import{C as es}from"./collection-tabs-BMBpTAbo.js";import{u as mt}from"./use-infinite-scroll-BhWnCwa_.js";import{B as Fe}from"./badge-p90WsvMa.js";import{u as ts}from"./useSuspenseInfiniteQuery-C2EK0lz_.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as ns}from"./studio-tools-DfsuYmJt.js";import{u as ss}from"./use-ai-providers-DFQIA0YS.js";function ft(n){return n.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const os=Kt({name:Ut().min(2,"Organization name is required")});function is(n){const e=$.c(66),{open:s,onOpenChange:o}=n,i=V();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={resolver:pt(os),defaultValues:{name:""}},e[0]=a):a=e[0];const r=ht(a);let d;e[1]!==i?(d=async E=>{const M=ft(E.name);if(!M)throw new Error(i("common.createOrganizationDialog.invalidSlug"));const G=await ae.organization.create({name:E.name,slug:M});if(G?.error)throw new Error(G.error.message||i("common.createOrganizationDialog.failedToCreate"));const U=G?.data?.slug??M;if(!U)throw new Error(i("common.createOrganizationDialog.failedToCreate"));return{orgSlug:U}},e[1]=i,e[2]=d):d=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=as,e[3]=c):c=e[3];let m;e[4]!==d?(m={mutationFn:d,onSuccess:c},e[4]=d,e[5]=m):m=e[5];const u=Gt(m);let p;e[6]!==u.error||e[7]!==i?(p=u.error instanceof Error?u.error.message:u.error?i("common.createOrganizationDialog.failedToCreateGeneric"):null,e[6]=u.error,e[7]=i,e[8]=p):p=e[8];const l=p;let x;e[9]!==i?(x=i("common.createOrganizationDialog.title"),e[9]=i,e[10]=x):x=e[10];let y;e[11]!==x?(y=t.jsx(un,{children:x}),e[11]=x,e[12]=y):y=e[12];let h;e[13]!==i?(h=i("common.createOrganizationDialog.description"),e[13]=i,e[14]=h):h=e[14];let f;e[15]!==h?(f=t.jsx(mn,{children:h}),e[15]=h,e[16]=f):f=e[16];let j;e[17]!==y||e[18]!==f?(j=t.jsxs(fn,{children:[y,f]}),e[17]=y,e[18]=f,e[19]=j):j=e[19];let v;if(e[20]!==u||e[21]!==r){let E;e[23]!==u?(E=M=>u.mutateAsync(M),e[23]=u,e[24]=E):E=e[24],v=r.handleSubmit(E),e[20]=u,e[21]=r,e[22]=v}else v=e[22];let b;e[25]!==r.formState.isSubmitting||e[26]!==i?(b=E=>{const{field:M}=E;return t.jsxs(Y,{children:[t.jsx(J,{children:i("common.createOrganizationDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{...M,placeholder:i("common.createOrganizationDialog.namePlaceholder"),disabled:r.formState.isSubmitting})}),t.jsx(jn,{children:i("common.createOrganizationDialog.nameDescription")}),M.value&&t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[i("common.createOrganizationDialog.urlLabel")," ",t.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ft(M.value)]})]}),t.jsx(ee,{})]})},e[25]=r.formState.isSubmitting,e[26]=i,e[27]=b):b=e[27];let w;e[28]!==r.control||e[29]!==b?(w=t.jsx(Q,{control:r.control,name:"name",render:b}),e[28]=r.control,e[29]=b,e[30]=w):w=e[30];let N;e[31]!==l?(N=l&&t.jsx("div",{className:"text-destructive text-sm mt-2",children:l}),e[31]=l,e[32]=N):N=e[32];const P=r.formState.isSubmitting;let O;e[33]!==u||e[34]!==r?(O=()=>{u.reset(),r.reset()},e[33]=u,e[34]=r,e[35]=O):O=e[35];let g;e[36]!==i?(g=i("common.createOrganizationDialog.cancel"),e[36]=i,e[37]=g):g=e[37];let _;e[38]!==r.formState.isSubmitting||e[39]!==O||e[40]!==g?(_=t.jsx(gn,{disabled:P,onClick:O,children:g}),e[38]=r.formState.isSubmitting,e[39]=O,e[40]=g,e[41]=_):_=e[41];const T=!r.formState.isValid||r.formState.isSubmitting;let S;e[42]!==r.formState.isSubmitting||e[43]!==i?(S=r.formState.isSubmitting?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(vn,{size:"xs"})," ",i("common.createOrganizationDialog.creating")]}):i("common.createOrganizationDialog.createButton"),e[42]=r.formState.isSubmitting,e[43]=i,e[44]=S):S=e[44];let C;e[45]!==T||e[46]!==S?(C=t.jsx(ne,{type:"submit",variant:"default",disabled:T,children:S}),e[45]=T,e[46]=S,e[47]=C):C=e[47];let I;e[48]!==_||e[49]!==C?(I=t.jsxs(pn,{children:[_,C]}),e[48]=_,e[49]=C,e[50]=I):I=e[50];let k;e[51]!==v||e[52]!==w||e[53]!==N||e[54]!==I?(k=t.jsxs("form",{className:"space-y-6",onSubmit:v,autoComplete:"off",children:[w,N,I]}),e[51]=v,e[52]=w,e[53]=N,e[54]=I,e[55]=k):k=e[55];let A;e[56]!==r||e[57]!==k?(A=t.jsx(nt,{...r,children:k}),e[56]=r,e[57]=k,e[58]=A):A=e[58];let z;e[59]!==j||e[60]!==A?(z=t.jsxs(hn,{children:[j,A]}),e[59]=j,e[60]=A,e[61]=z):z=e[61];let L;return e[62]!==o||e[63]!==s||e[64]!==z?(L=t.jsx(xn,{open:s,onOpenChange:o,children:z}),e[62]=o,e[63]=s,e[64]=z,e[65]=L):L=e[65],L}function as(n){const{orgSlug:e}=n;window.location.href=`/${e}`}function Vt(){const n=R.useContext(qt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date),refetch:()=>s?.()}}function rs(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=$.c(13),{org:s,size:o}=n,i=o===void 0?"sm":o,a=i==="xs"?"size-5":"size-6",r=i==="xs"?"text-[9px]":"text-xs";let d;e[0]!==a?(d=X(a,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:rs(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let m;e[5]!==s.logo||e[6]!==s.name||e[7]!==r?(m=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:X("font-semibold leading-none",r),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=r,e[8]=m):m=e[8];let u;return e[9]!==d||e[10]!==c||e[11]!==m?(u=t.jsx("div",{className:d,style:c,children:m}),e[9]=d,e[10]=c,e[11]=m,e[12]=u):u=e[12],u}function ls({invitation:n,onChanged:e}){const s=V(),[o,i]=R.useState(!1),a=n.organizationName??s("header.orgSwitcher.unknownOrganization"),r=async()=>{i(!0);try{const m=await ae.organization.acceptInvitation({invitationId:n.id});if(m.error){K.error(m.error.message),i(!1);return}}catch{K.error(s("header.orgSwitcher.failedToAcceptInvitation")),i(!1);return}K.success(s("header.orgSwitcher.joined",{name:a})),Wt();let c;try{c=(await ae.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},d=async()=>{i(!0);try{const c=await ae.organization.rejectInvitation({invitationId:n.id});if(c.error){K.error(c.error.message),i(!1);return}K.success(s("header.orgSwitcher.invitationDeclined")),i(!1),e()}catch{K.error(s("header.orgSwitcher.failedToDeclineInvitation")),i(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(lt,{org:{name:a},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:a}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ne,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:r,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(ne,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:d,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:a}),children:t.jsx(Nt,{size:14})})]})]})}function cs(n){const e=$.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:i}=n,a=V(),{data:r}=Xt(),{invitations:d,refetch:c}=Vt();let m;e[0]!==s?(m=(k,A)=>k.slug===s?-1:A.slug===s?1:k.name.localeCompare(A.name),e[0]=s,e[1]=m):m=e[1];const u=[...r??[]].sort(m),[p,l]=R.useState(""),x=p.toLowerCase(),y=x?u.filter(k=>k.name.toLowerCase().includes(x)||k.slug.toLowerCase().includes(x)):u;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(wt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=h):h=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[3]=f):f=e[3];let j;e[4]!==p?(j=k=>k.key==="Escape"&&p&&l(""),e[4]=p,e[5]=j):j=e[5];let v;e[6]!==a?(v=a("header.orgSwitcher.searchOrganizations"),e[6]=a,e[7]=v):v=e[7];let b;e[8]!==p||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:p,onChange:f,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=p,e[9]=j,e[10]=v,e[11]=b):b=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{size:16}),e[12]=w):w=e[12];let N;e[13]!==i?(N=t.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:w}),e[13]=i,e[14]=N):N=e[14];let P;e[15]!==b||e[16]!==N?(P=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[h,b,N]}),e[15]=b,e[16]=N,e[17]=P):P=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let g;e[18]!==d||e[19]!==p||e[20]!==c?(g=!p&&d.map(k=>t.jsx(ls,{invitation:k,onChanged:c},k.id)),e[18]=d,e[19]=p,e[20]=c,e[21]=g):g=e[21];const _=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:p?a("header.orgSwitcher.noOrganizationsMatch",{query:p}):a("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=k=>t.jsxs("button",{type:"button",onClick:()=>o(k.slug),className:X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",k.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:k,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.slug})]}),k.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},k.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const S=y.map(T);let C;e[25]!==g||e[26]!==_||e[27]!==S?(C=t.jsxs("div",{className:O,children:[g,_,S]}),e[25]=g,e[26]=_,e[27]=S,e[28]=C):C=e[28];let I;return e[29]!==C||e[30]!==P?(I=t.jsxs(t.Fragment,{children:[P,C]}),e[29]=C,e[30]=P,e[31]=I):I=e[31],I}function ds(n){const e=$.c(22),{trigger:s,orgParam:o,align:i,side:a}=n,r=i===void 0?"start":i,d=a===void 0?"bottom":a,c=st(),[m,u]=R.useState(!1),[p,l]=R.useState(!1);let x;e[0]!==s?(x=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=x):x=e[1];const y=String(m);let h;e[2]!==c?(h=P=>{u(!1),c({to:"/$org",params:{org:P}})},e[2]=c,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{u(!1),l(!0)},e[4]=f):f=e[4];let j;e[5]!==o||e[6]!==y||e[7]!==h?(j=t.jsx(cs,{orgParam:o,onSelectOrg:h,onCreateOrg:f},y),e[5]=o,e[6]=y,e[7]=h,e[8]=j):j=e[8];let v;e[9]!==r||e[10]!==d||e[11]!==j?(v=t.jsx(yt,{side:d,align:r,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:ms,onCloseAutoFocus:us,children:j}),e[9]=r,e[10]=d,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==m||e[14]!==x||e[15]!==v?(b=t.jsxs(St,{open:m,onOpenChange:u,children:[x,v]}),e[13]=m,e[14]=x,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==p?(w=t.jsx(is,{open:p,onOpenChange:l}),e[17]=p,e[18]=w):w=e[18];let N;return e[19]!==w||e[20]!==b?(N=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=N):N=e[21],N}function us(n){return n.preventDefault()}function ms(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function fs(n){const e=$.c(21),{value:s,onChange:o,placeholder:i,onKeyDown:a,className:r,isSearching:d,disabled:c}=n,m=i===void 0?"Search...":i;let u;e[0]!==r?(u=X("shrink-0 w-full border-b border-border h-12",r),e[0]=r,e[1]=u):u=e[1];const p=c?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==p?(l=X("flex items-center gap-2.5 h-12 px-4",p),e[2]=p,e[3]=l):l=e[3];let x;e[4]!==d?(x=d?t.jsx(ke,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(wt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=d,e[5]=x):x=e[5];let y;e[6]!==o?(y=v=>o(v.target.value),e[6]=o,e[7]=y):y=e[7];let h;e[8]!==c||e[9]!==a||e[10]!==m||e[11]!==y||e[12]!==s?(h=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:a,placeholder:m,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]=a,e[10]=m,e[11]=y,e[12]=s,e[13]=h):h=e[13];let f;e[14]!==l||e[15]!==x||e[16]!==h?(f=t.jsxs("label",{className:l,children:[x,h]}),e[14]=l,e[15]=x,e[16]=h,e[17]=f):f=e[17];let j;return e[18]!==u||e[19]!==f?(j=t.jsx("div",{className:u,children:f}),e[18]=u,e[19]=f,e[20]=j):j=e[20],j}function gs(n,e,s){if(!s)return null;const o=Dn(n,e);return o?o.threads.get().find(a=>a.id===s)?.branch??null:null}function ps(n){const e=$.c(6),{value:s,onChange:o}=n,i=V();let a;e[0]!==i?(a=i("sidebar.agentsSection.searchAgents"),e[0]=i,e[1]=a):a=e[1];let r;return e[2]!==o||e[3]!==a||e[4]!==s?(r=t.jsx(fs,{value:s,onChange:o,placeholder:a}),e[2]=o,e[3]=a,e[4]=s,e[5]=r):r=e[5],r}function hs(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=$.c(10),{org:s,onClose:o}=n,i=V();let a;e[0]!==s.slug?(a={org:s.slug},e[0]=s.slug,e[1]=a):a=e[1];let r;e[2]!==o?(r=()=>o(),e[2]=o,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sidebar.agentsSection.seeAllAgents"),e[4]=i,e[5]=d):d=e[5];let c;return e[6]!==a||e[7]!==r||e[8]!==d?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Qt,{to:"/$org/settings/agents",params:a,onClick:r,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:d})}),e[6]=a,e[7]=r,e[8]=d,e[9]=c):c=e[9],c}function js(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Ht,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function vs(n){const e=$.c(11),{onImportFromGithub:s}=n,o=V();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_n,{className:"size-3.5"}),e[0]=i):i=e[0];let a;e[1]!==o?(a=o("sidebar.agentsSection.import"),e[1]=o,e[2]=a):a=e[2];let r;e[3]!==s||e[4]!==a?(r=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[i,a]}),e[3]=s,e[4]=a,e[5]=r):r=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=d):d=e[7];let c;return e[8]!==r||e[9]!==d?(c=t.jsx(Ht,{action:r,children:d}),e[8]=r,e[9]=d,e[10]=c):c=e[10],c}function bs(n){const e=$.c(11),{setOpen:s,emptyCtaClass:o}=n,i=V();let a;e[0]!==i?(a=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=a):a=e[1];let r;e[2]!==o?(r=X(o),e[2]=o,e[3]=r):r=e[3];let d;e[4]!==s?(d=()=>{H("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=d):d=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[6]=c):c=e[6];let m;return e[7]!==a||e[8]!==r||e[9]!==d?(m=t.jsx(_t,{"aria-label":a,className:r,onClick:d,children:c}),e[7]=a,e[8]=r,e[9]=d,e[10]=m):m=e[10],m}function Cs(n){const e=$.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:i}=n,a=V();let r;e[0]!==o||e[1]!==a?(r=o?void 0:a("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==i?(d=X(i),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==s?(c=()=>{H("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(we,{}),e[7]=m):m=e[7];let u;e[8]!==a?(u=a("sidebar.agentsSection.newAgent"),e[8]=a,e[9]=u):u=e[9];let p;e[10]!==u?(p=t.jsx("span",{children:u}),e[10]=u,e[11]=p):p=e[11];let l;return e[12]!==r||e[13]!==d||e[14]!==c||e[15]!==p?(l=t.jsx(bt,{children:t.jsxs(Ct,{tooltip:r,className:d,onClick:c,children:[m,p]})}),e[12]=r,e[13]=d,e[14]=c,e[15]=p,e[16]=l):l=e[16],l}function ys(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(At,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function Ss(n){const e=$.c(8),{emptyCtaClass:s}=n,o=V();let i;e[0]!==o?(i=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==s?(a=X(s),e[2]=s,e[3]=a):a=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(we,{className:"size-4"}),e[4]=r):r=e[4];let d;return e[5]!==i||e[6]!==a?(d=t.jsx(_t,{"aria-label":i,className:a,children:r}),e[5]=i,e[6]=a,e[7]=d):d=e[7],d}function ws(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:i}=n,a=V();let r;e[0]!==o||e[1]!==a?(r=o?void 0:a("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==i?(d=X(i),e[3]=i,e[4]=d):d=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{}),e[5]=c):c=e[5];let m;e[6]!==a?(m=a("sidebar.agentsSection.newAgent"),e[6]=a,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsx("span",{children:m}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==r||e[11]!==d||e[12]!==u?(p=t.jsx(Le,{asChild:!0,children:t.jsxs(Ct,{tooltip:r,className:d,children:[c,u]})}),e[10]=r,e[11]=d,e[12]=u,e[13]=p):p=e[13];let l;e[14]!==p||e[15]!==s?(l=s(p),e[14]=p,e[15]=s,e[16]=l):l=e[16];let x;return e[17]!==l?(x=t.jsx(bt,{children:l}),e[17]=l,e[18]=x):x=e[18],x}function Ns(n){const e=$.c(9),{children:s}=n,o=V();let i;e[0]!==s?(i=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==o?(a=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=a):a=e[3];let r;e[4]!==a?(r=t.jsx(ye,{side:"right",sideOffset:8,children:a}),e[4]=a,e[5]=r):r=e[5];let d;return e[6]!==i||e[7]!==r?(d=t.jsxs(Se,{defaultOpen:!0,delayDuration:0,children:[i,r]}),e[6]=i,e[7]=r,e[8]=d):d=e[8],d}function _s(n){const e=st(),{create:s}=kn(),{locator:o}=oe(),i=ot({strict:!1}),a=it({strict:!1});return async r=>{const d=crypto.randomUUID(),c=r===a.virtualmcpid?gs(n,o,i.taskId??""):null;try{await s({id:d,virtual_mcp_id:r,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:d},search:{virtualmcpid:r}})}}function tt(n){const e=$.c(20),{agent:s,selected:o,onClick:i}=n,a=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let r;e[0]!==a?(r=X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",a),e[0]=a,e[1]=r):r=e[1];let d;e[2]!==s.icon||e[3]!==s.title?(d=t.jsx(jt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=d):d=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let m;e[7]!==s.description?(m=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=m):m=e[8];let u;e[9]!==c||e[10]!==m?(u=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,m]}),e[9]=c,e[10]=m,e[11]=u):u=e[11];let p;e[12]!==o?(p=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=p):p=e[13];let l;return e[14]!==i||e[15]!==r||e[16]!==d||e[17]!==u||e[18]!==p?(l=t.jsxs("button",{type:"button",onClick:i,className:r,children:[d,u,p]}),e[14]=i,e[15]=r,e[16]=d,e[17]=u,e[18]=p,e[19]=l):l=e[19],l}function Ht(n){const e=$.c(5),{children:s,action:o}=n;let i;e[0]!==s?(i=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==o||e[3]!==i?(a=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[i,o]}),e[2]=o,e[3]=i,e[4]=a):a=e[4],a}function Ds(n){const e=$.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:i,onImportFromGithub:a}=n,[r,d]=R.useState(""),c=cn(),m=c??[],{org:u}=oe(),{data:p}=ae.useSession(),l=p?.user?.id??"anon",x=In(c),y=Pn(),h=_s(u.slug),f=On(c),j=r.toLowerCase(),v=m.filter(Ps).filter(B=>!f.has(B.id)).filter(Is).filter(B=>!r||B.title.toLowerCase().includes(j)),b=v.filter(As),w=v.filter(ks),N=rt(u.id),P=!r||N.title.toLowerCase().includes(j),O=!!(o&&P);let g;e[0]!==s||e[1]!==o?(g=()=>{o?.(null),s(),d("")},e[0]=s,e[1]=o,e[2]=g):g=e[2];const _=g,T=B=>{if(o){o(B.id),s(),d("");return}Tn({orgId:u.id,userId:l},B.id,x),y(),s(),d(""),h(B.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let C;e[3]!==r?(C=t.jsx(ps,{value:r,onChange:d}),e[3]=r,e[4]=C):C=e[4];const I="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",k=o&&P&&N&&t.jsx(tt,{agent:N,selected:!i||i===N.id,onClick:_}),A=(b.length>0||!r)&&t.jsx(vs,{onImportFromGithub:a}),z=b.map(B=>t.jsx(tt,{agent:B,selected:o?i===B.id:void 0,onClick:()=>T(B)},B.id)),L=w.length>0&&t.jsx(js,{}),E=w.map(B=>t.jsx(tt,{agent:B,selected:o?i===B.id:void 0,onClick:()=>T(B)},B.id));let M;e[5]!==O||e[6]!==r||e[7]!==v.length?(M=v.length===0&&!O&&r&&t.jsx(hs,{}),e[5]=O,e[6]=r,e[7]=v.length,e[8]=M):M=e[8];let G;e[9]!==M||e[10]!==k||e[11]!==A||e[12]!==z||e[13]!==L||e[14]!==E?(G=t.jsxs("div",{className:I,children:[k,A,z,L,E,M]}),e[9]=M,e[10]=k,e[11]=A,e[12]=z,e[13]=L,e[14]=E,e[15]=G):G=e[15];let U;e[16]!==s||e[17]!==u?(U=t.jsx(xs,{org:u,onClose:s}),e[16]=s,e[17]=u,e[18]=U):U=e[18];let de;return e[19]!==G||e[20]!==U||e[21]!==C?(de=t.jsxs("div",{className:S,children:[C,G,U]}),e[19]=G,e[20]=U,e[21]=C,e[22]=de):de=e[22],de}function ks(n){return!Tt(n.metadata)}function As(n){return Tt(n.metadata)}function Is(n){return!an(n.id)}function Ps(n){return!on(n.id)}function Ts(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:i,onSelectAgent:a,selectedAgentId:r,side:d,align:c}=s,m=o===void 0?!1:o,u=d===void 0?"right":d,p=c===void 0?"start":c,[l,x]=R.useState(!1),[y,h]=R.useState(!1),f=It(),{setOpenMobile:j}=vt(),v=An(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(Ns,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const N=w;let P;e[4]!==f||e[5]!==j?(P=()=>{x(!1),f&&j(!1)},e[4]=f,e[5]=j,e[6]=P):P=e[6];const O=P;let g;e[7]!==O?(g=()=>{O(),h(!0)},e[7]=O,e[8]=g):g=e[8];const _=g;let T;e[9]!==O||e[10]!==_||e[11]!==a||e[12]!==l||e[13]!==r?(T=l&&t.jsx(R.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(bn,{className:"h-4 w-24"})}),children:t.jsx(Ds,{onClose:O,onSelectAgent:a,selectedAgentId:r,onImportFromGithub:_})}),e[9]=O,e[10]=_,e[11]=a,e[12]=l,e[13]=r,e[14]=T):T=e[14];const S=T;let C;e[15]!==p||e[16]!==m||e[17]!==b||e[18]!==v||e[19]!==f||e[20]!==l||e[21]!==S||e[22]!==u||e[23]!==i||e[24]!==N?(C=f?t.jsxs(t.Fragment,{children:[i?t.jsx("button",{type:"button",onClick:()=>x(!0),className:"contents",children:i}):m?N(t.jsx(bs,{setOpen:x,emptyCtaClass:b})):t.jsx(Cs,{setOpen:x,highlightEmpty:v,emptyCtaClass:b}),t.jsx(Dt,{open:l,onOpenChange:x,direction:"bottom",children:t.jsxs(kt,{className:"max-h-[85dvh] p-0",children:[t.jsx(ys,{}),S]})})]}):t.jsxs(St,{open:l,onOpenChange:A=>{A&&!l&&H("agent_browser_opened",{surface:"desktop_popover"}),x(A)},children:[i?t.jsx(Le,{asChild:!0,children:i}):m?N(t.jsx(Le,{asChild:!0,children:t.jsx(Ss,{emptyCtaClass:b})})):t.jsx(ws,{wrapEmptyHint:N,highlightEmpty:v,emptyCtaClass:b}),t.jsx(yt,{className:"w-[380px] p-0 overflow-hidden",side:u,align:p,children:S})]}),e[15]=p,e[16]=m,e[17]=b,e[18]=v,e[19]=f,e[20]=l,e[21]=S,e[22]=u,e[23]=i,e[24]=N,e[25]=C):C=e[25];let I;e[26]!==y?(I=t.jsx(Nn,{open:y,onOpenChange:h,mode:"agent"}),e[26]=y,e[27]=I):I=e[27];let k;return e[28]!==I||e[29]!==C?(k=t.jsxs(t.Fragment,{children:[C,I]}),e[28]=I,e[29]=C,e[30]=k):k=e[30],k}const Os="inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function zs(n){const e=$.c(29),{agentId:s,fallback:o,onOpenHome:i,onPick:a}=n,r=V(),d=dn(s)??o??null;let c,m,u,p,l;e[0]!==d?.title||e[1]!==i||e[2]!==r?(l=d?.title??r("header.shellBreadcrumb.superAgentDefaultName"),p="flex min-w-0 items-center gap-0",c="button",m=i,u=r("header.shellBreadcrumb.openAgentHome",{name:l}),e[0]=d?.title,e[1]=i,e[2]=r,e[3]=c,e[4]=m,e[5]=u,e[6]=p,e[7]=l):(c=e[3],m=e[4],u=e[5],p=e[6],l=e[7]);const x=d?.icon??null;let y;e[8]!==x||e[9]!==l?(y=t.jsx(jt,{icon:x,name:l,size:"xs"}),e[8]=x,e[9]=l,e[10]=y):y=e[10];let h;e[11]!==c||e[12]!==m||e[13]!==u||e[14]!==y?(h=t.jsx("button",{type:c,onClick:m,"aria-label":u,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=m,e[13]=u,e[14]=y,e[15]=h):h=e[15];let f;e[16]!==l?(f=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:l}),e[16]=l,e[17]=f):f=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==f?(v=t.jsxs("button",{type:"button",className:Os,children:[f,j]}),e[19]=f,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==a||e[23]!==v?(b=t.jsx(Ts,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:a,trigger:v}),e[21]=s,e[22]=a,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==p||e[27]!==h?(w=t.jsxs("div",{className:p,children:[h,b]}),e[25]=b,e[26]=p,e[27]=h,e[28]=w):w=e[28],w}function Fo(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,i=V(),{org:a}=oe(),{state:r,isMobile:d}=vt(),c=Vt().invitations.length>0,m=r==="collapsed"||d;let u;e[2]!==c||e[3]!==a.name||e[4]!==i?(u=c?i("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:a.name}):i("header.shellBreadcrumb.switchOrganization",{name:a.name}),e[2]=c,e[3]=a.name,e[4]=i,e[5]=u):u=e[5];let p;e[6]!==a?(p=t.jsx(lt,{org:a,size:"sm"}),e[6]=a,e[7]=p):p=e[7];let l;e[8]!==c||e[9]!==m?(l=c&&t.jsx("span",{className:X("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",m?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=m,e[10]=l):l=e[10];let x;e[11]!==p||e[12]!==l?(x=t.jsxs("span",{className:"relative inline-flex",children:[p,l]}),e[11]=p,e[12]=l,e[13]=x):x=e[13];let y;e[14]!==a.name||e[15]!==o?(y=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:a.name}),e[14]=a.name,e[15]=o,e[16]=y):y=e[16];let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=h):h=e[17];let f;e[18]!==u||e[19]!==x||e[20]!==y?(f=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":u,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[x,y,h]})}),e[18]=u,e[19]=x,e[20]=y,e[21]=f):f=e[21];let j;e[22]!==a.slug||e[23]!==f?(j=t.jsx(ds,{orgParam:a.slug,trigger:f}),e[22]=a.slug,e[23]=f,e[24]=j):j=e[24];let v;e[25]!==a.name?(v=t.jsx(ye,{side:"bottom",children:a.name}),e[25]=a.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Se,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Bo(n){const e=$.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:i}=oe();let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[2]=a):a=e[2];const r=ot(a);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},e[3]=d):d=e[3];const c=it(d),{threads:m}=Pt(),{data:u}=ae.useSession(),{setTaskId:p,createNewTask:l}=Ot();let x;e[4]!==i.id?(x=rt(i.id),e[4]=i.id,e[5]=x):x=e[5];const y=x,h=y.id,f=r.taskId?c.virtualmcpid??h:h;let j;e[6]!==l||e[7]!==h||e[8]!==o||e[9]!==u?.user?.id||e[10]!==p||e[11]!==m?(j=O=>{const g=O??h,_=zn(m,g,u?.user?.id);_?p(_.id,g):l(g),o?.()},e[6]=l,e[7]=h,e[8]=o,e[9]=u?.user?.id,e[10]=p,e[11]=m,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=f===h?y:void 0;let N;e[14]!==f||e[15]!==v?(N=()=>v(f),e[14]=f,e[15]=v,e[16]=N):N=e[16];let P;return e[17]!==f||e[18]!==v||e[19]!==w||e[20]!==N?(P=t.jsx(R.Suspense,{fallback:b,children:t.jsx(zs,{agentId:f,fallback:w,onOpenHome:N,onPick:v})}),e[17]=f,e[18]=v,e[19]=w,e[20]=N,e[21]=P):P=e[21],P}function Lo(){const n=$.c(24),e=V(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const i=ot(o);let a;n[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},n[1]=a):a=n[1];const r=it(a),{threads:d}=Pt(),{createNewTask:c}=Ot();let m;n[2]!==s.id?(m=rt(s.id),n[2]=s.id,n[3]=m):m=n[3];const u=m.id,p=i.taskId?r.virtualmcpid??u:u;let l;n[4]!==i.taskId||n[5]!==d?(l=(i.taskId?d.find(P=>P.id===i.taskId)?.branch:null)??null,n[4]=i.taskId,n[5]=d,n[6]=l):l=n[6];const x=l;let y;n[7]!==p||n[8]!==c||n[9]!==x?(y=()=>{c(p,x)},n[7]=p,n[8]=c,n[9]=x,n[10]=y):y=n[10];const h=y;let f;n[11]!==e?(f=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=f):f=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(nn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==h||n[15]!==f?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:h,"aria-label":f,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:j})}),n[14]=h,n[15]=f,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let N;return n[21]!==v||n[22]!==w?(N=t.jsxs(Se,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=N):N=n[23],N}function Ms({open:n,onOpenChange:e,onCreated:s}){const o=V(),{org:i}=oe(),{data:a}=ae.useSession(),{stdioEnabled:r}=Yt(),d=It(),c=Et(),m=zt(),p=Mt(m,"").items,l=ht({resolver:pt(Xn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),x=l.watch("ui_type"),y=l.watch("connection_url"),h=l.watch("npx_package"),f=$e({uiType:x,connectionUrl:y??"",npxPackage:h??""})??ut({uiType:x,connectionUrl:y??"",registryItems:p}),j=g=>{const _=g.trim();if(!_)return;const T=!!l.formState.dirtyFields.title,S=!!l.formState.dirtyFields.description,C=!!l.formState.dirtyFields.env_vars,I=A=>{if(A&&(!T&&!l.getValues("title").trim()&&A.title&&l.setValue("title",A.title,{shouldDirty:!1}),!S&&!(l.getValues("description")??"").trim()&&A.description&&l.setValue("description",A.description,{shouldDirty:!1}),!C&&A.envVarKeys?.length)){const z=l.getValues("env_vars")??[],L=new Set(z.map(M=>M.key)),E=A.envVarKeys.filter(M=>!L.has(M));E.length>0&&l.setValue("env_vars",[...z,...E.map(M=>({key:M,value:""}))],{shouldDirty:!0})}},k=Qn(_);if(k&&r){l.setValue("ui_type","NPX",{shouldDirty:!0}),l.setValue("npx_package",k.packageName,{shouldDirty:!0}),l.setValue("connection_url","",{shouldDirty:!0}),l.setValue("connection_token",null,{shouldDirty:!0}),I($e({uiType:"NPX",npxPackage:k.packageName}));return}if(_.startsWith("http://")||_.startsWith("https://")){const A=x==="HTTP"||x==="SSE"||x==="Websocket"?x:"HTTP";l.setValue("ui_type",A,{shouldDirty:!0}),l.setValue("connection_url",_,{shouldDirty:!0}),I($e({uiType:A,connectionUrl:_})??ut({uiType:A,connectionUrl:_,registryItems:p}));return}x==="NPX"&&I($e({uiType:"NPX",npxPackage:_}))},v=g=>{g||l.reset(),e(g)},b=async g=>{let _,T=null,S=null,C=null;g.ui_type==="NPX"?(_="STDIO",T="",C=Yn(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(_="STDIO",T="",C=Jn(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(_=g.ui_type,T=g.connection_url||"",S=g.connection_token||null);const I=$n("conn");try{await c.create.mutateAsync({id:I,title:g.title,description:g.description||null,connection_type:_,connection_url:T,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:a?.user?.id||"system",organization_id:i.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),l.reset(),e(!1),s?.(I)}catch{K.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),N=o("connections.createConnectionDialog.description"),P=l.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:l.control,name:"ui_type",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs(Rn,{value:g.value,onValueChange:g.onChange,children:[t.jsx(Z,{children:t.jsx(Kn,{children:t.jsx(Un,{})})}),t.jsxs(Gn,{children:[t.jsx(De,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(De,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(De,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),r&&t.jsxs(t.Fragment,{children:[t.jsx(De,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(De,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(sn,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),x==="NPX"&&t.jsx(Q,{control:l.control,name:"npx_package",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...g,value:g.value??"",onPaste:_=>{const T=_.clipboardData.getData("text");T&&(_.preventDefault(),l.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:_=>{j(_.target.value),g.onBlur()}})}),t.jsx(ee,{})]})}),x==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:l.control,name:"stdio_command",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...g,value:g.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"stdio_args",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...g,value:g.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"stdio_cwd",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...g,value:g.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(x==="NPX"||x==="STDIO")&&t.jsx(Q,{control:l.control,name:"env_vars",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Wn,{value:g.value??[],onChange:g.onChange})}),t.jsx(ee,{})]})}),x!=="NPX"&&x!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:l.control,name:"connection_url",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...g,value:g.value??"",onPaste:_=>{const T=_.clipboardData.getData("text");T&&(_.preventDefault(),l.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:_=>{j(_.target.value),g.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"connection_token",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:f?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:f?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...g,value:g.value??""})}),f?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.token.helperText,f.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"title",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...g})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"description",render:({field:g})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(qn,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...g,value:g.value??""})}),t.jsx(ee,{})]})})]});return d?t.jsx(Dt,{open:n,onOpenChange:v,children:t.jsxs(kt,{className:"max-h-[90vh]",children:[t.jsx(Cn,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(At,{children:w}),t.jsx(yn,{className:"mt-1",children:N})]}),t.jsx(Sn,{asChild:!0,children:t.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Nt,{size:16})})})]})}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(wn,{children:t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"w-full",children:P})})]})})]})}):t.jsx($t,{open:n,onOpenChange:v,children:t.jsxs(Ft,{className:"sm:max-w-[525px]",children:[t.jsxs(Bt,{children:[t.jsx(Lt,{children:w}),t.jsx(Vn,{children:N})]}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Hn,{children:[t.jsx(ne,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"min-w-40",children:P})]})]})})]})})}function $s(n){const e=$.c(72),{mode:s,agentId:o,addedConnectionIds:i,onAdd:a,onCloneAndAdd:r,onConnectAndAdd:d,connectingItemId:c,search:m,onCreateConnection:u,onBrowseNavigate:p,defaultTab:l}=n,x=s===void 0?"add":s,y=l===void 0?"connected":l,h=V(),{org:f}=oe(),j=R.useDeferredValue(m),v=m!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let N;e[2]!==y?(N=D=>D??y,e[2]=y,e[3]=N):N=e[3];const[P,O]=Jt(Zt.connectionsTab(f.slug)+(y==="all"?":home-modal":":agent-modal"),N);let g;e[4]!==P||e[5]!==O?(g=D=>{D!==P&&H("connections_dialog_tab_changed",{to_tab:D}),O(D)},e[4]=P,e[5]=O,e[6]=g):g=e[6];const _=g;let T;e[7]!==f.id||e[8]!==f.slug?(T={connectionId:rn,orgId:f.id,orgSlug:f.slug},e[7]=f.id,e[8]=f.slug,e[9]=T):T=e[9];const S=ln(T),C=j?.trim().split(/\s+/).filter(Boolean)??[],I=C.length>0?{operator:"or",conditions:C.flatMap(Ks)}:void 0,k={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(k),{data:z,fetchNextPage:L,hasNextPage:E,isFetchingNextPage:M}=ts({queryKey:at.collectionListInfinite(S,f.id,"","CONNECTIONS",A),queryFn:async D=>{const{pageParam:F}=D,se=F===void 0?0:F;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:Hs,staleTime:3e4}),G=z?.pages.flatMap(Vs)??[],U=En(G),de=new Set(G.filter(Es).map(Ls)),B=zt(),re=Mt(B,j),He=mt(re.loadMore,re.hasMore,re.isLoadingMore),Re=mt(L,E??!1,M),W=P==="all"||!!w,ct=W?re.items.filter(D=>{const F=Fn(D);if(F&&de.has(F))return!1;if(!w)return!0;const se=Ve(D._meta),le=[D.title,D.description,D.name,D.server?.title,D.server?.description,D.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return C.some(te=>le.includes(te.toLowerCase()))}):[],Ne=ct.filter(Bs),_e=ct.filter(Fs);let Ae;e[10]!==i?(Ae=D=>D.some(F=>i.has(F.id)),e[10]=i,e[11]=Ae):Ae=e[11];const Ke=Ae;let Ie;e[12]!==i||e[13]!==o||e[14]!==c||e[15]!==Ke||e[16]!==x||e[17]!==a||e[18]!==p||e[19]!==r||e[20]!==h?(Ie=(D,F,se,le,te)=>{const Me=Ke(te),be=te.find(ce=>!i.has(ce.id)),q=te[0];if(x==="browse"){const ce=Zn(q);return t.jsx(Ye,{connection:{title:F,icon:se,description:te.length>1?`${te.length} instances`:le??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",h("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{H("connection_browse_clicked",{app_name:q.app_name??null,connection_id:q.id,instances_count:te.length}),p?.(ce)}},D)}return t.jsx(Ye,{connection:{title:F,icon:se,description:le},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Me&&t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",h("virtualMcp.connectionDialogContent.added")]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ce=>{ce.stopPropagation(),be?(H("connection_add_clicked",{action:"use_existing",app_name:q.app_name??null,connection_id:be.id}),o&&H("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:q.app_name??null,mode:"existing"}),a(be.id)):(H("connection_add_clicked",{action:"clone",app_name:q.app_name??null,base_connection_id:q.id}),r(q))},children:h("virtualMcp.connectionDialogContent.add")})]})},D)},e[12]=i,e[13]=o,e[14]=c,e[15]=Ke,e[16]=x,e[17]=a,e[18]=p,e[19]=r,e[20]=h,e[21]=Ie):Ie=e[21];const Pe=Ie;let Te;e[22]!==c||e[23]!==x||e[24]!==d||e[25]!==h?(Te=D=>{const F=Ve(D._meta),se=F?.friendlyName||F?.friendly_name||D.server?.title||D.title||D.server?.name||D.name||D.id||"",le=D.server?.description||D.description||null,te=D.server?.icons?.[0]?.src||Bn(D.server?.repository)||null,Me=F?.official===!0,be=F?.verified===!0,q=F?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:le,icon:te},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[q&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:h("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.builtByDeco")})]}),!q&&Me&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!q&&!Me&&be&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:h("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ce=>{ce.stopPropagation(),H("connection_add_clicked",{action:"connect_new",registry_item_id:D.id,app_name:F?.friendlyName||D.server?.name||D.name||null}),d(D)},children:c===D.id?t.jsx(ke,{size:14,className:"animate-spin"}):h(x==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${D.id}`)},e[22]=c,e[23]=x,e[24]=d,e[25]=h,e[26]=Te):Te=e[26];const dt=Te;let ue;e[27]!==P||e[28]!==_||e[29]!==u||e[30]!==w||e[31]!==h?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(es,{tabs:[{id:"all",label:h("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:h("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:P,onTabChange:D=>_(D)}),t.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{H("connections_dialog_custom_clicked"),u()},children:[t.jsx(we,{size:12}),h("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=P,e[28]=_,e[29]=u,e[30]=w,e[31]=h,e[32]=ue):ue=e[32];const Ue=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ue?(me=X("flex-1 overflow-auto p-5 transition-opacity duration-150",Ue),e[33]=Ue,e[34]=me):me=e[34];const Rt="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[35]!==Pe?(Oe=D=>{if(D.type==="group")return Pe(D.key,D.title,D.icon,null,D.connections);const F=D.connection;return Pe(F.id,F.title,F.icon,F.description??null,[F])},e[35]=Pe,e[36]=Oe):Oe=e[36];const Ge=U.map(Oe);let fe;e[37]!==Re?(fe=t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[37]=Re,e[38]=fe):fe=e[38];let ge;e[39]!==M?(ge=M&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=M,e[40]=ge):ge=e[40];const qe=W&&Ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(Je,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:h("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=W&&Ne.map(dt),We=W&&_e.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:h("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Qe=W&&_e.map(dt);let pe;e[41]!==He||e[42]!==B||e[43]!==W?(pe=W&&B.length>0&&t.jsx("div",{ref:He,className:"col-span-full h-1"}),e[41]=He,e[42]=B,e[43]=W,e[44]=pe):pe=e[44];let he;e[45]!==re.isLoadingMore||e[46]!==W?(he=W&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=re.isLoadingMore,e[46]=W,e[47]=he):he=e[47];let xe;e[48]!==Ge||e[49]!==fe||e[50]!==ge||e[51]!==qe||e[52]!==Xe||e[53]!==We||e[54]!==Qe||e[55]!==pe||e[56]!==he?(xe=t.jsxs("div",{className:Rt,children:[Ge,fe,ge,qe,Xe,We,Qe,pe,he]}),e[48]=Ge,e[49]=fe,e[50]=ge,e[51]=qe,e[52]=Xe,e[53]=We,e[54]=Qe,e[55]=pe,e[56]=he,e[57]=xe):xe=e[57];let je;e[58]!==P||e[59]!==U.length||e[60]!==_e||e[61]!==m||e[62]!==h||e[63]!==Ne?(je=U.length===0&&Ne.length===0&&_e.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:m?h("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:m}):h(P==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=P,e[59]=U.length,e[60]=_e,e[61]=m,e[62]=h,e[63]=Ne,e[64]=je):je=e[64];let ve;e[65]!==me||e[66]!==xe||e[67]!==je?(ve=t.jsxs("div",{className:me,children:[xe,je]}),e[65]=me,e[66]=xe,e[67]=je,e[68]=ve):ve=e[68];let ze;return e[69]!==ue||e[70]!==ve?(ze=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=ze):ze=e[71],ze}function Fs(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Bs(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function Ls(n){return n.app_name}function Es(n){return n.app_name}function Vs(n){return n?.items??[]}function Hs(n,e){if(n?.hasMore)return e.reduce(Rs,0)}function Rs(n,e){return n+(e?.items?.length??0)}function Ks(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Eo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...i}){const a=V(),r=i.mode??"add",d="agentId"in i?i.agentId:void 0,c="addedConnectionIds"in i?i.addedConnectionIds??new Set:new Set,m="onAdd"in i&&i.onAdd?i.onAdd:S=>{},u=(S,C,I)=>{d&&H("agent_connection_attached",{agent_id:d,connection_id:S,app_name:C,mode:I})},[p,l]=R.useState(null),[x,y]=R.useState(o),[h,f]=R.useState(!1),{org:j}=oe(),{data:v}=ae.useSession(),b=Et(),w=en(),N=st(),P=S=>{e(!1),N({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:S}})},O=()=>{w.invalidateQueries({predicate:S=>{const C=S.queryKey;return C[1]===j.id&&C[3]==="collection"&&C[4]==="CONNECTIONS"}})},g=async(S,C)=>{H("connection_oauth_succeeded",{connection_id:S,flow:C});const I=new URL(`/api/${j.slug}/mcp/${S}`,window.location.origin);await w.invalidateQueries({queryKey:at.isMCPAuthenticated(I.href,null)}),O()},_=async S=>{l(S.app_name??S.id);try{const I=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:I,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,z=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:L=>b.update.mutateAsync({id:A,data:{connection_token:L}}).then(()=>{})});if(z.ran&&!z.ok){H("connection_oauth_failed",{connection_id:A,flow:"clone",error:z.error??"no_token"}),K.error(a("virtualMcp.addConnectionDialog.authenticationFailedError",{error:z.error??"no token received"})),await b.delete.mutateAsync(A);return}z.ran&&await g(A,"clone"),u(A,S.app_name??null,"clone"),m(A)}catch(C){console.error("Failed to add connection:",C),K.error(a("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{l(null)}},T=async S=>{if(!(!j||!v?.user?.id)){l(S.id);try{const C=Ln(S,j.id,v.user.id,{remoteIndex:0}),I=C.connection_type==="STDIO",k=!!C.connection_url,A=I&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!k&&!A){K.error(a("virtualMcp.addConnectionDialog.mcpServerConnectionError")),l(null);return}const{id:z}=await b.create.mutateAsync(C),L=await et({connectionId:z,orgId:j.id,orgSlug:j.slug,persistFallback:E=>b.update.mutateAsync({id:z,data:{connection_token:E}}).then(()=>{})});if(L.ran&&!L.ok){H("connection_oauth_failed",{connection_id:z,flow:"connect_new",error:L.error??"no_token"}),K.warning(a("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:a("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),u(z,C.app_name??null,"new"),m(z);return}L.ran?(await g(z,"connect_new"),K.success(a("virtualMcp.addConnectionDialog.connectedAuthenticated"))):K.success(a("virtualMcp.addConnectionDialog.connected")),u(z,C.app_name??null,"new"),m(z)}catch(C){console.error("Failed to connect:",C),K.error(a("virtualMcp.addConnectionDialog.failedToConnect"))}finally{l(null)}}};return t.jsxs($t,{open:n,onOpenChange:e,children:[t.jsxs(Ft,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Bt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Lt,{className:"text-base font-semibold",children:a(r==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Mn,{value:x,onChange:y,placeholder:a("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(R.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx($s,{mode:r,agentId:d,addedConnectionIds:c,onAdd:m,onCloneAndAdd:_,onConnectAndAdd:T,connectingItemId:p,search:x,onCreateConnection:()=>f(!0),onBrowseNavigate:P,defaultTab:s})})]}),t.jsx(Ms,{open:h,onOpenChange:f,onCreated:async S=>{f(!1);const C=await et({connectionId:S,orgId:j.id,orgSlug:j.slug,persistFallback:I=>b.update.mutateAsync({id:S,data:{connection_token:I}}).then(()=>{})});if(C.ran&&!C.ok){H("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:C.error??"no_token"}),K.warning(a("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:a("virtualMcp.addConnectionDialog.signInFailedDescription",{error:C.error??"no token received"})}),u(S,null,"custom"),m(S),e(!1);return}C.ran&&await g(S,"custom_create"),u(S,null,"custom"),m(S),e(!1)}})]})}const gt=new Map;function Vo(){const{org:n}=oe(),e=ns(),s=ss(),o=s.find(f=>f.providerId==="deco"),{data:i,isLoading:a,refetch:r,isFetching:d}=tn({queryKey:at.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=i?.balanceCents??null,m=c!=null?c/100:null,u=R.useRef(new Map);if(c!=null){const f=gt.get(n.id);u.current.get(n.id)&&f!=null&&c>f&&H("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-f,previous_balance_cents:f,new_balance_cents:c}),gt.set(n.id,c),u.current.set(n.id,!0)}const p=!!o,l=c!=null&&c>0,x=c!=null&&c===0,y=c!=null&&c===200,h=s.length>0&&s.every(f=>f.providerId==="deco");return{hasDecoKey:p,decoKeyId:o?.id??null,balanceCents:c,balanceDollars:m,hasCredits:l,isZeroBalance:x,isInitialFreeCredit:y,hasOnlyDecoProvider:h,isLoading:a,isFetching:d,refetch:r}}export{Bo as A,Lo as N,Fo as O,Eo as a,ds as b,lt as c,Vo as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-CckLDzub.js";import{d as R,D as u}from"./decopilot-sse-pool-B6LhhEZg.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
1
+ import{r as s}from"./index-CsMY3E0n.js";import{d as R,D as u}from"./decopilot-sse-pool-B682c9RZ.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
@@ -1 +1 @@
1
- import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,ba as re,bb as ae}from"./index-CckLDzub.js";import{A as z,a as G,b as V,c as X,d as Z,e as ee,f as te,g as ne}from"./alert-dialog-DnqyXHfM.js";import{u as de}from"./studio-tools-BB_5IEtF.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let b;e[56]!==_?(b=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=b):b=e[57];let F;e[58]!==A||e[59]!==b?(F=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,b]})}),e[58]=A,e[59]=b,e[60]=F):F=e[60];let I;e[61]!==y||e[62]!==F?(I=n.jsxs(V,{children:[y,F]}),e[61]=y,e[62]=F,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ue as D,De as u};
1
+ import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,ba as re,bb as ae}from"./index-CsMY3E0n.js";import{A as z,a as G,b as V,c as X,d as Z,e as ee,f as te,g as ne}from"./alert-dialog-DctPzbrJ.js";import{u as de}from"./studio-tools-DfsuYmJt.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let b;e[56]!==_?(b=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=b):b=e[57];let F;e[58]!==A||e[59]!==b?(F=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,b]})}),e[58]=A,e[59]=b,e[60]=F):F=e[60];let I;e[61]!==y||e[62]!==F?(I=n.jsxs(V,{children:[y,F]}),e[61]=y,e[62]=F,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ue as D,De as u};