decocms 4.131.3 → 4.131.4

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 (224) hide show
  1. package/dist/client/assets/{AlertCircle-XYVipozu.js → AlertCircle-DevA0A1M.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DxhXVk5N.js → AreaChart-BWfAq2gc.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-BwYEG81b.js → ArrowRight-Dq4C6lJ4.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-l-QJZJVq.js → ArrowUp-CLXut3hx.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-Dzxf-lpo.js → ArrowUpRight-Bay5EW8Z.js} +1 -1
  6. package/dist/client/assets/{Check-BQap7Cpe.js → Check-DN6IPn_3.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-CpszjLbT.js → CheckCircle-ck8m-YN6.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-BNTAvoWs.js → ChevronDown-cZoWRgvb.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-C4GCxTzK.js → ChevronRight-CmrokxXJ.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-CMJpp_7f.js → ChevronUp-CswOdRaR.js} +1 -1
  11. package/dist/client/assets/{Copy01-D_SKj3JY.js → Copy01-BGeJ_uJU.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DtxqOkQ-.js → DotsVertical-Db5Rriwt.js} +1 -1
  13. package/dist/client/assets/{Eye-DDei6OvA.js → Eye-BqdZYqpI.js} +1 -1
  14. package/dist/client/assets/{FilterLines-CdZmlIa2.js → FilterLines-BFxvHa0q.js} +1 -1
  15. package/dist/client/assets/{HardDrive-D5AmniWG.js → HardDrive-C1-SCHTe.js} +1 -1
  16. package/dist/client/assets/{Key01-BTOQ7Hsi.js → Key01-YwqEObkc.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-DAco-6YX.js → LayoutLeft-BzJLVhVQ.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-BAWgpdxG.js → LinkExternal01-Dv9Aj-K0.js} +1 -1
  19. package/dist/client/assets/{LogOut01-N3kqZQ5B.js → LogOut01-D1zBEUWi.js} +1 -1
  20. package/dist/client/assets/{Monitor01--AULmP_e.js → Monitor01-c_9oVNrI.js} +1 -1
  21. package/dist/client/assets/{Palette-Dr6-9ADN.js → Palette-CgoT-TdN.js} +1 -1
  22. package/dist/client/assets/{Play-CwRG1pgT.js → Play-DY15eh3c.js} +1 -1
  23. package/dist/client/assets/{Plus-Dc9c0aJB.js → Plus-D7R6BF5R.js} +1 -1
  24. package/dist/client/assets/{SearchLg-CI2UWBkb.js → SearchLg-B1avg8bD.js} +1 -1
  25. package/dist/client/assets/{SearchMd-BnuXOyI2.js → SearchMd-B-lbf8c2.js} +1 -1
  26. package/dist/client/assets/{Settings02-kFO_alvx.js → Settings02-k_lwzmTv.js} +1 -1
  27. package/dist/client/assets/{Shield01-BltVbqU-.js → Shield01-DFBgcYa0.js} +1 -1
  28. package/dist/client/assets/{Star01-CS45XDsX.js → Star01-Bv8b5o6W.js} +1 -1
  29. package/dist/client/assets/{Stars01-DkHEjXrS.js → Stars01-CAvqsR90.js} +1 -1
  30. package/dist/client/assets/{Stars02-DW1aL9Gv.js → Stars02-Djd7mUzA.js} +1 -1
  31. package/dist/client/assets/{Sun-1O9WSrfQ.js → Sun-DZlLfVSj.js} +1 -1
  32. package/dist/client/assets/{SwitchHorizontal01-DRF2ZDDF.js → SwitchHorizontal01-C9T_FryU.js} +1 -1
  33. package/dist/client/assets/{Tool01-DgbxCa0X.js → Tool01-B14PZEqF.js} +1 -1
  34. package/dist/client/assets/{Tool02-C2mcM2YH.js → Tool02-C-4pjcCY.js} +1 -1
  35. package/dist/client/assets/{Trash01-i0AMIXBp.js → Trash01-DnjcslV5.js} +1 -1
  36. package/dist/client/assets/{TrendUp01-UqSus9sN.js → TrendUp01-BVE2-KuE.js} +1 -1
  37. package/dist/client/assets/{Upload01-DdttVKpO.js → Upload01-uhey7zjg.js} +1 -1
  38. package/dist/client/assets/{User01-BcNtSYpD.js → User01-DQzbx1Xu.js} +1 -1
  39. package/dist/client/assets/{Users01-Dqmzv5Fm.js → Users01-Ct4A_zsW.js} +1 -1
  40. package/dist/client/assets/{Users03-Da6s5Xm-.js → Users03-C-mvAxcs.js} +1 -1
  41. package/dist/client/assets/{X-BZ-Qrql-.js → X-DsJCvKBO.js} +1 -1
  42. package/dist/client/assets/{XCircle-CrKimoYU.js → XCircle-Eu9CNvjp.js} +1 -1
  43. package/dist/client/assets/{XClose-BHqSO9Fx.js → XClose-BcWYJ3jm.js} +1 -1
  44. package/dist/client/assets/{Zap-Bf6OTD9_.js → Zap-BiPzgNTf.js} +1 -1
  45. package/dist/client/assets/{ZapSquare-C8CgHzT1.js → ZapSquare-DpSSWmnE.js} +1 -1
  46. package/dist/client/assets/{access-gate-CVZr_K21.js → access-gate-BUe45Oc3.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-CtCNzcu7.js → add-section-modal-Cj4WcLQN.js} +1 -1
  48. package/dist/client/assets/{agent-icon-DRGNhHDy.js → agent-icon-DW-jknHC.js} +1 -1
  49. package/dist/client/assets/{agents-list-DC5obzzN.js → agents-list-CnJm5oWk.js} +1 -1
  50. package/dist/client/assets/{ai-providers-DtiBdGh6.js → ai-providers-D9DCe_7q.js} +1 -1
  51. package/dist/client/assets/{alert-BR6d3rCa.js → alert-DM1JMd0G.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-vMeKz1oj.js → alert-dialog-B5UNzzAF.js} +1 -1
  53. package/dist/client/assets/{app-editor-6cg9gJwt.js → app-editor-Des7fkeu.js} +1 -1
  54. package/dist/client/assets/{auth-CjPDmXKg.js → auth-Btre_1OW.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-D_PecNHj.js → auth-catchall-DEyYZDPo.js} +1 -1
  56. package/dist/client/assets/{auth-entry-BoU-R1kT.js → auth-entry-Bk6mD7w7.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-BkllSNUH.js → auth-split-layout-Xx-1MkJu.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-CMEBdT9l.js → authenticate-and-persist-oauth-DMOmyFRT.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-a4o0Za57.js → automation-list-row-C0qxtH51.js} +1 -1
  60. package/dist/client/assets/{automation-runs-B0tfP751.js → automation-runs-D_CI6v6C.js} +1 -1
  61. package/dist/client/assets/{automations-C215sLZS.js → automations-DuYav8ee.js} +1 -1
  62. package/dist/client/assets/{avatar-ABBG4Zys.js → avatar-6012j4NF.js} +1 -1
  63. package/dist/client/assets/{badge-DHX2ckQi.js → badge-kM5UAKst.js} +1 -1
  64. package/dist/client/assets/{block-document-BpJ7OMsm.js → block-document-Cuu1bHmR.js} +1 -1
  65. package/dist/client/assets/{brand-context-DvgxrNhD.js → brand-context-QIm13fsq.js} +1 -1
  66. package/dist/client/assets/{buckets-C4DdXxfh.js → buckets-cXyEFJzj.js} +1 -1
  67. package/dist/client/assets/{bulk-category-panel-UScNnMYp.js → bulk-category-panel-2liLzEa8.js} +1 -1
  68. package/dist/client/assets/{calendar-BId5Ov_D.js → calendar-MyVXyluP.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-B9ewQDHI.js → capability-load-error-DXOesTij.js} +1 -1
  70. package/dist/client/assets/{card-CpyAPk4W.js → card-LK3SgMlx.js} +1 -1
  71. package/dist/client/assets/{category-editor-QJgu0Oa6.js → category-editor-Bpk_JSk7.js} +1 -1
  72. package/dist/client/assets/chat-context-4A5jyyEw.js +36 -0
  73. package/dist/client/assets/{checkbox-Dyd2bOG3.js → checkbox-C9Nq068Z.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-CvuXLOuX.js → cli-auth-success-C3PdvGhV.js} +1 -1
  75. package/dist/client/assets/{collection-detail-DHixVrfP.js → collection-detail-COz359qR.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-VXR-qfSN.js → collection-display-button-C9dL_fAH.js} +1 -1
  77. package/dist/client/assets/{collection-search-BXUxGpkT.js → collection-search-C63j6Zzd.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-DrsWOFMV.js → collection-table-wrapper-B06IqYXO.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-CrFDWpQo.js → collection-tabs-C_e51TYz.js} +1 -1
  80. package/dist/client/assets/{command-p71imMWZ.js → command-DtoG6f_9.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-DeCCW2Vu.js → commerce-onboarding-E61cJuT5.js} +1 -1
  82. package/dist/client/assets/{companions-core-BqqXlbWe.js → companions-core-RUJyQPUT.js} +1 -1
  83. package/dist/client/assets/{connect-DncRr4DD.js → connect-B7aqLNJY.js} +1 -1
  84. package/dist/client/assets/{connect-desktop-dialog-CpDi9jEG.js → connect-desktop-dialog-Dj9gRQkE.js} +1 -1
  85. package/dist/client/assets/{connection-card-BNd9VNGL.js → connection-card-BoF_KE8y.js} +1 -1
  86. package/dist/client/assets/{connection-detail-rsDLNcvr.js → connection-detail-DLH59AQX.js} +1 -1
  87. package/dist/client/assets/{connection-form-helpers-BRVXGHSF.js → connection-form-helpers-DB9ro8Ha.js} +1 -1
  88. package/dist/client/assets/{connection-DWdqWsqN.js → connection-vyIAo10g.js} +1 -1
  89. package/dist/client/assets/{connections-NIph2LCs.js → connections-DfRW6lnA.js} +1 -1
  90. package/dist/client/assets/{decopilot-sse-pool-CSHbnCTw.js → decopilot-sse-pool-CFz6l2VG.js} +1 -1
  91. package/dist/client/assets/{dialog-DgVuLqhS.js → dialog-D370feZI.js} +1 -1
  92. package/dist/client/assets/{domain-settings-BMc1ZlT9.js → domain-settings-6514J2nW.js} +1 -1
  93. package/dist/client/assets/{drawer-BAKGed9i.js → drawer-LhH6tqHN.js} +1 -1
  94. package/dist/client/assets/{dropdown-menu-X5GaQfkB.js → dropdown-menu-DBsO6utH.js} +1 -1
  95. package/dist/client/assets/{empty-state-BTI0jRLN.js → empty-state-Cj1VbJ0y.js} +1 -1
  96. package/dist/client/assets/{extract-connection-data-y9r-PxK0.js → extract-connection-data-C8zhfgGc.js} +1 -1
  97. package/dist/client/assets/{file-explorer-DiRIjdTO.js → file-explorer-CEKYwf0q.js} +1 -1
  98. package/dist/client/assets/{form-BSs_Wcc9.js → form-Dj_8GoDc.js} +1 -1
  99. package/dist/client/assets/{general-Q0eMdHbb.js → general-cez9yeo-.js} +1 -1
  100. package/dist/client/assets/{github-repo-picker-BcZWgRSG.js → github-repo-picker-CeuXOkGP.js} +1 -1
  101. package/dist/client/assets/{hooks-CSzZamSr.js → hooks-DJ2YKeR9.js} +1 -1
  102. package/dist/client/assets/{index-BYJD8VZD.js → index-8UQlPx-e.js} +1 -1
  103. package/dist/client/assets/{index-B9w5ivBW.js → index-9dxBGS0M.js} +1 -1
  104. package/dist/client/assets/{index-BPUDtemx.js → index-B6pbxJBU.js} +35 -35
  105. package/dist/client/assets/{index-ClYqgXfK.js → index-BtxByavv.js} +1 -1
  106. package/dist/client/assets/{index-R7we9WNO.js → index-CZWx2CTD.js} +1 -1
  107. package/dist/client/assets/{index-rNfPhyEe.js → index-D6fjxFLg.js} +1 -1
  108. package/dist/client/assets/{index-CN6o24P1.js → index-DLoS2Gvr.js} +3 -3
  109. package/dist/client/assets/{index-D_hlfh5m.js → index-Dx1y19yx.js} +1 -1
  110. package/dist/client/assets/{index-CnMgWn6h.js → index-DxEI9GBV.js} +1 -1
  111. package/dist/client/assets/{index-TcWD9It_.js → index-YTROANcF.js} +1 -1
  112. package/dist/client/assets/{index-redirect-B3exj8gg.js → index-redirect-DP7n2JdM.js} +1 -1
  113. package/dist/client/assets/{index-DnHWblfu.js → index-tHM8NTfd.js} +3 -3
  114. package/dist/client/assets/{input-BKgQbLb7.js → input-CtPcKTyA.js} +1 -1
  115. package/dist/client/assets/{integration-icon-Buz6Jy4-.js → integration-icon-C-2mN9ni.js} +1 -1
  116. package/dist/client/assets/{invite-member-dialog-DHospCr-.js → invite-member-dialog-B_qNDeU_.js} +1 -1
  117. package/dist/client/assets/{label-vQvzd2f4.js → label-Dx1_DE-f.js} +1 -1
  118. package/dist/client/assets/{layout-D1eS19nu.js → layout-CxQ_ZjYX.js} +1 -1
  119. package/dist/client/assets/{login-CV8LNv90.js → login-XiuCflbI.js} +1 -1
  120. package/dist/client/assets/{mcp-oauth-DdhiCVGm.js → mcp-oauth-Ch4TwOlY.js} +1 -1
  121. package/dist/client/assets/{members-B-8bNCz9.js → members-Ci-qw088.js} +1 -1
  122. package/dist/client/assets/{monaco-editor-CB-Jx900.js → monaco-editor-AliIqm4c.js} +1 -1
  123. package/dist/client/assets/{monitoring-stats-row-D1IsIC5b.js → monitoring-stats-row-DN9PtAZT.js} +1 -1
  124. package/dist/client/assets/{multi-select-siQWidPq.js → multi-select-YuTRMMq6.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-DFzc2Man.js → oauth-callback-B5VSsFYW.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-D5wGdFe8.js → oauth-callback-ai-provider-DvHFF9AB.js} +1 -1
  127. package/dist/client/assets/{onboarding-4x8bdTEE.js → onboarding-C1PGqPn5.js} +1 -1
  128. package/dist/client/assets/{org-install-DaXiGcuv.js → org-install-D3FG3YSl.js} +1 -1
  129. package/dist/client/assets/{org-layout-gnhpwzYn.js → org-layout-CC1aR_Ar.js} +1 -1
  130. package/dist/client/assets/{organization-choice-xe5P_CBM.js → organization-choice-QLXU0-_4.js} +1 -1
  131. package/dist/client/assets/{orgs-DKLE5wTt.js → orgs-urMoQKB9.js} +1 -1
  132. package/dist/client/assets/{page-seo-form-CpN8zrtu.js → page-seo-form-CmZpKqZS.js} +1 -1
  133. package/dist/client/assets/{popover-CVp_epYO.js → popover-C3OgPzQD.js} +1 -1
  134. package/dist/client/assets/{post-editor-WInb3hhw.js → post-editor-nU307FBm.js} +1 -1
  135. package/dist/client/assets/{primitives-DUyfIrNL.js → primitives-CK5MU42p.js} +1 -1
  136. package/dist/client/assets/{profile-DaHHfvaG.js → profile-hYMdiEA5.js} +1 -1
  137. package/dist/client/assets/project-app-view-qdfNZvBx.js +1 -0
  138. package/dist/client/assets/record-editor-DWuuBfxd.js +1 -0
  139. package/dist/client/assets/{redirect-editor-lC0dYN7C.js → redirect-editor-BMgNAGHS.js} +1 -1
  140. package/dist/client/assets/registry-RIQmZ8qc.js +2 -0
  141. package/dist/client/assets/{registry-layout-Cq1dxSDY.js → registry-layout-BNIYUe33.js} +1 -1
  142. package/dist/client/assets/{reports-DWR1-tvR.js → reports-BH4VUIWR.js} +1 -1
  143. package/dist/client/assets/{require-capability-E_Dah2u4.js → require-capability-B-Sqx0zT.js} +1 -1
  144. package/dist/client/assets/{required-auth-layout-CPjb3C6W.js → required-auth-layout-C91T3YkY.js} +1 -1
  145. package/dist/client/assets/{reset-password-DMWHI75_.js → reset-password-DZU7Xnj2.js} +1 -1
  146. package/dist/client/assets/{roles-D-8mHCVX.js → roles-B1Km9s7i.js} +1 -1
  147. package/dist/client/assets/{search-input-BsjySTQb.js → search-input-C_HmTn9N.js} +1 -1
  148. package/dist/client/assets/{secrets-kx0xefS3.js → secrets-w6471qmo.js} +1 -1
  149. package/dist/client/assets/{sections-editor-MsZlD81r.js → sections-editor-EpO7m57q.js} +1 -1
  150. package/dist/client/assets/{select-g0E4j9Tt.js → select-QOGEC2YQ.js} +1 -1
  151. package/dist/client/assets/{select-model-RA4tH7cK.js → select-model-BjPHv_Dr.js} +1 -1
  152. package/dist/client/assets/{self-tool-result-BZrmfYIi.js → self-tool-result-Wf62ha3A.js} +1 -1
  153. package/dist/client/assets/{seo-editor-DuuAhCLw.js → seo-editor-CypChmsn.js} +1 -1
  154. package/dist/client/assets/{settings-layout-CHrgf1OR.js → settings-layout-C-KR57M3.js} +1 -1
  155. package/dist/client/assets/{settings-section-DysjSOio.js → settings-section-B7sLcI44.js} +1 -1
  156. package/dist/client/assets/{shell-controls-D9KipuzZ.js → shell-controls-DtA7fOjc.js} +1 -1
  157. package/dist/client/assets/{shell-layout-BBtwtRs8.js → shell-layout-DjpBxe62.js} +1 -1
  158. package/dist/client/assets/{sidebar-DCTvELfP.js → sidebar-DS29jp1e.js} +1 -1
  159. package/dist/client/assets/{skeleton-CQ4Si4tx.js → skeleton-CVx36MXd.js} +1 -1
  160. package/dist/client/assets/{sso-CJ8qNqdV.js → sso-BWUbQwJM.js} +1 -1
  161. package/dist/client/assets/{store-Bdlu_O_k.js → store-BepPvAB9.js} +1 -1
  162. package/dist/client/assets/store-registry-DBscfyiP.js +2 -0
  163. package/dist/client/assets/{studio-tools-1de_48yn.js → studio-tools-DBJ4BlKP.js} +1 -1
  164. package/dist/client/assets/{switch-BTk8KHX6.js → switch-BAMPQcFC.js} +1 -1
  165. package/dist/client/assets/{tab-id-Ckd-ZAMH.js → tab-id-DLditg27.js} +1 -1
  166. package/dist/client/assets/{table-CLLWCOW2.js → table-DunMqZev.js} +1 -1
  167. package/dist/client/assets/{tabs-D4j_u8lp.js → tabs-DXpVtqDW.js} +1 -1
  168. package/dist/client/assets/{textarea-CDJ9hAiD.js → textarea-hljn8moZ.js} +1 -1
  169. package/dist/client/assets/{toggle-group-BQ95Mzlw.js → toggle-group-CugvhNWb.js} +1 -1
  170. package/dist/client/assets/{toolbar-n9I75ths.js → toolbar-dY2heqgV.js} +1 -1
  171. package/dist/client/assets/{tooltip-44-2qw6b.js → tooltip-C4NGAgAM.js} +1 -1
  172. package/dist/client/assets/use-ai-providers-COkTONXg.js +1 -0
  173. package/dist/client/assets/{use-api-keys-D9GX3AqG.js → use-api-keys-BondmtJR.js} +1 -1
  174. package/dist/client/assets/{use-automations-DOYrLfym.js → use-automations-RGeim-7x.js} +1 -1
  175. package/dist/client/assets/{use-autosave-BkiPj2IU.js → use-autosave-BBmT_CQu.js} +1 -1
  176. package/dist/client/assets/{use-capability-ZuDMV8i_.js → use-capability-nY6kVL8r.js} +1 -1
  177. package/dist/client/assets/{use-clock-tick-CF-fW2XN.js → use-clock-tick-GBpMaXwL.js} +1 -1
  178. package/dist/client/assets/{use-connection-DNsAtxSX.js → use-connection-uKN5YWIx.js} +1 -1
  179. package/dist/client/assets/{use-copy-DVkJpNIE.js → use-copy-EWLYbeWi.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-BLDf0ux0.js → use-create-virtual-mcp-DS8KPcoG.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-rKGkta2N.js → use-debounced-autosave-_O3PoKoh.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-DOFpGJrU.js → use-debounced-value-DuOUoSmu.js} +1 -1
  183. package/dist/client/assets/{use-deco-credits-nxiVRyXd.js → use-deco-credits-ClFjXcZg.js} +1 -1
  184. package/dist/client/assets/{use-decopilot-events-JMTJZeEq.js → use-decopilot-events-DSmTv1gx.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-pIo0CZXk.js → use-delete-connection-DjRlgLwA.js} +1 -1
  186. package/dist/client/assets/{use-deployment-admin-CdE4vCx5.js → use-deployment-admin-3EsHBbN1.js} +1 -1
  187. package/dist/client/assets/{use-file-configs-BLfsI3Gb.js → use-file-configs-Bgb80job.js} +1 -1
  188. package/dist/client/assets/{use-infinite-scroll-68HpgFc8.js → use-infinite-scroll-DFYxMuWT.js} +1 -1
  189. package/dist/client/assets/{use-join-requests-KtkcCBVT.js → use-join-requests-CTLDVqMF.js} +1 -1
  190. package/dist/client/assets/{use-mcp-auth-status-BW-U_Pa6.js → use-mcp-auth-status-Bbnk5NX6.js} +1 -1
  191. package/dist/client/assets/{use-mcp-client-BG7zveIM.js → use-mcp-client-BAwn-0AV.js} +1 -1
  192. package/dist/client/assets/{use-mcp-tools-DjATUgKD.js → use-mcp-tools-CgtI4_xz.js} +1 -1
  193. package/dist/client/assets/{use-members-UKyPZaKn.js → use-members-C_p-7j4-.js} +1 -1
  194. package/dist/client/assets/{use-mobile-ChN0uU-Y.js → use-mobile-B-9CWMAs.js} +1 -1
  195. package/dist/client/assets/{use-navigate-to-agent-_n3ZB1G-.js → use-navigate-to-agent-DEAiy9mr.js} +1 -1
  196. package/dist/client/assets/{use-org-auth-client-XykIzcR9.js → use-org-auth-client-GW_RbwIG.js} +1 -1
  197. package/dist/client/assets/{use-org-sso-C30Nyt4K.js → use-org-sso-C5GowRh9.js} +1 -1
  198. package/dist/client/assets/{use-organization-roles-YvhVsU1D.js → use-organization-roles-CjrQlUME.js} +1 -1
  199. package/dist/client/assets/{use-organization-settings-Bbc0ktBM.js → use-organization-settings-D0V5wIDO.js} +1 -1
  200. package/dist/client/assets/{use-registry-app-D6fcGueu.js → use-registry-app-D8hx17d1.js} +1 -1
  201. package/dist/client/assets/{use-registry-connections-CqQgIUl7.js → use-registry-connections-o8h37zTy.js} +1 -1
  202. package/dist/client/assets/{use-secrets-C8uvAtFz.js → use-secrets-C-31Hjoh.js} +1 -1
  203. package/dist/client/assets/{use-status-sounds-u5bruqG0.js → use-status-sounds-DZIf-G4r.js} +1 -1
  204. package/dist/client/assets/{use-view-mode-Z33nLYON.js → use-view-mode-CyIY6QXB.js} +1 -1
  205. package/dist/client/assets/{use-virtual-mcp-D6qbeGCA.js → use-virtual-mcp-DXStXtw1.js} +1 -1
  206. package/dist/client/assets/useInfiniteQuery-DAxuc5L-.js +1 -0
  207. package/dist/client/assets/{useQueries-BkQg5qxY.js → useQueries-Dk_rR620.js} +1 -1
  208. package/dist/client/assets/{useRouterState-Cx-iKGeP.js → useRouterState-CFblvFqM.js} +1 -1
  209. package/dist/client/assets/useSuspenseInfiniteQuery-BwVy3QbN.js +1 -0
  210. package/dist/client/assets/{users-B69hvHRd.js → users-TcleqpoV.js} +1 -1
  211. package/dist/client/assets/{variant-calendar-CjUxdkHi.js → variant-calendar-BH0fql5v.js} +1 -1
  212. package/dist/client/assets/{view-mode-toggle-CG5EKfFg.js → view-mode-toggle-BMYy47UV.js} +1 -1
  213. package/dist/client/index.html +1 -1
  214. package/dist/server/cli.js +1 -1
  215. package/dist/server/server.js +1 -1
  216. package/package.json +1 -1
  217. package/dist/client/assets/chat-context-BrrGaGbH.js +0 -36
  218. package/dist/client/assets/project-app-view-ScyHaVrd.js +0 -1
  219. package/dist/client/assets/record-editor-C6uQXE53.js +0 -1
  220. package/dist/client/assets/registry-COiCjfcj.js +0 -2
  221. package/dist/client/assets/store-registry-LydU-3AV.js +0 -2
  222. package/dist/client/assets/use-ai-providers-CuhkQheE.js +0 -1
  223. package/dist/client/assets/useInfiniteQuery-BuKAKdDO.js +0 -1
  224. package/dist/client/assets/useSuspenseInfiniteQuery-n2PIbfd5.js +0 -1
