decocms 3.106.0 → 3.107.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 (225) hide show
  1. package/dist/client/assets/{AlertCircle-BJGXp4ka.js → AlertCircle-CMPJVwbr.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BBdsIfGH.js → ArrowUpRight-BZym3T1n.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-BiabCmdF.js → CheckCircle-QaRkyWTy.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-CejcQRgy.js → ChevronDown-MjAOnuHm.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-fHsU-TVg.js → ChevronLeft-CaEi0Ql6.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-Bajwpni4.js → ChevronRight-Bggdd2Qb.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-DQ-5P7bA.js → ChevronUp-BI8Q0KCd.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-eDubkUAQ.js → DotsVertical-h9OltsuW.js} +1 -1
  9. package/dist/client/assets/{Eye-CMlUam6_.js → Eye-CiHeAXBi.js} +1 -1
  10. package/dist/client/assets/{FilterLines-CwMZDhi2.js → FilterLines-B44v5Lx3.js} +1 -1
  11. package/dist/client/assets/{Globe01-DKKcLl4T.js → Globe01-D3B0ZpoQ.js} +1 -1
  12. package/dist/client/assets/{Globe04-D95JskSa.js → Globe04-CZGzaUeg.js} +1 -1
  13. package/dist/client/assets/{HardDrive-C2eOF8dK.js → HardDrive-DOlIuOW5.js} +1 -1
  14. package/dist/client/assets/{Key01-DZIUNEvu.js → Key01-7V_ke0M2.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-CASwb6NS.js → LayoutLeft-CJtrx6Ua.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DEXnL1UU.js → LinkExternal01-BrCl9X8s.js} +1 -1
  17. package/dist/client/assets/{Monitor01-C1hxhUiJ.js → Monitor01-DmJn0Xdx.js} +1 -1
  18. package/dist/client/assets/{Palette-Dt-qaRPY.js → Palette-yYRvf-TN.js} +1 -1
  19. package/dist/client/assets/{Play-D4JYUILT.js → Play-Cu-3YV7r.js} +1 -1
  20. package/dist/client/assets/{Plus-TQEhHIaf.js → Plus-B-FGzVUP.js} +1 -1
  21. package/dist/client/assets/{SearchLg-D4TTfBZy.js → SearchLg-BFWxMS9X.js} +1 -1
  22. package/dist/client/assets/{SearchMd-D7Nisqin.js → SearchMd-Byi6dKBM.js} +1 -1
  23. package/dist/client/assets/{Settings02-NpgkR8L_.js → Settings02-BShYLaZd.js} +1 -1
  24. package/dist/client/assets/{Shield01-C1PqlQRA.js → Shield01-uufcEZDy.js} +1 -1
  25. package/dist/client/assets/{Star01-IvEBJsCV.js → Star01-zfVBP9ir.js} +1 -1
  26. package/dist/client/assets/{Stars01-Bg13RpyJ.js → Stars01-BPAFwodm.js} +1 -1
  27. package/dist/client/assets/{Stars02-Cqwr8Ws9.js → Stars02-BSNSGyod.js} +1 -1
  28. package/dist/client/assets/{Sun-DikA3hIV.js → Sun-1-Hvx1Ew.js} +1 -1
  29. package/dist/client/assets/{SwitchHorizontal01-BiabkfKZ.js → SwitchHorizontal01-B3GndgYh.js} +1 -1
  30. package/dist/client/assets/{Tool01-Bdi-BBKJ.js → Tool01-CtsjPgQT.js} +1 -1
  31. package/dist/client/assets/{Trash01-CdGzaXWc.js → Trash01-BOlMGjjk.js} +1 -1
  32. package/dist/client/assets/{Upload01-BLuoqDyn.js → Upload01-DT20S4kC.js} +1 -1
  33. package/dist/client/assets/{User01-CXAxBhFG.js → User01-MlOAkWV2.js} +1 -1
  34. package/dist/client/assets/{Users01-DCjMjVCn.js → Users01-xtXb7Nfj.js} +1 -1
  35. package/dist/client/assets/{Users03-B2-Dpsqz.js → Users03-BW0GYkX3.js} +1 -1
  36. package/dist/client/assets/{X-C2rVRme5.js → X-B8sLr84E.js} +1 -1
  37. package/dist/client/assets/{XCircle-CBjK62zF.js → XCircle-brEJ5T3F.js} +1 -1
  38. package/dist/client/assets/{XClose-DOorWLJQ.js → XClose-C7BFv2WT.js} +1 -1
  39. package/dist/client/assets/{Zap-BjNrPOTp.js → Zap-JwJYg7mG.js} +1 -1
  40. package/dist/client/assets/{ZapSquare-BLlgXs9L.js → ZapSquare-DZRGZSZa.js} +1 -1
  41. package/dist/client/assets/{ZoomOut-NGATVClW.js → ZoomOut-BTdqGEzT.js} +1 -1
  42. package/dist/client/assets/{access-gate-CEYZDlvH.js → access-gate-D-ENz8ic.js} +1 -1
  43. package/dist/client/assets/{add-section-modal-CCRNugwW.js → add-section-modal-DWwTmyTY.js} +1 -1
  44. package/dist/client/assets/{agent-icon-CPn767vi.js → agent-icon-B_o3wufy.js} +1 -1
  45. package/dist/client/assets/{agents-list-Cl_EsGPj.js → agents-list-BmacdMx-.js} +1 -1
  46. package/dist/client/assets/{ai-providers-HhkRLdHl.js → ai-providers-1J-5ov2d.js} +1 -1
  47. package/dist/client/assets/{alert-K1aHkZrD.js → alert-4WTxROsk.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-Dz8imfBX.js → alert-dialog-P0HjjxBt.js} +1 -1
  49. package/dist/client/assets/app-editor-CVQWSZwr.js +1 -0
  50. package/dist/client/assets/{auth-DCR9ETmd.js → auth-B4aNCnK1.js} +1 -1
  51. package/dist/client/assets/{auth-catchall-9nkYIsIV.js → auth-catchall-DA62NHq9.js} +1 -1
  52. package/dist/client/assets/{auth-entry-CaGUpf5G.js → auth-entry-DOnzMaqv.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-C9tdNO6I.js → auth-split-layout-Dzsy7Wh-.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-s0rsdpEF.js → authenticate-and-persist-oauth-Cf_RluiA.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-B2xN_dPF.js → automation-list-row-BGfOIH5A.js} +1 -1
  56. package/dist/client/assets/{automation-runs-Bkpk06w6.js → automation-runs-BpjM5lgm.js} +1 -1
  57. package/dist/client/assets/{automations-A0sOYZmC.js → automations-Cr5_dGMq.js} +1 -1
  58. package/dist/client/assets/{avatar-C8rHGBAI.js → avatar-DVWIK2_g.js} +1 -1
  59. package/dist/client/assets/{badge-CyH98isx.js → badge-DjgeHK0H.js} +1 -1
  60. package/dist/client/assets/{block-document-BaSGgwbA.js → block-document-Cazj3EmL.js} +1 -1
  61. package/dist/client/assets/{brand-context-C9-Fue2A.js → brand-context-CavCacnS.js} +1 -1
  62. package/dist/client/assets/{buckets-BtrNVl3M.js → buckets-D7ind9F_.js} +1 -1
  63. package/dist/client/assets/{capability-load-error-CiAu-JyH.js → capability-load-error-BM4sOhb_.js} +1 -1
  64. package/dist/client/assets/{card-DOpZHkJr.js → card-BoMxvMNj.js} +1 -1
  65. package/dist/client/assets/category-editor-BZfTM8Jr.js +1 -0
  66. package/dist/client/assets/chat-context-BNm8gbce.js +28 -0
  67. package/dist/client/assets/{checkbox-C7qfaduP.js → checkbox-C0jia2rg.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-RVqv2vB6.js → cli-auth-success-dXy3stat.js} +1 -1
  69. package/dist/client/assets/{collection-detail-Dh8aT7dW.js → collection-detail-BI_jJDe8.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-C1hErbyw.js → collection-display-button-CXTwGitF.js} +1 -1
  71. package/dist/client/assets/{collection-search-DaeCK9xr.js → collection-search-CTWT2tOk.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-DNE8Urvp.js → collection-tabs-QOIvDftU.js} +1 -1
  73. package/dist/client/assets/{command-J9Wy9n_1.js → command-BF5cH0fj.js} +1 -1
  74. package/dist/client/assets/{commerce-onboarding-ay94EDvY.js → commerce-onboarding-B2t05Fby.js} +1 -1
  75. package/dist/client/assets/{connect-desktop-dialog-Bx-n41ou.js → connect-desktop-dialog-B06-h5Nw.js} +1 -1
  76. package/dist/client/assets/{connection-card-DgYNR14j.js → connection-card-C1lQp9ha.js} +1 -1
  77. package/dist/client/assets/{connection-detail-NDadBpY7.js → connection-detail-D6FqPYcQ.js} +1 -1
  78. package/dist/client/assets/{connection-form-helpers-DW2qQjX-.js → connection-form-helpers-CZdUpiQP.js} +1 -1
  79. package/dist/client/assets/{connections-dTN5hfGr.js → connections-D54uxQNk.js} +1 -1
  80. package/dist/client/assets/{context-menu-BpE4NlKX.js → context-menu-DjpSQHDd.js} +1 -1
  81. package/dist/client/assets/{decopilot-Ds8Sp1JG.js → decopilot-B1xAdfGk.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-DVGFq1Bs.js → decopilot-sse-pool-CHxQ_LL4.js} +1 -1
  83. package/dist/client/assets/{dialog-w2u9ahjo.js → dialog-D5pyPA9N.js} +1 -1
  84. package/dist/client/assets/{domain-settings-DQwVxg0e.js → domain-settings-DxSkbwuB.js} +1 -1
  85. package/dist/client/assets/{drawer-M1tJGuIB.js → drawer-CL-lpG-j.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-Bw00TpsM.js → dropdown-menu-4WYZIGjr.js} +1 -1
  87. package/dist/client/assets/{empty-state-C_fk-KEj.js → empty-state-CXRWIWhf.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Wwim23p3.js → extract-connection-data-T901gsUX.js} +1 -1
  89. package/dist/client/assets/file-explorer-gfciE6Oz.js +2 -0
  90. package/dist/client/assets/{file-type-icon-D_3mz8is.js → file-type-icon-B2x2Y-0k.js} +1 -1
  91. package/dist/client/assets/{files-DEtwnxTG.js → files-DFAdeLGv.js} +1 -1
  92. package/dist/client/assets/{form-Cbgir1KX.js → form-BF9w4WAV.js} +1 -1
  93. package/dist/client/assets/{general-BHfBapWI.js → general-C7NRKQTh.js} +1 -1
  94. package/dist/client/assets/{github-repo-picker-7ankcqDv.js → github-repo-picker-BSRE_ZP0.js} +1 -1
  95. package/dist/client/assets/{hooks-DODv-wVV.js → hooks-CaH8V-Zq.js} +1 -1
  96. package/dist/client/assets/{import-from-deco-dialog-C2qQnsFK.js → import-from-deco-dialog-1mHtJ6UG.js} +1 -1
  97. package/dist/client/assets/{index-CC2delq7.js → index-Blp6eom1.js} +1 -1
  98. package/dist/client/assets/{index-CfDDnM0w.js → index-BmfLcGiW.js} +1 -1
  99. package/dist/client/assets/{index-BskdskYZ.js → index-C875GEAf.js} +1 -1
  100. package/dist/client/assets/{index-D2LhxKOJ.js → index-CWOvdf1E.js} +1 -1
  101. package/dist/client/assets/{index-BkUdQUyL.js → index-CXvlCk1u.js} +5 -5
  102. package/dist/client/assets/{index-C7P-sIHE.js → index-CpAR8E3g.js} +1 -1
  103. package/dist/client/assets/index-Cudx1rWQ.js +1 -0
  104. package/dist/client/assets/index-D2Fo5pUK.js +3 -0
  105. package/dist/client/assets/{index-CWb9Wsg4.js → index-D5EcXFQR.js} +4 -4
  106. package/dist/client/assets/{index-DQSbAZfL.js → index-D9iADi6F.js} +1 -1
  107. package/dist/client/assets/{index-DHLGskzl.js → index-DDhGpRHB.js} +12 -12
  108. package/dist/client/assets/{index-CHOLxMH7.js → index-DUu26rMc.js} +1 -1
  109. package/dist/client/assets/{index-CeQQD9lF.js → index-DlbygLez.js} +1 -1
  110. package/dist/client/assets/{index-BnDi5HAq.js → index-NjnKq7aT.js} +1 -1
  111. package/dist/client/assets/{index-redirect-C1i6X1BQ.js → index-redirect-PGR2Z-TP.js} +1 -1
  112. package/dist/client/assets/{input-DeTgNphX.js → input-DexDCoKo.js} +1 -1
  113. package/dist/client/assets/{integration-icon-DMSKHFp1.js → integration-icon-BdO2TGzi.js} +1 -1
  114. package/dist/client/assets/{label-C5upVuqQ.js → label-B7b8_W98.js} +1 -1
  115. package/dist/client/assets/{login-CgdoANZA.js → login-DRQ6ivKI.js} +1 -1
  116. package/dist/client/assets/{mcp-oauth-a3FzewVg.js → mcp-oauth-75_G3vbg.js} +1 -1
  117. package/dist/client/assets/{members-DpZ9A5f0.js → members-iTiwktiS.js} +1 -1
  118. package/dist/client/assets/{monaco-editor-CUY1wKmW.js → monaco-editor-wofwNzGP.js} +1 -1
  119. package/dist/client/assets/{monitoring-stats-row-CBjQbEuF.js → monitoring-stats-row-DZOpV8wR.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-DlNHjcXi.js → oauth-callback-DBGVioja.js} +1 -1
  121. package/dist/client/assets/{oauth-callback-ai-provider-DijOsYgL.js → oauth-callback-ai-provider-C8hnh5JQ.js} +1 -1
  122. package/dist/client/assets/{onboarding-BsVL9OWm.js → onboarding-BTkLuvSt.js} +1 -1
  123. package/dist/client/assets/{org-install-LgrIXD0Y.js → org-install-DsqI-XSV.js} +1 -1
  124. package/dist/client/assets/{org-layout-vDUTh50X.js → org-layout-CT-wybPj.js} +1 -1
  125. package/dist/client/assets/{organization-choice-XuATQzah.js → organization-choice-DA6cRlb9.js} +1 -1
  126. package/dist/client/assets/{page-seo-form-Xun3Gb-0.js → page-seo-form-f48UrvLZ.js} +1 -1
  127. package/dist/client/assets/page-seo-sheet-x1Ndtspw.js +1 -0
  128. package/dist/client/assets/{popover-Sng9qlGZ.js → popover-C4g-9bIR.js} +1 -1
  129. package/dist/client/assets/post-editor-BjFZW5Xv.js +1 -0
  130. package/dist/client/assets/preview-dialog-BkD-jMTL.js +5 -0
  131. package/dist/client/assets/{primitives-BX1TQnm6.js → primitives-HnexUalB.js} +1 -1
  132. package/dist/client/assets/{profile-2qqK3Ndl.js → profile-OgZpsKBH.js} +1 -1
  133. package/dist/client/assets/project-app-view-C_tJkaVI.js +1 -0
  134. package/dist/client/assets/record-editor-DzUsMR47.js +1 -0
  135. package/dist/client/assets/registry-DGqifiQi.js +2 -0
  136. package/dist/client/assets/{registry-layout-Dh1yj8yr.js → registry-layout-DR6jY145.js} +1 -1
  137. package/dist/client/assets/{require-capability-DQCVcrTE.js → require-capability-ByP8JmqW.js} +1 -1
  138. package/dist/client/assets/{required-auth-layout-BYjSLRKw.js → required-auth-layout-BZ3khNc4.js} +1 -1
  139. package/dist/client/assets/{reset-password-CGTbeNnn.js → reset-password-ByXWgQFi.js} +1 -1
  140. package/dist/client/assets/{roles-DHBhA_58.js → roles-C6FLJAxG.js} +1 -1
  141. package/dist/client/assets/{scroll-area-D5K2cFR-.js → scroll-area-mIEylF_b.js} +2 -2
  142. package/dist/client/assets/{search-input-Dcdjp99e.js → search-input-B5RoY0Jt.js} +1 -1
  143. package/dist/client/assets/{secrets-CZTBZ18F.js → secrets-Cx_0x5Jk.js} +1 -1
  144. package/dist/client/assets/{sections-editor-DR11Z6Ds.js → sections-editor-kz5N2Ax7.js} +2 -2
  145. package/dist/client/assets/{select-Cc21tKCb.js → select-DsHZ_cKM.js} +1 -1
  146. package/dist/client/assets/{select-model-C3sVs6BI.js → select-model-CXSEoijG.js} +1 -1
  147. package/dist/client/assets/seo-editor-42whDzUC.js +1 -0
  148. package/dist/client/assets/{settings-layout-B6-JV7a0.js → settings-layout-B6rSZndR.js} +1 -1
  149. package/dist/client/assets/{settings-section-BI5jS2Dt.js → settings-section-DpPoYwII.js} +1 -1
  150. package/dist/client/assets/{sheet-DOvMDZuR.js → sheet-BdP-CT3V.js} +1 -1
  151. package/dist/client/assets/{shell-controls-BXNxuXv0.js → shell-controls-BB7F5nRc.js} +1 -1
  152. package/dist/client/assets/{shell-layout-BmSdYmam.js → shell-layout-fxMd_ce_.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-DPMEw2M6.js → shell-route-loading-DK2BrXSy.js} +1 -1
  154. package/dist/client/assets/{sidebar-CtBbCGBG.js → sidebar-CUMG6X23.js} +1 -1
  155. package/dist/client/assets/{skeleton-D6by2dpn.js → skeleton-718IFt3P.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-CzWimVLQ.js → sortable.esm-DK8NQ3hM.js} +1 -1
  157. package/dist/client/assets/{sso-DJ-zP7sp.js → sso-CtblN5Bz.js} +1 -1
  158. package/dist/client/assets/{store-g3lyqmRz.js → store-DPFq6Slo.js} +1 -1
  159. package/dist/client/assets/store-registry-DMtj-ygY.js +2 -0
  160. package/dist/client/assets/{studio-tools-BJ-UdyTW.js → studio-tools-BeOJw07q.js} +1 -1
  161. package/dist/client/assets/{switch-BRov-LAY.js → switch-CciXYGhm.js} +1 -1
  162. package/dist/client/assets/{table-5b-Z4cr5.js → table-CKTQNmJo.js} +1 -1
  163. package/dist/client/assets/{tabs-CP761j-X.js → tabs-Ba2CnUCA.js} +1 -1
  164. package/dist/client/assets/{task-status-DwC3l4SN.js → task-status-Bynq6HkU.js} +1 -1
  165. package/dist/client/assets/{textarea-DGEx65DJ.js → textarea-y2Cb87mk.js} +1 -1
  166. package/dist/client/assets/{toggle-group-Bb1gTTUv.js → toggle-group-DULNiKJE.js} +1 -1
  167. package/dist/client/assets/{toolbar-IDz7ohMs.js → toolbar-DMe8NxOq.js} +1 -1
  168. package/dist/client/assets/{tooltip-DlNdoWTC.js → tooltip-9uXVN57R.js} +1 -1
  169. package/dist/client/assets/{types-DIkr-zoW.js → types-DZW_H5GK.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-Bk-PEV0W.js → use-ai-providers-B2EJOvgZ.js} +1 -1
  171. package/dist/client/assets/{use-automations-B3A8m1Qa.js → use-automations-CypyQIO7.js} +1 -1
  172. package/dist/client/assets/{use-capability-CIrGamSD.js → use-capability-miGh5F03.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-NRQ6Jq9B.js → use-clock-tick-BSiLW2Hc.js} +1 -1
  174. package/dist/client/assets/{use-collections-Dx9nw5SH.js → use-collections-C-3QxROQ.js} +1 -1
  175. package/dist/client/assets/{use-connection-CADUWJLS.js → use-connection-BoLZLoix.js} +1 -1
  176. package/dist/client/assets/{use-copy-CWemy_te.js → use-copy-BoWvAcv1.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-BF63k0IF.js → use-create-virtual-mcp-DS79wqg7.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-Ddf6ohdu.js → use-debounced-autosave-CEZtOBxe.js} +1 -1
  179. package/dist/client/assets/{use-debounced-value-CqnvF_Tx.js → use-debounced-value-B_dMYSTS.js} +1 -1
  180. package/dist/client/assets/{use-decopilot-events-DRFfNsO4.js → use-decopilot-events-BSwabbME.js} +1 -1
  181. package/dist/client/assets/{use-delete-connection-BeE9B7tk.js → use-delete-connection-CeUx32Ek.js} +1 -1
  182. package/dist/client/assets/{use-file-configs-Dqn5vTip.js → use-file-configs-CsGZaFDN.js} +1 -1
  183. package/dist/client/assets/{use-infinite-scroll-X3H24Vh-.js → use-infinite-scroll-DjBZ07EY.js} +1 -1
  184. package/dist/client/assets/{use-join-requests-pqzRJ1mW.js → use-join-requests-HvnfXtOh.js} +1 -1
  185. package/dist/client/assets/{use-mcp-client-H0qGyw4S.js → use-mcp-client-CllRpcn8.js} +1 -1
  186. package/dist/client/assets/{use-mcp-prompts-CMH8dkIp.js → use-mcp-prompts-B8n4vAIv.js} +1 -1
  187. package/dist/client/assets/{use-mcp-tools-ClpDupwI.js → use-mcp-tools-xIECjag4.js} +1 -1
  188. package/dist/client/assets/{use-members-CLe24wAb.js → use-members-C_0IATXJ.js} +1 -1
  189. package/dist/client/assets/{use-mobile-AEMP8WrJ.js → use-mobile-DOKfF7z_.js} +1 -1
  190. package/dist/client/assets/{use-navigate-to-agent-CCdQ4egc.js → use-navigate-to-agent-DP_Quce2.js} +1 -1
  191. package/dist/client/assets/{use-org-auth-client-e-AT3UBL.js → use-org-auth-client-C5SxR9m4.js} +1 -1
  192. package/dist/client/assets/use-org-fs-DKt2yrJB.js +1 -0
  193. package/dist/client/assets/{use-org-sso-oYTowyM2.js → use-org-sso-BfAMhOu1.js} +1 -1
  194. package/dist/client/assets/{use-organization-roles-BrNdhD0R.js → use-organization-roles-ChVGS5c6.js} +1 -1
  195. package/dist/client/assets/{use-organization-settings-Ddf63XoW.js → use-organization-settings-Cn568Sdu.js} +1 -1
  196. package/dist/client/assets/{use-registry-connections-FPQXF8Rq.js → use-registry-connections-Dc5qWDtU.js} +1 -1
  197. package/dist/client/assets/{use-secrets-DqSD7GLo.js → use-secrets-DFpbRD2F.js} +1 -1
  198. package/dist/client/assets/{use-status-sounds-C40CL6QW.js → use-status-sounds-BBLiZ08j.js} +1 -1
  199. package/dist/client/assets/{use-view-mode-BgbYtI9e.js → use-view-mode-g5gry7KE.js} +1 -1
  200. package/dist/client/assets/{use-virtual-mcp-BOv3TeD0.js → use-virtual-mcp-D7sKQkq9.js} +1 -1
  201. package/dist/client/assets/useInfiniteQuery-Ljssdqza.js +1 -0
  202. package/dist/client/assets/useSuspenseInfiniteQuery-D7uGd-6e.js +1 -0
  203. package/dist/client/assets/{useSuspenseQueries-Dz__3zJy.js → useSuspenseQueries-DqEFpcN_.js} +1 -1
  204. package/dist/client/assets/{variant-calendar-ColyLdfo.js → variant-calendar-CtaHCIb0.js} +1 -1
  205. package/dist/client/assets/{view-mode-toggle-buFuODEl.js → view-mode-toggle-Bwq7ahqB.js} +1 -1
  206. package/dist/client/index.html +1 -1
  207. package/dist/server/cli.js +410 -410
  208. package/dist/server/server.js +294 -294
  209. package/package.json +1 -1
  210. package/dist/client/assets/app-editor-RWsNU1_V.js +0 -1
  211. package/dist/client/assets/category-editor-nmJa-PEX.js +0 -1
  212. package/dist/client/assets/chat-context-A3TdA-KT.js +0 -21
  213. package/dist/client/assets/file-explorer-D83SKUgJ.js +0 -2
  214. package/dist/client/assets/index-D7jdL_DZ.js +0 -1
  215. package/dist/client/assets/index-DjmwjOWv.js +0 -3
  216. package/dist/client/assets/page-seo-sheet-CUpKopG7.js +0 -1
  217. package/dist/client/assets/post-editor-CGhDEOwt.js +0 -1
  218. package/dist/client/assets/preview-dialog-DNK26uoS.js +0 -5
  219. package/dist/client/assets/project-app-view-E03tCSaX.js +0 -1
  220. package/dist/client/assets/record-editor-aq3fvSFo.js +0 -1
  221. package/dist/client/assets/registry-DsQsIymK.js +0 -2
  222. package/dist/client/assets/seo-editor-Cch9eI4T.js +0 -1
  223. package/dist/client/assets/store-registry-Bl8dzute.js +0 -2
  224. package/dist/client/assets/useInfiniteQuery-DfyfHpXx.js +0 -1
  225. package/dist/client/assets/useSuspenseInfiniteQuery-BAdfxWHo.js +0 -1
