decocms 4.95.1 → 4.95.2

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 (235) hide show
  1. package/dist/client/assets/{AlertCircle-CdaQFqHl.js → AlertCircle-8aL2p4Jm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BagHq3g2.js → AreaChart-CH1JlaHA.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-Cov2YPeB.js → ArrowRight-BmTkQdSS.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-_a-SRtGc.js → ArrowUp-BRv6jMcd.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-DJyks9HV.js → ArrowUpRight-DgWDf4bB.js} +1 -1
  6. package/dist/client/assets/{Check-L1zt1MhQ.js → Check-xlx8bieA.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-MzaIveO0.js → CheckCircle-BhHr7P8S.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-ste9rvwa.js → ChevronDown-z_OgoJuG.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-DjxxY9yH.js → ChevronRight-HByc-_dD.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-BMKp68Ef.js → ChevronUp-C0dubflE.js} +1 -1
  11. package/dist/client/assets/{Copy01-LCLhyD88.js → Copy01-BhLnIcPa.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DCjclS0s.js → DotsVertical-9e8whEmO.js} +1 -1
  13. package/dist/client/assets/{Eye-DfJI2F2R.js → Eye-Dmrq3Yx3.js} +1 -1
  14. package/dist/client/assets/{FilterLines-BqkGYn3N.js → FilterLines-LxfJFt1s.js} +1 -1
  15. package/dist/client/assets/{Globe01-DTnpQEvE.js → Globe01-C1OI0rNn.js} +1 -1
  16. package/dist/client/assets/{Globe04-CWIUsgNy.js → Globe04-D37KO3Rl.js} +1 -1
  17. package/dist/client/assets/{HardDrive-CalrZSFc.js → HardDrive-xaUFGQWK.js} +1 -1
  18. package/dist/client/assets/{Image01-SH1T61tk.js → Image01-D2MElAgS.js} +1 -1
  19. package/dist/client/assets/{Key01-n8lq21nZ.js → Key01-CJ4v8ToT.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-D1i_m16o.js → LayoutLeft-BXx4559W.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-BnAWWVH2.js → LinkExternal01-RdFrwyl0.js} +1 -1
  22. package/dist/client/assets/{Monitor01-WjwD_B76.js → Monitor01-ByOW8gCA.js} +1 -1
  23. package/dist/client/assets/{Package-NScsE20z.js → Package-BApyVZZF.js} +1 -1
  24. package/dist/client/assets/{Palette-Dq9W8WsR.js → Palette-gwCbQEVd.js} +1 -1
  25. package/dist/client/assets/{Play-DwFJH11i.js → Play-CRcD5urt.js} +1 -1
  26. package/dist/client/assets/{Plus-B9C9Hujd.js → Plus-CpvaryXc.js} +1 -1
  27. package/dist/client/assets/{SearchLg-C07Q8QRW.js → SearchLg-BLbYMh4R.js} +1 -1
  28. package/dist/client/assets/{SearchMd-DP6rSkG4.js → SearchMd-BbTMkDIb.js} +1 -1
  29. package/dist/client/assets/{Settings02-CNqO4CPf.js → Settings02-CoD4T3JT.js} +1 -1
  30. package/dist/client/assets/{Shield01-qRQ0B-Cf.js → Shield01-BSQ914Nd.js} +1 -1
  31. package/dist/client/assets/{Star01-Cc38MZxO.js → Star01-B_ldc-QG.js} +1 -1
  32. package/dist/client/assets/{Stars01-DFWKWgNe.js → Stars01-BEQN6TZj.js} +1 -1
  33. package/dist/client/assets/{Stars02-BDaM006Z.js → Stars02-wl-TgjVw.js} +1 -1
  34. package/dist/client/assets/{Sun-DuSRYQOH.js → Sun-DcglW2RF.js} +1 -1
  35. package/dist/client/assets/{SwitchHorizontal01-BfOiWCGP.js → SwitchHorizontal01-BjhVVVE7.js} +1 -1
  36. package/dist/client/assets/{Tool01-CGUbJHe6.js → Tool01-F8NWFSUY.js} +1 -1
  37. package/dist/client/assets/{Tool02-yWUlg2Jl.js → Tool02-CYQFsqUw.js} +1 -1
  38. package/dist/client/assets/{Trash01-qeRcmh_t.js → Trash01-CFIi5PAY.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-C15jO-JN.js → TrendUp01-B11vKIzx.js} +1 -1
  40. package/dist/client/assets/{Upload01-DUtmbuEn.js → Upload01-CYv9Q0Sh.js} +1 -1
  41. package/dist/client/assets/{User01-BwTr9f5y.js → User01-BHW_CvWq.js} +1 -1
  42. package/dist/client/assets/{Users01-7br16I2u.js → Users01-CVvGtppm.js} +1 -1
  43. package/dist/client/assets/{Users03-sWa9-yJE.js → Users03-Bg-uyP8J.js} +1 -1
  44. package/dist/client/assets/{X-BYK4muxp.js → X-B9OMbRgI.js} +1 -1
  45. package/dist/client/assets/{XCircle-DQ0bT2Xh.js → XCircle-z2zpbAQl.js} +1 -1
  46. package/dist/client/assets/{XClose-Djg48M2y.js → XClose-Bvx5TP10.js} +1 -1
  47. package/dist/client/assets/{Zap-BIGnAJhj.js → Zap-CaoQpAZT.js} +1 -1
  48. package/dist/client/assets/{ZapSquare-BO7N9q2-.js → ZapSquare-NmRRaYpN.js} +1 -1
  49. package/dist/client/assets/{ZoomOut-CejWxeXb.js → ZoomOut-Bjuv5wtp.js} +1 -1
  50. package/dist/client/assets/{access-gate-hWVXWH-C.js → access-gate-CSvdc98W.js} +1 -1
  51. package/dist/client/assets/{add-section-modal-BKKn2cBw.js → add-section-modal-BlKiDhBw.js} +1 -1
  52. package/dist/client/assets/{agent-icon-yglVWNMq.js → agent-icon-kMrNxjYJ.js} +1 -1
  53. package/dist/client/assets/{agents-list-C2AH2ZTQ.js → agents-list-4wX4J2kJ.js} +1 -1
  54. package/dist/client/assets/{ai-providers-CvWWN6p0.js → ai-providers-Dj7ASIds.js} +1 -1
  55. package/dist/client/assets/{alert-C2Xn0s7k.js → alert-CgsPHe2o.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-DFT5_7dO.js → alert-dialog-lT11Jsbj.js} +1 -1
  57. package/dist/client/assets/{app-editor-BXtqlVCU.js → app-editor-B3W7tylT.js} +1 -1
  58. package/dist/client/assets/{auth-BZr8EHmi.js → auth-CaW_gj1t.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-B9JfYMyP.js → auth-catchall-CWTTCQsz.js} +1 -1
  60. package/dist/client/assets/{auth-entry-DJVyveKU.js → auth-entry-IJFQq8w-.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-D4gZanxW.js → auth-split-layout-C25aJ8eh.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-CpPUo5MX.js → authenticate-and-persist-oauth-jkSUOcu8.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-PQh9RFJz.js → automation-list-row-QQUoi2db.js} +1 -1
  64. package/dist/client/assets/{automation-runs-BkYkVwPY.js → automation-runs-Cs7mheBT.js} +1 -1
  65. package/dist/client/assets/{automations-D2bv4snW.js → automations-BzzWpoAs.js} +1 -1
  66. package/dist/client/assets/{autosend-pURvoWwX.js → autosend-CSO0mWVp.js} +1 -1
  67. package/dist/client/assets/{avatar-DZQ3Pejc.js → avatar-BHNRf2BK.js} +1 -1
  68. package/dist/client/assets/{badge-tRp7IfGb.js → badge-0FaSmMEN.js} +1 -1
  69. package/dist/client/assets/{block-document-BxADDFPU.js → block-document-BV8UCOiY.js} +1 -1
  70. package/dist/client/assets/{brand-context-BSI08ulM.js → brand-context-CnL-EXLr.js} +1 -1
  71. package/dist/client/assets/{buckets-B3DpKkO7.js → buckets-BhRo2ooL.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-GNC4wgLD.js → bulk-category-panel-CzxYutCW.js} +1 -1
  73. package/dist/client/assets/{calendar-BFap2Gyw.js → calendar-ajXRpj7H.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-BoQyulw4.js → capability-load-error-D08tgLJn.js} +1 -1
  75. package/dist/client/assets/{card-BFaEMAcD.js → card-CxpjTUKu.js} +1 -1
  76. package/dist/client/assets/{category-editor-CS6NoJ0d.js → category-editor-VzyKXFmI.js} +1 -1
  77. package/dist/client/assets/{chat-context-B8zmzrLo.js → chat-context-BKkLQtRB.js} +1 -1
  78. package/dist/client/assets/{checkbox-CSxALpSd.js → checkbox-9SStA5q1.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-Bz0Qm1gF.js → cli-auth-success-DMtwNV80.js} +1 -1
  80. package/dist/client/assets/{collection-detail-D3ZVqoRT.js → collection-detail-CjiPw-t8.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-CwYXQHk_.js → collection-display-button-BkQRfMlH.js} +1 -1
  82. package/dist/client/assets/{collection-search-C26mO7tt.js → collection-search-DZDCl18y.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-D350rJfW.js → collection-table-wrapper-3CLNdiVr.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-C2N7Gsrx.js → collection-tabs-C2iwwrh8.js} +1 -1
  85. package/dist/client/assets/{command-g-mrhqk4.js → command-Dv4-KFR5.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-oYMpNL3-.js → commerce-onboarding-Cw_rAIUN.js} +1 -1
  87. package/dist/client/assets/{companions-core-C4XWmT-B.js → companions-core-AOH9czLM.js} +1 -1
  88. package/dist/client/assets/{connect-D_C13SPH.js → connect-Cqt8XvcG.js} +1 -1
  89. package/dist/client/assets/{connect-desktop-dialog-Ddq0AXN_.js → connect-desktop-dialog-CcP2o0mO.js} +1 -1
  90. package/dist/client/assets/{connection-card-DSiFCHTb.js → connection-card-DSeJr6d2.js} +1 -1
  91. package/dist/client/assets/{connection-detail-B3zC3uoA.js → connection-detail-D0NuPfPl.js} +1 -1
  92. package/dist/client/assets/{connection-form-helpers-DqE8VlOL.js → connection-form-helpers-Ce26XCbs.js} +1 -1
  93. package/dist/client/assets/{connections-DNK3PDxG.js → connections-CaxsgoYU.js} +1 -1
  94. package/dist/client/assets/{decopilot-sse-pool-Czpmu6TG.js → decopilot-sse-pool-DWXTDK7c.js} +1 -1
  95. package/dist/client/assets/{dialog-BhHo_8aX.js → dialog-B8iPXZfB.js} +1 -1
  96. package/dist/client/assets/{domain-settings-Ditk8ojC.js → domain-settings-DkOZ5_VY.js} +1 -1
  97. package/dist/client/assets/{drawer-BtalvzOh.js → drawer-D5z1QpZ1.js} +1 -1
  98. package/dist/client/assets/{dropdown-menu-CS4ITtQz.js → dropdown-menu-D3W9Mypw.js} +1 -1
  99. package/dist/client/assets/{empty-state-BKVeh2JK.js → empty-state-B0XUVWqe.js} +1 -1
  100. package/dist/client/assets/{extract-connection-data-C_u7UnJF.js → extract-connection-data-ChcGsUj8.js} +1 -1
  101. package/dist/client/assets/{file-explorer-B0O5puyX.js → file-explorer-DIO_SQJ1.js} +1 -1
  102. package/dist/client/assets/{file-type-icon-CAWuba96.js → file-type-icon-CICh64eJ.js} +1 -1
  103. package/dist/client/assets/{files-CzJ2I1iX.js → files-Cql2muKm.js} +1 -1
  104. package/dist/client/assets/{form-CzoZxyKx.js → form-BbtpCekf.js} +1 -1
  105. package/dist/client/assets/{general-BBZsnwfo.js → general-DPD4y6iK.js} +1 -1
  106. package/dist/client/assets/{github-repo-picker-BDoqlkEl.js → github-repo-picker-qhKlxIkP.js} +1 -1
  107. package/dist/client/assets/{hooks-D4wZCWx0.js → hooks-QkqjVdn8.js} +1 -1
  108. package/dist/client/assets/{index-DgiImAyY.js → index-B72iIhnj.js} +1 -1
  109. package/dist/client/assets/{index-C_Zijcof.js → index-BD3KwOs3.js} +1 -1
  110. package/dist/client/assets/{index-Dgwu6aJL.js → index-BDQNsoxm.js} +1 -1
  111. package/dist/client/assets/{index-DS2AuJy-.js → index-BUJePXEL.js} +1 -1
  112. package/dist/client/assets/{index-58E47QOH.js → index-BdfBtWtk.js} +1 -1
  113. package/dist/client/assets/{index-K_meiP0u.js → index-BmTD_ujn.js} +1 -1
  114. package/dist/client/assets/{index-B28hvUXv.js → index-Bz75jbQc.js} +1 -1
  115. package/dist/client/assets/{index-BtvbO-YY.js → index-CfAl6qA3.js} +3 -3
  116. package/dist/client/assets/{index-CHGiYPlv.js → index-CwSqgILb.js} +9 -9
  117. package/dist/client/assets/{index-DuRfU6hc.js → index-D7GpXBZi.js} +1 -1
  118. package/dist/client/assets/{index-DOnqxg7a.js → index-DCLh1sVt.js} +1 -1
  119. package/dist/client/assets/{index-_3eICCSJ.js → index-DFylQUoD.js} +3 -3
  120. package/dist/client/assets/{index-B3rpW3YZ.js → index-DyxjlEL3.js} +1 -1
  121. package/dist/client/assets/{index-Qmmk-CVi.js → index-krar3iag.js} +1 -1
  122. package/dist/client/assets/{index-redirect-Dk66NSBz.js → index-redirect-BIF-9n41.js} +1 -1
  123. package/dist/client/assets/{input-B_sJYQmR.js → input-C96iFBVQ.js} +1 -1
  124. package/dist/client/assets/{integration-icon-D8ONihzR.js → integration-icon-B1RhpoYr.js} +1 -1
  125. package/dist/client/assets/{invite-member-dialog-DAWEia1M.js → invite-member-dialog-xjgZGOB2.js} +1 -1
  126. package/dist/client/assets/{label-DFLzLt29.js → label-Dyml5mFF.js} +1 -1
  127. package/dist/client/assets/{layout-CzxSs3tN.js → layout-DDL4dMPD.js} +1 -1
  128. package/dist/client/assets/{login-CHdAxa3B.js → login-CoR8jNzG.js} +1 -1
  129. package/dist/client/assets/{mcp-oauth-c9yHY2lN.js → mcp-oauth-C3_4QnQD.js} +1 -1
  130. package/dist/client/assets/{members-BSctJ4Dt.js → members-Bq1eH0V7.js} +1 -1
  131. package/dist/client/assets/{monaco-editor-BAOenOTd.js → monaco-editor-CzUxXwGN.js} +1 -1
  132. package/dist/client/assets/{monitoring-stats-row-CDlw7YVI.js → monitoring-stats-row-B0DrzvEt.js} +1 -1
  133. package/dist/client/assets/{multi-select-BMnTeVlJ.js → multi-select-rPe-eyDx.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-DighZLSE.js → oauth-callback-BrUhk0Wa.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-Dxa7fBXN.js → oauth-callback-ai-provider-B8YVCFyJ.js} +1 -1
  136. package/dist/client/assets/{onboarding-Bd1JidMq.js → onboarding-COoyusCG.js} +1 -1
  137. package/dist/client/assets/{org-install-BxMEPJ2B.js → org-install-JAHRkU5h.js} +1 -1
  138. package/dist/client/assets/{org-layout-Bd18fWgm.js → org-layout-D60pVxIN.js} +1 -1
  139. package/dist/client/assets/{organization-choice-B6HwP4Tc.js → organization-choice-C6Ls0A49.js} +1 -1
  140. package/dist/client/assets/{orgs-BCYlPNJI.js → orgs-DztT5sab.js} +1 -1
  141. package/dist/client/assets/{page-seo-form-138jxBGg.js → page-seo-form-B_P0EHl2.js} +1 -1
  142. package/dist/client/assets/page-seo-sheet-DHzmRm4L.js +1 -0
  143. package/dist/client/assets/{popover-DwFxfwW1.js → popover-CNhMnjco.js} +1 -1
  144. package/dist/client/assets/{post-editor-DltwfLuy.js → post-editor-D_xoTmn-.js} +1 -1
  145. package/dist/client/assets/{primitives-BqTD_FqC.js → primitives-CBYGlggB.js} +1 -1
  146. package/dist/client/assets/{profile-CxHF32FT.js → profile-cvRYji9N.js} +1 -1
  147. package/dist/client/assets/project-app-view-CBEQxExF.js +1 -0
  148. package/dist/client/assets/record-editor-PW0VGnvH.js +1 -0
  149. package/dist/client/assets/redirect-editor-DsFvTbg2.js +1 -0
  150. package/dist/client/assets/registry-CvDjs0_s.js +2 -0
  151. package/dist/client/assets/{registry-layout-C4qIpvwO.js → registry-layout-bAxFNLjy.js} +1 -1
  152. package/dist/client/assets/{reports-BAyzZeWB.js → reports-CQcFaphb.js} +1 -1
  153. package/dist/client/assets/{require-capability-9SFR5rb-.js → require-capability-DxlH57sg.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-CcmRmSDB.js → required-auth-layout-C-fhbIaJ.js} +1 -1
  155. package/dist/client/assets/{reset-password-BArup2RO.js → reset-password-DNx83PQG.js} +1 -1
  156. package/dist/client/assets/{roles-A1577aL6.js → roles-BHDPkFyx.js} +1 -1
  157. package/dist/client/assets/{search-input-CPAXCLRZ.js → search-input-DzbdykkS.js} +1 -1
  158. package/dist/client/assets/{secrets-BRyxdGkx.js → secrets-BiPQdzxP.js} +1 -1
  159. package/dist/client/assets/{sections-editor-Gc_tx3k8.js → sections-editor-DtTXEdpr.js} +1 -1
  160. package/dist/client/assets/{select-TTPpfzgt.js → select-DfWJsEeW.js} +1 -1
  161. package/dist/client/assets/{select-model-Cnv_ibpl.js → select-model-va_ybRaj.js} +1 -1
  162. package/dist/client/assets/{self-tool-result-7fY-wes8.js → self-tool-result-BYn91ML_.js} +1 -1
  163. package/dist/client/assets/{seo-editor-CKIx7Ev1.js → seo-editor-DhB9wLXc.js} +1 -1
  164. package/dist/client/assets/{settings-layout-Ch199aiR.js → settings-layout-C0ekeOOv.js} +1 -1
  165. package/dist/client/assets/{settings-section-CC-4Jtnh.js → settings-section-ZxnBfBdb.js} +1 -1
  166. package/dist/client/assets/{shell-controls-B4QWth0f.js → shell-controls-CWv-6pxT.js} +1 -1
  167. package/dist/client/assets/{shell-layout-CoLLzn9H.js → shell-layout-B3ubQVJp.js} +1 -1
  168. package/dist/client/assets/{sidebar-BdJCwNma.js → sidebar-Bmfjcji7.js} +1 -1
  169. package/dist/client/assets/{skeleton--YzuGfHz.js → skeleton-DYsdfnWI.js} +1 -1
  170. package/dist/client/assets/{sso-BMhbiV6W.js → sso-DxE0pH8a.js} +1 -1
  171. package/dist/client/assets/{store-CiVH2RIN.js → store-DQtXE3rO.js} +1 -1
  172. package/dist/client/assets/store-registry-DJ5jwwgh.js +2 -0
  173. package/dist/client/assets/{studio-tools-B1kdyH0X.js → studio-tools-CZ0lHHg8.js} +1 -1
  174. package/dist/client/assets/{switch-2of9e1Pf.js → switch-C8NVFCle.js} +1 -1
  175. package/dist/client/assets/{table-BwYfp4B-.js → table-rrhMpufJ.js} +1 -1
  176. package/dist/client/assets/{tabs-CVlUtRmS.js → tabs-Zz7_UEQN.js} +1 -1
  177. package/dist/client/assets/{textarea-Dbhv6rS_.js → textarea-Q9mIBUV-.js} +1 -1
  178. package/dist/client/assets/{toggle-group-Di2SNh_L.js → toggle-group-B8ZzagA8.js} +1 -1
  179. package/dist/client/assets/{toolbar-tptVGV-T.js → toolbar-1oJVDPdM.js} +1 -1
  180. package/dist/client/assets/{toolbar-icon-button-iNad5FK0.js → toolbar-icon-button-CqHN6MBe.js} +1 -1
  181. package/dist/client/assets/{tooltip-9cwJhSFd.js → tooltip-lvzwcxmr.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-CmTPM2dv.js → use-ai-providers-DLA17X4H.js} +1 -1
  183. package/dist/client/assets/{use-api-keys-Cu8rjQnp.js → use-api-keys-ZZNQlaQa.js} +1 -1
  184. package/dist/client/assets/{use-automations-D40MTJOG.js → use-automations-CtAoOh2g.js} +1 -1
  185. package/dist/client/assets/{use-autosave-Q8T9bi5T.js → use-autosave-Dj0woe8W.js} +1 -1
  186. package/dist/client/assets/{use-capability-fPLq6YoG.js → use-capability-x07oRB_v.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-JBKdZGDh.js → use-clock-tick-Cdnpjga1.js} +1 -1
  188. package/dist/client/assets/{use-collections-CV_TsUFs.js → use-collections-DJ2e88Xq.js} +1 -1
  189. package/dist/client/assets/{use-connection-BRQu0PKf.js → use-connection-CawdsRuN.js} +1 -1
  190. package/dist/client/assets/{use-copy-CMH3YN5-.js → use-copy-aPelM9gN.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-g467HJAl.js → use-create-virtual-mcp-D42LRs4W.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-sUGnSDUu.js → use-debounced-autosave-D46G2Nb3.js} +1 -1
  193. package/dist/client/assets/{use-debounced-value-CfrD-Ttf.js → use-debounced-value-U6TK_cAJ.js} +1 -1
  194. package/dist/client/assets/{use-deco-credits-CcbI-TH5.js → use-deco-credits-tLUAgc-O.js} +1 -1
  195. package/dist/client/assets/{use-decopilot-events-dX9WsnUS.js → use-decopilot-events-zHZ5c1US.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-Clb2-JR1.js → use-delete-connection-B0eSidiK.js} +1 -1
  197. package/dist/client/assets/{use-deployment-admin-DEQXPunY.js → use-deployment-admin-C0wf5iR9.js} +1 -1
  198. package/dist/client/assets/{use-file-configs-CfqRNUzP.js → use-file-configs-D6OQvi29.js} +1 -1
  199. package/dist/client/assets/{use-infinite-scroll-BonCf-uW.js → use-infinite-scroll-DgeL9DrI.js} +1 -1
  200. package/dist/client/assets/{use-join-requests-Bj_cRaW0.js → use-join-requests-DYt3ADmT.js} +1 -1
  201. package/dist/client/assets/{use-mcp-auth-status-CLvmNhzR.js → use-mcp-auth-status-mlZiRJgT.js} +1 -1
  202. package/dist/client/assets/{use-mcp-client-BDydpGXC.js → use-mcp-client-CAtCw6yl.js} +1 -1
  203. package/dist/client/assets/{use-mcp-tools-u68duyZ2.js → use-mcp-tools-BkyW84hu.js} +1 -1
  204. package/dist/client/assets/{use-members-8JQgnpEk.js → use-members-BPomUDuY.js} +1 -1
  205. package/dist/client/assets/{use-mobile-DC-H7nsJ.js → use-mobile-D0KrjV8M.js} +1 -1
  206. package/dist/client/assets/{use-navigate-to-agent-BxZflEOw.js → use-navigate-to-agent-CYMIGICl.js} +1 -1
  207. package/dist/client/assets/{use-org-auth-client-DrxeOGQ4.js → use-org-auth-client-BY7CXLsN.js} +1 -1
  208. package/dist/client/assets/{use-org-sso-BosEp_Ab.js → use-org-sso-BNL5m012.js} +1 -1
  209. package/dist/client/assets/{use-organization-roles-ChAylB-B.js → use-organization-roles-DP7VZAnw.js} +1 -1
  210. package/dist/client/assets/{use-organization-settings-B2unqpKQ.js → use-organization-settings-Btln8Py9.js} +1 -1
  211. package/dist/client/assets/{use-registry-app-CHS0S4YQ.js → use-registry-app-DGmz0d5i.js} +1 -1
  212. package/dist/client/assets/{use-registry-connections-TAn2JTW7.js → use-registry-connections-BNAx72pz.js} +1 -1
  213. package/dist/client/assets/{use-secrets-BwDhV9o1.js → use-secrets-Brx7T76W.js} +1 -1
  214. package/dist/client/assets/{use-status-sounds-DLYR4WdM.js → use-status-sounds-WASJAR7W.js} +1 -1
  215. package/dist/client/assets/{use-t-BGNaKfJX.js → use-t-Ca0ZB4W6.js} +1 -1
  216. package/dist/client/assets/{use-view-mode-DPa-2KX2.js → use-view-mode-CcZjEdUn.js} +1 -1
  217. package/dist/client/assets/{use-virtual-mcp-Zb-pycz2.js → use-virtual-mcp--wK0dI9I.js} +1 -1
  218. package/dist/client/assets/useInfiniteQuery-BT7hVNXg.js +1 -0
  219. package/dist/client/assets/{useRouterState-Cgc6JWBa.js → useRouterState-G26gh0wT.js} +1 -1
  220. package/dist/client/assets/useSuspenseInfiniteQuery-CIkQZwY0.js +1 -0
  221. package/dist/client/assets/{users-Cvx3FCBd.js → users-Cd08kHgh.js} +1 -1
  222. package/dist/client/assets/{variant-calendar-BdY0lXCO.js → variant-calendar-DuJ3EROs.js} +1 -1
  223. package/dist/client/assets/{view-mode-toggle-2HIAhZ9T.js → view-mode-toggle-IMXhdpcC.js} +1 -1
  224. package/dist/client/index.html +1 -1
  225. package/dist/server/cli.js +1 -1
  226. package/dist/server/server.js +1 -1
  227. package/package.json +1 -1
  228. package/dist/client/assets/page-seo-sheet-Cfwy2L4k.js +0 -1
  229. package/dist/client/assets/project-app-view-DxgfMS4y.js +0 -1
  230. package/dist/client/assets/record-editor-otSX7UwZ.js +0 -1
  231. package/dist/client/assets/redirect-editor-CC92-3j9.js +0 -1
  232. package/dist/client/assets/registry-BvkHxKgI.js +0 -2
  233. package/dist/client/assets/store-registry-CkfO8nd-.js +0 -2
  234. package/dist/client/assets/useInfiniteQuery-RcsnwPkt.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-DKEXqmd5.js +0 -1
