decocms 2.326.4 → 2.326.5

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 (784) hide show
  1. package/dist/client/assets/{AlertCircle-B-zXlYEF.js → AlertCircle-BKs-Tk9h.js} +1 -1
  2. package/dist/client/assets/{Archive-C4CyCqla.js → Archive-CV9j3bf4.js} +1 -1
  3. package/dist/client/assets/{ArrowNarrowLeft-BZYhS9D2.js → ArrowNarrowLeft-Bhh603Ny.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-3k3JYGrL.js → ArrowUpRight-FC4Oi-2f.js} +1 -1
  5. package/dist/client/assets/{Check-D31wS9ly.js → Check-DKiijWcP.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-71kyrNZf.js → CheckCircle-CfoII1eK.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-CHdzn9U5.js → ChevronDown--Y3EvXYp.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-jaz2OPsY.js → ChevronRight-Ca4zRaIb.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DVD8xx3D.js → ChevronUp-DdO_IfPT.js} +1 -1
  10. package/dist/client/assets/{Container-JDAraDwC.js → Container-DexpTeBC.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-CBFCVZAl.js → DotsVertical-DNQcbsoe.js} +1 -1
  12. package/dist/client/assets/{LayoutLeft-DXgHmejp.js → LayoutLeft-Ba7QhV2S.js} +1 -1
  13. package/dist/client/assets/{LinkExternal01-Ce2ayrs5.js → LinkExternal01-BL80P3n2.js} +1 -1
  14. package/dist/client/assets/{Lock01-Dbw9pcO9.js → Lock01-DeVe8o60.js} +1 -1
  15. package/dist/client/assets/{Palette-4V3m0N8j.js → Palette-C4dc74xH.js} +1 -1
  16. package/dist/client/assets/{Play-CcyCmiMU.js → Play-CFrlw7i9.js} +1 -1
  17. package/dist/client/assets/{Plus-CVgmWk0g.js → Plus-CYJr04Zy.js} +1 -1
  18. package/dist/client/assets/{RefreshCcw01-CmAvwlz8.js → RefreshCcw01-DfoX5B9c.js} +1 -1
  19. package/dist/client/assets/{SearchMd-DqNFegG5.js → SearchMd-BqMmNXqm.js} +1 -1
  20. package/dist/client/assets/{Settings02-DE5fJKUJ.js → Settings02-Fxu89hGM.js} +1 -1
  21. package/dist/client/assets/{Shield01-Cxs7a9Jh.js → Shield01-D2E9NwCB.js} +1 -1
  22. package/dist/client/assets/{Star01-TF4tlZgw.js → Star01-15V0wLt0.js} +1 -1
  23. package/dist/client/assets/{Sun-BWP8cIVK.js → Sun-C8OKCBXN.js} +1 -1
  24. package/dist/client/assets/{Tool01-BfW8LS_A.js → Tool01-BFjYTDOI.js} +1 -1
  25. package/dist/client/assets/{Trash01-EDLzlKD2.js → Trash01-C_CBcBXr.js} +1 -1
  26. package/dist/client/assets/{User01-Cd8AjYCw.js → User01-qzj_Y6tp.js} +1 -1
  27. package/dist/client/assets/{Users03-BfSxD6sb.js → Users03-B9PYd8og.js} +1 -1
  28. package/dist/client/assets/{X-BLb58Csk.js → X-CIaGajwH.js} +1 -1
  29. package/dist/client/assets/{XCircle-Dea1iai_.js → XCircle-4hBXWc9o.js} +1 -1
  30. package/dist/client/assets/{XClose-DZPI8gND.js → XClose-DOpoziBg.js} +1 -1
  31. package/dist/client/assets/{Zap-DiGqPMPS.js → Zap-CrGGMvmS.js} +1 -1
  32. package/dist/client/assets/{ZapSquare-DxkSPBC2.js → ZapSquare-BFFu4owk.js} +1 -1
  33. package/dist/client/assets/{accordion-BHzBNSWH.js → accordion-BO9kzIX-.js} +1 -1
  34. package/dist/client/assets/{agent-icon-CZh57Qne.js → agent-icon-CaP8Iah4.js} +1 -1
  35. package/dist/client/assets/{agents-list-BCkqI2gM.js → agents-list-nqTQby9f.js} +1 -1
  36. package/dist/client/assets/{ai-providers-K6Is2luN.js → ai-providers-CUtj8HsR.js} +1 -1
  37. package/dist/client/assets/{alert-dialog-CXLY8kKH.js → alert-dialog-3lGFvYQ1.js} +1 -1
  38. package/dist/client/assets/{auth-catchall-CmPVXq-9.js → auth-catchall-Cotr7aFt.js} +1 -1
  39. package/dist/client/assets/{automation-list-row-DIKTCCjc.js → automation-list-row-I7KwLrEL.js} +1 -1
  40. package/dist/client/assets/{automations-LFt0B4rd.js → automations-DDw91zEi.js} +1 -1
  41. package/dist/client/assets/{avatar-Dxnl4o1L.js → avatar-CUxSV6Bq.js} +1 -1
  42. package/dist/client/assets/{badge-c6NmzIqX.js → badge-DSaHi9qU.js} +1 -1
  43. package/dist/client/assets/{brand-context-n6SCXvxr.js → brand-context-BaEx8QEw.js} +1 -1
  44. package/dist/client/assets/{card-DNPqw_Rr.js → card-BlHkoRMW.js} +1 -1
  45. package/dist/client/assets/{chat-context-CZ_Mu36q.js → chat-context-CjvUdGWS.js} +1 -1
  46. package/dist/client/assets/{checkbox-BNr6-0AC.js → checkbox-DopKKHGG.js} +1 -1
  47. package/dist/client/assets/{collection-detail-CledVXiS.js → collection-detail-Cg-E9pGs.js} +1 -1
  48. package/dist/client/assets/{collection-display-button-CJQiKt2S.js → collection-display-button-CLBzGyQv.js} +1 -1
  49. package/dist/client/assets/{collection-search-BsVzk8FO.js → collection-search-DkrAcRrb.js} +1 -1
  50. package/dist/client/assets/{collection-search-BcOv8V-N.js → collection-search-DzsH8w_H.js} +1 -1
  51. package/dist/client/assets/{collection-table-wrapper-DNJ7UcGF.js → collection-table-wrapper-BjD1Qgaw.js} +1 -1
  52. package/dist/client/assets/{collection-tabs-mT-YEV4B.js → collection-tabs-B_L4D5-3.js} +1 -1
  53. package/dist/client/assets/{collections-khgoqAm2.js → collections-BrqFcVmu.js} +1 -1
  54. package/dist/client/assets/{command-XxtkPVWB.js → command-CvY2mBzB.js} +1 -1
  55. package/dist/client/assets/{connection-card-D5dw_oiA.js → connection-card-BwR9eG7C.js} +1 -1
  56. package/dist/client/assets/{connection-detail-CezI4z0c.js → connection-detail-BfPdN37I.js} +1 -1
  57. package/dist/client/assets/{connection-form-helpers-lIirWgoR.js → connection-form-helpers-H5EboxJB.js} +1 -1
  58. package/dist/client/assets/{connections-lcLZQkuC.js → connections-Io52Fszc.js} +1 -1
  59. package/dist/client/assets/{constants-IjhuLFaQ.js → constants-BktC-2Id.js} +1 -1
  60. package/dist/client/assets/{constants-C3zA8qHe.js → constants-DGtNAIT7.js} +1 -1
  61. package/dist/client/assets/{dialog-Doi9ytUK.js → dialog-DW6W2xmo.js} +1 -1
  62. package/dist/client/assets/{domain-settings-BmJSfQ5-.js → domain-settings-CsIwqHmG.js} +1 -1
  63. package/dist/client/assets/{drawer-Co0RKEhu.js → drawer-DpU0-uSN.js} +1 -1
  64. package/dist/client/assets/{dropdown-menu-D8r4Uxla.js → dropdown-menu-DGtcKrXj.js} +1 -1
  65. package/dist/client/assets/{dynamic-plugin-layout-bJdJUxKE.js → dynamic-plugin-layout-BaNikL9h.js} +1 -1
  66. package/dist/client/assets/{empty-state-R2a6UE5B.js → empty-state-DOBtW0uV.js} +1 -1
  67. package/dist/client/assets/{empty-state-_f2ap61r.js → empty-state-D_viS8sv.js} +1 -1
  68. package/dist/client/assets/{extract-connection-data-Dqnzibzo.js → extract-connection-data-TbblmvZm.js} +1 -1
  69. package/dist/client/assets/{features-Dn8COZs7.js → features-B0k2dtL_.js} +1 -1
  70. package/dist/client/assets/{form-eoUJY8jH.js → form-CM9bDTrj.js} +1 -1
  71. package/dist/client/assets/{general-CekP2kuo.js → general-DSqXP7nk.js} +1 -1
  72. package/dist/client/assets/{index-ChciALIJ.js → index-BEQ5uV_Z.js} +1 -1
  73. package/dist/client/assets/{index-DWdZCQc-.js → index-BS-gVIfq.js} +2 -2
  74. package/dist/client/assets/{index-B1aIHRcj.js → index-BSbfk45e.js} +1 -1
  75. package/dist/client/assets/{index-BdxXn3gu.js → index-BZ76ysow.js} +1 -1
  76. package/dist/client/assets/index-Bfttp8V9.css +1 -0
  77. package/dist/client/assets/{index-Bh6tRnlR.js → index-CIA1-hSC.js} +13 -13
  78. package/dist/client/assets/{index-Bjm4iXOx.js → index-CIjquNES.js} +1 -1
  79. package/dist/client/assets/{index-tUNX4FHc.js → index-CJRXtKyh.js} +1 -1
  80. package/dist/client/assets/{index-COcFSuQu.js → index-CUdwQ2wY.js} +12 -12
  81. package/dist/client/assets/{index-Cv6xzz4K.js → index-C_RdQhkF.js} +1 -1
  82. package/dist/client/assets/{index-CsDtkvRi.js → index-DKAIiHx5.js} +1 -1
  83. package/dist/client/assets/{index-DcBSdXJR.js → index-DmQ2kgm5.js} +1 -1
  84. package/dist/client/assets/{index-BSHkf8Vj.js → index-NVsr3upE.js} +1 -1
  85. package/dist/client/assets/{index-DxP6_nIb.js → index-OcGsBFm2.js} +1 -1
  86. package/dist/client/assets/index-Tl303EpR.js +1 -0
  87. package/dist/client/assets/{index-CPiOoTgn.js → index-ZEUO5UYe.js} +1 -1
  88. package/dist/client/assets/{index-Df-qwsmX.js → index-d5n6y5GX.js} +1 -1
  89. package/dist/client/assets/{infiniteQueryObserver-VD0-8yJ_.js → infiniteQueryObserver-B1QrPZyc.js} +1 -1
  90. package/dist/client/assets/{input-9xa5zvbW.js → input-Bnp88QZ_.js} +1 -1
  91. package/dist/client/assets/{integration-icon-yGmwrmvF.js → integration-icon-DyfaeoGN.js} +1 -1
  92. package/dist/client/assets/{label-Cpx7BYhp.js → label-DzJi_LlH.js} +1 -1
  93. package/dist/client/assets/{layout-DcJLID8L.js → layout-Ch4NhCr3.js} +1 -1
  94. package/dist/client/assets/{lean-canvas-recruit-modal-Du8EzSsE.js → lean-canvas-recruit-modal-Bm-BjQi1.js} +1 -1
  95. package/dist/client/assets/{login-gra3nUh1.js → login-B0F74reA.js} +1 -1
  96. package/dist/client/assets/{members-BSqb7D7k.js → members-BClfBPHF.js} +1 -1
  97. package/dist/client/assets/{monaco-editor-1-QaMbI2.js → monaco-editor-CtsW2vz6.js} +1 -1
  98. package/dist/client/assets/{monitoring-stats-row-D9JsOs0w.js → monitoring-stats-row-BxfRUlss.js} +1 -1
  99. package/dist/client/assets/{oauth-callback-BBFSzHJE.js → oauth-callback-3vfW-BJX.js} +1 -1
  100. package/dist/client/assets/{oauth-callback-ai-provider-Cqwmq4fm.js → oauth-callback-ai-provider-whSOs7Hc.js} +1 -1
  101. package/dist/client/assets/{onboarding-CjXmyYEc.js → onboarding-CxmWut2-.js} +1 -1
  102. package/dist/client/assets/{org-layout-BKhPjAVO.js → org-layout-CMNtRDYW.js} +1 -1
  103. package/dist/client/assets/{org-plugin-layout-uoSZruyT.js → org-plugin-layout-DbSU6107.js} +1 -1
  104. package/dist/client/assets/{pair-DueHqlQe.js → pair-CpXOCIMQ.js} +24 -24
  105. package/dist/client/assets/{plugin-empty-state-y6LyaWuT.js → plugin-empty-state-D9x8k3Tu.js} +1 -1
  106. package/dist/client/assets/{plugin-header-Brz-DxYW.js → plugin-header-BZfZnsUW.js} +1 -1
  107. package/dist/client/assets/{plugin-layout-C5keoFXu.js → plugin-layout-6zSfmEGw.js} +1 -1
  108. package/dist/client/assets/{popover-BdZuVay_.js → popover-DE1oeF2O.js} +1 -1
  109. package/dist/client/assets/{profile-BmP_6LKN.js → profile-DFFSC_Gk.js} +1 -1
  110. package/dist/client/assets/{project-app-view-C6_MrK97.js → project-app-view-DMfP2LeK.js} +1 -1
  111. package/dist/client/assets/registry-BASwAtDY.js +2 -0
  112. package/dist/client/assets/{registry-layout-BdyhnxVF.js → registry-layout-DOmyaCoz.js} +1 -1
  113. package/dist/client/assets/{required-auth-layout-BbLiMMM2.js → required-auth-layout-DMktWL1v.js} +1 -1
  114. package/dist/client/assets/{reset-password-Bi61iwcD.js → reset-password-CU2fIczb.js} +1 -1
  115. package/dist/client/assets/{roles-Do6qlzTW.js → roles-NjnIh1gA.js} +1 -1
  116. package/dist/client/assets/{scroll-area-BcV3t5bL.js → scroll-area-DeMoaU-3.js} +1 -1
  117. package/dist/client/assets/{search-input-Bq5K7FLU.js → search-input-D45y5JTY.js} +1 -1
  118. package/dist/client/assets/{select-XbJVHQj5.js → select-BeiVpWJO.js} +1 -1
  119. package/dist/client/assets/{select-model-a0ug8n7z.js → select-model-uM0zdmom.js} +1 -1
  120. package/dist/client/assets/{settings-layout-DTkkkyT4.js → settings-layout-iTPrQRjw.js} +1 -1
  121. package/dist/client/assets/{settings-section-Dh9Y3CLz.js → settings-section-CNZ8sN4I.js} +1 -1
  122. package/dist/client/assets/{shell-layout-DXnu_jyv.js → shell-layout-xFjv9Tup.js} +1 -1
  123. package/dist/client/assets/{sidebar-DvQL_TUY.js → sidebar-9QWnwvet.js} +1 -1
  124. package/dist/client/assets/{skeleton-Bx_60Lm6.js → skeleton-BcmlYPnB.js} +1 -1
  125. package/dist/client/assets/{spinner-B20oQJ-M.js → spinner-Cyd__3qS.js} +1 -1
  126. package/dist/client/assets/{sso-Cuasv7E2.js → sso-Vbx4SCL8.js} +1 -1
  127. package/dist/client/assets/{store-DT-96QRy.js → store-CkEUPTVJ.js} +1 -1
  128. package/dist/client/assets/store-registry-DDpH_0gb.js +2 -0
  129. package/dist/client/assets/{switch-zT1zi1kQ.js → switch-DbODMya7.js} +1 -1
  130. package/dist/client/assets/{table-C2ugbXni.js → table-TOpcK0gz.js} +1 -1
  131. package/dist/client/assets/{tabs-DPGWJZb6.js → tabs-CFhNcgi3.js} +1 -1
  132. package/dist/client/assets/{task-status-M26VOmDM.js → task-status-D8kjMA-y.js} +1 -1
  133. package/dist/client/assets/{textarea-DQXLFt5H.js → textarea-gYtsbOm3.js} +1 -1
  134. package/dist/client/assets/{toggle-group-DjJ0AjEg.js → toggle-group-pQ_FIeMw.js} +1 -1
  135. package/dist/client/assets/{tools-list-DrUWrtki.js → tools-list-B52c3iOc.js} +1 -1
  136. package/dist/client/assets/{tooltip-DfT_j861.js → tooltip-eDEazI1f.js} +1 -1
  137. package/dist/client/assets/{types-BDdsdv9K.js → types-FLjr0VG3.js} +1 -1
  138. package/dist/client/assets/{use-ai-providers-DhNztqgn.js → use-ai-providers-DPlKbjfN.js} +1 -1
  139. package/dist/client/assets/{use-collections-CYpFy4cl.js → use-collections-Dicu7Oae.js} +1 -1
  140. package/dist/client/assets/{use-connection-gqwIMzi8.js → use-connection-CYWI6QMK.js} +1 -1
  141. package/dist/client/assets/{use-copy-CXAKIutW.js → use-copy-CXH6SDSs.js} +1 -1
  142. package/dist/client/assets/{use-create-virtual-mcp-C4ESFAxW.js → use-create-virtual-mcp-Y-9T_lFR.js} +1 -1
  143. package/dist/client/assets/{use-debounced-autosave-Bp1Vss8d.js → use-debounced-autosave-DrVNzub3.js} +1 -1
  144. package/dist/client/assets/{use-decopilot-events-Bd1wRrTA.js → use-decopilot-events-BjFRRqQH.js} +1 -1
  145. package/dist/client/assets/{use-delete-connection-CNmyV8QE.js → use-delete-connection-oYsLxbGb.js} +1 -1
  146. package/dist/client/assets/{use-infinite-scroll-BHZ9RTFs.js → use-infinite-scroll-VIF4xHYD.js} +1 -1
  147. package/dist/client/assets/{use-list-state-BoZYbU5e.js → use-list-state-BnpYu1pb.js} +1 -1
  148. package/dist/client/assets/{use-mcp-tools-BTVGTOsk.js → use-mcp-tools-Bw2-KFGq.js} +1 -1
  149. package/dist/client/assets/{use-members-BiJaFgv8.js → use-members-DCz7bqXz.js} +1 -1
  150. package/dist/client/assets/{use-navigate-to-agent-ByWVCNuu.js → use-navigate-to-agent-Da1f5G7L.js} +1 -1
  151. package/dist/client/assets/{use-org-auth-client-Cy_5MF9D.js → use-org-auth-client-8OKnhNfM.js} +1 -1
  152. package/dist/client/assets/{use-org-sso-BqMkU3KM.js → use-org-sso-BPnP092_.js} +1 -1
  153. package/dist/client/assets/{use-organization-roles-NwQSv9-z.js → use-organization-roles-s3g4Ye6S.js} +1 -1
  154. package/dist/client/assets/{use-organization-settings-DXeEXREU.js → use-organization-settings-CzytzZM0.js} +1 -1
  155. package/dist/client/assets/{use-registry-connections-Ccqqa12a.js → use-registry-connections-BhSxL2KZ.js} +1 -1
  156. package/dist/client/assets/{use-status-sounds-8mapVZR-.js → use-status-sounds-jMF56EXn.js} +1 -1
  157. package/dist/client/assets/{use-tasks-BfdodVQE.js → use-tasks-Dm7kwVF-.js} +1 -1
  158. package/dist/client/assets/{use-view-mode-B_kT8lIO.js → use-view-mode-Cy22z7gd.js} +1 -1
  159. package/dist/client/assets/{use-virtual-mcp-DWh4bxBq.js → use-virtual-mcp-B3xI7Opb.js} +1 -1
  160. package/dist/client/assets/useInfiniteQuery-5jYZe5xL.js +1 -0
  161. package/dist/client/assets/{useRouterState-DA1xdhLv.js → useRouterState-BWUTsJUz.js} +1 -1
  162. package/dist/client/assets/useSuspenseInfiniteQuery-DPcxp7id.js +1 -0
  163. package/dist/client/assets/{user-CrVNB3sZ.js → user-DIfuunSw.js} +1 -1
  164. package/dist/client/assets/{view-mode-toggle-e816MMyJ.js → view-mode-toggle-BsakhBIU.js} +1 -1
  165. package/dist/client/assets/{workflow-CTJM1J8v.js → workflow-PneFPiX-.js} +1 -1
  166. package/dist/client/assets/workflow-detail-qsKI5IrE.js +1 -0
  167. package/dist/client/index.html +2 -2
  168. package/dist/server/cli.js +1 -1
  169. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js +36 -6
  170. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js.map +1 -1
  171. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js +15 -0
  172. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js.map +1 -1
  173. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js +36 -6
  174. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js.map +1 -1
  175. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js +15 -0
  176. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js.map +1 -1
  177. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js +36 -6
  178. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js.map +1 -1
  179. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js +15 -0
  180. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js.map +1 -1
  181. package/dist/server/node_modules/@opentelemetry/otlp-transformer/package.json +12 -14
  182. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/InstrumentDescriptor.js +1 -1
  183. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/InstrumentDescriptor.js.map +1 -1
  184. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.d.ts +3 -3
  185. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.js +6 -6
  186. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.js.map +1 -1
  187. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.d.ts +1 -1
  188. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.js +2 -2
  189. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.js.map +1 -1
  190. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.d.ts +3 -3
  191. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.js +5 -5
  192. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.js.map +1 -1
  193. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.d.ts +3 -3
  194. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.js +17 -17
  195. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.js.map +1 -1
  196. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.d.ts +3 -3
  197. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.js +8 -8
  198. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.js.map +1 -1
  199. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.d.ts +1 -1
  200. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.js +2 -2
  201. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.js.map +1 -1
  202. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.d.ts +2 -2
  203. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.js +3 -3
  204. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.js.map +1 -1
  205. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  206. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.js +2 -2
  207. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.js.map +1 -1
  208. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/ConsoleMetricExporter.js +1 -1
  209. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/ConsoleMetricExporter.js.map +1 -1
  210. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js +3 -3
  211. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js.map +1 -1
  212. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js +14 -21
  213. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js.map +1 -1
  214. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.d.ts +2 -2
  215. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.js +4 -4
  216. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.js.map +1 -1
  217. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.d.ts +2 -2
  218. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js +3 -3
  219. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js.map +1 -1
  220. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.d.ts +2 -2
  221. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js +3 -3
  222. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js.map +1 -1
  223. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.d.ts +1 -1
  224. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.js +1 -1
  225. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.js.map +1 -1
  226. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.d.ts +3 -3
  227. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.js +11 -12
  228. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.js.map +1 -1
  229. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.d.ts +1 -1
  230. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.js +3 -3
  231. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.js.map +1 -1
  232. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.d.ts +1 -1
  233. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.js +2 -2
  234. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.js.map +1 -1
  235. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.d.ts +1 -1
  236. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.js +2 -2
  237. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.js.map +1 -1
  238. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/ObservableRegistry.js +4 -4
  239. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/ObservableRegistry.js.map +1 -1
  240. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.d.ts +2 -2
  241. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.js +4 -4
  242. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.js.map +1 -1
  243. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.d.ts +1 -1
  244. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js +2 -2
  245. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js.map +1 -1
  246. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.d.ts +19 -0
  247. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js +36 -0
  248. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js.map +1 -1
  249. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.d.ts +1 -1
  250. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js +1 -1
  251. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js.map +1 -1
  252. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.d.ts +3 -3
  253. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.js +6 -6
  254. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.js.map +1 -1
  255. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AttributesProcessor.js +12 -16
  256. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AttributesProcessor.js.map +1 -1
  257. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/InstrumentDescriptor.js +1 -1
  258. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/InstrumentDescriptor.js.map +1 -1
  259. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.d.ts +3 -3
  260. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.js +6 -6
  261. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Instruments.js.map +1 -1
  262. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.d.ts +1 -1
  263. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.js +2 -2
  264. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/Meter.js.map +1 -1
  265. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.d.ts +3 -3
  266. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.js +5 -5
  267. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/ObservableResult.js.map +1 -1
  268. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.d.ts +3 -3
  269. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.js +17 -17
  270. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/ExponentialHistogram.js.map +1 -1
  271. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.d.ts +3 -3
  272. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.js +8 -8
  273. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Histogram.js.map +1 -1
  274. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.d.ts +1 -1
  275. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.js +2 -2
  276. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/LastValue.js.map +1 -1
  277. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.d.ts +2 -2
  278. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.js +3 -3
  279. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/Sum.js.map +1 -1
  280. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  281. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.js +2 -2
  282. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/aggregator/exponential-histogram/Buckets.js.map +1 -1
  283. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/ConsoleMetricExporter.js +1 -1
  284. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/ConsoleMetricExporter.js.map +1 -1
  285. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js +3 -3
  286. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js.map +1 -1
  287. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js +14 -21
  288. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js.map +1 -1
  289. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.d.ts +2 -2
  290. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.js +4 -4
  291. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/AsyncMetricStorage.js.map +1 -1
  292. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.d.ts +2 -2
  293. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js +3 -3
  294. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js.map +1 -1
  295. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.d.ts +2 -2
  296. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js +3 -3
  297. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js.map +1 -1
  298. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.d.ts +1 -1
  299. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.js +1 -1
  300. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterProviderSharedState.js.map +1 -1
  301. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.d.ts +3 -3
  302. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.js +11 -12
  303. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MeterSharedState.js.map +1 -1
  304. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.d.ts +1 -1
  305. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.js +3 -3
  306. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricCollector.js.map +1 -1
  307. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.d.ts +1 -1
  308. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.js +2 -2
  309. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MetricStorage.js.map +1 -1
  310. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.d.ts +1 -1
  311. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.js +2 -2
  312. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/MultiWritableMetricStorage.js.map +1 -1
  313. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/ObservableRegistry.js +4 -4
  314. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/ObservableRegistry.js.map +1 -1
  315. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.d.ts +2 -2
  316. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.js +4 -4
  317. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/SyncMetricStorage.js.map +1 -1
  318. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.d.ts +1 -1
  319. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js +2 -2
  320. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js.map +1 -1
  321. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.d.ts +19 -0
  322. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.js +36 -0
  323. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/utils.js.map +1 -1
  324. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.d.ts +1 -1
  325. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js +1 -1
  326. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js.map +1 -1
  327. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.d.ts +3 -3
  328. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.js +6 -6
  329. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/Aggregation.js.map +1 -1
  330. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/AttributesProcessor.js +12 -16
  331. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/esnext/view/AttributesProcessor.js.map +1 -1
  332. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.js +1 -1
  333. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.js.map +1 -1
  334. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.d.ts +3 -3
  335. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.js +6 -6
  336. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Instruments.js.map +1 -1
  337. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.d.ts +1 -1
  338. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.js +2 -2
  339. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/Meter.js.map +1 -1
  340. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.d.ts +3 -3
  341. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.js +5 -5
  342. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/ObservableResult.js.map +1 -1
  343. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.d.ts +3 -3
  344. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.js +17 -17
  345. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.js.map +1 -1
  346. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.d.ts +3 -3
  347. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.js +8 -8
  348. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.js.map +1 -1
  349. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.d.ts +1 -1
  350. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.js +2 -2
  351. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.js.map +1 -1
  352. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.d.ts +2 -2
  353. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.js +3 -3
  354. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.js.map +1 -1
  355. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.d.ts +1 -1
  356. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.js +2 -2
  357. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/exponential-histogram/Buckets.js.map +1 -1
  358. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.js +1 -1
  359. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.js.map +1 -1
  360. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js +2 -2
  361. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js.map +1 -1
  362. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js +14 -21
  363. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js.map +1 -1
  364. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.d.ts +2 -2
  365. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.js +4 -4
  366. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/AsyncMetricStorage.js.map +1 -1
  367. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.d.ts +2 -2
  368. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js +3 -3
  369. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js.map +1 -1
  370. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.d.ts +2 -2
  371. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js +3 -3
  372. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js.map +1 -1
  373. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.d.ts +1 -1
  374. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.js +1 -1
  375. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterProviderSharedState.js.map +1 -1
  376. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.d.ts +3 -3
  377. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.js +11 -12
  378. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MeterSharedState.js.map +1 -1
  379. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.d.ts +1 -1
  380. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.js +3 -3
  381. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricCollector.js.map +1 -1
  382. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.d.ts +1 -1
  383. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.js +2 -2
  384. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MetricStorage.js.map +1 -1
  385. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.d.ts +1 -1
  386. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.js +2 -2
  387. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/MultiWritableMetricStorage.js.map +1 -1
  388. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/ObservableRegistry.js +3 -3
  389. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/ObservableRegistry.js.map +1 -1
  390. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.d.ts +2 -2
  391. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.js +4 -4
  392. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/SyncMetricStorage.js.map +1 -1
  393. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.d.ts +1 -1
  394. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js +2 -2
  395. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js.map +1 -1
  396. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.d.ts +19 -0
  397. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.js +41 -1
  398. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/utils.js.map +1 -1
  399. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.d.ts +1 -1
  400. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.js +1 -1
  401. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/version.js.map +1 -1
  402. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.d.ts +3 -3
  403. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.js +6 -6
  404. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.js.map +1 -1
  405. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.js +12 -16
  406. package/dist/server/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.js.map +1 -1
  407. package/dist/server/node_modules/@opentelemetry/sdk-metrics/package.json +6 -6
  408. package/dist/server/node_modules/environment/index.d.ts +74 -0
  409. package/dist/server/node_modules/environment/index.js +47 -0
  410. package/dist/server/node_modules/environment/license +9 -0
  411. package/dist/server/node_modules/environment/package.json +74 -0
  412. package/dist/server/node_modules/environment/readme.md +94 -0
  413. package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
  414. package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
  415. package/dist/server/node_modules/escape-string-regexp/license +9 -0
  416. package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
  417. package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
  418. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  419. package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
  420. package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
  421. package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
  422. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
  423. package/package.json +1 -1
  424. package/dist/client/assets/index-CDdUTXEh.js +0 -1
  425. package/dist/client/assets/index-CJ6eA0ut.css +0 -1
  426. package/dist/client/assets/registry-DP9GyBWb.js +0 -2
  427. package/dist/client/assets/store-registry-s_o2PmSC.js +0 -2
  428. package/dist/client/assets/useInfiniteQuery-f4r7zUAu.js +0 -1
  429. package/dist/client/assets/useSuspenseInfiniteQuery-fA7ZS8le.js +0 -1
  430. package/dist/client/assets/workflow-detail-CVhp8kUB.js +0 -1
  431. package/dist/server/node_modules/@opentelemetry/core/LICENSE +0 -201
  432. package/dist/server/node_modules/@opentelemetry/core/README.md +0 -73
  433. package/dist/server/node_modules/@opentelemetry/core/build/esm/ExportResult.d.ts +0 -9
  434. package/dist/server/node_modules/@opentelemetry/core/build/esm/ExportResult.js +0 -21
  435. package/dist/server/node_modules/@opentelemetry/core/build/esm/ExportResult.js.map +0 -1
  436. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/constants.d.ts +0 -8
  437. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/constants.js +0 -27
  438. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/constants.js.map +0 -1
  439. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.d.ts +0 -13
  440. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js +0 -72
  441. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js.map +0 -1
  442. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/utils.d.ts +0 -16
  443. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/utils.js +0 -69
  444. package/dist/server/node_modules/@opentelemetry/core/build/esm/baggage/utils.js.map +0 -1
  445. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/anchored-clock.d.ts +0 -41
  446. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/anchored-clock.js +0 -57
  447. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/anchored-clock.js.map +0 -1
  448. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/attributes.d.ts +0 -5
  449. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/attributes.js +0 -87
  450. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/attributes.js.map +0 -1
  451. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.d.ts +0 -13
  452. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js +0 -36
  453. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js.map +0 -1
  454. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.d.ts +0 -7
  455. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js +0 -59
  456. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js.map +0 -1
  457. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/time.d.ts +0 -59
  458. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/time.js +0 -156
  459. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/time.js.map +0 -1
  460. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/timer-util.d.ts +0 -8
  461. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/timer-util.js +0 -25
  462. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/timer-util.js.map +0 -1
  463. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/types.d.ts +0 -33
  464. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/types.js +0 -17
  465. package/dist/server/node_modules/@opentelemetry/core/build/esm/common/types.js.map +0 -1
  466. package/dist/server/node_modules/@opentelemetry/core/build/esm/index.d.ts +0 -30
  467. package/dist/server/node_modules/@opentelemetry/core/build/esm/index.js +0 -40
  468. package/dist/server/node_modules/@opentelemetry/core/build/esm/index.js.map +0 -1
  469. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/exporter.d.ts +0 -10
  470. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/exporter.js +0 -32
  471. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/exporter.js.map +0 -1
  472. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/validators.d.ts +0 -15
  473. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/validators.js +0 -41
  474. package/dist/server/node_modules/@opentelemetry/core/build/esm/internal/validators.js.map +0 -1
  475. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.d.ts +0 -5
  476. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js +0 -28
  477. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js.map +0 -1
  478. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/globalThis.d.ts +0 -10
  479. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/globalThis.js +0 -35
  480. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/globalThis.js.map +0 -1
  481. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/index.d.ts +0 -5
  482. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js +0 -20
  483. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js.map +0 -1
  484. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.d.ts +0 -5
  485. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js +0 -17
  486. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/performance.js.map +0 -1
  487. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.d.ts +0 -8
  488. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js +0 -26
  489. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js.map +0 -1
  490. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/index.d.ts +0 -2
  491. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/index.js +0 -17
  492. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/index.js.map +0 -1
  493. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/environment.d.ts +0 -40
  494. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/environment.js +0 -97
  495. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/environment.js.map +0 -1
  496. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/globalThis.d.ts +0 -3
  497. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/globalThis.js +0 -19
  498. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/globalThis.js.map +0 -1
  499. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/index.d.ts +0 -5
  500. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/index.js +0 -20
  501. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/index.js.map +0 -1
  502. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/performance.d.ts +0 -5
  503. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/performance.js +0 -18
  504. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/performance.js.map +0 -1
  505. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.d.ts +0 -8
  506. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js +0 -26
  507. package/dist/server/node_modules/@opentelemetry/core/build/esm/platform/node/sdk-info.js.map +0 -1
  508. package/dist/server/node_modules/@opentelemetry/core/build/esm/propagation/composite.d.ts +0 -43
  509. package/dist/server/node_modules/@opentelemetry/core/build/esm/propagation/composite.js +0 -77
  510. package/dist/server/node_modules/@opentelemetry/core/build/esm/propagation/composite.js.map +0 -1
  511. package/dist/server/node_modules/@opentelemetry/core/build/esm/semconv.d.ts +0 -9
  512. package/dist/server/node_modules/@opentelemetry/core/build/esm/semconv.js +0 -29
  513. package/dist/server/node_modules/@opentelemetry/core/build/esm/semconv.js.map +0 -1
  514. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/TraceState.d.ts +0 -22
  515. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/TraceState.js +0 -99
  516. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/TraceState.js.map +0 -1
  517. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.d.ts +0 -26
  518. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js +0 -99
  519. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js.map +0 -1
  520. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/rpc-metadata.d.ts +0 -18
  521. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/rpc-metadata.js +0 -31
  522. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/rpc-metadata.js.map +0 -1
  523. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.d.ts +0 -5
  524. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js +0 -27
  525. package/dist/server/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js.map +0 -1
  526. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/callback.d.ts +0 -14
  527. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/callback.js +0 -48
  528. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/callback.js.map +0 -1
  529. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/configuration.d.ts +0 -7
  530. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/configuration.js +0 -42
  531. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/configuration.js.map +0 -1
  532. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.d.ts +0 -30
  533. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js +0 -153
  534. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js.map +0 -1
  535. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/merge.d.ts +0 -6
  536. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/merge.js +0 -158
  537. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/merge.js.map +0 -1
  538. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/promise.d.ts +0 -10
  539. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/promise.js +0 -36
  540. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/promise.js.map +0 -1
  541. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/timeout.d.ts +0 -17
  542. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/timeout.js +0 -51
  543. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/timeout.js.map +0 -1
  544. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/url.d.ts +0 -8
  545. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/url.js +0 -40
  546. package/dist/server/node_modules/@opentelemetry/core/build/esm/utils/url.js.map +0 -1
  547. package/dist/server/node_modules/@opentelemetry/core/build/esm/version.d.ts +0 -2
  548. package/dist/server/node_modules/@opentelemetry/core/build/esm/version.js +0 -18
  549. package/dist/server/node_modules/@opentelemetry/core/build/esm/version.js.map +0 -1
  550. package/dist/server/node_modules/@opentelemetry/core/build/esnext/ExportResult.d.ts +0 -9
  551. package/dist/server/node_modules/@opentelemetry/core/build/esnext/ExportResult.js +0 -21
  552. package/dist/server/node_modules/@opentelemetry/core/build/esnext/ExportResult.js.map +0 -1
  553. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/constants.d.ts +0 -8
  554. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/constants.js +0 -27
  555. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/constants.js.map +0 -1
  556. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/propagation/W3CBaggagePropagator.d.ts +0 -13
  557. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/propagation/W3CBaggagePropagator.js +0 -72
  558. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/propagation/W3CBaggagePropagator.js.map +0 -1
  559. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/utils.d.ts +0 -16
  560. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/utils.js +0 -69
  561. package/dist/server/node_modules/@opentelemetry/core/build/esnext/baggage/utils.js.map +0 -1
  562. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/anchored-clock.d.ts +0 -41
  563. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/anchored-clock.js +0 -57
  564. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/anchored-clock.js.map +0 -1
  565. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/attributes.d.ts +0 -5
  566. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/attributes.js +0 -87
  567. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/attributes.js.map +0 -1
  568. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/global-error-handler.d.ts +0 -13
  569. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/global-error-handler.js +0 -36
  570. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/global-error-handler.js.map +0 -1
  571. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/logging-error-handler.d.ts +0 -7
  572. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/logging-error-handler.js +0 -59
  573. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/logging-error-handler.js.map +0 -1
  574. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/time.d.ts +0 -59
  575. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/time.js +0 -156
  576. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/time.js.map +0 -1
  577. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/timer-util.d.ts +0 -8
  578. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/timer-util.js +0 -25
  579. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/timer-util.js.map +0 -1
  580. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/types.d.ts +0 -33
  581. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/types.js +0 -17
  582. package/dist/server/node_modules/@opentelemetry/core/build/esnext/common/types.js.map +0 -1
  583. package/dist/server/node_modules/@opentelemetry/core/build/esnext/index.d.ts +0 -30
  584. package/dist/server/node_modules/@opentelemetry/core/build/esnext/index.js +0 -40
  585. package/dist/server/node_modules/@opentelemetry/core/build/esnext/index.js.map +0 -1
  586. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/exporter.d.ts +0 -10
  587. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/exporter.js +0 -32
  588. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/exporter.js.map +0 -1
  589. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/validators.d.ts +0 -15
  590. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/validators.js +0 -41
  591. package/dist/server/node_modules/@opentelemetry/core/build/esnext/internal/validators.js.map +0 -1
  592. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/environment.d.ts +0 -5
  593. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/environment.js +0 -28
  594. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/environment.js.map +0 -1
  595. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/globalThis.d.ts +0 -10
  596. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/globalThis.js +0 -35
  597. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/globalThis.js.map +0 -1
  598. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/index.d.ts +0 -5
  599. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/index.js +0 -20
  600. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/index.js.map +0 -1
  601. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/performance.d.ts +0 -5
  602. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/performance.js +0 -17
  603. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/performance.js.map +0 -1
  604. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/sdk-info.d.ts +0 -8
  605. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/sdk-info.js +0 -26
  606. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/browser/sdk-info.js.map +0 -1
  607. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/index.d.ts +0 -2
  608. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/index.js +0 -17
  609. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/index.js.map +0 -1
  610. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/environment.d.ts +0 -40
  611. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/environment.js +0 -97
  612. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/environment.js.map +0 -1
  613. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/globalThis.d.ts +0 -3
  614. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/globalThis.js +0 -19
  615. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/globalThis.js.map +0 -1
  616. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/index.d.ts +0 -5
  617. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/index.js +0 -20
  618. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/index.js.map +0 -1
  619. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/performance.d.ts +0 -5
  620. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/performance.js +0 -18
  621. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/performance.js.map +0 -1
  622. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/sdk-info.d.ts +0 -8
  623. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/sdk-info.js +0 -26
  624. package/dist/server/node_modules/@opentelemetry/core/build/esnext/platform/node/sdk-info.js.map +0 -1
  625. package/dist/server/node_modules/@opentelemetry/core/build/esnext/propagation/composite.d.ts +0 -43
  626. package/dist/server/node_modules/@opentelemetry/core/build/esnext/propagation/composite.js +0 -77
  627. package/dist/server/node_modules/@opentelemetry/core/build/esnext/propagation/composite.js.map +0 -1
  628. package/dist/server/node_modules/@opentelemetry/core/build/esnext/semconv.d.ts +0 -9
  629. package/dist/server/node_modules/@opentelemetry/core/build/esnext/semconv.js +0 -29
  630. package/dist/server/node_modules/@opentelemetry/core/build/esnext/semconv.js.map +0 -1
  631. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/TraceState.d.ts +0 -22
  632. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/TraceState.js +0 -99
  633. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/TraceState.js.map +0 -1
  634. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/W3CTraceContextPropagator.d.ts +0 -26
  635. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/W3CTraceContextPropagator.js +0 -99
  636. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/W3CTraceContextPropagator.js.map +0 -1
  637. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/rpc-metadata.d.ts +0 -18
  638. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/rpc-metadata.js +0 -31
  639. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/rpc-metadata.js.map +0 -1
  640. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/suppress-tracing.d.ts +0 -5
  641. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/suppress-tracing.js +0 -27
  642. package/dist/server/node_modules/@opentelemetry/core/build/esnext/trace/suppress-tracing.js.map +0 -1
  643. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/callback.d.ts +0 -14
  644. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/callback.js +0 -48
  645. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/callback.js.map +0 -1
  646. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/configuration.d.ts +0 -7
  647. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/configuration.js +0 -42
  648. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/configuration.js.map +0 -1
  649. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/lodash.merge.d.ts +0 -30
  650. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/lodash.merge.js +0 -153
  651. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/lodash.merge.js.map +0 -1
  652. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/merge.d.ts +0 -6
  653. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/merge.js +0 -158
  654. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/merge.js.map +0 -1
  655. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/promise.d.ts +0 -10
  656. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/promise.js +0 -36
  657. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/promise.js.map +0 -1
  658. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/timeout.d.ts +0 -17
  659. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/timeout.js +0 -51
  660. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/timeout.js.map +0 -1
  661. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/url.d.ts +0 -8
  662. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/url.js +0 -40
  663. package/dist/server/node_modules/@opentelemetry/core/build/esnext/utils/url.js.map +0 -1
  664. package/dist/server/node_modules/@opentelemetry/core/build/esnext/version.d.ts +0 -2
  665. package/dist/server/node_modules/@opentelemetry/core/build/esnext/version.js +0 -18
  666. package/dist/server/node_modules/@opentelemetry/core/build/esnext/version.js.map +0 -1
  667. package/dist/server/node_modules/@opentelemetry/core/build/src/ExportResult.d.ts +0 -9
  668. package/dist/server/node_modules/@opentelemetry/core/build/src/ExportResult.js +0 -24
  669. package/dist/server/node_modules/@opentelemetry/core/build/src/ExportResult.js.map +0 -1
  670. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/constants.d.ts +0 -8
  671. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/constants.js +0 -30
  672. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/constants.js.map +0 -1
  673. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.d.ts +0 -13
  674. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js +0 -76
  675. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js.map +0 -1
  676. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/utils.d.ts +0 -16
  677. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/utils.js +0 -76
  678. package/dist/server/node_modules/@opentelemetry/core/build/src/baggage/utils.js.map +0 -1
  679. package/dist/server/node_modules/@opentelemetry/core/build/src/common/anchored-clock.d.ts +0 -41
  680. package/dist/server/node_modules/@opentelemetry/core/build/src/common/anchored-clock.js +0 -61
  681. package/dist/server/node_modules/@opentelemetry/core/build/src/common/anchored-clock.js.map +0 -1
  682. package/dist/server/node_modules/@opentelemetry/core/build/src/common/attributes.d.ts +0 -5
  683. package/dist/server/node_modules/@opentelemetry/core/build/src/common/attributes.js +0 -93
  684. package/dist/server/node_modules/@opentelemetry/core/build/src/common/attributes.js.map +0 -1
  685. package/dist/server/node_modules/@opentelemetry/core/build/src/common/global-error-handler.d.ts +0 -13
  686. package/dist/server/node_modules/@opentelemetry/core/build/src/common/global-error-handler.js +0 -41
  687. package/dist/server/node_modules/@opentelemetry/core/build/src/common/global-error-handler.js.map +0 -1
  688. package/dist/server/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.d.ts +0 -7
  689. package/dist/server/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.js +0 -63
  690. package/dist/server/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.js.map +0 -1
  691. package/dist/server/node_modules/@opentelemetry/core/build/src/common/time.d.ts +0 -59
  692. package/dist/server/node_modules/@opentelemetry/core/build/src/common/time.js +0 -171
  693. package/dist/server/node_modules/@opentelemetry/core/build/src/common/time.js.map +0 -1
  694. package/dist/server/node_modules/@opentelemetry/core/build/src/common/timer-util.d.ts +0 -8
  695. package/dist/server/node_modules/@opentelemetry/core/build/src/common/timer-util.js +0 -29
  696. package/dist/server/node_modules/@opentelemetry/core/build/src/common/timer-util.js.map +0 -1
  697. package/dist/server/node_modules/@opentelemetry/core/build/src/common/types.d.ts +0 -33
  698. package/dist/server/node_modules/@opentelemetry/core/build/src/common/types.js +0 -18
  699. package/dist/server/node_modules/@opentelemetry/core/build/src/common/types.js.map +0 -1
  700. package/dist/server/node_modules/@opentelemetry/core/build/src/index.d.ts +0 -30
  701. package/dist/server/node_modules/@opentelemetry/core/build/src/index.js +0 -92
  702. package/dist/server/node_modules/@opentelemetry/core/build/src/index.js.map +0 -1
  703. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/exporter.d.ts +0 -10
  704. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/exporter.js +0 -36
  705. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/exporter.js.map +0 -1
  706. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/validators.d.ts +0 -15
  707. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/validators.js +0 -46
  708. package/dist/server/node_modules/@opentelemetry/core/build/src/internal/validators.js.map +0 -1
  709. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/environment.d.ts +0 -5
  710. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/environment.js +0 -35
  711. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/environment.js.map +0 -1
  712. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/globalThis.d.ts +0 -10
  713. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/globalThis.js +0 -38
  714. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/globalThis.js.map +0 -1
  715. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/index.d.ts +0 -5
  716. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/index.js +0 -30
  717. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/index.js.map +0 -1
  718. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/performance.d.ts +0 -5
  719. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/performance.js +0 -20
  720. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/performance.js.map +0 -1
  721. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/sdk-info.d.ts +0 -8
  722. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/sdk-info.js +0 -29
  723. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/browser/sdk-info.js.map +0 -1
  724. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/index.d.ts +0 -2
  725. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/index.js +0 -27
  726. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/index.js.map +0 -1
  727. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/environment.d.ts +0 -40
  728. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/environment.js +0 -104
  729. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/environment.js.map +0 -1
  730. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/globalThis.d.ts +0 -3
  731. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/globalThis.js +0 -22
  732. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/globalThis.js.map +0 -1
  733. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/index.d.ts +0 -5
  734. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/index.js +0 -30
  735. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/index.js.map +0 -1
  736. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/performance.d.ts +0 -5
  737. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/performance.js +0 -21
  738. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/performance.js.map +0 -1
  739. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/sdk-info.d.ts +0 -8
  740. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/sdk-info.js +0 -29
  741. package/dist/server/node_modules/@opentelemetry/core/build/src/platform/node/sdk-info.js.map +0 -1
  742. package/dist/server/node_modules/@opentelemetry/core/build/src/propagation/composite.d.ts +0 -43
  743. package/dist/server/node_modules/@opentelemetry/core/build/src/propagation/composite.js +0 -81
  744. package/dist/server/node_modules/@opentelemetry/core/build/src/propagation/composite.js.map +0 -1
  745. package/dist/server/node_modules/@opentelemetry/core/build/src/semconv.d.ts +0 -9
  746. package/dist/server/node_modules/@opentelemetry/core/build/src/semconv.js +0 -32
  747. package/dist/server/node_modules/@opentelemetry/core/build/src/semconv.js.map +0 -1
  748. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/TraceState.d.ts +0 -22
  749. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/TraceState.js +0 -103
  750. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/TraceState.js.map +0 -1
  751. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.d.ts +0 -26
  752. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.js +0 -104
  753. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.js.map +0 -1
  754. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.d.ts +0 -18
  755. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.js +0 -37
  756. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.js.map +0 -1
  757. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.d.ts +0 -5
  758. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.js +0 -33
  759. package/dist/server/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.js.map +0 -1
  760. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/callback.d.ts +0 -14
  761. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/callback.js +0 -52
  762. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/callback.js.map +0 -1
  763. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/configuration.d.ts +0 -7
  764. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/configuration.js +0 -46
  765. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/configuration.js.map +0 -1
  766. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/lodash.merge.d.ts +0 -30
  767. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/lodash.merge.js +0 -157
  768. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/lodash.merge.js.map +0 -1
  769. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/merge.d.ts +0 -6
  770. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/merge.js +0 -162
  771. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/merge.js.map +0 -1
  772. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/promise.d.ts +0 -10
  773. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/promise.js +0 -40
  774. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/promise.js.map +0 -1
  775. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/timeout.d.ts +0 -17
  776. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/timeout.js +0 -56
  777. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/timeout.js.map +0 -1
  778. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/url.d.ts +0 -8
  779. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/url.js +0 -45
  780. package/dist/server/node_modules/@opentelemetry/core/build/src/utils/url.js.map +0 -1
  781. package/dist/server/node_modules/@opentelemetry/core/build/src/version.d.ts +0 -2
  782. package/dist/server/node_modules/@opentelemetry/core/build/src/version.js +0 -21
  783. package/dist/server/node_modules/@opentelemetry/core/build/src/version.js.map +0 -1
  784. package/dist/server/node_modules/@opentelemetry/core/package.json +0 -93
@@ -1,4 +1,4 @@
1
- import{s as ce,b as Ut,u as fi,z as bn,D as yn,j as n,B as ie,x as re,r as A,o as jt,f as Qe,l as Vt,G as Xt,F as Zt,t as B,K as Ae,e as M,Q as pi,R as hi,c as q,a as vn,g as wn,d as jn,an as At,H as He,J as tt,E as gi,P as An,ao as ls,ap as Mn,aq as xi,n as Sn,y as cs,ar as bi,as as ds,at as yi,au as Fe,av as en,aw as vi,ax as tn,ay as wi,az as ji,aA as Ai,aB as Si,w as ki,aC as _i,aD as Ci,aE as Ni,aF as Ii}from"./index-DWdZCQc-.js";import{b as Ue,a as Oe,c as $e,d as ze,e as Ot,D as us}from"./dialog-Doi9ytUK.js";import{S as Ti}from"./switch-zT1zi1kQ.js";import{I as Te}from"./input-9xa5zvbW.js";import{b as kn,u as Ri}from"./use-connection-gqwIMzi8.js";import{S as St,u as qe,W as Vs,g as _n,i as Fn,c as Pi}from"./constants-C3zA8qHe.js";import{a as Ei,c as Di}from"./lean-canvas-recruit-modal-Du8EzSsE.js";import{a as Cn}from"./use-navigate-to-agent-ByWVCNuu.js";import{q as Li,A as Nn,K as ms,J as Mi,L as fs,a as Fi,M as Ui,N as ps,m as Oi,O as $i,P as zi,H as hs}from"./agent-icon-CZh57Qne.js";import{t as Bi,e as qi,b as $t,u as zt,g as Ki,z as Yi,a as Wi,h as Gi,i as Qi,w as Hi,A as Ji,j as Xi,k as Zi}from"./chat-context-CZ_Mu36q.js";import{b as Bt,a as qt,c as Kt,D as Yt,d as eo,e as to,f as no}from"./drawer-Co0RKEhu.js";import{u as Wt,b as mt,T as ft,a as pt,c as un}from"./tooltip-DfT_j861.js";import{I as gs}from"./integration-icon-yGmwrmvF.js";import{a as xs,b as so,u as io}from"./use-virtual-mcp-DWh4bxBq.js";import{u as bs}from"./use-tasks-BfdodVQE.js";import{r as ys,i as oo}from"./shell-layout-DXnu_jyv.js";import{h as ro,j as Gt,k as Ge,l as ao,s as In,t as lo,m as co,n as uo,o as Vo,q as xt,u as mo,v as fo,c as po,S as ho,w as go,x as Un}from"./pair-DueHqlQe.js";import{a as xo,c as vs}from"./ZapSquare-DxkSPBC2.js";import{i as ws}from"./ChevronRight-jaz2OPsY.js";import{S as Pt}from"./spinner-B20oQJ-M.js";import{C as js}from"./collection-search-BsVzk8FO.js";import{u as bo,g as Tn,a as yo,c as vo,l as Et}from"./tabs-DPGWJZb6.js";import{F as we,b as me,c as Ie,d as fe,f as pe,a as bt}from"./form-eoUJY8jH.js";import{s as wo,i as jo}from"./XClose-DZPI8gND.js";import{i as yt}from"./Check-D31wS9ly.js";import{s as ht}from"./Star01-TF4tlZgw.js";import{t as Ao,a as As}from"./Tool01-BfW8LS_A.js";import{i as Ss}from"./Lock01-Dbw9pcO9.js";import{s as ks}from"./Plus-CVgmWk0g.js";import{f as nn,d as _s,t as Vn,g as So,b as ko}from"./XCircle-Dea1iai_.js";import{i as ct}from"./X-BLb58Csk.js";import{i as Cs}from"./AlertCircle-B-zXlYEF.js";import{S as Ns,a as Is,b as Ts,c as Rs,d as st}from"./select-XbJVHQj5.js";import{i as _o}from"./RefreshCcw01-CmAvwlz8.js";import{t as Co}from"./ChevronDown-CHdzn9U5.js";import{T as Ps,a as Dt}from"./toggle-group-DjJ0AjEg.js";import{u as No}from"./use-ai-providers-DhNztqgn.js";import{m as Qt,g as Io,i as To,a as Es,N as Ro}from"./select-model-a0ug8n7z.js";import{c as it,a as Ds,b as Ls,D as Ms,d as Po,e as Eo,f as Do}from"./dropdown-menu-D8r4Uxla.js";import{u as Ht,P as mn,a as Lo,b as Mo,c as Fo,E as Uo,i as Oo,d as $o}from"./index-BdxXn3gu.js";import{S as zo}from"./index-Cv6xzz4K.js";import{r as Fs,l as gt}from"./types-BDdsdv9K.js";import{p as Bo,q as On}from"./question-004-sINsf4GQ.js";import{g as qo}from"./connection-slug-eyAPH6o3.js";import{u as Us,a as Os,g as Ko,C as sn}from"./connection-card-D5dw_oiA.js";import{C as Yo}from"./collection-tabs-mT-YEV4B.js";import{g as Wo}from"./constants-IjhuLFaQ.js";import{T as Go}from"./textarea-DQXLFt5H.js";import{n as Tt}from"./Container-JDAraDwC.js";import{c as Qo,i as Ct,a as $n,E as Ho,p as Jo,b as Xo,d as Zo}from"./connection-form-helpers-lIirWgoR.js";import{u as zn}from"./use-infinite-scroll-BHZ9RTFs.js";import{u as er}from"./useSuspenseInfiniteQuery-fA7ZS8le.js";import{g as tr,e as nr,a as sr}from"./extract-connection-data-Dqnzibzo.js";import{B as Nt}from"./badge-c6NmzIqX.js";function ir({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ce(),{data:o}=Ut.useSession(),{stdioEnabled:r}=fi(),a=Wt(),c=kn(),l=Us(),V=Os(l,"").items,d=bn({resolver:yn(Qo),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=Ct({uiType:m,connectionUrl:f??"",npxPackage:y??""})??$n({uiType:m,connectionUrl:f??"",registryItems:V}),p=j=>{const x=j.trim();if(!x)return;const w=!!d.formState.dirtyFields.title,P=!!d.formState.dirtyFields.description,E=!!d.formState.dirtyFields.env_vars,N=k=>{if(k&&(!w&&!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})}},I=Jo(x);if(I&&r){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),N(Ct({uiType:"NPX",npxPackage:I.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}),N(Ct({uiType:k,connectionUrl:x})??$n({uiType:k,connectionUrl:x,registryItems:V}));return}m==="NPX"&&N(Ct({uiType:"NPX",npxPackage:x}))},v=j=>{j||d.reset(),e(j)},h=async j=>{let x,w=null,P=null,E=null;j.ui_type==="NPX"?(x="STDIO",w="",E=Xo(j.npx_package||"",j.env_vars||[])):j.ui_type==="STDIO"?(x="STDIO",w="",E=Zo(j.stdio_command||"",j.stdio_args||"",j.stdio_cwd,j.env_vars||[])):(x=j.ui_type,w=j.connection_url||"",P=j.connection_token||null);const N=Wo("conn");try{await c.create.mutateAsync({id:N,title:j.title,description:j.description||null,connection_type:x,connection_url:w,connection_token:P,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:i.id,icon:j.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?.(N)}catch{re.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(we,{control:d.control,name:"ui_type",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Type *"}),n.jsxs(Ns,{value:j.value,onValueChange:j.onChange,children:[n.jsx(fe,{children:n.jsx(Is,{children:n.jsx(Ts,{})})}),n.jsxs(Rs,{children:[n.jsx(st,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(st,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(st,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"Websocket"]})}),r&&n.jsxs(n.Fragment,{children:[n.jsx(st,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Tt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(st,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Li,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(pe,{})]})}),m==="NPX"&&n.jsx(we,{control:d.control,name:"npx_package",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"NPM Package *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"@perplexity-ai/mcp-server",...j,value:j.value??"",onPaste:x=>{const w=x.clipboardData.getData("text");w&&(x.preventDefault(),d.setValue("npx_package",w.trim(),{shouldDirty:!0}),p(w))},onBlur:x=>{p(x.target.value),j.onBlur()}})}),n.jsx(pe,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(we,{control:d.control,name:"stdio_command",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Command *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"node, bun, python...",...j,value:j.value??""})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"stdio_args",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Arguments"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"arg1 arg2 --flag value",...j,value:j.value??""})}),n.jsx(pe,{})]})})]}),n.jsx(we,{control:d.control,name:"stdio_cwd",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Working Directory"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"/path/to/project (optional)",...j,value:j.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(pe,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(we,{control:d.control,name:"env_vars",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Environment Variables"}),n.jsx(fe,{children:n.jsx(Ho,{value:j.value??[],onChange:j.onChange})}),n.jsx(pe,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(we,{control:d.control,name:"connection_url",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"URL *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"https://example.com/mcp",...j,value:j.value??"",onPaste:x=>{const w=x.clipboardData.getData("text");w&&(x.preventDefault(),d.setValue("connection_url",w.trim(),{shouldDirty:!0}),p(w))},onBlur:x=>{p(x.target.value),j.onBlur()}})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"connection_token",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:g?.token?.label??"Token (optional)"}),n.jsx(fe,{children:n.jsx(Te,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...j,value:j.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(pe,{})]})})]}),n.jsx(we,{control:d.control,name:"title",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Name *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"My Connection",...j})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"description",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Description"}),n.jsx(fe,{children:n.jsx(Go,{placeholder:"A brief description of this connection",rows:3,...j,value:j.value??""})}),n.jsx(pe,{})]})})]});return a?n.jsx(Bt,{open:t,onOpenChange:v,children:n.jsxs(qt,{className:"max-h-[90vh]",children:[n.jsx(Kt,{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(Yt,{children:b}),n.jsx(eo,{className:"mt-1",children:S})]}),n.jsx(to,{asChild:!0,children:n.jsx(ie,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(wo,{size:16})})})]})}),n.jsx(bt,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:_}),n.jsx(no,{children:n.jsx(ie,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:C})})]})})]})}):n.jsx(Ue,{open:t,onOpenChange:v,children:n.jsxs(Oe,{className:"sm:max-w-[525px]",children:[n.jsxs($e,{children:[n.jsx(ze,{children:b}),n.jsx(Ot,{children:S})]}),n.jsx(bt,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:_}),n.jsxs(us,{children:[n.jsx(ie,{type:"button",variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(ie,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:C})]})]})})]})})}function or(t){const e=M.c(73),{mode:s,agentId:i,addedConnectionIds:o,onAdd:r,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}=ce(),p=A.useDeferredValue(u),v=u!==p,h=p.trim().toLowerCase();let b;e[0]!==y?(b=$=>$??y,e[0]=y,e[1]=b):b=e[1];const[S,C]=pi(hi.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),b);let _;e[2]!==S||e[3]!==C?(_=$=>{$!==S&&B("connections_dialog_tab_changed",{to_tab:$}),C($)},e[2]=S,e[3]=C,e[4]=_):_=e[4];const j=_;let x;e[5]!==g.id||e[6]!==g.slug?(x={connectionId:St,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=x):x=e[7];const w=qe(x);let P,E,N;if(e[8]!==w||e[9]!==p||e[10]!==g.id){N=p?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:p.trim()},{field:["description"],operator:"contains",value:p.trim()}]}:void 0;const $={...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},te=JSON.stringify($);E=er,P=Ae.collectionListInfinite(w,g.id,"","CONNECTIONS",te),e[8]=w,e[9]=p,e[10]=g.id,e[11]=P,e[12]=E,e[13]=N}else P=e[11],E=e[12],N=e[13];let I;e[14]!==w||e[15]!==N?(I=async $=>{const{pageParam:te}=$,de=te===void 0?0:te;return(await w.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:de}})).structuredContent},e[14]=w,e[15]=N,e[16]=I):I=e[16];let k;e[17]!==P||e[18]!==I?(k={queryKey:P,queryFn:I,initialPageParam:0,getNextPageParam:ur,staleTime:3e4},e[17]=P,e[18]=I,e[19]=k):k=e[19];const{data:R,fetchNextPage:L,hasNextPage:D,isFetchingNextPage:T}=E(k),F=R?.pages.flatMap(dr)??[],U=Ko(F),O=new Set(F.filter(cr).map(lr)),K=Us(),W=Os(K,p),H=zn(W.loadMore,W.hasMore,W.isLoadingMore),Q=zn(L,D??!1,T),z=S==="all"||!!h,J=z?W.items.filter($=>{const te=tr($);if(te&&O.has(te))return!1;if(!h)return!0;const de=$._meta?.["mcp.mesh"];return[$.title,$.description,$.name,$.server?.title,$.server?.description,$.server?.name,de?.friendly_name,de?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],Y=J.filter(ar),X=J.filter(rr);let se;e[20]!==o?(se=$=>$.some(te=>o.has(te.id)),e[20]=o,e[21]=se):se=e[21];const G=se;let oe;e[22]!==o||e[23]!==i||e[24]!==l||e[25]!==G||e[26]!==f||e[27]!==r||e[28]!==d||e[29]!==a?(oe=($,te,de,Ne,ye)=>{const Be=G(ye),ve=ye.find(Ve=>!o.has(Ve.id)),le=ye[0];if(f==="browse"){const Ve=qo(le);return n.jsx(sn,{connection:{title:te,icon:de,description:ye.length>1?`${ye.length} instances`:Ne??void 0},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Nt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(yt,{size:11})," Connected"]}),onClick:()=>{B("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:ye.length}),d?.(Ve)}},$)}return n.jsx(sn,{connection:{title:te,icon:de,description:Ne},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[Be&&n.jsxs(Nt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(yt,{size:11})," Added"]}),n.jsx(ie,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Ve=>{Ve.stopPropagation(),ve?(B("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:ve.id}),i&&B("agent_connection_attached",{agent_id:i,connection_id:ve.id,app_name:le.app_name??null,mode:"existing"}),r(ve.id)):(B("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},$)},e[22]=o,e[23]=i,e[24]=l,e[25]=G,e[26]=f,e[27]=r,e[28]=d,e[29]=a,e[30]=oe):oe=e[30];const Z=oe;let ae;e[31]!==l||e[32]!==f||e[33]!==c?(ae=$=>{const te=$._meta?.["mcp.mesh"],de=te?.friendlyName||te?.friendly_name||$.server?.title||$.title||$.server?.name||$.name||$.id||"",Ne=$.server?.description||$.description||null,ye=$.server?.icons?.[0]?.src||sr($.server?.repository)||null,Be=te?.official===!0,ve=te?.verified===!0,le=te?.owner==="deco";return n.jsx(sn,{connection:{title:de,description:Ne,icon:ye},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(mt,{children:[n.jsx(ft,{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(pt,{children:"Built and maintained by Deco"})]}),!le&&Be&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Nt,{variant:"outline",size:"icon",children:n.jsx(nn,{})})}),n.jsx(pt,{children:"Built and maintained by the official vendor"})]}),!le&&!Be&&ve&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Nt,{variant:"outline",size:"icon",children:n.jsx(nn,{})})}),n.jsx(pt,{children:"Verified by the Deco team"})]}),n.jsx(ie,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Ve=>{Ve.stopPropagation(),B("connection_add_clicked",{action:"connect_new",registry_item_id:$.id,app_name:te?.friendlyName||$.server?.name||$.name||null}),c($)},children:l===$.id?n.jsx(Vt,{size:14,className:"animate-spin"}):f==="browse"?"Connect":"Add"})]})},`catalog-${$.id}`)},e[31]=l,e[32]=f,e[33]=c,e[34]=ae):ae=e[34];const je=ae,ee=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(Yo,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:S,onTabChange:$=>j($)}),n.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{B("connections_dialog_custom_clicked"),V()},children:[n.jsx(ks,{size:12}),"Custom Connection"]})]}),ue=v&&"opacity-50 pointer-events-none";let Re;e[35]!==ue?(Re=q("flex-1 overflow-auto p-5 transition-opacity duration-150",ue),e[35]=ue,e[36]=Re):Re=e[36];const Ke="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Ye;e[37]!==Z?(Ye=$=>{if($.type==="group")return Z($.key,$.title,$.icon,null,$.connections);const te=$.connection;return Z(te.id,te.title,te.icon,te.description??null,[te])},e[37]=Z,e[38]=Ye):Ye=e[38];const Pe=U.map(Ye);let he;e[39]!==Q?(he=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=he):he=e[40];let ke;e[41]!==T?(ke=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=ke):ke=e[42];const Ee=z&&Y.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(nn,{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"})]}),De=z&&Y.map(je),Xe=z&&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"})]}),Le=z&&X.map(je);let Me;e[43]!==H||e[44]!==K||e[45]!==z?(Me=z&&K.length>0&&n.jsx("div",{ref:H,className:"col-span-full h-1"}),e[43]=H,e[44]=K,e[45]=z,e[46]=Me):Me=e[46];let ge;e[47]!==W.isLoadingMore||e[48]!==z?(ge=z&&W.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=W.isLoadingMore,e[48]=z,e[49]=ge):ge=e[49];let xe;e[50]!==Pe||e[51]!==he||e[52]!==ke||e[53]!==Ee||e[54]!==De||e[55]!==Xe||e[56]!==Le||e[57]!==Me||e[58]!==ge?(xe=n.jsxs("div",{className:Ke,children:[Pe,he,ke,Ee,De,Xe,Le,Me,ge]}),e[50]=Pe,e[51]=he,e[52]=ke,e[53]=Ee,e[54]=De,e[55]=Xe,e[56]=Le,e[57]=Me,e[58]=ge,e[59]=xe):xe=e[59];let _e;e[60]!==S||e[61]!==U.length||e[62]!==X||e[63]!==u||e[64]!==Y?(_e=U.length===0&&Y.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]=U.length,e[62]=X,e[63]=u,e[64]=Y,e[65]=_e):_e=e[65];let be;e[66]!==Re||e[67]!==xe||e[68]!==_e?(be=n.jsxs("div",{className:Re,children:[xe,_e]}),e[66]=Re,e[67]=xe,e[68]=_e,e[69]=be):be=e[69];let Ce;return e[70]!==ee||e[71]!==be?(Ce=n.jsxs(n.Fragment,{children:[ee,be]}),e[70]=ee,e[71]=be,e[72]=Ce):Ce=e[72],Ce}function rr(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function ar(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function lr(t){return t.app_name}function cr(t){return t.app_name}function dr(t){return t?.items??[]}function ur(t,e){if(t?.hasMore)return e.reduce(Vr,0)}function Vr(t,e){return t+(e?.items?.length??0)}function mr({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...o}){const r=o.mode??"add",a="agentId"in o?o.agentId:void 0,c="addedConnectionIds"in o?o.addedConnectionIds??new Set:new Set,l="onAdd"in o&&o.onAdd?o.onAdd:x=>{},u=(x,w,P)=>{a&&B("agent_connection_attached",{agent_id:a,connection_id:x,app_name:w,mode:P})},[V,d]=A.useState(null),[m,f]=A.useState(i),[y,g]=A.useState(!1),{org:p}=ce(),{data:v}=Ut.useSession(),h=kn(),b=jt(),S=Qe(),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)})`,N=(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,I=new URL(`/api/${p.slug}/mcp/${N}`,window.location.origin),k=await Xt({url:I.href,token:null,orgId:p.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:R,tokenInfo:L,error:D}=await Zt({connectionId:N,orgSlug:p.slug,scope:"offline_access"});if(D||!R){B("connection_oauth_failed",{connection_id:N,flow:"clone",error:D??"no_token"}),re.error(`Authentication failed: ${D??"no token received"}`),await h.delete.mutateAsync(N);return}if(B("connection_oauth_succeeded",{connection_id:N,flow:"clone"}),L)try{(await fetch(`/api/${p.slug}/connections/${N}/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:N,data:{}}):await h.update.mutateAsync({id:N,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:N,data:{connection_token:R}})}else await h.update.mutateAsync({id:N,data:{connection_token:R}});await b.invalidateQueries({queryKey:Ae.isMCPAuthenticated(I.href,null)})}u(N,x.app_name??null,"clone"),l(N)}catch(w){console.error("Failed to add connection:",w),re.error("Failed to add connection")}finally{d(null)}},j=async x=>{if(!(!p||!v?.user?.id)){d(x.id);try{const w=nr(x,p.id,v.user.id,{remoteIndex:0}),P=w.connection_type==="STDIO",E=!!w.connection_url,N=P&&w.connection_headers&&typeof w.connection_headers=="object"&&"command"in w.connection_headers;if(!E&&!N){re.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:I}=await h.create.mutateAsync(w),k=new URL(`/api/${p.slug}/mcp/${I}`,window.location.origin),R=await Xt({url:k.href,token:null,orgId:p.id});if(R.supportsOAuth&&!R.isAuthenticated){const{token:L,tokenInfo:D,error:T}=await Zt({connectionId:I,orgSlug:p.slug,scope:"offline_access"});if(T||!L){B("connection_oauth_failed",{connection_id:I,flow:"connect_new",error:T??"no_token"}),re.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(I,w.app_name??null,"new"),l(I);return}if(B("connection_oauth_succeeded",{connection_id:I,flow:"connect_new"}),D)try{(await fetch(`/api/${p.slug}/connections/${I}/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:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:L}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:L}})}else await h.update.mutateAsync({id:I,data:{connection_token:L}});await b.invalidateQueries({queryKey:Ae.isMCPAuthenticated(k.href,null)}),re.success("Connected and authenticated")}else re.success("Connected");u(I,w.app_name??null,"new"),l(I)}catch(w){console.error("Failed to connect:",w),re.error("Failed to connect")}finally{d(null)}}};return n.jsxs(Ue,{open:t,onOpenChange:e,children:[n.jsxs(Oe,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx($e,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(ze,{className:"text-base font-semibold",children:r==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(js,{value:m,onChange:f,placeholder:"Search connections..."})}),n.jsx(A.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(or,{mode:r,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:_,onConnectAndAdd:j,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:C,defaultTab:s})})]}),n.jsx(ir,{open:y,onOpenChange:g,onCreated:async x=>{g(!1);const w=new URL(`/api/${p.slug}/mcp/${x}`,window.location.origin),P=await Xt({url:w.href,token:null,orgId:p.id});if(P.supportsOAuth&&!P.isAuthenticated){const{token:E,tokenInfo:N,error:I}=await Zt({connectionId:x,orgSlug:p.slug,scope:"offline_access"});if(I||!E){B("connection_oauth_failed",{connection_id:x,flow:"custom_create",error:I??"no_token"}),re.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. (${I??"no token received"})`}),u(x,null,"custom"),l(x),e(!1);return}if(B("connection_oauth_succeeded",{connection_id:x,flow:"custom_create"}),N)try{(await fetch(`/api/${p.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:N.accessToken,refreshToken:N.refreshToken,expiresIn:N.expiresIn,scope:N.scope,clientId:N.clientId,clientSecret:N.clientSecret,tokenEndpoint:N.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:Ae.isMCPAuthenticated(w.href,null)})}u(x,null,"custom"),l(x),e(!1)}})]})}const fr='# 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',pr='# 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',hr=`# Performance Watchdog
1
+ import{s as ce,b as Ut,u as po,z as bn,D as yn,j as n,B as oe,x as re,r as A,o as jt,f as Qe,l as Vt,G as Xt,F as Zt,t as B,K as Ae,e as M,Q as ho,R as go,c as q,a as vn,g as wn,d as jn,an as At,H as He,J as tt,E as xo,P as An,ao as ls,ap as Mn,aq as bo,n as Sn,y as cs,ar as yo,as as ds,at as vo,au as Fe,av as en,aw as wo,ax as tn,ay as jo,az as Ao,aA as So,aB as ko,w as _o,aC as Co,aD as No,aE as Io,aF as To}from"./index-BS-gVIfq.js";import{b as Ue,a as Oe,c as $e,d as ze,e as Ot,D as us}from"./dialog-DW6W2xmo.js";import{S as Ro}from"./switch-DbODMya7.js";import{I as Te}from"./input-Bnp88QZ_.js";import{b as kn,u as Po}from"./use-connection-CYWI6QMK.js";import{S as St,u as qe,W as Vs,g as _n,i as Fn,c as Eo}from"./constants-DGtNAIT7.js";import{a as Do,c as Lo}from"./lean-canvas-recruit-modal-Bm-BjQi1.js";import{a as Cn}from"./use-navigate-to-agent-Da1f5G7L.js";import{q as Mo,A as Nn,K as ms,J as Fo,L as fs,a as Uo,M as Oo,N as ps,m as $o,O as zo,P as Bo,H as hs}from"./agent-icon-CaP8Iah4.js";import{t as qo,e as Ko,b as $t,u as zt,g as Wo,z as Yo,a as Go,h as Qo,i as Ho,w as Jo,A as Xo,j as Zo,k as ei}from"./chat-context-CjvUdGWS.js";import{b as Bt,a as qt,c as Kt,D as Wt,d as ti,e as ni,f as si}from"./drawer-DpU0-uSN.js";import{u as Yt,b as mt,T as ft,a as pt,c as un}from"./tooltip-eDEazI1f.js";import{I as gs}from"./integration-icon-DyfaeoGN.js";import{a as xs,b as oi,u as ii}from"./use-virtual-mcp-B3xI7Opb.js";import{u as bs}from"./use-tasks-Dm7kwVF-.js";import{r as ys,i as ri}from"./shell-layout-xFjv9Tup.js";import{h as ai,j as Gt,k as Ge,l as li,s as In,t as ci,m as di,n as ui,o as Vi,q as xt,u as mi,v as fi,c as pi,S as hi,w as gi,x as Un}from"./pair-CpXOCIMQ.js";import{a as xi,c as vs}from"./ZapSquare-BFFu4owk.js";import{i as ws}from"./ChevronRight-Ca4zRaIb.js";import{S as Pt}from"./spinner-Cyd__3qS.js";import{C as js}from"./collection-search-DkrAcRrb.js";import{u as bi,g as Tn,a as yi,c as vi,l as Et}from"./tabs-CFhNcgi3.js";import{F as we,b as me,c as Ie,d as fe,f as pe,a as bt}from"./form-CM9bDTrj.js";import{s as wi,i as ji}from"./XClose-DOpoziBg.js";import{i as yt}from"./Check-DKiijWcP.js";import{s as ht}from"./Star01-15V0wLt0.js";import{t as Ai,a as As}from"./Tool01-BFjYTDOI.js";import{i as Ss}from"./Lock01-DeVe8o60.js";import{s as ks}from"./Plus-CYJr04Zy.js";import{f as nn,d as _s,t as Vn,g as Si,b as ki}from"./XCircle-4hBXWc9o.js";import{i as ct}from"./X-CIaGajwH.js";import{i as Cs}from"./AlertCircle-BKs-Tk9h.js";import{S as Ns,a as Is,b as Ts,c as Rs,d as st}from"./select-BeiVpWJO.js";import{i as _i}from"./RefreshCcw01-DfoX5B9c.js";import{t as Ci}from"./ChevronDown--Y3EvXYp.js";import{T as Ps,a as Dt}from"./toggle-group-pQ_FIeMw.js";import{u as Ni}from"./use-ai-providers-DPlKbjfN.js";import{m as Qt,g as Ii,i as Ti,a as Es,N as Ri}from"./select-model-uM0zdmom.js";import{a as Ds,c as ot,b as Ls,D as Ms,d as Pi,e as Ei,f as Di}from"./dropdown-menu-DGtcKrXj.js";import{u as Ht,P as mn,a as Li,b as Mi,c as Fi,E as Ui,i as Oi,d as $i}from"./index-BZ76ysow.js";import{S as zi}from"./index-C_RdQhkF.js";import{r as Fs,l as gt}from"./types-FLjr0VG3.js";import{p as Bi,q as On}from"./question-004-sINsf4GQ.js";import{g as qi}from"./connection-slug-eyAPH6o3.js";import{u as Us,a as Os,g as Ki,C as sn}from"./connection-card-BwR9eG7C.js";import{C as Wi}from"./collection-tabs-B_L4D5-3.js";import{g as Yi}from"./constants-BktC-2Id.js";import{T as Gi}from"./textarea-gYtsbOm3.js";import{n as Tt}from"./Container-DexpTeBC.js";import{c as Qi,i as Ct,a as $n,E as Hi,p as Ji,b as Xi,d as Zi}from"./connection-form-helpers-H5EboxJB.js";import{u as zn}from"./use-infinite-scroll-VIF4xHYD.js";import{u as er}from"./useSuspenseInfiniteQuery-DPcxp7id.js";import{g as tr,e as nr,a as sr}from"./extract-connection-data-TbblmvZm.js";import{B as Nt}from"./badge-DSaHi9qU.js";function or({open:t,onOpenChange:e,onCreated:s}){const{org:o}=ce(),{data:i}=Ut.useSession(),{stdioEnabled:r}=po(),a=Yt(),c=kn(),l=Us(),V=Os(l,"").items,d=bn({resolver:yn(Qi),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=Ct({uiType:m,connectionUrl:f??"",npxPackage:y??""})??$n({uiType:m,connectionUrl:f??"",registryItems:V}),p=j=>{const x=j.trim();if(!x)return;const w=!!d.formState.dirtyFields.title,P=!!d.formState.dirtyFields.description,E=!!d.formState.dirtyFields.env_vars,N=k=>{if(k&&(!w&&!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})}},I=Ji(x);if(I&&r){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),N(Ct({uiType:"NPX",npxPackage:I.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}),N(Ct({uiType:k,connectionUrl:x})??$n({uiType:k,connectionUrl:x,registryItems:V}));return}m==="NPX"&&N(Ct({uiType:"NPX",npxPackage:x}))},v=j=>{j||d.reset(),e(j)},h=async j=>{let x,w=null,P=null,E=null;j.ui_type==="NPX"?(x="STDIO",w="",E=Xi(j.npx_package||"",j.env_vars||[])):j.ui_type==="STDIO"?(x="STDIO",w="",E=Zi(j.stdio_command||"",j.stdio_args||"",j.stdio_cwd,j.env_vars||[])):(x=j.ui_type,w=j.connection_url||"",P=j.connection_token||null);const N=Yi("conn");try{await c.create.mutateAsync({id:N,title:j.title,description:j.description||null,connection_type:x,connection_url:w,connection_token:P,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:i?.user?.id||"system",organization_id:o.id,icon:j.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?.(N)}catch{re.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(we,{control:d.control,name:"ui_type",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Type *"}),n.jsxs(Ns,{value:j.value,onValueChange:j.onChange,children:[n.jsx(fe,{children:n.jsx(Is,{children:n.jsx(Ts,{})})}),n.jsxs(Rs,{children:[n.jsx(st,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(st,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(st,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ht,{className:"w-4 h-4"}),"Websocket"]})}),r&&n.jsxs(n.Fragment,{children:[n.jsx(st,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Tt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(st,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mo,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(pe,{})]})}),m==="NPX"&&n.jsx(we,{control:d.control,name:"npx_package",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"NPM Package *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"@perplexity-ai/mcp-server",...j,value:j.value??"",onPaste:x=>{const w=x.clipboardData.getData("text");w&&(x.preventDefault(),d.setValue("npx_package",w.trim(),{shouldDirty:!0}),p(w))},onBlur:x=>{p(x.target.value),j.onBlur()}})}),n.jsx(pe,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(we,{control:d.control,name:"stdio_command",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Command *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"node, bun, python...",...j,value:j.value??""})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"stdio_args",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Arguments"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"arg1 arg2 --flag value",...j,value:j.value??""})}),n.jsx(pe,{})]})})]}),n.jsx(we,{control:d.control,name:"stdio_cwd",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Working Directory"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"/path/to/project (optional)",...j,value:j.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(pe,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(we,{control:d.control,name:"env_vars",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Environment Variables"}),n.jsx(fe,{children:n.jsx(Hi,{value:j.value??[],onChange:j.onChange})}),n.jsx(pe,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(we,{control:d.control,name:"connection_url",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"URL *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"https://example.com/mcp",...j,value:j.value??"",onPaste:x=>{const w=x.clipboardData.getData("text");w&&(x.preventDefault(),d.setValue("connection_url",w.trim(),{shouldDirty:!0}),p(w))},onBlur:x=>{p(x.target.value),j.onBlur()}})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"connection_token",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:g?.token?.label??"Token (optional)"}),n.jsx(fe,{children:n.jsx(Te,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...j,value:j.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(pe,{})]})})]}),n.jsx(we,{control:d.control,name:"title",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Name *"}),n.jsx(fe,{children:n.jsx(Te,{placeholder:"My Connection",...j})}),n.jsx(pe,{})]})}),n.jsx(we,{control:d.control,name:"description",render:({field:j})=>n.jsxs(me,{children:[n.jsx(Ie,{children:"Description"}),n.jsx(fe,{children:n.jsx(Gi,{placeholder:"A brief description of this connection",rows:3,...j,value:j.value??""})}),n.jsx(pe,{})]})})]});return a?n.jsx(Bt,{open:t,onOpenChange:v,children:n.jsxs(qt,{className:"max-h-[90vh]",children:[n.jsx(Kt,{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(Wt,{children:b}),n.jsx(ti,{className:"mt-1",children:S})]}),n.jsx(ni,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(wi,{size:16})})})]})}),n.jsx(bt,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:_}),n.jsx(si,{children:n.jsx(oe,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:C})})]})})]})}):n.jsx(Ue,{open:t,onOpenChange:v,children:n.jsxs(Oe,{className:"sm:max-w-[525px]",children:[n.jsxs($e,{children:[n.jsx(ze,{children:b}),n.jsx(Ot,{children:S})]}),n.jsx(bt,{...d,children:n.jsxs("form",{onSubmit:d.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:_}),n.jsxs(us,{children:[n.jsx(oe,{type:"button",variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(oe,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:C})]})]})})]})})}function ir(t){const e=M.c(73),{mode:s,agentId:o,addedConnectionIds:i,onAdd:r,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}=ce(),p=A.useDeferredValue(u),v=u!==p,h=p.trim().toLowerCase();let b;e[0]!==y?(b=$=>$??y,e[0]=y,e[1]=b):b=e[1];const[S,C]=ho(go.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),b);let _;e[2]!==S||e[3]!==C?(_=$=>{$!==S&&B("connections_dialog_tab_changed",{to_tab:$}),C($)},e[2]=S,e[3]=C,e[4]=_):_=e[4];const j=_;let x;e[5]!==g.id||e[6]!==g.slug?(x={connectionId:St,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=x):x=e[7];const w=qe(x);let P,E,N;if(e[8]!==w||e[9]!==p||e[10]!==g.id){N=p?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:p.trim()},{field:["description"],operator:"contains",value:p.trim()}]}:void 0;const $={...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},te=JSON.stringify($);E=er,P=Ae.collectionListInfinite(w,g.id,"","CONNECTIONS",te),e[8]=w,e[9]=p,e[10]=g.id,e[11]=P,e[12]=E,e[13]=N}else P=e[11],E=e[12],N=e[13];let I;e[14]!==w||e[15]!==N?(I=async $=>{const{pageParam:te}=$,de=te===void 0?0:te;return(await w.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:de}})).structuredContent},e[14]=w,e[15]=N,e[16]=I):I=e[16];let k;e[17]!==P||e[18]!==I?(k={queryKey:P,queryFn:I,initialPageParam:0,getNextPageParam:ur,staleTime:3e4},e[17]=P,e[18]=I,e[19]=k):k=e[19];const{data:R,fetchNextPage:L,hasNextPage:D,isFetchingNextPage:T}=E(k),F=R?.pages.flatMap(dr)??[],U=Ki(F),O=new Set(F.filter(cr).map(lr)),K=Us(),Y=Os(K,p),H=zn(Y.loadMore,Y.hasMore,Y.isLoadingMore),Q=zn(L,D??!1,T),z=S==="all"||!!h,J=z?Y.items.filter($=>{const te=tr($);if(te&&O.has(te))return!1;if(!h)return!0;const de=$._meta?.["mcp.mesh"];return[$.title,$.description,$.name,$.server?.title,$.server?.description,$.server?.name,de?.friendly_name,de?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],W=J.filter(ar),X=J.filter(rr);let se;e[20]!==i?(se=$=>$.some(te=>i.has(te.id)),e[20]=i,e[21]=se):se=e[21];const G=se;let ie;e[22]!==i||e[23]!==o||e[24]!==l||e[25]!==G||e[26]!==f||e[27]!==r||e[28]!==d||e[29]!==a?(ie=($,te,de,Ne,ye)=>{const Be=G(ye),ve=ye.find(Ve=>!i.has(Ve.id)),le=ye[0];if(f==="browse"){const Ve=qi(le);return n.jsx(sn,{connection:{title:te,icon:de,description:ye.length>1?`${ye.length} instances`:Ne??void 0},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Nt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(yt,{size:11})," Connected"]}),onClick:()=>{B("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:ye.length}),d?.(Ve)}},$)}return n.jsx(sn,{connection:{title:te,icon:de,description:Ne},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[Be&&n.jsxs(Nt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(yt,{size:11})," Added"]}),n.jsx(oe,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Ve=>{Ve.stopPropagation(),ve?(B("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:ve.id}),o&&B("agent_connection_attached",{agent_id:o,connection_id:ve.id,app_name:le.app_name??null,mode:"existing"}),r(ve.id)):(B("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},$)},e[22]=i,e[23]=o,e[24]=l,e[25]=G,e[26]=f,e[27]=r,e[28]=d,e[29]=a,e[30]=ie):ie=e[30];const Z=ie;let ae;e[31]!==l||e[32]!==f||e[33]!==c?(ae=$=>{const te=$._meta?.["mcp.mesh"],de=te?.friendlyName||te?.friendly_name||$.server?.title||$.title||$.server?.name||$.name||$.id||"",Ne=$.server?.description||$.description||null,ye=$.server?.icons?.[0]?.src||sr($.server?.repository)||null,Be=te?.official===!0,ve=te?.verified===!0,le=te?.owner==="deco";return n.jsx(sn,{connection:{title:de,description:Ne,icon:ye},fallbackIcon:n.jsx(Tt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(mt,{children:[n.jsx(ft,{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(pt,{children:"Built and maintained by Deco"})]}),!le&&Be&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Nt,{variant:"outline",size:"icon",children:n.jsx(nn,{})})}),n.jsx(pt,{children:"Built and maintained by the official vendor"})]}),!le&&!Be&&ve&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Nt,{variant:"outline",size:"icon",children:n.jsx(nn,{})})}),n.jsx(pt,{children:"Verified by the Deco team"})]}),n.jsx(oe,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Ve=>{Ve.stopPropagation(),B("connection_add_clicked",{action:"connect_new",registry_item_id:$.id,app_name:te?.friendlyName||$.server?.name||$.name||null}),c($)},children:l===$.id?n.jsx(Vt,{size:14,className:"animate-spin"}):f==="browse"?"Connect":"Add"})]})},`catalog-${$.id}`)},e[31]=l,e[32]=f,e[33]=c,e[34]=ae):ae=e[34];const je=ae,ee=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(Wi,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:S,onTabChange:$=>j($)}),n.jsxs(oe,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{B("connections_dialog_custom_clicked"),V()},children:[n.jsx(ks,{size:12}),"Custom Connection"]})]}),ue=v&&"opacity-50 pointer-events-none";let Re;e[35]!==ue?(Re=q("flex-1 overflow-auto p-5 transition-opacity duration-150",ue),e[35]=ue,e[36]=Re):Re=e[36];const Ke="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let We;e[37]!==Z?(We=$=>{if($.type==="group")return Z($.key,$.title,$.icon,null,$.connections);const te=$.connection;return Z(te.id,te.title,te.icon,te.description??null,[te])},e[37]=Z,e[38]=We):We=e[38];const Pe=U.map(We);let he;e[39]!==Q?(he=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=he):he=e[40];let ke;e[41]!==T?(ke=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=ke):ke=e[42];const Ee=z&&W.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(nn,{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"})]}),De=z&&W.map(je),Xe=z&&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"})]}),Le=z&&X.map(je);let Me;e[43]!==H||e[44]!==K||e[45]!==z?(Me=z&&K.length>0&&n.jsx("div",{ref:H,className:"col-span-full h-1"}),e[43]=H,e[44]=K,e[45]=z,e[46]=Me):Me=e[46];let ge;e[47]!==Y.isLoadingMore||e[48]!==z?(ge=z&&Y.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=Y.isLoadingMore,e[48]=z,e[49]=ge):ge=e[49];let xe;e[50]!==Pe||e[51]!==he||e[52]!==ke||e[53]!==Ee||e[54]!==De||e[55]!==Xe||e[56]!==Le||e[57]!==Me||e[58]!==ge?(xe=n.jsxs("div",{className:Ke,children:[Pe,he,ke,Ee,De,Xe,Le,Me,ge]}),e[50]=Pe,e[51]=he,e[52]=ke,e[53]=Ee,e[54]=De,e[55]=Xe,e[56]=Le,e[57]=Me,e[58]=ge,e[59]=xe):xe=e[59];let _e;e[60]!==S||e[61]!==U.length||e[62]!==X||e[63]!==u||e[64]!==W?(_e=U.length===0&&W.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]=U.length,e[62]=X,e[63]=u,e[64]=W,e[65]=_e):_e=e[65];let be;e[66]!==Re||e[67]!==xe||e[68]!==_e?(be=n.jsxs("div",{className:Re,children:[xe,_e]}),e[66]=Re,e[67]=xe,e[68]=_e,e[69]=be):be=e[69];let Ce;return e[70]!==ee||e[71]!==be?(Ce=n.jsxs(n.Fragment,{children:[ee,be]}),e[70]=ee,e[71]=be,e[72]=Ce):Ce=e[72],Ce}function rr(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function ar(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function lr(t){return t.app_name}function cr(t){return t.app_name}function dr(t){return t?.items??[]}function ur(t,e){if(t?.hasMore)return e.reduce(Vr,0)}function Vr(t,e){return t+(e?.items?.length??0)}function mr({open:t,onOpenChange:e,defaultTab:s,initialSearch:o="",...i}){const r=i.mode??"add",a="agentId"in i?i.agentId:void 0,c="addedConnectionIds"in i?i.addedConnectionIds??new Set:new Set,l="onAdd"in i&&i.onAdd?i.onAdd:x=>{},u=(x,w,P)=>{a&&B("agent_connection_attached",{agent_id:a,connection_id:x,app_name:w,mode:P})},[V,d]=A.useState(null),[m,f]=A.useState(o),[y,g]=A.useState(!1),{org:p}=ce(),{data:v}=Ut.useSession(),h=kn(),b=jt(),S=Qe(),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)})`,N=(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,I=new URL(`/api/${p.slug}/mcp/${N}`,window.location.origin),k=await Xt({url:I.href,token:null,orgId:p.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:R,tokenInfo:L,error:D}=await Zt({connectionId:N,orgSlug:p.slug,scope:"offline_access"});if(D||!R){B("connection_oauth_failed",{connection_id:N,flow:"clone",error:D??"no_token"}),re.error(`Authentication failed: ${D??"no token received"}`),await h.delete.mutateAsync(N);return}if(B("connection_oauth_succeeded",{connection_id:N,flow:"clone"}),L)try{(await fetch(`/api/${p.slug}/connections/${N}/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:N,data:{}}):await h.update.mutateAsync({id:N,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:N,data:{connection_token:R}})}else await h.update.mutateAsync({id:N,data:{connection_token:R}});await b.invalidateQueries({queryKey:Ae.isMCPAuthenticated(I.href,null)})}u(N,x.app_name??null,"clone"),l(N)}catch(w){console.error("Failed to add connection:",w),re.error("Failed to add connection")}finally{d(null)}},j=async x=>{if(!(!p||!v?.user?.id)){d(x.id);try{const w=nr(x,p.id,v.user.id,{remoteIndex:0}),P=w.connection_type==="STDIO",E=!!w.connection_url,N=P&&w.connection_headers&&typeof w.connection_headers=="object"&&"command"in w.connection_headers;if(!E&&!N){re.error("This MCP Server cannot be connected: no connection method available"),d(null);return}const{id:I}=await h.create.mutateAsync(w),k=new URL(`/api/${p.slug}/mcp/${I}`,window.location.origin),R=await Xt({url:k.href,token:null,orgId:p.id});if(R.supportsOAuth&&!R.isAuthenticated){const{token:L,tokenInfo:D,error:T}=await Zt({connectionId:I,orgSlug:p.slug,scope:"offline_access"});if(T||!L){B("connection_oauth_failed",{connection_id:I,flow:"connect_new",error:T??"no_token"}),re.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(I,w.app_name??null,"new"),l(I);return}if(B("connection_oauth_succeeded",{connection_id:I,flow:"connect_new"}),D)try{(await fetch(`/api/${p.slug}/connections/${I}/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:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:L}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:L}})}else await h.update.mutateAsync({id:I,data:{connection_token:L}});await b.invalidateQueries({queryKey:Ae.isMCPAuthenticated(k.href,null)}),re.success("Connected and authenticated")}else re.success("Connected");u(I,w.app_name??null,"new"),l(I)}catch(w){console.error("Failed to connect:",w),re.error("Failed to connect")}finally{d(null)}}};return n.jsxs(Ue,{open:t,onOpenChange:e,children:[n.jsxs(Oe,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx($e,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(ze,{className:"text-base font-semibold",children:r==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(js,{value:m,onChange:f,placeholder:"Search connections..."})}),n.jsx(A.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(Vt,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(ir,{mode:r,agentId:a,addedConnectionIds:c,onAdd:l,onCloneAndAdd:_,onConnectAndAdd:j,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:C,defaultTab:s})})]}),n.jsx(or,{open:y,onOpenChange:g,onCreated:async x=>{g(!1);const w=new URL(`/api/${p.slug}/mcp/${x}`,window.location.origin),P=await Xt({url:w.href,token:null,orgId:p.id});if(P.supportsOAuth&&!P.isAuthenticated){const{token:E,tokenInfo:N,error:I}=await Zt({connectionId:x,orgSlug:p.slug,scope:"offline_access"});if(I||!E){B("connection_oauth_failed",{connection_id:x,flow:"custom_create",error:I??"no_token"}),re.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. (${I??"no token received"})`}),u(x,null,"custom"),l(x),e(!1);return}if(B("connection_oauth_succeeded",{connection_id:x,flow:"custom_create"}),N)try{(await fetch(`/api/${p.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:N.accessToken,refreshToken:N.refreshToken,expiresIn:N.expiresIn,scope:N.scope,clientId:N.clientId,clientSecret:N.clientSecret,tokenEndpoint:N.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:Ae.isMCPAuthenticated(w.href,null)})}u(x,null,"custom"),l(x),e(!1)}})]})}const fr='# 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',pr='# 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',hr=`# Performance Watchdog
2
2
 
3
3
  You are the **Performance Watchdog**, a specialist agent focused on web performance.
4
4
 
@@ -235,15 +235,15 @@ If there are zero findings, return \`findings: []\` — that is the correct outp
235
235
  - ${t}
236
236
  `},{id:"performance-watchdog",title:"Performance Watchdog",description:"Monitors websites for Core Web Vitals problems.",icon:"icon://Speedometer03?color=emerald",instructions:hr,siteDiagnosticsTools:["fetch_page","pagespeed_insights","crawl_site"],cron:on,issueLabel:"agent:perf",buildSubtaskInput:({siteRootUrl:t})=>`site_root_url: ${t}
237
237
  `},{id:"broken-link-finder",title:"Broken Link Finder",description:"Monitors websites for broken links.",icon:"icon://LinkBroken01?color=rose",instructions:fr,siteDiagnosticsTools:["collect_site_links","check_urls"],cron:on,issueLabel:"agent:links",buildSubtaskInput:({siteRootUrl:t})=>`site_root_url: ${t}
238
- `}],gr=[{id:"log-monitor",title:"Log Monitor",description:"Monitors websites for errors and warnings on the server. Outputs GitHub issues.",icon:"icon://MessageAlertCircle?color=amber"}];function xr(t){const{template:e,specialistAgentId:s,owner:i,repo:o,siteRootUrl:r}=t,a=e.buildSubtaskInput({siteRootUrl:r}),c=e.issueLabel.replace(/^agent:/,""),l=[];return l.push(Ze([We(`Daily ${e.title} run for ${i}/${o}, monitoring ${r}.
238
+ `}],gr=[{id:"log-monitor",title:"Log Monitor",description:"Monitors websites for errors and warnings on the server. Outputs GitHub issues.",icon:"icon://MessageAlertCircle?color=amber"}];function xr(t){const{template:e,specialistAgentId:s,owner:o,repo:i,siteRootUrl:r}=t,a=e.buildSubtaskInput({siteRootUrl:r}),c=e.issueLabel.replace(/^agent:/,""),l=[];return l.push(Ze([Ye(`Daily ${e.title} run for ${o}/${i}, monitoring ${r}.
239
239
 
240
- Your job: call the specialist sub-agent for fresh findings, dedup against the repo's open issues, and either file new issues or comment on existing ones. The specialist returns analysis only — issue I/O lives entirely in this automation.`)])),l.push(Ze([We(`Step 1 — Read current state.
240
+ Your job: call the specialist sub-agent for fresh findings, dedup against the repo's open issues, and either file new issues or comment on existing ones. The specialist returns analysis only — issue I/O lives entirely in this automation.`)])),l.push(Ze([Ye(`Step 1 — Read current state.
241
241
  Call list_issues with:
242
- owner: "${i}"
243
- repo: "${o}"
242
+ owner: "${o}"
243
+ repo: "${i}"
244
244
  labels: ["${e.issueLabel}", "auto-generated"]
245
245
  state: "open"
246
- For each issue, parse the YAML frontmatter at the top of the body and extract { kind, target.route }. This is your "known problems" map.`)])),l.push(Ze([We("Step 2 — Get fresh findings from "),yr({agentId:s,title:e.title}),We(`. Use the subtask tool with that agent and pass exactly this YAML as the prompt:
246
+ For each issue, parse the YAML frontmatter at the top of the body and extract { kind, target.route }. This is your "known problems" map.`)])),l.push(Ze([Ye("Step 2 — Get fresh findings from "),yr({agentId:s,title:e.title}),Ye(`. Use the subtask tool with that agent and pass exactly this YAML as the prompt:
247
247
 
248
248
  ${a.trimEnd()}
249
249
 
@@ -252,11 +252,11 @@ The specialist returns a structured report:
252
252
  summary: { ... }
253
253
  findings:
254
254
  - { kind, severity, target: { url, route }, evidence, impact, suggested_fix }
255
- If findings is empty, the site is healthy for this specialist — skip to Step 5.`)])),l.push(Ze([We(`Step 3 — For each finding, decide what to do based on the known-problems map from Step 1:
255
+ If findings is empty, the site is healthy for this specialist — skip to Step 5.`)])),l.push(Ze([Ye(`Step 3 — For each finding, decide what to do based on the known-problems map from Step 1:
256
256
  • No open issue with the same { kind, target.route } → create a new issue (Step 4).
257
257
  • Open issue exists with same { kind, target.route } → add a comment: "Still present." and include the latest evidence verbatim.
258
258
  • A previously-open issue's { kind, target.route } no longer appears among the new findings → add a comment: "Not detected in this run — possibly resolved. Leaving open for human confirmation." Do NOT close the issue.
259
- When in doubt, prefer commenting over creating. Duplicate issues erode maintainer trust.`)])),l.push(Ze([We(`Step 4 — Issue format. Set once at creation; NEVER edit the body afterwards.
259
+ When in doubt, prefer commenting over creating. Duplicate issues erode maintainer trust.`)])),l.push(Ze([Ye(`Step 4 — Issue format. Set once at creation; NEVER edit the body afterwards.
260
260
  Use issue_write with method: "create" and:
261
261
  title: "[${c}] <short summary> — <route>"
262
262
  labels: ["${e.issueLabel}", "auto-generated", "severity:<low|medium|high>"]
@@ -280,14 +280,14 @@ target:
280
280
  <impact from the specialist>
281
281
 
282
282
  ## Suggested Fix
283
- <suggested_fix from the specialist>`)])),l.push(Ze([We("Step 5 — Wrap up with a one-paragraph summary: how many findings, how many issues created, how many re-detected (commented), how many possibly-resolved (commented).")])),l.push(Ze([We(`Rules:
283
+ <suggested_fix from the specialist>`)])),l.push(Ze([Ye("Step 5 — Wrap up with a one-paragraph summary: how many findings, how many issues created, how many re-detected (commented), how many possibly-resolved (commented).")])),l.push(Ze([Ye(`Rules:
284
284
  • Never edit issue bodies after creation — use comments.
285
285
  • Never close issues automatically. At most, comment "possibly resolved".
286
286
  • Never touch issues that don't have BOTH "${e.issueLabel}" AND "auto-generated" labels.
287
287
  • One issue per { kind, target.route } pair. Dedup uses those two fields from the body frontmatter.
288
288
  • Always normalize route: lowercase host, no trailing slash (except "/"), no query string, no fragment.`)])),{type:"doc",content:l.map((u,V)=>V<l.length-1?br(u):u)}}function br(t){const e=t.content;if(!e||e.length===0)return t;const s=e[e.length-1];return!s||s.type!=="text"||typeof s.text!="string"?t:{...t,content:[...e.slice(0,-1),{...s,text:`${s.text}
289
289
 
290
- `}]}}function Ze(t){return{type:"paragraph",content:t}}function We(t){return{type:"text",text:t}}function yr({agentId:t,title:e}){return{type:"mention",attrs:{id:t,name:e,char:"@",metadata:{agentId:t,title:e}}}}const dt="deco/site-diagnostics";function gu(t){const e=M.c(15),{open:s,onOpenChange:i}=t,[o,r]=A.useState(null);let a;e[0]!==i?(a=()=>{r(null),i(!1)},e[0]=i,e[1]=a):a=e[1];const c=a,l=s&&o===null;let u;e[2]!==o||e[3]!==i?(u=y=>{!y&&o===null&&i(!1)},e[2]=o,e[3]=i,e[4]=u):u=e[4];let V;e[5]!==l||e[6]!==u?(V=n.jsx(Ei,{open:l,onOpenChange:u,title:"Set up self-healing repo",hideAutoRespondCheckbox:!0,onImportComplete:r}),e[5]=l,e[6]=u,e[7]=V):V=e[7];const d=s&&o!==null;let m;e[8]!==c||e[9]!==o||e[10]!==d?(m=n.jsx(vr,{open:d,payload:o,onClose:c}),e[8]=c,e[9]=o,e[10]=d,e[11]=m):m=e[11];let f;return e[12]!==V||e[13]!==m?(f=n.jsxs(n.Fragment,{children:[V,m]}),e[12]=V,e[13]=m,e[14]=f):f=e[14],f}function vr(t){const e=M.c(67),{open:s,payload:i,onClose:o}=t,{org:r}=ce(),a=Cn(),c=kn();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:St,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const u=qe(l),[V,d]=A.useState(""),[m,f]=A.useState(Ar);let y;e[3]!==s?(y={enabled:s},e[3]=s,e[4]=y):y=e[4];const{data:g}=Di(dt,y);let p;e[5]!==c||e[6]!==m||e[7]!==i||e[8]!==u||e[9]!==g||e[10]!==V?(p=async()=>{if(!i)throw new Error("No imported repo payload");const Y=Bn(V);if(!Y)throw new Error("Enter a valid https:// URL");const X=fn.filter(Z=>m[Z.id]);if(X.length===0)return{succeeded:[],failed:[]};const se=await Cr({selfClient:u,createConnection:c.create.mutateAsync,registry:g}),G=[],oe=[];for(const Z of X)try{await Nr({template:Z,selfClient:u,siteDiagnosticsConnectionId:se,projectAgentId:i.virtualMcpId,owner:i.repo.owner,repo:i.repo.name,siteRootUrl:Y}),G.push(Z.title)}catch(ae){const je=ae;console.error(`Failed to set up ${Z.title}:`,je),oe.push(Z.title)}return{succeeded:G,failed:oe}},e[5]=c,e[6]=m,e[7]=i,e[8]=u,e[9]=g,e[10]=V,e[11]=p):p=e[11];let v;e[12]!==a||e[13]!==o||e[14]!==i?.virtualMcpId?(v=Y=>{const{succeeded:X,failed:se}=Y;X.length>0?re.success(`Self-healing repo ready — ${X.length} specialist${X.length>1?"s":""} set up`):se.length===0&&re.success("Repo imported. Add specialists later from automations."),se.length>0&&re.warning(`Could not set up: ${se.join(", ")}. You can add them later from the automations view.`);const G=i?.virtualMcpId;o(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),G&&a(G)},e[12]=a,e[13]=o,e[14]=i?.virtualMcpId,e[15]=v):v=e[15];let h;e[16]!==p||e[17]!==v?(h={mutationFn:p,onSuccess:v,onError:jr},e[16]=p,e[17]=v,e[18]=h):h=e[18];const b=vn(h);let S;e[19]!==b.isPending||e[20]!==V?(S=Bn(V)!==null&&!b.isPending,e[19]=b.isPending,e[20]=V,e[21]=S):S=e[21];const C=S;let _;e[22]!==o||e[23]!==b.isPending?(_=Y=>{!Y&&!b.isPending&&o()},e[22]=o,e[23]=b.isPending,e[24]=_):_=e[24];let j;e[25]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx($e,{className:"h-12 border-b border-border px-4 flex flex-row items-center shrink-0 space-y-0",children:n.jsx(ze,{className:"text-sm font-medium text-foreground",children:"Add specialist monitors"})}),e[25]=j):j=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Specialists run on a daily schedule. Your repo agent collects their findings and opens GitHub issues, then writes the fixes."}),e[26]=x):x=e[26];let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("label",{htmlFor:"self-healing-site-url",className:"text-xs font-medium text-foreground",children:"Production URL"}),e[27]=w):w=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=Y=>d(Y.target.value),e[28]=P):P=e[28];let E;e[29]!==V?(E=n.jsx(Te,{id:"self-healing-site-url",type:"url",placeholder:"https://example.com",value:V,onChange:P,autoFocus:!0}),e[29]=V,e[30]=E):E=e[30];let N;e[31]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx("p",{className:"text-xs text-muted-foreground",children:"The site the specialists will monitor."}),e[31]=N):N=e[31];let I;e[32]!==E?(I=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[w,E,N]}),e[32]=E,e[33]=I):I=e[33];let k;e[34]!==m?(k=fn.map(Y=>n.jsx(Sr,{template:Y,enabled:m[Y.id]??!1,onToggle:X=>f(se=>({...se,[Y.id]:X}))},Y.id)),e[34]=m,e[35]=k):k=e[35];let R,L;e[36]===Symbol.for("react.memo_cache_sentinel")?(R=gr.map(wr),L=n.jsx(_r,{}),e[36]=R,e[37]=L):(R=e[36],L=e[37]);let D;e[38]!==k?(D=n.jsxs("div",{className:"flex flex-col gap-2",children:[k,R,L]}),e[38]=k,e[39]=D):D=e[39];let T;e[40]!==I||e[41]!==D?(T=n.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-4",children:[x,I,D]}),e[40]=I,e[41]=D,e[42]=T):T=e[42];let F;e[43]!==a||e[44]!==o||e[45]!==i?.virtualMcpId||e[46]!==b.isPending?(F=()=>{if(!b.isPending){const Y=i?.virtualMcpId;o(),Y&&a(Y)}},e[43]=a,e[44]=o,e[45]=i?.virtualMcpId,e[46]=b.isPending,e[47]=F):F=e[47];let U;e[48]!==b.isPending||e[49]!==F?(U=n.jsx("button",{type:"button",onClick:F,disabled:b.isPending,className:"text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 cursor-pointer",children:"Skip for now"}),e[48]=b.isPending,e[49]=F,e[50]=U):U=e[50];let O;e[51]!==b?(O=()=>b.mutate(),e[51]=b,e[52]=O):O=e[52];const K=!C,W=b.isPending?"Setting up...":"Set up specialists";let H;e[53]!==O||e[54]!==K||e[55]!==W?(H=n.jsx(ie,{onClick:O,disabled:K,size:"sm",children:W}),e[53]=O,e[54]=K,e[55]=W,e[56]=H):H=e[56];let Q;e[57]!==U||e[58]!==H?(Q=n.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center justify-between gap-3 shrink-0",children:[U,H]}),e[57]=U,e[58]=H,e[59]=Q):Q=e[59];let z;e[60]!==T||e[61]!==Q?(z=n.jsxs(Oe,{className:"sm:max-w-[560px] max-h-[85svh] p-0 gap-0 overflow-hidden flex flex-col",children:[j,T,Q]}),e[60]=T,e[61]=Q,e[62]=z):z=e[62];let J;return e[63]!==s||e[64]!==z||e[65]!==_?(J=n.jsx(Ue,{open:s,onOpenChange:_,children:z}),e[63]=s,e[64]=z,e[65]=_,e[66]=J):J=e[66],J}function wr(t){return n.jsx(kr,{title:t.title,description:t.description,icon:t.icon},t.id)}function jr(t){re.error("Failed to set up specialists: "+(t instanceof Error?t.message:"Unknown error"))}function Ar(){const t={};for(const e of fn)t[e.id]=!0;return t}function Sr(t){const e=M.c(20),{template:s,enabled:i,onToggle:o}=t,r=i?"bg-accent/30":"hover:bg-accent/30";let a;e[0]!==r?(a=q("flex items-center gap-3 rounded-lg border border-border px-3 py-3 cursor-pointer transition-colors",r),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==s.icon||e[3]!==s.title?(c=n.jsx(Nn,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=c):c=e[4];let l;e[5]!==s.title?(l=n.jsx("span",{className:"text-sm font-medium text-foreground leading-tight",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let V;e[9]!==l||e[10]!==u?(V=n.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[l,u]}),e[9]=l,e[10]=u,e[11]=V):V=e[11];let d;e[12]!==i||e[13]!==o?(d=n.jsx(Ti,{checked:i,onCheckedChange:o,className:"shrink-0"}),e[12]=i,e[13]=o,e[14]=d):d=e[14];let m;return e[15]!==a||e[16]!==c||e[17]!==V||e[18]!==d?(m=n.jsxs("label",{className:a,children:[c,V,d]}),e[15]=a,e[16]=c,e[17]=V,e[18]=d,e[19]=m):m=e[19],m}function kr(t){const e=M.c(14),{title:s,description:i,icon:o}=t;let r;e[0]!==o||e[1]!==s?(r=n.jsx(Nn,{icon:o,name:s,size:"sm",className:"shrink-0"}),e[0]=o,e[1]=s,e[2]=r):r=e[2];let a;e[3]!==s?(a=n.jsx("span",{className:"text-sm font-medium text-foreground leading-tight",children:s}),e[3]=s,e[4]=a):a=e[4];let c;e[5]!==i?(c=n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[5]=i,e[6]=c):c=e[6];let l;e[7]!==a||e[8]!==c?(l=n.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[a,c]}),e[7]=a,e[8]=c,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground shrink-0",children:"Coming soon"}),e[10]=u):u=e[10];let V;return e[11]!==r||e[12]!==l?(V=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 opacity-60",children:[r,l,u]}),e[11]=r,e[12]=l,e[13]=V):V=e[13],V}function _r(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed border-border px-3 py-3 text-xs text-muted-foreground",children:"More specialists coming soon"}),t[0]=e):e=t[0],e}function Bn(t){const e=t.trim();if(!e)return null;try{const s=new URL(e);return s.protocol!=="https:"&&s.protocol!=="http:"?null:s.origin+(s.pathname==="/"?"":s.pathname)}catch{return null}}async function Cr({selfClient:t,createConnection:e,registry:s}){const o=(await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:dt},limit:1,offset:0}})).structuredContent?.items?.find(V=>V.app_id===dt);if(o)return o.id;const r=s?.server?.remotes?.[0]?.url;if(!r)throw new Error("Site Diagnostics MCP is not available in the registry right now.");const a=s?.title??s?.server?.title??s?.server?.name??"Site Diagnostics",c=s?.server?.icons?.[0]?.src??null,l=s?.server?.description??null;return(await e({title:a,description:l,icon:c,connection_type:"HTTP",connection_url:r,app_name:s?.server?.name??"site-diagnostics",app_id:dt,metadata:{type:"site-diagnostics",source:"store",registry_item_id:dt,verified:!0}})).id}async function Nr({template:t,selfClient:e,siteDiagnosticsConnectionId:s,projectAgentId:i,owner:o,repo:r,siteRootUrl:a}){const c=`${r}: ${t.title}`,u=(await e.callTool({name:"AUTOMATION_LIST",arguments:{virtual_mcp_id:i}})).structuredContent?.automations?.find(d=>d.name===c);let V;if(!(u&&u.trigger_count>0)){if(u)V=u.id;else{const d=await Ir({template:t,selfClient:e,siteDiagnosticsConnectionId:s}),m=xr({template:t,specialistAgentId:d,owner:o,repo:r,siteRootUrl:a}),f=Bi(m),y=await e.callTool({name:"AUTOMATION_CREATE",arguments:{name:c,virtual_mcp_id:i,messages:f,active:!0}});V=(y.structuredContent??y).id}await e.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:V,type:"cron",cron_expression:t.cron}})}}async function Ir({template:t,selfClient:e,siteDiagnosticsConnectionId:s}){const o=(await e.callTool({name:"COLLECTION_VIRTUAL_MCP_LIST",arguments:{where:{field:["metadata","specialistId"],operator:"eq",value:t.id},limit:1,offset:0}})).structuredContent?.items?.find(c=>c.metadata?.specialistId===t.id);if(o)return o.id;const r=await e.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:t.title,description:t.description,icon:t.icon,pinned:!1,metadata:{specialistId:t.id,instructions:t.instructions},connections:[{connection_id:s,selected_tools:t.siteDiagnosticsTools,selected_resources:null,selected_prompts:null}]}}});return(r.structuredContent??r).item.id}const Tr=`You are an image generator agent. Every request of the user is somewhat related to creating, editing or varying an image. You have access to image generation tools
290
+ `}]}}function Ze(t){return{type:"paragraph",content:t}}function Ye(t){return{type:"text",text:t}}function yr({agentId:t,title:e}){return{type:"mention",attrs:{id:t,name:e,char:"@",metadata:{agentId:t,title:e}}}}const dt="deco/site-diagnostics";function gu(t){const e=M.c(15),{open:s,onOpenChange:o}=t,[i,r]=A.useState(null);let a;e[0]!==o?(a=()=>{r(null),o(!1)},e[0]=o,e[1]=a):a=e[1];const c=a,l=s&&i===null;let u;e[2]!==i||e[3]!==o?(u=y=>{!y&&i===null&&o(!1)},e[2]=i,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==l||e[6]!==u?(V=n.jsx(Do,{open:l,onOpenChange:u,title:"Set up self-healing repo",hideAutoRespondCheckbox:!0,onImportComplete:r}),e[5]=l,e[6]=u,e[7]=V):V=e[7];const d=s&&i!==null;let m;e[8]!==c||e[9]!==i||e[10]!==d?(m=n.jsx(vr,{open:d,payload:i,onClose:c}),e[8]=c,e[9]=i,e[10]=d,e[11]=m):m=e[11];let f;return e[12]!==V||e[13]!==m?(f=n.jsxs(n.Fragment,{children:[V,m]}),e[12]=V,e[13]=m,e[14]=f):f=e[14],f}function vr(t){const e=M.c(67),{open:s,payload:o,onClose:i}=t,{org:r}=ce(),a=Cn(),c=kn();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:St,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const u=qe(l),[V,d]=A.useState(""),[m,f]=A.useState(Ar);let y;e[3]!==s?(y={enabled:s},e[3]=s,e[4]=y):y=e[4];const{data:g}=Lo(dt,y);let p;e[5]!==c||e[6]!==m||e[7]!==o||e[8]!==u||e[9]!==g||e[10]!==V?(p=async()=>{if(!o)throw new Error("No imported repo payload");const W=Bn(V);if(!W)throw new Error("Enter a valid https:// URL");const X=fn.filter(Z=>m[Z.id]);if(X.length===0)return{succeeded:[],failed:[]};const se=await Cr({selfClient:u,createConnection:c.create.mutateAsync,registry:g}),G=[],ie=[];for(const Z of X)try{await Nr({template:Z,selfClient:u,siteDiagnosticsConnectionId:se,projectAgentId:o.virtualMcpId,owner:o.repo.owner,repo:o.repo.name,siteRootUrl:W}),G.push(Z.title)}catch(ae){const je=ae;console.error(`Failed to set up ${Z.title}:`,je),ie.push(Z.title)}return{succeeded:G,failed:ie}},e[5]=c,e[6]=m,e[7]=o,e[8]=u,e[9]=g,e[10]=V,e[11]=p):p=e[11];let v;e[12]!==a||e[13]!==i||e[14]!==o?.virtualMcpId?(v=W=>{const{succeeded:X,failed:se}=W;X.length>0?re.success(`Self-healing repo ready — ${X.length} specialist${X.length>1?"s":""} set up`):se.length===0&&re.success("Repo imported. Add specialists later from automations."),se.length>0&&re.warning(`Could not set up: ${se.join(", ")}. You can add them later from the automations view.`);const G=o?.virtualMcpId;i(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),G&&a(G)},e[12]=a,e[13]=i,e[14]=o?.virtualMcpId,e[15]=v):v=e[15];let h;e[16]!==p||e[17]!==v?(h={mutationFn:p,onSuccess:v,onError:jr},e[16]=p,e[17]=v,e[18]=h):h=e[18];const b=vn(h);let S;e[19]!==b.isPending||e[20]!==V?(S=Bn(V)!==null&&!b.isPending,e[19]=b.isPending,e[20]=V,e[21]=S):S=e[21];const C=S;let _;e[22]!==i||e[23]!==b.isPending?(_=W=>{!W&&!b.isPending&&i()},e[22]=i,e[23]=b.isPending,e[24]=_):_=e[24];let j;e[25]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx($e,{className:"h-12 border-b border-border px-4 flex flex-row items-center shrink-0 space-y-0",children:n.jsx(ze,{className:"text-sm font-medium text-foreground",children:"Add specialist monitors"})}),e[25]=j):j=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Specialists run on a daily schedule. Your repo agent collects their findings and opens GitHub issues, then writes the fixes."}),e[26]=x):x=e[26];let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("label",{htmlFor:"self-healing-site-url",className:"text-xs font-medium text-foreground",children:"Production URL"}),e[27]=w):w=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=W=>d(W.target.value),e[28]=P):P=e[28];let E;e[29]!==V?(E=n.jsx(Te,{id:"self-healing-site-url",type:"url",placeholder:"https://example.com",value:V,onChange:P,autoFocus:!0}),e[29]=V,e[30]=E):E=e[30];let N;e[31]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx("p",{className:"text-xs text-muted-foreground",children:"The site the specialists will monitor."}),e[31]=N):N=e[31];let I;e[32]!==E?(I=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[w,E,N]}),e[32]=E,e[33]=I):I=e[33];let k;e[34]!==m?(k=fn.map(W=>n.jsx(Sr,{template:W,enabled:m[W.id]??!1,onToggle:X=>f(se=>({...se,[W.id]:X}))},W.id)),e[34]=m,e[35]=k):k=e[35];let R,L;e[36]===Symbol.for("react.memo_cache_sentinel")?(R=gr.map(wr),L=n.jsx(_r,{}),e[36]=R,e[37]=L):(R=e[36],L=e[37]);let D;e[38]!==k?(D=n.jsxs("div",{className:"flex flex-col gap-2",children:[k,R,L]}),e[38]=k,e[39]=D):D=e[39];let T;e[40]!==I||e[41]!==D?(T=n.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-4",children:[x,I,D]}),e[40]=I,e[41]=D,e[42]=T):T=e[42];let F;e[43]!==a||e[44]!==i||e[45]!==o?.virtualMcpId||e[46]!==b.isPending?(F=()=>{if(!b.isPending){const W=o?.virtualMcpId;i(),W&&a(W)}},e[43]=a,e[44]=i,e[45]=o?.virtualMcpId,e[46]=b.isPending,e[47]=F):F=e[47];let U;e[48]!==b.isPending||e[49]!==F?(U=n.jsx("button",{type:"button",onClick:F,disabled:b.isPending,className:"text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 cursor-pointer",children:"Skip for now"}),e[48]=b.isPending,e[49]=F,e[50]=U):U=e[50];let O;e[51]!==b?(O=()=>b.mutate(),e[51]=b,e[52]=O):O=e[52];const K=!C,Y=b.isPending?"Setting up...":"Set up specialists";let H;e[53]!==O||e[54]!==K||e[55]!==Y?(H=n.jsx(oe,{onClick:O,disabled:K,size:"sm",children:Y}),e[53]=O,e[54]=K,e[55]=Y,e[56]=H):H=e[56];let Q;e[57]!==U||e[58]!==H?(Q=n.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center justify-between gap-3 shrink-0",children:[U,H]}),e[57]=U,e[58]=H,e[59]=Q):Q=e[59];let z;e[60]!==T||e[61]!==Q?(z=n.jsxs(Oe,{className:"sm:max-w-[560px] max-h-[85svh] p-0 gap-0 overflow-hidden flex flex-col",children:[j,T,Q]}),e[60]=T,e[61]=Q,e[62]=z):z=e[62];let J;return e[63]!==s||e[64]!==z||e[65]!==_?(J=n.jsx(Ue,{open:s,onOpenChange:_,children:z}),e[63]=s,e[64]=z,e[65]=_,e[66]=J):J=e[66],J}function wr(t){return n.jsx(kr,{title:t.title,description:t.description,icon:t.icon},t.id)}function jr(t){re.error("Failed to set up specialists: "+(t instanceof Error?t.message:"Unknown error"))}function Ar(){const t={};for(const e of fn)t[e.id]=!0;return t}function Sr(t){const e=M.c(20),{template:s,enabled:o,onToggle:i}=t,r=o?"bg-accent/30":"hover:bg-accent/30";let a;e[0]!==r?(a=q("flex items-center gap-3 rounded-lg border border-border px-3 py-3 cursor-pointer transition-colors",r),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==s.icon||e[3]!==s.title?(c=n.jsx(Nn,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=c):c=e[4];let l;e[5]!==s.title?(l=n.jsx("span",{className:"text-sm font-medium text-foreground leading-tight",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let V;e[9]!==l||e[10]!==u?(V=n.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[l,u]}),e[9]=l,e[10]=u,e[11]=V):V=e[11];let d;e[12]!==o||e[13]!==i?(d=n.jsx(Ro,{checked:o,onCheckedChange:i,className:"shrink-0"}),e[12]=o,e[13]=i,e[14]=d):d=e[14];let m;return e[15]!==a||e[16]!==c||e[17]!==V||e[18]!==d?(m=n.jsxs("label",{className:a,children:[c,V,d]}),e[15]=a,e[16]=c,e[17]=V,e[18]=d,e[19]=m):m=e[19],m}function kr(t){const e=M.c(14),{title:s,description:o,icon:i}=t;let r;e[0]!==i||e[1]!==s?(r=n.jsx(Nn,{icon:i,name:s,size:"sm",className:"shrink-0"}),e[0]=i,e[1]=s,e[2]=r):r=e[2];let a;e[3]!==s?(a=n.jsx("span",{className:"text-sm font-medium text-foreground leading-tight",children:s}),e[3]=s,e[4]=a):a=e[4];let c;e[5]!==o?(c=n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:o}),e[5]=o,e[6]=c):c=e[6];let l;e[7]!==a||e[8]!==c?(l=n.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[a,c]}),e[7]=a,e[8]=c,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground shrink-0",children:"Coming soon"}),e[10]=u):u=e[10];let V;return e[11]!==r||e[12]!==l?(V=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 opacity-60",children:[r,l,u]}),e[11]=r,e[12]=l,e[13]=V):V=e[13],V}function _r(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed border-border px-3 py-3 text-xs text-muted-foreground",children:"More specialists coming soon"}),t[0]=e):e=t[0],e}function Bn(t){const e=t.trim();if(!e)return null;try{const s=new URL(e);return s.protocol!=="https:"&&s.protocol!=="http:"?null:s.origin+(s.pathname==="/"?"":s.pathname)}catch{return null}}async function Cr({selfClient:t,createConnection:e,registry:s}){const i=(await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:dt},limit:1,offset:0}})).structuredContent?.items?.find(V=>V.app_id===dt);if(i)return i.id;const r=s?.server?.remotes?.[0]?.url;if(!r)throw new Error("Site Diagnostics MCP is not available in the registry right now.");const a=s?.title??s?.server?.title??s?.server?.name??"Site Diagnostics",c=s?.server?.icons?.[0]?.src??null,l=s?.server?.description??null;return(await e({title:a,description:l,icon:c,connection_type:"HTTP",connection_url:r,app_name:s?.server?.name??"site-diagnostics",app_id:dt,metadata:{type:"site-diagnostics",source:"store",registry_item_id:dt,verified:!0}})).id}async function Nr({template:t,selfClient:e,siteDiagnosticsConnectionId:s,projectAgentId:o,owner:i,repo:r,siteRootUrl:a}){const c=`${r}: ${t.title}`,u=(await e.callTool({name:"AUTOMATION_LIST",arguments:{virtual_mcp_id:o}})).structuredContent?.automations?.find(d=>d.name===c);let V;if(!(u&&u.trigger_count>0)){if(u)V=u.id;else{const d=await Ir({template:t,selfClient:e,siteDiagnosticsConnectionId:s}),m=xr({template:t,specialistAgentId:d,owner:i,repo:r,siteRootUrl:a}),f=qo(m),y=await e.callTool({name:"AUTOMATION_CREATE",arguments:{name:c,virtual_mcp_id:o,messages:f,active:!0}});V=(y.structuredContent??y).id}await e.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:V,type:"cron",cron_expression:t.cron}})}}async function Ir({template:t,selfClient:e,siteDiagnosticsConnectionId:s}){const i=(await e.callTool({name:"COLLECTION_VIRTUAL_MCP_LIST",arguments:{where:{field:["metadata","specialistId"],operator:"eq",value:t.id},limit:1,offset:0}})).structuredContent?.items?.find(c=>c.metadata?.specialistId===t.id);if(i)return i.id;const r=await e.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:t.title,description:t.description,icon:t.icon,pinned:!1,metadata:{specialistId:t.id,instructions:t.instructions},connections:[{connection_id:s,selected_tools:t.siteDiagnosticsTools,selected_resources:null,selected_prompts:null}]}}});return(r.structuredContent??r).item.id}const Tr=`You are an image generator agent. Every request of the user is somewhat related to creating, editing or varying an image. You have access to image generation tools
291
291
 
292
292
  These guidelines define how prompts should be structured, specified, and iterated to produce high-quality, controlled image outputs across different use cases.
293
293
 
@@ -531,7 +531,7 @@ This helps define finish quality and realism level.
531
531
  * Prefer clarity over poetic language.
532
532
  * Keep prompts structured, not verbose.
533
533
  * Add detail only when it improves control.
534
- * Prevent drift by restating critical constraints`,Rr=["Turn ideas into detailed, ready-to-use image generation prompts","Offer multiple artistic directions for every concept","Refine prompts iteratively based on your feedback","Advise on style, lighting, composition, and color palette","Support any use case: product shots, illustrations, concept art, and more"];function qn(t){const e=M.c(7),{onRecruit:s,isRecruiting:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Add an Image Creator agent that turns your ideas into precise, evocative prompts for any AI image generation tool."}),e[0]=o):o=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[r,n.jsx("ul",{className:"space-y-1.5",children:Rr.map(Pr)})]}),e[2]=a):a=e[2];const c=i?"Setting up...":"Add Image Creator";let l;return e[3]!==i||e[4]!==s||e[5]!==c?(l=n.jsxs("div",{className:"flex flex-col gap-6",children:[o,a,n.jsx(ie,{onClick:s,disabled:i,className:"w-full cursor-pointer",children:c})]}),e[3]=i,e[4]=s,e[5]=c,e[6]=l):l=e[6],l}function Pr(t){return n.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[n.jsx("span",{className:"text-rose-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function xu({open:t,onOpenChange:e,existingAgent:s}){const i=Wt(),o=Cn(),r=xs(),[a,c]=A.useState(!1),l=Vs.find(m=>m.id==="ai-image"),u=n.jsx(gs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),o(s.id);return}c(!0);try{const m=await r.create.mutateAsync({title:l.title,description:"AI image prompt engineering and visual ideation assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-image",instructions:Tr}});B("agent_recruit_confirmed",{template_id:"ai-image",agent_id:m.id}),e(!1),o(m.id)}catch(m){B("agent_recruit_failed",{template_id:"ai-image",error:m instanceof Error?m.message:String(m)}),console.error("Failed to create Image Creator agent:",m)}finally{c(!1)}},d=`Add ${l.title}`;return i?n.jsx(Bt,{open:t,onOpenChange:e,children:n.jsxs(qt,{className:"h-[70dvh]",children:[n.jsx(Kt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Yt,{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(qn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(Ue,{open:t,onOpenChange:e,children:n.jsxs(Oe,{className:"sm:max-w-[500px] p-8",children:[n.jsx($e,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ze,{className:"text-xl font-semibold",children:d})]})}),n.jsx(qn,{onRecruit:V,isRecruiting:a})]})})}const Er=`You are a systematic research assistant. You have access to web search tools and user's prompts will have somewhat relation to searching the web. Help users conduct thorough, well-structured research on any topic.
534
+ * Prevent drift by restating critical constraints`,Rr=["Turn ideas into detailed, ready-to-use image generation prompts","Offer multiple artistic directions for every concept","Refine prompts iteratively based on your feedback","Advise on style, lighting, composition, and color palette","Support any use case: product shots, illustrations, concept art, and more"];function qn(t){const e=M.c(7),{onRecruit:s,isRecruiting:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Add an Image Creator agent that turns your ideas into precise, evocative prompts for any AI image generation tool."}),e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[r,n.jsx("ul",{className:"space-y-1.5",children:Rr.map(Pr)})]}),e[2]=a):a=e[2];const c=o?"Setting up...":"Add Image Creator";let l;return e[3]!==o||e[4]!==s||e[5]!==c?(l=n.jsxs("div",{className:"flex flex-col gap-6",children:[i,a,n.jsx(oe,{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 Pr(t){return n.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[n.jsx("span",{className:"text-rose-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function xu({open:t,onOpenChange:e,existingAgent:s}){const o=Yt(),i=Cn(),r=xs(),[a,c]=A.useState(!1),l=Vs.find(m=>m.id==="ai-image"),u=n.jsx(gs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),i(s.id);return}c(!0);try{const m=await r.create.mutateAsync({title:l.title,description:"AI image prompt engineering and visual ideation assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-image",instructions:Tr}});B("agent_recruit_confirmed",{template_id:"ai-image",agent_id:m.id}),e(!1),i(m.id)}catch(m){B("agent_recruit_failed",{template_id:"ai-image",error:m instanceof Error?m.message:String(m)}),console.error("Failed to create Image Creator agent:",m)}finally{c(!1)}},d=`Add ${l.title}`;return o?n.jsx(Bt,{open:t,onOpenChange:e,children:n.jsxs(qt,{className:"h-[70dvh]",children:[n.jsx(Kt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Wt,{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(qn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(Ue,{open:t,onOpenChange:e,children:n.jsxs(Oe,{className:"sm:max-w-[500px] p-8",children:[n.jsx($e,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ze,{className:"text-xl font-semibold",children:d})]})}),n.jsx(qn,{onRecruit:V,isRecruiting:a})]})})}const Er=`You are a systematic research assistant. You have access to web search tools and user's prompts will have somewhat relation to searching the web. Help users conduct thorough, well-structured research on any topic.
535
535
 
536
536
  VERY IMPORTANT: The user might not have any web research model connected. If so, guide the user to use an AI Provider that has an Web Search generation, or connect a specific model in our connections.
537
537
 
@@ -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.`,Dr=["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 Kn(t){const e=M.c(7),{onRecruit:s,isRecruiting:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[r,n.jsx("ul",{className:"space-y-1.5",children:Dr.map(Lr)})]}),e[2]=a):a=e[2];const c=i?"Setting up...":"Add Web Researcher";let l;return e[3]!==i||e[4]!==s||e[5]!==c?(l=n.jsxs("div",{className:"flex flex-col gap-6",children:[o,a,n.jsx(ie,{onClick:s,disabled:i,className:"w-full cursor-pointer",children:c})]}),e[3]=i,e[4]=s,e[5]=c,e[6]=l):l=e[6],l}function Lr(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 bu({open:t,onOpenChange:e,existingAgent:s}){const i=Wt(),o=Cn(),r=xs(),[a,c]=A.useState(!1),l=Vs.find(m=>m.id==="ai-research"),u=n.jsx(gs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),o(s.id);return}c(!0);try{const m=await r.create.mutateAsync({title:l.title,description:"Systematic research and information synthesis assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Er}});B("agent_recruit_confirmed",{template_id:"ai-research",agent_id:m.id}),e(!1),o(m.id)}catch(m){B("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 i?n.jsx(Bt,{open:t,onOpenChange:e,children:n.jsxs(qt,{className:"h-[70dvh]",children:[n.jsx(Kt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Yt,{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(Kn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(Ue,{open:t,onOpenChange:e,children:n.jsxs(Oe,{className:"sm:max-w-[500px] p-8",children:[n.jsx($e,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ze,{className:"text-xl font-semibold",children:d})]})}),n.jsx(Kn,{onRecruit:V,isRecruiting:a})]})})}function Mr(t,e,s,i){const o=t.getQueriesData({queryKey:Ae.tasksPrefix(e)});let r=null;for(const[,a]of o)if(a?.items)for(const c of a.items)c.virtual_mcp_id===s&&c.created_by===i&&(c.hidden||(!r||c.updated_at>r.updated_at)&&(r=c));return r}function yu(t){const e=Qe(),s=jt(),i=bs(),{locator:o}=ce(),r=wn({strict:!1}),a=jn({strict:!1}),{data:c}=Ut.useSession(),l=c?.user?.id;return async u=>{const V=l?Mr(s,o,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?ys(s,o,r.taskId??""):null;try{await i.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 Fr(t,e){return t===1?!0:t===0?!1:e}function Ur(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,o=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:o}}function vu(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 Or(t,e){return t===1?!0:t===0?!1:e}function wu(t,e){const s=Qe(),i=jn({strict:!1}),o=wn({strict:!1}),r=jt(),a=bs(),{locator:c}=ce(),{virtualMcpId:l,orgSlug:u,isAgentRoute:V}=e,d=Ur({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),m=Or(i.chat,d.chatOpen),f=d.mainOpen,y=A.useRef(crypto.randomUUID()),g=o.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:N=>({...N,...P}),replace:E?.replace??!1})},S=(P,E)=>{s({to:p,params:v(P),search:N=>{const I={};return E?I.virtualmcpid=E:V&&(I.virtualmcpid=l),N.tasks&&(I.tasks=N.tasks),I}})},C=()=>{f?b({main:"0"},{replace:!0}):b({main:ro(t)},{replace:!0})},_=()=>{b({chat:m?0:1},{replace:!0})},j=()=>{m||b({chat:1},{replace:!0})},x=async()=>{const P=crypto.randomUUID(),E=ys(r,c,g);try{await a.create.mutateAsync({id:P,virtual_mcp_id:l,...E?{branch:E}:{}})}catch{}s({to:p,params:v(P),search:N=>{const I={...h,chat:1};return N.tasks&&(I.tasks=N.tasks),I}})},w=P=>{b({main:P},{replace:!0})};return{taskId:g,mainOpen:f,chatOpen:m,mainParam:i.main,setTaskId:S,toggleMain:C,toggleChat:_,openChat:j,createNewTask:x,openTab:w}}const Rn=A.createContext(null);function ju(t){const e=M.c(17),{children:s}=t,i=Qe();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[0]=o):o=e[0];const r=jn(o);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[1]=a):a=e[1];const c=wn(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}=qi(l);let V;e[3]!==c.taskId||e[4]!==r.tasks||e[5]!==u?(V=()=>Fr(r.tasks,!!c.taskId&&u.length>0),e[3]=c.taskId,e[4]=r.tasks,e[5]=u,e[6]=V):V=e[6];const[d,m]=A.useState(V);let f,y;e[7]!==i||e[8]!==d?(f=()=>{i({search:(b=>({...b,tasks:d?1:0})),replace:!0})},y=[d,i],e[7]=i,e[8]=d,e[9]=f,e[10]=y):(f=e[9],y=e[10]),A.useEffect(f,y);let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=()=>m($r),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(Rn.Provider,{value:v,children:s}),e[14]=s,e[15]=v,e[16]=h):h=e[16],h}function $r(t){return!t}function Au(){const t=A.useContext(Rn);if(!t)throw new Error("useTasksPanelState must be used inside <TasksPanelStateProvider>");return t}function Su(){return A.useContext(Rn)}const $s=A.createContext(null);function Je(){const t=A.use($s);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function Se(t){const e=M.c(10),{children:s}=t,[i,o]=A.useState(null),[r,a]=A.useState(null),[c,l]=A.useState(null),[u,V]=A.useState(null);let d;e[0]!==c||e[1]!==u||e[2]!==r||e[3]!==i?(d={togglesEl:i,setTogglesEl:o,tabsEl:r,setTabsEl:a,centerEl:c,setCenterEl:l,rightEl:u,setRightEl:V},e[0]=c,e[1]=u,e[2]=r,e[3]=i,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($s,{value:d,children:m}),e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function zr(t){const e=M.c(2),{children:s}=t;let i;return e[0]!==s?(i=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]=i):i=e[1],i}function Br(t){const e=M.c(2),{children:s}=t;let i;return e[0]!==s?(i=n.jsx("div",{className:"flex items-center gap-0.5 min-w-0 justify-self-start",children:s}),e[0]=s,e[1]=i):i=e[1],i}function qr(t){const e=M.c(2),{children:s}=t;let i;return e[0]!==s?(i=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]=i):i=e[1],i}function Kr(){const t=M.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("button",{type:"button",onClick:Wr,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(xo,{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:Yr,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(ws,{size:16})})]}),t[1]=s):s=t[1],s}function Yr(){return window.history.forward()}function Wr(){return window.history.back()}function Gr(){const t=M.c(2),{setCenterEl:e}=Je();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 Qr(t){const e=M.c(3),{children:s}=t,{centerEl:i}=Je();if(!i)return null;let o;return e[0]!==i||e[1]!==s?(o=At.createPortal(s,i),e[0]=i,e[1]=s,e[2]=o):o=e[2],o}function Hr(){const t=M.c(2),{setTabsEl:e}=Je();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 Jr(t){const e=M.c(3),{children:s}=t,{tabsEl:i}=Je();if(!i)return null;let o;return e[0]!==s||e[1]!==i?(o=At.createPortal(s,i),e[0]=s,e[1]=i,e[2]=o):o=e[2],o}function Xr(){const t=M.c(2),{setTogglesEl:e}=Je();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 Zr(t){const e=M.c(3),{children:s}=t,{togglesEl:i}=Je();if(!i)return null;let o;return e[0]!==s||e[1]!==i?(o=At.createPortal(s,i),e[0]=s,e[1]=i,e[2]=o):o=e[2],o}function ea(){const t=M.c(2),{setRightEl:e}=Je();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 ta(t){const e=M.c(3),{children:s}=t,{rightEl:i}=Je();if(!i)return null;let o;return e[0]!==s||e[1]!==i?(o=At.createPortal(s,i),e[0]=s,e[1]=i,e[2]=o):o=e[2],o}Se.Header=zr;Se.LeftColumn=Br;Se.RightColumn=qr;Se.Nav=Kr;Se.CenterSlot=Gr;Se.Center=Qr;Se.TabsSlot=Hr;Se.Tabs=Jr;Se.TogglesSlot=Xr;Se.Toggles=Zr;Se.RightSlot=ea;Se.Right=ta;function na(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?tt().min(1,"Required"):tt();return He(e)}function sa(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Pn(t){const e=M.c(65),{prompt:s,setPrompt:i,onSubmit:o}=t,r=A.useId();let a;if(e[0]!==s){const T=s?na(s):He({});a=yn(T),e[0]=s,e[1]=a}else a=e[1];const l=a;let u;e[2]!==s?(u=s?sa(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=bn(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]!==o||e[11]!==i?(y=async T=>{await o(T),i(null),d.reset()},e[9]=d,e[10]=o,e[11]=i,e[12]=y):y=e[12];const g=y;let p;e[13]!==d||e[14]!==i?(p=T=>{T||(d.reset(),i(null))},e[13]=d,e[14]=i,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||Gt(s.name,Ge(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(ze,{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($e,{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 j;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=F=>n.jsx(we,{control:d.control,name:F.name,render:U=>{const{field:O}=U;return n.jsxs(me,{children:[n.jsxs(Ie,{className:"text-xs",children:[F.name,F.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(fe,{children:n.jsx(Te,{...O,value:O.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(pe,{})]})}},F.name),e[34]=d.control,e[35]=d.formState.isSubmitting,e[36]=T):T=e[36],j=f.map(T),e[30]=f,e[31]=d.control,e[32]=d.formState.isSubmitting,e[33]=j}else j=e[33];let x;e[37]!==v?(x=()=>v(!1),e[37]=v,e[38]=x):x=e[38];let w;e[39]!==d.formState.isSubmitting||e[40]!==x?(w=n.jsx(ie,{type:"button",variant:"ghost",onClick:x,disabled:d.formState.isSubmitting,children:"Cancel"}),e[39]=d.formState.isSubmitting,e[40]=x,e[41]=w):w=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(Pt,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=d.formState.isSubmitting,e[43]=E):E=e[43];let N;e[44]!==r||e[45]!==P||e[46]!==E?(N=n.jsx(ie,{type:"submit",form:r,disabled:P,children:E}),e[44]=r,e[45]=P,e[46]=E,e[47]=N):N=e[47];let I;e[48]!==w||e[49]!==N?(I=n.jsxs(us,{children:[w,N]}),e[48]=w,e[49]=N,e[50]=I):I=e[50];let k;e[51]!==r||e[52]!==_||e[53]!==j||e[54]!==I?(k=n.jsxs("form",{id:r,className:"space-y-4 py-4",autoComplete:"off",onSubmit:_,children:[j,I]}),e[51]=r,e[52]=_,e[53]=j,e[54]=I,e[55]=k):k=e[55];let R;e[56]!==d||e[57]!==k?(R=n.jsx(bt,{...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(Oe,{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(Ue,{open:!0,onOpenChange:v,children:L}),e[62]=v,e[63]=L,e[64]=D):D=e[64],D}function ia(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 oa(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const Yn=3,zs="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",ra="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Bs(t){const e=M.c(46),{item:s,onSelect:i,isLoading:o,isDisabled:r,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 j=Ge(l._meta);u=l.title??Gt(l.name,j),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 j;e[4]!==i||e[5]!==l?(j=()=>i(l),e[4]=i,e[5]=l,e[6]=j):j=e[6];const x=r||o,w=o&&"bg-accent/40",P=(r||o)&&"cursor-not-allowed opacity-50";let E;e[7]!==w||e[8]!==P?(E=q(ra,"hover:bg-accent/60 text-foreground",w,P),e[7]=w,e[8]=P,e[9]=E):E=e[9];let N;e[10]!==V?(N=n.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=N):N=e[11];let I;e[12]!==o?(I=o&&n.jsx(Pt,{size:"xs"}),e[12]=o,e[13]=I):I=e[13];let k;e[14]!==N||e[15]!==I?(k=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,I]}),e[14]=N,e[15]=I,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]!==j||e[22]!==x||e[23]!==E?(L=n.jsxs("button",{type:"button",onClick:j,disabled:x,className:E,children:[k,R]}),e[19]=k,e[20]=R,e[21]=j,e[22]=x,e[23]=E,e[24]=L):L=e[24],L}let m;e[25]!==i||e[26]!==l?(m=()=>i(l),e[25]=i,e[26]=l,e[27]=m):m=e[27];const f=r||o,y=o&&"bg-muted/50",g=(r||o)&&"cursor-not-allowed opacity-50";let p;e[28]!==y||e[29]!==g?(p=q(zs,"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]!==o?(h=o&&n.jsx(Pt,{size:"xs"}),e[33]=o,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(ft,{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(pt,{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(mt,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=_):_=e[45],_}function aa(t){const e=M.c(41),{items:s,open:i,onOpenChange:o,onSelect:r,loadingPrompt:a}=t,[c,l]=A.useState(""),u=!!a;let V;e[0]!==s||e[1]!==c?(V=c.trim()?s.filter(x=>{const w=c.toLowerCase();return x.prompt.name.toLowerCase().includes(w)||(x.prompt.title??"").toLowerCase().includes(w)||(x.prompt.description??"").toLowerCase().includes(w)}):s,e[0]=s,e[1]=c,e[2]=V):V=e[2];const d=V,m=Wt();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]!==o||e[10]!==r){let x;e[12]!==u||e[13]!==a?.name||e[14]!==o||e[15]!==r?(x=w=>n.jsx(Bs,{item:w,variant:"card",onSelect:P=>{o(!1),r(P)},isLoading:a?.name===w.prompt.name,isDisabled:u&&a?.name!==w.prompt.name},w.prompt.name),e[12]=u,e[13]=a?.name,e[14]=o,e[15]=r,e[16]=x):x=e[16],y=d.map(x),e[6]=d,e[7]=u,e[8]=a?.name,e[9]=o,e[10]=r,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(js,{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(Kt,{className:"sr-only",children:n.jsx(Yt,{children:"All prompts"})}),e[23]=x):x=e[23];let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=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]=w):w=e[24];let P;e[25]!==p||e[26]!==b?(P=n.jsxs(qt,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[x,w,b,p]}),e[25]=p,e[26]=b,e[27]=P):P=e[27];let E;return e[28]!==o||e[29]!==i||e[30]!==P?(E=n.jsx(un,{delayDuration:400,children:n.jsx(Bt,{open:i,onOpenChange:o,children:P})}),e[28]=o,e[29]=i,e[30]=P,e[31]=E):E=e[31],E}let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx($e,{className:"sr-only",children:n.jsx(ze,{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(Oe,{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 j;return e[37]!==o||e[38]!==i||e[39]!==_?(j=n.jsx(un,{delayDuration:400,children:n.jsx(Ue,{open:i,onOpenChange:o,children:_})}),e[37]=o,e[38]=i,e[39]=_,e[40]=j):j=e[40],j}function la(t){const e=M.c(29),{items:s,onSelect:i,loadingPrompt:o,className:r}=t,[a,c]=A.useState(!1);if(s.length===0)return null;let l,u,V;if(e[0]!==s||e[1]!==o||e[2]!==i){const v=s.slice(0,Yn);let h;e[6]!==s?(h=s.slice(Yn),e[6]=s,e[7]=h):h=e[7],l=h,u=!!o;let b;e[8]!==u||e[9]!==o?.name||e[10]!==i?(b=S=>n.jsx(Bs,{item:S,onSelect:i,isLoading:o?.name===S.prompt.name,isDisabled:u&&o?.name!==S.prompt.name},S.prompt.name),e[8]=u,e[9]=o?.name,e[10]=i,e[11]=b):b=e[11],V=v.map(b),e[0]=s,e[1]=o,e[2]=i,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]!==r?(m=q("w-full flex flex-wrap gap-2 justify-center",r),e[12]=r,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:q(zs,"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]!==o||e[23]!==a||e[24]!==i?(g=n.jsx(aa,{items:s,open:a,onOpenChange:c,onSelect:i,loadingPrompt:o}),e[21]=s,e[22]=o,e[23]=a,e[24]=i,e[25]=g):g=e[25];let p;return e[26]!==y||e[27]!==g?(p=n.jsxs(un,{delayDuration:400,children:[y,g]}),e[26]=y,e[27]=g,e[28]=p):p=e[28],p}function ca(){return null}function da(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 ua(t){const e=M.c(31),{connectionId:s}=t,{sendMessage:i}=zt(),{tiptapDocRef:o}=$t(),{org:r}=ce();let a;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const c=qe(a);let l;e[4]!==c?(l={client:c,staleTime:6e4},e[4]=c,e[5]=l):l=e[5];const{data:u}=bo(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(Va),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]=A.useReducer(da,y),[v,h]=A.useState(null);let b;e[11]!==c||e[12]!==i||e[13]!==o?(b=async(k,R)=>{if(!c){re.error("MCP client not available"),p({type:"RESET"});return}try{const L=await Tn(c,k.name,R);p({type:"RESET"});const D=oa(o.current,{type:"paragraph",content:[ao({id:k.name,name:In(k.name,Ge(k._meta)),metadata:L.messages,char:"/"})]});await i(D)}catch(L){console.error("[ice-breakers] Failed to fetch prompt:",L),re.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=c,e[12]=i,e[13]=o,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 j;e[17]!==v||e[18]!==S?(j=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]=j):j=e[19];const x=j;if(f.length===0)return null;const w=g.stage==="loading"?g.prompt:null;let P;e[20]!==_||e[21]!==f||e[22]!==w?(P=n.jsx(la,{items:f,onSelect:_,loadingPrompt:w}),e[20]=_,e[21]=f,e[22]=w,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 N;e[25]!==v||e[26]!==x?(N=n.jsx(Pn,{prompt:v,setPrompt:E,onSubmit:x}),e[25]=v,e[26]=x,e[27]=N):N=e[27];let I;return e[28]!==P||e[29]!==N?(I=n.jsxs(n.Fragment,{children:[P,N]}),e[28]=P,e[29]=N,e[30]=I):I=e[30],I}function Va(t){return{prompt:t}}function ma(t){const e=M.c(13),{className:s}=t,{selectedVirtualMcp:i}=$t(),{org:o}=ce();let r;e[0]!==o.id?(r=_n(o.id),e[0]=o.id,e[1]=r):r=e[1];const a=r.id,c=i?.id??a;let l;e[2]!==s?(l=q("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(ca,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=n.jsx(ua,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=n.jsx(gi,{fallback:null,children:n.jsx(A.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 qs(t){const e=M.c(21),{current:s,total:i,onPrev:o,onNext:r}=t;if(i<=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=q("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(_o,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==a||e[5]!==l?(V=n.jsx("button",{type:"button",onClick:o,disabled:a,className:l,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=a,e[5]=l,e[6]=V):V=e[6];const d=s+1;let m;e[7]!==d||e[8]!==i?(m=n.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",i]}),e[7]=d,e[8]=i,e[9]=m):m=e[9];const f=s===i-1,y=s===i-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==y?(g=q("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(_s,{size:14}),e[12]=p):p=e[12];let v;e[13]!==r||e[14]!==g||e[15]!==f?(v=n.jsx("button",{type:"button",onClick:r,disabled:f,className:g,"aria-label":"Next question",children:p}),e[13]=r,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 rn="cubic-bezier(0.645, 0.045, 0.355, 1)",fa={default:"",error:"bg-destructive/5",warning:"bg-amber-500/5"},pa={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ha={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function rt(t){const e=M.c(61),{icon:s,label:i,count:o,title:r,footerLeft:a,footerRight:c,children:l,defaultExpanded:u,variant:V,onClose:d}=t,m=V===void 0?"default":V,[f,y]=A.useState(u),[g,p]=A.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=pa[m],S=fa[m];let C;e[2]!==b||e[3]!==S?(C=q("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(ga),e[5]=_):_=e[5];const j=f&&"rounded-b-none",x=!f&&"rounded-b-xl";let w;e[6]!==j||e[7]!==x?(w=q("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",j,x),e[6]=j,e[7]=x,e[8]=w):w=e[8];const P=ha[m];let E;e[9]!==P?(E=q("shrink-0",P),e[9]=P,e[10]=E):E=e[10];let N;e[11]!==s||e[12]!==E?(N=n.jsx("span",{className:E,children:s}),e[11]=s,e[12]=E,e[13]=N):N=e[13];let I;e[14]!==i?(I=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:i}),e[14]=i,e[15]=I):I=e[15];let k;e[16]!==o?(k=o?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,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(Co,{size:16,style:{transform:R,transition:`transform 180ms ${rn}`}})}),e[18]=R,e[19]=L):L=e[19];let D,T;e[20]!==h?(D=Z=>{Z.stopPropagation(),h()},T=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),h())},e[20]=h,e[21]=D,e[22]=T):(D=e[21],T=e[22]);let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx(ct,{size:16}),e[23]=F):F=e[23];let U;e[24]!==D||e[25]!==T?(U=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:F}),e[24]=D,e[25]=T,e[26]=U):U=e[26];let O;e[27]!==f||e[28]!==N||e[29]!==I||e[30]!==k||e[31]!==L||e[32]!==U||e[33]!==w?(O=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:_,className:w,children:[N,I,k,L,U]}),e[27]=f,e[28]=N,e[29]=I,e[30]=k,e[31]=L,e[32]=U,e[33]=w,e[34]=O):O=e[34];const K=f?"1fr":"0fr";let W;e[35]!==K?(W={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${rn}`},e[35]=K,e[36]=W):W=e[36];let H;e[37]===Symbol.for("react.memo_cache_sentinel")?(H={overflow:"hidden",minHeight:0},e[37]=H):H=e[37];const Q=f?1:0;let z;e[38]!==Q?(z={opacity:Q,transition:`opacity 120ms ${rn}`},e[38]=Q,e[39]=z):z=e[39];let J;e[40]!==r?(J=r?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:r})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=r,e[41]=J):J=e[41];let Y;e[42]!==l||e[43]!==r?(Y=l?n.jsx("div",{className:q("overflow-clip pb-4",!r&&"pt-4"),children:l}):null,e[42]=l,e[43]=r,e[44]=Y):Y=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 se;e[48]!==z||e[49]!==J||e[50]!==Y||e[51]!==X?(se=n.jsx("div",{style:H,children:n.jsxs("div",{style:z,children:[J,Y,X]})}),e[48]=z,e[49]=J,e[50]=Y,e[51]=X,e[52]=se):se=e[52];let G;e[53]!==W||e[54]!==se?(G=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:se}),e[53]=W,e[54]=se,e[55]=G):G=e[55];let oe;return e[56]!==O||e[57]!==G||e[58]!==C||e[59]!==m?(oe=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[O,G]}),e[56]=O,e[57]=G,e[58]=C,e[59]=m,e[60]=oe):oe=e[60],oe}function ga(t){return!t}const xa="User denied this tool call, give other alternatives.",ba=[{value:"readonly",label:"Ask before edit"},{value:"auto",label:"Auto approve"}];function ya(t){const e=M.c(9),{onYolo:s}=t,[i,o]=An();let r;e[0]!==s||e[1]!==i||e[2]!==o?(r=V=>{const d=V;o({...i,toolApprovalLevel:d}),d==="auto"&&s()},e[0]=s,e[1]=i,e[2]=o,e[3]=r):r=e[3];const a=r;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Is,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:wa,children:n.jsx(Ts,{})}),e[4]=c):c=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Rs,{children:ba.map(va)}),e[5]=l):l=e[5];let u;return e[6]!==a||e[7]!==i.toolApprovalLevel?(u=n.jsxs(Ns,{value:i.toolApprovalLevel,onValueChange:a,children:[c,l]}),e[6]=a,e[7]=i.toolApprovalLevel,e[8]=u):u=e[8],u}function va(t){return n.jsx(st,{value:t.value,children:t.label},t.value)}function wa(t){return t.stopPropagation()}function ja(t){const e=M.c(5),{input:s}=t;if(s==null){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=r):r=e[0],r}let i;try{let r;e[1]!==s?(r=JSON.stringify(s,null,2),e[1]=s,e[2]=r):r=e[2],i=r}catch{i=String(s)}let o;return e[3]!==i?(o=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:i})}),e[3]=i,e[4]=o):o=e[4],o}function Aa(t){const e=M.c(44),{approvals:s,onRespond:i}=t,[o,r]=A.useState(0),a=Math.min(o,s.length-1),c=s[a];if(!c)return null;let l;e[0]!==c.approvalId||e[1]!==i?(l=()=>{i(c.approvalId,!1,xa)},e[0]=c.approvalId,e[1]=i,e[2]=l):l=e[2];const u=l;let V;e[3]!==c.approvalId||e[4]!==i?(V=()=>{i(c.approvalId,!0)},e[3]=c.approvalId,e[4]=i,e[5]=V):V=e[5];const d=V;let m;e[6]!==s||e[7]!==i?(m=()=>{for(const R of s)i(R.approvalId,!0)},e[6]=s,e[7]=i,e[8]=m):m=e[8];const f=m;let y;e[9]!==a?(y=()=>{a>0&&r(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&&r(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(ya,{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(qs,{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 j;e[24]!==u?(j=n.jsx(ie,{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]=j):j=e[25];let x;e[26]!==s.length||e[27]!==f?(x=s.length>1&&n.jsx(ie,{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 w;e[29]!==d?(w=n.jsx(ie,{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]=w):w=e[30];let P;e[31]!==x||e[32]!==w||e[33]!==j?(P=n.jsxs(n.Fragment,{children:[j,x,w]}),e[31]=x,e[32]=w,e[33]=j,e[34]=P):P=e[34];const E=P;let N;e[35]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ms,{size:14}),e[35]=N):N=e[35];let I;e[36]!==c.input?(I=n.jsx(ja,{input:c.input}),e[36]=c.input,e[37]=I):I=e[37];let k;return e[38]!==h||e[39]!==c.friendlyName||e[40]!==_||e[41]!==E||e[42]!==I?(k=n.jsx(rt,{icon:N,label:h,title:c.friendlyName,defaultExpanded:!0,footerLeft:_,footerRight:E,children:I}),e[38]=h,e[39]=c.friendlyName,e[40]=_,e[41]=E,e[42]=I,e[43]=k):k=e[43],k}function Sa(){const t=M.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(ms,{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 ka(t){const e=M.c(4),{approvals:s,isStreaming:i,onRespond:o}=t;if(i&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Sa,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let r;return e[1]!==s||e[2]!==o?(r=n.jsx(Aa,{approvals:s,onRespond:o}),e[1]=s,e[2]=o,e[3]=r):r=e[3],r}function _a(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 i="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:i,friendlyName:lo(co(i)),input:s.input})}return e}function Ca(t){const e=M.c(16),{plan:s,onApprove:i,onDismiss:o}=t;let r;e[0]!==i||e[1]!==s.plan?(r=()=>{i(s.plan)},e[0]=i,e[1]=s.plan,e[2]=r):r=e[2];const a=r;let c;e[3]!==o?(c=n.jsx(ie,{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:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let l;e[5]!==a?(l=n.jsx(ie,{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(Mi,{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(uo,{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(rt,{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 Na(){const t=M.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(yt,{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 Ia(t){const e=M.c(7),{plans:s,isStreaming:i,onApprove:o,onDismiss:r}=t;if(i&&s.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Na,{}),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]!==o||e[5]!==r?(l=n.jsx(Ca,{plan:c,onApprove:o,onDismiss:r}),e[3]=c,e[4]=o,e[5]=r,e[6]=l):l=e[6],l}function Ta(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 i=s.input;e.push({toolCallId:s.toolCallId,plan:i.plan,state:s.state})}return e}function at(t){return t?"response"in t?t.response:t.option??t.draft:""}const Wn=He({response:tt().min(1,"Response is required")}),Ra=He({option:tt().nullable(),draft:tt()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Pa=He({response:ls(["yes","no"])});function Ea(t){switch(t.type){case"text":return Wn;case"choice":return Ra;case"confirm":return Pa;default:return Wn}}function Da(t){const e={};for(const s of t)e[s.toolCallId]=Ea(s.input);return He(e)}function La(t){const e=M.c(6),{control:s,name:i,placeholder:o}=t;let r;e[0]!==o?(r=c=>{const{field:l}=c;return n.jsxs(me,{children:[n.jsx(fe,{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:o||"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(pe,{})]})},e[0]=o,e[1]=r):r=e[1];let a;return e[2]!==s||e[3]!==i||e[4]!==r?(a=n.jsx(we,{control:s,name:i,render:r}),e[2]=s,e[3]=i,e[4]=r,e[5]=a):a=e[5],a}function Ks(t,e){const s=M.c(4);let i,o;s[0]!==t||s[1]!==e?(i=()=>{const r=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",r),()=>document.removeEventListener("keydown",r)},o=[t,e],s[0]=t,s[1]=e,s[2]=i,s[3]=o):(i=s[2],o=s[3]),A.useEffect(i,o)}function Ma(t){const e=M.c(40),{control:s,name:i,options:o}=t,r=`${i}.option`;let a;e[0]!==s||e[1]!==r?(a={control:s,name:r,defaultValue:null},e[0]=s,e[1]=r,e[2]=a):a=e[2];const{field:c}=Mn(a),l=`${i}.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}=Mn(u),d=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=N=>{const I=o[N];I!=null&&c.onChange(I)},e[6]=c,e[7]=o,e[8]=f):f=e[8],Ks(o.length,f),o.length===0)return null;const y=d===null;let g;if(e[9]!==c||e[10]!==d||e[11]!==o){let N;e[13]!==c||e[14]!==d?(N=(I,k)=>{const R=d===I;return n.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:q("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 ${I}`,children:[n.jsx("span",{className:q("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:I})]},`${k}-${I}`)},e[13]=c,e[14]=d,e[15]=N):N=e[15],g=o.map(N),e[9]=c,e[10]=d,e[11]=o,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=q("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=N=>{V.onChange(N.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 j;e[27]!==S||e[28]!==C||e[29]!==_?(j=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]=j):j=e[30];let x;e[31]!==j||e[32]!==h?(x=n.jsxs("label",{className:h,children:[b,j]}),e[31]=j,e[32]=h,e[33]=x):x=e[33];let w;e[34]!==x||e[35]!==g?(w=n.jsx(fe,{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]=w):w=e[36];let P;e[37]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(pe,{}),e[37]=P):P=e[37];let E;return e[38]!==w?(E=n.jsxs(me,{children:[w,P]}),e[38]=w,e[39]=E):E=e[39],E}function Fa(t){const e=M.c(6),{control:s,name:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const r=o,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{a.current?.onChange(r[V]??"")},e[1]=c):c=e[1],Ks(r.length,c);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=V=>{const{field:d}=V;return a.current=d,n.jsxs(me,{children:[n.jsx(fe,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:r.map(m=>{const f=d.value===m;return n.jsxs("button",{type:"button",onClick:()=>d.onChange(m),className:q("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:q("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(pe,{})]})},e[2]=l):l=e[2];let u;return e[3]!==s||e[4]!==i?(u=n.jsx(we,{control:s,name:i,render:l}),e[3]=s,e[4]=i,e[5]=u):u=e[5],u}function Gn(t){const e=M.c(13),{input:s,control:i,toolCallId:o}=t;switch(s.type){case"text":{const r=`${o}.response`;let a;return e[0]!==i||e[1]!==s.default||e[2]!==r?(a=n.jsx(La,{control:i,name:r,placeholder:s.default}),e[0]=i,e[1]=s.default,e[2]=r,e[3]=a):a=e[3],a}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const a=r;let c;return e[6]!==i||e[7]!==a||e[8]!==o?(c=n.jsx(Ma,{control:i,name:o,options:a}),e[6]=i,e[7]=a,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const r=`${o}.response`;let a;return e[10]!==i||e[11]!==r?(a=n.jsx(Fa,{control:i,name:r}),e[10]=i,e[11]=r,e[12]=a):a=e[12],a}default:return null}}function Ua({parts:t,onSubmit:e}){const[s,i]=A.useState(t[0]?.toolCallId??""),o=Da(t.map(h=>({toolCallId:h.toolCallId,input:h.input}))),r=bn({resolver:yn(o),defaultValues:Object.fromEntries(t.map(h=>h.input?.type==="choice"?[h.toolCallId,{option:null,draft:""}]:[h.toolCallId,{response:""}]))}),a=r.watch(),c=t.findIndex(h=>h.toolCallId===s),l=!!at(a[s]),u=t.every(h=>!!at(a[h.toolCallId])),V=h=>{for(const b of t){const S=at(h[b.toolCallId]);S&&e(b,S)}},d=h=>t.find(b=>!at(h[b.toolCallId])&&b.toolCallId!==s)??null,m=()=>{const h=r.getValues();if(t.every(S=>!!at(h[S.toolCallId])))r.handleSubmit(V)();else{const S=d(h);S&&i(S.toolCallId)}},f=()=>{const h=t.find(S=>S.toolCallId===s),b="user has skip this question";h?.input?.type==="choice"?(r.setValue(`${s}.option`,null),r.setValue(`${s}.draft`,b)):r.setValue(`${s}.response`,b),m()},y=()=>{if(c>0){const h=t[c-1];h&&i(h.toolCallId)}},g=()=>{if(c<t.length-1){const h=t[c+1];h&&i(h.toolCallId)}},p=n.jsxs(n.Fragment,{children:[n.jsx(ie,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),n.jsx(ie,{type:"button",size:"sm",disabled:!l,onClick:m,className:q("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),v=n.jsx(qs,{current:c,total:t.length,onPrev:y,onNext:g});if(t.length===1){const h=t[0];return h?.input?n.jsx(bt,{...r,children:n.jsx("form",{onSubmit:r.handleSubmit(V),autoComplete:"off",children:n.jsx(rt,{icon:n.jsx(Vn,{size:14}),label:"Question pending",title:h.input?.prompt??"Question",defaultExpanded:!0,footerRight:p,children:n.jsx(Gn,{input:h.input,control:r.control,toolCallId:h.toolCallId})})})}):null}return n.jsx(bt,{...r,children:n.jsx("form",{onSubmit:r.handleSubmit(V),autoComplete:"off",children:n.jsx(rt,{icon:n.jsx(Vn,{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(yo,{value:s,onValueChange:i,children:t.map(h=>n.jsx(vo,{value:h.toolCallId,className:"mt-0",children:n.jsx(Gn,{input:h.input,control:r.control,toolCallId:h.toolCallId})},h.toolCallId))})})})})}function Oa(){const t=M.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(Vn,{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 Ys(t){const e=M.c(6),{userAskParts:s,isStreaming:i,onSubmit:o}=t;let r;e[0]!==s?(r=s.filter($a),e[0]=s,e[1]=r):r=e[1];const a=r;if(i){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Oa,{}),e[2]=l):l=e[2],l}if(a.length===0)return null;let c;return e[3]!==o||e[4]!==a?(c=n.jsx(Ua,{parts:a,onSubmit:o}),e[3]=o,e[4]=a,e[5]=c):c=e[5],c}function $a(t){return t.state==="input-available"}const za=He({content:tt().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:ls(["pending","in_progress","completed"]),activeForm:tt().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Ws=He({todos:xi(za)}),Ba="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.";Ki({description:Ba,inputSchema:Yi(Ws),execute:async({todos:t})=>({ok:!0,count:t.length})});const qa="tool-todo_write",Ka=new Set(["input-available","output-available"]);function Ya(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const i=s.parts;if(Array.isArray(i))for(let o=i.length-1;o>=0;o--){const r=i[o];if(r.type!==qa||typeof r.state!="string"||!Ka.has(r.state))continue;const a=Ws.safeParse(r.input);if(a.success)return a.data.todos}}return[]}function Wa(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,i=t.length;if(i>0&&s===i)return{icon:"completed",activity:"All done",progress:`${i}/${i}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${s}/${i} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${i} done`}:s>0?{icon:"pending",activity:`${i-s} pending`,progress:`${s}/${i} done`}:{icon:"pending",activity:`${i} todos`,progress:"not started"}}function Ga(){const t=M.c(21),{messages:e}=zt();let s,i,o,r,a,c,l,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=Ya(e);if(f.length===0){V=null;break e}const y=Wa(f);s=rt,a=n.jsx(Xa,{status:y.icon}),c=y.activity,l=y.progress,u=!1,i="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",r=f.map(Qa)}t[0]=e,t[1]=s,t[2]=i,t[3]=o,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=V}else s=t[1],i=t[2],o=t[3],r=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]!==i||t[11]!==o||t[12]!==r?(d=n.jsx("ul",{"data-testid":i,className:o,children:r}),t[10]=i,t[11]=o,t[12]=r,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 Qa(t,e){return n.jsx(Ha,{todo:t},e)}function Ha(t){const e=M.c(14),{todo:s}=t,i=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Ja,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const c=i&&"text-muted-foreground";let l;e[2]!==c?(l=q("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=l):l=e[3];const u=i?"100%":"0%",V=i?"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]!==r||e[8]!==l||e[9]!==d?(m=n.jsxs("span",{className:l,children:[r,d]}),e[7]=r,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 Ja(t){const e=M.c(4),{status:s}=t,i=s==="completed"?"true":void 0,o=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=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]=r):r=e[0];let a;return e[1]!==i||e[2]!==o?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":i,"data-progress":o,"aria-hidden":"true",children:r}),e[1]=i,e[2]=o,e[3]=a):a=e[3],a}function Xa(t){const e=M.c(3),{status:s}=t;if(s==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0],o}if(s==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=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]=i):i=e[2],i}const Qn=new Map;function Gs(){const{org:t}=ce(),e=qe({connectionId:St,orgId:t.id,orgSlug:t.slug}),s=No(),i=s.find(p=>p.providerId==="deco"),{data:o,isLoading:r,refetch:a,isFetching:c}=Sn({queryKey:Ae.aiProviderCredits(t.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{const p=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return p?.isError?null:p.structuredContent??null}}),l=o?.balanceCents??null,u=l!=null?l/100:null,V=A.useRef(new Map);if(l!=null){const p=Qn.get(t.id);V.current.get(t.id)&&p!=null&&l>p&&B("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=!!i,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:i?.id??null,balanceCents:l,balanceDollars:u,hasCredits:m,isZeroBalance:f,isInitialFreeCredit:y,hasOnlyDecoProvider:g,isLoading:r,isFetching:c,refetch:a}}function Za(t){return t?t.message.startsWith("[CREDITS]"):!1}const el={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"}]},tl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Qs(t){const e=M.c(44),{onDismiss:s}=t,{org:i}=ce(),o=Qe(),{decoKeyId:r}=Gs();let a;e[0]!==i.id||e[1]!==i.slug?(a={connectionId:St,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=a):a=e[2];const c=qe(a),[l,u]=A.useState(""),[V,d]=A.useState(!1),[m,f]=A.useState("usd"),y=m==="brl"?"R$":"$";let g,p;e[3]!==i.id?(g=()=>{B("credits_exhausted_shown",{organization_id:i.id})},p=[i.id],e[3]=i.id,e[4]=g,e[5]=p):(g=e[4],p=e[5]),A.useEffect(g,p);let v;e[6]!==c||e[7]!==m?(v=async T=>{const F=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:T,currency:m}});if(F?.isError)throw new Error(F.content?.[0]?.text??"Failed to get top-up URL");return F.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:il},e[11]=v,e[12]=h,e[13]=b):b=e[13];const{mutate:S,isPending:C}=vn(b),_=parseFloat(l),j=!isNaN(_)&&_>=1;let x;e[14]!==s?(x=T=>!T&&s?.(),e[14]=s,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=["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]=w):w=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:w.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($e,{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(ze,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),n.jsx(Ot,{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 N;e[19]!==m||e[20]!==y||e[21]!==l||e[22]!==_||e[23]!==r||e[24]!==j||e[25]!==C||e[26]!==V||e[27]!==S?(N=r&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ps,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:T=>{T&&f(T)},children:[n.jsx(Dt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(Dt,{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:el[m].map(T=>{const{dollars:F,label:U}=T;return n.jsxs("button",{type:"button",disabled:C,onClick:()=>{B("credits_topup_clicked",{amount_cents:F*100,currency:m,tier_label:U,source:"exhausted_banner"}),S(F*100)},className:q("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,F]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:U})]},F)})}),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(Te,{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(ie,{className:"h-10",disabled:!j||C,onClick:()=>{B("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:tl.map(nl)})]}),e[19]=m,e[20]=y,e[21]=l,e[22]=_,e[23]=r,e[24]=j,e[25]=C,e[26]=V,e[27]=S,e[28]=N):N=e[28];let I;e[29]!==s?(I=n.jsx(ie,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[29]=s,e[30]=I):I=e[30];let k;e[31]!==o||e[32]!==s||e[33]!==i.slug?(k=n.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:i.slug}}),s?.()},children:"Manage providers"}),e[31]=o,e[32]=s,e[33]=i.slug,e[34]=k):k=e[34];let R;e[35]!==I||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:[I,k]}),e[35]=I,e[36]=k,e[37]=R):R=e[37];let L;e[38]!==N||e[39]!==R?(L=n.jsxs(Oe,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:sl,children:[E,N,R]}),e[38]=N,e[39]=R,e[40]=L):L=e[40];let D;return e[41]!==L||e[42]!==x?(D=n.jsx(Ue,{open:!0,onOpenChange:x,children:L}),e[41]=L,e[42]=x,e[43]=D):D=e[43],D}function nl(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(yt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function sl(t){return t.preventDefault()}function il(t){re.error(`Top-up failed: ${t.message}`)}const ol={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 Lt(t){const e=M.c(13),{variant:s,onDismiss:i}=t,o=s==="error",r=o?"Error occurred":"Response incomplete",a=o?t.error.message:ol[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,c=o?Cs:cs;let l;e[0]!==c?(l=n.jsx(c,{size:14}),e[0]=c,e[1]=l):l=e[1];let u;e[2]!==o||e[3]!==t.onContinue||e[4]!==t.onFixInChat?(u=o?n.jsx(ie,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):n.jsx(ie,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[2]=o,e[3]=t.onContinue,e[4]=t.onFixInChat,e[5]=u):u=e[5];let V;return e[6]!==r||e[7]!==a||e[8]!==i||e[9]!==l||e[10]!==u||e[11]!==s?(V=n.jsx(rt,{icon:l,label:r,title:a,defaultExpanded:!0,variant:s,onClose:i,footerRight:u,children:null}),e[6]=r,e[7]=a,e[8]=i,e[9]=l,e[10]=u,e[11]=s,e[12]=V):V=e[12],V}function Jt(){const t=M.c(81),{error:e,clearError:s,finishReason:i,clearFinishReason:o,messages:r,isStreaming:a,isWaitingForApprovals:c,addToolOutput:l,addToolApprovalResponse:u,sendMessage:V}=zt(),[d,m]=An(),{virtualMcpId:f,createTaskWithMessage:y}=Wi();let g,p,v,h,b,S,C,_,j,x,w,P,E,N,I,k,R;if(t[0]!==u||t[1]!==l||t[2]!==s||t[3]!==y||t[4]!==e||t[5]!==i||t[6]!==a||t[7]!==c||t[8]!==r||t[9]!==d||t[10]!==V||t[11]!==m||t[12]!==f){I=Symbol.for("react.early_return_sentinel");e:{const H=r.at(-1);R=H?.role==="assistant"?H.parts.filter(dl):null,_=!!R?.filter(cl)?.length,x=H?.role==="assistant"?Ta(H.parts):[],j=H?.role==="assistant"?_a(H.parts):[];let Q;t[30]!==e||t[31]!==V?(Q=()=>{if(e){const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};V(oe)}},t[30]=e,t[31]=V,t[32]=Q):Q=t[32],v=Q;let z;t[33]!==V?(z=()=>{V({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[33]=V,t[34]=z):z=t[34],p=z;let J;t[35]!==l?(J=(G,oe)=>{l({tool:"user_ask",toolCallId:G.toolCallId,output:{response:oe}})},t[35]=l,t[36]=J):J=t[36],S=J;let Y;t[37]!==y||t[38]!==d||t[39]!==m||t[40]!==f?(Y=G=>{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.`,Dr=["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 Kn(t){const e=M.c(7),{onRecruit:s,isRecruiting:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=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]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"space-y-2",children:[r,n.jsx("ul",{className:"space-y-1.5",children:Dr.map(Lr)})]}),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:[i,a,n.jsx(oe,{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 Lr(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 bu({open:t,onOpenChange:e,existingAgent:s}){const o=Yt(),i=Cn(),r=xs(),[a,c]=A.useState(!1),l=Vs.find(m=>m.id==="ai-research"),u=n.jsx(gs,{icon:l.icon,name:l.title,size:"sm"}),V=async()=>{if(s){e(!1),i(s.id);return}c(!0);try{const m=await r.create.mutateAsync({title:l.title,description:"Systematic research and information synthesis assistant",icon:l.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Er}});B("agent_recruit_confirmed",{template_id:"ai-research",agent_id:m.id}),e(!1),i(m.id)}catch(m){B("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(Bt,{open:t,onOpenChange:e,children:n.jsxs(qt,{className:"h-[70dvh]",children:[n.jsx(Kt,{className:"px-4 pt-4 pb-4 shrink-0",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(Wt,{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(Kn,{onRecruit:V,isRecruiting:a})})]})}):n.jsx(Ue,{open:t,onOpenChange:e,children:n.jsxs(Oe,{className:"sm:max-w-[500px] p-8",children:[n.jsx($e,{className:"mb-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[u,n.jsx(ze,{className:"text-xl font-semibold",children:d})]})}),n.jsx(Kn,{onRecruit:V,isRecruiting:a})]})})}function Mr(t,e,s,o){const i=t.getQueriesData({queryKey:Ae.tasksPrefix(e)});let r=null;for(const[,a]of i)if(a?.items)for(const c of a.items)c.virtual_mcp_id===s&&c.created_by===o&&(c.hidden||(!r||c.updated_at>r.updated_at)&&(r=c));return r}function yu(t){const e=Qe(),s=jt(),o=bs(),{locator:i}=ce(),r=wn({strict:!1}),a=jn({strict:!1}),{data:c}=Ut.useSession(),l=c?.user?.id;return async u=>{const V=l?Mr(s,i,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?ys(s,i,r.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 Fr(t,e){return t===1?!0:t===0?!1:e}function Ur(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",o=t.mainParamPresent?t.mainParamValue!=="0":!s,i=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:o,chatOpen:i}}function vu(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 Or(t,e){return t===1?!0:t===0?!1:e}function wu(t,e){const s=Qe(),o=jn({strict:!1}),i=wn({strict:!1}),r=jt(),a=bs(),{locator:c}=ce(),{virtualMcpId:l,orgSlug:u,isAgentRoute:V}=e,d=Ur({entityMetadata:t,mainParamPresent:o.main!==void 0,mainParamValue:o.main}),m=Or(o.chat,d.chatOpen),f=d.mainOpen,y=A.useRef(crypto.randomUUID()),g=i.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:N=>({...N,...P}),replace:E?.replace??!1})},S=(P,E)=>{s({to:p,params:v(P),search:N=>{const I={};return E?I.virtualmcpid=E:V&&(I.virtualmcpid=l),N.tasks&&(I.tasks=N.tasks),I}})},C=()=>{f?b({main:"0"},{replace:!0}):b({main:ai(t)},{replace:!0})},_=()=>{b({chat:m?0:1},{replace:!0})},j=()=>{m||b({chat:1},{replace:!0})},x=async()=>{const P=crypto.randomUUID(),E=ys(r,c,g);try{await a.create.mutateAsync({id:P,virtual_mcp_id:l,...E?{branch:E}:{}})}catch{}s({to:p,params:v(P),search:N=>{const I={...h,chat:1};return N.tasks&&(I.tasks=N.tasks),I}})},w=P=>{b({main:P},{replace:!0})};return{taskId:g,mainOpen:f,chatOpen:m,mainParam:o.main,setTaskId:S,toggleMain:C,toggleChat:_,openChat:j,createNewTask:x,openTab:w}}const Rn=A.createContext(null);function ju(t){const e=M.c(17),{children:s}=t,o=Qe();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=jn(i);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[1]=a):a=e[1];const c=wn(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}=Ko(l);let V;e[3]!==c.taskId||e[4]!==r.tasks||e[5]!==u?(V=()=>Fr(r.tasks,!!c.taskId&&u.length>0),e[3]=c.taskId,e[4]=r.tasks,e[5]=u,e[6]=V):V=e[6];const[d,m]=A.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]),A.useEffect(f,y);let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=()=>m($r),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(Rn.Provider,{value:v,children:s}),e[14]=s,e[15]=v,e[16]=h):h=e[16],h}function $r(t){return!t}function Au(){const t=A.useContext(Rn);if(!t)throw new Error("useTasksPanelState must be used inside <TasksPanelStateProvider>");return t}function Su(){return A.useContext(Rn)}const $s=A.createContext(null);function Je(){const t=A.use($s);if(!t)throw new Error("Toolbar.* must be used inside <Toolbar>");return t}function Se(t){const e=M.c(10),{children:s}=t,[o,i]=A.useState(null),[r,a]=A.useState(null),[c,l]=A.useState(null),[u,V]=A.useState(null);let d;e[0]!==c||e[1]!==u||e[2]!==r||e[3]!==o?(d={togglesEl:o,setTogglesEl:i,tabsEl:r,setTabsEl:a,centerEl:c,setCenterEl:l,rightEl:u,setRightEl:V},e[0]=c,e[1]=u,e[2]=r,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($s,{value:d,children:m}),e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function zr(t){const e=M.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 Br(t){const e=M.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 qr(t){const e=M.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 Kr(){const t=M.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("button",{type:"button",onClick:Yr,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(xi,{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:Wr,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(ws,{size:16})})]}),t[1]=s):s=t[1],s}function Wr(){return window.history.forward()}function Yr(){return window.history.back()}function Gr(){const t=M.c(2),{setCenterEl:e}=Je();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 Qr(t){const e=M.c(3),{children:s}=t,{centerEl:o}=Je();if(!o)return null;let i;return e[0]!==o||e[1]!==s?(i=At.createPortal(s,o),e[0]=o,e[1]=s,e[2]=i):i=e[2],i}function Hr(){const t=M.c(2),{setTabsEl:e}=Je();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 Jr(t){const e=M.c(3),{children:s}=t,{tabsEl:o}=Je();if(!o)return null;let i;return e[0]!==s||e[1]!==o?(i=At.createPortal(s,o),e[0]=s,e[1]=o,e[2]=i):i=e[2],i}function Xr(){const t=M.c(2),{setTogglesEl:e}=Je();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 Zr(t){const e=M.c(3),{children:s}=t,{togglesEl:o}=Je();if(!o)return null;let i;return e[0]!==s||e[1]!==o?(i=At.createPortal(s,o),e[0]=s,e[1]=o,e[2]=i):i=e[2],i}function ea(){const t=M.c(2),{setRightEl:e}=Je();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 ta(t){const e=M.c(3),{children:s}=t,{rightEl:o}=Je();if(!o)return null;let i;return e[0]!==s||e[1]!==o?(i=At.createPortal(s,o),e[0]=s,e[1]=o,e[2]=i):i=e[2],i}Se.Header=zr;Se.LeftColumn=Br;Se.RightColumn=qr;Se.Nav=Kr;Se.CenterSlot=Gr;Se.Center=Qr;Se.TabsSlot=Hr;Se.Tabs=Jr;Se.TogglesSlot=Xr;Se.Toggles=Zr;Se.RightSlot=ea;Se.Right=ta;function na(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?tt().min(1,"Required"):tt();return He(e)}function sa(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Pn(t){const e=M.c(65),{prompt:s,setPrompt:o,onSubmit:i}=t,r=A.useId();let a;if(e[0]!==s){const T=s?na(s):He({});a=yn(T),e[0]=s,e[1]=a}else a=e[1];const l=a;let u;e[2]!==s?(u=s?sa(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=bn(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]!==i||e[11]!==o?(y=async T=>{await i(T),o(null),d.reset()},e[9]=d,e[10]=i,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||Gt(s.name,Ge(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(ze,{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($e,{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 j;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=F=>n.jsx(we,{control:d.control,name:F.name,render:U=>{const{field:O}=U;return n.jsxs(me,{children:[n.jsxs(Ie,{className:"text-xs",children:[F.name,F.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(fe,{children:n.jsx(Te,{...O,value:O.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(pe,{})]})}},F.name),e[34]=d.control,e[35]=d.formState.isSubmitting,e[36]=T):T=e[36],j=f.map(T),e[30]=f,e[31]=d.control,e[32]=d.formState.isSubmitting,e[33]=j}else j=e[33];let x;e[37]!==v?(x=()=>v(!1),e[37]=v,e[38]=x):x=e[38];let w;e[39]!==d.formState.isSubmitting||e[40]!==x?(w=n.jsx(oe,{type:"button",variant:"ghost",onClick:x,disabled:d.formState.isSubmitting,children:"Cancel"}),e[39]=d.formState.isSubmitting,e[40]=x,e[41]=w):w=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(Pt,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=d.formState.isSubmitting,e[43]=E):E=e[43];let N;e[44]!==r||e[45]!==P||e[46]!==E?(N=n.jsx(oe,{type:"submit",form:r,disabled:P,children:E}),e[44]=r,e[45]=P,e[46]=E,e[47]=N):N=e[47];let I;e[48]!==w||e[49]!==N?(I=n.jsxs(us,{children:[w,N]}),e[48]=w,e[49]=N,e[50]=I):I=e[50];let k;e[51]!==r||e[52]!==_||e[53]!==j||e[54]!==I?(k=n.jsxs("form",{id:r,className:"space-y-4 py-4",autoComplete:"off",onSubmit:_,children:[j,I]}),e[51]=r,e[52]=_,e[53]=j,e[54]=I,e[55]=k):k=e[55];let R;e[56]!==d||e[57]!==k?(R=n.jsx(bt,{...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(Oe,{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(Ue,{open:!0,onOpenChange:v,children:L}),e[62]=v,e[63]=L,e[64]=D):D=e[64],D}function oa(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 ia(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const Wn=3,zs="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",ra="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Bs(t){const e=M.c(46),{item:s,onSelect:o,isLoading:i,isDisabled:r,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 j=Ge(l._meta);u=l.title??Gt(l.name,j),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 j;e[4]!==o||e[5]!==l?(j=()=>o(l),e[4]=o,e[5]=l,e[6]=j):j=e[6];const x=r||i,w=i&&"bg-accent/40",P=(r||i)&&"cursor-not-allowed opacity-50";let E;e[7]!==w||e[8]!==P?(E=q(ra,"hover:bg-accent/60 text-foreground",w,P),e[7]=w,e[8]=P,e[9]=E):E=e[9];let N;e[10]!==V?(N=n.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=N):N=e[11];let I;e[12]!==i?(I=i&&n.jsx(Pt,{size:"xs"}),e[12]=i,e[13]=I):I=e[13];let k;e[14]!==N||e[15]!==I?(k=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,I]}),e[14]=N,e[15]=I,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]!==j||e[22]!==x||e[23]!==E?(L=n.jsxs("button",{type:"button",onClick:j,disabled:x,className:E,children:[k,R]}),e[19]=k,e[20]=R,e[21]=j,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=r||i,y=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let p;e[28]!==y||e[29]!==g?(p=q(zs,"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]!==i?(h=i&&n.jsx(Pt,{size:"xs"}),e[33]=i,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(ft,{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(pt,{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(mt,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=_):_=e[45],_}function aa(t){const e=M.c(41),{items:s,open:o,onOpenChange:i,onSelect:r,loadingPrompt:a}=t,[c,l]=A.useState(""),u=!!a;let V;e[0]!==s||e[1]!==c?(V=c.trim()?s.filter(x=>{const w=c.toLowerCase();return x.prompt.name.toLowerCase().includes(w)||(x.prompt.title??"").toLowerCase().includes(w)||(x.prompt.description??"").toLowerCase().includes(w)}):s,e[0]=s,e[1]=c,e[2]=V):V=e[2];const d=V,m=Yt();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]!==i||e[10]!==r){let x;e[12]!==u||e[13]!==a?.name||e[14]!==i||e[15]!==r?(x=w=>n.jsx(Bs,{item:w,variant:"card",onSelect:P=>{i(!1),r(P)},isLoading:a?.name===w.prompt.name,isDisabled:u&&a?.name!==w.prompt.name},w.prompt.name),e[12]=u,e[13]=a?.name,e[14]=i,e[15]=r,e[16]=x):x=e[16],y=d.map(x),e[6]=d,e[7]=u,e[8]=a?.name,e[9]=i,e[10]=r,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(js,{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(Kt,{className:"sr-only",children:n.jsx(Wt,{children:"All prompts"})}),e[23]=x):x=e[23];let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=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]=w):w=e[24];let P;e[25]!==p||e[26]!==b?(P=n.jsxs(qt,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[x,w,b,p]}),e[25]=p,e[26]=b,e[27]=P):P=e[27];let E;return e[28]!==i||e[29]!==o||e[30]!==P?(E=n.jsx(un,{delayDuration:400,children:n.jsx(Bt,{open:o,onOpenChange:i,children:P})}),e[28]=i,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($e,{className:"sr-only",children:n.jsx(ze,{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(Oe,{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 j;return e[37]!==i||e[38]!==o||e[39]!==_?(j=n.jsx(un,{delayDuration:400,children:n.jsx(Ue,{open:o,onOpenChange:i,children:_})}),e[37]=i,e[38]=o,e[39]=_,e[40]=j):j=e[40],j}function la(t){const e=M.c(29),{items:s,onSelect:o,loadingPrompt:i,className:r}=t,[a,c]=A.useState(!1);if(s.length===0)return null;let l,u,V;if(e[0]!==s||e[1]!==i||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=!!i;let b;e[8]!==u||e[9]!==i?.name||e[10]!==o?(b=S=>n.jsx(Bs,{item:S,onSelect:o,isLoading:i?.name===S.prompt.name,isDisabled:u&&i?.name!==S.prompt.name},S.prompt.name),e[8]=u,e[9]=i?.name,e[10]=o,e[11]=b):b=e[11],V=v.map(b),e[0]=s,e[1]=i,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]!==r?(m=q("w-full flex flex-wrap gap-2 justify-center",r),e[12]=r,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:q(zs,"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]!==i||e[23]!==a||e[24]!==o?(g=n.jsx(aa,{items:s,open:a,onOpenChange:c,onSelect:o,loadingPrompt:i}),e[21]=s,e[22]=i,e[23]=a,e[24]=o,e[25]=g):g=e[25];let p;return e[26]!==y||e[27]!==g?(p=n.jsxs(un,{delayDuration:400,children:[y,g]}),e[26]=y,e[27]=g,e[28]=p):p=e[28],p}function ca(){return null}function da(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 ua(t){const e=M.c(31),{connectionId:s}=t,{sendMessage:o}=zt(),{tiptapDocRef:i}=$t(),{org:r}=ce();let a;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const c=qe(a);let l;e[4]!==c?(l={client:c,staleTime:6e4},e[4]=c,e[5]=l):l=e[5];const{data:u}=bi(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(Va),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]=A.useReducer(da,y),[v,h]=A.useState(null);let b;e[11]!==c||e[12]!==o||e[13]!==i?(b=async(k,R)=>{if(!c){re.error("MCP client not available"),p({type:"RESET"});return}try{const L=await Tn(c,k.name,R);p({type:"RESET"});const D=ia(i.current,{type:"paragraph",content:[li({id:k.name,name:In(k.name,Ge(k._meta)),metadata:L.messages,char:"/"})]});await o(D)}catch(L){console.error("[ice-breakers] Failed to fetch prompt:",L),re.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=c,e[12]=o,e[13]=i,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 j;e[17]!==v||e[18]!==S?(j=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]=j):j=e[19];const x=j;if(f.length===0)return null;const w=g.stage==="loading"?g.prompt:null;let P;e[20]!==_||e[21]!==f||e[22]!==w?(P=n.jsx(la,{items:f,onSelect:_,loadingPrompt:w}),e[20]=_,e[21]=f,e[22]=w,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 N;e[25]!==v||e[26]!==x?(N=n.jsx(Pn,{prompt:v,setPrompt:E,onSubmit:x}),e[25]=v,e[26]=x,e[27]=N):N=e[27];let I;return e[28]!==P||e[29]!==N?(I=n.jsxs(n.Fragment,{children:[P,N]}),e[28]=P,e[29]=N,e[30]=I):I=e[30],I}function Va(t){return{prompt:t}}function ma(t){const e=M.c(13),{className:s}=t,{selectedVirtualMcp:o}=$t(),{org:i}=ce();let r;e[0]!==i.id?(r=_n(i.id),e[0]=i.id,e[1]=r):r=e[1];const a=r.id,c=o?.id??a;let l;e[2]!==s?(l=q("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(ca,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=n.jsx(ua,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=n.jsx(xo,{fallback:null,children:n.jsx(A.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 qs(t){const e=M.c(21),{current:s,total:o,onPrev:i,onNext:r}=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=q("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(_i,{size:14}),e[2]=u):u=e[2];let V;e[3]!==i||e[4]!==a||e[5]!==l?(V=n.jsx("button",{type:"button",onClick:i,disabled:a,className:l,"aria-label":"Previous question",children:u}),e[3]=i,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=q("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(_s,{size:14}),e[12]=p):p=e[12];let v;e[13]!==r||e[14]!==g||e[15]!==f?(v=n.jsx("button",{type:"button",onClick:r,disabled:f,className:g,"aria-label":"Next question",children:p}),e[13]=r,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 rn="cubic-bezier(0.645, 0.045, 0.355, 1)",fa={default:"",error:"bg-destructive/5",warning:"bg-amber-500/5"},pa={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ha={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function rt(t){const e=M.c(61),{icon:s,label:o,count:i,title:r,footerLeft:a,footerRight:c,children:l,defaultExpanded:u,variant:V,onClose:d}=t,m=V===void 0?"default":V,[f,y]=A.useState(u),[g,p]=A.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=pa[m],S=fa[m];let C;e[2]!==b||e[3]!==S?(C=q("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(ga),e[5]=_):_=e[5];const j=f&&"rounded-b-none",x=!f&&"rounded-b-xl";let w;e[6]!==j||e[7]!==x?(w=q("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",j,x),e[6]=j,e[7]=x,e[8]=w):w=e[8];const P=ha[m];let E;e[9]!==P?(E=q("shrink-0",P),e[9]=P,e[10]=E):E=e[10];let N;e[11]!==s||e[12]!==E?(N=n.jsx("span",{className:E,children:s}),e[11]=s,e[12]=E,e[13]=N):N=e[13];let I;e[14]!==o?(I=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:o}),e[14]=o,e[15]=I):I=e[15];let k;e[16]!==i?(k=i?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,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(Ci,{size:16,style:{transform:R,transition:`transform 180ms ${rn}`}})}),e[18]=R,e[19]=L):L=e[19];let D,T;e[20]!==h?(D=Z=>{Z.stopPropagation(),h()},T=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),h())},e[20]=h,e[21]=D,e[22]=T):(D=e[21],T=e[22]);let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx(ct,{size:16}),e[23]=F):F=e[23];let U;e[24]!==D||e[25]!==T?(U=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:F}),e[24]=D,e[25]=T,e[26]=U):U=e[26];let O;e[27]!==f||e[28]!==N||e[29]!==I||e[30]!==k||e[31]!==L||e[32]!==U||e[33]!==w?(O=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:_,className:w,children:[N,I,k,L,U]}),e[27]=f,e[28]=N,e[29]=I,e[30]=k,e[31]=L,e[32]=U,e[33]=w,e[34]=O):O=e[34];const K=f?"1fr":"0fr";let Y;e[35]!==K?(Y={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${rn}`},e[35]=K,e[36]=Y):Y=e[36];let H;e[37]===Symbol.for("react.memo_cache_sentinel")?(H={overflow:"hidden",minHeight:0},e[37]=H):H=e[37];const Q=f?1:0;let z;e[38]!==Q?(z={opacity:Q,transition:`opacity 120ms ${rn}`},e[38]=Q,e[39]=z):z=e[39];let J;e[40]!==r?(J=r?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:r})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=r,e[41]=J):J=e[41];let W;e[42]!==l||e[43]!==r?(W=l?n.jsx("div",{className:q("overflow-clip pb-4",!r&&"pt-4"),children:l}):null,e[42]=l,e[43]=r,e[44]=W):W=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 se;e[48]!==z||e[49]!==J||e[50]!==W||e[51]!==X?(se=n.jsx("div",{style:H,children:n.jsxs("div",{style:z,children:[J,W,X]})}),e[48]=z,e[49]=J,e[50]=W,e[51]=X,e[52]=se):se=e[52];let G;e[53]!==Y||e[54]!==se?(G=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:Y,children:se}),e[53]=Y,e[54]=se,e[55]=G):G=e[55];let ie;return e[56]!==O||e[57]!==G||e[58]!==C||e[59]!==m?(ie=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[O,G]}),e[56]=O,e[57]=G,e[58]=C,e[59]=m,e[60]=ie):ie=e[60],ie}function ga(t){return!t}const xa="User denied this tool call, give other alternatives.",ba=[{value:"readonly",label:"Ask before edit"},{value:"auto",label:"Auto approve"}];function ya(t){const e=M.c(9),{onYolo:s}=t,[o,i]=An();let r;e[0]!==s||e[1]!==o||e[2]!==i?(r=V=>{const d=V;i({...o,toolApprovalLevel:d}),d==="auto"&&s()},e[0]=s,e[1]=o,e[2]=i,e[3]=r):r=e[3];const a=r;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Is,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:wa,children:n.jsx(Ts,{})}),e[4]=c):c=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Rs,{children:ba.map(va)}),e[5]=l):l=e[5];let u;return e[6]!==a||e[7]!==o.toolApprovalLevel?(u=n.jsxs(Ns,{value:o.toolApprovalLevel,onValueChange:a,children:[c,l]}),e[6]=a,e[7]=o.toolApprovalLevel,e[8]=u):u=e[8],u}function va(t){return n.jsx(st,{value:t.value,children:t.label},t.value)}function wa(t){return t.stopPropagation()}function ja(t){const e=M.c(5),{input:s}=t;if(s==null){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=r):r=e[0],r}let o;try{let r;e[1]!==s?(r=JSON.stringify(s,null,2),e[1]=s,e[2]=r):r=e[2],o=r}catch{o=String(s)}let i;return e[3]!==o?(i=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]=i):i=e[4],i}function Aa(t){const e=M.c(44),{approvals:s,onRespond:o}=t,[i,r]=A.useState(0),a=Math.min(i,s.length-1),c=s[a];if(!c)return null;let l;e[0]!==c.approvalId||e[1]!==o?(l=()=>{o(c.approvalId,!1,xa)},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&&r(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&&r(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(ya,{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(qs,{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 j;e[24]!==u?(j=n.jsx(oe,{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]=j):j=e[25];let x;e[26]!==s.length||e[27]!==f?(x=s.length>1&&n.jsx(oe,{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 w;e[29]!==d?(w=n.jsx(oe,{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]=w):w=e[30];let P;e[31]!==x||e[32]!==w||e[33]!==j?(P=n.jsxs(n.Fragment,{children:[j,x,w]}),e[31]=x,e[32]=w,e[33]=j,e[34]=P):P=e[34];const E=P;let N;e[35]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ms,{size:14}),e[35]=N):N=e[35];let I;e[36]!==c.input?(I=n.jsx(ja,{input:c.input}),e[36]=c.input,e[37]=I):I=e[37];let k;return e[38]!==h||e[39]!==c.friendlyName||e[40]!==_||e[41]!==E||e[42]!==I?(k=n.jsx(rt,{icon:N,label:h,title:c.friendlyName,defaultExpanded:!0,footerLeft:_,footerRight:E,children:I}),e[38]=h,e[39]=c.friendlyName,e[40]=_,e[41]=E,e[42]=I,e[43]=k):k=e[43],k}function Sa(){const t=M.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(ms,{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 ka(t){const e=M.c(4),{approvals:s,isStreaming:o,onRespond:i}=t;if(o&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Sa,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let r;return e[1]!==s||e[2]!==i?(r=n.jsx(Aa,{approvals:s,onRespond:i}),e[1]=s,e[2]=i,e[3]=r):r=e[3],r}function _a(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:ci(di(o)),input:s.input})}return e}function Ca(t){const e=M.c(16),{plan:s,onApprove:o,onDismiss:i}=t;let r;e[0]!==o||e[1]!==s.plan?(r=()=>{o(s.plan)},e[0]=o,e[1]=s.plan,e[2]=r):r=e[2];const a=r;let c;e[3]!==i?(c=n.jsx(oe,{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:i,children:"Keep iterating"}),e[3]=i,e[4]=c):c=e[4];let l;e[5]!==a?(l=n.jsx(oe,{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(Fo,{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(ui,{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(rt,{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 Na(){const t=M.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(yt,{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 Ia(t){const e=M.c(7),{plans:s,isStreaming:o,onApprove:i,onDismiss:r}=t;if(o&&s.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Na,{}),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]!==i||e[5]!==r?(l=n.jsx(Ca,{plan:c,onApprove:i,onDismiss:r}),e[3]=c,e[4]=i,e[5]=r,e[6]=l):l=e[6],l}function Ta(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 at(t){return t?"response"in t?t.response:t.option??t.draft:""}const Yn=He({response:tt().min(1,"Response is required")}),Ra=He({option:tt().nullable(),draft:tt()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Pa=He({response:ls(["yes","no"])});function Ea(t){switch(t.type){case"text":return Yn;case"choice":return Ra;case"confirm":return Pa;default:return Yn}}function Da(t){const e={};for(const s of t)e[s.toolCallId]=Ea(s.input);return He(e)}function La(t){const e=M.c(6),{control:s,name:o,placeholder:i}=t;let r;e[0]!==i?(r=c=>{const{field:l}=c;return n.jsxs(me,{children:[n.jsx(fe,{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:i||"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(pe,{})]})},e[0]=i,e[1]=r):r=e[1];let a;return e[2]!==s||e[3]!==o||e[4]!==r?(a=n.jsx(we,{control:s,name:o,render:r}),e[2]=s,e[3]=o,e[4]=r,e[5]=a):a=e[5],a}function Ks(t,e){const s=M.c(4);let o,i;s[0]!==t||s[1]!==e?(o=()=>{const r=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",r),()=>document.removeEventListener("keydown",r)},i=[t,e],s[0]=t,s[1]=e,s[2]=o,s[3]=i):(o=s[2],i=s[3]),A.useEffect(o,i)}function Ma(t){const e=M.c(40),{control:s,name:o,options:i}=t,r=`${o}.option`;let a;e[0]!==s||e[1]!==r?(a={control:s,name:r,defaultValue:null},e[0]=s,e[1]=r,e[2]=a):a=e[2];const{field:c}=Mn(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}=Mn(u),d=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==i?(f=N=>{const I=i[N];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=f):f=e[8],Ks(i.length,f),i.length===0)return null;const y=d===null;let g;if(e[9]!==c||e[10]!==d||e[11]!==i){let N;e[13]!==c||e[14]!==d?(N=(I,k)=>{const R=d===I;return n.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:q("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 ${I}`,children:[n.jsx("span",{className:q("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:I})]},`${k}-${I}`)},e[13]=c,e[14]=d,e[15]=N):N=e[15],g=i.map(N),e[9]=c,e[10]=d,e[11]=i,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=q("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=N=>{V.onChange(N.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 j;e[27]!==S||e[28]!==C||e[29]!==_?(j=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]=j):j=e[30];let x;e[31]!==j||e[32]!==h?(x=n.jsxs("label",{className:h,children:[b,j]}),e[31]=j,e[32]=h,e[33]=x):x=e[33];let w;e[34]!==x||e[35]!==g?(w=n.jsx(fe,{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]=w):w=e[36];let P;e[37]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(pe,{}),e[37]=P):P=e[37];let E;return e[38]!==w?(E=n.jsxs(me,{children:[w,P]}),e[38]=w,e[39]=E):E=e[39],E}function Fa(t){const e=M.c(6),{control:s,name:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const r=i,a=A.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{a.current?.onChange(r[V]??"")},e[1]=c):c=e[1],Ks(r.length,c);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=V=>{const{field:d}=V;return a.current=d,n.jsxs(me,{children:[n.jsx(fe,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:r.map(m=>{const f=d.value===m;return n.jsxs("button",{type:"button",onClick:()=>d.onChange(m),className:q("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:q("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(pe,{})]})},e[2]=l):l=e[2];let u;return e[3]!==s||e[4]!==o?(u=n.jsx(we,{control:s,name:o,render:l}),e[3]=s,e[4]=o,e[5]=u):u=e[5],u}function Gn(t){const e=M.c(13),{input:s,control:o,toolCallId:i}=t;switch(s.type){case"text":{const r=`${i}.response`;let a;return e[0]!==o||e[1]!==s.default||e[2]!==r?(a=n.jsx(La,{control:o,name:r,placeholder:s.default}),e[0]=o,e[1]=s.default,e[2]=r,e[3]=a):a=e[3],a}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const a=r;let c;return e[6]!==o||e[7]!==a||e[8]!==i?(c=n.jsx(Ma,{control:o,name:i,options:a}),e[6]=o,e[7]=a,e[8]=i,e[9]=c):c=e[9],c}case"confirm":{const r=`${i}.response`;let a;return e[10]!==o||e[11]!==r?(a=n.jsx(Fa,{control:o,name:r}),e[10]=o,e[11]=r,e[12]=a):a=e[12],a}default:return null}}function Ua({parts:t,onSubmit:e}){const[s,o]=A.useState(t[0]?.toolCallId??""),i=Da(t.map(h=>({toolCallId:h.toolCallId,input:h.input}))),r=bn({resolver:yn(i),defaultValues:Object.fromEntries(t.map(h=>h.input?.type==="choice"?[h.toolCallId,{option:null,draft:""}]:[h.toolCallId,{response:""}]))}),a=r.watch(),c=t.findIndex(h=>h.toolCallId===s),l=!!at(a[s]),u=t.every(h=>!!at(a[h.toolCallId])),V=h=>{for(const b of t){const S=at(h[b.toolCallId]);S&&e(b,S)}},d=h=>t.find(b=>!at(h[b.toolCallId])&&b.toolCallId!==s)??null,m=()=>{const h=r.getValues();if(t.every(S=>!!at(h[S.toolCallId])))r.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"?(r.setValue(`${s}.option`,null),r.setValue(`${s}.draft`,b)):r.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(oe,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),n.jsx(oe,{type:"button",size:"sm",disabled:!l,onClick:m,className:q("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),v=n.jsx(qs,{current:c,total:t.length,onPrev:y,onNext:g});if(t.length===1){const h=t[0];return h?.input?n.jsx(bt,{...r,children:n.jsx("form",{onSubmit:r.handleSubmit(V),autoComplete:"off",children:n.jsx(rt,{icon:n.jsx(Vn,{size:14}),label:"Question pending",title:h.input?.prompt??"Question",defaultExpanded:!0,footerRight:p,children:n.jsx(Gn,{input:h.input,control:r.control,toolCallId:h.toolCallId})})})}):null}return n.jsx(bt,{...r,children:n.jsx("form",{onSubmit:r.handleSubmit(V),autoComplete:"off",children:n.jsx(rt,{icon:n.jsx(Vn,{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(yi,{value:s,onValueChange:o,children:t.map(h=>n.jsx(vi,{value:h.toolCallId,className:"mt-0",children:n.jsx(Gn,{input:h.input,control:r.control,toolCallId:h.toolCallId})},h.toolCallId))})})})})}function Oa(){const t=M.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(Vn,{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 Ws(t){const e=M.c(6),{userAskParts:s,isStreaming:o,onSubmit:i}=t;let r;e[0]!==s?(r=s.filter($a),e[0]=s,e[1]=r):r=e[1];const a=r;if(o){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Oa,{}),e[2]=l):l=e[2],l}if(a.length===0)return null;let c;return e[3]!==i||e[4]!==a?(c=n.jsx(Ua,{parts:a,onSubmit:i}),e[3]=i,e[4]=a,e[5]=c):c=e[5],c}function $a(t){return t.state==="input-available"}const za=He({content:tt().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:ls(["pending","in_progress","completed"]),activeForm:tt().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),Ys=He({todos:bo(za)}),Ba="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.";Wo({description:Ba,inputSchema:Yo(Ys),execute:async({todos:t})=>({ok:!0,count:t.length})});const qa="tool-todo_write",Ka=new Set(["input-available","output-available"]);function Wa(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 i=o.length-1;i>=0;i--){const r=o[i];if(r.type!==qa||typeof r.state!="string"||!Ka.has(r.state))continue;const a=Ys.safeParse(r.input);if(a.success)return a.data.todos}}return[]}function Ya(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,o=t.length;if(o>0&&s===o)return{icon:"completed",activity:"All done",progress:`${o}/${o}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.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 Ga(){const t=M.c(21),{messages:e}=zt();let s,o,i,r,a,c,l,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=Wa(e);if(f.length===0){V=null;break e}const y=Ya(f);s=rt,a=n.jsx(Xa,{status:y.icon}),c=y.activity,l=y.progress,u=!1,o="todos-list",i="flex flex-col px-2 max-h-[40vh] overflow-y-auto",r=f.map(Qa)}t[0]=e,t[1]=s,t[2]=o,t[3]=i,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=V}else s=t[1],o=t[2],i=t[3],r=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]!==i||t[12]!==r?(d=n.jsx("ul",{"data-testid":o,className:i,children:r}),t[10]=o,t[11]=i,t[12]=r,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 Qa(t,e){return n.jsx(Ha,{todo:t},e)}function Ha(t){const e=M.c(14),{todo:s}=t,o=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Ja,{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=q("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]!==r||e[8]!==l||e[9]!==d?(m=n.jsxs("span",{className:l,children:[r,d]}),e[7]=r,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 Ja(t){const e=M.c(4),{status:s}=t,o=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=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]=r):r=e[0];let a;return e[1]!==o||e[2]!==i?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":o,"data-progress":i,"aria-hidden":"true",children:r}),e[1]=o,e[2]=i,e[3]=a):a=e[3],a}function Xa(t){const e=M.c(3),{status:s}=t;if(s==="completed"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=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]=i):i=e[0],i}if(s==="in_progress"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=i):i=e[1],i}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 Gs(){const{org:t}=ce(),e=qe({connectionId:St,orgId:t.id,orgSlug:t.slug}),s=Ni(),o=s.find(p=>p.providerId==="deco"),{data:i,isLoading:r,refetch:a,isFetching:c}=Sn({queryKey:Ae.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=i?.balanceCents??null,u=l!=null?l/100:null,V=A.useRef(new Map);if(l!=null){const p=Qn.get(t.id);V.current.get(t.id)&&p!=null&&l>p&&B("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:r,isFetching:c,refetch:a}}function Za(t){return t?t.message.startsWith("[CREDITS]"):!1}const el={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"}]},tl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Qs(t){const e=M.c(44),{onDismiss:s}=t,{org:o}=ce(),i=Qe(),{decoKeyId:r}=Gs();let a;e[0]!==o.id||e[1]!==o.slug?(a={connectionId:St,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=a):a=e[2];const c=qe(a),[l,u]=A.useState(""),[V,d]=A.useState(!1),[m,f]=A.useState("usd"),y=m==="brl"?"R$":"$";let g,p;e[3]!==o.id?(g=()=>{B("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]),A.useEffect(g,p);let v;e[6]!==c||e[7]!==m?(v=async T=>{const F=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:T,currency:m}});if(F?.isError)throw new Error(F.content?.[0]?.text??"Failed to get top-up URL");return F.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:ol},e[11]=v,e[12]=h,e[13]=b):b=e[13];const{mutate:S,isPending:C}=vn(b),_=parseFloat(l),j=!isNaN(_)&&_>=1;let x;e[14]!==s?(x=T=>!T&&s?.(),e[14]=s,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=["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]=w):w=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:w.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($e,{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(ze,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),n.jsx(Ot,{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 N;e[19]!==m||e[20]!==y||e[21]!==l||e[22]!==_||e[23]!==r||e[24]!==j||e[25]!==C||e[26]!==V||e[27]!==S?(N=r&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ps,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:T=>{T&&f(T)},children:[n.jsx(Dt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(Dt,{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:el[m].map(T=>{const{dollars:F,label:U}=T;return n.jsxs("button",{type:"button",disabled:C,onClick:()=>{B("credits_topup_clicked",{amount_cents:F*100,currency:m,tier_label:U,source:"exhausted_banner"}),S(F*100)},className:q("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,F]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:U})]},F)})}),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(Te,{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(oe,{className:"h-10",disabled:!j||C,onClick:()=>{B("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:tl.map(nl)})]}),e[19]=m,e[20]=y,e[21]=l,e[22]=_,e[23]=r,e[24]=j,e[25]=C,e[26]=V,e[27]=S,e[28]=N):N=e[28];let I;e[29]!==s?(I=n.jsx(oe,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[29]=s,e[30]=I):I=e[30];let k;e[31]!==i||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:()=>{i({to:"/$org/settings/ai-providers",params:{org:o.slug}}),s?.()},children:"Manage providers"}),e[31]=i,e[32]=s,e[33]=o.slug,e[34]=k):k=e[34];let R;e[35]!==I||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:[I,k]}),e[35]=I,e[36]=k,e[37]=R):R=e[37];let L;e[38]!==N||e[39]!==R?(L=n.jsxs(Oe,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:sl,children:[E,N,R]}),e[38]=N,e[39]=R,e[40]=L):L=e[40];let D;return e[41]!==L||e[42]!==x?(D=n.jsx(Ue,{open:!0,onOpenChange:x,children:L}),e[41]=L,e[42]=x,e[43]=D):D=e[43],D}function nl(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(yt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function sl(t){return t.preventDefault()}function ol(t){re.error(`Top-up failed: ${t.message}`)}const il={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 Lt(t){const e=M.c(13),{variant:s,onDismiss:o}=t,i=s==="error",r=i?"Error occurred":"Response incomplete",a=i?t.error.message:il[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,c=i?Cs:cs;let l;e[0]!==c?(l=n.jsx(c,{size:14}),e[0]=c,e[1]=l):l=e[1];let u;e[2]!==i||e[3]!==t.onContinue||e[4]!==t.onFixInChat?(u=i?n.jsx(oe,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):n.jsx(oe,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[2]=i,e[3]=t.onContinue,e[4]=t.onFixInChat,e[5]=u):u=e[5];let V;return e[6]!==r||e[7]!==a||e[8]!==o||e[9]!==l||e[10]!==u||e[11]!==s?(V=n.jsx(rt,{icon:l,label:r,title:a,defaultExpanded:!0,variant:s,onClose:o,footerRight:u,children:null}),e[6]=r,e[7]=a,e[8]=o,e[9]=l,e[10]=u,e[11]=s,e[12]=V):V=e[12],V}function Jt(){const t=M.c(81),{error:e,clearError:s,finishReason:o,clearFinishReason:i,messages:r,isStreaming:a,isWaitingForApprovals:c,addToolOutput:l,addToolApprovalResponse:u,sendMessage:V}=zt(),[d,m]=An(),{virtualMcpId:f,createTaskWithMessage:y}=Go();let g,p,v,h,b,S,C,_,j,x,w,P,E,N,I,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]!==r||t[9]!==d||t[10]!==V||t[11]!==m||t[12]!==f){I=Symbol.for("react.early_return_sentinel");e:{const H=r.at(-1);R=H?.role==="assistant"?H.parts.filter(dl):null,_=!!R?.filter(cl)?.length,x=H?.role==="assistant"?Ta(H.parts):[],j=H?.role==="assistant"?_a(H.parts):[];let Q;t[30]!==e||t[31]!==V?(Q=()=>{if(e){const ie={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};V(ie)}},t[30]=e,t[31]=V,t[32]=Q):Q=t[32],v=Q;let z;t[33]!==V?(z=()=>{V({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[33]=V,t[34]=z):z=t[34],p=z;let J;t[35]!==l?(J=(G,ie)=>{l({tool:"user_ask",toolCallId:G.toolCallId,output:{response:ie}})},t[35]=l,t[36]=J):J=t[36],S=J;let W;t[37]!==y||t[38]!==d||t[39]!==m||t[40]!==f?(W=G=>{m({...d,toolApprovalLevel:"auto"}),y({virtualMcpId:f,message:{parts:[{type:"text",text:`Implement this plan:
546
546
 
547
- ${G}`}]}})},t[37]=y,t[38]=d,t[39]=m,t[40]=f,t[41]=Y):Y=t[41],h=Y,b=ll;let X;if(t[42]!==u?(X=(G,oe,Z)=>{u({id:G,approved:oe,...Z?{reason:Z}:{}})},t[42]=u,t[43]=X):X=t[43],g=X,!a&&e&&Za(e)){let G;t[44]!==s?(G=n.jsx(Qs,{onDismiss:s}),t[44]=s,t[45]=G):G=t[45],I=G;break e}P=!a&&!!e,C=j.length>0||a&&c;const se=i==="tool-calls"&&(_||C||x.length>0);E=!a&&!!i&&i!=="stop"&&!se&&!P,k=R?.map(al).join("|")??"",w=x[0]?.toolCallId??"",N=j.map(rl).join("|")}t[0]=u,t[1]=l,t[2]=s,t[3]=y,t[4]=e,t[5]=i,t[6]=a,t[7]=c,t[8]=r,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]=j,t[22]=x,t[23]=w,t[24]=P,t[25]=E,t[26]=N,t[27]=I,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],j=t[21],x=t[22],w=t[23],P=t[24],E=t[25],N=t[26],I=t[27],k=t[28],R=t[29];if(I!==Symbol.for("react.early_return_sentinel"))return I;const L=N;let D;t[46]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(Ga,{}),t[46]=D):D=t[46];let T;t[47]!==s||t[48]!==e||t[49]!==v||t[50]!==P?(T=P&&n.jsx(Lt,{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 F;t[52]!==o||t[53]!==i||t[54]!==p||t[55]!==E?(F=E&&n.jsx(Lt,{variant:"warning",finishReason:i,onDismiss:o,onContinue:p}),t[52]=o,t[53]=i,t[54]=p,t[55]=E,t[56]=F):F=t[56];let U;t[57]!==L||t[58]!==g||t[59]!==C||t[60]!==a||t[61]!==j?(U=C&&n.jsx(ka,{approvals:j,isStreaming:a,onRespond:g},L),t[57]=L,t[58]=g,t[59]=C,t[60]=a,t[61]=j,t[62]=U):U=t[62];let O;t[63]!==h||t[64]!==b||t[65]!==a||t[66]!==x||t[67]!==w?(O=x.length>0&&n.jsx(Ia,{plans:x,isStreaming:a,onApprove:h,onDismiss:b},w),t[63]=h,t[64]=b,t[65]=a,t[66]=x,t[67]=w,t[68]=O):O=t[68];let K;t[69]!==S||t[70]!==a||t[71]!==_||t[72]!==k||t[73]!==R?(K=_&&R&&n.jsx(Ys,{userAskParts:R,isStreaming:a,onSubmit:S},k),t[69]=S,t[70]=a,t[71]=_,t[72]=k,t[73]=R,t[74]=K):K=t[74];let W;return t[75]!==T||t[76]!==F||t[77]!==U||t[78]!==O||t[79]!==K?(W=n.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[D,T,F,U,O,K]}),t[75]=T,t[76]=F,t[77]=U,t[78]=O,t[79]=K,t[80]=W):W=t[80],W}function rl(t){return t.approvalId}function al(t){return t.toolCallId}function ll(){document.querySelector("[data-chat-input]")?.focus()}function cl(t){return t.state!=="output-available"}function dl(t){return t.type==="tool-user_ask"}Jt.Error=function(e){return n.jsx(Lt,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Jt.Warning=function(e){return n.jsx(Lt,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Jt.UserAskQuestion=Ys;const an=[{value:"fast",label:"Fast",Icon:Fi,description:"Quicker responses"},{value:"smart",label:"Smart",Icon:Ao,description:"Balanced quality"},{value:"thinking",label:"Thinking",Icon:Ui,description:"Deeper reasoning"}];function ul(t){const e=M.c(17),{tier:s,onSelect:i}=t;let o;e[0]!==s?(o=an.find(f=>f.value===s)??an[1],e[0]=s,e[1]=o):o=e[1];const r=o,a=r.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]!==r.label?(l=n.jsx("span",{className:"hidden sm:inline",children:r.label}),e[4]=r.label,e[5]=l):l=e[5];let u;e[6]!==c||e[7]!==l?(u=n.jsx(Ds,{asChild:!0,children:n.jsxs(ie,{type:"button",variant:"ghost",size:"default",className:"text-muted-foreground hover:text-foreground",children:[c,l]})}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let V;e[9]!==i||e[10]!==s?(V=an.map(f=>{const{value:y,label:g,Icon:p,description:v}=f;return n.jsxs(it,{onSelect:()=>i(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[9]=i,e[10]=s,e[11]=V):V=e[11];let d;e[12]!==V?(d=n.jsx(Ls,{align:"end",className:"w-52 p-1.5",children:V}),e[12]=V,e[13]=d):d=e[13];let m;return e[14]!==u||e[15]!==d?(m=n.jsxs(Ms,{children:[u,d]}),e[14]=u,e[15]=d,e[16]=m):m=e[16],m}async function En(t,e,s,i,o){if(!Qt(e)){re.error("Selected model does not support file uploads");return}const r=s.type||"application/octet-stream";if(!To(r,e)){const c=Es(e),l=e?.title??"This model";o?o({fileName:s.name,modelName:l,accepted:c}):re.error(`"${s.name}" can't be attached`,{description:`${l} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){re.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};Vo(t,{from:i,to:i},V)}catch(c){console.error("Failed to process file:",c),re.error(`Failed to load file "${s.name}"`)}}function Vl(t){const e=M.c(8),{editor:s,selectedModel:i,onUnsupportedFile:o}=t,r=A.useRef(fl);let a,c;e[0]!==s||e[1]!==o||e[2]!==i?(a=()=>{r.current=async(V,d)=>{await En(s,i,V,d,o)}},c=[s,i,o],e[0]=s,e[1]=o,e[2]=i,e[3]=a,e[4]=c):(a=e[3],c=e[4]),A.useEffect(a,c);let l,u;return e[5]!==s?(l=()=>{if(s?.isDestroyed)return;const V=new mn("fileDropHandler");s.state.plugins.find(f=>f.spec.key===V)&&s.unregisterPlugin(V);const m=new Lo({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)r.current?.(C,S);return!0},handlePaste:(f,y)=>{const g=y.clipboardData?.items;if(!g)return!1;const p=Array.from(g).filter(ml);if(p.length===0)return!1;y.preventDefault();const{from:v}=f.state.selection;for(const h of p){const b=h.getAsFile();b&&r.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]),A.useEffect(l,u),null}function ml(t){return t.kind==="file"}function fl(){return Promise.resolve()}function pl(t){const e=M.c(24),{selectedModel:s,isStreaming:i,icon:o,onUnsupportedFile:r}=t,{editor:a}=Ht(),c=A.useRef(null);let l;e[0]!==s?(l=Qt(s),e[0]=s,e[1]=l):l=e[1];const u=l;let V;e[2]!==a||e[3]!==r||e[4]!==s?(V=async C=>{const _=C.target.files;if(!_||_.length===0||!a)return;const j=Array.from(_),{from:x}=a.state.selection,w=x;for(const P of j)await En(a,s,P,w,r);c.current&&(c.current.value="")},e[2]=a,e[3]=r,e[4]=s,e[5]=V):V=e[5];const d=V;if(!a||!u)return null;let m;e[6]!==s?(m=Io(s),e[6]=s,e[7]=m):m=e[7];let f;e[8]!==d||e[9]!==i||e[10]!==m?(f=n.jsx("input",{ref:c,type:"file",multiple:!0,accept:m,className:"hidden",onChange:d,disabled:i}),e[8]=d,e[9]=i,e[10]=m,e[11]=f):f=e[11];const y=i||!u;let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=()=>c.current?.click(),e[12]=g):g=e[12];let p;e[13]!==o?(p=o??n.jsx(ps,{size:16}),e[13]=o,e[14]=p):p=e[14];let v;e[15]!==y||e[16]!==p?(v=n.jsx(ft,{asChild:!0,children:n.jsx(ie,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground/75",disabled:y,onClick:g,children:p})}),e[15]=y,e[16]=p,e[17]=v):v=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(pt,{side:"top",children:"Add file"}),e[18]=h):h=e[18];let b;e[19]!==v?(b=n.jsxs(mt,{children:[v,h]}),e[19]=v,e[20]=b):b=e[20];let S;return e[21]!==b||e[22]!==f?(S=n.jsxs(n.Fragment,{children:[f,b]}),e[21]=b,e[22]=f,e[23]=S):S=e[23],S}function hl(t){const e=M.c(26),{info:s,onClose:i}=t,o=s!==null;let r;e[0]!==i?(r=C=>!C&&i(),e[0]=i,e[1]=r):r=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(cs,{size:18})}),u=n.jsx(ze,{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($e,{className:"relative gap-4",children:[l,n.jsxs("div",{children:[u,n.jsxs(Ot,{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(ps,{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]!==i?(h=n.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:n.jsx(ie,{onClick:i,children:"Got it"})}),e[16]=i,e[17]=h):h=e[17];let b;e[18]!==v||e[19]!==h||e[20]!==d?(b=n.jsxs(Oe,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:gl,children:[d,v,h]}),e[18]=v,e[19]=h,e[20]=d,e[21]=b):b=e[21];let S;return e[22]!==o||e[23]!==b||e[24]!==r?(S=n.jsx(Ue,{open:o,onOpenChange:r,children:b}),e[22]=o,e[23]=b,e[24]=r,e[25]=S):S=e[25],S}function gl(t){return t.preventDefault()}function xl(){const t=M.c(3),[e,s]=A.useState(null);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(null),t[0]=i):i=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:i},t[1]=e,t[2]=o):o=t[2],o}var bl=Mo;var yl=["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] *)"],pn=yl.join(","),Hs=typeof Element>"u",vt=Hs?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Mt=!Hs&&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},Ft=function(e,s){var i;s===void 0&&(s=!0);var o=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"inert"),r=o===""||o==="true",a=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Ft(e.parentNode));return a},vl=function(e){var s,i=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return i===""||i==="true"},wl=function(e,s,i){if(Ft(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(pn));return s&&vt.call(e,pn)&&o.unshift(e),o=o.filter(i),o},hn=function(e,s,i){for(var o=[],r=Array.from(e);r.length;){var a=r.shift();if(!Ft(a,!1))if(a.tagName==="SLOT"){var c=a.assignedElements(),l=c.length?c:a.children,u=hn(l,!0,i);i.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else{var V=vt.call(a,pn);V&&i.filter(a)&&(s||!e.includes(a))&&o.push(a);var d=a.shadowRoot||typeof i.getShadowRoot=="function"&&i.getShadowRoot(a),m=!Ft(d,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(d&&m){var f=hn(d===!0?a.children:d.children,!0,i);i.flatten?o.push.apply(o,f):o.push({scopeParent:a,candidates:f})}else r.unshift.apply(r,a.children)}}return o},Js=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Xs=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||vl(e))&&!Js(e)?0:e.tabIndex},jl=function(e,s){var i=Xs(e);return i<0&&s&&!Js(e)?0:i},Al=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Zs=function(e){return e.tagName==="INPUT"},Sl=function(e){return Zs(e)&&e.type==="hidden"},kl=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(i){return i.tagName==="SUMMARY"});return s},_l=function(e,s){for(var i=0;i<e.length;i++)if(e[i].checked&&e[i].form===s)return e[i]},Cl=function(e){if(!e.name)return!0;var s=e.form||Mt(e),i=function(c){return s.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=i(window.CSS.escape(e.name));else try{o=i(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 r=_l(o,e.form);return!r||r===e},Nl=function(e){return Zs(e)&&e.type==="radio"},Il=function(e){return Nl(e)&&!Cl(e)},Tl=function(e){var s,i=e&&Mt(e),o=(s=i)===null||s===void 0?void 0:s.host,r=!1;if(i&&i!==e){var a,c,l;for(r=!!((a=o)!==null&&a!==void 0&&(c=a.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!r&&o;){var u,V,d;i=Mt(o),o=(u=i)===null||u===void 0?void 0:u.host,r=!!((V=o)!==null&&V!==void 0&&(d=V.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return r},Hn=function(e){var s=e.getBoundingClientRect(),i=s.width,o=s.height;return i===0&&o===0},Rl=function(e,s){var i=s.displayCheck,o=s.getShadowRoot;if(i==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var a=vt.call(e,"details>summary:first-of-type"),c=a?e.parentElement:e;if(vt.call(c,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof o=="function"){for(var l=e;e;){var u=e.parentElement,V=Mt(e);if(u&&!u.shadowRoot&&o(u)===!0)return Hn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=l}if(Tl(e))return!e.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return Hn(e);return!1},Pl=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var i=0;i<s.children.length;i++){var o=s.children.item(i);if(o.tagName==="LEGEND")return vt.call(s,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}s=s.parentElement}return!1},El=function(e,s){return!(s.disabled||Sl(s)||Rl(s,e)||kl(s)||Pl(s))},Jn=function(e,s){return!(Il(s)||Xs(s)<0||!El(e,s))},Dl=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},ei=function(e){var s=[],i=[];return e.forEach(function(o,r){var a=!!o.scopeParent,c=a?o.scopeParent:o,l=jl(c,a),u=a?ei(o.candidates):c;l===0?a?s.push.apply(s,u):s.push(c):i.push({documentOrder:r,tabIndex:l,item:o,isScope:a,content:u})}),i.sort(Al).reduce(function(o,r){return r.isScope?o.push.apply(o,r.content):o.push(r.content),o},[]).concat(s)},ti=function(e,s){s=s||{};var i;return s.getShadowRoot?i=hn([e],s.includeContainer,{filter:Jn.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:Dl}):i=wl(e,s.includeContainer,Jn.bind(null,s)),ei(i)};function Ll(){return/apple/i.test(navigator.vendor)}const Xn="data-floating-ui-focusable";function Ml(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 gn(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&bi(s)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function lt(t){return"composedPath"in t?t.composedPath()[0]:t.target}function ln(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 Fl(t){return t.matches("html,body")}function wt(t){return t?.ownerDocument||document}function Ul(t){return t?t.hasAttribute(Xn)?t:t.querySelector("["+Xn+"]")||t:null}function Rt(t,e,s){return s===void 0&&(s=!0),t.filter(o=>{var r;return o.parentId===e&&(!s||((r=o.context)==null?void 0:r.open))}).flatMap(o=>[o,...Rt(t,o.id,s)])}function Ol(t){return"nativeEvent"in t}var $l=typeof document<"u",zl=function(){},et=$l?A.useLayoutEffect:zl;const Bl={...ds},ql=Bl.useInsertionEffect,Kl=ql||(t=>t());function ot(t){const e=A.useRef(()=>{});return Kl(()=>{e.current=t}),A.useCallback(function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return e.current==null?void 0:e.current(...i)},[])}const ni=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function si(t,e){const s=ti(t,ni()),i=s.length;if(i===0)return;const o=Ml(wt(t)),r=s.indexOf(o),a=r===-1?e===1?0:i-1:r+e;return s[a]}function Yl(t){return si(wt(t).body,1)||t}function Wl(t){return si(wt(t).body,-1)||t}function cn(t,e){const s=e||t.currentTarget,i=t.relatedTarget;return!i||!gn(s,i)}function Gl(t){ti(t,ni()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Zn(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const i=s.dataset.tabindex;delete s.dataset.tabindex,i?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")})}const Ql="data-floating-ui-focusable",es="active",ts="selected",Hl={...ds};let ns=!1,Jl=0;const ss=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Jl++;function Xl(){const[t,e]=A.useState(()=>ns?ss():void 0);return et(()=>{t==null&&e(ss())},[]),A.useEffect(()=>{ns=!0},[]),t}const Zl=Hl.useId,Dn=Zl||Xl;function ec(){const t=new Map;return{emit(e,s){var i;(i=t.get(e))==null||i.forEach(o=>o(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var i;(i=t.get(e))==null||i.delete(s)}}}const tc=A.createContext(null),nc=A.createContext(null),ii=()=>{var t;return((t=A.useContext(tc))==null?void 0:t.id)||null},oi=()=>A.useContext(nc);function Ln(t){return"data-floating-ui-"+t}const sc={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},is=A.forwardRef(function(e,s){const[i,o]=A.useState();et(()=>{Ll()&&o("button")},[]);const r={ref:s,tabIndex:0,role:i,"aria-hidden":i?void 0:!0,[Ln("focus-guard")]:"",style:sc};return n.jsx("span",{...e,...r})}),ic={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ri=A.createContext(null),os=Ln("portal");function oc(t){t===void 0&&(t={});const{id:e,root:s}=t,i=Dn(),o=ac(),[r,a]=A.useState(null),c=A.useRef(null);return et(()=>()=>{r?.remove(),queueMicrotask(()=>{c.current=null})},[r]),et(()=>{if(!i||c.current)return;const l=e?document.getElementById(e):null;if(!l)return;const u=document.createElement("div");u.id=i,u.setAttribute(os,""),l.appendChild(u),c.current=u,a(u)},[e,i]),et(()=>{if(s===null||!i||c.current)return;let l=s||o?.portalNode;l&&!Si(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=i,V.setAttribute(os,""),l=u||l,l.appendChild(V),c.current=V,a(V)},[e,s,i,o]),r}function rc(t){const{children:e,id:s,root:i,preserveTabOrder:o=!0}=t,r=oc({id:s,root:i}),[a,c]=A.useState(null),l=A.useRef(null),u=A.useRef(null),V=A.useRef(null),d=A.useRef(null),m=a?.modal,f=a?.open,y=!!a&&!a.modal&&a.open&&o&&!!(i||r);return A.useEffect(()=>{if(!r||!o||m)return;function g(p){r&&cn(p)&&(p.type==="focusin"?Zn:Gl)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,o,m]),A.useEffect(()=>{r&&(f||Zn(r))},[f,r]),n.jsxs(ri.Provider,{value:A.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:d,portalNode:r,setFocusManagerState:c}),[o,r]),children:[y&&r&&n.jsx(is,{"data-type":"outside",ref:l,onFocus:g=>{if(cn(g,r)){var p;(p=V.current)==null||p.focus()}else{const v=a?a.domReference:null,h=Wl(v);h?.focus()}}}),y&&r&&n.jsx("span",{"aria-owns":r.id,style:ic}),r&&At.createPortal(e,r),y&&r&&n.jsx(is,{"data-type":"outside",ref:u,onFocus:g=>{if(cn(g,r)){var p;(p=d.current)==null||p.focus()}else{const v=a?a.domReference:null,h=Yl(v);h?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const ac=()=>A.useContext(ri),lc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},rs=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 dc(t,e){e===void 0&&(e={});const{open:s,onOpenChange:i,elements:o,dataRef:r}=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=oi(),p=ot(typeof l=="function"?l:()=>!1),v=typeof l=="function"?p:l,h=A.useRef(!1),{escapeKey:b,outsidePress:S}=rs(f),{escapeKey:C,outsidePress:_}=rs(y),j=A.useRef(!1),x=ot(k=>{var R;if(!s||!a||!c||k.key!=="Escape"||j.current)return;const L=(R=r.current.floatingContext)==null?void 0:R.nodeId,D=g?Rt(g.nodesRef.current,L):[];if(!b&&(k.stopPropagation(),D.length>0)){let T=!0;if(D.forEach(F=>{var U;if((U=F.context)!=null&&U.open&&!F.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}i(!1,Ol(k)?k.nativeEvent:k,"escape-key")}),w=ot(k=>{var R;const L=()=>{var D;x(k),(D=lt(k))==null||D.removeEventListener("keydown",L)};(R=lt(k))==null||R.addEventListener("keydown",L)}),P=ot(k=>{var R;const L=r.current.insideReactTree;r.current.insideReactTree=!1;const D=h.current;if(h.current=!1,u==="click"&&D||L||typeof v=="function"&&!v(k))return;const T=lt(k),F="["+Ln("inert")+"]",U=wt(o.floating).querySelectorAll(F);let O=Fe(T)?T:null;for(;O&&!tn(O);){const Q=wi(O);if(tn(Q)||!Fe(Q))break;O=Q}if(U.length&&Fe(T)&&!Fl(T)&&!gn(T,o.floating)&&Array.from(U).every(Q=>!gn(O,Q)))return;if(ji(T)&&I){const Q=tn(T),z=Ai(T),J=/auto|scroll/,Y=Q||J.test(z.overflowX),X=Q||J.test(z.overflowY),se=Y&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,G=X&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,oe=z.direction==="rtl",Z=G&&(oe?k.offsetX<=T.offsetWidth-T.clientWidth:k.offsetX>T.clientWidth),ae=se&&k.offsetY>T.clientHeight;if(Z||ae)return}const K=(R=r.current.floatingContext)==null?void 0:R.nodeId,W=g&&Rt(g.nodesRef.current,K).some(Q=>{var z;return ln(k,(z=Q.context)==null?void 0:z.elements.floating)});if(ln(k,o.floating)||ln(k,o.domReference)||W)return;const H=g?Rt(g.nodesRef.current,K):[];if(H.length>0){let Q=!0;if(H.forEach(z=>{var J;if((J=z.context)!=null&&J.open&&!z.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}i(!1,k,"outside-press")}),E=ot(k=>{var R;const L=()=>{var D;P(k),(D=lt(k))==null||D.removeEventListener(u,L)};(R=lt(k))==null||R.addEventListener(u,L)});A.useEffect(()=>{if(!s||!a)return;r.current.__escapeKeyBubbles=b,r.current.__outsidePressBubbles=S;let k=-1;function R(U){i(!1,U,"ancestor-scroll")}function L(){window.clearTimeout(k),j.current=!0}function D(){k=window.setTimeout(()=>{j.current=!1},vi()?5:0)}const T=wt(o.floating);c&&(T.addEventListener("keydown",C?w:x,C),T.addEventListener("compositionstart",L),T.addEventListener("compositionend",D)),v&&T.addEventListener(u,_?E:P,_);let F=[];return m&&(Fe(o.domReference)&&(F=en(o.domReference)),Fe(o.floating)&&(F=F.concat(en(o.floating))),!Fe(o.reference)&&o.reference&&o.reference.contextElement&&(F=F.concat(en(o.reference.contextElement)))),F=F.filter(U=>{var O;return U!==((O=T.defaultView)==null?void 0:O.visualViewport)}),F.forEach(U=>{U.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(T.removeEventListener("keydown",C?w:x,C),T.removeEventListener("compositionstart",L),T.removeEventListener("compositionend",D)),v&&T.removeEventListener(u,_?E:P,_),F.forEach(U=>{U.removeEventListener("scroll",R)}),window.clearTimeout(k)}},[r,o,c,v,u,s,i,m,a,b,S,x,C,w,P,_,E]),A.useEffect(()=>{r.current.insideReactTree=!1},[r,v,u]);const N=A.useMemo(()=>({onKeyDown:x,...V&&{[lc[d]]:k=>{i(!1,k.nativeEvent,"reference-press")},...d!=="click"&&{onClick(k){i(!1,k.nativeEvent,"reference-press")}}}}),[x,i,V,d]),I=A.useMemo(()=>{function k(R){R.button===0&&(h.current=!0)}return{onKeyDown:x,onMouseDown:k,onMouseUp:k,[cc[u]]:()=>{r.current.insideReactTree=!0}}},[x,u,r]);return A.useMemo(()=>a?{reference:N,floating:I}:{},[a,N,I])}function uc(t){const{open:e=!1,onOpenChange:s,elements:i}=t,o=Dn(),r=A.useRef({}),[a]=A.useState(()=>ec()),c=ii()!=null,[l,u]=A.useState(i.reference),V=ot((f,y,g)=>{r.current.openEvent=f?y:void 0,a.emit("openchange",{open:f,event:y,reason:g,nested:c}),s?.(f,y,g)}),d=A.useMemo(()=>({setPositionReference:u}),[]),m=A.useMemo(()=>({reference:l||i.reference||null,floating:i.floating||null,domReference:i.reference}),[l,i.reference,i.floating]);return A.useMemo(()=>({dataRef:r,open:e,onOpenChange:V,elements:m,events:a,floatingId:o,refs:d}),[e,V,m,a,o,d])}function Vc(t){t===void 0&&(t={});const{nodeId:e}=t,s=uc({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||s,o=i.elements,[r,a]=A.useState(null),[c,l]=A.useState(null),V=o?.domReference||r,d=A.useRef(null),m=oi();et(()=>{V&&(d.current=V)},[V]);const f=yi({...t,elements:{...o,...c&&{reference:c}}}),y=A.useCallback(b=>{const S=Fe(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;l(S),f.refs.setReference(S)},[f.refs]),g=A.useCallback(b=>{(Fe(b)||b===null)&&(d.current=b,a(b)),(Fe(f.refs.reference.current)||f.refs.reference.current===null||b!==null&&!Fe(b))&&f.refs.setReference(b)},[f.refs]),p=A.useMemo(()=>({...f.refs,setReference:g,setPositionReference:y,domReference:d}),[f.refs,g,y]),v=A.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),h=A.useMemo(()=>({...f,...i,refs:p,elements:v,nodeId:e}),[f,p,v,e,i]);return et(()=>{i.dataRef.current.floatingContext=h;const b=m?.nodesRef.current.find(S=>S.id===e);b&&(b.context=h)}),A.useMemo(()=>({...f,context:h,refs:p,elements:v}),[f,p,v,h])}function dn(t,e,s){const i=new Map,o=s==="item";let r=t;if(o&&t){const{[es]:a,[ts]:c,...l}=t;r=l}return{...s==="floating"&&{tabIndex:-1,[Ql]:""},...r,...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(!(o&&[es,ts].includes(u)))if(u.indexOf("on")===0){if(i.has(u)||i.set(u,[]),typeof V=="function"){var d;(d=i.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=i.get(u))==null?void 0:m.map(p=>p(...y)).find(p=>p!==void 0)}}}else a[u]=V}),a),{})}}function mc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),s=t.map(c=>c?.floating),i=t.map(c=>c?.item),o=A.useCallback(c=>dn(c,t,"reference"),e),r=A.useCallback(c=>dn(c,t,"floating"),s),a=A.useCallback(c=>dn(c,t,"item"),i);return A.useMemo(()=>({getReferenceProps:o,getFloatingProps:r,getItemProps:a}),[o,r,a])}const fc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function pc(t,e){var s,i;e===void 0&&(e={});const{open:o,elements:r,floatingId:a}=t,{enabled:c=!0,role:l="dialog"}=e,u=Dn(),V=((s=r.domReference)==null?void 0:s.id)||u,d=A.useMemo(()=>{var h;return((h=Ul(r.floating))==null?void 0:h.id)||a},[r.floating,a]),m=(i=fc.get(l))!=null?i:l,y=ii()!=null,g=A.useMemo(()=>m==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?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,o,V,l]),p=A.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=A.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 A.useMemo(()=>c?{reference:g,floating:p,item:v}:{},[c,g,p,v])}function hc(t){const e=M.c(24),{editor:s,query:i,items:o,onSelect:r,onClose:a}=t,[c,l]=A.useState(0),u=A.useRef(o),V=A.useRef(c),d=A.useRef(r),m=A.useRef(a),f=A.useDeferredValue(i);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],A.useEffect(y,g);let p,v;e[3]!==o.length||e[4]!==c?(p=()=>{c>=o.length&&o.length>0&&l(0)},v=[o.length,c],e[3]=o.length,e[4]=c,e[5]=p,e[6]=v):(p=e[5],v=e[6]),A.useEffect(p,v);let h,b;e[7]!==o?(h=()=>{u.current=o},b=[o],e[7]=o,e[8]=h,e[9]=b):(h=e[8],b=e[9]),A.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]),A.useEffect(S,C);let _,j;e[13]!==r?(j=()=>{d.current=r},_=[r],e[13]=r,e[14]=_,e[15]=j):(_=e[14],j=e[15]),A.useEffect(j,_);let x,w;e[16]!==a?(x=()=>{m.current=a},w=[a],e[16]=a,e[17]=x,e[18]=w):(x=e[17],w=e[18]),A.useEffect(x,w);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 F=()=>l(O=>(O+1)%T.length),U=()=>l(O=>(O-1+T.length)%T.length);switch(D.key){case"ArrowUp":return D.preventDefault(),U(),!0;case"ArrowDown":return D.preventDefault(),F(),!0;case"Tab":return D.preventDefault(),D.shiftKey?U():F(),!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 O=V.current;return O!==-1&&T[O]&&d.current?.(T[O],O),!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]),A.useEffect(P,E);const N=o.length?c:void 0;let I;return e[22]!==N?(I={selectedIndex:N,setSelectedIndex:l},e[22]=N,e[23]=I):I=e[23],I}function gc(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 ai=A.createContext(void 0);function li(){const t=A.useContext(ai);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function xc({editor:t,char:e,pluginKey:s,allow:i,onOpenChange:o}){const[r,a]=A.useReducer(gc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=A.useRef(o);return c.current=o,A.useEffect(()=>{if(t?.isDestroyed)return;const l=s instanceof mn?s:new mn(s);t.state.plugins.find(d=>d.spec.key===l)&&t.unregisterPlugin(l);const V=zo({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!(i&&!i(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,i]),{state:r,dispatch:a}}function bc({editor:t,queryKey:e,queryFn:s,onSelect:i}){const{state:o,dispatch:r}=li(),a=A.useDeferredValue(o.query),{data:c}=ki({queryKey:Ae.suggestionItems(e,o.open,a),queryFn:()=>o.open?s({query:a}):[]}),l=()=>{r({type:"ON_EXIT"})},u=async(d,m)=>{if(!(o.selectedItem!==null||!o.range)){r({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,g=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),p=o.range?{...o.range}:{from:0,to:0};g&&o.range&&(p.to+=1),await i({range:p,item:d})===!1?r({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:V}=hc({editor:t,query:a,items:c,onSelect:u,onClose:l});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:l,onSelect:u}}function yc({children:t}){const{state:e,dispatch:s}=li(),{open:i,element:o}=e,r=()=>{s({type:"ON_EXIT"})},{refs:a,floatingStyles:c,context:l}=Vc({placement:"bottom-start",open:i,onOpenChange:m=>{m||r()},elements:{reference:o},middleware:[_i(10),Ci(),Ni()],whileElementsMounted:Ii}),u=dc(l,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=pc(l,{role:"listbox"}),{getFloatingProps:d}=mc([u,V]);return i?n.jsx(rc,{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 vc=t=>{const e=M.c(29),{item:s,isSelected:i,onSelect:o,isLoading:r,ref:a}=t;let c;if(e[0]!==s){const _=Ge(s._meta);c=s.title||Gt(s.name,_),e[0]=s,e[1]=c}else c=e[1];const l=c,u=s.description||null,V=s.icon,d=i&&"bg-accent text-accent-foreground",m=r&&"pointer-events-none opacity-50";let f;e[2]!==d||e[3]!==m?(f=q("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(Nn,{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]!==r?(p=r&&n.jsx(Pt,{size:"xs"}),e[10]=r,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]!==o||e[23]!==a||e[24]!==b||e[25]!==S||e[26]!==f||e[27]!==y?(C=n.jsxs("div",{ref:a,onClick:o,className:f,children:[y,b,S]}),e[22]=o,e[23]=a,e[24]=b,e[25]=S,e[26]=f,e[27]=y,e[28]=C):C=e[28],C},wc=t=>{const e=M.c(18),{editor:s,queryKey:i,queryFn:o,onSelect:r}=t;let a;e[0]!==s||e[1]!==r||e[2]!==o||e[3]!==i?(a={editor:s,queryKey:i,queryFn:o,onSelect:r},e[0]=s,e[1]=r,e[2]=o,e[3]=i,e[4]=a):a=e[4];const{items:c,selectedIndex:l,onSelect:u,selectedItem:V}=bc(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(vc,{item:g,isSelected:p===l,ref:p===l?Sc: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 jc(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"p-1",children:[...Array(3)].map(Ac)}),t[0]=e):e=t[0],e}function Ac(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 ci(t){const e=M.c(18),{editor:s,char:i,pluginKey:o,queryKey:r,queryFn:a,onSelect:c,allow:l,onOpenChange:u}=t;let V;e[0]!==l||e[1]!==i||e[2]!==s||e[3]!==u||e[4]!==o?(V={editor:s,char:i,pluginKey:o,allow:l,onOpenChange:u},e[0]=l,e[1]=i,e[2]=s,e[3]=u,e[4]=o,e[5]=V):V=e[5];const{state:d,dispatch:m}=xc(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(jc,{}),e[9]=y):y=e[9];let g;e[10]!==s||e[11]!==c||e[12]!==a||e[13]!==r?(g=n.jsx(yc,{children:n.jsx(A.Suspense,{fallback:y,children:n.jsx(wc,{editor:s,queryKey:r,queryFn:a,onSelect:c})})}),e[10]=s,e[11]=c,e[12]=a,e[13]=r,e[14]=g):g=e[14];let p;return e[15]!==f||e[16]!==g?(p=n.jsx(ai.Provider,{value:f,children:g}),e[15]=f,e[16]=g,e[17]=p):p=e[17],p}function Sc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const kc=[{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}],_c=({editor:t,virtualMcpId:e})=>{const s=jt(),{org:i}=ce(),o=so(),r=qe({connectionId:e,orgId:i.id,orgSlug:i.slug}),a=Ae.virtualMcpResources(e,i.id),[c,l]=A.useState("categories"),u=A.useRef(c);u.current=c;const V=A.useRef(null),d=A.useRef(!1),m=["at-mention",i.id,e??"default",c],f=async({item:p,range:v})=>{if(B("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){xt(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&&r){try{const h=await Fs(r,p.uri);xt(t,v,{id:p.uri,name:p.uri,metadata:h.contents,char:"@"})}catch(h){console.error("[at-mention] Failed to fetch resource:",h),re.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 kc;const C=v.toLowerCase(),_=o.filter(x=>x.status==="active"&&(!x.id||!Fn(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})),j=await(async()=>{if(!r)return[];let x=s.getQueryData(a);return x||(x=await s.fetchQuery({queryKey:a,queryFn:()=>gt(r),staleTime:6e4})),(x?.resources??[]).filter(w=>w.uri.toLowerCase().includes(C)||w.name?.toLowerCase().includes(C)||w.description?.toLowerCase().includes(C)).map(w=>({name:w.name??w.uri,title:w.name,description:w.description,kind:"resource",uri:w.uri}))})();return[..._,...j]}if(h==="agents"){let C=o.filter(_=>_.status==="active"&&(!_.id||!Fn(_.id))&&_.id!==e);if(v.trim()){const _=v.toLowerCase();C=C.filter(j=>j.title.toLowerCase().includes(_)||j.description?.toLowerCase().includes(_))}return C.map(_=>({name:_.title,title:_.title,description:_.description??void 0,icon:_.icon??null,kind:"agent",agentId:_.id}))}if(!r)return[];let b=s.getQueryData(a);b?s.fetchQuery({queryKey:a,queryFn:()=>gt(r),staleTime:6e4}).catch(()=>{}):b=await s.fetchQuery({queryKey:a,queryFn:()=>gt(r),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,B("chat_picker_opened",{picker:"@"});else{const v=V.current;B("chat_picker_closed",{picker:"@",outcome:d.current?"selected":"dismissed",duration_ms:v?Date.now()-v:null}),V.current=null,l("categories")}};return n.jsx(ci,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:y,onSelect:f,onOpenChange:g})};function Cc(t,e,s){const i=io(t),o=Ri(),r=new Map(o.map(u=>[u.id,u])),a=(i?.connections??[]).map(u=>u.connection_id),{data:c}=Sn({queryKey:Ae.promptConnectionMap(e,a),queryFn:async()=>{const u={};return await Promise.all(a.map(async V=>{try{const d=await Pi({connectionId:V,orgId:e,orgSlug:s}),m=await Et(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=r.get(V);d&&l.set(u,d)}return l}async function as(t,e,s,i,o,r){try{const a=await Tn(s,i,r);xt(t,e,{id:i,name:In(i,o),metadata:a.messages,char:"/"})}catch(a){console.error("[slash] Failed to fetch prompt:",a),re.error("Failed to load prompt. Please try again.")}}async function Nc(t,e,s,i){try{const o=await Fs(s,i);xt(t,e,{id:i,name:i,metadata:o.contents,char:"/"})}catch(o){console.error("[slash] Failed to fetch resource:",o),re.error("Failed to load resource. Please try again.")}}const Ic=({editor:t,virtualMcpId:e})=>{const s=jt(),{org:i}=ce(),o=qe({connectionId:e,orgId:i.id,orgSlug:i.slug}),r=Cc(e,i.id,i.slug),a=A.useRef(r);a.current=r;const c=Ae.virtualMcpPrompts(e,i.id),l=Ae.virtualMcpResources(e,i.id),u=["slash-mention",i.id,e??"default"],[V,d]=A.useState(null),m=A.useRef(null),f=A.useRef(!1),y=async({item:h,range:b})=>{if(B("chat_picker_item_selected",{picker:"/",item_kind:h.kind,item_name:h.name}),f.current=!0,!!o)if(h.kind==="prompt"){if(h.arguments&&h.arguments.length>0){d({range:b,item:h});return}const S=Ge(h._meta);await as(t,b,o,h.name,S)}else h.uri&&await Nc(t,b,o,h.uri)},g=async h=>{if(!V||!o)return;const{range:b,item:S}=V,C=Ge(S._meta);await as(t,b,o,S.name,C,h),d(null)},p=async h=>{const{query:b}=h;if(!o)return[];const[S,C]=await Promise.all([Tc(s,c,o),Rc(s,l,o)]),_=b.trim().toLowerCase(),j=(S??[]).filter(w=>!_||w.name.toLowerCase().includes(_)||w.title?.toLowerCase().includes(_)||w.description?.toLowerCase().includes(_)).map(w=>({name:w.name,title:w.title,description:w.description,icon:a.current.get(w.name)?.icon??null,kind:"prompt",arguments:w.arguments,_meta:w._meta})),x=(C??[]).filter(w=>!_||w.uri.toLowerCase().includes(_)||w.name?.toLowerCase().includes(_)||w.description?.toLowerCase().includes(_)).map(w=>({name:w.name??w.uri,title:w.name,description:w.description,kind:"resource",uri:w.uri}));return[...j,...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(ci,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:p,onSelect:y,onOpenChange:h=>{if(h)m.current=Date.now(),f.current=!1,B("chat_picker_opened",{picker:"/"});else{const b=m.current;B("chat_picker_closed",{picker:"/",outcome:f.current?"selected":"dismissed",duration_ms:b?Date.now()-b:null}),m.current=null}}}),n.jsx(Pn,{prompt:v,setPrompt:()=>d(null),onSubmit:g})]})};async function Tc(t,e,s){let i=t.getQueryData(e);return i?t.fetchQuery({queryKey:e,queryFn:()=>Et(s),staleTime:6e4}).catch(()=>{}):i=await t.fetchQuery({queryKey:e,queryFn:()=>Et(s),staleTime:6e4}),i?.prompts??[]}async function Rc(t,e,s){let i=t.getQueryData(e);return i?t.fetchQuery({queryKey:e,queryFn:()=>gt(s),staleTime:6e4}).catch(()=>{}):i=await t.fetchQuery({queryKey:e,queryFn:()=>gt(s),staleTime:6e4}),i?.resources??[]}function Pc(t){return[Oo.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),bl.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),mo,fo]}function Ec({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:i=!1,placeholder:o,onSubmit:r,children:a}){const c=A.useRef(r),l=A.useRef(e),u=A.useRef(i),V=A.useRef(o),d=Fo({extensions:Pc(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 A.useEffect(()=>{d?.setEditable(!s)},[d,s]),A.useEffect(()=>{c.current=r},[r]),A.useEffect(()=>{l.current=e},[e]),A.useEffect(()=>{u.current=i},[i]),A.useEffect(()=>{V.current=o},[o]),A.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(Uo.Provider,{value:{editor:d},children:a})}function Dc(t){const e=M.c(26),{disabled:s,virtualMcpId:i,showFileUploader:o,selectedModel:r,onUnsupportedFile:a,ref:c,className:l}=t,u=s===void 0?!1:s,V=o===void 0?!1:o,{editor:d}=Ht();let m,f;if(e[0]!==d?(m=()=>({focus:()=>{d?.commands.focus()},clear:()=>{d?.commands.clearContent(!0)},appendText:x=>{if(!d)return;const w=d.state.doc.textContent.trim()==="";d.commands.focus("end"),w||d.commands.insertContent(" "),d.commands.insertContent(x)},syncVoiceText:(x,w)=>{if(d&&(d.commands.setContent(x||{type:"doc",content:[]}),w)){d.commands.focus("end");const P=d.state.doc.textContent.trim().length>0;d.commands.insertContent(P?" "+w:w)}},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]),A.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=q("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($o,{editor:d,className:p}),e[7]=d,e[8]=p,e[9]=v):v=e[9];const h=i??null;let b;e[10]!==d||e[11]!==h?(b=n.jsx(A.Suspense,{fallback:null,children:n.jsx(Ic,{editor:d,virtualMcpId:h})}),e[10]=d,e[11]=h,e[12]=b):b=e[12];const S=i??null;let C;e[13]!==d||e[14]!==S?(C=n.jsx(A.Suspense,{fallback:null,children:n.jsx(_c,{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]!==r||e[19]!==V?(_=V&&r?n.jsx(Vl,{editor:d,selectedModel:r,onUnsupportedFile:a}):null,e[16]=d,e[17]=a,e[18]=r,e[19]=V,e[20]=_):_=e[20];let j;return e[21]!==b||e[22]!==C||e[23]!==_||e[24]!==v?(j=n.jsxs(n.Fragment,{children:[v,b,C,_]}),e[21]=b,e[22]=C,e[23]=_,e[24]=v,e[25]=j):j=e[25],j}function xn(t){const e=M.c(3),[s]=An();let i;return e[0]!==s.enableSounds||e[1]!==t?(i=()=>{s.enableSounds&&Bo(t.dataUri).catch(r=>{console.warn(`[sound] ${t.name} playback failed:`,r)})},e[0]=s.enableSounds,e[1]=t,e[2]=i):i=e[2],i}const Lc={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"},Mc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Fc(){const t=M.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: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-1 ring-border object-cover bg-white"},t.name)}function Oc(t){const e=M.c(116),{disabled:s,onOpenConnections:i,virtualMcpId:o}=t,[r,a]=A.useState(!1),c=xn(Lc),{org:l}=ce(),{editor:u}=Ht();let V;e[0]!==l.id||e[1]!==l.slug||e[2]!==o?(V={connectionId:o,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=o,e[3]=V):V=e[3];const d=qe(V);let m;e[4]!==l.id||e[5]!==o?(m=Ae.virtualMcpPrompts(o,l.id),e[4]=l.id,e[5]=o,e[6]=m):m=e[6];const f=m;let y;e[7]!==d?(y=()=>Et(d),e[7]=d,e[8]=y):y=e[8];const g=r&&!!d;let p;e[9]!==f||e[10]!==y||e[11]!==g?(p={queryKey:f,queryFn:y,staleTime:6e4,enabled:g},e[9]=f,e[10]=y,e[11]=g,e[12]=p):p=e[12];const{data:v,isLoading:h}=Sn(p);let b;e[13]!==v?.prompts?(b=v?.prompts??[],e[13]=v?.prompts,e[14]=b):b=e[14];const S=b,[C,_]=A.useState(null),{chatMode:j,setChatMode:x}=$t(),w=j==="plan";let P;e[15]!==j||e[16]!==w||e[17]!==c||e[18]!==x?(P=()=>{c();const ne=w?"default":"plan";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[15]=j,e[16]=w,e[17]=c,e[18]=x,e[19]=P):P=e[19];const E=P;let N;e[20]!==i?(N=()=>{i(),a(!1)},e[20]=i,e[21]=N):N=e[21];const I=N;let k;e[22]!==d||e[23]!==u?(k=async(ne,_t)=>{if(!u||!d)return;const ui=Ge(ne._meta),Vi={from:u.state.selection.from,to:u.state.selection.to};try{const mi=await Tn(d,ne.name,_t);xt(u,Vi,{id:ne.name,name:In(ne.name,ui),metadata:mi.messages,char:"/"})}catch{re.error("Failed to load prompt. Please try again.")}},e[22]=d,e[23]=u,e[24]=k):k=e[24];const R=k;let L;e[25]!==R?(L=async ne=>{a(!1);const _t=!!(ne.arguments&&ne.arguments.length>0);if(B("chat_prompt_inserted",{prompt_name:ne.name,with_arguments:_t}),_t){_(ne);return}await R(ne)},e[25]=R,e[26]=L):L=e[26];const D=L;let T;e[27]!==C||e[28]!==R?(T=async ne=>{C&&(await R(C,ne),_(null))},e[27]=C,e[28]=R,e[29]=T):T=e[29];const F=T;let U;e[30]!==j||e[31]!==c||e[32]!==x?(U=()=>{c();const ne=j==="gen-image"?"default":"gen-image";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[30]=j,e[31]=c,e[32]=x,e[33]=U):U=e[33];const O=U;let K;e[34]!==j||e[35]!==c||e[36]!==x?(K=()=>{c();const ne=j==="web-search"?"default":"web-search";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[34]=j,e[35]=c,e[36]=x,e[37]=K):K=e[37];const W=K,H=j==="gen-image",Q=j==="web-search";let z;e[38]!==j||e[39]!==r?(z=ne=>{ne&&!r&&B("chat_tools_popover_opened",{chat_mode:j}),a(ne)},e[38]=j,e[39]=r,e[40]=z):z=e[40];let J,Y;e[41]===Symbol.for("react.memo_cache_sentinel")?(J=n.jsx(Oi,{size:14}),Y=n.jsx("span",{className:"hidden sm:inline",children:"Tools"}),e[41]=J,e[42]=Y):(J=e[41],Y=e[42]);let X;e[43]!==s?(X=n.jsx(Ds,{asChild:!0,children:n.jsxs(ie,{type:"button",variant:"ghost",size:"default",disabled:s,className:"text-muted-foreground hover:text-foreground",children:[J,Y]})}),e[43]=s,e[44]=X):X=e[44];const se=w&&"text-violet-600 dark:text-violet-400";let G;e[45]!==se?(G=q(se),e[45]=se,e[46]=G):G=e[46];const oe=w&&"text-violet-500";let Z;e[47]!==oe?(Z=q(oe),e[47]=oe,e[48]=Z):Z=e[48];let ae;e[49]!==Z?(ae=n.jsx(vs,{size:16,className:Z}),e[49]=Z,e[50]=ae):ae=e[50];let je;e[51]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx("span",{className:"flex-1",children:"Plan mode"}),e[51]=je):je=e[51];let ee;e[52]!==w?(ee=w&&n.jsx("span",{className:"text-xs text-violet-500 font-medium",children:"On"}),e[52]=w,e[53]=ee):ee=e[53];let ue;e[54]!==E||e[55]!==G||e[56]!==ae||e[57]!==ee?(ue=n.jsxs(it,{onClick:E,className:G,children:[ae,je,ee]}),e[54]=E,e[55]=G,e[56]=ae,e[57]=ee,e[58]=ue):ue=e[58];const Re=H&&"text-pink-600 dark:text-pink-400";let Ke;e[59]!==Re?(Ke=q(Re),e[59]=Re,e[60]=Ke):Ke=e[60];const Ye=H&&"text-pink-500";let Pe;e[61]!==Ye?(Pe=q(Ye),e[61]=Ye,e[62]=Pe):Pe=e[62];let he;e[63]!==Pe?(he=n.jsx(As,{size:16,className:Pe}),e[63]=Pe,e[64]=he):he=e[64];let ke;e[65]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx("span",{className:"flex-1",children:"Create image"}),e[65]=ke):ke=e[65];let Ee;e[66]!==H?(Ee=H&&n.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"}),e[66]=H,e[67]=Ee):Ee=e[67];let De;e[68]!==O||e[69]!==Ke||e[70]!==he||e[71]!==Ee?(De=n.jsxs(it,{onClick:O,className:Ke,children:[he,ke,Ee]}),e[68]=O,e[69]=Ke,e[70]=he,e[71]=Ee,e[72]=De):De=e[72];const Xe=Q&&"text-blue-600 dark:text-blue-400";let Le;e[73]!==Xe?(Le=q(Xe),e[73]=Xe,e[74]=Le):Le=e[74];const Me=Q&&"text-blue-500";let ge;e[75]!==Me?(ge=q(Me),e[75]=Me,e[76]=ge):ge=e[76];let xe;e[77]!==ge?(xe=n.jsx(ht,{size:16,className:ge}),e[77]=ge,e[78]=xe):xe=e[78];let _e;e[79]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx("span",{className:"flex-1",children:"Web search"}),e[79]=_e):_e=e[79];let be;e[80]!==Q?(be=Q&&n.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"}),e[80]=Q,e[81]=be):be=e[81];let Ce;e[82]!==W||e[83]!==Le||e[84]!==xe||e[85]!==be?(Ce=n.jsxs(it,{onClick:W,className:Le,children:[xe,_e,be]}),e[82]=W,e[83]=Le,e[84]=xe,e[85]=be,e[86]=Ce):Ce=e[86];let $;e[87]===Symbol.for("react.memo_cache_sentinel")?($=n.jsxs(Po,{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"})]}),e[87]=$):$=e[87];let te;e[88]!==D||e[89]!==h||e[90]!==S?(te=h?n.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[n.jsx(Vt,{size:14,className:"animate-spin"}),"Loading prompts…"]}):S.length===0?n.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):S.map(ne=>n.jsxs(it,{onClick:()=>D(ne),className:"flex flex-col items-start gap-0.5",children:[n.jsx("span",{className:"font-medium text-sm capitalize",children:ne.title||Gt(ne.name,Ge(ne._meta))}),ne.description&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:ne.description})]},ne.name)),e[88]=D,e[89]=h,e[90]=S,e[91]=te):te=e[91];let de;e[92]!==te?(de=n.jsxs(Eo,{children:[$,n.jsx(Do,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:te})]}),e[92]=te,e[93]=de):de=e[93];let Ne,ye;e[94]===Symbol.for("react.memo_cache_sentinel")?(Ne=n.jsx(So,{size:16}),ye=n.jsx("span",{className:"flex-1",children:"Connections"}),e[94]=Ne,e[95]=ye):(Ne=e[94],ye=e[95]);let Be;e[96]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(A.Suspense,{children:n.jsx(Fc,{})}),e[96]=Be):Be=e[96];let ve;e[97]!==I?(ve=n.jsxs(it,{onClick:I,children:[Ne,ye,Be]}),e[97]=I,e[98]=ve):ve=e[98];let le;e[99]!==ue||e[100]!==De||e[101]!==Ce||e[102]!==de||e[103]!==ve?(le=n.jsxs(Ls,{align:"start",className:"w-52 p-1.5",children:[ue,De,Ce,de,ve]}),e[99]=ue,e[100]=De,e[101]=Ce,e[102]=de,e[103]=ve,e[104]=le):le=e[104];let Ve;e[105]!==r||e[106]!==z||e[107]!==X||e[108]!==le?(Ve=n.jsxs(Ms,{open:r,onOpenChange:z,children:[X,le]}),e[105]=r,e[106]=z,e[107]=X,e[108]=le,e[109]=Ve):Ve=e[109];let nt;e[110]!==C||e[111]!==F?(nt=n.jsx(Pn,{prompt:C,setPrompt:_,onSubmit:F}),e[110]=C,e[111]=F,e[112]=nt):nt=e[112];let kt;return e[113]!==Ve||e[114]!==nt?(kt=n.jsxs(n.Fragment,{children:[Ve,nt]}),e[113]=Ve,e[114]=nt,e[115]=kt):kt=e[115],kt}const $c=[{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 zc(){const t=M.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:$c.map(Bc)}),t[0]=e):e=t[0],e}function Bc(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 qc(t){const e=M.c(6),{onClick:s}=t;let i,o,r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=q("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=n.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),r=n.jsx(zc,{}),a=n.jsx(ws,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=i,e[1]=o,e[2]=r,e[3]=a):(i=e[0],o=e[1],r=e[2],a=e[3]);let c;return e[4]!==s?(c=n.jsxs("button",{type:"button",onClick:s,className:i,children:[o,r,a]}),e[4]=s,e[5]=c):c=e[5],c}const ut=48;function Kc(){const t=M.c(9),[e,s]=A.useState("idle"),[i,o]=A.useState(""),[r,a]=A.useState(""),[c,l]=A.useState(Gc),u=A.useRef(null),V=A.useRef(null),d=A.useRef(null),m=A.useRef(null),f=A.useRef(0),y=A.useRef(!1),g=A.useRef(""),p=A.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(Wc),m.current?.getTracks().forEach(Yc),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=N=>{m.current=N;const I=new AudioContext;V.current=I;const k=I.createMediaStreamSource(N),R=I.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 F=0;F<ut;F++){const U=Math.floor(F/ut*L.length);T.push(Math.max(.04,(L[U]??0)/255))}l(T),f.current=requestAnimationFrame(D)};D()};S=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N){s("unsupported");return}let I;try{I=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{s("permission-denied");return}o(""),a(""),p.current="",g.current="",y.current=!0,s("recording"),E(I);const k=new N;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 F=R.results[T],U=F?.[0]?.transcript??"";F?.isFinal?D=D+U:L=L+U}D&&(g.current=g.current+D,o(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(ut).fill(.05)),a("");const E=(g.current+(p.current?" "+p.current:"")).trim();return o(""),g.current="",p.current="",E},t[2]=_):_=t[2];const j=_;let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{y.current=!1,u.current?.abort(),b(),s("idle"),o(""),a(""),l(Array(ut).fill(.05)),g.current="",p.current=""},t[3]=x):x=t[3];const w=x;let P;return t[4]!==r||t[5]!==e||t[6]!==i||t[7]!==c?(P={status:e,transcript:i,interimTranscript:r,waveformData:c,isSupported:v,startRecording:C,stopRecording:j,cancelRecording:w},t[4]=r,t[5]=e,t[6]=i,t[7]=c,t[8]=P):P=t[8],P}function Yc(t){return t.stop()}function Wc(){}function Gc(){return Array(ut).fill(.05)}function Qc(t){const e=M.c(4),{data:s}=t;let i;e[0]!==s?(i=s.map(Hc),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==i?(o=n.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:i}),e[2]=i,e[3]=o):o=e[3],o}function Hc(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 Jc(t,e){const s=M.c(5),{editor:i}=Ht(),[o,r]=A.useState(!1),a=A.useRef(0);let c,l;return s[0]!==i||s[1]!==e||s[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),a.current=a.current+1,r(!0))},V=f=>{f.preventDefault(),a.current=Math.max(0,a.current-1),a.current===0&&r(!1)},d=Xc,m=f=>{if(f.preventDefault(),a.current=0,r(!1),!i||!t||!Qt(t))return;const y=f.dataTransfer?.files;if(!y||y.length===0)return;const{from:g}=i.state.selection;for(const p of Array.from(y))En(i,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=[i,t,e],s[0]=i,s[1]=e,s[2]=t,s[3]=c,s[4]=l):(c=s[3],l=s[4]),A.useEffect(c,l),o}function Xc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Zc(t){const e=M.c(11),{selectedModel:s,onUnsupportedFile:i}=t,o=Jc(s,i);let r;e[0]!==s?(r=Qt(s),e[0]=s,e[1]=r):r=e[1];const a=r,c=o?"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=q("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(ko,{size:24}),n.jsxs("span",{className:"text-sm font-medium",children:["Drop ",Es(s)," here"]})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ss,{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 ed(){const t=M.c(5),e=Qe(),{org:s,locator:i}=ce();let o;return t[0]!==i||t[1]!==e||t[2]!==s.id||t[3]!==s.slug?(o=r=>{const{tiptapDoc:a,virtualMcp:c}=r,l=crypto.randomUUID(),u=c?.id??_n(s.id).id;Hi(sessionStorage,i,l,{tiptapDoc:a}),e({to:"/$org/$taskId",params:{org:s.slug,taskId:l},search:{virtualmcpid:u,autosend:Ji}})},t[0]=i,t[1]=e,t[2]=s.id,t[3]=s.slug,t[4]=o):o=t[4],o}function td({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=Gi(),i=Qi(),o=s?.messages??[],r=s?.isStreaming??!1,a=s?.isRunInProgress??!1,c=s?.stop??(()=>{}),l=i?.taskId??"",u=i?.tasks??[],V=ed(),{selectedModel:d,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:y,imageModel:g,deepResearchModel:p,chatMode:v,setChatMode:h,simpleModeTier:b,setSimpleModeTier:S}=$t(),{data:C}=Ut.useSession(),_=C?.user?.id,{org:j}=ce(),x=_n(j.id).id,w=xn(On),[P,E]=A.useState(!1),{unsupportedFile:N,onUnsupportedFile:I,clearUnsupportedFile:k}=xl(),R=Kc(),L=A.useRef(void 0),D=async()=>{L.current=O,await R.startRecording();const ee=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";B("chat_voice_started",{thread_id:l,outcome:ee})},T=()=>{B("chat_voice_confirmed",{thread_id:l});const ee=R.stopRecording();J.current?.syncVoiceText(L.current,ee),J.current?.focus()},F=()=>{B("chat_voice_cancelled",{thread_id:l}),R.cancelRecording(),J.current?.restoreContent(L.current)};A.useEffect(()=>{if(R.status!=="recording")return;const ee=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();J.current?.syncVoiceText(L.current,ee)},[R.transcript,R.interimTranscript,R.status]);const U=u.find(ee=>ee.id===l),[O,K]=A.useState(void 0),W=ee=>{K(ee),y.current=ee},H=A.useRef(l);H.current!==l&&(H.current=l,K(void 0),y.current=void 0);const z=[...o].reverse().find(ee=>ee.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,J=A.useRef(null),Y=v==="plan";A.useEffect(()=>{const ee=ue=>{oo(ue)&&ue.code==="KeyL"&&(ue.preventDefault(),ue.shiftKey&&h(v==="plan"?"default":"plan"),J.current?.focus())};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[v,h]);const X=po(o),se=[...o].reverse().find(ee=>ee.role==="assistant"&&ee.metadata?.usage)?.metadata?.usage,G=se?.contextTokens??(se?.totalTokens??0)-(se?.reasoningTokens??0),oe=xn(On),Z=!r&&!f&&!ia(O),ae=r||a,je=ee=>{ee?.preventDefault(),r?(B("chat_message_stopped",{thread_id:l}),c()):a?(B("chat_message_stopped",{thread_id:l}),c()):Z&&O&&(B("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:ee?"button_or_enter":"programmatic"}),oe(),s?s.sendMessage(O):V({tiptapDoc:O,virtualMcp:m}),W(void 0))};return _&&U?.created_by&&U.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(Ss,{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&&i&&n.jsx(Jt,{}),n.jsx(Ec,{tiptapDoc:O,setTiptapDoc:W,disabled:r,enterToSubmit:!0,onSubmit:je,children:n.jsxs("form",{onSubmit:je,className:q("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(Zc,{selectedModel:d,onUnsupportedFile:I}),n.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:n.jsx(Dc,{ref:J,disabled:r||R.status==="recording",virtualMcpId:m?.id??x,showFileUploader:!0,selectedModel:d,onUnsupportedFile:I})}),n.jsx("div",{className:"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(Qc,{data:R.waveformData.slice(0,28)}),n.jsx("button",{type:"button",onClick:F,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(ct,{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(yt,{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(pl,{selectedModel:d,isStreaming:r,icon:n.jsx(ks,{size:16}),onUnsupportedFile:I}),n.jsx(Oc,{disabled:r,onOpenConnections:()=>{B("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??x}),Y&&n.jsxs("button",{type:"button",onClick:()=>{w(),B("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),h("default")},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(vs,{size:14,className:"shrink-0"}),"Plan mode",n.jsx(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="gen-image"&&g&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{w(),B("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),h("default")},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(As,{size:14,className:"shrink-0"}),n.jsx("span",{className:"max-w-[120px] truncate",children:"Create image"}),n.jsx(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="web-search"&&p&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{w(),B("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),h("default")},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(ht,{size:14,className:"shrink-0"}),n.jsx("span",{className:"max-w-[120px] truncate",children:"Web search"}),n.jsx(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),z&&G>0&&n.jsx(ho,{usage:X,totalTokens:G,contextWindow:z,onOpenContextPanel:t})]}),n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx(ul,{tier:b,onSelect:S}),R.isSupported&&!r&&!a&&n.jsx(ie,{type:"button",onClick:D,variant:"ghost",size:"icon",className:q("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($i,{size:18})}),n.jsx(ie,{type:ae?"button":"submit",onClick:ee=>{ae&&(ee.preventDefault(),ee.stopPropagation(),c())},variant:Z||ae?"default":"ghost",size:"icon",disabled:!Z&&!ae,className:q("size-8 rounded-lg transition-all",!Z&&!ae&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:r?"Stop generating":a?"Cancel run":"Send message (Enter)",children:ae?n.jsx(zi,{size:20}):n.jsx(jo,{size:20})})]})]})})]})},l),e&&n.jsx(qc,{onClick:()=>{B("connections_banner_clicked",{source:"home_chat_input"}),B("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),n.jsx(mr,{mode:"browse",open:P,onOpenChange:E,defaultTab:"all"}),n.jsx(hl,{info:N,onClose:k})]})}const nd={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 di(t){return`deco-credits-empty-dismissed:${t}`}function ku(t){try{return localStorage.getItem(di(t))==="1"}catch{return!1}}function sd(){const t=M.c(50),{org:e}=ce(),s=Qe(),{decoKeyId:i}=Gs();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:St,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=o):o=t[2];const r=qe(o),[a,c]=A.useState(!0),[l,u]=A.useState(""),[V,d]=A.useState(!1),[m,f]=A.useState("usd"),y=m==="brl"?"R$":"$";let g;t[3]!==e.id?(g=()=>{B("credits_empty_state_dismissed",{organization_id:e.id}),c(!1);try{localStorage.setItem(di(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&&B("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]),A.useEffect(v,h);let b;t[9]!==r||t[10]!==m?(b=async K=>{const W=await r.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:K,currency:m}});if(W?.isError)throw new Error(W.content?.[0]?.text??"Failed to get top-up URL");return W.structuredContent?.url},t[9]=r,t[10]=m,t[11]=b):b=t[11];let S;t[12]!==p?(S=K=>{K&&window.open(K,"_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:od},t[14]=b,t[15]=S,t[16]=C):C=t[16];const{mutate:_,isPending:j}=vn(C),x=parseFloat(l),w=!isNaN(x)&&x>=1;if(!a)return null;let P;t[17]!==p?(P=K=>!K&&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 N;t[20]===Symbol.for("react.memo_cache_sentinel")?(N=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(hs,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[20]=N):N=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[E,n.jsxs($e,{className:"relative gap-3",children:[N,n.jsxs("div",{className:"text-center",children:[n.jsx(ze,{className:"text-lg font-semibold",children:"This workspace has no credits"}),n.jsx(Ot,{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]=I):I=t[21];let k;t[22]!==m||t[23]!==y||t[24]!==l||t[25]!==x||t[26]!==i||t[27]!==w||t[28]!==j||t[29]!==V||t[30]!==_?(k=i&&n.jsxs("div",{className:"px-6 pb-5",children:[n.jsx("div",{className:"mb-4",children:n.jsxs(Ps,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:K=>{K&&f(K)},children:[n.jsx(Dt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(Dt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:nd[m].map(K=>{const{dollars:W,label:H}=K;return n.jsxs("button",{type:"button",disabled:j,onClick:()=>{B("credits_topup_clicked",{amount_cents:W*100,currency:m,tier_label:H,source:"empty_state"}),_(W*100)},className:q("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,W]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:H})]},W)})}),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(Te,{type:"number",min:"1",step:"1",placeholder:"50",value:l,onChange:K=>u(K.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(ie,{className:"h-10",disabled:!w||j,onClick:()=>{B("credits_topup_clicked",{amount_cents:Math.round(x*100),currency:m,tier_label:"custom",source:"empty_state"}),_(Math.round(x*100))},children:j?"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]=i,t[27]=w,t[28]=j,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(_s,{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(ie,{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 F;t[41]!==D||t[42]!==T?(F=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]=F):F=t[43];let U;t[44]!==k||t[45]!==F?(U=n.jsxs(Oe,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:id,children:[I,k,F]}),t[44]=k,t[45]=F,t[46]=U):U=t[46];let O;return t[47]!==U||t[48]!==P?(O=n.jsx(Ue,{open:!0,onOpenChange:P,children:U}),t[47]=U,t[48]=P,t[49]=O):O=t[49],O}function id(t){return t.preventDefault()}function od(t){re.error(`Top-up failed: ${t.message}`)}function rd(t){const e=M.c(6),{balanceDollars:s}=t;let i;e[0]!==s?(i=s.toFixed(2),e[0]=s,e[1]=i):i=e[1];const o=i;let r,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=q("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(hs,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=r,e[3]=a):(r=e[2],a=e[3]);let c;return e[4]!==o?(c=n.jsxs("div",{className:r,children:[a,n.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function ad(){const t=M.c(8),{org:e}=ce(),s=Qe();let i;t[0]!==s||t[1]!==e.slug?(i=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=i):i=t[2];let o,r,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=q("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"),r=n.jsx(Cs,{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]=o,t[4]=r,t[5]=a):(o=t[3],r=t[4],a=t[5]);let c;return t[6]!==i?(c=n.jsxs("button",{type:"button",onClick:i,className:o,children:[r,a]}),t[6]=i,t[7]=c):c=t[7],c}function ld(t){const e=M.c(11),{className:s}=t;let i;e[0]!==s?(i=q("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsxs("div",{className:"flex items-center gap-3",children:[o,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]=r):r=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:[r,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(It,{align:"right",width:"w-3/4"}),n.jsx(It,{align:"left",width:"w-full",lines:3}),n.jsx(It,{align:"right",width:"w-2/3"}),n.jsx(It,{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]!==i?(d=n.jsxs("div",{className:i,children:[a,c,V]}),e[9]=i,e[10]=d):d=e[10],d}function It(t){const e=M.c(22),{align:s,width:i,lines:o}=t,r=i===void 0?"w-full":i,a=o===void 0?1:o,c=s==="right"?"flex-row-reverse":"flex-row";let l;e[0]!==c?(l=q("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=q("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]!==r?(f=q("min-w-0 rounded-2xl p-4",m,r),e[5]=m,e[6]=r,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:q("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 cd(t){const e=M.c(5),{className:s,children:i}=t;let o;e[0]!==s?(o=q("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=o):o=e[1];let r;return e[2]!==i||e[3]!==o?(r=n.jsx("div",{className:o,children:i}),e[2]=i,e[3]=o,e[4]=r):r=e[4],r}function dd(t){const e=M.c(5),{children:s,className:i}=t;let o;e[0]!==i?(o=q("flex-1 min-h-0 overflow-y-auto isolate",i),e[0]=i,e[1]=o):o=e[1];let r;return e[2]!==s||e[3]!==o?(r=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=r):r=e[4],r}function ud(t){const e=M.c(2),{children:s}=t;let i;return e[0]!==s?(i=n.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:s}),e[0]=s,e[1]=i):i=e[1],i}function Vd(){const t=M.c(16),{messages:e,status:s}=zt(),i=go(e);let o;t[0]!==i?(o=i.at(-1),t[0]=i,t[1]=o):o=t[1];const r=o,a=s==="submitted"||s==="streaming";let c;if(t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==e||t[6]!==s){const l=e.at(-1),u=!a&&l?.role==="assistant"&&l.parts.filter(pd).some(fd),V=!a&&l?.role==="assistant"&&l.parts.some(md);let d;if(t[8]!==i||t[9]!==s){let f;t[11]!==i.length||t[12]!==s?(f=(y,g)=>n.jsx(Un,{pair:y,isLastPair:!1,status:g===i.length-1?s:void 0},`pair-${y.user.id}`),t[11]=i.length,t[12]=s,t[13]=f):f=t[13],d=i.slice(0,-1).map(f),t[8]=i,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,r&&n.jsx("div",{className:q("min-h-full min-w-0 max-w-2xl mx-auto w-full",(u||V)&&"pb-60"),children:n.jsx(Un,{pair:r,isLastPair:!0,status:s},`pair-${r?.user.id}`)})]}),t[2]=a,t[3]=r,t[4]=i,t[5]=e,t[6]=s,t[7]=c}else c=t[7];return c}function md(t){return"state"in t&&t.state==="approval-requested"}function fd(t){return t.state==="input-available"}function pd(t){return t.type==="tool-user_ask"}function hd(t){const e=M.c(5),{children:s,className:i}=t;let o;e[0]!==i?(o=q("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",i),e[0]=i,e[1]=o):o=e[1];let r;return e[2]!==s||e[3]!==o?(r=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=r):r=e[4],r}const _u=Object.assign(cd,{Main:dd,Messages:Vd,EmptyState:ud,Footer:hd,Input:td,Provider:Zi,ActiveTaskProvider:Xi,Skeleton:ld,IceBreakers:ma,NoAiProviderEmptyState:Ro,CreditsEmptyState:sd,CreditsEyebrow:rd,NoCreditsEyebrow:ad,CreditsExhaustedBanner:Qs});export{mr as A,_u as C,ul as S,ju as T,Se as a,Gs as b,Ec as c,Dc as d,vu as e,Su as f,wu as g,yu as h,gu as i,xu as j,bu as k,Au as u,ku as w};
547
+ ${G}`}]}})},t[37]=y,t[38]=d,t[39]=m,t[40]=f,t[41]=W):W=t[41],h=W,b=ll;let X;if(t[42]!==u?(X=(G,ie,Z)=>{u({id:G,approved:ie,...Z?{reason:Z}:{}})},t[42]=u,t[43]=X):X=t[43],g=X,!a&&e&&Za(e)){let G;t[44]!==s?(G=n.jsx(Qs,{onDismiss:s}),t[44]=s,t[45]=G):G=t[45],I=G;break e}P=!a&&!!e,C=j.length>0||a&&c;const se=o==="tool-calls"&&(_||C||x.length>0);E=!a&&!!o&&o!=="stop"&&!se&&!P,k=R?.map(al).join("|")??"",w=x[0]?.toolCallId??"",N=j.map(rl).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]=r,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]=j,t[22]=x,t[23]=w,t[24]=P,t[25]=E,t[26]=N,t[27]=I,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],j=t[21],x=t[22],w=t[23],P=t[24],E=t[25],N=t[26],I=t[27],k=t[28],R=t[29];if(I!==Symbol.for("react.early_return_sentinel"))return I;const L=N;let D;t[46]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(Ga,{}),t[46]=D):D=t[46];let T;t[47]!==s||t[48]!==e||t[49]!==v||t[50]!==P?(T=P&&n.jsx(Lt,{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 F;t[52]!==i||t[53]!==o||t[54]!==p||t[55]!==E?(F=E&&n.jsx(Lt,{variant:"warning",finishReason:o,onDismiss:i,onContinue:p}),t[52]=i,t[53]=o,t[54]=p,t[55]=E,t[56]=F):F=t[56];let U;t[57]!==L||t[58]!==g||t[59]!==C||t[60]!==a||t[61]!==j?(U=C&&n.jsx(ka,{approvals:j,isStreaming:a,onRespond:g},L),t[57]=L,t[58]=g,t[59]=C,t[60]=a,t[61]=j,t[62]=U):U=t[62];let O;t[63]!==h||t[64]!==b||t[65]!==a||t[66]!==x||t[67]!==w?(O=x.length>0&&n.jsx(Ia,{plans:x,isStreaming:a,onApprove:h,onDismiss:b},w),t[63]=h,t[64]=b,t[65]=a,t[66]=x,t[67]=w,t[68]=O):O=t[68];let K;t[69]!==S||t[70]!==a||t[71]!==_||t[72]!==k||t[73]!==R?(K=_&&R&&n.jsx(Ws,{userAskParts:R,isStreaming:a,onSubmit:S},k),t[69]=S,t[70]=a,t[71]=_,t[72]=k,t[73]=R,t[74]=K):K=t[74];let Y;return t[75]!==T||t[76]!==F||t[77]!==U||t[78]!==O||t[79]!==K?(Y=n.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[D,T,F,U,O,K]}),t[75]=T,t[76]=F,t[77]=U,t[78]=O,t[79]=K,t[80]=Y):Y=t[80],Y}function rl(t){return t.approvalId}function al(t){return t.toolCallId}function ll(){document.querySelector("[data-chat-input]")?.focus()}function cl(t){return t.state!=="output-available"}function dl(t){return t.type==="tool-user_ask"}Jt.Error=function(e){return n.jsx(Lt,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Jt.Warning=function(e){return n.jsx(Lt,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Jt.UserAskQuestion=Ws;const an=[{value:"fast",label:"Fast",Icon:Uo,description:"Quicker responses"},{value:"smart",label:"Smart",Icon:Ai,description:"Balanced quality"},{value:"thinking",label:"Thinking",Icon:Oo,description:"Deeper reasoning"}];function ul(t){const e=M.c(18),{tier:s,onSelect:o}=t;let i;e[0]!==s?(i=an.find(f=>f.value===s)??an[1],e[0]=s,e[1]=i):i=e[1];const r=i,a=r.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]!==r.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:r.label}),e[4]=r.label,e[5]=l):l=e[5];let u;e[6]!==r.label||e[7]!==c||e[8]!==l?(u=n.jsx(Ds,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"ghost",size:"default",title:r.label,"aria-label":r.label,className:"text-muted-foreground hover:text-foreground",children:[c,l]})}),e[6]=r.label,e[7]=c,e[8]=l,e[9]=u):u=e[9];let V;e[10]!==o||e[11]!==s?(V=an.map(f=>{const{value:y,label:g,Icon:p,description:v}=f;return n.jsxs(ot,{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(Ls,{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(Ms,{children:[u,d]}),e[15]=u,e[16]=d,e[17]=m):m=e[17],m}async function En(t,e,s,o,i){if(!Qt(e)){re.error("Selected model does not support file uploads");return}const r=s.type||"application/octet-stream";if(!Ti(r,e)){const c=Es(e),l=e?.title??"This model";i?i({fileName:s.name,modelName:l,accepted:c}):re.error(`"${s.name}" can't be attached`,{description:`${l} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){re.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};Vi(t,{from:o,to:o},V)}catch(c){console.error("Failed to process file:",c),re.error(`Failed to load file "${s.name}"`)}}function Vl(t){const e=M.c(8),{editor:s,selectedModel:o,onUnsupportedFile:i}=t,r=A.useRef(fl);let a,c;e[0]!==s||e[1]!==i||e[2]!==o?(a=()=>{r.current=async(V,d)=>{await En(s,o,V,d,i)}},c=[s,o,i],e[0]=s,e[1]=i,e[2]=o,e[3]=a,e[4]=c):(a=e[3],c=e[4]),A.useEffect(a,c);let l,u;return e[5]!==s?(l=()=>{if(s?.isDestroyed)return;const V=new mn("fileDropHandler");s.state.plugins.find(f=>f.spec.key===V)&&s.unregisterPlugin(V);const m=new Li({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)r.current?.(C,S);return!0},handlePaste:(f,y)=>{const g=y.clipboardData?.items;if(!g)return!1;const p=Array.from(g).filter(ml);if(p.length===0)return!1;y.preventDefault();const{from:v}=f.state.selection;for(const h of p){const b=h.getAsFile();b&&r.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]),A.useEffect(l,u),null}function ml(t){return t.kind==="file"}function fl(){return Promise.resolve()}function pl(t){const e=M.c(24),{selectedModel:s,isStreaming:o,icon:i,onUnsupportedFile:r}=t,{editor:a}=Ht(),c=A.useRef(null);let l;e[0]!==s?(l=Qt(s),e[0]=s,e[1]=l):l=e[1];const u=l;let V;e[2]!==a||e[3]!==r||e[4]!==s?(V=async C=>{const _=C.target.files;if(!_||_.length===0||!a)return;const j=Array.from(_),{from:x}=a.state.selection,w=x;for(const P of j)await En(a,s,P,w,r);c.current&&(c.current.value="")},e[2]=a,e[3]=r,e[4]=s,e[5]=V):V=e[5];const d=V;if(!a||!u)return null;let m;e[6]!==s?(m=Ii(s),e[6]=s,e[7]=m):m=e[7];let f;e[8]!==d||e[9]!==o||e[10]!==m?(f=n.jsx("input",{ref:c,type:"file",multiple:!0,accept:m,className:"hidden",onChange:d,disabled:o}),e[8]=d,e[9]=o,e[10]=m,e[11]=f):f=e[11];const y=o||!u;let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=()=>c.current?.click(),e[12]=g):g=e[12];let p;e[13]!==i?(p=i??n.jsx(ps,{size:16}),e[13]=i,e[14]=p):p=e[14];let v;e[15]!==y||e[16]!==p?(v=n.jsx(ft,{asChild:!0,children:n.jsx(oe,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground/75",disabled:y,onClick:g,children:p})}),e[15]=y,e[16]=p,e[17]=v):v=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(pt,{side:"top",children:"Add file"}),e[18]=h):h=e[18];let b;e[19]!==v?(b=n.jsxs(mt,{children:[v,h]}),e[19]=v,e[20]=b):b=e[20];let S;return e[21]!==b||e[22]!==f?(S=n.jsxs(n.Fragment,{children:[f,b]}),e[21]=b,e[22]=f,e[23]=S):S=e[23],S}function hl(t){const e=M.c(26),{info:s,onClose:o}=t,i=s!==null;let r;e[0]!==o?(r=C=>!C&&o(),e[0]=o,e[1]=r):r=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(cs,{size:18})}),u=n.jsx(ze,{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($e,{className:"relative gap-4",children:[l,n.jsxs("div",{children:[u,n.jsxs(Ot,{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(ps,{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(oe,{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(Oe,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:gl,children:[d,v,h]}),e[18]=v,e[19]=h,e[20]=d,e[21]=b):b=e[21];let S;return e[22]!==i||e[23]!==b||e[24]!==r?(S=n.jsx(Ue,{open:i,onOpenChange:r,children:b}),e[22]=i,e[23]=b,e[24]=r,e[25]=S):S=e[25],S}function gl(t){return t.preventDefault()}function xl(){const t=M.c(3),[e,s]=A.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>s(null),t[0]=o):o=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:o},t[1]=e,t[2]=i):i=t[2],i}var bl=Mi;var yl=["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] *)"],pn=yl.join(","),Hs=typeof Element>"u",vt=Hs?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Mt=!Hs&&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},Ft=function(e,s){var o;s===void 0&&(s=!0);var i=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),r=i===""||i==="true",a=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Ft(e.parentNode));return a},vl=function(e){var s,o=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return o===""||o==="true"},wl=function(e,s,o){if(Ft(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(pn));return s&&vt.call(e,pn)&&i.unshift(e),i=i.filter(o),i},hn=function(e,s,o){for(var i=[],r=Array.from(e);r.length;){var a=r.shift();if(!Ft(a,!1))if(a.tagName==="SLOT"){var c=a.assignedElements(),l=c.length?c:a.children,u=hn(l,!0,o);o.flatten?i.push.apply(i,u):i.push({scopeParent:a,candidates:u})}else{var V=vt.call(a,pn);V&&o.filter(a)&&(s||!e.includes(a))&&i.push(a);var d=a.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(a),m=!Ft(d,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(d&&m){var f=hn(d===!0?a.children:d.children,!0,o);o.flatten?i.push.apply(i,f):i.push({scopeParent:a,candidates:f})}else r.unshift.apply(r,a.children)}}return i},Js=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Xs=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||vl(e))&&!Js(e)?0:e.tabIndex},jl=function(e,s){var o=Xs(e);return o<0&&s&&!Js(e)?0:o},Al=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Zs=function(e){return e.tagName==="INPUT"},Sl=function(e){return Zs(e)&&e.type==="hidden"},kl=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return s},_l=function(e,s){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===s)return e[o]},Cl=function(e){if(!e.name)return!0;var s=e.form||Mt(e),o=function(c){return s.querySelectorAll('input[type="radio"][name="'+c+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=o(window.CSS.escape(e.name));else try{i=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 r=_l(i,e.form);return!r||r===e},Nl=function(e){return Zs(e)&&e.type==="radio"},Il=function(e){return Nl(e)&&!Cl(e)},Tl=function(e){var s,o=e&&Mt(e),i=(s=o)===null||s===void 0?void 0:s.host,r=!1;if(o&&o!==e){var a,c,l;for(r=!!((a=i)!==null&&a!==void 0&&(c=a.ownerDocument)!==null&&c!==void 0&&c.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!r&&i;){var u,V,d;o=Mt(i),i=(u=o)===null||u===void 0?void 0:u.host,r=!!((V=i)!==null&&V!==void 0&&(d=V.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return r},Hn=function(e){var s=e.getBoundingClientRect(),o=s.width,i=s.height;return o===0&&i===0},Rl=function(e,s){var o=s.displayCheck,i=s.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var a=vt.call(e,"details>summary:first-of-type"),c=a?e.parentElement:e;if(vt.call(c,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var u=e.parentElement,V=Mt(e);if(u&&!u.shadowRoot&&i(u)===!0)return Hn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=l}if(Tl(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return Hn(e);return!1},Pl=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 i=s.children.item(o);if(i.tagName==="LEGEND")return vt.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},El=function(e,s){return!(s.disabled||Sl(s)||Rl(s,e)||kl(s)||Pl(s))},Jn=function(e,s){return!(Il(s)||Xs(s)<0||!El(e,s))},Dl=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},eo=function(e){var s=[],o=[];return e.forEach(function(i,r){var a=!!i.scopeParent,c=a?i.scopeParent:i,l=jl(c,a),u=a?eo(i.candidates):c;l===0?a?s.push.apply(s,u):s.push(c):o.push({documentOrder:r,tabIndex:l,item:i,isScope:a,content:u})}),o.sort(Al).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(s)},to=function(e,s){s=s||{};var o;return s.getShadowRoot?o=hn([e],s.includeContainer,{filter:Jn.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:Dl}):o=wl(e,s.includeContainer,Jn.bind(null,s)),eo(o)};function Ll(){return/apple/i.test(navigator.vendor)}const Xn="data-floating-ui-focusable";function Ml(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 gn(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&yo(s)){let o=e;for(;o;){if(t===o)return!0;o=o.parentNode||o.host}}return!1}function lt(t){return"composedPath"in t?t.composedPath()[0]:t.target}function ln(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 Fl(t){return t.matches("html,body")}function wt(t){return t?.ownerDocument||document}function Ul(t){return t?t.hasAttribute(Xn)?t:t.querySelector("["+Xn+"]")||t:null}function Rt(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var r;return i.parentId===e&&(!s||((r=i.context)==null?void 0:r.open))}).flatMap(i=>[i,...Rt(t,i.id,s)])}function Ol(t){return"nativeEvent"in t}var $l=typeof document<"u",zl=function(){},et=$l?A.useLayoutEffect:zl;const Bl={...ds},ql=Bl.useInsertionEffect,Kl=ql||(t=>t());function it(t){const e=A.useRef(()=>{});return Kl(()=>{e.current=t}),A.useCallback(function(){for(var s=arguments.length,o=new Array(s),i=0;i<s;i++)o[i]=arguments[i];return e.current==null?void 0:e.current(...o)},[])}const no=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function so(t,e){const s=to(t,no()),o=s.length;if(o===0)return;const i=Ml(wt(t)),r=s.indexOf(i),a=r===-1?e===1?0:o-1:r+e;return s[a]}function Wl(t){return so(wt(t).body,1)||t}function Yl(t){return so(wt(t).body,-1)||t}function cn(t,e){const s=e||t.currentTarget,o=t.relatedTarget;return!o||!gn(s,o)}function Gl(t){to(t,no()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Zn(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",es="active",ts="selected",Hl={...ds};let ns=!1,Jl=0;const ss=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Jl++;function Xl(){const[t,e]=A.useState(()=>ns?ss():void 0);return et(()=>{t==null&&e(ss())},[]),A.useEffect(()=>{ns=!0},[]),t}const Zl=Hl.useId,Dn=Zl||Xl;function ec(){const t=new Map;return{emit(e,s){var o;(o=t.get(e))==null||o.forEach(i=>i(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 tc=A.createContext(null),nc=A.createContext(null),oo=()=>{var t;return((t=A.useContext(tc))==null?void 0:t.id)||null},io=()=>A.useContext(nc);function Ln(t){return"data-floating-ui-"+t}const sc={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},os=A.forwardRef(function(e,s){const[o,i]=A.useState();et(()=>{Ll()&&i("button")},[]);const r={ref:s,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[Ln("focus-guard")]:"",style:sc};return n.jsx("span",{...e,...r})}),oc={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ro=A.createContext(null),is=Ln("portal");function ic(t){t===void 0&&(t={});const{id:e,root:s}=t,o=Dn(),i=ac(),[r,a]=A.useState(null),c=A.useRef(null);return et(()=>()=>{r?.remove(),queueMicrotask(()=>{c.current=null})},[r]),et(()=>{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]),et(()=>{if(s===null||!o||c.current)return;let l=s||i?.portalNode;l&&!ko(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,i]),r}function rc(t){const{children:e,id:s,root:o,preserveTabOrder:i=!0}=t,r=ic({id:s,root:o}),[a,c]=A.useState(null),l=A.useRef(null),u=A.useRef(null),V=A.useRef(null),d=A.useRef(null),m=a?.modal,f=a?.open,y=!!a&&!a.modal&&a.open&&i&&!!(o||r);return A.useEffect(()=>{if(!r||!i||m)return;function g(p){r&&cn(p)&&(p.type==="focusin"?Zn:Gl)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,i,m]),A.useEffect(()=>{r&&(f||Zn(r))},[f,r]),n.jsxs(ro.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:d,portalNode:r,setFocusManagerState:c}),[i,r]),children:[y&&r&&n.jsx(os,{"data-type":"outside",ref:l,onFocus:g=>{if(cn(g,r)){var p;(p=V.current)==null||p.focus()}else{const v=a?a.domReference:null,h=Yl(v);h?.focus()}}}),y&&r&&n.jsx("span",{"aria-owns":r.id,style:oc}),r&&At.createPortal(e,r),y&&r&&n.jsx(os,{"data-type":"outside",ref:u,onFocus:g=>{if(cn(g,r)){var p;(p=d.current)==null||p.focus()}else{const v=a?a.domReference:null,h=Wl(v);h?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const ac=()=>A.useContext(ro),lc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},rs=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 dc(t,e){e===void 0&&(e={});const{open:s,onOpenChange:o,elements:i,dataRef:r}=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=io(),p=it(typeof l=="function"?l:()=>!1),v=typeof l=="function"?p:l,h=A.useRef(!1),{escapeKey:b,outsidePress:S}=rs(f),{escapeKey:C,outsidePress:_}=rs(y),j=A.useRef(!1),x=it(k=>{var R;if(!s||!a||!c||k.key!=="Escape"||j.current)return;const L=(R=r.current.floatingContext)==null?void 0:R.nodeId,D=g?Rt(g.nodesRef.current,L):[];if(!b&&(k.stopPropagation(),D.length>0)){let T=!0;if(D.forEach(F=>{var U;if((U=F.context)!=null&&U.open&&!F.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}o(!1,Ol(k)?k.nativeEvent:k,"escape-key")}),w=it(k=>{var R;const L=()=>{var D;x(k),(D=lt(k))==null||D.removeEventListener("keydown",L)};(R=lt(k))==null||R.addEventListener("keydown",L)}),P=it(k=>{var R;const L=r.current.insideReactTree;r.current.insideReactTree=!1;const D=h.current;if(h.current=!1,u==="click"&&D||L||typeof v=="function"&&!v(k))return;const T=lt(k),F="["+Ln("inert")+"]",U=wt(i.floating).querySelectorAll(F);let O=Fe(T)?T:null;for(;O&&!tn(O);){const Q=jo(O);if(tn(Q)||!Fe(Q))break;O=Q}if(U.length&&Fe(T)&&!Fl(T)&&!gn(T,i.floating)&&Array.from(U).every(Q=>!gn(O,Q)))return;if(Ao(T)&&I){const Q=tn(T),z=So(T),J=/auto|scroll/,W=Q||J.test(z.overflowX),X=Q||J.test(z.overflowY),se=W&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,G=X&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,ie=z.direction==="rtl",Z=G&&(ie?k.offsetX<=T.offsetWidth-T.clientWidth:k.offsetX>T.clientWidth),ae=se&&k.offsetY>T.clientHeight;if(Z||ae)return}const K=(R=r.current.floatingContext)==null?void 0:R.nodeId,Y=g&&Rt(g.nodesRef.current,K).some(Q=>{var z;return ln(k,(z=Q.context)==null?void 0:z.elements.floating)});if(ln(k,i.floating)||ln(k,i.domReference)||Y)return;const H=g?Rt(g.nodesRef.current,K):[];if(H.length>0){let Q=!0;if(H.forEach(z=>{var J;if((J=z.context)!=null&&J.open&&!z.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}o(!1,k,"outside-press")}),E=it(k=>{var R;const L=()=>{var D;P(k),(D=lt(k))==null||D.removeEventListener(u,L)};(R=lt(k))==null||R.addEventListener(u,L)});A.useEffect(()=>{if(!s||!a)return;r.current.__escapeKeyBubbles=b,r.current.__outsidePressBubbles=S;let k=-1;function R(U){o(!1,U,"ancestor-scroll")}function L(){window.clearTimeout(k),j.current=!0}function D(){k=window.setTimeout(()=>{j.current=!1},wo()?5:0)}const T=wt(i.floating);c&&(T.addEventListener("keydown",C?w:x,C),T.addEventListener("compositionstart",L),T.addEventListener("compositionend",D)),v&&T.addEventListener(u,_?E:P,_);let F=[];return m&&(Fe(i.domReference)&&(F=en(i.domReference)),Fe(i.floating)&&(F=F.concat(en(i.floating))),!Fe(i.reference)&&i.reference&&i.reference.contextElement&&(F=F.concat(en(i.reference.contextElement)))),F=F.filter(U=>{var O;return U!==((O=T.defaultView)==null?void 0:O.visualViewport)}),F.forEach(U=>{U.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(T.removeEventListener("keydown",C?w:x,C),T.removeEventListener("compositionstart",L),T.removeEventListener("compositionend",D)),v&&T.removeEventListener(u,_?E:P,_),F.forEach(U=>{U.removeEventListener("scroll",R)}),window.clearTimeout(k)}},[r,i,c,v,u,s,o,m,a,b,S,x,C,w,P,_,E]),A.useEffect(()=>{r.current.insideReactTree=!1},[r,v,u]);const N=A.useMemo(()=>({onKeyDown:x,...V&&{[lc[d]]:k=>{o(!1,k.nativeEvent,"reference-press")},...d!=="click"&&{onClick(k){o(!1,k.nativeEvent,"reference-press")}}}}),[x,o,V,d]),I=A.useMemo(()=>{function k(R){R.button===0&&(h.current=!0)}return{onKeyDown:x,onMouseDown:k,onMouseUp:k,[cc[u]]:()=>{r.current.insideReactTree=!0}}},[x,u,r]);return A.useMemo(()=>a?{reference:N,floating:I}:{},[a,N,I])}function uc(t){const{open:e=!1,onOpenChange:s,elements:o}=t,i=Dn(),r=A.useRef({}),[a]=A.useState(()=>ec()),c=oo()!=null,[l,u]=A.useState(o.reference),V=it((f,y,g)=>{r.current.openEvent=f?y:void 0,a.emit("openchange",{open:f,event:y,reason:g,nested:c}),s?.(f,y,g)}),d=A.useMemo(()=>({setPositionReference:u}),[]),m=A.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return A.useMemo(()=>({dataRef:r,open:e,onOpenChange:V,elements:m,events:a,floatingId:i,refs:d}),[e,V,m,a,i,d])}function Vc(t){t===void 0&&(t={});const{nodeId:e}=t,s=uc({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||s,i=o.elements,[r,a]=A.useState(null),[c,l]=A.useState(null),V=i?.domReference||r,d=A.useRef(null),m=io();et(()=>{V&&(d.current=V)},[V]);const f=vo({...t,elements:{...i,...c&&{reference:c}}}),y=A.useCallback(b=>{const S=Fe(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;l(S),f.refs.setReference(S)},[f.refs]),g=A.useCallback(b=>{(Fe(b)||b===null)&&(d.current=b,a(b)),(Fe(f.refs.reference.current)||f.refs.reference.current===null||b!==null&&!Fe(b))&&f.refs.setReference(b)},[f.refs]),p=A.useMemo(()=>({...f.refs,setReference:g,setPositionReference:y,domReference:d}),[f.refs,g,y]),v=A.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),h=A.useMemo(()=>({...f,...o,refs:p,elements:v,nodeId:e}),[f,p,v,e,o]);return et(()=>{o.dataRef.current.floatingContext=h;const b=m?.nodesRef.current.find(S=>S.id===e);b&&(b.context=h)}),A.useMemo(()=>({...f,context:h,refs:p,elements:v}),[f,p,v,h])}function dn(t,e,s){const o=new Map,i=s==="item";let r=t;if(i&&t){const{[es]:a,[ts]:c,...l}=t;r=l}return{...s==="floating"&&{tabIndex:-1,[Ql]:""},...r,...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(!(i&&[es,ts].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 mc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),s=t.map(c=>c?.floating),o=t.map(c=>c?.item),i=A.useCallback(c=>dn(c,t,"reference"),e),r=A.useCallback(c=>dn(c,t,"floating"),s),a=A.useCallback(c=>dn(c,t,"item"),o);return A.useMemo(()=>({getReferenceProps:i,getFloatingProps:r,getItemProps:a}),[i,r,a])}const fc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function pc(t,e){var s,o;e===void 0&&(e={});const{open:i,elements:r,floatingId:a}=t,{enabled:c=!0,role:l="dialog"}=e,u=Dn(),V=((s=r.domReference)==null?void 0:s.id)||u,d=A.useMemo(()=>{var h;return((h=Ul(r.floating))==null?void 0:h.id)||a},[r.floating,a]),m=(o=fc.get(l))!=null?o:l,y=oo()!=null,g=A.useMemo(()=>m==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:i?d:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":i?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,i,V,l]),p=A.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=A.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 A.useMemo(()=>c?{reference:g,floating:p,item:v}:{},[c,g,p,v])}function hc(t){const e=M.c(24),{editor:s,query:o,items:i,onSelect:r,onClose:a}=t,[c,l]=A.useState(0),u=A.useRef(i),V=A.useRef(c),d=A.useRef(r),m=A.useRef(a),f=A.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],A.useEffect(y,g);let p,v;e[3]!==i.length||e[4]!==c?(p=()=>{c>=i.length&&i.length>0&&l(0)},v=[i.length,c],e[3]=i.length,e[4]=c,e[5]=p,e[6]=v):(p=e[5],v=e[6]),A.useEffect(p,v);let h,b;e[7]!==i?(h=()=>{u.current=i},b=[i],e[7]=i,e[8]=h,e[9]=b):(h=e[8],b=e[9]),A.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]),A.useEffect(S,C);let _,j;e[13]!==r?(j=()=>{d.current=r},_=[r],e[13]=r,e[14]=_,e[15]=j):(_=e[14],j=e[15]),A.useEffect(j,_);let x,w;e[16]!==a?(x=()=>{m.current=a},w=[a],e[16]=a,e[17]=x,e[18]=w):(x=e[17],w=e[18]),A.useEffect(x,w);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 F=()=>l(O=>(O+1)%T.length),U=()=>l(O=>(O-1+T.length)%T.length);switch(D.key){case"ArrowUp":return D.preventDefault(),U(),!0;case"ArrowDown":return D.preventDefault(),F(),!0;case"Tab":return D.preventDefault(),D.shiftKey?U():F(),!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 O=V.current;return O!==-1&&T[O]&&d.current?.(T[O],O),!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]),A.useEffect(P,E);const N=i.length?c:void 0;let I;return e[22]!==N?(I={selectedIndex:N,setSelectedIndex:l},e[22]=N,e[23]=I):I=e[23],I}function gc(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 ao=A.createContext(void 0);function lo(){const t=A.useContext(ao);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function xc({editor:t,char:e,pluginKey:s,allow:o,onOpenChange:i}){const[r,a]=A.useReducer(gc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=A.useRef(i);return c.current=i,A.useEffect(()=>{if(t?.isDestroyed)return;const l=s instanceof mn?s:new mn(s);t.state.plugins.find(d=>d.spec.key===l)&&t.unregisterPlugin(l);const V=zi({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:r,dispatch:a}}function bc({editor:t,queryKey:e,queryFn:s,onSelect:o}){const{state:i,dispatch:r}=lo(),a=A.useDeferredValue(i.query),{data:c}=_o({queryKey:Ae.suggestionItems(e,i.open,a),queryFn:()=>i.open?s({query:a}):[]}),l=()=>{r({type:"ON_EXIT"})},u=async(d,m)=>{if(!(i.selectedItem!==null||!i.range)){r({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,g=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),p=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(p.to+=1),await o({range:p,item:d})===!1?r({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:V}=hc({editor:t,query:a,items:c,onSelect:u,onClose:l});return{selectedItem:i.selectedItem,items:c,selectedIndex:V,close:l,onSelect:u}}function yc({children:t}){const{state:e,dispatch:s}=lo(),{open:o,element:i}=e,r=()=>{s({type:"ON_EXIT"})},{refs:a,floatingStyles:c,context:l}=Vc({placement:"bottom-start",open:o,onOpenChange:m=>{m||r()},elements:{reference:i},middleware:[Co(10),No(),Io()],whileElementsMounted:To}),u=dc(l,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=pc(l,{role:"listbox"}),{getFloatingProps:d}=mc([u,V]);return o?n.jsx(rc,{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 vc=t=>{const e=M.c(29),{item:s,isSelected:o,onSelect:i,isLoading:r,ref:a}=t;let c;if(e[0]!==s){const _=Ge(s._meta);c=s.title||Gt(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=r&&"pointer-events-none opacity-50";let f;e[2]!==d||e[3]!==m?(f=q("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(Nn,{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]!==r?(p=r&&n.jsx(Pt,{size:"xs"}),e[10]=r,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]!==i||e[23]!==a||e[24]!==b||e[25]!==S||e[26]!==f||e[27]!==y?(C=n.jsxs("div",{ref:a,onClick:i,className:f,children:[y,b,S]}),e[22]=i,e[23]=a,e[24]=b,e[25]=S,e[26]=f,e[27]=y,e[28]=C):C=e[28],C},wc=t=>{const e=M.c(18),{editor:s,queryKey:o,queryFn:i,onSelect:r}=t;let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==o?(a={editor:s,queryKey:o,queryFn:i,onSelect:r},e[0]=s,e[1]=r,e[2]=i,e[3]=o,e[4]=a):a=e[4];const{items:c,selectedIndex:l,onSelect:u,selectedItem:V}=bc(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(vc,{item:g,isSelected:p===l,ref:p===l?Sc: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 jc(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"p-1",children:[...Array(3)].map(Ac)}),t[0]=e):e=t[0],e}function Ac(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 co(t){const e=M.c(18),{editor:s,char:o,pluginKey:i,queryKey:r,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]!==i?(V={editor:s,char:o,pluginKey:i,allow:l,onOpenChange:u},e[0]=l,e[1]=o,e[2]=s,e[3]=u,e[4]=i,e[5]=V):V=e[5];const{state:d,dispatch:m}=xc(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(jc,{}),e[9]=y):y=e[9];let g;e[10]!==s||e[11]!==c||e[12]!==a||e[13]!==r?(g=n.jsx(yc,{children:n.jsx(A.Suspense,{fallback:y,children:n.jsx(wc,{editor:s,queryKey:r,queryFn:a,onSelect:c})})}),e[10]=s,e[11]=c,e[12]=a,e[13]=r,e[14]=g):g=e[14];let p;return e[15]!==f||e[16]!==g?(p=n.jsx(ao.Provider,{value:f,children:g}),e[15]=f,e[16]=g,e[17]=p):p=e[17],p}function Sc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const kc=[{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}],_c=({editor:t,virtualMcpId:e})=>{const s=jt(),{org:o}=ce(),i=oi(),r=qe({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=Ae.virtualMcpResources(e,o.id),[c,l]=A.useState("categories"),u=A.useRef(c);u.current=c;const V=A.useRef(null),d=A.useRef(!1),m=["at-mention",o.id,e??"default",c],f=async({item:p,range:v})=>{if(B("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){xt(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&&r){try{const h=await Fs(r,p.uri);xt(t,v,{id:p.uri,name:p.uri,metadata:h.contents,char:"@"})}catch(h){console.error("[at-mention] Failed to fetch resource:",h),re.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 kc;const C=v.toLowerCase(),_=i.filter(x=>x.status==="active"&&(!x.id||!Fn(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})),j=await(async()=>{if(!r)return[];let x=s.getQueryData(a);return x||(x=await s.fetchQuery({queryKey:a,queryFn:()=>gt(r),staleTime:6e4})),(x?.resources??[]).filter(w=>w.uri.toLowerCase().includes(C)||w.name?.toLowerCase().includes(C)||w.description?.toLowerCase().includes(C)).map(w=>({name:w.name??w.uri,title:w.name,description:w.description,kind:"resource",uri:w.uri}))})();return[..._,...j]}if(h==="agents"){let C=i.filter(_=>_.status==="active"&&(!_.id||!Fn(_.id))&&_.id!==e);if(v.trim()){const _=v.toLowerCase();C=C.filter(j=>j.title.toLowerCase().includes(_)||j.description?.toLowerCase().includes(_))}return C.map(_=>({name:_.title,title:_.title,description:_.description??void 0,icon:_.icon??null,kind:"agent",agentId:_.id}))}if(!r)return[];let b=s.getQueryData(a);b?s.fetchQuery({queryKey:a,queryFn:()=>gt(r),staleTime:6e4}).catch(()=>{}):b=await s.fetchQuery({queryKey:a,queryFn:()=>gt(r),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,B("chat_picker_opened",{picker:"@"});else{const v=V.current;B("chat_picker_closed",{picker:"@",outcome:d.current?"selected":"dismissed",duration_ms:v?Date.now()-v:null}),V.current=null,l("categories")}};return n.jsx(co,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:y,onSelect:f,onOpenChange:g})};function Cc(t,e,s){const o=ii(t),i=Po(),r=new Map(i.map(u=>[u.id,u])),a=(o?.connections??[]).map(u=>u.connection_id),{data:c}=Sn({queryKey:Ae.promptConnectionMap(e,a),queryFn:async()=>{const u={};return await Promise.all(a.map(async V=>{try{const d=await Eo({connectionId:V,orgId:e,orgSlug:s}),m=await Et(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=r.get(V);d&&l.set(u,d)}return l}async function as(t,e,s,o,i,r){try{const a=await Tn(s,o,r);xt(t,e,{id:o,name:In(o,i),metadata:a.messages,char:"/"})}catch(a){console.error("[slash] Failed to fetch prompt:",a),re.error("Failed to load prompt. Please try again.")}}async function Nc(t,e,s,o){try{const i=await Fs(s,o);xt(t,e,{id:o,name:o,metadata:i.contents,char:"/"})}catch(i){console.error("[slash] Failed to fetch resource:",i),re.error("Failed to load resource. Please try again.")}}const Ic=({editor:t,virtualMcpId:e})=>{const s=jt(),{org:o}=ce(),i=qe({connectionId:e,orgId:o.id,orgSlug:o.slug}),r=Cc(e,o.id,o.slug),a=A.useRef(r);a.current=r;const c=Ae.virtualMcpPrompts(e,o.id),l=Ae.virtualMcpResources(e,o.id),u=["slash-mention",o.id,e??"default"],[V,d]=A.useState(null),m=A.useRef(null),f=A.useRef(!1),y=async({item:h,range:b})=>{if(B("chat_picker_item_selected",{picker:"/",item_kind:h.kind,item_name:h.name}),f.current=!0,!!i)if(h.kind==="prompt"){if(h.arguments&&h.arguments.length>0){d({range:b,item:h});return}const S=Ge(h._meta);await as(t,b,i,h.name,S)}else h.uri&&await Nc(t,b,i,h.uri)},g=async h=>{if(!V||!i)return;const{range:b,item:S}=V,C=Ge(S._meta);await as(t,b,i,S.name,C,h),d(null)},p=async h=>{const{query:b}=h;if(!i)return[];const[S,C]=await Promise.all([Tc(s,c,i),Rc(s,l,i)]),_=b.trim().toLowerCase(),j=(S??[]).filter(w=>!_||w.name.toLowerCase().includes(_)||w.title?.toLowerCase().includes(_)||w.description?.toLowerCase().includes(_)).map(w=>({name:w.name,title:w.title,description:w.description,icon:a.current.get(w.name)?.icon??null,kind:"prompt",arguments:w.arguments,_meta:w._meta})),x=(C??[]).filter(w=>!_||w.uri.toLowerCase().includes(_)||w.name?.toLowerCase().includes(_)||w.description?.toLowerCase().includes(_)).map(w=>({name:w.name??w.uri,title:w.name,description:w.description,kind:"resource",uri:w.uri}));return[...j,...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(co,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:p,onSelect:y,onOpenChange:h=>{if(h)m.current=Date.now(),f.current=!1,B("chat_picker_opened",{picker:"/"});else{const b=m.current;B("chat_picker_closed",{picker:"/",outcome:f.current?"selected":"dismissed",duration_ms:b?Date.now()-b:null}),m.current=null}}}),n.jsx(Pn,{prompt:v,setPrompt:()=>d(null),onSubmit:g})]})};async function Tc(t,e,s){let o=t.getQueryData(e);return o?t.fetchQuery({queryKey:e,queryFn:()=>Et(s),staleTime:6e4}).catch(()=>{}):o=await t.fetchQuery({queryKey:e,queryFn:()=>Et(s),staleTime:6e4}),o?.prompts??[]}async function Rc(t,e,s){let o=t.getQueryData(e);return o?t.fetchQuery({queryKey:e,queryFn:()=>gt(s),staleTime:6e4}).catch(()=>{}):o=await t.fetchQuery({queryKey:e,queryFn:()=>gt(s),staleTime:6e4}),o?.resources??[]}function Pc(t){return[Oi.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),bl.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),mi,fi]}function Ec({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:o=!1,placeholder:i,onSubmit:r,children:a}){const c=A.useRef(r),l=A.useRef(e),u=A.useRef(o),V=A.useRef(i),d=Fi({extensions:Pc(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 A.useEffect(()=>{d?.setEditable(!s)},[d,s]),A.useEffect(()=>{c.current=r},[r]),A.useEffect(()=>{l.current=e},[e]),A.useEffect(()=>{u.current=o},[o]),A.useEffect(()=>{V.current=i},[i]),A.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(Ui.Provider,{value:{editor:d},children:a})}function Dc(t){const e=M.c(26),{disabled:s,virtualMcpId:o,showFileUploader:i,selectedModel:r,onUnsupportedFile:a,ref:c,className:l}=t,u=s===void 0?!1:s,V=i===void 0?!1:i,{editor:d}=Ht();let m,f;if(e[0]!==d?(m=()=>({focus:()=>{d?.commands.focus()},clear:()=>{d?.commands.clearContent(!0)},appendText:x=>{if(!d)return;const w=d.state.doc.textContent.trim()==="";d.commands.focus("end"),w||d.commands.insertContent(" "),d.commands.insertContent(x)},syncVoiceText:(x,w)=>{if(d&&(d.commands.setContent(x||{type:"doc",content:[]}),w)){d.commands.focus("end");const P=d.state.doc.textContent.trim().length>0;d.commands.insertContent(P?" "+w:w)}},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]),A.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=q("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($i,{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(A.Suspense,{fallback:null,children:n.jsx(Ic,{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(A.Suspense,{fallback:null,children:n.jsx(_c,{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]!==r||e[19]!==V?(_=V&&r?n.jsx(Vl,{editor:d,selectedModel:r,onUnsupportedFile:a}):null,e[16]=d,e[17]=a,e[18]=r,e[19]=V,e[20]=_):_=e[20];let j;return e[21]!==b||e[22]!==C||e[23]!==_||e[24]!==v?(j=n.jsxs(n.Fragment,{children:[v,b,C,_]}),e[21]=b,e[22]=C,e[23]=_,e[24]=v,e[25]=j):j=e[25],j}function xn(t){const e=M.c(3),[s]=An();let o;return e[0]!==s.enableSounds||e[1]!==t?(o=()=>{s.enableSounds&&Bi(t.dataUri).catch(r=>{console.warn(`[sound] ${t.name} playback failed:`,r)})},e[0]=s.enableSounds,e[1]=t,e[2]=o):o=e[2],o}const Lc={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"},Mc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Fc(){const t=M.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: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-1 ring-border object-cover bg-white"},t.name)}function Oc(t){const e=M.c(116),{disabled:s,onOpenConnections:o,virtualMcpId:i}=t,[r,a]=A.useState(!1),c=xn(Lc),{org:l}=ce(),{editor:u}=Ht();let V;e[0]!==l.id||e[1]!==l.slug||e[2]!==i?(V={connectionId:i,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=i,e[3]=V):V=e[3];const d=qe(V);let m;e[4]!==l.id||e[5]!==i?(m=Ae.virtualMcpPrompts(i,l.id),e[4]=l.id,e[5]=i,e[6]=m):m=e[6];const f=m;let y;e[7]!==d?(y=()=>Et(d),e[7]=d,e[8]=y):y=e[8];const g=r&&!!d;let p;e[9]!==f||e[10]!==y||e[11]!==g?(p={queryKey:f,queryFn:y,staleTime:6e4,enabled:g},e[9]=f,e[10]=y,e[11]=g,e[12]=p):p=e[12];const{data:v,isLoading:h}=Sn(p);let b;e[13]!==v?.prompts?(b=v?.prompts??[],e[13]=v?.prompts,e[14]=b):b=e[14];const S=b,[C,_]=A.useState(null),{chatMode:j,setChatMode:x}=$t(),w=j==="plan";let P;e[15]!==j||e[16]!==w||e[17]!==c||e[18]!==x?(P=()=>{c();const ne=w?"default":"plan";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[15]=j,e[16]=w,e[17]=c,e[18]=x,e[19]=P):P=e[19];const E=P;let N;e[20]!==o?(N=()=>{o(),a(!1)},e[20]=o,e[21]=N):N=e[21];const I=N;let k;e[22]!==d||e[23]!==u?(k=async(ne,_t)=>{if(!u||!d)return;const Vo=Ge(ne._meta),mo={from:u.state.selection.from,to:u.state.selection.to};try{const fo=await Tn(d,ne.name,_t);xt(u,mo,{id:ne.name,name:In(ne.name,Vo),metadata:fo.messages,char:"/"})}catch{re.error("Failed to load prompt. Please try again.")}},e[22]=d,e[23]=u,e[24]=k):k=e[24];const R=k;let L;e[25]!==R?(L=async ne=>{a(!1);const _t=!!(ne.arguments&&ne.arguments.length>0);if(B("chat_prompt_inserted",{prompt_name:ne.name,with_arguments:_t}),_t){_(ne);return}await R(ne)},e[25]=R,e[26]=L):L=e[26];const D=L;let T;e[27]!==C||e[28]!==R?(T=async ne=>{C&&(await R(C,ne),_(null))},e[27]=C,e[28]=R,e[29]=T):T=e[29];const F=T;let U;e[30]!==j||e[31]!==c||e[32]!==x?(U=()=>{c();const ne=j==="gen-image"?"default":"gen-image";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[30]=j,e[31]=c,e[32]=x,e[33]=U):U=e[33];const O=U;let K;e[34]!==j||e[35]!==c||e[36]!==x?(K=()=>{c();const ne=j==="web-search"?"default":"web-search";B("chat_mode_changed",{from_mode:j,to_mode:ne,source:"tools_popover"}),x(ne),a(!1)},e[34]=j,e[35]=c,e[36]=x,e[37]=K):K=e[37];const Y=K,H=j==="gen-image",Q=j==="web-search";let z;e[38]!==j||e[39]!==r?(z=ne=>{ne&&!r&&B("chat_tools_popover_opened",{chat_mode:j}),a(ne)},e[38]=j,e[39]=r,e[40]=z):z=e[40];let J,W;e[41]===Symbol.for("react.memo_cache_sentinel")?(J=n.jsx($o,{size:14}),W=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"}),e[41]=J,e[42]=W):(J=e[41],W=e[42]);let X;e[43]!==s?(X=n.jsx(Ds,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"ghost",size:"default",disabled:s,title:"Tools","aria-label":"Tools",className:"text-muted-foreground hover:text-foreground",children:[J,W]})}),e[43]=s,e[44]=X):X=e[44];const se=w&&"text-violet-600 dark:text-violet-400";let G;e[45]!==se?(G=q(se),e[45]=se,e[46]=G):G=e[46];const ie=w&&"text-violet-500";let Z;e[47]!==ie?(Z=q(ie),e[47]=ie,e[48]=Z):Z=e[48];let ae;e[49]!==Z?(ae=n.jsx(vs,{size:16,className:Z}),e[49]=Z,e[50]=ae):ae=e[50];let je;e[51]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx("span",{className:"flex-1",children:"Plan mode"}),e[51]=je):je=e[51];let ee;e[52]!==w?(ee=w&&n.jsx("span",{className:"text-xs text-violet-500 font-medium",children:"On"}),e[52]=w,e[53]=ee):ee=e[53];let ue;e[54]!==E||e[55]!==G||e[56]!==ae||e[57]!==ee?(ue=n.jsxs(ot,{onClick:E,className:G,children:[ae,je,ee]}),e[54]=E,e[55]=G,e[56]=ae,e[57]=ee,e[58]=ue):ue=e[58];const Re=H&&"text-pink-600 dark:text-pink-400";let Ke;e[59]!==Re?(Ke=q(Re),e[59]=Re,e[60]=Ke):Ke=e[60];const We=H&&"text-pink-500";let Pe;e[61]!==We?(Pe=q(We),e[61]=We,e[62]=Pe):Pe=e[62];let he;e[63]!==Pe?(he=n.jsx(As,{size:16,className:Pe}),e[63]=Pe,e[64]=he):he=e[64];let ke;e[65]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx("span",{className:"flex-1",children:"Create image"}),e[65]=ke):ke=e[65];let Ee;e[66]!==H?(Ee=H&&n.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"}),e[66]=H,e[67]=Ee):Ee=e[67];let De;e[68]!==O||e[69]!==Ke||e[70]!==he||e[71]!==Ee?(De=n.jsxs(ot,{onClick:O,className:Ke,children:[he,ke,Ee]}),e[68]=O,e[69]=Ke,e[70]=he,e[71]=Ee,e[72]=De):De=e[72];const Xe=Q&&"text-blue-600 dark:text-blue-400";let Le;e[73]!==Xe?(Le=q(Xe),e[73]=Xe,e[74]=Le):Le=e[74];const Me=Q&&"text-blue-500";let ge;e[75]!==Me?(ge=q(Me),e[75]=Me,e[76]=ge):ge=e[76];let xe;e[77]!==ge?(xe=n.jsx(ht,{size:16,className:ge}),e[77]=ge,e[78]=xe):xe=e[78];let _e;e[79]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx("span",{className:"flex-1",children:"Web search"}),e[79]=_e):_e=e[79];let be;e[80]!==Q?(be=Q&&n.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"}),e[80]=Q,e[81]=be):be=e[81];let Ce;e[82]!==Y||e[83]!==Le||e[84]!==xe||e[85]!==be?(Ce=n.jsxs(ot,{onClick:Y,className:Le,children:[xe,_e,be]}),e[82]=Y,e[83]=Le,e[84]=xe,e[85]=be,e[86]=Ce):Ce=e[86];let $;e[87]===Symbol.for("react.memo_cache_sentinel")?($=n.jsxs(Pi,{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"})]}),e[87]=$):$=e[87];let te;e[88]!==D||e[89]!==h||e[90]!==S?(te=h?n.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[n.jsx(Vt,{size:14,className:"animate-spin"}),"Loading prompts…"]}):S.length===0?n.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):S.map(ne=>n.jsxs(ot,{onClick:()=>D(ne),className:"flex flex-col items-start gap-0.5",children:[n.jsx("span",{className:"font-medium text-sm capitalize",children:ne.title||Gt(ne.name,Ge(ne._meta))}),ne.description&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:ne.description})]},ne.name)),e[88]=D,e[89]=h,e[90]=S,e[91]=te):te=e[91];let de;e[92]!==te?(de=n.jsxs(Ei,{children:[$,n.jsx(Di,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:te})]}),e[92]=te,e[93]=de):de=e[93];let Ne,ye;e[94]===Symbol.for("react.memo_cache_sentinel")?(Ne=n.jsx(Si,{size:16}),ye=n.jsx("span",{className:"flex-1",children:"Connections"}),e[94]=Ne,e[95]=ye):(Ne=e[94],ye=e[95]);let Be;e[96]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(A.Suspense,{children:n.jsx(Fc,{})}),e[96]=Be):Be=e[96];let ve;e[97]!==I?(ve=n.jsxs(ot,{onClick:I,children:[Ne,ye,Be]}),e[97]=I,e[98]=ve):ve=e[98];let le;e[99]!==ue||e[100]!==De||e[101]!==Ce||e[102]!==de||e[103]!==ve?(le=n.jsxs(Ls,{align:"start",className:"w-52 p-1.5",children:[ue,De,Ce,de,ve]}),e[99]=ue,e[100]=De,e[101]=Ce,e[102]=de,e[103]=ve,e[104]=le):le=e[104];let Ve;e[105]!==r||e[106]!==z||e[107]!==X||e[108]!==le?(Ve=n.jsxs(Ms,{open:r,onOpenChange:z,children:[X,le]}),e[105]=r,e[106]=z,e[107]=X,e[108]=le,e[109]=Ve):Ve=e[109];let nt;e[110]!==C||e[111]!==F?(nt=n.jsx(Pn,{prompt:C,setPrompt:_,onSubmit:F}),e[110]=C,e[111]=F,e[112]=nt):nt=e[112];let kt;return e[113]!==Ve||e[114]!==nt?(kt=n.jsxs(n.Fragment,{children:[Ve,nt]}),e[113]=Ve,e[114]=nt,e[115]=kt):kt=e[115],kt}const $c=[{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 zc(){const t=M.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:$c.map(Bc)}),t[0]=e):e=t[0],e}function Bc(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 qc(t){const e=M.c(6),{onClick:s}=t;let o,i,r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=q("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),i=n.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),r=n.jsx(zc,{}),a=n.jsx(ws,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=o,e[1]=i,e[2]=r,e[3]=a):(o=e[0],i=e[1],r=e[2],a=e[3]);let c;return e[4]!==s?(c=n.jsxs("button",{type:"button",onClick:s,className:o,children:[i,r,a]}),e[4]=s,e[5]=c):c=e[5],c}const ut=48;function Kc(){const t=M.c(9),[e,s]=A.useState("idle"),[o,i]=A.useState(""),[r,a]=A.useState(""),[c,l]=A.useState(Gc),u=A.useRef(null),V=A.useRef(null),d=A.useRef(null),m=A.useRef(null),f=A.useRef(0),y=A.useRef(!1),g=A.useRef(""),p=A.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(Yc),m.current?.getTracks().forEach(Wc),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=N=>{m.current=N;const I=new AudioContext;V.current=I;const k=I.createMediaStreamSource(N),R=I.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 F=0;F<ut;F++){const U=Math.floor(F/ut*L.length);T.push(Math.max(.04,(L[U]??0)/255))}l(T),f.current=requestAnimationFrame(D)};D()};S=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N){s("unsupported");return}let I;try{I=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{s("permission-denied");return}i(""),a(""),p.current="",g.current="",y.current=!0,s("recording"),E(I);const k=new N;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 F=R.results[T],U=F?.[0]?.transcript??"";F?.isFinal?D=D+U:L=L+U}D&&(g.current=g.current+D,i(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(ut).fill(.05)),a("");const E=(g.current+(p.current?" "+p.current:"")).trim();return i(""),g.current="",p.current="",E},t[2]=_):_=t[2];const j=_;let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{y.current=!1,u.current?.abort(),b(),s("idle"),i(""),a(""),l(Array(ut).fill(.05)),g.current="",p.current=""},t[3]=x):x=t[3];const w=x;let P;return t[4]!==r||t[5]!==e||t[6]!==o||t[7]!==c?(P={status:e,transcript:o,interimTranscript:r,waveformData:c,isSupported:v,startRecording:C,stopRecording:j,cancelRecording:w},t[4]=r,t[5]=e,t[6]=o,t[7]=c,t[8]=P):P=t[8],P}function Wc(t){return t.stop()}function Yc(){}function Gc(){return Array(ut).fill(.05)}function Qc(t){const e=M.c(4),{data:s}=t;let o;e[0]!==s?(o=s.map(Hc),e[0]=s,e[1]=o):o=e[1];let i;return e[2]!==o?(i=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]=i):i=e[3],i}function Hc(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 Jc(t,e){const s=M.c(5),{editor:o}=Ht(),[i,r]=A.useState(!1),a=A.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,r(!0))},V=f=>{f.preventDefault(),a.current=Math.max(0,a.current-1),a.current===0&&r(!1)},d=Xc,m=f=>{if(f.preventDefault(),a.current=0,r(!1),!o||!t||!Qt(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))En(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]),A.useEffect(c,l),i}function Xc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Zc(t){const e=M.c(11),{selectedModel:s,onUnsupportedFile:o}=t,i=Jc(s,o);let r;e[0]!==s?(r=Qt(s),e[0]=s,e[1]=r):r=e[1];const a=r,c=i?"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=q("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(ki,{size:24}),n.jsxs("span",{className:"text-sm font-medium",children:["Drop ",Es(s)," here"]})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ss,{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 ed(){const t=M.c(5),e=Qe(),{org:s,locator:o}=ce();let i;return t[0]!==o||t[1]!==e||t[2]!==s.id||t[3]!==s.slug?(i=r=>{const{tiptapDoc:a,virtualMcp:c}=r,l=crypto.randomUUID(),u=c?.id??_n(s.id).id;Jo(sessionStorage,o,l,{tiptapDoc:a}),e({to:"/$org/$taskId",params:{org:s.slug,taskId:l},search:{virtualmcpid:u,autosend:Xo}})},t[0]=o,t[1]=e,t[2]=s.id,t[3]=s.slug,t[4]=i):i=t[4],i}function td({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=Qo(),o=Ho(),i=s?.messages??[],r=s?.isStreaming??!1,a=s?.isRunInProgress??!1,c=s?.stop??(()=>{}),l=o?.taskId??"",u=o?.tasks??[],V=ed(),{selectedModel:d,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:y,imageModel:g,deepResearchModel:p,chatMode:v,setChatMode:h,simpleModeTier:b,setSimpleModeTier:S}=$t(),{data:C}=Ut.useSession(),_=C?.user?.id,{org:j}=ce(),x=_n(j.id).id,w=xn(On),[P,E]=A.useState(!1),{unsupportedFile:N,onUnsupportedFile:I,clearUnsupportedFile:k}=xl(),R=Kc(),L=A.useRef(void 0),D=async()=>{L.current=O,await R.startRecording();const ee=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";B("chat_voice_started",{thread_id:l,outcome:ee})},T=()=>{B("chat_voice_confirmed",{thread_id:l});const ee=R.stopRecording();J.current?.syncVoiceText(L.current,ee),J.current?.focus()},F=()=>{B("chat_voice_cancelled",{thread_id:l}),R.cancelRecording(),J.current?.restoreContent(L.current)};A.useEffect(()=>{if(R.status!=="recording")return;const ee=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();J.current?.syncVoiceText(L.current,ee)},[R.transcript,R.interimTranscript,R.status]);const U=u.find(ee=>ee.id===l),[O,K]=A.useState(void 0),Y=ee=>{K(ee),y.current=ee},H=A.useRef(l);H.current!==l&&(H.current=l,K(void 0),y.current=void 0);const z=[...i].reverse().find(ee=>ee.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,J=A.useRef(null),W=v==="plan";A.useEffect(()=>{const ee=ue=>{ri(ue)&&ue.code==="KeyL"&&(ue.preventDefault(),ue.shiftKey&&h(v==="plan"?"default":"plan"),J.current?.focus())};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[v,h]);const X=pi(i),se=[...i].reverse().find(ee=>ee.role==="assistant"&&ee.metadata?.usage)?.metadata?.usage,G=se?.contextTokens??(se?.totalTokens??0)-(se?.reasoningTokens??0),ie=xn(On),Z=!r&&!f&&!oa(O),ae=r||a,je=ee=>{ee?.preventDefault(),r?(B("chat_message_stopped",{thread_id:l}),c()):a?(B("chat_message_stopped",{thread_id:l}),c()):Z&&O&&(B("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:ee?"button_or_enter":"programmatic"}),ie(),s?s.sendMessage(O):V({tiptapDoc:O,virtualMcp:m}),Y(void 0))};return _&&U?.created_by&&U.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(Ss,{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(Jt,{}),n.jsx(Ec,{tiptapDoc:O,setTiptapDoc:Y,disabled:r,enterToSubmit:!0,onSubmit:je,children:n.jsxs("form",{onSubmit:je,className:q("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(Zc,{selectedModel:d,onUnsupportedFile:I}),n.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:n.jsx(Dc,{ref:J,disabled:r||R.status==="recording",virtualMcpId:m?.id??x,showFileUploader:!0,selectedModel:d,onUnsupportedFile:I})}),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(Qc,{data:R.waveformData.slice(0,28)}),n.jsx("button",{type:"button",onClick:F,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(ct,{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(yt,{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(pl,{selectedModel:d,isStreaming:r,icon:n.jsx(ks,{size:16}),onUnsupportedFile:I}),n.jsx(Oc,{disabled:r,onOpenConnections:()=>{B("connections_dialog_opened",{source:"tools_popover",mode:"add"}),E(!0)},virtualMcpId:m?.id??x}),W&&n.jsxs("button",{type:"button",onClick:()=>{w(),B("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(vs,{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(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="gen-image"&&g&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{w(),B("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(As,{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(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),v==="web-search"&&p&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{w(),B("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(ht,{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(ct,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),z&&G>0&&n.jsx(hi,{usage:X,totalTokens:G,contextWindow:z,onOpenContextPanel:t})]}),n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx(ul,{tier:b,onSelect:S}),R.isSupported&&!r&&!a&&n.jsx(oe,{type:"button",onClick:D,variant:"ghost",size:"icon",className:q("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(zo,{size:18})}),n.jsx(oe,{type:ae?"button":"submit",onClick:ee=>{ae&&(ee.preventDefault(),ee.stopPropagation(),c())},variant:Z||ae?"default":"ghost",size:"icon",disabled:!Z&&!ae,className:q("size-8 rounded-lg transition-all",!Z&&!ae&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:r?"Stop generating":a?"Cancel run":"Send message (Enter)",children:ae?n.jsx(Bo,{size:20}):n.jsx(ji,{size:20})})]})]})})]})},l),e&&n.jsx(qc,{onClick:()=>{B("connections_banner_clicked",{source:"home_chat_input"}),B("connections_dialog_opened",{source:"home_banner",mode:"add"}),E(!0)}})]})}),n.jsx(mr,{mode:"browse",open:P,onOpenChange:E,defaultTab:"all"}),n.jsx(hl,{info:N,onClose:k})]})}const nd={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 uo(t){return`deco-credits-empty-dismissed:${t}`}function ku(t){try{return localStorage.getItem(uo(t))==="1"}catch{return!1}}function sd(){const t=M.c(50),{org:e}=ce(),s=Qe(),{decoKeyId:o}=Gs();let i;t[0]!==e.id||t[1]!==e.slug?(i={connectionId:St,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=i):i=t[2];const r=qe(i),[a,c]=A.useState(!0),[l,u]=A.useState(""),[V,d]=A.useState(!1),[m,f]=A.useState("usd"),y=m==="brl"?"R$":"$";let g;t[3]!==e.id?(g=()=>{B("credits_empty_state_dismissed",{organization_id:e.id}),c(!1);try{localStorage.setItem(uo(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&&B("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]),A.useEffect(v,h);let b;t[9]!==r||t[10]!==m?(b=async K=>{const Y=await r.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:K,currency:m}});if(Y?.isError)throw new Error(Y.content?.[0]?.text??"Failed to get top-up URL");return Y.structuredContent?.url},t[9]=r,t[10]=m,t[11]=b):b=t[11];let S;t[12]!==p?(S=K=>{K&&window.open(K,"_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:id},t[14]=b,t[15]=S,t[16]=C):C=t[16];const{mutate:_,isPending:j}=vn(C),x=parseFloat(l),w=!isNaN(x)&&x>=1;if(!a)return null;let P;t[17]!==p?(P=K=>!K&&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 N;t[20]===Symbol.for("react.memo_cache_sentinel")?(N=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(hs,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[20]=N):N=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[E,n.jsxs($e,{className:"relative gap-3",children:[N,n.jsxs("div",{className:"text-center",children:[n.jsx(ze,{className:"text-lg font-semibold",children:"This workspace has no credits"}),n.jsx(Ot,{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]=I):I=t[21];let k;t[22]!==m||t[23]!==y||t[24]!==l||t[25]!==x||t[26]!==o||t[27]!==w||t[28]!==j||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(Ps,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:K=>{K&&f(K)},children:[n.jsx(Dt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),n.jsx(Dt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:nd[m].map(K=>{const{dollars:Y,label:H}=K;return n.jsxs("button",{type:"button",disabled:j,onClick:()=>{B("credits_topup_clicked",{amount_cents:Y*100,currency:m,tier_label:H,source:"empty_state"}),_(Y*100)},className:q("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,Y]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:H})]},Y)})}),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(Te,{type:"number",min:"1",step:"1",placeholder:"50",value:l,onChange:K=>u(K.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(oe,{className:"h-10",disabled:!w||j,onClick:()=>{B("credits_topup_clicked",{amount_cents:Math.round(x*100),currency:m,tier_label:"custom",source:"empty_state"}),_(Math.round(x*100))},children:j?"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]=w,t[28]=j,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(_s,{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(oe,{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 F;t[41]!==D||t[42]!==T?(F=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]=F):F=t[43];let U;t[44]!==k||t[45]!==F?(U=n.jsxs(Oe,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:od,children:[I,k,F]}),t[44]=k,t[45]=F,t[46]=U):U=t[46];let O;return t[47]!==U||t[48]!==P?(O=n.jsx(Ue,{open:!0,onOpenChange:P,children:U}),t[47]=U,t[48]=P,t[49]=O):O=t[49],O}function od(t){return t.preventDefault()}function id(t){re.error(`Top-up failed: ${t.message}`)}function rd(t){const e=M.c(6),{balanceDollars:s}=t;let o;e[0]!==s?(o=s.toFixed(2),e[0]=s,e[1]=o):o=e[1];const i=o;let r,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=q("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(hs,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=r,e[3]=a):(r=e[2],a=e[3]);let c;return e[4]!==i?(c=n.jsxs("div",{className:r,children:[a,n.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=c):c=e[5],c}function ad(){const t=M.c(8),{org:e}=ce(),s=Qe();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 i,r,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=q("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"),r=n.jsx(Cs,{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]=i,t[4]=r,t[5]=a):(i=t[3],r=t[4],a=t[5]);let c;return t[6]!==o?(c=n.jsxs("button",{type:"button",onClick:o,className:i,children:[r,a]}),t[6]=o,t[7]=c):c=t[7],c}function ld(t){const e=M.c(11),{className:s}=t;let o;e[0]!==s?(o=q("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsxs("div",{className:"flex items-center gap-3",children:[i,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]=r):r=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:[r,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(It,{align:"right",width:"w-3/4"}),n.jsx(It,{align:"left",width:"w-full",lines:3}),n.jsx(It,{align:"right",width:"w-2/3"}),n.jsx(It,{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 It(t){const e=M.c(22),{align:s,width:o,lines:i}=t,r=o===void 0?"w-full":o,a=i===void 0?1:i,c=s==="right"?"flex-row-reverse":"flex-row";let l;e[0]!==c?(l=q("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=q("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]!==r?(f=q("min-w-0 rounded-2xl p-4",m,r),e[5]=m,e[6]=r,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:q("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 cd(t){const e=M.c(5),{className:s,children:o}=t;let i;e[0]!==s?(i=q("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==o||e[3]!==i?(r=n.jsx("div",{className:i,children:o}),e[2]=o,e[3]=i,e[4]=r):r=e[4],r}function dd(t){const e=M.c(5),{children:s,className:o}=t;let i;e[0]!==o?(i=q("flex-1 min-h-0 overflow-y-auto isolate",o),e[0]=o,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=n.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function ud(t){const e=M.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:s}),e[0]=s,e[1]=o):o=e[1],o}function Vd(){const t=M.c(16),{messages:e,status:s}=zt(),o=gi(e);let i;t[0]!==o?(i=o.at(-1),t[0]=o,t[1]=i):i=t[1];const r=i,a=s==="submitted"||s==="streaming";let c;if(t[2]!==a||t[3]!==r||t[4]!==o||t[5]!==e||t[6]!==s){const l=e.at(-1),u=!a&&l?.role==="assistant"&&l.parts.filter(pd).some(fd),V=!a&&l?.role==="assistant"&&l.parts.some(md);let d;if(t[8]!==o||t[9]!==s){let f;t[11]!==o.length||t[12]!==s?(f=(y,g)=>n.jsx(Un,{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,r&&n.jsx("div",{className:q("min-h-full min-w-0 max-w-2xl mx-auto w-full",(u||V)&&"pb-60"),children:n.jsx(Un,{pair:r,isLastPair:!0,status:s},`pair-${r?.user.id}`)})]}),t[2]=a,t[3]=r,t[4]=o,t[5]=e,t[6]=s,t[7]=c}else c=t[7];return c}function md(t){return"state"in t&&t.state==="approval-requested"}function fd(t){return t.state==="input-available"}function pd(t){return t.type==="tool-user_ask"}function hd(t){const e=M.c(5),{children:s,className:o}=t;let i;e[0]!==o?(i=q("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",o),e[0]=o,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=n.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}const _u=Object.assign(cd,{Main:dd,Messages:Vd,EmptyState:ud,Footer:hd,Input:td,Provider:ei,ActiveTaskProvider:Zo,Skeleton:ld,IceBreakers:ma,NoAiProviderEmptyState:Ri,CreditsEmptyState:sd,CreditsEyebrow:rd,NoCreditsEyebrow:ad,CreditsExhaustedBanner:Qs});export{mr as A,_u as C,ul as S,ju as T,Se as a,Gs as b,Ec as c,Dc as d,vu as e,Su as f,wu as g,yu as h,gu as i,xu as j,bu as k,Au as u,ku as w};