decocms 4.91.13 → 4.91.15

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 (231) hide show
  1. package/dist/client/assets/{AlertCircle-bnM-AHGO.js → AlertCircle-BAVOz-2x.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CGniEng_.js → AreaChart-BBlsfTvH.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-E_r50_2m.js → ArrowUp-CdomKn6E.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-CTGmCwuB.js → ArrowUpRight-DzplOzc9.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-BFjklaOK.js → CheckCircle-BUmTwNEw.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-CKv359F0.js → ChevronDown-BwIAM8yJ.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CfjLE0HN.js → ChevronRight-CR81Jb7f.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BXnZQZ3H.js → ChevronUp-CHwBY_gQ.js} +1 -1
  9. package/dist/client/assets/{Copy01-DKZgR_7b.js → Copy01-fXkAnRle.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-C4_fm4pn.js → DotsVertical-CTvul5Hx.js} +1 -1
  11. package/dist/client/assets/{Eye-CAFwHWrY.js → Eye-C56Rqkt8.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BDXLhdvw.js → FilterLines-lTq6Ij1i.js} +1 -1
  13. package/dist/client/assets/{Globe01-BQUa9MmI.js → Globe01-CBAdJxff.js} +1 -1
  14. package/dist/client/assets/{Globe04-CiV5sfOt.js → Globe04-Cf9zDTCT.js} +1 -1
  15. package/dist/client/assets/{HardDrive-CZUPAV8x.js → HardDrive-DvuSdXbu.js} +1 -1
  16. package/dist/client/assets/{Image01-CKQwIs-X.js → Image01-ffA98M16.js} +1 -1
  17. package/dist/client/assets/{Key01-6U7RTmt2.js → Key01-BoS606T3.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-Dk_UeFQQ.js → LayoutLeft-CaPhxBpK.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-cD5Jzz7-.js → LinkExternal01-4NcYsJN5.js} +1 -1
  20. package/dist/client/assets/{Monitor01-BgKfGb_C.js → Monitor01-Bf_ipmVo.js} +1 -1
  21. package/dist/client/assets/{Package-BF9Ikoon.js → Package-C6m5hlJG.js} +1 -1
  22. package/dist/client/assets/{Palette-CwbAfJE1.js → Palette-Bog-hkDH.js} +1 -1
  23. package/dist/client/assets/{Play-CcnUngDU.js → Play-CAJLxQxl.js} +1 -1
  24. package/dist/client/assets/{Plus-Da7EO9JW.js → Plus-B5eO3bTy.js} +1 -1
  25. package/dist/client/assets/{SearchLg-BU9kkayS.js → SearchLg-C9KqXDtT.js} +1 -1
  26. package/dist/client/assets/{SearchMd-DvFCXO2G.js → SearchMd-Byn-coVH.js} +1 -1
  27. package/dist/client/assets/{Settings02-DKg6N4zo.js → Settings02-CuWmowxn.js} +1 -1
  28. package/dist/client/assets/{Shield01-Cvfb7wza.js → Shield01-Bca-So8r.js} +1 -1
  29. package/dist/client/assets/{Star01-BaOZVkLR.js → Star01-BeXsAFXb.js} +1 -1
  30. package/dist/client/assets/{Stars01-BCzbdnTA.js → Stars01-hjCPYLmR.js} +1 -1
  31. package/dist/client/assets/{Stars02-DC2mUh1c.js → Stars02-Bvdy1G8F.js} +1 -1
  32. package/dist/client/assets/{Sun-D9Vmvb3x.js → Sun-DaMMLO5r.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-CIB6pEiS.js → SwitchHorizontal01-D3Ov4m9E.js} +1 -1
  34. package/dist/client/assets/{Tool01-FIiY7fJ0.js → Tool01-BsvXLKqb.js} +1 -1
  35. package/dist/client/assets/{Tool02-B5Nxme6Y.js → Tool02-CSuiCYgo.js} +1 -1
  36. package/dist/client/assets/{Trash01-DgMONZbo.js → Trash01-BNstTg_1.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-AEVL9FCI.js → TrendUp01--z14cIxf.js} +1 -1
  38. package/dist/client/assets/{Upload01-txM4Ed1z.js → Upload01-8kBCAzuF.js} +1 -1
  39. package/dist/client/assets/{User01-CB_k4B4C.js → User01-B6A0_PQ7.js} +1 -1
  40. package/dist/client/assets/{Users01-BBF6f3lO.js → Users01-ovBEB8pw.js} +1 -1
  41. package/dist/client/assets/{Users03-DlrfEd_j.js → Users03-DNyqpf8B.js} +1 -1
  42. package/dist/client/assets/{X-0zKy4PV1.js → X-BLBVAPOy.js} +1 -1
  43. package/dist/client/assets/{XCircle-DjghKaHD.js → XCircle-ZFeyu-0s.js} +1 -1
  44. package/dist/client/assets/{XClose-BG6EvGbU.js → XClose-BOxmZ42j.js} +1 -1
  45. package/dist/client/assets/{Zap-B5UqaMnU.js → Zap-C_1cs5r0.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-zQFlsNS9.js → ZapSquare-Cv314uE4.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-D9TWERka.js → ZoomOut-CQAHgoiD.js} +1 -1
  48. package/dist/client/assets/{access-gate-DNm2pSsB.js → access-gate-ChNZThLC.js} +1 -1
  49. package/dist/client/assets/{add-section-modal-C6oyMnRD.js → add-section-modal-qIs8pZh0.js} +1 -1
  50. package/dist/client/assets/{agent-icon-ChVtquyW.js → agent-icon-CtX3hx5F.js} +1 -1
  51. package/dist/client/assets/{agents-list-n8Ok0pCB.js → agents-list-CDvubk7n.js} +1 -1
  52. package/dist/client/assets/{ai-providers-u4zyABCa.js → ai-providers-Dw4Ws7aR.js} +1 -1
  53. package/dist/client/assets/{alert-Ctnn2jSu.js → alert-C9VZr1JG.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-rb3D-dE0.js → alert-dialog-Q_BwIUfu.js} +1 -1
  55. package/dist/client/assets/{app-editor-C-RUfofU.js → app-editor-Bm6bgVYS.js} +1 -1
  56. package/dist/client/assets/{auth-luIK0osn.js → auth-DWmoiFT3.js} +1 -1
  57. package/dist/client/assets/{auth-catchall-5fvS4lvO.js → auth-catchall-DAPsIyhK.js} +1 -1
  58. package/dist/client/assets/{auth-entry-DEUjBQ6l.js → auth-entry-SHYS_Z04.js} +1 -1
  59. package/dist/client/assets/{auth-split-layout-Bo0-zDty.js → auth-split-layout-BbYX_D2I.js} +1 -1
  60. package/dist/client/assets/{authenticate-and-persist-oauth-D7ClJY6z.js → authenticate-and-persist-oauth-mIivMus1.js} +1 -1
  61. package/dist/client/assets/{automation-list-row-B5YVrOQp.js → automation-list-row-BL6OIn6v.js} +1 -1
  62. package/dist/client/assets/{automation-runs-97vVniQB.js → automation-runs-D4MCi19D.js} +1 -1
  63. package/dist/client/assets/{automations-Bm2fQrjW.js → automations-DCkMyKx3.js} +1 -1
  64. package/dist/client/assets/{autosend-DdGcTLBu.js → autosend-nTHzHKVV.js} +1 -1
  65. package/dist/client/assets/{avatar-BaV7IKOZ.js → avatar-B7H5YfAv.js} +1 -1
  66. package/dist/client/assets/{badge-9gxuzEJo.js → badge-RF6m1wb5.js} +1 -1
  67. package/dist/client/assets/{block-document-BchBm-h5.js → block-document-CLwYPOrS.js} +1 -1
  68. package/dist/client/assets/{brand-context-UEw9ESFM.js → brand-context-BiFVu3Nt.js} +1 -1
  69. package/dist/client/assets/{buckets-FeAEzHbt.js → buckets-Cu-mDC9K.js} +1 -1
  70. package/dist/client/assets/{bulk-category-panel-B45xJdB8.js → bulk-category-panel-CIroraGq.js} +1 -1
  71. package/dist/client/assets/{calendar-CYKpLEK4.js → calendar-EgEumd4K.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-BWNm8Vlx.js → capability-load-error-DpDC2nXy.js} +1 -1
  73. package/dist/client/assets/{card-DzAexHYy.js → card-nbi0jwXg.js} +1 -1
  74. package/dist/client/assets/{category-editor-CocYKaDk.js → category-editor-C7BOhWVs.js} +1 -1
  75. package/dist/client/assets/{chat-context-c0BhAQmo.js → chat-context-CxcCOIx-.js} +1 -1
  76. package/dist/client/assets/{checkbox-_NM5O-zb.js → checkbox-0S0p1Qa5.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-CORojAqv.js → cli-auth-success-Dl9_nPdl.js} +1 -1
  78. package/dist/client/assets/{collection-detail-DLEcUL_1.js → collection-detail-CnA6DONP.js} +1 -1
  79. package/dist/client/assets/{collection-display-button-K4BxMYlM.js → collection-display-button-B2ZdPE0w.js} +1 -1
  80. package/dist/client/assets/{collection-search-Dt7NiO4g.js → collection-search-BuhzlZH8.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-BCkvrjfu.js → collection-table-wrapper-p2pYSSH6.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-BwZkgBbZ.js → collection-tabs-D-3Qpy7-.js} +1 -1
  83. package/dist/client/assets/{command-Bqg8EvQe.js → command-CepxnYO9.js} +1 -1
  84. package/dist/client/assets/{commerce-onboarding-Dr2cXHZ5.js → commerce-onboarding-Djots0jm.js} +1 -1
  85. package/dist/client/assets/{companions-core-B0Eh3Zr_.js → companions-core-Dg3HSBf0.js} +1 -1
  86. package/dist/client/assets/{connect-desktop-dialog-BOIK_vOw.js → connect-desktop-dialog-CthnsqOM.js} +1 -1
  87. package/dist/client/assets/{connection-card-BUL5tgWk.js → connection-card-rdd2ujA7.js} +1 -1
  88. package/dist/client/assets/{connection-detail-B9bFwLTL.js → connection-detail-DEag1MpP.js} +1 -1
  89. package/dist/client/assets/{connection-form-helpers-Du1LFZ4M.js → connection-form-helpers-Y52B043-.js} +1 -1
  90. package/dist/client/assets/{connections-C2EGW46B.js → connections-ClpkSDn9.js} +1 -1
  91. package/dist/client/assets/{decopilot-sse-pool-BVHOHmrO.js → decopilot-sse-pool-DPMHbwbb.js} +1 -1
  92. package/dist/client/assets/{dialog-DxYV-693.js → dialog-Ccu5eFvd.js} +1 -1
  93. package/dist/client/assets/{domain-settings-DEC2NMgK.js → domain-settings-vAp84nto.js} +1 -1
  94. package/dist/client/assets/{drawer-qstCMw0Q.js → drawer-CTLHO_Po.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-BQ-1kZyc.js → dropdown-menu-Dq9H83GM.js} +1 -1
  96. package/dist/client/assets/{empty-state-lR_3kEW4.js → empty-state-Bh6MA1Jh.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-DardgW4l.js → extract-connection-data-CKuJH2zH.js} +1 -1
  98. package/dist/client/assets/{file-explorer-ClqxSbDP.js → file-explorer-CKhmYdvk.js} +1 -1
  99. package/dist/client/assets/{file-type-icon-AZuZgEJR.js → file-type-icon-Bd0oHMYV.js} +1 -1
  100. package/dist/client/assets/{files-DwiZbIlf.js → files-TZe07ele.js} +1 -1
  101. package/dist/client/assets/{form-B5_Adu-q.js → form-B-B5R1Pb.js} +1 -1
  102. package/dist/client/assets/{general-DNgnDbjf.js → general-Bg-yEnP2.js} +1 -1
  103. package/dist/client/assets/{github-repo-picker-Cwo2CoXO.js → github-repo-picker-DCuRF_Em.js} +1 -1
  104. package/dist/client/assets/{hooks-BQfoSwJf.js → hooks-DJCvo0yZ.js} +1 -1
  105. package/dist/client/assets/{index-D6ohfUq5.js → index-BeK7AkFE.js} +1 -1
  106. package/dist/client/assets/{index-Cfp3S5Yv.js → index-Bebyksc0.js} +1 -1
  107. package/dist/client/assets/{index-ClyjgNfZ.js → index-CDjUOYZq.js} +1 -1
  108. package/dist/client/assets/{index-DYw7vW9h.js → index-ChdRNOZ8.js} +1 -1
  109. package/dist/client/assets/{index-bi_pNNOI.js → index-CoFMILd0.js} +1 -1
  110. package/dist/client/assets/{index-c2qA4sKG.js → index-DPFEIozt.js} +1 -1
  111. package/dist/client/assets/{index-6l6Vg_pR.js → index-DfdgvH7q.js} +2 -2
  112. package/dist/client/assets/{index-CJFz8vjp.js → index-Dipox1KZ.js} +1 -1
  113. package/dist/client/assets/{index-DT2lJEWW.js → index-DmzZXnCd.js} +1 -1
  114. package/dist/client/assets/{index-BMMnZ_kU.js → index-K9nNk4ZL.js} +3 -3
  115. package/dist/client/assets/{index-jM9Hlwh7.js → index-ZdLpvqVL.js} +1 -1
  116. package/dist/client/assets/{index--7Dl1ohP.js → index-i_Hm96VD.js} +1 -1
  117. package/dist/client/assets/{index-B2bEP20q.js → index-ow4G_Vs4.js} +1 -1
  118. package/dist/client/assets/{index-redirect-C4H2Dlej.js → index-redirect-De5ze_dU.js} +1 -1
  119. package/dist/client/assets/{index-CihUyKVR.js → index-wvAyIVBW.js} +26 -26
  120. package/dist/client/assets/{input-DO3omnvV.js → input-BTvFP-rc.js} +1 -1
  121. package/dist/client/assets/{integration-icon-CWW8IWzL.js → integration-icon-Dzl5JPvz.js} +1 -1
  122. package/dist/client/assets/{invite-member-dialog-sm_KAm4G.js → invite-member-dialog-CbVVcyGO.js} +1 -1
  123. package/dist/client/assets/{label-mmWPkvpb.js → label-BDx_uIBr.js} +1 -1
  124. package/dist/client/assets/{layout-C13m1wsi.js → layout-CWn7ui_e.js} +1 -1
  125. package/dist/client/assets/{login-LUR3adNp.js → login-C6gf611D.js} +1 -1
  126. package/dist/client/assets/{mcp-oauth-D9VV6Aqh.js → mcp-oauth-CrR55Ybi.js} +1 -1
  127. package/dist/client/assets/{members-DKAWzcSX.js → members-BJw8-N8M.js} +1 -1
  128. package/dist/client/assets/{monaco-editor-B_E5AYPW.js → monaco-editor-B7VLGKpm.js} +1 -1
  129. package/dist/client/assets/{monitoring-stats-row-BQYwpxkV.js → monitoring-stats-row-DcAwFFou.js} +1 -1
  130. package/dist/client/assets/{multi-select-C7fvK2JO.js → multi-select-CEexxbo5.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-Ca0dVhMs.js → oauth-callback-Dtqc-rQz.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-ai-provider-gF8yTd3P.js → oauth-callback-ai-provider-Sc0GBjWy.js} +1 -1
  133. package/dist/client/assets/{onboarding-D-7ZuKQ1.js → onboarding-DbU17zoX.js} +1 -1
  134. package/dist/client/assets/{org-install-BFIHP6cl.js → org-install-C2XcXxC-.js} +1 -1
  135. package/dist/client/assets/{org-layout-CqSGObQ4.js → org-layout-BFL_5bbc.js} +1 -1
  136. package/dist/client/assets/{organization-choice-DImju8iJ.js → organization-choice-BhekRQjj.js} +1 -1
  137. package/dist/client/assets/{orgs-DdB2tyjf.js → orgs-BmpGutsn.js} +1 -1
  138. package/dist/client/assets/{page-seo-form-EY2163Cy.js → page-seo-form-CPW4OXzd.js} +1 -1
  139. package/dist/client/assets/page-seo-sheet-Cylnmhwd.js +1 -0
  140. package/dist/client/assets/{popover-C0PapJhm.js → popover-BUeC8H1A.js} +1 -1
  141. package/dist/client/assets/{post-editor-B-mGeKuB.js → post-editor-BJK7yBbp.js} +1 -1
  142. package/dist/client/assets/{primitives-DGrpSRc_.js → primitives-9MFmR8mW.js} +1 -1
  143. package/dist/client/assets/{profile-D_8r6z9t.js → profile-3ljBANnT.js} +1 -1
  144. package/dist/client/assets/project-app-view-De_35RVp.js +1 -0
  145. package/dist/client/assets/record-editor-XEUZVot7.js +1 -0
  146. package/dist/client/assets/redirect-editor-DnC56ZKk.js +1 -0
  147. package/dist/client/assets/registry-BlWHx3OB.js +2 -0
  148. package/dist/client/assets/{registry-layout-hZdz6-kf.js → registry-layout-PsD4tT-R.js} +2 -2
  149. package/dist/client/assets/{reports-DH7IjchR.js → reports-BigCFVBW.js} +1 -1
  150. package/dist/client/assets/{require-capability-ujl9whCj.js → require-capability-B9yFZhPk.js} +1 -1
  151. package/dist/client/assets/{required-auth-layout-Gxfgdr_y.js → required-auth-layout-Ct_86Yn8.js} +1 -1
  152. package/dist/client/assets/{reset-password-BGTbATLO.js → reset-password-BzoVTsWC.js} +1 -1
  153. package/dist/client/assets/{roles-CWdkMWX4.js → roles-KQJNUpsW.js} +1 -1
  154. package/dist/client/assets/{search-input-B7BOe7-Z.js → search-input-D8Brj2tl.js} +1 -1
  155. package/dist/client/assets/{secrets-BOQDu26Y.js → secrets-DkNysD5B.js} +1 -1
  156. package/dist/client/assets/{sections-editor-D8ChFJlB.js → sections-editor-9QqW6QOK.js} +1 -1
  157. package/dist/client/assets/{select-CEjAa51v.js → select-DkFTH4pS.js} +1 -1
  158. package/dist/client/assets/{select-model-D4cfbFuD.js → select-model-BklSsqwO.js} +1 -1
  159. package/dist/client/assets/{self-tool-result-Cstm1W5n.js → self-tool-result-CGrwaOqB.js} +1 -1
  160. package/dist/client/assets/{seo-editor-CO_OqtSk.js → seo-editor-Bidhz1dJ.js} +1 -1
  161. package/dist/client/assets/{settings-layout-B2-ZFvIt.js → settings-layout-BvnNqnL2.js} +1 -1
  162. package/dist/client/assets/{settings-section-DgtumuNO.js → settings-section-BPiTjvGZ.js} +1 -1
  163. package/dist/client/assets/{shell-controls-DwnH84JX.js → shell-controls-Bk0h78Di.js} +1 -1
  164. package/dist/client/assets/{shell-layout-DKSoLsMT.js → shell-layout-C_fz-LWa.js} +1 -1
  165. package/dist/client/assets/{sidebar-BKJHes1N.js → sidebar-DmkMTXRm.js} +1 -1
  166. package/dist/client/assets/{skeleton-DRYlvCM9.js → skeleton-C31Wi2HR.js} +1 -1
  167. package/dist/client/assets/{sso-TrdYZ9Fq.js → sso-CwKUs7w6.js} +1 -1
  168. package/dist/client/assets/{store-B4jbgj1-.js → store-BtSOklMo.js} +1 -1
  169. package/dist/client/assets/store-registry-CTDSTGMA.js +2 -0
  170. package/dist/client/assets/{studio-tools-B-Eij61m.js → studio-tools-DEV89u5s.js} +1 -1
  171. package/dist/client/assets/{switch-Cu3VZitj.js → switch-Dqu0JsB4.js} +1 -1
  172. package/dist/client/assets/{table-Cms01M2Z.js → table-mM2UZh4-.js} +1 -1
  173. package/dist/client/assets/{tabs-C49u88u9.js → tabs-BmtGU6P3.js} +1 -1
  174. package/dist/client/assets/{textarea-B35vZ5jN.js → textarea-gE88LOd4.js} +1 -1
  175. package/dist/client/assets/{toggle-group-CNog9xMD.js → toggle-group-DZ-PwSy9.js} +1 -1
  176. package/dist/client/assets/{toolbar-BjEknNG8.js → toolbar-BnQrua_4.js} +1 -1
  177. package/dist/client/assets/{toolbar-icon-button-BzzPGdXN.js → toolbar-icon-button-C3nLPKdQ.js} +1 -1
  178. package/dist/client/assets/{tooltip-DGjRuZi1.js → tooltip-QIj4MYXF.js} +1 -1
  179. package/dist/client/assets/{use-ai-providers-CCC_yTQZ.js → use-ai-providers-CvkcDt8z.js} +1 -1
  180. package/dist/client/assets/{use-automations-Dph6FubM.js → use-automations-DA_A7ea0.js} +1 -1
  181. package/dist/client/assets/{use-autosave-CKvDGvgJ.js → use-autosave-TB5vrAcP.js} +1 -1
  182. package/dist/client/assets/{use-capability-CXQN2i28.js → use-capability-B5gueICr.js} +1 -1
  183. package/dist/client/assets/{use-clock-tick-qyYcZOnR.js → use-clock-tick-2Z9dljx4.js} +1 -1
  184. package/dist/client/assets/{use-collections-DfM_LEkP.js → use-collections-BXT57saO.js} +1 -1
  185. package/dist/client/assets/{use-connection-Dtoxwk_v.js → use-connection-B1oTCIml.js} +1 -1
  186. package/dist/client/assets/{use-copy-BVQGJ-sy.js → use-copy-XS6PbPfg.js} +1 -1
  187. package/dist/client/assets/{use-create-virtual-mcp-B0P7lyB0.js → use-create-virtual-mcp-C5vASeGE.js} +1 -1
  188. package/dist/client/assets/{use-debounced-autosave-DDMvbPZQ.js → use-debounced-autosave-CeSRLFvn.js} +1 -1
  189. package/dist/client/assets/{use-debounced-value-CraLUb40.js → use-debounced-value-OYErywlB.js} +1 -1
  190. package/dist/client/assets/{use-deco-credits-NTd3RI-N.js → use-deco-credits-DLdCNMTW.js} +1 -1
  191. package/dist/client/assets/{use-decopilot-events-DATU1apS.js → use-decopilot-events-CW6CBoVI.js} +1 -1
  192. package/dist/client/assets/{use-delete-connection-B6u81CNj.js → use-delete-connection-CyRF8DCa.js} +1 -1
  193. package/dist/client/assets/{use-deployment-admin-Crqnw_bw.js → use-deployment-admin-DBuKyz73.js} +1 -1
  194. package/dist/client/assets/{use-file-configs-wYzg3Q9h.js → use-file-configs-DySKbq7G.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-BQKuGeZW.js → use-infinite-scroll-COEiXKgN.js} +1 -1
  196. package/dist/client/assets/{use-join-requests-BvTFETm1.js → use-join-requests-DJFK9mdy.js} +1 -1
  197. package/dist/client/assets/{use-mcp-auth-status-C9F7z-xG.js → use-mcp-auth-status-CeS-sSG9.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-BdvBykSl.js → use-mcp-client-E4o51i36.js} +1 -1
  199. package/dist/client/assets/{use-mcp-tools-DwILy75s.js → use-mcp-tools-BmVUrIvT.js} +1 -1
  200. package/dist/client/assets/{use-members-D4YLs-Jc.js → use-members-C_PqWVC0.js} +1 -1
  201. package/dist/client/assets/{use-mobile-Bef-oAkh.js → use-mobile-CDLFoW5F.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-DC4DOTvY.js → use-navigate-to-agent-DO3W8rHR.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-BzbwdJQH.js → use-org-auth-client-D55gdzx_.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-CAvXAkMi.js → use-org-sso-B-C09oWZ.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-B-rkna0z.js → use-organization-roles-DI1I-ujJ.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-DR8jU_IF.js → use-organization-settings-CwwJujO2.js} +1 -1
  207. package/dist/client/assets/{use-registry-app-S0Rojzrq.js → use-registry-app-Bg-hKxMQ.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-BtFws4Kn.js → use-registry-connections-riJqDo6-.js} +1 -1
  209. package/dist/client/assets/{use-secrets-CnOAKTMF.js → use-secrets-DA17vJTD.js} +1 -1
  210. package/dist/client/assets/{use-status-sounds-SizlMvIJ.js → use-status-sounds-CQm_T5_1.js} +1 -1
  211. package/dist/client/assets/{use-t-BPFwceba.js → use-t-BYEA0NnF.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-r4kmYloh.js → use-view-mode-BYYmEzlE.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-CLPxduRS.js → use-virtual-mcp-DWXqRlLT.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-Bz26qvcU.js +1 -0
  215. package/dist/client/assets/{useRouterState-_1Yy5uzx.js → useRouterState-BPuzDu75.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-Vqts_kWq.js +1 -0
  217. package/dist/client/assets/{users-Cv8m_7pY.js → users-BR8qEd2z.js} +1 -1
  218. package/dist/client/assets/{variant-calendar-nyB4vBQj.js → variant-calendar-D08Ns1Fj.js} +1 -1
  219. package/dist/client/assets/{view-mode-toggle-D5W0l3in.js → view-mode-toggle-DGwLr-Wi.js} +1 -1
  220. package/dist/client/index.html +1 -1
  221. package/dist/server/cli.js +1 -1
  222. package/dist/server/server.js +1 -1
  223. package/package.json +1 -1
  224. package/dist/client/assets/page-seo-sheet-B4HcV4Jn.js +0 -1
  225. package/dist/client/assets/project-app-view-Cn_d_3a6.js +0 -1
  226. package/dist/client/assets/record-editor-BNzZA8dM.js +0 -1
  227. package/dist/client/assets/redirect-editor-u8-hgrCH.js +0 -1
  228. package/dist/client/assets/registry-A1ZQQvEy.js +0 -2
  229. package/dist/client/assets/store-registry-DQ7yErTg.js +0 -2
  230. package/dist/client/assets/useInfiniteQuery-CTHi40J6.js +0 -1
  231. package/dist/client/assets/useSuspenseInfiniteQuery-7sOHoy9i.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-BMMnZ_kU.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-BQ-1kZyc.js";import{a as be}from"./Users03-DlrfEd_j.js";import{G as me}from"./use-registry-app-S0Rojzrq.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp-CLPxduRS.js";import{P as X}from"./index-c2qA4sKG.js";import{i as _e}from"./DotsVertical-C4_fm4pn.js";import{a as Ne,b as Se}from"./Settings02-DKg6N4zo.js";import{s as ve}from"./Trash01-DgMONZbo.js";import{A as Ie,aJ as De}from"./agent-icon-ChVtquyW.js";import{c as ue}from"./use-navigate-to-agent-DC4DOTvY.js";import{C as Ae}from"./card-DzAexHYy.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-CXQN2i28.js";import{E as Te}from"./empty-state-lR_3kEW4.js";import{u as ke}from"./use-create-virtual-mcp-B0P7lyB0.js";import{u as Ge}from"./use-connection-Dtoxwk_v.js";import{u as re,S as Le}from"./use-mcp-client-BdvBykSl.js";import{u as Oe,G as Pe}from"./github-repo-picker-Cwo2CoXO.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-DxYV-693.js";import{C as Ke}from"./collection-search-Dt7NiO4g.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-rb3D-dE0.js";import{S as tt}from"./search-input-B7BOe7-Z.js";import{s as le}from"./Plus-Da7EO9JW.js";import"./ChevronUp-BXnZQZ3H.js";import"./ChevronRight-CfjLE0HN.js";import"./use-mcp-tools-DwILy75s.js";import"./use-collections-DfM_LEkP.js";import"./sidebar-BKJHes1N.js";import"./LayoutLeft-Dk_UeFQQ.js";import"./use-mobile-Bef-oAkh.js";import"./X-0zKy4PV1.js";import"./tooltip-DGjRuZi1.js";import"./AlertCircle-bnM-AHGO.js";import"./Tool01-FIiY7fJ0.js";import"./ArrowUp-E_r50_2m.js";import"./Tool02-B5Nxme6Y.js";import"./XCircle-DjghKaHD.js";import"./ArrowUpRight-CTGmCwuB.js";import"./TrendUp01-AEVL9FCI.js";import"./ZapSquare-zQFlsNS9.js";import"./ZoomOut-D9TWERka.js";import"./CheckCircle-BFjklaOK.js";import"./ChevronDown-CKv359F0.js";import"./Stars02-DC2mUh1c.js";import"./Copy01-DKZgR_7b.js";import"./Globe01-BQUa9MmI.js";import"./Eye-CAFwHWrY.js";import"./FilterLines-BDXLhdvw.js";import"./Star01-BaOZVkLR.js";import"./Globe04-CiV5sfOt.js";import"./SwitchHorizontal01-CIB6pEiS.js";import"./HardDrive-CZUPAV8x.js";import"./Image01-CKQwIs-X.js";import"./Key01-6U7RTmt2.js";import"./LinkExternal01-cD5Jzz7-.js";import"./Monitor01-BgKfGb_C.js";import"./Sun-D9Vmvb3x.js";import"./Package-BF9Ikoon.js";import"./Palette-CwbAfJE1.js";import"./Play-CcnUngDU.js";import"./SearchLg-BU9kkayS.js";import"./SearchMd-DvFCXO2G.js";import"./Shield01-Cvfb7wza.js";import"./Stars01-BCzbdnTA.js";import"./Upload01-txM4Ed1z.js";import"./User01-CB_k4B4C.js";import"./Users01-BBF6f3lO.js";import"./XClose-BG6EvGbU.js";import"./Zap-B5UqaMnU.js";import"./hooks-BQfoSwJf.js";import"./decopilot-sse-pool-BVHOHmrO.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-luIK0osn.js";import"./use-debounced-value-CraLUb40.js";import"./authenticate-and-persist-oauth-D7ClJY6z.js";import"./mcp-oauth-D9VV6Aqh.js";import"./extract-connection-data-DardgW4l.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:G=>{G.stopPropagation(),l(G)},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:Le,orgId:n.id,orgSlug:n.slug}),h=Ge({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??[],G=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),L=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`),G(!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:G,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:()=>G(!1),disabled:L.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||L.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&L.mutate(d),children:L.isPending?"Importing...":"Import"})]})]})})}function $s(){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 G;t[5]===Symbol.for("react.memo_cache_sentinel")?(G=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=G):G=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:G}),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 L;t[12]!==P||t[13]!==R?(L=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]=L):L=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]!==L||t[18]!==o?(v=s.jsxs(T.Body,{children:[L,o,k]}),t[15]=k,t[16]=T.Body,t[17]=L,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{$s 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-K9nNk4ZL.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-Dq9H83GM.js";import{a as be}from"./Users03-DNyqpf8B.js";import{G as me}from"./use-registry-app-Bg-hKxMQ.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp-DWXqRlLT.js";import{P as X}from"./index-DPFEIozt.js";import{i as _e}from"./DotsVertical-CTvul5Hx.js";import{a as Ne,b as Se}from"./Settings02-CuWmowxn.js";import{s as ve}from"./Trash01-BNstTg_1.js";import{A as Ie,aJ as De}from"./agent-icon-CtX3hx5F.js";import{c as ue}from"./use-navigate-to-agent-DO3W8rHR.js";import{C as Ae}from"./card-nbi0jwXg.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-B5gueICr.js";import{E as Te}from"./empty-state-Bh6MA1Jh.js";import{u as ke}from"./use-create-virtual-mcp-C5vASeGE.js";import{u as Ge}from"./use-connection-B1oTCIml.js";import{u as re,S as Le}from"./use-mcp-client-E4o51i36.js";import{u as Oe,G as Pe}from"./github-repo-picker-DCuRF_Em.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-Ccu5eFvd.js";import{C as Ke}from"./collection-search-BuhzlZH8.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-Q_BwIUfu.js";import{S as tt}from"./search-input-D8Brj2tl.js";import{s as le}from"./Plus-B5eO3bTy.js";import"./ChevronUp-CHwBY_gQ.js";import"./ChevronRight-CR81Jb7f.js";import"./use-mcp-tools-BmVUrIvT.js";import"./use-collections-BXT57saO.js";import"./sidebar-DmkMTXRm.js";import"./LayoutLeft-CaPhxBpK.js";import"./use-mobile-CDLFoW5F.js";import"./X-BLBVAPOy.js";import"./tooltip-QIj4MYXF.js";import"./AlertCircle-BAVOz-2x.js";import"./Tool01-BsvXLKqb.js";import"./ArrowUp-CdomKn6E.js";import"./Tool02-CSuiCYgo.js";import"./XCircle-ZFeyu-0s.js";import"./ArrowUpRight-DzplOzc9.js";import"./TrendUp01--z14cIxf.js";import"./ZapSquare-Cv314uE4.js";import"./ZoomOut-CQAHgoiD.js";import"./CheckCircle-BUmTwNEw.js";import"./ChevronDown-BwIAM8yJ.js";import"./Stars02-Bvdy1G8F.js";import"./Copy01-fXkAnRle.js";import"./Globe01-CBAdJxff.js";import"./Eye-C56Rqkt8.js";import"./FilterLines-lTq6Ij1i.js";import"./Star01-BeXsAFXb.js";import"./Globe04-Cf9zDTCT.js";import"./SwitchHorizontal01-D3Ov4m9E.js";import"./HardDrive-DvuSdXbu.js";import"./Image01-ffA98M16.js";import"./Key01-BoS606T3.js";import"./LinkExternal01-4NcYsJN5.js";import"./Monitor01-Bf_ipmVo.js";import"./Sun-DaMMLO5r.js";import"./Package-C6m5hlJG.js";import"./Palette-Bog-hkDH.js";import"./Play-CAJLxQxl.js";import"./SearchLg-C9KqXDtT.js";import"./SearchMd-Byn-coVH.js";import"./Shield01-Bca-So8r.js";import"./Stars01-hjCPYLmR.js";import"./Upload01-8kBCAzuF.js";import"./User01-B6A0_PQ7.js";import"./Users01-ovBEB8pw.js";import"./XClose-BOxmZ42j.js";import"./Zap-C_1cs5r0.js";import"./hooks-DJCvo0yZ.js";import"./decopilot-sse-pool-DPMHbwbb.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-DWmoiFT3.js";import"./use-debounced-value-OYErywlB.js";import"./authenticate-and-persist-oauth-mIivMus1.js";import"./mcp-oauth-CrR55Ybi.js";import"./extract-connection-data-CKuJH2zH.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:G=>{G.stopPropagation(),l(G)},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:Le,orgId:n.id,orgSlug:n.slug}),h=Ge({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??[],G=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),L=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`),G(!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:G,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:()=>G(!1),disabled:L.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||L.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&L.mutate(d),children:L.isPending?"Importing...":"Import"})]})]})})}function $s(){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 G;t[5]===Symbol.for("react.memo_cache_sentinel")?(G=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=G):G=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:G}),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 L;t[12]!==P||t[13]!==R?(L=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]=L):L=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]!==L||t[18]!==o?(v=s.jsxs(T.Body,{children:[L,o,k]}),t[15]=k,t[16]=T.Body,t[17]=L,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{$s as default};
@@ -1 +1 @@
1
- import{H as ie,I as D,ad as Ae,af as we,ag as Ue,ae as He,b3 as Fe,c as X,J as ze,M as qe,r as J,j as s,ah as rt,t as oe,aL as Le,C as Ie,n as De,d as je,K as le,m as Be,l as Te,B as se,p as Ve,E as ot}from"./index-BMMnZ_kU.js";import{i as nt}from"./AlertCircle-bnM-AHGO.js";import{P as ke}from"./index-c2qA4sKG.js";import{S as Me}from"./skeleton-DRYlvCM9.js";import{b as Qe,a as Ee,S as Re,c as at}from"./settings-section-DgtumuNO.js";import{u as Se,a as Pe,b as Ge}from"./use-ai-providers-CCC_yTQZ.js";import{i as ct}from"./CheckCircle-BFjklaOK.js";import{n as dt,o as mt,q as ft,S as ut}from"./chat-context-c0BhAQmo.js";import{e as pt,f as gt}from"./use-organization-settings-DR8jU_IF.js";import{M as ht,b as We,P as xt,C as $e}from"./select-model-D4cfbFuD.js";import{u as bt}from"./use-debounced-autosave-DDMvbPZQ.js";import{u as ne}from"./use-t-BPFwceba.js";import{I as Ne}from"./input-DO3omnvV.js";import{T as Oe,a as vt}from"./toggle-group-CNog9xMD.js";import{c as Ye,d as Je,b as Xe,A as Ze,g as et,e as tt,a as st,f as it}from"./alert-dialog-rb3D-dE0.js";import{u as ye}from"./studio-tools-B-Eij61m.js";import{s as yt}from"./Plus-Da7EO9JW.js";import{b as jt}from"./Tool01-FIiY7fJ0.js";import{s as St}from"./Trash01-DgMONZbo.js";import{A as _t}from"./avatar-BaV7IKOZ.js";import{i as Ct}from"./Settings02-DKg6N4zo.js";import{s as kt}from"./Eye-CAFwHWrY.js";import{a as Pt,D as Nt,d as It,e as Dt,c as Kt}from"./dialog-DxYV-693.js";import{f as wt}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as At}from"./require-capability-ujl9whCj.js";import"./sidebar-BKJHes1N.js";import"./LayoutLeft-Dk_UeFQQ.js";import"./use-mobile-Bef-oAkh.js";import"./X-0zKy4PV1.js";import"./tooltip-DGjRuZi1.js";import"./card-DzAexHYy.js";import"./ArrowUpRight-CTGmCwuB.js";import"./autosend-DdGcTLBu.js";import"./hooks-BQfoSwJf.js";import"./use-mcp-client-BdvBykSl.js";import"./auth-luIK0osn.js";import"./decopilot-sse-pool-BVHOHmrO.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CLPxduRS.js";import"./use-collections-DfM_LEkP.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-DATU1apS.js";import"./drawer-qstCMw0Q.js";import"./checkbox-_NM5O-zb.js";import"./ChevronUp-BXnZQZ3H.js";import"./select-CEjAa51v.js";import"./ChevronDown-CKv359F0.js";import"./Key01-6U7RTmt2.js";import"./SearchMd-DvFCXO2G.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-BgKfGb_C.js";import"./ChevronRight-CfjLE0HN.js";import"./connect-desktop-dialog-BOIK_vOw.js";import"./Copy01-DKZgR_7b.js";import"./Image01-CKQwIs-X.js";import"./Stars01-BCzbdnTA.js";import"./User01-CB_k4B4C.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-CXQN2i28.js";import"./access-gate-DNm2pSsB.js";import"./capability-load-error-BWNm8Vlx.js";ie({title:D(),url:D(),icon:D()});ie({registries:we(D(),ie({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=ie({keyId:D(),modelId:D(),title:D().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Mt=ie({tiers:ie({fast:ve,smart:ve,thinking:ve,image:ve,web_search:ve,deep_research:ve})});ie({ids:Ae(D()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});ie({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:ie({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:ie({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:o,filterModels:a,defaultKeyId:d}=e,n=Se(),[r,y]=J.useState(i?.keyId??d);let _;t[0]!==i?(_=()=>{i?.keyId&&y(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=r??d;let m;t[4]!==c||t[5]!==n?(m=c?n.find(C=>C.id===c):null,t[4]=c,t[5]=n,t[6]=m):m=t[6];const p=m,{models:u,isLoading:g}=Pe(a?c??void 0:void 0),P=a?g||u.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 v=h,k=ne();if(a&&!P){let C;t[10]!==k?(C=k("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=k,t[11]=C):C=t[11];let K;return t[12]!==C?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:C}),t[12]=C,t[13]=K):K=t[13],K}let j;t[14]!==k?(j=k("settings.simpleModeSection.pickModel"),t[14]=k,t[15]=j):j=t[15];let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=C=>y(C),t[16]=N):N=t[16];let f;t[17]!==c||t[18]!==o?(f=C=>{const K=C.keyId??c??"";y(K),o({keyId:K,modelId:C.modelId,title:C.title})},t[17]=c,t[18]=o,t[19]=f):f=t[19];let b;return t[20]!==c||t[21]!==a||t[22]!==v||t[23]!==j||t[24]!==f?(b=s.jsx(ht,{variant:"bordered",placeholder:j,model:v,credentialId:c,filterModels:a,onCredentialChange:N,onModelChange:f}),t[20]=c,t[21]=a,t[22]=v,t[23]=j,t[24]=f,t[25]=b):b=t[25],b}function Ot(e){const t=X.c(10),{isPending:i,showSaved:o}=e,a=ne();if(i){let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Le,{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 r;return t[3]!==n?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[3]=n,t[4]=r):r=t[4],r}if(o){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 r;return t[8]!==n?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[8]=n,t[9]=r):r=t[9],r}return null}function Ut(){const e=X.c(58),t=ne(),i=Se(),o=pt(),a=i.length>0;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=ze(Mt),e[0]=d):d=e[0];let n;e[1]!==o?(n={resolver:d,values:o,mode:"onChange"},e[1]=o,e[2]=n):n=e[2];const r=qe(n),{mutate:y,isPending:_,isSuccess:S}=gt(),l=r.formState.isDirty;let c;e[3]!==r||e[4]!==o||e[5]!==t||e[6]!==y?(c={delayMs:250,save:async()=>{const x=r.getValues();y(x,{onSuccess:()=>r.reset(x,{keepValues:!0}),onError:A=>{r.reset(o),oe.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=r,e[4]=o,e[5]=t,e[6]=y,e[7]=c):c=e[7];const{schedule:m}=bt(c),p=i[0],u=i[1],g=i[2],{models:P}=Pe(p?.id),{models:h}=Pe(u?.id),{models:v}=Pe(g?.id);let k,j;e[8]!==r||e[9]!==a?(k=()=>{a||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},j=[a,r],e[8]=r,e[9]=a,e[10]=k,e[11]=j):(k=e[10],j=e[11]),J.useEffect(k,j);let N;e[12]!==i||e[13]!==r||e[14]!==p||e[15]!==u||e[16]!==g||e[17]!==P||e[18]!==h||e[19]!==v?(N=()=>{const x=r.getValues(),A=new Set(i.map(Ht)),M={};p?.id&&(M[p.id]=P),u?.id&&(M[u.id]=h),g?.id&&(M[g.id]=v);const w=Q=>Q!=null&&!A.has(Q.keyId),I={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},W=!I.fast||!I.smart||!I.thinking||!I.image||!I.web_search||!I.deep_research,Y=I.fast===x.tiers.fast&&I.smart===x.tiers.smart&&I.thinking===x.tiers.thinking&&I.image===x.tiers.image&&I.web_search===x.tiers.web_search&&I.deep_research===x.tiers.deep_research;if(!W&&Y)return;const $=ft(i,M);r.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]=r,e[14]=p,e[15]=u,e[16]=g,e[17]=P,e[18]=h,e[19]=v,e[20]=N):N=e[20];const f=p?.id,b=u?.id,C=g?.id;let K;e[21]!==i||e[22]!==r||e[23]!==P||e[24]!==h||e[25]!==v||e[26]!==f||e[27]!==b||e[28]!==C?(K=[r,i,P,h,v,f,b,C],e[21]=i,e[22]=r,e[23]=P,e[24]=h,e[25]=v,e[26]=f,e[27]=b,e[28]=C,e[29]=K):K=e[29],J.useEffect(N,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const G=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const L=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 z;e[38]!==H?(z=s.jsx("p",{className:"text-sm text-muted-foreground",children:H}),e[38]=H,e[39]=z):z=e[39];const B=S&&!l;let E;e[40]!==_||e[41]!==B?(E=s.jsx(Ot,{isPending:_,showSaved:B}),e[40]=_,e[41]=B,e[42]=E):E=e[42];let R;e[43]!==z||e[44]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[z,E]}),e[43]=z,e[44]=E,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==r.control||e[48]!==L||e[49]!==G||e[50]!==m?(F=Tt.map(x=>s.jsx(rt,{control:r.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:G(x.key),description:L(x.key),action:s.jsx($t,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=r.control,e[48]=L,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 q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function Ht(e){return e.id}const zt={usd:[10,20,100],brl:[50,100,500]};function qt(){const e=X.c(30),t=ne(),i=ye(),[o,a]=J.useState(!1);let d;e[0]!==t?(d=f=>{oe.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=d):d=e[1];const{mutate:n,isPending:r}=je({mutationFn:async f=>{const{url:b}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:c});return b},onSuccess:Lt,onError:d}),[y,_]=J.useState(""),[S,l]=J.useState("usd"),c=S,m=parseFloat(y),p=!isNaN(m)&&m>=1,u=c==="brl"?"R$":"$";let g;e[2]!==l?(g=f=>{f&&l(f)},e[2]=l,e[3]=g):g=e[3];let P,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(P=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]=P,e[5]=h):(P=e[4],h=e[5]);let v;e[6]!==c||e[7]!==g?(v=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:c,onValueChange:g,children:[P,h]}),e[6]=c,e[7]=g,e[8]=v):v=e[8];let k;e[9]!==c||e[10]!==u||e[11]!==o||e[12]!==r||e[13]!==t||e[14]!==n?(k=!o&&s.jsxs(s.Fragment,{children:[zt[c].map(f=>s.jsxs(se,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:r,onClick:()=>n(f*100),children:[u,f]},f)),s.jsx(se,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:r,children:t("settings.decoCreditsHero.custom")})]}),e[9]=c,e[10]=u,e[11]=o,e[12]=r,e[13]=t,e[14]=n,e[15]=k):k=e[15];let j;e[16]!==u||e[17]!==y||e[18]!==m||e[19]!==o||e[20]!==p||e[21]!==r||e[22]!==_||e[23]!==t||e[24]!==n?(j=o&&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:u}),s.jsx(Ne,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:y,onChange:f=>_(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!p||r,onClick:()=>n(Math.round(m*100)),children:r?"...":t("settings.decoCreditsHero.add")}),s.jsx(se,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=u,e[17]=y,e[18]=m,e[19]=o,e[20]=p,e[21]=r,e[22]=_,e[23]=t,e[24]=n,e[25]=j):j=e[25];let N;return e[26]!==v||e[27]!==k||e[28]!==j?(N=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v,k,j]})}),e[26]=v,e[27]=k,e[28]=j,e[29]=N):N=e[29],N}function Lt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Bt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Vt(){const e=X.c(121),t=ne(),{org:i}=Ie(),o=ye(),a=De(),d=Se();let n;e[0]!==d?(n=d.find(Qt),e[0]=d,e[1]=n):n=e[1];const r=n,[y,_]=J.useState(!1);let S;e[2]!==r||e[3]!==o?(S=async()=>{r&&await o.call("AI_PROVIDER_KEY_DELETE",{keyId:r.id})},e[2]=r,e[3]=o,e[4]=S):S=e[4];let l;e[5]!==i.id||e[6]!==a||e[7]!==t?(l=()=>{a.invalidateQueries({queryKey:le.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:le.aiProviders(i.id)}),oe.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=>{oe.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:u}=je(m);let g;e[15]!==i.id?(g=le.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const P=!!r;let h;e[17]!==o?(h=async()=>{try{return await o.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=o,e[18]=h):h=e[18];let v;e[19]!==g||e[20]!==P||e[21]!==h?(v={queryKey:g,enabled:P,staleTime:6e4,queryFn:h},e[19]=g,e[20]=P,e[21]=h,e[22]=v):v=e[22];const{data:k,isLoading:j,refetch:N,isFetching:f}=Be(v);if(!r)return null;const b=k?.balanceCents!=null?k.balanceCents/100:null;let C;e[23]!==b?(C=b!=null?`$${b.toFixed(2)}`:"—",e[23]=b,e[24]=C):C=e[24];const K=C;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 L;e[31]!==t?(L=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=L):L=e[32];let U;e[33]!==L?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:L})}),e[33]=L,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 z;e[38]===Symbol.for("react.memo_cache_sentinel")?(z=()=>_(!0),e[38]=z):z=e[38];let B;e[39]!==t?(B=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=B):B=e[40];let E;e[41]!==u||e[42]!==B?(E=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:u,children:B}),e[41]=u,e[42]=B,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(Ye,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let I;e[62]!==p?(I=()=>p(),e[62]=p,e[63]=I):I=e[63];let W;e[64]!==t?(W=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=W):W=e[65];let Y;e[66]!==I||e[67]!==W?(Y=s.jsx(et,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:W}),e[66]=I,e[67]=W,e[68]=Y):Y=e[68];let $;e[69]!==w||e[70]!==Y?($=s.jsxs(tt,{children:[w,Y]}),e[69]=w,e[70]=Y,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]!==y||e[76]!==Q?(Z=s.jsx(it,{open:y,onOpenChange:_,children:Q}),e[75]=y,e[76]=Q,e[77]=Z):Z=e[77];let ee;e[78]!==b||e[79]!==K||e[80]!==f||e[81]!==j?(ee=j||f?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",b!=null&&Bt(b)),children:K}),e[78]=b,e[79]=K,e[80]=f,e[81]=j,e[82]=ee):ee=e[82];let re;e[83]!==N?(re=()=>N(),e[83]=N,e[84]=re):re=e[84];let te;e[85]!==t?(te=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=te):te=e[86];const Ke=f&&"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(Le,{size:14,className:ae}),e[89]=ae,e[90]=ce):ce=e[90];let de;e[91]!==f||e[92]!==re||e[93]!==te||e[94]!==ce?(de=s.jsx("button",{type:"button",onClick:re,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":te,children:ce}),e[91]=f,e[92]=re,e[93]=te,e[94]=ce,e[95]=de):de=e[95];let me;e[96]!==ee||e[97]!==de?(me=s.jsxs("div",{className:"flex items-baseline gap-2",children:[ee,de]}),e[96]=ee,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(qt,{}),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(),o=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]!==o?(d=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),o.invalidateQueries({queryKey:le.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:le.aiProviders(t.id)}),oe.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=o,e[4]=d):d=e[4];let n;return e[5]!==a||e[6]!==d?(n={mutationFn:a,onSuccess:d,onError:Wt},e[5]=a,e[6]=d,e[7]=n):n=e[7],je(n)}function Wt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),oe.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Yt(){const e=X.c(37),t=ne(),{mutate:i,isPending:o}=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 r;e[4]!==n?(r=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]=r):r=e[5];let y;e[6]!==t?(y=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=y):y=e[7];let _;e[8]!==y?(_=s.jsx("p",{className:"text-base font-semibold",children:y}),e[8]=y,e[9]=_):_=e[9];let 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 u;e[21]!==p||e[22]!==c?(u=s.jsxs("div",{className:"flex-1 min-w-0",children:[c,p]}),e[21]=p,e[22]=c,e[23]=u):u=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let P;e[26]!==o||e[27]!==t?(P=t(o?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=o,e[27]=t,e[28]=P):P=e[28];let h;e[29]!==o||e[30]!==g||e[31]!==P?(h=s.jsx(se,{variant:"outline",disabled:o,onClick:g,children:P}),e[29]=o,e[30]=g,e[31]=P,e[32]=h):h=e[32];let v;return e[33]!==u||e[34]!==h||e[35]!==r?(v=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:[r,u,h]})]}),e[33]=u,e[34]=h,e[35]=r,e[36]=v):v=e[36],v}const Jt=e=>ie({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function Xt({providerKey:e,provider:t,preset:i,maskedKey:o,currentLabel:a,currentBaseUrl:d,onCancel:n,onSuccess:r}){const{org:y}=Ie(),_=ye(),S=De(),l=ne(),[c,m]=J.useState(!1),p=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),g=Jt(l),{register:P,handleSubmit:h,watch:v,formState:{errors:k}}=qe({resolver:ze(g),defaultValues:{label:a,apiKey:"",baseUrl:d??""}}),j=v("apiKey")??"",{mutate:N,isPending:f}=je({mutationFn:async b=>{let C;b.apiKey?p?C=JSON.stringify({baseUrl:b.baseUrl||d||"",apiKey:b.apiKey}):C=b.apiKey:p&&b.baseUrl&&b.baseUrl!==d&&(C=JSON.stringify({baseUrl:b.baseUrl,apiKey:""})),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:b.label,...C!==void 0?{apiKey:C}:{}})},onSuccess:()=>{S.invalidateQueries({queryKey:le.aiProviderKeys(y.id)}),S.invalidateQueries({queryKey:le.aiProviders(y.id)}),oe.success(l("settings.editProviderDialog.providerUpdated")),r()},onError:b=>oe.error(l("settings.editProviderDialog.failedToUpdate",{error:b.message}))});return s.jsxs("form",{onSubmit:h(b=>N(b)),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"),...P("label"),className:"h-8 text-sm"}),k.label&&s.jsx("p",{className:"text-xs text-destructive",children:k.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"),...P("baseUrl"),className:"h-8 text-sm"})]}),u&&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&&j?"text":"password",placeholder:o,...P("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),j&&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})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Kt,{children:[s.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:f,children:l("settings.editProviderDialog.cancel")}),s.jsx(se,{type:"submit",size:"sm",disabled:f,children:l(f?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function Zt(e){const t=X.c(31),{providerKey:i,provider:o,open:a,onOpenChange:d}=e,n=ne(),r=ye(),y=o.id==="openai-compatible"&&i.presetId?We(i.presetId):void 0,_=y?.name??o.name;let S;t[0]!==i.id?(S=le.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=S):S=t[1];let l;t[2]!==i.id||t[3]!==r?(l=()=>r.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=r,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}=Be(c),u=Dt,g=It,P="sm:max-w-md",h=Nt,v=Pt,k=n("settings.editProviderDialog.editTitle",{name:_});let j;t[9]!==v||t[10]!==k?(j=s.jsx(v,{children:k}),t[9]=v,t[10]=k,t[11]=j):j=t[11];let N;t[12]!==h||t[13]!==j?(N=s.jsx(h,{children:j}),t[12]=h,t[13]=j,t[14]=N):N=t[14];let f;t[15]!==p||t[16]!==d||t[17]!==y||t[18]!==m||t[19]!==o||t[20]!==i?(f=p||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ut,{})}):s.jsx(Xt,{providerKey:i,provider:o,preset:y,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>d(!1),onSuccess:()=>d(!1)}),t[15]=p,t[16]=d,t[17]=y,t[18]=m,t[19]=o,t[20]=i,t[21]=f):f=t[21];let b;t[22]!==g||t[23]!==N||t[24]!==f?(b=s.jsxs(g,{className:P,children:[N,f]}),t[22]=g,t[23]=N,t[24]=f,t[25]=b):b=t[25];let C;return t[26]!==u||t[27]!==d||t[28]!==a||t[29]!==b?(C=s.jsx(u,{open:a,onOpenChange:d,children:b}),t[26]=u,t[27]=d,t[28]=a,t[29]=b,t[30]=C):C=t[30],C}function es(e){const t=X.c(83),{providerKey:i,provider:o}=e,{org:a}=Ie(),d=ye(),n=De(),[r,y]=J.useState(!1),[_,S]=J.useState(!1),l=ne(),c=o.id==="openai-compatible";let m;t[0]!==c||t[1]!==i.presetId?(m=c&&i.presetId?We(i.presetId):void 0,t[0]=c,t[1]=i.presetId,t[2]=m):m=t[2];const p=m,u=p?p.name:c?"Custom OpenAI-compatible":o.name,g=p?.logo??o.logo;let P;e:{if(c){P=i.label;break e}const re=i.label;let te;t[3]!==i.createdAt?(te=wt(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=te):te=t[4],P=`${re} · added ${te} ago`}const h=P;let v;t[5]!==i.id||t[6]!==d?(v=async()=>{await d.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=d,t[7]=v):v=t[7];let k;t[8]!==a||t[9]!==i.id||t[10]!==n||t[11]!==l?(k=()=>{n.invalidateQueries({queryKey:le.aiProviderKeys(a.id)}),n.invalidateQueries({queryKey:le.aiProviders(a.id)}),n.invalidateQueries({queryKey:le.aiProviderModels(a.id,i.id)}),oe.success(l("settings.providerKeyRow.keyDeleted")),y(!1)},t[8]=a,t[9]=i.id,t[10]=n,t[11]=l,t[12]=k):k=t[12];let j;t[13]!==l?(j=re=>oe.error(l("settings.providerKeyRow.failedToDeleteKey",{error:re.message})),t[13]=l,t[14]=j):j=t[14];let N;t[15]!==v||t[16]!==k||t[17]!==j?(N={mutationFn:v,onSuccess:k,onError:j},t[15]=v,t[16]=k,t[17]=j,t[18]=N):N=t[18];const{mutate:f,isPending:b}=je(N);let C;t[19]!==u||t[20]!==g?(C=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(_t,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[19]=u,t[20]=g,t[21]=C):C=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(se,{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 L;t[28]!==l?(L=l("settings.providerKeyRow.deleteProviderKey"),t[28]=l,t[29]=L):L=t[29];let U,H;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=()=>y(!0),H=s.jsx(St,{size:14}),t[30]=U,t[31]=H):(U=t[30],H=t[31]);let z;t[32]!==b||t[33]!==L?(z=s.jsx(se,{variant:"ghost",size:"icon","aria-label":L,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:b,onClick:U,children:H}),t[32]=b,t[33]=L,t[34]=z):z=t[34];let B;t[35]!==O||t[36]!==z?(B=s.jsxs("div",{className:"flex items-center gap-0.5",children:[O,z]}),t[35]=O,t[36]=z,t[37]=B):B=t[37];let E;t[38]!==h||t[39]!==u||t[40]!==B||t[41]!==C?(E=s.jsx(Qe,{icon:C,title:u,description:h,action:B}),t[38]=h,t[39]=u,t[40]=B,t[41]=C,t[42]=E):E=t[42];let R;t[43]!==_||t[44]!==o||t[45]!==i?(R=s.jsx(Zt,{providerKey:i,provider:o,open:_,onOpenChange:S}),t[43]=_,t[44]=o,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(Ye,{children:F}),t[49]=F,t[50]=T):T=t[50];let q;t[51]!==i.label||t[52]!==l?(q=l("settings.providerKeyRow.deleteApiKeyWarning",{label:i.label}),t[51]=i.label,t[52]=l,t[53]=q):q=t[53];let x;t[54]!==q?(x=s.jsx(Je,{children:q}),t[54]=q,t[55]=x):x=t[55];let A;t[56]!==T||t[57]!==x?(A=s.jsxs(Xe,{children:[T,x]}),t[56]=T,t[57]=x,t[58]=A):A=t[58];let M;t[59]!==l?(M=l("settings.providerKeyRow.cancel"),t[59]=l,t[60]=M):M=t[60];let w;t[61]!==M?(w=s.jsx(Ze,{children:M}),t[61]=M,t[62]=w):w=t[62];let I;t[63]!==f?(I=()=>f(),t[63]=f,t[64]=I):I=t[64];let W;t[65]!==l?(W=l("settings.providerKeyRow.delete"),t[65]=l,t[66]=W):W=t[66];let Y;t[67]!==I||t[68]!==W?(Y=s.jsx(et,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:W}),t[67]=I,t[68]=W,t[69]=Y):Y=t[69];let $;t[70]!==w||t[71]!==Y?($=s.jsxs(tt,{children:[w,Y]}),t[70]=w,t[71]=Y,t[72]=$):$=t[72];let Q;t[73]!==A||t[74]!==$?(Q=s.jsxs(st,{children:[A,$]}),t[73]=A,t[74]=$,t[75]=Q):Q=t[75];let Z;t[76]!==r||t[77]!==Q?(Z=s.jsx(it,{open:r,onOpenChange:y,children:Q}),t[76]=r,t[77]=Q,t[78]=Z):Z=t[78];let ee;return t[79]!==E||t[80]!==R||t[81]!==Z?(ee=s.jsxs(s.Fragment,{children:[E,R,Z]}),t[79]=E,t[80]=R,t[81]=Z,t[82]=ee):ee=t[82],ee}function ts(e){const t=X.c(17),{onConnectClick:i}=e,o=ne(),a=Se(),d=Ge();let n;t[0]!==d?.providers?(n=d?.providers??[],t[0]=d?.providers,t[1]=n):n=t[1];const r=n;let y;if(t[2]!==a||t[3]!==i||t[4]!==r||t[5]!==o){let _;t[7]!==r?(_=u=>({key:u,provider:r.find(g=>g.id===u.providerId)}),t[7]=r,t[8]=_):_=t[8];const S=a.filter(ls).map(_).filter(is);let l;t[9]!==o?(l=o("settings.connectedProvidersSection.sectionTitle"),t[9]=o,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]!==o?(m=o("settings.connectedProvidersSection.connectButton"),t[12]=o,t[13]=m):m=t[13];let p;t[14]!==i||t[15]!==m?(p=s.jsxs(se,{size:"sm",onClick:i,children:[c,m]}),t[14]=i,t[15]=m,t[16]=p):p=t[16],y=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:o("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:S.map(ss)})}),t[2]=a,t[3]=i,t[4]=r,t[5]=o,t[6]=y}else y=t[6];return y}function ss(e){const{key:t,provider:i}=e;return s.jsx(es,{providerKey:t,provider:i},t.id)}function is(e){return e.provider!==void 0}function ls(e){return e.providerId!=="deco"}function rs(e){const t=X.c(3),{error:i}=e;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(nt,{size:16}),t[0]=o):o=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:[o,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 os(){const e=X.c(23),t=Se();let i;e[0]!==t?(i=t.some(ns),e[0]=t,e[1]=i):i=e[1];const o=i,a=t.length>0,[d,n]=J.useState(!1),[r,y]=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 P;e[4]===Symbol.for("react.memo_cache_sentinel")?(P=()=>n(!0),e[4]=P):P=e[4];let h;e[5]!==l?(h=s.jsx(xt,{providers:l,onSelect:y,onShowAll:P}),e[5]=l,e[6]=h):h=e[6];const v=r!==null||d;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=b=>{b||(y(null),n(!1))},e[7]=k):k=e[7];const j=r??void 0;let N;e[8]!==v||e[9]!==j?(N=s.jsx($e,{open:v,onOpenChange:k,initialProvider:j}),e[8]=v,e[9]=j,e[10]=N):N=e[10];let f;return e[11]!==h||e[12]!==N?(f=s.jsxs(s.Fragment,{children:[h,N]}),e[11]=h,e[12]=N,e[13]=f):f=e[13],f}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]!==o?(m=o?s.jsx(Vt,{}):s.jsx(Yt,{}),e[15]=o,e[16]=m):m=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ts,{onConnectClick:()=>n(!0)}),e[17]=p):p=e[17];let u;e[18]!==d?(u=s.jsx($e,{open:d,onOpenChange:n}),e[18]=d,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=s.jsxs(s.Fragment,{children:[c,m,p,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g}function ns(e){return e.providerId==="deco"}function as(){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:cs,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(os,{})})})]})})})}),e[1]=i):i=e[1],i}function cs(e){const{error:t}=e;return s.jsx(rs,{error:t??new Error("Failed to load AI providers")})}function vi(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(At,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(as,{})}),e[0]=t):t=e[0],t}export{vi as default};
1
+ import{H as ie,I as D,ad as Ae,af as we,ag as Ue,ae as He,b3 as Fe,c as X,J as ze,M as qe,r as J,j as s,ah as rt,t as oe,aL as Le,C as Ie,n as De,d as je,K as le,m as Be,l as Te,B as se,p as Ve,E as ot}from"./index-K9nNk4ZL.js";import{i as nt}from"./AlertCircle-BAVOz-2x.js";import{P as ke}from"./index-DPFEIozt.js";import{S as Me}from"./skeleton-C31Wi2HR.js";import{b as Qe,a as Ee,S as Re,c as at}from"./settings-section-BPiTjvGZ.js";import{u as Se,a as Pe,b as Ge}from"./use-ai-providers-CvkcDt8z.js";import{i as ct}from"./CheckCircle-BUmTwNEw.js";import{n as dt,o as mt,q as ft,S as ut}from"./chat-context-CxcCOIx-.js";import{e as pt,f as gt}from"./use-organization-settings-CwwJujO2.js";import{M as ht,b as We,P as xt,C as $e}from"./select-model-BklSsqwO.js";import{u as bt}from"./use-debounced-autosave-CeSRLFvn.js";import{u as ne}from"./use-t-BYEA0NnF.js";import{I as Ne}from"./input-BTvFP-rc.js";import{T as Oe,a as vt}from"./toggle-group-DZ-PwSy9.js";import{c as Ye,d as Je,b as Xe,A as Ze,g as et,e as tt,a as st,f as it}from"./alert-dialog-Q_BwIUfu.js";import{u as ye}from"./studio-tools-DEV89u5s.js";import{s as yt}from"./Plus-B5eO3bTy.js";import{b as jt}from"./Tool01-BsvXLKqb.js";import{s as St}from"./Trash01-BNstTg_1.js";import{A as _t}from"./avatar-B7H5YfAv.js";import{i as Ct}from"./Settings02-CuWmowxn.js";import{s as kt}from"./Eye-C56Rqkt8.js";import{a as Pt,D as Nt,d as It,e as Dt,c as Kt}from"./dialog-Ccu5eFvd.js";import{f as wt}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as At}from"./require-capability-B9yFZhPk.js";import"./sidebar-DmkMTXRm.js";import"./LayoutLeft-CaPhxBpK.js";import"./use-mobile-CDLFoW5F.js";import"./X-BLBVAPOy.js";import"./tooltip-QIj4MYXF.js";import"./card-nbi0jwXg.js";import"./ArrowUpRight-DzplOzc9.js";import"./autosend-nTHzHKVV.js";import"./hooks-DJCvo0yZ.js";import"./use-mcp-client-E4o51i36.js";import"./auth-DWmoiFT3.js";import"./decopilot-sse-pool-DPMHbwbb.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-DWXqRlLT.js";import"./use-collections-BXT57saO.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-CW6CBoVI.js";import"./drawer-CTLHO_Po.js";import"./checkbox-0S0p1Qa5.js";import"./ChevronUp-CHwBY_gQ.js";import"./select-DkFTH4pS.js";import"./ChevronDown-BwIAM8yJ.js";import"./Key01-BoS606T3.js";import"./SearchMd-Byn-coVH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Bf_ipmVo.js";import"./ChevronRight-CR81Jb7f.js";import"./connect-desktop-dialog-CthnsqOM.js";import"./Copy01-fXkAnRle.js";import"./Image01-ffA98M16.js";import"./Stars01-hjCPYLmR.js";import"./User01-B6A0_PQ7.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-B5gueICr.js";import"./access-gate-ChNZThLC.js";import"./capability-load-error-DpDC2nXy.js";ie({title:D(),url:D(),icon:D()});ie({registries:we(D(),ie({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=ie({keyId:D(),modelId:D(),title:D().optional()}).nullable();He(["fast","smart","thinking","image","web_search","deep_research"]);He(["fast","smart","thinking"]);const Mt=ie({tiers:ie({fast:ve,smart:ve,thinking:ve,image:ve,web_search:ve,deep_research:ve})});ie({ids:Ae(D()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});ie({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:ie({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:ie({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:o,filterModels:a,defaultKeyId:d}=e,n=Se(),[r,y]=J.useState(i?.keyId??d);let _;t[0]!==i?(_=()=>{i?.keyId&&y(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=r??d;let m;t[4]!==c||t[5]!==n?(m=c?n.find(C=>C.id===c):null,t[4]=c,t[5]=n,t[6]=m):m=t[6];const p=m,{models:u,isLoading:g}=Pe(a?c??void 0:void 0),P=a?g||u.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 v=h,k=ne();if(a&&!P){let C;t[10]!==k?(C=k("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=k,t[11]=C):C=t[11];let K;return t[12]!==C?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:C}),t[12]=C,t[13]=K):K=t[13],K}let j;t[14]!==k?(j=k("settings.simpleModeSection.pickModel"),t[14]=k,t[15]=j):j=t[15];let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=C=>y(C),t[16]=N):N=t[16];let f;t[17]!==c||t[18]!==o?(f=C=>{const K=C.keyId??c??"";y(K),o({keyId:K,modelId:C.modelId,title:C.title})},t[17]=c,t[18]=o,t[19]=f):f=t[19];let b;return t[20]!==c||t[21]!==a||t[22]!==v||t[23]!==j||t[24]!==f?(b=s.jsx(ht,{variant:"bordered",placeholder:j,model:v,credentialId:c,filterModels:a,onCredentialChange:N,onModelChange:f}),t[20]=c,t[21]=a,t[22]=v,t[23]=j,t[24]=f,t[25]=b):b=t[25],b}function Ot(e){const t=X.c(10),{isPending:i,showSaved:o}=e,a=ne();if(i){let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Le,{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 r;return t[3]!==n?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[3]=n,t[4]=r):r=t[4],r}if(o){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 r;return t[8]!==n?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[d,n]}),t[8]=n,t[9]=r):r=t[9],r}return null}function Ut(){const e=X.c(58),t=ne(),i=Se(),o=pt(),a=i.length>0;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=ze(Mt),e[0]=d):d=e[0];let n;e[1]!==o?(n={resolver:d,values:o,mode:"onChange"},e[1]=o,e[2]=n):n=e[2];const r=qe(n),{mutate:y,isPending:_,isSuccess:S}=gt(),l=r.formState.isDirty;let c;e[3]!==r||e[4]!==o||e[5]!==t||e[6]!==y?(c={delayMs:250,save:async()=>{const x=r.getValues();y(x,{onSuccess:()=>r.reset(x,{keepValues:!0}),onError:A=>{r.reset(o),oe.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=r,e[4]=o,e[5]=t,e[6]=y,e[7]=c):c=e[7];const{schedule:m}=bt(c),p=i[0],u=i[1],g=i[2],{models:P}=Pe(p?.id),{models:h}=Pe(u?.id),{models:v}=Pe(g?.id);let k,j;e[8]!==r||e[9]!==a?(k=()=>{a||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},j=[a,r],e[8]=r,e[9]=a,e[10]=k,e[11]=j):(k=e[10],j=e[11]),J.useEffect(k,j);let N;e[12]!==i||e[13]!==r||e[14]!==p||e[15]!==u||e[16]!==g||e[17]!==P||e[18]!==h||e[19]!==v?(N=()=>{const x=r.getValues(),A=new Set(i.map(Ht)),M={};p?.id&&(M[p.id]=P),u?.id&&(M[u.id]=h),g?.id&&(M[g.id]=v);const w=Q=>Q!=null&&!A.has(Q.keyId),I={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},W=!I.fast||!I.smart||!I.thinking||!I.image||!I.web_search||!I.deep_research,Y=I.fast===x.tiers.fast&&I.smart===x.tiers.smart&&I.thinking===x.tiers.thinking&&I.image===x.tiers.image&&I.web_search===x.tiers.web_search&&I.deep_research===x.tiers.deep_research;if(!W&&Y)return;const $=ft(i,M);r.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]=r,e[14]=p,e[15]=u,e[16]=g,e[17]=P,e[18]=h,e[19]=v,e[20]=N):N=e[20];const f=p?.id,b=u?.id,C=g?.id;let K;e[21]!==i||e[22]!==r||e[23]!==P||e[24]!==h||e[25]!==v||e[26]!==f||e[27]!==b||e[28]!==C?(K=[r,i,P,h,v,f,b,C],e[21]=i,e[22]=r,e[23]=P,e[24]=h,e[25]=v,e[26]=f,e[27]=b,e[28]=C,e[29]=K):K=e[29],J.useEffect(N,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const G=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const L=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 z;e[38]!==H?(z=s.jsx("p",{className:"text-sm text-muted-foreground",children:H}),e[38]=H,e[39]=z):z=e[39];const B=S&&!l;let E;e[40]!==_||e[41]!==B?(E=s.jsx(Ot,{isPending:_,showSaved:B}),e[40]=_,e[41]=B,e[42]=E):E=e[42];let R;e[43]!==z||e[44]!==E?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[z,E]}),e[43]=z,e[44]=E,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==r.control||e[48]!==L||e[49]!==G||e[50]!==m?(F=Tt.map(x=>s.jsx(rt,{control:r.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:G(x.key),description:L(x.key),action:s.jsx($t,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=r.control,e[48]=L,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 q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Re,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function Ht(e){return e.id}const zt={usd:[10,20,100],brl:[50,100,500]};function qt(){const e=X.c(30),t=ne(),i=ye(),[o,a]=J.useState(!1);let d;e[0]!==t?(d=f=>{oe.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=d):d=e[1];const{mutate:n,isPending:r}=je({mutationFn:async f=>{const{url:b}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:c});return b},onSuccess:Lt,onError:d}),[y,_]=J.useState(""),[S,l]=J.useState("usd"),c=S,m=parseFloat(y),p=!isNaN(m)&&m>=1,u=c==="brl"?"R$":"$";let g;e[2]!==l?(g=f=>{f&&l(f)},e[2]=l,e[3]=g):g=e[3];let P,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(P=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]=P,e[5]=h):(P=e[4],h=e[5]);let v;e[6]!==c||e[7]!==g?(v=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:c,onValueChange:g,children:[P,h]}),e[6]=c,e[7]=g,e[8]=v):v=e[8];let k;e[9]!==c||e[10]!==u||e[11]!==o||e[12]!==r||e[13]!==t||e[14]!==n?(k=!o&&s.jsxs(s.Fragment,{children:[zt[c].map(f=>s.jsxs(se,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:r,onClick:()=>n(f*100),children:[u,f]},f)),s.jsx(se,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:r,children:t("settings.decoCreditsHero.custom")})]}),e[9]=c,e[10]=u,e[11]=o,e[12]=r,e[13]=t,e[14]=n,e[15]=k):k=e[15];let j;e[16]!==u||e[17]!==y||e[18]!==m||e[19]!==o||e[20]!==p||e[21]!==r||e[22]!==_||e[23]!==t||e[24]!==n?(j=o&&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:u}),s.jsx(Ne,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:y,onChange:f=>_(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!p||r,onClick:()=>n(Math.round(m*100)),children:r?"...":t("settings.decoCreditsHero.add")}),s.jsx(se,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),_("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=u,e[17]=y,e[18]=m,e[19]=o,e[20]=p,e[21]=r,e[22]=_,e[23]=t,e[24]=n,e[25]=j):j=e[25];let N;return e[26]!==v||e[27]!==k||e[28]!==j?(N=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v,k,j]})}),e[26]=v,e[27]=k,e[28]=j,e[29]=N):N=e[29],N}function Lt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Bt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Vt(){const e=X.c(121),t=ne(),{org:i}=Ie(),o=ye(),a=De(),d=Se();let n;e[0]!==d?(n=d.find(Qt),e[0]=d,e[1]=n):n=e[1];const r=n,[y,_]=J.useState(!1);let S;e[2]!==r||e[3]!==o?(S=async()=>{r&&await o.call("AI_PROVIDER_KEY_DELETE",{keyId:r.id})},e[2]=r,e[3]=o,e[4]=S):S=e[4];let l;e[5]!==i.id||e[6]!==a||e[7]!==t?(l=()=>{a.invalidateQueries({queryKey:le.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:le.aiProviders(i.id)}),oe.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=>{oe.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:u}=je(m);let g;e[15]!==i.id?(g=le.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const P=!!r;let h;e[17]!==o?(h=async()=>{try{return await o.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=o,e[18]=h):h=e[18];let v;e[19]!==g||e[20]!==P||e[21]!==h?(v={queryKey:g,enabled:P,staleTime:6e4,queryFn:h},e[19]=g,e[20]=P,e[21]=h,e[22]=v):v=e[22];const{data:k,isLoading:j,refetch:N,isFetching:f}=Be(v);if(!r)return null;const b=k?.balanceCents!=null?k.balanceCents/100:null;let C;e[23]!==b?(C=b!=null?`$${b.toFixed(2)}`:"—",e[23]=b,e[24]=C):C=e[24];const K=C;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 L;e[31]!==t?(L=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=L):L=e[32];let U;e[33]!==L?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:L})}),e[33]=L,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 z;e[38]===Symbol.for("react.memo_cache_sentinel")?(z=()=>_(!0),e[38]=z):z=e[38];let B;e[39]!==t?(B=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=B):B=e[40];let E;e[41]!==u||e[42]!==B?(E=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:u,children:B}),e[41]=u,e[42]=B,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(Ye,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let I;e[62]!==p?(I=()=>p(),e[62]=p,e[63]=I):I=e[63];let W;e[64]!==t?(W=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=W):W=e[65];let Y;e[66]!==I||e[67]!==W?(Y=s.jsx(et,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:W}),e[66]=I,e[67]=W,e[68]=Y):Y=e[68];let $;e[69]!==w||e[70]!==Y?($=s.jsxs(tt,{children:[w,Y]}),e[69]=w,e[70]=Y,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]!==y||e[76]!==Q?(Z=s.jsx(it,{open:y,onOpenChange:_,children:Q}),e[75]=y,e[76]=Q,e[77]=Z):Z=e[77];let ee;e[78]!==b||e[79]!==K||e[80]!==f||e[81]!==j?(ee=j||f?s.jsx(Me,{className:"h-9 w-24"}):s.jsx("span",{className:Te("text-3xl font-semibold tabular-nums tracking-tight",b!=null&&Bt(b)),children:K}),e[78]=b,e[79]=K,e[80]=f,e[81]=j,e[82]=ee):ee=e[82];let re;e[83]!==N?(re=()=>N(),e[83]=N,e[84]=re):re=e[84];let te;e[85]!==t?(te=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=te):te=e[86];const Ke=f&&"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(Le,{size:14,className:ae}),e[89]=ae,e[90]=ce):ce=e[90];let de;e[91]!==f||e[92]!==re||e[93]!==te||e[94]!==ce?(de=s.jsx("button",{type:"button",onClick:re,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":te,children:ce}),e[91]=f,e[92]=re,e[93]=te,e[94]=ce,e[95]=de):de=e[95];let me;e[96]!==ee||e[97]!==de?(me=s.jsxs("div",{className:"flex items-baseline gap-2",children:[ee,de]}),e[96]=ee,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(qt,{}),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(),o=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]!==o?(d=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),o.invalidateQueries({queryKey:le.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:le.aiProviders(t.id)}),oe.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=o,e[4]=d):d=e[4];let n;return e[5]!==a||e[6]!==d?(n={mutationFn:a,onSuccess:d,onError:Wt},e[5]=a,e[6]=d,e[7]=n):n=e[7],je(n)}function Wt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),oe.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Yt(){const e=X.c(37),t=ne(),{mutate:i,isPending:o}=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 r;e[4]!==n?(r=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]=r):r=e[5];let y;e[6]!==t?(y=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=y):y=e[7];let _;e[8]!==y?(_=s.jsx("p",{className:"text-base font-semibold",children:y}),e[8]=y,e[9]=_):_=e[9];let 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 u;e[21]!==p||e[22]!==c?(u=s.jsxs("div",{className:"flex-1 min-w-0",children:[c,p]}),e[21]=p,e[22]=c,e[23]=u):u=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let P;e[26]!==o||e[27]!==t?(P=t(o?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=o,e[27]=t,e[28]=P):P=e[28];let h;e[29]!==o||e[30]!==g||e[31]!==P?(h=s.jsx(se,{variant:"outline",disabled:o,onClick:g,children:P}),e[29]=o,e[30]=g,e[31]=P,e[32]=h):h=e[32];let v;return e[33]!==u||e[34]!==h||e[35]!==r?(v=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:[r,u,h]})]}),e[33]=u,e[34]=h,e[35]=r,e[36]=v):v=e[36],v}const Jt=e=>ie({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function Xt({providerKey:e,provider:t,preset:i,maskedKey:o,currentLabel:a,currentBaseUrl:d,onCancel:n,onSuccess:r}){const{org:y}=Ie(),_=ye(),S=De(),l=ne(),[c,m]=J.useState(!1),p=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),g=Jt(l),{register:P,handleSubmit:h,watch:v,formState:{errors:k}}=qe({resolver:ze(g),defaultValues:{label:a,apiKey:"",baseUrl:d??""}}),j=v("apiKey")??"",{mutate:N,isPending:f}=je({mutationFn:async b=>{let C;b.apiKey?p?C=JSON.stringify({baseUrl:b.baseUrl||d||"",apiKey:b.apiKey}):C=b.apiKey:p&&b.baseUrl&&b.baseUrl!==d&&(C=JSON.stringify({baseUrl:b.baseUrl,apiKey:""})),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:b.label,...C!==void 0?{apiKey:C}:{}})},onSuccess:()=>{S.invalidateQueries({queryKey:le.aiProviderKeys(y.id)}),S.invalidateQueries({queryKey:le.aiProviders(y.id)}),oe.success(l("settings.editProviderDialog.providerUpdated")),r()},onError:b=>oe.error(l("settings.editProviderDialog.failedToUpdate",{error:b.message}))});return s.jsxs("form",{onSubmit:h(b=>N(b)),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"),...P("label"),className:"h-8 text-sm"}),k.label&&s.jsx("p",{className:"text-xs text-destructive",children:k.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"),...P("baseUrl"),className:"h-8 text-sm"})]}),u&&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&&j?"text":"password",placeholder:o,...P("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),j&&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})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Kt,{children:[s.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:f,children:l("settings.editProviderDialog.cancel")}),s.jsx(se,{type:"submit",size:"sm",disabled:f,children:l(f?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function Zt(e){const t=X.c(31),{providerKey:i,provider:o,open:a,onOpenChange:d}=e,n=ne(),r=ye(),y=o.id==="openai-compatible"&&i.presetId?We(i.presetId):void 0,_=y?.name??o.name;let S;t[0]!==i.id?(S=le.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=S):S=t[1];let l;t[2]!==i.id||t[3]!==r?(l=()=>r.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=r,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}=Be(c),u=Dt,g=It,P="sm:max-w-md",h=Nt,v=Pt,k=n("settings.editProviderDialog.editTitle",{name:_});let j;t[9]!==v||t[10]!==k?(j=s.jsx(v,{children:k}),t[9]=v,t[10]=k,t[11]=j):j=t[11];let N;t[12]!==h||t[13]!==j?(N=s.jsx(h,{children:j}),t[12]=h,t[13]=j,t[14]=N):N=t[14];let f;t[15]!==p||t[16]!==d||t[17]!==y||t[18]!==m||t[19]!==o||t[20]!==i?(f=p||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ut,{})}):s.jsx(Xt,{providerKey:i,provider:o,preset:y,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>d(!1),onSuccess:()=>d(!1)}),t[15]=p,t[16]=d,t[17]=y,t[18]=m,t[19]=o,t[20]=i,t[21]=f):f=t[21];let b;t[22]!==g||t[23]!==N||t[24]!==f?(b=s.jsxs(g,{className:P,children:[N,f]}),t[22]=g,t[23]=N,t[24]=f,t[25]=b):b=t[25];let C;return t[26]!==u||t[27]!==d||t[28]!==a||t[29]!==b?(C=s.jsx(u,{open:a,onOpenChange:d,children:b}),t[26]=u,t[27]=d,t[28]=a,t[29]=b,t[30]=C):C=t[30],C}function es(e){const t=X.c(83),{providerKey:i,provider:o}=e,{org:a}=Ie(),d=ye(),n=De(),[r,y]=J.useState(!1),[_,S]=J.useState(!1),l=ne(),c=o.id==="openai-compatible";let m;t[0]!==c||t[1]!==i.presetId?(m=c&&i.presetId?We(i.presetId):void 0,t[0]=c,t[1]=i.presetId,t[2]=m):m=t[2];const p=m,u=p?p.name:c?"Custom OpenAI-compatible":o.name,g=p?.logo??o.logo;let P;e:{if(c){P=i.label;break e}const re=i.label;let te;t[3]!==i.createdAt?(te=wt(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=te):te=t[4],P=`${re} · added ${te} ago`}const h=P;let v;t[5]!==i.id||t[6]!==d?(v=async()=>{await d.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=d,t[7]=v):v=t[7];let k;t[8]!==a||t[9]!==i.id||t[10]!==n||t[11]!==l?(k=()=>{n.invalidateQueries({queryKey:le.aiProviderKeys(a.id)}),n.invalidateQueries({queryKey:le.aiProviders(a.id)}),n.invalidateQueries({queryKey:le.aiProviderModels(a.id,i.id)}),oe.success(l("settings.providerKeyRow.keyDeleted")),y(!1)},t[8]=a,t[9]=i.id,t[10]=n,t[11]=l,t[12]=k):k=t[12];let j;t[13]!==l?(j=re=>oe.error(l("settings.providerKeyRow.failedToDeleteKey",{error:re.message})),t[13]=l,t[14]=j):j=t[14];let N;t[15]!==v||t[16]!==k||t[17]!==j?(N={mutationFn:v,onSuccess:k,onError:j},t[15]=v,t[16]=k,t[17]=j,t[18]=N):N=t[18];const{mutate:f,isPending:b}=je(N);let C;t[19]!==u||t[20]!==g?(C=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(_t,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[19]=u,t[20]=g,t[21]=C):C=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(se,{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 L;t[28]!==l?(L=l("settings.providerKeyRow.deleteProviderKey"),t[28]=l,t[29]=L):L=t[29];let U,H;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=()=>y(!0),H=s.jsx(St,{size:14}),t[30]=U,t[31]=H):(U=t[30],H=t[31]);let z;t[32]!==b||t[33]!==L?(z=s.jsx(se,{variant:"ghost",size:"icon","aria-label":L,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:b,onClick:U,children:H}),t[32]=b,t[33]=L,t[34]=z):z=t[34];let B;t[35]!==O||t[36]!==z?(B=s.jsxs("div",{className:"flex items-center gap-0.5",children:[O,z]}),t[35]=O,t[36]=z,t[37]=B):B=t[37];let E;t[38]!==h||t[39]!==u||t[40]!==B||t[41]!==C?(E=s.jsx(Qe,{icon:C,title:u,description:h,action:B}),t[38]=h,t[39]=u,t[40]=B,t[41]=C,t[42]=E):E=t[42];let R;t[43]!==_||t[44]!==o||t[45]!==i?(R=s.jsx(Zt,{providerKey:i,provider:o,open:_,onOpenChange:S}),t[43]=_,t[44]=o,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(Ye,{children:F}),t[49]=F,t[50]=T):T=t[50];let q;t[51]!==i.label||t[52]!==l?(q=l("settings.providerKeyRow.deleteApiKeyWarning",{label:i.label}),t[51]=i.label,t[52]=l,t[53]=q):q=t[53];let x;t[54]!==q?(x=s.jsx(Je,{children:q}),t[54]=q,t[55]=x):x=t[55];let A;t[56]!==T||t[57]!==x?(A=s.jsxs(Xe,{children:[T,x]}),t[56]=T,t[57]=x,t[58]=A):A=t[58];let M;t[59]!==l?(M=l("settings.providerKeyRow.cancel"),t[59]=l,t[60]=M):M=t[60];let w;t[61]!==M?(w=s.jsx(Ze,{children:M}),t[61]=M,t[62]=w):w=t[62];let I;t[63]!==f?(I=()=>f(),t[63]=f,t[64]=I):I=t[64];let W;t[65]!==l?(W=l("settings.providerKeyRow.delete"),t[65]=l,t[66]=W):W=t[66];let Y;t[67]!==I||t[68]!==W?(Y=s.jsx(et,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:W}),t[67]=I,t[68]=W,t[69]=Y):Y=t[69];let $;t[70]!==w||t[71]!==Y?($=s.jsxs(tt,{children:[w,Y]}),t[70]=w,t[71]=Y,t[72]=$):$=t[72];let Q;t[73]!==A||t[74]!==$?(Q=s.jsxs(st,{children:[A,$]}),t[73]=A,t[74]=$,t[75]=Q):Q=t[75];let Z;t[76]!==r||t[77]!==Q?(Z=s.jsx(it,{open:r,onOpenChange:y,children:Q}),t[76]=r,t[77]=Q,t[78]=Z):Z=t[78];let ee;return t[79]!==E||t[80]!==R||t[81]!==Z?(ee=s.jsxs(s.Fragment,{children:[E,R,Z]}),t[79]=E,t[80]=R,t[81]=Z,t[82]=ee):ee=t[82],ee}function ts(e){const t=X.c(17),{onConnectClick:i}=e,o=ne(),a=Se(),d=Ge();let n;t[0]!==d?.providers?(n=d?.providers??[],t[0]=d?.providers,t[1]=n):n=t[1];const r=n;let y;if(t[2]!==a||t[3]!==i||t[4]!==r||t[5]!==o){let _;t[7]!==r?(_=u=>({key:u,provider:r.find(g=>g.id===u.providerId)}),t[7]=r,t[8]=_):_=t[8];const S=a.filter(ls).map(_).filter(is);let l;t[9]!==o?(l=o("settings.connectedProvidersSection.sectionTitle"),t[9]=o,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]!==o?(m=o("settings.connectedProvidersSection.connectButton"),t[12]=o,t[13]=m):m=t[13];let p;t[14]!==i||t[15]!==m?(p=s.jsxs(se,{size:"sm",onClick:i,children:[c,m]}),t[14]=i,t[15]=m,t[16]=p):p=t[16],y=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:o("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:S.map(ss)})}),t[2]=a,t[3]=i,t[4]=r,t[5]=o,t[6]=y}else y=t[6];return y}function ss(e){const{key:t,provider:i}=e;return s.jsx(es,{providerKey:t,provider:i},t.id)}function is(e){return e.provider!==void 0}function ls(e){return e.providerId!=="deco"}function rs(e){const t=X.c(3),{error:i}=e;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(nt,{size:16}),t[0]=o):o=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:[o,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 os(){const e=X.c(23),t=Se();let i;e[0]!==t?(i=t.some(ns),e[0]=t,e[1]=i):i=e[1];const o=i,a=t.length>0,[d,n]=J.useState(!1),[r,y]=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 P;e[4]===Symbol.for("react.memo_cache_sentinel")?(P=()=>n(!0),e[4]=P):P=e[4];let h;e[5]!==l?(h=s.jsx(xt,{providers:l,onSelect:y,onShowAll:P}),e[5]=l,e[6]=h):h=e[6];const v=r!==null||d;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=b=>{b||(y(null),n(!1))},e[7]=k):k=e[7];const j=r??void 0;let N;e[8]!==v||e[9]!==j?(N=s.jsx($e,{open:v,onOpenChange:k,initialProvider:j}),e[8]=v,e[9]=j,e[10]=N):N=e[10];let f;return e[11]!==h||e[12]!==N?(f=s.jsxs(s.Fragment,{children:[h,N]}),e[11]=h,e[12]=N,e[13]=f):f=e[13],f}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]!==o?(m=o?s.jsx(Vt,{}):s.jsx(Yt,{}),e[15]=o,e[16]=m):m=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ts,{onConnectClick:()=>n(!0)}),e[17]=p):p=e[17];let u;e[18]!==d?(u=s.jsx($e,{open:d,onOpenChange:n}),e[18]=d,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=s.jsxs(s.Fragment,{children:[c,m,p,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g}function ns(e){return e.providerId==="deco"}function as(){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:cs,children:s.jsx(J.Suspense,{fallback:s.jsx(Me,{className:"h-64 w-full"}),children:s.jsx(os,{})})})]})})})}),e[1]=i):i=e[1],i}function cs(e){const{error:t}=e;return s.jsx(rs,{error:t??new Error("Failed to load AI providers")})}function vi(){const e=X.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(At,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(as,{})}),e[0]=t):t=e[0],t}export{vi as default};
@@ -1 +1 @@
1
- import{c as n,l as o,j as c,bC as d}from"./index-BMMnZ_kU.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,bC as d}from"./index-K9nNk4ZL.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,cM as w,r as i,aS as m,dG as O,F as T,aU as M,cL as I,cN as F,cP as A,dH as D,cO as L,cX as z,aQ as G,cZ as H,cQ as Q,c as n,l as p,bQ as v}from"./index-BMMnZ_kU.js";var x="AlertDialog",[k]=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 V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Q,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[B,U]=k(f),X=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(B,{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(X,{children:a}),r.jsx(J,{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 Z="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Z;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var J=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{j as r,cM as w,r as i,aS as m,dG as O,F as T,aU as M,cL as I,cN as F,cP as A,dH as D,cO as L,cX as z,aQ as G,cZ as H,cQ as Q,c as n,l as p,bQ as v}from"./index-K9nNk4ZL.js";var x="AlertDialog",[k]=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 V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Q,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[B,U]=k(f),X=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(B,{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(X,{children:a}),r.jsx(J,{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 Z="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Z;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var J=({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-BMMnZ_kU.js";import{i as jt}from"./ChevronRight-CfjLE0HN.js";import{m as kt}from"./automation-runs-97vVniQB.js";import{A as _t}from"./add-section-modal-C6oyMnRD.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-CihUyKVR.js";import"./select-CEjAa51v.js";import"./tooltip-DGjRuZi1.js";import"./ChevronUp-BXnZQZ3H.js";import"./ChevronDown-CKv359F0.js";import"./useInfiniteQuery-CTHi40J6.js";import"./use-infinite-scroll-BQKuGeZW.js";import"./use-connection-Dtoxwk_v.js";import"./use-collections-DfM_LEkP.js";import"./use-mcp-client-BdvBykSl.js";import"./auth-luIK0osn.js";import"./use-virtual-mcp-CLPxduRS.js";import"./card-DzAexHYy.js";import"./sidebar-BKJHes1N.js";import"./LayoutLeft-Dk_UeFQQ.js";import"./use-mobile-Bef-oAkh.js";import"./X-0zKy4PV1.js";import"./table-Cms01M2Z.js";import"./empty-state-lR_3kEW4.js";import"./use-members-D4YLs-Jc.js";import"./use-org-auth-client-BzbwdJQH.js";import"./use-clock-tick-qyYcZOnR.js";import"./AlertCircle-bnM-AHGO.js";import"./CheckCircle-BFjklaOK.js";import"./DotsVertical-C4_fm4pn.js";import"./agent-icon-ChVtquyW.js";import"./Tool01-FIiY7fJ0.js";import"./ArrowUp-E_r50_2m.js";import"./Settings02-DKg6N4zo.js";import"./Tool02-B5Nxme6Y.js";import"./XCircle-DjghKaHD.js";import"./ArrowUpRight-CTGmCwuB.js";import"./TrendUp01-AEVL9FCI.js";import"./ZapSquare-zQFlsNS9.js";import"./ZoomOut-D9TWERka.js";import"./Users03-DlrfEd_j.js";import"./Stars02-DC2mUh1c.js";import"./Copy01-DKZgR_7b.js";import"./Globe01-BQUa9MmI.js";import"./Eye-CAFwHWrY.js";import"./FilterLines-BDXLhdvw.js";import"./Star01-BaOZVkLR.js";import"./Globe04-CiV5sfOt.js";import"./SwitchHorizontal01-CIB6pEiS.js";import"./HardDrive-CZUPAV8x.js";import"./Image01-CKQwIs-X.js";import"./Key01-6U7RTmt2.js";import"./LinkExternal01-cD5Jzz7-.js";import"./Monitor01-BgKfGb_C.js";import"./Sun-D9Vmvb3x.js";import"./Package-BF9Ikoon.js";import"./Palette-CwbAfJE1.js";import"./Play-CcnUngDU.js";import"./Plus-Da7EO9JW.js";import"./SearchLg-BU9kkayS.js";import"./SearchMd-DvFCXO2G.js";import"./Shield01-Cvfb7wza.js";import"./Stars01-BCzbdnTA.js";import"./Trash01-DgMONZbo.js";import"./Upload01-txM4Ed1z.js";import"./User01-CB_k4B4C.js";import"./Users01-BBF6f3lO.js";import"./XClose-BG6EvGbU.js";import"./Zap-B5UqaMnU.js";import"./use-automations-Dph6FubM.js";import"./studio-tools-B-Eij61m.js";import"./useSuspenseInfiniteQuery-7sOHoy9i.js";import"./avatar-BaV7IKOZ.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BVQGJ-sy.js";import"./file-type-icon-AZuZgEJR.js";import"./dialog-DxYV-693.js";import"./tab-id-BijBBRwE.js";import"./hooks-BQfoSwJf.js";import"./decopilot-sse-pool-BVHOHmrO.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-c0BhAQmo.js";import"./autosend-DdGcTLBu.js";import"./use-ai-providers-CCC_yTQZ.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-DATU1apS.js";import"./use-organization-settings-DR8jU_IF.js";import"./monaco-editor-B_E5AYPW.js";import"./index-Cfp3S5Yv.js";import"./index-D6ohfUq5.js";import"./calendar-CYKpLEK4.js";import"./shell-layout-DKSoLsMT.js";import"./use-t-BPFwceba.js";import"./required-auth-layout-Gxfgdr_y.js";import"./use-org-sso-CAvXAkMi.js";import"./integration-icon-CWW8IWzL.js";import"./use-navigate-to-agent-DC4DOTvY.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-CGniEng_.js";import"./form-B5_Adu-q.js";import"./label-mmWPkvpb.js";import"./input-DO3omnvV.js";import"./drawer-qstCMw0Q.js";import"./collection-search-Dt7NiO4g.js";import"./index-6l6Vg_pR.js";import"./get-initials-D-f_fDFw.js";import"./use-registry-app-S0Rojzrq.js";import"./use-mcp-tools-DwILy75s.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-D7ClJY6z.js";import"./mcp-oauth-D9VV6Aqh.js";import"./extract-connection-data-DardgW4l.js";import"./dropdown-menu-BQ-1kZyc.js";import"./popover-C0PapJhm.js";import"./command-Bqg8EvQe.js";import"./index--7Dl1ohP.js";import"./companions-core-B0Eh3Zr_.js";import"./tabs-C49u88u9.js";import"./toggle-group-CNog9xMD.js";import"./use-deco-credits-NTd3RI-N.js";import"./connection-card-BUL5tgWk.js";import"./use-registry-connections-BtFws4Kn.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-B35vZ5jN.js";import"./connection-form-helpers-Du1LFZ4M.js";import"./collection-tabs-BwZkgBbZ.js";import"./badge-9gxuzEJo.js";import"./connect-desktop-dialog-BOIK_vOw.js";import"./select-model-D4cfbFuD.js";import"./checkbox-_NM5O-zb.js";import"./skeleton-DRYlvCM9.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-DgtumuNO.js";import"./index-jM9Hlwh7.js";import"./alert-dialog-rb3D-dE0.js";import"./toolbar-BjEknNG8.js";import"./use-debounced-value-CraLUb40.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-SizlMvIJ.js";import"./use-capability-CXQN2i28.js";import"./toolbar-icon-button-BzzPGdXN.js";import"./use-debounced-autosave-DDMvbPZQ.js";import"./index-c2qA4sKG.js";import"./search-input-B7BOe7-Z.js";import"./use-mcp-auth-status-C9F7z-xG.js";import"./switch-Cu3VZitj.js";import"./github-repo-picker-Cwo2CoXO.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-CnOAKTMF.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-file-configs-wYzg3Q9h.js";import"./automation-list-row-B5YVrOQp.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 Cr(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{Cr as AppEditor};
1
+ import{c as gt,r as w,j as o,l as yt,t as ut,i as St}from"./index-K9nNk4ZL.js";import{i as jt}from"./ChevronRight-CR81Jb7f.js";import{m as kt}from"./automation-runs-D4MCi19D.js";import{A as _t}from"./add-section-modal-qIs8pZh0.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-wvAyIVBW.js";import"./select-DkFTH4pS.js";import"./tooltip-QIj4MYXF.js";import"./ChevronUp-CHwBY_gQ.js";import"./ChevronDown-BwIAM8yJ.js";import"./useInfiniteQuery-Bz26qvcU.js";import"./use-infinite-scroll-COEiXKgN.js";import"./use-connection-B1oTCIml.js";import"./use-collections-BXT57saO.js";import"./use-mcp-client-E4o51i36.js";import"./auth-DWmoiFT3.js";import"./use-virtual-mcp-DWXqRlLT.js";import"./card-nbi0jwXg.js";import"./sidebar-DmkMTXRm.js";import"./LayoutLeft-CaPhxBpK.js";import"./use-mobile-CDLFoW5F.js";import"./X-BLBVAPOy.js";import"./table-mM2UZh4-.js";import"./empty-state-Bh6MA1Jh.js";import"./use-members-C_PqWVC0.js";import"./use-org-auth-client-D55gdzx_.js";import"./use-clock-tick-2Z9dljx4.js";import"./AlertCircle-BAVOz-2x.js";import"./CheckCircle-BUmTwNEw.js";import"./DotsVertical-CTvul5Hx.js";import"./agent-icon-CtX3hx5F.js";import"./Tool01-BsvXLKqb.js";import"./ArrowUp-CdomKn6E.js";import"./Settings02-CuWmowxn.js";import"./Tool02-CSuiCYgo.js";import"./XCircle-ZFeyu-0s.js";import"./ArrowUpRight-DzplOzc9.js";import"./TrendUp01--z14cIxf.js";import"./ZapSquare-Cv314uE4.js";import"./ZoomOut-CQAHgoiD.js";import"./Users03-DNyqpf8B.js";import"./Stars02-Bvdy1G8F.js";import"./Copy01-fXkAnRle.js";import"./Globe01-CBAdJxff.js";import"./Eye-C56Rqkt8.js";import"./FilterLines-lTq6Ij1i.js";import"./Star01-BeXsAFXb.js";import"./Globe04-Cf9zDTCT.js";import"./SwitchHorizontal01-D3Ov4m9E.js";import"./HardDrive-DvuSdXbu.js";import"./Image01-ffA98M16.js";import"./Key01-BoS606T3.js";import"./LinkExternal01-4NcYsJN5.js";import"./Monitor01-Bf_ipmVo.js";import"./Sun-DaMMLO5r.js";import"./Package-C6m5hlJG.js";import"./Palette-Bog-hkDH.js";import"./Play-CAJLxQxl.js";import"./Plus-B5eO3bTy.js";import"./SearchLg-C9KqXDtT.js";import"./SearchMd-Byn-coVH.js";import"./Shield01-Bca-So8r.js";import"./Stars01-hjCPYLmR.js";import"./Trash01-BNstTg_1.js";import"./Upload01-8kBCAzuF.js";import"./User01-B6A0_PQ7.js";import"./Users01-ovBEB8pw.js";import"./XClose-BOxmZ42j.js";import"./Zap-C_1cs5r0.js";import"./use-automations-DA_A7ea0.js";import"./studio-tools-DEV89u5s.js";import"./useSuspenseInfiniteQuery-Vqts_kWq.js";import"./avatar-B7H5YfAv.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-XS6PbPfg.js";import"./file-type-icon-Bd0oHMYV.js";import"./dialog-Ccu5eFvd.js";import"./tab-id-BijBBRwE.js";import"./hooks-DJCvo0yZ.js";import"./decopilot-sse-pool-DPMHbwbb.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-CxcCOIx-.js";import"./autosend-nTHzHKVV.js";import"./use-ai-providers-CvkcDt8z.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-CW6CBoVI.js";import"./use-organization-settings-CwwJujO2.js";import"./monaco-editor-B7VLGKpm.js";import"./index-Bebyksc0.js";import"./index-BeK7AkFE.js";import"./calendar-EgEumd4K.js";import"./shell-layout-C_fz-LWa.js";import"./use-t-BYEA0NnF.js";import"./required-auth-layout-Ct_86Yn8.js";import"./use-org-sso-B-C09oWZ.js";import"./integration-icon-Dzl5JPvz.js";import"./use-navigate-to-agent-DO3W8rHR.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-BBlsfTvH.js";import"./form-B-B5R1Pb.js";import"./label-BDx_uIBr.js";import"./input-BTvFP-rc.js";import"./drawer-CTLHO_Po.js";import"./collection-search-BuhzlZH8.js";import"./index-DfdgvH7q.js";import"./get-initials-D-f_fDFw.js";import"./use-registry-app-Bg-hKxMQ.js";import"./use-mcp-tools-BmVUrIvT.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-mIivMus1.js";import"./mcp-oauth-CrR55Ybi.js";import"./extract-connection-data-CKuJH2zH.js";import"./dropdown-menu-Dq9H83GM.js";import"./popover-BUeC8H1A.js";import"./command-CepxnYO9.js";import"./index-i_Hm96VD.js";import"./companions-core-Dg3HSBf0.js";import"./tabs-BmtGU6P3.js";import"./toggle-group-DZ-PwSy9.js";import"./use-deco-credits-DLdCNMTW.js";import"./connection-card-rdd2ujA7.js";import"./use-registry-connections-riJqDo6-.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-gE88LOd4.js";import"./connection-form-helpers-Y52B043-.js";import"./collection-tabs-D-3Qpy7-.js";import"./badge-RF6m1wb5.js";import"./connect-desktop-dialog-CthnsqOM.js";import"./select-model-BklSsqwO.js";import"./checkbox-0S0p1Qa5.js";import"./skeleton-C31Wi2HR.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BPiTjvGZ.js";import"./index-ZdLpvqVL.js";import"./alert-dialog-Q_BwIUfu.js";import"./toolbar-BnQrua_4.js";import"./use-debounced-value-OYErywlB.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CQm_T5_1.js";import"./use-capability-B5gueICr.js";import"./toolbar-icon-button-C3nLPKdQ.js";import"./use-debounced-autosave-CeSRLFvn.js";import"./index-DPFEIozt.js";import"./search-input-D8Brj2tl.js";import"./use-mcp-auth-status-CeS-sSG9.js";import"./switch-Dqu0JsB4.js";import"./github-repo-picker-DCuRF_Em.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-DA17vJTD.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-file-configs-DySKbq7G.js";import"./automation-list-row-BL6OIn6v.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 Cr(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{Cr as AppEditor};
@@ -1 +1 @@
1
- import{ct as I,cu as $,cv as W,cw as L,cx as H,cy as D,cz as x,cA as V,cB as q,cC as j,cD as y,cE as N,cF as B,cG as F,cH as Z}from"./index-BMMnZ_kU.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{ct as I,cu as $,cv as W,cw as L,cx as H,cy as D,cz as x,cA as V,cB as q,cC as j,cD as y,cE as N,cF as B,cG as F,cH as Z}from"./index-K9nNk4ZL.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-BMMnZ_kU.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-K9nNk4ZL.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-BMMnZ_kU.js";import{I as U}from"./input-DO3omnvV.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-K9nNk4ZL.js";import{I as U}from"./input-BTvFP-rc.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-BMMnZ_kU.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-K9nNk4ZL.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 +1 @@
1
- import"./index-BMMnZ_kU.js";import{i as u,a as p}from"./mcp-oauth-D9VV6Aqh.js";async function k({connectionId:n,orgId:s,orgSlug:o,persistFallback:r}){const c=new URL(`/api/${o}/mcp/${n}`,window.location.origin),i=await u({url:c.href,token:null,orgId:s});if(!i.supportsOAuth||i.isAuthenticated)return{ran:!1,ok:!0,error:null};const{token:t,tokenInfo:e,error:a}=await p({connectionId:n,orgSlug:o,scope:"offline_access"});if(a||!t)return{ran:!0,ok:!1,error:a??"no token received"};if(e)try{(await fetch(`/api/${o}/connections/${n}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,scope:e.scope,clientId:e.clientId,clientSecret:e.clientSecret,tokenEndpoint:e.tokenEndpoint})})).ok||await r(t)}catch{await r(t)}else await r(t);return{ran:!0,ok:!0,error:null}}export{k as a};
1
+ import"./index-K9nNk4ZL.js";import{i as u,a as p}from"./mcp-oauth-CrR55Ybi.js";async function k({connectionId:n,orgId:s,orgSlug:o,persistFallback:r}){const c=new URL(`/api/${o}/mcp/${n}`,window.location.origin),i=await u({url:c.href,token:null,orgId:s});if(!i.supportsOAuth||i.isAuthenticated)return{ran:!1,ok:!0,error:null};const{token:t,tokenInfo:e,error:a}=await p({connectionId:n,orgSlug:o,scope:"offline_access"});if(a||!t)return{ran:!0,ok:!1,error:a??"no token received"};if(e)try{(await fetch(`/api/${o}/connections/${n}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,scope:e.scope,clientId:e.clientId,clientSecret:e.clientSecret,tokenEndpoint:e.tokenEndpoint})})).ok||await r(t)}catch{await r(t)}else await r(t);return{ran:!0,ok:!0,error:null}}export{k as a};