@@ -1 +1 @@
1
- import{c as ie,j as s,B as J,C as ce,n as fe,a as he,r as K,m as ge,K as ee,d as xe,p as $,t as te,l as je}from"./index-BtvbO-YY.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-CS4ITtQz.js";import{a as be}from"./Users03-sWa9-yJE.js";import{G as me}from"./use-registry-app-CHS0S4YQ.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp-Zb-pycz2.js";import{P as X}from"./index-DgiImAyY.js";import{i as _e}from"./DotsVertical-DCjclS0s.js";import{a as Ne,b as Se}from"./Settings02-CNqO4CPf.js";import{s as ve}from"./Trash01-qeRcmh_t.js";import{A as Ie,aL as De}from"./agent-icon-yglVWNMq.js";import{c as ue}from"./use-navigate-to-agent-BxZflEOw.js";import{C as Ae}from"./card-BFaEMAcD.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-fPLq6YoG.js";import{E as Te}from"./empty-state-BKVeh2JK.js";import{u as ke}from"./use-create-virtual-mcp-g467HJAl.js";import{u as Le}from"./use-connection-BRQu0PKf.js";import{u as re,S as Ge}from"./use-mcp-client-BDydpGXC.js";import{u as Oe,G as Pe}from"./github-repo-picker-BDoqlkEl.js";import{g as ze}from"./github-repo-scope-DjMZbiKa.js";import{f as Me,a as $e,p as He}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as Fe,d as Re,D as Ue,a as Be,c as Ve}from"./dialog-BhHo_8aX.js";import{C as Ke}from"./collection-search-C26mO7tt.js";import{c as qe,b as Qe,d as Je,A as We,e as Ye,g as Xe,a as Ze,f as et}from"./alert-dialog-DFT5_7dO.js";import{S as tt}from"./search-input-CPAXCLRZ.js";import{s as le}from"./Plus-B9C9Hujd.js";import"./Check-L1zt1MhQ.js";import"./ChevronRight-DjxxY9yH.js";import"./use-mcp-tools-u68duyZ2.js";import"./use-collections-CV_TsUFs.js";import"./sidebar-BdJCwNma.js";import"./LayoutLeft-D1i_m16o.js";import"./use-mobile-DC-H7nsJ.js";import"./X-BYK4muxp.js";import"./tooltip-9cwJhSFd.js";import"./AlertCircle-CdaQFqHl.js";import"./Tool01-CGUbJHe6.js";import"./ArrowUp-_a-SRtGc.js";import"./Tool02-yWUlg2Jl.js";import"./ArrowRight-Cov2YPeB.js";import"./ArrowUpRight-DJyks9HV.js";import"./TrendUp01-C15jO-JN.js";import"./ZapSquare-BO7N9q2-.js";import"./ZoomOut-CejWxeXb.js";import"./CheckCircle-MzaIveO0.js";import"./ChevronDown-ste9rvwa.js";import"./ChevronUp-BMKp68Ef.js";import"./Stars02-BDaM006Z.js";import"./Copy01-LCLhyD88.js";import"./Globe01-DTnpQEvE.js";import"./Eye-DfJI2F2R.js";import"./FilterLines-BqkGYn3N.js";import"./Star01-Cc38MZxO.js";import"./Globe04-CWIUsgNy.js";import"./SwitchHorizontal01-BfOiWCGP.js";import"./HardDrive-CalrZSFc.js";import"./Image01-SH1T61tk.js";import"./Key01-n8lq21nZ.js";import"./XCircle-DQ0bT2Xh.js";import"./LinkExternal01-BnAWWVH2.js";import"./Monitor01-WjwD_B76.js";import"./Sun-DuSRYQOH.js";import"./Package-NScsE20z.js";import"./Palette-Dq9W8WsR.js";import"./Play-DwFJH11i.js";import"./SearchLg-C07Q8QRW.js";import"./SearchMd-DP6rSkG4.js";import"./Shield01-qRQ0B-Cf.js";import"./Stars01-DFWKWgNe.js";import"./Upload01-DUtmbuEn.js";import"./User01-BwTr9f5y.js";import"./Users01-7br16I2u.js";import"./XClose-Djg48M2y.js";import"./Zap-BIGnAJhj.js";import"./hooks-D4wZCWx0.js";import"./decopilot-sse-pool-Czpmu6TG.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-BZr8EHmi.js";import"./use-debounced-value-CfrD-Ttf.js";import"./authenticate-and-persist-oauth-CpPUo5MX.js";import"./mcp-oauth-c9yHY2lN.js";import"./extract-connection-data-C_u7UnJF.js";function ae(t){const e=ie.c(19),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:l,isCreating:b,align:C,side:d,showBetaBadge:g}=t,y=C===void 0?"end":C;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(be,{size:14}),e[0]=x):x=e[0];let m;e[1]!==b||e[2]!==i?(m=s.jsxs(Y,{disabled:b,onClick:i,children:[x,"Create from scratch"]}),e[1]=b,e[2]=i,e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(me,{className:"size-3.5"}),e[4]=f):f=e[4];let a;e[5]!==g?(a=g&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[5]=g,e[6]=a):a=e[6];let h;e[7]!==n||e[8]!==a?(h=s.jsxs(Y,{onClick:n,children:[f,"Import from GitHub",a]}),e[7]=n,e[8]=a,e[9]=h):h=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[10]=c):c=e[10];let r;e[11]!==l?(r=s.jsxs(Y,{onClick:l,children:[c,"Import from deco.cx"]}),e[11]=l,e[12]=r):r=e[12];let u;return e[13]!==y||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==r?(u=s.jsxs(de,{side:d,align:y,className:"w-48",children:[m,h,r]}),e[13]=y,e[14]=d,e[15]=m,e[16]=h,e[17]=r,e[18]=u):u=e[18],u}function st(t){const e=ie.c(45),{project:i,lastUsedAt:n,onDeleteClick:l}=t,b=ue();let C;e[0]!==b||e[1]!==i.id?(C=()=>b(i.id),e[0]=b,e[1]=i.id,e[2]=C):C=e[2];let d;e[3]!==i.title||e[4]!==C?(d=s.jsx("button",{type:"button",onClick:C,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=C,e[5]=d):d=e[5];let g;e[6]!==i.icon||e[7]!==i.title?(g=s.jsx(Ie,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=g):g=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(_e,{size:20})})}),e[9]=y):y=e[9];let x;e[10]!==b||e[11]!==i.id?(x=()=>b(i.id,{search:{main:"settings"}}),e[10]=b,e[11]=i.id,e[12]=x):x=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Ne,{size:16}),e[13]=m):m=e[13];let f;e[14]!==x?(f=s.jsxs(Y,{onClick:x,children:[m,"Settings"]}),e[14]=x,e[15]=f):f=e[15];let a;e[16]!==l?(a=l&&s.jsxs(Y,{variant:"destructive",onClick:L=>{L.stopPropagation(),l(L)},children:[s.jsx(ve,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let h;e[18]!==f||e[19]!==a?(h=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(oe,{children:[y,s.jsxs(de,{align:"end",children:[f,a]})]})}),e[18]=f,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==g||e[22]!==h?(c=s.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[21]=g,e[22]=h,e[23]=c):c=e[23];let r;e[24]!==i.title?(r=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=r):r=e[25];const u=i.description||"No description";let I;e[26]!==u?(I=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:u}),e[26]=u,e[27]=I):I=e[27];let D;e[28]!==r||e[29]!==I?(D=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,I]}),e[28]=r,e[29]=I,e[30]=D):D=e[30];let w;e[31]!==c||e[32]!==D?(w=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,D]}),e[31]=c,e[32]=D,e[33]=w):w=e[33];let E;e[34]!==n||e[35]!==i.updated_at?(E=n?`Last used ${ne(new Date(n),{addSuffix:!0})}`:`Updated ${ne(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=n,e[35]=i.updated_at,e[36]=E):E=e[36];let N;e[37]!==E?(N=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})})}),e[37]=E,e[38]=N):N=e[38];let T;e[39]!==w||e[40]!==N?(T=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[w,N]}),e[39]=w,e[40]=N,e[41]=T):T=e[41];let S;return e[42]!==T||e[43]!==d?(S=s.jsxs(Ae,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[d,T]}),e[42]=T,e[43]=d,e[44]=S):S=e[44],S}const ot="deco-sites";function it(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const i=e.owner,n=e.repo;return typeof i!="string"||typeof n!="string"||i.length===0||n.length===0?null:{owner:i,repo:n}}function nt(t,e){const i=e?it(e):null,n=i?.owner??ot,l=i?.repo??t;return{owner:n,name:l,url:`https://github.com/${n}/${l}`}}function rt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function pe(t,e,i){const n=await fetch(t,e),l=await n.json().catch(()=>({}));if(!n.ok)throw new Error(l.error??`${i} (${n.status})`);return l}function lt(t){return pe(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function at({open:t,onOpenChange:e,onBack:i}){const{org:n}=ce(),l=ue(),b=fe(),{data:C}=he.useSession(),[d,g]=K.useState(null),[y,x]=K.useState(null),[m,f]=K.useState(""),a=re({connectionId:Ge,orgId:n.id,orgSlug:n.slug}),h=Le({slug:"mcp-github"}),c=ze(h),r=Oe({enabled:t&&c.length===0}),u=c.length===1?c[0]??null:y,I=c.length>1&&!u,D=re({connectionId:u?.id??"",orgId:n.id,orgSlug:n.slug}),w=t&&c.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:E,isLoading:N,error:T}=ge({queryKey:ee.decoSites(C?.user?.email),queryFn:()=>lt(n.slug),enabled:t&&!!C?.user?.email,staleTime:6e4,retry:!1}),S=E?.sites??[],L=o=>{o||(g(null),x(null),f("")),e(o)},P=S.filter(o=>o.name.toLowerCase().includes(m.toLowerCase())||(o.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),R=!d||P.some(o=>o.name===d),G=xe({mutationFn:async o=>{if(!u)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");$("deco_site_import_started",{site_name:o});const{installations:k,appSlug:v}=await Me(_=>a.callTool(_),u.id),A=S.find(_=>_.name===o);if(!A)throw new Error("Selected site is no longer available");const j=nt(o,A.metadata),z=$e(k,j.owner);if(!z){const _=v?`https://github.com/apps/${v}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${j.owner}" organization to import this site. ${_}`)}let V=null,U=null,B=null;const W=async()=>{B&&await a.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:B}}).catch(()=>{}),U&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:U,force:!0}}).catch(()=>{}),V&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:V,force:!0}}).catch(()=>{})};try{const _=await pe(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:o})},"Failed to create connection"),O=_.connId;if(!O)throw new Error("Server did not return a connection ID");V=O;const{childConnectionId:M}=await He({orgSlug:n.slug,sourceConnection:u,installationId:z.installationId,owner:j.owner,repo:j.name,githubCallTool:Z=>D.callTool(Z),selfCallTool:Z=>a.callTool(Z)});U=M;const H=_.icon??null,F=rt(o),q=o.toLowerCase(),p=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o,description:"Imported from deco.cx",pinned:!1,icon:H??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:q,githubRepo:{owner:j.owner,name:j.name,url:j.url,installationId:z.installationId,connectionId:M},ui:{banner:null,bannerColor:"#22C55E",icon:H,themeColor:"#22C55E",slug:F,pinnedViews:[{connectionId:O,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:O,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:O},{connection_id:M}]}}}),Q=p.structuredContent??p;if(!Q.item?.id)throw new Error("Failed to create the imported agent");return B=Q.item.id,{slug:F,virtualMcpId:Q.item.id,connId:O,item:Q.item}}catch(_){throw await W(),_}},onSuccess:({slug:o,virtualMcpId:k,item:v})=>{$("deco_site_import_succeeded",{site_name:v.title,virtual_mcp_id:k,slug:o}),b.setQueryData(ee.collectionItem(a,n.id,"","VIRTUAL_MCP",k),{item:v}),b.invalidateQueries({predicate:A=>{const j=A.queryKey;return j[1]===n.id&&j[3]==="collection"&&j[4]==="VIRTUAL_MCP"}}),b.invalidateQueries({queryKey:ee.projects(n.id)}),te.success(`Imported ${o} from deco.cx`),L(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(k)},onError:o=>{$("deco_site_import_failed",{error:o instanceof Error?o.message:"Unknown error"}),te.error("Import failed: "+(o instanceof Error?o.message:"Unknown error"))}});return s.jsx(Fe,{open:t,onOpenChange:L,children:s.jsxs(Re,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[s.jsx(Ue,{className:"sr-only",children:s.jsx(Be,{children:"Import from deco.cx"})}),s.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:s.jsx(Se,{size:18})}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),s.jsx("div",{children:s.jsx(Ke,{value:m,onChange:f,placeholder:"Search sites...",onKeyDown:o=>{o.key==="Escape"&&f("")}})}),s.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),s.jsx(J,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),I&&!w&&r.status!=="error"&&s.jsxs("div",{className:"flex flex-col py-2",children:[s.jsx("div",{className:"px-8 py-2",children:s.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),c.map(o=>s.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?s.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):s.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(me,{className:"size-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}),N&&!w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!N&&!w&&!I&&r.status!=="error"&&!T&&S.length===0&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!N&&!w&&!I&&r.status!=="error"&&S.length>0&&s.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:[P.length===0&&s.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",m,"”"]}),P.map(o=>{const k=o.domains?.find(A=>A.production)?.domain??o.domains?.[0]?.domain,v=d===o.name;return s.jsxs("button",{type:"button",onClick:()=>g(o.name),className:je("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",v?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[s.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:o.thumb_url?s.jsx("img",{src:o.thumb_url,alt:o.name,className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-muted"})}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),k&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:k})]})]},o.name)})]})]}),s.jsxs(Ve,{className:"px-8 py-5 border-t border-border",children:[s.jsx(J,{variant:"outline",onClick:()=>L(!1),disabled:G.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||G.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&G.mutate(d),children:G.isPending?"Importing...":"Import"})]})]})})}function Fs(){const t=ie.c(46),{org:e}=ce(),i=Ce(),n=ye(),[l,b]=K.useState("");let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},t[0]=C):C=t[0];const{createVirtualMCP:d,isCreating:g}=ke(C),[y,x]=K.useState(null),[m,f]=K.useState(!1),[a,h]=K.useState(!1),{granted:c}=Ee("agents:manage"),r=l.toLowerCase(),u=i.filter(p=>p.id!==e.id&&(p.title.toLowerCase().includes(r)||p.description?.toLowerCase().includes(r))),{data:I}=we(u.map(ct));let D;t[1]!==n||t[2]!==y?(D=async()=>{if(!y)return;const{id:p,title:Q}=y;x(null);try{await n.delete.mutateAsync(p),$("agent_deleted",{agent_id:p,source:"agents_list"}),te.success(`Deleted "${Q}"`)}catch{}},t[1]=n,t[2]=y,t[3]=D):D=t[3];const w=D,E=X,N=X,T=X;let S;t[4]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(X.Title,{children:"Agents"}),t[4]=S):S=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=L):L=t[5];let P;t[6]!==l?(P=s.jsx(tt,{value:l,onChange:b,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=P):P=t[7];let R;t[8]!==c||t[9]!==d||t[10]!==g?(R=c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list",method:"deco"}),f(!0)},isCreating:g,align:"end"})]}),t[8]=c,t[9]=d,t[10]=g,t[11]=R):R=t[11];let G;t[12]!==P||t[13]!==R?(G=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[P,R]})]}),t[12]=P,t[13]=R,t[14]=G):G=t[14];const o=u.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(De,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),f(!0)},isCreating:g,align:"center",showBetaBadge:!0})]})})}),k=u.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:u.map(p=>s.jsx(st,{project:p,lastUsedAt:I?.get(p.id)?.last_used_at,onDeleteClick:c?()=>x({id:p.id,title:p.title}):void 0},p.id))})]});let v;t[15]!==k||t[16]!==T.Body||t[17]!==G||t[18]!==o?(v=s.jsxs(T.Body,{children:[G,o,k]}),t[15]=k,t[16]=T.Body,t[17]=G,t[18]=o,t[19]=v):v=t[19];let A;t[20]!==v||t[21]!==N.Content?(A=s.jsx(N.Content,{children:v}),t[20]=v,t[21]=N.Content,t[22]=A):A=t[22];let j;t[23]!==a?(j=s.jsx(Pe,{open:a,onOpenChange:h}),t[23]=a,t[24]=j):j=t[24];let z;t[25]!==m?(z=s.jsx(at,{open:m,onOpenChange:f}),t[25]=m,t[26]=z):z=t[26];const V=!!y;let U;t[27]===Symbol.for("react.memo_cache_sentinel")?(U=p=>!p&&x(null),t[27]=U):U=t[27];let B;t[28]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qe,{children:"Delete Agent?"}),t[28]=B):B=t[28];const W=y?.title;let _;t[29]!==W?(_=s.jsxs(Qe,{children:[B,s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),t[29]=W,t[30]=_):_=t[30];let O;t[31]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(We,{children:"Cancel"}),t[31]=O):O=t[31];let M;t[32]!==w?(M=s.jsxs(Ye,{children:[O,s.jsx(Xe,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[32]=w,t[33]=M):M=t[33];let H;t[34]!==_||t[35]!==M?(H=s.jsxs(Ze,{children:[_,M]}),t[34]=_,t[35]=M,t[36]=H):H=t[36];let F;t[37]!==V||t[38]!==H?(F=s.jsx(et,{open:V,onOpenChange:U,children:H}),t[37]=V,t[38]=H,t[39]=F):F=t[39];let q;return t[40]!==E||t[41]!==A||t[42]!==j||t[43]!==z||t[44]!==F?(q=s.jsxs(E,{children:[A,j,z,F]}),t[40]=E,t[41]=A,t[42]=j,t[43]=z,t[44]=F,t[45]=q):q=t[45],q}function ct(t){return t.id}export{Fs as default};
1
+ import{c as ie,j as s,B as J,C as ce,n as fe,a as he,r as K,m as ge,K as ee,d as xe,p as $,t as te,l as je}from"./index-CfAl6qA3.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-D3W9Mypw.js";import{a as be}from"./Users03-Bg-uyP8J.js";import{G as me}from"./use-registry-app-DGmz0d5i.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp--wK0dI9I.js";import{P as X}from"./index-B72iIhnj.js";import{i as _e}from"./DotsVertical-9e8whEmO.js";import{a as Ne,b as Se}from"./Settings02-CoD4T3JT.js";import{s as ve}from"./Trash01-CFIi5PAY.js";import{A as Ie,aL as De}from"./agent-icon-kMrNxjYJ.js";import{c as ue}from"./use-navigate-to-agent-CYMIGICl.js";import{C as Ae}from"./card-CxpjTUKu.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-x07oRB_v.js";import{E as Te}from"./empty-state-B0XUVWqe.js";import{u as ke}from"./use-create-virtual-mcp-D42LRs4W.js";import{u as Le}from"./use-connection-CawdsRuN.js";import{u as re,S as Ge}from"./use-mcp-client-CAtCw6yl.js";import{u as Oe,G as Pe}from"./github-repo-picker-qhKlxIkP.js";import{g as ze}from"./github-repo-scope-DjMZbiKa.js";import{f as Me,a as $e,p as He}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as Fe,d as Re,D as Ue,a as Be,c as Ve}from"./dialog-B8iPXZfB.js";import{C as Ke}from"./collection-search-DZDCl18y.js";import{c as qe,b as Qe,d as Je,A as We,e as Ye,g as Xe,a as Ze,f as et}from"./alert-dialog-lT11Jsbj.js";import{S as tt}from"./search-input-DzbdykkS.js";import{s as le}from"./Plus-CpvaryXc.js";import"./Check-xlx8bieA.js";import"./ChevronRight-HByc-_dD.js";import"./use-mcp-tools-BkyW84hu.js";import"./use-collections-DJ2e88Xq.js";import"./sidebar-Bmfjcji7.js";import"./LayoutLeft-BXx4559W.js";import"./use-mobile-D0KrjV8M.js";import"./X-B9OMbRgI.js";import"./tooltip-lvzwcxmr.js";import"./AlertCircle-8aL2p4Jm.js";import"./Tool01-F8NWFSUY.js";import"./ArrowUp-BRv6jMcd.js";import"./Tool02-CYQFsqUw.js";import"./ArrowRight-BmTkQdSS.js";import"./ArrowUpRight-DgWDf4bB.js";import"./TrendUp01-B11vKIzx.js";import"./ZapSquare-NmRRaYpN.js";import"./ZoomOut-Bjuv5wtp.js";import"./CheckCircle-BhHr7P8S.js";import"./ChevronDown-z_OgoJuG.js";import"./ChevronUp-C0dubflE.js";import"./Stars02-wl-TgjVw.js";import"./Copy01-BhLnIcPa.js";import"./Globe01-C1OI0rNn.js";import"./Eye-Dmrq3Yx3.js";import"./FilterLines-LxfJFt1s.js";import"./Star01-B_ldc-QG.js";import"./Globe04-D37KO3Rl.js";import"./SwitchHorizontal01-BjhVVVE7.js";import"./HardDrive-xaUFGQWK.js";import"./Image01-D2MElAgS.js";import"./Key01-CJ4v8ToT.js";import"./XCircle-z2zpbAQl.js";import"./LinkExternal01-RdFrwyl0.js";import"./Monitor01-ByOW8gCA.js";import"./Sun-DcglW2RF.js";import"./Package-BApyVZZF.js";import"./Palette-gwCbQEVd.js";import"./Play-CRcD5urt.js";import"./SearchLg-BLbYMh4R.js";import"./SearchMd-BbTMkDIb.js";import"./Shield01-BSQ914Nd.js";import"./Stars01-BEQN6TZj.js";import"./Upload01-CYv9Q0Sh.js";import"./User01-BHW_CvWq.js";import"./Users01-CVvGtppm.js";import"./XClose-Bvx5TP10.js";import"./Zap-CaoQpAZT.js";import"./hooks-QkqjVdn8.js";import"./decopilot-sse-pool-DWXTDK7c.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-CaW_gj1t.js";import"./use-debounced-value-U6TK_cAJ.js";import"./authenticate-and-persist-oauth-jkSUOcu8.js";import"./mcp-oauth-C3_4QnQD.js";import"./extract-connection-data-ChcGsUj8.js";function ae(t){const e=ie.c(19),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:l,isCreating:b,align:C,side:d,showBetaBadge:g}=t,y=C===void 0?"end":C;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(be,{size:14}),e[0]=x):x=e[0];let m;e[1]!==b||e[2]!==i?(m=s.jsxs(Y,{disabled:b,onClick:i,children:[x,"Create from scratch"]}),e[1]=b,e[2]=i,e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(me,{className:"size-3.5"}),e[4]=f):f=e[4];let a;e[5]!==g?(a=g&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[5]=g,e[6]=a):a=e[6];let h;e[7]!==n||e[8]!==a?(h=s.jsxs(Y,{onClick:n,children:[f,"Import from GitHub",a]}),e[7]=n,e[8]=a,e[9]=h):h=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[10]=c):c=e[10];let r;e[11]!==l?(r=s.jsxs(Y,{onClick:l,children:[c,"Import from deco.cx"]}),e[11]=l,e[12]=r):r=e[12];let u;return e[13]!==y||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==r?(u=s.jsxs(de,{side:d,align:y,className:"w-48",children:[m,h,r]}),e[13]=y,e[14]=d,e[15]=m,e[16]=h,e[17]=r,e[18]=u):u=e[18],u}function st(t){const e=ie.c(45),{project:i,lastUsedAt:n,onDeleteClick:l}=t,b=ue();let C;e[0]!==b||e[1]!==i.id?(C=()=>b(i.id),e[0]=b,e[1]=i.id,e[2]=C):C=e[2];let d;e[3]!==i.title||e[4]!==C?(d=s.jsx("button",{type:"button",onClick:C,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=C,e[5]=d):d=e[5];let g;e[6]!==i.icon||e[7]!==i.title?(g=s.jsx(Ie,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=g):g=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(_e,{size:20})})}),e[9]=y):y=e[9];let x;e[10]!==b||e[11]!==i.id?(x=()=>b(i.id,{search:{main:"settings"}}),e[10]=b,e[11]=i.id,e[12]=x):x=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Ne,{size:16}),e[13]=m):m=e[13];let f;e[14]!==x?(f=s.jsxs(Y,{onClick:x,children:[m,"Settings"]}),e[14]=x,e[15]=f):f=e[15];let a;e[16]!==l?(a=l&&s.jsxs(Y,{variant:"destructive",onClick:L=>{L.stopPropagation(),l(L)},children:[s.jsx(ve,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let h;e[18]!==f||e[19]!==a?(h=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(oe,{children:[y,s.jsxs(de,{align:"end",children:[f,a]})]})}),e[18]=f,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==g||e[22]!==h?(c=s.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[21]=g,e[22]=h,e[23]=c):c=e[23];let r;e[24]!==i.title?(r=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=r):r=e[25];const u=i.description||"No description";let I;e[26]!==u?(I=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:u}),e[26]=u,e[27]=I):I=e[27];let D;e[28]!==r||e[29]!==I?(D=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,I]}),e[28]=r,e[29]=I,e[30]=D):D=e[30];let w;e[31]!==c||e[32]!==D?(w=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,D]}),e[31]=c,e[32]=D,e[33]=w):w=e[33];let E;e[34]!==n||e[35]!==i.updated_at?(E=n?`Last used ${ne(new Date(n),{addSuffix:!0})}`:`Updated ${ne(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=n,e[35]=i.updated_at,e[36]=E):E=e[36];let N;e[37]!==E?(N=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})})}),e[37]=E,e[38]=N):N=e[38];let T;e[39]!==w||e[40]!==N?(T=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[w,N]}),e[39]=w,e[40]=N,e[41]=T):T=e[41];let S;return e[42]!==T||e[43]!==d?(S=s.jsxs(Ae,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[d,T]}),e[42]=T,e[43]=d,e[44]=S):S=e[44],S}const ot="deco-sites";function it(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const i=e.owner,n=e.repo;return typeof i!="string"||typeof n!="string"||i.length===0||n.length===0?null:{owner:i,repo:n}}function nt(t,e){const i=e?it(e):null,n=i?.owner??ot,l=i?.repo??t;return{owner:n,name:l,url:`https://github.com/${n}/${l}`}}function rt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function pe(t,e,i){const n=await fetch(t,e),l=await n.json().catch(()=>({}));if(!n.ok)throw new Error(l.error??`${i} (${n.status})`);return l}function lt(t){return pe(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function at({open:t,onOpenChange:e,onBack:i}){const{org:n}=ce(),l=ue(),b=fe(),{data:C}=he.useSession(),[d,g]=K.useState(null),[y,x]=K.useState(null),[m,f]=K.useState(""),a=re({connectionId:Ge,orgId:n.id,orgSlug:n.slug}),h=Le({slug:"mcp-github"}),c=ze(h),r=Oe({enabled:t&&c.length===0}),u=c.length===1?c[0]??null:y,I=c.length>1&&!u,D=re({connectionId:u?.id??"",orgId:n.id,orgSlug:n.slug}),w=t&&c.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:E,isLoading:N,error:T}=ge({queryKey:ee.decoSites(C?.user?.email),queryFn:()=>lt(n.slug),enabled:t&&!!C?.user?.email,staleTime:6e4,retry:!1}),S=E?.sites??[],L=o=>{o||(g(null),x(null),f("")),e(o)},P=S.filter(o=>o.name.toLowerCase().includes(m.toLowerCase())||(o.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),R=!d||P.some(o=>o.name===d),G=xe({mutationFn:async o=>{if(!u)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");$("deco_site_import_started",{site_name:o});const{installations:k,appSlug:v}=await Me(_=>a.callTool(_),u.id),A=S.find(_=>_.name===o);if(!A)throw new Error("Selected site is no longer available");const j=nt(o,A.metadata),z=$e(k,j.owner);if(!z){const _=v?`https://github.com/apps/${v}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${j.owner}" organization to import this site. ${_}`)}let V=null,U=null,B=null;const W=async()=>{B&&await a.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:B}}).catch(()=>{}),U&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:U,force:!0}}).catch(()=>{}),V&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:V,force:!0}}).catch(()=>{})};try{const _=await pe(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:o})},"Failed to create connection"),O=_.connId;if(!O)throw new Error("Server did not return a connection ID");V=O;const{childConnectionId:M}=await He({orgSlug:n.slug,sourceConnection:u,installationId:z.installationId,owner:j.owner,repo:j.name,githubCallTool:Z=>D.callTool(Z),selfCallTool:Z=>a.callTool(Z)});U=M;const H=_.icon??null,F=rt(o),q=o.toLowerCase(),p=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o,description:"Imported from deco.cx",pinned:!1,icon:H??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:q,githubRepo:{owner:j.owner,name:j.name,url:j.url,installationId:z.installationId,connectionId:M},ui:{banner:null,bannerColor:"#22C55E",icon:H,themeColor:"#22C55E",slug:F,pinnedViews:[{connectionId:O,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:O,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:O},{connection_id:M}]}}}),Q=p.structuredContent??p;if(!Q.item?.id)throw new Error("Failed to create the imported agent");return B=Q.item.id,{slug:F,virtualMcpId:Q.item.id,connId:O,item:Q.item}}catch(_){throw await W(),_}},onSuccess:({slug:o,virtualMcpId:k,item:v})=>{$("deco_site_import_succeeded",{site_name:v.title,virtual_mcp_id:k,slug:o}),b.setQueryData(ee.collectionItem(a,n.id,"","VIRTUAL_MCP",k),{item:v}),b.invalidateQueries({predicate:A=>{const j=A.queryKey;return j[1]===n.id&&j[3]==="collection"&&j[4]==="VIRTUAL_MCP"}}),b.invalidateQueries({queryKey:ee.projects(n.id)}),te.success(`Imported ${o} from deco.cx`),L(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(k)},onError:o=>{$("deco_site_import_failed",{error:o instanceof Error?o.message:"Unknown error"}),te.error("Import failed: "+(o instanceof Error?o.message:"Unknown error"))}});return s.jsx(Fe,{open:t,onOpenChange:L,children:s.jsxs(Re,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[s.jsx(Ue,{className:"sr-only",children:s.jsx(Be,{children:"Import from deco.cx"})}),s.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:s.jsx(Se,{size:18})}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),s.jsx("div",{children:s.jsx(Ke,{value:m,onChange:f,placeholder:"Search sites...",onKeyDown:o=>{o.key==="Escape"&&f("")}})}),s.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),s.jsx(J,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),I&&!w&&r.status!=="error"&&s.jsxs("div",{className:"flex flex-col py-2",children:[s.jsx("div",{className:"px-8 py-2",children:s.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),c.map(o=>s.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?s.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):s.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(me,{className:"size-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}),N&&!w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!N&&!w&&!I&&r.status!=="error"&&!T&&S.length===0&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!N&&!w&&!I&&r.status!=="error"&&S.length>0&&s.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:[P.length===0&&s.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",m,"”"]}),P.map(o=>{const k=o.domains?.find(A=>A.production)?.domain??o.domains?.[0]?.domain,v=d===o.name;return s.jsxs("button",{type:"button",onClick:()=>g(o.name),className:je("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",v?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[s.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:o.thumb_url?s.jsx("img",{src:o.thumb_url,alt:o.name,className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-muted"})}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),k&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:k})]})]},o.name)})]})]}),s.jsxs(Ve,{className:"px-8 py-5 border-t border-border",children:[s.jsx(J,{variant:"outline",onClick:()=>L(!1),disabled:G.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||G.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&G.mutate(d),children:G.isPending?"Importing...":"Import"})]})]})})}function Fs(){const t=ie.c(46),{org:e}=ce(),i=Ce(),n=ye(),[l,b]=K.useState("");let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},t[0]=C):C=t[0];const{createVirtualMCP:d,isCreating:g}=ke(C),[y,x]=K.useState(null),[m,f]=K.useState(!1),[a,h]=K.useState(!1),{granted:c}=Ee("agents:manage"),r=l.toLowerCase(),u=i.filter(p=>p.id!==e.id&&(p.title.toLowerCase().includes(r)||p.description?.toLowerCase().includes(r))),{data:I}=we(u.map(ct));let D;t[1]!==n||t[2]!==y?(D=async()=>{if(!y)return;const{id:p,title:Q}=y;x(null);try{await n.delete.mutateAsync(p),$("agent_deleted",{agent_id:p,source:"agents_list"}),te.success(`Deleted "${Q}"`)}catch{}},t[1]=n,t[2]=y,t[3]=D):D=t[3];const w=D,E=X,N=X,T=X;let S;t[4]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(X.Title,{children:"Agents"}),t[4]=S):S=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=L):L=t[5];let P;t[6]!==l?(P=s.jsx(tt,{value:l,onChange:b,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=P):P=t[7];let R;t[8]!==c||t[9]!==d||t[10]!==g?(R=c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list",method:"deco"}),f(!0)},isCreating:g,align:"end"})]}),t[8]=c,t[9]=d,t[10]=g,t[11]=R):R=t[11];let G;t[12]!==P||t[13]!==R?(G=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[P,R]})]}),t[12]=P,t[13]=R,t[14]=G):G=t[14];const o=u.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(De,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),f(!0)},isCreating:g,align:"center",showBetaBadge:!0})]})})}),k=u.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:u.map(p=>s.jsx(st,{project:p,lastUsedAt:I?.get(p.id)?.last_used_at,onDeleteClick:c?()=>x({id:p.id,title:p.title}):void 0},p.id))})]});let v;t[15]!==k||t[16]!==T.Body||t[17]!==G||t[18]!==o?(v=s.jsxs(T.Body,{children:[G,o,k]}),t[15]=k,t[16]=T.Body,t[17]=G,t[18]=o,t[19]=v):v=t[19];let A;t[20]!==v||t[21]!==N.Content?(A=s.jsx(N.Content,{children:v}),t[20]=v,t[21]=N.Content,t[22]=A):A=t[22];let j;t[23]!==a?(j=s.jsx(Pe,{open:a,onOpenChange:h}),t[23]=a,t[24]=j):j=t[24];let z;t[25]!==m?(z=s.jsx(at,{open:m,onOpenChange:f}),t[25]=m,t[26]=z):z=t[26];const V=!!y;let U;t[27]===Symbol.for("react.memo_cache_sentinel")?(U=p=>!p&&x(null),t[27]=U):U=t[27];let B;t[28]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qe,{children:"Delete Agent?"}),t[28]=B):B=t[28];const W=y?.title;let _;t[29]!==W?(_=s.jsxs(Qe,{children:[B,s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),t[29]=W,t[30]=_):_=t[30];let O;t[31]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(We,{children:"Cancel"}),t[31]=O):O=t[31];let M;t[32]!==w?(M=s.jsxs(Ye,{children:[O,s.jsx(Xe,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[32]=w,t[33]=M):M=t[33];let H;t[34]!==_||t[35]!==M?(H=s.jsxs(Ze,{children:[_,M]}),t[34]=_,t[35]=M,t[36]=H):H=t[36];let F;t[37]!==V||t[38]!==H?(F=s.jsx(et,{open:V,onOpenChange:U,children:H}),t[37]=V,t[38]=H,t[39]=F):F=t[39];let q;return t[40]!==E||t[41]!==A||t[42]!==j||t[43]!==z||t[44]!==F?(q=s.jsxs(E,{children:[A,j,z,F]}),t[40]=E,t[41]=A,t[42]=j,t[43]=z,t[44]=F,t[45]=q):q=t[45],q}function ct(t){return t.id}export{Fs as default};
@@ -1 +1 @@
1
- import{H as se,I as D,ad as Ae,af as we,ag as Ue,ae as He,b3 as Fe,c as X,J as qe,M as ze,r as J,j as s,ah as rt,t as re,aL as Be,C as Ie,n as De,d as je,K as ie,m as Le,l as Te,B as te,p as Ve,E as ot}from"./index-BtvbO-YY.js";import{i as nt}from"./AlertCircle-CdaQFqHl.js";import{P as ke}from"./index-DgiImAyY.js";import{S as Me}from"./skeleton--YzuGfHz.js";import{b as Qe,a as Ee,S as Re,c as at}from"./settings-section-CC-4Jtnh.js";import{u as Se,a as Pe,b as Ge}from"./use-ai-providers-CmTPM2dv.js";import{i as ct}from"./CheckCircle-MzaIveO0.js";import{n as dt,o as mt,q as ft,S as ut}from"./chat-context-B8zmzrLo.js";import{e as pt,f as gt}from"./use-organization-settings-B2unqpKQ.js";import{M as ht,b as Ye,P as xt,C as $e}from"./select-model-Cnv_ibpl.js";import{u as bt}from"./use-debounced-autosave-sUGnSDUu.js";import{u as oe}from"./use-t-BGNaKfJX.js";import{I as Ne}from"./input-B_sJYQmR.js";import{T as Oe,a as vt}from"./toggle-group-Di2SNh_L.js";import{c as We,d as Je,b as Xe,A as Ze,g as et,e as tt,a as st,f as it}from"./alert-dialog-DFT5_7dO.js";import{u as ye}from"./studio-tools-B1kdyH0X.js";import{s as yt}from"./Plus-B9C9Hujd.js";import{b as jt}from"./Tool01-CGUbJHe6.js";import{s as St}from"./Trash01-qeRcmh_t.js";import{A as _t}from"./avatar-DZQ3Pejc.js";import{i as Ct}from"./Settings02-CNqO4CPf.js";import{s as kt}from"./Eye-DfJI2F2R.js";import{a as Pt,D as Nt,d as It,e as Dt,c as Kt}from"./dialog-BhHo_8aX.js";import{f as wt}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as At}from"./require-capability-9SFR5rb-.js";import"./sidebar-BdJCwNma.js";import"./LayoutLeft-D1i_m16o.js";import"./use-mobile-DC-H7nsJ.js";import"./X-BYK4muxp.js";import"./tooltip-9cwJhSFd.js";import"./card-BFaEMAcD.js";import"./ArrowUpRight-DJyks9HV.js";import"./autosend-pURvoWwX.js";import"./hooks-D4wZCWx0.js";import"./use-mcp-client-BDydpGXC.js";import"./auth-BZr8EHmi.js";import"./decopilot-sse-pool-Czpmu6TG.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-Zb-pycz2.js";import"./use-collections-CV_TsUFs.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-dX9WsnUS.js";import"./drawer-BtalvzOh.js";import"./checkbox-CSxALpSd.js";import"./Check-L1zt1MhQ.js";import"./select-TTPpfzgt.js";import"./ChevronDown-ste9rvwa.js";import"./ChevronUp-BMKp68Ef.js";import"./Key01-n8lq21nZ.js";import"./SearchMd-DP6rSkG4.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-WjwD_B76.js";import"./ChevronRight-DjxxY9yH.js";import"./connect-desktop-dialog-Ddq0AXN_.js";import"./Copy01-LCLhyD88.js";import"./Image01-SH1T61tk.js";import"./Stars01-DFWKWgNe.js";import"./User01-BwTr9f5y.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-fPLq6YoG.js";import"./access-gate-hWVXWH-C.js";import"./capability-load-error-BoQyulw4.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 ve=se({keyId:D(),modelId:D(),title:D().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Mt=se({tiers:se({fast:ve,smart:ve,thinking:ve,image:ve,web_search:ve,deep_research:ve})});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 Et=e=>e.capabilities?.includes("image")===!0,Rt=e=>dt(e),Ft=e=>mt(e),Tt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Et},{key:"web_search",filter:Rt},{key:"deep_research",filter:Ft}];function $t(e){const t=X.c(26),{slot:i,onSlotChange:r,filterModels:a,defaultKeyId:d}=e,n=Se(),[o,j]=J.useState(i?.keyId??d);let _;t[0]!==i?(_=()=>{i?.keyId&&j(i.keyId)},t[0]=i,t[1]=_):_=t[1];const S=i?.keyId;let l;t[2]!==S?(l=[S],t[2]=S,t[3]=l):l=t[3],J.useEffect(_,l);const c=o??d;let m;t[4]!==c||t[5]!==n?(m=c?n.find(x=>x.id===c):null,t[4]=c,t[5]=n,t[6]=m):m=t[6];const p=m,{models:f,isLoading:g}=Pe(a?c??void 0:void 0),k=a?g||f.some(a):!0;let h;t[7]!==i||t[8]!==p?.providerId?(h=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:p?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=p?.providerId,t[9]=h):h=t[9];const y=h,P=oe();if(a&&!k){let x;t[10]!==P?(x=P("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=P,t[11]=x):x=t[11];let K;return t[12]!==x?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:x}),t[12]=x,t[13]=K):K=t[13],K}let v;t[14]!==P?(v=P("settings.simpleModeSection.pickModel"),t[14]=P,t[15]=v):v=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=x=>j(x),t[16]=C):C=t[16];let u;t[17]!==c||t[18]!==r?(u=x=>{const K=x.keyId??c??"";j(K),r({keyId:K,modelId:x.modelId,title:x.title})},t[17]=c,t[18]=r,t[19]=u):u=t[19];let N;return t[20]!==c||t[21]!==a||t[22]!==y||t[23]!==v||t[24]!==u?(N=s.jsx(ht,{variant:"bordered",placeholder:v,model:y,credentialId:c,filterModels:a,onCredentialChange:C,onModelChange:u}),t[20]=c,t[21]=a,t[22]=y,t[23]=v,t[24]=u,t[25]=N):N=t[25],N}function Ot(e){const t=X.c(10),{isPending:i,showSaved:r}=e,a=oe();if(i){let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=d):d=t[0];let n;t[1]!==a?(n=a("settings.simpleModeSection.saving"),t[1]=a,t[2]=n):n=t[2];let o;return t[3]!==n?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[3]=n,t[4]=o):o=t[4],o}if(r){let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(ct,{size:12}),t[5]=d):d=t[5];let n;t[6]!==a?(n=a("settings.simpleModeSection.saved"),t[6]=a,t[7]=n):n=t[7];let o;return t[8]!==n?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[8]=n,t[9]=o):o=t[9],o}return null}function Ut(){const e=X.c(58),t=oe(),i=Se(),r=pt(),a=i.length>0;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=qe(Mt),e[0]=d):d=e[0];let n;e[1]!==r?(n={resolver:d,values:r,mode:"onChange"},e[1]=r,e[2]=n):n=e[2];const o=ze(n),{mutate:j,isPending:_,isSuccess:S}=gt(),l=o.formState.isDirty;let c;e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==j?(c={delayMs:250,save:async()=>{const b=o.getValues();j(b,{onSuccess:()=>o.reset(b,{keepValues:!0}),onError:A=>{o.reset(r),re.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=r,e[5]=t,e[6]=j,e[7]=c):c=e[7];const{schedule:m}=bt(c),p=i[0],f=i[1],g=i[2],{models:k}=Pe(p?.id),{models:h}=Pe(f?.id),{models:y}=Pe(g?.id);let P,v;e[8]!==o||e[9]!==a?(P=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},v=[a,o],e[8]=o,e[9]=a,e[10]=P,e[11]=v):(P=e[10],v=e[11]),J.useEffect(P,v);let C;e[12]!==i||e[13]!==o||e[14]!==p||e[15]!==f||e[16]!==g||e[17]!==k||e[18]!==h||e[19]!==y?(C=()=>{const b=o.getValues(),A=new Set(i.map(Ht)),M={};p?.id&&(M[p.id]=k),f?.id&&(M[f.id]=h),g?.id&&(M[g.id]=y);const w=Q=>Q!=null&&!A.has(Q.keyId),I={fast:w(b.tiers.fast)?null:b.tiers.fast,smart:w(b.tiers.smart)?null:b.tiers.smart,thinking:w(b.tiers.thinking)?null:b.tiers.thinking,image:w(b.tiers.image)?null:b.tiers.image,web_search:w(b.tiers.web_search)?null:b.tiers.web_search,deep_research:w(b.tiers.deep_research)?null:b.tiers.deep_research},Y=!I.fast||!I.smart||!I.thinking||!I.image||!I.web_search||!I.deep_research,W=I.fast===b.tiers.fast&&I.smart===b.tiers.smart&&I.thinking===b.tiers.thinking&&I.image===b.tiers.image&&I.web_search===b.tiers.web_search&&I.deep_research===b.tiers.deep_research;if(!Y&&W)return;const $=ft(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]=p,e[15]=f,e[16]=g,e[17]=k,e[18]=h,e[19]=y,e[20]=C):C=e[20];const u=p?.id,N=f?.id,x=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==h||e[25]!==y||e[26]!==u||e[27]!==N||e[28]!==x?(K=[o,i,k,h,y,u,N,x],e[21]=i,e[22]=o,e[23]=k,e[24]=h,e[25]=y,e[26]=u,e[27]=N,e[28]=x,e[29]=K):K=e[29],J.useEffect(C,K);let V;e[30]!==t?(V=b=>({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")})[b]||b,e[30]=t,e[31]=V):V=e[31];const G=V;let O;e[32]!==t?(O=b=>({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")})[b]||"",e[32]=t,e[33]=O):O=e[33];const B=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let H;e[36]!==t?(H=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=H):H=e[37];let q;e[38]!==H?(q=s.jsx("p",{className:"text-sm text-muted-foreground",children:H}),e[38]=H,e[39]=q):q=e[39];const L=S&&!l;let E;e[40]!==_||e[41]!==L?(E=s.jsx(Ot,{isPending:_,showSaved:L}),e[40]=_,e[41]=L,e[42]=E):E=e[42];let R;e[43]!==q||e[44]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[q,E]}),e[43]=q,e[44]=E,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==B||e[49]!==G||e[50]!==m?(F=Tt.map(b=>s.jsx(rt,{control:o.control,name:`tiers.${b.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:G(b.key),description:B(b.key),action:s.jsx($t,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:b.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},b.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=B,e[49]=G,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 z;return e[54]!==U||e[55]!==R||e[56]!==T?(z=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=z):z=e[57],z}function Ht(e){return e.id}const qt={usd:[10,20,100],brl:[50,100,500]};function zt(){const e=X.c(30),t=oe(),i=ye(),[r,a]=J.useState(!1);let d;e[0]!==t?(d=u=>{re.error(t("settings.decoCreditsHero.topUpFailed",{message:u.message}))},e[0]=t,e[1]=d):d=e[1];const{mutate:n,isPending:o}=je({mutationFn:async u=>{const{url:N}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:u,currency:c});return N},onSuccess:Bt,onError:d}),[j,_]=J.useState(""),[S,l]=J.useState("usd"),c=S,m=parseFloat(j),p=!isNaN(m)&&m>=1,f=c==="brl"?"R$":"$";let g;e[2]!==l?(g=u=>{u&&l(u)},e[2]=l,e[3]=g):g=e[3];let k,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Oe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),h=s.jsx(Oe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=h):(k=e[4],h=e[5]);let y;e[6]!==c||e[7]!==g?(y=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:c,onValueChange:g,children:[k,h]}),e[6]=c,e[7]=g,e[8]=y):y=e[8];let P;e[9]!==c||e[10]!==f||e[11]!==r||e[12]!==o||e[13]!==t||e[14]!==n?(P=!r&&s.jsxs(s.Fragment,{children:[qt[c].map(u=>s.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>n(u*100),children:[f,u]},u)),s.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=c,e[10]=f,e[11]=r,e[12]=o,e[13]=t,e[14]=n,e[15]=P):P=e[15];let v;e[16]!==f||e[17]!==j||e[18]!==m||e[19]!==r||e[20]!==p||e[21]!==o||e[22]!==_||e[23]!==t||e[24]!==n?(v=r&&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:f}),s.jsx(Ne,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:j,onChange:u=>_(u.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(te,{className:"h-10",disabled:!p||o,onClick:()=>n(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=f,e[17]=j,e[18]=m,e[19]=r,e[20]=p,e[21]=o,e[22]=_,e[23]=t,e[24]=n,e[25]=v):v=e[25];let C;return e[26]!==y||e[27]!==P||e[28]!==v?(C=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y,P,v]})}),e[26]=y,e[27]=P,e[28]=v,e[29]=C):C=e[29],C}function Bt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Lt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Vt(){const e=X.c(121),t=oe(),{org:i}=Ie(),r=ye(),a=De(),d=Se();let n;e[0]!==d?(n=d.find(Qt),e[0]=d,e[1]=n):n=e[1];const o=n,[j,_]=J.useState(!1);let S;e[2]!==o||e[3]!==r?(S=async()=>{o&&await r.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=r,e[4]=S):S=e[4];let l;e[5]!==i.id||e[6]!==a||e[7]!==t?(l=()=>{a.invalidateQueries({queryKey:ie.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:ie.aiProviders(i.id)}),re.success(t("settings.decoCreditsHero.disconnectSuccess")),_(!1)},e[5]=i.id,e[6]=a,e[7]=t,e[8]=l):l=e[8];let c;e[9]!==t?(c=lt=>{re.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=c):c=e[10];let m;e[11]!==S||e[12]!==l||e[13]!==c?(m={mutationFn:S,onSuccess:l,onError:c},e[11]=S,e[12]=l,e[13]=c,e[14]=m):m=e[14];const{mutate:p,isPending:f}=je(m);let g;e[15]!==i.id?(g=ie.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let h;e[17]!==r?(h=async()=>{try{return await r.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=r,e[18]=h):h=e[18];let y;e[19]!==g||e[20]!==k||e[21]!==h?(y={queryKey:g,enabled:k,staleTime:6e4,queryFn:h},e[19]=g,e[20]=k,e[21]=h,e[22]=y):y=e[22];const{data:P,isLoading:v,refetch:C,isFetching:u}=Le(y);if(!o)return null;const N=P?.balanceCents!=null?P.balanceCents/100:null;let x;e[23]!==N?(x=N!=null?`$${N.toFixed(2)}`:"—",e[23]=N,e[24]=x):x=e[24];const K=x;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let G;e[27]!==t?(G=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=G):G=e[28];let O;e[29]!==G?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:G,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=G,e[30]=O):O=e[30];let B;e[31]!==t?(B=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=B):B=e[32];let U;e[33]!==B?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:B})}),e[33]=B,e[34]=U):U=e[34];let H;e[35]!==O||e[36]!==U?(H=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=H):H=e[37];let q;e[38]===Symbol.for("react.memo_cache_sentinel")?(q=()=>_(!0),e[38]=q):q=e[38];let L;e[39]!==t?(L=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=L):L=e[40];let E;e[41]!==f||e[42]!==L?(E=s.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:q,disabled:f,children:L}),e[41]=f,e[42]=L,e[43]=E):E=e[43];let R;e[44]!==H||e[45]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[H,E]}),e[44]=H,e[45]=E,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 z;e[51]!==t?(z=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=z):z=e[52];let b;e[53]!==z?(b=s.jsx(Je,{children:z}),e[53]=z,e[54]=b):b=e[54];let A;e[55]!==T||e[56]!==b?(A=s.jsxs(Xe,{children:[T,b]}),e[55]=T,e[56]=b,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]!==p?(I=()=>p(),e[62]=p,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 Q;e[72]!==A||e[73]!==$?(Q=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=Q):Q=e[74];let Z;e[75]!==j||e[76]!==Q?(Z=s.jsx(it,{open:j,onOpenChange:_,children:Q}),e[75]=j,e[76]=Q,e[77]=Z):Z=e[77];let le;e[78]!==N||e[79]!==K||e[80]!==u||e[81]!==v?(le=v||u?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",N!=null&&Lt(N)),children:K}),e[78]=N,e[79]=K,e[80]=u,e[81]=v,e[82]=le):le=e[82];let ee;e[83]!==C?(ee=()=>C(),e[83]=C,e[84]=ee):ee=e[84];let ne;e[85]!==t?(ne=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ne):ne=e[86];const Ke=u&&"animate-spin";let ae;e[87]!==Ke?(ae=Te(Ke),e[87]=Ke,e[88]=ae):ae=e[88];let ce;e[89]!==ae?(ce=s.jsx(Be,{size:14,className:ae}),e[89]=ae,e[90]=ce):ce=e[90];let de;e[91]!==u||e[92]!==ee||e[93]!==ne||e[94]!==ce?(de=s.jsx("button",{type:"button",onClick:ee,disabled:u,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ne,children:ce}),e[91]=u,e[92]=ee,e[93]=ne,e[94]=ce,e[95]=de):de=e[95];let me;e[96]!==le||e[97]!==de?(me=s.jsxs("div",{className:"flex items-baseline gap-2",children:[le,de]}),e[96]=le,e[97]=de,e[98]=me):me=e[98];let fe;e[99]!==t?(fe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=fe):fe=e[100];let ue;e[101]!==fe?(ue=s.jsx("p",{className:"text-xs text-muted-foreground",children:fe}),e[101]=fe,e[102]=ue):ue=e[102];let pe;e[103]!==me||e[104]!==ue?(pe=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[me,ue]}),e[103]=me,e[104]=ue,e[105]=pe):pe=e[105];let ge;e[106]!==t?(ge=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=ge):ge=e[107];let he;e[108]!==ge?(he=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:ge}),e[108]=ge,e[109]=he):he=e[109];let _e;e[110]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(zt,{}),e[110]=_e):_e=e[110];let xe;e[111]!==he?(xe=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[he,_e]}),e[111]=he,e[112]=xe):xe=e[112];let be;e[113]!==R||e[114]!==Z||e[115]!==pe||e[116]!==xe?(be=s.jsx(Ee,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,Z,pe,xe]})}),e[113]=R,e[114]=Z,e[115]=pe,e[116]=xe,e[117]=be):be=e[117];let Ce;return e[118]!==V||e[119]!==be?(Ce=s.jsx(Re,{title:V,children:be}),e[118]=V,e[119]=be,e[120]=Ce):Ce=e[120],Ce}function Qt(e){return e.providerId==="deco"}function Gt(){const e=X.c(8),{org:t}=Ie(),i=ye(),r=De();let a;e[0]!==i?(a=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=a):a=e[1];let d;e[2]!==t||e[3]!==r?(d=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),r.invalidateQueries({queryKey:ie.aiProviderKeys(t.id)}),r.invalidateQueries({queryKey:ie.aiProviders(t.id)}),re.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=r,e[4]=d):d=e[4];let n;return e[5]!==a||e[6]!==d?(n={mutationFn:a,onSuccess:d,onError:Yt},e[5]=a,e[6]=d,e[7]=n):n=e[7],je(n)}function Yt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),re.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Wt(){const e=X.c(37),t=oe(),{mutate:i,isPending:r}=Gt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["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]=a):a=e[0];let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=d):d=e[1];let n;e[2]!==t?(n=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=n):n=e[3];let o;e[4]!==n?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:n,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=n,e[5]=o):o=e[5];let j;e[6]!==t?(j=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=j):j=e[7];let _;e[8]!==j?(_=s.jsx("p",{className:"text-base font-semibold",children:j}),e[8]=j,e[9]=_):_=e[9];let S;e[10]!==t?(S=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=S):S=e[11];let l;e[12]!==S?(l=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:S}),e[12]=S,e[13]=l):l=e[13];let c;e[14]!==_||e[15]!==l?(c=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_,l]}),e[14]=_,e[15]=l,e[16]=c):c=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let p;e[19]!==m?(p=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=p):p=e[20];let f;e[21]!==p||e[22]!==c?(f=s.jsxs("div",{className:"flex-1 min-w-0",children:[c,p]}),e[21]=p,e[22]=c,e[23]=f):f=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==r||e[27]!==t?(k=t(r?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=r,e[27]=t,e[28]=k):k=e[28];let h;e[29]!==r||e[30]!==g||e[31]!==k?(h=s.jsx(te,{variant:"outline",disabled:r,onClick:g,children:k}),e[29]=r,e[30]=g,e[31]=k,e[32]=h):h=e[32];let y;return e[33]!==f||e[34]!==h||e[35]!==o?(y=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[d,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,f,h]})]}),e[33]=f,e[34]=h,e[35]=o,e[36]=y):y=e[36],y}const Jt=e=>se({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function Xt({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:r}){return e&&!!t&&t!==i&&!r}function Zt({providerKey:e,provider:t,preset:i,maskedKey:r,currentLabel:a,currentBaseUrl:d,onCancel:n,onSuccess:o}){const{org:j}=Ie(),_=ye(),S=De(),l=oe(),[c,m]=J.useState(!1),p=t.id==="openai-compatible",f=t.supportedMethods.includes("api-key"),g=Jt(l),{register:k,handleSubmit:h,watch:y,setError:P,formState:{errors:v}}=ze({resolver:qe(g),defaultValues:{label:a,apiKey:"",baseUrl:d??""}}),C=y("apiKey")??"",{mutate:u,isPending:N}=je({mutationFn:async x=>{let K;x.apiKey&&(p?K=JSON.stringify({baseUrl:x.baseUrl||d||"",apiKey:x.apiKey}):K=x.apiKey),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:x.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{S.invalidateQueries({queryKey:ie.aiProviderKeys(j.id)}),S.invalidateQueries({queryKey:ie.aiProviders(j.id)}),re.success(l("settings.editProviderDialog.providerUpdated")),o()},onError:x=>re.error(l("settings.editProviderDialog.failedToUpdate",{error:x.message}))});return s.jsxs("form",{onSubmit:h(x=>{if(Xt({isOpenAICompatible:p,baseUrl:x.baseUrl,currentBaseUrl:d,apiKey:x.apiKey})){P("apiKey",{message:l("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}u(x)}),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:l("settings.editProviderDialog.label")}),s.jsx(Ne,{placeholder:l("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),v.label&&s.jsx("p",{className:"text-xs text-destructive",children:v.label.message})]}),p&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l("settings.editProviderDialog.baseUrl")}),s.jsx(Ne,{type:"url",placeholder:i?.baseUrlPlaceholder??l("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),f&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[l("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",l("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ne,{type:c&&C?"text":"password",placeholder:r,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),C&&s.jsx("button",{type:"button",onClick:()=>m(!c),"aria-label":l(c?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c?s.jsx(Ct,{size:14}):s.jsx(kt,{size:14})})]}),v.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:v.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Kt,{children:[s.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:N,children:l("settings.editProviderDialog.cancel")}),s.jsx(te,{type:"submit",size:"sm",disabled:N,children:l(N?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function es(e){const t=X.c(31),{providerKey:i,provider:r,open:a,onOpenChange:d}=e,n=oe(),o=ye(),j=r.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,_=j?.name??r.name;let S;t[0]!==i.id?(S=ie.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=S):S=t[1];let l;t[2]!==i.id||t[3]!==o?(l=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=l):l=t[4];let c;t[5]!==a||t[6]!==S||t[7]!==l?(c={queryKey:S,queryFn:l,enabled:a,staleTime:0},t[5]=a,t[6]=S,t[7]=l,t[8]=c):c=t[8];const{data:m,isLoading:p}=Le(c),f=Dt,g=It,k="sm:max-w-md",h=Nt,y=Pt,P=n("settings.editProviderDialog.editTitle",{name:_});let v;t[9]!==y||t[10]!==P?(v=s.jsx(y,{children:P}),t[9]=y,t[10]=P,t[11]=v):v=t[11];let C;t[12]!==h||t[13]!==v?(C=s.jsx(h,{children:v}),t[12]=h,t[13]=v,t[14]=C):C=t[14];let u;t[15]!==p||t[16]!==d||t[17]!==j||t[18]!==m||t[19]!==r||t[20]!==i?(u=p||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ut,{})}):s.jsx(Zt,{providerKey:i,provider:r,preset:j,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>d(!1),onSuccess:()=>d(!1)}),t[15]=p,t[16]=d,t[17]=j,t[18]=m,t[19]=r,t[20]=i,t[21]=u):u=t[21];let N;t[22]!==g||t[23]!==C||t[24]!==u?(N=s.jsxs(g,{className:k,children:[C,u]}),t[22]=g,t[23]=C,t[24]=u,t[25]=N):N=t[25];let x;return t[26]!==f||t[27]!==d||t[28]!==a||t[29]!==N?(x=s.jsx(f,{open:a,onOpenChange:d,children:N}),t[26]=f,t[27]=d,t[28]=a,t[29]=N,t[30]=x):x=t[30],x}function ts(e){const t=X.c(80),{providerKey:i,provider:r}=e,{org:a}=Ie(),d=ye(),n=De(),[o,j]=J.useState(!1),[_,S]=J.useState(!1),l=oe(),c=r.id==="openai-compatible";let m;t[0]!==c||t[1]!==i.presetId?(m=c&&i.presetId?Ye(i.presetId):void 0,t[0]=c,t[1]=i.presetId,t[2]=m):m=t[2];const p=m,f=p?p.name:c?"Custom OpenAI-compatible":r.name,g=p?.logo??r.logo;let k;e:{if(c){k=i.label;break e}const le=i.label;let ee;t[3]!==i.createdAt?(ee=wt(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=ee):ee=t[4],k=`${le} · added ${ee} ago`}const h=k;let y;t[5]!==i.id||t[6]!==d?(y=async()=>{await d.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=d,t[7]=y):y=t[7];let P;t[8]!==a||t[9]!==i.id||t[10]!==n||t[11]!==l?(P=()=>{n.invalidateQueries({queryKey:ie.aiProviderKeys(a.id)}),n.invalidateQueries({queryKey:ie.aiProviders(a.id)}),n.invalidateQueries({queryKey:ie.aiProviderModels(a.id,i.id)}),re.success(l("settings.providerKeyRow.keyDeleted")),j(!1)},t[8]=a,t[9]=i.id,t[10]=n,t[11]=l,t[12]=P):P=t[12];let v;t[13]!==l?(v=le=>re.error(l("settings.providerKeyRow.failedToDeleteKey",{error:le.message})),t[13]=l,t[14]=v):v=t[14];let C;t[15]!==y||t[16]!==P||t[17]!==v?(C={mutationFn:y,onSuccess:P,onError:v},t[15]=y,t[16]=P,t[17]=v,t[18]=C):C=t[18];const{mutate:u,isPending:N}=je(C);let x;t[19]!==f||t[20]!==g?(x=g?s.jsx("img",{src:g,alt:f,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(_t,{fallback:f.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[19]=f,t[20]=g,t[21]=x):x=t[21];let K;t[22]!==l?(K=l("settings.providerKeyRow.editProviderKey"),t[22]=l,t[23]=K):K=t[23];let V,G;t[24]===Symbol.for("react.memo_cache_sentinel")?(G=()=>S(!0),V=s.jsx(jt,{size:14}),t[24]=V,t[25]=G):(V=t[24],G=t[25]);let O;t[26]!==K?(O=s.jsx(te,{variant:"ghost",size:"icon","aria-label":K,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:G,children:V}),t[26]=K,t[27]=O):O=t[27];let B;t[28]!==l?(B=l("settings.providerKeyRow.deleteProviderKey"),t[28]=l,t[29]=B):B=t[29];let U,H;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=()=>j(!0),H=s.jsx(St,{size:14}),t[30]=U,t[31]=H):(U=t[30],H=t[31]);let q;t[32]!==N||t[33]!==B?(q=s.jsx(te,{variant:"ghost",size:"icon","aria-label":B,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:N,onClick:U,children:H}),t[32]=N,t[33]=B,t[34]=q):q=t[34];let L;t[35]!==O||t[36]!==q?(L=s.jsxs("div",{className:"flex items-center gap-0.5",children:[O,q]}),t[35]=O,t[36]=q,t[37]=L):L=t[37];let E;t[38]!==h||t[39]!==f||t[40]!==L||t[41]!==x?(E=s.jsx(Qe,{icon:x,title:f,description:h,action:L}),t[38]=h,t[39]=f,t[40]=L,t[41]=x,t[42]=E):E=t[42];let R;t[43]!==_||t[44]!==r||t[45]!==i?(R=s.jsx(es,{providerKey:i,provider:r,open:_,onOpenChange:S}),t[43]=_,t[44]=r,t[45]=i,t[46]=R):R=t[46];let F;t[47]!==l?(F=l("settings.providerKeyRow.deleteApiKey"),t[47]=l,t[48]=F):F=t[48];let T;t[49]!==F?(T=s.jsx(We,{children:F}),t[49]=F,t[50]=T):T=t[50];let z;t[51]!==i.label?(z=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[51]=i.label,t[52]=z):z=t[52];let b;t[53]!==T||t[54]!==z?(b=s.jsxs(Xe,{children:[T,z]}),t[53]=T,t[54]=z,t[55]=b):b=t[55];let A;t[56]!==l?(A=l("settings.providerKeyRow.cancel"),t[56]=l,t[57]=A):A=t[57];let M;t[58]!==A?(M=s.jsx(Ze,{children:A}),t[58]=A,t[59]=M):M=t[59];let w;t[60]!==u?(w=()=>u(),t[60]=u,t[61]=w):w=t[61];let I;t[62]!==l?(I=l("settings.providerKeyRow.delete"),t[62]=l,t[63]=I):I=t[63];let Y;t[64]!==w||t[65]!==I?(Y=s.jsx(et,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:I}),t[64]=w,t[65]=I,t[66]=Y):Y=t[66];let W;t[67]!==M||t[68]!==Y?(W=s.jsxs(tt,{children:[M,Y]}),t[67]=M,t[68]=Y,t[69]=W):W=t[69];let $;t[70]!==b||t[71]!==W?($=s.jsxs(st,{children:[b,W]}),t[70]=b,t[71]=W,t[72]=$):$=t[72];let Q;t[73]!==o||t[74]!==$?(Q=s.jsx(it,{open:o,onOpenChange:j,children:$}),t[73]=o,t[74]=$,t[75]=Q):Q=t[75];let Z;return t[76]!==E||t[77]!==R||t[78]!==Q?(Z=s.jsxs(s.Fragment,{children:[E,R,Q]}),t[76]=E,t[77]=R,t[78]=Q,t[79]=Z):Z=t[79],Z}function ss(e){const t=X.c(17),{onConnectClick:i}=e,r=oe(),a=Se(),d=Ge();let n;t[0]!==d?.providers?(n=d?.providers??[],t[0]=d?.providers,t[1]=n):n=t[1];const o=n;let j;if(t[2]!==a||t[3]!==i||t[4]!==o||t[5]!==r){let _;t[7]!==o?(_=f=>({key:f,provider:o.find(g=>g.id===f.providerId)}),t[7]=o,t[8]=_):_=t[8];const S=a.filter(rs).map(_).filter(ls);let l;t[9]!==r?(l=r("settings.connectedProvidersSection.sectionTitle"),t[9]=r,t[10]=l):l=t[10];let c;t[11]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{size:14}),t[11]=c):c=t[11];let m;t[12]!==r?(m=r("settings.connectedProvidersSection.connectButton"),t[12]=r,t[13]=m):m=t[13];let p;t[14]!==i||t[15]!==m?(p=s.jsxs(te,{size:"sm",onClick:i,children:[c,m]}),t[14]=i,t[15]=m,t[16]=p):p=t[16],j=s.jsx(Re,{title:l,headerClassName:"px-0",actions:p,children:S.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:r("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:S.map(is)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=r,t[6]=j}else j=t[6];return j}function is(e){const{key:t,provider:i}=e;return s.jsx(ts,{providerKey:t,provider:i},t.id)}function ls(e){return e.provider!==void 0}function rs(e){return e.providerId!=="deco"}function os(e){const t=X.c(3),{error:i}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(nt,{size:16}),t[0]=r):r=t[0];let a;return t[1]!==i.message?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[r,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=a):a=t[2],a}function ns(){const e=X.c(23),t=Se();let i;e[0]!==t?(i=t.some(as),e[0]=t,e[1]=i):i=e[1];const r=i,a=t.length>0,[d,n]=J.useState(!1),[o,j]=J.useState(null),_=Ge();let S;e[2]!==_?.providers?(S=_?.providers??[],e[2]=_?.providers,e[3]=S):S=e[3];const l=S;if(!a){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>n(!0),e[4]=k):k=e[4];let h;e[5]!==l?(h=s.jsx(xt,{providers:l,onSelect:j,onShowAll:k}),e[5]=l,e[6]=h):h=e[6];const y=o!==null||d;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=N=>{N||(j(null),n(!1))},e[7]=P):P=e[7];const v=o??void 0;let C;e[8]!==y||e[9]!==v?(C=s.jsx($e,{open:y,onOpenChange:P,initialProvider:v}),e[8]=y,e[9]=v,e[10]=C):C=e[10];let u;return e[11]!==h||e[12]!==C?(u=s.jsxs(s.Fragment,{children:[h,C]}),e[11]=h,e[12]=C,e[13]=u):u=e[13],u}let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-16 w-full"}),children:s.jsx(Ut,{})}),e[14]=c):c=e[14];let m;e[15]!==r?(m=r?s.jsx(Vt,{}):s.jsx(Wt,{}),e[15]=r,e[16]=m):m=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ss,{onConnectClick:()=>n(!0)}),e[17]=p):p=e[17];let f;e[18]!==d?(f=s.jsx($e,{open:d,onOpenChange:n}),e[18]=d,e[19]=f):f=e[19];let g;return e[20]!==m||e[21]!==f?(g=s.jsxs(s.Fragment,{children:[c,m,p,f]}),e[20]=m,e[21]=f,e[22]=g):g=e[22],g}function as(e){return e.providerId==="deco"}function cs(){const e=X.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ke.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ke,{children:s.jsx(ke.Content,{children:s.jsx(ke.Body,{children:s.jsxs(at,{children:[t,s.jsx(ot,{fallback:ds,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(ns,{})})})]})})})}),e[1]=i):i=e[1],i}function ds(e){const{error:t}=e;return s.jsx(os,{error:t??new Error("Failed to load AI providers")})}function ji(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(At,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(cs,{})}),e[0]=t):t=e[0],t}export{ji as default};
1
+ import{H as se,I as D,ad as Ae,af as we,ag as Ue,ae as He,b3 as Fe,c as X,J as qe,M as ze,r as J,j as s,ah as rt,t as re,aL as Be,C as Ie,n as De,d as je,K as ie,m as Le,l as Te,B as te,p as Ve,E as ot}from"./index-CfAl6qA3.js";import{i as nt}from"./AlertCircle-8aL2p4Jm.js";import{P as ke}from"./index-B72iIhnj.js";import{S as Me}from"./skeleton-DYsdfnWI.js";import{b as Qe,a as Ee,S as Re,c as at}from"./settings-section-ZxnBfBdb.js";import{u as Se,a as Pe,b as Ge}from"./use-ai-providers-DLA17X4H.js";import{i as ct}from"./CheckCircle-BhHr7P8S.js";import{n as dt,o as mt,q as ft,S as ut}from"./chat-context-BKkLQtRB.js";import{e as pt,f as gt}from"./use-organization-settings-Btln8Py9.js";import{M as ht,b as Ye,P as xt,C as $e}from"./select-model-va_ybRaj.js";import{u as bt}from"./use-debounced-autosave-D46G2Nb3.js";import{u as oe}from"./use-t-Ca0ZB4W6.js";import{I as Ne}from"./input-C96iFBVQ.js";import{T as Oe,a as vt}from"./toggle-group-B8ZzagA8.js";import{c as We,d as Je,b as Xe,A as Ze,g as et,e as tt,a as st,f as it}from"./alert-dialog-lT11Jsbj.js";import{u as ye}from"./studio-tools-CZ0lHHg8.js";import{s as yt}from"./Plus-CpvaryXc.js";import{b as jt}from"./Tool01-F8NWFSUY.js";import{s as St}from"./Trash01-CFIi5PAY.js";import{A as _t}from"./avatar-BHNRf2BK.js";import{i as Ct}from"./Settings02-CoD4T3JT.js";import{s as kt}from"./Eye-Dmrq3Yx3.js";import{a as Pt,D as Nt,d as It,e as Dt,c as Kt}from"./dialog-B8iPXZfB.js";import{f as wt}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as At}from"./require-capability-DxlH57sg.js";import"./sidebar-Bmfjcji7.js";import"./LayoutLeft-BXx4559W.js";import"./use-mobile-D0KrjV8M.js";import"./X-B9OMbRgI.js";import"./tooltip-lvzwcxmr.js";import"./card-CxpjTUKu.js";import"./ArrowUpRight-DgWDf4bB.js";import"./autosend-CSO0mWVp.js";import"./hooks-QkqjVdn8.js";import"./use-mcp-client-CAtCw6yl.js";import"./auth-CaW_gj1t.js";import"./decopilot-sse-pool-DWXTDK7c.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp--wK0dI9I.js";import"./use-collections-DJ2e88Xq.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-zHZ5c1US.js";import"./drawer-D5z1QpZ1.js";import"./checkbox-9SStA5q1.js";import"./Check-xlx8bieA.js";import"./select-DfWJsEeW.js";import"./ChevronDown-z_OgoJuG.js";import"./ChevronUp-C0dubflE.js";import"./Key01-CJ4v8ToT.js";import"./SearchMd-BbTMkDIb.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-ByOW8gCA.js";import"./ChevronRight-HByc-_dD.js";import"./connect-desktop-dialog-CcP2o0mO.js";import"./Copy01-BhLnIcPa.js";import"./Image01-D2MElAgS.js";import"./Stars01-BEQN6TZj.js";import"./User01-BHW_CvWq.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-x07oRB_v.js";import"./access-gate-CSvdc98W.js";import"./capability-load-error-D08tgLJn.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 ve=se({keyId:D(),modelId:D(),title:D().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Mt=se({tiers:se({fast:ve,smart:ve,thinking:ve,image:ve,web_search:ve,deep_research:ve})});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 Et=e=>e.capabilities?.includes("image")===!0,Rt=e=>dt(e),Ft=e=>mt(e),Tt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Et},{key:"web_search",filter:Rt},{key:"deep_research",filter:Ft}];function $t(e){const t=X.c(26),{slot:i,onSlotChange:r,filterModels:a,defaultKeyId:d}=e,n=Se(),[o,j]=J.useState(i?.keyId??d);let _;t[0]!==i?(_=()=>{i?.keyId&&j(i.keyId)},t[0]=i,t[1]=_):_=t[1];const S=i?.keyId;let l;t[2]!==S?(l=[S],t[2]=S,t[3]=l):l=t[3],J.useEffect(_,l);const c=o??d;let m;t[4]!==c||t[5]!==n?(m=c?n.find(x=>x.id===c):null,t[4]=c,t[5]=n,t[6]=m):m=t[6];const p=m,{models:f,isLoading:g}=Pe(a?c??void 0:void 0),k=a?g||f.some(a):!0;let h;t[7]!==i||t[8]!==p?.providerId?(h=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:p?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=p?.providerId,t[9]=h):h=t[9];const y=h,P=oe();if(a&&!k){let x;t[10]!==P?(x=P("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=P,t[11]=x):x=t[11];let K;return t[12]!==x?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:x}),t[12]=x,t[13]=K):K=t[13],K}let v;t[14]!==P?(v=P("settings.simpleModeSection.pickModel"),t[14]=P,t[15]=v):v=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=x=>j(x),t[16]=C):C=t[16];let u;t[17]!==c||t[18]!==r?(u=x=>{const K=x.keyId??c??"";j(K),r({keyId:K,modelId:x.modelId,title:x.title})},t[17]=c,t[18]=r,t[19]=u):u=t[19];let N;return t[20]!==c||t[21]!==a||t[22]!==y||t[23]!==v||t[24]!==u?(N=s.jsx(ht,{variant:"bordered",placeholder:v,model:y,credentialId:c,filterModels:a,onCredentialChange:C,onModelChange:u}),t[20]=c,t[21]=a,t[22]=y,t[23]=v,t[24]=u,t[25]=N):N=t[25],N}function Ot(e){const t=X.c(10),{isPending:i,showSaved:r}=e,a=oe();if(i){let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=d):d=t[0];let n;t[1]!==a?(n=a("settings.simpleModeSection.saving"),t[1]=a,t[2]=n):n=t[2];let o;return t[3]!==n?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[3]=n,t[4]=o):o=t[4],o}if(r){let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(ct,{size:12}),t[5]=d):d=t[5];let n;t[6]!==a?(n=a("settings.simpleModeSection.saved"),t[6]=a,t[7]=n):n=t[7];let o;return t[8]!==n?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[8]=n,t[9]=o):o=t[9],o}return null}function Ut(){const e=X.c(58),t=oe(),i=Se(),r=pt(),a=i.length>0;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=qe(Mt),e[0]=d):d=e[0];let n;e[1]!==r?(n={resolver:d,values:r,mode:"onChange"},e[1]=r,e[2]=n):n=e[2];const o=ze(n),{mutate:j,isPending:_,isSuccess:S}=gt(),l=o.formState.isDirty;let c;e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==j?(c={delayMs:250,save:async()=>{const b=o.getValues();j(b,{onSuccess:()=>o.reset(b,{keepValues:!0}),onError:A=>{o.reset(r),re.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=r,e[5]=t,e[6]=j,e[7]=c):c=e[7];const{schedule:m}=bt(c),p=i[0],f=i[1],g=i[2],{models:k}=Pe(p?.id),{models:h}=Pe(f?.id),{models:y}=Pe(g?.id);let P,v;e[8]!==o||e[9]!==a?(P=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},v=[a,o],e[8]=o,e[9]=a,e[10]=P,e[11]=v):(P=e[10],v=e[11]),J.useEffect(P,v);let C;e[12]!==i||e[13]!==o||e[14]!==p||e[15]!==f||e[16]!==g||e[17]!==k||e[18]!==h||e[19]!==y?(C=()=>{const b=o.getValues(),A=new Set(i.map(Ht)),M={};p?.id&&(M[p.id]=k),f?.id&&(M[f.id]=h),g?.id&&(M[g.id]=y);const w=Q=>Q!=null&&!A.has(Q.keyId),I={fast:w(b.tiers.fast)?null:b.tiers.fast,smart:w(b.tiers.smart)?null:b.tiers.smart,thinking:w(b.tiers.thinking)?null:b.tiers.thinking,image:w(b.tiers.image)?null:b.tiers.image,web_search:w(b.tiers.web_search)?null:b.tiers.web_search,deep_research:w(b.tiers.deep_research)?null:b.tiers.deep_research},Y=!I.fast||!I.smart||!I.thinking||!I.image||!I.web_search||!I.deep_research,W=I.fast===b.tiers.fast&&I.smart===b.tiers.smart&&I.thinking===b.tiers.thinking&&I.image===b.tiers.image&&I.web_search===b.tiers.web_search&&I.deep_research===b.tiers.deep_research;if(!Y&&W)return;const $=ft(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]=p,e[15]=f,e[16]=g,e[17]=k,e[18]=h,e[19]=y,e[20]=C):C=e[20];const u=p?.id,N=f?.id,x=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==h||e[25]!==y||e[26]!==u||e[27]!==N||e[28]!==x?(K=[o,i,k,h,y,u,N,x],e[21]=i,e[22]=o,e[23]=k,e[24]=h,e[25]=y,e[26]=u,e[27]=N,e[28]=x,e[29]=K):K=e[29],J.useEffect(C,K);let V;e[30]!==t?(V=b=>({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")})[b]||b,e[30]=t,e[31]=V):V=e[31];const G=V;let O;e[32]!==t?(O=b=>({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")})[b]||"",e[32]=t,e[33]=O):O=e[33];const B=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let H;e[36]!==t?(H=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=H):H=e[37];let q;e[38]!==H?(q=s.jsx("p",{className:"text-sm text-muted-foreground",children:H}),e[38]=H,e[39]=q):q=e[39];const L=S&&!l;let E;e[40]!==_||e[41]!==L?(E=s.jsx(Ot,{isPending:_,showSaved:L}),e[40]=_,e[41]=L,e[42]=E):E=e[42];let R;e[43]!==q||e[44]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[q,E]}),e[43]=q,e[44]=E,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==B||e[49]!==G||e[50]!==m?(F=Tt.map(b=>s.jsx(rt,{control:o.control,name:`tiers.${b.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:G(b.key),description:B(b.key),action:s.jsx($t,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:b.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},b.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=B,e[49]=G,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 z;return e[54]!==U||e[55]!==R||e[56]!==T?(z=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=z):z=e[57],z}function Ht(e){return e.id}const qt={usd:[10,20,100],brl:[50,100,500]};function zt(){const e=X.c(30),t=oe(),i=ye(),[r,a]=J.useState(!1);let d;e[0]!==t?(d=u=>{re.error(t("settings.decoCreditsHero.topUpFailed",{message:u.message}))},e[0]=t,e[1]=d):d=e[1];const{mutate:n,isPending:o}=je({mutationFn:async u=>{const{url:N}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:u,currency:c});return N},onSuccess:Bt,onError:d}),[j,_]=J.useState(""),[S,l]=J.useState("usd"),c=S,m=parseFloat(j),p=!isNaN(m)&&m>=1,f=c==="brl"?"R$":"$";let g;e[2]!==l?(g=u=>{u&&l(u)},e[2]=l,e[3]=g):g=e[3];let k,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Oe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),h=s.jsx(Oe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=h):(k=e[4],h=e[5]);let y;e[6]!==c||e[7]!==g?(y=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:c,onValueChange:g,children:[k,h]}),e[6]=c,e[7]=g,e[8]=y):y=e[8];let P;e[9]!==c||e[10]!==f||e[11]!==r||e[12]!==o||e[13]!==t||e[14]!==n?(P=!r&&s.jsxs(s.Fragment,{children:[qt[c].map(u=>s.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>n(u*100),children:[f,u]},u)),s.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=c,e[10]=f,e[11]=r,e[12]=o,e[13]=t,e[14]=n,e[15]=P):P=e[15];let v;e[16]!==f||e[17]!==j||e[18]!==m||e[19]!==r||e[20]!==p||e[21]!==o||e[22]!==_||e[23]!==t||e[24]!==n?(v=r&&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:f}),s.jsx(Ne,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:j,onChange:u=>_(u.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(te,{className:"h-10",disabled:!p||o,onClick:()=>n(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=f,e[17]=j,e[18]=m,e[19]=r,e[20]=p,e[21]=o,e[22]=_,e[23]=t,e[24]=n,e[25]=v):v=e[25];let C;return e[26]!==y||e[27]!==P||e[28]!==v?(C=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y,P,v]})}),e[26]=y,e[27]=P,e[28]=v,e[29]=C):C=e[29],C}function Bt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Lt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Vt(){const e=X.c(121),t=oe(),{org:i}=Ie(),r=ye(),a=De(),d=Se();let n;e[0]!==d?(n=d.find(Qt),e[0]=d,e[1]=n):n=e[1];const o=n,[j,_]=J.useState(!1);let S;e[2]!==o||e[3]!==r?(S=async()=>{o&&await r.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=r,e[4]=S):S=e[4];let l;e[5]!==i.id||e[6]!==a||e[7]!==t?(l=()=>{a.invalidateQueries({queryKey:ie.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:ie.aiProviders(i.id)}),re.success(t("settings.decoCreditsHero.disconnectSuccess")),_(!1)},e[5]=i.id,e[6]=a,e[7]=t,e[8]=l):l=e[8];let c;e[9]!==t?(c=lt=>{re.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=c):c=e[10];let m;e[11]!==S||e[12]!==l||e[13]!==c?(m={mutationFn:S,onSuccess:l,onError:c},e[11]=S,e[12]=l,e[13]=c,e[14]=m):m=e[14];const{mutate:p,isPending:f}=je(m);let g;e[15]!==i.id?(g=ie.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let h;e[17]!==r?(h=async()=>{try{return await r.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=r,e[18]=h):h=e[18];let y;e[19]!==g||e[20]!==k||e[21]!==h?(y={queryKey:g,enabled:k,staleTime:6e4,queryFn:h},e[19]=g,e[20]=k,e[21]=h,e[22]=y):y=e[22];const{data:P,isLoading:v,refetch:C,isFetching:u}=Le(y);if(!o)return null;const N=P?.balanceCents!=null?P.balanceCents/100:null;let x;e[23]!==N?(x=N!=null?`$${N.toFixed(2)}`:"—",e[23]=N,e[24]=x):x=e[24];const K=x;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let G;e[27]!==t?(G=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=G):G=e[28];let O;e[29]!==G?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:G,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=G,e[30]=O):O=e[30];let B;e[31]!==t?(B=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=B):B=e[32];let U;e[33]!==B?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:B})}),e[33]=B,e[34]=U):U=e[34];let H;e[35]!==O||e[36]!==U?(H=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=H):H=e[37];let q;e[38]===Symbol.for("react.memo_cache_sentinel")?(q=()=>_(!0),e[38]=q):q=e[38];let L;e[39]!==t?(L=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=L):L=e[40];let E;e[41]!==f||e[42]!==L?(E=s.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:q,disabled:f,children:L}),e[41]=f,e[42]=L,e[43]=E):E=e[43];let R;e[44]!==H||e[45]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[H,E]}),e[44]=H,e[45]=E,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 z;e[51]!==t?(z=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=z):z=e[52];let b;e[53]!==z?(b=s.jsx(Je,{children:z}),e[53]=z,e[54]=b):b=e[54];let A;e[55]!==T||e[56]!==b?(A=s.jsxs(Xe,{children:[T,b]}),e[55]=T,e[56]=b,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]!==p?(I=()=>p(),e[62]=p,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 Q;e[72]!==A||e[73]!==$?(Q=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=Q):Q=e[74];let Z;e[75]!==j||e[76]!==Q?(Z=s.jsx(it,{open:j,onOpenChange:_,children:Q}),e[75]=j,e[76]=Q,e[77]=Z):Z=e[77];let le;e[78]!==N||e[79]!==K||e[80]!==u||e[81]!==v?(le=v||u?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",N!=null&&Lt(N)),children:K}),e[78]=N,e[79]=K,e[80]=u,e[81]=v,e[82]=le):le=e[82];let ee;e[83]!==C?(ee=()=>C(),e[83]=C,e[84]=ee):ee=e[84];let ne;e[85]!==t?(ne=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ne):ne=e[86];const Ke=u&&"animate-spin";let ae;e[87]!==Ke?(ae=Te(Ke),e[87]=Ke,e[88]=ae):ae=e[88];let ce;e[89]!==ae?(ce=s.jsx(Be,{size:14,className:ae}),e[89]=ae,e[90]=ce):ce=e[90];let de;e[91]!==u||e[92]!==ee||e[93]!==ne||e[94]!==ce?(de=s.jsx("button",{type:"button",onClick:ee,disabled:u,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ne,children:ce}),e[91]=u,e[92]=ee,e[93]=ne,e[94]=ce,e[95]=de):de=e[95];let me;e[96]!==le||e[97]!==de?(me=s.jsxs("div",{className:"flex items-baseline gap-2",children:[le,de]}),e[96]=le,e[97]=de,e[98]=me):me=e[98];let fe;e[99]!==t?(fe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=fe):fe=e[100];let ue;e[101]!==fe?(ue=s.jsx("p",{className:"text-xs text-muted-foreground",children:fe}),e[101]=fe,e[102]=ue):ue=e[102];let pe;e[103]!==me||e[104]!==ue?(pe=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[me,ue]}),e[103]=me,e[104]=ue,e[105]=pe):pe=e[105];let ge;e[106]!==t?(ge=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=ge):ge=e[107];let he;e[108]!==ge?(he=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:ge}),e[108]=ge,e[109]=he):he=e[109];let _e;e[110]===Symbol.for("react.memo_cache_sentinel")?(_e=s.jsx(zt,{}),e[110]=_e):_e=e[110];let xe;e[111]!==he?(xe=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[he,_e]}),e[111]=he,e[112]=xe):xe=e[112];let be;e[113]!==R||e[114]!==Z||e[115]!==pe||e[116]!==xe?(be=s.jsx(Ee,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,Z,pe,xe]})}),e[113]=R,e[114]=Z,e[115]=pe,e[116]=xe,e[117]=be):be=e[117];let Ce;return e[118]!==V||e[119]!==be?(Ce=s.jsx(Re,{title:V,children:be}),e[118]=V,e[119]=be,e[120]=Ce):Ce=e[120],Ce}function Qt(e){return e.providerId==="deco"}function Gt(){const e=X.c(8),{org:t}=Ie(),i=ye(),r=De();let a;e[0]!==i?(a=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=a):a=e[1];let d;e[2]!==t||e[3]!==r?(d=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),r.invalidateQueries({queryKey:ie.aiProviderKeys(t.id)}),r.invalidateQueries({queryKey:ie.aiProviders(t.id)}),re.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=r,e[4]=d):d=e[4];let n;return e[5]!==a||e[6]!==d?(n={mutationFn:a,onSuccess:d,onError:Yt},e[5]=a,e[6]=d,e[7]=n):n=e[7],je(n)}function Yt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),re.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Wt(){const e=X.c(37),t=oe(),{mutate:i,isPending:r}=Gt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["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]=a):a=e[0];let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=d):d=e[1];let n;e[2]!==t?(n=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=n):n=e[3];let o;e[4]!==n?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:n,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=n,e[5]=o):o=e[5];let j;e[6]!==t?(j=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=j):j=e[7];let _;e[8]!==j?(_=s.jsx("p",{className:"text-base font-semibold",children:j}),e[8]=j,e[9]=_):_=e[9];let S;e[10]!==t?(S=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=S):S=e[11];let l;e[12]!==S?(l=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:S}),e[12]=S,e[13]=l):l=e[13];let c;e[14]!==_||e[15]!==l?(c=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_,l]}),e[14]=_,e[15]=l,e[16]=c):c=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let p;e[19]!==m?(p=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=p):p=e[20];let f;e[21]!==p||e[22]!==c?(f=s.jsxs("div",{className:"flex-1 min-w-0",children:[c,p]}),e[21]=p,e[22]=c,e[23]=f):f=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==r||e[27]!==t?(k=t(r?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=r,e[27]=t,e[28]=k):k=e[28];let h;e[29]!==r||e[30]!==g||e[31]!==k?(h=s.jsx(te,{variant:"outline",disabled:r,onClick:g,children:k}),e[29]=r,e[30]=g,e[31]=k,e[32]=h):h=e[32];let y;return e[33]!==f||e[34]!==h||e[35]!==o?(y=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[d,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,f,h]})]}),e[33]=f,e[34]=h,e[35]=o,e[36]=y):y=e[36],y}const Jt=e=>se({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function Xt({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:r}){return e&&!!t&&t!==i&&!r}function Zt({providerKey:e,provider:t,preset:i,maskedKey:r,currentLabel:a,currentBaseUrl:d,onCancel:n,onSuccess:o}){const{org:j}=Ie(),_=ye(),S=De(),l=oe(),[c,m]=J.useState(!1),p=t.id==="openai-compatible",f=t.supportedMethods.includes("api-key"),g=Jt(l),{register:k,handleSubmit:h,watch:y,setError:P,formState:{errors:v}}=ze({resolver:qe(g),defaultValues:{label:a,apiKey:"",baseUrl:d??""}}),C=y("apiKey")??"",{mutate:u,isPending:N}=je({mutationFn:async x=>{let K;x.apiKey&&(p?K=JSON.stringify({baseUrl:x.baseUrl||d||"",apiKey:x.apiKey}):K=x.apiKey),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:x.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{S.invalidateQueries({queryKey:ie.aiProviderKeys(j.id)}),S.invalidateQueries({queryKey:ie.aiProviders(j.id)}),re.success(l("settings.editProviderDialog.providerUpdated")),o()},onError:x=>re.error(l("settings.editProviderDialog.failedToUpdate",{error:x.message}))});return s.jsxs("form",{onSubmit:h(x=>{if(Xt({isOpenAICompatible:p,baseUrl:x.baseUrl,currentBaseUrl:d,apiKey:x.apiKey})){P("apiKey",{message:l("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}u(x)}),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:l("settings.editProviderDialog.label")}),s.jsx(Ne,{placeholder:l("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),v.label&&s.jsx("p",{className:"text-xs text-destructive",children:v.label.message})]}),p&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l("settings.editProviderDialog.baseUrl")}),s.jsx(Ne,{type:"url",placeholder:i?.baseUrlPlaceholder??l("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),f&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[l("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",l("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ne,{type:c&&C?"text":"password",placeholder:r,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),C&&s.jsx("button",{type:"button",onClick:()=>m(!c),"aria-label":l(c?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c?s.jsx(Ct,{size:14}):s.jsx(kt,{size:14})})]}),v.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:v.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Kt,{children:[s.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:N,children:l("settings.editProviderDialog.cancel")}),s.jsx(te,{type:"submit",size:"sm",disabled:N,children:l(N?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function es(e){const t=X.c(31),{providerKey:i,provider:r,open:a,onOpenChange:d}=e,n=oe(),o=ye(),j=r.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,_=j?.name??r.name;let S;t[0]!==i.id?(S=ie.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=S):S=t[1];let l;t[2]!==i.id||t[3]!==o?(l=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=l):l=t[4];let c;t[5]!==a||t[6]!==S||t[7]!==l?(c={queryKey:S,queryFn:l,enabled:a,staleTime:0},t[5]=a,t[6]=S,t[7]=l,t[8]=c):c=t[8];const{data:m,isLoading:p}=Le(c),f=Dt,g=It,k="sm:max-w-md",h=Nt,y=Pt,P=n("settings.editProviderDialog.editTitle",{name:_});let v;t[9]!==y||t[10]!==P?(v=s.jsx(y,{children:P}),t[9]=y,t[10]=P,t[11]=v):v=t[11];let C;t[12]!==h||t[13]!==v?(C=s.jsx(h,{children:v}),t[12]=h,t[13]=v,t[14]=C):C=t[14];let u;t[15]!==p||t[16]!==d||t[17]!==j||t[18]!==m||t[19]!==r||t[20]!==i?(u=p||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ut,{})}):s.jsx(Zt,{providerKey:i,provider:r,preset:j,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>d(!1),onSuccess:()=>d(!1)}),t[15]=p,t[16]=d,t[17]=j,t[18]=m,t[19]=r,t[20]=i,t[21]=u):u=t[21];let N;t[22]!==g||t[23]!==C||t[24]!==u?(N=s.jsxs(g,{className:k,children:[C,u]}),t[22]=g,t[23]=C,t[24]=u,t[25]=N):N=t[25];let x;return t[26]!==f||t[27]!==d||t[28]!==a||t[29]!==N?(x=s.jsx(f,{open:a,onOpenChange:d,children:N}),t[26]=f,t[27]=d,t[28]=a,t[29]=N,t[30]=x):x=t[30],x}function ts(e){const t=X.c(80),{providerKey:i,provider:r}=e,{org:a}=Ie(),d=ye(),n=De(),[o,j]=J.useState(!1),[_,S]=J.useState(!1),l=oe(),c=r.id==="openai-compatible";let m;t[0]!==c||t[1]!==i.presetId?(m=c&&i.presetId?Ye(i.presetId):void 0,t[0]=c,t[1]=i.presetId,t[2]=m):m=t[2];const p=m,f=p?p.name:c?"Custom OpenAI-compatible":r.name,g=p?.logo??r.logo;let k;e:{if(c){k=i.label;break e}const le=i.label;let ee;t[3]!==i.createdAt?(ee=wt(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=ee):ee=t[4],k=`${le} · added ${ee} ago`}const h=k;let y;t[5]!==i.id||t[6]!==d?(y=async()=>{await d.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=d,t[7]=y):y=t[7];let P;t[8]!==a||t[9]!==i.id||t[10]!==n||t[11]!==l?(P=()=>{n.invalidateQueries({queryKey:ie.aiProviderKeys(a.id)}),n.invalidateQueries({queryKey:ie.aiProviders(a.id)}),n.invalidateQueries({queryKey:ie.aiProviderModels(a.id,i.id)}),re.success(l("settings.providerKeyRow.keyDeleted")),j(!1)},t[8]=a,t[9]=i.id,t[10]=n,t[11]=l,t[12]=P):P=t[12];let v;t[13]!==l?(v=le=>re.error(l("settings.providerKeyRow.failedToDeleteKey",{error:le.message})),t[13]=l,t[14]=v):v=t[14];let C;t[15]!==y||t[16]!==P||t[17]!==v?(C={mutationFn:y,onSuccess:P,onError:v},t[15]=y,t[16]=P,t[17]=v,t[18]=C):C=t[18];const{mutate:u,isPending:N}=je(C);let x;t[19]!==f||t[20]!==g?(x=g?s.jsx("img",{src:g,alt:f,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(_t,{fallback:f.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[19]=f,t[20]=g,t[21]=x):x=t[21];let K;t[22]!==l?(K=l("settings.providerKeyRow.editProviderKey"),t[22]=l,t[23]=K):K=t[23];let V,G;t[24]===Symbol.for("react.memo_cache_sentinel")?(G=()=>S(!0),V=s.jsx(jt,{size:14}),t[24]=V,t[25]=G):(V=t[24],G=t[25]);let O;t[26]!==K?(O=s.jsx(te,{variant:"ghost",size:"icon","aria-label":K,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:G,children:V}),t[26]=K,t[27]=O):O=t[27];let B;t[28]!==l?(B=l("settings.providerKeyRow.deleteProviderKey"),t[28]=l,t[29]=B):B=t[29];let U,H;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=()=>j(!0),H=s.jsx(St,{size:14}),t[30]=U,t[31]=H):(U=t[30],H=t[31]);let q;t[32]!==N||t[33]!==B?(q=s.jsx(te,{variant:"ghost",size:"icon","aria-label":B,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:N,onClick:U,children:H}),t[32]=N,t[33]=B,t[34]=q):q=t[34];let L;t[35]!==O||t[36]!==q?(L=s.jsxs("div",{className:"flex items-center gap-0.5",children:[O,q]}),t[35]=O,t[36]=q,t[37]=L):L=t[37];let E;t[38]!==h||t[39]!==f||t[40]!==L||t[41]!==x?(E=s.jsx(Qe,{icon:x,title:f,description:h,action:L}),t[38]=h,t[39]=f,t[40]=L,t[41]=x,t[42]=E):E=t[42];let R;t[43]!==_||t[44]!==r||t[45]!==i?(R=s.jsx(es,{providerKey:i,provider:r,open:_,onOpenChange:S}),t[43]=_,t[44]=r,t[45]=i,t[46]=R):R=t[46];let F;t[47]!==l?(F=l("settings.providerKeyRow.deleteApiKey"),t[47]=l,t[48]=F):F=t[48];let T;t[49]!==F?(T=s.jsx(We,{children:F}),t[49]=F,t[50]=T):T=t[50];let z;t[51]!==i.label?(z=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[51]=i.label,t[52]=z):z=t[52];let b;t[53]!==T||t[54]!==z?(b=s.jsxs(Xe,{children:[T,z]}),t[53]=T,t[54]=z,t[55]=b):b=t[55];let A;t[56]!==l?(A=l("settings.providerKeyRow.cancel"),t[56]=l,t[57]=A):A=t[57];let M;t[58]!==A?(M=s.jsx(Ze,{children:A}),t[58]=A,t[59]=M):M=t[59];let w;t[60]!==u?(w=()=>u(),t[60]=u,t[61]=w):w=t[61];let I;t[62]!==l?(I=l("settings.providerKeyRow.delete"),t[62]=l,t[63]=I):I=t[63];let Y;t[64]!==w||t[65]!==I?(Y=s.jsx(et,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:I}),t[64]=w,t[65]=I,t[66]=Y):Y=t[66];let W;t[67]!==M||t[68]!==Y?(W=s.jsxs(tt,{children:[M,Y]}),t[67]=M,t[68]=Y,t[69]=W):W=t[69];let $;t[70]!==b||t[71]!==W?($=s.jsxs(st,{children:[b,W]}),t[70]=b,t[71]=W,t[72]=$):$=t[72];let Q;t[73]!==o||t[74]!==$?(Q=s.jsx(it,{open:o,onOpenChange:j,children:$}),t[73]=o,t[74]=$,t[75]=Q):Q=t[75];let Z;return t[76]!==E||t[77]!==R||t[78]!==Q?(Z=s.jsxs(s.Fragment,{children:[E,R,Q]}),t[76]=E,t[77]=R,t[78]=Q,t[79]=Z):Z=t[79],Z}function ss(e){const t=X.c(17),{onConnectClick:i}=e,r=oe(),a=Se(),d=Ge();let n;t[0]!==d?.providers?(n=d?.providers??[],t[0]=d?.providers,t[1]=n):n=t[1];const o=n;let j;if(t[2]!==a||t[3]!==i||t[4]!==o||t[5]!==r){let _;t[7]!==o?(_=f=>({key:f,provider:o.find(g=>g.id===f.providerId)}),t[7]=o,t[8]=_):_=t[8];const S=a.filter(rs).map(_).filter(ls);let l;t[9]!==r?(l=r("settings.connectedProvidersSection.sectionTitle"),t[9]=r,t[10]=l):l=t[10];let c;t[11]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{size:14}),t[11]=c):c=t[11];let m;t[12]!==r?(m=r("settings.connectedProvidersSection.connectButton"),t[12]=r,t[13]=m):m=t[13];let p;t[14]!==i||t[15]!==m?(p=s.jsxs(te,{size:"sm",onClick:i,children:[c,m]}),t[14]=i,t[15]=m,t[16]=p):p=t[16],j=s.jsx(Re,{title:l,headerClassName:"px-0",actions:p,children:S.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:r("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:S.map(is)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=r,t[6]=j}else j=t[6];return j}function is(e){const{key:t,provider:i}=e;return s.jsx(ts,{providerKey:t,provider:i},t.id)}function ls(e){return e.provider!==void 0}function rs(e){return e.providerId!=="deco"}function os(e){const t=X.c(3),{error:i}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(nt,{size:16}),t[0]=r):r=t[0];let a;return t[1]!==i.message?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[r,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=a):a=t[2],a}function ns(){const e=X.c(23),t=Se();let i;e[0]!==t?(i=t.some(as),e[0]=t,e[1]=i):i=e[1];const r=i,a=t.length>0,[d,n]=J.useState(!1),[o,j]=J.useState(null),_=Ge();let S;e[2]!==_?.providers?(S=_?.providers??[],e[2]=_?.providers,e[3]=S):S=e[3];const l=S;if(!a){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>n(!0),e[4]=k):k=e[4];let h;e[5]!==l?(h=s.jsx(xt,{providers:l,onSelect:j,onShowAll:k}),e[5]=l,e[6]=h):h=e[6];const y=o!==null||d;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=N=>{N||(j(null),n(!1))},e[7]=P):P=e[7];const v=o??void 0;let C;e[8]!==y||e[9]!==v?(C=s.jsx($e,{open:y,onOpenChange:P,initialProvider:v}),e[8]=y,e[9]=v,e[10]=C):C=e[10];let u;return e[11]!==h||e[12]!==C?(u=s.jsxs(s.Fragment,{children:[h,C]}),e[11]=h,e[12]=C,e[13]=u):u=e[13],u}let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-16 w-full"}),children:s.jsx(Ut,{})}),e[14]=c):c=e[14];let m;e[15]!==r?(m=r?s.jsx(Vt,{}):s.jsx(Wt,{}),e[15]=r,e[16]=m):m=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ss,{onConnectClick:()=>n(!0)}),e[17]=p):p=e[17];let f;e[18]!==d?(f=s.jsx($e,{open:d,onOpenChange:n}),e[18]=d,e[19]=f):f=e[19];let g;return e[20]!==m||e[21]!==f?(g=s.jsxs(s.Fragment,{children:[c,m,p,f]}),e[20]=m,e[21]=f,e[22]=g):g=e[22],g}function as(e){return e.providerId==="deco"}function cs(){const e=X.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ke.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ke,{children:s.jsx(ke.Content,{children:s.jsx(ke.Body,{children:s.jsxs(at,{children:[t,s.jsx(ot,{fallback:ds,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(ns,{})})})]})})})}),e[1]=i):i=e[1],i}function ds(e){const{error:t}=e;return s.jsx(os,{error:t??new Error("Failed to load AI providers")})}function ji(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(At,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(cs,{})}),e[0]=t):t=e[0],t}export{ji as default};
@@ -1 +1 @@
1
- import{c as n,l as o,j as c,bx as d}from"./index-BtvbO-YY.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,l as o,j as c,bx as d}from"./index-CfAl6qA3.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{j as r,cL as w,r as i,aS as m,dG as O,F as T,aU as M,cK as I,cM as F,cO as A,dH as D,cN as L,cW as z,aQ as G,cY as H,cP as W,c as n,l as p,bM as v}from"./index-BtvbO-YY.js";var x="AlertDialog",[Y]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(w,{...a,...t,modal:!0})};N.displayName=x;var k="AlertDialogTrigger",V=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});V.displayName=k;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...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",[K,Q]=Y(f),U=z("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(K,{scope:t,cancelRef:u,children:r.jsxs(T,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(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(I,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});R.displayName=E;var J="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=J;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=Q($,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{j as r,cL as w,r as i,aS as m,dG as O,F as T,aU as M,cK as I,cM as F,cO as A,dH as D,cN as L,cW as z,aQ as G,cY as H,cP as W,c as n,l as p,bM as v}from"./index-CfAl6qA3.js";var x="AlertDialog",[Y]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(w,{...a,...t,modal:!0})};N.displayName=x;var k="AlertDialogTrigger",V=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});V.displayName=k;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...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",[K,Q]=Y(f),U=z("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(K,{scope:t,cancelRef:u,children:r.jsxs(T,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(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(I,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});R.displayName=E;var J="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=J;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=Q($,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,r as w,j as o,l as yt,t as ut,i as St}from"./index-BtvbO-YY.js";import{i as jt}from"./ChevronRight-DjxxY9yH.js";import{m as kt}from"./automation-runs-BkYkVwPY.js";import{A as _t}from"./add-section-modal-BKKn2cBw.js";import{n as Bt,h as wt,j as At,e as Nt,k as Rt,l as Ct,m as Et,o as Kt,S as Tt}from"./index-CHGiYPlv.js";import"./select-TTPpfzgt.js";import"./tooltip-9cwJhSFd.js";import"./Check-L1zt1MhQ.js";import"./ChevronDown-ste9rvwa.js";import"./ChevronUp-BMKp68Ef.js";import"./useInfiniteQuery-RcsnwPkt.js";import"./use-infinite-scroll-BonCf-uW.js";import"./use-connection-BRQu0PKf.js";import"./use-collections-CV_TsUFs.js";import"./use-mcp-client-BDydpGXC.js";import"./auth-BZr8EHmi.js";import"./use-virtual-mcp-Zb-pycz2.js";import"./card-BFaEMAcD.js";import"./sidebar-BdJCwNma.js";import"./LayoutLeft-D1i_m16o.js";import"./use-mobile-DC-H7nsJ.js";import"./X-BYK4muxp.js";import"./table-BwYfp4B-.js";import"./empty-state-BKVeh2JK.js";import"./use-members-8JQgnpEk.js";import"./use-org-auth-client-DrxeOGQ4.js";import"./use-clock-tick-JBKdZGDh.js";import"./AlertCircle-CdaQFqHl.js";import"./CheckCircle-MzaIveO0.js";import"./DotsVertical-DCjclS0s.js";import"./agent-icon-yglVWNMq.js";import"./Tool01-CGUbJHe6.js";import"./ArrowUp-_a-SRtGc.js";import"./Settings02-CNqO4CPf.js";import"./Tool02-yWUlg2Jl.js";import"./ArrowRight-Cov2YPeB.js";import"./ArrowUpRight-DJyks9HV.js";import"./TrendUp01-C15jO-JN.js";import"./ZapSquare-BO7N9q2-.js";import"./ZoomOut-CejWxeXb.js";import"./Users03-sWa9-yJE.js";import"./Stars02-BDaM006Z.js";import"./Copy01-LCLhyD88.js";import"./Globe01-DTnpQEvE.js";import"./Eye-DfJI2F2R.js";import"./FilterLines-BqkGYn3N.js";import"./Star01-Cc38MZxO.js";import"./Globe04-CWIUsgNy.js";import"./SwitchHorizontal01-BfOiWCGP.js";import"./HardDrive-CalrZSFc.js";import"./Image01-SH1T61tk.js";import"./Key01-n8lq21nZ.js";import"./XCircle-DQ0bT2Xh.js";import"./LinkExternal01-BnAWWVH2.js";import"./Monitor01-WjwD_B76.js";import"./Sun-DuSRYQOH.js";import"./Package-NScsE20z.js";import"./Palette-Dq9W8WsR.js";import"./Play-DwFJH11i.js";import"./Plus-B9C9Hujd.js";import"./SearchLg-C07Q8QRW.js";import"./SearchMd-DP6rSkG4.js";import"./Shield01-qRQ0B-Cf.js";import"./Stars01-DFWKWgNe.js";import"./Trash01-qeRcmh_t.js";import"./Upload01-DUtmbuEn.js";import"./User01-BwTr9f5y.js";import"./Users01-7br16I2u.js";import"./XClose-Djg48M2y.js";import"./Zap-BIGnAJhj.js";import"./use-automations-D40MTJOG.js";import"./studio-tools-B1kdyH0X.js";import"./useSuspenseInfiniteQuery-DKEXqmd5.js";import"./avatar-DZQ3Pejc.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CMH3YN5-.js";import"./file-type-icon-CAWuba96.js";import"./dialog-BhHo_8aX.js";import"./tab-id-BijBBRwE.js";import"./hooks-D4wZCWx0.js";import"./decopilot-sse-pool-Czpmu6TG.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-B8zmzrLo.js";import"./autosend-pURvoWwX.js";import"./use-ai-providers-CmTPM2dv.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-dX9WsnUS.js";import"./use-organization-settings-B2unqpKQ.js";import"./monaco-editor-BAOenOTd.js";import"./index-B3rpW3YZ.js";import"./index-C_Zijcof.js";import"./calendar-BFap2Gyw.js";import"./use-t-BGNaKfJX.js";import"./shell-layout-CoLLzn9H.js";import"./required-auth-layout-CcmRmSDB.js";import"./use-org-sso-BosEp_Ab.js";import"./integration-icon-D8ONihzR.js";import"./use-navigate-to-agent-BxZflEOw.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-BagHq3g2.js";import"./form-CzoZxyKx.js";import"./label-DFLzLt29.js";import"./input-B_sJYQmR.js";import"./drawer-BtalvzOh.js";import"./collection-search-C26mO7tt.js";import"./index-_3eICCSJ.js";import"./get-initials-D-f_fDFw.js";import"./popover-DwFxfwW1.js";import"./use-registry-app-CHS0S4YQ.js";import"./use-mcp-tools-u68duyZ2.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-CpPUo5MX.js";import"./mcp-oauth-c9yHY2lN.js";import"./extract-connection-data-C_u7UnJF.js";import"./dropdown-menu-CS4ITtQz.js";import"./command-g-mrhqk4.js";import"./index-DOnqxg7a.js";import"./companions-core-C4XWmT-B.js";import"./tabs-CVlUtRmS.js";import"./toggle-group-Di2SNh_L.js";import"./use-deco-credits-CcbI-TH5.js";import"./connection-card-DSiFCHTb.js";import"./use-registry-connections-TAn2JTW7.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-Dbhv6rS_.js";import"./connection-form-helpers-DqE8VlOL.js";import"./collection-tabs-C2N7Gsrx.js";import"./badge-tRp7IfGb.js";import"./connect-desktop-dialog-Ddq0AXN_.js";import"./select-model-Cnv_ibpl.js";import"./checkbox-CSxALpSd.js";import"./skeleton--YzuGfHz.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CC-4Jtnh.js";import"./index-DuRfU6hc.js";import"./alert-dialog-DFT5_7dO.js";import"./toolbar-tptVGV-T.js";import"./use-debounced-value-CfrD-Ttf.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DLYR4WdM.js";import"./use-capability-fPLq6YoG.js";import"./toolbar-icon-button-iNad5FK0.js";import"./use-debounced-autosave-sUGnSDUu.js";import"./index-DgiImAyY.js";import"./search-input-CPAXCLRZ.js";import"./use-mcp-auth-status-CLvmNhzR.js";import"./switch-2of9e1Pf.js";import"./github-repo-picker-BDoqlkEl.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-BwDhV9o1.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-file-configs-CfqRNUzP.js";import"./automation-list-row-PQh9RFJz.js";function $t(l,t){const s=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",n=Bt(t,f);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Kr(l){const t=gt.c(77),{orgSlug:s,virtualMcpId:f,branch:n,blockKey:i,block:a,meta:m,decofile:c,title:D,excludeFields:H,schemaPending:nt,previewBaseUrl:at}=l,G=nt===void 0?!1:nt,u=at===void 0?null:at,x=typeof a?.__resolveType=="string"?a.__resolveType:"";let R;t[0]!==H||t[1]!==m||t[2]!==x?(R=wt(x,m,H),t[0]=H,t[1]=m,t[2]=x,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 J=C;let E;t[6]!==a||t[7]!==i||t[8]!==m||t[9]!==D?(E=D??(a?At(i,a,m):i),t[6]=a,t[7]=i,t[8]=m,t[9]=D,t[10]=E):E=t[10];const v=E;let K;t[11]!==n||t[12]!==s||t[13]!==f?(K={orgSlug:s,virtualMcpId:f,branch:n},t[11]=n,t[12]=s,t[13]=f,t[14]=K):K=t[14];const{save:b,flush:Q,isPending:W}=Nt(K);let T;t[15]!==n||t[16]!==s||t[17]!==f?(T={orgSlug:s,virtualMcpId:f,branch:n},t[15]=n,t[16]=s,t[17]=f,t[18]=T):T=t[18];const X=Rt(T);let $;t[19]!==b?($=Et((e,r)=>b(e,r)),t[19]=b,t[20]=$):$=t[20];const Y=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let F;t[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[21]=F):F=t[21];const[p,ft]=w.useState(F),[ot,rt]=w.useState(!1),P=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let O;t[22]!==a?(O=a??{},t[22]=a,t[23]=O):O=t[23];const it=O;let g;t[24]!==tt?(g=tt??{},t[24]=tt,t[25]=g):g=t[25];let z;t[26]!==it||t[27]!==g?(z={...it,...g},t[26]=it,t[27]=g,t[28]=z):z=t[28];const mt=z;let L;t[29]!==i||t[30]!==x||t[31]!==b?(L=e=>{const r=e;ct(r),b(i,{...r,__resolveType:x})},t[29]=i,t[30]=x,t[31]=b,t[32]=L):L=t[32];const st=L;let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{ft(e)},t[33]=V):V=t[33];const pt=V;let q;t[34]!==c||t[35]!==Q||t[36]!==X?(q=async(e,r)=>{try{const{blockKey:d,data:N}=$t(e,c);await X.mutateAsync({blockKey:d,data:N}),ut.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,bt=N instanceof Error?N.message:"Could not add section";throw ut.error(bt),N}},t[34]=c,t[35]=Q,t[36]=X,t[37]=q):q=t[37];const y=q;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{P.current=e.append,rt(!0)},t[38]=I):I=t[38];const vt=I;let U;t[39]!==y?(U=async e=>{const r=P.current;if(r)try{await y(e,d=>{r(d),rt(!1),P.current=null})}catch{}},t[39]=y,t[40]=U):U=t[40];const lt=U;let M;t[41]!==p||t[42]!==v?(M=p.length>0?[v,...p]:[],t[41]=p,t[42]=v,t[43]=M):M=t[43];const A=M;let S;t[44]!==p||t[45]!==A||t[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((e,r)=>{const d=r===A.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:()=>{pt(r===0?[]:Ct(p,r)),dt(Ft)},title:e,className:yt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"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[44]=p,t[45]=A,t[46]=v,t[47]=S):S=t[47];let j;t[48]!==W?(j=o.jsx(Kt,{isPending:W,isError:!1}),t[48]=W,t[49]=j):j=t[49];let k;t[50]!==S||t[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),t[50]=S,t[51]=j,t[52]=k):k=t[52];let _;t[53]!==i||t[54]!==p||t[55]!==c||t[56]!==mt||t[57]!==et||t[58]!==y||t[59]!==st||t[60]!==J||t[61]!==m||t[62]!==u||t[63]!==Y||t[64]!==h||t[65]!==G?(_=o.jsx(kt,{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:J?o.jsx(Tt,{schema:h,value:mt,onChange:st,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pt,decofile:c,meta:m,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${et}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(St,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=p,t[55]=c,t[56]=mt,t[57]=et,t[58]=y,t[59]=st,t[60]=J,t[61]=m,t[62]=u,t[63]=Y,t[64]=h,t[65]=G,t[66]=_):_=t[66];let B;t[67]!==ot||t[68]!==c||t[69]!==lt||t[70]!==m||t[71]!==u?(B=u&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(P.current=null)},meta:m,decofile:c,previewBaseUrl:u,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=c,t[69]=lt,t[70]=m,t[71]=u,t[72]=B):B=t[72];let Z;return t[73]!==k||t[74]!==_||t[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),t[73]=k,t[74]=_,t[75]=B,t[76]=Z):Z=t[76],Z}function Ft(l){return l+1}function Pt(l){return l+1}export{Kr as AppEditor};
1
+ import{c as gt,r as w,j as o,l as yt,t as ut,i as St}from"./index-CfAl6qA3.js";import{i as jt}from"./ChevronRight-HByc-_dD.js";import{m as kt}from"./automation-runs-Cs7mheBT.js";import{A as _t}from"./add-section-modal-BlKiDhBw.js";import{n as Bt,h as wt,j as At,e as Nt,k as Rt,l as Ct,m as Et,o as Kt,S as Tt}from"./index-CwSqgILb.js";import"./select-DfWJsEeW.js";import"./tooltip-lvzwcxmr.js";import"./Check-xlx8bieA.js";import"./ChevronDown-z_OgoJuG.js";import"./ChevronUp-C0dubflE.js";import"./useInfiniteQuery-BT7hVNXg.js";import"./use-infinite-scroll-DgeL9DrI.js";import"./use-connection-CawdsRuN.js";import"./use-collections-DJ2e88Xq.js";import"./use-mcp-client-CAtCw6yl.js";import"./auth-CaW_gj1t.js";import"./use-virtual-mcp--wK0dI9I.js";import"./card-CxpjTUKu.js";import"./sidebar-Bmfjcji7.js";import"./LayoutLeft-BXx4559W.js";import"./use-mobile-D0KrjV8M.js";import"./X-B9OMbRgI.js";import"./table-rrhMpufJ.js";import"./empty-state-B0XUVWqe.js";import"./use-members-BPomUDuY.js";import"./use-org-auth-client-BY7CXLsN.js";import"./use-clock-tick-Cdnpjga1.js";import"./AlertCircle-8aL2p4Jm.js";import"./CheckCircle-BhHr7P8S.js";import"./DotsVertical-9e8whEmO.js";import"./agent-icon-kMrNxjYJ.js";import"./Tool01-F8NWFSUY.js";import"./ArrowUp-BRv6jMcd.js";import"./Settings02-CoD4T3JT.js";import"./Tool02-CYQFsqUw.js";import"./ArrowRight-BmTkQdSS.js";import"./ArrowUpRight-DgWDf4bB.js";import"./TrendUp01-B11vKIzx.js";import"./ZapSquare-NmRRaYpN.js";import"./ZoomOut-Bjuv5wtp.js";import"./Users03-Bg-uyP8J.js";import"./Stars02-wl-TgjVw.js";import"./Copy01-BhLnIcPa.js";import"./Globe01-C1OI0rNn.js";import"./Eye-Dmrq3Yx3.js";import"./FilterLines-LxfJFt1s.js";import"./Star01-B_ldc-QG.js";import"./Globe04-D37KO3Rl.js";import"./SwitchHorizontal01-BjhVVVE7.js";import"./HardDrive-xaUFGQWK.js";import"./Image01-D2MElAgS.js";import"./Key01-CJ4v8ToT.js";import"./XCircle-z2zpbAQl.js";import"./LinkExternal01-RdFrwyl0.js";import"./Monitor01-ByOW8gCA.js";import"./Sun-DcglW2RF.js";import"./Package-BApyVZZF.js";import"./Palette-gwCbQEVd.js";import"./Play-CRcD5urt.js";import"./Plus-CpvaryXc.js";import"./SearchLg-BLbYMh4R.js";import"./SearchMd-BbTMkDIb.js";import"./Shield01-BSQ914Nd.js";import"./Stars01-BEQN6TZj.js";import"./Trash01-CFIi5PAY.js";import"./Upload01-CYv9Q0Sh.js";import"./User01-BHW_CvWq.js";import"./Users01-CVvGtppm.js";import"./XClose-Bvx5TP10.js";import"./Zap-CaoQpAZT.js";import"./use-automations-CtAoOh2g.js";import"./studio-tools-CZ0lHHg8.js";import"./useSuspenseInfiniteQuery-CIkQZwY0.js";import"./avatar-BHNRf2BK.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-aPelM9gN.js";import"./file-type-icon-CICh64eJ.js";import"./dialog-B8iPXZfB.js";import"./tab-id-BijBBRwE.js";import"./hooks-QkqjVdn8.js";import"./decopilot-sse-pool-DWXTDK7c.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-BKkLQtRB.js";import"./autosend-CSO0mWVp.js";import"./use-ai-providers-DLA17X4H.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-zHZ5c1US.js";import"./use-organization-settings-Btln8Py9.js";import"./monaco-editor-CzUxXwGN.js";import"./index-DyxjlEL3.js";import"./index-BD3KwOs3.js";import"./calendar-ajXRpj7H.js";import"./use-t-Ca0ZB4W6.js";import"./shell-layout-B3ubQVJp.js";import"./required-auth-layout-C-fhbIaJ.js";import"./use-org-sso-BNL5m012.js";import"./integration-icon-B1RhpoYr.js";import"./use-navigate-to-agent-CYMIGICl.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-CH1JlaHA.js";import"./form-BbtpCekf.js";import"./label-Dyml5mFF.js";import"./input-C96iFBVQ.js";import"./drawer-D5z1QpZ1.js";import"./collection-search-DZDCl18y.js";import"./index-DFylQUoD.js";import"./get-initials-D-f_fDFw.js";import"./popover-CNhMnjco.js";import"./use-registry-app-DGmz0d5i.js";import"./use-mcp-tools-BkyW84hu.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-jkSUOcu8.js";import"./mcp-oauth-C3_4QnQD.js";import"./extract-connection-data-ChcGsUj8.js";import"./dropdown-menu-D3W9Mypw.js";import"./command-Dv4-KFR5.js";import"./index-DCLh1sVt.js";import"./companions-core-AOH9czLM.js";import"./tabs-Zz7_UEQN.js";import"./toggle-group-B8ZzagA8.js";import"./use-deco-credits-tLUAgc-O.js";import"./connection-card-DSeJr6d2.js";import"./use-registry-connections-BNAx72pz.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-Q9mIBUV-.js";import"./connection-form-helpers-Ce26XCbs.js";import"./collection-tabs-C2iwwrh8.js";import"./badge-0FaSmMEN.js";import"./connect-desktop-dialog-CcP2o0mO.js";import"./select-model-va_ybRaj.js";import"./checkbox-9SStA5q1.js";import"./skeleton-DYsdfnWI.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-ZxnBfBdb.js";import"./index-D7GpXBZi.js";import"./alert-dialog-lT11Jsbj.js";import"./toolbar-1oJVDPdM.js";import"./use-debounced-value-U6TK_cAJ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-WASJAR7W.js";import"./use-capability-x07oRB_v.js";import"./toolbar-icon-button-CqHN6MBe.js";import"./use-debounced-autosave-D46G2Nb3.js";import"./index-B72iIhnj.js";import"./search-input-DzbdykkS.js";import"./use-mcp-auth-status-mlZiRJgT.js";import"./switch-C8NVFCle.js";import"./github-repo-picker-qhKlxIkP.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-Brx7T76W.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-file-configs-D6OQvi29.js";import"./automation-list-row-QQUoi2db.js";function $t(l,t){const s=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",n=Bt(t,f);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Kr(l){const t=gt.c(77),{orgSlug:s,virtualMcpId:f,branch:n,blockKey:i,block:a,meta:m,decofile:c,title:D,excludeFields:H,schemaPending:nt,previewBaseUrl:at}=l,G=nt===void 0?!1:nt,u=at===void 0?null:at,x=typeof a?.__resolveType=="string"?a.__resolveType:"";let R;t[0]!==H||t[1]!==m||t[2]!==x?(R=wt(x,m,H),t[0]=H,t[1]=m,t[2]=x,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 J=C;let E;t[6]!==a||t[7]!==i||t[8]!==m||t[9]!==D?(E=D??(a?At(i,a,m):i),t[6]=a,t[7]=i,t[8]=m,t[9]=D,t[10]=E):E=t[10];const v=E;let K;t[11]!==n||t[12]!==s||t[13]!==f?(K={orgSlug:s,virtualMcpId:f,branch:n},t[11]=n,t[12]=s,t[13]=f,t[14]=K):K=t[14];const{save:b,flush:Q,isPending:W}=Nt(K);let T;t[15]!==n||t[16]!==s||t[17]!==f?(T={orgSlug:s,virtualMcpId:f,branch:n},t[15]=n,t[16]=s,t[17]=f,t[18]=T):T=t[18];const X=Rt(T);let $;t[19]!==b?($=Et((e,r)=>b(e,r)),t[19]=b,t[20]=$):$=t[20];const Y=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let F;t[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[21]=F):F=t[21];const[p,ft]=w.useState(F),[ot,rt]=w.useState(!1),P=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let O;t[22]!==a?(O=a??{},t[22]=a,t[23]=O):O=t[23];const it=O;let g;t[24]!==tt?(g=tt??{},t[24]=tt,t[25]=g):g=t[25];let z;t[26]!==it||t[27]!==g?(z={...it,...g},t[26]=it,t[27]=g,t[28]=z):z=t[28];const mt=z;let L;t[29]!==i||t[30]!==x||t[31]!==b?(L=e=>{const r=e;ct(r),b(i,{...r,__resolveType:x})},t[29]=i,t[30]=x,t[31]=b,t[32]=L):L=t[32];const st=L;let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{ft(e)},t[33]=V):V=t[33];const pt=V;let q;t[34]!==c||t[35]!==Q||t[36]!==X?(q=async(e,r)=>{try{const{blockKey:d,data:N}=$t(e,c);await X.mutateAsync({blockKey:d,data:N}),ut.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,bt=N instanceof Error?N.message:"Could not add section";throw ut.error(bt),N}},t[34]=c,t[35]=Q,t[36]=X,t[37]=q):q=t[37];const y=q;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{P.current=e.append,rt(!0)},t[38]=I):I=t[38];const vt=I;let U;t[39]!==y?(U=async e=>{const r=P.current;if(r)try{await y(e,d=>{r(d),rt(!1),P.current=null})}catch{}},t[39]=y,t[40]=U):U=t[40];const lt=U;let M;t[41]!==p||t[42]!==v?(M=p.length>0?[v,...p]:[],t[41]=p,t[42]=v,t[43]=M):M=t[43];const A=M;let S;t[44]!==p||t[45]!==A||t[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((e,r)=>{const d=r===A.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:()=>{pt(r===0?[]:Ct(p,r)),dt(Ft)},title:e,className:yt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"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[44]=p,t[45]=A,t[46]=v,t[47]=S):S=t[47];let j;t[48]!==W?(j=o.jsx(Kt,{isPending:W,isError:!1}),t[48]=W,t[49]=j):j=t[49];let k;t[50]!==S||t[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),t[50]=S,t[51]=j,t[52]=k):k=t[52];let _;t[53]!==i||t[54]!==p||t[55]!==c||t[56]!==mt||t[57]!==et||t[58]!==y||t[59]!==st||t[60]!==J||t[61]!==m||t[62]!==u||t[63]!==Y||t[64]!==h||t[65]!==G?(_=o.jsx(kt,{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:J?o.jsx(Tt,{schema:h,value:mt,onChange:st,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pt,decofile:c,meta:m,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${et}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(St,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=p,t[55]=c,t[56]=mt,t[57]=et,t[58]=y,t[59]=st,t[60]=J,t[61]=m,t[62]=u,t[63]=Y,t[64]=h,t[65]=G,t[66]=_):_=t[66];let B;t[67]!==ot||t[68]!==c||t[69]!==lt||t[70]!==m||t[71]!==u?(B=u&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(P.current=null)},meta:m,decofile:c,previewBaseUrl:u,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=c,t[69]=lt,t[70]=m,t[71]=u,t[72]=B):B=t[72];let Z;return t[73]!==k||t[74]!==_||t[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),t[73]=k,t[74]=_,t[75]=B,t[76]=Z):Z=t[76],Z}function Ft(l){return l+1}function Pt(l){return l+1}export{Kr as AppEditor};
@@ -1 +1 @@
1
- import{cs as I,ct as $,cu as W,cv as L,cw as H,cx as D,cy as x,cz as V,cA as q,cB as j,cC as y,cD as N,cE as B,cF as F,cG as Z}from"./index-BtvbO-YY.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 Z(),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 F.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{cs as I,ct as $,cu as W,cv as L,cw as H,cx as D,cy as x,cz as V,cA as q,cB as j,cC as y,cD as N,cE as B,cF as F,cG as Z}from"./index-CfAl6qA3.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 Z(),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 F.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,e as m,j as t,A as f,S as h,f as x,g as r,h as p,N as u}from"./index-BtvbO-YY.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,e as m,j as t,A as f,S as h,f as x,g as r,h as p,N as u}from"./index-CfAl6qA3.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{z as pe,r as f,d as J,p as I,a as _,j as e,l as u,B as ge,c as Pe,S as fe}from"./index-BtvbO-YY.js";import{I as U}from"./input-B_sJYQmR.js";import{r as Ce,R as Ae}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ie={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:a="/",title:b,subtitle:x,brand:d,copy:v,variant:g="default",allowedSocialProviders:c,allowPassword:k=!0,onAuthEvent:W}){const{emailAndPassword:L,resetPassword:D,emailOtp:m,socialProviders:j}=pe(),l=t=>{try{W?.(t)}catch{}},h=g==="compact",z=c?j.providers.filter(t=>c.includes(t.name)):j.providers,H=j.enabled&&z.length>0,X=L.enabled&&(k||!m.enabled&&!H),$=j.enabled&&j.providers.length>0&&!H&&!m.enabled&&!X?j.providers:z,y=j.enabled&&$.length>0,w=L.enabled&&(k||!m.enabled&&!y),[n,G]=f.useState(""),[Y,xe]=f.useState(""),[Z,ne]=f.useState(""),[ee,te]=f.useState(""),[F,se]=f.useState(!1),[ae,be]=f.useState(()=>m.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,O]=f.useState(""),[re,oe]=f.useState(!1),s={...Ie,...v},p=ae==="signUp",P=ae==="forgotPassword",N=ae==="emailOtp",q=J({mutationFn:async({email:t,password:i,name:C})=>{try{if(p){const S=await _.signUp.email({email:t,password:i,name:C||""});if(S.error)throw new Error(S.error.message||s.signUpFailed);return S}else{const S=await _.signIn.email({email:t,password:i});if(S.error)throw new Error(S.error.message||s.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(s.authenticationFailed)}},onMutate:()=>{l({type:"started",method:"email_password",mode:p?"sign_up":"sign_in"})},onSuccess:()=>{l({type:"succeeded",method:"email_password",mode:p?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),I(p?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),V=J({mutationFn:async({email:t})=>{const i=await _.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||s.resetEmailFailed);return i},onSuccess:()=>{I("password_reset_requested"),oe(!0)},onError:t=>{I("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),T=J({mutationFn:async({email:t})=>{const i=await _.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(i.error)throw new Error(i.error.message||s.otpSendFailed);return i},onMutate:()=>{l({type:"started",method:"email_otp"})},onSuccess:()=>{l({type:"otp_sent",method:"email_otp"}),I("email_otp_sent"),se(!0)},onError:t=>{l({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t,otp:i})=>{const C=await _.signIn.emailOtp({email:t,otp:i});if(C.error)throw new Error(C.error.message||s.invalidCode);return C},onMutate:()=>{l({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{l({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ie=()=>{n.trim()&&!K(n)&&O(s.invalidEmail)},ve=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}q.mutate({email:n,password:Y,name:Z})},ye=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail);return}V.mutate({email:n})},we=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}T.mutate({email:n})},Ee=t=>{t.preventDefault(),R.mutate({email:n,otp:ee})},M=t=>i=>{t(i.target.value),le&&q.reset(),de&&V.reset(),ce&&(T.reset(),R.reset()),t===G&&E&&O("")},B=t=>{be(t),ne(""),te(""),se(!1),O(""),oe(!1),q.reset(),V.reset(),T.reset(),R.reset()},o=q.isPending||V.isPending||T.isPending||R.isPending,le=q.error,de=V.error,ce=T.error||R.error,A=p?n.trim()&&Y.trim()&&Z.trim():P?n.trim():N?F?ee.trim():n.trim():n.trim()&&Y.trim(),Se=t=>{if(!t)return null;const i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?s.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?s.accountExists:i.includes("network")||i.includes("fetch")?s.networkError:i.includes("rate limit")||i.includes("429")?s.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?s.invalidOrExpiredCode:t.message||s.genericError},me=le||de||ce,je=async t=>{l({type:"started",method:"social",provider:t});try{const i=await _.signIn.social({provider:t,callbackURL:r??a});if(i.error)throw new Error(i.error.message||s.authenticationFailed)}catch(i){const C=i instanceof Error?i.message:String(i);l({type:"failed",method:"social",provider:t,stage:"redirect",error:C}),I("social_signin_failed",{provider:t,error:C})}},Ne=P?s.resetPasswordTitle:N&&F?s.verificationCodeTitle:b??s.welcomeTitle,ue=P?s.resetPasswordSubtitle:N&&F?s.codeSentTo(n):x===void 0?s.defaultSubtitle:x;return e.jsxs("div",{className:u("grid w-full",h?"gap-5":"gap-10"),children:[d??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:u("font-medium",h?"text-xl leading-7":"text-2xl leading-8"),children:Ne}),ue&&e.jsx("p",{className:u("text-muted-foreground",h?"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:Se(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:s.resetEmailSent}),!P&&!(N&&F)&&y&&e.jsx("div",{className:"grid gap-2",children:$.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{je(t.name)},className:u("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",h?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:u("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),s.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!P&&!(N&&F)&&y&&(w||m.enabled)&&e.jsxs("div",{className:u("flex items-center gap-2.5",h?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:u("text-muted-foreground",h?"text-sm":"text-base"),children:s.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),N&&m.enabled&&e.jsx(e.Fragment,{children:F?e.jsxs("form",{onSubmit:Ee,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.verificationCodeLabel}),e.jsx(U,{type:"text",placeholder:s.enterCodePlaceholder,value:ee,onChange:M(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:u("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",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.verifying:s.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),T.reset(),R.reset()},disabled:o,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",h&&"sm:col-span-2"),children:s.useDifferentEmail})]}):e.jsxs("form",{onSubmit:we,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:s.emailPlaceholder,value:n,onChange:M(G),onBlur:ie,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:u("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",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.sending:s.sendCode})]})}),P&&w&&!re&&e.jsxs("form",{onSubmit:ye,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,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?s.sending:s.sendResetLink})]}),!P&&!N&&w&&e.jsxs("form",{onSubmit:ve,className:"grid gap-5",children:[p&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.nameLabel}),e.jsx(U,{type:"text",placeholder:s.namePlaceholder,value:Z,onChange:M(ne),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:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,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:s.passwordLabel}),!p&&D.enabled&&e.jsx("button",{type:"button",onClick:()=>B("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:s.forgotPassword})]}),e.jsx(U,{type:"password",placeholder:"••••••••",value:Y,onChange:M(xe),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:u("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:u("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:u("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?p?s.creatingAccount:s.signingIn:s.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:P?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.backToSignIn}):N&&w?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.signInWithPassword}):!N&&w?e.jsxs(e.Fragment,{children:[p?s.alreadyHaveAccount:s.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>B(p?"signIn":"signUp"),disabled:o,className:Q,children:p?s.signIn:s.signUp}),m.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>B("emailOtp"),disabled:o,className:Q,children:s.signInWithEmailCode})]})]}):null})]})}class he{constructor(a){this.response=a}response}function ke(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Le({redirectTo:r,onAuthEvent:a}){const[b,x]=f.useState(null),d=f.useEffectEvent(v=>{try{a?.(v)}catch{}});return f.useEffect(()=>{let v=!1;return(async()=>{d({type:"started",method:"local"});try{let g;try{g=await Ce(async()=>{const c=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(c.status>=500)throw new he(c);return c},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(c){if(c instanceof Ae&&c.cause instanceof he)g=c.cause.response;else throw c}if(!g.ok){const c=await g.json().catch(()=>({}));throw new Error(c?.error||"Auto-login failed")}v||(d({type:"succeeded",method:"local"}),window.location.href=ke(r))}catch(g){v||(d({type:"failed",method:"local",stage:"authenticate",error:g instanceof Error?g.message:String(g)}),x(g instanceof Error?g.message:"Auto-login failed"))}})(),()=>{v=!0}},[r]),b?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",b]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx(fe,{})}function Fe({callbackURL:r,providerId:a,onAuthEvent:b}){const x=f.useEffectEvent(d=>{try{b?.(d)}catch{}});return f.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:a});try{const d=await _.signIn.sso({providerId:a,callbackURL:r});if(d.error)throw new Error(d.error.message||"SSO redirect failed")}catch(d){x({type:"failed",method:"sso",provider:a,stage:"redirect",error:d instanceof Error?d.message:String(d)})}})()},[a,r]),e.jsx(fe,{})}function Me(r){const a=Pe.c(19),{callbackUrl:b,redirectUrl:x,allowAutoLogin:d,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}=r,j=d===void 0?!0:d,{sso:l,emailAndPassword:h,magicLink:z,emailOtp:H,socialProviders:X,localMode:$}=pe(),y=x||b;if($&&j){let n;return a[0]!==m||a[1]!==y?(n=e.jsx(Le,{redirectTo:y,onAuthEvent:m}),a[0]=m,a[1]=y,a[2]=n):n=a[2],n}if(l.enabled){let n;return a[3]!==m||a[4]!==y||a[5]!==l.providerId?(n=e.jsx(Fe,{callbackURL:y,providerId:l.providerId,onAuthEvent:m}),a[3]=m,a[4]=y,a[5]=l.providerId,a[6]=n):n=a[6],n}if(h.enabled||z.enabled||H.enabled||X.enabled){let n;return a[7]!==D||a[8]!==L||a[9]!==c||a[10]!==b||a[11]!==k||a[12]!==m||a[13]!==x||a[14]!==g||a[15]!==v||a[16]!==W?(n=e.jsx(_e,{redirectUrl:x,callbackUrl:b,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}),a[7]=D,a[8]=L,a[9]=c,a[10]=b,a[11]=k,a[12]=m,a[13]=x,a[14]=g,a[15]=v,a[16]=W,a[17]=n):n=a[17],n}let w;return a[18]===Symbol.for("react.memo_cache_sentinel")?(w=e.jsx("div",{children:"No login options available"}),a[18]=w):w=a[18],w}export{Me as A};
1
+ import{z as pe,r as f,d as J,p as I,a as _,j as e,l as u,B as ge,c as Pe,S as fe}from"./index-CfAl6qA3.js";import{I as U}from"./input-C96iFBVQ.js";import{r as Ce,R as Ae}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ie={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:a="/",title:b,subtitle:x,brand:d,copy:v,variant:g="default",allowedSocialProviders:c,allowPassword:k=!0,onAuthEvent:W}){const{emailAndPassword:L,resetPassword:D,emailOtp:m,socialProviders:j}=pe(),l=t=>{try{W?.(t)}catch{}},h=g==="compact",z=c?j.providers.filter(t=>c.includes(t.name)):j.providers,H=j.enabled&&z.length>0,X=L.enabled&&(k||!m.enabled&&!H),$=j.enabled&&j.providers.length>0&&!H&&!m.enabled&&!X?j.providers:z,y=j.enabled&&$.length>0,w=L.enabled&&(k||!m.enabled&&!y),[n,G]=f.useState(""),[Y,xe]=f.useState(""),[Z,ne]=f.useState(""),[ee,te]=f.useState(""),[F,se]=f.useState(!1),[ae,be]=f.useState(()=>m.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,O]=f.useState(""),[re,oe]=f.useState(!1),s={...Ie,...v},p=ae==="signUp",P=ae==="forgotPassword",N=ae==="emailOtp",q=J({mutationFn:async({email:t,password:i,name:C})=>{try{if(p){const S=await _.signUp.email({email:t,password:i,name:C||""});if(S.error)throw new Error(S.error.message||s.signUpFailed);return S}else{const S=await _.signIn.email({email:t,password:i});if(S.error)throw new Error(S.error.message||s.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(s.authenticationFailed)}},onMutate:()=>{l({type:"started",method:"email_password",mode:p?"sign_up":"sign_in"})},onSuccess:()=>{l({type:"succeeded",method:"email_password",mode:p?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),I(p?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),V=J({mutationFn:async({email:t})=>{const i=await _.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||s.resetEmailFailed);return i},onSuccess:()=>{I("password_reset_requested"),oe(!0)},onError:t=>{I("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),T=J({mutationFn:async({email:t})=>{const i=await _.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(i.error)throw new Error(i.error.message||s.otpSendFailed);return i},onMutate:()=>{l({type:"started",method:"email_otp"})},onSuccess:()=>{l({type:"otp_sent",method:"email_otp"}),I("email_otp_sent"),se(!0)},onError:t=>{l({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t,otp:i})=>{const C=await _.signIn.emailOtp({email:t,otp:i});if(C.error)throw new Error(C.error.message||s.invalidCode);return C},onMutate:()=>{l({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{l({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ie=()=>{n.trim()&&!K(n)&&O(s.invalidEmail)},ve=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}q.mutate({email:n,password:Y,name:Z})},ye=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail);return}V.mutate({email:n})},we=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}T.mutate({email:n})},Ee=t=>{t.preventDefault(),R.mutate({email:n,otp:ee})},M=t=>i=>{t(i.target.value),le&&q.reset(),de&&V.reset(),ce&&(T.reset(),R.reset()),t===G&&E&&O("")},B=t=>{be(t),ne(""),te(""),se(!1),O(""),oe(!1),q.reset(),V.reset(),T.reset(),R.reset()},o=q.isPending||V.isPending||T.isPending||R.isPending,le=q.error,de=V.error,ce=T.error||R.error,A=p?n.trim()&&Y.trim()&&Z.trim():P?n.trim():N?F?ee.trim():n.trim():n.trim()&&Y.trim(),Se=t=>{if(!t)return null;const i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?s.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?s.accountExists:i.includes("network")||i.includes("fetch")?s.networkError:i.includes("rate limit")||i.includes("429")?s.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?s.invalidOrExpiredCode:t.message||s.genericError},me=le||de||ce,je=async t=>{l({type:"started",method:"social",provider:t});try{const i=await _.signIn.social({provider:t,callbackURL:r??a});if(i.error)throw new Error(i.error.message||s.authenticationFailed)}catch(i){const C=i instanceof Error?i.message:String(i);l({type:"failed",method:"social",provider:t,stage:"redirect",error:C}),I("social_signin_failed",{provider:t,error:C})}},Ne=P?s.resetPasswordTitle:N&&F?s.verificationCodeTitle:b??s.welcomeTitle,ue=P?s.resetPasswordSubtitle:N&&F?s.codeSentTo(n):x===void 0?s.defaultSubtitle:x;return e.jsxs("div",{className:u("grid w-full",h?"gap-5":"gap-10"),children:[d??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:u("font-medium",h?"text-xl leading-7":"text-2xl leading-8"),children:Ne}),ue&&e.jsx("p",{className:u("text-muted-foreground",h?"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:Se(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:s.resetEmailSent}),!P&&!(N&&F)&&y&&e.jsx("div",{className:"grid gap-2",children:$.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{je(t.name)},className:u("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",h?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:u("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),s.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!P&&!(N&&F)&&y&&(w||m.enabled)&&e.jsxs("div",{className:u("flex items-center gap-2.5",h?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:u("text-muted-foreground",h?"text-sm":"text-base"),children:s.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),N&&m.enabled&&e.jsx(e.Fragment,{children:F?e.jsxs("form",{onSubmit:Ee,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.verificationCodeLabel}),e.jsx(U,{type:"text",placeholder:s.enterCodePlaceholder,value:ee,onChange:M(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:u("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",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.verifying:s.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),T.reset(),R.reset()},disabled:o,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",h&&"sm:col-span-2"),children:s.useDifferentEmail})]}):e.jsxs("form",{onSubmit:we,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:s.emailPlaceholder,value:n,onChange:M(G),onBlur:ie,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:u("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",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.sending:s.sendCode})]})}),P&&w&&!re&&e.jsxs("form",{onSubmit:ye,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,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?s.sending:s.sendResetLink})]}),!P&&!N&&w&&e.jsxs("form",{onSubmit:ve,className:"grid gap-5",children:[p&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.nameLabel}),e.jsx(U,{type:"text",placeholder:s.namePlaceholder,value:Z,onChange:M(ne),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:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,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:s.passwordLabel}),!p&&D.enabled&&e.jsx("button",{type:"button",onClick:()=>B("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:s.forgotPassword})]}),e.jsx(U,{type:"password",placeholder:"••••••••",value:Y,onChange:M(xe),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:u("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:u("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:u("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?p?s.creatingAccount:s.signingIn:s.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:P?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.backToSignIn}):N&&w?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.signInWithPassword}):!N&&w?e.jsxs(e.Fragment,{children:[p?s.alreadyHaveAccount:s.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>B(p?"signIn":"signUp"),disabled:o,className:Q,children:p?s.signIn:s.signUp}),m.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>B("emailOtp"),disabled:o,className:Q,children:s.signInWithEmailCode})]})]}):null})]})}class he{constructor(a){this.response=a}response}function ke(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Le({redirectTo:r,onAuthEvent:a}){const[b,x]=f.useState(null),d=f.useEffectEvent(v=>{try{a?.(v)}catch{}});return f.useEffect(()=>{let v=!1;return(async()=>{d({type:"started",method:"local"});try{let g;try{g=await Ce(async()=>{const c=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(c.status>=500)throw new he(c);return c},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(c){if(c instanceof Ae&&c.cause instanceof he)g=c.cause.response;else throw c}if(!g.ok){const c=await g.json().catch(()=>({}));throw new Error(c?.error||"Auto-login failed")}v||(d({type:"succeeded",method:"local"}),window.location.href=ke(r))}catch(g){v||(d({type:"failed",method:"local",stage:"authenticate",error:g instanceof Error?g.message:String(g)}),x(g instanceof Error?g.message:"Auto-login failed"))}})(),()=>{v=!0}},[r]),b?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",b]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx(fe,{})}function Fe({callbackURL:r,providerId:a,onAuthEvent:b}){const x=f.useEffectEvent(d=>{try{b?.(d)}catch{}});return f.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:a});try{const d=await _.signIn.sso({providerId:a,callbackURL:r});if(d.error)throw new Error(d.error.message||"SSO redirect failed")}catch(d){x({type:"failed",method:"sso",provider:a,stage:"redirect",error:d instanceof Error?d.message:String(d)})}})()},[a,r]),e.jsx(fe,{})}function Me(r){const a=Pe.c(19),{callbackUrl:b,redirectUrl:x,allowAutoLogin:d,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}=r,j=d===void 0?!0:d,{sso:l,emailAndPassword:h,magicLink:z,emailOtp:H,socialProviders:X,localMode:$}=pe(),y=x||b;if($&&j){let n;return a[0]!==m||a[1]!==y?(n=e.jsx(Le,{redirectTo:y,onAuthEvent:m}),a[0]=m,a[1]=y,a[2]=n):n=a[2],n}if(l.enabled){let n;return a[3]!==m||a[4]!==y||a[5]!==l.providerId?(n=e.jsx(Fe,{callbackURL:y,providerId:l.providerId,onAuthEvent:m}),a[3]=m,a[4]=y,a[5]=l.providerId,a[6]=n):n=a[6],n}if(h.enabled||z.enabled||H.enabled||X.enabled){let n;return a[7]!==D||a[8]!==L||a[9]!==c||a[10]!==b||a[11]!==k||a[12]!==m||a[13]!==x||a[14]!==g||a[15]!==v||a[16]!==W?(n=e.jsx(_e,{redirectUrl:x,callbackUrl:b,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}),a[7]=D,a[8]=L,a[9]=c,a[10]=b,a[11]=k,a[12]=m,a[13]=x,a[14]=g,a[15]=v,a[16]=W,a[17]=n):n=a[17],n}let w;return a[18]===Symbol.for("react.memo_cache_sentinel")?(w=e.jsx("div",{children:"No login options available"}),a[18]=w):w=a[18],w}export{Me as A};
@@ -1 +1 @@
1
- import{c as g,l as p,j as f}from"./index-BtvbO-YY.js";function w(b){const e=g.c(20),{children:m,visual:r,align:j}=b,d=(j===void 0?"center":j)==="fill",x=d?"min-h-[100dvh] md:min-h-screen":"min-h-screen";let l;e[0]!==x?(l=p("flex w-full",x),e[0]=x,e[1]=l):l=e[1];const h=d?"h-[100dvh] justify-start pt-4 pb-8 md:h-auto":"justify-center py-6";let t;e[2]!==h?(t=p("flex flex-1 flex-col items-center bg-sidebar px-6 md:justify-center md:px-10 md:py-10",h),e[2]=h,e[3]=t):t=e[3];const u=d&&"flex min-h-0 flex-1 flex-col md:block md:flex-none";let s;e[4]!==u?(s=p("w-full max-w-[440px]",u),e[4]=u,e[5]=s):s=e[5];let i;e[6]!==m||e[7]!==s?(i=f.jsx("div",{className:s,children:m}),e[6]=m,e[7]=s,e[8]=i):i=e[8];let n;e[9]!==t||e[10]!==i?(n=f.jsx("section",{className:t,children:i}),e[9]=t,e[10]=i,e[11]=n):n=e[11];let c;e[12]!==r?(c=r??f.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[12]=r,e[13]=c):c=e[13];let a;e[14]!==c?(a=f.jsx("aside",{className:"relative hidden flex-1 overflow-hidden bg-muted md:flex",children:c}),e[14]=c,e[15]=a):a=e[15];let o;return e[16]!==a||e[17]!==l||e[18]!==n?(o=f.jsxs("main",{className:l,children:[n,a]}),e[16]=a,e[17]=l,e[18]=n,e[19]=o):o=e[19],o}export{w as A};
1
+ import{c as g,l as p,j as f}from"./index-CfAl6qA3.js";function w(b){const e=g.c(20),{children:m,visual:r,align:j}=b,d=(j===void 0?"center":j)==="fill",x=d?"min-h-[100dvh] md:min-h-screen":"min-h-screen";let l;e[0]!==x?(l=p("flex w-full",x),e[0]=x,e[1]=l):l=e[1];const h=d?"h-[100dvh] justify-start pt-4 pb-8 md:h-auto":"justify-center py-6";let t;e[2]!==h?(t=p("flex flex-1 flex-col items-center bg-sidebar px-6 md:justify-center md:px-10 md:py-10",h),e[2]=h,e[3]=t):t=e[3];const u=d&&"flex min-h-0 flex-1 flex-col md:block md:flex-none";let s;e[4]!==u?(s=p("w-full max-w-[440px]",u),e[4]=u,e[5]=s):s=e[5];let i;e[6]!==m||e[7]!==s?(i=f.jsx("div",{className:s,children:m}),e[6]=m,e[7]=s,e[8]=i):i=e[8];let n;e[9]!==t||e[10]!==i?(n=f.jsx("section",{className:t,children:i}),e[9]=t,e[10]=i,e[11]=n):n=e[11];let c;e[12]!==r?(c=r??f.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[12]=r,e[13]=c):c=e[13];let a;e[14]!==c?(a=f.jsx("aside",{className:"relative hidden flex-1 overflow-hidden bg-muted md:flex",children:c}),e[14]=c,e[15]=a):a=e[15];let o;return e[16]!==a||e[17]!==l||e[18]!==n?(o=f.jsxs("main",{className:l,children:[n,a]}),e[16]=a,e[17]=l,e[18]=n,e[19]=o):o=e[19],o}export{w as A};