decocms 3.18.10 → 3.18.12

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 (229) hide show
  1. package/dist/client/assets/{AlertCircle-DO3qurkL.js → AlertCircle-CUUsAdtH.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CiDjAuoy.js → ArrowUpRight-Cf4evQxw.js} +1 -1
  3. package/dist/client/assets/{Check-CR0O2uWf.js → Check-BLqEeKBc.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-LDbTBL99.js → CheckCircle-CFOSBfJq.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-WrX0-Yew.js → ChevronDown-C2c6sinL.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-8UCyB4Yy.js → ChevronLeft-BnUJO43C.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BaUNdghF.js → ChevronRight-B5L5ipNb.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-C4tvbkfA.js → ChevronUp-D_wwe57U.js} +1 -1
  9. package/dist/client/assets/{Container-CB2clVKF.js → Container-BvPpGZnd.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DGTAVdEZ.js → DotsVertical-BOgEsTMy.js} +1 -1
  11. package/dist/client/assets/{Eye-sBZ-4iik.js → Eye-D9NEFF2b.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BU3D9Lid.js → FilterLines-BlZKlG21.js} +1 -1
  13. package/dist/client/assets/{Globe01-byyMUl6j.js → Globe01-cUR4k1x9.js} +1 -1
  14. package/dist/client/assets/{HardDrive-CUKuGEue.js → HardDrive-5wu_NjNO.js} +1 -1
  15. package/dist/client/assets/{Key01-DWQ0romw.js → Key01-Cp53LYcD.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-J1_JEXyN.js → LayoutLeft-HrAYDWPl.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-jNd7GK6h.js → LinkExternal01-DB359u1m.js} +1 -1
  18. package/dist/client/assets/{Monitor01-Df0H43EQ.js → Monitor01-BSb4OY8G.js} +1 -1
  19. package/dist/client/assets/{Palette-DTMyMQxf.js → Palette-xvxAGRbw.js} +1 -1
  20. package/dist/client/assets/{Play-BFlh2QTe.js → Play-VZl7G9wy.js} +1 -1
  21. package/dist/client/assets/{Plus-SYX7Jcs9.js → Plus-CT-4Jh-n.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-BQ5geCmZ.js → RefreshCcw01-0gFyqUZd.js} +1 -1
  23. package/dist/client/assets/{SearchMd-0TMVkQMW.js → SearchMd-C66hv9kt.js} +1 -1
  24. package/dist/client/assets/{Settings02-De_5mwce.js → Settings02-B89y1GN_.js} +1 -1
  25. package/dist/client/assets/{Shield01-BDh5ViTq.js → Shield01-9tiYd2ih.js} +1 -1
  26. package/dist/client/assets/{Star01-DLziHFop.js → Star01-DMJ7Bmvx.js} +1 -1
  27. package/dist/client/assets/{Stars01-BlfwbfsB.js → Stars01-CNBVD1W1.js} +1 -1
  28. package/dist/client/assets/{Stars02-DqL1Cccb.js → Stars02-BdwCB3Kj.js} +1 -1
  29. package/dist/client/assets/{Sun-DdGdhPXF.js → Sun-BYcJheYn.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-8u2E25Rp.js → SwitchHorizontal01-B0ESWdzS.js} +1 -1
  31. package/dist/client/assets/{Tool01-CqvNhfPg.js → Tool01-DN-gU43Y.js} +1 -1
  32. package/dist/client/assets/{Trash01-DUkv4uBS.js → Trash01-CR3E97ay.js} +1 -1
  33. package/dist/client/assets/{Upload01-Df5OqgB9.js → Upload01-DQ7aL3qZ.js} +1 -1
  34. package/dist/client/assets/{User01-BmlN3if3.js → User01-BDbelgHJ.js} +1 -1
  35. package/dist/client/assets/{Users01-CTGNOuQo.js → Users01-BPOE-PS5.js} +1 -1
  36. package/dist/client/assets/{Users03-QSPwwcGf.js → Users03-Q03Wmh-l.js} +1 -1
  37. package/dist/client/assets/{X-DIHUsKrt.js → X-H2fYFKrr.js} +1 -1
  38. package/dist/client/assets/{XCircle-Cj2MwS1p.js → XCircle-B3udZTDc.js} +1 -1
  39. package/dist/client/assets/{XClose-BNMay-WE.js → XClose-YFpYubX_.js} +1 -1
  40. package/dist/client/assets/{Zap-Dk_nA-wI.js → Zap-B_D2y40p.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-ye6mkz8R.js → ZapSquare--iRBoXV5.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-CBm47Mxl.js → ZoomOut-DHgWSdJD.js} +1 -1
  43. package/dist/client/assets/{access-gate-CuZatYm_.js → access-gate-DW1Er84j.js} +1 -1
  44. package/dist/client/assets/{accordion-D3cQViYi.js → accordion-JjBUcv_J.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CXbCdK1J.js → add-section-modal-BTVKMOgb.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-JCDkpFVT.js → agent-capabilities-BWLxH-Fx.js} +1 -1
  47. package/dist/client/assets/{agent-icon-Nb9q65px.js → agent-icon-BI9vERCT.js} +1 -1
  48. package/dist/client/assets/{agent-icons-Ba4I4FNK.js → agent-icons-CjkUCxqY.js} +1 -1
  49. package/dist/client/assets/{agents-list-CkR08YYw.js → agents-list-Bub1NK3T.js} +1 -1
  50. package/dist/client/assets/{ai-providers-BI7MzasF.js → ai-providers-Bu1GXg4N.js} +1 -1
  51. package/dist/client/assets/{alert-CtDMTHG1.js → alert-C1E2OWdA.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-BbR-MKg7.js → alert-dialog-DZtlkgip.js} +1 -1
  53. package/dist/client/assets/app-editor-rbvicmpG.js +1 -0
  54. package/dist/client/assets/{auth-catchall-C1PSF4Ip.js → auth-catchall-unBD4iEa.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-Djze1rdU.js → auth-split-layout-BPICnOKo.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-CGpoGzR0.js → automation-list-row-Dj1eIP99.js} +1 -1
  57. package/dist/client/assets/{automation-runs-C7aqiU1Z.js → automation-runs-BEXO7QGj.js} +1 -1
  58. package/dist/client/assets/{automations-BsawdG1_.js → automations-BgaCTq-h.js} +1 -1
  59. package/dist/client/assets/{avatar-BjbgYfeW.js → avatar-k6SwlvSl.js} +1 -1
  60. package/dist/client/assets/{badge-Cfj0m0C5.js → badge-BXuo1VOW.js} +1 -1
  61. package/dist/client/assets/{brand-context-CM0793M8.js → brand-context-mHlFr_RX.js} +1 -1
  62. package/dist/client/assets/{buckets-wqB_uth4.js → buckets-CXWxKqbX.js} +1 -1
  63. package/dist/client/assets/{calendar-DFlZao3t.js → calendar-neVp9ddK.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-Cj6SN6lp.js → capability-load-error-BC3MQy0S.js} +1 -1
  65. package/dist/client/assets/{card-QVeHFZsG.js → card-CIVB52uv.js} +1 -1
  66. package/dist/client/assets/{chat-context-BMAcvzGB.js → chat-context-3Vhjk0yV.js} +1 -1
  67. package/dist/client/assets/{checkbox-DqupQVQH.js → checkbox-JEI0UJfB.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-Cxtwyi64.js → cli-auth-success-cCIbpB1g.js} +1 -1
  69. package/dist/client/assets/{collection-detail-B6SNmLwi.js → collection-detail-CYkt3Nvh.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-C1C3izhC.js → collection-display-button-DezBi0Zd.js} +1 -1
  71. package/dist/client/assets/{collection-search-D2j75aeN.js → collection-search-D9kFwZgQ.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-CeOlGLcn.js → collection-table-wrapper-Cih2jkMD.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-DPisRalq.js → collection-tabs-C7ohic9I.js} +1 -1
  74. package/dist/client/assets/{collections-CkldJez1.js → collections-ClhAnvfO.js} +1 -1
  75. package/dist/client/assets/{command-DIrtC00t.js → command-CDpjPeBK.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CNMJdOFe.js → connect-desktop-dialog-C_x3t7pZ.js} +1 -1
  77. package/dist/client/assets/{connection-card-BKM57v71.js → connection-card-BK4dkPjw.js} +1 -1
  78. package/dist/client/assets/{connection-detail-GKPalFBP.js → connection-detail-b1VbGZgC.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-DfIl4yFq.js → connection-form-helpers-DBEWgaHF.js} +1 -1
  80. package/dist/client/assets/{connections-DuCFNFyf.js → connections-NC5N6xIp.js} +1 -1
  81. package/dist/client/assets/{constants-CMjFoMX0.js → constants-Dn21fsKH.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-BIv3mHQ8.js → decopilot-sse-pool-ClwsWVCx.js} +1 -1
  83. package/dist/client/assets/{dialog-C0feLjuV.js → dialog-CIzTOcgG.js} +1 -1
  84. package/dist/client/assets/{domain-settings-Cl_5u-Ie.js → domain-settings-44hRVATd.js} +1 -1
  85. package/dist/client/assets/{drawer-CKPN29cW.js → drawer-DlCSP28b.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-Cg5WpvGl.js → dropdown-menu-y8NIkVV4.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-CJCE1yd4.js → dynamic-plugin-layout-jYa9ST7c.js} +1 -1
  88. package/dist/client/assets/{empty-state-DGpuZNcs.js → empty-state-cflEad3j.js} +1 -1
  89. package/dist/client/assets/{empty-state-D-wJ7w0j.js → empty-state-xtqyfNBv.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-B2b4tk3B.js → extract-connection-data-bhQM6jl0.js} +1 -1
  91. package/dist/client/assets/{features-1Gd3VkNJ.js → features-rdoxawZo.js} +1 -1
  92. package/dist/client/assets/{file-explorer-e20KAzNM.js → file-explorer-CRjp25ZQ.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-D3OjC7Nc.js → file-type-icon-Bz1tWasF.js} +1 -1
  94. package/dist/client/assets/{files-DXms-EVV.js → files-8GMQ6t2B.js} +1 -1
  95. package/dist/client/assets/{form-DGJglQC2.js → form-CVTyweI2.js} +1 -1
  96. package/dist/client/assets/{general-CjIOWaFd.js → general-Cg0l8DBn.js} +1 -1
  97. package/dist/client/assets/{generate-id-DLw1KYSq.js → generate-id-BF1f71P9.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-CB1IGCBa.js → github-repo-picker-D93M8RRV.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-Czt3n5_n.js → header-tab-button-zuL7BIX-.js} +1 -1
  100. package/dist/client/assets/{hover-card-D_9z97Ih.js → hover-card-CSRaUNzl.js} +1 -1
  101. package/dist/client/assets/{image-field-V28zy_EV.js → image-field-nt8zGGSh.js} +1 -1
  102. package/dist/client/assets/{index-DGbvDudG.js → index--xdghBXA.js} +1 -1
  103. package/dist/client/assets/{index-sl5NILiy.js → index-Bay0Y2nf.js} +1 -1
  104. package/dist/client/assets/{index-Bb_z0e2b.js → index-Bo_NxHOU.js} +1 -1
  105. package/dist/client/assets/{index-BjEbE5bn.js → index-CAqOat9h.js} +1 -1
  106. package/dist/client/assets/{index-BwJ8x2eM.js → index-CD5E13Vo.js} +1 -1
  107. package/dist/client/assets/{index-BIleJ0VA.js → index-CLytPBUU.js} +1 -1
  108. package/dist/client/assets/{index-DBI0x8x7.js → index-DKywtzLS.js} +1 -1
  109. package/dist/client/assets/{index-CALvPqOi.js → index-DRAmSsY1.js} +1 -1
  110. package/dist/client/assets/{index-xlf1R0Pd.js → index-DRJmNXDD.js} +3 -3
  111. package/dist/client/assets/{index-C0kMDEcB.js → index-DZ_i--7B.js} +1 -1
  112. package/dist/client/assets/{index-CJpfxKNZ.js → index-Dby-ucWM.js} +1 -1
  113. package/dist/client/assets/{index-B2Xn22Dq.js → index-Dt_zFMlH.js} +1 -1
  114. package/dist/client/assets/{index-BK3wwG8_.js → index-Qq4jpFV6.js} +4 -4
  115. package/dist/client/assets/{index-BalURoI4.js → index-S_D2Y5IH.js} +1 -1
  116. package/dist/client/assets/{index-redirect-Dnewyuc8.js → index-redirect-BiSl4qX_.js} +1 -1
  117. package/dist/client/assets/{index-CjpJYW_2.js → index-tyjaJlk9.js} +1 -1
  118. package/dist/client/assets/{infiniteQueryObserver-Dod8uwNr.js → infiniteQueryObserver-C7ETsuTN.js} +1 -1
  119. package/dist/client/assets/{input-BjNSlgZE.js → input-P729pT4B.js} +1 -1
  120. package/dist/client/assets/{integration-icon-DztBpo-4.js → integration-icon-C9H4lbsU.js} +1 -1
  121. package/dist/client/assets/{label-DeQwx-7l.js → label-mYXtiAEA.js} +1 -1
  122. package/dist/client/assets/{layout-BtPw8KV-.js → layout-Da5Sw0u4.js} +1 -1
  123. package/dist/client/assets/{login-CL1yTVXE.js → login-BRSAuPGi.js} +1 -1
  124. package/dist/client/assets/{members-CGgYX03n.js → members-Dw0KJvzH.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-IXSH7yVN.js → monaco-editor-BCBnusgY.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-Bw7Yb8Li.js → monitoring-stats-row-wdRhlOlW.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-ai-provider-B9PUn4kZ.js → oauth-callback-ai-provider-Czo1UZ9i.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-CFTvyLv_.js → oauth-callback-dLhbjAHo.js} +1 -1
  129. package/dist/client/assets/{onboarding-hD7Xg9rl.js → onboarding-B5IGKngf.js} +1 -1
  130. package/dist/client/assets/{org-install-CV4doqve.js → org-install-CEIAGu61.js} +1 -1
  131. package/dist/client/assets/{org-layout-DXblqx0i.js → org-layout-Tx94FyMx.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-UFDYNPid.js → org-plugin-layout-B_w3GoQV.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-Cl7PxYdF.js → page-seo-form-CU5LVhNP.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-CeotG-uP.js +1 -0
  135. package/dist/client/assets/{pair-CGjBKqqE.js → pair-OYZMJU42.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-C7O12cTA.js → plugin-empty-state-2-Gmd4ef.js} +1 -1
  137. package/dist/client/assets/{plugin-header-n7k5ute4.js → plugin-header-CdWnAqhA.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-D0v2Yt3B.js → plugin-layout-D7PZZpy2.js} +1 -1
  139. package/dist/client/assets/{popover-squ0DpCA.js → popover-D2FcxHoI.js} +1 -1
  140. package/dist/client/assets/{post-editor-D5YuMCkc.js → post-editor-x8tOH-Xv.js} +1 -1
  141. package/dist/client/assets/{primitives-Dw4WC2se.js → primitives-BR0MmAqb.js} +1 -1
  142. package/dist/client/assets/{profile-DhM_cUSu.js → profile-Coc8xiva.js} +1 -1
  143. package/dist/client/assets/project-app-view-C5r_nrd1.js +1 -0
  144. package/dist/client/assets/record-editor-sgtNbQKl.js +1 -0
  145. package/dist/client/assets/registry-CcRzbKI-.js +2 -0
  146. package/dist/client/assets/{registry-layout-DSkrlzjH.js → registry-layout-jP07XDNe.js} +1 -1
  147. package/dist/client/assets/{require-capability-C0QcGgFF.js → require-capability-Fk6DVHbg.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-ymESQIi2.js → required-auth-layout-BXmyXUFi.js} +1 -1
  149. package/dist/client/assets/{reset-password-C0lkGU6M.js → reset-password-DiqQdQa-.js} +1 -1
  150. package/dist/client/assets/{resizable-Nlm_g4IC.js → resizable-DFm4kXdy.js} +1 -1
  151. package/dist/client/assets/{roles-DjM4e2_H.js → roles-DsmGWq7p.js} +1 -1
  152. package/dist/client/assets/{save-status-BiOcVRSD.js → save-status-D7nwqJA6.js} +1 -1
  153. package/dist/client/assets/{schema-form-74s11yhK.js → schema-form-D26Vyi9k.js} +1 -1
  154. package/dist/client/assets/{scroll-area-BchyeqP4.js → scroll-area-CbV228oT.js} +1 -1
  155. package/dist/client/assets/{search-input-CW76IA7x.js → search-input-B9IrHp4k.js} +1 -1
  156. package/dist/client/assets/{secrets-DkXCaPdC.js → secrets-DqOKaQWC.js} +1 -1
  157. package/dist/client/assets/{sections-editor-DxQ2D6k5.js → sections-editor-i_HD7PPz.js} +1 -1
  158. package/dist/client/assets/{select-BYULyxxE.js → select-DeypuT4J.js} +1 -1
  159. package/dist/client/assets/{select-model-DixjlRSy.js → select-model-CqSEs5Wd.js} +1 -1
  160. package/dist/client/assets/{seo-editor-C3ydxr1l.js → seo-editor-DfCz7pim.js} +1 -1
  161. package/dist/client/assets/{settings-layout-_SyzY_Pm.js → settings-layout-B8AxR89Q.js} +1 -1
  162. package/dist/client/assets/{settings-section-DS4shxaT.js → settings-section-CH8XK4Me.js} +1 -1
  163. package/dist/client/assets/{sheet-WSy7SjR0.js → sheet-Cba9SmBC.js} +1 -1
  164. package/dist/client/assets/{shell-controls-B4M-GcqN.js → shell-controls-CBYVrYSK.js} +1 -1
  165. package/dist/client/assets/{shell-layout-By3SjLTs.js → shell-layout-alcmiODa.js} +1 -1
  166. package/dist/client/assets/{shell-route-loading-CWHxFvKD.js → shell-route-loading-uCAQUh4N.js} +1 -1
  167. package/dist/client/assets/{sidebar-Clf4A7X_.js → sidebar-C55uTdAM.js} +1 -1
  168. package/dist/client/assets/{skeleton-CGwzwFVG.js → skeleton-CjQ5K3vJ.js} +1 -1
  169. package/dist/client/assets/{sortable.esm-C1zQJI2Q.js → sortable.esm-Cf7lIPPg.js} +1 -1
  170. package/dist/client/assets/{spinner-DjExjumk.js → spinner-bR-znNAV.js} +1 -1
  171. package/dist/client/assets/{sso-BgkpOviw.js → sso-EuKImMWP.js} +1 -1
  172. package/dist/client/assets/{store-Cqb7l3Do.js → store-00JFAaKp.js} +1 -1
  173. package/dist/client/assets/store-registry-DW5Ca0a4.js +2 -0
  174. package/dist/client/assets/{switch-CNDn_VQ1.js → switch-azpLz6de.js} +1 -1
  175. package/dist/client/assets/{tab-id-DL39xVYI.js → tab-id-CwBFTu9k.js} +1 -1
  176. package/dist/client/assets/{table-CAd4TJYo.js → table-MxnMAdrI.js} +1 -1
  177. package/dist/client/assets/{tabs-e_nZZIrp.js → tabs-DL-yl168.js} +1 -1
  178. package/dist/client/assets/{task-status-NbZ1Cgn2.js → task-status-CvJhfkMQ.js} +1 -1
  179. package/dist/client/assets/{textarea-BJ0xg93C.js → textarea-D0c-a7yW.js} +1 -1
  180. package/dist/client/assets/{toggle-group-FIn4BkMy.js → toggle-group-vh2Ns0If.js} +1 -1
  181. package/dist/client/assets/{toolbar-D_nesjSL.js → toolbar-B3mA0xt9.js} +1 -1
  182. package/dist/client/assets/{tools-list-Bsiim9dQ.js → tools-list-DtWyNgor.js} +1 -1
  183. package/dist/client/assets/{tooltip-eUi2Y5fU.js → tooltip-Bc8MQzHk.js} +1 -1
  184. package/dist/client/assets/{types-DSWKCdit.js → types-CRBqSXL2.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-BdWyfVEe.js → use-ai-providers-fjkaa603.js} +1 -1
  186. package/dist/client/assets/{use-automations-DKJfSgh5.js → use-automations-BqkQGVej.js} +1 -1
  187. package/dist/client/assets/{use-capability-52ANg0ua.js → use-capability-B8J1tkgS.js} +1 -1
  188. package/dist/client/assets/{use-collections-C98vGus5.js → use-collections-B7Q5Ewox.js} +1 -1
  189. package/dist/client/assets/{use-connection-x4R6JP5q.js → use-connection-B0F76h3F.js} +1 -1
  190. package/dist/client/assets/{use-copy-Cu8kujkR.js → use-copy-5x0rZhWf.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-DwzWsa7N.js → use-create-virtual-mcp-DjxyJVPx.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-rgg_ru3T.js → use-debounced-autosave-BsNxlSe7.js} +1 -1
  193. package/dist/client/assets/{use-delete-connection-C-GkFw97.js → use-delete-connection-Da27cion.js} +1 -1
  194. package/dist/client/assets/{use-file-configs-DGbMu0K6.js → use-file-configs-Cr_pEuKT.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-CaLMlbmi.js → use-infinite-scroll-pHyCBgQe.js} +1 -1
  196. package/dist/client/assets/{use-list-state-CKzfsg2N.js → use-list-state-B7b0g2Tt.js} +1 -1
  197. package/dist/client/assets/{use-mcp-prompts-D3jNMXd8.js → use-mcp-prompts-BIsh39jz.js} +1 -1
  198. package/dist/client/assets/{use-mcp-tools-D3mvpNKq.js → use-mcp-tools-DeqBABcT.js} +1 -1
  199. package/dist/client/assets/{use-members-CwhTvd1u.js → use-members-BqiYNK1W.js} +1 -1
  200. package/dist/client/assets/{use-navigate-to-agent-BEpojVbn.js → use-navigate-to-agent-BqNERGsJ.js} +1 -1
  201. package/dist/client/assets/{use-org-auth-client-DLdfBxh3.js → use-org-auth-client-DfWK5Dmp.js} +1 -1
  202. package/dist/client/assets/{use-org-sso-COHbMIdA.js → use-org-sso-DS2vtlRO.js} +1 -1
  203. package/dist/client/assets/{use-organization-roles-Cj9v6f9e.js → use-organization-roles-BeXitpuJ.js} +1 -1
  204. package/dist/client/assets/{use-organization-settings-BFlPCFeR.js → use-organization-settings-DcKBxQuR.js} +1 -1
  205. package/dist/client/assets/{use-registry-connections-DNdDhSw6.js → use-registry-connections-X5l6Ej7n.js} +1 -1
  206. package/dist/client/assets/{use-secrets-Bpm1CwQ6.js → use-secrets-POeN7r3M.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-Dw3nsUev.js → use-status-sounds-DiOixeGb.js} +1 -1
  208. package/dist/client/assets/{use-view-mode-C8r2Cw-r.js → use-view-mode-0BkYlq6R.js} +1 -1
  209. package/dist/client/assets/{use-virtual-mcp-yktM2JXP.js → use-virtual-mcp-KmXVB9CJ.js} +1 -1
  210. package/dist/client/assets/useInfiniteQuery-Btju8noP.js +1 -0
  211. package/dist/client/assets/{useRouterState-DhXN2nyU.js → useRouterState-DfFBm4VR.js} +1 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-gzhivT15.js +1 -0
  213. package/dist/client/assets/{user-CSPmp-pN.js → user-GPllNRXu.js} +1 -1
  214. package/dist/client/assets/{view-mode-toggle-8ghjojw3.js → view-mode-toggle-DYuUUvjN.js} +1 -1
  215. package/dist/client/assets/{workflow-DdioyrHR.js → workflow-DV-ldnai.js} +1 -1
  216. package/dist/client/assets/workflow-detail-BvkBTqLV.js +1 -0
  217. package/dist/client/index.html +1 -1
  218. package/dist/server/cli.js +365 -359
  219. package/dist/server/server.js +252 -246
  220. package/package.json +1 -1
  221. package/dist/client/assets/app-editor-BbJgWAgK.js +0 -1
  222. package/dist/client/assets/page-seo-sheet-BHa1ykNh.js +0 -1
  223. package/dist/client/assets/project-app-view-DMsxOy9X.js +0 -1
  224. package/dist/client/assets/record-editor-DWQJajpr.js +0 -1
  225. package/dist/client/assets/registry-CE5Xs2GQ.js +0 -2
  226. package/dist/client/assets/store-registry-ClMYiGJW.js +0 -2
  227. package/dist/client/assets/useInfiniteQuery-CYN-1qEP.js +0 -1
  228. package/dist/client/assets/useSuspenseInfiniteQuery-2A_8__7V.js +0 -1
  229. package/dist/client/assets/workflow-detail-Dn33HQ0I.js +0 -1
@@ -1 +1 @@
1
- import{e as le,r as oe,c as be,j as t,B as fe,K as xe,n as Ve,E as tt,q as st}from"./index-xlf1R0Pd.js";import{u as ze}from"./useInfiniteQuery-CYN-1qEP.js";import{u as lt}from"./use-connection-x4R6JP5q.js";import{i as nt,g as at,S as rt,u as it}from"./constants-CMjFoMX0.js";import{a as ot}from"./use-virtual-mcp-yktM2JXP.js";import{C as ct}from"./card-QVeHFZsG.js";import{a as Ke,b as qe,S as dt,d as mt}from"./sheet-WSy7SjR0.js";import{c as Ge,d as He,a as Ne,e as te,b as Be,T as se}from"./table-CAd4TJYo.js";import{E as Se}from"./empty-state-DGpuZNcs.js";import{u as ke}from"./use-infinite-scroll-CaLMlbmi.js";import{u as ut}from"./use-members-CwhTvd1u.js";import{S as ue}from"./task-status-NbZ1Cgn2.js";import{e as ft}from"./use-automations-DKJfSgh5.js";import{u as xt}from"./useSuspenseInfiniteQuery-2A_8__7V.js";import{B as je}from"./badge-Cfj0m0C5.js";import{S as ht,a as gt,b as pt,c as ge,d as jt}from"./select-BYULyxxE.js";import{C as Le}from"./checkbox-DqupQVQH.js";import{t as he}from"./ChevronDown-WrX0-Yew.js";import{c as bt,C as Nt,e as Fe,d as vt,a as St,b as yt}from"./command-DIrtC00t.js";import{a as Je,b as Qe,P as Ze}from"./popover-squ0DpCA.js";import{A as We}from"./avatar-BjbgYfeW.js";import{n as ye}from"./ChevronUp-C4tvbkfA.js";import{n as Ie}from"./Container-CB2clVKF.js";import{i as wt}from"./FilterLines-BU3D9Lid.js";import{m as Ct,n as _t}from"./pair-CGjBKqqE.js";import{I as Pe}from"./integration-icon-DztBpo-4.js";function Ue(l){const e=le.c(74),{options:s,onValueChange:n,defaultValue:r,placeholder:i,variant:a,animation:m,maxCount:c,modalPopover:o,asChild:b,className:v,disabled:x,onSearchChange:h}=l;let N;e[0]!==r?(N=r===void 0?[]:r,e[0]=r,e[1]=N):N=e[1];const u=N,p=i===void 0?"Select items":i,j=a===void 0?"default":a,g=m===void 0?0:m,S=c===void 0?3:c,f=o===void 0?!1:o,y=b===void 0?!1:b,_=x===void 0?!1:x,[d,C]=oe.useState(u),[T,w]=oe.useState(!1);let I,k;e[2]!==u||e[3]!==d?(I=()=>{JSON.stringify(d)!==JSON.stringify(u)&&C(u)},k=[u,d],e[2]=u,e[3]=d,e[4]=I,e[5]=k):(I=e[4],k=e[5]),oe.useEffect(I,k);let P;e[6]!==n||e[7]!==d?(P=E=>{if(E.key==="Enter")w(!0);else if(E.key==="Backspace"&&!E.currentTarget.value){const H=[...d];H.pop(),C(H),n(H)}},e[6]=n,e[7]=d,e[8]=P):P=e[8];const D=P;let M;e[9]!==n||e[10]!==d?(M=E=>{const H=d.includes(E.value)?d.filter(me=>me!==E.value):[...d,E.value];C(H),n(H)},e[9]=n,e[10]=d,e[11]=M):M=e[11];const A=M;let $;e[12]!==n?($=()=>{C([]),n([])},e[12]=n,e[13]=$):$=e[13];const B=$;let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{w(Pt)},e[14]=F):F=e[14];const Z=F;let q;e[15]!==B||e[16]!==n||e[17]!==s||e[18]!==d.length?(q=()=>{if(d.length===s.length)B();else{const E=s.map(It);C(E),n(E)}},e[15]=B,e[16]=n,e[17]=s,e[18]=d.length,e[19]=q):q=e[19];const U=q;let O;e[20]!==y?(O=y?{}:{variant:"outline"},e[20]=y,e[21]=O):O=e[21];let L;e[22]!==v?(L=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",v),e[22]=v,e[23]=L):L=e[23];let K;e[24]!==g||e[25]!==S||e[26]!==s||e[27]!==p||e[28]!==d||e[29]!==j?(K=d.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:[d.slice(0,S).map(E=>{const H=s.find(ve=>ve.value===E),me=H?.icon;return t.jsxs(je,{variant:j==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${g}s`},children:[me&&t.jsx(me,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:H?.label})]},E)}),d.length>S&&t.jsxs(je,{variant:j==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${g}s`},children:["+",d.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]=g,e[25]=S,e[26]=s,e[27]=p,e[28]=d,e[29]=j,e[30]=K):K=e[30];let V;e[31]!==_||e[32]!==O||e[33]!==L||e[34]!==K?(V=t.jsx(Je,{asChild:!0,children:t.jsx(fe,{ref:null,...O,onClick:Z,className:L,disabled:_,children:K})}),e[31]=_,e[32]=O,e[33]=L,e[34]=K,e[35]=V):V=e[35];let J;e[36]===Symbol.for("react.memo_cache_sentinel")?(J=()=>w(!1),e[36]=J):J=e[36];const z=!h;let Q;e[37]!==D||e[38]!==h?(Q=t.jsx(bt,{placeholder:"Search...",onKeyDown:D,onValueChange:h,className:"rounded-t-xl"}),e[37]=D,e[38]=h,e[39]=Q):Q=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=t.jsx(Nt,{children:"No results found."}),e[40]=ce):ce=e[40];let W;e[41]!==U?(W=()=>{U()},e[41]=U,e[42]=W):W=e[42];let Y;e[43]!==U?(Y=E=>{E.stopPropagation(),U()},e[43]=U,e[44]=Y):Y=e[44];const de=d.length===s.length&&s.length>0;let ne;e[45]!==de||e[46]!==U?(ne=t.jsx(Le,{checked:de,onCheckedChange:U,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:kt}),e[45]=de,e[46]=U,e[47]=ne):ne=e[47];let ae;e[48]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx("span",{children:"(Select All)"}),e[48]=ae):ae=e[48];let X;e[49]!==Y||e[50]!==ne?(X=t.jsxs("div",{className:"flex items-center w-full",onClick:Y,children:[ne,ae]}),e[49]=Y,e[50]=ne,e[51]=X):X=e[51];let ee;e[52]!==W||e[53]!==X?(ee=t.jsx(Fe,{onSelect:W,className:"cursor-pointer",children:X},"all"),e[52]=W,e[53]=X,e[54]=ee):ee=e[54];let re;if(e[55]!==s||e[56]!==d||e[57]!==A){let E;e[59]!==d||e[60]!==A?(E=H=>{const me=d.includes(H.value);return t.jsx(Fe,{onSelect:()=>{A(H)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ve=>{ve.stopPropagation(),A(H)},children:[t.jsx(Le,{checked:me,onCheckedChange:()=>{A(H)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:Tt}),H.icon&&t.jsx(H.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:H.label})]})},H.value)},e[59]=d,e[60]=A,e[61]=E):E=e[61],re=s.map(E),e[55]=s,e[56]=d,e[57]=A,e[58]=re}else re=e[58];let R;e[62]!==ee||e[63]!==re?(R=t.jsxs(vt,{className:"rounded-b-xl",children:[ce,t.jsxs(St,{children:[ee,re]})]}),e[62]=ee,e[63]=re,e[64]=R):R=e[64];let G;e[65]!==z||e[66]!==Q||e[67]!==R?(G=t.jsx(Qe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:J,children:t.jsxs(yt,{shouldFilter:z,className:"rounded-xl",children:[Q,R]})}),e[65]=z,e[66]=Q,e[67]=R,e[68]=G):G=e[68];let ie;return e[69]!==T||e[70]!==f||e[71]!==V||e[72]!==G?(ie=t.jsxs(Ze,{open:T,onOpenChange:w,modal:f,children:[V,G]}),e[69]=T,e[70]=f,e[71]=V,e[72]=G,e[73]=ie):ie=e[73],ie}function Tt(l){return l.stopPropagation()}function kt(l){return l.stopPropagation()}function It(l){return l.value}function Pt(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"}],Mt=40;function Cs(l){const s=(l.endDate.getTime()-l.startDate.getTime())/Mt;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 Dt(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 Rt(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 _s(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])),m=[];for(let c=r;c<=i;c+=n){const o=a.get(c),b=new Date(c).toISOString();m.push({t:b,ts:c,label:Dt(b,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 m}function Ts(l,e){return e==="requests"?l.calls:e==="errors"?l.errorRate:l.avgDurationMs}function ks(l,e){return e==="requests"?l.calls.toLocaleString():e==="errors"?`${l.errorRate.toFixed(1)}%`:Rt(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=le.c(33),{thread:s,connections:n,virtualMcps:r,selectedIndex:i,total:a,onPrev:m,onNext:c}=l;let o,b;if(e[0]!==n||e[1]!==s||e[2]!==r){const I=Ae(s);o=Ee(I,r,n,""),b=$e(I,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=o,e[4]=b}else o=e[3],b=e[4];const v=b,x=o||s.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Ie,{}),e[5]=h):h=e[5];let N;e[6]!==v||e[7]!==x?(N=t.jsx(Pe,{icon:v,name:x,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=v,e[7]=x,e[8]=N):N=e[8];let u;e[9]!==s.title?(u=t.jsx(dt,{className:"text-sm leading-snug truncate",children:s.title}),e[9]=s.title,e[10]=u):u=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 j;e[13]!==u||e[14]!==p?(j=t.jsxs("div",{className:"min-w-0",children:[u,p]}),e[13]=u,e[14]=p,e[15]=j):j=e[15];let g;e[16]!==N||e[17]!==j?(g=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[N,j]}),e[16]=N,e[17]=j,e[18]=g):g=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 y;e[20]!==m||e[21]!==S?(y=t.jsx(fe,{size:"icon",variant:"ghost",onClick:m,disabled:S,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous thread",children:f}),e[20]=m,e[21]=S,e[22]=y):y=e[22];const _=i===a-1;let d;e[23]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(he,{size:14}),e[23]=d):d=e[23];let C;e[24]!==c||e[25]!==_?(C=t.jsx(fe,{size:"icon",variant:"ghost",onClick:c,disabled:_,className:"h-7 w-7 text-muted-foreground","aria-label":"Next thread",children:d}),e[24]=c,e[25]=_,e[26]=C):C=e[26];let T;e[27]!==y||e[28]!==C?(T=t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,C]}),e[27]=y,e[28]=C,e[29]=T):T=e[29];let w;return e[30]!==T||e[31]!==g?(w=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:[g,T]})}),e[30]=T,e[31]=g,e[32]=w):w=e[32],w}function At(l){const e=le.c(48),{thread:s,connections:n,virtualMcps:r,members:i}=l;let a,m;if(e[0]!==n||e[1]!==s||e[2]!==r){const M=Ae(s);a=Ee(M,r,n,""),m=$e(M,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=a,e[4]=m}else a=e[3],m=e[4];const c=m;let o;if(e[5]!==i||e[6]!==s.created_by){const M=Xe(i);let A;e[8]!==s.created_by?(A=$=>$.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 b=o;let v;e[10]!==b?.user.email||e[11]!==b?.user.name||e[12]!==s.created_by?(v=b?.user.name??b?.user.email??s.created_by?.substring(0,8)??"—",e[10]=b?.user.email,e[11]=b?.user.name,e[12]=s.created_by,e[13]=v):v=e[13];const x=v,h=b?.user.image??void 0;let N;e[14]!==s.created_at?(N=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]=N):N=e[15];const u=N,p=ue[s.status]??ue.completed,j=p.icon;let g;e[16]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=g):g=e[16];let S;e[17]!==j||e[18]!==p.iconClassName?(S=t.jsx(j,{size:13,className:p.iconClassName}),e[17]=j,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 y;e[22]!==p.label||e[23]!==f?(y=t.jsx("span",{className:f,children:p.label}),e[22]=p.label,e[23]=f,e[24]=y):y=e[24];let _;e[25]!==S||e[26]!==y?(_=t.jsxs("div",{children:[g,t.jsxs("div",{className:"flex items-center gap-1.5",children:[S,y]})]}),e[25]=S,e[26]=y,e[27]=_):_=e[27];let d;e[28]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=d):d=e[28];let C;e[29]!==u?(C=t.jsxs("div",{children:[d,t.jsx("div",{className:"text-sm text-foreground",children:u})]}),e[29]=u,e[30]=C):C=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 w;e[32]!==h||e[33]!==x?(w=t.jsx(We,{url:h,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=h,e[33]=x,e[34]=w):w=e[34];let I;e[35]!==x?(I=t.jsx("span",{className:"text-sm text-foreground",children:x}),e[35]=x,e[36]=I):I=e[36];let k;e[37]!==w||e[38]!==I?(k=t.jsxs("div",{children:[T,t.jsxs("div",{className:"flex items-center gap-2",children:[w,I]})]}),e[37]=w,e[38]=I,e[39]=k):k=e[39];let P;e[40]!==c||e[41]!==a?(P=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]=P):P=e[42];let D;return e[43]!==C||e[44]!==k||e[45]!==P||e[46]!==_?(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:[_,C,k,P]}),e[43]=C,e[44]=k,e[45]=P,e[46]=_,e[47]=D):D=e[47],D}function Et(l){const e=le.c(72),{thread:s,usage:n,members:r,connections:i,virtualMcps:a,onClick:m,lastRowRef:c}=l;let o,b;if(e[0]!==i||e[1]!==s||e[2]!==a){const V=Ae(s);o=Ee(V,a,i,"—"),b=$e(V,a,i),e[0]=i,e[1]=s,e[2]=a,e[3]=o,e[4]=b}else o=e[3],b=e[4];const v=b;let x;if(e[5]!==r||e[6]!==s.created_by){const V=Xe(r);let J;e[8]!==s.created_by?(J=z=>z.userId===s.created_by,e[8]=s.created_by,e[9]=J):J=e[9],x=V.find(J),e[5]=r,e[6]=s.created_by,e[7]=x}else x=e[7];const h=x;let N;e[10]!==h?.user.email||e[11]!==h?.user.name||e[12]!==s.created_by?(N=h?.user.name??h?.user.email??s.created_by?.substring(0,8)??"—",e[10]=h?.user.email,e[11]=h?.user.name,e[12]=s.created_by,e[13]=N):N=e[13];const u=N,p=h?.user.image??void 0;let j,g;if(e[14]!==s.created_at){const V=new Date(s.created_at);j=V.toLocaleDateString("en-US",{month:"short",day:"numeric"}),g=V.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=s.created_at,e[15]=j,e[16]=g}else j=e[15],g=e[16];const S=g,f=ue[s.status]??ue.completed,y=f.icon;let _;e[17]!==s.title?(_=t.jsx(se,{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]=_):_=e[18];let d;e[19]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ie,{}),e[19]=d):d=e[19];let C;e[20]!==v||e[21]!==o?(C=t.jsx(Pe,{icon:v,name:o,size:"xs",fallbackIcon:d,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=v,e[21]=o,e[22]=C):C=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 w;e[25]!==C||e[26]!==T?(w=t.jsx(se,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,T]})}),e[25]=C,e[26]=T,e[27]=w):w=e[27];let I;e[28]!==p||e[29]!==u?(I=t.jsx(We,{url:p,fallback:u,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=p,e[29]=u,e[30]=I):I=e[30];let k;e[31]!==u?(k=t.jsx("span",{className:"truncate",children:u}),e[31]=u,e[32]=k):k=e[32];let P;e[33]!==I||e[34]!==k?(P=t.jsx(se,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I,k]})}),e[33]=I,e[34]=k,e[35]=P):P=e[35];let D;e[36]!==y||e[37]!==f.iconClassName?(D=t.jsx(y,{size:14,className:f.iconClassName}),e[36]=y,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 $;e[44]!==D||e[45]!==A?($=t.jsx(se,{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]=$):$=e[46];let B;e[47]!==n?(B=n?De(n.totalTokens):"—",e[47]=n,e[48]=B):B=e[48];let F;e[49]!==B?(F=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:B}),e[49]=B,e[50]=F):F=e[50];let Z;e[51]!==n?(Z=n&&n.costUsd>0?Re(n.costUsd):"—",e[51]=n,e[52]=Z):Z=e[52];let q;e[53]!==Z?(q=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:Z}),e[53]=Z,e[54]=q):q=e[54];let U;e[55]!==j?(U=t.jsx("div",{children:j}),e[55]=j,e[56]=U):U=e[56];let O;e[57]!==S?(O=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=O):O=e[58];let L;e[59]!==U||e[60]!==O?(L=t.jsxs(se,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[U,O]}),e[59]=U,e[60]=O,e[61]=L):L=e[61];let K;return e[62]!==c||e[63]!==m||e[64]!==P||e[65]!==$||e[66]!==F||e[67]!==q||e[68]!==L||e[69]!==_||e[70]!==w?(K=t.jsxs(Ne,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:m,children:[_,w,P,$,F,q,L]}),e[62]=c,e[63]=m,e[64]=P,e[65]=$,e[66]=F,e[67]=q,e[68]=L,e[69]=_,e[70]=w,e[71]=K):K=e[71],K}const Ce=100;function $t(l){const e=le.c(37),{client:s,locator:n,thread:r,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}=l;let x;e[0]!==n||e[1]!==r.id?(x=xe.threadMessages(n,r.id),e[0]=n,e[1]=r.id,e[2]=x):x=e[2];let h;e[3]!==s||e[4]!==r.id?(h=async k=>{const{pageParam:P}=k,D=P===void 0?0:P;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:Ce,offset:D}});return M.structuredContent??M},e[3]=s,e[4]=r.id,e[5]=h):h=e[5];let N;e[6]!==x||e[7]!==h?(N={queryKey:x,queryFn:h,initialPageParam:0,getNextPageParam:Ut,staleTime:6e4},e[6]=x,e[7]=h,e[8]=N):N=e[8];const{data:u,fetchNextPage:p,hasNextPage:j,isFetchingNextPage:g}=xt(N);let S;e[9]!==u.pages?(S=u.pages.flatMap(Ft).filter(Lt),e[9]=u.pages,e[10]=S):S=e[10];const f=S,y=Ct(f);let _;e[11]!==p||e[12]!==j||e[13]!==g?(_=()=>{j&&!g&&p()},e[11]=p,e[12]=j,e[13]=g,e[14]=_):_=e[14];const d=ke(_,j??!1,g);let C;e[15]!==i||e[16]!==v||e[17]!==b||e[18]!==c||e[19]!==r||e[20]!==o||e[21]!==a?(C=t.jsx(we,{thread:r,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[15]=i,e[16]=v,e[17]=b,e[18]=c,e[19]=r,e[20]=o,e[21]=a,e[22]=C):C=e[22];let T;e[23]!==i||e[24]!==m||e[25]!==r||e[26]!==a?(T=t.jsx(At,{thread:r,connections:i,virtualMcps:a,members:m}),e[23]=i,e[24]=m,e[25]=r,e[26]=a,e[27]=T):T=e[27];let w;e[28]!==g||e[29]!==d||e[30]!==y||e[31]!==f.length?(w=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:[y.map((k,P)=>t.jsx("div",{ref:P===y.length-1?d:void 0,children:t.jsx(_t,{pair:k,isLastPair:P===y.length-1,status:"ready"})},`pair-${k.user?.id??k.assistant?.id}`)),g&&t.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=g,e[29]=d,e[30]=y,e[31]=f.length,e[32]=w):w=e[32];let I;return e[33]!==C||e[34]!==T||e[35]!==w?(I=t.jsxs(t.Fragment,{children:[C,T,w]}),e[33]=C,e[34]=T,e[35]=w,e[36]=I):I=e[36],I}function Lt(l){return l.role==="user"||l.role==="assistant"}function Ft(l){return l.items??[]}function Ut(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Ce))return n.length*Ce}function et(l){const e=le.c(39),{thread:s,client:n,locator:r,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}=l;let x;e[0]!==i||e[1]!==v||e[2]!==b||e[3]!==c||e[4]!==s||e[5]!==o||e[6]!==a?(x=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[0]=i,e[1]=v,e[2]=b,e[3]=c,e[4]=s,e[5]=o,e[6]=a,e[7]=x):x=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=h):h=e[8];let N;e[9]!==x?(N=t.jsxs(t.Fragment,{children:[x,h]}),e[9]=x,e[10]=N):N=e[10];let u;e[11]!==i||e[12]!==v||e[13]!==b||e[14]!==c||e[15]!==s||e[16]!==o||e[17]!==a?(u=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[11]=i,e[12]=v,e[13]=b,e[14]=c,e[15]=s,e[16]=o,e[17]=a,e[18]=u):u=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 j;e[20]!==u?(j=t.jsxs(t.Fragment,{children:[u,p]}),e[20]=u,e[21]=j):j=e[21];let g;e[22]!==n||e[23]!==i||e[24]!==r||e[25]!==m||e[26]!==v||e[27]!==b||e[28]!==c||e[29]!==s||e[30]!==o||e[31]!==a?(g=t.jsx($t,{client:n,locator:r,thread:s,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[22]=n,e[23]=i,e[24]=r,e[25]=m,e[26]=v,e[27]=b,e[28]=c,e[29]=s,e[30]=o,e[31]=a,e[32]=g):g=e[32];let S;e[33]!==j||e[34]!==g?(S=t.jsx(oe.Suspense,{fallback:j,children:g}),e[33]=j,e[34]=g,e[35]=S):S=e[35];let f;return e[36]!==N||e[37]!==S?(f=t.jsx(tt,{fallback:N,children:S}),e[36]=N,e[37]=S,e[38]=f):f=e[38],f}function Is(l){const e=le.c(43),{filterAgentIds:s,filterUserIds:n,filterStatus:r,virtualMcpOptions:i,memberOptions:a,activeFiltersCount:m,onUpdateFilters:c}=l,[o,b]=oe.useState(!1);let v,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(wt,{size:16}),x=t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e[0]=v,e[1]=x):(v=e[0],x=e[1]);let h;e[2]!==m?(h=m>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:m}),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:m})]}),e[2]=m,e[3]=h):h=e[3];let N;e[4]!==h?(N=t.jsx(Je,{asChild:!0,children:t.jsxs(fe,{variant:"outline",className:"relative",children:[v,x,h]})}),e[4]=h,e[5]=N):N=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("h4",{className:"font-medium text-sm",children:"Filter Threads"}),e[6]=u):u=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 j;e[8]!==c?(j=M=>c({filterAgentIds:M.slice(0,1)}),e[8]=c,e[9]=j):j=e[9];let g;e[10]!==s||e[11]!==j||e[12]!==i?(g=t.jsxs("div",{children:[p,t.jsx(Ue,{options:i,defaultValue:s,onValueChange:j,placeholder:"All agents",variant:"secondary",className:"w-full",maxCount:1})]}),e[10]=s,e[11]=j,e[12]=i,e[13]=g):g=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 y;e[17]!==n||e[18]!==a||e[19]!==f?(y=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]=y):y=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Status"}),e[21]=_):_=e[21];let d;e[22]!==c?(d=M=>c({filterStatus:M}),e[22]=c,e[23]=d):d=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(ht,{className:"w-full",children:t.jsx(gt,{})}),e[24]=C):C=e[24];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(pt,{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 w;e[26]!==r||e[27]!==d?(w=t.jsxs("div",{children:[_,t.jsxs(jt,{value:r,onValueChange:d,children:[C,T]})]}),e[26]=r,e[27]=d,e[28]=w):w=e[28];let I;e[29]!==y||e[30]!==w||e[31]!==g?(I=t.jsxs("div",{className:"space-y-3",children:[g,y,w]}),e[29]=y,e[30]=w,e[31]=g,e[32]=I):I=e[32];let k;e[33]!==m||e[34]!==c?(k=m>0&&t.jsx(fe,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{c({filterAgentIds:[],filterUserIds:[],filterStatus:"all"}),b(!1)},children:"Clear all filters"}),e[33]=m,e[34]=c,e[35]=k):k=e[35];let P;e[36]!==I||e[37]!==k?(P=t.jsx(Qe,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[u,I,k]})}),e[36]=I,e[37]=k,e[38]=P):P=e[38];let D;return e[39]!==o||e[40]!==P||e[41]!==N?(D=t.jsxs(Ze,{open:o,onOpenChange:b,children:[N,P]}),e[39]=o,e[40]=P,e[41]=N,e[42]=D):D=e[42],D}const _e=50;function Ps(l){const e=le.c(29),{client:s,locator:n,membersData:r,allConnections:i,allVirtualMcps:a,dateRange:m,searchQuery:c,filterAgentIds:o,filterUserIds:b,filterStatus:v}=l,[x,h]=oe.useState(null),N=m.startDate.toISOString(),u=m.endDate.toISOString(),p=JSON.stringify({startDate:N,endDate:u,search:c,agentIds:o,userIds:b,status:v}),{data:j,fetchNextPage:g,hasNextPage:S,isFetchingNextPage:f,isLoading:y}=ze({queryKey:xe.threadsInfinite(n,p),queryFn:async R=>{const{pageParam:G}=R,ie=G===void 0?0:G;if(!s)throw new Error("MCP client is not available");const E=await s.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:_e,offset:ie,startDate:N,endDate:u,...c?{search:c}:{},...o&&o.length>0?{agentId:o[0]}:{},...b&&b.length>0?{userId:b[0]}:{},...v&&v!=="all"?{status:v}:{}}});return E.structuredContent??E},initialPageParam:0,getNextPageParam:Gt,staleTime:3e4}),_=(j?.pages??[]).flatMap(qt),d=_.map(Kt),{data:C}=Ve({queryKey:xe.monitoringThreadUsage(n,JSON.stringify({ids:d,startDate:N,endDate:u})),queryFn:async()=>{if(!s)throw new Error("MCP client is not available");const R=await s.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:d,startDate:N,endDate:u}});return R.structuredContent??R},enabled:!!s&&d.length>0,staleTime:3e4}),T=new Map((C?.items??[]).map(zt)),[w,I]=oe.useState(null),[k,P]=oe.useState("desc");let D;e[0]!==w?(D=R=>{w===R?P(Vt):(I(R),P("desc"))},e[0]=w,e[1]=D):D=e[1];const M=D,A=R=>{const G=T.get(R);return G?w==="cost"?G.costUsd:G.totalTokens:0},$=w?[..._].sort((R,G)=>{const ie=A(R.id),E=A(G.id);return k==="desc"?E-ie:ie-E}):_,B=x!==null?$[x]??null:null;let F;e[2]!==g||e[3]!==S||e[4]!==f?(F=()=>{S&&!f&&g()},e[2]=g,e[3]=S,e[4]=f,e[5]=F):F=e[5];const q=ke(F,S??!1,f),U=!!c||(o?.length??0)>0||(b?.length??0)>0||v&&v!=="all";let O;e[6]===Symbol.for("react.memo_cache_sentinel")?(O=()=>h(Ot),e[6]=O):O=e[6];const L=O,K=()=>h(R=>R!==null&&R<$.length-1?R+1:R),V="flex-1 flex flex-col overflow-auto min-w-0",J="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",z="flex-1 flex flex-col min-w-0",Q="flex-1 min-w-0 pt-1",ce="min-w-0",W=y?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"})}):_.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Se,{title:U?"No matching threads":"No threads in this time range",description:U?"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(te,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),t.jsx(te,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),t.jsx(te,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(te,{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",w==="tokens"&&(k==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(te,{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",w==="cost"&&(k==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(te,{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:$.map((R,G)=>t.jsx(Et,{thread:R,usage:T.get(R.id),members:r,connections:i,virtualMcps:a,onClick:()=>h(G),lastRowRef:G===$.length-1?q:void 0},R.id))})]}),f&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let Y;e[7]!==W?(Y=t.jsx("div",{className:J,children:t.jsx("div",{className:z,children:t.jsx("div",{className:Q,children:t.jsx("div",{className:ce,children:W})})})}),e[7]=W,e[8]=Y):Y=e[8];const de=x!==null;let ne;e[9]===Symbol.for("react.memo_cache_sentinel")?(ne=R=>{R||h(null)},e[9]=ne):ne=e[9];let ae;e[10]!==i||e[11]!==a||e[12]!==s||e[13]!==$||e[14]!==K||e[15]!==L||e[16]!==n||e[17]!==r||e[18]!==B||e[19]!==x?(ae=B&&x!==null&&t.jsx(et,{thread:B,client:s,locator:n,connections:i,virtualMcps:a,members:r,selectedIndex:x,total:$.length,onPrev:L,onNext:K}),e[10]=i,e[11]=a,e[12]=s,e[13]=$,e[14]=K,e[15]=L,e[16]=n,e[17]=r,e[18]=B,e[19]=x,e[20]=ae):ae=e[20];let X;e[21]!==ae?(X=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:ae}),e[21]=ae,e[22]=X):X=e[22];let ee;e[23]!==de||e[24]!==X?(ee=t.jsx(qe,{open:de,onOpenChange:ne,children:X}),e[23]=de,e[24]=X,e[25]=ee):ee=e[25];let re;return e[26]!==Y||e[27]!==ee?(re=t.jsxs("div",{className:V,children:[Y,ee]}),e[26]=Y,e[27]=ee,e[28]=re):re=e[28],re}function Ot(l){return l!==null&&l>0?l-1:l}function Vt(l){return l==="desc"?"asc":"desc"}function zt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Kt(l){return l.id}function qt(l){return l.items??[]}function Gt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<_e))return n.length*_e}const Te=50;function pe(l){const e=le.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 m;e[4]!==r?(m=r&&t.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=m):m=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==m?(c=t.jsxs(ct,{className:"pt-4 px-4 pb-5 gap-1",children:[i,a,m]}),e[6]=i,e[7]=a,e[8]=m,e[9]=c):c=e[9],c}function Ht(l){const e=le.c(27),{automationId:s,range:n}=l,{data:r,isLoading:i}=ft(s,n),a=r?.runs,m=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,b=m&&m.truncated?`last ${m.sampledRuns} runs`:void 0;let v;e[2]!==i||e[3]!==a?.total?(v=i?"…":a?.total.toLocaleString()??"0",e[2]=i,e[3]=a?.total,e[4]=v):v=e[4];const x=a?`${a.completed} ok · ${a.failed} failed${a.inProgress>0?` · ${a.inProgress} running`:""}`:void 0;let h;e[5]!==v||e[6]!==x?(h=t.jsx(pe,{title:"Runs",value:v,subtitle:x}),e[5]=v,e[6]=x,e[7]=h):h=e[7];const N=i?"…":o;let u;e[8]!==N?(u=t.jsx(pe,{title:"Success rate",value:N}),e[8]=N,e[9]=u):u=e[9];let p;e[10]!==i||e[11]!==m?.totalTokens?(p=i?"…":De(m?.totalTokens??0),e[10]=i,e[11]=m?.totalTokens,e[12]=p):p=e[12];let j;e[13]!==p||e[14]!==b?(j=t.jsx(pe,{title:"Tokens",value:p,subtitle:b}),e[13]=p,e[14]=b,e[15]=j):j=e[15];let g;e[16]!==i||e[17]!==m?(g=i?"…":m&&m.costUsd>0?Re(m.costUsd):"—",e[16]=i,e[17]=m,e[18]=g):g=e[18];let S;e[19]!==g||e[20]!==b?(S=t.jsx(pe,{title:"Cost",value:g,subtitle:b}),e[19]=g,e[20]=b,e[21]=S):S=e[21];let f;return e[22]!==S||e[23]!==h||e[24]!==u||e[25]!==j?(f=t.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[h,u,j,S]}),e[22]=S,e[23]=h,e[24]=u,e[25]=j,e[26]=f):f=e[26],f}function Bt(l){const e=le.c(39),{run:s,usage:n,onClick:r,lastRowRef:i}=l;let a,m;if(e[0]!==s.created_at){const C=new Date(s.created_at);a=C.toLocaleDateString("en-US",{month:"short",day:"numeric"}),m=C.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=s.created_at,e[1]=a,e[2]=m}else a=e[1],m=e[2];const c=m,o=ue[s.status]??ue.completed,b=o.icon;let v;e[3]!==s.title?(v=t.jsx(se,{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]=v):v=e[4];let x;e[5]!==b||e[6]!==o.iconClassName?(x=t.jsx(b,{size:14,className:o.iconClassName}),e[5]=b,e[6]=o.iconClassName,e[7]=x):x=e[7];let h;e[8]!==o.labelColor?(h=be("text-sm",o.labelColor),e[8]=o.labelColor,e[9]=h):h=e[9];let N;e[10]!==o.label||e[11]!==h?(N=t.jsx("span",{className:h,children:o.label}),e[10]=o.label,e[11]=h,e[12]=N):N=e[12];let u;e[13]!==x||e[14]!==N?(u=t.jsx(se,{className:"w-28 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[x,N]})}),e[13]=x,e[14]=N,e[15]=u):u=e[15];let p;e[16]!==n?(p=n?De(n.totalTokens):"—",e[16]=n,e[17]=p):p=e[17];let j;e[18]!==p?(j=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:p}),e[18]=p,e[19]=j):j=e[19];let g;e[20]!==n?(g=n&&n.costUsd>0?Re(n.costUsd):"—",e[20]=n,e[21]=g):g=e[21];let S;e[22]!==g?(S=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:g}),e[22]=g,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 y;e[26]!==c?(y=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=y):y=e[27];let _;e[28]!==f||e[29]!==y?(_=t.jsxs(se,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[f,y]}),e[28]=f,e[29]=y,e[30]=_):_=e[30];let d;return e[31]!==i||e[32]!==r||e[33]!==S||e[34]!==_||e[35]!==v||e[36]!==u||e[37]!==j?(d=t.jsxs(Ne,{ref:i,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[v,u,j,S,_]}),e[31]=i,e[32]=r,e[33]=S,e[34]=_,e[35]=v,e[36]=u,e[37]=j,e[38]=d):d=e[38],d}function Ms(l){const e=le.c(48),{automationId:s,triggerIds:n,range:r}=l,{org:i,locator:a}=st();let m;e[0]!==i.id||e[1]!==i.slug?(m={connectionId:rt,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=m):m=e[2];const c=it(m),o=lt(),b=ot(),{data:v}=ut(),[x,h]=oe.useState(null),N=n.length>0;let u;e[3]!==s||e[4]!==i.id||e[5]!==n?(u=xe.automationRuns(i.id,s,n),e[3]=s,e[4]=i.id,e[5]=n,e[6]=u):u=e[6];let p;e[7]!==c||e[8]!==n?(p=async z=>{const{pageParam:Q}=z,ce=Q===void 0?0:Q,W=await c.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Te,offset:ce,where:{trigger_ids:n}}});return W.structuredContent??W},e[7]=c,e[8]=n,e[9]=p):p=e[9];let j;e[10]!==N||e[11]!==u||e[12]!==p?(j={queryKey:u,queryFn:p,initialPageParam:0,getNextPageParam:Yt,enabled:N,staleTime:3e4},e[10]=N,e[11]=u,e[12]=p,e[13]=j):j=e[13];const{data:g,fetchNextPage:S,hasNextPage:f,isFetchingNextPage:y,isLoading:_}=ze(j),d=(g?.pages??[]).flatMap(Wt),C=d.map(Zt),{data:T}=Ve({queryKey:xe.monitoringThreadUsage(a,JSON.stringify({ids:C,...r})),queryFn:async()=>{const z=await c.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:C,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}});return z.structuredContent??z},enabled:C.length>0,staleTime:3e4});let w;e[14]!==T?.items?(w=new Map((T?.items??[]).map(Qt)),e[14]=T?.items,e[15]=w):w=e[15];const I=w;let k;e[16]!==S||e[17]!==f||e[18]!==y?(k=()=>{f&&!y&&S()},e[16]=S,e[17]=f,e[18]=y,e[19]=k):k=e[19];const P=ke(k,f??!1,y),D=x!==null?d[x]??null:null;let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=()=>h(Jt),e[20]=M):M=e[20];const A=M,$=()=>h(z=>z!==null&&z<d.length-1?z+1:z),B="flex flex-col gap-5";let F;e[21]!==s||e[22]!==r?(F=t.jsx(Ht,{automationId:s,range:r}),e[21]=s,e[22]=r,e[23]=F):F=e[23];const Z=N?_?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):d.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(te,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),t.jsx(te,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),t.jsx(te,{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:d.map((z,Q)=>t.jsx(Bt,{run:z,usage:I.get(z.id),onClick:()=>h(Q),lastRowRef:Q===d.length-1?P: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 q;e[24]!==y?(q=y&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=y,e[25]=q):q=e[25];const U=x!==null;let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=z=>{z||h(null)},e[26]=O):O=e[26];let L;e[27]!==o||e[28]!==b||e[29]!==c||e[30]!==$||e[31]!==A||e[32]!==a||e[33]!==v||e[34]!==d||e[35]!==D||e[36]!==x?(L=D&&x!==null&&t.jsx(et,{thread:D,client:c,locator:a,connections:o,virtualMcps:b,members:v,selectedIndex:x,total:d.length,onPrev:A,onNext:$}),e[27]=o,e[28]=b,e[29]=c,e[30]=$,e[31]=A,e[32]=a,e[33]=v,e[34]=d,e[35]=D,e[36]=x,e[37]=L):L=e[37];let K;e[38]!==L?(K=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:L}),e[38]=L,e[39]=K):K=e[39];let V;e[40]!==U||e[41]!==K?(V=t.jsx(qe,{open:U,onOpenChange:O,children:K}),e[40]=U,e[41]=K,e[42]=V):V=e[42];let J;return e[43]!==Z||e[44]!==q||e[45]!==V||e[46]!==F?(J=t.jsxs("div",{className:B,children:[F,Z,q,V]}),e[43]=Z,e[44]=q,e[45]=V,e[46]=F,e[47]=J):J=e[47],J}function Jt(l){return l!==null&&l>0?l-1:l}function Qt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Zt(l){return l.id}function Wt(l){return l.items??[]}function Yt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Te))return n.length*Te}export{Ms as A,Ue as M,Is as T,Re as a,_s as b,Rt as c,ks as d,Ts as e,De as f,Cs as g,Xe as h,Ps as i};
1
+ import{e as le,r as oe,c as be,j as t,B as fe,K as xe,n as Ve,E as tt,q as st}from"./index-DRJmNXDD.js";import{u as ze}from"./useInfiniteQuery-Btju8noP.js";import{u as lt}from"./use-connection-B0F76h3F.js";import{i as nt,g as at,S as rt,u as it}from"./constants-Dn21fsKH.js";import{a as ot}from"./use-virtual-mcp-KmXVB9CJ.js";import{C as ct}from"./card-CIVB52uv.js";import{a as Ke,b as qe,S as dt,d as mt}from"./sheet-Cba9SmBC.js";import{c as Ge,d as He,a as Ne,e as te,b as Be,T as se}from"./table-MxnMAdrI.js";import{E as Se}from"./empty-state-cflEad3j.js";import{u as ke}from"./use-infinite-scroll-pHyCBgQe.js";import{u as ut}from"./use-members-BqiYNK1W.js";import{S as ue}from"./task-status-CvJhfkMQ.js";import{e as ft}from"./use-automations-BqkQGVej.js";import{u as xt}from"./useSuspenseInfiniteQuery-gzhivT15.js";import{B as je}from"./badge-BXuo1VOW.js";import{S as ht,a as gt,b as pt,c as ge,d as jt}from"./select-DeypuT4J.js";import{C as Le}from"./checkbox-JEI0UJfB.js";import{t as he}from"./ChevronDown-C2c6sinL.js";import{c as bt,C as Nt,e as Fe,d as vt,a as St,b as yt}from"./command-CDpjPeBK.js";import{a as Je,b as Qe,P as Ze}from"./popover-D2FcxHoI.js";import{A as We}from"./avatar-k6SwlvSl.js";import{n as ye}from"./ChevronUp-D_wwe57U.js";import{n as Ie}from"./Container-BvPpGZnd.js";import{i as wt}from"./FilterLines-BlZKlG21.js";import{m as Ct,n as _t}from"./pair-OYZMJU42.js";import{I as Pe}from"./integration-icon-C9H4lbsU.js";function Ue(l){const e=le.c(74),{options:s,onValueChange:n,defaultValue:r,placeholder:i,variant:a,animation:m,maxCount:c,modalPopover:o,asChild:b,className:v,disabled:x,onSearchChange:h}=l;let N;e[0]!==r?(N=r===void 0?[]:r,e[0]=r,e[1]=N):N=e[1];const u=N,p=i===void 0?"Select items":i,j=a===void 0?"default":a,g=m===void 0?0:m,S=c===void 0?3:c,f=o===void 0?!1:o,y=b===void 0?!1:b,_=x===void 0?!1:x,[d,C]=oe.useState(u),[T,w]=oe.useState(!1);let I,k;e[2]!==u||e[3]!==d?(I=()=>{JSON.stringify(d)!==JSON.stringify(u)&&C(u)},k=[u,d],e[2]=u,e[3]=d,e[4]=I,e[5]=k):(I=e[4],k=e[5]),oe.useEffect(I,k);let P;e[6]!==n||e[7]!==d?(P=E=>{if(E.key==="Enter")w(!0);else if(E.key==="Backspace"&&!E.currentTarget.value){const H=[...d];H.pop(),C(H),n(H)}},e[6]=n,e[7]=d,e[8]=P):P=e[8];const D=P;let M;e[9]!==n||e[10]!==d?(M=E=>{const H=d.includes(E.value)?d.filter(me=>me!==E.value):[...d,E.value];C(H),n(H)},e[9]=n,e[10]=d,e[11]=M):M=e[11];const A=M;let $;e[12]!==n?($=()=>{C([]),n([])},e[12]=n,e[13]=$):$=e[13];const B=$;let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{w(Pt)},e[14]=F):F=e[14];const Z=F;let q;e[15]!==B||e[16]!==n||e[17]!==s||e[18]!==d.length?(q=()=>{if(d.length===s.length)B();else{const E=s.map(It);C(E),n(E)}},e[15]=B,e[16]=n,e[17]=s,e[18]=d.length,e[19]=q):q=e[19];const U=q;let O;e[20]!==y?(O=y?{}:{variant:"outline"},e[20]=y,e[21]=O):O=e[21];let L;e[22]!==v?(L=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",v),e[22]=v,e[23]=L):L=e[23];let K;e[24]!==g||e[25]!==S||e[26]!==s||e[27]!==p||e[28]!==d||e[29]!==j?(K=d.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:[d.slice(0,S).map(E=>{const H=s.find(ve=>ve.value===E),me=H?.icon;return t.jsxs(je,{variant:j==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${g}s`},children:[me&&t.jsx(me,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:H?.label})]},E)}),d.length>S&&t.jsxs(je,{variant:j==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${g}s`},children:["+",d.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]=g,e[25]=S,e[26]=s,e[27]=p,e[28]=d,e[29]=j,e[30]=K):K=e[30];let V;e[31]!==_||e[32]!==O||e[33]!==L||e[34]!==K?(V=t.jsx(Je,{asChild:!0,children:t.jsx(fe,{ref:null,...O,onClick:Z,className:L,disabled:_,children:K})}),e[31]=_,e[32]=O,e[33]=L,e[34]=K,e[35]=V):V=e[35];let J;e[36]===Symbol.for("react.memo_cache_sentinel")?(J=()=>w(!1),e[36]=J):J=e[36];const z=!h;let Q;e[37]!==D||e[38]!==h?(Q=t.jsx(bt,{placeholder:"Search...",onKeyDown:D,onValueChange:h,className:"rounded-t-xl"}),e[37]=D,e[38]=h,e[39]=Q):Q=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=t.jsx(Nt,{children:"No results found."}),e[40]=ce):ce=e[40];let W;e[41]!==U?(W=()=>{U()},e[41]=U,e[42]=W):W=e[42];let Y;e[43]!==U?(Y=E=>{E.stopPropagation(),U()},e[43]=U,e[44]=Y):Y=e[44];const de=d.length===s.length&&s.length>0;let ne;e[45]!==de||e[46]!==U?(ne=t.jsx(Le,{checked:de,onCheckedChange:U,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:kt}),e[45]=de,e[46]=U,e[47]=ne):ne=e[47];let ae;e[48]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx("span",{children:"(Select All)"}),e[48]=ae):ae=e[48];let X;e[49]!==Y||e[50]!==ne?(X=t.jsxs("div",{className:"flex items-center w-full",onClick:Y,children:[ne,ae]}),e[49]=Y,e[50]=ne,e[51]=X):X=e[51];let ee;e[52]!==W||e[53]!==X?(ee=t.jsx(Fe,{onSelect:W,className:"cursor-pointer",children:X},"all"),e[52]=W,e[53]=X,e[54]=ee):ee=e[54];let re;if(e[55]!==s||e[56]!==d||e[57]!==A){let E;e[59]!==d||e[60]!==A?(E=H=>{const me=d.includes(H.value);return t.jsx(Fe,{onSelect:()=>{A(H)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ve=>{ve.stopPropagation(),A(H)},children:[t.jsx(Le,{checked:me,onCheckedChange:()=>{A(H)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:Tt}),H.icon&&t.jsx(H.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:H.label})]})},H.value)},e[59]=d,e[60]=A,e[61]=E):E=e[61],re=s.map(E),e[55]=s,e[56]=d,e[57]=A,e[58]=re}else re=e[58];let R;e[62]!==ee||e[63]!==re?(R=t.jsxs(vt,{className:"rounded-b-xl",children:[ce,t.jsxs(St,{children:[ee,re]})]}),e[62]=ee,e[63]=re,e[64]=R):R=e[64];let G;e[65]!==z||e[66]!==Q||e[67]!==R?(G=t.jsx(Qe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:J,children:t.jsxs(yt,{shouldFilter:z,className:"rounded-xl",children:[Q,R]})}),e[65]=z,e[66]=Q,e[67]=R,e[68]=G):G=e[68];let ie;return e[69]!==T||e[70]!==f||e[71]!==V||e[72]!==G?(ie=t.jsxs(Ze,{open:T,onOpenChange:w,modal:f,children:[V,G]}),e[69]=T,e[70]=f,e[71]=V,e[72]=G,e[73]=ie):ie=e[73],ie}function Tt(l){return l.stopPropagation()}function kt(l){return l.stopPropagation()}function It(l){return l.value}function Pt(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"}],Mt=40;function Cs(l){const s=(l.endDate.getTime()-l.startDate.getTime())/Mt;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 Dt(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 Rt(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 _s(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])),m=[];for(let c=r;c<=i;c+=n){const o=a.get(c),b=new Date(c).toISOString();m.push({t:b,ts:c,label:Dt(b,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 m}function Ts(l,e){return e==="requests"?l.calls:e==="errors"?l.errorRate:l.avgDurationMs}function ks(l,e){return e==="requests"?l.calls.toLocaleString():e==="errors"?`${l.errorRate.toFixed(1)}%`:Rt(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=le.c(33),{thread:s,connections:n,virtualMcps:r,selectedIndex:i,total:a,onPrev:m,onNext:c}=l;let o,b;if(e[0]!==n||e[1]!==s||e[2]!==r){const I=Ae(s);o=Ee(I,r,n,""),b=$e(I,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=o,e[4]=b}else o=e[3],b=e[4];const v=b,x=o||s.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Ie,{}),e[5]=h):h=e[5];let N;e[6]!==v||e[7]!==x?(N=t.jsx(Pe,{icon:v,name:x,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=v,e[7]=x,e[8]=N):N=e[8];let u;e[9]!==s.title?(u=t.jsx(dt,{className:"text-sm leading-snug truncate",children:s.title}),e[9]=s.title,e[10]=u):u=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 j;e[13]!==u||e[14]!==p?(j=t.jsxs("div",{className:"min-w-0",children:[u,p]}),e[13]=u,e[14]=p,e[15]=j):j=e[15];let g;e[16]!==N||e[17]!==j?(g=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[N,j]}),e[16]=N,e[17]=j,e[18]=g):g=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 y;e[20]!==m||e[21]!==S?(y=t.jsx(fe,{size:"icon",variant:"ghost",onClick:m,disabled:S,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous thread",children:f}),e[20]=m,e[21]=S,e[22]=y):y=e[22];const _=i===a-1;let d;e[23]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(he,{size:14}),e[23]=d):d=e[23];let C;e[24]!==c||e[25]!==_?(C=t.jsx(fe,{size:"icon",variant:"ghost",onClick:c,disabled:_,className:"h-7 w-7 text-muted-foreground","aria-label":"Next thread",children:d}),e[24]=c,e[25]=_,e[26]=C):C=e[26];let T;e[27]!==y||e[28]!==C?(T=t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,C]}),e[27]=y,e[28]=C,e[29]=T):T=e[29];let w;return e[30]!==T||e[31]!==g?(w=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:[g,T]})}),e[30]=T,e[31]=g,e[32]=w):w=e[32],w}function At(l){const e=le.c(48),{thread:s,connections:n,virtualMcps:r,members:i}=l;let a,m;if(e[0]!==n||e[1]!==s||e[2]!==r){const M=Ae(s);a=Ee(M,r,n,""),m=$e(M,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=a,e[4]=m}else a=e[3],m=e[4];const c=m;let o;if(e[5]!==i||e[6]!==s.created_by){const M=Xe(i);let A;e[8]!==s.created_by?(A=$=>$.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 b=o;let v;e[10]!==b?.user.email||e[11]!==b?.user.name||e[12]!==s.created_by?(v=b?.user.name??b?.user.email??s.created_by?.substring(0,8)??"—",e[10]=b?.user.email,e[11]=b?.user.name,e[12]=s.created_by,e[13]=v):v=e[13];const x=v,h=b?.user.image??void 0;let N;e[14]!==s.created_at?(N=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]=N):N=e[15];const u=N,p=ue[s.status]??ue.completed,j=p.icon;let g;e[16]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=g):g=e[16];let S;e[17]!==j||e[18]!==p.iconClassName?(S=t.jsx(j,{size:13,className:p.iconClassName}),e[17]=j,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 y;e[22]!==p.label||e[23]!==f?(y=t.jsx("span",{className:f,children:p.label}),e[22]=p.label,e[23]=f,e[24]=y):y=e[24];let _;e[25]!==S||e[26]!==y?(_=t.jsxs("div",{children:[g,t.jsxs("div",{className:"flex items-center gap-1.5",children:[S,y]})]}),e[25]=S,e[26]=y,e[27]=_):_=e[27];let d;e[28]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=d):d=e[28];let C;e[29]!==u?(C=t.jsxs("div",{children:[d,t.jsx("div",{className:"text-sm text-foreground",children:u})]}),e[29]=u,e[30]=C):C=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 w;e[32]!==h||e[33]!==x?(w=t.jsx(We,{url:h,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=h,e[33]=x,e[34]=w):w=e[34];let I;e[35]!==x?(I=t.jsx("span",{className:"text-sm text-foreground",children:x}),e[35]=x,e[36]=I):I=e[36];let k;e[37]!==w||e[38]!==I?(k=t.jsxs("div",{children:[T,t.jsxs("div",{className:"flex items-center gap-2",children:[w,I]})]}),e[37]=w,e[38]=I,e[39]=k):k=e[39];let P;e[40]!==c||e[41]!==a?(P=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]=P):P=e[42];let D;return e[43]!==C||e[44]!==k||e[45]!==P||e[46]!==_?(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:[_,C,k,P]}),e[43]=C,e[44]=k,e[45]=P,e[46]=_,e[47]=D):D=e[47],D}function Et(l){const e=le.c(72),{thread:s,usage:n,members:r,connections:i,virtualMcps:a,onClick:m,lastRowRef:c}=l;let o,b;if(e[0]!==i||e[1]!==s||e[2]!==a){const V=Ae(s);o=Ee(V,a,i,"—"),b=$e(V,a,i),e[0]=i,e[1]=s,e[2]=a,e[3]=o,e[4]=b}else o=e[3],b=e[4];const v=b;let x;if(e[5]!==r||e[6]!==s.created_by){const V=Xe(r);let J;e[8]!==s.created_by?(J=z=>z.userId===s.created_by,e[8]=s.created_by,e[9]=J):J=e[9],x=V.find(J),e[5]=r,e[6]=s.created_by,e[7]=x}else x=e[7];const h=x;let N;e[10]!==h?.user.email||e[11]!==h?.user.name||e[12]!==s.created_by?(N=h?.user.name??h?.user.email??s.created_by?.substring(0,8)??"—",e[10]=h?.user.email,e[11]=h?.user.name,e[12]=s.created_by,e[13]=N):N=e[13];const u=N,p=h?.user.image??void 0;let j,g;if(e[14]!==s.created_at){const V=new Date(s.created_at);j=V.toLocaleDateString("en-US",{month:"short",day:"numeric"}),g=V.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=s.created_at,e[15]=j,e[16]=g}else j=e[15],g=e[16];const S=g,f=ue[s.status]??ue.completed,y=f.icon;let _;e[17]!==s.title?(_=t.jsx(se,{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]=_):_=e[18];let d;e[19]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ie,{}),e[19]=d):d=e[19];let C;e[20]!==v||e[21]!==o?(C=t.jsx(Pe,{icon:v,name:o,size:"xs",fallbackIcon:d,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=v,e[21]=o,e[22]=C):C=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 w;e[25]!==C||e[26]!==T?(w=t.jsx(se,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,T]})}),e[25]=C,e[26]=T,e[27]=w):w=e[27];let I;e[28]!==p||e[29]!==u?(I=t.jsx(We,{url:p,fallback:u,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=p,e[29]=u,e[30]=I):I=e[30];let k;e[31]!==u?(k=t.jsx("span",{className:"truncate",children:u}),e[31]=u,e[32]=k):k=e[32];let P;e[33]!==I||e[34]!==k?(P=t.jsx(se,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I,k]})}),e[33]=I,e[34]=k,e[35]=P):P=e[35];let D;e[36]!==y||e[37]!==f.iconClassName?(D=t.jsx(y,{size:14,className:f.iconClassName}),e[36]=y,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 $;e[44]!==D||e[45]!==A?($=t.jsx(se,{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]=$):$=e[46];let B;e[47]!==n?(B=n?De(n.totalTokens):"—",e[47]=n,e[48]=B):B=e[48];let F;e[49]!==B?(F=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:B}),e[49]=B,e[50]=F):F=e[50];let Z;e[51]!==n?(Z=n&&n.costUsd>0?Re(n.costUsd):"—",e[51]=n,e[52]=Z):Z=e[52];let q;e[53]!==Z?(q=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:Z}),e[53]=Z,e[54]=q):q=e[54];let U;e[55]!==j?(U=t.jsx("div",{children:j}),e[55]=j,e[56]=U):U=e[56];let O;e[57]!==S?(O=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=O):O=e[58];let L;e[59]!==U||e[60]!==O?(L=t.jsxs(se,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[U,O]}),e[59]=U,e[60]=O,e[61]=L):L=e[61];let K;return e[62]!==c||e[63]!==m||e[64]!==P||e[65]!==$||e[66]!==F||e[67]!==q||e[68]!==L||e[69]!==_||e[70]!==w?(K=t.jsxs(Ne,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:m,children:[_,w,P,$,F,q,L]}),e[62]=c,e[63]=m,e[64]=P,e[65]=$,e[66]=F,e[67]=q,e[68]=L,e[69]=_,e[70]=w,e[71]=K):K=e[71],K}const Ce=100;function $t(l){const e=le.c(37),{client:s,locator:n,thread:r,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}=l;let x;e[0]!==n||e[1]!==r.id?(x=xe.threadMessages(n,r.id),e[0]=n,e[1]=r.id,e[2]=x):x=e[2];let h;e[3]!==s||e[4]!==r.id?(h=async k=>{const{pageParam:P}=k,D=P===void 0?0:P;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:Ce,offset:D}});return M.structuredContent??M},e[3]=s,e[4]=r.id,e[5]=h):h=e[5];let N;e[6]!==x||e[7]!==h?(N={queryKey:x,queryFn:h,initialPageParam:0,getNextPageParam:Ut,staleTime:6e4},e[6]=x,e[7]=h,e[8]=N):N=e[8];const{data:u,fetchNextPage:p,hasNextPage:j,isFetchingNextPage:g}=xt(N);let S;e[9]!==u.pages?(S=u.pages.flatMap(Ft).filter(Lt),e[9]=u.pages,e[10]=S):S=e[10];const f=S,y=Ct(f);let _;e[11]!==p||e[12]!==j||e[13]!==g?(_=()=>{j&&!g&&p()},e[11]=p,e[12]=j,e[13]=g,e[14]=_):_=e[14];const d=ke(_,j??!1,g);let C;e[15]!==i||e[16]!==v||e[17]!==b||e[18]!==c||e[19]!==r||e[20]!==o||e[21]!==a?(C=t.jsx(we,{thread:r,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[15]=i,e[16]=v,e[17]=b,e[18]=c,e[19]=r,e[20]=o,e[21]=a,e[22]=C):C=e[22];let T;e[23]!==i||e[24]!==m||e[25]!==r||e[26]!==a?(T=t.jsx(At,{thread:r,connections:i,virtualMcps:a,members:m}),e[23]=i,e[24]=m,e[25]=r,e[26]=a,e[27]=T):T=e[27];let w;e[28]!==g||e[29]!==d||e[30]!==y||e[31]!==f.length?(w=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:[y.map((k,P)=>t.jsx("div",{ref:P===y.length-1?d:void 0,children:t.jsx(_t,{pair:k,isLastPair:P===y.length-1,status:"ready"})},`pair-${k.user?.id??k.assistant?.id}`)),g&&t.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=g,e[29]=d,e[30]=y,e[31]=f.length,e[32]=w):w=e[32];let I;return e[33]!==C||e[34]!==T||e[35]!==w?(I=t.jsxs(t.Fragment,{children:[C,T,w]}),e[33]=C,e[34]=T,e[35]=w,e[36]=I):I=e[36],I}function Lt(l){return l.role==="user"||l.role==="assistant"}function Ft(l){return l.items??[]}function Ut(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Ce))return n.length*Ce}function et(l){const e=le.c(39),{thread:s,client:n,locator:r,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}=l;let x;e[0]!==i||e[1]!==v||e[2]!==b||e[3]!==c||e[4]!==s||e[5]!==o||e[6]!==a?(x=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[0]=i,e[1]=v,e[2]=b,e[3]=c,e[4]=s,e[5]=o,e[6]=a,e[7]=x):x=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=h):h=e[8];let N;e[9]!==x?(N=t.jsxs(t.Fragment,{children:[x,h]}),e[9]=x,e[10]=N):N=e[10];let u;e[11]!==i||e[12]!==v||e[13]!==b||e[14]!==c||e[15]!==s||e[16]!==o||e[17]!==a?(u=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[11]=i,e[12]=v,e[13]=b,e[14]=c,e[15]=s,e[16]=o,e[17]=a,e[18]=u):u=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 j;e[20]!==u?(j=t.jsxs(t.Fragment,{children:[u,p]}),e[20]=u,e[21]=j):j=e[21];let g;e[22]!==n||e[23]!==i||e[24]!==r||e[25]!==m||e[26]!==v||e[27]!==b||e[28]!==c||e[29]!==s||e[30]!==o||e[31]!==a?(g=t.jsx($t,{client:n,locator:r,thread:s,connections:i,virtualMcps:a,members:m,selectedIndex:c,total:o,onPrev:b,onNext:v}),e[22]=n,e[23]=i,e[24]=r,e[25]=m,e[26]=v,e[27]=b,e[28]=c,e[29]=s,e[30]=o,e[31]=a,e[32]=g):g=e[32];let S;e[33]!==j||e[34]!==g?(S=t.jsx(oe.Suspense,{fallback:j,children:g}),e[33]=j,e[34]=g,e[35]=S):S=e[35];let f;return e[36]!==N||e[37]!==S?(f=t.jsx(tt,{fallback:N,children:S}),e[36]=N,e[37]=S,e[38]=f):f=e[38],f}function Is(l){const e=le.c(43),{filterAgentIds:s,filterUserIds:n,filterStatus:r,virtualMcpOptions:i,memberOptions:a,activeFiltersCount:m,onUpdateFilters:c}=l,[o,b]=oe.useState(!1);let v,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(wt,{size:16}),x=t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e[0]=v,e[1]=x):(v=e[0],x=e[1]);let h;e[2]!==m?(h=m>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:m}),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:m})]}),e[2]=m,e[3]=h):h=e[3];let N;e[4]!==h?(N=t.jsx(Je,{asChild:!0,children:t.jsxs(fe,{variant:"outline",className:"relative",children:[v,x,h]})}),e[4]=h,e[5]=N):N=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("h4",{className:"font-medium text-sm",children:"Filter Threads"}),e[6]=u):u=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 j;e[8]!==c?(j=M=>c({filterAgentIds:M.slice(0,1)}),e[8]=c,e[9]=j):j=e[9];let g;e[10]!==s||e[11]!==j||e[12]!==i?(g=t.jsxs("div",{children:[p,t.jsx(Ue,{options:i,defaultValue:s,onValueChange:j,placeholder:"All agents",variant:"secondary",className:"w-full",maxCount:1})]}),e[10]=s,e[11]=j,e[12]=i,e[13]=g):g=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 y;e[17]!==n||e[18]!==a||e[19]!==f?(y=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]=y):y=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Status"}),e[21]=_):_=e[21];let d;e[22]!==c?(d=M=>c({filterStatus:M}),e[22]=c,e[23]=d):d=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(ht,{className:"w-full",children:t.jsx(gt,{})}),e[24]=C):C=e[24];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(pt,{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 w;e[26]!==r||e[27]!==d?(w=t.jsxs("div",{children:[_,t.jsxs(jt,{value:r,onValueChange:d,children:[C,T]})]}),e[26]=r,e[27]=d,e[28]=w):w=e[28];let I;e[29]!==y||e[30]!==w||e[31]!==g?(I=t.jsxs("div",{className:"space-y-3",children:[g,y,w]}),e[29]=y,e[30]=w,e[31]=g,e[32]=I):I=e[32];let k;e[33]!==m||e[34]!==c?(k=m>0&&t.jsx(fe,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{c({filterAgentIds:[],filterUserIds:[],filterStatus:"all"}),b(!1)},children:"Clear all filters"}),e[33]=m,e[34]=c,e[35]=k):k=e[35];let P;e[36]!==I||e[37]!==k?(P=t.jsx(Qe,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[u,I,k]})}),e[36]=I,e[37]=k,e[38]=P):P=e[38];let D;return e[39]!==o||e[40]!==P||e[41]!==N?(D=t.jsxs(Ze,{open:o,onOpenChange:b,children:[N,P]}),e[39]=o,e[40]=P,e[41]=N,e[42]=D):D=e[42],D}const _e=50;function Ps(l){const e=le.c(29),{client:s,locator:n,membersData:r,allConnections:i,allVirtualMcps:a,dateRange:m,searchQuery:c,filterAgentIds:o,filterUserIds:b,filterStatus:v}=l,[x,h]=oe.useState(null),N=m.startDate.toISOString(),u=m.endDate.toISOString(),p=JSON.stringify({startDate:N,endDate:u,search:c,agentIds:o,userIds:b,status:v}),{data:j,fetchNextPage:g,hasNextPage:S,isFetchingNextPage:f,isLoading:y}=ze({queryKey:xe.threadsInfinite(n,p),queryFn:async R=>{const{pageParam:G}=R,ie=G===void 0?0:G;if(!s)throw new Error("MCP client is not available");const E=await s.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:_e,offset:ie,startDate:N,endDate:u,...c?{search:c}:{},...o&&o.length>0?{agentId:o[0]}:{},...b&&b.length>0?{userId:b[0]}:{},...v&&v!=="all"?{status:v}:{}}});return E.structuredContent??E},initialPageParam:0,getNextPageParam:Gt,staleTime:3e4}),_=(j?.pages??[]).flatMap(qt),d=_.map(Kt),{data:C}=Ve({queryKey:xe.monitoringThreadUsage(n,JSON.stringify({ids:d,startDate:N,endDate:u})),queryFn:async()=>{if(!s)throw new Error("MCP client is not available");const R=await s.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:d,startDate:N,endDate:u}});return R.structuredContent??R},enabled:!!s&&d.length>0,staleTime:3e4}),T=new Map((C?.items??[]).map(zt)),[w,I]=oe.useState(null),[k,P]=oe.useState("desc");let D;e[0]!==w?(D=R=>{w===R?P(Vt):(I(R),P("desc"))},e[0]=w,e[1]=D):D=e[1];const M=D,A=R=>{const G=T.get(R);return G?w==="cost"?G.costUsd:G.totalTokens:0},$=w?[..._].sort((R,G)=>{const ie=A(R.id),E=A(G.id);return k==="desc"?E-ie:ie-E}):_,B=x!==null?$[x]??null:null;let F;e[2]!==g||e[3]!==S||e[4]!==f?(F=()=>{S&&!f&&g()},e[2]=g,e[3]=S,e[4]=f,e[5]=F):F=e[5];const q=ke(F,S??!1,f),U=!!c||(o?.length??0)>0||(b?.length??0)>0||v&&v!=="all";let O;e[6]===Symbol.for("react.memo_cache_sentinel")?(O=()=>h(Ot),e[6]=O):O=e[6];const L=O,K=()=>h(R=>R!==null&&R<$.length-1?R+1:R),V="flex-1 flex flex-col overflow-auto min-w-0",J="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",z="flex-1 flex flex-col min-w-0",Q="flex-1 min-w-0 pt-1",ce="min-w-0",W=y?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"})}):_.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Se,{title:U?"No matching threads":"No threads in this time range",description:U?"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(te,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),t.jsx(te,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),t.jsx(te,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(te,{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",w==="tokens"&&(k==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(te,{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",w==="cost"&&(k==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(te,{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:$.map((R,G)=>t.jsx(Et,{thread:R,usage:T.get(R.id),members:r,connections:i,virtualMcps:a,onClick:()=>h(G),lastRowRef:G===$.length-1?q:void 0},R.id))})]}),f&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let Y;e[7]!==W?(Y=t.jsx("div",{className:J,children:t.jsx("div",{className:z,children:t.jsx("div",{className:Q,children:t.jsx("div",{className:ce,children:W})})})}),e[7]=W,e[8]=Y):Y=e[8];const de=x!==null;let ne;e[9]===Symbol.for("react.memo_cache_sentinel")?(ne=R=>{R||h(null)},e[9]=ne):ne=e[9];let ae;e[10]!==i||e[11]!==a||e[12]!==s||e[13]!==$||e[14]!==K||e[15]!==L||e[16]!==n||e[17]!==r||e[18]!==B||e[19]!==x?(ae=B&&x!==null&&t.jsx(et,{thread:B,client:s,locator:n,connections:i,virtualMcps:a,members:r,selectedIndex:x,total:$.length,onPrev:L,onNext:K}),e[10]=i,e[11]=a,e[12]=s,e[13]=$,e[14]=K,e[15]=L,e[16]=n,e[17]=r,e[18]=B,e[19]=x,e[20]=ae):ae=e[20];let X;e[21]!==ae?(X=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:ae}),e[21]=ae,e[22]=X):X=e[22];let ee;e[23]!==de||e[24]!==X?(ee=t.jsx(qe,{open:de,onOpenChange:ne,children:X}),e[23]=de,e[24]=X,e[25]=ee):ee=e[25];let re;return e[26]!==Y||e[27]!==ee?(re=t.jsxs("div",{className:V,children:[Y,ee]}),e[26]=Y,e[27]=ee,e[28]=re):re=e[28],re}function Ot(l){return l!==null&&l>0?l-1:l}function Vt(l){return l==="desc"?"asc":"desc"}function zt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Kt(l){return l.id}function qt(l){return l.items??[]}function Gt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<_e))return n.length*_e}const Te=50;function pe(l){const e=le.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 m;e[4]!==r?(m=r&&t.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=m):m=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==m?(c=t.jsxs(ct,{className:"pt-4 px-4 pb-5 gap-1",children:[i,a,m]}),e[6]=i,e[7]=a,e[8]=m,e[9]=c):c=e[9],c}function Ht(l){const e=le.c(27),{automationId:s,range:n}=l,{data:r,isLoading:i}=ft(s,n),a=r?.runs,m=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,b=m&&m.truncated?`last ${m.sampledRuns} runs`:void 0;let v;e[2]!==i||e[3]!==a?.total?(v=i?"…":a?.total.toLocaleString()??"0",e[2]=i,e[3]=a?.total,e[4]=v):v=e[4];const x=a?`${a.completed} ok · ${a.failed} failed${a.inProgress>0?` · ${a.inProgress} running`:""}`:void 0;let h;e[5]!==v||e[6]!==x?(h=t.jsx(pe,{title:"Runs",value:v,subtitle:x}),e[5]=v,e[6]=x,e[7]=h):h=e[7];const N=i?"…":o;let u;e[8]!==N?(u=t.jsx(pe,{title:"Success rate",value:N}),e[8]=N,e[9]=u):u=e[9];let p;e[10]!==i||e[11]!==m?.totalTokens?(p=i?"…":De(m?.totalTokens??0),e[10]=i,e[11]=m?.totalTokens,e[12]=p):p=e[12];let j;e[13]!==p||e[14]!==b?(j=t.jsx(pe,{title:"Tokens",value:p,subtitle:b}),e[13]=p,e[14]=b,e[15]=j):j=e[15];let g;e[16]!==i||e[17]!==m?(g=i?"…":m&&m.costUsd>0?Re(m.costUsd):"—",e[16]=i,e[17]=m,e[18]=g):g=e[18];let S;e[19]!==g||e[20]!==b?(S=t.jsx(pe,{title:"Cost",value:g,subtitle:b}),e[19]=g,e[20]=b,e[21]=S):S=e[21];let f;return e[22]!==S||e[23]!==h||e[24]!==u||e[25]!==j?(f=t.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[h,u,j,S]}),e[22]=S,e[23]=h,e[24]=u,e[25]=j,e[26]=f):f=e[26],f}function Bt(l){const e=le.c(39),{run:s,usage:n,onClick:r,lastRowRef:i}=l;let a,m;if(e[0]!==s.created_at){const C=new Date(s.created_at);a=C.toLocaleDateString("en-US",{month:"short",day:"numeric"}),m=C.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=s.created_at,e[1]=a,e[2]=m}else a=e[1],m=e[2];const c=m,o=ue[s.status]??ue.completed,b=o.icon;let v;e[3]!==s.title?(v=t.jsx(se,{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]=v):v=e[4];let x;e[5]!==b||e[6]!==o.iconClassName?(x=t.jsx(b,{size:14,className:o.iconClassName}),e[5]=b,e[6]=o.iconClassName,e[7]=x):x=e[7];let h;e[8]!==o.labelColor?(h=be("text-sm",o.labelColor),e[8]=o.labelColor,e[9]=h):h=e[9];let N;e[10]!==o.label||e[11]!==h?(N=t.jsx("span",{className:h,children:o.label}),e[10]=o.label,e[11]=h,e[12]=N):N=e[12];let u;e[13]!==x||e[14]!==N?(u=t.jsx(se,{className:"w-28 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[x,N]})}),e[13]=x,e[14]=N,e[15]=u):u=e[15];let p;e[16]!==n?(p=n?De(n.totalTokens):"—",e[16]=n,e[17]=p):p=e[17];let j;e[18]!==p?(j=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:p}),e[18]=p,e[19]=j):j=e[19];let g;e[20]!==n?(g=n&&n.costUsd>0?Re(n.costUsd):"—",e[20]=n,e[21]=g):g=e[21];let S;e[22]!==g?(S=t.jsx(se,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:g}),e[22]=g,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 y;e[26]!==c?(y=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=y):y=e[27];let _;e[28]!==f||e[29]!==y?(_=t.jsxs(se,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[f,y]}),e[28]=f,e[29]=y,e[30]=_):_=e[30];let d;return e[31]!==i||e[32]!==r||e[33]!==S||e[34]!==_||e[35]!==v||e[36]!==u||e[37]!==j?(d=t.jsxs(Ne,{ref:i,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[v,u,j,S,_]}),e[31]=i,e[32]=r,e[33]=S,e[34]=_,e[35]=v,e[36]=u,e[37]=j,e[38]=d):d=e[38],d}function Ms(l){const e=le.c(48),{automationId:s,triggerIds:n,range:r}=l,{org:i,locator:a}=st();let m;e[0]!==i.id||e[1]!==i.slug?(m={connectionId:rt,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=m):m=e[2];const c=it(m),o=lt(),b=ot(),{data:v}=ut(),[x,h]=oe.useState(null),N=n.length>0;let u;e[3]!==s||e[4]!==i.id||e[5]!==n?(u=xe.automationRuns(i.id,s,n),e[3]=s,e[4]=i.id,e[5]=n,e[6]=u):u=e[6];let p;e[7]!==c||e[8]!==n?(p=async z=>{const{pageParam:Q}=z,ce=Q===void 0?0:Q,W=await c.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Te,offset:ce,where:{trigger_ids:n}}});return W.structuredContent??W},e[7]=c,e[8]=n,e[9]=p):p=e[9];let j;e[10]!==N||e[11]!==u||e[12]!==p?(j={queryKey:u,queryFn:p,initialPageParam:0,getNextPageParam:Yt,enabled:N,staleTime:3e4},e[10]=N,e[11]=u,e[12]=p,e[13]=j):j=e[13];const{data:g,fetchNextPage:S,hasNextPage:f,isFetchingNextPage:y,isLoading:_}=ze(j),d=(g?.pages??[]).flatMap(Wt),C=d.map(Zt),{data:T}=Ve({queryKey:xe.monitoringThreadUsage(a,JSON.stringify({ids:C,...r})),queryFn:async()=>{const z=await c.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:C,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}});return z.structuredContent??z},enabled:C.length>0,staleTime:3e4});let w;e[14]!==T?.items?(w=new Map((T?.items??[]).map(Qt)),e[14]=T?.items,e[15]=w):w=e[15];const I=w;let k;e[16]!==S||e[17]!==f||e[18]!==y?(k=()=>{f&&!y&&S()},e[16]=S,e[17]=f,e[18]=y,e[19]=k):k=e[19];const P=ke(k,f??!1,y),D=x!==null?d[x]??null:null;let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=()=>h(Jt),e[20]=M):M=e[20];const A=M,$=()=>h(z=>z!==null&&z<d.length-1?z+1:z),B="flex flex-col gap-5";let F;e[21]!==s||e[22]!==r?(F=t.jsx(Ht,{automationId:s,range:r}),e[21]=s,e[22]=r,e[23]=F):F=e[23];const Z=N?_?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):d.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(te,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),t.jsx(te,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),t.jsx(te,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),t.jsx(te,{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:d.map((z,Q)=>t.jsx(Bt,{run:z,usage:I.get(z.id),onClick:()=>h(Q),lastRowRef:Q===d.length-1?P: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 q;e[24]!==y?(q=y&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=y,e[25]=q):q=e[25];const U=x!==null;let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=z=>{z||h(null)},e[26]=O):O=e[26];let L;e[27]!==o||e[28]!==b||e[29]!==c||e[30]!==$||e[31]!==A||e[32]!==a||e[33]!==v||e[34]!==d||e[35]!==D||e[36]!==x?(L=D&&x!==null&&t.jsx(et,{thread:D,client:c,locator:a,connections:o,virtualMcps:b,members:v,selectedIndex:x,total:d.length,onPrev:A,onNext:$}),e[27]=o,e[28]=b,e[29]=c,e[30]=$,e[31]=A,e[32]=a,e[33]=v,e[34]=d,e[35]=D,e[36]=x,e[37]=L):L=e[37];let K;e[38]!==L?(K=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:L}),e[38]=L,e[39]=K):K=e[39];let V;e[40]!==U||e[41]!==K?(V=t.jsx(qe,{open:U,onOpenChange:O,children:K}),e[40]=U,e[41]=K,e[42]=V):V=e[42];let J;return e[43]!==Z||e[44]!==q||e[45]!==V||e[46]!==F?(J=t.jsxs("div",{className:B,children:[F,Z,q,V]}),e[43]=Z,e[44]=q,e[45]=V,e[46]=F,e[47]=J):J=e[47],J}function Jt(l){return l!==null&&l>0?l-1:l}function Qt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Zt(l){return l.id}function Wt(l){return l.items??[]}function Yt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Te))return n.length*Te}export{Ms as A,Ue as M,Is as T,Re as a,_s as b,Rt as c,ks as d,Ts as e,De as f,Cs as g,Xe as h,Ps as i};
@@ -1 +1 @@
1
- import{e as k,j as o,q as L,f as T,r as $,B as M,t as N}from"./index-xlf1R0Pd.js";import{s as q}from"./Plus-SYX7Jcs9.js";import{i as S}from"./Zap-Dk_nA-wI.js";import{S as D}from"./search-input-CW76IA7x.js";import{P as l}from"./index-sl5NILiy.js";import{E as b}from"./empty-state-DGpuZNcs.js";import{c as O}from"./use-automations-DKJfSgh5.js";import{k as V}from"./use-navigate-to-agent-BEpojVbn.js";import{A as F}from"./automation-list-row-CGpoGzR0.js";import{h as G}from"./constants-CMjFoMX0.js";import{a as H}from"./use-virtual-mcp-yktM2JXP.js";import{R as J}from"./require-capability-C0QcGgFF.js";import"./SearchMd-0TMVkQMW.js";import"./sidebar-Clf4A7X_.js";import"./LayoutLeft-J1_JEXyN.js";import"./tooltip-eUi2Y5fU.js";import"./sheet-WSy7SjR0.js";import"./X-DIHUsKrt.js";import"./alert-dialog-BbR-MKg7.js";import"./dropdown-menu-Cg5WpvGl.js";import"./Check-CR0O2uWf.js";import"./ChevronRight-BaUNdghF.js";import"./DotsVertical-DGTAVdEZ.js";import"./agent-icon-Nb9q65px.js";import"./AlertCircle-DO3qurkL.js";import"./Tool01-CqvNhfPg.js";import"./SwitchHorizontal01-8u2E25Rp.js";import"./RefreshCcw01-BQ5geCmZ.js";import"./XCircle-Cj2MwS1p.js";import"./ArrowUpRight-CiDjAuoy.js";import"./ZapSquare-ye6mkz8R.js";import"./Users03-QSPwwcGf.js";import"./CheckCircle-LDbTBL99.js";import"./ChevronDown-WrX0-Yew.js";import"./ChevronLeft-8UCyB4Yy.js";import"./ChevronUp-C4tvbkfA.js";import"./Container-CB2clVKF.js";import"./Eye-sBZ-4iik.js";import"./ZoomOut-CBm47Mxl.js";import"./Globe01-byyMUl6j.js";import"./FilterLines-BU3D9Lid.js";import"./Star01-DLziHFop.js";import"./Palette-DTMyMQxf.js";import"./HardDrive-CUKuGEue.js";import"./Stars02-DqL1Cccb.js";import"./Key01-DWQ0romw.js";import"./LinkExternal01-jNd7GK6h.js";import"./Monitor01-Df0H43EQ.js";import"./Sun-DdGdhPXF.js";import"./Play-BFlh2QTe.js";import"./Settings02-De_5mwce.js";import"./Shield01-BDh5ViTq.js";import"./Stars01-BlfwbfsB.js";import"./Trash01-DUkv4uBS.js";import"./Upload01-Df5OqgB9.js";import"./User01-BmlN3if3.js";import"./Users01-CTGNOuQo.js";import"./XClose-BNMay-WE.js";import"./use-collections-C98vGus5.js";import"./use-capability-52ANg0ua.js";import"./access-gate-CuZatYm_.js";import"./capability-load-error-Cj6SN6lp.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function eo(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{eo as default};
1
+ import{e as k,j as o,q as L,f as T,r as $,B as M,t as N}from"./index-DRJmNXDD.js";import{s as q}from"./Plus-CT-4Jh-n.js";import{i as S}from"./Zap-B_D2y40p.js";import{S as D}from"./search-input-B9IrHp4k.js";import{P as l}from"./index-Bay0Y2nf.js";import{E as b}from"./empty-state-cflEad3j.js";import{c as O}from"./use-automations-BqkQGVej.js";import{k as V}from"./use-navigate-to-agent-BqNERGsJ.js";import{A as F}from"./automation-list-row-Dj1eIP99.js";import{h as G}from"./constants-Dn21fsKH.js";import{a as H}from"./use-virtual-mcp-KmXVB9CJ.js";import{R as J}from"./require-capability-Fk6DVHbg.js";import"./SearchMd-C66hv9kt.js";import"./sidebar-C55uTdAM.js";import"./LayoutLeft-HrAYDWPl.js";import"./tooltip-Bc8MQzHk.js";import"./sheet-Cba9SmBC.js";import"./X-H2fYFKrr.js";import"./alert-dialog-DZtlkgip.js";import"./dropdown-menu-y8NIkVV4.js";import"./Check-BLqEeKBc.js";import"./ChevronRight-B5L5ipNb.js";import"./DotsVertical-BOgEsTMy.js";import"./agent-icon-BI9vERCT.js";import"./AlertCircle-CUUsAdtH.js";import"./Tool01-DN-gU43Y.js";import"./SwitchHorizontal01-B0ESWdzS.js";import"./RefreshCcw01-0gFyqUZd.js";import"./XCircle-B3udZTDc.js";import"./ArrowUpRight-Cf4evQxw.js";import"./ZapSquare--iRBoXV5.js";import"./Users03-Q03Wmh-l.js";import"./CheckCircle-CFOSBfJq.js";import"./ChevronDown-C2c6sinL.js";import"./ChevronLeft-BnUJO43C.js";import"./ChevronUp-D_wwe57U.js";import"./Container-BvPpGZnd.js";import"./Eye-D9NEFF2b.js";import"./ZoomOut-DHgWSdJD.js";import"./Globe01-cUR4k1x9.js";import"./FilterLines-BlZKlG21.js";import"./Star01-DMJ7Bmvx.js";import"./Palette-xvxAGRbw.js";import"./HardDrive-5wu_NjNO.js";import"./Stars02-BdwCB3Kj.js";import"./Key01-Cp53LYcD.js";import"./LinkExternal01-DB359u1m.js";import"./Monitor01-BSb4OY8G.js";import"./Sun-BYcJheYn.js";import"./Play-VZl7G9wy.js";import"./Settings02-B89y1GN_.js";import"./Shield01-9tiYd2ih.js";import"./Stars01-CNBVD1W1.js";import"./Trash01-CR3E97ay.js";import"./Upload01-DQ7aL3qZ.js";import"./User01-BDbelgHJ.js";import"./Users01-BPOE-PS5.js";import"./XClose-YFpYubX_.js";import"./use-collections-B7Q5Ewox.js";import"./use-capability-B8J1tkgS.js";import"./access-gate-DW1Er84j.js";import"./capability-load-error-BC3MQy0S.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function eo(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{eo as default};
@@ -1 +1 @@
1
- import{e as k,j as i,c as m,bt as R,dg as V,dh as I,di as $}from"./index-xlf1R0Pd.js";import{s as O}from"./User01-BmlN3if3.js";function U(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("relative flex size-8 shrink-0 overflow-hidden rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx($,{"data-slot":"avatar",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function E(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("aspect-square size-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(V,{"data-slot":"avatar-image",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function M(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("bg-muted flex size-full items-center justify-center rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(I,{"data-slot":"avatar-fallback",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}const C=["drop-shadow-lg bg-gradient-to-br from-red-100 to-red-300 text-red-800 shadow-lg shadow-red-300/40 ring-1 ring-red-300/30","drop-shadow-lg bg-gradient-to-br from-lime-100 to-lime-300 text-lime-800 shadow-lg shadow-lime-300/40 ring-1 ring-lime-300/30","drop-shadow-lg bg-gradient-to-br from-emerald-100 to-emerald-300 text-emerald-800 shadow-lg shadow-emerald-300/40 ring-1 ring-emerald-300/30","drop-shadow-lg bg-gradient-to-br from-orange-100 to-orange-300 text-orange-800 shadow-lg shadow-orange-300/40 ring-1 ring-orange-300/30","drop-shadow-lg bg-gradient-to-br from-amber-100 to-amber-300 text-amber-800 shadow-lg shadow-amber-300/40 ring-1 ring-amber-300/30","drop-shadow-lg bg-gradient-to-br from-yellow-100 to-yellow-300 text-yellow-800 shadow-lg shadow-yellow-300/40 ring-1 ring-yellow-300/30","drop-shadow-lg bg-gradient-to-br from-green-100 to-green-300 text-green-800 shadow-lg shadow-green-300/40 ring-1 ring-green-300/30","drop-shadow-lg bg-gradient-to-br from-teal-100 to-teal-300 text-teal-800 shadow-lg shadow-teal-300/40 ring-1 ring-teal-300/30","drop-shadow-lg bg-gradient-to-br from-cyan-100 to-cyan-300 text-cyan-800 shadow-lg shadow-cyan-300/40 ring-1 ring-cyan-300/30","drop-shadow-lg bg-gradient-to-br from-sky-100 to-sky-300 text-sky-800 shadow-lg shadow-sky-300/40 ring-1 ring-sky-300/30","drop-shadow-lg bg-gradient-to-br from-blue-100 to-blue-300 text-blue-800 shadow-lg shadow-blue-300/40 ring-1 ring-blue-300/30","drop-shadow-lg bg-gradient-to-br from-indigo-100 to-indigo-300 text-indigo-800 shadow-lg shadow-indigo-300/40 ring-1 ring-indigo-300/30","drop-shadow-lg bg-gradient-to-br from-violet-100 to-violet-300 text-violet-800 shadow-lg shadow-violet-300/40 ring-1 ring-violet-300/30","drop-shadow-lg bg-gradient-to-br from-purple-100 to-purple-300 text-purple-800 shadow-lg shadow-purple-300/40 ring-1 ring-purple-300/30","drop-shadow-lg bg-gradient-to-br from-fuchsia-100 to-fuchsia-300 text-fuchsia-800 shadow-lg shadow-fuchsia-300/40 ring-1 ring-fuchsia-300/30","drop-shadow-lg bg-gradient-to-br from-pink-100 to-pink-300 text-pink-800 shadow-lg shadow-pink-300/40 ring-1 ring-pink-300/30","drop-shadow-lg bg-gradient-to-br from-rose-100 to-rose-300 text-rose-800 shadow-lg shadow-rose-300/40 ring-1 ring-rose-300/30"],L="drop-shadow-lg text-muted-foreground bg-muted shadow-lg";function T(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);const s=Math.abs(e)%C.length;return C[s]}const S=R("border border-border",{variants:{shape:{circle:"rounded-full",square:""},size:{"3xs":"w-3 h-3 text-[7px] font-semibold","2xs":"w-4 h-4 text-[9px] font-semibold",xs:"w-6 h-6 text-sm font-semibold",sm:"w-8 h-8 text-lg font-semibold",base:"w-10 h-10 text-2xl font-semibold",lg:"w-12 h-12 text-3xl font-semibold",xl:"w-16 h-16 text-4xl font-semibold","2xl":"w-20 h-20 text-5xl font-semibold","3xl":"w-32 h-32 text-7xl font-semibold"}},compoundVariants:[{shape:"square",size:"xs",class:"rounded-lg"},{shape:"square",size:"sm",class:"rounded-xl"},{shape:"square",size:"base",class:"rounded-xl"},{shape:"square",size:"lg",class:"rounded-xl"},{shape:"square",size:"xl",class:"rounded-2xl"},{shape:"square",size:"2xl",class:"rounded-3xl"},{shape:"square",size:"3xl",class:"rounded-[40px]"}],defaultVariants:{shape:"square",size:"base"}}),_=R("",{variants:{objectFit:{contain:"object-contain",cover:"object-cover"}},defaultVariants:{objectFit:"cover"}}),D=r=>{const e={"3xs":8,"2xs":8,xs:12,sm:16,base:24,lg:28,xl:36,"2xl":48,"3xl":80};return e[r]||e.base};function W(r){const e=k.c(34);let s,t,o,a,n,d,g,l;e[0]!==r?({url:l,fallback:t,shape:a,size:n,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g;let x;e:{if(typeof t=="string"){let c;e[9]!==t?(c=t.trim().slice(0,2).toUpperCase(),e[9]=t,e[10]=c):c=e[10],x=c;break e}x=t}const f=x;let y;e:{if(j){y=L;break e}if(typeof t=="string"){let c;e[11]!==t?(c=T(t),e[11]=t,e[12]=c):c=e[12],y=c;break e}y=C[0]}const z=y;let N;e[13]!==l?(N=l?.startsWith("icon://"),e[13]=l,e[14]=N):N=e[14];const p=N;let q;e[15]!==p||e[16]!==l?(q=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=q):q=e[17];const F=q;let w;e[18]!==s||e[19]!==b||e[20]!==h?(w=m(S({shape:b,size:h}),s),e[18]=s,e[19]=b,e[20]=h,e[21]=w):w=e[21];let v;e[22]!==z||e[23]!==f||e[24]!==F||e[25]!==p||e[26]!==u||e[27]!==h||e[28]!==l?(v=p&&F?i.jsx("div",{className:m("flex items-center justify-center w-full h-full",z),children:i.jsx(O,{size:D(h)})}):i.jsxs(i.Fragment,{children:[l&&i.jsx(E,{src:l,loading:"lazy",alt:"Avatar",className:m(_({objectFit:u}))}),i.jsx(M,{className:m(z,"rounded-none"),delayMs:l?600:0,children:f})]}),e[22]=z,e[23]=f,e[24]=F,e[25]=p,e[26]=u,e[27]=h,e[28]=l,e[29]=v):v=e[29];let A;return e[30]!==o||e[31]!==v||e[32]!==w?(A=i.jsx(U,{className:w,...o,children:v}),e[30]=o,e[31]=v,e[32]=w,e[33]=A):A=e[33],A}function B(r){const e=k.c(18);let s,t,o,a,n,d,g,l;e[0]!==r?({shape:a,size:n,url:l,fallback:t,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,x=h??"base";let f;return e[9]!==s||e[10]!==t||e[11]!==j||e[12]!==u||e[13]!==o||e[14]!==b||e[15]!==x||e[16]!==l?(f=i.jsx(W,{shape:b,url:l,fallback:t,size:x,objectFit:u,className:s,muted:j,...o}),e[9]=s,e[10]=t,e[11]=j,e[12]=u,e[13]=o,e[14]=b,e[15]=x,e[16]=l,e[17]=f):f=e[17],f}B.Skeleton=function({shape:e="square",size:s="base",className:t}){return i.jsx("div",{className:m(S({shape:e,size:s}),"bg-muted animate-pulse",t)})};export{B as A};
1
+ import{e as k,j as i,c as m,bt as R,dg as V,dh as I,di as $}from"./index-DRJmNXDD.js";import{s as O}from"./User01-BDbelgHJ.js";function U(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("relative flex size-8 shrink-0 overflow-hidden rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx($,{"data-slot":"avatar",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function E(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("aspect-square size-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(V,{"data-slot":"avatar-image",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function M(r){const e=k.c(8);let s,t;e[0]!==r?({className:s,...t}=r,e[0]=r,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=m("bg-muted flex size-full items-center justify-center rounded-full",s),e[3]=s,e[4]=o):o=e[4];let a;return e[5]!==t||e[6]!==o?(a=i.jsx(I,{"data-slot":"avatar-fallback",className:o,...t}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}const C=["drop-shadow-lg bg-gradient-to-br from-red-100 to-red-300 text-red-800 shadow-lg shadow-red-300/40 ring-1 ring-red-300/30","drop-shadow-lg bg-gradient-to-br from-lime-100 to-lime-300 text-lime-800 shadow-lg shadow-lime-300/40 ring-1 ring-lime-300/30","drop-shadow-lg bg-gradient-to-br from-emerald-100 to-emerald-300 text-emerald-800 shadow-lg shadow-emerald-300/40 ring-1 ring-emerald-300/30","drop-shadow-lg bg-gradient-to-br from-orange-100 to-orange-300 text-orange-800 shadow-lg shadow-orange-300/40 ring-1 ring-orange-300/30","drop-shadow-lg bg-gradient-to-br from-amber-100 to-amber-300 text-amber-800 shadow-lg shadow-amber-300/40 ring-1 ring-amber-300/30","drop-shadow-lg bg-gradient-to-br from-yellow-100 to-yellow-300 text-yellow-800 shadow-lg shadow-yellow-300/40 ring-1 ring-yellow-300/30","drop-shadow-lg bg-gradient-to-br from-green-100 to-green-300 text-green-800 shadow-lg shadow-green-300/40 ring-1 ring-green-300/30","drop-shadow-lg bg-gradient-to-br from-teal-100 to-teal-300 text-teal-800 shadow-lg shadow-teal-300/40 ring-1 ring-teal-300/30","drop-shadow-lg bg-gradient-to-br from-cyan-100 to-cyan-300 text-cyan-800 shadow-lg shadow-cyan-300/40 ring-1 ring-cyan-300/30","drop-shadow-lg bg-gradient-to-br from-sky-100 to-sky-300 text-sky-800 shadow-lg shadow-sky-300/40 ring-1 ring-sky-300/30","drop-shadow-lg bg-gradient-to-br from-blue-100 to-blue-300 text-blue-800 shadow-lg shadow-blue-300/40 ring-1 ring-blue-300/30","drop-shadow-lg bg-gradient-to-br from-indigo-100 to-indigo-300 text-indigo-800 shadow-lg shadow-indigo-300/40 ring-1 ring-indigo-300/30","drop-shadow-lg bg-gradient-to-br from-violet-100 to-violet-300 text-violet-800 shadow-lg shadow-violet-300/40 ring-1 ring-violet-300/30","drop-shadow-lg bg-gradient-to-br from-purple-100 to-purple-300 text-purple-800 shadow-lg shadow-purple-300/40 ring-1 ring-purple-300/30","drop-shadow-lg bg-gradient-to-br from-fuchsia-100 to-fuchsia-300 text-fuchsia-800 shadow-lg shadow-fuchsia-300/40 ring-1 ring-fuchsia-300/30","drop-shadow-lg bg-gradient-to-br from-pink-100 to-pink-300 text-pink-800 shadow-lg shadow-pink-300/40 ring-1 ring-pink-300/30","drop-shadow-lg bg-gradient-to-br from-rose-100 to-rose-300 text-rose-800 shadow-lg shadow-rose-300/40 ring-1 ring-rose-300/30"],L="drop-shadow-lg text-muted-foreground bg-muted shadow-lg";function T(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);const s=Math.abs(e)%C.length;return C[s]}const S=R("border border-border",{variants:{shape:{circle:"rounded-full",square:""},size:{"3xs":"w-3 h-3 text-[7px] font-semibold","2xs":"w-4 h-4 text-[9px] font-semibold",xs:"w-6 h-6 text-sm font-semibold",sm:"w-8 h-8 text-lg font-semibold",base:"w-10 h-10 text-2xl font-semibold",lg:"w-12 h-12 text-3xl font-semibold",xl:"w-16 h-16 text-4xl font-semibold","2xl":"w-20 h-20 text-5xl font-semibold","3xl":"w-32 h-32 text-7xl font-semibold"}},compoundVariants:[{shape:"square",size:"xs",class:"rounded-lg"},{shape:"square",size:"sm",class:"rounded-xl"},{shape:"square",size:"base",class:"rounded-xl"},{shape:"square",size:"lg",class:"rounded-xl"},{shape:"square",size:"xl",class:"rounded-2xl"},{shape:"square",size:"2xl",class:"rounded-3xl"},{shape:"square",size:"3xl",class:"rounded-[40px]"}],defaultVariants:{shape:"square",size:"base"}}),_=R("",{variants:{objectFit:{contain:"object-contain",cover:"object-cover"}},defaultVariants:{objectFit:"cover"}}),D=r=>{const e={"3xs":8,"2xs":8,xs:12,sm:16,base:24,lg:28,xl:36,"2xl":48,"3xl":80};return e[r]||e.base};function W(r){const e=k.c(34);let s,t,o,a,n,d,g,l;e[0]!==r?({url:l,fallback:t,shape:a,size:n,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g;let x;e:{if(typeof t=="string"){let c;e[9]!==t?(c=t.trim().slice(0,2).toUpperCase(),e[9]=t,e[10]=c):c=e[10],x=c;break e}x=t}const f=x;let y;e:{if(j){y=L;break e}if(typeof t=="string"){let c;e[11]!==t?(c=T(t),e[11]=t,e[12]=c):c=e[12],y=c;break e}y=C[0]}const z=y;let N;e[13]!==l?(N=l?.startsWith("icon://"),e[13]=l,e[14]=N):N=e[14];const p=N;let q;e[15]!==p||e[16]!==l?(q=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=q):q=e[17];const F=q;let w;e[18]!==s||e[19]!==b||e[20]!==h?(w=m(S({shape:b,size:h}),s),e[18]=s,e[19]=b,e[20]=h,e[21]=w):w=e[21];let v;e[22]!==z||e[23]!==f||e[24]!==F||e[25]!==p||e[26]!==u||e[27]!==h||e[28]!==l?(v=p&&F?i.jsx("div",{className:m("flex items-center justify-center w-full h-full",z),children:i.jsx(O,{size:D(h)})}):i.jsxs(i.Fragment,{children:[l&&i.jsx(E,{src:l,loading:"lazy",alt:"Avatar",className:m(_({objectFit:u}))}),i.jsx(M,{className:m(z,"rounded-none"),delayMs:l?600:0,children:f})]}),e[22]=z,e[23]=f,e[24]=F,e[25]=p,e[26]=u,e[27]=h,e[28]=l,e[29]=v):v=e[29];let A;return e[30]!==o||e[31]!==v||e[32]!==w?(A=i.jsx(U,{className:w,...o,children:v}),e[30]=o,e[31]=v,e[32]=w,e[33]=A):A=e[33],A}function B(r){const e=k.c(18);let s,t,o,a,n,d,g,l;e[0]!==r?({shape:a,size:n,url:l,fallback:t,objectFit:d,className:s,muted:g,...o}=r,e[0]=r,e[1]=s,e[2]=t,e[3]=o,e[4]=a,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],a=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=a===void 0?"square":a,h=n===void 0?"base":n,u=d===void 0?"cover":d,j=g===void 0?!1:g,x=h??"base";let f;return e[9]!==s||e[10]!==t||e[11]!==j||e[12]!==u||e[13]!==o||e[14]!==b||e[15]!==x||e[16]!==l?(f=i.jsx(W,{shape:b,url:l,fallback:t,size:x,objectFit:u,className:s,muted:j,...o}),e[9]=s,e[10]=t,e[11]=j,e[12]=u,e[13]=o,e[14]=b,e[15]=x,e[16]=l,e[17]=f):f=e[17],f}B.Skeleton=function({shape:e="square",size:s="base",className:t}){return i.jsx("div",{className:m(S({shape:e,size:s}),"bg-muted animate-pulse",t)})};export{B as A};
@@ -1 +1 @@
1
- import{e as u,c as l,j as g,bn as v,bt as b}from"./index-xlf1R0Pd.js";const f=b("inline-flex items-center justify-center rounded-full border text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",warning:"border-transparent bg-warning text-warning-foreground [a&]:hover:bg-warning/90 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"},size:{default:"px-2 py-0.5",icon:"size-5"}},defaultVariants:{variant:"default",size:"default"}});function h(c){const e=u.c(14);let r,s,i,n,t;e[0]!==c?({className:r,variant:t,size:i,asChild:n,...s}=c,e[0]=c,e[1]=r,e[2]=s,e[3]=i,e[4]=n,e[5]=t):(r=e[1],s=e[2],i=e[3],n=e[4],t=e[5]);const d=(n===void 0?!1:n)?v:"span";let a;e[6]!==r||e[7]!==i||e[8]!==t?(a=l(f({variant:t,size:i}),r),e[6]=r,e[7]=i,e[8]=t,e[9]=a):a=e[9];let o;return e[10]!==d||e[11]!==s||e[12]!==a?(o=g.jsx(d,{"data-slot":"badge",className:a,...s}),e[10]=d,e[11]=s,e[12]=a,e[13]=o):o=e[13],o}export{h as B};
1
+ import{e as u,c as l,j as g,bn as v,bt as b}from"./index-DRJmNXDD.js";const f=b("inline-flex items-center justify-center rounded-full border text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",warning:"border-transparent bg-warning text-warning-foreground [a&]:hover:bg-warning/90 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"},size:{default:"px-2 py-0.5",icon:"size-5"}},defaultVariants:{variant:"default",size:"default"}});function h(c){const e=u.c(14);let r,s,i,n,t;e[0]!==c?({className:r,variant:t,size:i,asChild:n,...s}=c,e[0]=c,e[1]=r,e[2]=s,e[3]=i,e[4]=n,e[5]=t):(r=e[1],s=e[2],i=e[3],n=e[4],t=e[5]);const d=(n===void 0?!1:n)?v:"span";let a;e[6]!==r||e[7]!==i||e[8]!==t?(a=l(f({variant:t,size:i}),r),e[6]=r,e[7]=i,e[8]=t,e[9]=a):a=e[9];let o;return e[10]!==d||e[11]!==s||e[12]!==a?(o=g.jsx(d,{"data-slot":"badge",className:a,...s}),e[10]=d,e[11]=s,e[12]=a,e[13]=o):o=e[13],o}export{h as B};
@@ -1 +1 @@
1
- import{e as H,X as Ie,q as ze,G as Le,K as Re,n as Ke,a as ge,j as n,B as Te,t as V,o as X,r as Oe,H as Xe,c as _e,D as fe}from"./index-xlf1R0Pd.js";import{S as He,u as Ue}from"./constants-CMjFoMX0.js";import{t as qe}from"./ChevronDown-WrX0-Yew.js";import{i as Me}from"./ChevronRight-BaUNdghF.js";import{s as Ve,t as Ge}from"./Star01-DLziHFop.js";import{n as Qe}from"./LinkExternal01-jNd7GK6h.js";import{s as Pe}from"./Plus-SYX7Jcs9.js";import{s as Ye}from"./Trash01-DUkv4uBS.js";import{i as Je}from"./Zap-Dk_nA-wI.js";import{c as We,b as Ze,d as et,f as tt,g as st,e as nt,a as lt,A as ot}from"./alert-dialog-BbR-MKg7.js";import{I as ue}from"./input-BjNSlgZE.js";import{T as rt}from"./textarea-BJ0xg93C.js";import{P as Ne}from"./index-sl5NILiy.js";import{u as $e}from"./unwrap-tool-result-BYXdCQMg.js";import{u as at}from"./use-debounced-autosave-rgg_ru3T.js";import{R as it}from"./require-capability-C0QcGgFF.js";import"./sidebar-Clf4A7X_.js";import"./LayoutLeft-J1_JEXyN.js";import"./tooltip-eUi2Y5fU.js";import"./sheet-WSy7SjR0.js";import"./X-DIHUsKrt.js";import"./use-capability-52ANg0ua.js";import"./access-gate-CuZatYm_.js";import"./capability-load-error-Cj6SN6lp.js";function we(t){const e=H.c(8),{title:s,children:o,className:l}=t;let r;e[0]!==l?(r=_e("rounded-2xl border border-border/60 bg-background p-5",l),e[0]=l,e[1]=r):r=e[1];let i;e[2]!==s?(i=n.jsx("div",{className:"mb-4",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s})}),e[2]=s,e[3]=i):i=e[3];let d;return e[4]!==o||e[5]!==r||e[6]!==i?(d=n.jsxs("div",{className:r,children:[i,o]}),e[4]=o,e[5]=r,e[6]=i,e[7]=d):d=e[7],d}function ct(t){const e=H.c(25),{onExtract:s,isExtracting:o}=t,[l,r]=Oe.useState("");let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10",children:n.jsx(Je,{size:18,className:"text-primary"})}),e[0]=i):i=e[0];let d,u;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-extract brand context"}),u=n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter your website URL and we'll automatically extract your brand colors, fonts, logos, and company overview."}),e[1]=d,e[2]=u):(d=e[1],u=e[2]);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=f=>r(f.target.value),e[3]=p):p=e[3];let b;e[4]!==l||e[5]!==o||e[6]!==s?(b=f=>{f.key==="Enter"&&l.trim()&&!o&&s(l.trim())},e[4]=l,e[5]=o,e[6]=s,e[7]=b):b=e[7];let m;e[8]!==l||e[9]!==b?(m=n.jsx(ue,{placeholder:"acme.com",value:l,onChange:p,className:"max-w-xs",onKeyDown:b}),e[8]=l,e[9]=b,e[10]=m):m=e[10];let c;e[11]!==l||e[12]!==o?(c=!l.trim()||o,e[11]=l,e[12]=o,e[13]=c):c=e[13];let a;e[14]!==l||e[15]!==s?(a=()=>s(l.trim()),e[14]=l,e[15]=s,e[16]=a):a=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ve,{size:14}),e[17]=x):x=e[17];const g=o?"Extracting...":"Extract";let h;e[18]!==g||e[19]!==c||e[20]!==a?(h=n.jsxs(Te,{variant:"outline",disabled:c,onClick:a,children:[x,g]}),e[18]=g,e[19]=c,e[20]=a,e[21]=h):h=e[21];let v;return e[22]!==h||e[23]!==m?(v=n.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-5",children:n.jsxs("div",{className:"flex items-start gap-4",children:[i,n.jsxs("div",{className:"flex-1",children:[d,u,n.jsxs("div",{className:"mt-3 flex gap-2",children:[m,h]})]})]})}),e[22]=h,e[23]=m,e[24]=v):v=e[24],v}function dt(t){const e=H.c(36),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s?(r=s.watch("domain"),e[0]=s,e[1]=r):r=e[1];const i=r;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Company name"}),e[2]=d):d=e[2];let u;e[3]!==o||e[4]!==l?(u=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Acme Corp"})},e[3]=o,e[4]=l,e[5]=u):u=e[5];let p;e[6]!==s.control||e[7]!==u?(p=n.jsxs("div",{children:[d,n.jsx(fe,{control:s.control,name:"name",render:u})]}),e[6]=s.control,e[7]=u,e[8]=p):p=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{children:"Domain"}),e[9]=b):b=e[9];let m;e[10]!==i?(m=i&&n.jsxs("a",{href:`https://${i}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:text-foreground",children:[n.jsx(Qe,{size:10}),"open"]}),e[10]=i,e[11]=m):m=e[11];let c;e[12]!==m?(c=n.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[b,m]}),e[12]=m,e[13]=c):c=e[13];let a;e[14]!==o||e[15]!==l?(a=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"acme.com"})},e[14]=o,e[15]=l,e[16]=a):a=e[16];let x;e[17]!==s.control||e[18]!==a?(x=n.jsx(fe,{control:s.control,name:"domain",render:a}),e[17]=s.control,e[18]=a,e[19]=x):x=e[19];let g;e[20]!==c||e[21]!==x?(g=n.jsxs("div",{children:[c,x]}),e[20]=c,e[21]=x,e[22]=g):g=e[22];let h;e[23]!==g||e[24]!==p?(h=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p,g]}),e[23]=g,e[24]=p,e[25]=h):h=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Overview"}),e[26]=v):v=e[26];let f;e[27]!==o||e[28]!==l?(f=D=>{const{field:y}=D;return n.jsx(rt,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Brief description of what the company does...",rows:3})},e[27]=o,e[28]=l,e[29]=f):f=e[29];let C;e[30]!==s.control||e[31]!==f?(C=n.jsxs("div",{children:[v,n.jsx(fe,{control:s.control,name:"overview",render:f})]}),e[30]=s.control,e[31]=f,e[32]=C):C=e[32];let w;return e[33]!==h||e[34]!==C?(w=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[h,C]})}),e[33]=h,e[34]=C,e[35]=w):w=e[35],w}const mt={backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px",backgroundColor:"#fff"};function Ae(t){const e=H.c(22),{form:s,name:o,label:l,imgClassName:r,onFieldChange:i,onFieldCommit:d}=t,u=r===void 0?"h-full w-full object-contain p-3":r;let p;e[0]!==s||e[1]!==o?(p=s.watch(o),e[0]=s,e[1]=o,e[2]=p):p=e[2];const b=p;let m;e[3]!==u||e[4]!==l||e[5]!==b?(m=n.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:mt,children:b?n.jsx("img",{src:b,alt:l,className:u,loading:"lazy"}):n.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:["No ",l.toLowerCase()]})}),e[3]=u,e[4]=l,e[5]=b,e[6]=m):m=e[6];let c;e[7]!==l?(c=n.jsxs("label",{className:"mb-1 block text-xs text-muted-foreground",children:[l," URL"]}),e[7]=l,e[8]=c):c=e[8];let a;e[9]!==i||e[10]!==d?(a=v=>{const{field:f}=v;return n.jsx(ue,{...f,onChange:C=>{f.onChange(C),i()},onBlur:()=>{f.onBlur(),d()},placeholder:"https://..."})},e[9]=i,e[10]=d,e[11]=a):a=e[11];let x;e[12]!==s.control||e[13]!==o||e[14]!==a?(x=n.jsx(fe,{control:s.control,name:o,render:a}),e[12]=s.control,e[13]=o,e[14]=a,e[15]=x):x=e[15];let g;e[16]!==c||e[17]!==x?(g=n.jsxs("div",{className:"flex-1",children:[c,x]}),e[16]=c,e[17]=x,e[18]=g):g=e[18];let h;return e[19]!==m||e[20]!==g?(h=n.jsxs("div",{className:"flex items-start gap-3",children:[m,g]}),e[19]=m,e[20]=g,e[21]=h):h=e[21],h}function ft(t){const e=H.c(4),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;return e[0]!==s||e[1]!==o||e[2]!==l?(r=n.jsx(we,{title:"Logos & Images",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(Ae,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{form:s,name:"ogImage",label:"SEO / OG image",imgClassName:"h-full w-full object-contain",onFieldChange:o,onFieldCommit:l})]})}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3],r}const ut=[{key:"heading",label:"Headings"},{key:"body",label:"Body"},{key:"code",label:"Code"}];function xt(t){const e=H.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=ut.map(d=>{const{key:u,label:p}=d,b=`fonts.${u}`,m=s.watch(b);return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 flex items-center gap-3 text-xs text-muted-foreground",children:[n.jsx("span",{className:"w-7 text-base font-medium leading-none text-foreground",children:"Aa"}),n.jsx("span",{children:p}),m&&n.jsx("span",{className:"ml-auto truncate text-foreground",style:{fontFamily:m},children:m})]}),n.jsx(fe,{control:s.control,name:b,render:c=>{const{field:a}=c;return n.jsx(ue,{...a,value:a.value??"",onChange:x=>{a.onChange(x),o()},onBlur:()=>{a.onBlur(),l()},placeholder:`Font family for ${p.toLowerCase()}`})}})]},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Fonts",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}const gt=[{key:"primary",label:"Primary"},{key:"secondary",label:"Secondary"},{key:"accent",label:"Accent"},{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}];function ht(t){const e=H.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=gt.map(d=>{const{key:u,label:p}=d,b=`colors.${u}`;return n.jsx(fe,{control:s.control,name:b,render:m=>{const{field:c}=m;return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:c.value??"#000000",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.onBlur(),l()},className:"h-9 w-9 shrink-0 cursor-pointer rounded-lg border border-border bg-transparent p-0.5"}),n.jsx(ue,{value:c.value??"",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.onBlur(),l()},placeholder:"#000000",className:"w-28"}),n.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:p})]})}},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Colors",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}function pt(t){const e=H.c(128),{brand:s,client:o,onChanged:l}=t,[r,i]=Oe.useState(s.isDefault??!1),[d,u]=Oe.useState(!1),p=s.name??"",b=s.domain??"",m=s.overview??"",c=s.logo??"",a=s.favicon??"",x=s.ogImage??"";let g;e[0]!==s.fonts?(g=s.fonts??{},e[0]=s.fonts,e[1]=g):g=e[1];let h;e[2]!==s.colors?(h=s.colors??{},e[2]=s.colors,e[3]=h):h=e[3];let v;e[4]!==p||e[5]!==b||e[6]!==m||e[7]!==c||e[8]!==a||e[9]!==x||e[10]!==g||e[11]!==h?(v={values:{name:p,domain:b,overview:m,logo:c,favicon:a,ogImage:x,fonts:g,colors:h}},e[4]=p,e[5]=b,e[6]=m,e[7]=c,e[8]=a,e[9]=x,e[10]=g,e[11]=h,e[12]=v):v=e[12];const f=Xe(v);let C;e[13]!==s.id||e[14]!==s.images||e[15]!==o?(C={mutationFn:async j=>{const ve=Object.values(j.fonts).some(kt),Ce=Object.values(j.colors).some(Dt),Se={id:s.id,name:j.name,domain:j.domain,overview:j.overview,logo:j.logo||null,favicon:j.favicon||null,ogImage:j.ogImage||null,fonts:ve?j.fonts:null,colors:Ce?j.colors:null,images:s.images};await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:Se})},onError:wt},e[13]=s.id,e[14]=s.images,e[15]=o,e[16]=C):C=e[16];const w=ge(C);let D;e[17]!==s.id||e[18]!==f||e[19]!==l||e[20]!==w?(D={delayMs:500,save:async()=>{const j=f.control._formState.dirtyFields,ve=Object.keys(j);if(ve.length===0)return;const Ce=f.getValues(),Se=f.control._defaultValues;f.reset(Ce,{keepValues:!0});try{await w.mutateAsync(Ce),V("brand_updated",{brand_id:s.id,fields:ve}),X.success("Brand context updated successfully"),l()}catch{f.reset(Se,{keepValues:!0})}}},e[17]=s.id,e[18]=f,e[19]=l,e[20]=w,e[21]=D):D=e[21];const{schedule:y,flush:N}=at(D);let I;e[22]!==s.id||e[23]!==o?(I=async()=>{await o.callTool({name:"BRAND_CONTEXT_DELETE",arguments:{id:s.id}})},e[22]=s.id,e[23]=o,e[24]=I):I=e[24];let z;e[25]!==s.id||e[26]!==l?(z=()=>{V("brand_deleted",{brand_id:s.id}),u(!1),l(),X.success("Brand deleted")},e[25]=s.id,e[26]=l,e[27]=z):z=e[27];let U;e[28]!==I||e[29]!==z?(U={mutationFn:I,onSuccess:z,onError:_t},e[28]=I,e[29]=z,e[30]=U):U=e[30];const{mutate:xe,isPending:k}=ge(U);let B;e[31]!==s.id||e[32]!==s.isDefault||e[33]!==o?(B=async()=>{await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:{id:s.id,isDefault:!s.isDefault}})},e[31]=s.id,e[32]=s.isDefault,e[33]=o,e[34]=B):B=e[34];let A;e[35]!==s.id||e[36]!==s.isDefault||e[37]!==l?(A=()=>{V(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),l(),X.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[35]=s.id,e[36]=s.isDefault,e[37]=l,e[38]=A):A=e[38];let T;e[39]!==B||e[40]!==A?(T={mutationFn:B,onSuccess:A,onError:Nt},e[39]=B,e[40]=A,e[41]=T):T=e[41];const{mutate:O}=ge(T),M=s.isDefault?"border-primary/30":"border-border/60";let q;e[42]!==M?(q=_e("rounded-2xl border bg-background",M),e[42]=M,e[43]=q):q=e[43];let R;e[44]!==r?(R=()=>i(!r),e[44]=r,e[45]=R):R=e[45];let L;e[46]!==r?(L=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(qe,{size:14}):n.jsx(Me,{size:14})}),e[46]=r,e[47]=L):L=e[47];let E;e[48]!==s.logo||e[49]!==s.name?(E=s.logo?n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg",style:{backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"6px 6px",backgroundPosition:"0 0, 3px 3px",backgroundColor:"#fff"},children:n.jsx("img",{src:s.logo,alt:"",className:"h-full w-full object-contain p-1",onError:Ct})}):n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s.name?.charAt(0)?.toUpperCase()||"?"})}),e[48]=s.logo,e[49]=s.name,e[50]=E):E=e[50];const K=s.name||"Untitled Brand";let F;e[51]!==K?(F=n.jsx("span",{className:"text-sm font-medium text-foreground",children:K}),e[51]=K,e[52]=F):F=e[52];let S;e[53]!==s.domain?(S=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[53]=s.domain,e[54]=S):S=e[54];let P;e[55]!==F||e[56]!==S?(P=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[F,S]}),e[55]=F,e[56]=S,e[57]=P):P=e[57];let _;e[58]!==s.colors||e[59]!==r?(_=!r&&s.colors&&Object.values(s.colors).some(vt)&&n.jsx("div",{className:"flex shrink-0 gap-1",children:Object.entries(s.colors).filter(yt).map(jt)}),e[58]=s.colors,e[59]=r,e[60]=_):_=e[60];let $;e[61]!==s.fonts||e[62]!==r?($=!r&&s.fonts&&Object.values(s.fonts).some(bt)&&n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Object.values(s.fonts).filter(Boolean).join(", ")}),e[61]=s.fonts,e[62]=r,e[63]=$):$=e[63];const De=s.isDefault?"opacity-100":"opacity-0 hover:bg-muted group-hover:opacity-100";let G;e[64]!==De?(G=_e("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-opacity",De),e[64]=De,e[65]=G):G=e[65];let Q,Y;e[66]!==O?(Q=j=>{j.stopPropagation(),O()},Y=j=>{j.key==="Enter"&&(j.stopPropagation(),O())},e[66]=O,e[67]=Q,e[68]=Y):(Q=e[67],Y=e[68]);const ke=s.isDefault?"Unset as default":"Set as default",Be=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[69]!==Be?(J=_e(Be),e[69]=Be,e[70]=J):J=e[70];let W;e[71]!==J?(W=n.jsx(Ge,{size:13,className:J}),e[71]=J,e[72]=W):W=e[72];let Z;e[73]!==G||e[74]!==Q||e[75]!==Y||e[76]!==ke||e[77]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:Y,title:ke,children:W}),e[73]=G,e[74]=Q,e[75]=Y,e[76]=ke,e[77]=W,e[78]=Z):Z=e[78];let he,pe;e[79]===Symbol.for("react.memo_cache_sentinel")?(he=j=>{j.stopPropagation(),u(!0)},pe=j=>{j.key==="Enter"&&(j.stopPropagation(),u(!0))},e[79]=he,e[80]=pe):(he=e[79],pe=e[80]);let be;e[81]===Symbol.for("react.memo_cache_sentinel")?(be=n.jsx("span",{role:"button",tabIndex:0,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg opacity-0 transition-opacity hover:bg-destructive/10 group-hover:opacity-100",onClick:he,onKeyDown:pe,title:"Delete brand",children:n.jsx(Ye,{size:13,className:"text-muted-foreground"})}),e[81]=be):be=e[81];let ee;e[82]!==R||e[83]!==L||e[84]!==E||e[85]!==P||e[86]!==_||e[87]!==$||e[88]!==Z?(ee=n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-5",onClick:R,children:[L,E,P,_,$,Z,be]}),e[82]=R,e[83]=L,e[84]=E,e[85]=P,e[86]=_,e[87]=$,e[88]=Z,e[89]=ee):ee=e[89];let te;e[90]!==r||e[91]!==N||e[92]!==f||e[93]!==y?(te=r&&n.jsxs("div",{className:"space-y-3 px-5 pb-5",children:[n.jsx(dt,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(ft,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ht,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(xt,{form:f,onFieldChange:y,onFieldCommit:N})]})]}),e[90]=r,e[91]=N,e[92]=f,e[93]=y,e[94]=te):te=e[94];let se;e[95]!==k?(se=j=>{!j&&!k&&u(!1)},e[95]=k,e[96]=se):se=e[96];let je;e[97]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(We,{children:"Delete brand?"}),e[97]=je):je=e[97];const Ee=s.name||"this brand";let ne;e[98]!==Ee?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Ee}),". This action cannot be undone."]}),e[98]=Ee,e[99]=ne):ne=e[99];let le;e[100]!==s.isDefault?(le=s.isDefault&&n.jsxs("p",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/5 p-2 text-destructive",children:[n.jsx("span",{className:"font-medium",children:"Heads up:"})," this is your organization's default brand. Deleting it will leave your organization without a default brand until you set another."]}),e[100]=s.isDefault,e[101]=le):le=e[101];let oe;e[102]!==ne||e[103]!==le?(oe=n.jsxs(Ze,{children:[je,n.jsx(et,{asChild:!0,children:n.jsxs("div",{children:[ne,le]})})]}),e[102]=ne,e[103]=le,e[104]=oe):oe=e[104];let re;e[105]!==k?(re=n.jsx(tt,{disabled:k,children:"Cancel"}),e[105]=k,e[106]=re):re=e[106];let ae;e[107]!==xe?(ae=j=>{j.preventDefault(),xe()},e[107]=xe,e[108]=ae):ae=e[108];const Fe=k?"Deleting...":"Delete";let ie;e[109]!==k||e[110]!==ae||e[111]!==Fe?(ie=n.jsx(st,{onClick:ae,disabled:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[109]=k,e[110]=ae,e[111]=Fe,e[112]=ie):ie=e[112];let ce;e[113]!==re||e[114]!==ie?(ce=n.jsxs(nt,{children:[re,ie]}),e[113]=re,e[114]=ie,e[115]=ce):ce=e[115];let de;e[116]!==oe||e[117]!==ce?(de=n.jsxs(lt,{children:[oe,ce]}),e[116]=oe,e[117]=ce,e[118]=de):de=e[118];let me;e[119]!==d||e[120]!==se||e[121]!==de?(me=n.jsx(ot,{open:d,onOpenChange:se,children:de}),e[119]=d,e[120]=se,e[121]=de,e[122]=me):me=e[122];let ye;return e[123]!==q||e[124]!==ee||e[125]!==te||e[126]!==me?(ye=n.jsxs("div",{className:q,children:[ee,te,me]}),e[123]=q,e[124]=ee,e[125]=te,e[126]=me,e[127]=ye):ye=e[127],ye}function bt(t){return t}function jt(t){const[e,s]=t;return n.jsx("div",{className:"h-5 w-5 rounded-full border border-border/40",style:{backgroundColor:s},title:`${e}: ${s}`},e)}function yt(t){const[,e]=t;return e}function vt(t){return t}function Ct(t){t.target.style.display="none"}function Nt(){return X.error("Failed to update default brand")}function _t(){return X.error("Failed to delete brand")}function wt(){return X.error("Failed to save brand context")}function Dt(t){return t?.trim()}function kt(t){return t?.trim()}function Bt(){const t=H.c(57),{brandExtractEnabled:e}=Ie(),{org:s}=ze();let o;t[0]!==s.id||t[1]!==s.slug?(o={connectionId:He,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=o):o=t[2];const l=Ue(o),r=Le();let i;t[3]!==s.id?(i=Re.brandContext(s.id),t[3]=s.id,t[4]=i):i=t[4];let d;t[5]!==l?(d=async()=>{const _=await l.callTool({name:"BRAND_CONTEXT_LIST",arguments:{includeArchived:!1}}),$=$e(_);return Array.isArray($?.items)?$.items:[]},t[5]=l,t[6]=d):d=t[6];let u;t[7]!==i||t[8]!==d?(u={queryKey:i,queryFn:d},t[7]=i,t[8]=d,t[9]=u):u=t[9];const{data:p}=Ke(u),m=(p===void 0?[]:p).filter(St);let c;t[10]!==s.id||t[11]!==r?(c=()=>r.invalidateQueries({queryKey:Re.brandContext(s.id),refetchType:"all"}),t[10]=s.id,t[11]=r,t[12]=c):c=t[12];const a=c;let x;t[13]!==l?(x=async()=>{await l.callTool({name:"BRAND_CONTEXT_CREATE",arguments:{name:"New Brand",domain:"example.com",overview:""}})},t[13]=l,t[14]=x):x=t[14];let g;t[15]!==a?(g=()=>{V("brand_created"),a(),X.success("Brand created")},t[15]=a,t[16]=g):g=t[16];let h;t[17]!==x||t[18]!==g?(h={mutationFn:x,onSuccess:g,onError:Ft},t[17]=x,t[18]=g,t[19]=h):h=t[19];const{mutate:v,isPending:f}=ge(h);let C;t[20]!==l?(C=async _=>{V("brand_extract_started",{domain:_});const $=await l.callTool({name:"BRAND_CONTEXT_EXTRACT",arguments:{domain:_}});$e($)},t[20]=l,t[21]=C):C=t[21];let w;t[22]!==a?(w=()=>{V("brand_extract_succeeded"),a(),X.success("Brand extracted successfully")},t[22]=a,t[23]=w):w=t[23];let D;t[24]!==w||t[25]!==C?(D={mutationFn:C,onSuccess:w,onError:Et},t[24]=w,t[25]=C,t[26]=D):D=t[26];const{mutate:y,isPending:N}=ge(D),I=Ne,z=Ne,U=Ne,xe="flex flex-col gap-6";let k;t[27]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsxs("div",{children:[n.jsx(Ne.Title,{children:"Brand Context"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define your brand profiles. Each brand is available as an MCP prompt for AI clients."})]}),t[27]=k):k=t[27];let B;t[28]!==v?(B=()=>v(),t[28]=v,t[29]=B):B=t[29];let A;t[30]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(Pe,{size:14}),t[30]=A):A=t[30];let T;t[31]!==f||t[32]!==B?(T=n.jsxs("div",{className:"flex items-center justify-between",children:[k,n.jsxs(Te,{variant:"outline",onClick:B,disabled:f,children:[A,"Add Brand"]})]}),t[31]=f,t[32]=B,t[33]=T):T=t[33];let O;t[34]!==e||t[35]!==y||t[36]!==N?(O=e&&n.jsx(ct,{onExtract:_=>y(_),isExtracting:N}),t[34]=e,t[35]=y,t[36]=N,t[37]=O):O=t[37];const M=m.length===0&&n.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-8 text-center",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"No brands configured yet."}),n.jsxs(Te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>v(),disabled:f,children:[n.jsx(Pe,{size:14}),"Add your first brand"]})]}),q="group space-y-3";let R;t[38]!==l||t[39]!==a?(R=_=>n.jsx(pt,{brand:_,client:l,onChanged:a},_.id),t[38]=l,t[39]=a,t[40]=R):R=t[40];const L=m.map(R);let E;t[41]!==L?(E=n.jsx("div",{className:q,children:L}),t[41]=L,t[42]=E):E=t[42];let K;t[43]!==T||t[44]!==O||t[45]!==M||t[46]!==E?(K=n.jsxs("div",{className:xe,children:[T,O,M,E]}),t[43]=T,t[44]=O,t[45]=M,t[46]=E,t[47]=K):K=t[47];let F;t[48]!==U.Body||t[49]!==K?(F=n.jsx(U.Body,{children:K}),t[48]=U.Body,t[49]=K,t[50]=F):F=t[50];let S;t[51]!==z.Content||t[52]!==F?(S=n.jsx(z.Content,{children:F}),t[51]=z.Content,t[52]=F,t[53]=S):S=t[53];let P;return t[54]!==I||t[55]!==S?(P=n.jsx(I,{children:S}),t[54]=I,t[55]=S,t[56]=P):P=t[56],P}function Et(t){V("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),X.error(t instanceof Error?t.message:"Failed to extract brand")}function Ft(){return X.error("Failed to create brand")}function St(t){return!t.archivedAt}function ss(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(it,{capability:"org:manage",area:"brand context",children:n.jsx(Bt,{})}),t[0]=e):e=t[0],e}export{ss as default};
1
+ import{e as H,X as Ie,q as ze,G as Le,K as Re,n as Ke,a as ge,j as n,B as Te,t as V,o as X,r as Oe,H as Xe,c as _e,D as fe}from"./index-DRJmNXDD.js";import{S as He,u as Ue}from"./constants-Dn21fsKH.js";import{t as qe}from"./ChevronDown-C2c6sinL.js";import{i as Me}from"./ChevronRight-B5L5ipNb.js";import{s as Ve,t as Ge}from"./Star01-DMJ7Bmvx.js";import{n as Qe}from"./LinkExternal01-DB359u1m.js";import{s as Pe}from"./Plus-CT-4Jh-n.js";import{s as Ye}from"./Trash01-CR3E97ay.js";import{i as Je}from"./Zap-B_D2y40p.js";import{c as We,b as Ze,d as et,f as tt,g as st,e as nt,a as lt,A as ot}from"./alert-dialog-DZtlkgip.js";import{I as ue}from"./input-P729pT4B.js";import{T as rt}from"./textarea-D0c-a7yW.js";import{P as Ne}from"./index-Bay0Y2nf.js";import{u as $e}from"./unwrap-tool-result-BYXdCQMg.js";import{u as at}from"./use-debounced-autosave-BsNxlSe7.js";import{R as it}from"./require-capability-Fk6DVHbg.js";import"./sidebar-C55uTdAM.js";import"./LayoutLeft-HrAYDWPl.js";import"./tooltip-Bc8MQzHk.js";import"./sheet-Cba9SmBC.js";import"./X-H2fYFKrr.js";import"./use-capability-B8J1tkgS.js";import"./access-gate-DW1Er84j.js";import"./capability-load-error-BC3MQy0S.js";function we(t){const e=H.c(8),{title:s,children:o,className:l}=t;let r;e[0]!==l?(r=_e("rounded-2xl border border-border/60 bg-background p-5",l),e[0]=l,e[1]=r):r=e[1];let i;e[2]!==s?(i=n.jsx("div",{className:"mb-4",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s})}),e[2]=s,e[3]=i):i=e[3];let d;return e[4]!==o||e[5]!==r||e[6]!==i?(d=n.jsxs("div",{className:r,children:[i,o]}),e[4]=o,e[5]=r,e[6]=i,e[7]=d):d=e[7],d}function ct(t){const e=H.c(25),{onExtract:s,isExtracting:o}=t,[l,r]=Oe.useState("");let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10",children:n.jsx(Je,{size:18,className:"text-primary"})}),e[0]=i):i=e[0];let d,u;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-extract brand context"}),u=n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter your website URL and we'll automatically extract your brand colors, fonts, logos, and company overview."}),e[1]=d,e[2]=u):(d=e[1],u=e[2]);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=f=>r(f.target.value),e[3]=p):p=e[3];let b;e[4]!==l||e[5]!==o||e[6]!==s?(b=f=>{f.key==="Enter"&&l.trim()&&!o&&s(l.trim())},e[4]=l,e[5]=o,e[6]=s,e[7]=b):b=e[7];let m;e[8]!==l||e[9]!==b?(m=n.jsx(ue,{placeholder:"acme.com",value:l,onChange:p,className:"max-w-xs",onKeyDown:b}),e[8]=l,e[9]=b,e[10]=m):m=e[10];let c;e[11]!==l||e[12]!==o?(c=!l.trim()||o,e[11]=l,e[12]=o,e[13]=c):c=e[13];let a;e[14]!==l||e[15]!==s?(a=()=>s(l.trim()),e[14]=l,e[15]=s,e[16]=a):a=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ve,{size:14}),e[17]=x):x=e[17];const g=o?"Extracting...":"Extract";let h;e[18]!==g||e[19]!==c||e[20]!==a?(h=n.jsxs(Te,{variant:"outline",disabled:c,onClick:a,children:[x,g]}),e[18]=g,e[19]=c,e[20]=a,e[21]=h):h=e[21];let v;return e[22]!==h||e[23]!==m?(v=n.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-5",children:n.jsxs("div",{className:"flex items-start gap-4",children:[i,n.jsxs("div",{className:"flex-1",children:[d,u,n.jsxs("div",{className:"mt-3 flex gap-2",children:[m,h]})]})]})}),e[22]=h,e[23]=m,e[24]=v):v=e[24],v}function dt(t){const e=H.c(36),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s?(r=s.watch("domain"),e[0]=s,e[1]=r):r=e[1];const i=r;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Company name"}),e[2]=d):d=e[2];let u;e[3]!==o||e[4]!==l?(u=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Acme Corp"})},e[3]=o,e[4]=l,e[5]=u):u=e[5];let p;e[6]!==s.control||e[7]!==u?(p=n.jsxs("div",{children:[d,n.jsx(fe,{control:s.control,name:"name",render:u})]}),e[6]=s.control,e[7]=u,e[8]=p):p=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{children:"Domain"}),e[9]=b):b=e[9];let m;e[10]!==i?(m=i&&n.jsxs("a",{href:`https://${i}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:text-foreground",children:[n.jsx(Qe,{size:10}),"open"]}),e[10]=i,e[11]=m):m=e[11];let c;e[12]!==m?(c=n.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[b,m]}),e[12]=m,e[13]=c):c=e[13];let a;e[14]!==o||e[15]!==l?(a=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"acme.com"})},e[14]=o,e[15]=l,e[16]=a):a=e[16];let x;e[17]!==s.control||e[18]!==a?(x=n.jsx(fe,{control:s.control,name:"domain",render:a}),e[17]=s.control,e[18]=a,e[19]=x):x=e[19];let g;e[20]!==c||e[21]!==x?(g=n.jsxs("div",{children:[c,x]}),e[20]=c,e[21]=x,e[22]=g):g=e[22];let h;e[23]!==g||e[24]!==p?(h=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p,g]}),e[23]=g,e[24]=p,e[25]=h):h=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Overview"}),e[26]=v):v=e[26];let f;e[27]!==o||e[28]!==l?(f=D=>{const{field:y}=D;return n.jsx(rt,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Brief description of what the company does...",rows:3})},e[27]=o,e[28]=l,e[29]=f):f=e[29];let C;e[30]!==s.control||e[31]!==f?(C=n.jsxs("div",{children:[v,n.jsx(fe,{control:s.control,name:"overview",render:f})]}),e[30]=s.control,e[31]=f,e[32]=C):C=e[32];let w;return e[33]!==h||e[34]!==C?(w=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[h,C]})}),e[33]=h,e[34]=C,e[35]=w):w=e[35],w}const mt={backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px",backgroundColor:"#fff"};function Ae(t){const e=H.c(22),{form:s,name:o,label:l,imgClassName:r,onFieldChange:i,onFieldCommit:d}=t,u=r===void 0?"h-full w-full object-contain p-3":r;let p;e[0]!==s||e[1]!==o?(p=s.watch(o),e[0]=s,e[1]=o,e[2]=p):p=e[2];const b=p;let m;e[3]!==u||e[4]!==l||e[5]!==b?(m=n.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:mt,children:b?n.jsx("img",{src:b,alt:l,className:u,loading:"lazy"}):n.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:["No ",l.toLowerCase()]})}),e[3]=u,e[4]=l,e[5]=b,e[6]=m):m=e[6];let c;e[7]!==l?(c=n.jsxs("label",{className:"mb-1 block text-xs text-muted-foreground",children:[l," URL"]}),e[7]=l,e[8]=c):c=e[8];let a;e[9]!==i||e[10]!==d?(a=v=>{const{field:f}=v;return n.jsx(ue,{...f,onChange:C=>{f.onChange(C),i()},onBlur:()=>{f.onBlur(),d()},placeholder:"https://..."})},e[9]=i,e[10]=d,e[11]=a):a=e[11];let x;e[12]!==s.control||e[13]!==o||e[14]!==a?(x=n.jsx(fe,{control:s.control,name:o,render:a}),e[12]=s.control,e[13]=o,e[14]=a,e[15]=x):x=e[15];let g;e[16]!==c||e[17]!==x?(g=n.jsxs("div",{className:"flex-1",children:[c,x]}),e[16]=c,e[17]=x,e[18]=g):g=e[18];let h;return e[19]!==m||e[20]!==g?(h=n.jsxs("div",{className:"flex items-start gap-3",children:[m,g]}),e[19]=m,e[20]=g,e[21]=h):h=e[21],h}function ft(t){const e=H.c(4),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;return e[0]!==s||e[1]!==o||e[2]!==l?(r=n.jsx(we,{title:"Logos & Images",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(Ae,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{form:s,name:"ogImage",label:"SEO / OG image",imgClassName:"h-full w-full object-contain",onFieldChange:o,onFieldCommit:l})]})}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3],r}const ut=[{key:"heading",label:"Headings"},{key:"body",label:"Body"},{key:"code",label:"Code"}];function xt(t){const e=H.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=ut.map(d=>{const{key:u,label:p}=d,b=`fonts.${u}`,m=s.watch(b);return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 flex items-center gap-3 text-xs text-muted-foreground",children:[n.jsx("span",{className:"w-7 text-base font-medium leading-none text-foreground",children:"Aa"}),n.jsx("span",{children:p}),m&&n.jsx("span",{className:"ml-auto truncate text-foreground",style:{fontFamily:m},children:m})]}),n.jsx(fe,{control:s.control,name:b,render:c=>{const{field:a}=c;return n.jsx(ue,{...a,value:a.value??"",onChange:x=>{a.onChange(x),o()},onBlur:()=>{a.onBlur(),l()},placeholder:`Font family for ${p.toLowerCase()}`})}})]},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Fonts",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}const gt=[{key:"primary",label:"Primary"},{key:"secondary",label:"Secondary"},{key:"accent",label:"Accent"},{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}];function ht(t){const e=H.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=gt.map(d=>{const{key:u,label:p}=d,b=`colors.${u}`;return n.jsx(fe,{control:s.control,name:b,render:m=>{const{field:c}=m;return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:c.value??"#000000",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.onBlur(),l()},className:"h-9 w-9 shrink-0 cursor-pointer rounded-lg border border-border bg-transparent p-0.5"}),n.jsx(ue,{value:c.value??"",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.onBlur(),l()},placeholder:"#000000",className:"w-28"}),n.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:p})]})}},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Colors",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}function pt(t){const e=H.c(128),{brand:s,client:o,onChanged:l}=t,[r,i]=Oe.useState(s.isDefault??!1),[d,u]=Oe.useState(!1),p=s.name??"",b=s.domain??"",m=s.overview??"",c=s.logo??"",a=s.favicon??"",x=s.ogImage??"";let g;e[0]!==s.fonts?(g=s.fonts??{},e[0]=s.fonts,e[1]=g):g=e[1];let h;e[2]!==s.colors?(h=s.colors??{},e[2]=s.colors,e[3]=h):h=e[3];let v;e[4]!==p||e[5]!==b||e[6]!==m||e[7]!==c||e[8]!==a||e[9]!==x||e[10]!==g||e[11]!==h?(v={values:{name:p,domain:b,overview:m,logo:c,favicon:a,ogImage:x,fonts:g,colors:h}},e[4]=p,e[5]=b,e[6]=m,e[7]=c,e[8]=a,e[9]=x,e[10]=g,e[11]=h,e[12]=v):v=e[12];const f=Xe(v);let C;e[13]!==s.id||e[14]!==s.images||e[15]!==o?(C={mutationFn:async j=>{const ve=Object.values(j.fonts).some(kt),Ce=Object.values(j.colors).some(Dt),Se={id:s.id,name:j.name,domain:j.domain,overview:j.overview,logo:j.logo||null,favicon:j.favicon||null,ogImage:j.ogImage||null,fonts:ve?j.fonts:null,colors:Ce?j.colors:null,images:s.images};await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:Se})},onError:wt},e[13]=s.id,e[14]=s.images,e[15]=o,e[16]=C):C=e[16];const w=ge(C);let D;e[17]!==s.id||e[18]!==f||e[19]!==l||e[20]!==w?(D={delayMs:500,save:async()=>{const j=f.control._formState.dirtyFields,ve=Object.keys(j);if(ve.length===0)return;const Ce=f.getValues(),Se=f.control._defaultValues;f.reset(Ce,{keepValues:!0});try{await w.mutateAsync(Ce),V("brand_updated",{brand_id:s.id,fields:ve}),X.success("Brand context updated successfully"),l()}catch{f.reset(Se,{keepValues:!0})}}},e[17]=s.id,e[18]=f,e[19]=l,e[20]=w,e[21]=D):D=e[21];const{schedule:y,flush:N}=at(D);let I;e[22]!==s.id||e[23]!==o?(I=async()=>{await o.callTool({name:"BRAND_CONTEXT_DELETE",arguments:{id:s.id}})},e[22]=s.id,e[23]=o,e[24]=I):I=e[24];let z;e[25]!==s.id||e[26]!==l?(z=()=>{V("brand_deleted",{brand_id:s.id}),u(!1),l(),X.success("Brand deleted")},e[25]=s.id,e[26]=l,e[27]=z):z=e[27];let U;e[28]!==I||e[29]!==z?(U={mutationFn:I,onSuccess:z,onError:_t},e[28]=I,e[29]=z,e[30]=U):U=e[30];const{mutate:xe,isPending:k}=ge(U);let B;e[31]!==s.id||e[32]!==s.isDefault||e[33]!==o?(B=async()=>{await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:{id:s.id,isDefault:!s.isDefault}})},e[31]=s.id,e[32]=s.isDefault,e[33]=o,e[34]=B):B=e[34];let A;e[35]!==s.id||e[36]!==s.isDefault||e[37]!==l?(A=()=>{V(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),l(),X.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[35]=s.id,e[36]=s.isDefault,e[37]=l,e[38]=A):A=e[38];let T;e[39]!==B||e[40]!==A?(T={mutationFn:B,onSuccess:A,onError:Nt},e[39]=B,e[40]=A,e[41]=T):T=e[41];const{mutate:O}=ge(T),M=s.isDefault?"border-primary/30":"border-border/60";let q;e[42]!==M?(q=_e("rounded-2xl border bg-background",M),e[42]=M,e[43]=q):q=e[43];let R;e[44]!==r?(R=()=>i(!r),e[44]=r,e[45]=R):R=e[45];let L;e[46]!==r?(L=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(qe,{size:14}):n.jsx(Me,{size:14})}),e[46]=r,e[47]=L):L=e[47];let E;e[48]!==s.logo||e[49]!==s.name?(E=s.logo?n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg",style:{backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"6px 6px",backgroundPosition:"0 0, 3px 3px",backgroundColor:"#fff"},children:n.jsx("img",{src:s.logo,alt:"",className:"h-full w-full object-contain p-1",onError:Ct})}):n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s.name?.charAt(0)?.toUpperCase()||"?"})}),e[48]=s.logo,e[49]=s.name,e[50]=E):E=e[50];const K=s.name||"Untitled Brand";let F;e[51]!==K?(F=n.jsx("span",{className:"text-sm font-medium text-foreground",children:K}),e[51]=K,e[52]=F):F=e[52];let S;e[53]!==s.domain?(S=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[53]=s.domain,e[54]=S):S=e[54];let P;e[55]!==F||e[56]!==S?(P=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[F,S]}),e[55]=F,e[56]=S,e[57]=P):P=e[57];let _;e[58]!==s.colors||e[59]!==r?(_=!r&&s.colors&&Object.values(s.colors).some(vt)&&n.jsx("div",{className:"flex shrink-0 gap-1",children:Object.entries(s.colors).filter(yt).map(jt)}),e[58]=s.colors,e[59]=r,e[60]=_):_=e[60];let $;e[61]!==s.fonts||e[62]!==r?($=!r&&s.fonts&&Object.values(s.fonts).some(bt)&&n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Object.values(s.fonts).filter(Boolean).join(", ")}),e[61]=s.fonts,e[62]=r,e[63]=$):$=e[63];const De=s.isDefault?"opacity-100":"opacity-0 hover:bg-muted group-hover:opacity-100";let G;e[64]!==De?(G=_e("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-opacity",De),e[64]=De,e[65]=G):G=e[65];let Q,Y;e[66]!==O?(Q=j=>{j.stopPropagation(),O()},Y=j=>{j.key==="Enter"&&(j.stopPropagation(),O())},e[66]=O,e[67]=Q,e[68]=Y):(Q=e[67],Y=e[68]);const ke=s.isDefault?"Unset as default":"Set as default",Be=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[69]!==Be?(J=_e(Be),e[69]=Be,e[70]=J):J=e[70];let W;e[71]!==J?(W=n.jsx(Ge,{size:13,className:J}),e[71]=J,e[72]=W):W=e[72];let Z;e[73]!==G||e[74]!==Q||e[75]!==Y||e[76]!==ke||e[77]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:Y,title:ke,children:W}),e[73]=G,e[74]=Q,e[75]=Y,e[76]=ke,e[77]=W,e[78]=Z):Z=e[78];let he,pe;e[79]===Symbol.for("react.memo_cache_sentinel")?(he=j=>{j.stopPropagation(),u(!0)},pe=j=>{j.key==="Enter"&&(j.stopPropagation(),u(!0))},e[79]=he,e[80]=pe):(he=e[79],pe=e[80]);let be;e[81]===Symbol.for("react.memo_cache_sentinel")?(be=n.jsx("span",{role:"button",tabIndex:0,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg opacity-0 transition-opacity hover:bg-destructive/10 group-hover:opacity-100",onClick:he,onKeyDown:pe,title:"Delete brand",children:n.jsx(Ye,{size:13,className:"text-muted-foreground"})}),e[81]=be):be=e[81];let ee;e[82]!==R||e[83]!==L||e[84]!==E||e[85]!==P||e[86]!==_||e[87]!==$||e[88]!==Z?(ee=n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-5",onClick:R,children:[L,E,P,_,$,Z,be]}),e[82]=R,e[83]=L,e[84]=E,e[85]=P,e[86]=_,e[87]=$,e[88]=Z,e[89]=ee):ee=e[89];let te;e[90]!==r||e[91]!==N||e[92]!==f||e[93]!==y?(te=r&&n.jsxs("div",{className:"space-y-3 px-5 pb-5",children:[n.jsx(dt,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(ft,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ht,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(xt,{form:f,onFieldChange:y,onFieldCommit:N})]})]}),e[90]=r,e[91]=N,e[92]=f,e[93]=y,e[94]=te):te=e[94];let se;e[95]!==k?(se=j=>{!j&&!k&&u(!1)},e[95]=k,e[96]=se):se=e[96];let je;e[97]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(We,{children:"Delete brand?"}),e[97]=je):je=e[97];const Ee=s.name||"this brand";let ne;e[98]!==Ee?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Ee}),". This action cannot be undone."]}),e[98]=Ee,e[99]=ne):ne=e[99];let le;e[100]!==s.isDefault?(le=s.isDefault&&n.jsxs("p",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/5 p-2 text-destructive",children:[n.jsx("span",{className:"font-medium",children:"Heads up:"})," this is your organization's default brand. Deleting it will leave your organization without a default brand until you set another."]}),e[100]=s.isDefault,e[101]=le):le=e[101];let oe;e[102]!==ne||e[103]!==le?(oe=n.jsxs(Ze,{children:[je,n.jsx(et,{asChild:!0,children:n.jsxs("div",{children:[ne,le]})})]}),e[102]=ne,e[103]=le,e[104]=oe):oe=e[104];let re;e[105]!==k?(re=n.jsx(tt,{disabled:k,children:"Cancel"}),e[105]=k,e[106]=re):re=e[106];let ae;e[107]!==xe?(ae=j=>{j.preventDefault(),xe()},e[107]=xe,e[108]=ae):ae=e[108];const Fe=k?"Deleting...":"Delete";let ie;e[109]!==k||e[110]!==ae||e[111]!==Fe?(ie=n.jsx(st,{onClick:ae,disabled:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[109]=k,e[110]=ae,e[111]=Fe,e[112]=ie):ie=e[112];let ce;e[113]!==re||e[114]!==ie?(ce=n.jsxs(nt,{children:[re,ie]}),e[113]=re,e[114]=ie,e[115]=ce):ce=e[115];let de;e[116]!==oe||e[117]!==ce?(de=n.jsxs(lt,{children:[oe,ce]}),e[116]=oe,e[117]=ce,e[118]=de):de=e[118];let me;e[119]!==d||e[120]!==se||e[121]!==de?(me=n.jsx(ot,{open:d,onOpenChange:se,children:de}),e[119]=d,e[120]=se,e[121]=de,e[122]=me):me=e[122];let ye;return e[123]!==q||e[124]!==ee||e[125]!==te||e[126]!==me?(ye=n.jsxs("div",{className:q,children:[ee,te,me]}),e[123]=q,e[124]=ee,e[125]=te,e[126]=me,e[127]=ye):ye=e[127],ye}function bt(t){return t}function jt(t){const[e,s]=t;return n.jsx("div",{className:"h-5 w-5 rounded-full border border-border/40",style:{backgroundColor:s},title:`${e}: ${s}`},e)}function yt(t){const[,e]=t;return e}function vt(t){return t}function Ct(t){t.target.style.display="none"}function Nt(){return X.error("Failed to update default brand")}function _t(){return X.error("Failed to delete brand")}function wt(){return X.error("Failed to save brand context")}function Dt(t){return t?.trim()}function kt(t){return t?.trim()}function Bt(){const t=H.c(57),{brandExtractEnabled:e}=Ie(),{org:s}=ze();let o;t[0]!==s.id||t[1]!==s.slug?(o={connectionId:He,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=o):o=t[2];const l=Ue(o),r=Le();let i;t[3]!==s.id?(i=Re.brandContext(s.id),t[3]=s.id,t[4]=i):i=t[4];let d;t[5]!==l?(d=async()=>{const _=await l.callTool({name:"BRAND_CONTEXT_LIST",arguments:{includeArchived:!1}}),$=$e(_);return Array.isArray($?.items)?$.items:[]},t[5]=l,t[6]=d):d=t[6];let u;t[7]!==i||t[8]!==d?(u={queryKey:i,queryFn:d},t[7]=i,t[8]=d,t[9]=u):u=t[9];const{data:p}=Ke(u),m=(p===void 0?[]:p).filter(St);let c;t[10]!==s.id||t[11]!==r?(c=()=>r.invalidateQueries({queryKey:Re.brandContext(s.id),refetchType:"all"}),t[10]=s.id,t[11]=r,t[12]=c):c=t[12];const a=c;let x;t[13]!==l?(x=async()=>{await l.callTool({name:"BRAND_CONTEXT_CREATE",arguments:{name:"New Brand",domain:"example.com",overview:""}})},t[13]=l,t[14]=x):x=t[14];let g;t[15]!==a?(g=()=>{V("brand_created"),a(),X.success("Brand created")},t[15]=a,t[16]=g):g=t[16];let h;t[17]!==x||t[18]!==g?(h={mutationFn:x,onSuccess:g,onError:Ft},t[17]=x,t[18]=g,t[19]=h):h=t[19];const{mutate:v,isPending:f}=ge(h);let C;t[20]!==l?(C=async _=>{V("brand_extract_started",{domain:_});const $=await l.callTool({name:"BRAND_CONTEXT_EXTRACT",arguments:{domain:_}});$e($)},t[20]=l,t[21]=C):C=t[21];let w;t[22]!==a?(w=()=>{V("brand_extract_succeeded"),a(),X.success("Brand extracted successfully")},t[22]=a,t[23]=w):w=t[23];let D;t[24]!==w||t[25]!==C?(D={mutationFn:C,onSuccess:w,onError:Et},t[24]=w,t[25]=C,t[26]=D):D=t[26];const{mutate:y,isPending:N}=ge(D),I=Ne,z=Ne,U=Ne,xe="flex flex-col gap-6";let k;t[27]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsxs("div",{children:[n.jsx(Ne.Title,{children:"Brand Context"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define your brand profiles. Each brand is available as an MCP prompt for AI clients."})]}),t[27]=k):k=t[27];let B;t[28]!==v?(B=()=>v(),t[28]=v,t[29]=B):B=t[29];let A;t[30]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(Pe,{size:14}),t[30]=A):A=t[30];let T;t[31]!==f||t[32]!==B?(T=n.jsxs("div",{className:"flex items-center justify-between",children:[k,n.jsxs(Te,{variant:"outline",onClick:B,disabled:f,children:[A,"Add Brand"]})]}),t[31]=f,t[32]=B,t[33]=T):T=t[33];let O;t[34]!==e||t[35]!==y||t[36]!==N?(O=e&&n.jsx(ct,{onExtract:_=>y(_),isExtracting:N}),t[34]=e,t[35]=y,t[36]=N,t[37]=O):O=t[37];const M=m.length===0&&n.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-8 text-center",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"No brands configured yet."}),n.jsxs(Te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>v(),disabled:f,children:[n.jsx(Pe,{size:14}),"Add your first brand"]})]}),q="group space-y-3";let R;t[38]!==l||t[39]!==a?(R=_=>n.jsx(pt,{brand:_,client:l,onChanged:a},_.id),t[38]=l,t[39]=a,t[40]=R):R=t[40];const L=m.map(R);let E;t[41]!==L?(E=n.jsx("div",{className:q,children:L}),t[41]=L,t[42]=E):E=t[42];let K;t[43]!==T||t[44]!==O||t[45]!==M||t[46]!==E?(K=n.jsxs("div",{className:xe,children:[T,O,M,E]}),t[43]=T,t[44]=O,t[45]=M,t[46]=E,t[47]=K):K=t[47];let F;t[48]!==U.Body||t[49]!==K?(F=n.jsx(U.Body,{children:K}),t[48]=U.Body,t[49]=K,t[50]=F):F=t[50];let S;t[51]!==z.Content||t[52]!==F?(S=n.jsx(z.Content,{children:F}),t[51]=z.Content,t[52]=F,t[53]=S):S=t[53];let P;return t[54]!==I||t[55]!==S?(P=n.jsx(I,{children:S}),t[54]=I,t[55]=S,t[56]=P):P=t[56],P}function Et(t){V("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),X.error(t instanceof Error?t.message:"Failed to extract brand")}function Ft(){return X.error("Failed to create brand")}function St(t){return!t.archivedAt}function ss(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(it,{capability:"org:manage",area:"brand context",children:n.jsx(Bt,{})}),t[0]=e):e=t[0],e}export{ss as default};
@@ -1 +1 @@
1
- import{e as D,j as t,E as q,r as v,B as A,o as P}from"./index-xlf1R0Pd.js";import{i as O}from"./AlertCircle-DO3qurkL.js";import{i as $}from"./HardDrive-CUKuGEue.js";import{s as E}from"./Plus-SYX7Jcs9.js";import{s as T}from"./Trash01-DUkv4uBS.js";import{f as L,g as K,c as G,b as M,d as W,e as H,a as J,A as Q}from"./alert-dialog-BbR-MKg7.js";import{D as V,a as X,b as Y,c as Z,e as ee,d as te}from"./dialog-C0feLjuV.js";import{I as N}from"./input-BjNSlgZE.js";import{L as k}from"./label-DeQwx-7l.js";import{S as se}from"./switch-CNDn_VQ1.js";import{S as ie}from"./skeleton-CGwzwFVG.js";import{T as re}from"./textarea-BJ0xg93C.js";import{P as _}from"./index-sl5NILiy.js";import{c as ne}from"./settings-section-DS4shxaT.js";import{u as le,a as oe,b as ae}from"./use-file-configs-DGbMu0K6.js";import{R as ce}from"./require-capability-C0QcGgFF.js";import"./X-DIHUsKrt.js";import"./sidebar-Clf4A7X_.js";import"./LayoutLeft-J1_JEXyN.js";import"./tooltip-eUi2Y5fU.js";import"./sheet-WSy7SjR0.js";import"./card-QVeHFZsG.js";import"./ArrowUpRight-CiDjAuoy.js";import"./constants-CMjFoMX0.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-capability-52ANg0ua.js";import"./access-gate-CuZatYm_.js";import"./capability-load-error-Cj6SN6lp.js";function de(s,e){if(!(s instanceof Error))return e;const i=s.message.match(/\[\s*\{[\s\S]*\}\s*\]/);if(i)try{const r=JSON.parse(i[0])[0];if(r?.message){const l=r.path?.join(".");return l?`${l}: ${r.message}`:r.message}}catch{}return s.message||e}function me(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(O,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load file configurations: ",i.message]})]}),e[1]=i.message,e[2]=r):r=e[2],r}function fe(s){const e=D.c(41),{config:i,onDelete:n}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx($,{size:16,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let l;e[1]!==i.name?(l=t.jsx("span",{className:"font-medium text-sm truncate",children:i.name}),e[1]=i.name,e[2]=l):l=e[2];let o;e[3]!==i.bucket||e[4]!==i.region?(o=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[3]=i.bucket,e[4]=i.region,e[5]=o):o=e[5];let p;e[6]!==l||e[7]!==o?(p=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o]}),e[6]=l,e[7]=o,e[8]=p):p=e[8];let a;e[9]!==i.description?(a=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[9]=i.description,e[10]=a):a=e[10];let j;e[11]!==i.endpoint||e[12]!==i.forcePathStyle?(j=i.endpoint?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:[i.endpoint,i.forcePathStyle?" (path-style)":""]}):null,e[11]=i.endpoint,e[12]=i.forcePathStyle,e[13]=j):j=e[13];let h;e[14]!==i.prefix?(h=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[14]=i.prefix,e[15]=h):h=e[15];let c;e[16]!==i.publicUrlBase?(c=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[16]=i.publicUrlBase,e[17]=c):c=e[17];let d;e[18]!==p||e[19]!==a||e[20]!==j||e[21]!==h||e[22]!==c?(d=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[p,a,j,h,c]})]}),e[18]=p,e[19]=a,e[20]=j,e[21]=h,e[22]=c,e[23]=d):d=e[23];let g;e[24]!==i.createdAt?(g=new Date(i.createdAt).toLocaleDateString(),e[24]=i.createdAt,e[25]=g):g=e[25];let x;e[26]!==g?(x=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let m;e[28]!==i||e[29]!==n?(m=()=>n(i),e[28]=i,e[29]=n,e[30]=m):m=e[30];const y=`Delete ${i.name}`;let f;e[31]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(T,{size:14}),e[31]=f):f=e[31];let u;e[32]!==m||e[33]!==y?(u=t.jsx(A,{variant:"ghost",size:"sm",onClick:m,"aria-label":y,children:f}),e[32]=m,e[33]=y,e[34]=u):u=e[34];let S;e[35]!==x||e[36]!==u?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[x,u]}),e[35]=x,e[36]=u,e[37]=S):S=e[37];let C;return e[38]!==S||e[39]!==d?(C=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[d,S]}),e[38]=S,e[39]=d,e[40]=C):C=e[40],C}function ue(s){const e=D.c(5),{onCreate:i}=s;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx($,{size:20,className:"text-muted-foreground"})}),r=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No buckets configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket (AWS S3, Cloudflare R2, Google Cloud Storage, MinIO). Access keys are encrypted at rest and never returned over the API."})]}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(E,{size:14}),e[2]=l):l=e[2];let o;return e[3]!==i?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[n,r,t.jsxs(A,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function B({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,p]=v.useState(""),[a,j]=v.useState(""),[h,c]=v.useState(""),[d,g]=v.useState(!1),[x,m]=v.useState(""),[y,f]=v.useState(""),[u,S]=v.useState(""),[C,w]=v.useState(""),F=oe();function R(){n(""),l(""),p(""),j(""),c(""),g(!1),m(""),f(""),S(""),w("")}async function z(b){if(b.preventDefault(),!(!i.trim()||!o.trim()||!a.trim())&&!(!u||!C))try{await F.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:a.trim(),endpoint:h.trim()||void 0,forcePathStyle:d,prefix:x.trim()||void 0,publicUrlBase:y.trim()||void 0,accessKeyId:u,secretAccessKey:C}),P.success(`Bucket "${i.trim()}" added`),R(),e(!1)}catch(I){P.error(de(I,"Failed to add bucket"))}}const U=F.isPending||!i.trim()||!o.trim()||!a.trim()||!u||!C;return t.jsx(V,{open:s,onOpenChange:e,children:t.jsxs(X,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(Y,{children:[t.jsx(Z,{children:"Add S3 bucket"}),t.jsx(ee,{children:"Credentials are encrypted at rest and never returned over the API. For Cloudflare R2, Google Cloud Storage, or MinIO, set a custom endpoint."})]}),t.jsxs("form",{onSubmit:z,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:b=>n(b.target.value),placeholder:"production-uploads",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Unique within the organization."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:b=>p(b.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:a,onChange:b=>j(b.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:h,onChange:b=>c(b.target.value),placeholder:"https://<account>.r2.cloudflarestorage.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for non-AWS providers (R2, GCS, MinIO)."})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/60 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(k,{htmlFor:"file-config-path-style",className:"text-sm",children:"Force path-style URLs"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Required for Google Cloud Storage and most MinIO setups."})]}),t.jsx(se,{id:"file-config-path-style",checked:d,onCheckedChange:g})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:x,onChange:b=>m(b.target.value),placeholder:"tenants/acme/",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"All object keys are written under this prefix. Useful for multi-tenant buckets or credentials scoped to a sub-path. A trailing slash is added automatically."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:y,onChange:b=>f(b.target.value),placeholder:"https://pub-xxxx.r2.dev or https://cdn.example.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Host used to build public URLs returned by the picker (R2 dev domain, CDN, custom host). Leave blank to use the bucket's S3 host (AWS default)."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:u,onChange:b=>S(b.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:C,onChange:b=>w(b.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(re,{id:"file-config-description",value:r,onChange:b=>l(b.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(te,{children:[t.jsx(A,{type:"button",variant:"outline",onClick:()=>{R(),e(!1)},disabled:F.isPending,children:"Cancel"}),t.jsx(A,{type:"submit",disabled:U,children:F.isPending?"Adding…":"Add bucket"})]})]})]})})}function xe(s){const e=D.c(25),{config:i,onClose:n}=s,r=ae();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),P.success(`Bucket "${i.name}" removed`),n()}catch(S){const C=S;P.error(C instanceof Error?C.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,p=i!==null;let a;e[4]!==n?(a=u=>!u&&n(),e[4]=n,e[5]=a):a=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(G,{children:"Remove bucket configuration?"}),e[6]=j):j=e[6];const h=i?.name;let c;e[7]!==h?(c=t.jsxs(M,{children:[j,t.jsxs(W,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:h}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=h,e[8]=c):c=e[8];let d;e[9]!==r.isPending?(d=t.jsx(L,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=d):d=e[10];const g=r.isPending?"Removing…":"Remove";let x;e[11]!==r.isPending||e[12]!==o||e[13]!==g?(x=t.jsx(K,{onClick:o,disabled:r.isPending,children:g}),e[11]=r.isPending,e[12]=o,e[13]=g,e[14]=x):x=e[14];let m;e[15]!==d||e[16]!==x?(m=t.jsxs(H,{children:[d,x]}),e[15]=d,e[16]=x,e[17]=m):m=e[17];let y;e[18]!==m||e[19]!==c?(y=t.jsxs(J,{children:[c,m]}),e[18]=m,e[19]=c,e[20]=y):y=e[20];let f;return e[21]!==y||e[22]!==p||e[23]!==a?(f=t.jsx(Q,{open:p,onOpenChange:a,children:y}),e[21]=y,e[22]=p,e[23]=a,e[24]=f):f=e[24],f}function pe(){const s=D.c(25),e=le(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let f;s[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ue,{onCreate:()=>n(!0)}),s[0]=f):f=s[0];let u;return s[1]!==i?(u=t.jsxs(t.Fragment,{children:[f,t.jsx(B,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=u):u=s[2],u}const o=e.length===1?"":"s";let p;s[3]!==e.length||s[4]!==o?(p=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=p):p=s[5];let a;s[6]===Symbol.for("react.memo_cache_sentinel")?(a=()=>n(!0),s[6]=a):a=s[6];let j;s[7]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs(A,{onClick:a,size:"sm",children:[t.jsx(E,{size:14}),"Add bucket"]}),s[7]=j):j=s[7];let h;s[8]!==p?(h=t.jsxs("div",{className:"flex items-center justify-between",children:[p,j]}),s[8]=p,s[9]=h):h=s[9];let c;if(s[10]!==e){let f;s[12]===Symbol.for("react.memo_cache_sentinel")?(f=u=>t.jsx(fe,{config:u,onDelete:l},u.id),s[12]=f):f=s[12],c=e.map(f),s[10]=e,s[11]=c}else c=s[11];let d;s[13]!==c?(d=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:c})}),s[13]=c,s[14]=d):d=s[14];let g;s[15]!==i?(g=t.jsx(B,{open:i,onOpenChange:n}),s[15]=i,s[16]=g):g=s[16];let x;s[17]===Symbol.for("react.memo_cache_sentinel")?(x=()=>l(null),s[17]=x):x=s[17];let m;s[18]!==r?(m=t.jsx(xe,{config:r,onClose:x}),s[18]=r,s[19]=m):m=s[19];let y;return s[20]!==h||s[21]!==d||s[22]!==g||s[23]!==m?(y=t.jsxs(t.Fragment,{children:[h,d,g,m]}),s[20]=h,s[21]=d,s[22]=g,s[23]=m,s[24]=y):y=s[24],y}function he(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(_.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_,{children:t.jsx(_.Content,{children:t.jsx(_.Body,{children:t.jsxs(ne,{children:[e,t.jsx(q,{fallback:ge,children:t.jsx(v.Suspense,{fallback:t.jsx(ie,{className:"h-32 w-full"}),children:t.jsx(pe,{})})})]})})})}),s[1]=i):i=s[1],i}function ge(s){const{error:e}=s;return t.jsx(me,{error:e??new Error("Failed to load file configs")})}function We(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ce,{capability:"file-configs:manage",area:"files",children:t.jsx(he,{})}),s[0]=e):e=s[0],e}export{We as default};
1
+ import{e as D,j as t,E as q,r as v,B as A,o as P}from"./index-DRJmNXDD.js";import{i as O}from"./AlertCircle-CUUsAdtH.js";import{i as $}from"./HardDrive-5wu_NjNO.js";import{s as E}from"./Plus-CT-4Jh-n.js";import{s as T}from"./Trash01-CR3E97ay.js";import{f as L,g as K,c as G,b as M,d as W,e as H,a as J,A as Q}from"./alert-dialog-DZtlkgip.js";import{D as V,a as X,b as Y,c as Z,e as ee,d as te}from"./dialog-CIzTOcgG.js";import{I as N}from"./input-P729pT4B.js";import{L as k}from"./label-mYXtiAEA.js";import{S as se}from"./switch-azpLz6de.js";import{S as ie}from"./skeleton-CjQ5K3vJ.js";import{T as re}from"./textarea-D0c-a7yW.js";import{P as _}from"./index-Bay0Y2nf.js";import{c as ne}from"./settings-section-CH8XK4Me.js";import{u as le,a as oe,b as ae}from"./use-file-configs-Cr_pEuKT.js";import{R as ce}from"./require-capability-Fk6DVHbg.js";import"./X-H2fYFKrr.js";import"./sidebar-C55uTdAM.js";import"./LayoutLeft-HrAYDWPl.js";import"./tooltip-Bc8MQzHk.js";import"./sheet-Cba9SmBC.js";import"./card-CIVB52uv.js";import"./ArrowUpRight-Cf4evQxw.js";import"./constants-Dn21fsKH.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-capability-B8J1tkgS.js";import"./access-gate-DW1Er84j.js";import"./capability-load-error-BC3MQy0S.js";function de(s,e){if(!(s instanceof Error))return e;const i=s.message.match(/\[\s*\{[\s\S]*\}\s*\]/);if(i)try{const r=JSON.parse(i[0])[0];if(r?.message){const l=r.path?.join(".");return l?`${l}: ${r.message}`:r.message}}catch{}return s.message||e}function me(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(O,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load file configurations: ",i.message]})]}),e[1]=i.message,e[2]=r):r=e[2],r}function fe(s){const e=D.c(41),{config:i,onDelete:n}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx($,{size:16,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let l;e[1]!==i.name?(l=t.jsx("span",{className:"font-medium text-sm truncate",children:i.name}),e[1]=i.name,e[2]=l):l=e[2];let o;e[3]!==i.bucket||e[4]!==i.region?(o=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[3]=i.bucket,e[4]=i.region,e[5]=o):o=e[5];let p;e[6]!==l||e[7]!==o?(p=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o]}),e[6]=l,e[7]=o,e[8]=p):p=e[8];let a;e[9]!==i.description?(a=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[9]=i.description,e[10]=a):a=e[10];let j;e[11]!==i.endpoint||e[12]!==i.forcePathStyle?(j=i.endpoint?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:[i.endpoint,i.forcePathStyle?" (path-style)":""]}):null,e[11]=i.endpoint,e[12]=i.forcePathStyle,e[13]=j):j=e[13];let h;e[14]!==i.prefix?(h=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[14]=i.prefix,e[15]=h):h=e[15];let c;e[16]!==i.publicUrlBase?(c=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[16]=i.publicUrlBase,e[17]=c):c=e[17];let d;e[18]!==p||e[19]!==a||e[20]!==j||e[21]!==h||e[22]!==c?(d=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[p,a,j,h,c]})]}),e[18]=p,e[19]=a,e[20]=j,e[21]=h,e[22]=c,e[23]=d):d=e[23];let g;e[24]!==i.createdAt?(g=new Date(i.createdAt).toLocaleDateString(),e[24]=i.createdAt,e[25]=g):g=e[25];let x;e[26]!==g?(x=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let m;e[28]!==i||e[29]!==n?(m=()=>n(i),e[28]=i,e[29]=n,e[30]=m):m=e[30];const y=`Delete ${i.name}`;let f;e[31]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(T,{size:14}),e[31]=f):f=e[31];let u;e[32]!==m||e[33]!==y?(u=t.jsx(A,{variant:"ghost",size:"sm",onClick:m,"aria-label":y,children:f}),e[32]=m,e[33]=y,e[34]=u):u=e[34];let S;e[35]!==x||e[36]!==u?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[x,u]}),e[35]=x,e[36]=u,e[37]=S):S=e[37];let C;return e[38]!==S||e[39]!==d?(C=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[d,S]}),e[38]=S,e[39]=d,e[40]=C):C=e[40],C}function ue(s){const e=D.c(5),{onCreate:i}=s;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx($,{size:20,className:"text-muted-foreground"})}),r=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No buckets configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket (AWS S3, Cloudflare R2, Google Cloud Storage, MinIO). Access keys are encrypted at rest and never returned over the API."})]}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(E,{size:14}),e[2]=l):l=e[2];let o;return e[3]!==i?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[n,r,t.jsxs(A,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function B({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,p]=v.useState(""),[a,j]=v.useState(""),[h,c]=v.useState(""),[d,g]=v.useState(!1),[x,m]=v.useState(""),[y,f]=v.useState(""),[u,S]=v.useState(""),[C,w]=v.useState(""),F=oe();function R(){n(""),l(""),p(""),j(""),c(""),g(!1),m(""),f(""),S(""),w("")}async function z(b){if(b.preventDefault(),!(!i.trim()||!o.trim()||!a.trim())&&!(!u||!C))try{await F.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:a.trim(),endpoint:h.trim()||void 0,forcePathStyle:d,prefix:x.trim()||void 0,publicUrlBase:y.trim()||void 0,accessKeyId:u,secretAccessKey:C}),P.success(`Bucket "${i.trim()}" added`),R(),e(!1)}catch(I){P.error(de(I,"Failed to add bucket"))}}const U=F.isPending||!i.trim()||!o.trim()||!a.trim()||!u||!C;return t.jsx(V,{open:s,onOpenChange:e,children:t.jsxs(X,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(Y,{children:[t.jsx(Z,{children:"Add S3 bucket"}),t.jsx(ee,{children:"Credentials are encrypted at rest and never returned over the API. For Cloudflare R2, Google Cloud Storage, or MinIO, set a custom endpoint."})]}),t.jsxs("form",{onSubmit:z,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:b=>n(b.target.value),placeholder:"production-uploads",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Unique within the organization."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:b=>p(b.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:a,onChange:b=>j(b.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:h,onChange:b=>c(b.target.value),placeholder:"https://<account>.r2.cloudflarestorage.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for non-AWS providers (R2, GCS, MinIO)."})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/60 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(k,{htmlFor:"file-config-path-style",className:"text-sm",children:"Force path-style URLs"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Required for Google Cloud Storage and most MinIO setups."})]}),t.jsx(se,{id:"file-config-path-style",checked:d,onCheckedChange:g})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:x,onChange:b=>m(b.target.value),placeholder:"tenants/acme/",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"All object keys are written under this prefix. Useful for multi-tenant buckets or credentials scoped to a sub-path. A trailing slash is added automatically."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:y,onChange:b=>f(b.target.value),placeholder:"https://pub-xxxx.r2.dev or https://cdn.example.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Host used to build public URLs returned by the picker (R2 dev domain, CDN, custom host). Leave blank to use the bucket's S3 host (AWS default)."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:u,onChange:b=>S(b.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:C,onChange:b=>w(b.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(re,{id:"file-config-description",value:r,onChange:b=>l(b.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(te,{children:[t.jsx(A,{type:"button",variant:"outline",onClick:()=>{R(),e(!1)},disabled:F.isPending,children:"Cancel"}),t.jsx(A,{type:"submit",disabled:U,children:F.isPending?"Adding…":"Add bucket"})]})]})]})})}function xe(s){const e=D.c(25),{config:i,onClose:n}=s,r=ae();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),P.success(`Bucket "${i.name}" removed`),n()}catch(S){const C=S;P.error(C instanceof Error?C.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,p=i!==null;let a;e[4]!==n?(a=u=>!u&&n(),e[4]=n,e[5]=a):a=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(G,{children:"Remove bucket configuration?"}),e[6]=j):j=e[6];const h=i?.name;let c;e[7]!==h?(c=t.jsxs(M,{children:[j,t.jsxs(W,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:h}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=h,e[8]=c):c=e[8];let d;e[9]!==r.isPending?(d=t.jsx(L,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=d):d=e[10];const g=r.isPending?"Removing…":"Remove";let x;e[11]!==r.isPending||e[12]!==o||e[13]!==g?(x=t.jsx(K,{onClick:o,disabled:r.isPending,children:g}),e[11]=r.isPending,e[12]=o,e[13]=g,e[14]=x):x=e[14];let m;e[15]!==d||e[16]!==x?(m=t.jsxs(H,{children:[d,x]}),e[15]=d,e[16]=x,e[17]=m):m=e[17];let y;e[18]!==m||e[19]!==c?(y=t.jsxs(J,{children:[c,m]}),e[18]=m,e[19]=c,e[20]=y):y=e[20];let f;return e[21]!==y||e[22]!==p||e[23]!==a?(f=t.jsx(Q,{open:p,onOpenChange:a,children:y}),e[21]=y,e[22]=p,e[23]=a,e[24]=f):f=e[24],f}function pe(){const s=D.c(25),e=le(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let f;s[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ue,{onCreate:()=>n(!0)}),s[0]=f):f=s[0];let u;return s[1]!==i?(u=t.jsxs(t.Fragment,{children:[f,t.jsx(B,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=u):u=s[2],u}const o=e.length===1?"":"s";let p;s[3]!==e.length||s[4]!==o?(p=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=p):p=s[5];let a;s[6]===Symbol.for("react.memo_cache_sentinel")?(a=()=>n(!0),s[6]=a):a=s[6];let j;s[7]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs(A,{onClick:a,size:"sm",children:[t.jsx(E,{size:14}),"Add bucket"]}),s[7]=j):j=s[7];let h;s[8]!==p?(h=t.jsxs("div",{className:"flex items-center justify-between",children:[p,j]}),s[8]=p,s[9]=h):h=s[9];let c;if(s[10]!==e){let f;s[12]===Symbol.for("react.memo_cache_sentinel")?(f=u=>t.jsx(fe,{config:u,onDelete:l},u.id),s[12]=f):f=s[12],c=e.map(f),s[10]=e,s[11]=c}else c=s[11];let d;s[13]!==c?(d=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:c})}),s[13]=c,s[14]=d):d=s[14];let g;s[15]!==i?(g=t.jsx(B,{open:i,onOpenChange:n}),s[15]=i,s[16]=g):g=s[16];let x;s[17]===Symbol.for("react.memo_cache_sentinel")?(x=()=>l(null),s[17]=x):x=s[17];let m;s[18]!==r?(m=t.jsx(xe,{config:r,onClose:x}),s[18]=r,s[19]=m):m=s[19];let y;return s[20]!==h||s[21]!==d||s[22]!==g||s[23]!==m?(y=t.jsxs(t.Fragment,{children:[h,d,g,m]}),s[20]=h,s[21]=d,s[22]=g,s[23]=m,s[24]=y):y=s[24],y}function he(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(_.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_,{children:t.jsx(_.Content,{children:t.jsx(_.Body,{children:t.jsxs(ne,{children:[e,t.jsx(q,{fallback:ge,children:t.jsx(v.Suspense,{fallback:t.jsx(ie,{className:"h-32 w-full"}),children:t.jsx(pe,{})})})]})})})}),s[1]=i):i=s[1],i}function ge(s){const{error:e}=s;return t.jsx(me,{error:e??new Error("Failed to load file configs")})}function We(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ce,{capability:"file-configs:manage",area:"files",children:t.jsx(he,{})}),s[0]=e):e=s[0],e}export{We as default};