decocms 4.158.9 → 4.159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/client/assets/{AlertCircle-XsSybzV2.js → AlertCircle-pqmzRzJD.js} +1 -1
  2. package/dist/client/assets/{AreaChart-C4ZhwL0D.js → AreaChart-JtTd_Y37.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BiPUP2gq.js → ArrowUp-Cja1iGmu.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-kUSCGGiA.js → ArrowUpRight-BLRBShLj.js} +1 -1
  5. package/dist/client/assets/{Check-DRHebq05.js → Check-BudCPgEo.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-DIFjbn-D.js → CheckCircle-KQ7QLQnq.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-CQ6znfFH.js → ChevronDown-CnqZfGUJ.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BA_KeRrx.js → ChevronRight-jWXQxAxT.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DVQu5g5t.js → ChevronUp-D-1ZRQa8.js} +1 -1
  10. package/dist/client/assets/{Copy01-B_G58LZY.js → Copy01-DKpWfuyL.js} +1 -1
  11. package/dist/client/assets/{CpuChip01-DFejE2LO.js → CpuChip01-BFj5zMEs.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CaKRcDmK.js → DotsVertical-CmfEzLbI.js} +1 -1
  13. package/dist/client/assets/{Eye-CDzVXN3o.js → Eye-CCDvKyN1.js} +1 -1
  14. package/dist/client/assets/{FilterLines-IuYLktmF.js → FilterLines-B2KnloFF.js} +1 -1
  15. package/dist/client/assets/{HardDrive-BbiV1wJQ.js → HardDrive-FMBz7R-3.js} +1 -1
  16. package/dist/client/assets/{Key01-Dt5Mf3aj.js → Key01-Cg7xRrj6.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-D6cz98wA.js → LayoutLeft-CrAeQE2_.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-DhaWMZac.js → LinkExternal01-CoNiop35.js} +1 -1
  19. package/dist/client/assets/{LogOut01-8bL0QEJV.js → LogOut01-D0rW1sIh.js} +1 -1
  20. package/dist/client/assets/{Monitor01-DCylQ5tt.js → Monitor01-D7zGH_lY.js} +1 -1
  21. package/dist/client/assets/{Palette-B4-vfaKL.js → Palette-BFAwTvSE.js} +1 -1
  22. package/dist/client/assets/{Play-6R8vxzNW.js → Play-DyWf32_s.js} +1 -1
  23. package/dist/client/assets/{Plus-vFX-xmox.js → Plus-B4O8CQB-.js} +1 -1
  24. package/dist/client/assets/{SearchLg-xaso6Wq4.js → SearchLg-BLHmttXq.js} +1 -1
  25. package/dist/client/assets/{SearchMd-Byt-g7vZ.js → SearchMd-D6K1gQz5.js} +1 -1
  26. package/dist/client/assets/{Settings02-CGfQYOCm.js → Settings02-dNA_w0fs.js} +1 -1
  27. package/dist/client/assets/{Shield01-B9zyRhV8.js → Shield01-BmMAtVqp.js} +1 -1
  28. package/dist/client/assets/{Star01-BBb4arlG.js → Star01-DQCPnd5h.js} +1 -1
  29. package/dist/client/assets/{Stars01-C_m5dPf5.js → Stars01-CxZkjPqU.js} +1 -1
  30. package/dist/client/assets/{Stars02-ox6hLDxt.js → Stars02-m6J1J5js.js} +1 -1
  31. package/dist/client/assets/{Sun-DPsJ2b1E.js → Sun-Cxxd7Gbn.js} +1 -1
  32. package/dist/client/assets/{SwitchHorizontal01-Bspj7Vj6.js → SwitchHorizontal01-CSA5YTCy.js} +1 -1
  33. package/dist/client/assets/{Tool01-B2A1WZbW.js → Tool01-Dwk2jnxr.js} +1 -1
  34. package/dist/client/assets/{Tool02-DtTt8E9G.js → Tool02-BJ8Pm3bB.js} +1 -1
  35. package/dist/client/assets/{Trash01-YaFSTgUX.js → Trash01-KHaub8Lz.js} +1 -1
  36. package/dist/client/assets/{TrendUp01-MqZny71u.js → TrendUp01-D8U-rE4_.js} +1 -1
  37. package/dist/client/assets/{Upload01-CiFB3Tur.js → Upload01-L_4YihBW.js} +1 -1
  38. package/dist/client/assets/{User01-C5Yp3meQ.js → User01-7ALtRHh9.js} +1 -1
  39. package/dist/client/assets/{Users01-DurIoWFy.js → Users01-CPEyBSqa.js} +1 -1
  40. package/dist/client/assets/{Users03-CzYxh4Nc.js → Users03-3PvR443H.js} +1 -1
  41. package/dist/client/assets/{X-BCC1Ri4d.js → X-eA4ffq6C.js} +1 -1
  42. package/dist/client/assets/{XCircle-FHv-T_YI.js → XCircle-CclOCWSw.js} +1 -1
  43. package/dist/client/assets/{XClose-Cqnz1T9W.js → XClose-B8QTyuNc.js} +1 -1
  44. package/dist/client/assets/{Zap-C_Z0Pnr9.js → Zap-CC0qAKRq.js} +1 -1
  45. package/dist/client/assets/{ZapSquare-Ua60hj0w.js → ZapSquare-Bsi66MG_.js} +1 -1
  46. package/dist/client/assets/{access-gate-9oHjtByn.js → access-gate-zVACMryx.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-Bzs1tH6_.js → add-section-modal-MZkelOIV.js} +1 -1
  48. package/dist/client/assets/{agent-icon-B9cL76D_.js → agent-icon-D_nZ6mrh.js} +1 -1
  49. package/dist/client/assets/{agents-list-CkOJPP64.js → agents-list-DC_ArgNv.js} +1 -1
  50. package/dist/client/assets/ai-providers-_RbWIbA7.js +1 -0
  51. package/dist/client/assets/{alert-CEGDZHJ1.js → alert-B1ukPYDJ.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DtzbrfY8.js → alert-dialog-BDUQxyT2.js} +1 -1
  53. package/dist/client/assets/{app-editor-CzHh6nxG.js → app-editor-DOXt5yIe.js} +1 -1
  54. package/dist/client/assets/{auth-CZyFs5-X.js → auth-DL0CrVYc.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-CjT3wXk3.js → auth-catchall-Db1KQu9H.js} +1 -1
  56. package/dist/client/assets/{auth-entry-O7vg6WXF.js → auth-entry-C5-EXCXM.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-BQTZ4k9r.js → auth-split-layout-BdoARcyp.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-BAzzX0Ll.js → authenticate-and-persist-oauth-DAZm6keb.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-B2aBGwZQ.js → automation-list-row-CkO0J79X.js} +1 -1
  60. package/dist/client/assets/{automation-runs-B3MPRguv.js → automation-runs-GivPtHD0.js} +1 -1
  61. package/dist/client/assets/{automations-x6yxVEnc.js → automations-CQX75saK.js} +1 -1
  62. package/dist/client/assets/{avatar-CoOOLfC1.js → avatar-Ba2Gqhb3.js} +1 -1
  63. package/dist/client/assets/{badge-CM-uUCke.js → badge-CitgQ88i.js} +1 -1
  64. package/dist/client/assets/{block-document-BQa75UtR.js → block-document-BWVRIMlQ.js} +1 -1
  65. package/dist/client/assets/{brand-context-By9w2Jz8.js → brand-context-ted3_6sh.js} +1 -1
  66. package/dist/client/assets/{buckets-_Z0RFXU6.js → buckets-DRTPk5gC.js} +1 -1
  67. package/dist/client/assets/{bulk-category-panel-Bsv1nUvf.js → bulk-category-panel-B8XQFxPG.js} +1 -1
  68. package/dist/client/assets/{calendar-Dn9s36Xe.js → calendar-y7Z3l0t-.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-qt1IsVJW.js → capability-load-error-DXAIRfYN.js} +1 -1
  70. package/dist/client/assets/{card-DTyggeiE.js → card-BV9Yg8JF.js} +1 -1
  71. package/dist/client/assets/{category-editor-3hNwKZ_c.js → category-editor-DAcVqubm.js} +1 -1
  72. package/dist/client/assets/{chat-context-CCFohHst.js → chat-context-3uDM1nqn.js} +1 -1
  73. package/dist/client/assets/{checkbox-Bi3A0Gbi.js → checkbox-CuLLPt_L.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-BbMkPCgJ.js → cli-auth-success-B7WpBJA8.js} +1 -1
  75. package/dist/client/assets/{collection-detail-CjrpnpKt.js → collection-detail-CsbTTad9.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-D9JMLmUc.js → collection-display-button-D7rF0f70.js} +1 -1
  77. package/dist/client/assets/{collection-search-_-XVj1sh.js → collection-search-B6rZN0yo.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-C7DuqoJO.js → collection-table-wrapper-D66QZDTl.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-LlDw_64d.js → collection-tabs-BH_gsD9t.js} +1 -1
  80. package/dist/client/assets/{command-BOyEi0RK.js → command-B9pzXnjQ.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-Bqk9It9M.js → commerce-onboarding-DC6TyQ4x.js} +1 -1
  82. package/dist/client/assets/{companions-core-ytu3FTIi.js → companions-core-BmIxvwXH.js} +1 -1
  83. package/dist/client/assets/{connect-_049ri4g.js → connect-Bmeehzw1.js} +1 -1
  84. package/dist/client/assets/{connection-card-BMbhSeIj.js → connection-card-BEEfZ_Gw.js} +1 -1
  85. package/dist/client/assets/{connection-detail-CpICEfTD.js → connection-detail-BwFd2zcI.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-49UPI5Ws.js → connection-form-helpers-Bcft3DyG.js} +1 -1
  87. package/dist/client/assets/{connection-Cy9nCmb2.js → connection-i8LJvlWi.js} +1 -1
  88. package/dist/client/assets/{connections-DK9sbyv6.js → connections-B6eGU31-.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-DnhzFtCQ.js → decopilot-sse-pool-DK3tcwFk.js} +1 -1
  90. package/dist/client/assets/{dialog-CM7HYdGm.js → dialog-R92c_Pnz.js} +1 -1
  91. package/dist/client/assets/{domain-settings-CgGUvY7C.js → domain-settings-BVUEhaOu.js} +1 -1
  92. package/dist/client/assets/{drawer-BtlDaNql.js → drawer-DCxC2dRW.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-BGosRkzl.js → dropdown-menu-BnENS1C8.js} +1 -1
  94. package/dist/client/assets/{empty-state-Doz2U8-n.js → empty-state-BFZ_pyiJ.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-CL1mZXvD.js → extract-connection-data-CY98vwTG.js} +1 -1
  96. package/dist/client/assets/{file-explorer-BEweBw34.js → file-explorer-DjjA4vHT.js} +1 -1
  97. package/dist/client/assets/{form-DLdD3JgE.js → form-BPQDX1iu.js} +1 -1
  98. package/dist/client/assets/{general-1USoOFWO.js → general-Bkp17u0t.js} +1 -1
  99. package/dist/client/assets/{github-repo-picker-D2vpz6sK.js → github-repo-picker-BIiHdSbe.js} +1 -1
  100. package/dist/client/assets/{hooks-BtDpKg5N.js → hooks-VDpgeOEk.js} +1 -1
  101. package/dist/client/assets/{index-DxUEXfrS.js → index-50qLy1V3.js} +1 -1
  102. package/dist/client/assets/{index-TU307Yrp.js → index-B2R1pAtc.js} +1 -1
  103. package/dist/client/assets/{index-B0Y3eUm5.js → index-B36QpfJp.js} +1 -1
  104. package/dist/client/assets/{index-BgjWxEcz.js → index-BGlIfpLW.js} +1 -1
  105. package/dist/client/assets/{index-88v9n6DK.js → index-BuJWnVLg.js} +1 -1
  106. package/dist/client/assets/{index-DAXTeTbR.js → index-CIppZMLU.js} +5 -5
  107. package/dist/client/assets/{index-O2A0mRXY.js → index-CP7hbBBu.js} +1 -1
  108. package/dist/client/assets/{index-KHsUcvuP.js → index-CRrndHjz.js} +1 -1
  109. package/dist/client/assets/{index-DfI3lYUq.js → index-Dveh4K2v.js} +3 -3
  110. package/dist/client/assets/{index-xlMo0hig.js → index-FH1iXwG9.js} +1 -1
  111. package/dist/client/assets/{index-CUEhhFkA.js → index-OFuIeWBU.js} +3 -3
  112. package/dist/client/assets/{index-redirect-Bjw0d-zc.js → index-redirect-DQWBeHSL.js} +1 -1
  113. package/dist/client/assets/{input-k8QMZSpl.js → input-D6HGf9aQ.js} +1 -1
  114. package/dist/client/assets/{integration-icon-XjdXY3eT.js → integration-icon-B0Qh3kkh.js} +1 -1
  115. package/dist/client/assets/{invite-member-dialog-D4FtW_ly.js → invite-member-dialog-D-YWVA4s.js} +1 -1
  116. package/dist/client/assets/{label-Bo-GoBix.js → label-C0nGPhyn.js} +1 -1
  117. package/dist/client/assets/{layout-CHbESbvF.js → layout-C1Ps1TGD.js} +1 -1
  118. package/dist/client/assets/{login-Cbm_3c29.js → login-DSmWl_JN.js} +1 -1
  119. package/dist/client/assets/{mcp-oauth-DQo8HdBy.js → mcp-oauth-DK9h3luZ.js} +1 -1
  120. package/dist/client/assets/{members-CfI-Q1SW.js → members-Ch1qVL01.js} +1 -1
  121. package/dist/client/assets/{monaco-editor-9LxNntdd.js → monaco-editor-DAztJ7NY.js} +1 -1
  122. package/dist/client/assets/{monitoring-stats-row-BMdlAJkq.js → monitoring-stats-row-CF_Qrlc9.js} +1 -1
  123. package/dist/client/assets/{multi-select-DgwpqE_P.js → multi-select-BNdTGIHQ.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-D3H-9lwA.js → oauth-callback-Bm7Oez7j.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-CD5QZASa.js → oauth-callback-ai-provider-Cof8_07v.js} +1 -1
  126. package/dist/client/assets/{onboarding-Bc8GR9Ys.js → onboarding-CuqZY2si.js} +1 -1
  127. package/dist/client/assets/{org-layout-CAB_yy_o.js → org-layout-lpk1bxwd.js} +1 -1
  128. package/dist/client/assets/{organization-choice-DbmTOXZp.js → organization-choice-B84tKWUC.js} +1 -1
  129. package/dist/client/assets/{orgs-BSCrivJo.js → orgs-Bu_yrVSe.js} +1 -1
  130. package/dist/client/assets/{page-seo-form-D6c0Brgv.js → page-seo-form-DI9p61Ed.js} +1 -1
  131. package/dist/client/assets/{popover-CGGxHaV2.js → popover-B1k48k3v.js} +1 -1
  132. package/dist/client/assets/{post-editor-KDC87xl_.js → post-editor-B-K4gHyX.js} +1 -1
  133. package/dist/client/assets/{primitives-CW3FMaIa.js → primitives-DqkBHMSa.js} +1 -1
  134. package/dist/client/assets/{profile-D7U0BxuQ.js → profile-DHzj8ZYV.js} +1 -1
  135. package/dist/client/assets/project-app-view-CRlrtWWM.js +1 -0
  136. package/dist/client/assets/record-editor-C0Uo0m59.js +1 -0
  137. package/dist/client/assets/{redirect-editor-DaSV9VDn.js → redirect-editor-C10zF6iN.js} +1 -1
  138. package/dist/client/assets/registry-Cc1RcM5h.js +2 -0
  139. package/dist/client/assets/{registry-layout-CjohfObB.js → registry-layout-Dc9kK58q.js} +1 -1
  140. package/dist/client/assets/{reports-D0bn3pZy.js → reports-CNLhmgWb.js} +1 -1
  141. package/dist/client/assets/{require-capability-DJfRDTnj.js → require-capability-Bv5KoiXy.js} +1 -1
  142. package/dist/client/assets/{required-auth-layout-BHJiGd5R.js → required-auth-layout-Y5UM7oI2.js} +1 -1
  143. package/dist/client/assets/{reset-password-Bjvx0V8_.js → reset-password-D8k7zjEk.js} +1 -1
  144. package/dist/client/assets/{roles-DIA3HT76.js → roles-CcYTQ_XH.js} +1 -1
  145. package/dist/client/assets/{search-input-B5E3rgEU.js → search-input-B2V-KxMH.js} +1 -1
  146. package/dist/client/assets/{secrets-BJR5r4bY.js → secrets-DbxklaOO.js} +1 -1
  147. package/dist/client/assets/{sections-editor-DHj_EZwl.js → sections-editor-DJpGZpcw.js} +1 -1
  148. package/dist/client/assets/{select-BrkB_YSs.js → select-BfHA3hXI.js} +1 -1
  149. package/dist/client/assets/{select-model-C_MgNjBF.js → select-model-aDWO0QR9.js} +1 -1
  150. package/dist/client/assets/{self-tool-result-CNQh2_f2.js → self-tool-result-cgo1DEgv.js} +1 -1
  151. package/dist/client/assets/{seo-editor-DYm37Bkc.js → seo-editor-CjUP28r9.js} +1 -1
  152. package/dist/client/assets/{settings-layout-JWP3NM3P.js → settings-layout-BaJiz02p.js} +1 -1
  153. package/dist/client/assets/{settings-section-38RkVyD-.js → settings-section-DGgss-oN.js} +1 -1
  154. package/dist/client/assets/{shell-controls-CiDIQ_CD.js → shell-controls-d1HkoX_B.js} +1 -1
  155. package/dist/client/assets/{shell-layout-Chl24Hqy.js → shell-layout-WBJ3MoEz.js} +1 -1
  156. package/dist/client/assets/{sidebar-DnrpOcUt.js → sidebar-zX-Xh26M.js} +1 -1
  157. package/dist/client/assets/{skeleton-ubrWwuqr.js → skeleton-Cd62pFKu.js} +1 -1
  158. package/dist/client/assets/{spinner-BBLqnnk0.js → spinner-BULrncM1.js} +1 -1
  159. package/dist/client/assets/{sso-Dx-ke3DB.js → sso-DW208l4y.js} +1 -1
  160. package/dist/client/assets/{store-DWu1R-KK.js → store-D_pRoj59.js} +1 -1
  161. package/dist/client/assets/store-registry-BxUwPaiS.js +2 -0
  162. package/dist/client/assets/{studio-tools-CcQw1G2R.js → studio-tools-Ck8WNEjD.js} +1 -1
  163. package/dist/client/assets/{switch-fumpDPMB.js → switch-DP-6KK-R.js} +1 -1
  164. package/dist/client/assets/{tab-id-9DMAfa2T.js → tab-id-D3E_XoXg.js} +1 -1
  165. package/dist/client/assets/{table-Hb8bDUqL.js → table-_nYBvo6-.js} +1 -1
  166. package/dist/client/assets/{tabs-Dh6a3OYH.js → tabs-CRFEXKs1.js} +1 -1
  167. package/dist/client/assets/{textarea-mikc_xJD.js → textarea-DlYNEV-I.js} +1 -1
  168. package/dist/client/assets/{toggle-group-1Yj4T64a.js → toggle-group-CaL1nc-I.js} +1 -1
  169. package/dist/client/assets/{toolbar-DBG8Kp4J.js → toolbar-BhA4kTI5.js} +1 -1
  170. package/dist/client/assets/{tooltip-BNye0dKm.js → tooltip-B4QWZZgT.js} +1 -1
  171. package/dist/client/assets/{use-ai-providers-RQ8Vfto6.js → use-ai-providers-XMOk0ZOu.js} +1 -1
  172. package/dist/client/assets/{use-automations-kQIAo5Jm.js → use-automations-BJf24dYG.js} +1 -1
  173. package/dist/client/assets/{use-autosave-B80ba5NZ.js → use-autosave-BDESqJYa.js} +1 -1
  174. package/dist/client/assets/{use-capability-DTky4_rM.js → use-capability-R9xRMDt0.js} +1 -1
  175. package/dist/client/assets/{use-clock-tick-DUtgJAUk.js → use-clock-tick-Cs7ZABrR.js} +1 -1
  176. package/dist/client/assets/{use-connection-C3T1xFRX.js → use-connection-E0imXfMX.js} +1 -1
  177. package/dist/client/assets/{use-copy-L9NArsbn.js → use-copy-CRWKGHJN.js} +1 -1
  178. package/dist/client/assets/{use-create-virtual-mcp-CELIfvpG.js → use-create-virtual-mcp-CYlf05IQ.js} +1 -1
  179. package/dist/client/assets/{use-debounced-autosave-CsJyNeJR.js → use-debounced-autosave-BmuBhQoj.js} +1 -1
  180. package/dist/client/assets/{use-debounced-value-3rO8TtRH.js → use-debounced-value-UVOlZ3gD.js} +1 -1
  181. package/dist/client/assets/{use-deco-credits-CNG6Ed_s.js → use-deco-credits-zQFZusEY.js} +1 -1
  182. package/dist/client/assets/{use-decopilot-events-Dz6okK1o.js → use-decopilot-events-C4NHCngI.js} +1 -1
  183. package/dist/client/assets/{use-delete-connection-CouGfdUk.js → use-delete-connection-Dj2CMZ0P.js} +1 -1
  184. package/dist/client/assets/{use-deployment-admin-BfveWOC8.js → use-deployment-admin-tqeojbd1.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-CeWA-mlS.js → use-file-configs-Sk-WKXU_.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-CaNm312i.js → use-infinite-scroll-CgKbiP8I.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-C_fswDtT.js → use-join-requests-BvxtgSqf.js} +1 -1
  188. package/dist/client/assets/{use-mcp-auth-status-DsjOpWQI.js → use-mcp-auth-status-TirzCz71.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-CdYMMWSO.js → use-mcp-client-p6iuzcQc.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-DcRf4Qk1.js → use-mcp-tools-Bpb4DQXQ.js} +1 -1
  191. package/dist/client/assets/{use-members-gV6tk0K-.js → use-members-lcuXZKPB.js} +1 -1
  192. package/dist/client/assets/{use-mobile-u9PWDzDf.js → use-mobile-Pya12KNo.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-CvjDM4uj.js → use-navigate-to-agent-BNPczzIg.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-B-04KAvZ.js → use-org-auth-client-Criqs8X8.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-B_R9NcR2.js → use-org-sso-C2IyqiaN.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-WTXmwXIY.js → use-organization-roles-DQY8BVQS.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-CxnOU5AV.js → use-organization-settings-CdIDoB_L.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-CED-TXjg.js → use-registry-connections-B3eNVmA7.js} +1 -1
  199. package/dist/client/assets/{use-secrets-D-IOSNQd.js → use-secrets-wm75C4q2.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-Db7yNxU9.js → use-status-sounds-CfzCFlDY.js} +1 -1
  201. package/dist/client/assets/{use-tags-CzERZ8zr.js → use-tags-BQQBSo4w.js} +1 -1
  202. package/dist/client/assets/{use-view-mode-SI7rls_E.js → use-view-mode-CHCnjxSc.js} +1 -1
  203. package/dist/client/assets/{use-virtual-mcp-CRB2isTu.js → use-virtual-mcp-ByPyGM47.js} +1 -1
  204. package/dist/client/assets/useInfiniteQuery-Dh0Gvn-P.js +1 -0
  205. package/dist/client/assets/{useQueries-DfRa6hBH.js → useQueries-BcZGQUCR.js} +1 -1
  206. package/dist/client/assets/{useRouterState-DUk_ukbe.js → useRouterState-DO5A39hB.js} +1 -1
  207. package/dist/client/assets/useSuspenseInfiniteQuery-DCCY-k1D.js +1 -0
  208. package/dist/client/assets/{users-TsidD-Zh.js → users-gkbB2JHc.js} +1 -1
  209. package/dist/client/assets/{variant-calendar-B2H4EdAS.js → variant-calendar-B7h9hmv9.js} +1 -1
  210. package/dist/client/assets/{view-mode-toggle-DTaBnp5F.js → view-mode-toggle-CyA_1Jtp.js} +1 -1
  211. package/dist/client/index.html +1 -1
  212. package/dist/server/cli.js +3 -3
  213. package/dist/server/server.js +3 -3
  214. package/package.json +1 -1
  215. package/dist/client/assets/ai-providers-MDk2OGxO.js +0 -1
  216. package/dist/client/assets/project-app-view-DSl1UaI6.js +0 -1
  217. package/dist/client/assets/record-editor-CJScAmh7.js +0 -1
  218. package/dist/client/assets/registry-Ckuq5Muq.js +0 -2
  219. package/dist/client/assets/store-registry-C-TjMJw3.js +0 -2
  220. package/dist/client/assets/useInfiniteQuery-dvWvOWWt.js +0 -1
  221. package/dist/client/assets/useSuspenseInfiniteQuery-Cal-i01w.js +0 -1
