decocms 2.330.0 → 2.330.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/dist/client/assets/{AlertCircle-DzuAM8Ts.js → AlertCircle-D_INSRN8.js} +1 -1
  2. package/dist/client/assets/{Archive-BDH1Dswp.js → Archive-hv8eiJor.js} +1 -1
  3. package/dist/client/assets/{ArrowNarrowLeft-Bmb7olbY.js → ArrowNarrowLeft-DhFfnYk7.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-DcUWATTI.js → ArrowUpRight-9Ai9aon6.js} +1 -1
  5. package/dist/client/assets/{Check-D6DtmAYz.js → Check-dlY8e2Ho.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-CjDCEsTA.js → CheckCircle-ZwSrc_V3.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-BQEZBz5I.js → ChevronDown-Cw9ngzw7.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-W_JRVCsB.js → ChevronRight-BfR151jd.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-0UdtzCuO.js → ChevronUp-TLiygZdx.js} +1 -1
  10. package/dist/client/assets/{Container-CAHcYnEg.js → Container-TZxpYYVB.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-EAv-owu7.js → DotsVertical-Ou7LbJND.js} +1 -1
  12. package/dist/client/assets/{LayoutLeft-IDRLtOjX.js → LayoutLeft-Dbfut965.js} +1 -1
  13. package/dist/client/assets/{LinkExternal01-j3B7-hx8.js → LinkExternal01-DC7EGXJS.js} +1 -1
  14. package/dist/client/assets/{Lock01-SfDe88qn.js → Lock01-B2dFGh2K.js} +1 -1
  15. package/dist/client/assets/{Palette-CqCsrryh.js → Palette-C0vJNXPA.js} +1 -1
  16. package/dist/client/assets/{Play-CnTvC9yX.js → Play-BY55Ek61.js} +1 -1
  17. package/dist/client/assets/{Plus-DPd13c1m.js → Plus-tONXYA9f.js} +1 -1
  18. package/dist/client/assets/{RefreshCcw01-BYmTCqrQ.js → RefreshCcw01-COhnBWDC.js} +1 -1
  19. package/dist/client/assets/{SearchMd-Dh7KD_0m.js → SearchMd-CvmqhL6H.js} +1 -1
  20. package/dist/client/assets/{Settings02-Dc5nQYki.js → Settings02-DCIs2aB_.js} +1 -1
  21. package/dist/client/assets/{Shield01-DX8JclwA.js → Shield01-mgeNQ2VV.js} +1 -1
  22. package/dist/client/assets/{Star01-BTd7uzv1.js → Star01-Y755IVMR.js} +1 -1
  23. package/dist/client/assets/{Sun-jEuMiwZd.js → Sun-e35YL1rR.js} +1 -1
  24. package/dist/client/assets/{Tool01-CC7E7i0z.js → Tool01-DHg5BBnf.js} +1 -1
  25. package/dist/client/assets/{Trash01-D2xRqKfO.js → Trash01-B6SxNvU3.js} +1 -1
  26. package/dist/client/assets/{Upload01-43iSsXQQ.js → Upload01-CYxSnGGr.js} +1 -1
  27. package/dist/client/assets/{User01-c_Asv58w.js → User01-BYrF92KE.js} +1 -1
  28. package/dist/client/assets/{Users03-C1-L9z2i.js → Users03-CUFFCyXr.js} +1 -1
  29. package/dist/client/assets/{X-DTT-z90W.js → X-C8Bj97my.js} +1 -1
  30. package/dist/client/assets/{XCircle-BqSNivAk.js → XCircle-Cs4Fr8x-.js} +1 -1
  31. package/dist/client/assets/{XClose-BvJMELx2.js → XClose-BgdRSEZn.js} +1 -1
  32. package/dist/client/assets/{Zap-KD6eR0oK.js → Zap-Bevu_d3X.js} +1 -1
  33. package/dist/client/assets/{ZapSquare-D0un1xlb.js → ZapSquare-Do5pKYHa.js} +1 -1
  34. package/dist/client/assets/{accordion-wpzsKEQA.js → accordion-CLeAxR1X.js} +1 -1
  35. package/dist/client/assets/{agent-icon-Bf-mJf1h.js → agent-icon-0yz7Dosu.js} +1 -1
  36. package/dist/client/assets/{agents-list-Rk84qi5_.js → agents-list-ByM9sf21.js} +1 -1
  37. package/dist/client/assets/{ai-providers-Ch9VXdmL.js → ai-providers-BJbcBW-t.js} +1 -1
  38. package/dist/client/assets/{alert-dialog-1jsNudB5.js → alert-dialog-qwFc5CCL.js} +1 -1
  39. package/dist/client/assets/{auth-catchall-C5zyGG89.js → auth-catchall-DJHymmlM.js} +1 -1
  40. package/dist/client/assets/{auth-split-layout-C5mvcCAs.js → auth-split-layout-B_G3Mw4x.js} +1 -1
  41. package/dist/client/assets/{automation-list-row-DXsgFyeD.js → automation-list-row-DgrPu5-J.js} +1 -1
  42. package/dist/client/assets/{automations-B00CxNwL.js → automations-CFvywS1_.js} +1 -1
  43. package/dist/client/assets/{avatar-D8FGI6L7.js → avatar-BGzCI6Pz.js} +1 -1
  44. package/dist/client/assets/{badge-CHFfTDkx.js → badge-BFgmLB6r.js} +1 -1
  45. package/dist/client/assets/{brand-context-32F2vYxq.js → brand-context-Bsv5LzVQ.js} +1 -1
  46. package/dist/client/assets/{card-M99xY5Ij.js → card-um3TY69s.js} +1 -1
  47. package/dist/client/assets/{chat-context-BWP0L-4o.js → chat-context-COuQh22R.js} +1 -1
  48. package/dist/client/assets/{checkbox-1zI1an2L.js → checkbox-D4Jr7ySt.js} +1 -1
  49. package/dist/client/assets/{collection-detail-DPAa_Jxh.js → collection-detail-DRY2sMWp.js} +1 -1
  50. package/dist/client/assets/{collection-display-button-lENJyZQL.js → collection-display-button-C_0gHzsd.js} +1 -1
  51. package/dist/client/assets/{collection-search-BbX02Vt9.js → collection-search-5TnOhjQK.js} +1 -1
  52. package/dist/client/assets/{collection-search-Cu9lkdI6.js → collection-search-Bs1XbNRa.js} +1 -1
  53. package/dist/client/assets/{collection-table-wrapper-DOjzjRHz.js → collection-table-wrapper-L-3RXpbY.js} +1 -1
  54. package/dist/client/assets/{collection-tabs-CklGlAHz.js → collection-tabs-CDpY01rL.js} +1 -1
  55. package/dist/client/assets/{collections-Cj5K9IFm.js → collections-Cy1wKVsb.js} +1 -1
  56. package/dist/client/assets/{command-AVrUDknH.js → command-Dr1S6n_q.js} +1 -1
  57. package/dist/client/assets/{connection-card-dG1gvcfw.js → connection-card-DFcnQBIx.js} +1 -1
  58. package/dist/client/assets/{connection-detail-BreqhOne.js → connection-detail-DzhDmPXa.js} +1 -1
  59. package/dist/client/assets/{connection-form-helpers-BHm9qvan.js → connection-form-helpers-u0rrd0BU.js} +1 -1
  60. package/dist/client/assets/{connections-X8BOYR2c.js → connections-C43gHQHK.js} +1 -1
  61. package/dist/client/assets/{constants-DdO-uSXG.js → constants-B9APhgxz.js} +1 -1
  62. package/dist/client/assets/{constants-DK6-FgDX.js → constants-BjyyTXnH.js} +1 -1
  63. package/dist/client/assets/{dialog-DKLqkTro.js → dialog-BPWWf_z7.js} +1 -1
  64. package/dist/client/assets/{domain-settings-C9qsDXWB.js → domain-settings-8k4JYeoL.js} +1 -1
  65. package/dist/client/assets/{drawer-H55NP4R-.js → drawer-BlRlQn9T.js} +1 -1
  66. package/dist/client/assets/{dropdown-menu-mFwKSfJW.js → dropdown-menu-Dp_8NT82.js} +1 -1
  67. package/dist/client/assets/{dynamic-plugin-layout-CodQjmGD.js → dynamic-plugin-layout-BXYVZmaA.js} +1 -1
  68. package/dist/client/assets/{empty-state-sTUmdNAV.js → empty-state-DAxQYPL-.js} +1 -1
  69. package/dist/client/assets/{empty-state-M6KhVXj7.js → empty-state-DaHA56PP.js} +1 -1
  70. package/dist/client/assets/{extract-connection-data-Fzjrvq-Y.js → extract-connection-data-DCcXYZQ5.js} +1 -1
  71. package/dist/client/assets/{features-t235iBCX.js → features-wVLym6TJ.js} +1 -1
  72. package/dist/client/assets/{form-Dnh_68v3.js → form-DGRQji8F.js} +1 -1
  73. package/dist/client/assets/{general-BT1DEreb.js → general-CAZAuJP3.js} +1 -1
  74. package/dist/client/assets/{index-fAesIntL.js → index-92KX-oMD.js} +1 -1
  75. package/dist/client/assets/{index-52GnFl_O.js → index-B1e-m7TH.js} +1 -1
  76. package/dist/client/assets/{index-Bg3h9DSa.css → index-BGIpZFyP.css} +1 -1
  77. package/dist/client/assets/{index-B2-K2yJt.js → index-CU2mMxYg.js} +1 -1
  78. package/dist/client/assets/{index-CB0kKfpJ.js → index-CW81S5SP.js} +1 -1
  79. package/dist/client/assets/{index-CaB42iwv.js → index-Ct_ZVBZo.js} +1 -1
  80. package/dist/client/assets/{index-F296X3Sq.js → index-CxDGuN9P.js} +2 -2
  81. package/dist/client/assets/{index-CXpTUfZQ.js → index-DCcOV8WL.js} +1 -1
  82. package/dist/client/assets/{index-DwpTcFSf.js → index-DNMdaPSW.js} +1 -1
  83. package/dist/client/assets/{index-Djpto450.js → index-DXGWl53B.js} +1 -1
  84. package/dist/client/assets/{index-20auhCJb.js → index-DXSYIzHm.js} +1 -1
  85. package/dist/client/assets/{index-BW5oXiOF.js → index-Dk5AlIgx.js} +2 -2
  86. package/dist/client/assets/{index-CfxeuG-C.js → index-IMNzHG--.js} +3 -3
  87. package/dist/client/assets/{index-VfHF0s-6.js → index-Jqg1d2lv.js} +1 -1
  88. package/dist/client/assets/{index-YTibzsnP.js → index-MCkNdbA2.js} +1 -1
  89. package/dist/client/assets/{index-AVz4LXaJ.js → index-SCfxtLIU.js} +1 -1
  90. package/dist/client/assets/{index-CLSLc3kK.js → index-bnxUXqc9.js} +1 -1
  91. package/dist/client/assets/{infiniteQueryObserver-ChWYWWbe.js → infiniteQueryObserver-BYmvvZLY.js} +1 -1
  92. package/dist/client/assets/{input-IQBUa_cI.js → input-C9pPBwxY.js} +1 -1
  93. package/dist/client/assets/{integration-icon-mQ_J6kU4.js → integration-icon-CNgai9ER.js} +1 -1
  94. package/dist/client/assets/{label-BnWIwDeW.js → label-_Kk4PYag.js} +1 -1
  95. package/dist/client/assets/{layout-C-U7OZiG.js → layout-C7rDP8J7.js} +1 -1
  96. package/dist/client/assets/{lean-canvas-recruit-modal-DqzxwaiI.js → lean-canvas-recruit-modal-Bhm-Amf2.js} +1 -1
  97. package/dist/client/assets/{login-COdNUv8E.js → login-C8-CeGeL.js} +1 -1
  98. package/dist/client/assets/{members-BTk5NIcA.js → members-DFhjYmWg.js} +1 -1
  99. package/dist/client/assets/{monaco-editor-BhngwT5D.js → monaco-editor-BZaWZju1.js} +1 -1
  100. package/dist/client/assets/{monitoring-stats-row-D9G7l6Ho.js → monitoring-stats-row-BWIqBSBV.js} +1 -1
  101. package/dist/client/assets/{oauth-callback-DGaM3FRM.js → oauth-callback-Dw_hUfOe.js} +1 -1
  102. package/dist/client/assets/{oauth-callback-ai-provider-CzRLvqiw.js → oauth-callback-ai-provider-BYgoqGp3.js} +1 -1
  103. package/dist/client/assets/{onboarding-CT3X-AWs.js → onboarding-DRieBUiV.js} +1 -1
  104. package/dist/client/assets/{org-layout-kMNjoQdP.js → org-layout-BtxVMtIc.js} +1 -1
  105. package/dist/client/assets/{org-plugin-layout-BntDifaf.js → org-plugin-layout-ji7SHKdA.js} +1 -1
  106. package/dist/client/assets/{pair-CSM05GR-.js → pair-C76DvqJ7.js} +1 -1
  107. package/dist/client/assets/{plugin-empty-state-DiRtDtz2.js → plugin-empty-state-D_zR3YSs.js} +1 -1
  108. package/dist/client/assets/{plugin-header-CumlGsMi.js → plugin-header-DBHEEKeG.js} +1 -1
  109. package/dist/client/assets/{plugin-layout-02_5Qhop.js → plugin-layout-DADelhka.js} +1 -1
  110. package/dist/client/assets/{popover-Dua0iOiu.js → popover-Cfh0Iugp.js} +1 -1
  111. package/dist/client/assets/{profile-CwGCV-qD.js → profile-CBVOSE5Y.js} +1 -1
  112. package/dist/client/assets/{project-app-view-zErfFogL.js → project-app-view-BdYdufIV.js} +1 -1
  113. package/dist/client/assets/registry-C1cjKaK9.js +2 -0
  114. package/dist/client/assets/{registry-layout-CmGW21c2.js → registry-layout-Bh11v3_V.js} +1 -1
  115. package/dist/client/assets/{required-auth-layout-B5HJtIOF.js → required-auth-layout-qictP9vU.js} +1 -1
  116. package/dist/client/assets/{reset-password-B677eX41.js → reset-password-BnZceRfb.js} +1 -1
  117. package/dist/client/assets/{roles-rcr_Tn0O.js → roles-CwKZSEWu.js} +1 -1
  118. package/dist/client/assets/{scroll-area-DBHrR7i5.js → scroll-area-Bgr87Vkq.js} +1 -1
  119. package/dist/client/assets/{search-input-DNUv1nJ2.js → search-input-D3ooVf8T.js} +1 -1
  120. package/dist/client/assets/{select-DCtC1IMd.js → select-BvNSl-Jm.js} +1 -1
  121. package/dist/client/assets/{select-model-C0Ic0E0i.js → select-model-DI9UTyVN.js} +1 -1
  122. package/dist/client/assets/{settings-layout-D5W1vy8m.js → settings-layout-CWWMk8wn.js} +1 -1
  123. package/dist/client/assets/{settings-section-C_Z35Ekv.js → settings-section-Wa1rawfe.js} +1 -1
  124. package/dist/client/assets/{shell-layout-DE2WQ3BJ.js → shell-layout-BrvvUJhC.js} +1 -1
  125. package/dist/client/assets/{sidebar-Ch_ebdAm.js → sidebar-eGSKB8cD.js} +1 -1
  126. package/dist/client/assets/{skeleton-je9GHbw8.js → skeleton-2TiLw6p1.js} +1 -1
  127. package/dist/client/assets/{spinner-DpQmSOow.js → spinner-BcijiTi2.js} +1 -1
  128. package/dist/client/assets/{sso-CVcn-0Dn.js → sso-ZMCkxi_f.js} +1 -1
  129. package/dist/client/assets/{store-_jI9s_lN.js → store-CxMODKHn.js} +1 -1
  130. package/dist/client/assets/store-registry-CtJjKA9S.js +2 -0
  131. package/dist/client/assets/{switch-BuXjAHfK.js → switch-Bm1-hyTt.js} +1 -1
  132. package/dist/client/assets/{table-CmIcMrJR.js → table-D0keoPRL.js} +1 -1
  133. package/dist/client/assets/{tabs-DQp_lyAm.js → tabs-C2THvaTH.js} +1 -1
  134. package/dist/client/assets/{task-status-DTa3jENF.js → task-status-BWhgRhRo.js} +1 -1
  135. package/dist/client/assets/{textarea-BV-jr_2O.js → textarea-B62Tb3Io.js} +1 -1
  136. package/dist/client/assets/{toggle-group-CwdiENSQ.js → toggle-group-xvQyi0Vl.js} +1 -1
  137. package/dist/client/assets/{tools-list-DfRSJFnA.js → tools-list-CAuCzKuY.js} +1 -1
  138. package/dist/client/assets/{tooltip-Da8-Ku4Z.js → tooltip-CQFT1Re2.js} +1 -1
  139. package/dist/client/assets/{types--Rr3ouKV.js → types-ci029xNq.js} +1 -1
  140. package/dist/client/assets/{use-ai-providers-B5OHV4sb.js → use-ai-providers-CbNJglUd.js} +1 -1
  141. package/dist/client/assets/{use-collections-CeOFxTJH.js → use-collections-2gBqo-BR.js} +1 -1
  142. package/dist/client/assets/{use-connection-fq8uDcfF.js → use-connection-BYD0CUg8.js} +1 -1
  143. package/dist/client/assets/{use-copy-sJQGUyLg.js → use-copy-C-tWck4r.js} +1 -1
  144. package/dist/client/assets/{use-create-virtual-mcp-ojYabGTO.js → use-create-virtual-mcp-D0QnBQVv.js} +1 -1
  145. package/dist/client/assets/{use-debounced-autosave-DjO2HHUO.js → use-debounced-autosave-D7-8d9VC.js} +1 -1
  146. package/dist/client/assets/{use-decopilot-events-B6BbCwiZ.js → use-decopilot-events-DbT_VS1d.js} +1 -1
  147. package/dist/client/assets/{use-delete-connection-CYBpm8Ct.js → use-delete-connection-HnhRN2Ev.js} +1 -1
  148. package/dist/client/assets/{use-infinite-scroll-CJveXi0J.js → use-infinite-scroll-CqEN47wq.js} +1 -1
  149. package/dist/client/assets/{use-list-state-9sj7RRhW.js → use-list-state-r8XZVGki.js} +1 -1
  150. package/dist/client/assets/{use-mcp-tools-Dwain8ET.js → use-mcp-tools-a5XMLKmP.js} +1 -1
  151. package/dist/client/assets/{use-members-Didb_H2A.js → use-members-Ch4bT4PE.js} +1 -1
  152. package/dist/client/assets/{use-navigate-to-agent-DDII26WP.js → use-navigate-to-agent-BsiHoTDR.js} +1 -1
  153. package/dist/client/assets/{use-org-auth-client-CQez6x3r.js → use-org-auth-client-BgXVYRZg.js} +1 -1
  154. package/dist/client/assets/{use-org-sso-D_YtPG_1.js → use-org-sso-BPJ5Jco7.js} +1 -1
  155. package/dist/client/assets/{use-organization-roles-BdaEBBm0.js → use-organization-roles-CKxZ__sD.js} +1 -1
  156. package/dist/client/assets/{use-organization-settings-BufG9pl6.js → use-organization-settings-DiOm3xYz.js} +1 -1
  157. package/dist/client/assets/{use-registry-connections-B9cwxbzp.js → use-registry-connections-DQ_E11W8.js} +1 -1
  158. package/dist/client/assets/{use-status-sounds-gwfSIdp-.js → use-status-sounds-BXJFAMQR.js} +1 -1
  159. package/dist/client/assets/{use-tasks-MJ3x_RWK.js → use-tasks-B6fACmKz.js} +1 -1
  160. package/dist/client/assets/{use-view-mode-Dwq_2gyt.js → use-view-mode-BA6tvMhN.js} +1 -1
  161. package/dist/client/assets/{use-virtual-mcp-B94Q-YCK.js → use-virtual-mcp-CkMyRuxj.js} +1 -1
  162. package/dist/client/assets/useInfiniteQuery-D3f5NTGj.js +1 -0
  163. package/dist/client/assets/{useRouterState-a3-LnatZ.js → useRouterState-DwzXc-5k.js} +1 -1
  164. package/dist/client/assets/useSuspenseInfiniteQuery-qwJlN4qP.js +1 -0
  165. package/dist/client/assets/{user-CMk5TXD8.js → user-D5kme3HP.js} +1 -1
  166. package/dist/client/assets/{view-mode-toggle-Ba3Fa81r.js → view-mode-toggle-NgXWlV9i.js} +1 -1
  167. package/dist/client/assets/{workflow-Duy2bsYW.js → workflow-NF6DzTIP.js} +1 -1
  168. package/dist/client/assets/workflow-detail-BLE69_IP.js +1 -0
  169. package/dist/client/index.html +2 -2
  170. package/dist/server/cli.js +1 -1
  171. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js +6 -36
  172. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js.map +1 -1
  173. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js +0 -15
  174. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js.map +1 -1
  175. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js +6 -36
  176. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js.map +1 -1
  177. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js +0 -15
  178. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js.map +1 -1
  179. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js +6 -36
  180. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js.map +1 -1
  181. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js +0 -15
  182. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js.map +1 -1
  183. package/dist/server/node_modules/@opentelemetry/otlp-transformer/package.json +14 -12
  184. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/InstrumentDescriptor.js +1 -1
  185. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/InstrumentDescriptor.js.map +1 -1
  186. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.d.ts +3 -3
  187. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.js +6 -6
  188. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.js.map +1 -1
  189. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.d.ts +1 -1
  190. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.js +2 -2
  191. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.js.map +1 -1
  192. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.d.ts +3 -3
  193. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.js +5 -5
  194. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.js.map +1 -1
  195. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.d.ts +3 -3
  196. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.js +17 -17
  197. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.js.map +1 -1
  198. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.d.ts +3 -3
  199. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.js +8 -8
  200. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.js.map +1 -1
  201. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.d.ts +1 -1
  202. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.js +2 -2
  203. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.js.map +1 -1
  204. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.d.ts +2 -2
  205. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.js +3 -3
  206. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.js.map +1 -1
  207. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  208. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.js +2 -2
  209. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.js.map +1 -1
  210. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/ConsoleMetricExporter.js +1 -1
  211. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/ConsoleMetricExporter.js.map +1 -1
  212. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js +3 -3
  213. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js.map +1 -1
  214. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js +21 -14
  215. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js.map +1 -1
  216. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.d.ts +2 -2
  217. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.js +4 -4
  218. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.js.map +1 -1
  219. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.d.ts +2 -2
  220. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js +3 -3
  221. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js.map +1 -1
  222. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.d.ts +2 -2
  223. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js +3 -3
  224. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js.map +1 -1
  225. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.d.ts +1 -1
  226. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.js +1 -1
  227. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.js.map +1 -1
  228. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.d.ts +3 -3
  229. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.js +12 -11
  230. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.js.map +1 -1
  231. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.d.ts +1 -1
  232. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.js +3 -3
  233. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.js.map +1 -1
  234. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.d.ts +1 -1
  235. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.js +2 -2
  236. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.js.map +1 -1
  237. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.d.ts +1 -1
  238. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.js +2 -2
  239. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.js.map +1 -1
  240. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/ObservableRegistry.js +4 -4
  241. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/ObservableRegistry.js.map +1 -1
  242. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.d.ts +2 -2
  243. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.js +4 -4
  244. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.js.map +1 -1
  245. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.d.ts +1 -1
  246. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js +2 -2
  247. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js.map +1 -1
  248. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.d.ts +0 -19
  249. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js +0 -36
  250. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js.map +1 -1
  251. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.d.ts +1 -1
  252. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js +1 -1
  253. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js.map +1 -1
  254. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.d.ts +3 -3
  255. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.js +6 -6
  256. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.js.map +1 -1
  257. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AttributesProcessor.js +16 -12
  258. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AttributesProcessor.js.map +1 -1
  259. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/InstrumentDescriptor.js +1 -1
  260. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/InstrumentDescriptor.js.map +1 -1
  261. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.d.ts +3 -3
  262. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.js +6 -6
  263. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.js.map +1 -1
  264. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.d.ts +1 -1
  265. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.js +2 -2
  266. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.js.map +1 -1
  267. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.d.ts +3 -3
  268. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.js +5 -5
  269. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.js.map +1 -1
  270. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.d.ts +3 -3
  271. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.js +17 -17
  272. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.js.map +1 -1
  273. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.d.ts +3 -3
  274. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.js +8 -8
  275. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.js.map +1 -1
  276. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.d.ts +1 -1
  277. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.js +2 -2
  278. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.js.map +1 -1
  279. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.d.ts +2 -2
  280. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.js +3 -3
  281. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.js.map +1 -1
  282. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  283. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.js +2 -2
  284. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.js.map +1 -1
  285. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/ConsoleMetricExporter.js +1 -1
  286. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/ConsoleMetricExporter.js.map +1 -1
  287. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js +3 -3
  288. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js.map +1 -1
  289. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js +21 -14
  290. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js.map +1 -1
  291. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.d.ts +2 -2
  292. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.js +4 -4
  293. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.js.map +1 -1
  294. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.d.ts +2 -2
  295. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js +3 -3
  296. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js.map +1 -1
  297. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.d.ts +2 -2
  298. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js +3 -3
  299. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js.map +1 -1
  300. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.d.ts +1 -1
  301. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.js +1 -1
  302. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.js.map +1 -1
  303. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.d.ts +3 -3
  304. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.js +12 -11
  305. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.js.map +1 -1
  306. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.d.ts +1 -1
  307. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.js +3 -3
  308. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.js.map +1 -1
  309. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.d.ts +1 -1
  310. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.js +2 -2
  311. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.js.map +1 -1
  312. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.d.ts +1 -1
  313. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.js +2 -2
  314. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.js.map +1 -1
  315. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/ObservableRegistry.js +4 -4
  316. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/ObservableRegistry.js.map +1 -1
  317. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.d.ts +2 -2
  318. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.js +4 -4
  319. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.js.map +1 -1
  320. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.d.ts +1 -1
  321. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js +2 -2
  322. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js.map +1 -1
  323. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.d.ts +0 -19
  324. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.js +0 -36
  325. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.js.map +1 -1
  326. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.d.ts +1 -1
  327. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js +1 -1
  328. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js.map +1 -1
  329. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.d.ts +3 -3
  330. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.js +6 -6
  331. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.js.map +1 -1
  332. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/AttributesProcessor.js +16 -12
  333. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/AttributesProcessor.js.map +1 -1
  334. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.js +1 -1
  335. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.js.map +1 -1
  336. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.d.ts +3 -3
  337. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.js +6 -6
  338. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.js.map +1 -1
  339. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.d.ts +1 -1
  340. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.js +2 -2
  341. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.js.map +1 -1
  342. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.d.ts +3 -3
  343. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.js +5 -5
  344. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.js.map +1 -1
  345. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.d.ts +3 -3
  346. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.js +17 -17
  347. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.js.map +1 -1
  348. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.d.ts +3 -3
  349. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.js +8 -8
  350. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.js.map +1 -1
  351. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.d.ts +1 -1
  352. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.js +2 -2
  353. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.js.map +1 -1
  354. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.d.ts +2 -2
  355. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.js +3 -3
  356. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.js.map +1 -1
  357. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  358. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.js +2 -2
  359. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.js.map +1 -1
  360. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.js +1 -1
  361. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.js.map +1 -1
  362. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js +2 -2
  363. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js.map +1 -1
  364. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js +21 -14
  365. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js.map +1 -1
  366. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.d.ts +2 -2
  367. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.js +4 -4
  368. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.js.map +1 -1
  369. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.d.ts +2 -2
  370. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js +3 -3
  371. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js.map +1 -1
  372. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.d.ts +2 -2
  373. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js +3 -3
  374. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js.map +1 -1
  375. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.d.ts +1 -1
  376. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.js +1 -1
  377. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.js.map +1 -1
  378. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.d.ts +3 -3
  379. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.js +12 -11
  380. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.js.map +1 -1
  381. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.d.ts +1 -1
  382. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.js +3 -3
  383. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.js.map +1 -1
  384. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.d.ts +1 -1
  385. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.js +2 -2
  386. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.js.map +1 -1
  387. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.d.ts +1 -1
  388. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.js +2 -2
  389. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.js.map +1 -1
  390. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/ObservableRegistry.js +3 -3
  391. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/ObservableRegistry.js.map +1 -1
  392. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.d.ts +2 -2
  393. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.js +4 -4
  394. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.js.map +1 -1
  395. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.d.ts +1 -1
  396. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js +2 -2
  397. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js.map +1 -1
  398. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.d.ts +0 -19
  399. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.js +1 -41
  400. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.js.map +1 -1
  401. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.d.ts +1 -1
  402. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.js +1 -1
  403. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.js.map +1 -1
  404. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.d.ts +3 -3
  405. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.js +6 -6
  406. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.js.map +1 -1
  407. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.js +16 -12
  408. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.js.map +1 -1
  409. package/dist/server/node_modules/@opentelemetry/sdk-metrics/package.json +6 -6
  410. package/dist/server/node_modules/indent-string/index.d.ts +38 -0
  411. package/dist/server/node_modules/indent-string/index.js +38 -0
  412. package/dist/server/node_modules/indent-string/license +9 -0
  413. package/dist/server/node_modules/indent-string/package.json +40 -0
  414. package/dist/server/node_modules/indent-string/readme.md +73 -0
  415. package/package.json +1 -1
  416. package/dist/client/assets/registry-DaNGJ7bm.js +0 -2
  417. package/dist/client/assets/store-registry-BeOq04Go.js +0 -2
  418. package/dist/client/assets/useInfiniteQuery-CYx7uTOQ.js +0 -1
  419. package/dist/client/assets/useSuspenseInfiniteQuery-HwB3d92O.js +0 -1
  420. package/dist/client/assets/workflow-detail-CxVdD2VS.js +0 -1