@@ -1 +1 @@
1
- import{c as ge,b as ce,j as o,v as ve,B as ie,F as Ce,o as Ne,a as Ae,r as W,n as Ie,K as me,e as Le,p as V,t as de,G as Te,m as Ee}from"./index-DnHWblfu.js";import{a as re,b as De,D as ue,c as pe}from"./dropdown-menu-X5GaQfkB.js";import{a as Fe}from"./Users03-Da6s5Xm-.js";import{G as ye}from"./use-registry-app-D6fcGueu.js";import{a as ke,b as Ge,c as Oe}from"./use-virtual-mcp-D6qbeGCA.js";import{P as ae}from"./index-rNfPhyEe.js";import{a as Pe}from"./DotsVertical-DtxqOkQ-.js";import{a as Me,b as ze}from"./Settings02-kFO_alvx.js";import{s as Be}from"./Trash01-i0AMIXBp.js";import{p as Re,f as fe}from"./pt-BR-CLy76QW2.js";import{A as $e,a$ as Ue}from"./agent-icon-DRGNhHDy.js";import{c as we}from"./use-navigate-to-agent-_n3ZB1G-.js";import{C as Ve}from"./card-CpyAPk4W.js";import{u as He}from"./use-capability-ZuDMV8i_.js";import{E as Ke}from"./empty-state-BTI0jRLN.js";import{u as qe}from"./use-create-virtual-mcp-BLDf0ux0.js";import{u as Qe}from"./use-connection-DNsAtxSX.js";import{u as he,S as Je}from"./use-mcp-client-BG7zveIM.js";import{u as Ye,G as We}from"./github-repo-picker-BcZWgRSG.js";import{p as Xe,a as xe}from"./deco-site-production-url-CaKZ7xBn.js";import{g as Ze}from"./github-repo-scope-DjMZbiKa.js";import{f as et,a as tt,p as ot}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as st,d as it,a as nt,b as rt,c as lt}from"./dialog-DgVuLqhS.js";import{C as at}from"./collection-search-BXUxGpkT.js";import{c as ct,d as mt,b as dt,f as ut,g as pt,e as gt,a as ft,A as ht}from"./alert-dialog-vMeKz1oj.js";import{S as xt}from"./search-input-BsjySTQb.js";import{s as je}from"./Plus-Dc9c0aJB.js";import"./Check-BQap7Cpe.js";import"./ChevronRight-C4GCxTzK.js";import"./use-mcp-tools-DjATUgKD.js";import"./sidebar-DCTvELfP.js";import"./LayoutLeft-DAco-6YX.js";import"./use-mobile-ChN0uU-Y.js";import"./X-BZ-Qrql-.js";import"./tooltip-44-2qw6b.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-XYVipozu.js";import"./Tool01-DgbxCa0X.js";import"./ArrowUp-l-QJZJVq.js";import"./Tool02-C2mcM2YH.js";import"./ArrowRight-BwYEG81b.js";import"./ArrowUpRight-Dzxf-lpo.js";import"./TrendUp01-UqSus9sN.js";import"./ZapSquare-C8CgHzT1.js";import"./CheckCircle-CpszjLbT.js";import"./ChevronDown-BNTAvoWs.js";import"./ChevronUp-CMJpp_7f.js";import"./Stars02-DW1aL9Gv.js";import"./Copy01-D_SKj3JY.js";import"./Eye-DDei6OvA.js";import"./FilterLines-CdZmlIa2.js";import"./Star01-CS45XDsX.js";import"./Palette-Dr6-9ADN.js";import"./SwitchHorizontal01-DRF2ZDDF.js";import"./HardDrive-D5AmniWG.js";import"./Key01-BTOQ7Hsi.js";import"./XCircle-CrKimoYU.js";import"./LinkExternal01-BAWgpdxG.js";import"./LogOut01-N3kqZQ5B.js";import"./Monitor01--AULmP_e.js";import"./Sun-1O9WSrfQ.js";import"./Play-CwRG1pgT.js";import"./SearchLg-CI2UWBkb.js";import"./SearchMd-BnuXOyI2.js";import"./Shield01-BltVbqU-.js";import"./Stars01-DkHEjXrS.js";import"./Upload01-DdttVKpO.js";import"./User01-BcNtSYpD.js";import"./Users01-Dqmzv5Fm.js";import"./XClose-BHqSO9Fx.js";import"./Zap-Bf6OTD9_.js";import"./hooks-CSzZamSr.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CSHbnCTw.js";import"./reusable-new-chat-CouMjkYR.js";import"./auth-CjPDmXKg.js";import"./use-debounced-value-DOFpGJrU.js";import"./authenticate-and-persist-oauth-CMEBdT9l.js";import"./mcp-oauth-DdhiCVGm.js";import"./extract-connection-data-y9r-PxK0.js";import"./metadata-dUsYcpuu.js";function be(t){const e=ge.c(28),{onCreateFromScratch:n,onImportGitHub:i,onImportDeco:r,isCreating:u,align:L,side:E,showBetaBadge:f}=t,b=L===void 0?"end":L,c=ce();let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Fe,{size:14}),e[0]=C):C=e[0];let h;e[1]!==c?(h=c("common.createAgentDropdown.createFromScratch"),e[1]=c,e[2]=h):h=e[2];let p;e[3]!==u||e[4]!==n||e[5]!==h?(p=o.jsxs(re,{disabled:u,onClick:n,children:[C,h]}),e[3]=u,e[4]=n,e[5]=h,e[6]=p):p=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(ye,{className:"size-3.5"}),e[7]=g):g=e[7];let j;e[8]!==c?(j=c("common.createAgentDropdown.importFromGitHub"),e[8]=c,e[9]=j):j=e[9];let a;e[10]!==f?(a=f&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=f,e[11]=a):a=e[11];let l;e[12]!==i||e[13]!==j||e[14]!==a?(l=o.jsxs(re,{onClick:i,children:[g,j,a]}),e[12]=i,e[13]=j,e[14]=a,e[15]=l):l=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=m):m=e[16];let x;e[17]!==c?(x=c("common.createAgentDropdown.importFromDeco"),e[17]=c,e[18]=x):x=e[18];let y;e[19]!==r||e[20]!==x?(y=o.jsxs(re,{onClick:r,children:[m,x]}),e[19]=r,e[20]=x,e[21]=y):y=e[21];let d;return e[22]!==b||e[23]!==E||e[24]!==y||e[25]!==p||e[26]!==l?(d=o.jsxs(De,{side:E,align:b,className:"w-48",children:[p,l,y]}),e[22]=b,e[23]=E,e[24]=y,e[25]=p,e[26]=l,e[27]=d):d=e[27],d}function jt(t){const e=ge.c(47),{project:n,lastUsedAt:i,onDeleteClick:r}=t,u=we(),L=ce(),[E]=ve(),f=E.language==="pt-BR"?Re:void 0;let b;e[0]!==u||e[1]!==n.id?(b=()=>u(n.id),e[0]=u,e[1]=n.id,e[2]=b):b=e[2];let c;e[3]!==n.title||e[4]!==b?(c=o.jsx("button",{type:"button",onClick:b,className:"absolute inset-0 z-0","aria-label":n.title}),e[3]=n.title,e[4]=b,e[5]=c):c=e[5];let C;e[6]!==n.icon||e[7]!==n.title?(C=o.jsx($e,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=n.icon,e[7]=n.title,e[8]=C):C=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Pe,{size:20})})}),e[9]=h):h=e[9];let p;e[10]!==u||e[11]!==n.id?(p=()=>u(n.id,{search:{main:"settings"}}),e[10]=u,e[11]=n.id,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Me,{size:16}),e[13]=g):g=e[13];let j;e[14]!==p?(j=o.jsxs(re,{onClick:p,children:[g,"Settings"]}),e[14]=p,e[15]=j):j=e[15];let a;e[16]!==r?(a=r&&o.jsxs(re,{variant:"destructive",onClick:H=>{H.stopPropagation(),r(H)},children:[o.jsx(Be,{size:16}),"Delete"]}),e[16]=r,e[17]=a):a=e[17];let l;e[18]!==j||e[19]!==a?(l=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(De,{align:"end",children:[j,a]})]})}),e[18]=j,e[19]=a,e[20]=l):l=e[20];let m;e[21]!==C||e[22]!==l?(m=o.jsxs("div",{className:"flex items-start justify-between",children:[C,l]}),e[21]=C,e[22]=l,e[23]=m):m=e[23];let x;e[24]!==n.title?(x=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[24]=n.title,e[25]=x):x=e[25];const y=n.description||"No description";let d;e[26]!==y?(d=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:y}),e[26]=y,e[27]=d):d=e[27];let k;e[28]!==x||e[29]!==d?(k=o.jsxs("div",{className:"flex flex-col gap-1",children:[x,d]}),e[28]=x,e[29]=d,e[30]=k):k=e[30];let S;e[31]!==m||e[32]!==k?(S=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[m,k]}),e[31]=m,e[32]=k,e[33]=S):S=e[33];let G;e[34]!==i||e[35]!==f||e[36]!==n.updated_at||e[37]!==L?(G=i?L("home.projectCard.lastUsed",{time:fe(new Date(i),{addSuffix:!0,locale:f})}):L("home.projectCard.updated",{time:fe(new Date(n.updated_at),{addSuffix:!0,locale:f})}),e[34]=i,e[35]=f,e[36]=n.updated_at,e[37]=L,e[38]=G):G=e[38];let D;e[39]!==G?(D=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:G})})}),e[39]=G,e[40]=D):D=e[40];let w;e[41]!==S||e[42]!==D?(w=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[S,D]}),e[41]=S,e[42]=D,e[43]=w):w=e[43];let v;return e[44]!==w||e[45]!==c?(v=o.jsxs(Ve,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[c,w]}),e[44]=w,e[45]=c,e[46]=v):v=e[46],v}const bt="deco-sites";function Ct(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const n=e.owner,i=e.repo;return typeof n!="string"||typeof i!="string"||n.length===0||i.length===0?null:{owner:n,repo:i}}function Dt(t,e){const n=e?Ct(e):null,i=n?.owner??bt,r=n?.repo??t;return{owner:i,name:r,url:`https://github.com/${i}/${r}`}}function yt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function _e(t,e,n){const i=await fetch(t,e),r=await i.json().catch(()=>({}));if(!i.ok)throw new Error(r.error??`${n} (${i.status})`);return r}function wt(t){return _e(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function _t({open:t,onOpenChange:e,onBack:n}){const i=ce(),{org:r}=Ce(),u=we(),L=Ne(),{data:E}=Ae.useSession(),[f,b]=W.useState(null),[c,C]=W.useState(null),[h,p]=W.useState(""),g=he({connectionId:Je,orgId:r.id,orgSlug:r.slug}),j=Qe({slug:"mcp-github"}),a=Ze(j),l=Ye({enabled:t&&a.length===0}),m=a.length===1?a[0]??null:c,x=a.length>1&&!m,y=he({connectionId:m?.id??"",orgId:r.id,orgSlug:r.slug}),d=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:k,isLoading:S,error:G}=Ie({queryKey:me.decoSites(E?.user?.email),queryFn:()=>wt(r.slug),enabled:t&&!!E?.user?.email,staleTime:6e4,retry:!1}),D=k?.sites??[],w=s=>{s||(b(null),C(null),p("")),e(s)},v=D.filter(s=>s.name.toLowerCase().includes(h.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(h.toLowerCase())??!1)),H=!f||v.some(s=>s.name===f),O=Le({mutationFn:async s=>{if(!m)throw new Error(i("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:N,appSlug:T}=await et(I=>g.callTool(I),m.id),K=D.find(I=>I.name===s);if(!K)throw new Error(i("common.importFromDecoDialog.siteNoLongerAvailable"));const A=Dt(s,K.metadata),M=tt(N,A.owner);if(!M){const I=T?`https://github.com/apps/${T}/installations/new`:"https://github.com/settings/installations";throw new Error(i("common.importFromDecoDialog.installGithubApp",{owner:A.owner,installUrl:I}))}let z=null,B=null,R=null;const ne=async()=>{R&&await g.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:R}}).catch(()=>{}),B&&await g.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:B,force:!0}}).catch(()=>{}),z&&await g.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:z,force:!0}}).catch(()=>{})};try{const I=await _e(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},i("common.importFromDecoDialog.failedToCreateConnection")),F=I.connId;if(!F)throw new Error(i("common.importFromDecoDialog.noConnectionId"));z=F;const{childConnectionId:$}=await ot({orgSlug:r.slug,sourceConnection:m,installationId:M.installationId,owner:A.owner,repo:A.name,githubCallTool:U=>y.callTool(U),selfCallTool:U=>g.callTool(U)});B=$;const q=I.icon??null,X=yt(s),J=s.toLowerCase(),Y=Xe(xe(K.domains)),Q=await g.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:q??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:J,productionUrl:Y,githubRepo:{owner:A.owner,name:A.name,url:A.url,installationId:M.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:q,themeColor:"#22C55E",slug:X,pinnedViews:[{connectionId:F,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:F,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:F},{connection_id:$}]}}}),P=Q.structuredContent??Q;if(!P.item?.id)throw new Error(i("common.importFromDecoDialog.failedToCreateAgent"));return R=P.item.id,{slug:X,virtualMcpId:P.item.id,connId:F,item:P.item}}catch(I){throw await ne(),I}},onSuccess:({slug:s,virtualMcpId:N,item:T})=>{V("deco_site_import_succeeded",{site_name:T.title,virtual_mcp_id:N,slug:s}),L.setQueryData(me.collectionItem(g,r.id,"","VIRTUAL_MCP",N),{item:T}),L.invalidateQueries({predicate:K=>{const A=K.queryKey;return A[1]===r.id&&A[3]==="collection"&&A[4]==="VIRTUAL_MCP"}}),L.invalidateQueries({queryKey:me.projects(r.id)}),de.success(i("common.importFromDecoDialog.importSuccess",{slug:s})),w(!1),localStorage.setItem(Te.sidebarOpen(),JSON.stringify(!1)),u(N)},onError:s=>{V("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),de.error(i("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:i("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(st,{open:t,onOpenChange:w,children:o.jsxs(it,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(nt,{className:"sr-only",children:o.jsx(rt,{children:i("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[n&&o.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":i("common.importFromDecoDialog.goBack"),children:o.jsx(ze,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:i("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(at,{value:h,onChange:p,placeholder:i("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&p("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??i("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:i("common.importFromDecoDialog.retryGithubSetup")})]}),d&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.settingUpGithub")}),x&&!d&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:i("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>C(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(ye,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),S&&!d&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.loadingSites")}),!S&&!d&&!x&&l.status!=="error"&&!G&&D.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.noSitesFound")}),!S&&!d&&!x&&l.status!=="error"&&D.length>0&&o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:i("common.importFromDecoDialog.noSitesMatch",{search:h})}),v.map(s=>{const N=xe(s.domains),T=f===s.name;return o.jsxs("button",{type:"button",onClick:()=>b(s.name),className:Ee("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",T?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),N&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:N})]})]},s.name)})]})]}),o.jsxs(lt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>w(!1),disabled:O.isPending,children:i("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!f||!H||O.isPending||S||d||x||!m||l.status==="error",onClick:()=>f&&O.mutate(f),children:O.isPending?i("common.importFromDecoDialog.importing"):i("common.importFromDecoDialog.import")})]})]})})}function ts(){const t=ge.c(77),e=ce(),{org:n}=Ce(),i=ke(),r=Ge(),[u,L]=W.useState("");let E;t[0]===Symbol.for("react.memo_cache_sentinel")?(E={navigateOnCreate:!0},t[0]=E):E=t[0];const{createVirtualMCP:f,isCreating:b}=qe(E),[c,C]=W.useState(null),[h,p]=W.useState(!1),[g,j]=W.useState(!1),{granted:a}=He("agents:manage"),l=u.toLowerCase(),m=i.filter(_=>_.id!==n.id&&(_.title.toLowerCase().includes(l)||_.description?.toLowerCase().includes(l))),{data:x}=Oe(m.map(St));let y;t[1]!==r||t[2]!==c||t[3]!==e?(y=async()=>{if(!c)return;const{id:_,title:Se}=c;C(null);try{await r.delete.mutateAsync(_),V("agent_deleted",{agent_id:_,source:"agents_list"}),de.success(e("routes.agentsList.deletedAgent",{title:Se}))}catch{}},t[1]=r,t[2]=c,t[3]=e,t[4]=y):y=t[4];const d=y,k=ae,S=ae,G=ae;let D;t[5]!==e?(D=e("routes.agentsList.title"),t[5]=e,t[6]=D):D=t[6];let w;t[7]!==D?(w=o.jsx(ae.Title,{children:D}),t[7]=D,t[8]=w):w=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let H;t[11]===Symbol.for("react.memo_cache_sentinel")?(H=_=>{_.key==="Escape"&&(L(""),_.target.blur())},t[11]=H):H=t[11];let O;t[12]!==u||t[13]!==v?(O=o.jsx(xt,{value:u,onChange:L,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:H}),t[12]=u,t[13]=v,t[14]=O):O=t[14];let s;t[15]!==a||t[16]!==f||t[17]!==b||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(je,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),f()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),j(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),p(!0)},isCreating:b,align:"end"})]}),t[15]=a,t[16]=f,t[17]=b,t[18]=e,t[19]=s):s=t[19];let N;t[20]!==O||t[21]!==s?(N=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[O,s]}),t[20]=O,t[21]=s,t[22]=N):N=t[22];let T;t[23]!==N||t[24]!==w?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[w,N]}),t[23]=N,t[24]=w,t[25]=T):T=t[25];const K=m.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ke,{image:o.jsx(Ue,{size:48,className:"text-muted-foreground"}),title:e(u?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:u?e("routes.agentsList.noAgentsMatchSearch",{search:u}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!u&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(je,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),f()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),j(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),p(!0)},isCreating:b,align:"center",showBetaBadge:!0})]})})}),A=m.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:m.map(_=>o.jsx(jt,{project:_,lastUsedAt:x?.get(_.id)?.last_used_at,onDeleteClick:a?()=>C({id:_.id,title:_.title}):void 0},_.id))})]});let M;t[26]!==T||t[27]!==K||t[28]!==A||t[29]!==G.Body?(M=o.jsxs(G.Body,{children:[T,K,A]}),t[26]=T,t[27]=K,t[28]=A,t[29]=G.Body,t[30]=M):M=t[30];let z;t[31]!==M||t[32]!==S.Content?(z=o.jsx(S.Content,{children:M}),t[31]=M,t[32]=S.Content,t[33]=z):z=t[33];let B;t[34]!==g?(B=o.jsx(We,{open:g,onOpenChange:j}),t[34]=g,t[35]=B):B=t[35];let R;t[36]!==h?(R=o.jsx(_t,{open:h,onOpenChange:p}),t[36]=h,t[37]=R):R=t[37];const ne=!!c;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=_=>!_&&C(null),t[38]=I):I=t[38];let F;t[39]!==e?(F=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=F):F=t[40];let $;t[41]!==F?($=o.jsx(ct,{children:F}),t[41]=F,t[42]=$):$=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const X=c?.title;let J;t[45]!==X?(J=o.jsx("span",{className:"font-medium text-foreground",children:X}),t[45]=X,t[46]=J):J=t[46];let Y;t[47]!==q||t[48]!==J?(Y=o.jsxs(mt,{children:[q," ",J,"."]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let Q;t[50]!==$||t[51]!==Y?(Q=o.jsxs(dt,{children:[$,Y]}),t[50]=$,t[51]=Y,t[52]=Q):Q=t[52];let P;t[53]!==e?(P=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=P):P=t[54];let U;t[55]!==P?(U=o.jsx(ut,{children:P}),t[55]=P,t[56]=U):U=t[56];let Z;t[57]!==e?(Z=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=Z):Z=t[58];let ee;t[59]!==d||t[60]!==Z?(ee=o.jsx(pt,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Z}),t[59]=d,t[60]=Z,t[61]=ee):ee=t[61];let te;t[62]!==U||t[63]!==ee?(te=o.jsxs(gt,{children:[U,ee]}),t[62]=U,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==Q||t[66]!==te?(oe=o.jsxs(ft,{children:[Q,te]}),t[65]=Q,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==ne||t[69]!==oe?(se=o.jsx(ht,{open:ne,onOpenChange:I,children:oe}),t[68]=ne,t[69]=oe,t[70]=se):se=t[70];let le;return t[71]!==k||t[72]!==z||t[73]!==B||t[74]!==R||t[75]!==se?(le=o.jsxs(k,{children:[z,B,R,se]}),t[71]=k,t[72]=z,t[73]=B,t[74]=R,t[75]=se,t[76]=le):le=t[76],le}function St(t){return t.id}export{ts as default};
1
+ import{c as ge,b as ce,j as o,v as ve,B as ie,F as Ce,o as Ne,a as Ae,r as W,n as Ie,K as me,e as Le,p as V,t as de,G as Te,m as Ee}from"./index-tHM8NTfd.js";import{a as re,b as De,D as ue,c as pe}from"./dropdown-menu-DBsO6utH.js";import{a as Fe}from"./Users03-C-mvAxcs.js";import{G as ye}from"./use-registry-app-D8hx17d1.js";import{a as ke,b as Ge,c as Oe}from"./use-virtual-mcp-DXStXtw1.js";import{P as ae}from"./index-D6fjxFLg.js";import{a as Pe}from"./DotsVertical-Db5Rriwt.js";import{a as Me,b as ze}from"./Settings02-k_lwzmTv.js";import{s as Be}from"./Trash01-DnjcslV5.js";import{p as Re,f as fe}from"./pt-BR-CLy76QW2.js";import{A as $e,a$ as Ue}from"./agent-icon-DW-jknHC.js";import{c as we}from"./use-navigate-to-agent-DEAiy9mr.js";import{C as Ve}from"./card-LK3SgMlx.js";import{u as He}from"./use-capability-nY6kVL8r.js";import{E as Ke}from"./empty-state-Cj1VbJ0y.js";import{u as qe}from"./use-create-virtual-mcp-DS8KPcoG.js";import{u as Qe}from"./use-connection-uKN5YWIx.js";import{u as he,S as Je}from"./use-mcp-client-BAwn-0AV.js";import{u as Ye,G as We}from"./github-repo-picker-CeuXOkGP.js";import{p as Xe,a as xe}from"./deco-site-production-url-CaKZ7xBn.js";import{g as Ze}from"./github-repo-scope-DjMZbiKa.js";import{f as et,a as tt,p as ot}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as st,d as it,a as nt,b as rt,c as lt}from"./dialog-D370feZI.js";import{C as at}from"./collection-search-C63j6Zzd.js";import{c as ct,d as mt,b as dt,f as ut,g as pt,e as gt,a as ft,A as ht}from"./alert-dialog-B5UNzzAF.js";import{S as xt}from"./search-input-C_HmTn9N.js";import{s as je}from"./Plus-D7R6BF5R.js";import"./Check-DN6IPn_3.js";import"./ChevronRight-CmrokxXJ.js";import"./use-mcp-tools-CgtI4_xz.js";import"./sidebar-DS29jp1e.js";import"./LayoutLeft-BzJLVhVQ.js";import"./use-mobile-B-9CWMAs.js";import"./X-DsJCvKBO.js";import"./tooltip-C4NGAgAM.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-DevA0A1M.js";import"./Tool01-B14PZEqF.js";import"./ArrowUp-CLXut3hx.js";import"./Tool02-C-4pjcCY.js";import"./ArrowRight-Dq4C6lJ4.js";import"./ArrowUpRight-Bay5EW8Z.js";import"./TrendUp01-BVE2-KuE.js";import"./ZapSquare-DpSSWmnE.js";import"./CheckCircle-ck8m-YN6.js";import"./ChevronDown-cZoWRgvb.js";import"./ChevronUp-CswOdRaR.js";import"./Stars02-Djd7mUzA.js";import"./Copy01-BGeJ_uJU.js";import"./Eye-BqdZYqpI.js";import"./FilterLines-BFxvHa0q.js";import"./Star01-Bv8b5o6W.js";import"./Palette-CgoT-TdN.js";import"./SwitchHorizontal01-C9T_FryU.js";import"./HardDrive-C1-SCHTe.js";import"./Key01-YwqEObkc.js";import"./XCircle-Eu9CNvjp.js";import"./LinkExternal01-Dv9Aj-K0.js";import"./LogOut01-D1zBEUWi.js";import"./Monitor01-c_9oVNrI.js";import"./Sun-DZlLfVSj.js";import"./Play-DY15eh3c.js";import"./SearchLg-B1avg8bD.js";import"./SearchMd-B-lbf8c2.js";import"./Shield01-DFBgcYa0.js";import"./Stars01-CAvqsR90.js";import"./Upload01-uhey7zjg.js";import"./User01-DQzbx1Xu.js";import"./Users01-Ct4A_zsW.js";import"./XClose-BcWYJ3jm.js";import"./Zap-BiPzgNTf.js";import"./hooks-DJ2YKeR9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CFz6l2VG.js";import"./reusable-new-chat-CouMjkYR.js";import"./auth-Btre_1OW.js";import"./use-debounced-value-DuOUoSmu.js";import"./authenticate-and-persist-oauth-DMOmyFRT.js";import"./mcp-oauth-Ch4TwOlY.js";import"./extract-connection-data-C8zhfgGc.js";import"./metadata-dUsYcpuu.js";function be(t){const e=ge.c(28),{onCreateFromScratch:n,onImportGitHub:i,onImportDeco:r,isCreating:u,align:L,side:E,showBetaBadge:f}=t,b=L===void 0?"end":L,c=ce();let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Fe,{size:14}),e[0]=C):C=e[0];let h;e[1]!==c?(h=c("common.createAgentDropdown.createFromScratch"),e[1]=c,e[2]=h):h=e[2];let p;e[3]!==u||e[4]!==n||e[5]!==h?(p=o.jsxs(re,{disabled:u,onClick:n,children:[C,h]}),e[3]=u,e[4]=n,e[5]=h,e[6]=p):p=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(ye,{className:"size-3.5"}),e[7]=g):g=e[7];let j;e[8]!==c?(j=c("common.createAgentDropdown.importFromGitHub"),e[8]=c,e[9]=j):j=e[9];let a;e[10]!==f?(a=f&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=f,e[11]=a):a=e[11];let l;e[12]!==i||e[13]!==j||e[14]!==a?(l=o.jsxs(re,{onClick:i,children:[g,j,a]}),e[12]=i,e[13]=j,e[14]=a,e[15]=l):l=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=m):m=e[16];let x;e[17]!==c?(x=c("common.createAgentDropdown.importFromDeco"),e[17]=c,e[18]=x):x=e[18];let y;e[19]!==r||e[20]!==x?(y=o.jsxs(re,{onClick:r,children:[m,x]}),e[19]=r,e[20]=x,e[21]=y):y=e[21];let d;return e[22]!==b||e[23]!==E||e[24]!==y||e[25]!==p||e[26]!==l?(d=o.jsxs(De,{side:E,align:b,className:"w-48",children:[p,l,y]}),e[22]=b,e[23]=E,e[24]=y,e[25]=p,e[26]=l,e[27]=d):d=e[27],d}function jt(t){const e=ge.c(47),{project:n,lastUsedAt:i,onDeleteClick:r}=t,u=we(),L=ce(),[E]=ve(),f=E.language==="pt-BR"?Re:void 0;let b;e[0]!==u||e[1]!==n.id?(b=()=>u(n.id),e[0]=u,e[1]=n.id,e[2]=b):b=e[2];let c;e[3]!==n.title||e[4]!==b?(c=o.jsx("button",{type:"button",onClick:b,className:"absolute inset-0 z-0","aria-label":n.title}),e[3]=n.title,e[4]=b,e[5]=c):c=e[5];let C;e[6]!==n.icon||e[7]!==n.title?(C=o.jsx($e,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=n.icon,e[7]=n.title,e[8]=C):C=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Pe,{size:20})})}),e[9]=h):h=e[9];let p;e[10]!==u||e[11]!==n.id?(p=()=>u(n.id,{search:{main:"settings"}}),e[10]=u,e[11]=n.id,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Me,{size:16}),e[13]=g):g=e[13];let j;e[14]!==p?(j=o.jsxs(re,{onClick:p,children:[g,"Settings"]}),e[14]=p,e[15]=j):j=e[15];let a;e[16]!==r?(a=r&&o.jsxs(re,{variant:"destructive",onClick:H=>{H.stopPropagation(),r(H)},children:[o.jsx(Be,{size:16}),"Delete"]}),e[16]=r,e[17]=a):a=e[17];let l;e[18]!==j||e[19]!==a?(l=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(De,{align:"end",children:[j,a]})]})}),e[18]=j,e[19]=a,e[20]=l):l=e[20];let m;e[21]!==C||e[22]!==l?(m=o.jsxs("div",{className:"flex items-start justify-between",children:[C,l]}),e[21]=C,e[22]=l,e[23]=m):m=e[23];let x;e[24]!==n.title?(x=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[24]=n.title,e[25]=x):x=e[25];const y=n.description||"No description";let d;e[26]!==y?(d=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:y}),e[26]=y,e[27]=d):d=e[27];let k;e[28]!==x||e[29]!==d?(k=o.jsxs("div",{className:"flex flex-col gap-1",children:[x,d]}),e[28]=x,e[29]=d,e[30]=k):k=e[30];let S;e[31]!==m||e[32]!==k?(S=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[m,k]}),e[31]=m,e[32]=k,e[33]=S):S=e[33];let G;e[34]!==i||e[35]!==f||e[36]!==n.updated_at||e[37]!==L?(G=i?L("home.projectCard.lastUsed",{time:fe(new Date(i),{addSuffix:!0,locale:f})}):L("home.projectCard.updated",{time:fe(new Date(n.updated_at),{addSuffix:!0,locale:f})}),e[34]=i,e[35]=f,e[36]=n.updated_at,e[37]=L,e[38]=G):G=e[38];let D;e[39]!==G?(D=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:G})})}),e[39]=G,e[40]=D):D=e[40];let w;e[41]!==S||e[42]!==D?(w=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[S,D]}),e[41]=S,e[42]=D,e[43]=w):w=e[43];let v;return e[44]!==w||e[45]!==c?(v=o.jsxs(Ve,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[c,w]}),e[44]=w,e[45]=c,e[46]=v):v=e[46],v}const bt="deco-sites";function Ct(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const n=e.owner,i=e.repo;return typeof n!="string"||typeof i!="string"||n.length===0||i.length===0?null:{owner:n,repo:i}}function Dt(t,e){const n=e?Ct(e):null,i=n?.owner??bt,r=n?.repo??t;return{owner:i,name:r,url:`https://github.com/${i}/${r}`}}function yt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function _e(t,e,n){const i=await fetch(t,e),r=await i.json().catch(()=>({}));if(!i.ok)throw new Error(r.error??`${n} (${i.status})`);return r}function wt(t){return _e(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function _t({open:t,onOpenChange:e,onBack:n}){const i=ce(),{org:r}=Ce(),u=we(),L=Ne(),{data:E}=Ae.useSession(),[f,b]=W.useState(null),[c,C]=W.useState(null),[h,p]=W.useState(""),g=he({connectionId:Je,orgId:r.id,orgSlug:r.slug}),j=Qe({slug:"mcp-github"}),a=Ze(j),l=Ye({enabled:t&&a.length===0}),m=a.length===1?a[0]??null:c,x=a.length>1&&!m,y=he({connectionId:m?.id??"",orgId:r.id,orgSlug:r.slug}),d=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:k,isLoading:S,error:G}=Ie({queryKey:me.decoSites(E?.user?.email),queryFn:()=>wt(r.slug),enabled:t&&!!E?.user?.email,staleTime:6e4,retry:!1}),D=k?.sites??[],w=s=>{s||(b(null),C(null),p("")),e(s)},v=D.filter(s=>s.name.toLowerCase().includes(h.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(h.toLowerCase())??!1)),H=!f||v.some(s=>s.name===f),O=Le({mutationFn:async s=>{if(!m)throw new Error(i("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:N,appSlug:T}=await et(I=>g.callTool(I),m.id),K=D.find(I=>I.name===s);if(!K)throw new Error(i("common.importFromDecoDialog.siteNoLongerAvailable"));const A=Dt(s,K.metadata),M=tt(N,A.owner);if(!M){const I=T?`https://github.com/apps/${T}/installations/new`:"https://github.com/settings/installations";throw new Error(i("common.importFromDecoDialog.installGithubApp",{owner:A.owner,installUrl:I}))}let z=null,B=null,R=null;const ne=async()=>{R&&await g.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:R}}).catch(()=>{}),B&&await g.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:B,force:!0}}).catch(()=>{}),z&&await g.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:z,force:!0}}).catch(()=>{})};try{const I=await _e(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},i("common.importFromDecoDialog.failedToCreateConnection")),F=I.connId;if(!F)throw new Error(i("common.importFromDecoDialog.noConnectionId"));z=F;const{childConnectionId:$}=await ot({orgSlug:r.slug,sourceConnection:m,installationId:M.installationId,owner:A.owner,repo:A.name,githubCallTool:U=>y.callTool(U),selfCallTool:U=>g.callTool(U)});B=$;const q=I.icon??null,X=yt(s),J=s.toLowerCase(),Y=Xe(xe(K.domains)),Q=await g.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:q??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:J,productionUrl:Y,githubRepo:{owner:A.owner,name:A.name,url:A.url,installationId:M.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:q,themeColor:"#22C55E",slug:X,pinnedViews:[{connectionId:F,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:F,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:F},{connection_id:$}]}}}),P=Q.structuredContent??Q;if(!P.item?.id)throw new Error(i("common.importFromDecoDialog.failedToCreateAgent"));return R=P.item.id,{slug:X,virtualMcpId:P.item.id,connId:F,item:P.item}}catch(I){throw await ne(),I}},onSuccess:({slug:s,virtualMcpId:N,item:T})=>{V("deco_site_import_succeeded",{site_name:T.title,virtual_mcp_id:N,slug:s}),L.setQueryData(me.collectionItem(g,r.id,"","VIRTUAL_MCP",N),{item:T}),L.invalidateQueries({predicate:K=>{const A=K.queryKey;return A[1]===r.id&&A[3]==="collection"&&A[4]==="VIRTUAL_MCP"}}),L.invalidateQueries({queryKey:me.projects(r.id)}),de.success(i("common.importFromDecoDialog.importSuccess",{slug:s})),w(!1),localStorage.setItem(Te.sidebarOpen(),JSON.stringify(!1)),u(N)},onError:s=>{V("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),de.error(i("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:i("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(st,{open:t,onOpenChange:w,children:o.jsxs(it,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(nt,{className:"sr-only",children:o.jsx(rt,{children:i("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[n&&o.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":i("common.importFromDecoDialog.goBack"),children:o.jsx(ze,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:i("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(at,{value:h,onChange:p,placeholder:i("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&p("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??i("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:i("common.importFromDecoDialog.retryGithubSetup")})]}),d&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.settingUpGithub")}),x&&!d&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:i("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>C(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(ye,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),S&&!d&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.loadingSites")}),!S&&!d&&!x&&l.status!=="error"&&!G&&D.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.noSitesFound")}),!S&&!d&&!x&&l.status!=="error"&&D.length>0&&o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:i("common.importFromDecoDialog.noSitesMatch",{search:h})}),v.map(s=>{const N=xe(s.domains),T=f===s.name;return o.jsxs("button",{type:"button",onClick:()=>b(s.name),className:Ee("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",T?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),N&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:N})]})]},s.name)})]})]}),o.jsxs(lt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>w(!1),disabled:O.isPending,children:i("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!f||!H||O.isPending||S||d||x||!m||l.status==="error",onClick:()=>f&&O.mutate(f),children:O.isPending?i("common.importFromDecoDialog.importing"):i("common.importFromDecoDialog.import")})]})]})})}function ts(){const t=ge.c(77),e=ce(),{org:n}=Ce(),i=ke(),r=Ge(),[u,L]=W.useState("");let E;t[0]===Symbol.for("react.memo_cache_sentinel")?(E={navigateOnCreate:!0},t[0]=E):E=t[0];const{createVirtualMCP:f,isCreating:b}=qe(E),[c,C]=W.useState(null),[h,p]=W.useState(!1),[g,j]=W.useState(!1),{granted:a}=He("agents:manage"),l=u.toLowerCase(),m=i.filter(_=>_.id!==n.id&&(_.title.toLowerCase().includes(l)||_.description?.toLowerCase().includes(l))),{data:x}=Oe(m.map(St));let y;t[1]!==r||t[2]!==c||t[3]!==e?(y=async()=>{if(!c)return;const{id:_,title:Se}=c;C(null);try{await r.delete.mutateAsync(_),V("agent_deleted",{agent_id:_,source:"agents_list"}),de.success(e("routes.agentsList.deletedAgent",{title:Se}))}catch{}},t[1]=r,t[2]=c,t[3]=e,t[4]=y):y=t[4];const d=y,k=ae,S=ae,G=ae;let D;t[5]!==e?(D=e("routes.agentsList.title"),t[5]=e,t[6]=D):D=t[6];let w;t[7]!==D?(w=o.jsx(ae.Title,{children:D}),t[7]=D,t[8]=w):w=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let H;t[11]===Symbol.for("react.memo_cache_sentinel")?(H=_=>{_.key==="Escape"&&(L(""),_.target.blur())},t[11]=H):H=t[11];let O;t[12]!==u||t[13]!==v?(O=o.jsx(xt,{value:u,onChange:L,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:H}),t[12]=u,t[13]=v,t[14]=O):O=t[14];let s;t[15]!==a||t[16]!==f||t[17]!==b||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(je,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),f()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),j(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),p(!0)},isCreating:b,align:"end"})]}),t[15]=a,t[16]=f,t[17]=b,t[18]=e,t[19]=s):s=t[19];let N;t[20]!==O||t[21]!==s?(N=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[O,s]}),t[20]=O,t[21]=s,t[22]=N):N=t[22];let T;t[23]!==N||t[24]!==w?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[w,N]}),t[23]=N,t[24]=w,t[25]=T):T=t[25];const K=m.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ke,{image:o.jsx(Ue,{size:48,className:"text-muted-foreground"}),title:e(u?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:u?e("routes.agentsList.noAgentsMatchSearch",{search:u}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!u&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(je,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),f()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),j(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),p(!0)},isCreating:b,align:"center",showBetaBadge:!0})]})})}),A=m.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:m.map(_=>o.jsx(jt,{project:_,lastUsedAt:x?.get(_.id)?.last_used_at,onDeleteClick:a?()=>C({id:_.id,title:_.title}):void 0},_.id))})]});let M;t[26]!==T||t[27]!==K||t[28]!==A||t[29]!==G.Body?(M=o.jsxs(G.Body,{children:[T,K,A]}),t[26]=T,t[27]=K,t[28]=A,t[29]=G.Body,t[30]=M):M=t[30];let z;t[31]!==M||t[32]!==S.Content?(z=o.jsx(S.Content,{children:M}),t[31]=M,t[32]=S.Content,t[33]=z):z=t[33];let B;t[34]!==g?(B=o.jsx(We,{open:g,onOpenChange:j}),t[34]=g,t[35]=B):B=t[35];let R;t[36]!==h?(R=o.jsx(_t,{open:h,onOpenChange:p}),t[36]=h,t[37]=R):R=t[37];const ne=!!c;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=_=>!_&&C(null),t[38]=I):I=t[38];let F;t[39]!==e?(F=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=F):F=t[40];let $;t[41]!==F?($=o.jsx(ct,{children:F}),t[41]=F,t[42]=$):$=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const X=c?.title;let J;t[45]!==X?(J=o.jsx("span",{className:"font-medium text-foreground",children:X}),t[45]=X,t[46]=J):J=t[46];let Y;t[47]!==q||t[48]!==J?(Y=o.jsxs(mt,{children:[q," ",J,"."]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let Q;t[50]!==$||t[51]!==Y?(Q=o.jsxs(dt,{children:[$,Y]}),t[50]=$,t[51]=Y,t[52]=Q):Q=t[52];let P;t[53]!==e?(P=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=P):P=t[54];let U;t[55]!==P?(U=o.jsx(ut,{children:P}),t[55]=P,t[56]=U):U=t[56];let Z;t[57]!==e?(Z=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=Z):Z=t[58];let ee;t[59]!==d||t[60]!==Z?(ee=o.jsx(pt,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Z}),t[59]=d,t[60]=Z,t[61]=ee):ee=t[61];let te;t[62]!==U||t[63]!==ee?(te=o.jsxs(gt,{children:[U,ee]}),t[62]=U,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==Q||t[66]!==te?(oe=o.jsxs(ft,{children:[Q,te]}),t[65]=Q,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==ne||t[69]!==oe?(se=o.jsx(ht,{open:ne,onOpenChange:I,children:oe}),t[68]=ne,t[69]=oe,t[70]=se):se=t[70];let le;return t[71]!==k||t[72]!==z||t[73]!==B||t[74]!==R||t[75]!==se?(le=o.jsxs(k,{children:[z,B,R,se]}),t[71]=k,t[72]=z,t[73]=B,t[74]=R,t[75]=se,t[76]=le):le=t[76],le}function St(t){return t.id}export{ts as default};
@@ -1 +1 @@
1
- import{W as se,X as D,a1 as Ae,a3 as we,a4 as Ue,a2 as He,a$ as Fe,c as X,b as ne,Y as ze,Z as qe,r as J,j as s,a5 as rt,t as ae,aw as Be,F as De,o as Ke,e as Se,K as oe,n as Le,m as Te,B as re,p as Ve,v as ot,E as nt}from"./index-DnHWblfu.js";import{i as at}from"./AlertCircle-XYVipozu.js";import{P as Pe}from"./index-rNfPhyEe.js";import{S as Me}from"./skeleton-CQ4Si4tx.js";import{b as Qe,a as Ee,S as Re,c as ct}from"./settings-section-DysjSOio.js";import{u as Ce,a as Ne,b as Ge}from"./use-ai-providers-CuhkQheE.js";import{i as dt}from"./CheckCircle-CpszjLbT.js";import{a as mt,f as ft}from"./use-organization-settings-Bbc0ktBM.js";import{c as ut,d as Ye,P as pt,C as $e}from"./select-model-RA4tH7cK.js";import{u as gt}from"./use-debounced-autosave-rKGkta2N.js";import{G as ht,H as xt,I as vt,S as yt}from"./chat-context-BrrGaGbH.js";import{I as Ie}from"./input-BKgQbLb7.js";import{T as Oe,a as bt}from"./toggle-group-BQ95Mzlw.js";import{c as We,d as Je,b as Xe,f as Ze,g as et,e as tt,a as st,A as it}from"./alert-dialog-vMeKz1oj.js";import{u as je}from"./studio-tools-1de_48yn.js";import{s as jt}from"./Plus-Dc9c0aJB.js";import{p as St,f as Ct}from"./pt-BR-CLy76QW2.js";import{c as _t}from"./Tool01-DgbxCa0X.js";import{s as kt}from"./Trash01-i0AMIXBp.js";import{A as Pt}from"./avatar-ABBG4Zys.js";import{i as Nt}from"./Settings02-kFO_alvx.js";import{s as It}from"./Eye-DDei6OvA.js";import{b as Dt,a as Kt,d as wt,e as At,c as Mt}from"./dialog-DgVuLqhS.js";import{R as Et}from"./require-capability-E_Dah2u4.js";import"./sidebar-DCTvELfP.js";import"./LayoutLeft-DAco-6YX.js";import"./use-mobile-ChN0uU-Y.js";import"./X-BZ-Qrql-.js";import"./tooltip-44-2qw6b.js";import"./card-CpyAPk4W.js";import"./ArrowUpRight-Dzxf-lpo.js";import"./use-mcp-client-BG7zveIM.js";import"./auth-CjPDmXKg.js";import"./drawer-BAKGed9i.js";import"./checkbox-Dyd2bOG3.js";import"./Check-BQap7Cpe.js";import"./select-g0E4j9Tt.js";import"./ChevronDown-BNTAvoWs.js";import"./ChevronUp-CMJpp_7f.js";import"./Key01-BTOQ7Hsi.js";import"./SearchMd-BnuXOyI2.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01--AULmP_e.js";import"./ChevronRight-C4GCxTzK.js";import"./connect-desktop-dialog-CpDi9jEG.js";import"./Copy01-D_SKj3JY.js";import"./Stars01-DkHEjXrS.js";import"./tab-id-Ckd-ZAMH.js";import"./hooks-CSzZamSr.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CSHbnCTw.js";import"./use-virtual-mcp-D6qbeGCA.js";import"./use-decopilot-events-JMTJZeEq.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-BcNtSYpD.js";import"./use-capability-ZuDMV8i_.js";import"./access-gate-CVZr_K21.js";import"./capability-load-error-B9ewQDHI.js";se({title:D(),url:D(),icon:D()});se({registries:we(D(),se({enabled:Ue()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ae(D()).describe("List of MCP app_name or app_id values to hide from the store.")});const ce=se({keyId:D(),modelId:D(),title:D().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Rt=se({tiers:se({fast:ce,smart:ce,thinking:ce,image:ce,web_search:ce,deep_research:ce})});se({tiers:se({fast:ce.optional(),smart:ce.optional(),thinking:ce.optional()})});se({ids:Ae(D()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});se({id:D().describe("Brand context ID"),name:D().describe("Company name"),domain:D().describe("Company domain (e.g. example.com)"),overview:D().describe("Company overview / description"),logo:D().nullable().optional().describe("Logo URL"),favicon:D().nullable().optional().describe("Favicon URL"),ogImage:D().nullable().optional().describe("OG image URL"),fonts:se({heading:D().optional().describe("Font family for headings"),body:D().optional().describe("Font family for body text"),code:D().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:D().optional().describe("Primary brand color (hex)"),secondary:D().optional().describe("Secondary brand color (hex)"),accent:D().optional().describe("Accent / highlight color (hex)"),background:D().optional().describe("Background color (hex)"),foreground:D().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ae(we(D(),Fe())).nullable().optional().describe("Brand images"),metadata:we(D(),Fe()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:D().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ue().optional().describe("Whether this is the default brand for the organization")});const Ft=e=>e.capabilities?.includes("image")===!0,Tt=e=>ht(e),$t=e=>xt(e),Ot=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ft},{key:"web_search",filter:Tt},{key:"deep_research",filter:$t}];function Ut(e){const t=X.c(26),{slot:i,onSlotChange:l,filterModels:n,defaultKeyId:a}=e,c=Ce(),[o,y]=J.useState(i?.keyId??a);let _;t[0]!==i?(_=()=>{i?.keyId&&y(i.keyId)},t[0]=i,t[1]=_):_=t[1];const b=i?.keyId;let r;t[2]!==b?(r=[b],t[2]=b,t[3]=r):r=t[3],J.useEffect(_,r);const d=o??a;let m;t[4]!==d||t[5]!==c?(m=d?c.find(v=>v.id===d):null,t[4]=d,t[5]=c,t[6]=m):m=t[6];const u=m,{models:h,isLoading:g}=Ne(n?d??void 0:void 0),k=n?g||h.some(n):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const j=p,N=ne();if(n&&!k){let v;t[10]!==N?(v=N("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=N,t[11]=v):v=t[11];let K;return t[12]!==v?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:v}),t[12]=v,t[13]=K):K=t[13],K}let S;t[14]!==N?(S=N("settings.simpleModeSection.pickModel"),t[14]=N,t[15]=S):S=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=v=>y(v),t[16]=C):C=t[16];let f;t[17]!==d||t[18]!==l?(f=v=>{const K=v.keyId??d??"";y(K),l({keyId:K,modelId:v.modelId,title:v.title})},t[17]=d,t[18]=l,t[19]=f):f=t[19];let P;return t[20]!==d||t[21]!==n||t[22]!==j||t[23]!==S||t[24]!==f?(P=s.jsx(ut,{variant:"bordered",placeholder:S,model:j,credentialId:d,filterModels:n,onCredentialChange:C,onModelChange:f}),t[20]=d,t[21]=n,t[22]=j,t[23]=S,t[24]=f,t[25]=P):P=t[25],P}function Ht(e){const t=X.c(10),{isPending:i,showSaved:l}=e,n=ne();if(i){let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=a):a=t[0];let c;t[1]!==n?(c=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=c):c=t[2];let o;return t[3]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[3]=c,t[4]=o):o=t[4],o}if(l){let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(dt,{size:12}),t[5]=a):a=t[5];let c;t[6]!==n?(c=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=c):c=t[7];let o;return t[8]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[8]=c,t[9]=o):o=t[9],o}return null}function zt(){const e=X.c(58),t=ne(),i=Ce(),l=mt(),n=i.length>0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ze(Rt),e[0]=a):a=e[0];let c;e[1]!==l?(c={resolver:a,values:l,mode:"onChange"},e[1]=l,e[2]=c):c=e[2];const o=qe(c),{mutate:y,isPending:_,isSuccess:b}=ft(),r=o.formState.isDirty;let d;e[3]!==o||e[4]!==l||e[5]!==t||e[6]!==y?(d={delayMs:250,save:async()=>{const x=o.getValues();y(x,{onSuccess:()=>o.reset(x,{keepValues:!0}),onError:A=>{o.reset(l),ae.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=l,e[5]=t,e[6]=y,e[7]=d):d=e[7];const{schedule:m}=gt(d),u=i[0],h=i[1],g=i[2],{models:k}=Ne(u?.id),{models:p}=Ne(h?.id),{models:j}=Ne(g?.id);let N,S;e[8]!==o||e[9]!==n?(N=()=>{n||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},S=[n,o],e[8]=o,e[9]=n,e[10]=N,e[11]=S):(N=e[10],S=e[11]),J.useEffect(N,S);let C;e[12]!==i||e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==g||e[17]!==k||e[18]!==p||e[19]!==j?(C=()=>{const x=o.getValues(),A=new Set(i.map(qt)),M={};u?.id&&(M[u.id]=k),h?.id&&(M[h.id]=p),g?.id&&(M[g.id]=j);const w=L=>L!=null&&!A.has(L.keyId),I={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},Y=!I.fast||!I.smart||!I.thinking||!I.image||!I.web_search||!I.deep_research,W=I.fast===x.tiers.fast&&I.smart===x.tiers.smart&&I.thinking===x.tiers.thinking&&I.image===x.tiers.image&&I.web_search===x.tiers.web_search&&I.deep_research===x.tiers.deep_research;if(!Y&&W)return;const $=vt(i,M);o.reset({tiers:{fast:I.fast??$.chat.fast,smart:I.smart??$.chat.smart,thinking:I.thinking??$.chat.thinking,image:I.image??$.image,web_search:I.web_search??$.webSearch,deep_research:I.deep_research??$.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=o,e[14]=u,e[15]=h,e[16]=g,e[17]=k,e[18]=p,e[19]=j,e[20]=C):C=e[20];const f=u?.id,P=h?.id,v=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==p||e[25]!==j||e[26]!==f||e[27]!==P||e[28]!==v?(K=[o,i,k,p,j,f,P,v],e[21]=i,e[22]=o,e[23]=k,e[24]=p,e[25]=j,e[26]=f,e[27]=P,e[28]=v,e[29]=K):K=e[29],J.useEffect(C,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const B=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const Q=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let E;e[36]!==t?(E=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=E):E=e[37];let H;e[38]!==E?(H=s.jsx("p",{className:"text-sm text-muted-foreground",children:E}),e[38]=E,e[39]=H):H=e[39];const G=b&&!r;let z;e[40]!==_||e[41]!==G?(z=s.jsx(Ht,{isPending:_,showSaved:G}),e[40]=_,e[41]=G,e[42]=z):z=e[42];let R;e[43]!==H||e[44]!==z?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[H,z]}),e[43]=H,e[44]=z,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==Q||e[49]!==B||e[50]!==m?(F=Ot.map(x=>s.jsx(rt,{control:o.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:B(x.key),description:Q(x.key),action:s.jsx(Ut,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=Q,e[49]=B,e[50]=m,e[51]=F):F=e[51];let T;e[52]!==F?(T=s.jsx(Ee,{children:F}),e[52]=F,e[53]=T):T=e[53];let q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function qt(e){return e.id}const Bt={usd:[10,20,100],brl:[50,100,500]};function Lt(){const e=X.c(30),t=ne(),i=je(),[l,n]=J.useState(!1);let a;e[0]!==t?(a=f=>{ae.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:c,isPending:o}=Se({mutationFn:async f=>{const{url:P}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:d});return P},onSuccess:Vt,onError:a}),[y,_]=J.useState(""),[b,r]=J.useState("usd"),d=b,m=parseFloat(y),u=!isNaN(m)&&m>=1,h=d==="brl"?"R$":"$";let g;e[2]!==r?(g=f=>{f&&r(f)},e[2]=r,e[3]=g):g=e[3];let k,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Oe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=s.jsx(Oe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=p):(k=e[4],p=e[5]);let j;e[6]!==d||e[7]!==g?(j=s.jsxs(bt,{type:"single",variant:"outline",size:"default",value:d,onValueChange:g,children:[k,p]}),e[6]=d,e[7]=g,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==h||e[11]!==l||e[12]!==o||e[13]!==t||e[14]!==c?(N=!l&&s.jsxs(s.Fragment,{children:[Bt[d].map(f=>s.jsxs(re,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>c(f*100),children:[h,f]},f)),s.jsx(re,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=h,e[11]=l,e[12]=o,e[13]=t,e[14]=c,e[15]=N):N=e[15];let S;e[16]!==h||e[17]!==y||e[18]!==m||e[19]!==l||e[20]!==u||e[21]!==o||e[22]!==_||e[23]!==t||e[24]!==c?(S=l&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:h}),s.jsx(Ie,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:y,onChange:f=>_(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!u||o,onClick:()=>c(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(re,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=y,e[18]=m,e[19]=l,e[20]=u,e[21]=o,e[22]=_,e[23]=t,e[24]=c,e[25]=S):S=e[25];let C;return e[26]!==j||e[27]!==N||e[28]!==S?(C=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,N,S]})}),e[26]=j,e[27]=N,e[28]=S,e[29]=C):C=e[29],C}function Vt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Qt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Gt(){const e=X.c(121),t=ne(),{org:i}=De(),l=je(),n=Ke(),a=Ce();let c;e[0]!==a?(c=a.find(Yt),e[0]=a,e[1]=c):c=e[1];const o=c,[y,_]=J.useState(!1);let b;e[2]!==o||e[3]!==l?(b=async()=>{o&&await l.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=l,e[4]=b):b=e[4];let r;e[5]!==i.id||e[6]!==n||e[7]!==t?(r=()=>{n.invalidateQueries({queryKey:oe.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:oe.aiProviders(i.id)}),ae.success(t("settings.decoCreditsHero.disconnectSuccess")),_(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=r):r=e[8];let d;e[9]!==t?(d=lt=>{ae.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==b||e[12]!==r||e[13]!==d?(m={mutationFn:b,onSuccess:r,onError:d},e[11]=b,e[12]=r,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:h}=Se(m);let g;e[15]!==i.id?(g=oe.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let p;e[17]!==l?(p=async()=>{try{return await l.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=l,e[18]=p):p=e[18];let j;e[19]!==g||e[20]!==k||e[21]!==p?(j={queryKey:g,enabled:k,staleTime:6e4,queryFn:p},e[19]=g,e[20]=k,e[21]=p,e[22]=j):j=e[22];const{data:N,isLoading:S,refetch:C,isFetching:f}=Le(j);if(!o)return null;const P=N?.balanceCents!=null?N.balanceCents/100:null;let v;e[23]!==P?(v=P!=null?`$${P.toFixed(2)}`:"—",e[23]=P,e[24]=v):v=e[24];const K=v;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let B;e[27]!==t?(B=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=B):B=e[28];let O;e[29]!==B?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:B,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=B,e[30]=O):O=e[30];let Q;e[31]!==t?(Q=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=Q):Q=e[32];let U;e[33]!==Q?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:Q})}),e[33]=Q,e[34]=U):U=e[34];let E;e[35]!==O||e[36]!==U?(E=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=E):E=e[37];let H;e[38]===Symbol.for("react.memo_cache_sentinel")?(H=()=>_(!0),e[38]=H):H=e[38];let G;e[39]!==t?(G=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=G):G=e[40];let z;e[41]!==h||e[42]!==G?(z=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:H,disabled:h,children:G}),e[41]=h,e[42]=G,e[43]=z):z=e[43];let R;e[44]!==E||e[45]!==z?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[E,z]}),e[44]=E,e[45]=z,e[46]=R):R=e[46];let F;e[47]!==t?(F=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=F):F=e[48];let T;e[49]!==F?(T=s.jsx(We,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let I;e[62]!==u?(I=()=>u(),e[62]=u,e[63]=I):I=e[63];let Y;e[64]!==t?(Y=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=Y):Y=e[65];let W;e[66]!==I||e[67]!==Y?(W=s.jsx(et,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=I,e[67]=Y,e[68]=W):W=e[68];let $;e[69]!==w||e[70]!==W?($=s.jsxs(tt,{children:[w,W]}),e[69]=w,e[70]=W,e[71]=$):$=e[71];let L;e[72]!==A||e[73]!==$?(L=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=L):L=e[74];let Z;e[75]!==y||e[76]!==L?(Z=s.jsx(it,{open:y,onOpenChange:_,children:L}),e[75]=y,e[76]=L,e[77]=Z):Z=e[77];let ee;e[78]!==P||e[79]!==K||e[80]!==f||e[81]!==S?(ee=S||f?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",P!=null&&Qt(P)),children:K}),e[78]=P,e[79]=K,e[80]=f,e[81]=S,e[82]=ee):ee=e[82];let te;e[83]!==C?(te=()=>C(),e[83]=C,e[84]=te):te=e[84];let ie;e[85]!==t?(ie=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ie):ie=e[86];const de=f&&"animate-spin";let le;e[87]!==de?(le=Te(de),e[87]=de,e[88]=le):le=e[88];let me;e[89]!==le?(me=s.jsx(Be,{size:14,className:le}),e[89]=le,e[90]=me):me=e[90];let fe;e[91]!==f||e[92]!==te||e[93]!==ie||e[94]!==me?(fe=s.jsx("button",{type:"button",onClick:te,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ie,children:me}),e[91]=f,e[92]=te,e[93]=ie,e[94]=me,e[95]=fe):fe=e[95];let ue;e[96]!==ee||e[97]!==fe?(ue=s.jsxs("div",{className:"flex items-baseline gap-2",children:[ee,fe]}),e[96]=ee,e[97]=fe,e[98]=ue):ue=e[98];let pe;e[99]!==t?(pe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=pe):pe=e[100];let ge;e[101]!==pe?(ge=s.jsx("p",{className:"text-xs text-muted-foreground",children:pe}),e[101]=pe,e[102]=ge):ge=e[102];let he;e[103]!==ue||e[104]!==ge?(he=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ue,ge]}),e[103]=ue,e[104]=ge,e[105]=he):he=e[105];let xe;e[106]!==t?(xe=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=xe):xe=e[107];let ve;e[108]!==xe?(ve=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:xe}),e[108]=xe,e[109]=ve):ve=e[109];let _e;e[110]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(Lt,{}),e[110]=_e):_e=e[110];let ye;e[111]!==ve?(ye=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ve,_e]}),e[111]=ve,e[112]=ye):ye=e[112];let be;e[113]!==R||e[114]!==Z||e[115]!==he||e[116]!==ye?(be=s.jsx(Ee,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,Z,he,ye]})}),e[113]=R,e[114]=Z,e[115]=he,e[116]=ye,e[117]=be):be=e[117];let ke;return e[118]!==V||e[119]!==be?(ke=s.jsx(Re,{title:V,children:be}),e[118]=V,e[119]=be,e[120]=ke):ke=e[120],ke}function Yt(e){return e.providerId==="deco"}function Wt(){const e=X.c(8),{org:t}=De(),i=je(),l=Ke();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let a;e[2]!==t||e[3]!==l?(a=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),l.invalidateQueries({queryKey:oe.aiProviderKeys(t.id)}),l.invalidateQueries({queryKey:oe.aiProviders(t.id)}),ae.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==a?(c={mutationFn:n,onSuccess:a,onError:Jt},e[5]=n,e[6]=a,e[7]=c):c=e[7],Se(c)}function Jt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ae.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Xt(){const e=X.c(37),t=ne(),{mutate:i,isPending:l}=Wt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=a):a=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let o;e[4]!==c?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:c,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=c,e[5]=o):o=e[5];let y;e[6]!==t?(y=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=y):y=e[7];let _;e[8]!==y?(_=s.jsx("p",{className:"text-base font-semibold",children:y}),e[8]=y,e[9]=_):_=e[9];let b;e[10]!==t?(b=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=b):b=e[11];let r;e[12]!==b?(r=s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:b}),e[12]=b,e[13]=r):r=e[13];let d;e[14]!==_||e[15]!==r?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_,r]}),e[14]=_,e[15]=r,e[16]=d):d=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let u;e[19]!==m?(u=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=u):u=e[20];let h;e[21]!==u||e[22]!==d?(h=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=h):h=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==l||e[27]!==t?(k=t(l?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=l,e[27]=t,e[28]=k):k=e[28];let p;e[29]!==l||e[30]!==g||e[31]!==k?(p=s.jsx(re,{variant:"outline",disabled:l,onClick:g,children:k}),e[29]=l,e[30]=g,e[31]=k,e[32]=p):p=e[32];let j;return e[33]!==h||e[34]!==p||e[35]!==o?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[a,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,h,p]})]}),e[33]=h,e[34]=p,e[35]=o,e[36]=j):j=e[36],j}const Zt=e=>se({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function es({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:l}){return e&&!!t&&t!==i&&!l}function ts({providerKey:e,provider:t,preset:i,maskedKey:l,currentLabel:n,currentBaseUrl:a,onCancel:c,onSuccess:o}){const{org:y}=De(),_=je(),b=Ke(),r=ne(),[d,m]=J.useState(!1),u=t.id==="openai-compatible",h=t.supportedMethods.includes("api-key"),g=Zt(r),{register:k,handleSubmit:p,watch:j,setError:N,formState:{errors:S}}=qe({resolver:ze(g),defaultValues:{label:n,apiKey:"",baseUrl:a??""}}),C=j("apiKey")??"",{mutate:f,isPending:P}=Se({mutationFn:async v=>{let K;v.apiKey&&(u?K=JSON.stringify({baseUrl:v.baseUrl||a||"",apiKey:v.apiKey}):K=v.apiKey),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:v.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{b.invalidateQueries({queryKey:oe.aiProviderKeys(y.id)}),b.invalidateQueries({queryKey:oe.aiProviders(y.id)}),ae.success(r("settings.editProviderDialog.providerUpdated")),o()},onError:v=>ae.error(r("settings.editProviderDialog.failedToUpdate",{error:v.message}))});return s.jsxs("form",{onSubmit:p(v=>{if(es({isOpenAICompatible:u,baseUrl:v.baseUrl,currentBaseUrl:a,apiKey:v.apiKey})){N("apiKey",{message:r("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}f(v)}),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.label")}),s.jsx(Ie,{placeholder:r("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),S.label&&s.jsx("p",{className:"text-xs text-destructive",children:S.label.message})]}),u&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.baseUrl")}),s.jsx(Ie,{type:"url",placeholder:i?.baseUrlPlaceholder??r("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),h&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[r("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",r("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ie,{type:d&&C?"text":"password",placeholder:l,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),C&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":r(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Nt,{size:14}):s.jsx(It,{size:14})})]}),S.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Mt,{children:[s.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:P,children:r("settings.editProviderDialog.cancel")}),s.jsx(re,{type:"submit",size:"sm",disabled:P,children:r(P?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ss(e){const t=X.c(31),{providerKey:i,provider:l,open:n,onOpenChange:a}=e,c=ne(),o=je(),y=l.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,_=y?.name??l.name;let b;t[0]!==i.id?(b=oe.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=b):b=t[1];let r;t[2]!==i.id||t[3]!==o?(r=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=r):r=t[4];let d;t[5]!==n||t[6]!==b||t[7]!==r?(d={queryKey:b,queryFn:r,enabled:n,staleTime:0},t[5]=n,t[6]=b,t[7]=r,t[8]=d):d=t[8];const{data:m,isLoading:u}=Le(d),h=At,g=wt,k="sm:max-w-md",p=Kt,j=Dt,N=c("settings.editProviderDialog.editTitle",{name:_});let S;t[9]!==j||t[10]!==N?(S=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=S):S=t[11];let C;t[12]!==p||t[13]!==S?(C=s.jsx(p,{children:S}),t[12]=p,t[13]=S,t[14]=C):C=t[14];let f;t[15]!==u||t[16]!==a||t[17]!==y||t[18]!==m||t[19]!==l||t[20]!==i?(f=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(yt,{})}):s.jsx(ts,{providerKey:i,provider:l,preset:y,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[15]=u,t[16]=a,t[17]=y,t[18]=m,t[19]=l,t[20]=i,t[21]=f):f=t[21];let P;t[22]!==g||t[23]!==C||t[24]!==f?(P=s.jsxs(g,{className:k,children:[C,f]}),t[22]=g,t[23]=C,t[24]=f,t[25]=P):P=t[25];let v;return t[26]!==h||t[27]!==a||t[28]!==n||t[29]!==P?(v=s.jsx(h,{open:n,onOpenChange:a,children:P}),t[26]=h,t[27]=a,t[28]=n,t[29]=P,t[30]=v):v=t[30],v}function is(e){const t=X.c(86),{providerKey:i,provider:l}=e,{org:n}=De(),a=je(),c=Ke(),[o,y]=J.useState(!1),[_,b]=J.useState(!1),r=ne(),[d]=ot(),m=d.language==="pt-BR"?St:void 0,u=l.id==="openai-compatible";let h;t[0]!==u||t[1]!==i.presetId?(h=u&&i.presetId?Ye(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=h):h=t[2];const g=h;let k;t[3]!==u||t[4]!==g||t[5]!==l.name||t[6]!==r?(k=g?g.name:u?r("settings.aiProviders.customOpenAiCompatible"):l.name,t[3]=u,t[4]=g,t[5]=l.name,t[6]=r,t[7]=k):k=t[7];const p=k,j=g?.logo??l.logo;let N;e:{if(u){N=i.label;break e}const de=i.label;let le;t[8]!==m||t[9]!==i.createdAt?(le=Ct(new Date(i.createdAt),{locale:m}),t[8]=m,t[9]=i.createdAt,t[10]=le):le=t[10],N=`${de} · added ${le} ago`}const S=N;let C;t[11]!==i.id||t[12]!==a?(C=async()=>{await a.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[11]=i.id,t[12]=a,t[13]=C):C=t[13];let f;t[14]!==n||t[15]!==i.id||t[16]!==c||t[17]!==r?(f=()=>{c.invalidateQueries({queryKey:oe.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:oe.aiProviders(n.id)}),c.invalidateQueries({queryKey:oe.aiProviderModels(n.id,i.id)}),ae.success(r("settings.providerKeyRow.keyDeleted")),y(!1)},t[14]=n,t[15]=i.id,t[16]=c,t[17]=r,t[18]=f):f=t[18];let P;t[19]!==r?(P=de=>ae.error(r("settings.providerKeyRow.failedToDeleteKey",{error:de.message})),t[19]=r,t[20]=P):P=t[20];let v;t[21]!==C||t[22]!==f||t[23]!==P?(v={mutationFn:C,onSuccess:f,onError:P},t[21]=C,t[22]=f,t[23]=P,t[24]=v):v=t[24];const{mutate:K,isPending:V}=Se(v);let B;t[25]!==p||t[26]!==j?(B=j?s.jsx("img",{src:j,alt:p,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Pt,{fallback:p.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[25]=p,t[26]=j,t[27]=B):B=t[27];let O;t[28]!==r?(O=r("settings.providerKeyRow.editProviderKey"),t[28]=r,t[29]=O):O=t[29];let Q,U;t[30]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>b(!0),U=s.jsx(_t,{size:14}),t[30]=Q,t[31]=U):(Q=t[30],U=t[31]);let E;t[32]!==O?(E=s.jsx(re,{variant:"ghost",size:"icon","aria-label":O,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Q,children:U}),t[32]=O,t[33]=E):E=t[33];let H;t[34]!==r?(H=r("settings.providerKeyRow.deleteProviderKey"),t[34]=r,t[35]=H):H=t[35];let G,z;t[36]===Symbol.for("react.memo_cache_sentinel")?(G=()=>y(!0),z=s.jsx(kt,{size:14}),t[36]=G,t[37]=z):(G=t[36],z=t[37]);let R;t[38]!==V||t[39]!==H?(R=s.jsx(re,{variant:"ghost",size:"icon","aria-label":H,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:V,onClick:G,children:z}),t[38]=V,t[39]=H,t[40]=R):R=t[40];let F;t[41]!==E||t[42]!==R?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[E,R]}),t[41]=E,t[42]=R,t[43]=F):F=t[43];let T;t[44]!==S||t[45]!==p||t[46]!==F||t[47]!==B?(T=s.jsx(Qe,{icon:B,title:p,description:S,action:F}),t[44]=S,t[45]=p,t[46]=F,t[47]=B,t[48]=T):T=t[48];let q;t[49]!==_||t[50]!==l||t[51]!==i?(q=s.jsx(ss,{providerKey:i,provider:l,open:_,onOpenChange:b}),t[49]=_,t[50]=l,t[51]=i,t[52]=q):q=t[52];let x;t[53]!==r?(x=r("settings.providerKeyRow.deleteApiKey"),t[53]=r,t[54]=x):x=t[54];let A;t[55]!==x?(A=s.jsx(We,{children:x}),t[55]=x,t[56]=A):A=t[56];let M;t[57]!==i.label?(M=s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=M):M=t[58];let w;t[59]!==A||t[60]!==M?(w=s.jsxs(Xe,{children:[A,M]}),t[59]=A,t[60]=M,t[61]=w):w=t[61];let I;t[62]!==r?(I=r("settings.providerKeyRow.cancel"),t[62]=r,t[63]=I):I=t[63];let Y;t[64]!==I?(Y=s.jsx(Ze,{children:I}),t[64]=I,t[65]=Y):Y=t[65];let W;t[66]!==K?(W=()=>K(),t[66]=K,t[67]=W):W=t[67];let $;t[68]!==r?($=r("settings.providerKeyRow.delete"),t[68]=r,t[69]=$):$=t[69];let L;t[70]!==W||t[71]!==$?(L=s.jsx(et,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$}),t[70]=W,t[71]=$,t[72]=L):L=t[72];let Z;t[73]!==Y||t[74]!==L?(Z=s.jsxs(tt,{children:[Y,L]}),t[73]=Y,t[74]=L,t[75]=Z):Z=t[75];let ee;t[76]!==w||t[77]!==Z?(ee=s.jsxs(st,{children:[w,Z]}),t[76]=w,t[77]=Z,t[78]=ee):ee=t[78];let te;t[79]!==o||t[80]!==ee?(te=s.jsx(it,{open:o,onOpenChange:y,children:ee}),t[79]=o,t[80]=ee,t[81]=te):te=t[81];let ie;return t[82]!==T||t[83]!==q||t[84]!==te?(ie=s.jsxs(s.Fragment,{children:[T,q,te]}),t[82]=T,t[83]=q,t[84]=te,t[85]=ie):ie=t[85],ie}function ls(e){const t=X.c(17),{onConnectClick:i}=e,l=ne(),n=Ce(),a=Ge();let c;t[0]!==a?.providers?(c=a?.providers??[],t[0]=a?.providers,t[1]=c):c=t[1];const o=c;let y;if(t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==l){let _;t[7]!==o?(_=h=>({key:h,provider:o.find(g=>g.id===h.providerId)}),t[7]=o,t[8]=_):_=t[8];const b=n.filter(ns).map(_).filter(os);let r;t[9]!==l?(r=l("settings.connectedProvidersSection.sectionTitle"),t[9]=l,t[10]=r):r=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(jt,{size:14}),t[11]=d):d=t[11];let m;t[12]!==l?(m=l("settings.connectedProvidersSection.connectButton"),t[12]=l,t[13]=m):m=t[13];let u;t[14]!==i||t[15]!==m?(u=s.jsxs(re,{size:"sm",onClick:i,children:[d,m]}),t[14]=i,t[15]=m,t[16]=u):u=t[16],y=s.jsx(Re,{title:r,headerClassName:"px-0",actions:u,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:l("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:b.map(rs)})}),t[2]=n,t[3]=i,t[4]=o,t[5]=l,t[6]=y}else y=t[6];return y}function rs(e){const{key:t,provider:i}=e;return s.jsx(is,{providerKey:t,provider:i},t.id)}function os(e){return e.provider!==void 0}function ns(e){return e.providerId!=="deco"}function as(e){const t=X.c(3),{error:i}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(at,{size:16}),t[0]=l):l=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function cs(){const e=X.c(23),t=Ce();let i;e[0]!==t?(i=t.some(ds),e[0]=t,e[1]=i):i=e[1];const l=i,n=t.length>0,[a,c]=J.useState(!1),[o,y]=J.useState(null),_=Ge();let b;e[2]!==_?.providers?(b=_?.providers??[],e[2]=_?.providers,e[3]=b):b=e[3];const r=b;if(!n){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),e[4]=k):k=e[4];let p;e[5]!==r?(p=s.jsx(pt,{providers:r,onSelect:y,onShowAll:k}),e[5]=r,e[6]=p):p=e[6];const j=o!==null||a;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=P=>{P||(y(null),c(!1))},e[7]=N):N=e[7];const S=o??void 0;let C;e[8]!==j||e[9]!==S?(C=s.jsx($e,{open:j,onOpenChange:N,initialProvider:S}),e[8]=j,e[9]=S,e[10]=C):C=e[10];let f;return e[11]!==p||e[12]!==C?(f=s.jsxs(s.Fragment,{children:[p,C]}),e[11]=p,e[12]=C,e[13]=f):f=e[13],f}let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-16 w-full"}),children:s.jsx(zt,{})}),e[14]=d):d=e[14];let m;e[15]!==l?(m=l?s.jsx(Gt,{}):s.jsx(Xt,{}),e[15]=l,e[16]=m):m=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ls,{onConnectClick:()=>c(!0)}),e[17]=u):u=e[17];let h;e[18]!==a?(h=s.jsx($e,{open:a,onOpenChange:c}),e[18]=a,e[19]=h):h=e[19];let g;return e[20]!==m||e[21]!==h?(g=s.jsxs(s.Fragment,{children:[d,m,u,h]}),e[20]=m,e[21]=h,e[22]=g):g=e[22],g}function ds(e){return e.providerId==="deco"}function ms(){const e=X.c(7),t=ne();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=s.jsx(Pe.Title,{children:i}),e[2]=i,e[3]=l):l=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(nt,{fallback:fs,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(cs,{})})}),e[4]=n):n=e[4];let a;return e[5]!==l?(a=s.jsx(Pe,{children:s.jsx(Pe.Content,{children:s.jsx(Pe.Body,{children:s.jsxs(ct,{children:[l,n]})})})}),e[5]=l,e[6]=a):a=e[6],a}function fs(e){const{error:t}=e;return s.jsx(as,{error:t??new Error("Failed to load AI providers")})}function vi(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Et,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ms,{})}),e[0]=t):t=e[0],t}export{vi as default};
1
+ import{W as se,X as I,a1 as Ae,a3 as we,a4 as Ue,a2 as He,a$ as Fe,c as X,b as ne,Y as ze,Z as qe,r as J,j as s,a5 as rt,t as ae,aw as Be,F as Ie,o as Ke,e as Se,K as oe,n as Le,m as Te,B as re,p as Ve,v as ot,E as nt}from"./index-tHM8NTfd.js";import{i as at}from"./AlertCircle-DevA0A1M.js";import{P as Pe}from"./index-D6fjxFLg.js";import{S as Me}from"./skeleton-CVx36MXd.js";import{b as Qe,a as Ee,S as Re,c as ct}from"./settings-section-B7sLcI44.js";import{u as Ce,b as Ne,i as dt,c as mt,p as ft,d as Ge}from"./use-ai-providers-COkTONXg.js";import{i as ut}from"./CheckCircle-ck8m-YN6.js";import{a as pt,f as gt}from"./use-organization-settings-D0V5wIDO.js";import{c as ht,d as Ye,P as xt,C as $e}from"./select-model-BjPHv_Dr.js";import{u as vt}from"./use-debounced-autosave-_O3PoKoh.js";import{I as De}from"./input-CtPcKTyA.js";import{T as Oe,a as yt}from"./toggle-group-CugvhNWb.js";import{c as We,d as Je,b as Xe,f as Ze,g as et,e as tt,a as st,A as it}from"./alert-dialog-B5UNzzAF.js";import{u as je}from"./studio-tools-DBJ4BlKP.js";import{s as bt}from"./Plus-D7R6BF5R.js";import{p as jt,f as St}from"./pt-BR-CLy76QW2.js";import{c as Ct}from"./Tool01-B14PZEqF.js";import{s as _t}from"./Trash01-DnjcslV5.js";import{A as kt}from"./avatar-6012j4NF.js";import{i as Pt}from"./Settings02-k_lwzmTv.js";import{s as Nt}from"./Eye-BqdZYqpI.js";import{b as Dt,a as It,d as Kt,e as wt,c as At}from"./dialog-D370feZI.js";import{S as Mt}from"./chat-context-4A5jyyEw.js";import{R as Et}from"./require-capability-B-Sqx0zT.js";import"./sidebar-DS29jp1e.js";import"./LayoutLeft-BzJLVhVQ.js";import"./use-mobile-B-9CWMAs.js";import"./X-DsJCvKBO.js";import"./tooltip-C4NGAgAM.js";import"./card-LK3SgMlx.js";import"./ArrowUpRight-Bay5EW8Z.js";import"./use-mcp-client-BAwn-0AV.js";import"./auth-Btre_1OW.js";import"./drawer-LhH6tqHN.js";import"./checkbox-C9Nq068Z.js";import"./Check-DN6IPn_3.js";import"./select-QOGEC2YQ.js";import"./ChevronDown-cZoWRgvb.js";import"./ChevronUp-CswOdRaR.js";import"./Key01-YwqEObkc.js";import"./SearchMd-B-lbf8c2.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-c_9oVNrI.js";import"./ChevronRight-CmrokxXJ.js";import"./connect-desktop-dialog-Dj9gRQkE.js";import"./Copy01-BGeJ_uJU.js";import"./Stars01-CAvqsR90.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-DQzbx1Xu.js";import"./tab-id-DLditg27.js";import"./hooks-DJ2YKeR9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CFz6l2VG.js";import"./use-virtual-mcp-DXStXtw1.js";import"./use-decopilot-events-DSmTv1gx.js";import"./use-capability-nY6kVL8r.js";import"./access-gate-BUe45Oc3.js";import"./capability-load-error-DXOesTij.js";se({title:I(),url:I(),icon:I()});se({registries:we(I(),se({enabled:Ue()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ae(I()).describe("List of MCP app_name or app_id values to hide from the store.")});const ce=se({keyId:I(),modelId:I(),title:I().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Rt=se({tiers:se({fast:ce,smart:ce,thinking:ce,image:ce,web_search:ce,deep_research:ce})});se({tiers:se({fast:ce.optional(),smart:ce.optional(),thinking:ce.optional()})});se({ids:Ae(I()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});se({id:I().describe("Brand context ID"),name:I().describe("Company name"),domain:I().describe("Company domain (e.g. example.com)"),overview:I().describe("Company overview / description"),logo:I().nullable().optional().describe("Logo URL"),favicon:I().nullable().optional().describe("Favicon URL"),ogImage:I().nullable().optional().describe("OG image URL"),fonts:se({heading:I().optional().describe("Font family for headings"),body:I().optional().describe("Font family for body text"),code:I().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:I().optional().describe("Primary brand color (hex)"),secondary:I().optional().describe("Secondary brand color (hex)"),accent:I().optional().describe("Accent / highlight color (hex)"),background:I().optional().describe("Background color (hex)"),foreground:I().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ae(we(I(),Fe())).nullable().optional().describe("Brand images"),metadata:we(I(),Fe()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:I().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ue().optional().describe("Whether this is the default brand for the organization")});const Ft=e=>e.capabilities?.includes("image")===!0,Tt=e=>dt(e),$t=e=>mt(e),Ot=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ft},{key:"web_search",filter:Tt},{key:"deep_research",filter:$t}];function Ut(e){const t=X.c(26),{slot:i,onSlotChange:l,filterModels:n,defaultKeyId:a}=e,c=Ce(),[o,y]=J.useState(i?.keyId??a);let _;t[0]!==i?(_=()=>{i?.keyId&&y(i.keyId)},t[0]=i,t[1]=_):_=t[1];const b=i?.keyId;let r;t[2]!==b?(r=[b],t[2]=b,t[3]=r):r=t[3],J.useEffect(_,r);const d=o??a;let m;t[4]!==d||t[5]!==c?(m=d?c.find(v=>v.id===d):null,t[4]=d,t[5]=c,t[6]=m):m=t[6];const u=m,{models:h,isLoading:g}=Ne(n?d??void 0:void 0),k=n?g||h.some(n):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const j=p,N=ne();if(n&&!k){let v;t[10]!==N?(v=N("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=N,t[11]=v):v=t[11];let K;return t[12]!==v?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:v}),t[12]=v,t[13]=K):K=t[13],K}let S;t[14]!==N?(S=N("settings.simpleModeSection.pickModel"),t[14]=N,t[15]=S):S=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=v=>y(v),t[16]=C):C=t[16];let f;t[17]!==d||t[18]!==l?(f=v=>{const K=v.keyId??d??"";y(K),l({keyId:K,modelId:v.modelId,title:v.title})},t[17]=d,t[18]=l,t[19]=f):f=t[19];let P;return t[20]!==d||t[21]!==n||t[22]!==j||t[23]!==S||t[24]!==f?(P=s.jsx(ht,{variant:"bordered",placeholder:S,model:j,credentialId:d,filterModels:n,onCredentialChange:C,onModelChange:f}),t[20]=d,t[21]=n,t[22]=j,t[23]=S,t[24]=f,t[25]=P):P=t[25],P}function Ht(e){const t=X.c(10),{isPending:i,showSaved:l}=e,n=ne();if(i){let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=a):a=t[0];let c;t[1]!==n?(c=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=c):c=t[2];let o;return t[3]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[3]=c,t[4]=o):o=t[4],o}if(l){let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ut,{size:12}),t[5]=a):a=t[5];let c;t[6]!==n?(c=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=c):c=t[7];let o;return t[8]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[8]=c,t[9]=o):o=t[9],o}return null}function zt(){const e=X.c(58),t=ne(),i=Ce(),l=pt(),n=i.length>0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ze(Rt),e[0]=a):a=e[0];let c;e[1]!==l?(c={resolver:a,values:l,mode:"onChange"},e[1]=l,e[2]=c):c=e[2];const o=qe(c),{mutate:y,isPending:_,isSuccess:b}=gt(),r=o.formState.isDirty;let d;e[3]!==o||e[4]!==l||e[5]!==t||e[6]!==y?(d={delayMs:250,save:async()=>{const x=o.getValues();y(x,{onSuccess:()=>o.reset(x,{keepValues:!0}),onError:A=>{o.reset(l),ae.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=l,e[5]=t,e[6]=y,e[7]=d):d=e[7];const{schedule:m}=vt(d),u=i[0],h=i[1],g=i[2],{models:k}=Ne(u?.id),{models:p}=Ne(h?.id),{models:j}=Ne(g?.id);let N,S;e[8]!==o||e[9]!==n?(N=()=>{n||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},S=[n,o],e[8]=o,e[9]=n,e[10]=N,e[11]=S):(N=e[10],S=e[11]),J.useEffect(N,S);let C;e[12]!==i||e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==g||e[17]!==k||e[18]!==p||e[19]!==j?(C=()=>{const x=o.getValues(),A=new Set(i.map(qt)),M={};u?.id&&(M[u.id]=k),h?.id&&(M[h.id]=p),g?.id&&(M[g.id]=j);const w=L=>L!=null&&!A.has(L.keyId),D={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},Y=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,W=D.fast===x.tiers.fast&&D.smart===x.tiers.smart&&D.thinking===x.tiers.thinking&&D.image===x.tiers.image&&D.web_search===x.tiers.web_search&&D.deep_research===x.tiers.deep_research;if(!Y&&W)return;const $=ft(i,M);o.reset({tiers:{fast:D.fast??$.chat.fast,smart:D.smart??$.chat.smart,thinking:D.thinking??$.chat.thinking,image:D.image??$.image,web_search:D.web_search??$.webSearch,deep_research:D.deep_research??$.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=o,e[14]=u,e[15]=h,e[16]=g,e[17]=k,e[18]=p,e[19]=j,e[20]=C):C=e[20];const f=u?.id,P=h?.id,v=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==p||e[25]!==j||e[26]!==f||e[27]!==P||e[28]!==v?(K=[o,i,k,p,j,f,P,v],e[21]=i,e[22]=o,e[23]=k,e[24]=p,e[25]=j,e[26]=f,e[27]=P,e[28]=v,e[29]=K):K=e[29],J.useEffect(C,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const B=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const Q=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let E;e[36]!==t?(E=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=E):E=e[37];let H;e[38]!==E?(H=s.jsx("p",{className:"text-sm text-muted-foreground",children:E}),e[38]=E,e[39]=H):H=e[39];const G=b&&!r;let z;e[40]!==_||e[41]!==G?(z=s.jsx(Ht,{isPending:_,showSaved:G}),e[40]=_,e[41]=G,e[42]=z):z=e[42];let R;e[43]!==H||e[44]!==z?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[H,z]}),e[43]=H,e[44]=z,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==Q||e[49]!==B||e[50]!==m?(F=Ot.map(x=>s.jsx(rt,{control:o.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:B(x.key),description:Q(x.key),action:s.jsx(Ut,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=Q,e[49]=B,e[50]=m,e[51]=F):F=e[51];let T;e[52]!==F?(T=s.jsx(Ee,{children:F}),e[52]=F,e[53]=T):T=e[53];let q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function qt(e){return e.id}const Bt={usd:[10,20,100],brl:[50,100,500]};function Lt(){const e=X.c(30),t=ne(),i=je(),[l,n]=J.useState(!1);let a;e[0]!==t?(a=f=>{ae.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:c,isPending:o}=Se({mutationFn:async f=>{const{url:P}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:d});return P},onSuccess:Vt,onError:a}),[y,_]=J.useState(""),[b,r]=J.useState("usd"),d=b,m=parseFloat(y),u=!isNaN(m)&&m>=1,h=d==="brl"?"R$":"$";let g;e[2]!==r?(g=f=>{f&&r(f)},e[2]=r,e[3]=g):g=e[3];let k,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Oe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=s.jsx(Oe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=p):(k=e[4],p=e[5]);let j;e[6]!==d||e[7]!==g?(j=s.jsxs(yt,{type:"single",variant:"outline",size:"default",value:d,onValueChange:g,children:[k,p]}),e[6]=d,e[7]=g,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==h||e[11]!==l||e[12]!==o||e[13]!==t||e[14]!==c?(N=!l&&s.jsxs(s.Fragment,{children:[Bt[d].map(f=>s.jsxs(re,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>c(f*100),children:[h,f]},f)),s.jsx(re,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=h,e[11]=l,e[12]=o,e[13]=t,e[14]=c,e[15]=N):N=e[15];let S;e[16]!==h||e[17]!==y||e[18]!==m||e[19]!==l||e[20]!==u||e[21]!==o||e[22]!==_||e[23]!==t||e[24]!==c?(S=l&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:h}),s.jsx(De,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:y,onChange:f=>_(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!u||o,onClick:()=>c(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(re,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=y,e[18]=m,e[19]=l,e[20]=u,e[21]=o,e[22]=_,e[23]=t,e[24]=c,e[25]=S):S=e[25];let C;return e[26]!==j||e[27]!==N||e[28]!==S?(C=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,N,S]})}),e[26]=j,e[27]=N,e[28]=S,e[29]=C):C=e[29],C}function Vt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Qt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Gt(){const e=X.c(121),t=ne(),{org:i}=Ie(),l=je(),n=Ke(),a=Ce();let c;e[0]!==a?(c=a.find(Yt),e[0]=a,e[1]=c):c=e[1];const o=c,[y,_]=J.useState(!1);let b;e[2]!==o||e[3]!==l?(b=async()=>{o&&await l.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=l,e[4]=b):b=e[4];let r;e[5]!==i.id||e[6]!==n||e[7]!==t?(r=()=>{n.invalidateQueries({queryKey:oe.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:oe.aiProviders(i.id)}),ae.success(t("settings.decoCreditsHero.disconnectSuccess")),_(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=r):r=e[8];let d;e[9]!==t?(d=lt=>{ae.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==b||e[12]!==r||e[13]!==d?(m={mutationFn:b,onSuccess:r,onError:d},e[11]=b,e[12]=r,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:h}=Se(m);let g;e[15]!==i.id?(g=oe.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let p;e[17]!==l?(p=async()=>{try{return await l.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=l,e[18]=p):p=e[18];let j;e[19]!==g||e[20]!==k||e[21]!==p?(j={queryKey:g,enabled:k,staleTime:6e4,queryFn:p},e[19]=g,e[20]=k,e[21]=p,e[22]=j):j=e[22];const{data:N,isLoading:S,refetch:C,isFetching:f}=Le(j);if(!o)return null;const P=N?.balanceCents!=null?N.balanceCents/100:null;let v;e[23]!==P?(v=P!=null?`$${P.toFixed(2)}`:"—",e[23]=P,e[24]=v):v=e[24];const K=v;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let B;e[27]!==t?(B=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=B):B=e[28];let O;e[29]!==B?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:B,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=B,e[30]=O):O=e[30];let Q;e[31]!==t?(Q=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=Q):Q=e[32];let U;e[33]!==Q?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:Q})}),e[33]=Q,e[34]=U):U=e[34];let E;e[35]!==O||e[36]!==U?(E=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=E):E=e[37];let H;e[38]===Symbol.for("react.memo_cache_sentinel")?(H=()=>_(!0),e[38]=H):H=e[38];let G;e[39]!==t?(G=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=G):G=e[40];let z;e[41]!==h||e[42]!==G?(z=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:H,disabled:h,children:G}),e[41]=h,e[42]=G,e[43]=z):z=e[43];let R;e[44]!==E||e[45]!==z?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[E,z]}),e[44]=E,e[45]=z,e[46]=R):R=e[46];let F;e[47]!==t?(F=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=F):F=e[48];let T;e[49]!==F?(T=s.jsx(We,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let D;e[62]!==u?(D=()=>u(),e[62]=u,e[63]=D):D=e[63];let Y;e[64]!==t?(Y=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=Y):Y=e[65];let W;e[66]!==D||e[67]!==Y?(W=s.jsx(et,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=D,e[67]=Y,e[68]=W):W=e[68];let $;e[69]!==w||e[70]!==W?($=s.jsxs(tt,{children:[w,W]}),e[69]=w,e[70]=W,e[71]=$):$=e[71];let L;e[72]!==A||e[73]!==$?(L=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=L):L=e[74];let Z;e[75]!==y||e[76]!==L?(Z=s.jsx(it,{open:y,onOpenChange:_,children:L}),e[75]=y,e[76]=L,e[77]=Z):Z=e[77];let ee;e[78]!==P||e[79]!==K||e[80]!==f||e[81]!==S?(ee=S||f?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",P!=null&&Qt(P)),children:K}),e[78]=P,e[79]=K,e[80]=f,e[81]=S,e[82]=ee):ee=e[82];let te;e[83]!==C?(te=()=>C(),e[83]=C,e[84]=te):te=e[84];let ie;e[85]!==t?(ie=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ie):ie=e[86];const de=f&&"animate-spin";let le;e[87]!==de?(le=Te(de),e[87]=de,e[88]=le):le=e[88];let me;e[89]!==le?(me=s.jsx(Be,{size:14,className:le}),e[89]=le,e[90]=me):me=e[90];let fe;e[91]!==f||e[92]!==te||e[93]!==ie||e[94]!==me?(fe=s.jsx("button",{type:"button",onClick:te,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ie,children:me}),e[91]=f,e[92]=te,e[93]=ie,e[94]=me,e[95]=fe):fe=e[95];let ue;e[96]!==ee||e[97]!==fe?(ue=s.jsxs("div",{className:"flex items-baseline gap-2",children:[ee,fe]}),e[96]=ee,e[97]=fe,e[98]=ue):ue=e[98];let pe;e[99]!==t?(pe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=pe):pe=e[100];let ge;e[101]!==pe?(ge=s.jsx("p",{className:"text-xs text-muted-foreground",children:pe}),e[101]=pe,e[102]=ge):ge=e[102];let he;e[103]!==ue||e[104]!==ge?(he=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ue,ge]}),e[103]=ue,e[104]=ge,e[105]=he):he=e[105];let xe;e[106]!==t?(xe=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=xe):xe=e[107];let ve;e[108]!==xe?(ve=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:xe}),e[108]=xe,e[109]=ve):ve=e[109];let _e;e[110]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(Lt,{}),e[110]=_e):_e=e[110];let ye;e[111]!==ve?(ye=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ve,_e]}),e[111]=ve,e[112]=ye):ye=e[112];let be;e[113]!==R||e[114]!==Z||e[115]!==he||e[116]!==ye?(be=s.jsx(Ee,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,Z,he,ye]})}),e[113]=R,e[114]=Z,e[115]=he,e[116]=ye,e[117]=be):be=e[117];let ke;return e[118]!==V||e[119]!==be?(ke=s.jsx(Re,{title:V,children:be}),e[118]=V,e[119]=be,e[120]=ke):ke=e[120],ke}function Yt(e){return e.providerId==="deco"}function Wt(){const e=X.c(8),{org:t}=Ie(),i=je(),l=Ke();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let a;e[2]!==t||e[3]!==l?(a=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),l.invalidateQueries({queryKey:oe.aiProviderKeys(t.id)}),l.invalidateQueries({queryKey:oe.aiProviders(t.id)}),ae.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==a?(c={mutationFn:n,onSuccess:a,onError:Jt},e[5]=n,e[6]=a,e[7]=c):c=e[7],Se(c)}function Jt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ae.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Xt(){const e=X.c(37),t=ne(),{mutate:i,isPending:l}=Wt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=a):a=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let o;e[4]!==c?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:c,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=c,e[5]=o):o=e[5];let y;e[6]!==t?(y=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=y):y=e[7];let _;e[8]!==y?(_=s.jsx("p",{className:"text-base font-semibold",children:y}),e[8]=y,e[9]=_):_=e[9];let b;e[10]!==t?(b=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=b):b=e[11];let r;e[12]!==b?(r=s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:b}),e[12]=b,e[13]=r):r=e[13];let d;e[14]!==_||e[15]!==r?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_,r]}),e[14]=_,e[15]=r,e[16]=d):d=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let u;e[19]!==m?(u=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=u):u=e[20];let h;e[21]!==u||e[22]!==d?(h=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=h):h=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==l||e[27]!==t?(k=t(l?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=l,e[27]=t,e[28]=k):k=e[28];let p;e[29]!==l||e[30]!==g||e[31]!==k?(p=s.jsx(re,{variant:"outline",disabled:l,onClick:g,children:k}),e[29]=l,e[30]=g,e[31]=k,e[32]=p):p=e[32];let j;return e[33]!==h||e[34]!==p||e[35]!==o?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[a,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,h,p]})]}),e[33]=h,e[34]=p,e[35]=o,e[36]=j):j=e[36],j}const Zt=e=>se({label:I().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:I().optional(),baseUrl:I().optional()});function es({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:l}){return e&&!!t&&t!==i&&!l}function ts({providerKey:e,provider:t,preset:i,maskedKey:l,currentLabel:n,currentBaseUrl:a,onCancel:c,onSuccess:o}){const{org:y}=Ie(),_=je(),b=Ke(),r=ne(),[d,m]=J.useState(!1),u=t.id==="openai-compatible",h=t.supportedMethods.includes("api-key"),g=Zt(r),{register:k,handleSubmit:p,watch:j,setError:N,formState:{errors:S}}=qe({resolver:ze(g),defaultValues:{label:n,apiKey:"",baseUrl:a??""}}),C=j("apiKey")??"",{mutate:f,isPending:P}=Se({mutationFn:async v=>{let K;v.apiKey&&(u?K=JSON.stringify({baseUrl:v.baseUrl||a||"",apiKey:v.apiKey}):K=v.apiKey),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:v.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{b.invalidateQueries({queryKey:oe.aiProviderKeys(y.id)}),b.invalidateQueries({queryKey:oe.aiProviders(y.id)}),ae.success(r("settings.editProviderDialog.providerUpdated")),o()},onError:v=>ae.error(r("settings.editProviderDialog.failedToUpdate",{error:v.message}))});return s.jsxs("form",{onSubmit:p(v=>{if(es({isOpenAICompatible:u,baseUrl:v.baseUrl,currentBaseUrl:a,apiKey:v.apiKey})){N("apiKey",{message:r("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}f(v)}),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.label")}),s.jsx(De,{placeholder:r("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),S.label&&s.jsx("p",{className:"text-xs text-destructive",children:S.label.message})]}),u&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.baseUrl")}),s.jsx(De,{type:"url",placeholder:i?.baseUrlPlaceholder??r("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),h&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[r("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",r("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(De,{type:d&&C?"text":"password",placeholder:l,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),C&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":r(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Pt,{size:14}):s.jsx(Nt,{size:14})})]}),S.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(At,{children:[s.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:P,children:r("settings.editProviderDialog.cancel")}),s.jsx(re,{type:"submit",size:"sm",disabled:P,children:r(P?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ss(e){const t=X.c(31),{providerKey:i,provider:l,open:n,onOpenChange:a}=e,c=ne(),o=je(),y=l.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,_=y?.name??l.name;let b;t[0]!==i.id?(b=oe.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=b):b=t[1];let r;t[2]!==i.id||t[3]!==o?(r=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=r):r=t[4];let d;t[5]!==n||t[6]!==b||t[7]!==r?(d={queryKey:b,queryFn:r,enabled:n,staleTime:0},t[5]=n,t[6]=b,t[7]=r,t[8]=d):d=t[8];const{data:m,isLoading:u}=Le(d),h=wt,g=Kt,k="sm:max-w-md",p=It,j=Dt,N=c("settings.editProviderDialog.editTitle",{name:_});let S;t[9]!==j||t[10]!==N?(S=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=S):S=t[11];let C;t[12]!==p||t[13]!==S?(C=s.jsx(p,{children:S}),t[12]=p,t[13]=S,t[14]=C):C=t[14];let f;t[15]!==u||t[16]!==a||t[17]!==y||t[18]!==m||t[19]!==l||t[20]!==i?(f=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Mt,{})}):s.jsx(ts,{providerKey:i,provider:l,preset:y,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[15]=u,t[16]=a,t[17]=y,t[18]=m,t[19]=l,t[20]=i,t[21]=f):f=t[21];let P;t[22]!==g||t[23]!==C||t[24]!==f?(P=s.jsxs(g,{className:k,children:[C,f]}),t[22]=g,t[23]=C,t[24]=f,t[25]=P):P=t[25];let v;return t[26]!==h||t[27]!==a||t[28]!==n||t[29]!==P?(v=s.jsx(h,{open:n,onOpenChange:a,children:P}),t[26]=h,t[27]=a,t[28]=n,t[29]=P,t[30]=v):v=t[30],v}function is(e){const t=X.c(86),{providerKey:i,provider:l}=e,{org:n}=Ie(),a=je(),c=Ke(),[o,y]=J.useState(!1),[_,b]=J.useState(!1),r=ne(),[d]=ot(),m=d.language==="pt-BR"?jt:void 0,u=l.id==="openai-compatible";let h;t[0]!==u||t[1]!==i.presetId?(h=u&&i.presetId?Ye(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=h):h=t[2];const g=h;let k;t[3]!==u||t[4]!==g||t[5]!==l.name||t[6]!==r?(k=g?g.name:u?r("settings.aiProviders.customOpenAiCompatible"):l.name,t[3]=u,t[4]=g,t[5]=l.name,t[6]=r,t[7]=k):k=t[7];const p=k,j=g?.logo??l.logo;let N;e:{if(u){N=i.label;break e}const de=i.label;let le;t[8]!==m||t[9]!==i.createdAt?(le=St(new Date(i.createdAt),{locale:m}),t[8]=m,t[9]=i.createdAt,t[10]=le):le=t[10],N=`${de} · added ${le} ago`}const S=N;let C;t[11]!==i.id||t[12]!==a?(C=async()=>{await a.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[11]=i.id,t[12]=a,t[13]=C):C=t[13];let f;t[14]!==n||t[15]!==i.id||t[16]!==c||t[17]!==r?(f=()=>{c.invalidateQueries({queryKey:oe.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:oe.aiProviders(n.id)}),c.invalidateQueries({queryKey:oe.aiProviderModels(n.id,i.id)}),ae.success(r("settings.providerKeyRow.keyDeleted")),y(!1)},t[14]=n,t[15]=i.id,t[16]=c,t[17]=r,t[18]=f):f=t[18];let P;t[19]!==r?(P=de=>ae.error(r("settings.providerKeyRow.failedToDeleteKey",{error:de.message})),t[19]=r,t[20]=P):P=t[20];let v;t[21]!==C||t[22]!==f||t[23]!==P?(v={mutationFn:C,onSuccess:f,onError:P},t[21]=C,t[22]=f,t[23]=P,t[24]=v):v=t[24];const{mutate:K,isPending:V}=Se(v);let B;t[25]!==p||t[26]!==j?(B=j?s.jsx("img",{src:j,alt:p,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(kt,{fallback:p.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[25]=p,t[26]=j,t[27]=B):B=t[27];let O;t[28]!==r?(O=r("settings.providerKeyRow.editProviderKey"),t[28]=r,t[29]=O):O=t[29];let Q,U;t[30]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>b(!0),U=s.jsx(Ct,{size:14}),t[30]=Q,t[31]=U):(Q=t[30],U=t[31]);let E;t[32]!==O?(E=s.jsx(re,{variant:"ghost",size:"icon","aria-label":O,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Q,children:U}),t[32]=O,t[33]=E):E=t[33];let H;t[34]!==r?(H=r("settings.providerKeyRow.deleteProviderKey"),t[34]=r,t[35]=H):H=t[35];let G,z;t[36]===Symbol.for("react.memo_cache_sentinel")?(G=()=>y(!0),z=s.jsx(_t,{size:14}),t[36]=G,t[37]=z):(G=t[36],z=t[37]);let R;t[38]!==V||t[39]!==H?(R=s.jsx(re,{variant:"ghost",size:"icon","aria-label":H,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:V,onClick:G,children:z}),t[38]=V,t[39]=H,t[40]=R):R=t[40];let F;t[41]!==E||t[42]!==R?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[E,R]}),t[41]=E,t[42]=R,t[43]=F):F=t[43];let T;t[44]!==S||t[45]!==p||t[46]!==F||t[47]!==B?(T=s.jsx(Qe,{icon:B,title:p,description:S,action:F}),t[44]=S,t[45]=p,t[46]=F,t[47]=B,t[48]=T):T=t[48];let q;t[49]!==_||t[50]!==l||t[51]!==i?(q=s.jsx(ss,{providerKey:i,provider:l,open:_,onOpenChange:b}),t[49]=_,t[50]=l,t[51]=i,t[52]=q):q=t[52];let x;t[53]!==r?(x=r("settings.providerKeyRow.deleteApiKey"),t[53]=r,t[54]=x):x=t[54];let A;t[55]!==x?(A=s.jsx(We,{children:x}),t[55]=x,t[56]=A):A=t[56];let M;t[57]!==i.label?(M=s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=M):M=t[58];let w;t[59]!==A||t[60]!==M?(w=s.jsxs(Xe,{children:[A,M]}),t[59]=A,t[60]=M,t[61]=w):w=t[61];let D;t[62]!==r?(D=r("settings.providerKeyRow.cancel"),t[62]=r,t[63]=D):D=t[63];let Y;t[64]!==D?(Y=s.jsx(Ze,{children:D}),t[64]=D,t[65]=Y):Y=t[65];let W;t[66]!==K?(W=()=>K(),t[66]=K,t[67]=W):W=t[67];let $;t[68]!==r?($=r("settings.providerKeyRow.delete"),t[68]=r,t[69]=$):$=t[69];let L;t[70]!==W||t[71]!==$?(L=s.jsx(et,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$}),t[70]=W,t[71]=$,t[72]=L):L=t[72];let Z;t[73]!==Y||t[74]!==L?(Z=s.jsxs(tt,{children:[Y,L]}),t[73]=Y,t[74]=L,t[75]=Z):Z=t[75];let ee;t[76]!==w||t[77]!==Z?(ee=s.jsxs(st,{children:[w,Z]}),t[76]=w,t[77]=Z,t[78]=ee):ee=t[78];let te;t[79]!==o||t[80]!==ee?(te=s.jsx(it,{open:o,onOpenChange:y,children:ee}),t[79]=o,t[80]=ee,t[81]=te):te=t[81];let ie;return t[82]!==T||t[83]!==q||t[84]!==te?(ie=s.jsxs(s.Fragment,{children:[T,q,te]}),t[82]=T,t[83]=q,t[84]=te,t[85]=ie):ie=t[85],ie}function ls(e){const t=X.c(17),{onConnectClick:i}=e,l=ne(),n=Ce(),a=Ge();let c;t[0]!==a?.providers?(c=a?.providers??[],t[0]=a?.providers,t[1]=c):c=t[1];const o=c;let y;if(t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==l){let _;t[7]!==o?(_=h=>({key:h,provider:o.find(g=>g.id===h.providerId)}),t[7]=o,t[8]=_):_=t[8];const b=n.filter(ns).map(_).filter(os);let r;t[9]!==l?(r=l("settings.connectedProvidersSection.sectionTitle"),t[9]=l,t[10]=r):r=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(bt,{size:14}),t[11]=d):d=t[11];let m;t[12]!==l?(m=l("settings.connectedProvidersSection.connectButton"),t[12]=l,t[13]=m):m=t[13];let u;t[14]!==i||t[15]!==m?(u=s.jsxs(re,{size:"sm",onClick:i,children:[d,m]}),t[14]=i,t[15]=m,t[16]=u):u=t[16],y=s.jsx(Re,{title:r,headerClassName:"px-0",actions:u,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:l("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:b.map(rs)})}),t[2]=n,t[3]=i,t[4]=o,t[5]=l,t[6]=y}else y=t[6];return y}function rs(e){const{key:t,provider:i}=e;return s.jsx(is,{providerKey:t,provider:i},t.id)}function os(e){return e.provider!==void 0}function ns(e){return e.providerId!=="deco"}function as(e){const t=X.c(3),{error:i}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(at,{size:16}),t[0]=l):l=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function cs(){const e=X.c(23),t=Ce();let i;e[0]!==t?(i=t.some(ds),e[0]=t,e[1]=i):i=e[1];const l=i,n=t.length>0,[a,c]=J.useState(!1),[o,y]=J.useState(null),_=Ge();let b;e[2]!==_?.providers?(b=_?.providers??[],e[2]=_?.providers,e[3]=b):b=e[3];const r=b;if(!n){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),e[4]=k):k=e[4];let p;e[5]!==r?(p=s.jsx(xt,{providers:r,onSelect:y,onShowAll:k}),e[5]=r,e[6]=p):p=e[6];const j=o!==null||a;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=P=>{P||(y(null),c(!1))},e[7]=N):N=e[7];const S=o??void 0;let C;e[8]!==j||e[9]!==S?(C=s.jsx($e,{open:j,onOpenChange:N,initialProvider:S}),e[8]=j,e[9]=S,e[10]=C):C=e[10];let f;return e[11]!==p||e[12]!==C?(f=s.jsxs(s.Fragment,{children:[p,C]}),e[11]=p,e[12]=C,e[13]=f):f=e[13],f}let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-16 w-full"}),children:s.jsx(zt,{})}),e[14]=d):d=e[14];let m;e[15]!==l?(m=l?s.jsx(Gt,{}):s.jsx(Xt,{}),e[15]=l,e[16]=m):m=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ls,{onConnectClick:()=>c(!0)}),e[17]=u):u=e[17];let h;e[18]!==a?(h=s.jsx($e,{open:a,onOpenChange:c}),e[18]=a,e[19]=h):h=e[19];let g;return e[20]!==m||e[21]!==h?(g=s.jsxs(s.Fragment,{children:[d,m,u,h]}),e[20]=m,e[21]=h,e[22]=g):g=e[22],g}function ds(e){return e.providerId==="deco"}function ms(){const e=X.c(7),t=ne();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=s.jsx(Pe.Title,{children:i}),e[2]=i,e[3]=l):l=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(nt,{fallback:fs,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(cs,{})})}),e[4]=n):n=e[4];let a;return e[5]!==l?(a=s.jsx(Pe,{children:s.jsx(Pe.Content,{children:s.jsx(Pe.Body,{children:s.jsxs(ct,{children:[l,n]})})})}),e[5]=l,e[6]=a):a=e[6],a}function fs(e){const{error:t}=e;return s.jsx(as,{error:t??new Error("Failed to load AI providers")})}function vi(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Et,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ms,{})}),e[0]=t):t=e[0],t}export{vi as default};
@@ -1 +1 @@
1
- import{c as n,m as o,j as c,bt as d}from"./index-DnHWblfu.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
1
+ import{c as n,m as o,j as c,bt as d}from"./index-tHM8NTfd.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
@@ -1,4 +1,4 @@
1
- import{r as i,j as r,cI as T,cK as w,aC as m,cM as A,dS as O,H as M,aE as I,cJ as L,dT as D,cL as z,cU as F,aA as G,cW as H,cN as W,c as n,m as p,bL as v}from"./index-DnHWblfu.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",Y=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});Y.displayName=V;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=q;var B="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(W,{...o,...a,ref:e})});_.displayName=B;var f="AlertDialogContent",[J,K]=k(f),U=F("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(U,{children:a}),r.jsx(X,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});C.displayName=E;var Q="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=Q;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{r as i,j as r,cI as T,cK as w,aC as m,cM as A,dS as O,H as M,aE as I,cJ as L,dT as D,cL as z,cU as F,aA as G,cW as H,cN as W,c as n,m as p,bL as v}from"./index-tHM8NTfd.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",Y=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});Y.displayName=V;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=q;var B="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(W,{...o,...a,ref:e})});_.displayName=B;var f="AlertDialogContent",[J,K]=k(f),U=F("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(U,{children:a}),r.jsx(X,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});C.displayName=E;var Q="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=Q;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var X=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
3
  You can add a description to the \`${f}\` by passing a \`${E}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
@@ -1 +1 @@
1
- import{c as gt,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-DnHWblfu.js";import{i as jt}from"./ChevronRight-C4GCxTzK.js";import{n as Bt}from"./automation-runs-B0tfP751.js";import{A as At}from"./add-section-modal-CtCNzcu7.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-BPUDtemx.js";import"./select-g0E4j9Tt.js";import"./tooltip-44-2qw6b.js";import"./Check-BQap7Cpe.js";import"./ChevronDown-BNTAvoWs.js";import"./ChevronUp-CMJpp_7f.js";import"./useInfiniteQuery-BuKAKdDO.js";import"./use-infinite-scroll-68HpgFc8.js";import"./use-connection-DNsAtxSX.js";import"./use-mcp-client-BG7zveIM.js";import"./auth-CjPDmXKg.js";import"./use-virtual-mcp-D6qbeGCA.js";import"./card-CpyAPk4W.js";import"./sidebar-DCTvELfP.js";import"./LayoutLeft-DAco-6YX.js";import"./use-mobile-ChN0uU-Y.js";import"./X-BZ-Qrql-.js";import"./table-CLLWCOW2.js";import"./empty-state-BTI0jRLN.js";import"./use-members-UKyPZaKn.js";import"./use-org-auth-client-XykIzcR9.js";import"./use-clock-tick-CF-fW2XN.js";import"./AlertCircle-XYVipozu.js";import"./CheckCircle-CpszjLbT.js";import"./DotsVertical-DtxqOkQ-.js";import"./agent-icon-DRGNhHDy.js";import"./Tool01-DgbxCa0X.js";import"./ArrowUp-l-QJZJVq.js";import"./Settings02-kFO_alvx.js";import"./Tool02-C2mcM2YH.js";import"./ArrowRight-BwYEG81b.js";import"./ArrowUpRight-Dzxf-lpo.js";import"./TrendUp01-UqSus9sN.js";import"./ZapSquare-C8CgHzT1.js";import"./Users03-Da6s5Xm-.js";import"./Stars02-DW1aL9Gv.js";import"./Copy01-D_SKj3JY.js";import"./Eye-DDei6OvA.js";import"./FilterLines-CdZmlIa2.js";import"./Star01-CS45XDsX.js";import"./Palette-Dr6-9ADN.js";import"./SwitchHorizontal01-DRF2ZDDF.js";import"./HardDrive-D5AmniWG.js";import"./Key01-BTOQ7Hsi.js";import"./XCircle-CrKimoYU.js";import"./LinkExternal01-BAWgpdxG.js";import"./LogOut01-N3kqZQ5B.js";import"./Monitor01--AULmP_e.js";import"./Sun-1O9WSrfQ.js";import"./Play-CwRG1pgT.js";import"./Plus-Dc9c0aJB.js";import"./SearchLg-CI2UWBkb.js";import"./SearchMd-BnuXOyI2.js";import"./Shield01-BltVbqU-.js";import"./Stars01-DkHEjXrS.js";import"./Trash01-i0AMIXBp.js";import"./Upload01-DdttVKpO.js";import"./User01-BcNtSYpD.js";import"./Users01-Dqmzv5Fm.js";import"./XClose-BHqSO9Fx.js";import"./Zap-Bf6OTD9_.js";import"./use-automations-DOYrLfym.js";import"./studio-tools-1de_48yn.js";import"./useSuspenseInfiniteQuery-n2PIbfd5.js";import"./avatar-ABBG4Zys.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DVkJpNIE.js";import"./dialog-DgVuLqhS.js";import"./tab-id-Ckd-ZAMH.js";import"./hooks-CSzZamSr.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CSHbnCTw.js";import"./chat-context-BrrGaGbH.js";import"./use-ai-providers-CuhkQheE.js";import"./use-decopilot-events-JMTJZeEq.js";import"./use-organization-settings-Bbc0ktBM.js";import"./monaco-editor-CB-Jx900.js";import"./index-D_hlfh5m.js";import"./calendar-BId5Ov_D.js";import"./shell-layout-BBtwtRs8.js";import"./required-auth-layout-CPjb3C6W.js";import"./use-org-sso-C30Nyt4K.js";import"./integration-icon-Buz6Jy4-.js";import"./use-navigate-to-agent-_n3ZB1G-.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-DxhXVk5N.js";import"./form-BSs_Wcc9.js";import"./label-vQvzd2f4.js";import"./input-BKgQbLb7.js";import"./drawer-BAKGed9i.js";import"./collection-search-BXUxGpkT.js";import"./index-CN6o24P1.js";import"./get-initials-D-f_fDFw.js";import"./popover-CVp_epYO.js";import"./use-registry-app-D6fcGueu.js";import"./use-mcp-tools-DjATUgKD.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-CMEBdT9l.js";import"./mcp-oauth-DdhiCVGm.js";import"./extract-connection-data-y9r-PxK0.js";import"./metadata-dUsYcpuu.js";import"./dropdown-menu-X5GaQfkB.js";import"./command-p71imMWZ.js";import"./index-R7we9WNO.js";import"./companions-core-BqqXlbWe.js";import"./tabs-D4j_u8lp.js";import"./toggle-group-BQ95Mzlw.js";import"./use-deco-credits-nxiVRyXd.js";import"./alert-dialog-vMeKz1oj.js";import"./toolbar-n9I75ths.js";import"./skeleton-CQ4Si4tx.js";import"./github-repo-picker-BcZWgRSG.js";import"./use-debounced-value-DOFpGJrU.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./connection-card-BNd9VNGL.js";import"./use-registry-connections-CqQgIUl7.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-CDJ9hAiD.js";import"./connection-form-helpers-BRVXGHSF.js";import"./collection-tabs-CrFDWpQo.js";import"./badge-DHX2ckQi.js";import"./connect-desktop-dialog-CpDi9jEG.js";import"./select-model-RA4tH7cK.js";import"./checkbox-Dyd2bOG3.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-DysjSOio.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-u5bruqG0.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-ZuDMV8i_.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-BW-U_Pa6.js";import"./use-debounced-autosave-rKGkta2N.js";import"./index-rNfPhyEe.js";import"./search-input-BsjySTQb.js";import"./switch-BTk8KHX6.js";import"./use-secrets-C8uvAtFz.js";import"./useQueries-BkQg5qxY.js";import"./use-file-configs-BLfsI3Gb.js";import"./automation-list-row-a4o0Za57.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Br(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:m,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,s=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==m||t[2]!==b?(R=Et(b,m,G),t[0]=G,t[1]=m,t[2]=b,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==m||t[9]!==Z?(K=Z??(c?Nt(i,c,m):i),t[6]=c,t[7]=i,t[8]=m,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const mt=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==mt||t[27]!==g?(I={...mt,...g},t[26]=mt,t[27]=g,t[28]=I):I=t[28];const st=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==s?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(s("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:s("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=s,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==s||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":s("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[45]=a,t[46]=E,t[47]=s,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==st||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==m||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==s?(B=o.jsx(Bt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:Q?o.jsx(Tt,{schema:h,value:st,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:m,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),s("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=st,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=m,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=s,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==m||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:m,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=m,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{Br as AppEditor};
1
+ import{c as gt,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-tHM8NTfd.js";import{i as jt}from"./ChevronRight-CmrokxXJ.js";import{n as Bt}from"./automation-runs-D_CI6v6C.js";import{A as At}from"./add-section-modal-Cj4WcLQN.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-B6pbxJBU.js";import"./select-QOGEC2YQ.js";import"./tooltip-C4NGAgAM.js";import"./Check-DN6IPn_3.js";import"./ChevronDown-cZoWRgvb.js";import"./ChevronUp-CswOdRaR.js";import"./useInfiniteQuery-DAxuc5L-.js";import"./use-infinite-scroll-DFYxMuWT.js";import"./use-connection-uKN5YWIx.js";import"./use-mcp-client-BAwn-0AV.js";import"./auth-Btre_1OW.js";import"./use-virtual-mcp-DXStXtw1.js";import"./card-LK3SgMlx.js";import"./sidebar-DS29jp1e.js";import"./LayoutLeft-BzJLVhVQ.js";import"./use-mobile-B-9CWMAs.js";import"./X-DsJCvKBO.js";import"./table-DunMqZev.js";import"./empty-state-Cj1VbJ0y.js";import"./use-members-C_p-7j4-.js";import"./use-org-auth-client-GW_RbwIG.js";import"./use-clock-tick-GBpMaXwL.js";import"./AlertCircle-DevA0A1M.js";import"./CheckCircle-ck8m-YN6.js";import"./DotsVertical-Db5Rriwt.js";import"./agent-icon-DW-jknHC.js";import"./Tool01-B14PZEqF.js";import"./ArrowUp-CLXut3hx.js";import"./Settings02-k_lwzmTv.js";import"./Tool02-C-4pjcCY.js";import"./ArrowRight-Dq4C6lJ4.js";import"./ArrowUpRight-Bay5EW8Z.js";import"./TrendUp01-BVE2-KuE.js";import"./ZapSquare-DpSSWmnE.js";import"./Users03-C-mvAxcs.js";import"./Stars02-Djd7mUzA.js";import"./Copy01-BGeJ_uJU.js";import"./Eye-BqdZYqpI.js";import"./FilterLines-BFxvHa0q.js";import"./Star01-Bv8b5o6W.js";import"./Palette-CgoT-TdN.js";import"./SwitchHorizontal01-C9T_FryU.js";import"./HardDrive-C1-SCHTe.js";import"./Key01-YwqEObkc.js";import"./XCircle-Eu9CNvjp.js";import"./LinkExternal01-Dv9Aj-K0.js";import"./LogOut01-D1zBEUWi.js";import"./Monitor01-c_9oVNrI.js";import"./Sun-DZlLfVSj.js";import"./Play-DY15eh3c.js";import"./Plus-D7R6BF5R.js";import"./SearchLg-B1avg8bD.js";import"./SearchMd-B-lbf8c2.js";import"./Shield01-DFBgcYa0.js";import"./Stars01-CAvqsR90.js";import"./Trash01-DnjcslV5.js";import"./Upload01-uhey7zjg.js";import"./User01-DQzbx1Xu.js";import"./Users01-Ct4A_zsW.js";import"./XClose-BcWYJ3jm.js";import"./Zap-BiPzgNTf.js";import"./use-automations-RGeim-7x.js";import"./studio-tools-DBJ4BlKP.js";import"./useSuspenseInfiniteQuery-BwVy3QbN.js";import"./avatar-6012j4NF.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-EWLYbeWi.js";import"./dialog-D370feZI.js";import"./tab-id-DLditg27.js";import"./hooks-DJ2YKeR9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CFz6l2VG.js";import"./chat-context-4A5jyyEw.js";import"./use-ai-providers-COkTONXg.js";import"./use-decopilot-events-DSmTv1gx.js";import"./use-organization-settings-D0V5wIDO.js";import"./monaco-editor-AliIqm4c.js";import"./index-Dx1y19yx.js";import"./calendar-MyVXyluP.js";import"./shell-layout-DjpBxe62.js";import"./required-auth-layout-C91T3YkY.js";import"./use-org-sso-C5GowRh9.js";import"./integration-icon-C-2mN9ni.js";import"./use-navigate-to-agent-DEAiy9mr.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-BWfAq2gc.js";import"./form-Dj_8GoDc.js";import"./label-Dx1_DE-f.js";import"./input-CtPcKTyA.js";import"./drawer-LhH6tqHN.js";import"./collection-search-C63j6Zzd.js";import"./index-DLoS2Gvr.js";import"./get-initials-D-f_fDFw.js";import"./popover-C3OgPzQD.js";import"./use-registry-app-D8hx17d1.js";import"./use-mcp-tools-CgtI4_xz.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-DMOmyFRT.js";import"./mcp-oauth-Ch4TwOlY.js";import"./extract-connection-data-C8zhfgGc.js";import"./metadata-dUsYcpuu.js";import"./dropdown-menu-DBsO6utH.js";import"./command-DtoG6f_9.js";import"./index-CZWx2CTD.js";import"./companions-core-RUJyQPUT.js";import"./tabs-DXpVtqDW.js";import"./toggle-group-CugvhNWb.js";import"./use-deco-credits-ClFjXcZg.js";import"./alert-dialog-B5UNzzAF.js";import"./toolbar-dY2heqgV.js";import"./skeleton-CVx36MXd.js";import"./github-repo-picker-CeuXOkGP.js";import"./use-debounced-value-DuOUoSmu.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./connection-card-BoF_KE8y.js";import"./use-registry-connections-o8h37zTy.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-hljn8moZ.js";import"./connection-form-helpers-DB9ro8Ha.js";import"./collection-tabs-C_e51TYz.js";import"./badge-kM5UAKst.js";import"./connect-desktop-dialog-Dj9gRQkE.js";import"./select-model-BjPHv_Dr.js";import"./checkbox-C9Nq068Z.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B7sLcI44.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DZIf-G4r.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-nY6kVL8r.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-Bbnk5NX6.js";import"./use-debounced-autosave-_O3PoKoh.js";import"./index-D6fjxFLg.js";import"./search-input-C_HmTn9N.js";import"./switch-BAMPQcFC.js";import"./use-secrets-C-31Hjoh.js";import"./useQueries-Dk_rR620.js";import"./use-file-configs-Bgb80job.js";import"./automation-list-row-C0qxtH51.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Br(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:m,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,s=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==m||t[2]!==b?(R=Et(b,m,G),t[0]=G,t[1]=m,t[2]=b,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==m||t[9]!==Z?(K=Z??(c?Nt(i,c,m):i),t[6]=c,t[7]=i,t[8]=m,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const mt=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==mt||t[27]!==g?(I={...mt,...g},t[26]=mt,t[27]=g,t[28]=I):I=t[28];const st=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==s?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(s("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:s("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=s,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==s||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":s("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[45]=a,t[46]=E,t[47]=s,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==st||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==m||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==s?(B=o.jsx(Bt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:Q?o.jsx(Tt,{schema:h,value:st,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:m,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),s("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=st,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=m,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=s,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==m||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:m,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=m,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{Br as AppEditor};
@@ -1 +1 @@
1
- import{cq as I,cr as $,cs as W,ct as L,cu as H,cv as D,cw as x,cx as V,cy as q,cz as j,cA as y,cB as N,cC as B,cD as Z,cE as F}from"./index-DnHWblfu.js";function G(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function J({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(i)}class pe extends Error{constructor(t){super(t??"Unauthorized")}}function Y(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function K(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&Y(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function Q(e,t,n,r){const{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":X(a,i,n);return;case"client_secret_post":ee(a,i,r);return;case"none":te(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function X(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function ee(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function te(e,t){t.set("client_id",e)}async function M(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=N.parse(JSON.parse(n)),{error:a,error_description:i,error_uri:s}=r,o=B[a]||y;return new o(i||"",s)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new y(a)}}async function _e(e,t){try{return await U(e,t)}catch(n){if(n instanceof H||n instanceof D)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof x)return await e.invalidateCredentials?.("tokens"),await U(e,t);throw n}}async function U(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:i}){const s=await e.discoveryState?.();let o,c,u,h=a;if(!h&&s?.resourceMetadataUrl&&(h=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(c=s.authorizationServerUrl,o=s.resourceMetadata,u=s.authorizationServerMetadata??await P(c,{fetchFn:i}),!o)try{o=await T(t,{resourceMetadataUrl:h},i)}catch{}(u!==s.authorizationServerMetadata||o!==s.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}else{const l=await ce(t,{resourceMetadataUrl:h,fetchFn:i});c=l.authorizationServerUrl,u=l.authorizationServerMetadata,o=l.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}const f=await re(t,e,o),A=r||o?.scopes_supported?.join(" ")||e.clientMetadata.scope;let d=await Promise.resolve(e.clientInformation());if(!d){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const l=u?.client_id_metadata_document_supported===!0,w=e.clientMetadataUrl;if(w&&!ne(w))throw new q(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${w}`);if(l&&w)d={client_id:w},await e.saveClientInformation?.(d);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(S),d=S}}const O=!e.redirectUrl;if(n!==void 0||O){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const k=await e.tokens();if(k?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:k.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}catch(l){if(!(!(l instanceof j)||l instanceof y))throw l}const z=e.state?await e.state():void 0,{authorizationUrl:b,codeVerifier:v}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(b),"REDIRECT"}function ne(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function re(e,t,n){const r=G(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!J({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Ue(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=m(e,"resource_metadata")||void 0;let i;if(a)try{i=new URL(a)}catch{}const s=m(e,"scope")||void 0,o=m(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:o}}function m(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function T(e,t,n=fetch){const r=await ie(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await r.body?.cancel(),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return I.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await F(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function C(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function g(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:s}){const o=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),a)await a(c,n,o,t);else if(r){const h=t?.token_endpoint_auth_methods_supported??[],f=K(r,h);Q(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return V.parse(await u.json())}async function me(e,{metadata:t,clientInformation:n,authorizationCode:r,codeVerifier:a,redirectUri:i,resource:s,addClientAuthentication:o,fetchFn:c}){const u=C(r,a,i);return g(e,{metadata:t,tokenRequestParams:u,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:c})}async function le(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:i,fetchFn:s}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),c=await g(e,{metadata:t,tokenRequestParams:o,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:s});return{refresh_token:r,...c}}async function he(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:i}={}){const s=e.clientMetadata.scope;let o;if(e.prepareTokenRequest&&(o=await e.prepareTokenRequest(s)),!o){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();o=C(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return Z.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
1
+ import{cq as I,cr as $,cs as W,ct as L,cu as H,cv as D,cw as x,cx as V,cy as q,cz as j,cA as y,cB as N,cC as B,cD as Z,cE as F}from"./index-tHM8NTfd.js";function G(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function J({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(i)}class pe extends Error{constructor(t){super(t??"Unauthorized")}}function Y(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function K(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&Y(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function Q(e,t,n,r){const{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":X(a,i,n);return;case"client_secret_post":ee(a,i,r);return;case"none":te(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function X(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function ee(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function te(e,t){t.set("client_id",e)}async function M(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=N.parse(JSON.parse(n)),{error:a,error_description:i,error_uri:s}=r,o=B[a]||y;return new o(i||"",s)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new y(a)}}async function _e(e,t){try{return await U(e,t)}catch(n){if(n instanceof H||n instanceof D)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof x)return await e.invalidateCredentials?.("tokens"),await U(e,t);throw n}}async function U(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:i}){const s=await e.discoveryState?.();let o,c,u,h=a;if(!h&&s?.resourceMetadataUrl&&(h=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(c=s.authorizationServerUrl,o=s.resourceMetadata,u=s.authorizationServerMetadata??await P(c,{fetchFn:i}),!o)try{o=await T(t,{resourceMetadataUrl:h},i)}catch{}(u!==s.authorizationServerMetadata||o!==s.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}else{const l=await ce(t,{resourceMetadataUrl:h,fetchFn:i});c=l.authorizationServerUrl,u=l.authorizationServerMetadata,o=l.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}const f=await re(t,e,o),A=r||o?.scopes_supported?.join(" ")||e.clientMetadata.scope;let d=await Promise.resolve(e.clientInformation());if(!d){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const l=u?.client_id_metadata_document_supported===!0,w=e.clientMetadataUrl;if(w&&!ne(w))throw new q(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${w}`);if(l&&w)d={client_id:w},await e.saveClientInformation?.(d);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(S),d=S}}const O=!e.redirectUrl;if(n!==void 0||O){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const k=await e.tokens();if(k?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:k.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}catch(l){if(!(!(l instanceof j)||l instanceof y))throw l}const z=e.state?await e.state():void 0,{authorizationUrl:b,codeVerifier:v}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(b),"REDIRECT"}function ne(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function re(e,t,n){const r=G(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!J({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Ue(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=m(e,"resource_metadata")||void 0;let i;if(a)try{i=new URL(a)}catch{}const s=m(e,"scope")||void 0,o=m(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:o}}function m(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function T(e,t,n=fetch){const r=await ie(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await r.body?.cancel(),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return I.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await F(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function C(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function g(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:s}){const o=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),a)await a(c,n,o,t);else if(r){const h=t?.token_endpoint_auth_methods_supported??[],f=K(r,h);Q(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return V.parse(await u.json())}async function me(e,{metadata:t,clientInformation:n,authorizationCode:r,codeVerifier:a,redirectUri:i,resource:s,addClientAuthentication:o,fetchFn:c}){const u=C(r,a,i);return g(e,{metadata:t,tokenRequestParams:u,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:c})}async function le(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:i,fetchFn:s}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),c=await g(e,{metadata:t,tokenRequestParams:o,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:s});return{refresh_token:r,...c}}async function he(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:i}={}){const s=e.clientMetadata.scope;let o;if(e.prepareTokenRequest&&(o=await e.prepareTokenRequest(s)),!o){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();o=C(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return Z.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
@@ -1 +1 @@
1
- import{c as l,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-DnHWblfu.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
1
+ import{c as l,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-tHM8NTfd.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
@@ -1 +1 @@
1
- import{D as pe,r as v,e as J,p as _,a as L,j as e,m as h,B as ge,c as Ce,b as fe,S as xe}from"./index-DnHWblfu.js";import{I as W}from"./input-BKgQbLb7.js";import{r as Ie,R as ke}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ae={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:r=>`Code sent to ${r}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:r=>`Continue with ${r}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function _e({redirectUrl:r,callbackUrl:s="/",title:f,subtitle:x,brand:p,copy:j,variant:w="default",allowedSocialProviders:c,allowPassword:m=!0,onAuthEvent:D}){const{emailAndPassword:F,resetPassword:q,emailOtp:u,socialProviders:N}=pe(),g=t=>{try{D?.(t)}catch{}},d=w==="compact",$=c?N.providers.filter(t=>c.includes(t.name)):N.providers,G=N.enabled&&$.length>0,X=F.enabled&&(m||!u.enabled&&!G),Y=N.enabled&&N.providers.length>0&&!G&&!u.enabled&&!X?N.providers:$,V=N.enabled&&Y.length>0,y=F.enabled&&(m||!u.enabled&&!V),[i,P]=v.useState(""),[l,be]=v.useState(""),[Z,ie]=v.useState(""),[ee,te]=v.useState(""),[O,se]=v.useState(!1),[ae,ve]=v.useState(()=>u.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,T]=v.useState(""),[re,oe]=v.useState(!1),a={...Ae,...j},b=ae==="signUp",I=ae==="forgotPassword",C=ae==="emailOtp",B=J({mutationFn:async({email:t,password:n,name:k})=>{try{if(b){const S=await L.signUp.email({email:t,password:n,name:k||""});if(S.error)throw new Error(S.error.message||a.signUpFailed);return S}else{const S=await L.signIn.email({email:t,password:n});if(S.error)throw new Error(S.error.message||a.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(a.authenticationFailed)}},onMutate:()=>{g({type:"started",method:"email_password",mode:b?"sign_up":"sign_in"})},onSuccess:()=>{g({type:"succeeded",method:"email_password",mode:b?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??s},onError:t=>{g({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),_(b?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),H=J({mutationFn:async({email:t})=>{const n=await L.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(n.error)throw new Error(n.error.message||a.resetEmailFailed);return n},onSuccess:()=>{_("password_reset_requested"),oe(!0)},onError:t=>{_("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t})=>{const n=await L.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(n.error)throw new Error(n.error.message||a.otpSendFailed);return n},onMutate:()=>{g({type:"started",method:"email_otp"})},onSuccess:()=>{g({type:"otp_sent",method:"email_otp"}),_("email_otp_sent"),se(!0)},onError:t=>{g({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),_("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),M=J({mutationFn:async({email:t,otp:n})=>{const k=await L.signIn.emailOtp({email:t,otp:n});if(k.error)throw new Error(k.error.message||a.invalidCode);return k},onMutate:()=>{g({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{g({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??s},onError:t=>{g({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),_("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ne=()=>{i.trim()&&!K(i)&&T(a.invalidEmail)},ye=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail),g({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}B.mutate({email:i,password:l,name:Z})},we=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail);return}H.mutate({email:i})},Ee=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail),g({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}R.mutate({email:i})},Se=t=>{t.preventDefault(),M.mutate({email:i,otp:ee})},U=t=>n=>{t(n.target.value),le&&B.reset(),de&&H.reset(),ce&&(R.reset(),M.reset()),t===P&&E&&T("")},z=t=>{ve(t),ie(""),te(""),se(!1),T(""),oe(!1),B.reset(),H.reset(),R.reset(),M.reset()},o=B.isPending||H.isPending||R.isPending||M.isPending,le=B.error,de=H.error,ce=R.error||M.error,A=b?i.trim()&&l.trim()&&Z.trim():I?i.trim():C?O?ee.trim():i.trim():i.trim()&&l.trim(),je=t=>{if(!t)return null;const n=t.message.toLowerCase();return n.includes("unauthorized")||n.includes("401")?a.invalidEmailOrPassword:n.includes("already exists")||n.includes("409")?a.accountExists:n.includes("network")||n.includes("fetch")?a.networkError:n.includes("rate limit")||n.includes("429")?a.tooManyAttempts:n.includes("invalid")&&n.includes("otp")?a.invalidOrExpiredCode:t.message||a.genericError},me=le||de||ce,Ne=async t=>{g({type:"started",method:"social",provider:t});try{const n=await L.signIn.social({provider:t,callbackURL:r??s});if(n.error)throw new Error(n.error.message||a.authenticationFailed)}catch(n){const k=n instanceof Error?n.message:String(n);g({type:"failed",method:"social",provider:t,stage:"redirect",error:k}),_("social_signin_failed",{provider:t,error:k})}},Pe=I?a.resetPasswordTitle:C&&O?a.verificationCodeTitle:f??a.welcomeTitle,ue=I?a.resetPasswordSubtitle:C&&O?a.codeSentTo(i):x===void 0?a.defaultSubtitle:x;return e.jsxs("div",{className:h("grid w-full",d?"gap-5":"gap-10"),children:[p??e.jsxs("div",{children:[e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),e.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:h("font-medium",d?"text-xl leading-7":"text-2xl leading-8"),children:Pe}),ue&&e.jsx("p",{className:h("text-muted-foreground",d?"text-sm leading-5":"text-base leading-6"),children:ue})]}),me&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:je(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:a.resetEmailSent}),!I&&!(C&&O)&&V&&e.jsx("div",{className:"grid gap-2",children:Y.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{Ne(t.name)},className:h("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",d?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:h("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),a.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!I&&!(C&&O)&&V&&(y||u.enabled)&&e.jsxs("div",{className:h("flex items-center gap-2.5",d?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:h("text-muted-foreground",d?"text-sm":"text-base"),children:a.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),C&&u.enabled&&e.jsx(e.Fragment,{children:O?e.jsxs("form",{onSubmit:Se,className:h("grid gap-2",d&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:h("text-sm font-medium text-foreground",d&&"sr-only"),children:a.verificationCodeLabel}),e.jsx(W,{type:"text",placeholder:a.enterCodePlaceholder,value:ee,onChange:U(te),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:h("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",d?"h-11 sm:w-auto":"h-12 w-full"),children:o?a.verifying:a.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),R.reset(),M.reset()},disabled:o,className:h("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",d&&"sm:col-span-2"),children:a.useDifferentEmail})]}):e.jsxs("form",{onSubmit:Ee,className:h("grid gap-2",d&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:h("text-sm font-medium text-foreground",d&&"sr-only"),children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:a.emailPlaceholder,value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive",children:E})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:h("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",d?"h-11 sm:w-auto":"h-12 w-full"),children:o?a.sending:a.sendCode})]})}),I&&y&&!re&&e.jsxs("form",{onSubmit:we,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:"you@example.com",value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsx(ge,{type:"submit",disabled:o||!A,className:"w-full font-semibold",size:"xl",children:o?a.sending:a.sendResetLink})]}),!I&&!C&&y&&e.jsxs("form",{onSubmit:ye,className:"grid gap-5",children:[b&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.nameLabel}),e.jsx(W,{type:"text",placeholder:a.namePlaceholder,value:Z,onChange:U(ie),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:"you@example.com",value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:a.passwordLabel}),!b&&q.enabled&&e.jsx("button",{type:"button",onClick:()=>z("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:a.forgotPassword})]}),e.jsx(W,{type:"password",placeholder:"••••••••",value:l,onChange:U(be),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:h("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",A?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:h("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:h("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?b?a.creatingAccount:a.signingIn:a.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:I?e.jsx("button",{type:"button",onClick:()=>z("signIn"),disabled:o,className:Q,children:a.backToSignIn}):C&&y?e.jsx("button",{type:"button",onClick:()=>z("signIn"),disabled:o,className:Q,children:a.signInWithPassword}):!C&&y?e.jsxs(e.Fragment,{children:[b?a.alreadyHaveAccount:a.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>z(b?"signIn":"signUp"),disabled:o,className:Q,children:b?a.signIn:a.signUp}),u.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>z("emailOtp"),disabled:o,className:Q,children:a.signInWithEmailCode})]})]}):null})]})}class he{constructor(s){this.response=s}response}function Le(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Fe({redirectTo:r,onAuthEvent:s}){const f=fe(),[x,p]=v.useState(null),j=v.useEffectEvent(w=>{try{s?.(w)}catch{}});return v.useEffect(()=>{let w=!1;return(async()=>{j({type:"started",method:"local"});try{let c;try{c=await Ie(async()=>{const m=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(m.status>=500)throw new he(m);return m},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(m){if(m instanceof ke&&m.cause instanceof he)c=m.cause.response;else throw m}if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m?.error||f("common.authEntry.autoLoginFailed"))}w||(j({type:"succeeded",method:"local"}),window.location.href=Le(r))}catch(c){w||(j({type:"failed",method:"local",stage:"authenticate",error:c instanceof Error?c.message:String(c)}),p(c instanceof Error?c.message:f("common.authEntry.autoLoginFailed")))}})(),()=>{w=!0}},[r]),x?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-destructive mb-2",children:f("common.authEntry.autoLoginFailedWithError",{error:x})}),e.jsx("p",{className:"text-muted-foreground text-sm",children:f("common.authEntry.tryRestartingServer")})]})}):e.jsx(xe,{})}function Oe({callbackURL:r,providerId:s,onAuthEvent:f}){const x=v.useEffectEvent(p=>{try{f?.(p)}catch{}});return v.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:s});try{const p=await L.signIn.sso({providerId:s,callbackURL:r});if(p.error)throw new Error(p.error.message||"SSO redirect failed")}catch(p){x({type:"failed",method:"sso",provider:s,stage:"redirect",error:p instanceof Error?p.message:String(p)})}})()},[s,r]),e.jsx(xe,{})}function Ue(r){const s=Ce.c(22),{callbackUrl:f,redirectUrl:x,allowAutoLogin:p,title:j,subtitle:w,brand:c,copy:m,variant:D,allowedSocialProviders:F,allowPassword:q,onAuthEvent:u}=r,N=p===void 0?!0:p,g=fe(),{sso:d,emailAndPassword:$,magicLink:G,emailOtp:X,socialProviders:Y,localMode:V}=pe(),y=x||f;if(V&&N){let l;return s[0]!==u||s[1]!==y?(l=e.jsx(Fe,{redirectTo:y,onAuthEvent:u}),s[0]=u,s[1]=y,s[2]=l):l=s[2],l}if(d.enabled){let l;return s[3]!==u||s[4]!==y||s[5]!==d.providerId?(l=e.jsx(Oe,{callbackURL:y,providerId:d.providerId,onAuthEvent:u}),s[3]=u,s[4]=y,s[5]=d.providerId,s[6]=l):l=s[6],l}if($.enabled||G.enabled||X.enabled||Y.enabled){let l;return s[7]!==q||s[8]!==F||s[9]!==c||s[10]!==f||s[11]!==m||s[12]!==u||s[13]!==x||s[14]!==w||s[15]!==j||s[16]!==D?(l=e.jsx(_e,{redirectUrl:x,callbackUrl:f,title:j,subtitle:w,brand:c,copy:m,variant:D,allowedSocialProviders:F,allowPassword:q,onAuthEvent:u}),s[7]=q,s[8]=F,s[9]=c,s[10]=f,s[11]=m,s[12]=u,s[13]=x,s[14]=w,s[15]=j,s[16]=D,s[17]=l):l=s[17],l}let i;s[18]!==g?(i=g("common.authEntry.noLoginOptions"),s[18]=g,s[19]=i):i=s[19];let P;return s[20]!==i?(P=e.jsx("div",{children:i}),s[20]=i,s[21]=P):P=s[21],P}export{Ue as A};
1
+ import{D as pe,r as v,e as J,p as _,a as L,j as e,m as h,B as ge,c as Ce,b as fe,S as xe}from"./index-tHM8NTfd.js";import{I as W}from"./input-CtPcKTyA.js";import{r as Ie,R as ke}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ae={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:r=>`Code sent to ${r}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:r=>`Continue with ${r}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function _e({redirectUrl:r,callbackUrl:s="/",title:f,subtitle:x,brand:p,copy:j,variant:w="default",allowedSocialProviders:c,allowPassword:m=!0,onAuthEvent:D}){const{emailAndPassword:F,resetPassword:q,emailOtp:u,socialProviders:N}=pe(),g=t=>{try{D?.(t)}catch{}},d=w==="compact",$=c?N.providers.filter(t=>c.includes(t.name)):N.providers,G=N.enabled&&$.length>0,X=F.enabled&&(m||!u.enabled&&!G),Y=N.enabled&&N.providers.length>0&&!G&&!u.enabled&&!X?N.providers:$,V=N.enabled&&Y.length>0,y=F.enabled&&(m||!u.enabled&&!V),[i,P]=v.useState(""),[l,be]=v.useState(""),[Z,ie]=v.useState(""),[ee,te]=v.useState(""),[O,se]=v.useState(!1),[ae,ve]=v.useState(()=>u.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,T]=v.useState(""),[re,oe]=v.useState(!1),a={...Ae,...j},b=ae==="signUp",I=ae==="forgotPassword",C=ae==="emailOtp",B=J({mutationFn:async({email:t,password:n,name:k})=>{try{if(b){const S=await L.signUp.email({email:t,password:n,name:k||""});if(S.error)throw new Error(S.error.message||a.signUpFailed);return S}else{const S=await L.signIn.email({email:t,password:n});if(S.error)throw new Error(S.error.message||a.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(a.authenticationFailed)}},onMutate:()=>{g({type:"started",method:"email_password",mode:b?"sign_up":"sign_in"})},onSuccess:()=>{g({type:"succeeded",method:"email_password",mode:b?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??s},onError:t=>{g({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),_(b?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),H=J({mutationFn:async({email:t})=>{const n=await L.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(n.error)throw new Error(n.error.message||a.resetEmailFailed);return n},onSuccess:()=>{_("password_reset_requested"),oe(!0)},onError:t=>{_("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t})=>{const n=await L.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(n.error)throw new Error(n.error.message||a.otpSendFailed);return n},onMutate:()=>{g({type:"started",method:"email_otp"})},onSuccess:()=>{g({type:"otp_sent",method:"email_otp"}),_("email_otp_sent"),se(!0)},onError:t=>{g({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),_("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),M=J({mutationFn:async({email:t,otp:n})=>{const k=await L.signIn.emailOtp({email:t,otp:n});if(k.error)throw new Error(k.error.message||a.invalidCode);return k},onMutate:()=>{g({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{g({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??s},onError:t=>{g({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),_("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ne=()=>{i.trim()&&!K(i)&&T(a.invalidEmail)},ye=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail),g({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}B.mutate({email:i,password:l,name:Z})},we=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail);return}H.mutate({email:i})},Ee=t=>{if(t.preventDefault(),!K(i)){T(a.invalidEmail),g({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}R.mutate({email:i})},Se=t=>{t.preventDefault(),M.mutate({email:i,otp:ee})},U=t=>n=>{t(n.target.value),le&&B.reset(),de&&H.reset(),ce&&(R.reset(),M.reset()),t===P&&E&&T("")},z=t=>{ve(t),ie(""),te(""),se(!1),T(""),oe(!1),B.reset(),H.reset(),R.reset(),M.reset()},o=B.isPending||H.isPending||R.isPending||M.isPending,le=B.error,de=H.error,ce=R.error||M.error,A=b?i.trim()&&l.trim()&&Z.trim():I?i.trim():C?O?ee.trim():i.trim():i.trim()&&l.trim(),je=t=>{if(!t)return null;const n=t.message.toLowerCase();return n.includes("unauthorized")||n.includes("401")?a.invalidEmailOrPassword:n.includes("already exists")||n.includes("409")?a.accountExists:n.includes("network")||n.includes("fetch")?a.networkError:n.includes("rate limit")||n.includes("429")?a.tooManyAttempts:n.includes("invalid")&&n.includes("otp")?a.invalidOrExpiredCode:t.message||a.genericError},me=le||de||ce,Ne=async t=>{g({type:"started",method:"social",provider:t});try{const n=await L.signIn.social({provider:t,callbackURL:r??s});if(n.error)throw new Error(n.error.message||a.authenticationFailed)}catch(n){const k=n instanceof Error?n.message:String(n);g({type:"failed",method:"social",provider:t,stage:"redirect",error:k}),_("social_signin_failed",{provider:t,error:k})}},Pe=I?a.resetPasswordTitle:C&&O?a.verificationCodeTitle:f??a.welcomeTitle,ue=I?a.resetPasswordSubtitle:C&&O?a.codeSentTo(i):x===void 0?a.defaultSubtitle:x;return e.jsxs("div",{className:h("grid w-full",d?"gap-5":"gap-10"),children:[p??e.jsxs("div",{children:[e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),e.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:h("font-medium",d?"text-xl leading-7":"text-2xl leading-8"),children:Pe}),ue&&e.jsx("p",{className:h("text-muted-foreground",d?"text-sm leading-5":"text-base leading-6"),children:ue})]}),me&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:je(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:a.resetEmailSent}),!I&&!(C&&O)&&V&&e.jsx("div",{className:"grid gap-2",children:Y.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{Ne(t.name)},className:h("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",d?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:h("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),a.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!I&&!(C&&O)&&V&&(y||u.enabled)&&e.jsxs("div",{className:h("flex items-center gap-2.5",d?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:h("text-muted-foreground",d?"text-sm":"text-base"),children:a.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),C&&u.enabled&&e.jsx(e.Fragment,{children:O?e.jsxs("form",{onSubmit:Se,className:h("grid gap-2",d&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:h("text-sm font-medium text-foreground",d&&"sr-only"),children:a.verificationCodeLabel}),e.jsx(W,{type:"text",placeholder:a.enterCodePlaceholder,value:ee,onChange:U(te),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:h("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",d?"h-11 sm:w-auto":"h-12 w-full"),children:o?a.verifying:a.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),R.reset(),M.reset()},disabled:o,className:h("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",d&&"sm:col-span-2"),children:a.useDifferentEmail})]}):e.jsxs("form",{onSubmit:Ee,className:h("grid gap-2",d&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:h("text-sm font-medium text-foreground",d&&"sr-only"),children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:a.emailPlaceholder,value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive",children:E})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:h("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",d?"h-11 sm:w-auto":"h-12 w-full"),children:o?a.sending:a.sendCode})]})}),I&&y&&!re&&e.jsxs("form",{onSubmit:we,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:"you@example.com",value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsx(ge,{type:"submit",disabled:o||!A,className:"w-full font-semibold",size:"xl",children:o?a.sending:a.sendResetLink})]}),!I&&!C&&y&&e.jsxs("form",{onSubmit:ye,className:"grid gap-5",children:[b&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.nameLabel}),e.jsx(W,{type:"text",placeholder:a.namePlaceholder,value:Z,onChange:U(ie),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:a.emailLabel}),e.jsx(W,{type:"email",placeholder:"you@example.com",value:i,onChange:U(P),onBlur:ne,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:a.passwordLabel}),!b&&q.enabled&&e.jsx("button",{type:"button",onClick:()=>z("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:a.forgotPassword})]}),e.jsx(W,{type:"password",placeholder:"••••••••",value:l,onChange:U(be),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:h("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",A?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:h("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:h("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?b?a.creatingAccount:a.signingIn:a.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:I?e.jsx("button",{type:"button",onClick:()=>z("signIn"),disabled:o,className:Q,children:a.backToSignIn}):C&&y?e.jsx("button",{type:"button",onClick:()=>z("signIn"),disabled:o,className:Q,children:a.signInWithPassword}):!C&&y?e.jsxs(e.Fragment,{children:[b?a.alreadyHaveAccount:a.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>z(b?"signIn":"signUp"),disabled:o,className:Q,children:b?a.signIn:a.signUp}),u.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>z("emailOtp"),disabled:o,className:Q,children:a.signInWithEmailCode})]})]}):null})]})}class he{constructor(s){this.response=s}response}function Le(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Fe({redirectTo:r,onAuthEvent:s}){const f=fe(),[x,p]=v.useState(null),j=v.useEffectEvent(w=>{try{s?.(w)}catch{}});return v.useEffect(()=>{let w=!1;return(async()=>{j({type:"started",method:"local"});try{let c;try{c=await Ie(async()=>{const m=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(m.status>=500)throw new he(m);return m},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(m){if(m instanceof ke&&m.cause instanceof he)c=m.cause.response;else throw m}if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m?.error||f("common.authEntry.autoLoginFailed"))}w||(j({type:"succeeded",method:"local"}),window.location.href=Le(r))}catch(c){w||(j({type:"failed",method:"local",stage:"authenticate",error:c instanceof Error?c.message:String(c)}),p(c instanceof Error?c.message:f("common.authEntry.autoLoginFailed")))}})(),()=>{w=!0}},[r]),x?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-destructive mb-2",children:f("common.authEntry.autoLoginFailedWithError",{error:x})}),e.jsx("p",{className:"text-muted-foreground text-sm",children:f("common.authEntry.tryRestartingServer")})]})}):e.jsx(xe,{})}function Oe({callbackURL:r,providerId:s,onAuthEvent:f}){const x=v.useEffectEvent(p=>{try{f?.(p)}catch{}});return v.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:s});try{const p=await L.signIn.sso({providerId:s,callbackURL:r});if(p.error)throw new Error(p.error.message||"SSO redirect failed")}catch(p){x({type:"failed",method:"sso",provider:s,stage:"redirect",error:p instanceof Error?p.message:String(p)})}})()},[s,r]),e.jsx(xe,{})}function Ue(r){const s=Ce.c(22),{callbackUrl:f,redirectUrl:x,allowAutoLogin:p,title:j,subtitle:w,brand:c,copy:m,variant:D,allowedSocialProviders:F,allowPassword:q,onAuthEvent:u}=r,N=p===void 0?!0:p,g=fe(),{sso:d,emailAndPassword:$,magicLink:G,emailOtp:X,socialProviders:Y,localMode:V}=pe(),y=x||f;if(V&&N){let l;return s[0]!==u||s[1]!==y?(l=e.jsx(Fe,{redirectTo:y,onAuthEvent:u}),s[0]=u,s[1]=y,s[2]=l):l=s[2],l}if(d.enabled){let l;return s[3]!==u||s[4]!==y||s[5]!==d.providerId?(l=e.jsx(Oe,{callbackURL:y,providerId:d.providerId,onAuthEvent:u}),s[3]=u,s[4]=y,s[5]=d.providerId,s[6]=l):l=s[6],l}if($.enabled||G.enabled||X.enabled||Y.enabled){let l;return s[7]!==q||s[8]!==F||s[9]!==c||s[10]!==f||s[11]!==m||s[12]!==u||s[13]!==x||s[14]!==w||s[15]!==j||s[16]!==D?(l=e.jsx(_e,{redirectUrl:x,callbackUrl:f,title:j,subtitle:w,brand:c,copy:m,variant:D,allowedSocialProviders:F,allowPassword:q,onAuthEvent:u}),s[7]=q,s[8]=F,s[9]=c,s[10]=f,s[11]=m,s[12]=u,s[13]=x,s[14]=w,s[15]=j,s[16]=D,s[17]=l):l=s[17],l}let i;s[18]!==g?(i=g("common.authEntry.noLoginOptions"),s[18]=g,s[19]=i):i=s[19];let P;return s[20]!==i?(P=e.jsx("div",{children:i}),s[20]=i,s[21]=P):P=s[21],P}export{Ue as A};