decocms 3.98.0 → 3.99.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/client/assets/{AlertCircle-kcMUHNYP.js → AlertCircle-VcwplCRi.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-KPaHD_ZU.js → ArrowUpRight-CAv7CUnJ.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-Do934x7B.js → CheckCircle-V30FMM2D.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DJ5SHmhN.js → ChevronDown-URo4LveF.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-QZNH5ck-.js → ChevronLeft-aMkPes9N.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-BXEszS6k.js → ChevronRight-oz8o6WPV.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CUesWqmK.js → ChevronUp-HJUE3-BD.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-F-o-_a2z.js → DotsVertical-QF46dzdi.js} +1 -1
  9. package/dist/client/assets/{Eye-FmUDnTHn.js → Eye-BSiFxHQB.js} +1 -1
  10. package/dist/client/assets/{FilterLines-eS3dI9hB.js → FilterLines-CEzORaPw.js} +1 -1
  11. package/dist/client/assets/{Globe01-Ckwe4UHh.js → Globe01-wGomueqV.js} +1 -1
  12. package/dist/client/assets/{Globe04-iXhOnFjr.js → Globe04-CsKOsQ4z.js} +1 -1
  13. package/dist/client/assets/{HardDrive-CNIST2bR.js → HardDrive-BuI4Q48l.js} +1 -1
  14. package/dist/client/assets/{Key01-wlyPB5nN.js → Key01-r6MDYdDw.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-C_wbh4sE.js → LayoutLeft-BFxGsVdk.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-BoVxtqR2.js → LinkExternal01-BWnRnxGs.js} +1 -1
  17. package/dist/client/assets/{Monitor01-DNvJhnf-.js → Monitor01-SEZLDRFN.js} +1 -1
  18. package/dist/client/assets/{Palette-Bf6p_3g1.js → Palette-CEjENuG4.js} +1 -1
  19. package/dist/client/assets/{Play-D6BtU9Uh.js → Play-BDoh8EAp.js} +1 -1
  20. package/dist/client/assets/{Plus-8zBKSNee.js → Plus-Bw9lc6SR.js} +1 -1
  21. package/dist/client/assets/{SearchMd-57vTBUjU.js → SearchMd-BMfw7gZ4.js} +1 -1
  22. package/dist/client/assets/{Settings02-k7X7M16V.js → Settings02-DbH9OAzT.js} +1 -1
  23. package/dist/client/assets/{Shield01-6X9Jy9--.js → Shield01-C1R4fpvK.js} +1 -1
  24. package/dist/client/assets/{Star01-BUumId75.js → Star01-BwAv907s.js} +1 -1
  25. package/dist/client/assets/{Stars01-BvvUaY8d.js → Stars01-D1icdaCh.js} +1 -1
  26. package/dist/client/assets/{Stars02-f3tbtjbB.js → Stars02-PPXsboxW.js} +1 -1
  27. package/dist/client/assets/{Sun-42Xfv_Dc.js → Sun-Dw86eVev.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-BeteqXsq.js → SwitchHorizontal01-F_1MjTR3.js} +1 -1
  29. package/dist/client/assets/{Tool01-DKUGTxge.js → Tool01-DvTGD1Yt.js} +1 -1
  30. package/dist/client/assets/{Trash01-DDwxWuR_.js → Trash01-d58N8w5a.js} +1 -1
  31. package/dist/client/assets/{Upload01-CvwE1uG-.js → Upload01-C_hHbDSF.js} +1 -1
  32. package/dist/client/assets/{User01-KLLrp_Cb.js → User01-BDtU1dk1.js} +1 -1
  33. package/dist/client/assets/{Users01-BoxxsDP9.js → Users01-PX3eYoC8.js} +1 -1
  34. package/dist/client/assets/{Users03-Cnldjgk9.js → Users03-CL71IAQ8.js} +1 -1
  35. package/dist/client/assets/{X-D5odjFOj.js → X-D7X7Z50V.js} +1 -1
  36. package/dist/client/assets/{XCircle-CkFuQ7IG.js → XCircle-PlbEvjyp.js} +1 -1
  37. package/dist/client/assets/{XClose-CQQFXdbB.js → XClose-BbuWQhNb.js} +1 -1
  38. package/dist/client/assets/{Zap-D2QyQXL2.js → Zap-BQKeuD4l.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-DWfiiAgK.js → ZapSquare-CvkoTQDM.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-CGeRz2Xe.js → ZoomOut-DxqRFWA_.js} +1 -1
  41. package/dist/client/assets/{access-gate-B1FO8IUq.js → access-gate-6AWas-Ss.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-C4vE7N12.js → add-section-modal-jgpkoBcW.js} +1 -1
  43. package/dist/client/assets/{agent-icon-AqXPfJak.js → agent-icon-B2N3zGQH.js} +1 -1
  44. package/dist/client/assets/{agents-list-D_wYa6fb.js → agents-list-Cd9i8250.js} +1 -1
  45. package/dist/client/assets/{ai-providers-T-u5bvaJ.js → ai-providers-CG207wTX.js} +1 -1
  46. package/dist/client/assets/{alert-BbYDxfTx.js → alert-Cg3WXwSx.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-C-zjIGep.js → alert-dialog-DvWgcmQI.js} +1 -1
  48. package/dist/client/assets/{app-editor-B1BV7cVP.js → app-editor-tLSi5KV_.js} +1 -1
  49. package/dist/client/assets/{auth-DhQO5_HB.js → auth-DZDiXt1m.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-Di4BNeJO.js → auth-catchall-kuEh1_rd.js} +1 -1
  51. package/dist/client/assets/{auth-entry-_k3gk7s2.js → auth-entry-CavsOUDq.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-bCFbyvYe.js → auth-split-layout-dFpcxyJe.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-DBMlTO0L.js → authenticate-and-persist-oauth-CGYbK6H8.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-Bs5UJwPA.js → automation-list-row-CAUoBpVq.js} +1 -1
  55. package/dist/client/assets/{automation-runs-BZimcr-h.js → automation-runs-DyKvgj21.js} +1 -1
  56. package/dist/client/assets/{automations-X1kqWMvM.js → automations-wXAz-GXj.js} +1 -1
  57. package/dist/client/assets/{avatar-BVLQzOkg.js → avatar-Dv3IrttI.js} +1 -1
  58. package/dist/client/assets/{badge-DySIiC0W.js → badge-toKsUzoB.js} +1 -1
  59. package/dist/client/assets/{block-document-DAnpzS1z.js → block-document-DRbnuwCo.js} +1 -1
  60. package/dist/client/assets/{brand-context-Dw4JnvNB.js → brand-context-BaVxi4M4.js} +1 -1
  61. package/dist/client/assets/{buckets-B3emByFY.js → buckets-BKwGKvkZ.js} +1 -1
  62. package/dist/client/assets/{capability-load-error-dMfRi5Lm.js → capability-load-error-BRyHg_Rt.js} +1 -1
  63. package/dist/client/assets/{card-Dcgr1F8G.js → card-Chq65iX4.js} +1 -1
  64. package/dist/client/assets/{category-editor-DxkVuATo.js → category-editor-LeiO5-YX.js} +1 -1
  65. package/dist/client/assets/{chat-context-Bw2XBdCM.js → chat-context-Bspy4m-d.js} +1 -1
  66. package/dist/client/assets/{checkbox-DtAK_uVJ.js → checkbox-KUrNOBQk.js} +1 -1
  67. package/dist/client/assets/{cli-auth-success-C1VkvMBP.js → cli-auth-success-B36KwAFt.js} +1 -1
  68. package/dist/client/assets/{collection-detail-CwmHQu2v.js → collection-detail-CbhoYXmP.js} +1 -1
  69. package/dist/client/assets/{collection-display-button-CwlHCCWA.js → collection-display-button-DNbt3d2y.js} +1 -1
  70. package/dist/client/assets/{collection-search-ChsfwSm5.js → collection-search-BPoBI_I5.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BKP4OHUr.js → collection-tabs-FH3-RtUV.js} +1 -1
  72. package/dist/client/assets/{command-BxulIERM.js → command-DMsCjDdA.js} +1 -1
  73. package/dist/client/assets/{commerce-onboarding-Dg7vjIhZ.js → commerce-onboarding-Cv30K_3D.js} +1 -1
  74. package/dist/client/assets/{connect-desktop-dialog-CRTSitBm.js → connect-desktop-dialog-G37q3fkg.js} +1 -1
  75. package/dist/client/assets/{connection-card-DHEsTOvl.js → connection-card-BG_Nwlzj.js} +1 -1
  76. package/dist/client/assets/{connection-detail-Dug72TML.js → connection-detail-oU0C71F8.js} +1 -1
  77. package/dist/client/assets/{connection-form-helpers-DydZsosn.js → connection-form-helpers-DLOiycDJ.js} +1 -1
  78. package/dist/client/assets/{connections-D1302Qtf.js → connections-BgFAjnb1.js} +1 -1
  79. package/dist/client/assets/{context-menu-CIuP6HS5.js → context-menu-BRDnNrnF.js} +1 -1
  80. package/dist/client/assets/{decopilot-CTSJKb4z.js → decopilot-DfFzELja.js} +1 -1
  81. package/dist/client/assets/{decopilot-sse-pool-BiYcCf8O.js → decopilot-sse-pool-TIer_srZ.js} +1 -1
  82. package/dist/client/assets/{dialog-CbpDnZu8.js → dialog-CxQBoX40.js} +1 -1
  83. package/dist/client/assets/{domain-settings-CoN7-60k.js → domain-settings-gFWo85oP.js} +1 -1
  84. package/dist/client/assets/{drawer-UU4w29Dz.js → drawer-CoRZTii0.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-QpPxe1tm.js → dropdown-menu-5CWPgj7f.js} +1 -1
  86. package/dist/client/assets/{empty-state-Do7xKqQm.js → empty-state-B-ezQrZT.js} +1 -1
  87. package/dist/client/assets/{extract-connection-data-DVGeC9AU.js → extract-connection-data-BaXkJtVr.js} +1 -1
  88. package/dist/client/assets/{file-explorer-D2afeXPb.js → file-explorer-CwlDpz6e.js} +1 -1
  89. package/dist/client/assets/{file-type-icon-Cs_SK9tU.js → file-type-icon-Cd8oKt-R.js} +1 -1
  90. package/dist/client/assets/{files-5aenLfPW.js → files-CkNnfKPK.js} +1 -1
  91. package/dist/client/assets/{form-HH5S6Yti.js → form-CpFt_4sy.js} +1 -1
  92. package/dist/client/assets/{general-BnR0HO7J.js → general-9kWrBaDN.js} +1 -1
  93. package/dist/client/assets/{github-repo-picker-DvVBXFrQ.js → github-repo-picker-CvyWRbaM.js} +1 -1
  94. package/dist/client/assets/{hooks-fHAHvlgy.js → hooks-BAG9TZjZ.js} +1 -1
  95. package/dist/client/assets/{import-from-deco-dialog-gGGcEtn9.js → import-from-deco-dialog-ga5lUGZx.js} +1 -1
  96. package/dist/client/assets/{index--YoOFH0C.js → index-ALZP0-mx.js} +1 -1
  97. package/dist/client/assets/{index-BMiO2DRK.js → index-BAfXUZ9K.js} +1 -1
  98. package/dist/client/assets/{index-Dm5Wtwak.js → index-BLMNER8l.js} +1 -1
  99. package/dist/client/assets/{index-1K74hihp.js → index-BU8Nad-n.js} +1 -1
  100. package/dist/client/assets/{index-GSJQ2HSb.js → index-BeB2S664.js} +1 -1
  101. package/dist/client/assets/{index-BlCwbTgh.js → index-BwC0cAdP.js} +1 -1
  102. package/dist/client/assets/{index-Cnw7T0fh.js → index-C_Ih0jtP.js} +1 -1
  103. package/dist/client/assets/{index-DEuymgXg.js → index-CiVkOVzW.js} +26 -26
  104. package/dist/client/assets/{index-DUxlPTha.js → index-DPI_0XE-.js} +1 -1
  105. package/dist/client/assets/{index-CJHqjy38.js → index-DS2I5JM3.js} +1 -1
  106. package/dist/client/assets/{index-CutM526i.js → index-DUdLsOJu.js} +1 -1
  107. package/dist/client/assets/{index-uyO8STkD.js → index-DZCgQXLz.js} +1 -1
  108. package/dist/client/assets/{index-DVyj5fuq.js → index-I8Uum3Jx.js} +4 -4
  109. package/dist/client/assets/{index-Cr1XkGY8.js → index-JhgoGL0k.js} +1 -1
  110. package/dist/client/assets/{index-redirect-B3cwEJb7.js → index-redirect-CP9ATXDl.js} +1 -1
  111. package/dist/client/assets/{input-GyW6rRcJ.js → input-CutcETvq.js} +1 -1
  112. package/dist/client/assets/{integration-icon-BtlW6ioP.js → integration-icon-D3W1euXX.js} +1 -1
  113. package/dist/client/assets/{label-DZS4CYvt.js → label-DtGUWURu.js} +1 -1
  114. package/dist/client/assets/{login-8FZgzert.js → login-DUTSfri0.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-BKEDlyVy.js → mcp-oauth-CSZ5TVrK.js} +1 -1
  116. package/dist/client/assets/{members-BJYRHZsS.js → members-Dq59tJj1.js} +1 -1
  117. package/dist/client/assets/{monaco-editor-CGqqNDfH.js → monaco-editor-x5JEAvo5.js} +1 -1
  118. package/dist/client/assets/{monitoring-stats-row-D3Ly6cXH.js → monitoring-stats-row-BsPY2-bU.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-Dwd806qn.js → oauth-callback-BXF1WEWL.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-ai-provider-CC85HfxS.js → oauth-callback-ai-provider-MpQ7zAqW.js} +1 -1
  121. package/dist/client/assets/{onboarding-D0JBHrcc.js → onboarding-CKZFzjtY.js} +1 -1
  122. package/dist/client/assets/{org-install-DQyhSRpe.js → org-install-DVysq6Hz.js} +1 -1
  123. package/dist/client/assets/{org-layout-Cr-WH3RD.js → org-layout-hE5dYTZz.js} +1 -1
  124. package/dist/client/assets/{organization-choice-CoeFbp4N.js → organization-choice-y8WYOYM0.js} +1 -1
  125. package/dist/client/assets/{page-seo-form-B7y574iK.js → page-seo-form-gPXTm6pw.js} +1 -1
  126. package/dist/client/assets/page-seo-sheet-CpMq28JR.js +1 -0
  127. package/dist/client/assets/{popover-DCt-yH34.js → popover-C8AJAJSa.js} +1 -1
  128. package/dist/client/assets/{post-editor-BZKlC439.js → post-editor-DrZmKifS.js} +1 -1
  129. package/dist/client/assets/{preview-dialog-CvZ5HrrM.js → preview-dialog-D1-LAakL.js} +1 -1
  130. package/dist/client/assets/{primitives-DU5cdK_v.js → primitives-D7qGIw1V.js} +1 -1
  131. package/dist/client/assets/{profile-VCalx_au.js → profile-DwtHhCaD.js} +1 -1
  132. package/dist/client/assets/project-app-view-H9YA_3uu.js +1 -0
  133. package/dist/client/assets/record-editor-C64a4aNL.js +1 -0
  134. package/dist/client/assets/registry-CxYUBbU6.js +2 -0
  135. package/dist/client/assets/{registry-layout-UOOnsAxo.js → registry-layout-CZALtE-Q.js} +1 -1
  136. package/dist/client/assets/{require-capability-B3soU3U-.js → require-capability-DAovjPYR.js} +1 -1
  137. package/dist/client/assets/{required-auth-layout-DJ9sUOZj.js → required-auth-layout-BFGUeccA.js} +1 -1
  138. package/dist/client/assets/{reset-password-Cbn69hRw.js → reset-password-CrnrgmIx.js} +1 -1
  139. package/dist/client/assets/{roles-BUk_bsvO.js → roles-DRg1cyfq.js} +1 -1
  140. package/dist/client/assets/{save-status-CV3d48oi.js → save-status-BmnvufMt.js} +1 -1
  141. package/dist/client/assets/{scroll-area-BOzFl7qs.js → scroll-area-DnauLcxE.js} +1 -1
  142. package/dist/client/assets/{search-input-Bkwrx7tI.js → search-input-BVF4N9EW.js} +1 -1
  143. package/dist/client/assets/{secrets-BaUhAjXu.js → secrets-DPqx_gXC.js} +1 -1
  144. package/dist/client/assets/{sections-editor-B1yHaLKY.js → sections-editor-BLU0buUC.js} +1 -1
  145. package/dist/client/assets/{select-C3uZV2A_.js → select-CeO9pIG_.js} +1 -1
  146. package/dist/client/assets/{select-model-Q-rnyaMQ.js → select-model-mprfSN1i.js} +1 -1
  147. package/dist/client/assets/{seo-editor-tIrWl6nj.js → seo-editor-Dyh0ncgL.js} +1 -1
  148. package/dist/client/assets/{settings-layout-DTBcjBLr.js → settings-layout-BcPbOkgS.js} +1 -1
  149. package/dist/client/assets/{settings-section-BLfkvtRw.js → settings-section-B3kXnqLg.js} +1 -1
  150. package/dist/client/assets/{sheet-n3UWOPEl.js → sheet-CaSXRGPU.js} +1 -1
  151. package/dist/client/assets/{shell-controls-DhJC4c0p.js → shell-controls-D2Qn9uVj.js} +1 -1
  152. package/dist/client/assets/{shell-layout-xNLL_s4g.js → shell-layout-BgovnITR.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-Cpya0EwH.js → shell-route-loading-w2qYEgt-.js} +1 -1
  154. package/dist/client/assets/{sidebar-B5rVQTnV.js → sidebar-BNKGZwsk.js} +1 -1
  155. package/dist/client/assets/{skeleton-D20LVfuJ.js → skeleton-1BUBAFib.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-bhnYhglv.js → sortable.esm-BQBGtGRV.js} +1 -1
  157. package/dist/client/assets/{sso-1G-Lrcz1.js → sso-B5RA5Egt.js} +1 -1
  158. package/dist/client/assets/{store-B2Ao3pPp.js → store-Ni3ANns9.js} +1 -1
  159. package/dist/client/assets/store-registry-kIHn_jDR.js +2 -0
  160. package/dist/client/assets/{studio-tools-BvOjHliA.js → studio-tools-bjPFQfXc.js} +1 -1
  161. package/dist/client/assets/{switch-aFiGEpQz.js → switch-B9PlH85E.js} +1 -1
  162. package/dist/client/assets/{table-DerXyAj5.js → table-Bh38Wtyx.js} +1 -1
  163. package/dist/client/assets/{tabs-C2oZPeQe.js → tabs-C0RM8s7M.js} +1 -1
  164. package/dist/client/assets/{task-status-D2kMSoyM.js → task-status-sw3Y4pwg.js} +1 -1
  165. package/dist/client/assets/{textarea-C8t5NRp5.js → textarea-CvR7iHW3.js} +1 -1
  166. package/dist/client/assets/{toggle-group-DJ8r0lkn.js → toggle-group-qpErv2AC.js} +1 -1
  167. package/dist/client/assets/{toolbar-CH6VbS3Q.js → toolbar-CB27CeHy.js} +1 -1
  168. package/dist/client/assets/{tooltip-3uKRhKGc.js → tooltip-Cs84Kx7a.js} +1 -1
  169. package/dist/client/assets/{types-pwajyff_.js → types-pQkRXbdZ.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-CWY8hivp.js → use-ai-providers-BgadC07_.js} +1 -1
  171. package/dist/client/assets/{use-automations-D3-t22-_.js → use-automations-P1MHR3DS.js} +1 -1
  172. package/dist/client/assets/{use-capability-BjlflkMO.js → use-capability-BUm2GwYJ.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-CzIilxCh.js → use-clock-tick-DNfOIVGO.js} +1 -1
  174. package/dist/client/assets/{use-collections-DCQeHkgD.js → use-collections-KLUYE1x1.js} +1 -1
  175. package/dist/client/assets/{use-connection-CzcC522C.js → use-connection-BcZ8SPdu.js} +1 -1
  176. package/dist/client/assets/{use-copy-DwazvcnZ.js → use-copy-3_Rhxcs5.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-Bd6NX9e2.js → use-create-virtual-mcp-BUg1GOjA.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-7QeHZ0an.js → use-debounced-autosave-CSkDAooO.js} +1 -1
  179. package/dist/client/assets/{use-delete-connection-BuL4NUvH.js → use-delete-connection-CRtYZbhZ.js} +1 -1
  180. package/dist/client/assets/{use-file-configs-CElizRPA.js → use-file-configs-YBpYKsXP.js} +1 -1
  181. package/dist/client/assets/{use-infinite-scroll-BXMBgtt1.js → use-infinite-scroll-BJoUj4tJ.js} +1 -1
  182. package/dist/client/assets/{use-join-requests-BNKnZPHN.js → use-join-requests-7lEKJyAD.js} +1 -1
  183. package/dist/client/assets/{use-mcp-client-fdcDDNuq.js → use-mcp-client-Bq9g8m5J.js} +1 -1
  184. package/dist/client/assets/{use-mcp-prompts-D-HAq_yv.js → use-mcp-prompts-B5FIxmOZ.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-B6s0E39X.js → use-mcp-tools-LraQQ1bu.js} +1 -1
  186. package/dist/client/assets/{use-members-GGq7DYTP.js → use-members-D283HZiN.js} +1 -1
  187. package/dist/client/assets/{use-mobile-CvxOtGtu.js → use-mobile-C0mpADhR.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-DwfR9Suw.js → use-navigate-to-agent-CRQ9sIAj.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-DXTnBB9n.js → use-org-auth-client-WATciLg3.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-B6LnDpoK.js → use-org-sso-HWNvOeDC.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-tYXE1Sad.js → use-organization-roles-Cyp5dthQ.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-BnxEz1nn.js → use-organization-settings-oh1iUWuA.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-B-i9Sftv.js → use-registry-connections-d6Abj3O4.js} +1 -1
  194. package/dist/client/assets/{use-secrets-DS1SrxPb.js → use-secrets-CkVHtz_G.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-9_fdEsNO.js → use-status-sounds-MBoAiBsc.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-DFO97l4B.js → use-view-mode-Dhn_wt1k.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-ufrd8iJJ.js → use-virtual-mcp-C5aoCVVQ.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-RfoATJAI.js +1 -0
  199. package/dist/client/assets/useSuspenseInfiniteQuery-DBiSYggu.js +1 -0
  200. package/dist/client/assets/{useSuspenseQueries-CKrSo39Z.js → useSuspenseQueries-C6KWJru5.js} +1 -1
  201. package/dist/client/assets/{variant-calendar-DotXoiJr.js → variant-calendar-krPIZ_Rp.js} +1 -1
  202. package/dist/client/assets/{view-mode-toggle-C9lZfxMp.js → view-mode-toggle-DTMt6lCZ.js} +1 -1
  203. package/dist/client/index.html +1 -1
  204. package/dist/server/cli.js +361 -361
  205. package/dist/server/server.js +255 -255
  206. package/package.json +1 -1
  207. package/dist/client/assets/page-seo-sheet-C7aYjteJ.js +0 -1
  208. package/dist/client/assets/project-app-view-DY9V3RKN.js +0 -1
  209. package/dist/client/assets/record-editor-Iup_3GZW.js +0 -1
  210. package/dist/client/assets/registry-C1pjl2mg.js +0 -2
  211. package/dist/client/assets/store-registry-CnLvGy-0.js +0 -2
  212. package/dist/client/assets/useInfiniteQuery-D6zHLjhR.js +0 -1
  213. package/dist/client/assets/useSuspenseInfiniteQuery-BEAkaT6v.js +0 -1
@@ -1,3 +1,3 @@
1
- import{m as Be,r as S,ar as Bs,ap as Us,c as $,D as ce,l as U,j as s,E as qs,t as le,o as he,aD as Ks,s as Ie,aE as Dt,L as Qs,B as re,p as Ys,n as Gs,aF as Hs,aG as Ws,J as Ee,af as Js,aH as Pe,aI as Wt,b as rt,d as Pt,w as W,aJ as Zs,a8 as Rn,a7 as Xs,F as er,aK as tr,a as Tn,aL as nr,aM as Dn,aN as sr,aO as de,aP as gt,aQ as rr,aR as or,aS as bt,aT as ar,aU as lr,aV as ir,aW as cr,q as dr,K as $e,aX as ur,aY as Vr,aZ as fr,a_ as mr,a$ as Pn,b0 as Fe,k as pr,i as hr,ag as Mn}from"./index-DVyj5fuq.js";import{b as me,u as Ue,S as Ct,c as ot,a as xr,e as gr,f as Fn,A as br,g as vr}from"./chat-context-Bw2XBdCM.js";import{j as $n,s as at,g as Ve,P as Je,k as Mt,t as yr,l as Ar,M as jr,m as wr,n as Ze,o as On,p as Sr,D as Cr,q as Nr,r as kr,v as Oe,w as _r,d as Ir,x as Er,y as Ft,z as Rr,F as Tr,i as Dr,E as Pr,c as Mr,A as Fr,B as $r,H as Jt,I as Or}from"./scroll-area-BOzFl7qs.js";import{c as Nt,a as xe,b as ge,T as be}from"./tooltip-3uKRhKGc.js";import{c as lt,d as it,b as ct,a as dt,e as $t}from"./dialog-CbpDnZu8.js";import{c as Lr,b as zr,a as Br,D as Ur}from"./drawer-UU4w29Dz.js";import{C as qr}from"./collection-search-ChsfwSm5.js";import{u as Kr}from"./use-mobile-CvxOtGtu.js";import{a as ut,u as Re,S as Qr,i as Zt}from"./use-mcp-client-fdcDDNuq.js";import{u as Yr,g as Vt,l as kt}from"./use-mcp-prompts-D-HAq_yv.js";import{t as ft}from"./ChevronDown-DJ5SHmhN.js";import{i as ke}from"./X-D5odjFOj.js";import{t as Gr,z as Hr,u as Wr,w as Jr,A as Zr}from"./hooks-fHAHvlgy.js";import{K as Xr,i as eo}from"./shell-layout-xNLL_s4g.js";import{u as to,a as no}from"./use-virtual-mcp-ufrd8iJJ.js";import{a as so}from"./SwitchHorizontal01-BeteqXsq.js";import{n as Ln}from"./ZapSquare-DWfiiAgK.js";import{i as qe}from"./ChevronUp-CUesWqmK.js";import{s as zn}from"./Star01-BUumId75.js";import{a as Bn}from"./Tool01-DKUGTxge.js";import{a9 as mt,w as ro,a0 as Un,aa as oo,A as qn,g as Ge,j as ao,a3 as lo,ab as io,B as co,ac as Kn,ad as uo,ae as Vo,c as Qn}from"./agent-icon-AqXPfJak.js";import{i as fo}from"./Upload01-CvwE1uG-.js";import{i as Yn}from"./AlertCircle-kcMUHNYP.js";import{a as mo}from"./Eye-FmUDnTHn.js";import{a as _t,b as Ot,d as Lt,e as zt,F as Gn}from"./form-HH5S6Yti.js";import{S as po,d as ho,a as xo,b as go,c as bo}from"./select-C3uZV2A_.js";import{b as vo}from"./Settings02-k7X7M16V.js";import{i as Hn,t as It,b as yo}from"./XCircle-CkFuQ7IG.js";import{b as Ao,c as jo}from"./tabs-C2oZPeQe.js";import{T as Wn,a as Xe}from"./toggle-group-DJ8r0lkn.js";import{I as Jn}from"./input-GyW6rRcJ.js";import{u as Zn,a as wo,g as So,A as Co}from"./sortable.esm-bhnYhglv.js";import{u as Xn}from"./studio-tools-BvOjHliA.js";import{i as Bt}from"./Monitor01-DNvJhnf-.js";import{u as es,C as No,a as ts,b as ns}from"./connect-desktop-dialog-CRTSitBm.js";import{m as pt,i as ko,g as ss,a as _o,N as Io}from"./decopilot-CTSJKb4z.js";import{P as Ut,a as qt,b as Kt}from"./popover-DCt-yH34.js";import{e as Xt,a as en,g as Eo,b as Ro,C as To,c as Do,d as Po}from"./command-BxulIERM.js";import{u as Mo}from"./useInfiniteQuery-D6zHLjhR.js";import{t as Fo}from"./Stars01-BvvUaY8d.js";import{D as $o,a as Oo,b as Lo,c as ue,d as tn,e as nn,f as sn,j as zo,i as Bo}from"./dropdown-menu-QpPxe1tm.js";import{s as rn}from"./Plus-8zBKSNee.js";import{p as Uo,q as qo}from"./question-004-sINsf4GQ.js";import{i as Ko}from"./ChevronRight-BXEszS6k.js";function Qo(t,e){const n=Be(e);return Yo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Yo(t={},e){const n=Be(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=on(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=Bs(o.current,on(n,r.current));o.current!==l&&(o.current=l,Us.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,rs="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",Go="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function os(t){const e=$.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:d}=n;let u;if(e[0]!==d._meta||e[1]!==d.name||e[2]!==d.title){const A=Ve(d._meta);u=d.title??Mt(d.name,A),e[0]=d._meta,e[1]=d.name,e[2]=d.title,e[3]=u}else u=e[3];const V=u,i=d.description||null;if(c==="card"){let A;e[4]!==r||e[5]!==d?(A=()=>r(d),e[4]=r,e[5]=d,e[6]=A):A=e[6];const w=a||o,N=o&&"bg-accent/40",D=(a||o)&&"cursor-not-allowed opacity-50";let k;e[7]!==N||e[8]!==D?(k=U(Go,"hover:bg-accent/60 text-foreground",N,D),e[7]=N,e[8]=D,e[9]=k):k=e[9];let T;e[10]!==V?(T=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=T):T=e[11];let P;e[12]!==o?(P=o&&s.jsx(Ct,{size:"xs"}),e[12]=o,e[13]=P):P=e[13];let I;e[14]!==T||e[15]!==P?(I=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,P]}),e[14]=T,e[15]=P,e[16]=I):I=e[16];let M;e[17]!==i?(M=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=M):M=e[18];let _;return e[19]!==I||e[20]!==M||e[21]!==A||e[22]!==w||e[23]!==k?(_=s.jsxs("button",{type:"button",onClick:A,disabled:w,className:k,children:[I,M]}),e[19]=I,e[20]=M,e[21]=A,e[22]=w,e[23]=k,e[24]=_):_=e[24],_}let m;e[25]!==r||e[26]!==d?(m=()=>r(d),e[25]=r,e[26]=d,e[27]=m):m=e[27];const f=a||o,g=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let x;e[28]!==g||e[29]!==p?(x=U(rs,"hover:bg-muted/70 hover:text-foreground",g,p),e[28]=g,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let h;e[33]!==o?(h=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=h):h=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==x||e[38]!==b||e[39]!==h?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:x,children:[b,h]})}),e[35]=m,e[36]=f,e[37]=x,e[38]=b,e[39]=h,e[40]=v):v=e[40];const y=i??V;let C;e[41]!==y?(C=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=C):C=e[42];let j;return e[43]!==v||e[44]!==C?(j=s.jsxs(be,{delayDuration:400,children:[v,C]}),e[43]=v,e[44]=C,e[45]=j):j=e[45],j}function Ho(t){const e=$.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,d]=S.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(w=>{const N=c.toLowerCase();return w.prompt.name.toLowerCase().includes(N)||(w.prompt.title??"").toLowerCase().includes(N)||(w.prompt.description??"").toLowerCase().includes(N)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const i=V,m=Kr();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let g;if(e[6]!==i||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let w;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(w=N=>s.jsx(os,{item:N,variant:"card",onSelect:D=>{o(!1),a(D)},isLoading:l?.name===N.prompt.name,isDisabled:u&&l?.name!==N.prompt.name},N.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=w):w=e[16],g=i.map(w),e[6]=i,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=g}else g=e[11];let p;e[17]!==f||e[18]!==g?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,g]})}),e[17]=f,e[18]=g,e[19]=p):p=e[19];const x=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=w=>{w.key==="Escape"&&d("")},e[20]=b):b=e[20];let h;e[21]!==c?(h=s.jsx(qr,{value:c,onChange:d,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=h):h=e[22];const v=h;if(m){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Lr,{className:"sr-only",children:s.jsx(zr,{children:"All prompts"})}),e[23]=w):w=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=N):N=e[24];let D;e[25]!==x||e[26]!==v?(D=s.jsxs(Br,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,N,v,x]}),e[25]=x,e[26]=v,e[27]=D):D=e[27];let k;return e[28]!==o||e[29]!==r||e[30]!==D?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(Ur,{open:r,onOpenChange:o,children:D})}),e[28]=o,e[29]=r,e[30]=D,e[31]=k):k=e[31],k}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let j;e[34]!==x||e[35]!==v?(j=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,C,v,x]}),e[34]=x,e[35]=v,e[36]=j):j=e[36];let A;return e[37]!==o||e[38]!==r||e[39]!==j?(A=s.jsx(Nt,{delayDuration:400,children:s.jsx(dt,{open:r,onOpenChange:o,children:j})}),e[37]=o,e[38]=r,e[39]=j,e[40]=A):A=e[40],A}function Wo(t){const e=$.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=S.useState(!1);if(n.length===0)return null;let d,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,an);let h;e[6]!==n?(h=n.slice(an),e[6]=n,e[7]=h):h=e[7],d=h,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(os,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:u&&o?.name!==y.prompt.name},y.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=d,e[4]=u,e[5]=V}else d=e[3],u=e[4],V=e[5];const i=V;let m;e[12]!==a?(m=U("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==d.length||e[15]!==u?(f=d.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:U(rs,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",d.length," more"]}),e[14]=d.length,e[15]=u,e[16]=f):f=e[16];let g;e[17]!==i||e[18]!==m||e[19]!==f?(g=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=g):g=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(Ho,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let x;return e[26]!==g||e[27]!==p?(x=s.jsxs(Nt,{delayDuration:400,children:[g,p]}),e[26]=g,e[27]=p,e[28]=x):x=e[28],x}function Jo(){return null}function Zo(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 Xo(t){const e=$.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{org:o}=ce();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Re(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=Yr(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const V=u;let i;e[8]!==V?(i=V.map(ea),e[8]=V,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[g,p]=S.useReducer(Zo,f),[x,b]=S.useState(null);let h;e[11]!==l||e[12]!==r?(h=async(P,I)=>{if(!l){le.error("MCP client not available"),p({type:"RESET"});return}try{const M=await Vt(l,P.name,I);p({type:"RESET"});const _={type:"doc",content:[{type:"paragraph",content:[$n({id:P.name,name:at(P.name,Ve(P._meta)),metadata:M.messages,char:"/",kind:"prompt",args:I}),{type:"text",text:" "}]}]};await r(_)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),le.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=h):h=e[13];const v=h;let y;e[14]!==v?(y=async P=>{if(P.arguments&&P.arguments.length>0){p({type:"SELECT_PROMPT",prompt:P}),b(P);return}p({type:"START_LOADING",prompt:P}),await v(P)},e[14]=v,e[15]=y):y=e[15];const C=y;let j;e[16]!==x||e[17]!==v?(j=async P=>{x&&(p({type:"START_LOADING",prompt:x,arguments:P}),b(null),await v(x,P))},e[16]=x,e[17]=v,e[18]=j):j=e[18];const A=j;if(m.length===0)return null;const w=g.stage==="loading"?g.prompt:null;let N;e[19]!==C||e[20]!==m||e[21]!==w?(N=s.jsx(Wo,{items:m,onSelect:C,loadingPrompt:w}),e[19]=C,e[20]=m,e[21]=w,e[22]=N):N=e[22];let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{b(null),p({type:"RESET"})},e[23]=D):D=e[23];let k;e[24]!==x||e[25]!==A?(k=s.jsx(Je,{prompt:x,setPrompt:D,onSubmit:A}),e[24]=x,e[25]=A,e[26]=k):k=e[26];let T;return e[27]!==N||e[28]!==k?(T=s.jsxs(s.Fragment,{children:[N,k]}),e[27]=N,e[28]=k,e[29]=T):T=e[29],T}function ea(t){return{prompt:t}}function ta(t){const e=$.c(13),{className:n}=t,{selectedVirtualMcp:r}=me(),{org:o}=ce();let a;e[0]!==o.id?(a=ut(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let d;e[2]!==n?(d=U("w-full @container",n),e[2]=n,e[3]=d):d=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(Jo,{}),e[4]=V):V=e[4];let i;e[5]!==c?(i=s.jsx(Xo,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==u||e[8]!==i?(m=s.jsx(qs,{fallback:null,children:s.jsx(S.Suspense,{fallback:V,children:i},u)}),e[7]=u,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==d||e[11]!==m?(f=s.jsx("div",{className:d,children:m}),e[10]=d,e[11]=m,e[12]=f):f=e[12],f}const vt="cubic-bezier(0.645, 0.045, 0.355, 1)",na=44,sa={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},ra={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},oa={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function fe(t){const e=$.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:d,defaultExpanded:u,variant:V,onClose:i}=t,m=V===void 0?"default":V,[f,g]=S.useState(u),[p,x]=S.useState(!1);let b;e[0]!==i?(b=()=>{x(!0),i?.()},e[0]=i,e[1]=b):b=e[1];const h=b;if(p)return null;const v=ra[m],y=sa[m];let C;e[2]!==v||e[3]!==y?(C=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=C):C=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=()=>g(aa),e[5]=j):j=e[5];const A=f&&"rounded-b-none",w=!f&&"rounded-b-xl";let N;e[6]!==A||e[7]!==w?(N=U("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",A,w),e[6]=A,e[7]=w,e[8]=N):N=e[8];const D=oa[m];let k;e[9]!==D?(k=U("shrink-0",D),e[9]=D,e[10]=k):k=e[10];let T;e[11]!==n||e[12]!==k?(T=s.jsx("span",{className:k,children:n}),e[11]=n,e[12]=k,e[13]=T):T=e[13];let P;e[14]!==r?(P=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=P):P=e[15];let I;e[16]!==o?(I=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=I):I=e[17];const M=f?"rotate(180deg)":"rotate(0deg)";let _;e[18]!==M?(_=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ft,{size:16,style:{transform:M,transition:`transform 180ms ${vt}`}})}),e[18]=M,e[19]=_):_=e[19];let R,E;e[20]!==h?(R=X=>{X.stopPropagation(),h()},E=X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),X.stopPropagation(),h())},e[20]=h,e[21]=R,e[22]=E):(R=e[21],E=e[22]);let O;e[23]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ke,{size:16}),e[23]=O):O=e[23];let B;e[24]!==R||e[25]!==E?(B=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:R,onKeyDown:E,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:O}),e[24]=R,e[25]=E,e[26]=B):B=e[26];let L;e[27]!==f||e[28]!==T||e[29]!==P||e[30]!==I||e[31]!==_||e[32]!==B||e[33]!==N?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:j,className:N,children:[T,P,I,_,B]}),e[27]=f,e[28]=T,e[29]=P,e[30]=I,e[31]=_,e[32]=B,e[33]=N,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let K;e[35]!==q?(K={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${vt}`},e[35]=q,e[36]=K):K=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q={overflow:"hidden",minHeight:0},e[37]=Q):Q=e[37];const F=f?1:0;let z;e[38]!==F?(z={opacity:F,transition:`opacity 120ms ${vt}`},e[38]=F,e[39]=z):z=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let G;e[42]!==d||e[43]!==a?(G=d?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:d}):null,e[42]=d,e[43]=a,e[44]=G):G=e[44];let J;e[45]!==l||e[46]!==c?(J=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=J):J=e[47];let ee;e[48]!==z||e[49]!==Y||e[50]!==G||e[51]!==J?(ee=s.jsx("div",{style:Q,children:s.jsxs("div",{style:z,children:[Y,G,J]})}),e[48]=z,e[49]=Y,e[50]=G,e[51]=J,e[52]=ee):ee=e[52];let te;e[53]!==K||e[54]!==ee?(te=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:ee}),e[53]=K,e[54]=ee,e[55]=te):te=e[55];let ne;return e[56]!==L||e[57]!==te||e[58]!==C||e[59]!==m?(ne=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[L,te]}),e[56]=L,e[57]=te,e[58]=C,e[59]=m,e[60]=ne):ne=e[60],ne}function aa(t){return!t}const la=he({content:Ie().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:Ie().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),as=he({todos:Ks(la)}),ia="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.";Gr({description:ia,inputSchema:Hr(as),execute:async({todos:t})=>({ok:!0,count:t.length})});const ca="tool-todo_write",da=new Set(["input-available","output-available"]);function ls(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==ca||typeof a.state!="string"||!da.has(a.state))continue;const l=as.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function is(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:yr(Ar(r)),input:n.input})}return e}function cs(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function ua(t){return t?t.message.startsWith("[CREDITS]"):!1}const Va={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function fa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&ua(n))return{...Va,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],d=c,V=!!d.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=cs(c),m=is(d),f=ls(e),g=!o&&!!n,p=m.length>0||o&&a,x=i.length>0,h=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||x))&&!g;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:g,showWarning:h,hasApprovals:p,hasPlans:x,isWaitingForUserInput:V}}function ds(){const t=$.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),l=n??null,c=r??null;let d;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(d=fa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=d):d=t[5],d}function ma(){const t=ds();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function us(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(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const pa="__home__";function Qt(t,e){return Qs.chatDraft(t,e)}function ha(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function xa(t,e,n,r,o){const a=Qt(e,n);if(us(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(d){if(ba(d)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw d}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=ha(o);return o!==null&&a===null&&t.removeItem(r),a}function ga(t,e,n){t.removeItem(Qt(e,n))}function ba(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function va(t){const e=$.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=U("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(vo,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==d?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:d,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=d,e[6]=V):V=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,g=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==g?(p=U("p-0.5 rounded transition-colors",g),e[10]=g,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Hn,{size:14}),e[12]=x):x=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:x}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let h;return e[17]!==b||e[18]!==V||e[19]!==m?(h=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=h):h=e[20],h}function Vs(t){const e=$.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(va,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function ya(t){const e=$.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const g=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==g?(p=U("h-7 px-2.5 text-xs",g),e[3]=g,e[4]=p):p=e[4];let x;e[5]!==i||e[6]!==V||e[7]!==f||e[8]!==p?(x=s.jsx(re,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:V}),e[5]=i,e[6]=V,e[7]=f,e[8]=p,e[9]=x):x=e[9];const b=x;if(!m)return b;let h;e[10]!==b?(h=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=h):h=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==h||e[15]!==v?(y=s.jsxs(be,{children:[h,v]}),e[14]=h,e[15]=v,e[16]=y):y=e[16],y}function fs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function dn(t,e,n,r,o){if(t.length===0)return null;const a=fs(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const d=e(c);if(d!==o&&!r(n[d]))return d}return null}function Aa(t){return!t.isStreaming&&t.allAnswered}function ms(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,d=e[0]?n(e[0]):"",[u,V]=S.useState(d),[i,m]=S.useState(!1),f=Ys({resolver:Gs(r),defaultValues:o}),g=f.watch(),p=fs(e,n,u),x=p>=0?e[p]:void 0,b=l(g[u]),h=cn(e,n,g,l),v=Aa({isStreaming:a,allAnswered:h}),y=()=>{if(p>0){const k=e[p-1];k&&V(n(k))}},C=()=>{if(p>=0&&p<e.length-1){const k=e[p+1];k&&V(n(k))}},j=()=>{const k=f.getValues(),T=dn(e,n,k,l,u);T&&V(T)},A=()=>{f.handleSubmit(k=>{const T=k;for(const P of e)c(P,T[n(P)])})()},w=S.useRef(A);w.current=A;const N=()=>{v&&(m(!1),w.current())},D=()=>{const k=f.getValues();if(cn(e,n,k,l)){if(a){m(!0);return}m(!1),w.current()}else{const T=dn(e,n,k,l,u);T&&V(T)}};return S.useEffect(()=>{if(i&&!a){if(!h){m(!1);return}m(!1),w.current()}},[i,a,h]),{form:f,activeKey:u,setActiveKey:V,currentIndex:p,currentPart:x,isCurrentAnswered:b,isAllAnswered:h,canSubmit:v,goPrev:y,goNext:C,advanceToNextUnanswered:j,submit:N,submitOrAdvance:D}}const ps="User denied this tool call, give other alternatives.";function hs(t){const e=$.c(9),{onYolo:n}=t,[r,o]=Ee();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const i=V,m=r.toolApprovalLevel??"readonly";o({...r,toolApprovalLevel:i}),i==="auto"&&n(m)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(go,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:wa,children:s.jsx(bo,{})}),e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(po,{children:Pe.map(ja)}),e[5]=d):d=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(ho,{value:r.toolApprovalLevel,onValueChange:l,children:[c,d]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function ja(t){return s.jsx(xo,{value:t.value,children:t.label},t.value)}function wa(t){return t.stopPropagation()}function xs(t){const e=$.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.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:r})}),e[3]=r,e[4]=o):o=e[4],o}function Sa(t){const e=$.c(28),{approval:n,onRespond:r}=t,[o]=Ee(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ps,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(d=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=d):d=e[7];const u=d;let V;e[8]!==n.approvalId||e[9]!==r?(V=C=>r(n.approvalId,!0,void 0,C),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const i=V;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(hs,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let g;e[13]!==c?(g=s.jsx(re,{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:c,children:"Deny"}),e[13]=c,e[14]=g):g=e[14];let p;e[15]!==u?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=p):p=e[16];let x;e[17]!==g||e[18]!==p?(x=s.jsxs(s.Fragment,{children:[g,p]}),e[17]=g,e[18]=p,e[19]=x):x=e[19];const b=x;let h;e[20]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{size:14}),e[20]=h):h=e[20];let v;e[21]!==n.input?(v=s.jsx(xs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(y=s.jsx(fe,{icon:h,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=y):y=e[27],y}const Ca=Hs(Ie(),he({approved:Ws().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function Na(t){const e=$.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ee(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Ia)),e[0]=n,e[1]=c):c=e[1];const d=c;let u;e[2]!==l||e[3]!==o?(u=(D,k)=>{const T=k;typeof T?.approved=="boolean"&&o(D.approvalId,T.approved,T.approved===!1?ps:void 0,T.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==d||e[7]!==r||e[8]!==u?(V={parts:n,partKey:_a,schema:Ca,defaultValues:d,isStreaming:r,hasAnswer:ka,onSubmit:u},e[5]=n,e[6]=d,e[7]=r,e[8]=u,e[9]=V):V=e[9];const i=ms(V);let m;e[10]!==n||e[11]!==i?(m=D=>{i.form.reset(Object.fromEntries(n.map(k=>[k.approvalId,{approved:!0,levelOverride:D}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,g=i.currentPart;let p;e[13]!==i?(p=D=>{D.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(mt,{size:14}),e[15]=x):x=e[15];const b=`${n.length} approvals pending`,h=g?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(hs,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(y=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=y):y=e[23];let C;e[24]!==g||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(C=g?s.jsx(Ea,{approvalId:g.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=g,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=C):C=e[27];let j;e[28]!==g?(j=g?s.jsx(xs,{input:g.input}):null,e[28]=g,e[29]=j):j=e[29];let A;e[30]!==y||e[31]!==C||e[32]!==j||e[33]!==b||e[34]!==h?(A=s.jsx(fe,{icon:x,label:b,title:h,defaultExpanded:!0,footerLeft:y,footerRight:C,children:j}),e[30]=y,e[31]=C,e[32]=j,e[33]=b,e[34]=h,e[35]=A):A=e[35];let w;e[36]!==A||e[37]!==p?(w=s.jsx("form",{onSubmit:p,children:A}),e[36]=A,e[37]=p,e[38]=w):w=e[38];let N;return e[39]!==i.form||e[40]!==w?(N=s.jsx(_t,{...i.form,children:w}),e[39]=i.form,e[40]=w,e[41]=N):N=e[41],N}function ka(t){return typeof t?.approved=="boolean"}function _a(t){return t.approvalId}function Ia(t){return[t.approvalId,{approved:void 0}]}function Ea(t){const e=$.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=d=>{const{field:u}=d,V=u.value===!0,i=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Js,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function Ra(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(mt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ta(t){const e=$.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ra,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(Sa,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Na,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Da(t){const e=$.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(re,{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 d;e[5]!==l?(d=s.jsx(re,{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:l,children:"Let's go"}),e[5]=l,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];const V=u;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ro,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(jr,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(fe,{icon:i,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 Pa(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(qe,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ma(t){const e=$.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Pa,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let d;return e[3]!==c||e[4]!==o||e[5]!==a?(d=s.jsx(Da,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=d):d=e[6],d}function gs(t){return t?"response"in t?t.response:t.option??t.draft:""}const un=he({response:Ie().min(1,"Response is required")}),Fa=he({option:Ie().nullable(),draft:Ie()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),$a=he({response:Dt(["yes","no"])});function Oa(t){switch(t.type){case"text":return un;case"choice":return Fa;case"confirm":return $a;default:return un}}function La(t){const e={};for(const n of t)e[n.toolCallId]=Oa(n.input);return he(e)}function za(t){const e=$.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:d}=c,u=d.value??"";return s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...d,value:u,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"})]})})}),s.jsx(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Gn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function bs(t,e){const n=$.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const d=Number.parseInt(l.key,10);d>=1&&d<=t&&(l.preventDefault(),e(d-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),S.useEffect(r,o)}function Ba(t){const e=$.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Wt(l),d=`${r}.draft`;let u;e[3]!==n||e[4]!==d?(u={control:n,name:d,defaultValue:""},e[3]=n,e[4]=d,e[5]=u):u=e[5];const{field:V}=Wt(u),i=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=T=>{const P=o[T];P!=null&&c.onChange(P)},e[6]=c,e[7]=o,e[8]=f):f=e[8],bs(o.length,f),o.length===0)return null;const g=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let T;e[13]!==c||e[14]!==i?(T=(P,I)=>{const M=i===P;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(P),className:U("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",M&&"bg-accent/50",!M&&"hover:bg-accent/30"),"aria-label":`Select ${P}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",M?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:P})]},`${I}-${P}`)},e[13]=c,e[14]=i,e[15]=T):T=e[15],p=o.map(T),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const x=g&&"bg-accent/50",b=!g&&"hover:bg-accent/30";let h;e[16]!==x||e[17]!==b?(h=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[16]=x,e[17]=b,e[18]=h):h=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=g?m:"";let C;e[20]!==V||e[21]!==c||e[22]!==i?(C=T=>{V.onChange(T.target.value),i!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=i,e[23]=C):C=e[23];let j;e[24]!==c||e[25]!==i?(j=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=j):j=e[26];let A;e[27]!==y||e[28]!==C||e[29]!==j?(A=s.jsx("input",{type:"text",value:y,onChange:C,onFocus:j,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]=y,e[28]=C,e[29]=j,e[30]=A):A=e[30];let w;e[31]!==A||e[32]!==h?(w=s.jsxs("label",{className:h,children:[v,A]}),e[31]=A,e[32]=h,e[33]=w):w=e[33];let N;e[34]!==w||e[35]!==p?(N=s.jsx(Lt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,w]})}),e[34]=w,e[35]=p,e[36]=N):N=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(zt,{}),e[37]=D):D=e[37];let k;return e[38]!==N?(k=s.jsxs(Ot,{children:[N,D]}),e[38]=N,e[39]=k):k=e[39],k}function Ua(t){const e=$.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=S.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],bs(a.length,c);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=V=>{const{field:i}=V;return l.current=i,s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:U("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:[s.jsx("span",{className:U("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}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(zt,{})]})},e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Gn,{control:n,name:r,render:d}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function Vn(t){const e=$.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(za,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ba,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ua,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function qa(t){const e=$.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=La(n.map(Ga)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(Ya)),e[2]=n,e[3]=c):c=e[3];const d=c;let u;e[4]!==o?(u=(R,E)=>{const O=gs(E);O&&o(R,O)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==d||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:Qa,schema:l,defaultValues:d,isStreaming:r,hasAnswer:Ka,onSubmit:u},e[6]=d,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const i=ms(V),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const R=m;if(!R)return;const E=R.toolCallId;R.input?.type==="choice"?(i.form.setValue(`${E}.option`,null),i.form.setValue(`${E}.draft`,"user has skip this question")):i.form.setValue(`${E}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const g=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const x=p;let b;e[20]!==g?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:"Skip"}),e[20]=g,e[21]=b):b=e[21];let h;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(h=s.jsx(ya,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=h):h=e[26];let v;e[27]!==b||e[28]!==h?(v=s.jsxs(s.Fragment,{children:[b,h]}),e[27]=b,e[28]=h,e[29]=v):v=e[29];const y=v;if(n.length===1){const R=n[0];if(!R?.input)return null;let E;e[30]!==i?(E=z=>{z.preventDefault(),i.submit()},e[30]=i,e[31]=E):E=e[31];let O;e[32]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(It,{size:14}),e[32]=O):O=e[32];const B=R.input?.prompt??"Question",L=R.input;let q;e[33]!==i.form.control||e[34]!==R.toolCallId||e[35]!==L?(q=s.jsx(Vn,{input:L,control:i.form.control,toolCallId:R.toolCallId}),e[33]=i.form.control,e[34]=R.toolCallId,e[35]=L,e[36]=q):q=e[36];let K;e[37]!==y||e[38]!==B||e[39]!==q?(K=s.jsx(fe,{icon:O,label:"Question pending",title:B,defaultExpanded:!0,footerRight:y,children:q}),e[37]=y,e[38]=B,e[39]=q,e[40]=K):K=e[40];let Q;e[41]!==E||e[42]!==K?(Q=s.jsx("form",{onSubmit:E,autoComplete:"off",children:K}),e[41]=E,e[42]=K,e[43]=Q):Q=e[43];let F;return e[44]!==i.form||e[45]!==Q?(F=s.jsx(_t,{...i.form,children:Q}),e[44]=i.form,e[45]=Q,e[46]=F):F=e[46],F}const C=i.form;let j;e[47]!==i?(j=R=>{R.preventDefault(),i.submit()},e[47]=i,e[48]=j):j=e[48];let A;e[49]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(It,{size:14}),e[49]=A):A=e[49];const w=`${i.currentIndex+1} of ${n.length}`,N=m?.input?.prompt??"Question",D=i.activeKey,k=i.setActiveKey;let T;if(e[50]!==i.form||e[51]!==n){let R;e[53]!==i.form?(R=E=>s.jsx(Ao,{value:E.toolCallId,className:"mt-0",children:s.jsx(Vn,{input:E.input,control:i.form.control,toolCallId:E.toolCallId})},E.toolCallId),e[53]=i.form,e[54]=R):R=e[54],T=n.map(R),e[50]=i.form,e[51]=n,e[52]=T}else T=e[52];let P;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==T?(P=s.jsx(jo,{value:D,onValueChange:k,children:T}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=T,e[58]=P):P=e[58];let I;e[59]!==x||e[60]!==y||e[61]!==w||e[62]!==N||e[63]!==P?(I=s.jsx(fe,{icon:A,label:"Question pending",count:w,title:N,defaultExpanded:!0,footerLeft:x,footerRight:y,children:P}),e[59]=x,e[60]=y,e[61]=w,e[62]=N,e[63]=P,e[64]=I):I=e[64];let M;e[65]!==j||e[66]!==I?(M=s.jsx("form",{onSubmit:j,autoComplete:"off",children:I}),e[65]=j,e[66]=I,e[67]=M):M=e[67];let _;return e[68]!==i.form||e[69]!==M?(_=s.jsx(_t,{...C,children:M}),e[68]=i.form,e[69]=M,e[70]=_):_=e[70],_}function Ka(t){return!!gs(t)}function Qa(t){return t.toolCallId}function Ya(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Ga(t){return{toolCallId:t.toolCallId,input:t.input}}function Ha(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(It,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function vs(t){const e=$.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Wa),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ha,{}),e[2]=d):d=e[2],d}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(qa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Wa(t){return t.state==="input-available"}function Ja(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function Za(){const t=$.c(21),{messages:e}=Ue();let n,r,o,a,l,c,d,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=ls(e);if(f.length===0){V=null;break e}const g=Ja(f);n=fe,l=s.jsx(nl,{status:g.icon}),c=g.activity,d=g.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Xa)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=d,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==u||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:d,defaultExpanded:u,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=d,t[18]=u,t[19]=i,t[20]=m):m=t[20],m}function Xa(t,e){return s.jsx(el,{todo:t},e)}function el(t){const e=$.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(tl,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let d;e[2]!==c?(d=U("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=d):d=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==u||e[5]!==V?(i=s.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]=i):i=e[6];let m;e[7]!==a||e[8]!==d||e[9]!==i?(m=s.jsxs("span",{className:d,children:[a,i]}),e[7]=a,e[8]=d,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function tl(t){const e=$.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.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]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function nl(t){const e=$.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.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:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.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 r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.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]=r):r=e[2],r}const sl={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"}]},rl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function ys(t){const e=$.c(41),{onDismiss:n}=t,{org:r}=ce(),o=rt(),{decoKeyId:a}=Zn(),l=Xn(),[c,d]=S.useState(""),[u,V]=S.useState(!1),[i,m]=S.useState("usd"),f=i==="brl"?"R$":"$";let g,p;e[0]!==r.id?(g=()=>{W("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=g,e[2]=p):(g=e[1],p=e[2]),S.useEffect(g,p);let x;e[3]!==i||e[4]!==l?(x=async R=>{const{url:E}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:R,currency:i});return E},e[3]=i,e[4]=l,e[5]=x):x=e[5];let b;e[6]!==n?(b=R=>{R&&window.open(R,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let h;e[8]!==x||e[9]!==b?(h={mutationFn:x,onSuccess:b,onError:ll},e[8]=x,e[9]=b,e[10]=h):h=e[10];const{mutate:v,isPending:y}=Pt(h),C=parseFloat(c),j=!isNaN(C)&&C>=1;let A;e[11]!==n?(A=R=>!R&&n?.(),e[11]=n,e[12]=A):A=e[12];let w;e[13]===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[13]=w):w=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.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[14]=N):N=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,s.jsxs(lt,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx($t,{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[15]=D):D=e[15];let k;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==C||e[20]!==a||e[21]!==j||e[22]!==y||e[23]!==u||e[24]!==v?(k=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Wn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:R=>{R&&m(R)},children:[s.jsx(Xe,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Xe,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:sl[i].map(R=>{const{dollars:E,label:O}=R;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{W("credits_topup_clicked",{amount_cents:E*100,currency:i,tier_label:O,source:"exhausted_banner"}),v(E*100)},className:U("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:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,E]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:O})]},E)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Jn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:R=>d(R.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!j||y,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(C*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(C*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:rl.map(ol)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=C,e[20]=a,e[21]=j,e[22]=y,e[23]=u,e[24]=v,e[25]=k):k=e[25];let T;e[26]!==n?(T=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=T):T=e[27];let P;e[28]!==o||e[29]!==n||e[30]!==r.slug?(P=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=P):P=e[31];let I;e[32]!==T||e[33]!==P?(I=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[T,P]}),e[32]=T,e[33]=P,e[34]=I):I=e[34];let M;e[35]!==k||e[36]!==I?(M=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:al,children:[D,k,I]}),e[35]=k,e[36]=I,e[37]=M):M=e[37];let _;return e[38]!==M||e[39]!==A?(_=s.jsx(dt,{open:!0,onOpenChange:A,children:M}),e[38]=M,e[39]=A,e[40]=_):_=e[40],_}function ol(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(qe,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function al(t){return t.preventDefault()}function ll(t){le.error(`Top-up failed: ${t.message}`)}function il(){const t=$.c(5),e=ot(),n=es(),[r,o]=S.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(fe,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=d):d=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[d,s.jsx(No,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function cl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const d=c[1]?.trim().replace(/\.$/,"");return{summary:d?`Your sandbox didn't finish starting up (${d}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const dl={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 et(t){const e=$.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Yn:Rn,c=o?t.error.message:dl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let d;e[0]!==o||e[1]!==c?(d=o?cl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=d):d=e[2];const{summary:u,rawDetails:V}=d;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(Vl).catch(ul)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(mo,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let g;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(g=s.jsx(fe,{icon:i,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=g):g=e[18],g}function ul(){return le.error("Could not copy")}function Vl(){return le.success("Copied to clipboard")}function ht(){const t=$.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:d}=Ue(),[u,V]=Ee(),{virtualMcpId:i,createTaskWithMessage:m}=xr(),{chatMode:f,simpleModeTier:g}=me();let p;t[0]!==f||t[1]!==g||t[2]!==i?(p=Z=>({tier:g,mode:f,toolApprovalLevel:Z,agent:i?{id:i}:void 0}),t[0]=f,t[1]=g,t[2]=i,t[3]=p):p=t[3];const x=p;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??Zs(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const h=b,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],C=y.filter(hl),j=cs(y),A=is(y);let w;t[6]!==e||t[7]!==d?(w=()=>{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?`}]}]};d(oe)}},t[6]=e,t[7]=d,t[8]=w):w=t[8];const N=w;let D;t[9]!==d?(D=()=>{d({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=d,t[10]=D):D=t[10];const k=D;let T;t[11]!==x||t[12]!==h||t[13]!==c?(T=(Z,oe)=>{c({kind:"toolOutput",toolCallId:Z.toolCallId,output:{response:oe}},x(h))},t[11]=x,t[12]=h,t[13]=c,t[14]=T):T=t[14];const P=T;let I;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==i?(I=Z=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
1
+ import{m as Be,r as S,ar as Bs,ap as Us,c as $,D as ce,l as U,j as s,E as qs,t as le,o as he,aD as Ks,s as Ie,aE as Dt,L as Qs,B as re,p as Ys,n as Gs,aF as Hs,aG as Ws,J as Ee,af as Js,aH as Pe,aI as Wt,b as rt,d as Pt,w as W,aJ as Zs,a8 as Rn,a7 as Xs,F as er,aK as tr,a as Tn,aL as nr,aM as Dn,aN as sr,aO as de,aP as gt,aQ as rr,aR as or,aS as bt,aT as ar,aU as lr,aV as ir,aW as cr,q as dr,K as $e,aX as ur,aY as Vr,aZ as fr,a_ as mr,a$ as Pn,b0 as Fe,k as pr,i as hr,ag as Mn}from"./index-I8Uum3Jx.js";import{b as me,u as Ue,S as Ct,c as ot,a as xr,e as gr,f as Fn,A as br,g as vr}from"./chat-context-Bspy4m-d.js";import{j as $n,s as at,g as Ve,P as Je,k as Mt,t as yr,l as Ar,M as jr,m as wr,n as Ze,o as On,p as Sr,D as Cr,q as Nr,r as kr,v as Oe,w as _r,d as Ir,x as Er,y as Ft,z as Rr,F as Tr,i as Dr,E as Pr,c as Mr,A as Fr,B as $r,H as Jt,I as Or}from"./scroll-area-DnauLcxE.js";import{c as Nt,a as xe,b as ge,T as be}from"./tooltip-Cs84Kx7a.js";import{c as lt,d as it,b as ct,a as dt,e as $t}from"./dialog-CxQBoX40.js";import{c as Lr,b as zr,a as Br,D as Ur}from"./drawer-CoRZTii0.js";import{C as qr}from"./collection-search-BPoBI_I5.js";import{u as Kr}from"./use-mobile-C0mpADhR.js";import{a as ut,u as Re,S as Qr,i as Zt}from"./use-mcp-client-Bq9g8m5J.js";import{u as Yr,g as Vt,l as kt}from"./use-mcp-prompts-B5FIxmOZ.js";import{t as ft}from"./ChevronDown-URo4LveF.js";import{i as ke}from"./X-D7X7Z50V.js";import{t as Gr,z as Hr,u as Wr,w as Jr,A as Zr}from"./hooks-BAG9TZjZ.js";import{K as Xr,i as eo}from"./shell-layout-BgovnITR.js";import{u as to,a as no}from"./use-virtual-mcp-C5aoCVVQ.js";import{a as so}from"./SwitchHorizontal01-F_1MjTR3.js";import{n as Ln}from"./ZapSquare-CvkoTQDM.js";import{i as qe}from"./ChevronUp-HJUE3-BD.js";import{s as zn}from"./Star01-BwAv907s.js";import{a as Bn}from"./Tool01-DvTGD1Yt.js";import{a9 as mt,w as ro,a0 as Un,aa as oo,A as qn,g as Ge,j as ao,a3 as lo,ab as io,B as co,ac as Kn,ad as uo,ae as Vo,c as Qn}from"./agent-icon-B2N3zGQH.js";import{i as fo}from"./Upload01-C_hHbDSF.js";import{i as Yn}from"./AlertCircle-VcwplCRi.js";import{a as mo}from"./Eye-BSiFxHQB.js";import{a as _t,b as Ot,d as Lt,e as zt,F as Gn}from"./form-CpFt_4sy.js";import{S as po,d as ho,a as xo,b as go,c as bo}from"./select-CeO9pIG_.js";import{b as vo}from"./Settings02-DbH9OAzT.js";import{i as Hn,t as It,b as yo}from"./XCircle-PlbEvjyp.js";import{b as Ao,c as jo}from"./tabs-C0RM8s7M.js";import{T as Wn,a as Xe}from"./toggle-group-qpErv2AC.js";import{I as Jn}from"./input-CutcETvq.js";import{u as Zn,a as wo,g as So,A as Co}from"./sortable.esm-BQBGtGRV.js";import{u as Xn}from"./studio-tools-bjPFQfXc.js";import{i as Bt}from"./Monitor01-SEZLDRFN.js";import{u as es,C as No,a as ts,b as ns}from"./connect-desktop-dialog-G37q3fkg.js";import{m as pt,i as ko,g as ss,a as _o,N as Io}from"./decopilot-DfFzELja.js";import{P as Ut,a as qt,b as Kt}from"./popover-C8AJAJSa.js";import{e as Xt,a as en,g as Eo,b as Ro,C as To,c as Do,d as Po}from"./command-DMsCjDdA.js";import{u as Mo}from"./useInfiniteQuery-RfoATJAI.js";import{t as Fo}from"./Stars01-D1icdaCh.js";import{D as $o,a as Oo,b as Lo,c as ue,d as tn,e as nn,f as sn,j as zo,i as Bo}from"./dropdown-menu-5CWPgj7f.js";import{s as rn}from"./Plus-Bw9lc6SR.js";import{p as Uo,q as qo}from"./question-004-sINsf4GQ.js";import{i as Ko}from"./ChevronRight-oz8o6WPV.js";function Qo(t,e){const n=Be(e);return Yo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Yo(t={},e){const n=Be(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=on(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=Bs(o.current,on(n,r.current));o.current!==l&&(o.current=l,Us.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,rs="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",Go="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function os(t){const e=$.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:d}=n;let u;if(e[0]!==d._meta||e[1]!==d.name||e[2]!==d.title){const A=Ve(d._meta);u=d.title??Mt(d.name,A),e[0]=d._meta,e[1]=d.name,e[2]=d.title,e[3]=u}else u=e[3];const V=u,i=d.description||null;if(c==="card"){let A;e[4]!==r||e[5]!==d?(A=()=>r(d),e[4]=r,e[5]=d,e[6]=A):A=e[6];const w=a||o,N=o&&"bg-accent/40",D=(a||o)&&"cursor-not-allowed opacity-50";let k;e[7]!==N||e[8]!==D?(k=U(Go,"hover:bg-accent/60 text-foreground",N,D),e[7]=N,e[8]=D,e[9]=k):k=e[9];let T;e[10]!==V?(T=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=T):T=e[11];let P;e[12]!==o?(P=o&&s.jsx(Ct,{size:"xs"}),e[12]=o,e[13]=P):P=e[13];let I;e[14]!==T||e[15]!==P?(I=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,P]}),e[14]=T,e[15]=P,e[16]=I):I=e[16];let M;e[17]!==i?(M=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=M):M=e[18];let _;return e[19]!==I||e[20]!==M||e[21]!==A||e[22]!==w||e[23]!==k?(_=s.jsxs("button",{type:"button",onClick:A,disabled:w,className:k,children:[I,M]}),e[19]=I,e[20]=M,e[21]=A,e[22]=w,e[23]=k,e[24]=_):_=e[24],_}let m;e[25]!==r||e[26]!==d?(m=()=>r(d),e[25]=r,e[26]=d,e[27]=m):m=e[27];const f=a||o,g=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let x;e[28]!==g||e[29]!==p?(x=U(rs,"hover:bg-muted/70 hover:text-foreground",g,p),e[28]=g,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let h;e[33]!==o?(h=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=h):h=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==x||e[38]!==b||e[39]!==h?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:x,children:[b,h]})}),e[35]=m,e[36]=f,e[37]=x,e[38]=b,e[39]=h,e[40]=v):v=e[40];const y=i??V;let C;e[41]!==y?(C=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=C):C=e[42];let j;return e[43]!==v||e[44]!==C?(j=s.jsxs(be,{delayDuration:400,children:[v,C]}),e[43]=v,e[44]=C,e[45]=j):j=e[45],j}function Ho(t){const e=$.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,d]=S.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(w=>{const N=c.toLowerCase();return w.prompt.name.toLowerCase().includes(N)||(w.prompt.title??"").toLowerCase().includes(N)||(w.prompt.description??"").toLowerCase().includes(N)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const i=V,m=Kr();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let g;if(e[6]!==i||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let w;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(w=N=>s.jsx(os,{item:N,variant:"card",onSelect:D=>{o(!1),a(D)},isLoading:l?.name===N.prompt.name,isDisabled:u&&l?.name!==N.prompt.name},N.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=w):w=e[16],g=i.map(w),e[6]=i,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=g}else g=e[11];let p;e[17]!==f||e[18]!==g?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,g]})}),e[17]=f,e[18]=g,e[19]=p):p=e[19];const x=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=w=>{w.key==="Escape"&&d("")},e[20]=b):b=e[20];let h;e[21]!==c?(h=s.jsx(qr,{value:c,onChange:d,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=h):h=e[22];const v=h;if(m){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Lr,{className:"sr-only",children:s.jsx(zr,{children:"All prompts"})}),e[23]=w):w=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=N):N=e[24];let D;e[25]!==x||e[26]!==v?(D=s.jsxs(Br,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,N,v,x]}),e[25]=x,e[26]=v,e[27]=D):D=e[27];let k;return e[28]!==o||e[29]!==r||e[30]!==D?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(Ur,{open:r,onOpenChange:o,children:D})}),e[28]=o,e[29]=r,e[30]=D,e[31]=k):k=e[31],k}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let j;e[34]!==x||e[35]!==v?(j=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,C,v,x]}),e[34]=x,e[35]=v,e[36]=j):j=e[36];let A;return e[37]!==o||e[38]!==r||e[39]!==j?(A=s.jsx(Nt,{delayDuration:400,children:s.jsx(dt,{open:r,onOpenChange:o,children:j})}),e[37]=o,e[38]=r,e[39]=j,e[40]=A):A=e[40],A}function Wo(t){const e=$.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=S.useState(!1);if(n.length===0)return null;let d,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,an);let h;e[6]!==n?(h=n.slice(an),e[6]=n,e[7]=h):h=e[7],d=h,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(os,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:u&&o?.name!==y.prompt.name},y.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=d,e[4]=u,e[5]=V}else d=e[3],u=e[4],V=e[5];const i=V;let m;e[12]!==a?(m=U("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==d.length||e[15]!==u?(f=d.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:U(rs,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",d.length," more"]}),e[14]=d.length,e[15]=u,e[16]=f):f=e[16];let g;e[17]!==i||e[18]!==m||e[19]!==f?(g=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=g):g=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(Ho,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let x;return e[26]!==g||e[27]!==p?(x=s.jsxs(Nt,{delayDuration:400,children:[g,p]}),e[26]=g,e[27]=p,e[28]=x):x=e[28],x}function Jo(){return null}function Zo(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 Xo(t){const e=$.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{org:o}=ce();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Re(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=Yr(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const V=u;let i;e[8]!==V?(i=V.map(ea),e[8]=V,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[g,p]=S.useReducer(Zo,f),[x,b]=S.useState(null);let h;e[11]!==l||e[12]!==r?(h=async(P,I)=>{if(!l){le.error("MCP client not available"),p({type:"RESET"});return}try{const M=await Vt(l,P.name,I);p({type:"RESET"});const _={type:"doc",content:[{type:"paragraph",content:[$n({id:P.name,name:at(P.name,Ve(P._meta)),metadata:M.messages,char:"/",kind:"prompt",args:I}),{type:"text",text:" "}]}]};await r(_)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),le.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=h):h=e[13];const v=h;let y;e[14]!==v?(y=async P=>{if(P.arguments&&P.arguments.length>0){p({type:"SELECT_PROMPT",prompt:P}),b(P);return}p({type:"START_LOADING",prompt:P}),await v(P)},e[14]=v,e[15]=y):y=e[15];const C=y;let j;e[16]!==x||e[17]!==v?(j=async P=>{x&&(p({type:"START_LOADING",prompt:x,arguments:P}),b(null),await v(x,P))},e[16]=x,e[17]=v,e[18]=j):j=e[18];const A=j;if(m.length===0)return null;const w=g.stage==="loading"?g.prompt:null;let N;e[19]!==C||e[20]!==m||e[21]!==w?(N=s.jsx(Wo,{items:m,onSelect:C,loadingPrompt:w}),e[19]=C,e[20]=m,e[21]=w,e[22]=N):N=e[22];let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{b(null),p({type:"RESET"})},e[23]=D):D=e[23];let k;e[24]!==x||e[25]!==A?(k=s.jsx(Je,{prompt:x,setPrompt:D,onSubmit:A}),e[24]=x,e[25]=A,e[26]=k):k=e[26];let T;return e[27]!==N||e[28]!==k?(T=s.jsxs(s.Fragment,{children:[N,k]}),e[27]=N,e[28]=k,e[29]=T):T=e[29],T}function ea(t){return{prompt:t}}function ta(t){const e=$.c(13),{className:n}=t,{selectedVirtualMcp:r}=me(),{org:o}=ce();let a;e[0]!==o.id?(a=ut(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let d;e[2]!==n?(d=U("w-full @container",n),e[2]=n,e[3]=d):d=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(Jo,{}),e[4]=V):V=e[4];let i;e[5]!==c?(i=s.jsx(Xo,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==u||e[8]!==i?(m=s.jsx(qs,{fallback:null,children:s.jsx(S.Suspense,{fallback:V,children:i},u)}),e[7]=u,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==d||e[11]!==m?(f=s.jsx("div",{className:d,children:m}),e[10]=d,e[11]=m,e[12]=f):f=e[12],f}const vt="cubic-bezier(0.645, 0.045, 0.355, 1)",na=44,sa={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},ra={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},oa={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function fe(t){const e=$.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:d,defaultExpanded:u,variant:V,onClose:i}=t,m=V===void 0?"default":V,[f,g]=S.useState(u),[p,x]=S.useState(!1);let b;e[0]!==i?(b=()=>{x(!0),i?.()},e[0]=i,e[1]=b):b=e[1];const h=b;if(p)return null;const v=ra[m],y=sa[m];let C;e[2]!==v||e[3]!==y?(C=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=C):C=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=()=>g(aa),e[5]=j):j=e[5];const A=f&&"rounded-b-none",w=!f&&"rounded-b-xl";let N;e[6]!==A||e[7]!==w?(N=U("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",A,w),e[6]=A,e[7]=w,e[8]=N):N=e[8];const D=oa[m];let k;e[9]!==D?(k=U("shrink-0",D),e[9]=D,e[10]=k):k=e[10];let T;e[11]!==n||e[12]!==k?(T=s.jsx("span",{className:k,children:n}),e[11]=n,e[12]=k,e[13]=T):T=e[13];let P;e[14]!==r?(P=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=P):P=e[15];let I;e[16]!==o?(I=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=I):I=e[17];const M=f?"rotate(180deg)":"rotate(0deg)";let _;e[18]!==M?(_=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ft,{size:16,style:{transform:M,transition:`transform 180ms ${vt}`}})}),e[18]=M,e[19]=_):_=e[19];let R,E;e[20]!==h?(R=X=>{X.stopPropagation(),h()},E=X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),X.stopPropagation(),h())},e[20]=h,e[21]=R,e[22]=E):(R=e[21],E=e[22]);let O;e[23]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ke,{size:16}),e[23]=O):O=e[23];let B;e[24]!==R||e[25]!==E?(B=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:R,onKeyDown:E,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:O}),e[24]=R,e[25]=E,e[26]=B):B=e[26];let L;e[27]!==f||e[28]!==T||e[29]!==P||e[30]!==I||e[31]!==_||e[32]!==B||e[33]!==N?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:j,className:N,children:[T,P,I,_,B]}),e[27]=f,e[28]=T,e[29]=P,e[30]=I,e[31]=_,e[32]=B,e[33]=N,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let K;e[35]!==q?(K={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${vt}`},e[35]=q,e[36]=K):K=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q={overflow:"hidden",minHeight:0},e[37]=Q):Q=e[37];const F=f?1:0;let z;e[38]!==F?(z={opacity:F,transition:`opacity 120ms ${vt}`},e[38]=F,e[39]=z):z=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let G;e[42]!==d||e[43]!==a?(G=d?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:d}):null,e[42]=d,e[43]=a,e[44]=G):G=e[44];let J;e[45]!==l||e[46]!==c?(J=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=J):J=e[47];let ee;e[48]!==z||e[49]!==Y||e[50]!==G||e[51]!==J?(ee=s.jsx("div",{style:Q,children:s.jsxs("div",{style:z,children:[Y,G,J]})}),e[48]=z,e[49]=Y,e[50]=G,e[51]=J,e[52]=ee):ee=e[52];let te;e[53]!==K||e[54]!==ee?(te=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:ee}),e[53]=K,e[54]=ee,e[55]=te):te=e[55];let ne;return e[56]!==L||e[57]!==te||e[58]!==C||e[59]!==m?(ne=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:C,children:[L,te]}),e[56]=L,e[57]=te,e[58]=C,e[59]=m,e[60]=ne):ne=e[60],ne}function aa(t){return!t}const la=he({content:Ie().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:Ie().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),as=he({todos:Ks(la)}),ia="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.";Gr({description:ia,inputSchema:Hr(as),execute:async({todos:t})=>({ok:!0,count:t.length})});const ca="tool-todo_write",da=new Set(["input-available","output-available"]);function ls(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==ca||typeof a.state!="string"||!da.has(a.state))continue;const l=as.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function is(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:yr(Ar(r)),input:n.input})}return e}function cs(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function ua(t){return t?t.message.startsWith("[CREDITS]"):!1}const Va={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function fa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&ua(n))return{...Va,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],d=c,V=!!d.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=cs(c),m=is(d),f=ls(e),g=!o&&!!n,p=m.length>0||o&&a,x=i.length>0,h=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||x))&&!g;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:g,showWarning:h,hasApprovals:p,hasPlans:x,isWaitingForUserInput:V}}function ds(){const t=$.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),l=n??null,c=r??null;let d;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(d=fa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=d):d=t[5],d}function ma(){const t=ds();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function us(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(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const pa="__home__";function Qt(t,e){return Qs.chatDraft(t,e)}function ha(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function xa(t,e,n,r,o){const a=Qt(e,n);if(us(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(d){if(ba(d)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw d}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=ha(o);return o!==null&&a===null&&t.removeItem(r),a}function ga(t,e,n){t.removeItem(Qt(e,n))}function ba(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function va(t){const e=$.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=U("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(vo,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==d?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:d,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=d,e[6]=V):V=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,g=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==g?(p=U("p-0.5 rounded transition-colors",g),e[10]=g,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Hn,{size:14}),e[12]=x):x=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:x}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let h;return e[17]!==b||e[18]!==V||e[19]!==m?(h=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=h):h=e[20],h}function Vs(t){const e=$.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(va,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function ya(t){const e=$.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const g=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==g?(p=U("h-7 px-2.5 text-xs",g),e[3]=g,e[4]=p):p=e[4];let x;e[5]!==i||e[6]!==V||e[7]!==f||e[8]!==p?(x=s.jsx(re,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:V}),e[5]=i,e[6]=V,e[7]=f,e[8]=p,e[9]=x):x=e[9];const b=x;if(!m)return b;let h;e[10]!==b?(h=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=h):h=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==h||e[15]!==v?(y=s.jsxs(be,{children:[h,v]}),e[14]=h,e[15]=v,e[16]=y):y=e[16],y}function fs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function dn(t,e,n,r,o){if(t.length===0)return null;const a=fs(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const d=e(c);if(d!==o&&!r(n[d]))return d}return null}function Aa(t){return!t.isStreaming&&t.allAnswered}function ms(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,d=e[0]?n(e[0]):"",[u,V]=S.useState(d),[i,m]=S.useState(!1),f=Ys({resolver:Gs(r),defaultValues:o}),g=f.watch(),p=fs(e,n,u),x=p>=0?e[p]:void 0,b=l(g[u]),h=cn(e,n,g,l),v=Aa({isStreaming:a,allAnswered:h}),y=()=>{if(p>0){const k=e[p-1];k&&V(n(k))}},C=()=>{if(p>=0&&p<e.length-1){const k=e[p+1];k&&V(n(k))}},j=()=>{const k=f.getValues(),T=dn(e,n,k,l,u);T&&V(T)},A=()=>{f.handleSubmit(k=>{const T=k;for(const P of e)c(P,T[n(P)])})()},w=S.useRef(A);w.current=A;const N=()=>{v&&(m(!1),w.current())},D=()=>{const k=f.getValues();if(cn(e,n,k,l)){if(a){m(!0);return}m(!1),w.current()}else{const T=dn(e,n,k,l,u);T&&V(T)}};return S.useEffect(()=>{if(i&&!a){if(!h){m(!1);return}m(!1),w.current()}},[i,a,h]),{form:f,activeKey:u,setActiveKey:V,currentIndex:p,currentPart:x,isCurrentAnswered:b,isAllAnswered:h,canSubmit:v,goPrev:y,goNext:C,advanceToNextUnanswered:j,submit:N,submitOrAdvance:D}}const ps="User denied this tool call, give other alternatives.";function hs(t){const e=$.c(9),{onYolo:n}=t,[r,o]=Ee();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const i=V,m=r.toolApprovalLevel??"readonly";o({...r,toolApprovalLevel:i}),i==="auto"&&n(m)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(go,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:wa,children:s.jsx(bo,{})}),e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(po,{children:Pe.map(ja)}),e[5]=d):d=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(ho,{value:r.toolApprovalLevel,onValueChange:l,children:[c,d]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function ja(t){return s.jsx(xo,{value:t.value,children:t.label},t.value)}function wa(t){return t.stopPropagation()}function xs(t){const e=$.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.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:r})}),e[3]=r,e[4]=o):o=e[4],o}function Sa(t){const e=$.c(28),{approval:n,onRespond:r}=t,[o]=Ee(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ps,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(d=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=d):d=e[7];const u=d;let V;e[8]!==n.approvalId||e[9]!==r?(V=C=>r(n.approvalId,!0,void 0,C),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const i=V;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(hs,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let g;e[13]!==c?(g=s.jsx(re,{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:c,children:"Deny"}),e[13]=c,e[14]=g):g=e[14];let p;e[15]!==u?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=p):p=e[16];let x;e[17]!==g||e[18]!==p?(x=s.jsxs(s.Fragment,{children:[g,p]}),e[17]=g,e[18]=p,e[19]=x):x=e[19];const b=x;let h;e[20]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{size:14}),e[20]=h):h=e[20];let v;e[21]!==n.input?(v=s.jsx(xs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(y=s.jsx(fe,{icon:h,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=y):y=e[27],y}const Ca=Hs(Ie(),he({approved:Ws().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function Na(t){const e=$.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ee(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Ia)),e[0]=n,e[1]=c):c=e[1];const d=c;let u;e[2]!==l||e[3]!==o?(u=(D,k)=>{const T=k;typeof T?.approved=="boolean"&&o(D.approvalId,T.approved,T.approved===!1?ps:void 0,T.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==d||e[7]!==r||e[8]!==u?(V={parts:n,partKey:_a,schema:Ca,defaultValues:d,isStreaming:r,hasAnswer:ka,onSubmit:u},e[5]=n,e[6]=d,e[7]=r,e[8]=u,e[9]=V):V=e[9];const i=ms(V);let m;e[10]!==n||e[11]!==i?(m=D=>{i.form.reset(Object.fromEntries(n.map(k=>[k.approvalId,{approved:!0,levelOverride:D}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,g=i.currentPart;let p;e[13]!==i?(p=D=>{D.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(mt,{size:14}),e[15]=x):x=e[15];const b=`${n.length} approvals pending`,h=g?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(hs,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(y=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=y):y=e[23];let C;e[24]!==g||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(C=g?s.jsx(Ea,{approvalId:g.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=g,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=C):C=e[27];let j;e[28]!==g?(j=g?s.jsx(xs,{input:g.input}):null,e[28]=g,e[29]=j):j=e[29];let A;e[30]!==y||e[31]!==C||e[32]!==j||e[33]!==b||e[34]!==h?(A=s.jsx(fe,{icon:x,label:b,title:h,defaultExpanded:!0,footerLeft:y,footerRight:C,children:j}),e[30]=y,e[31]=C,e[32]=j,e[33]=b,e[34]=h,e[35]=A):A=e[35];let w;e[36]!==A||e[37]!==p?(w=s.jsx("form",{onSubmit:p,children:A}),e[36]=A,e[37]=p,e[38]=w):w=e[38];let N;return e[39]!==i.form||e[40]!==w?(N=s.jsx(_t,{...i.form,children:w}),e[39]=i.form,e[40]=w,e[41]=N):N=e[41],N}function ka(t){return typeof t?.approved=="boolean"}function _a(t){return t.approvalId}function Ia(t){return[t.approvalId,{approved:void 0}]}function Ea(t){const e=$.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=d=>{const{field:u}=d,V=u.value===!0,i=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Js,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function Ra(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(mt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ta(t){const e=$.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ra,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(Sa,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Na,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Da(t){const e=$.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(re,{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 d;e[5]!==l?(d=s.jsx(re,{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:l,children:"Let's go"}),e[5]=l,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];const V=u;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ro,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(jr,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(fe,{icon:i,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 Pa(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(qe,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ma(t){const e=$.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Pa,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let d;return e[3]!==c||e[4]!==o||e[5]!==a?(d=s.jsx(Da,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=d):d=e[6],d}function gs(t){return t?"response"in t?t.response:t.option??t.draft:""}const un=he({response:Ie().min(1,"Response is required")}),Fa=he({option:Ie().nullable(),draft:Ie()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),$a=he({response:Dt(["yes","no"])});function Oa(t){switch(t.type){case"text":return un;case"choice":return Fa;case"confirm":return $a;default:return un}}function La(t){const e={};for(const n of t)e[n.toolCallId]=Oa(n.input);return he(e)}function za(t){const e=$.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:d}=c,u=d.value??"";return s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...d,value:u,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"})]})})}),s.jsx(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Gn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function bs(t,e){const n=$.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const d=Number.parseInt(l.key,10);d>=1&&d<=t&&(l.preventDefault(),e(d-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),S.useEffect(r,o)}function Ba(t){const e=$.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Wt(l),d=`${r}.draft`;let u;e[3]!==n||e[4]!==d?(u={control:n,name:d,defaultValue:""},e[3]=n,e[4]=d,e[5]=u):u=e[5];const{field:V}=Wt(u),i=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=T=>{const P=o[T];P!=null&&c.onChange(P)},e[6]=c,e[7]=o,e[8]=f):f=e[8],bs(o.length,f),o.length===0)return null;const g=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let T;e[13]!==c||e[14]!==i?(T=(P,I)=>{const M=i===P;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(P),className:U("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",M&&"bg-accent/50",!M&&"hover:bg-accent/30"),"aria-label":`Select ${P}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",M?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:P})]},`${I}-${P}`)},e[13]=c,e[14]=i,e[15]=T):T=e[15],p=o.map(T),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const x=g&&"bg-accent/50",b=!g&&"hover:bg-accent/30";let h;e[16]!==x||e[17]!==b?(h=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[16]=x,e[17]=b,e[18]=h):h=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=g?m:"";let C;e[20]!==V||e[21]!==c||e[22]!==i?(C=T=>{V.onChange(T.target.value),i!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=i,e[23]=C):C=e[23];let j;e[24]!==c||e[25]!==i?(j=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=j):j=e[26];let A;e[27]!==y||e[28]!==C||e[29]!==j?(A=s.jsx("input",{type:"text",value:y,onChange:C,onFocus:j,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]=y,e[28]=C,e[29]=j,e[30]=A):A=e[30];let w;e[31]!==A||e[32]!==h?(w=s.jsxs("label",{className:h,children:[v,A]}),e[31]=A,e[32]=h,e[33]=w):w=e[33];let N;e[34]!==w||e[35]!==p?(N=s.jsx(Lt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,w]})}),e[34]=w,e[35]=p,e[36]=N):N=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(zt,{}),e[37]=D):D=e[37];let k;return e[38]!==N?(k=s.jsxs(Ot,{children:[N,D]}),e[38]=N,e[39]=k):k=e[39],k}function Ua(t){const e=$.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=S.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],bs(a.length,c);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=V=>{const{field:i}=V;return l.current=i,s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:U("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:[s.jsx("span",{className:U("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}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(zt,{})]})},e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Gn,{control:n,name:r,render:d}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function Vn(t){const e=$.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(za,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ba,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ua,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function qa(t){const e=$.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=La(n.map(Ga)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(Ya)),e[2]=n,e[3]=c):c=e[3];const d=c;let u;e[4]!==o?(u=(R,E)=>{const O=gs(E);O&&o(R,O)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==d||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:Qa,schema:l,defaultValues:d,isStreaming:r,hasAnswer:Ka,onSubmit:u},e[6]=d,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const i=ms(V),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const R=m;if(!R)return;const E=R.toolCallId;R.input?.type==="choice"?(i.form.setValue(`${E}.option`,null),i.form.setValue(`${E}.draft`,"user has skip this question")):i.form.setValue(`${E}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const g=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const x=p;let b;e[20]!==g?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:"Skip"}),e[20]=g,e[21]=b):b=e[21];let h;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(h=s.jsx(ya,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=h):h=e[26];let v;e[27]!==b||e[28]!==h?(v=s.jsxs(s.Fragment,{children:[b,h]}),e[27]=b,e[28]=h,e[29]=v):v=e[29];const y=v;if(n.length===1){const R=n[0];if(!R?.input)return null;let E;e[30]!==i?(E=z=>{z.preventDefault(),i.submit()},e[30]=i,e[31]=E):E=e[31];let O;e[32]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(It,{size:14}),e[32]=O):O=e[32];const B=R.input?.prompt??"Question",L=R.input;let q;e[33]!==i.form.control||e[34]!==R.toolCallId||e[35]!==L?(q=s.jsx(Vn,{input:L,control:i.form.control,toolCallId:R.toolCallId}),e[33]=i.form.control,e[34]=R.toolCallId,e[35]=L,e[36]=q):q=e[36];let K;e[37]!==y||e[38]!==B||e[39]!==q?(K=s.jsx(fe,{icon:O,label:"Question pending",title:B,defaultExpanded:!0,footerRight:y,children:q}),e[37]=y,e[38]=B,e[39]=q,e[40]=K):K=e[40];let Q;e[41]!==E||e[42]!==K?(Q=s.jsx("form",{onSubmit:E,autoComplete:"off",children:K}),e[41]=E,e[42]=K,e[43]=Q):Q=e[43];let F;return e[44]!==i.form||e[45]!==Q?(F=s.jsx(_t,{...i.form,children:Q}),e[44]=i.form,e[45]=Q,e[46]=F):F=e[46],F}const C=i.form;let j;e[47]!==i?(j=R=>{R.preventDefault(),i.submit()},e[47]=i,e[48]=j):j=e[48];let A;e[49]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(It,{size:14}),e[49]=A):A=e[49];const w=`${i.currentIndex+1} of ${n.length}`,N=m?.input?.prompt??"Question",D=i.activeKey,k=i.setActiveKey;let T;if(e[50]!==i.form||e[51]!==n){let R;e[53]!==i.form?(R=E=>s.jsx(Ao,{value:E.toolCallId,className:"mt-0",children:s.jsx(Vn,{input:E.input,control:i.form.control,toolCallId:E.toolCallId})},E.toolCallId),e[53]=i.form,e[54]=R):R=e[54],T=n.map(R),e[50]=i.form,e[51]=n,e[52]=T}else T=e[52];let P;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==T?(P=s.jsx(jo,{value:D,onValueChange:k,children:T}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=T,e[58]=P):P=e[58];let I;e[59]!==x||e[60]!==y||e[61]!==w||e[62]!==N||e[63]!==P?(I=s.jsx(fe,{icon:A,label:"Question pending",count:w,title:N,defaultExpanded:!0,footerLeft:x,footerRight:y,children:P}),e[59]=x,e[60]=y,e[61]=w,e[62]=N,e[63]=P,e[64]=I):I=e[64];let M;e[65]!==j||e[66]!==I?(M=s.jsx("form",{onSubmit:j,autoComplete:"off",children:I}),e[65]=j,e[66]=I,e[67]=M):M=e[67];let _;return e[68]!==i.form||e[69]!==M?(_=s.jsx(_t,{...C,children:M}),e[68]=i.form,e[69]=M,e[70]=_):_=e[70],_}function Ka(t){return!!gs(t)}function Qa(t){return t.toolCallId}function Ya(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Ga(t){return{toolCallId:t.toolCallId,input:t.input}}function Ha(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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:[s.jsx(It,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function vs(t){const e=$.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Wa),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ha,{}),e[2]=d):d=e[2],d}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(qa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Wa(t){return t.state==="input-available"}function Ja(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function Za(){const t=$.c(21),{messages:e}=Ue();let n,r,o,a,l,c,d,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=ls(e);if(f.length===0){V=null;break e}const g=Ja(f);n=fe,l=s.jsx(nl,{status:g.icon}),c=g.activity,d=g.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Xa)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=d,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==u||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:d,defaultExpanded:u,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=d,t[18]=u,t[19]=i,t[20]=m):m=t[20],m}function Xa(t,e){return s.jsx(el,{todo:t},e)}function el(t){const e=$.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(tl,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let d;e[2]!==c?(d=U("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=d):d=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==u||e[5]!==V?(i=s.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]=i):i=e[6];let m;e[7]!==a||e[8]!==d||e[9]!==i?(m=s.jsxs("span",{className:d,children:[a,i]}),e[7]=a,e[8]=d,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function tl(t){const e=$.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.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]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function nl(t){const e=$.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.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:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.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 r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.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]=r):r=e[2],r}const sl={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"}]},rl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function ys(t){const e=$.c(41),{onDismiss:n}=t,{org:r}=ce(),o=rt(),{decoKeyId:a}=Zn(),l=Xn(),[c,d]=S.useState(""),[u,V]=S.useState(!1),[i,m]=S.useState("usd"),f=i==="brl"?"R$":"$";let g,p;e[0]!==r.id?(g=()=>{W("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=g,e[2]=p):(g=e[1],p=e[2]),S.useEffect(g,p);let x;e[3]!==i||e[4]!==l?(x=async R=>{const{url:E}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:R,currency:i});return E},e[3]=i,e[4]=l,e[5]=x):x=e[5];let b;e[6]!==n?(b=R=>{R&&window.open(R,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let h;e[8]!==x||e[9]!==b?(h={mutationFn:x,onSuccess:b,onError:ll},e[8]=x,e[9]=b,e[10]=h):h=e[10];const{mutate:v,isPending:y}=Pt(h),C=parseFloat(c),j=!isNaN(C)&&C>=1;let A;e[11]!==n?(A=R=>!R&&n?.(),e[11]=n,e[12]=A):A=e[12];let w;e[13]===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[13]=w):w=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.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[14]=N):N=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,s.jsxs(lt,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx($t,{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[15]=D):D=e[15];let k;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==C||e[20]!==a||e[21]!==j||e[22]!==y||e[23]!==u||e[24]!==v?(k=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Wn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:R=>{R&&m(R)},children:[s.jsx(Xe,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Xe,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:sl[i].map(R=>{const{dollars:E,label:O}=R;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{W("credits_topup_clicked",{amount_cents:E*100,currency:i,tier_label:O,source:"exhausted_banner"}),v(E*100)},className:U("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:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,E]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:O})]},E)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Jn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:R=>d(R.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!j||y,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(C*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(C*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:rl.map(ol)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=C,e[20]=a,e[21]=j,e[22]=y,e[23]=u,e[24]=v,e[25]=k):k=e[25];let T;e[26]!==n?(T=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=T):T=e[27];let P;e[28]!==o||e[29]!==n||e[30]!==r.slug?(P=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=P):P=e[31];let I;e[32]!==T||e[33]!==P?(I=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[T,P]}),e[32]=T,e[33]=P,e[34]=I):I=e[34];let M;e[35]!==k||e[36]!==I?(M=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:al,children:[D,k,I]}),e[35]=k,e[36]=I,e[37]=M):M=e[37];let _;return e[38]!==M||e[39]!==A?(_=s.jsx(dt,{open:!0,onOpenChange:A,children:M}),e[38]=M,e[39]=A,e[40]=_):_=e[40],_}function ol(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(qe,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function al(t){return t.preventDefault()}function ll(t){le.error(`Top-up failed: ${t.message}`)}function il(){const t=$.c(5),e=ot(),n=es(),[r,o]=S.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(fe,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=d):d=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[d,s.jsx(No,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function cl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const d=c[1]?.trim().replace(/\.$/,"");return{summary:d?`Your sandbox didn't finish starting up (${d}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const dl={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 et(t){const e=$.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Yn:Rn,c=o?t.error.message:dl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let d;e[0]!==o||e[1]!==c?(d=o?cl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=d):d=e[2];const{summary:u,rawDetails:V}=d;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(Vl).catch(ul)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(mo,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let g;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(g=s.jsx(fe,{icon:i,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=g):g=e[18],g}function ul(){return le.error("Could not copy")}function Vl(){return le.success("Copied to clipboard")}function ht(){const t=$.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:d}=Ue(),[u,V]=Ee(),{virtualMcpId:i,createTaskWithMessage:m}=xr(),{chatMode:f,simpleModeTier:g}=me();let p;t[0]!==f||t[1]!==g||t[2]!==i?(p=Z=>({tier:g,mode:f,toolApprovalLevel:Z,agent:i?{id:i}:void 0}),t[0]=f,t[1]=g,t[2]=i,t[3]=p):p=t[3];const x=p;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??Zs(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const h=b,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],C=y.filter(hl),j=cs(y),A=is(y);let w;t[6]!==e||t[7]!==d?(w=()=>{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?`}]}]};d(oe)}},t[6]=e,t[7]=d,t[8]=w):w=t[8];const N=w;let D;t[9]!==d?(D=()=>{d({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=d,t[10]=D):D=t[10];const k=D;let T;t[11]!==x||t[12]!==h||t[13]!==c?(T=(Z,oe)=>{c({kind:"toolOutput",toolCallId:Z.toolCallId,output:{response:oe}},x(h))},t[11]=x,t[12]=h,t[13]=c,t[14]=T):T=t[14];const P=T;let I;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==i?(I=Z=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
2
2
 
3
3
  ${Z}`}]}})},t[15]=m,t[16]=u,t[17]=V,t[18]=i,t[19]=I):I=t[19];const M=I,_=pl;let R;t[20]!==x||t[21]!==c?(R=(Z,oe,se,H)=>{c({kind:"approval",approvalId:Z,approved:oe,...se?{reason:se}:{}},x(H))},t[20]=x,t[21]=c,t[22]=R):R=t[22];const E=R,O=ds();if(O.isCreditExhausted){let Z;return t[23]!==n?(Z=s.jsx(ys,{onDismiss:n}),t[23]=n,t[24]=Z):Z=t[24],Z}const{showError:B,showWarning:L,hasApprovals:q}=O,K=C.map(ml).join("|"),Q=j[0]?.toolCallId??"",F=A.map(fl).join("|");let z,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Za,{}),Y=s.jsx(il,{}),t[25]=z,t[26]=Y):(z=t[25],Y=t[26]);let G;t[27]!==n||t[28]!==e||t[29]!==N||t[30]!==B?(G=B&&s.jsx(et,{variant:"error",error:e,onDismiss:n,onFixInChat:N}),t[27]=n,t[28]=e,t[29]=N,t[30]=B,t[31]=G):G=t[31];let J;t[32]!==o||t[33]!==r||t[34]!==k||t[35]!==L?(J=L&&s.jsx(et,{variant:"warning",finishReason:r,onDismiss:o,onContinue:k}),t[32]=o,t[33]=r,t[34]=k,t[35]=L,t[36]=J):J=t[36];let ee;t[37]!==F||t[38]!==E||t[39]!==q||t[40]!==l||t[41]!==A?(ee=q&&s.jsx(Ta,{approvals:A,isStreaming:l,onRespond:E},F),t[37]=F,t[38]=E,t[39]=q,t[40]=l,t[41]=A,t[42]=ee):ee=t[42];let te;t[43]!==O.hasPlans||t[44]!==M||t[45]!==_||t[46]!==l||t[47]!==j||t[48]!==Q?(te=O.hasPlans&&s.jsx(Ma,{plans:j,isStreaming:l,onApprove:M,onDismiss:_},Q),t[43]=O.hasPlans,t[44]=M,t[45]=_,t[46]=l,t[47]=j,t[48]=Q,t[49]=te):te=t[49];let ne;t[50]!==O.isWaitingForUserInput||t[51]!==P||t[52]!==l||t[53]!==K||t[54]!==C?(ne=O.isWaitingForUserInput&&s.jsx(vs,{userAskParts:C,isStreaming:l,onSubmit:P},K),t[50]=O.isWaitingForUserInput,t[51]=P,t[52]=l,t[53]=K,t[54]=C,t[55]=ne):ne=t[55];let X;return t[56]!==J||t[57]!==ee||t[58]!==te||t[59]!==ne||t[60]!==G?(X=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[z,Y,G,J,ee,te,ne]}),t[56]=J,t[57]=ee,t[58]=te,t[59]=ne,t[60]=G,t[61]=X):X=t[61],X}function fl(t){return t.approvalId}function ml(t){return t.toolCallId}function pl(){document.querySelector("[data-chat-input]")?.focus()}function hl(t){return t.type==="tool-user_ask"}ht.Error=function(e){return s.jsx(et,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};ht.Warning=function(e){return s.jsx(et,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};ht.UserAskQuestion=vs;async function xl(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const As=["SANDBOX_START"],Qe=new Map,gl=t=>`${t.virtualMcpId}::${t.branch??""}`,yt=new Set,bl={mark:(t,e)=>yt.add(`${t}::${e}`),clear:(t,e)=>yt.delete(`${t}::${e}`),isStopped:(t,e)=>yt.has(`${t}::${e}`)};function vl(t){const e=Be();return Pt({mutationKey:As,mutationFn:async n=>{n.branch&&bl.clear(n.virtualMcpId,n.branch);const r=gl(n),o=Qe.get(r);if(o)return o;const a=(async()=>(await xl(t,"SANDBOX_START",n)).structuredContent)();Qe.set(r,a);try{return await a}finally{Qe.get(r)===a&&Qe.delete(r)}},onSuccess:()=>{Xs(e)}})}function iu(t,e){const n=$.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:As,predicate:a=>{if(!t)return!1;const l=a.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],Qo(r)>0}function yl(){const t=$.c(11),e=es(),n=er();let r;t[0]!==e.capabilities||t[1]!==e.online?(r=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=r):r=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==n.runtime.agentSandbox||t[8]!==r||t[9]!==o?(a={agentSandbox:n.runtime.agentSandbox,userDesktop:e.online,claudeCode:r,codex:o},t[6]=e.online,t[7]=n.runtime.agentSandbox,t[8]=r,t[9]=o,t[10]=a):a=t[10],a}const Al={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},jl={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function wl(t){return t==="claude-code"?Al:t==="codex"?jl:null}function fn(t,e){return wl(t)?.[e]??null}const Sl={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},Cl={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function Nl(t){return Sl[t]}function js(t){return t===null?"cloud-decopilot":Cl[t]}function ws(){const t=$.c(2),{pendingAgentOption:e}=me();let n;return t[0]!==e?(n=js(e),t[0]=e,t[1]=n):n=t[1],n}function kl(){const t=$.c(2),{setPendingAgentOption:e}=me();let n;return t[0]!==e?(n=r=>e(Nl(r)),t[0]=e,t[1]=n):n=t[1],n}function _l(){return me().simpleModeTier}function Il(){return me().setSimpleModeTier}const El={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function Rl(t,e){return t==="local-claude-code"?fn("claude-code",e)?.label??null:t==="local-codex"?fn("codex",e)?.label??null:El[e]}const Tl={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},Dl=ut("").icon;function tt(t){const e=$.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=U(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(qn,{icon:Dl,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const Pl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(tt,{}),isAvailable:t=>t.agentSandbox},Ml={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(tt,{}),isAvailable:t=>t.userDesktop},Fl={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(ts,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},$l={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(ns,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},mn=[Pl,Ml,Fl,$l];function Ol(t,e){return t==="claude-code"?"local-claude-code":t==="codex"?"local-codex":e==="user-desktop"?"local-decopilot":"cloud-decopilot"}function Ll({selectedMode:t,lockedHarness:e,lockedSandbox:n,isThreadLocked:r}){if(r&&e!=null){const o=gr(e,n);return o?js(o):Ol(e,n)}return t}function Ss(t){return t==="local-decopilot"?{icon:s.jsx(tt,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(ts,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(ns,{size:14}),text:"Codex"}:{icon:s.jsx(tt,{compact:!0}),text:"Decopilot"}}function zl(t){const{text:e}=Ss(t);return{icon:t==="cloud-decopilot"?s.jsx(oo,{size:14}):s.jsx(Bt,{size:14}),text:e}}function At(t){return t==="cloud-decopilot"?"cloud":"desktop"}const Bl="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Ul="text-success hover:text-success";function ql(t){const e=$.c(91),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l}=t,[c,d]=S.useState(!1);let u;e[0]!==o||e[1]!==n?(u=o?Ss(n):zl(n),e[0]=o,e[1]=n,e[2]=u):u=e[2];const{icon:V,text:i}=u;let m;e[3]!==n?(m=At(n),e[3]=n,e[4]=m):m=e[4];const f=`${i} on ${m}`,g=n!=="cloud-decopilot",p=a!=null,x=a?Tl[a]:null;let b,h,v,y,C,j,A,w,N,D,k,T,P;if(e[5]!==r||e[6]!==x||e[7]!==V||e[8]!==g||e[9]!==f||e[10]!==o||e[11]!==n||e[12]!==l||e[13]!==c||e[14]!==p||e[15]!==i){let R;e[29]!==r?(R=se=>se.group==="cloud"&&se.isAvailable(r),e[29]=r,e[30]=R):R=e[30];const E=mn.filter(R),O=mn.filter(Kl);let B;e[31]!==l?(B=se=>{l(se),d(!1)},e[31]=l,e[32]=B):B=e[32];const L=B;h=Ut,y=c,C=o?void 0:d;let q;e[33]!==x||e[34]!==f||e[35]!==n||e[36]!==p?(q=p&&x?`This chat is using ${x} on ${At(n)}. Start a new chat to use a different runtime.`:f,e[33]=x,e[34]=f,e[35]=n,e[36]=p,e[37]=q):q=e[37];const K=o?"mode-picker-locked":"mode-picker",Q=g&&Ul,F=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let z;e[38]!==Q||e[39]!==F?(z=U(Bl,Q,"shrink min-w-0",F),e[38]=Q,e[39]=F,e[40]=z):z=e[40];const Y=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let G;e[41]!==Y?(G=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",Y),e[41]=Y,e[42]=G):G=e[42];let J;e[43]!==G||e[44]!==i?(J=s.jsx("span",{className:G,children:i}),e[43]=G,e[44]=i,e[45]=J):J=e[45];let ee;e[46]!==o?(ee=!o&&s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[46]=o,e[47]=ee):ee=e[47];let te;e[48]!==V||e[49]!==o||e[50]!==q||e[51]!==K||e[52]!==z||e[53]!==J||e[54]!==ee?(te=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":q,disabled:o,"data-testid":K,className:z,children:[V,J,ee]})})})}),e[48]=V,e[49]=o,e[50]=q,e[51]=K,e[52]=z,e[53]=J,e[54]=ee,e[55]=te):te=e[55];let ne;e[56]!==x||e[57]!==f||e[58]!==n||e[59]!==p?(ne=p&&x?`This chat is using ${x} on ${At(n)}. Start a new chat to use a different runtime.`:f,e[56]=x,e[57]=f,e[58]=n,e[59]=p,e[60]=ne):ne=e[60];let X;e[61]!==ne?(X=s.jsx(ge,{children:ne}),e[61]=ne,e[62]=X):X=e[62],e[63]!==te||e[64]!==X?(j=s.jsxs(be,{children:[te,X]}),e[63]=te,e[64]=X,e[65]=j):j=e[65],b=Kt,P="start",v="p-1 w-64",A="menu",w="flex flex-col",N=E.length>0&&s.jsx(pn,{title:"Cloud"});let Z;e[66]!==L||e[67]!==n?(Z=se=>s.jsx(hn,{row:se,active:n===se.mode,onSelect:L},se.mode),e[66]=L,e[67]=n,e[68]=Z):Z=e[68],D=E.map(Z),k=O.length>0&&s.jsx(pn,{title:"Local",variant:"success",icon:s.jsx(Bt,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let oe;e[69]!==r||e[70]!==L||e[71]!==n?(oe=se=>{const H=se.isAvailable(r);return s.jsx(hn,{row:se,active:n===se.mode,onSelect:L,unavailableHint:H?void 0:r.userDesktop?"Not detected on your desktop":"Desktop not detected"},se.mode)},e[69]=r,e[70]=L,e[71]=n,e[72]=oe):oe=e[72],T=O.map(oe),e[5]=r,e[6]=x,e[7]=V,e[8]=g,e[9]=f,e[10]=o,e[11]=n,e[12]=l,e[13]=c,e[14]=p,e[15]=i,e[16]=b,e[17]=h,e[18]=v,e[19]=y,e[20]=C,e[21]=j,e[22]=A,e[23]=w,e[24]=N,e[25]=D,e[26]=k,e[27]=T,e[28]=P}else b=e[16],h=e[17],v=e[18],y=e[19],C=e[20],j=e[21],A=e[22],w=e[23],N=e[24],D=e[25],k=e[26],T=e[27],P=e[28];let I;e[73]!==A||e[74]!==w||e[75]!==N||e[76]!==D||e[77]!==k||e[78]!==T?(I=s.jsxs("div",{role:A,className:w,children:[N,D,k,T]}),e[73]=A,e[74]=w,e[75]=N,e[76]=D,e[77]=k,e[78]=T,e[79]=I):I=e[79];let M;e[80]!==b||e[81]!==v||e[82]!==I||e[83]!==P?(M=s.jsx(b,{align:P,className:v,children:I}),e[80]=b,e[81]=v,e[82]=I,e[83]=P,e[84]=M):M=e[84];let _;return e[85]!==h||e[86]!==y||e[87]!==C||e[88]!==j||e[89]!==M?(_=s.jsxs(h,{open:y,onOpenChange:C,children:[j,M]}),e[85]=h,e[86]=y,e[87]=C,e[88]=j,e[89]=M,e[90]=_):_=e[90],_}function Kl(t){return t.group==="local"}function pn(t){const e=$.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let d;e[0]!==c?(d=U("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==n?(u=s.jsx("span",{children:n}),e[2]=n,e[3]=u):u=e[3];let V;return e[4]!==o||e[5]!==d||e[6]!==u||e[7]!==a?(V=s.jsxs("div",{"data-testid":a,className:d,children:[o,u]}),e[4]=o,e[5]=d,e[6]=u,e[7]=a,e[8]=V):V=e[8],V}function hn(t){const e=$.c(20),{row:n,active:r,onSelect:o,unavailableHint:a}=t;let l;e[0]!==o||e[1]!==n.mode?(l=()=>o(n.mode),e[0]=o,e[1]=n.mode,e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),e[3]=c):c=e[3];let d;e[4]!==n.icon?(d=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[4]=n.icon,e[5]=d):d=e[5];let u;e[6]!==n.label?(u=s.jsx("div",{className:"text-sm",children:n.label}),e[6]=n.label,e[7]=u):u=e[7];const V=a??n.description;let i;e[8]!==V?(i=s.jsx("div",{className:"text-xs text-muted-foreground",children:V}),e[8]=V,e[9]=i):i=e[9];let m;e[10]!==u||e[11]!==i?(m=s.jsxs("div",{className:"flex-1",children:[u,i]}),e[10]=u,e[11]=i,e[12]=m):m=e[12];let f;e[13]!==r?(f=r&&s.jsx(qe,{size:14,className:"text-foreground mt-0.5"}),e[13]=r,e[14]=f):f=e[14];let g;return e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==f?(g=s.jsxs("button",{type:"button",role:"menuitem",onClick:l,className:c,children:[d,m,f]}),e[15]=l,e[16]=d,e[17]=m,e[18]=f,e[19]=g):g=e[19],g}function Ql(t){const e=$.c(19),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=ws(),l=kl(),{org:c}=ce();let d;e[0]!==c.id||e[1]!==c.slug?(d={connectionId:Qr,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=d):d=e[2];const u=Re(d),V=vl(u),i=ot(),m=i?.lockedHarness??null,f=i?.lockedSandbox??null,g=i?.isThreadLocked??!1,p=yl();let x;e[3]!==g||e[4]!==m||e[5]!==f||e[6]!==a?(x=Ll({selectedMode:a,lockedHarness:m,lockedSandbox:f,isThreadLocked:g}),e[3]=g,e[4]=m,e[5]=f,e[6]=a,e[7]=x):x=e[7];const b=x;let h;e[8]!==r||e[9]!==l||e[10]!==V||e[11]!==o?(h=C=>{l(C),W("agent_mode_selected",{mode:C}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:C==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[8]=r,e[9]=l,e[10]=V,e[11]=o,e[12]=h):h=e[12];const v=h;let y;return e[13]!==p||e[14]!==v||e[15]!==n||e[16]!==m||e[17]!==b?(y=s.jsx(s.Fragment,{children:s.jsx(ql,{mode:b,availability:p,locked:n,lockedHarness:m,onSelect:v})}),e[13]=p,e[14]=v,e[15]=n,e[16]=m,e[17]=b,e[18]=y):y=e[18],y}const xn=["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega"],gn=["andromedae","antliae","apodis","aquarii","aquilae","arae","arietis","aurigae","bootis","caeli","camelopardalis","cancri","capricorni","carinae","cassiopeiae","centauri","cephei","ceti","chamaeleontis","circini","columbae","corvi","crateris","crucis","cygni","delphini","doradus","draconis","equulei","eridani","fornacis","geminorum","gruis","herculis","horologii","hydrae","hydri","indi","lacertae","leonis","leporis","librae","lupi","lyncis","lyrae","mensae","microscopii","monocerotis","muscae","normae","octantis","ophiuchi","orionis","pavonis","pegasi","persei","phoenicis","pictoris","piscium","puppis","pyxidis","reticuli","sagittae","sagittarii","scorpii","sculptoris","scuti","serpentis","sextantis","tauri","telescopii","trianguli","tucanae","velorum","virginis","volantis","vulpeculae"];function Yl(){const t=xn[Math.floor(Math.random()*xn.length)],e=gn[Math.floor(Math.random()*gn.length)];return`${t}-${e}`}const He=100;function Gl(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function Hl(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function Wl(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function Jl(t){const e=$.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:l,owner:c,repo:d,enabled:u}=t,V=u===void 0?!0:u,i=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==i?(m={connectionId:i,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=i,e[3]=m):m=e[3];const f=Re(m);let g;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==d?(g=tr.githubBranches(n,r,a,c,d),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=d,e[9]=g):g=e[9];const p=V&&!!a&&!!c&&!!d;let x;e[10]!==f||e[11]!==c||e[12]!==d?(x=async L=>{const{pageParam:q,signal:K}=L,Q=Number(q),F=await f.callTool({name:"list_branches",arguments:{owner:c,repo:d,page:Q,perPage:He}},void 0,{signal:K}),z=Wl(F);return{branches:Array.isArray(z)?z:z.branches??[],default_branch:Array.isArray(z)?null:z.default_branch??null,page:Q}},e[10]=f,e[11]=c,e[12]=d,e[13]=x):x=e[13];let b;e[14]!==g||e[15]!==p||e[16]!==x?(b={queryKey:g,enabled:p,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:x,getNextPageParam:si},e[14]=g,e[15]=p,e[16]=x,e[17]=b):b=e[17];const{data:h,isLoading:v,isError:y,hasNextPage:C,isFetchingNextPage:j,fetchNextPage:A}=Mo(b);let w,N;e[18]!==l||e[19]!==o?(N=new Set(Object.keys(l?.[o]??{})),w=[...N].sort().map(ni),e[18]=l,e[19]=o,e[20]=w,e[21]=N):(w=e[20],N=e[21]);const D=w;let k;if(e[22]!==h?.pages){const L=new Map;for(const K of h?.pages??[])for(const Q of K.branches)typeof Q.name=="string"&&L.set(Q.name,Q);k=[...L.values()].filter(ti),e[22]=h?.pages,e[23]=k}else k=e[23];let T;e[24]!==k||e[25]!==N?(T=k.filter(L=>!N.has(L.name)).map(ei),e[24]=k,e[25]=N,e[26]=T):T=e[26];const P=T;let I;e[27]!==h?.pages?(I=h?.pages.find(Xl)?.default_branch??null,e[27]=h?.pages,e[28]=I):I=e[28];const M=I;let _;e[29]!==h?.pages||e[30]!==A||e[31]!==j||e[32]!==N?(_=async(L,q)=>{const K=q===void 0?Zl:q;if(!K()||Hl(N,L)||j)return;let Q=h?.pages??[];for(;K()&&!Gl(Q,L,N)&&(Q.at(-1)?.branches.length??He)>=He;){const F=await A();if(!K())break;const z=F.data?.pages??Q;if(z.length===Q.length)break;Q=z}},e[29]=h?.pages,e[30]=A,e[31]=j,e[32]=N,e[33]=_):_=e[33];const R=_,E=C??!1;let O;e[34]!==A||e[35]!==C||e[36]!==j?(O=()=>{C&&!j&&A()},e[34]=A,e[35]=C,e[36]=j,e[37]=O):O=e[37];let B;return e[38]!==M||e[39]!==R||e[40]!==y||e[41]!==j||e[42]!==v||e[43]!==P||e[44]!==E||e[45]!==O||e[46]!==D?(B={yours:D,others:P,defaultBase:M,isLoading:v,isError:y,hasMore:E,isFetchingMore:j,fetchMore:O,fetchUntilMatch:R},e[38]=M,e[39]=R,e[40]=y,e[41]=j,e[42]=v,e[43]=P,e[44]=E,e[45]=O,e[46]=D,e[47]=B):B=e[47],B}function Zl(){return!0}function Xl(t){return t.default_branch}function ei(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function ti(t){return typeof t.name=="string"}function ni(t){return{name:t,source:"yours"}}function si(t){if(!(t.branches.length<He))return t.page+1}function ri(t){const e=$.c(84),{orgId:n,orgSlug:r,userId:o,connectionId:a,owner:l,repo:c,sandboxMap:d,value:u,onChange:V,disabled:i,placement:m}=t,f=i===void 0?!1:i,p=(m===void 0?"chat":m)==="header",[x,b]=S.useState(!1),[h,v]=S.useState(""),[y,C]=S.useState(!1),j=S.useRef(0);let A;e[0]!==a||e[1]!==x||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==o?(A={orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:d,owner:l,repo:c,enabled:x},e[0]=a,e[1]=x,e[2]=n,e[3]=r,e[4]=l,e[5]=c,e[6]=d,e[7]=o,e[8]=A):A=e[8];const{yours:w,others:N,isLoading:D,isError:k,hasMore:T,isFetchingMore:P,fetchMore:I,fetchUntilMatch:M}=Jl(A);let _;e[9]!==V?(_=ae=>{V(ae),b(!1)},e[9]=V,e[10]=_):_=e[10];const R=_,E=u??"Select branch…";let O;e[11]!==M?(O=ae=>{v(ae),j.current=j.current+1;const Ne=j.current,xt=ae.trim();if(!xt){C(!1);return}C(!0),M(xt,()=>Ne===j.current).finally(()=>{Ne===j.current&&C(!1)})},e[11]=M,e[12]=O):O=e[12];const B=O;let L;e[13]!==I?(L=ae=>{const Ne=ae.currentTarget;Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight<48&&I()},e[13]=I,e[14]=L):L=e[14];const q=L,K=f?void 0:b,Q=p?"outline":"ghost",F=p?"sm":"default";let z;e[15]!==f||e[16]!==p?(z=U("font-mono shrink min-w-0 max-w-[200px]",p?"gap-1.5 text-xs":U("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",f?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=f,e[16]=p,e[17]=z):z=e[17];let Y;e[18]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(Ge,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=Y):Y=e[18];const G=p?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let J;e[19]!==G?(J=U("min-w-0 truncate",G),e[19]=G,e[20]=J):J=e[20];let ee;e[21]!==E||e[22]!==J?(ee=s.jsx("span",{className:J,children:E}),e[21]=E,e[22]=J,e[23]=ee):ee=e[23];let te;e[24]!==f||e[25]!==p?(te=!f&&s.jsx(ft,{size:12,className:U("opacity-60 shrink-0",p?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=f,e[25]=p,e[26]=te):te=e[26];let ne;e[27]!==f||e[28]!==E||e[29]!==z||e[30]!==ee||e[31]!==te||e[32]!==Q||e[33]!==F?(ne=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{variant:Q,size:F,"aria-label":E,disabled:f,className:z,children:[Y,ee,te]})})})}),e[27]=f,e[28]=E,e[29]=z,e[30]=ee,e[31]=te,e[32]=Q,e[33]=F,e[34]=ne):ne=e[34];let X;e[35]!==E?(X=s.jsx(ge,{children:E}),e[35]=E,e[36]=X):X=e[36];let Z;e[37]!==ne||e[38]!==X?(Z=s.jsxs(be,{children:[ne,X]}),e[37]=ne,e[38]=X,e[39]=Z):Z=e[39];let oe;e[40]!==B||e[41]!==h?(oe=s.jsx(Ro,{placeholder:"Search loaded branches…",value:h,onValueChange:B}),e[40]=B,e[41]=h,e[42]=oe):oe=e[42];let se;e[43]!==R?(se=s.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>R(Yl()),children:"New"}),e[43]=R,e[44]=se):se=e[44];let H;e[45]!==oe||e[46]!==se?(H=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[oe,se]}),e[45]=oe,e[46]=se,e[47]=H):H=e[47];let ie;e[48]!==k?(ie=k&&s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[48]=k,e[49]=ie):ie=e[49];let ve;e[50]!==T||e[51]!==k||e[52]!==D?(ve=!k&&!D&&s.jsx(To,{children:T?"Looking through more branches...":"No branches found."}),e[50]=T,e[51]=k,e[52]=D,e[53]=ve):ve=e[53];let ye;e[54]!==R||e[55]!==w?(ye=w.length>0&&s.jsx(Xt,{heading:"Your branches",children:w.map(ae=>s.jsxs(en,{value:ae.name,onSelect:()=>R(ae.name),children:[s.jsx(Ge,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name})]},ae.name))}),e[54]=R,e[55]=w,e[56]=ye):ye=e[56];let Ae;e[57]!==N||e[58]!==R?(Ae=N.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Eo,{}),s.jsx(Xt,{heading:"Other branches in repo",children:N.map(ae=>s.jsxs(en,{value:ae.name,onSelect:()=>R(ae.name),children:[s.jsx(Ge,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name}),ae.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",ae.author]})]},ae.name))})]}),e[57]=N,e[58]=R,e[59]=Ae):Ae=e[59];let je;e[60]!==I||e[61]!==T||e[62]!==P||e[63]!==y?(je=T&&s.jsx("div",{className:"border-t p-2",children:s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:P,onClick:I,children:P||y?"Loading more…":"Load more branches"})}),e[60]=I,e[61]=T,e[62]=P,e[63]=y,e[64]=je):je=e[64];let we;e[65]!==T||e[66]!==N.length?(we=!T&&N.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[65]=T,e[66]=N.length,e[67]=we):we=e[67];let Se;e[68]!==q||e[69]!==ie||e[70]!==ve||e[71]!==ye||e[72]!==Ae||e[73]!==je||e[74]!==we?(Se=s.jsxs(Do,{onScroll:q,children:[ie,ve,ye,Ae,je,we]}),e[68]=q,e[69]=ie,e[70]=ve,e[71]=ye,e[72]=Ae,e[73]=je,e[74]=we,e[75]=Se):Se=e[75];let Ce;e[76]!==H||e[77]!==Se?(Ce=s.jsx(Kt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(Po,{children:[H,Se]})}),e[76]=H,e[77]=Se,e[78]=Ce):Ce=e[78];let Ke;return e[79]!==x||e[80]!==Z||e[81]!==Ce||e[82]!==K?(Ke=s.jsxs(Ut,{open:x,onOpenChange:K,children:[Z,Ce]}),e[79]=x,e[80]=Z,e[81]=Ce,e[82]=K,e[83]=Ke):Ke=e[83],Ke}function oi(t){const e=$.c(25);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const l=r==="header";if(n){const d=a??"(no branch)",u=l?"h-8 gap-1.5 border border-input bg-background px-2.5":"h-9 gap-0 px-2";let V;e[5]!==u?(V=U("inline-flex items-center rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",u),e[5]=u,e[6]=V):V=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ge,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=i):i=e[7];const m=l?"":"max-w-0 opacity-0";let f;e[8]!==m?(f=U("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let g;e[10]!==d||e[11]!==f?(g=s.jsx("span",{className:f,children:d}),e[10]=d,e[11]=f,e[12]=g):g=e[12];let p;e[13]!==V||e[14]!==g?(p=s.jsx(xe,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:V,children:[i,g]})}),e[13]=V,e[14]=g,e[15]=p):p=e[15];let x;e[16]!==d?(x=s.jsxs(ge,{children:["This chat is using branch ",d,". Start a new chat to use a different branch."]}),e[16]=d,e[17]=x):x=e[17];let b;return e[18]!==p||e[19]!==x?(b=s.jsxs(be,{children:[p,x]}),e[18]=p,e[19]=x,e[20]=b):b=e[20],b}let c;return e[21]!==r||e[22]!==o||e[23]!==a?(c=s.jsx(ri,{...o,value:a,placement:r}),e[21]=r,e[22]=o,e[23]=a,e[24]=c):c=e[24],c}function ai(t){const e=$.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function li(t){const e=$.c(22),{virtualMcp:n,currentBranch:r}=t,o=Fn(),a=ot();let l;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(l=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=l):l=e[2];const c=l,d=a?.setCurrentTaskBranch;let u;e[3]!==n?(u=wo(n),e[3]=n,e[4]=u):u=e[4];const V=u,i=V?.connectionId,{data:m}=Tn.useSession(),f=m?.user?.id??"",{org:g}=ce();let p;e[5]!==i||e[6]!==r||e[7]!==V||e[8]!==c||e[9]!==g||e[10]!==d||e[11]!==f||e[12]!==n?.id||e[13]!==n?.metadata?.sandboxMap?(p=V&&i?s.jsx(oi,{orgId:g.id,orgSlug:g.slug,userId:f,virtualMcpId:n?.id??"",connectionId:i,owner:V.owner,repo:V.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:C=>{d&&d(C)},locked:c,placement:"chat"}):null,e[5]=i,e[6]=r,e[7]=V,e[8]=c,e[9]=g,e[10]=d,e[11]=f,e[12]=n?.id,e[13]=n?.metadata?.sandboxMap,e[14]=p):p=e[14];const x=p,b=n?.id??"";let h;e[15]!==r||e[16]!==c||e[17]!==b?(h=s.jsx(Ql,{locked:c,currentBranch:r,virtualMcpId:b}),e[15]=r,e[16]=c,e[17]=b,e[18]=h):h=e[18];const v=h;let y;return e[19]!==x||e[20]!==v?(y=s.jsx(ai,{branchPill:x,modePicker:v}),e[19]=x,e[20]=v,e[21]=y):y=e[21],y}const ii=["fast","smart","thinking"],Te={fast:"Fast",smart:"Smart",thinking:"Thinking"};function ci(t){const e=$.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[l,c]=S.useState(!1);let d;e[0]!==a?(d=w=>{a(w),c(!1)},e[0]=a,e[1]=d):d=e[1];const u=d,V=Te[n];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=i):i=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const g=Te[n];let p;e[7]!==g?(p=s.jsx("span",{className:f,children:g}),e[7]=g,e[8]=p):p=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=x):x=e[9];let b;e[10]!==V||e[11]!==m||e[12]!==p?(b=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":V,className:i,children:[m,p,x]})})})}),e[10]=V,e[11]=m,e[12]=p,e[13]=b):b=e[13];const h=Te[n];let v;e[14]!==h?(v=s.jsx(ge,{children:h}),e[14]=h,e[15]=v):v=e[15];let y;e[16]!==v||e[17]!==b?(y=s.jsxs(be,{children:[b,v]}),e[16]=v,e[17]=b,e[18]=y):y=e[18];let C;e[19]!==u||e[20]!==o||e[21]!==r||e[22]!==n?(C=ii.map(w=>{const N=r(w),D=o?.(w),k=w===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Te[w],onClick:()=>u(w),className:U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[D&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:D}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:Te[w]}),N&&s.jsx("div",{className:"text-xs text-muted-foreground",children:N})]}),k&&s.jsx(qe,{size:14,className:"text-foreground mt-0.5"})]},w)}),e[19]=u,e[20]=o,e[21]=r,e[22]=n,e[23]=C):C=e[23];let j;e[24]!==C?(j=s.jsx(Kt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:C})}),e[24]=C,e[25]=j):j=e[25];let A;return e[26]!==l||e[27]!==y||e[28]!==j?(A=s.jsxs(Ut,{open:l,onOpenChange:c,children:[y,j]}),e[26]=l,e[27]=y,e[28]=j,e[29]=A):A=e[29],A}function di(t){return t==="fast"?s.jsx(ao,{size:16}):t==="thinking"?s.jsx(lo,{size:16}):s.jsx(Fo,{size:16})}function ui(){const t=$.c(6),e=_l(),n=Il(),r=ws();let o;t[0]!==r?(o=c=>Rl(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let l;return t[2]!==n||t[3]!==a||t[4]!==e?(l=s.jsx(ci,{tier:e,subtitleFor:a,iconFor:di,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Yt(t,e,n,r,o){if(!pt(e)){le.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!ko(a,e)){const c=ss(e),d=e?.title??"This model";o?o({fileName:n.name,modelName:d,accepted:c}):le.error(`"${n.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const l=10*1024*1024;if(n.size>l){le.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((i,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const g=f.includes(",")?f.split(",")[1]??f:f;i(g)},c.onerror=m});c.readAsDataURL(n);const u=await d,V={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:u};wr(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),le.error(`Failed to load file "${n.name}"`)}}function Vi(t){const e=$.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=S.useRef(mi);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(V,i)=>{await Yt(n,r,V,i,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=l,e[4]=c):(l=e[3],c=e[4]),S.useEffect(l,c);let d,u;return e[5]!==n?(d=()=>{if(n?.isDestroyed)return;const V=new Ze("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new On({key:V,props:{handleDrop:(f,g,p,x)=>{if(x)return!1;const b=g.dataTransfer?.files;if(!b||b.length===0)return!1;g.preventDefault();const h=f.posAtCoords({left:g.clientX,top:g.clientY});if(!h)return!1;const v=Array.from(b),y=h.pos;for(const C of v)a.current?.(C,y);return!0},handlePaste:(f,g)=>{const p=g.clipboardData?.items;if(!p)return!1;const x=Array.from(p).filter(fi);if(x.length===0)return!1;g.preventDefault();const{from:b}=f.state.selection;for(const h of x){const v=h.getAsFile();v&&a.current?.(v,b)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(V)}},u=[n],e[5]=n,e[6]=d,e[7]=u):(d=e[6],u=e[7]),S.useEffect(d,u),null}function fi(t){return t.kind==="file"}function mi(){return Promise.resolve()}function pi(t){const e=$.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=C=>!C&&r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["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]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.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 d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(Rn,{size:18})}),u=s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]);const V=n?.fileName;let i;e[6]!==V?(i=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(lt,{className:"relative gap-4",children:[d,s.jsxs("div",{children:[u,s.jsxs($t,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=i):i=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.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 g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(io,{size:14,className:"text-muted-foreground"}),e[10]=g):g=e[10];const p=n?.accepted;let x;e[11]!==p?(x=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[g,s.jsx("span",{className:"capitalize",children:p})]}),e[11]=p,e[12]=x):x=e[12];let b;e[13]!==f||e[14]!==x?(b=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,x]})}),e[13]=f,e[14]=x,e[15]=b):b=e[15];let h;e[16]!==r?(h=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(re,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=h):h=e[17];let v;e[18]!==b||e[19]!==h||e[20]!==i?(v=s.jsxs(ct,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:hi,children:[i,b,h]}),e[18]=b,e[19]=h,e[20]=i,e[21]=v):v=e[21];let y;return e[22]!==o||e[23]!==v||e[24]!==a?(y=s.jsx(dt,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=y):y=e[25],y}function hi(t){return t.preventDefault()}function xi(){const t=$.c(3),[e,n]=S.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var gi=Sr;var bi=["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] *)"],Et=bi.join(","),Cs=typeof Element>"u",Le=Cs?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nt=!Cs&&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},st=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",l=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):st(e.parentNode));return l},vi=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},yi=function(e,n,r){if(st(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Et));return n&&Le.call(e,Et)&&o.unshift(e),o=o.filter(r),o},Rt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!st(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),d=c.length?c:l.children,u=Rt(d,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{var V=Le.call(l,Et);V&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var i=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!st(i,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(i&&m){var f=Rt(i===!0?l.children:i.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else a.unshift.apply(a,l.children)}}return o},Ns=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ks=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||vi(e))&&!Ns(e)?0:e.tabIndex},Ai=function(e,n){var r=ks(e);return r<0&&n&&!Ns(e)?0:r},ji=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},_s=function(e){return e.tagName==="INPUT"},wi=function(e){return _s(e)&&e.type==="hidden"},Si=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Ci=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},Ni=function(e){if(!e.name)return!0;var n=e.form||nt(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(l){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",l.message),!1}var a=Ci(o,e.form);return!a||a===e},ki=function(e){return _s(e)&&e.type==="radio"},_i=function(e){return ki(e)&&!Ni(e)},Ii=function(e){var n,r=e&&nt(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var l,c,d;for(a=!!((l=o)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(d=e.ownerDocument)!==null&&d!==void 0&&d.contains(e));!a&&o;){var u,V,i;r=nt(o),o=(u=r)===null||u===void 0?void 0:u.host,a=!!((V=o)!==null&&V!==void 0&&(i=V.ownerDocument)!==null&&i!==void 0&&i.contains(o))}}return a},bn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Ei=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Le.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(Le.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var u=e.parentElement,V=nt(e);if(u&&!u.shadowRoot&&o(u)===!0)return bn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=d}if(Ii(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bn(e);return!1},Ri=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Le.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Ti=function(e,n){return!(n.disabled||wi(n)||Ei(n,e)||Si(n)||Ri(n))},vn=function(e,n){return!(_i(n)||ks(n)<0||!Ti(e,n))},Di=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Is=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,d=Ai(c,l),u=l?Is(o.candidates):c;d===0?l?n.push.apply(n,u):n.push(c):r.push({documentOrder:a,tabIndex:d,item:o,isScope:l,content:u})}),r.sort(ji).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},Es=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Rt([e],n.includeContainer,{filter:vn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Di}):r=yi(e,n.includeContainer,vn.bind(null,n)),Is(r)};function Pi(){return/apple/i.test(navigator.vendor)}const yn="data-floating-ui-focusable";function Mi(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Tt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&nr(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function De(t){return"composedPath"in t?t.composedPath()[0]:t.target}function jt(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Fi(t){return t.matches("html,body")}function ze(t){return t?.ownerDocument||document}function $i(t){return t?t.hasAttribute(yn)?t:t.querySelector("["+yn+"]")||t:null}function We(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...We(t,o.id,n)])}function Oi(t){return"nativeEvent"in t}var Li=typeof document<"u",zi=function(){},pe=Li?S.useLayoutEffect:zi;const Bi={...Dn},Ui=Bi.useInsertionEffect,qi=Ui||(t=>t());function _e(t){const e=S.useRef(()=>{});return qi(()=>{e.current=t}),S.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Rs=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ts(t,e){const n=Es(t,Rs()),r=n.length;if(r===0)return;const o=Mi(ze(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function Ki(t){return Ts(ze(t).body,1)||t}function Qi(t){return Ts(ze(t).body,-1)||t}function wt(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Tt(n,r)}function Yi(t){Es(t,Rs()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function An(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Gi="data-floating-ui-focusable",jn="active",wn="selected",Hi={...Dn};let Sn=!1,Wi=0;const Cn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Wi++;function Ji(){const[t,e]=S.useState(()=>Sn?Cn():void 0);return pe(()=>{t==null&&e(Cn())},[]),S.useEffect(()=>{Sn=!0},[]),t}const Zi=Hi.useId,Gt=Zi||Ji;function Xi(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const ec=S.createContext(null),tc=S.createContext(null),Ds=()=>{var t;return((t=S.useContext(ec))==null?void 0:t.id)||null},Ps=()=>S.useContext(tc);function Ht(t){return"data-floating-ui-"+t}const nc={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},Nn=S.forwardRef(function(e,n){const[r,o]=S.useState();pe(()=>{Pi()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ht("focus-guard")]:"",style:nc};return s.jsx("span",{...e,...a})}),sc={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ms=S.createContext(null),kn=Ht("portal");function rc(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Gt(),o=ac(),[a,l]=S.useState(null),c=S.useRef(null);return pe(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),pe(()=>{if(!r||c.current)return;const d=e?document.getElementById(e):null;if(!d)return;const u=document.createElement("div");u.id=r,u.setAttribute(kn,""),d.appendChild(u),c.current=u,l(u)},[e,r]),pe(()=>{if(n===null||!r||c.current)return;let d=n||o?.portalNode;d&&!cr(d)&&(d=d.current),d=d||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,d.appendChild(u));const V=document.createElement("div");V.id=r,V.setAttribute(kn,""),d=u||d,d.appendChild(V),c.current=V,l(V)},[e,n,r,o]),a}function oc(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=rc({id:n,root:r}),[l,c]=S.useState(null),d=S.useRef(null),u=S.useRef(null),V=S.useRef(null),i=S.useRef(null),m=l?.modal,f=l?.open,g=!!l&&!l.modal&&l.open&&o&&!!(r||a);return S.useEffect(()=>{if(!a||!o||m)return;function p(x){a&&wt(x)&&(x.type==="focusin"?An:Yi)(a)}return a.addEventListener("focusin",p,!0),a.addEventListener("focusout",p,!0),()=>{a.removeEventListener("focusin",p,!0),a.removeEventListener("focusout",p,!0)}},[a,o,m]),S.useEffect(()=>{a&&(f||An(a))},[f,a]),s.jsxs(Ms.Provider,{value:S.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:d,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:i,portalNode:a,setFocusManagerState:c}),[o,a]),children:[g&&a&&s.jsx(Nn,{"data-type":"outside",ref:d,onFocus:p=>{if(wt(p,a)){var x;(x=V.current)==null||x.focus()}else{const b=l?l.domReference:null,h=Qi(b);h?.focus()}}}),g&&a&&s.jsx("span",{"aria-owns":a.id,style:sc}),a&&rr.createPortal(e,a),g&&a&&s.jsx(Nn,{"data-type":"outside",ref:u,onFocus:p=>{if(wt(p,a)){var x;(x=i.current)==null||x.focus()}else{const b=l?l.domReference:null,h=Ki(b);h?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,p.nativeEvent,"focus-out")}}})]})}const ac=()=>S.useContext(Ms),lc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ic={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},_n=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function cc(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:l=!0,escapeKey:c=!0,outsidePress:d=!0,outsidePressEvent:u="pointerdown",referencePress:V=!1,referencePressEvent:i="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:g}=e,p=Ps(),x=_e(typeof d=="function"?d:()=>!1),b=typeof d=="function"?x:d,h=S.useRef(!1),{escapeKey:v,outsidePress:y}=_n(f),{escapeKey:C,outsidePress:j}=_n(g),A=S.useRef(!1),w=_e(I=>{var M;if(!n||!l||!c||I.key!=="Escape"||A.current)return;const _=(M=a.current.floatingContext)==null?void 0:M.nodeId,R=p?We(p.nodesRef.current,_):[];if(!v&&(I.stopPropagation(),R.length>0)){let E=!0;if(R.forEach(O=>{var B;if((B=O.context)!=null&&B.open&&!O.context.dataRef.current.__escapeKeyBubbles){E=!1;return}}),!E)return}r(!1,Oi(I)?I.nativeEvent:I,"escape-key")}),N=_e(I=>{var M;const _=()=>{var R;w(I),(R=De(I))==null||R.removeEventListener("keydown",_)};(M=De(I))==null||M.addEventListener("keydown",_)}),D=_e(I=>{var M;const _=a.current.insideReactTree;a.current.insideReactTree=!1;const R=h.current;if(h.current=!1,u==="click"&&R||_||typeof b=="function"&&!b(I))return;const E=De(I),O="["+Ht("inert")+"]",B=ze(o.floating).querySelectorAll(O);let L=de(E)?E:null;for(;L&&!bt(L);){const F=ar(L);if(bt(F)||!de(F))break;L=F}if(B.length&&de(E)&&!Fi(E)&&!Tt(E,o.floating)&&Array.from(B).every(F=>!Tt(L,F)))return;if(lr(E)&&P){const F=bt(E),z=ir(E),Y=/auto|scroll/,G=F||Y.test(z.overflowX),J=F||Y.test(z.overflowY),ee=G&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,te=J&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,ne=z.direction==="rtl",X=te&&(ne?I.offsetX<=E.offsetWidth-E.clientWidth:I.offsetX>E.clientWidth),Z=ee&&I.offsetY>E.clientHeight;if(X||Z)return}const q=(M=a.current.floatingContext)==null?void 0:M.nodeId,K=p&&We(p.nodesRef.current,q).some(F=>{var z;return jt(I,(z=F.context)==null?void 0:z.elements.floating)});if(jt(I,o.floating)||jt(I,o.domReference)||K)return;const Q=p?We(p.nodesRef.current,q):[];if(Q.length>0){let F=!0;if(Q.forEach(z=>{var Y;if((Y=z.context)!=null&&Y.open&&!z.context.dataRef.current.__outsidePressBubbles){F=!1;return}}),!F)return}r(!1,I,"outside-press")}),k=_e(I=>{var M;const _=()=>{var R;D(I),(R=De(I))==null||R.removeEventListener(u,_)};(M=De(I))==null||M.addEventListener(u,_)});S.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=y;let I=-1;function M(B){r(!1,B,"ancestor-scroll")}function _(){window.clearTimeout(I),A.current=!0}function R(){I=window.setTimeout(()=>{A.current=!1},or()?5:0)}const E=ze(o.floating);c&&(E.addEventListener("keydown",C?N:w,C),E.addEventListener("compositionstart",_),E.addEventListener("compositionend",R)),b&&E.addEventListener(u,j?k:D,j);let O=[];return m&&(de(o.domReference)&&(O=gt(o.domReference)),de(o.floating)&&(O=O.concat(gt(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(O=O.concat(gt(o.reference.contextElement)))),O=O.filter(B=>{var L;return B!==((L=E.defaultView)==null?void 0:L.visualViewport)}),O.forEach(B=>{B.addEventListener("scroll",M,{passive:!0})}),()=>{c&&(E.removeEventListener("keydown",C?N:w,C),E.removeEventListener("compositionstart",_),E.removeEventListener("compositionend",R)),b&&E.removeEventListener(u,j?k:D,j),O.forEach(B=>{B.removeEventListener("scroll",M)}),window.clearTimeout(I)}},[a,o,c,b,u,n,r,m,l,v,y,w,C,N,D,j,k]),S.useEffect(()=>{a.current.insideReactTree=!1},[a,b,u]);const T=S.useMemo(()=>({onKeyDown:w,...V&&{[lc[i]]:I=>{r(!1,I.nativeEvent,"reference-press")},...i!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[w,r,V,i]),P=S.useMemo(()=>{function I(M){M.button===0&&(h.current=!0)}return{onKeyDown:w,onMouseDown:I,onMouseUp:I,[ic[u]]:()=>{a.current.insideReactTree=!0}}},[w,u,a]);return S.useMemo(()=>l?{reference:T,floating:P}:{},[l,T,P])}function dc(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Gt(),a=S.useRef({}),[l]=S.useState(()=>Xi()),c=Ds()!=null,[d,u]=S.useState(r.reference),V=_e((f,g,p)=>{a.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:p,nested:c}),n?.(f,g,p)}),i=S.useMemo(()=>({setPositionReference:u}),[]),m=S.useMemo(()=>({reference:d||r.reference||null,floating:r.floating||null,domReference:r.reference}),[d,r.reference,r.floating]);return S.useMemo(()=>({dataRef:a,open:e,onOpenChange:V,elements:m,events:l,floatingId:o,refs:i}),[e,V,m,l,o,i])}function uc(t){t===void 0&&(t={});const{nodeId:e}=t,n=dc({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,l]=S.useState(null),[c,d]=S.useState(null),V=o?.domReference||a,i=S.useRef(null),m=Ps();pe(()=>{V&&(i.current=V)},[V]);const f=sr({...t,elements:{...o,...c&&{reference:c}}}),g=S.useCallback(v=>{const y=de(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;d(y),f.refs.setReference(y)},[f.refs]),p=S.useCallback(v=>{(de(v)||v===null)&&(i.current=v,l(v)),(de(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!de(v))&&f.refs.setReference(v)},[f.refs]),x=S.useMemo(()=>({...f.refs,setReference:p,setPositionReference:g,domReference:i}),[f.refs,p,g]),b=S.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),h=S.useMemo(()=>({...f,...r,refs:x,elements:b,nodeId:e}),[f,x,b,e,r]);return pe(()=>{r.dataRef.current.floatingContext=h;const v=m?.nodesRef.current.find(y=>y.id===e);v&&(v.context=h)}),S.useMemo(()=>({...f,context:h,refs:x,elements:b}),[f,x,b,h])}function St(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[jn]:l,[wn]:c,...d}=t;a=d}return{...n==="floating"&&{tabIndex:-1,[Gi]:""},...a,...e.map(l=>{const c=l?l[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((l,c)=>(c&&Object.entries(c).forEach(d=>{let[u,V]=d;if(!(o&&[jn,wn].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof V=="function"){var i;(i=r.get(u))==null||i.push(V),l[u]=function(){for(var m,f=arguments.length,g=new Array(f),p=0;p<f;p++)g[p]=arguments[p];return(m=r.get(u))==null?void 0:m.map(x=>x(...g)).find(x=>x!==void 0)}}}else l[u]=V}),l),{})}}function Vc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=S.useCallback(c=>St(c,t,"reference"),e),a=S.useCallback(c=>St(c,t,"floating"),n),l=S.useCallback(c=>St(c,t,"item"),r);return S.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const fc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function mc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:l}=t,{enabled:c=!0,role:d="dialog"}=e,u=Gt(),V=((n=a.domReference)==null?void 0:n.id)||u,i=S.useMemo(()=>{var h;return((h=$i(a.floating))==null?void 0:h.id)||l},[a.floating,l]),m=(r=fc.get(d))!=null?r:d,g=Ds()!=null,p=S.useMemo(()=>m==="tooltip"||d==="label"?{["aria-"+(d==="label"?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?i:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&g&&{role:"menuitem"},...d==="select"&&{"aria-autocomplete":"none"},...d==="combobox"&&{"aria-autocomplete":"list"}},[m,i,g,o,V,d]),x=S.useMemo(()=>{const h={id:i,...m&&{role:m}};return m==="tooltip"||d==="label"?h:{...h,...m==="menu"&&{"aria-labelledby":V}}},[m,i,V,d]),b=S.useCallback(h=>{let{active:v,selected:y}=h;const C={role:"option",...v&&{id:i+"-fui-option"}};switch(d){case"select":case"combobox":return{...C,"aria-selected":y}}return{}},[i,d]);return S.useMemo(()=>c?{reference:p,floating:x,item:b}:{},[c,p,x,b])}function pc(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:c}=t,d=r&&!o,u=kr(n),V=new RegExp(`\\s${u}$`),i=l?"^":"",m=o?"":u,f=d?new RegExp(`${i}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${i}(?:^)?${u}[^\\s${m}]*`,"gm"),g=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!g)return null;const p=c.pos-g.length,x=Array.from(g.matchAll(f)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),h=new RegExp(`^[${a?.join("")}\0]?$`).test(b);if(a!==null&&!h)return null;const v=p+x.index;let y=v+x[0].length;return d&&V.test(g.slice(y-1,y+1))&&(x[0]+=" ",y+=1),v<c.pos&&y>=c.pos?{range:{from:v,to:y},query:x[0].slice(n.length),text:x[0]}:null}var hc=new Ze("suggestion");function xc({pluginKey:t=hc,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:a=[" "],startOfLine:l=!1,decorationTag:c="span",decorationClass:d="suggestion",decorationContent:u="",decorationEmptyClass:V="is-empty",command:i=()=>null,items:m=()=>[],render:f=()=>({}),allow:g=()=>!0,findSuggestionMatch:p=pc,shouldShow:x}){let b;const h=f?.(),v=()=>{const A=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(A),{top:N,right:D,bottom:k,left:T}=w;try{return new DOMRect(T,N,D-T,k-N)}catch{return null}},y=(A,w)=>w?()=>{const N=t.getState(e.state),D=N?.decorationId,k=A.dom.querySelector(`[data-decoration-id="${D}"]`);return k?.getBoundingClientRect()||null}:v;function C(A,w){var N;try{const k=t.getState(A.state),T=k?.decorationId?A.dom.querySelector(`[data-decoration-id="${k.decorationId}"]`):null,P={editor:e,range:k?.range||{from:0,to:0},query:k?.query||null,text:k?.text||null,items:[],command:I=>i({editor:e,range:k?.range||{from:0,to:0},props:I}),decorationNode:T,clientRect:y(A,T)};(N=h?.onExit)==null||N.call(h,P)}catch{}const D=A.state.tr.setMeta(w,{exit:!0});A.dispatch(D)}const j=new On({key:t,view(){return{update:async(A,w)=>{var N,D,k,T,P,I,M;const _=(N=this.key)==null?void 0:N.getState(w),R=(D=this.key)==null?void 0:D.getState(A.state),E=_.active&&R.active&&_.range.from!==R.range.from,O=!_.active&&R.active,B=_.active&&!R.active,L=!O&&!B&&_.query!==R.query,q=O||E&&L,K=L||E,Q=B||E&&L;if(!q&&!K&&!Q)return;const F=Q&&!q?_:R,z=A.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);b={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Y=>i({editor:e,range:F.range,props:Y}),decorationNode:z,clientRect:y(A,z)},q&&((k=h?.onBeforeStart)==null||k.call(h,b)),K&&((T=h?.onBeforeUpdate)==null||T.call(h,b)),(K||q)&&(b.items=await m({editor:e,query:F.query})),Q&&((P=h?.onExit)==null||P.call(h,b)),K&&((I=h?.onUpdate)==null||I.call(h,b)),q&&((M=h?.onStart)==null||M.call(h,b))},destroy:()=>{var A;b&&((A=h?.onExit)==null||A.call(h,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(A,w,N,D){const{isEditable:k}=e,{composing:T}=e.view,{selection:P}=A,{empty:I,from:M}=P,_={...w},R=A.getMeta(t);if(R&&R.exit)return _.active=!1,_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null,_;if(_.composing=T,k&&(I||e.view.composing)){(M<w.range.from||M>w.range.to)&&!T&&!w.composing&&(_.active=!1);const E=p({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:P.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;E&&g({editor:e,state:D,range:E.range,isActive:w.active})&&(!x||x({editor:e,range:E.range,query:E.query,text:E.text,transaction:A}))?(_.active=!0,_.decorationId=w.decorationId?w.decorationId:O,_.range=E.range,_.query=E.query,_.text=E.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(A,w){var N,D,k,T;const{active:P,range:I}=j.getState(A.state);if(!P)return!1;if(w.key==="Escape"||w.key==="Esc"){const _=j.getState(A.state),R=(N=b?.decorationNode)!=null?N:null,E=R??(_?.decorationId?A.dom.querySelector(`[data-decoration-id="${_.decorationId}"]`):null);if(((D=h?.onKeyDown)==null?void 0:D.call(h,{view:A,event:w,range:_.range}))||!1)return!0;const B={editor:e,range:_.range,query:_.query,text:_.text,items:[],command:L=>i({editor:e,range:_.range,props:L}),decorationNode:E,clientRect:E?()=>E.getBoundingClientRect()||null:null};return(k=h?.onExit)==null||k.call(h,B),C(A,t),!0}return((T=h?.onKeyDown)==null?void 0:T.call(h,{view:A,event:w,range:I}))||!1},decorations(A){const{active:w,range:N,decorationId:D,query:k}=j.getState(A);if(!w)return null;const T=!k?.length,P=[d];return T&&P.push(V),Cr.create(A.doc,[Nr.inline(N.from,N.to,{nodeName:c,class:P.join(" "),"data-decoration-id":D,"data-decoration-content":u})])}}});return j}function gc(t){const e=$.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:l}=t,[c,d]=S.useState(0),u=S.useRef(o),V=S.useRef(c),i=S.useRef(a),m=S.useRef(l),f=S.useDeferredValue(r);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{d(0)},e[0]=g):g=e[0];let p;e[1]!==f?(p=[f],e[1]=f,e[2]=p):p=e[2],S.useEffect(g,p);let x,b;e[3]!==o.length||e[4]!==c?(x=()=>{c>=o.length&&o.length>0&&d(0)},b=[o.length,c],e[3]=o.length,e[4]=c,e[5]=x,e[6]=b):(x=e[5],b=e[6]),S.useEffect(x,b);let h,v;e[7]!==o?(h=()=>{u.current=o},v=[o],e[7]=o,e[8]=h,e[9]=v):(h=e[8],v=e[9]),S.useEffect(h,v);let y,C;e[10]!==c?(y=()=>{V.current=c},C=[c],e[10]=c,e[11]=y,e[12]=C):(y=e[11],C=e[12]),S.useEffect(y,C);let j,A;e[13]!==a?(A=()=>{i.current=a},j=[a],e[13]=a,e[14]=j,e[15]=A):(j=e[14],A=e[15]),S.useEffect(A,j);let w,N;e[16]!==l?(w=()=>{m.current=l},N=[l],e[16]=l,e[17]=w,e[18]=N):(w=e[17],N=e[18]),S.useEffect(w,N);let D,k;e[19]!==n?(D=()=>{if(n?.isDestroyed)return;let I;try{I=n.view.dom}catch{return}if(!I)return;const M=R=>{const E=u.current;if(!E.length)return!1;const O=()=>d(L=>(L+1)%E.length),B=()=>d(L=>(L-1+E.length)%E.length);switch(R.key){case"ArrowUp":return R.preventDefault(),B(),!0;case"ArrowDown":return R.preventDefault(),O(),!0;case"Tab":return R.preventDefault(),R.shiftKey?B():O(),!0;case"Home":return R.preventDefault(),d(0),!0;case"End":return R.preventDefault(),d(E.length-1),!0;case"Enter":{if(R.isComposing)return!1;R.preventDefault();const L=V.current;return L!==-1&&E[L]&&i.current?.(E[L],L),!0}case"Escape":return R.preventDefault(),m.current?.(),!0;default:return!1}},_=R=>{M(R)};return I.addEventListener("keydown",_,!0),()=>{I?.removeEventListener("keydown",_,!0)}},k=[n],e[19]=n,e[20]=D,e[21]=k):(D=e[20],k=e[21]),S.useEffect(D,k);const T=o.length?c:void 0;let P;return e[22]!==T?(P={selectedIndex:T,setSelectedIndex:d},e[22]=T,e[23]=P):P=e[23],P}function bc(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 Fs=S.createContext(void 0);function $s(){const t=S.useContext(Fs);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function vc({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=S.useReducer(bc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=S.useRef(o);return c.current=o,S.useEffect(()=>{if(t?.isDestroyed)return;const d=n instanceof Ze?n:new Ze(n);t.state.plugins.find(i=>i.spec.key===d)&&t.unregisterPlugin(d);const V=xc({pluginKey:d,editor:t,char:e,allow(i){const m=t.state.doc.resolve(i.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(i))},command(){},render:()=>({onStart:i=>{l({type:"ON_START",payload:{element:i.decorationNode??null,query:i.query,range:i.range}}),c.current?.(!0)},onUpdate:i=>{l({type:"ON_UPDATE",payload:{element:i.decorationNode??null,query:i.query,range:i.range}})},onKeyDown:i=>i.event.key==="Escape"?(l({type:"ON_EXIT"}),!0):!1,onExit:()=>{l({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(d)}},[t,n,e,l,r]),{state:a,dispatch:l}}function yc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=$s(),l=S.useDeferredValue(o.query),{data:c}=dr({queryKey:$e.suggestionItems(e,o.open,l),queryFn:()=>o.open?n({query:l}):[]}),d=()=>{a({type:"ON_EXIT"})},u=async(i,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:i});try{const{view:f}=t,p=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=o.range?{...o.range}:{from:0,to:0};p&&o.range&&(x.to+=1),await r({range:x,item:i})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):d()}catch{d()}}},{selectedIndex:V}=gc({editor:t,query:l,items:c,onSelect:u,onClose:d});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:d,onSelect:u}}function Ac({children:t}){const{state:e,dispatch:n}=$s(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:d}=uc({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[ur(10),Vr(),fr()],whileElementsMounted:mr}),u=cc(d,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=mc(d,{role:"listbox"}),{getFloatingProps:i}=Vc([u,V]);return r?s.jsx(oc,{children:s.jsx("div",{ref:l.setFloating,style:c,...i(),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 jc=t=>{const e=$.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:l}=t;let c;if(e[0]!==n){const j=Ve(n._meta);c=n.title||Mt(n.name,j),e[0]=n,e[1]=c}else c=e[1];const d=c,u=n.description||null,V=n.icon,i=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==i||e[3]!==m?(f=U("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",i,m),e[2]=i,e[3]=m,e[4]=f):f=e[4];let g;e[5]!==V||e[6]!==d?(g=V!==void 0&&s.jsx(qn,{icon:V,name:d,size:"xs",className:"mr-2"}),e[5]=V,e[6]=d,e[7]=g):g=e[7];let p;e[8]!==d?(p=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:d}),e[8]=d,e[9]=p):p=e[9];let x;e[10]!==a?(x=a&&s.jsx(Ct,{size:"xs"}),e[10]=a,e[11]=x):x=e[11];let b;e[12]!==p||e[13]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,x]}),e[12]=p,e[13]=x,e[14]=b):b=e[14];let h;e[15]!==u?(h=u&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=h):h=e[16];let v;e[17]!==b||e[18]!==h?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,h]}),e[17]=b,e[18]=h,e[19]=v):v=e[19];let y;e[20]!==n.drillable?(y=n.drillable&&s.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]=n.drillable,e[21]=y):y=e[21];let C;return e[22]!==o||e[23]!==l||e[24]!==v||e[25]!==y||e[26]!==f||e[27]!==g?(C=s.jsxs("div",{ref:l,onClick:o,className:f,children:[g,v,y]}),e[22]=o,e[23]=l,e[24]=v,e[25]=y,e[26]=f,e[27]=g,e[28]=C):C=e[28],C},wc=t=>{const e=$.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let l;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(l={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:V}=yc(l);if(!c.length){let g;return e[5]===Symbol.for("react.memo_cache_sentinel")?(g=s.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]=g):g=e[5],g}let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=i):i=e[6];let m;if(e[7]!==u||e[8]!==c||e[9]!==d||e[10]!==V?.name){let g;e[12]!==u||e[13]!==d||e[14]!==V?.name?(g=(p,x)=>s.jsx(jc,{item:p,isSelected:x===d,ref:x===d?Nc:void 0,onSelect:()=>u(p,x),isLoading:V?.name===p.name},p.name),e[12]=u,e[13]=d,e[14]=V?.name,e[15]=g):g=e[15],m=c.map(g),e[7]=u,e[8]=c,e[9]=d,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:i,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function Sc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(Cc)}),t[0]=e):e=t[0],e}function Cc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Os(t){const e=$.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:l,onSelect:c,allow:d,onOpenChange:u}=t;let V;e[0]!==d||e[1]!==r||e[2]!==n||e[3]!==u||e[4]!==o?(V={editor:n,char:r,pluginKey:o,allow:d,onOpenChange:u},e[0]=d,e[1]=r,e[2]=n,e[3]=u,e[4]=o,e[5]=V):V=e[5];const{state:i,dispatch:m}=vc(V);let f;e[6]!==m||e[7]!==i?(f={state:i,dispatch:m},e[6]=m,e[7]=i,e[8]=f):f=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Sc,{}),e[9]=g):g=e[9];let p;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(p=s.jsx(Ac,{children:s.jsx(S.Suspense,{fallback:g,children:s.jsx(wc,{editor:n,queryKey:a,queryFn:l,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=l,e[13]=a,e[14]=p):p=e[14];let x;return e[15]!==f||e[16]!==p?(x=s.jsx(Fs.Provider,{value:f,children:p}),e[15]=f,e[16]=p,e[17]=x):x=e[17],x}function Nc(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 n=Be(),{org:r}=ce(),o=to(),a=So(o),l=Re({connectionId:e,orgId:r.id,orgSlug:r.slug}),c=$e.virtualMcpResources(e,r.id),[d,u]=S.useState("categories"),V=S.useRef(d);V.current=d;const i=S.useRef(null),m=S.useRef(!1),f=["at-mention",r.id,e??"default",d],g=async({item:b,range:h})=>{if(W("chat_picker_item_selected",{picker:"@",item_kind:b.kind,item_name:b.name}),b.kind!=="category"&&(m.current=!0),b.kind==="category")return u(b.name==="agents"?"agents":"resources"),!1;if(b.kind==="agent"&&b.agentId){Oe(t,h,{id:b.agentId,name:b.name,metadata:{agentId:b.agentId,title:b.name},char:"@"}),u("categories");return}if(b.kind==="resource"&&b.uri&&l){try{const v=await Pn(l,b.uri);Oe(t,h,{id:b.uri,name:b.uri,metadata:v.contents,char:"@"})}catch(v){console.error("[at-mention] Failed to fetch resource:",v),le.error("Failed to load resource. Please try again.")}u("categories");return}},p=async b=>{const{query:h}=b,v=V.current;if(v==="categories"){if(!h.trim())return kc;const j=h.toLowerCase(),A=o.filter(N=>N.status==="active"&&(!N.id||!Zt(N.id))&&!a.has(N.id)&&N.id!==e&&(N.title.toLowerCase().includes(j)||N.description?.toLowerCase().includes(j))).map(N=>({name:N.title,title:N.title,description:N.description??void 0,icon:N.icon??null,kind:"agent",agentId:N.id})),w=await(async()=>{if(!l)return[];let N=n.getQueryData(c);return N||(N=await n.fetchQuery({queryKey:c,queryFn:()=>Fe(l),staleTime:6e4})),(N?.resources??[]).filter(D=>D.uri.toLowerCase().includes(j)||D.name?.toLowerCase().includes(j)||D.description?.toLowerCase().includes(j)).map(D=>({name:D.name??D.uri,title:D.name,description:D.description,kind:"resource",uri:D.uri}))})();return[...A,...w]}if(v==="agents"){let j=o.filter(A=>A.status==="active"&&(!A.id||!Zt(A.id))&&!a.has(A.id)&&A.id!==e);if(h.trim()){const A=h.toLowerCase();j=j.filter(w=>w.title.toLowerCase().includes(A)||w.description?.toLowerCase().includes(A))}return j.map(A=>({name:A.title,title:A.title,description:A.description??void 0,icon:A.icon??null,kind:"agent",agentId:A.id}))}if(!l)return[];let y=n.getQueryData(c);y?n.fetchQuery({queryKey:c,queryFn:()=>Fe(l),staleTime:6e4}).catch(()=>{}):y=await n.fetchQuery({queryKey:c,queryFn:()=>Fe(l),staleTime:6e4});let C=y?.resources??[];if(h.trim()){const j=h.toLowerCase();C=C.filter(A=>A.uri.toLowerCase().includes(j)||A.name?.toLowerCase().includes(j)||A.description?.toLowerCase().includes(j))}return C.map(j=>({name:j.name??j.uri,title:j.name,description:j.description,kind:"resource",uri:j.uri}))},x=b=>{if(b)i.current=Date.now(),m.current=!1,W("chat_picker_opened",{picker:"@"});else{const h=i.current;W("chat_picker_closed",{picker:"@",outcome:m.current?"selected":"dismissed",duration_ms:h?Date.now()-h:null}),i.current=null,u("categories")}};return s.jsx(Os,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:f,queryFn:p,onSelect:g,onOpenChange:x})};async function In(t,e,n,r,o,a){try{const l=await Vt(n,r,a);Oe(t,e,{id:r,name:at(r,o),metadata:l.messages,char:"/",kind:"prompt",args:a})}catch(l){console.error("[slash] Failed to fetch prompt:",l),le.error("Failed to load prompt. Please try again.")}}async function Ic(t,e,n,r){try{const o=await Pn(n,r);Oe(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),le.error("Failed to load resource. Please try again.")}}const Ec=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=ce(),o=Re({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=$e.virtualMcpPrompts(e,r.id),l=$e.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[d,u]=S.useState(null),[V,i]=S.useState(null),m=_r(t);m&&(m.onEditChip=async y=>{if(o)try{const j=(await En(n,a,o)).find(A=>A.name===y.promptId);if(!j?.arguments||j.arguments.length===0)return;i({...y,prompt:j})}catch(C){console.error("[slash] Failed to load prompt for editing:",C),le.error("Failed to load prompt. Please try again.")}});const f=S.useRef(null),g=S.useRef(!1),p=async({item:y,range:C})=>{if(W("chat_picker_item_selected",{picker:"/",item_kind:y.kind,item_name:y.name}),g.current=!0,!!o)if(y.kind==="prompt"){if(y.arguments&&y.arguments.length>0){u({range:C,item:y});return}const j=Ve(y._meta);await In(t,C,o,y.name,j)}else y.uri&&await Ic(t,C,o,y.uri)},x=async y=>{if(!d||!o)return;const{range:C,item:j}=d,A=Ve(j._meta);await In(t,C,o,j.name,A,y),u(null)},b=async y=>{if(!(!V||!o)){try{const C=await Vt(o,V.promptId,y),j=Ve(V.prompt._meta);t.chain().focus().setNodeSelection(V.pos).deleteSelection().insertContentAt(V.pos,$n({id:V.promptId,name:at(V.promptId,j),metadata:C.messages,char:"/",kind:"prompt",args:y})).run(),W("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:V.promptId})}catch(C){console.error("[slash] Failed to update prompt:",C),le.error("Failed to update prompt. Please try again.")}i(null)}},h=async y=>{const{query:C}=y;if(!o)return[];const[j,A]=await Promise.all([En(n,a,o),Rc(n,l,o)]),w=C.trim().toLowerCase(),N=(j??[]).filter(k=>!w||k.name.toLowerCase().includes(w)||k.title?.toLowerCase().includes(w)||k.description?.toLowerCase().includes(w)).map(k=>({name:k.name,title:k.title,description:k.description,kind:"prompt",arguments:k.arguments,_meta:k._meta})),D=(A??[]).filter(k=>!w||k.uri.toLowerCase().includes(w)||k.name?.toLowerCase().includes(w)||k.description?.toLowerCase().includes(w)).map(k=>({name:k.name??k.uri,title:k.name,description:k.description,kind:"resource",uri:k.uri}));return[...N,...D]},v=d?.item.kind==="prompt"?{name:d.item.name,title:d.item.title,arguments:d.item.arguments,description:d.item.description,_meta:d.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(Os,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:h,onSelect:p,onOpenChange:y=>{if(y)f.current=Date.now(),g.current=!1,W("chat_picker_opened",{picker:"/"});else{const C=f.current;W("chat_picker_closed",{picker:"/",outcome:g.current?"selected":"dismissed",duration_ms:C?Date.now()-C:null}),f.current=null}}}),s.jsx(Je,{prompt:v,setPrompt:()=>u(null),onSubmit:x}),s.jsx(Je,{prompt:V?.prompt??null,setPrompt:()=>i(null),onSubmit:b,defaultValues:V?.args},V?`edit-${V.promptId}-${V.pos}`:"edit-idle")]})};async function En(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}),r?.prompts??[]}async function Rc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}),r?.resources??[]}function Tc(t){return[Dr.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),gi.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),Rr,Tr]}function Dc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:l}){const c=S.useRef(a),d=S.useRef(e),u=S.useRef(r),V=S.useRef(o),i=Ir({extensions:Tc(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})=>{d.current(m?.getJSON())}});return S.useEffect(()=>{i?.setEditable(!n)},[i,n]),S.useEffect(()=>{c.current=a},[a]),S.useEffect(()=>{d.current=e},[e]),S.useEffect(()=>{u.current=r},[r]),S.useEffect(()=>{V.current=o},[o]),S.useEffect(()=>{if(!i||i.isDestroyed)return;const m=JSON.stringify(i.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&i.commands.setContent(t||{type:"doc",content:[]})},[i,t]),s.jsx(Er.Provider,{value:{editor:i},children:l})}function Pc(t){const e=$.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:l,ref:c,className:d}=t,u=n===void 0?!1:n,V=o===void 0?!1:o,{editor:i}=Ft();let m,f;if(e[0]!==i?(m=()=>({focus:()=>{i?.commands.focus()},clear:()=>{i?.commands.clearContent(!0)},appendText:w=>{if(!i)return;const N=i.state.doc.textContent.trim()==="";i.commands.focus("end"),N||i.commands.insertContent(" "),i.commands.insertContent(w)},syncVoiceText:(w,N)=>{if(i&&(i.commands.setContent(w||{type:"doc",content:[]}),N)){i.commands.focus("end");const D=i.state.doc.textContent.trim().length>0;i.commands.insertContent(D?" "+N:N)}},restoreContent:w=>{i&&i.commands.setContent(w||{type:"doc",content:[]})}}),f=[i],e[0]=i,e[1]=m,e[2]=f):(m=e[1],f=e[2]),S.useImperativeHandle(c??null,m,f),!i)return null;const g=u&&"cursor-not-allowed opacity-70",p=u&&"[&_.ProseMirror]:cursor-not-allowed";let x;e[3]!==d||e[4]!==g||e[5]!==p?(x=U("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.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",g,p),e[3]=d,e[4]=g,e[5]=p,e[6]=x):x=e[6];let b;e[7]!==i||e[8]!==x?(b=s.jsx(Pr,{editor:i,className:x}),e[7]=i,e[8]=x,e[9]=b):b=e[9];const h=r??null;let v;e[10]!==i||e[11]!==h?(v=s.jsx(S.Suspense,{fallback:null,children:s.jsx(Ec,{editor:i,virtualMcpId:h})}),e[10]=i,e[11]=h,e[12]=v):v=e[12];const y=r??null;let C;e[13]!==i||e[14]!==y?(C=s.jsx(S.Suspense,{fallback:null,children:s.jsx(_c,{editor:i,virtualMcpId:y})}),e[13]=i,e[14]=y,e[15]=C):C=e[15];let j;e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==V?(j=V&&a?s.jsx(Vi,{editor:i,selectedModel:a,onUnsupportedFile:l}):null,e[16]=i,e[17]=l,e[18]=a,e[19]=V,e[20]=j):j=e[20];let A;return e[21]!==v||e[22]!==C||e[23]!==j||e[24]!==b?(A=s.jsxs(s.Fragment,{children:[b,v,C,j]}),e[21]=v,e[22]=C,e[23]=j,e[24]=b,e[25]=A):A=e[25],A}function Ls(t){const e=$.c(3),[n]=Ee();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Uo(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const Mc={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"},Fc=Xr.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),$c=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Oc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:$c.map(Lc)}),t[0]=e):e=t[0],e}function Lc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function zc({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=S.useState(!1),d=Ls(Mc),{org:u}=ce(),{editor:V}=Ft(),i=S.useRef(null),m=pt(r),f=()=>{!m||o||(c(!1),i.current?.click())},g=async F=>{const z=F.target.files;if(!z||z.length===0||!V)return;const Y=Array.from(z),{from:G}=V.state.selection;try{for(const J of Y)await Yt(V,r??null,J,G,a)}finally{i.current&&(i.current.value="")}},p=Re({connectionId:n,orgId:u.id,orgSlug:u.slug}),x=$e.virtualMcpPrompts(n,u.id),{data:b,isLoading:h}=pr({queryKey:x,queryFn:()=>kt(p),staleTime:6e4,enabled:l&&!!p}),v=b?.prompts??[],[y,C]=S.useState(null),{chatMode:j,setChatMode:A}=me(),[w,N]=Ee(),k=(Pe.find(F=>F.value===w.toolApprovalLevel)??Pe[0]).short,T=F=>{const z=Pe.find(Y=>Y.value===F);if(z){if(z.value===w.toolApprovalLevel){c(!1);return}d(),W("chat_approval_level_changed",{from_level:w.toolApprovalLevel,to_level:z.value,source:"tools_popover"}),N({...w,toolApprovalLevel:z.value}),c(!1)}},P=j==="plan",I=()=>{d();const F=P?"default":"plan";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},M=()=>{e(),c(!1)},_=async(F,z)=>{if(!V||!p)return;const Y=Ve(F._meta),G={from:V.state.selection.from,to:V.state.selection.to};try{const J=await Vt(p,F.name,z);Oe(V,G,{id:F.name,name:at(F.name,Y),metadata:J.messages,char:"/",kind:"prompt",args:z})}catch{le.error("Failed to load prompt. Please try again.")}},R=async F=>{c(!1);const z=!!(F.arguments&&F.arguments.length>0);if(W("chat_prompt_inserted",{prompt_name:F.name,with_arguments:z}),z){C(F);return}await _(F)},E=async F=>{y&&(await _(y,F),C(null))},O=()=>{d();const F=j==="gen-image"?"default":"gen-image";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},B=()=>{d();const F=j==="web-search"?"default":"web-search";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},L=()=>{d();const F=j==="deep-research"?"default":"deep-research";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},q=j==="gen-image",K=j==="web-search",Q=j==="deep-research";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:i,type:"file",multiple:!0,accept:_o(r??null),className:"hidden",onChange:g,disabled:o}),s.jsxs($o,{open:l,onOpenChange:F=>{F&&!l&&W("chat_tools_popover_opened",{chat_mode:j}),c(F)},children:[s.jsx(Oo,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(co,{size:14}),s.jsx("span",{className:U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(Lo,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(ue,{onClick:f,disabled:o,children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(be,{children:[s.jsx(xe,{asChild:!0,children:s.jsxs(ue,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:F=>F.preventDefault(),children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(ge,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(ue,{onClick:I,className:U(P&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(Ln,{size:16,className:U(P&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:U("text-xs text-muted-foreground",P&&"text-violet-500 font-medium"),children:Fc})]}),s.jsxs(ue,{onClick:O,className:U(q&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(Bn,{size:16,className:U(q&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),q&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(ue,{onClick:B,className:U(K&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(zn,{size:16,className:U(K&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),K&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(ue,{onClick:L,className:U(Q&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(Kn,{size:16,className:U(Q&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Deep research"}),Q&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(sn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:h?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(hr,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(F=>s.jsxs(ue,{onClick:()=>R(F),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:F.title||Mt(F.name,Ve(F._meta))}),F.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:F.description})]},F.name))})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx(mt,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:k})]}),s.jsx(sn,{className:"w-48 p-1.5",children:s.jsx(zo,{value:w.toolApprovalLevel,onValueChange:T,children:Pe.map(F=>s.jsx(Bo,{value:F.value,children:F.label},F.value))})})]}),s.jsxs(ue,{onClick:M,children:[s.jsx(yo,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(S.Suspense,{children:s.jsx(Oc,{})})]})]})]}),s.jsx(Je,{prompt:y,setPrompt:C,onSubmit:E})]})}const Bc=[{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 Uc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:Bc.map(qc)}),t[0]=e):e=t[0],e}function qc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Kc(t){const e=$.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=U("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(Uc,{}),l=s.jsx(Ko,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=l):(r=e[0],o=e[1],a=e[2],l=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,l]}),e[4]=n,e[5]=c):c=e[5],c}const Me=48;function Qc(){const t=$.c(9),[e,n]=S.useState("idle"),[r,o]=S.useState(""),[a,l]=S.useState(""),[c,d]=S.useState(Hc),u=S.useRef(null),V=S.useRef(null),i=S.useRef(null),m=S.useRef(null),f=S.useRef(0),g=S.useRef(!1),p=S.useRef(""),x=S.useRef(""),b=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(Gc),m.current?.getTracks().forEach(Yc),i.current=null,V.current=null,m.current=null},t[0]=h):h=t[0];const v=h;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const k=T=>{m.current=T;const P=new AudioContext;V.current=P;const I=P.createMediaStreamSource(T),M=P.createAnalyser();M.fftSize=128,M.smoothingTimeConstant=.8,I.connect(M),i.current=M;const _=new Uint8Array(M.frequencyBinCount),R=()=>{if(!i.current)return;i.current.getByteFrequencyData(_);const E=[];for(let O=0;O<Me;O++){const B=Math.floor(O/Me*_.length);E.push(Math.max(.04,(_[B]??0)/255))}d(E),f.current=requestAnimationFrame(R)};R()};y=async()=>{const T=window.SpeechRecognition||window.webkitSpeechRecognition;if(!T){n("unsupported");return}let P;try{P=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),l(""),x.current="",p.current="",g.current=!0,n("recording"),k(P);const I=new T;u.current=I,I.interimResults=!0,I.continuous=!0,I.lang=navigator.language||"en-US",I.onresult=M=>{let _="",R="";for(let E=M.resultIndex;E<M.results.length;E++){const O=M.results[E],B=O?.[0]?.transcript??"";O?.isFinal?R=R+B:_=_+B}R&&(p.current=p.current+R,o(p.current)),x.current=_,l(_)},I.onend=()=>{if(g.current)try{I.start()}catch{}};try{I.start()}catch{n("idle")}},t[1]=y}else y=t[1];const C=y;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{g.current=!1,u.current?.stop(),v(),n("idle"),d(Array(Me).fill(.05)),l("");const k=(p.current+(x.current?" "+x.current:"")).trim();return o(""),p.current="",x.current="",k},t[2]=j):j=t[2];const A=j;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{g.current=!1,u.current?.abort(),v(),n("idle"),o(""),l(""),d(Array(Me).fill(.05)),p.current="",x.current=""},t[3]=w):w=t[3];const N=w;let D;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(D={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:b,startRecording:C,stopRecording:A,cancelRecording:N},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=D):D=t[8],D}function Yc(t){return t.stop()}function Gc(){}function Hc(){return Array(Me).fill(.05)}function Wc(t){const e=$.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(Jc),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Jc(t,e){return s.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 Zc({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Xc(t){const e=$.c(3),{message:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Mn,{size:14,className:"shrink-0"}),e[0]=r):r=e[0];let o;return e[1]!==n?(o=s.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:[r,s.jsx("span",{className:"text-sm",children:n})]}),e[1]=n,e[2]=o):o=e[2],o}function ed(t,e){const n=$.c(5),{editor:r}=Ft(),[o,a]=S.useState(!1),l=S.useRef(0);let c,d;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),l.current=l.current+1,a(!0))},V=f=>{f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&a(!1)},i=td,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!pt(t))return;const g=f.dataTransfer?.files;if(!g||g.length===0)return;const{from:p}=r.state.selection;for(const x of Array.from(g))Yt(r,t,x,p,e)};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",V),window.addEventListener("dragover",i),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",i),window.removeEventListener("drop",m)}},d=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=d):(c=n[3],d=n[4]),S.useEffect(c,d),o}function td(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function nd(t){const e=$.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=ed(n,r);let a;e[0]!==n?(a=pt(n),e[0]=n,e[1]=a):a=e[1];const l=a,c=o?"opacity-100":"opacity-0 pointer-events-none",d=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=U("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,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==l?(V=l?s.jsxs(s.Fragment,{children:[s.jsx(fo,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",ss(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Mn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=l,e[7]=V):V=e[7];let i;return e[8]!==u||e[9]!==V?(i=s.jsx("div",{className:u,children:V}),e[8]=u,e[9]=V,e[10]=i):i=e[10],i}function sd(){const t=$.c(6),e=rt(),{org:n,locator:r}=ce(),{create:o}=Wr();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async l=>{const{tiptapDoc:c,virtualMcp:d}=l,u=crypto.randomUUID(),V=d?.id??ut(n.id).id;Jr(sessionStorage,r,u,{tiptapDoc:c});try{await o({id:u,virtual_mcp_id:V})}catch{}const i={virtualmcpid:V,autosend:Zr};e({to:"/$org/$taskId",params:{org:n.slug,taskId:u},search:i})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function rd({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=Fn(),r=ot(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=r?.taskId??"",u=d||pa,V=sd(),{selectedModel:i,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:g,imageModel:p,webSearchModel:x,deepResearchModel:b,chatMode:h,setChatMode:v}=me(),{data:y}=Tn.useSession(),C=y?.user?.id,{org:j,locator:A}=ce(),w=ut(j.id).id,N=no(m?.id??w),D=Ls(qo),[k,T]=S.useState(!1),{unsupportedFile:P,onUnsupportedFile:I,clearUnsupportedFile:M}=xi(),_=Qc(),R=S.useRef(void 0),E=async()=>{R.current=q,await _.startRecording();const H=_.status==="recording"?"started":_.status==="unsupported"?"unsupported":_.status==="permission-denied"?"permission_denied":"unknown";W("chat_voice_started",{thread_id:d,outcome:H})},O=()=>{W("chat_voice_confirmed",{thread_id:d});const H=_.stopRecording();G.current?.syncVoiceText(R.current,H),G.current?.focus()},B=()=>{W("chat_voice_cancelled",{thread_id:d}),_.cancelRecording(),G.current?.restoreContent(R.current)};S.useEffect(()=>{if(_.status!=="recording")return;const H=(_.transcript+(_.interimTranscript?" "+_.interimTranscript:"")).trim();G.current?.syncVoiceText(R.current,H)},[_.transcript,_.interimTranscript,_.status]);const L=r?.activeTask??null,[q,K]=S.useState(()=>ln(sessionStorage,A,u)??void 0),Q=H=>{K(H),g.current=H,xa(sessionStorage,A,u,H,{onQuotaExceeded:({docSizeBytes:ie})=>{W("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:ie}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},F=S.useRef(d);if(F.current!==d){F.current=d;const H=ln(sessionStorage,A,u)??void 0;K(H),g.current=H}const Y=[...o].reverse().find(H=>H.role==="assistant")?.metadata?.modelLimits?.contextWindow??i?.limits?.contextWindow,G=S.useRef(null),J=h==="plan";S.useEffect(()=>{const H=ie=>{eo(ie)&&ie.code==="KeyL"&&(ie.preventDefault(),ie.shiftKey&&v(h==="plan"?"default":"plan"),G.current?.focus())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[h,v]);const ee=Mr(o),ne=[...o].reverse().find(H=>H.role==="assistant"&&H.metadata?.usage)?.metadata?.usage?.contextTokens??0,X=!a&&!f&&!us(q),Z=a||l,oe=Zc({messageCount:o.length,showConnectionsBanner:e}),se=H=>{H?.preventDefault(),a?(W("chat_message_stopped",{thread_id:d}),c()):l?(W("chat_message_stopped",{thread_id:d}),c()):X&&q&&(W("chat_message_sent",{thread_id:d||null,mode:h,model_id:i?.modelId??null,model_provider:i?.providerId??null,virtual_mcp_id:m?.id??null,submission:H?"button_or_enter":"programmatic"}),n?n.sendMessage(q):V({tiptapDoc:q,virtualMcp:m}),ga(sessionStorage,A,u),Q(void 0))};return C&&L?.created_by&&L.created_by!==C?s.jsx(Xc,{message:"Read only - you're viewing someone else's thread"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(ht,{}),s.jsx(Dc,{tiptapDoc:q,setTiptapDoc:Q,disabled:a,enterToSubmit:!0,onSubmit:se,children:s.jsxs("form",{onSubmit:se,className:U("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(nd,{selectedModel:i,onUnsupportedFile:I}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(Pc,{ref:G,disabled:a||_.status==="recording",virtualMcpId:m?.id??w,showFileUploader:!0,selectedModel:i,onUnsupportedFile:I})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:_.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(Wc,{data:_.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:B,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:s.jsx(ke,{size:16})}),s.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(qe,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(zc,{disabled:a,onOpenConnections:()=>{W("connections_dialog_opened",{source:"tools_popover",mode:"add"}),T(!0)},virtualMcpId:m?.id??w,selectedModel:i,isStreaming:a,onUnsupportedFile:I}),J&&s.jsxs("button",{type:"button",onClick:()=>{D(),W("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),v("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 min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(Ln,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="gen-image"&&p&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{D(),W("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),v("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 min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Bn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="web-search"&&x&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{D(),W("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),v("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 min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(zn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="deep-research"&&b&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{D(),W("chat_mode_changed",{from_mode:"deep-research",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Deep research","aria-label":"Deep research",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 min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Kn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Deep research"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),Y&&ne>0&&s.jsx(Fr,{usage:ee,totalTokens:ne,contextWindow:Y,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[oe&&s.jsx(li,{virtualMcp:N,currentBranch:r?.currentBranch??null}),s.jsx(ui,{}),_.isSupported&&s.jsx(re,{type:"button",onClick:E,disabled:a||l,variant:"ghost",size:"icon",className:U("size-8 rounded-lg transition-colors",_.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:_.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(uo,{size:18})}),s.jsx(re,{type:Z?"button":"submit",onClick:H=>{Z&&(H.preventDefault(),H.stopPropagation(),c())},variant:X||Z?"default":"ghost",size:"icon",disabled:!X&&!Z,className:U("size-8 rounded-lg transition-all",!X&&!Z&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:a?"Stop generating":l?"Cancel run":"Send message (Enter)",children:Z?s.jsx(Vo,{size:20}):s.jsx(so,{size:20})})]})]})})]})},d),e&&s.jsx(Kc,{onClick:()=>{W("connections_banner_clicked",{source:"home_chat_input"}),W("connections_dialog_opened",{source:"home_banner",mode:"add"}),T(!0)}})]})}),s.jsx(Co,{mode:"browse",open:k,onOpenChange:T,defaultTab:"all"}),s.jsx(pi,{info:P,onClose:M})]})}const od={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 zs(t){return`deco-credits-empty-dismissed:${t}`}function cu(t){try{return localStorage.getItem(zs(t))==="1"}catch{return!1}}function ad(){const t=$.c(47),{org:e}=ce(),n=rt(),{decoKeyId:r}=Zn(),o=Xn(),[a,l]=S.useState(!0),[c,d]=S.useState(""),[u,V]=S.useState(!1),[i,m]=S.useState("usd"),f=i==="brl"?"R$":"$";let g;t[0]!==e.id?(g=()=>{W("credits_empty_state_dismissed",{organization_id:e.id}),l(!1);try{localStorage.setItem(zs(e.id),"1")}catch{}},t[0]=e.id,t[1]=g):g=t[1];const p=g;let x,b;t[2]!==a||t[3]!==e.id?(x=()=>{a&&W("credits_empty_state_shown",{organization_id:e.id})},b=[a,e.id],t[2]=a,t[3]=e.id,t[4]=x,t[5]=b):(x=t[4],b=t[5]),S.useEffect(x,b);let h;t[6]!==i||t[7]!==o?(h=async L=>{const{url:q}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:L,currency:i});return q},t[6]=i,t[7]=o,t[8]=h):h=t[8];let v;t[9]!==p?(v=L=>{L&&window.open(L,"_blank","noopener,noreferrer"),p()},t[9]=p,t[10]=v):v=t[10];let y;t[11]!==h||t[12]!==v?(y={mutationFn:h,onSuccess:v,onError:id},t[11]=h,t[12]=v,t[13]=y):y=t[13];const{mutate:C,isPending:j}=Pt(y),A=parseFloat(c),w=!isNaN(A)&&A>=1;if(!a)return null;let N;t[14]!==p?(N=L=>!L&&p(),t[14]=p,t[15]=N):N=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.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[16]=D):D=t[16];let k;t[17]===Symbol.for("react.memo_cache_sentinel")?(k=s.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:s.jsx(Qn,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[17]=k):k=t[17];let T;t[18]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[D,s.jsxs(lt,{className:"relative gap-3",children:[k,s.jsxs("div",{className:"text-center",children:[s.jsx(it,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx($t,{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[18]=T):T=t[18];let P;t[19]!==i||t[20]!==f||t[21]!==c||t[22]!==A||t[23]!==r||t[24]!==w||t[25]!==j||t[26]!==u||t[27]!==C?(P=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Wn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:L=>{L&&m(L)},children:[s.jsx(Xe,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Xe,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:od[i].map(L=>{const{dollars:q,label:K}=L;return s.jsxs("button",{type:"button",disabled:j,onClick:()=>{W("credits_topup_clicked",{amount_cents:q*100,currency:i,tier_label:K,source:"empty_state"}),C(q*100)},className:U("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:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,q]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:K})]},q)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Jn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:L=>d(L.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!w||j,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:i,tier_label:"custom",source:"empty_state"}),C(Math.round(A*100))},children:j?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),t[19]=i,t[20]=f,t[21]=c,t[22]=A,t[23]=r,t[24]=w,t[25]=j,t[26]=u,t[27]=C,t[28]=P):P=t[28];let I;t[29]!==p||t[30]!==n||t[31]!==e.slug?(I=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[29]=p,t[30]=n,t[31]=e.slug,t[32]=I):I=t[32];let M;t[33]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Hn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[33]=M):M=t[33];let _;t[34]!==I?(_=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:I,children:["Use your own provider",M]}),t[34]=I,t[35]=_):_=t[35];let R;t[36]!==p?(R=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[36]=p,t[37]=R):R=t[37];let E;t[38]!==_||t[39]!==R?(E=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[_,R]}),t[38]=_,t[39]=R,t[40]=E):E=t[40];let O;t[41]!==P||t[42]!==E?(O=s.jsxs(ct,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ld,children:[T,P,E]}),t[41]=P,t[42]=E,t[43]=O):O=t[43];let B;return t[44]!==O||t[45]!==N?(B=s.jsx(dt,{open:!0,onOpenChange:N,children:O}),t[44]=O,t[45]=N,t[46]=B):B=t[46],B}function ld(t){return t.preventDefault()}function id(t){le.error(`Top-up failed: ${t.message}`)}function cd(t){const e=$.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=U("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"),l=s.jsx(Qn,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[l,s.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 dd(){const t=$.c(8),{org:e}=ce(),n=rt();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=U("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"),a=s.jsx(Yn,{size:13,className:"text-amber-600 dark:text-amber-400"}),l=s.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]=a,t[5]=l):(o=t[3],a=t[4],l=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,l]}),t[6]=r,t[7]=c):c=t[7],c}function ud(t){const e=$.c(11),{className:n}=t;let r;e[0]!==n?(r=U("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(Ye,{align:"right",width:"w-3/4"}),s.jsx(Ye,{align:"left",width:"w-full",lines:3}),s.jsx(Ye,{align:"right",width:"w-2/3"}),s.jsx(Ye,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center gap-1",children:s.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=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[d,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let i;return e[9]!==r?(i=s.jsxs("div",{className:r,children:[l,c,V]}),e[9]=r,e[10]=i):i=e[10],i}function Ye(t){const e=$.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,l=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let d;e[0]!==c?(d=U("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=d):d=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==u?(V=U("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=V):V=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=i):i=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=U("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let g;e[8]!==l?(g=Array.from({length:l}),e[8]=l,e[9]=g):g=e[9];let p;e[10]!==l||e[11]!==g?(p=s.jsx("div",{className:"space-y-2",children:g.map((v,y)=>s.jsx("div",{className:U("h-3 rounded bg-muted-foreground/20 animate-pulse",y===l-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=l,e[11]=g,e[12]=p):p=e[12];let x;e[13]!==p||e[14]!==f?(x=s.jsx("div",{className:f,children:p}),e[13]=p,e[14]=f,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==V?(b=s.jsxs("div",{className:V,children:[i,x]}),e[16]=x,e[17]=V,e[18]=b):b=e[18];let h;return e[19]!==b||e[20]!==d?(h=s.jsx("div",{className:d,children:b}),e[19]=b,e[20]=d,e[21]=h):h=e[21],h}function Vd(t){const e=$.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:l}=t;let c,d;e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const u=r.current,V=n.current;if(!u||!V||!o)return;const i=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const g=V.scrollHeight,p=V.scrollTop;await l(),requestAnimationFrame(()=>{const x=V.scrollHeight;V.scrollTop=p+(x-g)})},{root:V,rootMargin:"200px 0px 0px 0px"});return i.observe(u),()=>i.disconnect()},d=[n,r,o,a,l],e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=d):(c=e[5],d=e[6]),S.useEffect(c,d)}function fd(t){const e=$.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=U("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function md(t){const e=$.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function pd(t){const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function hd(){const t=$.c(30),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a}=Ue(),l=$r(e);let c;t[0]!==l?(c=l.at(-1),t[0]=l,t[1]=c):c=t[1];const d=c,V=ma()*na+16,i=S.useRef(null),m=S.useRef(null);let f;t[2]!==a||t[3]!==r||t[4]!==o?(f={scrollRef:i,sentinelRef:m,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a},t[2]=a,t[3]=r,t[4]=o,t[5]=f):f=t[5],Vd(f);let g;t[6]!==V?(g={paddingBottom:V},t[6]=V,t[7]=g):g=t[7];let p;t[8]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("div",{ref:m,"aria-hidden":!0,className:"h-px"}),t[8]=p):p=t[8];let x;t[9]!==o?(x=o&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),t[9]=o,t[10]=x):x=t[10];let b;if(t[11]!==l||t[12]!==n){let j;t[14]!==l.length||t[15]!==n?(j=(A,w)=>s.jsx(Jt,{pair:A,isLastPair:!1,status:w===l.length-1?n:void 0},`pair-${A.user?.id??A.assistant?.id}`),t[14]=l.length,t[15]=n,t[16]=j):j=t[16],b=l.slice(0,-1).map(j),t[11]=l,t[12]=n,t[13]=b}else b=t[13];let h;t[17]!==x||t[18]!==b?(h=s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[p,x,b]}),t[17]=x,t[18]=b,t[19]=h):h=t[19];let v;t[20]!==d||t[21]!==n?(v=d&&s.jsx("div",{className:"min-h-full min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Jt,{pair:d,isLastPair:!0,status:n},`pair-${d.user?.id??d.assistant?.id}`)}),t[20]=d,t[21]=n,t[22]=v):v=t[22];let y;t[23]!==g||t[24]!==h||t[25]!==v?(y=s.jsxs("div",{ref:i,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",style:g,children:[h,v]}),t[23]=g,t[24]=h,t[25]=v,t[26]=y):y=t[26];let C;return t[27]!==e||t[28]!==y?(C=s.jsx(Or,{messages:e,children:y}),t[27]=e,t[28]=y,t[29]=C):C=t[29],C}function xd(t){const e=$.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const du=Object.assign(fd,{Main:md,Messages:hd,EmptyState:pd,Footer:xd,Input:rd,Provider:vr,ActiveTaskProvider:br,Skeleton:ud,IceBreakers:ta,NoAiProviderEmptyState:Io,CreditsEmptyState:ad,CreditsEyebrow:cd,NoCreditsEyebrow:dd,CreditsExhaustedBanner:ys});export{du as C,Dc as T,li as a,Pc as b,iu as c,Yl as g,gi as i,bl as s,vl as u,cu as w};