@@ -1,3 +0,0 @@
1
- import{m as Ue,r as S,ar as Ks,ap as Qs,c as $,D as de,l as U,j as s,E as Ys,t as le,o as ye,aD as Hs,s as Ie,aE as Dt,L as Gs,B as re,p as Ws,n as Js,aF as Zs,aG as Xs,J as Ee,af as er,aH as Me,aI as Wt,b as rt,d as Pt,v as W,aJ as tr,a8 as Rn,a7 as nr,F as sr,aK as rr,a as Tn,aL as or,aM as Dn,aN as ar,aO as ue,aP as gt,aQ as lr,aR as ir,aS as bt,aT as cr,aU as dr,aV as ur,aW as Vr,q as fr,K as Oe,aX as mr,aY as pr,aZ as hr,a_ as xr,a$ as Pn,b0 as $e,k as gr,i as br,ag as Mn}from"./index-CWb9Wsg4.js";import{b as he,u as Re,S as Ct,c as ot,a as Fn,e as $n,s as vr,f as yr,g as Ar,h as jr,i as On,A as wr,j as Sr,k as Cr}from"./chat-context-A3TdA-KT.js";import{j as Ln,s as at,g as me,P as Je,k as Mt,t as Nr,l as kr,M as _r,m as Ir,n as Ze,o as zn,p as Er,D as Rr,q as Tr,r as Dr,v as Le,w as Pr,d as Mr,x as Fr,y as Ft,z as $r,F as Or,i as Lr,E as zr,c as Br,A as Ur,B as qr,H as Jt,I as Kr}from"./scroll-area-D5K2cFR-.js";import{c as Nt,a as xe,b as ge,T as be}from"./tooltip-DlNdoWTC.js";import{c as lt,a as it,d as ct,e as dt,b as $t}from"./dialog-w2u9ahjo.js";import{c as Qr,b as Yr,a as Hr,D as Gr}from"./drawer-M1tJGuIB.js";import{C as Wr}from"./collection-search-DaeCK9xr.js";import{u as Jr}from"./use-mobile-AEMP8WrJ.js";import{a as ut,u as Te,S as Zr,i as Zt}from"./use-mcp-client-H0qGyw4S.js";import{u as Xr,g as Vt,l as kt}from"./use-mcp-prompts-CMH8dkIp.js";import{t as ft}from"./ChevronDown-CejcQRgy.js";import{i as ke}from"./X-C2rVRme5.js";import{t as eo,z as to,u as no,w as so,A as ro}from"./hooks-DODv-wVV.js";import{K as oo,i as ao}from"./shell-layout-BmSdYmam.js";import{u as lo,a as io}from"./use-virtual-mcp-BOv3TeD0.js";import{a as Bn}from"./SwitchHorizontal01-BiabkfKZ.js";import{n as Un}from"./ZapSquare-BLlgXs9L.js";import{i as qe}from"./ChevronUp-DQ-5P7bA.js";import{s as qn}from"./Star01-IvEBJsCV.js";import{a as Kn}from"./Tool01-Bdi-BBKJ.js";import{ac as mt,x as co,a4 as Qn,ad as uo,A as Yn,g as He,j as Vo,a6 as fo,ae as mo,C as po,af as Hn,ag as ho,ah as xo,c as Gn}from"./agent-icon-CPn767vi.js";import{i as go}from"./Upload01-BLuoqDyn.js";import{i as Wn}from"./AlertCircle-BJGXp4ka.js";import{a as bo}from"./Eye-CMlUam6_.js";import{a as _t,b as Ot,d as Lt,e as zt,F as Jn}from"./form-Cbgir1KX.js";import{S as vo,d as yo,a as Ao,b as jo,c as wo}from"./select-Cc21tKCb.js";import{b as So}from"./Settings02-NpgkR8L_.js";import{i as Zn,t as It,b as Co}from"./XCircle-CBjK62zF.js";import{b as No,c as ko}from"./tabs-CP761j-X.js";import{T as Xn,a as Xe}from"./toggle-group-Bb1gTTUv.js";import{I as es}from"./input-DeTgNphX.js";import{u as ts,a as _o,g as Io,A as Eo}from"./sortable.esm-CzWimVLQ.js";import{u as ns}from"./studio-tools-BJ-UdyTW.js";import{i as Bt}from"./Monitor01-C1hxhUiJ.js";import{u as ss,C as Ro,a as rs,b as os}from"./connect-desktop-dialog-Bx-n41ou.js";import{s as To}from"./XClose-DOorWLJQ.js";import{m as pt,i as Do,g as as,a as Po,N as Mo}from"./decopilot-Ds8Sp1JG.js";import{P as Ut,a as qt,b as Kt}from"./popover-Sng9qlGZ.js";import{e as Xt,a as en,g as Fo,b as $o,C as Oo,c as Lo,d as zo}from"./command-J9Wy9n_1.js";import{u as Bo}from"./useInfiniteQuery-DfyfHpXx.js";import{t as Uo}from"./Stars01-Bg13RpyJ.js";import{D as qo,a as Ko,b as Qo,c as fe,d as tn,e as nn,f as sn,j as Yo,i as Ho}from"./dropdown-menu-Bw00TpsM.js";import{s as rn}from"./Plus-TQEhHIaf.js";import{p as Go,q as Wo}from"./question-004-sINsf4GQ.js";import{i as Jo}from"./ChevronRight-Bajwpni4.js";function Zo(t,e){const n=Ue(e);return Xo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Xo(t={},e){const n=Ue(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=on(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=Ks(o.current,on(n,r.current));o.current!==l&&(o.current=l,Qs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,ls="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",ea="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function is(t){const e=$.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:d}=n;let u;if(e[0]!==d._meta||e[1]!==d.name||e[2]!==d.title){const A=me(d._meta);u=d.title??Mt(d.name,A),e[0]=d._meta,e[1]=d.name,e[2]=d.title,e[3]=u}else u=e[3];const V=u,i=d.description||null;if(c==="card"){let A;e[4]!==r||e[5]!==d?(A=()=>r(d),e[4]=r,e[5]=d,e[6]=A):A=e[6];const w=a||o,C=o&&"bg-accent/40",E=(a||o)&&"cursor-not-allowed opacity-50";let N;e[7]!==C||e[8]!==E?(N=U(ea,"hover:bg-accent/60 text-foreground",C,E),e[7]=C,e[8]=E,e[9]=N):N=e[9];let D;e[10]!==V?(D=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=D):D=e[11];let P;e[12]!==o?(P=o&&s.jsx(Ct,{size:"xs"}),e[12]=o,e[13]=P):P=e[13];let I;e[14]!==D||e[15]!==P?(I=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[D,P]}),e[14]=D,e[15]=P,e[16]=I):I=e[16];let M;e[17]!==i?(M=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=M):M=e[18];let _;return e[19]!==I||e[20]!==M||e[21]!==A||e[22]!==w||e[23]!==N?(_=s.jsxs("button",{type:"button",onClick:A,disabled:w,className:N,children:[I,M]}),e[19]=I,e[20]=M,e[21]=A,e[22]=w,e[23]=N,e[24]=_):_=e[24],_}let m;e[25]!==r||e[26]!==d?(m=()=>r(d),e[25]=r,e[26]=d,e[27]=m):m=e[27];const f=a||o,g=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let x;e[28]!==g||e[29]!==p?(x=U(ls,"hover:bg-muted/70 hover:text-foreground",g,p),e[28]=g,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let h;e[33]!==o?(h=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=h):h=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==x||e[38]!==b||e[39]!==h?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:x,children:[b,h]})}),e[35]=m,e[36]=f,e[37]=x,e[38]=b,e[39]=h,e[40]=v):v=e[40];const y=i??V;let k;e[41]!==y?(k=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=k):k=e[42];let j;return e[43]!==v||e[44]!==k?(j=s.jsxs(be,{delayDuration:400,children:[v,k]}),e[43]=v,e[44]=k,e[45]=j):j=e[45],j}function ta(t){const e=$.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,d]=S.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(w=>{const C=c.toLowerCase();return w.prompt.name.toLowerCase().includes(C)||(w.prompt.title??"").toLowerCase().includes(C)||(w.prompt.description??"").toLowerCase().includes(C)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const i=V,m=Jr();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let g;if(e[6]!==i||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let w;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(w=C=>s.jsx(is,{item:C,variant:"card",onSelect:E=>{o(!1),a(E)},isLoading:l?.name===C.prompt.name,isDisabled:u&&l?.name!==C.prompt.name},C.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=w):w=e[16],g=i.map(w),e[6]=i,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=g}else g=e[11];let p;e[17]!==f||e[18]!==g?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,g]})}),e[17]=f,e[18]=g,e[19]=p):p=e[19];const x=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=w=>{w.key==="Escape"&&d("")},e[20]=b):b=e[20];let h;e[21]!==c?(h=s.jsx(Wr,{value:c,onChange:d,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=h):h=e[22];const v=h;if(m){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Qr,{className:"sr-only",children:s.jsx(Yr,{children:"All prompts"})}),e[23]=w):w=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=C):C=e[24];let E;e[25]!==x||e[26]!==v?(E=s.jsxs(Hr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,C,v,x]}),e[25]=x,e[26]=v,e[27]=E):E=e[27];let N;return e[28]!==o||e[29]!==r||e[30]!==E?(N=s.jsx(Nt,{delayDuration:400,children:s.jsx(Gr,{open:r,onOpenChange:o,children:E})}),e[28]=o,e[29]=r,e[30]=E,e[31]=N):N=e[31],N}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=k):k=e[33];let j;e[34]!==x||e[35]!==v?(j=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,k,v,x]}),e[34]=x,e[35]=v,e[36]=j):j=e[36];let A;return e[37]!==o||e[38]!==r||e[39]!==j?(A=s.jsx(Nt,{delayDuration:400,children:s.jsx(dt,{open:r,onOpenChange:o,children:j})}),e[37]=o,e[38]=r,e[39]=j,e[40]=A):A=e[40],A}function na(t){const e=$.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=S.useState(!1);if(n.length===0)return null;let d,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,an);let h;e[6]!==n?(h=n.slice(an),e[6]=n,e[7]=h):h=e[7],d=h,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(is,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:u&&o?.name!==y.prompt.name},y.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=d,e[4]=u,e[5]=V}else d=e[3],u=e[4],V=e[5];const i=V;let m;e[12]!==a?(m=U("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==d.length||e[15]!==u?(f=d.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:U(ls,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",d.length," more"]}),e[14]=d.length,e[15]=u,e[16]=f):f=e[16];let g;e[17]!==i||e[18]!==m||e[19]!==f?(g=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=g):g=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(ta,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let x;return e[26]!==g||e[27]!==p?(x=s.jsxs(Nt,{delayDuration:400,children:[g,p]}),e[26]=g,e[27]=p,e[28]=x):x=e[28],x}function sa(){return null}function ra(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function oa(t){const e=$.c(30),{connectionId:n}=t,{sendMessage:r}=Re(),{org:o}=de();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Te(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=Xr(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const V=u;let i;e[8]!==V?(i=V.map(aa),e[8]=V,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[g,p]=S.useReducer(ra,f),[x,b]=S.useState(null);let h;e[11]!==l||e[12]!==r?(h=async(P,I)=>{if(!l){le.error("MCP client not available"),p({type:"RESET"});return}try{const M=await Vt(l,P.name,I);p({type:"RESET"});const _={type:"doc",content:[{type:"paragraph",content:[Ln({id:P.name,name:at(P.name,me(P._meta)),metadata:M.messages,char:"/",kind:"prompt",args:I}),{type:"text",text:" "}]}]};await r(_)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),le.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=h):h=e[13];const v=h;let y;e[14]!==v?(y=async P=>{if(P.arguments&&P.arguments.length>0){p({type:"SELECT_PROMPT",prompt:P}),b(P);return}p({type:"START_LOADING",prompt:P}),await v(P)},e[14]=v,e[15]=y):y=e[15];const k=y;let j;e[16]!==x||e[17]!==v?(j=async P=>{x&&(p({type:"START_LOADING",prompt:x,arguments:P}),b(null),await v(x,P))},e[16]=x,e[17]=v,e[18]=j):j=e[18];const A=j;if(m.length===0)return null;const w=g.stage==="loading"?g.prompt:null;let C;e[19]!==k||e[20]!==m||e[21]!==w?(C=s.jsx(na,{items:m,onSelect:k,loadingPrompt:w}),e[19]=k,e[20]=m,e[21]=w,e[22]=C):C=e[22];let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{b(null),p({type:"RESET"})},e[23]=E):E=e[23];let N;e[24]!==x||e[25]!==A?(N=s.jsx(Je,{prompt:x,setPrompt:E,onSubmit:A}),e[24]=x,e[25]=A,e[26]=N):N=e[26];let D;return e[27]!==C||e[28]!==N?(D=s.jsxs(s.Fragment,{children:[C,N]}),e[27]=C,e[28]=N,e[29]=D):D=e[29],D}function aa(t){return{prompt:t}}function la(t){const e=$.c(13),{className:n}=t,{selectedVirtualMcp:r}=he(),{org:o}=de();let a;e[0]!==o.id?(a=ut(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let d;e[2]!==n?(d=U("w-full @container",n),e[2]=n,e[3]=d):d=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(sa,{}),e[4]=V):V=e[4];let i;e[5]!==c?(i=s.jsx(oa,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==u||e[8]!==i?(m=s.jsx(Ys,{fallback:null,children:s.jsx(S.Suspense,{fallback:V,children:i},u)}),e[7]=u,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==d||e[11]!==m?(f=s.jsx("div",{className:d,children:m}),e[10]=d,e[11]=m,e[12]=f):f=e[12],f}const vt="cubic-bezier(0.645, 0.045, 0.355, 1)",ia=44,ca={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},da={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ua={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function pe(t){const e=$.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:d,defaultExpanded:u,variant:V,onClose:i}=t,m=V===void 0?"default":V,[f,g]=S.useState(u),[p,x]=S.useState(!1);let b;e[0]!==i?(b=()=>{x(!0),i?.()},e[0]=i,e[1]=b):b=e[1];const h=b;if(p)return null;const v=da[m],y=ca[m];let k;e[2]!==v||e[3]!==y?(k=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=k):k=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=()=>g(Va),e[5]=j):j=e[5];const A=f&&"rounded-b-none",w=!f&&"rounded-b-xl";let C;e[6]!==A||e[7]!==w?(C=U("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",A,w),e[6]=A,e[7]=w,e[8]=C):C=e[8];const E=ua[m];let N;e[9]!==E?(N=U("shrink-0",E),e[9]=E,e[10]=N):N=e[10];let D;e[11]!==n||e[12]!==N?(D=s.jsx("span",{className:N,children:n}),e[11]=n,e[12]=N,e[13]=D):D=e[13];let P;e[14]!==r?(P=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=P):P=e[15];let I;e[16]!==o?(I=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=I):I=e[17];const M=f?"rotate(180deg)":"rotate(0deg)";let _;e[18]!==M?(_=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ft,{size:16,style:{transform:M,transition:`transform 180ms ${vt}`}})}),e[18]=M,e[19]=_):_=e[19];let T,R;e[20]!==h?(T=se=>{se.stopPropagation(),h()},R=se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),h())},e[20]=h,e[21]=T,e[22]=R):(T=e[21],R=e[22]);let O;e[23]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ke,{size:16}),e[23]=O):O=e[23];let B;e[24]!==T||e[25]!==R?(B=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:T,onKeyDown:R,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:O}),e[24]=T,e[25]=R,e[26]=B):B=e[26];let L;e[27]!==f||e[28]!==D||e[29]!==P||e[30]!==I||e[31]!==_||e[32]!==B||e[33]!==C?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:j,className:C,children:[D,P,I,_,B]}),e[27]=f,e[28]=D,e[29]=P,e[30]=I,e[31]=_,e[32]=B,e[33]=C,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let K;e[35]!==q?(K={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${vt}`},e[35]=q,e[36]=K):K=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q={overflow:"hidden",minHeight:0},e[37]=Q):Q=e[37];const F=f?1:0;let z;e[38]!==F?(z={opacity:F,transition:`opacity 120ms ${vt}`},e[38]=F,e[39]=z):z=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let H;e[42]!==d||e[43]!==a?(H=d?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:d}):null,e[42]=d,e[43]=a,e[44]=H):H=e[44];let G;e[45]!==l||e[46]!==c?(G=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=G):G=e[47];let X;e[48]!==z||e[49]!==Y||e[50]!==H||e[51]!==G?(X=s.jsx("div",{style:Q,children:s.jsxs("div",{style:z,children:[Y,H,G]})}),e[48]=z,e[49]=Y,e[50]=H,e[51]=G,e[52]=X):X=e[52];let ee;e[53]!==K||e[54]!==X?(ee=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:X}),e[53]=K,e[54]=X,e[55]=ee):ee=e[55];let te;return e[56]!==L||e[57]!==ee||e[58]!==k||e[59]!==m?(te=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:k,children:[L,ee]}),e[56]=L,e[57]=ee,e[58]=k,e[59]=m,e[60]=te):te=e[60],te}function Va(t){return!t}const fa=ye({content:Ie().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:Ie().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),cs=ye({todos:Hs(fa)}),ma="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.";eo({description:ma,inputSchema:to(cs),execute:async({todos:t})=>({ok:!0,count:t.length})});const pa="tool-todo_write",ha=new Set(["input-available","output-available"]);function ds(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==pa||typeof a.state!="string"||!ha.has(a.state))continue;const l=cs.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function us(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:Nr(kr(r)),input:n.input})}return e}function Vs(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function xa(t){return t?t.message.startsWith("[CREDITS]"):!1}const ga={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function ba(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&xa(n))return{...ga,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],d=c,V=!!d.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=Vs(c),m=us(d),f=ds(e),g=!o&&!!n,p=m.length>0||o&&a,x=i.length>0,h=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||x))&&!g;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:g,showWarning:h,hasApprovals:p,hasPlans:x,isWaitingForUserInput:V}}function fs(){const t=$.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Re(),l=n??null,c=r??null;let d;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(d=ba({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=d):d=t[5],d}function va(){const t=fs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function ms(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const ya="__home__";function Qt(t,e){return Gs.chatDraft(t,e)}function Aa(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function ja(t,e,n,r,o){const a=Qt(e,n);if(ms(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(d){if(Sa(d)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw d}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=Aa(o);return o!==null&&a===null&&t.removeItem(r),a}function wa(t,e,n){t.removeItem(Qt(e,n))}function Sa(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Ca(t){const e=$.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=U("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(So,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==d?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:d,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=d,e[6]=V):V=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,g=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==g?(p=U("p-0.5 rounded transition-colors",g),e[10]=g,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Zn,{size:14}),e[12]=x):x=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:x}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let h;return e[17]!==b||e[18]!==V||e[19]!==m?(h=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=h):h=e[20],h}function ps(t){const e=$.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(Ca,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Na(t){const e=$.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const g=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==g?(p=U("h-7 px-2.5 text-xs",g),e[3]=g,e[4]=p):p=e[4];let x;e[5]!==i||e[6]!==V||e[7]!==f||e[8]!==p?(x=s.jsx(re,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:V}),e[5]=i,e[6]=V,e[7]=f,e[8]=p,e[9]=x):x=e[9];const b=x;if(!m)return b;let h;e[10]!==b?(h=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=h):h=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==h||e[15]!==v?(y=s.jsxs(be,{children:[h,v]}),e[14]=h,e[15]=v,e[16]=y):y=e[16],y}function hs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function dn(t,e,n,r,o){if(t.length===0)return null;const a=hs(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const d=e(c);if(d!==o&&!r(n[d]))return d}return null}function ka(t){return!t.isStreaming&&t.allAnswered}function xs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,d=e[0]?n(e[0]):"",[u,V]=S.useState(d),[i,m]=S.useState(!1),f=Ws({resolver:Js(r),defaultValues:o}),g=f.watch(),p=hs(e,n,u),x=p>=0?e[p]:void 0,b=l(g[u]),h=cn(e,n,g,l),v=ka({isStreaming:a,allAnswered:h}),y=()=>{if(p>0){const N=e[p-1];N&&V(n(N))}},k=()=>{if(p>=0&&p<e.length-1){const N=e[p+1];N&&V(n(N))}},j=()=>{const N=f.getValues(),D=dn(e,n,N,l,u);D&&V(D)},A=()=>{f.handleSubmit(N=>{const D=N;for(const P of e)c(P,D[n(P)])})()},w=S.useRef(A);w.current=A;const C=()=>{v&&(m(!1),w.current())},E=()=>{const N=f.getValues();if(cn(e,n,N,l)){if(a){m(!0);return}m(!1),w.current()}else{const D=dn(e,n,N,l,u);D&&V(D)}};return S.useEffect(()=>{if(i&&!a){if(!h){m(!1);return}m(!1),w.current()}},[i,a,h]),{form:f,activeKey:u,setActiveKey:V,currentIndex:p,currentPart:x,isCurrentAnswered:b,isAllAnswered:h,canSubmit:v,goPrev:y,goNext:k,advanceToNextUnanswered:j,submit:C,submitOrAdvance:E}}const gs="User denied this tool call, give other alternatives.";function bs(t){const e=$.c(9),{onYolo:n}=t,[r,o]=Ee();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const i=V,m=r.toolApprovalLevel??"readonly";o({...r,toolApprovalLevel:i}),i==="auto"&&n(m)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(jo,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:Ia,children:s.jsx(wo,{})}),e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(vo,{children:Me.map(_a)}),e[5]=d):d=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(yo,{value:r.toolApprovalLevel,onValueChange:l,children:[c,d]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function _a(t){return s.jsx(Ao,{value:t.value,children:t.label},t.value)}function Ia(t){return t.stopPropagation()}function vs(t){const e=$.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function Ea(t){const e=$.c(28),{approval:n,onRespond:r}=t,[o]=Ee(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,gs,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(d=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=d):d=e[7];const u=d;let V;e[8]!==n.approvalId||e[9]!==r?(V=k=>r(n.approvalId,!0,void 0,k),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const i=V;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(bs,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let g;e[13]!==c?(g=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=g):g=e[14];let p;e[15]!==u?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=p):p=e[16];let x;e[17]!==g||e[18]!==p?(x=s.jsxs(s.Fragment,{children:[g,p]}),e[17]=g,e[18]=p,e[19]=x):x=e[19];const b=x;let h;e[20]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{size:14}),e[20]=h):h=e[20];let v;e[21]!==n.input?(v=s.jsx(vs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(y=s.jsx(pe,{icon:h,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=y):y=e[27],y}const Ra=Zs(Ie(),ye({approved:Xs().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function Ta(t){const e=$.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ee(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Ma)),e[0]=n,e[1]=c):c=e[1];const d=c;let u;e[2]!==l||e[3]!==o?(u=(E,N)=>{const D=N;typeof D?.approved=="boolean"&&o(E.approvalId,D.approved,D.approved===!1?gs:void 0,D.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==d||e[7]!==r||e[8]!==u?(V={parts:n,partKey:Pa,schema:Ra,defaultValues:d,isStreaming:r,hasAnswer:Da,onSubmit:u},e[5]=n,e[6]=d,e[7]=r,e[8]=u,e[9]=V):V=e[9];const i=xs(V);let m;e[10]!==n||e[11]!==i?(m=E=>{i.form.reset(Object.fromEntries(n.map(N=>[N.approvalId,{approved:!0,levelOverride:E}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,g=i.currentPart;let p;e[13]!==i?(p=E=>{E.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(mt,{size:14}),e[15]=x):x=e[15];const b=`${n.length} approvals pending`,h=g?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(bs,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(y=s.jsx(ps,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=y):y=e[23];let k;e[24]!==g||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(k=g?s.jsx(Fa,{approvalId:g.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=g,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=k):k=e[27];let j;e[28]!==g?(j=g?s.jsx(vs,{input:g.input}):null,e[28]=g,e[29]=j):j=e[29];let A;e[30]!==y||e[31]!==k||e[32]!==j||e[33]!==b||e[34]!==h?(A=s.jsx(pe,{icon:x,label:b,title:h,defaultExpanded:!0,footerLeft:y,footerRight:k,children:j}),e[30]=y,e[31]=k,e[32]=j,e[33]=b,e[34]=h,e[35]=A):A=e[35];let w;e[36]!==A||e[37]!==p?(w=s.jsx("form",{onSubmit:p,children:A}),e[36]=A,e[37]=p,e[38]=w):w=e[38];let C;return e[39]!==i.form||e[40]!==w?(C=s.jsx(_t,{...i.form,children:w}),e[39]=i.form,e[40]=w,e[41]=C):C=e[41],C}function Da(t){return typeof t?.approved=="boolean"}function Pa(t){return t.approvalId}function Ma(t){return[t.approvalId,{approved:void 0}]}function Fa(t){const e=$.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=d=>{const{field:u}=d,V=u.value===!0,i=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(er,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function $a(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(mt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Oa(t){const e=$.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx($a,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(Ea,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Ta,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function La(t){const e=$.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==l?(d=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];const V=u;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(co,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(_r,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(pe,{icon:i,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function za(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(qe,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ba(t){const e=$.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(za,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let d;return e[3]!==c||e[4]!==o||e[5]!==a?(d=s.jsx(La,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=d):d=e[6],d}function ys(t){return t?"response"in t?t.response:t.option??t.draft:""}const un=ye({response:Ie().min(1,"Response is required")}),Ua=ye({option:Ie().nullable(),draft:Ie()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),qa=ye({response:Dt(["yes","no"])});function Ka(t){switch(t.type){case"text":return un;case"choice":return Ua;case"confirm":return qa;default:return un}}function Qa(t){const e={};for(const n of t)e[n.toolCallId]=Ka(n.input);return ye(e)}function Ya(t){const e=$.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:d}=c,u=d.value??"";return s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Qn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...d,value:u,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Jn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function As(t,e){const n=$.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const d=Number.parseInt(l.key,10);d>=1&&d<=t&&(l.preventDefault(),e(d-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),S.useEffect(r,o)}function Ha(t){const e=$.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Wt(l),d=`${r}.draft`;let u;e[3]!==n||e[4]!==d?(u={control:n,name:d,defaultValue:""},e[3]=n,e[4]=d,e[5]=u):u=e[5];const{field:V}=Wt(u),i=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=D=>{const P=o[D];P!=null&&c.onChange(P)},e[6]=c,e[7]=o,e[8]=f):f=e[8],As(o.length,f),o.length===0)return null;const g=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let D;e[13]!==c||e[14]!==i?(D=(P,I)=>{const M=i===P;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(P),className:U("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",M&&"bg-accent/50",!M&&"hover:bg-accent/30"),"aria-label":`Select ${P}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",M?"bg-chart-1 text-white":"bg-muted text-foreground"),children:I+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:P})]},`${I}-${P}`)},e[13]=c,e[14]=i,e[15]=D):D=e[15],p=o.map(D),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const x=g&&"bg-accent/50",b=!g&&"hover:bg-accent/30";let h;e[16]!==x||e[17]!==b?(h=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[16]=x,e[17]=b,e[18]=h):h=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Qn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=g?m:"";let k;e[20]!==V||e[21]!==c||e[22]!==i?(k=D=>{V.onChange(D.target.value),i!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=i,e[23]=k):k=e[23];let j;e[24]!==c||e[25]!==i?(j=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=j):j=e[26];let A;e[27]!==y||e[28]!==k||e[29]!==j?(A=s.jsx("input",{type:"text",value:y,onChange:k,onFocus:j,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=y,e[28]=k,e[29]=j,e[30]=A):A=e[30];let w;e[31]!==A||e[32]!==h?(w=s.jsxs("label",{className:h,children:[v,A]}),e[31]=A,e[32]=h,e[33]=w):w=e[33];let C;e[34]!==w||e[35]!==p?(C=s.jsx(Lt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,w]})}),e[34]=w,e[35]=p,e[36]=C):C=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(zt,{}),e[37]=E):E=e[37];let N;return e[38]!==C?(N=s.jsxs(Ot,{children:[C,E]}),e[38]=C,e[39]=N):N=e[39],N}function Ga(t){const e=$.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=S.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],As(a.length,c);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=V=>{const{field:i}=V;return l.current=i,s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:U("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(zt,{})]})},e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Jn,{control:n,name:r,render:d}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function Vn(t){const e=$.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Ya,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ha,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ga,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Wa(t){const e=$.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Qa(n.map(el)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(Xa)),e[2]=n,e[3]=c):c=e[3];const d=c;let u;e[4]!==o?(u=(T,R)=>{const O=ys(R);O&&o(T,O)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==d||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:Za,schema:l,defaultValues:d,isStreaming:r,hasAnswer:Ja,onSubmit:u},e[6]=d,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const i=xs(V),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const T=m;if(!T)return;const R=T.toolCallId;T.input?.type==="choice"?(i.form.setValue(`${R}.option`,null),i.form.setValue(`${R}.draft`,"user has skip this question")):i.form.setValue(`${R}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const g=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(ps,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const x=p;let b;e[20]!==g?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:"Skip"}),e[20]=g,e[21]=b):b=e[21];let h;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(h=s.jsx(Na,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=h):h=e[26];let v;e[27]!==b||e[28]!==h?(v=s.jsxs(s.Fragment,{children:[b,h]}),e[27]=b,e[28]=h,e[29]=v):v=e[29];const y=v;if(n.length===1){const T=n[0];if(!T?.input)return null;let R;e[30]!==i?(R=z=>{z.preventDefault(),i.submit()},e[30]=i,e[31]=R):R=e[31];let O;e[32]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(It,{size:14}),e[32]=O):O=e[32];const B=T.input?.prompt??"Question",L=T.input;let q;e[33]!==i.form.control||e[34]!==T.toolCallId||e[35]!==L?(q=s.jsx(Vn,{input:L,control:i.form.control,toolCallId:T.toolCallId}),e[33]=i.form.control,e[34]=T.toolCallId,e[35]=L,e[36]=q):q=e[36];let K;e[37]!==y||e[38]!==B||e[39]!==q?(K=s.jsx(pe,{icon:O,label:"Question pending",title:B,defaultExpanded:!0,footerRight:y,children:q}),e[37]=y,e[38]=B,e[39]=q,e[40]=K):K=e[40];let Q;e[41]!==R||e[42]!==K?(Q=s.jsx("form",{onSubmit:R,autoComplete:"off",children:K}),e[41]=R,e[42]=K,e[43]=Q):Q=e[43];let F;return e[44]!==i.form||e[45]!==Q?(F=s.jsx(_t,{...i.form,children:Q}),e[44]=i.form,e[45]=Q,e[46]=F):F=e[46],F}const k=i.form;let j;e[47]!==i?(j=T=>{T.preventDefault(),i.submit()},e[47]=i,e[48]=j):j=e[48];let A;e[49]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(It,{size:14}),e[49]=A):A=e[49];const w=`${i.currentIndex+1} of ${n.length}`,C=m?.input?.prompt??"Question",E=i.activeKey,N=i.setActiveKey;let D;if(e[50]!==i.form||e[51]!==n){let T;e[53]!==i.form?(T=R=>s.jsx(No,{value:R.toolCallId,className:"mt-0",children:s.jsx(Vn,{input:R.input,control:i.form.control,toolCallId:R.toolCallId})},R.toolCallId),e[53]=i.form,e[54]=T):T=e[54],D=n.map(T),e[50]=i.form,e[51]=n,e[52]=D}else D=e[52];let P;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==D?(P=s.jsx(ko,{value:E,onValueChange:N,children:D}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=D,e[58]=P):P=e[58];let I;e[59]!==x||e[60]!==y||e[61]!==w||e[62]!==C||e[63]!==P?(I=s.jsx(pe,{icon:A,label:"Question pending",count:w,title:C,defaultExpanded:!0,footerLeft:x,footerRight:y,children:P}),e[59]=x,e[60]=y,e[61]=w,e[62]=C,e[63]=P,e[64]=I):I=e[64];let M;e[65]!==j||e[66]!==I?(M=s.jsx("form",{onSubmit:j,autoComplete:"off",children:I}),e[65]=j,e[66]=I,e[67]=M):M=e[67];let _;return e[68]!==i.form||e[69]!==M?(_=s.jsx(_t,{...k,children:M}),e[68]=i.form,e[69]=M,e[70]=_):_=e[70],_}function Ja(t){return!!ys(t)}function Za(t){return t.toolCallId}function Xa(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function el(t){return{toolCallId:t.toolCallId,input:t.input}}function tl(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(It,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function js(t){const e=$.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(nl),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(tl,{}),e[2]=d):d=e[2],d}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Wa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function nl(t){return t.state==="input-available"}function sl(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function rl(){const t=$.c(21),{messages:e}=Re();let n,r,o,a,l,c,d,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=ds(e);if(f.length===0){V=null;break e}const g=sl(f);n=pe,l=s.jsx(il,{status:g.icon}),c=g.activity,d=g.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(ol)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=d,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==u||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:d,defaultExpanded:u,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=d,t[18]=u,t[19]=i,t[20]=m):m=t[20],m}function ol(t,e){return s.jsx(al,{todo:t},e)}function al(t){const e=$.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(ll,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let d;e[2]!==c?(d=U("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=d):d=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==u||e[5]!==V?(i=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==d||e[9]!==i?(m=s.jsxs("span",{className:d,children:[a,i]}),e[7]=a,e[8]=d,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function ll(t){const e=$.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function il(t){const e=$.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const cl={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},dl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function ws(t){const e=$.c(41),{onDismiss:n}=t,{org:r}=de(),o=rt(),{decoKeyId:a}=ts(),l=ns(),[c,d]=S.useState(""),[u,V]=S.useState(!1),[i,m]=S.useState("usd"),f=i==="brl"?"R$":"$";let g,p;e[0]!==r.id?(g=()=>{W("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=g,e[2]=p):(g=e[1],p=e[2]),S.useEffect(g,p);let x;e[3]!==i||e[4]!==l?(x=async T=>{const{url:R}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:T,currency:i});return R},e[3]=i,e[4]=l,e[5]=x):x=e[5];let b;e[6]!==n?(b=T=>{T&&window.open(T,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let h;e[8]!==x||e[9]!==b?(h={mutationFn:x,onSuccess:b,onError:fl},e[8]=x,e[9]=b,e[10]=h):h=e[10];const{mutate:v,isPending:y}=Pt(h),k=parseFloat(c),j=!isNaN(k)&&k>=1;let A;e[11]!==n?(A=T=>!T&&n?.(),e[11]=n,e[12]=A):A=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=w):w=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:w.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=C):C=e[14];let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[C,s.jsxs(lt,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx($t,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=E):E=e[15];let N;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==k||e[20]!==a||e[21]!==j||e[22]!==y||e[23]!==u||e[24]!==v?(N=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Xn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:T=>{T&&m(T)},children:[s.jsx(Xe,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Xe,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:cl[i].map(T=>{const{dollars:R,label:O}=T;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{W("credits_topup_clicked",{amount_cents:R*100,currency:i,tier_label:O,source:"exhausted_banner"}),v(R*100)},className:U("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,R]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:O})]},R)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(es,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:T=>d(T.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!j||y,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(k*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(k*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:dl.map(ul)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=k,e[20]=a,e[21]=j,e[22]=y,e[23]=u,e[24]=v,e[25]=N):N=e[25];let D;e[26]!==n?(D=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=D):D=e[27];let P;e[28]!==o||e[29]!==n||e[30]!==r.slug?(P=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=P):P=e[31];let I;e[32]!==D||e[33]!==P?(I=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[D,P]}),e[32]=D,e[33]=P,e[34]=I):I=e[34];let M;e[35]!==N||e[36]!==I?(M=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Vl,children:[E,N,I]}),e[35]=N,e[36]=I,e[37]=M):M=e[37];let _;return e[38]!==M||e[39]!==A?(_=s.jsx(dt,{open:!0,onOpenChange:A,children:M}),e[38]=M,e[39]=A,e[40]=_):_=e[40],_}function ul(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(qe,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Vl(t){return t.preventDefault()}function fl(t){le.error(`Top-up failed: ${t.message}`)}function ml(){const t=$.c(5),e=ot(),n=ss(),[r,o]=S.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(pe,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=d):d=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[d,s.jsx(Ro,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function pl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const d=c[1]?.trim().replace(/\.$/,"");return{summary:d?`Your sandbox didn't finish starting up (${d}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const hl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function et(t){const e=$.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Wn:Rn,c=o?t.error.message:hl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let d;e[0]!==o||e[1]!==c?(d=o?pl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=d):d=e[2];const{summary:u,rawDetails:V}=d;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(gl).catch(xl)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(bo,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let g;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(g=s.jsx(pe,{icon:i,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=g):g=e[18],g}function xl(){return le.error("Could not copy")}function gl(){return le.success("Copied to clipboard")}function ht(){const t=$.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:d}=Re(),[u,V]=Ee(),{virtualMcpId:i,createTaskWithMessage:m}=Fn(),{chatMode:f,simpleModeTier:g}=he();let p;t[0]!==f||t[1]!==g||t[2]!==i?(p=J=>({tier:g,mode:f,toolApprovalLevel:J,agent:i?{id:i}:void 0}),t[0]=f,t[1]=g,t[2]=i,t[3]=p):p=t[3];const x=p;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??tr(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const h=b,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],k=y.filter(Al),j=Vs(y),A=us(y);let w;t[6]!==e||t[7]!==d?(w=()=>{if(e){const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};d(oe)}},t[6]=e,t[7]=d,t[8]=w):w=t[8];const C=w;let E;t[9]!==d?(E=()=>{d({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=d,t[10]=E):E=t[10];const N=E;let D;t[11]!==x||t[12]!==h||t[13]!==c?(D=(J,oe)=>{c({kind:"toolOutput",toolCallId:J.toolCallId,output:{response:oe}},x(h))},t[11]=x,t[12]=h,t[13]=c,t[14]=D):D=t[14];const P=D;let I;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==i?(I=J=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
2
-
3
- ${J}`}]}})},t[15]=m,t[16]=u,t[17]=V,t[18]=i,t[19]=I):I=t[19];const M=I,_=yl;let T;t[20]!==x||t[21]!==c?(T=(J,oe,ne,ce)=>{c({kind:"approval",approvalId:J,approved:oe,...ne?{reason:ne}:{}},x(ce))},t[20]=x,t[21]=c,t[22]=T):T=t[22];const R=T,O=fs();if(O.isCreditExhausted){let J;return t[23]!==n?(J=s.jsx(ws,{onDismiss:n}),t[23]=n,t[24]=J):J=t[24],J}const{showError:B,showWarning:L,hasApprovals:q}=O,K=k.map(vl).join("|"),Q=j[0]?.toolCallId??"",F=A.map(bl).join("|");let z,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(rl,{}),Y=s.jsx(ml,{}),t[25]=z,t[26]=Y):(z=t[25],Y=t[26]);let H;t[27]!==n||t[28]!==e||t[29]!==C||t[30]!==B?(H=B&&s.jsx(et,{variant:"error",error:e,onDismiss:n,onFixInChat:C}),t[27]=n,t[28]=e,t[29]=C,t[30]=B,t[31]=H):H=t[31];let G;t[32]!==o||t[33]!==r||t[34]!==N||t[35]!==L?(G=L&&s.jsx(et,{variant:"warning",finishReason:r,onDismiss:o,onContinue:N}),t[32]=o,t[33]=r,t[34]=N,t[35]=L,t[36]=G):G=t[36];let X;t[37]!==F||t[38]!==R||t[39]!==q||t[40]!==l||t[41]!==A?(X=q&&s.jsx(Oa,{approvals:A,isStreaming:l,onRespond:R},F),t[37]=F,t[38]=R,t[39]=q,t[40]=l,t[41]=A,t[42]=X):X=t[42];let ee;t[43]!==O.hasPlans||t[44]!==M||t[45]!==_||t[46]!==l||t[47]!==j||t[48]!==Q?(ee=O.hasPlans&&s.jsx(Ba,{plans:j,isStreaming:l,onApprove:M,onDismiss:_},Q),t[43]=O.hasPlans,t[44]=M,t[45]=_,t[46]=l,t[47]=j,t[48]=Q,t[49]=ee):ee=t[49];let te;t[50]!==O.isWaitingForUserInput||t[51]!==P||t[52]!==l||t[53]!==K||t[54]!==k?(te=O.isWaitingForUserInput&&s.jsx(js,{userAskParts:k,isStreaming:l,onSubmit:P},K),t[50]=O.isWaitingForUserInput,t[51]=P,t[52]=l,t[53]=K,t[54]=k,t[55]=te):te=t[55];let se;return t[56]!==G||t[57]!==X||t[58]!==ee||t[59]!==te||t[60]!==H?(se=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[z,Y,H,G,X,ee,te]}),t[56]=G,t[57]=X,t[58]=ee,t[59]=te,t[60]=H,t[61]=se):se=t[61],se}function bl(t){return t.approvalId}function vl(t){return t.toolCallId}function yl(){document.querySelector("[data-chat-input]")?.focus()}function Al(t){return t.type==="tool-user_ask"}ht.Error=function(e){return s.jsx(et,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};ht.Warning=function(e){return s.jsx(et,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};ht.UserAskQuestion=js;function jl(t){const e=$.c(12),{taskId:n}=t,r=$n(n),o=vr(r),a=yr(),{stop:l,removeLocalMessage:c}=Re();if(o.length===0)return null;let d;e[0]!==l?(d=()=>{l()},e[0]=l,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Bn,{size:14}),e[2]=u):u=e[2];let V;e[3]!==d?(V=s.jsx(xe,{asChild:!0,children:s.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",onClick:d,children:u})}),e[3]=d,e[4]=V):V=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ge,{side:"top",children:s.jsx("p",{className:"text-xs",children:"Send now"})}),e[5]=i):i=e[5];let m;e[6]!==V?(m=s.jsxs(be,{delayDuration:400,children:[V,i]}),e[6]=V,e[7]=m):m=e[7];let f;return e[8]!==a||e[9]!==c||e[10]!==n?(f=(g,p)=>s.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[s.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:p+1}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:g.text}),s.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover/queuerow:opacity-100",children:s.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",title:"Remove from queue",onClick:()=>{a.cancel(n,g.messageId).then(x=>{x&&(Ar(n,g.messageId),c(g.messageId))})},children:s.jsx(To,{className:"size-3.5"})})})]},g.messageId),e[8]=a,e[9]=c,e[10]=n,e[11]=f):f=e[11],s.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[s.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:[s.jsxs("span",{children:[o.length," queued message",o.length>1?"s":""]}),m]}),o.map(f)]})}async function wl(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const Ss=["SANDBOX_START"],Qe=new Map,Sl=t=>`${t.virtualMcpId}::${t.branch??""}`,yt=new Set,Cl={mark:(t,e)=>yt.add(`${t}::${e}`),clear:(t,e)=>yt.delete(`${t}::${e}`),isStopped:(t,e)=>yt.has(`${t}::${e}`)};function Nl(t){const e=Ue();return Pt({mutationKey:Ss,mutationFn:async n=>{n.branch&&Cl.clear(n.virtualMcpId,n.branch);const r=Sl(n),o=Qe.get(r);if(o)return o;const a=(async()=>(await wl(t,"SANDBOX_START",n)).structuredContent)();Qe.set(r,a);try{return await a}finally{Qe.get(r)===a&&Qe.delete(r)}},onSuccess:()=>{nr(e)}})}function xu(t,e){const n=$.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:Ss,predicate:a=>{if(!t)return!1;const l=a.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],Zo(r)>0}function kl(){const t=$.c(11),e=ss(),n=sr();let r;t[0]!==e.capabilities||t[1]!==e.online?(r=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=r):r=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==n.runtime.agentSandbox||t[8]!==r||t[9]!==o?(a={agentSandbox:n.runtime.agentSandbox,userDesktop:e.online,claudeCode:r,codex:o},t[6]=e.online,t[7]=n.runtime.agentSandbox,t[8]=r,t[9]=o,t[10]=a):a=t[10],a}const _l={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},Il={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function El(t){return t==="claude-code"?_l:t==="codex"?Il:null}function fn(t,e){return El(t)?.[e]??null}const Rl={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},Tl={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function Dl(t){return Rl[t]}function Cs(t){return t===null?"cloud-decopilot":Tl[t]}function Ns(){const t=$.c(2),{pendingAgentOption:e}=he();let n;return t[0]!==e?(n=Cs(e),t[0]=e,t[1]=n):n=t[1],n}function Pl(){const t=$.c(2),{setPendingAgentOption:e}=he();let n;return t[0]!==e?(n=r=>e(Dl(r)),t[0]=e,t[1]=n):n=t[1],n}function Ml(){return he().simpleModeTier}function Fl(){return he().setSimpleModeTier}const $l={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function Ol(t,e){return t==="local-claude-code"?fn("claude-code",e)?.label??null:t==="local-codex"?fn("codex",e)?.label??null:$l[e]}const Ll={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},zl=ut("").icon;function tt(t){const e=$.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=U(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(Yn,{icon:zl,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const Bl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(tt,{}),isAvailable:t=>t.agentSandbox},Ul={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(tt,{}),isAvailable:t=>t.userDesktop},ql={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(rs,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},Kl={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(os,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},mn=[Bl,Ul,ql,Kl];function Ql(t,e){return t==="claude-code"?"local-claude-code":t==="codex"?"local-codex":e==="user-desktop"?"local-decopilot":"cloud-decopilot"}function Yl({selectedMode:t,lockedHarness:e,lockedSandbox:n,isThreadLocked:r}){if(r&&e!=null){const o=jr(e,n);return o?Cs(o):Ql(e,n)}return t}function ks(t){return t==="local-decopilot"?{icon:s.jsx(tt,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(rs,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(os,{size:14}),text:"Codex"}:{icon:s.jsx(tt,{compact:!0}),text:"Decopilot"}}function Hl(t){const{text:e}=ks(t);return{icon:t==="cloud-decopilot"?s.jsx(uo,{size:14}):s.jsx(Bt,{size:14}),text:e}}function At(t){return t==="cloud-decopilot"?"cloud":"desktop"}const Gl="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Wl="text-success hover:text-success";function Jl(t){const e=$.c(91),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l}=t,[c,d]=S.useState(!1);let u;e[0]!==o||e[1]!==n?(u=o?ks(n):Hl(n),e[0]=o,e[1]=n,e[2]=u):u=e[2];const{icon:V,text:i}=u;let m;e[3]!==n?(m=At(n),e[3]=n,e[4]=m):m=e[4];const f=`${i} on ${m}`,g=n!=="cloud-decopilot",p=a!=null,x=a?Ll[a]:null;let b,h,v,y,k,j,A,w,C,E,N,D,P;if(e[5]!==r||e[6]!==x||e[7]!==V||e[8]!==g||e[9]!==f||e[10]!==o||e[11]!==n||e[12]!==l||e[13]!==c||e[14]!==p||e[15]!==i){let T;e[29]!==r?(T=ne=>ne.group==="cloud"&&ne.isAvailable(r),e[29]=r,e[30]=T):T=e[30];const R=mn.filter(T),O=mn.filter(Zl);let B;e[31]!==l?(B=ne=>{l(ne),d(!1)},e[31]=l,e[32]=B):B=e[32];const L=B;h=Ut,y=c,k=o?void 0:d;let q;e[33]!==x||e[34]!==f||e[35]!==n||e[36]!==p?(q=p&&x?`This chat is using ${x} on ${At(n)}. Start a new chat to use a different runtime.`:f,e[33]=x,e[34]=f,e[35]=n,e[36]=p,e[37]=q):q=e[37];const K=o?"mode-picker-locked":"mode-picker",Q=g&&Wl,F=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let z;e[38]!==Q||e[39]!==F?(z=U(Gl,Q,"shrink min-w-0",F),e[38]=Q,e[39]=F,e[40]=z):z=e[40];const Y=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let H;e[41]!==Y?(H=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",Y),e[41]=Y,e[42]=H):H=e[42];let G;e[43]!==H||e[44]!==i?(G=s.jsx("span",{className:H,children:i}),e[43]=H,e[44]=i,e[45]=G):G=e[45];let X;e[46]!==o?(X=!o&&s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[46]=o,e[47]=X):X=e[47];let ee;e[48]!==V||e[49]!==o||e[50]!==q||e[51]!==K||e[52]!==z||e[53]!==G||e[54]!==X?(ee=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":q,disabled:o,"data-testid":K,className:z,children:[V,G,X]})})})}),e[48]=V,e[49]=o,e[50]=q,e[51]=K,e[52]=z,e[53]=G,e[54]=X,e[55]=ee):ee=e[55];let te;e[56]!==x||e[57]!==f||e[58]!==n||e[59]!==p?(te=p&&x?`This chat is using ${x} on ${At(n)}. Start a new chat to use a different runtime.`:f,e[56]=x,e[57]=f,e[58]=n,e[59]=p,e[60]=te):te=e[60];let se;e[61]!==te?(se=s.jsx(ge,{children:te}),e[61]=te,e[62]=se):se=e[62],e[63]!==ee||e[64]!==se?(j=s.jsxs(be,{children:[ee,se]}),e[63]=ee,e[64]=se,e[65]=j):j=e[65],b=Kt,P="start",v="p-1 w-64",A="menu",w="flex flex-col",C=R.length>0&&s.jsx(pn,{title:"Cloud"});let J;e[66]!==L||e[67]!==n?(J=ne=>s.jsx(hn,{row:ne,active:n===ne.mode,onSelect:L},ne.mode),e[66]=L,e[67]=n,e[68]=J):J=e[68],E=R.map(J),N=O.length>0&&s.jsx(pn,{title:"Local",variant:"success",icon:s.jsx(Bt,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let oe;e[69]!==r||e[70]!==L||e[71]!==n?(oe=ne=>{const ce=ne.isAvailable(r);return s.jsx(hn,{row:ne,active:n===ne.mode,onSelect:L,unavailableHint:ce?void 0:r.userDesktop?"Not detected on your desktop":"Desktop not detected"},ne.mode)},e[69]=r,e[70]=L,e[71]=n,e[72]=oe):oe=e[72],D=O.map(oe),e[5]=r,e[6]=x,e[7]=V,e[8]=g,e[9]=f,e[10]=o,e[11]=n,e[12]=l,e[13]=c,e[14]=p,e[15]=i,e[16]=b,e[17]=h,e[18]=v,e[19]=y,e[20]=k,e[21]=j,e[22]=A,e[23]=w,e[24]=C,e[25]=E,e[26]=N,e[27]=D,e[28]=P}else b=e[16],h=e[17],v=e[18],y=e[19],k=e[20],j=e[21],A=e[22],w=e[23],C=e[24],E=e[25],N=e[26],D=e[27],P=e[28];let I;e[73]!==A||e[74]!==w||e[75]!==C||e[76]!==E||e[77]!==N||e[78]!==D?(I=s.jsxs("div",{role:A,className:w,children:[C,E,N,D]}),e[73]=A,e[74]=w,e[75]=C,e[76]=E,e[77]=N,e[78]=D,e[79]=I):I=e[79];let M;e[80]!==b||e[81]!==v||e[82]!==I||e[83]!==P?(M=s.jsx(b,{align:P,className:v,children:I}),e[80]=b,e[81]=v,e[82]=I,e[83]=P,e[84]=M):M=e[84];let _;return e[85]!==h||e[86]!==y||e[87]!==k||e[88]!==j||e[89]!==M?(_=s.jsxs(h,{open:y,onOpenChange:k,children:[j,M]}),e[85]=h,e[86]=y,e[87]=k,e[88]=j,e[89]=M,e[90]=_):_=e[90],_}function Zl(t){return t.group==="local"}function pn(t){const e=$.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let d;e[0]!==c?(d=U("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==n?(u=s.jsx("span",{children:n}),e[2]=n,e[3]=u):u=e[3];let V;return e[4]!==o||e[5]!==d||e[6]!==u||e[7]!==a?(V=s.jsxs("div",{"data-testid":a,className:d,children:[o,u]}),e[4]=o,e[5]=d,e[6]=u,e[7]=a,e[8]=V):V=e[8],V}function hn(t){const e=$.c(20),{row:n,active:r,onSelect:o,unavailableHint:a}=t;let l;e[0]!==o||e[1]!==n.mode?(l=()=>o(n.mode),e[0]=o,e[1]=n.mode,e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),e[3]=c):c=e[3];let d;e[4]!==n.icon?(d=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[4]=n.icon,e[5]=d):d=e[5];let u;e[6]!==n.label?(u=s.jsx("div",{className:"text-sm",children:n.label}),e[6]=n.label,e[7]=u):u=e[7];const V=a??n.description;let i;e[8]!==V?(i=s.jsx("div",{className:"text-xs text-muted-foreground",children:V}),e[8]=V,e[9]=i):i=e[9];let m;e[10]!==u||e[11]!==i?(m=s.jsxs("div",{className:"flex-1",children:[u,i]}),e[10]=u,e[11]=i,e[12]=m):m=e[12];let f;e[13]!==r?(f=r&&s.jsx(qe,{size:14,className:"text-foreground mt-0.5"}),e[13]=r,e[14]=f):f=e[14];let g;return e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==f?(g=s.jsxs("button",{type:"button",role:"menuitem",onClick:l,className:c,children:[d,m,f]}),e[15]=l,e[16]=d,e[17]=m,e[18]=f,e[19]=g):g=e[19],g}function Xl(t){const e=$.c(19),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=Ns(),l=Pl(),{org:c}=de();let d;e[0]!==c.id||e[1]!==c.slug?(d={connectionId:Zr,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=d):d=e[2];const u=Te(d),V=Nl(u),i=ot(),m=i?.lockedHarness??null,f=i?.lockedSandbox??null,g=i?.isThreadLocked??!1,p=kl();let x;e[3]!==g||e[4]!==m||e[5]!==f||e[6]!==a?(x=Yl({selectedMode:a,lockedHarness:m,lockedSandbox:f,isThreadLocked:g}),e[3]=g,e[4]=m,e[5]=f,e[6]=a,e[7]=x):x=e[7];const b=x;let h;e[8]!==r||e[9]!==l||e[10]!==V||e[11]!==o?(h=k=>{l(k),W("agent_mode_selected",{mode:k}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:k==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[8]=r,e[9]=l,e[10]=V,e[11]=o,e[12]=h):h=e[12];const v=h;let y;return e[13]!==p||e[14]!==v||e[15]!==n||e[16]!==m||e[17]!==b?(y=s.jsx(s.Fragment,{children:s.jsx(Jl,{mode:b,availability:p,locked:n,lockedHarness:m,onSelect:v})}),e[13]=p,e[14]=v,e[15]=n,e[16]=m,e[17]=b,e[18]=y):y=e[18],y}const xn=["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega"],gn=["andromedae","antliae","apodis","aquarii","aquilae","arae","arietis","aurigae","bootis","caeli","camelopardalis","cancri","capricorni","carinae","cassiopeiae","centauri","cephei","ceti","chamaeleontis","circini","columbae","corvi","crateris","crucis","cygni","delphini","doradus","draconis","equulei","eridani","fornacis","geminorum","gruis","herculis","horologii","hydrae","hydri","indi","lacertae","leonis","leporis","librae","lupi","lyncis","lyrae","mensae","microscopii","monocerotis","muscae","normae","octantis","ophiuchi","orionis","pavonis","pegasi","persei","phoenicis","pictoris","piscium","puppis","pyxidis","reticuli","sagittae","sagittarii","scorpii","sculptoris","scuti","serpentis","sextantis","tauri","telescopii","trianguli","tucanae","velorum","virginis","volantis","vulpeculae"];function ei(){const t=xn[Math.floor(Math.random()*xn.length)],e=gn[Math.floor(Math.random()*gn.length)];return`${t}-${e}`}const Ge=100;function ti(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function ni(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function si(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function ri(t){const e=$.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:l,owner:c,repo:d,enabled:u}=t,V=u===void 0?!0:u,i=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==i?(m={connectionId:i,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=i,e[3]=m):m=e[3];const f=Te(m);let g;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==d?(g=rr.githubBranches(n,r,a,c,d),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=d,e[9]=g):g=e[9];const p=V&&!!a&&!!c&&!!d;let x;e[10]!==f||e[11]!==c||e[12]!==d?(x=async L=>{const{pageParam:q,signal:K}=L,Q=Number(q),F=await f.callTool({name:"list_branches",arguments:{owner:c,repo:d,page:Q,perPage:Ge}},void 0,{signal:K}),z=si(F);return{branches:Array.isArray(z)?z:z.branches??[],default_branch:Array.isArray(z)?null:z.default_branch??null,page:Q}},e[10]=f,e[11]=c,e[12]=d,e[13]=x):x=e[13];let b;e[14]!==g||e[15]!==p||e[16]!==x?(b={queryKey:g,enabled:p,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:x,getNextPageParam:di},e[14]=g,e[15]=p,e[16]=x,e[17]=b):b=e[17];const{data:h,isLoading:v,isError:y,hasNextPage:k,isFetchingNextPage:j,fetchNextPage:A}=Bo(b);let w,C;e[18]!==l||e[19]!==o?(C=new Set(Object.keys(l?.[o]??{})),w=[...C].sort().map(ci),e[18]=l,e[19]=o,e[20]=w,e[21]=C):(w=e[20],C=e[21]);const E=w;let N;if(e[22]!==h?.pages){const L=new Map;for(const K of h?.pages??[])for(const Q of K.branches)typeof Q.name=="string"&&L.set(Q.name,Q);N=[...L.values()].filter(ii),e[22]=h?.pages,e[23]=N}else N=e[23];let D;e[24]!==N||e[25]!==C?(D=N.filter(L=>!C.has(L.name)).map(li),e[24]=N,e[25]=C,e[26]=D):D=e[26];const P=D;let I;e[27]!==h?.pages?(I=h?.pages.find(ai)?.default_branch??null,e[27]=h?.pages,e[28]=I):I=e[28];const M=I;let _;e[29]!==h?.pages||e[30]!==A||e[31]!==j||e[32]!==C?(_=async(L,q)=>{const K=q===void 0?oi:q;if(!K()||ni(C,L)||j)return;let Q=h?.pages??[];for(;K()&&!ti(Q,L,C)&&(Q.at(-1)?.branches.length??Ge)>=Ge;){const F=await A();if(!K())break;const z=F.data?.pages??Q;if(z.length===Q.length)break;Q=z}},e[29]=h?.pages,e[30]=A,e[31]=j,e[32]=C,e[33]=_):_=e[33];const T=_,R=k??!1;let O;e[34]!==A||e[35]!==k||e[36]!==j?(O=()=>{k&&!j&&A()},e[34]=A,e[35]=k,e[36]=j,e[37]=O):O=e[37];let B;return e[38]!==M||e[39]!==T||e[40]!==y||e[41]!==j||e[42]!==v||e[43]!==P||e[44]!==R||e[45]!==O||e[46]!==E?(B={yours:E,others:P,defaultBase:M,isLoading:v,isError:y,hasMore:R,isFetchingMore:j,fetchMore:O,fetchUntilMatch:T},e[38]=M,e[39]=T,e[40]=y,e[41]=j,e[42]=v,e[43]=P,e[44]=R,e[45]=O,e[46]=E,e[47]=B):B=e[47],B}function oi(){return!0}function ai(t){return t.default_branch}function li(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function ii(t){return typeof t.name=="string"}function ci(t){return{name:t,source:"yours"}}function di(t){if(!(t.branches.length<Ge))return t.page+1}function ui(t){const e=$.c(84),{orgId:n,orgSlug:r,userId:o,connectionId:a,owner:l,repo:c,sandboxMap:d,value:u,onChange:V,disabled:i,placement:m}=t,f=i===void 0?!1:i,p=(m===void 0?"chat":m)==="header",[x,b]=S.useState(!1),[h,v]=S.useState(""),[y,k]=S.useState(!1),j=S.useRef(0);let A;e[0]!==a||e[1]!==x||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==o?(A={orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:d,owner:l,repo:c,enabled:x},e[0]=a,e[1]=x,e[2]=n,e[3]=r,e[4]=l,e[5]=c,e[6]=d,e[7]=o,e[8]=A):A=e[8];const{yours:w,others:C,isLoading:E,isError:N,hasMore:D,isFetchingMore:P,fetchMore:I,fetchUntilMatch:M}=ri(A);let _;e[9]!==V?(_=ae=>{V(ae),b(!1)},e[9]=V,e[10]=_):_=e[10];const T=_,R=u??"Select branch…";let O;e[11]!==M?(O=ae=>{v(ae),j.current=j.current+1;const Ne=j.current,xt=ae.trim();if(!xt){k(!1);return}k(!0),M(xt,()=>Ne===j.current).finally(()=>{Ne===j.current&&k(!1)})},e[11]=M,e[12]=O):O=e[12];const B=O;let L;e[13]!==I?(L=ae=>{const Ne=ae.currentTarget;Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight<48&&I()},e[13]=I,e[14]=L):L=e[14];const q=L,K=f?void 0:b,Q=p?"outline":"ghost",F=p?"sm":"default";let z;e[15]!==f||e[16]!==p?(z=U("font-mono shrink min-w-0 max-w-[200px]",p?"gap-1.5 text-xs":U("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",f?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=f,e[16]=p,e[17]=z):z=e[17];let Y;e[18]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=Y):Y=e[18];const H=p?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let G;e[19]!==H?(G=U("min-w-0 truncate",H),e[19]=H,e[20]=G):G=e[20];let X;e[21]!==R||e[22]!==G?(X=s.jsx("span",{className:G,children:R}),e[21]=R,e[22]=G,e[23]=X):X=e[23];let ee;e[24]!==f||e[25]!==p?(ee=!f&&s.jsx(ft,{size:12,className:U("opacity-60 shrink-0",p?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=f,e[25]=p,e[26]=ee):ee=e[26];let te;e[27]!==f||e[28]!==R||e[29]!==z||e[30]!==X||e[31]!==ee||e[32]!==Q||e[33]!==F?(te=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{variant:Q,size:F,"aria-label":R,disabled:f,className:z,children:[Y,X,ee]})})})}),e[27]=f,e[28]=R,e[29]=z,e[30]=X,e[31]=ee,e[32]=Q,e[33]=F,e[34]=te):te=e[34];let se;e[35]!==R?(se=s.jsx(ge,{children:R}),e[35]=R,e[36]=se):se=e[36];let J;e[37]!==te||e[38]!==se?(J=s.jsxs(be,{children:[te,se]}),e[37]=te,e[38]=se,e[39]=J):J=e[39];let oe;e[40]!==B||e[41]!==h?(oe=s.jsx($o,{placeholder:"Search loaded branches…",value:h,onValueChange:B}),e[40]=B,e[41]=h,e[42]=oe):oe=e[42];let ne;e[43]!==T?(ne=s.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>T(ei()),children:"New"}),e[43]=T,e[44]=ne):ne=e[44];let ce;e[45]!==oe||e[46]!==ne?(ce=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[oe,ne]}),e[45]=oe,e[46]=ne,e[47]=ce):ce=e[47];let Ve;e[48]!==N?(Ve=N&&s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[48]=N,e[49]=Ve):Ve=e[49];let Z;e[50]!==D||e[51]!==N||e[52]!==E?(Z=!N&&!E&&s.jsx(Oo,{children:D?"Looking through more branches...":"No branches found."}),e[50]=D,e[51]=N,e[52]=E,e[53]=Z):Z=e[53];let ie;e[54]!==T||e[55]!==w?(ie=w.length>0&&s.jsx(Xt,{heading:"Your branches",children:w.map(ae=>s.jsxs(en,{value:ae.name,onSelect:()=>T(ae.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name})]},ae.name))}),e[54]=T,e[55]=w,e[56]=ie):ie=e[56];let Ae;e[57]!==C||e[58]!==T?(Ae=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Fo,{}),s.jsx(Xt,{heading:"Other branches in repo",children:C.map(ae=>s.jsxs(en,{value:ae.name,onSelect:()=>T(ae.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name}),ae.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",ae.author]})]},ae.name))})]}),e[57]=C,e[58]=T,e[59]=Ae):Ae=e[59];let je;e[60]!==I||e[61]!==D||e[62]!==P||e[63]!==y?(je=D&&s.jsx("div",{className:"border-t p-2",children:s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:P,onClick:I,children:P||y?"Loading more…":"Load more branches"})}),e[60]=I,e[61]=D,e[62]=P,e[63]=y,e[64]=je):je=e[64];let we;e[65]!==D||e[66]!==C.length?(we=!D&&C.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[65]=D,e[66]=C.length,e[67]=we):we=e[67];let Se;e[68]!==q||e[69]!==Ve||e[70]!==Z||e[71]!==ie||e[72]!==Ae||e[73]!==je||e[74]!==we?(Se=s.jsxs(Lo,{onScroll:q,children:[Ve,Z,ie,Ae,je,we]}),e[68]=q,e[69]=Ve,e[70]=Z,e[71]=ie,e[72]=Ae,e[73]=je,e[74]=we,e[75]=Se):Se=e[75];let Ce;e[76]!==ce||e[77]!==Se?(Ce=s.jsx(Kt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(zo,{children:[ce,Se]})}),e[76]=ce,e[77]=Se,e[78]=Ce):Ce=e[78];let Ke;return e[79]!==x||e[80]!==J||e[81]!==Ce||e[82]!==K?(Ke=s.jsxs(Ut,{open:x,onOpenChange:K,children:[J,Ce]}),e[79]=x,e[80]=J,e[81]=Ce,e[82]=K,e[83]=Ke):Ke=e[83],Ke}function Vi(t){const e=$.c(25);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const l=r==="header";if(n){const d=a??"(no branch)",u=l?"h-8 gap-1.5 border border-input bg-background px-2.5":"h-9 gap-0 px-2";let V;e[5]!==u?(V=U("inline-flex items-center rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",u),e[5]=u,e[6]=V):V=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=i):i=e[7];const m=l?"":"max-w-0 opacity-0";let f;e[8]!==m?(f=U("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let g;e[10]!==d||e[11]!==f?(g=s.jsx("span",{className:f,children:d}),e[10]=d,e[11]=f,e[12]=g):g=e[12];let p;e[13]!==V||e[14]!==g?(p=s.jsx(xe,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:V,children:[i,g]})}),e[13]=V,e[14]=g,e[15]=p):p=e[15];let x;e[16]!==d?(x=s.jsxs(ge,{children:["This chat is using branch ",d,". Start a new chat to use a different branch."]}),e[16]=d,e[17]=x):x=e[17];let b;return e[18]!==p||e[19]!==x?(b=s.jsxs(be,{children:[p,x]}),e[18]=p,e[19]=x,e[20]=b):b=e[20],b}let c;return e[21]!==r||e[22]!==o||e[23]!==a?(c=s.jsx(ui,{...o,value:a,placement:r}),e[21]=r,e[22]=o,e[23]=a,e[24]=c):c=e[24],c}function fi(t){const e=$.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function mi(t){const e=$.c(22),{virtualMcp:n,currentBranch:r}=t,o=On(),a=ot();let l;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(l=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=l):l=e[2];const c=l,d=a?.setCurrentTaskBranch;let u;e[3]!==n?(u=_o(n),e[3]=n,e[4]=u):u=e[4];const V=u,i=V?.connectionId,{data:m}=Tn.useSession(),f=m?.user?.id??"",{org:g}=de();let p;e[5]!==i||e[6]!==r||e[7]!==V||e[8]!==c||e[9]!==g||e[10]!==d||e[11]!==f||e[12]!==n?.id||e[13]!==n?.metadata?.sandboxMap?(p=V&&i?s.jsx(Vi,{orgId:g.id,orgSlug:g.slug,userId:f,virtualMcpId:n?.id??"",connectionId:i,owner:V.owner,repo:V.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:k=>{d&&d(k)},locked:c,placement:"chat"}):null,e[5]=i,e[6]=r,e[7]=V,e[8]=c,e[9]=g,e[10]=d,e[11]=f,e[12]=n?.id,e[13]=n?.metadata?.sandboxMap,e[14]=p):p=e[14];const x=p,b=n?.id??"";let h;e[15]!==r||e[16]!==c||e[17]!==b?(h=s.jsx(Xl,{locked:c,currentBranch:r,virtualMcpId:b}),e[15]=r,e[16]=c,e[17]=b,e[18]=h):h=e[18];const v=h;let y;return e[19]!==x||e[20]!==v?(y=s.jsx(fi,{branchPill:x,modePicker:v}),e[19]=x,e[20]=v,e[21]=y):y=e[21],y}const pi=["fast","smart","thinking"],De={fast:"Fast",smart:"Smart",thinking:"Thinking"};function hi(t){const e=$.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[l,c]=S.useState(!1);let d;e[0]!==a?(d=w=>{a(w),c(!1)},e[0]=a,e[1]=d):d=e[1];const u=d,V=De[n];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=i):i=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const g=De[n];let p;e[7]!==g?(p=s.jsx("span",{className:f,children:g}),e[7]=g,e[8]=p):p=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=x):x=e[9];let b;e[10]!==V||e[11]!==m||e[12]!==p?(b=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(qt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":V,className:i,children:[m,p,x]})})})}),e[10]=V,e[11]=m,e[12]=p,e[13]=b):b=e[13];const h=De[n];let v;e[14]!==h?(v=s.jsx(ge,{children:h}),e[14]=h,e[15]=v):v=e[15];let y;e[16]!==v||e[17]!==b?(y=s.jsxs(be,{children:[b,v]}),e[16]=v,e[17]=b,e[18]=y):y=e[18];let k;e[19]!==u||e[20]!==o||e[21]!==r||e[22]!==n?(k=pi.map(w=>{const C=r(w),E=o?.(w),N=w===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":De[w],onClick:()=>u(w),className:U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[E&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:E}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:De[w]}),C&&s.jsx("div",{className:"text-xs text-muted-foreground",children:C})]}),N&&s.jsx(qe,{size:14,className:"text-foreground mt-0.5"})]},w)}),e[19]=u,e[20]=o,e[21]=r,e[22]=n,e[23]=k):k=e[23];let j;e[24]!==k?(j=s.jsx(Kt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:k})}),e[24]=k,e[25]=j):j=e[25];let A;return e[26]!==l||e[27]!==y||e[28]!==j?(A=s.jsxs(Ut,{open:l,onOpenChange:c,children:[y,j]}),e[26]=l,e[27]=y,e[28]=j,e[29]=A):A=e[29],A}function xi(t){return t==="fast"?s.jsx(Vo,{size:16}):t==="thinking"?s.jsx(fo,{size:16}):s.jsx(Uo,{size:16})}function gi(){const t=$.c(6),e=Ml(),n=Fl(),r=Ns();let o;t[0]!==r?(o=c=>Ol(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let l;return t[2]!==n||t[3]!==a||t[4]!==e?(l=s.jsx(hi,{tier:e,subtitleFor:a,iconFor:xi,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Yt(t,e,n,r,o){if(!pt(e)){le.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!Do(a,e)){const c=as(e),d=e?.title??"This model";o?o({fileName:n.name,modelName:d,accepted:c}):le.error(`"${n.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const l=10*1024*1024;if(n.size>l){le.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((i,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const g=f.includes(",")?f.split(",")[1]??f:f;i(g)},c.onerror=m});c.readAsDataURL(n);const u=await d,V={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:u};Ir(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),le.error(`Failed to load file "${n.name}"`)}}function bi(t){const e=$.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=S.useRef(yi);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(V,i)=>{await Yt(n,r,V,i,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=l,e[4]=c):(l=e[3],c=e[4]),S.useEffect(l,c);let d,u;return e[5]!==n?(d=()=>{if(n?.isDestroyed)return;const V=new Ze("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new zn({key:V,props:{handleDrop:(f,g,p,x)=>{if(x)return!1;const b=g.dataTransfer?.files;if(!b||b.length===0)return!1;g.preventDefault();const h=f.posAtCoords({left:g.clientX,top:g.clientY});if(!h)return!1;const v=Array.from(b),y=h.pos;for(const k of v)a.current?.(k,y);return!0},handlePaste:(f,g)=>{const p=g.clipboardData?.items;if(!p)return!1;const x=Array.from(p).filter(vi);if(x.length===0)return!1;g.preventDefault();const{from:b}=f.state.selection;for(const h of x){const v=h.getAsFile();v&&a.current?.(v,b)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(V)}},u=[n],e[5]=n,e[6]=d,e[7]=u):(d=e[6],u=e[7]),S.useEffect(d,u),null}function vi(t){return t.kind==="file"}function yi(){return Promise.resolve()}function Ai(t){const e=$.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=k=>!k&&r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(Rn,{size:18})}),u=s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]);const V=n?.fileName;let i;e[6]!==V?(i=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(lt,{className:"relative gap-4",children:[d,s.jsxs("div",{children:[u,s.jsxs($t,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=i):i=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(mo,{size:14,className:"text-muted-foreground"}),e[10]=g):g=e[10];const p=n?.accepted;let x;e[11]!==p?(x=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[g,s.jsx("span",{className:"capitalize",children:p})]}),e[11]=p,e[12]=x):x=e[12];let b;e[13]!==f||e[14]!==x?(b=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,x]})}),e[13]=f,e[14]=x,e[15]=b):b=e[15];let h;e[16]!==r?(h=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(re,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=h):h=e[17];let v;e[18]!==b||e[19]!==h||e[20]!==i?(v=s.jsxs(ct,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ji,children:[i,b,h]}),e[18]=b,e[19]=h,e[20]=i,e[21]=v):v=e[21];let y;return e[22]!==o||e[23]!==v||e[24]!==a?(y=s.jsx(dt,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=y):y=e[25],y}function ji(t){return t.preventDefault()}function wi(){const t=$.c(3),[e,n]=S.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var Si=Er;var Ci=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Et=Ci.join(","),_s=typeof Element>"u",ze=_s?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nt=!_s&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},st=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",l=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):st(e.parentNode));return l},Ni=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},ki=function(e,n,r){if(st(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Et));return n&&ze.call(e,Et)&&o.unshift(e),o=o.filter(r),o},Rt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!st(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),d=c.length?c:l.children,u=Rt(d,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{var V=ze.call(l,Et);V&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var i=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!st(i,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(i&&m){var f=Rt(i===!0?l.children:i.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else a.unshift.apply(a,l.children)}}return o},Is=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Es=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Ni(e))&&!Is(e)?0:e.tabIndex},_i=function(e,n){var r=Es(e);return r<0&&n&&!Is(e)?0:r},Ii=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Rs=function(e){return e.tagName==="INPUT"},Ei=function(e){return Rs(e)&&e.type==="hidden"},Ri=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Ti=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},Di=function(e){if(!e.name)return!0;var n=e.form||nt(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var a=Ti(o,e.form);return!a||a===e},Pi=function(e){return Rs(e)&&e.type==="radio"},Mi=function(e){return Pi(e)&&!Di(e)},Fi=function(e){var n,r=e&&nt(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var l,c,d;for(a=!!((l=o)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(d=e.ownerDocument)!==null&&d!==void 0&&d.contains(e));!a&&o;){var u,V,i;r=nt(o),o=(u=r)===null||u===void 0?void 0:u.host,a=!!((V=o)!==null&&V!==void 0&&(i=V.ownerDocument)!==null&&i!==void 0&&i.contains(o))}}return a},bn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},$i=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var l=ze.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(ze.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var u=e.parentElement,V=nt(e);if(u&&!u.shadowRoot&&o(u)===!0)return bn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=d}if(Fi(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bn(e);return!1},Oi=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return ze.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Li=function(e,n){return!(n.disabled||Ei(n)||$i(n,e)||Ri(n)||Oi(n))},vn=function(e,n){return!(Mi(n)||Es(n)<0||!Li(e,n))},zi=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ts=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,d=_i(c,l),u=l?Ts(o.candidates):c;d===0?l?n.push.apply(n,u):n.push(c):r.push({documentOrder:a,tabIndex:d,item:o,isScope:l,content:u})}),r.sort(Ii).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},Ds=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Rt([e],n.includeContainer,{filter:vn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:zi}):r=ki(e,n.includeContainer,vn.bind(null,n)),Ts(r)};function Bi(){return/apple/i.test(navigator.vendor)}const yn="data-floating-ui-focusable";function Ui(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Tt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&or(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Pe(t){return"composedPath"in t?t.composedPath()[0]:t.target}function jt(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function qi(t){return t.matches("html,body")}function Be(t){return t?.ownerDocument||document}function Ki(t){return t?t.hasAttribute(yn)?t:t.querySelector("["+yn+"]")||t:null}function We(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...We(t,o.id,n)])}function Qi(t){return"nativeEvent"in t}var Yi=typeof document<"u",Hi=function(){},ve=Yi?S.useLayoutEffect:Hi;const Gi={...Dn},Wi=Gi.useInsertionEffect,Ji=Wi||(t=>t());function _e(t){const e=S.useRef(()=>{});return Ji(()=>{e.current=t}),S.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Ps=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ms(t,e){const n=Ds(t,Ps()),r=n.length;if(r===0)return;const o=Ui(Be(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function Zi(t){return Ms(Be(t).body,1)||t}function Xi(t){return Ms(Be(t).body,-1)||t}function wt(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Tt(n,r)}function ec(t){Ds(t,Ps()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function An(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const tc="data-floating-ui-focusable",jn="active",wn="selected",nc={...Dn};let Sn=!1,sc=0;const Cn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+sc++;function rc(){const[t,e]=S.useState(()=>Sn?Cn():void 0);return ve(()=>{t==null&&e(Cn())},[]),S.useEffect(()=>{Sn=!0},[]),t}const oc=nc.useId,Ht=oc||rc;function ac(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const lc=S.createContext(null),ic=S.createContext(null),Fs=()=>{var t;return((t=S.useContext(lc))==null?void 0:t.id)||null},$s=()=>S.useContext(ic);function Gt(t){return"data-floating-ui-"+t}const cc={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Nn=S.forwardRef(function(e,n){const[r,o]=S.useState();ve(()=>{Bi()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Gt("focus-guard")]:"",style:cc};return s.jsx("span",{...e,...a})}),dc={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Os=S.createContext(null),kn=Gt("portal");function uc(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Ht(),o=fc(),[a,l]=S.useState(null),c=S.useRef(null);return ve(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),ve(()=>{if(!r||c.current)return;const d=e?document.getElementById(e):null;if(!d)return;const u=document.createElement("div");u.id=r,u.setAttribute(kn,""),d.appendChild(u),c.current=u,l(u)},[e,r]),ve(()=>{if(n===null||!r||c.current)return;let d=n||o?.portalNode;d&&!Vr(d)&&(d=d.current),d=d||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,d.appendChild(u));const V=document.createElement("div");V.id=r,V.setAttribute(kn,""),d=u||d,d.appendChild(V),c.current=V,l(V)},[e,n,r,o]),a}function Vc(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=uc({id:n,root:r}),[l,c]=S.useState(null),d=S.useRef(null),u=S.useRef(null),V=S.useRef(null),i=S.useRef(null),m=l?.modal,f=l?.open,g=!!l&&!l.modal&&l.open&&o&&!!(r||a);return S.useEffect(()=>{if(!a||!o||m)return;function p(x){a&&wt(x)&&(x.type==="focusin"?An:ec)(a)}return a.addEventListener("focusin",p,!0),a.addEventListener("focusout",p,!0),()=>{a.removeEventListener("focusin",p,!0),a.removeEventListener("focusout",p,!0)}},[a,o,m]),S.useEffect(()=>{a&&(f||An(a))},[f,a]),s.jsxs(Os.Provider,{value:S.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:d,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:i,portalNode:a,setFocusManagerState:c}),[o,a]),children:[g&&a&&s.jsx(Nn,{"data-type":"outside",ref:d,onFocus:p=>{if(wt(p,a)){var x;(x=V.current)==null||x.focus()}else{const b=l?l.domReference:null,h=Xi(b);h?.focus()}}}),g&&a&&s.jsx("span",{"aria-owns":a.id,style:dc}),a&&lr.createPortal(e,a),g&&a&&s.jsx(Nn,{"data-type":"outside",ref:u,onFocus:p=>{if(wt(p,a)){var x;(x=i.current)==null||x.focus()}else{const b=l?l.domReference:null,h=Zi(b);h?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,p.nativeEvent,"focus-out")}}})]})}const fc=()=>S.useContext(Os),mc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},pc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},_n=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function hc(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:l=!0,escapeKey:c=!0,outsidePress:d=!0,outsidePressEvent:u="pointerdown",referencePress:V=!1,referencePressEvent:i="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:g}=e,p=$s(),x=_e(typeof d=="function"?d:()=>!1),b=typeof d=="function"?x:d,h=S.useRef(!1),{escapeKey:v,outsidePress:y}=_n(f),{escapeKey:k,outsidePress:j}=_n(g),A=S.useRef(!1),w=_e(I=>{var M;if(!n||!l||!c||I.key!=="Escape"||A.current)return;const _=(M=a.current.floatingContext)==null?void 0:M.nodeId,T=p?We(p.nodesRef.current,_):[];if(!v&&(I.stopPropagation(),T.length>0)){let R=!0;if(T.forEach(O=>{var B;if((B=O.context)!=null&&B.open&&!O.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}r(!1,Qi(I)?I.nativeEvent:I,"escape-key")}),C=_e(I=>{var M;const _=()=>{var T;w(I),(T=Pe(I))==null||T.removeEventListener("keydown",_)};(M=Pe(I))==null||M.addEventListener("keydown",_)}),E=_e(I=>{var M;const _=a.current.insideReactTree;a.current.insideReactTree=!1;const T=h.current;if(h.current=!1,u==="click"&&T||_||typeof b=="function"&&!b(I))return;const R=Pe(I),O="["+Gt("inert")+"]",B=Be(o.floating).querySelectorAll(O);let L=ue(R)?R:null;for(;L&&!bt(L);){const F=cr(L);if(bt(F)||!ue(F))break;L=F}if(B.length&&ue(R)&&!qi(R)&&!Tt(R,o.floating)&&Array.from(B).every(F=>!Tt(L,F)))return;if(dr(R)&&P){const F=bt(R),z=ur(R),Y=/auto|scroll/,H=F||Y.test(z.overflowX),G=F||Y.test(z.overflowY),X=H&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,ee=G&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,te=z.direction==="rtl",se=ee&&(te?I.offsetX<=R.offsetWidth-R.clientWidth:I.offsetX>R.clientWidth),J=X&&I.offsetY>R.clientHeight;if(se||J)return}const q=(M=a.current.floatingContext)==null?void 0:M.nodeId,K=p&&We(p.nodesRef.current,q).some(F=>{var z;return jt(I,(z=F.context)==null?void 0:z.elements.floating)});if(jt(I,o.floating)||jt(I,o.domReference)||K)return;const Q=p?We(p.nodesRef.current,q):[];if(Q.length>0){let F=!0;if(Q.forEach(z=>{var Y;if((Y=z.context)!=null&&Y.open&&!z.context.dataRef.current.__outsidePressBubbles){F=!1;return}}),!F)return}r(!1,I,"outside-press")}),N=_e(I=>{var M;const _=()=>{var T;E(I),(T=Pe(I))==null||T.removeEventListener(u,_)};(M=Pe(I))==null||M.addEventListener(u,_)});S.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=y;let I=-1;function M(B){r(!1,B,"ancestor-scroll")}function _(){window.clearTimeout(I),A.current=!0}function T(){I=window.setTimeout(()=>{A.current=!1},ir()?5:0)}const R=Be(o.floating);c&&(R.addEventListener("keydown",k?C:w,k),R.addEventListener("compositionstart",_),R.addEventListener("compositionend",T)),b&&R.addEventListener(u,j?N:E,j);let O=[];return m&&(ue(o.domReference)&&(O=gt(o.domReference)),ue(o.floating)&&(O=O.concat(gt(o.floating))),!ue(o.reference)&&o.reference&&o.reference.contextElement&&(O=O.concat(gt(o.reference.contextElement)))),O=O.filter(B=>{var L;return B!==((L=R.defaultView)==null?void 0:L.visualViewport)}),O.forEach(B=>{B.addEventListener("scroll",M,{passive:!0})}),()=>{c&&(R.removeEventListener("keydown",k?C:w,k),R.removeEventListener("compositionstart",_),R.removeEventListener("compositionend",T)),b&&R.removeEventListener(u,j?N:E,j),O.forEach(B=>{B.removeEventListener("scroll",M)}),window.clearTimeout(I)}},[a,o,c,b,u,n,r,m,l,v,y,w,k,C,E,j,N]),S.useEffect(()=>{a.current.insideReactTree=!1},[a,b,u]);const D=S.useMemo(()=>({onKeyDown:w,...V&&{[mc[i]]:I=>{r(!1,I.nativeEvent,"reference-press")},...i!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[w,r,V,i]),P=S.useMemo(()=>{function I(M){M.button===0&&(h.current=!0)}return{onKeyDown:w,onMouseDown:I,onMouseUp:I,[pc[u]]:()=>{a.current.insideReactTree=!0}}},[w,u,a]);return S.useMemo(()=>l?{reference:D,floating:P}:{},[l,D,P])}function xc(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Ht(),a=S.useRef({}),[l]=S.useState(()=>ac()),c=Fs()!=null,[d,u]=S.useState(r.reference),V=_e((f,g,p)=>{a.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:p,nested:c}),n?.(f,g,p)}),i=S.useMemo(()=>({setPositionReference:u}),[]),m=S.useMemo(()=>({reference:d||r.reference||null,floating:r.floating||null,domReference:r.reference}),[d,r.reference,r.floating]);return S.useMemo(()=>({dataRef:a,open:e,onOpenChange:V,elements:m,events:l,floatingId:o,refs:i}),[e,V,m,l,o,i])}function gc(t){t===void 0&&(t={});const{nodeId:e}=t,n=xc({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,l]=S.useState(null),[c,d]=S.useState(null),V=o?.domReference||a,i=S.useRef(null),m=$s();ve(()=>{V&&(i.current=V)},[V]);const f=ar({...t,elements:{...o,...c&&{reference:c}}}),g=S.useCallback(v=>{const y=ue(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;d(y),f.refs.setReference(y)},[f.refs]),p=S.useCallback(v=>{(ue(v)||v===null)&&(i.current=v,l(v)),(ue(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!ue(v))&&f.refs.setReference(v)},[f.refs]),x=S.useMemo(()=>({...f.refs,setReference:p,setPositionReference:g,domReference:i}),[f.refs,p,g]),b=S.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),h=S.useMemo(()=>({...f,...r,refs:x,elements:b,nodeId:e}),[f,x,b,e,r]);return ve(()=>{r.dataRef.current.floatingContext=h;const v=m?.nodesRef.current.find(y=>y.id===e);v&&(v.context=h)}),S.useMemo(()=>({...f,context:h,refs:x,elements:b}),[f,x,b,h])}function St(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[jn]:l,[wn]:c,...d}=t;a=d}return{...n==="floating"&&{tabIndex:-1,[tc]:""},...a,...e.map(l=>{const c=l?l[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((l,c)=>(c&&Object.entries(c).forEach(d=>{let[u,V]=d;if(!(o&&[jn,wn].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof V=="function"){var i;(i=r.get(u))==null||i.push(V),l[u]=function(){for(var m,f=arguments.length,g=new Array(f),p=0;p<f;p++)g[p]=arguments[p];return(m=r.get(u))==null?void 0:m.map(x=>x(...g)).find(x=>x!==void 0)}}}else l[u]=V}),l),{})}}function bc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=S.useCallback(c=>St(c,t,"reference"),e),a=S.useCallback(c=>St(c,t,"floating"),n),l=S.useCallback(c=>St(c,t,"item"),r);return S.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const vc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function yc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:l}=t,{enabled:c=!0,role:d="dialog"}=e,u=Ht(),V=((n=a.domReference)==null?void 0:n.id)||u,i=S.useMemo(()=>{var h;return((h=Ki(a.floating))==null?void 0:h.id)||l},[a.floating,l]),m=(r=vc.get(d))!=null?r:d,g=Fs()!=null,p=S.useMemo(()=>m==="tooltip"||d==="label"?{["aria-"+(d==="label"?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?i:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&g&&{role:"menuitem"},...d==="select"&&{"aria-autocomplete":"none"},...d==="combobox"&&{"aria-autocomplete":"list"}},[m,i,g,o,V,d]),x=S.useMemo(()=>{const h={id:i,...m&&{role:m}};return m==="tooltip"||d==="label"?h:{...h,...m==="menu"&&{"aria-labelledby":V}}},[m,i,V,d]),b=S.useCallback(h=>{let{active:v,selected:y}=h;const k={role:"option",...v&&{id:i+"-fui-option"}};switch(d){case"select":case"combobox":return{...k,"aria-selected":y}}return{}},[i,d]);return S.useMemo(()=>c?{reference:p,floating:x,item:b}:{},[c,p,x,b])}function Ac(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:c}=t,d=r&&!o,u=Dr(n),V=new RegExp(`\\s${u}$`),i=l?"^":"",m=o?"":u,f=d?new RegExp(`${i}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${i}(?:^)?${u}[^\\s${m}]*`,"gm"),g=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!g)return null;const p=c.pos-g.length,x=Array.from(g.matchAll(f)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),h=new RegExp(`^[${a?.join("")}\0]?$`).test(b);if(a!==null&&!h)return null;const v=p+x.index;let y=v+x[0].length;return d&&V.test(g.slice(y-1,y+1))&&(x[0]+=" ",y+=1),v<c.pos&&y>=c.pos?{range:{from:v,to:y},query:x[0].slice(n.length),text:x[0]}:null}var jc=new Ze("suggestion");function wc({pluginKey:t=jc,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:a=[" "],startOfLine:l=!1,decorationTag:c="span",decorationClass:d="suggestion",decorationContent:u="",decorationEmptyClass:V="is-empty",command:i=()=>null,items:m=()=>[],render:f=()=>({}),allow:g=()=>!0,findSuggestionMatch:p=Ac,shouldShow:x}){let b;const h=f?.(),v=()=>{const A=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(A),{top:C,right:E,bottom:N,left:D}=w;try{return new DOMRect(D,C,E-D,N-C)}catch{return null}},y=(A,w)=>w?()=>{const C=t.getState(e.state),E=C?.decorationId,N=A.dom.querySelector(`[data-decoration-id="${E}"]`);return N?.getBoundingClientRect()||null}:v;function k(A,w){var C;try{const N=t.getState(A.state),D=N?.decorationId?A.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,P={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:I=>i({editor:e,range:N?.range||{from:0,to:0},props:I}),decorationNode:D,clientRect:y(A,D)};(C=h?.onExit)==null||C.call(h,P)}catch{}const E=A.state.tr.setMeta(w,{exit:!0});A.dispatch(E)}const j=new zn({key:t,view(){return{update:async(A,w)=>{var C,E,N,D,P,I,M;const _=(C=this.key)==null?void 0:C.getState(w),T=(E=this.key)==null?void 0:E.getState(A.state),R=_.active&&T.active&&_.range.from!==T.range.from,O=!_.active&&T.active,B=_.active&&!T.active,L=!O&&!B&&_.query!==T.query,q=O||R&&L,K=L||R,Q=B||R&&L;if(!q&&!K&&!Q)return;const F=Q&&!q?_:T,z=A.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);b={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Y=>i({editor:e,range:F.range,props:Y}),decorationNode:z,clientRect:y(A,z)},q&&((N=h?.onBeforeStart)==null||N.call(h,b)),K&&((D=h?.onBeforeUpdate)==null||D.call(h,b)),(K||q)&&(b.items=await m({editor:e,query:F.query})),Q&&((P=h?.onExit)==null||P.call(h,b)),K&&((I=h?.onUpdate)==null||I.call(h,b)),q&&((M=h?.onStart)==null||M.call(h,b))},destroy:()=>{var A;b&&((A=h?.onExit)==null||A.call(h,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(A,w,C,E){const{isEditable:N}=e,{composing:D}=e.view,{selection:P}=A,{empty:I,from:M}=P,_={...w},T=A.getMeta(t);if(T&&T.exit)return _.active=!1,_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null,_;if(_.composing=D,N&&(I||e.view.composing)){(M<w.range.from||M>w.range.to)&&!D&&!w.composing&&(_.active=!1);const R=p({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:P.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;R&&g({editor:e,state:E,range:R.range,isActive:w.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:A}))?(_.active=!0,_.decorationId=w.decorationId?w.decorationId:O,_.range=R.range,_.query=R.query,_.text=R.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(A,w){var C,E,N,D;const{active:P,range:I}=j.getState(A.state);if(!P)return!1;if(w.key==="Escape"||w.key==="Esc"){const _=j.getState(A.state),T=(C=b?.decorationNode)!=null?C:null,R=T??(_?.decorationId?A.dom.querySelector(`[data-decoration-id="${_.decorationId}"]`):null);if(((E=h?.onKeyDown)==null?void 0:E.call(h,{view:A,event:w,range:_.range}))||!1)return!0;const B={editor:e,range:_.range,query:_.query,text:_.text,items:[],command:L=>i({editor:e,range:_.range,props:L}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(N=h?.onExit)==null||N.call(h,B),k(A,t),!0}return((D=h?.onKeyDown)==null?void 0:D.call(h,{view:A,event:w,range:I}))||!1},decorations(A){const{active:w,range:C,decorationId:E,query:N}=j.getState(A);if(!w)return null;const D=!N?.length,P=[d];return D&&P.push(V),Rr.create(A.doc,[Tr.inline(C.from,C.to,{nodeName:c,class:P.join(" "),"data-decoration-id":E,"data-decoration-content":u})])}}});return j}function Sc(t){const e=$.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:l}=t,[c,d]=S.useState(0),u=S.useRef(o),V=S.useRef(c),i=S.useRef(a),m=S.useRef(l),f=S.useDeferredValue(r);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{d(0)},e[0]=g):g=e[0];let p;e[1]!==f?(p=[f],e[1]=f,e[2]=p):p=e[2],S.useEffect(g,p);let x,b;e[3]!==o.length||e[4]!==c?(x=()=>{c>=o.length&&o.length>0&&d(0)},b=[o.length,c],e[3]=o.length,e[4]=c,e[5]=x,e[6]=b):(x=e[5],b=e[6]),S.useEffect(x,b);let h,v;e[7]!==o?(h=()=>{u.current=o},v=[o],e[7]=o,e[8]=h,e[9]=v):(h=e[8],v=e[9]),S.useEffect(h,v);let y,k;e[10]!==c?(y=()=>{V.current=c},k=[c],e[10]=c,e[11]=y,e[12]=k):(y=e[11],k=e[12]),S.useEffect(y,k);let j,A;e[13]!==a?(A=()=>{i.current=a},j=[a],e[13]=a,e[14]=j,e[15]=A):(j=e[14],A=e[15]),S.useEffect(A,j);let w,C;e[16]!==l?(w=()=>{m.current=l},C=[l],e[16]=l,e[17]=w,e[18]=C):(w=e[17],C=e[18]),S.useEffect(w,C);let E,N;e[19]!==n?(E=()=>{if(n?.isDestroyed)return;let I;try{I=n.view.dom}catch{return}if(!I)return;const M=T=>{const R=u.current;if(!R.length)return!1;const O=()=>d(L=>(L+1)%R.length),B=()=>d(L=>(L-1+R.length)%R.length);switch(T.key){case"ArrowUp":return T.preventDefault(),B(),!0;case"ArrowDown":return T.preventDefault(),O(),!0;case"Tab":return T.preventDefault(),T.shiftKey?B():O(),!0;case"Home":return T.preventDefault(),d(0),!0;case"End":return T.preventDefault(),d(R.length-1),!0;case"Enter":{if(T.isComposing)return!1;T.preventDefault();const L=V.current;return L!==-1&&R[L]&&i.current?.(R[L],L),!0}case"Escape":return T.preventDefault(),m.current?.(),!0;default:return!1}},_=T=>{M(T)};return I.addEventListener("keydown",_,!0),()=>{I?.removeEventListener("keydown",_,!0)}},N=[n],e[19]=n,e[20]=E,e[21]=N):(E=e[20],N=e[21]),S.useEffect(E,N);const D=o.length?c:void 0;let P;return e[22]!==D?(P={selectedIndex:D,setSelectedIndex:d},e[22]=D,e[23]=P):P=e[23],P}function Cc(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const Ls=S.createContext(void 0);function zs(){const t=S.useContext(Ls);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function Nc({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=S.useReducer(Cc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=S.useRef(o);return c.current=o,S.useEffect(()=>{if(t?.isDestroyed)return;const d=n instanceof Ze?n:new Ze(n);t.state.plugins.find(i=>i.spec.key===d)&&t.unregisterPlugin(d);const V=wc({pluginKey:d,editor:t,char:e,allow(i){const m=t.state.doc.resolve(i.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(i))},command(){},render:()=>({onStart:i=>{l({type:"ON_START",payload:{element:i.decorationNode??null,query:i.query,range:i.range}}),c.current?.(!0)},onUpdate:i=>{l({type:"ON_UPDATE",payload:{element:i.decorationNode??null,query:i.query,range:i.range}})},onKeyDown:i=>i.event.key==="Escape"?(l({type:"ON_EXIT"}),!0):!1,onExit:()=>{l({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(d)}},[t,n,e,l,r]),{state:a,dispatch:l}}function kc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=zs(),l=S.useDeferredValue(o.query),{data:c}=fr({queryKey:Oe.suggestionItems(e,o.open,l),queryFn:()=>o.open?n({query:l}):[]}),d=()=>{a({type:"ON_EXIT"})},u=async(i,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:i});try{const{view:f}=t,p=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=o.range?{...o.range}:{from:0,to:0};p&&o.range&&(x.to+=1),await r({range:x,item:i})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):d()}catch{d()}}},{selectedIndex:V}=Sc({editor:t,query:l,items:c,onSelect:u,onClose:d});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:d,onSelect:u}}function _c({children:t}){const{state:e,dispatch:n}=zs(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:d}=gc({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[mr(10),pr(),hr()],whileElementsMounted:xr}),u=hc(d,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=yc(d,{role:"listbox"}),{getFloatingProps:i}=bc([u,V]);return r?s.jsx(Vc,{children:s.jsx("div",{ref:l.setFloating,style:c,...i(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const Ic=t=>{const e=$.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:l}=t;let c;if(e[0]!==n){const j=me(n._meta);c=n.title||Mt(n.name,j),e[0]=n,e[1]=c}else c=e[1];const d=c,u=n.description||null,V=n.icon,i=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==i||e[3]!==m?(f=U("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",i,m),e[2]=i,e[3]=m,e[4]=f):f=e[4];let g;e[5]!==V||e[6]!==d?(g=V!==void 0&&s.jsx(Yn,{icon:V,name:d,size:"xs",className:"mr-2"}),e[5]=V,e[6]=d,e[7]=g):g=e[7];let p;e[8]!==d?(p=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:d}),e[8]=d,e[9]=p):p=e[9];let x;e[10]!==a?(x=a&&s.jsx(Ct,{size:"xs"}),e[10]=a,e[11]=x):x=e[11];let b;e[12]!==p||e[13]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,x]}),e[12]=p,e[13]=x,e[14]=b):b=e[14];let h;e[15]!==u?(h=u&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=h):h=e[16];let v;e[17]!==b||e[18]!==h?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,h]}),e[17]=b,e[18]=h,e[19]=v):v=e[19];let y;e[20]!==n.drillable?(y=n.drillable&&s.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=n.drillable,e[21]=y):y=e[21];let k;return e[22]!==o||e[23]!==l||e[24]!==v||e[25]!==y||e[26]!==f||e[27]!==g?(k=s.jsxs("div",{ref:l,onClick:o,className:f,children:[g,v,y]}),e[22]=o,e[23]=l,e[24]=v,e[25]=y,e[26]=f,e[27]=g,e[28]=k):k=e[28],k},Ec=t=>{const e=$.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let l;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(l={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:V}=kc(l);if(!c.length){let g;return e[5]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=g):g=e[5],g}let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=i):i=e[6];let m;if(e[7]!==u||e[8]!==c||e[9]!==d||e[10]!==V?.name){let g;e[12]!==u||e[13]!==d||e[14]!==V?.name?(g=(p,x)=>s.jsx(Ic,{item:p,isSelected:x===d,ref:x===d?Dc:void 0,onSelect:()=>u(p,x),isLoading:V?.name===p.name},p.name),e[12]=u,e[13]=d,e[14]=V?.name,e[15]=g):g=e[15],m=c.map(g),e[7]=u,e[8]=c,e[9]=d,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:i,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function Rc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(Tc)}),t[0]=e):e=t[0],e}function Tc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Bs(t){const e=$.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:l,onSelect:c,allow:d,onOpenChange:u}=t;let V;e[0]!==d||e[1]!==r||e[2]!==n||e[3]!==u||e[4]!==o?(V={editor:n,char:r,pluginKey:o,allow:d,onOpenChange:u},e[0]=d,e[1]=r,e[2]=n,e[3]=u,e[4]=o,e[5]=V):V=e[5];const{state:i,dispatch:m}=Nc(V);let f;e[6]!==m||e[7]!==i?(f={state:i,dispatch:m},e[6]=m,e[7]=i,e[8]=f):f=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Rc,{}),e[9]=g):g=e[9];let p;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(p=s.jsx(_c,{children:s.jsx(S.Suspense,{fallback:g,children:s.jsx(Ec,{editor:n,queryKey:a,queryFn:l,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=l,e[13]=a,e[14]=p):p=e[14];let x;return e[15]!==f||e[16]!==p?(x=s.jsx(Ls.Provider,{value:f,children:p}),e[15]=f,e[16]=p,e[17]=x):x=e[17],x}function Dc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const Pc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],Mc=({editor:t,virtualMcpId:e})=>{const n=Ue(),{org:r}=de(),o=lo(),a=Io(o),l=Te({connectionId:e,orgId:r.id,orgSlug:r.slug}),c=Oe.virtualMcpResources(e,r.id),[d,u]=S.useState("categories"),V=S.useRef(d);V.current=d;const i=S.useRef(null),m=S.useRef(!1),f=["at-mention",r.id,e??"default",d],g=async({item:b,range:h})=>{if(W("chat_picker_item_selected",{picker:"@",item_kind:b.kind,item_name:b.name}),b.kind!=="category"&&(m.current=!0),b.kind==="category")return u(b.name==="agents"?"agents":"resources"),!1;if(b.kind==="agent"&&b.agentId){Le(t,h,{id:b.agentId,name:b.name,metadata:{agentId:b.agentId,title:b.name},char:"@"}),u("categories");return}if(b.kind==="resource"&&b.uri&&l){try{const v=await Pn(l,b.uri);Le(t,h,{id:b.uri,name:b.uri,metadata:v.contents,char:"@"})}catch(v){console.error("[at-mention] Failed to fetch resource:",v),le.error("Failed to load resource. Please try again.")}u("categories");return}},p=async b=>{const{query:h}=b,v=V.current;if(v==="categories"){if(!h.trim())return Pc;const j=h.toLowerCase(),A=o.filter(C=>C.status==="active"&&(!C.id||!Zt(C.id))&&!a.has(C.id)&&C.id!==e&&(C.title.toLowerCase().includes(j)||C.description?.toLowerCase().includes(j))).map(C=>({name:C.title,title:C.title,description:C.description??void 0,icon:C.icon??null,kind:"agent",agentId:C.id})),w=await(async()=>{if(!l)return[];let C=n.getQueryData(c);return C||(C=await n.fetchQuery({queryKey:c,queryFn:()=>$e(l),staleTime:6e4})),(C?.resources??[]).filter(E=>E.uri.toLowerCase().includes(j)||E.name?.toLowerCase().includes(j)||E.description?.toLowerCase().includes(j)).map(E=>({name:E.name??E.uri,title:E.name,description:E.description,kind:"resource",uri:E.uri}))})();return[...A,...w]}if(v==="agents"){let j=o.filter(A=>A.status==="active"&&(!A.id||!Zt(A.id))&&!a.has(A.id)&&A.id!==e);if(h.trim()){const A=h.toLowerCase();j=j.filter(w=>w.title.toLowerCase().includes(A)||w.description?.toLowerCase().includes(A))}return j.map(A=>({name:A.title,title:A.title,description:A.description??void 0,icon:A.icon??null,kind:"agent",agentId:A.id}))}if(!l)return[];let y=n.getQueryData(c);y?n.fetchQuery({queryKey:c,queryFn:()=>$e(l),staleTime:6e4}).catch(()=>{}):y=await n.fetchQuery({queryKey:c,queryFn:()=>$e(l),staleTime:6e4});let k=y?.resources??[];if(h.trim()){const j=h.toLowerCase();k=k.filter(A=>A.uri.toLowerCase().includes(j)||A.name?.toLowerCase().includes(j)||A.description?.toLowerCase().includes(j))}return k.map(j=>({name:j.name??j.uri,title:j.name,description:j.description,kind:"resource",uri:j.uri}))},x=b=>{if(b)i.current=Date.now(),m.current=!1,W("chat_picker_opened",{picker:"@"});else{const h=i.current;W("chat_picker_closed",{picker:"@",outcome:m.current?"selected":"dismissed",duration_ms:h?Date.now()-h:null}),i.current=null,u("categories")}};return s.jsx(Bs,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:f,queryFn:p,onSelect:g,onOpenChange:x})};async function In(t,e,n,r,o,a){try{const l=await Vt(n,r,a);Le(t,e,{id:r,name:at(r,o),metadata:l.messages,char:"/",kind:"prompt",args:a})}catch(l){console.error("[slash] Failed to fetch prompt:",l),le.error("Failed to load prompt. Please try again.")}}async function Fc(t,e,n,r){try{const o=await Pn(n,r);Le(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),le.error("Failed to load resource. Please try again.")}}const $c=({editor:t,virtualMcpId:e})=>{const n=Ue(),{org:r}=de(),o=Te({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Oe.virtualMcpPrompts(e,r.id),l=Oe.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[d,u]=S.useState(null),[V,i]=S.useState(null),m=Pr(t);m&&(m.onEditChip=async y=>{if(o)try{const j=(await En(n,a,o)).find(A=>A.name===y.promptId);if(!j?.arguments||j.arguments.length===0)return;i({...y,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),le.error("Failed to load prompt. Please try again.")}});const f=S.useRef(null),g=S.useRef(!1),p=async({item:y,range:k})=>{if(W("chat_picker_item_selected",{picker:"/",item_kind:y.kind,item_name:y.name}),g.current=!0,!!o)if(y.kind==="prompt"){if(y.arguments&&y.arguments.length>0){u({range:k,item:y});return}const j=me(y._meta);await In(t,k,o,y.name,j)}else y.uri&&await Fc(t,k,o,y.uri)},x=async y=>{if(!d||!o)return;const{range:k,item:j}=d,A=me(j._meta);await In(t,k,o,j.name,A,y),u(null)},b=async y=>{if(!(!V||!o)){try{const k=await Vt(o,V.promptId,y),j=me(V.prompt._meta);t.chain().focus().setNodeSelection(V.pos).deleteSelection().insertContentAt(V.pos,Ln({id:V.promptId,name:at(V.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:y})).run(),W("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:V.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),le.error("Failed to update prompt. Please try again.")}i(null)}},h=async y=>{const{query:k}=y;if(!o)return[];const[j,A]=await Promise.all([En(n,a,o),Oc(n,l,o)]),w=k.trim().toLowerCase(),C=(j??[]).filter(N=>!w||N.name.toLowerCase().includes(w)||N.title?.toLowerCase().includes(w)||N.description?.toLowerCase().includes(w)).map(N=>({name:N.name,title:N.title,description:N.description,kind:"prompt",arguments:N.arguments,_meta:N._meta})),E=(A??[]).filter(N=>!w||N.uri.toLowerCase().includes(w)||N.name?.toLowerCase().includes(w)||N.description?.toLowerCase().includes(w)).map(N=>({name:N.name??N.uri,title:N.name,description:N.description,kind:"resource",uri:N.uri}));return[...C,...E]},v=d?.item.kind==="prompt"?{name:d.item.name,title:d.item.title,arguments:d.item.arguments,description:d.item.description,_meta:d.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(Bs,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:h,onSelect:p,onOpenChange:y=>{if(y)f.current=Date.now(),g.current=!1,W("chat_picker_opened",{picker:"/"});else{const k=f.current;W("chat_picker_closed",{picker:"/",outcome:g.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),f.current=null}}}),s.jsx(Je,{prompt:v,setPrompt:()=>u(null),onSubmit:x}),s.jsx(Je,{prompt:V?.prompt??null,setPrompt:()=>i(null),onSubmit:b,defaultValues:V?.args},V?`edit-${V.promptId}-${V.pos}`:"edit-idle")]})};async function En(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}),r?.prompts??[]}async function Oc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>$e(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>$e(n),staleTime:6e4}),r?.resources??[]}function Lc(t){return[Lr.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Si.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),$r,Or]}function zc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:l}){const c=S.useRef(a),d=S.useRef(e),u=S.useRef(r),V=S.useRef(o),i=Mr({extensions:Lc(V),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&u.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return S.useEffect(()=>{i?.setEditable(!n)},[i,n]),S.useEffect(()=>{c.current=a},[a]),S.useEffect(()=>{d.current=e},[e]),S.useEffect(()=>{u.current=r},[r]),S.useEffect(()=>{V.current=o},[o]),S.useEffect(()=>{if(!i||i.isDestroyed)return;const m=JSON.stringify(i.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&i.commands.setContent(t||{type:"doc",content:[]})},[i,t]),s.jsx(Fr.Provider,{value:{editor:i},children:l})}function Bc(t){const e=$.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:l,ref:c,className:d}=t,u=n===void 0?!1:n,V=o===void 0?!1:o,{editor:i}=Ft();let m,f;if(e[0]!==i?(m=()=>({focus:()=>{i?.commands.focus()},clear:()=>{i?.commands.clearContent(!0)},appendText:w=>{if(!i)return;const C=i.state.doc.textContent.trim()==="";i.commands.focus("end"),C||i.commands.insertContent(" "),i.commands.insertContent(w)},syncVoiceText:(w,C)=>{if(i&&(i.commands.setContent(w||{type:"doc",content:[]}),C)){i.commands.focus("end");const E=i.state.doc.textContent.trim().length>0;i.commands.insertContent(E?" "+C:C)}},restoreContent:w=>{i&&i.commands.setContent(w||{type:"doc",content:[]})}}),f=[i],e[0]=i,e[1]=m,e[2]=f):(m=e[1],f=e[2]),S.useImperativeHandle(c??null,m,f),!i)return null;const g=u&&"cursor-not-allowed opacity-70",p=u&&"[&_.ProseMirror]:cursor-not-allowed";let x;e[3]!==d||e[4]!==g||e[5]!==p?(x=U("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",g,p),e[3]=d,e[4]=g,e[5]=p,e[6]=x):x=e[6];let b;e[7]!==i||e[8]!==x?(b=s.jsx(zr,{editor:i,className:x}),e[7]=i,e[8]=x,e[9]=b):b=e[9];const h=r??null;let v;e[10]!==i||e[11]!==h?(v=s.jsx(S.Suspense,{fallback:null,children:s.jsx($c,{editor:i,virtualMcpId:h})}),e[10]=i,e[11]=h,e[12]=v):v=e[12];const y=r??null;let k;e[13]!==i||e[14]!==y?(k=s.jsx(S.Suspense,{fallback:null,children:s.jsx(Mc,{editor:i,virtualMcpId:y})}),e[13]=i,e[14]=y,e[15]=k):k=e[15];let j;e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==V?(j=V&&a?s.jsx(bi,{editor:i,selectedModel:a,onUnsupportedFile:l}):null,e[16]=i,e[17]=l,e[18]=a,e[19]=V,e[20]=j):j=e[20];let A;return e[21]!==v||e[22]!==k||e[23]!==j||e[24]!==b?(A=s.jsxs(s.Fragment,{children:[b,v,k,j]}),e[21]=v,e[22]=k,e[23]=j,e[24]=b,e[25]=A):A=e[25],A}function Us(t){const e=$.c(3),[n]=Ee();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Go(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const Uc={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"},qc=oo.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),Kc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Qc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:Kc.map(Yc)}),t[0]=e):e=t[0],e}function Yc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function Hc({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=S.useState(!1),d=Us(Uc),{org:u}=de(),{editor:V}=Ft(),i=S.useRef(null),m=pt(r),f=()=>{!m||o||(c(!1),i.current?.click())},g=async F=>{const z=F.target.files;if(!z||z.length===0||!V)return;const Y=Array.from(z),{from:H}=V.state.selection;try{for(const G of Y)await Yt(V,r??null,G,H,a)}finally{i.current&&(i.current.value="")}},p=Te({connectionId:n,orgId:u.id,orgSlug:u.slug}),x=Oe.virtualMcpPrompts(n,u.id),{data:b,isLoading:h}=gr({queryKey:x,queryFn:()=>kt(p),staleTime:6e4,enabled:l&&!!p}),v=b?.prompts??[],[y,k]=S.useState(null),{chatMode:j,setChatMode:A}=he(),[w,C]=Ee(),N=(Me.find(F=>F.value===w.toolApprovalLevel)??Me[0]).short,D=F=>{const z=Me.find(Y=>Y.value===F);if(z){if(z.value===w.toolApprovalLevel){c(!1);return}d(),W("chat_approval_level_changed",{from_level:w.toolApprovalLevel,to_level:z.value,source:"tools_popover"}),C({...w,toolApprovalLevel:z.value}),c(!1)}},P=j==="plan",I=()=>{d();const F=P?"default":"plan";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},M=()=>{e(),c(!1)},_=async(F,z)=>{if(!V||!p)return;const Y=me(F._meta),H={from:V.state.selection.from,to:V.state.selection.to};try{const G=await Vt(p,F.name,z);Le(V,H,{id:F.name,name:at(F.name,Y),metadata:G.messages,char:"/",kind:"prompt",args:z})}catch{le.error("Failed to load prompt. Please try again.")}},T=async F=>{c(!1);const z=!!(F.arguments&&F.arguments.length>0);if(W("chat_prompt_inserted",{prompt_name:F.name,with_arguments:z}),z){k(F);return}await _(F)},R=async F=>{y&&(await _(y,F),k(null))},O=()=>{d();const F=j==="gen-image"?"default":"gen-image";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},B=()=>{d();const F=j==="web-search"?"default":"web-search";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},L=()=>{d();const F=j==="deep-research"?"default":"deep-research";W("chat_mode_changed",{from_mode:j,to_mode:F,source:"tools_popover"}),A(F),c(!1)},q=j==="gen-image",K=j==="web-search",Q=j==="deep-research";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:i,type:"file",multiple:!0,accept:Po(r??null),className:"hidden",onChange:g,disabled:o}),s.jsxs(qo,{open:l,onOpenChange:F=>{F&&!l&&W("chat_tools_popover_opened",{chat_mode:j}),c(F)},children:[s.jsx(Ko,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(po,{size:14}),s.jsx("span",{className:U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(Qo,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(fe,{onClick:f,disabled:o,children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(be,{children:[s.jsx(xe,{asChild:!0,children:s.jsxs(fe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:F=>F.preventDefault(),children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(ge,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(fe,{onClick:I,className:U(P&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(Un,{size:16,className:U(P&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:U("text-xs text-muted-foreground",P&&"text-violet-500 font-medium"),children:qc})]}),s.jsxs(fe,{onClick:O,className:U(q&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(Kn,{size:16,className:U(q&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),q&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:B,className:U(K&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(qn,{size:16,className:U(K&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),K&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:L,className:U(Q&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(Hn,{size:16,className:U(Q&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Deep research"}),Q&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(sn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:h?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(br,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(F=>s.jsxs(fe,{onClick:()=>T(F),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:F.title||Mt(F.name,me(F._meta))}),F.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:F.description})]},F.name))})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx(mt,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),s.jsx(sn,{className:"w-48 p-1.5",children:s.jsx(Yo,{value:w.toolApprovalLevel,onValueChange:D,children:Me.map(F=>s.jsx(Ho,{value:F.value,children:F.label},F.value))})})]}),s.jsxs(fe,{onClick:M,children:[s.jsx(Co,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(S.Suspense,{children:s.jsx(Qc,{})})]})]})]}),s.jsx(Je,{prompt:y,setPrompt:k,onSubmit:R})]})}const Gc=[{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 Wc(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:Gc.map(Jc)}),t[0]=e):e=t[0],e}function Jc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Zc(t){const e=$.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=U("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(Wc,{}),l=s.jsx(Jo,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=l):(r=e[0],o=e[1],a=e[2],l=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,l]}),e[4]=n,e[5]=c):c=e[5],c}const Fe=48;function Xc(){const t=$.c(9),[e,n]=S.useState("idle"),[r,o]=S.useState(""),[a,l]=S.useState(""),[c,d]=S.useState(nd),u=S.useRef(null),V=S.useRef(null),i=S.useRef(null),m=S.useRef(null),f=S.useRef(0),g=S.useRef(!1),p=S.useRef(""),x=S.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(td),m.current?.getTracks().forEach(ed),i.current=null,V.current=null,m.current=null},t[0]=h):h=t[0];const v=h;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=D=>{m.current=D;const P=new AudioContext;V.current=P;const I=P.createMediaStreamSource(D),M=P.createAnalyser();M.fftSize=128,M.smoothingTimeConstant=.8,I.connect(M),i.current=M;const _=new Uint8Array(M.frequencyBinCount),T=()=>{if(!i.current)return;i.current.getByteFrequencyData(_);const R=[];for(let O=0;O<Fe;O++){const B=Math.floor(O/Fe*_.length);R.push(Math.max(.04,(_[B]??0)/255))}d(R),f.current=requestAnimationFrame(T)};T()};y=async()=>{const D=window.SpeechRecognition||window.webkitSpeechRecognition;if(!D){n("unsupported");return}let P;try{P=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),l(""),x.current="",p.current="",g.current=!0,n("recording"),N(P);const I=new D;u.current=I,I.interimResults=!0,I.continuous=!0,I.lang=navigator.language||"en-US",I.onresult=M=>{let _="",T="";for(let R=M.resultIndex;R<M.results.length;R++){const O=M.results[R],B=O?.[0]?.transcript??"";O?.isFinal?T=T+B:_=_+B}T&&(p.current=p.current+T,o(p.current)),x.current=_,l(_)},I.onend=()=>{if(g.current)try{I.start()}catch{}};try{I.start()}catch{n("idle")}},t[1]=y}else y=t[1];const k=y;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{g.current=!1,u.current?.stop(),v(),n("idle"),d(Array(Fe).fill(.05)),l("");const N=(p.current+(x.current?" "+x.current:"")).trim();return o(""),p.current="",x.current="",N},t[2]=j):j=t[2];const A=j;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{g.current=!1,u.current?.abort(),v(),n("idle"),o(""),l(""),d(Array(Fe).fill(.05)),p.current="",x.current=""},t[3]=w):w=t[3];const C=w;let E;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(E={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:b,startRecording:k,stopRecording:A,cancelRecording:C},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=E):E=t[8],E}function ed(t){return t.stop()}function td(){}function nd(){return Array(Fe).fill(.05)}function sd(t){const e=$.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(rd),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function rd(t,e){return s.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function od({messageCount:t,showConnectionsBanner:e}){return t>0||e}function ad(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function ld(t){const e=$.c(3),{message:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Mn,{size:14,className:"shrink-0"}),e[0]=r):r=e[0];let o;return e[1]!==n?(o=s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,s.jsx("span",{className:"text-sm",children:n})]}),e[1]=n,e[2]=o):o=e[2],o}function id(t,e){const n=$.c(5),{editor:r}=Ft(),[o,a]=S.useState(!1),l=S.useRef(0);let c,d;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),l.current=l.current+1,a(!0))},V=f=>{f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&a(!1)},i=cd,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!pt(t))return;const g=f.dataTransfer?.files;if(!g||g.length===0)return;const{from:p}=r.state.selection;for(const x of Array.from(g))Yt(r,t,x,p,e)};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",V),window.addEventListener("dragover",i),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",i),window.removeEventListener("drop",m)}},d=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=d):(c=n[3],d=n[4]),S.useEffect(c,d),o}function cd(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function dd(t){const e=$.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=id(n,r);let a;e[0]!==n?(a=pt(n),e[0]=n,e[1]=a):a=e[1];const l=a,c=o?"opacity-100":"opacity-0 pointer-events-none",d=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=U("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==l?(V=l?s.jsxs(s.Fragment,{children:[s.jsx(go,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",as(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Mn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=l,e[7]=V):V=e[7];let i;return e[8]!==u||e[9]!==V?(i=s.jsx("div",{className:u,children:V}),e[8]=u,e[9]=V,e[10]=i):i=e[10],i}function ud(){const t=$.c(6),e=rt(),{org:n,locator:r}=de(),{create:o}=no();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async l=>{const{tiptapDoc:c,virtualMcp:d}=l,u=crypto.randomUUID(),V=d?.id??ut(n.id).id;so(sessionStorage,r,u,{tiptapDoc:c});try{await o({id:u,virtual_mcp_id:V})}catch{}const i={virtualmcpid:V,autosend:ro};e({to:"/$org/$taskId",params:{org:n.slug,taskId:u},search:i})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function Vd({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=On(),r=ot(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=r?.taskId??"",u=d||ya,V=ud(),{selectedModel:i,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:g,imageModel:p,webSearchModel:x,deepResearchModel:b,chatMode:h,setChatMode:v}=he(),{data:y}=Tn.useSession(),k=y?.user?.id,{org:j,locator:A}=de(),w=ut(j.id).id,C=io(m?.id??w),E=Us(Wo),[N,D]=S.useState(!1),{unsupportedFile:P,onUnsupportedFile:I,clearUnsupportedFile:M}=wi(),_=Xc(),T=S.useRef(void 0),R=async()=>{T.current=q,await _.startRecording();const Z=_.status==="recording"?"started":_.status==="unsupported"?"unsupported":_.status==="permission-denied"?"permission_denied":"unknown";W("chat_voice_started",{thread_id:d,outcome:Z})},O=()=>{W("chat_voice_confirmed",{thread_id:d});const Z=_.stopRecording();H.current?.syncVoiceText(T.current,Z),H.current?.focus()},B=()=>{W("chat_voice_cancelled",{thread_id:d}),_.cancelRecording(),H.current?.restoreContent(T.current)};S.useEffect(()=>{if(_.status!=="recording")return;const Z=(_.transcript+(_.interimTranscript?" "+_.interimTranscript:"")).trim();H.current?.syncVoiceText(T.current,Z)},[_.transcript,_.interimTranscript,_.status]);const L=r?.activeTask??null,[q,K]=S.useState(()=>ln(sessionStorage,A,u)??void 0),Q=Z=>{K(Z),g.current=Z,ja(sessionStorage,A,u,Z,{onQuotaExceeded:({docSizeBytes:ie})=>{W("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:ie}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},F=S.useRef(d);if(F.current!==d){F.current=d;const Z=ln(sessionStorage,A,u)??void 0;K(Z),g.current=Z}const Y=[...o].reverse().find(Z=>Z.role==="assistant")?.metadata?.modelLimits?.contextWindow??i?.limits?.contextWindow,H=S.useRef(null),G=h==="plan";S.useEffect(()=>{const Z=ie=>{ao(ie)&&ie.code==="KeyL"&&(ie.preventDefault(),ie.shiftKey&&v(h==="plan"?"default":"plan"),H.current?.focus())};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[h,v]);const X=Br(o),te=[...o].reverse().find(Z=>Z.role==="assistant"&&Z.metadata?.usage)?.metadata?.usage?.contextTokens??0,se=!f&&!ms(q),J=ad({hasDraft:se,isStreaming:a,isRunInProgress:l}),oe=J==="send",ne=J==="stop",ce=od({messageCount:o.length,showConnectionsBanner:e}),Ve=Z=>{if(Z?.preventDefault(),J==="send"&&q){if(W("chat_message_sent",{thread_id:d||null,mode:h,model_id:i?.modelId??null,model_provider:i?.providerId??null,virtual_mcp_id:m?.id??null,submission:Z?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){le.info("Still sending your previous message — try again in a moment");return}n.sendMessage(q)}else V({tiptapDoc:q,virtualMcp:m});wa(sessionStorage,A,u),Q(void 0)}else J==="stop"&&(W("chat_message_stopped",{thread_id:d}),c())};return k&&L?.created_by&&L.created_by!==k?s.jsx(ld,{message:"Read only - you're viewing someone else's thread"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(ht,{}),n&&r&&d?s.jsx(jl,{taskId:d}):null,s.jsx(zc,{tiptapDoc:q,setTiptapDoc:Q,disabled:!1,enterToSubmit:!0,onSubmit:Ve,children:s.jsxs("form",{onSubmit:Ve,className:U("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(dd,{selectedModel:i,onUnsupportedFile:I}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(Bc,{ref:H,disabled:_.status==="recording",virtualMcpId:m?.id??w,showFileUploader:!0,selectedModel:i,onUnsupportedFile:I})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:_.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(sd,{data:_.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:B,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:s.jsx(ke,{size:16})}),s.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(qe,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Hc,{disabled:!1,onOpenConnections:()=>{W("connections_dialog_opened",{source:"tools_popover",mode:"add"}),D(!0)},virtualMcpId:m?.id??w,selectedModel:i,isStreaming:a,onUnsupportedFile:I}),G&&s.jsxs("button",{type:"button",onClick:()=>{E(),W("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(Un,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="gen-image"&&p&&s.jsxs("button",{type:"button",onClick:()=>{E(),W("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Kn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="web-search"&&x&&s.jsxs("button",{type:"button",onClick:()=>{E(),W("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(qn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),h==="deep-research"&&b&&s.jsxs("button",{type:"button",onClick:()=>{E(),W("chat_mode_changed",{from_mode:"deep-research",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Deep research","aria-label":"Deep research",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Hn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Deep research"}),s.jsx(ke,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),Y&&te>0&&s.jsx(Ur,{usage:X,totalTokens:te,contextWindow:Y,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[ce&&s.jsx(mi,{virtualMcp:C,currentBranch:r?.currentBranch??null}),s.jsx(gi,{}),_.isSupported&&s.jsx(re,{type:"button",onClick:R,disabled:!1,variant:"ghost",size:"icon",className:U("size-8 rounded-lg transition-colors",_.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:_.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(ho,{size:18})}),s.jsx(re,{type:ne?"button":"submit",onClick:Z=>{ne&&(Z.preventDefault(),Z.stopPropagation(),c())},variant:oe||ne?"default":"ghost",size:"icon",disabled:!oe&&!ne,className:U("size-8 rounded-lg transition-all",!oe&&!ne&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:J==="stop"?a?"Stop generating":"Cancel run":"Send message (Enter)",children:ne?s.jsx(xo,{size:20}):s.jsx(Bn,{size:20})})]})]})})]})},d),e&&s.jsx(Zc,{onClick:()=>{W("connections_banner_clicked",{source:"home_chat_input"}),W("connections_dialog_opened",{source:"home_banner",mode:"add"}),D(!0)}})]})}),s.jsx(Eo,{mode:"browse",open:N,onOpenChange:D,defaultTab:"all"}),s.jsx(Ai,{info:P,onClose:M})]})}const fd={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function qs(t){return`deco-credits-empty-dismissed:${t}`}function gu(t){try{return localStorage.getItem(qs(t))==="1"}catch{return!1}}function md(){const t=$.c(47),{org:e}=de(),n=rt(),{decoKeyId:r}=ts(),o=ns(),[a,l]=S.useState(!0),[c,d]=S.useState(""),[u,V]=S.useState(!1),[i,m]=S.useState("usd"),f=i==="brl"?"R$":"$";let g;t[0]!==e.id?(g=()=>{W("credits_empty_state_dismissed",{organization_id:e.id}),l(!1);try{localStorage.setItem(qs(e.id),"1")}catch{}},t[0]=e.id,t[1]=g):g=t[1];const p=g;let x,b;t[2]!==a||t[3]!==e.id?(x=()=>{a&&W("credits_empty_state_shown",{organization_id:e.id})},b=[a,e.id],t[2]=a,t[3]=e.id,t[4]=x,t[5]=b):(x=t[4],b=t[5]),S.useEffect(x,b);let h;t[6]!==i||t[7]!==o?(h=async L=>{const{url:q}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:L,currency:i});return q},t[6]=i,t[7]=o,t[8]=h):h=t[8];let v;t[9]!==p?(v=L=>{L&&window.open(L,"_blank","noopener,noreferrer"),p()},t[9]=p,t[10]=v):v=t[10];let y;t[11]!==h||t[12]!==v?(y={mutationFn:h,onSuccess:v,onError:hd},t[11]=h,t[12]=v,t[13]=y):y=t[13];const{mutate:k,isPending:j}=Pt(y),A=parseFloat(c),w=!isNaN(A)&&A>=1;if(!a)return null;let C;t[14]!==p?(C=L=>!L&&p(),t[14]=p,t[15]=C):C=t[15];let E;t[16]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[16]=E):E=t[16];let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:s.jsx(Gn,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[17]=N):N=t[17];let D;t[18]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[E,s.jsxs(lt,{className:"relative gap-3",children:[N,s.jsxs("div",{className:"text-center",children:[s.jsx(it,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx($t,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[18]=D):D=t[18];let P;t[19]!==i||t[20]!==f||t[21]!==c||t[22]!==A||t[23]!==r||t[24]!==w||t[25]!==j||t[26]!==u||t[27]!==k?(P=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Xn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:L=>{L&&m(L)},children:[s.jsx(Xe,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Xe,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:fd[i].map(L=>{const{dollars:q,label:K}=L;return s.jsxs("button",{type:"button",disabled:j,onClick:()=>{W("credits_topup_clicked",{amount_cents:q*100,currency:i,tier_label:K,source:"empty_state"}),k(q*100)},className:U("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,q]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:K})]},q)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(es,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:L=>d(L.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!w||j,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:i,tier_label:"custom",source:"empty_state"}),k(Math.round(A*100))},children:j?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),t[19]=i,t[20]=f,t[21]=c,t[22]=A,t[23]=r,t[24]=w,t[25]=j,t[26]=u,t[27]=k,t[28]=P):P=t[28];let I;t[29]!==p||t[30]!==n||t[31]!==e.slug?(I=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[29]=p,t[30]=n,t[31]=e.slug,t[32]=I):I=t[32];let M;t[33]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Zn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[33]=M):M=t[33];let _;t[34]!==I?(_=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:I,children:["Use your own provider",M]}),t[34]=I,t[35]=_):_=t[35];let T;t[36]!==p?(T=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[36]=p,t[37]=T):T=t[37];let R;t[38]!==_||t[39]!==T?(R=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[_,T]}),t[38]=_,t[39]=T,t[40]=R):R=t[40];let O;t[41]!==P||t[42]!==R?(O=s.jsxs(ct,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:pd,children:[D,P,R]}),t[41]=P,t[42]=R,t[43]=O):O=t[43];let B;return t[44]!==O||t[45]!==C?(B=s.jsx(dt,{open:!0,onOpenChange:C,children:O}),t[44]=O,t[45]=C,t[46]=B):B=t[46],B}function pd(t){return t.preventDefault()}function hd(t){le.error(`Top-up failed: ${t.message}`)}function xd(t){const e=$.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=U("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=s.jsx(Gn,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[l,s.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function gd(){const t=$.c(8),{org:e}=de(),n=rt();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=U("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=s.jsx(Wn,{size:13,className:"text-amber-600 dark:text-amber-400"}),l=s.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=o,t[4]=a,t[5]=l):(o=t[3],a=t[4],l=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,l]}),t[6]=r,t[7]=c):c=t[7],c}function bd(t){const e=$.c(11),{className:n}=t;let r;e[0]!==n?(r=U("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(Ye,{align:"right",width:"w-3/4"}),s.jsx(Ye,{align:"left",width:"w-full",lines:3}),s.jsx(Ye,{align:"right",width:"w-2/3"}),s.jsx(Ye,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[d,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let i;return e[9]!==r?(i=s.jsxs("div",{className:r,children:[l,c,V]}),e[9]=r,e[10]=i):i=e[10],i}function Ye(t){const e=$.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,l=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let d;e[0]!==c?(d=U("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=d):d=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==u?(V=U("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=V):V=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=i):i=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=U("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let g;e[8]!==l?(g=Array.from({length:l}),e[8]=l,e[9]=g):g=e[9];let p;e[10]!==l||e[11]!==g?(p=s.jsx("div",{className:"space-y-2",children:g.map((v,y)=>s.jsx("div",{className:U("h-3 rounded bg-muted-foreground/20 animate-pulse",y===l-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=l,e[11]=g,e[12]=p):p=e[12];let x;e[13]!==p||e[14]!==f?(x=s.jsx("div",{className:f,children:p}),e[13]=p,e[14]=f,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==V?(b=s.jsxs("div",{className:V,children:[i,x]}),e[16]=x,e[17]=V,e[18]=b):b=e[18];let h;return e[19]!==b||e[20]!==d?(h=s.jsx("div",{className:d,children:b}),e[19]=b,e[20]=d,e[21]=h):h=e[21],h}function vd(t){const e=$.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:l}=t;let c,d;e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const u=r.current,V=n.current;if(!u||!V||!o)return;const i=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const g=V.scrollHeight,p=V.scrollTop;await l(),requestAnimationFrame(()=>{const x=V.scrollHeight;V.scrollTop=p+(x-g)})},{root:V,rootMargin:"200px 0px 0px 0px"});return i.observe(u),()=>i.disconnect()},d=[n,r,o,a,l],e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=d):(c=e[5],d=e[6]),S.useEffect(c,d)}function yd(t){const e=$.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=U("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function Ad(t){const e=$.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function jd(t){const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function wd(){const t=$.c(33),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a}=Re(),{taskId:l}=Fn(),c=$n(l??"");let d;if(t[0]!==e||t[1]!==c){const E=Cr(c);d=E.size===0?e:e.filter(N=>!E.has(N.id)),t[0]=e,t[1]=c,t[2]=d}else d=t[2];const V=qr(d);let i;t[3]!==V?(i=V.at(-1),t[3]=V,t[4]=i):i=t[4];const m=i,g=va()*ia+16,p=S.useRef(null),x=S.useRef(null);let b;t[5]!==a||t[6]!==r||t[7]!==o?(b={scrollRef:p,sentinelRef:x,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a},t[5]=a,t[6]=r,t[7]=o,t[8]=b):b=t[8],vd(b);let h;t[9]!==g?(h={paddingBottom:g},t[9]=g,t[10]=h):h=t[10];let v;t[11]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("div",{ref:x,"aria-hidden":!0,className:"h-px"}),t[11]=v):v=t[11];let y;t[12]!==o?(y=o&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),t[12]=o,t[13]=y):y=t[13];let k;if(t[14]!==V||t[15]!==n){let E;t[17]!==V.length||t[18]!==n?(E=(N,D)=>s.jsx(Jt,{pair:N,isLastPair:!1,status:D===V.length-1?n:void 0},`pair-${N.user?.id??N.assistant?.id}`),t[17]=V.length,t[18]=n,t[19]=E):E=t[19],k=V.slice(0,-1).map(E),t[14]=V,t[15]=n,t[16]=k}else k=t[16];let j;t[20]!==y||t[21]!==k?(j=s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[v,y,k]}),t[20]=y,t[21]=k,t[22]=j):j=t[22];let A;t[23]!==m||t[24]!==n?(A=m&&s.jsx("div",{className:"min-h-full min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Jt,{pair:m,isLastPair:!0,status:n},`pair-${m.user?.id??m.assistant?.id}`)}),t[23]=m,t[24]=n,t[25]=A):A=t[25];let w;t[26]!==h||t[27]!==j||t[28]!==A?(w=s.jsxs("div",{ref:p,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",style:h,children:[j,A]}),t[26]=h,t[27]=j,t[28]=A,t[29]=w):w=t[29];let C;return t[30]!==e||t[31]!==w?(C=s.jsx(Kr,{messages:e,children:w}),t[30]=e,t[31]=w,t[32]=C):C=t[32],C}function Sd(t){const e=$.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const bu=Object.assign(yd,{Main:Ad,Messages:wd,EmptyState:jd,Footer:Sd,Input:Vd,Provider:Sr,ActiveTaskProvider:wr,Skeleton:bd,IceBreakers:la,NoAiProviderEmptyState:Mo,CreditsEmptyState:md,CreditsEyebrow:xd,NoCreditsEyebrow:gd,CreditsExhaustedBanner:ws});export{bu as C,zc as T,mi as a,Bc as b,xu as c,ei as g,Si as i,Cl as s,Nl as u,gu as w};
@@ -1 +0,0 @@
1
- import{c as it,r as E,j as e,i as rt}from"./index-CWb9Wsg4.js";import{S as mt,b as pt,c as st,d as at}from"./sheet-DOvMDZuR.js";import{S as nt}from"./scroll-area-D5K2cFR-.js";import{r as lt,c as ct,u as dt,a as St,i as ft,f as ut,d as vt,P as ht,S as gt}from"./page-seo-form-Xun3Gb-0.js";import{p as xt}from"./index-DHLGskzl.js";import"./X-C2rVRme5.js";import"./agent-icon-CPn767vi.js";import"./AlertCircle-BJGXp4ka.js";import"./Tool01-Bdi-BBKJ.js";import"./SwitchHorizontal01-BiabkfKZ.js";import"./Settings02-NpgkR8L_.js";import"./XCircle-CBjK62zF.js";import"./ArrowUpRight-BBdsIfGH.js";import"./ZapSquare-BLlgXs9L.js";import"./Users03-B2-Dpsqz.js";import"./CheckCircle-BiabCmdF.js";import"./ChevronUp-DQ-5P7bA.js";import"./ChevronDown-CejcQRgy.js";import"./ChevronLeft-fHsU-TVg.js";import"./ChevronRight-Bajwpni4.js";import"./DotsVertical-eDubkUAQ.js";import"./Stars02-Cqwr8Ws9.js";import"./Eye-CMlUam6_.js";import"./ZoomOut-NGATVClW.js";import"./Globe01-DKKcLl4T.js";import"./FilterLines-CwMZDhi2.js";import"./Star01-IvEBJsCV.js";import"./Globe04-D95JskSa.js";import"./HardDrive-C2eOF8dK.js";import"./Key01-DZIUNEvu.js";import"./LayoutLeft-CASwb6NS.js";import"./LinkExternal01-DEXnL1UU.js";import"./Monitor01-C1hxhUiJ.js";import"./Sun-DikA3hIV.js";import"./Palette-Dt-qaRPY.js";import"./Play-D4JYUILT.js";import"./Plus-TQEhHIaf.js";import"./SearchLg-D4TTfBZy.js";import"./SearchMd-D7Nisqin.js";import"./Shield01-C1PqlQRA.js";import"./Stars01-Bg13RpyJ.js";import"./Trash01-CdGzaXWc.js";import"./Upload01-BLuoqDyn.js";import"./User01-CXAxBhFG.js";import"./Users01-DCjMjVCn.js";import"./XClose-DOorWLJQ.js";import"./Zap-BjNrPOTp.js";import"./use-clock-tick-NRQ6Jq9B.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CWemy_te.js";import"./tooltip-DlNdoWTC.js";import"./file-type-icon-D_3mz8is.js";import"./dialog-w2u9ahjo.js";import"./use-mobile-AEMP8WrJ.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-DIkr-zoW.js";import"./use-mcp-client-H0qGyw4S.js";import"./auth-DCR9ETmd.js";import"./chat-context-A3TdA-KT.js";import"./hooks-DODv-wVV.js";import"./decopilot-sse-pool-DVGFq1Bs.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-BOv3TeD0.js";import"./use-collections-Dx9nw5SH.js";import"./use-ai-providers-Bk-PEV0W.js";import"./studio-tools-BJ-UdyTW.js";import"./use-decopilot-events-DRFfNsO4.js";import"./use-organization-settings-Ddf63XoW.js";import"./shell-layout-BmSdYmam.js";import"./avatar-C8rHGBAI.js";import"./required-auth-layout-BYjSLRKw.js";import"./use-org-sso-oYTowyM2.js";import"./integration-icon-DMSKHFp1.js";import"./use-navigate-to-agent-CCdQ4egc.js";import"./use-connection-CADUWJLS.js";import"./use-mcp-prompts-CMH8dkIp.js";import"./form-Cbgir1KX.js";import"./label-C5upVuqQ.js";import"./input-DeTgNphX.js";import"./select-Cc21tKCb.js";import"./switch-BRov-LAY.js";import"./index-DjmwjOWv.js";import"./drawer-M1tJGuIB.js";import"./collection-search-DaeCK9xr.js";import"./tabs-CP761j-X.js";import"./toggle-group-Bb1gTTUv.js";import"./sortable.esm-CzWimVLQ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DgYNR14j.js";import"./use-registry-connections-FPQXF8Rq.js";import"./useInfiniteQuery-DfyfHpXx.js";import"./use-infinite-scroll-X3H24Vh-.js";import"./extract-connection-data-Wwim23p3.js";import"./card-DOpZHkJr.js";import"./collection-tabs-DNE8Urvp.js";import"./badge-CyH98isx.js";import"./textarea-DGEx65DJ.js";import"./connection-form-helpers-DW2qQjX-.js";import"./authenticate-and-persist-oauth-s0rsdpEF.js";import"./mcp-oauth-a3FzewVg.js";import"./useSuspenseInfiniteQuery-BAdfxWHo.js";import"./connect-desktop-dialog-Bx-n41ou.js";import"./decopilot-Ds8Sp1JG.js";import"./checkbox-C7qfaduP.js";import"./skeleton-D6by2dpn.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BI5jS2Dt.js";import"./popover-Sng9qlGZ.js";import"./command-J9Wy9n_1.js";import"./index-CC2delq7.js";import"./dropdown-menu-Bw00TpsM.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-C40CL6QW.js";import"./empty-state-C_fk-KEj.js";import"./toolbar-IDz7ohMs.js";import"./preview-dialog-DNK26uoS.js";import"./index-D2LhxKOJ.js";import"./use-mcp-tools-ClpDupwI.js";import"./use-capability-CIrGamSD.js";import"./shell-route-loading-DPMEw2M6.js";import"./index-CeQQD9lF.js";import"./alert-dialog-Dz8imfBX.js";import"./use-debounced-autosave-Ddf6ohdu.js";import"./index-BnDi5HAq.js";import"./sidebar-CtBbCGBG.js";import"./search-input-Dcdjp99e.js";import"./github-repo-picker-7ankcqDv.js";import"./use-debounced-value-CqnvF_Tx.js";import"./use-secrets-DqSD7GLo.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-buFuODEl.js";import"./automation-runs-Bkpk06w6.js";import"./table-5b-Z4cr5.js";import"./use-members-CLe24wAb.js";import"./use-org-auth-client-e-AT3UBL.js";import"./task-status-DwC3l4SN.js";import"./use-automations-B3A8m1Qa.js";import"./use-file-configs-Dqn5vTip.js";import"./monaco-editor-CUY1wKmW.js";import"./select-model-C3sVs6BI.js";import"./automation-list-row-B2xN_dPF.js";function ri(u){const t=it.c(46),{open:N,onOpenChange:P,orgSlug:Q,virtualMcpId:U,branch:W,decofile:G,meta:s,target:m,onSaved:X}=u,o=lt(G,m,s),k=m.kind==="site"?"site":m.pageKey,[Y,Z]=E.useState(k),[tt,i]=E.useState(null),[J,g]=E.useState(void 0),[x,y]=E.useState(0);Y!==k&&(Z(k),i(null),g(void 0),y(wt));const{persistSeo:a,persistRawSeo:I,flush:K,isPending:D}=ct({orgSlug:Q,virtualMcpId:U,branch:W,target:m,resolved:o,onSaved:X}),w=m.kind==="page",ot=w?o?.rawSeoData:void 0,v=J!==void 0?J:ot,et=w?dt(v)??void 0:void 0,h=tt??et??o?.seoData??{},p=o?St(h,o):null,n=p&&(!w||ft(v))?xt(p,s):null,_=m.kind==="page"?ut(G,s)?.seoData??void 0:void 0;let j;t[0]!==s?(j=vt(s),t[0]=s,t[1]=j):j=t[1];const M=j;let R;t[2]!==a||t[3]!==o||t[4]!==i?(R=r=>{if(!o)return;const L=r;i(L),a(L)},t[2]=a,t[3]=o,t[4]=i,t[5]=R):R=t[5];const V=R;let F;t[6]!==K||t[7]!==P?(F=r=>{r||K(),P(r)},t[6]=K,t[7]=P,t[8]=F):F=t[8];const z=F,A=m.kind==="site"?"Site SEO":"Page SEO",T=w&&o,B=m.kind==="site"&&o&&n,H=m.kind==="site"?"No site-level SEO block found.":o?"SEO schema not found for this page.":"Could not load page SEO.";let C;t[9]!==i?(C=()=>i(null),t[9]=i,t[10]=C):C=t[10];const $=C;let O;t[11]!==y?(O=()=>y(yt),t[11]=y,t[12]=O):O=t[12];const q=O;let l;t[13]!==A?(l=e.jsx(mt,{className:"text-sm font-semibold",children:A}),t[13]=A,t[14]=l):l=t[14];let c;t[15]!==D?(c=D&&e.jsx(rt,{size:14,className:"animate-spin text-muted-foreground"}),t[15]=D,t[16]=c):c=t[16];let d;t[17]!==l||t[18]!==c?(d=e.jsxs(pt,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[l,c]}),t[17]=l,t[18]=c,t[19]=d):d=t[19];let S;t[20]!==p||t[21]!==q||t[22]!==$||t[23]!==M||t[24]!==v||t[25]!==h||t[26]!==H||t[27]!==x||t[28]!==V||t[29]!==I||t[30]!==a||t[31]!==o||t[32]!==n||t[33]!==i||t[34]!==g||t[35]!==T||t[36]!==B||t[37]!==_?(S=!o||!T&&!B?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:H}):e.jsx(nt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:e.jsx("div",{className:"px-6 py-4",children:e.jsx("div",{className:"mx-auto max-w-sm",children:T?e.jsx(ht,{rawSeo:v,innerSeo:h,defaultResolveType:M,seoSchema:n,activeResolveType:p,seoTypeOptions:o.seoTypeOptions,formResetKey:x,siteDefaultSeo:_,onPersistRaw:r=>{g(r),I(r)},onInnerChange:r=>{i(r),a(r)},onClearForm:$,onBumpFormKey:q}):n&&p&&e.jsx(gt,{schema:n,resolveType:p,value:h,formResetKey:x,onChange:V})})})}),t[20]=p,t[21]=q,t[22]=$,t[23]=M,t[24]=v,t[25]=h,t[26]=H,t[27]=x,t[28]=V,t[29]=I,t[30]=a,t[31]=o,t[32]=n,t[33]=i,t[34]=g,t[35]=T,t[36]=B,t[37]=_,t[38]=S):S=t[38];let f;t[39]!==d||t[40]!==S?(f=e.jsxs(st,{side:"right",className:"w-[400px] sm:max-w-[440px] p-0 gap-0",children:[d,S]}),t[39]=d,t[40]=S,t[41]=f):f=t[41];let b;return t[42]!==z||t[43]!==N||t[44]!==f?(b=e.jsx(at,{open:N,onOpenChange:z,children:f}),t[42]=z,t[43]=N,t[44]=f,t[45]=b):b=t[45],b}function yt(u){return u+1}function wt(u){return u+1}export{ri as SeoSheet};
@@ -1 +0,0 @@
1
- import{c as H,j as t,B as Z}from"./index-CWb9Wsg4.js";import{n as ee}from"./LinkExternal01-DEXnL1UU.js";import{aB as te,t as oe}from"./agent-icon-CPn767vi.js";import{I as J}from"./input-DeTgNphX.js";import{L as G}from"./label-C5upVuqQ.js";import{M as ie}from"./automation-runs-Bkpk06w6.js";import{T as Q,a as se,b as W,c as le}from"./tabs-CP761j-X.js";import{T as re}from"./textarea-DGEx65DJ.js";import{au as ae,av as me,at as pe,aw as ne,ax as ce,ay as de,az as fe}from"./index-DHLGskzl.js";import{b as ue,a as xe,B as he}from"./block-document-BaSGgwbA.js";import{u as ge,s as F,E as ve,R as ye,A as je}from"./primitives-BX1TQnm6.js";import"./AlertCircle-BJGXp4ka.js";import"./Tool01-Bdi-BBKJ.js";import"./SwitchHorizontal01-BiabkfKZ.js";import"./Settings02-NpgkR8L_.js";import"./XCircle-CBjK62zF.js";import"./ArrowUpRight-BBdsIfGH.js";import"./ZapSquare-BLlgXs9L.js";import"./Users03-B2-Dpsqz.js";import"./CheckCircle-BiabCmdF.js";import"./ChevronUp-DQ-5P7bA.js";import"./ChevronDown-CejcQRgy.js";import"./ChevronLeft-fHsU-TVg.js";import"./ChevronRight-Bajwpni4.js";import"./DotsVertical-eDubkUAQ.js";import"./Stars02-Cqwr8Ws9.js";import"./Eye-CMlUam6_.js";import"./ZoomOut-NGATVClW.js";import"./Globe01-DKKcLl4T.js";import"./FilterLines-CwMZDhi2.js";import"./Star01-IvEBJsCV.js";import"./Globe04-D95JskSa.js";import"./HardDrive-C2eOF8dK.js";import"./Key01-DZIUNEvu.js";import"./LayoutLeft-CASwb6NS.js";import"./Monitor01-C1hxhUiJ.js";import"./Sun-DikA3hIV.js";import"./Palette-Dt-qaRPY.js";import"./Play-D4JYUILT.js";import"./Plus-TQEhHIaf.js";import"./SearchLg-D4TTfBZy.js";import"./SearchMd-D7Nisqin.js";import"./Shield01-C1PqlQRA.js";import"./Stars01-Bg13RpyJ.js";import"./Trash01-CdGzaXWc.js";import"./Upload01-BLuoqDyn.js";import"./User01-CXAxBhFG.js";import"./Users01-DCjMjVCn.js";import"./XClose-DOorWLJQ.js";import"./X-C2rVRme5.js";import"./Zap-BjNrPOTp.js";import"./useInfiniteQuery-DfyfHpXx.js";import"./use-infinite-scroll-X3H24Vh-.js";import"./use-connection-CADUWJLS.js";import"./use-collections-Dx9nw5SH.js";import"./use-mcp-client-H0qGyw4S.js";import"./auth-DCR9ETmd.js";import"./use-virtual-mcp-BOv3TeD0.js";import"./card-DOpZHkJr.js";import"./sheet-DOvMDZuR.js";import"./table-5b-Z4cr5.js";import"./empty-state-C_fk-KEj.js";import"./use-members-CLe24wAb.js";import"./use-org-auth-client-e-AT3UBL.js";import"./task-status-DwC3l4SN.js";import"./use-automations-B3A8m1Qa.js";import"./studio-tools-BJ-UdyTW.js";import"./useSuspenseInfiniteQuery-BAdfxWHo.js";import"./badge-CyH98isx.js";import"./select-Cc21tKCb.js";import"./tooltip-DlNdoWTC.js";import"./checkbox-C7qfaduP.js";import"./command-J9Wy9n_1.js";import"./index-CC2delq7.js";import"./dialog-w2u9ahjo.js";import"./popover-Sng9qlGZ.js";import"./avatar-C8rHGBAI.js";import"./scroll-area-D5K2cFR-.js";import"./use-clock-tick-NRQ6Jq9B.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CWemy_te.js";import"./file-type-icon-D_3mz8is.js";import"./use-mobile-AEMP8WrJ.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-DIkr-zoW.js";import"./chat-context-A3TdA-KT.js";import"./hooks-DODv-wVV.js";import"./decopilot-sse-pool-DVGFq1Bs.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-Bk-PEV0W.js";import"./use-decopilot-events-DRFfNsO4.js";import"./use-organization-settings-Ddf63XoW.js";import"./shell-layout-BmSdYmam.js";import"./required-auth-layout-BYjSLRKw.js";import"./use-org-sso-oYTowyM2.js";import"./integration-icon-DMSKHFp1.js";import"./use-navigate-to-agent-CCdQ4egc.js";import"./use-mcp-prompts-CMH8dkIp.js";import"./form-Cbgir1KX.js";import"./index-DjmwjOWv.js";import"./drawer-M1tJGuIB.js";import"./collection-search-DaeCK9xr.js";import"./toggle-group-Bb1gTTUv.js";import"./sortable.esm-CzWimVLQ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DgYNR14j.js";import"./use-registry-connections-FPQXF8Rq.js";import"./extract-connection-data-Wwim23p3.js";import"./collection-tabs-DNE8Urvp.js";import"./connection-form-helpers-DW2qQjX-.js";import"./authenticate-and-persist-oauth-s0rsdpEF.js";import"./mcp-oauth-a3FzewVg.js";import"./connect-desktop-dialog-Bx-n41ou.js";import"./decopilot-Ds8Sp1JG.js";import"./skeleton-D6by2dpn.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BI5jS2Dt.js";import"./dropdown-menu-Bw00TpsM.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-C40CL6QW.js";import"./toolbar-IDz7ohMs.js";import"./preview-dialog-DNK26uoS.js";import"./index-D2LhxKOJ.js";import"./use-mcp-tools-ClpDupwI.js";import"./use-capability-CIrGamSD.js";import"./shell-route-loading-DPMEw2M6.js";import"./index-CeQQD9lF.js";import"./alert-dialog-Dz8imfBX.js";import"./switch-BRov-LAY.js";import"./use-debounced-autosave-Ddf6ohdu.js";import"./index-BnDi5HAq.js";import"./sidebar-CtBbCGBG.js";import"./search-input-Dcdjp99e.js";import"./github-repo-picker-7ankcqDv.js";import"./use-debounced-value-CqnvF_Tx.js";import"./use-secrets-DqSD7GLo.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-buFuODEl.js";import"./use-file-configs-Dqn5vTip.js";import"./monaco-editor-CUY1wKmW.js";import"./select-model-C3sVs6BI.js";import"./automation-list-row-B2xN_dPF.js";function be(A){return Array.isArray(A)?A.map(e=>({key:F(e?.key),value:F(e?.value)})):[]}function ai(A){const e=H.c(66),{orgSlug:i,virtualMcpId:d,branch:o,blockKey:l,block:p,decofile:m,meta:u,previewBaseUrl:x}=A;let y;e[0]!==o||e[1]!==i||e[2]!==d?(y={orgSlug:i,virtualMcpId:d,branch:o},e[0]=o,e[1]=i,e[2]=d,e[3]=y):y=e[3];const s=ae(y);let n;e[4]!==p?(n=me(p,"posts"),e[4]=p,e[5]=n):n=e[5];const j=n;let b;e[6]!==l||e[7]!==s?(b=T=>{s.mutate({blockKey:l,data:ne(l,"posts",T)})},e[6]=l,e[7]=s,e[8]=b):b=e[8];const[r,_]=ge(j,b);let C;e[9]!==r||e[10]!==_?(C=(T,Y)=>_({...r,[T]:Y}),e[9]=r,e[10]=_,e[11]=C):C=e[11];const h=C;let S;e[12]!==m||e[13]!==r||e[14]!==x?(S=ue({decofile:m,post:r,previewBaseUrl:x}),e[12]=m,e[13]=r,e[14]=x,e[15]=S):S=e[15];const f=S;let a;e[16]!==r.title?(a=F(r.title)||"Untitled post",e[16]=r.title,e[17]=a):a=e[17];let c;e[18]!==a?(c=t.jsx("span",{className:"truncate text-sm font-medium",children:a}),e[18]=a,e[19]=c):c=e[19];let g;e[20]!==s.isError||e[21]!==s.isPending?(g=t.jsx(pe,{isPending:s.isPending,isError:s.isError}),e[20]=s.isError,e[21]=s.isPending,e[22]=g):g=e[22];const k=!f,P=f?"Open the post preview in a new tab":"Set the post slug (and its category) plus the blog app's pageSlug to preview";let N;e[23]!==f?(N=()=>{f&&window.open(f,"_blank","noopener,noreferrer")},e[23]=f,e[24]=N):N=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx(ee,{size:14}),e[25]=B):B=e[25];let w;e[26]!==P||e[27]!==N||e[28]!==k?(w=t.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:k,title:P,onClick:N,children:[B,"See preview"]}),e[26]=P,e[27]=N,e[28]=k,e[29]=w):w=e[29];let E;e[30]!==w||e[31]!==g?(E=t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[g,w]}),e[30]=w,e[31]=g,e[32]=E):E=e[32];let v;e[33]!==E||e[34]!==c?(v=t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[c,E]}),e[33]=E,e[34]=c,e[35]=v):v=e[35];let L;e[36]!==r.title?(L=F(r.title),e[36]=r.title,e[37]=L):L=e[37];let R;e[38]!==h?(R=T=>h("title",T),e[38]=h,e[39]=R):R=e[39];let U;e[40]!==L||e[41]!==R?(U=t.jsx(ve,{value:L,onChange:R,placeholder:"Post title",className:"py-1 text-4xl font-bold text-foreground"}),e[40]=L,e[41]=R,e[42]=U):U=e[42];let O;e[43]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs(Q,{value:"content",children:[t.jsx(te,{}),"Content"]}),e[43]=O):O=e[43];let K;e[44]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsxs(se,{children:[O,t.jsxs(Q,{value:"settings",children:[t.jsx(oe,{}),"Settings"]})]}),e[44]=K):K=e[44];let $;e[45]!==r.sections?($=xe(r.sections),e[45]=r.sections,e[46]=$):$=e[46];let I;e[47]!==h?(I=T=>h("sections",T),e[47]=h,e[48]=I):I=e[48];let M;e[49]!==u||e[50]!==$||e[51]!==I?(M=t.jsx(W,{value:"content",children:t.jsx("div",{className:"rounded-xl border bg-card p-8 shadow-sm",children:t.jsx(he,{value:$,onChange:I,meta:u,emptyMessage:"This post has no content yet. Use ⊕ to add your first block."})})}),e[49]=u,e[50]=$,e[51]=I,e[52]=M):M=e[52];let z;e[53]!==m||e[54]!==r||e[55]!==h?(z=t.jsx(W,{value:"settings",children:t.jsx("div",{className:"rounded-xl border bg-card p-6 shadow-sm",children:t.jsx(Ce,{post:r,decofile:m,onChange:h})})}),e[53]=m,e[54]=r,e[55]=h,e[56]=z):z=e[56];let D;e[57]!==M||e[58]!==z?(D=t.jsxs(le,{defaultValue:"content",className:"mt-6 gap-4",children:[K,M,z]}),e[57]=M,e[58]=z,e[59]=D):D=e[59];let V;e[60]!==U||e[61]!==D?(V=t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[U,D]})}),e[60]=U,e[61]=D,e[62]=V):V=e[62];let q;return e[63]!==v||e[64]!==V?(q=t.jsxs("div",{className:"flex h-full flex-col",children:[v,V]}),e[63]=v,e[64]=V,e[65]=q):q=e[65],q}function Ce(A){const e=H.c(59),{post:i,decofile:d,onChange:o}=A;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(G,{htmlFor:"post-excerpt",children:"Excerpt"}),e[0]=l):l=e[0];let p;e[1]!==i.excerpt?(p=F(i.excerpt),e[1]=i.excerpt,e[2]=p):p=e[2];let m;e[3]!==o?(m=v=>o("excerpt",v.target.value),e[3]=o,e[4]=m):m=e[4];let u;e[5]!==p||e[6]!==m?(u=t.jsxs("div",{className:"space-y-2",children:[l,t.jsx(re,{id:"post-excerpt",value:p,onChange:m,rows:2})]}),e[5]=p,e[6]=m,e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(G,{htmlFor:"post-slug",children:"Slug"}),e[8]=x):x=e[8];let y;e[9]!==i.slug?(y=F(i.slug),e[9]=i.slug,e[10]=y):y=e[10];let s;e[11]!==o?(s=v=>o("slug",v.target.value),e[11]=o,e[12]=s):s=e[12];let n;e[13]!==y||e[14]!==s?(n=t.jsxs("div",{className:"space-y-2",children:[x,t.jsx(J,{id:"post-slug",value:y,onChange:s,placeholder:"my-post",className:"h-10"})]}),e[13]=y,e[14]=s,e[15]=n):n=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j={type:"string",format:"date",title:"Date"},e[16]=j):j=e[16];let b;e[17]!==i.date?(b=F(i.date),e[17]=i.date,e[18]=b):b=e[18];let r;e[19]!==o?(r=v=>o("date",v),e[19]=o,e[20]=r):r=e[20];let _;e[21]!==b||e[22]!==r?(_=t.jsx(fe,{schema:j,value:b,onChange:r,path:"post-date",label:"Date"}),e[21]=b,e[22]=r,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==n?(C=t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n,_]}),e[24]=_,e[25]=n,e[26]=C):C=e[26];let h;e[27]===Symbol.for("react.memo_cache_sentinel")?(h={type:"string",format:"image-uri",title:"Cover image"},e[27]=h):h=e[27];let S;e[28]!==o?(S=v=>o("image",v),e[28]=o,e[29]=S):S=e[29];let f;e[30]!==i.image||e[31]!==S?(f=t.jsx(ce,{schema:h,value:i.image,onChange:S,path:"post-image",label:"Cover image"}),e[30]=i.image,e[31]=S,e[32]=f):f=e[32];let a;e[33]===Symbol.for("react.memo_cache_sentinel")?(a=["email"],e[33]=a):a=e[33];let c;e[34]!==o?(c=v=>o("authors",v),e[34]=o,e[35]=c):c=e[35];let g;e[36]!==d||e[37]!==i.authors||e[38]!==c?(g=t.jsx(X,{label:"Authors",decofile:d,kind:"authors",valueField:"email",extraFields:a,selected:i.authors,onChange:c}),e[36]=d,e[37]=i.authors,e[38]=c,e[39]=g):g=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=["slug"],e[40]=k):k=e[40];let P;e[41]!==o?(P=v=>o("categories",v),e[41]=o,e[42]=P):P=e[42];let N;e[43]!==d||e[44]!==i.categories||e[45]!==P?(N=t.jsx(X,{label:"Categories",decofile:d,kind:"categories",valueField:"slug",extraFields:k,selected:i.categories,onChange:P}),e[43]=d,e[44]=i.categories,e[45]=P,e[46]=N):N=e[46];let B;e[47]!==o?(B=v=>o("extraProps",v),e[47]=o,e[48]=B):B=e[48];let w;e[49]!==i.extraProps||e[50]!==B?(w=t.jsx(ke,{value:i.extraProps,onChange:B}),e[49]=i.extraProps,e[50]=B,e[51]=w):w=e[51];let E;return e[52]!==C||e[53]!==f||e[54]!==g||e[55]!==N||e[56]!==w||e[57]!==u?(E=t.jsxs("div",{className:"space-y-5",children:[u,C,f,g,N,w]}),e[52]=C,e[53]=f,e[54]=g,e[55]=N,e[56]=w,e[57]=u,e[58]=E):E=e[58],E}function ke(A){const e=H.c(15),{value:i,onChange:d}=A;let o,l,p,m;if(e[0]!==d||e[1]!==i){o=be(i);const y=(s,n)=>d(o.map((j,b)=>b===s?{...j,...n}:j));l="space-y-2",e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(G,{children:"Extra props"}),e[6]=p):p=e[6],m=o.length>0&&t.jsx("ul",{className:"space-y-2",children:o.map((s,n)=>t.jsxs("li",{className:"group/item flex items-center gap-2",children:[t.jsx(J,{value:s.key,onChange:j=>y(n,{key:j.target.value}),placeholder:"key",className:"h-9 flex-1"}),t.jsx(J,{value:s.value,onChange:j=>y(n,{value:j.target.value}),placeholder:"value",className:"h-9 flex-1"}),t.jsx(ye,{label:"Remove prop",onClick:()=>d(o.filter((j,b)=>b!==n))})]},n))}),e[0]=d,e[1]=i,e[2]=o,e[3]=l,e[4]=p,e[5]=m}else o=e[2],l=e[3],p=e[4],m=e[5];let u;e[7]!==o||e[8]!==d?(u=t.jsx(je,{label:"Add prop",onClick:()=>d([...o,{key:"",value:""}])}),e[7]=o,e[8]=d,e[9]=u):u=e[9];let x;return e[10]!==l||e[11]!==p||e[12]!==m||e[13]!==u?(x=t.jsxs("div",{className:l,children:[p,m,u]}),e[10]=l,e[11]=p,e[12]=m,e[13]=u,e[14]=x):x=e[14],x}function X(A){const e=H.c(31),{label:i,decofile:d,kind:o,valueField:l,extraFields:p,selected:m,onChange:u}=A;let x,y,s;if(e[0]!==d||e[1]!==o||e[2]!==l){x=de(d,o);let f;e[6]!==l?(f=(c,g)=>F(c[l])||g,e[6]=l,e[7]=f):f=e[7],s=f;let a;e[8]!==s?(a=c=>{const{key:g,payload:k}=c;return{value:s(k,g),label:F(k.name)||s(k,g)}},e[8]=s,e[9]=a):a=e[9],y=x.map(a),e[0]=d,e[1]=o,e[2]=l,e[3]=x,e[4]=y,e[5]=s}else x=e[3],y=e[4],s=e[5];const n=y;let j;if(e[10]!==m||e[11]!==l){const f=Array.isArray(m)?m:[];let a;e[13]!==l?(a=c=>F(c[l]),e[13]=l,e[14]=a):a=e[14],j=f.map(a).filter(Boolean),e[10]=m,e[11]=l,e[12]=j}else j=e[12];const b=j;let r;e[15]!==p||e[16]!==u||e[17]!==x||e[18]!==l||e[19]!==s?(r=f=>{u(f.map(a=>{const c=x.find(k=>{const{key:P,payload:N}=k;return s(N,P)===a});if(!c)return{name:a,[l]:a};const g={name:F(c.payload.name)};for(const k of p)g[k]=c.payload[k]??a;return g}))},e[15]=p,e[16]=u,e[17]=x,e[18]=l,e[19]=s,e[20]=r):r=e[20];const _=r;let C;e[21]!==i?(C=t.jsx(G,{children:i}),e[21]=i,e[22]=C):C=e[22];let h;e[23]!==b||e[24]!==_||e[25]!==i||e[26]!==n?(h=n.length===0?t.jsxs("p",{className:"text-xs text-muted-foreground",children:["No ",i.toLowerCase()," yet — create some in the"," ",i.toLowerCase()," collection."]}):t.jsx(ie,{options:n,defaultValue:b,onValueChange:_,placeholder:`Select ${i.toLowerCase()}`,maxCount:4}),e[23]=b,e[24]=_,e[25]=i,e[26]=n,e[27]=h):h=e[27];let S;return e[28]!==C||e[29]!==h?(S=t.jsxs("div",{className:"space-y-2",children:[C,h]}),e[28]=C,e[29]=h,e[30]=S):S=e[30],S}export{ai as PostEditor};