decocms 4.449.1 → 4.451.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/dist/client/assets/{AlertCircle-CZ2r-6fw.js → AlertCircle-DrwoGJpd.js} +1 -1
  2. package/dist/client/assets/{AreaChart-FS3XyoCE.js → AreaChart-BAAHWXOl.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-CUyvjw-L.js → ArrowLeft-DKYwT7KB.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DL-SqfEN.js → ArrowUp-NsPNRi9p.js} +1 -1
  5. package/dist/client/assets/{Building02-DHvWrFPu.js → Building02-DlH3FV2M.js} +1 -1
  6. package/dist/client/assets/{CartesianChart--cOSR3Jk.js → CartesianChart-8XeONUcg.js} +1 -1
  7. package/dist/client/assets/{Check-Xxxm4n9N.js → Check-BcGsLSsp.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-BIdsej-O.js → CheckCircle-iXm3h-fF.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CjbQc22U.js → ChevronUp-BAvbedXO.js} +1 -1
  10. package/dist/client/assets/{Copy01-BsGAkEj7.js → Copy01-C_KnfAlj.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-CdUq8Vzt.js → CreditCard01-B7CL5INn.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-B7TYh03O.js → DotsVertical-wjfpXF6W.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-R_14A7h7.js → ErrorBarContext-JpptrruU.js} +1 -1
  14. package/dist/client/assets/{Image01-Cm62Gz39.js → Image01-BVwA4uCp.js} +1 -1
  15. package/dist/client/assets/{Key01-ClO0ouA9.js → Key01-C3aJH3VU.js} +1 -1
  16. package/dist/client/assets/{Line-BMudRu9O.js → Line-CE2RR3X9.js} +1 -1
  17. package/dist/client/assets/{Link01-jFnxVzfa.js → Link01-BezCCi1I.js} +1 -1
  18. package/dist/client/assets/{LinkBroken01-DAzor-5J.js → LinkBroken01-CYAPpruG.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-CRGszGOd.js → LinkExternal01-D_cGFYPK.js} +1 -1
  20. package/dist/client/assets/{Monitor01-Cx1CPXa6.js → Monitor01-R0RI8JD-.js} +1 -1
  21. package/dist/client/assets/{Palette-Bw3lu3zp.js → Palette-Bh_thK5-.js} +1 -1
  22. package/dist/client/assets/{Plus-CB7d6UWu.js → Plus-GNsqHUli.js} +1 -1
  23. package/dist/client/assets/{SearchMd-L7QUcOTu.js → SearchMd-DeSQISfo.js} +1 -1
  24. package/dist/client/assets/{Sector-BfSkdIGm.js → Sector-CPFqrWxD.js} +1 -1
  25. package/dist/client/assets/{ShoppingBag01-sD-3dhUV.js → ShoppingBag01-P4dMHDVk.js} +1 -1
  26. package/dist/client/assets/{Sun-BY5kKfkJ.js → Sun-7PdNidQ5.js} +1 -1
  27. package/dist/client/assets/{Tool01-D45Ut_f6.js → Tool01-CWjV8YTI.js} +1 -1
  28. package/dist/client/assets/{Trash01-CDoa1NJh.js → Trash01-BJ_e57Kj.js} +1 -1
  29. package/dist/client/assets/{Upload01-B-X-AhmC.js → Upload01-3jf5OQDv.js} +1 -1
  30. package/dist/client/assets/{User01-DB2iYIZ6.js → User01-CN7JcgS_.js} +1 -1
  31. package/dist/client/assets/{UserSquare-C8QKc8iC.js → UserSquare-CEkD4_s5.js} +1 -1
  32. package/dist/client/assets/{Users01-CM8VThr8.js → Users01-B-RFC-RT.js} +1 -1
  33. package/dist/client/assets/{X-BB3WvJxy.js → X-DvEbwZ22.js} +1 -1
  34. package/dist/client/assets/{XAxis-qZdw3jBu.js → XAxis-DdJd7RhS.js} +1 -1
  35. package/dist/client/assets/{XClose-knQXpnnU.js → XClose-eArhRgkd.js} +1 -1
  36. package/dist/client/assets/{ZoomOut-Cq_Zt2ir.js → ZoomOut-B5FfXkUf.js} +1 -1
  37. package/dist/client/assets/{access-gate-CMQ4v3QC.js → access-gate-Cno0bRAg.js} +1 -1
  38. package/dist/client/assets/{add-connection-dialog-DlAKTxBm.js → add-connection-dialog-BRrDiP3N.js} +1 -1
  39. package/dist/client/assets/{agent-analytics-mlEzY5zy.js → agent-analytics-ZqkZ1GcW.js} +1 -1
  40. package/dist/client/assets/agent-app-DrzBZfr1.js +1 -0
  41. package/dist/client/assets/{agent-assets-Dd8Wyh0x.js → agent-assets-2FdntYeU.js} +1 -1
  42. package/dist/client/assets/{agent-automation-WHMHg6XB.js → agent-automation-DeOilbKj.js} +1 -1
  43. package/dist/client/assets/{agent-automations-B9OGThwg.js → agent-automations-CU5BfClm.js} +1 -1
  44. package/dist/client/assets/{agent-connect-sources-BOsscNwu.js → agent-connect-sources-BlWCNkZ9.js} +1 -1
  45. package/dist/client/assets/agent-deck-CMkJu0nT.js +1 -0
  46. package/dist/client/assets/{agent-e2e-C1js2PVO.js → agent-e2e-Dp5CImx5.js} +1 -1
  47. package/dist/client/assets/{agent-experiments-C8kLOiyW.js → agent-experiments-CT9FOKqn.js} +1 -1
  48. package/dist/client/assets/{agent-file-CF2jQWCf.js → agent-file-BWzZimsi.js} +1 -1
  49. package/dist/client/assets/{agent-git-BMtQgaRT.js → agent-git-C1iinKRI.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-Co798KFZ.js → agent-hosting-BsslI9uH.js} +1 -1
  51. package/dist/client/assets/agent-icon-CfuzWIKW.js +1 -0
  52. package/dist/client/assets/agent-library-BnziJi08.js +1 -0
  53. package/dist/client/assets/agent-library-file-Cf4X2sXR.js +1 -0
  54. package/dist/client/assets/{agent-monitor-BOIQ7Aqz.js → agent-monitor-C2aIDenY.js} +1 -1
  55. package/dist/client/assets/{agent-overview-DKSCuoWD.js → agent-overview-DDbsx1gU.js} +1 -1
  56. package/dist/client/assets/agent-settings-CXCG6lM5.js +1 -0
  57. package/dist/client/assets/agent-site-editor-code-BA8Iz10L.js +2 -0
  58. package/dist/client/assets/agent-site-editor-content-Cboi32wv.js +9 -0
  59. package/dist/client/assets/{agent-site-editor-preview-DjK1fgkE.js → agent-site-editor-preview-C9chmhlV.js} +3 -3
  60. package/dist/client/assets/{agent-site-editor-RvFdvBuC.js → agent-site-editor-xt5GtnuW.js} +1 -1
  61. package/dist/client/assets/agent-view-CWGAdnJH.js +1 -0
  62. package/dist/client/assets/{agent-view-guard-BW6hQdkX.js → agent-view-guard-Vq5CpblU.js} +1 -1
  63. package/dist/client/assets/{agents-list-CPKokLjm.js → agents-list-L_NaMW9r.js} +1 -1
  64. package/dist/client/assets/{ai-providers-lnTymIIa.js → ai-providers-C1Gld-NP.js} +1 -1
  65. package/dist/client/assets/{alert-CyIaIZtA.js → alert-DSDuF6qI.js} +1 -1
  66. package/dist/client/assets/{alert-dialog-Bkxa5kpY.js → alert-dialog-BbSmZoVi.js} +1 -1
  67. package/dist/client/assets/{analytics-sections-VpFg-3NF.js → analytics-sections-B7erlEU9.js} +1 -1
  68. package/dist/client/assets/{api-keys-BsUUQFi9.js → api-keys-DJHmuI-k.js} +1 -1
  69. package/dist/client/assets/api-keys-bQee7GZd.js +1 -0
  70. package/dist/client/assets/app-editor-BUUQAodh.js +1 -0
  71. package/dist/client/assets/{asset-utils-CEIfOX2f.js → asset-utils-CiYXoNyJ.js} +1 -1
  72. package/dist/client/assets/{auth-bIc0P9RV.js → auth-5kOh9gsa.js} +1 -1
  73. package/dist/client/assets/{auth-catchall-C58S_HOO.js → auth-catchall-DxlXq7tK.js} +1 -1
  74. package/dist/client/assets/{auth-entry-Dtfj-HKj.js → auth-entry-Exunf2v5.js} +1 -1
  75. package/dist/client/assets/{auth-split-layout-CotD4M6V.js → auth-split-layout-BAIpdvCx.js} +1 -1
  76. package/dist/client/assets/{authenticate-and-persist-oauth-CPk9K9qy.js → authenticate-and-persist-oauth-IbhNDJn9.js} +1 -1
  77. package/dist/client/assets/{automation-list-row-DmmPl7Bw.js → automation-list-row-BGPK9DDr.js} +1 -1
  78. package/dist/client/assets/{automation-runs-DVnZHoMd.js → automation-runs-79Bdx95q.js} +1 -1
  79. package/dist/client/assets/{automations-BCKWj8gN.js → automations-DEsgrDFl.js} +1 -1
  80. package/dist/client/assets/{autosend-Cgp0Kt47.js → autosend-CsHrH9Xo.js} +1 -1
  81. package/dist/client/assets/{avatar-BW3U9bUq.js → avatar-CrasAAzq.js} +1 -1
  82. package/dist/client/assets/{badge-DRtzW34c.js → badge-BrDXjbHd.js} +1 -1
  83. package/dist/client/assets/block-document-CWFqlSnH.js +3 -0
  84. package/dist/client/assets/{blocks-preview-workspace-context-CIe2ZImm.js → blocks-preview-workspace-context-DAcrAS0Y.js} +1 -1
  85. package/dist/client/assets/{blog-schema-BoXFEaF0.js → blog-schema-CpOSYi5o.js} +1 -1
  86. package/dist/client/assets/{buckets-B66lPPhY.js → buckets-CJHv6B92.js} +1 -1
  87. package/dist/client/assets/{build-improve-prompt-doc-ARaFWjqz.js → build-improve-prompt-doc-Dp9hBbaC.js} +1 -1
  88. package/dist/client/assets/{calendar-aTytw_rp.js → calendar-DJbd_Mk0.js} +1 -1
  89. package/dist/client/assets/{capability-load-error-B2aK95hA.js → capability-load-error-B8JQAANB.js} +1 -1
  90. package/dist/client/assets/category-editor-DdyY6pMr.js +1 -0
  91. package/dist/client/assets/{chart-BS6TSfxM.js → chart-CrYOX1s7.js} +1 -1
  92. package/dist/client/assets/{chat-context-D_aG2yAX.js → chat-context-CbVc7tEo.js} +1 -1
  93. package/dist/client/assets/{chat-draft-kw4JBxuT.js → chat-draft-DCJfKWx2.js} +1 -1
  94. package/dist/client/assets/{checkbox-DnZkZOM8.js → checkbox-C68xjrg5.js} +1 -1
  95. package/dist/client/assets/{choose-editor-C3yqk0fB.js → choose-editor-9DBH_8WX.js} +1 -1
  96. package/dist/client/assets/{claim-phase-copy-BoMuJBb0.js → claim-phase-copy-C42LUZgr.js} +1 -1
  97. package/dist/client/assets/{cli-auth-success-DbteZLq9.js → cli-auth-success-CQ-Ph_Z8.js} +1 -1
  98. package/dist/client/assets/{client-icons-uj1PKgBg.js → client-icons-B2afUpOp.js} +1 -1
  99. package/dist/client/assets/{collapsible-B1Xa1jKR.js → collapsible-BouI-hE9.js} +1 -1
  100. package/dist/client/assets/{collection-detail-D36i0K3U.js → collection-detail-BIyd346E.js} +1 -1
  101. package/dist/client/assets/{collection-display-button-uMlnRYuM.js → collection-display-button-CJGrnpdv.js} +1 -1
  102. package/dist/client/assets/{collection-search-BM261TmD.js → collection-search-FRa3rbYr.js} +1 -1
  103. package/dist/client/assets/{collection-table-wrapper-xxoxiw2q.js → collection-table-wrapper-CWM8G_TB.js} +1 -1
  104. package/dist/client/assets/{collection-tabs-CjB8WZDI.js → collection-tabs-JVe-o8Om.js} +1 -1
  105. package/dist/client/assets/{column-rules-DZ44MUki.js → column-rules-D2GeNGaF.js} +1 -1
  106. package/dist/client/assets/{combobox-BDneKP5k.js → combobox-BYzyVsfP.js} +1 -1
  107. package/dist/client/assets/{command-DRa5QzcI.js → command-DA3SiBwF.js} +1 -1
  108. package/dist/client/assets/{companion-mcps-section-CdCBY4T-.js → companion-mcps-section-nJ90DS7n.js} +1 -1
  109. package/dist/client/assets/{config-CAfwygQ8.js → config-CiQU6gsO.js} +1 -1
  110. package/dist/client/assets/{connect-CvjEKlf6.js → connect-BfDqgAhE.js} +1 -1
  111. package/dist/client/assets/{connect-layout-CAq_juBv.js → connect-layout-D9lxOI4T.js} +1 -1
  112. package/dist/client/assets/{connection-CcGTFKQt.js → connection-B1RIZdkW.js} +1 -1
  113. package/dist/client/assets/{connection-card-xm3ewa1i.js → connection-card-CBKnCj0k.js} +1 -1
  114. package/dist/client/assets/{connection-detail-BVWn0aEu.js → connection-detail-DCoDGHIg.js} +1 -1
  115. package/dist/client/assets/{connection-form-helpers-R9FNwPaA.js → connection-form-helpers-CTzk01jW.js} +1 -1
  116. package/dist/client/assets/{connections-DhDNHYXZ.js → connections-g7AYRhCW.js} +1 -1
  117. package/dist/client/assets/context-CtvGGIuc.js +1 -0
  118. package/dist/client/assets/{context-menu-CRrDeZev.js → context-menu-BHpyeRN3.js} +1 -1
  119. package/dist/client/assets/{create-organization-dialog-bjUb_uRH.js → create-organization-dialog-DM0EVF-D.js} +1 -1
  120. package/dist/client/assets/{daily-pulse-Io-Crvam.js → daily-pulse-BOdn-UxC.js} +1 -1
  121. package/dist/client/assets/{decopilot-CAfMXinP.js → decopilot-BEZXwH2l.js} +1 -1
  122. package/dist/client/assets/{device-hint-dLg0eqvh.js → device-hint-Bcob3UqV.js} +1 -1
  123. package/dist/client/assets/{dialog-CrYpY3Eq.js → dialog-BJny2srB.js} +1 -1
  124. package/dist/client/assets/{discover-O-E-uPSJ.js → discover-Be00RGyY.js} +1 -1
  125. package/dist/client/assets/{domain-settings-612gOLKf.js → domain-settings-ChkNgBLE.js} +1 -1
  126. package/dist/client/assets/{download-app-dialog-CssiauNE.js → download-app-dialog-CYxTt_wl.js} +1 -1
  127. package/dist/client/assets/{drawer-BoaD9rxZ.js → drawer-ugS5r2iQ.js} +1 -1
  128. package/dist/client/assets/{editor-B1yj_Rg3.js → editor-BFX6ra4l.js} +1 -1
  129. package/dist/client/assets/{empty-state-CC3oHvo4.js → empty-state-BgjT33mH.js} +1 -1
  130. package/dist/client/assets/{empty-state-BgRZvqsL.js → empty-state-CrLuHHe8.js} +1 -1
  131. package/dist/client/assets/{extract-connection-data-CeW7ej-C.js → extract-connection-data-DzRM76JF.js} +1 -1
  132. package/dist/client/assets/{feature-gate-DMDbne2B.js → feature-gate-D5RLRNV5.js} +1 -1
  133. package/dist/client/assets/{feature-paywall-CdbrbN16.js → feature-paywall-BOUIyLME.js} +1 -1
  134. package/dist/client/assets/{file-explorer-Cwsg0yOv.js → file-explorer-WHZll4h4.js} +1 -1
  135. package/dist/client/assets/{file-preview-CD-YG8wZ.js → file-preview-C0y1VI3d.js} +1 -1
  136. package/dist/client/assets/{file-share-button-CFtNWg9R.js → file-share-button-BIJj7BbT.js} +2 -2
  137. package/dist/client/assets/{file-type-icon-DHOlz79V.js → file-type-icon-CvWWoRAO.js} +1 -1
  138. package/dist/client/assets/flat-project-DklPJ7ot.js +1 -0
  139. package/dist/client/assets/{folder-icon-Dy8JE9nj.js → folder-icon-CMZRw_lE.js} +1 -1
  140. package/dist/client/assets/{form-uqvM1Jp0.js → form-BsbEXxEk.js} +1 -1
  141. package/dist/client/assets/{gateway-client-BMuj7uLa.js → gateway-client-DPQb-ray.js} +1 -1
  142. package/dist/client/assets/general-DcmU5ljh.js +1 -0
  143. package/dist/client/assets/{home-socKDX4c.js → home-Cluz7ZcZ.js} +1 -1
  144. package/dist/client/assets/{icon-button-D7O1wynv.js → icon-button-Cpld4nrH.js} +1 -1
  145. package/dist/client/assets/{index-SV7bFlbR.js → index-B7-3R-Wc.js} +1 -1
  146. package/dist/client/assets/{index-CpOfh4QE.js → index-BmjSoeeS.js} +1 -1
  147. package/dist/client/assets/{index-B3rJSOmg.js → index-BnLwnO1e.js} +1 -1
  148. package/dist/client/assets/{index-rnfQP0qj.js → index-Bnq5a3RF.js} +1 -1
  149. package/dist/client/assets/{index-ZD4Fz0cx.js → index-BsSf6-Tp.js} +1 -1
  150. package/dist/client/assets/{index-HWxR2Ep5.js → index-C5LlvZFc.js} +4 -4
  151. package/dist/client/assets/{index-DnVCHdD7.js → index-CFVUUkFw.js} +1 -1
  152. package/dist/client/assets/{index-DrLxpkVi.js → index-CMWyW-nP.js} +1 -1
  153. package/dist/client/assets/{index-BSPOgv2I.js → index-CMxk_Q0b.js} +3 -3
  154. package/dist/client/assets/{index-CyudKxKs.js → index-CeE78dnN.js} +1 -1
  155. package/dist/client/assets/{index-DfGHT-t4.js → index-DR8phzsm.js} +1 -1
  156. package/dist/client/assets/{index-lLNfJgr6.js → index-Dm8tF0P6.js} +1 -1
  157. package/dist/client/assets/{index-ClrFphBQ.js → index-DnCv4gDA.js} +1 -1
  158. package/dist/client/assets/{index-eKgwFeS5.js → index-LUzyiStE.js} +1 -1
  159. package/dist/client/assets/{index-redirect-xE_km-fe.js → index-redirect-2EYYlLWV.js} +1 -1
  160. package/dist/client/assets/{index-PwkDSqfp.js → index-svk4_uTN.js} +1 -1
  161. package/dist/client/assets/{infiniteQueryObserver-BQoespCm.js → infiniteQueryObserver-DS3r5RyQ.js} +1 -1
  162. package/dist/client/assets/{infra-billing-B0jRZLlu.js → infra-billing-BP0k6gQd.js} +1 -1
  163. package/dist/client/assets/{input-L6zRtw2u.js → input-BYbHl7fH.js} +1 -1
  164. package/dist/client/assets/{input-BDyBZ261.js → input-DtRnGymn.js} +7 -7
  165. package/dist/client/assets/{input-CxP1FO-T.js → input-NPHEwu7D.js} +1 -1
  166. package/dist/client/assets/{integration-icon-BmIuOhyq.js → integration-icon-Db99lv2a.js} +1 -1
  167. package/dist/client/assets/{label-CFAv__xD.js → label-DFV1EjGx.js} +1 -1
  168. package/dist/client/assets/{layout-DZyc2QyB.js → layout-DT9fBwIn.js} +1 -1
  169. package/dist/client/assets/{legacy-agents-deep-CU_wHsOn.js → legacy-agents-deep-CB9Z2QQP.js} +1 -1
  170. package/dist/client/assets/{legacy-main-redirect-3Gm3Yt2d.js → legacy-main-redirect-DL_OU_ve.js} +1 -1
  171. package/dist/client/assets/library-DVDKWOCj.js +1 -0
  172. package/dist/client/assets/{library-tab-ByN2HhqC.js → library-tab-zwg8I-zT.js} +1 -1
  173. package/dist/client/assets/{login-CUbYBhTN.js → login-B_u9hKdd.js} +1 -1
  174. package/dist/client/assets/{markdown-CqclEMlW.js → markdown-BNkxJvOO.js} +1 -1
  175. package/dist/client/assets/mcp-app-renderer-BEPdGRWf.js +11 -0
  176. package/dist/client/assets/{mcp-oauth-Cu8OJU0d.js → mcp-oauth-B9fQInjX.js} +1 -1
  177. package/dist/client/assets/{members-BOSDDP3d.js → members-BDa5FNmm.js} +1 -1
  178. package/dist/client/assets/{memory-hbzEO1t9.js → memory-DLlNfrtQ.js} +1 -1
  179. package/dist/client/assets/{message-templates-DzqE5_jI.js → message-templates-BfVwoNvk.js} +1 -1
  180. package/dist/client/assets/{mini-report-page-BJ96T-Ya.js → mini-report-page-Ci8p_7Qc.js} +1 -1
  181. package/dist/client/assets/{mock-board-7P2uFjO8.js → mock-board-CWXm4av0.js} +1 -1
  182. package/dist/client/assets/{monaco-editor-DIyyItcZ.js → monaco-editor-D29Kd2Kr.js} +1 -1
  183. package/dist/client/assets/{monitoring-stats-row-BG4-JAlt.js → monitoring-stats-row-slQbN1nA.js} +1 -1
  184. package/dist/client/assets/{multi-select-BopnODiG.js → multi-select-W9MlzeC1.js} +1 -1
  185. package/dist/client/assets/{mustache-XqAsCmLc.js → mustache-BgbWTbKV.js} +1 -1
  186. package/dist/client/assets/{new-project-dialog-VKI7H_TP.js → new-project-dialog-CJlermXp.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-D8an7xgw.js → oauth-callback-BuGfhU-z.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-DttkbgyU.js → oauth-callback-ai-provider-BAJwl5IS.js} +1 -1
  189. package/dist/client/assets/{onboarding-SeTEsrRv.js → onboarding-kTCKp428.js} +1 -1
  190. package/dist/client/assets/{openai-conversation-CTeax-iN.js → openai-conversation-C-yPKbTo.js} +1 -1
  191. package/dist/client/assets/{optimistic-project-sidebar-views-ColYeNGR.js → optimistic-project-sidebar-views-CIecA9o-.js} +1 -1
  192. package/dist/client/assets/{org-file-open-context-T9d_LmYT.js → org-file-open-context-C7-ltXbm.js} +1 -1
  193. package/dist/client/assets/{organization-choice-BgYRAOW5.js → organization-choice-D3SzAbEY.js} +1 -1
  194. package/dist/client/assets/{orgs-Dp05bfGb.js → orgs-BGO2o2om.js} +1 -1
  195. package/dist/client/assets/{page-seo-form--09pJM6C.js → page-seo-form-syG_NsyC.js} +1 -1
  196. package/dist/client/assets/{pair-BnYrih-e.js → pair-BXahrBJ-.js} +7 -7
  197. package/dist/client/assets/{plan-ladder-BNbJXBN6.js → plan-ladder-jHsL2xiU.js} +1 -1
  198. package/dist/client/assets/{popover-FL0SUsUE.js → popover-98ItoIiE.js} +1 -1
  199. package/dist/client/assets/{post-calendar-B-ch6tRM.js → post-calendar-DA7gf-iD.js} +1 -1
  200. package/dist/client/assets/{post-editor-BFIdye1u.js → post-editor-DJSWFkVZ.js} +2 -2
  201. package/dist/client/assets/{preview-content-DdGAiWOw.js → preview-content-B3SrY9U6.js} +1 -1
  202. package/dist/client/assets/{preview-dialog-Dfx7xRLA.js → preview-dialog-DtE8hySm.js} +1 -1
  203. package/dist/client/assets/{profile-CkGAuvwn.js → profile-BqkkPgHb.js} +1 -1
  204. package/dist/client/assets/{project-app-view-B4wg3-js.js → project-app-view-DJNcLbfl.js} +1 -1
  205. package/dist/client/assets/{project-feed-djzrblst.js → project-feed-5oGhucIT.js} +1 -1
  206. package/dist/client/assets/{project-icon-xPNeTbRo.js → project-icon-ss5TCI0R.js} +1 -1
  207. package/dist/client/assets/project-reports-BLn_609q.js +1 -0
  208. package/dist/client/assets/project-tasks-B2djFoeX.js +1 -0
  209. package/dist/client/assets/{projects-CwuTDH8z.js → projects-C0NE_8ue.js} +1 -1
  210. package/dist/client/assets/{projects-empty-state-9UvM93cC.js → projects-empty-state-AWojsVAU.js} +1 -1
  211. package/dist/client/assets/{prompts-DvvuLzj1.js → prompts-CkLT7Pp3.js} +1 -1
  212. package/dist/client/assets/record-editor-DyjHgKTD.js +1 -0
  213. package/dist/client/assets/{redirect-editor-x2got8qn.js → redirect-editor-Co-NnhcC.js} +1 -1
  214. package/dist/client/assets/{reports-DgxeoCiI.js → reports-BZp0upxy.js} +1 -1
  215. package/dist/client/assets/{reports-onboarding-Bwu9_9mO.js → reports-onboarding-BBsNQaBV.js} +1 -1
  216. package/dist/client/assets/{reports-tab-B6bOOGao.js → reports-tab-yZ-nVssc.js} +2 -2
  217. package/dist/client/assets/reports-z77dCvga.js +1 -0
  218. package/dist/client/assets/{repositories-Cu-pLRjV.js → repositories-DuKOCOxg.js} +1 -1
  219. package/dist/client/assets/{repository-binding-CMSObH6I.js → repository-binding-BzfYTDYg.js} +1 -1
  220. package/dist/client/assets/{repository-import-picker-B5uDnNQ_.js → repository-import-picker-BZ4SbZxQ.js} +1 -1
  221. package/dist/client/assets/{repository-picker-CHQX2zi4.js → repository-picker-Bzznh2XU.js} +1 -1
  222. package/dist/client/assets/{require-capability-C-J2G0JP.js → require-capability-ZVnNGQoT.js} +1 -1
  223. package/dist/client/assets/{required-auth-layout-C1HzYYkM.js → required-auth-layout-DanliwF9.js} +1 -1
  224. package/dist/client/assets/{reset-password-NZnIlfUQ.js → reset-password-DW3qLKpy.js} +1 -1
  225. package/dist/client/assets/{resizable-BWcGeSs4.js → resizable-DywAIc1-.js} +1 -1
  226. package/dist/client/assets/resolve-tab-icon-C5M35tEP.js +1 -0
  227. package/dist/client/assets/review-settings-Cu2P77Gp.js +1 -0
  228. package/dist/client/assets/{rich-text-link-control-B4yYmVrn.js → rich-text-link-control-DGgBIkoQ.js} +1 -1
  229. package/dist/client/assets/{roles-FlVitblA.js → roles-55Tdfjs_.js} +1 -1
  230. package/dist/client/assets/{route-UCSOp9Po.js → route-BSEkxVC-.js} +1 -1
  231. package/dist/client/assets/{route-BPxGCDd1.js → route-BvV_LTTA.js} +1 -1
  232. package/dist/client/assets/route-efW7oDD1.js +1 -0
  233. package/dist/client/assets/{runnable-block-editor-m1Qq5JeU.js → runnable-block-editor-246vsgYp.js} +1 -1
  234. package/dist/client/assets/{sandbox-lifecycle-context-RZq7OXus.js → sandbox-lifecycle-context-BvXjf7rx.js} +1 -1
  235. package/dist/client/assets/{schema-DJA56Znc.js → schema-DvFu1ToO.js} +1 -1
  236. package/dist/client/assets/{scroll-area-CqKR-j9d.js → scroll-area-DaBuMKS9.js} +1 -1
  237. package/dist/client/assets/{search-input-KkYEYKdn.js → search-input--Cs2kN0G.js} +1 -1
  238. package/dist/client/assets/{search-toggle-u0HPBSmW.js → search-toggle-C3WefJ2y.js} +1 -1
  239. package/dist/client/assets/{secret-picker-cKJXkGmK.js → secret-picker-CEdXEQdI.js} +1 -1
  240. package/dist/client/assets/{secrets-D73SLAhe.js → secrets-CqHQ9R62.js} +1 -1
  241. package/dist/client/assets/{sections-editor-DdB2ICl9.js → sections-editor-BBgqWNXJ.js} +1 -1
  242. package/dist/client/assets/{select-vA5aLKVe.js → select-BlojSjop.js} +1 -1
  243. package/dist/client/assets/{select-model-CeVR5Lsq.js → select-model-qkZsSZ-s.js} +1 -1
  244. package/dist/client/assets/{seo-editor-6NBXqyeG.js → seo-editor-vSFjIyB8.js} +1 -1
  245. package/dist/client/assets/{separator-DWmeqDpd.js → separator-DVd2LxRQ.js} +1 -1
  246. package/dist/client/assets/{settings-tab-D2HRWLjD.js → settings-tab-BB1cUOmY.js} +1 -1
  247. package/dist/client/assets/{sheet-DiRUSwQB.js → sheet-DhV5S-lN.js} +1 -1
  248. package/dist/client/assets/{shell-layout-d_sSLfND.js → shell-layout-BCgx5xUt.js} +1 -1
  249. package/dist/client/assets/{skills-BkZysL5d.js → skills-CGor4YeE.js} +1 -1
  250. package/dist/client/assets/{sso-BWvpwg2A.js → sso-DT447B-z.js} +1 -1
  251. package/dist/client/assets/{suggestion-BkCheNCW.js → suggestion-20OWsU93.js} +1 -1
  252. package/dist/client/assets/{switch-Oe1o4Jst.js → switch-CMfc7QV5.js} +1 -1
  253. package/dist/client/assets/{synced-repos-CsRh95sP.js → synced-repos-mHQN0OHN.js} +1 -1
  254. package/dist/client/assets/{tab-icon-glyph-USELPr6s.js → tab-icon-glyph-Cv2jvczH.js} +1 -1
  255. package/dist/client/assets/{table-CDMcGFDs.js → table-Dh5pobpb.js} +1 -1
  256. package/dist/client/assets/{tabs-DpX5BLsl.js → tabs-BQf21wqw.js} +1 -1
  257. package/dist/client/assets/{task-board-DQoxAg0z.js → task-board-DGnwsIns.js} +1 -1
  258. package/dist/client/assets/{task-route-BaUE_XMH.js → task-route-T3lqK1Fh.js} +1 -1
  259. package/dist/client/assets/{task-status-CayXiTCC.js → task-status-BXB-vdW8.js} +1 -1
  260. package/dist/client/assets/{taskboard-analytics-CN9qSipL.js → taskboard-analytics-DorE9nZU.js} +1 -1
  261. package/dist/client/assets/tasks-BCug_duM.js +1 -0
  262. package/dist/client/assets/{tasks-Dd_4KjmD.js → tasks-DJSTWu0I.js} +1 -1
  263. package/dist/client/assets/{textarea-BBDC4DVr.js → textarea-CVYfh0wC.js} +1 -1
  264. package/dist/client/assets/{thread-analytics-NwQ8ejQ_.js → thread-analytics-DnKw3wA2.js} +1 -1
  265. package/dist/client/assets/{thread-button-BAtfkAD5.js → thread-button-DLBvXKcS.js} +1 -1
  266. package/dist/client/assets/{thread-intent-DQKTpQfu.js → thread-intent-Cc5BAaIc.js} +1 -1
  267. package/dist/client/assets/{thread-route-ssC9pRVm.js → thread-route-BfHTBheT.js} +1 -1
  268. package/dist/client/assets/{thread-route-C62apffp.js → thread-route-CmSAw42O.js} +1 -1
  269. package/dist/client/assets/{thread-sheet-body-B_nVAoRK.js → thread-sheet-body-tvi3Cu-i.js} +1 -1
  270. package/dist/client/assets/{toggle-group-CjnaoGYT.js → toggle-group-D_XfPgvt.js} +1 -1
  271. package/dist/client/assets/{toolbar-icon-button-BtSeYwLl.js → toolbar-icon-button-CUSdjojs.js} +1 -1
  272. package/dist/client/assets/{tooltip-CBWyBQCl.js → tooltip-66nc6La-.js} +1 -1
  273. package/dist/client/assets/{track-bXEcNWqe.js → track-C-MP37D4.js} +1 -1
  274. package/dist/client/assets/{types-DBj9i1zi.js → types-Ch9SdRcv.js} +1 -1
  275. package/dist/client/assets/{usage-stats-MicZljk7.js → usage-stats-yiZ6SKAb.js} +1 -1
  276. package/dist/client/assets/{use-ai-providers-jUulD26_.js → use-ai-providers-M9Gfv9f8.js} +1 -1
  277. package/dist/client/assets/{use-automations-CEYClL9i.js → use-automations-CY_zEchX.js} +1 -1
  278. package/dist/client/assets/{use-autosave-CQfPajqv.js → use-autosave-Cn0WfmQ8.js} +1 -1
  279. package/dist/client/assets/{use-chat-layout-state-CbytSCzM.js → use-chat-layout-state-EbMrj1Yk.js} +1 -1
  280. package/dist/client/assets/{use-clock-tick-BUO999BZ.js → use-clock-tick-Db61eAzB.js} +1 -1
  281. package/dist/client/assets/{use-connect-companion-TYMdFN1j.js → use-connect-companion-DxqzImGI.js} +1 -1
  282. package/dist/client/assets/{use-connection-B9WHtxSO.js → use-connection-aogXB8HT.js} +1 -1
  283. package/dist/client/assets/{use-copy-BTWDFkjW.js → use-copy-B1c_EBRx.js} +1 -1
  284. package/dist/client/assets/{use-create-virtual-mcp-CyUZA-li.js → use-create-virtual-mcp-CV_Qkq--.js} +1 -1
  285. package/dist/client/assets/{use-date-fns-locale-BjWu6H9m.js → use-date-fns-locale-B2cpFjnp.js} +1 -1
  286. package/dist/client/assets/{use-debounced-autosave-BKR9kxYh.js → use-debounced-autosave-CNHp8gYO.js} +1 -1
  287. package/dist/client/assets/{use-debounced-value-XwsAZBkp.js → use-debounced-value-C3ROkLpe.js} +1 -1
  288. package/dist/client/assets/{use-deco-credits-CzkmZZZy.js → use-deco-credits-u3-i822p.js} +1 -1
  289. package/dist/client/assets/{use-decopilot-events-C2Pzma6G.js → use-decopilot-events-DSjzPVBT.js} +1 -1
  290. package/dist/client/assets/{use-delete-connection-BmpOu0M4.js → use-delete-connection-DUF2NW3l.js} +1 -1
  291. package/dist/client/assets/{use-deployment-admin-B94yEd9J.js → use-deployment-admin-Cc2a3wOb.js} +1 -1
  292. package/dist/client/assets/{use-fast-preview-draft-url-GddpS0DZ.js → use-fast-preview-draft-url-ClRKZFue.js} +1 -1
  293. package/dist/client/assets/{use-file-configs-BrMAMhvL.js → use-file-configs-CF1-8iPu.js} +1 -1
  294. package/dist/client/assets/{use-infinite-scroll-x37PMcqa.js → use-infinite-scroll-DwjxrCBI.js} +1 -1
  295. package/dist/client/assets/{use-join-requests-B-T0LPqg.js → use-join-requests-CX1Z0mNX.js} +1 -1
  296. package/dist/client/assets/{use-main-panel-tabs-D9roufQj.js → use-main-panel-tabs-D9RE-lnQ.js} +1 -1
  297. package/dist/client/assets/use-mcp-auth-status-BoAIHl4N.js +1 -0
  298. package/dist/client/assets/{use-mcp-client-DepMR5h0.js → use-mcp-client-B2Vh9Cd7.js} +1 -1
  299. package/dist/client/assets/{use-mcp-prompts-Bjb4h1TD.js → use-mcp-prompts-BBIzvKJ-.js} +1 -1
  300. package/dist/client/assets/{use-mcp-tools-ok1u563f.js → use-mcp-tools-BTm2d3TE.js} +1 -1
  301. package/dist/client/assets/{use-members-zL7ESsDH.js → use-members-C6qHLZqu.js} +1 -1
  302. package/dist/client/assets/{use-mobile-Bgz25Qmq.js → use-mobile-Du3isCXQ.js} +1 -1
  303. package/dist/client/assets/{use-navigate-to-agent-DRcEQJw4.js → use-navigate-to-agent-DeIS5d_A.js} +1 -1
  304. package/dist/client/assets/use-new-blocks-editor-Bq5-foqH.js +1 -0
  305. package/dist/client/assets/{use-open-billing-url-d7KMUwR_.js → use-open-billing-url-C43__85H.js} +1 -1
  306. package/dist/client/assets/{use-org-auth-client-G2KA5nw3.js → use-org-auth-client-BBNuWvcV.js} +1 -1
  307. package/dist/client/assets/{use-org-fs-zJoB2iqQ.js → use-org-fs-Can_Zv1k.js} +1 -1
  308. package/dist/client/assets/{use-org-repo-syncs-BLBkY1kx.js → use-org-repo-syncs-DSCXfgI7.js} +1 -1
  309. package/dist/client/assets/{use-org-sso-DhnTeWxC.js → use-org-sso-CW6lGteH.js} +1 -1
  310. package/dist/client/assets/{use-organization-roles-I2byl3QM.js → use-organization-roles-BawJTbcK.js} +1 -1
  311. package/dist/client/assets/{use-organization-settings-C39MKM-d.js → use-organization-settings-Bq69ux21.js} +1 -1
  312. package/dist/client/assets/{use-panel-navigate-CmDIq84u.js → use-panel-navigate-BVY-Wy0A.js} +1 -1
  313. package/dist/client/assets/{use-project-scope-OOD-YqtN.js → use-project-scope-Cg6fEvSs.js} +1 -1
  314. package/dist/client/assets/{use-releases-D5Ile4-b.js → use-releases-BKi-DdL8.js} +1 -1
  315. package/dist/client/assets/{use-reports-diagnostic-DWp2Tuua.js → use-reports-diagnostic-6cATxGHb.js} +1 -1
  316. package/dist/client/assets/{use-secrets-BANymk9v.js → use-secrets-BD6_VEse.js} +1 -1
  317. package/dist/client/assets/{use-section-preview-base-BGZ-85P3.js → use-section-preview-base-BGOkvMCT.js} +1 -1
  318. package/dist/client/assets/{use-session-runtime-BMxBtcXn.js → use-session-runtime-XVdydjwY.js} +1 -1
  319. package/dist/client/assets/{use-tags-CJVDMJxT.js → use-tags-BzBCpaxP.js} +1 -1
  320. package/dist/client/assets/{use-task-board-analytics-Bym1kFw6.js → use-task-board-analytics-OYMnbU1S.js} +1 -1
  321. package/dist/client/assets/{use-task-board-events-CEk5blpI.js → use-task-board-events-j6Gt2_bO.js} +1 -1
  322. package/dist/client/assets/{use-task-metadata-D-lB65bE.js → use-task-metadata-BJMv-ITR.js} +1 -1
  323. package/dist/client/assets/{use-thread-analytics-I29BXaCq.js → use-thread-analytics-2OqfjnUQ.js} +1 -1
  324. package/dist/client/assets/{use-thread-outputs-C9UtpCKG.js → use-thread-outputs-DqGdi_Az.js} +1 -1
  325. package/dist/client/assets/useInfiniteQuery-DpDVtLXw.js +1 -0
  326. package/dist/client/assets/{useQueries-C2htcIyy.js → useQueries-hEYaMROO.js} +1 -1
  327. package/dist/client/assets/useSuspenseInfiniteQuery-Exur-lii.js +1 -0
  328. package/dist/client/assets/{users-DdL6TyrV.js → users-CVUsc3a5.js} +1 -1
  329. package/dist/client/assets/{utils-CKNMlsNR.js → utils-DWTn-3pm.js} +1 -1
  330. package/dist/client/assets/{variant-calendar-IYfe0Ok0.js → variant-calendar-BwZCUSvP.js} +1 -1
  331. package/dist/client/assets/{variant-matcher-override-DeFpVA2m.js → variant-matcher-override-Dv_-MENJ.js} +1 -1
  332. package/dist/client/assets/{view-mode-toggle-Xs3q2g1G.js → view-mode-toggle-D-i9WhgV.js} +1 -1
  333. package/dist/client/assets/{virtual-mcp-D8XA_CG1.js → virtual-mcp-CYrVMkY_.js} +1 -1
  334. package/dist/client/index.html +1 -1
  335. package/dist/server/cli.js +14 -14
  336. package/dist/server/server.js +14 -14
  337. package/package.json +1 -1
  338. package/dist/client/assets/agent-app-B5jUA0Bn.js +0 -1
  339. package/dist/client/assets/agent-deck-DBkOmZCZ.js +0 -1
  340. package/dist/client/assets/agent-icon-Ncp9jZCj.js +0 -1
  341. package/dist/client/assets/agent-library-Dqbt3v2J.js +0 -1
  342. package/dist/client/assets/agent-library-file-BKsMUnRd.js +0 -1
  343. package/dist/client/assets/agent-settings-mn6p1y5w.js +0 -1
  344. package/dist/client/assets/agent-site-editor-code-DYFKAxNM.js +0 -2
  345. package/dist/client/assets/agent-site-editor-content-2o8hHnLT.js +0 -9
  346. package/dist/client/assets/agent-view-BFlErvoh.js +0 -1
  347. package/dist/client/assets/api-keys-q7UewISa.js +0 -1
  348. package/dist/client/assets/app-editor-CdUH-3-4.js +0 -1
  349. package/dist/client/assets/block-document-BsnWmc6a.js +0 -3
  350. package/dist/client/assets/category-editor-CCVIKYQL.js +0 -1
  351. package/dist/client/assets/context-CG40wvqE.js +0 -1
  352. package/dist/client/assets/flat-project-C-rxP_2v.js +0 -1
  353. package/dist/client/assets/general-K5AW1rsS.js +0 -1
  354. package/dist/client/assets/library-Dz-ZWmvM.js +0 -1
  355. package/dist/client/assets/mcp-app-renderer-C1kN5ekK.js +0 -11
  356. package/dist/client/assets/project-reports-pmeTAKhL.js +0 -1
  357. package/dist/client/assets/project-tasks-BZ6hadae.js +0 -1
  358. package/dist/client/assets/record-editor-BmYmQ65G.js +0 -1
  359. package/dist/client/assets/reports-DR6TkE0h.js +0 -1
  360. package/dist/client/assets/resolve-tab-icon-57uNahWH.js +0 -1
  361. package/dist/client/assets/review-settings-DTZPZBmj.js +0 -1
  362. package/dist/client/assets/route-Cyq6kSz7.js +0 -1
  363. package/dist/client/assets/tasks-B3-owb_p.js +0 -1
  364. package/dist/client/assets/use-mcp-auth-status-BNqQlCcI.js +0 -1
  365. package/dist/client/assets/use-new-blocks-editor-qEa50N_M.js +0 -1
  366. package/dist/client/assets/useInfiniteQuery-ak-p-B-L.js +0 -1
  367. package/dist/client/assets/useSuspenseInfiniteQuery-BzpL8p-T.js +0 -1
@@ -1,17 +1,17 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/openai-conversation-CTeax-iN.js","assets/index-HWxR2Ep5.js","assets/index-DoNIk522.css","assets/index-lLNfJgr6.js","assets/gateway-client-BMuj7uLa.js","assets/dialog-CrYpY3Eq.js","assets/X-BB3WvJxy.js","assets/form-uqvM1Jp0.js","assets/label-CFAv__xD.js","assets/input-CxP1FO-T.js","assets/utils-CVEq3hMx.js","assets/org-file-open-context-T9d_LmYT.js","assets/use-mobile-Bgz25Qmq.js","assets/use-panel-navigate-CmDIq84u.js","assets/thread-route-C62apffp.js","assets/use-project-scope-OOD-YqtN.js","assets/repository-binding-CMSObH6I.js","assets/use-mcp-client-DepMR5h0.js","assets/auth-bIc0P9RV.js","assets/tooltip-CBWyBQCl.js","assets/index-DrLxpkVi.js","assets/shell-layout-d_sSLfND.js","assets/avatar-BW3U9bUq.js","assets/User01-DB2iYIZ6.js","assets/Building02-DHvWrFPu.js","assets/UserSquare-C8QKc8iC.js","assets/agent-icon-Ncp9jZCj.js","assets/AlertCircle-CZ2r-6fw.js","assets/Tool01-D45Ut_f6.js","assets/ArrowUp-DL-SqfEN.js","assets/ArrowLeft-CUyvjw-L.js","assets/LinkBroken01-DAzor-5J.js","assets/ShoppingBag01-sD-3dhUV.js","assets/ZoomOut-Cq_Zt2ir.js","assets/CheckCircle-BIdsej-O.js","assets/Check-Xxxm4n9N.js","assets/ChevronUp-CjbQc22U.js","assets/Copy01-BsGAkEj7.js","assets/CreditCard01-CdUq8Vzt.js","assets/DotsVertical-B7TYh03O.js","assets/Image01-Cm62Gz39.js","assets/Palette-Bw3lu3zp.js","assets/XClose-knQXpnnU.js","assets/Key01-ClO0ouA9.js","assets/Link01-jFnxVzfa.js","assets/LinkExternal01-CRGszGOd.js","assets/Monitor01-Cx1CPXa6.js","assets/Sun-BY5kKfkJ.js","assets/Plus-CB7d6UWu.js","assets/SearchMd-L7QUcOTu.js","assets/Trash01-CDoa1NJh.js","assets/Upload01-B-X-AhmC.js","assets/Users01-CM8VThr8.js","assets/download-app-dialog-CssiauNE.js","assets/use-clock-tick-BUO999BZ.js","assets/command-DRa5QzcI.js","assets/index-ZD4Fz0cx.js","assets/integration-icon-BmIuOhyq.js","assets/project-icon-xPNeTbRo.js","assets/new-project-dialog-VKI7H_TP.js","assets/repository-import-picker-B5uDnNQ_.js","assets/use-navigate-to-agent-DRcEQJw4.js","assets/thread-intent-DQKTpQfu.js","assets/backoff-8mStPHYB.js","assets/task-board-DQoxAg0z.js","assets/schema-DJA56Znc.js","assets/slugify-CEUa2lfQ.js","assets/repository-picker-CHQX2zi4.js","assets/useInfiniteQuery-ak-p-B-L.js","assets/infiniteQueryObserver-BQoespCm.js","assets/collection-search-BM261TmD.js","assets/use-debounced-value-XwsAZBkp.js","assets/use-organization-settings-C39MKM-d.js","assets/use-is-desktop-app-BNujXJc_.js","assets/required-auth-layout-C1HzYYkM.js","assets/autosend-Cgp0Kt47.js","assets/use-org-sso-DhnTeWxC.js","assets/shell-layout-CE2Eihra.css","assets/chat-draft-kw4JBxuT.js","assets/use-session-runtime-BMxBtcXn.js","assets/chat-context-D_aG2yAX.js","assets/use-decopilot-events-C2Pzma6G.js","assets/use-ai-providers-jUulD26_.js","assets/location-DPIrGNp7.js","assets/select-vA5aLKVe.js","assets/usage-stats-MicZljk7.js","assets/use-copy-BTWDFkjW.js","assets/markdown-CqclEMlW.js","assets/format-time-CjIPQhCN.js","assets/differenceInSeconds-C3x8sHUj.js","assets/tabs-DpX5BLsl.js","assets/use-deco-credits-CzkmZZZy.js","assets/toggle-group-CjnaoGYT.js","assets/tool-namespace-DmnQIdtF.js","assets/use-open-billing-url-d7KMUwR_.js","assets/decopilot-CAfMXinP.js","assets/checkbox-DnZkZOM8.js","assets/ai-providers-logos-DD3qZ33J.js","assets/popover-FL0SUsUE.js","assets/drawer-BoaD9rxZ.js","assets/index-CpOfh4QE.js","assets/input-L6zRtw2u.js","assets/suggestion-BkCheNCW.js","assets/use-mcp-prompts-Bjb4h1TD.js","assets/use-org-fs-zJoB2iqQ.js","assets/question-004-sINsf4GQ.js","assets/use-members-zL7ESsDH.js","assets/use-org-auth-client-G2KA5nw3.js","assets/feature-paywall-CdbrbN16.js","assets/plan-ladder-BNbJXBN6.js","assets/add-connection-dialog-DlAKTxBm.js","assets/extract-connection-data-CeW7ej-C.js","assets/metadata-D72DunRR.js","assets/connection-CcGTFKQt.js","assets/connection-card-xm3ewa1i.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-BBDC4DVr.js","assets/use-connection-B9WHtxSO.js","assets/connection-form-helpers-R9FNwPaA.js","assets/authenticate-and-persist-oauth-CPk9K9qy.js","assets/mcp-oauth-Cu8OJU0d.js","assets/collection-tabs-CjB8WZDI.js","assets/badge-DRtzW34c.js","assets/use-infinite-scroll-x37PMcqa.js","assets/useSuspenseInfiniteQuery-BzpL8p-T.js","assets/use-task-board-events-CEk5blpI.js","assets/use-chat-layout-state-CbytSCzM.js","assets/use-file-configs-BrMAMhvL.js","assets/site-slug-DebpOoQq.js"])))=>i.map(i=>d[i]);
2
- import{aO as Ue,c as R,b as B,r as E,l as O,j as n,au as re,bM as Ut,av as ne,bL as Le,B as Y,at as js,as as ks,bN as ws,bK as Ss,x as Se,aU as Cs,e2 as we,e3 as mt,a2 as Ns,e as Is,t as Pe,q as te,X as Ce,d as rt,e0 as Ts,Z as _s,K as Ms,m as Ds,I as Rs,F as Ps,H as Es,G as Ae,aj as gt,ah as xt,ai as vt,h as Us,aG as Ls,aF as Fs,ak as zs,cQ as Os,cU as ye,aK as $s,cW as Bs,aL as bt,aP as Ks,a as qs,U as Qs,V as Ws,ay as tt,a7 as Lt,bT as Ys,aE as Gs}from"./index-HWxR2Ep5.js";import{c as Hs,d as Ft,P as Js,i as Zs}from"./index-lLNfJgr6.js";import{K as Xs,b as en}from"./shell-layout-d_sSLfND.js";import{a as tn}from"./repository-binding-CMSObH6I.js";import{w as sn,A as nn}from"./autosend-Cgp0Kt47.js";import{s as on,r as At,i as rn,c as an,w as ln,H as Vn}from"./chat-draft-kw4JBxuT.js";import{u as cn}from"./use-session-runtime-BMxBtcXn.js";import{i as zt}from"./LinkBroken01-DAzor-5J.js";import{i as Ot}from"./ArrowUp-DL-SqfEN.js";import{n as $t}from"./ShoppingBag01-sD-3dhUV.js";import{i as it}from"./Check-Xxxm4n9N.js";import{t as We,aL as Bt,a2 as Kt,aM as st,f as at,at as dn,_ as un,aN as pn,q as qt,aO as Qt,I as fn,aP as hn}from"./agent-icon-Ncp9jZCj.js";import{a as Wt}from"./Image01-Cm62Gz39.js";import{g as mn}from"./UserSquare-C8QKc8iC.js";import{i as gn}from"./Upload01-B-X-AhmC.js";import{i as lt}from"./X-BB3WvJxy.js";import{a as Fe,b as Ye,c as Ge,i as xn,k as vn,l as bn,m as An,n as yn,o as jn,p as kn,q as wn,f as Sn,u as Cn,s as Nn,d as In}from"./chat-context-D_aG2yAX.js";import{o as Tn,z as _n,q as Mn,c as Dn}from"./thread-intent-DQKTpQfu.js";import{i as Rn}from"./AlertCircle-CZ2r-6fw.js";import{a as Pn}from"./Copy01-BsGAkEj7.js";import{a as nt,b as Vt,d as ct,f as dt,F as Yt}from"./form-uqvM1Jp0.js";import{c as En,S as Un,b as Ln,a as Fn,d as zn}from"./select-vA5aLKVe.js";import{t as Gt}from"./ChevronUp-CjbQc22U.js";import{T as He,a as Je,b as Ze}from"./tooltip-CBWyBQCl.js";import{i as On}from"./ArrowLeft-CUyvjw-L.js";import{M as $n,S as Bn}from"./usage-stats-MicZljk7.js";import{c as Kn,b as qn}from"./tabs-DpX5BLsl.js";import{d as Qn,h as Wn,c as Yn,b as Gn,D as Hn}from"./dialog-CrYpY3Eq.js";import{e as ze,f as Jn,c as Zn,g as Xn}from"./use-decopilot-events-C2Pzma6G.js";import{u as eo}from"./use-deco-credits-CzkmZZZy.js";import{I as to}from"./input-CxP1FO-T.js";import{T as yt,a as so}from"./toggle-group-CjnaoGYT.js";import{s as no}from"./tool-namespace-DmnQIdtF.js";import{t as oo}from"./utils-CVEq3hMx.js";import{u as ro}from"./use-open-billing-url-d7KMUwR_.js";import{s as io}from"./XClose-knQXpnnU.js";import{M as ao,m as ut,g as lo,a as Vo}from"./decopilot-CAfMXinP.js";import{a as Ht,b as Jt,P as Zt}from"./popover-FL0SUsUE.js";import{c as co,b as uo,a as po,D as fo}from"./drawer-BoaD9rxZ.js";import{u as Xt}from"./use-mobile-Bgz25Qmq.js";import{t as ho}from"./Tool01-D45Ut_f6.js";import{c as mo,a as go}from"./use-organization-settings-C39MKM-d.js";import{u as es,c as xo}from"./use-ai-providers-jUulD26_.js";import{M as vo}from"./index-CpOfh4QE.js";import{p as ts,u as bo,T as Ao,a as yo,U as jo}from"./input-L6zRtw2u.js";import{d as ko,g as jt,s as wo}from"./gateway-client-BMuj7uLa.js";import{u as So}from"./use-mcp-client-DepMR5h0.js";import{l as Co,g as No}from"./use-mcp-prompts-Bjb4h1TD.js";import{i as Io}from"./Link01-jFnxVzfa.js";import{s as kt}from"./Plus-CB7d6UWu.js";import"./suggestion-BkCheNCW.js";import{p as To,q as _o}from"./question-004-sINsf4GQ.js";import{A as Mo}from"./avatar-BW3U9bUq.js";import{u as Do}from"./use-members-zL7ESsDH.js";import{F as wt}from"./feature-paywall-CdbrbN16.js";import{A as Ro}from"./add-connection-dialog-DlAKTxBm.js";import{u as Po}from"./use-task-board-events-CEk5blpI.js";import{d as Eo}from"./use-chat-layout-state-CbytSCzM.js";import{u as Uo}from"./use-is-desktop-app-BNujXJc_.js";const Lo=Ue("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);const Fo=Ue("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const zo=Ue("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const Oo=Ue("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const $o=Ue("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),et="cubic-bezier(0.645, 0.045, 0.355, 1)",Ja=44,Bo={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-warning/5 after:pointer-events-none after:-z-10"},Ko={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},qo={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function pe(t){const e=R.c(69),{icon:s,label:o,count:r,title:i,footerLeft:a,footerRight:l,children:V,defaultExpanded:d,variant:u,onClose:c}=t,p=u===void 0?"default":u,f=B(),[m,h]=E.useState(d),[g,v]=E.useState(!1);let x;e[0]!==c?(x=()=>{v(!0),c?.()},e[0]=c,e[1]=x):x=e[1];const b=x;if(g)return null;const A=Ko[p],j=Bo[p];let k;e[2]!==A||e[3]!==j?(k=O("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",A,j),e[2]=A,e[3]=j,e[4]=k):k=e[4];let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>h(Qo),e[5]=y):y=e[5];const w=m&&"rounded-b-none",C=!m&&"rounded-b-xl";let S;e[6]!==w||e[7]!==C?(S=O("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",w,C),e[6]=w,e[7]=C,e[8]=S):S=e[8];const I=qo[p];let N;e[9]!==I?(N=O("shrink-0",I),e[9]=I,e[10]=N):N=e[10];let T;e[11]!==s||e[12]!==N?(T=n.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=T):T=e[13];let _;e[14]!==o?(_=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:o}),e[14]=o,e[15]=_):_=e[15];let P;e[16]!==r?(P=r?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=P):P=e[17];const U=m?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==U?(M=n.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:n.jsx(Gt,{size:16,style:{transform:U,transition:`transform 180ms ${et}`}})}),e[18]=U,e[19]=M):M=e[19];let L;e[20]!==f?(L=f("chat.collapsibleHighlight.closeLabel"),e[20]=f,e[21]=L):L=e[21];let z;e[22]!==f?(z=f("chat.collapsibleHighlight.closeTitle"),e[22]=f,e[23]=z):z=e[23];let W,$;e[24]!==b?(W=le=>{le.stopPropagation(),b()},$=le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),b())},e[24]=b,e[25]=W,e[26]=$):(W=e[25],$=e[26]);let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx(lt,{size:16}),e[27]=F):F=e[27];let Q;e[28]!==L||e[29]!==z||e[30]!==W||e[31]!==$?(Q=n.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":L,title:z,onClick:W,onKeyDown:$,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:F}),e[28]=L,e[29]=z,e[30]=W,e[31]=$,e[32]=Q):Q=e[32];let Z;e[33]!==m||e[34]!==T||e[35]!==_||e[36]!==P||e[37]!==M||e[38]!==Q||e[39]!==S?(Z=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:y,className:S,children:[T,_,P,M,Q]}),e[33]=m,e[34]=T,e[35]=_,e[36]=P,e[37]=M,e[38]=Q,e[39]=S,e[40]=Z):Z=e[40];const se=m?"1fr":"0fr";let X;e[41]!==se?(X={display:"grid",gridTemplateRows:se,transition:`grid-template-rows 180ms ${et}`},e[41]=se,e[42]=X):X=e[42];let D;e[43]===Symbol.for("react.memo_cache_sentinel")?(D={overflow:"hidden",minHeight:0},e[43]=D):D=e[43];const K=m?1:0;let H;e[44]!==K?(H={opacity:K,transition:`opacity 120ms ${et}`,maxHeight:"60vh"},e[44]=K,e[45]=H):H=e[45];let ee;e[46]!==i?(ee=i?n.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:n.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=i,e[47]=ee):ee=e[47];let J;e[48]!==V||e[49]!==i?(J=V?n.jsx("div",{className:O("pb-4",!i&&"pt-4"),children:V}):null,e[48]=V,e[49]=i,e[50]=J):J=e[50];let ae;e[51]!==ee||e[52]!==J?(ae=n.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ee,J]}),e[51]=ee,e[52]=J,e[53]=ae):ae=e[53];let G;e[54]!==a||e[55]!==l?(G=a||l?n.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{children:a}),n.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=G):G=e[56];let ce;e[57]!==H||e[58]!==ae||e[59]!==G?(ce=n.jsx("div",{style:D,children:n.jsxs("div",{className:"flex flex-col",style:H,children:[ae,G]})}),e[57]=H,e[58]=ae,e[59]=G,e[60]=ce):ce=e[60];let ie;e[61]!==X||e[62]!==ce?(ie=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:X,children:ce}),e[61]=X,e[62]=ce,e[63]=ie):ie=e[63];let fe;return e[64]!==Z||e[65]!==ie||e[66]!==k||e[67]!==p?(fe=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":p,className:k,children:[Z,ie]}),e[64]=Z,e[65]=ie,e[66]=k,e[67]=p,e[68]=fe):fe=e[68],fe}function Qo(t){return!t}const Wo=re({content:ne().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Le(["pending","in_progress","completed"]),activeForm:ne().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),ss=re({todos:Ut(Wo)}),Yo="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.";Tn({description:Yo,inputSchema:_n(ss),execute:async({todos:t})=>({ok:!0,count:t.length})});const Go="tool-todo_write",Ho=new Set(["input-available","output-available"]);function Jo(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const o=s.parts;if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=o[r];if(i.type!==Go||typeof i.state!="string"||!Ho.has(i.state))continue;const a=ss.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function ns(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const o="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:o,friendlyName:oo(no(o)),input:s.input})}return e}function os(t){return t.at(-1)}function rs(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function Zo(t){return t?t.message.startsWith("[CREDITS]"):!1}const Xo={isCreditExhausted:!1,planRefusal:null,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,hasTaskSuggestion:!1,todos:[]};function er(t){const{messages:e,error:s,finishReason:o,isStreaming:r,isWaitingForApprovals:i}=t;if(!r&&s&&Zo(s))return{...Xo,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],V=l,u=!!V.filter(k=>k.type==="tool-user_ask").filter(k=>k.state!=="output-available").length,c=V.some(k=>k.type==="tool-suggest_task"&&k.state==="input-available"),p=rs(l),f=ns(V),m=Jo(e),h=r?null:on(s),g=r?null:Mn(s),v=!r&&!!s&&!h&&!g,x=f.length>0||r&&i,b=p.length>0,j=!r&&!!o&&o!=="stop"&&!(o==="tool-calls"&&(u||x||b||c))&&!v;return{isCreditExhausted:!1,planRefusal:g,subscriptionErrorKind:h,hasTodos:m.length>0,showError:v,showWarning:j,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,hasTaskSuggestion:c,todos:m}}function is(){const t=R.c(6),{messages:e,error:s,finishReason:o,isStreaming:r,isWaitingForApprovals:i}=Fe(),a=s??null,l=o??null;let V;return t[0]!==r||t[1]!==i||t[2]!==e||t[3]!==a||t[4]!==l?(V=er({messages:e,error:a,finishReason:l,isStreaming:r,isWaitingForApprovals:i}),t[0]=r,t[1]=i,t[2]=e,t[3]=a,t[4]=l,t[5]=V):V=t[5],V}function Za(){const t=is(),e=ze("credits");return t.isCreditExhausted?e?0:1:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+ +!!t.planRefusal+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)+Number(t.hasTaskSuggestion)}const St="start-task",tr=`Turn the report below into a running task. The user pressed "Start task", which authorizes delegation.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/openai-conversation-C-yPKbTo.js","assets/index-C5LlvZFc.js","assets/index-DoNIk522.css","assets/index-Dm8tF0P6.js","assets/gateway-client-DPQb-ray.js","assets/dialog-BJny2srB.js","assets/X-DvEbwZ22.js","assets/form-BsbEXxEk.js","assets/label-DFV1EjGx.js","assets/input-NPHEwu7D.js","assets/utils-CVEq3hMx.js","assets/org-file-open-context-C7-ltXbm.js","assets/use-mobile-Du3isCXQ.js","assets/use-panel-navigate-BVY-Wy0A.js","assets/thread-route-CmSAw42O.js","assets/use-project-scope-Cg6fEvSs.js","assets/repository-binding-BzfYTDYg.js","assets/use-mcp-client-B2Vh9Cd7.js","assets/auth-5kOh9gsa.js","assets/tooltip-66nc6La-.js","assets/index-CMWyW-nP.js","assets/shell-layout-BCgx5xUt.js","assets/avatar-CrasAAzq.js","assets/User01-CN7JcgS_.js","assets/Building02-DlH3FV2M.js","assets/UserSquare-CEkD4_s5.js","assets/agent-icon-CfuzWIKW.js","assets/AlertCircle-DrwoGJpd.js","assets/Tool01-CWjV8YTI.js","assets/ArrowUp-NsPNRi9p.js","assets/ArrowLeft-DKYwT7KB.js","assets/LinkBroken01-CYAPpruG.js","assets/ShoppingBag01-P4dMHDVk.js","assets/ZoomOut-B5FfXkUf.js","assets/CheckCircle-iXm3h-fF.js","assets/Check-BcGsLSsp.js","assets/ChevronUp-BAvbedXO.js","assets/Copy01-C_KnfAlj.js","assets/CreditCard01-B7CL5INn.js","assets/DotsVertical-wjfpXF6W.js","assets/Image01-BVwA4uCp.js","assets/Palette-Bh_thK5-.js","assets/XClose-eArhRgkd.js","assets/Key01-C3aJH3VU.js","assets/Link01-BezCCi1I.js","assets/LinkExternal01-D_cGFYPK.js","assets/Monitor01-R0RI8JD-.js","assets/Sun-7PdNidQ5.js","assets/Plus-GNsqHUli.js","assets/SearchMd-DeSQISfo.js","assets/Trash01-BJ_e57Kj.js","assets/Upload01-3jf5OQDv.js","assets/Users01-B-RFC-RT.js","assets/download-app-dialog-CYxTt_wl.js","assets/use-clock-tick-Db61eAzB.js","assets/command-DA3SiBwF.js","assets/index-BsSf6-Tp.js","assets/integration-icon-Db99lv2a.js","assets/project-icon-ss5TCI0R.js","assets/new-project-dialog-CJlermXp.js","assets/repository-import-picker-BZ4SbZxQ.js","assets/use-navigate-to-agent-DeIS5d_A.js","assets/thread-intent-Cc5BAaIc.js","assets/backoff-8mStPHYB.js","assets/task-board-DGnwsIns.js","assets/schema-DvFu1ToO.js","assets/slugify-CEUa2lfQ.js","assets/repository-picker-Bzznh2XU.js","assets/useInfiniteQuery-DpDVtLXw.js","assets/infiniteQueryObserver-DS3r5RyQ.js","assets/collection-search-FRa3rbYr.js","assets/use-debounced-value-C3ROkLpe.js","assets/use-organization-settings-Bq69ux21.js","assets/use-is-desktop-app-BNujXJc_.js","assets/required-auth-layout-DanliwF9.js","assets/autosend-CsHrH9Xo.js","assets/use-org-sso-CW6lGteH.js","assets/shell-layout-CE2Eihra.css","assets/chat-draft-DCJfKWx2.js","assets/use-session-runtime-XVdydjwY.js","assets/chat-context-CbVc7tEo.js","assets/use-decopilot-events-DSjzPVBT.js","assets/use-ai-providers-M9Gfv9f8.js","assets/location-DPIrGNp7.js","assets/select-BlojSjop.js","assets/usage-stats-yiZ6SKAb.js","assets/use-copy-B1c_EBRx.js","assets/markdown-BNkxJvOO.js","assets/format-time-CjIPQhCN.js","assets/differenceInSeconds-C3x8sHUj.js","assets/tabs-BQf21wqw.js","assets/use-deco-credits-u3-i822p.js","assets/toggle-group-D_XfPgvt.js","assets/tool-namespace-DmnQIdtF.js","assets/use-open-billing-url-C43__85H.js","assets/decopilot-BEZXwH2l.js","assets/checkbox-C68xjrg5.js","assets/ai-providers-logos-DD3qZ33J.js","assets/popover-98ItoIiE.js","assets/drawer-ugS5r2iQ.js","assets/index-BmjSoeeS.js","assets/input-BYbHl7fH.js","assets/suggestion-20OWsU93.js","assets/use-mcp-prompts-BBIzvKJ-.js","assets/use-org-fs-Can_Zv1k.js","assets/question-004-sINsf4GQ.js","assets/use-members-C6qHLZqu.js","assets/use-org-auth-client-BBNuWvcV.js","assets/feature-paywall-BOUIyLME.js","assets/plan-ladder-jHsL2xiU.js","assets/add-connection-dialog-BRrDiP3N.js","assets/extract-connection-data-DzRM76JF.js","assets/metadata-D72DunRR.js","assets/connection-B1RIZdkW.js","assets/connection-card-CBKnCj0k.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-CVYfh0wC.js","assets/use-connection-aogXB8HT.js","assets/connection-form-helpers-CTzk01jW.js","assets/authenticate-and-persist-oauth-IbhNDJn9.js","assets/mcp-oauth-B9fQInjX.js","assets/collection-tabs-JVe-o8Om.js","assets/badge-BrDXjbHd.js","assets/use-infinite-scroll-DwjxrCBI.js","assets/useSuspenseInfiniteQuery-Exur-lii.js","assets/use-task-board-events-j6Gt2_bO.js","assets/use-chat-layout-state-EbMrj1Yk.js","assets/use-file-configs-CF1-8iPu.js","assets/site-slug-DebpOoQq.js"])))=>i.map(i=>d[i]);
2
+ import{aO as Ue,c as R,b as B,r as P,l as O,j as n,au as re,bM as Ut,av as ne,bL as Le,B as Y,at as js,as as ks,bN as ws,bK as Ss,x as Se,aU as Cs,e2 as we,e3 as mt,a2 as Ns,e as Is,t as Ee,q as te,X as Ce,d as rt,e0 as Ts,Z as _s,K as Ms,m as Ds,I as Rs,F as Es,H as Ps,G as Ae,aj as gt,ah as xt,ai as vt,h as Us,aG as Ls,aF as Fs,ak as zs,cQ as Os,cU as ye,aK as $s,cW as Bs,aL as bt,aP as Ks,a as qs,U as Qs,V as Ws,ay as tt,a7 as Lt,bT as Ys,aE as Gs}from"./index-C5LlvZFc.js";import{c as Hs,d as Ft,P as Js,i as Zs}from"./index-Dm8tF0P6.js";import{K as Xs,b as en}from"./shell-layout-BCgx5xUt.js";import{a as tn}from"./repository-binding-BzfYTDYg.js";import{w as sn,A as nn}from"./autosend-CsHrH9Xo.js";import{s as on,r as At,i as rn,c as an,w as ln,H as Vn}from"./chat-draft-DCJfKWx2.js";import{u as cn}from"./use-session-runtime-XVdydjwY.js";import{i as zt}from"./LinkBroken01-CYAPpruG.js";import{i as Ot}from"./ArrowUp-NsPNRi9p.js";import{n as $t}from"./ShoppingBag01-P4dMHDVk.js";import{i as it}from"./Check-BcGsLSsp.js";import{t as We,aK as Bt,a2 as Kt,aL as st,f as at,as as dn,_ as un,aM as pn,q as qt,aN as Qt,I as fn,aO as hn}from"./agent-icon-CfuzWIKW.js";import{a as Wt}from"./Image01-BVwA4uCp.js";import{h as mn}from"./UserSquare-CEkD4_s5.js";import{i as gn}from"./Upload01-3jf5OQDv.js";import{i as lt}from"./X-DvEbwZ22.js";import{a as Fe,b as Ye,c as Ge,i as xn,k as vn,l as bn,m as An,n as yn,o as jn,p as kn,q as wn,f as Sn,u as Cn,s as Nn,d as In}from"./chat-context-CbVc7tEo.js";import{o as Tn,z as _n,q as Mn,c as Dn}from"./thread-intent-Cc5BAaIc.js";import{i as Rn}from"./AlertCircle-DrwoGJpd.js";import{a as En}from"./Copy01-C_KnfAlj.js";import{a as nt,b as Vt,d as ct,f as dt,F as Yt}from"./form-BsbEXxEk.js";import{c as Pn,S as Un,b as Ln,a as Fn,d as zn}from"./select-BlojSjop.js";import{t as Gt}from"./ChevronUp-BAvbedXO.js";import{T as He,a as Je,b as Ze}from"./tooltip-66nc6La-.js";import{i as On}from"./ArrowLeft-DKYwT7KB.js";import{M as $n,S as Bn}from"./usage-stats-yiZ6SKAb.js";import{c as Kn,b as qn}from"./tabs-BQf21wqw.js";import{d as Qn,h as Wn,c as Yn,b as Gn,D as Hn}from"./dialog-BJny2srB.js";import{e as ze,f as Jn,c as Zn,g as Xn}from"./use-decopilot-events-DSjzPVBT.js";import{u as eo}from"./use-deco-credits-u3-i822p.js";import{I as to}from"./input-NPHEwu7D.js";import{T as yt,a as so}from"./toggle-group-D_XfPgvt.js";import{s as no}from"./tool-namespace-DmnQIdtF.js";import{t as oo}from"./utils-CVEq3hMx.js";import{u as ro}from"./use-open-billing-url-C43__85H.js";import{s as io}from"./XClose-eArhRgkd.js";import{M as ao,m as ut,g as lo,a as Vo}from"./decopilot-BEZXwH2l.js";import{a as Ht,b as Jt,P as Zt}from"./popover-98ItoIiE.js";import{c as co,b as uo,a as po,D as fo}from"./drawer-ugS5r2iQ.js";import{u as Xt}from"./use-mobile-Du3isCXQ.js";import{t as ho}from"./Tool01-CWjV8YTI.js";import{c as mo,a as go}from"./use-organization-settings-Bq69ux21.js";import{u as es,c as xo}from"./use-ai-providers-M9Gfv9f8.js";import{M as vo}from"./index-BmjSoeeS.js";import{p as ts,u as bo,T as Ao,a as yo,U as jo}from"./input-BYbHl7fH.js";import{d as ko,g as jt,s as wo}from"./gateway-client-DPQb-ray.js";import{u as So}from"./use-mcp-client-B2Vh9Cd7.js";import{l as Co,g as No}from"./use-mcp-prompts-BBIzvKJ-.js";import{i as Io}from"./Link01-BezCCi1I.js";import{s as kt}from"./Plus-GNsqHUli.js";import"./suggestion-20OWsU93.js";import{p as To,q as _o}from"./question-004-sINsf4GQ.js";import{A as Mo}from"./avatar-CrasAAzq.js";import{u as Do}from"./use-members-C6qHLZqu.js";import{F as wt}from"./feature-paywall-BOUIyLME.js";import{A as Ro}from"./add-connection-dialog-BRrDiP3N.js";import{u as Eo}from"./use-task-board-events-j6Gt2_bO.js";import{d as Po}from"./use-chat-layout-state-EbMrj1Yk.js";import{u as Uo}from"./use-is-desktop-app-BNujXJc_.js";const Lo=Ue("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);const Fo=Ue("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const zo=Ue("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const Oo=Ue("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);const $o=Ue("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),et="cubic-bezier(0.645, 0.045, 0.355, 1)",Ja=44,Bo={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-warning/5 after:pointer-events-none after:-z-10"},Ko={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},qo={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function pe(t){const e=R.c(69),{icon:s,label:o,count:r,title:i,footerLeft:a,footerRight:l,children:V,defaultExpanded:d,variant:u,onClose:c}=t,p=u===void 0?"default":u,f=B(),[m,h]=P.useState(d),[g,v]=P.useState(!1);let x;e[0]!==c?(x=()=>{v(!0),c?.()},e[0]=c,e[1]=x):x=e[1];const b=x;if(g)return null;const A=Ko[p],j=Bo[p];let k;e[2]!==A||e[3]!==j?(k=O("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",A,j),e[2]=A,e[3]=j,e[4]=k):k=e[4];let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>h(Qo),e[5]=y):y=e[5];const w=m&&"rounded-b-none",C=!m&&"rounded-b-xl";let S;e[6]!==w||e[7]!==C?(S=O("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",w,C),e[6]=w,e[7]=C,e[8]=S):S=e[8];const I=qo[p];let N;e[9]!==I?(N=O("shrink-0",I),e[9]=I,e[10]=N):N=e[10];let T;e[11]!==s||e[12]!==N?(T=n.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=T):T=e[13];let _;e[14]!==o?(_=n.jsx("span",{className:"flex-1 min-w-0 truncate",children:o}),e[14]=o,e[15]=_):_=e[15];let E;e[16]!==r?(E=r?n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=E):E=e[17];const U=m?"rotate(180deg)":"rotate(0deg)";let M;e[18]!==U?(M=n.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:n.jsx(Gt,{size:16,style:{transform:U,transition:`transform 180ms ${et}`}})}),e[18]=U,e[19]=M):M=e[19];let L;e[20]!==f?(L=f("chat.collapsibleHighlight.closeLabel"),e[20]=f,e[21]=L):L=e[21];let z;e[22]!==f?(z=f("chat.collapsibleHighlight.closeTitle"),e[22]=f,e[23]=z):z=e[23];let W,$;e[24]!==b?(W=le=>{le.stopPropagation(),b()},$=le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),b())},e[24]=b,e[25]=W,e[26]=$):(W=e[25],$=e[26]);let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx(lt,{size:16}),e[27]=F):F=e[27];let Q;e[28]!==L||e[29]!==z||e[30]!==W||e[31]!==$?(Q=n.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":L,title:z,onClick:W,onKeyDown:$,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:F}),e[28]=L,e[29]=z,e[30]=W,e[31]=$,e[32]=Q):Q=e[32];let Z;e[33]!==m||e[34]!==T||e[35]!==_||e[36]!==E||e[37]!==M||e[38]!==Q||e[39]!==S?(Z=n.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:y,className:S,children:[T,_,E,M,Q]}),e[33]=m,e[34]=T,e[35]=_,e[36]=E,e[37]=M,e[38]=Q,e[39]=S,e[40]=Z):Z=e[40];const se=m?"1fr":"0fr";let X;e[41]!==se?(X={display:"grid",gridTemplateRows:se,transition:`grid-template-rows 180ms ${et}`},e[41]=se,e[42]=X):X=e[42];let D;e[43]===Symbol.for("react.memo_cache_sentinel")?(D={overflow:"hidden",minHeight:0},e[43]=D):D=e[43];const K=m?1:0;let H;e[44]!==K?(H={opacity:K,transition:`opacity 120ms ${et}`,maxHeight:"60vh"},e[44]=K,e[45]=H):H=e[45];let ee;e[46]!==i?(ee=i?n.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:n.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):n.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=i,e[47]=ee):ee=e[47];let J;e[48]!==V||e[49]!==i?(J=V?n.jsx("div",{className:O("pb-4",!i&&"pt-4"),children:V}):null,e[48]=V,e[49]=i,e[50]=J):J=e[50];let ae;e[51]!==ee||e[52]!==J?(ae=n.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ee,J]}),e[51]=ee,e[52]=J,e[53]=ae):ae=e[53];let G;e[54]!==a||e[55]!==l?(G=a||l?n.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{children:a}),n.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=G):G=e[56];let ce;e[57]!==H||e[58]!==ae||e[59]!==G?(ce=n.jsx("div",{style:D,children:n.jsxs("div",{className:"flex flex-col",style:H,children:[ae,G]})}),e[57]=H,e[58]=ae,e[59]=G,e[60]=ce):ce=e[60];let ie;e[61]!==X||e[62]!==ce?(ie=n.jsx("div",{"data-testid":"collapsible-highlight-body",style:X,children:ce}),e[61]=X,e[62]=ce,e[63]=ie):ie=e[63];let fe;return e[64]!==Z||e[65]!==ie||e[66]!==k||e[67]!==p?(fe=n.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":p,className:k,children:[Z,ie]}),e[64]=Z,e[65]=ie,e[66]=k,e[67]=p,e[68]=fe):fe=e[68],fe}function Qo(t){return!t}const Wo=re({content:ne().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Le(["pending","in_progress","completed"]),activeForm:ne().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),ss=re({todos:Ut(Wo)}),Yo="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.";Tn({description:Yo,inputSchema:_n(ss),execute:async({todos:t})=>({ok:!0,count:t.length})});const Go="tool-todo_write",Ho=new Set(["input-available","output-available"]);function Jo(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const o=s.parts;if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=o[r];if(i.type!==Go||typeof i.state!="string"||!Ho.has(i.state))continue;const a=ss.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function ns(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const o="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:o,friendlyName:oo(no(o)),input:s.input})}return e}function os(t){return t.at(-1)}function rs(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function Zo(t){return t?t.message.startsWith("[CREDITS]"):!1}const Xo={isCreditExhausted:!1,planRefusal:null,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,hasTaskSuggestion:!1,todos:[]};function er(t){const{messages:e,error:s,finishReason:o,isStreaming:r,isWaitingForApprovals:i}=t;if(!r&&s&&Zo(s))return{...Xo,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],V=l,u=!!V.filter(k=>k.type==="tool-user_ask").filter(k=>k.state!=="output-available").length,c=V.some(k=>k.type==="tool-suggest_task"&&k.state==="input-available"),p=rs(l),f=ns(V),m=Jo(e),h=r?null:on(s),g=r?null:Mn(s),v=!r&&!!s&&!h&&!g,x=f.length>0||r&&i,b=p.length>0,j=!r&&!!o&&o!=="stop"&&!(o==="tool-calls"&&(u||x||b||c))&&!v;return{isCreditExhausted:!1,planRefusal:g,subscriptionErrorKind:h,hasTodos:m.length>0,showError:v,showWarning:j,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,hasTaskSuggestion:c,todos:m}}function is(){const t=R.c(6),{messages:e,error:s,finishReason:o,isStreaming:r,isWaitingForApprovals:i}=Fe(),a=s??null,l=o??null;let V;return t[0]!==r||t[1]!==i||t[2]!==e||t[3]!==a||t[4]!==l?(V=er({messages:e,error:a,finishReason:l,isStreaming:r,isWaitingForApprovals:i}),t[0]=r,t[1]=i,t[2]=e,t[3]=a,t[4]=l,t[5]=V):V=t[5],V}function Za(){const t=is(),e=ze("credits");return t.isCreditExhausted?e?0:1:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+ +!!t.planRefusal+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)+Number(t.hasTaskSuggestion)}const St="start-task",tr=`Turn the report below into a running task. The user pressed "Start task", which authorizes delegation.
3
3
 
4
4
  1. Read the report and any attached screenshots. Carry the reporter's own words into the task description, plus the URL of any attachment.
5
5
  2. Call TASK_BOARD_ITEM_LIST. Its \`repos\` are this organization's repositories — the only valid values for a task's repo, so pick the one the report is about and never invent a name.
6
6
  3. Call TASK_BOARD_ITEM_CREATE with a concise title, the full description, the chosen repo as owner/name, assigneeId "super-agent", and onDuplicate "return_existing". That assignment is what queues the work; the duplicate option makes the tool hand back an existing task when one already covers this report instead of opening a second one.
7
7
  4. Reply with the task key the tool returned (e.g. DECO-144) and one line on what you filed. If the output says \`deduplicated: true\`, say the report was already tracked by that task and quote its \`duplicateReason\`. Never invent a URL. Do NOT implement the fix here; the task's own run does that, and the reporter gets an email when its PR is ready for review.
8
8
 
9
- The report follows.`;function sr(t){return{...t,content:[{type:"paragraph",content:[Hs({id:St,name:St,char:"/",kind:"prompt",metadata:[{role:"user",content:{type:"text",text:tr}}]})]},...t.content??[]]}}function nr(t){const e=R.c(30),{current:s,total:o,onPrev:r,onNext:i}=t,a=B();if(o<=1)return null;const l=s===0,V=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==V?(d=O("p-0.5 transition-colors rounded-lg",V),e[0]=V,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("chat.pagination.previousLabel"),e[2]=a,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(On,{size:14}),e[4]=c):c=e[4];let p;e[5]!==r||e[6]!==l||e[7]!==d||e[8]!==u?(p=n.jsx("button",{type:"button",onClick:r,disabled:l,className:d,"aria-label":u,children:c}),e[5]=r,e[6]=l,e[7]=d,e[8]=u,e[9]=p):p=e[9];const f=s+1;let m;e[10]!==a||e[11]!==f||e[12]!==o?(m=a("chat.pagination.counter",{current:f,total:o}),e[10]=a,e[11]=f,e[12]=o,e[13]=m):m=e[13];let h;e[14]!==m?(h=n.jsx("span",{className:"tabular-nums text-xs",children:m}),e[14]=m,e[15]=h):h=e[15];const g=s===o-1,v=s===o-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let x;e[16]!==v?(x=O("p-0.5 transition-colors rounded-lg",v),e[16]=v,e[17]=x):x=e[17];let b;e[18]!==a?(b=a("chat.pagination.nextLabel"),e[18]=a,e[19]=b):b=e[19];let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(zt,{size:14}),e[20]=A):A=e[20];let j;e[21]!==i||e[22]!==g||e[23]!==x||e[24]!==b?(j=n.jsx("button",{type:"button",onClick:i,disabled:g,className:x,"aria-label":b,children:A}),e[21]=i,e[22]=g,e[23]=x,e[24]=b,e[25]=j):j=e[25];let k;return e[26]!==j||e[27]!==p||e[28]!==h?(k=n.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[p,h,j]}),e[26]=j,e[27]=p,e[28]=h,e[29]=k):k=e[29],k}function as(t){const e=R.c(8),{currentIndex:s,total:o,onPrev:r,onNext:i,extraLeft:a}=t;let l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==o?(l=n.jsx(nr,{current:s,total:o,onPrev:r,onNext:i}),e[0]=s,e[1]=i,e[2]=r,e[3]=o,e[4]=l):l=e[4];let V;return e[5]!==a||e[6]!==l?(V=n.jsxs("div",{className:"flex items-center gap-2",children:[l,a]}),e[5]=a,e[6]=l,e[7]=V):V=e[7],V}function or(t){const e=R.c(17),{isStreaming:s,isAllAnswered:o,isCurrentAnswered:r,onAdvanceOrSubmit:i,submitLabel:a,nextLabel:l}=t,u=o?a===void 0?"Submit":a:l===void 0?"Next":l,c=o?s:!r,p=c?o?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==c||e[1]!==i?(f=()=>{c||i()},e[0]=c,e[1]=i,e[2]=f):f=e[2];const m=c&&"opacity-50 cursor-not-allowed";let h;e[3]!==m?(h=O("h-7 px-2.5 text-xs",m),e[3]=m,e[4]=h):h=e[4];let g;e[5]!==c||e[6]!==u||e[7]!==f||e[8]!==h?(g=n.jsx(Y,{type:"button",size:"sm","aria-disabled":c,onClick:f,className:h,children:u}),e[5]=c,e[6]=u,e[7]=f,e[8]=h,e[9]=g):g=e[9];const v=g;if(!p)return v;let x;e[10]!==v?(x=n.jsx(He,{asChild:!0,children:v}),e[10]=v,e[11]=x):x=e[11];let b;e[12]!==p?(b=n.jsx(Je,{children:p}),e[12]=p,e[13]=b):b=e[13];let A;return e[14]!==x||e[15]!==b?(A=n.jsxs(Ze,{children:[x,b]}),e[14]=x,e[15]=b,e[16]=A):A=e[16],A}function ls(t,e,s){return t.findIndex(o=>e(o)===s)}function Ct(t,e,s,o){return t.length===0?!1:t.every(r=>o(s[e(r)]))}function Nt(t,e,s,o,r){if(t.length===0)return null;const i=ls(t,e,r);for(let a=1;a<=t.length;a++){const l=t[(i+a)%t.length];if(!l)continue;const V=e(l);if(V!==r&&!o(s[V]))return V}return null}function rr(t){return!t.isStreaming&&t.allAnswered}function Vs(t){const{parts:e,partKey:s,schema:o,defaultValues:r,isStreaming:i,hasAnswer:a,onSubmit:l}=t,V=e[0]?s(e[0]):"",[d,u]=E.useState(V),[c,p]=E.useState(!1),f=js({resolver:ks(o),defaultValues:r}),m=f.watch(),h=ls(e,s,d),g=h>=0?e[h]:void 0,v=a(m[d]),x=Ct(e,s,m,a),b=rr({isStreaming:i,allAnswered:x}),A=()=>{if(h>0){const I=e[h-1];I&&u(s(I))}},j=()=>{if(h>=0&&h<e.length-1){const I=e[h+1];I&&u(s(I))}},k=()=>{const I=f.getValues(),N=Nt(e,s,I,a,d);N&&u(N)},y=()=>{f.handleSubmit(I=>{const N=I;for(const T of e)l(T,N[s(T)])})()},w=E.useRef(y);w.current=y;const C=()=>{b&&(p(!1),w.current())},S=()=>{const I=f.getValues();if(Ct(e,s,I,a)){if(i){p(!0);return}p(!1),w.current()}else{const N=Nt(e,s,I,a,d);N&&u(N)}};return E.useEffect(()=>{if(c&&!i){if(!x){p(!1);return}p(!1),w.current()}},[c,i,x]),{form:f,activeKey:d,setActiveKey:u,currentIndex:h,currentPart:g,isCurrentAnswered:v,isAllAnswered:x,canSubmit:b,goPrev:A,goNext:j,advanceToNextUnanswered:k,submit:C,submitOrAdvance:S}}const cs="chat.approval.defaultDenyReason";function ds(t){const e=R.c(36),{onYolo:s}=t,o=B(),[r,i]=Se();let a,l,V,d,u,c,p,f,m;if(e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==o){const A=we.find(y=>y.value===r.toolApprovalLevel)??we[0];let j;e[13]!==s||e[14]!==r||e[15]!==i?(j=y=>{const w=y,C=r.toolApprovalLevel??"readonly";i({...r,toolApprovalLevel:w}),w==="auto"&&s(C)},e[13]=s,e[14]=r,e[15]=i,e[16]=j):j=e[16];const k=j;V=Un,f=r.toolApprovalLevel,m=k,l=Ln,u="xs",c="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",p=ir,a=Fn,d=o(A.shortKey),e[0]=s,e[1]=r,e[2]=i,e[3]=o,e[4]=a,e[5]=l,e[6]=V,e[7]=d,e[8]=u,e[9]=c,e[10]=p,e[11]=f,e[12]=m}else a=e[4],l=e[5],V=e[6],d=e[7],u=e[8],c=e[9],p=e[10],f=e[11],m=e[12];let h;e[17]!==a||e[18]!==d?(h=n.jsx(a,{children:d}),e[17]=a,e[18]=d,e[19]=h):h=e[19];let g;e[20]!==l||e[21]!==u||e[22]!==c||e[23]!==p||e[24]!==h?(g=n.jsx(l,{size:u,className:c,onClick:p,children:h}),e[20]=l,e[21]=u,e[22]=c,e[23]=p,e[24]=h,e[25]=g):g=e[25];let v;e[26]!==o?(v=we.map(A=>n.jsx(En,{value:A.value,children:o(A.labelKey)},A.value)),e[26]=o,e[27]=v):v=e[27];let x;e[28]!==v?(x=n.jsx(zn,{children:v}),e[28]=v,e[29]=x):x=e[29];let b;return e[30]!==V||e[31]!==x||e[32]!==f||e[33]!==m||e[34]!==g?(b=n.jsxs(V,{value:f,onValueChange:m,children:[g,x]}),e[30]=V,e[31]=x,e[32]=f,e[33]=m,e[34]=g,e[35]=b):b=e[35],b}function ir(t){return t.stopPropagation()}function us(t){const e=R.c(8),{input:s}=t,o=B();if(s==null){let a;e[0]!==o?(a=o("chat.approval.noInput"),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:a}),e[2]=a,e[3]=l):l=e[3],l}let r;try{let a;e[4]!==s?(a=JSON.stringify(s,null,2),e[4]=s,e[5]=a):a=e[5],r=a}catch{r=String(s)}let i;return e[6]!==r?(i=n.jsx("div",{className:"px-4",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[6]=r,e[7]=i):i=e[7],i}function ar(t){const e=R.c(38),{approval:s,onRespond:o}=t,r=B(),[i]=Se(),a=i.toolApprovalLevel??"readonly";let l;e[0]!==s.approvalId||e[1]!==a||e[2]!==o||e[3]!==r?(l=()=>o(s.approvalId,!1,r(cs),a),e[0]=s.approvalId,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const V=l;let d;e[5]!==s.approvalId||e[6]!==a||e[7]!==o?(d=()=>o(s.approvalId,!0,void 0,a),e[5]=s.approvalId,e[6]=a,e[7]=o,e[8]=d):d=e[8];const u=d;let c;e[9]!==s.approvalId||e[10]!==o?(c=C=>o(s.approvalId,!0,void 0,C),e[9]=s.approvalId,e[10]=o,e[11]=c):c=e[11];const p=c;let f;e[12]!==p?(f=n.jsx("div",{className:"flex items-center gap-2",children:n.jsx(ds,{onYolo:p})}),e[12]=p,e[13]=f):f=e[13];const m=f;let h;e[14]!==r?(h=r("chat.approval.denyButton"),e[14]=r,e[15]=h):h=e[15];let g;e[16]!==V||e[17]!==h?(g=n.jsx(Y,{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:V,children:h}),e[16]=V,e[17]=h,e[18]=g):g=e[18];let v;e[19]!==r?(v=r("chat.approval.acceptButton"),e[19]=r,e[20]=v):v=e[20];let x;e[21]!==u||e[22]!==v?(x=n.jsx(Y,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:v}),e[21]=u,e[22]=v,e[23]=x):x=e[23];let b;e[24]!==g||e[25]!==x?(b=n.jsxs(n.Fragment,{children:[g,x]}),e[24]=g,e[25]=x,e[26]=b):b=e[26];const A=b;let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(We,{size:14}),e[27]=j):j=e[27];let k;e[28]!==r?(k=r("chat.approval.needsApproval"),e[28]=r,e[29]=k):k=e[29];let y;e[30]!==s.input?(y=n.jsx(us,{input:s.input}),e[30]=s.input,e[31]=y):y=e[31];let w;return e[32]!==s.friendlyName||e[33]!==m||e[34]!==A||e[35]!==k||e[36]!==y?(w=n.jsx(pe,{icon:j,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:m,footerRight:A,children:y}),e[32]=s.friendlyName,e[33]=m,e[34]=A,e[35]=k,e[36]=y,e[37]=w):w=e[37],w}const lr=ws(ne(),re({approved:Ss().optional(),levelOverride:Le(["auto","readonly"]).optional()}));function Vr(t){const e=R.c(46),{approvals:s,isStreaming:o,onRespond:r}=t,i=B(),[a]=Se(),l=a.toolApprovalLevel??"readonly";let V;e[0]!==s?(V=Object.fromEntries(s.map(ur)),e[0]=s,e[1]=V):V=e[1];const d=V;let u;e[2]!==l||e[3]!==r||e[4]!==i?(u=(N,T)=>{const _=T;typeof _?.approved=="boolean"&&r(N.approvalId,_.approved,_.approved===!1?i(cs):void 0,_.levelOverride??l)},e[2]=l,e[3]=r,e[4]=i,e[5]=u):u=e[5];let c;e[6]!==s||e[7]!==d||e[8]!==o||e[9]!==u?(c={parts:s,partKey:dr,schema:lr,defaultValues:d,isStreaming:o,hasAnswer:cr,onSubmit:u},e[6]=s,e[7]=d,e[8]=o,e[9]=u,e[10]=c):c=e[10];const p=Vs(c);let f;e[11]!==s||e[12]!==p?(f=N=>{p.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:N}]))),p.submitOrAdvance()},e[11]=s,e[12]=p,e[13]=f):f=e[13];const m=f,h=p.currentPart,g=p.form;let v;e[14]!==p?(v=N=>{N.preventDefault(),p.submit()},e[14]=p,e[15]=v):v=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(We,{size:14}),e[16]=x):x=e[16];let b;e[17]!==s.length||e[18]!==i?(b=i("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=i,e[19]=b):b=e[19];const A=h?.friendlyName??"";let j;e[20]!==m?(j=n.jsx(ds,{onYolo:m}),e[20]=m,e[21]=j):j=e[21];let k;e[22]!==s.length||e[23]!==p.currentIndex||e[24]!==p.goNext||e[25]!==p.goPrev||e[26]!==j?(k=n.jsx(as,{currentIndex:p.currentIndex,total:s.length,onPrev:p.goPrev,onNext:p.goNext,extraLeft:j}),e[22]=s.length,e[23]=p.currentIndex,e[24]=p.goNext,e[25]=p.goPrev,e[26]=j,e[27]=k):k=e[27];let y;e[28]!==h||e[29]!==p.form.control||e[30]!==p.submitOrAdvance?(y=h?n.jsx(pr,{approvalId:h.approvalId,control:p.form.control,onChange:p.submitOrAdvance}):null,e[28]=h,e[29]=p.form.control,e[30]=p.submitOrAdvance,e[31]=y):y=e[31];let w;e[32]!==h?(w=h?n.jsx(us,{input:h.input}):null,e[32]=h,e[33]=w):w=e[33];let C;e[34]!==k||e[35]!==y||e[36]!==w||e[37]!==b||e[38]!==A?(C=n.jsx(pe,{icon:x,label:b,title:A,defaultExpanded:!0,footerLeft:k,footerRight:y,children:w}),e[34]=k,e[35]=y,e[36]=w,e[37]=b,e[38]=A,e[39]=C):C=e[39];let S;e[40]!==C||e[41]!==v?(S=n.jsx("form",{onSubmit:v,children:C}),e[40]=C,e[41]=v,e[42]=S):S=e[42];let I;return e[43]!==p.form||e[44]!==S?(I=n.jsx(nt,{...g,children:S}),e[43]=p.form,e[44]=S,e[45]=I):I=e[45],I}function cr(t){return typeof t?.approved=="boolean"}function dr(t){return t.approvalId}function ur(t){return[t.approvalId,{approved:void 0}]}function pr(t){const e=R.c(7),{approvalId:s,control:o,onChange:r}=t,i=B(),a=`${s}.approved`;let l;e[0]!==r||e[1]!==i?(l=d=>{const{field:u}=d,c=u.value===!0,p=u.value===!1;return n.jsxs(n.Fragment,{children:[n.jsx(Y,{type:"button",variant:p?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),r()},"aria-pressed":p,children:i("chat.approval.denyButton")}),n.jsx(Y,{type:"button",variant:c?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),r()},"aria-pressed":c,children:i("chat.approval.acceptButton")})]})},e[0]=r,e[1]=i,e[2]=l):l=e[2];let V;return e[3]!==o||e[4]!==a||e[5]!==l?(V=n.jsx(Cs,{control:o,name:a,render:l}),e[3]=o,e[4]=a,e[5]=l,e[6]=V):V=e[6],V}function fr(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(We,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.approval.preparingRequest"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function hr(t){const e=R.c(8),{approvals:s,isStreaming:o,onRespond:r}=t;if(o&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(fr,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;if(s.length===1){const a=s[0];if(!a)return null;let l;return e[1]!==r||e[2]!==a?(l=n.jsx(ar,{approval:a,onRespond:r}),e[1]=r,e[2]=a,e[3]=l):l=e[3],l}let i;return e[4]!==s||e[5]!==o||e[6]!==r?(i=n.jsx(Vr,{approvals:s,isStreaming:o,onRespond:r}),e[4]=s,e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function mr(t){const e=R.c(28),{plan:s,onApprove:o,onDismiss:r}=t,i=B();let a;e[0]!==o||e[1]!==s.plan?(a=()=>{o(s.plan)},e[0]=o,e[1]=s.plan,e[2]=a):a=e[2];const l=a;let V;e[3]!==i?(V=i("chat.proposePlan.keepIterating"),e[3]=i,e[4]=V):V=e[4];let d;e[5]!==r||e[6]!==V?(d=n.jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:V}),e[5]=r,e[6]=V,e[7]=d):d=e[7];let u;e[8]!==i?(u=i("chat.proposePlan.letsGo"),e[8]=i,e[9]=u):u=e[9];let c;e[10]!==l||e[11]!==u?(c=n.jsx(Y,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-special hover:bg-special/90 text-special-foreground active:scale-[0.97] transition-transform",onClick:l,children:u}),e[10]=l,e[11]=u,e[12]=c):c=e[12];let p;e[13]!==d||e[14]!==c?(p=n.jsxs(n.Fragment,{children:[d,c]}),e[13]=d,e[14]=c,e[15]=p):p=e[15];const f=p;let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Bt,{size:14}),e[16]=m):m=e[16];let h;e[17]!==i?(h=i("chat.proposePlan.planReady"),e[17]=i,e[18]=h):h=e[18];let g;e[19]!==i?(g=i("chat.proposePlan.implementationPlan"),e[19]=i,e[20]=g):g=e[20];let v;e[21]!==s.plan?(v=n.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:n.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:n.jsx($n,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=v):v=e[22];let x;return e[23]!==f||e[24]!==v||e[25]!==h||e[26]!==g?(x=n.jsx(pe,{icon:m,label:h,title:g,defaultExpanded:!0,footerRight:f,children:v}),e[23]=f,e[24]=v,e[25]=h,e[26]=g,e[27]=x):x=e[27],x}function gr(t){const e=R.c(6),{plans:s,onApprove:o,onDismiss:r}=t;let i;e[0]!==s?(i=os(s),e[0]=s,e[1]=i):i=e[1];const a=i;if(!a)return null;let l;return e[2]!==a||e[3]!==o||e[4]!==r?(l=n.jsx(mr,{plan:a,onApprove:o,onDismiss:r}),e[2]=a,e[3]=o,e[4]=r,e[5]=l):l=e[5],l}function ps(t){return t?"response"in t?t.response:t.option??t.draft:""}const It=re({response:ne().min(1,"Response is required")}),xr=re({option:ne().nullable(),draft:ne()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),vr=re({response:Le(["yes","no"])});function br(t){switch(t.type){case"text":return It;case"choice":return xr;case"confirm":return vr;default:return It}}function Ar(t){const e={};for(const s of t)e[s.toolCallId]=br(s.input);return re(e)}function yr(t){const e=R.c(7),{control:s,name:o,placeholder:r}=t,i=B();let a;e[0]!==r||e[1]!==i?(a=V=>{const{field:d}=V,u=d.value??"";return n.jsxs(Vt,{children:[n.jsx(ct,{children:n.jsx("div",{className:"px-2",children:n.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(Kt,{size:16,className:"text-muted-foreground"})}),n.jsx("input",{...d,value:u,type:"text",placeholder:r||i("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":i("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),n.jsx(dt,{})]})},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==s||e[4]!==o||e[5]!==a?(l=n.jsx(Yt,{control:s,name:o,render:a}),e[3]=s,e[4]=o,e[5]=a,e[6]=l):l=e[6],l}function fs(t,e){const s=R.c(4);let o,r;s[0]!==t||s[1]!==e?(o=()=>{const i=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const V=Number.parseInt(a.key,10);V>=1&&V<=t&&(a.preventDefault(),e(V-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=o,s[3]=r):(o=s[2],r=s[3]),E.useEffect(o,r)}function jr(t){const e=R.c(51),{control:s,name:o,options:r}=t,i=B(),a=`${o}.option`;let l;e[0]!==s||e[1]!==a?(l={control:s,name:a,defaultValue:null},e[0]=s,e[1]=a,e[2]=l):l=e[2];const{field:V}=mt(l),d=`${o}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:c}=mt(u),p=V.value,f=c.value??"";let m;if(e[6]!==V||e[7]!==r?(m=U=>{const M=r[U];M!=null&&V.onChange(M)},e[6]=V,e[7]=r,e[8]=m):m=e[8],fs(r.length,m),r.length===0)return null;const h=p===null;let g;e[9]!==i?(g=i("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=i,e[10]=g):g=e[10];let v;if(e[11]!==V||e[12]!==p||e[13]!==r||e[14]!==i){let U;e[16]!==V||e[17]!==p||e[18]!==i?(U=(M,L)=>{const z=p===M;return n.jsxs("button",{type:"button",onClick:()=>V.onChange(M),className:O("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",z&&"bg-accent/50",!z&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.selectOption",{option:M}),children:[n.jsx("span",{className:O("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",z?"bg-chart-1 text-white":"bg-muted text-foreground"),children:L+1}),n.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${L}-${M}`)},e[16]=V,e[17]=p,e[18]=i,e[19]=U):U=e[19],v=r.map(U),e[11]=V,e[12]=p,e[13]=r,e[14]=i,e[15]=v}else v=e[15];const x=h&&"bg-accent/50",b=!h&&"hover:bg-accent/30";let A;e[20]!==x||e[21]!==b?(A=O("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[20]=x,e[21]=b,e[22]=A):A=e[22];let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(Kt,{size:16,className:"text-muted-foreground"})}),e[23]=j):j=e[23];const k=h?f:"";let y;e[24]!==c||e[25]!==V||e[26]!==p?(y=U=>{c.onChange(U.target.value),p!==null&&V.onChange(null)},e[24]=c,e[25]=V,e[26]=p,e[27]=y):y=e[27];let w;e[28]!==V||e[29]!==p?(w=()=>{p!==null&&V.onChange(null)},e[28]=V,e[29]=p,e[30]=w):w=e[30];let C;e[31]!==i?(C=i("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=i,e[32]=C):C=e[32];let S;e[33]!==i?(S=i("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=i,e[34]=S):S=e[34];let I;e[35]!==k||e[36]!==y||e[37]!==w||e[38]!==C||e[39]!==S?(I=n.jsx("input",{type:"text",value:k,onChange:y,onFocus:w,placeholder:C,"aria-label":S,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=y,e[37]=w,e[38]=C,e[39]=S,e[40]=I):I=e[40];let N;e[41]!==A||e[42]!==I?(N=n.jsxs("label",{className:A,children:[j,I]}),e[41]=A,e[42]=I,e[43]=N):N=e[43];let T;e[44]!==N||e[45]!==g||e[46]!==v?(T=n.jsx(ct,{children:n.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":g,children:[v,N]})}),e[44]=N,e[45]=g,e[46]=v,e[47]=T):T=e[47];let _;e[48]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(dt,{}),e[48]=_):_=e[48];let P;return e[49]!==T?(P=n.jsxs(Vt,{children:[T,_]}),e[49]=T,e[50]=P):P=e[50],P}function kr(t){const e=R.c(8),{control:s,name:o}=t,r=B();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,l=E.useRef(null);let V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=c=>{l.current?.onChange(a[c]??"")},e[1]=V):V=e[1],fs(a.length,V);let d;e[2]!==r?(d=c=>{const{field:p}=c;return l.current=p,n.jsxs(Vt,{children:[n.jsx(ct,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":r("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:a.map(f=>{const m=p.value===f;return n.jsxs("button",{type:"button",onClick:()=>p.onChange(f),className:O("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.confirmValue",{value:r(`chat.userAskQuestion.confirm${f==="yes"?"Yes":"No"}`)}),children:[n.jsx("span",{className:O("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),n.jsx("span",{className:"text-sm text-foreground capitalize",children:r(`chat.userAskQuestion.confirm${f==="yes"?"Yes":"No"}`)})]},f)})})}),n.jsx(dt,{})]})},e[2]=r,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==o||e[6]!==d?(u=n.jsx(Yt,{control:s,name:o,render:d}),e[4]=s,e[5]=o,e[6]=d,e[7]=u):u=e[7],u}function Tt(t){const e=R.c(13),{input:s,control:o,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==o||e[1]!==s.default||e[2]!==i?(a=n.jsx(yr,{control:o,name:i,placeholder:s.default}),e[0]=o,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let l;return e[6]!==o||e[7]!==a||e[8]!==r?(l=n.jsx(jr,{control:o,name:r,options:a}),e[6]=o,e[7]=a,e[8]=r,e[9]=l):l=e[9],l}case"confirm":{const i=`${r}.response`;let a;return e[10]!==o||e[11]!==i?(a=n.jsx(kr,{control:o,name:i}),e[10]=o,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function wr(t){const e=R.c(91),{parts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=Ar(s.map(Ir)),e[0]=s,e[1]=i):i=e[1];const a=i;let l;e[2]!==s?(l=Object.fromEntries(s.map(Nr)),e[2]=s,e[3]=l):l=e[3];const V=l;let d;e[4]!==r?(d=($,F)=>{const Q=ps(F);Q&&r($,Q)},e[4]=r,e[5]=d):d=e[5];let u;e[6]!==V||e[7]!==o||e[8]!==s||e[9]!==a||e[10]!==d?(u={parts:s,partKey:Cr,schema:a,defaultValues:V,isStreaming:o,hasAnswer:Sr,onSubmit:d},e[6]=V,e[7]=o,e[8]=s,e[9]=a,e[10]=d,e[11]=u):u=e[11];const c=Vs(u),p=c.currentPart,f=B();let m;e[12]!==p||e[13]!==c||e[14]!==f?(m=()=>{const $=p;if(!$)return;const F=f("chat.userAskQuestion.skipMessage"),Q=$.toolCallId;$.input?.type==="choice"?(c.form.setValue(`${Q}.option`,null),c.form.setValue(`${Q}.draft`,F)):c.form.setValue(`${Q}.response`,F),c.advanceToNextUnanswered()},e[12]=p,e[13]=c,e[14]=f,e[15]=m):m=e[15];const h=m;let g;e[16]!==c.currentIndex||e[17]!==c.goNext||e[18]!==c.goPrev||e[19]!==s.length?(g=n.jsx(as,{currentIndex:c.currentIndex,total:s.length,onPrev:c.goPrev,onNext:c.goNext}),e[16]=c.currentIndex,e[17]=c.goNext,e[18]=c.goPrev,e[19]=s.length,e[20]=g):g=e[20];const v=g;let x;e[21]!==f?(x=f("chat.userAskQuestion.skip"),e[21]=f,e[22]=x):x=e[22];let b;e[23]!==h||e[24]!==x?(b=n.jsx(Y,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-7",children:x}),e[23]=h,e[24]=x,e[25]=b):b=e[25];let A;e[26]!==c.isAllAnswered||e[27]!==c.isCurrentAnswered||e[28]!==c.submitOrAdvance||e[29]!==o?(A=n.jsx(or,{isStreaming:o,isAllAnswered:c.isAllAnswered,isCurrentAnswered:c.isCurrentAnswered,onAdvanceOrSubmit:c.submitOrAdvance}),e[26]=c.isAllAnswered,e[27]=c.isCurrentAnswered,e[28]=c.submitOrAdvance,e[29]=o,e[30]=A):A=e[30];let j;e[31]!==b||e[32]!==A?(j=n.jsxs(n.Fragment,{children:[b,A]}),e[31]=b,e[32]=A,e[33]=j):j=e[33];const k=j;if(s.length===1){const $=s[0];if(!$?.input)return null;const F=c.form;let Q;e[34]!==c?(Q=ae=>{ae.preventDefault(),c.submit()},e[34]=c,e[35]=Q):Q=e[35];let Z;e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(st,{size:14}),e[36]=Z):Z=e[36];let se;e[37]!==f?(se=f("chat.userAskQuestion.questionPending"),e[37]=f,e[38]=se):se=e[38];let X;e[39]!==$.input?.prompt||e[40]!==f?(X=$.input?.prompt??f("chat.userAskQuestion.question"),e[39]=$.input?.prompt,e[40]=f,e[41]=X):X=e[41];const D=$.input;let K;e[42]!==c.form.control||e[43]!==$.toolCallId||e[44]!==D?(K=n.jsx(Tt,{input:D,control:c.form.control,toolCallId:$.toolCallId}),e[42]=c.form.control,e[43]=$.toolCallId,e[44]=D,e[45]=K):K=e[45];let H;e[46]!==k||e[47]!==se||e[48]!==X||e[49]!==K?(H=n.jsx(pe,{icon:Z,label:se,title:X,defaultExpanded:!0,footerRight:k,children:K}),e[46]=k,e[47]=se,e[48]=X,e[49]=K,e[50]=H):H=e[50];let ee;e[51]!==Q||e[52]!==H?(ee=n.jsx("form",{onSubmit:Q,autoComplete:"off",children:H}),e[51]=Q,e[52]=H,e[53]=ee):ee=e[53];let J;return e[54]!==c.form||e[55]!==ee?(J=n.jsx(nt,{...F,children:ee}),e[54]=c.form,e[55]=ee,e[56]=J):J=e[56],J}const y=c.form;let w;e[57]!==c?(w=$=>{$.preventDefault(),c.submit()},e[57]=c,e[58]=w):w=e[58];let C;e[59]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(st,{size:14}),e[59]=C):C=e[59];let S;e[60]!==f?(S=f("chat.userAskQuestion.questionPending"),e[60]=f,e[61]=S):S=e[61];const I=c.currentIndex+1;let N;e[62]!==s.length||e[63]!==f||e[64]!==I?(N=f("chat.userAskQuestion.questionCount",{current:I,total:s.length}),e[62]=s.length,e[63]=f,e[64]=I,e[65]=N):N=e[65];let T;e[66]!==p?.input?.prompt||e[67]!==f?(T=p?.input?.prompt??f("chat.userAskQuestion.question"),e[66]=p?.input?.prompt,e[67]=f,e[68]=T):T=e[68];const _=c.activeKey,P=c.setActiveKey;let U;if(e[69]!==c.form||e[70]!==s){let $;e[72]!==c.form?($=F=>n.jsx(Kn,{value:F.toolCallId,className:"mt-0",children:n.jsx(Tt,{input:F.input,control:c.form.control,toolCallId:F.toolCallId})},F.toolCallId),e[72]=c.form,e[73]=$):$=e[73],U=s.map($),e[69]=c.form,e[70]=s,e[71]=U}else U=e[71];let M;e[74]!==c.activeKey||e[75]!==c.setActiveKey||e[76]!==U?(M=n.jsx(qn,{value:_,onValueChange:P,children:U}),e[74]=c.activeKey,e[75]=c.setActiveKey,e[76]=U,e[77]=M):M=e[77];let L;e[78]!==v||e[79]!==k||e[80]!==S||e[81]!==N||e[82]!==T||e[83]!==M?(L=n.jsx(pe,{icon:C,label:S,count:N,title:T,defaultExpanded:!0,footerLeft:v,footerRight:k,children:M}),e[78]=v,e[79]=k,e[80]=S,e[81]=N,e[82]=T,e[83]=M,e[84]=L):L=e[84];let z;e[85]!==w||e[86]!==L?(z=n.jsx("form",{onSubmit:w,autoComplete:"off",children:L}),e[85]=w,e[86]=L,e[87]=z):z=e[87];let W;return e[88]!==c.form||e[89]!==z?(W=n.jsx(nt,{...y,children:z}),e[88]=c.form,e[89]=z,e[90]=W):W=e[90],W}function Sr(t){return!!ps(t)}function Cr(t){return t.toolCallId}function Nr(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Ir(t){return{toolCallId:t.toolCallId,input:t.input}}function Tr(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(st,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function hs(t){const e=R.c(7),{userAskParts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(_r),e[0]=s,e[1]=i):i=e[1];const a=i;if(a.length===0){if(o){let V;return e[2]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(Tr,{}),e[2]=V):V=e[2],V}return null}let l;return e[3]!==o||e[4]!==r||e[5]!==a?(l=n.jsx(wr,{parts:a,isStreaming:o,onSubmit:r}),e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function _r(t){return t.state==="input-available"}function Mr(t){const e=R.c(33),{parts:s,isStreaming:o,onRespond:r}=t,i=B();let a;e[0]!==s?(a=s.at(-1),e[0]=s,e[1]=a):a=e[1];const l=a,V=l?.input;if(!l||!V?.title)return null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Bt,{size:14}),e[2]=d):d=e[2];let u;e[3]!==i?(u=i("chat.suggestTask.label"),e[3]=i,e[4]=u):u=e[4];const c=V.title;let p;e[5]!==r||e[6]!==l?(p=()=>r(l,!1),e[5]=r,e[6]=l,e[7]=p):p=e[7];let f;e[8]!==i?(f=i("chat.suggestTask.notNow"),e[8]=i,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==p||e[12]!==f?(m=n.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"h-7",disabled:o,onClick:p,children:f}),e[10]=o,e[11]=p,e[12]=f,e[13]=m):m=e[13];let h;e[14]!==r||e[15]!==l?(h=()=>r(l,!0),e[14]=r,e[15]=l,e[16]=h):h=e[16];let g;e[17]!==i?(g=i("chat.suggestTask.create"),e[17]=i,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==h||e[21]!==g?(v=n.jsx(Y,{type:"button",size:"sm",className:"h-7",disabled:o,onClick:h,children:g}),e[19]=o,e[20]=h,e[21]=g,e[22]=v):v=e[22];let x;e[23]!==v||e[24]!==m?(x=n.jsxs(n.Fragment,{children:[m,v]}),e[23]=v,e[24]=m,e[25]=x):x=e[25];let b;e[26]!==V.summary?(b=V.summary?n.jsx("p",{className:"px-4 pb-1 text-sm leading-snug text-muted-foreground whitespace-pre-wrap",children:V.summary}):null,e[26]=V.summary,e[27]=b):b=e[27];let A;return e[28]!==V.title||e[29]!==x||e[30]!==b||e[31]!==u?(A=n.jsx(pe,{icon:d,label:u,title:c,defaultExpanded:!0,footerRight:x,children:b}),e[28]=V.title,e[29]=x,e[30]=b,e[31]=u,e[32]=A):A=e[32],A}function Dr(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,o=t.length;if(o>0&&s===o)return{icon:"completed",activity:"All done",progress:`${o}/${o}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${o} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${o} done`}:s>0?{icon:"pending",activity:`${o-s} pending`,progress:`${s}/${o} done`}:{icon:"pending",activity:`${o} todos`,progress:"not started"}}function Rr(t){const e=R.c(13),{todos:s}=t;if(s.length===0)return null;let o;e[0]!==s?(o=Dr(s),e[0]=s,e[1]=o):o=e[1];const r=o;let i;e[2]!==r.icon?(i=n.jsx(Lr,{status:r.icon}),e[2]=r.icon,e[3]=i):i=e[3];const a=r.activity,l=r.progress;let V;e[4]!==s?(V=s.map(Pr),e[4]=s,e[5]=V):V=e[5];let d;e[6]!==V?(d=n.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:V}),e[6]=V,e[7]=d):d=e[7];let u;return e[8]!==r.activity||e[9]!==r.progress||e[10]!==i||e[11]!==d?(u=n.jsx(pe,{icon:i,label:a,count:l,defaultExpanded:!1,children:d}),e[8]=r.activity,e[9]=r.progress,e[10]=i,e[11]=d,e[12]=u):u=e[12],u}function Pr(t,e){return n.jsx(Er,{todo:t},e)}function Er(t){const e=R.c(14),{todo:s}=t,o=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Ur,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const l=o&&"text-muted-foreground";let V;e[2]!==l?(V=O("relative text-sm leading-snug pt-px select-none",l),e[2]=l,e[3]=V):V=e[3];const d=o?"100%":"0%",u=o?"width 300ms ease 200ms":"width 150ms ease";let c;e[4]!==d||e[5]!==u?(c=n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=c):c=e[6];let p;e[7]!==i||e[8]!==V||e[9]!==c?(p=n.jsxs("span",{className:V,children:[i,c]}),e[7]=i,e[8]=V,e[9]=c,e[10]=p):p=e[10];let f;return e[11]!==a||e[12]!==p?(f=n.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,p]}),e[11]=a,e[12]=p,e[13]=f):f=e[13],f}function Ur(t){const e=R.c(4),{status:s}=t,o=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("svg",{viewBox:"0 0 21 21",children:n.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==o||e[2]!==r?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":o,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=o,e[2]=r,e[3]=a):a=e[3],a}function Lr(t){const e=R.c(13),{status:s}=t,o=B();if(s==="completed"){let a;e[0]!==o?(a=o("chat.todoStatus.completed"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:n.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=l):l=e[2];let V;return e[3]!==a?(V=n.jsx("span",{"aria-label":a,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:l}),e[3]=a,e[4]=V):V=e[4],V}if(s==="in_progress"){let a;e[5]!==o?(a=o("chat.todoStatus.inProgress"),e[5]=o,e[6]=a):a=e[6];let l;return e[7]!==a?(l=n.jsx("span",{"aria-label":a,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=a,e[8]=l):l=e[8],l}let r;e[9]!==o?(r=o("chat.todoStatus.pending"),e[9]=o,e[10]=r):r=e[10];let i;return e[11]!==r?(i=n.jsx("span",{"aria-label":r,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=r,e[12]=i):i=e[12],i}const Fr={usd:[{dollars:10,labelKey:"credits.topUp.starter"},{dollars:20,labelKey:"credits.topUp.popular"},{dollars:100,labelKey:"credits.topUp.bestValue"}],brl:[{dollars:50,labelKey:"credits.topUp.starter"},{dollars:100,labelKey:"credits.topUp.popular"},{dollars:500,labelKey:"credits.topUp.bestValue"}]},zr={"credits.topUp.starter":"starter","credits.topUp.popular":"popular","credits.topUp.bestValue":"best_value"};function Or(t){const e=R.c(46),{source:s,onDone:o}=t,r=B(),i=Ns(),[a]=Se(),[l,V]=E.useState(a.language==="pt-BR"?"brl":"usd"),[d,u]=E.useState(""),[c,p]=E.useState(!1),f=l==="brl"?"R$":"$";let m;e[0]!==l||e[1]!==i?(m=async M=>{const{url:L}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:M,currency:l});return L},e[0]=l,e[1]=i,e[2]=m):m=e[2];let h;e[3]!==o?(h=M=>{M&&window.open(M,"_blank","noopener,noreferrer"),o?.()},e[3]=o,e[4]=h):h=e[4];let g;e[5]!==r?(g=M=>{Pe.error(r("credits.topUp.failed",{message:M.message}))},e[5]=r,e[6]=g):g=e[6];let v;e[7]!==m||e[8]!==h||e[9]!==g?(v={mutationFn:m,onSuccess:h,onError:g},e[7]=m,e[8]=h,e[9]=g,e[10]=v):v=e[10];const{mutate:x,isPending:b}=Is(v);let A;e[11]!==l||e[12]!==s||e[13]!==x?(A=(M,L)=>{te("credits_topup_clicked",{amount_cents:M,currency:l,tier_label:L,source:s}),x(M)},e[11]=l,e[12]=s,e[13]=x,e[14]=A):A=e[14];const j=A,k=parseFloat(d),y=!isNaN(k)&&k>=1;let w,C,S;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=M=>{M&&V(M)},C=n.jsx(yt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),S=n.jsx(yt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"}),e[15]=w,e[16]=C,e[17]=S):(w=e[15],C=e[16],S=e[17]);let I;e[18]!==l?(I=n.jsx("div",{className:"mb-4",children:n.jsxs(so,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:w,children:[C,S]})}),e[18]=l,e[19]=I):I=e[19];const N=Fr[l];let T;if(e[20]!==j||e[21]!==f||e[22]!==b||e[23]!==r||e[24]!==N){let M;e[26]!==j||e[27]!==f||e[28]!==b||e[29]!==r?(M=L=>{const{dollars:z,labelKey:W}=L;return n.jsxs("button",{type:"button",disabled:b,onClick:()=>j(z*100,zr[W]??"preset"),className:O("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[n.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,z]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:r(W)})]},z)},e[26]=j,e[27]=f,e[28]=b,e[29]=r,e[30]=M):M=e[30],T=N.map(M),e[20]=j,e[21]=f,e[22]=b,e[23]=r,e[24]=N,e[25]=T}else T=e[25];let _;e[31]!==T?(_=n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:T}),e[31]=T,e[32]=_):_=e[32];let P;e[33]!==j||e[34]!==f||e[35]!==d||e[36]!==k||e[37]!==y||e[38]!==b||e[39]!==c||e[40]!==r?(P=c?n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),n.jsx(to,{type:"number",min:"1",step:"1",placeholder:r("credits.topUp.customPlaceholder"),value:d,onChange:M=>u(M.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(Y,{className:"h-10",disabled:!y||b,onClick:()=>j(Math.round(k*100),"custom"),children:r(b?"credits.topUp.opening":"credits.topUp.add")})]}):n.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>p(!0),children:r("credits.topUp.enterCustom")}),e[33]=j,e[34]=f,e[35]=d,e[36]=k,e[37]=y,e[38]=b,e[39]=c,e[40]=r,e[41]=P):P=e[41];let U;return e[42]!==_||e[43]!==P||e[44]!==I?(U=n.jsxs("div",{children:[I,_,P]}),e[42]=_,e[43]=P,e[44]=I,e[45]=U):U=e[45],U}const $r=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function Br(t){const e=R.c(47),{onDismiss:s}=t,{org:o}=Ce(),r=rt(),{decoKeyId:i}=eo(),a=B(),l=ze("credits");let V,d;if(e[0]!==o.id?(V=()=>{te("credits_exhausted_shown",{organization_id:o.id})},d=[o.id],e[0]=o.id,e[1]=V,e[2]=d):(V=e[1],d=e[2]),E.useEffect(V,d),!l)return null;let u;e[3]!==s?(u=N=>!N&&s?.(),e[3]=s,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=["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[5]=c):c=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:c.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[7]=f):f=e[7];let m;e[8]!==a?(m=a("chat.creditsExhaustedBanner.title"),e[8]=a,e[9]=m):m=e[9];let h;e[10]!==m?(h=n.jsx(Qn,{className:"text-xl font-semibold tracking-tight",children:m}),e[10]=m,e[11]=h):h=e[11];let g;e[12]!==a?(g=a("chat.creditsExhaustedBanner.description"),e[12]=a,e[13]=g):g=e[13];let v;e[14]!==g?(v=n.jsx(Wn,{className:"mt-1.5 text-sm leading-relaxed",children:g}),e[14]=g,e[15]=v):v=e[15];let x;e[16]!==v||e[17]!==h?(x=n.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[p,n.jsxs(Yn,{className:"relative gap-4",children:[f,n.jsxs("div",{children:[h,v]})]})]}),e[16]=v,e[17]=h,e[18]=x):x=e[18];let b;e[19]!==i||e[20]!==s||e[21]!==a?(b=i&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"rounded-xl border border-border p-5",children:n.jsx(Or,{source:"exhausted_banner",onDone:s})}),n.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:$r.map(N=>n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-success/15 shrink-0",children:n.jsx(it,{size:12,className:"text-success"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:a(N)})]},N))})]}),e[19]=i,e[20]=s,e[21]=a,e[22]=b):b=e[22];let A;e[23]!==a?(A=a("chat.creditsExhaustedBanner.dismiss"),e[23]=a,e[24]=A):A=e[24];let j;e[25]!==s||e[26]!==A?(j=n.jsx(Y,{variant:"ghost",size:"sm",onClick:s,children:A}),e[25]=s,e[26]=A,e[27]=j):j=e[27];let k;e[28]!==r||e[29]!==s||e[30]!==o.slug?(k=()=>{r({to:"/$org/settings/ai-providers",params:{org:o.slug}}),s?.()},e[28]=r,e[29]=s,e[30]=o.slug,e[31]=k):k=e[31];let y;e[32]!==a?(y=a("chat.creditsExhaustedBanner.manageProviders"),e[32]=a,e[33]=y):y=e[33];let w;e[34]!==k||e[35]!==y?(w=n.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:k,children:y}),e[34]=k,e[35]=y,e[36]=w):w=e[36];let C;e[37]!==j||e[38]!==w?(C=n.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[j,w]}),e[37]=j,e[38]=w,e[39]=C):C=e[39];let S;e[40]!==x||e[41]!==b||e[42]!==C?(S=n.jsxs(Gn,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Kr,children:[x,b,C]}),e[40]=x,e[41]=b,e[42]=C,e[43]=S):S=e[43];let I;return e[44]!==S||e[45]!==u?(I=n.jsx(Hn,{open:!0,onOpenChange:u,children:S}),e[44]=S,e[45]=u,e[46]=I):I=e[46],I}function Kr(t){return t.preventDefault()}const qr={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function Qr(t){const e=R.c(16),{kind:s,onDismiss:o,onSubscribe:r}=t,i=B(),{label:a,title:l}=qr[s];let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(at,{size:14}),e[0]=V):V=e[0];let d;e[1]!==a||e[2]!==i?(d=i(a),e[1]=a,e[2]=i,e[3]=d):d=e[3];let u;e[4]!==i||e[5]!==l?(u=i(l),e[4]=i,e[5]=l,e[6]=u):u=e[6];let c;e[7]!==s||e[8]!==r||e[9]!==i?(c=s==="trial_exhausted"?n.jsx(Y,{size:"sm",onClick:r,className:"h-7 text-xs",children:i("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=r,e[9]=i,e[10]=c):c=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u||e[14]!==c?(p=n.jsx(pe,{icon:V,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:o,footerRight:c}),e[11]=o,e[12]=d,e[13]=u,e[14]=c,e[15]=p):p=e[15],p}const Wr={ai_budget_exhausted:{label:"chat.planRefused.budgetLabel",title:"chat.planRefused.budgetTitle"},feature_not_in_plan:{label:"chat.planRefused.featureLabel",title:"chat.planRefused.featureTitle"}};function _t(t){const e=R.c(21),{kind:s,onDismiss:o}=t,r=B(),i=rt(),{org:a}=Ce(),{label:l,title:V}=Wr[s];let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(at,{size:14}),e[0]=d):d=e[0];let u;e[1]!==l||e[2]!==r?(u=r(l),e[1]=l,e[2]=r,e[3]=u):u=e[3];let c;e[4]!==r||e[5]!==V?(c=r(V),e[4]=r,e[5]=V,e[6]=c):c=e[6];let p;e[7]!==i||e[8]!==o||e[9]!==a.slug?(p=()=>{i({to:"/$org/settings/ai-providers",params:{org:a.slug}}),o()},e[7]=i,e[8]=o,e[9]=a.slug,e[10]=p):p=e[10];let f;e[11]!==r?(f=r("chat.planRefused.seePlans"),e[11]=r,e[12]=f):f=e[12];let m;e[13]!==p||e[14]!==f?(m=n.jsx(Y,{size:"sm",className:"h-7 text-xs",onClick:p,children:f}),e[13]=p,e[14]=f,e[15]=m):m=e[15];let h;return e[16]!==o||e[17]!==u||e[18]!==c||e[19]!==m?(h=n.jsx(pe,{icon:d,label:u,title:c,defaultExpanded:!0,variant:"warning",onClose:o,footerRight:m}),e[16]=o,e[17]=u,e[18]=c,e[19]=m,e[20]=h):h=e[20],h}function ms(t){const e=Yr(t);if(e!==null){const d=ms(e);return{summary:d.summary,rawDetails:d.rawDetails??t}}const s=t.trim(),o=s.startsWith("<")&&/<[a-z][\s\S]*>/i.test(s),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(s),i=/failed to fetch|networkerror|load failed|offline/i.test(s),a=/timeout|timed out|aborted|deadline/i.test(s),l=s.length>240,V=/sandbox failed to start(?::\s*(.+))?/is.exec(s);if(V){const d=V[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 r||o&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:o||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}function Yr(t){const e=t.trim();if(!e.startsWith("{"))return null;let s;try{s=JSON.parse(e)}catch{return null}if(!s||typeof s!="object")return null;const{error:o,message:r}=s,i=typeof o=="string"?o:r;return typeof i=="string"&&i.trim()&&!i.trim().startsWith("{")?i:null}const Gr={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Qe(t){const e=R.c(29),s=B(),{variant:o,onDismiss:r}=t,i=o==="error";let a;e[0]!==i||e[1]!==s?(a=s(i?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a,V=i?Rn:_s;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const x=Gr[t.finishReason];return x?s(x):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let c;e[8]!==i||e[9]!==u?(c=i?ms(u):{summary:u,rawDetails:null},e[8]=i,e[9]=u,e[10]=c):c=e[10];const{summary:p,rawDetails:f}=c;let m;e[11]!==V?(m=n.jsx(V,{size:14}),e[11]=V,e[12]=m):m=e[12];let h;e[13]!==i||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(h=i?n.jsx(Y,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):n.jsx(Y,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=i,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=h):h=e[17];let g;e[18]!==f||e[19]!==s?(g=f?n.jsxs("details",{className:"group mx-4",children:[n.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:[n.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:n.jsx("path",{d:"m4.5 3 3 3-3 3"})}),n.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),n.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),n.jsxs("div",{className:"relative mt-2",children:[n.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(f).then(()=>Pe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>Pe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-lg bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:n.jsx(Pn,{className:"size-3.5"})}),n.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:f})]})]}):null,e[18]=f,e[19]=s,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==r||e[23]!==p||e[24]!==m||e[25]!==h||e[26]!==g||e[27]!==o?(v=n.jsx(pe,{icon:m,label:l,title:p,defaultExpanded:!0,variant:o,onClose:r,footerRight:h,children:g}),e[21]=l,e[22]=r,e[23]=p,e[24]=m,e[25]=h,e[26]=g,e[27]=o,e[28]=v):v=e[28],v}function Oe(t){const e=R.c(77);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{inline:o,voiceMode:r}=s,i=o===void 0?!1:o,a=r===void 0?!1:r,l=B(),{error:V,clearError:d,finishReason:u,clearFinishReason:c,messages:p,isStreaming:f,submit:m,sendMessage:h}=Fe(),[g,v]=Se(),{virtualMcpId:x,createTaskWithMessage:b}=Ye(),{chatMode:A,simpleModeTier:j}=Ge(),k=ze("credits"),{mutate:y}=ro("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let w;e[2]!==y?(w=()=>y(),e[2]=y,e[3]=w):w=e[3];const C=w;let S;e[4]!==A||e[5]!==j||e[6]!==x||e[7]!==a?(S=oe=>({...a?{voiceMode:!0}:{},tier:j,mode:A,toolApprovalLevel:oe,agent:x?{id:x}:void 0}),e[4]=A,e[5]=j,e[6]=x,e[7]=a,e[8]=S):S=e[8];const I=S;let N;e[9]!==g.toolApprovalLevel?(N=g.toolApprovalLevel??Ts(),e[9]=g.toolApprovalLevel,e[10]=N):N=e[10];const T=N,_=p.at(-1),P=_?.role==="assistant"?_.parts:[],U=P.filter(ei),M=P.filter(Xr),L=rs(P),z=ns(P);let W;e[11]!==V||e[12]!==h||e[13]!==l?(W=()=>{if(V){const ue={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:l("chat.highlight.fixInChatMessage",{error:V.message})}]}]};h(ue)}},e[11]=V,e[12]=h,e[13]=l,e[14]=W):W=e[14];const $=W;let F;e[15]!==h||e[16]!==l?(F=()=>{const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:l("chat.highlight.pleaseContinue")}]}]};h(oe)},e[15]=h,e[16]=l,e[17]=F):F=e[17];const Q=F;let Z;e[18]!==I||e[19]!==T||e[20]!==m?(Z=(oe,ue)=>{m({kind:"toolOutput",toolCallId:oe.toolCallId,output:{response:ue}},I(T))},e[18]=I,e[19]=T,e[20]=m,e[21]=Z):Z=e[21];const se=Z;let X;e[22]!==I||e[23]!==T||e[24]!==m?(X=(oe,ue)=>{m({kind:"toolOutput",toolCallId:oe.toolCallId,output:{accepted:ue}},I(T))},e[22]=I,e[23]=T,e[24]=m,e[25]=X):X=e[25];const D=X;let K;e[26]!==b||e[27]!==g||e[28]!==v||e[29]!==l||e[30]!==x?(K=oe=>{v({...g,toolApprovalLevel:"auto"}),b({virtualMcpId:x,message:{parts:[{type:"text",text:l("chat.highlight.implementPlanMessage",{plan:oe})}]}})},e[26]=b,e[27]=g,e[28]=v,e[29]=l,e[30]=x,e[31]=K):K=e[31];const H=K,ee=Zr;let J;e[32]!==I||e[33]!==m?(J=(oe,ue,Be,be)=>{m({kind:"approval",approvalId:oe,approved:ue,...Be?{reason:Be}:{}},I(be))},e[32]=I,e[33]=m,e[34]=J):J=e[34];const ae=J,G=is();if(G.isCreditExhausted){let oe;return e[35]!==k||e[36]!==d||e[37]!==i?(oe=k?n.jsx(Br,{onDismiss:d}):n.jsx("div",{className:O(!i&&"absolute bottom-full left-0 right-0"),children:n.jsx(_t,{kind:"ai_budget_exhausted",onDismiss:d})}),e[35]=k,e[36]=d,e[37]=i,e[38]=oe):oe=e[38],oe}const{showError:ce,showWarning:ie,hasApprovals:fe}=G,le=U.map(Jr).join("|"),$e=os(L)?.toolCallId??"",ft=z.map(Hr).join("|"),Ne=!i&&"absolute bottom-full left-0 right-0";let Ve;e[39]!==Ne?(Ve=O(Ne),e[39]=Ne,e[40]=Ve):Ve=e[40];let he;e[41]!==G.todos?(he=n.jsx(Rr,{todos:G.todos}),e[41]=G.todos,e[42]=he):he=e[42];let ge;e[43]!==d||e[44]!==G.subscriptionErrorKind||e[45]!==C?(ge=G.subscriptionErrorKind&&n.jsx(Qr,{kind:G.subscriptionErrorKind,onDismiss:d,onSubscribe:C}),e[43]=d,e[44]=G.subscriptionErrorKind,e[45]=C,e[46]=ge):ge=e[46];let de;e[47]!==d||e[48]!==G.planRefusal?(de=G.planRefusal&&n.jsx(_t,{kind:G.planRefusal,onDismiss:d}),e[47]=d,e[48]=G.planRefusal,e[49]=de):de=e[49];let xe;e[50]!==d||e[51]!==V||e[52]!==$||e[53]!==ce?(xe=ce&&n.jsx(Qe,{variant:"error",error:V,onDismiss:d,onFixInChat:$}),e[50]=d,e[51]=V,e[52]=$,e[53]=ce,e[54]=xe):xe=e[54];let je;e[55]!==c||e[56]!==u||e[57]!==Q||e[58]!==ie?(je=ie&&n.jsx(Qe,{variant:"warning",finishReason:u,onDismiss:c,onContinue:Q}),e[55]=c,e[56]=u,e[57]=Q,e[58]=ie,e[59]=je):je=e[59];const Ie=fe&&n.jsx(hr,{approvals:z,isStreaming:f,onRespond:ae},ft),_e=G.hasPlans&&n.jsx(gr,{plans:L,isStreaming:f,onApprove:H,onDismiss:ee},$e),Me=G.hasTaskSuggestion&&n.jsx(Mr,{parts:M,isStreaming:f,onRespond:D},M.at(-1)?.toolCallId??"");let ve;e[60]!==G.isWaitingForUserInput||e[61]!==se||e[62]!==f||e[63]!==le||e[64]!==U?(ve=G.isWaitingForUserInput&&n.jsx(hs,{userAskParts:U,isStreaming:f,onSubmit:se},le),e[60]=G.isWaitingForUserInput,e[61]=se,e[62]=f,e[63]=le,e[64]=U,e[65]=ve):ve=e[65];let ke;return e[66]!==Ve||e[67]!==he||e[68]!==ge||e[69]!==de||e[70]!==xe||e[71]!==je||e[72]!==Ie||e[73]!==_e||e[74]!==Me||e[75]!==ve?(ke=n.jsxs("div",{className:Ve,children:[he,ge,de,xe,je,Ie,_e,Me,ve]}),e[66]=Ve,e[67]=he,e[68]=ge,e[69]=de,e[70]=xe,e[71]=je,e[72]=Ie,e[73]=_e,e[74]=Me,e[75]=ve,e[76]=ke):ke=e[76],ke}function Hr(t){return t.approvalId}function Jr(t){return t.toolCallId}function Zr(){document.querySelector("[data-chat-input]")?.focus()}function Xr(t){return t.type==="tool-suggest_task"&&t.state==="input-available"}function ei(t){return t.type==="tool-user_ask"}Oe.Error=function(e){return n.jsx(Qe,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Oe.Warning=function(e){return n.jsx(Qe,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Oe.UserAskQuestion=hs;function gs(t){const e=R.c(20),{taskId:s}=t,o=B(),r=xn(s),i=vn(r),a=bn(),{stop:l,removeLocalMessage:V}=Fe();if(i.length===0)return null;let d;e[0]!==o?(d=o("chat.queueTray.sendNow"),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==l?(u=()=>{l()},e[2]=l,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ot,{size:14}),e[4]=c):c=e[4];let p;e[5]!==d||e[6]!==u?(p=n.jsx(He,{asChild:!0,children:n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:c})}),e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==o?(f=o("chat.queueTray.sendNow"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=n.jsx(Je,{side:"top",children:n.jsx("p",{className:"text-xs",children:f})}),e[10]=f,e[11]=m):m=e[11];let h;e[12]!==p||e[13]!==m?(h=n.jsxs(Ze,{delayDuration:400,children:[p,m]}),e[12]=p,e[13]=m,e[14]=h):h=e[14];let g;return e[15]!==a||e[16]!==V||e[17]!==o||e[18]!==s?(g=(v,x)=>n.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[n.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:x+1}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:v.text}),n.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm",title:o("chat.queueTray.removeFromQueue"),"aria-label":o("chat.queueTray.removeFromQueue"),onClick:()=>{a.cancel(s,v.messageId).then(b=>{b&&(An(s,v.messageId),V(v.messageId))})},children:n.jsx(io,{className:"size-3.5"})})})]},v.messageId),e[15]=a,e[16]=V,e[17]=o,e[18]=s,e[19]=g):g=e[19],n.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[n.jsx("span",{children:o(i.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:i.length})}),h]}),i.map(g)]})}function ti(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const si={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function ni(t){const e=R.c(31),{tier:s,orgSlot:o,userSlot:r,autoSlot:i,onPick:a,onReset:l,onClose:V}=t,d=B(),u=es(),c=new Set(u.map(oi)),p=yn([r,o,i],c),f=p?.keyId??null,[m,h]=E.useState(f??u[0]?.id??null),g=u.some(L=>L.id===m)?m:f??u[0]?.id??null,v=g?u.find(L=>L.id===g):null,x="flex h-[70vh] max-h-[460px] w-full flex-col",b=si[s];let A;e[0]!==d||e[1]!==b?(A=d(b),e[0]=d,e[1]=b,e[2]=A):A=e[2];let j;e[3]!==A?(j=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:A}),e[3]=A,e[4]=j):j=e[4];let k;e[5]!==l||e[6]!==d||e[7]!==r?(k=r&&n.jsx("button",{type:"button",onClick:l,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-lg hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=l,e[6]=d,e[7]=r,e[8]=k):k=e[8];let y;e[9]!==j||e[10]!==k?(y=n.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[j,k]}),e[9]=j,e[10]=k,e[11]=y):y=e[11];const w="flex-1 min-h-0",C=E.Suspense;let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ao,{}),e[12]=S):S=e[12];const I=vo,N=!0,T=ti(f?p:null,v?.providerId??"deco");let _;e[13]!==g||e[14]!==a||e[15]!==h?(_=L=>{const z=L.keyId??g??"";h(z),a({keyId:z,modelId:L.modelId,title:L.title})},e[13]=g,e[14]=a,e[15]=h,e[16]=_):_=e[16];let P;e[17]!==I||e[18]!==g||e[19]!==V||e[20]!==h||e[21]!==T||e[22]!==_?(P=n.jsx(I,{compact:N,onClose:V,credentialId:g,onCredentialChange:h,selectedModel:T,onModelChange:_}),e[17]=I,e[18]=g,e[19]=V,e[20]=h,e[21]=T,e[22]=_,e[23]=P):P=e[23];let U;e[24]!==C||e[25]!==P||e[26]!==S?(U=n.jsx("div",{className:w,children:n.jsx(C,{fallback:S,children:P})}),e[24]=C,e[25]=P,e[26]=S,e[27]=U):U=e[27];let M;return e[28]!==U||e[29]!==y?(M=n.jsxs("div",{className:x,children:[y,U]}),e[28]=U,e[29]=y,e[30]=M):M=e[30],M}function oi(t){return t.id}const ri=["fast","smart","thinking"];function xs(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const Mt={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function ii(t){const e=R.c(28),{tier:s,pillIcon:o,groups:r}=t,i=B();let a;e[0]!==i?(a=xs(i),e[0]=i,e[1]=a):a=e[1];const l=a,[V,d]=E.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=w=>{w.onSelect(),d(!1)},e[2]=u):u=e[2];const c=u,p=l[s];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=O("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=f):f=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=O("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[4]=m):m=e[4];const h=l[s];let g;e[5]!==h?(g=n.jsx("span",{className:m,children:h}),e[5]=h,e[6]=g):g=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Gt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=v):v=e[7];let x;e[8]!==o||e[9]!==p||e[10]!==g?(x=n.jsx(He,{asChild:!0,children:n.jsx("span",{className:"inline-flex min-w-0 shrink",children:n.jsx(Ht,{asChild:!0,children:n.jsxs(Y,{type:"button",variant:"ghost",size:"default","aria-label":p,className:f,children:[o,g,v]})})})}),e[8]=o,e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==p?(b=n.jsx(Je,{children:p}),e[12]=p,e[13]=b):b=e[13];let A;e[14]!==x||e[15]!==b?(A=n.jsxs(Ze,{children:[x,b]}),e[14]=x,e[15]=b,e[16]=A):A=e[16];let j;if(e[17]!==r||e[18]!==i){let w;e[20]!==i?(w=C=>n.jsx("div",{className:"flex flex-col",children:C.rows.map(S=>n.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-lg hover:bg-muted",children:[n.jsxs("button",{type:"button",role:"menuitem","aria-label":S.title,onClick:()=>c(S),className:O("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",S.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[S.icon&&n.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:S.icon}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm",children:S.title}),S.subtitle&&n.jsx("div",{className:"text-xs text-muted-foreground",children:S.subtitle})]}),S.active&&n.jsx("span",{title:i("chat.tierTrigger.selected"),children:n.jsx(it,{size:14,className:"text-foreground mt-0.5"})})]}),S.modelOverride&&n.jsx(li,{label:S.title,render:S.modelOverride})]},S.key))},C.key),e[20]=i,e[21]=w):w=e[21],j=r.map(w),e[17]=r,e[18]=i,e[19]=j}else j=e[19];let k;e[22]!==j?(k=n.jsx(Jt,{align:"end",className:"p-1 w-64",onOpenAutoFocus:ai,children:n.jsx("div",{role:"menu",className:"flex flex-col",children:j})}),e[22]=j,e[23]=k):k=e[23];let y;return e[24]!==V||e[25]!==A||e[26]!==k?(y=n.jsxs(Zt,{open:V,onOpenChange:d,children:[A,k]}),e[24]=V,e[25]=A,e[26]=k,e[27]=y):y=e[27],y}function ai(t){return t.preventDefault()}function li(t){const e=R.c(38),{label:s,render:o}=t,r=B(),i=Xt(),[a,l]=E.useState(!1);let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=()=>l(!1),e[0]=V):V=e[0];const d=V;let u;e[1]!==s||e[2]!==r?(u=r("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=r,e[3]=u):u=e[3];const c=a&&"opacity-100";let p;e[4]!==c?(p=O("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-lg bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",c),e[4]=c,e[5]=p):p=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(un,{size:14}),e[6]=f):f=e[6];let m;e[7]!==u||e[8]!==p?(m=n.jsx("button",{type:"button","aria-label":u,className:p,children:f}),e[7]=u,e[8]=p,e[9]=m):m=e[9];const h=m;if(i){let A;e[10]!==h?(A=n.jsx(co,{asChild:!0,children:h}),e[10]=h,e[11]=A):A=e[11];let j;e[12]!==s||e[13]!==r?(j=r("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=r,e[14]=j):j=e[14];let k;e[15]!==j?(k=n.jsx(uo,{className:"sr-only",children:j}),e[15]=j,e[16]=k):k=e[16];let y;e[17]!==a||e[18]!==o?(y=a&&o(d),e[17]=a,e[18]=o,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==k?(w=n.jsxs(po,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,y]}),e[20]=y,e[21]=k,e[22]=w):w=e[22];let C;return e[23]!==a||e[24]!==w||e[25]!==A?(C=n.jsxs(fo,{open:a,onOpenChange:l,children:[A,w]}),e[23]=a,e[24]=w,e[25]=A,e[26]=C):C=e[26],C}let g;e[27]!==h?(g=n.jsx(Ht,{asChild:!0,children:h}),e[27]=h,e[28]=g):g=e[28];let v;e[29]!==a||e[30]!==o?(v=a&&o(d),e[29]=a,e[30]=o,e[31]=v):v=e[31];let x;e[32]!==v?(x=n.jsx(Jt,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:v}),e[32]=v,e[33]=x):x=e[33];let b;return e[34]!==a||e[35]!==g||e[36]!==x?(b=n.jsxs(Zt,{open:a,onOpenChange:l,children:[g,x]}),e[34]=a,e[35]=g,e[36]=x,e[37]=b):b=e[37],b}function Dt(t){return t==="fast"?n.jsx(at,{size:16}):t==="thinking"?n.jsx(dn,{size:16}):n.jsx(ho,{size:16})}function Vi(t){const e=R.c(13),s=wn();let o;e[0]!==t||e[1]!==s.tiers?(o=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=o):o=e[2];const r=o;let i;e[3]!==r?(i=r("fast"),e[3]=r,e[4]=i):i=e[4];let a;e[5]!==r?(a=r("smart"),e[5]=r,e[6]=a):a=e[6];let l;e[7]!==r?(l=r("thinking"),e[7]=r,e[8]=l):l=e[8];let V;return e[9]!==i||e[10]!==a||e[11]!==l?(V={fast:i,smart:a,thinking:l},e[9]=i,e[10]=a,e[11]=l,e[12]=V):V=e[12],V}function ci(){const t=R.c(23),e=B(),{simpleModeTier:s,setSimpleModeTier:o}=Ge(),r=mo(),i=es(),a=xo(i),l=Vi(a),{data:V,error:d}=jn();let u;t[0]!==V?(u=V===void 0?{tiers:{}}:V,t[0]=V,t[1]=u):u=t[1];const c=u,p=kn(),f=ze("model_choice"),m=Jn(),h=Zn();if(!m||!f)return null;let g,v;if(t[2]!==a||t[3]!==h||t[4]!==r||t[5]!==o||t[6]!==e||t[7]!==s||t[8]!==l||t[9]!==p||t[10]!==c||t[11]!==d){const k=xs(e);g="decopilot",v=ri.map(y=>{const w=l[y],C=c.tiers[y];return{key:`decopilot-${y}`,icon:Dt(y),title:k[y],subtitle:h?w??e(Mt[y]):e(Mt[y]),active:s===y,onSelect:()=>o(y),modelOverride:h?S=>n.jsxs(n.Fragment,{children:[d&&n.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),n.jsx(ni,{tier:y,orgSlot:r.tiers[y],userSlot:C,autoSlot:a.chat[y],onClose:S,onPick:I=>p.mutate({tier:y,slot:I}),onReset:()=>p.mutate({tier:y,slot:null})},`${y}:${C?.keyId??"org"}:${C?.modelId??""}`)]}):void 0}}),t[2]=a,t[3]=h,t[4]=r,t[5]=o,t[6]=e,t[7]=s,t[8]=l,t[9]=p,t[10]=c,t[11]=d,t[12]=g,t[13]=v}else g=t[12],v=t[13];let x;t[14]!==g||t[15]!==v?(x=[{key:g,rows:v}],t[14]=g,t[15]=v,t[16]=x):x=t[16];const b=x;let A;t[17]!==s?(A=Dt(s),t[17]=s,t[18]=A):A=t[18];let j;return t[19]!==b||t[20]!==A||t[21]!==s?(j=n.jsx(ii,{tier:s,pillIcon:A,groups:b}),t[19]=b,t[20]=A,t[21]=s,t[22]=j):j=t[22],j}function vs(t){const e=R.c(3),[s]=Se();let o;return e[0]!==s.enableSounds||e[1]!==t?(o=()=>{s.enableSounds&&To(t.dataUri).catch(i=>{console.warn(`[sound] ${t.name} playback failed:`,i)})},e[0]=s.enableSounds,e[1]=t,e[2]=o):o=e[2],o}const di={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"},ui=Xs.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),pi=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function fi(){const t=R.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1.5",children:pi.map(hi)}),t[0]=e):e=t[0],e}function hi(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function mi({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:o,isStreaming:r,onUnsupportedFile:i}){const a=B(),[l,V]=E.useState(!1),d=vs(di),{org:u}=Ce(),{editor:c}=Ft(),p=E.useRef(null),f=ut(o),m=()=>{!f||r||(V(!1),p.current?.click())},h=async D=>{const K=D.target.files;if(!K||K.length===0||!c)return;const H=Array.from(K);try{let ee=c.state.selection.from;for(const J of H)await ts(c,o??null,J,ee,i,a),ee=c.state.selection.to}finally{p.current&&(p.current.value="")}},g=So({connectionId:s,orgId:u.id,orgSlug:u.slug}),v=Ms.virtualMcpPrompts(s,u.id),{data:x,isLoading:b}=Ds({queryKey:v,queryFn:()=>Co(g),staleTime:6e4,enabled:l&&!!g}),A=x?.prompts??[],[j,k]=E.useState(null),{chatMode:y,setChatMode:w}=Ge(),[C,S]=Se(),I=we.find(D=>D.value===C.toolApprovalLevel)??we[0],N=a(I.shortKey),T=D=>{const K=we.find(H=>H.value===D);if(K){if(K.value===C.toolApprovalLevel){V(!1);return}d(),te("chat_approval_level_changed",{from_level:C.toolApprovalLevel,to_level:K.value,source:"tools_popover"}),S({...C,toolApprovalLevel:K.value}),V(!1)}},_=y==="plan",P=()=>{d();const D=_?"default":"plan";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},U=()=>{e(),V(!1)},M=async(D,K)=>{if(!c||!g)return;const H=jt(D._meta),ee={from:c.state.selection.from,to:c.state.selection.to};try{const J=await No(g,D.name,K);Zs(c,ee,{id:D.name,name:wo(D.name,H),metadata:J.messages,char:"/",kind:"prompt",args:K})}catch{Pe.error(a("chat.toolsPopover.failedLoadPrompt"))}},L=async D=>{V(!1);const K=!!(D.arguments&&D.arguments.length>0);if(te("chat_prompt_inserted",{prompt_name:D.name,with_arguments:K}),K){k(D);return}await M(D)},z=async D=>{j&&(await M(j,D),k(null))},W=()=>{d();const D=y==="gen-image"?"default":"gen-image";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},$=()=>{d();const D=y==="web-search"?"default":"web-search";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},F=()=>{d();const D=y==="deep-research"?"default":"deep-research";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},Q=y==="gen-image",Z=y==="web-search",se=y==="deep-research",X=n.jsx("input",{ref:p,type:"file",multiple:!0,accept:lo(o??null),className:"hidden",onChange:h,disabled:r});return n.jsxs(n.Fragment,{children:[X,n.jsxs(Rs,{open:l,onOpenChange:D=>{D&&!l&&te("chat_tools_popover_opened",{chat_mode:y}),V(D)},children:[n.jsx(Ps,{asChild:!0,children:n.jsxs(Y,{type:"button",variant:"ghost",size:"default",disabled:t,title:a("chat.toolsPopover.tools"),"aria-label":a("chat.toolsPopover.tools"),className:O("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[n.jsx(pn,{size:14}),n.jsx("span",{className:O("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:a("chat.toolsPopover.tools")})]})}),n.jsxs(Es,{align:"start",className:"w-56 p-1.5 space-y-1",children:[f?n.jsxs(Ae,{onClick:m,disabled:r,children:[n.jsx(kt,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]}):n.jsxs(Ze,{children:[n.jsx(He,{asChild:!0,children:n.jsxs(Ae,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:D=>D.preventDefault(),children:[n.jsx(kt,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]})}),n.jsx(Je,{side:"right",children:a("chat.toolsPopover.modelNoFileSupport")})]}),n.jsxs(Ae,{onClick:P,className:O(_&&"text-special"),children:[n.jsx($t,{size:16,className:O(_&&"text-special")}),n.jsx("span",{className:"flex-1 whitespace-nowrap",children:a("chat.toolsPopover.planMode")}),n.jsx("span",{className:O("text-xs text-muted-foreground",_&&"text-special font-medium"),children:ui})]}),n.jsxs(Ae,{onClick:W,className:O(Q&&"text-special"),children:[n.jsx(Wt,{size:16,className:O(Q&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.createImage")}),Q&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(Ae,{onClick:$,className:O(Z&&"text-special"),children:[n.jsx(qt,{size:16,className:O(Z&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.webSearch")}),Z&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(Ae,{onClick:F,className:O(se&&"text-special"),children:[n.jsx(Qt,{size:16,className:O(se&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.deepResearch")}),se&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(gt,{children:[n.jsxs(xt,{className:"gap-2",children:[n.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.prompts")})]}),n.jsx(vt,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:b?n.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[n.jsx(Us,{className:"size-3.5"}),a("chat.toolsPopover.loadingPrompts")]}):A.length===0?n.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:a("chat.toolsPopover.noPromptsAvailable")}):A.map(D=>n.jsxs(Ae,{onClick:()=>L(D),className:"flex flex-col items-start gap-0.5",children:[n.jsx("span",{className:"font-medium text-sm capitalize",children:D.title||ko(D.name,jt(D._meta))}),D.description&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:D.description})]},D.name))})]}),n.jsxs(gt,{children:[n.jsxs(xt,{className:"gap-2",children:[n.jsx(We,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.approval")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),n.jsx(vt,{className:"w-48 p-1.5",children:n.jsx(Ls,{value:C.toolApprovalLevel,onValueChange:T,children:we.map(D=>n.jsx(Fs,{value:D.value,children:a(D.labelKey)},D.value))})})]}),n.jsxs(Ae,{onClick:U,children:[n.jsx(Io,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.connections")}),n.jsx(E.Suspense,{children:n.jsx(fi,{})})]})]})]}),n.jsx(Js,{prompt:j,setPrompt:k,onSubmit:z})]})}const gi=[{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 xi(){const t=R.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1",children:gi.map(vi)}),t[0]=e):e=t[0],e}function vi(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function bi(t){const e=R.c(10),{onClick:s}=t,o=B();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=O("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=r):r=e[0];let i;e[1]!==o?(i=o("chat.connectionsBanner.description"),e[1]=o,e[2]=i):i=e[2];let a;e[3]!==i?(a=n.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:i}),e[3]=i,e[4]=a):a=e[4];let l,V;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(xi,{}),V=n.jsx(zs,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=l,e[6]=V):(l=e[5],V=e[6]);let d;return e[7]!==s||e[8]!==a?(d=n.jsxs("button",{type:"button",onClick:s,className:r,children:[a,l,V]}),e[7]=s,e[8]=a,e[9]=d):d=e[9],d}const Re=48;function Ai(){const t=R.c(9),[e,s]=E.useState("idle"),[o,r]=E.useState(""),[i,a]=E.useState(""),[l,V]=E.useState(ki),d=E.useRef(null),u=E.useRef(null),c=E.useRef(null),p=E.useRef(null),f=E.useRef(0),m=E.useRef(!1),h=E.useRef(""),g=E.useRef(""),v=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),u.current?.close().catch(ji),p.current?.getTracks().forEach(yi),c.current=null,u.current=null,p.current=null},t[0]=x):x=t[0];const b=x;let A;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const I=N=>{p.current=N;const T=new AudioContext;u.current=T;const _=T.createMediaStreamSource(N),P=T.createAnalyser();P.fftSize=128,P.smoothingTimeConstant=.8,_.connect(P),c.current=P;const U=new Uint8Array(P.frequencyBinCount),M=()=>{if(!c.current)return;c.current.getByteFrequencyData(U);const L=[];for(let z=0;z<Re;z++){const W=Math.floor(z/Re*U.length);L.push(Math.max(.04,(U[W]??0)/255))}V(L),f.current=requestAnimationFrame(M)};M()};A=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}r(""),a(""),g.current="",h.current="",m.current=!0,s("recording"),I(T);const _=new N;d.current=_,_.interimResults=!0,_.continuous=!0,_.lang=navigator.language||"en-US",_.onresult=P=>{if(d.current!==_)return;let U="",M="";for(let L=P.resultIndex;L<P.results.length;L++){const z=P.results[L],W=z?.[0]?.transcript??"";z?.isFinal?M=M+W:U=U+W}M&&(h.current=h.current+M,r(h.current)),g.current=U,a(U)},_.onerror=P=>{d.current===_&&P.error!=="no-speech"&&(m.current=!1,d.current=null,b(),s(P.error==="not-allowed"?"permission-denied":"idle"))},_.onend=()=>{if(d.current===_&&m.current)try{_.start()}catch{}};try{_.start()}catch{return m.current=!1,d.current=null,b(),s("idle"),"idle"}return"recording"},t[1]=A}else A=t[1];const j=A;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{m.current=!1,d.current?.stop(),b(),s("idle"),V(Array(Re).fill(.05)),a("");const I=(h.current+(g.current?" "+g.current:"")).trim();return r(""),h.current="",g.current="",I},t[2]=k):k=t[2];const y=k;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{m.current=!1,d.current?.abort(),b(),s("idle"),r(""),a(""),V(Array(Re).fill(.05)),h.current="",g.current=""},t[3]=w):w=t[3];const C=w;let S;return t[4]!==i||t[5]!==e||t[6]!==o||t[7]!==l?(S={status:e,transcript:o,interimTranscript:i,waveformData:l,isSupported:v,startRecording:j,stopRecording:y,cancelRecording:C},t[4]=i,t[5]=e,t[6]=o,t[7]=l,t[8]=S):S=t[8],S}function yi(t){return t.stop()}function ji(){}function ki(){return Array(Re).fill(.05)}function wi(t){const e=R.c(4),{data:s}=t;let o;e[0]!==s?(o=s.map(Si),e[0]=s,e[1]=o):o=e[1];let r;return e[2]!==o?(r=n.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:o}),e[2]=o,e[3]=r):r=e[3],r}function Si(t,e){return n.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}const Ee=12e3,Rt=re({token:ne(),expiresAt:$s()});Bs("provider",[re({provider:ye("elevenlabs"),conversationToken:ne().min(1)}),re({provider:ye("openai"),transport:ye("webrtc")})]);const Ci=Os([Rt.extend({provider:ye("elevenlabs").default("elevenlabs"),conversationToken:ne().min(1)}),Rt.extend({provider:ye("openai"),transport:ye("webrtc")})]);re({token:ne().min(1).max(4096),text:ne().trim().min(1).max(Ee)});const bs=re({request:ne().trim().min(1).max(Ee)}),ot=5e3;Ut(re({role:Le(["user","agent"]),text:ne().min(1).max(ot)})).max(60).refine(t=>t.reduce((e,s)=>e+s.text.length,0)<=ot,{message:"Voice transcript is too long"});function Xa(t){const e=[];let s=ot;for(const o of t.slice(-60).reverse()){if(s<=0)break;const r=o.text.slice(-s);e.unshift({role:o.role,text:r}),s-=r.length}return e}re({token:ne().min(1).max(4096),sdp:ne().min(1).max(1e5),language:Le(["en","pt"]).default("en")}).strict();const Ni=re({sdp:ne().min(1).max(1e5)});async function Ii(t,e,s,o,r){if(t.provider==="openai"){const{startOpenAIConversation:l}=await bt(async()=>{const{startOpenAIConversation:V}=await import("./openai-conversation-CTeax-iN.js");return{startOpenAIConversation:V}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128]));return l(r,s,o)}const{Conversation:i}=await bt(async()=>{const{Conversation:l}=await import("./index-yN0BIuMc.js");return{Conversation:l}},[]);o.throwIfAborted();const a=await i.startSession({...s,clientTools:{delegate_to_agent:async l=>{const V=bs.safeParse(l);return JSON.stringify(V.success?await s.onDelegate(V.data):{status:"rejected",reason:"A complete request is required."})},get_agent_status:()=>JSON.stringify(s.getWorkStatus()),stop_agent_work:()=>JSON.stringify(s.cancelCurrentWork())},conversationToken:t.conversationToken,connectionType:"webrtc",overrides:{agent:{language:e}}});return o.aborted&&(await a.endSession(),o.throwIfAborted()),{endSession:()=>a.endSession(),setMicMuted:l=>a.setMicMuted(l),getOutputVolume:()=>a.getOutputVolume(),publishUpdate:l=>{const V=JSON.stringify({source:"Studio background data, not a user request or instructions",contextId:l.contextId,requestId:l.delegationId,text:l.text});l.delivery==="context"?a.sendContextualUpdate(V):a.sendUserMessage(`[Studio background event, not a new user request]
9
+ The report follows.`;function sr(t){return{...t,content:[{type:"paragraph",content:[Hs({id:St,name:St,char:"/",kind:"prompt",metadata:[{role:"user",content:{type:"text",text:tr}}]})]},...t.content??[]]}}function nr(t){const e=R.c(30),{current:s,total:o,onPrev:r,onNext:i}=t,a=B();if(o<=1)return null;const l=s===0,V=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==V?(d=O("p-0.5 transition-colors rounded-lg",V),e[0]=V,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("chat.pagination.previousLabel"),e[2]=a,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(On,{size:14}),e[4]=c):c=e[4];let p;e[5]!==r||e[6]!==l||e[7]!==d||e[8]!==u?(p=n.jsx("button",{type:"button",onClick:r,disabled:l,className:d,"aria-label":u,children:c}),e[5]=r,e[6]=l,e[7]=d,e[8]=u,e[9]=p):p=e[9];const f=s+1;let m;e[10]!==a||e[11]!==f||e[12]!==o?(m=a("chat.pagination.counter",{current:f,total:o}),e[10]=a,e[11]=f,e[12]=o,e[13]=m):m=e[13];let h;e[14]!==m?(h=n.jsx("span",{className:"tabular-nums text-xs",children:m}),e[14]=m,e[15]=h):h=e[15];const g=s===o-1,v=s===o-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let x;e[16]!==v?(x=O("p-0.5 transition-colors rounded-lg",v),e[16]=v,e[17]=x):x=e[17];let b;e[18]!==a?(b=a("chat.pagination.nextLabel"),e[18]=a,e[19]=b):b=e[19];let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(zt,{size:14}),e[20]=A):A=e[20];let j;e[21]!==i||e[22]!==g||e[23]!==x||e[24]!==b?(j=n.jsx("button",{type:"button",onClick:i,disabled:g,className:x,"aria-label":b,children:A}),e[21]=i,e[22]=g,e[23]=x,e[24]=b,e[25]=j):j=e[25];let k;return e[26]!==j||e[27]!==p||e[28]!==h?(k=n.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[p,h,j]}),e[26]=j,e[27]=p,e[28]=h,e[29]=k):k=e[29],k}function as(t){const e=R.c(8),{currentIndex:s,total:o,onPrev:r,onNext:i,extraLeft:a}=t;let l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==o?(l=n.jsx(nr,{current:s,total:o,onPrev:r,onNext:i}),e[0]=s,e[1]=i,e[2]=r,e[3]=o,e[4]=l):l=e[4];let V;return e[5]!==a||e[6]!==l?(V=n.jsxs("div",{className:"flex items-center gap-2",children:[l,a]}),e[5]=a,e[6]=l,e[7]=V):V=e[7],V}function or(t){const e=R.c(17),{isStreaming:s,isAllAnswered:o,isCurrentAnswered:r,onAdvanceOrSubmit:i,submitLabel:a,nextLabel:l}=t,u=o?a===void 0?"Submit":a:l===void 0?"Next":l,c=o?s:!r,p=c?o?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==c||e[1]!==i?(f=()=>{c||i()},e[0]=c,e[1]=i,e[2]=f):f=e[2];const m=c&&"opacity-50 cursor-not-allowed";let h;e[3]!==m?(h=O("h-7 px-2.5 text-xs",m),e[3]=m,e[4]=h):h=e[4];let g;e[5]!==c||e[6]!==u||e[7]!==f||e[8]!==h?(g=n.jsx(Y,{type:"button",size:"sm","aria-disabled":c,onClick:f,className:h,children:u}),e[5]=c,e[6]=u,e[7]=f,e[8]=h,e[9]=g):g=e[9];const v=g;if(!p)return v;let x;e[10]!==v?(x=n.jsx(He,{asChild:!0,children:v}),e[10]=v,e[11]=x):x=e[11];let b;e[12]!==p?(b=n.jsx(Je,{children:p}),e[12]=p,e[13]=b):b=e[13];let A;return e[14]!==x||e[15]!==b?(A=n.jsxs(Ze,{children:[x,b]}),e[14]=x,e[15]=b,e[16]=A):A=e[16],A}function ls(t,e,s){return t.findIndex(o=>e(o)===s)}function Ct(t,e,s,o){return t.length===0?!1:t.every(r=>o(s[e(r)]))}function Nt(t,e,s,o,r){if(t.length===0)return null;const i=ls(t,e,r);for(let a=1;a<=t.length;a++){const l=t[(i+a)%t.length];if(!l)continue;const V=e(l);if(V!==r&&!o(s[V]))return V}return null}function rr(t){return!t.isStreaming&&t.allAnswered}function Vs(t){const{parts:e,partKey:s,schema:o,defaultValues:r,isStreaming:i,hasAnswer:a,onSubmit:l}=t,V=e[0]?s(e[0]):"",[d,u]=P.useState(V),[c,p]=P.useState(!1),f=js({resolver:ks(o),defaultValues:r}),m=f.watch(),h=ls(e,s,d),g=h>=0?e[h]:void 0,v=a(m[d]),x=Ct(e,s,m,a),b=rr({isStreaming:i,allAnswered:x}),A=()=>{if(h>0){const I=e[h-1];I&&u(s(I))}},j=()=>{if(h>=0&&h<e.length-1){const I=e[h+1];I&&u(s(I))}},k=()=>{const I=f.getValues(),N=Nt(e,s,I,a,d);N&&u(N)},y=()=>{f.handleSubmit(I=>{const N=I;for(const T of e)l(T,N[s(T)])})()},w=P.useRef(y);w.current=y;const C=()=>{b&&(p(!1),w.current())},S=()=>{const I=f.getValues();if(Ct(e,s,I,a)){if(i){p(!0);return}p(!1),w.current()}else{const N=Nt(e,s,I,a,d);N&&u(N)}};return P.useEffect(()=>{if(c&&!i){if(!x){p(!1);return}p(!1),w.current()}},[c,i,x]),{form:f,activeKey:d,setActiveKey:u,currentIndex:h,currentPart:g,isCurrentAnswered:v,isAllAnswered:x,canSubmit:b,goPrev:A,goNext:j,advanceToNextUnanswered:k,submit:C,submitOrAdvance:S}}const cs="chat.approval.defaultDenyReason";function ds(t){const e=R.c(36),{onYolo:s}=t,o=B(),[r,i]=Se();let a,l,V,d,u,c,p,f,m;if(e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==o){const A=we.find(y=>y.value===r.toolApprovalLevel)??we[0];let j;e[13]!==s||e[14]!==r||e[15]!==i?(j=y=>{const w=y,C=r.toolApprovalLevel??"readonly";i({...r,toolApprovalLevel:w}),w==="auto"&&s(C)},e[13]=s,e[14]=r,e[15]=i,e[16]=j):j=e[16];const k=j;V=Un,f=r.toolApprovalLevel,m=k,l=Ln,u="xs",c="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",p=ir,a=Fn,d=o(A.shortKey),e[0]=s,e[1]=r,e[2]=i,e[3]=o,e[4]=a,e[5]=l,e[6]=V,e[7]=d,e[8]=u,e[9]=c,e[10]=p,e[11]=f,e[12]=m}else a=e[4],l=e[5],V=e[6],d=e[7],u=e[8],c=e[9],p=e[10],f=e[11],m=e[12];let h;e[17]!==a||e[18]!==d?(h=n.jsx(a,{children:d}),e[17]=a,e[18]=d,e[19]=h):h=e[19];let g;e[20]!==l||e[21]!==u||e[22]!==c||e[23]!==p||e[24]!==h?(g=n.jsx(l,{size:u,className:c,onClick:p,children:h}),e[20]=l,e[21]=u,e[22]=c,e[23]=p,e[24]=h,e[25]=g):g=e[25];let v;e[26]!==o?(v=we.map(A=>n.jsx(Pn,{value:A.value,children:o(A.labelKey)},A.value)),e[26]=o,e[27]=v):v=e[27];let x;e[28]!==v?(x=n.jsx(zn,{children:v}),e[28]=v,e[29]=x):x=e[29];let b;return e[30]!==V||e[31]!==x||e[32]!==f||e[33]!==m||e[34]!==g?(b=n.jsxs(V,{value:f,onValueChange:m,children:[g,x]}),e[30]=V,e[31]=x,e[32]=f,e[33]=m,e[34]=g,e[35]=b):b=e[35],b}function ir(t){return t.stopPropagation()}function us(t){const e=R.c(8),{input:s}=t,o=B();if(s==null){let a;e[0]!==o?(a=o("chat.approval.noInput"),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=n.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:a}),e[2]=a,e[3]=l):l=e[3],l}let r;try{let a;e[4]!==s?(a=JSON.stringify(s,null,2),e[4]=s,e[5]=a):a=e[5],r=a}catch{r=String(s)}let i;return e[6]!==r?(i=n.jsx("div",{className:"px-4",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[6]=r,e[7]=i):i=e[7],i}function ar(t){const e=R.c(38),{approval:s,onRespond:o}=t,r=B(),[i]=Se(),a=i.toolApprovalLevel??"readonly";let l;e[0]!==s.approvalId||e[1]!==a||e[2]!==o||e[3]!==r?(l=()=>o(s.approvalId,!1,r(cs),a),e[0]=s.approvalId,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const V=l;let d;e[5]!==s.approvalId||e[6]!==a||e[7]!==o?(d=()=>o(s.approvalId,!0,void 0,a),e[5]=s.approvalId,e[6]=a,e[7]=o,e[8]=d):d=e[8];const u=d;let c;e[9]!==s.approvalId||e[10]!==o?(c=C=>o(s.approvalId,!0,void 0,C),e[9]=s.approvalId,e[10]=o,e[11]=c):c=e[11];const p=c;let f;e[12]!==p?(f=n.jsx("div",{className:"flex items-center gap-2",children:n.jsx(ds,{onYolo:p})}),e[12]=p,e[13]=f):f=e[13];const m=f;let h;e[14]!==r?(h=r("chat.approval.denyButton"),e[14]=r,e[15]=h):h=e[15];let g;e[16]!==V||e[17]!==h?(g=n.jsx(Y,{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:V,children:h}),e[16]=V,e[17]=h,e[18]=g):g=e[18];let v;e[19]!==r?(v=r("chat.approval.acceptButton"),e[19]=r,e[20]=v):v=e[20];let x;e[21]!==u||e[22]!==v?(x=n.jsx(Y,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:v}),e[21]=u,e[22]=v,e[23]=x):x=e[23];let b;e[24]!==g||e[25]!==x?(b=n.jsxs(n.Fragment,{children:[g,x]}),e[24]=g,e[25]=x,e[26]=b):b=e[26];const A=b;let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(We,{size:14}),e[27]=j):j=e[27];let k;e[28]!==r?(k=r("chat.approval.needsApproval"),e[28]=r,e[29]=k):k=e[29];let y;e[30]!==s.input?(y=n.jsx(us,{input:s.input}),e[30]=s.input,e[31]=y):y=e[31];let w;return e[32]!==s.friendlyName||e[33]!==m||e[34]!==A||e[35]!==k||e[36]!==y?(w=n.jsx(pe,{icon:j,label:k,title:s.friendlyName,defaultExpanded:!0,footerLeft:m,footerRight:A,children:y}),e[32]=s.friendlyName,e[33]=m,e[34]=A,e[35]=k,e[36]=y,e[37]=w):w=e[37],w}const lr=ws(ne(),re({approved:Ss().optional(),levelOverride:Le(["auto","readonly"]).optional()}));function Vr(t){const e=R.c(46),{approvals:s,isStreaming:o,onRespond:r}=t,i=B(),[a]=Se(),l=a.toolApprovalLevel??"readonly";let V;e[0]!==s?(V=Object.fromEntries(s.map(ur)),e[0]=s,e[1]=V):V=e[1];const d=V;let u;e[2]!==l||e[3]!==r||e[4]!==i?(u=(N,T)=>{const _=T;typeof _?.approved=="boolean"&&r(N.approvalId,_.approved,_.approved===!1?i(cs):void 0,_.levelOverride??l)},e[2]=l,e[3]=r,e[4]=i,e[5]=u):u=e[5];let c;e[6]!==s||e[7]!==d||e[8]!==o||e[9]!==u?(c={parts:s,partKey:dr,schema:lr,defaultValues:d,isStreaming:o,hasAnswer:cr,onSubmit:u},e[6]=s,e[7]=d,e[8]=o,e[9]=u,e[10]=c):c=e[10];const p=Vs(c);let f;e[11]!==s||e[12]!==p?(f=N=>{p.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:N}]))),p.submitOrAdvance()},e[11]=s,e[12]=p,e[13]=f):f=e[13];const m=f,h=p.currentPart,g=p.form;let v;e[14]!==p?(v=N=>{N.preventDefault(),p.submit()},e[14]=p,e[15]=v):v=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(We,{size:14}),e[16]=x):x=e[16];let b;e[17]!==s.length||e[18]!==i?(b=i("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=i,e[19]=b):b=e[19];const A=h?.friendlyName??"";let j;e[20]!==m?(j=n.jsx(ds,{onYolo:m}),e[20]=m,e[21]=j):j=e[21];let k;e[22]!==s.length||e[23]!==p.currentIndex||e[24]!==p.goNext||e[25]!==p.goPrev||e[26]!==j?(k=n.jsx(as,{currentIndex:p.currentIndex,total:s.length,onPrev:p.goPrev,onNext:p.goNext,extraLeft:j}),e[22]=s.length,e[23]=p.currentIndex,e[24]=p.goNext,e[25]=p.goPrev,e[26]=j,e[27]=k):k=e[27];let y;e[28]!==h||e[29]!==p.form.control||e[30]!==p.submitOrAdvance?(y=h?n.jsx(pr,{approvalId:h.approvalId,control:p.form.control,onChange:p.submitOrAdvance}):null,e[28]=h,e[29]=p.form.control,e[30]=p.submitOrAdvance,e[31]=y):y=e[31];let w;e[32]!==h?(w=h?n.jsx(us,{input:h.input}):null,e[32]=h,e[33]=w):w=e[33];let C;e[34]!==k||e[35]!==y||e[36]!==w||e[37]!==b||e[38]!==A?(C=n.jsx(pe,{icon:x,label:b,title:A,defaultExpanded:!0,footerLeft:k,footerRight:y,children:w}),e[34]=k,e[35]=y,e[36]=w,e[37]=b,e[38]=A,e[39]=C):C=e[39];let S;e[40]!==C||e[41]!==v?(S=n.jsx("form",{onSubmit:v,children:C}),e[40]=C,e[41]=v,e[42]=S):S=e[42];let I;return e[43]!==p.form||e[44]!==S?(I=n.jsx(nt,{...g,children:S}),e[43]=p.form,e[44]=S,e[45]=I):I=e[45],I}function cr(t){return typeof t?.approved=="boolean"}function dr(t){return t.approvalId}function ur(t){return[t.approvalId,{approved:void 0}]}function pr(t){const e=R.c(7),{approvalId:s,control:o,onChange:r}=t,i=B(),a=`${s}.approved`;let l;e[0]!==r||e[1]!==i?(l=d=>{const{field:u}=d,c=u.value===!0,p=u.value===!1;return n.jsxs(n.Fragment,{children:[n.jsx(Y,{type:"button",variant:p?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),r()},"aria-pressed":p,children:i("chat.approval.denyButton")}),n.jsx(Y,{type:"button",variant:c?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),r()},"aria-pressed":c,children:i("chat.approval.acceptButton")})]})},e[0]=r,e[1]=i,e[2]=l):l=e[2];let V;return e[3]!==o||e[4]!==a||e[5]!==l?(V=n.jsx(Cs,{control:o,name:a,render:l}),e[3]=o,e[4]=a,e[5]=l,e[6]=V):V=e[6],V}function fr(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(We,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.approval.preparingRequest"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function hr(t){const e=R.c(8),{approvals:s,isStreaming:o,onRespond:r}=t;if(o&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(fr,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;if(s.length===1){const a=s[0];if(!a)return null;let l;return e[1]!==r||e[2]!==a?(l=n.jsx(ar,{approval:a,onRespond:r}),e[1]=r,e[2]=a,e[3]=l):l=e[3],l}let i;return e[4]!==s||e[5]!==o||e[6]!==r?(i=n.jsx(Vr,{approvals:s,isStreaming:o,onRespond:r}),e[4]=s,e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function mr(t){const e=R.c(28),{plan:s,onApprove:o,onDismiss:r}=t,i=B();let a;e[0]!==o||e[1]!==s.plan?(a=()=>{o(s.plan)},e[0]=o,e[1]=s.plan,e[2]=a):a=e[2];const l=a;let V;e[3]!==i?(V=i("chat.proposePlan.keepIterating"),e[3]=i,e[4]=V):V=e[4];let d;e[5]!==r||e[6]!==V?(d=n.jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:V}),e[5]=r,e[6]=V,e[7]=d):d=e[7];let u;e[8]!==i?(u=i("chat.proposePlan.letsGo"),e[8]=i,e[9]=u):u=e[9];let c;e[10]!==l||e[11]!==u?(c=n.jsx(Y,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-special hover:bg-special/90 text-special-foreground active:scale-[0.97] transition-transform",onClick:l,children:u}),e[10]=l,e[11]=u,e[12]=c):c=e[12];let p;e[13]!==d||e[14]!==c?(p=n.jsxs(n.Fragment,{children:[d,c]}),e[13]=d,e[14]=c,e[15]=p):p=e[15];const f=p;let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Bt,{size:14}),e[16]=m):m=e[16];let h;e[17]!==i?(h=i("chat.proposePlan.planReady"),e[17]=i,e[18]=h):h=e[18];let g;e[19]!==i?(g=i("chat.proposePlan.implementationPlan"),e[19]=i,e[20]=g):g=e[20];let v;e[21]!==s.plan?(v=n.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:n.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:n.jsx($n,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=v):v=e[22];let x;return e[23]!==f||e[24]!==v||e[25]!==h||e[26]!==g?(x=n.jsx(pe,{icon:m,label:h,title:g,defaultExpanded:!0,footerRight:f,children:v}),e[23]=f,e[24]=v,e[25]=h,e[26]=g,e[27]=x):x=e[27],x}function gr(t){const e=R.c(6),{plans:s,onApprove:o,onDismiss:r}=t;let i;e[0]!==s?(i=os(s),e[0]=s,e[1]=i):i=e[1];const a=i;if(!a)return null;let l;return e[2]!==a||e[3]!==o||e[4]!==r?(l=n.jsx(mr,{plan:a,onApprove:o,onDismiss:r}),e[2]=a,e[3]=o,e[4]=r,e[5]=l):l=e[5],l}function ps(t){return t?"response"in t?t.response:t.option??t.draft:""}const It=re({response:ne().min(1,"Response is required")}),xr=re({option:ne().nullable(),draft:ne()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),vr=re({response:Le(["yes","no"])});function br(t){switch(t.type){case"text":return It;case"choice":return xr;case"confirm":return vr;default:return It}}function Ar(t){const e={};for(const s of t)e[s.toolCallId]=br(s.input);return re(e)}function yr(t){const e=R.c(7),{control:s,name:o,placeholder:r}=t,i=B();let a;e[0]!==r||e[1]!==i?(a=V=>{const{field:d}=V,u=d.value??"";return n.jsxs(Vt,{children:[n.jsx(ct,{children:n.jsx("div",{className:"px-2",children:n.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(Kt,{size:16,className:"text-muted-foreground"})}),n.jsx("input",{...d,value:u,type:"text",placeholder:r||i("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":i("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),n.jsx(dt,{})]})},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==s||e[4]!==o||e[5]!==a?(l=n.jsx(Yt,{control:s,name:o,render:a}),e[3]=s,e[4]=o,e[5]=a,e[6]=l):l=e[6],l}function fs(t,e){const s=R.c(4);let o,r;s[0]!==t||s[1]!==e?(o=()=>{const i=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const V=Number.parseInt(a.key,10);V>=1&&V<=t&&(a.preventDefault(),e(V-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=o,s[3]=r):(o=s[2],r=s[3]),P.useEffect(o,r)}function jr(t){const e=R.c(51),{control:s,name:o,options:r}=t,i=B(),a=`${o}.option`;let l;e[0]!==s||e[1]!==a?(l={control:s,name:a,defaultValue:null},e[0]=s,e[1]=a,e[2]=l):l=e[2];const{field:V}=mt(l),d=`${o}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:c}=mt(u),p=V.value,f=c.value??"";let m;if(e[6]!==V||e[7]!==r?(m=U=>{const M=r[U];M!=null&&V.onChange(M)},e[6]=V,e[7]=r,e[8]=m):m=e[8],fs(r.length,m),r.length===0)return null;const h=p===null;let g;e[9]!==i?(g=i("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=i,e[10]=g):g=e[10];let v;if(e[11]!==V||e[12]!==p||e[13]!==r||e[14]!==i){let U;e[16]!==V||e[17]!==p||e[18]!==i?(U=(M,L)=>{const z=p===M;return n.jsxs("button",{type:"button",onClick:()=>V.onChange(M),className:O("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",z&&"bg-accent/50",!z&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.selectOption",{option:M}),children:[n.jsx("span",{className:O("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",z?"bg-chart-1 text-white":"bg-muted text-foreground"),children:L+1}),n.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:M})]},`${L}-${M}`)},e[16]=V,e[17]=p,e[18]=i,e[19]=U):U=e[19],v=r.map(U),e[11]=V,e[12]=p,e[13]=r,e[14]=i,e[15]=v}else v=e[15];const x=h&&"bg-accent/50",b=!h&&"hover:bg-accent/30";let A;e[20]!==x||e[21]!==b?(A=O("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[20]=x,e[21]=b,e[22]=A):A=e[22];let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:n.jsx(Kt,{size:16,className:"text-muted-foreground"})}),e[23]=j):j=e[23];const k=h?f:"";let y;e[24]!==c||e[25]!==V||e[26]!==p?(y=U=>{c.onChange(U.target.value),p!==null&&V.onChange(null)},e[24]=c,e[25]=V,e[26]=p,e[27]=y):y=e[27];let w;e[28]!==V||e[29]!==p?(w=()=>{p!==null&&V.onChange(null)},e[28]=V,e[29]=p,e[30]=w):w=e[30];let C;e[31]!==i?(C=i("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=i,e[32]=C):C=e[32];let S;e[33]!==i?(S=i("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=i,e[34]=S):S=e[34];let I;e[35]!==k||e[36]!==y||e[37]!==w||e[38]!==C||e[39]!==S?(I=n.jsx("input",{type:"text",value:k,onChange:y,onFocus:w,placeholder:C,"aria-label":S,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=k,e[36]=y,e[37]=w,e[38]=C,e[39]=S,e[40]=I):I=e[40];let N;e[41]!==A||e[42]!==I?(N=n.jsxs("label",{className:A,children:[j,I]}),e[41]=A,e[42]=I,e[43]=N):N=e[43];let T;e[44]!==N||e[45]!==g||e[46]!==v?(T=n.jsx(ct,{children:n.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":g,children:[v,N]})}),e[44]=N,e[45]=g,e[46]=v,e[47]=T):T=e[47];let _;e[48]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(dt,{}),e[48]=_):_=e[48];let E;return e[49]!==T?(E=n.jsxs(Vt,{children:[T,_]}),e[49]=T,e[50]=E):E=e[50],E}function kr(t){const e=R.c(8),{control:s,name:o}=t,r=B();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,l=P.useRef(null);let V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=c=>{l.current?.onChange(a[c]??"")},e[1]=V):V=e[1],fs(a.length,V);let d;e[2]!==r?(d=c=>{const{field:p}=c;return l.current=p,n.jsxs(Vt,{children:[n.jsx(ct,{children:n.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":r("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:a.map(f=>{const m=p.value===f;return n.jsxs("button",{type:"button",onClick:()=>p.onChange(f),className:O("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.confirmValue",{value:r(`chat.userAskQuestion.confirm${f==="yes"?"Yes":"No"}`)}),children:[n.jsx("span",{className:O("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),n.jsx("span",{className:"text-sm text-foreground capitalize",children:r(`chat.userAskQuestion.confirm${f==="yes"?"Yes":"No"}`)})]},f)})})}),n.jsx(dt,{})]})},e[2]=r,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==o||e[6]!==d?(u=n.jsx(Yt,{control:s,name:o,render:d}),e[4]=s,e[5]=o,e[6]=d,e[7]=u):u=e[7],u}function Tt(t){const e=R.c(13),{input:s,control:o,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==o||e[1]!==s.default||e[2]!==i?(a=n.jsx(yr,{control:o,name:i,placeholder:s.default}),e[0]=o,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let l;return e[6]!==o||e[7]!==a||e[8]!==r?(l=n.jsx(jr,{control:o,name:r,options:a}),e[6]=o,e[7]=a,e[8]=r,e[9]=l):l=e[9],l}case"confirm":{const i=`${r}.response`;let a;return e[10]!==o||e[11]!==i?(a=n.jsx(kr,{control:o,name:i}),e[10]=o,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function wr(t){const e=R.c(91),{parts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=Ar(s.map(Ir)),e[0]=s,e[1]=i):i=e[1];const a=i;let l;e[2]!==s?(l=Object.fromEntries(s.map(Nr)),e[2]=s,e[3]=l):l=e[3];const V=l;let d;e[4]!==r?(d=($,F)=>{const Q=ps(F);Q&&r($,Q)},e[4]=r,e[5]=d):d=e[5];let u;e[6]!==V||e[7]!==o||e[8]!==s||e[9]!==a||e[10]!==d?(u={parts:s,partKey:Cr,schema:a,defaultValues:V,isStreaming:o,hasAnswer:Sr,onSubmit:d},e[6]=V,e[7]=o,e[8]=s,e[9]=a,e[10]=d,e[11]=u):u=e[11];const c=Vs(u),p=c.currentPart,f=B();let m;e[12]!==p||e[13]!==c||e[14]!==f?(m=()=>{const $=p;if(!$)return;const F=f("chat.userAskQuestion.skipMessage"),Q=$.toolCallId;$.input?.type==="choice"?(c.form.setValue(`${Q}.option`,null),c.form.setValue(`${Q}.draft`,F)):c.form.setValue(`${Q}.response`,F),c.advanceToNextUnanswered()},e[12]=p,e[13]=c,e[14]=f,e[15]=m):m=e[15];const h=m;let g;e[16]!==c.currentIndex||e[17]!==c.goNext||e[18]!==c.goPrev||e[19]!==s.length?(g=n.jsx(as,{currentIndex:c.currentIndex,total:s.length,onPrev:c.goPrev,onNext:c.goNext}),e[16]=c.currentIndex,e[17]=c.goNext,e[18]=c.goPrev,e[19]=s.length,e[20]=g):g=e[20];const v=g;let x;e[21]!==f?(x=f("chat.userAskQuestion.skip"),e[21]=f,e[22]=x):x=e[22];let b;e[23]!==h||e[24]!==x?(b=n.jsx(Y,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-7",children:x}),e[23]=h,e[24]=x,e[25]=b):b=e[25];let A;e[26]!==c.isAllAnswered||e[27]!==c.isCurrentAnswered||e[28]!==c.submitOrAdvance||e[29]!==o?(A=n.jsx(or,{isStreaming:o,isAllAnswered:c.isAllAnswered,isCurrentAnswered:c.isCurrentAnswered,onAdvanceOrSubmit:c.submitOrAdvance}),e[26]=c.isAllAnswered,e[27]=c.isCurrentAnswered,e[28]=c.submitOrAdvance,e[29]=o,e[30]=A):A=e[30];let j;e[31]!==b||e[32]!==A?(j=n.jsxs(n.Fragment,{children:[b,A]}),e[31]=b,e[32]=A,e[33]=j):j=e[33];const k=j;if(s.length===1){const $=s[0];if(!$?.input)return null;const F=c.form;let Q;e[34]!==c?(Q=ae=>{ae.preventDefault(),c.submit()},e[34]=c,e[35]=Q):Q=e[35];let Z;e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(st,{size:14}),e[36]=Z):Z=e[36];let se;e[37]!==f?(se=f("chat.userAskQuestion.questionPending"),e[37]=f,e[38]=se):se=e[38];let X;e[39]!==$.input?.prompt||e[40]!==f?(X=$.input?.prompt??f("chat.userAskQuestion.question"),e[39]=$.input?.prompt,e[40]=f,e[41]=X):X=e[41];const D=$.input;let K;e[42]!==c.form.control||e[43]!==$.toolCallId||e[44]!==D?(K=n.jsx(Tt,{input:D,control:c.form.control,toolCallId:$.toolCallId}),e[42]=c.form.control,e[43]=$.toolCallId,e[44]=D,e[45]=K):K=e[45];let H;e[46]!==k||e[47]!==se||e[48]!==X||e[49]!==K?(H=n.jsx(pe,{icon:Z,label:se,title:X,defaultExpanded:!0,footerRight:k,children:K}),e[46]=k,e[47]=se,e[48]=X,e[49]=K,e[50]=H):H=e[50];let ee;e[51]!==Q||e[52]!==H?(ee=n.jsx("form",{onSubmit:Q,autoComplete:"off",children:H}),e[51]=Q,e[52]=H,e[53]=ee):ee=e[53];let J;return e[54]!==c.form||e[55]!==ee?(J=n.jsx(nt,{...F,children:ee}),e[54]=c.form,e[55]=ee,e[56]=J):J=e[56],J}const y=c.form;let w;e[57]!==c?(w=$=>{$.preventDefault(),c.submit()},e[57]=c,e[58]=w):w=e[58];let C;e[59]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(st,{size:14}),e[59]=C):C=e[59];let S;e[60]!==f?(S=f("chat.userAskQuestion.questionPending"),e[60]=f,e[61]=S):S=e[61];const I=c.currentIndex+1;let N;e[62]!==s.length||e[63]!==f||e[64]!==I?(N=f("chat.userAskQuestion.questionCount",{current:I,total:s.length}),e[62]=s.length,e[63]=f,e[64]=I,e[65]=N):N=e[65];let T;e[66]!==p?.input?.prompt||e[67]!==f?(T=p?.input?.prompt??f("chat.userAskQuestion.question"),e[66]=p?.input?.prompt,e[67]=f,e[68]=T):T=e[68];const _=c.activeKey,E=c.setActiveKey;let U;if(e[69]!==c.form||e[70]!==s){let $;e[72]!==c.form?($=F=>n.jsx(Kn,{value:F.toolCallId,className:"mt-0",children:n.jsx(Tt,{input:F.input,control:c.form.control,toolCallId:F.toolCallId})},F.toolCallId),e[72]=c.form,e[73]=$):$=e[73],U=s.map($),e[69]=c.form,e[70]=s,e[71]=U}else U=e[71];let M;e[74]!==c.activeKey||e[75]!==c.setActiveKey||e[76]!==U?(M=n.jsx(qn,{value:_,onValueChange:E,children:U}),e[74]=c.activeKey,e[75]=c.setActiveKey,e[76]=U,e[77]=M):M=e[77];let L;e[78]!==v||e[79]!==k||e[80]!==S||e[81]!==N||e[82]!==T||e[83]!==M?(L=n.jsx(pe,{icon:C,label:S,count:N,title:T,defaultExpanded:!0,footerLeft:v,footerRight:k,children:M}),e[78]=v,e[79]=k,e[80]=S,e[81]=N,e[82]=T,e[83]=M,e[84]=L):L=e[84];let z;e[85]!==w||e[86]!==L?(z=n.jsx("form",{onSubmit:w,autoComplete:"off",children:L}),e[85]=w,e[86]=L,e[87]=z):z=e[87];let W;return e[88]!==c.form||e[89]!==z?(W=n.jsx(nt,{...y,children:z}),e[88]=c.form,e[89]=z,e[90]=W):W=e[90],W}function Sr(t){return!!ps(t)}function Cr(t){return t.toolCallId}function Nr(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Ir(t){return{toolCallId:t.toolCallId,input:t.input}}function Tr(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(st,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,n.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function hs(t){const e=R.c(7),{userAskParts:s,isStreaming:o,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(_r),e[0]=s,e[1]=i):i=e[1];const a=i;if(a.length===0){if(o){let V;return e[2]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(Tr,{}),e[2]=V):V=e[2],V}return null}let l;return e[3]!==o||e[4]!==r||e[5]!==a?(l=n.jsx(wr,{parts:a,isStreaming:o,onSubmit:r}),e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function _r(t){return t.state==="input-available"}function Mr(t){const e=R.c(33),{parts:s,isStreaming:o,onRespond:r}=t,i=B();let a;e[0]!==s?(a=s.at(-1),e[0]=s,e[1]=a):a=e[1];const l=a,V=l?.input;if(!l||!V?.title)return null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Bt,{size:14}),e[2]=d):d=e[2];let u;e[3]!==i?(u=i("chat.suggestTask.label"),e[3]=i,e[4]=u):u=e[4];const c=V.title;let p;e[5]!==r||e[6]!==l?(p=()=>r(l,!1),e[5]=r,e[6]=l,e[7]=p):p=e[7];let f;e[8]!==i?(f=i("chat.suggestTask.notNow"),e[8]=i,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==p||e[12]!==f?(m=n.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"h-7",disabled:o,onClick:p,children:f}),e[10]=o,e[11]=p,e[12]=f,e[13]=m):m=e[13];let h;e[14]!==r||e[15]!==l?(h=()=>r(l,!0),e[14]=r,e[15]=l,e[16]=h):h=e[16];let g;e[17]!==i?(g=i("chat.suggestTask.create"),e[17]=i,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==h||e[21]!==g?(v=n.jsx(Y,{type:"button",size:"sm",className:"h-7",disabled:o,onClick:h,children:g}),e[19]=o,e[20]=h,e[21]=g,e[22]=v):v=e[22];let x;e[23]!==v||e[24]!==m?(x=n.jsxs(n.Fragment,{children:[m,v]}),e[23]=v,e[24]=m,e[25]=x):x=e[25];let b;e[26]!==V.summary?(b=V.summary?n.jsx("p",{className:"px-4 pb-1 text-sm leading-snug text-muted-foreground whitespace-pre-wrap",children:V.summary}):null,e[26]=V.summary,e[27]=b):b=e[27];let A;return e[28]!==V.title||e[29]!==x||e[30]!==b||e[31]!==u?(A=n.jsx(pe,{icon:d,label:u,title:c,defaultExpanded:!0,footerRight:x,children:b}),e[28]=V.title,e[29]=x,e[30]=b,e[31]=u,e[32]=A):A=e[32],A}function Dr(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,o=t.length;if(o>0&&s===o)return{icon:"completed",activity:"All done",progress:`${o}/${o}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${o} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${o} done`}:s>0?{icon:"pending",activity:`${o-s} pending`,progress:`${s}/${o} done`}:{icon:"pending",activity:`${o} todos`,progress:"not started"}}function Rr(t){const e=R.c(13),{todos:s}=t;if(s.length===0)return null;let o;e[0]!==s?(o=Dr(s),e[0]=s,e[1]=o):o=e[1];const r=o;let i;e[2]!==r.icon?(i=n.jsx(Lr,{status:r.icon}),e[2]=r.icon,e[3]=i):i=e[3];const a=r.activity,l=r.progress;let V;e[4]!==s?(V=s.map(Er),e[4]=s,e[5]=V):V=e[5];let d;e[6]!==V?(d=n.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:V}),e[6]=V,e[7]=d):d=e[7];let u;return e[8]!==r.activity||e[9]!==r.progress||e[10]!==i||e[11]!==d?(u=n.jsx(pe,{icon:i,label:a,count:l,defaultExpanded:!1,children:d}),e[8]=r.activity,e[9]=r.progress,e[10]=i,e[11]=d,e[12]=u):u=e[12],u}function Er(t,e){return n.jsx(Pr,{todo:t},e)}function Pr(t){const e=R.c(14),{todo:s}=t,o=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=n.jsx(Ur,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const l=o&&"text-muted-foreground";let V;e[2]!==l?(V=O("relative text-sm leading-snug pt-px select-none",l),e[2]=l,e[3]=V):V=e[3];const d=o?"100%":"0%",u=o?"width 300ms ease 200ms":"width 150ms ease";let c;e[4]!==d||e[5]!==u?(c=n.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=c):c=e[6];let p;e[7]!==i||e[8]!==V||e[9]!==c?(p=n.jsxs("span",{className:V,children:[i,c]}),e[7]=i,e[8]=V,e[9]=c,e[10]=p):p=e[10];let f;return e[11]!==a||e[12]!==p?(f=n.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,p]}),e[11]=a,e[12]=p,e[13]=f):f=e[13],f}function Ur(t){const e=R.c(4),{status:s}=t,o=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("svg",{viewBox:"0 0 21 21",children:n.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==o||e[2]!==r?(a=n.jsx("div",{className:"todo-cb mt-0.5","data-checked":o,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=o,e[2]=r,e[3]=a):a=e[3],a}function Lr(t){const e=R.c(13),{status:s}=t,o=B();if(s==="completed"){let a;e[0]!==o?(a=o("chat.todoStatus.completed"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:n.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=l):l=e[2];let V;return e[3]!==a?(V=n.jsx("span",{"aria-label":a,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:l}),e[3]=a,e[4]=V):V=e[4],V}if(s==="in_progress"){let a;e[5]!==o?(a=o("chat.todoStatus.inProgress"),e[5]=o,e[6]=a):a=e[6];let l;return e[7]!==a?(l=n.jsx("span",{"aria-label":a,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=a,e[8]=l):l=e[8],l}let r;e[9]!==o?(r=o("chat.todoStatus.pending"),e[9]=o,e[10]=r):r=e[10];let i;return e[11]!==r?(i=n.jsx("span",{"aria-label":r,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=r,e[12]=i):i=e[12],i}const Fr={usd:[{dollars:10,labelKey:"credits.topUp.starter"},{dollars:20,labelKey:"credits.topUp.popular"},{dollars:100,labelKey:"credits.topUp.bestValue"}],brl:[{dollars:50,labelKey:"credits.topUp.starter"},{dollars:100,labelKey:"credits.topUp.popular"},{dollars:500,labelKey:"credits.topUp.bestValue"}]},zr={"credits.topUp.starter":"starter","credits.topUp.popular":"popular","credits.topUp.bestValue":"best_value"};function Or(t){const e=R.c(46),{source:s,onDone:o}=t,r=B(),i=Ns(),[a]=Se(),[l,V]=P.useState(a.language==="pt-BR"?"brl":"usd"),[d,u]=P.useState(""),[c,p]=P.useState(!1),f=l==="brl"?"R$":"$";let m;e[0]!==l||e[1]!==i?(m=async M=>{const{url:L}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:M,currency:l});return L},e[0]=l,e[1]=i,e[2]=m):m=e[2];let h;e[3]!==o?(h=M=>{M&&window.open(M,"_blank","noopener,noreferrer"),o?.()},e[3]=o,e[4]=h):h=e[4];let g;e[5]!==r?(g=M=>{Ee.error(r("credits.topUp.failed",{message:M.message}))},e[5]=r,e[6]=g):g=e[6];let v;e[7]!==m||e[8]!==h||e[9]!==g?(v={mutationFn:m,onSuccess:h,onError:g},e[7]=m,e[8]=h,e[9]=g,e[10]=v):v=e[10];const{mutate:x,isPending:b}=Is(v);let A;e[11]!==l||e[12]!==s||e[13]!==x?(A=(M,L)=>{te("credits_topup_clicked",{amount_cents:M,currency:l,tier_label:L,source:s}),x(M)},e[11]=l,e[12]=s,e[13]=x,e[14]=A):A=e[14];const j=A,k=parseFloat(d),y=!isNaN(k)&&k>=1;let w,C,S;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=M=>{M&&V(M)},C=n.jsx(yt,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),S=n.jsx(yt,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"}),e[15]=w,e[16]=C,e[17]=S):(w=e[15],C=e[16],S=e[17]);let I;e[18]!==l?(I=n.jsx("div",{className:"mb-4",children:n.jsxs(so,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:w,children:[C,S]})}),e[18]=l,e[19]=I):I=e[19];const N=Fr[l];let T;if(e[20]!==j||e[21]!==f||e[22]!==b||e[23]!==r||e[24]!==N){let M;e[26]!==j||e[27]!==f||e[28]!==b||e[29]!==r?(M=L=>{const{dollars:z,labelKey:W}=L;return n.jsxs("button",{type:"button",disabled:b,onClick:()=>j(z*100,zr[W]??"preset"),className:O("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[n.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,z]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:r(W)})]},z)},e[26]=j,e[27]=f,e[28]=b,e[29]=r,e[30]=M):M=e[30],T=N.map(M),e[20]=j,e[21]=f,e[22]=b,e[23]=r,e[24]=N,e[25]=T}else T=e[25];let _;e[31]!==T?(_=n.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:T}),e[31]=T,e[32]=_):_=e[32];let E;e[33]!==j||e[34]!==f||e[35]!==d||e[36]!==k||e[37]!==y||e[38]!==b||e[39]!==c||e[40]!==r?(E=c?n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),n.jsx(to,{type:"number",min:"1",step:"1",placeholder:r("credits.topUp.customPlaceholder"),value:d,onChange:M=>u(M.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),n.jsx(Y,{className:"h-10",disabled:!y||b,onClick:()=>j(Math.round(k*100),"custom"),children:r(b?"credits.topUp.opening":"credits.topUp.add")})]}):n.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>p(!0),children:r("credits.topUp.enterCustom")}),e[33]=j,e[34]=f,e[35]=d,e[36]=k,e[37]=y,e[38]=b,e[39]=c,e[40]=r,e[41]=E):E=e[41];let U;return e[42]!==_||e[43]!==E||e[44]!==I?(U=n.jsxs("div",{children:[I,_,E]}),e[42]=_,e[43]=E,e[44]=I,e[45]=U):U=e[45],U}const $r=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function Br(t){const e=R.c(47),{onDismiss:s}=t,{org:o}=Ce(),r=rt(),{decoKeyId:i}=eo(),a=B(),l=ze("credits");let V,d;if(e[0]!==o.id?(V=()=>{te("credits_exhausted_shown",{organization_id:o.id})},d=[o.id],e[0]=o.id,e[1]=V,e[2]=d):(V=e[1],d=e[2]),P.useEffect(V,d),!l)return null;let u;e[3]!==s?(u=N=>!N&&s?.(),e[3]=s,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=["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[5]=c):c=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:c.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[7]=f):f=e[7];let m;e[8]!==a?(m=a("chat.creditsExhaustedBanner.title"),e[8]=a,e[9]=m):m=e[9];let h;e[10]!==m?(h=n.jsx(Qn,{className:"text-xl font-semibold tracking-tight",children:m}),e[10]=m,e[11]=h):h=e[11];let g;e[12]!==a?(g=a("chat.creditsExhaustedBanner.description"),e[12]=a,e[13]=g):g=e[13];let v;e[14]!==g?(v=n.jsx(Wn,{className:"mt-1.5 text-sm leading-relaxed",children:g}),e[14]=g,e[15]=v):v=e[15];let x;e[16]!==v||e[17]!==h?(x=n.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[p,n.jsxs(Yn,{className:"relative gap-4",children:[f,n.jsxs("div",{children:[h,v]})]})]}),e[16]=v,e[17]=h,e[18]=x):x=e[18];let b;e[19]!==i||e[20]!==s||e[21]!==a?(b=i&&n.jsxs("div",{className:"px-8 pt-5 pb-6",children:[n.jsx("div",{className:"rounded-xl border border-border p-5",children:n.jsx(Or,{source:"exhausted_banner",onDone:s})}),n.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:$r.map(N=>n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-success/15 shrink-0",children:n.jsx(it,{size:12,className:"text-success"})}),n.jsx("span",{className:"text-sm text-foreground/80",children:a(N)})]},N))})]}),e[19]=i,e[20]=s,e[21]=a,e[22]=b):b=e[22];let A;e[23]!==a?(A=a("chat.creditsExhaustedBanner.dismiss"),e[23]=a,e[24]=A):A=e[24];let j;e[25]!==s||e[26]!==A?(j=n.jsx(Y,{variant:"ghost",size:"sm",onClick:s,children:A}),e[25]=s,e[26]=A,e[27]=j):j=e[27];let k;e[28]!==r||e[29]!==s||e[30]!==o.slug?(k=()=>{r({to:"/$org/settings/ai-providers",params:{org:o.slug}}),s?.()},e[28]=r,e[29]=s,e[30]=o.slug,e[31]=k):k=e[31];let y;e[32]!==a?(y=a("chat.creditsExhaustedBanner.manageProviders"),e[32]=a,e[33]=y):y=e[33];let w;e[34]!==k||e[35]!==y?(w=n.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:k,children:y}),e[34]=k,e[35]=y,e[36]=w):w=e[36];let C;e[37]!==j||e[38]!==w?(C=n.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[j,w]}),e[37]=j,e[38]=w,e[39]=C):C=e[39];let S;e[40]!==x||e[41]!==b||e[42]!==C?(S=n.jsxs(Gn,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Kr,children:[x,b,C]}),e[40]=x,e[41]=b,e[42]=C,e[43]=S):S=e[43];let I;return e[44]!==S||e[45]!==u?(I=n.jsx(Hn,{open:!0,onOpenChange:u,children:S}),e[44]=S,e[45]=u,e[46]=I):I=e[46],I}function Kr(t){return t.preventDefault()}const qr={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function Qr(t){const e=R.c(16),{kind:s,onDismiss:o,onSubscribe:r}=t,i=B(),{label:a,title:l}=qr[s];let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(at,{size:14}),e[0]=V):V=e[0];let d;e[1]!==a||e[2]!==i?(d=i(a),e[1]=a,e[2]=i,e[3]=d):d=e[3];let u;e[4]!==i||e[5]!==l?(u=i(l),e[4]=i,e[5]=l,e[6]=u):u=e[6];let c;e[7]!==s||e[8]!==r||e[9]!==i?(c=s==="trial_exhausted"?n.jsx(Y,{size:"sm",onClick:r,className:"h-7 text-xs",children:i("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=r,e[9]=i,e[10]=c):c=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u||e[14]!==c?(p=n.jsx(pe,{icon:V,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:o,footerRight:c}),e[11]=o,e[12]=d,e[13]=u,e[14]=c,e[15]=p):p=e[15],p}const Wr={ai_budget_exhausted:{label:"chat.planRefused.budgetLabel",title:"chat.planRefused.budgetTitle"},feature_not_in_plan:{label:"chat.planRefused.featureLabel",title:"chat.planRefused.featureTitle"}};function _t(t){const e=R.c(21),{kind:s,onDismiss:o}=t,r=B(),i=rt(),{org:a}=Ce(),{label:l,title:V}=Wr[s];let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(at,{size:14}),e[0]=d):d=e[0];let u;e[1]!==l||e[2]!==r?(u=r(l),e[1]=l,e[2]=r,e[3]=u):u=e[3];let c;e[4]!==r||e[5]!==V?(c=r(V),e[4]=r,e[5]=V,e[6]=c):c=e[6];let p;e[7]!==i||e[8]!==o||e[9]!==a.slug?(p=()=>{i({to:"/$org/settings/ai-providers",params:{org:a.slug}}),o()},e[7]=i,e[8]=o,e[9]=a.slug,e[10]=p):p=e[10];let f;e[11]!==r?(f=r("chat.planRefused.seePlans"),e[11]=r,e[12]=f):f=e[12];let m;e[13]!==p||e[14]!==f?(m=n.jsx(Y,{size:"sm",className:"h-7 text-xs",onClick:p,children:f}),e[13]=p,e[14]=f,e[15]=m):m=e[15];let h;return e[16]!==o||e[17]!==u||e[18]!==c||e[19]!==m?(h=n.jsx(pe,{icon:d,label:u,title:c,defaultExpanded:!0,variant:"warning",onClose:o,footerRight:m}),e[16]=o,e[17]=u,e[18]=c,e[19]=m,e[20]=h):h=e[20],h}function ms(t){const e=Yr(t);if(e!==null){const d=ms(e);return{summary:d.summary,rawDetails:d.rawDetails??t}}const s=t.trim(),o=s.startsWith("<")&&/<[a-z][\s\S]*>/i.test(s),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(s),i=/failed to fetch|networkerror|load failed|offline/i.test(s),a=/timeout|timed out|aborted|deadline/i.test(s),l=s.length>240,V=/sandbox failed to start(?::\s*(.+))?/is.exec(s);if(V){const d=V[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 r||o&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:o||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}function Yr(t){const e=t.trim();if(!e.startsWith("{"))return null;let s;try{s=JSON.parse(e)}catch{return null}if(!s||typeof s!="object")return null;const{error:o,message:r}=s,i=typeof o=="string"?o:r;return typeof i=="string"&&i.trim()&&!i.trim().startsWith("{")?i:null}const Gr={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Qe(t){const e=R.c(29),s=B(),{variant:o,onDismiss:r}=t,i=o==="error";let a;e[0]!==i||e[1]!==s?(a=s(i?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a,V=i?Rn:_s;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const x=Gr[t.finishReason];return x?s(x):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let c;e[8]!==i||e[9]!==u?(c=i?ms(u):{summary:u,rawDetails:null},e[8]=i,e[9]=u,e[10]=c):c=e[10];const{summary:p,rawDetails:f}=c;let m;e[11]!==V?(m=n.jsx(V,{size:14}),e[11]=V,e[12]=m):m=e[12];let h;e[13]!==i||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(h=i?n.jsx(Y,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):n.jsx(Y,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=i,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=h):h=e[17];let g;e[18]!==f||e[19]!==s?(g=f?n.jsxs("details",{className:"group mx-4",children:[n.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:[n.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:n.jsx("path",{d:"m4.5 3 3 3-3 3"})}),n.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),n.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),n.jsxs("div",{className:"relative mt-2",children:[n.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(f).then(()=>Ee.success(s("chat.highlight.copiedToClipboard"))).catch(()=>Ee.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-lg bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:n.jsx(En,{className:"size-3.5"})}),n.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:f})]})]}):null,e[18]=f,e[19]=s,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==r||e[23]!==p||e[24]!==m||e[25]!==h||e[26]!==g||e[27]!==o?(v=n.jsx(pe,{icon:m,label:l,title:p,defaultExpanded:!0,variant:o,onClose:r,footerRight:h,children:g}),e[21]=l,e[22]=r,e[23]=p,e[24]=m,e[25]=h,e[26]=g,e[27]=o,e[28]=v):v=e[28],v}function Oe(t){const e=R.c(77);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{inline:o,voiceMode:r}=s,i=o===void 0?!1:o,a=r===void 0?!1:r,l=B(),{error:V,clearError:d,finishReason:u,clearFinishReason:c,messages:p,isStreaming:f,submit:m,sendMessage:h}=Fe(),[g,v]=Se(),{virtualMcpId:x,createTaskWithMessage:b}=Ye(),{chatMode:A,simpleModeTier:j}=Ge(),k=ze("credits"),{mutate:y}=ro("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let w;e[2]!==y?(w=()=>y(),e[2]=y,e[3]=w):w=e[3];const C=w;let S;e[4]!==A||e[5]!==j||e[6]!==x||e[7]!==a?(S=oe=>({...a?{voiceMode:!0}:{},tier:j,mode:A,toolApprovalLevel:oe,agent:x?{id:x}:void 0}),e[4]=A,e[5]=j,e[6]=x,e[7]=a,e[8]=S):S=e[8];const I=S;let N;e[9]!==g.toolApprovalLevel?(N=g.toolApprovalLevel??Ts(),e[9]=g.toolApprovalLevel,e[10]=N):N=e[10];const T=N,_=p.at(-1),E=_?.role==="assistant"?_.parts:[],U=E.filter(ei),M=E.filter(Xr),L=rs(E),z=ns(E);let W;e[11]!==V||e[12]!==h||e[13]!==l?(W=()=>{if(V){const ue={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:l("chat.highlight.fixInChatMessage",{error:V.message})}]}]};h(ue)}},e[11]=V,e[12]=h,e[13]=l,e[14]=W):W=e[14];const $=W;let F;e[15]!==h||e[16]!==l?(F=()=>{const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:l("chat.highlight.pleaseContinue")}]}]};h(oe)},e[15]=h,e[16]=l,e[17]=F):F=e[17];const Q=F;let Z;e[18]!==I||e[19]!==T||e[20]!==m?(Z=(oe,ue)=>{m({kind:"toolOutput",toolCallId:oe.toolCallId,output:{response:ue}},I(T))},e[18]=I,e[19]=T,e[20]=m,e[21]=Z):Z=e[21];const se=Z;let X;e[22]!==I||e[23]!==T||e[24]!==m?(X=(oe,ue)=>{m({kind:"toolOutput",toolCallId:oe.toolCallId,output:{accepted:ue}},I(T))},e[22]=I,e[23]=T,e[24]=m,e[25]=X):X=e[25];const D=X;let K;e[26]!==b||e[27]!==g||e[28]!==v||e[29]!==l||e[30]!==x?(K=oe=>{v({...g,toolApprovalLevel:"auto"}),b({virtualMcpId:x,message:{parts:[{type:"text",text:l("chat.highlight.implementPlanMessage",{plan:oe})}]}})},e[26]=b,e[27]=g,e[28]=v,e[29]=l,e[30]=x,e[31]=K):K=e[31];const H=K,ee=Zr;let J;e[32]!==I||e[33]!==m?(J=(oe,ue,Be,be)=>{m({kind:"approval",approvalId:oe,approved:ue,...Be?{reason:Be}:{}},I(be))},e[32]=I,e[33]=m,e[34]=J):J=e[34];const ae=J,G=is();if(G.isCreditExhausted){let oe;return e[35]!==k||e[36]!==d||e[37]!==i?(oe=k?n.jsx(Br,{onDismiss:d}):n.jsx("div",{className:O(!i&&"absolute bottom-full left-0 right-0"),children:n.jsx(_t,{kind:"ai_budget_exhausted",onDismiss:d})}),e[35]=k,e[36]=d,e[37]=i,e[38]=oe):oe=e[38],oe}const{showError:ce,showWarning:ie,hasApprovals:fe}=G,le=U.map(Jr).join("|"),$e=os(L)?.toolCallId??"",ft=z.map(Hr).join("|"),Ne=!i&&"absolute bottom-full left-0 right-0";let Ve;e[39]!==Ne?(Ve=O(Ne),e[39]=Ne,e[40]=Ve):Ve=e[40];let he;e[41]!==G.todos?(he=n.jsx(Rr,{todos:G.todos}),e[41]=G.todos,e[42]=he):he=e[42];let ge;e[43]!==d||e[44]!==G.subscriptionErrorKind||e[45]!==C?(ge=G.subscriptionErrorKind&&n.jsx(Qr,{kind:G.subscriptionErrorKind,onDismiss:d,onSubscribe:C}),e[43]=d,e[44]=G.subscriptionErrorKind,e[45]=C,e[46]=ge):ge=e[46];let de;e[47]!==d||e[48]!==G.planRefusal?(de=G.planRefusal&&n.jsx(_t,{kind:G.planRefusal,onDismiss:d}),e[47]=d,e[48]=G.planRefusal,e[49]=de):de=e[49];let xe;e[50]!==d||e[51]!==V||e[52]!==$||e[53]!==ce?(xe=ce&&n.jsx(Qe,{variant:"error",error:V,onDismiss:d,onFixInChat:$}),e[50]=d,e[51]=V,e[52]=$,e[53]=ce,e[54]=xe):xe=e[54];let je;e[55]!==c||e[56]!==u||e[57]!==Q||e[58]!==ie?(je=ie&&n.jsx(Qe,{variant:"warning",finishReason:u,onDismiss:c,onContinue:Q}),e[55]=c,e[56]=u,e[57]=Q,e[58]=ie,e[59]=je):je=e[59];const Ie=fe&&n.jsx(hr,{approvals:z,isStreaming:f,onRespond:ae},ft),_e=G.hasPlans&&n.jsx(gr,{plans:L,isStreaming:f,onApprove:H,onDismiss:ee},$e),Me=G.hasTaskSuggestion&&n.jsx(Mr,{parts:M,isStreaming:f,onRespond:D},M.at(-1)?.toolCallId??"");let ve;e[60]!==G.isWaitingForUserInput||e[61]!==se||e[62]!==f||e[63]!==le||e[64]!==U?(ve=G.isWaitingForUserInput&&n.jsx(hs,{userAskParts:U,isStreaming:f,onSubmit:se},le),e[60]=G.isWaitingForUserInput,e[61]=se,e[62]=f,e[63]=le,e[64]=U,e[65]=ve):ve=e[65];let ke;return e[66]!==Ve||e[67]!==he||e[68]!==ge||e[69]!==de||e[70]!==xe||e[71]!==je||e[72]!==Ie||e[73]!==_e||e[74]!==Me||e[75]!==ve?(ke=n.jsxs("div",{className:Ve,children:[he,ge,de,xe,je,Ie,_e,Me,ve]}),e[66]=Ve,e[67]=he,e[68]=ge,e[69]=de,e[70]=xe,e[71]=je,e[72]=Ie,e[73]=_e,e[74]=Me,e[75]=ve,e[76]=ke):ke=e[76],ke}function Hr(t){return t.approvalId}function Jr(t){return t.toolCallId}function Zr(){document.querySelector("[data-chat-input]")?.focus()}function Xr(t){return t.type==="tool-suggest_task"&&t.state==="input-available"}function ei(t){return t.type==="tool-user_ask"}Oe.Error=function(e){return n.jsx(Qe,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Oe.Warning=function(e){return n.jsx(Qe,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Oe.UserAskQuestion=hs;function gs(t){const e=R.c(20),{taskId:s}=t,o=B(),r=xn(s),i=vn(r),a=bn(),{stop:l,removeLocalMessage:V}=Fe();if(i.length===0)return null;let d;e[0]!==o?(d=o("chat.queueTray.sendNow"),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==l?(u=()=>{l()},e[2]=l,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ot,{size:14}),e[4]=c):c=e[4];let p;e[5]!==d||e[6]!==u?(p=n.jsx(He,{asChild:!0,children:n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:c})}),e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==o?(f=o("chat.queueTray.sendNow"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=n.jsx(Je,{side:"top",children:n.jsx("p",{className:"text-xs",children:f})}),e[10]=f,e[11]=m):m=e[11];let h;e[12]!==p||e[13]!==m?(h=n.jsxs(Ze,{delayDuration:400,children:[p,m]}),e[12]=p,e[13]=m,e[14]=h):h=e[14];let g;return e[15]!==a||e[16]!==V||e[17]!==o||e[18]!==s?(g=(v,x)=>n.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[n.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:x+1}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:v.text}),n.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm",title:o("chat.queueTray.removeFromQueue"),"aria-label":o("chat.queueTray.removeFromQueue"),onClick:()=>{a.cancel(s,v.messageId).then(b=>{b&&(An(s,v.messageId),V(v.messageId))})},children:n.jsx(io,{className:"size-3.5"})})})]},v.messageId),e[15]=a,e[16]=V,e[17]=o,e[18]=s,e[19]=g):g=e[19],n.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[n.jsx("span",{children:o(i.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:i.length})}),h]}),i.map(g)]})}function ti(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const si={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function ni(t){const e=R.c(31),{tier:s,orgSlot:o,userSlot:r,autoSlot:i,onPick:a,onReset:l,onClose:V}=t,d=B(),u=es(),c=new Set(u.map(oi)),p=yn([r,o,i],c),f=p?.keyId??null,[m,h]=P.useState(f??u[0]?.id??null),g=u.some(L=>L.id===m)?m:f??u[0]?.id??null,v=g?u.find(L=>L.id===g):null,x="flex h-[70vh] max-h-[460px] w-full flex-col",b=si[s];let A;e[0]!==d||e[1]!==b?(A=d(b),e[0]=d,e[1]=b,e[2]=A):A=e[2];let j;e[3]!==A?(j=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:A}),e[3]=A,e[4]=j):j=e[4];let k;e[5]!==l||e[6]!==d||e[7]!==r?(k=r&&n.jsx("button",{type:"button",onClick:l,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-lg hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=l,e[6]=d,e[7]=r,e[8]=k):k=e[8];let y;e[9]!==j||e[10]!==k?(y=n.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[j,k]}),e[9]=j,e[10]=k,e[11]=y):y=e[11];const w="flex-1 min-h-0",C=P.Suspense;let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ao,{}),e[12]=S):S=e[12];const I=vo,N=!0,T=ti(f?p:null,v?.providerId??"deco");let _;e[13]!==g||e[14]!==a||e[15]!==h?(_=L=>{const z=L.keyId??g??"";h(z),a({keyId:z,modelId:L.modelId,title:L.title})},e[13]=g,e[14]=a,e[15]=h,e[16]=_):_=e[16];let E;e[17]!==I||e[18]!==g||e[19]!==V||e[20]!==h||e[21]!==T||e[22]!==_?(E=n.jsx(I,{compact:N,onClose:V,credentialId:g,onCredentialChange:h,selectedModel:T,onModelChange:_}),e[17]=I,e[18]=g,e[19]=V,e[20]=h,e[21]=T,e[22]=_,e[23]=E):E=e[23];let U;e[24]!==C||e[25]!==E||e[26]!==S?(U=n.jsx("div",{className:w,children:n.jsx(C,{fallback:S,children:E})}),e[24]=C,e[25]=E,e[26]=S,e[27]=U):U=e[27];let M;return e[28]!==U||e[29]!==y?(M=n.jsxs("div",{className:x,children:[y,U]}),e[28]=U,e[29]=y,e[30]=M):M=e[30],M}function oi(t){return t.id}const ri=["fast","smart","thinking"];function xs(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const Mt={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function ii(t){const e=R.c(28),{tier:s,pillIcon:o,groups:r}=t,i=B();let a;e[0]!==i?(a=xs(i),e[0]=i,e[1]=a):a=e[1];const l=a,[V,d]=P.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=w=>{w.onSelect(),d(!1)},e[2]=u):u=e[2];const c=u,p=l[s];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=O("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=f):f=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=O("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[4]=m):m=e[4];const h=l[s];let g;e[5]!==h?(g=n.jsx("span",{className:m,children:h}),e[5]=h,e[6]=g):g=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Gt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=v):v=e[7];let x;e[8]!==o||e[9]!==p||e[10]!==g?(x=n.jsx(He,{asChild:!0,children:n.jsx("span",{className:"inline-flex min-w-0 shrink",children:n.jsx(Ht,{asChild:!0,children:n.jsxs(Y,{type:"button",variant:"ghost",size:"default","aria-label":p,className:f,children:[o,g,v]})})})}),e[8]=o,e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==p?(b=n.jsx(Je,{children:p}),e[12]=p,e[13]=b):b=e[13];let A;e[14]!==x||e[15]!==b?(A=n.jsxs(Ze,{children:[x,b]}),e[14]=x,e[15]=b,e[16]=A):A=e[16];let j;if(e[17]!==r||e[18]!==i){let w;e[20]!==i?(w=C=>n.jsx("div",{className:"flex flex-col",children:C.rows.map(S=>n.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-lg hover:bg-muted",children:[n.jsxs("button",{type:"button",role:"menuitem","aria-label":S.title,onClick:()=>c(S),className:O("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",S.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[S.icon&&n.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:S.icon}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm",children:S.title}),S.subtitle&&n.jsx("div",{className:"text-xs text-muted-foreground",children:S.subtitle})]}),S.active&&n.jsx("span",{title:i("chat.tierTrigger.selected"),children:n.jsx(it,{size:14,className:"text-foreground mt-0.5"})})]}),S.modelOverride&&n.jsx(li,{label:S.title,render:S.modelOverride})]},S.key))},C.key),e[20]=i,e[21]=w):w=e[21],j=r.map(w),e[17]=r,e[18]=i,e[19]=j}else j=e[19];let k;e[22]!==j?(k=n.jsx(Jt,{align:"end",className:"p-1 w-64",onOpenAutoFocus:ai,children:n.jsx("div",{role:"menu",className:"flex flex-col",children:j})}),e[22]=j,e[23]=k):k=e[23];let y;return e[24]!==V||e[25]!==A||e[26]!==k?(y=n.jsxs(Zt,{open:V,onOpenChange:d,children:[A,k]}),e[24]=V,e[25]=A,e[26]=k,e[27]=y):y=e[27],y}function ai(t){return t.preventDefault()}function li(t){const e=R.c(38),{label:s,render:o}=t,r=B(),i=Xt(),[a,l]=P.useState(!1);let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=()=>l(!1),e[0]=V):V=e[0];const d=V;let u;e[1]!==s||e[2]!==r?(u=r("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=r,e[3]=u):u=e[3];const c=a&&"opacity-100";let p;e[4]!==c?(p=O("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-lg bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",c),e[4]=c,e[5]=p):p=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(un,{size:14}),e[6]=f):f=e[6];let m;e[7]!==u||e[8]!==p?(m=n.jsx("button",{type:"button","aria-label":u,className:p,children:f}),e[7]=u,e[8]=p,e[9]=m):m=e[9];const h=m;if(i){let A;e[10]!==h?(A=n.jsx(co,{asChild:!0,children:h}),e[10]=h,e[11]=A):A=e[11];let j;e[12]!==s||e[13]!==r?(j=r("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=r,e[14]=j):j=e[14];let k;e[15]!==j?(k=n.jsx(uo,{className:"sr-only",children:j}),e[15]=j,e[16]=k):k=e[16];let y;e[17]!==a||e[18]!==o?(y=a&&o(d),e[17]=a,e[18]=o,e[19]=y):y=e[19];let w;e[20]!==y||e[21]!==k?(w=n.jsxs(po,{className:"p-0 flex flex-col max-h-[95vh]",children:[k,y]}),e[20]=y,e[21]=k,e[22]=w):w=e[22];let C;return e[23]!==a||e[24]!==w||e[25]!==A?(C=n.jsxs(fo,{open:a,onOpenChange:l,children:[A,w]}),e[23]=a,e[24]=w,e[25]=A,e[26]=C):C=e[26],C}let g;e[27]!==h?(g=n.jsx(Ht,{asChild:!0,children:h}),e[27]=h,e[28]=g):g=e[28];let v;e[29]!==a||e[30]!==o?(v=a&&o(d),e[29]=a,e[30]=o,e[31]=v):v=e[31];let x;e[32]!==v?(x=n.jsx(Jt,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:v}),e[32]=v,e[33]=x):x=e[33];let b;return e[34]!==a||e[35]!==g||e[36]!==x?(b=n.jsxs(Zt,{open:a,onOpenChange:l,children:[g,x]}),e[34]=a,e[35]=g,e[36]=x,e[37]=b):b=e[37],b}function Dt(t){return t==="fast"?n.jsx(at,{size:16}):t==="thinking"?n.jsx(dn,{size:16}):n.jsx(ho,{size:16})}function Vi(t){const e=R.c(13),s=wn();let o;e[0]!==t||e[1]!==s.tiers?(o=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=o):o=e[2];const r=o;let i;e[3]!==r?(i=r("fast"),e[3]=r,e[4]=i):i=e[4];let a;e[5]!==r?(a=r("smart"),e[5]=r,e[6]=a):a=e[6];let l;e[7]!==r?(l=r("thinking"),e[7]=r,e[8]=l):l=e[8];let V;return e[9]!==i||e[10]!==a||e[11]!==l?(V={fast:i,smart:a,thinking:l},e[9]=i,e[10]=a,e[11]=l,e[12]=V):V=e[12],V}function ci(){const t=R.c(23),e=B(),{simpleModeTier:s,setSimpleModeTier:o}=Ge(),r=mo(),i=es(),a=xo(i),l=Vi(a),{data:V,error:d}=jn();let u;t[0]!==V?(u=V===void 0?{tiers:{}}:V,t[0]=V,t[1]=u):u=t[1];const c=u,p=kn(),f=ze("model_choice"),m=Jn(),h=Zn();if(!m||!f)return null;let g,v;if(t[2]!==a||t[3]!==h||t[4]!==r||t[5]!==o||t[6]!==e||t[7]!==s||t[8]!==l||t[9]!==p||t[10]!==c||t[11]!==d){const k=xs(e);g="decopilot",v=ri.map(y=>{const w=l[y],C=c.tiers[y];return{key:`decopilot-${y}`,icon:Dt(y),title:k[y],subtitle:h?w??e(Mt[y]):e(Mt[y]),active:s===y,onSelect:()=>o(y),modelOverride:h?S=>n.jsxs(n.Fragment,{children:[d&&n.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),n.jsx(ni,{tier:y,orgSlot:r.tiers[y],userSlot:C,autoSlot:a.chat[y],onClose:S,onPick:I=>p.mutate({tier:y,slot:I}),onReset:()=>p.mutate({tier:y,slot:null})},`${y}:${C?.keyId??"org"}:${C?.modelId??""}`)]}):void 0}}),t[2]=a,t[3]=h,t[4]=r,t[5]=o,t[6]=e,t[7]=s,t[8]=l,t[9]=p,t[10]=c,t[11]=d,t[12]=g,t[13]=v}else g=t[12],v=t[13];let x;t[14]!==g||t[15]!==v?(x=[{key:g,rows:v}],t[14]=g,t[15]=v,t[16]=x):x=t[16];const b=x;let A;t[17]!==s?(A=Dt(s),t[17]=s,t[18]=A):A=t[18];let j;return t[19]!==b||t[20]!==A||t[21]!==s?(j=n.jsx(ii,{tier:s,pillIcon:A,groups:b}),t[19]=b,t[20]=A,t[21]=s,t[22]=j):j=t[22],j}function vs(t){const e=R.c(3),[s]=Se();let o;return e[0]!==s.enableSounds||e[1]!==t?(o=()=>{s.enableSounds&&To(t.dataUri).catch(i=>{console.warn(`[sound] ${t.name} playback failed:`,i)})},e[0]=s.enableSounds,e[1]=t,e[2]=o):o=e[2],o}const di={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"},ui=Xs.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),pi=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function fi(){const t=R.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1.5",children:pi.map(hi)}),t[0]=e):e=t[0],e}function hi(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function mi({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:o,isStreaming:r,onUnsupportedFile:i}){const a=B(),[l,V]=P.useState(!1),d=vs(di),{org:u}=Ce(),{editor:c}=Ft(),p=P.useRef(null),f=ut(o),m=()=>{!f||r||(V(!1),p.current?.click())},h=async D=>{const K=D.target.files;if(!K||K.length===0||!c)return;const H=Array.from(K);try{let ee=c.state.selection.from;for(const J of H)await ts(c,o??null,J,ee,i,a),ee=c.state.selection.to}finally{p.current&&(p.current.value="")}},g=So({connectionId:s,orgId:u.id,orgSlug:u.slug}),v=Ms.virtualMcpPrompts(s,u.id),{data:x,isLoading:b}=Ds({queryKey:v,queryFn:()=>Co(g),staleTime:6e4,enabled:l&&!!g}),A=x?.prompts??[],[j,k]=P.useState(null),{chatMode:y,setChatMode:w}=Ge(),[C,S]=Se(),I=we.find(D=>D.value===C.toolApprovalLevel)??we[0],N=a(I.shortKey),T=D=>{const K=we.find(H=>H.value===D);if(K){if(K.value===C.toolApprovalLevel){V(!1);return}d(),te("chat_approval_level_changed",{from_level:C.toolApprovalLevel,to_level:K.value,source:"tools_popover"}),S({...C,toolApprovalLevel:K.value}),V(!1)}},_=y==="plan",E=()=>{d();const D=_?"default":"plan";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},U=()=>{e(),V(!1)},M=async(D,K)=>{if(!c||!g)return;const H=jt(D._meta),ee={from:c.state.selection.from,to:c.state.selection.to};try{const J=await No(g,D.name,K);Zs(c,ee,{id:D.name,name:wo(D.name,H),metadata:J.messages,char:"/",kind:"prompt",args:K})}catch{Ee.error(a("chat.toolsPopover.failedLoadPrompt"))}},L=async D=>{V(!1);const K=!!(D.arguments&&D.arguments.length>0);if(te("chat_prompt_inserted",{prompt_name:D.name,with_arguments:K}),K){k(D);return}await M(D)},z=async D=>{j&&(await M(j,D),k(null))},W=()=>{d();const D=y==="gen-image"?"default":"gen-image";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},$=()=>{d();const D=y==="web-search"?"default":"web-search";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},F=()=>{d();const D=y==="deep-research"?"default":"deep-research";te("chat_mode_changed",{from_mode:y,to_mode:D,source:"tools_popover"}),w(D),V(!1)},Q=y==="gen-image",Z=y==="web-search",se=y==="deep-research",X=n.jsx("input",{ref:p,type:"file",multiple:!0,accept:lo(o??null),className:"hidden",onChange:h,disabled:r});return n.jsxs(n.Fragment,{children:[X,n.jsxs(Rs,{open:l,onOpenChange:D=>{D&&!l&&te("chat_tools_popover_opened",{chat_mode:y}),V(D)},children:[n.jsx(Es,{asChild:!0,children:n.jsxs(Y,{type:"button",variant:"ghost",size:"default",disabled:t,title:a("chat.toolsPopover.tools"),"aria-label":a("chat.toolsPopover.tools"),className:O("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[n.jsx(pn,{size:14}),n.jsx("span",{className:O("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:a("chat.toolsPopover.tools")})]})}),n.jsxs(Ps,{align:"start",className:"w-56 p-1.5 space-y-1",children:[f?n.jsxs(Ae,{onClick:m,disabled:r,children:[n.jsx(kt,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]}):n.jsxs(Ze,{children:[n.jsx(He,{asChild:!0,children:n.jsxs(Ae,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:D=>D.preventDefault(),children:[n.jsx(kt,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]})}),n.jsx(Je,{side:"right",children:a("chat.toolsPopover.modelNoFileSupport")})]}),n.jsxs(Ae,{onClick:E,className:O(_&&"text-special"),children:[n.jsx($t,{size:16,className:O(_&&"text-special")}),n.jsx("span",{className:"flex-1 whitespace-nowrap",children:a("chat.toolsPopover.planMode")}),n.jsx("span",{className:O("text-xs text-muted-foreground",_&&"text-special font-medium"),children:ui})]}),n.jsxs(Ae,{onClick:W,className:O(Q&&"text-special"),children:[n.jsx(Wt,{size:16,className:O(Q&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.createImage")}),Q&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(Ae,{onClick:$,className:O(Z&&"text-special"),children:[n.jsx(qt,{size:16,className:O(Z&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.webSearch")}),Z&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(Ae,{onClick:F,className:O(se&&"text-special"),children:[n.jsx(Qt,{size:16,className:O(se&&"text-special")}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.deepResearch")}),se&&n.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),n.jsxs(gt,{children:[n.jsxs(xt,{className:"gap-2",children:[n.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.prompts")})]}),n.jsx(vt,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:b?n.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[n.jsx(Us,{className:"size-3.5"}),a("chat.toolsPopover.loadingPrompts")]}):A.length===0?n.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:a("chat.toolsPopover.noPromptsAvailable")}):A.map(D=>n.jsxs(Ae,{onClick:()=>L(D),className:"flex flex-col items-start gap-0.5",children:[n.jsx("span",{className:"font-medium text-sm capitalize",children:D.title||ko(D.name,jt(D._meta))}),D.description&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:D.description})]},D.name))})]}),n.jsxs(gt,{children:[n.jsxs(xt,{className:"gap-2",children:[n.jsx(We,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.approval")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),n.jsx(vt,{className:"w-48 p-1.5",children:n.jsx(Ls,{value:C.toolApprovalLevel,onValueChange:T,children:we.map(D=>n.jsx(Fs,{value:D.value,children:a(D.labelKey)},D.value))})})]}),n.jsxs(Ae,{onClick:U,children:[n.jsx(Io,{size:16}),n.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.connections")}),n.jsx(P.Suspense,{children:n.jsx(fi,{})})]})]})]}),n.jsx(Js,{prompt:j,setPrompt:k,onSubmit:z})]})}const gi=[{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 xi(){const t=R.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center -space-x-1",children:gi.map(vi)}),t[0]=e):e=t[0],e}function vi(t){return n.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function bi(t){const e=R.c(10),{onClick:s}=t,o=B();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=O("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=r):r=e[0];let i;e[1]!==o?(i=o("chat.connectionsBanner.description"),e[1]=o,e[2]=i):i=e[2];let a;e[3]!==i?(a=n.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:i}),e[3]=i,e[4]=a):a=e[4];let l,V;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(xi,{}),V=n.jsx(zs,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=l,e[6]=V):(l=e[5],V=e[6]);let d;return e[7]!==s||e[8]!==a?(d=n.jsxs("button",{type:"button",onClick:s,className:r,children:[a,l,V]}),e[7]=s,e[8]=a,e[9]=d):d=e[9],d}const Re=48;function Ai(){const t=R.c(9),[e,s]=P.useState("idle"),[o,r]=P.useState(""),[i,a]=P.useState(""),[l,V]=P.useState(ki),d=P.useRef(null),u=P.useRef(null),c=P.useRef(null),p=P.useRef(null),f=P.useRef(0),m=P.useRef(!1),h=P.useRef(""),g=P.useRef(""),v=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),u.current?.close().catch(ji),p.current?.getTracks().forEach(yi),c.current=null,u.current=null,p.current=null},t[0]=x):x=t[0];const b=x;let A;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const I=N=>{p.current=N;const T=new AudioContext;u.current=T;const _=T.createMediaStreamSource(N),E=T.createAnalyser();E.fftSize=128,E.smoothingTimeConstant=.8,_.connect(E),c.current=E;const U=new Uint8Array(E.frequencyBinCount),M=()=>{if(!c.current)return;c.current.getByteFrequencyData(U);const L=[];for(let z=0;z<Re;z++){const W=Math.floor(z/Re*U.length);L.push(Math.max(.04,(U[W]??0)/255))}V(L),f.current=requestAnimationFrame(M)};M()};A=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}r(""),a(""),g.current="",h.current="",m.current=!0,s("recording"),I(T);const _=new N;d.current=_,_.interimResults=!0,_.continuous=!0,_.lang=navigator.language||"en-US",_.onresult=E=>{if(d.current!==_)return;let U="",M="";for(let L=E.resultIndex;L<E.results.length;L++){const z=E.results[L],W=z?.[0]?.transcript??"";z?.isFinal?M=M+W:U=U+W}M&&(h.current=h.current+M,r(h.current)),g.current=U,a(U)},_.onerror=E=>{d.current===_&&E.error!=="no-speech"&&(m.current=!1,d.current=null,b(),s(E.error==="not-allowed"?"permission-denied":"idle"))},_.onend=()=>{if(d.current===_&&m.current)try{_.start()}catch{}};try{_.start()}catch{return m.current=!1,d.current=null,b(),s("idle"),"idle"}return"recording"},t[1]=A}else A=t[1];const j=A;let k;t[2]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{m.current=!1,d.current?.stop(),b(),s("idle"),V(Array(Re).fill(.05)),a("");const I=(h.current+(g.current?" "+g.current:"")).trim();return r(""),h.current="",g.current="",I},t[2]=k):k=t[2];const y=k;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{m.current=!1,d.current?.abort(),b(),s("idle"),r(""),a(""),V(Array(Re).fill(.05)),h.current="",g.current=""},t[3]=w):w=t[3];const C=w;let S;return t[4]!==i||t[5]!==e||t[6]!==o||t[7]!==l?(S={status:e,transcript:o,interimTranscript:i,waveformData:l,isSupported:v,startRecording:j,stopRecording:y,cancelRecording:C},t[4]=i,t[5]=e,t[6]=o,t[7]=l,t[8]=S):S=t[8],S}function yi(t){return t.stop()}function ji(){}function ki(){return Array(Re).fill(.05)}function wi(t){const e=R.c(4),{data:s}=t;let o;e[0]!==s?(o=s.map(Si),e[0]=s,e[1]=o):o=e[1];let r;return e[2]!==o?(r=n.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:o}),e[2]=o,e[3]=r):r=e[3],r}function Si(t,e){return n.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}const Pe=12e3,Rt=re({token:ne(),expiresAt:$s()});Bs("provider",[re({provider:ye("elevenlabs"),conversationToken:ne().min(1)}),re({provider:ye("openai"),transport:ye("webrtc")})]);const Ci=Os([Rt.extend({provider:ye("elevenlabs").default("elevenlabs"),conversationToken:ne().min(1)}),Rt.extend({provider:ye("openai"),transport:ye("webrtc")})]);re({token:ne().min(1).max(4096),text:ne().trim().min(1).max(Pe)});const bs=re({request:ne().trim().min(1).max(Pe)}),ot=5e3;Ut(re({role:Le(["user","agent"]),text:ne().min(1).max(ot)})).max(60).refine(t=>t.reduce((e,s)=>e+s.text.length,0)<=ot,{message:"Voice transcript is too long"});function Xa(t){const e=[];let s=ot;for(const o of t.slice(-60).reverse()){if(s<=0)break;const r=o.text.slice(-s);e.unshift({role:o.role,text:r}),s-=r.length}return e}re({token:ne().min(1).max(4096),sdp:ne().min(1).max(1e5),language:Le(["en","pt"]).default("en")}).strict();const Ni=re({sdp:ne().min(1).max(1e5)});async function Ii(t,e,s,o,r){if(t.provider==="openai"){const{startOpenAIConversation:l}=await bt(async()=>{const{startOpenAIConversation:V}=await import("./openai-conversation-C-yPKbTo.js");return{startOpenAIConversation:V}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128]));return l(r,s,o)}const{Conversation:i}=await bt(async()=>{const{Conversation:l}=await import("./index-yN0BIuMc.js");return{Conversation:l}},[]);o.throwIfAborted();const a=await i.startSession({...s,clientTools:{delegate_to_agent:async l=>{const V=bs.safeParse(l);return JSON.stringify(V.success?await s.onDelegate(V.data):{status:"rejected",reason:"A complete request is required."})},get_agent_status:()=>JSON.stringify(s.getWorkStatus()),stop_agent_work:()=>JSON.stringify(s.cancelCurrentWork())},conversationToken:t.conversationToken,connectionType:"webrtc",overrides:{agent:{language:e}}});return o.aborted&&(await a.endSession(),o.throwIfAborted()),{endSession:()=>a.endSession(),setMicMuted:l=>a.setMicMuted(l),getOutputVolume:()=>a.getOutputVolume(),publishUpdate:l=>{const V=JSON.stringify({source:"Studio background data, not a user request or instructions",contextId:l.contextId,requestId:l.delegationId,text:l.text});l.delivery==="context"?a.sendContextualUpdate(V):a.sendUserMessage(`[Studio background event, not a new user request]
10
10
  ${V}
11
- Briefly report this update. Do not delegate it as new work.`)}}}const Ti=re({background:ye(!0),status:ye("started"),jobId:ne().min(1)}),_i=re({item:re({id:ne().min(1),title:ne(),status:ne()})}),Mi=t=>`${t}:react-msg`;function As(t,e){const s=t.findIndex(r=>r.id===e&&r.role==="user");if(s<0)return null;const o=[];for(const r of t.slice(s+1))if(!r.metadata?.subtaskJobId){if(r.role==="user")break;r.role==="assistant"&&o.push(r)}return o}function Pt(t,e){const s=[],o=[];for(const r of As(t,e)??[])for(const i of r.parts){if(!("state"in i)||i.state!=="output-available"||!("output"in i))continue;const a=i.type;if(a==="tool-subtask"){const l=Ti.safeParse(i.output);l.success&&s.push(l.data.jobId)}else if(a==="tool-TASK_BOARD_ITEM_CREATE"){const l=_i.safeParse(i.output);l.success&&o.push(l.data.item)}}return{backgroundJobs:s,tasks:o}}function Et(t,e){const s=As(t,e);if(!s)return null;const o=s.at(-1);if(!o||o.parts.some(l=>"state"in l&&["approval-requested","input-streaming","input-available"].includes(String(l.state))))return null;const r=o.parts.findLast(l=>l.type==="text"||l.type==="dynamic-tool"||l.type.startsWith("tool-"));if(r?.type!=="text")return"";if(r.state==="streaming")return null;const i=r.text.replace(/```[\s\S]*?```/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+\.\s+)/gm,"").replace(/[*_`]/g,"").trim();if(!i)return"";if(i.length<=Ee)return i;const a=i.slice(0,Ee-1);return`${a.slice(0,a.lastIndexOf(" "))}…`}class Di{constructor(e,s){this.url=e,this.language=s}url;language;state={phase:"idle",muted:!1,working:!1,error:null};listeners=new Set;generation=0;conversation;startupAbort;userSpeaking=!1;token;timer;expires;bindings;jobs=new Map;announcements=[];lastActivity=0;approvalReported=!1;cleanup=Promise.resolve();dispatchQueue=Promise.resolve();lastContext="";lastWorkStatus="";utterance=0;seenUserEvents=new Set;tasks=new Map;boardUpdates=new Map;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;outputVolume=()=>this.conversation?.getOutputVolume()??0;patch(e){if(!Object.entries(e).every(([s,o])=>this.state[s]===o)){this.state={...this.state,...e};for(const s of this.listeners)s()}}updateBindings(e,s){if(this.bindings=e,!s&&this.state.phase!=="idle"){this.stop();return}this.conversation&&(this.updateContext(),this.collectResults())}requestStatus(e){return e.result!==void 0?"finished":e.accepted?e.background?"running_in_background":this.bindings?.messages.some(s=>s.id===e.messageId)?"running":"queued":"submitting"}status(){const e=this.bindings;return{status:e?.isWaitingForApprovals?"approval_required":e?.error||e?.status==="error"?"failed":e?.isStreaming||e?.isRunInProgress?"working":"idle",requests:[...this.jobs.values()].slice(-6).map(s=>({id:s.messageId,request:s.request.slice(0,200),status:this.requestStatus(s),result:s.result?.slice(0,500)})),tasks:[...this.tasks.values()].slice(-10).map(s=>({title:s.title.slice(0,120),status:s.status}))}}updateContext(){const e=this.bindings?.voiceContext??"";e!==this.lastContext&&(this.lastContext=e,this.conversation?.publishUpdate({text:`Current Studio view, supplied as context only:
12
- ${e.slice(0,12e3)}`,delivery:"context",contextId:"studio-view"}))}collectResults(){const e=this.bindings;if(!e||!this.conversation)return;const s=e.isStreaming||e.isRunInProgress;if(this.patch({working:s||[...this.jobs.values()].some(o=>o.accepted&&o.result===void 0)}),this.publishWorkStatus(),e.isWaitingForApprovals){this.approvalReported||(this.approvalReported=!0,this.report("The Studio agent needs the user's approval. The approval controls are visible in this chat. Ask the user to review them; do not approve on their behalf."));return}this.approvalReported=!1;for(const o of this.jobs.values()){if(!o.accepted||o.result!==void 0)continue;if(o.background){this.collectBackground(o,s);continue}const r=e.messages.findIndex(l=>l.id===o.messageId);if(r<0)continue;const i=r>=0&&e.messages.slice(r+1).some(l=>l.role==="user");if(s&&!i)continue;let a;if(!s&&!i&&(e.error||e.status==="error"))a="The agent's run failed. Ask the user to return to the chat for the error details; do not claim completion.";else if(!s&&!i&&e.finishReason&&["error","length","content-filter","aborted"].includes(e.finishReason))a=`The run ended with status ${e.finishReason}; successful completion is not established.`;else{const l=Et(e.messages,o.messageId);if(l===null)continue;a=l;const V=Pt(e.messages,o.messageId);if(this.track(V.tasks),V.backgroundJobs.length){o.background=V.backgroundJobs,this.collectBackground(o,s);continue}}this.finish(o,a||"The agent finished without a final text response. Do not infer that the requested change succeeded.")}this.patch({working:s||[...this.jobs.values()].some(o=>o.accepted&&o.result===void 0)}),this.publishWorkStatus()}collectBackground(e,s){const o=this.bindings?.messages??[],r=[];for(const i of e.background??[]){const a=Mi(i),l=o.findIndex(u=>u.id===a);if(l<0)return;const V=o.slice(l+1).some(u=>u.role==="user");if(s&&!V)return;const d=Et(o,a);if(d===null)return;this.track(Pt(o,a).tasks),r.push(d)}this.finish(e,r.filter(Boolean).join(`
11
+ Briefly report this update. Do not delegate it as new work.`)}}}const Ti=re({background:ye(!0),status:ye("started"),jobId:ne().min(1)}),_i=re({item:re({id:ne().min(1),title:ne(),status:ne()})}),Mi=t=>`${t}:react-msg`;function As(t,e){const s=t.findIndex(r=>r.id===e&&r.role==="user");if(s<0)return null;const o=[];for(const r of t.slice(s+1))if(!r.metadata?.subtaskJobId){if(r.role==="user")break;r.role==="assistant"&&o.push(r)}return o}function Et(t,e){const s=[],o=[];for(const r of As(t,e)??[])for(const i of r.parts){if(!("state"in i)||i.state!=="output-available"||!("output"in i))continue;const a=i.type;if(a==="tool-subtask"){const l=Ti.safeParse(i.output);l.success&&s.push(l.data.jobId)}else if(a==="tool-TASK_BOARD_ITEM_CREATE"){const l=_i.safeParse(i.output);l.success&&o.push(l.data.item)}}return{backgroundJobs:s,tasks:o}}function Pt(t,e){const s=As(t,e);if(!s)return null;const o=s.at(-1);if(!o||o.parts.some(l=>"state"in l&&["approval-requested","input-streaming","input-available"].includes(String(l.state))))return null;const r=o.parts.findLast(l=>l.type==="text"||l.type==="dynamic-tool"||l.type.startsWith("tool-"));if(r?.type!=="text")return"";if(r.state==="streaming")return null;const i=r.text.replace(/```[\s\S]*?```/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+\.\s+)/gm,"").replace(/[*_`]/g,"").trim();if(!i)return"";if(i.length<=Pe)return i;const a=i.slice(0,Pe-1);return`${a.slice(0,a.lastIndexOf(" "))}…`}class Di{constructor(e,s){this.url=e,this.language=s}url;language;state={phase:"idle",muted:!1,working:!1,error:null};listeners=new Set;generation=0;conversation;startupAbort;userSpeaking=!1;token;timer;expires;bindings;jobs=new Map;announcements=[];lastActivity=0;approvalReported=!1;cleanup=Promise.resolve();dispatchQueue=Promise.resolve();lastContext="";lastWorkStatus="";utterance=0;seenUserEvents=new Set;tasks=new Map;boardUpdates=new Map;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;outputVolume=()=>this.conversation?.getOutputVolume()??0;patch(e){if(!Object.entries(e).every(([s,o])=>this.state[s]===o)){this.state={...this.state,...e};for(const s of this.listeners)s()}}updateBindings(e,s){if(this.bindings=e,!s&&this.state.phase!=="idle"){this.stop();return}this.conversation&&(this.updateContext(),this.collectResults())}requestStatus(e){return e.result!==void 0?"finished":e.accepted?e.background?"running_in_background":this.bindings?.messages.some(s=>s.id===e.messageId)?"running":"queued":"submitting"}status(){const e=this.bindings;return{status:e?.isWaitingForApprovals?"approval_required":e?.error||e?.status==="error"?"failed":e?.isStreaming||e?.isRunInProgress?"working":"idle",requests:[...this.jobs.values()].slice(-6).map(s=>({id:s.messageId,request:s.request.slice(0,200),status:this.requestStatus(s),result:s.result?.slice(0,500)})),tasks:[...this.tasks.values()].slice(-10).map(s=>({title:s.title.slice(0,120),status:s.status}))}}updateContext(){const e=this.bindings?.voiceContext??"";e!==this.lastContext&&(this.lastContext=e,this.conversation?.publishUpdate({text:`Current Studio view, supplied as context only:
12
+ ${e.slice(0,12e3)}`,delivery:"context",contextId:"studio-view"}))}collectResults(){const e=this.bindings;if(!e||!this.conversation)return;const s=e.isStreaming||e.isRunInProgress;if(this.patch({working:s||[...this.jobs.values()].some(o=>o.accepted&&o.result===void 0)}),this.publishWorkStatus(),e.isWaitingForApprovals){this.approvalReported||(this.approvalReported=!0,this.report("The Studio agent needs the user's approval. The approval controls are visible in this chat. Ask the user to review them; do not approve on their behalf."));return}this.approvalReported=!1;for(const o of this.jobs.values()){if(!o.accepted||o.result!==void 0)continue;if(o.background){this.collectBackground(o,s);continue}const r=e.messages.findIndex(l=>l.id===o.messageId);if(r<0)continue;const i=r>=0&&e.messages.slice(r+1).some(l=>l.role==="user");if(s&&!i)continue;let a;if(!s&&!i&&(e.error||e.status==="error"))a="The agent's run failed. Ask the user to return to the chat for the error details; do not claim completion.";else if(!s&&!i&&e.finishReason&&["error","length","content-filter","aborted"].includes(e.finishReason))a=`The run ended with status ${e.finishReason}; successful completion is not established.`;else{const l=Pt(e.messages,o.messageId);if(l===null)continue;a=l;const V=Et(e.messages,o.messageId);if(this.track(V.tasks),V.backgroundJobs.length){o.background=V.backgroundJobs,this.collectBackground(o,s);continue}}this.finish(o,a||"The agent finished without a final text response. Do not infer that the requested change succeeded.")}this.patch({working:s||[...this.jobs.values()].some(o=>o.accepted&&o.result===void 0)}),this.publishWorkStatus()}collectBackground(e,s){const o=this.bindings?.messages??[],r=[];for(const i of e.background??[]){const a=Mi(i),l=o.findIndex(u=>u.id===a);if(l<0)return;const V=o.slice(l+1).some(u=>u.role==="user");if(s&&!V)return;const d=Pt(o,a);if(d===null)return;this.track(Et(o,a).tasks),r.push(d)}this.finish(e,r.filter(Boolean).join(`
13
13
  `)||"The background work finished without a final text response. Do not infer that the requested change succeeded.")}finish(e,s){e.result=s,this.report(JSON.stringify({requestId:e.messageId,request:e.delegationId?void 0:e.request,result:s}),e.delegationId)}track(e){for(const s of e)this.tasks.has(s.id)||this.tasks.set(s.id,this.boardUpdates.get(s.id)??s)}publishWorkStatus(){const e=JSON.stringify(this.status());e!==this.lastWorkStatus&&(this.lastWorkStatus=e,this.conversation?.publishUpdate({delivery:"context",contextId:"studio-work",text:e}))}taskUpdated=e=>{const s={id:e.id,title:e.title,status:e.status};this.boardUpdates.delete(e.id),this.boardUpdates.set(e.id,s);for(const r of this.boardUpdates.keys()){if(this.boardUpdates.size<=200)break;this.boardUpdates.delete(r)}const o=this.tasks.get(e.id);!o||!this.conversation||o.status===e.status||(this.tasks.set(e.id,s),this.report(JSON.stringify({task:e.title,status:e.status})),this.publishWorkStatus())};taskDeleted=e=>{const s=this.tasks.get(e);!s||!this.conversation||(this.tasks.delete(e),this.report(JSON.stringify({task:s.title,status:"deleted"})),this.publishWorkStatus())};report(e,s){const o={text:e,delegationId:s,delivery:"context"};this.conversation?.publishUpdate(o),this.announcements.push({...o,delivery:"announce"})}flushAnnouncements(){if(!(!this.conversation||!this.announcements.length||this.userSpeaking||this.state.phase!=="listening"||Date.now()-this.lastActivity<1800)){this.lastActivity=Date.now();for(const e of this.announcements.splice(0))this.conversation.publishUpdate(e)}}delegate=async e=>{if(this.utterance===0&&!e.delegationId)return{status:"rejected",reason:"Wait for a spoken user request before delegating work."};const s=bs.safeParse(e);if(!s.success)return{status:"rejected",reason:"A complete, non-empty request is required."};if(this.jobs.size>=40)return{status:"rejected",reason:"This voice session has reached its request limit. Continue in the text chat."};const o=s.data.request,r=[...this.jobs.values()].find(V=>e.delegationId?V.delegationId===e.delegationId:V.utterance===this.utterance||V.request===o&&V.result===void 0);if(r)return{status:r.result!==void 0?"finished":r.accepted?"accepted":"submitting",requestId:r.messageId,result:r.result?.slice(0,2e3),note:"This utterance already has a work request; do not submit it again."};const i=this.generation,a={messageId:crypto.randomUUID(),utterance:this.utterance,request:o,accepted:!1,delegationId:e.delegationId};this.jobs.set(a.messageId,a);const l=this.dispatchQueue.then(async()=>i!==this.generation||!this.conversation?!1:this.bindings?.sendVoiceMessage?.(a.messageId,o,e.transcript)??!1);this.dispatchQueue=l.catch(()=>{});try{const V=await l;return i!==this.generation?{status:"disconnected"}:V?(a.accepted=!0,this.collectResults(),{status:"accepted",requestId:a.messageId,note:"Work is running or queued in Studio. Keep conversing. A background event will supply its actual result."}):(this.jobs.delete(a.messageId),{status:"rejected",reason:"Studio did not accept the request. No work has been confirmed."})}catch{return this.jobs.delete(a.messageId),{status:"rejected",reason:"Studio could not accept the request. Do not claim it started."}}};async start(){if(this.state.phase!=="idle"&&this.state.phase!=="error")return;this.stop();const e=++this.generation,s=new AbortController;this.startupAbort=s;const o=()=>e===this.generation;this.patch({phase:"connecting",error:null,muted:!1});try{if(await this.cleanup,!o())return;const r=fetch(this.url,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"conversation",language:this.language}),signal:AbortSignal.timeout(5e4)}).then(async d=>{if(!d.ok)throw new Error("Voice unavailable");return Ci.parse(await d.json())});this.cleanup=r.then(async d=>{o()||await this.revoke(d.token)}).catch(()=>{});const i=await r;if(!o())return;this.token=i.token;const a=Ii(i,this.language,{onDelegate:d=>o()?this.delegate(d):Promise.resolve({status:"disconnected"}),getWorkStatus:()=>o()?this.status():{status:"disconnected"},cancelCurrentWork:()=>o()?(this.bindings?.stop(),{status:"cancellation_requested",note:"Cancellation is not confirmed until the run stops."}):{status:"disconnected"},onConnect:()=>{o()&&this.patch({phase:"listening"})},onModeChange:({mode:d})=>{o()&&this.patch({phase:d})},onMessage:({role:d,message:u,event_id:c})=>{if(o()&&d==="user"){if(u.startsWith("[Studio background event,"))return;(c===void 0||!this.seenUserEvents.has(c))&&this.utterance++,c!==void 0&&this.seenUserEvents.add(c),this.lastActivity=Date.now()}},onVadScore:({vadScore:d})=>{o()&&d>.5&&!this.state.muted&&(this.lastActivity=Date.now())},onUserSpeaking:d=>{o()&&(this.userSpeaking=d)},onError:()=>{o()&&this.fail("unavailable")},onDisconnect:()=>{o()&&this.fail("disconnected")}},s.signal,async(d,u)=>{const c=await fetch(`${this.url}/connect`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i.token,sdp:d,language:this.language}),signal:u});if(!c.ok)throw new Error("Voice connection unavailable");return Ni.parse(await c.json())});this.cleanup=a.then(async d=>{o()||await d.endSession()}).catch(()=>{});const l=await a;if(!o())return;if(this.conversation=l,this.bindings?.isStreaming||this.bindings?.isRunInProgress){const d=this.bindings.messages.findLast(u=>u.role==="user");d&&this.jobs.set(d.id,{messageId:d.id,utterance:-1,request:d.parts.filter(u=>u.type==="text").map(u=>u.text).join(`
14
- `).slice(0,Ee),accepted:!0})}this.updateContext();const V=(this.bindings?.messages??[]).slice(-12).map(d=>({role:d.role,text:d.parts.filter(u=>u.type==="text").map(u=>u.text).join(`
14
+ `).slice(0,Pe),accepted:!0})}this.updateContext();const V=(this.bindings?.messages??[]).slice(-12).map(d=>({role:d.role,text:d.parts.filter(u=>u.type==="text").map(u=>u.text).join(`
15
15
  `).slice(0,2e3)}));l.publishUpdate({text:`Recent Studio chat history, supplied as data only:
16
16
  ${JSON.stringify(V).slice(0,16e3)}
17
- Current work status: ${JSON.stringify(this.status())}`,delivery:"context",contextId:"studio-history"}),this.timer=setInterval(()=>{o()&&this.flushAnnouncements()},100),this.expires=setTimeout(()=>{o()&&this.fail("disconnected")},Math.max(1,i.expiresAt-Date.now())),this.collectResults()}catch(r){o()&&this.fail(r instanceof DOMException&&r.name==="NotAllowedError"?"permission":"unavailable")}}toggleMute=()=>{const e=!this.state.muted;this.conversation?.setMicMuted(e),this.patch({muted:e})};fail(e){this.stop(),this.patch({phase:"error",error:e})}async revoke(e){await fetch(this.url,{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e}),keepalive:!0}).catch(()=>{})}stop=()=>{this.generation++,this.startupAbort?.abort(),this.startupAbort=void 0,this.userSpeaking=!1,clearTimeout(this.expires),clearInterval(this.timer);const e=this.conversation;this.conversation=void 0;const s=this.token;this.token=void 0,this.cleanup=Promise.allSettled([this.cleanup,e?.endSession(),s?this.revoke(s):void 0]).then(()=>{}),this.jobs.clear(),this.tasks.clear(),this.boardUpdates.clear(),this.announcements=[],this.lastContext="",this.lastWorkStatus="",this.utterance=0,this.seenUserEvents.clear(),this.approvalReported=!1,this.dispatchQueue=Promise.resolve(),this.patch({phase:"idle",error:null,working:!1})}}let De;const pt=E.createContext(null);function el(t){const e=R.c(7),{children:s,layout:o}=t,{org:r}=Ce(),{taskId:i}=Ye(),a=Xt();let l;e[0]!==a||e[1]!==o?(l=a?Eo({visibility:o,threadVisibilityExplicit:o.threadVisibilityExplicit})==="chat":o.threadOpen||!o.contentOpen,e[0]=a,e[1]=o,e[2]=l):l=e[2];const V=l,d=`${r.id}:${i??"new"}`;let u;return e[3]!==s||e[4]!==d||e[5]!==V?(u=n.jsx(Ri,{visible:V,children:s},d),e[3]=s,e[4]=d,e[5]=V,e[6]=u):u=e[6],u}function Ri(t){const e=R.c(35),{children:s,visible:o}=t,{org:r}=Ce(),{taskId:i,createTask:a,activeTask:l}=Ye(),d=go("voice_mode")&&!0&&!l?.metadata?.read_only;let u;e[0]!==r.slug||e[1]!==i?(u=()=>new Di(`/api/${encodeURIComponent(r.slug)}/threads/${encodeURIComponent(i??"")}/voice/sessions`,Ks()==="pt-BR"?"pt":"en"),e[0]=r.slug,e[1]=i,e[2]=u):u=e[2];const[c]=E.useState(u);let p,f;e[3]!==d||e[4]!==c||e[5]!==o?(p=()=>{(!d||!o)&&c.stop()},f=[c,d,o],e[3]=d,e[4]=c,e[5]=o,e[6]=p,e[7]=f):(p=e[6],f=e[7]),E.useLayoutEffect(p,f);let m;e[8]!==c?(m=()=>c.getSnapshot().phase!=="idle",e[8]=c,e[9]=m):m=e[9];const h=E.useSyncExternalStore(c.subscribe,m);let g;e[10]!==h||e[11]!==r.slug||e[12]!==c.taskDeleted||e[13]!==c.taskUpdated?(g={orgSlug:r.slug,enabled:h,onUpdate:c.taskUpdated,onDelete:c.taskDeleted},e[10]=h,e[11]=r.slug,e[12]=c.taskDeleted,e[13]=c.taskUpdated,e[14]=g):g=e[14],Po(g);let v;e[15]!==d||e[16]!==r.id||e[17]!==c||e[18]!==i?(v=()=>w=>{if(d&&i&&De?.orgId===r.id&&De.threadId===i){const S=De.expires>Date.now();De=void 0,S&&c.start()}const C=()=>c.stop();return window.addEventListener("pagehide",C),()=>{window.removeEventListener("pagehide",C),c.stop()}},e[15]=d,e[16]=r.id,e[17]=c,e[18]=i,e[19]=v):v=e[19];const[x]=E.useState(v);let b;e[20]!==a||e[21]!==d||e[22]!==r.id||e[23]!==c||e[24]!==i?(b=()=>{if(d){if(!i){const w=a();De={orgId:r.id,threadId:w,expires:Date.now()+3e4};return}c.start()}},e[20]=a,e[21]=d,e[22]=r.id,e[23]=c,e[24]=i,e[25]=b):b=e[25];const A=b;let j;e[26]!==d||e[27]!==c||e[28]!==A?(j={session:c,enabled:d,start:A},e[26]=d,e[27]=c,e[28]=A,e[29]=j):j=e[29];let k;e[30]!==s?(k=n.jsx("div",{className:"contents",ref:x,children:s}),e[30]=s,e[31]=k):k=e[31];let y;return e[32]!==j||e[33]!==k?(y=n.jsx(pt,{value:j,children:k}),e[32]=j,e[33]=k,e[34]=y):y=e[34],y}function tl(t){const e=R.c(4),{children:s}=t,o=E.useContext(pt),r=Fe();let i,a;return e[0]!==o||e[1]!==r?(i=()=>{o?.session.updateBindings(r,o.enabled)},a=[o,r],e[0]=o,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),E.useLayoutEffect(i,a),s}function ys(){const t=R.c(4),e=E.useContext(pt),s=E.useSyncExternalStore(e?.session.subscribe??Pi,e?.session.getSnapshot??Ei),o=s?.phase!==void 0&&s.phase!=="idle";let r;return t[0]!==e||t[1]!==s||t[2]!==o?(r={active:o,context:e,snapshot:s},t[0]=e,t[1]=s,t[2]=o,t[3]=r):r=t[3],r}const Pi=()=>()=>{},Ei=()=>null;function Ui(){const t=R.c(9),e=B(),{context:s}=ys();if(!s?.enabled||!navigator.mediaDevices?.getUserMedia)return null;const o=s.start;let r;t[0]!==e?(r=e("chat.voice.start"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e?(i=e("chat.voice.start"),t[2]=e,t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Lo,{size:18}),t[4]=a):a=t[4];let l;return t[5]!==s.start||t[6]!==r||t[7]!==i?(l=n.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:o,"aria-label":r,title:i,children:a}),t[5]=s.start,t[6]=r,t[7]=i,t[8]=l):l=t[8],l}function Li({session:t,phase:e,muted:s}){const[o]=E.useState(()=>r=>{if(!r||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let i=0,a=requestAnimationFrame(function l(){const V=Math.min(1,t.outputVolume());i+=(V-i)*(V>i?.55:.12),r.style.setProperty("--voice-level",i.toFixed(3)),a=requestAnimationFrame(l)});return()=>cancelAnimationFrame(a)});return n.jsx("div",{ref:o,className:"studio-voice-orb","data-phase":e,"data-muted":s,"aria-hidden":"true"})}function sl(){const t=R.c(65),e=B(),{taskId:s}=Ye(),o=Fe(),{context:r,snapshot:i,active:a}=ys();if(!a||!r||!i)return null;const{session:l}=r;let V;t[0]!==i.error||t[1]!==i.muted||t[2]!==i.phase||t[3]!==e?(V=i.error?e(`chat.voice.${i.error}`):i.muted?e("chat.voice.muted"):e(`chat.voice.${i.phase}`),t[0]=i.error,t[1]=i.muted,t[2]=i.phase,t[3]=e,t[4]=V):V=t[4];const d=V;let u;t[5]!==e?(u=e("chat.voice.title"),t[5]=e,t[6]=u):u=t[6];let c;t[7]!==l||t[8]!==i.muted||t[9]!==i.phase?(c=n.jsx(Li,{session:l,phase:i.phase,muted:i.muted}),t[7]=l,t[8]=i.muted,t[9]=i.phase,t[10]=c):c=t[10];let p;t[11]!==d?(p=n.jsx("p",{role:"status",className:"max-w-sm text-center text-sm text-muted-foreground",children:d}),t[11]=d,t[12]=p):p=t[12];let f;t[13]!==i.working||t[14]!==e?(f=i.working&&n.jsx("p",{className:"text-center text-xs text-muted-foreground",children:e("chat.voice.backgroundWork")}),t[13]=i.working,t[14]=e,t[15]=f):f=t[15];let m;t[16]!==r.start||t[17]!==i.phase||t[18]!==e?(m=i.phase==="error"&&n.jsx(Y,{variant:"outline",onClick:r.start,children:e("chat.voice.retry")}),t[16]=r.start,t[17]=i.phase,t[18]=e,t[19]=m):m=t[19];let h;t[20]!==c||t[21]!==p||t[22]!==f||t[23]!==m?(h=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-7 overflow-y-auto px-6 py-8",children:[c,p,f,m]}),t[20]=c,t[21]=p,t[22]=f,t[23]=m,t[24]=h):h=t[24];let g;t[25]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Oe,{inline:!0,voiceMode:!0}),t[25]=g):g=t[25];let v;t[26]!==s?(v=s&&n.jsx(gs,{taskId:s}),t[26]=s,t[27]=v):v=t[27];let x;t[28]!==v?(x=n.jsxs("div",{className:"max-h-[55%] shrink-0 overflow-y-auto px-3",children:[g,v]}),t[28]=v,t[29]=x):x=t[29];const b=i.phase==="connecting"||i.phase==="error",A=i.muted?"chat.voice.unmute":"chat.voice.mute";let j;t[30]!==e||t[31]!==A?(j=e(A),t[30]=e,t[31]=A,t[32]=j):j=t[32];const k=i.muted?"chat.voice.unmute":"chat.voice.mute";let y;t[33]!==e||t[34]!==k?(y=e(k),t[33]=e,t[34]=k,t[35]=y):y=t[35];let w;t[36]!==i.muted?(w=i.muted?n.jsx(zo,{size:18}):n.jsx(Oo,{size:18}),t[36]=i.muted,t[37]=w):w=t[37];let C;t[38]!==l.toggleMute||t[39]!==i.muted||t[40]!==b||t[41]!==j||t[42]!==y||t[43]!==w?(C=n.jsx(Y,{variant:"outline",size:"icon",disabled:b,"aria-label":j,title:y,"aria-pressed":i.muted,onClick:l.toggleMute,children:w}),t[38]=l.toggleMute,t[39]=i.muted,t[40]=b,t[41]=j,t[42]=y,t[43]=w,t[44]=C):C=t[44];const S=l.stop;let I;t[45]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(Fo,{size:16}),t[45]=I):I=t[45];let N;t[46]!==e?(N=e("chat.voice.backToChat"),t[46]=e,t[47]=N):N=t[47];let T;t[48]!==l.stop||t[49]!==N?(T=n.jsxs(Y,{variant:"outline",onClick:S,children:[I,N]}),t[48]=l.stop,t[49]=N,t[50]=T):T=t[50];let _;t[51]!==o.isRunInProgress||t[52]!==o.isStreaming||t[53]!==o.stop||t[54]!==e?(_=(o.isStreaming||o.isRunInProgress)&&n.jsx(Y,{variant:"outline",size:"icon","aria-label":e("chat.voice.stopWork"),title:e("chat.voice.stopWork"),onClick:o.stop,children:n.jsx($o,{size:16})}),t[51]=o.isRunInProgress,t[52]=o.isStreaming,t[53]=o.stop,t[54]=e,t[55]=_):_=t[55];let P;t[56]!==C||t[57]!==T||t[58]!==_?(P=n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-3 px-4 py-6",children:[C,T,_]}),t[56]=C,t[57]=T,t[58]=_,t[59]=P):P=t[59];let U;return t[60]!==u||t[61]!==P||t[62]!==h||t[63]!==x?(U=n.jsxs("section",{"aria-label":u,className:"absolute inset-0 flex min-h-0 flex-col bg-background",children:[h,x,P]}),t[60]=u,t[61]=P,t[62]=h,t[63]=x,t[64]=U):U=t[64],U}function Fi(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Ke(t){const e=R.c(7),{message:s,icon:o}=t;let r;e[0]!==o?(r=o??n.jsx(Lt,{size:14,className:"shrink-0"}),e[0]=o,e[1]=r):r=e[1];const i=s??"";let a;e[2]!==i?(a=n.jsx("span",{className:"text-sm",children:i}),e[2]=i,e[3]=a):a=e[3];let l;return e[4]!==r||e[5]!==a?(l=n.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function zi(t,e,s){const o=R.c(7),{editor:r}=Ft(),i=B(),[a,l]=E.useState(!1),V=E.useRef(0);let d,u;return o[0]!==s||o[1]!==r||o[2]!==e||o[3]!==t||o[4]!==i?(d=()=>{const c=h=>{h.dataTransfer?.types.includes("Files")&&(h.preventDefault(),V.current=V.current+1,l(!0))},p=h=>{h.preventDefault(),V.current=Math.max(0,V.current-1),V.current===0&&l(!1)},f=Oi,m=h=>{if(h.preventDefault(),V.current=0,l(!1),s||!r||!t||!ut(t))return;const g=h.dataTransfer?.files;if(!g||g.length===0)return;const v=Array.from(g);(async()=>{let x=r.state.selection.from;for(const b of v)await ts(r,t,b,x,e,i),x=r.state.selection.to})()};return window.addEventListener("dragenter",c),window.addEventListener("dragleave",p),window.addEventListener("dragover",f),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",c),window.removeEventListener("dragleave",p),window.removeEventListener("dragover",f),window.removeEventListener("drop",m)}},u=[r,t,e,i,s],o[0]=s,o[1]=r,o[2]=e,o[3]=t,o[4]=i,o[5]=d,o[6]=u):(d=o[5],u=o[6]),E.useEffect(d,u),a}function Oi(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function $i(t){const e=R.c(14),{selectedModel:s}=t,o=B();let r,i,a;if(e[0]!==s||e[1]!==o){const{parts:d}=Vo(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(gn,{size:24}),e[5]=a):a=e[5],r="text-sm font-medium";let u;e[6]!==o?(u=c=>o(c),e[6]=o,e[7]=u):u=e[7],i=o("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=o,e[2]=r,e[3]=i,e[4]=a}else r=e[2],i=e[3],a=e[4];let l;e[8]!==r||e[9]!==i?(l=n.jsx("span",{className:r,children:i}),e[8]=r,e[9]=i,e[10]=l):l=e[10];let V;return e[11]!==a||e[12]!==l?(V=n.jsxs(n.Fragment,{children:[a,l]}),e[11]=a,e[12]=l,e[13]=V):V=e[13],V}function Bi(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Lt,{size:24}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs(n.Fragment,{children:[s,n.jsx("span",{className:"text-sm font-medium",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function Ki(t){const e=R.c(11),{selectedModel:s,onUnsupportedFile:o,disabled:r}=t,i=zi(s,o,r);let a;e[0]!==s?(a=ut(s),e[0]=s,e[1]=a):a=e[1];const l=a,V=i?"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]!==V||e[3]!==d?(u=O("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",V,d),e[2]=V,e[3]=d,e[4]=u):u=e[4];let c;e[5]!==s||e[6]!==l?(c=l?n.jsx($i,{selectedModel:s}):n.jsx(Bi,{}),e[5]=s,e[6]=l,e[7]=c):c=e[7];let p;return e[8]!==u||e[9]!==c?(p=n.jsx("div",{className:u,children:c}),e[8]=u,e[9]=c,e[10]=p):p=e[10],p}function qe(t){const e=R.c(14),{onClick:s,label:o,icon:r,colorClass:i,maxWidthClass:a}=t;let l;e[0]!==i?(l=O("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",i),e[0]=i,e[1]=l):l=e[1];let V;e[2]!==a?(V=O("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",a),e[2]=a,e[3]=V):V=e[3];let d;e[4]!==o||e[5]!==V?(d=n.jsx("span",{className:V,children:o}),e[4]=o,e[5]=V,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(lt,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let c;return e[8]!==r||e[9]!==o||e[10]!==s||e[11]!==l||e[12]!==d?(c=n.jsxs("button",{type:"button",onClick:s,title:o,"aria-label":o,className:l,children:[r,d,u]}),e[8]=r,e[9]=o,e[10]=s,e[11]=l,e[12]=d,e[13]=c):c=e[13],c}function qi(){const t=R.c(6),e=rt(),{org:s,locator:o}=Ce(),{create:r}=Dn();let i;return t[0]!==r||t[1]!==o||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(i=async a=>{const{tiptapDoc:l,virtualMcp:V,taskIntake:d}=a,u=d===void 0?!1:d,c=crypto.randomUUID(),p=V?.id??tt(s.id).id;sn(sessionStorage,o,c,{tiptapDoc:u&&l?sr(l):l});try{await r({id:c,virtual_mcp_id:p})}catch{}const f={autosend:nn};u&&(f.sidepanel=!0,f.mainpanel=!1),Ys(e,Gs({org:s.slug,agentId:p,superAgentId:tt(s.id).id}),{search:()=>({...f,thread:c}),replace:!1})},t[0]=r,t[1]=o,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=i):i=t[5],i}function nl({onOpenContextPanel:t,showConnectionsBanner:e=!1,homeTaskComposer:s=!1}){const o=B(),r=Sn(),i=Cn(),a=r?.messages??[],l=r?.isStreaming??!1,V=r?.isRunInProgress??!1,d=r?.stop??(()=>{}),u=i?.taskId??"",c=u||Vn,p=qi(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:h,tiptapDocRef:g,imageModel:v,webSearchModel:x,deepResearchModel:b,chatMode:A,setChatMode:j}=Ge(),{data:k}=qs.useSession(),y=k?.user?.id,{org:w,locator:C}=Ce(),[S,I]=Qs(Ws.homeTaskMode(C),!0),N=s&&S,T=tt(w.id).id,_=tn(m?.id),P=cn(_?.id).runtime==="cms",U=vs(_o),[M,L]=E.useState(!1),{unsupportedFile:z,onUnsupportedFile:W,clearUnsupportedFile:$}=bo(),F=Ai(),Q=E.useRef(void 0),Z=async()=>{Q.current=ie;const q=await F.startRecording();te("chat_voice_started",{thread_id:u,outcome:q==="recording"?"started":q==="unsupported"?"unsupported":q==="permission-denied"?"permission_denied":"unknown"})},se=()=>{te("chat_voice_confirmed",{thread_id:u});const q=F.stopRecording();Ve.current?.syncVoiceText(Q.current,q),Ve.current?.focus()},X=()=>{te("chat_voice_cancelled",{thread_id:u}),F.cancelRecording(),Ve.current?.restoreContent(Q.current)};E.useEffect(()=>{if(F.status!=="recording")return;const q=(F.transcript+(F.interimTranscript?" "+F.interimTranscript:"")).trim();Ve.current?.syncVoiceText(Q.current,q)},[F.transcript,F.interimTranscript,F.status]);const D=i?.activeTask??null,K=D?.created_by,H=!!(y&&K&&K!==y),{data:ee}=Do({enabled:H}),J=(ee?.data?.members??[]).find(q=>q.userId===K),ae=J?.user?.name??J?.user?.email?.split("@")[0]??null,G=Uo(),ce=Nn({isDesktopApp:G,harnessId:D?.harness_id}),[ie,fe]=E.useState(()=>At(sessionStorage,C,c)??void 0),le=q=>{fe(q),g.current=q,ln(sessionStorage,C,c,q,{onQuotaExceeded:({docSizeBytes:me})=>{te("chat_draft_quota_exceeded",{thread_id:u||null,doc_size_bytes:me}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},$e=E.useRef(u);if($e.current!==u){$e.current=u;const q=At(sessionStorage,C,c)??void 0;fe(q),g.current=q}const Ne=[...a].reverse().find(q=>q.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Ve=E.useRef(null),he=E.useRef(!1),ge=A==="plan",de=q=>{U(),te("chat_mode_changed",{from_mode:q,to_mode:"default",source:"pill_dismiss"}),j("default")};E.useEffect(()=>{const q=me=>{en(me)&&me.code==="KeyL"&&(me.preventDefault(),me.shiftKey&&j(A==="plan"?"default":"plan"),Ve.current?.focus())};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[A,j]);const xe=In(a),Ie=[...a].reverse().find(q=>q.role==="assistant"&&q.metadata?.usage)?.metadata?.usage?.contextTokens??0,_e=ze("chat"),Me=Xn(),[ve,ke]=E.useState(!1),[oe,ue]=E.useState(!1),Be=!h&&!rn(ie),be=Fi({hasDraft:Be,isStreaming:l,isRunInProgress:V}),Xe=be==="send",Te=be==="stop",ht=q=>{if(q?.preventDefault(),!_e){ke(!0);return}if(Me){ue(!0);return}if(be==="send"&&ie){if(te("chat_message_sent",{thread_id:u||null,mode:A,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:q?"button_or_enter":"programmatic"}),r){if(r.isSendInFlight()){Pe.info(o("chat.input.stillSendingPreviousMessage"));return}r.sendMessage(ie)}else N&&te("task_report_submitted",{source:"home"}),p({tiptapDoc:ie,virtualMcp:N?null:m,taskIntake:N});an(sessionStorage,C,c),le(void 0)}else be==="stop"&&(te("chat_message_stopped",{thread_id:u}),d())};if(H)return n.jsx(Ke,{message:ae?o("chat.input.readOnlyOthersChatNamed",{name:ae}):o("chat.input.readOnlyOthersChat"),icon:ae?n.jsx(Mo,{shape:"circle",size:"2xs",url:J?.user?.image??void 0,fallback:ae.slice(0,2).toUpperCase()}):void 0});if(D?.metadata?.read_only)return n.jsx(Ke,{message:o("chat.input.readOnlyThread")});if(ce)return n.jsx(Ke,{message:o("chat.input.codingAgentRequiresDesktop")});if(P){if(!i)return n.jsx(Ke,{message:o("chat.input.fastPreviewUnavailable")});const q=()=>{const me=i.createTask({runtime:"sandbox"});te("coding_session_started",{thread_id:me})};return n.jsxs("button",{type:"button",onClick:q,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(fn,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:o("chat.fastPreview.startCodingSession")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.fastPreview.chatNeedsSession")})]}),n.jsx(zt,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return n.jsxs(n.Fragment,{children:[ve&&n.jsx(wt,{feature:"chat",onDismiss:()=>ke(!1)}),oe&&n.jsx(wt,{feature:"chat",copy:{title:o("chat.input.allowanceExhaustedTitle")},onDismiss:()=>ue(!1)}),n.jsx("div",{className:"flex flex-col w-full justify-end text-left",children:n.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&n.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),r&&i&&n.jsx(Oe,{}),r&&i&&u?n.jsx(gs,{taskId:u}):null,n.jsx(Ao,{tiptapDoc:ie,setTiptapDoc:le,disabled:F.status==="recording",enterToSubmit:!0,placeholder:o(N?"chat.input.taskPlaceholder":"chat.input.placeholder"),onSubmit:ht,suggestionOpenRef:he,children:n.jsxs("form",{onSubmit:ht,className:O("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:[n.jsx(Ki,{selectedModel:f,onUnsupportedFile:W,disabled:F.status==="recording"}),n.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:n.jsx(yo,{ref:Ve,disabled:F.status==="recording",virtualMcpId:m?.id??T,showFileUploader:!0,selectedModel:f,onUnsupportedFile:W,suggestionOpenRef:he})}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:F.status==="recording"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1"}),n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n.jsx(wi,{data:F.waveformData.slice(0,28)}),n.jsx("button",{type:"button",onClick:X,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":o("chat.input.cancelRecording"),children:n.jsx(lt,{size:16})}),n.jsx("button",{type:"button",onClick:se,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":o("chat.input.useTranscription"),children:n.jsx(it,{size:16})})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s&&n.jsx(Y,{type:"button",size:"sm",variant:S?"secondary":"ghost","aria-pressed":S,onClick:()=>I(!S),className:"h-8",children:o("chat.input.taskMode")}),n.jsx(mi,{disabled:!1,onOpenConnections:()=>{te("connections_dialog_opened",{source:"tools_popover",mode:"add"}),L(!0)},virtualMcpId:m?.id??T,selectedModel:f,isStreaming:l,onUnsupportedFile:W}),ge&&n.jsx(qe,{onClick:()=>de("plan"),label:o("chat.input.planMode"),icon:n.jsx($t,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),A==="gen-image"&&v&&n.jsx(qe,{onClick:()=>de("gen-image"),label:o("chat.input.createImage"),icon:n.jsx(Wt,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),A==="web-search"&&x&&n.jsx(qe,{onClick:()=>de("web-search"),label:o("chat.input.webSearch"),icon:n.jsx(qt,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),A==="deep-research"&&b&&n.jsx(qe,{onClick:()=>de("deep-research"),label:o("chat.input.deepResearch"),icon:n.jsx(Qt,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),Ne&&Ie>0&&n.jsx(Bn,{usage:xe,totalTokens:Ie,contextWindow:Ne,onOpenContextPanel:t})]}),n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx(ci,{}),n.jsx(Ui,{}),F.isSupported&&n.jsx(Y,{type:"button",onClick:Z,disabled:!1,variant:"ghost",size:"icon",className:O("size-8 transition-colors",F.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:F.status==="permission-denied"?o("chat.input.microphoneAccessDenied"):o("chat.input.voiceInput"),"aria-label":F.status==="permission-denied"?o("chat.input.microphoneAccessDenied"):o("chat.input.voiceInput"),children:n.jsx(mn,{size:18})}),n.jsx(Y,{type:Te?"button":"submit",onClick:q=>{Te&&(q.preventDefault(),q.stopPropagation(),d())},variant:Xe||Te?"default":"ghost",size:N?"sm":"icon",disabled:!Xe&&!Te,className:O(N?"h-8 px-3 transition-all":"size-8 transition-all",!Xe&&!Te&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:o(be==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":N?"chat.input.startTask":"chat.input.sendMessageEnter"),"aria-label":o(be==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":N?"chat.input.startTask":"chat.input.sendMessage"),children:Te?n.jsx(hn,{size:20}):n.jsxs(n.Fragment,{children:[N&&o("chat.input.startTask"),n.jsx(Ot,{size:20})]})})]})]})})]})},u),s&&N&&n.jsx("p",{className:"px-3 pt-3 text-left text-xs text-muted-foreground",children:o("chat.input.taskHint")}),e&&n.jsx(bi,{onClick:()=>{te("connections_banner_clicked",{source:"home_chat_input"}),te("connections_dialog_opened",{source:"home_banner",mode:"add"}),L(!0)}})]})}),n.jsx(Ro,{mode:"browse",open:M,onOpenChange:L,defaultTab:"all"}),n.jsx(jo,{info:z,onClose:$})]})}export{tl as C,Ja as H,Or as T,sl as V,el as a,nl as b,Br as c,Za as d,Ee as e,Xa as f,ys as u};
17
+ Current work status: ${JSON.stringify(this.status())}`,delivery:"context",contextId:"studio-history"}),this.timer=setInterval(()=>{o()&&this.flushAnnouncements()},100),this.expires=setTimeout(()=>{o()&&this.fail("disconnected")},Math.max(1,i.expiresAt-Date.now())),this.collectResults()}catch(r){o()&&this.fail(r instanceof DOMException&&r.name==="NotAllowedError"?"permission":"unavailable")}}toggleMute=()=>{const e=!this.state.muted;this.conversation?.setMicMuted(e),this.patch({muted:e})};fail(e){this.stop(),this.patch({phase:"error",error:e})}async revoke(e){await fetch(this.url,{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e}),keepalive:!0}).catch(()=>{})}stop=()=>{this.generation++,this.startupAbort?.abort(),this.startupAbort=void 0,this.userSpeaking=!1,clearTimeout(this.expires),clearInterval(this.timer);const e=this.conversation;this.conversation=void 0;const s=this.token;this.token=void 0,this.cleanup=Promise.allSettled([this.cleanup,e?.endSession(),s?this.revoke(s):void 0]).then(()=>{}),this.jobs.clear(),this.tasks.clear(),this.boardUpdates.clear(),this.announcements=[],this.lastContext="",this.lastWorkStatus="",this.utterance=0,this.seenUserEvents.clear(),this.approvalReported=!1,this.dispatchQueue=Promise.resolve(),this.patch({phase:"idle",error:null,working:!1})}}let De;const pt=P.createContext(null);function el(t){const e=R.c(7),{children:s,layout:o}=t,{org:r}=Ce(),{taskId:i}=Ye(),a=Xt();let l;e[0]!==a||e[1]!==o?(l=a?Po({visibility:o,threadVisibilityExplicit:o.threadVisibilityExplicit})==="chat":o.threadOpen||!o.contentOpen,e[0]=a,e[1]=o,e[2]=l):l=e[2];const V=l,d=`${r.id}:${i??"new"}`;let u;return e[3]!==s||e[4]!==d||e[5]!==V?(u=n.jsx(Ri,{visible:V,children:s},d),e[3]=s,e[4]=d,e[5]=V,e[6]=u):u=e[6],u}function Ri(t){const e=R.c(35),{children:s,visible:o}=t,{org:r}=Ce(),{taskId:i,createTask:a,activeTask:l}=Ye(),d=go("voice_mode")&&!0&&!l?.metadata?.read_only;let u;e[0]!==r.slug||e[1]!==i?(u=()=>new Di(`/api/${encodeURIComponent(r.slug)}/threads/${encodeURIComponent(i??"")}/voice/sessions`,Ks()==="pt-BR"?"pt":"en"),e[0]=r.slug,e[1]=i,e[2]=u):u=e[2];const[c]=P.useState(u);let p,f;e[3]!==d||e[4]!==c||e[5]!==o?(p=()=>{(!d||!o)&&c.stop()},f=[c,d,o],e[3]=d,e[4]=c,e[5]=o,e[6]=p,e[7]=f):(p=e[6],f=e[7]),P.useLayoutEffect(p,f);let m;e[8]!==c?(m=()=>c.getSnapshot().phase!=="idle",e[8]=c,e[9]=m):m=e[9];const h=P.useSyncExternalStore(c.subscribe,m);let g;e[10]!==h||e[11]!==r.slug||e[12]!==c.taskDeleted||e[13]!==c.taskUpdated?(g={orgSlug:r.slug,enabled:h,onUpdate:c.taskUpdated,onDelete:c.taskDeleted},e[10]=h,e[11]=r.slug,e[12]=c.taskDeleted,e[13]=c.taskUpdated,e[14]=g):g=e[14],Eo(g);let v;e[15]!==d||e[16]!==r.id||e[17]!==c||e[18]!==i?(v=()=>w=>{if(d&&i&&De?.orgId===r.id&&De.threadId===i){const S=De.expires>Date.now();De=void 0,S&&c.start()}const C=()=>c.stop();return window.addEventListener("pagehide",C),()=>{window.removeEventListener("pagehide",C),c.stop()}},e[15]=d,e[16]=r.id,e[17]=c,e[18]=i,e[19]=v):v=e[19];const[x]=P.useState(v);let b;e[20]!==a||e[21]!==d||e[22]!==r.id||e[23]!==c||e[24]!==i?(b=()=>{if(d){if(!i){const w=a();De={orgId:r.id,threadId:w,expires:Date.now()+3e4};return}c.start()}},e[20]=a,e[21]=d,e[22]=r.id,e[23]=c,e[24]=i,e[25]=b):b=e[25];const A=b;let j;e[26]!==d||e[27]!==c||e[28]!==A?(j={session:c,enabled:d,start:A},e[26]=d,e[27]=c,e[28]=A,e[29]=j):j=e[29];let k;e[30]!==s?(k=n.jsx("div",{className:"contents",ref:x,children:s}),e[30]=s,e[31]=k):k=e[31];let y;return e[32]!==j||e[33]!==k?(y=n.jsx(pt,{value:j,children:k}),e[32]=j,e[33]=k,e[34]=y):y=e[34],y}function tl(t){const e=R.c(4),{children:s}=t,o=P.useContext(pt),r=Fe();let i,a;return e[0]!==o||e[1]!==r?(i=()=>{o?.session.updateBindings(r,o.enabled)},a=[o,r],e[0]=o,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),P.useLayoutEffect(i,a),s}function ys(){const t=R.c(4),e=P.useContext(pt),s=P.useSyncExternalStore(e?.session.subscribe??Ei,e?.session.getSnapshot??Pi),o=s?.phase!==void 0&&s.phase!=="idle";let r;return t[0]!==e||t[1]!==s||t[2]!==o?(r={active:o,context:e,snapshot:s},t[0]=e,t[1]=s,t[2]=o,t[3]=r):r=t[3],r}const Ei=()=>()=>{},Pi=()=>null;function Ui(){const t=R.c(9),e=B(),{context:s}=ys();if(!s?.enabled||!navigator.mediaDevices?.getUserMedia)return null;const o=s.start;let r;t[0]!==e?(r=e("chat.voice.start"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e?(i=e("chat.voice.start"),t[2]=e,t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Lo,{size:18}),t[4]=a):a=t[4];let l;return t[5]!==s.start||t[6]!==r||t[7]!==i?(l=n.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:o,"aria-label":r,title:i,children:a}),t[5]=s.start,t[6]=r,t[7]=i,t[8]=l):l=t[8],l}function Li({session:t,phase:e,muted:s}){const[o]=P.useState(()=>r=>{if(!r||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let i=0,a=requestAnimationFrame(function l(){const V=Math.min(1,t.outputVolume());i+=(V-i)*(V>i?.55:.12),r.style.setProperty("--voice-level",i.toFixed(3)),a=requestAnimationFrame(l)});return()=>cancelAnimationFrame(a)});return n.jsx("div",{ref:o,className:"studio-voice-orb","data-phase":e,"data-muted":s,"aria-hidden":"true"})}function sl(){const t=R.c(65),e=B(),{taskId:s}=Ye(),o=Fe(),{context:r,snapshot:i,active:a}=ys();if(!a||!r||!i)return null;const{session:l}=r;let V;t[0]!==i.error||t[1]!==i.muted||t[2]!==i.phase||t[3]!==e?(V=i.error?e(`chat.voice.${i.error}`):i.muted?e("chat.voice.muted"):e(`chat.voice.${i.phase}`),t[0]=i.error,t[1]=i.muted,t[2]=i.phase,t[3]=e,t[4]=V):V=t[4];const d=V;let u;t[5]!==e?(u=e("chat.voice.title"),t[5]=e,t[6]=u):u=t[6];let c;t[7]!==l||t[8]!==i.muted||t[9]!==i.phase?(c=n.jsx(Li,{session:l,phase:i.phase,muted:i.muted}),t[7]=l,t[8]=i.muted,t[9]=i.phase,t[10]=c):c=t[10];let p;t[11]!==d?(p=n.jsx("p",{role:"status",className:"max-w-sm text-center text-sm text-muted-foreground",children:d}),t[11]=d,t[12]=p):p=t[12];let f;t[13]!==i.working||t[14]!==e?(f=i.working&&n.jsx("p",{className:"text-center text-xs text-muted-foreground",children:e("chat.voice.backgroundWork")}),t[13]=i.working,t[14]=e,t[15]=f):f=t[15];let m;t[16]!==r.start||t[17]!==i.phase||t[18]!==e?(m=i.phase==="error"&&n.jsx(Y,{variant:"outline",onClick:r.start,children:e("chat.voice.retry")}),t[16]=r.start,t[17]=i.phase,t[18]=e,t[19]=m):m=t[19];let h;t[20]!==c||t[21]!==p||t[22]!==f||t[23]!==m?(h=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-7 overflow-y-auto px-6 py-8",children:[c,p,f,m]}),t[20]=c,t[21]=p,t[22]=f,t[23]=m,t[24]=h):h=t[24];let g;t[25]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Oe,{inline:!0,voiceMode:!0}),t[25]=g):g=t[25];let v;t[26]!==s?(v=s&&n.jsx(gs,{taskId:s}),t[26]=s,t[27]=v):v=t[27];let x;t[28]!==v?(x=n.jsxs("div",{className:"max-h-[55%] shrink-0 overflow-y-auto px-3",children:[g,v]}),t[28]=v,t[29]=x):x=t[29];const b=i.phase==="connecting"||i.phase==="error",A=i.muted?"chat.voice.unmute":"chat.voice.mute";let j;t[30]!==e||t[31]!==A?(j=e(A),t[30]=e,t[31]=A,t[32]=j):j=t[32];const k=i.muted?"chat.voice.unmute":"chat.voice.mute";let y;t[33]!==e||t[34]!==k?(y=e(k),t[33]=e,t[34]=k,t[35]=y):y=t[35];let w;t[36]!==i.muted?(w=i.muted?n.jsx(zo,{size:18}):n.jsx(Oo,{size:18}),t[36]=i.muted,t[37]=w):w=t[37];let C;t[38]!==l.toggleMute||t[39]!==i.muted||t[40]!==b||t[41]!==j||t[42]!==y||t[43]!==w?(C=n.jsx(Y,{variant:"outline",size:"icon",disabled:b,"aria-label":j,title:y,"aria-pressed":i.muted,onClick:l.toggleMute,children:w}),t[38]=l.toggleMute,t[39]=i.muted,t[40]=b,t[41]=j,t[42]=y,t[43]=w,t[44]=C):C=t[44];const S=l.stop;let I;t[45]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(Fo,{size:16}),t[45]=I):I=t[45];let N;t[46]!==e?(N=e("chat.voice.backToChat"),t[46]=e,t[47]=N):N=t[47];let T;t[48]!==l.stop||t[49]!==N?(T=n.jsxs(Y,{variant:"outline",onClick:S,children:[I,N]}),t[48]=l.stop,t[49]=N,t[50]=T):T=t[50];let _;t[51]!==o.isRunInProgress||t[52]!==o.isStreaming||t[53]!==o.stop||t[54]!==e?(_=(o.isStreaming||o.isRunInProgress)&&n.jsx(Y,{variant:"outline",size:"icon","aria-label":e("chat.voice.stopWork"),title:e("chat.voice.stopWork"),onClick:o.stop,children:n.jsx($o,{size:16})}),t[51]=o.isRunInProgress,t[52]=o.isStreaming,t[53]=o.stop,t[54]=e,t[55]=_):_=t[55];let E;t[56]!==C||t[57]!==T||t[58]!==_?(E=n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-3 px-4 py-6",children:[C,T,_]}),t[56]=C,t[57]=T,t[58]=_,t[59]=E):E=t[59];let U;return t[60]!==u||t[61]!==E||t[62]!==h||t[63]!==x?(U=n.jsxs("section",{"aria-label":u,className:"absolute inset-0 flex min-h-0 flex-col bg-background",children:[h,x,E]}),t[60]=u,t[61]=E,t[62]=h,t[63]=x,t[64]=U):U=t[64],U}function Fi(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function Ke(t){const e=R.c(7),{message:s,icon:o}=t;let r;e[0]!==o?(r=o??n.jsx(Lt,{size:14,className:"shrink-0"}),e[0]=o,e[1]=r):r=e[1];const i=s??"";let a;e[2]!==i?(a=n.jsx("span",{className:"text-sm",children:i}),e[2]=i,e[3]=a):a=e[3];let l;return e[4]!==r||e[5]!==a?(l=n.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function zi(t,e,s){const o=R.c(7),{editor:r}=Ft(),i=B(),[a,l]=P.useState(!1),V=P.useRef(0);let d,u;return o[0]!==s||o[1]!==r||o[2]!==e||o[3]!==t||o[4]!==i?(d=()=>{const c=h=>{h.dataTransfer?.types.includes("Files")&&(h.preventDefault(),V.current=V.current+1,l(!0))},p=h=>{h.preventDefault(),V.current=Math.max(0,V.current-1),V.current===0&&l(!1)},f=Oi,m=h=>{if(h.preventDefault(),V.current=0,l(!1),s||!r||!t||!ut(t))return;const g=h.dataTransfer?.files;if(!g||g.length===0)return;const v=Array.from(g);(async()=>{let x=r.state.selection.from;for(const b of v)await ts(r,t,b,x,e,i),x=r.state.selection.to})()};return window.addEventListener("dragenter",c),window.addEventListener("dragleave",p),window.addEventListener("dragover",f),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",c),window.removeEventListener("dragleave",p),window.removeEventListener("dragover",f),window.removeEventListener("drop",m)}},u=[r,t,e,i,s],o[0]=s,o[1]=r,o[2]=e,o[3]=t,o[4]=i,o[5]=d,o[6]=u):(d=o[5],u=o[6]),P.useEffect(d,u),a}function Oi(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function $i(t){const e=R.c(14),{selectedModel:s}=t,o=B();let r,i,a;if(e[0]!==s||e[1]!==o){const{parts:d}=Vo(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(gn,{size:24}),e[5]=a):a=e[5],r="text-sm font-medium";let u;e[6]!==o?(u=c=>o(c),e[6]=o,e[7]=u):u=e[7],i=o("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=o,e[2]=r,e[3]=i,e[4]=a}else r=e[2],i=e[3],a=e[4];let l;e[8]!==r||e[9]!==i?(l=n.jsx("span",{className:r,children:i}),e[8]=r,e[9]=i,e[10]=l):l=e[10];let V;return e[11]!==a||e[12]!==l?(V=n.jsxs(n.Fragment,{children:[a,l]}),e[11]=a,e[12]=l,e[13]=V):V=e[13],V}function Bi(){const t=R.c(5),e=B();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Lt,{size:24}),t[0]=s):s=t[0];let o;t[1]!==e?(o=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=o):o=t[2];let r;return t[3]!==o?(r=n.jsxs(n.Fragment,{children:[s,n.jsx("span",{className:"text-sm font-medium",children:o})]}),t[3]=o,t[4]=r):r=t[4],r}function Ki(t){const e=R.c(11),{selectedModel:s,onUnsupportedFile:o,disabled:r}=t,i=zi(s,o,r);let a;e[0]!==s?(a=ut(s),e[0]=s,e[1]=a):a=e[1];const l=a,V=i?"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]!==V||e[3]!==d?(u=O("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",V,d),e[2]=V,e[3]=d,e[4]=u):u=e[4];let c;e[5]!==s||e[6]!==l?(c=l?n.jsx($i,{selectedModel:s}):n.jsx(Bi,{}),e[5]=s,e[6]=l,e[7]=c):c=e[7];let p;return e[8]!==u||e[9]!==c?(p=n.jsx("div",{className:u,children:c}),e[8]=u,e[9]=c,e[10]=p):p=e[10],p}function qe(t){const e=R.c(14),{onClick:s,label:o,icon:r,colorClass:i,maxWidthClass:a}=t;let l;e[0]!==i?(l=O("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",i),e[0]=i,e[1]=l):l=e[1];let V;e[2]!==a?(V=O("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",a),e[2]=a,e[3]=V):V=e[3];let d;e[4]!==o||e[5]!==V?(d=n.jsx("span",{className:V,children:o}),e[4]=o,e[5]=V,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(lt,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let c;return e[8]!==r||e[9]!==o||e[10]!==s||e[11]!==l||e[12]!==d?(c=n.jsxs("button",{type:"button",onClick:s,title:o,"aria-label":o,className:l,children:[r,d,u]}),e[8]=r,e[9]=o,e[10]=s,e[11]=l,e[12]=d,e[13]=c):c=e[13],c}function qi(){const t=R.c(6),e=rt(),{org:s,locator:o}=Ce(),{create:r}=Dn();let i;return t[0]!==r||t[1]!==o||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(i=async a=>{const{tiptapDoc:l,virtualMcp:V,taskIntake:d}=a,u=d===void 0?!1:d,c=crypto.randomUUID(),p=V?.id??tt(s.id).id;sn(sessionStorage,o,c,{tiptapDoc:u&&l?sr(l):l});try{await r({id:c,virtual_mcp_id:p})}catch{}const f={autosend:nn};u&&(f.sidepanel=!0,f.mainpanel=!1),Ys(e,Gs({org:s.slug,agentId:p,superAgentId:tt(s.id).id}),{search:()=>({...f,thread:c}),replace:!1})},t[0]=r,t[1]=o,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=i):i=t[5],i}function nl({onOpenContextPanel:t,showConnectionsBanner:e=!1,homeTaskComposer:s=!1}){const o=B(),r=Sn(),i=Cn(),a=r?.messages??[],l=r?.isStreaming??!1,V=r?.isRunInProgress??!1,d=r?.stop??(()=>{}),u=i?.taskId??"",c=u||Vn,p=qi(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:h,tiptapDocRef:g,imageModel:v,webSearchModel:x,deepResearchModel:b,chatMode:A,setChatMode:j}=Ge(),{data:k}=qs.useSession(),y=k?.user?.id,{org:w,locator:C}=Ce(),[S,I]=Qs(Ws.homeTaskMode(C),!0),N=s&&S,T=tt(w.id).id,_=tn(m?.id),E=cn(_?.id).runtime==="cms",U=vs(_o),[M,L]=P.useState(!1),{unsupportedFile:z,onUnsupportedFile:W,clearUnsupportedFile:$}=bo(),F=Ai(),Q=P.useRef(void 0),Z=async()=>{Q.current=ie;const q=await F.startRecording();te("chat_voice_started",{thread_id:u,outcome:q==="recording"?"started":q==="unsupported"?"unsupported":q==="permission-denied"?"permission_denied":"unknown"})},se=()=>{te("chat_voice_confirmed",{thread_id:u});const q=F.stopRecording();Ve.current?.syncVoiceText(Q.current,q),Ve.current?.focus()},X=()=>{te("chat_voice_cancelled",{thread_id:u}),F.cancelRecording(),Ve.current?.restoreContent(Q.current)};P.useEffect(()=>{if(F.status!=="recording")return;const q=(F.transcript+(F.interimTranscript?" "+F.interimTranscript:"")).trim();Ve.current?.syncVoiceText(Q.current,q)},[F.transcript,F.interimTranscript,F.status]);const D=i?.activeTask??null,K=D?.created_by,H=!!(y&&K&&K!==y),{data:ee}=Do({enabled:H}),J=(ee?.data?.members??[]).find(q=>q.userId===K),ae=J?.user?.name??J?.user?.email?.split("@")[0]??null,G=Uo(),ce=Nn({isDesktopApp:G,harnessId:D?.harness_id}),[ie,fe]=P.useState(()=>At(sessionStorage,C,c)??void 0),le=q=>{fe(q),g.current=q,ln(sessionStorage,C,c,q,{onQuotaExceeded:({docSizeBytes:me})=>{te("chat_draft_quota_exceeded",{thread_id:u||null,doc_size_bytes:me}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},$e=P.useRef(u);if($e.current!==u){$e.current=u;const q=At(sessionStorage,C,c)??void 0;fe(q),g.current=q}const Ne=[...a].reverse().find(q=>q.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Ve=P.useRef(null),he=P.useRef(!1),ge=A==="plan",de=q=>{U(),te("chat_mode_changed",{from_mode:q,to_mode:"default",source:"pill_dismiss"}),j("default")};P.useEffect(()=>{const q=me=>{en(me)&&me.code==="KeyL"&&(me.preventDefault(),me.shiftKey&&j(A==="plan"?"default":"plan"),Ve.current?.focus())};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[A,j]);const xe=In(a),Ie=[...a].reverse().find(q=>q.role==="assistant"&&q.metadata?.usage)?.metadata?.usage?.contextTokens??0,_e=ze("chat"),Me=Xn(),[ve,ke]=P.useState(!1),[oe,ue]=P.useState(!1),Be=!h&&!rn(ie),be=Fi({hasDraft:Be,isStreaming:l,isRunInProgress:V}),Xe=be==="send",Te=be==="stop",ht=q=>{if(q?.preventDefault(),!_e){ke(!0);return}if(Me){ue(!0);return}if(be==="send"&&ie){if(te("chat_message_sent",{thread_id:u||null,mode:A,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:q?"button_or_enter":"programmatic"}),r){if(r.isSendInFlight()){Ee.info(o("chat.input.stillSendingPreviousMessage"));return}r.sendMessage(ie)}else N&&te("task_report_submitted",{source:"home"}),p({tiptapDoc:ie,virtualMcp:N?null:m,taskIntake:N});an(sessionStorage,C,c),le(void 0)}else be==="stop"&&(te("chat_message_stopped",{thread_id:u}),d())};if(H)return n.jsx(Ke,{message:ae?o("chat.input.readOnlyOthersChatNamed",{name:ae}):o("chat.input.readOnlyOthersChat"),icon:ae?n.jsx(Mo,{shape:"circle",size:"2xs",url:J?.user?.image??void 0,fallback:ae.slice(0,2).toUpperCase()}):void 0});if(D?.metadata?.read_only)return n.jsx(Ke,{message:o("chat.input.readOnlyThread")});if(ce)return n.jsx(Ke,{message:o("chat.input.codingAgentRequiresDesktop")});if(E){if(!i)return n.jsx(Ke,{message:o("chat.input.fastPreviewUnavailable")});const q=()=>{const me=i.createTask({runtime:"sandbox"});te("coding_session_started",{thread_id:me})};return n.jsxs("button",{type:"button",onClick:q,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx(fn,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:o("chat.fastPreview.startCodingSession")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.fastPreview.chatNeedsSession")})]}),n.jsx(zt,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return n.jsxs(n.Fragment,{children:[ve&&n.jsx(wt,{feature:"chat",onDismiss:()=>ke(!1)}),oe&&n.jsx(wt,{feature:"chat",copy:{title:o("chat.input.allowanceExhaustedTitle")},onDismiss:()=>ue(!1)}),n.jsx("div",{className:"flex flex-col w-full justify-end text-left",children:n.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&n.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),r&&i&&n.jsx(Oe,{}),r&&i&&u?n.jsx(gs,{taskId:u}):null,n.jsx(Ao,{tiptapDoc:ie,setTiptapDoc:le,disabled:F.status==="recording",enterToSubmit:!0,placeholder:o(N?"chat.input.taskPlaceholder":"chat.input.placeholder"),onSubmit:ht,suggestionOpenRef:he,children:n.jsxs("form",{onSubmit:ht,className:O("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:[n.jsx(Ki,{selectedModel:f,onUnsupportedFile:W,disabled:F.status==="recording"}),n.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:n.jsx(yo,{ref:Ve,disabled:F.status==="recording",virtualMcpId:m?.id??T,showFileUploader:!0,selectedModel:f,onUnsupportedFile:W,suggestionOpenRef:he})}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:F.status==="recording"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1"}),n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n.jsx(wi,{data:F.waveformData.slice(0,28)}),n.jsx("button",{type:"button",onClick:X,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":o("chat.input.cancelRecording"),children:n.jsx(lt,{size:16})}),n.jsx("button",{type:"button",onClick:se,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":o("chat.input.useTranscription"),children:n.jsx(it,{size:16})})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s&&n.jsx(Y,{type:"button",size:"sm",variant:S?"secondary":"ghost","aria-pressed":S,onClick:()=>I(!S),className:"h-8",children:o("chat.input.taskMode")}),n.jsx(mi,{disabled:!1,onOpenConnections:()=>{te("connections_dialog_opened",{source:"tools_popover",mode:"add"}),L(!0)},virtualMcpId:m?.id??T,selectedModel:f,isStreaming:l,onUnsupportedFile:W}),ge&&n.jsx(qe,{onClick:()=>de("plan"),label:o("chat.input.planMode"),icon:n.jsx($t,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),A==="gen-image"&&v&&n.jsx(qe,{onClick:()=>de("gen-image"),label:o("chat.input.createImage"),icon:n.jsx(Wt,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),A==="web-search"&&x&&n.jsx(qe,{onClick:()=>de("web-search"),label:o("chat.input.webSearch"),icon:n.jsx(qt,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),A==="deep-research"&&b&&n.jsx(qe,{onClick:()=>de("deep-research"),label:o("chat.input.deepResearch"),icon:n.jsx(Qt,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),Ne&&Ie>0&&n.jsx(Bn,{usage:xe,totalTokens:Ie,contextWindow:Ne,onOpenContextPanel:t})]}),n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx(ci,{}),n.jsx(Ui,{}),F.isSupported&&n.jsx(Y,{type:"button",onClick:Z,disabled:!1,variant:"ghost",size:"icon",className:O("size-8 transition-colors",F.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:F.status==="permission-denied"?o("chat.input.microphoneAccessDenied"):o("chat.input.voiceInput"),"aria-label":F.status==="permission-denied"?o("chat.input.microphoneAccessDenied"):o("chat.input.voiceInput"),children:n.jsx(mn,{size:18})}),n.jsx(Y,{type:Te?"button":"submit",onClick:q=>{Te&&(q.preventDefault(),q.stopPropagation(),d())},variant:Xe||Te?"default":"ghost",size:N?"sm":"icon",disabled:!Xe&&!Te,className:O(N?"h-8 px-3 transition-all":"size-8 transition-all",!Xe&&!Te&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:o(be==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":N?"chat.input.startTask":"chat.input.sendMessageEnter"),"aria-label":o(be==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":N?"chat.input.startTask":"chat.input.sendMessage"),children:Te?n.jsx(hn,{size:20}):n.jsxs(n.Fragment,{children:[N&&o("chat.input.startTask"),n.jsx(Ot,{size:20})]})})]})]})})]})},u),s&&N&&n.jsx("p",{className:"px-3 pt-3 text-left text-xs text-muted-foreground",children:o("chat.input.taskHint")}),e&&n.jsx(bi,{onClick:()=>{te("connections_banner_clicked",{source:"home_chat_input"}),te("connections_dialog_opened",{source:"home_banner",mode:"add"}),L(!0)}})]})}),n.jsx(Ro,{mode:"browse",open:M,onOpenChange:L,defaultTab:"all"}),n.jsx(jo,{info:z,onClose:$})]})}export{tl as C,Ja as H,Or as T,sl as V,el as a,nl as b,Br as c,Za as d,Pe as e,Xa as f,ys as u};