decocms 4.139.21 → 4.139.23

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 (221) hide show
  1. package/dist/client/assets/{AlertCircle-BqXz_QW3.js → AlertCircle-DcC27WmA.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DTmhkVdV.js → AreaChart-DsfzIYIp.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-CuPsp_g8.js → ArrowUp-CdeTFRe8.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-5u0BVlcn.js → ArrowUpRight-kIZaH3BQ.js} +1 -1
  5. package/dist/client/assets/{Check-D3dAxrw3.js → Check-RPsONqoi.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-DJgrIUO3.js → CheckCircle-VwoQIY3x.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-sGinN19i.js → ChevronDown-CvsGy9_V.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-DQRrACFJ.js → ChevronRight-COrmV1RX.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BbsgPeIZ.js → ChevronUp-t2K_HYRx.js} +1 -1
  10. package/dist/client/assets/{Copy01-CBKme8NM.js → Copy01-dUIi2eZN.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-BEG934Sy.js → DotsVertical-B5m6mJwx.js} +1 -1
  12. package/dist/client/assets/{Eye-CgfFpeGb.js → Eye-CPyHsNx9.js} +1 -1
  13. package/dist/client/assets/{FilterLines-BKryYm8Z.js → FilterLines-C3ejwu4y.js} +1 -1
  14. package/dist/client/assets/{HardDrive-Ce_49EOW.js → HardDrive-RremZdHb.js} +1 -1
  15. package/dist/client/assets/{Key01-D3otsQjQ.js → Key01-DrXVRZX2.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-D3LTKctD.js → LayoutLeft-CUtVoabE.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-DdG8DMp5.js → LinkExternal01-FYanFsTL.js} +1 -1
  18. package/dist/client/assets/{LogOut01-DYtDxfbG.js → LogOut01-Dibr0QOA.js} +1 -1
  19. package/dist/client/assets/{Monitor01-B9Ngi6RN.js → Monitor01-0a0QOsYs.js} +1 -1
  20. package/dist/client/assets/{Palette-BXIMBzzn.js → Palette-C6VwvyVY.js} +1 -1
  21. package/dist/client/assets/{Play-DtXxBW66.js → Play-Bn0EGB-t.js} +1 -1
  22. package/dist/client/assets/{Plus-TZoZPDtM.js → Plus-sc0rW8OF.js} +1 -1
  23. package/dist/client/assets/{SearchLg-D0JVAnZf.js → SearchLg-DXFQe1Sx.js} +1 -1
  24. package/dist/client/assets/{SearchMd-DTzUg0rC.js → SearchMd-FZNYglTs.js} +1 -1
  25. package/dist/client/assets/{Settings02-BLjXGanZ.js → Settings02-epU11QVl.js} +1 -1
  26. package/dist/client/assets/{Shield01-iDkSI_Ov.js → Shield01-DrNeuOUB.js} +1 -1
  27. package/dist/client/assets/{Star01-BI7bTLeh.js → Star01-Cawt_hmv.js} +1 -1
  28. package/dist/client/assets/{Stars01-Bk7jyFCH.js → Stars01-DIPcXJk_.js} +1 -1
  29. package/dist/client/assets/{Stars02-CFDUnzqj.js → Stars02-B8jO1lJL.js} +1 -1
  30. package/dist/client/assets/{Sun-CsC6IQlI.js → Sun-E9I6kbto.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-CjtBAa85.js → SwitchHorizontal01-BxES_zRv.js} +1 -1
  32. package/dist/client/assets/{Tool01-DvOYqvtL.js → Tool01-DV88LwAF.js} +1 -1
  33. package/dist/client/assets/{Tool02-w_YdMf1T.js → Tool02-DHfpo6ax.js} +1 -1
  34. package/dist/client/assets/{Trash01-BCRpsJy6.js → Trash01-BWM43E9g.js} +1 -1
  35. package/dist/client/assets/{TrendUp01-ClZSGNPD.js → TrendUp01-DNTYrYK3.js} +1 -1
  36. package/dist/client/assets/{Upload01-DUPVY2Gx.js → Upload01-H15qbd7J.js} +1 -1
  37. package/dist/client/assets/{User01-DwgmSXVE.js → User01-DnfEmgSx.js} +1 -1
  38. package/dist/client/assets/{Users01-xF6GoF_3.js → Users01-chZ7Ggai.js} +1 -1
  39. package/dist/client/assets/{Users03-Y5y_Bnnu.js → Users03-DEjraBJr.js} +1 -1
  40. package/dist/client/assets/{X-D7TfGl49.js → X-BpPB2vv6.js} +1 -1
  41. package/dist/client/assets/{XCircle-BBzjwcRg.js → XCircle-A38V1g83.js} +1 -1
  42. package/dist/client/assets/{XClose-DSzxEgiI.js → XClose-CN5uz5w3.js} +1 -1
  43. package/dist/client/assets/{Zap-B8RnuHjT.js → Zap-Cnbp-COg.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-BaUS6VhV.js → ZapSquare-DvCo-SHa.js} +1 -1
  45. package/dist/client/assets/{access-gate-CvoyuAXP.js → access-gate-BDUkbCsf.js} +1 -1
  46. package/dist/client/assets/{add-section-modal-BwZRsP3o.js → add-section-modal-DzbJrwq6.js} +1 -1
  47. package/dist/client/assets/{agent-icon-BgwoOVTy.js → agent-icon-CXm0tG2U.js} +1 -1
  48. package/dist/client/assets/{agents-list-DiOC6pAt.js → agents-list-CjHAfdf9.js} +1 -1
  49. package/dist/client/assets/{ai-providers-DysJ4XpD.js → ai-providers-BROkQV92.js} +1 -1
  50. package/dist/client/assets/{alert-CvZcb5df.js → alert-D30tDfCd.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-uHbSnxit.js → alert-dialog-CLo68ArF.js} +1 -1
  52. package/dist/client/assets/{app-editor-gcuEY9pT.js → app-editor-BSkfyJUG.js} +1 -1
  53. package/dist/client/assets/{auth-Czzx0j0k.js → auth-Cz9MUOH5.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-BjP7QUb6.js → auth-catchall-BIi2h9s3.js} +1 -1
  55. package/dist/client/assets/{auth-entry-thK0sQBN.js → auth-entry-CzqhITib.js} +1 -1
  56. package/dist/client/assets/{auth-split-layout-CucSluN0.js → auth-split-layout-BRyLNUwV.js} +1 -1
  57. package/dist/client/assets/{authenticate-and-persist-oauth-BVTKYLto.js → authenticate-and-persist-oauth-QRlskZE_.js} +1 -1
  58. package/dist/client/assets/{automation-list-row-LCWziqcp.js → automation-list-row-D0YQZG_t.js} +1 -1
  59. package/dist/client/assets/{automation-runs-BIEKHb6d.js → automation-runs-BB4tZxlE.js} +1 -1
  60. package/dist/client/assets/{automations-CP7ov8Lx.js → automations-BZcwZ-Od.js} +1 -1
  61. package/dist/client/assets/{avatar-BRD9KdBU.js → avatar-qGQm5tob.js} +1 -1
  62. package/dist/client/assets/{badge-DDwsRXNR.js → badge-66rG3iWT.js} +1 -1
  63. package/dist/client/assets/{block-document-CecHU1PK.js → block-document-Cm_jusyJ.js} +1 -1
  64. package/dist/client/assets/{brand-context-CJHfDs6l.js → brand-context-BqNKSG9k.js} +1 -1
  65. package/dist/client/assets/{buckets-Ahb6rM_Y.js → buckets-BGXJu3d4.js} +1 -1
  66. package/dist/client/assets/{bulk-category-panel-DsQFT-Hf.js → bulk-category-panel-XvJ7By1M.js} +1 -1
  67. package/dist/client/assets/{calendar-BrKnCkWQ.js → calendar-CzpAjlxQ.js} +1 -1
  68. package/dist/client/assets/{capability-load-error-Cp_g8FRh.js → capability-load-error-CGTFJhIa.js} +1 -1
  69. package/dist/client/assets/{card-BTSKivkX.js → card-Ci1lZJg4.js} +1 -1
  70. package/dist/client/assets/{category-editor-hsY7reYC.js → category-editor-DYVz_gOe.js} +1 -1
  71. package/dist/client/assets/{chat-context-6SXYx23Y.js → chat-context-8rUWDM2F.js} +1 -1
  72. package/dist/client/assets/{checkbox-CBK2tfcP.js → checkbox-BaGAZdHF.js} +1 -1
  73. package/dist/client/assets/{cli-auth-success-D3UHqcMt.js → cli-auth-success-D8-_HLB1.js} +1 -1
  74. package/dist/client/assets/{collection-detail-DrTl48DA.js → collection-detail-BDkIUc9G.js} +1 -1
  75. package/dist/client/assets/{collection-display-button-CPZFWju5.js → collection-display-button-D7yWJ9_C.js} +1 -1
  76. package/dist/client/assets/{collection-search-BMiVgOB1.js → collection-search-CadXW_fq.js} +1 -1
  77. package/dist/client/assets/{collection-table-wrapper-g19JCIIU.js → collection-table-wrapper-CFX4HclN.js} +1 -1
  78. package/dist/client/assets/{collection-tabs-DUqXcfp3.js → collection-tabs-CoBnKZKn.js} +1 -1
  79. package/dist/client/assets/{command-4dtI7K4X.js → command-DM53UzIu.js} +1 -1
  80. package/dist/client/assets/{commerce-onboarding-B169h72H.js → commerce-onboarding-DgpUymib.js} +1 -1
  81. package/dist/client/assets/{companions-core-BjD1nv-H.js → companions-core-CKPOUArc.js} +1 -1
  82. package/dist/client/assets/{connect-O-_wEa7t.js → connect-DjyEX_0G.js} +1 -1
  83. package/dist/client/assets/{connect-desktop-dialog-EmUPMW7h.js → connect-desktop-dialog-GV9ICvaM.js} +1 -1
  84. package/dist/client/assets/{connection-byi4sTeQ.js → connection-Cg-LX4zr.js} +1 -1
  85. package/dist/client/assets/{connection-card-B7IQPsIT.js → connection-card-DhrUKXbn.js} +1 -1
  86. package/dist/client/assets/{connection-detail-gBSOppOt.js → connection-detail-DcWby86r.js} +1 -1
  87. package/dist/client/assets/{connection-form-helpers-BuAcwq2m.js → connection-form-helpers-C5m7rYZy.js} +1 -1
  88. package/dist/client/assets/{connections-l-379sH1.js → connections-CUTRuKYm.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-ryBZ2XcK.js → decopilot-sse-pool-BSWVee71.js} +1 -1
  90. package/dist/client/assets/{dialog-BrzGrjwQ.js → dialog-BxTzgMQc.js} +1 -1
  91. package/dist/client/assets/{domain-settings-6iuPQvRk.js → domain-settings-CV5zJhRX.js} +1 -1
  92. package/dist/client/assets/{drawer-BzRyXmUT.js → drawer-CJiwuDdN.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-1UOTocN9.js → dropdown-menu-B4RxTCSq.js} +1 -1
  94. package/dist/client/assets/{empty-state-CF1KfjKx.js → empty-state-CTXAxK95.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-_-65OKSK.js → extract-connection-data-RnIuisTy.js} +1 -1
  96. package/dist/client/assets/{file-explorer-DkHfsjHS.js → file-explorer-uv_H1vB7.js} +1 -1
  97. package/dist/client/assets/{form-BX8qMoto.js → form-DQKD1v0g.js} +1 -1
  98. package/dist/client/assets/{general-BnU1vX54.js → general-BPr6qxJo.js} +1 -1
  99. package/dist/client/assets/{github-repo-picker-BobG4pdj.js → github-repo-picker-Co6hb63c.js} +1 -1
  100. package/dist/client/assets/{hooks-BVS2tyiL.js → hooks-CHAv4NGW.js} +1 -1
  101. package/dist/client/assets/{index-BX05btf2.js → index-7ySSB_wV.js} +1 -1
  102. package/dist/client/assets/{index-DWYyxUr4.js → index-B1Pu947Q.js} +1 -1
  103. package/dist/client/assets/{index-CkQPHwRq.js → index-BNgXKQGi.js} +1 -1
  104. package/dist/client/assets/{index-B4SL8vna.js → index-BaBe80UU.js} +3 -3
  105. package/dist/client/assets/{index-BArJ9zM9.js → index-BewecO7v.js} +39 -39
  106. package/dist/client/assets/{index-NEHd_tvO.js → index-Bj16BBtO.js} +1 -1
  107. package/dist/client/assets/{index-aAdudEgA.js → index-BuLlGRwx.js} +1 -1
  108. package/dist/client/assets/{index-j7fxIdzH.js → index-CL1Jslvp.js} +1 -1
  109. package/dist/client/assets/{index-DEu8RRM_.js → index-CTrHbDcT.js} +1 -1
  110. package/dist/client/assets/{index-BhyteG24.js → index-DAf4hRwd.js} +1 -1
  111. package/dist/client/assets/{index-DH1sjrfb.js → index-DUUMVVf8.js} +6 -6
  112. package/dist/client/assets/{index-redirect-C9GYbflf.js → index-redirect-kSXc5CQI.js} +1 -1
  113. package/dist/client/assets/{input-Ds8gG1fd.js → input-CnmLY31M.js} +1 -1
  114. package/dist/client/assets/{integration-icon-8Ti4QWx2.js → integration-icon-D8ziNv4e.js} +1 -1
  115. package/dist/client/assets/{invite-member-dialog-DnWyyZ2q.js → invite-member-dialog-CAI8atEf.js} +1 -1
  116. package/dist/client/assets/{label-Cvqartba.js → label-CtIzDrcX.js} +1 -1
  117. package/dist/client/assets/{layout-BYsroZAA.js → layout-CxNIjagx.js} +1 -1
  118. package/dist/client/assets/{login-D0YaQT9R.js → login-BwlmyKrx.js} +1 -1
  119. package/dist/client/assets/{mcp-oauth-BqRaTzNr.js → mcp-oauth-CCkq-PPq.js} +1 -1
  120. package/dist/client/assets/{members-Bg079RXh.js → members-PB_LDXIu.js} +1 -1
  121. package/dist/client/assets/{monaco-editor-BxLiuOeu.js → monaco-editor-RaZqssxu.js} +1 -1
  122. package/dist/client/assets/{monitoring-stats-row-BmqauNPl.js → monitoring-stats-row-BwyTITKy.js} +1 -1
  123. package/dist/client/assets/{multi-select-p2D2J4qv.js → multi-select-Bc2ULJcP.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-l30vedQM.js → oauth-callback-D12oe1rh.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-D8-j-H6i.js → oauth-callback-ai-provider-DDu5oMlE.js} +1 -1
  126. package/dist/client/assets/{onboarding-PS2gB57L.js → onboarding-BsGu5CIv.js} +1 -1
  127. package/dist/client/assets/{org-install-BV6HqSmd.js → org-install-B_UnHFzM.js} +1 -1
  128. package/dist/client/assets/{org-layout--zgqB30e.js → org-layout-DFjKY9G0.js} +1 -1
  129. package/dist/client/assets/{organization-choice-Svkx4ABU.js → organization-choice-D8VKKjij.js} +1 -1
  130. package/dist/client/assets/{orgs-CVgI1V5J.js → orgs-DRyKnjXZ.js} +1 -1
  131. package/dist/client/assets/{page-seo-form-D72Ej1dW.js → page-seo-form-CE-uaaSZ.js} +1 -1
  132. package/dist/client/assets/{popover-Cl5Mc9gd.js → popover-E3JPeoM_.js} +1 -1
  133. package/dist/client/assets/{post-editor-DCGf0zG0.js → post-editor-DmtkpxyQ.js} +1 -1
  134. package/dist/client/assets/{primitives-il0pwDNO.js → primitives-HbonJ6H3.js} +1 -1
  135. package/dist/client/assets/{profile-Dx_h1RZ2.js → profile-BQdPECxi.js} +1 -1
  136. package/dist/client/assets/project-app-view-B1lZU9VM.js +1 -0
  137. package/dist/client/assets/record-editor-BAsNjdjV.js +1 -0
  138. package/dist/client/assets/{redirect-editor-CSl2En1s.js → redirect-editor-77s4t1K9.js} +1 -1
  139. package/dist/client/assets/registry-CEz_-21i.js +2 -0
  140. package/dist/client/assets/{registry-layout-CKtMXK7N.js → registry-layout-DYgygQJb.js} +1 -1
  141. package/dist/client/assets/{reports-BZIMcYC6.js → reports-CgGoEKZA.js} +1 -1
  142. package/dist/client/assets/{require-capability-BMA8i9zx.js → require-capability-0koYWXxZ.js} +1 -1
  143. package/dist/client/assets/{required-auth-layout-Cmvklk1H.js → required-auth-layout-mi5ZHwMW.js} +1 -1
  144. package/dist/client/assets/{reset-password-BXHuVIh6.js → reset-password-C8kyrQo7.js} +1 -1
  145. package/dist/client/assets/{roles-TsMY4Rff.js → roles-GJBfty57.js} +1 -1
  146. package/dist/client/assets/{search-input-5sC2b3i6.js → search-input-DQndNQ0y.js} +1 -1
  147. package/dist/client/assets/{secrets-Ci6occuz.js → secrets-BcGUKHvi.js} +1 -1
  148. package/dist/client/assets/{sections-editor-IjywG33X.js → sections-editor-tm2zRXuE.js} +1 -1
  149. package/dist/client/assets/{select-olxknRSu.js → select-BIIO90wp.js} +1 -1
  150. package/dist/client/assets/{select-model-BtItpQ7d.js → select-model-DpYmAjaB.js} +2 -2
  151. package/dist/client/assets/{self-tool-result-7ZjSBZgb.js → self-tool-result-C6NpfXvm.js} +1 -1
  152. package/dist/client/assets/{seo-editor-0isBtajP.js → seo-editor-B3mCpkuz.js} +1 -1
  153. package/dist/client/assets/{settings-layout-TAJFdLbr.js → settings-layout-DN2z8Sla.js} +1 -1
  154. package/dist/client/assets/{settings-section-hfb-XBqr.js → settings-section-Bq6IN2K4.js} +1 -1
  155. package/dist/client/assets/{shell-controls-BIxFtA6H.js → shell-controls-CRmVnIWH.js} +1 -1
  156. package/dist/client/assets/{shell-layout-qVfaRC7R.js → shell-layout-CODOAxB8.js} +1 -1
  157. package/dist/client/assets/{sidebar-CTPjB5Wi.js → sidebar-ldg-_gcB.js} +1 -1
  158. package/dist/client/assets/{skeleton-Bd8P_P_y.js → skeleton-DSYUICHh.js} +1 -1
  159. package/dist/client/assets/{sso-jaCnGSte.js → sso-ixn9OUuX.js} +1 -1
  160. package/dist/client/assets/{store-BkDs22GB.js → store-CqlPg4Jm.js} +1 -1
  161. package/dist/client/assets/store-registry-BNQsgs3Z.js +2 -0
  162. package/dist/client/assets/{studio-tools-9kid8z0N.js → studio-tools-C5EOIT8V.js} +1 -1
  163. package/dist/client/assets/{switch-Y5xPOTg7.js → switch-DP_H4qok.js} +1 -1
  164. package/dist/client/assets/{tab-id-DBqKadVL.js → tab-id-C6_7L5LO.js} +1 -1
  165. package/dist/client/assets/{table-DoghpL6K.js → table-IQ1eq-kq.js} +1 -1
  166. package/dist/client/assets/{tabs-C35o5sKq.js → tabs-DCBH6SAb.js} +1 -1
  167. package/dist/client/assets/{textarea-DQv6de7L.js → textarea-mjweOaPi.js} +1 -1
  168. package/dist/client/assets/{toggle-group-CU6SdkqY.js → toggle-group-CbDPcMqH.js} +1 -1
  169. package/dist/client/assets/{toolbar-B61OGwWM.js → toolbar-Cw1AJgYM.js} +1 -1
  170. package/dist/client/assets/{tooltip-BcvemS6N.js → tooltip-W2R86GKd.js} +1 -1
  171. package/dist/client/assets/{use-ai-providers-BVw2CHin.js → use-ai-providers-lrxkqJ6z.js} +1 -1
  172. package/dist/client/assets/{use-api-keys-lN_blV1M.js → use-api-keys-BR3TF35O.js} +1 -1
  173. package/dist/client/assets/{use-automations-DU90KoX7.js → use-automations-DxXx_lHD.js} +1 -1
  174. package/dist/client/assets/{use-autosave-ChqIro0p.js → use-autosave-DSRh0RXM.js} +1 -1
  175. package/dist/client/assets/{use-capability-Ck-Xwe4D.js → use-capability-Kmrr2_DL.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-D_NPoqnV.js → use-clock-tick-BKCswZqG.js} +1 -1
  177. package/dist/client/assets/{use-connection-PubjDNyw.js → use-connection-CLpbKsOa.js} +1 -1
  178. package/dist/client/assets/{use-copy-yeEn1d7I.js → use-copy-Ctcxuxud.js} +1 -1
  179. package/dist/client/assets/{use-create-virtual-mcp-GVgzjyVg.js → use-create-virtual-mcp-Bo9StMVq.js} +1 -1
  180. package/dist/client/assets/{use-debounced-autosave-HxnxsdJJ.js → use-debounced-autosave-RLi4BVRQ.js} +1 -1
  181. package/dist/client/assets/{use-debounced-value-Dr_-z1cL.js → use-debounced-value-CF1gvVc7.js} +1 -1
  182. package/dist/client/assets/{use-deco-credits-B0cJCElK.js → use-deco-credits-BncCMCeP.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-DYiQ_xOP.js → use-decopilot-events-Cmb-e7V8.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-BKBG41XQ.js → use-delete-connection-DXoT9PVi.js} +1 -1
  185. package/dist/client/assets/{use-deployment-admin-D-6qobkw.js → use-deployment-admin-CwpZWZN0.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-Cn51f1d2.js → use-file-configs-CZm1ErSy.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-l8bvKhVB.js → use-infinite-scroll-Duo-6Jh0.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-CY2eYfZF.js → use-join-requests-BiNZX6-t.js} +1 -1
  189. package/dist/client/assets/{use-mcp-auth-status-akmi11me.js → use-mcp-auth-status-EUDH_JPu.js} +1 -1
  190. package/dist/client/assets/{use-mcp-client-DGM7YU-F.js → use-mcp-client-Bn_fKie9.js} +1 -1
  191. package/dist/client/assets/{use-mcp-tools-DRHPvVvo.js → use-mcp-tools-DeNxG47-.js} +1 -1
  192. package/dist/client/assets/{use-members-DQAFdnQe.js → use-members-CD6ZyOrK.js} +1 -1
  193. package/dist/client/assets/{use-mobile-DpM0EKIv.js → use-mobile-By0ugXDS.js} +1 -1
  194. package/dist/client/assets/{use-navigate-to-agent-hZe3bwKG.js → use-navigate-to-agent-DKnGfo5A.js} +1 -1
  195. package/dist/client/assets/{use-org-auth-client-DQdwaOVQ.js → use-org-auth-client-BTsOFju1.js} +1 -1
  196. package/dist/client/assets/{use-org-sso-udDavLyS.js → use-org-sso-BLgobVS7.js} +1 -1
  197. package/dist/client/assets/{use-organization-roles-T6wafrzs.js → use-organization-roles-Be81sAA5.js} +1 -1
  198. package/dist/client/assets/{use-organization-settings-e7cKE1EV.js → use-organization-settings-DxCjQA-p.js} +1 -1
  199. package/dist/client/assets/{use-registry-app-CWkIAq8u.js → use-registry-app-CiFGb0BH.js} +1 -1
  200. package/dist/client/assets/{use-registry-connections-CWu2QJNH.js → use-registry-connections-BtAhGlNY.js} +1 -1
  201. package/dist/client/assets/{use-secrets-CtItzADM.js → use-secrets-CGGmczJZ.js} +1 -1
  202. package/dist/client/assets/{use-status-sounds-DwuhuX2o.js → use-status-sounds-C6gn0U8N.js} +1 -1
  203. package/dist/client/assets/{use-view-mode-C9E6Ia8X.js → use-view-mode-2IyCcfB4.js} +1 -1
  204. package/dist/client/assets/{use-virtual-mcp-DYFy1B5_.js → use-virtual-mcp-DRku4bc3.js} +1 -1
  205. package/dist/client/assets/useInfiniteQuery-C3930CkE.js +1 -0
  206. package/dist/client/assets/{useQueries-Yq2sCMyy.js → useQueries-B2OSOrpG.js} +1 -1
  207. package/dist/client/assets/{useRouterState-1NjQlc4i.js → useRouterState-DYLxn-4w.js} +1 -1
  208. package/dist/client/assets/useSuspenseInfiniteQuery-CayL-QrT.js +1 -0
  209. package/dist/client/assets/{users-BvhyZKaa.js → users-BG8U0FQd.js} +1 -1
  210. package/dist/client/assets/{variant-calendar-CNISXfPR.js → variant-calendar-DLh6-t_H.js} +1 -1
  211. package/dist/client/assets/{view-mode-toggle-Dt9bWWxZ.js → view-mode-toggle-B14_Ky0k.js} +1 -1
  212. package/dist/client/index.html +1 -1
  213. package/dist/server/cli.js +503 -500
  214. package/dist/server/server.js +381 -381
  215. package/package.json +1 -1
  216. package/dist/client/assets/project-app-view-CgywXL9B.js +0 -1
  217. package/dist/client/assets/record-editor-B4PjiId1.js +0 -1
  218. package/dist/client/assets/registry-7XTCklCD.js +0 -2
  219. package/dist/client/assets/store-registry-BNNG_XJq.js +0 -2
  220. package/dist/client/assets/useInfiniteQuery-BSb7U3ZZ.js +0 -1
  221. package/dist/client/assets/useSuspenseInfiniteQuery-2-LAq09Z.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as V,ag as xt,c as G,b as se,j as s,X as He,Y as ve,F as xe,o as Ie,Z as qe,_ as Ge,e as ke,K as ce,t as le,B as ne,p as ie,D as gt,m as oe,n as vt,d as bt,E as yt,z as jt}from"./index-DH1sjrfb.js";import{c as Xe,e as Ye,d as Qe,a as St,b as Je,h as Nt,D as kt}from"./dialog-BrzGrjwQ.js";import{d as Ct,b as wt,a as It,D as _t}from"./drawer-BzRyXmUT.js";import{u as Mt}from"./use-mobile-DpM0EKIv.js";import{S as Le,u as Et,D as Ot,a as _e}from"./chat-context-6SXYx23Y.js";import{C as Pt}from"./checkbox-CBK2tfcP.js";import{I as pe}from"./input-Ds8gG1fd.js";import{S as Lt,a as At,b as Tt,c as zt,d as Rt}from"./select-olxknRSu.js";import{S as te}from"./skeleton-Bd8P_P_y.js";import{i as Ze,b as et,c as Ft,a as Dt,s as Kt}from"./Settings02-BLjXGanZ.js";import{d as $t,a as Ut,b as Bt,i as Wt}from"./Tool01-DvOYqvtL.js";import{i as Vt}from"./Key01-D3otsQjQ.js";import{i as tt}from"./SearchMd-DTzUg0rC.js";import{d as Me,u as Ht,b as qt}from"./use-ai-providers-BVw2CHin.js";import{g as Ee}from"./ai-providers-logos-DD3qZ33J.js";import{i as Gt}from"./Monitor01-B9Ngi6RN.js";import{i as Xt}from"./AlertCircle-BqXz_QW3.js";import{u as we}from"./studio-tools-9kid8z0N.js";import{i as Yt}from"./ChevronRight-DQRrACFJ.js";import{A as Qt}from"./avatar-BRD9KdBU.js";import{S as Ae,a as Te,b as st}from"./settings-section-hfb-XBqr.js";import{s as it}from"./Eye-CgfFpeGb.js";import{a as Se,b as Ne,C as Jt}from"./connect-desktop-dialog-EmUPMW7h.js";import{t as ze}from"./ChevronDown-sGinN19i.js";import{t as Zt}from"./Stars01-Bk7jyFCH.js";function fe(l,e,t){let i=t.initialDeps??[],o,n=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const h=l();if(!(h.length!==i.length||h.some((f,b)=>i[b]!==f)))return o;i=h;let m;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(m=Date.now()),o=e(...h),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-m)*100)/100,k=b/16,y=(S,I)=>{for(S=String(S);S.length<I;)S=" "+S;return S};console.info(`%c⏱ ${y(b,5)} /${y(f,5)} ms`,`
1
+ import{r as V,ag as xt,c as G,b as se,j as s,X as He,Y as ve,F as xe,o as Ie,Z as qe,_ as Ge,e as ke,K as ce,t as le,B as ne,p as ie,D as gt,m as oe,n as vt,d as bt,E as yt,z as jt}from"./index-DUUMVVf8.js";import{c as Xe,e as Ye,d as Qe,a as St,b as Je,h as Nt,D as kt}from"./dialog-BxTzgMQc.js";import{d as Ct,b as wt,a as It,D as _t}from"./drawer-CJiwuDdN.js";import{u as Mt}from"./use-mobile-By0ugXDS.js";import{S as Le,u as Et,D as Ot,a as _e}from"./chat-context-8rUWDM2F.js";import{C as Pt}from"./checkbox-BaGAZdHF.js";import{I as pe}from"./input-CnmLY31M.js";import{S as Lt,a as At,b as Tt,c as zt,d as Rt}from"./select-BIIO90wp.js";import{S as te}from"./skeleton-DSYUICHh.js";import{i as Ze,b as et,c as Ft,a as Dt,s as Kt}from"./Settings02-epU11QVl.js";import{d as $t,a as Ut,b as Bt,i as Wt}from"./Tool01-DV88LwAF.js";import{i as Vt}from"./Key01-DrXVRZX2.js";import{i as tt}from"./SearchMd-FZNYglTs.js";import{d as Me,u as Ht,b as qt}from"./use-ai-providers-lrxkqJ6z.js";import{g as Ee}from"./ai-providers-logos-DD3qZ33J.js";import{i as Gt}from"./Monitor01-0a0QOsYs.js";import{i as Xt}from"./AlertCircle-DcC27WmA.js";import{u as we}from"./studio-tools-C5EOIT8V.js";import{i as Yt}from"./ChevronRight-COrmV1RX.js";import{A as Qt}from"./avatar-qGQm5tob.js";import{S as Ae,a as Te,b as st}from"./settings-section-Bq6IN2K4.js";import{s as it}from"./Eye-CPyHsNx9.js";import{a as Se,b as Ne,C as Jt}from"./connect-desktop-dialog-GV9ICvaM.js";import{t as ze}from"./ChevronDown-CvsGy9_V.js";import{t as Zt}from"./Stars01-DIPcXJk_.js";function fe(l,e,t){let i=t.initialDeps??[],o,n=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const h=l();if(!(h.length!==i.length||h.some((f,b)=>i[b]!==f)))return o;i=h;let m;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(m=Date.now()),o=e(...h),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-m)*100)/100,k=b/16,y=(S,I)=>{for(S=String(S);S.length<I;)S=" "+S;return S};console.info(`%c⏱ ${y(b,5)} /${y(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(o),n=!1,o}return r.updateDeps=c=>{i=c},r}function Re(l,e){if(l===void 0)throw new Error("Unexpected undefined");return l}const es=(l,e)=>Math.abs(l-e)<1.01,ts=(l,e,t)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>e.apply(this,o),t)}},Fe=l=>{const{offsetWidth:e,offsetHeight:t}=l;return{width:e,height:t}},ss=l=>l,is=l=>{const e=Math.max(l.startIndex-l.overscan,0),t=Math.min(l.endIndex+l.overscan,l.count-1),i=[];for(let o=e;o<=t;o++)i.push(o);return i},ls=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;const o=r=>{const{width:c,height:u}=r;e({width:Math.round(c),height:Math.round(u)})};if(o(Fe(t)),!i.ResizeObserver)return()=>{};const n=new i.ResizeObserver(r=>{const c=()=>{const u=r[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Fe(t))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},De={passive:!0},Ke=typeof window>"u"?!0:"onscrollend"in window,ns=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;let o=0;const n=l.options.useScrollendEvent&&Ke?()=>{}:ts(i,()=>{e(o,!1)},l.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:h,isRtl:p}=l.options;o=h?t.scrollLeft*(p&&-1||1):t.scrollTop,n(),e(o,a)},c=r(!0),u=r(!1);t.addEventListener("scroll",c,De);const d=l.options.useScrollendEvent&&Ke;return d&&t.addEventListener("scrollend",u,De),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",u)}},os=(l,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return l[t.options.horizontal?"offsetWidth":"offsetHeight"]},rs=(l,{adjustments:e=0,behavior:t},i)=>{var o,n;const r=l+e;(n=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||n.call(o,{[i.options.horizontal?"left":"top"]:r,behavior:t})};class as{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,o;return((o=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(n=>{const r=()=>{const c=n.target,u=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(c,n,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),t=null},observe:o=>{var n;return(n=i())==null?void 0:n.observe(o,{box:"border-box"})},unobserve:o=>{var n;return(n=i())==null?void 0:n.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,o])=>{typeof o>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ss,rangeExtractor:is,onChange:()=>{},measureElement:os,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,t)},this.maybeNotify=fe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=n,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const o=new Map,n=new Map;for(let r=i-1;r>=0;r--){const c=t[r];if(o.has(c.lane))continue;const u=n.get(c.lane);if(u==null||c.end>u.end?n.set(c.lane,c):c.end<u.end&&o.set(c.lane,!0),o.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=fe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,o,n,r,c,u)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:o,getItemKey:n,enabled:r,lanes:c,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=fe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:o,getItemKey:n,enabled:r,lanes:c,laneAssignmentMode:u},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,a),p=new Array(c).fill(void 0);for(let m=0;m<a;m++){const f=h[m];f&&(p[f.lane]=m)}for(let m=a;m<t;m++){const f=n(m),b=this.laneAssignments.get(m);let k,y;const S=u==="estimate"||d.has(f);if(b!==void 0&&this.options.lanes>1){k=b;const _=p[k],x=_!==void 0?h[_]:void 0;y=x?x.end+this.options.gap:i+o}else{const _=this.options.lanes===1?h[m-1]:this.getFurthestMeasurement(h,m);y=_?_.end+this.options.gap:i+o,k=_?_.lane:m%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(m,k)}const I=d.get(f),P=typeof I=="number"?I:this.options.estimateSize(m),E=y+P;h[m]={index:m,start:y,size:P,end:E,key:f,lane:k},p[k]=m}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=fe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,o,n)=>this.range=t.length>0&&i>0?cs({measurements:t,outerSize:i,scrollOffset:o,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=fe(()=>{let t=null,i=null;const o=this.calculateRange();return o&&(t=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,o,n,r)=>n===null||r===null?[]:t({startIndex:n,endIndex:r,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,o=t.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,o-n),c=Math.min(this.options.count-1,o+n);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const i=this.indexFromElement(t),o=this.options.getItemKey(i),n=this.elementsCache.get(o);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var o;const n=this.measurementsCache[t];if(!n)return;const r=this.itemSizeCache.get(n.key)??n.size,c=i-r;c!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,c,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,i)),this.notify(!1))},this.getVirtualItems=fe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const o=[];for(let n=0,r=t.length;n<r;n++){const c=t[n],u=i[c];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Re(i[lt(0,i.length-1,o=>Re(i[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,o=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=t>=r+n?"end":"start"),i==="center"?t+=(o-n)/2:i==="end"&&(t-=n);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),n=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(i==="auto")if(r.end>=n+o-this.options.scrollPaddingEnd)i="end";else if(r.start<=n+this.options.scrollPaddingStart)i="start";else return[n,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const c=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,i,r.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:o="auto"}={})=>{const n=this.getOffsetForAlignment(t,i),r=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getOffsetForIndex(t,i);if(!n)return;const[r,c]=n,u=this.now();this.scrollState={index:t,align:c,behavior:o,startedAt:u,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:n,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=i[i.length-1])==null?void 0:t.end)??0;else{const n=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&n.some(c=>c===null);){const c=i[r];n[c.lane]===null&&(n[c.lane]=c.end),r--}o=Math.max(...n.filter(c=>c!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,n=1,r=o!==this.scrollState.lastTargetOffset;if(!r&&es(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const lt=(l,e,t,i)=>{for(;l<=e;){const o=(l+e)/2|0,n=t(o);if(n<i)l=o+1;else if(n>i)e=o-1;else return o}return l>0?l-1:0};function cs({measurements:l,outerSize:e,scrollOffset:t,lanes:i}){const o=l.length-1,n=u=>l[u].start;if(l.length<=i)return{startIndex:0,endIndex:o};let r=lt(0,o,n,t),c=r;if(i===1)for(;c<o&&l[c].end<t+e;)c++;else if(i>1){const u=Array(i).fill(0);for(;c<o&&u.some(a=>a<t+e);){const a=l[c];u[a.lane]=a.end,c++}const d=Array(i).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=l[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%i),c=Math.min(o,c+(i-1-c%i))}return{startIndex:r,endIndex:c}}const $e=typeof document<"u"?V.useLayoutEffect:V.useEffect;function ds({useFlushSync:l=!0,...e}){const t=V.useReducer(()=>({}),{})[1],i={...e,onChange:(n,r)=>{var c;l&&r?xt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,n,r)}},[o]=V.useState(()=>new as(i));return o.setOptions(i),$e(()=>o._didMount(),[]),$e(()=>o._willUpdate()),o}function us(l){return ds({observeElementRect:ls,observeElementOffset:ns,scrollToFn:rs,...l})}const nt=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(l){if(l)return nt.find(e=>e.id===l)}const Ue=4;function ge(l){const e=G.c(8),{logo:t,name:i,description:o,onClick:n}=l;let r;e[0]!==t||e[1]!==i?(r=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Qt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=r):r=e[2];let c;return e[3]!==o||e[4]!==i||e[5]!==n||e[6]!==r?(c=s.jsx(st,{onClick:n,icon:r,title:i,description:o}),e[3]=o,e[4]=i,e[5]=n,e[6]=r,e[7]=c):c=e[7],c}function ot(l){const e=G.c(38),{providers:t,onSelect:i,onShowAll:o}=l,n=se();let r;e[0]!==t?(r=t.find(ps),e[0]=t,e[1]=r):r=e[1];const c=r;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=u):u=e[2];const d=u;let a;if(e[3]!==i||e[4]!==t||e[5]!==n){let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=(j,w)=>{const T=d[j.id]??Number.MAX_SAFE_INTEGER,A=d[w.id]??Number.MAX_SAFE_INTEGER;return T-A},e[7]=P):P=e[7];const E=t.filter(fs).sort(P);let _;e[8]!==t?(_=t.find(hs),e[8]=t,e[9]=_):_=e[9];const x=_;let N;e[10]===Symbol.for("react.memo_cache_sentinel")?(N=be("openai"),e[10]=N):N=e[10];const C=N;let M;e[11]!==i?(M=j=>s.jsx(ge,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"provider",provider:j})},j.id),e[11]=i,e[12]=M):M=e[12];let v;e[13]!==i||e[14]!==x?(v=x&&C?[s.jsx(ge,{logo:C.logo,name:C.name,description:C.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:C})},C.id)]:[],e[13]=i,e[14]=x,e[15]=v):v=e[15];let g;e[16]!==i||e[17]!==x||e[18]!==n?(g=x?[...nt.filter(ms).map(j=>s.jsx(ge,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:j})},j.id)),s.jsx(ge,{logo:x.logo,name:n("settings.aiProviders.customOpenAiCompatible"),description:n("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=n,e[19]=g):g=e[19],a=[...E.map(M),...v,...g],e[3]=i,e[4]=t,e[5]=n,e[6]=a}else a=e[6];const h=a,p=h.length-Ue,m=!!o&&p>0;let f;e[20]!==h||e[21]!==m?(f=m?h.slice(0,Ue):h,e[20]=h,e[21]=m,e[22]=f):f=e[22];const b=f;let k;e[23]!==c||e[24]!==i||e[25]!==n?(k=c&&s.jsx(Ae,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:n("settings.aiProviders.recommended")}),s.jsx(Te,{className:"relative",children:s.jsx(ge,{logo:c.logo,name:c.name,description:c.description,onClick:()=>i({kind:"provider",provider:c})})})]})}),e[23]=c,e[24]=i,e[25]=n,e[26]=k):k=e[26];let y;e[27]!==p||e[28]!==o||e[29]!==m||e[30]!==n?(y=m&&s.jsx(st,{onClick:o,title:n("settings.aiProviders.moreProviders",{count:p,plural:p===1?"":"s"}),action:s.jsx(Yt,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=m,e[30]=n,e[31]=y):y=e[31];let S;e[32]!==y||e[33]!==b?(S=s.jsx(Ae,{children:s.jsxs(Te,{children:[b,y]})}),e[32]=y,e[33]=b,e[34]=S):S=e[34];let I;return e[35]!==k||e[36]!==S?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[k,S]}),e[35]=k,e[36]=S,e[37]=I):I=e[37],I}function ms(l){return l.id!=="openai"}function hs(l){return l.id==="openai-compatible"}function fs(l){return l.id!=="deco"&&l.id!=="openai-compatible"}function ps(l){return l.id==="deco"}const xs=He({label:ve().optional(),apiKey:ve().min(1,"API key is required")});function gs(l){const e=G.c(87),{providerId:t,onCancel:i,onSuccess:o}=l,{org:n}=xe(),r=we(),c=Ie(),[u,d]=V.useState(!1),a=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={resolver:qe(xs),defaultValues:{label:"",apiKey:""}},e[0]=h):h=e[0];const{register:p,handleSubmit:m,formState:f}=Ge(h),{errors:b}=f;let k;e[1]!==t||e[2]!==r||e[3]!==a?(k=async U=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:U.label||a("settings.connectForms.defaultKeyLabel"),apiKey:U.apiKey})},e[1]=t,e[2]=r,e[3]=a,e[4]=k):k=e[4];let y;e[5]!==o||e[6]!==n||e[7]!==c||e[8]!==a?(y=()=>{c.invalidateQueries({queryKey:ce.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:ce.aiProviders(n.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[5]=o,e[6]=n,e[7]=c,e[8]=a,e[9]=y):y=e[9];let S;e[10]!==a?(S=U=>{le.error(a("settings.connectForms.failedSaveKey",{error:U.message}))},e[10]=a,e[11]=S):S=e[11];let I;e[12]!==k||e[13]!==y||e[14]!==S?(I={mutationFn:k,onSuccess:y,onError:S},e[12]=k,e[13]=y,e[14]=S,e[15]=I):I=e[15];const{mutate:P,isPending:E,error:_}=ke(I);let x;e[16]!==P?(x=U=>P(U),e[16]=P,e[17]=x):x=e[17];let N;e[18]!==m||e[19]!==x?(N=m(x),e[18]=m,e[19]=x,e[20]=N):N=e[20];let C;e[21]!==a?(C=a("settings.connectForms.labelField"),e[21]=a,e[22]=C):C=e[22];let M;e[23]!==C?(M=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:C}),e[23]=C,e[24]=M):M=e[24];let v;e[25]!==a?(v=a("settings.connectForms.labelPlaceholder"),e[25]=a,e[26]=v):v=e[26];let g;e[27]!==p?(g=p("label"),e[27]=p,e[28]=g):g=e[28];let j;e[29]!==v||e[30]!==g?(j=s.jsx(pe,{placeholder:v,...g,className:"h-8 text-sm"}),e[29]=v,e[30]=g,e[31]=j):j=e[31];let w;e[32]!==M||e[33]!==j?(w=s.jsxs("div",{className:"space-y-1",children:[M,j]}),e[32]=M,e[33]=j,e[34]=w):w=e[34];let T;e[35]!==a?(T=a("settings.connectForms.apiKeyField"),e[35]=a,e[36]=T):T=e[36];let A;e[37]!==T?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[37]=T,e[38]=A):A=e[38];const O=u?"text":"password";let z;e[39]!==p?(z=p("apiKey"),e[39]=p,e[40]=z):z=e[40];let F;e[41]!==O||e[42]!==z?(F=s.jsx(pe,{type:O,placeholder:"sk-...",...z,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=O,e[42]=z,e[43]=F):F=e[43];let K;e[44]!==u?(K=()=>d(!u),e[44]=u,e[45]=K):K=e[45];let R;e[46]!==u||e[47]!==a?(R=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=u,e[47]=a,e[48]=R):R=e[48];let W;e[49]!==u?(W=u?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[49]=u,e[50]=W):W=e[50];let Q;e[51]!==K||e[52]!==R||e[53]!==W?(Q=s.jsx("button",{type:"button",onClick:K,"aria-label":R,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:W}),e[51]=K,e[52]=R,e[53]=W,e[54]=Q):Q=e[54];let J;e[55]!==F||e[56]!==Q?(J=s.jsxs("div",{className:"relative",children:[F,Q]}),e[55]=F,e[56]=Q,e[57]=J):J=e[57];let Z;e[58]!==b.apiKey?(Z=b.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[58]=b.apiKey,e[59]=Z):Z=e[59];let X;e[60]!==A||e[61]!==J||e[62]!==Z?(X=s.jsxs("div",{className:"space-y-1",children:[A,J,Z]}),e[60]=A,e[61]=J,e[62]=Z,e[63]=X):X=e[63];let ee;e[64]!==_?(ee=_&&s.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[64]=_,e[65]=ee):ee=e[65];let H;e[66]!==a?(H=a("settings.connectForms.cancel"),e[66]=a,e[67]=H):H=e[67];let q;e[68]!==E||e[69]!==i||e[70]!==H?(q=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:E,children:H}),e[68]=E,e[69]=i,e[70]=H,e[71]=q):q=e[71];let Y;e[72]!==E||e[73]!==a?(Y=a(E?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=E,e[73]=a,e[74]=Y):Y=e[74];let L;e[75]!==E||e[76]!==Y?(L=s.jsx(ne,{type:"submit",size:"sm",disabled:E,children:Y}),e[75]=E,e[76]=Y,e[77]=L):L=e[77];let D;e[78]!==q||e[79]!==L?(D=s.jsxs(Xe,{children:[q,L]}),e[78]=q,e[79]=L,e[80]=D):D=e[80];let $;return e[81]!==w||e[82]!==X||e[83]!==ee||e[84]!==D||e[85]!==N?($=s.jsxs("form",{onSubmit:N,className:"space-y-3",children:[w,X,ee,D]}),e[81]=w,e[82]=X,e[83]=ee,e[84]=D,e[85]=N,e[86]=$):$=e[86],$}const vs=He({label:ve().optional(),baseUrl:ve().min(1,"Base URL is required"),apiKey:ve().optional()});function bs(l){const e=G.c(105),{preset:t,onCancel:i,onSuccess:o}=l,{org:n}=xe(),r=we(),c=Ie(),[u,d]=V.useState(!1),a=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=qe(vs),e[0]=h):h=e[0];const p=t?.defaultBaseUrl??"";let m;e[1]!==p?(m={resolver:h,defaultValues:{label:"",baseUrl:p,apiKey:""}},e[1]=p,e[2]=m):m=e[2];const{register:f,handleSubmit:b,formState:k}=Ge(m),{errors:y}=k;let S;e[3]!==t||e[4]!==r?(S=async ae=>{const pt=JSON.stringify({baseUrl:ae.baseUrl,apiKey:ae.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ae.label||t?.name||ae.baseUrl,apiKey:pt,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=S):S=e[5];let I;e[6]!==o||e[7]!==n||e[8]!==c||e[9]!==a?(I=()=>{c.invalidateQueries({queryKey:ce.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:ce.aiProviders(n.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[6]=o,e[7]=n,e[8]=c,e[9]=a,e[10]=I):I=e[10];let P;e[11]!==a?(P=ae=>{le.error(a("settings.connectForms.failedSaveConnection",{error:ae.message}))},e[11]=a,e[12]=P):P=e[12];let E;e[13]!==S||e[14]!==I||e[15]!==P?(E={mutationFn:S,onSuccess:I,onError:P},e[13]=S,e[14]=I,e[15]=P,e[16]=E):E=e[16];const{mutate:_,isPending:x,error:N}=ke(E);let C;e[17]!==t||e[18]!==a?(C=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=a,e[19]=C):C=e[19];const M=C;let v;e[20]!==t?.baseUrlPlaceholder||e[21]!==a?(v=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=a,e[22]=v):v=e[22];const g=v;let j;e[23]!==_?(j=ae=>_(ae),e[23]=_,e[24]=j):j=e[24];let w;e[25]!==b||e[26]!==j?(w=b(j),e[25]=b,e[26]=j,e[27]=w):w=e[27];let T;e[28]!==a?(T=a("settings.connectForms.labelField"),e[28]=a,e[29]=T):T=e[29];let A;e[30]!==T?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[30]=T,e[31]=A):A=e[31];let O;e[32]!==f?(O=f("label"),e[32]=f,e[33]=O):O=e[33];let z;e[34]!==M||e[35]!==O?(z=s.jsx(pe,{placeholder:M,...O,className:"h-8 text-sm"}),e[34]=M,e[35]=O,e[36]=z):z=e[36];let F;e[37]!==A||e[38]!==z?(F=s.jsxs("div",{className:"space-y-1",children:[A,z]}),e[37]=A,e[38]=z,e[39]=F):F=e[39];let K;e[40]!==g||e[41]!==y||e[42]!==t?.defaultBaseUrl||e[43]!==f||e[44]!==a?(K=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...f("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),s.jsx(pe,{type:"url",placeholder:g,...f("baseUrl"),className:"h-8 text-sm"}),y.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[40]=g,e[41]=y,e[42]=t?.defaultBaseUrl,e[43]=f,e[44]=a,e[45]=K):K=e[45];let R;e[46]!==a?(R=a("settings.connectForms.apiKeyField"),e[46]=a,e[47]=R):R=e[47];let W;e[48]!==t?.apiKeyRecommended||e[49]!==a?(W=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=a,e[50]=W):W=e[50];let Q;e[51]!==W?(Q=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",W,")"]}),e[51]=W,e[52]=Q):Q=e[52];let J;e[53]!==R||e[54]!==Q?(J=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[R," ",Q]}),e[53]=R,e[54]=Q,e[55]=J):J=e[55];const Z=u?"text":"password";let X;e[56]!==f?(X=f("apiKey"),e[56]=f,e[57]=X):X=e[57];let ee;e[58]!==Z||e[59]!==X?(ee=s.jsx(pe,{type:Z,placeholder:"sk-...",...X,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=Z,e[59]=X,e[60]=ee):ee=e[60];let H;e[61]!==u?(H=()=>d(!u),e[61]=u,e[62]=H):H=e[62];let q;e[63]!==u||e[64]!==a?(q=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=u,e[64]=a,e[65]=q):q=e[65];let Y;e[66]!==u?(Y=u?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[66]=u,e[67]=Y):Y=e[67];let L;e[68]!==H||e[69]!==q||e[70]!==Y?(L=s.jsx("button",{type:"button",onClick:H,"aria-label":q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Y}),e[68]=H,e[69]=q,e[70]=Y,e[71]=L):L=e[71];let D;e[72]!==ee||e[73]!==L?(D=s.jsxs("div",{className:"relative",children:[ee,L]}),e[72]=ee,e[73]=L,e[74]=D):D=e[74];let $;e[75]!==J||e[76]!==D?($=s.jsxs("div",{className:"space-y-1",children:[J,D]}),e[75]=J,e[76]=D,e[77]=$):$=e[77];let U;e[78]!==t?(U=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=U):U=e[79];let B;e[80]!==N?(B=N&&s.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[80]=N,e[81]=B):B=e[81];let re;e[82]!==a?(re=a("settings.connectForms.cancel"),e[82]=a,e[83]=re):re=e[83];let de;e[84]!==x||e[85]!==i||e[86]!==re?(de=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:re}),e[84]=x,e[85]=i,e[86]=re,e[87]=de):de=e[87];let ue;e[88]!==x||e[89]!==a?(ue=a(x?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=x,e[89]=a,e[90]=ue):ue=e[90];let me;e[91]!==x||e[92]!==ue?(me=s.jsx(ne,{type:"submit",size:"sm",disabled:x,children:ue}),e[91]=x,e[92]=ue,e[93]=me):me=e[93];let he;e[94]!==de||e[95]!==me?(he=s.jsxs(Xe,{children:[de,me]}),e[94]=de,e[95]=me,e[96]=he):he=e[96];let ye;return e[97]!==w||e[98]!==F||e[99]!==K||e[100]!==$||e[101]!==U||e[102]!==B||e[103]!==he?(ye=s.jsxs("form",{onSubmit:w,className:"space-y-3",children:[F,K,$,U,B,he]}),e[97]=w,e[98]=F,e[99]=K,e[100]=$,e[101]=U,e[102]=B,e[103]=he,e[104]=ye):ye=e[104],ye}const ys={kind:"closed"};function js(l,e){switch(e.type){case"open":return l.kind==="closed"?{kind:"grid"}:l;case"close":return{kind:"closed"};case"back":switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return l}case"select-form":return l.kind!=="grid"?l:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return l.kind!=="grid"?l:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return l.kind==="oauth-pending"?{kind:"grid"}:l;case"select-provision":return l.kind!=="grid"?l:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return l.kind!=="provision-pending"?l:{kind:"provision-error",providerId:l.providerId,error:e.error};case"retry-provision":return l.kind!=="provision-error"?l:{kind:"provision-pending",providerId:l.providerId}}}function Ss(l){switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return l.providerId;default:return null}}function Ns({open:l,onOpenChange:e,initialProvider:t}){const i=se(),n=Me()?.providers??[],{org:r}=xe(),c=we(),u=Ie(),[d,a]=V.useReducer(js,ys),h=V.useRef(!1);V.useEffect(()=>{l&&d.kind==="closed"?a({type:"open"}):!l&&d.kind!=="closed"&&a({type:"close"})},[l,d.kind]);const p=()=>{h.current=!1,a({type:"close"}),e(!1)},m=()=>{u.invalidateQueries({queryKey:ce.aiProviderKeys(r.id)}),u.invalidateQueries({queryKey:ce.aiProviders(r.id)})},{mutate:f}=ke({mutationFn:async({providerId:v,code:g,stateToken:j,label:w})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:g,stateToken:j,label:w}),v),onSuccess:v=>{ie("ai_provider_oauth_succeeded",{provider_id:v}),m();const g=n.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_oauth_failed",{provider_id:g.providerId,error:v.message}),le.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),a({type:"oauth-failed"})}}),{mutate:b}=ke({mutationFn:async v=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{ie("ai_provider_provision_succeeded",{provider_id:v}),m();const g=n.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_provision_failed",{provider_id:g,error:v.message}),a({type:"provision-error",error:v.message})}}),k=async v=>{const{provider:g}=v,j=v.kind==="openai-compatible"?v.preset?.id??null:null,w=g.supportedMethods.includes("oauth-pkce"),T=g.supportedMethods.includes("api-key");if(g.supportsProvision===!0){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"provision"}),a({type:"select-provision",providerId:g.id}),b(g.id);return}if(w){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"oauth-pkce"});try{const O=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:g.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:g.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}T&&(ie("ai_provider_connect_clicked",{provider_id:g.id,...j!==null?{preset_id:j}:{},method:"api-key"}),a({type:"select-form",providerId:g.id,presetId:j}))},y=V.useRef(k);y.current=k;const S=V.useRef(t);S.current=t,V.useEffect(()=>{!S.current||d.kind!=="grid"||h.current||(h.current=!0,y.current(S.current))},[d.kind]);const I=d.kind==="oauth-pending"?d.stateToken:null,P=d.kind==="oauth-pending"?d.providerId:null;V.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const g=d.stateToken,j=d.providerId,w=A=>{if(A.origin!==window.location.origin||A.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:z}=A.data;if(z!==g){le.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}v=!0;const F=n.find(K=>K.id===j);f({providerId:j,code:O,stateToken:g,label:F?.name??j})};window.addEventListener("message",w);const T=setTimeout(()=>{v||(ie("ai_provider_oauth_timeout",{provider_id:j}),a({type:"oauth-failed"}),le.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",w),clearTimeout(T)}},[d.kind,I,P,f]);const E=Ss(d),_=E?n.find(v=>v.id===E):null,N=(d.kind==="form"&&d.presetId?be(d.presetId):null)?.name??_?.name??i("settings.connectProviderDialog.defaultTitle"),C=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():a({type:"back"})};return s.jsx(Ye,{open:d.kind!=="closed",onOpenChange:v=>!v&&p(),children:s.jsxs(Qe,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(St,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(ne,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:M,children:s.jsx(et,{size:16})}),s.jsx(Je,{children:N})]}),d.kind==="grid"&&!t&&s.jsx(Nt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(ot,{providers:n,onSelect:k}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(bs,{preset:d.presetId?be(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}}):s.jsx(gs,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Xt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(ne,{size:"sm",onClick:()=>{a({type:"retry-provision"}),b(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function ks(){const l=G.c(7),{org:e}=xe(),t=we();let i;l[0]!==e.id?(i=ce.defaultBrand(e.id),l[0]=e.id,l[1]=i):i=l[1];let o;l[2]!==t?(o=async()=>{const{items:c}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(c)?c:[]).find(Cs)??null},l[2]=t,l[3]=o):o=l[3];let n;l[4]!==i||l[5]!==o?(n={queryKey:i,queryFn:o},l[4]=i,l[5]=o,l[6]=n):n=l[6];const{data:r}=vt(n);return r??null}function Cs(l){return l.isDefault&&!l.archivedAt}function ws(l){const e=l.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(o=>typeof o=="object"&&o!==null&&"label"in o&&/primary|brand|main/i.test(o.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Is(l){const e=G.c(66);let t;e[0]!==l?(t=l===void 0?{}:l,e[0]=l,e[1]=t):t=e[1];const{title:i,description:o,onLocalRuntimePicked:n}=t,r=se(),{org:c}=xe(),{localMode:u}=gt(),d=ks(),a=Et(),h=Ot(),[p,m]=V.useState(null),[f,b]=V.useState(!1),[k,y]=V.useState(!1),S=Me();let I;e[2]!==S?.providers?(I=S?.providers??[],e[2]=S?.providers,e[3]=I):I=e[3];const P=I;let E,_,x;if(e[4]!==d||e[5]!==h||e[6]!==o||e[7]!==a.capabilities||e[8]!==a.online||e[9]!==u||e[10]!==n||e[11]!==c.name||e[12]!==r||e[13]!==i){const O=[];if(a.online){if(a.capabilities.includes("claude-code")){let B;e[17]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(Se,{size:16}),e[17]=B):B=e[17],O.push({option:"claude-code-desktop",label:"Claude Code",icon:B})}if(a.capabilities.includes("codex")){let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(Ne,{size:16}),e[18]=B):B=e[18],O.push({option:"codex-desktop",label:"Codex",icon:B})}}const z=O.length>0&&h!==null,F=c.name;let K;e[19]!==d?(K=d?ws(d):null,e[19]=d,e[20]=K):K=e[20];const R=K,W=d?.favicon??d?.logo??null;let Q;e[21]!==F||e[22]!==r||e[23]!==i?(Q=i??(F?r("chat.noAiProviderEmptyState.headingWithOrg",{org:F}):r("chat.noAiProviderEmptyState.headingDefault")),e[21]=F,e[22]=r,e[23]=i,e[24]=Q):Q=e[24];const J=Q;let Z;e[25]!==o||e[26]!==z||e[27]!==u||e[28]!==r?(Z=o??r(z?"chat.noAiProviderEmptyState.subtitleWithDesktop":u?"chat.noAiProviderEmptyState.subtitleLocalMode":"chat.noAiProviderEmptyState.subtitleDefault"),e[25]=o,e[26]=z,e[27]=u,e[28]=r,e[29]=Z):Z=e[29];const X=Z,ee=!!(W||R);let H;e[30]!==R?(H=R?{backgroundColor:`${R}18`,borderColor:`${R}30`}:void 0,e[30]=R,e[31]=H):H=e[31];const q=H,Y=ee?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";E="flex flex-col items-center gap-8 w-full max-w-3xl px-4";let L;e[32]!==Y||e[33]!==q||e[34]!==W||e[35]!==a.online||e[36]!==R||e[37]!==r?(L=W?s.jsx("div",{className:Y,style:q,children:s.jsx("img",{src:W,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>y(!0),"aria-label":a.online?r("chat.noAiProviderEmptyState.desktopLinkedLabel"):r("chat.noAiProviderEmptyState.connectDesktopLabel"),className:oe(Y,"cursor-pointer transition-colors hover:bg-accent"),style:q,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(Gt,{size:24,style:R?{color:R}:void 0,className:oe(!R&&"text-muted-foreground")}),a.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[32]=Y,e[33]=q,e[34]=W,e[35]=a.online,e[36]=R,e[37]=r,e[38]=L):L=e[38];let D;e[39]!==J?(D=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:J}),e[39]=J,e[40]=D):D=e[40];let $;e[41]!==X?($=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:X}),e[41]=X,e[42]=$):$=e[42];let U;e[43]!==D||e[44]!==$?(U=s.jsxs("div",{className:"space-y-2",children:[D,$]}),e[43]=D,e[44]=$,e[45]=U):U=e[45],e[46]!==L||e[47]!==U?(_=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[L,U]}),e[46]=L,e[47]=U,e[48]=_):_=e[48],x=z&&s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:O.map(B=>s.jsxs(ne,{variant:"default",className:"gap-2",onClick:()=>{h?.setPendingAgentOption(B.option),n?.(B.option)},children:[B.icon,r("chat.noAiProviderEmptyState.useLabel",{label:B.label})]},B.option))}),s.jsxs("div",{className:"flex items-center gap-3 w-full max-w-xs text-xs text-muted-foreground",children:[s.jsx("span",{className:"h-px flex-1 bg-border"}),r("chat.noAiProviderEmptyState.orConnectProvider"),s.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),e[4]=d,e[5]=h,e[6]=o,e[7]=a.capabilities,e[8]=a.online,e[9]=u,e[10]=n,e[11]=c.name,e[12]=r,e[13]=i,e[14]=E,e[15]=_,e[16]=x}else E=e[14],_=e[15],x=e[16];let N,C;e[49]===Symbol.for("react.memo_cache_sentinel")?(N=O=>m(O),C=()=>b(!0),e[49]=N,e[50]=C):(N=e[49],C=e[50]);let M;e[51]!==P?(M=s.jsx("div",{className:"w-full",children:s.jsx(ot,{providers:P,onSelect:N,onShowAll:C})}),e[51]=P,e[52]=M):M=e[52];const v=p!==null||f;let g;e[53]===Symbol.for("react.memo_cache_sentinel")?(g=O=>{O||(m(null),b(!1))},e[53]=g):g=e[53];const j=p??void 0;let w;e[54]!==j||e[55]!==v?(w=s.jsx(Ns,{open:v,onOpenChange:g,initialProvider:j}),e[54]=j,e[55]=v,e[56]=w):w=e[56];let T;e[57]!==k?(T=s.jsx(Jt,{open:k,onOpenChange:y}),e[57]=k,e[58]=T):T=e[58];let A;return e[59]!==w||e[60]!==T||e[61]!==E||e[62]!==_||e[63]!==x||e[64]!==M?(A=s.jsxs("div",{className:E,children:[_,x,M,w,T]}),e[59]=w,e[60]=T,e[61]=E,e[62]=_,e[63]=x,e[64]=M,e[65]=A):A=e[65],A}function Oe(l){const e=l.title.includes(": ");return{provider:e?l.title.split(": ")[0]??"":l.modelId.split("/")[0]??"",displayName:e?l.title.split(": ").slice(1).join(": "):l.title}}function _s(l){return l<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:l<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:l<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const Ms=["bg-destructive","bg-warning","bg-success","bg-success"],Es=["text-success","text-warning","text-warning","text-destructive"];function Os(l,e){const t=Math.round(l*.75/1e3),i=t>=1?`${t}K`:`${Math.round(l*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Ps(l){return l<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:l<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:l<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Ls={text:{icon:s.jsx(Bt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Ut,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Ft,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx($t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(Zt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function As(l){const e=G.c(10),{capability:t}=l,i=se(),o=Ls[t];if(o){const u=o.icon;let d;e[0]!==o.labelKey||e[1]!==i?(d=i(o.labelKey),e[0]=o.labelKey,e[1]=i,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[u,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let n;e[6]!==t?(n=t.charAt(0).toUpperCase(),e[6]=t,e[7]=n):n=e[7];const r=n+t.slice(1);let c;return e[8]!==r?(c=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=c):c=e[9],c}function Ts(l){const e=G.c(59),{model:t,compact:i}=l,o=i===void 0?!1:i,n=se();if(!t){let x;e[0]!==n?(x=n("chat.shared.hoverToPreview"),e[0]=n,e[1]=x):x=e[1];let N;return e[2]!==x?(N=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=N):N=e[3],N}const r=t.costs?.input!=null?t.costs.input*1e6:null,c=t.costs?.output!=null?t.costs.output*1e6:null;let u;e[4]!==t?(u=Oe(t),e[4]=t,e[5]=u):u=e[5];const{provider:d,displayName:a}=u;if(o){let x;e[6]!==t.limits||e[7]!==n?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",n("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=n,e[8]=x):x=e[8];let N;e[9]!==r||e[10]!==n?(N=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=n,e[11]=N):N=e[11];let C;e[12]!==c||e[13]!==n?(C=c!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=n,e[14]=C):C=e[14];let M;e[15]!==t.limits||e[16]!==n?(M=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",n("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=n,e[17]=M):M=e[17];let v;return e[18]!==x||e[19]!==N||e[20]!==C||e[21]!==M?(v=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,N,C,M]}),e[18]=x,e[19]=N,e[20]=C,e[21]=M,e[22]=v):v=e[22],v}let h;e[23]!==d?(h=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=h):h=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let m;e[28]!==a?(m=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=m):m=e[29];let f;e[30]!==p||e[31]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,m]}),e[30]=p,e[31]=m,e[32]=f):f=e[32];let b;e[33]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=b):b=e[34];let k;e[35]!==h||e[36]!==f||e[37]!==b?(k=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[h,f,b]}),e[35]=h,e[36]=f,e[37]=b,e[38]=k):k=e[38];let y;e[39]!==t.capabilities?(y=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(zs)}),e[39]=t.capabilities,e[40]=y):y=e[40];let S;e[41]!==t.limits||e[42]!==n?(S=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:N,descriptionKey:C}=_s(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>s.jsx("div",{className:oe("w-2 h-2 rounded-full",M<=x?Ms[x-1]:"bg-muted")},M))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:n(N)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",n(C)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",n("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=n,e[43]=S):S=e[43];let I;e[44]!==t.limits||e[45]!==n?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",n("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Os(t.limits.maxOutputTokens,n)})]})]}),e[44]=t.limits,e[45]=n,e[46]=I):I=e[46];let P;e[47]!==r||e[48]!==c||e[49]!==n?(P=(r!=null||c!=null)&&(()=>{const{level:x,labelKey:N}=r!=null?Ps(r):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.pricing")}),r!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:oe("text-sm font-bold leading-none",C<=x?Es[x-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N?n(N):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",n("chat.shared.tokens")]})]}),c!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",n("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=c,e[49]=n,e[50]=P):P=e[50];let E;e[51]!==S||e[52]!==I||e[53]!==P?(E=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,I,P]}),e[51]=S,e[52]=I,e[53]=P,e[54]=E):E=e[54];let _;return e[55]!==E||e[56]!==k||e[57]!==y?(_=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[k,y,E]}),e[55]=E,e[56]=k,e[57]=y,e[58]=_):_=e[58],_}function zs(l){return s.jsx(As,{capability:l},l)}function rt(l){const e=G.c(22),{model:t,placeholder:i,isLoading:o}=l,n=o===void 0?!1:o,r=se();let c;e[0]!==i||e[1]!==r?(c=i??r("chat.shared.selectModel"),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;if(n){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(te,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(te,{className:"w-16 h-3 hidden md:block"})]}),e[3]=y):y=e[3],y}if(!t){let y;e[4]!==u?(y=s.jsx("span",{className:"text-sm text-muted-foreground",children:u}),e[4]=u,e[5]=y):y=e[5];let S;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=S):S=e[6];let I;return e[7]!==y?(I=s.jsxs("div",{className:"flex items-center gap-1.5",children:[y,S]}),e[7]=y,e[8]=I):I=e[8],I}let d;e[9]!==t?(d=Oe(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let h;e[11]!==t?(h=Ee(t),e[11]=t,e[12]=h):h=e[12];const p=h;let m;e[13]!==t.title||e[14]!==p?(m=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=m):m=e[15];let f;e[16]!==a?(f=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=f):f=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=b):b=e[18];let k;return e[19]!==m||e[20]!==f?(k=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[m,f,b]}),e[19]=m,e[20]=f,e[21]=k):k=e[21],k}const Rs=["vision","image","file","audio","video"],at=["image/png","image/jpeg","image/gif","image/webp"],ct=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Pe(l){const e=l?.capabilities;return e?Rs.some(t=>e.includes(t)):!1}function qi(l,e){if(!l)return!1;if(l.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),o=t.includes("file"),n=t.includes("audio"),r=t.includes("video");return!!(i&&at.includes(l)||o&&l==="application/pdf"||n&&l.startsWith("audio/")||r&&l.startsWith("video/")||Pe(e)&&ct.includes(l))}function Gi(l){const e=l?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...at),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Pe(l)&&t.push(...ct),t.join(",")}function Xi(l){const e=l?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Pe(l)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const dt=["smarter","faster","cheaper"],Fs={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ds=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ks=Ds.flatMap(({tier:l,prefixes:e})=>e.map(t=>({tier:l,prefix:t}))).sort((l,e)=>e.prefix.length-l.prefix.length),$s="google/gemini-2.5-pro",Be=new Map;function Us(l){const e=Be.get(l);if(e!==void 0)return e;let t=null;if(l.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:o}of Ks)if(l.startsWith(o)){if(o===$s&&l.length>o.length&&l[o.length]==="-"){const r=l[o.length+1];if(!r||!/\d/.test(r))continue}t=i;break}return Be.set(l,t),t}function We(l){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of l){const i=Us(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,o)=>i.title.localeCompare(o.title));return e}const ut="studio:model-shortlist:",Bs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Ws(l){try{const e=localStorage.getItem(ut+l);return e?new Set(JSON.parse(e)):null}catch{return null}}function Vs(l,e){localStorage.setItem(ut+l,JSON.stringify([...e]))}function Hs(l){const e=G.c(21),{model:t,onHover:i}=l;let o;e[0]!==t?(o=Oe(t),e[0]=t,e[1]=o):o=e[1];const{displayName:n,provider:r}=o;let c;e[2]!==t?(c=Ee(t),e[2]=t,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==u?(a=s.jsx("img",{src:u,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=u,e[9]=a):a=e[9];let h;e[10]!==n?(h=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:n}),e[10]=n,e[11]=h):h=e[11];let p;e[12]!==r?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let m;e[14]!==h||e[15]!==p?(m=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[h,p]}),e[14]=h,e[15]=p,e[16]=m):m=e[16];let f;return e[17]!==d||e[18]!==a||e[19]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,m]}),e[17]=d,e[18]=a,e[19]=m,e[20]=f):f=e[20],f}function qs(l){const e=G.c(16),{error:t,onRetry:i}=l,o=se();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(jt,{className:"size-5 text-destructive"})}),e[0]=n):n=e[0];const r=o("chat.decopilot.failedToLoadModels");let c;e[1]!==r?(c=s.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=c):c=e[2];const u=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==u||e[4]!==d?(a=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[u,d]}),e[3]=u,e[4]=d,e[5]=a):a=e[5];let h;e[6]!==c||e[7]!==a?(h=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,a]}),e[6]=c,e[7]=a,e[8]=h):h=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Kt,{className:"size-3.5"}),e[9]=p):p=e[9];const m=o("chat.decopilot.retry");let f;e[10]!==i||e[11]!==m?(f=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,m]})}),e[10]=i,e[11]=m,e[12]=f):f=e[12];let b;return e[13]!==f||e[14]!==h?(b=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[n,h,f]}),e[13]=f,e[14]=h,e[15]=b):b=e[15],b}function Gs(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Xs)}),l[0]=e):e=l[0],e}function Xs(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ve(l){const e=G.c(12),{label:t,models:i,onSelect:o,onHover:n}=l;if(i.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==i||e[3]!==n||e[4]!==o){let d;e[6]!==n||e[7]!==o?(d=a=>s.jsx("div",{onClick:()=>o(a),className:"cursor-pointer",children:s.jsx(Hs,{model:a,onHover:n})},a.modelId),e[6]=n,e[7]=o,e[8]=d):d=e[8],c=i.map(d),e[2]=i,e[3]=n,e[4]=o,e[5]=c}else c=e[5];let u;return e[9]!==r||e[10]!==c?(u=s.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function Ce(l,e){return e(l==="other"?"chat.decopilot.tierOther":Fs[l])}function Ys(l){const e=G.c(21),{model:t,isChecked:i,onToggle:o,onHover:n}=l,[r,c]=V.useState(i);r!==i&&c(i);let u;e[0]!==t?(u=Ee(t),e[0]=t,e[1]=u):u=e[1];const d=u;let a;e[2]!==t||e[3]!==n?(a=()=>n(t),e[2]=t,e[3]=n,e[4]=a):a=e[4];let h;e[5]!==t.modelId||e[6]!==o?(h=()=>{c(Qs),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=h):h=e[7];let p;e[8]!==r||e[9]!==h?(p=s.jsx(Pt,{checked:r,onCheckedChange:h}),e[8]=r,e[9]=h,e[10]=p):p=e[10];let m;e[11]!==d||e[12]!==t.title?(m=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=m):m=e[13];let f;e[14]!==t.title?(f=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let b;return e[16]!==a||e[17]!==p||e[18]!==m||e[19]!==f?(b=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,m,f]}),e[16]=a,e[17]=p,e[18]=m,e[19]=f,e[20]=b):b=e[20],b}function Qs(l){return!l}function Js(l,e){const t=[];for(const i of dt)if(l[i].length>0){t.push({type:"header",label:Ce(i,e)});for(const o of l[i])t.push({type:"model",model:o})}if(l.other.length>0){t.push({type:"header",label:Ce("other",e)});for(const i of l.other)t.push({type:"model",model:i})}return t}function Zs({items:l,shortlistSet:e,onToggle:t,onHover:i}){const o=V.useRef(null),n=us({count:l.length,getScrollElement:()=>o.current,estimateSize:r=>l[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:n.getTotalSize()},children:n.getVirtualItems().map(r=>{const c=l[r.index];return c?s.jsx("div",{"data-index":r.index,ref:n.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):s.jsx(Ys,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:i})},r.key):null})})})}function ei(l){const e=G.c(30),{keyId:t,searchTerm:i,onHover:o,onModelSelect:n,managing:r,onToggleManage:c,filterModels:u}=l,d=se(),{models:a}=qt(t),h=u?a.filter(u):a.filter(ti);let p;e[0]!==t?(p=()=>(t?Ws(t):null)??Bs,e[0]=t,e[1]=p):p=e[1];const[m,f]=V.useState(p),[,b]=V.useTransition();let k;e[2]!==t||e[3]!==b?(k=g=>{t&&b(()=>{f(j=>{const w=new Set(j);return w.has(g)?w.delete(g):w.add(g),Vs(t,w),w})})},e[2]=t,e[3]=b,e[4]=k):k=e[4];const y=k,S=i.toLowerCase().trim(),I=g=>S?g.filter(j=>j.title.toLowerCase().includes(S)||j.modelId.toLowerCase().includes(S)):g;if(r){const g=We(I(h)),j=Js(g,d);let w;e[5]!==m?(w=F=>m.has(F.modelId),e[5]=m,e[6]=w):w=e[6];const T=h.filter(w).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(et,{size:14}),e[7]=A):A=e[7];let O;e[8]!==d?(O=d("chat.decopilot.back"),e[8]=d,e[9]=O):O=e[9];let z;return e[10]!==c||e[11]!==O?(z=s.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,O]}),e[10]=c,e[11]=O,e[12]=z):z=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[z,s.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:T})})]}),s.jsx(Zs,{items:j,shortlistSet:m,onToggle:y,onHover:o})]})}let P;e[13]!==m?(P=g=>m.has(g.modelId),e[13]=m,e[14]=P):P=e[14];const E=h.filter(P),_=E.length>0?E:h,x=We(I(_));let N;e[15]!==x||e[16]!==o||e[17]!==n||e[18]!==d?(N=dt.map(g=>s.jsx(Ve,{label:Ce(g,d),models:x[g],onSelect:n,onHover:o},g)),e[15]=x,e[16]=o,e[17]=n,e[18]=d,e[19]=N):N=e[19];let C;e[20]!==d?(C=Ce("other",d),e[20]=d,e[21]=C):C=e[21];let M;e[22]!==x.other||e[23]!==o||e[24]!==n||e[25]!==C?(M=s.jsx(Ve,{label:C,models:x.other,onSelect:n,onHover:o}),e[22]=x.other,e[23]=o,e[24]=n,e[25]=C,e[26]=M):M=e[26];let v;return e[27]!==N||e[28]!==M?(v=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,M]}),e[27]=N,e[28]=M,e[29]=v):v=e[29],v}function ti(l){return l.asyncResearch!==!0}function si(){const l=G.c(6);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(te,{className:"size-4 shrink-0"}),s.jsx(te,{className:"flex-1 h-6"}),s.jsx(te,{className:"w-[140px] h-8 shrink-0"})]})}),l[0]=e):e=l[0];let t;l[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(ii)})]}),l[1]=t):t=l[1];let i;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(te,{className:"size-6 shrink-0"}),s.jsx(te,{className:"h-6 w-32"})]}),l[2]=i):i=l[2];let o;l[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{className:"h-6 w-20 rounded-md"}),s.jsx(te,{className:"h-6 w-24 rounded-md"})]})]}),l[3]=o):o=l[3];let n;l[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-24"}),s.jsx(te,{className:"h-4 w-32"})]}),l[4]=n):n=l[4];let r;return l[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,s.jsxs("div",{className:"flex flex-col gap-4",children:[n,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-16"}),s.jsx(te,{className:"h-4 w-40"})]})]})]})})]}),l[5]=r):r=l[5],r}function ii(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function mt(l){const e=G.c(66),{onClose:t,credentialId:i,onCredentialChange:o,selectedModel:n,onModelChange:r,filterModels:c,compact:u}=l,d=se(),[a,h]=V.useState(null),[p,m]=V.useState(""),[f,b]=V.useState(!1),k=V.useRef(null),y=Me(),S=Ht();let I;e[0]!==y?.providers?(I=Object.fromEntries((y?.providers??[]).map(oi)),e[0]=y?.providers,e[1]=I):I=e[1];const P=I,E=bt(),{org:_}=xe();let x;e[2]!==o?(x=L=>{o(L),h(null)},e[2]=o,e[3]=x):x=e[3];const N=x;let C;e[4]!==i||e[5]!==t||e[6]!==r?(C=L=>{i&&(r(L),m(""),t())},e[4]=i,e[5]=t,e[6]=r,e[7]=C):C=e[7];const M=C;if(S.length===0){const L=!u&&"sm:w-[740px]";let D;e[8]!==L?(D=oe("flex items-center justify-center p-8 w-full",L),e[8]=L,e[9]=D):D=e[9];let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Is,{}),e[10]=$):$=e[10];let U;return e[11]!==D?(U=s.jsx("div",{className:D,children:$}),e[11]=D,e[12]=U):U=e[12],U}const v=u?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==v?(g=oe("flex flex-col md:flex-row h-full min-h-0",v),e[13]=v,e[14]=g):g=e[14];const j=u?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let w;e[15]!==j?(w=oe("flex-1 flex flex-col min-h-0 overflow-hidden",j),e[15]=j,e[16]=w):w=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx(tt,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=T):T=e[17];let A;e[18]!==f||e[19]!==d?(A=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=L=>m(L.target.value),e[21]=O):O=e[21];let z;e[22]!==p||e[23]!==A?(z=s.jsx(pe,{ref:k,type:"text",placeholder:A,value:p,onChange:O,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=A,e[24]=z):z=e[24];let F;e[25]!==i||e[26]!==N||e[27]!==S||e[28]!==P||e[29]!==d?(F=S.length>0&&s.jsxs(Lt,{value:i??"",onValueChange:N,children:[s.jsxs(At,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ni,children:[s.jsx(Tt,{placeholder:d("chat.decopilot.key"),children:(()=>{const L=S.find(re=>re.id===i),D=L?P[L.providerId]:void 0,$=be(L?.presetId),U=$?.logo??D?.logo,B=$?.name??D?.name??L?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[U?s.jsx("img",{src:U,alt:B,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:B.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:B})]})})()}),s.jsx(Wt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(zt,{children:S.map(L=>{const D=P[L.providerId],$=be(L.presetId),U=$?.logo??D?.logo,B=$?.name??D?.name??L.providerId;return s.jsx(Rt,{value:L.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[U?s.jsx("img",{src:U,alt:B,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:B.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[B," — ",L.label]})]})},L.id)})})]}),e[25]=i,e[26]=N,e[27]=S,e[28]=P,e[29]=d,e[30]=F):F=e[30];let K;e[31]!==z||e[32]!==F?(K=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[T,z,F]})}),e[31]=z,e[32]=F,e[33]=K):K=e[33];let R;e[34]!==i?(R=L=>{const{error:D,resetError:$}=L;return s.jsx(qs,{error:D,onRetry:$,credentialId:i??void 0})},e[34]=i,e[35]=R):R=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Gs,{}),e[36]=W):W=e[36];const Q=i??void 0;let J;e[37]===Symbol.for("react.memo_cache_sentinel")?(J=()=>b(li),e[37]=J):J=e[37];let Z;e[38]!==c||e[39]!==M||e[40]!==f||e[41]!==p||e[42]!==Q?(Z=s.jsx(V.Suspense,{fallback:W,children:s.jsx(ei,{keyId:Q,searchTerm:p,onHover:h,onModelSelect:M,managing:f,onToggleManage:J,filterModels:c})}),e[38]=c,e[39]=M,e[40]=f,e[41]=p,e[42]=Q,e[43]=Z):Z=e[43];let X;e[44]!==i||e[45]!==R||e[46]!==Z?(X=s.jsx(yt,{fallback:R,children:Z},i),e[44]=i,e[45]=R,e[46]=Z,e[47]=X):X=e[47];let ee;e[48]!==f||e[49]!==E||e[50]!==_||e[51]!==d?(ee=!f&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>V.startTransition(()=>b(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Dt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>E({to:"/$org/settings/ai-providers",params:{org:_.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Vt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=E,e[50]=_,e[51]=d,e[52]=ee):ee=e[52];let H;e[53]!==K||e[54]!==X||e[55]!==ee||e[56]!==w?(H=s.jsxs("div",{className:w,children:[K,X,ee]}),e[53]=K,e[54]=X,e[55]=ee,e[56]=w,e[57]=H):H=e[57];let q;e[58]!==u||e[59]!==a||e[60]!==n?(q=!u&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Ts,{model:a??n??null})}),e[58]=u,e[59]=a,e[60]=n,e[61]=q):q=e[61];let Y;return e[62]!==H||e[63]!==q||e[64]!==g?(Y=s.jsxs("div",{className:g,children:[H,q]}),e[62]=H,e[63]=q,e[64]=g,e[65]=Y):Y=e[65],Y}function li(l){return!l}function ni(l){return l.stopPropagation()}function oi(l){return[l.id,l]}function ri(l){const e=G.c(12),{onClose:t}=l,{credentialId:i,setCredentialId:o,selectedModel:n,setModel:r}=_e();let c;e[0]!==o?(c=a=>{ie("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=c):c=e[1];let u;e[2]!==i||e[3]!==n?.modelId||e[4]!==r?(u=a=>{i&&(ie("chat_model_changed",{from_model_id:n?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),r({...a,keyId:i}))},e[2]=i,e[3]=n?.modelId,e[4]=r,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==n||e[9]!==c||e[10]!==u?(d=s.jsx(mt,{onClose:t,credentialId:i,onCredentialChange:c,selectedModel:n,onModelChange:u}),e[6]=i,e[7]=t,e[8]=n,e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function ai(l){const e=G.c(2),{onClose:t}=l;let i;return e[0]!==t?(i=s.jsx(ri,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ci(l){const e=G.c(2);let t;return e[0]!==l?(t=s.jsx(mt,{...l}),e[0]=l,e[1]=t):t=e[1],t}const di=[{tier:"fast",labelKey:"chat.desktopCli.tierFastDescription"},{tier:"smart",labelKey:"chat.desktopCli.tierSmartDescription"},{tier:"thinking",labelKey:"chat.desktopCli.tierThinkingDescription"}];function ht(l){const e=G.c(11),{modelSet:t,selectedModelId:i,onSelect:o}=l,n=se();let r,c;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==o||e[4]!==i||e[5]!==n){const d=Object.fromEntries(t.models.map(ui));r="flex flex-col p-2 w-[320px]",c=di.map(a=>{const{tier:h,labelKey:p}=a,m=t.tiers[h];if(!m.modelId)return null;const f=d[m.modelId];if(!f)return null;const b=i===m.modelId;return s.jsxs("button",{type:"button",onClick:()=>o(f),className:oe("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",b&&"bg-accent/50"),children:[s.jsx("img",{src:t.logo,alt:m.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:m.label}),s.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:n(p)})]})]},h)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=o,e[4]=i,e[5]=n,e[6]=r,e[7]=c}else r=e[6],c=e[7];let u;return e[8]!==r||e[9]!==c?(u=s.jsx("div",{className:r,children:c}),e[8]=r,e[9]=c,e[10]=u):u=e[10],u}function ui(l){return[l.modelId,l]}const mi=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 4.8 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],je="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",hi=[{providerId:"codex",modelId:"codex:gpt-5.6-sol",title:"GPT-5.6 Sol",description:"Frontier Codex model for deep reasoning, complex coding, and real-world work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-terra",title:"GPT-5.6 Terra",description:"Balanced Codex model for everyday coding and agent work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-luna",title:"GPT-5.6 Luna",description:"Fast Codex model for lightweight coding tasks and titles",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:je,limits:null,costs:null}],fi="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",pi="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg";function xi(l){return{fast:{modelId:"claude-code:haiku",label:l("chat.agentModels.haikuLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Se,{size:16})},smart:{modelId:"claude-code:sonnet",label:l("chat.agentModels.sonnetLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Se,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:l("chat.agentModels.opusLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Se,{size:16})}}}function gi(l){return{fast:{modelId:"codex:gpt-5.6-luna",label:l("chat.agentModels.gptLunaLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Ne,{size:16})},smart:{modelId:"codex:gpt-5.6-terra",label:l("chat.agentModels.gptTerraLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Ne,{size:16})},thinking:{modelId:"codex:gpt-5.6-sol",label:l("chat.agentModels.gptSolLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Ne,{size:16})}}}function ft(l,e){return l==="claude-code"?{logo:fi,tiers:xi(e),models:mi}:l==="codex"?{logo:pi,tiers:gi(e),models:hi}:null}function vi(l){const e=G.c(12),{onClose:t,agent:i}=l,o=se(),n=_e(),r=i??n.pendingHarnessId??"decopilot";let c;e[0]!==r||e[1]!==o?(c=ft(r,o),e[0]=r,e[1]=o,e[2]=c):c=e[2];const u=c;if(!u){let p;return e[3]!==t?(p=s.jsx(ai,{onClose:t}),e[3]=t,e[4]=p):p=e[4],p}const d=n.selectedModel?.modelId??u.tiers[n.simpleModeTier].modelId;let a;e[5]!==t||e[6]!==n?(a=p=>{n.setModel({...p,keyId:void 0}),t()},e[5]=t,e[6]=n,e[7]=a):a=e[7];let h;return e[8]!==u||e[9]!==d||e[10]!==a?(h=s.jsx(ht,{modelSet:u,selectedModelId:d,onSelect:a}),e[8]=u,e[9]=d,e[10]=a,e[11]=h):h=e[11],h}function bi(l){const e=G.c(14);let t,i;e[0]!==l?({agent:t,...i}=l,e[0]=l,e[1]=t,e[2]=i):(t=e[1],i=e[2]);const o=se();let n;e[3]!==t||e[4]!==o?(n=t?ft(t,o):null,e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=n;if(!r){let a;return e[6]!==i?(a=s.jsx(ci,{...i}),e[6]=i,e[7]=a):a=e[7],a}const c=i.selectedModel?.modelId??r.tiers.smart.modelId;let u;e[8]!==i?(u=a=>{i.onModelChange(a),i.onClose()},e[8]=i,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==c||e[12]!==u?(d=s.jsx(ht,{modelSet:r,selectedModelId:c,onSelect:u}),e[10]=r,e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function Yi(l){const e=G.c(49),{variant:t,className:i,placeholder:o,model:n,isLoading:r,credentialId:c,onCredentialChange:u,onModelChange:d,filterModels:a,agent:h}=l,p=t===void 0?"borderless":t,m=o===void 0?"Select model":o,f=se(),[b,k]=V.useState(!1),y=d!==void 0,S=Mt(),I=p==="borderless"?"ghost":"outline",P=p==="borderless"&&"md:border-none";let E;e[0]!==i||e[1]!==P?(E=oe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",P,i),e[0]=i,e[1]=P,e[2]=E):E=e[2];let _;e[3]!==r||e[4]!==n||e[5]!==m||e[6]!==y?(_=y?s.jsx(rt,{model:n??null,placeholder:m,isLoading:r}):s.jsx(ji,{placeholder:m}),e[3]=r,e[4]=n,e[5]=m,e[6]=y,e[7]=_):_=e[7];let x;e[8]!==I||e[9]!==E||e[10]!==_?(x=s.jsx(ne,{variant:I,size:"sm",className:E,children:_}),e[8]=I,e[9]=E,e[10]=_,e[11]=x):x=e[11];const N=x;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(si,{}),e[12]=C):C=e[12];let M;e[13]!==h||e[14]!==c||e[15]!==a||e[16]!==n||e[17]!==u||e[18]!==d||e[19]!==y?(M=s.jsx(V.Suspense,{fallback:C,children:y?s.jsx(bi,{onClose:()=>k(!1),agent:h,credentialId:c??null,onCredentialChange:u??yi,selectedModel:n??null,onModelChange:d,filterModels:a}):s.jsx(vi,{onClose:()=>k(!1),agent:h})}),e[13]=h,e[14]=c,e[15]=a,e[16]=n,e[17]=u,e[18]=d,e[19]=y,e[20]=M):M=e[20];const v=M;if(S){let O;e[21]!==N?(O=s.jsx(Ct,{asChild:!0,children:N}),e[21]=N,e[22]=O):O=e[22];let z;e[23]!==f?(z=f("chat.selectModel.selectModel"),e[23]=f,e[24]=z):z=e[24];let F;e[25]!==z?(F=s.jsx(wt,{className:"sr-only",children:z}),e[25]=z,e[26]=F):F=e[26];let K;e[27]!==v?(K=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v}),e[27]=v,e[28]=K):K=e[28];let R;e[29]!==F||e[30]!==K?(R=s.jsxs(It,{className:"p-0 flex flex-col max-h-[95vh]",children:[F,K]}),e[29]=F,e[30]=K,e[31]=R):R=e[31];let W;return e[32]!==b||e[33]!==O||e[34]!==R?(W=s.jsxs(_t,{open:b,onOpenChange:k,children:[O,R]}),e[32]=b,e[33]=O,e[34]=R,e[35]=W):W=e[35],W}let g;e[36]!==N?(g=s.jsx(kt,{asChild:!0,children:N}),e[36]=N,e[37]=g):g=e[37];let j;e[38]!==f?(j=f("chat.selectModel.selectModel"),e[38]=f,e[39]=j):j=e[39];let w;e[40]!==j?(w=s.jsx(Je,{className:"sr-only",children:j}),e[40]=j,e[41]=w):w=e[41];let T;e[42]!==v||e[43]!==w?(T=s.jsxs(Qe,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[w,v]}),e[42]=v,e[43]=w,e[44]=T):T=e[44];let A;return e[45]!==b||e[46]!==g||e[47]!==T?(A=s.jsxs(Ye,{open:b,onOpenChange:k,children:[g,T]}),e[45]=b,e[46]=g,e[47]=T,e[48]=A):A=e[48],A}function yi(){}function ji(l){const e=G.c(4),{placeholder:t}=l,{selectedModel:i,isModelsLoading:o}=_e();let n;return e[0]!==o||e[1]!==i||e[2]!==t?(n=s.jsx(rt,{model:i,placeholder:t,isLoading:o}),e[0]=o,e[1]=i,e[2]=t,e[3]=n):n=e[3],n}export{Ns as C,si as M,Is as N,ot as P,bi as a,Gi as b,Yi as c,be as d,Xi as g,qi as i,Pe as m};
4
+ color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(o),n=!1,o}return r.updateDeps=c=>{i=c},r}function Re(l,e){if(l===void 0)throw new Error("Unexpected undefined");return l}const es=(l,e)=>Math.abs(l-e)<1.01,ts=(l,e,t)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>e.apply(this,o),t)}},Fe=l=>{const{offsetWidth:e,offsetHeight:t}=l;return{width:e,height:t}},ss=l=>l,is=l=>{const e=Math.max(l.startIndex-l.overscan,0),t=Math.min(l.endIndex+l.overscan,l.count-1),i=[];for(let o=e;o<=t;o++)i.push(o);return i},ls=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;const o=r=>{const{width:c,height:u}=r;e({width:Math.round(c),height:Math.round(u)})};if(o(Fe(t)),!i.ResizeObserver)return()=>{};const n=new i.ResizeObserver(r=>{const c=()=>{const u=r[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Fe(t))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},De={passive:!0},Ke=typeof window>"u"?!0:"onscrollend"in window,ns=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;let o=0;const n=l.options.useScrollendEvent&&Ke?()=>{}:ts(i,()=>{e(o,!1)},l.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:h,isRtl:p}=l.options;o=h?t.scrollLeft*(p&&-1||1):t.scrollTop,n(),e(o,a)},c=r(!0),u=r(!1);t.addEventListener("scroll",c,De);const d=l.options.useScrollendEvent&&Ke;return d&&t.addEventListener("scrollend",u,De),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",u)}},os=(l,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return l[t.options.horizontal?"offsetWidth":"offsetHeight"]},rs=(l,{adjustments:e=0,behavior:t},i)=>{var o,n;const r=l+e;(n=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||n.call(o,{[i.options.horizontal?"left":"top"]:r,behavior:t})};class as{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,o;return((o=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(n=>{const r=()=>{const c=n.target,u=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(c,n,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),t=null},observe:o=>{var n;return(n=i())==null?void 0:n.observe(o,{box:"border-box"})},unobserve:o=>{var n;return(n=i())==null?void 0:n.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,o])=>{typeof o>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ss,rangeExtractor:is,onChange:()=>{},measureElement:os,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,t)},this.maybeNotify=fe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=n,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const o=new Map,n=new Map;for(let r=i-1;r>=0;r--){const c=t[r];if(o.has(c.lane))continue;const u=n.get(c.lane);if(u==null||c.end>u.end?n.set(c.lane,c):c.end<u.end&&o.set(c.lane,!0),o.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=fe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,o,n,r,c,u)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:o,getItemKey:n,enabled:r,lanes:c,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=fe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:o,getItemKey:n,enabled:r,lanes:c,laneAssignmentMode:u},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,a),p=new Array(c).fill(void 0);for(let m=0;m<a;m++){const f=h[m];f&&(p[f.lane]=m)}for(let m=a;m<t;m++){const f=n(m),b=this.laneAssignments.get(m);let k,y;const S=u==="estimate"||d.has(f);if(b!==void 0&&this.options.lanes>1){k=b;const _=p[k],x=_!==void 0?h[_]:void 0;y=x?x.end+this.options.gap:i+o}else{const _=this.options.lanes===1?h[m-1]:this.getFurthestMeasurement(h,m);y=_?_.end+this.options.gap:i+o,k=_?_.lane:m%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(m,k)}const I=d.get(f),P=typeof I=="number"?I:this.options.estimateSize(m),E=y+P;h[m]={index:m,start:y,size:P,end:E,key:f,lane:k},p[k]=m}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=fe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,o,n)=>this.range=t.length>0&&i>0?cs({measurements:t,outerSize:i,scrollOffset:o,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=fe(()=>{let t=null,i=null;const o=this.calculateRange();return o&&(t=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,o,n,r)=>n===null||r===null?[]:t({startIndex:n,endIndex:r,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,o=t.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,o-n),c=Math.min(this.options.count-1,o+n);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const i=this.indexFromElement(t),o=this.options.getItemKey(i),n=this.elementsCache.get(o);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var o;const n=this.measurementsCache[t];if(!n)return;const r=this.itemSizeCache.get(n.key)??n.size,c=i-r;c!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,c,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,i)),this.notify(!1))},this.getVirtualItems=fe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const o=[];for(let n=0,r=t.length;n<r;n++){const c=t[n],u=i[c];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Re(i[lt(0,i.length-1,o=>Re(i[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,o=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=t>=r+n?"end":"start"),i==="center"?t+=(o-n)/2:i==="end"&&(t-=n);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),n=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(i==="auto")if(r.end>=n+o-this.options.scrollPaddingEnd)i="end";else if(r.start<=n+this.options.scrollPaddingStart)i="start";else return[n,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const c=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,i,r.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:o="auto"}={})=>{const n=this.getOffsetForAlignment(t,i),r=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getOffsetForIndex(t,i);if(!n)return;const[r,c]=n,u=this.now();this.scrollState={index:t,align:c,behavior:o,startedAt:u,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:n,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=i[i.length-1])==null?void 0:t.end)??0;else{const n=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&n.some(c=>c===null);){const c=i[r];n[c.lane]===null&&(n[c.lane]=c.end),r--}o=Math.max(...n.filter(c=>c!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,n=1,r=o!==this.scrollState.lastTargetOffset;if(!r&&es(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const lt=(l,e,t,i)=>{for(;l<=e;){const o=(l+e)/2|0,n=t(o);if(n<i)l=o+1;else if(n>i)e=o-1;else return o}return l>0?l-1:0};function cs({measurements:l,outerSize:e,scrollOffset:t,lanes:i}){const o=l.length-1,n=u=>l[u].start;if(l.length<=i)return{startIndex:0,endIndex:o};let r=lt(0,o,n,t),c=r;if(i===1)for(;c<o&&l[c].end<t+e;)c++;else if(i>1){const u=Array(i).fill(0);for(;c<o&&u.some(a=>a<t+e);){const a=l[c];u[a.lane]=a.end,c++}const d=Array(i).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=l[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%i),c=Math.min(o,c+(i-1-c%i))}return{startIndex:r,endIndex:c}}const $e=typeof document<"u"?V.useLayoutEffect:V.useEffect;function ds({useFlushSync:l=!0,...e}){const t=V.useReducer(()=>({}),{})[1],i={...e,onChange:(n,r)=>{var c;l&&r?xt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,n,r)}},[o]=V.useState(()=>new as(i));return o.setOptions(i),$e(()=>o._didMount(),[]),$e(()=>o._willUpdate()),o}function us(l){return ds({observeElementRect:ls,observeElementOffset:ns,scrollToFn:rs,...l})}const nt=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(l){if(l)return nt.find(e=>e.id===l)}const Ue=4;function ge(l){const e=G.c(8),{logo:t,name:i,description:o,onClick:n}=l;let r;e[0]!==t||e[1]!==i?(r=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Qt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=r):r=e[2];let c;return e[3]!==o||e[4]!==i||e[5]!==n||e[6]!==r?(c=s.jsx(st,{onClick:n,icon:r,title:i,description:o}),e[3]=o,e[4]=i,e[5]=n,e[6]=r,e[7]=c):c=e[7],c}function ot(l){const e=G.c(38),{providers:t,onSelect:i,onShowAll:o}=l,n=se();let r;e[0]!==t?(r=t.find(ps),e[0]=t,e[1]=r):r=e[1];const c=r;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=u):u=e[2];const d=u;let a;if(e[3]!==i||e[4]!==t||e[5]!==n){let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=(j,w)=>{const T=d[j.id]??Number.MAX_SAFE_INTEGER,A=d[w.id]??Number.MAX_SAFE_INTEGER;return T-A},e[7]=P):P=e[7];const E=t.filter(fs).sort(P);let _;e[8]!==t?(_=t.find(hs),e[8]=t,e[9]=_):_=e[9];const x=_;let N;e[10]===Symbol.for("react.memo_cache_sentinel")?(N=be("openai"),e[10]=N):N=e[10];const C=N;let M;e[11]!==i?(M=j=>s.jsx(ge,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"provider",provider:j})},j.id),e[11]=i,e[12]=M):M=e[12];let v;e[13]!==i||e[14]!==x?(v=x&&C?[s.jsx(ge,{logo:C.logo,name:C.name,description:C.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:C})},C.id)]:[],e[13]=i,e[14]=x,e[15]=v):v=e[15];let g;e[16]!==i||e[17]!==x||e[18]!==n?(g=x?[...nt.filter(ms).map(j=>s.jsx(ge,{logo:j.logo,name:j.name,description:j.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:j})},j.id)),s.jsx(ge,{logo:x.logo,name:n("settings.aiProviders.customOpenAiCompatible"),description:n("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=n,e[19]=g):g=e[19],a=[...E.map(M),...v,...g],e[3]=i,e[4]=t,e[5]=n,e[6]=a}else a=e[6];const h=a,p=h.length-Ue,m=!!o&&p>0;let f;e[20]!==h||e[21]!==m?(f=m?h.slice(0,Ue):h,e[20]=h,e[21]=m,e[22]=f):f=e[22];const b=f;let k;e[23]!==c||e[24]!==i||e[25]!==n?(k=c&&s.jsx(Ae,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:n("settings.aiProviders.recommended")}),s.jsx(Te,{className:"relative",children:s.jsx(ge,{logo:c.logo,name:c.name,description:c.description,onClick:()=>i({kind:"provider",provider:c})})})]})}),e[23]=c,e[24]=i,e[25]=n,e[26]=k):k=e[26];let y;e[27]!==p||e[28]!==o||e[29]!==m||e[30]!==n?(y=m&&s.jsx(st,{onClick:o,title:n("settings.aiProviders.moreProviders",{count:p,plural:p===1?"":"s"}),action:s.jsx(Yt,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=m,e[30]=n,e[31]=y):y=e[31];let S;e[32]!==y||e[33]!==b?(S=s.jsx(Ae,{children:s.jsxs(Te,{children:[b,y]})}),e[32]=y,e[33]=b,e[34]=S):S=e[34];let I;return e[35]!==k||e[36]!==S?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[k,S]}),e[35]=k,e[36]=S,e[37]=I):I=e[37],I}function ms(l){return l.id!=="openai"}function hs(l){return l.id==="openai-compatible"}function fs(l){return l.id!=="deco"&&l.id!=="openai-compatible"}function ps(l){return l.id==="deco"}const xs=He({label:ve().optional(),apiKey:ve().min(1,"API key is required")});function gs(l){const e=G.c(87),{providerId:t,onCancel:i,onSuccess:o}=l,{org:n}=xe(),r=we(),c=Ie(),[u,d]=V.useState(!1),a=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={resolver:qe(xs),defaultValues:{label:"",apiKey:""}},e[0]=h):h=e[0];const{register:p,handleSubmit:m,formState:f}=Ge(h),{errors:b}=f;let k;e[1]!==t||e[2]!==r||e[3]!==a?(k=async U=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:U.label||a("settings.connectForms.defaultKeyLabel"),apiKey:U.apiKey})},e[1]=t,e[2]=r,e[3]=a,e[4]=k):k=e[4];let y;e[5]!==o||e[6]!==n||e[7]!==c||e[8]!==a?(y=()=>{c.invalidateQueries({queryKey:ce.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:ce.aiProviders(n.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[5]=o,e[6]=n,e[7]=c,e[8]=a,e[9]=y):y=e[9];let S;e[10]!==a?(S=U=>{le.error(a("settings.connectForms.failedSaveKey",{error:U.message}))},e[10]=a,e[11]=S):S=e[11];let I;e[12]!==k||e[13]!==y||e[14]!==S?(I={mutationFn:k,onSuccess:y,onError:S},e[12]=k,e[13]=y,e[14]=S,e[15]=I):I=e[15];const{mutate:P,isPending:E,error:_}=ke(I);let x;e[16]!==P?(x=U=>P(U),e[16]=P,e[17]=x):x=e[17];let N;e[18]!==m||e[19]!==x?(N=m(x),e[18]=m,e[19]=x,e[20]=N):N=e[20];let C;e[21]!==a?(C=a("settings.connectForms.labelField"),e[21]=a,e[22]=C):C=e[22];let M;e[23]!==C?(M=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:C}),e[23]=C,e[24]=M):M=e[24];let v;e[25]!==a?(v=a("settings.connectForms.labelPlaceholder"),e[25]=a,e[26]=v):v=e[26];let g;e[27]!==p?(g=p("label"),e[27]=p,e[28]=g):g=e[28];let j;e[29]!==v||e[30]!==g?(j=s.jsx(pe,{placeholder:v,...g,className:"h-8 text-sm"}),e[29]=v,e[30]=g,e[31]=j):j=e[31];let w;e[32]!==M||e[33]!==j?(w=s.jsxs("div",{className:"space-y-1",children:[M,j]}),e[32]=M,e[33]=j,e[34]=w):w=e[34];let T;e[35]!==a?(T=a("settings.connectForms.apiKeyField"),e[35]=a,e[36]=T):T=e[36];let A;e[37]!==T?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[37]=T,e[38]=A):A=e[38];const O=u?"text":"password";let z;e[39]!==p?(z=p("apiKey"),e[39]=p,e[40]=z):z=e[40];let F;e[41]!==O||e[42]!==z?(F=s.jsx(pe,{type:O,placeholder:"sk-...",...z,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=O,e[42]=z,e[43]=F):F=e[43];let K;e[44]!==u?(K=()=>d(!u),e[44]=u,e[45]=K):K=e[45];let R;e[46]!==u||e[47]!==a?(R=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=u,e[47]=a,e[48]=R):R=e[48];let W;e[49]!==u?(W=u?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[49]=u,e[50]=W):W=e[50];let Q;e[51]!==K||e[52]!==R||e[53]!==W?(Q=s.jsx("button",{type:"button",onClick:K,"aria-label":R,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:W}),e[51]=K,e[52]=R,e[53]=W,e[54]=Q):Q=e[54];let J;e[55]!==F||e[56]!==Q?(J=s.jsxs("div",{className:"relative",children:[F,Q]}),e[55]=F,e[56]=Q,e[57]=J):J=e[57];let Z;e[58]!==b.apiKey?(Z=b.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[58]=b.apiKey,e[59]=Z):Z=e[59];let X;e[60]!==A||e[61]!==J||e[62]!==Z?(X=s.jsxs("div",{className:"space-y-1",children:[A,J,Z]}),e[60]=A,e[61]=J,e[62]=Z,e[63]=X):X=e[63];let ee;e[64]!==_?(ee=_&&s.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[64]=_,e[65]=ee):ee=e[65];let H;e[66]!==a?(H=a("settings.connectForms.cancel"),e[66]=a,e[67]=H):H=e[67];let q;e[68]!==E||e[69]!==i||e[70]!==H?(q=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:E,children:H}),e[68]=E,e[69]=i,e[70]=H,e[71]=q):q=e[71];let Y;e[72]!==E||e[73]!==a?(Y=a(E?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=E,e[73]=a,e[74]=Y):Y=e[74];let L;e[75]!==E||e[76]!==Y?(L=s.jsx(ne,{type:"submit",size:"sm",disabled:E,children:Y}),e[75]=E,e[76]=Y,e[77]=L):L=e[77];let D;e[78]!==q||e[79]!==L?(D=s.jsxs(Xe,{children:[q,L]}),e[78]=q,e[79]=L,e[80]=D):D=e[80];let $;return e[81]!==w||e[82]!==X||e[83]!==ee||e[84]!==D||e[85]!==N?($=s.jsxs("form",{onSubmit:N,className:"space-y-3",children:[w,X,ee,D]}),e[81]=w,e[82]=X,e[83]=ee,e[84]=D,e[85]=N,e[86]=$):$=e[86],$}const vs=He({label:ve().optional(),baseUrl:ve().min(1,"Base URL is required"),apiKey:ve().optional()});function bs(l){const e=G.c(105),{preset:t,onCancel:i,onSuccess:o}=l,{org:n}=xe(),r=we(),c=Ie(),[u,d]=V.useState(!1),a=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=qe(vs),e[0]=h):h=e[0];const p=t?.defaultBaseUrl??"";let m;e[1]!==p?(m={resolver:h,defaultValues:{label:"",baseUrl:p,apiKey:""}},e[1]=p,e[2]=m):m=e[2];const{register:f,handleSubmit:b,formState:k}=Ge(m),{errors:y}=k;let S;e[3]!==t||e[4]!==r?(S=async ae=>{const pt=JSON.stringify({baseUrl:ae.baseUrl,apiKey:ae.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ae.label||t?.name||ae.baseUrl,apiKey:pt,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=S):S=e[5];let I;e[6]!==o||e[7]!==n||e[8]!==c||e[9]!==a?(I=()=>{c.invalidateQueries({queryKey:ce.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:ce.aiProviders(n.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[6]=o,e[7]=n,e[8]=c,e[9]=a,e[10]=I):I=e[10];let P;e[11]!==a?(P=ae=>{le.error(a("settings.connectForms.failedSaveConnection",{error:ae.message}))},e[11]=a,e[12]=P):P=e[12];let E;e[13]!==S||e[14]!==I||e[15]!==P?(E={mutationFn:S,onSuccess:I,onError:P},e[13]=S,e[14]=I,e[15]=P,e[16]=E):E=e[16];const{mutate:_,isPending:x,error:N}=ke(E);let C;e[17]!==t||e[18]!==a?(C=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=a,e[19]=C):C=e[19];const M=C;let v;e[20]!==t?.baseUrlPlaceholder||e[21]!==a?(v=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=a,e[22]=v):v=e[22];const g=v;let j;e[23]!==_?(j=ae=>_(ae),e[23]=_,e[24]=j):j=e[24];let w;e[25]!==b||e[26]!==j?(w=b(j),e[25]=b,e[26]=j,e[27]=w):w=e[27];let T;e[28]!==a?(T=a("settings.connectForms.labelField"),e[28]=a,e[29]=T):T=e[29];let A;e[30]!==T?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[30]=T,e[31]=A):A=e[31];let O;e[32]!==f?(O=f("label"),e[32]=f,e[33]=O):O=e[33];let z;e[34]!==M||e[35]!==O?(z=s.jsx(pe,{placeholder:M,...O,className:"h-8 text-sm"}),e[34]=M,e[35]=O,e[36]=z):z=e[36];let F;e[37]!==A||e[38]!==z?(F=s.jsxs("div",{className:"space-y-1",children:[A,z]}),e[37]=A,e[38]=z,e[39]=F):F=e[39];let K;e[40]!==g||e[41]!==y||e[42]!==t?.defaultBaseUrl||e[43]!==f||e[44]!==a?(K=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...f("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),s.jsx(pe,{type:"url",placeholder:g,...f("baseUrl"),className:"h-8 text-sm"}),y.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[40]=g,e[41]=y,e[42]=t?.defaultBaseUrl,e[43]=f,e[44]=a,e[45]=K):K=e[45];let R;e[46]!==a?(R=a("settings.connectForms.apiKeyField"),e[46]=a,e[47]=R):R=e[47];let W;e[48]!==t?.apiKeyRecommended||e[49]!==a?(W=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=a,e[50]=W):W=e[50];let Q;e[51]!==W?(Q=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",W,")"]}),e[51]=W,e[52]=Q):Q=e[52];let J;e[53]!==R||e[54]!==Q?(J=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[R," ",Q]}),e[53]=R,e[54]=Q,e[55]=J):J=e[55];const Z=u?"text":"password";let X;e[56]!==f?(X=f("apiKey"),e[56]=f,e[57]=X):X=e[57];let ee;e[58]!==Z||e[59]!==X?(ee=s.jsx(pe,{type:Z,placeholder:"sk-...",...X,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=Z,e[59]=X,e[60]=ee):ee=e[60];let H;e[61]!==u?(H=()=>d(!u),e[61]=u,e[62]=H):H=e[62];let q;e[63]!==u||e[64]!==a?(q=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=u,e[64]=a,e[65]=q):q=e[65];let Y;e[66]!==u?(Y=u?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[66]=u,e[67]=Y):Y=e[67];let L;e[68]!==H||e[69]!==q||e[70]!==Y?(L=s.jsx("button",{type:"button",onClick:H,"aria-label":q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Y}),e[68]=H,e[69]=q,e[70]=Y,e[71]=L):L=e[71];let D;e[72]!==ee||e[73]!==L?(D=s.jsxs("div",{className:"relative",children:[ee,L]}),e[72]=ee,e[73]=L,e[74]=D):D=e[74];let $;e[75]!==J||e[76]!==D?($=s.jsxs("div",{className:"space-y-1",children:[J,D]}),e[75]=J,e[76]=D,e[77]=$):$=e[77];let U;e[78]!==t?(U=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=U):U=e[79];let B;e[80]!==N?(B=N&&s.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[80]=N,e[81]=B):B=e[81];let re;e[82]!==a?(re=a("settings.connectForms.cancel"),e[82]=a,e[83]=re):re=e[83];let de;e[84]!==x||e[85]!==i||e[86]!==re?(de=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:re}),e[84]=x,e[85]=i,e[86]=re,e[87]=de):de=e[87];let ue;e[88]!==x||e[89]!==a?(ue=a(x?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=x,e[89]=a,e[90]=ue):ue=e[90];let me;e[91]!==x||e[92]!==ue?(me=s.jsx(ne,{type:"submit",size:"sm",disabled:x,children:ue}),e[91]=x,e[92]=ue,e[93]=me):me=e[93];let he;e[94]!==de||e[95]!==me?(he=s.jsxs(Xe,{children:[de,me]}),e[94]=de,e[95]=me,e[96]=he):he=e[96];let ye;return e[97]!==w||e[98]!==F||e[99]!==K||e[100]!==$||e[101]!==U||e[102]!==B||e[103]!==he?(ye=s.jsxs("form",{onSubmit:w,className:"space-y-3",children:[F,K,$,U,B,he]}),e[97]=w,e[98]=F,e[99]=K,e[100]=$,e[101]=U,e[102]=B,e[103]=he,e[104]=ye):ye=e[104],ye}const ys={kind:"closed"};function js(l,e){switch(e.type){case"open":return l.kind==="closed"?{kind:"grid"}:l;case"close":return{kind:"closed"};case"back":switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return l}case"select-form":return l.kind!=="grid"?l:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return l.kind!=="grid"?l:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return l.kind==="oauth-pending"?{kind:"grid"}:l;case"select-provision":return l.kind!=="grid"?l:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return l.kind!=="provision-pending"?l:{kind:"provision-error",providerId:l.providerId,error:e.error};case"retry-provision":return l.kind!=="provision-error"?l:{kind:"provision-pending",providerId:l.providerId}}}function Ss(l){switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return l.providerId;default:return null}}function Ns({open:l,onOpenChange:e,initialProvider:t}){const i=se(),n=Me()?.providers??[],{org:r}=xe(),c=we(),u=Ie(),[d,a]=V.useReducer(js,ys),h=V.useRef(!1);V.useEffect(()=>{l&&d.kind==="closed"?a({type:"open"}):!l&&d.kind!=="closed"&&a({type:"close"})},[l,d.kind]);const p=()=>{h.current=!1,a({type:"close"}),e(!1)},m=()=>{u.invalidateQueries({queryKey:ce.aiProviderKeys(r.id)}),u.invalidateQueries({queryKey:ce.aiProviders(r.id)})},{mutate:f}=ke({mutationFn:async({providerId:v,code:g,stateToken:j,label:w})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:g,stateToken:j,label:w}),v),onSuccess:v=>{ie("ai_provider_oauth_succeeded",{provider_id:v}),m();const g=n.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_oauth_failed",{provider_id:g.providerId,error:v.message}),le.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),a({type:"oauth-failed"})}}),{mutate:b}=ke({mutationFn:async v=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{ie("ai_provider_provision_succeeded",{provider_id:v}),m();const g=n.find(j=>j.id===v);le.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ie("ai_provider_provision_failed",{provider_id:g,error:v.message}),a({type:"provision-error",error:v.message})}}),k=async v=>{const{provider:g}=v,j=v.kind==="openai-compatible"?v.preset?.id??null:null,w=g.supportedMethods.includes("oauth-pkce"),T=g.supportedMethods.includes("api-key");if(g.supportsProvision===!0){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"provision"}),a({type:"select-provision",providerId:g.id}),b(g.id);return}if(w){ie("ai_provider_connect_clicked",{provider_id:g.id,method:"oauth-pkce"});try{const O=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:g.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:g.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}T&&(ie("ai_provider_connect_clicked",{provider_id:g.id,...j!==null?{preset_id:j}:{},method:"api-key"}),a({type:"select-form",providerId:g.id,presetId:j}))},y=V.useRef(k);y.current=k;const S=V.useRef(t);S.current=t,V.useEffect(()=>{!S.current||d.kind!=="grid"||h.current||(h.current=!0,y.current(S.current))},[d.kind]);const I=d.kind==="oauth-pending"?d.stateToken:null,P=d.kind==="oauth-pending"?d.providerId:null;V.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const g=d.stateToken,j=d.providerId,w=A=>{if(A.origin!==window.location.origin||A.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:z}=A.data;if(z!==g){le.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}v=!0;const F=n.find(K=>K.id===j);f({providerId:j,code:O,stateToken:g,label:F?.name??j})};window.addEventListener("message",w);const T=setTimeout(()=>{v||(ie("ai_provider_oauth_timeout",{provider_id:j}),a({type:"oauth-failed"}),le.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",w),clearTimeout(T)}},[d.kind,I,P,f]);const E=Ss(d),_=E?n.find(v=>v.id===E):null,N=(d.kind==="form"&&d.presetId?be(d.presetId):null)?.name??_?.name??i("settings.connectProviderDialog.defaultTitle"),C=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():a({type:"back"})};return s.jsx(Ye,{open:d.kind!=="closed",onOpenChange:v=>!v&&p(),children:s.jsxs(Qe,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(St,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(ne,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:M,children:s.jsx(et,{size:16})}),s.jsx(Je,{children:N})]}),d.kind==="grid"&&!t&&s.jsx(Nt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(ot,{providers:n,onSelect:k}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(bs,{preset:d.presetId?be(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}}):s.jsx(gs,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Xt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(ne,{size:"sm",onClick:()=>{a({type:"retry-provision"}),b(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function ks(){const l=G.c(7),{org:e}=xe(),t=we();let i;l[0]!==e.id?(i=ce.defaultBrand(e.id),l[0]=e.id,l[1]=i):i=l[1];let o;l[2]!==t?(o=async()=>{const{items:c}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(c)?c:[]).find(Cs)??null},l[2]=t,l[3]=o):o=l[3];let n;l[4]!==i||l[5]!==o?(n={queryKey:i,queryFn:o},l[4]=i,l[5]=o,l[6]=n):n=l[6];const{data:r}=vt(n);return r??null}function Cs(l){return l.isDefault&&!l.archivedAt}function ws(l){const e=l.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(o=>typeof o=="object"&&o!==null&&"label"in o&&/primary|brand|main/i.test(o.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Is(l){const e=G.c(66);let t;e[0]!==l?(t=l===void 0?{}:l,e[0]=l,e[1]=t):t=e[1];const{title:i,description:o,onLocalRuntimePicked:n}=t,r=se(),{org:c}=xe(),{localMode:u}=gt(),d=ks(),a=Et(),h=Ot(),[p,m]=V.useState(null),[f,b]=V.useState(!1),[k,y]=V.useState(!1),S=Me();let I;e[2]!==S?.providers?(I=S?.providers??[],e[2]=S?.providers,e[3]=I):I=e[3];const P=I;let E,_,x;if(e[4]!==d||e[5]!==h||e[6]!==o||e[7]!==a.capabilities||e[8]!==a.online||e[9]!==u||e[10]!==n||e[11]!==c.name||e[12]!==r||e[13]!==i){const O=[];if(a.online){if(a.capabilities.includes("claude-code")){let B;e[17]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(Se,{size:16}),e[17]=B):B=e[17],O.push({option:"claude-code-desktop",label:"Claude Code",icon:B})}if(a.capabilities.includes("codex")){let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(Ne,{size:16}),e[18]=B):B=e[18],O.push({option:"codex-desktop",label:"Codex",icon:B})}}const z=O.length>0&&h!==null,F=c.name;let K;e[19]!==d?(K=d?ws(d):null,e[19]=d,e[20]=K):K=e[20];const R=K,W=d?.favicon??d?.logo??null;let Q;e[21]!==F||e[22]!==r||e[23]!==i?(Q=i??(F?r("chat.noAiProviderEmptyState.headingWithOrg",{org:F}):r("chat.noAiProviderEmptyState.headingDefault")),e[21]=F,e[22]=r,e[23]=i,e[24]=Q):Q=e[24];const J=Q;let Z;e[25]!==o||e[26]!==z||e[27]!==u||e[28]!==r?(Z=o??r(z?"chat.noAiProviderEmptyState.subtitleWithDesktop":u?"chat.noAiProviderEmptyState.subtitleLocalMode":"chat.noAiProviderEmptyState.subtitleDefault"),e[25]=o,e[26]=z,e[27]=u,e[28]=r,e[29]=Z):Z=e[29];const X=Z,ee=!!(W||R);let H;e[30]!==R?(H=R?{backgroundColor:`${R}18`,borderColor:`${R}30`}:void 0,e[30]=R,e[31]=H):H=e[31];const q=H,Y=ee?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";E="flex flex-col items-center gap-8 w-full max-w-3xl px-4";let L;e[32]!==Y||e[33]!==q||e[34]!==W||e[35]!==a.online||e[36]!==R||e[37]!==r?(L=W?s.jsx("div",{className:Y,style:q,children:s.jsx("img",{src:W,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>y(!0),"aria-label":a.online?r("chat.noAiProviderEmptyState.desktopLinkedLabel"):r("chat.noAiProviderEmptyState.connectDesktopLabel"),className:oe(Y,"cursor-pointer transition-colors hover:bg-accent"),style:q,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(Gt,{size:24,style:R?{color:R}:void 0,className:oe(!R&&"text-muted-foreground")}),a.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[32]=Y,e[33]=q,e[34]=W,e[35]=a.online,e[36]=R,e[37]=r,e[38]=L):L=e[38];let D;e[39]!==J?(D=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:J}),e[39]=J,e[40]=D):D=e[40];let $;e[41]!==X?($=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:X}),e[41]=X,e[42]=$):$=e[42];let U;e[43]!==D||e[44]!==$?(U=s.jsxs("div",{className:"space-y-2",children:[D,$]}),e[43]=D,e[44]=$,e[45]=U):U=e[45],e[46]!==L||e[47]!==U?(_=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[L,U]}),e[46]=L,e[47]=U,e[48]=_):_=e[48],x=z&&s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:O.map(B=>s.jsxs(ne,{variant:"default",className:"gap-2",onClick:()=>{h?.setPendingAgentOption(B.option),n?.(B.option)},children:[B.icon,r("chat.noAiProviderEmptyState.useLabel",{label:B.label})]},B.option))}),s.jsxs("div",{className:"flex items-center gap-3 w-full max-w-xs text-xs text-muted-foreground",children:[s.jsx("span",{className:"h-px flex-1 bg-border"}),r("chat.noAiProviderEmptyState.orConnectProvider"),s.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),e[4]=d,e[5]=h,e[6]=o,e[7]=a.capabilities,e[8]=a.online,e[9]=u,e[10]=n,e[11]=c.name,e[12]=r,e[13]=i,e[14]=E,e[15]=_,e[16]=x}else E=e[14],_=e[15],x=e[16];let N,C;e[49]===Symbol.for("react.memo_cache_sentinel")?(N=O=>m(O),C=()=>b(!0),e[49]=N,e[50]=C):(N=e[49],C=e[50]);let M;e[51]!==P?(M=s.jsx("div",{className:"w-full",children:s.jsx(ot,{providers:P,onSelect:N,onShowAll:C})}),e[51]=P,e[52]=M):M=e[52];const v=p!==null||f;let g;e[53]===Symbol.for("react.memo_cache_sentinel")?(g=O=>{O||(m(null),b(!1))},e[53]=g):g=e[53];const j=p??void 0;let w;e[54]!==j||e[55]!==v?(w=s.jsx(Ns,{open:v,onOpenChange:g,initialProvider:j}),e[54]=j,e[55]=v,e[56]=w):w=e[56];let T;e[57]!==k?(T=s.jsx(Jt,{open:k,onOpenChange:y}),e[57]=k,e[58]=T):T=e[58];let A;return e[59]!==w||e[60]!==T||e[61]!==E||e[62]!==_||e[63]!==x||e[64]!==M?(A=s.jsxs("div",{className:E,children:[_,x,M,w,T]}),e[59]=w,e[60]=T,e[61]=E,e[62]=_,e[63]=x,e[64]=M,e[65]=A):A=e[65],A}function Oe(l){const e=l.title.includes(": ");return{provider:e?l.title.split(": ")[0]??"":l.modelId.split("/")[0]??"",displayName:e?l.title.split(": ").slice(1).join(": "):l.title}}function _s(l){return l<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:l<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:l<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const Ms=["bg-destructive","bg-warning","bg-success","bg-success"],Es=["text-success","text-warning","text-warning","text-destructive"];function Os(l,e){const t=Math.round(l*.75/1e3),i=t>=1?`${t}K`:`${Math.round(l*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Ps(l){return l<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:l<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:l<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Ls={text:{icon:s.jsx(Bt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Ut,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Ft,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx($t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(Zt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function As(l){const e=G.c(10),{capability:t}=l,i=se(),o=Ls[t];if(o){const u=o.icon;let d;e[0]!==o.labelKey||e[1]!==i?(d=i(o.labelKey),e[0]=o.labelKey,e[1]=i,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[u,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let n;e[6]!==t?(n=t.charAt(0).toUpperCase(),e[6]=t,e[7]=n):n=e[7];const r=n+t.slice(1);let c;return e[8]!==r?(c=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=c):c=e[9],c}function Ts(l){const e=G.c(59),{model:t,compact:i}=l,o=i===void 0?!1:i,n=se();if(!t){let x;e[0]!==n?(x=n("chat.shared.hoverToPreview"),e[0]=n,e[1]=x):x=e[1];let N;return e[2]!==x?(N=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=N):N=e[3],N}const r=t.costs?.input!=null?t.costs.input*1e6:null,c=t.costs?.output!=null?t.costs.output*1e6:null;let u;e[4]!==t?(u=Oe(t),e[4]=t,e[5]=u):u=e[5];const{provider:d,displayName:a}=u;if(o){let x;e[6]!==t.limits||e[7]!==n?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",n("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=n,e[8]=x):x=e[8];let N;e[9]!==r||e[10]!==n?(N=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=n,e[11]=N):N=e[11];let C;e[12]!==c||e[13]!==n?(C=c!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=n,e[14]=C):C=e[14];let M;e[15]!==t.limits||e[16]!==n?(M=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:n("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",n("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=n,e[17]=M):M=e[17];let v;return e[18]!==x||e[19]!==N||e[20]!==C||e[21]!==M?(v=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,N,C,M]}),e[18]=x,e[19]=N,e[20]=C,e[21]=M,e[22]=v):v=e[22],v}let h;e[23]!==d?(h=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=h):h=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let m;e[28]!==a?(m=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=m):m=e[29];let f;e[30]!==p||e[31]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,m]}),e[30]=p,e[31]=m,e[32]=f):f=e[32];let b;e[33]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=b):b=e[34];let k;e[35]!==h||e[36]!==f||e[37]!==b?(k=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[h,f,b]}),e[35]=h,e[36]=f,e[37]=b,e[38]=k):k=e[38];let y;e[39]!==t.capabilities?(y=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(zs)}),e[39]=t.capabilities,e[40]=y):y=e[40];let S;e[41]!==t.limits||e[42]!==n?(S=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:N,descriptionKey:C}=_s(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>s.jsx("div",{className:oe("w-2 h-2 rounded-full",M<=x?Ms[x-1]:"bg-muted")},M))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:n(N)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",n(C)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",n("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=n,e[43]=S):S=e[43];let I;e[44]!==t.limits||e[45]!==n?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",n("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Os(t.limits.maxOutputTokens,n)})]})]}),e[44]=t.limits,e[45]=n,e[46]=I):I=e[46];let P;e[47]!==r||e[48]!==c||e[49]!==n?(P=(r!=null||c!=null)&&(()=>{const{level:x,labelKey:N}=r!=null?Ps(r):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n("chat.shared.pricing")}),r!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:oe("text-sm font-bold leading-none",C<=x?Es[x-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N?n(N):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",n("chat.shared.tokens")]})]}),c!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",n("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=c,e[49]=n,e[50]=P):P=e[50];let E;e[51]!==S||e[52]!==I||e[53]!==P?(E=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,I,P]}),e[51]=S,e[52]=I,e[53]=P,e[54]=E):E=e[54];let _;return e[55]!==E||e[56]!==k||e[57]!==y?(_=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[k,y,E]}),e[55]=E,e[56]=k,e[57]=y,e[58]=_):_=e[58],_}function zs(l){return s.jsx(As,{capability:l},l)}function rt(l){const e=G.c(22),{model:t,placeholder:i,isLoading:o}=l,n=o===void 0?!1:o,r=se();let c;e[0]!==i||e[1]!==r?(c=i??r("chat.shared.selectModel"),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;if(n){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(te,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(te,{className:"w-16 h-3 hidden md:block"})]}),e[3]=y):y=e[3],y}if(!t){let y;e[4]!==u?(y=s.jsx("span",{className:"text-sm text-muted-foreground",children:u}),e[4]=u,e[5]=y):y=e[5];let S;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=S):S=e[6];let I;return e[7]!==y?(I=s.jsxs("div",{className:"flex items-center gap-1.5",children:[y,S]}),e[7]=y,e[8]=I):I=e[8],I}let d;e[9]!==t?(d=Oe(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let h;e[11]!==t?(h=Ee(t),e[11]=t,e[12]=h):h=e[12];const p=h;let m;e[13]!==t.title||e[14]!==p?(m=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=m):m=e[15];let f;e[16]!==a?(f=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=f):f=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=b):b=e[18];let k;return e[19]!==m||e[20]!==f?(k=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[m,f,b]}),e[19]=m,e[20]=f,e[21]=k):k=e[21],k}const Rs=["vision","image","file","audio","video"],at=["image/png","image/jpeg","image/gif","image/webp"],ct=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Pe(l){const e=l?.capabilities;return e?Rs.some(t=>e.includes(t)):!1}function qi(l,e){if(!l)return!1;if(l.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),o=t.includes("file"),n=t.includes("audio"),r=t.includes("video");return!!(i&&at.includes(l)||o&&l==="application/pdf"||n&&l.startsWith("audio/")||r&&l.startsWith("video/")||Pe(e)&&ct.includes(l))}function Gi(l){const e=l?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...at),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Pe(l)&&t.push(...ct),t.join(",")}function Xi(l){const e=l?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Pe(l)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const dt=["smarter","faster","cheaper"],Fs={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ds=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ks=Ds.flatMap(({tier:l,prefixes:e})=>e.map(t=>({tier:l,prefix:t}))).sort((l,e)=>e.prefix.length-l.prefix.length),$s="google/gemini-2.5-pro",Be=new Map;function Us(l){const e=Be.get(l);if(e!==void 0)return e;let t=null;if(l.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:o}of Ks)if(l.startsWith(o)){if(o===$s&&l.length>o.length&&l[o.length]==="-"){const r=l[o.length+1];if(!r||!/\d/.test(r))continue}t=i;break}return Be.set(l,t),t}function We(l){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of l){const i=Us(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,o)=>i.title.localeCompare(o.title));return e}const ut="studio:model-shortlist:",Bs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Ws(l){try{const e=localStorage.getItem(ut+l);return e?new Set(JSON.parse(e)):null}catch{return null}}function Vs(l,e){localStorage.setItem(ut+l,JSON.stringify([...e]))}function Hs(l){const e=G.c(21),{model:t,onHover:i}=l;let o;e[0]!==t?(o=Oe(t),e[0]=t,e[1]=o):o=e[1];const{displayName:n,provider:r}=o;let c;e[2]!==t?(c=Ee(t),e[2]=t,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==u?(a=s.jsx("img",{src:u,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=u,e[9]=a):a=e[9];let h;e[10]!==n?(h=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:n}),e[10]=n,e[11]=h):h=e[11];let p;e[12]!==r?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let m;e[14]!==h||e[15]!==p?(m=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[h,p]}),e[14]=h,e[15]=p,e[16]=m):m=e[16];let f;return e[17]!==d||e[18]!==a||e[19]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,m]}),e[17]=d,e[18]=a,e[19]=m,e[20]=f):f=e[20],f}function qs(l){const e=G.c(16),{error:t,onRetry:i}=l,o=se();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(jt,{className:"size-5 text-destructive"})}),e[0]=n):n=e[0];const r=o("chat.decopilot.failedToLoadModels");let c;e[1]!==r?(c=s.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=c):c=e[2];const u=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==u||e[4]!==d?(a=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[u,d]}),e[3]=u,e[4]=d,e[5]=a):a=e[5];let h;e[6]!==c||e[7]!==a?(h=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,a]}),e[6]=c,e[7]=a,e[8]=h):h=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Kt,{className:"size-3.5"}),e[9]=p):p=e[9];const m=o("chat.decopilot.retry");let f;e[10]!==i||e[11]!==m?(f=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,m]})}),e[10]=i,e[11]=m,e[12]=f):f=e[12];let b;return e[13]!==f||e[14]!==h?(b=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[n,h,f]}),e[13]=f,e[14]=h,e[15]=b):b=e[15],b}function Gs(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Xs)}),l[0]=e):e=l[0],e}function Xs(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ve(l){const e=G.c(12),{label:t,models:i,onSelect:o,onHover:n}=l;if(i.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==i||e[3]!==n||e[4]!==o){let d;e[6]!==n||e[7]!==o?(d=a=>s.jsx("div",{onClick:()=>o(a),className:"cursor-pointer",children:s.jsx(Hs,{model:a,onHover:n})},a.modelId),e[6]=n,e[7]=o,e[8]=d):d=e[8],c=i.map(d),e[2]=i,e[3]=n,e[4]=o,e[5]=c}else c=e[5];let u;return e[9]!==r||e[10]!==c?(u=s.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function Ce(l,e){return e(l==="other"?"chat.decopilot.tierOther":Fs[l])}function Ys(l){const e=G.c(21),{model:t,isChecked:i,onToggle:o,onHover:n}=l,[r,c]=V.useState(i);r!==i&&c(i);let u;e[0]!==t?(u=Ee(t),e[0]=t,e[1]=u):u=e[1];const d=u;let a;e[2]!==t||e[3]!==n?(a=()=>n(t),e[2]=t,e[3]=n,e[4]=a):a=e[4];let h;e[5]!==t.modelId||e[6]!==o?(h=()=>{c(Qs),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=h):h=e[7];let p;e[8]!==r||e[9]!==h?(p=s.jsx(Pt,{checked:r,onCheckedChange:h}),e[8]=r,e[9]=h,e[10]=p):p=e[10];let m;e[11]!==d||e[12]!==t.title?(m=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=m):m=e[13];let f;e[14]!==t.title?(f=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let b;return e[16]!==a||e[17]!==p||e[18]!==m||e[19]!==f?(b=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,m,f]}),e[16]=a,e[17]=p,e[18]=m,e[19]=f,e[20]=b):b=e[20],b}function Qs(l){return!l}function Js(l,e){const t=[];for(const i of dt)if(l[i].length>0){t.push({type:"header",label:Ce(i,e)});for(const o of l[i])t.push({type:"model",model:o})}if(l.other.length>0){t.push({type:"header",label:Ce("other",e)});for(const i of l.other)t.push({type:"model",model:i})}return t}function Zs({items:l,shortlistSet:e,onToggle:t,onHover:i}){const o=V.useRef(null),n=us({count:l.length,getScrollElement:()=>o.current,estimateSize:r=>l[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:n.getTotalSize()},children:n.getVirtualItems().map(r=>{const c=l[r.index];return c?s.jsx("div",{"data-index":r.index,ref:n.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):s.jsx(Ys,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:i})},r.key):null})})})}function ei(l){const e=G.c(30),{keyId:t,searchTerm:i,onHover:o,onModelSelect:n,managing:r,onToggleManage:c,filterModels:u}=l,d=se(),{models:a}=qt(t),h=u?a.filter(u):a.filter(ti);let p;e[0]!==t?(p=()=>(t?Ws(t):null)??Bs,e[0]=t,e[1]=p):p=e[1];const[m,f]=V.useState(p),[,b]=V.useTransition();let k;e[2]!==t||e[3]!==b?(k=g=>{t&&b(()=>{f(j=>{const w=new Set(j);return w.has(g)?w.delete(g):w.add(g),Vs(t,w),w})})},e[2]=t,e[3]=b,e[4]=k):k=e[4];const y=k,S=i.toLowerCase().trim(),I=g=>S?g.filter(j=>j.title.toLowerCase().includes(S)||j.modelId.toLowerCase().includes(S)):g;if(r){const g=We(I(h)),j=Js(g,d);let w;e[5]!==m?(w=F=>m.has(F.modelId),e[5]=m,e[6]=w):w=e[6];const T=h.filter(w).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(et,{size:14}),e[7]=A):A=e[7];let O;e[8]!==d?(O=d("chat.decopilot.back"),e[8]=d,e[9]=O):O=e[9];let z;return e[10]!==c||e[11]!==O?(z=s.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,O]}),e[10]=c,e[11]=O,e[12]=z):z=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[z,s.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:T})})]}),s.jsx(Zs,{items:j,shortlistSet:m,onToggle:y,onHover:o})]})}let P;e[13]!==m?(P=g=>m.has(g.modelId),e[13]=m,e[14]=P):P=e[14];const E=h.filter(P),_=E.length>0?E:h,x=We(I(_));let N;e[15]!==x||e[16]!==o||e[17]!==n||e[18]!==d?(N=dt.map(g=>s.jsx(Ve,{label:Ce(g,d),models:x[g],onSelect:n,onHover:o},g)),e[15]=x,e[16]=o,e[17]=n,e[18]=d,e[19]=N):N=e[19];let C;e[20]!==d?(C=Ce("other",d),e[20]=d,e[21]=C):C=e[21];let M;e[22]!==x.other||e[23]!==o||e[24]!==n||e[25]!==C?(M=s.jsx(Ve,{label:C,models:x.other,onSelect:n,onHover:o}),e[22]=x.other,e[23]=o,e[24]=n,e[25]=C,e[26]=M):M=e[26];let v;return e[27]!==N||e[28]!==M?(v=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,M]}),e[27]=N,e[28]=M,e[29]=v):v=e[29],v}function ti(l){return l.asyncResearch!==!0}function si(){const l=G.c(6);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(te,{className:"size-4 shrink-0"}),s.jsx(te,{className:"flex-1 h-6"}),s.jsx(te,{className:"w-[140px] h-8 shrink-0"})]})}),l[0]=e):e=l[0];let t;l[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(ii)})]}),l[1]=t):t=l[1];let i;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(te,{className:"size-6 shrink-0"}),s.jsx(te,{className:"h-6 w-32"})]}),l[2]=i):i=l[2];let o;l[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{className:"h-6 w-20 rounded-md"}),s.jsx(te,{className:"h-6 w-24 rounded-md"})]})]}),l[3]=o):o=l[3];let n;l[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-24"}),s.jsx(te,{className:"h-4 w-32"})]}),l[4]=n):n=l[4];let r;return l[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,s.jsxs("div",{className:"flex flex-col gap-4",children:[n,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(te,{className:"h-4 w-16"}),s.jsx(te,{className:"h-4 w-40"})]})]})]})})]}),l[5]=r):r=l[5],r}function ii(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(te,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(te,{className:"flex-1 h-4"}),s.jsx(te,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function mt(l){const e=G.c(66),{onClose:t,credentialId:i,onCredentialChange:o,selectedModel:n,onModelChange:r,filterModels:c,compact:u}=l,d=se(),[a,h]=V.useState(null),[p,m]=V.useState(""),[f,b]=V.useState(!1),k=V.useRef(null),y=Me(),S=Ht();let I;e[0]!==y?.providers?(I=Object.fromEntries((y?.providers??[]).map(oi)),e[0]=y?.providers,e[1]=I):I=e[1];const P=I,E=bt(),{org:_}=xe();let x;e[2]!==o?(x=L=>{o(L),h(null)},e[2]=o,e[3]=x):x=e[3];const N=x;let C;e[4]!==i||e[5]!==t||e[6]!==r?(C=L=>{i&&(r(L),m(""),t())},e[4]=i,e[5]=t,e[6]=r,e[7]=C):C=e[7];const M=C;if(S.length===0){const L=!u&&"sm:w-[740px]";let D;e[8]!==L?(D=oe("flex items-center justify-center p-8 w-full",L),e[8]=L,e[9]=D):D=e[9];let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Is,{}),e[10]=$):$=e[10];let U;return e[11]!==D?(U=s.jsx("div",{className:D,children:$}),e[11]=D,e[12]=U):U=e[12],U}const v=u?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==v?(g=oe("flex flex-col md:flex-row h-full min-h-0",v),e[13]=v,e[14]=g):g=e[14];const j=u?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let w;e[15]!==j?(w=oe("flex-1 flex flex-col min-h-0 overflow-hidden",j),e[15]=j,e[16]=w):w=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx(tt,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=T):T=e[17];let A;e[18]!==f||e[19]!==d?(A=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=L=>m(L.target.value),e[21]=O):O=e[21];let z;e[22]!==p||e[23]!==A?(z=s.jsx(pe,{ref:k,type:"text",placeholder:A,value:p,onChange:O,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=A,e[24]=z):z=e[24];let F;e[25]!==i||e[26]!==N||e[27]!==S||e[28]!==P||e[29]!==d?(F=S.length>0&&s.jsxs(Lt,{value:i??"",onValueChange:N,children:[s.jsxs(At,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ni,children:[s.jsx(Tt,{placeholder:d("chat.decopilot.key"),children:(()=>{const L=S.find(re=>re.id===i),D=L?P[L.providerId]:void 0,$=be(L?.presetId),U=$?.logo??D?.logo,B=$?.name??D?.name??L?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[U?s.jsx("img",{src:U,alt:B,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:B.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:B})]})})()}),s.jsx(Wt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(zt,{children:S.map(L=>{const D=P[L.providerId],$=be(L.presetId),U=$?.logo??D?.logo,B=$?.name??D?.name??L.providerId;return s.jsx(Rt,{value:L.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[U?s.jsx("img",{src:U,alt:B,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:B.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[B," — ",L.label]})]})},L.id)})})]}),e[25]=i,e[26]=N,e[27]=S,e[28]=P,e[29]=d,e[30]=F):F=e[30];let K;e[31]!==z||e[32]!==F?(K=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[T,z,F]})}),e[31]=z,e[32]=F,e[33]=K):K=e[33];let R;e[34]!==i?(R=L=>{const{error:D,resetError:$}=L;return s.jsx(qs,{error:D,onRetry:$,credentialId:i??void 0})},e[34]=i,e[35]=R):R=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Gs,{}),e[36]=W):W=e[36];const Q=i??void 0;let J;e[37]===Symbol.for("react.memo_cache_sentinel")?(J=()=>b(li),e[37]=J):J=e[37];let Z;e[38]!==c||e[39]!==M||e[40]!==f||e[41]!==p||e[42]!==Q?(Z=s.jsx(V.Suspense,{fallback:W,children:s.jsx(ei,{keyId:Q,searchTerm:p,onHover:h,onModelSelect:M,managing:f,onToggleManage:J,filterModels:c})}),e[38]=c,e[39]=M,e[40]=f,e[41]=p,e[42]=Q,e[43]=Z):Z=e[43];let X;e[44]!==i||e[45]!==R||e[46]!==Z?(X=s.jsx(yt,{fallback:R,children:Z},i),e[44]=i,e[45]=R,e[46]=Z,e[47]=X):X=e[47];let ee;e[48]!==f||e[49]!==E||e[50]!==_||e[51]!==d?(ee=!f&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>V.startTransition(()=>b(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Dt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>E({to:"/$org/settings/ai-providers",params:{org:_.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Vt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=E,e[50]=_,e[51]=d,e[52]=ee):ee=e[52];let H;e[53]!==K||e[54]!==X||e[55]!==ee||e[56]!==w?(H=s.jsxs("div",{className:w,children:[K,X,ee]}),e[53]=K,e[54]=X,e[55]=ee,e[56]=w,e[57]=H):H=e[57];let q;e[58]!==u||e[59]!==a||e[60]!==n?(q=!u&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Ts,{model:a??n??null})}),e[58]=u,e[59]=a,e[60]=n,e[61]=q):q=e[61];let Y;return e[62]!==H||e[63]!==q||e[64]!==g?(Y=s.jsxs("div",{className:g,children:[H,q]}),e[62]=H,e[63]=q,e[64]=g,e[65]=Y):Y=e[65],Y}function li(l){return!l}function ni(l){return l.stopPropagation()}function oi(l){return[l.id,l]}function ri(l){const e=G.c(12),{onClose:t}=l,{credentialId:i,setCredentialId:o,selectedModel:n,setModel:r}=_e();let c;e[0]!==o?(c=a=>{ie("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=c):c=e[1];let u;e[2]!==i||e[3]!==n?.modelId||e[4]!==r?(u=a=>{i&&(ie("chat_model_changed",{from_model_id:n?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),r({...a,keyId:i}))},e[2]=i,e[3]=n?.modelId,e[4]=r,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==n||e[9]!==c||e[10]!==u?(d=s.jsx(mt,{onClose:t,credentialId:i,onCredentialChange:c,selectedModel:n,onModelChange:u}),e[6]=i,e[7]=t,e[8]=n,e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function ai(l){const e=G.c(2),{onClose:t}=l;let i;return e[0]!==t?(i=s.jsx(ri,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ci(l){const e=G.c(2);let t;return e[0]!==l?(t=s.jsx(mt,{...l}),e[0]=l,e[1]=t):t=e[1],t}const di=[{tier:"fast",labelKey:"chat.desktopCli.tierFastDescription"},{tier:"smart",labelKey:"chat.desktopCli.tierSmartDescription"},{tier:"thinking",labelKey:"chat.desktopCli.tierThinkingDescription"}];function ht(l){const e=G.c(11),{modelSet:t,selectedModelId:i,onSelect:o}=l,n=se();let r,c;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==o||e[4]!==i||e[5]!==n){const d=Object.fromEntries(t.models.map(ui));r="flex flex-col p-2 w-[320px]",c=di.map(a=>{const{tier:h,labelKey:p}=a,m=t.tiers[h];if(!m.modelId)return null;const f=d[m.modelId];if(!f)return null;const b=i===m.modelId;return s.jsxs("button",{type:"button",onClick:()=>o(f),className:oe("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",b&&"bg-accent/50"),children:[s.jsx("img",{src:t.logo,alt:m.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:m.label}),s.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:n(p)})]})]},h)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=o,e[4]=i,e[5]=n,e[6]=r,e[7]=c}else r=e[6],c=e[7];let u;return e[8]!==r||e[9]!==c?(u=s.jsx("div",{className:r,children:c}),e[8]=r,e[9]=c,e[10]=u):u=e[10],u}function ui(l){return[l.modelId,l]}const mi=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 5 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],je="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",hi=[{providerId:"codex",modelId:"codex:gpt-5.6-sol",title:"GPT-5.6 Sol",description:"Frontier Codex model for deep reasoning, complex coding, and real-world work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-terra",title:"GPT-5.6 Terra",description:"Balanced Codex model for everyday coding and agent work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-luna",title:"GPT-5.6 Luna",description:"Fast Codex model for lightweight coding tasks and titles",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:je,limits:null,costs:null}],fi="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",pi="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg";function xi(l){return{fast:{modelId:"claude-code:haiku",label:l("chat.agentModels.haikuLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Se,{size:16})},smart:{modelId:"claude-code:sonnet",label:l("chat.agentModels.sonnetLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Se,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:l("chat.agentModels.opusLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Se,{size:16})}}}function gi(l){return{fast:{modelId:"codex:gpt-5.6-luna",label:l("chat.agentModels.gptLunaLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Ne,{size:16})},smart:{modelId:"codex:gpt-5.6-terra",label:l("chat.agentModels.gptTerraLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Ne,{size:16})},thinking:{modelId:"codex:gpt-5.6-sol",label:l("chat.agentModels.gptSolLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Ne,{size:16})}}}function ft(l,e){return l==="claude-code"?{logo:fi,tiers:xi(e),models:mi}:l==="codex"?{logo:pi,tiers:gi(e),models:hi}:null}function vi(l){const e=G.c(12),{onClose:t,agent:i}=l,o=se(),n=_e(),r=i??n.pendingHarnessId??"decopilot";let c;e[0]!==r||e[1]!==o?(c=ft(r,o),e[0]=r,e[1]=o,e[2]=c):c=e[2];const u=c;if(!u){let p;return e[3]!==t?(p=s.jsx(ai,{onClose:t}),e[3]=t,e[4]=p):p=e[4],p}const d=n.selectedModel?.modelId??u.tiers[n.simpleModeTier].modelId;let a;e[5]!==t||e[6]!==n?(a=p=>{n.setModel({...p,keyId:void 0}),t()},e[5]=t,e[6]=n,e[7]=a):a=e[7];let h;return e[8]!==u||e[9]!==d||e[10]!==a?(h=s.jsx(ht,{modelSet:u,selectedModelId:d,onSelect:a}),e[8]=u,e[9]=d,e[10]=a,e[11]=h):h=e[11],h}function bi(l){const e=G.c(14);let t,i;e[0]!==l?({agent:t,...i}=l,e[0]=l,e[1]=t,e[2]=i):(t=e[1],i=e[2]);const o=se();let n;e[3]!==t||e[4]!==o?(n=t?ft(t,o):null,e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=n;if(!r){let a;return e[6]!==i?(a=s.jsx(ci,{...i}),e[6]=i,e[7]=a):a=e[7],a}const c=i.selectedModel?.modelId??r.tiers.smart.modelId;let u;e[8]!==i?(u=a=>{i.onModelChange(a),i.onClose()},e[8]=i,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==c||e[12]!==u?(d=s.jsx(ht,{modelSet:r,selectedModelId:c,onSelect:u}),e[10]=r,e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function Yi(l){const e=G.c(49),{variant:t,className:i,placeholder:o,model:n,isLoading:r,credentialId:c,onCredentialChange:u,onModelChange:d,filterModels:a,agent:h}=l,p=t===void 0?"borderless":t,m=o===void 0?"Select model":o,f=se(),[b,k]=V.useState(!1),y=d!==void 0,S=Mt(),I=p==="borderless"?"ghost":"outline",P=p==="borderless"&&"md:border-none";let E;e[0]!==i||e[1]!==P?(E=oe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",P,i),e[0]=i,e[1]=P,e[2]=E):E=e[2];let _;e[3]!==r||e[4]!==n||e[5]!==m||e[6]!==y?(_=y?s.jsx(rt,{model:n??null,placeholder:m,isLoading:r}):s.jsx(ji,{placeholder:m}),e[3]=r,e[4]=n,e[5]=m,e[6]=y,e[7]=_):_=e[7];let x;e[8]!==I||e[9]!==E||e[10]!==_?(x=s.jsx(ne,{variant:I,size:"sm",className:E,children:_}),e[8]=I,e[9]=E,e[10]=_,e[11]=x):x=e[11];const N=x;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(si,{}),e[12]=C):C=e[12];let M;e[13]!==h||e[14]!==c||e[15]!==a||e[16]!==n||e[17]!==u||e[18]!==d||e[19]!==y?(M=s.jsx(V.Suspense,{fallback:C,children:y?s.jsx(bi,{onClose:()=>k(!1),agent:h,credentialId:c??null,onCredentialChange:u??yi,selectedModel:n??null,onModelChange:d,filterModels:a}):s.jsx(vi,{onClose:()=>k(!1),agent:h})}),e[13]=h,e[14]=c,e[15]=a,e[16]=n,e[17]=u,e[18]=d,e[19]=y,e[20]=M):M=e[20];const v=M;if(S){let O;e[21]!==N?(O=s.jsx(Ct,{asChild:!0,children:N}),e[21]=N,e[22]=O):O=e[22];let z;e[23]!==f?(z=f("chat.selectModel.selectModel"),e[23]=f,e[24]=z):z=e[24];let F;e[25]!==z?(F=s.jsx(wt,{className:"sr-only",children:z}),e[25]=z,e[26]=F):F=e[26];let K;e[27]!==v?(K=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v}),e[27]=v,e[28]=K):K=e[28];let R;e[29]!==F||e[30]!==K?(R=s.jsxs(It,{className:"p-0 flex flex-col max-h-[95vh]",children:[F,K]}),e[29]=F,e[30]=K,e[31]=R):R=e[31];let W;return e[32]!==b||e[33]!==O||e[34]!==R?(W=s.jsxs(_t,{open:b,onOpenChange:k,children:[O,R]}),e[32]=b,e[33]=O,e[34]=R,e[35]=W):W=e[35],W}let g;e[36]!==N?(g=s.jsx(kt,{asChild:!0,children:N}),e[36]=N,e[37]=g):g=e[37];let j;e[38]!==f?(j=f("chat.selectModel.selectModel"),e[38]=f,e[39]=j):j=e[39];let w;e[40]!==j?(w=s.jsx(Je,{className:"sr-only",children:j}),e[40]=j,e[41]=w):w=e[41];let T;e[42]!==v||e[43]!==w?(T=s.jsxs(Qe,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[w,v]}),e[42]=v,e[43]=w,e[44]=T):T=e[44];let A;return e[45]!==b||e[46]!==g||e[47]!==T?(A=s.jsxs(Ye,{open:b,onOpenChange:k,children:[g,T]}),e[45]=b,e[46]=g,e[47]=T,e[48]=A):A=e[48],A}function yi(){}function ji(l){const e=G.c(4),{placeholder:t}=l,{selectedModel:i,isModelsLoading:o}=_e();let n;return e[0]!==o||e[1]!==i||e[2]!==t?(n=s.jsx(rt,{model:i,placeholder:t,isLoading:o}),e[0]=o,e[1]=i,e[2]=t,e[3]=n):n=e[3],n}export{Ns as C,si as M,Is as N,ot as P,bi as a,Gi as b,Yi as c,be as d,Xi as g,qi as i,Pe as m};