decocms 3.26.2 → 3.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/client/assets/{AlertCircle-9EFUZenf.js → AlertCircle-Dk6vk346.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-97355q5v.js → ArrowUpRight-4oEjocH3.js} +1 -1
  3. package/dist/client/assets/{Check-D-9dblUn.js → Check-xMlMIzVH.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-C2ualSpf.js → CheckCircle-ieh2HpZJ.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Cf2Q-GlB.js → ChevronDown-DXk0XLak.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-BaV4nFMQ.js → ChevronLeft-z0R4UDTf.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CrZy8tHx.js → ChevronRight-TZkuqway.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BAxoXhnT.js → ChevronUp-CDwUhj6r.js} +1 -1
  9. package/dist/client/assets/{Container-CYcITvPW.js → Container-BuYdkyve.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-SvwN4CeV.js → DotsVertical-dauL8_mz.js} +1 -1
  11. package/dist/client/assets/{Eye-ByuwKsdh.js → Eye-DjmQZ2p3.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BJZdiggU.js → FilterLines-DCVUz1mF.js} +1 -1
  13. package/dist/client/assets/{Globe01-DfGFlik1.js → Globe01-BFX2DjNo.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DNFvbooP.js → HardDrive-ep-sJwLU.js} +1 -1
  15. package/dist/client/assets/{Key01-CzmPnHuw.js → Key01-u8nOkLN5.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CQ8Vq9nI.js → LayoutLeft-Ozgz9jeL.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-CgI1VTqi.js → LinkExternal01-C_bnt3ki.js} +1 -1
  18. package/dist/client/assets/{Monitor01-Cw6kmClm.js → Monitor01-BBuvzSNf.js} +1 -1
  19. package/dist/client/assets/{Palette-Druykvzw.js → Palette-CJj0LVDj.js} +1 -1
  20. package/dist/client/assets/{Play-CMJ2IWYR.js → Play-BUy7F0as.js} +1 -1
  21. package/dist/client/assets/{Plus-CjrtKB-Y.js → Plus-CSmw6cpp.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-3BsQQkRx.js → RefreshCcw01-Ct_5xx8z.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BL2y99rx.js → SearchMd-DXp3IUvU.js} +1 -1
  24. package/dist/client/assets/{Settings02-Cd4DIqaJ.js → Settings02-DttqwSGe.js} +1 -1
  25. package/dist/client/assets/{Shield01-zIbMct6w.js → Shield01-BlrpeOP8.js} +1 -1
  26. package/dist/client/assets/{Star01-eRdSY4QW.js → Star01-s_hRJjwq.js} +1 -1
  27. package/dist/client/assets/{Stars01-v0yz6PCZ.js → Stars01-U1zM7H-d.js} +1 -1
  28. package/dist/client/assets/{Stars02-EuAFDZ5E.js → Stars02-Cg2K8h2t.js} +1 -1
  29. package/dist/client/assets/{Sun-CH2HWLCn.js → Sun-D1pch37z.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-BMnNI1Fi.js → SwitchHorizontal01-DUBxuMB8.js} +1 -1
  31. package/dist/client/assets/{Tool01-Dcq7KP8Y.js → Tool01-CSM07Bd3.js} +1 -1
  32. package/dist/client/assets/{Trash01-Cup7-ZTT.js → Trash01-BOiUMUTV.js} +1 -1
  33. package/dist/client/assets/{Upload01-C9yi1Bdg.js → Upload01-B45bupsd.js} +1 -1
  34. package/dist/client/assets/{User01-thAIxsAs.js → User01-CMlKZMq6.js} +1 -1
  35. package/dist/client/assets/{Users01-DPJm6-u-.js → Users01-CHcmgQX1.js} +1 -1
  36. package/dist/client/assets/{Users03-BlNe2PnN.js → Users03-C19XPgsH.js} +1 -1
  37. package/dist/client/assets/{X-1KR4wibP.js → X-LT7RIKGm.js} +1 -1
  38. package/dist/client/assets/{XCircle-UPVnJx4i.js → XCircle-fZmWWsk8.js} +1 -1
  39. package/dist/client/assets/{XClose-pR-QU0OQ.js → XClose-CXQHotFO.js} +1 -1
  40. package/dist/client/assets/{Zap-Cl-JM7N9.js → Zap-DhYBCL8w.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-B1o2Q9OR.js → ZapSquare-Br5HjwCx.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-D8vQ49we.js → ZoomOut-DiWWUJB1.js} +1 -1
  43. package/dist/client/assets/{access-gate-CWPebMdP.js → access-gate-CAbN0Agd.js} +1 -1
  44. package/dist/client/assets/{accordion-aX0NKKKh.js → accordion-CqS3rCYY.js} +1 -1
  45. package/dist/client/assets/add-section-modal-Xtytp9xF.js +1 -0
  46. package/dist/client/assets/agent-capabilities-CH2iEpSS.js +3 -0
  47. package/dist/client/assets/{agent-icon-DT8dQ9tq.js → agent-icon-DyETFFvd.js} +1 -1
  48. package/dist/client/assets/agent-icons-0as3WkuR.js +4 -0
  49. package/dist/client/assets/{agents-list-DDhPNISh.js → agents-list-CDTD2QQV.js} +1 -1
  50. package/dist/client/assets/ai-providers-CmBK6tVa.js +1 -0
  51. package/dist/client/assets/{alert-DyB_hFGI.js → alert-BvaxqAIW.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CSkQIwm8.js → alert-dialog-C_C5CWIi.js} +1 -1
  53. package/dist/client/assets/app-editor-BeU6l_dS.js +1 -0
  54. package/dist/client/assets/{auth-catchall-BUwhIhze.js → auth-catchall-DBSfiKWC.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-CY4CpKKX.js → auth-split-layout-CEZXGHtA.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-5M4PNEWw.js → automation-list-row-s3KQqnbA.js} +1 -1
  57. package/dist/client/assets/automation-runs-RFg521Hi.js +1 -0
  58. package/dist/client/assets/{automations-Cy981ltn.js → automations-C4zBnLxc.js} +1 -1
  59. package/dist/client/assets/{avatar-BHEXMwdE.js → avatar-DI2KQvq0.js} +1 -1
  60. package/dist/client/assets/{badge-Da0IsrqH.js → badge-DqS5s_eb.js} +1 -1
  61. package/dist/client/assets/brand-context-Cg_N2T5g.js +1 -0
  62. package/dist/client/assets/buckets-CGFQSBKU.js +1 -0
  63. package/dist/client/assets/{calendar-BbhbS2FE.js → calendar-CuCfbpTI.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-Dfw4xb8a.js → capability-load-error-DMe1nIxk.js} +1 -1
  65. package/dist/client/assets/{card-BUTabNLA.js → card-C0qmaAJH.js} +1 -1
  66. package/dist/client/assets/chat-context-DEKG6yp4.js +20 -0
  67. package/dist/client/assets/{checkbox--nDaSUZE.js → checkbox-ClCQ7aIa.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-CUSnxWUp.js → cli-auth-success-YaavH1FD.js} +1 -1
  69. package/dist/client/assets/collection-detail-TiY0uzM1.js +1 -0
  70. package/dist/client/assets/{collection-display-button-BfQyXSIv.js → collection-display-button-C6_DwOqJ.js} +1 -1
  71. package/dist/client/assets/{collection-search-LsgoMrVO.js → collection-search-uQS9yrST.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-D3ciIIEv.js → collection-table-wrapper-CTY0qyxJ.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-CQJiHDMR.js → collection-tabs-dTL9gxGq.js} +1 -1
  74. package/dist/client/assets/{collections-C_j8CeI8.js → collections-5f6Mz9W3.js} +1 -1
  75. package/dist/client/assets/{command-BehF6pb8.js → command-DZekvH1G.js} +1 -1
  76. package/dist/client/assets/connect-desktop-dialog-Bi-Fd5NF.js +1 -0
  77. package/dist/client/assets/{connection-card-EXvV7rxl.js → connection-card-CVH5Hy6F.js} +1 -1
  78. package/dist/client/assets/connection-detail-mj8sHl20.js +1 -0
  79. package/dist/client/assets/{connection-form-helpers-DoJomSCQ.js → connection-form-helpers-DFXgro4O.js} +1 -1
  80. package/dist/client/assets/connections-D3Q6bIzz.js +1 -0
  81. package/dist/client/assets/{decopilot-sse-pool-BUhEcft-.js → decopilot-sse-pool-Keqs3wfV.js} +1 -1
  82. package/dist/client/assets/{dialog-Bm1pP7Vu.js → dialog-BE3BWPis.js} +1 -1
  83. package/dist/client/assets/domain-settings-Bq8L3_pf.js +1 -0
  84. package/dist/client/assets/{drawer-B51jkLaX.js → drawer-BSFXr7hp.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-CIu58K9q.js → dropdown-menu-D7fqzmBS.js} +1 -1
  86. package/dist/client/assets/dynamic-plugin-layout-CK3Aqazw.js +1 -0
  87. package/dist/client/assets/{empty-state-1AbmTLd7.js → empty-state-BumLAiri.js} +1 -1
  88. package/dist/client/assets/{empty-state-BfmCVPeb.js → empty-state-Eik7Dn7e.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-LoMqboL3.js → extract-connection-data-BLVQkjXZ.js} +1 -1
  90. package/dist/client/assets/{features-DWJ09Fdz.js → features-BPRhAfHF.js} +1 -1
  91. package/dist/client/assets/file-explorer-D9JJ-ABp.js +2 -0
  92. package/dist/client/assets/{file-type-icon-CX5JEvCQ.js → file-type-icon-I99Qy2JI.js} +1 -1
  93. package/dist/client/assets/{files-QExlaPCQ.js → files-Bo9D7ZcJ.js} +1 -1
  94. package/dist/client/assets/{form-BcPtow5O.js → form-Bn5_lJ6b.js} +1 -1
  95. package/dist/client/assets/general-BKEEaSjd.js +1 -0
  96. package/dist/client/assets/{generate-id-CadHbHqX.js → generate-id-D0pLsbUu.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-B24_pGAu.js → github-repo-picker-CKp3ba8m.js} +1 -1
  98. package/dist/client/assets/header-tab-button-CbbR6n8q.js +5 -0
  99. package/dist/client/assets/{hover-card-DE2_8MLP.js → hover-card-NLGI_Z11.js} +1 -1
  100. package/dist/client/assets/image-field-Baxidks4.js +1 -0
  101. package/dist/client/assets/{index-BflNEs6l.js → index-B-No0lhl.js} +1 -1
  102. package/dist/client/assets/{index-50-dmJFK.js → index-B6YB9tmn.js} +1 -1
  103. package/dist/client/assets/{index-B1bHiM-j.js → index-BE8dVooN.js} +1 -1
  104. package/dist/client/assets/index-BGdRrrmO.js +1 -0
  105. package/dist/client/assets/{index-J2NhKqyZ.js → index-BM5cVzVa.js} +5 -5
  106. package/dist/client/assets/{index-Dr4Isy1j.js → index-BTFwMarm.js} +1 -1
  107. package/dist/client/assets/{index-r7-3fAFf.js → index-Bgv8YQhF.js} +1 -1
  108. package/dist/client/assets/{index-biiHZ5l9.js → index-Bll1AlZi.js} +26 -26
  109. package/dist/client/assets/{index-D6ELOmUq.js → index-Bz4SrPhc.js} +1 -1
  110. package/dist/client/assets/{index-Bo5bzoUm.js → index-CF_awNaT.js} +1 -1
  111. package/dist/client/assets/{index-YdX5UjUB.js → index-ClpGtndr.js} +1 -1
  112. package/dist/client/assets/{index-CZJ35dl3.css → index-DfYyH4IW.css} +1 -1
  113. package/dist/client/assets/{index-CR_LeyNj.js → index-DxNfIzhJ.js} +1 -1
  114. package/dist/client/assets/{index-CHdFXpqc.js → index-YVfCniqO.js} +1 -1
  115. package/dist/client/assets/index-apuzt69p.js +310 -0
  116. package/dist/client/assets/index-bSiT8Vjd.js +1 -0
  117. package/dist/client/assets/{index-redirect-pPYMz5D6.js → index-redirect-DjHBgih0.js} +1 -1
  118. package/dist/client/assets/{infiniteQueryObserver-B0VBGXv5.js → infiniteQueryObserver-B-dakPwk.js} +1 -1
  119. package/dist/client/assets/{input-5PMMNPU9.js → input-CMMOM0dD.js} +1 -1
  120. package/dist/client/assets/{integration-icon-Dy-a3x5R.js → integration-icon-DblM7d27.js} +1 -1
  121. package/dist/client/assets/{label-CcC4_aKf.js → label-cKO6vIjy.js} +1 -1
  122. package/dist/client/assets/{layout-CbTbCjmA.js → layout-QBDJ_skY.js} +1 -1
  123. package/dist/client/assets/{login-Dn4EF5EK.js → login-BAGu_SJp.js} +1 -1
  124. package/dist/client/assets/members-C7uPVWw3.js +3 -0
  125. package/dist/client/assets/{monaco-editor-CJVi8Ty8.js → monaco-editor-BD33gVrt.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-BAplEVfE.js → monitoring-stats-row-Bvt3RsAI.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-D5XAAL8p.js → oauth-callback-DvAeoSNI.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-tGQCB63I.js → oauth-callback-ai-provider-BuhDe7NV.js} +1 -1
  129. package/dist/client/assets/{onboarding-CgvYwT2C.js → onboarding-DiyHWSGI.js} +1 -1
  130. package/dist/client/assets/{org-install-CV5qvXsE.js → org-install-B1rM2juw.js} +1 -1
  131. package/dist/client/assets/{org-layout-BFil8fwL.js → org-layout-Ck7vt_mB.js} +1 -1
  132. package/dist/client/assets/org-plugin-layout-Cc5oLilE.js +1 -0
  133. package/dist/client/assets/{page-seo-form-Bbna5w2y.js → page-seo-form-CTM0Xp8N.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-nSdCZ-KL.js +1 -0
  135. package/dist/client/assets/pair-BidrJ4sX.js +39 -0
  136. package/dist/client/assets/{plugin-empty-state-DM8dR2Wk.js → plugin-empty-state-CERz9K1r.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CaWKfaZE.js → plugin-header-CISIxXxk.js} +1 -1
  138. package/dist/client/assets/plugin-layout-UkXtyZlZ.js +1 -0
  139. package/dist/client/assets/{popover-Cvcd3A1d.js → popover-CNh3Ozeq.js} +1 -1
  140. package/dist/client/assets/{post-editor-CM-ESdP7.js → post-editor-C3YLiXXM.js} +3 -3
  141. package/dist/client/assets/{primitives-DWXKnou4.js → primitives-Y0YbWOD4.js} +1 -1
  142. package/dist/client/assets/{profile-DmCC3zYK.js → profile-o29P_MC2.js} +1 -1
  143. package/dist/client/assets/project-app-view-DHVFZPIZ.js +1 -0
  144. package/dist/client/assets/record-editor-DtXRmftd.js +1 -0
  145. package/dist/client/assets/registry-jlRh9TsH.js +2 -0
  146. package/dist/client/assets/registry-layout-zUgwlIce.js +27 -0
  147. package/dist/client/assets/{require-capability-DVI2cKO3.js → require-capability-CQkA6hP5.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-zYH6NIDF.js → required-auth-layout-Sv9_QEzP.js} +1 -1
  149. package/dist/client/assets/{reset-password-DXXx8e6Q.js → reset-password-C1pH8pyn.js} +1 -1
  150. package/dist/client/assets/{resizable-BbbLszRZ.js → resizable-BTpQlX-z.js} +1 -1
  151. package/dist/client/assets/{roles-vHYrQg5g.js → roles-CL5RMNps.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-JBVOc1Wy.js +1 -0
  153. package/dist/client/assets/{save-status-pJVz5vCQ.js → save-status-Dfy3Cw0L.js} +1 -1
  154. package/dist/client/assets/{schema-form-nZH-67HX.js → schema-form-BLq0KNxn.js} +1 -1
  155. package/dist/client/assets/{scroll-area-BqOijBAI.js → scroll-area-SRbC7c25.js} +1 -1
  156. package/dist/client/assets/{search-input-BgGthWir.js → search-input-JFEU6QlH.js} +1 -1
  157. package/dist/client/assets/secrets-DvkQvbwt.js +1 -0
  158. package/dist/client/assets/sections-editor-HXjdp6eB.js +2 -0
  159. package/dist/client/assets/{select-CNSUv3cw.js → select-CTk6Rsq0.js} +1 -1
  160. package/dist/client/assets/{select-model-0CGh6cKF.js → select-model-D2KMm6n2.js} +1 -1
  161. package/dist/client/assets/seo-editor-ifMY-Fw8.js +1 -0
  162. package/dist/client/assets/{settings-layout-DRYgevr6.js → settings-layout-BCPOwwNR.js} +1 -1
  163. package/dist/client/assets/{settings-section-V9kb8x32.js → settings-section-CcspUfab.js} +1 -1
  164. package/dist/client/assets/{sheet-D99KevZC.js → sheet-DokH5LKH.js} +1 -1
  165. package/dist/client/assets/{shell-controls-DSSWZ7Ia.js → shell-controls-rZZhpuW4.js} +1 -1
  166. package/dist/client/assets/{shell-layout-4LsIVsl3.js → shell-layout-DO1LZiwY.js} +1 -1
  167. package/dist/client/assets/shell-route-loading-DI9OtFHe.js +1 -0
  168. package/dist/client/assets/{sidebar-CPZXU-2w.js → sidebar-hk7mPADd.js} +1 -1
  169. package/dist/client/assets/{skeleton--DN75sg7.js → skeleton-CxMjy9Kg.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-g7bq1nDZ.js → sortable.esm-BnSJaRIy.js} +1 -1
  171. package/dist/client/assets/{spinner-DJD6-9r-.js → spinner-Dstb6AhM.js} +1 -1
  172. package/dist/client/assets/sso-lfWsp7Wf.js +1 -0
  173. package/dist/client/assets/{store-DTK5DubB.js → store-CHpKgn9g.js} +1 -1
  174. package/dist/client/assets/store-registry-D9xAoVoW.js +2 -0
  175. package/dist/client/assets/studio-tools-I8Y7AvNq.js +1 -0
  176. package/dist/client/assets/{switch-D6SWnoi2.js → switch-Ds4XHhlB.js} +1 -1
  177. package/dist/client/assets/{tab-id-D4SJwEQy.js → tab-id-D_jK7L5o.js} +2 -2
  178. package/dist/client/assets/{table-Cx3PhNth.js → table-BvWfaT33.js} +1 -1
  179. package/dist/client/assets/{tabs-DCDCb9Pz.js → tabs-2_PrfGe1.js} +1 -1
  180. package/dist/client/assets/{task-status-P3BULAyA.js → task-status-CyBgq1B0.js} +1 -1
  181. package/dist/client/assets/{textarea-QEULyLXh.js → textarea-D7mZzw_Y.js} +1 -1
  182. package/dist/client/assets/{toggle-group-DhVqXGfs.js → toggle-group-CcV2qfqh.js} +1 -1
  183. package/dist/client/assets/{toolbar-BsB4Mvyv.js → toolbar-Vk0X9zFW.js} +1 -1
  184. package/dist/client/assets/{tools-list-Ch5RlbiL.js → tools-list-DZyHvyxj.js} +1 -1
  185. package/dist/client/assets/{tooltip-bsrBmmjV.js → tooltip-B2vnmSMM.js} +1 -1
  186. package/dist/client/assets/{types-jBdXInU0.js → types-DsBzghfJ.js} +1 -1
  187. package/dist/client/assets/use-ai-providers-BDbyWdvc.js +1 -0
  188. package/dist/client/assets/{use-automations-Db8x6SNU.js → use-automations-DjpksCFK.js} +1 -1
  189. package/dist/client/assets/{use-capability-BPM45mbW.js → use-capability-cYRWRLhr.js} +1 -1
  190. package/dist/client/assets/{use-collections-B5Jh_wGd.js → use-collections-DI2EpqEk.js} +1 -1
  191. package/dist/client/assets/{use-connection-DyJtuHQI.js → use-connection-Cam2HslE.js} +1 -1
  192. package/dist/client/assets/{use-copy-P6tx-uOp.js → use-copy-CyNGh3eK.js} +1 -1
  193. package/dist/client/assets/{use-create-virtual-mcp-CWYOy45e.js → use-create-virtual-mcp-TPoPQ6hG.js} +1 -1
  194. package/dist/client/assets/{use-debounced-autosave-ClLbciGl.js → use-debounced-autosave-b8Qk2OvK.js} +1 -1
  195. package/dist/client/assets/use-delete-connection-DXpw9Kqu.js +1 -0
  196. package/dist/client/assets/use-file-configs-J3tDrhRd.js +1 -0
  197. package/dist/client/assets/{use-infinite-scroll-xQQ6lYk4.js → use-infinite-scroll-CF4jvsDL.js} +1 -1
  198. package/dist/client/assets/{use-list-state-BZmeG7gi.js → use-list-state-C3OBf8IN.js} +1 -1
  199. package/dist/client/assets/{use-mcp-client-CWFUu1lY.js → use-mcp-client-Des-fSV9.js} +2 -2
  200. package/dist/client/assets/{use-mcp-prompts-B5RhBVzg.js → use-mcp-prompts-d7xtcVsP.js} +1 -1
  201. package/dist/client/assets/{use-mcp-tools-DePRGZE5.js → use-mcp-tools-DVBLMBo3.js} +1 -1
  202. package/dist/client/assets/{use-members-Cw70r_Wh.js → use-members-CTowYB9Z.js} +1 -1
  203. package/dist/client/assets/{use-navigate-to-agent-CdsMYUzL.js → use-navigate-to-agent-TzPRxzJx.js} +1 -1
  204. package/dist/client/assets/{use-org-auth-client--i_Sx92M.js → use-org-auth-client-uSzlmndB.js} +1 -1
  205. package/dist/client/assets/{use-org-sso-C1cJTBIx.js → use-org-sso-Bez1Sajf.js} +1 -1
  206. package/dist/client/assets/{use-organization-roles-ATKYiNpl.js → use-organization-roles-DfnjRa-5.js} +1 -1
  207. package/dist/client/assets/{use-organization-settings-Izqk1Gkk.js → use-organization-settings-B5dKExdR.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-C-WVKjSU.js → use-registry-connections-CWiPZtVM.js} +1 -1
  209. package/dist/client/assets/use-secrets-CrukgaJs.js +1 -0
  210. package/dist/client/assets/{use-status-sounds-BJ_LqdGJ.js → use-status-sounds-B1WepgCG.js} +1 -1
  211. package/dist/client/assets/{use-view-mode-CbT8E3wV.js → use-view-mode-q_aFx9Fj.js} +1 -1
  212. package/dist/client/assets/{use-virtual-mcp-0jbEmvOc.js → use-virtual-mcp-71PpEQrs.js} +1 -1
  213. package/dist/client/assets/useInfiniteQuery-Dl7i7ptk.js +1 -0
  214. package/dist/client/assets/{useRouterState-Dm0UHjU4.js → useRouterState-l6E4h2DF.js} +1 -1
  215. package/dist/client/assets/useSuspenseInfiniteQuery-CmT2FyND.js +1 -0
  216. package/dist/client/assets/user-ZvpM4E3a.js +1 -0
  217. package/dist/client/assets/{view-mode-toggle-G0qNMbJ1.js → view-mode-toggle-oQJDkJzK.js} +1 -1
  218. package/dist/client/assets/workflow-detail-Ba-EIKe1.js +1 -0
  219. package/dist/client/assets/workflow-i0CMnn6N.js +1 -0
  220. package/dist/client/index.html +2 -2
  221. package/dist/server/cli.js +439 -419
  222. package/dist/server/migrate.js +95 -95
  223. package/dist/server/server.js +287 -282
  224. package/package.json +1 -1
  225. package/dist/client/assets/add-section-modal-DbuGc2qc.js +0 -1
  226. package/dist/client/assets/agent-capabilities-BJLQSkAN.js +0 -3
  227. package/dist/client/assets/agent-icons-DRrDyR7j.js +0 -4
  228. package/dist/client/assets/ai-providers-GxPLAPId.js +0 -1
  229. package/dist/client/assets/app-editor-BsxVHV86.js +0 -1
  230. package/dist/client/assets/automation-runs-BJTRztep.js +0 -1
  231. package/dist/client/assets/brand-context-DTmvDRqf.js +0 -1
  232. package/dist/client/assets/buckets-Cv3AB_TT.js +0 -1
  233. package/dist/client/assets/chat-context-Bu6qpu9K.js +0 -20
  234. package/dist/client/assets/collection-detail-DHxXW6T4.js +0 -1
  235. package/dist/client/assets/connect-desktop-dialog-DPqrgnkS.js +0 -1
  236. package/dist/client/assets/connection-detail-58UbdFd3.js +0 -1
  237. package/dist/client/assets/connections-BMZIGugH.js +0 -1
  238. package/dist/client/assets/domain-settings-DHsRsnmX.js +0 -1
  239. package/dist/client/assets/dynamic-plugin-layout-DWE13BKk.js +0 -1
  240. package/dist/client/assets/file-explorer-Dmpsw-4-.js +0 -2
  241. package/dist/client/assets/general-CLesrOe8.js +0 -1
  242. package/dist/client/assets/header-tab-button-DSX6YPkf.js +0 -5
  243. package/dist/client/assets/image-field-D00iYa4G.js +0 -1
  244. package/dist/client/assets/index-BZvxagUr.js +0 -310
  245. package/dist/client/assets/index-CCs3Chg3.js +0 -1
  246. package/dist/client/assets/index-Db3P8pHg.js +0 -1
  247. package/dist/client/assets/members-BwcNzXwU.js +0 -3
  248. package/dist/client/assets/org-plugin-layout-DyCflrr1.js +0 -1
  249. package/dist/client/assets/page-seo-sheet-D9M3CoUb.js +0 -1
  250. package/dist/client/assets/pair-Ba1UoSSJ.js +0 -39
  251. package/dist/client/assets/plugin-layout-DrVKV-lp.js +0 -1
  252. package/dist/client/assets/project-app-view-C9azYjZP.js +0 -1
  253. package/dist/client/assets/record-editor-DJucp492.js +0 -1
  254. package/dist/client/assets/registry-hKns5OCc.js +0 -2
  255. package/dist/client/assets/registry-layout-DPaKDLDg.js +0 -27
  256. package/dist/client/assets/save-referenced-block-q2CPWVkl.js +0 -1
  257. package/dist/client/assets/secrets-YkTDT7yT.js +0 -1
  258. package/dist/client/assets/sections-editor-CSz4pxMw.js +0 -2
  259. package/dist/client/assets/seo-editor-CspZxazh.js +0 -1
  260. package/dist/client/assets/shell-route-loading-5KSwc3hj.js +0 -1
  261. package/dist/client/assets/sso-D04DjSnZ.js +0 -1
  262. package/dist/client/assets/store-registry-nABlp_7k.js +0 -2
  263. package/dist/client/assets/unwrap-tool-result-BYXdCQMg.js +0 -1
  264. package/dist/client/assets/use-ai-providers-v0sCRzMO.js +0 -1
  265. package/dist/client/assets/use-delete-connection-C60uGs0b.js +0 -1
  266. package/dist/client/assets/use-file-configs-CC8ghNUa.js +0 -1
  267. package/dist/client/assets/use-secrets-BpdIBEe6.js +0 -1
  268. package/dist/client/assets/useInfiniteQuery-BGg7INCQ.js +0 -1
  269. package/dist/client/assets/useSuspenseInfiniteQuery-B4dQiTEq.js +0 -1
  270. package/dist/client/assets/user-DRDdFgUw.js +0 -1
  271. package/dist/client/assets/workflow-D1PUPL3K.js +0 -1
  272. package/dist/client/assets/workflow-detail-CRUxUbKb.js +0 -1
@@ -0,0 +1,4 @@
1
+ import{r as P,aU as Qe,e as W,j as s,T as Te,W as re,q as le,G as me,I as ze,H as Le,a as de,K as te,o as Q,B as ee,t as X,u as Je,c as ue,n as Ze,f as et,E as tt,v as st}from"./index-Bll1AlZi.js";import{C as it}from"./checkbox-ClCQ7aIa.js";import{I as ne}from"./input-CMMOM0dD.js";import{d as nt,S as lt,a as ot,b as rt,c as at}from"./select-CTk6Rsq0.js";import{S as q}from"./skeleton-CxMjy9Kg.js";import{a as Re,i as Pe,b as ct,s as dt}from"./RefreshCcw01-Ct_5xx8z.js";import{b as ut,a as mt,c as ht,d as ft}from"./Tool01-CSM07Bd3.js";import{i as pt}from"./Key01-u8nOkLN5.js";import{i as $e}from"./SearchMd-DXp3IUvU.js";import{a as xt}from"./Settings02-DttqwSGe.js";import{c as he,u as gt,b as vt}from"./use-ai-providers-BDbyWdvc.js";import{u as bt,c as yt}from"./chat-context-DEKG6yp4.js";import{g as fe}from"./ai-providers-logos-DD3qZ33J.js";import{i as jt}from"./Monitor01-BBuvzSNf.js";import{i as St}from"./AlertCircle-Dk6vk346.js";import{d as Fe,D as Nt,a as kt,b as wt,c as _t,e as Ct}from"./dialog-BE3BWPis.js";import{S as be}from"./spinner-Dstb6AhM.js";import{a as pe,u as xe}from"./use-mcp-client-Des-fSV9.js";import{i as It}from"./ChevronRight-TZkuqway.js";import{A as Mt}from"./avatar-DI2KQvq0.js";import{S as ye,a as je,b as Ke}from"./settings-section-CcspUfab.js";import{s as De}from"./Eye-DjmQZ2p3.js";import{u as Et}from"./studio-tools-I8Y7AvNq.js";import{C as Ot}from"./connect-desktop-dialog-Bi-Fd5NF.js";import{t as Se}from"./ChevronDown-DXk0XLak.js";import{t as At}from"./Stars01-U1zM7H-d.js";function ie(i,e,t){let n=t.initialDeps??[],l,o=!0;function r(){var a,c,d;let u;t.key&&((a=t.debug)!=null&&a.call(t))&&(u=Date.now());const p=i();if(!(p.length!==n.length||p.some((v,g)=>n[g]!==v)))return l;n=p;let h;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(h=Date.now()),l=e(...p),t.key&&((d=t.debug)!=null&&d.call(t))){const v=Math.round((Date.now()-u)*100)/100,g=Math.round((Date.now()-h)*100)/100,S=g/16,j=(w,_)=>{for(w=String(w);w.length<_;)w=" "+w;return w};console.info(`%c⏱ ${j(g,5)} /${j(v,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(l),o=!1,l}return r.updateDeps=a=>{n=a},r}function Ne(i,e){if(i===void 0)throw new Error("Unexpected undefined");return i}const Tt=(i,e)=>Math.abs(i-e)<1.01,zt=(i,e,t)=>{let n;return function(...l){i.clearTimeout(n),n=i.setTimeout(()=>e.apply(this,l),t)}},ke=i=>{const{offsetWidth:e,offsetHeight:t}=i;return{width:e,height:t}},Lt=i=>i,Rt=i=>{const e=Math.max(i.startIndex-i.overscan,0),t=Math.min(i.endIndex+i.overscan,i.count-1),n=[];for(let l=e;l<=t;l++)n.push(l);return n},Pt=(i,e)=>{const t=i.scrollElement;if(!t)return;const n=i.targetWindow;if(!n)return;const l=r=>{const{width:a,height:c}=r;e({width:Math.round(a),height:Math.round(c)})};if(l(ke(t)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){l({width:d.inlineSize,height:d.blockSize});return}}l(ke(t))};i.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},we={passive:!0},_e=typeof window>"u"?!0:"onscrollend"in window,$t=(i,e)=>{const t=i.scrollElement;if(!t)return;const n=i.targetWindow;if(!n)return;let l=0;const o=i.options.useScrollendEvent&&_e?()=>{}:zt(n,()=>{e(l,!1)},i.options.isScrollingResetDelay),r=u=>()=>{const{horizontal:p,isRtl:f}=i.options;l=p?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(l,u)},a=r(!0),c=r(!1);t.addEventListener("scroll",a,we);const d=i.options.useScrollendEvent&&_e;return d&&t.addEventListener("scrollend",c,we),()=>{t.removeEventListener("scroll",a),d&&t.removeEventListener("scrollend",c)}},Ft=(i,e,t)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return i[t.options.horizontal?"offsetWidth":"offsetHeight"]},Kt=(i,{adjustments:e=0,behavior:t},n)=>{var l,o;const r=i+e;(o=(l=n.scrollElement)==null?void 0:l.scrollTo)==null||o.call(l,{[n.options.horizontal?"left":"top"]:r,behavior:t})};class Dt{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,l;return((l=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:l.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(l=>{l.forEach(o=>{const r=()=>{const a=o.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var l;(l=n())==null||l.disconnect(),t=null},observe:l=>{var o;return(o=n())==null?void 0:o.observe(l,{box:"border-box"})},unobserve:l=>{var o;return(o=n())==null?void 0:o.unobserve(l)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,l])=>{typeof l>"u"&&delete t[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Lt,rangeExtractor:Rt,onChange:()=>{},measureElement:Ft,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var n,l;(l=(n=this.options).onChange)==null||l.call(n,this,t)},this.maybeNotify=ie(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const l=new Map,o=new Map;for(let r=n-1;r>=0;r--){const a=t[r];if(l.has(a.lane))continue;const c=o.get(a.lane);if(c==null||a.end>c.end?o.set(a.lane,a):a.end<c.end&&l.set(a.lane,!0),l.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=ie(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,n,l,o,r,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:l,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=ie(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:l,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:c},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const h of this.laneAssignments.keys())h>=t&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const p=this.measurementsCache.slice(0,u),f=new Array(a).fill(void 0);for(let h=0;h<u;h++){const v=p[h];v&&(f[v.lane]=h)}for(let h=u;h<t;h++){const v=o(h),g=this.laneAssignments.get(h);let S,j;const w=c==="estimate"||d.has(v);if(g!==void 0&&this.options.lanes>1){S=g;const x=f[S],N=x!==void 0?p[x]:void 0;j=N?N.end+this.options.gap:n+l}else{const x=this.options.lanes===1?p[h-1]:this.getFurthestMeasurement(p,h);j=x?x.end+this.options.gap:n+l,S=x?x.lane:h%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(h,S)}const _=d.get(v),k=typeof _=="number"?_:this.options.estimateSize(h),T=j+k;p[h]={index:h,start:j,size:k,end:T,key:v,lane:S},f[S]=h}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ie(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,l,o)=>this.range=t.length>0&&n>0?Ut({measurements:t,outerSize:n,scrollOffset:l,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ie(()=>{let t=null,n=null;const l=this.calculateRange();return l&&(t=l.startIndex,n=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,l,o,r)=>o===null||r===null?[]:t({startIndex:o,endIndex:r,overscan:n,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,l=t.getAttribute(n);return l?parseInt(l,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(l!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,l-o),a=Math.min(this.options.count-1,l+o);return t>=r&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const n=this.indexFromElement(t),l=this.options.getItemKey(n),o=this.elementsCache.get(l);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(l,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var l;const o=this.measurementsCache[t];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=n-r;a!==0&&(((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.getVirtualItems=ie(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const l=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],c=n[a];l.push(c)}return l},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return Ne(n[Ue(0,n.length-1,l=>Ne(n[l]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,l=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=t>=r+o?"end":"start"),n==="center"?t+=(l-o)/2:n==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(n==="auto")if(r.end>=o+l-this.options.scrollPaddingEnd)n="end";else if(r.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:l="auto"}={})=>{const o=this.getOffsetForAlignment(t,n),r=this.now();this.scrollState={index:null,align:n,behavior:l,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:l="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,n);if(!o)return;const[r,a]=o,c=this.now();this.scrollState={index:t,align:a,behavior:l,startedAt:c,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const l=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let l;if(n.length===0)l=this.options.paddingStart;else if(this.options.lanes===1)l=((t=n[n.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&o.some(a=>a===null);){const a=n[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}l=Math.max(...o.filter(a=>a!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:l})=>{this.options.scrollToFn(t,{behavior:l,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=n?n[0]:this.scrollState.lastTargetOffset,o=1,r=l!==this.scrollState.lastTargetOffset;if(!r&&Tt(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=l,this.scrollState.behavior="auto",this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Ue=(i,e,t,n)=>{for(;i<=e;){const l=(i+e)/2|0,o=t(l);if(o<n)i=l+1;else if(o>n)e=l-1;else return l}return i>0?i-1:0};function Ut({measurements:i,outerSize:e,scrollOffset:t,lanes:n}){const l=i.length-1,o=c=>i[c].start;if(i.length<=n)return{startIndex:0,endIndex:l};let r=Ue(0,l,o,t),a=r;if(n===1)for(;a<l&&i[a].end<t+e;)a++;else if(n>1){const c=Array(n).fill(0);for(;a<l&&c.some(u=>u<t+e);){const u=i[a];c[u.lane]=u.end,a++}const d=Array(n).fill(t+e);for(;r>=0&&d.some(u=>u>=t);){const u=i[r];d[u.lane]=u.start,r--}r=Math.max(0,r-r%n),a=Math.min(l,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Ce=typeof document<"u"?P.useLayoutEffect:P.useEffect;function Bt({useFlushSync:i=!0,...e}){const t=P.useReducer(()=>({}),{})[1],n={...e,onChange:(o,r)=>{var a;i&&r?Qe.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,r)}},[l]=P.useState(()=>new Dt(n));return l.setOptions(n),Ce(()=>l._didMount(),[]),Ce(()=>l._willUpdate()),l}function Wt(i){return Bt({observeElementRect:Pt,observeElementOffset:$t,scrollToFn:Kt,...i})}const ae=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function Ie(i){if(i)return ae.find(e=>e.id===i)}const Me=4;function oe(i){const e=W.c(8),{logo:t,name:n,description:l,onClick:o}=i;let r;e[0]!==t||e[1]!==n?(r=t?s.jsx("img",{src:t,alt:n,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Mt,{fallback:n.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=n,e[2]=r):r=e[2];let a;return e[3]!==l||e[4]!==n||e[5]!==o||e[6]!==r?(a=s.jsx(Ke,{onClick:o,icon:r,title:n,description:l}),e[3]=l,e[4]=n,e[5]=o,e[6]=r,e[7]=a):a=e[7],a}function Be(i){const e=W.c(32),{providers:t,onSelect:n,onShowAll:l}=i;let o;e[0]!==t?(o=t.find(Yt),e[0]=t,e[1]=o):o=e[1];const r=o;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={openrouter:0,anthropic:1,google:2},e[2]=a):a=e[2];const c=a;let d;if(e[3]!==n||e[4]!==t){let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=(b,A)=>{const M=c[b.id]??Number.MAX_SAFE_INTEGER,O=c[A.id]??Number.MAX_SAFE_INTEGER;return M-O},e[6]=_):_=e[6];const k=t.filter(Gt).sort(_);let T;e[7]!==t?(T=t.find(qt),e[7]=t,e[8]=T):T=e[8];const x=T;let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=ae.find(Ht),e[9]=N):N=e[9];const C=N;let I;e[10]!==n?(I=b=>s.jsx(oe,{logo:b.logo,name:b.name,description:b.description,onClick:()=>n({kind:"provider",provider:b})},b.id),e[10]=n,e[11]=I):I=e[11];let m,y;e[12]!==n||e[13]!==x?(m=x&&C?[s.jsx(oe,{logo:C.logo,name:C.name,description:C.description,onClick:()=>n({kind:"openai-compatible",provider:x,preset:C})},C.id)]:[],y=x?[...ae.filter(Vt).map(b=>s.jsx(oe,{logo:b.logo,name:b.name,description:b.description,onClick:()=>n({kind:"openai-compatible",provider:x,preset:b})},b.id)),s.jsx(oe,{logo:x.logo,name:"Custom OpenAI-compatible",description:"Bring your own model server (advanced)",onClick:()=>n({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[12]=n,e[13]=x,e[14]=m,e[15]=y):(m=e[14],y=e[15]),d=[...k.map(I),...m,...y],e[3]=n,e[4]=t,e[5]=d}else d=e[5];const u=d,p=u.length-Me,f=!!l&&p>0;let h;e[16]!==u||e[17]!==f?(h=f?u.slice(0,Me):u,e[16]=u,e[17]=f,e[18]=h):h=e[18];const v=h;let g;e[19]!==r||e[20]!==n?(g=r&&s.jsx(ye,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:"Recommended — 100+ models, pay as you go"}),s.jsx(je,{className:"relative",children:s.jsx(oe,{logo:r.logo,name:r.name,description:r.description,onClick:()=>n({kind:"provider",provider:r})})})]})}),e[19]=r,e[20]=n,e[21]=g):g=e[21];let S;e[22]!==p||e[23]!==l||e[24]!==f?(S=f&&s.jsx(Ke,{onClick:l,title:`${p} more provider${p===1?"":"s"}`,action:s.jsx(It,{size:16,className:"text-muted-foreground"})}),e[22]=p,e[23]=l,e[24]=f,e[25]=S):S=e[25];let j;e[26]!==S||e[27]!==v?(j=s.jsx(ye,{children:s.jsxs(je,{children:[v,S]})}),e[26]=S,e[27]=v,e[28]=j):j=e[28];let w;return e[29]!==g||e[30]!==j?(w=s.jsxs("div",{className:"flex flex-col gap-6",children:[g,j]}),e[29]=g,e[30]=j,e[31]=w):w=e[31],w}function Vt(i){return i.id!=="openai"}function Ht(i){return i.id==="openai"}function qt(i){return i.id==="openai-compatible"}function Gt(i){return i.id!=="deco"&&i.id!=="openai-compatible"}function Yt(i){return i.id==="deco"}const Xt=Te({label:re().optional(),apiKey:re().min(1,"API key is required")});function Qt(i){const e=W.c(62),{providerId:t,onCancel:n,onSuccess:l}=i,{org:o}=le();let r;e[0]!==o.id||e[1]!==o.slug?(r={connectionId:pe,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=r):r=e[2];const a=xe(r),c=me(),[d,u]=P.useState(!1);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={resolver:ze(Xt),defaultValues:{label:"",apiKey:""}},e[3]=p):p=e[3];const{register:f,handleSubmit:h,formState:v}=Le(p),{errors:g}=v;let S;e[4]!==a||e[5]!==t?(S=async H=>{await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:t,label:H.label||"Personal key",apiKey:H.apiKey}})},e[4]=a,e[5]=t,e[6]=S):S=e[6];let j;e[7]!==l||e[8]!==o.id||e[9]!==c?(j=()=>{c.invalidateQueries({queryKey:te.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:te.aiProviders(o.id)}),Q.success("Key saved successfully"),l()},e[7]=l,e[8]=o.id,e[9]=c,e[10]=j):j=e[10];let w;e[11]!==S||e[12]!==j?(w={mutationFn:S,onSuccess:j,onError:Jt},e[11]=S,e[12]=j,e[13]=w):w=e[13];const{mutate:_,isPending:k,error:T}=de(w);let x;e[14]!==_?(x=H=>_(H),e[14]=_,e[15]=x):x=e[15];let N;e[16]!==h||e[17]!==x?(N=h(x),e[16]=h,e[17]=x,e[18]=N):N=e[18];let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[19]=C):C=e[19];let I;e[20]!==f?(I=f("label"),e[20]=f,e[21]=I):I=e[21];let m;e[22]!==I?(m=s.jsxs("div",{className:"space-y-1",children:[C,s.jsx(ne,{placeholder:"e.g. Personal key",...I,className:"h-8 text-sm"})]}),e[22]=I,e[23]=m):m=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[24]=y):y=e[24];const b=d?"text":"password";let A;e[25]!==f?(A=f("apiKey"),e[25]=f,e[26]=A):A=e[26];let M;e[27]!==b||e[28]!==A?(M=s.jsx(ne,{type:b,placeholder:"sk-...",...A,className:"ph-no-capture h-8 text-sm pr-8"}),e[27]=b,e[28]=A,e[29]=M):M=e[29];let O;e[30]!==d?(O=()=>u(!d),e[30]=d,e[31]=O):O=e[31];let z;e[32]!==d?(z=d?s.jsx(Re,{size:14}):s.jsx(De,{size:14}),e[32]=d,e[33]=z):z=e[33];let F;e[34]!==O||e[35]!==z?(F=s.jsx("button",{type:"button",onClick:O,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:z}),e[34]=O,e[35]=z,e[36]=F):F=e[36];let B;e[37]!==M||e[38]!==F?(B=s.jsxs("div",{className:"relative",children:[M,F]}),e[37]=M,e[38]=F,e[39]=B):B=e[39];let L;e[40]!==g.apiKey?(L=g.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:g.apiKey.message}),e[40]=g.apiKey,e[41]=L):L=e[41];let K;e[42]!==B||e[43]!==L?(K=s.jsxs("div",{className:"space-y-1",children:[y,B,L]}),e[42]=B,e[43]=L,e[44]=K):K=e[44];let $;e[45]!==T?($=T&&s.jsx("p",{className:"text-xs text-destructive",children:T.message}),e[45]=T,e[46]=$):$=e[46];let D;e[47]!==k||e[48]!==n?(D=s.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:k,children:"Cancel"}),e[47]=k,e[48]=n,e[49]=D):D=e[49];const V=k?"Saving...":"Save Key";let R;e[50]!==k||e[51]!==V?(R=s.jsx(ee,{type:"submit",size:"sm",disabled:k,children:V}),e[50]=k,e[51]=V,e[52]=R):R=e[52];let U;e[53]!==D||e[54]!==R?(U=s.jsxs(Fe,{children:[D,R]}),e[53]=D,e[54]=R,e[55]=U):U=e[55];let E;return e[56]!==m||e[57]!==K||e[58]!==$||e[59]!==U||e[60]!==N?(E=s.jsxs("form",{onSubmit:N,className:"space-y-3",children:[m,K,$,U]}),e[56]=m,e[57]=K,e[58]=$,e[59]=U,e[60]=N,e[61]=E):E=e[61],E}function Jt(i){Q.error(`Failed to save key: ${i.message}`)}const Zt=Te({label:re().optional(),baseUrl:re().min(1,"Base URL is required"),apiKey:re().optional()});function es(i){const e=W.c(73),{preset:t,onCancel:n,onSuccess:l}=i,{org:o}=le();let r;e[0]!==o.id||e[1]!==o.slug?(r={connectionId:pe,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=r):r=e[2];const a=xe(r),c=me(),[d,u]=P.useState(!1);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=ze(Zt),e[3]=p):p=e[3];const f=t?.defaultBaseUrl??"";let h;e[4]!==f?(h={resolver:p,defaultValues:{label:"",baseUrl:f,apiKey:""}},e[4]=f,e[5]=h):h=e[5];const{register:v,handleSubmit:g,formState:S}=Le(h),{errors:j}=S;let w;e[6]!==a||e[7]!==t?(w=async se=>{const Xe=JSON.stringify({baseUrl:se.baseUrl,apiKey:se.apiKey||""});await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:se.label||t?.name||se.baseUrl,apiKey:Xe,...t?{presetId:t.id}:{}}})},e[6]=a,e[7]=t,e[8]=w):w=e[8];let _;e[9]!==l||e[10]!==o.id||e[11]!==c?(_=()=>{c.invalidateQueries({queryKey:te.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:te.aiProviders(o.id)}),Q.success("Connection saved successfully"),l()},e[9]=l,e[10]=o.id,e[11]=c,e[12]=_):_=e[12];let k;e[13]!==w||e[14]!==_?(k={mutationFn:w,onSuccess:_,onError:ts},e[13]=w,e[14]=_,e[15]=k):k=e[15];const{mutate:T,isPending:x,error:N}=de(k),C=t?`e.g. ${t.name} prod, ${t.name} dev`:"e.g. My OpenAI-compatible server",I=t?.baseUrlPlaceholder??"http://localhost:4000/v1";let m;e[16]!==T?(m=se=>T(se),e[16]=T,e[17]=m):m=e[17];let y;e[18]!==g||e[19]!==m?(y=g(m),e[18]=g,e[19]=m,e[20]=y):y=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[21]=b):b=e[21];let A;e[22]!==v?(A=v("label"),e[22]=v,e[23]=A):A=e[23];let M;e[24]!==C||e[25]!==A?(M=s.jsxs("div",{className:"space-y-1",children:[b,s.jsx(ne,{placeholder:C,...A,className:"h-8 text-sm"})]}),e[24]=C,e[25]=A,e[26]=M):M=e[26];let O;e[27]!==I||e[28]!==j||e[29]!==t?.defaultBaseUrl||e[30]!==v?(O=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...v("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ne,{type:"url",placeholder:I,...v("baseUrl"),className:"h-8 text-sm"}),j.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:j.baseUrl.message})]}),e[27]=I,e[28]=j,e[29]=t?.defaultBaseUrl,e[30]=v,e[31]=O):O=e[31];const z=t?.apiKeyRecommended?"recommended":"optional";let F;e[32]!==z?(F=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key"," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",z,")"]})]}),e[32]=z,e[33]=F):F=e[33];const B=d?"text":"password";let L;e[34]!==v?(L=v("apiKey"),e[34]=v,e[35]=L):L=e[35];let K;e[36]!==B||e[37]!==L?(K=s.jsx(ne,{type:B,placeholder:"sk-...",...L,className:"ph-no-capture h-8 text-sm pr-8"}),e[36]=B,e[37]=L,e[38]=K):K=e[38];let $;e[39]!==d?($=()=>u(!d),e[39]=d,e[40]=$):$=e[40];let D;e[41]!==d?(D=d?s.jsx(Re,{size:14}):s.jsx(De,{size:14}),e[41]=d,e[42]=D):D=e[42];let V;e[43]!==$||e[44]!==D?(V=s.jsx("button",{type:"button",onClick:$,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:D}),e[43]=$,e[44]=D,e[45]=V):V=e[45];let R;e[46]!==K||e[47]!==V?(R=s.jsxs("div",{className:"relative",children:[K,V]}),e[46]=K,e[47]=V,e[48]=R):R=e[48];let U;e[49]!==F||e[50]!==R?(U=s.jsxs("div",{className:"space-y-1",children:[F,R]}),e[49]=F,e[50]=R,e[51]=U):U=e[51];let E;e[52]!==t?(E=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[52]=t,e[53]=E):E=e[53];let H;e[54]!==N?(H=N&&s.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[54]=N,e[55]=H):H=e[55];let G;e[56]!==x||e[57]!==n?(G=s.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:x,children:"Cancel"}),e[56]=x,e[57]=n,e[58]=G):G=e[58];const J=x?"Saving...":"Save Connection";let Y;e[59]!==x||e[60]!==J?(Y=s.jsx(ee,{type:"submit",size:"sm",disabled:x,children:J}),e[59]=x,e[60]=J,e[61]=Y):Y=e[61];let Z;e[62]!==G||e[63]!==Y?(Z=s.jsxs(Fe,{children:[G,Y]}),e[62]=G,e[63]=Y,e[64]=Z):Z=e[64];let ce;return e[65]!==y||e[66]!==M||e[67]!==O||e[68]!==U||e[69]!==E||e[70]!==H||e[71]!==Z?(ce=s.jsxs("form",{onSubmit:y,className:"space-y-3",children:[M,O,U,E,H,Z]}),e[65]=y,e[66]=M,e[67]=O,e[68]=U,e[69]=E,e[70]=H,e[71]=Z,e[72]=ce):ce=e[72],ce}function ts(i){Q.error(`Failed to save connection: ${i.message}`)}const ss={kind:"closed"};function is(i,e){switch(e.type){case"open":return i.kind==="closed"?{kind:"grid"}:i;case"close":return{kind:"closed"};case"back":switch(i.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return i}case"select-form":return i.kind!=="grid"?i:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return i.kind!=="grid"?i:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return i.kind==="oauth-pending"?{kind:"grid"}:i;case"select-provision":return i.kind!=="grid"?i:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return i.kind!=="provision-pending"?i:{kind:"provision-error",providerId:i.providerId,error:e.error};case"retry-provision":return i.kind!=="provision-error"?i:{kind:"provision-pending",providerId:i.providerId}}}function ns(i){switch(i.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return i.providerId;default:return null}}function ls({open:i,onOpenChange:e,initialProvider:t}){const l=he()?.providers??[],{org:o}=le(),r=xe({connectionId:pe,orgId:o.id,orgSlug:o.slug}),a=me(),[c,d]=P.useReducer(is,ss),u=P.useRef(!1);P.useEffect(()=>{i&&c.kind==="closed"?d({type:"open"}):!i&&c.kind!=="closed"&&d({type:"close"})},[i,c.kind]);const p=()=>{u.current=!1,d({type:"close"}),e(!1)},f=()=>{a.invalidateQueries({queryKey:te.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:te.aiProviders(o.id)})},{mutate:h}=de({mutationFn:async({providerId:m,code:y,stateToken:b,label:A})=>{const M=await r.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:m,code:y,stateToken:b,label:A}});if(M?.isError)throw new Error(M.content?.[0]?.text??"OAuth exchange failed");return m},onSuccess:m=>{X("ai_provider_oauth_succeeded",{provider_id:m}),f();const y=l.find(b=>b.id===m);Q.success(`${y?.name??"Provider"} connected successfully`),p()},onError:(m,y)=>{X("ai_provider_oauth_failed",{provider_id:y.providerId,error:m.message}),Q.error(`OAuth connection failed: ${m.message}`),d({type:"oauth-failed"})}}),{mutate:v}=de({mutationFn:async m=>{const y=await r.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:m}});if(y?.isError)throw new Error(y.content?.[0]?.text??"Key provisioning failed");return m},onSuccess:m=>{X("ai_provider_provision_succeeded",{provider_id:m}),f();const y=l.find(b=>b.id===m);Q.success(`${y?.name??"Provider"} connected successfully`),p()},onError:(m,y)=>{X("ai_provider_provision_failed",{provider_id:y,error:m.message}),d({type:"provision-error",error:m.message})}}),g=async m=>{const{provider:y}=m,b=m.kind==="openai-compatible"?m.preset?.id??null:null,A=y.supportedMethods.includes("oauth-pkce"),M=y.supportedMethods.includes("api-key");if(y.supportsProvision===!0){X("ai_provider_connect_clicked",{provider_id:y.id,method:"provision"}),d({type:"select-provision",providerId:y.id}),v(y.id);return}if(A){X("ai_provider_connect_clicked",{provider_id:y.id,method:"oauth-pkce"});try{const z=await r.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:y.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(!z.structuredContent)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");d({type:"select-oauth",providerId:y.id,stateToken:z.structuredContent.stateToken}),window.open(z.structuredContent.url,"AiProviderOAuth","width=600,height=700")}catch(z){Q.error(`Failed to start OAuth: ${z instanceof Error?z.message:String(z)}`)}return}M&&(X("ai_provider_connect_clicked",{provider_id:y.id,...b!==null?{preset_id:b}:{},method:"api-key"}),d({type:"select-form",providerId:y.id,presetId:b}))},S=P.useRef(g);S.current=g;const j=P.useRef(t);j.current=t,P.useEffect(()=>{!j.current||c.kind!=="grid"||u.current||(u.current=!0,S.current(j.current))},[c.kind]);const w=c.kind==="oauth-pending"?c.stateToken:null,_=c.kind==="oauth-pending"?c.providerId:null;P.useEffect(()=>{if(c.kind!=="oauth-pending")return;let m=!1;const y=c.stateToken,b=c.providerId,A=O=>{if(O.origin!==window.location.origin||O.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:z,stateToken:F}=O.data;if(F!==y){Q.error("Security check failed: State token mismatch"),d({type:"oauth-failed"});return}m=!0;const B=l.find(L=>L.id===b);h({providerId:b,code:z,stateToken:y,label:B?.name??b})};window.addEventListener("message",A);const M=setTimeout(()=>{m||(X("ai_provider_oauth_timeout",{provider_id:b}),d({type:"oauth-failed"}),Q.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",A),clearTimeout(M)}},[c.kind,w,_,h]);const k=ns(c),T=k?l.find(m=>m.id===k):null,N=(c.kind==="form"&&c.presetId?ae.find(m=>m.id===c.presetId):null)?.name??T?.name??"Connect an AI provider",C=c.kind!=="grid"&&c.kind!=="closed",I=()=>{t?p():d({type:"back"})};return s.jsx(Nt,{open:c.kind!=="closed",onOpenChange:m=>!m&&p(),children:s.jsxs(kt,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(wt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:I,children:s.jsx(Pe,{size:16})}),s.jsx(_t,{children:N})]}),c.kind==="grid"&&!t&&s.jsx(Ct,{children:"Pick a provider — we'll handle the rest."})]}),c.kind==="grid"&&!t&&s.jsx(Be,{providers:l,onSelect:g}),c.kind==="form"&&(c.providerId==="openai-compatible"?s.jsx(es,{preset:c.presetId?ae.find(m=>m.id===c.presetId):void 0,onCancel:()=>d({type:"back"}),onSuccess:()=>{f(),p()}}):s.jsx(Qt,{providerId:c.providerId,onCancel:()=>d({type:"back"}),onSuccess:()=>{f(),p()}})),c.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(be,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Authorize the connection in the popup window. This dialog will close once authorization completes."})]}),c.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(be,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Connecting…"})]}),c.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(St,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:c.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{variant:"outline",size:"sm",onClick:()=>d({type:"back"}),children:"Back"}),s.jsx(ee,{size:"sm",onClick:()=>{d({type:"retry-provision"}),v(c.providerId)},children:"Retry"})]})]})]})})}function os(){const i=W.c(7),{org:e}=le(),t=Et();let n;i[0]!==e.id?(n=te.defaultBrand(e.id),i[0]=e.id,i[1]=n):n=i[1];let l;i[2]!==t?(l=async()=>{const{items:a}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(a)?a:[]).find(rs)??null},i[2]=t,i[3]=l):l=i[3];let o;i[4]!==n||i[5]!==l?(o={queryKey:n,queryFn:l},i[4]=n,i[5]=l,i[6]=o):o=i[6];const{data:r}=Ze(o);return r??null}function rs(i){return i.isDefault&&!i.archivedAt}function as(i){const e=i.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(l=>typeof l=="object"&&l!==null&&"label"in l&&/primary|brand|main/i.test(l.label)),n=t?t.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function cs(i){const e=W.c(39);let t;e[0]!==i?(t=i===void 0?{}:i,e[0]=i,e[1]=t):t=e[1];const{title:n,description:l}=t,{org:o}=le(),{localMode:r}=Je(),a=os(),c=bt(),[d,u]=P.useState(null),[p,f]=P.useState(!1),[h,v]=P.useState(!1),g=he();let S;e[2]!==g?.providers?(S=g?.providers??[],e[2]=g?.providers,e[3]=S):S=e[3];const j=S,w=o.name;let _;e[4]!==a?(_=a?as(a):null,e[4]=a,e[5]=_):_=e[5];const k=_,T=a?.favicon??a?.logo??null,x=n??(w?`${w} is ready for agents`:"Your agents are almost ready"),N=l??(r?"Connect a provider, or run `bunx decocms link` on your desktop for Claude Code, Codex, and local files.":"Connect a provider — or run `bunx decocms link` on your desktop to use Claude Code, Codex, or your local files."),C=!!(T||k);let I;e[6]!==k?(I=k?{backgroundColor:`${k}18`,borderColor:`${k}30`}:void 0,e[6]=k,e[7]=I):I=e[7];const m=I,y=C?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";let b;e[8]!==y||e[9]!==m||e[10]!==T||e[11]!==c||e[12]!==k?(b=T?s.jsx("div",{className:y,style:m,children:s.jsx("img",{src:T,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>v(!0),"aria-label":c.online?"Desktop linked":"Connect your desktop",className:ue(y,"cursor-pointer transition-colors hover:bg-accent"),style:m,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(jt,{size:24,style:k?{color:k}:void 0,className:ue(!k&&"text-muted-foreground")}),c.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[8]=y,e[9]=m,e[10]=T,e[11]=c,e[12]=k,e[13]=b):b=e[13];let A;e[14]!==x?(A=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:x}),e[14]=x,e[15]=A):A=e[15];let M;e[16]!==N?(M=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:N}),e[16]=N,e[17]=M):M=e[17];let O;e[18]!==A||e[19]!==M?(O=s.jsxs("div",{className:"space-y-2",children:[A,M]}),e[18]=A,e[19]=M,e[20]=O):O=e[20];let z;e[21]!==b||e[22]!==O?(z=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[b,O]}),e[21]=b,e[22]=O,e[23]=z):z=e[23];let F,B;e[24]===Symbol.for("react.memo_cache_sentinel")?(F=E=>u(E),B=()=>f(!0),e[24]=F,e[25]=B):(F=e[24],B=e[25]);let L;e[26]!==j?(L=s.jsx("div",{className:"w-full",children:s.jsx(Be,{providers:j,onSelect:F,onShowAll:B})}),e[26]=j,e[27]=L):L=e[27];const K=d!==null||p;let $;e[28]===Symbol.for("react.memo_cache_sentinel")?($=E=>{E||(u(null),f(!1))},e[28]=$):$=e[28];const D=d??void 0;let V;e[29]!==K||e[30]!==D?(V=s.jsx(ls,{open:K,onOpenChange:$,initialProvider:D}),e[29]=K,e[30]=D,e[31]=V):V=e[31];let R;e[32]!==h?(R=s.jsx(Ot,{open:h,onOpenChange:v}),e[32]=h,e[33]=R):R=e[33];let U;return e[34]!==L||e[35]!==V||e[36]!==R||e[37]!==z?(U=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[z,L,V,R]}),e[34]=L,e[35]=V,e[36]=R,e[37]=z,e[38]=U):U=e[38],U}function ge(i){const e=i.title.includes(": ");return{provider:e?i.title.split(": ")[0]??"":i.modelId.split("/")[0]??"",displayName:e?i.title.split(": ").slice(1).join(": "):i.title}}function ds(i){return i<32e3?{level:1,label:"Small",description:"Short conversations"}:i<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:i<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const us=["bg-destructive","bg-warning","bg-success","bg-success"],ms=["text-success","text-warning","text-warning","text-destructive"];function hs(i){const e=Math.round(i*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(i*.75)} words`}function fs(i){return i<1?{level:1,label:"Cheap"}:i<5?{level:2,label:"Moderate"}:i<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const ps={text:{icon:s.jsx(ht,{className:"size-3.5"}),label:"Text"},vision:{icon:s.jsx(mt,{className:"size-3.5"}),label:"Vision"},image:{icon:s.jsx(ct,{className:"size-3.5"}),label:"Image"},tools:{icon:s.jsx(ut,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:s.jsx(At,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:s.jsx($e,{className:"size-3.5"}),label:"Web search"}};function xs(i){const e=W.c(5),{capability:t}=i;let n;e[0]!==t?(n=ps[t]??{icon:null,label:t.charAt(0).toUpperCase()+t.slice(1)},e[0]=t,e[1]=n):n=e[1];const l=n;let o;return e[2]!==l.icon||e[3]!==l.label?(o=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[l.icon,l.label]}),e[2]=l.icon,e[3]=l.label,e[4]=o):o=e[4],o}function gs(i){const e=W.c(49),{model:t,compact:n}=i,l=n===void 0?!1:n;if(!t){let x;return e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=x):x=e[0],x}const o=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let a;e[1]!==t?(a=ge(t),e[1]=t,e[2]=a):a=e[2];const{provider:c,displayName:d}=a;if(l){let x;e[3]!==t.limits?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Context"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=t.limits,e[4]=x):x=e[4];let N;e[5]!==o?(N=o!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=N):N=e[6];let C;e[7]!==r?(C=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=C):C=e[8];let I;e[9]!==t.limits?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=t.limits,e[10]=I):I=e[10];let m;return e[11]!==x||e[12]!==N||e[13]!==C||e[14]!==I?(m=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,N,C,I]}),e[11]=x,e[12]=N,e[13]=C,e[14]=I,e[15]=m):m=e[15],m}let u;e[16]!==c?(u=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c}),e[16]=c,e[17]=u):u=e[17];let p;e[18]!==t.logo||e[19]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[18]=t.logo,e[19]=t.title,e[20]=p):p=e[20];let f;e[21]!==d?(f=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:d}),e[21]=d,e[22]=f):f=e[22];let h;e[23]!==p||e[24]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,f]}),e[23]=p,e[24]=f,e[25]=h):h=e[25];let v;e[26]!==t.modelId?(v=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[26]=t.modelId,e[27]=v):v=e[27];let g;e[28]!==u||e[29]!==h||e[30]!==v?(g=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[u,h,v]}),e[28]=u,e[29]=h,e[30]=v,e[31]=g):g=e[31];let S;e[32]!==t.capabilities?(S=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(vs)}),e[32]=t.capabilities,e[33]=S):S=e[33];let j;e[34]!==t.limits?(j=t.limits?.contextWindow&&(()=>{const{level:x,label:N,description:C}=ds(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(I=>s.jsx("div",{className:ue("w-2 h-2 rounded-full",I<=x?us[x-1]:"bg-muted")},I))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",C]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=t.limits,e[35]=j):j=e[35];let w;e[36]!==t.limits?(w=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:hs(t.limits.maxOutputTokens)})]})]}),e[36]=t.limits,e[37]=w):w=e[37];let _;e[38]!==o||e[39]!==r?(_=(o!=null||r!=null)&&(()=>{const{level:x,label:N}=o!=null?fs(o):{level:0,label:""};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:ue("text-sm font-bold leading-none",C<=x?ms[x-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=_):_=e[40];let k;e[41]!==j||e[42]!==w||e[43]!==_?(k=s.jsxs("div",{className:"flex flex-col gap-6",children:[j,w,_]}),e[41]=j,e[42]=w,e[43]=_,e[44]=k):k=e[44];let T;return e[45]!==k||e[46]!==g||e[47]!==S?(T=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[g,S,k]}),e[45]=k,e[46]=g,e[47]=S,e[48]=T):T=e[48],T}function vs(i){return s.jsx(xs,{capability:i},i)}function fi(i){const e=W.c(19),{model:t,placeholder:n,isLoading:l}=i,o=n===void 0?"Select model":n;if(l===void 0?!1:l){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(q,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(q,{className:"w-16 h-3 hidden md:block"})]}),e[0]=g):g=e[0],g}if(!t){let g;e[1]!==o?(g=s.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=g):g=e[2];let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Se,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=S):S=e[3];let j;return e[4]!==g?(j=s.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[4]=g,e[5]=j):j=e[5],j}let a;e[6]!==t?(a=ge(t),e[6]=t,e[7]=a):a=e[7];const{displayName:c}=a;let d;e[8]!==t?(d=fe(t),e[8]=t,e[9]=d):d=e[9];const u=d;let p;e[10]!==t.title||e[11]!==u?(p=s.jsx("img",{src:u,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[10]=t.title,e[11]=u,e[12]=p):p=e[12];let f;e[13]!==c?(f=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:c}),e[13]=c,e[14]=f):f=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Se,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=h):h=e[15];let v;return e[16]!==p||e[17]!==f?(v=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=v):v=e[18],v}const bs=["vision","image","file","audio","video"],We=["image/png","image/jpeg","image/gif","image/webp"],Ve=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function ve(i){const e=i?.capabilities;return e?bs.some(t=>e.includes(t)):!1}function pi(i,e){if(!i)return!1;if(i.startsWith("text/"))return!0;const t=e?.capabilities??[],n=t.includes("vision")||t.includes("image"),l=t.includes("file"),o=t.includes("audio"),r=t.includes("video");return!!(n&&We.includes(i)||l&&i==="application/pdf"||o&&i.startsWith("audio/")||r&&i.startsWith("video/")||ve(e)&&Ve.includes(i))}function xi(i){const e=i?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...We),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),ve(i)&&t.push(...Ve),t.join(",")}function gi(i){const e=i?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("images"),e.includes("file")&&t.push("PDFs"),e.includes("audio")&&t.push("audio"),e.includes("video")&&t.push("video"),ve(i)&&t.push("Office files"),t.length===0?"text only":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`}const He=["smarter","faster","cheaper"],qe={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},ys=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],js=ys.flatMap(({tier:i,prefixes:e})=>e.map(t=>({tier:i,prefix:t}))).sort((i,e)=>e.prefix.length-i.prefix.length),Ss=new Set(["google/gemini-2.5-pro"]),Ee=new Map;function Ns(i){const e=Ee.get(i);if(e!==void 0)return e;let t=null;if(i.endsWith(":free"))t="cheaper";else e:for(const{tier:n,prefix:l}of js)if(i.startsWith(l)){if(Ss.has(l)&&i.length>l.length&&i[l.length]==="-"){const r=i[l.length+1];if(!r||!/\d/.test(r))continue e}t=n;break}return Ee.set(i,t),t}function Oe(i){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of i){const n=Ns(t.modelId);e[n??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((n,l)=>n.title.localeCompare(l.title));return e}const Ge="mesh:model-shortlist:",ks=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function ws(i){try{const e=localStorage.getItem(Ge+i);return e?new Set(JSON.parse(e)):null}catch{return null}}function _s(i,e){localStorage.setItem(Ge+i,JSON.stringify([...e]))}function Cs(i){const e=W.c(21),{model:t,onHover:n}=i;let l;e[0]!==t?(l=ge(t),e[0]=t,e[1]=l):l=e[1];const{displayName:o,provider:r}=l;let a;e[2]!==t?(a=fe(t),e[2]=t,e[3]=a):a=e[3];const c=a;let d;e[4]!==t||e[5]!==n?(d=()=>n(t),e[4]=t,e[5]=n,e[6]=d):d=e[6];let u;e[7]!==t.title||e[8]!==c?(u=s.jsx("img",{src:c,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=c,e[9]=u):u=e[9];let p;e[10]!==o?(p=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=p):p=e[11];let f;e[12]!==r?(f=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=f):f=e[13];let h;e[14]!==p||e[15]!==f?(h=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[p,f]}),e[14]=p,e[15]=f,e[16]=h):h=e[16];let v;return e[17]!==d||e[18]!==u||e[19]!==h?(v=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[u,h]}),e[17]=d,e[18]=u,e[19]=h,e[20]=v):v=e[20],v}function Is(i){const e=W.c(10),{error:t,onRetry:n}=i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(st,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=t?.message||"Could not fetch models from this provider.";let a;e[2]!==r?(a=s.jsxs("div",{className:"flex flex-col gap-1",children:[o,s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(dt,{className:"size-3.5"}),e[4]=c):c=e[4];let d;e[5]!==n?(d=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ee,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[c,"Retry"]})}),e[5]=n,e[6]=d):d=e[6];let u;return e[7]!==a||e[8]!==d?(u=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,a,d]}),e[7]=a,e[8]=d,e[9]=u):u=e[9],u}function Ms(){const i=W.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Es)}),i[0]=e):e=i[0],e}function Es(i,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(q,{className:"flex-1 h-4"}),s.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ae(i){const e=W.c(12),{label:t,models:n,onSelect:l,onHover:o}=i;if(n.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==o||e[4]!==l){let d;e[6]!==o||e[7]!==l?(d=u=>s.jsx("div",{onClick:()=>l(u),className:"cursor-pointer",children:s.jsx(Cs,{model:u,onHover:o})},u.modelId),e[6]=o,e[7]=l,e[8]=d):d=e[8],a=n.map(d),e[2]=n,e[3]=o,e[4]=l,e[5]=a}else a=e[5];let c;return e[9]!==r||e[10]!==a?(c=s.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=c):c=e[11],c}function Os(i){const e=W.c(21),{model:t,isChecked:n,onToggle:l,onHover:o}=i,[r,a]=P.useState(n);r!==n&&a(n);let c;e[0]!==t?(c=fe(t),e[0]=t,e[1]=c):c=e[1];const d=c;let u;e[2]!==t||e[3]!==o?(u=()=>o(t),e[2]=t,e[3]=o,e[4]=u):u=e[4];let p;e[5]!==t.modelId||e[6]!==l?(p=()=>{a(As),l(t.modelId)},e[5]=t.modelId,e[6]=l,e[7]=p):p=e[7];let f;e[8]!==r||e[9]!==p?(f=s.jsx(it,{checked:r,onCheckedChange:p}),e[8]=r,e[9]=p,e[10]=f):f=e[10];let h;e[11]!==d||e[12]!==t.title?(h=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=h):h=e[13];let v;e[14]!==t.title?(v=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=v):v=e[15];let g;return e[16]!==u||e[17]!==f||e[18]!==h||e[19]!==v?(g=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:u,children:[f,h,v]}),e[16]=u,e[17]=f,e[18]=h,e[19]=v,e[20]=g):g=e[20],g}function As(i){return!i}function Ts(i){const e=[];for(const t of He)if(i[t].length>0){e.push({type:"header",label:qe[t]});for(const n of i[t])e.push({type:"model",model:n})}if(i.other.length>0){e.push({type:"header",label:"Other"});for(const t of i.other)e.push({type:"model",model:t})}return e}function zs({items:i,shortlistSet:e,onToggle:t,onHover:n}){const l=P.useRef(null),o=Wt({count:i.length,getScrollElement:()=>l.current,estimateSize:r=>i[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=i[r.index];return a?s.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):s.jsx(Os,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:t,onHover:n})},r.key):null})})})}function Ls(i){const e=W.c(23),{keyId:t,searchTerm:n,onHover:l,onModelSelect:o,managing:r,onToggleManage:a,filterModels:c}=i,{models:d}=vt(t),u=c?d.filter(c):d.filter(Rs);let p;e[0]!==t?(p=()=>(t?ws(t):null)??ks,e[0]=t,e[1]=p):p=e[1];const[f,h]=P.useState(p),[,v]=P.useTransition();let g;e[2]!==t||e[3]!==v?(g=m=>{t&&v(()=>{h(y=>{const b=new Set(y);return b.has(m)?b.delete(m):b.add(m),_s(t,b),b})})},e[2]=t,e[3]=v,e[4]=g):g=e[4];const S=g,j=n.toLowerCase().trim(),w=m=>j?m.filter(y=>y.title.toLowerCase().includes(j)||y.modelId.toLowerCase().includes(j)):m;if(r){const m=Oe(w(u)),y=Ts(m);let b;e[5]!==f?(b=z=>f.has(z.modelId),e[5]=f,e[6]=b):b=e[6];const A=u.filter(b).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Pe,{size:14}),e[7]=M):M=e[7];let O;return e[8]!==a?(O=s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[M,"Back"]}),e[8]=a,e[9]=O):O=e[9],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[O,s.jsxs("span",{className:"text-xs text-muted-foreground",children:[A," selected"]})]}),s.jsx(zs,{items:y,shortlistSet:f,onToggle:S,onHover:l})]})}let _;e[10]!==f?(_=m=>f.has(m.modelId),e[10]=f,e[11]=_):_=e[11];const k=u.filter(_),T=k.length>0?k:u,x=Oe(w(T));let N;e[12]!==x||e[13]!==l||e[14]!==o?(N=He.map(m=>s.jsx(Ae,{label:qe[m],models:x[m],onSelect:o,onHover:l},m)),e[12]=x,e[13]=l,e[14]=o,e[15]=N):N=e[15];let C;e[16]!==x.other||e[17]!==l||e[18]!==o?(C=s.jsx(Ae,{label:"Other",models:x.other,onSelect:o,onHover:l}),e[16]=x.other,e[17]=l,e[18]=o,e[19]=C):C=e[19];let I;return e[20]!==N||e[21]!==C?(I=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,C]}),e[20]=N,e[21]=C,e[22]=I):I=e[22],I}function Rs(i){return i.asyncResearch!==!0}function vi(){const i=W.c(6);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(q,{className:"size-4 shrink-0"}),s.jsx(q,{className:"flex-1 h-6"}),s.jsx(q,{className:"w-[140px] h-8 shrink-0"})]})}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Ps)})]}),i[1]=t):t=i[1];let n;i[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(q,{className:"size-6 shrink-0"}),s.jsx(q,{className:"h-6 w-32"})]}),i[2]=n):n=i[2];let l;i[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(q,{className:"h-6 w-20 rounded-md"}),s.jsx(q,{className:"h-6 w-24 rounded-md"})]})]}),i[3]=l):l=i[3];let o;i[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(q,{className:"h-4 w-24"}),s.jsx(q,{className:"h-4 w-32"})]}),i[4]=o):o=i[4];let r;return i[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[l,s.jsxs("div",{className:"flex flex-col gap-4",children:[o,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(q,{className:"h-4 w-16"}),s.jsx(q,{className:"h-4 w-40"})]})]})]})})]}),i[5]=r):r=i[5],r}function Ps(i,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(q,{className:"flex-1 h-4"}),s.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ye(i){const e=W.c(49),{onClose:t,credentialId:n,onCredentialChange:l,selectedModel:o,onModelChange:r,filterModels:a}=i,[c,d]=P.useState(null),[u,p]=P.useState(""),[f,h]=P.useState(!1),v=P.useRef(null),g=he(),S=gt();let j;e[0]!==g?.providers?(j=Object.fromEntries((g?.providers??[]).map(Ks)),e[0]=g?.providers,e[1]=j):j=e[1];const w=j,_=et(),{org:k}=le();let T;e[2]!==l?(T=E=>{l(E),d(null)},e[2]=l,e[3]=T):T=e[3];const x=T;let N;e[4]!==n||e[5]!==t||e[6]!==r?(N=E=>{n&&(r(E),p(""),t())},e[4]=n,e[5]=t,e[6]=r,e[7]=N):N=e[7];const C=N;if(S.length===0){let E;return e[8]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:s.jsx(cs,{})}),e[8]=E):E=e[8],E}let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx($e,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=I):I=e[9];const m=f?"Search all models...":"Search for a model...";let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=E=>p(E.target.value),e[10]=y):y=e[10];let b;e[11]!==u||e[12]!==m?(b=s.jsx(ne,{ref:v,type:"text",placeholder:m,value:u,onChange:y,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[11]=u,e[12]=m,e[13]=b):b=e[13];let A;e[14]!==n||e[15]!==x||e[16]!==S||e[17]!==w?(A=S.length>0&&s.jsxs(nt,{value:n??"",onValueChange:x,children:[s.jsxs(lt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Fs,children:[s.jsx(ot,{placeholder:"Key",children:(()=>{const E=S.find(Z=>Z.id===n),H=E?w[E.providerId]:void 0,G=Ie(E?.presetId),J=G?.logo??H?.logo,Y=G?.name??H?.name??E?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[J?s.jsx("img",{src:J,alt:Y,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:Y.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:Y})]})})()}),s.jsx(ft,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(rt,{children:S.map(E=>{const H=w[E.providerId],G=Ie(E.presetId),J=G?.logo??H?.logo,Y=G?.name??H?.name??E.providerId;return s.jsx(at,{value:E.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[J?s.jsx("img",{src:J,alt:Y,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:Y.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[Y," — ",E.label]})]})},E.id)})})]}),e[14]=n,e[15]=x,e[16]=S,e[17]=w,e[18]=A):A=e[18];let M;e[19]!==b||e[20]!==A?(M=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[I,b,A]})}),e[19]=b,e[20]=A,e[21]=M):M=e[21];let O;e[22]!==n?(O=E=>{const{error:H,resetError:G}=E;return s.jsx(Is,{error:H,onRetry:G,credentialId:n??void 0})},e[22]=n,e[23]=O):O=e[23];let z;e[24]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ms,{}),e[24]=z):z=e[24];const F=n??void 0;let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=()=>h($s),e[25]=B):B=e[25];let L;e[26]!==a||e[27]!==C||e[28]!==f||e[29]!==u||e[30]!==F?(L=s.jsx(P.Suspense,{fallback:z,children:s.jsx(Ls,{keyId:F,searchTerm:u,onHover:d,onModelSelect:C,managing:f,onToggleManage:B,filterModels:a})}),e[26]=a,e[27]=C,e[28]=f,e[29]=u,e[30]=F,e[31]=L):L=e[31];let K;e[32]!==n||e[33]!==O||e[34]!==L?(K=s.jsx(tt,{fallback:O,children:L},n),e[32]=n,e[33]=O,e[34]=L,e[35]=K):K=e[35];let $;e[36]!==f||e[37]!==_||e[38]!==k?($=!f&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>P.startTransition(()=>h(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(xt,{className:"size-3.5 shrink-0"}),"Manage models"]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>_({to:"/$org/settings/ai-providers",params:{org:k.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(pt,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[36]=f,e[37]=_,e[38]=k,e[39]=$):$=e[39];let D;e[40]!==K||e[41]!==$||e[42]!==M?(D=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[M,K,$]}),e[40]=K,e[41]=$,e[42]=M,e[43]=D):D=e[43];const V=c??o??null;let R;e[44]!==V?(R=s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(gs,{model:V})}),e[44]=V,e[45]=R):R=e[45];let U;return e[46]!==D||e[47]!==R?(U=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[D,R]}),e[46]=D,e[47]=R,e[48]=U):U=e[48],U}function $s(i){return!i}function Fs(i){return i.stopPropagation()}function Ks(i){return[i.id,i]}function Ds(i){const e=W.c(12),{onClose:t}=i,{credentialId:n,setCredentialId:l,selectedModel:o,setModel:r}=yt();let a;e[0]!==l?(a=u=>{X("chat_credential_changed",{credential_id:u}),l(u)},e[0]=l,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?.modelId||e[4]!==r?(c=u=>{n&&(X("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:u.modelId,to_model_provider:u.providerId??null,credential_id:n}),r({...u,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=r,e[5]=c):c=e[5];let d;return e[6]!==n||e[7]!==t||e[8]!==o||e[9]!==a||e[10]!==c?(d=s.jsx(Ye,{onClose:t,credentialId:n,onCredentialChange:a,selectedModel:o,onModelChange:c}),e[6]=n,e[7]=t,e[8]=o,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function bi(i){const e=W.c(2),{onClose:t}=i;let n;return e[0]!==t?(n=s.jsx(Ds,{onClose:t}),e[0]=t,e[1]=n):n=e[1],n}function yi(i){const e=W.c(2);let t;return e[0]!==i?(t=s.jsx(Ye,{...i}),e[0]=i,e[1]=t):t=e[1],t}function ji(i){const e=W.c(3),{size:t}=i,n=t===void 0?16:t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=l):l=e[0];let o;return e[1]!==n?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:n,height:n,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l}),e[1]=n,e[2]=o):o=e[2],o}function Si(i){const e=W.c(3),{size:t}=i,n=t===void 0?16:t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=l):l=e[0];let o;return e[1]!==n?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:n,height:n,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:l}),e[1]=n,e[2]=o):o=e[2],o}export{ji as C,yi as D,vi as M,cs as N,ae as O,Be as P,fi as S,Si as a,xi as b,ls as c,bi as d,gi as g,pi as i,ve as m};
@@ -1 +1 @@
1
- import{e as se,j as s,B as Z,q as me,r as Y,t as v,o as de}from"./index-biiHZ5l9.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-CIu58K9q.js";import{s as pe}from"./Star01-eRdSY4QW.js";import{a as fe}from"./Users03-BlNe2PnN.js";import{S as ge,G as ue,u as he,H as ie,W as oe,a as xe,I as je}from"./github-repo-picker-B24_pGAu.js";import{a as _e,b as Ce,c as be}from"./use-virtual-mcp-0jbEmvOc.js";import{P as q}from"./index-r7-3fAFf.js";import{i as ye}from"./DotsVertical-SvwN4CeV.js";import{a as Ne}from"./Settings02-Cd4DIqaJ.js";import{s as Se}from"./Trash01-Cup7-ZTT.js";import{A as De,ao as ve}from"./agent-icon-DT8dQ9tq.js";import{k as Ae}from"./use-navigate-to-agent-CdsMYUzL.js";import{C as ke}from"./card-BUTabNLA.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-BPM45mbW.js";import{E as Te}from"./empty-state-1AbmTLd7.js";import{u as ze}from"./use-create-virtual-mcp-CWYOy45e.js";import{c as Ie,b as Pe,d as He,f as Ee,e as Me,g as Oe,a as Be,A as Ge}from"./alert-dialog-CSkQIwm8.js";import{S as $e}from"./search-input-BgGthWir.js";import{s as le}from"./Plus-CjrtKB-Y.js";import"./Check-D-9dblUn.js";import"./ChevronRight-CrZy8tHx.js";import"./use-connection-DyJtuHQI.js";import"./use-collections-B5Jh_wGd.js";import"./use-mcp-client-CWFUu1lY.js";import"./dialog-Bm1pP7Vu.js";import"./X-1KR4wibP.js";import"./RefreshCcw01-3BsQQkRx.js";import"./collection-search-LsgoMrVO.js";import"./SearchMd-BL2y99rx.js";import"./checkbox--nDaSUZE.js";import"./use-mcp-tools-DePRGZE5.js";import"./extract-connection-data-LoMqboL3.js";import"./generate-id-CadHbHqX.js";import"./collections-C_j8CeI8.js";import"./sidebar-CPZXU-2w.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./tooltip-bsrBmmjV.js";import"./sheet-D99KevZC.js";import"./AlertCircle-9EFUZenf.js";import"./Tool01-Dcq7KP8Y.js";import"./SwitchHorizontal01-BMnNI1Fi.js";import"./XCircle-UPVnJx4i.js";import"./ArrowUpRight-97355q5v.js";import"./ZapSquare-B1o2Q9OR.js";import"./CheckCircle-C2ualSpf.js";import"./ChevronDown-Cf2Q-GlB.js";import"./ChevronLeft-BaV4nFMQ.js";import"./ChevronUp-BAxoXhnT.js";import"./Container-CYcITvPW.js";import"./Eye-ByuwKsdh.js";import"./ZoomOut-D8vQ49we.js";import"./Globe01-DfGFlik1.js";import"./FilterLines-BJZdiggU.js";import"./Palette-Druykvzw.js";import"./HardDrive-DNFvbooP.js";import"./Stars02-EuAFDZ5E.js";import"./Key01-CzmPnHuw.js";import"./LinkExternal01-CgI1VTqi.js";import"./Monitor01-Cw6kmClm.js";import"./Sun-CH2HWLCn.js";import"./Play-CMJ2IWYR.js";import"./Shield01-zIbMct6w.js";import"./Stars01-v0yz6PCZ.js";import"./Upload01-C9yi1Bdg.js";import"./User01-thAIxsAs.js";import"./Users01-DPJm6-u-.js";import"./XClose-pR-QU0OQ.js";import"./Zap-Cl-JM7N9.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=se.c(29),{onCreateFromScratch:i,onCreateWebsite:D,onCreateHydrogenStore:l,onImportGitHub:S,onImportDeco:f,isCreating:o,align:y,side:g,showBetaBadge:u}=t,h=y===void 0?"end":y;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(fe,{size:14}),e[0]=x):x=e[0];let a;e[1]!==o||e[2]!==i?(a=s.jsxs(k,{disabled:o,onClick:i,children:[x,"Create from scratch"]}),e[1]=o,e[2]=i,e[3]=a):a=e[3];let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:14}),e[4]=j):j=e[4];let n;e[5]!==o||e[6]!==D?(n=s.jsxs(k,{disabled:o,onClick:D,children:[j,"Start Website"]}),e[5]=o,e[6]=D,e[7]=n):n=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("img",{src:ge,alt:"",className:"size-3.5 object-contain"}),e[8]=_):_=e[8];let c;e[9]!==o||e[10]!==l?(c=s.jsxs(k,{disabled:o,onClick:l,children:[_,"Create Shopify Headless Store"]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(ue,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(k,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(k,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(k,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(k,{variant:"destructive",onClick:w=>{w.stopPropagation(),l(w)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(ke,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function rs(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=he(),[h,x]=Y.useState(null),[a,j]=Y.useState(!1),[n,_]=Y.useState(!1),{granted:c}=we("agents:manage"),N=l.toLowerCase(),r=i.filter(d=>d.id!==e.id&&(d.title.toLowerCase().includes(N)||d.description?.toLowerCase().includes(N))),{data:C}=be(r.map(Le));let p;t[1]!==D||t[2]!==h?(p=async()=>{if(!h)return;const{id:d,title:ce}=h;x(null);try{await D.delete.mutateAsync(d),v("agent_deleted",{agent_id:d,source:"agents_list"}),de.success(`Deleted "${ce}"`)}catch{}},t[1]=D,t[2]=h,t[3]=p):p=t[3];const m=p,b=q,A=q,w=q;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(q.Title,{children:"Agents"}),t[4]=F):F=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{d.key==="Escape"&&(S(""),d.target.blur())},t[5]=L):L=t[5];let T;t[6]!==l?(T=s.jsx($e,{value:l,onChange:S,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=T):T=t[7];let z;t[8]!==c||t[9]!==g||t[10]!==o||t[11]!==y||t[12]!==u?(z=c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list",method:"deco"}),j(!0)},isCreating:y||u,align:"end"})]}),t[8]=c,t[9]=g,t[10]=o,t[11]=y,t[12]=u,t[13]=z):z=t[13];let I;t[14]!==T||t[15]!==z?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[F,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[T,z]})]}),t[14]=T,t[15]=z,t[16]=I):I=t[16];const K=r.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(ve,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),j(!0)},isCreating:y||u,align:"center",showBetaBadge:!0})]})})}),J=r.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:r.map(d=>s.jsx(Fe,{project:d,lastUsedAt:C?.get(d.id)?.last_used_at,onDeleteClick:c?()=>x({id:d.id,title:d.title}):void 0},d.id))})]});let P;t[17]!==J||t[18]!==w.Body||t[19]!==I||t[20]!==K?(P=s.jsxs(w.Body,{children:[I,K,J]}),t[17]=J,t[18]=w.Body,t[19]=I,t[20]=K,t[21]=P):P=t[21];let H;t[22]!==P||t[23]!==A.Content?(H=s.jsx(A.Content,{children:P}),t[22]=P,t[23]=A.Content,t[24]=H):H=t[24];let E;t[25]!==n?(E=s.jsx(xe,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{rs as default};
1
+ import{e as se,j as s,B as Z,q as me,r as Y,t as v,o as de}from"./index-Bll1AlZi.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-D7fqzmBS.js";import{s as pe}from"./Star01-s_hRJjwq.js";import{a as fe}from"./Users03-C19XPgsH.js";import{S as ge,G as ue,u as he,H as ie,W as oe,a as xe,I as je}from"./github-repo-picker-CKp3ba8m.js";import{a as _e,b as Ce,c as be}from"./use-virtual-mcp-71PpEQrs.js";import{P as q}from"./index-Bgv8YQhF.js";import{i as ye}from"./DotsVertical-dauL8_mz.js";import{a as Ne}from"./Settings02-DttqwSGe.js";import{s as Se}from"./Trash01-BOiUMUTV.js";import{A as De,ap as ve}from"./agent-icon-DyETFFvd.js";import{k as Ae}from"./use-navigate-to-agent-TzPRxzJx.js";import{C as ke}from"./card-C0qmaAJH.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-cYRWRLhr.js";import{E as Te}from"./empty-state-BumLAiri.js";import{u as ze}from"./use-create-virtual-mcp-TPoPQ6hG.js";import{c as Ie,b as Pe,d as He,f as Ee,e as Me,g as Oe,a as Be,A as Ge}from"./alert-dialog-C_C5CWIi.js";import{S as $e}from"./search-input-JFEU6QlH.js";import{s as le}from"./Plus-CSmw6cpp.js";import"./Check-xMlMIzVH.js";import"./ChevronRight-TZkuqway.js";import"./use-connection-Cam2HslE.js";import"./use-collections-DI2EpqEk.js";import"./use-mcp-client-Des-fSV9.js";import"./dialog-BE3BWPis.js";import"./X-LT7RIKGm.js";import"./RefreshCcw01-Ct_5xx8z.js";import"./collection-search-uQS9yrST.js";import"./SearchMd-DXp3IUvU.js";import"./checkbox-ClCQ7aIa.js";import"./use-mcp-tools-DVBLMBo3.js";import"./extract-connection-data-BLVQkjXZ.js";import"./generate-id-D0pLsbUu.js";import"./collections-5f6Mz9W3.js";import"./sidebar-hk7mPADd.js";import"./LayoutLeft-Ozgz9jeL.js";import"./tooltip-B2vnmSMM.js";import"./sheet-DokH5LKH.js";import"./AlertCircle-Dk6vk346.js";import"./Tool01-CSM07Bd3.js";import"./SwitchHorizontal01-DUBxuMB8.js";import"./XCircle-fZmWWsk8.js";import"./ArrowUpRight-4oEjocH3.js";import"./ZapSquare-Br5HjwCx.js";import"./CheckCircle-ieh2HpZJ.js";import"./ChevronDown-DXk0XLak.js";import"./ChevronLeft-z0R4UDTf.js";import"./ChevronUp-CDwUhj6r.js";import"./Container-BuYdkyve.js";import"./Eye-DjmQZ2p3.js";import"./ZoomOut-DiWWUJB1.js";import"./Globe01-BFX2DjNo.js";import"./FilterLines-DCVUz1mF.js";import"./Palette-CJj0LVDj.js";import"./HardDrive-ep-sJwLU.js";import"./Stars02-Cg2K8h2t.js";import"./Key01-u8nOkLN5.js";import"./LinkExternal01-C_bnt3ki.js";import"./Monitor01-BBuvzSNf.js";import"./Sun-D1pch37z.js";import"./Play-BUy7F0as.js";import"./Shield01-BlrpeOP8.js";import"./Stars01-U1zM7H-d.js";import"./Upload01-B45bupsd.js";import"./User01-CMlKZMq6.js";import"./Users01-CHcmgQX1.js";import"./XClose-CXQHotFO.js";import"./Zap-DhYBCL8w.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=se.c(29),{onCreateFromScratch:i,onCreateWebsite:D,onCreateHydrogenStore:l,onImportGitHub:S,onImportDeco:f,isCreating:o,align:y,side:g,showBetaBadge:u}=t,h=y===void 0?"end":y;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(fe,{size:14}),e[0]=x):x=e[0];let a;e[1]!==o||e[2]!==i?(a=s.jsxs(k,{disabled:o,onClick:i,children:[x,"Create from scratch"]}),e[1]=o,e[2]=i,e[3]=a):a=e[3];let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:14}),e[4]=j):j=e[4];let n;e[5]!==o||e[6]!==D?(n=s.jsxs(k,{disabled:o,onClick:D,children:[j,"Start Website"]}),e[5]=o,e[6]=D,e[7]=n):n=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("img",{src:ge,alt:"",className:"size-3.5 object-contain"}),e[8]=_):_=e[8];let c;e[9]!==o||e[10]!==l?(c=s.jsxs(k,{disabled:o,onClick:l,children:[_,"Create Shopify Headless Store"]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(ue,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(k,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(k,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(k,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(k,{variant:"destructive",onClick:w=>{w.stopPropagation(),l(w)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(ke,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function rs(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=he(),[h,x]=Y.useState(null),[a,j]=Y.useState(!1),[n,_]=Y.useState(!1),{granted:c}=we("agents:manage"),N=l.toLowerCase(),r=i.filter(d=>d.id!==e.id&&(d.title.toLowerCase().includes(N)||d.description?.toLowerCase().includes(N))),{data:C}=be(r.map(Le));let p;t[1]!==D||t[2]!==h?(p=async()=>{if(!h)return;const{id:d,title:ce}=h;x(null);try{await D.delete.mutateAsync(d),v("agent_deleted",{agent_id:d,source:"agents_list"}),de.success(`Deleted "${ce}"`)}catch{}},t[1]=D,t[2]=h,t[3]=p):p=t[3];const m=p,b=q,A=q,w=q;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(q.Title,{children:"Agents"}),t[4]=F):F=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{d.key==="Escape"&&(S(""),d.target.blur())},t[5]=L):L=t[5];let T;t[6]!==l?(T=s.jsx($e,{value:l,onChange:S,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=T):T=t[7];let z;t[8]!==c||t[9]!==g||t[10]!==o||t[11]!==y||t[12]!==u?(z=c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list",method:"deco"}),j(!0)},isCreating:y||u,align:"end"})]}),t[8]=c,t[9]=g,t[10]=o,t[11]=y,t[12]=u,t[13]=z):z=t[13];let I;t[14]!==T||t[15]!==z?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[F,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[T,z]})]}),t[14]=T,t[15]=z,t[16]=I):I=t[16];const K=r.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(ve,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),j(!0)},isCreating:y||u,align:"center",showBetaBadge:!0})]})})}),J=r.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:r.map(d=>s.jsx(Fe,{project:d,lastUsedAt:C?.get(d.id)?.last_used_at,onDeleteClick:c?()=>x({id:d.id,title:d.title}):void 0},d.id))})]});let P;t[17]!==J||t[18]!==w.Body||t[19]!==I||t[20]!==K?(P=s.jsxs(w.Body,{children:[I,K,J]}),t[17]=J,t[18]=w.Body,t[19]=I,t[20]=K,t[21]=P):P=t[21];let H;t[22]!==P||t[23]!==A.Content?(H=s.jsx(A.Content,{children:P}),t[22]=P,t[23]=A.Content,t[24]=H):H=t[24];let E;t[25]!==n?(E=s.jsx(xe,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{rs as default};
@@ -0,0 +1 @@
1
+ import{T as V,W as C,aH as ne,aJ as le,aK as he,aI as xe,ba as me,e as U,I as ge,H as be,r as O,j as s,D as Ee,o as Q,C as ye,q as oe,G as re,a as J,K as B,n as ve,c as ue,B as L,t as je,E as $e}from"./index-Bll1AlZi.js";import{i as Re}from"./AlertCircle-Dk6vk346.js";import{P as te}from"./index-Bgv8YQhF.js";import{S as ae}from"./skeleton-CxMjy9Kg.js";import{b as _e,a as ce,S as de,c as Fe}from"./settings-section-CcspUfab.js";import{u as X,b as se,c as Se}from"./use-ai-providers-BDbyWdvc.js";import{i as Oe}from"./CheckCircle-ieh2HpZJ.js";import{p as Me}from"./chat-context-DEKG6yp4.js";import{e as Te,f as Ue}from"./use-organization-settings-B5dKExdR.js";import{M as ze}from"./select-model-D2KMm6n2.js";import{u as qe}from"./use-debounced-autosave-b8Qk2OvK.js";import{I as ie}from"./input-CMMOM0dD.js";import{a as fe,T as Le}from"./toggle-group-CcV2qfqh.js";import{b as ke,c as Ie,d as Ce,f as Ne,a as Pe,e as we,g as Ae,A as De}from"./alert-dialog-C_C5CWIi.js";import{u as Y}from"./studio-tools-I8Y7AvNq.js";import{s as Ve}from"./Plus-CSmw6cpp.js";import{i as Be}from"./Tool01-CSM07Bd3.js";import{s as Ge}from"./Trash01-BOiUMUTV.js";import{A as Qe}from"./avatar-DI2KQvq0.js";import{O as Ke,P as We,c as pe}from"./agent-icons-0as3WkuR.js";import{a as Ye}from"./RefreshCcw01-Ct_5xx8z.js";import{s as He}from"./Eye-DjmQZ2p3.js";import{d as Je,b as Xe,c as Ze,a as et,D as tt}from"./dialog-BE3BWPis.js";import{S as st}from"./spinner-Dstb6AhM.js";import{f as it}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as ot}from"./require-capability-CQkA6hP5.js";import"./sidebar-hk7mPADd.js";import"./LayoutLeft-Ozgz9jeL.js";import"./tooltip-B2vnmSMM.js";import"./sheet-DokH5LKH.js";import"./X-LT7RIKGm.js";import"./card-C0qmaAJH.js";import"./ArrowUpRight-4oEjocH3.js";import"./use-mcp-client-Des-fSV9.js";import"./tab-id-D_jK7L5o.js";import"./decopilot-sse-pool-Keqs3wfV.js";import"./create-sse-subscription-BS5983N4.js";import"./use-virtual-mcp-71PpEQrs.js";import"./use-collections-DI2EpqEk.js";import"./drawer-BSFXr7hp.js";import"./User01-CMlKZMq6.js";import"./checkbox-ClCQ7aIa.js";import"./Check-xMlMIzVH.js";import"./select-CTk6Rsq0.js";import"./ChevronDown-DXk0XLak.js";import"./ChevronUp-CDwUhj6r.js";import"./Key01-u8nOkLN5.js";import"./SearchMd-DXp3IUvU.js";import"./Settings02-DttqwSGe.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-BBuvzSNf.js";import"./ChevronRight-TZkuqway.js";import"./connect-desktop-dialog-Bi-Fd5NF.js";import"./Stars01-U1zM7H-d.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-cYRWRLhr.js";import"./access-gate-CAbN0Agd.js";import"./capability-load-error-DMe1nIxk.js";V({title:C(),url:C(),icon:C()});V({registries:le(C(),V({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ne(C()).describe("List of MCP app_name or app_id values to hide from the store.")});const H=V({keyId:C(),modelId:C(),title:C().optional()}).nullable();xe(["fast","smart","thinking","image","web_research"]);xe(["fast","smart","thinking"]);const rt=V({tiers:V({fast:H,smart:H,thinking:H,image:H,web_research:H})});V({ids:ne(C()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});V({id:C().describe("Brand context ID"),name:C().describe("Company name"),domain:C().describe("Company domain (e.g. example.com)"),overview:C().describe("Company overview / description"),logo:C().nullable().optional().describe("Logo URL"),favicon:C().nullable().optional().describe("Favicon URL"),ogImage:C().nullable().optional().describe("OG image URL"),fonts:V({heading:C().optional().describe("Font family for headings"),body:C().optional().describe("Font family for body text"),code:C().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:V({primary:C().optional().describe("Primary brand color (hex)"),secondary:C().optional().describe("Secondary brand color (hex)"),accent:C().optional().describe("Accent / highlight color (hex)"),background:C().optional().describe("Background color (hex)"),foreground:C().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ne(le(C(),me())).nullable().optional().describe("Brand images"),metadata:le(C(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:C().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const lt=e=>e.capabilities?.includes("image")===!0,nt=e=>{if(e.asyncResearch===!0)return!0;const t=e.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return t.includes("sonar")||t.includes("deepresearch")},at=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:lt},{key:"web_research",label:"Web research",description:"Web search and deep research",filter:nt}];function ct(e){const t=U.c(20),{slot:i,onSlotChange:n,filterModels:o,defaultKeyId:l}=e,r=X(),[x,_]=O.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&_(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let a;t[2]!==d?(a=[d],t[2]=d,t[3]=a):a=t[3],O.useEffect(b,a);const m=x??l;let c;t[4]!==m||t[5]!==r?(c=m?r.find(y=>y.id===m):null,t[4]=m,t[5]=r,t[6]=c):c=t[6];const u=c,{models:g,isLoading:v}=se(o?m??void 0:void 0),j=o?v||g.some(o):!0;let f;t[7]!==i||t[8]!==u?.providerId?(f=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=f):f=t[9];const k=f;if(o&&!j){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>_(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==n?(h=y=>{const R=y.keyId??m??"";_(R),n({keyId:R,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=n,t[14]=h):h=t[14];let p;return t[15]!==m||t[16]!==o||t[17]!==k||t[18]!==h?(p=s.jsx(ze,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:o,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=o,t[17]=k,t[18]=h,t[19]=p):p=t[19],p}function dt(e){const t=U.c(2),{isPending:i,showSaved:n}=e;if(i){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=o):o=t[0],o}if(n){let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Oe,{size:12}),"Saved"]}),t[1]=o):o=t[1],o}return null}function mt(){const e=U.c(42),t=X(),i=Te(),n=t.length>0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ge(rt),e[0]=o):o=e[0];let l;e[1]!==i?(l={resolver:o,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const r=be(l),{mutate:x,isPending:_,isSuccess:b}=Ue(),d=r.formState.isDirty;let a;e[3]!==r||e[4]!==i||e[5]!==x?(a={delayMs:250,save:async()=>{const S=r.getValues();x(S,{onSuccess:()=>r.reset(S,{keepValues:!0}),onError:w=>{r.reset(i),Q.error(`Failed to save: ${w.message}`)}})}},e[3]=r,e[4]=i,e[5]=x,e[6]=a):a=e[6];const{schedule:m}=qe(a),c=t[0],u=t[1],g=t[2],{models:v}=se(c?.id),{models:j}=se(u?.id),{models:f}=se(g?.id);let k,I;e[7]!==r||e[8]!==n?(k=()=>{n||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_research:null}})},I=[n,r],e[7]=r,e[8]=n,e[9]=k,e[10]=I):(k=e[9],I=e[10]),O.useEffect(k,I);let h;e[11]!==t||e[12]!==r||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==v||e[17]!==j||e[18]!==f?(h=()=>{const S=r.getValues(),w=new Set(t.map(ut)),$={};c?.id&&($[c.id]=v),u?.id&&($[u.id]=j),g?.id&&($[g.id]=f);const P=W=>W!=null&&!w.has(W.keyId),N={fast:P(S.tiers.fast)?null:S.tiers.fast,smart:P(S.tiers.smart)?null:S.tiers.smart,thinking:P(S.tiers.thinking)?null:S.tiers.thinking,image:P(S.tiers.image)?null:S.tiers.image,web_research:P(S.tiers.web_research)?null:S.tiers.web_research},q=!N.fast||!N.smart||!N.thinking||!N.image||!N.web_research,z=N.fast===S.tiers.fast&&N.smart===S.tiers.smart&&N.thinking===S.tiers.thinking&&N.image===S.tiers.image&&N.web_research===S.tiers.web_research;if(!q&&z)return;const G=Me(t,$);r.reset({tiers:{fast:N.fast??G.chat.fast,smart:N.smart??G.chat.smart,thinking:N.thinking??G.chat.thinking,image:N.image??G.image,web_research:N.web_research??G.webResearch}},{keepDirty:!0})},e[11]=t,e[12]=r,e[13]=c,e[14]=u,e[15]=g,e[16]=v,e[17]=j,e[18]=f,e[19]=h):h=e[19];const p=c?.id,y=u?.id,R=g?.id;let M;e[20]!==t||e[21]!==r||e[22]!==v||e[23]!==j||e[24]!==f||e[25]!==p||e[26]!==y||e[27]!==R?(M=[r,t,v,j,f,p,y,R],e[20]=t,e[21]=r,e[22]=v,e[23]=j,e[24]=f,e[25]=p,e[26]=y,e[27]=R,e[28]=M):M=e[28],O.useEffect(h,M);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const F=b&&!d;let A;e[30]!==_||e[31]!==F?(A=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(dt,{isPending:_,showSaved:F})]}),e[30]=_,e[31]=F,e[32]=A):A=e[32];let D;e[33]!==t[0]?.id||e[34]!==r.control||e[35]!==m?(D=at.map(S=>s.jsx(Ee,{control:r.control,name:`tiers.${S.key}`,render:w=>{const{field:$}=w;return s.jsx(_e,{title:S.label,description:S.description,action:s.jsx(ct,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:S.filter,onSlotChange:P=>{$.onChange(P),m()}})})}},S.key)),e[33]=t[0]?.id,e[34]=r.control,e[35]=m,e[36]=D):D=e[36];let K;e[37]!==D?(K=s.jsx(ce,{children:D}),e[37]=D,e[38]=K):K=e[38];let E;return e[39]!==A||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[A,K]}),e[39]=A,e[40]=K,e[41]=E):E=e[41],E}function ut(e){return e.id}const ft={usd:[10,20,100],brl:[50,100,500]};function pt(){const e=U.c(26),t=Y(),[i,n]=O.useState(!1),{mutate:o,isPending:l}=J({mutationFn:async h=>{const{url:p}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return p},onSuccess:xt,onError:ht}),[r,x]=O.useState(""),[_,b]=O.useState("usd"),d=_,a=parseFloat(r),m=!isNaN(a)&&a>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,v;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),v=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=v):(g=e[2],v=e[3]);let j;e[4]!==d||e[5]!==u?(j=s.jsxs(Le,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,v]}),e[4]=d,e[5]=u,e[6]=j):j=e[6];let f;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==o?(f=!i&&s.jsxs(s.Fragment,{children:[ft[d].map(h=>s.jsxs(L,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>o(h*100),children:[c,h]},h)),s.jsx(L,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=o,e[12]=f):f=e[12];let k;e[13]!==c||e[14]!==r||e[15]!==a||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==o?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:r,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(L,{className:"h-10",disabled:!m||l,onClick:()=>o(Math.round(a*100)),children:l?"...":"Add"}),s.jsx(L,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=r,e[15]=a,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=o,e[21]=k):k=e[21];let I;return e[22]!==j||e[23]!==f||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,f,k]})}),e[22]=j,e[23]=f,e[24]=k,e[25]=I):I=e[25],I}function ht(e){Q.error(`Top-up failed: ${e.message}`)}function xt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function gt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function bt(){const e=U.c(58),{org:t}=oe(),i=Y(),n=re(),o=X();let l;e[0]!==o?(l=o.find(vt),e[0]=o,e[1]=l):l=e[1];const r=l,[x,_]=O.useState(!1);let b;e[2]!==r||e[3]!==i?(b=async()=>{r&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:r.id})},e[2]=r,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==n?(d=()=>{n.invalidateQueries({queryKey:B.aiProviderKeys(t.id)}),n.invalidateQueries({queryKey:B.aiProviders(t.id)}),Q.success("Deco AI Gateway disconnected"),_(!1)},e[5]=t.id,e[6]=n,e[7]=d):d=e[7];let a;e[8]!==b||e[9]!==d?(a={mutationFn:b,onSuccess:d,onError:yt},e[8]=b,e[9]=d,e[10]=a):a=e[10];const{mutate:m,isPending:c}=J(a);let u;e[11]!==t.id?(u=B.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!r;let v;e[13]!==i?(v=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=v):v=e[14];let j;e[15]!==u||e[16]!==g||e[17]!==v?(j={queryKey:u,enabled:g,staleTime:6e4,queryFn:v},e[15]=u,e[16]=g,e[17]=v,e[18]=j):j=e[18];const{data:f,isLoading:k,refetch:I,isFetching:h}=ve(j);if(!r)return null;const p=f?.balanceCents!=null?f.balanceCents/100:null;let y;e[19]!==p?(y=p!=null?`$${p.toFixed(2)}`:"—",e[19]=p,e[20]=y):y=e[20];const R=y;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>_(!0),e[22]=T):T=e[22];let F;e[23]!==c?(F=s.jsxs("div",{className:"flex items-center justify-between",children:[M,s.jsx(L,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=F):F=e[24];let A;e[25]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsxs(ke,{children:[s.jsx(Ie,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ce,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=A):A=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(Ne,{children:"Cancel"}),e[26]=D):D=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[A,s.jsxs(we,{children:[D,s.jsx(Ae,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(De,{open:x,onOpenChange:_,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let S;e[32]!==p||e[33]!==R||e[34]!==h||e[35]!==k?(S=k||h?s.jsx(ae,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",p!=null&&gt(p)),children:R}),e[32]=p,e[33]=R,e[34]=h,e[35]=k,e[36]=S):S=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const $=h&&"animate-spin";let P;e[39]!==$?(P=ue($),e[39]=$,e[40]=P):P=e[40];let N;e[41]!==P?(N=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=N):N=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==N?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:N}),e[43]=h,e[44]=w,e[45]=N,e[46]=q):q=e[46];let z;e[47]!==S||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[S,q]}),e[47]=S,e[48]=q,e[49]=z):z=e[49];let G;e[50]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=G):G=e[50];let W;e[51]!==z?(W=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,G]}),e[51]=z,e[52]=W):W=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(pt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==F||e[55]!==E||e[56]!==W?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[F,E,W,Z]})})}),e[54]=F,e[55]=E,e[56]=W,e[57]=ee):ee=e[57],ee}function yt(e){Q.error(`Failed to disconnect: ${e.message}`)}function vt(e){return e.providerId==="deco"}function jt(){const e=U.c(8),{org:t}=oe(),i=Y(),n=re();let o;e[0]!==i?(o=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=o):o=e[1];let l;e[2]!==t||e[3]!==n?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),n.invalidateQueries({queryKey:B.aiProviderKeys(t.id)}),n.invalidateQueries({queryKey:B.aiProviders(t.id)}),Q.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=n,e[4]=l):l=e[4];let r;return e[5]!==o||e[6]!==l?(r={mutationFn:o,onSuccess:l,onError:_t},e[5]=o,e[6]=l,e[7]=r):r=e[7],J(r)}function _t(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),Q.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function St(){const e=U.c(10),{mutate:t,isPending:i}=jt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=o):o=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=r):r=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const _=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==_?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[o,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,r,s.jsx(L,{variant:"outline",disabled:i,onClick:x,children:_})]})]}),e[6]=i,e[7]=x,e[8]=_,e[9]=b):b=e[9],b}const kt=V({label:C().min(1,"Label is required").max(100),apiKey:C().optional(),baseUrl:C().optional()});function It({providerKey:e,provider:t,preset:i,maskedKey:n,currentLabel:o,currentBaseUrl:l,onCancel:r,onSuccess:x}){const{org:_}=oe(),b=Y(),d=re(),[a,m]=O.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:v,watch:j,formState:{errors:f}}=be({resolver:ge(kt),defaultValues:{label:o,apiKey:"",baseUrl:l??""}}),k=j("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async p=>{let y;p.apiKey?c?y=JSON.stringify({baseUrl:p.baseUrl||l||"",apiKey:p.apiKey}):y=p.apiKey:c&&p.baseUrl&&p.baseUrl!==l&&(y=JSON.stringify({baseUrl:p.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:p.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:B.aiProviderKeys(_.id)}),d.invalidateQueries({queryKey:B.aiProviders(_.id)}),Q.success("Provider updated"),x()},onError:p=>Q.error(`Failed to update: ${p.message}`)});return s.jsxs("form",{onSubmit:v(p=>I(p)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),f.label&&s.jsx("p",{className:"text-xs text-destructive",children:f.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:a&&k?"text":"password",placeholder:n,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!a),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:a?s.jsx(Ye,{size:14}):s.jsx(He,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Je,{children:[s.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:r,disabled:h,children:"Cancel"}),s.jsx(L,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function Ct(e){const t=U.c(28),{providerKey:i,provider:n,open:o,onOpenChange:l}=e,r=Y();let x;t[0]!==n.id||t[1]!==i.presetId?(x=n.id==="openai-compatible"&&i.presetId?Ke.find(k=>k.id===i.presetId):void 0,t[0]=n.id,t[1]=i.presetId,t[2]=x):x=t[2];const _=x,b=_?.name??n.name;let d;t[3]!==i.id?(d=B.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let a;t[5]!==i.id||t[6]!==r?(a=()=>r.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=r,t[7]=a):a=t[7];let m;t[8]!==o||t[9]!==d||t[10]!==a?(m={queryKey:d,queryFn:a,enabled:o,staleTime:0},t[8]=o,t[9]=d,t[10]=a,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(Xe,{children:s.jsxs(Ze,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let v;t[14]!==u||t[15]!==l||t[16]!==_||t[17]!==c||t[18]!==n||t[19]!==i?(v=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(st,{})}):s.jsx(It,{providerKey:i,provider:n,preset:_,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=_,t[17]=c,t[18]=n,t[19]=i,t[20]=v):v=t[20];let j;t[21]!==g||t[22]!==v?(j=s.jsxs(et,{className:"sm:max-w-md",children:[g,v]}),t[21]=g,t[22]=v,t[23]=j):j=t[23];let f;return t[24]!==l||t[25]!==o||t[26]!==j?(f=s.jsx(tt,{open:o,onOpenChange:l,children:j}),t[24]=l,t[25]=o,t[26]=j,t[27]=f):f=t[27],f}function Nt(e){const t=U.c(48),{providerKey:i,provider:n}=e,{org:o}=oe(),l=Y(),r=re(),[x,_]=O.useState(!1),[b,d]=O.useState(!1),a=n.id==="openai-compatible";let m;t[0]!==a||t[1]!==i.presetId?(m=a&&i.presetId?Ke.find(q=>q.id===i.presetId):void 0,t[0]=a,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:a?"Custom OpenAI-compatible":n.name,g=c?.logo??n.logo;let v;e:{if(a){v=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=it(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],v=`${q} · added ${z} ago`}const j=v;let f;t[5]!==i.id||t[6]!==l?(f=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=f):f=t[7];let k;t[8]!==o||t[9]!==i.id||t[10]!==r?(k=()=>{r.invalidateQueries({queryKey:B.aiProviderKeys(o.id)}),r.invalidateQueries({queryKey:B.aiProviders(o.id)}),r.invalidateQueries({queryKey:B.aiProviderModels(o.id,i.id)}),Q.success("Key deleted"),_(!1)},t[8]=o,t[9]=i.id,t[10]=r,t[11]=k):k=t[11];let I;t[12]!==f||t[13]!==k?(I={mutationFn:f,onSuccess:k,onError:Pt},t[12]=f,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:p}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Qe,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let R;t[18]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(Be,{size:14})}),t[18]=R):R=t[18];let M,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>_(!0),T=s.jsx(Ge,{size:14}),t[19]=M,t[20]=T):(M=t[19],T=t[20]);let F;t[21]!==p?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[R,s.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:p,onClick:M,children:T})]}),t[21]=p,t[22]=F):F=t[22];let A;t[23]!==j||t[24]!==u||t[25]!==F||t[26]!==y?(A=s.jsx(_e,{icon:y,title:u,description:j,action:F}),t[23]=j,t[24]=u,t[25]=F,t[26]=y,t[27]=A):A=t[27];let D;t[28]!==b||t[29]!==n||t[30]!==i?(D=s.jsx(Ct,{providerKey:i,provider:n,open:b,onOpenChange:d}),t[28]=b,t[29]=n,t[30]=i,t[31]=D):D=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ie,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(ke,{children:[K,s.jsxs(Ce,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let S;t[35]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Ne,{children:"Cancel"}),t[35]=S):S=t[35];let w;t[36]!==h?(w=s.jsxs(we,{children:[S,s.jsx(Ae,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let $;t[38]!==E||t[39]!==w?($=s.jsxs(Pe,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=$):$=t[40];let P;t[41]!==x||t[42]!==$?(P=s.jsx(De,{open:x,onOpenChange:_,children:$}),t[41]=x,t[42]=$,t[43]=P):P=t[43];let N;return t[44]!==A||t[45]!==D||t[46]!==P?(N=s.jsxs(s.Fragment,{children:[A,D,P]}),t[44]=A,t[45]=D,t[46]=P,t[47]=N):N=t[47],N}function Pt(e){return Q.error(`Failed to delete key: ${e.message}`)}function wt(e){const t=U.c(11),{onConnectClick:i}=e,n=X(),o=Se();let l;t[0]!==o?.providers?(l=o?.providers??[],t[0]=o?.providers,t[1]=l):l=t[1];const r=l;let x;if(t[2]!==n||t[3]!==i||t[4]!==r){let _;t[6]!==r?(_=m=>({key:m,provider:r.find(c=>c.id===m.providerId)}),t[6]=r,t[7]=_):_=t[7];const b=n.filter(Kt).map(_).filter(Dt);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ve,{size:14}),t[8]=d):d=t[8];let a;t[9]!==i?(a=s.jsxs(L,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=a):a=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:a,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(At)})}),t[2]=n,t[3]=i,t[4]=r,t[5]=x}else x=t[5];return x}function At(e){const{key:t,provider:i}=e;return s.jsx(Nt,{providerKey:t,provider:i},t.id)}function Dt(e){return e.provider!==void 0}function Kt(e){return e.providerId!=="deco"}function Et(e){const t=U.c(3),{error:i}=e;let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Re,{size:16}),t[0]=n):n=t[0];let o;return t[1]!==i.message?(o=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=o):o=t[2],o}function $t(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Rt),e[0]=t,e[1]=i):i=e[1];const n=i,o=t.length>0,[l,r]=O.useState(!1),[x,_]=O.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const a=d;if(!o){let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=()=>r(!0),e[4]=j):j=e[4];let f;e[5]!==a?(f=s.jsx(We,{providers:a,onSelect:_,onShowAll:j}),e[5]=a,e[6]=f):f=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=R=>{R||(_(null),r(!1))},e[7]=I):I=e[7];const h=x??void 0;let p;e[8]!==k||e[9]!==h?(p=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=p):p=e[10];let y;return e[11]!==f||e[12]!==p?(y=s.jsxs(s.Fragment,{children:[f,p]}),e[11]=f,e[12]=p,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(O.Suspense,{fallback:s.jsx(ae,{className:"h-16 w-full"}),children:s.jsx(mt,{})}),e[14]=m):m=e[14];let c;e[15]!==n?(c=n?s.jsx(bt,{}):s.jsx(St,{}),e[15]=n,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(wt,{onConnectClick:()=>r(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:r}),e[18]=l,e[19]=g):g=e[19];let v;return e[20]!==c||e[21]!==g?(v=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=v):v=e[22],v}function Rt(e){return e.providerId==="deco"}function Ft(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Fe,{children:[t,s.jsx($e,{fallback:Ot,children:s.jsx(O.Suspense,{fallback:s.jsx(ae,{className:"h-64 w-full"}),children:s.jsx($t,{})})})]})})})}),e[1]=i):i=e[1],i}function Ot(e){const{error:t}=e;return s.jsx(Et,{error:t??new Error("Failed to load AI providers")})}function qs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ot,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Ft,{})}),e[0]=t):t=e[0],t}export{qs as default};
@@ -1 +1 @@
1
- import{e as n,c as o,j as c,bt as d}from"./index-biiHZ5l9.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
1
+ import{e as n,c as o,j as c,bt as d}from"./index-Bll1AlZi.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
@@ -1,4 +1,4 @@
1
- import{r as i,bx as m,j as r,dg as A,de as w,df as T,dB as O,bE as M,a8 as I,cz as z,dC as D,cA as F,ds as L,ag as B,dh as G,cB as k,e as n,c as p,dD as v}from"./index-biiHZ5l9.js";var x="AlertDialog",[H]=B(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(G,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(F,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(k,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,K]=H(f),Q=L("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(Q,{children:a}),r.jsx(X,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});C.displayName=E;var U="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=U;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{r as i,bx as m,j as r,dg as A,de as w,df as T,dB as O,bE as M,a8 as I,cz as z,dC as D,cA as F,ds as L,ag as B,dh as G,cB as k,e as n,c as p,dD as v}from"./index-Bll1AlZi.js";var x="AlertDialog",[H]=B(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(G,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(F,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(k,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,K]=H(f),Q=L("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(Q,{children:a}),r.jsx(X,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});C.displayName=E;var U="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=U;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
3
  You can add a description to the \`${f}\` by passing a \`${E}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
@@ -0,0 +1 @@
1
+ import{e as W,r as B,j as e,c as X,l as Y}from"./index-Bll1AlZi.js";import{i as Z}from"./ChevronRight-TZkuqway.js";import{S as tt}from"./scroll-area-SRbC7c25.js";import{aa as et,ab as rt,e as ot}from"./index-apuzt69p.js";import{c as it}from"./save-referenced-block-JBVOc1Wy.js";import{S as mt}from"./schema-form-BLq0KNxn.js";import{S as pt}from"./save-status-Dfy3Cw0L.js";import"./select-CTk6Rsq0.js";import"./tooltip-B2vnmSMM.js";import"./Check-xMlMIzVH.js";import"./ChevronDown-DXk0XLak.js";import"./ChevronUp-CDwUhj6r.js";import"./agent-capabilities-CH2iEpSS.js";import"./chat-context-DEKG6yp4.js";import"./tab-id-D_jK7L5o.js";import"./use-mcp-client-Des-fSV9.js";import"./decopilot-sse-pool-Keqs3wfV.js";import"./create-sse-subscription-BS5983N4.js";import"./studio-tools-I8Y7AvNq.js";import"./use-virtual-mcp-71PpEQrs.js";import"./use-collections-DI2EpqEk.js";import"./use-ai-providers-BDbyWdvc.js";import"./use-organization-settings-B5dKExdR.js";import"./pair-BidrJ4sX.js";import"./agent-icon-DyETFFvd.js";import"./AlertCircle-Dk6vk346.js";import"./Tool01-CSM07Bd3.js";import"./SwitchHorizontal01-DUBxuMB8.js";import"./RefreshCcw01-Ct_5xx8z.js";import"./XCircle-fZmWWsk8.js";import"./ArrowUpRight-4oEjocH3.js";import"./ZapSquare-Br5HjwCx.js";import"./Users03-C19XPgsH.js";import"./CheckCircle-ieh2HpZJ.js";import"./ChevronLeft-z0R4UDTf.js";import"./DotsVertical-dauL8_mz.js";import"./Container-BuYdkyve.js";import"./Eye-DjmQZ2p3.js";import"./ZoomOut-DiWWUJB1.js";import"./Globe01-BFX2DjNo.js";import"./FilterLines-DCVUz1mF.js";import"./Star01-s_hRJjwq.js";import"./Palette-CJj0LVDj.js";import"./HardDrive-ep-sJwLU.js";import"./Stars02-Cg2K8h2t.js";import"./Key01-u8nOkLN5.js";import"./LayoutLeft-Ozgz9jeL.js";import"./LinkExternal01-C_bnt3ki.js";import"./Monitor01-BBuvzSNf.js";import"./Sun-D1pch37z.js";import"./Play-BUy7F0as.js";import"./Plus-CSmw6cpp.js";import"./SearchMd-DXp3IUvU.js";import"./Settings02-DttqwSGe.js";import"./Shield01-BlrpeOP8.js";import"./Stars01-U1zM7H-d.js";import"./Trash01-BOiUMUTV.js";import"./Upload01-B45bupsd.js";import"./User01-CMlKZMq6.js";import"./Users01-CHcmgQX1.js";import"./XClose-CXQHotFO.js";import"./X-LT7RIKGm.js";import"./Zap-DhYBCL8w.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CyNGh3eK.js";import"./file-type-icon-I99Qy2JI.js";import"./dialog-BE3BWPis.js";import"./content-blocks-o63cs2vh.js";import"./types-DsBzghfJ.js";import"./shell-layout-DO1LZiwY.js";import"./avatar-DI2KQvq0.js";import"./required-auth-layout-Sv9_QEzP.js";import"./useRouterState-l6E4h2DF.js";import"./use-org-sso-Bez1Sajf.js";import"./integration-icon-DblM7d27.js";import"./use-navigate-to-agent-TzPRxzJx.js";import"./use-connection-Cam2HslE.js";import"./use-mcp-prompts-d7xtcVsP.js";import"./form-Bn5_lJ6b.js";import"./label-cKO6vIjy.js";import"./input-CMMOM0dD.js";import"./spinner-Dstb6AhM.js";import"./drawer-BSFXr7hp.js";import"./collection-search-uQS9yrST.js";import"./tabs-2_PrfGe1.js";import"./toggle-group-CcV2qfqh.js";import"./connect-desktop-dialog-Bi-Fd5NF.js";import"./agent-icons-0as3WkuR.js";import"./checkbox-ClCQ7aIa.js";import"./skeleton-CxMjy9Kg.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CcspUfab.js";import"./card-C0qmaAJH.js";import"./popover-CNh3Ozeq.js";import"./command-DZekvH1G.js";import"./index-DxNfIzhJ.js";import"./useInfiniteQuery-Dl7i7ptk.js";import"./infiniteQueryObserver-B-dakPwk.js";import"./sortable.esm-BnSJaRIy.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CVH5Hy6F.js";import"./use-registry-connections-CWiPZtVM.js";import"./extract-connection-data-BLVQkjXZ.js";import"./generate-id-D0pLsbUu.js";import"./collections-5f6Mz9W3.js";import"./collection-tabs-dTL9gxGq.js";import"./badge-DqS5s_eb.js";import"./textarea-D7mZzw_Y.js";import"./connection-form-helpers-DFXgro4O.js";import"./use-infinite-scroll-CF4jvsDL.js";import"./useSuspenseInfiniteQuery-CmT2FyND.js";import"./index-CF_awNaT.js";import"./dropdown-menu-D7fqzmBS.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-DI9OtFHe.js";import"./sidebar-hk7mPADd.js";import"./sheet-DokH5LKH.js";import"./toolbar-Vk0X9zFW.js";import"./use-create-virtual-mcp-TPoPQ6hG.js";import"./github-repo-picker-CKp3ba8m.js";import"./use-mcp-tools-DVBLMBo3.js";import"./alert-dialog-C_C5CWIi.js";import"./index-BE8dVooN.js";import"./use-org-auth-client-uSzlmndB.js";import"./hover-card-NLGI_Z11.js";import"./task-status-CyBgq1B0.js";import"./use-status-sounds-B1WepgCG.js";import"./empty-state-BumLAiri.js";import"./resizable-BTpQlX-z.js";import"./use-capability-cYRWRLhr.js";import"./header-tab-button-CbbR6n8q.js";import"./index-B-No0lhl.js";import"./user-ZvpM4E3a.js";import"./tools-list-DZyHvyxj.js";import"./switch-Ds4XHhlB.js";import"./use-debounced-autosave-b8Qk2OvK.js";import"./index-Bgv8YQhF.js";import"./search-input-JFEU6QlH.js";import"./use-secrets-CrukgaJs.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-CqS3rCYY.js";import"./view-mode-toggle-oQJDkJzK.js";import"./select-model-D2KMm6n2.js";import"./use-automations-DjpksCFK.js";import"./monaco-editor-BD33gVrt.js";import"./automation-runs-RFg521Hi.js";import"./table-BvWfaT33.js";import"./use-members-CTowYB9Z.js";import"./automation-list-row-s3KQqnbA.js";import"./calendar-CuCfbpTI.js";import"./image-field-Baxidks4.js";import"./use-file-configs-J3tDrhRd.js";function to(E){const t=W.c(51),{orgSlug:R,virtualMcpId:P,branch:$,blockKey:r,block:m,meta:p,decofile:C,title:F,excludeFields:K,schemaPending:M}=E,V=M===void 0?!1:M,a=typeof m?.__resolveType=="string"?m.__resolveType:"";let v;t[0]!==K||t[1]!==p||t[2]!==a?(v=et(a,p,K),t[0]=K,t[1]=p,t[2]=a,t[3]=v):v=t[3];const s=v;let b;t[4]!==s?(b=!!s&&Object.keys(s.properties??{}).length>0,t[4]=s,t[5]=b):b=t[5];const T=b;let g;t[6]!==m||t[7]!==r||t[8]!==p||t[9]!==F?(g=F??(m?rt(r,m,p):r),t[6]=m,t[7]=r,t[8]=p,t[9]=F,t[10]=g):g=t[10];const n=g;let j;t[11]!==$||t[12]!==R||t[13]!==P?(j={orgSlug:R,virtualMcpId:P,branch:$},t[11]=$,t[12]=R,t[13]=P,t[14]=j):j=t[14];const{save:c,isPending:A}=ot(j);let y;t[15]!==c?(y=it((l,i)=>c(l,i)),t[15]=c,t[16]=y):y=t[16];const L=y,[G,H]=B.useState(r),[J,q]=B.useState(null),[z,Q]=B.useState(0);let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=[],t[17]=S):S=t[17];const[o,O]=B.useState(S);G!==r&&(H(r),q(null),Q(st),O([]));let N;t[18]!==m?(N=m??{},t[18]=m,t[19]=N):N=t[19];const D=J??N;let k;t[20]!==r||t[21]!==a||t[22]!==c?(k=l=>{const i=l;q(i),c(r,{...i,__resolveType:a})},t[20]=r,t[21]=a,t[22]=c,t[23]=k):k=t[23];const I=k;let _;t[24]!==o||t[25]!==n?(_=o.length>0?[n,...o]:[],t[24]=o,t[25]=n,t[26]=_):_=t[26];const h=_;let d;t[27]!==o||t[28]!==h||t[29]!==n?(d=h.length>0?e.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:h.map((l,i)=>{const U=i===h.length-1;return e.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[i>0&&e.jsx(Z,{className:"size-3 shrink-0 text-muted-foreground/60"}),e.jsx("button",{type:"button",onClick:()=>O(i===0?[]:o.slice(0,i)),title:l,className:X("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",U?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:l})]},`${l}-${i}`)})}):e.jsx("span",{className:"text-sm font-medium",children:n}),t[27]=o,t[28]=h,t[29]=n,t[30]=d):d=t[30];let f;t[31]!==A?(f=e.jsx(pt,{isPending:A,isError:!1}),t[31]=A,t[32]=f):f=t[32];let u;t[33]!==d||t[34]!==f?(u=e.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[d,f]}),t[33]=d,t[34]=f,t[35]=u):u=t[35];let x;t[36]!==r||t[37]!==o||t[38]!==C||t[39]!==D||t[40]!==z||t[41]!==I||t[42]!==T||t[43]!==p||t[44]!==L||t[45]!==s||t[46]!==V?(x=e.jsx(tt,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:e.jsx("div",{className:"px-6 py-6",children:e.jsx("div",{className:"mx-auto max-w-xl",children:T?e.jsx(mt,{schema:s,value:D,onChange:I,basePath:"",breadcrumbPath:o,onBreadcrumbChange:O,decofile:C,meta:p,onSaveReferencedBlock:L},`${r}:${z}`):V?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[e.jsx(Y,{size:16,className:"animate-spin"}),"Loading app schema…"]}):e.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[36]=r,t[37]=o,t[38]=C,t[39]=D,t[40]=z,t[41]=I,t[42]=T,t[43]=p,t[44]=L,t[45]=s,t[46]=V,t[47]=x):x=t[47];let w;return t[48]!==u||t[49]!==x?(w=e.jsxs("div",{className:"flex h-full flex-col",children:[u,x]}),t[48]=u,t[49]=x,t[50]=w):w=t[50],w}function st(E){return E+1}export{to as AppEditor};
@@ -1 +1 @@
1
- import{e as l,g as m,j as t,A as f,S as h,h as x,i as r,k as p,N as u}from"./index-biiHZ5l9.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
1
+ import{e as l,g as m,j as t,A as f,S as h,h as x,i as r,k as p,N as u}from"./index-Bll1AlZi.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
@@ -1 +1 @@
1
- import{e as o,j as i}from"./index-biiHZ5l9.js";function f(r){const e=o.c(9),{children:n,visual:c}=r;let l;e[0]!==n?(l=i.jsx("section",{className:"flex flex-1 items-center justify-center bg-sidebar p-6 md:p-10",children:i.jsx("div",{className:"w-full max-w-[440px]",children:n})}),e[0]=n,e[1]=l):l=e[1];let s;e[2]!==c?(s=c??i.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[2]=c,e[3]=s):s=e[3];let t;e[4]!==s?(t=i.jsx("aside",{className:"relative hidden md:flex flex-1 overflow-hidden bg-muted",children:s}),e[4]=s,e[5]=t):t=e[5];let a;return e[6]!==l||e[7]!==t?(a=i.jsxs("main",{className:"flex min-h-screen w-full",children:[l,t]}),e[6]=l,e[7]=t,e[8]=a):a=e[8],a}export{f as A};
1
+ import{e as o,j as i}from"./index-Bll1AlZi.js";function f(r){const e=o.c(9),{children:n,visual:c}=r;let l;e[0]!==n?(l=i.jsx("section",{className:"flex flex-1 items-center justify-center bg-sidebar p-6 md:p-10",children:i.jsx("div",{className:"w-full max-w-[440px]",children:n})}),e[0]=n,e[1]=l):l=e[1];let s;e[2]!==c?(s=c??i.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[2]=c,e[3]=s):s=e[3];let t;e[4]!==s?(t=i.jsx("aside",{className:"relative hidden md:flex flex-1 overflow-hidden bg-muted",children:s}),e[4]=s,e[5]=t):t=e[5];let a;return e[6]!==l||e[7]!==t?(a=i.jsxs("main",{className:"flex min-h-screen w-full",children:[l,t]}),e[6]=l,e[7]=t,e[8]=a):a=e[8],a}export{f as A};
@@ -1 +1 @@
1
- import{e as E,r as F,c as $,j as t,B as K}from"./index-biiHZ5l9.js";import{b as O,d as B,e as I,g as L,c as H,f as Q,a as V,A as q}from"./alert-dialog-CSkQIwm8.js";import{a as G,D as J,b as U,c as W}from"./dropdown-menu-CIu58K9q.js";import{A as X,Q as Y}from"./agent-icon-DT8dQ9tq.js";import{i as Z}from"./DotsVertical-SvwN4CeV.js";import{s as ee}from"./Trash01-Cup7-ZTT.js";import{i as te}from"./Zap-Cl-JM7N9.js";import{u as se}from"./use-virtual-mcp-0jbEmvOc.js";import{u as ne}from"./use-automations-Db8x6SNU.js";function pe(a){const e=E.c(53),{automation:s,showAgent:n,onClick:r}=a,{remove:i}=ne(),[P,S]=F.useState(!1),o=se(n?s.virtual_mcp_id:void 0);let D;e[0]!==s.id||e[1]!==i?(D=()=>{i.mutate(s.id),S(!1)},e[0]=s.id,e[1]=i,e[2]=D):D=e[2];const z=D;let A;e[3]!==r?(A=l=>{l.target===l.currentTarget&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},e[3]=r,e[4]=A):A=e[4];const T=A,M=s.active&&s.trigger_count>0?"bg-emerald-500":"bg-muted-foreground/40";let c;e[5]!==M?(c=$("inline-block size-2 rounded-full shrink-0",M),e[5]=M,e[6]=c):c=e[6];const R=s.active&&s.trigger_count>0?"Active":s.active?"No triggers configured":"Paused";let m;e[7]!==c||e[8]!==R?(m=t.jsx("span",{className:c,"aria-label":R}),e[7]=c,e[8]=R,e[9]=m):m=e[9];let u;e[10]!==o?.icon||e[11]!==o?.title||e[12]!==s.name||e[13]!==n?(u=n&&t.jsx(X,{icon:o?.icon??null,name:o?.title??s.name,size:"xs",className:"shrink-0"}),e[10]=o?.icon,e[11]=o?.title,e[12]=s.name,e[13]=n,e[14]=u):u=e[14];let d;e[15]!==s.name?(d=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.name}),e[15]=s.name,e[16]=d):d=e[16];let g;e[17]!==o||e[18]!==n?(g=n&&o&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["· ",o.title]}),e[17]=o,e[18]=n,e[19]=g):g=e[19];let f;e[20]!==d||e[21]!==g?(f=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d,g]}),e[20]=d,e[21]=g,e[22]=f):f=e[22];let x;e[23]!==s.nearest_next_run_at||e[24]!==s.trigger_count?(x=t.jsx(oe,{triggerCount:s.trigger_count,nextRunAt:s.nearest_next_run_at}),e[23]=s.nearest_next_run_at,e[24]=s.trigger_count,e[25]=x):x=e[25];let p;e[26]!==f||e[27]!==x?(p=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[f,x]}),e[26]=f,e[27]=x,e[28]=p):p=e[28];let N;e[29]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(G,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:t.jsx(Z,{size:16})})}),e[29]=N):N=e[29];let y;e[30]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("div",{onClick:ie,onKeyDown:re,role:"presentation",className:"shrink-0",children:t.jsxs(J,{children:[N,t.jsx(U,{align:"end",children:t.jsxs(W,{variant:"destructive",onClick:l=>{l.stopPropagation(),S(!0)},children:[t.jsx(ee,{size:16}),"Delete"]})})]})}),e[30]=y):y=e[30];let h;e[31]!==T||e[32]!==r||e[33]!==p||e[34]!==m||e[35]!==u?(h=t.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:T,className:"group w-full flex items-center gap-3 px-4 py-3 border-b border-border text-left hover:bg-muted/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[m,u,p,y]}),e[31]=T,e[32]=r,e[33]=p,e[34]=m,e[35]=u,e[36]=h):h=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(H,{children:"Delete automation?"}),e[37]=w):w=e[37];let j;e[38]!==s.name?(j=t.jsxs(O,{children:[w,t.jsxs(B,{children:["This removes"," ",t.jsx("span",{className:"font-medium text-foreground",children:s.name})," ","and all of its triggers. This action cannot be undone."]})]}),e[38]=s.name,e[39]=j):j=e[39];let C;e[40]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Q,{children:"Cancel"}),e[40]=C):C=e[40];let _;e[41]!==z||e[42]!==i.isPending?(_=t.jsxs(I,{children:[C,t.jsx(L,{onClick:z,disabled:i.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[41]=z,e[42]=i.isPending,e[43]=_):_=e[43];let v;e[44]!==j||e[45]!==_?(v=t.jsxs(V,{children:[j,_]}),e[44]=j,e[45]=_,e[46]=v):v=e[46];let b;e[47]!==P||e[48]!==v?(b=t.jsx(q,{open:P,onOpenChange:S,children:v}),e[47]=P,e[48]=v,e[49]=b):b=e[49];let k;return e[50]!==h||e[51]!==b?(k=t.jsxs(t.Fragment,{children:[h,b]}),e[50]=h,e[51]=b,e[52]=k):k=e[52],k}function re(a){return a.stopPropagation()}function ie(a){return a.stopPropagation()}function oe(a){const e=E.c(4),{triggerCount:s,nextRunAt:n}=a;if(s===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-xs text-muted-foreground",children:"No triggers configured"}),e[0]=i):i=e[0],i}let r;return e[1]!==n||e[2]!==s?(r=t.jsx("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground min-w-0",children:n?t.jsxs(t.Fragment,{children:[t.jsx(Y,{size:12,className:"shrink-0"}),t.jsxs("span",{className:"truncate",children:["Next run ",new Date(n).toLocaleString()]})]}):t.jsxs(t.Fragment,{children:[t.jsx(te,{size:12,className:"shrink-0"}),t.jsxs("span",{className:"truncate",children:[s," trigger",s===1?"":"s"]})]})}),e[1]=n,e[2]=s,e[3]=r):r=e[3],r}export{pe as A};
1
+ import{e as E,r as F,c as $,j as t,B as K}from"./index-Bll1AlZi.js";import{b as O,d as B,e as I,g as L,c as H,f as V,a as q,A as G}from"./alert-dialog-C_C5CWIi.js";import{a as J,D as Q,b as U,c as W}from"./dropdown-menu-D7fqzmBS.js";import{A as X,R as Y}from"./agent-icon-DyETFFvd.js";import{i as Z}from"./DotsVertical-dauL8_mz.js";import{s as ee}from"./Trash01-BOiUMUTV.js";import{i as te}from"./Zap-DhYBCL8w.js";import{u as se}from"./use-virtual-mcp-71PpEQrs.js";import{u as ne}from"./use-automations-DjpksCFK.js";function pe(a){const e=E.c(53),{automation:s,showAgent:n,onClick:r}=a,{remove:i}=ne(),[P,S]=F.useState(!1),o=se(n?s.virtual_mcp_id:void 0);let D;e[0]!==s.id||e[1]!==i?(D=()=>{i.mutate(s.id),S(!1)},e[0]=s.id,e[1]=i,e[2]=D):D=e[2];const z=D;let A;e[3]!==r?(A=l=>{l.target===l.currentTarget&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},e[3]=r,e[4]=A):A=e[4];const R=A,T=s.active&&s.trigger_count>0?"bg-emerald-500":"bg-muted-foreground/40";let c;e[5]!==T?(c=$("inline-block size-2 rounded-full shrink-0",T),e[5]=T,e[6]=c):c=e[6];const M=s.active&&s.trigger_count>0?"Active":s.active?"No triggers configured":"Paused";let m;e[7]!==c||e[8]!==M?(m=t.jsx("span",{className:c,"aria-label":M}),e[7]=c,e[8]=M,e[9]=m):m=e[9];let u;e[10]!==o?.icon||e[11]!==o?.title||e[12]!==s.name||e[13]!==n?(u=n&&t.jsx(X,{icon:o?.icon??null,name:o?.title??s.name,size:"xs",className:"shrink-0"}),e[10]=o?.icon,e[11]=o?.title,e[12]=s.name,e[13]=n,e[14]=u):u=e[14];let d;e[15]!==s.name?(d=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.name}),e[15]=s.name,e[16]=d):d=e[16];let g;e[17]!==o||e[18]!==n?(g=n&&o&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["· ",o.title]}),e[17]=o,e[18]=n,e[19]=g):g=e[19];let f;e[20]!==d||e[21]!==g?(f=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d,g]}),e[20]=d,e[21]=g,e[22]=f):f=e[22];let x;e[23]!==s.nearest_next_run_at||e[24]!==s.trigger_count?(x=t.jsx(oe,{triggerCount:s.trigger_count,nextRunAt:s.nearest_next_run_at}),e[23]=s.nearest_next_run_at,e[24]=s.trigger_count,e[25]=x):x=e[25];let p;e[26]!==f||e[27]!==x?(p=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[f,x]}),e[26]=f,e[27]=x,e[28]=p):p=e[28];let N;e[29]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(J,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:t.jsx(Z,{size:16})})}),e[29]=N):N=e[29];let y;e[30]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("div",{onClick:ie,onKeyDown:re,role:"presentation",className:"shrink-0",children:t.jsxs(Q,{children:[N,t.jsx(U,{align:"end",children:t.jsxs(W,{variant:"destructive",onClick:l=>{l.stopPropagation(),S(!0)},children:[t.jsx(ee,{size:16}),"Delete"]})})]})}),e[30]=y):y=e[30];let h;e[31]!==R||e[32]!==r||e[33]!==p||e[34]!==m||e[35]!==u?(h=t.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:R,className:"group w-full flex items-center gap-3 px-4 py-3 border-b border-border text-left hover:bg-muted/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[m,u,p,y]}),e[31]=R,e[32]=r,e[33]=p,e[34]=m,e[35]=u,e[36]=h):h=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(H,{children:"Delete automation?"}),e[37]=w):w=e[37];let j;e[38]!==s.name?(j=t.jsxs(O,{children:[w,t.jsxs(B,{children:["This removes"," ",t.jsx("span",{className:"font-medium text-foreground",children:s.name})," ","and all of its triggers. This action cannot be undone."]})]}),e[38]=s.name,e[39]=j):j=e[39];let C;e[40]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(V,{children:"Cancel"}),e[40]=C):C=e[40];let _;e[41]!==z||e[42]!==i.isPending?(_=t.jsxs(I,{children:[C,t.jsx(L,{onClick:z,disabled:i.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[41]=z,e[42]=i.isPending,e[43]=_):_=e[43];let v;e[44]!==j||e[45]!==_?(v=t.jsxs(q,{children:[j,_]}),e[44]=j,e[45]=_,e[46]=v):v=e[46];let b;e[47]!==P||e[48]!==v?(b=t.jsx(G,{open:P,onOpenChange:S,children:v}),e[47]=P,e[48]=v,e[49]=b):b=e[49];let k;return e[50]!==h||e[51]!==b?(k=t.jsxs(t.Fragment,{children:[h,b]}),e[50]=h,e[51]=b,e[52]=k):k=e[52],k}function re(a){return a.stopPropagation()}function ie(a){return a.stopPropagation()}function oe(a){const e=E.c(4),{triggerCount:s,nextRunAt:n}=a;if(s===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-xs text-muted-foreground",children:"No triggers configured"}),e[0]=i):i=e[0],i}let r;return e[1]!==n||e[2]!==s?(r=t.jsx("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground min-w-0",children:n?t.jsxs(t.Fragment,{children:[t.jsx(Y,{size:12,className:"shrink-0"}),t.jsxs("span",{className:"truncate",children:["Next run ",new Date(n).toLocaleString()]})]}):t.jsxs(t.Fragment,{children:[t.jsx(te,{size:12,className:"shrink-0"}),t.jsxs("span",{className:"truncate",children:[s," trigger",s===1?"":"s"]})]})}),e[1]=n,e[2]=s,e[3]=r):r=e[3],r}export{pe as A};
@@ -0,0 +1 @@
1
+ import{e as ne,r as ce,c as be,j as t,B as fe,K as xe,n as Ve,E as tt,q as st}from"./index-Bll1AlZi.js";import{u as ze}from"./useInfiniteQuery-Dl7i7ptk.js";import{u as lt}from"./use-connection-Cam2HslE.js";import{i as nt,g as at,a as rt,u as it}from"./use-mcp-client-Des-fSV9.js";import{a as ot}from"./use-virtual-mcp-71PpEQrs.js";import{C as ct}from"./card-C0qmaAJH.js";import{a as Ke,b as qe,S as dt,d as mt}from"./sheet-DokH5LKH.js";import{c as Ge,d as He,a as Ne,e as se,b as Be,T as le}from"./table-BvWfaT33.js";import{E as Se}from"./empty-state-BumLAiri.js";import{u as ke}from"./use-infinite-scroll-CF4jvsDL.js";import{u as ut}from"./use-members-CTowYB9Z.js";import{S as ue}from"./task-status-CyBgq1B0.js";import{e as ft}from"./use-automations-DjpksCFK.js";import{u as xt}from"./studio-tools-I8Y7AvNq.js";import{u as ht}from"./useSuspenseInfiniteQuery-CmT2FyND.js";import{B as je}from"./badge-DqS5s_eb.js";import{S as gt,a as pt,b as jt,c as ge,d as bt}from"./select-CTk6Rsq0.js";import{C as Le}from"./checkbox-ClCQ7aIa.js";import{t as he}from"./ChevronDown-DXk0XLak.js";import{c as Nt,C as vt,e as Fe,d as St,a as yt,b as wt}from"./command-DZekvH1G.js";import{a as Je,b as Qe,P as Ze}from"./popover-CNh3Ozeq.js";import{A as We}from"./avatar-DI2KQvq0.js";import{n as ye}from"./ChevronUp-CDwUhj6r.js";import{n as Ie}from"./Container-BuYdkyve.js";import{i as _t}from"./FilterLines-DCVUz1mF.js";import{m as Ct,n as Tt}from"./pair-BidrJ4sX.js";import{I as Pe}from"./integration-icon-DblM7d27.js";function Ue(l){const e=ne.c(74),{options:s,onValueChange:n,defaultValue:r,placeholder:i,variant:a,animation:d,maxCount:c,modalPopover:o,asChild:j,className:N,disabled:v,onSearchChange:m}=l;let b;e[0]!==r?(b=r===void 0?[]:r,e[0]=r,e[1]=b):b=e[1];const x=b,p=i===void 0?"Select items":i,h=a===void 0?"default":a,u=d===void 0?0:d,S=c===void 0?3:c,f=o===void 0?!1:o,C=j===void 0?!1:j,w=v===void 0?!1:v,[g,y]=ce.useState(x),[T,_]=ce.useState(!1);let k,P;e[2]!==x||e[3]!==g?(k=()=>{JSON.stringify(g)!==JSON.stringify(x)&&y(x)},P=[x,g],e[2]=x,e[3]=g,e[4]=k,e[5]=P):(k=e[4],P=e[5]),ce.useEffect(k,P);let I;e[6]!==n||e[7]!==g?(I=$=>{if($.key==="Enter")_(!0);else if($.key==="Backspace"&&!$.currentTarget.value){const B=[...g];B.pop(),y(B),n(B)}},e[6]=n,e[7]=g,e[8]=I):I=e[8];const D=I;let M;e[9]!==n||e[10]!==g?(M=$=>{const B=g.includes($.value)?g.filter(me=>me!==$.value):[...g,$.value];y(B),n(B)},e[9]=n,e[10]=g,e[11]=M):M=e[11];const A=M;let L;e[12]!==n?(L=()=>{y([]),n([])},e[12]=n,e[13]=L):L=e[13];const K=L;let q;e[14]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{_(Mt)},e[14]=q):q=e[14];const Q=q;let J;e[15]!==K||e[16]!==n||e[17]!==s||e[18]!==g.length?(J=()=>{if(g.length===s.length)K();else{const $=s.map(Pt);y($),n($)}},e[15]=K,e[16]=n,e[17]=s,e[18]=g.length,e[19]=J):J=e[19];const E=J;let U;e[20]!==C?(U=C?{}:{variant:"outline"},e[20]=C,e[21]=U):U=e[21];let O;e[22]!==N?(O=be("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full max-w-xs items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 h-10 min-h-10",N),e[22]=N,e[23]=O):O=e[23];let V;e[24]!==u||e[25]!==S||e[26]!==s||e[27]!==p||e[28]!==g||e[29]!==h?(V=g.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[g.slice(0,S).map($=>{const B=s.find(ve=>ve.value===$),me=B?.icon;return t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${u}s`},children:[me&&t.jsx(me,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:B?.label})]},$)}),g.length>S&&t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${u}s`},children:["+",g.length-S]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(he,{size:20,className:"shrink-0 opacity-50"})})]}):t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:p}),t.jsx(he,{size:20,className:"shrink-0 opacity-50"})]}),e[24]=u,e[25]=S,e[26]=s,e[27]=p,e[28]=g,e[29]=h,e[30]=V):V=e[30];let F;e[31]!==w||e[32]!==U||e[33]!==O||e[34]!==V?(F=t.jsx(Je,{asChild:!0,children:t.jsx(fe,{ref:null,...U,onClick:Q,className:O,disabled:w,children:V})}),e[31]=w,e[32]=U,e[33]=O,e[34]=V,e[35]=F):F=e[35];let G;e[36]===Symbol.for("react.memo_cache_sentinel")?(G=()=>_(!1),e[36]=G):G=e[36];const X=!m;let z;e[37]!==D||e[38]!==m?(z=t.jsx(Nt,{placeholder:"Search...",onKeyDown:D,onValueChange:m,className:"rounded-t-xl"}),e[37]=D,e[38]=m,e[39]=z):z=e[39];let ee;e[40]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(vt,{children:"No results found."}),e[40]=ee):ee=e[40];let te;e[41]!==E?(te=()=>{E()},e[41]=E,e[42]=te):te=e[42];let Z;e[43]!==E?(Z=$=>{$.stopPropagation(),E()},e[43]=E,e[44]=Z):Z=e[44];const de=g.length===s.length&&s.length>0;let ae;e[45]!==de||e[46]!==E?(ae=t.jsx(Le,{checked:de,onCheckedChange:E,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:It}),e[45]=de,e[46]=E,e[47]=ae):ae=e[47];let re;e[48]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx("span",{children:"(Select All)"}),e[48]=re):re=e[48];let W;e[49]!==Z||e[50]!==ae?(W=t.jsxs("div",{className:"flex items-center w-full",onClick:Z,children:[ae,re]}),e[49]=Z,e[50]=ae,e[51]=W):W=e[51];let Y;e[52]!==te||e[53]!==W?(Y=t.jsx(Fe,{onSelect:te,className:"cursor-pointer",children:W},"all"),e[52]=te,e[53]=W,e[54]=Y):Y=e[54];let ie;if(e[55]!==s||e[56]!==g||e[57]!==A){let $;e[59]!==g||e[60]!==A?($=B=>{const me=g.includes(B.value);return t.jsx(Fe,{onSelect:()=>{A(B)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ve=>{ve.stopPropagation(),A(B)},children:[t.jsx(Le,{checked:me,onCheckedChange:()=>{A(B)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:kt}),B.icon&&t.jsx(B.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:B.label})]})},B.value)},e[59]=g,e[60]=A,e[61]=$):$=e[61],ie=s.map($),e[55]=s,e[56]=g,e[57]=A,e[58]=ie}else ie=e[58];let R;e[62]!==Y||e[63]!==ie?(R=t.jsxs(St,{className:"rounded-b-xl",children:[ee,t.jsxs(yt,{children:[Y,ie]})]}),e[62]=Y,e[63]=ie,e[64]=R):R=e[64];let H;e[65]!==X||e[66]!==z||e[67]!==R?(H=t.jsx(Qe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:G,children:t.jsxs(wt,{shouldFilter:X,className:"rounded-xl",children:[z,R]})}),e[65]=X,e[66]=z,e[67]=R,e[68]=H):H=e[68];let oe;return e[69]!==T||e[70]!==f||e[71]!==F||e[72]!==H?(oe=t.jsxs(Ze,{open:T,onOpenChange:_,modal:f,children:[F,H]}),e[69]=T,e[70]=f,e[71]=F,e[72]=H,e[73]=oe):oe=e[73],oe}function kt(l){return l.stopPropagation()}function It(l){return l.stopPropagation()}function Pt(l){return l.value}function Mt(l){return!l}const Ye=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],Dt=40;function Ts(l){const s=(l.endDate.getTime()-l.startDate.getTime())/Dt;return Ye.find(r=>r.ms>=s)?.label??"1d"}function Me(l){const e=Ye.find(i=>i.label===l);if(e)return e.ms;const s=/^(\d+)([mhd])$/.exec(l);if(!s)return 6e4;const n=parseInt(s[1],10),r=s[2];return r==="h"?n*36e5:r==="d"?n*864e5:n*6e4}function Rt(l,e){const s=new Date(l);return Me(e)>=864e5?s.toLocaleDateString([],{month:"short",day:"numeric"}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Oe(l,e){const s=Me(e);return new Date(Math.floor(l.getTime()/s)*s)}function At(l){return l>=1e4?`${(l/1e3).toFixed(1)}s`:`${Math.round(l)}ms`}function De(l){return Number.isFinite(l)?l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:Math.round(l).toLocaleString():"0"}function Re(l){return Number.isFinite(l)?`$${l.toFixed(l<1?4:2)}`:"$0.00"}function ks(l,e,s){const n=Me(s),r=Oe(e.startDate,s).getTime(),i=e.endDate.getTime(),a=new Map(l.map(c=>[Oe(new Date(c.timestamp),s).getTime(),c])),d=[];for(let c=r;c<=i;c+=n){const o=a.get(c),j=new Date(c).toISOString();d.push({t:j,ts:c,label:Rt(j,s),calls:o?.calls??0,errors:o?.errors??0,errorRate:o?.errorRate??0,avg:o?.avg??0,p50:o?.p50??0,p95:o?.p95??0,inputTokens:o?.inputTokens??0,outputTokens:o?.outputTokens??0,totalTokens:o?.totalTokens??0,costUsd:o?.costUsd??0})}return d}function Is(l,e){return e==="requests"?l.calls:e==="errors"?l.errorRate:l.avgDurationMs}function Ps(l,e){return e==="requests"?l.calls.toLocaleString():e==="errors"?`${l.errorRate.toFixed(1)}%`:At(l.avgDurationMs)}function Ae(l){return(l.run_config??{}).agent?.id??(l.virtual_mcp_id||null)}function Ee(l,e,s,n){if(!l)return n;const r=e.find(a=>a.id===l)??s?.find(a=>a.id===l);if(r?.title)return r.title;const i=nt(l);return i?at(i).title??n:l}function $e(l,e,s){return l?(e.find(r=>r.id===l)??s?.find(r=>r.id===l))?.icon??null:null}function Xe(l){return l?.data?.members??[]}function we(l){const e=ne.c(33),{thread:s,connections:n,virtualMcps:r,selectedIndex:i,total:a,onPrev:d,onNext:c}=l;let o,j;if(e[0]!==n||e[1]!==s||e[2]!==r){const k=Ae(s);o=Ee(k,r,n,""),j=$e(k,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j,v=o||s.title;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{}),e[5]=m):m=e[5];let b;e[6]!==N||e[7]!==v?(b=t.jsx(Pe,{icon:N,name:v,size:"sm",fallbackIcon:m,className:"shadow-sm shrink-0 rounded-md"}),e[6]=N,e[7]=v,e[8]=b):b=e[8];let x;e[9]!==s.title?(x=t.jsx(dt,{className:"text-sm leading-snug truncate",children:s.title}),e[9]=s.title,e[10]=x):x=e[10];let p;e[11]!==o?(p=o&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:o}),e[11]=o,e[12]=p):p=e[12];let h;e[13]!==x||e[14]!==p?(h=t.jsxs("div",{className:"min-w-0",children:[x,p]}),e[13]=x,e[14]=p,e[15]=h):h=e[15];let u;e[16]!==b||e[17]!==h?(u=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[b,h]}),e[16]=b,e[17]=h,e[18]=u):u=e[18];const S=i===0;let f;e[19]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ye,{size:14}),e[19]=f):f=e[19];let C;e[20]!==d||e[21]!==S?(C=t.jsx(fe,{size:"icon",variant:"ghost",onClick:d,disabled:S,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous thread",children:f}),e[20]=d,e[21]=S,e[22]=C):C=e[22];const w=i===a-1;let g;e[23]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(he,{size:14}),e[23]=g):g=e[23];let y;e[24]!==c||e[25]!==w?(y=t.jsx(fe,{size:"icon",variant:"ghost",onClick:c,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":"Next thread",children:g}),e[24]=c,e[25]=w,e[26]=y):y=e[26];let T;e[27]!==C||e[28]!==y?(T=t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C,y]}),e[27]=C,e[28]=y,e[29]=T):T=e[29];let _;return e[30]!==T||e[31]!==u?(_=t.jsx(mt,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[u,T]})}),e[30]=T,e[31]=u,e[32]=_):_=e[32],_}function Et(l){const e=ne.c(48),{thread:s,connections:n,virtualMcps:r,members:i}=l;let a,d;if(e[0]!==n||e[1]!==s||e[2]!==r){const M=Ae(s);a=Ee(M,r,n,""),d=$e(M,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=a,e[4]=d}else a=e[3],d=e[4];const c=d;let o;if(e[5]!==i||e[6]!==s.created_by){const M=Xe(i);let A;e[8]!==s.created_by?(A=L=>L.userId===s.created_by,e[8]=s.created_by,e[9]=A):A=e[9],o=M.find(A),e[5]=i,e[6]=s.created_by,e[7]=o}else o=e[7];const j=o;let N;e[10]!==j?.user.email||e[11]!==j?.user.name||e[12]!==s.created_by?(N=j?.user.name??j?.user.email??s.created_by?.substring(0,8)??"—",e[10]=j?.user.email,e[11]=j?.user.name,e[12]=s.created_by,e[13]=N):N=e[13];const v=N,m=j?.user.image??void 0;let b;e[14]!==s.created_at?(b=new Date(s.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=s.created_at,e[15]=b):b=e[15];const x=b,p=ue[s.status]??ue.completed,h=p.icon;let u;e[16]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=u):u=e[16];let S;e[17]!==h||e[18]!==p.iconClassName?(S=t.jsx(h,{size:13,className:p.iconClassName}),e[17]=h,e[18]=p.iconClassName,e[19]=S):S=e[19];let f;e[20]!==p.labelColor?(f=be("text-sm",p.labelColor),e[20]=p.labelColor,e[21]=f):f=e[21];let C;e[22]!==p.label||e[23]!==f?(C=t.jsx("span",{className:f,children:p.label}),e[22]=p.label,e[23]=f,e[24]=C):C=e[24];let w;e[25]!==S||e[26]!==C?(w=t.jsxs("div",{children:[u,t.jsxs("div",{className:"flex items-center gap-1.5",children:[S,C]})]}),e[25]=S,e[26]=C,e[27]=w):w=e[27];let g;e[28]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=g):g=e[28];let y;e[29]!==x?(y=t.jsxs("div",{children:[g,t.jsx("div",{className:"text-sm text-foreground",children:x})]}),e[29]=x,e[30]=y):y=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"User"}),e[31]=T):T=e[31];let _;e[32]!==m||e[33]!==v?(_=t.jsx(We,{url:m,fallback:v,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=m,e[33]=v,e[34]=_):_=e[34];let k;e[35]!==v?(k=t.jsx("span",{className:"text-sm text-foreground",children:v}),e[35]=v,e[36]=k):k=e[36];let P;e[37]!==_||e[38]!==k?(P=t.jsxs("div",{children:[T,t.jsxs("div",{className:"flex items-center gap-2",children:[_,k]})]}),e[37]=_,e[38]=k,e[39]=P):P=e[39];let I;e[40]!==c||e[41]!==a?(I=a&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Agent"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Pe,{icon:c,name:a,size:"xs",fallbackIcon:t.jsx(Ie,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),t.jsx("span",{className:"text-sm text-foreground",children:a})]})]}),e[40]=c,e[41]=a,e[42]=I):I=e[42];let D;return e[43]!==y||e[44]!==P||e[45]!==I||e[46]!==w?(D=t.jsxs("div",{className:"px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm",children:[w,y,P,I]}),e[43]=y,e[44]=P,e[45]=I,e[46]=w,e[47]=D):D=e[47],D}function $t(l){const e=ne.c(72),{thread:s,usage:n,members:r,connections:i,virtualMcps:a,onClick:d,lastRowRef:c}=l;let o,j;if(e[0]!==i||e[1]!==s||e[2]!==a){const F=Ae(s);o=Ee(F,a,i,"—"),j=$e(F,a,i),e[0]=i,e[1]=s,e[2]=a,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j;let v;if(e[5]!==r||e[6]!==s.created_by){const F=Xe(r);let G;e[8]!==s.created_by?(G=X=>X.userId===s.created_by,e[8]=s.created_by,e[9]=G):G=e[9],v=F.find(G),e[5]=r,e[6]=s.created_by,e[7]=v}else v=e[7];const m=v;let b;e[10]!==m?.user.email||e[11]!==m?.user.name||e[12]!==s.created_by?(b=m?.user.name??m?.user.email??s.created_by?.substring(0,8)??"—",e[10]=m?.user.email,e[11]=m?.user.name,e[12]=s.created_by,e[13]=b):b=e[13];const x=b,p=m?.user.image??void 0;let h,u;if(e[14]!==s.created_at){const F=new Date(s.created_at);h=F.toLocaleDateString("en-US",{month:"short",day:"numeric"}),u=F.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=s.created_at,e[15]=h,e[16]=u}else h=e[15],u=e[16];const S=u,f=ue[s.status]??ue.completed,C=f.icon;let w;e[17]!==s.title?(w=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[17]=s.title,e[18]=w):w=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Ie,{}),e[19]=g):g=e[19];let y;e[20]!==N||e[21]!==o?(y=t.jsx(Pe,{icon:N,name:o,size:"xs",fallbackIcon:g,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=N,e[21]=o,e[22]=y):y=e[22];let T;e[23]!==o?(T=t.jsx("span",{className:"truncate",children:o}),e[23]=o,e[24]=T):T=e[24];let _;e[25]!==y||e[26]!==T?(_=t.jsx(le,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,T]})}),e[25]=y,e[26]=T,e[27]=_):_=e[27];let k;e[28]!==p||e[29]!==x?(k=t.jsx(We,{url:p,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=p,e[29]=x,e[30]=k):k=e[30];let P;e[31]!==x?(P=t.jsx("span",{className:"truncate",children:x}),e[31]=x,e[32]=P):P=e[32];let I;e[33]!==k||e[34]!==P?(I=t.jsx(le,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[k,P]})}),e[33]=k,e[34]=P,e[35]=I):I=e[35];let D;e[36]!==C||e[37]!==f.iconClassName?(D=t.jsx(C,{size:14,className:f.iconClassName}),e[36]=C,e[37]=f.iconClassName,e[38]=D):D=e[38];let M;e[39]!==f.labelColor?(M=be("text-sm",f.labelColor),e[39]=f.labelColor,e[40]=M):M=e[40];let A;e[41]!==f.label||e[42]!==M?(A=t.jsx("span",{className:M,children:f.label}),e[41]=f.label,e[42]=M,e[43]=A):A=e[43];let L;e[44]!==D||e[45]!==A?(L=t.jsx(le,{className:"w-24 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[D,A]})}),e[44]=D,e[45]=A,e[46]=L):L=e[46];let K;e[47]!==n?(K=n?De(n.totalTokens):"—",e[47]=n,e[48]=K):K=e[48];let q;e[49]!==K?(q=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:K}),e[49]=K,e[50]=q):q=e[50];let Q;e[51]!==n?(Q=n&&n.costUsd>0?Re(n.costUsd):"—",e[51]=n,e[52]=Q):Q=e[52];let J;e[53]!==Q?(J=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:Q}),e[53]=Q,e[54]=J):J=e[54];let E;e[55]!==h?(E=t.jsx("div",{children:h}),e[55]=h,e[56]=E):E=e[56];let U;e[57]!==S?(U=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=U):U=e[58];let O;e[59]!==E||e[60]!==U?(O=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[E,U]}),e[59]=E,e[60]=U,e[61]=O):O=e[61];let V;return e[62]!==c||e[63]!==d||e[64]!==I||e[65]!==L||e[66]!==q||e[67]!==J||e[68]!==O||e[69]!==w||e[70]!==_?(V=t.jsxs(Ne,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:d,children:[w,_,I,L,q,J,O]}),e[62]=c,e[63]=d,e[64]=I,e[65]=L,e[66]=q,e[67]=J,e[68]=O,e[69]=w,e[70]=_,e[71]=V):V=e[71],V}const _e=100;function Lt(l){const e=ne.c(37),{client:s,locator:n,thread:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==n||e[1]!==r.id?(v=xe.threadMessages(n,r.id),e[0]=n,e[1]=r.id,e[2]=v):v=e[2];let m;e[3]!==s||e[4]!==r.id?(m=async P=>{const{pageParam:I}=P,D=I===void 0?0:I;if(!s)throw new Error("MCP client is not available");const M=await s.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:r.id,limit:_e,offset:D}});return M.structuredContent??M},e[3]=s,e[4]=r.id,e[5]=m):m=e[5];let b;e[6]!==v||e[7]!==m?(b={queryKey:v,queryFn:m,initialPageParam:0,getNextPageParam:Ot,staleTime:6e4},e[6]=v,e[7]=m,e[8]=b):b=e[8];const{data:x,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:u}=ht(b);let S;e[9]!==x.pages?(S=x.pages.flatMap(Ut).filter(Ft),e[9]=x.pages,e[10]=S):S=e[10];const f=S,C=Ct(f);let w;e[11]!==p||e[12]!==h||e[13]!==u?(w=()=>{h&&!u&&p()},e[11]=p,e[12]=h,e[13]=u,e[14]=w):w=e[14];const g=ke(w,h??!1,u);let y;e[15]!==i||e[16]!==N||e[17]!==j||e[18]!==c||e[19]!==r||e[20]!==o||e[21]!==a?(y=t.jsx(we,{thread:r,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[15]=i,e[16]=N,e[17]=j,e[18]=c,e[19]=r,e[20]=o,e[21]=a,e[22]=y):y=e[22];let T;e[23]!==i||e[24]!==d||e[25]!==r||e[26]!==a?(T=t.jsx(Et,{thread:r,connections:i,virtualMcps:a,members:d}),e[23]=i,e[24]=d,e[25]=r,e[26]=a,e[27]=T):T=e[27];let _;e[28]!==u||e[29]!==g||e[30]!==C||e[31]!==f.length?(_=f.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No messages in this thread"}):t.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:t.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[C.map((P,I)=>t.jsx("div",{ref:I===C.length-1?g:void 0,children:t.jsx(Tt,{pair:P,isLastPair:I===C.length-1,status:"ready"})},`pair-${P.user?.id??P.assistant?.id}`)),u&&t.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=u,e[29]=g,e[30]=C,e[31]=f.length,e[32]=_):_=e[32];let k;return e[33]!==y||e[34]!==T||e[35]!==_?(k=t.jsxs(t.Fragment,{children:[y,T,_]}),e[33]=y,e[34]=T,e[35]=_,e[36]=k):k=e[36],k}function Ft(l){return l.role==="user"||l.role==="assistant"}function Ut(l){return l.items??[]}function Ot(l,e){const s=l,n=e;if(!((s?.items?.length??0)<_e))return n.length*_e}function et(l){const e=ne.c(39),{thread:s,client:n,locator:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==i||e[1]!==N||e[2]!==j||e[3]!==c||e[4]!==s||e[5]!==o||e[6]!==a?(v=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[0]=i,e[1]=N,e[2]=j,e[3]=c,e[4]=s,e[5]=o,e[6]=a,e[7]=v):v=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=m):m=e[8];let b;e[9]!==v?(b=t.jsxs(t.Fragment,{children:[v,m]}),e[9]=v,e[10]=b):b=e[10];let x;e[11]!==i||e[12]!==N||e[13]!==j||e[14]!==c||e[15]!==s||e[16]!==o||e[17]!==a?(x=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[11]=i,e[12]=N,e[13]=j,e[14]=c,e[15]=s,e[16]=o,e[17]=a,e[18]=x):x=e[18];let p;e[19]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Loading conversation\\u2026"}),e[19]=p):p=e[19];let h;e[20]!==x?(h=t.jsxs(t.Fragment,{children:[x,p]}),e[20]=x,e[21]=h):h=e[21];let u;e[22]!==n||e[23]!==i||e[24]!==r||e[25]!==d||e[26]!==N||e[27]!==j||e[28]!==c||e[29]!==s||e[30]!==o||e[31]!==a?(u=t.jsx(Lt,{client:n,locator:r,thread:s,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[22]=n,e[23]=i,e[24]=r,e[25]=d,e[26]=N,e[27]=j,e[28]=c,e[29]=s,e[30]=o,e[31]=a,e[32]=u):u=e[32];let S;e[33]!==h||e[34]!==u?(S=t.jsx(ce.Suspense,{fallback:h,children:u}),e[33]=h,e[34]=u,e[35]=S):S=e[35];let f;return e[36]!==b||e[37]!==S?(f=t.jsx(tt,{fallback:b,children:S}),e[36]=b,e[37]=S,e[38]=f):f=e[38],f}function Ms(l){const e=ne.c(43),{filterAgentIds:s,filterUserIds:n,filterStatus:r,virtualMcpOptions:i,memberOptions:a,activeFiltersCount:d,onUpdateFilters:c}=l,[o,j]=ce.useState(!1);let N,v;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(_t,{size:16}),v=t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e[0]=N,e[1]=v):(N=e[0],v=e[1]);let m;e[2]!==d?(m=d>0&&t.jsxs(t.Fragment,{children:[t.jsx(je,{variant:"default",className:"sm:hidden absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:d}),t.jsx(je,{variant:"default",className:"hidden sm:flex ml-1 h-5 w-5 rounded-full p-0 items-center justify-center text-xs",children:d})]}),e[2]=d,e[3]=m):m=e[3];let b;e[4]!==m?(b=t.jsx(Je,{asChild:!0,children:t.jsxs(fe,{variant:"outline",className:"relative",children:[N,v,m]})}),e[4]=m,e[5]=b):b=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"font-medium text-sm",children:"Filter Threads"}),e[6]=x):x=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Agent"}),e[7]=p):p=e[7];let h;e[8]!==c?(h=M=>c({filterAgentIds:M.slice(0,1)}),e[8]=c,e[9]=h):h=e[9];let u;e[10]!==s||e[11]!==h||e[12]!==i?(u=t.jsxs("div",{children:[p,t.jsx(Ue,{options:i,defaultValue:s,onValueChange:h,placeholder:"All agents",variant:"secondary",className:"w-full",maxCount:1})]}),e[10]=s,e[11]=h,e[12]=i,e[13]=u):u=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"User"}),e[14]=S):S=e[14];let f;e[15]!==c?(f=M=>c({filterUserIds:M.slice(0,1)}),e[15]=c,e[16]=f):f=e[16];let C;e[17]!==n||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{children:[S,t.jsx(Ue,{options:a,defaultValue:n,onValueChange:f,placeholder:"All users",variant:"secondary",className:"w-full",maxCount:1})]}),e[17]=n,e[18]=a,e[19]=f,e[20]=C):C=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Status"}),e[21]=w):w=e[21];let g;e[22]!==c?(g=M=>c({filterStatus:M}),e[22]=c,e[23]=g):g=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(gt,{className:"w-full",children:t.jsx(pt,{})}),e[24]=y):y=e[24];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(jt,{children:[t.jsx(ge,{value:"all",children:"All statuses"}),t.jsx(ge,{value:"completed",children:"Completed"}),t.jsx(ge,{value:"active",children:"Active"}),t.jsx(ge,{value:"failed",children:"Failed"})]}),e[25]=T):T=e[25];let _;e[26]!==r||e[27]!==g?(_=t.jsxs("div",{children:[w,t.jsxs(bt,{value:r,onValueChange:g,children:[y,T]})]}),e[26]=r,e[27]=g,e[28]=_):_=e[28];let k;e[29]!==C||e[30]!==_||e[31]!==u?(k=t.jsxs("div",{className:"space-y-3",children:[u,C,_]}),e[29]=C,e[30]=_,e[31]=u,e[32]=k):k=e[32];let P;e[33]!==d||e[34]!==c?(P=d>0&&t.jsx(fe,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{c({filterAgentIds:[],filterUserIds:[],filterStatus:"all"}),j(!1)},children:"Clear all filters"}),e[33]=d,e[34]=c,e[35]=P):P=e[35];let I;e[36]!==k||e[37]!==P?(I=t.jsx(Qe,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[x,k,P]})}),e[36]=k,e[37]=P,e[38]=I):I=e[38];let D;return e[39]!==o||e[40]!==I||e[41]!==b?(D=t.jsxs(Ze,{open:o,onOpenChange:j,children:[b,I]}),e[39]=o,e[40]=I,e[41]=b,e[42]=D):D=e[42],D}const Ce=50;function Ds(l){const e=ne.c(29),{client:s,locator:n,membersData:r,allConnections:i,allVirtualMcps:a,dateRange:d,searchQuery:c,filterAgentIds:o,filterUserIds:j,filterStatus:N}=l,[v,m]=ce.useState(null),b=d.startDate.toISOString(),x=d.endDate.toISOString(),p=JSON.stringify({startDate:b,endDate:x,search:c,agentIds:o,userIds:j,status:N}),{data:h,fetchNextPage:u,hasNextPage:S,isFetchingNextPage:f,isLoading:C}=ze({queryKey:xe.threadsInfinite(n,p),queryFn:async R=>{const{pageParam:H}=R,oe=H===void 0?0:H;if(!s)throw new Error("MCP client is not available");const $=await s.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Ce,offset:oe,startDate:b,endDate:x,...c?{search:c}:{},...o&&o.length>0?{agentId:o[0]}:{},...j&&j.length>0?{userId:j[0]}:{},...N&&N!=="all"?{status:N}:{}}});return $.structuredContent??$},initialPageParam:0,getNextPageParam:Ht,staleTime:3e4}),w=(h?.pages??[]).flatMap(Gt),g=w.map(qt),{data:y}=Ve({queryKey:xe.monitoringThreadUsage(n,JSON.stringify({ids:g,startDate:b,endDate:x})),queryFn:async()=>{if(!s)throw new Error("MCP client is not available");const R=await s.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:g,startDate:b,endDate:x}});return R.structuredContent??R},enabled:!!s&&g.length>0,staleTime:3e4}),T=new Map((y?.items??[]).map(Kt)),[_,k]=ce.useState(null),[P,I]=ce.useState("desc");let D;e[0]!==_?(D=R=>{_===R?I(zt):(k(R),I("desc"))},e[0]=_,e[1]=D):D=e[1];const M=D,A=R=>{const H=T.get(R);return H?_==="cost"?H.costUsd:H.totalTokens:0},L=_?[...w].sort((R,H)=>{const oe=A(R.id),$=A(H.id);return P==="desc"?$-oe:oe-$}):w,K=v!==null?L[v]??null:null;let q;e[2]!==u||e[3]!==S||e[4]!==f?(q=()=>{S&&!f&&u()},e[2]=u,e[3]=S,e[4]=f,e[5]=q):q=e[5];const J=ke(q,S??!1,f),E=!!c||(o?.length??0)>0||(j?.length??0)>0||N&&N!=="all";let U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=()=>m(Vt),e[6]=U):U=e[6];const O=U,V=()=>m(R=>R!==null&&R<L.length-1?R+1:R),F="flex-1 flex flex-col overflow-auto min-w-0",G="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",X="flex-1 flex flex-col min-w-0",z="flex-1 min-w-0 pt-1",ee="min-w-0",te=C?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})}):w.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Se,{title:E?"No matching threads":"No threads in this time range",description:E?"Try adjusting your filters or search query.":"Try expanding the time range to see older threads."})}):t.jsxs(t.Fragment,{children:[t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0 z-20",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),t.jsx(se,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Tokens",_==="tokens"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Cost",_==="cost"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Date"})]})}),t.jsx(Be,{children:L.map((R,H)=>t.jsx($t,{thread:R,usage:T.get(R.id),members:r,connections:i,virtualMcps:a,onClick:()=>m(H),lastRowRef:H===L.length-1?J:void 0},R.id))})]}),f&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let Z;e[7]!==te?(Z=t.jsx("div",{className:G,children:t.jsx("div",{className:X,children:t.jsx("div",{className:z,children:t.jsx("div",{className:ee,children:te})})})}),e[7]=te,e[8]=Z):Z=e[8];const de=v!==null;let ae;e[9]===Symbol.for("react.memo_cache_sentinel")?(ae=R=>{R||m(null)},e[9]=ae):ae=e[9];let re;e[10]!==i||e[11]!==a||e[12]!==s||e[13]!==L||e[14]!==V||e[15]!==O||e[16]!==n||e[17]!==r||e[18]!==K||e[19]!==v?(re=K&&v!==null&&t.jsx(et,{thread:K,client:s,locator:n,connections:i,virtualMcps:a,members:r,selectedIndex:v,total:L.length,onPrev:O,onNext:V}),e[10]=i,e[11]=a,e[12]=s,e[13]=L,e[14]=V,e[15]=O,e[16]=n,e[17]=r,e[18]=K,e[19]=v,e[20]=re):re=e[20];let W;e[21]!==re?(W=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:re}),e[21]=re,e[22]=W):W=e[22];let Y;e[23]!==de||e[24]!==W?(Y=t.jsx(qe,{open:de,onOpenChange:ae,children:W}),e[23]=de,e[24]=W,e[25]=Y):Y=e[25];let ie;return e[26]!==Z||e[27]!==Y?(ie=t.jsxs("div",{className:F,children:[Z,Y]}),e[26]=Z,e[27]=Y,e[28]=ie):ie=e[28],ie}function Vt(l){return l!==null&&l>0?l-1:l}function zt(l){return l==="desc"?"asc":"desc"}function Kt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function qt(l){return l.id}function Gt(l){return l.items??[]}function Ht(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Ce))return n.length*Ce}const Te=50;function pe(l){const e=ne.c(10),{title:s,value:n,subtitle:r}=l;let i;e[0]!==s?(i=t.jsx("span",{className:"text-sm text-foreground/70",children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=t.jsx("span",{className:"text-3xl font-normal tabular-nums",children:n}),e[2]=n,e[3]=a):a=e[3];let d;e[4]!==r?(d=r&&t.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==d?(c=t.jsxs(ct,{className:"pt-4 px-4 pb-5 gap-1",children:[i,a,d]}),e[6]=i,e[7]=a,e[8]=d,e[9]=c):c=e[9],c}function Bt(l){const e=ne.c(27),{automationId:s,range:n}=l,{data:r,isLoading:i}=ft(s,n),a=r?.runs,d=r?.usage;let c;e[0]!==a?(c=a&&a.total>0?`${Math.round(a.completed/a.total*100)}%`:"—",e[0]=a,e[1]=c):c=e[1];const o=c,j=d&&d.truncated?`last ${d.sampledRuns} runs`:void 0;let N;e[2]!==i||e[3]!==a?.total?(N=i?"…":a?.total.toLocaleString()??"0",e[2]=i,e[3]=a?.total,e[4]=N):N=e[4];const v=a?`${a.completed} ok · ${a.failed} failed${a.inProgress>0?` · ${a.inProgress} running`:""}`:void 0;let m;e[5]!==N||e[6]!==v?(m=t.jsx(pe,{title:"Runs",value:N,subtitle:v}),e[5]=N,e[6]=v,e[7]=m):m=e[7];const b=i?"…":o;let x;e[8]!==b?(x=t.jsx(pe,{title:"Success rate",value:b}),e[8]=b,e[9]=x):x=e[9];let p;e[10]!==i||e[11]!==d?.totalTokens?(p=i?"…":De(d?.totalTokens??0),e[10]=i,e[11]=d?.totalTokens,e[12]=p):p=e[12];let h;e[13]!==p||e[14]!==j?(h=t.jsx(pe,{title:"Tokens",value:p,subtitle:j}),e[13]=p,e[14]=j,e[15]=h):h=e[15];let u;e[16]!==i||e[17]!==d?(u=i?"…":d&&d.costUsd>0?Re(d.costUsd):"—",e[16]=i,e[17]=d,e[18]=u):u=e[18];let S;e[19]!==u||e[20]!==j?(S=t.jsx(pe,{title:"Cost",value:u,subtitle:j}),e[19]=u,e[20]=j,e[21]=S):S=e[21];let f;return e[22]!==S||e[23]!==m||e[24]!==x||e[25]!==h?(f=t.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[m,x,h,S]}),e[22]=S,e[23]=m,e[24]=x,e[25]=h,e[26]=f):f=e[26],f}function Jt(l){const e=ne.c(39),{run:s,usage:n,onClick:r,lastRowRef:i}=l;let a,d;if(e[0]!==s.created_at){const y=new Date(s.created_at);a=y.toLocaleDateString("en-US",{month:"short",day:"numeric"}),d=y.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=s.created_at,e[1]=a,e[2]=d}else a=e[1],d=e[2];const c=d,o=ue[s.status]??ue.completed,j=o.icon;let N;e[3]!==s.title?(N=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[3]=s.title,e[4]=N):N=e[4];let v;e[5]!==j||e[6]!==o.iconClassName?(v=t.jsx(j,{size:14,className:o.iconClassName}),e[5]=j,e[6]=o.iconClassName,e[7]=v):v=e[7];let m;e[8]!==o.labelColor?(m=be("text-sm",o.labelColor),e[8]=o.labelColor,e[9]=m):m=e[9];let b;e[10]!==o.label||e[11]!==m?(b=t.jsx("span",{className:m,children:o.label}),e[10]=o.label,e[11]=m,e[12]=b):b=e[12];let x;e[13]!==v||e[14]!==b?(x=t.jsx(le,{className:"w-28 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[v,b]})}),e[13]=v,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n?(p=n?De(n.totalTokens):"—",e[16]=n,e[17]=p):p=e[17];let h;e[18]!==p?(h=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:p}),e[18]=p,e[19]=h):h=e[19];let u;e[20]!==n?(u=n&&n.costUsd>0?Re(n.costUsd):"—",e[20]=n,e[21]=u):u=e[21];let S;e[22]!==u?(S=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:u}),e[22]=u,e[23]=S):S=e[23];let f;e[24]!==a?(f=t.jsx("div",{children:a}),e[24]=a,e[25]=f):f=e[25];let C;e[26]!==c?(C=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==C?(w=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[f,C]}),e[28]=f,e[29]=C,e[30]=w):w=e[30];let g;return e[31]!==i||e[32]!==r||e[33]!==S||e[34]!==w||e[35]!==N||e[36]!==x||e[37]!==h?(g=t.jsxs(Ne,{ref:i,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[N,x,h,S,w]}),e[31]=i,e[32]=r,e[33]=S,e[34]=w,e[35]=N,e[36]=x,e[37]=h,e[38]=g):g=e[38],g}function Rs(l){const e=ne.c(48),{automationId:s,triggerIds:n,range:r}=l,{org:i,locator:a}=st();let d;e[0]!==i.id||e[1]!==i.slug?(d={connectionId:rt,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=d):d=e[2];const c=it(d),o=xt(),j=lt(),N=ot(),{data:v}=ut(),[m,b]=ce.useState(null),x=n.length>0;let p;e[3]!==s||e[4]!==i.id||e[5]!==n?(p=xe.automationRuns(i.id,s,n),e[3]=s,e[4]=i.id,e[5]=n,e[6]=p):p=e[6];let h;e[7]!==o||e[8]!==n?(h=async z=>{const{pageParam:ee}=z,te=ee===void 0?0:ee;return await o.call("COLLECTION_THREADS_LIST",{limit:Te,offset:te,where:{trigger_ids:n}})},e[7]=o,e[8]=n,e[9]=h):h=e[9];let u;e[10]!==x||e[11]!==p||e[12]!==h?(u={queryKey:p,queryFn:h,initialPageParam:0,getNextPageParam:Xt,enabled:x,staleTime:3e4},e[10]=x,e[11]=p,e[12]=h,e[13]=u):u=e[13];const{data:S,fetchNextPage:f,hasNextPage:C,isFetchingNextPage:w,isLoading:g}=ze(u),y=(S?.pages??[]).flatMap(Yt),T=y.map(Wt),{data:_}=Ve({queryKey:xe.monitoringThreadUsage(a,JSON.stringify({ids:T,...r})),queryFn:async()=>await o.call("MONITORING_THREAD_USAGE",{threadIds:T,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}),enabled:T.length>0,staleTime:3e4});let k;e[14]!==_?.items?(k=new Map((_?.items??[]).map(Zt)),e[14]=_?.items,e[15]=k):k=e[15];const P=k;let I;e[16]!==f||e[17]!==C||e[18]!==w?(I=()=>{C&&!w&&f()},e[16]=f,e[17]=C,e[18]=w,e[19]=I):I=e[19];const D=ke(I,C??!1,w),M=m!==null?y[m]??null:null;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=()=>b(Qt),e[20]=A):A=e[20];const L=A,K=()=>b(z=>z!==null&&z<y.length-1?z+1:z),q="flex flex-col gap-5";let Q;e[21]!==s||e[22]!==r?(Q=t.jsx(Bt,{automationId:s,range:r}),e[21]=s,e[22]=r,e[23]=Q):Q=e[23];const J=x?g?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):y.length===0?t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No runs yet",description:"This automation hasn't run yet. Trigger it or wait for a starter to fire."})}):t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Started"})]})}),t.jsx(Be,{children:y.map((z,ee)=>t.jsx(Jt,{run:z,usage:P.get(z.id),onClick:()=>b(ee),lastRowRef:ee===y.length-1?D:void 0},z.id))})]}):t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No starters yet",description:"Add a starter (cron, event, or webhook) to start collecting runs."})});let E;e[24]!==w?(E=w&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=w,e[25]=E):E=e[25];const U=m!==null;let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=z=>{z||b(null)},e[26]=O):O=e[26];let V;e[27]!==j||e[28]!==N||e[29]!==c||e[30]!==K||e[31]!==L||e[32]!==a||e[33]!==v||e[34]!==y||e[35]!==M||e[36]!==m?(V=M&&m!==null&&t.jsx(et,{thread:M,client:c,locator:a,connections:j,virtualMcps:N,members:v,selectedIndex:m,total:y.length,onPrev:L,onNext:K}),e[27]=j,e[28]=N,e[29]=c,e[30]=K,e[31]=L,e[32]=a,e[33]=v,e[34]=y,e[35]=M,e[36]=m,e[37]=V):V=e[37];let F;e[38]!==V?(F=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:V}),e[38]=V,e[39]=F):F=e[39];let G;e[40]!==U||e[41]!==F?(G=t.jsx(qe,{open:U,onOpenChange:O,children:F}),e[40]=U,e[41]=F,e[42]=G):G=e[42];let X;return e[43]!==J||e[44]!==E||e[45]!==G||e[46]!==Q?(X=t.jsxs("div",{className:q,children:[Q,J,E,G]}),e[43]=J,e[44]=E,e[45]=G,e[46]=Q,e[47]=X):X=e[47],X}function Qt(l){return l!==null&&l>0?l-1:l}function Zt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Wt(l){return l.id}function Yt(l){return l.items??[]}function Xt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Te))return n.length*Te}export{Rs as A,Ue as M,Ms as T,Re as a,ks as b,At as c,Ps as d,Is as e,De as f,Ts as g,Xe as h,Ds as i};