decocms 3.36.8 → 3.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/client/assets/{AlertCircle-diUVbO2-.js → AlertCircle-B8wgh1Ly.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DZao7AcN.js → ArrowUpRight-DFourmXp.js} +1 -1
  3. package/dist/client/assets/{Check-BKIJF1cF.js → Check-D0urCyzd.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-BEdczdw2.js → CheckCircle-Qyp95spV.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CibD7WLD.js → ChevronDown-DwPK2mcP.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-DnwnYIMW.js → ChevronLeft-C357wJbK.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BkNktb2f.js → ChevronRight-pxM9WiYB.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-DGD0GGvF.js → ChevronUp-DNp3BStr.js} +1 -1
  9. package/dist/client/assets/{Container-u2OVN7H1.js → Container-CwEfFXez.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CJXQkRAx.js → DotsVertical-DE_SmTP3.js} +1 -1
  11. package/dist/client/assets/{Eye-Dl4wUVA0.js → Eye-Cfv_RGHV.js} +1 -1
  12. package/dist/client/assets/{FilterLines-Ckb-C13v.js → FilterLines-91VA8muG.js} +1 -1
  13. package/dist/client/assets/{Globe01-DuXtiXmT.js → Globe01-ho0SCMcq.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DsvvHov8.js → HardDrive-B_FOclPu.js} +1 -1
  15. package/dist/client/assets/{Key01-CamRGqdp.js → Key01-iwxkuIvh.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-RNub1vlB.js → LayoutLeft-UZ6_8WBi.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-CkMjIxNM.js → LinkExternal01-Zwfdiaw5.js} +1 -1
  18. package/dist/client/assets/{Monitor01-CMEyE7XK.js → Monitor01-CwZrvxuC.js} +1 -1
  19. package/dist/client/assets/{Palette-3y8-lyYx.js → Palette-D6gsHlnc.js} +1 -1
  20. package/dist/client/assets/{Play-BWUsEKn-.js → Play-CvfmKRq2.js} +1 -1
  21. package/dist/client/assets/{Plus-CKCNLZUU.js → Plus-BCfK0mBl.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-Gjck8qdC.js → RefreshCcw01-k5H1KZCV.js} +1 -1
  23. package/dist/client/assets/{SearchMd-C9j-gudR.js → SearchMd-CPNqbMGc.js} +1 -1
  24. package/dist/client/assets/{Settings02-CYtGjYiT.js → Settings02-sp3cCEp1.js} +1 -1
  25. package/dist/client/assets/{Shield01-CnPBBwr9.js → Shield01-BnTZT70O.js} +1 -1
  26. package/dist/client/assets/{Star01-DkjN3wmL.js → Star01-C3iVmnF7.js} +1 -1
  27. package/dist/client/assets/{Stars01-CGinyuoF.js → Stars01-spNf2CVt.js} +1 -1
  28. package/dist/client/assets/{Stars02-8XRN5mVg.js → Stars02-DTJjqSl_.js} +1 -1
  29. package/dist/client/assets/{Sun-B5JsbdJQ.js → Sun-Bd_n5MS2.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-D_ioy5qF.js → SwitchHorizontal01--RQkLq3s.js} +1 -1
  31. package/dist/client/assets/{Tool01-WP19hvhy.js → Tool01-UC0L2ZqT.js} +1 -1
  32. package/dist/client/assets/{Trash01-ysxYI5Wr.js → Trash01-C89-wTac.js} +1 -1
  33. package/dist/client/assets/{Upload01-BEUiJeg2.js → Upload01-CvoLArfG.js} +1 -1
  34. package/dist/client/assets/{User01--nPpP5WD.js → User01-CHDBPbMe.js} +1 -1
  35. package/dist/client/assets/{Users01-CJfUt2eU.js → Users01-AMiQvbzx.js} +1 -1
  36. package/dist/client/assets/{Users03-C0zNVryE.js → Users03-z8pz4cwj.js} +1 -1
  37. package/dist/client/assets/{X-Dk_6ic2Z.js → X-ncGdMje6.js} +1 -1
  38. package/dist/client/assets/{XCircle-CbslYmbl.js → XCircle-BOJh16Ag.js} +1 -1
  39. package/dist/client/assets/{XClose-MySSOydc.js → XClose-xAOdH2ec.js} +1 -1
  40. package/dist/client/assets/{Zap-qtt4gXCs.js → Zap-DRqUuFzT.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-DiFDNaz3.js → ZapSquare-CgDDvUYJ.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-BEjoQvI4.js → ZoomOut-BX0KAK4E.js} +1 -1
  43. package/dist/client/assets/{access-gate-ngcc1WVS.js → access-gate--AqGaZB3.js} +1 -1
  44. package/dist/client/assets/{accordion-BOcO2Sna.js → accordion-BuZO_I6n.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CJp9aW-b.js → add-section-modal-rYMlcfZK.js} +1 -1
  46. package/dist/client/assets/agent-capabilities-CqovZOHW.js +3 -0
  47. package/dist/client/assets/{agent-icon-DDCLA9rm.js → agent-icon-BSv2ZliY.js} +1 -1
  48. package/dist/client/assets/{agents-list-B0tfBLmN.js → agents-list-CmYCHfAQ.js} +1 -1
  49. package/dist/client/assets/{ai-providers-CFrOqxsn.js → ai-providers-6F9F9DIs.js} +1 -1
  50. package/dist/client/assets/{alert-BBvLAZ8F.js → alert-CcZNr6SG.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-Czjj9xUL.js → alert-dialog-CAUF2lG9.js} +1 -1
  52. package/dist/client/assets/app-editor-B-eeqhg_.js +1 -0
  53. package/dist/client/assets/{auth-CiDtyFcv.js → auth-BL0nL9hg.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-B0-jSWZU.js → auth-catchall-BOZa6JWc.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-BIBJaUjk.js → auth-split-layout-DPGpfEMf.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-ComFNSHa.js → automation-list-row-6ykDco-o.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CwgZcPxU.js → automation-runs-DqEY9N3m.js} +1 -1
  58. package/dist/client/assets/{automations-CmFLKPOX.js → automations-DYa5K7uf.js} +1 -1
  59. package/dist/client/assets/{avatar-B0oOQW3w.js → avatar-CKQTxZ1l.js} +1 -1
  60. package/dist/client/assets/{badge-CPbLyufC.js → badge-8nbtF57a.js} +1 -1
  61. package/dist/client/assets/{brand-context-BNo29QkS.js → brand-context-Keh-FgCI.js} +1 -1
  62. package/dist/client/assets/{buckets-BTWRkLl1.js → buckets-v205fCPo.js} +1 -1
  63. package/dist/client/assets/{calendar-LmdrkG8B.js → calendar-BvmyrwZT.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-BU8SCPcT.js → capability-load-error-CgPvQ3DP.js} +1 -1
  65. package/dist/client/assets/{card-DdkEdLE9.js → card-CSrfjLPK.js} +1 -1
  66. package/dist/client/assets/chat-context-CX93kZ3t.js +21 -0
  67. package/dist/client/assets/{checkbox-BC4wIenO.js → checkbox-emZqfNka.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-DL51rx0C.js → cli-auth-success-TnF4DMg7.js} +1 -1
  69. package/dist/client/assets/{collection-detail-BiWubvHL.js → collection-detail-BT1eAXzt.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-tErBbn-6.js → collection-display-button-Cn53vdgk.js} +1 -1
  71. package/dist/client/assets/{collection-search-GY1bal72.js → collection-search-DtWJHNG9.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-BLpY2FjH.js → collection-table-wrapper-5l1s21E3.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-VcC-MXis.js → collection-tabs-BfVE1VBn.js} +1 -1
  74. package/dist/client/assets/{collections-DFUCvejZ.js → collections-CccDziah.js} +1 -1
  75. package/dist/client/assets/{command-DTlk4TO1.js → command-B9-QuD3I.js} +1 -1
  76. package/dist/client/assets/connect-desktop-dialog-Brphey_z.js +1 -0
  77. package/dist/client/assets/{connection-card-J_SBwL8x.js → connection-card-BT3OrnD0.js} +1 -1
  78. package/dist/client/assets/{connection-detail-BiRkgy_l.js → connection-detail-CbSv2HSL.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-BkqhduE1.js → connection-form-helpers-jwqRoSno.js} +1 -1
  80. package/dist/client/assets/{connections-BcU9kTAE.js → connections-Ye6Uy5rT.js} +1 -1
  81. package/dist/client/assets/{decopilot-BIeINY_s.js → decopilot-qvpc7Sek.js} +2 -2
  82. package/dist/client/assets/decopilot-sse-pool-C1TU9aOA.js +1 -0
  83. package/dist/client/assets/{dialog-BQ75yEwF.js → dialog-NPdsRr2K.js} +1 -1
  84. package/dist/client/assets/{domain-settings-e1Vus4xL.js → domain-settings-CkRknwBG.js} +1 -1
  85. package/dist/client/assets/{drawer-DHZ6TiZV.js → drawer-C8_o0ImI.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-C9Apf8St.js → dropdown-menu-B7tRotB5.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-uPTvMT1i.js → dynamic-plugin-layout-BOuZuhA_.js} +1 -1
  88. package/dist/client/assets/{empty-state-lFjdJT7F.js → empty-state-B5-XU_Qq.js} +1 -1
  89. package/dist/client/assets/{empty-state-DneBSEGo.js → empty-state-DAGj9d4y.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-DY_wdsqB.js → extract-connection-data-gSFD29EZ.js} +1 -1
  91. package/dist/client/assets/{features-9TbsLZr4.js → features-d8fgsMPi.js} +1 -1
  92. package/dist/client/assets/{file-explorer-9WRP-9UQ.js → file-explorer-DQz3ihEX.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-BMtzYhxY.js → file-type-icon-BQd_cgeD.js} +1 -1
  94. package/dist/client/assets/{files-Dhl8Q6Au.js → files-BbwS0mtG.js} +1 -1
  95. package/dist/client/assets/{form-CvLuR0Gb.js → form-Cj4RGsYg.js} +1 -1
  96. package/dist/client/assets/{general-2s032ZcY.js → general-BpEOoyW8.js} +1 -1
  97. package/dist/client/assets/{generate-id-Df1_2KNe.js → generate-id-ofakiB8n.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-DC8oHexa.js → github-repo-picker-mW07O8yJ.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-BfAGzd8m.js → header-tab-button-D7VApmY0.js} +1 -1
  100. package/dist/client/assets/{hover-card-4KBIFi9j.js → hover-card-6VdpmsDU.js} +1 -1
  101. package/dist/client/assets/{image-field-KauoRkxt.js → image-field-Bcq-hVOg.js} +1 -1
  102. package/dist/client/assets/{index-6v8yQXXA.js → index-B9ecm8uM.js} +1 -1
  103. package/dist/client/assets/{index-D1RdoGnd.js → index-BtFMBt2v.js} +1 -1
  104. package/dist/client/assets/{index-CHcXeW8J.js → index-C81KKEdc.js} +1 -1
  105. package/dist/client/assets/{index-CZmaPtza.js → index-CH6rJ--L.js} +24 -24
  106. package/dist/client/assets/index-CTTuPnXB.js +1 -0
  107. package/dist/client/assets/{index-Bge_3NUT.js → index-CZc_n55l.js} +1 -1
  108. package/dist/client/assets/{index-BBsNs16v.js → index-Cl6oCTqk.js} +1 -1
  109. package/dist/client/assets/{index-CiA0zZvI.js → index-DF2vRBkT.js} +1 -1
  110. package/dist/client/assets/{index-D7zMM4W4.js → index-DGGjIheX.js} +3 -3
  111. package/dist/client/assets/{index-CfcqKeX1.js → index-DK5lK69Y.js} +1 -1
  112. package/dist/client/assets/{index-BkjOXm-U.js → index-DP7f4jv4.js} +1 -1
  113. package/dist/client/assets/{index-DAz0gT0O.js → index-Dx3qMd9z.js} +1 -1
  114. package/dist/client/assets/{index-DOOpysP1.js → index-b2M5sZOB.js} +1 -1
  115. package/dist/client/assets/{index-DY-zRdhZ.js → index-pTlAPI8b.js} +1 -1
  116. package/dist/client/assets/{index-redirect-DHEXmWaA.js → index-redirect-ByzWgrxP.js} +1 -1
  117. package/dist/client/assets/{index-DAqaT6Rd.js → index-u7WCkeqH.js} +1 -1
  118. package/dist/client/assets/{input-DlpqEr8E.js → input-DYsPOaw4.js} +1 -1
  119. package/dist/client/assets/{integration-icon-CBAKG0Pi.js → integration-icon-DPU9dY8x.js} +1 -1
  120. package/dist/client/assets/{label-BCg8KKvZ.js → label-Mdkg-a4K.js} +1 -1
  121. package/dist/client/assets/{layout-DXZ4W4co.js → layout-CU5iFDsE.js} +1 -1
  122. package/dist/client/assets/{login-CojfjNfQ.js → login-d0pplMa6.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-X7hs3Ag9.js → mcp-oauth-Volcctly.js} +1 -1
  124. package/dist/client/assets/{members-B8fViDTN.js → members-BK5L7JQD.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-CIH-AKEP.js → monaco-editor-4CF0qu1C.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-CCcAAEao.js → monitoring-stats-row-CFGsDpK7.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-CZccUhJ6.js → oauth-callback-DhqXwpa8.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-CFS2UJsP.js → oauth-callback-ai-provider-BHSpzZke.js} +1 -1
  129. package/dist/client/assets/{onboarding-BRAoHg0Y.js → onboarding-DUe6TykK.js} +1 -1
  130. package/dist/client/assets/{org-install-DcjkeQWQ.js → org-install-DamvG0TG.js} +1 -1
  131. package/dist/client/assets/{org-layout-CoTqhSTr.js → org-layout-3uHDqMYh.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-OiLrrpvb.js → org-plugin-layout-CP8-PFlP.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-29P9gMgJ.js → page-seo-form-Co3gV6nS.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-DlQgt1ce.js +1 -0
  135. package/dist/client/assets/{pair-DbqLAr7H.js → pair-nJ1ZiPVr.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-clkVquTR.js → plugin-empty-state-B_fcTgAM.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CvCFe8sm.js → plugin-header-zj7BhYV0.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-bpk5-ppI.js → plugin-layout-BXugA7sH.js} +1 -1
  139. package/dist/client/assets/{popover-CGxVd8dj.js → popover-CCUenseZ.js} +1 -1
  140. package/dist/client/assets/{post-editor-BRDFK_L9.js → post-editor-BmGcYIO1.js} +1 -1
  141. package/dist/client/assets/{primitives-BjOQ6kiW.js → primitives-DDWQanLc.js} +1 -1
  142. package/dist/client/assets/{profile-DXYWvJhr.js → profile-pOgFJgzN.js} +1 -1
  143. package/dist/client/assets/project-app-view-DADZJkAJ.js +1 -0
  144. package/dist/client/assets/record-editor-DwZPV8Tp.js +1 -0
  145. package/dist/client/assets/registry-DpZxa23w.js +2 -0
  146. package/dist/client/assets/{registry-layout-KpLfwb01.js → registry-layout-vrycAExD.js} +1 -1
  147. package/dist/client/assets/{require-capability-siE8o61Y.js → require-capability-DDdNdDdz.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-B6wlMeXp.js → required-auth-layout-Dvl8wW25.js} +1 -1
  149. package/dist/client/assets/{reset-password-DMGhuy3g.js → reset-password-BO9Tpk_q.js} +1 -1
  150. package/dist/client/assets/{resizable-DvU979g4.js → resizable-FPwEQu4J.js} +1 -1
  151. package/dist/client/assets/{roles-BbRFWJFf.js → roles-B5S-JsJi.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-xyiiUgMo.js +1 -0
  153. package/dist/client/assets/{save-status-DMf7Ki8m.js → save-status-CDo7AlvY.js} +1 -1
  154. package/dist/client/assets/{schema-form-CmUF2bFS.js → schema-form-B5X_jnCS.js} +1 -1
  155. package/dist/client/assets/{scroll-area-DAQuWOFc.js → scroll-area-86Op8ApP.js} +1 -1
  156. package/dist/client/assets/{search-input-C0c6vwO5.js → search-input-DFrDstX6.js} +1 -1
  157. package/dist/client/assets/{secrets-D1HBT99G.js → secrets-C4XubnGB.js} +1 -1
  158. package/dist/client/assets/{sections-editor-Bcy_4zFJ.js → sections-editor-BGpn_Sa9.js} +1 -1
  159. package/dist/client/assets/{select-BTJH3S1Y.js → select-DIImlu5H.js} +1 -1
  160. package/dist/client/assets/{select-model-DPxYg0zJ.js → select-model-DMM38IJD.js} +1 -1
  161. package/dist/client/assets/{seo-editor-b_pr82NE.js → seo-editor-tNuhLm3d.js} +1 -1
  162. package/dist/client/assets/{settings-layout-Daps0DJ2.js → settings-layout-tNiJIWIn.js} +1 -1
  163. package/dist/client/assets/{settings-section-B5i82NgR.js → settings-section-8TfsFzZk.js} +1 -1
  164. package/dist/client/assets/{sheet-CCipW2FH.js → sheet-qXjZ6ijq.js} +1 -1
  165. package/dist/client/assets/{shell-controls-Ce5fzkhT.js → shell-controls-YPeEwMMG.js} +1 -1
  166. package/dist/client/assets/{shell-layout-CTQMbW4a.js → shell-layout-BZuowLaO.js} +1 -1
  167. package/dist/client/assets/{shell-route-loading-BwBOB-GI.js → shell-route-loading-DLvkliSc.js} +1 -1
  168. package/dist/client/assets/{sidebar-vUZgGPF7.js → sidebar-DV_8rP5O.js} +1 -1
  169. package/dist/client/assets/{skeleton-DWiCZKLu.js → skeleton-BAqUrlIk.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-B_SnIoCf.js → sortable.esm-CwxymQUp.js} +1 -1
  171. package/dist/client/assets/{spinner-Cf-IAzXM.js → spinner-BNJ1ntL6.js} +1 -1
  172. package/dist/client/assets/{sso-BVINRo2Z.js → sso-d2lJzN6l.js} +1 -1
  173. package/dist/client/assets/{store-BW1GY6_F.js → store-BnlTxhhC.js} +1 -1
  174. package/dist/client/assets/store-registry-BFDp8lS0.js +2 -0
  175. package/dist/client/assets/{studio-tools-LMNN2joX.js → studio-tools-VmDH_tkD.js} +1 -1
  176. package/dist/client/assets/{switch-DJP3r5vJ.js → switch-BLdRz6LH.js} +1 -1
  177. package/dist/client/assets/{tab-id-ByXHuOlI.js → tab-id-BuwvvoKA.js} +1 -1
  178. package/dist/client/assets/{table-B2KlLYRM.js → table-DLTcBxkL.js} +1 -1
  179. package/dist/client/assets/{tabs-V4XsHC7f.js → tabs-BfsyXeV7.js} +1 -1
  180. package/dist/client/assets/{task-status-CEXxjU1X.js → task-status-BebHkyud.js} +1 -1
  181. package/dist/client/assets/{textarea-Bc-j0SM5.js → textarea-DOxc062C.js} +1 -1
  182. package/dist/client/assets/{toggle-group-COWeQ2c6.js → toggle-group-CUnJVdhY.js} +1 -1
  183. package/dist/client/assets/{toolbar-PSYvcVzm.js → toolbar-C-goTyi1.js} +1 -1
  184. package/dist/client/assets/{tools-list-DTOKH1D-.js → tools-list-BMPh17xT.js} +1 -1
  185. package/dist/client/assets/{tooltip-B5iep7Ko.js → tooltip-AlbIxSnB.js} +1 -1
  186. package/dist/client/assets/{types-BAMtYEey.js → types-B6A14fRD.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-DzrkIvyk.js → use-ai-providers-Bm_rqURb.js} +1 -1
  188. package/dist/client/assets/{use-automations-tXwjiHAc.js → use-automations-BGZXYpIN.js} +1 -1
  189. package/dist/client/assets/{use-capability-DXVx5Xxx.js → use-capability-JDGz96yw.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-BDCCVICH.js → use-clock-tick-ApetjkK0.js} +1 -1
  191. package/dist/client/assets/{use-collections-DxiinEjJ.js → use-collections-X9suE0Rz.js} +1 -1
  192. package/dist/client/assets/{use-connection-7gOEmOWX.js → use-connection-H42b0qTa.js} +1 -1
  193. package/dist/client/assets/{use-copy-CRVb47fM.js → use-copy-Ch4eJC6W.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-CjtM4q6t.js → use-create-virtual-mcp-BiMPRmS0.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-DeRUhFjV.js → use-debounced-autosave-bupcMtLI.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-CKkxX1yi.js → use-delete-connection--wxVFqSC.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-DihB1CSn.js → use-file-configs-B-TRPlGa.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-D1XgBgMg.js → use-infinite-scroll-CD71xyIK.js} +1 -1
  199. package/dist/client/assets/{use-list-state-CqG6kyCV.js → use-list-state-7-M0Oy-p.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-CrjmswbX.js → use-mcp-client-DVIPuDIp.js} +1 -1
  201. package/dist/client/assets/{use-mcp-prompts-CcgUU2va.js → use-mcp-prompts-Cc0asrBz.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-SSgHcUph.js → use-mcp-tools-Ce2De-n9.js} +1 -1
  203. package/dist/client/assets/{use-members-7_urfNyQ.js → use-members-1AkYrlKa.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-BkTVNUaN.js → use-navigate-to-agent-BIO7CjS7.js} +1 -1
  205. package/dist/client/assets/{use-org-auth-client-45Kq_uI1.js → use-org-auth-client-Dd-mOXzl.js} +1 -1
  206. package/dist/client/assets/{use-org-sso-gUWGH-aK.js → use-org-sso-DGDlZviB.js} +1 -1
  207. package/dist/client/assets/{use-organization-roles-lBuv_PBX.js → use-organization-roles-CjQiMsg2.js} +1 -1
  208. package/dist/client/assets/{use-organization-settings-CNaysSS7.js → use-organization-settings-DVnlfq4p.js} +1 -1
  209. package/dist/client/assets/use-registry-connections-DhiOfiCw.js +1 -0
  210. package/dist/client/assets/{use-secrets-CFUYkFk-.js → use-secrets-BiDXoWq-.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-B3I8SIeo.js → use-status-sounds--1cQ7Gwq.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-Br-x5WnV.js → use-view-mode-Bc8_FKXN.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-YDOoOiIE.js → use-virtual-mcp-D9H9aNMJ.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-DBPdoIhC.js +1 -0
  215. package/dist/client/assets/{useRouterState-B-4iWxA3.js → useRouterState-Ba9Tqr45.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-BGLS34hq.js +1 -0
  217. package/dist/client/assets/{user-XzqpqM8M.js → user-CfS8x4lp.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-EHbZdESt.js → view-mode-toggle-DaV2KCBn.js} +1 -1
  219. package/dist/client/assets/{watch-sse-pool-B2UHmnkn.js → watch-sse-pool-CbLJ0uWL.js} +1 -1
  220. package/dist/client/assets/{workflow-BvCi7RsT.js → workflow-BwGcPmPE.js} +1 -1
  221. package/dist/client/assets/workflow-detail-CYjYJeGk.js +1 -0
  222. package/dist/client/index.html +1 -1
  223. package/dist/server/cli.js +425 -425
  224. package/dist/server/server.js +256 -256
  225. package/package.json +1 -1
  226. package/dist/client/assets/agent-capabilities-DYA4_FQC.js +0 -3
  227. package/dist/client/assets/app-editor-BHLxWfgZ.js +0 -1
  228. package/dist/client/assets/chat-context-CD2JvZDF.js +0 -21
  229. package/dist/client/assets/connect-desktop-dialog-SmaY4SKp.js +0 -1
  230. package/dist/client/assets/decopilot-sse-pool-BXXKMHET.js +0 -1
  231. package/dist/client/assets/index-DRHoPy-V.js +0 -1
  232. package/dist/client/assets/page-seo-sheet-SyZrVZNj.js +0 -1
  233. package/dist/client/assets/project-app-view-BJauens7.js +0 -1
  234. package/dist/client/assets/record-editor-ZJ1XN9iZ.js +0 -1
  235. package/dist/client/assets/registry-BSzFy0xA.js +0 -2
  236. package/dist/client/assets/save-referenced-block-lBPwVOlw.js +0 -1
  237. package/dist/client/assets/store-registry-GHPfrbOP.js +0 -2
  238. package/dist/client/assets/use-registry-connections-CC5drynS.js +0 -1
  239. package/dist/client/assets/useInfiniteQuery-B4yLyRTD.js +0 -1
  240. package/dist/client/assets/useSuspenseInfiniteQuery-BfueowGJ.js +0 -1
  241. package/dist/client/assets/workflow-detail-BmwDA1AR.js +0 -1
@@ -1 +1 @@
1
- import{e as ne,r as ce,c as be,j as t,B as fe,K as xe,m as Ve,E as tt,p as st}from"./index-D7zMM4W4.js";import{u as ze}from"./useInfiniteQuery-B4yLyRTD.js";import{u as lt}from"./use-connection-7gOEmOWX.js";import{i as nt,g as at,a as rt,u as it}from"./use-mcp-client-CrjmswbX.js";import{a as ot}from"./use-virtual-mcp-YDOoOiIE.js";import{C as ct}from"./card-DdkEdLE9.js";import{a as Ke,b as qe,S as dt,d as mt}from"./sheet-CCipW2FH.js";import{c as Ge,d as He,a as Ne,e as se,b as Be,T as le}from"./table-B2KlLYRM.js";import{E as Se}from"./empty-state-DneBSEGo.js";import{u as ke}from"./use-infinite-scroll-D1XgBgMg.js";import{u as ut}from"./use-members-7_urfNyQ.js";import{S as ue}from"./task-status-CEXxjU1X.js";import{e as ft}from"./use-automations-tXwjiHAc.js";import{u as xt}from"./studio-tools-LMNN2joX.js";import{u as ht}from"./useSuspenseInfiniteQuery-BfueowGJ.js";import{B as je}from"./badge-CPbLyufC.js";import{S as gt,a as pt,b as jt,c as ge,d as bt}from"./select-BTJH3S1Y.js";import{C as Le}from"./checkbox-BC4wIenO.js";import{t as he}from"./ChevronDown-CibD7WLD.js";import{c as Nt,C as vt,e as Fe,d as St,a as yt,b as wt}from"./command-DTlk4TO1.js";import{a as Je,b as Qe,P as Ze}from"./popover-CGxVd8dj.js";import{A as We}from"./avatar-B0oOQW3w.js";import{n as ye}from"./ChevronUp-DGD0GGvF.js";import{n as Ie}from"./Container-u2OVN7H1.js";import{i as _t}from"./FilterLines-Ckb-C13v.js";import{m as Ct,n as Tt}from"./pair-DbqLAr7H.js";import{I as Pe}from"./integration-icon-CBAKG0Pi.js";function Ue(l){const e=ne.c(74),{options:s,onValueChange:n,defaultValue:r,placeholder:i,variant:a,animation:d,maxCount:c,modalPopover:o,asChild:j,className:N,disabled:v,onSearchChange:m}=l;let b;e[0]!==r?(b=r===void 0?[]:r,e[0]=r,e[1]=b):b=e[1];const x=b,p=i===void 0?"Select items":i,h=a===void 0?"default":a,u=d===void 0?0:d,S=c===void 0?3:c,f=o===void 0?!1:o,C=j===void 0?!1:j,w=v===void 0?!1:v,[g,y]=ce.useState(x),[T,_]=ce.useState(!1);let k,P;e[2]!==x||e[3]!==g?(k=()=>{JSON.stringify(g)!==JSON.stringify(x)&&y(x)},P=[x,g],e[2]=x,e[3]=g,e[4]=k,e[5]=P):(k=e[4],P=e[5]),ce.useEffect(k,P);let I;e[6]!==n||e[7]!==g?(I=$=>{if($.key==="Enter")_(!0);else if($.key==="Backspace"&&!$.currentTarget.value){const B=[...g];B.pop(),y(B),n(B)}},e[6]=n,e[7]=g,e[8]=I):I=e[8];const D=I;let M;e[9]!==n||e[10]!==g?(M=$=>{const B=g.includes($.value)?g.filter(me=>me!==$.value):[...g,$.value];y(B),n(B)},e[9]=n,e[10]=g,e[11]=M):M=e[11];const A=M;let L;e[12]!==n?(L=()=>{y([]),n([])},e[12]=n,e[13]=L):L=e[13];const K=L;let q;e[14]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{_(Mt)},e[14]=q):q=e[14];const Q=q;let J;e[15]!==K||e[16]!==n||e[17]!==s||e[18]!==g.length?(J=()=>{if(g.length===s.length)K();else{const $=s.map(Pt);y($),n($)}},e[15]=K,e[16]=n,e[17]=s,e[18]=g.length,e[19]=J):J=e[19];const E=J;let U;e[20]!==C?(U=C?{}:{variant:"outline"},e[20]=C,e[21]=U):U=e[21];let O;e[22]!==N?(O=be("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full max-w-xs items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 h-10 min-h-10",N),e[22]=N,e[23]=O):O=e[23];let V;e[24]!==u||e[25]!==S||e[26]!==s||e[27]!==p||e[28]!==g||e[29]!==h?(V=g.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[g.slice(0,S).map($=>{const B=s.find(ve=>ve.value===$),me=B?.icon;return t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${u}s`},children:[me&&t.jsx(me,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:B?.label})]},$)}),g.length>S&&t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${u}s`},children:["+",g.length-S]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(he,{size:20,className:"shrink-0 opacity-50"})})]}):t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:p}),t.jsx(he,{size:20,className:"shrink-0 opacity-50"})]}),e[24]=u,e[25]=S,e[26]=s,e[27]=p,e[28]=g,e[29]=h,e[30]=V):V=e[30];let F;e[31]!==w||e[32]!==U||e[33]!==O||e[34]!==V?(F=t.jsx(Je,{asChild:!0,children:t.jsx(fe,{ref:null,...U,onClick:Q,className:O,disabled:w,children:V})}),e[31]=w,e[32]=U,e[33]=O,e[34]=V,e[35]=F):F=e[35];let G;e[36]===Symbol.for("react.memo_cache_sentinel")?(G=()=>_(!1),e[36]=G):G=e[36];const X=!m;let z;e[37]!==D||e[38]!==m?(z=t.jsx(Nt,{placeholder:"Search...",onKeyDown:D,onValueChange:m,className:"rounded-t-xl"}),e[37]=D,e[38]=m,e[39]=z):z=e[39];let ee;e[40]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(vt,{children:"No results found."}),e[40]=ee):ee=e[40];let te;e[41]!==E?(te=()=>{E()},e[41]=E,e[42]=te):te=e[42];let Z;e[43]!==E?(Z=$=>{$.stopPropagation(),E()},e[43]=E,e[44]=Z):Z=e[44];const de=g.length===s.length&&s.length>0;let ae;e[45]!==de||e[46]!==E?(ae=t.jsx(Le,{checked:de,onCheckedChange:E,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:It}),e[45]=de,e[46]=E,e[47]=ae):ae=e[47];let re;e[48]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx("span",{children:"(Select All)"}),e[48]=re):re=e[48];let W;e[49]!==Z||e[50]!==ae?(W=t.jsxs("div",{className:"flex items-center w-full",onClick:Z,children:[ae,re]}),e[49]=Z,e[50]=ae,e[51]=W):W=e[51];let Y;e[52]!==te||e[53]!==W?(Y=t.jsx(Fe,{onSelect:te,className:"cursor-pointer",children:W},"all"),e[52]=te,e[53]=W,e[54]=Y):Y=e[54];let ie;if(e[55]!==s||e[56]!==g||e[57]!==A){let $;e[59]!==g||e[60]!==A?($=B=>{const me=g.includes(B.value);return t.jsx(Fe,{onSelect:()=>{A(B)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ve=>{ve.stopPropagation(),A(B)},children:[t.jsx(Le,{checked:me,onCheckedChange:()=>{A(B)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:kt}),B.icon&&t.jsx(B.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:B.label})]})},B.value)},e[59]=g,e[60]=A,e[61]=$):$=e[61],ie=s.map($),e[55]=s,e[56]=g,e[57]=A,e[58]=ie}else ie=e[58];let R;e[62]!==Y||e[63]!==ie?(R=t.jsxs(St,{className:"rounded-b-xl",children:[ee,t.jsxs(yt,{children:[Y,ie]})]}),e[62]=Y,e[63]=ie,e[64]=R):R=e[64];let H;e[65]!==X||e[66]!==z||e[67]!==R?(H=t.jsx(Qe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:G,children:t.jsxs(wt,{shouldFilter:X,className:"rounded-xl",children:[z,R]})}),e[65]=X,e[66]=z,e[67]=R,e[68]=H):H=e[68];let oe;return e[69]!==T||e[70]!==f||e[71]!==F||e[72]!==H?(oe=t.jsxs(Ze,{open:T,onOpenChange:_,modal:f,children:[F,H]}),e[69]=T,e[70]=f,e[71]=F,e[72]=H,e[73]=oe):oe=e[73],oe}function kt(l){return l.stopPropagation()}function It(l){return l.stopPropagation()}function Pt(l){return l.value}function Mt(l){return!l}const Ye=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],Dt=40;function Ts(l){const s=(l.endDate.getTime()-l.startDate.getTime())/Dt;return Ye.find(r=>r.ms>=s)?.label??"1d"}function Me(l){const e=Ye.find(i=>i.label===l);if(e)return e.ms;const s=/^(\d+)([mhd])$/.exec(l);if(!s)return 6e4;const n=parseInt(s[1],10),r=s[2];return r==="h"?n*36e5:r==="d"?n*864e5:n*6e4}function Rt(l,e){const s=new Date(l);return Me(e)>=864e5?s.toLocaleDateString([],{month:"short",day:"numeric"}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Oe(l,e){const s=Me(e);return new Date(Math.floor(l.getTime()/s)*s)}function At(l){return l>=1e4?`${(l/1e3).toFixed(1)}s`:`${Math.round(l)}ms`}function De(l){return Number.isFinite(l)?l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:Math.round(l).toLocaleString():"0"}function Re(l){return Number.isFinite(l)?`$${l.toFixed(l<1?4:2)}`:"$0.00"}function ks(l,e,s){const n=Me(s),r=Oe(e.startDate,s).getTime(),i=e.endDate.getTime(),a=new Map(l.map(c=>[Oe(new Date(c.timestamp),s).getTime(),c])),d=[];for(let c=r;c<=i;c+=n){const o=a.get(c),j=new Date(c).toISOString();d.push({t:j,ts:c,label:Rt(j,s),calls:o?.calls??0,errors:o?.errors??0,errorRate:o?.errorRate??0,avg:o?.avg??0,p50:o?.p50??0,p95:o?.p95??0,inputTokens:o?.inputTokens??0,outputTokens:o?.outputTokens??0,totalTokens:o?.totalTokens??0,costUsd:o?.costUsd??0})}return d}function Is(l,e){return e==="requests"?l.calls:e==="errors"?l.errorRate:l.avgDurationMs}function Ps(l,e){return e==="requests"?l.calls.toLocaleString():e==="errors"?`${l.errorRate.toFixed(1)}%`:At(l.avgDurationMs)}function Ae(l){return(l.run_config??{}).agent?.id??(l.virtual_mcp_id||null)}function Ee(l,e,s,n){if(!l)return n;const r=e.find(a=>a.id===l)??s?.find(a=>a.id===l);if(r?.title)return r.title;const i=nt(l);return i?at(i).title??n:l}function $e(l,e,s){return l?(e.find(r=>r.id===l)??s?.find(r=>r.id===l))?.icon??null:null}function Xe(l){return l?.data?.members??[]}function we(l){const e=ne.c(33),{thread:s,connections:n,virtualMcps:r,selectedIndex:i,total:a,onPrev:d,onNext:c}=l;let o,j;if(e[0]!==n||e[1]!==s||e[2]!==r){const k=Ae(s);o=Ee(k,r,n,""),j=$e(k,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j,v=o||s.title;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{}),e[5]=m):m=e[5];let b;e[6]!==N||e[7]!==v?(b=t.jsx(Pe,{icon:N,name:v,size:"sm",fallbackIcon:m,className:"shadow-sm shrink-0 rounded-md"}),e[6]=N,e[7]=v,e[8]=b):b=e[8];let x;e[9]!==s.title?(x=t.jsx(dt,{className:"text-sm leading-snug truncate",children:s.title}),e[9]=s.title,e[10]=x):x=e[10];let p;e[11]!==o?(p=o&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:o}),e[11]=o,e[12]=p):p=e[12];let h;e[13]!==x||e[14]!==p?(h=t.jsxs("div",{className:"min-w-0",children:[x,p]}),e[13]=x,e[14]=p,e[15]=h):h=e[15];let u;e[16]!==b||e[17]!==h?(u=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[b,h]}),e[16]=b,e[17]=h,e[18]=u):u=e[18];const S=i===0;let f;e[19]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ye,{size:14}),e[19]=f):f=e[19];let C;e[20]!==d||e[21]!==S?(C=t.jsx(fe,{size:"icon",variant:"ghost",onClick:d,disabled:S,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous thread",children:f}),e[20]=d,e[21]=S,e[22]=C):C=e[22];const w=i===a-1;let g;e[23]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(he,{size:14}),e[23]=g):g=e[23];let y;e[24]!==c||e[25]!==w?(y=t.jsx(fe,{size:"icon",variant:"ghost",onClick:c,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":"Next thread",children:g}),e[24]=c,e[25]=w,e[26]=y):y=e[26];let T;e[27]!==C||e[28]!==y?(T=t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C,y]}),e[27]=C,e[28]=y,e[29]=T):T=e[29];let _;return e[30]!==T||e[31]!==u?(_=t.jsx(mt,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[u,T]})}),e[30]=T,e[31]=u,e[32]=_):_=e[32],_}function Et(l){const e=ne.c(48),{thread:s,connections:n,virtualMcps:r,members:i}=l;let a,d;if(e[0]!==n||e[1]!==s||e[2]!==r){const M=Ae(s);a=Ee(M,r,n,""),d=$e(M,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=a,e[4]=d}else a=e[3],d=e[4];const c=d;let o;if(e[5]!==i||e[6]!==s.created_by){const M=Xe(i);let A;e[8]!==s.created_by?(A=L=>L.userId===s.created_by,e[8]=s.created_by,e[9]=A):A=e[9],o=M.find(A),e[5]=i,e[6]=s.created_by,e[7]=o}else o=e[7];const j=o;let N;e[10]!==j?.user.email||e[11]!==j?.user.name||e[12]!==s.created_by?(N=j?.user.name??j?.user.email??s.created_by?.substring(0,8)??"—",e[10]=j?.user.email,e[11]=j?.user.name,e[12]=s.created_by,e[13]=N):N=e[13];const v=N,m=j?.user.image??void 0;let b;e[14]!==s.created_at?(b=new Date(s.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=s.created_at,e[15]=b):b=e[15];const x=b,p=ue[s.status]??ue.completed,h=p.icon;let u;e[16]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=u):u=e[16];let S;e[17]!==h||e[18]!==p.iconClassName?(S=t.jsx(h,{size:13,className:p.iconClassName}),e[17]=h,e[18]=p.iconClassName,e[19]=S):S=e[19];let f;e[20]!==p.labelColor?(f=be("text-sm",p.labelColor),e[20]=p.labelColor,e[21]=f):f=e[21];let C;e[22]!==p.label||e[23]!==f?(C=t.jsx("span",{className:f,children:p.label}),e[22]=p.label,e[23]=f,e[24]=C):C=e[24];let w;e[25]!==S||e[26]!==C?(w=t.jsxs("div",{children:[u,t.jsxs("div",{className:"flex items-center gap-1.5",children:[S,C]})]}),e[25]=S,e[26]=C,e[27]=w):w=e[27];let g;e[28]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=g):g=e[28];let y;e[29]!==x?(y=t.jsxs("div",{children:[g,t.jsx("div",{className:"text-sm text-foreground",children:x})]}),e[29]=x,e[30]=y):y=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"User"}),e[31]=T):T=e[31];let _;e[32]!==m||e[33]!==v?(_=t.jsx(We,{url:m,fallback:v,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=m,e[33]=v,e[34]=_):_=e[34];let k;e[35]!==v?(k=t.jsx("span",{className:"text-sm text-foreground",children:v}),e[35]=v,e[36]=k):k=e[36];let P;e[37]!==_||e[38]!==k?(P=t.jsxs("div",{children:[T,t.jsxs("div",{className:"flex items-center gap-2",children:[_,k]})]}),e[37]=_,e[38]=k,e[39]=P):P=e[39];let I;e[40]!==c||e[41]!==a?(I=a&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Agent"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Pe,{icon:c,name:a,size:"xs",fallbackIcon:t.jsx(Ie,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),t.jsx("span",{className:"text-sm text-foreground",children:a})]})]}),e[40]=c,e[41]=a,e[42]=I):I=e[42];let D;return e[43]!==y||e[44]!==P||e[45]!==I||e[46]!==w?(D=t.jsxs("div",{className:"px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm",children:[w,y,P,I]}),e[43]=y,e[44]=P,e[45]=I,e[46]=w,e[47]=D):D=e[47],D}function $t(l){const e=ne.c(72),{thread:s,usage:n,members:r,connections:i,virtualMcps:a,onClick:d,lastRowRef:c}=l;let o,j;if(e[0]!==i||e[1]!==s||e[2]!==a){const F=Ae(s);o=Ee(F,a,i,"—"),j=$e(F,a,i),e[0]=i,e[1]=s,e[2]=a,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j;let v;if(e[5]!==r||e[6]!==s.created_by){const F=Xe(r);let G;e[8]!==s.created_by?(G=X=>X.userId===s.created_by,e[8]=s.created_by,e[9]=G):G=e[9],v=F.find(G),e[5]=r,e[6]=s.created_by,e[7]=v}else v=e[7];const m=v;let b;e[10]!==m?.user.email||e[11]!==m?.user.name||e[12]!==s.created_by?(b=m?.user.name??m?.user.email??s.created_by?.substring(0,8)??"—",e[10]=m?.user.email,e[11]=m?.user.name,e[12]=s.created_by,e[13]=b):b=e[13];const x=b,p=m?.user.image??void 0;let h,u;if(e[14]!==s.created_at){const F=new Date(s.created_at);h=F.toLocaleDateString("en-US",{month:"short",day:"numeric"}),u=F.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=s.created_at,e[15]=h,e[16]=u}else h=e[15],u=e[16];const S=u,f=ue[s.status]??ue.completed,C=f.icon;let w;e[17]!==s.title?(w=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[17]=s.title,e[18]=w):w=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Ie,{}),e[19]=g):g=e[19];let y;e[20]!==N||e[21]!==o?(y=t.jsx(Pe,{icon:N,name:o,size:"xs",fallbackIcon:g,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=N,e[21]=o,e[22]=y):y=e[22];let T;e[23]!==o?(T=t.jsx("span",{className:"truncate",children:o}),e[23]=o,e[24]=T):T=e[24];let _;e[25]!==y||e[26]!==T?(_=t.jsx(le,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,T]})}),e[25]=y,e[26]=T,e[27]=_):_=e[27];let k;e[28]!==p||e[29]!==x?(k=t.jsx(We,{url:p,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=p,e[29]=x,e[30]=k):k=e[30];let P;e[31]!==x?(P=t.jsx("span",{className:"truncate",children:x}),e[31]=x,e[32]=P):P=e[32];let I;e[33]!==k||e[34]!==P?(I=t.jsx(le,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[k,P]})}),e[33]=k,e[34]=P,e[35]=I):I=e[35];let D;e[36]!==C||e[37]!==f.iconClassName?(D=t.jsx(C,{size:14,className:f.iconClassName}),e[36]=C,e[37]=f.iconClassName,e[38]=D):D=e[38];let M;e[39]!==f.labelColor?(M=be("text-sm",f.labelColor),e[39]=f.labelColor,e[40]=M):M=e[40];let A;e[41]!==f.label||e[42]!==M?(A=t.jsx("span",{className:M,children:f.label}),e[41]=f.label,e[42]=M,e[43]=A):A=e[43];let L;e[44]!==D||e[45]!==A?(L=t.jsx(le,{className:"w-24 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[D,A]})}),e[44]=D,e[45]=A,e[46]=L):L=e[46];let K;e[47]!==n?(K=n?De(n.totalTokens):"—",e[47]=n,e[48]=K):K=e[48];let q;e[49]!==K?(q=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:K}),e[49]=K,e[50]=q):q=e[50];let Q;e[51]!==n?(Q=n&&n.costUsd>0?Re(n.costUsd):"—",e[51]=n,e[52]=Q):Q=e[52];let J;e[53]!==Q?(J=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:Q}),e[53]=Q,e[54]=J):J=e[54];let E;e[55]!==h?(E=t.jsx("div",{children:h}),e[55]=h,e[56]=E):E=e[56];let U;e[57]!==S?(U=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=U):U=e[58];let O;e[59]!==E||e[60]!==U?(O=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[E,U]}),e[59]=E,e[60]=U,e[61]=O):O=e[61];let V;return e[62]!==c||e[63]!==d||e[64]!==I||e[65]!==L||e[66]!==q||e[67]!==J||e[68]!==O||e[69]!==w||e[70]!==_?(V=t.jsxs(Ne,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:d,children:[w,_,I,L,q,J,O]}),e[62]=c,e[63]=d,e[64]=I,e[65]=L,e[66]=q,e[67]=J,e[68]=O,e[69]=w,e[70]=_,e[71]=V):V=e[71],V}const _e=100;function Lt(l){const e=ne.c(37),{client:s,locator:n,thread:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==n||e[1]!==r.id?(v=xe.threadMessages(n,r.id),e[0]=n,e[1]=r.id,e[2]=v):v=e[2];let m;e[3]!==s||e[4]!==r.id?(m=async P=>{const{pageParam:I}=P,D=I===void 0?0:I;if(!s)throw new Error("MCP client is not available");const M=await s.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:r.id,limit:_e,offset:D}});return M.structuredContent??M},e[3]=s,e[4]=r.id,e[5]=m):m=e[5];let b;e[6]!==v||e[7]!==m?(b={queryKey:v,queryFn:m,initialPageParam:0,getNextPageParam:Ot,staleTime:6e4},e[6]=v,e[7]=m,e[8]=b):b=e[8];const{data:x,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:u}=ht(b);let S;e[9]!==x.pages?(S=x.pages.flatMap(Ut).filter(Ft),e[9]=x.pages,e[10]=S):S=e[10];const f=S,C=Ct(f);let w;e[11]!==p||e[12]!==h||e[13]!==u?(w=()=>{h&&!u&&p()},e[11]=p,e[12]=h,e[13]=u,e[14]=w):w=e[14];const g=ke(w,h??!1,u);let y;e[15]!==i||e[16]!==N||e[17]!==j||e[18]!==c||e[19]!==r||e[20]!==o||e[21]!==a?(y=t.jsx(we,{thread:r,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[15]=i,e[16]=N,e[17]=j,e[18]=c,e[19]=r,e[20]=o,e[21]=a,e[22]=y):y=e[22];let T;e[23]!==i||e[24]!==d||e[25]!==r||e[26]!==a?(T=t.jsx(Et,{thread:r,connections:i,virtualMcps:a,members:d}),e[23]=i,e[24]=d,e[25]=r,e[26]=a,e[27]=T):T=e[27];let _;e[28]!==u||e[29]!==g||e[30]!==C||e[31]!==f.length?(_=f.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No messages in this thread"}):t.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:t.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[C.map((P,I)=>t.jsx("div",{ref:I===C.length-1?g:void 0,children:t.jsx(Tt,{pair:P,isLastPair:I===C.length-1,status:"ready"})},`pair-${P.user?.id??P.assistant?.id}`)),u&&t.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=u,e[29]=g,e[30]=C,e[31]=f.length,e[32]=_):_=e[32];let k;return e[33]!==y||e[34]!==T||e[35]!==_?(k=t.jsxs(t.Fragment,{children:[y,T,_]}),e[33]=y,e[34]=T,e[35]=_,e[36]=k):k=e[36],k}function Ft(l){return l.role==="user"||l.role==="assistant"}function Ut(l){return l.items??[]}function Ot(l,e){const s=l,n=e;if(!((s?.items?.length??0)<_e))return n.length*_e}function et(l){const e=ne.c(39),{thread:s,client:n,locator:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==i||e[1]!==N||e[2]!==j||e[3]!==c||e[4]!==s||e[5]!==o||e[6]!==a?(v=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[0]=i,e[1]=N,e[2]=j,e[3]=c,e[4]=s,e[5]=o,e[6]=a,e[7]=v):v=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=m):m=e[8];let b;e[9]!==v?(b=t.jsxs(t.Fragment,{children:[v,m]}),e[9]=v,e[10]=b):b=e[10];let x;e[11]!==i||e[12]!==N||e[13]!==j||e[14]!==c||e[15]!==s||e[16]!==o||e[17]!==a?(x=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[11]=i,e[12]=N,e[13]=j,e[14]=c,e[15]=s,e[16]=o,e[17]=a,e[18]=x):x=e[18];let p;e[19]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Loading conversation\\u2026"}),e[19]=p):p=e[19];let h;e[20]!==x?(h=t.jsxs(t.Fragment,{children:[x,p]}),e[20]=x,e[21]=h):h=e[21];let u;e[22]!==n||e[23]!==i||e[24]!==r||e[25]!==d||e[26]!==N||e[27]!==j||e[28]!==c||e[29]!==s||e[30]!==o||e[31]!==a?(u=t.jsx(Lt,{client:n,locator:r,thread:s,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[22]=n,e[23]=i,e[24]=r,e[25]=d,e[26]=N,e[27]=j,e[28]=c,e[29]=s,e[30]=o,e[31]=a,e[32]=u):u=e[32];let S;e[33]!==h||e[34]!==u?(S=t.jsx(ce.Suspense,{fallback:h,children:u}),e[33]=h,e[34]=u,e[35]=S):S=e[35];let f;return e[36]!==b||e[37]!==S?(f=t.jsx(tt,{fallback:b,children:S}),e[36]=b,e[37]=S,e[38]=f):f=e[38],f}function Ms(l){const e=ne.c(43),{filterAgentIds:s,filterUserIds:n,filterStatus:r,virtualMcpOptions:i,memberOptions:a,activeFiltersCount:d,onUpdateFilters:c}=l,[o,j]=ce.useState(!1);let N,v;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(_t,{size:16}),v=t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e[0]=N,e[1]=v):(N=e[0],v=e[1]);let m;e[2]!==d?(m=d>0&&t.jsxs(t.Fragment,{children:[t.jsx(je,{variant:"default",className:"sm:hidden absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:d}),t.jsx(je,{variant:"default",className:"hidden sm:flex ml-1 h-5 w-5 rounded-full p-0 items-center justify-center text-xs",children:d})]}),e[2]=d,e[3]=m):m=e[3];let b;e[4]!==m?(b=t.jsx(Je,{asChild:!0,children:t.jsxs(fe,{variant:"outline",className:"relative",children:[N,v,m]})}),e[4]=m,e[5]=b):b=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"font-medium text-sm",children:"Filter Threads"}),e[6]=x):x=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Agent"}),e[7]=p):p=e[7];let h;e[8]!==c?(h=M=>c({filterAgentIds:M.slice(0,1)}),e[8]=c,e[9]=h):h=e[9];let u;e[10]!==s||e[11]!==h||e[12]!==i?(u=t.jsxs("div",{children:[p,t.jsx(Ue,{options:i,defaultValue:s,onValueChange:h,placeholder:"All agents",variant:"secondary",className:"w-full",maxCount:1})]}),e[10]=s,e[11]=h,e[12]=i,e[13]=u):u=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"User"}),e[14]=S):S=e[14];let f;e[15]!==c?(f=M=>c({filterUserIds:M.slice(0,1)}),e[15]=c,e[16]=f):f=e[16];let C;e[17]!==n||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{children:[S,t.jsx(Ue,{options:a,defaultValue:n,onValueChange:f,placeholder:"All users",variant:"secondary",className:"w-full",maxCount:1})]}),e[17]=n,e[18]=a,e[19]=f,e[20]=C):C=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Status"}),e[21]=w):w=e[21];let g;e[22]!==c?(g=M=>c({filterStatus:M}),e[22]=c,e[23]=g):g=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(gt,{className:"w-full",children:t.jsx(pt,{})}),e[24]=y):y=e[24];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(jt,{children:[t.jsx(ge,{value:"all",children:"All statuses"}),t.jsx(ge,{value:"completed",children:"Completed"}),t.jsx(ge,{value:"active",children:"Active"}),t.jsx(ge,{value:"failed",children:"Failed"})]}),e[25]=T):T=e[25];let _;e[26]!==r||e[27]!==g?(_=t.jsxs("div",{children:[w,t.jsxs(bt,{value:r,onValueChange:g,children:[y,T]})]}),e[26]=r,e[27]=g,e[28]=_):_=e[28];let k;e[29]!==C||e[30]!==_||e[31]!==u?(k=t.jsxs("div",{className:"space-y-3",children:[u,C,_]}),e[29]=C,e[30]=_,e[31]=u,e[32]=k):k=e[32];let P;e[33]!==d||e[34]!==c?(P=d>0&&t.jsx(fe,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{c({filterAgentIds:[],filterUserIds:[],filterStatus:"all"}),j(!1)},children:"Clear all filters"}),e[33]=d,e[34]=c,e[35]=P):P=e[35];let I;e[36]!==k||e[37]!==P?(I=t.jsx(Qe,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[x,k,P]})}),e[36]=k,e[37]=P,e[38]=I):I=e[38];let D;return e[39]!==o||e[40]!==I||e[41]!==b?(D=t.jsxs(Ze,{open:o,onOpenChange:j,children:[b,I]}),e[39]=o,e[40]=I,e[41]=b,e[42]=D):D=e[42],D}const Ce=50;function Ds(l){const e=ne.c(29),{client:s,locator:n,membersData:r,allConnections:i,allVirtualMcps:a,dateRange:d,searchQuery:c,filterAgentIds:o,filterUserIds:j,filterStatus:N}=l,[v,m]=ce.useState(null),b=d.startDate.toISOString(),x=d.endDate.toISOString(),p=JSON.stringify({startDate:b,endDate:x,search:c,agentIds:o,userIds:j,status:N}),{data:h,fetchNextPage:u,hasNextPage:S,isFetchingNextPage:f,isLoading:C}=ze({queryKey:xe.threadsInfinite(n,p),queryFn:async R=>{const{pageParam:H}=R,oe=H===void 0?0:H;if(!s)throw new Error("MCP client is not available");const $=await s.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Ce,offset:oe,startDate:b,endDate:x,...c?{search:c}:{},...o&&o.length>0?{agentId:o[0]}:{},...j&&j.length>0?{userId:j[0]}:{},...N&&N!=="all"?{status:N}:{}}});return $.structuredContent??$},initialPageParam:0,getNextPageParam:Ht,staleTime:3e4}),w=(h?.pages??[]).flatMap(Gt),g=w.map(qt),{data:y}=Ve({queryKey:xe.monitoringThreadUsage(n,JSON.stringify({ids:g,startDate:b,endDate:x})),queryFn:async()=>{if(!s)throw new Error("MCP client is not available");const R=await s.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:g,startDate:b,endDate:x}});return R.structuredContent??R},enabled:!!s&&g.length>0,staleTime:3e4}),T=new Map((y?.items??[]).map(Kt)),[_,k]=ce.useState(null),[P,I]=ce.useState("desc");let D;e[0]!==_?(D=R=>{_===R?I(zt):(k(R),I("desc"))},e[0]=_,e[1]=D):D=e[1];const M=D,A=R=>{const H=T.get(R);return H?_==="cost"?H.costUsd:H.totalTokens:0},L=_?[...w].sort((R,H)=>{const oe=A(R.id),$=A(H.id);return P==="desc"?$-oe:oe-$}):w,K=v!==null?L[v]??null:null;let q;e[2]!==u||e[3]!==S||e[4]!==f?(q=()=>{S&&!f&&u()},e[2]=u,e[3]=S,e[4]=f,e[5]=q):q=e[5];const J=ke(q,S??!1,f),E=!!c||(o?.length??0)>0||(j?.length??0)>0||N&&N!=="all";let U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=()=>m(Vt),e[6]=U):U=e[6];const O=U,V=()=>m(R=>R!==null&&R<L.length-1?R+1:R),F="flex-1 flex flex-col overflow-auto min-w-0",G="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",X="flex-1 flex flex-col min-w-0",z="flex-1 min-w-0 pt-1",ee="min-w-0",te=C?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})}):w.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Se,{title:E?"No matching threads":"No threads in this time range",description:E?"Try adjusting your filters or search query.":"Try expanding the time range to see older threads."})}):t.jsxs(t.Fragment,{children:[t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0 z-20",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),t.jsx(se,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Tokens",_==="tokens"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Cost",_==="cost"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Date"})]})}),t.jsx(Be,{children:L.map((R,H)=>t.jsx($t,{thread:R,usage:T.get(R.id),members:r,connections:i,virtualMcps:a,onClick:()=>m(H),lastRowRef:H===L.length-1?J:void 0},R.id))})]}),f&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let Z;e[7]!==te?(Z=t.jsx("div",{className:G,children:t.jsx("div",{className:X,children:t.jsx("div",{className:z,children:t.jsx("div",{className:ee,children:te})})})}),e[7]=te,e[8]=Z):Z=e[8];const de=v!==null;let ae;e[9]===Symbol.for("react.memo_cache_sentinel")?(ae=R=>{R||m(null)},e[9]=ae):ae=e[9];let re;e[10]!==i||e[11]!==a||e[12]!==s||e[13]!==L||e[14]!==V||e[15]!==O||e[16]!==n||e[17]!==r||e[18]!==K||e[19]!==v?(re=K&&v!==null&&t.jsx(et,{thread:K,client:s,locator:n,connections:i,virtualMcps:a,members:r,selectedIndex:v,total:L.length,onPrev:O,onNext:V}),e[10]=i,e[11]=a,e[12]=s,e[13]=L,e[14]=V,e[15]=O,e[16]=n,e[17]=r,e[18]=K,e[19]=v,e[20]=re):re=e[20];let W;e[21]!==re?(W=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:re}),e[21]=re,e[22]=W):W=e[22];let Y;e[23]!==de||e[24]!==W?(Y=t.jsx(qe,{open:de,onOpenChange:ae,children:W}),e[23]=de,e[24]=W,e[25]=Y):Y=e[25];let ie;return e[26]!==Z||e[27]!==Y?(ie=t.jsxs("div",{className:F,children:[Z,Y]}),e[26]=Z,e[27]=Y,e[28]=ie):ie=e[28],ie}function Vt(l){return l!==null&&l>0?l-1:l}function zt(l){return l==="desc"?"asc":"desc"}function Kt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function qt(l){return l.id}function Gt(l){return l.items??[]}function Ht(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Ce))return n.length*Ce}const Te=50;function pe(l){const e=ne.c(10),{title:s,value:n,subtitle:r}=l;let i;e[0]!==s?(i=t.jsx("span",{className:"text-sm text-foreground/70",children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=t.jsx("span",{className:"text-3xl font-normal tabular-nums",children:n}),e[2]=n,e[3]=a):a=e[3];let d;e[4]!==r?(d=r&&t.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==d?(c=t.jsxs(ct,{className:"pt-4 px-4 pb-5 gap-1",children:[i,a,d]}),e[6]=i,e[7]=a,e[8]=d,e[9]=c):c=e[9],c}function Bt(l){const e=ne.c(27),{automationId:s,range:n}=l,{data:r,isLoading:i}=ft(s,n),a=r?.runs,d=r?.usage;let c;e[0]!==a?(c=a&&a.total>0?`${Math.round(a.completed/a.total*100)}%`:"—",e[0]=a,e[1]=c):c=e[1];const o=c,j=d&&d.truncated?`last ${d.sampledRuns} runs`:void 0;let N;e[2]!==i||e[3]!==a?.total?(N=i?"…":a?.total.toLocaleString()??"0",e[2]=i,e[3]=a?.total,e[4]=N):N=e[4];const v=a?`${a.completed} ok · ${a.failed} failed${a.inProgress>0?` · ${a.inProgress} running`:""}`:void 0;let m;e[5]!==N||e[6]!==v?(m=t.jsx(pe,{title:"Runs",value:N,subtitle:v}),e[5]=N,e[6]=v,e[7]=m):m=e[7];const b=i?"…":o;let x;e[8]!==b?(x=t.jsx(pe,{title:"Success rate",value:b}),e[8]=b,e[9]=x):x=e[9];let p;e[10]!==i||e[11]!==d?.totalTokens?(p=i?"…":De(d?.totalTokens??0),e[10]=i,e[11]=d?.totalTokens,e[12]=p):p=e[12];let h;e[13]!==p||e[14]!==j?(h=t.jsx(pe,{title:"Tokens",value:p,subtitle:j}),e[13]=p,e[14]=j,e[15]=h):h=e[15];let u;e[16]!==i||e[17]!==d?(u=i?"…":d&&d.costUsd>0?Re(d.costUsd):"—",e[16]=i,e[17]=d,e[18]=u):u=e[18];let S;e[19]!==u||e[20]!==j?(S=t.jsx(pe,{title:"Cost",value:u,subtitle:j}),e[19]=u,e[20]=j,e[21]=S):S=e[21];let f;return e[22]!==S||e[23]!==m||e[24]!==x||e[25]!==h?(f=t.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[m,x,h,S]}),e[22]=S,e[23]=m,e[24]=x,e[25]=h,e[26]=f):f=e[26],f}function Jt(l){const e=ne.c(39),{run:s,usage:n,onClick:r,lastRowRef:i}=l;let a,d;if(e[0]!==s.created_at){const y=new Date(s.created_at);a=y.toLocaleDateString("en-US",{month:"short",day:"numeric"}),d=y.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=s.created_at,e[1]=a,e[2]=d}else a=e[1],d=e[2];const c=d,o=ue[s.status]??ue.completed,j=o.icon;let N;e[3]!==s.title?(N=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[3]=s.title,e[4]=N):N=e[4];let v;e[5]!==j||e[6]!==o.iconClassName?(v=t.jsx(j,{size:14,className:o.iconClassName}),e[5]=j,e[6]=o.iconClassName,e[7]=v):v=e[7];let m;e[8]!==o.labelColor?(m=be("text-sm",o.labelColor),e[8]=o.labelColor,e[9]=m):m=e[9];let b;e[10]!==o.label||e[11]!==m?(b=t.jsx("span",{className:m,children:o.label}),e[10]=o.label,e[11]=m,e[12]=b):b=e[12];let x;e[13]!==v||e[14]!==b?(x=t.jsx(le,{className:"w-28 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[v,b]})}),e[13]=v,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n?(p=n?De(n.totalTokens):"—",e[16]=n,e[17]=p):p=e[17];let h;e[18]!==p?(h=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:p}),e[18]=p,e[19]=h):h=e[19];let u;e[20]!==n?(u=n&&n.costUsd>0?Re(n.costUsd):"—",e[20]=n,e[21]=u):u=e[21];let S;e[22]!==u?(S=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:u}),e[22]=u,e[23]=S):S=e[23];let f;e[24]!==a?(f=t.jsx("div",{children:a}),e[24]=a,e[25]=f):f=e[25];let C;e[26]!==c?(C=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==C?(w=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[f,C]}),e[28]=f,e[29]=C,e[30]=w):w=e[30];let g;return e[31]!==i||e[32]!==r||e[33]!==S||e[34]!==w||e[35]!==N||e[36]!==x||e[37]!==h?(g=t.jsxs(Ne,{ref:i,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[N,x,h,S,w]}),e[31]=i,e[32]=r,e[33]=S,e[34]=w,e[35]=N,e[36]=x,e[37]=h,e[38]=g):g=e[38],g}function Rs(l){const e=ne.c(48),{automationId:s,triggerIds:n,range:r}=l,{org:i,locator:a}=st();let d;e[0]!==i.id||e[1]!==i.slug?(d={connectionId:rt,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=d):d=e[2];const c=it(d),o=xt(),j=lt(),N=ot(),{data:v}=ut(),[m,b]=ce.useState(null),x=n.length>0;let p;e[3]!==s||e[4]!==i.id||e[5]!==n?(p=xe.automationRuns(i.id,s,n),e[3]=s,e[4]=i.id,e[5]=n,e[6]=p):p=e[6];let h;e[7]!==o||e[8]!==n?(h=async z=>{const{pageParam:ee}=z,te=ee===void 0?0:ee;return await o.call("COLLECTION_THREADS_LIST",{limit:Te,offset:te,where:{trigger_ids:n}})},e[7]=o,e[8]=n,e[9]=h):h=e[9];let u;e[10]!==x||e[11]!==p||e[12]!==h?(u={queryKey:p,queryFn:h,initialPageParam:0,getNextPageParam:Xt,enabled:x,staleTime:3e4},e[10]=x,e[11]=p,e[12]=h,e[13]=u):u=e[13];const{data:S,fetchNextPage:f,hasNextPage:C,isFetchingNextPage:w,isLoading:g}=ze(u),y=(S?.pages??[]).flatMap(Yt),T=y.map(Wt),{data:_}=Ve({queryKey:xe.monitoringThreadUsage(a,JSON.stringify({ids:T,...r})),queryFn:async()=>await o.call("MONITORING_THREAD_USAGE",{threadIds:T,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}),enabled:T.length>0,staleTime:3e4});let k;e[14]!==_?.items?(k=new Map((_?.items??[]).map(Zt)),e[14]=_?.items,e[15]=k):k=e[15];const P=k;let I;e[16]!==f||e[17]!==C||e[18]!==w?(I=()=>{C&&!w&&f()},e[16]=f,e[17]=C,e[18]=w,e[19]=I):I=e[19];const D=ke(I,C??!1,w),M=m!==null?y[m]??null:null;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=()=>b(Qt),e[20]=A):A=e[20];const L=A,K=()=>b(z=>z!==null&&z<y.length-1?z+1:z),q="flex flex-col gap-5";let Q;e[21]!==s||e[22]!==r?(Q=t.jsx(Bt,{automationId:s,range:r}),e[21]=s,e[22]=r,e[23]=Q):Q=e[23];const J=x?g?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):y.length===0?t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No runs yet",description:"This automation hasn't run yet. Trigger it or wait for a starter to fire."})}):t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Started"})]})}),t.jsx(Be,{children:y.map((z,ee)=>t.jsx(Jt,{run:z,usage:P.get(z.id),onClick:()=>b(ee),lastRowRef:ee===y.length-1?D:void 0},z.id))})]}):t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No starters yet",description:"Add a starter (cron, event, or webhook) to start collecting runs."})});let E;e[24]!==w?(E=w&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=w,e[25]=E):E=e[25];const U=m!==null;let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=z=>{z||b(null)},e[26]=O):O=e[26];let V;e[27]!==j||e[28]!==N||e[29]!==c||e[30]!==K||e[31]!==L||e[32]!==a||e[33]!==v||e[34]!==y||e[35]!==M||e[36]!==m?(V=M&&m!==null&&t.jsx(et,{thread:M,client:c,locator:a,connections:j,virtualMcps:N,members:v,selectedIndex:m,total:y.length,onPrev:L,onNext:K}),e[27]=j,e[28]=N,e[29]=c,e[30]=K,e[31]=L,e[32]=a,e[33]=v,e[34]=y,e[35]=M,e[36]=m,e[37]=V):V=e[37];let F;e[38]!==V?(F=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:V}),e[38]=V,e[39]=F):F=e[39];let G;e[40]!==U||e[41]!==F?(G=t.jsx(qe,{open:U,onOpenChange:O,children:F}),e[40]=U,e[41]=F,e[42]=G):G=e[42];let X;return e[43]!==J||e[44]!==E||e[45]!==G||e[46]!==Q?(X=t.jsxs("div",{className:q,children:[Q,J,E,G]}),e[43]=J,e[44]=E,e[45]=G,e[46]=Q,e[47]=X):X=e[47],X}function Qt(l){return l!==null&&l>0?l-1:l}function Zt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Wt(l){return l.id}function Yt(l){return l.items??[]}function Xt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Te))return n.length*Te}export{Rs as A,Ue as M,Ms as T,Re as a,ks as b,At as c,Ps as d,Is as e,De as f,Ts as g,Xe as h,Ds as i};
1
+ import{e as ne,r as ce,c as be,j as t,B as fe,K as xe,m as Ve,E as tt,p as st}from"./index-DGGjIheX.js";import{u as ze}from"./useInfiniteQuery-DBPdoIhC.js";import{u as lt}from"./use-connection-H42b0qTa.js";import{i as nt,g as at,a as rt,u as it}from"./use-mcp-client-DVIPuDIp.js";import{a as ot}from"./use-virtual-mcp-D9H9aNMJ.js";import{C as ct}from"./card-CSrfjLPK.js";import{a as Ke,b as qe,S as dt,d as mt}from"./sheet-qXjZ6ijq.js";import{c as Ge,d as He,a as Ne,e as se,b as Be,T as le}from"./table-DLTcBxkL.js";import{E as Se}from"./empty-state-DAGj9d4y.js";import{u as ke}from"./use-infinite-scroll-CD71xyIK.js";import{u as ut}from"./use-members-1AkYrlKa.js";import{S as ue}from"./task-status-BebHkyud.js";import{e as ft}from"./use-automations-BGZXYpIN.js";import{u as xt}from"./studio-tools-VmDH_tkD.js";import{u as ht}from"./useSuspenseInfiniteQuery-BGLS34hq.js";import{B as je}from"./badge-8nbtF57a.js";import{S as gt,a as pt,b as jt,c as ge,d as bt}from"./select-DIImlu5H.js";import{C as Le}from"./checkbox-emZqfNka.js";import{t as he}from"./ChevronDown-DwPK2mcP.js";import{c as Nt,C as vt,e as Fe,d as St,a as yt,b as wt}from"./command-B9-QuD3I.js";import{a as Je,b as Qe,P as Ze}from"./popover-CCUenseZ.js";import{A as We}from"./avatar-CKQTxZ1l.js";import{n as ye}from"./ChevronUp-DNp3BStr.js";import{n as Ie}from"./Container-CwEfFXez.js";import{i as _t}from"./FilterLines-91VA8muG.js";import{m as Ct,n as Tt}from"./pair-nJ1ZiPVr.js";import{I as Pe}from"./integration-icon-DPU9dY8x.js";function Ue(l){const e=ne.c(74),{options:s,onValueChange:n,defaultValue:r,placeholder:i,variant:a,animation:d,maxCount:c,modalPopover:o,asChild:j,className:N,disabled:v,onSearchChange:m}=l;let b;e[0]!==r?(b=r===void 0?[]:r,e[0]=r,e[1]=b):b=e[1];const x=b,p=i===void 0?"Select items":i,h=a===void 0?"default":a,u=d===void 0?0:d,S=c===void 0?3:c,f=o===void 0?!1:o,C=j===void 0?!1:j,w=v===void 0?!1:v,[g,y]=ce.useState(x),[T,_]=ce.useState(!1);let k,P;e[2]!==x||e[3]!==g?(k=()=>{JSON.stringify(g)!==JSON.stringify(x)&&y(x)},P=[x,g],e[2]=x,e[3]=g,e[4]=k,e[5]=P):(k=e[4],P=e[5]),ce.useEffect(k,P);let I;e[6]!==n||e[7]!==g?(I=$=>{if($.key==="Enter")_(!0);else if($.key==="Backspace"&&!$.currentTarget.value){const B=[...g];B.pop(),y(B),n(B)}},e[6]=n,e[7]=g,e[8]=I):I=e[8];const D=I;let M;e[9]!==n||e[10]!==g?(M=$=>{const B=g.includes($.value)?g.filter(me=>me!==$.value):[...g,$.value];y(B),n(B)},e[9]=n,e[10]=g,e[11]=M):M=e[11];const A=M;let L;e[12]!==n?(L=()=>{y([]),n([])},e[12]=n,e[13]=L):L=e[13];const K=L;let q;e[14]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{_(Mt)},e[14]=q):q=e[14];const Q=q;let J;e[15]!==K||e[16]!==n||e[17]!==s||e[18]!==g.length?(J=()=>{if(g.length===s.length)K();else{const $=s.map(Pt);y($),n($)}},e[15]=K,e[16]=n,e[17]=s,e[18]=g.length,e[19]=J):J=e[19];const E=J;let U;e[20]!==C?(U=C?{}:{variant:"outline"},e[20]=C,e[21]=U):U=e[21];let O;e[22]!==N?(O=be("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full max-w-xs items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 h-10 min-h-10",N),e[22]=N,e[23]=O):O=e[23];let V;e[24]!==u||e[25]!==S||e[26]!==s||e[27]!==p||e[28]!==g||e[29]!==h?(V=g.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[g.slice(0,S).map($=>{const B=s.find(ve=>ve.value===$),me=B?.icon;return t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"max-w-24",style:{animationDuration:`${u}s`},children:[me&&t.jsx(me,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:B?.label})]},$)}),g.length>S&&t.jsxs(je,{variant:h==="default"?"default":"secondary",className:"flex-shrink-0",style:{animationDuration:`${u}s`},children:["+",g.length-S]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(he,{size:20,className:"shrink-0 opacity-50"})})]}):t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:p}),t.jsx(he,{size:20,className:"shrink-0 opacity-50"})]}),e[24]=u,e[25]=S,e[26]=s,e[27]=p,e[28]=g,e[29]=h,e[30]=V):V=e[30];let F;e[31]!==w||e[32]!==U||e[33]!==O||e[34]!==V?(F=t.jsx(Je,{asChild:!0,children:t.jsx(fe,{ref:null,...U,onClick:Q,className:O,disabled:w,children:V})}),e[31]=w,e[32]=U,e[33]=O,e[34]=V,e[35]=F):F=e[35];let G;e[36]===Symbol.for("react.memo_cache_sentinel")?(G=()=>_(!1),e[36]=G):G=e[36];const X=!m;let z;e[37]!==D||e[38]!==m?(z=t.jsx(Nt,{placeholder:"Search...",onKeyDown:D,onValueChange:m,className:"rounded-t-xl"}),e[37]=D,e[38]=m,e[39]=z):z=e[39];let ee;e[40]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(vt,{children:"No results found."}),e[40]=ee):ee=e[40];let te;e[41]!==E?(te=()=>{E()},e[41]=E,e[42]=te):te=e[42];let Z;e[43]!==E?(Z=$=>{$.stopPropagation(),E()},e[43]=E,e[44]=Z):Z=e[44];const de=g.length===s.length&&s.length>0;let ae;e[45]!==de||e[46]!==E?(ae=t.jsx(Le,{checked:de,onCheckedChange:E,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:It}),e[45]=de,e[46]=E,e[47]=ae):ae=e[47];let re;e[48]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx("span",{children:"(Select All)"}),e[48]=re):re=e[48];let W;e[49]!==Z||e[50]!==ae?(W=t.jsxs("div",{className:"flex items-center w-full",onClick:Z,children:[ae,re]}),e[49]=Z,e[50]=ae,e[51]=W):W=e[51];let Y;e[52]!==te||e[53]!==W?(Y=t.jsx(Fe,{onSelect:te,className:"cursor-pointer",children:W},"all"),e[52]=te,e[53]=W,e[54]=Y):Y=e[54];let ie;if(e[55]!==s||e[56]!==g||e[57]!==A){let $;e[59]!==g||e[60]!==A?($=B=>{const me=g.includes(B.value);return t.jsx(Fe,{onSelect:()=>{A(B)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:ve=>{ve.stopPropagation(),A(B)},children:[t.jsx(Le,{checked:me,onCheckedChange:()=>{A(B)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:kt}),B.icon&&t.jsx(B.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:B.label})]})},B.value)},e[59]=g,e[60]=A,e[61]=$):$=e[61],ie=s.map($),e[55]=s,e[56]=g,e[57]=A,e[58]=ie}else ie=e[58];let R;e[62]!==Y||e[63]!==ie?(R=t.jsxs(St,{className:"rounded-b-xl",children:[ee,t.jsxs(yt,{children:[Y,ie]})]}),e[62]=Y,e[63]=ie,e[64]=R):R=e[64];let H;e[65]!==X||e[66]!==z||e[67]!==R?(H=t.jsx(Qe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:G,children:t.jsxs(wt,{shouldFilter:X,className:"rounded-xl",children:[z,R]})}),e[65]=X,e[66]=z,e[67]=R,e[68]=H):H=e[68];let oe;return e[69]!==T||e[70]!==f||e[71]!==F||e[72]!==H?(oe=t.jsxs(Ze,{open:T,onOpenChange:_,modal:f,children:[F,H]}),e[69]=T,e[70]=f,e[71]=F,e[72]=H,e[73]=oe):oe=e[73],oe}function kt(l){return l.stopPropagation()}function It(l){return l.stopPropagation()}function Pt(l){return l.value}function Mt(l){return!l}const Ye=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],Dt=40;function Ts(l){const s=(l.endDate.getTime()-l.startDate.getTime())/Dt;return Ye.find(r=>r.ms>=s)?.label??"1d"}function Me(l){const e=Ye.find(i=>i.label===l);if(e)return e.ms;const s=/^(\d+)([mhd])$/.exec(l);if(!s)return 6e4;const n=parseInt(s[1],10),r=s[2];return r==="h"?n*36e5:r==="d"?n*864e5:n*6e4}function Rt(l,e){const s=new Date(l);return Me(e)>=864e5?s.toLocaleDateString([],{month:"short",day:"numeric"}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Oe(l,e){const s=Me(e);return new Date(Math.floor(l.getTime()/s)*s)}function At(l){return l>=1e4?`${(l/1e3).toFixed(1)}s`:`${Math.round(l)}ms`}function De(l){return Number.isFinite(l)?l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:Math.round(l).toLocaleString():"0"}function Re(l){return Number.isFinite(l)?`$${l.toFixed(l<1?4:2)}`:"$0.00"}function ks(l,e,s){const n=Me(s),r=Oe(e.startDate,s).getTime(),i=e.endDate.getTime(),a=new Map(l.map(c=>[Oe(new Date(c.timestamp),s).getTime(),c])),d=[];for(let c=r;c<=i;c+=n){const o=a.get(c),j=new Date(c).toISOString();d.push({t:j,ts:c,label:Rt(j,s),calls:o?.calls??0,errors:o?.errors??0,errorRate:o?.errorRate??0,avg:o?.avg??0,p50:o?.p50??0,p95:o?.p95??0,inputTokens:o?.inputTokens??0,outputTokens:o?.outputTokens??0,totalTokens:o?.totalTokens??0,costUsd:o?.costUsd??0})}return d}function Is(l,e){return e==="requests"?l.calls:e==="errors"?l.errorRate:l.avgDurationMs}function Ps(l,e){return e==="requests"?l.calls.toLocaleString():e==="errors"?`${l.errorRate.toFixed(1)}%`:At(l.avgDurationMs)}function Ae(l){return(l.run_config??{}).agent?.id??(l.virtual_mcp_id||null)}function Ee(l,e,s,n){if(!l)return n;const r=e.find(a=>a.id===l)??s?.find(a=>a.id===l);if(r?.title)return r.title;const i=nt(l);return i?at(i).title??n:l}function $e(l,e,s){return l?(e.find(r=>r.id===l)??s?.find(r=>r.id===l))?.icon??null:null}function Xe(l){return l?.data?.members??[]}function we(l){const e=ne.c(33),{thread:s,connections:n,virtualMcps:r,selectedIndex:i,total:a,onPrev:d,onNext:c}=l;let o,j;if(e[0]!==n||e[1]!==s||e[2]!==r){const k=Ae(s);o=Ee(k,r,n,""),j=$e(k,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j,v=o||s.title;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{}),e[5]=m):m=e[5];let b;e[6]!==N||e[7]!==v?(b=t.jsx(Pe,{icon:N,name:v,size:"sm",fallbackIcon:m,className:"shadow-sm shrink-0 rounded-md"}),e[6]=N,e[7]=v,e[8]=b):b=e[8];let x;e[9]!==s.title?(x=t.jsx(dt,{className:"text-sm leading-snug truncate",children:s.title}),e[9]=s.title,e[10]=x):x=e[10];let p;e[11]!==o?(p=o&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:o}),e[11]=o,e[12]=p):p=e[12];let h;e[13]!==x||e[14]!==p?(h=t.jsxs("div",{className:"min-w-0",children:[x,p]}),e[13]=x,e[14]=p,e[15]=h):h=e[15];let u;e[16]!==b||e[17]!==h?(u=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[b,h]}),e[16]=b,e[17]=h,e[18]=u):u=e[18];const S=i===0;let f;e[19]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ye,{size:14}),e[19]=f):f=e[19];let C;e[20]!==d||e[21]!==S?(C=t.jsx(fe,{size:"icon",variant:"ghost",onClick:d,disabled:S,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous thread",children:f}),e[20]=d,e[21]=S,e[22]=C):C=e[22];const w=i===a-1;let g;e[23]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(he,{size:14}),e[23]=g):g=e[23];let y;e[24]!==c||e[25]!==w?(y=t.jsx(fe,{size:"icon",variant:"ghost",onClick:c,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":"Next thread",children:g}),e[24]=c,e[25]=w,e[26]=y):y=e[26];let T;e[27]!==C||e[28]!==y?(T=t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C,y]}),e[27]=C,e[28]=y,e[29]=T):T=e[29];let _;return e[30]!==T||e[31]!==u?(_=t.jsx(mt,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[u,T]})}),e[30]=T,e[31]=u,e[32]=_):_=e[32],_}function Et(l){const e=ne.c(48),{thread:s,connections:n,virtualMcps:r,members:i}=l;let a,d;if(e[0]!==n||e[1]!==s||e[2]!==r){const M=Ae(s);a=Ee(M,r,n,""),d=$e(M,r,n),e[0]=n,e[1]=s,e[2]=r,e[3]=a,e[4]=d}else a=e[3],d=e[4];const c=d;let o;if(e[5]!==i||e[6]!==s.created_by){const M=Xe(i);let A;e[8]!==s.created_by?(A=L=>L.userId===s.created_by,e[8]=s.created_by,e[9]=A):A=e[9],o=M.find(A),e[5]=i,e[6]=s.created_by,e[7]=o}else o=e[7];const j=o;let N;e[10]!==j?.user.email||e[11]!==j?.user.name||e[12]!==s.created_by?(N=j?.user.name??j?.user.email??s.created_by?.substring(0,8)??"—",e[10]=j?.user.email,e[11]=j?.user.name,e[12]=s.created_by,e[13]=N):N=e[13];const v=N,m=j?.user.image??void 0;let b;e[14]!==s.created_at?(b=new Date(s.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=s.created_at,e[15]=b):b=e[15];const x=b,p=ue[s.status]??ue.completed,h=p.icon;let u;e[16]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=u):u=e[16];let S;e[17]!==h||e[18]!==p.iconClassName?(S=t.jsx(h,{size:13,className:p.iconClassName}),e[17]=h,e[18]=p.iconClassName,e[19]=S):S=e[19];let f;e[20]!==p.labelColor?(f=be("text-sm",p.labelColor),e[20]=p.labelColor,e[21]=f):f=e[21];let C;e[22]!==p.label||e[23]!==f?(C=t.jsx("span",{className:f,children:p.label}),e[22]=p.label,e[23]=f,e[24]=C):C=e[24];let w;e[25]!==S||e[26]!==C?(w=t.jsxs("div",{children:[u,t.jsxs("div",{className:"flex items-center gap-1.5",children:[S,C]})]}),e[25]=S,e[26]=C,e[27]=w):w=e[27];let g;e[28]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=g):g=e[28];let y;e[29]!==x?(y=t.jsxs("div",{children:[g,t.jsx("div",{className:"text-sm text-foreground",children:x})]}),e[29]=x,e[30]=y):y=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"User"}),e[31]=T):T=e[31];let _;e[32]!==m||e[33]!==v?(_=t.jsx(We,{url:m,fallback:v,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=m,e[33]=v,e[34]=_):_=e[34];let k;e[35]!==v?(k=t.jsx("span",{className:"text-sm text-foreground",children:v}),e[35]=v,e[36]=k):k=e[36];let P;e[37]!==_||e[38]!==k?(P=t.jsxs("div",{children:[T,t.jsxs("div",{className:"flex items-center gap-2",children:[_,k]})]}),e[37]=_,e[38]=k,e[39]=P):P=e[39];let I;e[40]!==c||e[41]!==a?(I=a&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Agent"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Pe,{icon:c,name:a,size:"xs",fallbackIcon:t.jsx(Ie,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),t.jsx("span",{className:"text-sm text-foreground",children:a})]})]}),e[40]=c,e[41]=a,e[42]=I):I=e[42];let D;return e[43]!==y||e[44]!==P||e[45]!==I||e[46]!==w?(D=t.jsxs("div",{className:"px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm",children:[w,y,P,I]}),e[43]=y,e[44]=P,e[45]=I,e[46]=w,e[47]=D):D=e[47],D}function $t(l){const e=ne.c(72),{thread:s,usage:n,members:r,connections:i,virtualMcps:a,onClick:d,lastRowRef:c}=l;let o,j;if(e[0]!==i||e[1]!==s||e[2]!==a){const F=Ae(s);o=Ee(F,a,i,"—"),j=$e(F,a,i),e[0]=i,e[1]=s,e[2]=a,e[3]=o,e[4]=j}else o=e[3],j=e[4];const N=j;let v;if(e[5]!==r||e[6]!==s.created_by){const F=Xe(r);let G;e[8]!==s.created_by?(G=X=>X.userId===s.created_by,e[8]=s.created_by,e[9]=G):G=e[9],v=F.find(G),e[5]=r,e[6]=s.created_by,e[7]=v}else v=e[7];const m=v;let b;e[10]!==m?.user.email||e[11]!==m?.user.name||e[12]!==s.created_by?(b=m?.user.name??m?.user.email??s.created_by?.substring(0,8)??"—",e[10]=m?.user.email,e[11]=m?.user.name,e[12]=s.created_by,e[13]=b):b=e[13];const x=b,p=m?.user.image??void 0;let h,u;if(e[14]!==s.created_at){const F=new Date(s.created_at);h=F.toLocaleDateString("en-US",{month:"short",day:"numeric"}),u=F.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=s.created_at,e[15]=h,e[16]=u}else h=e[15],u=e[16];const S=u,f=ue[s.status]??ue.completed,C=f.icon;let w;e[17]!==s.title?(w=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[17]=s.title,e[18]=w):w=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Ie,{}),e[19]=g):g=e[19];let y;e[20]!==N||e[21]!==o?(y=t.jsx(Pe,{icon:N,name:o,size:"xs",fallbackIcon:g,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=N,e[21]=o,e[22]=y):y=e[22];let T;e[23]!==o?(T=t.jsx("span",{className:"truncate",children:o}),e[23]=o,e[24]=T):T=e[24];let _;e[25]!==y||e[26]!==T?(_=t.jsx(le,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,T]})}),e[25]=y,e[26]=T,e[27]=_):_=e[27];let k;e[28]!==p||e[29]!==x?(k=t.jsx(We,{url:p,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=p,e[29]=x,e[30]=k):k=e[30];let P;e[31]!==x?(P=t.jsx("span",{className:"truncate",children:x}),e[31]=x,e[32]=P):P=e[32];let I;e[33]!==k||e[34]!==P?(I=t.jsx(le,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[k,P]})}),e[33]=k,e[34]=P,e[35]=I):I=e[35];let D;e[36]!==C||e[37]!==f.iconClassName?(D=t.jsx(C,{size:14,className:f.iconClassName}),e[36]=C,e[37]=f.iconClassName,e[38]=D):D=e[38];let M;e[39]!==f.labelColor?(M=be("text-sm",f.labelColor),e[39]=f.labelColor,e[40]=M):M=e[40];let A;e[41]!==f.label||e[42]!==M?(A=t.jsx("span",{className:M,children:f.label}),e[41]=f.label,e[42]=M,e[43]=A):A=e[43];let L;e[44]!==D||e[45]!==A?(L=t.jsx(le,{className:"w-24 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[D,A]})}),e[44]=D,e[45]=A,e[46]=L):L=e[46];let K;e[47]!==n?(K=n?De(n.totalTokens):"—",e[47]=n,e[48]=K):K=e[48];let q;e[49]!==K?(q=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:K}),e[49]=K,e[50]=q):q=e[50];let Q;e[51]!==n?(Q=n&&n.costUsd>0?Re(n.costUsd):"—",e[51]=n,e[52]=Q):Q=e[52];let J;e[53]!==Q?(J=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:Q}),e[53]=Q,e[54]=J):J=e[54];let E;e[55]!==h?(E=t.jsx("div",{children:h}),e[55]=h,e[56]=E):E=e[56];let U;e[57]!==S?(U=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=U):U=e[58];let O;e[59]!==E||e[60]!==U?(O=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[E,U]}),e[59]=E,e[60]=U,e[61]=O):O=e[61];let V;return e[62]!==c||e[63]!==d||e[64]!==I||e[65]!==L||e[66]!==q||e[67]!==J||e[68]!==O||e[69]!==w||e[70]!==_?(V=t.jsxs(Ne,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:d,children:[w,_,I,L,q,J,O]}),e[62]=c,e[63]=d,e[64]=I,e[65]=L,e[66]=q,e[67]=J,e[68]=O,e[69]=w,e[70]=_,e[71]=V):V=e[71],V}const _e=100;function Lt(l){const e=ne.c(37),{client:s,locator:n,thread:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==n||e[1]!==r.id?(v=xe.threadMessages(n,r.id),e[0]=n,e[1]=r.id,e[2]=v):v=e[2];let m;e[3]!==s||e[4]!==r.id?(m=async P=>{const{pageParam:I}=P,D=I===void 0?0:I;if(!s)throw new Error("MCP client is not available");const M=await s.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:r.id,limit:_e,offset:D}});return M.structuredContent??M},e[3]=s,e[4]=r.id,e[5]=m):m=e[5];let b;e[6]!==v||e[7]!==m?(b={queryKey:v,queryFn:m,initialPageParam:0,getNextPageParam:Ot,staleTime:6e4},e[6]=v,e[7]=m,e[8]=b):b=e[8];const{data:x,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:u}=ht(b);let S;e[9]!==x.pages?(S=x.pages.flatMap(Ut).filter(Ft),e[9]=x.pages,e[10]=S):S=e[10];const f=S,C=Ct(f);let w;e[11]!==p||e[12]!==h||e[13]!==u?(w=()=>{h&&!u&&p()},e[11]=p,e[12]=h,e[13]=u,e[14]=w):w=e[14];const g=ke(w,h??!1,u);let y;e[15]!==i||e[16]!==N||e[17]!==j||e[18]!==c||e[19]!==r||e[20]!==o||e[21]!==a?(y=t.jsx(we,{thread:r,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[15]=i,e[16]=N,e[17]=j,e[18]=c,e[19]=r,e[20]=o,e[21]=a,e[22]=y):y=e[22];let T;e[23]!==i||e[24]!==d||e[25]!==r||e[26]!==a?(T=t.jsx(Et,{thread:r,connections:i,virtualMcps:a,members:d}),e[23]=i,e[24]=d,e[25]=r,e[26]=a,e[27]=T):T=e[27];let _;e[28]!==u||e[29]!==g||e[30]!==C||e[31]!==f.length?(_=f.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No messages in this thread"}):t.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:t.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[C.map((P,I)=>t.jsx("div",{ref:I===C.length-1?g:void 0,children:t.jsx(Tt,{pair:P,isLastPair:I===C.length-1,status:"ready"})},`pair-${P.user?.id??P.assistant?.id}`)),u&&t.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=u,e[29]=g,e[30]=C,e[31]=f.length,e[32]=_):_=e[32];let k;return e[33]!==y||e[34]!==T||e[35]!==_?(k=t.jsxs(t.Fragment,{children:[y,T,_]}),e[33]=y,e[34]=T,e[35]=_,e[36]=k):k=e[36],k}function Ft(l){return l.role==="user"||l.role==="assistant"}function Ut(l){return l.items??[]}function Ot(l,e){const s=l,n=e;if(!((s?.items?.length??0)<_e))return n.length*_e}function et(l){const e=ne.c(39),{thread:s,client:n,locator:r,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}=l;let v;e[0]!==i||e[1]!==N||e[2]!==j||e[3]!==c||e[4]!==s||e[5]!==o||e[6]!==a?(v=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[0]=i,e[1]=N,e[2]=j,e[3]=c,e[4]=s,e[5]=o,e[6]=a,e[7]=v):v=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=m):m=e[8];let b;e[9]!==v?(b=t.jsxs(t.Fragment,{children:[v,m]}),e[9]=v,e[10]=b):b=e[10];let x;e[11]!==i||e[12]!==N||e[13]!==j||e[14]!==c||e[15]!==s||e[16]!==o||e[17]!==a?(x=t.jsx(we,{thread:s,connections:i,virtualMcps:a,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[11]=i,e[12]=N,e[13]=j,e[14]=c,e[15]=s,e[16]=o,e[17]=a,e[18]=x):x=e[18];let p;e[19]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Loading conversation\\u2026"}),e[19]=p):p=e[19];let h;e[20]!==x?(h=t.jsxs(t.Fragment,{children:[x,p]}),e[20]=x,e[21]=h):h=e[21];let u;e[22]!==n||e[23]!==i||e[24]!==r||e[25]!==d||e[26]!==N||e[27]!==j||e[28]!==c||e[29]!==s||e[30]!==o||e[31]!==a?(u=t.jsx(Lt,{client:n,locator:r,thread:s,connections:i,virtualMcps:a,members:d,selectedIndex:c,total:o,onPrev:j,onNext:N}),e[22]=n,e[23]=i,e[24]=r,e[25]=d,e[26]=N,e[27]=j,e[28]=c,e[29]=s,e[30]=o,e[31]=a,e[32]=u):u=e[32];let S;e[33]!==h||e[34]!==u?(S=t.jsx(ce.Suspense,{fallback:h,children:u}),e[33]=h,e[34]=u,e[35]=S):S=e[35];let f;return e[36]!==b||e[37]!==S?(f=t.jsx(tt,{fallback:b,children:S}),e[36]=b,e[37]=S,e[38]=f):f=e[38],f}function Ms(l){const e=ne.c(43),{filterAgentIds:s,filterUserIds:n,filterStatus:r,virtualMcpOptions:i,memberOptions:a,activeFiltersCount:d,onUpdateFilters:c}=l,[o,j]=ce.useState(!1);let N,v;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(_t,{size:16}),v=t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e[0]=N,e[1]=v):(N=e[0],v=e[1]);let m;e[2]!==d?(m=d>0&&t.jsxs(t.Fragment,{children:[t.jsx(je,{variant:"default",className:"sm:hidden absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:d}),t.jsx(je,{variant:"default",className:"hidden sm:flex ml-1 h-5 w-5 rounded-full p-0 items-center justify-center text-xs",children:d})]}),e[2]=d,e[3]=m):m=e[3];let b;e[4]!==m?(b=t.jsx(Je,{asChild:!0,children:t.jsxs(fe,{variant:"outline",className:"relative",children:[N,v,m]})}),e[4]=m,e[5]=b):b=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"font-medium text-sm",children:"Filter Threads"}),e[6]=x):x=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Agent"}),e[7]=p):p=e[7];let h;e[8]!==c?(h=M=>c({filterAgentIds:M.slice(0,1)}),e[8]=c,e[9]=h):h=e[9];let u;e[10]!==s||e[11]!==h||e[12]!==i?(u=t.jsxs("div",{children:[p,t.jsx(Ue,{options:i,defaultValue:s,onValueChange:h,placeholder:"All agents",variant:"secondary",className:"w-full",maxCount:1})]}),e[10]=s,e[11]=h,e[12]=i,e[13]=u):u=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"User"}),e[14]=S):S=e[14];let f;e[15]!==c?(f=M=>c({filterUserIds:M.slice(0,1)}),e[15]=c,e[16]=f):f=e[16];let C;e[17]!==n||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{children:[S,t.jsx(Ue,{options:a,defaultValue:n,onValueChange:f,placeholder:"All users",variant:"secondary",className:"w-full",maxCount:1})]}),e[17]=n,e[18]=a,e[19]=f,e[20]=C):C=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Status"}),e[21]=w):w=e[21];let g;e[22]!==c?(g=M=>c({filterStatus:M}),e[22]=c,e[23]=g):g=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(gt,{className:"w-full",children:t.jsx(pt,{})}),e[24]=y):y=e[24];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(jt,{children:[t.jsx(ge,{value:"all",children:"All statuses"}),t.jsx(ge,{value:"completed",children:"Completed"}),t.jsx(ge,{value:"active",children:"Active"}),t.jsx(ge,{value:"failed",children:"Failed"})]}),e[25]=T):T=e[25];let _;e[26]!==r||e[27]!==g?(_=t.jsxs("div",{children:[w,t.jsxs(bt,{value:r,onValueChange:g,children:[y,T]})]}),e[26]=r,e[27]=g,e[28]=_):_=e[28];let k;e[29]!==C||e[30]!==_||e[31]!==u?(k=t.jsxs("div",{className:"space-y-3",children:[u,C,_]}),e[29]=C,e[30]=_,e[31]=u,e[32]=k):k=e[32];let P;e[33]!==d||e[34]!==c?(P=d>0&&t.jsx(fe,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{c({filterAgentIds:[],filterUserIds:[],filterStatus:"all"}),j(!1)},children:"Clear all filters"}),e[33]=d,e[34]=c,e[35]=P):P=e[35];let I;e[36]!==k||e[37]!==P?(I=t.jsx(Qe,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[x,k,P]})}),e[36]=k,e[37]=P,e[38]=I):I=e[38];let D;return e[39]!==o||e[40]!==I||e[41]!==b?(D=t.jsxs(Ze,{open:o,onOpenChange:j,children:[b,I]}),e[39]=o,e[40]=I,e[41]=b,e[42]=D):D=e[42],D}const Ce=50;function Ds(l){const e=ne.c(29),{client:s,locator:n,membersData:r,allConnections:i,allVirtualMcps:a,dateRange:d,searchQuery:c,filterAgentIds:o,filterUserIds:j,filterStatus:N}=l,[v,m]=ce.useState(null),b=d.startDate.toISOString(),x=d.endDate.toISOString(),p=JSON.stringify({startDate:b,endDate:x,search:c,agentIds:o,userIds:j,status:N}),{data:h,fetchNextPage:u,hasNextPage:S,isFetchingNextPage:f,isLoading:C}=ze({queryKey:xe.threadsInfinite(n,p),queryFn:async R=>{const{pageParam:H}=R,oe=H===void 0?0:H;if(!s)throw new Error("MCP client is not available");const $=await s.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Ce,offset:oe,startDate:b,endDate:x,...c?{search:c}:{},...o&&o.length>0?{agentId:o[0]}:{},...j&&j.length>0?{userId:j[0]}:{},...N&&N!=="all"?{status:N}:{}}});return $.structuredContent??$},initialPageParam:0,getNextPageParam:Ht,staleTime:3e4}),w=(h?.pages??[]).flatMap(Gt),g=w.map(qt),{data:y}=Ve({queryKey:xe.monitoringThreadUsage(n,JSON.stringify({ids:g,startDate:b,endDate:x})),queryFn:async()=>{if(!s)throw new Error("MCP client is not available");const R=await s.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:g,startDate:b,endDate:x}});return R.structuredContent??R},enabled:!!s&&g.length>0,staleTime:3e4}),T=new Map((y?.items??[]).map(Kt)),[_,k]=ce.useState(null),[P,I]=ce.useState("desc");let D;e[0]!==_?(D=R=>{_===R?I(zt):(k(R),I("desc"))},e[0]=_,e[1]=D):D=e[1];const M=D,A=R=>{const H=T.get(R);return H?_==="cost"?H.costUsd:H.totalTokens:0},L=_?[...w].sort((R,H)=>{const oe=A(R.id),$=A(H.id);return P==="desc"?$-oe:oe-$}):w,K=v!==null?L[v]??null:null;let q;e[2]!==u||e[3]!==S||e[4]!==f?(q=()=>{S&&!f&&u()},e[2]=u,e[3]=S,e[4]=f,e[5]=q):q=e[5];const J=ke(q,S??!1,f),E=!!c||(o?.length??0)>0||(j?.length??0)>0||N&&N!=="all";let U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=()=>m(Vt),e[6]=U):U=e[6];const O=U,V=()=>m(R=>R!==null&&R<L.length-1?R+1:R),F="flex-1 flex flex-col overflow-auto min-w-0",G="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",X="flex-1 flex flex-col min-w-0",z="flex-1 min-w-0 pt-1",ee="min-w-0",te=C?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})}):w.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Se,{title:E?"No matching threads":"No threads in this time range",description:E?"Try adjusting your filters or search query.":"Try expanding the time range to see older threads."})}):t.jsxs(t.Fragment,{children:[t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0 z-20",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),t.jsx(se,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Tokens",_==="tokens"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:t.jsxs("button",{type:"button",onClick:()=>M("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Cost",_==="cost"&&(P==="desc"?t.jsx(he,{size:12}):t.jsx(ye,{size:12}))]})}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Date"})]})}),t.jsx(Be,{children:L.map((R,H)=>t.jsx($t,{thread:R,usage:T.get(R.id),members:r,connections:i,virtualMcps:a,onClick:()=>m(H),lastRowRef:H===L.length-1?J:void 0},R.id))})]}),f&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let Z;e[7]!==te?(Z=t.jsx("div",{className:G,children:t.jsx("div",{className:X,children:t.jsx("div",{className:z,children:t.jsx("div",{className:ee,children:te})})})}),e[7]=te,e[8]=Z):Z=e[8];const de=v!==null;let ae;e[9]===Symbol.for("react.memo_cache_sentinel")?(ae=R=>{R||m(null)},e[9]=ae):ae=e[9];let re;e[10]!==i||e[11]!==a||e[12]!==s||e[13]!==L||e[14]!==V||e[15]!==O||e[16]!==n||e[17]!==r||e[18]!==K||e[19]!==v?(re=K&&v!==null&&t.jsx(et,{thread:K,client:s,locator:n,connections:i,virtualMcps:a,members:r,selectedIndex:v,total:L.length,onPrev:O,onNext:V}),e[10]=i,e[11]=a,e[12]=s,e[13]=L,e[14]=V,e[15]=O,e[16]=n,e[17]=r,e[18]=K,e[19]=v,e[20]=re):re=e[20];let W;e[21]!==re?(W=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:re}),e[21]=re,e[22]=W):W=e[22];let Y;e[23]!==de||e[24]!==W?(Y=t.jsx(qe,{open:de,onOpenChange:ae,children:W}),e[23]=de,e[24]=W,e[25]=Y):Y=e[25];let ie;return e[26]!==Z||e[27]!==Y?(ie=t.jsxs("div",{className:F,children:[Z,Y]}),e[26]=Z,e[27]=Y,e[28]=ie):ie=e[28],ie}function Vt(l){return l!==null&&l>0?l-1:l}function zt(l){return l==="desc"?"asc":"desc"}function Kt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function qt(l){return l.id}function Gt(l){return l.items??[]}function Ht(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Ce))return n.length*Ce}const Te=50;function pe(l){const e=ne.c(10),{title:s,value:n,subtitle:r}=l;let i;e[0]!==s?(i=t.jsx("span",{className:"text-sm text-foreground/70",children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=t.jsx("span",{className:"text-3xl font-normal tabular-nums",children:n}),e[2]=n,e[3]=a):a=e[3];let d;e[4]!==r?(d=r&&t.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==d?(c=t.jsxs(ct,{className:"pt-4 px-4 pb-5 gap-1",children:[i,a,d]}),e[6]=i,e[7]=a,e[8]=d,e[9]=c):c=e[9],c}function Bt(l){const e=ne.c(27),{automationId:s,range:n}=l,{data:r,isLoading:i}=ft(s,n),a=r?.runs,d=r?.usage;let c;e[0]!==a?(c=a&&a.total>0?`${Math.round(a.completed/a.total*100)}%`:"—",e[0]=a,e[1]=c):c=e[1];const o=c,j=d&&d.truncated?`last ${d.sampledRuns} runs`:void 0;let N;e[2]!==i||e[3]!==a?.total?(N=i?"…":a?.total.toLocaleString()??"0",e[2]=i,e[3]=a?.total,e[4]=N):N=e[4];const v=a?`${a.completed} ok · ${a.failed} failed${a.inProgress>0?` · ${a.inProgress} running`:""}`:void 0;let m;e[5]!==N||e[6]!==v?(m=t.jsx(pe,{title:"Runs",value:N,subtitle:v}),e[5]=N,e[6]=v,e[7]=m):m=e[7];const b=i?"…":o;let x;e[8]!==b?(x=t.jsx(pe,{title:"Success rate",value:b}),e[8]=b,e[9]=x):x=e[9];let p;e[10]!==i||e[11]!==d?.totalTokens?(p=i?"…":De(d?.totalTokens??0),e[10]=i,e[11]=d?.totalTokens,e[12]=p):p=e[12];let h;e[13]!==p||e[14]!==j?(h=t.jsx(pe,{title:"Tokens",value:p,subtitle:j}),e[13]=p,e[14]=j,e[15]=h):h=e[15];let u;e[16]!==i||e[17]!==d?(u=i?"…":d&&d.costUsd>0?Re(d.costUsd):"—",e[16]=i,e[17]=d,e[18]=u):u=e[18];let S;e[19]!==u||e[20]!==j?(S=t.jsx(pe,{title:"Cost",value:u,subtitle:j}),e[19]=u,e[20]=j,e[21]=S):S=e[21];let f;return e[22]!==S||e[23]!==m||e[24]!==x||e[25]!==h?(f=t.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[m,x,h,S]}),e[22]=S,e[23]=m,e[24]=x,e[25]=h,e[26]=f):f=e[26],f}function Jt(l){const e=ne.c(39),{run:s,usage:n,onClick:r,lastRowRef:i}=l;let a,d;if(e[0]!==s.created_at){const y=new Date(s.created_at);a=y.toLocaleDateString("en-US",{month:"short",day:"numeric"}),d=y.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=s.created_at,e[1]=a,e[2]=d}else a=e[1],d=e[2];const c=d,o=ue[s.status]??ue.completed,j=o.icon;let N;e[3]!==s.title?(N=t.jsx(le,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:s.title})}),e[3]=s.title,e[4]=N):N=e[4];let v;e[5]!==j||e[6]!==o.iconClassName?(v=t.jsx(j,{size:14,className:o.iconClassName}),e[5]=j,e[6]=o.iconClassName,e[7]=v):v=e[7];let m;e[8]!==o.labelColor?(m=be("text-sm",o.labelColor),e[8]=o.labelColor,e[9]=m):m=e[9];let b;e[10]!==o.label||e[11]!==m?(b=t.jsx("span",{className:m,children:o.label}),e[10]=o.label,e[11]=m,e[12]=b):b=e[12];let x;e[13]!==v||e[14]!==b?(x=t.jsx(le,{className:"w-28 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[v,b]})}),e[13]=v,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n?(p=n?De(n.totalTokens):"—",e[16]=n,e[17]=p):p=e[17];let h;e[18]!==p?(h=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:p}),e[18]=p,e[19]=h):h=e[19];let u;e[20]!==n?(u=n&&n.costUsd>0?Re(n.costUsd):"—",e[20]=n,e[21]=u):u=e[21];let S;e[22]!==u?(S=t.jsx(le,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:u}),e[22]=u,e[23]=S):S=e[23];let f;e[24]!==a?(f=t.jsx("div",{children:a}),e[24]=a,e[25]=f):f=e[25];let C;e[26]!==c?(C=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==C?(w=t.jsxs(le,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[f,C]}),e[28]=f,e[29]=C,e[30]=w):w=e[30];let g;return e[31]!==i||e[32]!==r||e[33]!==S||e[34]!==w||e[35]!==N||e[36]!==x||e[37]!==h?(g=t.jsxs(Ne,{ref:i,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[N,x,h,S,w]}),e[31]=i,e[32]=r,e[33]=S,e[34]=w,e[35]=N,e[36]=x,e[37]=h,e[38]=g):g=e[38],g}function Rs(l){const e=ne.c(48),{automationId:s,triggerIds:n,range:r}=l,{org:i,locator:a}=st();let d;e[0]!==i.id||e[1]!==i.slug?(d={connectionId:rt,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=d):d=e[2];const c=it(d),o=xt(),j=lt(),N=ot(),{data:v}=ut(),[m,b]=ce.useState(null),x=n.length>0;let p;e[3]!==s||e[4]!==i.id||e[5]!==n?(p=xe.automationRuns(i.id,s,n),e[3]=s,e[4]=i.id,e[5]=n,e[6]=p):p=e[6];let h;e[7]!==o||e[8]!==n?(h=async z=>{const{pageParam:ee}=z,te=ee===void 0?0:ee;return await o.call("COLLECTION_THREADS_LIST",{limit:Te,offset:te,where:{trigger_ids:n}})},e[7]=o,e[8]=n,e[9]=h):h=e[9];let u;e[10]!==x||e[11]!==p||e[12]!==h?(u={queryKey:p,queryFn:h,initialPageParam:0,getNextPageParam:Xt,enabled:x,staleTime:3e4},e[10]=x,e[11]=p,e[12]=h,e[13]=u):u=e[13];const{data:S,fetchNextPage:f,hasNextPage:C,isFetchingNextPage:w,isLoading:g}=ze(u),y=(S?.pages??[]).flatMap(Yt),T=y.map(Wt),{data:_}=Ve({queryKey:xe.monitoringThreadUsage(a,JSON.stringify({ids:T,...r})),queryFn:async()=>await o.call("MONITORING_THREAD_USAGE",{threadIds:T,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}),enabled:T.length>0,staleTime:3e4});let k;e[14]!==_?.items?(k=new Map((_?.items??[]).map(Zt)),e[14]=_?.items,e[15]=k):k=e[15];const P=k;let I;e[16]!==f||e[17]!==C||e[18]!==w?(I=()=>{C&&!w&&f()},e[16]=f,e[17]=C,e[18]=w,e[19]=I):I=e[19];const D=ke(I,C??!1,w),M=m!==null?y[m]??null:null;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=()=>b(Qt),e[20]=A):A=e[20];const L=A,K=()=>b(z=>z!==null&&z<y.length-1?z+1:z),q="flex flex-col gap-5";let Q;e[21]!==s||e[22]!==r?(Q=t.jsx(Bt,{automationId:s,range:r}),e[21]=s,e[22]=r,e[23]=Q):Q=e[23];const J=x?g?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):y.length===0?t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No runs yet",description:"This automation hasn't run yet. Trigger it or wait for a starter to fire."})}):t.jsxs(Ge,{className:"w-full border-collapse",children:[t.jsx(He,{className:"border-b-0",children:t.jsxs(Ne,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(se,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),t.jsx(se,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),t.jsx(se,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),t.jsx(se,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Started"})]})}),t.jsx(Be,{children:y.map((z,ee)=>t.jsx(Jt,{run:z,usage:P.get(z.id),onClick:()=>b(ee),lastRowRef:ee===y.length-1?D:void 0},z.id))})]}):t.jsx("div",{className:"py-16",children:t.jsx(Se,{title:"No starters yet",description:"Add a starter (cron, event, or webhook) to start collecting runs."})});let E;e[24]!==w?(E=w&&t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=w,e[25]=E):E=e[25];const U=m!==null;let O;e[26]===Symbol.for("react.memo_cache_sentinel")?(O=z=>{z||b(null)},e[26]=O):O=e[26];let V;e[27]!==j||e[28]!==N||e[29]!==c||e[30]!==K||e[31]!==L||e[32]!==a||e[33]!==v||e[34]!==y||e[35]!==M||e[36]!==m?(V=M&&m!==null&&t.jsx(et,{thread:M,client:c,locator:a,connections:j,virtualMcps:N,members:v,selectedIndex:m,total:y.length,onPrev:L,onNext:K}),e[27]=j,e[28]=N,e[29]=c,e[30]=K,e[31]=L,e[32]=a,e[33]=v,e[34]=y,e[35]=M,e[36]=m,e[37]=V):V=e[37];let F;e[38]!==V?(F=t.jsx(Ke,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:V}),e[38]=V,e[39]=F):F=e[39];let G;e[40]!==U||e[41]!==F?(G=t.jsx(qe,{open:U,onOpenChange:O,children:F}),e[40]=U,e[41]=F,e[42]=G):G=e[42];let X;return e[43]!==J||e[44]!==E||e[45]!==G||e[46]!==Q?(X=t.jsxs("div",{className:q,children:[Q,J,E,G]}),e[43]=J,e[44]=E,e[45]=G,e[46]=Q,e[47]=X):X=e[47],X}function Qt(l){return l!==null&&l>0?l-1:l}function Zt(l){return[l.threadId,{calls:l.calls,inputTokens:l.inputTokens,outputTokens:l.outputTokens,totalTokens:l.totalTokens,costUsd:l.costUsd}]}function Wt(l){return l.id}function Yt(l){return l.items??[]}function Xt(l,e){const s=l,n=e;if(!((s?.items?.length??0)<Te))return n.length*Te}export{Rs as A,Ue as M,Ms as T,Re as a,ks as b,At as c,Ps as d,Is as e,De as f,Ts as g,Xe as h,Ds as i};
@@ -1 +1 @@
1
- import{e as B,j as o,p as L,f as T,r as $,B as M,t as N}from"./index-D7zMM4W4.js";import{s as q}from"./Plus-CKCNLZUU.js";import{i as S}from"./Zap-qtt4gXCs.js";import{S as D}from"./search-input-C0c6vwO5.js";import{P as l}from"./index-CfcqKeX1.js";import{E as b}from"./empty-state-DneBSEGo.js";import{c as O}from"./use-automations-tXwjiHAc.js";import{l as V}from"./use-navigate-to-agent-BkTVNUaN.js";import{A as F}from"./automation-list-row-ComFNSHa.js";import{h as G}from"./use-mcp-client-CrjmswbX.js";import{a as H}from"./use-virtual-mcp-YDOoOiIE.js";import{R as J}from"./require-capability-siE8o61Y.js";import"./SearchMd-C9j-gudR.js";import"./sidebar-vUZgGPF7.js";import"./LayoutLeft-RNub1vlB.js";import"./tooltip-B5iep7Ko.js";import"./sheet-CCipW2FH.js";import"./X-Dk_6ic2Z.js";import"./alert-dialog-Czjj9xUL.js";import"./dropdown-menu-C9Apf8St.js";import"./Check-BKIJF1cF.js";import"./ChevronRight-BkNktb2f.js";import"./DotsVertical-CJXQkRAx.js";import"./agent-icon-DDCLA9rm.js";import"./AlertCircle-diUVbO2-.js";import"./Tool01-WP19hvhy.js";import"./SwitchHorizontal01-D_ioy5qF.js";import"./RefreshCcw01-Gjck8qdC.js";import"./XCircle-CbslYmbl.js";import"./ArrowUpRight-DZao7AcN.js";import"./ZapSquare-DiFDNaz3.js";import"./Users03-C0zNVryE.js";import"./CheckCircle-BEdczdw2.js";import"./ChevronDown-CibD7WLD.js";import"./ChevronLeft-DnwnYIMW.js";import"./ChevronUp-DGD0GGvF.js";import"./Container-u2OVN7H1.js";import"./Eye-Dl4wUVA0.js";import"./ZoomOut-BEjoQvI4.js";import"./Globe01-DuXtiXmT.js";import"./FilterLines-Ckb-C13v.js";import"./Star01-DkjN3wmL.js";import"./Palette-3y8-lyYx.js";import"./HardDrive-DsvvHov8.js";import"./Stars02-8XRN5mVg.js";import"./Key01-CamRGqdp.js";import"./LinkExternal01-CkMjIxNM.js";import"./Monitor01-CMEyE7XK.js";import"./Sun-B5JsbdJQ.js";import"./Play-BWUsEKn-.js";import"./Settings02-CYtGjYiT.js";import"./Shield01-CnPBBwr9.js";import"./Stars01-CGinyuoF.js";import"./Trash01-ysxYI5Wr.js";import"./Upload01-BEUiJeg2.js";import"./User01--nPpP5WD.js";import"./Users01-CJfUt2eU.js";import"./XClose-MySSOydc.js";import"./auth-CiDtyFcv.js";import"./use-collections-DxiinEjJ.js";import"./use-capability-DXVx5Xxx.js";import"./access-gate-ngcc1WVS.js";import"./capability-load-error-BU8SCPcT.js";function K(){const t=B.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.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"}),k(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 io(){const t=B.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{io as default};
1
+ import{e as B,j as o,p as L,f as T,r as $,B as M,t as N}from"./index-DGGjIheX.js";import{s as q}from"./Plus-BCfK0mBl.js";import{i as S}from"./Zap-DRqUuFzT.js";import{S as D}from"./search-input-DFrDstX6.js";import{P as l}from"./index-DK5lK69Y.js";import{E as b}from"./empty-state-DAGj9d4y.js";import{c as O}from"./use-automations-BGZXYpIN.js";import{l as V}from"./use-navigate-to-agent-BIO7CjS7.js";import{A as F}from"./automation-list-row-6ykDco-o.js";import{h as G}from"./use-mcp-client-DVIPuDIp.js";import{a as H}from"./use-virtual-mcp-D9H9aNMJ.js";import{R as J}from"./require-capability-DDdNdDdz.js";import"./SearchMd-CPNqbMGc.js";import"./sidebar-DV_8rP5O.js";import"./LayoutLeft-UZ6_8WBi.js";import"./tooltip-AlbIxSnB.js";import"./sheet-qXjZ6ijq.js";import"./X-ncGdMje6.js";import"./alert-dialog-CAUF2lG9.js";import"./dropdown-menu-B7tRotB5.js";import"./Check-D0urCyzd.js";import"./ChevronRight-pxM9WiYB.js";import"./DotsVertical-DE_SmTP3.js";import"./agent-icon-BSv2ZliY.js";import"./AlertCircle-B8wgh1Ly.js";import"./Tool01-UC0L2ZqT.js";import"./SwitchHorizontal01--RQkLq3s.js";import"./RefreshCcw01-k5H1KZCV.js";import"./XCircle-BOJh16Ag.js";import"./ArrowUpRight-DFourmXp.js";import"./ZapSquare-CgDDvUYJ.js";import"./Users03-z8pz4cwj.js";import"./CheckCircle-Qyp95spV.js";import"./ChevronDown-DwPK2mcP.js";import"./ChevronLeft-C357wJbK.js";import"./ChevronUp-DNp3BStr.js";import"./Container-CwEfFXez.js";import"./Eye-Cfv_RGHV.js";import"./ZoomOut-BX0KAK4E.js";import"./Globe01-ho0SCMcq.js";import"./FilterLines-91VA8muG.js";import"./Star01-C3iVmnF7.js";import"./Palette-D6gsHlnc.js";import"./HardDrive-B_FOclPu.js";import"./Stars02-DTJjqSl_.js";import"./Key01-iwxkuIvh.js";import"./LinkExternal01-Zwfdiaw5.js";import"./Monitor01-CwZrvxuC.js";import"./Sun-Bd_n5MS2.js";import"./Play-CvfmKRq2.js";import"./Settings02-sp3cCEp1.js";import"./Shield01-BnTZT70O.js";import"./Stars01-spNf2CVt.js";import"./Trash01-C89-wTac.js";import"./Upload01-CvoLArfG.js";import"./User01-CHDBPbMe.js";import"./Users01-AMiQvbzx.js";import"./XClose-xAOdH2ec.js";import"./auth-BL0nL9hg.js";import"./use-collections-X9suE0Rz.js";import"./use-capability-JDGz96yw.js";import"./access-gate--AqGaZB3.js";import"./capability-load-error-CgPvQ3DP.js";function K(){const t=B.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.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"}),k(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 io(){const t=B.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{io as default};
@@ -1 +1 @@
1
- import{e as k,j as i,c as m,bq as R,dr as V,ds as I,dt as $}from"./index-D7zMM4W4.js";import{s as O}from"./User01--nPpP5WD.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 q;e[13]!==l?(q=l?.startsWith("icon://"),e[13]=l,e[14]=q):q=e[14];const p=q;let N;e[15]!==p||e[16]!==l?(N=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=N):N=e[17];const F=N;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,bq as R,dr as V,ds as I,dt as $}from"./index-DGGjIheX.js";import{s as O}from"./User01-CHDBPbMe.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 q;e[13]!==l?(q=l?.startsWith("icon://"),e[13]=l,e[14]=q):q=e[14];const p=q;let N;e[15]!==p||e[16]!==l?(N=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=N):N=e[17];const F=N;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,bk as v,bq as b}from"./index-D7zMM4W4.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,bk as v,bq as b}from"./index-DGGjIheX.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 X,T as Ie,p as Le,F as ze,K as Re,m as Ke,a as ge,j as n,B as Te,t as V,n as U,r as Oe,G as Ue,c as _e,C as fe}from"./index-D7zMM4W4.js";import{a as Xe,u as He}from"./use-mcp-client-CrjmswbX.js";import{t as Me}from"./ChevronDown-CibD7WLD.js";import{i as qe}from"./ChevronRight-BkNktb2f.js";import{s as Ve,t as Ge}from"./Star01-DkjN3wmL.js";import{n as Qe}from"./LinkExternal01-CkMjIxNM.js";import{s as Pe}from"./Plus-CKCNLZUU.js";import{s as Ye}from"./Trash01-ysxYI5Wr.js";import{i as Je}from"./Zap-qtt4gXCs.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-Czjj9xUL.js";import{I as ue}from"./input-DlpqEr8E.js";import{T as rt}from"./textarea-Bc-j0SM5.js";import{P as Ne}from"./index-CfcqKeX1.js";import{u as at}from"./use-debounced-autosave-DeRUhFjV.js";import{R as it}from"./require-capability-siE8o61Y.js";import"./auth-CiDtyFcv.js";import"./sidebar-vUZgGPF7.js";import"./LayoutLeft-RNub1vlB.js";import"./tooltip-B5iep7Ko.js";import"./sheet-CCipW2FH.js";import"./X-Dk_6ic2Z.js";import"./use-capability-DXVx5Xxx.js";import"./access-gate-ngcc1WVS.js";import"./capability-load-error-BU8SCPcT.js";function $e(t){const e=t;if(e?.isError)throw new Error(e.content?.[0]?.text??"Tool call failed");const s=e?.structuredContent??t,o=s;if(o?.isError)throw new Error(o.content?.[0]?.text??"Tool call failed");return s}function we(t){const e=X.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=X.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 h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=f=>r(f.target.value),e[3]=h):h=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:h,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 p;e[18]!==g||e[19]!==c||e[20]!==a?(p=n.jsxs(Te,{variant:"outline",disabled:c,onClick:a,children:[x,g]}),e[18]=g,e[19]=c,e[20]=a,e[21]=p):p=e[21];let v;return e[22]!==p||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,p]})]})]})}),e[22]=p,e[23]=m,e[24]=v):v=e[24],v}function dt(t){const e=X.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 h;e[6]!==s.control||e[7]!==u?(h=n.jsxs("div",{children:[d,n.jsx(fe,{control:s.control,name:"name",render:u})]}),e[6]=s.control,e[7]=u,e[8]=h):h=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 p;e[23]!==g||e[24]!==h?(p=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h,g]}),e[23]=g,e[24]=h,e[25]=p):p=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]!==p||e[34]!==C?(w=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[p,C]})}),e[33]=p,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 Se(t){const e=X.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 h;e[0]!==s||e[1]!==o?(h=s.watch(o),e[0]=s,e[1]=o,e[2]=h):h=e[2];const b=h;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 p;return e[19]!==m||e[20]!==g?(p=n.jsxs("div",{className:"flex items-start gap-3",children:[m,g]}),e[19]=m,e[20]=g,e[21]=p):p=e[21],p}function ft(t){const e=X.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(Se,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{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=X.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:h}=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:h}),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 ${h.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 pt(t){const e=X.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:h}=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:h})]})}},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 ht(t){const e=X.c(128),{brand:s,client:o,onChanged:l}=t,[r,i]=Oe.useState(s.isDefault??!1),[d,u]=Oe.useState(!1),h=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 p;e[2]!==s.colors?(p=s.colors??{},e[2]=s.colors,e[3]=p):p=e[3];let v;e[4]!==h||e[5]!==b||e[6]!==m||e[7]!==c||e[8]!==a||e[9]!==x||e[10]!==g||e[11]!==p?(v={values:{name:h,domain:b,overview:m,logo:c,favicon:a,ogImage:x,fonts:g,colors:p}},e[4]=h,e[5]=b,e[6]=m,e[7]=c,e[8]=a,e[9]=x,e[10]=g,e[11]=p,e[12]=v):v=e[12];const f=Ue(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(Et),Ce=Object.values(j.colors).some(Dt),Ae={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:Ae})},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(),Ae=f.control._defaultValues;f.reset(Ce,{keepValues:!0});try{await w.mutateAsync(Ce),V("brand_updated",{brand_id:s.id,fields:ve}),U.success("Brand context updated successfully"),l()}catch{f.reset(Ae,{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 L;e[25]!==s.id||e[26]!==l?(L=()=>{V("brand_deleted",{brand_id:s.id}),u(!1),l(),U.success("Brand deleted")},e[25]=s.id,e[26]=l,e[27]=L):L=e[27];let H;e[28]!==I||e[29]!==L?(H={mutationFn:I,onSuccess:L,onError:_t},e[28]=I,e[29]=L,e[30]=H):H=e[30];const{mutate:xe,isPending:E}=ge(H);let k;e[31]!==s.id||e[32]!==s.isDefault||e[33]!==o?(k=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]=k):k=e[34];let S;e[35]!==s.id||e[36]!==s.isDefault||e[37]!==l?(S=()=>{V(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),l(),U.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[35]=s.id,e[36]=s.isDefault,e[37]=l,e[38]=S):S=e[38];let T;e[39]!==k||e[40]!==S?(T={mutationFn:k,onSuccess:S,onError:Nt},e[39]=k,e[40]=S,e[41]=T):T=e[41];const{mutate:O}=ge(T),q=s.isDefault?"border-primary/30":"border-border/60";let M;e[42]!==q?(M=_e("rounded-2xl border bg-background",q),e[42]=q,e[43]=M):M=e[43];let R;e[44]!==r?(R=()=>i(!r),e[44]=r,e[45]=R):R=e[45];let z;e[46]!==r?(z=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(Me,{size:14}):n.jsx(qe,{size:14})}),e[46]=r,e[47]=z):z=e[47];let B;e[48]!==s.logo||e[49]!==s.name?(B=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]=B):B=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 A;e[53]!==s.domain?(A=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[53]=s.domain,e[54]=A):A=e[54];let P;e[55]!==F||e[56]!==A?(P=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[F,A]}),e[55]=F,e[56]=A,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 Ee=s.isDefault?"Unset as default":"Set as default",ke=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[69]!==ke?(J=_e(ke),e[69]=ke,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]!==Ee||e[77]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:Y,title:Ee,children:W}),e[73]=G,e[74]=Q,e[75]=Y,e[76]=Ee,e[77]=W,e[78]=Z):Z=e[78];let pe,he;e[79]===Symbol.for("react.memo_cache_sentinel")?(pe=j=>{j.stopPropagation(),u(!0)},he=j=>{j.key==="Enter"&&(j.stopPropagation(),u(!0))},e[79]=pe,e[80]=he):(pe=e[79],he=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:pe,onKeyDown:he,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]!==z||e[84]!==B||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:[z,B,P,_,$,Z,be]}),e[82]=R,e[83]=z,e[84]=B,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(pt,{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]!==E?(se=j=>{!j&&!E&&u(!1)},e[95]=E,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 Be=s.name||"this brand";let ne;e[98]!==Be?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Be}),". This action cannot be undone."]}),e[98]=Be,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]!==E?(re=n.jsx(tt,{disabled:E,children:"Cancel"}),e[105]=E,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=E?"Deleting...":"Delete";let ie;e[109]!==E||e[110]!==ae||e[111]!==Fe?(ie=n.jsx(st,{onClick:ae,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[109]=E,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]!==M||e[124]!==ee||e[125]!==te||e[126]!==me?(ye=n.jsxs("div",{className:M,children:[ee,te,me]}),e[123]=M,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 U.error("Failed to update default brand")}function _t(){return U.error("Failed to delete brand")}function wt(){return U.error("Failed to save brand context")}function Dt(t){return t?.trim()}function Et(t){return t?.trim()}function kt(){const t=X.c(57),{brandExtractEnabled:e}=Ie(),{org:s}=Le();let o;t[0]!==s.id||t[1]!==s.slug?(o={connectionId:Xe,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=o):o=t[2];const l=He(o),r=ze();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:h}=Ke(u),m=(h===void 0?[]:h).filter(At);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(),U.success("Brand created")},t[15]=a,t[16]=g):g=t[16];let p;t[17]!==x||t[18]!==g?(p={mutationFn:x,onSuccess:g,onError:Ft},t[17]=x,t[18]=g,t[19]=p):p=t[19];const{mutate:v,isPending:f}=ge(p);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(),U.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:Bt},t[24]=w,t[25]=C,t[26]=D):D=t[26];const{mutate:y,isPending:N}=ge(D),I=Ne,L=Ne,H=Ne,xe="flex flex-col gap-6";let E;t[27]===Symbol.for("react.memo_cache_sentinel")?(E=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]=E):E=t[27];let k;t[28]!==v?(k=()=>v(),t[28]=v,t[29]=k):k=t[29];let S;t[30]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Pe,{size:14}),t[30]=S):S=t[30];let T;t[31]!==f||t[32]!==k?(T=n.jsxs("div",{className:"flex items-center justify-between",children:[E,n.jsxs(Te,{variant:"outline",onClick:k,disabled:f,children:[S,"Add Brand"]})]}),t[31]=f,t[32]=k,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 q=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"]})]}),M="group space-y-3";let R;t[38]!==l||t[39]!==a?(R=_=>n.jsx(ht,{brand:_,client:l,onChanged:a},_.id),t[38]=l,t[39]=a,t[40]=R):R=t[40];const z=m.map(R);let B;t[41]!==z?(B=n.jsx("div",{className:M,children:z}),t[41]=z,t[42]=B):B=t[42];let K;t[43]!==T||t[44]!==O||t[45]!==q||t[46]!==B?(K=n.jsxs("div",{className:xe,children:[T,O,q,B]}),t[43]=T,t[44]=O,t[45]=q,t[46]=B,t[47]=K):K=t[47];let F;t[48]!==H.Body||t[49]!==K?(F=n.jsx(H.Body,{children:K}),t[48]=H.Body,t[49]=K,t[50]=F):F=t[50];let A;t[51]!==L.Content||t[52]!==F?(A=n.jsx(L.Content,{children:F}),t[51]=L.Content,t[52]=F,t[53]=A):A=t[53];let P;return t[54]!==I||t[55]!==A?(P=n.jsx(I,{children:A}),t[54]=I,t[55]=A,t[56]=P):P=t[56],P}function Bt(t){V("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),U.error(t instanceof Error?t.message:"Failed to extract brand")}function Ft(){return U.error("Failed to create brand")}function At(t){return!t.archivedAt}function ss(){const t=X.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(kt,{})}),t[0]=e):e=t[0],e}export{ss as default};
1
+ import{e as X,T as Ie,p as Le,F as ze,K as Re,m as Ke,a as ge,j as n,B as Te,t as V,n as U,r as Oe,G as Ue,c as _e,C as fe}from"./index-DGGjIheX.js";import{a as Xe,u as He}from"./use-mcp-client-DVIPuDIp.js";import{t as Me}from"./ChevronDown-DwPK2mcP.js";import{i as qe}from"./ChevronRight-pxM9WiYB.js";import{s as Ve,t as Ge}from"./Star01-C3iVmnF7.js";import{n as Qe}from"./LinkExternal01-Zwfdiaw5.js";import{s as Pe}from"./Plus-BCfK0mBl.js";import{s as Ye}from"./Trash01-C89-wTac.js";import{i as Je}from"./Zap-DRqUuFzT.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-CAUF2lG9.js";import{I as ue}from"./input-DYsPOaw4.js";import{T as rt}from"./textarea-DOxc062C.js";import{P as Ne}from"./index-DK5lK69Y.js";import{u as at}from"./use-debounced-autosave-bupcMtLI.js";import{R as it}from"./require-capability-DDdNdDdz.js";import"./auth-BL0nL9hg.js";import"./sidebar-DV_8rP5O.js";import"./LayoutLeft-UZ6_8WBi.js";import"./tooltip-AlbIxSnB.js";import"./sheet-qXjZ6ijq.js";import"./X-ncGdMje6.js";import"./use-capability-JDGz96yw.js";import"./access-gate--AqGaZB3.js";import"./capability-load-error-CgPvQ3DP.js";function $e(t){const e=t;if(e?.isError)throw new Error(e.content?.[0]?.text??"Tool call failed");const s=e?.structuredContent??t,o=s;if(o?.isError)throw new Error(o.content?.[0]?.text??"Tool call failed");return s}function we(t){const e=X.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=X.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 h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=f=>r(f.target.value),e[3]=h):h=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:h,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 p;e[18]!==g||e[19]!==c||e[20]!==a?(p=n.jsxs(Te,{variant:"outline",disabled:c,onClick:a,children:[x,g]}),e[18]=g,e[19]=c,e[20]=a,e[21]=p):p=e[21];let v;return e[22]!==p||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,p]})]})]})}),e[22]=p,e[23]=m,e[24]=v):v=e[24],v}function dt(t){const e=X.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 h;e[6]!==s.control||e[7]!==u?(h=n.jsxs("div",{children:[d,n.jsx(fe,{control:s.control,name:"name",render:u})]}),e[6]=s.control,e[7]=u,e[8]=h):h=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 p;e[23]!==g||e[24]!==h?(p=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h,g]}),e[23]=g,e[24]=h,e[25]=p):p=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]!==p||e[34]!==C?(w=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[p,C]})}),e[33]=p,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 Se(t){const e=X.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 h;e[0]!==s||e[1]!==o?(h=s.watch(o),e[0]=s,e[1]=o,e[2]=h):h=e[2];const b=h;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 p;return e[19]!==m||e[20]!==g?(p=n.jsxs("div",{className:"flex items-start gap-3",children:[m,g]}),e[19]=m,e[20]=g,e[21]=p):p=e[21],p}function ft(t){const e=X.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(Se,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{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=X.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:h}=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:h}),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 ${h.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 pt(t){const e=X.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:h}=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:h})]})}},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 ht(t){const e=X.c(128),{brand:s,client:o,onChanged:l}=t,[r,i]=Oe.useState(s.isDefault??!1),[d,u]=Oe.useState(!1),h=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 p;e[2]!==s.colors?(p=s.colors??{},e[2]=s.colors,e[3]=p):p=e[3];let v;e[4]!==h||e[5]!==b||e[6]!==m||e[7]!==c||e[8]!==a||e[9]!==x||e[10]!==g||e[11]!==p?(v={values:{name:h,domain:b,overview:m,logo:c,favicon:a,ogImage:x,fonts:g,colors:p}},e[4]=h,e[5]=b,e[6]=m,e[7]=c,e[8]=a,e[9]=x,e[10]=g,e[11]=p,e[12]=v):v=e[12];const f=Ue(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(Et),Ce=Object.values(j.colors).some(Dt),Ae={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:Ae})},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(),Ae=f.control._defaultValues;f.reset(Ce,{keepValues:!0});try{await w.mutateAsync(Ce),V("brand_updated",{brand_id:s.id,fields:ve}),U.success("Brand context updated successfully"),l()}catch{f.reset(Ae,{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 L;e[25]!==s.id||e[26]!==l?(L=()=>{V("brand_deleted",{brand_id:s.id}),u(!1),l(),U.success("Brand deleted")},e[25]=s.id,e[26]=l,e[27]=L):L=e[27];let H;e[28]!==I||e[29]!==L?(H={mutationFn:I,onSuccess:L,onError:_t},e[28]=I,e[29]=L,e[30]=H):H=e[30];const{mutate:xe,isPending:E}=ge(H);let k;e[31]!==s.id||e[32]!==s.isDefault||e[33]!==o?(k=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]=k):k=e[34];let S;e[35]!==s.id||e[36]!==s.isDefault||e[37]!==l?(S=()=>{V(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),l(),U.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[35]=s.id,e[36]=s.isDefault,e[37]=l,e[38]=S):S=e[38];let T;e[39]!==k||e[40]!==S?(T={mutationFn:k,onSuccess:S,onError:Nt},e[39]=k,e[40]=S,e[41]=T):T=e[41];const{mutate:O}=ge(T),q=s.isDefault?"border-primary/30":"border-border/60";let M;e[42]!==q?(M=_e("rounded-2xl border bg-background",q),e[42]=q,e[43]=M):M=e[43];let R;e[44]!==r?(R=()=>i(!r),e[44]=r,e[45]=R):R=e[45];let z;e[46]!==r?(z=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(Me,{size:14}):n.jsx(qe,{size:14})}),e[46]=r,e[47]=z):z=e[47];let B;e[48]!==s.logo||e[49]!==s.name?(B=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]=B):B=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 A;e[53]!==s.domain?(A=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[53]=s.domain,e[54]=A):A=e[54];let P;e[55]!==F||e[56]!==A?(P=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[F,A]}),e[55]=F,e[56]=A,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 Ee=s.isDefault?"Unset as default":"Set as default",ke=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[69]!==ke?(J=_e(ke),e[69]=ke,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]!==Ee||e[77]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:Y,title:Ee,children:W}),e[73]=G,e[74]=Q,e[75]=Y,e[76]=Ee,e[77]=W,e[78]=Z):Z=e[78];let pe,he;e[79]===Symbol.for("react.memo_cache_sentinel")?(pe=j=>{j.stopPropagation(),u(!0)},he=j=>{j.key==="Enter"&&(j.stopPropagation(),u(!0))},e[79]=pe,e[80]=he):(pe=e[79],he=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:pe,onKeyDown:he,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]!==z||e[84]!==B||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:[z,B,P,_,$,Z,be]}),e[82]=R,e[83]=z,e[84]=B,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(pt,{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]!==E?(se=j=>{!j&&!E&&u(!1)},e[95]=E,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 Be=s.name||"this brand";let ne;e[98]!==Be?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Be}),". This action cannot be undone."]}),e[98]=Be,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]!==E?(re=n.jsx(tt,{disabled:E,children:"Cancel"}),e[105]=E,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=E?"Deleting...":"Delete";let ie;e[109]!==E||e[110]!==ae||e[111]!==Fe?(ie=n.jsx(st,{onClick:ae,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[109]=E,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]!==M||e[124]!==ee||e[125]!==te||e[126]!==me?(ye=n.jsxs("div",{className:M,children:[ee,te,me]}),e[123]=M,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 U.error("Failed to update default brand")}function _t(){return U.error("Failed to delete brand")}function wt(){return U.error("Failed to save brand context")}function Dt(t){return t?.trim()}function Et(t){return t?.trim()}function kt(){const t=X.c(57),{brandExtractEnabled:e}=Ie(),{org:s}=Le();let o;t[0]!==s.id||t[1]!==s.slug?(o={connectionId:Xe,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=o):o=t[2];const l=He(o),r=ze();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:h}=Ke(u),m=(h===void 0?[]:h).filter(At);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(),U.success("Brand created")},t[15]=a,t[16]=g):g=t[16];let p;t[17]!==x||t[18]!==g?(p={mutationFn:x,onSuccess:g,onError:Ft},t[17]=x,t[18]=g,t[19]=p):p=t[19];const{mutate:v,isPending:f}=ge(p);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(),U.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:Bt},t[24]=w,t[25]=C,t[26]=D):D=t[26];const{mutate:y,isPending:N}=ge(D),I=Ne,L=Ne,H=Ne,xe="flex flex-col gap-6";let E;t[27]===Symbol.for("react.memo_cache_sentinel")?(E=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]=E):E=t[27];let k;t[28]!==v?(k=()=>v(),t[28]=v,t[29]=k):k=t[29];let S;t[30]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Pe,{size:14}),t[30]=S):S=t[30];let T;t[31]!==f||t[32]!==k?(T=n.jsxs("div",{className:"flex items-center justify-between",children:[E,n.jsxs(Te,{variant:"outline",onClick:k,disabled:f,children:[S,"Add Brand"]})]}),t[31]=f,t[32]=k,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 q=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"]})]}),M="group space-y-3";let R;t[38]!==l||t[39]!==a?(R=_=>n.jsx(ht,{brand:_,client:l,onChanged:a},_.id),t[38]=l,t[39]=a,t[40]=R):R=t[40];const z=m.map(R);let B;t[41]!==z?(B=n.jsx("div",{className:M,children:z}),t[41]=z,t[42]=B):B=t[42];let K;t[43]!==T||t[44]!==O||t[45]!==q||t[46]!==B?(K=n.jsxs("div",{className:xe,children:[T,O,q,B]}),t[43]=T,t[44]=O,t[45]=q,t[46]=B,t[47]=K):K=t[47];let F;t[48]!==H.Body||t[49]!==K?(F=n.jsx(H.Body,{children:K}),t[48]=H.Body,t[49]=K,t[50]=F):F=t[50];let A;t[51]!==L.Content||t[52]!==F?(A=n.jsx(L.Content,{children:F}),t[51]=L.Content,t[52]=F,t[53]=A):A=t[53];let P;return t[54]!==I||t[55]!==A?(P=n.jsx(I,{children:A}),t[54]=I,t[55]=A,t[56]=P):P=t[56],P}function Bt(t){V("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),U.error(t instanceof Error?t.message:"Failed to extract brand")}function Ft(){return U.error("Failed to create brand")}function At(t){return!t.archivedAt}function ss(){const t=X.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(kt,{})}),t[0]=e):e=t[0],e}export{ss as default};
@@ -1 +1 @@
1
- import{e as D,j as t,E as V,r as v,B as F,n as _}from"./index-D7zMM4W4.js";import{i as J}from"./AlertCircle-diUVbO2-.js";import{i as O}from"./HardDrive-DsvvHov8.js";import{s as L}from"./Plus-CKCNLZUU.js";import{s as Q}from"./Trash01-ysxYI5Wr.js";import{f as X,g as Y,c as Z,b as ee,d as te,e as se,a as ie,A as re}from"./alert-dialog-Czjj9xUL.js";import{D as ne,a as le,b as ae,c as oe,e as ce,d as de}from"./dialog-BQ75yEwF.js";import{I as N}from"./input-DlpqEr8E.js";import{L as C}from"./label-BCg8KKvZ.js";import{d as me,S as fe,a as ue,b as xe,c as q}from"./select-BTJH3S1Y.js";import{S as pe}from"./switch-DJP3r5vJ.js";import{S as he}from"./skeleton-DWiCZKLu.js";import{T as ge}from"./textarea-Bc-j0SM5.js";import{P}from"./index-CfcqKeX1.js";import{c as je}from"./settings-section-B5i82NgR.js";import{u as ye,a as be,b as ve}from"./use-file-configs-DihB1CSn.js";import{R as Se}from"./require-capability-siE8o61Y.js";import"./X-Dk_6ic2Z.js";import"./tooltip-B5iep7Ko.js";import"./Check-BKIJF1cF.js";import"./ChevronDown-CibD7WLD.js";import"./ChevronUp-DGD0GGvF.js";import"./sidebar-vUZgGPF7.js";import"./LayoutLeft-RNub1vlB.js";import"./sheet-CCipW2FH.js";import"./card-DdkEdLE9.js";import"./ArrowUpRight-DZao7AcN.js";import"./studio-tools-LMNN2joX.js";import"./use-capability-DXVx5Xxx.js";import"./access-gate-ngcc1WVS.js";import"./capability-load-error-BU8SCPcT.js";function Ce(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 ke(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(J,{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 Ne(s){const e=D.c(44),{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(O,{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.credentialType?(o=i.credentialType==="sts-session"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"STS"}):null,e[3]=i.credentialType,e[4]=o):o=e[4];let g;e[5]!==i.bucket||e[6]!==i.region?(g=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[5]=i.bucket,e[6]=i.region,e[7]=g):g=e[7];let c;e[8]!==l||e[9]!==o||e[10]!==g?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o,g]}),e[8]=l,e[9]=o,e[10]=g,e[11]=c):c=e[11];let b;e[12]!==i.description?(b=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[12]=i.description,e[13]=b):b=e[13];let j;e[14]!==i.endpoint||e[15]!==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[14]=i.endpoint,e[15]=i.forcePathStyle,e[16]=j):j=e[16];let d;e[17]!==i.prefix?(d=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[17]=i.prefix,e[18]=d):d=e[18];let m;e[19]!==i.publicUrlBase?(m=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[19]=i.publicUrlBase,e[20]=m):m=e[20];let y;e[21]!==c||e[22]!==b||e[23]!==j||e[24]!==d||e[25]!==m?(y=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[c,b,j,d,m]})]}),e[21]=c,e[22]=b,e[23]=j,e[24]=d,e[25]=m,e[26]=y):y=e[26];let u;e[27]!==i.createdAt?(u=new Date(i.createdAt).toLocaleDateString(),e[27]=i.createdAt,e[28]=u):u=e[28];let f;e[29]!==u?(f=t.jsx("span",{className:"text-xs text-muted-foreground",children:u}),e[29]=u,e[30]=f):f=e[30];let x;e[31]!==i||e[32]!==n?(x=()=>n(i),e[31]=i,e[32]=n,e[33]=x):x=e[33];const p=`Delete ${i.name}`;let h;e[34]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Q,{size:14}),e[34]=h):h=e[34];let k;e[35]!==x||e[36]!==p?(k=t.jsx(F,{variant:"ghost",size:"sm",onClick:x,"aria-label":p,children:h}),e[35]=x,e[36]=p,e[37]=k):k=e[37];let S;e[38]!==f||e[39]!==k?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f,k]}),e[38]=f,e[39]=k,e[40]=S):S=e[40];let A;return e[41]!==y||e[42]!==S?(A=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[y,S]}),e[41]=y,e[42]=S,e[43]=A):A=e[43],A}function Ae(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(O,{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(L,{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(F,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function K({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,g]=v.useState(""),[c,b]=v.useState(""),[j,d]=v.useState(""),[m,y]=v.useState(!1),[u,f]=v.useState(""),[x,p]=v.useState(""),[h,k]=v.useState("static"),[S,A]=v.useState(""),[R,I]=v.useState(""),[T,U]=v.useState(""),[B,E]=v.useState(""),w=be();function $(){n(""),l(""),g(""),b(""),d(""),y(!1),f(""),p(""),k("static"),A(""),I(""),U(""),E("")}const z=h==="sts-session"?!!(T.trim()&&B.trim()):!!(S&&R);async function M(a){if(a.preventDefault(),!i.trim()||!o.trim()||!c.trim()||!z)return;const W=h==="sts-session"?{credentialType:"sts-session",refreshUrl:T.trim(),apiKey:B.trim()}:{credentialType:"static",accessKeyId:S,secretAccessKey:R};try{await w.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:c.trim(),endpoint:j.trim()||void 0,forcePathStyle:m,prefix:u.trim()||void 0,publicUrlBase:x.trim()||void 0,...W}),_.success(`Bucket "${i.trim()}" added`),$(),e(!1)}catch(H){_.error(Ce(H,"Failed to add bucket"))}}const G=w.isPending||!i.trim()||!o.trim()||!c.trim()||!z;return t.jsx(ne,{open:s,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(ae,{children:[t.jsx(oe,{children:"Add S3 bucket"}),t.jsx(ce,{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:M,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:a=>n(a.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(C,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:a=>g(a.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:c,onChange:a=>b(a.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:j,onChange:a=>d(a.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(C,{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(pe,{id:"file-config-path-style",checked:m,onCheckedChange:y})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:u,onChange:a=>f(a.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(C,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:x,onChange:a=>p(a.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(C,{htmlFor:"file-config-credential-type",children:"Credentials"}),t.jsxs(me,{value:h,onValueChange:a=>k(a),children:[t.jsx(fe,{id:"file-config-credential-type",className:"w-full",children:t.jsx(ue,{})}),t.jsxs(xe,{children:[t.jsx(q,{value:"static",children:"Static key pair (long-lived)"}),t.jsx(q,{value:"sts-session",children:"Temporary session (STS, auto-refreshed)"})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:h==="sts-session"?"Stores only a refresh endpoint + API key; short-lived credentials are fetched on demand and refreshed automatically.":"A long-lived access key ID and secret, used as-is."})]}),h==="static"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:S,onChange:a=>A(a.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:R,onChange:a=>I(a.target.value),autoComplete:"new-password",required:!0})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-refresh-url",children:"Refresh URL"}),t.jsx(N,{id:"file-config-refresh-url",type:"url",value:T,onChange:a=>U(a.target.value),placeholder:"https://admin.example.com/api/acme/s3-credentials",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Endpoint POSTed (with the API key below) to vend temporary credentials. Must return accessKeyId, secretAccessKey, sessionToken, and expiration."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-api-key",children:"API key"}),t.jsx(N,{id:"file-config-api-key",type:"password",value:B,onChange:a=>E(a.target.value),autoComplete:"new-password",required:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent as the ",t.jsx("code",{children:"x-api-key"})," header on each refresh call."]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(ge,{id:"file-config-description",value:r,onChange:a=>l(a.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(de,{children:[t.jsx(F,{type:"button",variant:"outline",onClick:()=>{$(),e(!1)},disabled:w.isPending,children:"Cancel"}),t.jsx(F,{type:"submit",disabled:G,children:w.isPending?"Adding…":"Add bucket"})]})]})]})})}function De(s){const e=D.c(25),{config:i,onClose:n}=s,r=ve();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),_.success(`Bucket "${i.name}" removed`),n()}catch(k){const S=k;_.error(S instanceof Error?S.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,g=i!==null;let c;e[4]!==n?(c=h=>!h&&n(),e[4]=n,e[5]=c):c=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Z,{children:"Remove bucket configuration?"}),e[6]=b):b=e[6];const j=i?.name;let d;e[7]!==j?(d=t.jsxs(ee,{children:[b,t.jsxs(te,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:j}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=j,e[8]=d):d=e[8];let m;e[9]!==r.isPending?(m=t.jsx(X,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=m):m=e[10];const y=r.isPending?"Removing…":"Remove";let u;e[11]!==r.isPending||e[12]!==o||e[13]!==y?(u=t.jsx(Y,{onClick:o,disabled:r.isPending,children:y}),e[11]=r.isPending,e[12]=o,e[13]=y,e[14]=u):u=e[14];let f;e[15]!==m||e[16]!==u?(f=t.jsxs(se,{children:[m,u]}),e[15]=m,e[16]=u,e[17]=f):f=e[17];let x;e[18]!==f||e[19]!==d?(x=t.jsxs(ie,{children:[d,f]}),e[18]=f,e[19]=d,e[20]=x):x=e[20];let p;return e[21]!==x||e[22]!==g||e[23]!==c?(p=t.jsx(re,{open:g,onOpenChange:c,children:x}),e[21]=x,e[22]=g,e[23]=c,e[24]=p):p=e[24],p}function Fe(){const s=D.c(25),e=ye(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let p;s[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ae,{onCreate:()=>n(!0)}),s[0]=p):p=s[0];let h;return s[1]!==i?(h=t.jsxs(t.Fragment,{children:[p,t.jsx(K,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=h):h=s[2],h}const o=e.length===1?"":"s";let g;s[3]!==e.length||s[4]!==o?(g=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=g):g=s[5];let c;s[6]===Symbol.for("react.memo_cache_sentinel")?(c=()=>n(!0),s[6]=c):c=s[6];let b;s[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs(F,{onClick:c,size:"sm",children:[t.jsx(L,{size:14}),"Add bucket"]}),s[7]=b):b=s[7];let j;s[8]!==g?(j=t.jsxs("div",{className:"flex items-center justify-between",children:[g,b]}),s[8]=g,s[9]=j):j=s[9];let d;if(s[10]!==e){let p;s[12]===Symbol.for("react.memo_cache_sentinel")?(p=h=>t.jsx(Ne,{config:h,onDelete:l},h.id),s[12]=p):p=s[12],d=e.map(p),s[10]=e,s[11]=d}else d=s[11];let m;s[13]!==d?(m=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:d})}),s[13]=d,s[14]=m):m=s[14];let y;s[15]!==i?(y=t.jsx(K,{open:i,onOpenChange:n}),s[15]=i,s[16]=y):y=s[16];let u;s[17]===Symbol.for("react.memo_cache_sentinel")?(u=()=>l(null),s[17]=u):u=s[17];let f;s[18]!==r?(f=t.jsx(De,{config:r,onClose:u}),s[18]=r,s[19]=f):f=s[19];let x;return s[20]!==j||s[21]!==m||s[22]!==y||s[23]!==f?(x=t.jsxs(t.Fragment,{children:[j,m,y,f]}),s[20]=j,s[21]=m,s[22]=y,s[23]=f,s[24]=x):x=s[24],x}function we(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(P.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(P,{children:t.jsx(P.Content,{children:t.jsx(P.Body,{children:t.jsxs(je,{children:[e,t.jsx(V,{fallback:Pe,children:t.jsx(v.Suspense,{fallback:t.jsx(he,{className:"h-32 w-full"}),children:t.jsx(Fe,{})})})]})})})}),s[1]=i):i=s[1],i}function Pe(s){const{error:e}=s;return t.jsx(ke,{error:e??new Error("Failed to load file configs")})}function ot(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Se,{capability:"file-configs:manage",area:"files",children:t.jsx(we,{})}),s[0]=e):e=s[0],e}export{ot as default};
1
+ import{e as D,j as t,E as V,r as v,B as F,n as _}from"./index-DGGjIheX.js";import{i as J}from"./AlertCircle-B8wgh1Ly.js";import{i as O}from"./HardDrive-B_FOclPu.js";import{s as L}from"./Plus-BCfK0mBl.js";import{s as Q}from"./Trash01-C89-wTac.js";import{f as X,g as Y,c as Z,b as ee,d as te,e as se,a as ie,A as re}from"./alert-dialog-CAUF2lG9.js";import{D as ne,a as le,b as ae,c as oe,e as ce,d as de}from"./dialog-NPdsRr2K.js";import{I as N}from"./input-DYsPOaw4.js";import{L as C}from"./label-Mdkg-a4K.js";import{d as me,S as fe,a as ue,b as xe,c as q}from"./select-DIImlu5H.js";import{S as pe}from"./switch-BLdRz6LH.js";import{S as he}from"./skeleton-BAqUrlIk.js";import{T as ge}from"./textarea-DOxc062C.js";import{P}from"./index-DK5lK69Y.js";import{c as je}from"./settings-section-8TfsFzZk.js";import{u as ye,a as be,b as ve}from"./use-file-configs-B-TRPlGa.js";import{R as Se}from"./require-capability-DDdNdDdz.js";import"./X-ncGdMje6.js";import"./tooltip-AlbIxSnB.js";import"./Check-D0urCyzd.js";import"./ChevronDown-DwPK2mcP.js";import"./ChevronUp-DNp3BStr.js";import"./sidebar-DV_8rP5O.js";import"./LayoutLeft-UZ6_8WBi.js";import"./sheet-qXjZ6ijq.js";import"./card-CSrfjLPK.js";import"./ArrowUpRight-DFourmXp.js";import"./studio-tools-VmDH_tkD.js";import"./use-capability-JDGz96yw.js";import"./access-gate--AqGaZB3.js";import"./capability-load-error-CgPvQ3DP.js";function Ce(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 ke(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(J,{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 Ne(s){const e=D.c(44),{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(O,{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.credentialType?(o=i.credentialType==="sts-session"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"STS"}):null,e[3]=i.credentialType,e[4]=o):o=e[4];let g;e[5]!==i.bucket||e[6]!==i.region?(g=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[5]=i.bucket,e[6]=i.region,e[7]=g):g=e[7];let c;e[8]!==l||e[9]!==o||e[10]!==g?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o,g]}),e[8]=l,e[9]=o,e[10]=g,e[11]=c):c=e[11];let b;e[12]!==i.description?(b=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[12]=i.description,e[13]=b):b=e[13];let j;e[14]!==i.endpoint||e[15]!==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[14]=i.endpoint,e[15]=i.forcePathStyle,e[16]=j):j=e[16];let d;e[17]!==i.prefix?(d=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[17]=i.prefix,e[18]=d):d=e[18];let m;e[19]!==i.publicUrlBase?(m=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[19]=i.publicUrlBase,e[20]=m):m=e[20];let y;e[21]!==c||e[22]!==b||e[23]!==j||e[24]!==d||e[25]!==m?(y=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[c,b,j,d,m]})]}),e[21]=c,e[22]=b,e[23]=j,e[24]=d,e[25]=m,e[26]=y):y=e[26];let u;e[27]!==i.createdAt?(u=new Date(i.createdAt).toLocaleDateString(),e[27]=i.createdAt,e[28]=u):u=e[28];let f;e[29]!==u?(f=t.jsx("span",{className:"text-xs text-muted-foreground",children:u}),e[29]=u,e[30]=f):f=e[30];let x;e[31]!==i||e[32]!==n?(x=()=>n(i),e[31]=i,e[32]=n,e[33]=x):x=e[33];const p=`Delete ${i.name}`;let h;e[34]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Q,{size:14}),e[34]=h):h=e[34];let k;e[35]!==x||e[36]!==p?(k=t.jsx(F,{variant:"ghost",size:"sm",onClick:x,"aria-label":p,children:h}),e[35]=x,e[36]=p,e[37]=k):k=e[37];let S;e[38]!==f||e[39]!==k?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f,k]}),e[38]=f,e[39]=k,e[40]=S):S=e[40];let A;return e[41]!==y||e[42]!==S?(A=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[y,S]}),e[41]=y,e[42]=S,e[43]=A):A=e[43],A}function Ae(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(O,{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(L,{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(F,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function K({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,g]=v.useState(""),[c,b]=v.useState(""),[j,d]=v.useState(""),[m,y]=v.useState(!1),[u,f]=v.useState(""),[x,p]=v.useState(""),[h,k]=v.useState("static"),[S,A]=v.useState(""),[R,I]=v.useState(""),[T,U]=v.useState(""),[B,E]=v.useState(""),w=be();function $(){n(""),l(""),g(""),b(""),d(""),y(!1),f(""),p(""),k("static"),A(""),I(""),U(""),E("")}const z=h==="sts-session"?!!(T.trim()&&B.trim()):!!(S&&R);async function M(a){if(a.preventDefault(),!i.trim()||!o.trim()||!c.trim()||!z)return;const W=h==="sts-session"?{credentialType:"sts-session",refreshUrl:T.trim(),apiKey:B.trim()}:{credentialType:"static",accessKeyId:S,secretAccessKey:R};try{await w.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:c.trim(),endpoint:j.trim()||void 0,forcePathStyle:m,prefix:u.trim()||void 0,publicUrlBase:x.trim()||void 0,...W}),_.success(`Bucket "${i.trim()}" added`),$(),e(!1)}catch(H){_.error(Ce(H,"Failed to add bucket"))}}const G=w.isPending||!i.trim()||!o.trim()||!c.trim()||!z;return t.jsx(ne,{open:s,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(ae,{children:[t.jsx(oe,{children:"Add S3 bucket"}),t.jsx(ce,{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:M,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:a=>n(a.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(C,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:a=>g(a.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:c,onChange:a=>b(a.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:j,onChange:a=>d(a.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(C,{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(pe,{id:"file-config-path-style",checked:m,onCheckedChange:y})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:u,onChange:a=>f(a.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(C,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:x,onChange:a=>p(a.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(C,{htmlFor:"file-config-credential-type",children:"Credentials"}),t.jsxs(me,{value:h,onValueChange:a=>k(a),children:[t.jsx(fe,{id:"file-config-credential-type",className:"w-full",children:t.jsx(ue,{})}),t.jsxs(xe,{children:[t.jsx(q,{value:"static",children:"Static key pair (long-lived)"}),t.jsx(q,{value:"sts-session",children:"Temporary session (STS, auto-refreshed)"})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:h==="sts-session"?"Stores only a refresh endpoint + API key; short-lived credentials are fetched on demand and refreshed automatically.":"A long-lived access key ID and secret, used as-is."})]}),h==="static"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:S,onChange:a=>A(a.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:R,onChange:a=>I(a.target.value),autoComplete:"new-password",required:!0})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-refresh-url",children:"Refresh URL"}),t.jsx(N,{id:"file-config-refresh-url",type:"url",value:T,onChange:a=>U(a.target.value),placeholder:"https://admin.example.com/api/acme/s3-credentials",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Endpoint POSTed (with the API key below) to vend temporary credentials. Must return accessKeyId, secretAccessKey, sessionToken, and expiration."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-api-key",children:"API key"}),t.jsx(N,{id:"file-config-api-key",type:"password",value:B,onChange:a=>E(a.target.value),autoComplete:"new-password",required:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent as the ",t.jsx("code",{children:"x-api-key"})," header on each refresh call."]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(ge,{id:"file-config-description",value:r,onChange:a=>l(a.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(de,{children:[t.jsx(F,{type:"button",variant:"outline",onClick:()=>{$(),e(!1)},disabled:w.isPending,children:"Cancel"}),t.jsx(F,{type:"submit",disabled:G,children:w.isPending?"Adding…":"Add bucket"})]})]})]})})}function De(s){const e=D.c(25),{config:i,onClose:n}=s,r=ve();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),_.success(`Bucket "${i.name}" removed`),n()}catch(k){const S=k;_.error(S instanceof Error?S.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,g=i!==null;let c;e[4]!==n?(c=h=>!h&&n(),e[4]=n,e[5]=c):c=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Z,{children:"Remove bucket configuration?"}),e[6]=b):b=e[6];const j=i?.name;let d;e[7]!==j?(d=t.jsxs(ee,{children:[b,t.jsxs(te,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:j}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=j,e[8]=d):d=e[8];let m;e[9]!==r.isPending?(m=t.jsx(X,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=m):m=e[10];const y=r.isPending?"Removing…":"Remove";let u;e[11]!==r.isPending||e[12]!==o||e[13]!==y?(u=t.jsx(Y,{onClick:o,disabled:r.isPending,children:y}),e[11]=r.isPending,e[12]=o,e[13]=y,e[14]=u):u=e[14];let f;e[15]!==m||e[16]!==u?(f=t.jsxs(se,{children:[m,u]}),e[15]=m,e[16]=u,e[17]=f):f=e[17];let x;e[18]!==f||e[19]!==d?(x=t.jsxs(ie,{children:[d,f]}),e[18]=f,e[19]=d,e[20]=x):x=e[20];let p;return e[21]!==x||e[22]!==g||e[23]!==c?(p=t.jsx(re,{open:g,onOpenChange:c,children:x}),e[21]=x,e[22]=g,e[23]=c,e[24]=p):p=e[24],p}function Fe(){const s=D.c(25),e=ye(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let p;s[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ae,{onCreate:()=>n(!0)}),s[0]=p):p=s[0];let h;return s[1]!==i?(h=t.jsxs(t.Fragment,{children:[p,t.jsx(K,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=h):h=s[2],h}const o=e.length===1?"":"s";let g;s[3]!==e.length||s[4]!==o?(g=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=g):g=s[5];let c;s[6]===Symbol.for("react.memo_cache_sentinel")?(c=()=>n(!0),s[6]=c):c=s[6];let b;s[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs(F,{onClick:c,size:"sm",children:[t.jsx(L,{size:14}),"Add bucket"]}),s[7]=b):b=s[7];let j;s[8]!==g?(j=t.jsxs("div",{className:"flex items-center justify-between",children:[g,b]}),s[8]=g,s[9]=j):j=s[9];let d;if(s[10]!==e){let p;s[12]===Symbol.for("react.memo_cache_sentinel")?(p=h=>t.jsx(Ne,{config:h,onDelete:l},h.id),s[12]=p):p=s[12],d=e.map(p),s[10]=e,s[11]=d}else d=s[11];let m;s[13]!==d?(m=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:d})}),s[13]=d,s[14]=m):m=s[14];let y;s[15]!==i?(y=t.jsx(K,{open:i,onOpenChange:n}),s[15]=i,s[16]=y):y=s[16];let u;s[17]===Symbol.for("react.memo_cache_sentinel")?(u=()=>l(null),s[17]=u):u=s[17];let f;s[18]!==r?(f=t.jsx(De,{config:r,onClose:u}),s[18]=r,s[19]=f):f=s[19];let x;return s[20]!==j||s[21]!==m||s[22]!==y||s[23]!==f?(x=t.jsxs(t.Fragment,{children:[j,m,y,f]}),s[20]=j,s[21]=m,s[22]=y,s[23]=f,s[24]=x):x=s[24],x}function we(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(P.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(P,{children:t.jsx(P.Content,{children:t.jsx(P.Body,{children:t.jsxs(je,{children:[e,t.jsx(V,{fallback:Pe,children:t.jsx(v.Suspense,{fallback:t.jsx(he,{className:"h-32 w-full"}),children:t.jsx(Fe,{})})})]})})})}),s[1]=i):i=s[1],i}function Pe(s){const{error:e}=s;return t.jsx(ke,{error:e??new Error("Failed to load file configs")})}function ot(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Se,{capability:"file-configs:manage",area:"files",children:t.jsx(we,{})}),s[0]=e):e=s[0],e}export{ot as default};