@@ -1,4 +1,4 @@
1
- import{v as ie,b as It,u as uo,z as hn,D as gn,j as n,B as Z,o as oe,r as w,p as mt,f as Ne,l as nt,G as Gt,F as Ht,t as z,K as me,e as F,Q as Vo,R as mo,c as K,a as xn,g as bn,d as yn,an as ft,H as Ie,J as Le,E as fo,P as Tt,ao as Xe,ap as cs,aq as Dn,ar as po,n as vn,y as ds,as as ho,at as us,au as go,av as ge,aw as Qt,ax as xo,ay as Jt,az as bo,aA as yo,aB as vo,aC as wo,x as jo,aD as Ao,aE as So,aF as ko,aG as _o}from"./index-BW5oXiOF.js";import{b as xe,a as be,c as ye,d as ve,e as Rt,D as Vs}from"./dialog-DKLqkTro.js";import{S as Co}from"./switch-BuXjAHfK.js";import{I as he}from"./input-IQBUa_cI.js";import{b as wn,u as No}from"./use-connection-fq8uDcfF.js";import{S as pt,u as je,W as ms,g as jn,i as Ln,c as Io}from"./constants-DK6-FgDX.js";import{a as To,c as Ro}from"./lean-canvas-recruit-modal-DqzxwaiI.js";import{a as An}from"./use-navigate-to-agent-DDII26WP.js";import{q as Po,A as Sn,K as kn,J as Eo,L as fs,a as Do,M as Lo,N as Mo,m as Fo,O as Uo,P as Oo,H as ps}from"./agent-icon-Bf-mJf1h.js";import{t as $o,e as zo,b as Pt,u as Et,g as Bo,z as qo,a as Ko,h as Yo,i as Wo,w as Go,A as Ho,j as Qo,k as Jo}from"./chat-context-BWP0L-4o.js";import{b as Dt,a as Lt,c as Mt,D as Ft,d as Xo,e as Zo,f as er}from"./drawer-H55NP4R-.js";import{u as Ut,b as st,T as ot,a as rt,c as an}from"./tooltip-Da8-Ku4Z.js";import{I as hs}from"./integration-icon-mQ_J6kU4.js";import{a as gs,b as tr,u as nr}from"./use-virtual-mcp-B94Q-YCK.js";import{u as xs}from"./use-tasks-MJ3x_RWK.js";import{r as bs,K as sr,i as or}from"./shell-layout-DE2WQ3BJ.js";import{h as rr,j as Ot,k as Ce,l as ir,s as _n,t as ar,m as lr,n as cr,o as dr,q as lt,u as ur,v as Vr,c as mr,S as fr,w as pr,x as Mn}from"./pair-CSM05GR-.js";import{a as hr,c as ys}from"./ZapSquare-D0un1xlb.js";import{i as vs}from"./ChevronRight-W_JRVCsB.js";import{S as At}from"./spinner-DpQmSOow.js";import{C as ws}from"./collection-search-BbX02Vt9.js";import{u as gr,g as Cn,a as xr,c as br,l as St}from"./tabs-DQp_lyAm.js";import{F as ue,b as le,c as pe,d as ce,f as de,a as ct}from"./form-Dnh_68v3.js";import{s as yr,i as vr}from"./XClose-BvJMELx2.js";import{i as dt}from"./Check-D6DtmAYz.js";import{s as it}from"./Star01-BTd7uzv1.js";import{t as wr,a as js}from"./Tool01-CC7E7i0z.js";import{i as As}from"./Lock01-SfDe88qn.js";import{i as jr}from"./Upload01-43iSsXQQ.js";import{i as Ze}from"./X-DTT-z90W.js";import{i as Ss}from"./AlertCircle-DzuAM8Ts.js";import{S as ks,a as _s,b as Cs,c as Ns,d as We}from"./select-DCtC1IMd.js";import{i as Ar}from"./RefreshCcw01-BYmTCqrQ.js";import{e as Xt,c as Is,t as ln,f as Sr}from"./XCircle-BqSNivAk.js";import{t as kr}from"./ChevronDown-BQEZBz5I.js";import{T as Ts,a as kt}from"./toggle-group-CwdiENSQ.js";import{u as _r}from"./use-ai-providers-B5OHV4sb.js";import{m as $t,i as Cr,g as Rs,a as Nr,N as Ir}from"./select-model-C0Ic0E0i.js";import{a as Ps,c as _e,b as Es,D as Ds,e as Fn,d as Un,f as On,h as Tr,g as Rr}from"./dropdown-menu-mFwKSfJW.js";import{P as cn,a as Pr,b as Er,u as Dr,E as Lr,c as Nn,i as Mr,d as Fr}from"./index-CaB42iwv.js";import{S as Ur}from"./index-DwpTcFSf.js";import{r as Ls,l as at}from"./types--Rr3ouKV.js";import{s as dn}from"./Plus-DPd13c1m.js";import{p as Or,q as $n}from"./question-004-sINsf4GQ.js";import{g as $r}from"./connection-slug-eyAPH6o3.js";import{u as Ms,a as Fs,g as zr,C as Zt}from"./connection-card-dG1gvcfw.js";import{C as Br}from"./collection-tabs-CklGlAHz.js";import{g as qr}from"./constants-DdO-uSXG.js";import{T as Kr}from"./textarea-BV-jr_2O.js";import{n as wt}from"./Container-CAHcYnEg.js";import{c as Yr,i as bt,a as zn,E as Wr,p as Gr,b as Hr,d as Qr}from"./connection-form-helpers-BHm9qvan.js";import{u as Bn}from"./use-infinite-scroll-CJveXi0J.js";import{u as Jr}from"./useSuspenseInfiniteQuery-HwB3d92O.js";import{g as Xr,e as Zr,a as ei}from"./extract-connection-data-Fzjrvq-Y.js";import{B as yt}from"./badge-CHFfTDkx.js";function ti({open:t,onOpenChange:e,onCreated:s}){const{org:o}=ie(),{data:r}=It.useSession(),{stdioEnabled:i}=uo(),a=Ut(),c=wn(),l=Ms(),V=Fs(l,"").items,d=hn({resolver:gn(Yr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=d.watch("ui_type"),f=d.watch("connection_url"),y=d.watch("npx_package"),g=bt({uiType:m,connectionUrl:f??"",npxPackage:y??""})??zn({uiType:m,connectionUrl:f??"",registryItems:V}),p=A=>{const x=A.trim();if(!x)return;const j=!!d.formState.dirtyFields.title,P=!!d.formState.dirtyFields.description,E=!!d.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!d.getValues("title").trim()&&k.title&&d.setValue("title",k.title,{shouldDirty:!1}),!P&&!(d.getValues("description")??"").trim()&&k.description&&d.setValue("description",k.description,{shouldDirty:!1}),!E&&k.envVarKeys?.length)){const R=d.getValues("env_vars")??[],L=new Set(R.map(T=>T.key)),D=k.envVarKeys.filter(T=>!L.has(T));D.length>0&&d.setValue("env_vars",[...R,...D.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},N=Gr(x);if(N&&i){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",N.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),I(bt({uiType:"NPX",npxPackage:N.packageName}));return}if(x.startsWith("http://")||x.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";d.setValue("ui_type",k,{shouldDirty:!0}),d.setValue("connection_url",x,{shouldDirty:!0}),I(bt({uiType:k,connectionUrl:x})??zn({uiType:k,connectionUrl:x,registryItems:V}));return}m==="NPX"&&I(bt({uiType:"NPX",npxPackage:x}))},v=A=>{A||d.reset(),e(A)},h=async A=>{let x,j=null,P=null,E=null;A.ui_type==="NPX"?(x="STDIO",j="",E=Hr(A.npx_package||"",A.env_vars||[])):A.ui_type==="STDIO"?(x="STDIO",j="",E=Qr(A.stdio_command||"",A.stdio_args||"",A.stdio_cwd,A.env_vars||[])):(x=A.ui_type,j=A.connection_url||"",P=A.connection_token||null);const I=qr("conn");try{await c.create.mutateAsync({id:I,title:A.title,description:A.description||null,connection_type:x,connection_url:j,connection_token:P,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:o.id,icon:A.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(I)}catch{oe.error("Failed to create connection")}},b="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",C=d.formState.isSubmitting?"Saving...":"Create Connection",_=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(ue,{control:d.control,name:"ui_type",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Type *"}),n.jsxs(ks,{value:A.value,onValueChange:A.onChange,children:[n.jsx(ce,{children:n.jsx(_s,{children:n.jsx(Cs,{})})}),n.jsxs(Ns,{children:[n.jsx(We,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(We,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(We,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"Websocket"]})}),i&&n.jsxs(n.Fragment,{children:[n.jsx(We,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(wt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(We,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Po,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(de,{})]})}),m==="NPX"&&n.jsx(ue,{control:d.control,name:"npx_package",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"NPM Package *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"@perplexity-ai/mcp-server",...A,value:A.value??"",onPaste:x=>{const j=x.clipboardData.getData("text");j&&(x.preventDefault(),d.setValue("npx_package",j.trim(),{shouldDirty:!0}),p(j))},onBlur:x=>{p(x.target.value),A.onBlur()}})}),n.jsx(de,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(ue,{control:d.control,name:"stdio_command",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Command *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"node, bun, python...",...A,value:A.value??""})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"stdio_args",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Arguments"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"arg1 arg2 --flag value",...A,value:A.value??""})}),n.jsx(de,{})]})})]}),n.jsx(ue,{control:d.control,name:"stdio_cwd",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Working Directory"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"/path/to/project (optional)",...A,value:A.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(de,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(ue,{control:d.control,name:"env_vars",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Environment Variables"}),n.jsx(ce,{children:n.jsx(Wr,{value:A.value??[],onChange:A.onChange})}),n.jsx(de,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(ue,{control:d.control,name:"connection_url",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"URL *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"https://example.com/mcp",...A,value:A.value??"",onPaste:x=>{const j=x.clipboardData.getData("text");j&&(x.preventDefault(),d.setValue("connection_url",j.trim(),{shouldDirty:!0}),p(j))},onBlur:x=>{p(x.target.value),A.onBlur()}})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"connection_token",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:g?.token?.label??"Token (optional)"}),n.jsx(ce,{children:n.jsx(he,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...A,value:A.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),n.jsx(de,{})]})})]}),n.jsx(ue,{control:d.control,name:"title",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Name *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"My Connection",...A})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"description",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Description"}),n.jsx(ce,{children:n.jsx(Kr,{placeholder:"A brief description of this connection",rows:3,...A,value:A.value??""})}),n.jsx(de,{})]})})]});return a?n.jsx(Dt,{open:t,onOpenChange:v,children:n.jsxs(Lt,{className:"max-h-[90vh]",children:[n.jsx(Mt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ft,{children:b}),n.jsx(Xo,{className:"mt-1",children:S})]}),n.jsx(Zo,{asChild:!0,children:n.jsx(Z,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(yr,{size:16})})})]})}),n.jsx(ct,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:_}),n.jsx(er,{children:n.jsx(Z,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:C})})]})})]})}):n.jsx(xe,{open:t,onOpenChange:v,children:n.jsxs(be,{className:"sm:max-w-[525px]",children:[n.jsxs(ye,{children:[n.jsx(ve,{children:b}),n.jsx(Rt,{children:S})]}),n.jsx(ct,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:_}),n.jsxs(Vs,{children:[n.jsx(Z,{type:"button",variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(Z,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:C})]})]})})]})})}function ni(t){const e=F.c(73),{mode:s,agentId:o,addedConnectionIds:r,onAdd:i,onCloneAndAdd:a,onConnectAndAdd:c,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:d,defaultTab:m}=t,f=s===void 0?"add":s,y=m===void 0?"connected":m,{org:g}=ie(),p=w.useDeferredValue(u),v=u!==p,h=p.trim().toLowerCase();let b;e[0]!==y?(b=B=>B??y,e[0]=y,e[1]=b):b=e[1];const[S,C]=Vo(mo.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),b);let _;e[2]!==S||e[3]!==C?(_=B=>{B!==S&&z("connections_dialog_tab_changed",{to_tab:B}),C(B)},e[2]=S,e[3]=C,e[4]=_):_=e[4];const A=_;let x;e[5]!==g.id||e[6]!==g.slug?(x={connectionId:pt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=x):x=e[7];const j=je(x);let P,E,I;if(e[8]!==j||e[9]!==p||e[10]!==g.id){I=p?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:p.trim()},{field:["description"],operator:"contains",value:p.trim()}]}:void 0;const B={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},se=JSON.stringify(B);E=Jr,P=me.collectionListInfinite(j,g.id,"","CONNECTIONS",se),e[8]=j,e[9]=p,e[10]=g.id,e[11]=P,e[12]=E,e[13]=I}else P=e[11],E=e[12],I=e[13];let N;e[14]!==j||e[15]!==I?(N=async B=>{const{pageParam:se}=B,we=se===void 0?0:se;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:we}})).structuredContent},e[14]=j,e[15]=I,e[16]=N):N=e[16];let k;e[17]!==P||e[18]!==N?(k={queryKey:P,queryFn:N,initialPageParam:0,getNextPageParam:li,staleTime:3e4},e[17]=P,e[18]=N,e[19]=k):k=e[19];const{data:R,fetchNextPage:L,hasNextPage:D,isFetchingNextPage:T}=E(k),U=R?.pages.flatMap(ai)??[],O=zr(U),$=new Set(U.filter(ii).map(ri)),W=Ms(),M=Fs(W,p),Y=Bn(M.loadMore,M.hasMore,M.isLoadingMore),G=Bn(L,D??!1,T),q=S==="all"||!!h,Q=q?M.items.filter(B=>{const se=Xr(B);if(se&&$.has(se))return!1;if(!h)return!0;const we=B._meta?.["mcp.mesh"];return[B.title,B.description,B.name,B.server?.title,B.server?.description,B.server?.name,we?.friendly_name,we?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],H=Q.filter(oi),X=Q.filter(si);let ne;e[20]!==r?(ne=B=>B.some(se=>r.has(se.id)),e[20]=r,e[21]=ne):ne=e[21];const J=ne;let re;e[22]!==r||e[23]!==o||e[24]!==l||e[25]!==J||e[26]!==f||e[27]!==i||e[28]!==d||e[29]!==a?(re=(B,se,we,Ke,Se)=>{const xt=J(Se),Ye=Se.find(Pe=>!r.has(Pe.id)),Ve=Se[0];if(f==="browse"){const Pe=$r(Ve);return n.jsx(Zt,{connection:{title:se,icon:we,description:Se.length>1?`${Se.length} instances`:Ke??void 0},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(yt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(dt,{size:11})," Connected"]}),onClick:()=>{z("connection_browse_clicked",{app_name:Ve.app_name??null,connection_id:Ve.id,instances_count:Se.length}),d?.(Pe)}},B)}return n.jsx(Zt,{connection:{title:se,icon:we,description:Ke},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[xt&&n.jsxs(yt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(dt,{size:11})," Added"]}),n.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Ye?(z("connection_add_clicked",{action:"use_existing",app_name:Ve.app_name??null,connection_id:Ye.id}),o&&z("agent_connection_attached",{agent_id:o,connection_id:Ye.id,app_name:Ve.app_name??null,mode:"existing"}),i(Ye.id)):(z("connection_add_clicked",{action:"clone",app_name:Ve.app_name??null,base_connection_id:Ve.id}),a(Ve))},children:"Add"})]})},B)},e[22]=r,e[23]=o,e[24]=l,e[25]=J,e[26]=f,e[27]=i,e[28]=d,e[29]=a,e[30]=re):re=e[30];const ee=re;let ae;e[31]!==l||e[32]!==f||e[33]!==c?(ae=B=>{const se=B._meta?.["mcp.mesh"],we=se?.friendlyName||se?.friendly_name||B.server?.title||B.title||B.server?.name||B.name||B.id||"",Ke=B.server?.description||B.description||null,Se=B.server?.icons?.[0]?.src||ei(B.server?.repository)||null,xt=se?.official===!0,Ye=se?.verified===!0,Ve=se?.owner==="deco";return n.jsx(Zt,{connection:{title:we,description:Ke,icon:Se},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[Ve&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(rt,{children:"Built and maintained by Deco"})]}),!Ve&&xt&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx(yt,{variant:"outline",size:"icon",children:n.jsx(Xt,{})})}),n.jsx(rt,{children:"Built and maintained by the official vendor"})]}),!Ve&&!xt&&Ye&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx(yt,{variant:"outline",size:"icon",children:n.jsx(Xt,{})})}),n.jsx(rt,{children:"Verified by the Deco team"})]}),n.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),z("connection_add_clicked",{action:"connect_new",registry_item_id:B.id,app_name:se?.friendlyName||B.server?.name||B.name||null}),c(B)},children:l===B.id?n.jsx(nt,{size:14,className:"animate-spin"}):f==="browse"?"Connect":"Add"})]})},`catalog-${B.id}`)},e[31]=l,e[32]=f,e[33]=c,e[34]=ae):ae=e[34];const Re=ae,te=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(Br,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:S,onTabChange:B=>A(B)}),n.jsxs(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{z("connections_dialog_custom_clicked"),V()},children:[n.jsx(dn,{size:12}),"Custom Connection"]})]}),Ae=v&&"opacity-50 pointer-events-none";let Me;e[35]!==Ae?(Me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ae),e[35]=Ae,e[36]=Me):Me=e[36];const co="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ht;e[37]!==ee?(ht=B=>{if(B.type==="group")return ee(B.key,B.title,B.icon,null,B.connections);const se=B.connection;return ee(se.id,se.title,se.icon,se.description??null,[se])},e[37]=ee,e[38]=ht):ht=e[38];const Bt=O.map(ht);let Fe;e[39]!==G?(Fe=n.jsx("div",{ref:G,className:"col-span-full h-1"}),e[39]=G,e[40]=Fe):Fe=e[40];let Ue;e[41]!==T?(Ue=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=Ue):Ue=e[42];const qt=q&&H.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(Xt,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Kt=q&&H.map(Re),Yt=q&&X.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Wt=q&&X.map(Re);let Oe;e[43]!==Y||e[44]!==W||e[45]!==q?(Oe=q&&W.length>0&&n.jsx("div",{ref:Y,className:"col-span-full h-1"}),e[43]=Y,e[44]=W,e[45]=q,e[46]=Oe):Oe=e[46];let $e;e[47]!==M.isLoadingMore||e[48]!==q?($e=q&&M.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=M.isLoadingMore,e[48]=q,e[49]=$e):$e=e[49];let ze;e[50]!==Bt||e[51]!==Fe||e[52]!==Ue||e[53]!==qt||e[54]!==Kt||e[55]!==Yt||e[56]!==Wt||e[57]!==Oe||e[58]!==$e?(ze=n.jsxs("div",{className:co,children:[Bt,Fe,Ue,qt,Kt,Yt,Wt,Oe,$e]}),e[50]=Bt,e[51]=Fe,e[52]=Ue,e[53]=qt,e[54]=Kt,e[55]=Yt,e[56]=Wt,e[57]=Oe,e[58]=$e,e[59]=ze):ze=e[59];let Be;e[60]!==S||e[61]!==O.length||e[62]!==X||e[63]!==u||e[64]!==H?(Be=O.length===0&&H.length===0&&X.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:S==="connected"?"No connections yet":"No connections available"}),e[60]=S,e[61]=O.length,e[62]=X,e[63]=u,e[64]=H,e[65]=Be):Be=e[65];let qe;e[66]!==Me||e[67]!==ze||e[68]!==Be?(qe=n.jsxs("div",{className:Me,children:[ze,Be]}),e[66]=Me,e[67]=ze,e[68]=Be,e[69]=qe):qe=e[69];let gt;return e[70]!==te||e[71]!==qe?(gt=n.jsxs(n.Fragment,{children:[te,qe]}),e[70]=te,e[71]=qe,e[72]=gt):gt=e[72],gt}function si(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function oi(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ri(t){return t.app_name}function ii(t){return t.app_name}function ai(t){return t?.items??[]}function li(t,e){if(t?.hasMore)return e.reduce(ci,0)}function ci(t,e){return t+(e?.items?.length??0)}function di({open:t,onOpenChange:e,defaultTab:s,initialSearch:o="",...r}){const i=r.mode??"add",a="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:x=>{},u=(x,j,P)=>{a&&z("agent_connection_attached",{agent_id:a,connection_id:x,app_name:j,mode:P})},[V,d]=w.useState(null),[m,f]=w.useState(o),[y,g]=w.useState(!1),{org:p}=ie(),{data:v}=It.useSession(),h=wn(),b=mt(),S=Ne(),C=x=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:p.slug,appSlug:x}})},_=async x=>{d(x.app_name??x.id);try{const P=`${x.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:P,description:x.description??null,connection_type:x.connection_type,connection_url:x.connection_url??null,connection_token:null,icon:x.icon??null,app_name:x.app_name??null,app_id:x.app_id??null,connection_headers:x.connection_headers??null})).id,N=new URL(`/api/${p.slug}/mcp/${I}`,window.location.origin),k=await Gt({url:N.href,token:null,orgId:p.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:R,tokenInfo:L,error:D}=await Ht({connectionId:I,orgSlug:p.slug,scope:"offline_access"});if(D||!R){z("connection_oauth_failed",{connection_id:I,flow:"clone",error:D??"no_token"}),oe.error(`Authentication failed: ${D??"no token received"}`),await h.delete.mutateAsync(I);return}if(z("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),L)try{(await fetch(`/api/${p.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:L.accessToken,refreshToken:L.refreshToken,expiresIn:L.expiresIn,scope:L.scope,clientId:L.clientId,clientSecret:L.clientSecret,tokenEndpoint:L.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:R}})}else await h.update.mutateAsync({id:I,data:{connection_token:R}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(N.href,null)})}u(I,x.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),oe.error("Failed to add connection")}finally{d(null)}},A=async x=>{if(!(!p||!v?.user?.id)){d(x.id);try{const j=Zr(x,p.id,v.user.id,{remoteIndex:0}),P=j.connection_type==="STDIO",E=!!j.connection_url,I=P&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!E&&!I){oe.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:N}=await h.create.mutateAsync(j),k=new URL(`/api/${p.slug}/mcp/${N}`,window.location.origin),R=await Gt({url:k.href,token:null,orgId:p.id});if(R.supportsOAuth&&!R.isAuthenticated){const{token:L,tokenInfo:D,error:T}=await Ht({connectionId:N,orgSlug:p.slug,scope:"offline_access"});if(T||!L){z("connection_oauth_failed",{connection_id:N,flow:"connect_new",error:T??"no_token"}),oe.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${T??"no token received"})`}),u(N,j.app_name??null,"new"),l(N);return}if(z("connection_oauth_succeeded",{connection_id:N,flow:"connect_new"}),D)try{(await fetch(`/api/${p.slug}/connections/${N}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})})).ok?await h.update.mutateAsync({id:N,data:{}}):await h.update.mutateAsync({id:N,data:{connection_token:L}})}catch{await h.update.mutateAsync({id:N,data:{connection_token:L}})}else await h.update.mutateAsync({id:N,data:{connection_token:L}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(k.href,null)}),oe.success("Connected and authenticated")}else oe.success("Connected");u(N,j.app_name??null,"new"),l(N)}catch(j){console.error("Failed to connect:",j),oe.error("Failed to connect")}finally{d(null)}}};return n.jsxs(xe,{open:t,onOpenChange:e,children:[n.jsxs(be,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(ye,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(ve,{className:"text-base font-semibold",children:i==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(ws,{value:m,onChange:f,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(ni,{mode:i,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:_,onConnectAndAdd:A,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:C,defaultTab:s})})]}),n.jsx(ti,{open:y,onOpenChange:g,onCreated:async x=>{g(!1);const j=new URL(`/api/${p.slug}/mcp/${x}`,window.location.origin),P=await Gt({url:j.href,token:null,orgId:p.id});if(P.supportsOAuth&&!P.isAuthenticated){const{token:E,tokenInfo:I,error:N}=await Ht({connectionId:x,orgSlug:p.slug,scope:"offline_access"});if(N||!E){z("connection_oauth_failed",{connection_id:x,flow:"custom_create",error:N??"no_token"}),oe.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${N??"no token received"})`}),u(x,null,"custom"),l(x),e(!1);return}if(z("connection_oauth_succeeded",{connection_id:x,flow:"custom_create"}),I)try{(await fetch(`/api/${p.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:x,data:{}}):await h.update.mutateAsync({id:x,data:{connection_token:E}})}catch{await h.update.mutateAsync({id:x,data:{connection_token:E}})}else await h.update.mutateAsync({id:x,data:{connection_token:E}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(j.href,null)})}u(x,null,"custom"),l(x),e(!1)}})]})}const ui='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',Vi='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',mi=`# Performance Watchdog
1
+ import{v as ie,b as It,u as uo,z as hn,D as gn,j as n,B as Z,o as oe,r as w,p as mt,f as Ne,l as nt,G as Gt,F as Ht,t as z,K as me,e as F,Q as Vo,R as mo,c as K,a as xn,g as bn,d as yn,an as ft,H as Ie,J as Le,E as fo,P as Tt,ao as Xe,ap as cs,aq as Dn,ar as po,n as vn,y as ds,as as ho,at as us,au as go,av as ge,aw as Qt,ax as xo,ay as Jt,az as bo,aA as yo,aB as vo,aC as wo,x as jo,aD as Ao,aE as So,aF as ko,aG as _o}from"./index-Dk5AlIgx.js";import{b as xe,a as be,c as ye,d as ve,e as Rt,D as Vs}from"./dialog-BPWWf_z7.js";import{S as Co}from"./switch-Bm1-hyTt.js";import{I as he}from"./input-C9pPBwxY.js";import{b as wn,u as No}from"./use-connection-BYD0CUg8.js";import{S as pt,u as je,W as ms,g as jn,i as Ln,c as Io}from"./constants-BjyyTXnH.js";import{a as To,c as Ro}from"./lean-canvas-recruit-modal-Bhm-Amf2.js";import{a as An}from"./use-navigate-to-agent-BsiHoTDR.js";import{q as Po,A as Sn,K as kn,J as Eo,L as fs,a as Do,M as Lo,N as Mo,m as Fo,O as Uo,P as Oo,H as ps}from"./agent-icon-0yz7Dosu.js";import{t as $o,e as zo,b as Pt,u as Et,g as Bo,z as qo,a as Ko,h as Yo,i as Wo,w as Go,A as Ho,j as Qo,k as Jo}from"./chat-context-COuQh22R.js";import{b as Dt,a as Lt,c as Mt,D as Ft,d as Xo,e as Zo,f as er}from"./drawer-BlRlQn9T.js";import{u as Ut,b as st,T as ot,a as rt,c as an}from"./tooltip-CQFT1Re2.js";import{I as hs}from"./integration-icon-CNgai9ER.js";import{a as gs,b as tr,u as nr}from"./use-virtual-mcp-CkMyRuxj.js";import{u as xs}from"./use-tasks-B6fACmKz.js";import{r as bs,K as sr,i as or}from"./shell-layout-BrvvUJhC.js";import{h as rr,j as Ot,k as Ce,l as ir,s as _n,t as ar,m as lr,n as cr,o as dr,q as lt,u as ur,v as Vr,c as mr,S as fr,w as pr,x as Mn}from"./pair-C76DvqJ7.js";import{a as hr,c as ys}from"./ZapSquare-Do5pKYHa.js";import{i as vs}from"./ChevronRight-BfR151jd.js";import{S as At}from"./spinner-BcijiTi2.js";import{C as ws}from"./collection-search-5TnOhjQK.js";import{u as gr,g as Cn,a as xr,c as br,l as St}from"./tabs-C2THvaTH.js";import{F as ue,b as le,c as pe,d as ce,f as de,a as ct}from"./form-DGRQji8F.js";import{s as yr,i as vr}from"./XClose-BgdRSEZn.js";import{i as dt}from"./Check-dlY8e2Ho.js";import{s as it}from"./Star01-Y755IVMR.js";import{t as wr,a as js}from"./Tool01-DHg5BBnf.js";import{i as As}from"./Lock01-B2dFGh2K.js";import{i as jr}from"./Upload01-CYxSnGGr.js";import{i as Ze}from"./X-C8Bj97my.js";import{i as Ss}from"./AlertCircle-D_INSRN8.js";import{S as ks,a as _s,b as Cs,c as Ns,d as We}from"./select-BvNSl-Jm.js";import{i as Ar}from"./RefreshCcw01-COhnBWDC.js";import{e as Xt,c as Is,t as ln,f as Sr}from"./XCircle-Cs4Fr8x-.js";import{t as kr}from"./ChevronDown-Cw9ngzw7.js";import{T as Ts,a as kt}from"./toggle-group-xvQyi0Vl.js";import{u as _r}from"./use-ai-providers-CbNJglUd.js";import{m as $t,i as Cr,g as Rs,a as Nr,N as Ir}from"./select-model-DI9UTyVN.js";import{a as Ps,c as _e,b as Es,D as Ds,e as Fn,d as Un,f as On,h as Tr,g as Rr}from"./dropdown-menu-Dp_8NT82.js";import{P as cn,a as Pr,b as Er,u as Dr,E as Lr,c as Nn,i as Mr,d as Fr}from"./index-Ct_ZVBZo.js";import{S as Ur}from"./index-DNMdaPSW.js";import{r as Ls,l as at}from"./types-ci029xNq.js";import{s as dn}from"./Plus-tONXYA9f.js";import{p as Or,q as $n}from"./question-004-sINsf4GQ.js";import{g as $r}from"./connection-slug-eyAPH6o3.js";import{u as Ms,a as Fs,g as zr,C as Zt}from"./connection-card-DFcnQBIx.js";import{C as Br}from"./collection-tabs-CDpY01rL.js";import{g as qr}from"./constants-B9APhgxz.js";import{T as Kr}from"./textarea-B62Tb3Io.js";import{n as wt}from"./Container-TZxpYYVB.js";import{c as Yr,i as bt,a as zn,E as Wr,p as Gr,b as Hr,d as Qr}from"./connection-form-helpers-u0rrd0BU.js";import{u as Bn}from"./use-infinite-scroll-CqEN47wq.js";import{u as Jr}from"./useSuspenseInfiniteQuery-qwJlN4qP.js";import{g as Xr,e as Zr,a as ei}from"./extract-connection-data-DCcXYZQ5.js";import{B as yt}from"./badge-BFgmLB6r.js";function ti({open:t,onOpenChange:e,onCreated:s}){const{org:o}=ie(),{data:r}=It.useSession(),{stdioEnabled:i}=uo(),a=Ut(),c=wn(),l=Ms(),V=Fs(l,"").items,d=hn({resolver:gn(Yr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=d.watch("ui_type"),f=d.watch("connection_url"),y=d.watch("npx_package"),g=bt({uiType:m,connectionUrl:f??"",npxPackage:y??""})??zn({uiType:m,connectionUrl:f??"",registryItems:V}),p=A=>{const x=A.trim();if(!x)return;const j=!!d.formState.dirtyFields.title,P=!!d.formState.dirtyFields.description,E=!!d.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!d.getValues("title").trim()&&k.title&&d.setValue("title",k.title,{shouldDirty:!1}),!P&&!(d.getValues("description")??"").trim()&&k.description&&d.setValue("description",k.description,{shouldDirty:!1}),!E&&k.envVarKeys?.length)){const R=d.getValues("env_vars")??[],L=new Set(R.map(T=>T.key)),D=k.envVarKeys.filter(T=>!L.has(T));D.length>0&&d.setValue("env_vars",[...R,...D.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},N=Gr(x);if(N&&i){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",N.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),I(bt({uiType:"NPX",npxPackage:N.packageName}));return}if(x.startsWith("http://")||x.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";d.setValue("ui_type",k,{shouldDirty:!0}),d.setValue("connection_url",x,{shouldDirty:!0}),I(bt({uiType:k,connectionUrl:x})??zn({uiType:k,connectionUrl:x,registryItems:V}));return}m==="NPX"&&I(bt({uiType:"NPX",npxPackage:x}))},v=A=>{A||d.reset(),e(A)},h=async A=>{let x,j=null,P=null,E=null;A.ui_type==="NPX"?(x="STDIO",j="",E=Hr(A.npx_package||"",A.env_vars||[])):A.ui_type==="STDIO"?(x="STDIO",j="",E=Qr(A.stdio_command||"",A.stdio_args||"",A.stdio_cwd,A.env_vars||[])):(x=A.ui_type,j=A.connection_url||"",P=A.connection_token||null);const I=qr("conn");try{await c.create.mutateAsync({id:I,title:A.title,description:A.description||null,connection_type:x,connection_url:j,connection_token:P,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:o.id,icon:A.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(I)}catch{oe.error("Failed to create connection")}},b="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",C=d.formState.isSubmitting?"Saving...":"Create Connection",_=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(ue,{control:d.control,name:"ui_type",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Type *"}),n.jsxs(ks,{value:A.value,onValueChange:A.onChange,children:[n.jsx(ce,{children:n.jsx(_s,{children:n.jsx(Cs,{})})}),n.jsxs(Ns,{children:[n.jsx(We,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(We,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(We,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(it,{className:"w-4 h-4"}),"Websocket"]})}),i&&n.jsxs(n.Fragment,{children:[n.jsx(We,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(wt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(We,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Po,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(de,{})]})}),m==="NPX"&&n.jsx(ue,{control:d.control,name:"npx_package",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"NPM Package *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"@perplexity-ai/mcp-server",...A,value:A.value??"",onPaste:x=>{const j=x.clipboardData.getData("text");j&&(x.preventDefault(),d.setValue("npx_package",j.trim(),{shouldDirty:!0}),p(j))},onBlur:x=>{p(x.target.value),A.onBlur()}})}),n.jsx(de,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(ue,{control:d.control,name:"stdio_command",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Command *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"node, bun, python...",...A,value:A.value??""})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"stdio_args",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Arguments"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"arg1 arg2 --flag value",...A,value:A.value??""})}),n.jsx(de,{})]})})]}),n.jsx(ue,{control:d.control,name:"stdio_cwd",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Working Directory"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"/path/to/project (optional)",...A,value:A.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(de,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(ue,{control:d.control,name:"env_vars",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Environment Variables"}),n.jsx(ce,{children:n.jsx(Wr,{value:A.value??[],onChange:A.onChange})}),n.jsx(de,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(ue,{control:d.control,name:"connection_url",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"URL *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"https://example.com/mcp",...A,value:A.value??"",onPaste:x=>{const j=x.clipboardData.getData("text");j&&(x.preventDefault(),d.setValue("connection_url",j.trim(),{shouldDirty:!0}),p(j))},onBlur:x=>{p(x.target.value),A.onBlur()}})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"connection_token",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:g?.token?.label??"Token (optional)"}),n.jsx(ce,{children:n.jsx(he,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...A,value:A.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),n.jsx(de,{})]})})]}),n.jsx(ue,{control:d.control,name:"title",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Name *"}),n.jsx(ce,{children:n.jsx(he,{placeholder:"My Connection",...A})}),n.jsx(de,{})]})}),n.jsx(ue,{control:d.control,name:"description",render:({field:A})=>n.jsxs(le,{children:[n.jsx(pe,{children:"Description"}),n.jsx(ce,{children:n.jsx(Kr,{placeholder:"A brief description of this connection",rows:3,...A,value:A.value??""})}),n.jsx(de,{})]})})]});return a?n.jsx(Dt,{open:t,onOpenChange:v,children:n.jsxs(Lt,{className:"max-h-[90vh]",children:[n.jsx(Mt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ft,{children:b}),n.jsx(Xo,{className:"mt-1",children:S})]}),n.jsx(Zo,{asChild:!0,children:n.jsx(Z,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(yr,{size:16})})})]})}),n.jsx(ct,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:_}),n.jsx(er,{children:n.jsx(Z,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:C})})]})})]})}):n.jsx(xe,{open:t,onOpenChange:v,children:n.jsxs(be,{className:"sm:max-w-[525px]",children:[n.jsxs(ye,{children:[n.jsx(ve,{children:b}),n.jsx(Rt,{children:S})]}),n.jsx(ct,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:_}),n.jsxs(Vs,{children:[n.jsx(Z,{type:"button",variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(Z,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:C})]})]})})]})})}function ni(t){const e=F.c(73),{mode:s,agentId:o,addedConnectionIds:r,onAdd:i,onCloneAndAdd:a,onConnectAndAdd:c,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:d,defaultTab:m}=t,f=s===void 0?"add":s,y=m===void 0?"connected":m,{org:g}=ie(),p=w.useDeferredValue(u),v=u!==p,h=p.trim().toLowerCase();let b;e[0]!==y?(b=B=>B??y,e[0]=y,e[1]=b):b=e[1];const[S,C]=Vo(mo.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),b);let _;e[2]!==S||e[3]!==C?(_=B=>{B!==S&&z("connections_dialog_tab_changed",{to_tab:B}),C(B)},e[2]=S,e[3]=C,e[4]=_):_=e[4];const A=_;let x;e[5]!==g.id||e[6]!==g.slug?(x={connectionId:pt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=x):x=e[7];const j=je(x);let P,E,I;if(e[8]!==j||e[9]!==p||e[10]!==g.id){I=p?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:p.trim()},{field:["description"],operator:"contains",value:p.trim()}]}:void 0;const B={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},se=JSON.stringify(B);E=Jr,P=me.collectionListInfinite(j,g.id,"","CONNECTIONS",se),e[8]=j,e[9]=p,e[10]=g.id,e[11]=P,e[12]=E,e[13]=I}else P=e[11],E=e[12],I=e[13];let N;e[14]!==j||e[15]!==I?(N=async B=>{const{pageParam:se}=B,we=se===void 0?0:se;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:we}})).structuredContent},e[14]=j,e[15]=I,e[16]=N):N=e[16];let k;e[17]!==P||e[18]!==N?(k={queryKey:P,queryFn:N,initialPageParam:0,getNextPageParam:li,staleTime:3e4},e[17]=P,e[18]=N,e[19]=k):k=e[19];const{data:R,fetchNextPage:L,hasNextPage:D,isFetchingNextPage:T}=E(k),U=R?.pages.flatMap(ai)??[],O=zr(U),$=new Set(U.filter(ii).map(ri)),W=Ms(),M=Fs(W,p),Y=Bn(M.loadMore,M.hasMore,M.isLoadingMore),G=Bn(L,D??!1,T),q=S==="all"||!!h,Q=q?M.items.filter(B=>{const se=Xr(B);if(se&&$.has(se))return!1;if(!h)return!0;const we=B._meta?.["mcp.mesh"];return[B.title,B.description,B.name,B.server?.title,B.server?.description,B.server?.name,we?.friendly_name,we?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],H=Q.filter(oi),X=Q.filter(si);let ne;e[20]!==r?(ne=B=>B.some(se=>r.has(se.id)),e[20]=r,e[21]=ne):ne=e[21];const J=ne;let re;e[22]!==r||e[23]!==o||e[24]!==l||e[25]!==J||e[26]!==f||e[27]!==i||e[28]!==d||e[29]!==a?(re=(B,se,we,Ke,Se)=>{const xt=J(Se),Ye=Se.find(Pe=>!r.has(Pe.id)),Ve=Se[0];if(f==="browse"){const Pe=$r(Ve);return n.jsx(Zt,{connection:{title:se,icon:we,description:Se.length>1?`${Se.length} instances`:Ke??void 0},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(yt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(dt,{size:11})," Connected"]}),onClick:()=>{z("connection_browse_clicked",{app_name:Ve.app_name??null,connection_id:Ve.id,instances_count:Se.length}),d?.(Pe)}},B)}return n.jsx(Zt,{connection:{title:se,icon:we,description:Ke},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[xt&&n.jsxs(yt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(dt,{size:11})," Added"]}),n.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Ye?(z("connection_add_clicked",{action:"use_existing",app_name:Ve.app_name??null,connection_id:Ye.id}),o&&z("agent_connection_attached",{agent_id:o,connection_id:Ye.id,app_name:Ve.app_name??null,mode:"existing"}),i(Ye.id)):(z("connection_add_clicked",{action:"clone",app_name:Ve.app_name??null,base_connection_id:Ve.id}),a(Ve))},children:"Add"})]})},B)},e[22]=r,e[23]=o,e[24]=l,e[25]=J,e[26]=f,e[27]=i,e[28]=d,e[29]=a,e[30]=re):re=e[30];const ee=re;let ae;e[31]!==l||e[32]!==f||e[33]!==c?(ae=B=>{const se=B._meta?.["mcp.mesh"],we=se?.friendlyName||se?.friendly_name||B.server?.title||B.title||B.server?.name||B.name||B.id||"",Ke=B.server?.description||B.description||null,Se=B.server?.icons?.[0]?.src||ei(B.server?.repository)||null,xt=se?.official===!0,Ye=se?.verified===!0,Ve=se?.owner==="deco";return n.jsx(Zt,{connection:{title:we,description:Ke,icon:Se},fallbackIcon:n.jsx(wt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[Ve&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(rt,{children:"Built and maintained by Deco"})]}),!Ve&&xt&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx(yt,{variant:"outline",size:"icon",children:n.jsx(Xt,{})})}),n.jsx(rt,{children:"Built and maintained by the official vendor"})]}),!Ve&&!xt&&Ye&&n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsx(yt,{variant:"outline",size:"icon",children:n.jsx(Xt,{})})}),n.jsx(rt,{children:"Verified by the Deco team"})]}),n.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),z("connection_add_clicked",{action:"connect_new",registry_item_id:B.id,app_name:se?.friendlyName||B.server?.name||B.name||null}),c(B)},children:l===B.id?n.jsx(nt,{size:14,className:"animate-spin"}):f==="browse"?"Connect":"Add"})]})},`catalog-${B.id}`)},e[31]=l,e[32]=f,e[33]=c,e[34]=ae):ae=e[34];const Re=ae,te=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(Br,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:S,onTabChange:B=>A(B)}),n.jsxs(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{z("connections_dialog_custom_clicked"),V()},children:[n.jsx(dn,{size:12}),"Custom Connection"]})]}),Ae=v&&"opacity-50 pointer-events-none";let Me;e[35]!==Ae?(Me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ae),e[35]=Ae,e[36]=Me):Me=e[36];const co="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ht;e[37]!==ee?(ht=B=>{if(B.type==="group")return ee(B.key,B.title,B.icon,null,B.connections);const se=B.connection;return ee(se.id,se.title,se.icon,se.description??null,[se])},e[37]=ee,e[38]=ht):ht=e[38];const Bt=O.map(ht);let Fe;e[39]!==G?(Fe=n.jsx("div",{ref:G,className:"col-span-full h-1"}),e[39]=G,e[40]=Fe):Fe=e[40];let Ue;e[41]!==T?(Ue=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=Ue):Ue=e[42];const qt=q&&H.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(Xt,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Kt=q&&H.map(Re),Yt=q&&X.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Wt=q&&X.map(Re);let Oe;e[43]!==Y||e[44]!==W||e[45]!==q?(Oe=q&&W.length>0&&n.jsx("div",{ref:Y,className:"col-span-full h-1"}),e[43]=Y,e[44]=W,e[45]=q,e[46]=Oe):Oe=e[46];let $e;e[47]!==M.isLoadingMore||e[48]!==q?($e=q&&M.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=M.isLoadingMore,e[48]=q,e[49]=$e):$e=e[49];let ze;e[50]!==Bt||e[51]!==Fe||e[52]!==Ue||e[53]!==qt||e[54]!==Kt||e[55]!==Yt||e[56]!==Wt||e[57]!==Oe||e[58]!==$e?(ze=n.jsxs("div",{className:co,children:[Bt,Fe,Ue,qt,Kt,Yt,Wt,Oe,$e]}),e[50]=Bt,e[51]=Fe,e[52]=Ue,e[53]=qt,e[54]=Kt,e[55]=Yt,e[56]=Wt,e[57]=Oe,e[58]=$e,e[59]=ze):ze=e[59];let Be;e[60]!==S||e[61]!==O.length||e[62]!==X||e[63]!==u||e[64]!==H?(Be=O.length===0&&H.length===0&&X.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:S==="connected"?"No connections yet":"No connections available"}),e[60]=S,e[61]=O.length,e[62]=X,e[63]=u,e[64]=H,e[65]=Be):Be=e[65];let qe;e[66]!==Me||e[67]!==ze||e[68]!==Be?(qe=n.jsxs("div",{className:Me,children:[ze,Be]}),e[66]=Me,e[67]=ze,e[68]=Be,e[69]=qe):qe=e[69];let gt;return e[70]!==te||e[71]!==qe?(gt=n.jsxs(n.Fragment,{children:[te,qe]}),e[70]=te,e[71]=qe,e[72]=gt):gt=e[72],gt}function si(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function oi(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ri(t){return t.app_name}function ii(t){return t.app_name}function ai(t){return t?.items??[]}function li(t,e){if(t?.hasMore)return e.reduce(ci,0)}function ci(t,e){return t+(e?.items?.length??0)}function di({open:t,onOpenChange:e,defaultTab:s,initialSearch:o="",...r}){const i=r.mode??"add",a="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:x=>{},u=(x,j,P)=>{a&&z("agent_connection_attached",{agent_id:a,connection_id:x,app_name:j,mode:P})},[V,d]=w.useState(null),[m,f]=w.useState(o),[y,g]=w.useState(!1),{org:p}=ie(),{data:v}=It.useSession(),h=wn(),b=mt(),S=Ne(),C=x=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:p.slug,appSlug:x}})},_=async x=>{d(x.app_name??x.id);try{const P=`${x.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:P,description:x.description??null,connection_type:x.connection_type,connection_url:x.connection_url??null,connection_token:null,icon:x.icon??null,app_name:x.app_name??null,app_id:x.app_id??null,connection_headers:x.connection_headers??null})).id,N=new URL(`/api/${p.slug}/mcp/${I}`,window.location.origin),k=await Gt({url:N.href,token:null,orgId:p.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:R,tokenInfo:L,error:D}=await Ht({connectionId:I,orgSlug:p.slug,scope:"offline_access"});if(D||!R){z("connection_oauth_failed",{connection_id:I,flow:"clone",error:D??"no_token"}),oe.error(`Authentication failed: ${D??"no token received"}`),await h.delete.mutateAsync(I);return}if(z("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),L)try{(await fetch(`/api/${p.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:L.accessToken,refreshToken:L.refreshToken,expiresIn:L.expiresIn,scope:L.scope,clientId:L.clientId,clientSecret:L.clientSecret,tokenEndpoint:L.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:R}})}else await h.update.mutateAsync({id:I,data:{connection_token:R}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(N.href,null)})}u(I,x.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),oe.error("Failed to add connection")}finally{d(null)}},A=async x=>{if(!(!p||!v?.user?.id)){d(x.id);try{const j=Zr(x,p.id,v.user.id,{remoteIndex:0}),P=j.connection_type==="STDIO",E=!!j.connection_url,I=P&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!E&&!I){oe.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:N}=await h.create.mutateAsync(j),k=new URL(`/api/${p.slug}/mcp/${N}`,window.location.origin),R=await Gt({url:k.href,token:null,orgId:p.id});if(R.supportsOAuth&&!R.isAuthenticated){const{token:L,tokenInfo:D,error:T}=await Ht({connectionId:N,orgSlug:p.slug,scope:"offline_access"});if(T||!L){z("connection_oauth_failed",{connection_id:N,flow:"connect_new",error:T??"no_token"}),oe.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${T??"no token received"})`}),u(N,j.app_name??null,"new"),l(N);return}if(z("connection_oauth_succeeded",{connection_id:N,flow:"connect_new"}),D)try{(await fetch(`/api/${p.slug}/connections/${N}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})})).ok?await h.update.mutateAsync({id:N,data:{}}):await h.update.mutateAsync({id:N,data:{connection_token:L}})}catch{await h.update.mutateAsync({id:N,data:{connection_token:L}})}else await h.update.mutateAsync({id:N,data:{connection_token:L}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(k.href,null)}),oe.success("Connected and authenticated")}else oe.success("Connected");u(N,j.app_name??null,"new"),l(N)}catch(j){console.error("Failed to connect:",j),oe.error("Failed to connect")}finally{d(null)}}};return n.jsxs(xe,{open:t,onOpenChange:e,children:[n.jsxs(be,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(ye,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(ve,{className:"text-base font-semibold",children:i==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(ws,{value:m,onChange:f,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(nt,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(ni,{mode:i,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:_,onConnectAndAdd:A,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:C,defaultTab:s})})]}),n.jsx(ti,{open:y,onOpenChange:g,onCreated:async x=>{g(!1);const j=new URL(`/api/${p.slug}/mcp/${x}`,window.location.origin),P=await Gt({url:j.href,token:null,orgId:p.id});if(P.supportsOAuth&&!P.isAuthenticated){const{token:E,tokenInfo:I,error:N}=await Ht({connectionId:x,orgSlug:p.slug,scope:"offline_access"});if(N||!E){z("connection_oauth_failed",{connection_id:x,flow:"custom_create",error:N??"no_token"}),oe.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${N??"no token received"})`}),u(x,null,"custom"),l(x),e(!1);return}if(z("connection_oauth_succeeded",{connection_id:x,flow:"custom_create"}),I)try{(await fetch(`/api/${p.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:x,data:{}}):await h.update.mutateAsync({id:x,data:{connection_token:E}})}catch{await h.update.mutateAsync({id:x,data:{connection_token:E}})}else await h.update.mutateAsync({id:x,data:{connection_token:E}});await b.invalidateQueries({queryKey:me.isMCPAuthenticated(j.href,null)})}u(x,null,"custom"),l(x),e(!1)}})]})}const ui='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',Vi='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',mi=`# Performance Watchdog
2
2
 
3
3
  You are the **Performance Watchdog**, a specialist agent focused on web performance.
4
4
 
@@ -542,6 +542,6 @@ When given a research question or topic:
542
542
  - Identify sources, patterns, gaps, and contradictions
543
543
  - Deliver findings as clear, structured summaries with actionable insights
544
544
 
545
- Approach every request with rigor and intellectual honesty. Always surface what is uncertain or debated, not just what is known.`,Ri=["Break any topic into key sub-questions and define scope","Synthesize information from multiple angles and sources","Distinguish facts, expert consensus, and contested claims","Identify gaps, contradictions, and emerging patterns","Deliver structured summaries with actionable insights"];function Yn(t){const e=F.c(7),{onRecruit:s,isRecruiting:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Web Researcher agent that conducts thorough, rigorous research on any topic and delivers structured, actionable insights."}),e[0]=r):r=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[i,n.jsx("ul",{className:"space-y-1.5",children:Ri.map(Pi)})]}),e[2]=a):a=e[2];const c=o?"Setting up...":"Add Web Researcher";let l;return e[3]!==o||e[4]!==s||e[5]!==c?(l=n.jsxs("div",{className:"flex flex-col gap-6",children:[r,a,n.jsx(Z,{onClick:s,disabled:o,className:"w-full cursor-pointer",children:c})]}),e[3]=o,e[4]=s,e[5]=c,e[6]=l):l=e[6],l}function Pi(t){return n.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[n.jsx("span",{className:"text-amber-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function hu({open:t,onOpenChange:e,existingAgent:s}){const o=Ut(),r=An(),i=gs(),[a,c]=w.useState(!1),l=ms.find(m=>m.id==="ai-research"),u=n.jsx(hs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),r(s.id);return}c(!0);try{const m=await i.create.mutateAsync({title:l.title,description:"Systematic research and information synthesis assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Ti}});z("agent_recruit_confirmed",{template_id:"ai-research",agent_id:m.id}),e(!1),r(m.id)}catch(m){z("agent_recruit_failed",{template_id:"ai-research",error:m instanceof Error?m.message:String(m)}),console.error("Failed to create Researcher agent:",m)}finally{c(!1)}},d=`Add ${l.title}`;return o?n.jsx(Dt,{open:t,onOpenChange:e,children:n.jsxs(Lt,{className:"h-[70dvh]",children:[n.jsx(Mt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Ft,{className:"text-xl font-semibold",children:d})]})}),n.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:n.jsx(Yn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(xe,{open:t,onOpenChange:e,children:n.jsxs(be,{className:"sm:max-w-[500px] p-8",children:[n.jsx(ye,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ve,{className:"text-xl font-semibold",children:d})]})}),n.jsx(Yn,{onRecruit:V,isRecruiting:a})]})})}function Ei(t,e,s,o){const r=t.getQueriesData({queryKey:me.tasksPrefix(e)});let i=null;for(const[,a]of r)if(a?.items)for(const c of a.items)c.virtual_mcp_id===s&&c.created_by===o&&(c.hidden||(!i||c.updated_at>i.updated_at)&&(i=c));return i}function gu(t){const e=Ne(),s=mt(),o=xs(),{locator:r}=ie(),i=bn({strict:!1}),a=yn({strict:!1}),{data:c}=It.useSession(),l=c?.user?.id;return async u=>{const V=l?Ei(s,r,u,l):null;if(V)return e({to:"/$org/$taskId",params:{org:t,taskId:V.id},search:{virtualmcpid:u}}),{resumed:!0};const d=crypto.randomUUID(),m=u===a.virtualmcpid?bs(s,r,i.taskId??""):null;try{await o.create.mutateAsync({id:d,virtual_mcp_id:u,...m?{branch:m}:{}})}catch{}return e({to:"/$org/$taskId",params:{org:t,taskId:d},search:{virtualmcpid:u}}),{resumed:!1}}}function Di(t,e){return t===1?!0:t===0?!1:e}function Li(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",o=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:o,chatOpen:r}}function xu(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Mi(t,e){return t===1?!0:t===0?!1:e}function bu(t,e){const s=Ne(),o=yn({strict:!1}),r=bn({strict:!1}),i=mt(),a=xs(),{locator:c}=ie(),{virtualMcpId:l,orgSlug:u,isAgentRoute:V}=e,d=Li({entityMetadata:t,mainParamPresent:o.main!==void 0,mainParamValue:o.main}),m=Mi(o.chat,d.chatOpen),f=d.mainOpen,y=w.useRef(crypto.randomUUID()),g=r.taskId??y.current,p="/$org/$taskId",v=P=>({org:u,taskId:P}),h=V?{virtualmcpid:l}:{},b=(P,E)=>{s({to:p,params:v(g),search:I=>({...I,...P}),replace:E?.replace??!1})},S=(P,E)=>{s({to:p,params:v(P),search:I=>{const N={};return E?N.virtualmcpid=E:V&&(N.virtualmcpid=l),I.tasks&&(N.tasks=I.tasks),N}})},C=()=>{f?b({main:"0"},{replace:!0}):b({main:rr(t)},{replace:!0})},_=()=>{b({chat:m?0:1},{replace:!0})},A=()=>{m||b({chat:1},{replace:!0})},x=async()=>{const P=crypto.randomUUID(),E=bs(i,c,g);try{await a.create.mutateAsync({id:P,virtual_mcp_id:l,...E?{branch:E}:{}})}catch{}s({to:p,params:v(P),search:I=>{const N={...h,chat:1};return I.tasks&&(N.tasks=I.tasks),N}})},j=P=>{b({main:P},{replace:!0})};return{taskId:g,mainOpen:f,chatOpen:m,mainParam:o.main,setTaskId:S,toggleMain:C,toggleChat:_,openChat:A,createNewTask:x,openTab:j}}const In=w.createContext(null);function yu(t){const e=F.c(17),{children:s}=t,o=Ne();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const i=yn(r);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[1]=a):a=e[1];const c=bn(a);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={owner:"all",status:"open"},e[2]=l):l=e[2];const{tasks:u}=zo(l);let V;e[3]!==c.taskId||e[4]!==i.tasks||e[5]!==u?(V=()=>Di(i.tasks,!!c.taskId&&u.length>0),e[3]=c.taskId,e[4]=i.tasks,e[5]=u,e[6]=V):V=e[6];const[d,m]=w.useState(V);let f,y;e[7]!==o||e[8]!==d?(f=()=>{o({search:(b=>({...b,tasks:d?1:0})),replace:!0})},y=[d,o],e[7]=o,e[8]=d,e[9]=f,e[10]=y):(f=e[9],y=e[10]),w.useEffect(f,y);let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=()=>m(Fi),e[11]=g):g=e[11];const p=g;let v;e[12]!==d?(v={tasksOpen:d,toggleTasks:p},e[12]=d,e[13]=v):v=e[13];let h;return e[14]!==s||e[15]!==v?(h=n.jsx(In.Provider,{value:v,children:s}),e[14]=s,e[15]=v,e[16]=h):h=e[16],h}function Fi(t){return!t}function vu(){const t=w.useContext(In);if(!t)throw new Error("useTasksPanelState must be used inside <TasksPanelStateProvider>");return t}function wu(){return w.useContext(In)}const Us=w.createContext(null);function Te(){const t=w.use(Us);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function fe(t){const e=F.c(10),{children:s}=t,[o,r]=w.useState(null),[i,a]=w.useState(null),[c,l]=w.useState(null),[u,V]=w.useState(null);let d;e[0]!==c||e[1]!==u||e[2]!==i||e[3]!==o?(d={togglesEl:o,setTogglesEl:r,tabsEl:i,setTabsEl:a,centerEl:c,setCenterEl:l,rightEl:u,setRightEl:V},e[0]=c,e[1]=u,e[2]=i,e[3]=o,e[4]=d):d=e[4];let m;e[5]!==s?(m=n.jsx("div",{className:"flex flex-col h-full min-h-0",children:s}),e[5]=s,e[6]=m):m=e[6];let f;return e[7]!==d||e[8]!==m?(f=n.jsx(Us,{value:d,children:m}),e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function Ui(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"shrink-0 grid grid-cols-3 items-center pl-1 pr-2 pt-0.25 h-12",children:s}),e[0]=s,e[1]=o):o=e[1],o}function Oi(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:s}),e[0]=s,e[1]=o):o=e[1],o}function $i(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center justify-end gap-0.5 min-w-0 justify-self-end",children:s}),e[0]=s,e[1]=o):o=e[1],o}function zi(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("button",{type:"button",onClick:qi,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go back",children:n.jsx(hr,{size:16})}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs(n.Fragment,{children:[e,n.jsx("button",{type:"button",onClick:Bi,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go forward",children:n.jsx(vs,{size:16})})]}),t[1]=s):s=t[1],s}function Bi(){return window.history.forward()}function qi(){return window.history.back()}function Ki(){const t=F.c(2),{setCenterEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"min-w-0 flex items-center justify-center gap-2"}),t[0]=e,t[1]=s):s=t[1],s}function Yi(t){const e=F.c(3),{children:s}=t,{centerEl:o}=Te();if(!o)return null;let r;return e[0]!==o||e[1]!==s?(r=ft.createPortal(s,o),e[0]=o,e[1]=s,e[2]=r):r=e[2],r}function Wi(){const t=F.c(2),{setTabsEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"shrink-0 flex items-center"}),t[0]=e,t[1]=s):s=t[1],s}function Gi(t){const e=F.c(3),{children:s}=t,{tabsEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function Hi(){const t=F.c(2),{setTogglesEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center gap-0.5 shrink-0 ml-0.5"}),t[0]=e,t[1]=s):s=t[1],s}function Qi(t){const e=F.c(3),{children:s}=t,{togglesEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function Ji(){const t=F.c(2),{setRightEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center justify-end gap-0.5 shrink-0"}),t[0]=e,t[1]=s):s=t[1],s}function Xi(t){const e=F.c(3),{children:s}=t,{rightEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}fe.Header=Ui;fe.LeftColumn=Oi;fe.RightColumn=$i;fe.Nav=zi;fe.CenterSlot=Ki;fe.Center=Yi;fe.TabsSlot=Wi;fe.Tabs=Gi;fe.TogglesSlot=Hi;fe.Toggles=Qi;fe.RightSlot=Ji;fe.Right=Xi;function Zi(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?Le().min(1,"Required"):Le();return Ie(e)}function ea(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Tn(t){const e=F.c(65),{prompt:s,setPrompt:o,onSubmit:r}=t,i=w.useId();let a;if(e[0]!==s){const T=s?Zi(s):Ie({});a=gn(T),e[0]=s,e[1]=a}else a=e[1];const l=a;let u;e[2]!==s?(u=s?ea(s):{},e[2]=s,e[3]=u):u=e[3];let V;e[4]!==l||e[5]!==u?(V={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=V):V=e[6];const d=hn(V);let m;e[7]!==s?.arguments?(m=s?.arguments??[],e[7]=s?.arguments,e[8]=m):m=e[8];const f=m;let y;e[9]!==d||e[10]!==r||e[11]!==o?(y=async T=>{await r(T),o(null),d.reset()},e[9]=d,e[10]=r,e[11]=o,e[12]=y):y=e[12];const g=y;let p;e[13]!==d||e[14]!==o?(p=T=>{T||(d.reset(),o(null))},e[13]=d,e[14]=o,e[15]=p):p=e[15];const v=p;if(!s)return null;let h;e[16]!==s._meta||e[17]!==s.name||e[18]!==s.title?(h=s.title||Ot(s.name,Ce(s._meta)),e[16]=s._meta,e[17]=s.name,e[18]=s.title,e[19]=h):h=e[19];let b;e[20]!==h?(b=n.jsx(ve,{children:n.jsx("span",{className:"capitalize",children:h})}),e[20]=h,e[21]=b):b=e[21];let S;e[22]!==s.description?(S=s.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),e[22]=s.description,e[23]=S):S=e[23];let C;e[24]!==S||e[25]!==b?(C=n.jsxs(ye,{children:[b,S]}),e[24]=S,e[25]=b,e[26]=C):C=e[26];let _;e[27]!==d||e[28]!==g?(_=T=>{T.stopPropagation(),d.handleSubmit(g)(T)},e[27]=d,e[28]=g,e[29]=_):_=e[29];let A;if(e[30]!==f||e[31]!==d.control||e[32]!==d.formState.isSubmitting){let T;e[34]!==d.control||e[35]!==d.formState.isSubmitting?(T=U=>n.jsx(ue,{control:d.control,name:U.name,render:O=>{const{field:$}=O;return n.jsxs(le,{children:[n.jsxs(pe,{className:"text-xs",children:[U.name,U.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(ce,{children:n.jsx(he,{...$,value:$.value??"",required:U.required,placeholder:U.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(de,{})]})}},U.name),e[34]=d.control,e[35]=d.formState.isSubmitting,e[36]=T):T=e[36],A=f.map(T),e[30]=f,e[31]=d.control,e[32]=d.formState.isSubmitting,e[33]=A}else A=e[33];let x;e[37]!==v?(x=()=>v(!1),e[37]=v,e[38]=x):x=e[38];let j;e[39]!==d.formState.isSubmitting||e[40]!==x?(j=n.jsx(Z,{type:"button",variant:"ghost",onClick:x,disabled:d.formState.isSubmitting,children:"Cancel"}),e[39]=d.formState.isSubmitting,e[40]=x,e[41]=j):j=e[41];const P=!d.formState.isValid||d.formState.isSubmitting;let E;e[42]!==d.formState.isSubmitting?(E=d.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(At,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=d.formState.isSubmitting,e[43]=E):E=e[43];let I;e[44]!==i||e[45]!==P||e[46]!==E?(I=n.jsx(Z,{type:"submit",form:i,disabled:P,children:E}),e[44]=i,e[45]=P,e[46]=E,e[47]=I):I=e[47];let N;e[48]!==j||e[49]!==I?(N=n.jsxs(Vs,{children:[j,I]}),e[48]=j,e[49]=I,e[50]=N):N=e[50];let k;e[51]!==i||e[52]!==_||e[53]!==A||e[54]!==N?(k=n.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:_,children:[A,N]}),e[51]=i,e[52]=_,e[53]=A,e[54]=N,e[55]=k):k=e[55];let R;e[56]!==d||e[57]!==k?(R=n.jsx(ct,{...d,children:k}),e[56]=d,e[57]=k,e[58]=R):R=e[58];let L;e[59]!==C||e[60]!==R?(L=n.jsxs(be,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[59]=C,e[60]=R,e[61]=L):L=e[61];let D;return e[62]!==v||e[63]!==L?(D=n.jsx(xe,{open:!0,onOpenChange:v,children:L}),e[62]=v,e[63]=L,e[64]=D):D=e[64],D}function ta(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}function na(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const Wn=3,Os="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",sa="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function $s(t){const e=F.c(46),{item:s,onSelect:o,isLoading:r,isDisabled:i,variant:a}=t,c=a===void 0?"pill":a,{prompt:l}=s;let u;if(e[0]!==l._meta||e[1]!==l.name||e[2]!==l.title){const A=Ce(l._meta);u=l.title??Ot(l.name,A),e[0]=l._meta,e[1]=l.name,e[2]=l.title,e[3]=u}else u=e[3];const V=u,d=l.description||null;if(c==="card"){let A;e[4]!==o||e[5]!==l?(A=()=>o(l),e[4]=o,e[5]=l,e[6]=A):A=e[6];const x=i||r,j=r&&"bg-accent/40",P=(i||r)&&"cursor-not-allowed opacity-50";let E;e[7]!==j||e[8]!==P?(E=K(sa,"hover:bg-accent/60 text-foreground",j,P),e[7]=j,e[8]=P,e[9]=E):E=e[9];let I;e[10]!==V?(I=n.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=I):I=e[11];let N;e[12]!==r?(N=r&&n.jsx(At,{size:"xs"}),e[12]=r,e[13]=N):N=e[13];let k;e[14]!==I||e[15]!==N?(k=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I,N]}),e[14]=I,e[15]=N,e[16]=k):k=e[16];let R;e[17]!==d?(R=d&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:d}),e[17]=d,e[18]=R):R=e[18];let L;return e[19]!==k||e[20]!==R||e[21]!==A||e[22]!==x||e[23]!==E?(L=n.jsxs("button",{type:"button",onClick:A,disabled:x,className:E,children:[k,R]}),e[19]=k,e[20]=R,e[21]=A,e[22]=x,e[23]=E,e[24]=L):L=e[24],L}let m;e[25]!==o||e[26]!==l?(m=()=>o(l),e[25]=o,e[26]=l,e[27]=m):m=e[27];const f=i||r,y=r&&"bg-muted/50",g=(i||r)&&"cursor-not-allowed opacity-50";let p;e[28]!==y||e[29]!==g?(p=K(Os,"hover:bg-muted/70 hover:text-foreground",y,g),e[28]=y,e[29]=g,e[30]=p):p=e[30];let v;e[31]!==V?(v=n.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=v):v=e[32];let h;e[33]!==r?(h=r&&n.jsx(At,{size:"xs"}),e[33]=r,e[34]=h):h=e[34];let b;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==v||e[39]!==h?(b=n.jsx(ot,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:m,disabled:f,className:p,children:[v,h]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=v,e[39]=h,e[40]=b):b=e[40];const S=d??V;let C;e[41]!==S?(C=n.jsx(rt,{side:"top",className:"max-w-xs",children:n.jsx("p",{className:"text-xs",children:S})}),e[41]=S,e[42]=C):C=e[42];let _;return e[43]!==b||e[44]!==C?(_=n.jsxs(st,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=_):_=e[45],_}function oa(t){const e=F.c(41),{items:s,open:o,onOpenChange:r,onSelect:i,loadingPrompt:a}=t,[c,l]=w.useState(""),u=!!a;let V;e[0]!==s||e[1]!==c?(V=c.trim()?s.filter(x=>{const j=c.toLowerCase();return x.prompt.name.toLowerCase().includes(j)||(x.prompt.title??"").toLowerCase().includes(j)||(x.prompt.description??"").toLowerCase().includes(j)}):s,e[0]=s,e[1]=c,e[2]=V):V=e[2];const d=V,m=Ut();let f;e[3]!==d.length||e[4]!==c?(f=d.length===0&&n.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=d.length,e[4]=c,e[5]=f):f=e[5];let y;if(e[6]!==d||e[7]!==u||e[8]!==a?.name||e[9]!==r||e[10]!==i){let x;e[12]!==u||e[13]!==a?.name||e[14]!==r||e[15]!==i?(x=j=>n.jsx($s,{item:j,variant:"card",onSelect:P=>{r(!1),i(P)},isLoading:a?.name===j.prompt.name,isDisabled:u&&a?.name!==j.prompt.name},j.prompt.name),e[12]=u,e[13]=a?.name,e[14]=r,e[15]=i,e[16]=x):x=e[16],y=d.map(x),e[6]=d,e[7]=u,e[8]=a?.name,e[9]=r,e[10]=i,e[11]=y}else y=e[11];let g;e[17]!==f||e[18]!==y?(g=n.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,y]})}),e[17]=f,e[18]=y,e[19]=g):g=e[19];const p=g;let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=x=>{x.key==="Escape"&&l("")},e[20]=v):v=e[20];let h;e[21]!==c?(h=n.jsx(ws,{value:c,onChange:l,placeholder:"Search prompts...",onKeyDown:v}),e[21]=c,e[22]=h):h=e[22];const b=h;if(m){let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Mt,{className:"sr-only",children:n.jsx(Ft,{children:"All prompts"})}),e[23]=x):x=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=j):j=e[24];let P;e[25]!==p||e[26]!==b?(P=n.jsxs(Lt,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[x,j,b,p]}),e[25]=p,e[26]=b,e[27]=P):P=e[27];let E;return e[28]!==r||e[29]!==o||e[30]!==P?(E=n.jsx(an,{delayDuration:400,children:n.jsx(Dt,{open:o,onOpenChange:r,children:P})}),e[28]=r,e[29]=o,e[30]=P,e[31]=E):E=e[31],E}let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{className:"sr-only",children:n.jsx(ve,{children:"All prompts"})}),e[32]=S):S=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let _;e[34]!==p||e[35]!==b?(_=n.jsxs(be,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,C,b,p]}),e[34]=p,e[35]=b,e[36]=_):_=e[36];let A;return e[37]!==r||e[38]!==o||e[39]!==_?(A=n.jsx(an,{delayDuration:400,children:n.jsx(xe,{open:o,onOpenChange:r,children:_})}),e[37]=r,e[38]=o,e[39]=_,e[40]=A):A=e[40],A}function ra(t){const e=F.c(29),{items:s,onSelect:o,loadingPrompt:r,className:i}=t,[a,c]=w.useState(!1);if(s.length===0)return null;let l,u,V;if(e[0]!==s||e[1]!==r||e[2]!==o){const v=s.slice(0,Wn);let h;e[6]!==s?(h=s.slice(Wn),e[6]=s,e[7]=h):h=e[7],l=h,u=!!r;let b;e[8]!==u||e[9]!==r?.name||e[10]!==o?(b=S=>n.jsx($s,{item:S,onSelect:o,isLoading:r?.name===S.prompt.name,isDisabled:u&&r?.name!==S.prompt.name},S.prompt.name),e[8]=u,e[9]=r?.name,e[10]=o,e[11]=b):b=e[11],V=v.map(b),e[0]=s,e[1]=r,e[2]=o,e[3]=l,e[4]=u,e[5]=V}else l=e[3],u=e[4],V=e[5];const d=V;let m;e[12]!==i?(m=K("w-full flex flex-wrap gap-2 justify-center",i),e[12]=i,e[13]=m):m=e[13];let f;e[14]!==l.length||e[15]!==u?(f=l.length>0&&n.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:K(Os,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",l.length," more"]}),e[14]=l.length,e[15]=u,e[16]=f):f=e[16];let y;e[17]!==d||e[18]!==m||e[19]!==f?(y=n.jsxs("div",{className:m,children:[d,f]}),e[17]=d,e[18]=m,e[19]=f,e[20]=y):y=e[20];let g;e[21]!==s||e[22]!==r||e[23]!==a||e[24]!==o?(g=n.jsx(oa,{items:s,open:a,onOpenChange:c,onSelect:o,loadingPrompt:r}),e[21]=s,e[22]=r,e[23]=a,e[24]=o,e[25]=g):g=e[25];let p;return e[26]!==y||e[27]!==g?(p=n.jsxs(an,{delayDuration:400,children:[y,g]}),e[26]=y,e[27]=g,e[28]=p):p=e[28],p}function ia(){return null}function aa(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function la(t){const e=F.c(31),{connectionId:s}=t,{sendMessage:o}=Et(),{tiptapDocRef:r}=Pt(),{org:i}=ie();let a;e[0]!==s||e[1]!==i.id||e[2]!==i.slug?(a={connectionId:s,orgId:i.id,orgSlug:i.slug},e[0]=s,e[1]=i.id,e[2]=i.slug,e[3]=a):a=e[3];const c=je(a);let l;e[4]!==c?(l={client:c,staleTime:6e4},e[4]=c,e[5]=l):l=e[5];const{data:u}=gr(l);let V;e[6]!==u?.prompts?(V=u?.prompts??[],e[6]=u?.prompts,e[7]=V):V=e[7];const d=V;let m;e[8]!==d?(m=d.map(ca),e[8]=d,e[9]=m):m=e[9];const f=m;let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={stage:"idle"},e[10]=y):y=e[10];const[g,p]=w.useReducer(aa,y),[v,h]=w.useState(null);let b;e[11]!==c||e[12]!==o||e[13]!==r?(b=async(k,R)=>{if(!c){oe.error("MCP client not available"),p({type:"RESET"});return}try{const L=await Cn(c,k.name,R);p({type:"RESET"});const D=na(r.current,{type:"paragraph",content:[ir({id:k.name,name:_n(k.name,Ce(k._meta)),metadata:L.messages,char:"/"})]});await o(D)}catch(L){console.error("[ice-breakers] Failed to fetch prompt:",L),oe.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=c,e[12]=o,e[13]=r,e[14]=b):b=e[14];const S=b;let C;e[15]!==S?(C=async k=>{if(k.arguments&&k.arguments.length>0){p({type:"SELECT_PROMPT",prompt:k}),h(k);return}p({type:"START_LOADING",prompt:k}),await S(k)},e[15]=S,e[16]=C):C=e[16];const _=C;let A;e[17]!==v||e[18]!==S?(A=async k=>{v&&(p({type:"START_LOADING",prompt:v,arguments:k}),h(null),await S(v,k))},e[17]=v,e[18]=S,e[19]=A):A=e[19];const x=A;if(f.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let P;e[20]!==_||e[21]!==f||e[22]!==j?(P=n.jsx(ra,{items:f,onSelect:_,loadingPrompt:j}),e[20]=_,e[21]=f,e[22]=j,e[23]=P):P=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{h(null),p({type:"RESET"})},e[24]=E):E=e[24];let I;e[25]!==v||e[26]!==x?(I=n.jsx(Tn,{prompt:v,setPrompt:E,onSubmit:x}),e[25]=v,e[26]=x,e[27]=I):I=e[27];let N;return e[28]!==P||e[29]!==I?(N=n.jsxs(n.Fragment,{children:[P,I]}),e[28]=P,e[29]=I,e[30]=N):N=e[30],N}function ca(t){return{prompt:t}}function da(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:o}=Pt(),{org:r}=ie();let i;e[0]!==r.id?(i=jn(r.id),e[0]=r.id,e[1]=i):i=e[1];const a=i.id,c=o?.id??a;let l;e[2]!==s?(l=K("w-full @container",s),e[2]=s,e[3]=l):l=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(ia,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=n.jsx(la,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=n.jsx(fo,{fallback:null,children:n.jsx(w.Suspense,{fallback:V,children:d},u)}),e[7]=u,e[8]=d,e[9]=m):m=e[9];let f;return e[10]!==l||e[11]!==m?(f=n.jsx("div",{className:l,children:m}),e[10]=l,e[11]=m,e[12]=f):f=e[12],f}function zs(t){const e=F.c(21),{current:s,total:o,onPrev:r,onNext:i}=t;if(o<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==c?(l=K("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Ar,{size:14}),e[2]=u):u=e[2];let V;e[3]!==r||e[4]!==a||e[5]!==l?(V=n.jsx("button",{type:"button",onClick:r,disabled:a,className:l,"aria-label":"Previous question",children:u}),e[3]=r,e[4]=a,e[5]=l,e[6]=V):V=e[6];const d=s+1;let m;e[7]!==d||e[8]!==o?(m=n.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",o]}),e[7]=d,e[8]=o,e[9]=m):m=e[9];const f=s===o-1,y=s===o-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==y?(g=K("p-0.5 rounded transition-colors",y),e[10]=y,e[11]=g):g=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Is,{size:14}),e[12]=p):p=e[12];let v;e[13]!==i||e[14]!==g||e[15]!==f?(v=n.jsx("button",{type:"button",onClick:i,disabled:f,className:g,"aria-label":"Next question",children:p}),e[13]=i,e[14]=g,e[15]=f,e[16]=v):v=e[16];let h;return e[17]!==v||e[18]!==V||e[19]!==m?(h=n.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,v]}),e[17]=v,e[18]=V,e[19]=m,e[20]=h):h=e[20],h}const tn="cubic-bezier(0.645, 0.045, 0.355, 1)",ua={default:"",error:"after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none",warning:"after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none"},Va={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ma={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function He(t){const e=F.c(61),{icon:s,label:o,count:r,title:i,footerLeft:a,footerRight:c,children:l,defaultExpanded:u,variant:V,onClose:d}=t,m=V===void 0?"default":V,[f,y]=w.useState(u),[g,p]=w.useState(!1);let v;e[0]!==d?(v=()=>{p(!0),d?.()},e[0]=d,e[1]=v):v=e[1];const h=v;if(g)return null;const b=Va[m],S=ua[m];let C;e[2]!==b||e[3]!==S?(C=K("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",b,S),e[2]=b,e[3]=S,e[4]=C):C=e[4];let _;e[5]===Symbol.for("react.memo_cache_sentinel")?(_=()=>y(fa),e[5]=_):_=e[5];const A=f&&"rounded-b-none",x=!f&&"rounded-b-xl";let j;e[6]!==A||e[7]!==x?(j=K("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",A,x),e[6]=A,e[7]=x,e[8]=j):j=e[8];const P=ma[m];let E;e[9]!==P?(E=K("shrink-0",P),e[9]=P,e[10]=E):E=e[10];let I;e[11]!==s||e[12]!==E?(I=n.jsx("span",{className:E,children:s}),e[11]=s,e[12]=E,e[13]=I):I=e[13];let N;e[14]!==o?(N=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:o}),e[14]=o,e[15]=N):N=e[15];let k;e[16]!==r?(k=r?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=k):k=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let L;e[18]!==R?(L=n.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:n.jsx(kr,{size:16,style:{transform:R,transition:`transform 180ms ${tn}`}})}),e[18]=R,e[19]=L):L=e[19];let D,T;e[20]!==h?(D=ee=>{ee.stopPropagation(),h()},T=ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),ee.stopPropagation(),h())},e[20]=h,e[21]=D,e[22]=T):(D=e[21],T=e[22]);let U;e[23]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Ze,{size:16}),e[23]=U):U=e[23];let O;e[24]!==D||e[25]!==T?(O=n.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:D,onKeyDown:T,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:U}),e[24]=D,e[25]=T,e[26]=O):O=e[26];let $;e[27]!==f||e[28]!==I||e[29]!==N||e[30]!==k||e[31]!==L||e[32]!==O||e[33]!==j?($=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:_,className:j,children:[I,N,k,L,O]}),e[27]=f,e[28]=I,e[29]=N,e[30]=k,e[31]=L,e[32]=O,e[33]=j,e[34]=$):$=e[34];const W=f?"1fr":"0fr";let M;e[35]!==W?(M={display:"grid",gridTemplateRows:W,transition:`grid-template-rows 180ms ${tn}`},e[35]=W,e[36]=M):M=e[36];let Y;e[37]===Symbol.for("react.memo_cache_sentinel")?(Y={overflow:"hidden",minHeight:0},e[37]=Y):Y=e[37];const G=f?1:0;let q;e[38]!==G?(q={opacity:G,transition:`opacity 120ms ${tn}`},e[38]=G,e[39]=q):q=e[39];let Q;e[40]!==i?(Q=i?n.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:n.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=i,e[41]=Q):Q=e[41];let H;e[42]!==l||e[43]!==i?(H=l?n.jsx("div",{className:K("overflow-clip pb-4",!i&&"pt-4"),children:l}):null,e[42]=l,e[43]=i,e[44]=H):H=e[44];let X;e[45]!==a||e[46]!==c?(X=a||c?n.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{children:a}),n.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=a,e[46]=c,e[47]=X):X=e[47];let ne;e[48]!==q||e[49]!==Q||e[50]!==H||e[51]!==X?(ne=n.jsx("div",{style:Y,children:n.jsxs("div",{style:q,children:[Q,H,X]})}),e[48]=q,e[49]=Q,e[50]=H,e[51]=X,e[52]=ne):ne=e[52];let J;e[53]!==M||e[54]!==ne?(J=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:ne}),e[53]=M,e[54]=ne,e[55]=J):J=e[55];let re;return e[56]!==$||e[57]!==J||e[58]!==C||e[59]!==m?(re=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[$,J]}),e[56]=$,e[57]=J,e[58]=C,e[59]=m,e[60]=re):re=e[60],re}function fa(t){return!t}const pa="User denied this tool call, give other alternatives.";function ha(t){const e=F.c(9),{onYolo:s}=t,[o,r]=Tt();let i;e[0]!==s||e[1]!==o||e[2]!==r?(i=V=>{const d=V;r({...o,toolApprovalLevel:d}),d==="auto"&&s()},e[0]=s,e[1]=o,e[2]=r,e[3]=i):i=e[3];const a=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(_s,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:xa,children:n.jsx(Cs,{})}),e[4]=c):c=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ns,{children:Xe.map(ga)}),e[5]=l):l=e[5];let u;return e[6]!==a||e[7]!==o.toolApprovalLevel?(u=n.jsxs(ks,{value:o.toolApprovalLevel,onValueChange:a,children:[c,l]}),e[6]=a,e[7]=o.toolApprovalLevel,e[8]=u):u=e[8],u}function ga(t){return n.jsx(We,{value:t.value,children:t.label},t.value)}function xa(t){return t.stopPropagation()}function ba(t){const e=F.c(5),{input:s}=t;if(s==null){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=i):i=e[0],i}let o;try{let i;e[1]!==s?(i=JSON.stringify(s,null,2),e[1]=s,e[2]=i):i=e[2],o=i}catch{o=String(s)}let r;return e[3]!==o?(r=n.jsx("div",{className:"px-4",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:o})}),e[3]=o,e[4]=r):r=e[4],r}function ya(t){const e=F.c(44),{approvals:s,onRespond:o}=t,[r,i]=w.useState(0),a=Math.min(r,s.length-1),c=s[a];if(!c)return null;let l;e[0]!==c.approvalId||e[1]!==o?(l=()=>{o(c.approvalId,!1,pa)},e[0]=c.approvalId,e[1]=o,e[2]=l):l=e[2];const u=l;let V;e[3]!==c.approvalId||e[4]!==o?(V=()=>{o(c.approvalId,!0)},e[3]=c.approvalId,e[4]=o,e[5]=V):V=e[5];const d=V;let m;e[6]!==s||e[7]!==o?(m=()=>{for(const R of s)o(R.approvalId,!0)},e[6]=s,e[7]=o,e[8]=m):m=e[8];const f=m;let y;e[9]!==a?(y=()=>{a>0&&i(a-1)},e[9]=a,e[10]=y):y=e[10];const g=y;let p;e[11]!==s.length||e[12]!==a?(p=()=>{a<s.length-1&&i(a+1)},e[11]=s.length,e[12]=a,e[13]=p):p=e[13];const v=p,h=s.length===1?"Approval needed":`${s.length} approvals pending`;let b;e[14]!==f?(b=n.jsx(ha,{onYolo:f}),e[14]=f,e[15]=b):b=e[15];let S;e[16]!==s.length||e[17]!==v||e[18]!==g||e[19]!==a?(S=n.jsx(zs,{current:a,total:s.length,onPrev:g,onNext:v}),e[16]=s.length,e[17]=v,e[18]=g,e[19]=a,e[20]=S):S=e[20];let C;e[21]!==b||e[22]!==S?(C=n.jsxs("div",{className:"flex items-center gap-2",children:[b,S]}),e[21]=b,e[22]=S,e[23]=C):C=e[23];const _=C;let A;e[24]!==u?(A=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:u,children:"Deny"}),e[24]=u,e[25]=A):A=e[25];let x;e[26]!==s.length||e[27]!==f?(x=s.length>1&&n.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:f,children:"Accept All"}),e[26]=s.length,e[27]=f,e[28]=x):x=e[28];let j;e[29]!==d?(j=n.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:d,children:"Accept"}),e[29]=d,e[30]=j):j=e[30];let P;e[31]!==x||e[32]!==j||e[33]!==A?(P=n.jsxs(n.Fragment,{children:[A,x,j]}),e[31]=x,e[32]=j,e[33]=A,e[34]=P):P=e[34];const E=P;let I;e[35]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(kn,{size:14}),e[35]=I):I=e[35];let N;e[36]!==c.input?(N=n.jsx(ba,{input:c.input}),e[36]=c.input,e[37]=N):N=e[37];let k;return e[38]!==h||e[39]!==c.friendlyName||e[40]!==_||e[41]!==E||e[42]!==N?(k=n.jsx(He,{icon:I,label:h,title:c.friendlyName,defaultExpanded:!0,footerLeft:_,footerRight:E,children:N}),e[38]=h,e[39]=c.friendlyName,e[40]=_,e[41]=E,e[42]=N,e[43]=k):k=e[43],k}function va(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(kn,{className:"size-5 text-muted-foreground shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function wa(t){const e=F.c(4),{approvals:s,isStreaming:o,onRespond:r}=t;if(o&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(va,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let i;return e[1]!==s||e[2]!==r?(i=n.jsx(ya,{approvals:s,onRespond:r}),e[1]=s,e[2]=r,e[3]=i):i=e[3],i}function ja(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const o="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:o,friendlyName:ar(lr(o)),input:s.input})}return e}function Aa(t){const e=F.c(16),{plan:s,onApprove:o,onDismiss:r}=t;let i;e[0]!==o||e[1]!==s.plan?(i=()=>{o(s.plan)},e[0]=o,e[1]=s.plan,e[2]=i):i=e[2];const a=i;let c;e[3]!==r?(c=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:"Keep iterating"}),e[3]=r,e[4]=c):c=e[4];let l;e[5]!==a?(l=n.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:"Let's go"}),e[5]=a,e[6]=l):l=e[6];let u;e[7]!==c||e[8]!==l?(u=n.jsxs(n.Fragment,{children:[c,l]}),e[7]=c,e[8]=l,e[9]=u):u=e[9];const V=u;let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Eo,{size:14}),e[10]=d):d=e[10];let m;e[11]!==s.plan?(m=n.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:n.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:n.jsx(cr,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[11]=s.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=n.jsx(He,{icon:d,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function Sa(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(dt,{className:"size-5 text-purple-500 shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function ka(t){const e=F.c(7),{plans:s,isStreaming:o,onApprove:r,onDismiss:i}=t;if(o&&s.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Sa,{}),e[0]=u):u=e[0],u}let a;e[1]!==s?(a=s.at(-1),e[1]=s,e[2]=a):a=e[2];const c=a;if(!c)return null;let l;return e[3]!==c||e[4]!==r||e[5]!==i?(l=n.jsx(Aa,{plan:c,onApprove:r,onDismiss:i}),e[3]=c,e[4]=r,e[5]=i,e[6]=l):l=e[6],l}function _a(t){const e=[];for(const s of t)if("type"in s&&s.type==="tool-propose_plan"&&"state"in s&&s.state==="input-available"&&"toolCallId"in s&&"input"in s){const o=s.input;e.push({toolCallId:s.toolCallId,plan:o.plan,state:s.state})}return e}function Qe(t){return t?"response"in t?t.response:t.option??t.draft:""}const Gn=Ie({response:Le().min(1,"Response is required")}),Ca=Ie({option:Le().nullable(),draft:Le()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Na=Ie({response:cs(["yes","no"])});function Ia(t){switch(t.type){case"text":return Gn;case"choice":return Ca;case"confirm":return Na;default:return Gn}}function Ta(t){const e={};for(const s of t)e[s.toolCallId]=Ia(s.input);return Ie(e)}function Ra(t){const e=F.c(6),{control:s,name:o,placeholder:r}=t;let i;e[0]!==r?(i=c=>{const{field:l}=c;return n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx("div",{className:"px-2",children:n.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(fs,{size:16,className:"text-muted-foreground"})}),n.jsx("input",{...l,type:"text",placeholder:r||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),n.jsx(de,{})]})},e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==s||e[3]!==o||e[4]!==i?(a=n.jsx(ue,{control:s,name:o,render:i}),e[2]=s,e[3]=o,e[4]=i,e[5]=a):a=e[5],a}function Bs(t,e){const s=F.c(4);let o,r;s[0]!==t||s[1]!==e?(o=()=>{const i=a=>{const c=a.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const l=Number.parseInt(a.key,10);l>=1&&l<=t&&(a.preventDefault(),e(l-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=o,s[3]=r):(o=s[2],r=s[3]),w.useEffect(o,r)}function Pa(t){const e=F.c(40),{control:s,name:o,options:r}=t,i=`${o}.option`;let a;e[0]!==s||e[1]!==i?(a={control:s,name:i,defaultValue:null},e[0]=s,e[1]=i,e[2]=a):a=e[2];const{field:c}=Dn(a),l=`${o}.draft`;let u;e[3]!==s||e[4]!==l?(u={control:s,name:l,defaultValue:""},e[3]=s,e[4]=l,e[5]=u):u=e[5];const{field:V}=Dn(u),d=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==r?(f=I=>{const N=r[I];N!=null&&c.onChange(N)},e[6]=c,e[7]=r,e[8]=f):f=e[8],Bs(r.length,f),r.length===0)return null;const y=d===null;let g;if(e[9]!==c||e[10]!==d||e[11]!==r){let I;e[13]!==c||e[14]!==d?(I=(N,k)=>{const R=d===N;return n.jsxs("button",{type:"button",onClick:()=>c.onChange(N),className:K("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${N}`,children:[n.jsx("span",{className:K("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:k+1}),n.jsx("span",{className:"text-sm text-foreground truncate",children:N})]},`${k}-${N}`)},e[13]=c,e[14]=d,e[15]=I):I=e[15],g=r.map(I),e[9]=c,e[10]=d,e[11]=r,e[12]=g}else g=e[12];const p=y&&"bg-accent/50",v=!y&&"hover:bg-accent/30";let h;e[16]!==p||e[17]!==v?(h=K("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p,v),e[16]=p,e[17]=v,e[18]=h):h=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(fs,{size:16,className:"text-muted-foreground"})}),e[19]=b):b=e[19];const S=y?m:"";let C;e[20]!==V||e[21]!==c||e[22]!==d?(C=I=>{V.onChange(I.target.value),d!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=d,e[23]=C):C=e[23];let _;e[24]!==c||e[25]!==d?(_=()=>{d!==null&&c.onChange(null)},e[24]=c,e[25]=d,e[26]=_):_=e[26];let A;e[27]!==S||e[28]!==C||e[29]!==_?(A=n.jsx("input",{type:"text",value:S,onChange:C,onFocus:_,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=S,e[28]=C,e[29]=_,e[30]=A):A=e[30];let x;e[31]!==A||e[32]!==h?(x=n.jsxs("label",{className:h,children:[b,A]}),e[31]=A,e[32]=h,e[33]=x):x=e[33];let j;e[34]!==x||e[35]!==g?(j=n.jsx(ce,{children:n.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[g,x]})}),e[34]=x,e[35]=g,e[36]=j):j=e[36];let P;e[37]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(de,{}),e[37]=P):P=e[37];let E;return e[38]!==j?(E=n.jsxs(le,{children:[j,P]}),e[38]=j,e[39]=E):E=e[39],E}function Ea(t){const e=F.c(6),{control:s,name:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const i=r,a=w.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{a.current?.onChange(i[V]??"")},e[1]=c):c=e[1],Bs(i.length,c);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=V=>{const{field:d}=V;return a.current=d,n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:i.map(m=>{const f=d.value===m;return n.jsxs("button",{type:"button",onClick:()=>d.onChange(m),className:K("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[n.jsx("span",{className:K("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),n.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),n.jsx(de,{})]})},e[2]=l):l=e[2];let u;return e[3]!==s||e[4]!==o?(u=n.jsx(ue,{control:s,name:o,render:l}),e[3]=s,e[4]=o,e[5]=u):u=e[5],u}function Hn(t){const e=F.c(13),{input:s,control:o,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==o||e[1]!==s.default||e[2]!==i?(a=n.jsx(Ra,{control:o,name:i,placeholder:s.default}),e[0]=o,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let c;return e[6]!==o||e[7]!==a||e[8]!==r?(c=n.jsx(Pa,{control:o,name:r,options:a}),e[6]=o,e[7]=a,e[8]=r,e[9]=c):c=e[9],c}case"confirm":{const i=`${r}.response`;let a;return e[10]!==o||e[11]!==i?(a=n.jsx(Ea,{control:o,name:i}),e[10]=o,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function Da({parts:t,onSubmit:e}){const[s,o]=w.useState(t[0]?.toolCallId??""),r=Ta(t.map(h=>({toolCallId:h.toolCallId,input:h.input}))),i=hn({resolver:gn(r),defaultValues:Object.fromEntries(t.map(h=>h.input?.type==="choice"?[h.toolCallId,{option:null,draft:""}]:[h.toolCallId,{response:""}]))}),a=i.watch(),c=t.findIndex(h=>h.toolCallId===s),l=!!Qe(a[s]),u=t.every(h=>!!Qe(a[h.toolCallId])),V=h=>{for(const b of t){const S=Qe(h[b.toolCallId]);S&&e(b,S)}},d=h=>t.find(b=>!Qe(h[b.toolCallId])&&b.toolCallId!==s)??null,m=()=>{const h=i.getValues();if(t.every(S=>!!Qe(h[S.toolCallId])))i.handleSubmit(V)();else{const S=d(h);S&&o(S.toolCallId)}},f=()=>{const h=t.find(S=>S.toolCallId===s),b="user has skip this question";h?.input?.type==="choice"?(i.setValue(`${s}.option`,null),i.setValue(`${s}.draft`,b)):i.setValue(`${s}.response`,b),m()},y=()=>{if(c>0){const h=t[c-1];h&&o(h.toolCallId)}},g=()=>{if(c<t.length-1){const h=t[c+1];h&&o(h.toolCallId)}},p=n.jsxs(n.Fragment,{children:[n.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),n.jsx(Z,{type:"button",size:"sm",disabled:!l,onClick:m,className:K("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),v=n.jsx(zs,{current:c,total:t.length,onPrev:y,onNext:g});if(t.length===1){const h=t[0];return h?.input?n.jsx(ct,{...i,children:n.jsx("form",{onSubmit:i.handleSubmit(V),autoComplete:"off",children:n.jsx(He,{icon:n.jsx(ln,{size:14}),label:"Question pending",title:h.input?.prompt??"Question",defaultExpanded:!0,footerRight:p,children:n.jsx(Hn,{input:h.input,control:i.control,toolCallId:h.toolCallId})})})}):null}return n.jsx(ct,{...i,children:n.jsx("form",{onSubmit:i.handleSubmit(V),autoComplete:"off",children:n.jsx(He,{icon:n.jsx(ln,{size:14}),label:"Question pending",count:`${c+1} of ${t.length}`,title:t[c]?.input?.prompt??"Question",defaultExpanded:!0,footerLeft:v,footerRight:p,children:n.jsx(xr,{value:s,onValueChange:o,children:t.map(h=>n.jsx(br,{value:h.toolCallId,className:"mt-0",children:n.jsx(Hn,{input:h.input,control:i.control,toolCallId:h.toolCallId})},h.toolCallId))})})})})}function La(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(ln,{className:"size-5 text-muted-foreground shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function qs(t){const e=F.c(6),{userAskParts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(Ma),e[0]=s,e[1]=i):i=e[1];const a=i;if(o){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(La,{}),e[2]=l):l=e[2],l}if(a.length===0)return null;let c;return e[3]!==r||e[4]!==a?(c=n.jsx(Da,{parts:a,onSubmit:r}),e[3]=r,e[4]=a,e[5]=c):c=e[5],c}function Ma(t){return t.state==="input-available"}const Fa=Ie({content:Le().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:cs(["pending","in_progress","completed"]),activeForm:Le().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Ks=Ie({todos:po(Fa)}),Ua="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Bo({description:Ua,inputSchema:qo(Ks),execute:async({todos:t})=>({ok:!0,count:t.length})});const Oa="tool-todo_write",$a=new Set(["input-available","output-available"]);function za(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const o=s.parts;if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=o[r];if(i.type!==Oa||typeof i.state!="string"||!$a.has(i.state))continue;const a=Ks.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function Ba(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,o=t.length;if(o>0&&s===o)return{icon:"completed",activity:"All done",progress:`${o}/${o}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${o} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${o} done`}:s>0?{icon:"pending",activity:`${o-s} pending`,progress:`${s}/${o} done`}:{icon:"pending",activity:`${o} todos`,progress:"not started"}}function qa(){const t=F.c(21),{messages:e}=Et();let s,o,r,i,a,c,l,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=za(e);if(f.length===0){V=null;break e}const y=Ba(f);s=He,a=n.jsx(Ga,{status:y.icon}),c=y.activity,l=y.progress,u=!1,o="todos-list",r="flex flex-col px-2 max-h-[40vh] overflow-y-auto",i=f.map(Ka)}t[0]=e,t[1]=s,t[2]=o,t[3]=r,t[4]=i,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=V}else s=t[1],o=t[2],r=t[3],i=t[4],a=t[5],c=t[6],l=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let d;t[10]!==o||t[11]!==r||t[12]!==i?(d=n.jsx("ul",{"data-testid":o,className:r,children:i}),t[10]=o,t[11]=r,t[12]=i,t[13]=d):d=t[13];let m;return t[14]!==s||t[15]!==a||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d?(m=n.jsx(s,{icon:a,label:c,count:l,defaultExpanded:u,children:d}),t[14]=s,t[15]=a,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=m):m=t[20],m}function Ka(t,e){return n.jsx(Ya,{todo:t},e)}function Ya(t){const e=F.c(14),{todo:s}=t,o=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Wa,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const c=o&&"text-muted-foreground";let l;e[2]!==c?(l=K("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=l):l=e[3];const u=o?"100%":"0%",V=o?"width 300ms ease 200ms":"width 150ms ease";let d;e[4]!==u||e[5]!==V?(d=n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==l||e[9]!==d?(m=n.jsxs("span",{className:l,children:[i,d]}),e[7]=i,e[8]=l,e[9]=d,e[10]=m):m=e[10];let f;return e[11]!==a||e[12]!==m?(f=n.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,m]}),e[11]=a,e[12]=m,e[13]=f):f=e[13],f}function Wa(t){const e=F.c(4),{status:s}=t,o=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("svg",{viewBox:"0 0 21 21",children:n.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==o||e[2]!==r?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":o,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=o,e[2]=r,e[3]=a):a=e[3],a}function Ga(t){const e=F.c(3),{status:s}=t;if(s==="completed"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:n.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:n.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=r):r=e[0],r}if(s==="in_progress"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=r):r=e[1],r}let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=o):o=e[2],o}const Qn=new Map;function Ys(){const{org:t}=ie(),e=je({connectionId:pt,orgId:t.id,orgSlug:t.slug}),s=_r(),o=s.find(p=>p.providerId==="deco"),{data:r,isLoading:i,refetch:a,isFetching:c}=vn({queryKey:me.aiProviderCredits(t.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{const p=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return p?.isError?null:p.structuredContent??null}}),l=r?.balanceCents??null,u=l!=null?l/100:null,V=w.useRef(new Map);if(l!=null){const p=Qn.get(t.id);V.current.get(t.id)&&p!=null&&l>p&&z("credits_topped_up_detected",{organization_id:t.id,delta_cents:l-p,previous_balance_cents:p,new_balance_cents:l}),Qn.set(t.id,l),V.current.set(t.id,!0)}const d=!!o,m=l!=null&&l>0,f=l!=null&&l===0,y=l!=null&&l===200,g=s.length>0&&s.every(p=>p.providerId==="deco");return{hasDecoKey:d,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:m,isZeroBalance:f,isInitialFreeCredit:y,hasOnlyDecoProvider:g,isLoading:i,isFetching:c,refetch:a}}function Ha(t){return t?t.message.startsWith("[CREDITS]"):!1}const Qa={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Ja=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Ws(t){const e=F.c(44),{onDismiss:s}=t,{org:o}=ie(),r=Ne(),{decoKeyId:i}=Ys();let a;e[0]!==o.id||e[1]!==o.slug?(a={connectionId:pt,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=a):a=e[2];const c=je(a),[l,u]=w.useState(""),[V,d]=w.useState(!1),[m,f]=w.useState("usd"),y=m==="brl"?"R$":"$";let g,p;e[3]!==o.id?(g=()=>{z("credits_exhausted_shown",{organization_id:o.id})},p=[o.id],e[3]=o.id,e[4]=g,e[5]=p):(g=e[4],p=e[5]),w.useEffect(g,p);let v;e[6]!==c||e[7]!==m?(v=async T=>{const U=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:T,currency:m}});if(U?.isError)throw new Error(U.content?.[0]?.text??"Failed to get top-up URL");return U.structuredContent?.url},e[6]=c,e[7]=m,e[8]=v):v=e[8];let h;e[9]!==s?(h=T=>{T&&window.open(T,"_blank","noopener,noreferrer"),s?.()},e[9]=s,e[10]=h):h=e[10];let b;e[11]!==v||e[12]!==h?(b={mutationFn:v,onSuccess:h,onError:el},e[11]=v,e[12]=h,e[13]=b):b=e[13];const{mutate:S,isPending:C}=xn(b),_=parseFloat(l),A=!isNaN(_)&&_>=1;let x;e[14]!==s?(x=T=>!T&&s?.(),e[14]=s,e[15]=x):x=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=j):j=e[16];let P;e[17]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:j.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=P):P=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[P,n.jsxs(ye,{className:"relative gap-4",children:[n.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),n.jsxs("div",{children:[n.jsx(ve,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),n.jsx(Rt,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[18]=E):E=e[18];let I;e[19]!==m||e[20]!==y||e[21]!==l||e[22]!==_||e[23]!==i||e[24]!==A||e[25]!==C||e[26]!==V||e[27]!==S?(I=i&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ts,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:T=>{T&&f(T)},children:[n.jsx(kt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(kt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),n.jsxs("div",{className:"rounded-xl border border-border p-5",children:[n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Qa[m].map(T=>{const{dollars:U,label:O}=T;return n.jsxs("button",{type:"button",disabled:C,onClick:()=>{z("credits_topup_clicked",{amount_cents:U*100,currency:m,tier_label:O,source:"exhausted_banner"}),S(U*100)},className:K("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[n.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[y,U]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:O})]},U)})}),V?n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:y}),n.jsx(he,{type:"number",min:"1",step:"1",placeholder:"50",value:l,onChange:T=>u(T.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(Z,{className:"h-10",disabled:!A||C,onClick:()=>{z("credits_topup_clicked",{amount_cents:Math.round(_*100),currency:m,tier_label:"custom",source:"exhausted_banner"}),S(Math.round(_*100))},children:C?"Opening...":"Add"})]}):n.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),n.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Ja.map(Xa)})]}),e[19]=m,e[20]=y,e[21]=l,e[22]=_,e[23]=i,e[24]=A,e[25]=C,e[26]=V,e[27]=S,e[28]=I):I=e[28];let N;e[29]!==s?(N=n.jsx(Z,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[29]=s,e[30]=N):N=e[30];let k;e[31]!==r||e[32]!==s||e[33]!==o.slug?(k=n.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{r({to:"/$org/settings/ai-providers",params:{org:o.slug}}),s?.()},children:"Manage providers"}),e[31]=r,e[32]=s,e[33]=o.slug,e[34]=k):k=e[34];let R;e[35]!==N||e[36]!==k?(R=n.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[N,k]}),e[35]=N,e[36]=k,e[37]=R):R=e[37];let L;e[38]!==I||e[39]!==R?(L=n.jsxs(be,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Za,children:[E,I,R]}),e[38]=I,e[39]=R,e[40]=L):L=e[40];let D;return e[41]!==L||e[42]!==x?(D=n.jsx(xe,{open:!0,onOpenChange:x,children:L}),e[41]=L,e[42]=x,e[43]=D):D=e[43],D}function Xa(t){return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:n.jsx(dt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Za(t){return t.preventDefault()}function el(t){oe.error(`Top-up failed: ${t.message}`)}const tl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function _t(t){const e=F.c(13),{variant:s,onDismiss:o}=t,r=s==="error",i=r?"Error occurred":"Response incomplete",a=r?t.error.message:tl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,c=r?Ss:ds;let l;e[0]!==c?(l=n.jsx(c,{size:14}),e[0]=c,e[1]=l):l=e[1];let u;e[2]!==r||e[3]!==t.onContinue||e[4]!==t.onFixInChat?(u=r?n.jsx(Z,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):n.jsx(Z,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[2]=r,e[3]=t.onContinue,e[4]=t.onFixInChat,e[5]=u):u=e[5];let V;return e[6]!==i||e[7]!==a||e[8]!==o||e[9]!==l||e[10]!==u||e[11]!==s?(V=n.jsx(He,{icon:l,label:i,title:a,defaultExpanded:!0,variant:s,onClose:o,footerRight:u,children:null}),e[6]=i,e[7]=a,e[8]=o,e[9]=l,e[10]=u,e[11]=s,e[12]=V):V=e[12],V}function zt(){const t=F.c(81),{error:e,clearError:s,finishReason:o,clearFinishReason:r,messages:i,isStreaming:a,isWaitingForApprovals:c,addToolOutput:l,addToolApprovalResponse:u,sendMessage:V}=Et(),[d,m]=Tt(),{virtualMcpId:f,createTaskWithMessage:y}=Ko();let g,p,v,h,b,S,C,_,A,x,j,P,E,I,N,k,R;if(t[0]!==u||t[1]!==l||t[2]!==s||t[3]!==y||t[4]!==e||t[5]!==o||t[6]!==a||t[7]!==c||t[8]!==i||t[9]!==d||t[10]!==V||t[11]!==m||t[12]!==f){N=Symbol.for("react.early_return_sentinel");e:{const Y=i.at(-1);R=Y?.role==="assistant"?Y.parts.filter(il):null,_=!!R?.filter(rl)?.length,x=Y?.role==="assistant"?_a(Y.parts):[],A=Y?.role==="assistant"?ja(Y.parts):[];let G;t[30]!==e||t[31]!==V?(G=()=>{if(e){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};V(re)}},t[30]=e,t[31]=V,t[32]=G):G=t[32],v=G;let q;t[33]!==V?(q=()=>{V({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[33]=V,t[34]=q):q=t[34],p=q;let Q;t[35]!==l?(Q=(J,re)=>{l({tool:"user_ask",toolCallId:J.toolCallId,output:{response:re}})},t[35]=l,t[36]=Q):Q=t[36],S=Q;let H;t[37]!==y||t[38]!==d||t[39]!==m||t[40]!==f?(H=J=>{m({...d,toolApprovalLevel:"auto"}),y({virtualMcpId:f,message:{parts:[{type:"text",text:`Implement this plan:
545
+ Approach every request with rigor and intellectual honesty. Always surface what is uncertain or debated, not just what is known.`,Ri=["Break any topic into key sub-questions and define scope","Synthesize information from multiple angles and sources","Distinguish facts, expert consensus, and contested claims","Identify gaps, contradictions, and emerging patterns","Deliver structured summaries with actionable insights"];function Yn(t){const e=F.c(7),{onRecruit:s,isRecruiting:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Web Researcher agent that conducts thorough, rigorous research on any topic and delivers structured, actionable insights."}),e[0]=r):r=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[i,n.jsx("ul",{className:"space-y-1.5",children:Ri.map(Pi)})]}),e[2]=a):a=e[2];const c=o?"Setting up...":"Add Web Researcher";let l;return e[3]!==o||e[4]!==s||e[5]!==c?(l=n.jsxs("div",{className:"flex flex-col gap-6",children:[r,a,n.jsx(Z,{onClick:s,disabled:o,className:"w-full cursor-pointer",children:c})]}),e[3]=o,e[4]=s,e[5]=c,e[6]=l):l=e[6],l}function Pi(t){return n.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[n.jsx("span",{className:"text-amber-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function hu({open:t,onOpenChange:e,existingAgent:s}){const o=Ut(),r=An(),i=gs(),[a,c]=w.useState(!1),l=ms.find(m=>m.id==="ai-research"),u=n.jsx(hs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),r(s.id);return}c(!0);try{const m=await i.create.mutateAsync({title:l.title,description:"Systematic research and information synthesis assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Ti}});z("agent_recruit_confirmed",{template_id:"ai-research",agent_id:m.id}),e(!1),r(m.id)}catch(m){z("agent_recruit_failed",{template_id:"ai-research",error:m instanceof Error?m.message:String(m)}),console.error("Failed to create Researcher agent:",m)}finally{c(!1)}},d=`Add ${l.title}`;return o?n.jsx(Dt,{open:t,onOpenChange:e,children:n.jsxs(Lt,{className:"h-[70dvh]",children:[n.jsx(Mt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Ft,{className:"text-xl font-semibold",children:d})]})}),n.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:n.jsx(Yn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(xe,{open:t,onOpenChange:e,children:n.jsxs(be,{className:"sm:max-w-[500px] p-8",children:[n.jsx(ye,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ve,{className:"text-xl font-semibold",children:d})]})}),n.jsx(Yn,{onRecruit:V,isRecruiting:a})]})})}function Ei(t,e,s,o){const r=t.getQueriesData({queryKey:me.tasksPrefix(e)});let i=null;for(const[,a]of r)if(a?.items)for(const c of a.items)c.virtual_mcp_id===s&&c.created_by===o&&(c.hidden||(!i||c.updated_at>i.updated_at)&&(i=c));return i}function gu(t){const e=Ne(),s=mt(),o=xs(),{locator:r}=ie(),i=bn({strict:!1}),a=yn({strict:!1}),{data:c}=It.useSession(),l=c?.user?.id;return async u=>{const V=l?Ei(s,r,u,l):null;if(V)return e({to:"/$org/$taskId",params:{org:t,taskId:V.id},search:{virtualmcpid:u}}),{resumed:!0};const d=crypto.randomUUID(),m=u===a.virtualmcpid?bs(s,r,i.taskId??""):null;try{await o.create.mutateAsync({id:d,virtual_mcp_id:u,...m?{branch:m}:{}})}catch{}return e({to:"/$org/$taskId",params:{org:t,taskId:d},search:{virtualmcpid:u}}),{resumed:!1}}}function Di(t,e){return t===1?!0:t===0?!1:e}function Li(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",o=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:o,chatOpen:r}}function xu(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Mi(t,e){return t===1?!0:t===0?!1:e}function bu(t,e){const s=Ne(),o=yn({strict:!1}),r=bn({strict:!1}),i=mt(),a=xs(),{locator:c}=ie(),{virtualMcpId:l,orgSlug:u,isAgentRoute:V}=e,d=Li({entityMetadata:t,mainParamPresent:o.main!==void 0,mainParamValue:o.main}),m=Mi(o.chat,d.chatOpen),f=d.mainOpen,y=w.useRef(crypto.randomUUID()),g=r.taskId??y.current,p="/$org/$taskId",v=P=>({org:u,taskId:P}),h=V?{virtualmcpid:l}:{},b=(P,E)=>{s({to:p,params:v(g),search:I=>({...I,...P}),replace:E?.replace??!1})},S=(P,E)=>{s({to:p,params:v(P),search:I=>{const N={};return E?N.virtualmcpid=E:V&&(N.virtualmcpid=l),I.tasks&&(N.tasks=I.tasks),N}})},C=()=>{f?b({main:"0"},{replace:!0}):b({main:rr(t)},{replace:!0})},_=()=>{b({chat:m?0:1},{replace:!0})},A=()=>{m||b({chat:1},{replace:!0})},x=async()=>{const P=crypto.randomUUID(),E=bs(i,c,g);try{await a.create.mutateAsync({id:P,virtual_mcp_id:l,...E?{branch:E}:{}})}catch{}s({to:p,params:v(P),search:I=>{const N={...h,chat:1};return I.tasks&&(N.tasks=I.tasks),N}})},j=P=>{b({main:P},{replace:!0})};return{taskId:g,mainOpen:f,chatOpen:m,mainParam:o.main,setTaskId:S,toggleMain:C,toggleChat:_,openChat:A,createNewTask:x,openTab:j}}const In=w.createContext(null);function yu(t){const e=F.c(17),{children:s}=t,o=Ne();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const i=yn(r);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[1]=a):a=e[1];const c=bn(a);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={owner:"all",status:"open"},e[2]=l):l=e[2];const{tasks:u}=zo(l);let V;e[3]!==c.taskId||e[4]!==i.tasks||e[5]!==u?(V=()=>Di(i.tasks,!!c.taskId&&u.length>0),e[3]=c.taskId,e[4]=i.tasks,e[5]=u,e[6]=V):V=e[6];const[d,m]=w.useState(V);let f,y;e[7]!==o||e[8]!==d?(f=()=>{o({search:(b=>({...b,tasks:d?1:0})),replace:!0})},y=[d,o],e[7]=o,e[8]=d,e[9]=f,e[10]=y):(f=e[9],y=e[10]),w.useEffect(f,y);let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=()=>m(Fi),e[11]=g):g=e[11];const p=g;let v;e[12]!==d?(v={tasksOpen:d,toggleTasks:p},e[12]=d,e[13]=v):v=e[13];let h;return e[14]!==s||e[15]!==v?(h=n.jsx(In.Provider,{value:v,children:s}),e[14]=s,e[15]=v,e[16]=h):h=e[16],h}function Fi(t){return!t}function vu(){const t=w.useContext(In);if(!t)throw new Error("useTasksPanelState must be used inside <TasksPanelStateProvider>");return t}function wu(){return w.useContext(In)}const Us=w.createContext(null);function Te(){const t=w.use(Us);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function fe(t){const e=F.c(10),{children:s}=t,[o,r]=w.useState(null),[i,a]=w.useState(null),[c,l]=w.useState(null),[u,V]=w.useState(null);let d;e[0]!==c||e[1]!==u||e[2]!==i||e[3]!==o?(d={togglesEl:o,setTogglesEl:r,tabsEl:i,setTabsEl:a,centerEl:c,setCenterEl:l,rightEl:u,setRightEl:V},e[0]=c,e[1]=u,e[2]=i,e[3]=o,e[4]=d):d=e[4];let m;e[5]!==s?(m=n.jsx("div",{className:"flex flex-col h-full min-h-0",children:s}),e[5]=s,e[6]=m):m=e[6];let f;return e[7]!==d||e[8]!==m?(f=n.jsx(Us,{value:d,children:m}),e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function Ui(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"shrink-0 grid grid-cols-3 items-center pl-1 pr-2 pt-0.25 h-12",children:s}),e[0]=s,e[1]=o):o=e[1],o}function Oi(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:s}),e[0]=s,e[1]=o):o=e[1],o}function $i(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"flex items-center justify-end gap-0.5 min-w-0 justify-self-end",children:s}),e[0]=s,e[1]=o):o=e[1],o}function zi(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("button",{type:"button",onClick:qi,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go back",children:n.jsx(hr,{size:16})}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs(n.Fragment,{children:[e,n.jsx("button",{type:"button",onClick:Bi,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go forward",children:n.jsx(vs,{size:16})})]}),t[1]=s):s=t[1],s}function Bi(){return window.history.forward()}function qi(){return window.history.back()}function Ki(){const t=F.c(2),{setCenterEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"min-w-0 flex items-center justify-center gap-2"}),t[0]=e,t[1]=s):s=t[1],s}function Yi(t){const e=F.c(3),{children:s}=t,{centerEl:o}=Te();if(!o)return null;let r;return e[0]!==o||e[1]!==s?(r=ft.createPortal(s,o),e[0]=o,e[1]=s,e[2]=r):r=e[2],r}function Wi(){const t=F.c(2),{setTabsEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"shrink-0 flex items-center"}),t[0]=e,t[1]=s):s=t[1],s}function Gi(t){const e=F.c(3),{children:s}=t,{tabsEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function Hi(){const t=F.c(2),{setTogglesEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center gap-0.5 shrink-0 ml-0.5"}),t[0]=e,t[1]=s):s=t[1],s}function Qi(t){const e=F.c(3),{children:s}=t,{togglesEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}function Ji(){const t=F.c(2),{setRightEl:e}=Te();let s;return t[0]!==e?(s=n.jsx("div",{ref:e,className:"flex items-center justify-end gap-0.5 shrink-0"}),t[0]=e,t[1]=s):s=t[1],s}function Xi(t){const e=F.c(3),{children:s}=t,{rightEl:o}=Te();if(!o)return null;let r;return e[0]!==s||e[1]!==o?(r=ft.createPortal(s,o),e[0]=s,e[1]=o,e[2]=r):r=e[2],r}fe.Header=Ui;fe.LeftColumn=Oi;fe.RightColumn=$i;fe.Nav=zi;fe.CenterSlot=Ki;fe.Center=Yi;fe.TabsSlot=Wi;fe.Tabs=Gi;fe.TogglesSlot=Hi;fe.Toggles=Qi;fe.RightSlot=Ji;fe.Right=Xi;function Zi(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?Le().min(1,"Required"):Le();return Ie(e)}function ea(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Tn(t){const e=F.c(65),{prompt:s,setPrompt:o,onSubmit:r}=t,i=w.useId();let a;if(e[0]!==s){const T=s?Zi(s):Ie({});a=gn(T),e[0]=s,e[1]=a}else a=e[1];const l=a;let u;e[2]!==s?(u=s?ea(s):{},e[2]=s,e[3]=u):u=e[3];let V;e[4]!==l||e[5]!==u?(V={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=V):V=e[6];const d=hn(V);let m;e[7]!==s?.arguments?(m=s?.arguments??[],e[7]=s?.arguments,e[8]=m):m=e[8];const f=m;let y;e[9]!==d||e[10]!==r||e[11]!==o?(y=async T=>{await r(T),o(null),d.reset()},e[9]=d,e[10]=r,e[11]=o,e[12]=y):y=e[12];const g=y;let p;e[13]!==d||e[14]!==o?(p=T=>{T||(d.reset(),o(null))},e[13]=d,e[14]=o,e[15]=p):p=e[15];const v=p;if(!s)return null;let h;e[16]!==s._meta||e[17]!==s.name||e[18]!==s.title?(h=s.title||Ot(s.name,Ce(s._meta)),e[16]=s._meta,e[17]=s.name,e[18]=s.title,e[19]=h):h=e[19];let b;e[20]!==h?(b=n.jsx(ve,{children:n.jsx("span",{className:"capitalize",children:h})}),e[20]=h,e[21]=b):b=e[21];let S;e[22]!==s.description?(S=s.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),e[22]=s.description,e[23]=S):S=e[23];let C;e[24]!==S||e[25]!==b?(C=n.jsxs(ye,{children:[b,S]}),e[24]=S,e[25]=b,e[26]=C):C=e[26];let _;e[27]!==d||e[28]!==g?(_=T=>{T.stopPropagation(),d.handleSubmit(g)(T)},e[27]=d,e[28]=g,e[29]=_):_=e[29];let A;if(e[30]!==f||e[31]!==d.control||e[32]!==d.formState.isSubmitting){let T;e[34]!==d.control||e[35]!==d.formState.isSubmitting?(T=U=>n.jsx(ue,{control:d.control,name:U.name,render:O=>{const{field:$}=O;return n.jsxs(le,{children:[n.jsxs(pe,{className:"text-xs",children:[U.name,U.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(ce,{children:n.jsx(he,{...$,value:$.value??"",required:U.required,placeholder:U.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(de,{})]})}},U.name),e[34]=d.control,e[35]=d.formState.isSubmitting,e[36]=T):T=e[36],A=f.map(T),e[30]=f,e[31]=d.control,e[32]=d.formState.isSubmitting,e[33]=A}else A=e[33];let x;e[37]!==v?(x=()=>v(!1),e[37]=v,e[38]=x):x=e[38];let j;e[39]!==d.formState.isSubmitting||e[40]!==x?(j=n.jsx(Z,{type:"button",variant:"ghost",onClick:x,disabled:d.formState.isSubmitting,children:"Cancel"}),e[39]=d.formState.isSubmitting,e[40]=x,e[41]=j):j=e[41];const P=!d.formState.isValid||d.formState.isSubmitting;let E;e[42]!==d.formState.isSubmitting?(E=d.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(At,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=d.formState.isSubmitting,e[43]=E):E=e[43];let I;e[44]!==i||e[45]!==P||e[46]!==E?(I=n.jsx(Z,{type:"submit",form:i,disabled:P,children:E}),e[44]=i,e[45]=P,e[46]=E,e[47]=I):I=e[47];let N;e[48]!==j||e[49]!==I?(N=n.jsxs(Vs,{children:[j,I]}),e[48]=j,e[49]=I,e[50]=N):N=e[50];let k;e[51]!==i||e[52]!==_||e[53]!==A||e[54]!==N?(k=n.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:_,children:[A,N]}),e[51]=i,e[52]=_,e[53]=A,e[54]=N,e[55]=k):k=e[55];let R;e[56]!==d||e[57]!==k?(R=n.jsx(ct,{...d,children:k}),e[56]=d,e[57]=k,e[58]=R):R=e[58];let L;e[59]!==C||e[60]!==R?(L=n.jsxs(be,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[59]=C,e[60]=R,e[61]=L):L=e[61];let D;return e[62]!==v||e[63]!==L?(D=n.jsx(xe,{open:!0,onOpenChange:v,children:L}),e[62]=v,e[63]=L,e[64]=D):D=e[64],D}function ta(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}function na(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const Wn=3,Os="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",sa="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function $s(t){const e=F.c(46),{item:s,onSelect:o,isLoading:r,isDisabled:i,variant:a}=t,c=a===void 0?"pill":a,{prompt:l}=s;let u;if(e[0]!==l._meta||e[1]!==l.name||e[2]!==l.title){const A=Ce(l._meta);u=l.title??Ot(l.name,A),e[0]=l._meta,e[1]=l.name,e[2]=l.title,e[3]=u}else u=e[3];const V=u,d=l.description||null;if(c==="card"){let A;e[4]!==o||e[5]!==l?(A=()=>o(l),e[4]=o,e[5]=l,e[6]=A):A=e[6];const x=i||r,j=r&&"bg-accent/40",P=(i||r)&&"cursor-not-allowed opacity-50";let E;e[7]!==j||e[8]!==P?(E=K(sa,"hover:bg-accent/60 text-foreground",j,P),e[7]=j,e[8]=P,e[9]=E):E=e[9];let I;e[10]!==V?(I=n.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=I):I=e[11];let N;e[12]!==r?(N=r&&n.jsx(At,{size:"xs"}),e[12]=r,e[13]=N):N=e[13];let k;e[14]!==I||e[15]!==N?(k=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I,N]}),e[14]=I,e[15]=N,e[16]=k):k=e[16];let R;e[17]!==d?(R=d&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:d}),e[17]=d,e[18]=R):R=e[18];let L;return e[19]!==k||e[20]!==R||e[21]!==A||e[22]!==x||e[23]!==E?(L=n.jsxs("button",{type:"button",onClick:A,disabled:x,className:E,children:[k,R]}),e[19]=k,e[20]=R,e[21]=A,e[22]=x,e[23]=E,e[24]=L):L=e[24],L}let m;e[25]!==o||e[26]!==l?(m=()=>o(l),e[25]=o,e[26]=l,e[27]=m):m=e[27];const f=i||r,y=r&&"bg-muted/50",g=(i||r)&&"cursor-not-allowed opacity-50";let p;e[28]!==y||e[29]!==g?(p=K(Os,"hover:bg-muted/70 hover:text-foreground",y,g),e[28]=y,e[29]=g,e[30]=p):p=e[30];let v;e[31]!==V?(v=n.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=v):v=e[32];let h;e[33]!==r?(h=r&&n.jsx(At,{size:"xs"}),e[33]=r,e[34]=h):h=e[34];let b;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==v||e[39]!==h?(b=n.jsx(ot,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:m,disabled:f,className:p,children:[v,h]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=v,e[39]=h,e[40]=b):b=e[40];const S=d??V;let C;e[41]!==S?(C=n.jsx(rt,{side:"top",className:"max-w-xs",children:n.jsx("p",{className:"text-xs",children:S})}),e[41]=S,e[42]=C):C=e[42];let _;return e[43]!==b||e[44]!==C?(_=n.jsxs(st,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=_):_=e[45],_}function oa(t){const e=F.c(41),{items:s,open:o,onOpenChange:r,onSelect:i,loadingPrompt:a}=t,[c,l]=w.useState(""),u=!!a;let V;e[0]!==s||e[1]!==c?(V=c.trim()?s.filter(x=>{const j=c.toLowerCase();return x.prompt.name.toLowerCase().includes(j)||(x.prompt.title??"").toLowerCase().includes(j)||(x.prompt.description??"").toLowerCase().includes(j)}):s,e[0]=s,e[1]=c,e[2]=V):V=e[2];const d=V,m=Ut();let f;e[3]!==d.length||e[4]!==c?(f=d.length===0&&n.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=d.length,e[4]=c,e[5]=f):f=e[5];let y;if(e[6]!==d||e[7]!==u||e[8]!==a?.name||e[9]!==r||e[10]!==i){let x;e[12]!==u||e[13]!==a?.name||e[14]!==r||e[15]!==i?(x=j=>n.jsx($s,{item:j,variant:"card",onSelect:P=>{r(!1),i(P)},isLoading:a?.name===j.prompt.name,isDisabled:u&&a?.name!==j.prompt.name},j.prompt.name),e[12]=u,e[13]=a?.name,e[14]=r,e[15]=i,e[16]=x):x=e[16],y=d.map(x),e[6]=d,e[7]=u,e[8]=a?.name,e[9]=r,e[10]=i,e[11]=y}else y=e[11];let g;e[17]!==f||e[18]!==y?(g=n.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,y]})}),e[17]=f,e[18]=y,e[19]=g):g=e[19];const p=g;let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=x=>{x.key==="Escape"&&l("")},e[20]=v):v=e[20];let h;e[21]!==c?(h=n.jsx(ws,{value:c,onChange:l,placeholder:"Search prompts...",onKeyDown:v}),e[21]=c,e[22]=h):h=e[22];const b=h;if(m){let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Mt,{className:"sr-only",children:n.jsx(Ft,{children:"All prompts"})}),e[23]=x):x=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=j):j=e[24];let P;e[25]!==p||e[26]!==b?(P=n.jsxs(Lt,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[x,j,b,p]}),e[25]=p,e[26]=b,e[27]=P):P=e[27];let E;return e[28]!==r||e[29]!==o||e[30]!==P?(E=n.jsx(an,{delayDuration:400,children:n.jsx(Dt,{open:o,onOpenChange:r,children:P})}),e[28]=r,e[29]=o,e[30]=P,e[31]=E):E=e[31],E}let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{className:"sr-only",children:n.jsx(ve,{children:"All prompts"})}),e[32]=S):S=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let _;e[34]!==p||e[35]!==b?(_=n.jsxs(be,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,C,b,p]}),e[34]=p,e[35]=b,e[36]=_):_=e[36];let A;return e[37]!==r||e[38]!==o||e[39]!==_?(A=n.jsx(an,{delayDuration:400,children:n.jsx(xe,{open:o,onOpenChange:r,children:_})}),e[37]=r,e[38]=o,e[39]=_,e[40]=A):A=e[40],A}function ra(t){const e=F.c(29),{items:s,onSelect:o,loadingPrompt:r,className:i}=t,[a,c]=w.useState(!1);if(s.length===0)return null;let l,u,V;if(e[0]!==s||e[1]!==r||e[2]!==o){const v=s.slice(0,Wn);let h;e[6]!==s?(h=s.slice(Wn),e[6]=s,e[7]=h):h=e[7],l=h,u=!!r;let b;e[8]!==u||e[9]!==r?.name||e[10]!==o?(b=S=>n.jsx($s,{item:S,onSelect:o,isLoading:r?.name===S.prompt.name,isDisabled:u&&r?.name!==S.prompt.name},S.prompt.name),e[8]=u,e[9]=r?.name,e[10]=o,e[11]=b):b=e[11],V=v.map(b),e[0]=s,e[1]=r,e[2]=o,e[3]=l,e[4]=u,e[5]=V}else l=e[3],u=e[4],V=e[5];const d=V;let m;e[12]!==i?(m=K("w-full flex flex-wrap gap-2 justify-center",i),e[12]=i,e[13]=m):m=e[13];let f;e[14]!==l.length||e[15]!==u?(f=l.length>0&&n.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:K(Os,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",l.length," more"]}),e[14]=l.length,e[15]=u,e[16]=f):f=e[16];let y;e[17]!==d||e[18]!==m||e[19]!==f?(y=n.jsxs("div",{className:m,children:[d,f]}),e[17]=d,e[18]=m,e[19]=f,e[20]=y):y=e[20];let g;e[21]!==s||e[22]!==r||e[23]!==a||e[24]!==o?(g=n.jsx(oa,{items:s,open:a,onOpenChange:c,onSelect:o,loadingPrompt:r}),e[21]=s,e[22]=r,e[23]=a,e[24]=o,e[25]=g):g=e[25];let p;return e[26]!==y||e[27]!==g?(p=n.jsxs(an,{delayDuration:400,children:[y,g]}),e[26]=y,e[27]=g,e[28]=p):p=e[28],p}function ia(){return null}function aa(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function la(t){const e=F.c(31),{connectionId:s}=t,{sendMessage:o}=Et(),{tiptapDocRef:r}=Pt(),{org:i}=ie();let a;e[0]!==s||e[1]!==i.id||e[2]!==i.slug?(a={connectionId:s,orgId:i.id,orgSlug:i.slug},e[0]=s,e[1]=i.id,e[2]=i.slug,e[3]=a):a=e[3];const c=je(a);let l;e[4]!==c?(l={client:c,staleTime:6e4},e[4]=c,e[5]=l):l=e[5];const{data:u}=gr(l);let V;e[6]!==u?.prompts?(V=u?.prompts??[],e[6]=u?.prompts,e[7]=V):V=e[7];const d=V;let m;e[8]!==d?(m=d.map(ca),e[8]=d,e[9]=m):m=e[9];const f=m;let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={stage:"idle"},e[10]=y):y=e[10];const[g,p]=w.useReducer(aa,y),[v,h]=w.useState(null);let b;e[11]!==c||e[12]!==o||e[13]!==r?(b=async(k,R)=>{if(!c){oe.error("MCP client not available"),p({type:"RESET"});return}try{const L=await Cn(c,k.name,R);p({type:"RESET"});const D=na(r.current,{type:"paragraph",content:[ir({id:k.name,name:_n(k.name,Ce(k._meta)),metadata:L.messages,char:"/"})]});await o(D)}catch(L){console.error("[ice-breakers] Failed to fetch prompt:",L),oe.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=c,e[12]=o,e[13]=r,e[14]=b):b=e[14];const S=b;let C;e[15]!==S?(C=async k=>{if(k.arguments&&k.arguments.length>0){p({type:"SELECT_PROMPT",prompt:k}),h(k);return}p({type:"START_LOADING",prompt:k}),await S(k)},e[15]=S,e[16]=C):C=e[16];const _=C;let A;e[17]!==v||e[18]!==S?(A=async k=>{v&&(p({type:"START_LOADING",prompt:v,arguments:k}),h(null),await S(v,k))},e[17]=v,e[18]=S,e[19]=A):A=e[19];const x=A;if(f.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let P;e[20]!==_||e[21]!==f||e[22]!==j?(P=n.jsx(ra,{items:f,onSelect:_,loadingPrompt:j}),e[20]=_,e[21]=f,e[22]=j,e[23]=P):P=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{h(null),p({type:"RESET"})},e[24]=E):E=e[24];let I;e[25]!==v||e[26]!==x?(I=n.jsx(Tn,{prompt:v,setPrompt:E,onSubmit:x}),e[25]=v,e[26]=x,e[27]=I):I=e[27];let N;return e[28]!==P||e[29]!==I?(N=n.jsxs(n.Fragment,{children:[P,I]}),e[28]=P,e[29]=I,e[30]=N):N=e[30],N}function ca(t){return{prompt:t}}function da(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:o}=Pt(),{org:r}=ie();let i;e[0]!==r.id?(i=jn(r.id),e[0]=r.id,e[1]=i):i=e[1];const a=i.id,c=o?.id??a;let l;e[2]!==s?(l=K("w-full @container",s),e[2]=s,e[3]=l):l=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(ia,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=n.jsx(la,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=n.jsx(fo,{fallback:null,children:n.jsx(w.Suspense,{fallback:V,children:d},u)}),e[7]=u,e[8]=d,e[9]=m):m=e[9];let f;return e[10]!==l||e[11]!==m?(f=n.jsx("div",{className:l,children:m}),e[10]=l,e[11]=m,e[12]=f):f=e[12],f}function zs(t){const e=F.c(21),{current:s,total:o,onPrev:r,onNext:i}=t;if(o<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==c?(l=K("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Ar,{size:14}),e[2]=u):u=e[2];let V;e[3]!==r||e[4]!==a||e[5]!==l?(V=n.jsx("button",{type:"button",onClick:r,disabled:a,className:l,"aria-label":"Previous question",children:u}),e[3]=r,e[4]=a,e[5]=l,e[6]=V):V=e[6];const d=s+1;let m;e[7]!==d||e[8]!==o?(m=n.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",o]}),e[7]=d,e[8]=o,e[9]=m):m=e[9];const f=s===o-1,y=s===o-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==y?(g=K("p-0.5 rounded transition-colors",y),e[10]=y,e[11]=g):g=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Is,{size:14}),e[12]=p):p=e[12];let v;e[13]!==i||e[14]!==g||e[15]!==f?(v=n.jsx("button",{type:"button",onClick:i,disabled:f,className:g,"aria-label":"Next question",children:p}),e[13]=i,e[14]=g,e[15]=f,e[16]=v):v=e[16];let h;return e[17]!==v||e[18]!==V||e[19]!==m?(h=n.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,v]}),e[17]=v,e[18]=V,e[19]=m,e[20]=h):h=e[20],h}const tn="cubic-bezier(0.645, 0.045, 0.355, 1)",ua={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},Va={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ma={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function He(t){const e=F.c(61),{icon:s,label:o,count:r,title:i,footerLeft:a,footerRight:c,children:l,defaultExpanded:u,variant:V,onClose:d}=t,m=V===void 0?"default":V,[f,y]=w.useState(u),[g,p]=w.useState(!1);let v;e[0]!==d?(v=()=>{p(!0),d?.()},e[0]=d,e[1]=v):v=e[1];const h=v;if(g)return null;const b=Va[m],S=ua[m];let C;e[2]!==b||e[3]!==S?(C=K("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",b,S),e[2]=b,e[3]=S,e[4]=C):C=e[4];let _;e[5]===Symbol.for("react.memo_cache_sentinel")?(_=()=>y(fa),e[5]=_):_=e[5];const A=f&&"rounded-b-none",x=!f&&"rounded-b-xl";let j;e[6]!==A||e[7]!==x?(j=K("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",A,x),e[6]=A,e[7]=x,e[8]=j):j=e[8];const P=ma[m];let E;e[9]!==P?(E=K("shrink-0",P),e[9]=P,e[10]=E):E=e[10];let I;e[11]!==s||e[12]!==E?(I=n.jsx("span",{className:E,children:s}),e[11]=s,e[12]=E,e[13]=I):I=e[13];let N;e[14]!==o?(N=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:o}),e[14]=o,e[15]=N):N=e[15];let k;e[16]!==r?(k=r?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=k):k=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let L;e[18]!==R?(L=n.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:n.jsx(kr,{size:16,style:{transform:R,transition:`transform 180ms ${tn}`}})}),e[18]=R,e[19]=L):L=e[19];let D,T;e[20]!==h?(D=ee=>{ee.stopPropagation(),h()},T=ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),ee.stopPropagation(),h())},e[20]=h,e[21]=D,e[22]=T):(D=e[21],T=e[22]);let U;e[23]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Ze,{size:16}),e[23]=U):U=e[23];let O;e[24]!==D||e[25]!==T?(O=n.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:D,onKeyDown:T,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:U}),e[24]=D,e[25]=T,e[26]=O):O=e[26];let $;e[27]!==f||e[28]!==I||e[29]!==N||e[30]!==k||e[31]!==L||e[32]!==O||e[33]!==j?($=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:_,className:j,children:[I,N,k,L,O]}),e[27]=f,e[28]=I,e[29]=N,e[30]=k,e[31]=L,e[32]=O,e[33]=j,e[34]=$):$=e[34];const W=f?"1fr":"0fr";let M;e[35]!==W?(M={display:"grid",gridTemplateRows:W,transition:`grid-template-rows 180ms ${tn}`},e[35]=W,e[36]=M):M=e[36];let Y;e[37]===Symbol.for("react.memo_cache_sentinel")?(Y={overflow:"hidden",minHeight:0},e[37]=Y):Y=e[37];const G=f?1:0;let q;e[38]!==G?(q={opacity:G,transition:`opacity 120ms ${tn}`},e[38]=G,e[39]=q):q=e[39];let Q;e[40]!==i?(Q=i?n.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:n.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=i,e[41]=Q):Q=e[41];let H;e[42]!==l||e[43]!==i?(H=l?n.jsx("div",{className:K("overflow-clip pb-4",!i&&"pt-4"),children:l}):null,e[42]=l,e[43]=i,e[44]=H):H=e[44];let X;e[45]!==a||e[46]!==c?(X=a||c?n.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{children:a}),n.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=a,e[46]=c,e[47]=X):X=e[47];let ne;e[48]!==q||e[49]!==Q||e[50]!==H||e[51]!==X?(ne=n.jsx("div",{style:Y,children:n.jsxs("div",{style:q,children:[Q,H,X]})}),e[48]=q,e[49]=Q,e[50]=H,e[51]=X,e[52]=ne):ne=e[52];let J;e[53]!==M||e[54]!==ne?(J=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:ne}),e[53]=M,e[54]=ne,e[55]=J):J=e[55];let re;return e[56]!==$||e[57]!==J||e[58]!==C||e[59]!==m?(re=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[$,J]}),e[56]=$,e[57]=J,e[58]=C,e[59]=m,e[60]=re):re=e[60],re}function fa(t){return!t}const pa="User denied this tool call, give other alternatives.";function ha(t){const e=F.c(9),{onYolo:s}=t,[o,r]=Tt();let i;e[0]!==s||e[1]!==o||e[2]!==r?(i=V=>{const d=V;r({...o,toolApprovalLevel:d}),d==="auto"&&s()},e[0]=s,e[1]=o,e[2]=r,e[3]=i):i=e[3];const a=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(_s,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:xa,children:n.jsx(Cs,{})}),e[4]=c):c=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ns,{children:Xe.map(ga)}),e[5]=l):l=e[5];let u;return e[6]!==a||e[7]!==o.toolApprovalLevel?(u=n.jsxs(ks,{value:o.toolApprovalLevel,onValueChange:a,children:[c,l]}),e[6]=a,e[7]=o.toolApprovalLevel,e[8]=u):u=e[8],u}function ga(t){return n.jsx(We,{value:t.value,children:t.label},t.value)}function xa(t){return t.stopPropagation()}function ba(t){const e=F.c(5),{input:s}=t;if(s==null){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=i):i=e[0],i}let o;try{let i;e[1]!==s?(i=JSON.stringify(s,null,2),e[1]=s,e[2]=i):i=e[2],o=i}catch{o=String(s)}let r;return e[3]!==o?(r=n.jsx("div",{className:"px-4",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:o})}),e[3]=o,e[4]=r):r=e[4],r}function ya(t){const e=F.c(44),{approvals:s,onRespond:o}=t,[r,i]=w.useState(0),a=Math.min(r,s.length-1),c=s[a];if(!c)return null;let l;e[0]!==c.approvalId||e[1]!==o?(l=()=>{o(c.approvalId,!1,pa)},e[0]=c.approvalId,e[1]=o,e[2]=l):l=e[2];const u=l;let V;e[3]!==c.approvalId||e[4]!==o?(V=()=>{o(c.approvalId,!0)},e[3]=c.approvalId,e[4]=o,e[5]=V):V=e[5];const d=V;let m;e[6]!==s||e[7]!==o?(m=()=>{for(const R of s)o(R.approvalId,!0)},e[6]=s,e[7]=o,e[8]=m):m=e[8];const f=m;let y;e[9]!==a?(y=()=>{a>0&&i(a-1)},e[9]=a,e[10]=y):y=e[10];const g=y;let p;e[11]!==s.length||e[12]!==a?(p=()=>{a<s.length-1&&i(a+1)},e[11]=s.length,e[12]=a,e[13]=p):p=e[13];const v=p,h=s.length===1?"Approval needed":`${s.length} approvals pending`;let b;e[14]!==f?(b=n.jsx(ha,{onYolo:f}),e[14]=f,e[15]=b):b=e[15];let S;e[16]!==s.length||e[17]!==v||e[18]!==g||e[19]!==a?(S=n.jsx(zs,{current:a,total:s.length,onPrev:g,onNext:v}),e[16]=s.length,e[17]=v,e[18]=g,e[19]=a,e[20]=S):S=e[20];let C;e[21]!==b||e[22]!==S?(C=n.jsxs("div",{className:"flex items-center gap-2",children:[b,S]}),e[21]=b,e[22]=S,e[23]=C):C=e[23];const _=C;let A;e[24]!==u?(A=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:u,children:"Deny"}),e[24]=u,e[25]=A):A=e[25];let x;e[26]!==s.length||e[27]!==f?(x=s.length>1&&n.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:f,children:"Accept All"}),e[26]=s.length,e[27]=f,e[28]=x):x=e[28];let j;e[29]!==d?(j=n.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:d,children:"Accept"}),e[29]=d,e[30]=j):j=e[30];let P;e[31]!==x||e[32]!==j||e[33]!==A?(P=n.jsxs(n.Fragment,{children:[A,x,j]}),e[31]=x,e[32]=j,e[33]=A,e[34]=P):P=e[34];const E=P;let I;e[35]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(kn,{size:14}),e[35]=I):I=e[35];let N;e[36]!==c.input?(N=n.jsx(ba,{input:c.input}),e[36]=c.input,e[37]=N):N=e[37];let k;return e[38]!==h||e[39]!==c.friendlyName||e[40]!==_||e[41]!==E||e[42]!==N?(k=n.jsx(He,{icon:I,label:h,title:c.friendlyName,defaultExpanded:!0,footerLeft:_,footerRight:E,children:N}),e[38]=h,e[39]=c.friendlyName,e[40]=_,e[41]=E,e[42]=N,e[43]=k):k=e[43],k}function va(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(kn,{className:"size-5 text-muted-foreground shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function wa(t){const e=F.c(4),{approvals:s,isStreaming:o,onRespond:r}=t;if(o&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(va,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let i;return e[1]!==s||e[2]!==r?(i=n.jsx(ya,{approvals:s,onRespond:r}),e[1]=s,e[2]=r,e[3]=i):i=e[3],i}function ja(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const o="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:o,friendlyName:ar(lr(o)),input:s.input})}return e}function Aa(t){const e=F.c(16),{plan:s,onApprove:o,onDismiss:r}=t;let i;e[0]!==o||e[1]!==s.plan?(i=()=>{o(s.plan)},e[0]=o,e[1]=s.plan,e[2]=i):i=e[2];const a=i;let c;e[3]!==r?(c=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:"Keep iterating"}),e[3]=r,e[4]=c):c=e[4];let l;e[5]!==a?(l=n.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:"Let's go"}),e[5]=a,e[6]=l):l=e[6];let u;e[7]!==c||e[8]!==l?(u=n.jsxs(n.Fragment,{children:[c,l]}),e[7]=c,e[8]=l,e[9]=u):u=e[9];const V=u;let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Eo,{size:14}),e[10]=d):d=e[10];let m;e[11]!==s.plan?(m=n.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:n.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:n.jsx(cr,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[11]=s.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=n.jsx(He,{icon:d,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function Sa(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(dt,{className:"size-5 text-purple-500 shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function ka(t){const e=F.c(7),{plans:s,isStreaming:o,onApprove:r,onDismiss:i}=t;if(o&&s.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Sa,{}),e[0]=u):u=e[0],u}let a;e[1]!==s?(a=s.at(-1),e[1]=s,e[2]=a):a=e[2];const c=a;if(!c)return null;let l;return e[3]!==c||e[4]!==r||e[5]!==i?(l=n.jsx(Aa,{plan:c,onApprove:r,onDismiss:i}),e[3]=c,e[4]=r,e[5]=i,e[6]=l):l=e[6],l}function _a(t){const e=[];for(const s of t)if("type"in s&&s.type==="tool-propose_plan"&&"state"in s&&s.state==="input-available"&&"toolCallId"in s&&"input"in s){const o=s.input;e.push({toolCallId:s.toolCallId,plan:o.plan,state:s.state})}return e}function Qe(t){return t?"response"in t?t.response:t.option??t.draft:""}const Gn=Ie({response:Le().min(1,"Response is required")}),Ca=Ie({option:Le().nullable(),draft:Le()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Na=Ie({response:cs(["yes","no"])});function Ia(t){switch(t.type){case"text":return Gn;case"choice":return Ca;case"confirm":return Na;default:return Gn}}function Ta(t){const e={};for(const s of t)e[s.toolCallId]=Ia(s.input);return Ie(e)}function Ra(t){const e=F.c(6),{control:s,name:o,placeholder:r}=t;let i;e[0]!==r?(i=c=>{const{field:l}=c;return n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx("div",{className:"px-2",children:n.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(fs,{size:16,className:"text-muted-foreground"})}),n.jsx("input",{...l,type:"text",placeholder:r||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),n.jsx(de,{})]})},e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==s||e[3]!==o||e[4]!==i?(a=n.jsx(ue,{control:s,name:o,render:i}),e[2]=s,e[3]=o,e[4]=i,e[5]=a):a=e[5],a}function Bs(t,e){const s=F.c(4);let o,r;s[0]!==t||s[1]!==e?(o=()=>{const i=a=>{const c=a.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const l=Number.parseInt(a.key,10);l>=1&&l<=t&&(a.preventDefault(),e(l-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=o,s[3]=r):(o=s[2],r=s[3]),w.useEffect(o,r)}function Pa(t){const e=F.c(40),{control:s,name:o,options:r}=t,i=`${o}.option`;let a;e[0]!==s||e[1]!==i?(a={control:s,name:i,defaultValue:null},e[0]=s,e[1]=i,e[2]=a):a=e[2];const{field:c}=Dn(a),l=`${o}.draft`;let u;e[3]!==s||e[4]!==l?(u={control:s,name:l,defaultValue:""},e[3]=s,e[4]=l,e[5]=u):u=e[5];const{field:V}=Dn(u),d=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==r?(f=I=>{const N=r[I];N!=null&&c.onChange(N)},e[6]=c,e[7]=r,e[8]=f):f=e[8],Bs(r.length,f),r.length===0)return null;const y=d===null;let g;if(e[9]!==c||e[10]!==d||e[11]!==r){let I;e[13]!==c||e[14]!==d?(I=(N,k)=>{const R=d===N;return n.jsxs("button",{type:"button",onClick:()=>c.onChange(N),className:K("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${N}`,children:[n.jsx("span",{className:K("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:k+1}),n.jsx("span",{className:"text-sm text-foreground truncate",children:N})]},`${k}-${N}`)},e[13]=c,e[14]=d,e[15]=I):I=e[15],g=r.map(I),e[9]=c,e[10]=d,e[11]=r,e[12]=g}else g=e[12];const p=y&&"bg-accent/50",v=!y&&"hover:bg-accent/30";let h;e[16]!==p||e[17]!==v?(h=K("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p,v),e[16]=p,e[17]=v,e[18]=h):h=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(fs,{size:16,className:"text-muted-foreground"})}),e[19]=b):b=e[19];const S=y?m:"";let C;e[20]!==V||e[21]!==c||e[22]!==d?(C=I=>{V.onChange(I.target.value),d!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=d,e[23]=C):C=e[23];let _;e[24]!==c||e[25]!==d?(_=()=>{d!==null&&c.onChange(null)},e[24]=c,e[25]=d,e[26]=_):_=e[26];let A;e[27]!==S||e[28]!==C||e[29]!==_?(A=n.jsx("input",{type:"text",value:S,onChange:C,onFocus:_,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=S,e[28]=C,e[29]=_,e[30]=A):A=e[30];let x;e[31]!==A||e[32]!==h?(x=n.jsxs("label",{className:h,children:[b,A]}),e[31]=A,e[32]=h,e[33]=x):x=e[33];let j;e[34]!==x||e[35]!==g?(j=n.jsx(ce,{children:n.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[g,x]})}),e[34]=x,e[35]=g,e[36]=j):j=e[36];let P;e[37]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(de,{}),e[37]=P):P=e[37];let E;return e[38]!==j?(E=n.jsxs(le,{children:[j,P]}),e[38]=j,e[39]=E):E=e[39],E}function Ea(t){const e=F.c(6),{control:s,name:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const i=r,a=w.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{a.current?.onChange(i[V]??"")},e[1]=c):c=e[1],Bs(i.length,c);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=V=>{const{field:d}=V;return a.current=d,n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:i.map(m=>{const f=d.value===m;return n.jsxs("button",{type:"button",onClick:()=>d.onChange(m),className:K("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[n.jsx("span",{className:K("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),n.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),n.jsx(de,{})]})},e[2]=l):l=e[2];let u;return e[3]!==s||e[4]!==o?(u=n.jsx(ue,{control:s,name:o,render:l}),e[3]=s,e[4]=o,e[5]=u):u=e[5],u}function Hn(t){const e=F.c(13),{input:s,control:o,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==o||e[1]!==s.default||e[2]!==i?(a=n.jsx(Ra,{control:o,name:i,placeholder:s.default}),e[0]=o,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let c;return e[6]!==o||e[7]!==a||e[8]!==r?(c=n.jsx(Pa,{control:o,name:r,options:a}),e[6]=o,e[7]=a,e[8]=r,e[9]=c):c=e[9],c}case"confirm":{const i=`${r}.response`;let a;return e[10]!==o||e[11]!==i?(a=n.jsx(Ea,{control:o,name:i}),e[10]=o,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function Da({parts:t,onSubmit:e}){const[s,o]=w.useState(t[0]?.toolCallId??""),r=Ta(t.map(h=>({toolCallId:h.toolCallId,input:h.input}))),i=hn({resolver:gn(r),defaultValues:Object.fromEntries(t.map(h=>h.input?.type==="choice"?[h.toolCallId,{option:null,draft:""}]:[h.toolCallId,{response:""}]))}),a=i.watch(),c=t.findIndex(h=>h.toolCallId===s),l=!!Qe(a[s]),u=t.every(h=>!!Qe(a[h.toolCallId])),V=h=>{for(const b of t){const S=Qe(h[b.toolCallId]);S&&e(b,S)}},d=h=>t.find(b=>!Qe(h[b.toolCallId])&&b.toolCallId!==s)??null,m=()=>{const h=i.getValues();if(t.every(S=>!!Qe(h[S.toolCallId])))i.handleSubmit(V)();else{const S=d(h);S&&o(S.toolCallId)}},f=()=>{const h=t.find(S=>S.toolCallId===s),b="user has skip this question";h?.input?.type==="choice"?(i.setValue(`${s}.option`,null),i.setValue(`${s}.draft`,b)):i.setValue(`${s}.response`,b),m()},y=()=>{if(c>0){const h=t[c-1];h&&o(h.toolCallId)}},g=()=>{if(c<t.length-1){const h=t[c+1];h&&o(h.toolCallId)}},p=n.jsxs(n.Fragment,{children:[n.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),n.jsx(Z,{type:"button",size:"sm",disabled:!l,onClick:m,className:K("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),v=n.jsx(zs,{current:c,total:t.length,onPrev:y,onNext:g});if(t.length===1){const h=t[0];return h?.input?n.jsx(ct,{...i,children:n.jsx("form",{onSubmit:i.handleSubmit(V),autoComplete:"off",children:n.jsx(He,{icon:n.jsx(ln,{size:14}),label:"Question pending",title:h.input?.prompt??"Question",defaultExpanded:!0,footerRight:p,children:n.jsx(Hn,{input:h.input,control:i.control,toolCallId:h.toolCallId})})})}):null}return n.jsx(ct,{...i,children:n.jsx("form",{onSubmit:i.handleSubmit(V),autoComplete:"off",children:n.jsx(He,{icon:n.jsx(ln,{size:14}),label:"Question pending",count:`${c+1} of ${t.length}`,title:t[c]?.input?.prompt??"Question",defaultExpanded:!0,footerLeft:v,footerRight:p,children:n.jsx(xr,{value:s,onValueChange:o,children:t.map(h=>n.jsx(br,{value:h.toolCallId,className:"mt-0",children:n.jsx(Hn,{input:h.input,control:i.control,toolCallId:h.toolCallId})},h.toolCallId))})})})})}function La(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[n.jsx(ln,{className:"size-5 text-muted-foreground shimmer"}),n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function qs(t){const e=F.c(6),{userAskParts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(Ma),e[0]=s,e[1]=i):i=e[1];const a=i;if(o){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(La,{}),e[2]=l):l=e[2],l}if(a.length===0)return null;let c;return e[3]!==r||e[4]!==a?(c=n.jsx(Da,{parts:a,onSubmit:r}),e[3]=r,e[4]=a,e[5]=c):c=e[5],c}function Ma(t){return t.state==="input-available"}const Fa=Ie({content:Le().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:cs(["pending","in_progress","completed"]),activeForm:Le().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Ks=Ie({todos:po(Fa)}),Ua="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Bo({description:Ua,inputSchema:qo(Ks),execute:async({todos:t})=>({ok:!0,count:t.length})});const Oa="tool-todo_write",$a=new Set(["input-available","output-available"]);function za(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const o=s.parts;if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=o[r];if(i.type!==Oa||typeof i.state!="string"||!$a.has(i.state))continue;const a=Ks.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function Ba(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,o=t.length;if(o>0&&s===o)return{icon:"completed",activity:"All done",progress:`${o}/${o}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${o} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${o} done`}:s>0?{icon:"pending",activity:`${o-s} pending`,progress:`${s}/${o} done`}:{icon:"pending",activity:`${o} todos`,progress:"not started"}}function qa(){const t=F.c(21),{messages:e}=Et();let s,o,r,i,a,c,l,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=za(e);if(f.length===0){V=null;break e}const y=Ba(f);s=He,a=n.jsx(Ga,{status:y.icon}),c=y.activity,l=y.progress,u=!1,o="todos-list",r="flex flex-col px-2 max-h-[40vh] overflow-y-auto",i=f.map(Ka)}t[0]=e,t[1]=s,t[2]=o,t[3]=r,t[4]=i,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=V}else s=t[1],o=t[2],r=t[3],i=t[4],a=t[5],c=t[6],l=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let d;t[10]!==o||t[11]!==r||t[12]!==i?(d=n.jsx("ul",{"data-testid":o,className:r,children:i}),t[10]=o,t[11]=r,t[12]=i,t[13]=d):d=t[13];let m;return t[14]!==s||t[15]!==a||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d?(m=n.jsx(s,{icon:a,label:c,count:l,defaultExpanded:u,children:d}),t[14]=s,t[15]=a,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=m):m=t[20],m}function Ka(t,e){return n.jsx(Ya,{todo:t},e)}function Ya(t){const e=F.c(14),{todo:s}=t,o=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Wa,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const c=o&&"text-muted-foreground";let l;e[2]!==c?(l=K("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=l):l=e[3];const u=o?"100%":"0%",V=o?"width 300ms ease 200ms":"width 150ms ease";let d;e[4]!==u||e[5]!==V?(d=n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==l||e[9]!==d?(m=n.jsxs("span",{className:l,children:[i,d]}),e[7]=i,e[8]=l,e[9]=d,e[10]=m):m=e[10];let f;return e[11]!==a||e[12]!==m?(f=n.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,m]}),e[11]=a,e[12]=m,e[13]=f):f=e[13],f}function Wa(t){const e=F.c(4),{status:s}=t,o=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("svg",{viewBox:"0 0 21 21",children:n.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==o||e[2]!==r?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":o,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=o,e[2]=r,e[3]=a):a=e[3],a}function Ga(t){const e=F.c(3),{status:s}=t;if(s==="completed"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:n.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:n.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=r):r=e[0],r}if(s==="in_progress"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=r):r=e[1],r}let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=o):o=e[2],o}const Qn=new Map;function Ys(){const{org:t}=ie(),e=je({connectionId:pt,orgId:t.id,orgSlug:t.slug}),s=_r(),o=s.find(p=>p.providerId==="deco"),{data:r,isLoading:i,refetch:a,isFetching:c}=vn({queryKey:me.aiProviderCredits(t.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{const p=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return p?.isError?null:p.structuredContent??null}}),l=r?.balanceCents??null,u=l!=null?l/100:null,V=w.useRef(new Map);if(l!=null){const p=Qn.get(t.id);V.current.get(t.id)&&p!=null&&l>p&&z("credits_topped_up_detected",{organization_id:t.id,delta_cents:l-p,previous_balance_cents:p,new_balance_cents:l}),Qn.set(t.id,l),V.current.set(t.id,!0)}const d=!!o,m=l!=null&&l>0,f=l!=null&&l===0,y=l!=null&&l===200,g=s.length>0&&s.every(p=>p.providerId==="deco");return{hasDecoKey:d,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:m,isZeroBalance:f,isInitialFreeCredit:y,hasOnlyDecoProvider:g,isLoading:i,isFetching:c,refetch:a}}function Ha(t){return t?t.message.startsWith("[CREDITS]"):!1}const Qa={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Ja=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Ws(t){const e=F.c(44),{onDismiss:s}=t,{org:o}=ie(),r=Ne(),{decoKeyId:i}=Ys();let a;e[0]!==o.id||e[1]!==o.slug?(a={connectionId:pt,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=a):a=e[2];const c=je(a),[l,u]=w.useState(""),[V,d]=w.useState(!1),[m,f]=w.useState("usd"),y=m==="brl"?"R$":"$";let g,p;e[3]!==o.id?(g=()=>{z("credits_exhausted_shown",{organization_id:o.id})},p=[o.id],e[3]=o.id,e[4]=g,e[5]=p):(g=e[4],p=e[5]),w.useEffect(g,p);let v;e[6]!==c||e[7]!==m?(v=async T=>{const U=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:T,currency:m}});if(U?.isError)throw new Error(U.content?.[0]?.text??"Failed to get top-up URL");return U.structuredContent?.url},e[6]=c,e[7]=m,e[8]=v):v=e[8];let h;e[9]!==s?(h=T=>{T&&window.open(T,"_blank","noopener,noreferrer"),s?.()},e[9]=s,e[10]=h):h=e[10];let b;e[11]!==v||e[12]!==h?(b={mutationFn:v,onSuccess:h,onError:el},e[11]=v,e[12]=h,e[13]=b):b=e[13];const{mutate:S,isPending:C}=xn(b),_=parseFloat(l),A=!isNaN(_)&&_>=1;let x;e[14]!==s?(x=T=>!T&&s?.(),e[14]=s,e[15]=x):x=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=j):j=e[16];let P;e[17]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:j.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=P):P=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[P,n.jsxs(ye,{className:"relative gap-4",children:[n.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),n.jsxs("div",{children:[n.jsx(ve,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),n.jsx(Rt,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[18]=E):E=e[18];let I;e[19]!==m||e[20]!==y||e[21]!==l||e[22]!==_||e[23]!==i||e[24]!==A||e[25]!==C||e[26]!==V||e[27]!==S?(I=i&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ts,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:T=>{T&&f(T)},children:[n.jsx(kt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(kt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),n.jsxs("div",{className:"rounded-xl border border-border p-5",children:[n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Qa[m].map(T=>{const{dollars:U,label:O}=T;return n.jsxs("button",{type:"button",disabled:C,onClick:()=>{z("credits_topup_clicked",{amount_cents:U*100,currency:m,tier_label:O,source:"exhausted_banner"}),S(U*100)},className:K("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[n.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[y,U]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:O})]},U)})}),V?n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:y}),n.jsx(he,{type:"number",min:"1",step:"1",placeholder:"50",value:l,onChange:T=>u(T.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(Z,{className:"h-10",disabled:!A||C,onClick:()=>{z("credits_topup_clicked",{amount_cents:Math.round(_*100),currency:m,tier_label:"custom",source:"exhausted_banner"}),S(Math.round(_*100))},children:C?"Opening...":"Add"})]}):n.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),n.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Ja.map(Xa)})]}),e[19]=m,e[20]=y,e[21]=l,e[22]=_,e[23]=i,e[24]=A,e[25]=C,e[26]=V,e[27]=S,e[28]=I):I=e[28];let N;e[29]!==s?(N=n.jsx(Z,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[29]=s,e[30]=N):N=e[30];let k;e[31]!==r||e[32]!==s||e[33]!==o.slug?(k=n.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{r({to:"/$org/settings/ai-providers",params:{org:o.slug}}),s?.()},children:"Manage providers"}),e[31]=r,e[32]=s,e[33]=o.slug,e[34]=k):k=e[34];let R;e[35]!==N||e[36]!==k?(R=n.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[N,k]}),e[35]=N,e[36]=k,e[37]=R):R=e[37];let L;e[38]!==I||e[39]!==R?(L=n.jsxs(be,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Za,children:[E,I,R]}),e[38]=I,e[39]=R,e[40]=L):L=e[40];let D;return e[41]!==L||e[42]!==x?(D=n.jsx(xe,{open:!0,onOpenChange:x,children:L}),e[41]=L,e[42]=x,e[43]=D):D=e[43],D}function Xa(t){return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:n.jsx(dt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Za(t){return t.preventDefault()}function el(t){oe.error(`Top-up failed: ${t.message}`)}const tl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function _t(t){const e=F.c(13),{variant:s,onDismiss:o}=t,r=s==="error",i=r?"Error occurred":"Response incomplete",a=r?t.error.message:tl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,c=r?Ss:ds;let l;e[0]!==c?(l=n.jsx(c,{size:14}),e[0]=c,e[1]=l):l=e[1];let u;e[2]!==r||e[3]!==t.onContinue||e[4]!==t.onFixInChat?(u=r?n.jsx(Z,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):n.jsx(Z,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[2]=r,e[3]=t.onContinue,e[4]=t.onFixInChat,e[5]=u):u=e[5];let V;return e[6]!==i||e[7]!==a||e[8]!==o||e[9]!==l||e[10]!==u||e[11]!==s?(V=n.jsx(He,{icon:l,label:i,title:a,defaultExpanded:!0,variant:s,onClose:o,footerRight:u,children:null}),e[6]=i,e[7]=a,e[8]=o,e[9]=l,e[10]=u,e[11]=s,e[12]=V):V=e[12],V}function zt(){const t=F.c(81),{error:e,clearError:s,finishReason:o,clearFinishReason:r,messages:i,isStreaming:a,isWaitingForApprovals:c,addToolOutput:l,addToolApprovalResponse:u,sendMessage:V}=Et(),[d,m]=Tt(),{virtualMcpId:f,createTaskWithMessage:y}=Ko();let g,p,v,h,b,S,C,_,A,x,j,P,E,I,N,k,R;if(t[0]!==u||t[1]!==l||t[2]!==s||t[3]!==y||t[4]!==e||t[5]!==o||t[6]!==a||t[7]!==c||t[8]!==i||t[9]!==d||t[10]!==V||t[11]!==m||t[12]!==f){N=Symbol.for("react.early_return_sentinel");e:{const Y=i.at(-1);R=Y?.role==="assistant"?Y.parts.filter(il):null,_=!!R?.filter(rl)?.length,x=Y?.role==="assistant"?_a(Y.parts):[],A=Y?.role==="assistant"?ja(Y.parts):[];let G;t[30]!==e||t[31]!==V?(G=()=>{if(e){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};V(re)}},t[30]=e,t[31]=V,t[32]=G):G=t[32],v=G;let q;t[33]!==V?(q=()=>{V({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[33]=V,t[34]=q):q=t[34],p=q;let Q;t[35]!==l?(Q=(J,re)=>{l({tool:"user_ask",toolCallId:J.toolCallId,output:{response:re}})},t[35]=l,t[36]=Q):Q=t[36],S=Q;let H;t[37]!==y||t[38]!==d||t[39]!==m||t[40]!==f?(H=J=>{m({...d,toolApprovalLevel:"auto"}),y({virtualMcpId:f,message:{parts:[{type:"text",text:`Implement this plan:
546
546
 
547
547
  ${J}`}]}})},t[37]=y,t[38]=d,t[39]=m,t[40]=f,t[41]=H):H=t[41],h=H,b=ol;let X;if(t[42]!==u?(X=(J,re,ee)=>{u({id:J,approved:re,...ee?{reason:ee}:{}})},t[42]=u,t[43]=X):X=t[43],g=X,!a&&e&&Ha(e)){let J;t[44]!==s?(J=n.jsx(Ws,{onDismiss:s}),t[44]=s,t[45]=J):J=t[45],N=J;break e}P=!a&&!!e,C=A.length>0||a&&c;const ne=o==="tool-calls"&&(_||C||x.length>0);E=!a&&!!o&&o!=="stop"&&!ne&&!P,k=R?.map(sl).join("|")??"",j=x[0]?.toolCallId??"",I=A.map(nl).join("|")}t[0]=u,t[1]=l,t[2]=s,t[3]=y,t[4]=e,t[5]=o,t[6]=a,t[7]=c,t[8]=i,t[9]=d,t[10]=V,t[11]=m,t[12]=f,t[13]=g,t[14]=p,t[15]=v,t[16]=h,t[17]=b,t[18]=S,t[19]=C,t[20]=_,t[21]=A,t[22]=x,t[23]=j,t[24]=P,t[25]=E,t[26]=I,t[27]=N,t[28]=k,t[29]=R}else g=t[13],p=t[14],v=t[15],h=t[16],b=t[17],S=t[18],C=t[19],_=t[20],A=t[21],x=t[22],j=t[23],P=t[24],E=t[25],I=t[26],N=t[27],k=t[28],R=t[29];if(N!==Symbol.for("react.early_return_sentinel"))return N;const L=I;let D;t[46]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(qa,{}),t[46]=D):D=t[46];let T;t[47]!==s||t[48]!==e||t[49]!==v||t[50]!==P?(T=P&&n.jsx(_t,{variant:"error",error:e,onDismiss:s,onFixInChat:v}),t[47]=s,t[48]=e,t[49]=v,t[50]=P,t[51]=T):T=t[51];let U;t[52]!==r||t[53]!==o||t[54]!==p||t[55]!==E?(U=E&&n.jsx(_t,{variant:"warning",finishReason:o,onDismiss:r,onContinue:p}),t[52]=r,t[53]=o,t[54]=p,t[55]=E,t[56]=U):U=t[56];let O;t[57]!==L||t[58]!==g||t[59]!==C||t[60]!==a||t[61]!==A?(O=C&&n.jsx(wa,{approvals:A,isStreaming:a,onRespond:g},L),t[57]=L,t[58]=g,t[59]=C,t[60]=a,t[61]=A,t[62]=O):O=t[62];let $;t[63]!==h||t[64]!==b||t[65]!==a||t[66]!==x||t[67]!==j?($=x.length>0&&n.jsx(ka,{plans:x,isStreaming:a,onApprove:h,onDismiss:b},j),t[63]=h,t[64]=b,t[65]=a,t[66]=x,t[67]=j,t[68]=$):$=t[68];let W;t[69]!==S||t[70]!==a||t[71]!==_||t[72]!==k||t[73]!==R?(W=_&&R&&n.jsx(qs,{userAskParts:R,isStreaming:a,onSubmit:S},k),t[69]=S,t[70]=a,t[71]=_,t[72]=k,t[73]=R,t[74]=W):W=t[74];let M;return t[75]!==T||t[76]!==U||t[77]!==O||t[78]!==$||t[79]!==W?(M=n.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[D,T,U,O,$,W]}),t[75]=T,t[76]=U,t[77]=O,t[78]=$,t[79]=W,t[80]=M):M=t[80],M}function nl(t){return t.approvalId}function sl(t){return t.toolCallId}function ol(){document.querySelector("[data-chat-input]")?.focus()}function rl(t){return t.state!=="output-available"}function il(t){return t.type==="tool-user_ask"}zt.Error=function(e){return n.jsx(_t,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};zt.Warning=function(e){return n.jsx(_t,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};zt.UserAskQuestion=qs;const nn=[{value:"fast",label:"Fast",Icon:Do,description:"Quicker responses"},{value:"smart",label:"Smart",Icon:wr,description:"Balanced quality"},{value:"thinking",label:"Thinking",Icon:Lo,description:"Deeper reasoning"}];function al(t){const e=F.c(18),{tier:s,onSelect:o}=t;let r;e[0]!==s?(r=nn.find(f=>f.value===s)??nn[1],e[0]=s,e[1]=r):r=e[1];const i=r,a=i.Icon;let c;e[2]!==a?(c=n.jsx(a,{size:14}),e[2]=a,e[3]=c):c=e[3];let l;e[4]!==i.label?(l=n.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[496px]/chat-bottom:max-w-24 @[496px]/chat-bottom:opacity-100",children:i.label}),e[4]=i.label,e[5]=l):l=e[5];let u;e[6]!==i.label||e[7]!==c||e[8]!==l?(u=n.jsx(Ps,{asChild:!0,children:n.jsxs(Z,{type:"button",variant:"ghost",size:"default",title:i.label,"aria-label":i.label,className:"text-muted-foreground hover:text-foreground",children:[c,l]})}),e[6]=i.label,e[7]=c,e[8]=l,e[9]=u):u=e[9];let V;e[10]!==o||e[11]!==s?(V=nn.map(f=>{const{value:y,label:g,Icon:p,description:v}=f;return n.jsxs(_e,{onSelect:()=>o(y),children:[n.jsx(p,{size:16,className:"text-muted-foreground"}),n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx("span",{children:g}),n.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:v})]}),s===y&&n.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"On"})]},y)}),e[10]=o,e[11]=s,e[12]=V):V=e[12];let d;e[13]!==V?(d=n.jsx(Es,{align:"end",className:"w-52 p-1.5",children:V}),e[13]=V,e[14]=d):d=e[14];let m;return e[15]!==u||e[16]!==d?(m=n.jsxs(Ds,{children:[u,d]}),e[15]=u,e[16]=d,e[17]=m):m=e[17],m}async function Rn(t,e,s,o,r){if(!$t(e)){oe.error("Selected model does not support file uploads");return}const i=s.type||"application/octet-stream";if(!Cr(i,e)){const c=Rs(e),l=e?.title??"This model";r?r({fileName:s.name,modelName:l,accepted:c}):oe.error(`"${s.name}" can't be attached`,{description:`${l} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){oe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,l=new Promise((d,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const y=f.includes(",")?f.split(",")[1]??f:f;d(y)},c.onerror=m});c.readAsDataURL(s);const u=await l,V={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};dr(t,{from:o,to:o},V)}catch(c){console.error("Failed to process file:",c),oe.error(`Failed to load file "${s.name}"`)}}function ll(t){const e=F.c(8),{editor:s,selectedModel:o,onUnsupportedFile:r}=t,i=w.useRef(dl);let a,c;e[0]!==s||e[1]!==r||e[2]!==o?(a=()=>{i.current=async(V,d)=>{await Rn(s,o,V,d,r)}},c=[s,o,r],e[0]=s,e[1]=r,e[2]=o,e[3]=a,e[4]=c):(a=e[3],c=e[4]),w.useEffect(a,c);let l,u;return e[5]!==s?(l=()=>{if(s?.isDestroyed)return;const V=new cn("fileDropHandler");s.state.plugins.find(f=>f.spec.key===V)&&s.unregisterPlugin(V);const m=new Pr({key:V,props:{handleDrop:(f,y,g,p)=>{if(p)return!1;const v=y.dataTransfer?.files;if(!v||v.length===0)return!1;y.preventDefault();const h=f.posAtCoords({left:y.clientX,top:y.clientY});if(!h)return!1;const b=Array.from(v),S=h.pos;for(const C of b)i.current?.(C,S);return!0},handlePaste:(f,y)=>{const g=y.clipboardData?.items;if(!g)return!1;const p=Array.from(g).filter(cl);if(p.length===0)return!1;y.preventDefault();const{from:v}=f.state.selection;for(const h of p){const b=h.getAsFile();b&&i.current?.(b,v)}return!0}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(V)}},u=[s],e[5]=s,e[6]=l,e[7]=u):(l=e[6],u=e[7]),w.useEffect(l,u),null}function cl(t){return t.kind==="file"}function dl(){return Promise.resolve()}function ul(t){const e=F.c(26),{info:s,onClose:o}=t,r=s!==null;let i;e[0]!==o?(i=C=>!C&&o(),e[0]=o,e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let l,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:n.jsx(ds,{size:18})}),u=n.jsx(ve,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);const V=s?.fileName;let d;e[6]!==V?(d=n.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,n.jsxs(ye,{className:"relative gap-4",children:[l,n.jsxs("div",{children:[u,n.jsxs(Rt,{className:"mt-1.5 text-sm leading-relaxed",children:[n.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=d):d=e[7];const m=s?.modelName;let f;e[8]!==m?(f=n.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Mo,{size:14,className:"text-muted-foreground"}),e[10]=y):y=e[10];const g=s?.accepted;let p;e[11]!==g?(p=n.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[y,n.jsx("span",{className:"capitalize",children:g})]}),e[11]=g,e[12]=p):p=e[12];let v;e[13]!==f||e[14]!==p?(v=n.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:n.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,p]})}),e[13]=f,e[14]=p,e[15]=v):v=e[15];let h;e[16]!==o?(h=n.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:n.jsx(Z,{onClick:o,children:"Got it"})}),e[16]=o,e[17]=h):h=e[17];let b;e[18]!==v||e[19]!==h||e[20]!==d?(b=n.jsxs(be,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Vl,children:[d,v,h]}),e[18]=v,e[19]=h,e[20]=d,e[21]=b):b=e[21];let S;return e[22]!==r||e[23]!==b||e[24]!==i?(S=n.jsx(xe,{open:r,onOpenChange:i,children:b}),e[22]=r,e[23]=b,e[24]=i,e[25]=S):S=e[25],S}function Vl(t){return t.preventDefault()}function ml(){const t=F.c(3),[e,s]=w.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>s(null),t[0]=o):o=t[0];let r;return t[1]!==e?(r={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:o},t[1]=e,t[2]=r):r=t[2],r}var fl=Er;var pl=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Vn=pl.join(","),Gs=typeof Element>"u",ut=Gs?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ct=!Gs&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Nt=function(e,s){var o;s===void 0&&(s=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),i=r===""||r==="true",a=i||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Nt(e.parentNode));return a},hl=function(e){var s,o=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return o===""||o==="true"},gl=function(e,s,o){if(Nt(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Vn));return s&&ut.call(e,Vn)&&r.unshift(e),r=r.filter(o),r},mn=function(e,s,o){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Nt(a,!1))if(a.tagName==="SLOT"){var c=a.assignedElements(),l=c.length?c:a.children,u=mn(l,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else{var V=ut.call(a,Vn);V&&o.filter(a)&&(s||!e.includes(a))&&r.push(a);var d=a.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(a),m=!Nt(d,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(d&&m){var f=mn(d===!0?a.children:d.children,!0,o);o.flatten?r.push.apply(r,f):r.push({scopeParent:a,candidates:f})}else i.unshift.apply(i,a.children)}}return r},Hs=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Qs=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||hl(e))&&!Hs(e)?0:e.tabIndex},xl=function(e,s){var o=Qs(e);return o<0&&s&&!Hs(e)?0:o},bl=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Js=function(e){return e.tagName==="INPUT"},yl=function(e){return Js(e)&&e.type==="hidden"},vl=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return s},wl=function(e,s){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===s)return e[o]},jl=function(e){if(!e.name)return!0;var s=e.form||Ct(e),o=function(c){return s.querySelectorAll('input[type="radio"][name="'+c+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=wl(r,e.form);return!i||i===e},Al=function(e){return Js(e)&&e.type==="radio"},Sl=function(e){return Al(e)&&!jl(e)},kl=function(e){var s,o=e&&Ct(e),r=(s=o)===null||s===void 0?void 0:s.host,i=!1;if(o&&o!==e){var a,c,l;for(i=!!((a=r)!==null&&a!==void 0&&(c=a.ownerDocument)!==null&&c!==void 0&&c.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&r;){var u,V,d;o=Ct(r),r=(u=o)===null||u===void 0?void 0:u.host,i=!!((V=r)!==null&&V!==void 0&&(d=V.ownerDocument)!==null&&d!==void 0&&d.contains(r))}}return i},Jn=function(e){var s=e.getBoundingClientRect(),o=s.width,r=s.height;return o===0&&r===0},_l=function(e,s){var o=s.displayCheck,r=s.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var a=ut.call(e,"details>summary:first-of-type"),c=a?e.parentElement:e;if(ut.call(c,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var u=e.parentElement,V=Ct(e);if(u&&!u.shadowRoot&&r(u)===!0)return Jn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=l}if(kl(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return Jn(e);return!1},Cl=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var o=0;o<s.children.length;o++){var r=s.children.item(o);if(r.tagName==="LEGEND")return ut.call(s,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}s=s.parentElement}return!1},Nl=function(e,s){return!(s.disabled||yl(s)||_l(s,e)||vl(s)||Cl(s))},Xn=function(e,s){return!(Sl(s)||Qs(s)<0||!Nl(e,s))},Il=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},Xs=function(e){var s=[],o=[];return e.forEach(function(r,i){var a=!!r.scopeParent,c=a?r.scopeParent:r,l=xl(c,a),u=a?Xs(r.candidates):c;l===0?a?s.push.apply(s,u):s.push(c):o.push({documentOrder:i,tabIndex:l,item:r,isScope:a,content:u})}),o.sort(bl).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(s)},Zs=function(e,s){s=s||{};var o;return s.getShadowRoot?o=mn([e],s.includeContainer,{filter:Xn.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:Il}):o=gl(e,s.includeContainer,Xn.bind(null,s)),Xs(o)};function Tl(){return/apple/i.test(navigator.vendor)}const Zn="data-floating-ui-focusable";function Rl(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function fn(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&ho(s)){let o=e;for(;o;){if(t===o)return!0;o=o.parentNode||o.host}}return!1}function Je(t){return"composedPath"in t?t.composedPath()[0]:t.target}function sn(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function Pl(t){return t.matches("html,body")}function Vt(t){return t?.ownerDocument||document}function El(t){return t?t.hasAttribute(Zn)?t:t.querySelector("["+Zn+"]")||t:null}function jt(t,e,s){return s===void 0&&(s=!0),t.filter(r=>{var i;return r.parentId===e&&(!s||((i=r.context)==null?void 0:i.open))}).flatMap(r=>[r,...jt(t,r.id,s)])}function Dl(t){return"nativeEvent"in t}var Ll=typeof document<"u",Ml=function(){},De=Ll?w.useLayoutEffect:Ml;const Fl={...us},Ul=Fl.useInsertionEffect,Ol=Ul||(t=>t());function Ge(t){const e=w.useRef(()=>{});return Ol(()=>{e.current=t}),w.useCallback(function(){for(var s=arguments.length,o=new Array(s),r=0;r<s;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const eo=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function to(t,e){const s=Zs(t,eo()),o=s.length;if(o===0)return;const r=Rl(Vt(t)),i=s.indexOf(r),a=i===-1?e===1?0:o-1:i+e;return s[a]}function $l(t){return to(Vt(t).body,1)||t}function zl(t){return to(Vt(t).body,-1)||t}function on(t,e){const s=e||t.currentTarget,o=t.relatedTarget;return!o||!fn(s,o)}function Bl(t){Zs(t,eo()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function es(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}const ql="data-floating-ui-focusable",ts="active",ns="selected",Kl={...us};let ss=!1,Yl=0;const os=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Yl++;function Wl(){const[t,e]=w.useState(()=>ss?os():void 0);return De(()=>{t==null&&e(os())},[]),w.useEffect(()=>{ss=!0},[]),t}const Gl=Kl.useId,Pn=Gl||Wl;function Hl(){const t=new Map;return{emit(e,s){var o;(o=t.get(e))==null||o.forEach(r=>r(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var o;(o=t.get(e))==null||o.delete(s)}}}const Ql=w.createContext(null),Jl=w.createContext(null),no=()=>{var t;return((t=w.useContext(Ql))==null?void 0:t.id)||null},so=()=>w.useContext(Jl);function En(t){return"data-floating-ui-"+t}const Xl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},rs=w.forwardRef(function(e,s){const[o,r]=w.useState();De(()=>{Tl()&&r("button")},[]);const i={ref:s,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[En("focus-guard")]:"",style:Xl};return n.jsx("span",{...e,...i})}),Zl={clipPath:"inset(50%)",position:"fixed",top:0,left:0},oo=w.createContext(null),is=En("portal");function ec(t){t===void 0&&(t={});const{id:e,root:s}=t,o=Pn(),r=nc(),[i,a]=w.useState(null),c=w.useRef(null);return De(()=>()=>{i?.remove(),queueMicrotask(()=>{c.current=null})},[i]),De(()=>{if(!o||c.current)return;const l=e?document.getElementById(e):null;if(!l)return;const u=document.createElement("div");u.id=o,u.setAttribute(is,""),l.appendChild(u),c.current=u,a(u)},[e,o]),De(()=>{if(s===null||!o||c.current)return;let l=s||r?.portalNode;l&&!wo(l)&&(l=l.current),l=l||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,l.appendChild(u));const V=document.createElement("div");V.id=o,V.setAttribute(is,""),l=u||l,l.appendChild(V),c.current=V,a(V)},[e,s,o,r]),i}function tc(t){const{children:e,id:s,root:o,preserveTabOrder:r=!0}=t,i=ec({id:s,root:o}),[a,c]=w.useState(null),l=w.useRef(null),u=w.useRef(null),V=w.useRef(null),d=w.useRef(null),m=a?.modal,f=a?.open,y=!!a&&!a.modal&&a.open&&r&&!!(o||i);return w.useEffect(()=>{if(!i||!r||m)return;function g(p){i&&on(p)&&(p.type==="focusin"?es:Bl)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,r,m]),w.useEffect(()=>{i&&(f||es(i))},[f,i]),n.jsxs(oo.Provider,{value:w.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:d,portalNode:i,setFocusManagerState:c}),[r,i]),children:[y&&i&&n.jsx(rs,{"data-type":"outside",ref:l,onFocus:g=>{if(on(g,i)){var p;(p=V.current)==null||p.focus()}else{const v=a?a.domReference:null,h=zl(v);h?.focus()}}}),y&&i&&n.jsx("span",{"aria-owns":i.id,style:Zl}),i&&ft.createPortal(e,i),y&&i&&n.jsx(rs,{"data-type":"outside",ref:u,onFocus:g=>{if(on(g,i)){var p;(p=d.current)==null||p.focus()}else{const v=a?a.domReference:null,h=$l(v);h?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const nc=()=>w.useContext(oo),sc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},oc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},as=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function rc(t,e){e===void 0&&(e={});const{open:s,onOpenChange:o,elements:r,dataRef:i}=t,{enabled:a=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:V=!1,referencePressEvent:d="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:y}=e,g=so(),p=Ge(typeof l=="function"?l:()=>!1),v=typeof l=="function"?p:l,h=w.useRef(!1),{escapeKey:b,outsidePress:S}=as(f),{escapeKey:C,outsidePress:_}=as(y),A=w.useRef(!1),x=Ge(k=>{var R;if(!s||!a||!c||k.key!=="Escape"||A.current)return;const L=(R=i.current.floatingContext)==null?void 0:R.nodeId,D=g?jt(g.nodesRef.current,L):[];if(!b&&(k.stopPropagation(),D.length>0)){let T=!0;if(D.forEach(U=>{var O;if((O=U.context)!=null&&O.open&&!U.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}o(!1,Dl(k)?k.nativeEvent:k,"escape-key")}),j=Ge(k=>{var R;const L=()=>{var D;x(k),(D=Je(k))==null||D.removeEventListener("keydown",L)};(R=Je(k))==null||R.addEventListener("keydown",L)}),P=Ge(k=>{var R;const L=i.current.insideReactTree;i.current.insideReactTree=!1;const D=h.current;if(h.current=!1,u==="click"&&D||L||typeof v=="function"&&!v(k))return;const T=Je(k),U="["+En("inert")+"]",O=Vt(r.floating).querySelectorAll(U);let $=ge(T)?T:null;for(;$&&!Jt($);){const G=bo($);if(Jt(G)||!ge(G))break;$=G}if(O.length&&ge(T)&&!Pl(T)&&!fn(T,r.floating)&&Array.from(O).every(G=>!fn($,G)))return;if(yo(T)&&N){const G=Jt(T),q=vo(T),Q=/auto|scroll/,H=G||Q.test(q.overflowX),X=G||Q.test(q.overflowY),ne=H&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,J=X&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,re=q.direction==="rtl",ee=J&&(re?k.offsetX<=T.offsetWidth-T.clientWidth:k.offsetX>T.clientWidth),ae=ne&&k.offsetY>T.clientHeight;if(ee||ae)return}const W=(R=i.current.floatingContext)==null?void 0:R.nodeId,M=g&&jt(g.nodesRef.current,W).some(G=>{var q;return sn(k,(q=G.context)==null?void 0:q.elements.floating)});if(sn(k,r.floating)||sn(k,r.domReference)||M)return;const Y=g?jt(g.nodesRef.current,W):[];if(Y.length>0){let G=!0;if(Y.forEach(q=>{var Q;if((Q=q.context)!=null&&Q.open&&!q.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}o(!1,k,"outside-press")}),E=Ge(k=>{var R;const L=()=>{var D;P(k),(D=Je(k))==null||D.removeEventListener(u,L)};(R=Je(k))==null||R.addEventListener(u,L)});w.useEffect(()=>{if(!s||!a)return;i.current.__escapeKeyBubbles=b,i.current.__outsidePressBubbles=S;let k=-1;function R(O){o(!1,O,"ancestor-scroll")}function L(){window.clearTimeout(k),A.current=!0}function D(){k=window.setTimeout(()=>{A.current=!1},xo()?5:0)}const T=Vt(r.floating);c&&(T.addEventListener("keydown",C?j:x,C),T.addEventListener("compositionstart",L),T.addEventListener("compositionend",D)),v&&T.addEventListener(u,_?E:P,_);let U=[];return m&&(ge(r.domReference)&&(U=Qt(r.domReference)),ge(r.floating)&&(U=U.concat(Qt(r.floating))),!ge(r.reference)&&r.reference&&r.reference.contextElement&&(U=U.concat(Qt(r.reference.contextElement)))),U=U.filter(O=>{var $;return O!==(($=T.defaultView)==null?void 0:$.visualViewport)}),U.forEach(O=>{O.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(T.removeEventListener("keydown",C?j:x,C),T.removeEventListener("compositionstart",L),T.removeEventListener("compositionend",D)),v&&T.removeEventListener(u,_?E:P,_),U.forEach(O=>{O.removeEventListener("scroll",R)}),window.clearTimeout(k)}},[i,r,c,v,u,s,o,m,a,b,S,x,C,j,P,_,E]),w.useEffect(()=>{i.current.insideReactTree=!1},[i,v,u]);const I=w.useMemo(()=>({onKeyDown:x,...V&&{[sc[d]]:k=>{o(!1,k.nativeEvent,"reference-press")},...d!=="click"&&{onClick(k){o(!1,k.nativeEvent,"reference-press")}}}}),[x,o,V,d]),N=w.useMemo(()=>{function k(R){R.button===0&&(h.current=!0)}return{onKeyDown:x,onMouseDown:k,onMouseUp:k,[oc[u]]:()=>{i.current.insideReactTree=!0}}},[x,u,i]);return w.useMemo(()=>a?{reference:I,floating:N}:{},[a,I,N])}function ic(t){const{open:e=!1,onOpenChange:s,elements:o}=t,r=Pn(),i=w.useRef({}),[a]=w.useState(()=>Hl()),c=no()!=null,[l,u]=w.useState(o.reference),V=Ge((f,y,g)=>{i.current.openEvent=f?y:void 0,a.emit("openchange",{open:f,event:y,reason:g,nested:c}),s?.(f,y,g)}),d=w.useMemo(()=>({setPositionReference:u}),[]),m=w.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return w.useMemo(()=>({dataRef:i,open:e,onOpenChange:V,elements:m,events:a,floatingId:r,refs:d}),[e,V,m,a,r,d])}function ac(t){t===void 0&&(t={});const{nodeId:e}=t,s=ic({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||s,r=o.elements,[i,a]=w.useState(null),[c,l]=w.useState(null),V=r?.domReference||i,d=w.useRef(null),m=so();De(()=>{V&&(d.current=V)},[V]);const f=go({...t,elements:{...r,...c&&{reference:c}}}),y=w.useCallback(b=>{const S=ge(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;l(S),f.refs.setReference(S)},[f.refs]),g=w.useCallback(b=>{(ge(b)||b===null)&&(d.current=b,a(b)),(ge(f.refs.reference.current)||f.refs.reference.current===null||b!==null&&!ge(b))&&f.refs.setReference(b)},[f.refs]),p=w.useMemo(()=>({...f.refs,setReference:g,setPositionReference:y,domReference:d}),[f.refs,g,y]),v=w.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),h=w.useMemo(()=>({...f,...o,refs:p,elements:v,nodeId:e}),[f,p,v,e,o]);return De(()=>{o.dataRef.current.floatingContext=h;const b=m?.nodesRef.current.find(S=>S.id===e);b&&(b.context=h)}),w.useMemo(()=>({...f,context:h,refs:p,elements:v}),[f,p,v,h])}function rn(t,e,s){const o=new Map,r=s==="item";let i=t;if(r&&t){const{[ts]:a,[ns]:c,...l}=t;i=l}return{...s==="floating"&&{tabIndex:-1,[ql]:""},...i,...e.map(a=>{const c=a?a[s]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((a,c)=>(c&&Object.entries(c).forEach(l=>{let[u,V]=l;if(!(r&&[ts,ns].includes(u)))if(u.indexOf("on")===0){if(o.has(u)||o.set(u,[]),typeof V=="function"){var d;(d=o.get(u))==null||d.push(V),a[u]=function(){for(var m,f=arguments.length,y=new Array(f),g=0;g<f;g++)y[g]=arguments[g];return(m=o.get(u))==null?void 0:m.map(p=>p(...y)).find(p=>p!==void 0)}}}else a[u]=V}),a),{})}}function lc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),s=t.map(c=>c?.floating),o=t.map(c=>c?.item),r=w.useCallback(c=>rn(c,t,"reference"),e),i=w.useCallback(c=>rn(c,t,"floating"),s),a=w.useCallback(c=>rn(c,t,"item"),o);return w.useMemo(()=>({getReferenceProps:r,getFloatingProps:i,getItemProps:a}),[r,i,a])}const cc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function dc(t,e){var s,o;e===void 0&&(e={});const{open:r,elements:i,floatingId:a}=t,{enabled:c=!0,role:l="dialog"}=e,u=Pn(),V=((s=i.domReference)==null?void 0:s.id)||u,d=w.useMemo(()=>{var h;return((h=El(i.floating))==null?void 0:h.id)||a},[i.floating,a]),m=(o=cc.get(l))!=null?o:l,y=no()!=null,g=w.useMemo(()=>m==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?d:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":r?d:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[m,d,y,r,V,l]),p=w.useMemo(()=>{const h={id:d,...m&&{role:m}};return m==="tooltip"||l==="label"?h:{...h,...m==="menu"&&{"aria-labelledby":V}}},[m,d,V,l]),v=w.useCallback(h=>{let{active:b,selected:S}=h;const C={role:"option",...b&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...C,"aria-selected":S}}return{}},[d,l]);return w.useMemo(()=>c?{reference:g,floating:p,item:v}:{},[c,g,p,v])}function uc(t){const e=F.c(24),{editor:s,query:o,items:r,onSelect:i,onClose:a}=t,[c,l]=w.useState(0),u=w.useRef(r),V=w.useRef(c),d=w.useRef(i),m=w.useRef(a),f=w.useDeferredValue(o);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{l(0)},e[0]=y):y=e[0];let g;e[1]!==f?(g=[f],e[1]=f,e[2]=g):g=e[2],w.useEffect(y,g);let p,v;e[3]!==r.length||e[4]!==c?(p=()=>{c>=r.length&&r.length>0&&l(0)},v=[r.length,c],e[3]=r.length,e[4]=c,e[5]=p,e[6]=v):(p=e[5],v=e[6]),w.useEffect(p,v);let h,b;e[7]!==r?(h=()=>{u.current=r},b=[r],e[7]=r,e[8]=h,e[9]=b):(h=e[8],b=e[9]),w.useEffect(h,b);let S,C;e[10]!==c?(S=()=>{V.current=c},C=[c],e[10]=c,e[11]=S,e[12]=C):(S=e[11],C=e[12]),w.useEffect(S,C);let _,A;e[13]!==i?(A=()=>{d.current=i},_=[i],e[13]=i,e[14]=_,e[15]=A):(_=e[14],A=e[15]),w.useEffect(A,_);let x,j;e[16]!==a?(x=()=>{m.current=a},j=[a],e[16]=a,e[17]=x,e[18]=j):(x=e[17],j=e[18]),w.useEffect(x,j);let P,E;e[19]!==s?(P=()=>{if(s?.isDestroyed)return;let k;try{k=s.view.dom}catch{return}if(!k)return;const R=D=>{const T=u.current;if(!T.length)return!1;const U=()=>l($=>($+1)%T.length),O=()=>l($=>($-1+T.length)%T.length);switch(D.key){case"ArrowUp":return D.preventDefault(),O(),!0;case"ArrowDown":return D.preventDefault(),U(),!0;case"Tab":return D.preventDefault(),D.shiftKey?O():U(),!0;case"Home":return D.preventDefault(),l(0),!0;case"End":return D.preventDefault(),l(T.length-1),!0;case"Enter":{if(D.isComposing)return!1;D.preventDefault();const $=V.current;return $!==-1&&T[$]&&d.current?.(T[$],$),!0}case"Escape":return D.preventDefault(),m.current?.(),!0;default:return!1}},L=D=>{R(D)};return k.addEventListener("keydown",L,!0),()=>{k?.removeEventListener("keydown",L,!0)}},E=[s],e[19]=s,e[20]=P,e[21]=E):(P=e[20],E=e[21]),w.useEffect(P,E);const I=r.length?c:void 0;let N;return e[22]!==I?(N={selectedIndex:I,setSelectedIndex:l},e[22]=I,e[23]=N):N=e[23],N}function Vc(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const ro=w.createContext(void 0);function io(){const t=w.useContext(ro);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function mc({editor:t,char:e,pluginKey:s,allow:o,onOpenChange:r}){const[i,a]=w.useReducer(Vc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=w.useRef(r);return c.current=r,w.useEffect(()=>{if(t?.isDestroyed)return;const l=s instanceof cn?s:new cn(s);t.state.plugins.find(d=>d.spec.key===l)&&t.unregisterPlugin(l);const V=Ur({pluginKey:l,editor:t,char:e,allow(d){const m=t.state.doc.resolve(d.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(o&&!o(d))},command(){},render:()=>({onStart:d=>{a({type:"ON_START",payload:{element:d.decorationNode??null,query:d.query,range:d.range}}),c.current?.(!0)},onUpdate:d=>{a({type:"ON_UPDATE",payload:{element:d.decorationNode??null,query:d.query,range:d.range}})},onKeyDown:d=>d.event.key==="Escape"?(a({type:"ON_EXIT"}),!0):!1,onExit:()=>{a({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(l)}},[t,s,e,a,o]),{state:i,dispatch:a}}function fc({editor:t,queryKey:e,queryFn:s,onSelect:o}){const{state:r,dispatch:i}=io(),a=w.useDeferredValue(r.query),{data:c}=jo({queryKey:me.suggestionItems(e,r.open,a),queryFn:()=>r.open?s({query:a}):[]}),l=()=>{i({type:"ON_EXIT"})},u=async(d,m)=>{if(!(r.selectedItem!==null||!r.range)){i({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,g=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),p=r.range?{...r.range}:{from:0,to:0};g&&r.range&&(p.to+=1),await o({range:p,item:d})===!1?i({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:V}=uc({editor:t,query:a,items:c,onSelect:u,onClose:l});return{selectedItem:r.selectedItem,items:c,selectedIndex:V,close:l,onSelect:u}}function pc({children:t}){const{state:e,dispatch:s}=io(),{open:o,element:r}=e,i=()=>{s({type:"ON_EXIT"})},{refs:a,floatingStyles:c,context:l}=ac({placement:"bottom-start",open:o,onOpenChange:m=>{m||i()},elements:{reference:r},middleware:[Ao(10),So(),ko()],whileElementsMounted:_o}),u=rc(l,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=dc(l,{role:"listbox"}),{getFloatingProps:d}=lc([u,V]);return o?n.jsx(tc,{children:n.jsx("div",{ref:a.setFloating,style:c,...d(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const hc=t=>{const e=F.c(29),{item:s,isSelected:o,onSelect:r,isLoading:i,ref:a}=t;let c;if(e[0]!==s){const _=Ce(s._meta);c=s.title||Ot(s.name,_),e[0]=s,e[1]=c}else c=e[1];const l=c,u=s.description||null,V=s.icon,d=o&&"bg-accent text-accent-foreground",m=i&&"pointer-events-none opacity-50";let f;e[2]!==d||e[3]!==m?(f=K("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",d,m),e[2]=d,e[3]=m,e[4]=f):f=e[4];let y;e[5]!==V||e[6]!==l?(y=V!==void 0&&n.jsx(Sn,{icon:V,name:l,size:"xs",className:"mr-2"}),e[5]=V,e[6]=l,e[7]=y):y=e[7];let g;e[8]!==l?(g=n.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:l}),e[8]=l,e[9]=g):g=e[9];let p;e[10]!==i?(p=i&&n.jsx(At,{size:"xs"}),e[10]=i,e[11]=p):p=e[11];let v;e[12]!==g||e[13]!==p?(v=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,p]}),e[12]=g,e[13]=p,e[14]=v):v=e[14];let h;e[15]!==u?(h=u&&n.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=h):h=e[16];let b;e[17]!==v||e[18]!==h?(b=n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[v,h]}),e[17]=v,e[18]=h,e[19]=b):b=e[19];let S;e[20]!==s.drillable?(S=s.drillable&&n.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=S):S=e[21];let C;return e[22]!==r||e[23]!==a||e[24]!==b||e[25]!==S||e[26]!==f||e[27]!==y?(C=n.jsxs("div",{ref:a,onClick:r,className:f,children:[y,b,S]}),e[22]=r,e[23]=a,e[24]=b,e[25]=S,e[26]=f,e[27]=y,e[28]=C):C=e[28],C},gc=t=>{const e=F.c(18),{editor:s,queryKey:o,queryFn:r,onSelect:i}=t;let a;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==o?(a={editor:s,queryKey:o,queryFn:r,onSelect:i},e[0]=s,e[1]=i,e[2]=r,e[3]=o,e[4]=a):a=e[4];const{items:c,selectedIndex:l,onSelect:u,selectedItem:V}=fc(a);if(!c.length){let y;return e[5]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=y):y=e[5],y}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=d):d=e[6];let m;if(e[7]!==u||e[8]!==c||e[9]!==l||e[10]!==V?.name){let y;e[12]!==u||e[13]!==l||e[14]!==V?.name?(y=(g,p)=>n.jsx(hc,{item:g,isSelected:p===l,ref:p===l?yc:void 0,onSelect:()=>u(g,p),isLoading:V?.name===g.name},g.name),e[12]=u,e[13]=l,e[14]=V?.name,e[15]=y):y=e[15],m=c.map(y),e[7]=u,e[8]=c,e[9]=l,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=n.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:d,children:n.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function xc(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"p-1",children:[...Array(3)].map(bc)}),t[0]=e):e=t[0],e}function bc(t,e){return n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[n.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),n.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function ao(t){const e=F.c(18),{editor:s,char:o,pluginKey:r,queryKey:i,queryFn:a,onSelect:c,allow:l,onOpenChange:u}=t;let V;e[0]!==l||e[1]!==o||e[2]!==s||e[3]!==u||e[4]!==r?(V={editor:s,char:o,pluginKey:r,allow:l,onOpenChange:u},e[0]=l,e[1]=o,e[2]=s,e[3]=u,e[4]=r,e[5]=V):V=e[5];const{state:d,dispatch:m}=mc(V);let f;e[6]!==m||e[7]!==d?(f={state:d,dispatch:m},e[6]=m,e[7]=d,e[8]=f):f=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(xc,{}),e[9]=y):y=e[9];let g;e[10]!==s||e[11]!==c||e[12]!==a||e[13]!==i?(g=n.jsx(pc,{children:n.jsx(w.Suspense,{fallback:y,children:n.jsx(gc,{editor:s,queryKey:i,queryFn:a,onSelect:c})})}),e[10]=s,e[11]=c,e[12]=a,e[13]=i,e[14]=g):g=e[14];let p;return e[15]!==f||e[16]!==g?(p=n.jsx(ro.Provider,{value:f,children:g}),e[15]=f,e[16]=g,e[17]=p):p=e[17],p}function yc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const vc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],wc=({editor:t,virtualMcpId:e})=>{const s=mt(),{org:o}=ie(),r=tr(),i=je({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=me.virtualMcpResources(e,o.id),[c,l]=w.useState("categories"),u=w.useRef(c);u.current=c;const V=w.useRef(null),d=w.useRef(!1),m=["at-mention",o.id,e??"default",c],f=async({item:p,range:v})=>{if(z("chat_picker_item_selected",{picker:"@",item_kind:p.kind,item_name:p.name}),p.kind!=="category"&&(d.current=!0),p.kind==="category")return l(p.name==="agents"?"agents":"resources"),!1;if(p.kind==="agent"&&p.agentId){lt(t,v,{id:p.agentId,name:p.name,metadata:{agentId:p.agentId,title:p.name},char:"@"}),l("categories");return}if(p.kind==="resource"&&p.uri&&i){try{const h=await Ls(i,p.uri);lt(t,v,{id:p.uri,name:p.uri,metadata:h.contents,char:"@"})}catch(h){console.error("[at-mention] Failed to fetch resource:",h),oe.error("Failed to load resource. Please try again.")}l("categories");return}},y=async p=>{const{query:v}=p,h=u.current;if(h==="categories"){if(!v.trim())return vc;const C=v.toLowerCase(),_=r.filter(x=>x.status==="active"&&(!x.id||!Ln(x.id))&&x.id!==e&&(x.title.toLowerCase().includes(C)||x.description?.toLowerCase().includes(C))).map(x=>({name:x.title,title:x.title,description:x.description??void 0,icon:x.icon??null,kind:"agent",agentId:x.id})),A=await(async()=>{if(!i)return[];let x=s.getQueryData(a);return x||(x=await s.fetchQuery({queryKey:a,queryFn:()=>at(i),staleTime:6e4})),(x?.resources??[]).filter(j=>j.uri.toLowerCase().includes(C)||j.name?.toLowerCase().includes(C)||j.description?.toLowerCase().includes(C)).map(j=>({name:j.name??j.uri,title:j.name,description:j.description,kind:"resource",uri:j.uri}))})();return[..._,...A]}if(h==="agents"){let C=r.filter(_=>_.status==="active"&&(!_.id||!Ln(_.id))&&_.id!==e);if(v.trim()){const _=v.toLowerCase();C=C.filter(A=>A.title.toLowerCase().includes(_)||A.description?.toLowerCase().includes(_))}return C.map(_=>({name:_.title,title:_.title,description:_.description??void 0,icon:_.icon??null,kind:"agent",agentId:_.id}))}if(!i)return[];let b=s.getQueryData(a);b?s.fetchQuery({queryKey:a,queryFn:()=>at(i),staleTime:6e4}).catch(()=>{}):b=await s.fetchQuery({queryKey:a,queryFn:()=>at(i),staleTime:6e4});let S=b?.resources??[];if(v.trim()){const C=v.toLowerCase();S=S.filter(_=>_.uri.toLowerCase().includes(C)||_.name?.toLowerCase().includes(C)||_.description?.toLowerCase().includes(C))}return S.map(C=>({name:C.name??C.uri,title:C.name,description:C.description,kind:"resource",uri:C.uri}))},g=p=>{if(p)V.current=Date.now(),d.current=!1,z("chat_picker_opened",{picker:"@"});else{const v=V.current;z("chat_picker_closed",{picker:"@",outcome:d.current?"selected":"dismissed",duration_ms:v?Date.now()-v:null}),V.current=null,l("categories")}};return n.jsx(ao,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:y,onSelect:f,onOpenChange:g})};function jc(t,e,s){const o=nr(t),r=No(),i=new Map(r.map(u=>[u.id,u])),a=(o?.connections??[]).map(u=>u.connection_id),{data:c}=vn({queryKey:me.promptConnectionMap(e,a),queryFn:async()=>{const u={};return await Promise.all(a.map(async V=>{try{const d=await Io({connectionId:V,orgId:e,orgSlug:s}),m=await St(d);for(const f of m.prompts)f.name in u||(u[f.name]=V)}catch{}})),u},staleTime:6e4,enabled:a.length>0}),l=new Map;for(const[u,V]of Object.entries(c??{})){const d=i.get(V);d&&l.set(u,d)}return l}async function ls(t,e,s,o,r,i){try{const a=await Cn(s,o,i);lt(t,e,{id:o,name:_n(o,r),metadata:a.messages,char:"/"})}catch(a){console.error("[slash] Failed to fetch prompt:",a),oe.error("Failed to load prompt. Please try again.")}}async function Ac(t,e,s,o){try{const r=await Ls(s,o);lt(t,e,{id:o,name:o,metadata:r.contents,char:"/"})}catch(r){console.error("[slash] Failed to fetch resource:",r),oe.error("Failed to load resource. Please try again.")}}const Sc=({editor:t,virtualMcpId:e})=>{const s=mt(),{org:o}=ie(),r=je({connectionId:e,orgId:o.id,orgSlug:o.slug}),i=jc(e,o.id,o.slug),a=w.useRef(i);a.current=i;const c=me.virtualMcpPrompts(e,o.id),l=me.virtualMcpResources(e,o.id),u=["slash-mention",o.id,e??"default"],[V,d]=w.useState(null),m=w.useRef(null),f=w.useRef(!1),y=async({item:h,range:b})=>{if(z("chat_picker_item_selected",{picker:"/",item_kind:h.kind,item_name:h.name}),f.current=!0,!!r)if(h.kind==="prompt"){if(h.arguments&&h.arguments.length>0){d({range:b,item:h});return}const S=Ce(h._meta);await ls(t,b,r,h.name,S)}else h.uri&&await Ac(t,b,r,h.uri)},g=async h=>{if(!V||!r)return;const{range:b,item:S}=V,C=Ce(S._meta);await ls(t,b,r,S.name,C,h),d(null)},p=async h=>{const{query:b}=h;if(!r)return[];const[S,C]=await Promise.all([kc(s,c,r),_c(s,l,r)]),_=b.trim().toLowerCase(),A=(S??[]).filter(j=>!_||j.name.toLowerCase().includes(_)||j.title?.toLowerCase().includes(_)||j.description?.toLowerCase().includes(_)).map(j=>({name:j.name,title:j.title,description:j.description,icon:a.current.get(j.name)?.icon??null,kind:"prompt",arguments:j.arguments,_meta:j._meta})),x=(C??[]).filter(j=>!_||j.uri.toLowerCase().includes(_)||j.name?.toLowerCase().includes(_)||j.description?.toLowerCase().includes(_)).map(j=>({name:j.name??j.uri,title:j.name,description:j.description,kind:"resource",uri:j.uri}));return[...A,...x]},v=V?.item.kind==="prompt"?{name:V.item.name,arguments:V.item.arguments,description:V.item.description}:null;return n.jsxs(n.Fragment,{children:[n.jsx(ao,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:p,onSelect:y,onOpenChange:h=>{if(h)m.current=Date.now(),f.current=!1,z("chat_picker_opened",{picker:"/"});else{const b=m.current;z("chat_picker_closed",{picker:"/",outcome:f.current?"selected":"dismissed",duration_ms:b?Date.now()-b:null}),m.current=null}}}),n.jsx(Tn,{prompt:v,setPrompt:()=>d(null),onSubmit:g})]})};async function kc(t,e,s){let o=t.getQueryData(e);return o?t.fetchQuery({queryKey:e,queryFn:()=>St(s),staleTime:6e4}).catch(()=>{}):o=await t.fetchQuery({queryKey:e,queryFn:()=>St(s),staleTime:6e4}),o?.prompts??[]}async function _c(t,e,s){let o=t.getQueryData(e);return o?t.fetchQuery({queryKey:e,queryFn:()=>at(s),staleTime:6e4}).catch(()=>{}):o=await t.fetchQuery({queryKey:e,queryFn:()=>at(s),staleTime:6e4}),o?.resources??[]}function Cc(t){return[Mr.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),fl.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),ur,Vr]}function Nc({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:o=!1,placeholder:r,onSubmit:i,children:a}){const c=w.useRef(i),l=w.useRef(e),u=w.useRef(o),V=w.useRef(r),d=Dr({extensions:Cc(V),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&u.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{l.current(m?.getJSON())}});return w.useEffect(()=>{d?.setEditable(!s)},[d,s]),w.useEffect(()=>{c.current=i},[i]),w.useEffect(()=>{l.current=e},[e]),w.useEffect(()=>{u.current=o},[o]),w.useEffect(()=>{V.current=r},[r]),w.useEffect(()=>{if(d?.isDestroyed)return;const m=JSON.stringify(d?.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&d.commands.setContent(t||{type:"doc",content:[]})},[d,t]),n.jsx(Lr.Provider,{value:{editor:d},children:a})}function Ic(t){const e=F.c(26),{disabled:s,virtualMcpId:o,showFileUploader:r,selectedModel:i,onUnsupportedFile:a,ref:c,className:l}=t,u=s===void 0?!1:s,V=r===void 0?!1:r,{editor:d}=Nn();let m,f;if(e[0]!==d?(m=()=>({focus:()=>{d?.commands.focus()},clear:()=>{d?.commands.clearContent(!0)},appendText:x=>{if(!d)return;const j=d.state.doc.textContent.trim()==="";d.commands.focus("end"),j||d.commands.insertContent(" "),d.commands.insertContent(x)},syncVoiceText:(x,j)=>{if(d&&(d.commands.setContent(x||{type:"doc",content:[]}),j)){d.commands.focus("end");const P=d.state.doc.textContent.trim().length>0;d.commands.insertContent(P?" "+j:j)}},restoreContent:x=>{d&&d.commands.setContent(x||{type:"doc",content:[]})}}),f=[d],e[0]=d,e[1]=m,e[2]=f):(m=e[1],f=e[2]),w.useImperativeHandle(c??null,m,f),!d)return null;const y=u&&"cursor-not-allowed opacity-70",g=u&&"[&_.ProseMirror]:cursor-not-allowed";let p;e[3]!==l||e[4]!==y||e[5]!==g?(p=K("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",l,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",y,g),e[3]=l,e[4]=y,e[5]=g,e[6]=p):p=e[6];let v;e[7]!==d||e[8]!==p?(v=n.jsx(Fr,{editor:d,className:p}),e[7]=d,e[8]=p,e[9]=v):v=e[9];const h=o??null;let b;e[10]!==d||e[11]!==h?(b=n.jsx(w.Suspense,{fallback:null,children:n.jsx(Sc,{editor:d,virtualMcpId:h})}),e[10]=d,e[11]=h,e[12]=b):b=e[12];const S=o??null;let C;e[13]!==d||e[14]!==S?(C=n.jsx(w.Suspense,{fallback:null,children:n.jsx(wc,{editor:d,virtualMcpId:S})}),e[13]=d,e[14]=S,e[15]=C):C=e[15];let _;e[16]!==d||e[17]!==a||e[18]!==i||e[19]!==V?(_=V&&i?n.jsx(ll,{editor:d,selectedModel:i,onUnsupportedFile:a}):null,e[16]=d,e[17]=a,e[18]=i,e[19]=V,e[20]=_):_=e[20];let A;return e[21]!==b||e[22]!==C||e[23]!==_||e[24]!==v?(A=n.jsxs(n.Fragment,{children:[v,b,C,_]}),e[21]=b,e[22]=C,e[23]=_,e[24]=v,e[25]=A):A=e[25],A}function pn(t){const e=F.c(3),[s]=Tt();let o;return e[0]!==s.enableSounds||e[1]!==t?(o=()=>{s.enableSounds&&Or(t.dataUri).catch(i=>{console.warn(`[sound] ${t.name} playback failed:`,i)})},e[0]=s.enableSounds,e[1]=t,e[2]=o):o=e[2],o}const Tc={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},Rc=sr.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),Pc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Ec(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1.5",children:Pc.map(Dc)}),t[0]=e):e=t[0],e}function Dc(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function Lc({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:o,isStreaming:r,onUnsupportedFile:i}){const[a,c]=w.useState(!1),l=pn(Tc),{org:u}=ie(),{editor:V}=Nn(),d=w.useRef(null),m=$t(o),f=()=>{!m||r||(c(!1),d.current?.click())},y=async M=>{const Y=M.target.files;if(!Y||Y.length===0||!V)return;const G=Array.from(Y),{from:q}=V.state.selection;try{for(const Q of G)await Rn(V,o??null,Q,q,i)}finally{d.current&&(d.current.value="")}},g=je({connectionId:s,orgId:u.id,orgSlug:u.slug}),p=me.virtualMcpPrompts(s,u.id),{data:v,isLoading:h}=vn({queryKey:p,queryFn:()=>St(g),staleTime:6e4,enabled:a&&!!g}),b=v?.prompts??[],[S,C]=w.useState(null),{chatMode:_,setChatMode:A}=Pt(),[x,j]=Tt(),E=(Xe.find(M=>M.value===x.toolApprovalLevel)??Xe[0]).short,I=M=>{const Y=Xe.find(G=>G.value===M);if(Y){if(Y.value===x.toolApprovalLevel){c(!1);return}l(),z("chat_approval_level_changed",{from_level:x.toolApprovalLevel,to_level:Y.value,source:"tools_popover"}),j({...x,toolApprovalLevel:Y.value}),c(!1)}},N=_==="plan",k=()=>{l();const M=N?"default":"plan";z("chat_mode_changed",{from_mode:_,to_mode:M,source:"tools_popover"}),A(M),c(!1)},R=()=>{e(),c(!1)},L=async(M,Y)=>{if(!V||!g)return;const G=Ce(M._meta),q={from:V.state.selection.from,to:V.state.selection.to};try{const Q=await Cn(g,M.name,Y);lt(V,q,{id:M.name,name:_n(M.name,G),metadata:Q.messages,char:"/"})}catch{oe.error("Failed to load prompt. Please try again.")}},D=async M=>{c(!1);const Y=!!(M.arguments&&M.arguments.length>0);if(z("chat_prompt_inserted",{prompt_name:M.name,with_arguments:Y}),Y){C(M);return}await L(M)},T=async M=>{S&&(await L(S,M),C(null))},U=()=>{l();const M=_==="gen-image"?"default":"gen-image";z("chat_mode_changed",{from_mode:_,to_mode:M,source:"tools_popover"}),A(M),c(!1)},O=()=>{l();const M=_==="web-search"?"default":"web-search";z("chat_mode_changed",{from_mode:_,to_mode:M,source:"tools_popover"}),A(M),c(!1)},$=_==="gen-image",W=_==="web-search";return n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:d,type:"file",multiple:!0,accept:Nr(o??null),className:"hidden",onChange:y,disabled:r}),n.jsxs(Ds,{open:a,onOpenChange:M=>{M&&!a&&z("chat_tools_popover_opened",{chat_mode:_}),c(M)},children:[n.jsx(Ps,{asChild:!0,children:n.jsxs(Z,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:"text-muted-foreground hover:text-foreground",children:[n.jsx(Fo,{size:14}),n.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[496px]/chat-bottom:max-w-24 @[496px]/chat-bottom:opacity-100",children:"Tools"})]})}),n.jsxs(Es,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?n.jsxs(_e,{onClick:f,disabled:r,children:[n.jsx(dn,{size:16}),n.jsx("span",{className:"flex-1",children:"Add file"})]}):n.jsxs(st,{children:[n.jsx(ot,{asChild:!0,children:n.jsxs(_e,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:M=>M.preventDefault(),children:[n.jsx(dn,{size:16}),n.jsx("span",{className:"flex-1",children:"Add file"})]})}),n.jsx(rt,{side:"right",children:"The selected model does not support reading files or images."})]}),n.jsxs(_e,{onClick:k,className:K(N&&"text-violet-600 dark:text-violet-400"),children:[n.jsx(ys,{size:16,className:K(N&&"text-violet-500")}),n.jsx("span",{className:"flex-1",children:"Plan mode"}),n.jsx("span",{className:K("text-xs text-muted-foreground",N&&"text-violet-500 font-medium"),children:Rc})]}),n.jsxs(_e,{onClick:U,className:K($&&"text-pink-600 dark:text-pink-400"),children:[n.jsx(js,{size:16,className:K($&&"text-pink-500")}),n.jsx("span",{className:"flex-1",children:"Create image"}),$&&n.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),n.jsxs(_e,{onClick:O,className:K(W&&"text-blue-600 dark:text-blue-400"),children:[n.jsx(it,{size:16,className:K(W&&"text-blue-500")}),n.jsx("span",{className:"flex-1",children:"Web search"}),W&&n.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),n.jsxs(Fn,{children:[n.jsxs(Un,{className:"gap-2",children:[n.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),n.jsx("span",{className:"flex-1",children:"Prompts"})]}),n.jsx(On,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:h?n.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[n.jsx(nt,{size:14,className:"animate-spin"}),"Loading prompts…"]}):b.length===0?n.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):b.map(M=>n.jsxs(_e,{onClick:()=>D(M),className:"flex flex-col items-start gap-0.5",children:[n.jsx("span",{className:"font-medium text-sm capitalize",children:M.title||Ot(M.name,Ce(M._meta))}),M.description&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]},M.name))})]}),n.jsxs(Fn,{children:[n.jsxs(Un,{className:"gap-2",children:[n.jsx(kn,{size:16}),n.jsx("span",{className:"flex-1",children:"Approval"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:E})]}),n.jsx(On,{className:"w-48 p-1.5",children:n.jsx(Tr,{value:x.toolApprovalLevel,onValueChange:I,children:Xe.map(M=>n.jsx(Rr,{value:M.value,children:M.label},M.value))})})]}),n.jsxs(_e,{onClick:R,children:[n.jsx(Sr,{size:16}),n.jsx("span",{className:"flex-1",children:"Connections"}),n.jsx(w.Suspense,{children:n.jsx(Ec,{})})]})]})]}),n.jsx(Tn,{prompt:S,setPrompt:C,onSubmit:T})]})}const Mc=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function Fc(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1",children:Mc.map(Uc)}),t[0]=e):e=t[0],e}function Uc(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Oc(t){const e=F.c(6),{onClick:s}=t;let o,r,i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=K("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),r=n.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),i=n.jsx(Fc,{}),a=n.jsx(vs,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=o,e[1]=r,e[2]=i,e[3]=a):(o=e[0],r=e[1],i=e[2],a=e[3]);let c;return e[4]!==s?(c=n.jsxs("button",{type:"button",onClick:s,className:o,children:[r,i,a]}),e[4]=s,e[5]=c):c=e[5],c}const tt=48;function $c(){const t=F.c(9),[e,s]=w.useState("idle"),[o,r]=w.useState(""),[i,a]=w.useState(""),[c,l]=w.useState(qc),u=w.useRef(null),V=w.useRef(null),d=w.useRef(null),m=w.useRef(null),f=w.useRef(0),y=w.useRef(!1),g=w.useRef(""),p=w.useRef(""),v=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(Bc),m.current?.getTracks().forEach(zc),d.current=null,V.current=null,m.current=null},t[0]=h):h=t[0];const b=h;let S;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const E=I=>{m.current=I;const N=new AudioContext;V.current=N;const k=N.createMediaStreamSource(I),R=N.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,k.connect(R),d.current=R;const L=new Uint8Array(R.frequencyBinCount),D=()=>{if(!d.current)return;d.current.getByteFrequencyData(L);const T=[];for(let U=0;U<tt;U++){const O=Math.floor(U/tt*L.length);T.push(Math.max(.04,(L[O]??0)/255))}l(T),f.current=requestAnimationFrame(D)};D()};S=async()=>{const I=window.SpeechRecognition||window.webkitSpeechRecognition;if(!I){s("unsupported");return}let N;try{N=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{s("permission-denied");return}r(""),a(""),p.current="",g.current="",y.current=!0,s("recording"),E(N);const k=new I;u.current=k,k.interimResults=!0,k.continuous=!0,k.lang=navigator.language||"en-US",k.onresult=R=>{let L="",D="";for(let T=R.resultIndex;T<R.results.length;T++){const U=R.results[T],O=U?.[0]?.transcript??"";U?.isFinal?D=D+O:L=L+O}D&&(g.current=g.current+D,r(g.current)),p.current=L,a(L)},k.onend=()=>{if(y.current)try{k.start()}catch{}};try{k.start()}catch{s("idle")}},t[1]=S}else S=t[1];const C=S;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{y.current=!1,u.current?.stop(),b(),s("idle"),l(Array(tt).fill(.05)),a("");const E=(g.current+(p.current?" "+p.current:"")).trim();return r(""),g.current="",p.current="",E},t[2]=_):_=t[2];const A=_;let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{y.current=!1,u.current?.abort(),b(),s("idle"),r(""),a(""),l(Array(tt).fill(.05)),g.current="",p.current=""},t[3]=x):x=t[3];const j=x;let P;return t[4]!==i||t[5]!==e||t[6]!==o||t[7]!==c?(P={status:e,transcript:o,interimTranscript:i,waveformData:c,isSupported:v,startRecording:C,stopRecording:A,cancelRecording:j},t[4]=i,t[5]=e,t[6]=o,t[7]=c,t[8]=P):P=t[8],P}function zc(t){return t.stop()}function Bc(){}function qc(){return Array(tt).fill(.05)}function Kc(t){const e=F.c(4),{data:s}=t;let o;e[0]!==s?(o=s.map(Yc),e[0]=s,e[1]=o):o=e[1];let r;return e[2]!==o?(r=n.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:o}),e[2]=o,e[3]=r):r=e[3],r}function Yc(t,e){return n.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function Wc(t,e){const s=F.c(5),{editor:o}=Nn(),[r,i]=w.useState(!1),a=w.useRef(0);let c,l;return s[0]!==o||s[1]!==e||s[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),a.current=a.current+1,i(!0))},V=f=>{f.preventDefault(),a.current=Math.max(0,a.current-1),a.current===0&&i(!1)},d=Gc,m=f=>{if(f.preventDefault(),a.current=0,i(!1),!o||!t||!$t(t))return;const y=f.dataTransfer?.files;if(!y||y.length===0)return;const{from:g}=o.state.selection;for(const p of Array.from(y))Rn(o,t,p,g,e)};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",V),window.addEventListener("dragover",d),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",d),window.removeEventListener("drop",m)}},l=[o,t,e],s[0]=o,s[1]=e,s[2]=t,s[3]=c,s[4]=l):(c=s[3],l=s[4]),w.useEffect(c,l),r}function Gc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Hc(t){const e=F.c(11),{selectedModel:s,onUnsupportedFile:o}=t,r=Wc(s,o);let i;e[0]!==s?(i=$t(s),e[0]=s,e[1]=i):i=e[1];const a=i,c=r?"opacity-100":"opacity-0 pointer-events-none",l=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==l?(u=K("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,l),e[2]=c,e[3]=l,e[4]=u):u=e[4];let V;e[5]!==s||e[6]!==a?(V=a?n.jsxs(n.Fragment,{children:[n.jsx(jr,{size:24}),n.jsxs("span",{className:"text-sm font-medium",children:["Drop ",Rs(s)," here"]})]}):n.jsxs(n.Fragment,{children:[n.jsx(As,{size:24}),n.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=s,e[6]=a,e[7]=V):V=e[7];let d;return e[8]!==u||e[9]!==V?(d=n.jsx("div",{className:u,children:V}),e[8]=u,e[9]=V,e[10]=d):d=e[10],d}function Qc(){const t=F.c(5),e=Ne(),{org:s,locator:o}=ie();let r;return t[0]!==o||t[1]!==e||t[2]!==s.id||t[3]!==s.slug?(r=i=>{const{tiptapDoc:a,virtualMcp:c}=i,l=crypto.randomUUID(),u=c?.id??jn(s.id).id;Go(sessionStorage,o,l,{tiptapDoc:a}),e({to:"/$org/$taskId",params:{org:s.slug,taskId:l},search:{virtualmcpid:u,autosend:Ho}})},t[0]=o,t[1]=e,t[2]=s.id,t[3]=s.slug,t[4]=r):r=t[4],r}function Jc({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=Yo(),o=Wo(),r=s?.messages??[],i=s?.isStreaming??!1,a=s?.isRunInProgress??!1,c=s?.stop??(()=>{}),l=o?.taskId??"",u=o?.tasks??[],V=Qc(),{selectedModel:d,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:y,imageModel:g,deepResearchModel:p,chatMode:v,setChatMode:h,simpleModeTier:b,setSimpleModeTier:S}=Pt(),{data:C}=It.useSession(),_=C?.user?.id,{org:A}=ie(),x=jn(A.id).id,j=pn($n),[P,E]=w.useState(!1),{unsupportedFile:I,onUnsupportedFile:N,clearUnsupportedFile:k}=ml(),R=$c(),L=w.useRef(void 0),D=async()=>{L.current=$,await R.startRecording();const te=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";z("chat_voice_started",{thread_id:l,outcome:te})},T=()=>{z("chat_voice_confirmed",{thread_id:l});const te=R.stopRecording();Q.current?.syncVoiceText(L.current,te),Q.current?.focus()},U=()=>{z("chat_voice_cancelled",{thread_id:l}),R.cancelRecording(),Q.current?.restoreContent(L.current)};w.useEffect(()=>{if(R.status!=="recording")return;const te=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Q.current?.syncVoiceText(L.current,te)},[R.transcript,R.interimTranscript,R.status]);const O=u.find(te=>te.id===l),[$,W]=w.useState(void 0),M=te=>{W(te),y.current=te},Y=w.useRef(l);Y.current!==l&&(Y.current=l,W(void 0),y.current=void 0);const q=[...r].reverse().find(te=>te.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,Q=w.useRef(null),H=v==="plan";w.useEffect(()=>{const te=Ae=>{or(Ae)&&Ae.code==="KeyL"&&(Ae.preventDefault(),Ae.shiftKey&&h(v==="plan"?"default":"plan"),Q.current?.focus())};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[v,h]);const X=mr(r),ne=[...r].reverse().find(te=>te.role==="assistant"&&te.metadata?.usage)?.metadata?.usage,J=ne?.contextTokens??(ne?.totalTokens??0)-(ne?.reasoningTokens??0),re=pn($n),ee=!i&&!f&&!ta($),ae=i||a,Re=te=>{te?.preventDefault(),i?(z("chat_message_stopped",{thread_id:l}),c()):a?(z("chat_message_stopped",{thread_id:l}),c()):ee&&$&&(z("chat_message_sent",{thread_id:l||null,mode:v,model_id:d?.modelId??null,model_provider:d?.providerId??null,virtual_mcp_id:m?.id??null,submission:te?"button_or_enter":"programmatic"}),re(),s?s.sendMessage($):V({tiptapDoc:$,virtualMcp:m}),M(void 0))};return _&&O?.created_by&&O.created_by!==_?n.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[n.jsx(As,{size:14,className:"shrink-0"}),n.jsx("span",{className:"text-sm",children:"Read only — you're viewing someone else's thread"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col w-full justify-end",children:n.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&n.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),s&&o&&n.jsx(zt,{}),n.jsx(Nc,{tiptapDoc:$,setTiptapDoc:M,disabled:i,enterToSubmit:!0,onSubmit:Re,children:n.jsxs("form",{onSubmit:Re,className:K("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-background dark:bg-muted card-shadow"),children:[n.jsx(Hc,{selectedModel:d,onUnsupportedFile:N}),n.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:n.jsx(Ic,{ref:Q,disabled:i||R.status==="recording",virtualMcpId:m?.id??x,showFileUploader:!0,selectedModel:d,onUnsupportedFile:N})}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.status==="recording"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1"}),n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n.jsx(Kc,{data:R.waveformData.slice(0,28)}),n.jsx("button",{type:"button",onClick:U,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:n.jsx(Ze,{size:16})}),n.jsx("button",{type:"button",onClick:T,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:n.jsx(dt,{size:16})})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 shrink-0",children:[n.jsx(Lc,{disabled:i,onOpenConnections:()=>{z("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??x,selectedModel:d,isStreaming:i,onUnsupportedFile:N}),H&&n.jsxs("button",{type:"button",onClick:()=>{j(),z("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),h("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group whitespace-nowrap animate-in fade-in duration-200",children:[n.jsx(ys,{size:14,className:"shrink-0"}),n.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[496px]/chat-bottom:max-w-32 @[496px]/chat-bottom:opacity-100",children:"Plan mode"}),n.jsx(Ze,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="gen-image"&&g&&n.jsxs("button",{type:"button",disabled:i,onClick:()=>{j(),z("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),h("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group whitespace-nowrap animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[n.jsx(js,{size:14,className:"shrink-0"}),n.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[496px]/chat-bottom:max-w-[120px] @[496px]/chat-bottom:opacity-100",children:"Create image"}),n.jsx(Ze,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="web-search"&&p&&n.jsxs("button",{type:"button",disabled:i,onClick:()=>{j(),z("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),h("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group whitespace-nowrap animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[n.jsx(it,{size:14,className:"shrink-0"}),n.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[496px]/chat-bottom:max-w-[120px] @[496px]/chat-bottom:opacity-100",children:"Web search"}),n.jsx(Ze,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),q&&J>0&&n.jsx(fr,{usage:X,totalTokens:J,contextWindow:q,onOpenContextPanel:t})]}),n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx(al,{tier:b,onSelect:S}),R.isSupported&&!i&&!a&&n.jsx(Z,{type:"button",onClick:D,variant:"ghost",size:"icon",className:K("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:n.jsx(Uo,{size:18})}),n.jsx(Z,{type:ae?"button":"submit",onClick:te=>{ae&&(te.preventDefault(),te.stopPropagation(),c())},variant:ee||ae?"default":"ghost",size:"icon",disabled:!ee&&!ae,className:K("size-8 rounded-lg transition-all",!ee&&!ae&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:i?"Stop generating":a?"Cancel run":"Send message (Enter)",children:ae?n.jsx(Oo,{size:20}):n.jsx(vr,{size:20})})]})]})})]})},l),e&&n.jsx(Oc,{onClick:()=>{z("connections_banner_clicked",{source:"home_chat_input"}),z("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),n.jsx(di,{mode:"browse",open:P,onOpenChange:E,defaultTab:"all"}),n.jsx(ul,{info:I,onClose:k})]})}const Xc={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function lo(t){return`deco-credits-empty-dismissed:${t}`}function ju(t){try{return localStorage.getItem(lo(t))==="1"}catch{return!1}}function Zc(){const t=F.c(50),{org:e}=ie(),s=Ne(),{decoKeyId:o}=Ys();let r;t[0]!==e.id||t[1]!==e.slug?(r={connectionId:pt,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=r):r=t[2];const i=je(r),[a,c]=w.useState(!0),[l,u]=w.useState(""),[V,d]=w.useState(!1),[m,f]=w.useState("usd"),y=m==="brl"?"R$":"$";let g;t[3]!==e.id?(g=()=>{z("credits_empty_state_dismissed",{organization_id:e.id}),c(!1);try{localStorage.setItem(lo(e.id),"1")}catch{}},t[3]=e.id,t[4]=g):g=t[4];const p=g;let v,h;t[5]!==a||t[6]!==e.id?(v=()=>{a&&z("credits_empty_state_shown",{organization_id:e.id})},h=[a,e.id],t[5]=a,t[6]=e.id,t[7]=v,t[8]=h):(v=t[7],h=t[8]),w.useEffect(v,h);let b;t[9]!==i||t[10]!==m?(b=async W=>{const M=await i.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:W,currency:m}});if(M?.isError)throw new Error(M.content?.[0]?.text??"Failed to get top-up URL");return M.structuredContent?.url},t[9]=i,t[10]=m,t[11]=b):b=t[11];let S;t[12]!==p?(S=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),p()},t[12]=p,t[13]=S):S=t[13];let C;t[14]!==b||t[15]!==S?(C={mutationFn:b,onSuccess:S,onError:td},t[14]=b,t[15]=S,t[16]=C):C=t[16];const{mutate:_,isPending:A}=xn(C),x=parseFloat(l),j=!isNaN(x)&&x>=1;if(!a)return null;let P;t[17]!==p?(P=W=>!W&&p(),t[17]=p,t[18]=P):P=t[18];let E;t[19]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=E):E=t[19];let I;t[20]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:n.jsx(ps,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[20]=I):I=t[20];let N;t[21]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[E,n.jsxs(ye,{className:"relative gap-3",children:[I,n.jsxs("div",{className:"text-center",children:[n.jsx(ve,{className:"text-lg font-semibold",children:"This workspace has no credits"}),n.jsx(Rt,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[21]=N):N=t[21];let k;t[22]!==m||t[23]!==y||t[24]!==l||t[25]!==x||t[26]!==o||t[27]!==j||t[28]!==A||t[29]!==V||t[30]!==_?(k=o&&n.jsxs("div",{className:"px-6 pb-5",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ts,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:W=>{W&&f(W)},children:[n.jsx(kt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(kt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Xc[m].map(W=>{const{dollars:M,label:Y}=W;return n.jsxs("button",{type:"button",disabled:A,onClick:()=>{z("credits_topup_clicked",{amount_cents:M*100,currency:m,tier_label:Y,source:"empty_state"}),_(M*100)},className:K("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[n.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[y,M]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:Y})]},M)})}),V?n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:y}),n.jsx(he,{type:"number",min:"1",step:"1",placeholder:"50",value:l,onChange:W=>u(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(Z,{className:"h-10",disabled:!j||A,onClick:()=>{z("credits_topup_clicked",{amount_cents:Math.round(x*100),currency:m,tier_label:"custom",source:"empty_state"}),_(Math.round(x*100))},children:A?"Opening...":"Add"})]}):n.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),t[22]=m,t[23]=y,t[24]=l,t[25]=x,t[26]=o,t[27]=j,t[28]=A,t[29]=V,t[30]=_,t[31]=k):k=t[31];let R;t[32]!==p||t[33]!==s||t[34]!==e.slug?(R=()=>{s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[32]=p,t[33]=s,t[34]=e.slug,t[35]=R):R=t[35];let L;t[36]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Is,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[36]=L):L=t[36];let D;t[37]!==R?(D=n.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:R,children:["Use your own provider",L]}),t[37]=R,t[38]=D):D=t[38];let T;t[39]!==p?(T=n.jsx(Z,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[39]=p,t[40]=T):T=t[40];let U;t[41]!==D||t[42]!==T?(U=n.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[D,T]}),t[41]=D,t[42]=T,t[43]=U):U=t[43];let O;t[44]!==k||t[45]!==U?(O=n.jsxs(be,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ed,children:[N,k,U]}),t[44]=k,t[45]=U,t[46]=O):O=t[46];let $;return t[47]!==O||t[48]!==P?($=n.jsx(xe,{open:!0,onOpenChange:P,children:O}),t[47]=O,t[48]=P,t[49]=$):$=t[49],$}function ed(t){return t.preventDefault()}function td(t){oe.error(`Top-up failed: ${t.message}`)}function nd(t){const e=F.c(6),{balanceDollars:s}=t;let o;e[0]!==s?(o=s.toFixed(2),e[0]=s,e[1]=o):o=e[1];const r=o;let i,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=K("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=n.jsx(ps,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=i,e[3]=a):(i=e[2],a=e[3]);let c;return e[4]!==r?(c=n.jsxs("div",{className:i,children:[a,n.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",r," in credits to get started"]})]}),e[4]=r,e[5]=c):c=e[5],c}function sd(){const t=F.c(8),{org:e}=ie(),s=Ne();let o;t[0]!==s||t[1]!==e.slug?(o=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=o):o=t[2];let r,i,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=K("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),i=n.jsx(Ss,{size:13,className:"text-amber-600 dark:text-amber-400"}),a=n.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=r,t[4]=i,t[5]=a):(r=t[3],i=t[4],a=t[5]);let c;return t[6]!==o?(c=n.jsxs("button",{type:"button",onClick:o,className:r,children:[i,a]}),t[6]=o,t[7]=c):c=t[7],c}function od(t){const e=F.c(11),{className:s}=t;let o;e[0]!==s?(o=K("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=o):o=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=r):r=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{className:"flex items-center gap-3",children:[r,n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),n.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:n.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[i,n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),n.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=a):a=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:n.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[n.jsx(vt,{align:"right",width:"w-3/4"}),n.jsx(vt,{align:"left",width:"w-full",lines:3}),n.jsx(vt,{align:"right",width:"w-2/3"}),n.jsx(vt,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:n.jsx("div",{className:"relative flex-1",children:n.jsxs("div",{className:"space-y-2 p-2",children:[n.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),n.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx("div",{className:"px-4 py-4",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:n.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[l,n.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),n.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let d;return e[9]!==o?(d=n.jsxs("div",{className:o,children:[a,c,V]}),e[9]=o,e[10]=d):d=e[10],d}function vt(t){const e=F.c(22),{align:s,width:o,lines:r}=t,i=o===void 0?"w-full":o,a=r===void 0?1:r,c=s==="right"?"flex-row-reverse":"flex-row";let l;e[0]!==c?(l=K("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=l):l=e[1];const u=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==u?(V=K("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=V):V=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const m=s==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==i?(f=K("min-w-0 rounded-2xl p-4",m,i),e[5]=m,e[6]=i,e[7]=f):f=e[7];let y;e[8]!==a?(y=Array.from({length:a}),e[8]=a,e[9]=y):y=e[9];let g;e[10]!==a||e[11]!==y?(g=n.jsx("div",{className:"space-y-2",children:y.map((b,S)=>n.jsx("div",{className:K("h-3 rounded bg-muted-foreground/20 animate-pulse",S===a-1?"w-3/4":"w-full"),style:{animationDelay:`${S*.1}s`}},S))}),e[10]=a,e[11]=y,e[12]=g):g=e[12];let p;e[13]!==g||e[14]!==f?(p=n.jsx("div",{className:f,children:g}),e[13]=g,e[14]=f,e[15]=p):p=e[15];let v;e[16]!==p||e[17]!==V?(v=n.jsxs("div",{className:V,children:[d,p]}),e[16]=p,e[17]=V,e[18]=v):v=e[18];let h;return e[19]!==v||e[20]!==l?(h=n.jsx("div",{className:l,children:v}),e[19]=v,e[20]=l,e[21]=h):h=e[21],h}function rd(t){const e=F.c(5),{className:s,children:o}=t;let r;e[0]!==s?(r=K("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=r):r=e[1];let i;return e[2]!==o||e[3]!==r?(i=n.jsx("div",{className:r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}function id(t){const e=F.c(5),{children:s,className:o}=t;let r;e[0]!==o?(r=K("flex-1 min-h-0 overflow-y-auto isolate",o),e[0]=o,e[1]=r):r=e[1];let i;return e[2]!==s||e[3]!==r?(i=n.jsx("div",{className:r,children:s}),e[2]=s,e[3]=r,e[4]=i):i=e[4],i}function ad(t){const e=F.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=o):o=e[1],o}function ld(){const t=F.c(16),{messages:e,status:s}=Et(),o=pr(e);let r;t[0]!==o?(r=o.at(-1),t[0]=o,t[1]=r):r=t[1];const i=r,a=s==="submitted"||s==="streaming";let c;if(t[2]!==a||t[3]!==i||t[4]!==o||t[5]!==e||t[6]!==s){const l=e.at(-1),u=!a&&l?.role==="assistant"&&l.parts.filter(ud).some(dd),V=!a&&l?.role==="assistant"&&l.parts.some(cd);let d;if(t[8]!==o||t[9]!==s){let f;t[11]!==o.length||t[12]!==s?(f=(y,g)=>n.jsx(Mn,{pair:y,isLastPair:!1,status:g===o.length-1?s:void 0},`pair-${y.user.id}`),t[11]=o.length,t[12]=s,t[13]=f):f=t[13],d=o.slice(0,-1).map(f),t[8]=o,t[9]=s,t[10]=d}else d=t[10];let m;t[14]!==d?(m=n.jsx("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:d}),t[14]=d,t[15]=m):m=t[15],c=n.jsxs("div",{className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",children:[m,i&&n.jsx("div",{className:K("min-h-full min-w-0 max-w-2xl mx-auto w-full",(u||V)&&"pb-60"),children:n.jsx(Mn,{pair:i,isLastPair:!0,status:s},`pair-${i?.user.id}`)})]}),t[2]=a,t[3]=i,t[4]=o,t[5]=e,t[6]=s,t[7]=c}else c=t[7];return c}function cd(t){return"state"in t&&t.state==="approval-requested"}function dd(t){return t.state==="input-available"}function ud(t){return t.type==="tool-user_ask"}function Vd(t){const e=F.c(5),{children:s,className:o}=t;let r;e[0]!==o?(r=K("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",o),e[0]=o,e[1]=r):r=e[1];let i;return e[2]!==s||e[3]!==r?(i=n.jsx("div",{className:r,children:s}),e[2]=s,e[3]=r,e[4]=i):i=e[4],i}const Au=Object.assign(rd,{Main:id,Messages:ld,EmptyState:ad,Footer:Vd,Input:Jc,Provider:Jo,ActiveTaskProvider:Qo,Skeleton:od,IceBreakers:da,NoAiProviderEmptyState:Ir,CreditsEmptyState:Zc,CreditsEyebrow:nd,NoCreditsEyebrow:sd,CreditsExhaustedBanner:Ws});export{di as A,Au as C,al as S,yu as T,fe as a,Ys as b,Nc as c,Ic as d,xu as e,wu as f,bu as g,gu as h,fu as i,pu as j,hu as k,vu as u,ju as w};