@@ -1 +1 @@
1
- import{c as ge,b as me,j as o,v as Ae,t as le,B as ie,F as De,o as Ie,a as Le,r as W,n as Te,K as de,e as Ee,p as V,G as Fe,m as ke}from"./index-CUEhhFkA.js";import{a as ne,b as ye,D as ue,c as pe}from"./dropdown-menu-BGosRkzl.js";import{a as Ge}from"./Users03-CzYxh4Nc.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-D2vpz6sK.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-CRB2isTu.js";import{P as ce}from"./index-O2A0mRXY.js";import{a as Ue}from"./DotsVertical-CaKRcDmK.js";import{A as Re,H as fe,aZ as $e}from"./agent-icon-B9cL76D_.js";import{a as He,b as Ve}from"./Settings02-CGfQYOCm.js";import{s as Ke}from"./Trash01-YaFSTgUX.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-CvjDM4uj.js";import{e as Qe,h as Je}from"./use-organization-settings-CxnOU5AV.js";import{u as Se}from"./use-capability-DTky4_rM.js";import{C as Ye}from"./card-DTyggeiE.js";import{E as We}from"./empty-state-Doz2U8-n.js";import{u as Ze}from"./use-create-virtual-mcp-CELIfvpG.js";import{u as Xe}from"./use-connection-C3T1xFRX.js";import{u as xe,S as et}from"./use-mcp-client-CdYMMWSO.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,a as it,G as nt,p as rt}from"./provision-repo-scoped-github-connection-CAXumITS.js";import{e as lt,d as at,a as ct,b as mt,c as dt}from"./dialog-CM7HYdGm.js";import{C as ut}from"./collection-search-_-XVj1sh.js";import{c as pt,d as gt,b as ft,f as ht,g as xt,e as jt,a as Ct,A as bt}from"./alert-dialog-DtzbrfY8.js";import{S as Dt}from"./search-input-B5E3rgEU.js";import{s as Ce}from"./Plus-vFX-xmox.js";import"./Check-DRHebq05.js";import"./ChevronRight-BA_KeRrx.js";import"./use-debounced-value-3rO8TtRH.js";import"./authenticate-and-persist-oauth-BAzzX0Ll.js";import"./mcp-oauth-DQo8HdBy.js";import"./auth-CZyFs5-X.js";import"./LinkExternal01-DhaWMZac.js";import"./use-mcp-tools-DcRf4Qk1.js";import"./extract-connection-data-CL1mZXvD.js";import"./metadata-dUsYcpuu.js";import"./sidebar-DnrpOcUt.js";import"./LayoutLeft-D6cz98wA.js";import"./use-mobile-u9PWDzDf.js";import"./X-BCC1Ri4d.js";import"./tooltip-BNye0dKm.js";import"./AlertCircle-XsSybzV2.js";import"./Tool01-B2A1WZbW.js";import"./ArrowUp-BiPUP2gq.js";import"./Tool02-DtTt8E9G.js";import"./XCircle-FHv-T_YI.js";import"./ArrowUpRight-kUSCGGiA.js";import"./TrendUp01-MqZny71u.js";import"./ZapSquare-Ua60hj0w.js";import"./CheckCircle-DIFjbn-D.js";import"./ChevronDown-CQ6znfFH.js";import"./ChevronUp-DVQu5g5t.js";import"./Stars02-ox6hLDxt.js";import"./Copy01-B_G58LZY.js";import"./CpuChip01-DFejE2LO.js";import"./Eye-CDzVXN3o.js";import"./FilterLines-IuYLktmF.js";import"./Star01-BBb4arlG.js";import"./Palette-B4-vfaKL.js";import"./SwitchHorizontal01-Bspj7Vj6.js";import"./HardDrive-BbiV1wJQ.js";import"./Key01-Dt5Mf3aj.js";import"./LogOut01-8bL0QEJV.js";import"./Monitor01-DCylQ5tt.js";import"./Sun-DPsJ2b1E.js";import"./Play-6R8vxzNW.js";import"./SearchLg-xaso6Wq4.js";import"./SearchMd-Byt-g7vZ.js";import"./Shield01-B9zyRhV8.js";import"./Stars01-C_m5dPf5.js";import"./Upload01-CiFB3Tur.js";import"./User01-C5Yp3meQ.js";import"./Users01-DurIoWFy.js";import"./XClose-Cqnz1T9W.js";import"./Zap-C_Z0Pnr9.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-BtDpKg5N.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DnhzFtCQ.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-CcQw1G2R.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:x}=t,M=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Ge,{size:14}),e[0]=T):T=e[0];let m;e[1]!==d?(m=d("common.createAgentDropdown.createFromScratch"),e[1]=d,e[2]=m):m=e[2];let D;e[3]!==f||e[4]!==i||e[5]!==m?(D=o.jsxs(ne,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(we,{className:"size-3.5"}),e[7]=j):j=e[7];let y;e[8]!==d?(y=d("common.createAgentDropdown.importFromGitHub"),e[8]=d,e[9]=y):y=e[9];let a;e[10]!==x?(a=x&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=x,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(ne,{onClick:n,children:[j,y,a]}),e[12]=n,e[13]=y,e[14]=a,e[15]=l):l=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=h):h=e[16];let C;e[17]!==d?(C=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==C?(w=o.jsxs(ne,{onClick:r,children:[h,C]}),e[19]=r,e[20]=C,e[21]=w):w=e[21];let u;return e[22]!==M||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:M,className:"w-48",children:[D,l,w]}),e[22]=M,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function yt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=_e(),c=me(),[G]=Ae(),x=G.language==="pt-BR"?qe:void 0,{mainAgentId:M}=Qe(),d=Je(),{granted:T}=Se("org:manage"),m=M===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const I=m?null:i.id;d.mutate(I,{onSuccess:()=>le.success(m?c("home.projectCard.mainAgentUnset",{title:i.title}):c("home.projectCard.mainAgentSet",{title:i.title})),onError:()=>le.error(c("home.projectCard.mainAgentError"))})},e[0]=m,e[1]=i.id,e[2]=i.title,e[3]=d,e[4]=c,e[5]=D):D=e[5];const j=D;let y;e[6]!==f||e[7]!==i.id?(y=()=>f(i.id),e[6]=f,e[7]=i.id,e[8]=y):y=e[8];let a;e[9]!==i.title||e[10]!==y?(a=o.jsx("button",{type:"button",onClick:y,className:"absolute inset-0 z-0","aria-label":i.title}),e[9]=i.title,e[10]=y,e[11]=a):a=e[11];let l;e[12]!==i.icon||e[13]!==i.title?(l=o.jsx(Re,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[12]=i.icon,e[13]=i.title,e[14]=l):l=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Ue,{size:20})})}),e[15]=h):h=e[15];let C;e[16]!==f||e[17]!==i.id?(C=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=C):C=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(He,{size:16}),e[19]=w):w=e[19];let u;e[20]!==C?(u=o.jsxs(ne,{onClick:C,children:[w,"Settings"]}),e[20]=C,e[21]=u):u=e[21];let O;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==j?(O=T&&o.jsxs(ne,{onClick:I=>{I.stopPropagation(),j()},children:[o.jsx(fe,{size:16}),c(m?"home.projectCard.unsetMainAgent":"home.projectCard.setAsMainAgent")]}),e[22]=T,e[23]=m,e[24]=c,e[25]=j,e[26]=O):O=e[26];let E;e[27]!==r?(E=r&&o.jsxs(ne,{variant:"destructive",onClick:I=>{I.stopPropagation(),r(I)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let z;e[29]!==E||e[30]!==u||e[31]!==O?(z=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(ye,{align:"end",children:[u,O,E]})]})}),e[29]=E,e[30]=u,e[31]=O,e[32]=z):z=e[32];let _;e[33]!==z||e[34]!==l?(_=o.jsxs("div",{className:"flex items-start justify-between",children:[l,z]}),e[33]=z,e[34]=l,e[35]=_):_=e[35];let N;e[36]!==i.title?(N=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=N):N=e[37];let v;e[38]!==m||e[39]!==c?(v=m&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:[o.jsx(fe,{size:12}),c("home.projectCard.mainAgentBadge")]}),e[38]=m,e[39]=c,e[40]=v):v=e[40];let P;e[41]!==N||e[42]!==v?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[N,v]}),e[41]=N,e[42]=v,e[43]=P):P=e[43];const F=i.description||"No description";let s;e[44]!==F?(s=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:F}),e[44]=F,e[45]=s):s=e[45];let p;e[46]!==P||e[47]!==s?(p=o.jsxs("div",{className:"flex flex-col gap-1",children:[P,s]}),e[46]=P,e[47]=s,e[48]=p):p=e[48];let g;e[49]!==_||e[50]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[_,p]}),e[49]=_,e[50]=p,e[51]=g):g=e[51];let b;e[52]!==n||e[53]!==x||e[54]!==i.updated_at||e[55]!==c?(b=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:x})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:x})}),e[52]=n,e[53]=x,e[54]=i.updated_at,e[55]=c,e[56]=b):b=e[56];let S;e[57]!==b?(S=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:b})})}),e[57]=b,e[58]=S):S=e[58];let A;e[59]!==g||e[60]!==S?(A=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[g,S]}),e[59]=g,e[60]=S,e[61]=A):A=e[61];let k;return e[62]!==A||e[63]!==a?(k=o.jsxs(Ye,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[a,A]}),e[62]=A,e[63]=a,e[64]=k):k=e[64],k}const wt="deco-sites";function _t(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 St(t,e){const i=e?_t(e):null,n=i?.owner??wt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function Nt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Ne(t,e,i){const n=await fetch(t,e),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error??`${i} (${n.status})`);return r}function vt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function At({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=_e(),c=Ie(),{data:G}=Le.useSession(),[x,M]=W.useState(null),[d,T]=W.useState(null),[m,D]=W.useState(""),j=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Xe({slug:"mcp-github"}),a=ot(y),l=Me({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,C=a.length>1&&!h,w=xe({connectionId:h?.id??"",orgId:r.id,orgSlug:r.slug}),u=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:O,isLoading:E,error:z}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>vt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),_=O?.sites??[],N=s=>{s||(M(null),T(null),D("")),e(s)},v=_.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!x||v.some(s=>s.name===x),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:p}=await st(B=>j.callTool(B),h.id),g=_.find(B=>B.name===s);if(!g)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const b=St(s,g.metadata),S=it(p,b.owner);if(!S)throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:b.owner,installUrl:nt}));let A=null,k=null,I=null;const J=async()=>{I&&await j.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:I}}).catch(()=>{}),k&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),A&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{})};try{const B=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),U=B.connId;if(!U)throw new Error(n("common.importFromDecoDialog.noConnectionId"));A=U;const{childConnectionId:$}=await rt({orgSlug:r.slug,sourceConnection:h,installationId:S.installationId,owner:b.owner,repo:b.name,githubCallTool:H=>w.callTool(H),selfCallTool:H=>j.callTool(H)});k=$;const K=B.icon??null,q=Nt(s),re=s.toLowerCase(),Y=tt(je(g.domains)),Q=await j.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:K??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:re,productionUrl:Y,githubRepo:{owner:b.owner,name:b.name,url:b.url,installationId:S.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:K,themeColor:"#22C55E",slug:q,pinnedViews:[{connectionId:U,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:U,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:U},{connection_id:$}]}}}),R=Q.structuredContent??Q;if(!R.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return I=R.item.id,{slug:q,virtualMcpId:R.item.id,connId:U,item:R.item}}catch(B){throw await J(),B}},onSuccess:({slug:s,virtualMcpId:p,item:g})=>{V("deco_site_import_succeeded",{site_name:g.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(j,r.id,"","VIRTUAL_MCP",p),{item:g}),c.invalidateQueries({predicate:b=>{const S=b.queryKey;return S[1]===r.id&&S[3]==="collection"&&S[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),N(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{V("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),le.error(n("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:n("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(lt,{open:t,onOpenChange:N,children:o.jsxs(at,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(ct,{className:"sr-only",children:o.jsx(mt,{children:n("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&o.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":n("common.importFromDecoDialog.goBack"),children:o.jsx(Ve,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:n("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(ut,{value:m,onChange:D,placeholder:n("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&D("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??n("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:n("common.importFromDecoDialog.retryGithubSetup")})]}),u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.settingUpGithub")}),C&&!u&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>T(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(we,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),E&&!u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.loadingSites")}),!E&&!u&&!C&&l.status!=="error"&&!z&&_.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.noSitesFound")}),!E&&!u&&!C&&l.status!=="error"&&_.length>0&&o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:n("common.importFromDecoDialog.noSitesMatch",{search:m})}),v.map(s=>{const p=je(s.domains),g=x===s.name;return o.jsxs("button",{type:"button",onClick:()=>M(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",g?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),p&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:p})]})]},s.name)})]})]}),o.jsxs(dt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>N(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!x||!P||F.isPending||E||u||C||!h||l.status==="error",onClick:()=>x&&F.mutate(x),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function ns(){const t=ge.c(77),e=me(),{org:i}=De(),n=Oe(),r=ze(),[f,c]=W.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:x,isCreating:M}=Ze(G),[d,T]=W.useState(null),[m,D]=W.useState(!1),[j,y]=W.useState(!1),{granted:a}=Se("agents:manage"),l=f.toLowerCase(),h=n.filter(L=>L.id!==i.id&&(L.title.toLowerCase().includes(l)||L.description?.toLowerCase().includes(l))),{data:C}=Be(h.map(It));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:L,title:ve}=d;T(null);try{await r.delete.mutateAsync(L),V("agent_deleted",{agent_id:L,source:"agents_list"}),le.success(e("routes.agentsList.deletedAgent",{title:ve}))}catch{}},t[1]=r,t[2]=d,t[3]=e,t[4]=w):w=t[4];const u=w,O=ce,E=ce,z=ce;let _;t[5]!==e?(_=e("routes.agentsList.title"),t[5]=e,t[6]=_):_=t[6];let N;t[7]!==_?(N=o.jsx(ce.Title,{children:_}),t[7]=_,t[8]=N):N=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=L=>{L.key==="Escape"&&(c(""),L.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==v?(F=o.jsx(Dt,{value:f,onChange:c,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=v,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==x||t[17]!==M||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:M,align:"end"})]}),t[15]=a,t[16]=x,t[17]=M,t[18]=e,t[19]=s):s=t[19];let p;t[20]!==F||t[21]!==s?(p=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[F,s]}),t[20]=F,t[21]=s,t[22]=p):p=t[22];let g;t[23]!==p||t[24]!==N?(g=o.jsxs("div",{className:"flex flex-col gap-6",children:[N,p]}),t[23]=p,t[24]=N,t[25]=g):g=t[25];const b=h.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(We,{image:o.jsx($e,{size:48,className:"text-muted-foreground"}),title:e(f?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:f?e("routes.agentsList.noAgentsMatchSearch",{search:f}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!f&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:M,align:"center",showBetaBadge:!0})]})})}),S=h.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:h.map(L=>o.jsx(yt,{project:L,lastUsedAt:C?.get(L.id)?.last_used_at,onDeleteClick:a?()=>T({id:L.id,title:L.title}):void 0},L.id))})]});let A;t[26]!==g||t[27]!==b||t[28]!==S||t[29]!==z.Body?(A=o.jsxs(z.Body,{children:[g,b,S]}),t[26]=g,t[27]=b,t[28]=S,t[29]=z.Body,t[30]=A):A=t[30];let k;t[31]!==A||t[32]!==E.Content?(k=o.jsx(E.Content,{children:A}),t[31]=A,t[32]=E.Content,t[33]=k):k=t[33];let I;t[34]!==j?(I=o.jsx(Pe,{open:j,onOpenChange:y}),t[34]=j,t[35]=I):I=t[35];let J;t[36]!==m?(J=o.jsx(At,{open:m,onOpenChange:D}),t[36]=m,t[37]=J):J=t[37];const B=!!d;let U;t[38]===Symbol.for("react.memo_cache_sentinel")?(U=L=>!L&&T(null),t[38]=U):U=t[38];let $;t[39]!==e?($=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=$):$=t[40];let K;t[41]!==$?(K=o.jsx(pt,{children:$}),t[41]=$,t[42]=K):K=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const re=d?.title;let Y;t[45]!==re?(Y=o.jsx("span",{className:"font-medium text-foreground",children:re}),t[45]=re,t[46]=Y):Y=t[46];let Q;t[47]!==q||t[48]!==Y?(Q=o.jsxs(gt,{children:[q," ",Y,"."]}),t[47]=q,t[48]=Y,t[49]=Q):Q=t[49];let R;t[50]!==K||t[51]!==Q?(R=o.jsxs(ft,{children:[K,Q]}),t[50]=K,t[51]=Q,t[52]=R):R=t[52];let H;t[53]!==e?(H=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=H):H=t[54];let Z;t[55]!==H?(Z=o.jsx(ht,{children:H}),t[55]=H,t[56]=Z):Z=t[56];let X;t[57]!==e?(X=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=X):X=t[58];let ee;t[59]!==u||t[60]!==X?(ee=o.jsx(xt,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:X}),t[59]=u,t[60]=X,t[61]=ee):ee=t[61];let te;t[62]!==Z||t[63]!==ee?(te=o.jsxs(jt,{children:[Z,ee]}),t[62]=Z,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==R||t[66]!==te?(oe=o.jsxs(Ct,{children:[R,te]}),t[65]=R,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==B||t[69]!==oe?(se=o.jsx(bt,{open:B,onOpenChange:U,children:oe}),t[68]=B,t[69]=oe,t[70]=se):se=t[70];let ae;return t[71]!==O||t[72]!==k||t[73]!==I||t[74]!==J||t[75]!==se?(ae=o.jsxs(O,{children:[k,I,J,se]}),t[71]=O,t[72]=k,t[73]=I,t[74]=J,t[75]=se,t[76]=ae):ae=t[76],ae}function It(t){return t.id}export{ns as default};
1
+ import{c as ge,b as me,j as o,v as Ae,t as le,B as ie,F as De,o as Ie,a as Le,r as W,n as Te,K as de,e as Ee,p as V,G as Fe,m as ke}from"./index-OFuIeWBU.js";import{a as ne,b as ye,D as ue,c as pe}from"./dropdown-menu-BnENS1C8.js";import{a as Ge}from"./Users03-3PvR443H.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-BIiHdSbe.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-ByPyGM47.js";import{P as ce}from"./index-CP7hbBBu.js";import{a as Ue}from"./DotsVertical-CmfEzLbI.js";import{A as Re,H as fe,aZ as $e}from"./agent-icon-D_nZ6mrh.js";import{a as He,b as Ve}from"./Settings02-dNA_w0fs.js";import{s as Ke}from"./Trash01-KHaub8Lz.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-BNPczzIg.js";import{e as Qe,h as Je}from"./use-organization-settings-CdIDoB_L.js";import{u as Se}from"./use-capability-R9xRMDt0.js";import{C as Ye}from"./card-BV9Yg8JF.js";import{E as We}from"./empty-state-BFZ_pyiJ.js";import{u as Ze}from"./use-create-virtual-mcp-CYlf05IQ.js";import{u as Xe}from"./use-connection-E0imXfMX.js";import{u as xe,S as et}from"./use-mcp-client-p6iuzcQc.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,a as it,G as nt,p as rt}from"./provision-repo-scoped-github-connection-CAXumITS.js";import{e as lt,d as at,a as ct,b as mt,c as dt}from"./dialog-R92c_Pnz.js";import{C as ut}from"./collection-search-B6rZN0yo.js";import{c as pt,d as gt,b as ft,f as ht,g as xt,e as jt,a as Ct,A as bt}from"./alert-dialog-BDUQxyT2.js";import{S as Dt}from"./search-input-B2V-KxMH.js";import{s as Ce}from"./Plus-B4O8CQB-.js";import"./Check-BudCPgEo.js";import"./ChevronRight-jWXQxAxT.js";import"./use-debounced-value-UVOlZ3gD.js";import"./authenticate-and-persist-oauth-DAZm6keb.js";import"./mcp-oauth-DK9h3luZ.js";import"./auth-DL0CrVYc.js";import"./LinkExternal01-CoNiop35.js";import"./use-mcp-tools-Bpb4DQXQ.js";import"./extract-connection-data-CY98vwTG.js";import"./metadata-dUsYcpuu.js";import"./sidebar-zX-Xh26M.js";import"./LayoutLeft-CrAeQE2_.js";import"./use-mobile-Pya12KNo.js";import"./X-eA4ffq6C.js";import"./tooltip-B4QWZZgT.js";import"./AlertCircle-pqmzRzJD.js";import"./Tool01-Dwk2jnxr.js";import"./ArrowUp-Cja1iGmu.js";import"./Tool02-BJ8Pm3bB.js";import"./XCircle-CclOCWSw.js";import"./ArrowUpRight-BLRBShLj.js";import"./TrendUp01-D8U-rE4_.js";import"./ZapSquare-Bsi66MG_.js";import"./CheckCircle-KQ7QLQnq.js";import"./ChevronDown-CnqZfGUJ.js";import"./ChevronUp-D-1ZRQa8.js";import"./Stars02-m6J1J5js.js";import"./Copy01-DKpWfuyL.js";import"./CpuChip01-BFj5zMEs.js";import"./Eye-CCDvKyN1.js";import"./FilterLines-B2KnloFF.js";import"./Star01-DQCPnd5h.js";import"./Palette-BFAwTvSE.js";import"./SwitchHorizontal01-CSA5YTCy.js";import"./HardDrive-FMBz7R-3.js";import"./Key01-Cg7xRrj6.js";import"./LogOut01-D0rW1sIh.js";import"./Monitor01-D7zGH_lY.js";import"./Sun-Cxxd7Gbn.js";import"./Play-DyWf32_s.js";import"./SearchLg-BLHmttXq.js";import"./SearchMd-D6K1gQz5.js";import"./Shield01-BmMAtVqp.js";import"./Stars01-CxZkjPqU.js";import"./Upload01-L_4YihBW.js";import"./User01-7ALtRHh9.js";import"./Users01-CPEyBSqa.js";import"./XClose-B8QTyuNc.js";import"./Zap-CC0qAKRq.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-VDpgeOEk.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DK3tcwFk.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-Ck8WNEjD.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:x}=t,M=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Ge,{size:14}),e[0]=T):T=e[0];let m;e[1]!==d?(m=d("common.createAgentDropdown.createFromScratch"),e[1]=d,e[2]=m):m=e[2];let D;e[3]!==f||e[4]!==i||e[5]!==m?(D=o.jsxs(ne,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(we,{className:"size-3.5"}),e[7]=j):j=e[7];let y;e[8]!==d?(y=d("common.createAgentDropdown.importFromGitHub"),e[8]=d,e[9]=y):y=e[9];let a;e[10]!==x?(a=x&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=x,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(ne,{onClick:n,children:[j,y,a]}),e[12]=n,e[13]=y,e[14]=a,e[15]=l):l=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=h):h=e[16];let C;e[17]!==d?(C=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==C?(w=o.jsxs(ne,{onClick:r,children:[h,C]}),e[19]=r,e[20]=C,e[21]=w):w=e[21];let u;return e[22]!==M||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:M,className:"w-48",children:[D,l,w]}),e[22]=M,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function yt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=_e(),c=me(),[G]=Ae(),x=G.language==="pt-BR"?qe:void 0,{mainAgentId:M}=Qe(),d=Je(),{granted:T}=Se("org:manage"),m=M===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const I=m?null:i.id;d.mutate(I,{onSuccess:()=>le.success(m?c("home.projectCard.mainAgentUnset",{title:i.title}):c("home.projectCard.mainAgentSet",{title:i.title})),onError:()=>le.error(c("home.projectCard.mainAgentError"))})},e[0]=m,e[1]=i.id,e[2]=i.title,e[3]=d,e[4]=c,e[5]=D):D=e[5];const j=D;let y;e[6]!==f||e[7]!==i.id?(y=()=>f(i.id),e[6]=f,e[7]=i.id,e[8]=y):y=e[8];let a;e[9]!==i.title||e[10]!==y?(a=o.jsx("button",{type:"button",onClick:y,className:"absolute inset-0 z-0","aria-label":i.title}),e[9]=i.title,e[10]=y,e[11]=a):a=e[11];let l;e[12]!==i.icon||e[13]!==i.title?(l=o.jsx(Re,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[12]=i.icon,e[13]=i.title,e[14]=l):l=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Ue,{size:20})})}),e[15]=h):h=e[15];let C;e[16]!==f||e[17]!==i.id?(C=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=C):C=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(He,{size:16}),e[19]=w):w=e[19];let u;e[20]!==C?(u=o.jsxs(ne,{onClick:C,children:[w,"Settings"]}),e[20]=C,e[21]=u):u=e[21];let O;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==j?(O=T&&o.jsxs(ne,{onClick:I=>{I.stopPropagation(),j()},children:[o.jsx(fe,{size:16}),c(m?"home.projectCard.unsetMainAgent":"home.projectCard.setAsMainAgent")]}),e[22]=T,e[23]=m,e[24]=c,e[25]=j,e[26]=O):O=e[26];let E;e[27]!==r?(E=r&&o.jsxs(ne,{variant:"destructive",onClick:I=>{I.stopPropagation(),r(I)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let z;e[29]!==E||e[30]!==u||e[31]!==O?(z=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(ye,{align:"end",children:[u,O,E]})]})}),e[29]=E,e[30]=u,e[31]=O,e[32]=z):z=e[32];let _;e[33]!==z||e[34]!==l?(_=o.jsxs("div",{className:"flex items-start justify-between",children:[l,z]}),e[33]=z,e[34]=l,e[35]=_):_=e[35];let N;e[36]!==i.title?(N=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=N):N=e[37];let v;e[38]!==m||e[39]!==c?(v=m&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:[o.jsx(fe,{size:12}),c("home.projectCard.mainAgentBadge")]}),e[38]=m,e[39]=c,e[40]=v):v=e[40];let P;e[41]!==N||e[42]!==v?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[N,v]}),e[41]=N,e[42]=v,e[43]=P):P=e[43];const F=i.description||"No description";let s;e[44]!==F?(s=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:F}),e[44]=F,e[45]=s):s=e[45];let p;e[46]!==P||e[47]!==s?(p=o.jsxs("div",{className:"flex flex-col gap-1",children:[P,s]}),e[46]=P,e[47]=s,e[48]=p):p=e[48];let g;e[49]!==_||e[50]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[_,p]}),e[49]=_,e[50]=p,e[51]=g):g=e[51];let b;e[52]!==n||e[53]!==x||e[54]!==i.updated_at||e[55]!==c?(b=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:x})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:x})}),e[52]=n,e[53]=x,e[54]=i.updated_at,e[55]=c,e[56]=b):b=e[56];let S;e[57]!==b?(S=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:b})})}),e[57]=b,e[58]=S):S=e[58];let A;e[59]!==g||e[60]!==S?(A=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[g,S]}),e[59]=g,e[60]=S,e[61]=A):A=e[61];let k;return e[62]!==A||e[63]!==a?(k=o.jsxs(Ye,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[a,A]}),e[62]=A,e[63]=a,e[64]=k):k=e[64],k}const wt="deco-sites";function _t(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 St(t,e){const i=e?_t(e):null,n=i?.owner??wt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function Nt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Ne(t,e,i){const n=await fetch(t,e),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error??`${i} (${n.status})`);return r}function vt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function At({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=_e(),c=Ie(),{data:G}=Le.useSession(),[x,M]=W.useState(null),[d,T]=W.useState(null),[m,D]=W.useState(""),j=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Xe({slug:"mcp-github"}),a=ot(y),l=Me({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,C=a.length>1&&!h,w=xe({connectionId:h?.id??"",orgId:r.id,orgSlug:r.slug}),u=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:O,isLoading:E,error:z}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>vt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),_=O?.sites??[],N=s=>{s||(M(null),T(null),D("")),e(s)},v=_.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!x||v.some(s=>s.name===x),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:p}=await st(B=>j.callTool(B),h.id),g=_.find(B=>B.name===s);if(!g)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const b=St(s,g.metadata),S=it(p,b.owner);if(!S)throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:b.owner,installUrl:nt}));let A=null,k=null,I=null;const J=async()=>{I&&await j.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:I}}).catch(()=>{}),k&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),A&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{})};try{const B=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),U=B.connId;if(!U)throw new Error(n("common.importFromDecoDialog.noConnectionId"));A=U;const{childConnectionId:$}=await rt({orgSlug:r.slug,sourceConnection:h,installationId:S.installationId,owner:b.owner,repo:b.name,githubCallTool:H=>w.callTool(H),selfCallTool:H=>j.callTool(H)});k=$;const K=B.icon??null,q=Nt(s),re=s.toLowerCase(),Y=tt(je(g.domains)),Q=await j.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:K??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:re,productionUrl:Y,githubRepo:{owner:b.owner,name:b.name,url:b.url,installationId:S.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:K,themeColor:"#22C55E",slug:q,pinnedViews:[{connectionId:U,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:U,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:U},{connection_id:$}]}}}),R=Q.structuredContent??Q;if(!R.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return I=R.item.id,{slug:q,virtualMcpId:R.item.id,connId:U,item:R.item}}catch(B){throw await J(),B}},onSuccess:({slug:s,virtualMcpId:p,item:g})=>{V("deco_site_import_succeeded",{site_name:g.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(j,r.id,"","VIRTUAL_MCP",p),{item:g}),c.invalidateQueries({predicate:b=>{const S=b.queryKey;return S[1]===r.id&&S[3]==="collection"&&S[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),N(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{V("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),le.error(n("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:n("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(lt,{open:t,onOpenChange:N,children:o.jsxs(at,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(ct,{className:"sr-only",children:o.jsx(mt,{children:n("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&o.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":n("common.importFromDecoDialog.goBack"),children:o.jsx(Ve,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:n("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(ut,{value:m,onChange:D,placeholder:n("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&D("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??n("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:n("common.importFromDecoDialog.retryGithubSetup")})]}),u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.settingUpGithub")}),C&&!u&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>T(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(we,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),E&&!u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.loadingSites")}),!E&&!u&&!C&&l.status!=="error"&&!z&&_.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.noSitesFound")}),!E&&!u&&!C&&l.status!=="error"&&_.length>0&&o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:n("common.importFromDecoDialog.noSitesMatch",{search:m})}),v.map(s=>{const p=je(s.domains),g=x===s.name;return o.jsxs("button",{type:"button",onClick:()=>M(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",g?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),p&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:p})]})]},s.name)})]})]}),o.jsxs(dt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>N(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!x||!P||F.isPending||E||u||C||!h||l.status==="error",onClick:()=>x&&F.mutate(x),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function ns(){const t=ge.c(77),e=me(),{org:i}=De(),n=Oe(),r=ze(),[f,c]=W.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:x,isCreating:M}=Ze(G),[d,T]=W.useState(null),[m,D]=W.useState(!1),[j,y]=W.useState(!1),{granted:a}=Se("agents:manage"),l=f.toLowerCase(),h=n.filter(L=>L.id!==i.id&&(L.title.toLowerCase().includes(l)||L.description?.toLowerCase().includes(l))),{data:C}=Be(h.map(It));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:L,title:ve}=d;T(null);try{await r.delete.mutateAsync(L),V("agent_deleted",{agent_id:L,source:"agents_list"}),le.success(e("routes.agentsList.deletedAgent",{title:ve}))}catch{}},t[1]=r,t[2]=d,t[3]=e,t[4]=w):w=t[4];const u=w,O=ce,E=ce,z=ce;let _;t[5]!==e?(_=e("routes.agentsList.title"),t[5]=e,t[6]=_):_=t[6];let N;t[7]!==_?(N=o.jsx(ce.Title,{children:_}),t[7]=_,t[8]=N):N=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=L=>{L.key==="Escape"&&(c(""),L.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==v?(F=o.jsx(Dt,{value:f,onChange:c,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=v,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==x||t[17]!==M||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:M,align:"end"})]}),t[15]=a,t[16]=x,t[17]=M,t[18]=e,t[19]=s):s=t[19];let p;t[20]!==F||t[21]!==s?(p=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[F,s]}),t[20]=F,t[21]=s,t[22]=p):p=t[22];let g;t[23]!==p||t[24]!==N?(g=o.jsxs("div",{className:"flex flex-col gap-6",children:[N,p]}),t[23]=p,t[24]=N,t[25]=g):g=t[25];const b=h.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(We,{image:o.jsx($e,{size:48,className:"text-muted-foreground"}),title:e(f?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:f?e("routes.agentsList.noAgentsMatchSearch",{search:f}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!f&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:M,align:"center",showBetaBadge:!0})]})})}),S=h.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:h.map(L=>o.jsx(yt,{project:L,lastUsedAt:C?.get(L.id)?.last_used_at,onDeleteClick:a?()=>T({id:L.id,title:L.title}):void 0},L.id))})]});let A;t[26]!==g||t[27]!==b||t[28]!==S||t[29]!==z.Body?(A=o.jsxs(z.Body,{children:[g,b,S]}),t[26]=g,t[27]=b,t[28]=S,t[29]=z.Body,t[30]=A):A=t[30];let k;t[31]!==A||t[32]!==E.Content?(k=o.jsx(E.Content,{children:A}),t[31]=A,t[32]=E.Content,t[33]=k):k=t[33];let I;t[34]!==j?(I=o.jsx(Pe,{open:j,onOpenChange:y}),t[34]=j,t[35]=I):I=t[35];let J;t[36]!==m?(J=o.jsx(At,{open:m,onOpenChange:D}),t[36]=m,t[37]=J):J=t[37];const B=!!d;let U;t[38]===Symbol.for("react.memo_cache_sentinel")?(U=L=>!L&&T(null),t[38]=U):U=t[38];let $;t[39]!==e?($=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=$):$=t[40];let K;t[41]!==$?(K=o.jsx(pt,{children:$}),t[41]=$,t[42]=K):K=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const re=d?.title;let Y;t[45]!==re?(Y=o.jsx("span",{className:"font-medium text-foreground",children:re}),t[45]=re,t[46]=Y):Y=t[46];let Q;t[47]!==q||t[48]!==Y?(Q=o.jsxs(gt,{children:[q," ",Y,"."]}),t[47]=q,t[48]=Y,t[49]=Q):Q=t[49];let R;t[50]!==K||t[51]!==Q?(R=o.jsxs(ft,{children:[K,Q]}),t[50]=K,t[51]=Q,t[52]=R):R=t[52];let H;t[53]!==e?(H=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=H):H=t[54];let Z;t[55]!==H?(Z=o.jsx(ht,{children:H}),t[55]=H,t[56]=Z):Z=t[56];let X;t[57]!==e?(X=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=X):X=t[58];let ee;t[59]!==u||t[60]!==X?(ee=o.jsx(xt,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:X}),t[59]=u,t[60]=X,t[61]=ee):ee=t[61];let te;t[62]!==Z||t[63]!==ee?(te=o.jsxs(jt,{children:[Z,ee]}),t[62]=Z,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==R||t[66]!==te?(oe=o.jsxs(Ct,{children:[R,te]}),t[65]=R,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==B||t[69]!==oe?(se=o.jsx(bt,{open:B,onOpenChange:U,children:oe}),t[68]=B,t[69]=oe,t[70]=se):se=t[70];let ae;return t[71]!==O||t[72]!==k||t[73]!==I||t[74]!==J||t[75]!==se?(ae=o.jsxs(O,{children:[k,I,J,se]}),t[71]=O,t[72]=k,t[73]=I,t[74]=J,t[75]=se,t[76]=ae):ae=t[76],ae}function It(t){return t.id}export{ns as default};
@@ -0,0 +1 @@
1
+ import{X as J,Y as D,a2 as Me,a4 as Ae,a5 as de,a3 as qe,b7 as Fe,c as Z,b as le,Z as ze,_ as Be,r as X,j as s,a6 as rt,t as ae,av as He,F as we,o as Ke,e as _e,K as re,n as Le,m as Oe,B as oe,p as Ve,v as lt,E as nt}from"./index-OFuIeWBU.js";import{i as at}from"./AlertCircle-pqmzRzJD.js";import{P as Ne}from"./index-CP7hbBBu.js";import{S as Re}from"./skeleton-Cd62pFKu.js";import{b as Qe,a as Ee,S as Te,c as ct}from"./settings-section-DGgss-oN.js";import{u as Ce,b as Ie,i as dt,c as mt,p as ut,d as Ge}from"./use-ai-providers-XMOk0ZOu.js";import{i as ft}from"./CheckCircle-KQ7QLQnq.js";import{b as pt,j as gt}from"./use-organization-settings-CdIDoB_L.js";import{e as ht,f as We,P as xt,h as $e}from"./select-model-aDWO0QR9.js";import{u as bt}from"./use-debounced-autosave-BmuBhQoj.js";import{I as De}from"./input-D6HGf9aQ.js";import{T as Ue,a as vt}from"./toggle-group-CaL1nc-I.js";import{c as Ye,d as Xe,b as Je,f as Ze,g as et,e as tt,a as st,A as it}from"./alert-dialog-BDUQxyT2.js";import{u as Se}from"./studio-tools-Ck8WNEjD.js";import{s as yt}from"./Plus-B4O8CQB-.js";import{p as jt,f as St}from"./pt-BR-CLy76QW2.js";import{c as _t}from"./Tool01-Dwk2jnxr.js";import{s as Ct}from"./Trash01-KHaub8Lz.js";import{A as kt}from"./avatar-Ba2Gqhb3.js";import{i as Pt}from"./Settings02-dNA_w0fs.js";import{s as Nt}from"./Eye-CCDvKyN1.js";import{b as It,a as Dt,d as wt,e as Kt,c as At}from"./dialog-R92c_Pnz.js";import{S as Mt}from"./spinner-BULrncM1.js";import{R as Rt}from"./require-capability-Bv5KoiXy.js";import"./sidebar-zX-Xh26M.js";import"./LayoutLeft-CrAeQE2_.js";import"./use-mobile-Pya12KNo.js";import"./X-eA4ffq6C.js";import"./tooltip-B4QWZZgT.js";import"./card-BV9Yg8JF.js";import"./ArrowUpRight-BLRBShLj.js";import"./use-mcp-client-p6iuzcQc.js";import"./auth-DL0CrVYc.js";import"./drawer-DCxC2dRW.js";import"./chat-context-3uDM1nqn.js";import"./tab-id-D3E_XoXg.js";import"./Check-BudCPgEo.js";import"./Copy01-DKpWfuyL.js";import"./hooks-VDpgeOEk.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DK3tcwFk.js";import"./use-virtual-mcp-ByPyGM47.js";import"./use-decopilot-events-C4NHCngI.js";import"./checkbox-CuLLPt_L.js";import"./select-BfHA3hXI.js";import"./ChevronDown-CnqZfGUJ.js";import"./ChevronUp-D-1ZRQa8.js";import"./Key01-Cg7xRrj6.js";import"./SearchMd-D6K1gQz5.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-D7zGH_lY.js";import"./ChevronRight-jWXQxAxT.js";import"./use-is-desktop-app-BNujXJc_.js";import"./Stars01-CxZkjPqU.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-7ALtRHh9.js";import"./use-capability-R9xRMDt0.js";import"./access-gate-zVACMryx.js";import"./capability-load-error-DXAIRfYN.js";J({title:D(),url:D(),icon:D()});J({registries:Ae(D(),J({enabled:de()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Me(D()).describe("List of MCP app_name or app_id values to hide from the store.")});const ce=J({keyId:D(),modelId:D(),title:D().optional()}).nullable();qe(["fast","smart","thinking","image","web_search","deep_research"]);qe(["fast","smart","thinking"]);const Et=J({tiers:J({fast:ce,smart:ce,thinking:ce,image:ce,web_search:ce,deep_research:ce})});J({tiers:J({fast:ce.optional(),smart:ce.optional(),thinking:ce.optional()})});J({ids:Me(D()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});J({demo_mode:de().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:de().optional().describe("Curated commerce (reports) look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding."),qa_agent_enabled:de().optional().describe("Run the QA Agent on a task's pull request once it's In Review — it verifies the task actually solved the problem (exercises the feature, not just the diff)."),code_reviewer_enabled:de().optional().describe("Run the Code Reviewer on a task's pull request once it's In Review — it reviews the code using the repo's stack-appropriate review skills."),auto_merge:de().optional().describe("When every enabled reviewer (QA Agent / Code Reviewer) approves a task's pull request, merge it automatically instead of leaving the merge to a human."),sandbox_go_daemon:de().optional().describe("Which sandbox daemon this org's new sandboxes run. Go is the default, so this is an OPT-OUT: set it to `false` to keep the org on the TypeScript daemon; unset (or `true`) means Go. Affects the NEXT sandbox only — live sandboxes drain on the binary they booted with. Ignored unless the deployment sets STUDIO_SANDBOX_GO_TEMPLATE_NAME (the global kill switch); SANDBOX_START's `daemonImpl` overrides it per sandbox in either direction.")});J({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:J({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:J({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:Me(Ae(D(),Fe())).nullable().optional().describe("Brand images"),metadata:Ae(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:de().optional().describe("Whether this is the default brand for the organization")});const Tt=e=>e.capabilities?.includes("image")===!0,Ft=e=>dt(e),Ot=e=>mt(e),$t=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Tt},{key:"web_search",filter:Ft},{key:"deep_research",filter:Ot}];function Ut(e){const t=Z.c(26),{slot:i,onSlotChange:r,filterModels:n,defaultKeyId:a}=e,c=Ce(),[l,v]=X.useState(i?.keyId??a);let C;t[0]!==i?(C=()=>{i?.keyId&&v(i.keyId)},t[0]=i,t[1]=C):C=t[1];const y=i?.keyId;let o;t[2]!==y?(o=[y],t[2]=y,t[3]=o):o=t[3],X.useEffect(C,o);const d=l??a;let m;t[4]!==d||t[5]!==c?(m=d?c.find(b=>b.id===d):null,t[4]=d,t[5]=c,t[6]=m):m=t[6];const f=m,{models:h,isLoading:g}=Ie(n?d??void 0:void 0),k=n?g||h.some(n):!0;let p;t[7]!==i||t[8]!==f?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:f?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=f?.providerId,t[9]=p):p=t[9];const j=p,N=le();if(n&&!k){let b;t[10]!==N?(b=N("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=N,t[11]=b):b=t[11];let w;return t[12]!==b?(w=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:b}),t[12]=b,t[13]=w):w=t[13],w}let S;t[14]!==N?(S=N("settings.simpleModeSection.pickModel"),t[14]=N,t[15]=S):S=t[15];let _;t[16]===Symbol.for("react.memo_cache_sentinel")?(_=b=>v(b),t[16]=_):_=t[16];let u;t[17]!==d||t[18]!==r?(u=b=>{const w=b.keyId??d??"";v(w),r({keyId:w,modelId:b.modelId,title:b.title})},t[17]=d,t[18]=r,t[19]=u):u=t[19];let P;return t[20]!==d||t[21]!==n||t[22]!==j||t[23]!==S||t[24]!==u?(P=s.jsx(ht,{variant:"bordered",placeholder:S,model:j,credentialId:d,filterModels:n,onCredentialChange:_,onModelChange:u}),t[20]=d,t[21]=n,t[22]=j,t[23]=S,t[24]=u,t[25]=P):P=t[25],P}function qt(e){const t=Z.c(10),{isPending:i,showSaved:r}=e,n=le();if(i){let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(He,{size:12,className:"animate-spin"}),t[0]=a):a=t[0];let c;t[1]!==n?(c=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=c):c=t[2];let l;return t[3]!==c?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[3]=c,t[4]=l):l=t[4],l}if(r){let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ft,{size:12}),t[5]=a):a=t[5];let c;t[6]!==n?(c=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=c):c=t[7];let l;return t[8]!==c?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[8]=c,t[9]=l):l=t[9],l}return null}function zt(){const e=Z.c(58),t=le(),i=Ce(),r=pt(),n=i.length>0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ze(Et),e[0]=a):a=e[0];let c;e[1]!==r?(c={resolver:a,values:r,mode:"onChange"},e[1]=r,e[2]=c):c=e[2];const l=Be(c),{mutate:v,isPending:C,isSuccess:y}=gt(),o=l.formState.isDirty;let d;e[3]!==l||e[4]!==r||e[5]!==t||e[6]!==v?(d={delayMs:250,save:async()=>{const x=l.getValues();v(x,{onSuccess:()=>l.reset(x,{keepValues:!0}),onError:A=>{l.reset(r),ae.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=l,e[4]=r,e[5]=t,e[6]=v,e[7]=d):d=e[7];const{schedule:m}=bt(d),f=i[0],h=i[1],g=i[2],{models:k}=Ie(f?.id),{models:p}=Ie(h?.id),{models:j}=Ie(g?.id);let N,S;e[8]!==l||e[9]!==n?(N=()=>{n||l.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},S=[n,l],e[8]=l,e[9]=n,e[10]=N,e[11]=S):(N=e[10],S=e[11]),X.useEffect(N,S);let _;e[12]!==i||e[13]!==l||e[14]!==f||e[15]!==h||e[16]!==g||e[17]!==k||e[18]!==p||e[19]!==j?(_=()=>{const x=l.getValues(),A=new Set(i.map(Bt)),M={};f?.id&&(M[f.id]=k),h?.id&&(M[h.id]=p),g?.id&&(M[g.id]=j);const K=L=>L!=null&&!A.has(L.keyId),I={fast:K(x.tiers.fast)?null:x.tiers.fast,smart:K(x.tiers.smart)?null:x.tiers.smart,thinking:K(x.tiers.thinking)?null:x.tiers.thinking,image:K(x.tiers.image)?null:x.tiers.image,web_search:K(x.tiers.web_search)?null:x.tiers.web_search,deep_research:K(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 O=ut(i,M);l.reset({tiers:{fast:I.fast??O.chat.fast,smart:I.smart??O.chat.smart,thinking:I.thinking??O.chat.thinking,image:I.image??O.image,web_search:I.web_search??O.webSearch,deep_research:I.deep_research??O.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=l,e[14]=f,e[15]=h,e[16]=g,e[17]=k,e[18]=p,e[19]=j,e[20]=_):_=e[20];const u=f?.id,P=h?.id,b=g?.id;let w;e[21]!==i||e[22]!==l||e[23]!==k||e[24]!==p||e[25]!==j||e[26]!==u||e[27]!==P||e[28]!==b?(w=[l,i,k,p,j,u,P,b],e[21]=i,e[22]=l,e[23]=k,e[24]=p,e[25]=j,e[26]=u,e[27]=P,e[28]=b,e[29]=w):w=e[29],X.useEffect(_,w);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 H=V;let $;e[32]!==t?($=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]=$):$=e[33];const Q=$;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let R;e[36]!==t?(R=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=R):R=e[37];let q;e[38]!==R?(q=s.jsx("p",{className:"text-sm text-muted-foreground",children:R}),e[38]=R,e[39]=q):q=e[39];const G=y&&!o;let z;e[40]!==C||e[41]!==G?(z=s.jsx(qt,{isPending:C,showSaved:G}),e[40]=C,e[41]=G,e[42]=z):z=e[42];let E;e[43]!==q||e[44]!==z?(E=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[q,z]}),e[43]=q,e[44]=z,e[45]=E):E=e[45];let T;e[46]!==i[0]?.id||e[47]!==l.control||e[48]!==Q||e[49]!==H||e[50]!==m?(T=$t.map(x=>s.jsx(rt,{control:l.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:H(x.key),description:Q(x.key),action:s.jsx(Ut,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:K=>{M.onChange(K),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=l.control,e[48]=Q,e[49]=H,e[50]=m,e[51]=T):T=e[51];let F;e[52]!==T?(F=s.jsx(Ee,{children:T}),e[52]=T,e[53]=F):F=e[53];let B;return e[54]!==U||e[55]!==E||e[56]!==F?(B=s.jsxs(Te,{title:U,headerClassName:"pl-0",children:[E,F]}),e[54]=U,e[55]=E,e[56]=F,e[57]=B):B=e[57],B}function Bt(e){return e.id}const Ht={usd:[10,20,100],brl:[50,100,500]};function Lt(){const e=Z.c(30),t=le(),i=Se(),[r,n]=X.useState(!1);let a;e[0]!==t?(a=u=>{ae.error(t("settings.decoCreditsHero.topUpFailed",{message:u.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:c,isPending:l}=_e({mutationFn:async u=>{const{url:P}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:u,currency:d});return P},onSuccess:Vt,onError:a}),[v,C]=X.useState(""),[y,o]=X.useState("usd"),d=y,m=parseFloat(v),f=!isNaN(m)&&m>=1,h=d==="brl"?"R$":"$";let g;e[2]!==o?(g=u=>{u&&o(u)},e[2]=o,e[3]=g):g=e[3];let k,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Ue,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=s.jsx(Ue,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=p):(k=e[4],p=e[5]);let j;e[6]!==d||e[7]!==g?(j=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:d,onValueChange:g,children:[k,p]}),e[6]=d,e[7]=g,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==h||e[11]!==r||e[12]!==l||e[13]!==t||e[14]!==c?(N=!r&&s.jsxs(s.Fragment,{children:[Ht[d].map(u=>s.jsxs(oe,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>c(u*100),children:[h,u]},u)),s.jsx(oe,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:l,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=h,e[11]=r,e[12]=l,e[13]=t,e[14]=c,e[15]=N):N=e[15];let S;e[16]!==h||e[17]!==v||e[18]!==m||e[19]!==r||e[20]!==f||e[21]!==l||e[22]!==C||e[23]!==t||e[24]!==c?(S=r&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:h}),s.jsx(De,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:v,onChange:u=>C(u.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(oe,{className:"h-10",disabled:!f||l,onClick:()=>c(Math.round(m*100)),children:l?"...":t("settings.decoCreditsHero.add")}),s.jsx(oe,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),C("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=v,e[18]=m,e[19]=r,e[20]=f,e[21]=l,e[22]=C,e[23]=t,e[24]=c,e[25]=S):S=e[25];let _;return e[26]!==j||e[27]!==N||e[28]!==S?(_=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,N,S]})}),e[26]=j,e[27]=N,e[28]=S,e[29]=_):_=e[29],_}function Vt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Qt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Gt(){const e=Z.c(121),t=le(),{org:i}=we(),r=Se(),n=Ke(),a=Ce();let c;e[0]!==a?(c=a.find(Wt),e[0]=a,e[1]=c):c=e[1];const l=c,[v,C]=X.useState(!1);let y;e[2]!==l||e[3]!==r?(y=async()=>{l&&await r.call("AI_PROVIDER_KEY_DELETE",{keyId:l.id})},e[2]=l,e[3]=r,e[4]=y):y=e[4];let o;e[5]!==i.id||e[6]!==n||e[7]!==t?(o=()=>{n.invalidateQueries({queryKey:re.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:re.aiProviders(i.id)}),ae.success(t("settings.decoCreditsHero.disconnectSuccess")),C(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=o):o=e[8];let d;e[9]!==t?(d=ot=>{ae.error(t("settings.decoCreditsHero.disconnectError",{message:ot.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==y||e[12]!==o||e[13]!==d?(m={mutationFn:y,onSuccess:o,onError:d},e[11]=y,e[12]=o,e[13]=d,e[14]=m):m=e[14];const{mutate:f,isPending:h}=_e(m);let g;e[15]!==i.id?(g=re.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!l;let p;e[17]!==r?(p=async()=>{try{return await r.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=r,e[18]=p):p=e[18];let j;e[19]!==g||e[20]!==k||e[21]!==p?(j={queryKey:g,enabled:k,staleTime:6e4,queryFn:p},e[19]=g,e[20]=k,e[21]=p,e[22]=j):j=e[22];const{data:N,isLoading:S,refetch:_,isFetching:u}=Le(j);if(!l)return null;const P=N?.balanceCents!=null?N.balanceCents/100:null;let b;e[23]!==P?(b=P!=null?`$${P.toFixed(2)}`:"—",e[23]=P,e[24]=b):b=e[24];const w=b;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let H;e[27]!==t?(H=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=H):H=e[28];let $;e[29]!==H?($=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:H,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=H,e[30]=$):$=e[30];let Q;e[31]!==t?(Q=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=Q):Q=e[32];let U;e[33]!==Q?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:Q})}),e[33]=Q,e[34]=U):U=e[34];let R;e[35]!==$||e[36]!==U?(R=s.jsxs("div",{className:"flex items-center gap-3",children:[$,U]}),e[35]=$,e[36]=U,e[37]=R):R=e[37];let q;e[38]===Symbol.for("react.memo_cache_sentinel")?(q=()=>C(!0),e[38]=q):q=e[38];let G;e[39]!==t?(G=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=G):G=e[40];let z;e[41]!==h||e[42]!==G?(z=s.jsx(oe,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:q,disabled:h,children:G}),e[41]=h,e[42]=G,e[43]=z):z=e[43];let E;e[44]!==R||e[45]!==z?(E=s.jsxs("div",{className:"flex items-center justify-between",children:[R,z]}),e[44]=R,e[45]=z,e[46]=E):E=e[46];let T;e[47]!==t?(T=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=T):T=e[48];let F;e[49]!==T?(F=s.jsx(Ye,{children:T}),e[49]=T,e[50]=F):F=e[50];let B;e[51]!==t?(B=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=B):B=e[52];let x;e[53]!==B?(x=s.jsx(Xe,{children:B}),e[53]=B,e[54]=x):x=e[54];let A;e[55]!==F||e[56]!==x?(A=s.jsxs(Je,{children:[F,x]}),e[55]=F,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 K;e[60]!==M?(K=s.jsx(Ze,{children:M}),e[60]=M,e[61]=K):K=e[61];let I;e[62]!==f?(I=()=>f(),e[62]=f,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 O;e[69]!==K||e[70]!==Y?(O=s.jsxs(tt,{children:[K,Y]}),e[69]=K,e[70]=Y,e[71]=O):O=e[71];let L;e[72]!==A||e[73]!==O?(L=s.jsxs(st,{children:[A,O]}),e[72]=A,e[73]=O,e[74]=L):L=e[74];let ee;e[75]!==v||e[76]!==L?(ee=s.jsx(it,{open:v,onOpenChange:C,children:L}),e[75]=v,e[76]=L,e[77]=ee):ee=e[77];let te;e[78]!==P||e[79]!==w||e[80]!==u||e[81]!==S?(te=S||u?s.jsx(Re,{className:"h-9 w-24"}):s.jsx("span",{className:Oe("text-3xl font-semibold tabular-nums tracking-tight",P!=null&&Qt(P)),children:w}),e[78]=P,e[79]=w,e[80]=u,e[81]=S,e[82]=te):te=e[82];let se;e[83]!==_?(se=()=>_(),e[83]=_,e[84]=se):se=e[84];let ie;e[85]!==t?(ie=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ie):ie=e[86];const ne=u&&"animate-spin";let me;e[87]!==ne?(me=Oe(ne),e[87]=ne,e[88]=me):me=e[88];let ue;e[89]!==me?(ue=s.jsx(He,{size:14,className:me}),e[89]=me,e[90]=ue):ue=e[90];let fe;e[91]!==u||e[92]!==se||e[93]!==ie||e[94]!==ue?(fe=s.jsx("button",{type:"button",onClick:se,disabled:u,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ie,children:ue}),e[91]=u,e[92]=se,e[93]=ie,e[94]=ue,e[95]=fe):fe=e[95];let pe;e[96]!==te||e[97]!==fe?(pe=s.jsxs("div",{className:"flex items-baseline gap-2",children:[te,fe]}),e[96]=te,e[97]=fe,e[98]=pe):pe=e[98];let ge;e[99]!==t?(ge=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=ge):ge=e[100];let he;e[101]!==ge?(he=s.jsx("p",{className:"text-xs text-muted-foreground",children:ge}),e[101]=ge,e[102]=he):he=e[102];let xe;e[103]!==pe||e[104]!==he?(xe=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[pe,he]}),e[103]=pe,e[104]=he,e[105]=xe):xe=e[105];let be;e[106]!==t?(be=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=be):be=e[107];let ve;e[108]!==be?(ve=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:be}),e[108]=be,e[109]=ve):ve=e[109];let ke;e[110]===Symbol.for("react.memo_cache_sentinel")?(ke=s.jsx(Lt,{}),e[110]=ke):ke=e[110];let ye;e[111]!==ve?(ye=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ve,ke]}),e[111]=ve,e[112]=ye):ye=e[112];let je;e[113]!==E||e[114]!==ee||e[115]!==xe||e[116]!==ye?(je=s.jsx(Ee,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[E,ee,xe,ye]})}),e[113]=E,e[114]=ee,e[115]=xe,e[116]=ye,e[117]=je):je=e[117];let Pe;return e[118]!==V||e[119]!==je?(Pe=s.jsx(Te,{title:V,children:je}),e[118]=V,e[119]=je,e[120]=Pe):Pe=e[120],Pe}function Wt(e){return e.providerId==="deco"}function Yt(){const e=Z.c(8),{org:t}=we(),i=Se(),r=Ke();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let a;e[2]!==t||e[3]!==r?(a=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),r.invalidateQueries({queryKey:re.aiProviderKeys(t.id)}),r.invalidateQueries({queryKey:re.aiProviders(t.id)}),ae.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==a?(c={mutationFn:n,onSuccess:a,onError:Xt},e[5]=n,e[6]=a,e[7]=c):c=e[7],_e(c)}function Xt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ae.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Jt(){const e=Z.c(37),t=le(),{mutate:i,isPending:r}=Yt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=a):a=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let l;e[4]!==c?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:c,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=c,e[5]=l):l=e[5];let v;e[6]!==t?(v=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=v):v=e[7];let C;e[8]!==v?(C=s.jsx("p",{className:"text-base font-semibold",children:v}),e[8]=v,e[9]=C):C=e[9];let y;e[10]!==t?(y=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=y):y=e[11];let o;e[12]!==y?(o=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:y}),e[12]=y,e[13]=o):o=e[13];let d;e[14]!==C||e[15]!==o?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[C,o]}),e[14]=C,e[15]=o,e[16]=d):d=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let f;e[19]!==m?(f=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=f):f=e[20];let h;e[21]!==f||e[22]!==d?(h=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,f]}),e[21]=f,e[22]=d,e[23]=h):h=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==r||e[27]!==t?(k=t(r?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=r,e[27]=t,e[28]=k):k=e[28];let p;e[29]!==r||e[30]!==g||e[31]!==k?(p=s.jsx(oe,{variant:"outline",disabled:r,onClick:g,children:k}),e[29]=r,e[30]=g,e[31]=k,e[32]=p):p=e[32];let j;return e[33]!==h||e[34]!==p||e[35]!==l?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[a,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,h,p]})]}),e[33]=h,e[34]=p,e[35]=l,e[36]=j):j=e[36],j}const Zt=e=>J({label:D().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:D().optional(),baseUrl:D().optional()});function es({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:r}){return e&&!!t&&t!==i&&!r}function ts({providerKey:e,provider:t,preset:i,maskedKey:r,currentLabel:n,currentBaseUrl:a,onCancel:c,onSuccess:l}){const{org:v}=we(),C=Se(),y=Ke(),o=le(),[d,m]=X.useState(!1),f=t.id==="openai-compatible",h=t.supportedMethods.includes("api-key"),g=Zt(o),{register:k,handleSubmit:p,watch:j,setError:N,formState:{errors:S}}=Be({resolver:ze(g),defaultValues:{label:n,apiKey:"",baseUrl:a??""}}),_=j("apiKey")??"",{mutate:u,isPending:P}=_e({mutationFn:async b=>{let w;b.apiKey&&(f?w=JSON.stringify({baseUrl:b.baseUrl||a||"",apiKey:b.apiKey}):w=b.apiKey),await C.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:b.label,...w!==void 0?{apiKey:w}:{}})},onSuccess:()=>{y.invalidateQueries({queryKey:re.aiProviderKeys(v.id)}),y.invalidateQueries({queryKey:re.aiProviders(v.id)}),ae.success(o("settings.editProviderDialog.providerUpdated")),l()},onError:b=>ae.error(o("settings.editProviderDialog.failedToUpdate",{error:b.message}))});return s.jsxs("form",{onSubmit:p(b=>{if(es({isOpenAICompatible:f,baseUrl:b.baseUrl,currentBaseUrl:a,apiKey:b.apiKey})){N("apiKey",{message:o("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}u(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:o("settings.editProviderDialog.label")}),s.jsx(De,{placeholder:o("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),S.label&&s.jsx("p",{className:"text-xs text-destructive",children:S.label.message})]}),f&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:o("settings.editProviderDialog.baseUrl")}),s.jsx(De,{type:"url",placeholder:i?.baseUrlPlaceholder??o("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),h&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[o("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",o("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(De,{type:d&&_?"text":"password",placeholder:r,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),_&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":o(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Pt,{size:14}):s.jsx(Nt,{size:14})})]}),S.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(At,{children:[s.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:P,children:o("settings.editProviderDialog.cancel")}),s.jsx(oe,{type:"submit",size:"sm",disabled:P,children:o(P?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ss(e){const t=Z.c(31),{providerKey:i,provider:r,open:n,onOpenChange:a}=e,c=le(),l=Se(),v=r.id==="openai-compatible"&&i.presetId?We(i.presetId):void 0,C=v?.name??r.name;let y;t[0]!==i.id?(y=re.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=y):y=t[1];let o;t[2]!==i.id||t[3]!==l?(o=()=>l.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=l,t[4]=o):o=t[4];let d;t[5]!==n||t[6]!==y||t[7]!==o?(d={queryKey:y,queryFn:o,enabled:n,staleTime:0},t[5]=n,t[6]=y,t[7]=o,t[8]=d):d=t[8];const{data:m,isLoading:f}=Le(d),h=Kt,g=wt,k="sm:max-w-md",p=Dt,j=It,N=c("settings.editProviderDialog.editTitle",{name:C});let S;t[9]!==j||t[10]!==N?(S=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=S):S=t[11];let _;t[12]!==p||t[13]!==S?(_=s.jsx(p,{children:S}),t[12]=p,t[13]=S,t[14]=_):_=t[14];let u;t[15]!==f||t[16]!==a||t[17]!==v||t[18]!==m||t[19]!==r||t[20]!==i?(u=f||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Mt,{})}):s.jsx(ts,{providerKey:i,provider:r,preset:v,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[15]=f,t[16]=a,t[17]=v,t[18]=m,t[19]=r,t[20]=i,t[21]=u):u=t[21];let P;t[22]!==g||t[23]!==_||t[24]!==u?(P=s.jsxs(g,{className:k,children:[_,u]}),t[22]=g,t[23]=_,t[24]=u,t[25]=P):P=t[25];let b;return t[26]!==h||t[27]!==a||t[28]!==n||t[29]!==P?(b=s.jsx(h,{open:n,onOpenChange:a,children:P}),t[26]=h,t[27]=a,t[28]=n,t[29]=P,t[30]=b):b=t[30],b}function is(e){const t=Z.c(88),{providerKey:i,provider:r}=e,{org:n}=we(),a=Se(),c=Ke(),[l,v]=X.useState(!1),[C,y]=X.useState(!1),o=le(),[d]=lt(),m=d.language==="pt-BR"?jt:void 0,f=r.id==="openai-compatible";let h;t[0]!==f||t[1]!==i.presetId?(h=f&&i.presetId?We(i.presetId):void 0,t[0]=f,t[1]=i.presetId,t[2]=h):h=t[2];const g=h;let k;t[3]!==f||t[4]!==g||t[5]!==r.name||t[6]!==o?(k=g?g.name:f?o("settings.aiProviders.customOpenAiCompatible"):r.name,t[3]=f,t[4]=g,t[5]=r.name,t[6]=o,t[7]=k):k=t[7];const p=k,j=g?.logo??r.logo;let N;e:{if(f){N=i.label;break e}let ne;t[8]!==m||t[9]!==i.createdAt||t[10]!==i.label||t[11]!==o?(ne=o("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:St(new Date(i.createdAt),{locale:m})}),t[8]=m,t[9]=i.createdAt,t[10]=i.label,t[11]=o,t[12]=ne):ne=t[12],N=ne}const S=N;let _;t[13]!==i.id||t[14]!==a?(_=async()=>{await a.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[13]=i.id,t[14]=a,t[15]=_):_=t[15];let u;t[16]!==n||t[17]!==i.id||t[18]!==c||t[19]!==o?(u=()=>{c.invalidateQueries({queryKey:re.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:re.aiProviders(n.id)}),c.invalidateQueries({queryKey:re.aiProviderModels(n.id,i.id)}),ae.success(o("settings.providerKeyRow.keyDeleted")),v(!1)},t[16]=n,t[17]=i.id,t[18]=c,t[19]=o,t[20]=u):u=t[20];let P;t[21]!==o?(P=ne=>ae.error(o("settings.providerKeyRow.failedToDeleteKey",{error:ne.message})),t[21]=o,t[22]=P):P=t[22];let b;t[23]!==_||t[24]!==u||t[25]!==P?(b={mutationFn:_,onSuccess:u,onError:P},t[23]=_,t[24]=u,t[25]=P,t[26]=b):b=t[26];const{mutate:w,isPending:V}=_e(b);let H;t[27]!==p||t[28]!==j?(H=j?s.jsx("img",{src:j,alt:p,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(kt,{fallback:p.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[27]=p,t[28]=j,t[29]=H):H=t[29];let $;t[30]!==o?($=o("settings.providerKeyRow.editProviderKey"),t[30]=o,t[31]=$):$=t[31];let Q,U;t[32]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>y(!0),U=s.jsx(_t,{size:14}),t[32]=Q,t[33]=U):(Q=t[32],U=t[33]);let R;t[34]!==$?(R=s.jsx(oe,{variant:"ghost",size:"icon","aria-label":$,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Q,children:U}),t[34]=$,t[35]=R):R=t[35];let q;t[36]!==o?(q=o("settings.providerKeyRow.deleteProviderKey"),t[36]=o,t[37]=q):q=t[37];let G,z;t[38]===Symbol.for("react.memo_cache_sentinel")?(G=()=>v(!0),z=s.jsx(Ct,{size:14}),t[38]=G,t[39]=z):(G=t[38],z=t[39]);let E;t[40]!==V||t[41]!==q?(E=s.jsx(oe,{variant:"ghost",size:"icon","aria-label":q,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:V,onClick:G,children:z}),t[40]=V,t[41]=q,t[42]=E):E=t[42];let T;t[43]!==R||t[44]!==E?(T=s.jsxs("div",{className:"flex items-center gap-0.5",children:[R,E]}),t[43]=R,t[44]=E,t[45]=T):T=t[45];let F;t[46]!==S||t[47]!==p||t[48]!==T||t[49]!==H?(F=s.jsx(Qe,{icon:H,title:p,description:S,action:T}),t[46]=S,t[47]=p,t[48]=T,t[49]=H,t[50]=F):F=t[50];let B;t[51]!==C||t[52]!==r||t[53]!==i?(B=s.jsx(ss,{providerKey:i,provider:r,open:C,onOpenChange:y}),t[51]=C,t[52]=r,t[53]=i,t[54]=B):B=t[54];let x;t[55]!==o?(x=o("settings.providerKeyRow.deleteApiKey"),t[55]=o,t[56]=x):x=t[56];let A;t[57]!==x?(A=s.jsx(Ye,{children:x}),t[57]=x,t[58]=A):A=t[58];let M;t[59]!==i.label?(M=s.jsxs(Xe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[59]=i.label,t[60]=M):M=t[60];let K;t[61]!==A||t[62]!==M?(K=s.jsxs(Je,{children:[A,M]}),t[61]=A,t[62]=M,t[63]=K):K=t[63];let I;t[64]!==o?(I=o("settings.providerKeyRow.cancel"),t[64]=o,t[65]=I):I=t[65];let W;t[66]!==I?(W=s.jsx(Ze,{children:I}),t[66]=I,t[67]=W):W=t[67];let Y;t[68]!==w?(Y=()=>w(),t[68]=w,t[69]=Y):Y=t[69];let O;t[70]!==o?(O=o("settings.providerKeyRow.delete"),t[70]=o,t[71]=O):O=t[71];let L;t[72]!==Y||t[73]!==O?(L=s.jsx(et,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:O}),t[72]=Y,t[73]=O,t[74]=L):L=t[74];let ee;t[75]!==W||t[76]!==L?(ee=s.jsxs(tt,{children:[W,L]}),t[75]=W,t[76]=L,t[77]=ee):ee=t[77];let te;t[78]!==K||t[79]!==ee?(te=s.jsxs(st,{children:[K,ee]}),t[78]=K,t[79]=ee,t[80]=te):te=t[80];let se;t[81]!==l||t[82]!==te?(se=s.jsx(it,{open:l,onOpenChange:v,children:te}),t[81]=l,t[82]=te,t[83]=se):se=t[83];let ie;return t[84]!==F||t[85]!==B||t[86]!==se?(ie=s.jsxs(s.Fragment,{children:[F,B,se]}),t[84]=F,t[85]=B,t[86]=se,t[87]=ie):ie=t[87],ie}function os(e){const t=Z.c(17),{onConnectClick:i}=e,r=le(),n=Ce(),a=Ge();let c;t[0]!==a?.providers?(c=a?.providers??[],t[0]=a?.providers,t[1]=c):c=t[1];const l=c;let v;if(t[2]!==n||t[3]!==i||t[4]!==l||t[5]!==r){let C;t[7]!==l?(C=h=>({key:h,provider:l.find(g=>g.id===h.providerId)}),t[7]=l,t[8]=C):C=t[8];const y=n.filter(ns).map(C).filter(ls);let o;t[9]!==r?(o=r("settings.connectedProvidersSection.sectionTitle"),t[9]=r,t[10]=o):o=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yt,{size:14}),t[11]=d):d=t[11];let m;t[12]!==r?(m=r("settings.connectedProvidersSection.connectButton"),t[12]=r,t[13]=m):m=t[13];let f;t[14]!==i||t[15]!==m?(f=s.jsxs(oe,{size:"sm",onClick:i,children:[d,m]}),t[14]=i,t[15]=m,t[16]=f):f=t[16],v=s.jsx(Te,{title:o,headerClassName:"px-0",actions:f,children:y.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:r("settings.connectedProvidersSection.emptyState")}):s.jsx(Ee,{children:y.map(rs)})}),t[2]=n,t[3]=i,t[4]=l,t[5]=r,t[6]=v}else v=t[6];return v}function rs(e){const{key:t,provider:i}=e;return s.jsx(is,{providerKey:t,provider:i},t.id)}function ls(e){return e.provider!==void 0}function ns(e){return e.providerId!=="deco"}function as(e){const t=Z.c(3),{error:i}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(at,{size:16}),t[0]=r):r=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[r,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function cs(){const e=Z.c(23),t=Ce();let i;e[0]!==t?(i=t.some(ds),e[0]=t,e[1]=i):i=e[1];const r=i,n=t.length>0,[a,c]=X.useState(!1),[l,v]=X.useState(null),C=Ge();let y;e[2]!==C?.providers?(y=C?.providers??[],e[2]=C?.providers,e[3]=y):y=e[3];const o=y;if(!n){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),e[4]=k):k=e[4];let p;e[5]!==o?(p=s.jsx(xt,{providers:o,onSelect:v,onShowAll:k}),e[5]=o,e[6]=p):p=e[6];const j=l!==null||a;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=P=>{P||(v(null),c(!1))},e[7]=N):N=e[7];const S=l??void 0;let _;e[8]!==j||e[9]!==S?(_=s.jsx($e,{open:j,onOpenChange:N,initialProvider:S}),e[8]=j,e[9]=S,e[10]=_):_=e[10];let u;return e[11]!==p||e[12]!==_?(u=s.jsxs(s.Fragment,{children:[p,_]}),e[11]=p,e[12]=_,e[13]=u):u=e[13],u}let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(X.Suspense,{fallback:s.jsx(Re,{className:"h-16 w-full"}),children:s.jsx(zt,{})}),e[14]=d):d=e[14];let m;e[15]!==r?(m=r?s.jsx(Gt,{}):s.jsx(Jt,{}),e[15]=r,e[16]=m):m=e[16];let f;e[17]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(os,{onConnectClick:()=>c(!0)}),e[17]=f):f=e[17];let h;e[18]!==a?(h=s.jsx($e,{open:a,onOpenChange:c}),e[18]=a,e[19]=h):h=e[19];let g;return e[20]!==m||e[21]!==h?(g=s.jsxs(s.Fragment,{children:[d,m,f,h]}),e[20]=m,e[21]=h,e[22]=g):g=e[22],g}function ds(e){return e.providerId==="deco"}function ms(){const e=Z.c(7),t=le();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let r;e[2]!==i?(r=s.jsx(Ne.Title,{children:i}),e[2]=i,e[3]=r):r=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(nt,{fallback:us,children:s.jsx(X.Suspense,{fallback:s.jsx(Re,{className:"h-64 w-full"}),children:s.jsx(cs,{})})}),e[4]=n):n=e[4];let a;return e[5]!==r?(a=s.jsx(Ne,{children:s.jsx(Ne.Content,{children:s.jsx(Ne.Body,{children:s.jsxs(ct,{children:[r,n]})})})}),e[5]=r,e[6]=a):a=e[6],a}function us(e){const{error:t}=e;return s.jsx(as,{error:t??new Error("Failed to load AI providers")})}function vi(){const e=Z.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Rt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ms,{})}),e[0]=t):t=e[0],t}export{vi as default};
@@ -1 +1 @@
1
- import{c as n,m as o,j as c,bB as d}from"./index-CUEhhFkA.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
1
+ import{c as n,m as o,j as c,bB as d}from"./index-OFuIeWBU.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
@@ -1,4 +1,4 @@
1
- import{r as i,j as r,cY as T,cZ as w,aB as m,c_ as A,e0 as O,H as M,aD as I,cy as z,e1 as D,cz as F,d5 as L,az as G,d7 as H,cA as Y,c as n,m as p,bT as v}from"./index-CUEhhFkA.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var B="AlertDialogTrigger",V=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});V.displayName=B;var W="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(F,{...a,...t})};y.displayName=W;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Y,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[Z,J]=k(f),K=L("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(Z,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(K,{children:a}),r.jsx(U,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});R.displayName=E;var Q="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Q;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=J($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var U=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{r as i,j as r,cY as T,cZ as w,aB as m,c_ as A,e0 as O,H as M,aD as I,cy as z,e1 as D,cz as F,d5 as L,az as G,d7 as H,cA as Y,c as n,m as p,bT as v}from"./index-OFuIeWBU.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var B="AlertDialogTrigger",V=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});V.displayName=B;var W="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(F,{...a,...t})};y.displayName=W;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Y,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[Z,J]=k(f),K=L("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(Z,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(K,{children:a}),r.jsx(U,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});R.displayName=E;var Q="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Q;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=J($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var U=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
3
  You can add a description to the \`${f}\` by passing a \`${E}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
@@ -1 +1 @@
1
- import{c as gt,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-CUEhhFkA.js";import{i as jt}from"./ChevronRight-BA_KeRrx.js";import{l as Bt}from"./automation-runs-B3MPRguv.js";import{A as At}from"./add-section-modal-Bzs1tH6_.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-DAXTeTbR.js";import"./select-BrkB_YSs.js";import"./tooltip-BNye0dKm.js";import"./Check-DRHebq05.js";import"./ChevronDown-CQ6znfFH.js";import"./ChevronUp-DVQu5g5t.js";import"./useInfiniteQuery-dvWvOWWt.js";import"./use-infinite-scroll-CaNm312i.js";import"./use-connection-C3T1xFRX.js";import"./use-mcp-client-CdYMMWSO.js";import"./auth-CZyFs5-X.js";import"./use-virtual-mcp-CRB2isTu.js";import"./card-DTyggeiE.js";import"./sidebar-DnrpOcUt.js";import"./LayoutLeft-D6cz98wA.js";import"./use-mobile-u9PWDzDf.js";import"./X-BCC1Ri4d.js";import"./table-Hb8bDUqL.js";import"./empty-state-Doz2U8-n.js";import"./use-members-gV6tk0K-.js";import"./use-org-auth-client-B-04KAvZ.js";import"./use-clock-tick-DUtgJAUk.js";import"./AlertCircle-XsSybzV2.js";import"./CheckCircle-DIFjbn-D.js";import"./DotsVertical-CaKRcDmK.js";import"./agent-icon-B9cL76D_.js";import"./Tool01-B2A1WZbW.js";import"./ArrowUp-BiPUP2gq.js";import"./Settings02-CGfQYOCm.js";import"./Tool02-DtTt8E9G.js";import"./XCircle-FHv-T_YI.js";import"./ArrowUpRight-kUSCGGiA.js";import"./TrendUp01-MqZny71u.js";import"./ZapSquare-Ua60hj0w.js";import"./Users03-CzYxh4Nc.js";import"./Stars02-ox6hLDxt.js";import"./Copy01-B_G58LZY.js";import"./CpuChip01-DFejE2LO.js";import"./Eye-CDzVXN3o.js";import"./FilterLines-IuYLktmF.js";import"./Star01-BBb4arlG.js";import"./Palette-B4-vfaKL.js";import"./SwitchHorizontal01-Bspj7Vj6.js";import"./HardDrive-BbiV1wJQ.js";import"./Key01-Dt5Mf3aj.js";import"./LinkExternal01-DhaWMZac.js";import"./LogOut01-8bL0QEJV.js";import"./Monitor01-DCylQ5tt.js";import"./Sun-DPsJ2b1E.js";import"./Play-6R8vxzNW.js";import"./Plus-vFX-xmox.js";import"./SearchLg-xaso6Wq4.js";import"./SearchMd-Byt-g7vZ.js";import"./Shield01-B9zyRhV8.js";import"./Stars01-C_m5dPf5.js";import"./Trash01-YaFSTgUX.js";import"./Upload01-CiFB3Tur.js";import"./User01-C5Yp3meQ.js";import"./Users01-DurIoWFy.js";import"./XClose-Cqnz1T9W.js";import"./Zap-C_Z0Pnr9.js";import"./use-automations-kQIAo5Jm.js";import"./studio-tools-CcQw1G2R.js";import"./useSuspenseInfiniteQuery-Cal-i01w.js";import"./avatar-CoOOLfC1.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-L9NArsbn.js";import"./calendar-Dn9s36Xe.js";import"./dialog-CM7HYdGm.js";import"./tab-id-9DMAfa2T.js";import"./hooks-BtDpKg5N.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DnhzFtCQ.js";import"./chat-context-CCFohHst.js";import"./use-ai-providers-RQ8Vfto6.js";import"./use-decopilot-events-Dz6okK1o.js";import"./use-organization-settings-CxnOU5AV.js";import"./monaco-editor-9LxNntdd.js";import"./spinner-BBLqnnk0.js";import"./index-TU307Yrp.js";import"./shell-layout-Chl24Hqy.js";import"./use-is-desktop-app-BNujXJc_.js";import"./required-auth-layout-BHJiGd5R.js";import"./use-org-sso-B_R9NcR2.js";import"./integration-icon-XjdXY3eT.js";import"./use-navigate-to-agent-CvjDM4uj.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-C4ZhwL0D.js";import"./form-DLdD3JgE.js";import"./label-Bo-GoBix.js";import"./input-k8QMZSpl.js";import"./drawer-BtlDaNql.js";import"./collection-search-_-XVj1sh.js";import"./index-DfI3lYUq.js";import"./get-initials-D-f_fDFw.js";import"./popover-CGGxHaV2.js";import"./dropdown-menu-BGosRkzl.js";import"./github-repo-picker-D2vpz6sK.js";import"./use-debounced-value-3rO8TtRH.js";import"./authenticate-and-persist-oauth-BAzzX0Ll.js";import"./mcp-oauth-DQo8HdBy.js";import"./use-mcp-tools-DcRf4Qk1.js";import"./extract-connection-data-CL1mZXvD.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-CAXumITS.js";import"./use-tags-CzERZ8zr.js";import"./skeleton-ubrWwuqr.js";import"./command-BOyEi0RK.js";import"./index-DxUEXfrS.js";import"./companions-core-ytu3FTIi.js";import"./tabs-Dh6a3OYH.js";import"./toggle-group-1Yj4T64a.js";import"./use-deco-credits-CNG6Ed_s.js";import"./alert-dialog-DtzbrfY8.js";import"./toolbar-DBG8Kp4J.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-BMbhSeIj.js";import"./use-registry-connections-CED-TXjg.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-mikc_xJD.js";import"./connection-form-helpers-49UPI5Ws.js";import"./collection-tabs-LlDw_64d.js";import"./badge-CM-uUCke.js";import"./select-model-C_MgNjBF.js";import"./checkbox-Bi3A0Gbi.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-38RkVyD-.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Db7yNxU9.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-DTky4_rM.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-DsjOpWQI.js";import"./use-debounced-autosave-CsJyNeJR.js";import"./index-O2A0mRXY.js";import"./search-input-B5E3rgEU.js";import"./switch-fumpDPMB.js";import"./use-secrets-D-IOSNQd.js";import"./useQueries-DfRa6hBH.js";import"./use-file-configs-CeWA-mlS.js";import"./automation-list-row-B2aBGwZQ.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Ar(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:m,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,s=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==m||t[2]!==b?(R=Et(b,m,G),t[0]=G,t[1]=m,t[2]=b,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==m||t[9]!==Z?(K=Z??(c?Nt(i,c,m):i),t[6]=c,t[7]=i,t[8]=m,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const mt=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==mt||t[27]!==g?(I={...mt,...g},t[26]=mt,t[27]=g,t[28]=I):I=t[28];const st=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==s?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(s("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:s("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=s,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==s||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":s("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[45]=a,t[46]=E,t[47]=s,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==st||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==m||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==s?(B=o.jsx(Bt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:Q?o.jsx(Tt,{schema:h,value:st,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:m,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),s("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=st,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=m,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=s,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==m||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:m,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=m,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{Ar as AppEditor};
1
+ import{c as gt,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-OFuIeWBU.js";import{i as jt}from"./ChevronRight-jWXQxAxT.js";import{l as Bt}from"./automation-runs-GivPtHD0.js";import{A as At}from"./add-section-modal-MZkelOIV.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-CIppZMLU.js";import"./select-BfHA3hXI.js";import"./tooltip-B4QWZZgT.js";import"./Check-BudCPgEo.js";import"./ChevronDown-CnqZfGUJ.js";import"./ChevronUp-D-1ZRQa8.js";import"./useInfiniteQuery-Dh0Gvn-P.js";import"./use-infinite-scroll-CgKbiP8I.js";import"./use-connection-E0imXfMX.js";import"./use-mcp-client-p6iuzcQc.js";import"./auth-DL0CrVYc.js";import"./use-virtual-mcp-ByPyGM47.js";import"./card-BV9Yg8JF.js";import"./sidebar-zX-Xh26M.js";import"./LayoutLeft-CrAeQE2_.js";import"./use-mobile-Pya12KNo.js";import"./X-eA4ffq6C.js";import"./table-_nYBvo6-.js";import"./empty-state-BFZ_pyiJ.js";import"./use-members-lcuXZKPB.js";import"./use-org-auth-client-Criqs8X8.js";import"./use-clock-tick-Cs7ZABrR.js";import"./AlertCircle-pqmzRzJD.js";import"./CheckCircle-KQ7QLQnq.js";import"./DotsVertical-CmfEzLbI.js";import"./agent-icon-D_nZ6mrh.js";import"./Tool01-Dwk2jnxr.js";import"./ArrowUp-Cja1iGmu.js";import"./Settings02-dNA_w0fs.js";import"./Tool02-BJ8Pm3bB.js";import"./XCircle-CclOCWSw.js";import"./ArrowUpRight-BLRBShLj.js";import"./TrendUp01-D8U-rE4_.js";import"./ZapSquare-Bsi66MG_.js";import"./Users03-3PvR443H.js";import"./Stars02-m6J1J5js.js";import"./Copy01-DKpWfuyL.js";import"./CpuChip01-BFj5zMEs.js";import"./Eye-CCDvKyN1.js";import"./FilterLines-B2KnloFF.js";import"./Star01-DQCPnd5h.js";import"./Palette-BFAwTvSE.js";import"./SwitchHorizontal01-CSA5YTCy.js";import"./HardDrive-FMBz7R-3.js";import"./Key01-Cg7xRrj6.js";import"./LinkExternal01-CoNiop35.js";import"./LogOut01-D0rW1sIh.js";import"./Monitor01-D7zGH_lY.js";import"./Sun-Cxxd7Gbn.js";import"./Play-DyWf32_s.js";import"./Plus-B4O8CQB-.js";import"./SearchLg-BLHmttXq.js";import"./SearchMd-D6K1gQz5.js";import"./Shield01-BmMAtVqp.js";import"./Stars01-CxZkjPqU.js";import"./Trash01-KHaub8Lz.js";import"./Upload01-L_4YihBW.js";import"./User01-7ALtRHh9.js";import"./Users01-CPEyBSqa.js";import"./XClose-B8QTyuNc.js";import"./Zap-CC0qAKRq.js";import"./use-automations-BJf24dYG.js";import"./studio-tools-Ck8WNEjD.js";import"./useSuspenseInfiniteQuery-DCCY-k1D.js";import"./avatar-Ba2Gqhb3.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CRWKGHJN.js";import"./calendar-y7Z3l0t-.js";import"./dialog-R92c_Pnz.js";import"./tab-id-D3E_XoXg.js";import"./hooks-VDpgeOEk.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DK3tcwFk.js";import"./chat-context-3uDM1nqn.js";import"./use-ai-providers-XMOk0ZOu.js";import"./use-decopilot-events-C4NHCngI.js";import"./use-organization-settings-CdIDoB_L.js";import"./monaco-editor-DAztJ7NY.js";import"./spinner-BULrncM1.js";import"./index-B2R1pAtc.js";import"./shell-layout-WBJ3MoEz.js";import"./use-is-desktop-app-BNujXJc_.js";import"./required-auth-layout-Y5UM7oI2.js";import"./use-org-sso-C2IyqiaN.js";import"./integration-icon-B0Qh3kkh.js";import"./use-navigate-to-agent-BNPczzIg.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-JtTd_Y37.js";import"./form-BPQDX1iu.js";import"./label-C0nGPhyn.js";import"./input-D6HGf9aQ.js";import"./drawer-DCxC2dRW.js";import"./collection-search-B6rZN0yo.js";import"./index-Dveh4K2v.js";import"./get-initials-D-f_fDFw.js";import"./popover-B1k48k3v.js";import"./dropdown-menu-BnENS1C8.js";import"./github-repo-picker-BIiHdSbe.js";import"./use-debounced-value-UVOlZ3gD.js";import"./authenticate-and-persist-oauth-DAZm6keb.js";import"./mcp-oauth-DK9h3luZ.js";import"./use-mcp-tools-Bpb4DQXQ.js";import"./extract-connection-data-CY98vwTG.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-CAXumITS.js";import"./use-tags-BQQBSo4w.js";import"./skeleton-Cd62pFKu.js";import"./command-B9pzXnjQ.js";import"./index-50qLy1V3.js";import"./companions-core-BmIxvwXH.js";import"./tabs-CRFEXKs1.js";import"./toggle-group-CaL1nc-I.js";import"./use-deco-credits-zQFZusEY.js";import"./alert-dialog-BDUQxyT2.js";import"./toolbar-BhA4kTI5.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-BEEfZ_Gw.js";import"./use-registry-connections-B3eNVmA7.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-DlYNEV-I.js";import"./connection-form-helpers-Bcft3DyG.js";import"./collection-tabs-BH_gsD9t.js";import"./badge-CitgQ88i.js";import"./select-model-aDWO0QR9.js";import"./checkbox-CuLLPt_L.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-DGgss-oN.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CfzCFlDY.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-R9xRMDt0.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-TirzCz71.js";import"./use-debounced-autosave-BmuBhQoj.js";import"./index-CP7hbBBu.js";import"./search-input-B2V-KxMH.js";import"./switch-DP-6KK-R.js";import"./use-secrets-wm75C4q2.js";import"./useQueries-BcZGQUCR.js";import"./use-file-configs-Sk-WKXU_.js";import"./automation-list-row-CkO0J79X.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Ar(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:m,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,s=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==m||t[2]!==b?(R=Et(b,m,G),t[0]=G,t[1]=m,t[2]=b,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==m||t[9]!==Z?(K=Z??(c?Nt(i,c,m):i),t[6]=c,t[7]=i,t[8]=m,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const mt=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==mt||t[27]!==g?(I={...mt,...g},t[26]=mt,t[27]=g,t[28]=I):I=t[28];const st=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==s?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(s("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:s("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=s,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==s||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":s("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[45]=a,t[46]=E,t[47]=s,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==st||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==m||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==s?(B=o.jsx(Bt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:Q?o.jsx(Tt,{schema:h,value:st,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:m,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),s("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=st,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=m,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=s,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==m||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:m,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=m,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{Ar as AppEditor};
@@ -1 +1 @@
1
- import{cG as v,cH as $,cI as W,cJ as L,cK as H,cL as D,cM as V,cN as x,cO as q,cP as j,cQ as y,cR as N,cS as B,cT as Z,cU as F}from"./index-CUEhhFkA.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 K(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function Q(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&K(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 Y(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 V)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 k=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(k),d=k}}const C=!e.redirectUrl;if(n!==void 0||C){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const S=await e.tokens();if(S?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:S.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:I,codeVerifier:b}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(b),await e.redirectToAuthorization(I),"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 v.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await F(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function O(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=Q(r,h);Y(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return x.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=O(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=O(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return Z.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
1
+ import{cG as v,cH as $,cI as W,cJ as L,cK as H,cL as D,cM as V,cN as x,cO as q,cP as j,cQ as y,cR as N,cS as B,cT as Z,cU as F}from"./index-OFuIeWBU.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 K(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function Q(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&K(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 Y(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 V)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 k=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(k),d=k}}const C=!e.redirectUrl;if(n!==void 0||C){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const S=await e.tokens();if(S?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:S.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:I,codeVerifier:b}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(b),await e.redirectToAuthorization(I),"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 v.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await F(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function O(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=Q(r,h);Y(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return x.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=O(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=O(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return Z.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
@@ -1 +1 @@
1
- import{c as l,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-CUEhhFkA.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
1
+ import{c as l,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-OFuIeWBU.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{a as B,D as ke,r as y,e as ae,p as $,j as t,m as j,B as pe,o as Be,n as $e,K as oe,c as ce,b as xe,S as Fe}from"./index-CUEhhFkA.js";import{I as X}from"./input-k8QMZSpl.js";import{i as Ve}from"./use-is-desktop-app-BNujXJc_.js";import{S as Qe}from"./spinner-BBLqnnk0.js";import{r as ze,R as He}from"./retry-CErkP7V6.js";const _e={submitEmailPassword:({mode:r,email:e,password:c,name:f})=>r==="sign_up"?B.signUp.email({email:e,password:c,name:f||""}):B.signIn.email({email:e,password:c}),requestPasswordReset:({email:r,redirectTo:e})=>B.requestPasswordReset({email:r,redirectTo:e}),sendOtp:({email:r})=>B.emailOtp.sendVerificationOtp({email:r,type:"sign-in"}),submitOtp:({email:r,otp:e})=>B.signIn.emailOtp({email:r,otp:e}),socialSignIn:({provider:r,callbackURL:e})=>B.signIn.social({provider:r,callbackURL:e}),ssoSignIn:({providerId:r,callbackURL:e})=>B.signIn.sso({providerId:r,callbackURL:e}),onAuthenticated:r=>{window.location.href=r}},le="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ke={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 Ye({redirectUrl:r,callbackUrl:e="/",title:c,subtitle:f,brand:p,copy:m,variant:i="default",allowedSocialProviders:l,allowPassword:u=!0,onAuthEvent:I,actions:N}){const{emailAndPassword:A,resetPassword:v,emailOtp:E,socialProviders:h}=ke(),d={..._e,...N},g=s=>{try{I?.(s)}catch{}},P=i==="compact",Z=l?h.providers.filter(s=>l.includes(s.name)):h.providers,ee=h.enabled&&Z.length>0,me=A.enabled&&(u||!E.enabled&&!ee),x=h.enabled&&h.providers.length>0&&!ee&&!E.enabled&&!me?h.providers:Z,O=h.enabled&&x.length>0,F=A.enabled&&(u||!E.enabled&&!O),[b,M]=y.useState(""),[_,V]=y.useState(""),[a,S]=y.useState(""),[q,T]=y.useState(""),[L,ue]=y.useState(!1),[ge,Le]=y.useState(()=>E.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[k,Q]=y.useState(""),[be,ye]=y.useState(!1),[Oe,he]=y.useState(null),n={...Ke,...m},te=y.useId(),z=`${te}-email`,H=`${te}-email-error`,ve=`${te}-name`,we=`${te}-password`,Ee=`${te}-otp`,C=ge==="signUp",W=ge==="forgotPassword",R=ge==="emailOtp",se=ae({mutationFn:async({email:s,password:o,name:D})=>{try{const J=await d.submitEmailPassword({mode:C?"sign_up":"sign_in",email:s,password:o,name:D});if(J.error)throw new Error(J.error.message||(C?n.signUpFailed:n.signInFailed));return J}catch(J){throw J instanceof Error?J:new Error(n.authenticationFailed)}},onMutate:()=>{g({type:"started",method:"email_password",mode:C?"sign_up":"sign_in"})},onSuccess:()=>{g({type:"succeeded",method:"email_password",mode:C?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),d.onAuthenticated(r??e)},onError:s=>{g({type:"failed",method:"email_password",mode:C?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),$(C?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),ne=ae({mutationFn:async({email:s})=>{const o=await d.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(o.error)throw new Error(o.error.message||n.resetEmailFailed);return o},onSuccess:()=>{$("password_reset_requested"),ye(!0)},onError:s=>{$("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),K=ae({mutationFn:async({email:s})=>{const o=await d.sendOtp({email:s});if(o.error)throw new Error(o.error.message||n.otpSendFailed);return o},onMutate:()=>{g({type:"started",method:"email_otp"})},onSuccess:()=>{g({type:"otp_sent",method:"email_otp"}),$("email_otp_sent"),ue(!0)},onError:s=>{g({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),$("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),Y=ae({mutationFn:async({email:s,otp:o})=>{const D=await d.submitOtp({email:s,otp:o});if(D.error)throw new Error(D.error.message||n.invalidCode);return D},onMutate:()=>{g({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{g({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),d.onAuthenticated(r??e)},onError:s=>{g({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),$("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),ie=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),fe=()=>{b.trim()&&!ie(b)&&Q(n.invalidEmail)},Te=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail),g({type:"failed",method:"email_password",mode:C?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}se.mutate({email:b,password:_,name:a})},Re=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail);return}ne.mutate({email:b})},De=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail),g({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}K.mutate({email:b})},Me=s=>{s.preventDefault(),Y.mutate({email:b,otp:q})},G=s=>o=>{s(o.target.value),Se&&se.reset(),je&&ne.reset(),Ne&&(K.reset(),Y.reset()),s===M&&k&&Q("")},re=s=>{Le(s),S(""),T(""),ue(!1),Q(""),ye(!1),he(null),se.reset(),ne.reset(),K.reset(),Y.reset()},w=se.isPending||ne.isPending||K.isPending||Y.isPending,Se=se.error,je=ne.error,Ne=K.error||Y.error,U=C?b.trim()&&_.trim()&&a.trim():W?b.trim():R?L?q.trim():b.trim():b.trim()&&_.trim(),qe=s=>{if(!s)return null;const o=s.message.toLowerCase();return o.includes("unauthorized")||o.includes("401")?n.invalidEmailOrPassword:o.includes("already exists")||o.includes("409")?n.accountExists:o.includes("network")||o.includes("fetch")?n.networkError:o.includes("rate limit")||o.includes("429")?n.tooManyAttempts:o.includes("invalid")&&o.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},Pe=Se||je||Ne||Oe,We=async s=>{g({type:"started",method:"social",provider:s}),he(null);try{const o=await d.socialSignIn({provider:s,callbackURL:r??e});if(o.error)throw new Error(o.error.message||n.authenticationFailed)}catch(o){const D=o instanceof Error?o.message:String(o);g({type:"failed",method:"social",provider:s,stage:"redirect",error:D}),$("social_signin_failed",{provider:s,error:D}),he(o instanceof Error?o:new Error(D))}},Ue=W?n.resetPasswordTitle:R&&L?n.verificationCodeTitle:c??n.welcomeTitle,Ae=W?n.resetPasswordSubtitle:R&&L?n.codeSentTo(b):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:j("grid w-full",P?"gap-5":"gap-10"),children:[p??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:j("font-medium",P?"text-xl leading-7":"text-2xl leading-8"),children:Ue}),Ae&&t.jsx("p",{className:j("text-muted-foreground",P?"text-sm leading-5":"text-base leading-6"),children:Ae})]}),Pe&&t.jsx("div",{role:"alert",className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:qe(Pe)}),be&&t.jsx("div",{role:"status",className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!W&&!(R&&L)&&O&&t.jsx("div",{className:"grid gap-2",children:x.map(s=>t.jsxs("button",{type:"button",disabled:w,onClick:()=>{We(s.name)},className:j("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",P?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:j("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!W&&!(R&&L)&&O&&(F||E.enabled)&&t.jsxs("div",{className:j("flex items-center gap-2.5",P?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:j("text-muted-foreground",P?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),R&&E.enabled&&t.jsx(t.Fragment,{children:L?t.jsxs("form",{onSubmit:Me,className:j("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:Ee,className:j("text-sm font-medium text-foreground",P&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(X,{id:Ee,type:"text",placeholder:n.enterCodePlaceholder,value:q,onChange:G(T),required:!0,disabled:w,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:w||!U,className:j("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",P?"h-11 sm:w-auto":"h-12 w-full"),children:w?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{ue(!1),T(""),K.reset(),Y.reset()},disabled:w,className:j("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",P&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:De,className:j("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:z,className:j("text-sm font-medium text-foreground",P&&"sr-only"),children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:n.emailPlaceholder,value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive",children:k})]}),t.jsx("button",{type:"submit",disabled:w||!U,className:j("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",P?"h-11 sm:w-auto":"h-12 w-full"),children:w?n.sending:n.sendCode})]})}),W&&F&&!be&&t.jsxs("form",{onSubmit:Re,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:z,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:"you@example.com",value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive mt-1.5",children:k})]}),t.jsx(pe,{type:"submit",disabled:w||!U,className:"w-full font-semibold",size:"xl",children:w?n.sending:n.sendResetLink})]}),!W&&!R&&F&&t.jsxs("form",{onSubmit:Te,className:"grid gap-5",children:[C&&t.jsxs("div",{children:[t.jsx("label",{htmlFor:ve,className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(X,{id:ve,type:"text",placeholder:n.namePlaceholder,value:a,onChange:G(S),required:!0,disabled:w,autoComplete:"name",className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:z,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:"you@example.com",value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive mt-1.5",children:k})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{htmlFor:we,className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!C&&v.enabled&&t.jsx("button",{type:"button",onClick:()=>re("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(X,{id:we,type:"password",placeholder:"••••••••",value:_,onChange:G(V),required:!0,disabled:w,autoComplete:C?"new-password":"current-password",className:"h-11 rounded-lg"})]}),t.jsx("div",{className:j("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",U?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:j("p-1",!U&&"pointer-events-none"),children:t.jsx(pe,{type:"submit",disabled:w||!U,className:j("w-full font-semibold"),size:"xl","aria-hidden":!U,children:w?C?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:W?t.jsx("button",{type:"button",onClick:()=>re("signIn"),disabled:w,className:le,children:n.backToSignIn}):R&&F?t.jsx("button",{type:"button",onClick:()=>re("signIn"),disabled:w,className:le,children:n.signInWithPassword}):!R&&F?t.jsxs(t.Fragment,{children:[C?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>re(C?"signIn":"signUp"),disabled:w,className:le,children:C?n.signIn:n.signUp}),E.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>re("emailOtp"),disabled:w,className:le,children:n.signInWithEmailCode})]})]}):null})]})}async function de(){throw new Error("Tauri bridge is unavailable outside the desktop build")}function Ge(){const r=Be(),e=Ve(),c=$e({queryKey:oe.desktopAuthStatus(),queryFn:async()=>(await de()).fetchAuthStatus(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0}),[f,p]=y.useState(!1),[m,i]=y.useState(null),[l,u]=y.useState(!1),[I,N]=y.useState(null);y.useEffect(()=>{},[e,r]);async function A(){p(!0),i(null);try{const d=await de();await d.performAuthLogin();const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}catch(d){i(d instanceof Error?d.message:"Sign-in failed")}finally{p(!1)}}async function v(){p(!0);try{const d=await de();await d.performAuthLogout();const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}finally{p(!1)}}async function E(){u(!0),N(null);let d;try{d=await de()}catch(g){N(g instanceof Error?g.message:"Sign-in failed"),u(!1);return}try{await d.performAuthCompleteSession()}catch(g){N(g instanceof Error?g.message:"Sign-in failed")}finally{try{const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}finally{u(!1)}}}async function h(){await c.refetch()}return{status:c.data,isChecking:c.isLoading,isRetryingStatus:c.isFetching,isPending:f,loginError:m,login:A,logout:v,isCompletingSession:l,completeSessionError:I,completeSession:E,retryStatus:h}}function Je(r){return!(r.emailAndPassword.enabled||r.emailOtp.enabled||r.socialProviders.enabled)&&!r.sso.enabled&&r.magicLink.enabled}function Xe(){return ce.c(10),Ge(),null}function Ze(r){const e=ce.c(25),{onContinue:c,isPending:f,error:p}=r,m=xe();let i;e[0]!==m?(i=m("common.authEntry.browserOnlyTitle"),e[0]=m,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx("h1",{className:"text-lg font-medium text-foreground",children:i}),e[2]=i,e[3]=l):l=e[3];let u;e[4]!==m?(u=m("common.authEntry.browserOnlyDescription"),e[4]=m,e[5]=u):u=e[5];let I;e[6]!==u?(I=t.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:u}),e[6]=u,e[7]=I):I=e[7];let N;e[8]!==l||e[9]!==I?(N=t.jsxs("div",{className:"flex flex-col gap-1",children:[l,I]}),e[8]=l,e[9]=I,e[10]=N):N=e[10];let A;e[11]!==c?(A=()=>{c()},e[11]=c,e[12]=A):A=e[12];let v;e[13]!==m?(v=m("common.authEntry.browserOnlyCta"),e[13]=m,e[14]=v):v=e[14];let E;e[15]!==f||e[16]!==A||e[17]!==v?(E=t.jsx(pe,{onClick:A,disabled:f,children:v}),e[15]=f,e[16]=A,e[17]=v,e[18]=E):E=e[18];let h;e[19]!==p?(h=p&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:p}),e[19]=p,e[20]=h):h=e[20];let d;return e[21]!==N||e[22]!==E||e[23]!==h?(d=t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[N,E,h]}),e[21]=N,e[22]=E,e[23]=h,e[24]=d):d=e[24],d}function Ce(r){const e=ce.c(8),{label:c,error:f}=r;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Qe,{size:"lg"}),e[0]=p):p=e[0];let m;e[1]!==c?(m=c&&t.jsx("p",{className:"text-sm text-muted-foreground",children:c}),e[1]=c,e[2]=m):m=e[2];let i;e[3]!==f?(i=f&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:f}),e[3]=f,e[4]=i):i=e[4];let l;return e[5]!==m||e[6]!==i?(l=t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,m,i]}),e[5]=m,e[6]=i,e[7]=l):l=e[7],l}class Ie{constructor(e){this.response=e}response}function et(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function tt({redirectTo:r,onAuthEvent:e}){const c=xe(),[f,p]=y.useState(null),m=y.useEffectEvent(i=>{try{e?.(i)}catch{}});return y.useEffect(()=>{let i=!1;return(async()=>{m({type:"started",method:"local"});try{let l;try{l=await ze(async()=>{const u=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(u.status>=500)throw new Ie(u);return u},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(u){if(u instanceof He&&u.cause instanceof Ie)l=u.cause.response;else throw u}if(!l.ok){const u=await l.json().catch(()=>({}));throw new Error(u?.error||c("common.authEntry.autoLoginFailed"))}i||(m({type:"succeeded",method:"local"}),window.location.href=et(r))}catch(l){i||(m({type:"failed",method:"local",stage:"authenticate",error:l instanceof Error?l.message:String(l)}),p(l instanceof Error?l.message:c("common.authEntry.autoLoginFailed")))}})(),()=>{i=!0}},[r]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:c("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:c("common.authEntry.tryRestartingServer")})]})}):t.jsx(Fe,{})}function st({callbackURL:r,providerId:e,ssoSignIn:c,onAuthEvent:f}){const p=y.useEffectEvent(i=>{try{f?.(i)}catch{}}),m=y.useEffectEvent(c);return y.useEffect(()=>{(async()=>{p({type:"started",method:"sso",provider:e});try{const i=await m({providerId:e,callbackURL:r});if(i.error)throw new Error(i.error.message||"SSO redirect failed")}catch(i){p({type:"failed",method:"sso",provider:e,stage:"redirect",error:i instanceof Error?i.message:String(i)})}})()},[e,r]),t.jsx(Fe,{})}function lt(r){const e=ce.c(45),{callbackUrl:c,redirectUrl:f,allowAutoLogin:p,title:m,subtitle:i,brand:l,copy:u,variant:I,allowedSocialProviders:N,allowPassword:A,onAuthEvent:v}=r,E=p===void 0?!0:p,h=xe(),{sso:d,emailAndPassword:g,magicLink:P,emailOtp:Z,socialProviders:ee,localMode:me}=ke(),x=Xe(),O=f||c,F=x?.actions;let b;e[0]!==F?(b={..._e,...F},e[0]=F,e[1]=b):b=e[1];const M=b;if(x?.isPending){let a;e[2]!==h?(a=h("common.authEntry.finishSignInInBrowser"),e[2]=h,e[3]=a):a=e[3];let S;return e[4]!==x.loginError||e[5]!==a?(S=t.jsx(Ce,{label:a,error:x.loginError}),e[4]=x.loginError,e[5]=a,e[6]=S):S=e[6],S}if(x?.isCompletingSession){let a;e[7]!==h?(a=h("common.authEntry.finishingSignIn"),e[7]=h,e[8]=a):a=e[8];let S;return e[9]!==x.completeSessionError||e[10]!==a?(S=t.jsx(Ce,{label:a,error:x.completeSessionError}),e[9]=x.completeSessionError,e[10]=a,e[11]=S):S=e[11],S}if(me&&E){let a;return e[12]!==v||e[13]!==O?(a=t.jsx(tt,{redirectTo:O,onAuthEvent:v}),e[12]=v,e[13]=O,e[14]=a):a=e[14],a}if(d.enabled){let a;return e[15]!==v||e[16]!==O||e[17]!==M.ssoSignIn||e[18]!==d.providerId?(a=t.jsx(st,{callbackURL:O,providerId:d.providerId,ssoSignIn:M.ssoSignIn,onAuthEvent:v}),e[15]=v,e[16]=O,e[17]=M.ssoSignIn,e[18]=d.providerId,e[19]=a):a=e[19],a}if(x&&Je({emailAndPassword:g,emailOtp:Z,socialProviders:ee,magicLink:P,sso:d})){let a;return e[20]!==x.isPending||e[21]!==x.login||e[22]!==x.loginError?(a=t.jsx(Ze,{onContinue:x.login,isPending:x.isPending,error:x.loginError}),e[20]=x.isPending,e[21]=x.login,e[22]=x.loginError,e[23]=a):a=e[23],a}if(g.enabled||P.enabled||Z.enabled||ee.enabled){const a=x?.loginError??x?.completeSessionError??null;let S;e[24]!==A||e[25]!==N||e[26]!==l||e[27]!==c||e[28]!==u||e[29]!==v||e[30]!==F||e[31]!==f||e[32]!==i||e[33]!==m||e[34]!==I?(S=t.jsx(Ye,{redirectUrl:f,callbackUrl:c,title:m,subtitle:i,brand:l,copy:u,variant:I,allowedSocialProviders:N,allowPassword:A,onAuthEvent:v,actions:F}),e[24]=A,e[25]=N,e[26]=l,e[27]=c,e[28]=u,e[29]=v,e[30]=F,e[31]=f,e[32]=i,e[33]=m,e[34]=I,e[35]=S):S=e[35];const q=S;if(!a)return q;let T;e[36]!==a?(T=t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:a}),e[36]=a,e[37]=T):T=e[37];let L;return e[38]!==q||e[39]!==T?(L=t.jsxs("div",{className:"grid gap-4",children:[T,q]}),e[38]=q,e[39]=T,e[40]=L):L=e[40],L}let _;e[41]!==h?(_=h("common.authEntry.noLoginOptions"),e[41]=h,e[42]=_):_=e[42];let V;return e[43]!==_?(V=t.jsx("div",{children:_}),e[43]=_,e[44]=V):V=e[44],V}export{lt as A,Ge as u};
1
+ import{a as B,D as ke,r as y,e as ae,p as $,j as t,m as j,B as pe,o as Be,n as $e,K as oe,c as ce,b as xe,S as Fe}from"./index-OFuIeWBU.js";import{I as X}from"./input-D6HGf9aQ.js";import{i as Ve}from"./use-is-desktop-app-BNujXJc_.js";import{S as Qe}from"./spinner-BULrncM1.js";import{r as ze,R as He}from"./retry-CErkP7V6.js";const _e={submitEmailPassword:({mode:r,email:e,password:c,name:f})=>r==="sign_up"?B.signUp.email({email:e,password:c,name:f||""}):B.signIn.email({email:e,password:c}),requestPasswordReset:({email:r,redirectTo:e})=>B.requestPasswordReset({email:r,redirectTo:e}),sendOtp:({email:r})=>B.emailOtp.sendVerificationOtp({email:r,type:"sign-in"}),submitOtp:({email:r,otp:e})=>B.signIn.emailOtp({email:r,otp:e}),socialSignIn:({provider:r,callbackURL:e})=>B.signIn.social({provider:r,callbackURL:e}),ssoSignIn:({providerId:r,callbackURL:e})=>B.signIn.sso({providerId:r,callbackURL:e}),onAuthenticated:r=>{window.location.href=r}},le="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ke={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 Ye({redirectUrl:r,callbackUrl:e="/",title:c,subtitle:f,brand:p,copy:m,variant:i="default",allowedSocialProviders:l,allowPassword:u=!0,onAuthEvent:I,actions:N}){const{emailAndPassword:A,resetPassword:v,emailOtp:E,socialProviders:h}=ke(),d={..._e,...N},g=s=>{try{I?.(s)}catch{}},P=i==="compact",Z=l?h.providers.filter(s=>l.includes(s.name)):h.providers,ee=h.enabled&&Z.length>0,me=A.enabled&&(u||!E.enabled&&!ee),x=h.enabled&&h.providers.length>0&&!ee&&!E.enabled&&!me?h.providers:Z,O=h.enabled&&x.length>0,F=A.enabled&&(u||!E.enabled&&!O),[b,M]=y.useState(""),[_,V]=y.useState(""),[a,S]=y.useState(""),[q,T]=y.useState(""),[L,ue]=y.useState(!1),[ge,Le]=y.useState(()=>E.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[k,Q]=y.useState(""),[be,ye]=y.useState(!1),[Oe,he]=y.useState(null),n={...Ke,...m},te=y.useId(),z=`${te}-email`,H=`${te}-email-error`,ve=`${te}-name`,we=`${te}-password`,Ee=`${te}-otp`,C=ge==="signUp",W=ge==="forgotPassword",R=ge==="emailOtp",se=ae({mutationFn:async({email:s,password:o,name:D})=>{try{const J=await d.submitEmailPassword({mode:C?"sign_up":"sign_in",email:s,password:o,name:D});if(J.error)throw new Error(J.error.message||(C?n.signUpFailed:n.signInFailed));return J}catch(J){throw J instanceof Error?J:new Error(n.authenticationFailed)}},onMutate:()=>{g({type:"started",method:"email_password",mode:C?"sign_up":"sign_in"})},onSuccess:()=>{g({type:"succeeded",method:"email_password",mode:C?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),d.onAuthenticated(r??e)},onError:s=>{g({type:"failed",method:"email_password",mode:C?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),$(C?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),ne=ae({mutationFn:async({email:s})=>{const o=await d.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(o.error)throw new Error(o.error.message||n.resetEmailFailed);return o},onSuccess:()=>{$("password_reset_requested"),ye(!0)},onError:s=>{$("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),K=ae({mutationFn:async({email:s})=>{const o=await d.sendOtp({email:s});if(o.error)throw new Error(o.error.message||n.otpSendFailed);return o},onMutate:()=>{g({type:"started",method:"email_otp"})},onSuccess:()=>{g({type:"otp_sent",method:"email_otp"}),$("email_otp_sent"),ue(!0)},onError:s=>{g({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),$("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),Y=ae({mutationFn:async({email:s,otp:o})=>{const D=await d.submitOtp({email:s,otp:o});if(D.error)throw new Error(D.error.message||n.invalidCode);return D},onMutate:()=>{g({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{g({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),d.onAuthenticated(r??e)},onError:s=>{g({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),$("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),ie=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),fe=()=>{b.trim()&&!ie(b)&&Q(n.invalidEmail)},Te=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail),g({type:"failed",method:"email_password",mode:C?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}se.mutate({email:b,password:_,name:a})},Re=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail);return}ne.mutate({email:b})},De=s=>{if(s.preventDefault(),!ie(b)){Q(n.invalidEmail),g({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}K.mutate({email:b})},Me=s=>{s.preventDefault(),Y.mutate({email:b,otp:q})},G=s=>o=>{s(o.target.value),Se&&se.reset(),je&&ne.reset(),Ne&&(K.reset(),Y.reset()),s===M&&k&&Q("")},re=s=>{Le(s),S(""),T(""),ue(!1),Q(""),ye(!1),he(null),se.reset(),ne.reset(),K.reset(),Y.reset()},w=se.isPending||ne.isPending||K.isPending||Y.isPending,Se=se.error,je=ne.error,Ne=K.error||Y.error,U=C?b.trim()&&_.trim()&&a.trim():W?b.trim():R?L?q.trim():b.trim():b.trim()&&_.trim(),qe=s=>{if(!s)return null;const o=s.message.toLowerCase();return o.includes("unauthorized")||o.includes("401")?n.invalidEmailOrPassword:o.includes("already exists")||o.includes("409")?n.accountExists:o.includes("network")||o.includes("fetch")?n.networkError:o.includes("rate limit")||o.includes("429")?n.tooManyAttempts:o.includes("invalid")&&o.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},Pe=Se||je||Ne||Oe,We=async s=>{g({type:"started",method:"social",provider:s}),he(null);try{const o=await d.socialSignIn({provider:s,callbackURL:r??e});if(o.error)throw new Error(o.error.message||n.authenticationFailed)}catch(o){const D=o instanceof Error?o.message:String(o);g({type:"failed",method:"social",provider:s,stage:"redirect",error:D}),$("social_signin_failed",{provider:s,error:D}),he(o instanceof Error?o:new Error(D))}},Ue=W?n.resetPasswordTitle:R&&L?n.verificationCodeTitle:c??n.welcomeTitle,Ae=W?n.resetPasswordSubtitle:R&&L?n.codeSentTo(b):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:j("grid w-full",P?"gap-5":"gap-10"),children:[p??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:j("font-medium",P?"text-xl leading-7":"text-2xl leading-8"),children:Ue}),Ae&&t.jsx("p",{className:j("text-muted-foreground",P?"text-sm leading-5":"text-base leading-6"),children:Ae})]}),Pe&&t.jsx("div",{role:"alert",className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:qe(Pe)}),be&&t.jsx("div",{role:"status",className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!W&&!(R&&L)&&O&&t.jsx("div",{className:"grid gap-2",children:x.map(s=>t.jsxs("button",{type:"button",disabled:w,onClick:()=>{We(s.name)},className:j("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",P?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:j("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!W&&!(R&&L)&&O&&(F||E.enabled)&&t.jsxs("div",{className:j("flex items-center gap-2.5",P?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:j("text-muted-foreground",P?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),R&&E.enabled&&t.jsx(t.Fragment,{children:L?t.jsxs("form",{onSubmit:Me,className:j("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:Ee,className:j("text-sm font-medium text-foreground",P&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(X,{id:Ee,type:"text",placeholder:n.enterCodePlaceholder,value:q,onChange:G(T),required:!0,disabled:w,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:w||!U,className:j("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",P?"h-11 sm:w-auto":"h-12 w-full"),children:w?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{ue(!1),T(""),K.reset(),Y.reset()},disabled:w,className:j("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",P&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:De,className:j("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:z,className:j("text-sm font-medium text-foreground",P&&"sr-only"),children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:n.emailPlaceholder,value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive",children:k})]}),t.jsx("button",{type:"submit",disabled:w||!U,className:j("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",P?"h-11 sm:w-auto":"h-12 w-full"),children:w?n.sending:n.sendCode})]})}),W&&F&&!be&&t.jsxs("form",{onSubmit:Re,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:z,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:"you@example.com",value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive mt-1.5",children:k})]}),t.jsx(pe,{type:"submit",disabled:w||!U,className:"w-full font-semibold",size:"xl",children:w?n.sending:n.sendResetLink})]}),!W&&!R&&F&&t.jsxs("form",{onSubmit:Te,className:"grid gap-5",children:[C&&t.jsxs("div",{children:[t.jsx("label",{htmlFor:ve,className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(X,{id:ve,type:"text",placeholder:n.namePlaceholder,value:a,onChange:G(S),required:!0,disabled:w,autoComplete:"name",className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:z,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(X,{id:z,type:"email",placeholder:"you@example.com",value:b,onChange:G(M),onBlur:fe,required:!0,disabled:w,autoComplete:"email","aria-invalid":!!k,"aria-describedby":k?H:void 0,className:"h-11 rounded-lg"}),k&&t.jsx("p",{id:H,role:"alert",className:"text-xs text-destructive mt-1.5",children:k})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{htmlFor:we,className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!C&&v.enabled&&t.jsx("button",{type:"button",onClick:()=>re("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(X,{id:we,type:"password",placeholder:"••••••••",value:_,onChange:G(V),required:!0,disabled:w,autoComplete:C?"new-password":"current-password",className:"h-11 rounded-lg"})]}),t.jsx("div",{className:j("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",U?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:j("p-1",!U&&"pointer-events-none"),children:t.jsx(pe,{type:"submit",disabled:w||!U,className:j("w-full font-semibold"),size:"xl","aria-hidden":!U,children:w?C?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:W?t.jsx("button",{type:"button",onClick:()=>re("signIn"),disabled:w,className:le,children:n.backToSignIn}):R&&F?t.jsx("button",{type:"button",onClick:()=>re("signIn"),disabled:w,className:le,children:n.signInWithPassword}):!R&&F?t.jsxs(t.Fragment,{children:[C?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>re(C?"signIn":"signUp"),disabled:w,className:le,children:C?n.signIn:n.signUp}),E.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>re("emailOtp"),disabled:w,className:le,children:n.signInWithEmailCode})]})]}):null})]})}async function de(){throw new Error("Tauri bridge is unavailable outside the desktop build")}function Ge(){const r=Be(),e=Ve(),c=$e({queryKey:oe.desktopAuthStatus(),queryFn:async()=>(await de()).fetchAuthStatus(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0}),[f,p]=y.useState(!1),[m,i]=y.useState(null),[l,u]=y.useState(!1),[I,N]=y.useState(null);y.useEffect(()=>{},[e,r]);async function A(){p(!0),i(null);try{const d=await de();await d.performAuthLogin();const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}catch(d){i(d instanceof Error?d.message:"Sign-in failed")}finally{p(!1)}}async function v(){p(!0);try{const d=await de();await d.performAuthLogout();const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}finally{p(!1)}}async function E(){u(!0),N(null);let d;try{d=await de()}catch(g){N(g instanceof Error?g.message:"Sign-in failed"),u(!1);return}try{await d.performAuthCompleteSession()}catch(g){N(g instanceof Error?g.message:"Sign-in failed")}finally{try{const g=await d.fetchAuthStatus();r.setQueryData(oe.desktopAuthStatus(),g)}finally{u(!1)}}}async function h(){await c.refetch()}return{status:c.data,isChecking:c.isLoading,isRetryingStatus:c.isFetching,isPending:f,loginError:m,login:A,logout:v,isCompletingSession:l,completeSessionError:I,completeSession:E,retryStatus:h}}function Je(r){return!(r.emailAndPassword.enabled||r.emailOtp.enabled||r.socialProviders.enabled)&&!r.sso.enabled&&r.magicLink.enabled}function Xe(){return ce.c(10),Ge(),null}function Ze(r){const e=ce.c(25),{onContinue:c,isPending:f,error:p}=r,m=xe();let i;e[0]!==m?(i=m("common.authEntry.browserOnlyTitle"),e[0]=m,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx("h1",{className:"text-lg font-medium text-foreground",children:i}),e[2]=i,e[3]=l):l=e[3];let u;e[4]!==m?(u=m("common.authEntry.browserOnlyDescription"),e[4]=m,e[5]=u):u=e[5];let I;e[6]!==u?(I=t.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:u}),e[6]=u,e[7]=I):I=e[7];let N;e[8]!==l||e[9]!==I?(N=t.jsxs("div",{className:"flex flex-col gap-1",children:[l,I]}),e[8]=l,e[9]=I,e[10]=N):N=e[10];let A;e[11]!==c?(A=()=>{c()},e[11]=c,e[12]=A):A=e[12];let v;e[13]!==m?(v=m("common.authEntry.browserOnlyCta"),e[13]=m,e[14]=v):v=e[14];let E;e[15]!==f||e[16]!==A||e[17]!==v?(E=t.jsx(pe,{onClick:A,disabled:f,children:v}),e[15]=f,e[16]=A,e[17]=v,e[18]=E):E=e[18];let h;e[19]!==p?(h=p&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:p}),e[19]=p,e[20]=h):h=e[20];let d;return e[21]!==N||e[22]!==E||e[23]!==h?(d=t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[N,E,h]}),e[21]=N,e[22]=E,e[23]=h,e[24]=d):d=e[24],d}function Ce(r){const e=ce.c(8),{label:c,error:f}=r;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Qe,{size:"lg"}),e[0]=p):p=e[0];let m;e[1]!==c?(m=c&&t.jsx("p",{className:"text-sm text-muted-foreground",children:c}),e[1]=c,e[2]=m):m=e[2];let i;e[3]!==f?(i=f&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:f}),e[3]=f,e[4]=i):i=e[4];let l;return e[5]!==m||e[6]!==i?(l=t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,m,i]}),e[5]=m,e[6]=i,e[7]=l):l=e[7],l}class Ie{constructor(e){this.response=e}response}function et(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function tt({redirectTo:r,onAuthEvent:e}){const c=xe(),[f,p]=y.useState(null),m=y.useEffectEvent(i=>{try{e?.(i)}catch{}});return y.useEffect(()=>{let i=!1;return(async()=>{m({type:"started",method:"local"});try{let l;try{l=await ze(async()=>{const u=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(u.status>=500)throw new Ie(u);return u},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(u){if(u instanceof He&&u.cause instanceof Ie)l=u.cause.response;else throw u}if(!l.ok){const u=await l.json().catch(()=>({}));throw new Error(u?.error||c("common.authEntry.autoLoginFailed"))}i||(m({type:"succeeded",method:"local"}),window.location.href=et(r))}catch(l){i||(m({type:"failed",method:"local",stage:"authenticate",error:l instanceof Error?l.message:String(l)}),p(l instanceof Error?l.message:c("common.authEntry.autoLoginFailed")))}})(),()=>{i=!0}},[r]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:c("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:c("common.authEntry.tryRestartingServer")})]})}):t.jsx(Fe,{})}function st({callbackURL:r,providerId:e,ssoSignIn:c,onAuthEvent:f}){const p=y.useEffectEvent(i=>{try{f?.(i)}catch{}}),m=y.useEffectEvent(c);return y.useEffect(()=>{(async()=>{p({type:"started",method:"sso",provider:e});try{const i=await m({providerId:e,callbackURL:r});if(i.error)throw new Error(i.error.message||"SSO redirect failed")}catch(i){p({type:"failed",method:"sso",provider:e,stage:"redirect",error:i instanceof Error?i.message:String(i)})}})()},[e,r]),t.jsx(Fe,{})}function lt(r){const e=ce.c(45),{callbackUrl:c,redirectUrl:f,allowAutoLogin:p,title:m,subtitle:i,brand:l,copy:u,variant:I,allowedSocialProviders:N,allowPassword:A,onAuthEvent:v}=r,E=p===void 0?!0:p,h=xe(),{sso:d,emailAndPassword:g,magicLink:P,emailOtp:Z,socialProviders:ee,localMode:me}=ke(),x=Xe(),O=f||c,F=x?.actions;let b;e[0]!==F?(b={..._e,...F},e[0]=F,e[1]=b):b=e[1];const M=b;if(x?.isPending){let a;e[2]!==h?(a=h("common.authEntry.finishSignInInBrowser"),e[2]=h,e[3]=a):a=e[3];let S;return e[4]!==x.loginError||e[5]!==a?(S=t.jsx(Ce,{label:a,error:x.loginError}),e[4]=x.loginError,e[5]=a,e[6]=S):S=e[6],S}if(x?.isCompletingSession){let a;e[7]!==h?(a=h("common.authEntry.finishingSignIn"),e[7]=h,e[8]=a):a=e[8];let S;return e[9]!==x.completeSessionError||e[10]!==a?(S=t.jsx(Ce,{label:a,error:x.completeSessionError}),e[9]=x.completeSessionError,e[10]=a,e[11]=S):S=e[11],S}if(me&&E){let a;return e[12]!==v||e[13]!==O?(a=t.jsx(tt,{redirectTo:O,onAuthEvent:v}),e[12]=v,e[13]=O,e[14]=a):a=e[14],a}if(d.enabled){let a;return e[15]!==v||e[16]!==O||e[17]!==M.ssoSignIn||e[18]!==d.providerId?(a=t.jsx(st,{callbackURL:O,providerId:d.providerId,ssoSignIn:M.ssoSignIn,onAuthEvent:v}),e[15]=v,e[16]=O,e[17]=M.ssoSignIn,e[18]=d.providerId,e[19]=a):a=e[19],a}if(x&&Je({emailAndPassword:g,emailOtp:Z,socialProviders:ee,magicLink:P,sso:d})){let a;return e[20]!==x.isPending||e[21]!==x.login||e[22]!==x.loginError?(a=t.jsx(Ze,{onContinue:x.login,isPending:x.isPending,error:x.loginError}),e[20]=x.isPending,e[21]=x.login,e[22]=x.loginError,e[23]=a):a=e[23],a}if(g.enabled||P.enabled||Z.enabled||ee.enabled){const a=x?.loginError??x?.completeSessionError??null;let S;e[24]!==A||e[25]!==N||e[26]!==l||e[27]!==c||e[28]!==u||e[29]!==v||e[30]!==F||e[31]!==f||e[32]!==i||e[33]!==m||e[34]!==I?(S=t.jsx(Ye,{redirectUrl:f,callbackUrl:c,title:m,subtitle:i,brand:l,copy:u,variant:I,allowedSocialProviders:N,allowPassword:A,onAuthEvent:v,actions:F}),e[24]=A,e[25]=N,e[26]=l,e[27]=c,e[28]=u,e[29]=v,e[30]=F,e[31]=f,e[32]=i,e[33]=m,e[34]=I,e[35]=S):S=e[35];const q=S;if(!a)return q;let T;e[36]!==a?(T=t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:a}),e[36]=a,e[37]=T):T=e[37];let L;return e[38]!==q||e[39]!==T?(L=t.jsxs("div",{className:"grid gap-4",children:[T,q]}),e[38]=q,e[39]=T,e[40]=L):L=e[40],L}let _;e[41]!==h?(_=h("common.authEntry.noLoginOptions"),e[41]=h,e[42]=_):_=e[42];let V;return e[43]!==_?(V=t.jsx("div",{children:_}),e[43]=_,e[44]=V):V=e[44],V}export{lt as A,Ge as u};
@@ -1 +1 @@
1
- import{c as g,m as p,j as f}from"./index-CUEhhFkA.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,m as p,j as f}from"./index-OFuIeWBU.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-CUEhhFkA.js";import{i as u,a as p}from"./mcp-oauth-DQo8HdBy.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-OFuIeWBU.js";import{i as u,a as p}from"./mcp-oauth-DK9h3luZ.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 +1 @@
1
- import{c as G,b as J,r as U,m as W,j as t,B as X}from"./index-CUEhhFkA.js";import{c as Y,d as Z,b as ee,f as te,g as se,e as ie,a as ne,A as oe}from"./alert-dialog-DtzbrfY8.js";import{D as ae,c as re,b as le,a as ce}from"./dropdown-menu-BGosRkzl.js";import{s as me}from"./Stars02-ox6hLDxt.js";import{a as ue}from"./DotsVertical-CaKRcDmK.js";import{s as de}from"./Trash01-YaFSTgUX.js";import{i as fe}from"./Zap-C_Z0Pnr9.js";import{u as ge}from"./use-virtual-mcp-CRB2isTu.js";import{A as xe}from"./agent-icon-B9cL76D_.js";import{u as pe}from"./use-automations-kQIAo5Jm.js";function ke(c){const e=G.c(80),{automation:s,showAgent:a,onClick:n}=c,i=J(),{remove:o}=pe(),[l,O]=U.useState(!1),r=ge(a?s.virtual_mcp_id:void 0);let S;e[0]!==s.id||e[1]!==o?(S=()=>{o.mutate(s.id),O(!1)},e[0]=s.id,e[1]=o,e[2]=S):S=e[2];const I=S;let E;e[3]!==n?(E=m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n())},e[3]=n,e[4]=E):E=e[4];const H=E,V=s.active&&s.trigger_count>0?"bg-success":"bg-muted-foreground/40";let u;e[5]!==V?(u=W("inline-block size-2 rounded-full shrink-0",V),e[5]=V,e[6]=u):u=e[6];const q=s.active&&s.trigger_count>0?"automations.automationListRow.ariaActive":s.active?"automations.automationListRow.ariaNoTriggers":"automations.automationListRow.ariaPaused";let d;e[7]!==i||e[8]!==q?(d=i(q),e[7]=i,e[8]=q,e[9]=d):d=e[9];let f;e[10]!==u||e[11]!==d?(f=t.jsx("span",{className:u,"aria-label":d}),e[10]=u,e[11]=d,e[12]=f):f=e[12];let g;e[13]!==r?.icon||e[14]!==r?.title||e[15]!==s.name||e[16]!==a?(g=a&&t.jsx(xe,{icon:r?.icon??null,name:r?.title??s.name,size:"xs",className:"shrink-0"}),e[13]=r?.icon,e[14]=r?.title,e[15]=s.name,e[16]=a,e[17]=g):g=e[17];let x;e[18]!==s.name?(x=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.name}),e[18]=s.name,e[19]=x):x=e[19];let p;e[20]!==r||e[21]!==a?(p=a&&r&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["· ",r.title]}),e[20]=r,e[21]=a,e[22]=p):p=e[22];let h;e[23]!==p||e[24]!==x?(h=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[x,p]}),e[23]=p,e[24]=x,e[25]=h):h=e[25];let j;e[26]!==s.nearest_next_run_at||e[27]!==s.trigger_count?(j=t.jsx(we,{triggerCount:s.trigger_count,nextRunAt:s.nearest_next_run_at}),e[26]=s.nearest_next_run_at,e[27]=s.trigger_count,e[28]=j):j=e[28];let w;e[29]!==h||e[30]!==j?(w=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[h,j]}),e[29]=h,e[30]=j,e[31]=w):w=e[31];let F;e[32]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ae,{asChild:!0,children:t.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:t.jsx(ue,{size:16})})}),e[32]=F):F=e[32];let $,B;e[33]===Symbol.for("react.memo_cache_sentinel")?($=m=>{m.stopPropagation(),O(!0)},B=t.jsx(de,{size:16}),e[33]=$,e[34]=B):($=e[33],B=e[34]);let v;e[35]!==i?(v=i("automations.automationListRow.delete"),e[35]=i,e[36]=v):v=e[36];let _;e[37]!==v?(_=t.jsx("div",{onClick:je,onKeyDown:he,role:"presentation",className:"shrink-0",children:t.jsxs(re,{children:[F,t.jsx(le,{align:"end",children:t.jsxs(ce,{variant:"destructive",onClick:$,children:[B,v]})})]})}),e[37]=v,e[38]=_):_=e[38];let b;e[39]!==H||e[40]!==n||e[41]!==w||e[42]!==_||e[43]!==f||e[44]!==g?(b=t.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:H,className:"group w-full flex items-center gap-3 px-4 py-3 border-b border-border text-left hover:bg-muted/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[f,g,w,_]}),e[39]=H,e[40]=n,e[41]=w,e[42]=_,e[43]=f,e[44]=g,e[45]=b):b=e[45];let A;e[46]!==i?(A=i("automations.automationListRow.deleteTitle"),e[46]=i,e[47]=A):A=e[47];let D;e[48]!==A?(D=t.jsx(Y,{children:A}),e[48]=A,e[49]=D):D=e[49];let N;e[50]!==s.name||e[51]!==i?(N=i("automations.automationListRow.deleteDescription",{name:s.name}),e[50]=s.name,e[51]=i,e[52]=N):N=e[52];let R;e[53]!==N?(R=t.jsx(Z,{children:N}),e[53]=N,e[54]=R):R=e[54];let y;e[55]!==D||e[56]!==R?(y=t.jsxs(ee,{children:[D,R]}),e[55]=D,e[56]=R,e[57]=y):y=e[57];let C;e[58]!==i?(C=i("automations.automationListRow.cancel"),e[58]=i,e[59]=C):C=e[59];let L;e[60]!==C?(L=t.jsx(te,{children:C}),e[60]=C,e[61]=L):L=e[61];const Q=o.isPending;let k;e[62]!==i?(k=i("automations.automationListRow.deleteButton"),e[62]=i,e[63]=k):k=e[63];let P;e[64]!==I||e[65]!==o.isPending||e[66]!==k?(P=t.jsx(se,{onClick:I,disabled:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:k}),e[64]=I,e[65]=o.isPending,e[66]=k,e[67]=P):P=e[67];let T;e[68]!==L||e[69]!==P?(T=t.jsxs(ie,{children:[L,P]}),e[68]=L,e[69]=P,e[70]=T):T=e[70];let z;e[71]!==y||e[72]!==T?(z=t.jsxs(ne,{children:[y,T]}),e[71]=y,e[72]=T,e[73]=z):z=e[73];let M;e[74]!==l||e[75]!==z?(M=t.jsx(oe,{open:l,onOpenChange:O,children:z}),e[74]=l,e[75]=z,e[76]=M):M=e[76];let K;return e[77]!==b||e[78]!==M?(K=t.jsxs(t.Fragment,{children:[b,M]}),e[77]=b,e[78]=M,e[79]=K):K=e[79],K}function he(c){return c.stopPropagation()}function je(c){return c.stopPropagation()}function we(c){const e=G.c(8),{triggerCount:s,nextRunAt:a}=c,n=J();if(s===0){let o;e[0]!==n?(o=n("automations.automationListRow.noTriggers"),e[0]=n,e[1]=o):o=e[1];let l;return e[2]!==o?(l=t.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=l):l=e[3],l}let i;return e[4]!==a||e[5]!==n||e[6]!==s?(i=t.jsx("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground min-w-0",children:a?t.jsxs(t.Fragment,{children:[t.jsx(me,{size:12,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:n("automations.automationListRow.nextRun",{date:new Date(a).toLocaleString()})})]}):t.jsxs(t.Fragment,{children:[t.jsx(fe,{size:12,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:n("automations.automationListRow.triggers",{count:s})})]})}),e[4]=a,e[5]=n,e[6]=s,e[7]=i):i=e[7],i}export{ke as A};
1
+ import{c as G,b as J,r as U,m as W,j as t,B as X}from"./index-OFuIeWBU.js";import{c as Y,d as Z,b as ee,f as te,g as se,e as ie,a as ne,A as oe}from"./alert-dialog-BDUQxyT2.js";import{D as ae,c as re,b as le,a as ce}from"./dropdown-menu-BnENS1C8.js";import{s as me}from"./Stars02-m6J1J5js.js";import{a as ue}from"./DotsVertical-CmfEzLbI.js";import{s as de}from"./Trash01-KHaub8Lz.js";import{i as fe}from"./Zap-CC0qAKRq.js";import{u as ge}from"./use-virtual-mcp-ByPyGM47.js";import{A as xe}from"./agent-icon-D_nZ6mrh.js";import{u as pe}from"./use-automations-BJf24dYG.js";function ke(c){const e=G.c(80),{automation:s,showAgent:a,onClick:n}=c,i=J(),{remove:o}=pe(),[l,O]=U.useState(!1),r=ge(a?s.virtual_mcp_id:void 0);let S;e[0]!==s.id||e[1]!==o?(S=()=>{o.mutate(s.id),O(!1)},e[0]=s.id,e[1]=o,e[2]=S):S=e[2];const I=S;let E;e[3]!==n?(E=m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n())},e[3]=n,e[4]=E):E=e[4];const H=E,V=s.active&&s.trigger_count>0?"bg-success":"bg-muted-foreground/40";let u;e[5]!==V?(u=W("inline-block size-2 rounded-full shrink-0",V),e[5]=V,e[6]=u):u=e[6];const q=s.active&&s.trigger_count>0?"automations.automationListRow.ariaActive":s.active?"automations.automationListRow.ariaNoTriggers":"automations.automationListRow.ariaPaused";let d;e[7]!==i||e[8]!==q?(d=i(q),e[7]=i,e[8]=q,e[9]=d):d=e[9];let f;e[10]!==u||e[11]!==d?(f=t.jsx("span",{className:u,"aria-label":d}),e[10]=u,e[11]=d,e[12]=f):f=e[12];let g;e[13]!==r?.icon||e[14]!==r?.title||e[15]!==s.name||e[16]!==a?(g=a&&t.jsx(xe,{icon:r?.icon??null,name:r?.title??s.name,size:"xs",className:"shrink-0"}),e[13]=r?.icon,e[14]=r?.title,e[15]=s.name,e[16]=a,e[17]=g):g=e[17];let x;e[18]!==s.name?(x=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.name}),e[18]=s.name,e[19]=x):x=e[19];let p;e[20]!==r||e[21]!==a?(p=a&&r&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["· ",r.title]}),e[20]=r,e[21]=a,e[22]=p):p=e[22];let h;e[23]!==p||e[24]!==x?(h=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[x,p]}),e[23]=p,e[24]=x,e[25]=h):h=e[25];let j;e[26]!==s.nearest_next_run_at||e[27]!==s.trigger_count?(j=t.jsx(we,{triggerCount:s.trigger_count,nextRunAt:s.nearest_next_run_at}),e[26]=s.nearest_next_run_at,e[27]=s.trigger_count,e[28]=j):j=e[28];let w;e[29]!==h||e[30]!==j?(w=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[h,j]}),e[29]=h,e[30]=j,e[31]=w):w=e[31];let F;e[32]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ae,{asChild:!0,children:t.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:t.jsx(ue,{size:16})})}),e[32]=F):F=e[32];let $,B;e[33]===Symbol.for("react.memo_cache_sentinel")?($=m=>{m.stopPropagation(),O(!0)},B=t.jsx(de,{size:16}),e[33]=$,e[34]=B):($=e[33],B=e[34]);let v;e[35]!==i?(v=i("automations.automationListRow.delete"),e[35]=i,e[36]=v):v=e[36];let _;e[37]!==v?(_=t.jsx("div",{onClick:je,onKeyDown:he,role:"presentation",className:"shrink-0",children:t.jsxs(re,{children:[F,t.jsx(le,{align:"end",children:t.jsxs(ce,{variant:"destructive",onClick:$,children:[B,v]})})]})}),e[37]=v,e[38]=_):_=e[38];let b;e[39]!==H||e[40]!==n||e[41]!==w||e[42]!==_||e[43]!==f||e[44]!==g?(b=t.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:H,className:"group w-full flex items-center gap-3 px-4 py-3 border-b border-border text-left hover:bg-muted/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[f,g,w,_]}),e[39]=H,e[40]=n,e[41]=w,e[42]=_,e[43]=f,e[44]=g,e[45]=b):b=e[45];let A;e[46]!==i?(A=i("automations.automationListRow.deleteTitle"),e[46]=i,e[47]=A):A=e[47];let D;e[48]!==A?(D=t.jsx(Y,{children:A}),e[48]=A,e[49]=D):D=e[49];let N;e[50]!==s.name||e[51]!==i?(N=i("automations.automationListRow.deleteDescription",{name:s.name}),e[50]=s.name,e[51]=i,e[52]=N):N=e[52];let R;e[53]!==N?(R=t.jsx(Z,{children:N}),e[53]=N,e[54]=R):R=e[54];let y;e[55]!==D||e[56]!==R?(y=t.jsxs(ee,{children:[D,R]}),e[55]=D,e[56]=R,e[57]=y):y=e[57];let C;e[58]!==i?(C=i("automations.automationListRow.cancel"),e[58]=i,e[59]=C):C=e[59];let L;e[60]!==C?(L=t.jsx(te,{children:C}),e[60]=C,e[61]=L):L=e[61];const Q=o.isPending;let k;e[62]!==i?(k=i("automations.automationListRow.deleteButton"),e[62]=i,e[63]=k):k=e[63];let P;e[64]!==I||e[65]!==o.isPending||e[66]!==k?(P=t.jsx(se,{onClick:I,disabled:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:k}),e[64]=I,e[65]=o.isPending,e[66]=k,e[67]=P):P=e[67];let T;e[68]!==L||e[69]!==P?(T=t.jsxs(ie,{children:[L,P]}),e[68]=L,e[69]=P,e[70]=T):T=e[70];let z;e[71]!==y||e[72]!==T?(z=t.jsxs(ne,{children:[y,T]}),e[71]=y,e[72]=T,e[73]=z):z=e[73];let M;e[74]!==l||e[75]!==z?(M=t.jsx(oe,{open:l,onOpenChange:O,children:z}),e[74]=l,e[75]=z,e[76]=M):M=e[76];let K;return e[77]!==b||e[78]!==M?(K=t.jsxs(t.Fragment,{children:[b,M]}),e[77]=b,e[78]=M,e[79]=K):K=e[79],K}function he(c){return c.stopPropagation()}function je(c){return c.stopPropagation()}function we(c){const e=G.c(8),{triggerCount:s,nextRunAt:a}=c,n=J();if(s===0){let o;e[0]!==n?(o=n("automations.automationListRow.noTriggers"),e[0]=n,e[1]=o):o=e[1];let l;return e[2]!==o?(l=t.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=l):l=e[3],l}let i;return e[4]!==a||e[5]!==n||e[6]!==s?(i=t.jsx("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground min-w-0",children:a?t.jsxs(t.Fragment,{children:[t.jsx(me,{size:12,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:n("automations.automationListRow.nextRun",{date:new Date(a).toLocaleString()})})]}):t.jsxs(t.Fragment,{children:[t.jsx(fe,{size:12,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:n("automations.automationListRow.triggers",{count:s})})]})}),e[4]=a,e[5]=n,e[6]=s,e[7]=i):i=e[7],i}export{ke as A};