decocms 4.160.6 → 4.161.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 (224) hide show
  1. package/README.md +0 -1
  2. package/dist/README.md +0 -1
  3. package/dist/client/assets/{AlertCircle-BKWtHLuM.js → AlertCircle-DLzeWW_T.js} +1 -1
  4. package/dist/client/assets/{AreaChart-6Z8zdJku.js → AreaChart-pzs3vvOZ.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Cxv-XBQA.js → ArrowUp-CxvtSdkN.js} +1 -1
  6. package/dist/client/assets/{ArrowUpRight-D66LLTae.js → ArrowUpRight-DPC10cdm.js} +1 -1
  7. package/dist/client/assets/{Check-Cf1p4cPm.js → Check-Cc1URztt.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-O6WYhGlf.js → CheckCircle-CKFQ-ojS.js} +1 -1
  9. package/dist/client/assets/{ChevronDown-Jt_S9JUZ.js → ChevronDown-CGQNWnd1.js} +1 -1
  10. package/dist/client/assets/{ChevronRight-DofsbtWu.js → ChevronRight-D8qRMofp.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-BlcGyfw1.js → ChevronUp-B1MCgjPT.js} +1 -1
  12. package/dist/client/assets/{Copy01-BiGjHBg4.js → Copy01-B_uUNvC1.js} +1 -1
  13. package/dist/client/assets/{CpuChip01-D_2Z9MMj.js → CpuChip01-TRNsH071.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-67buAsMV.js → DotsVertical-CVUQFIq0.js} +1 -1
  15. package/dist/client/assets/{Eye-DIqODX9i.js → Eye-YusYyNwB.js} +1 -1
  16. package/dist/client/assets/{FilterLines-D0lq4PR2.js → FilterLines-CnFW7BL3.js} +1 -1
  17. package/dist/client/assets/{HardDrive-Dchox8PE.js → HardDrive-Dy4jOdZa.js} +1 -1
  18. package/dist/client/assets/{Key01-C1pgCoc-.js → Key01-VrpEHfUN.js} +1 -1
  19. package/dist/client/assets/{LayoutLeft-BZEc20IP.js → LayoutLeft-wIsOdHDO.js} +1 -1
  20. package/dist/client/assets/{LinkExternal01-BZBrn2jR.js → LinkExternal01-C08SeV4q.js} +1 -1
  21. package/dist/client/assets/{LogOut01-ra5yyDYf.js → LogOut01-CjdQdSFl.js} +1 -1
  22. package/dist/client/assets/{Monitor01-DiblGrW3.js → Monitor01-B18puA3q.js} +1 -1
  23. package/dist/client/assets/{Palette-TVx5K9sd.js → Palette-PEJqZgK-.js} +1 -1
  24. package/dist/client/assets/{Play-CqEDB1Je.js → Play-DlOwS4QV.js} +1 -1
  25. package/dist/client/assets/{Plus-CWNZghUJ.js → Plus-BPKrERKg.js} +1 -1
  26. package/dist/client/assets/{SearchLg-C9IBm0V3.js → SearchLg-CvzWiMCw.js} +1 -1
  27. package/dist/client/assets/{SearchMd-B3zYmgrK.js → SearchMd-CzLFcViF.js} +1 -1
  28. package/dist/client/assets/{Settings02-C-wQUSYI.js → Settings02-CzZapEug.js} +1 -1
  29. package/dist/client/assets/{Shield01-DHBz1rsf.js → Shield01--IU-F9zy.js} +1 -1
  30. package/dist/client/assets/{Star01-BvhXRrKP.js → Star01-D-FnejVv.js} +1 -1
  31. package/dist/client/assets/{Stars01-DOE0Pjm1.js → Stars01-CO1ZsKSM.js} +1 -1
  32. package/dist/client/assets/{Stars02-BfxCpI3j.js → Stars02-BQiI_7bO.js} +1 -1
  33. package/dist/client/assets/{Sun-BhcJlJt7.js → Sun-Czb40wa5.js} +1 -1
  34. package/dist/client/assets/{SwitchHorizontal01-CKXMG0H_.js → SwitchHorizontal01-BMdCcnbl.js} +1 -1
  35. package/dist/client/assets/{Tool01-C5h3WP4s.js → Tool01-Czi-69SR.js} +1 -1
  36. package/dist/client/assets/{Tool02-D6kdZPtA.js → Tool02-DbFQnKm7.js} +1 -1
  37. package/dist/client/assets/{Trash01-D6nYBv8Q.js → Trash01-CJ5MTqKD.js} +1 -1
  38. package/dist/client/assets/{TrendUp01-CowO6BlO.js → TrendUp01-Dx0eGCHh.js} +1 -1
  39. package/dist/client/assets/{Upload01-D31qC2Bb.js → Upload01-DEQX-M-s.js} +1 -1
  40. package/dist/client/assets/{User01-k32-Q8hw.js → User01-aqOULbJy.js} +1 -1
  41. package/dist/client/assets/{Users01-CaNmt7QX.js → Users01-Bd1Jrc1q.js} +1 -1
  42. package/dist/client/assets/{Users03-B93N8SgD.js → Users03-C8IQMkHF.js} +1 -1
  43. package/dist/client/assets/{X-BFVN_Ew8.js → X-C8pctpGF.js} +1 -1
  44. package/dist/client/assets/{XCircle-B3w-kPPf.js → XCircle-tVWlex9c.js} +1 -1
  45. package/dist/client/assets/{XClose-BxNA0UXq.js → XClose-D7FEmbyQ.js} +1 -1
  46. package/dist/client/assets/{Zap-BvFWTo0d.js → Zap-C7Zkgnxi.js} +1 -1
  47. package/dist/client/assets/{ZapSquare-BSheoe64.js → ZapSquare-DWTmsWCw.js} +1 -1
  48. package/dist/client/assets/{access-gate-zJARvMeG.js → access-gate-ZUTDiUUH.js} +1 -1
  49. package/dist/client/assets/{add-section-modal-DtMFdJPd.js → add-section-modal-C8iRgsqy.js} +1 -1
  50. package/dist/client/assets/{agent-icon-D5XWrthR.js → agent-icon-D24e3m8a.js} +1 -1
  51. package/dist/client/assets/{agents-list-BmHxIvAH.js → agents-list-C0oRDsUe.js} +1 -1
  52. package/dist/client/assets/{ai-providers-BwzQl9hq.js → ai-providers-CdUQIxJh.js} +1 -1
  53. package/dist/client/assets/{alert-Bfkav-Zr.js → alert-CThEG15M.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-BdZDft22.js → alert-dialog-BoL4E1L1.js} +1 -1
  55. package/dist/client/assets/{app-editor-FLTx7sN-.js → app-editor-Ds20lEQ8.js} +1 -1
  56. package/dist/client/assets/{auth-BL1qGwfH.js → auth-DRteaRo7.js} +1 -1
  57. package/dist/client/assets/{auth-catchall-D1hJqXz0.js → auth-catchall-CmHISeLm.js} +1 -1
  58. package/dist/client/assets/{auth-entry-CwPmj0uO.js → auth-entry-Cen2uJU1.js} +1 -1
  59. package/dist/client/assets/{auth-split-layout-5PuBmNOe.js → auth-split-layout-BTlAo9cV.js} +1 -1
  60. package/dist/client/assets/{authenticate-and-persist-oauth-B-Cee2FB.js → authenticate-and-persist-oauth-DS1Wi7hh.js} +1 -1
  61. package/dist/client/assets/{automation-list-row-jVwnpqZ3.js → automation-list-row-E0ENAv6T.js} +1 -1
  62. package/dist/client/assets/{automation-runs-CRTARkGb.js → automation-runs-CefJAXbk.js} +1 -1
  63. package/dist/client/assets/{automations-CumddsDc.js → automations-DmXT_6Vl.js} +1 -1
  64. package/dist/client/assets/{avatar-D56i9NK7.js → avatar-BoeRrsu0.js} +1 -1
  65. package/dist/client/assets/{badge-DozN8el9.js → badge-DHPndUF3.js} +1 -1
  66. package/dist/client/assets/{block-document-KWACmHYb.js → block-document-Db0r3CJO.js} +1 -1
  67. package/dist/client/assets/{brand-context-o-jY68i9.js → brand-context-D7JuaFk9.js} +1 -1
  68. package/dist/client/assets/{buckets-D-tfsr2P.js → buckets-D4viXEBf.js} +1 -1
  69. package/dist/client/assets/{bulk-category-panel-nM04QB5C.js → bulk-category-panel-DVXKdwpG.js} +1 -1
  70. package/dist/client/assets/{calendar-CuwV5_kH.js → calendar-C7p8Pfcr.js} +1 -1
  71. package/dist/client/assets/{capability-load-error-BPHxeG_N.js → capability-load-error-DsipVLJU.js} +1 -1
  72. package/dist/client/assets/{card-_UBviVQl.js → card-Sy0U3-Wx.js} +1 -1
  73. package/dist/client/assets/{category-editor-BJC1BO5h.js → category-editor-Cx_SOHSc.js} +1 -1
  74. package/dist/client/assets/{chat-context-B5q0NFRT.js → chat-context-B6_ywnmh.js} +1 -1
  75. package/dist/client/assets/{checkbox-DHCVnLdZ.js → checkbox-6YGZXahW.js} +1 -1
  76. package/dist/client/assets/{cli-auth-success-BSUWD9dE.js → cli-auth-success-BP_evRWj.js} +1 -1
  77. package/dist/client/assets/{collection-detail-Dk4uZiKQ.js → collection-detail-DGMNodpe.js} +1 -1
  78. package/dist/client/assets/{collection-display-button-CwE-ZLHm.js → collection-display-button-B_hVwDI3.js} +1 -1
  79. package/dist/client/assets/{collection-search-DJ06uz8M.js → collection-search-Dp6F4e-r.js} +1 -1
  80. package/dist/client/assets/{collection-table-wrapper-l0kHrJMb.js → collection-table-wrapper-ByCaiD9J.js} +1 -1
  81. package/dist/client/assets/{collection-tabs-CEmKpAsc.js → collection-tabs-D7xdcSRl.js} +1 -1
  82. package/dist/client/assets/{command-D474JxD9.js → command-CIKiJ9mI.js} +1 -1
  83. package/dist/client/assets/{commerce-onboarding-9g8c4xaF.js → commerce-onboarding-FPVSwQmJ.js} +1 -1
  84. package/dist/client/assets/companions-core-a4SdW3uj.js +1 -0
  85. package/dist/client/assets/{connect-CaSt8CjY.js → connect-C-UeFeiC.js} +1 -1
  86. package/dist/client/assets/{connection-kK3c1WbV.js → connection-DzettGC3.js} +1 -1
  87. package/dist/client/assets/{connection-card-BjP5_tjD.js → connection-card-CJ1zmea6.js} +1 -1
  88. package/dist/client/assets/{connection-detail-Bn8koacX.js → connection-detail-DpZmlaBz.js} +1 -1
  89. package/dist/client/assets/{connection-form-helpers-0ay5zqRB.js → connection-form-helpers-Cz30_EcT.js} +1 -1
  90. package/dist/client/assets/{connections-DJbgZibT.js → connections-TMKh5xRR.js} +1 -1
  91. package/dist/client/assets/{decopilot-sse-pool-BqHy9fYR.js → decopilot-sse-pool-B-yIIkq7.js} +1 -1
  92. package/dist/client/assets/{dialog-DBHygfOy.js → dialog-CLRqjexh.js} +1 -1
  93. package/dist/client/assets/{domain-settings-Ts7BSFxW.js → domain-settings-CUvlEo5L.js} +1 -1
  94. package/dist/client/assets/{drawer-C97GmoZZ.js → drawer-CJG4KQ31.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-DxzIdPjM.js → dropdown-menu-LjQEXf6I.js} +1 -1
  96. package/dist/client/assets/{empty-state-BhMUIGeR.js → empty-state-B6Syio-N.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-B0zB4rYk.js → extract-connection-data-CGhHKZyY.js} +1 -1
  98. package/dist/client/assets/{file-explorer-BcXiscCm.js → file-explorer-VOixh5LM.js} +1 -1
  99. package/dist/client/assets/{form-C31Guq6I.js → form-5ssuGL92.js} +1 -1
  100. package/dist/client/assets/{general-DUkKUHxD.js → general-DaNZQo1V.js} +1 -1
  101. package/dist/client/assets/{github-repo-picker-lVUi3c9s.js → github-repo-picker-CLYbDMRM.js} +1 -1
  102. package/dist/client/assets/{hooks-_6qLH3a1.js → hooks-B8L2k77M.js} +1 -1
  103. package/dist/client/assets/{index-Ckm1UYTd.js → index-B2y9Di3y.js} +3 -3
  104. package/dist/client/assets/{index-BkY8d-45.js → index-BJtgm97J.js} +1 -1
  105. package/dist/client/assets/{index-CtlTXjZs.js → index-BXpucqbV.js} +1 -1
  106. package/dist/client/assets/{index-CcjTk66d.js → index-BZ3okQg1.js} +1 -1
  107. package/dist/client/assets/{index-T8UtHXRW.js → index-BwtPwDkT.js} +5 -5
  108. package/dist/client/assets/{index-aZP8RLO-.js → index-Cj6bcenP.js} +1 -1
  109. package/dist/client/assets/{index-Byy3-ESS.js → index-D0lOXkKe.js} +1 -1
  110. package/dist/client/assets/{index-BNaeYakB.js → index-DAs-9e2l.js} +5 -5
  111. package/dist/client/assets/{index-CMNRmHCU.js → index-DdrlaVv3.js} +1 -1
  112. package/dist/client/assets/{index-UBWcFEcy.js → index-Smwq5Lyw.js} +1 -1
  113. package/dist/client/assets/{index-DPhbsbtW.js → index-q4OC2fZp.js} +1 -1
  114. package/dist/client/assets/{index-redirect-DOpqt7g_.js → index-redirect-6PCgRgDl.js} +1 -1
  115. package/dist/client/assets/{input-Bp5qVo1d.js → input-CWOf_06B.js} +1 -1
  116. package/dist/client/assets/{integration-icon-DM84oKIR.js → integration-icon-D00h7u0u.js} +1 -1
  117. package/dist/client/assets/{invite-member-dialog-VUqp9IjM.js → invite-member-dialog-DuQcrN4y.js} +1 -1
  118. package/dist/client/assets/{label-QBKT0ian.js → label-CfD3KdnG.js} +1 -1
  119. package/dist/client/assets/{layout-Ch5HRahO.js → layout-C4_zOxUK.js} +1 -1
  120. package/dist/client/assets/{login-CAkfO0lZ.js → login-DxINR4-H.js} +1 -1
  121. package/dist/client/assets/{mcp-oauth-DIWhMMB3.js → mcp-oauth-Cf4CBqV8.js} +1 -1
  122. package/dist/client/assets/{members-S4yTnUtl.js → members-C1o0DQ12.js} +1 -1
  123. package/dist/client/assets/{monaco-editor-CF2PLFdW.js → monaco-editor-34s3IYG-.js} +1 -1
  124. package/dist/client/assets/{monitoring-stats-row-CE5wX5dd.js → monitoring-stats-row-ep4hubUc.js} +1 -1
  125. package/dist/client/assets/{multi-select-BGy9CRSM.js → multi-select-C4rW-VO5.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-DpKf2aAu.js → oauth-callback-ai-provider-CLfKk4Fa.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-BZPx_vfW.js → oauth-callback-zvSVQgyF.js} +1 -1
  128. package/dist/client/assets/{onboarding-DFOJmWsI.js → onboarding-C3SYWIF2.js} +1 -1
  129. package/dist/client/assets/{org-layout-jGQ5_8st.js → org-layout-BnI1QlcR.js} +1 -1
  130. package/dist/client/assets/{organization-choice-CiUe16h2.js → organization-choice-DYNikqVU.js} +1 -1
  131. package/dist/client/assets/{orgs-BhhTg3Pp.js → orgs-Cm8eXAuw.js} +1 -1
  132. package/dist/client/assets/{page-seo-form-D7B-sCCx.js → page-seo-form-DR8h-gQE.js} +1 -1
  133. package/dist/client/assets/{popover-CArWaBSj.js → popover-BHleKabJ.js} +1 -1
  134. package/dist/client/assets/{post-editor-CQdqNv30.js → post-editor-DCkAKPIS.js} +1 -1
  135. package/dist/client/assets/{primitives-Ta_WO9MH.js → primitives-C0AROOTz.js} +1 -1
  136. package/dist/client/assets/{profile-D-jclIpq.js → profile-CL6IQ3Fl.js} +1 -1
  137. package/dist/client/assets/project-app-view-DxvjSATo.js +1 -0
  138. package/dist/client/assets/record-editor-TbGKJxnE.js +1 -0
  139. package/dist/client/assets/{redirect-editor-C-3CxtJe.js → redirect-editor-UQYpv5C_.js} +1 -1
  140. package/dist/client/assets/registry-DLDJcqtc.js +2 -0
  141. package/dist/client/assets/{registry-layout-D6C-4oqg.js → registry-layout-NhqIRzzz.js} +1 -1
  142. package/dist/client/assets/{reports-CVC8sf9Z.js → reports-D4D2Os_H.js} +1 -1
  143. package/dist/client/assets/{require-capability-sNLW5gF3.js → require-capability-CB4rHeMC.js} +1 -1
  144. package/dist/client/assets/{required-auth-layout-DhWi4UTr.js → required-auth-layout-BPywrnYN.js} +1 -1
  145. package/dist/client/assets/{reset-password-CL14KgWk.js → reset-password-Br0nO7M8.js} +1 -1
  146. package/dist/client/assets/{roles-fjqW1aWQ.js → roles-BJ06-jIc.js} +1 -1
  147. package/dist/client/assets/{search-input-DVLpoloj.js → search-input-Dm_eTyGl.js} +1 -1
  148. package/dist/client/assets/{secrets-BARrr2ft.js → secrets-DTzGP45M.js} +1 -1
  149. package/dist/client/assets/{sections-editor-CGqcHtxe.js → sections-editor-COBfPCM9.js} +1 -1
  150. package/dist/client/assets/{select-DTHMSVvR.js → select-BbYS1E3l.js} +1 -1
  151. package/dist/client/assets/{select-model-C9wCmrpF.js → select-model-pTvdtWWw.js} +1 -1
  152. package/dist/client/assets/self-tool-result-Yn_3N0cu.js +1 -0
  153. package/dist/client/assets/{seo-editor-BYE6CN2T.js → seo-editor-CMm4jEb4.js} +1 -1
  154. package/dist/client/assets/{settings-layout-DVk7oulh.js → settings-layout-D181ueaI.js} +1 -1
  155. package/dist/client/assets/{settings-section-B09dtn0a.js → settings-section-D2FgE1NH.js} +1 -1
  156. package/dist/client/assets/{shell-controls-BfFd4km4.js → shell-controls-DmHgFQFH.js} +1 -1
  157. package/dist/client/assets/{shell-layout-mys1mpVU.js → shell-layout-DfiKUJAA.js} +1 -1
  158. package/dist/client/assets/{sidebar-D_-oDydd.js → sidebar-BAUTb--2.js} +1 -1
  159. package/dist/client/assets/{skeleton-BKzYEyPy.js → skeleton-EeUOKHea.js} +1 -1
  160. package/dist/client/assets/{spinner-C0JZ4pZa.js → spinner-C3MmgrM8.js} +1 -1
  161. package/dist/client/assets/{sso-JgAWsqlp.js → sso-0Ja-RNZl.js} +1 -1
  162. package/dist/client/assets/{store-DsRmnTe8.js → store-BnDXQRe5.js} +1 -1
  163. package/dist/client/assets/store-registry-Kq12eoMm.js +2 -0
  164. package/dist/client/assets/{studio-tools-Drz6Ql7x.js → studio-tools-B0hGD5Gd.js} +1 -1
  165. package/dist/client/assets/{switch-y3vto-gq.js → switch-B3bEiCXf.js} +1 -1
  166. package/dist/client/assets/{tab-id-CLMXpokn.js → tab-id-7BtS1Sf2.js} +1 -1
  167. package/dist/client/assets/{table-Dqf82LGl.js → table-osBzVewG.js} +1 -1
  168. package/dist/client/assets/{tabs-Bpz-Jf9F.js → tabs-Dwdju4U8.js} +1 -1
  169. package/dist/client/assets/{textarea-COZXbZtD.js → textarea-8dJKevB7.js} +1 -1
  170. package/dist/client/assets/{toggle-group-9kMoq9st.js → toggle-group-oSJPzYP5.js} +1 -1
  171. package/dist/client/assets/{toolbar-CNUb_JNM.js → toolbar-1x2OYBi0.js} +1 -1
  172. package/dist/client/assets/{tooltip-Dm896ony.js → tooltip-DpCQ4VIp.js} +1 -1
  173. package/dist/client/assets/{use-ai-providers-C90iwQma.js → use-ai-providers-fwwaVRz9.js} +1 -1
  174. package/dist/client/assets/{use-automations-BAuuqtFF.js → use-automations-D1WDAUDw.js} +1 -1
  175. package/dist/client/assets/{use-autosave-75YdhXHX.js → use-autosave-CYMXofan.js} +1 -1
  176. package/dist/client/assets/{use-capability-D1_GyAkB.js → use-capability-DBxj3ZBy.js} +1 -1
  177. package/dist/client/assets/{use-clock-tick-DB4wLWKF.js → use-clock-tick-Bc1o7i2J.js} +1 -1
  178. package/dist/client/assets/{use-connection-Cv9n2bg4.js → use-connection-Vb2VF6Hp.js} +1 -1
  179. package/dist/client/assets/{use-copy-C3J1yKwP.js → use-copy-CHvgH5Lh.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-BarPI5Qh.js → use-create-virtual-mcp-Bz7S0S4E.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-BuY-zYWq.js → use-debounced-autosave-CBX0zn4k.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-B7BOJtlx.js → use-debounced-value-B7GbcCk6.js} +1 -1
  183. package/dist/client/assets/{use-deco-credits-Comnp1EI.js → use-deco-credits-Dp9kIRuI.js} +1 -1
  184. package/dist/client/assets/{use-decopilot-events-BjxyNJFw.js → use-decopilot-events-C7QhM8s6.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-BUCESKPy.js → use-delete-connection-jJGa1r2P.js} +1 -1
  186. package/dist/client/assets/{use-deployment-admin-kOx_QPrt.js → use-deployment-admin-kLCH3aEw.js} +1 -1
  187. package/dist/client/assets/{use-file-configs-BjBZDLRS.js → use-file-configs-CAMwu8_0.js} +1 -1
  188. package/dist/client/assets/{use-infinite-scroll-D_1cIQuB.js → use-infinite-scroll-BerLzyTb.js} +1 -1
  189. package/dist/client/assets/{use-join-requests-ihWhY5lF.js → use-join-requests-CbWjVaiY.js} +1 -1
  190. package/dist/client/assets/{use-mcp-auth-status-VhFCGaYc.js → use-mcp-auth-status-BCEeD3p5.js} +1 -1
  191. package/dist/client/assets/{use-mcp-client-Beixgeu8.js → use-mcp-client-FfMc8-rx.js} +1 -1
  192. package/dist/client/assets/{use-mcp-tools-CR8PDvke.js → use-mcp-tools-CJRQx9mh.js} +1 -1
  193. package/dist/client/assets/{use-members-DFZua-Mi.js → use-members-DmA1JBPe.js} +1 -1
  194. package/dist/client/assets/{use-mobile-CINzfRDA.js → use-mobile-Ce6m_tdj.js} +1 -1
  195. package/dist/client/assets/{use-navigate-to-agent-DbFXXpsT.js → use-navigate-to-agent-BywRVo4r.js} +1 -1
  196. package/dist/client/assets/{use-org-auth-client-DjyNTqL5.js → use-org-auth-client-qRcVIjeO.js} +1 -1
  197. package/dist/client/assets/{use-org-sso-xxLJrDI3.js → use-org-sso-CeCv1N-8.js} +1 -1
  198. package/dist/client/assets/{use-organization-roles-BbEccH2X.js → use-organization-roles-3X0CAGAI.js} +1 -1
  199. package/dist/client/assets/{use-organization-settings-ldPN5XeT.js → use-organization-settings-DIoSfGxH.js} +1 -1
  200. package/dist/client/assets/{use-registry-connections-BO1HvgEu.js → use-registry-connections-BW6UlzJ3.js} +1 -1
  201. package/dist/client/assets/{use-secrets-B_o-zwGG.js → use-secrets-6OQFbWZR.js} +1 -1
  202. package/dist/client/assets/{use-status-sounds-BiyOR3fI.js → use-status-sounds-DtpMl-Yx.js} +1 -1
  203. package/dist/client/assets/{use-tags-dMm8oLa7.js → use-tags-xUIAqM8l.js} +1 -1
  204. package/dist/client/assets/{use-view-mode-pamCZlJJ.js → use-view-mode-BQOaov8k.js} +1 -1
  205. package/dist/client/assets/{use-virtual-mcp-DGBXqKbp.js → use-virtual-mcp-LvfbHggF.js} +1 -1
  206. package/dist/client/assets/useInfiniteQuery-Cm_QWUqt.js +1 -0
  207. package/dist/client/assets/{useQueries-CD6pVq1W.js → useQueries-_Xy4vtop.js} +1 -1
  208. package/dist/client/assets/{useRouterState-JACN-I5b.js → useRouterState-CdWmcBSP.js} +1 -1
  209. package/dist/client/assets/useSuspenseInfiniteQuery-Ghh8fdTf.js +1 -0
  210. package/dist/client/assets/{users-B5poMIGf.js → users-CnNuEk_v.js} +1 -1
  211. package/dist/client/assets/{variant-calendar-D_PVsMZu.js → variant-calendar-By4oAdg7.js} +1 -1
  212. package/dist/client/assets/{view-mode-toggle-Do4Mv_aS.js → view-mode-toggle-BNBmVxxx.js} +1 -1
  213. package/dist/client/index.html +1 -1
  214. package/dist/server/cli.js +2 -2
  215. package/dist/server/server.js +2 -2
  216. package/package.json +1 -1
  217. package/dist/client/assets/companions-core-C9f9-EJg.js +0 -1
  218. package/dist/client/assets/project-app-view-DHCM9ZV-.js +0 -1
  219. package/dist/client/assets/record-editor-qkbhvGZv.js +0 -1
  220. package/dist/client/assets/registry-WMjAXfr8.js +0 -2
  221. package/dist/client/assets/self-tool-result-CRvRQnji.js +0 -1
  222. package/dist/client/assets/store-registry-C3Jey1Vt.js +0 -2
  223. package/dist/client/assets/useInfiniteQuery-CI2iG6K5.js +0 -1
  224. package/dist/client/assets/useSuspenseInfiniteQuery-MqpBAc3M.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as V,j as s,b as ie,r as U,B as de,m as ce,af as yt,X as Ye,Y as je,F as be,o as _e,Z as Qe,_ as Je,e as ke,K as fe,t as me,p as ue,D as jt,n as St,d as Nt,E as kt,z as wt}from"./index-T8UtHXRW.js";import{e as Me,d as Ee,a as Ze,b as Oe,h as et,c as tt,D as Ct}from"./dialog-DBHygfOy.js";import{d as It,b as _t,a as Mt,D as Et}from"./drawer-C97GmoZZ.js";import{u as Ot}from"./use-mobile-CINzfRDA.js";import{c as st,G as Lt,u as Le}from"./chat-context-B5q0NFRT.js";import{C as At}from"./checkbox-DHCVnLdZ.js";import{I as xe}from"./input-Bp5qVo1d.js";import{S as Pt,a as Tt,b as Dt,c as zt,d as Rt}from"./select-DTHMSVvR.js";import{S as se}from"./skeleton-BKzYEyPy.js";import{i as it,b as lt,c as Kt,a as Ft,s as $t}from"./Settings02-C-wQUSYI.js";import{d as Ut,a as Bt,b as Wt,i as Vt}from"./Tool01-C5h3WP4s.js";import{i as Ht}from"./Key01-C1pgCoc-.js";import{i as nt}from"./SearchMd-B3zYmgrK.js";import{d as Ae,u as qt,b as Gt}from"./use-ai-providers-C90iwQma.js";import{g as Pe}from"./ai-providers-logos-DD3qZ33J.js";import{i as Xt}from"./Monitor01-DiblGrW3.js";import{i as Yt}from"./AlertCircle-BKWtHLuM.js";import{S as Ie}from"./spinner-C0JZ4pZa.js";import{u as Ce}from"./studio-tools-Drz6Ql7x.js";import{i as Qt}from"./ChevronRight-DofsbtWu.js";import{A as Jt}from"./avatar-D56i9NK7.js";import{S as ze,a as Re,b as ot}from"./settings-section-B09dtn0a.js";import{s as rt}from"./Eye-DIqODX9i.js";import{i as Zt,D as es}from"./tab-id-CLMXpokn.js";import{u as ts}from"./use-is-desktop-app-BNujXJc_.js";import{i as ss}from"./Check-Cf1p4cPm.js";import{a as is}from"./Copy01-BiGjHBg4.js";import{t as Ke}from"./ChevronDown-Jt_S9JUZ.js";import{t as ls}from"./Stars01-DOE0Pjm1.js";function ge(l){const e=V.c(3),{size:t}=l,i=t===void 0?16:t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=n):n=e[0];let o;return e[1]!==i?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n}),e[1]=i,e[2]=o):o=e[2],o}function ve(l){const e=V.c(3),{size:t}=l,i=t===void 0?16:t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=n):n=e[0];let o;return e[1]!==i?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:n}),e[1]=i,e[2]=o):o=e[2],o}const ns={"claude-code":{labelKey:"chat.agentIcons.claudeCode",Icon:ge},codex:{labelKey:"chat.agentIcons.codex",Icon:ve}};function nl(l){return(l&&ns[l])??null}const Fe="bunx decocms@latest link",os=[{capability:"claude-code",labelKey:"chat.connectDesktopDialog.agentClaudeCodeLabel",descriptionKey:"chat.connectDesktopDialog.agentClaudeCodeDescription",icon:s.jsx(ge,{size:18})},{capability:"codex",labelKey:"chat.connectDesktopDialog.agentCodexLabel",descriptionKey:"chat.connectDesktopDialog.agentCodexDescription",icon:s.jsx(ve,{size:18})}];function rs(l){const e=V.c(46),{open:t,onOpenChange:i}=l,n=ie();let o;e[0]!==t?(o={fast:t},e[0]=t,e[1]=o):o=e[1];const r=st(o),[c,u]=U.useState(!1);let d,a,h,p,m,f,b,N;if(e[2]!==r.hostname||e[3]!==r.machineId||e[4]!==r.online||e[5]!==i||e[6]!==t||e[7]!==n){const w=r.hostname??r.machineId??n("chat.connectDesktopDialog.yourDesktop");p=Me,b=t,N=i,h=Ee,f="sm:max-w-md",a=Ze,d=Oe,m=r.online?n("chat.connectDesktopDialog.connectedTo",{desktopName:w}):n("chat.connectDesktopDialog.connectYourDesktop"),e[2]=r.hostname,e[3]=r.machineId,e[4]=r.online,e[5]=i,e[6]=t,e[7]=n,e[8]=d,e[9]=a,e[10]=h,e[11]=p,e[12]=m,e[13]=f,e[14]=b,e[15]=N}else d=e[8],a=e[9],h=e[10],p=e[11],m=e[12],f=e[13],b=e[14],N=e[15];let y;e[16]!==d||e[17]!==m?(y=s.jsx(d,{children:m}),e[16]=d,e[17]=m,e[18]=y):y=e[18];let j;e[19]!==r.online||e[20]!==n?(j=r.online?n("chat.connectDesktopDialog.machineAgentsDescription"):n("chat.connectDesktopDialog.runCommandDescription"),e[19]=r.online,e[20]=n,e[21]=j):j=e[21];let C;e[22]!==j?(C=s.jsx(et,{children:j}),e[22]=j,e[23]=C):C=e[23];let E;e[24]!==a||e[25]!==y||e[26]!==C?(E=s.jsxs(a,{children:[y,C]}),e[24]=a,e[25]=y,e[26]=C,e[27]=E):E=e[27];let M;e[28]!==c||e[29]!==r.online?(M=!r.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:Fe}),s.jsx(de,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(Fe).then(()=>{u(!0),setTimeout(()=>u(!1),1500)})},children:c?s.jsx(ss,{size:14}):s.jsx(is,{size:14})})]}),e[28]=c,e[29]=r.online,e[30]=M):M=e[30];let I;e[31]!==r.capabilities||e[32]!==r.online||e[33]!==n?(I=r.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:os.map(w=>{const _=r.capabilities.includes(w.capability);return s.jsxs("div",{className:ce("flex items-center gap-3 rounded-md border px-3 py-2",_?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:ce("flex size-6 items-center justify-center",_?"text-foreground":"text-muted-foreground"),children:w.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:n(w.labelKey)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:n(_?w.descriptionKey:"chat.connectDesktopDialog.notDetected")})]}),s.jsx("span",{className:ce("size-2 rounded-full",_?"bg-success":"bg-muted-foreground/30")})]},w.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Ie,{size:"sm"}),n("chat.connectDesktopDialog.waitingForDesktop")]}),e[31]=r.capabilities,e[32]=r.online,e[33]=n,e[34]=I):I=e[34];let x;e[35]!==h||e[36]!==M||e[37]!==I||e[38]!==f||e[39]!==E?(x=s.jsxs(h,{className:f,children:[E,M,I]}),e[35]=h,e[36]=M,e[37]=I,e[38]=f,e[39]=E,e[40]=x):x=e[40];let k;return e[41]!==p||e[42]!==x||e[43]!==b||e[44]!==N?(k=s.jsx(p,{open:b,onOpenChange:N,children:x}),e[41]=p,e[42]=x,e[43]=b,e[44]=N,e[45]=k):k=e[45],k}function pe(l,e,t){let i=t.initialDeps??[],n,o=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const h=l();if(!(h.length!==i.length||h.some((f,b)=>i[b]!==f)))return n;i=h;let m;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(m=Date.now()),n=e(...h),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-m)*100)/100,N=b/16,y=(j,C)=>{for(j=String(j);j.length<C;)j=" "+j;return j};console.info(`%c⏱ ${y(b,5)} /${y(f,5)} ms`,`
1
+ import{c as V,j as s,b as ie,r as U,B as de,m as ce,af as yt,X as Ye,Y as je,F as be,o as _e,Z as Qe,_ as Je,e as ke,K as fe,t as me,p as ue,D as jt,n as St,d as Nt,E as kt,z as wt}from"./index-BwtPwDkT.js";import{e as Me,d as Ee,a as Ze,b as Oe,h as et,c as tt,D as Ct}from"./dialog-CLRqjexh.js";import{d as It,b as _t,a as Mt,D as Et}from"./drawer-CJG4KQ31.js";import{u as Ot}from"./use-mobile-Ce6m_tdj.js";import{c as st,G as Lt,u as Le}from"./chat-context-B6_ywnmh.js";import{C as At}from"./checkbox-6YGZXahW.js";import{I as xe}from"./input-CWOf_06B.js";import{S as Pt,a as Tt,b as Dt,c as zt,d as Rt}from"./select-BbYS1E3l.js";import{S as se}from"./skeleton-EeUOKHea.js";import{i as it,b as lt,c as Kt,a as Ft,s as $t}from"./Settings02-CzZapEug.js";import{d as Ut,a as Bt,b as Wt,i as Vt}from"./Tool01-Czi-69SR.js";import{i as Ht}from"./Key01-VrpEHfUN.js";import{i as nt}from"./SearchMd-CzLFcViF.js";import{d as Ae,u as qt,b as Gt}from"./use-ai-providers-fwwaVRz9.js";import{g as Pe}from"./ai-providers-logos-DD3qZ33J.js";import{i as Xt}from"./Monitor01-B18puA3q.js";import{i as Yt}from"./AlertCircle-DLzeWW_T.js";import{S as Ie}from"./spinner-C3MmgrM8.js";import{u as Ce}from"./studio-tools-B0hGD5Gd.js";import{i as Qt}from"./ChevronRight-D8qRMofp.js";import{A as Jt}from"./avatar-BoeRrsu0.js";import{S as ze,a as Re,b as ot}from"./settings-section-D2FgE1NH.js";import{s as rt}from"./Eye-YusYyNwB.js";import{i as Zt,D as es}from"./tab-id-7BtS1Sf2.js";import{u as ts}from"./use-is-desktop-app-BNujXJc_.js";import{i as ss}from"./Check-Cc1URztt.js";import{a as is}from"./Copy01-B_uUNvC1.js";import{t as Ke}from"./ChevronDown-CGQNWnd1.js";import{t as ls}from"./Stars01-CO1ZsKSM.js";function ge(l){const e=V.c(3),{size:t}=l,i=t===void 0?16:t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=n):n=e[0];let o;return e[1]!==i?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n}),e[1]=i,e[2]=o):o=e[2],o}function ve(l){const e=V.c(3),{size:t}=l,i=t===void 0?16:t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=n):n=e[0];let o;return e[1]!==i?(o=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:n}),e[1]=i,e[2]=o):o=e[2],o}const ns={"claude-code":{labelKey:"chat.agentIcons.claudeCode",Icon:ge},codex:{labelKey:"chat.agentIcons.codex",Icon:ve}};function nl(l){return(l&&ns[l])??null}const Fe="bunx decocms@latest link",os=[{capability:"claude-code",labelKey:"chat.connectDesktopDialog.agentClaudeCodeLabel",descriptionKey:"chat.connectDesktopDialog.agentClaudeCodeDescription",icon:s.jsx(ge,{size:18})},{capability:"codex",labelKey:"chat.connectDesktopDialog.agentCodexLabel",descriptionKey:"chat.connectDesktopDialog.agentCodexDescription",icon:s.jsx(ve,{size:18})}];function rs(l){const e=V.c(46),{open:t,onOpenChange:i}=l,n=ie();let o;e[0]!==t?(o={fast:t},e[0]=t,e[1]=o):o=e[1];const r=st(o),[c,u]=U.useState(!1);let d,a,h,p,m,f,b,N;if(e[2]!==r.hostname||e[3]!==r.machineId||e[4]!==r.online||e[5]!==i||e[6]!==t||e[7]!==n){const w=r.hostname??r.machineId??n("chat.connectDesktopDialog.yourDesktop");p=Me,b=t,N=i,h=Ee,f="sm:max-w-md",a=Ze,d=Oe,m=r.online?n("chat.connectDesktopDialog.connectedTo",{desktopName:w}):n("chat.connectDesktopDialog.connectYourDesktop"),e[2]=r.hostname,e[3]=r.machineId,e[4]=r.online,e[5]=i,e[6]=t,e[7]=n,e[8]=d,e[9]=a,e[10]=h,e[11]=p,e[12]=m,e[13]=f,e[14]=b,e[15]=N}else d=e[8],a=e[9],h=e[10],p=e[11],m=e[12],f=e[13],b=e[14],N=e[15];let y;e[16]!==d||e[17]!==m?(y=s.jsx(d,{children:m}),e[16]=d,e[17]=m,e[18]=y):y=e[18];let j;e[19]!==r.online||e[20]!==n?(j=r.online?n("chat.connectDesktopDialog.machineAgentsDescription"):n("chat.connectDesktopDialog.runCommandDescription"),e[19]=r.online,e[20]=n,e[21]=j):j=e[21];let C;e[22]!==j?(C=s.jsx(et,{children:j}),e[22]=j,e[23]=C):C=e[23];let E;e[24]!==a||e[25]!==y||e[26]!==C?(E=s.jsxs(a,{children:[y,C]}),e[24]=a,e[25]=y,e[26]=C,e[27]=E):E=e[27];let M;e[28]!==c||e[29]!==r.online?(M=!r.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:Fe}),s.jsx(de,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(Fe).then(()=>{u(!0),setTimeout(()=>u(!1),1500)})},children:c?s.jsx(ss,{size:14}):s.jsx(is,{size:14})})]}),e[28]=c,e[29]=r.online,e[30]=M):M=e[30];let I;e[31]!==r.capabilities||e[32]!==r.online||e[33]!==n?(I=r.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:os.map(w=>{const _=r.capabilities.includes(w.capability);return s.jsxs("div",{className:ce("flex items-center gap-3 rounded-md border px-3 py-2",_?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:ce("flex size-6 items-center justify-center",_?"text-foreground":"text-muted-foreground"),children:w.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:n(w.labelKey)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:n(_?w.descriptionKey:"chat.connectDesktopDialog.notDetected")})]}),s.jsx("span",{className:ce("size-2 rounded-full",_?"bg-success":"bg-muted-foreground/30")})]},w.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Ie,{size:"sm"}),n("chat.connectDesktopDialog.waitingForDesktop")]}),e[31]=r.capabilities,e[32]=r.online,e[33]=n,e[34]=I):I=e[34];let x;e[35]!==h||e[36]!==M||e[37]!==I||e[38]!==f||e[39]!==E?(x=s.jsxs(h,{className:f,children:[E,M,I]}),e[35]=h,e[36]=M,e[37]=I,e[38]=f,e[39]=E,e[40]=x):x=e[40];let k;return e[41]!==p||e[42]!==x||e[43]!==b||e[44]!==N?(k=s.jsx(p,{open:b,onOpenChange:N,children:x}),e[41]=p,e[42]=x,e[43]=b,e[44]=N,e[45]=k):k=e[45],k}function pe(l,e,t){let i=t.initialDeps??[],n,o=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const h=l();if(!(h.length!==i.length||h.some((f,b)=>i[b]!==f)))return n;i=h;let m;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(m=Date.now()),n=e(...h),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-m)*100)/100,N=b/16,y=(j,C)=>{for(j=String(j);j.length<C;)j=" "+j;return j};console.info(`%c⏱ ${y(b,5)} /${y(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*N,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(n),o=!1,n}return r.updateDeps=c=>{i=c},r}function $e(l,e){if(l===void 0)throw new Error("Unexpected undefined");return l}const as=(l,e)=>Math.abs(l-e)<1.01,cs=(l,e,t)=>{let i;return function(...n){l.clearTimeout(i),i=l.setTimeout(()=>e.apply(this,n),t)}},Ue=l=>{const{offsetWidth:e,offsetHeight:t}=l;return{width:e,height:t}},ds=l=>l,us=l=>{const e=Math.max(l.startIndex-l.overscan,0),t=Math.min(l.endIndex+l.overscan,l.count-1),i=[];for(let n=e;n<=t;n++)i.push(n);return i},ms=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;const n=r=>{const{width:c,height:u}=r;e({width:Math.round(c),height:Math.round(u)})};if(n(Ue(t)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(r=>{const c=()=>{const u=r[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n(Ue(t))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Be={passive:!0},We=typeof window>"u"?!0:"onscrollend"in window,hs=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;let n=0;const o=l.options.useScrollendEvent&&We?()=>{}:cs(i,()=>{e(n,!1)},l.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:h,isRtl:p}=l.options;n=h?t.scrollLeft*(p&&-1||1):t.scrollTop,o(),e(n,a)},c=r(!0),u=r(!1);t.addEventListener("scroll",c,Be);const d=l.options.useScrollendEvent&&We;return d&&t.addEventListener("scrollend",u,Be),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",u)}},fs=(l,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return l[t.options.horizontal?"offsetWidth":"offsetHeight"]},ps=(l,{adjustments:e=0,behavior:t},i)=>{var n,o;const r=l+e;(o=(n=i.scrollElement)==null?void 0:n.scrollTo)==null||o.call(n,{[i.options.horizontal?"left":"top"]:r,behavior:t})};class xs{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,n;return((n=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:n.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(n=>{n.forEach(o=>{const r=()=>{const c=o.target,u=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(c,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var n;(n=i())==null||n.disconnect(),t=null},observe:n=>{var o;return(o=i())==null?void 0:o.observe(n,{box:"border-box"})},unobserve:n=>{var o;return(o=i())==null?void 0:o.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,n])=>{typeof n>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ds,rangeExtractor:us,onChange:()=>{},measureElement:fs,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,n;(n=(i=this.options).onChange)==null||n.call(i,this,t)},this.maybeNotify=pe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const n=new Map,o=new Map;for(let r=i-1;r>=0;r--){const c=t[r];if(n.has(c.lane))continue;const u=o.get(c.lane);if(u==null||c.end>u.end?o.set(c.lane,c):c.end<u.end&&n.set(c.lane,!0),n.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=pe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,n,o,r,c,u)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:c,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=pe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:c,laneAssignmentMode:u},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,a),p=new Array(c).fill(void 0);for(let m=0;m<a;m++){const f=h[m];f&&(p[f.lane]=m)}for(let m=a;m<t;m++){const f=o(m),b=this.laneAssignments.get(m);let N,y;const j=u==="estimate"||d.has(f);if(b!==void 0&&this.options.lanes>1){N=b;const I=p[N],x=I!==void 0?h[I]:void 0;y=x?x.end+this.options.gap:i+n}else{const I=this.options.lanes===1?h[m-1]:this.getFurthestMeasurement(h,m);y=I?I.end+this.options.gap:i+n,N=I?I.lane:m%this.options.lanes,this.options.lanes>1&&j&&this.laneAssignments.set(m,N)}const C=d.get(f),E=typeof C=="number"?C:this.options.estimateSize(m),M=y+E;h[m]={index:m,start:y,size:E,end:M,key:f,lane:N},p[N]=m}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,n,o)=>this.range=t.length>0&&i>0?gs({measurements:t,outerSize:i,scrollOffset:n,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pe(()=>{let t=null,i=null;const n=this.calculateRange();return n&&(t=n.startIndex,i=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,n,o,r)=>o===null||r===null?[]:t({startIndex:o,endIndex:r,overscan:i,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,n=t.getAttribute(i);return n?parseInt(n,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(n!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-o),c=Math.min(this.options.count-1,n+o);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const i=this.indexFromElement(t),n=this.options.getItemKey(i),o=this.elementsCache.get(n);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(n,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var n;const o=this.measurementsCache[t];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,c=i-r;c!==0&&(((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,c,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,i)),this.notify(!1))},this.getVirtualItems=pe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const n=[];for(let o=0,r=t.length;o<r;o++){const c=t[o],u=i[c];n.push(u)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return $e(i[at(0,i.length-1,n=>$e(i[n]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=t>=r+o?"end":"start"),i==="center"?t+=(n-o)/2:i==="end"&&(t-=o);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(i==="auto")if(r.end>=o+n-this.options.scrollPaddingEnd)i="end";else if(r.start<=o+this.options.scrollPaddingStart)i="start";else return[o,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const c=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,i,r.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(t,i),r=this.now();this.scrollState={index:null,align:i,behavior:n,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:n="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,i);if(!o)return;const[r,c]=o,u=this.now();this.scrollState={index:t,align:c,behavior:n,startedAt:u,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const n=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let n;if(i.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((t=i[i.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&o.some(c=>c===null);){const c=i[r];o[c.lane]===null&&(o[c.lane]=c.end),r--}n=Math.max(...o.filter(c=>c!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:n})=>{this.options.scrollToFn(t,{behavior:n,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=i?i[0]:this.scrollState.lastTargetOffset,o=1,r=n!==this.scrollState.lastTargetOffset;if(!r&&as(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=n,this.scrollState.behavior="auto",this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const at=(l,e,t,i)=>{for(;l<=e;){const n=(l+e)/2|0,o=t(n);if(o<i)l=n+1;else if(o>i)e=n-1;else return n}return l>0?l-1:0};function gs({measurements:l,outerSize:e,scrollOffset:t,lanes:i}){const n=l.length-1,o=u=>l[u].start;if(l.length<=i)return{startIndex:0,endIndex:n};let r=at(0,n,o,t),c=r;if(i===1)for(;c<n&&l[c].end<t+e;)c++;else if(i>1){const u=Array(i).fill(0);for(;c<n&&u.some(a=>a<t+e);){const a=l[c];u[a.lane]=a.end,c++}const d=Array(i).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=l[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%i),c=Math.min(n,c+(i-1-c%i))}return{startIndex:r,endIndex:c}}const Ve=typeof document<"u"?U.useLayoutEffect:U.useEffect;function vs({useFlushSync:l=!0,...e}){const t=U.useReducer(()=>({}),{})[1],i={...e,onChange:(o,r)=>{var c;l&&r?yt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,o,r)}},[n]=U.useState(()=>new xs(i));return n.setOptions(i),Ve(()=>n._didMount(),[]),Ve(()=>n._willUpdate()),n}function bs(l){return vs({observeElementRect:ms,observeElementOffset:hs,scrollToFn:ps,...l})}const ct=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function Se(l){if(l)return ct.find(e=>e.id===l)}const He=4;function ye(l){const e=V.c(8),{logo:t,name:i,description:n,onClick:o}=l;let r;e[0]!==t||e[1]!==i?(r=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Jt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=r):r=e[2];let c;return e[3]!==n||e[4]!==i||e[5]!==o||e[6]!==r?(c=s.jsx(ot,{onClick:o,icon:r,title:i,description:n}),e[3]=n,e[4]=i,e[5]=o,e[6]=r,e[7]=c):c=e[7],c}function dt(l){const e=V.c(38),{providers:t,onSelect:i,onShowAll:n}=l,o=ie();let r;e[0]!==t?(r=t.find(Ns),e[0]=t,e[1]=r):r=e[1];const c=r;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=u):u=e[2];const d=u;let a;if(e[3]!==i||e[4]!==t||e[5]!==o){let E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=(S,O)=>{const T=d[S.id]??Number.MAX_SAFE_INTEGER,P=d[O.id]??Number.MAX_SAFE_INTEGER;return T-P},e[7]=E):E=e[7];const M=t.filter(Ss).sort(E);let I;e[8]!==t?(I=t.find(js),e[8]=t,e[9]=I):I=e[9];const x=I;let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=Se("openai"),e[10]=k):k=e[10];const w=k;let _;e[11]!==i?(_=S=>s.jsx(ye,{logo:S.logo,name:S.name,description:S.description,onClick:()=>i({kind:"provider",provider:S})},S.id),e[11]=i,e[12]=_):_=e[12];let v;e[13]!==i||e[14]!==x?(v=x&&w?[s.jsx(ye,{logo:w.logo,name:w.name,description:w.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:w})},w.id)]:[],e[13]=i,e[14]=x,e[15]=v):v=e[15];let g;e[16]!==i||e[17]!==x||e[18]!==o?(g=x?[...ct.filter(ys).map(S=>s.jsx(ye,{logo:S.logo,name:S.name,description:S.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:S})},S.id)),s.jsx(ye,{logo:x.logo,name:o("settings.aiProviders.customOpenAiCompatible"),description:o("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=o,e[19]=g):g=e[19],a=[...M.map(_),...v,...g],e[3]=i,e[4]=t,e[5]=o,e[6]=a}else a=e[6];const h=a,p=h.length-He,m=!!n&&p>0;let f;e[20]!==h||e[21]!==m?(f=m?h.slice(0,He):h,e[20]=h,e[21]=m,e[22]=f):f=e[22];const b=f;let N;e[23]!==c||e[24]!==i||e[25]!==o?(N=c&&s.jsx(ze,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:o("settings.aiProviders.recommended")}),s.jsx(Re,{className:"relative",children:s.jsx(ye,{logo:c.logo,name:c.name,description:c.description,onClick:()=>i({kind:"provider",provider:c})})})]})}),e[23]=c,e[24]=i,e[25]=o,e[26]=N):N=e[26];let y;e[27]!==p||e[28]!==n||e[29]!==m||e[30]!==o?(y=m&&s.jsx(ot,{onClick:n,title:o(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:s.jsx(Qt,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=n,e[29]=m,e[30]=o,e[31]=y):y=e[31];let j;e[32]!==y||e[33]!==b?(j=s.jsx(ze,{children:s.jsxs(Re,{children:[b,y]})}),e[32]=y,e[33]=b,e[34]=j):j=e[34];let C;return e[35]!==N||e[36]!==j?(C=s.jsxs("div",{className:"flex flex-col gap-6",children:[N,j]}),e[35]=N,e[36]=j,e[37]=C):C=e[37],C}function ys(l){return l.id!=="openai"}function js(l){return l.id==="openai-compatible"}function Ss(l){return l.id!=="deco"&&l.id!=="openai-compatible"}function Ns(l){return l.id==="deco"}const ks=Ye({label:je().optional(),apiKey:je().min(1,"API key is required")});function ws(l){const e=V.c(87),{providerId:t,onCancel:i,onSuccess:n}=l,{org:o}=be(),r=Ce(),c=_e(),[u,d]=U.useState(!1),a=ie();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={resolver:Qe(ks),defaultValues:{label:"",apiKey:""}},e[0]=h):h=e[0];const{register:p,handleSubmit:m,formState:f}=Je(h),{errors:b}=f;let N;e[1]!==t||e[2]!==r||e[3]!==a?(N=async B=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:B.label||a("settings.connectForms.defaultKeyLabel"),apiKey:B.apiKey})},e[1]=t,e[2]=r,e[3]=a,e[4]=N):N=e[4];let y;e[5]!==n||e[6]!==o||e[7]!==c||e[8]!==a?(y=()=>{c.invalidateQueries({queryKey:fe.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:fe.aiProviders(o.id)}),me.success(a("settings.connectForms.keySavedSuccess")),n()},e[5]=n,e[6]=o,e[7]=c,e[8]=a,e[9]=y):y=e[9];let j;e[10]!==a?(j=B=>{me.error(a("settings.connectForms.failedSaveKey",{error:B.message}))},e[10]=a,e[11]=j):j=e[11];let C;e[12]!==N||e[13]!==y||e[14]!==j?(C={mutationFn:N,onSuccess:y,onError:j},e[12]=N,e[13]=y,e[14]=j,e[15]=C):C=e[15];const{mutate:E,isPending:M,error:I}=ke(C);let x;e[16]!==E?(x=B=>E(B),e[16]=E,e[17]=x):x=e[17];let k;e[18]!==m||e[19]!==x?(k=m(x),e[18]=m,e[19]=x,e[20]=k):k=e[20];let w;e[21]!==a?(w=a("settings.connectForms.labelField"),e[21]=a,e[22]=w):w=e[22];let _;e[23]!==w?(_=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:w}),e[23]=w,e[24]=_):_=e[24];let v;e[25]!==a?(v=a("settings.connectForms.labelPlaceholder"),e[25]=a,e[26]=v):v=e[26];let g;e[27]!==p?(g=p("label"),e[27]=p,e[28]=g):g=e[28];let S;e[29]!==v||e[30]!==g?(S=s.jsx(xe,{placeholder:v,...g,className:"h-8 text-sm"}),e[29]=v,e[30]=g,e[31]=S):S=e[31];let O;e[32]!==_||e[33]!==S?(O=s.jsxs("div",{className:"space-y-1",children:[_,S]}),e[32]=_,e[33]=S,e[34]=O):O=e[34];let T;e[35]!==a?(T=a("settings.connectForms.apiKeyField"),e[35]=a,e[36]=T):T=e[36];let P;e[37]!==T?(P=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[37]=T,e[38]=P):P=e[38];const L=u?"text":"password";let D;e[39]!==p?(D=p("apiKey"),e[39]=p,e[40]=D):D=e[40];let z;e[41]!==L||e[42]!==D?(z=s.jsx(xe,{type:L,placeholder:"sk-...",...D,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=L,e[42]=D,e[43]=z):z=e[43];let R;e[44]!==u?(R=()=>d(!u),e[44]=u,e[45]=R):R=e[45];let K;e[46]!==u||e[47]!==a?(K=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=u,e[47]=a,e[48]=K):K=e[48];let W;e[49]!==u?(W=u?s.jsx(it,{size:14}):s.jsx(rt,{size:14}),e[49]=u,e[50]=W):W=e[50];let H;e[51]!==R||e[52]!==K||e[53]!==W?(H=s.jsx("button",{type:"button",onClick:R,"aria-label":K,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:W}),e[51]=R,e[52]=K,e[53]=W,e[54]=H):H=e[54];let Q;e[55]!==z||e[56]!==H?(Q=s.jsxs("div",{className:"relative",children:[z,H]}),e[55]=z,e[56]=H,e[57]=Q):Q=e[57];let J;e[58]!==b.apiKey?(J=b.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[58]=b.apiKey,e[59]=J):J=e[59];let X;e[60]!==P||e[61]!==Q||e[62]!==J?(X=s.jsxs("div",{className:"space-y-1",children:[P,Q,J]}),e[60]=P,e[61]=Q,e[62]=J,e[63]=X):X=e[63];let F;e[64]!==I?(F=I&&s.jsx("p",{className:"text-xs text-destructive",children:I.message}),e[64]=I,e[65]=F):F=e[65];let q;e[66]!==a?(q=a("settings.connectForms.cancel"),e[66]=a,e[67]=q):q=e[67];let Y;e[68]!==M||e[69]!==i||e[70]!==q?(Y=s.jsx(de,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:M,children:q}),e[68]=M,e[69]=i,e[70]=q,e[71]=Y):Y=e[71];let Z;e[72]!==M||e[73]!==a?(Z=a(M?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=M,e[73]=a,e[74]=Z):Z=e[74];let A;e[75]!==M||e[76]!==Z?(A=s.jsx(de,{type:"submit",size:"sm",disabled:M,children:Z}),e[75]=M,e[76]=Z,e[77]=A):A=e[77];let $;e[78]!==Y||e[79]!==A?($=s.jsxs(tt,{children:[Y,A]}),e[78]=Y,e[79]=A,e[80]=$):$=e[80];let G;return e[81]!==O||e[82]!==X||e[83]!==F||e[84]!==$||e[85]!==k?(G=s.jsxs("form",{onSubmit:k,className:"space-y-3",children:[O,X,F,$]}),e[81]=O,e[82]=X,e[83]=F,e[84]=$,e[85]=k,e[86]=G):G=e[86],G}const Cs=Ye({label:je().optional(),baseUrl:je().min(1,"Base URL is required"),apiKey:je().optional()});function Is(l){const e=V.c(105),{preset:t,onCancel:i,onSuccess:n}=l,{org:o}=be(),r=Ce(),c=_e(),[u,d]=U.useState(!1),a=ie();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=Qe(Cs),e[0]=h):h=e[0];const p=t?.defaultBaseUrl??"";let m;e[1]!==p?(m={resolver:h,defaultValues:{label:"",baseUrl:p,apiKey:""}},e[1]=p,e[2]=m):m=e[2];const{register:f,handleSubmit:b,formState:N}=Je(m),{errors:y}=N;let j;e[3]!==t||e[4]!==r?(j=async he=>{const bt=JSON.stringify({baseUrl:he.baseUrl,apiKey:he.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:he.label||t?.name||he.baseUrl,apiKey:bt,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=j):j=e[5];let C;e[6]!==n||e[7]!==o||e[8]!==c||e[9]!==a?(C=()=>{c.invalidateQueries({queryKey:fe.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:fe.aiProviders(o.id)}),me.success(a("settings.connectForms.connectionSavedSuccess")),n()},e[6]=n,e[7]=o,e[8]=c,e[9]=a,e[10]=C):C=e[10];let E;e[11]!==a?(E=he=>{me.error(a("settings.connectForms.failedSaveConnection",{error:he.message}))},e[11]=a,e[12]=E):E=e[12];let M;e[13]!==j||e[14]!==C||e[15]!==E?(M={mutationFn:j,onSuccess:C,onError:E},e[13]=j,e[14]=C,e[15]=E,e[16]=M):M=e[16];const{mutate:I,isPending:x,error:k}=ke(M);let w;e[17]!==t||e[18]!==a?(w=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=a,e[19]=w):w=e[19];const _=w;let v;e[20]!==t?.baseUrlPlaceholder||e[21]!==a?(v=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=a,e[22]=v):v=e[22];const g=v;let S;e[23]!==I?(S=he=>I(he),e[23]=I,e[24]=S):S=e[24];let O;e[25]!==b||e[26]!==S?(O=b(S),e[25]=b,e[26]=S,e[27]=O):O=e[27];let T;e[28]!==a?(T=a("settings.connectForms.labelField"),e[28]=a,e[29]=T):T=e[29];let P;e[30]!==T?(P=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[30]=T,e[31]=P):P=e[31];let L;e[32]!==f?(L=f("label"),e[32]=f,e[33]=L):L=e[33];let D;e[34]!==_||e[35]!==L?(D=s.jsx(xe,{placeholder:_,...L,className:"h-8 text-sm"}),e[34]=_,e[35]=L,e[36]=D):D=e[36];let z;e[37]!==P||e[38]!==D?(z=s.jsxs("div",{className:"space-y-1",children:[P,D]}),e[37]=P,e[38]=D,e[39]=z):z=e[39];let R;e[40]!==g||e[41]!==y||e[42]!==t?.defaultBaseUrl||e[43]!==f||e[44]!==a?(R=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...f("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),s.jsx(xe,{type:"url",placeholder:g,...f("baseUrl"),className:"h-8 text-sm"}),y.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[40]=g,e[41]=y,e[42]=t?.defaultBaseUrl,e[43]=f,e[44]=a,e[45]=R):R=e[45];let K;e[46]!==a?(K=a("settings.connectForms.apiKeyField"),e[46]=a,e[47]=K):K=e[47];let W;e[48]!==t?.apiKeyRecommended||e[49]!==a?(W=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=a,e[50]=W):W=e[50];let H;e[51]!==W?(H=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",W,")"]}),e[51]=W,e[52]=H):H=e[52];let Q;e[53]!==K||e[54]!==H?(Q=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[K," ",H]}),e[53]=K,e[54]=H,e[55]=Q):Q=e[55];const J=u?"text":"password";let X;e[56]!==f?(X=f("apiKey"),e[56]=f,e[57]=X):X=e[57];let F;e[58]!==J||e[59]!==X?(F=s.jsx(xe,{type:J,placeholder:"sk-...",...X,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=J,e[59]=X,e[60]=F):F=e[60];let q;e[61]!==u?(q=()=>d(!u),e[61]=u,e[62]=q):q=e[62];let Y;e[63]!==u||e[64]!==a?(Y=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=u,e[64]=a,e[65]=Y):Y=e[65];let Z;e[66]!==u?(Z=u?s.jsx(it,{size:14}):s.jsx(rt,{size:14}),e[66]=u,e[67]=Z):Z=e[67];let A;e[68]!==q||e[69]!==Y||e[70]!==Z?(A=s.jsx("button",{type:"button",onClick:q,"aria-label":Y,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Z}),e[68]=q,e[69]=Y,e[70]=Z,e[71]=A):A=e[71];let $;e[72]!==F||e[73]!==A?($=s.jsxs("div",{className:"relative",children:[F,A]}),e[72]=F,e[73]=A,e[74]=$):$=e[74];let G;e[75]!==Q||e[76]!==$?(G=s.jsxs("div",{className:"space-y-1",children:[Q,$]}),e[75]=Q,e[76]=$,e[77]=G):G=e[77];let B;e[78]!==t?(B=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=B):B=e[79];let te;e[80]!==k?(te=k&&s.jsx("p",{className:"text-xs text-destructive",children:k.message}),e[80]=k,e[81]=te):te=e[81];let le;e[82]!==a?(le=a("settings.connectForms.cancel"),e[82]=a,e[83]=le):le=e[83];let ne;e[84]!==x||e[85]!==i||e[86]!==le?(ne=s.jsx(de,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:le}),e[84]=x,e[85]=i,e[86]=le,e[87]=ne):ne=e[87];let oe;e[88]!==x||e[89]!==a?(oe=a(x?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=x,e[89]=a,e[90]=oe):oe=e[90];let re;e[91]!==x||e[92]!==oe?(re=s.jsx(de,{type:"submit",size:"sm",disabled:x,children:oe}),e[91]=x,e[92]=oe,e[93]=re):re=e[93];let ae;e[94]!==ne||e[95]!==re?(ae=s.jsxs(tt,{children:[ne,re]}),e[94]=ne,e[95]=re,e[96]=ae):ae=e[96];let ee;return e[97]!==O||e[98]!==z||e[99]!==R||e[100]!==G||e[101]!==B||e[102]!==te||e[103]!==ae?(ee=s.jsxs("form",{onSubmit:O,className:"space-y-3",children:[z,R,G,B,te,ae]}),e[97]=O,e[98]=z,e[99]=R,e[100]=G,e[101]=B,e[102]=te,e[103]=ae,e[104]=ee):ee=e[104],ee}const _s={kind:"closed"};function Ms(l,e){switch(e.type){case"open":return l.kind==="closed"?{kind:"grid"}:l;case"close":return{kind:"closed"};case"back":switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return l}case"select-form":return l.kind!=="grid"?l:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return l.kind!=="grid"?l:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return l.kind==="oauth-pending"?{kind:"grid"}:l;case"select-provision":return l.kind!=="grid"?l:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return l.kind!=="provision-pending"?l:{kind:"provision-error",providerId:l.providerId,error:e.error};case"retry-provision":return l.kind!=="provision-error"?l:{kind:"provision-pending",providerId:l.providerId}}}function Es(l){switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return l.providerId;default:return null}}function Os({open:l,onOpenChange:e,initialProvider:t}){const i=ie(),o=Ae()?.providers??[],{org:r}=be(),c=Ce(),u=_e(),[d,a]=U.useReducer(Ms,_s),h=U.useRef(!1);U.useEffect(()=>{l&&d.kind==="closed"?a({type:"open"}):!l&&d.kind!=="closed"&&a({type:"close"})},[l,d.kind]);const p=()=>{h.current=!1,a({type:"close"}),e(!1)},m=()=>{u.invalidateQueries({queryKey:fe.aiProviderKeys(r.id)}),u.invalidateQueries({queryKey:fe.aiProviders(r.id)})},{mutate:f}=ke({mutationFn:async({providerId:v,code:g,stateToken:S,label:O})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:g,stateToken:S,label:O}),v),onSuccess:v=>{ue("ai_provider_oauth_succeeded",{provider_id:v}),m();const g=o.find(S=>S.id===v);me.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ue("ai_provider_oauth_failed",{provider_id:g.providerId,error:v.message}),me.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),a({type:"oauth-failed"})}}),{mutate:b}=ke({mutationFn:async v=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{ue("ai_provider_provision_succeeded",{provider_id:v}),m();const g=o.find(S=>S.id===v);me.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:g?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(v,g)=>{ue("ai_provider_provision_failed",{provider_id:g,error:v.message}),a({type:"provision-error",error:v.message})}}),N=async v=>{const{provider:g}=v,S=v.kind==="openai-compatible"?v.preset?.id??null:null,O=g.supportedMethods.includes("oauth-pkce"),T=g.supportedMethods.includes("api-key");if(g.supportsProvision===!0){ue("ai_provider_connect_clicked",{provider_id:g.id,method:"provision"}),a({type:"select-provision",providerId:g.id}),b(g.id);return}if(O){ue("ai_provider_connect_clicked",{provider_id:g.id,method:"oauth-pkce"});try{const L=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:g.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!L?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:g.id,stateToken:L.stateToken}),window.open(L.url,"AiProviderOAuth","width=600,height=700")}catch(L){me.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:L instanceof Error?L.message:String(L)}))}return}T&&(ue("ai_provider_connect_clicked",{provider_id:g.id,...S!==null?{preset_id:S}:{},method:"api-key"}),a({type:"select-form",providerId:g.id,presetId:S}))},y=U.useRef(N);y.current=N;const j=U.useRef(t);j.current=t,U.useEffect(()=>{!j.current||d.kind!=="grid"||h.current||(h.current=!0,y.current(j.current))},[d.kind]);const C=d.kind==="oauth-pending"?d.stateToken:null,E=d.kind==="oauth-pending"?d.providerId:null;U.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const g=d.stateToken,S=d.providerId,O=P=>{if(P.origin!==window.location.origin||P.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:L,stateToken:D}=P.data;if(D!==g){me.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}v=!0;const z=o.find(R=>R.id===S);f({providerId:S,code:L,stateToken:g,label:z?.name??S})};window.addEventListener("message",O);const T=setTimeout(()=>{v||(ue("ai_provider_oauth_timeout",{provider_id:S}),a({type:"oauth-failed"}),me.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",O),clearTimeout(T)}},[d.kind,C,E,f]);const M=Es(d),I=M?o.find(v=>v.id===M):null,k=(d.kind==="form"&&d.presetId?Se(d.presetId):null)?.name??I?.name??i("settings.connectProviderDialog.defaultTitle"),w=d.kind!=="grid"&&d.kind!=="closed",_=()=>{t?p():a({type:"back"})};return s.jsx(Me,{open:d.kind!=="closed",onOpenChange:v=>!v&&p(),children:s.jsxs(Ee,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(Ze,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[w&&s.jsx(de,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:_,children:s.jsx(lt,{size:16})}),s.jsx(Oe,{children:k})]}),d.kind==="grid"&&!t&&s.jsx(et,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(dt,{providers:o,onSelect:N}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(Is,{preset:d.presetId?Se(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}}):s.jsx(ws,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{m(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Ie,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Ie,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Yt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(de,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(de,{size:"sm",onClick:()=>{a({type:"retry-provision"}),b(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function Ls(){const l=V.c(7),{org:e}=be(),t=Ce();let i;l[0]!==e.id?(i=fe.defaultBrand(e.id),l[0]=e.id,l[1]=i):i=l[1];let n;l[2]!==t?(n=async()=>{const{items:c}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(c)?c:[]).find(As)??null},l[2]=t,l[3]=n):n=l[3];let o;l[4]!==i||l[5]!==n?(o={queryKey:i,queryFn:n},l[4]=i,l[5]=n,l[6]=o):o=l[6];const{data:r}=St(o);return r??null}function As(l){return l.isDefault&&!l.archivedAt}function Ps(l){const e=l.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(n=>typeof n=="object"&&n!==null&&"label"in n&&/primary|brand|main/i.test(n.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Ts(l){const e=V.c(74);let t;e[0]!==l?(t=l===void 0?{}:l,e[0]=l,e[1]=t):t=e[1];const{title:i,description:n,onLocalRuntimePicked:o}=t,r=ie(),{org:c}=be(),{localMode:u}=jt(),d=Ls(),a=st(),h=Lt(),[p,m]=U.useState(null),[f,b]=U.useState(!1),[N,y]=U.useState(!1),[j,C]=U.useState(!1),E=ts();let M;e[2]!==E||e[3]!==a.online?(M=Zt()&&!E&&!a.online,e[2]=E,e[3]=a.online,e[4]=M):M=e[4];const I=M,x=Ae();let k;e[5]!==x?.providers?(k=x?.providers??[],e[5]=x?.providers,e[6]=k):k=e[6];const w=k;let _,v,g;if(e[7]!==d||e[8]!==h||e[9]!==n||e[10]!==a.capabilities||e[11]!==a.online||e[12]!==u||e[13]!==I||e[14]!==o||e[15]!==c.name||e[16]!==r||e[17]!==i){const H=[];if(a.online){if(a.capabilities.includes("claude-code")){let ee;e[21]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(ge,{size:16}),e[21]=ee):ee=e[21],H.push({option:"claude-code-desktop",label:"Claude Code",icon:ee})}if(a.capabilities.includes("codex")){let ee;e[22]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(ve,{size:16}),e[22]=ee):ee=e[22],H.push({option:"codex-desktop",label:"Codex",icon:ee})}}const Q=H.length>0&&h!==null,J=c.name;let X;e[23]!==d?(X=d?Ps(d):null,e[23]=d,e[24]=X):X=e[24];const F=X,q=d?.favicon??d?.logo??null;let Y;e[25]!==J||e[26]!==r||e[27]!==i?(Y=i??(J?r("chat.noAiProviderEmptyState.headingWithOrg",{org:J}):r("chat.noAiProviderEmptyState.headingDefault")),e[25]=J,e[26]=r,e[27]=i,e[28]=Y):Y=e[28];const Z=Y;let A;e[29]!==n||e[30]!==Q||e[31]!==u||e[32]!==r?(A=n??r(Q?"chat.noAiProviderEmptyState.subtitleWithDesktop":u?"chat.noAiProviderEmptyState.subtitleLocalMode":"chat.noAiProviderEmptyState.subtitleDefault"),e[29]=n,e[30]=Q,e[31]=u,e[32]=r,e[33]=A):A=e[33];const $=A,G=!!(q||F);let B;e[34]!==F?(B=F?{backgroundColor:`${F}18`,borderColor:`${F}30`}:void 0,e[34]=F,e[35]=B):B=e[35];const te=B,le=G?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";_="flex flex-col items-center gap-8 w-full max-w-3xl px-4";let ne;e[36]!==le||e[37]!==te||e[38]!==q||e[39]!==a.online||e[40]!==I||e[41]!==F||e[42]!==r?(ne=q?s.jsx("div",{className:le,style:te,children:s.jsx("img",{src:q,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>I?C(!0):y(!0),"aria-label":I?r("downloadApp.openLabel"):a.online?r("chat.noAiProviderEmptyState.desktopLinkedLabel"):r("chat.noAiProviderEmptyState.connectDesktopLabel"),className:ce(le,"cursor-pointer transition-colors hover:bg-accent"),style:te,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(Xt,{size:24,style:F?{color:F}:void 0,className:ce(!F&&"text-muted-foreground")}),a.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[36]=le,e[37]=te,e[38]=q,e[39]=a.online,e[40]=I,e[41]=F,e[42]=r,e[43]=ne):ne=e[43];let oe;e[44]!==Z?(oe=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:Z}),e[44]=Z,e[45]=oe):oe=e[45];let re;e[46]!==$?(re=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:$}),e[46]=$,e[47]=re):re=e[47];let ae;e[48]!==oe||e[49]!==re?(ae=s.jsxs("div",{className:"space-y-2",children:[oe,re]}),e[48]=oe,e[49]=re,e[50]=ae):ae=e[50],e[51]!==ne||e[52]!==ae?(v=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[ne,ae]}),e[51]=ne,e[52]=ae,e[53]=v):v=e[53],g=Q&&s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:H.map(ee=>s.jsxs(de,{variant:"default",className:"gap-2",onClick:()=>{h?.setPendingAgentOption(ee.option),o?.(ee.option)},children:[ee.icon,r("chat.noAiProviderEmptyState.useLabel",{label:ee.label})]},ee.option))}),s.jsxs("div",{className:"flex items-center gap-3 w-full max-w-xs text-xs text-muted-foreground",children:[s.jsx("span",{className:"h-px flex-1 bg-border"}),r("chat.noAiProviderEmptyState.orConnectProvider"),s.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),e[7]=d,e[8]=h,e[9]=n,e[10]=a.capabilities,e[11]=a.online,e[12]=u,e[13]=I,e[14]=o,e[15]=c.name,e[16]=r,e[17]=i,e[18]=_,e[19]=v,e[20]=g}else _=e[18],v=e[19],g=e[20];let S,O;e[54]===Symbol.for("react.memo_cache_sentinel")?(S=H=>m(H),O=()=>b(!0),e[54]=S,e[55]=O):(S=e[54],O=e[55]);let T;e[56]!==w?(T=s.jsx("div",{className:"w-full",children:s.jsx(dt,{providers:w,onSelect:S,onShowAll:O})}),e[56]=w,e[57]=T):T=e[57];const P=p!==null||f;let L;e[58]===Symbol.for("react.memo_cache_sentinel")?(L=H=>{H||(m(null),b(!1))},e[58]=L):L=e[58];const D=p??void 0;let z;e[59]!==P||e[60]!==D?(z=s.jsx(Os,{open:P,onOpenChange:L,initialProvider:D}),e[59]=P,e[60]=D,e[61]=z):z=e[61];let R;e[62]!==N?(R=s.jsx(rs,{open:N,onOpenChange:y}),e[62]=N,e[63]=R):R=e[63];let K;e[64]!==j?(K=s.jsx(es,{open:j,onOpenChange:C}),e[64]=j,e[65]=K):K=e[65];let W;return e[66]!==z||e[67]!==R||e[68]!==K||e[69]!==_||e[70]!==v||e[71]!==g||e[72]!==T?(W=s.jsxs("div",{className:_,children:[v,g,T,z,R,K]}),e[66]=z,e[67]=R,e[68]=K,e[69]=_,e[70]=v,e[71]=g,e[72]=T,e[73]=W):W=e[73],W}function Te(l){const e=l.title.includes(": ");return{provider:e?l.title.split(": ")[0]??"":l.modelId.split("/")[0]??"",displayName:e?l.title.split(": ").slice(1).join(": "):l.title}}function Ds(l){return l<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:l<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:l<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const zs=["bg-destructive","bg-warning","bg-success","bg-success"],Rs=["text-success","text-warning","text-warning","text-destructive"];function Ks(l,e){const t=Math.round(l*.75/1e3),i=t>=1?`${t}K`:`${Math.round(l*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Fs(l){return l<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:l<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:l<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const $s={text:{icon:s.jsx(Wt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Bt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Kt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx(Ut,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(ls,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(nt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function Us(l){const e=V.c(10),{capability:t}=l,i=ie(),n=$s[t];if(n){const u=n.icon;let d;e[0]!==n.labelKey||e[1]!==i?(d=i(n.labelKey),e[0]=n.labelKey,e[1]=i,e[2]=d):d=e[2];let a;return e[3]!==n.icon||e[4]!==d?(a=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[u,d]}),e[3]=n.icon,e[4]=d,e[5]=a):a=e[5],a}let o;e[6]!==t?(o=t.charAt(0).toUpperCase(),e[6]=t,e[7]=o):o=e[7];const r=o+t.slice(1);let c;return e[8]!==r?(c=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=c):c=e[9],c}function Bs(l){const e=V.c(59),{model:t,compact:i}=l,n=i===void 0?!1:i,o=ie();if(!t){let x;e[0]!==o?(x=o("chat.shared.hoverToPreview"),e[0]=o,e[1]=x):x=e[1];let k;return e[2]!==x?(k=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=k):k=e[3],k}const r=t.costs?.input!=null?t.costs.input*1e6:null,c=t.costs?.output!=null?t.costs.output*1e6:null;let u;e[4]!==t?(u=Te(t),e[4]=t,e[5]=u):u=e[5];const{provider:d,displayName:a}=u;if(n){let x;e[6]!==t.limits||e[7]!==o?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",o("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=o,e[8]=x):x=e[8];let k;e[9]!==r||e[10]!==o?(k=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=o,e[11]=k):k=e[11];let w;e[12]!==c||e[13]!==o?(w=c!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=o,e[14]=w):w=e[14];let _;e[15]!==t.limits||e[16]!==o?(_=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",o("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=o,e[17]=_):_=e[17];let v;return e[18]!==x||e[19]!==k||e[20]!==w||e[21]!==_?(v=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,k,w,_]}),e[18]=x,e[19]=k,e[20]=w,e[21]=_,e[22]=v):v=e[22],v}let h;e[23]!==d?(h=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=h):h=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let m;e[28]!==a?(m=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=m):m=e[29];let f;e[30]!==p||e[31]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,m]}),e[30]=p,e[31]=m,e[32]=f):f=e[32];let b;e[33]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=b):b=e[34];let N;e[35]!==h||e[36]!==f||e[37]!==b?(N=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[h,f,b]}),e[35]=h,e[36]=f,e[37]=b,e[38]=N):N=e[38];let y;e[39]!==t.capabilities?(y=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(Ws)}),e[39]=t.capabilities,e[40]=y):y=e[40];let j;e[41]!==t.limits||e[42]!==o?(j=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:k,descriptionKey:w}=Ds(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(_=>s.jsx("div",{className:ce("w-2 h-2 rounded-full",_<=x?zs[x-1]:"bg-muted")},_))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:o(k)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",o(w)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",o("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=o,e[43]=j):j=e[43];let C;e[44]!==t.limits||e[45]!==o?(C=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",o("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Ks(t.limits.maxOutputTokens,o)})]})]}),e[44]=t.limits,e[45]=o,e[46]=C):C=e[46];let E;e[47]!==r||e[48]!==c||e[49]!==o?(E=(r!=null||c!=null)&&(()=>{const{level:x,labelKey:k}=r!=null?Fs(r):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.pricing")}),r!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(w=>s.jsx("span",{className:ce("text-sm font-bold leading-none",w<=x?Rs[x-1]:"text-muted-foreground/20"),children:"$"},w))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:k?o(k):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",o("chat.shared.tokens")]})]}),c!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",o("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=c,e[49]=o,e[50]=E):E=e[50];let M;e[51]!==j||e[52]!==C||e[53]!==E?(M=s.jsxs("div",{className:"flex flex-col gap-6",children:[j,C,E]}),e[51]=j,e[52]=C,e[53]=E,e[54]=M):M=e[54];let I;return e[55]!==M||e[56]!==N||e[57]!==y?(I=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[N,y,M]}),e[55]=M,e[56]=N,e[57]=y,e[58]=I):I=e[58],I}function Ws(l){return s.jsx(Us,{capability:l},l)}function ut(l){const e=V.c(22),{model:t,placeholder:i,isLoading:n}=l,o=n===void 0?!1:n,r=ie();let c;e[0]!==i||e[1]!==r?(c=i??r("chat.shared.selectModel"),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;if(o){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(se,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(se,{className:"w-16 h-3 hidden md:block"})]}),e[3]=y):y=e[3],y}if(!t){let y;e[4]!==u?(y=s.jsx("span",{className:"text-sm text-muted-foreground",children:u}),e[4]=u,e[5]=y):y=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Ke,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=j):j=e[6];let C;return e[7]!==y?(C=s.jsxs("div",{className:"flex items-center gap-1.5",children:[y,j]}),e[7]=y,e[8]=C):C=e[8],C}let d;e[9]!==t?(d=Te(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let h;e[11]!==t?(h=Pe(t),e[11]=t,e[12]=h):h=e[12];const p=h;let m;e[13]!==t.title||e[14]!==p?(m=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=m):m=e[15];let f;e[16]!==a?(f=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=f):f=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Ke,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=b):b=e[18];let N;return e[19]!==m||e[20]!==f?(N=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[m,f,b]}),e[19]=m,e[20]=f,e[21]=N):N=e[21],N}const Vs=["vision","image","file","audio","video"],mt=["image/png","image/jpeg","image/gif","image/webp"],ht=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function De(l){const e=l?.capabilities;return e?Vs.some(t=>e.includes(t)):!1}function ol(l,e){if(!l)return!1;if(l.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),n=t.includes("file"),o=t.includes("audio"),r=t.includes("video");return!!(i&&mt.includes(l)||n&&l==="application/pdf"||o&&l.startsWith("audio/")||r&&l.startsWith("video/")||De(e)&&ht.includes(l))}function rl(l){const e=l?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...mt),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),De(l)&&t.push(...ht),t.join(",")}function al(l){const e=l?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),De(l)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const ft=["smarter","faster","cheaper"],Hs={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},qs=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Gs=qs.flatMap(({tier:l,prefixes:e})=>e.map(t=>({tier:l,prefix:t}))).sort((l,e)=>e.prefix.length-l.prefix.length),Xs="google/gemini-2.5-pro",qe=new Map;function Ys(l){const e=qe.get(l);if(e!==void 0)return e;let t=null;if(l.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:n}of Gs)if(l.startsWith(n)){if(n===Xs&&l.length>n.length&&l[n.length]==="-"){const r=l[n.length+1];if(!r||!/\d/.test(r))continue}t=i;break}return qe.set(l,t),t}function Ge(l){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of l){const i=Ys(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,n)=>i.title.localeCompare(n.title));return e}const pt="studio:model-shortlist:",Qs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Js(l){try{const e=localStorage.getItem(pt+l);return e?new Set(JSON.parse(e)):null}catch{return null}}function Zs(l,e){localStorage.setItem(pt+l,JSON.stringify([...e]))}function ei(l){const e=V.c(21),{model:t,onHover:i}=l;let n;e[0]!==t?(n=Te(t),e[0]=t,e[1]=n):n=e[1];const{displayName:o,provider:r}=n;let c;e[2]!==t?(c=Pe(t),e[2]=t,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==u?(a=s.jsx("img",{src:u,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=u,e[9]=a):a=e[9];let h;e[10]!==o?(h=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=h):h=e[11];let p;e[12]!==r?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let m;e[14]!==h||e[15]!==p?(m=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[h,p]}),e[14]=h,e[15]=p,e[16]=m):m=e[16];let f;return e[17]!==d||e[18]!==a||e[19]!==m?(f=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,m]}),e[17]=d,e[18]=a,e[19]=m,e[20]=f):f=e[20],f}function ti(l){const e=V.c(16),{error:t,onRetry:i}=l,n=ie();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(wt,{className:"size-5 text-destructive"})}),e[0]=o):o=e[0];const r=n("chat.decopilot.failedToLoadModels");let c;e[1]!==r?(c=s.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=c):c=e[2];const u=t?.message||n("chat.decopilot.couldNotFetchModels"),d=" "+n("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==u||e[4]!==d?(a=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[u,d]}),e[3]=u,e[4]=d,e[5]=a):a=e[5];let h;e[6]!==c||e[7]!==a?(h=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,a]}),e[6]=c,e[7]=a,e[8]=h):h=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx($t,{className:"size-3.5"}),e[9]=p):p=e[9];const m=n("chat.decopilot.retry");let f;e[10]!==i||e[11]!==m?(f=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(de,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,m]})}),e[10]=i,e[11]=m,e[12]=f):f=e[12];let b;return e[13]!==f||e[14]!==h?(b=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[o,h,f]}),e[13]=f,e[14]=h,e[15]=b):b=e[15],b}function si(){const l=V.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(ii)}),l[0]=e):e=l[0],e}function ii(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(se,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(se,{className:"flex-1 h-4"}),s.jsx(se,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Xe(l){const e=V.c(12),{label:t,models:i,onSelect:n,onHover:o}=l;if(i.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==i||e[3]!==o||e[4]!==n){let d;e[6]!==o||e[7]!==n?(d=a=>s.jsx("div",{onClick:()=>n(a),className:"cursor-pointer",children:s.jsx(ei,{model:a,onHover:o})},a.modelId),e[6]=o,e[7]=n,e[8]=d):d=e[8],c=i.map(d),e[2]=i,e[3]=o,e[4]=n,e[5]=c}else c=e[5];let u;return e[9]!==r||e[10]!==c?(u=s.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function we(l,e){return e(l==="other"?"chat.decopilot.tierOther":Hs[l])}function li(l){const e=V.c(21),{model:t,isChecked:i,onToggle:n,onHover:o}=l,[r,c]=U.useState(i);r!==i&&c(i);let u;e[0]!==t?(u=Pe(t),e[0]=t,e[1]=u):u=e[1];const d=u;let a;e[2]!==t||e[3]!==o?(a=()=>o(t),e[2]=t,e[3]=o,e[4]=a):a=e[4];let h;e[5]!==t.modelId||e[6]!==n?(h=()=>{c(ni),n(t.modelId)},e[5]=t.modelId,e[6]=n,e[7]=h):h=e[7];let p;e[8]!==r||e[9]!==h?(p=s.jsx(At,{checked:r,onCheckedChange:h}),e[8]=r,e[9]=h,e[10]=p):p=e[10];let m;e[11]!==d||e[12]!==t.title?(m=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=m):m=e[13];let f;e[14]!==t.title?(f=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let b;return e[16]!==a||e[17]!==p||e[18]!==m||e[19]!==f?(b=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,m,f]}),e[16]=a,e[17]=p,e[18]=m,e[19]=f,e[20]=b):b=e[20],b}function ni(l){return!l}function oi(l,e){const t=[];for(const i of ft)if(l[i].length>0){t.push({type:"header",label:we(i,e)});for(const n of l[i])t.push({type:"model",model:n})}if(l.other.length>0){t.push({type:"header",label:we("other",e)});for(const i of l.other)t.push({type:"model",model:i})}return t}function ri({items:l,shortlistSet:e,onToggle:t,onHover:i}){const n=U.useRef(null),o=bs({count:l.length,getScrollElement:()=>n.current,estimateSize:r=>l[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:n,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const c=l[r.index];return c?s.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):s.jsx(li,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:i})},r.key):null})})})}function ai(l){const e=V.c(30),{keyId:t,searchTerm:i,onHover:n,onModelSelect:o,managing:r,onToggleManage:c,filterModels:u}=l,d=ie(),{models:a}=Gt(t),h=u?a.filter(u):a.filter(ci);let p;e[0]!==t?(p=()=>(t?Js(t):null)??Qs,e[0]=t,e[1]=p):p=e[1];const[m,f]=U.useState(p),[,b]=U.useTransition();let N;e[2]!==t||e[3]!==b?(N=g=>{t&&b(()=>{f(S=>{const O=new Set(S);return O.has(g)?O.delete(g):O.add(g),Zs(t,O),O})})},e[2]=t,e[3]=b,e[4]=N):N=e[4];const y=N,j=i.toLowerCase().trim(),C=g=>j?g.filter(S=>S.title.toLowerCase().includes(j)||S.modelId.toLowerCase().includes(j)):g;if(r){const g=Ge(C(h)),S=oi(g,d);let O;e[5]!==m?(O=z=>m.has(z.modelId),e[5]=m,e[6]=O):O=e[6];const T=h.filter(O).length;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(lt,{size:14}),e[7]=P):P=e[7];let L;e[8]!==d?(L=d("chat.decopilot.back"),e[8]=d,e[9]=L):L=e[9];let D;return e[10]!==c||e[11]!==L?(D=s.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[P,L]}),e[10]=c,e[11]=L,e[12]=D):D=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[D,s.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:T})})]}),s.jsx(ri,{items:S,shortlistSet:m,onToggle:y,onHover:n})]})}let E;e[13]!==m?(E=g=>m.has(g.modelId),e[13]=m,e[14]=E):E=e[14];const M=h.filter(E),I=M.length>0?M:h,x=Ge(C(I));let k;e[15]!==x||e[16]!==n||e[17]!==o||e[18]!==d?(k=ft.map(g=>s.jsx(Xe,{label:we(g,d),models:x[g],onSelect:o,onHover:n},g)),e[15]=x,e[16]=n,e[17]=o,e[18]=d,e[19]=k):k=e[19];let w;e[20]!==d?(w=we("other",d),e[20]=d,e[21]=w):w=e[21];let _;e[22]!==x.other||e[23]!==n||e[24]!==o||e[25]!==w?(_=s.jsx(Xe,{label:w,models:x.other,onSelect:o,onHover:n}),e[22]=x.other,e[23]=n,e[24]=o,e[25]=w,e[26]=_):_=e[26];let v;return e[27]!==k||e[28]!==_?(v=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[k,_]}),e[27]=k,e[28]=_,e[29]=v):v=e[29],v}function ci(l){return l.asyncResearch!==!0}function di(){const l=V.c(6);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(se,{className:"size-4 shrink-0"}),s.jsx(se,{className:"flex-1 h-6"}),s.jsx(se,{className:"w-[140px] h-8 shrink-0"})]})}),l[0]=e):e=l[0];let t;l[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(ui)})]}),l[1]=t):t=l[1];let i;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(se,{className:"size-6 shrink-0"}),s.jsx(se,{className:"h-6 w-32"})]}),l[2]=i):i=l[2];let n;l[3]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{className:"h-6 w-20 rounded-md"}),s.jsx(se,{className:"h-6 w-24 rounded-md"})]})]}),l[3]=n):n=l[3];let o;l[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(se,{className:"h-4 w-24"}),s.jsx(se,{className:"h-4 w-32"})]}),l[4]=o):o=l[4];let r;return l[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[n,s.jsxs("div",{className:"flex flex-col gap-4",children:[o,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(se,{className:"h-4 w-16"}),s.jsx(se,{className:"h-4 w-40"})]})]})]})})]}),l[5]=r):r=l[5],r}function ui(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(se,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(se,{className:"flex-1 h-4"}),s.jsx(se,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function xt(l){const e=V.c(66),{onClose:t,credentialId:i,onCredentialChange:n,selectedModel:o,onModelChange:r,filterModels:c,compact:u}=l,d=ie(),[a,h]=U.useState(null),[p,m]=U.useState(""),[f,b]=U.useState(!1),N=U.useRef(null),y=Ae(),j=qt();let C;e[0]!==y?.providers?(C=Object.fromEntries((y?.providers??[]).map(fi)),e[0]=y?.providers,e[1]=C):C=e[1];const E=C,M=Nt(),{org:I}=be();let x;e[2]!==n?(x=A=>{n(A),h(null)},e[2]=n,e[3]=x):x=e[3];const k=x;let w;e[4]!==i||e[5]!==t||e[6]!==r?(w=A=>{i&&(r(A),m(""),t())},e[4]=i,e[5]=t,e[6]=r,e[7]=w):w=e[7];const _=w;if(j.length===0){const A=!u&&"sm:w-[740px]";let $;e[8]!==A?($=ce("flex items-center justify-center p-8 w-full",A),e[8]=A,e[9]=$):$=e[9];let G;e[10]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Ts,{}),e[10]=G):G=e[10];let B;return e[11]!==$?(B=s.jsx("div",{className:$,children:G}),e[11]=$,e[12]=B):B=e[12],B}const v=u?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==v?(g=ce("flex flex-col md:flex-row h-full min-h-0",v),e[13]=v,e[14]=g):g=e[14];const S=u?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let O;e[15]!==S?(O=ce("flex-1 flex flex-col min-h-0 overflow-hidden",S),e[15]=S,e[16]=O):O=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx(nt,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=T):T=e[17];let P;e[18]!==f||e[19]!==d?(P=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=P):P=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=A=>m(A.target.value),e[21]=L):L=e[21];let D;e[22]!==p||e[23]!==P?(D=s.jsx(xe,{ref:N,type:"text",placeholder:P,value:p,onChange:L,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=P,e[24]=D):D=e[24];let z;e[25]!==i||e[26]!==k||e[27]!==j||e[28]!==E||e[29]!==d?(z=j.length>0&&s.jsxs(Pt,{value:i??"",onValueChange:k,children:[s.jsxs(Tt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:hi,children:[s.jsx(Dt,{placeholder:d("chat.decopilot.key"),children:(()=>{const A=j.find(le=>le.id===i),$=A?E[A.providerId]:void 0,G=Se(A?.presetId),B=G?.logo??$?.logo,te=G?.name??$?.name??A?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[B?s.jsx("img",{src:B,alt:te,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:te.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:te})]})})()}),s.jsx(Vt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(zt,{children:j.map(A=>{const $=E[A.providerId],G=Se(A.presetId),B=G?.logo??$?.logo,te=G?.name??$?.name??A.providerId;return s.jsx(Rt,{value:A.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[B?s.jsx("img",{src:B,alt:te,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:te.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[te," — ",A.label]})]})},A.id)})})]}),e[25]=i,e[26]=k,e[27]=j,e[28]=E,e[29]=d,e[30]=z):z=e[30];let R;e[31]!==D||e[32]!==z?(R=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[T,D,z]})}),e[31]=D,e[32]=z,e[33]=R):R=e[33];let K;e[34]!==i?(K=A=>{const{error:$,resetError:G}=A;return s.jsx(ti,{error:$,onRetry:G,credentialId:i??void 0})},e[34]=i,e[35]=K):K=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(si,{}),e[36]=W):W=e[36];const H=i??void 0;let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>b(mi),e[37]=Q):Q=e[37];let J;e[38]!==c||e[39]!==_||e[40]!==f||e[41]!==p||e[42]!==H?(J=s.jsx(U.Suspense,{fallback:W,children:s.jsx(ai,{keyId:H,searchTerm:p,onHover:h,onModelSelect:_,managing:f,onToggleManage:Q,filterModels:c})}),e[38]=c,e[39]=_,e[40]=f,e[41]=p,e[42]=H,e[43]=J):J=e[43];let X;e[44]!==i||e[45]!==K||e[46]!==J?(X=s.jsx(kt,{fallback:K,children:J},i),e[44]=i,e[45]=K,e[46]=J,e[47]=X):X=e[47];let F;e[48]!==f||e[49]!==M||e[50]!==I||e[51]!==d?(F=!f&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>U.startTransition(()=>b(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Ft,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>M({to:"/$org/settings/ai-providers",params:{org:I.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Ht,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=M,e[50]=I,e[51]=d,e[52]=F):F=e[52];let q;e[53]!==R||e[54]!==X||e[55]!==F||e[56]!==O?(q=s.jsxs("div",{className:O,children:[R,X,F]}),e[53]=R,e[54]=X,e[55]=F,e[56]=O,e[57]=q):q=e[57];let Y;e[58]!==u||e[59]!==a||e[60]!==o?(Y=!u&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Bs,{model:a??o??null})}),e[58]=u,e[59]=a,e[60]=o,e[61]=Y):Y=e[61];let Z;return e[62]!==q||e[63]!==Y||e[64]!==g?(Z=s.jsxs("div",{className:g,children:[q,Y]}),e[62]=q,e[63]=Y,e[64]=g,e[65]=Z):Z=e[65],Z}function mi(l){return!l}function hi(l){return l.stopPropagation()}function fi(l){return[l.id,l]}function pi(l){const e=V.c(12),{onClose:t}=l,{credentialId:i,setCredentialId:n,selectedModel:o,setModel:r}=Le();let c;e[0]!==n?(c=a=>{ue("chat_credential_changed",{credential_id:a}),n(a)},e[0]=n,e[1]=c):c=e[1];let u;e[2]!==i||e[3]!==o?.modelId||e[4]!==r?(u=a=>{i&&(ue("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),r({...a,keyId:i}))},e[2]=i,e[3]=o?.modelId,e[4]=r,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==o||e[9]!==c||e[10]!==u?(d=s.jsx(xt,{onClose:t,credentialId:i,onCredentialChange:c,selectedModel:o,onModelChange:u}),e[6]=i,e[7]=t,e[8]=o,e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function xi(l){const e=V.c(2),{onClose:t}=l;let i;return e[0]!==t?(i=s.jsx(pi,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function gi(l){const e=V.c(2);let t;return e[0]!==l?(t=s.jsx(xt,{...l}),e[0]=l,e[1]=t):t=e[1],t}const vi=[{tier:"fast",labelKey:"chat.desktopCli.tierFastDescription"},{tier:"smart",labelKey:"chat.desktopCli.tierSmartDescription"},{tier:"thinking",labelKey:"chat.desktopCli.tierThinkingDescription"}];function gt(l){const e=V.c(11),{modelSet:t,selectedModelId:i,onSelect:n}=l,o=ie();let r,c;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==n||e[4]!==i||e[5]!==o){const d=Object.fromEntries(t.models.map(bi));r="flex flex-col p-2 w-[320px]",c=vi.map(a=>{const{tier:h,labelKey:p}=a,m=t.tiers[h];if(!m.modelId)return null;const f=d[m.modelId];if(!f)return null;const b=i===m.modelId;return s.jsxs("button",{type:"button",onClick:()=>n(f),className:ce("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",b&&"bg-accent/50"),children:[s.jsx("img",{src:t.logo,alt:m.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:m.label}),s.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:o(p)})]})]},h)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=n,e[4]=i,e[5]=o,e[6]=r,e[7]=c}else r=e[6],c=e[7];let u;return e[8]!==r||e[9]!==c?(u=s.jsx("div",{className:r,children:c}),e[8]=r,e[9]=c,e[10]=u):u=e[10],u}function bi(l){return[l.modelId,l]}const yi=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 5 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],Ne="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",ji=[{providerId:"codex",modelId:"codex:gpt-5.6-sol",title:"GPT-5.6 Sol",description:"Frontier Codex model for deep reasoning, complex coding, and real-world work",capabilities:["text","reasoning"],logo:Ne,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-terra",title:"GPT-5.6 Terra",description:"Balanced Codex model for everyday coding and agent work",capabilities:["text","reasoning"],logo:Ne,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-luna",title:"GPT-5.6 Luna",description:"Fast Codex model for lightweight coding tasks and titles",capabilities:["text","reasoning"],logo:Ne,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:Ne,limits:null,costs:null}],Si="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",Ni="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg";function ki(l){return{fast:{modelId:"claude-code:haiku",label:l("chat.agentModels.haikuLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(ge,{size:16})},smart:{modelId:"claude-code:sonnet",label:l("chat.agentModels.sonnetLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(ge,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:l("chat.agentModels.opusLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(ge,{size:16})}}}function wi(l){return{fast:{modelId:"codex:gpt-5.6-luna",label:l("chat.agentModels.gptLunaLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(ve,{size:16})},smart:{modelId:"codex:gpt-5.6-terra",label:l("chat.agentModels.gptTerraLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(ve,{size:16})},thinking:{modelId:"codex:gpt-5.6-sol",label:l("chat.agentModels.gptSolLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(ve,{size:16})}}}function vt(l,e){return l==="claude-code"?{logo:Si,tiers:ki(e),models:yi}:l==="codex"?{logo:Ni,tiers:wi(e),models:ji}:null}function Ci(l){const e=V.c(12),{onClose:t,agent:i}=l,n=ie(),o=Le(),r=i??o.pendingHarnessId??"decopilot";let c;e[0]!==r||e[1]!==n?(c=vt(r,n),e[0]=r,e[1]=n,e[2]=c):c=e[2];const u=c;if(!u){let p;return e[3]!==t?(p=s.jsx(xi,{onClose:t}),e[3]=t,e[4]=p):p=e[4],p}const d=o.selectedModel?.modelId??u.tiers[o.simpleModeTier].modelId;let a;e[5]!==t||e[6]!==o?(a=p=>{o.setModel({...p,keyId:void 0}),t()},e[5]=t,e[6]=o,e[7]=a):a=e[7];let h;return e[8]!==u||e[9]!==d||e[10]!==a?(h=s.jsx(gt,{modelSet:u,selectedModelId:d,onSelect:a}),e[8]=u,e[9]=d,e[10]=a,e[11]=h):h=e[11],h}function Ii(l){const e=V.c(14);let t,i;e[0]!==l?({agent:t,...i}=l,e[0]=l,e[1]=t,e[2]=i):(t=e[1],i=e[2]);const n=ie();let o;e[3]!==t||e[4]!==n?(o=t?vt(t,n):null,e[3]=t,e[4]=n,e[5]=o):o=e[5];const r=o;if(!r){let a;return e[6]!==i?(a=s.jsx(gi,{...i}),e[6]=i,e[7]=a):a=e[7],a}const c=i.selectedModel?.modelId??r.tiers.smart.modelId;let u;e[8]!==i?(u=a=>{i.onModelChange(a),i.onClose()},e[8]=i,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==c||e[12]!==u?(d=s.jsx(gt,{modelSet:r,selectedModelId:c,onSelect:u}),e[10]=r,e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function cl(l){const e=V.c(49),{variant:t,className:i,placeholder:n,model:o,isLoading:r,credentialId:c,onCredentialChange:u,onModelChange:d,filterModels:a,agent:h}=l,p=t===void 0?"borderless":t,m=n===void 0?"Select model":n,f=ie(),[b,N]=U.useState(!1),y=d!==void 0,j=Ot(),C=p==="borderless"?"ghost":"outline",E=p==="borderless"&&"md:border-none";let M;e[0]!==i||e[1]!==E?(M=ce("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",E,i),e[0]=i,e[1]=E,e[2]=M):M=e[2];let I;e[3]!==r||e[4]!==o||e[5]!==m||e[6]!==y?(I=y?s.jsx(ut,{model:o??null,placeholder:m,isLoading:r}):s.jsx(Mi,{placeholder:m}),e[3]=r,e[4]=o,e[5]=m,e[6]=y,e[7]=I):I=e[7];let x;e[8]!==C||e[9]!==M||e[10]!==I?(x=s.jsx(de,{variant:C,size:"sm",className:M,children:I}),e[8]=C,e[9]=M,e[10]=I,e[11]=x):x=e[11];const k=x;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(di,{}),e[12]=w):w=e[12];let _;e[13]!==h||e[14]!==c||e[15]!==a||e[16]!==o||e[17]!==u||e[18]!==d||e[19]!==y?(_=s.jsx(U.Suspense,{fallback:w,children:y?s.jsx(Ii,{onClose:()=>N(!1),agent:h,credentialId:c??null,onCredentialChange:u??_i,selectedModel:o??null,onModelChange:d,filterModels:a}):s.jsx(Ci,{onClose:()=>N(!1),agent:h})}),e[13]=h,e[14]=c,e[15]=a,e[16]=o,e[17]=u,e[18]=d,e[19]=y,e[20]=_):_=e[20];const v=_;if(j){let L;e[21]!==k?(L=s.jsx(It,{asChild:!0,children:k}),e[21]=k,e[22]=L):L=e[22];let D;e[23]!==f?(D=f("chat.selectModel.selectModel"),e[23]=f,e[24]=D):D=e[24];let z;e[25]!==D?(z=s.jsx(_t,{className:"sr-only",children:D}),e[25]=D,e[26]=z):z=e[26];let R;e[27]!==v?(R=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v}),e[27]=v,e[28]=R):R=e[28];let K;e[29]!==z||e[30]!==R?(K=s.jsxs(Mt,{className:"p-0 flex flex-col max-h-[95vh]",children:[z,R]}),e[29]=z,e[30]=R,e[31]=K):K=e[31];let W;return e[32]!==b||e[33]!==L||e[34]!==K?(W=s.jsxs(Et,{open:b,onOpenChange:N,children:[L,K]}),e[32]=b,e[33]=L,e[34]=K,e[35]=W):W=e[35],W}let g;e[36]!==k?(g=s.jsx(Ct,{asChild:!0,children:k}),e[36]=k,e[37]=g):g=e[37];let S;e[38]!==f?(S=f("chat.selectModel.selectModel"),e[38]=f,e[39]=S):S=e[39];let O;e[40]!==S?(O=s.jsx(Oe,{className:"sr-only",children:S}),e[40]=S,e[41]=O):O=e[41];let T;e[42]!==v||e[43]!==O?(T=s.jsxs(Ee,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[O,v]}),e[42]=v,e[43]=O,e[44]=T):T=e[44];let P;return e[45]!==b||e[46]!==g||e[47]!==T?(P=s.jsxs(Me,{open:b,onOpenChange:N,children:[g,T]}),e[45]=b,e[46]=g,e[47]=T,e[48]=P):P=e[48],P}function _i(){}function Mi(l){const e=V.c(4),{placeholder:t}=l,{selectedModel:i,isModelsLoading:n}=Le();let o;return e[0]!==n||e[1]!==i||e[2]!==t?(o=s.jsx(ut,{model:i,placeholder:t,isLoading:n}),e[0]=n,e[1]=i,e[2]=t,e[3]=o):o=e[3],o}export{rs as C,di as M,Ts as N,dt as P,Ii as a,ge as b,ve as c,rl as d,cl as e,Se as f,al as g,Os as h,ol as i,nl as l,De as m};
@@ -0,0 +1 @@
1
+ import{W as kt,c as G,r as M,m as pe,j as n,b as ie,k as Ve,B as Y,o as Ee,e as De,K as X,X as Se,Y as le,Z as _e,_ as Ne,n as je,$ as At,t as Fe,x as Ue,p as fe,Q as Ft,E as Lt,a as Dt}from"./index-BwtPwDkT.js";import{W as ut,g as Rt,u as Be,S as Pt}from"./use-mcp-client-FfMc8-rx.js";import{I as Ge}from"./integration-icon-D00h7u0u.js";import{c as he,b as ft,h as pt,a as gt,d as ht,e as xt}from"./dialog-CLRqjexh.js";import{c as Me,T as Qe,a as He}from"./tooltip-DpCQ4VIp.js";import{k as bt,f as Ct,a as $t}from"./agent-icon-D24e3m8a.js";import{u as ne,t as qt,m as Kt,s as lt,g as Ut,p as zt,F as Vt,b as Bt,a as Gt,c as Mt}from"./companions-core-a4SdW3uj.js";import{i as yt}from"./CheckCircle-CKFQ-ojS.js";import{F as ce,a as Oe,b as de,c as ge,d as me,e as ue,f as Qt}from"./form-5ssuGL92.js";import{I as xe}from"./input-CWOf_06B.js";import{i as Ht}from"./Check-Cc1URztt.js";import{a as jt}from"./Copy01-B_uUNvC1.js";import{i as Wt}from"./Settings02-CzZapEug.js";import{s as Yt}from"./Eye-YusYyNwB.js";import{u as Zt}from"./use-debounced-value-B7GbcCk6.js";import{f as vt,a as Xt,p as Jt}from"./provision-repo-scoped-github-connection-CAXumITS.js";import{c as en,e as tn}from"./extract-connection-data-CGhHKZyY.js";import{u as nn}from"./useQueries-_Xy4vtop.js";import{a as on}from"./authenticate-and-persist-oauth-DS1Wi7hh.js";function sn(s,e){return nn({...s,queries:s.queries.map(t=>({...t,suspense:!0,throwOnError:kt,enabled:!0,placeholderData:void 0}))},e)}const rn=/^[a-zA-Z][a-zA-Z\d+.-]*:/,an=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,ln=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,cn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Le(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),o=an.test(e),d=ln.test(e);if(t&&!o&&!d)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const r=o?e:`https://${e}`;let m;try{m=new URL(r)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(m.protocol!=="http:"&&m.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const i=m.hostname.split(".");return i.length<2||i.some(c=>!c||!cn.test(c))?{ok:!1,error:"Enter a valid website URL."}:(m.protocol="https:",{ok:!0,value:m.origin})}function Ao(s,e){if(!s.trim())return!0;const t=Le(s);if(!t.ok||!e)return!1;const o=Le(e);return o.ok&&o.value===t.value}function Fo(s){if(!s)return null;const e=Le(s);return e.ok?new URL(e.value).hostname:null}function dn(s){const e=G.c(14),{children:t,className:o,wrapperClassName:d}=s,[r,m]=M.useState(!0);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=v=>{if(!v)return;const b=()=>{const g=v.scrollHeight-v.scrollTop-v.clientHeight<8;m(g)};b(),v.addEventListener("scroll",b,{passive:!0});const p=new ResizeObserver(b);p.observe(v);for(const g of Array.from(v.children))p.observe(g);return()=>{v.removeEventListener("scroll",b),p.disconnect()}},e[0]=i):i=e[0];const c=i;let h;e[1]!==d?(h=pe("relative",d),e[1]=d,e[2]=h):h=e[2];let a;e[3]!==t||e[4]!==o?(a=n.jsx("div",{ref:c,className:o,children:t}),e[3]=t,e[4]=o,e[5]=a):a=e[5];const l=r?"opacity-0":"opacity-100";let f;e[6]!==l?(f=pe("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",l),e[6]=l,e[7]=f):f=e[7];let u;e[8]!==f?(u=n.jsx("div",{"aria-hidden":!0,className:f}),e[8]=f,e[9]=u):u=e[9];let j;return e[10]!==h||e[11]!==a||e[12]!==u?(j=n.jsxs("div",{className:h,children:[a,u]}),e[10]=h,e[11]=a,e[12]=u,e[13]=j):j=e[13],j}function mn(s){const e=G.c(25),{icon:t,title:o,headline:d,required:r,attention:m,action:i}=s,c=ie(),h=m?"border-warning/50 bg-warning/[0.04]":"border-border";let a;e[0]!==h?(a=pe("relative flex items-center justify-between gap-3 rounded-lg border bg-card p-3.5 sm:gap-4 sm:p-4",h),e[0]=h,e[1]=a):a=e[1];let l;e[2]!==r||e[3]!==c?(l=r&&n.jsx("span",{className:"absolute -top-3 right-4 rounded-full border border-input bg-background px-3 py-1 text-xs font-medium text-foreground",children:c("commerceOnboarding.companionCard.required")}),e[2]=r,e[3]=c,e[4]=l):l=e[4];let f;e[5]!==t||e[6]!==o?(f=n.jsx(Ge,{icon:t,name:o,size:"sm",fit:"contain",className:"size-[30px] shrink-0 p-1"}),e[5]=t,e[6]=o,e[7]=f):f=e[7];let u;e[8]!==o?(u=n.jsx("span",{className:"text-sm font-medium text-foreground",children:o}),e[8]=o,e[9]=u):u=e[9];let j;e[10]!==d?(j=d&&n.jsx("p",{className:"hidden text-sm leading-5 text-muted-foreground sm:block",children:d}),e[10]=d,e[11]=j):j=e[11];let v;e[12]!==u||e[13]!==j?(v=n.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[u,j]}),e[12]=u,e[13]=j,e[14]=v):v=e[14];let b;e[15]!==f||e[16]!==v?(b=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3 sm:items-start",children:[f,v]}),e[15]=f,e[16]=v,e[17]=b):b=e[17];let p;e[18]!==i?(p=n.jsx("div",{className:"shrink-0",children:i}),e[18]=i,e[19]=p):p=e[19];let g;return e[20]!==a||e[21]!==l||e[22]!==b||e[23]!==p?(g=n.jsxs("div",{className:a,children:[l,b,p]}),e[20]=a,e[21]=l,e[22]=b,e[23]=p,e[24]=g):g=e[24],g}function St(s){const e=G.c(12),{connecting:t,disabled:o,title:d,primary:r,onConnect:m}=s,i=ie(),c=r?"default":"outline",h=o||t;let a;e[0]!==i||e[1]!==d?(a=i("commerceOnboarding.companionCard.connectAriaLabel",{title:d}),e[0]=i,e[1]=d,e[2]=a):a=e[2];let l;e[3]!==t||e[4]!==i?(l=t?n.jsx(Ve,{size:16,className:"animate-spin"}):i("commerceOnboarding.companionCard.connect"),e[3]=t,e[4]=i,e[5]=l):l=e[5];let f;return e[6]!==m||e[7]!==c||e[8]!==h||e[9]!==a||e[10]!==l?(f=n.jsx(Y,{type:"button",variant:c,size:"sm",disabled:h,onClick:m,"aria-label":a,children:l}),e[6]=m,e[7]=c,e[8]=h,e[9]=a,e[10]=l,e[11]=f):f=e[11],f}function un(s){const e=G.c(11),{disabled:t,title:o,onConfigure:d}=s,r=ie();let m;e[0]!==r||e[1]!==o?(m=r("commerceOnboarding.companionCard.configureAriaLabel",{title:o}),e[0]=r,e[1]=o,e[2]=m):m=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(bt,{size:16}),e[3]=i):i=e[3];let c;e[4]!==r?(c=r("commerceOnboarding.companionCard.finishSetup"),e[4]=r,e[5]=c):c=e[5];let h;return e[6]!==t||e[7]!==d||e[8]!==m||e[9]!==c?(h=n.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"border-warning/60 text-warning hover:bg-warning/10 hover:text-warning",disabled:t,onClick:d,"aria-label":m,children:[i,c]}),e[6]=t,e[7]=d,e[8]=m,e[9]=c,e[10]=h):h=e[10],h}function _t(s){const e=G.c(9),{detail:t,controls:o}=s,d=ie();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(yt,{size:16,className:"text-success"}),e[0]=r):r=e[0];let m;e[1]!==t||e[2]!==d?(m=t?n.jsx("span",{className:"max-w-40 truncate text-foreground",children:t}):d("commerceOnboarding.companionCard.connected"),e[1]=t,e[2]=d,e[3]=m):m=e[3];let i;e[4]!==m?(i=n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[r," ",m]}),e[4]=m,e[5]=i):i=e[5];let c;return e[6]!==o||e[7]!==i?(c=n.jsxs("div",{className:"flex items-center gap-1",children:[i,o]}),e[6]=o,e[7]=i,e[8]=c):c=e[8],c}function Nt(s){const e=G.c(4),{ariaLabel:t,onClick:o}=s;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(bt,{size:16}),e[0]=d):d=e[0];let r;return e[1]!==t||e[2]!==o?(r=n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:o,"aria-label":t,children:d}),e[1]=t,e[2]=o,e[3]=r):r=e[3],r}function ze(s){const e=G.c(38);let t,o,d,r,m;e[0]!==s?({value:m,onChange:o,placeholder:d,className:t,...r}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=d,e[4]=r,e[5]=m):(t=e[1],o=e[2],d=e[3],r=e[4],m=e[5]);const[i,c]=M.useState(!1),[h,a]=M.useState(!1);let l;e[6]!==m?(l=async()=>{if(m)try{await navigator.clipboard.writeText(m),a(!0),setTimeout(()=>a(!1),2e3)}catch(E){console.error("Failed to copy text: ",E)}},e[6]=m,e[7]=l):l=e[7];const f=l;let u;e[8]!==i?(u=()=>{c(!i)},e[8]=i,e[9]=u):u=e[9];const j=u,v=i?"text":"password";let b;e[10]!==t?(b=pe("pr-20",t),e[10]=t,e[11]=b):b=e[11];let p;e[12]!==o||e[13]!==d||e[14]!==r||e[15]!==v||e[16]!==b||e[17]!==m?(p=n.jsx(xe,{type:v,value:m,onChange:o,placeholder:d,className:b,...r}),e[12]=o,e[13]=d,e[14]=r,e[15]=v,e[16]=b,e[17]=m,e[18]=p):p=e[18];const g=i?"Hide password":"Show password";let S;e[19]!==i?(S=i?n.jsx(Wt,{size:16}):n.jsx(Yt,{size:16}),e[19]=i,e[20]=S):S=e[20];let x;e[21]!==g||e[22]!==S||e[23]!==j?(x=n.jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:j,title:g,children:S}),e[21]=g,e[22]=S,e[23]=j,e[24]=x):x=e[24];const k=!m,A=h?"Copied!":"Copy token";let C;e[25]!==h?(C=h?n.jsx(Ht,{size:16}):n.jsx(jt,{size:16}),e[25]=h,e[26]=C):C=e[26];let y;e[27]!==f||e[28]!==A||e[29]!==C||e[30]!==k?(y=n.jsx(Y,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:f,disabled:k,title:A,children:C}),e[27]=f,e[28]=A,e[29]=C,e[30]=k,e[31]=y):y=e[31];let I;e[32]!==y||e[33]!==x?(I=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[x,y]}),e[32]=y,e[33]=x,e[34]=I):I=e[34];let O;return e[35]!==I||e[36]!==p?(O=n.jsxs("div",{className:"relative",children:[p,I]}),e[35]=I,e[36]=p,e[37]=O):O=e[37],O}function Re(s){const e=G.c(19),{card:t,selfClient:o,org:d,onDone:r,onError:m}=s,i=Ee();let c;e[0]!==t||e[1]!==o?(c=async b=>{const{values:p,connectionToken:g}=b,x={configuration_state:{...t.configurationState??{},...p}};g!==void 0&&(x.connection_token=g),await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:x}})},e[0]=t,e[1]=o,e[2]=c):c=e[2];let h;e[3]!==r||e[4]!==d||e[5]!==i?(h=async()=>{await i.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(d.id)}),r()},e[3]=r,e[4]=d,e[5]=i,e[6]=h):h=e[6];let a;e[7]!==m?(a=b=>{m?.(b)},e[7]=m,e[8]=a):a=e[8];let l;e[9]!==c||e[10]!==h||e[11]!==a?(l={mutationFn:c,onSuccess:h,onError:a},e[9]=c,e[10]=h,e[11]=a,e[12]=l):l=e[12];const f=De(l);let u;e[13]!==f?(u=(b,p)=>f.mutate({values:b,connectionToken:p?.connectionToken}),e[13]=f,e[14]=u):u=e[14];const j=u;let v;return e[15]!==f.error||e[16]!==f.isPending||e[17]!==j?(v={save:j,isPending:f.isPending,error:f.error},e[15]=f.error,e[16]=f.isPending,e[17]=j,e[18]=v):v=e[18],v}const fn=Se({accountName:le().min(1,"Informe o nome da conta"),appKey:le().optional(),appToken:le().optional()});function pn(s){const e=G.c(73),{card:t,selfClient:o,org:d,onDone:r,onIsPendingChange:m}=s,i=ie();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=_e(fn),e[0]=c):c=e[0];const h=t.configurationState?.accountName||"",a=t.configurationState?.appKey||"",l=t.configurationState?.appToken||"";let f;e[1]!==h||e[2]!==a||e[3]!==l?(f={resolver:c,defaultValues:{accountName:h,appKey:a,appToken:l}},e[1]=h,e[2]=a,e[3]=l,e[4]=f):f=e[4];const u=Ne(f);let j;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==u?(j=()=>{u.reset({accountName:t.configurationState?.accountName||"",appKey:t.configurationState?.appKey||"",appToken:t.configurationState?.appToken||""})},e[5]=t.configurationState?.accountName,e[6]=t.configurationState?.appKey,e[7]=t.configurationState?.appToken,e[8]=u,e[9]=j):j=e[9];let v;e[10]!==t.configurationState||e[11]!==u?(v=[t.configurationState,u],e[10]=t.configurationState,e[11]=u,e[12]=v):v=e[12],M.useEffect(j,v);let b;e[13]!==t||e[14]!==r||e[15]!==d||e[16]!==o?(b={card:t,selfClient:o,org:d,onDone:r},e[13]=t,e[14]=r,e[15]=d,e[16]=o,e[17]=b):b=e[17];const{save:p,isPending:g,error:S}=Re(b);let x,k;e[18]!==g||e[19]!==m?(k=()=>{m?.(g)},x=[g,m],e[18]=g,e[19]=m,e[20]=x,e[21]=k):(x=e[20],k=e[21]),M.useEffect(k,x);let A;if(e[22]!==u||e[23]!==p){let F;e[25]!==p?(F=async w=>{p(w)},e[25]=p,e[26]=F):F=e[26],A=u.handleSubmit(F),e[22]=u,e[23]=p,e[24]=A}else A=e[24];const C=A;let y;e[27]!==g||e[28]!==i?(y=F=>{const{field:w}=F;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.vtexConfigForm.accountNameLabel")}),n.jsx(me,{children:n.jsx(xe,{placeholder:i("commerceOnboarding.vtexConfigForm.accountNamePlaceholder"),...w,disabled:g})}),n.jsx(ue,{})]})},e[27]=g,e[28]=i,e[29]=y):y=e[29];let I;e[30]!==u.control||e[31]!==y?(I=n.jsx(ce,{control:u.control,name:"accountName",render:y}),e[30]=u.control,e[31]=y,e[32]=I):I=e[32];let O;e[33]!==g||e[34]!==i?(O=F=>{const{field:w}=F;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.vtexConfigForm.appKeyLabel")}),n.jsx(me,{children:n.jsx(ze,{placeholder:i("commerceOnboarding.vtexConfigForm.appKeyPlaceholder"),...w,disabled:g})}),n.jsx(ue,{})]})},e[33]=g,e[34]=i,e[35]=O):O=e[35];let E;e[36]!==u.control||e[37]!==O?(E=n.jsx(ce,{control:u.control,name:"appKey",render:O}),e[36]=u.control,e[37]=O,e[38]=E):E=e[38];let L;e[39]!==g||e[40]!==i?(L=F=>{const{field:w}=F;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.vtexConfigForm.appTokenLabel")}),n.jsx(me,{children:n.jsx(ze,{placeholder:i("commerceOnboarding.vtexConfigForm.appTokenPlaceholder"),...w,disabled:g})}),n.jsx(ue,{})]})},e[39]=g,e[40]=i,e[41]=L):L=e[41];let _;e[42]!==u.control||e[43]!==L?(_=n.jsx(ce,{control:u.control,name:"appToken",render:L}),e[42]=u.control,e[43]=L,e[44]=_):_=e[44];let N;e[45]!==u||e[46]!==I||e[47]!==E||e[48]!==_?(N=n.jsxs(Oe,{...u,children:[I,E,_]}),e[45]=u,e[46]=I,e[47]=E,e[48]=_,e[49]=N):N=e[49];let R;e[50]!==S||e[51]!==i?(R=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:i("commerceOnboarding.vtexConfigForm.savingError")}),e[50]=S,e[51]=i,e[52]=R):R=e[52];let D;e[53]!==i?(D=i("commerceOnboarding.vtexConfigForm.cancelButton"),e[53]=i,e[54]=D):D=e[54];let P;e[55]!==g||e[56]!==r||e[57]!==D?(P=n.jsx(Y,{type:"button",variant:"outline",onClick:r,disabled:g,children:D}),e[55]=g,e[56]=r,e[57]=D,e[58]=P):P=e[58];let q;e[59]!==g||e[60]!==i?(q=i(g?"commerceOnboarding.vtexConfigForm.savingButton":"commerceOnboarding.vtexConfigForm.saveButton"),e[59]=g,e[60]=i,e[61]=q):q=e[61];let U;e[62]!==g||e[63]!==q?(U=n.jsx(Y,{type:"submit",disabled:g,children:q}),e[62]=g,e[63]=q,e[64]=U):U=e[64];let V;e[65]!==P||e[66]!==U?(V=n.jsxs(he,{className:"pt-4",children:[P,U]}),e[65]=P,e[66]=U,e[67]=V):V=e[67];let K;return e[68]!==C||e[69]!==N||e[70]!==R||e[71]!==V?(K=n.jsxs("form",{onSubmit:C,className:"space-y-4",children:[N,R,V]}),e[68]=C,e[69]=N,e[70]=R,e[71]=V,e[72]=K):K=e[72],K}const gn=Se({storeDomain:le().min(1,"Informe o domínio da loja"),accessToken:le().optional(),apiVersion:le().optional()});function hn(s){const e=G.c(71),{card:t,selfClient:o,org:d,onDone:r,onIsPendingChange:m}=s,i=ie();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=_e(gn),e[0]=c):c=e[0];const h=t.configurationState?.storeDomain||"",a=t.configurationState?.apiVersion||"";let l;e[1]!==h||e[2]!==a?(l={resolver:c,defaultValues:{storeDomain:h,accessToken:"",apiVersion:a}},e[1]=h,e[2]=a,e[3]=l):l=e[3];const f=Ne(l);let u;e[4]!==t.configurationState?.apiVersion||e[5]!==t.configurationState?.storeDomain||e[6]!==f?(u=()=>{f.reset({storeDomain:t.configurationState?.storeDomain||"",accessToken:"",apiVersion:t.configurationState?.apiVersion||""})},e[4]=t.configurationState?.apiVersion,e[5]=t.configurationState?.storeDomain,e[6]=f,e[7]=u):u=e[7];let j;e[8]!==t.configurationState||e[9]!==f?(j=[t.configurationState,f],e[8]=t.configurationState,e[9]=f,e[10]=j):j=e[10],M.useEffect(u,j);let v;e[11]!==t||e[12]!==r||e[13]!==d||e[14]!==o?(v={card:t,selfClient:o,org:d,onDone:r},e[11]=t,e[12]=r,e[13]=d,e[14]=o,e[15]=v):v=e[15];const{save:b,isPending:p,error:g}=Re(v);let S,x;e[16]!==p||e[17]!==m?(S=()=>{m?.(p)},x=[p,m],e[16]=p,e[17]=m,e[18]=S,e[19]=x):(S=e[18],x=e[19]),M.useEffect(S,x);let k;if(e[20]!==f||e[21]!==b){let K;e[23]!==b?(K=async F=>{const w=F.apiVersion?.trim(),$=F.accessToken?.trim();b({storeDomain:F.storeDomain.trim(),...w?{apiVersion:w}:{}},$?{connectionToken:$}:void 0)},e[23]=b,e[24]=K):K=e[24],k=f.handleSubmit(K),e[20]=f,e[21]=b,e[22]=k}else k=e[22];const A=k;let C;e[25]!==p||e[26]!==i?(C=K=>{const{field:F}=K;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.shopifyConfigForm.storeDomainLabel")}),n.jsx(me,{children:n.jsx(xe,{placeholder:i("commerceOnboarding.shopifyConfigForm.storeDomainPlaceholder"),...F,disabled:p})}),n.jsx(ue,{})]})},e[25]=p,e[26]=i,e[27]=C):C=e[27];let y;e[28]!==f.control||e[29]!==C?(y=n.jsx(ce,{control:f.control,name:"storeDomain",render:C}),e[28]=f.control,e[29]=C,e[30]=y):y=e[30];let I;e[31]!==p||e[32]!==i?(I=K=>{const{field:F}=K;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.shopifyConfigForm.accessTokenLabel")}),n.jsx(me,{children:n.jsx(ze,{placeholder:i("commerceOnboarding.shopifyConfigForm.accessTokenPlaceholder"),...F,disabled:p})}),n.jsx(ue,{})]})},e[31]=p,e[32]=i,e[33]=I):I=e[33];let O;e[34]!==f.control||e[35]!==I?(O=n.jsx(ce,{control:f.control,name:"accessToken",render:I}),e[34]=f.control,e[35]=I,e[36]=O):O=e[36];let E;e[37]!==p||e[38]!==i?(E=K=>{const{field:F}=K;return n.jsxs(de,{children:[n.jsx(ge,{children:i("commerceOnboarding.shopifyConfigForm.apiVersionLabel")}),n.jsx(me,{children:n.jsx(xe,{placeholder:i("commerceOnboarding.shopifyConfigForm.apiVersionPlaceholder"),...F,disabled:p})}),n.jsx(ue,{})]})},e[37]=p,e[38]=i,e[39]=E):E=e[39];let L;e[40]!==f.control||e[41]!==E?(L=n.jsx(ce,{control:f.control,name:"apiVersion",render:E}),e[40]=f.control,e[41]=E,e[42]=L):L=e[42];let _;e[43]!==f||e[44]!==y||e[45]!==O||e[46]!==L?(_=n.jsxs(Oe,{...f,children:[y,O,L]}),e[43]=f,e[44]=y,e[45]=O,e[46]=L,e[47]=_):_=e[47];let N;e[48]!==g||e[49]!==i?(N=g&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:g instanceof Error?g.message:i("commerceOnboarding.shopifyConfigForm.savingError")}),e[48]=g,e[49]=i,e[50]=N):N=e[50];let R;e[51]!==i?(R=i("commerceOnboarding.shopifyConfigForm.cancelButton"),e[51]=i,e[52]=R):R=e[52];let D;e[53]!==p||e[54]!==r||e[55]!==R?(D=n.jsx(Y,{type:"button",variant:"outline",onClick:r,disabled:p,children:R}),e[53]=p,e[54]=r,e[55]=R,e[56]=D):D=e[56];let P;e[57]!==p||e[58]!==i?(P=i(p?"commerceOnboarding.shopifyConfigForm.savingButton":"commerceOnboarding.shopifyConfigForm.saveButton"),e[57]=p,e[58]=i,e[59]=P):P=e[59];let q;e[60]!==p||e[61]!==P?(q=n.jsx(Y,{type:"submit",disabled:p,children:P}),e[60]=p,e[61]=P,e[62]=q):q=e[62];let U;e[63]!==D||e[64]!==q?(U=n.jsxs(he,{className:"pt-4",children:[D,q]}),e[63]=D,e[64]=q,e[65]=U):U=e[65];let V;return e[66]!==A||e[67]!==_||e[68]!==N||e[69]!==U?(V=n.jsxs("form",{onSubmit:A,className:"space-y-4",children:[_,N,U]}),e[66]=A,e[67]=_,e[68]=N,e[69]=U,e[70]=V):V=e[70],V}function We(s){const e=G.c(29),{options:t,value:o,onChange:d,disabled:r,ariaLabel:m,searchPlaceholder:i,hideSearch:c}=s,h=i===void 0?"Buscar...":i,a=c===void 0?!1:c,[l,f]=M.useState("");let u,j,v;if(e[0]!==t||e[1]!==l||e[2]!==o){const C=l.trim().toLowerCase();u=C?t.filter(y=>y.label.toLowerCase().includes(C)):t,j=u.map(xn),v=j.includes(o)?o:j[0]??"",e[0]=t,e[1]=l,e[2]=o,e[3]=u,e[4]=j,e[5]=v}else u=e[3],j=e[4],v=e[5];const b=v;let p;e[6]!==r||e[7]!==j||e[8]!==d?(p=function(y){if(r||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(y.key))return;y.preventDefault();const O=y.currentTarget.dataset.value,E=j.indexOf(O),L=j.length;if(L===0)return;let _;y.key==="ArrowDown"||y.key==="ArrowRight"?_=(E+1)%L:y.key==="ArrowUp"||y.key==="ArrowLeft"?_=(E-1+L)%L:y.key==="Home"?_=0:_=L-1;const N=j[_];d(N),y.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(N)}"]`)?.focus()},e[6]=r,e[7]=j,e[8]=d,e[9]=p):p=e[9];const g=p;let S;e[10]!==m||e[11]!==r||e[12]!==a||e[13]!==l||e[14]!==h?(S=a?null:n.jsxs("div",{className:"relative",children:[n.jsx(Ct,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),n.jsx(xe,{type:"text",value:l,onChange:C=>f(C.target.value),disabled:r,placeholder:h,"aria-label":`Buscar ${m}`,className:"h-8 pl-8"})]}),e[10]=m,e[11]=r,e[12]=a,e[13]=l,e[14]=h,e[15]=S):S=e[15];let x;e[16]!==r||e[17]!==u||e[18]!==g||e[19]!==d||e[20]!==b||e[21]!==o?(x=u.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):u.map(C=>{const y=C.value===o;return n.jsxs("button",{type:"button",role:"radio","aria-checked":y,disabled:r,"data-value":C.value,tabIndex:C.value===b?0:-1,onClick:()=>d(C.value),onKeyDown:g,className:pe("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",y?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:C.label}),y?n.jsx(yt,{size:16,className:"shrink-0 text-primary"}):null]},C.value)}),e[16]=r,e[17]=u,e[18]=g,e[19]=d,e[20]=b,e[21]=o,e[22]=x):x=e[22];let k;e[23]!==m||e[24]!==x?(k=n.jsx("div",{role:"radiogroup","aria-label":m,className:"max-h-[280px] overflow-y-auto",children:x}),e[23]=m,e[24]=x,e[25]=k):k=e[25];let A;return e[26]!==S||e[27]!==k?(A=n.jsxs("div",{className:"space-y-2",children:[S,k]}),e[26]=S,e[27]=k,e[28]=A):A=e[28],A}function xn(s){return s.value}function Ye(s){const e=G.c(16),{label:t,iconSize:o,className:d,iconClassName:r,labelClassName:m}=s,i=o===void 0?14:o;let c;e[0]!==d?(c=pe("inline-flex items-center gap-2",d),e[0]=d,e[1]=c):c=e[1];let h;e[2]!==r?(h=pe("shrink-0 animate-spin",r),e[2]=r,e[3]=h):h=e[3];let a;e[4]!==i||e[5]!==h?(a=n.jsx(Ve,{size:i,className:h}),e[4]=i,e[5]=h,e[6]=a):a=e[6];let l;e[7]!==m?(l=pe("text-sm",m),e[7]=m,e[8]=l):l=e[8];let f;e[9]!==t||e[10]!==l?(f=n.jsx("span",{className:l,children:t}),e[9]=t,e[10]=l,e[11]=f):f=e[11];let u;return e[12]!==c||e[13]!==a||e[14]!==f?(u=n.jsxs("span",{className:c,children:[a,f]}),e[12]=c,e[13]=a,e[14]=f,e[15]=u):u=e[15],u}const bn=Se({propertyId:le().min(1,"Selecione uma propriedade")});function Cn(s){const e=G.c(68),{card:t,connectionId:o,companionClient:d,selfClient:r,org:m,onDone:i,onDisconnect:c,onIsPendingChange:h}=s;let a;e[0]!==o||e[1]!==m.id?(a=X.commerceDiscoveryCompanionGaProperties(m.id,o),e[0]=o,e[1]=m.id,e[2]=a):a=e[2];let l;e[3]!==d?(l=async()=>{const $=await d.callTool({name:"get-account-summaries",arguments:{}}),T=ne($);return qt(T)},e[3]=d,e[4]=l):l=e[4];let f;e[5]!==a||e[6]!==l?(f={queryKey:a,queryFn:l},e[5]=a,e[6]=l,e[7]=f):f=e[7];const u=je(f);let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=_e(bn),e[8]=j):j=e[8];const v=t.configurationState?.propertyId||"";let b;e[9]!==v?(b={resolver:j,defaultValues:{propertyId:v}},e[9]=v,e[10]=b):b=e[10];const p=Ne(b);let g;e[11]!==t||e[12]!==i||e[13]!==m||e[14]!==r?(g={card:t,selfClient:r,org:m,onDone:i},e[11]=t,e[12]=i,e[13]=m,e[14]=r,e[15]=g):g=e[15];const{save:S,isPending:x,error:k}=Re(g);let A,C;e[16]!==x||e[17]!==h?(A=()=>{h?.(x)},C=[x,h],e[16]=x,e[17]=h,e[18]=A,e[19]=C):(A=e[18],C=e[19]),M.useEffect(A,C);let y;if(e[20]!==p||e[21]!==S){let $;e[23]!==S?($=async T=>{S(T)},e[23]=S,e[24]=$):$=e[24],y=p.handleSubmit($),e[20]=p,e[21]=S,e[22]=y}else y=e[22];const I=y;if(u.isLoading){let $;return e[25]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ye,{label:"Carregando propriedades..."})}),e[25]=$):$=e[25],$}if(u.isError){let $;return e[26]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=$):$=e[26],$}let O;e[27]!==u.data?(O=u.data||[],e[27]=u.data,e[28]=O):O=e[28];const E=O;if(E.flatMap(jn).length===0){let $;e[29]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma propriedade do Google Analytics foi encontrada. Conecte uma conta do Google Analytics com propriedades."}),e[29]=$):$=e[29];let T;e[30]!==c?(T=c?n.jsx("button",{type:"button",onClick:c,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):n.jsx("span",{}),e[30]=c,e[31]=T):T=e[31];let B;e[32]!==i?(B=n.jsx(Y,{type:"button",variant:"outline",onClick:i,children:"Fechar"}),e[32]=i,e[33]=B):B=e[33];let Q;return e[34]!==T||e[35]!==B?(Q=n.jsxs("div",{className:"space-y-4",children:[$,n.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[T,B]})]}),e[34]=T,e[35]=B,e[36]=Q):Q=e[36],Q}let _;e[37]!==x||e[38]!==E?(_=$=>{const{field:T}=$;return n.jsxs(de,{children:[n.jsx(me,{children:n.jsx(We,{options:E.flatMap(yn),value:T.value,onChange:T.onChange,disabled:x,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(ue,{})]})},e[37]=x,e[38]=E,e[39]=_):_=e[39];let N;e[40]!==p.control||e[41]!==_?(N=n.jsx(ce,{control:p.control,name:"propertyId",render:_}),e[40]=p.control,e[41]=_,e[42]=N):N=e[42];let R;e[43]!==p||e[44]!==N?(R=n.jsx(Oe,{...p,children:N}),e[43]=p,e[44]=N,e[45]=R):R=e[45];let D;e[46]!==k?(D=k&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:k instanceof Error?k.message:"Não foi possível salvar a configuração"}),e[46]=k,e[47]=D):D=e[47];let P;e[48]!==x||e[49]!==c?(P=c?n.jsx("button",{type:"button",onClick:c,disabled:x,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):n.jsx("span",{}),e[48]=x,e[49]=c,e[50]=P):P=e[50];let q;e[51]!==x||e[52]!==i?(q=n.jsx(Y,{type:"button",variant:"outline",onClick:i,disabled:x,children:"Cancelar"}),e[51]=x,e[52]=i,e[53]=q):q=e[53];const U=x?"Salvando...":"Salvar";let V;e[54]!==x||e[55]!==U?(V=n.jsx(Y,{type:"submit",disabled:x,children:U}),e[54]=x,e[55]=U,e[56]=V):V=e[56];let K;e[57]!==q||e[58]!==V?(K=n.jsxs("div",{className:"flex gap-2",children:[q,V]}),e[57]=q,e[58]=V,e[59]=K):K=e[59];let F;e[60]!==P||e[61]!==K?(F=n.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[P,K]}),e[60]=P,e[61]=K,e[62]=F):F=e[62];let w;return e[63]!==I||e[64]!==R||e[65]!==D||e[66]!==F?(w=n.jsxs("form",{onSubmit:I,className:"space-y-4",children:[R,D,F]}),e[63]=I,e[64]=R,e[65]=D,e[66]=F,e[67]=w):w=e[67],w}function yn(s){return s.options}function jn(s){return s.options}const vn=Se({siteUrl:le().min(1,"Selecione um site")});function Sn(s){const e=G.c(62),{card:t,connectionId:o,companionClient:d,selfClient:r,org:m,contextSiteUrl:i,onDone:c,onIsPendingChange:h}=s;let a;e[0]!==o||e[1]!==m.id?(a=X.commerceDiscoveryCompanionGscSites(m.id,o),e[0]=o,e[1]=m.id,e[2]=a):a=e[2];let l;e[3]!==d?(l=async()=>{const T=await d.callTool({name:"list_sites",arguments:{}});return ne(T).sites||[]},e[3]=d,e[4]=l):l=e[4];let f;e[5]!==a||e[6]!==l?(f={queryKey:a,queryFn:l},e[5]=a,e[6]=l,e[7]=f):f=e[7];const u=je(f);let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=_e(vn),e[8]=j):j=e[8];const v=t.configurationState?.siteUrl||"";let b;e[9]!==v?(b={resolver:j,defaultValues:{siteUrl:v}},e[9]=v,e[10]=b):b=e[10];const p=Ne(b);let g;e[11]!==t||e[12]!==c||e[13]!==m||e[14]!==r?(g={card:t,selfClient:r,org:m,onDone:c},e[11]=t,e[12]=c,e[13]=m,e[14]=r,e[15]=g):g=e[15];const{save:S,isPending:x,error:k}=Re(g),A=M.useRef(!1),C=t.configurationState?.siteUrl;let y,I;e[16]!==x||e[17]!==h?(y=()=>{h?.(x)},I=[x,h],e[16]=x,e[17]=h,e[18]=y,e[19]=I):(y=e[18],I=e[19]),M.useEffect(y,I);let O,E;e[20]!==i||e[21]!==p||e[22]!==C||e[23]!==u.data||e[24]!==u.isSuccess?(O=()=>{if(!(A.current||!u.isSuccess)){if(A.current=!0,C){p.getValues("siteUrl")!==C&&p.setValue("siteUrl",C);return}if(!p.getValues("siteUrl")){const T=Kt(i,u.data??[]);T&&p.setValue("siteUrl",T)}}},E=[u.isSuccess,u.data,C,i,p],e[20]=i,e[21]=p,e[22]=C,e[23]=u.data,e[24]=u.isSuccess,e[25]=O,e[26]=E):(O=e[25],E=e[26]),M.useEffect(O,E);let L;if(e[27]!==p||e[28]!==S){let T;e[30]!==S?(T=async B=>{S(B)},e[30]=S,e[31]=T):T=e[31],L=p.handleSubmit(T),e[27]=p,e[28]=S,e[29]=L}else L=e[29];const _=L;if(u.isLoading){let T;return e[32]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ye,{label:"Carregando sites..."})}),e[32]=T):T=e[32],T}if(u.isError){let T;return e[33]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[33]=T):T=e[33],T}let N;e[34]!==u.data?(N=u.data||[],e[34]=u.data,e[35]=N):N=e[35];const R=N;if(R.length===0){let T;return e[36]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[36]=T):T=e[36],T}let D;e[37]!==x||e[38]!==R?(D=T=>{const{field:B}=T;return n.jsxs(de,{children:[n.jsx(me,{children:n.jsx(We,{options:R.map(_n),value:B.value,onChange:B.onChange,disabled:x,ariaLabel:"Site verificado"})}),n.jsx(ue,{})]})},e[37]=x,e[38]=R,e[39]=D):D=e[39];let P;e[40]!==p.control||e[41]!==D?(P=n.jsx(ce,{control:p.control,name:"siteUrl",render:D}),e[40]=p.control,e[41]=D,e[42]=P):P=e[42];let q;e[43]!==p||e[44]!==P?(q=n.jsx(Oe,{...p,children:P}),e[43]=p,e[44]=P,e[45]=q):q=e[45];let U;e[46]!==k?(U=k&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:k instanceof Error?k.message:"Não foi possível salvar a configuração"}),e[46]=k,e[47]=U):U=e[47];let V;e[48]!==x||e[49]!==c?(V=n.jsx(Y,{type:"button",variant:"outline",onClick:c,disabled:x,children:"Cancelar"}),e[48]=x,e[49]=c,e[50]=V):V=e[50];const K=x?"Salvando...":"Salvar";let F;e[51]!==x||e[52]!==K?(F=n.jsx(Y,{type:"submit",disabled:x,children:K}),e[51]=x,e[52]=K,e[53]=F):F=e[53];let w;e[54]!==V||e[55]!==F?(w=n.jsxs(he,{className:"pt-4",children:[V,F]}),e[54]=V,e[55]=F,e[56]=w):w=e[56];let $;return e[57]!==_||e[58]!==q||e[59]!==U||e[60]!==w?($=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[q,U,w]}),e[57]=_,e[58]=q,e[59]=U,e[60]=w,e[61]=$):$=e[61],$}function _n(s){return{value:s.siteUrl,label:s.siteUrl}}function Nn(s){const[e,t]=s.split("/");return!e||!t?null:{owner:e,name:t}}function On(s){const{existingRepo:e,owner:t,name:o}=s;return e?.connectionId&&e.owner.toLowerCase()===t.toLowerCase()&&e.name.toLowerCase()===o.toLowerCase()?{connectionId:e.connectionId,installationId:e.installationId}:null}function Tn(s){const{existingRepo:e,existingConnections:t,repoConnectionId:o}=s,d=e?.connectionId&&e.connectionId!==o?e.connectionId:void 0,r=[...t.filter(m=>m.connection_id!==o&&m.connection_id!==d),{connection_id:o,selected_tools:[]}];return{staleConnectionId:d,mergedConnections:r}}const In=Se({githubRepo:le().min(1,"commerceOnboarding.githubConfigForm.selectRepository")}),En=15e3,wn=/^[\w.-]+\/[\w.-]+$/;async function kn(s,e,t,o){const{installations:d}=await vt(s,t),r=o.trim(),m=await Promise.allSettled(d.map(async a=>{const l=a.type==="User"?"user":"org",f=r?`${l}:${a.login} ${r} in:name`:`${l}:${a.login}`,j=await e.callTool({name:"search_repositories",arguments:{query:f,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(En)}),v=j.content?.[0]?.text;if(j.isError)throw new Error(v??"search_repositories failed");if(!v)throw new Error("empty search_repositories response");return JSON.parse(v).items??[]})),i=new Map;let c=0;for(const a of m){if(a.status==="rejected"){c+=1;continue}for(const l of a.value)l.full_name&&!i.has(l.full_name)&&i.set(l.full_name,l)}return{repos:Array.from(i.values()).sort((a,l)=>(l.updated_at??"").localeCompare(a.updated_at??"")).map(a=>a.full_name),failed:c,total:d.length}}function An(s){const e=G.c(109),{connectionId:t,companionClient:o,selfClient:d,org:r,onDone:m,onIsPendingChange:i}=s,c=ie(),h=Ee();let a;e[0]!==r.id?(a=ut.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=a):a=e[1];const l=a,[f,u]=M.useState(""),j=Zt(f,300),v=M.useRef(!1);let b;e[2]!==t||e[3]!==r.id?(b=X.commerceDiscoveryCompanionGithubSelected(r.id,t),e[2]=t,e[3]=r.id,e[4]=b):b=e[4];let p;e[5]!==l||e[6]!==d?(p=async()=>{const Z=await d.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),se=ne(Z).item?.configuration_state??null;return typeof se?.github_repo=="string"?se.github_repo:""},e[5]=l,e[6]=d,e[7]=p):p=e[7];let g;e[8]!==b||e[9]!==p?(g={queryKey:b,queryFn:p},e[8]=b,e[9]=p,e[10]=g):g=e[10];const S=je(g);let x;e[11]!==t||e[12]!==j||e[13]!==r.id?(x=X.commerceDiscoveryCompanionGithubRepos(r.id,t,j.trim()),e[11]=t,e[12]=j,e[13]=r.id,e[14]=x):x=e[14];let k;e[15]!==o||e[16]!==t||e[17]!==j||e[18]!==d?(k=()=>kn(Z=>d.callTool(Z),o,t,j),e[15]=o,e[16]=t,e[17]=j,e[18]=d,e[19]=k):k=e[19];let A;e[20]!==x||e[21]!==k?(A={queryKey:x,queryFn:k},e[20]=x,e[21]=k,e[22]=A):A=e[22];const C=je(A);let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y={resolver:_e(In),defaultValues:{githubRepo:""}},e[23]=y):y=e[23];const I=Ne(y);let O;e[24]!==l||e[25]!==o||e[26]!==t||e[27]!==r.id||e[28]!==r.slug||e[29]!==d||e[30]!==c?(O=async Z=>{const se=await d.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),It={...ne(se).item?.configuration_state??null??{},github_repo:Z};await d.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:l,data:{configuration_state:It}}});const et=Nn(Z);if(!et)throw new Error(c("commerceOnboarding.githubConfigForm.invalidRepository",{repo:Z}));const{owner:Te,name:Pe}=et,tt=Rt(r.id),nt=ne(await d.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:tt}})).item,ot=nt?.metadata?.githubRepo,Et=nt?.connections??[],st=On({existingRepo:ot,owner:Te,name:Pe});let ke=st?.connectionId,$e=st?.installationId,qe;if(!ke){const{installations:Ke}=await vt(Ie=>d.callTool(Ie),t),Ae=Xt(Ke,Te);if(!Ae)throw new Error(c("commerceOnboarding.githubConfigForm.noGithubInstallation",{owner:Te}));$e=Ae.installationId;const rt=ne(await d.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:t}})).item;if(!rt)throw new Error(c("commerceOnboarding.githubConfigForm.githubConnectionNotFound"));const{childConnectionId:at}=await Jt({orgSlug:r.slug,sourceConnection:rt,installationId:$e,owner:Te,repo:Pe,githubCallTool:Ie=>o.callTool(Ie),selfCallTool:Ie=>d.callTool(Ie)});ke=at,qe=at}const{staleConnectionId:it,mergedConnections:wt}=Tn({existingRepo:ot,existingConnections:Et,repoConnectionId:ke});try{await d.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:tt,data:{connections:wt,metadata:{githubRepo:{owner:Te,name:Pe,url:`https://github.com/${Z}`,installationId:$e,connectionId:ke}}}}}),it&&await d.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:it,force:!0}}).catch(Dn)}catch(Ke){const Ae=Ke;throw qe&&await d.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:qe,force:!0}}).catch(Ln),Ae}},e[24]=l,e[25]=o,e[26]=t,e[27]=r.id,e[28]=r.slug,e[29]=d,e[30]=c,e[31]=O):O=e[31];let E;e[32]!==l||e[33]!==m||e[34]!==r.id||e[35]!==h?(E=async()=>{await h.invalidateQueries({queryKey:X.commerceDiscoveryConnection(r.id,l)}),await h.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(r.id)}),At(h,r.id),m()},e[32]=l,e[33]=m,e[34]=r.id,e[35]=h,e[36]=E):E=e[36];let L;e[37]!==E||e[38]!==O?(L={mutationFn:O,onSuccess:E},e[37]=E,e[38]=O,e[39]=L):L=e[39];const _=De(L),N=_.isPending;let R,D;e[40]!==N||e[41]!==i?(R=()=>{i?.(N)},D=[N,i],e[40]=N,e[41]=i,e[42]=R,e[43]=D):(R=e[42],D=e[43]),M.useEffect(R,D);const P=S.data??"";let q,U;e[44]!==I||e[45]!==S.data||e[46]!==S.isSuccess?(q=()=>{!S.isSuccess||v.current||(v.current=!0,S.data&&I.setValue("githubRepo",S.data))},U=[S.isSuccess,S.data,I],e[44]=I,e[45]=S.data,e[46]=S.isSuccess,e[47]=q,e[48]=U):(q=e[47],U=e[48]),M.useEffect(q,U);let V;if(e[49]!==I||e[50]!==_){let Z;e[52]!==_?(Z=async se=>{_.mutate(se.githubRepo)},e[52]=_,e[53]=Z):Z=e[53],V=I.handleSubmit(Z),e[49]=I,e[50]=_,e[51]=V}else V=e[51];const K=V;let F,w,$;if(e[54]!==j||e[55]!==C.data?.failed||e[56]!==C.data?.repos||e[57]!==C.data?.total||e[58]!==P){const Z=C.data?.repos??[];F=C.data?.failed??0,$=C.data?.total??0;const se=j.trim();w=[...Z],se&&wn.test(se)&&!w.includes(se)&&w.unshift(se),P&&!w.includes(P)&&w.push(P),e[54]=j,e[55]=C.data?.failed,e[56]=C.data?.repos,e[57]=C.data?.total,e[58]=P,e[59]=F,e[60]=w,e[61]=$}else F=e[59],w=e[60],$=e[61];const T=$>0&&F===$;let B;e[62]!==T||e[63]!==F||e[64]!==C.isError||e[65]!==c?(B=C.isError||T?c("commerceOnboarding.githubConfigForm.searchFailedTotal"):F>0?c("commerceOnboarding.githubConfigForm.searchFailedPartial"):null,e[62]=T,e[63]=F,e[64]=C.isError,e[65]=c,e[66]=B):B=e[66];const Q=B;let te;e[67]===Symbol.for("react.memo_cache_sentinel")?(te=n.jsx(Ct,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[67]=te):te=e[67];let oe;e[68]===Symbol.for("react.memo_cache_sentinel")?(oe=Z=>u(Z.target.value),e[68]=oe):oe=e[68];let J;e[69]!==c?(J=c("commerceOnboarding.githubConfigForm.searchRepositoryPlaceholder"),e[69]=c,e[70]=J):J=e[70];let z;e[71]!==c?(z=c("commerceOnboarding.githubConfigForm.searchRepositoryLabel"),e[71]=c,e[72]=z):z=e[72];let H;e[73]!==N||e[74]!==f||e[75]!==J||e[76]!==z?(H=n.jsxs("div",{className:"relative",children:[te,n.jsx(xe,{type:"text",value:f,onChange:oe,disabled:N,placeholder:J,"aria-label":z,className:"h-8 pl-8"})]}),e[73]=N,e[74]=f,e[75]=J,e[76]=z,e[77]=H):H=e[77];let ee;e[78]!==I||e[79]!==N||e[80]!==w||e[81]!==C.isLoading||e[82]!==Q||e[83]!==c?(ee=C.isLoading?n.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:n.jsx(Ye,{label:c("commerceOnboarding.githubConfigForm.loadingRepositories")})}):n.jsxs(n.Fragment,{children:[Q&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:Q}),w.length===0?!Q&&n.jsx("p",{className:"text-sm text-muted-foreground",children:c("commerceOnboarding.githubConfigForm.noRepositoriesFound")}):n.jsx(Oe,{...I,children:n.jsx(ce,{control:I.control,name:"githubRepo",render:Z=>{const{field:se}=Z;return n.jsxs(de,{children:[n.jsx(me,{children:n.jsx(We,{options:w.map(Fn),value:se.value,onChange:se.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),n.jsx(ue,{})]})}})})]}),e[78]=I,e[79]=N,e[80]=w,e[81]=C.isLoading,e[82]=Q,e[83]=c,e[84]=ee):ee=e[84];let ae;e[85]!==_.error||e[86]!==c?(ae=_.error&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_.error instanceof Error?_.error.message:c("commerceOnboarding.githubConfigForm.failedToSave")}),e[85]=_.error,e[86]=c,e[87]=ae):ae=e[87];let W;e[88]!==c?(W=c("commerceOnboarding.githubConfigForm.cancel"),e[88]=c,e[89]=W):W=e[89];let re;e[90]!==N||e[91]!==m||e[92]!==W?(re=n.jsx(Y,{type:"button",variant:"outline",onClick:m,disabled:N,children:W}),e[90]=N,e[91]=m,e[92]=W,e[93]=re):re=e[93];let be;e[94]!==N||e[95]!==c?(be=c(N?"commerceOnboarding.githubConfigForm.saving":"commerceOnboarding.githubConfigForm.save"),e[94]=N,e[95]=c,e[96]=be):be=e[96];let Ce;e[97]!==N||e[98]!==be?(Ce=n.jsx(Y,{type:"submit",disabled:N,children:be}),e[97]=N,e[98]=be,e[99]=Ce):Ce=e[99];let ye;e[100]!==re||e[101]!==Ce?(ye=n.jsxs(he,{className:"pt-4",children:[re,Ce]}),e[100]=re,e[101]=Ce,e[102]=ye):ye=e[102];let we;return e[103]!==K||e[104]!==H||e[105]!==ee||e[106]!==ae||e[107]!==ye?(we=n.jsxs("form",{onSubmit:K,className:"space-y-4",children:[H,ee,ae,ye]}),e[103]=K,e[104]=H,e[105]=ee,e[106]=ae,e[107]=ye,e[108]=we):we=e[108],we}function Fn(s){return{value:s,label:s}}function Ln(){}function Dn(){}const Rn={vtex:pn,shopify:hn,"google-analytics":Cn,"google-search-console":Sn,github:An},ve="deco-reader@decocms.iam.gserviceaccount.com",Ot={"google-analytics":"ga4","google-search-console":"gsc"},Tt={ga4:{label:"Google Analytics",resourceLabel:"ID da propriedade",resourcePlaceholder:"ex: 123456789",resourceHint:"No GA4: Admin → Detalhes da propriedade → ID da propriedade (só números).",connectSteps:["Abra o Google Analytics (GA4) da sua loja.","Vá em Admin → Acesso à propriedade (Gerenciamento de acesso).",`Clique em + → Adicionar usuários, cole ${ve} e conceda o papel Leitor.`,"Copie o ID da propriedade (Admin → Detalhes da propriedade) e cole abaixo."]},gsc:{label:"Google Search Console",resourceLabel:"Site / propriedade",resourcePlaceholder:"ex: sc-domain:sualoja.com.br",resourceHint:"Use o mesmo formato que aparece no Search Console: sc-domain:sualoja.com.br ou https://www.sualoja.com.br/.",connectSteps:["Abra o Google Search Console da sua loja.","Vá em Configurações → Usuários e permissões.",`Clique em Adicionar usuário, cole ${ve} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Pn(s,e){const t=Tt[s].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${t}.`,steps:s==="ga4"?[`Confirme que ${ve} foi adicionado em Admin → Acesso à propriedade com o papel Leitor.`,"Confira se o ID da propriedade está correto (só números, sem o prefixo 'properties/').","A concessão de acesso pode levar alguns segundos — tente novamente."]:[`Confirme que ${ve} foi adicionado em Configurações → Usuários e permissões.`,"A permissão precisa ser Completa ou Restrita — 'Não verificado' não funciona.","Confira se o endereço do site está exatamente como aparece no Search Console."]};case"no-web-stream":return{title:"Esta propriedade do GA4 não tem um fluxo de dados da Web (site) configurado.",steps:["No GA4, vá em Admin → Fluxos de dados.","Clique em Adicionar fluxo → Web.","Informe a URL do site da sua loja e salve o fluxo.","Volte aqui e tente vincular de novo. (Propriedades só de app precisam de vínculo manual — fale com o suporte.)"]};case"no-match":return{title:"O recurso informado não corresponde ao domínio desta loja.",steps:s==="ga4"?["Verifique se digitou o ID da propriedade certa — provavelmente é de outro site.","No GA4, o site medido aparece em Admin → Fluxos de dados → (seu fluxo Web) → URL do stream."]:["Verifique se selecionou a propriedade do Search Console referente a esta loja.","O endereço precisa cobrir o mesmo domínio do diagnóstico."]};case"resource_already_bound":return{title:"Este recurso já está vinculado a outra loja.",steps:["Se este recurso é realmente desta loja, fale com o suporte para uma revisão manual.","Caso tenha digitado o id errado, confira e tente novamente."]};default:return{title:"Não foi possível verificar o acesso a este recurso.",steps:["Revise os passos de acesso acima e tente novamente.","Se persistir, fale com o suporte."]}}}function $n(s){const e=G.c(95),{provider:t,siteUrl:o,selfClient:d,org:r,initialResourceId:m,onDone:i,onIsPendingChange:c,onOAuthInstead:h}=s,a=ie(),l=Tt[t],f=Ee(),[u,j]=M.useState(null);let v,b;if(e[0]!==l.resourceLabel||e[1]!==a){const W=Se({resourceId:le().trim().min(1,a("commerceOnboarding.saBindingForm.resourceIdRequired",{resourceLabel:l.resourceLabel.toLowerCase()}))});b=Ne,v=_e(W),e[0]=l.resourceLabel,e[1]=a,e[2]=v,e[3]=b}else v=e[2],b=e[3];const p=m??"";let g;e[4]!==p?(g={resourceId:p},e[4]=p,e[5]=g):g=e[5];let S;e[6]!==v||e[7]!==g?(S={resolver:v,defaultValues:g},e[6]=v,e[7]=g,e[8]=S):S=e[8];const x=b(S);let k;e[9]!==t||e[10]!==d||e[11]!==o||e[12]!==a?(k=async W=>{if(!o)throw new Error(a("commerceOnboarding.saBindingForm.storeUrlUnavailable"));const re=await d.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:t,resourceId:W.resourceId}});return ne(re)},e[9]=t,e[10]=d,e[11]=o,e[12]=a,e[13]=k):k=e[13];let A,C;e[14]!==c?(A=()=>c?.(!0),C=()=>c?.(!1),e[14]=c,e[15]=A,e[16]=C):(A=e[15],C=e[16]);let y;e[17]!==l.label||e[18]!==i||e[19]!==r||e[20]!==t||e[21]!==f||e[22]!==o||e[23]!==a?(y=async W=>{if(W.ok){j(null),Fe.success(a("commerceOnboarding.saBindingForm.connectedSuccess",{label:l.label})),o&&await f.invalidateQueries({queryKey:X.commerceDiscoveryConnectionStatus(r.id,o)}),i();return}j({...Pn(t,W.reason??"unknown"),detail:W.detail})},e[17]=l.label,e[18]=i,e[19]=r,e[20]=t,e[21]=f,e[22]=o,e[23]=a,e[24]=y):y=e[24];let I;e[25]!==k||e[26]!==A||e[27]!==C||e[28]!==y?(I={mutationFn:k,onMutate:A,onSettled:C,onSuccess:y},e[25]=k,e[26]=A,e[27]=C,e[28]=y,e[29]=I):I=e[29];const O=De(I);let E;if(e[30]!==x||e[31]!==O){let W;e[33]!==O?(W=re=>O.mutate(re),e[33]=O,e[34]=W):W=e[34],E=x.handleSubmit(W),e[30]=x,e[31]=O,e[32]=E}else E=e[32];const L=E,_=O.isPending;let N;e[35]!==a?(N=()=>{navigator.clipboard?.writeText(ve),Fe.success(a("commerceOnboarding.saBindingForm.emailCopied"))},e[35]=a,e[36]=N):N=e[36];const R=N;let D;e[37]!==l.connectSteps?(D=l.connectSteps.map(Kn),e[37]=l.connectSteps,e[38]=D):D=e[38];let P;e[39]!==D?(P=n.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:D}),e[39]=D,e[40]=P):P=e[40];let q;e[41]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:ve}),e[41]=q):q=e[41];let U;e[42]!==a?(U=a("commerceOnboarding.saBindingForm.copyEmailLabel"),e[42]=a,e[43]=U):U=e[43];let V;e[44]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(jt,{size:16}),e[44]=V):V=e[44];let K;e[45]!==R||e[46]!==U?(K=n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[q,n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm",onClick:R,"aria-label":U,children:V})]}),e[45]=R,e[46]=U,e[47]=K):K=e[47];let F;e[48]!==l.resourceHint||e[49]!==l.resourceLabel||e[50]!==l.resourcePlaceholder||e[51]!==_?(F=W=>{const{field:re}=W;return n.jsxs(de,{children:[n.jsx(ge,{children:l.resourceLabel}),n.jsx(me,{children:n.jsx(xe,{...re,placeholder:l.resourcePlaceholder,disabled:_,autoComplete:"off"})}),n.jsx(Qt,{children:l.resourceHint}),n.jsx(ue,{})]})},e[48]=l.resourceHint,e[49]=l.resourceLabel,e[50]=l.resourcePlaceholder,e[51]=_,e[52]=F):F=e[52];let w;e[53]!==x.control||e[54]!==F?(w=n.jsx(ce,{control:x.control,name:"resourceId",render:F}),e[53]=x.control,e[54]=F,e[55]=w):w=e[55];let $;e[56]!==x||e[57]!==w?($=n.jsx(Oe,{...x,children:w}),e[56]=x,e[57]=w,e[58]=$):$=e[58];let T;e[59]!==u?(T=u&&n.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:u.title}),n.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:u.steps.map(qn)})]}),e[59]=u,e[60]=T):T=e[60];let B;e[61]!==O.error||e[62]!==O.isError||e[63]!==a?(B=O.isError&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:O.error instanceof Error?O.error.message:a("commerceOnboarding.saBindingForm.bindError")}),e[61]=O.error,e[62]=O.isError,e[63]=a,e[64]=B):B=e[64];let Q;e[65]!==_||e[66]!==h||e[67]!==a?(Q=h?n.jsx("button",{type:"button",onClick:h,disabled:_,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:a("commerceOnboarding.saBindingForm.googleLoginAlternative")}):n.jsx("span",{}),e[65]=_,e[66]=h,e[67]=a,e[68]=Q):Q=e[68];let te;e[69]!==a?(te=a("commerceOnboarding.saBindingForm.cancel"),e[69]=a,e[70]=te):te=e[70];let oe;e[71]!==_||e[72]!==i||e[73]!==te?(oe=n.jsx(Y,{type:"button",variant:"outline",onClick:i,disabled:_,children:te}),e[71]=_,e[72]=i,e[73]=te,e[74]=oe):oe=e[74];let J;e[75]!==_||e[76]!==a?(J=a(_?"commerceOnboarding.saBindingForm.verifying":"commerceOnboarding.saBindingForm.bind"),e[75]=_,e[76]=a,e[77]=J):J=e[77];let z;e[78]!==_||e[79]!==J?(z=n.jsx(Y,{type:"submit",disabled:_,children:J}),e[78]=_,e[79]=J,e[80]=z):z=e[80];let H;e[81]!==oe||e[82]!==z?(H=n.jsxs("div",{className:"flex gap-2",children:[oe,z]}),e[81]=oe,e[82]=z,e[83]=H):H=e[83];let ee;e[84]!==Q||e[85]!==H?(ee=n.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[Q,H]}),e[84]=Q,e[85]=H,e[86]=ee):ee=e[86];let ae;return e[87]!==L||e[88]!==P||e[89]!==K||e[90]!==$||e[91]!==T||e[92]!==B||e[93]!==ee?(ae=n.jsxs("form",{onSubmit:L,className:"space-y-4",children:[P,K,$,T,B,ee]}),e[87]=L,e[88]=P,e[89]=K,e[90]=$,e[91]=T,e[92]=B,e[93]=ee,e[94]=ae):ae=e[94],ae}function qn(s){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":!0,children:"•"}),n.jsx("span",{children:s})]},s)}function Kn(s,e){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),n.jsx("span",{children:s})]},s)}function Un(){const s=G.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0];let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-3 sm:h-full sm:flex-col sm:items-stretch sm:p-4",children:[e,n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"hidden h-3 w-full animate-pulse rounded bg-muted/60 sm:block"})]}),n.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),s[1]=t):t=s[1],t}function ct(s){const e=G.c(17),{title:t,disconnecting:o,disabled:d,onDisconnect:r}=s,m=ie(),i=d||o;let c;e[0]!==m||e[1]!==t?(c=m("commerceOnboarding.companionCard.disconnectAriaLabel",{title:t}),e[0]=m,e[1]=t,e[2]=c):c=e[2];let h;e[3]!==o?(h=o?n.jsx(Ve,{size:16,className:"animate-spin"}):n.jsx($t,{size:16}),e[3]=o,e[4]=h):h=e[4];let a;e[5]!==r||e[6]!==i||e[7]!==c||e[8]!==h?(a=n.jsx(Qe,{asChild:!0,children:n.jsx(Y,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:i,onClick:r,"aria-label":c,children:h})}),e[5]=r,e[6]=i,e[7]=c,e[8]=h,e[9]=a):a=e[9];let l;e[10]!==m?(l=m("commerceOnboarding.companionCard.disconnect"),e[10]=m,e[11]=l):l=e[11];let f;e[12]!==l?(f=n.jsx(He,{children:l}),e[12]=l,e[13]=f):f=e[13];let u;return e[14]!==a||e[15]!==f?(u=n.jsxs(Me,{children:[a,f]}),e[14]=a,e[15]=f,e[16]=u):u=e[16],u}function zn(s){const e=G.c(23),{card:t,connecting:o,disconnecting:d,disabled:r,onConnect:m,onDisconnect:i,org:c,selfClient:h,siteUrl:a,autoOpenConfigFieldKey:l,onAutoOpenConfigHandled:f}=s,u=t.linkedConnectionId,j=Ot[t.bindingType],v=!!j&&t.boundVia!=="oauth",b=t.satisfied&&!t.configured;let p;e[0]!==l||e[1]!==t||e[2]!==o||e[3]!==r||e[4]!==d||e[5]!==u||e[6]!==b||e[7]!==f||e[8]!==m||e[9]!==i||e[10]!==c||e[11]!==j||e[12]!==h||e[13]!==a||e[14]!==v?(p=v&&j?n.jsx(Vn,{card:t,provider:j,org:c,selfClient:h,siteUrl:a,onOAuthInstead:m,disabled:r,connecting:o,primary:t.required}):t.satisfied&&u?b?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsx(M.Suspense,{fallback:n.jsx(dt,{}),children:n.jsx(mt,{card:t,org:c,selfClient:h,connectionId:u,contextSiteUrl:a,variant:"configure",disabled:r,autoOpen:lt({autoOpenFieldKey:l,card:t}),onAutoOpenHandled:f})}),n.jsx(ct,{title:t.title,disconnecting:d,disabled:r,onDisconnect:i})]}):n.jsx(_t,{detail:t.connectedDetail,controls:n.jsxs(n.Fragment,{children:[n.jsx(M.Suspense,{fallback:n.jsx(dt,{}),children:n.jsx(mt,{card:t,org:c,selfClient:h,connectionId:u,contextSiteUrl:a,variant:"gear",disabled:r,autoOpen:lt({autoOpenFieldKey:l,card:t}),onAutoOpenHandled:f})}),n.jsx(ct,{title:t.title,disconnecting:d,disabled:r,onDisconnect:i})]})}):n.jsx(St,{connecting:o,disabled:r,title:t.title,primary:t.required,onConnect:m}),e[0]=l,e[1]=t,e[2]=o,e[3]=r,e[4]=d,e[5]=u,e[6]=b,e[7]=f,e[8]=m,e[9]=i,e[10]=c,e[11]=j,e[12]=h,e[13]=a,e[14]=v,e[15]=p):p=e[15];const g=p,S=t.required&&!t.satisfied;let x;return e[16]!==g||e[17]!==t.headline||e[18]!==t.icon||e[19]!==t.title||e[20]!==b||e[21]!==S?(x=n.jsx(mn,{icon:t.icon,title:t.title,headline:t.headline,required:S,attention:b,action:g}),e[16]=g,e[17]=t.headline,e[18]=t.icon,e[19]=t.title,e[20]=b,e[21]=S,e[22]=x):x=e[22],x}function Vn(s){const e=G.c(46),{card:t,provider:o,org:d,selfClient:r,siteUrl:m,onOAuthInstead:i,disabled:c,connecting:h,primary:a}=s,l=ie(),[f,u]=M.useState(!1),[j,v]=M.useState(!1);let b;e[0]!==j?(b=D=>{!D&&j||u(D)},e[0]=j,e[1]=b):b=e[1];const p=b;let g;e[2]!==t.connectedDetail||e[3]!==t.satisfied||e[4]!==t.title||e[5]!==h||e[6]!==c||e[7]!==a||e[8]!==l?(g=t.satisfied?n.jsx(_t,{detail:t.connectedDetail,controls:n.jsxs(Me,{children:[n.jsx(Qe,{asChild:!0,children:n.jsx(Nt,{ariaLabel:l("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>u(!0)})}),n.jsx(He,{children:l("commerceOnboarding.companionCard.editConfiguration")})]})}):n.jsx(St,{connecting:h,disabled:c,title:t.title,primary:a,onConnect:()=>u(!0)}),e[2]=t.connectedDetail,e[3]=t.satisfied,e[4]=t.title,e[5]=h,e[6]=c,e[7]=a,e[8]=l,e[9]=g):g=e[9];let S;e[10]!==t.icon||e[11]!==t.title?(S=n.jsx(Ge,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[10]=t.icon,e[11]=t.title,e[12]=S):S=e[12];let x;e[13]!==t.title?(x=n.jsx(ft,{children:t.title}),e[13]=t.title,e[14]=x):x=e[14];let k;e[15]!==l?(k=l("commerceOnboarding.companionCard.grantAccessDescription"),e[15]=l,e[16]=k):k=e[16];let A;e[17]!==k?(A=n.jsx(pt,{children:k}),e[17]=k,e[18]=A):A=e[18];let C;e[19]!==x||e[20]!==A?(C=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[x,A]}),e[19]=x,e[20]=A,e[21]=C):C=e[21];let y;e[22]!==S||e[23]!==C?(y=n.jsxs(gt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[S,C]}),e[22]=S,e[23]=C,e[24]=y):y=e[24];const I=t.boundResource??void 0;let O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=()=>u(!1),e[25]=O):O=e[25];let E;e[26]!==t.satisfied||e[27]!==i?(E=t.satisfied?void 0:()=>{u(!1),i()},e[26]=t.satisfied,e[27]=i,e[28]=E):E=e[28];let L;e[29]!==d||e[30]!==o||e[31]!==r||e[32]!==m||e[33]!==E||e[34]!==I?(L=n.jsx($n,{provider:o,siteUrl:m,selfClient:r,org:d,initialResourceId:I,onDone:O,onIsPendingChange:v,onOAuthInstead:E}),e[29]=d,e[30]=o,e[31]=r,e[32]=m,e[33]=E,e[34]=I,e[35]=L):L=e[35];let _;e[36]!==L||e[37]!==y?(_=n.jsxs(ht,{className:"sm:max-w-lg",children:[y,L]}),e[36]=L,e[37]=y,e[38]=_):_=e[38];let N;e[39]!==p||e[40]!==f||e[41]!==_?(N=n.jsx(xt,{open:f,onOpenChange:p,children:_}),e[39]=p,e[40]=f,e[41]=_,e[42]=N):N=e[42];let R;return e[43]!==N||e[44]!==g?(R=n.jsxs(n.Fragment,{children:[g,N]}),e[43]=N,e[44]=g,e[45]=R):R=e[45],R}function dt(){const s=G.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0],e}function mt(s){const e=G.c(71),{card:t,org:o,selfClient:d,connectionId:r,contextSiteUrl:m,variant:i,disabled:c,autoOpen:h,onAutoOpenHandled:a}=s,l=ie();let f;e[0]!==r||e[1]!==o.id||e[2]!==o.slug?(f={connectionId:r,orgId:o.id,orgSlug:o.slug},e[0]=r,e[1]=o.id,e[2]=o.slug,e[3]=f):f=e[3];const u=Be(f),[j,v]=M.useState(h),[b,p]=M.useState(!1),g=Ee(),S=Rn[t.bindingType];let x;e[4]!==t.configurationState?(x=Ut(t.configurationState),e[4]=t.configurationState,e[5]=x):x=e[5];const k=x;let A;e[6]!==h||e[7]!==a?(A=()=>{v(!1),h&&a()},e[6]=h,e[7]=a,e[8]=A):A=e[8];const C=A;let y;e[9]!==C||e[10]!==b?(y=te=>{if(!(!te&&b)){if(!te){C();return}v(!0)}},e[9]=C,e[10]=b,e[11]=y):y=e[11];const I=y;let O;e[12]!==r||e[13]!==d?(O=async()=>{await d.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})},e[12]=r,e[13]=d,e[14]=O):O=e[14];let E;e[15]!==t.title||e[16]!==C||e[17]!==o.id||e[18]!==g||e[19]!==l?(E=async()=>{await g.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Fe.success(l("commerceOnboarding.companionCard.disconnectedSuccess",{title:t.title})),C()},e[15]=t.title,e[16]=C,e[17]=o.id,e[18]=g,e[19]=l,e[20]=E):E=e[20];let L;e[21]!==l?(L=()=>{Fe.error(l("commerceOnboarding.companionCard.disconnectError"))},e[21]=l,e[22]=L):L=e[22];let _;e[23]!==O||e[24]!==E||e[25]!==L?(_={mutationFn:O,onSuccess:E,onError:L},e[23]=O,e[24]=E,e[25]=L,e[26]=_):_=e[26];const N=De(_);if(!S)return null;let R;e[27]!==t.title||e[28]!==c||e[29]!==k||e[30]!==l||e[31]!==i?(R=i==="configure"?n.jsx(un,{disabled:c,title:t.title,onConfigure:()=>v(!0)}):n.jsxs(Me,{children:[n.jsx(Qe,{asChild:!0,children:n.jsx(Nt,{ariaLabel:l("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>v(!0)})}),n.jsx(He,{children:k.length>0?l("commerceOnboarding.companionCard.editConfiguration"):l("commerceOnboarding.companionCard.configure")})]}),e[27]=t.title,e[28]=c,e[29]=k,e[30]=l,e[31]=i,e[32]=R):R=e[32];const D=R;let P;e[33]!==t.icon||e[34]!==t.title?(P=n.jsx(Ge,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[33]=t.icon,e[34]=t.title,e[35]=P):P=e[35];let q;e[36]!==t.title?(q=n.jsx(ft,{children:t.title}),e[36]=t.title,e[37]=q):q=e[37];let U;e[38]!==t.title||e[39]!==l?(U=l("commerceOnboarding.companionCard.configureDescription",{title:t.title}),e[38]=t.title,e[39]=l,e[40]=U):U=e[40];let V;e[41]!==U?(V=n.jsx(pt,{children:U}),e[41]=U,e[42]=V):V=e[42];let K;e[43]!==q||e[44]!==V?(K=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[q,V]}),e[43]=q,e[44]=V,e[45]=K):K=e[45];let F;e[46]!==P||e[47]!==K?(F=n.jsxs(gt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[P,K]}),e[46]=P,e[47]=K,e[48]=F):F=e[48];let w;e[49]!==N?(w=()=>N.mutate(),e[49]=N,e[50]=w):w=e[50];let $;e[51]!==S||e[52]!==t||e[53]!==C||e[54]!==u||e[55]!==r||e[56]!==m||e[57]!==o||e[58]!==d||e[59]!==w?($=n.jsx(S,{card:t,connectionId:r,companionClient:u,selfClient:d,org:o,contextSiteUrl:m,onDone:C,onDisconnect:w,onIsPendingChange:p}),e[51]=S,e[52]=t,e[53]=C,e[54]=u,e[55]=r,e[56]=m,e[57]=o,e[58]=d,e[59]=w,e[60]=$):$=e[60];let T;e[61]!==F||e[62]!==$?(T=n.jsxs(ht,{className:"sm:max-w-lg",children:[F,$]}),e[61]=F,e[62]=$,e[63]=T):T=e[63];let B;e[64]!==j||e[65]!==I||e[66]!==T?(B=n.jsx(xt,{open:j,onOpenChange:I,children:T}),e[64]=j,e[65]=I,e[66]=T,e[67]=B):B=e[67];let Q;return e[68]!==B||e[69]!==D?(Q=n.jsxs(n.Fragment,{children:[D,B]}),e[68]=B,e[69]=D,e[70]=Q):Q=e[70],Q}const Ze={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},shopify:{registryAppId:"deco/shopify",area:"Catálogo",headline:"Pedidos, estoque e catálogo direto da sua Shopify."},"google-analytics":{registryAppId:"deco/google-analytics",area:"Funil",headline:"Onde a receita vaza no seu funil."},"google-search-console":{registryAppId:"deco/google-search-console",area:"Busca",headline:"O tráfego de busca que você deixa na mesa."},github:{registryAppId:"deco/mcp-github",area:"Engenharia",headline:"A saúde da entrega de código por trás da sua loja."}};function Bn(s){const e=G.c(40),{selfClient:t,org:o,cdConnectionId:d,siteUrl:r}=s;let m;e[0]!==d||e[1]!==o.id||e[2]!==o.slug?(m={connectionId:d,orgId:o.id,orgSlug:o.slug},e[0]=d,e[1]=o.id,e[2]=o.slug,e[3]=m):m=e[3];const i=Be(m);let c;e[4]!==d||e[5]!==o.id?(c=X.commerceDiscoveryCompanionSchema(o.id,d),e[4]=d,e[5]=o.id,e[6]=c):c=e[6];let h;e[7]!==i?(h=async()=>{const z=await i.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(z)},e[7]=i,e[8]=h):h=e[8];let a;e[9]!==c||e[10]!==h?(a={queryKey:c,queryFn:h,retry:!1},e[9]=c,e[10]=h,e[11]=a):a=e[11];const l=je(a),f=l.data?.stateSchema?zt(l.data.stateSchema):null,u=f&&f.length>0?f:Vt,j=u.map(eo),v=u.map(Jn).filter(Xn),b=u.filter(Zn).map(Yn),p=[...v,...b].sort().join(",");let g;e[12]!==d||e[13]!==o.id?(g=X.commerceDiscoveryConnection(o.id,d),e[12]=d,e[13]=o.id,e[14]=g):g=e[14];let S;e[15]!==d||e[16]!==t?(S=async()=>{const z=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}});return ne(z)},e[15]=d,e[16]=t,e[17]=S):S=e[17];let x;e[18]!==g||e[19]!==S?(x={queryKey:g,queryFn:S},e[18]=g,e[19]=S,e[20]=x):x=e[20];const A=Ue(x).data?.item?.configuration_state??null;let C;e[21]!==A?(C=z=>A?.[z.fieldKey]?.value,e[21]=A,e[22]=C):C=e[22];const y=u.map(C).filter(Wn),I=[...j.map(Hn),...v.map(Qn),...y.map(Mn)].sort().join(","),E=Ue({queryKey:X.commerceDiscoveryCompanionConnections(o.id,I),queryFn:async()=>{if(u.length===0)return{items:[]};const z=[{field:["app_name"],operator:"in",value:j},{field:["app_id"],operator:"in",value:v}];y.length>0&&z.push({field:["id"],operator:"in",value:y});const H=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:z},limit:1e3}});return ne(H)}}).data?.items??[],L=new Set(y),_=E.filter(z=>L.has(z.id)),N=_.filter(Gn);let R;e[23]!==o.id||e[24]!==o.slug?(R=z=>({queryKey:X.commerceDiscoveryCompanionOAuthStatus(o.id,z.id),queryFn:async()=>{try{const H=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(z.id)}/oauth-token/status`,{credentials:"include"});return H.ok?{hasToken:(await H.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=R):R=e[25];const D=sn({queries:N.map(R)});let P;e[26]!==D?(P=(z,H)=>[z.id,D[H]?.data?.hasToken===!0],e[26]=D,e[27]=P):P=e[27];const q=new Map(N.map(P)),U={};for(const z of _)U[z.id]=!z.oauth_config||!!z.connection_token||q.get(z.id)===!0;const V=Ue({queryKey:X.commerceDiscoveryCompanionRegistry(o.id,p),queryFn:async()=>{if(u.length===0)return{items:[]};const z=Bt(v,b),H=await en(ut.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...z?{where:z}:{},limit:1e3});return ne(H)}}),K={},F={};for(const z of V.data?.items??[])K[z.id]=z,z.server?.name&&(F[z.server.name]=z);let w;e[28]!==o.id||e[29]!==r?(w=X.commerceDiscoveryConnectionStatus(o.id,r??""),e[28]=o.id,e[29]=r,e[30]=w):w=e[30];const $=!!r;let T;e[31]!==t||e[32]!==r?(T=async()=>{const z=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:r}});return ne(z)},e[31]=t,e[32]=r,e[33]=T):T=e[33];let B;e[34]!==w||e[35]!==$||e[36]!==T?(B={queryKey:w,enabled:$,queryFn:T},e[34]=w,e[35]=$,e[36]=T,e[37]=B):B=e[37];const Q=je(B),te={};for(const[z,H]of Object.entries(Ot)){const ee=Q.data?.providers?.[H];ee?.connected&&ee.via==="sa"&&(te[z]={resource:ee.resource??null})}const oe=Gt({requirements:u,itemsById:K,itemsByName:F,connections:E,connectionReadiness:U,configurationState:A,curated:Ze,saBindings:te});let J;return e[38]!==oe?(J={cards:oe},e[38]=oe,e[39]=J):J=e[39],J}function Gn(s){return s.oauth_config&&!s.connection_token}function Mn(s){return`linked:${s}`}function Qn(s){return`app:${s}`}function Hn(s){return`binding:${s}`}function Wn(s){return typeof s=="string"&&s.length>0}function Yn(s){return s.bindingType}function Zn(s){return!Ze[s.bindingType]}function Xn(s){return!!s}function Jn(s){return Ze[s.bindingType]?.registryAppId}function eo(s){return s.bindingType}function to({selfClient:s,org:e,userId:t,cdConnectionId:o,domain:d,siteUrl:r}){const m=Ee(),[i,c]=M.useState(null),[h,a]=M.useState(null),[l,f]=M.useState(null),u=async(b,p)=>{const g=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:b,data:p}});return ne(g)};async function j(b){c(b.fieldKey),f(null);const p={app_name:b.title,field_key:b.fieldKey,organization_id:e.id,domain:d,site_url:r};fe("commerce_onboarding_companion_connect_clicked",p);try{let g=b.candidateConnectionId;if(!g){const y=tn(b.registryItem,e.id,t,{remoteIndex:0}),I=y.connection_type==="STDIO",O=!!y.connection_url,E=I&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!O&&!E)return fe("commerce_onboarding_companion_connect_failed",{...p,error:"no_connection_method"}),f(`${b.title} cannot be connected: no connection method available`),!1;const L=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:y}});g=ne(L).item.id}const S=g,x=await on({connectionId:S,orgId:e.id,orgSlug:e.slug,persistFallback:y=>u(S,{connection_token:y}).then(()=>{})});if(!x.ok)return fe("commerce_onboarding_companion_connect_failed",{...p,error:x.error}),f(`Couldn't sign in to ${b.title}: ${x.error}`),!1;const k=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),A=ne(k).item?.configuration_state??null,C=Mt(A,b.fieldKey,b.bindingType,S);return b.bindingType==="github"&&delete C.github_repo,await u(o,{configuration_state:C}),await m.invalidateQueries({queryKey:X.commerceDiscoveryConnection(e.id,o)}),await m.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),fe("commerce_onboarding_companion_connected",p),!0}catch(g){return fe("commerce_onboarding_companion_connect_failed",{...p,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{c(null)}}async function v(b){a(b.fieldKey),f(null);const p={app_name:b.title,field_key:b.fieldKey,organization_id:e.id,domain:d,site_url:r};fe("commerce_onboarding_companion_disconnect_clicked",p);try{const g=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),x={...ne(g).item?.configuration_state??null??{}};return delete x[b.fieldKey],b.bindingType==="github"&&delete x.github_repo,await u(o,{configuration_state:x}),await m.invalidateQueries({queryKey:X.commerceDiscoveryConnection(e.id,o)}),await m.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),fe("commerce_onboarding_companion_disconnected",p),!0}catch(g){return fe("commerce_onboarding_companion_disconnect_failed",{...p,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{a(null)}}return{connect:j,connectingFieldKey:i,disconnect:v,disconnectingFieldKey:h,error:l}}const Xe="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-6";function Je(){const s=G.c(4),e=ie();let t;s[0]!==e?(t=e("routes.commerceOnboarding.companionSection.title"),s[0]=e,s[1]=t):t=s[1];let o;return s[2]!==t?(o=n.jsx("h1",{className:"text-lg font-medium leading-6 text-foreground lg:text-xl lg:leading-7",children:t}),s[2]=t,s[3]=o):o=s[3],o}function no(){const s=G.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2,3].map(oo)}),s[0]=e):e=s[0],e}function oo(s){return n.jsx(Un,{},s)}function so(){const s=G.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:Xe,children:[n.jsx(Je,{}),n.jsx(no,{})]}),s[0]=e):e=s[0],e}function io(s){const e=G.c(18),{onRetry:t}=s,o=ie();let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Je,{}),e[0]=d):d=e[0];let r;e[1]!==o?(r=o("routes.commerceOnboarding.companionSection.loadError"),e[1]=o,e[2]=r):r=e[2];let m;e[3]!==r?(m=n.jsx("p",{className:"text-sm text-foreground",children:r}),e[3]=r,e[4]=m):m=e[4];let i;e[5]!==o?(i=o("routes.commerceOnboarding.companionSection.loadErrorDescription"),e[5]=o,e[6]=i):i=e[6];let c;e[7]!==i?(c=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:i}),e[7]=i,e[8]=c):c=e[8];let h;e[9]!==o?(h=o("routes.commerceOnboarding.companionSection.retry"),e[9]=o,e[10]=h):h=e[10];let a;e[11]!==t||e[12]!==h?(a=n.jsx(Y,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:h}),e[11]=t,e[12]=h,e[13]=a):a=e[13];let l;return e[14]!==m||e[15]!==c||e[16]!==a?(l=n.jsxs("div",{className:Xe,children:[d,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[m,c,a]})]}),e[14]=m,e[15]=c,e[16]=a,e[17]=l):l=e[17],l}function Lo(s){const e=G.c(2);let t;return e[0]!==s?(t=n.jsx(Ft,{children:o=>{const{reset:d}=o;return n.jsx(Lt,{fallback:r=>{const{resetError:m}=r;return n.jsx(io,{onRetry:()=>{d(),m()}})},children:n.jsx(M.Suspense,{fallback:n.jsx(so,{}),children:n.jsx(ro,{...s})})})}}),e[0]=s,e[1]=t):t=e[1],t}function ro(s){const e=G.c(53),{org:t,cdConnectionId:o,siteUrl:d,onReadinessChange:r}=s,{data:m}=Dt.useSession(),i=m?.user?.id??"";let c;if(e[0]!==d){const q=d?Le(d):null;if(q?.ok)try{c=new URL(q.value).hostname}catch{c=void 0}e[0]=d,e[1]=c}else c=e[1];let h;e[2]!==t.id||e[3]!==t.slug?(h={connectionId:Pt,orgId:t.id,orgSlug:t.slug},e[2]=t.id,e[3]=t.slug,e[4]=h):h=e[4];const a=Be(h);let l;e[5]!==o||e[6]!==t||e[7]!==a||e[8]!==d?(l={selfClient:a,org:t,cdConnectionId:o,siteUrl:d},e[5]=o,e[6]=t,e[7]=a,e[8]=d,e[9]=l):l=e[9];const{cards:f}=Bn(l);let u;e[10]!==o||e[11]!==t||e[12]!==a||e[13]!==c||e[14]!==d||e[15]!==i?(u={selfClient:a,org:t,userId:i,cdConnectionId:o,domain:c,siteUrl:d},e[10]=o,e[11]=t,e[12]=a,e[13]=c,e[14]=d,e[15]=i,e[16]=u):u=e[16];const{connect:j,connectingFieldKey:v,disconnect:b,disconnectingFieldKey:p,error:g}=to(u),[S,x]=M.useState(null),k=co;let A,C,y,I,O,E,L,_,N;if(e[17]!==S||e[18]!==f||e[19]!==j||e[20]!==g||e[21]!==v||e[22]!==b||e[23]!==p||e[24]!==r||e[25]!==t||e[26]!==a||e[27]!==d){y=Symbol.for("react.early_return_sentinel");e:{const q=f.filter(lo),U=f.filter(ao),V=q.length>0?q.every(k):f.length===0||f.some(k);if(r?.(V),f.length===0){y=null;break e}const K=v!==null||p!==null,F=w=>{const $=async()=>{await j(w)&&x(w.fieldKey)};return n.jsx(zn,{card:w,connecting:v===w.fieldKey,disconnecting:p===w.fieldKey,disabled:K&&v!==w.fieldKey&&p!==w.fieldKey,org:t,selfClient:a,siteUrl:d,autoOpenConfigFieldKey:S,onAutoOpenConfigHandled:()=>x(T=>T===w.fieldKey?null:T),onConnect:()=>{$()},onDisconnect:()=>{b(w)}},w.fieldKey)};N=Xe,e[37]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(Je,{}),e[37]=C):C=e[37],A=dn,E="flex min-h-0 flex-1 flex-col md:block",L="-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",e[38]!==g?(_=g&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:g}),e[38]=g,e[39]=_):_=e[39],I="flex flex-col gap-4 pt-3",O=[...q,...U].map(F)}e[17]=S,e[18]=f,e[19]=j,e[20]=g,e[21]=v,e[22]=b,e[23]=p,e[24]=r,e[25]=t,e[26]=a,e[27]=d,e[28]=A,e[29]=C,e[30]=y,e[31]=I,e[32]=O,e[33]=E,e[34]=L,e[35]=_,e[36]=N}else A=e[28],C=e[29],y=e[30],I=e[31],O=e[32],E=e[33],L=e[34],_=e[35],N=e[36];if(y!==Symbol.for("react.early_return_sentinel"))return y;let R;e[40]!==I||e[41]!==O?(R=n.jsx("div",{className:I,children:O}),e[40]=I,e[41]=O,e[42]=R):R=e[42];let D;e[43]!==A||e[44]!==R||e[45]!==E||e[46]!==L||e[47]!==_?(D=n.jsxs(A,{wrapperClassName:E,className:L,children:[_,R]}),e[43]=A,e[44]=R,e[45]=E,e[46]=L,e[47]=_,e[48]=D):D=e[48];let P;return e[49]!==C||e[50]!==D||e[51]!==N?(P=n.jsxs("div",{className:N,children:[C,D]}),e[49]=C,e[50]=D,e[51]=N,e[52]=P):P=e[52],P}function ao(s){return!s.required}function lo(s){return s.required}function co(s){return s.satisfied&&s.configured}function mo(s){return s.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Do(s){const e=s;if(e.isError)throw new Error(mo(e));return e.structuredContent??s}export{so as C,Ye as L,dn as S,Lo as a,Ao as i,Le as n,Do as p,Fo as s};
@@ -1 +1 @@
1
- import{c as T,b as ve,j as o,r as ee,B as je,k as Se}from"./index-T8UtHXRW.js";import{i as ke}from"./ChevronRight-DofsbtWu.js";import{a6 as fe}from"./agent-icon-D5XWrthR.js";import{l as xe}from"./automation-runs-CRTARkGb.js";import{r as Ne,c as we,u as _e,a as Ee,i as Pe,d as Te,f as Fe,P as Re,S as Ce}from"./page-seo-form-D7B-sCCx.js";import{a8 as ue,a0 as Ke}from"./index-BNaeYakB.js";import{a as ye}from"./Tool01-C5h3WP4s.js";import"./AlertCircle-BKWtHLuM.js";import"./ArrowUp-Cxv-XBQA.js";import"./Settings02-C-wQUSYI.js";import"./Tool02-D6kdZPtA.js";import"./XCircle-B3w-kPPf.js";import"./ArrowUpRight-D66LLTae.js";import"./TrendUp01-CowO6BlO.js";import"./ZapSquare-BSheoe64.js";import"./Users03-B93N8SgD.js";import"./CheckCircle-O6WYhGlf.js";import"./Check-Cf1p4cPm.js";import"./ChevronDown-Jt_S9JUZ.js";import"./ChevronUp-BlcGyfw1.js";import"./DotsVertical-67buAsMV.js";import"./Stars02-BfxCpI3j.js";import"./Copy01-BiGjHBg4.js";import"./CpuChip01-D_2Z9MMj.js";import"./Eye-DIqODX9i.js";import"./FilterLines-D0lq4PR2.js";import"./Star01-BvhXRrKP.js";import"./Palette-TVx5K9sd.js";import"./SwitchHorizontal01-CKXMG0H_.js";import"./HardDrive-Dchox8PE.js";import"./Key01-C1pgCoc-.js";import"./LayoutLeft-BZEc20IP.js";import"./LinkExternal01-BZBrn2jR.js";import"./LogOut01-ra5yyDYf.js";import"./Monitor01-DiblGrW3.js";import"./Sun-BhcJlJt7.js";import"./Play-CqEDB1Je.js";import"./Plus-CWNZghUJ.js";import"./SearchLg-C9IBm0V3.js";import"./SearchMd-B3zYmgrK.js";import"./Shield01-DHBz1rsf.js";import"./Stars01-DOE0Pjm1.js";import"./Trash01-D6nYBv8Q.js";import"./Upload01-D31qC2Bb.js";import"./User01-k32-Q8hw.js";import"./Users01-CaNmt7QX.js";import"./XClose-BxNA0UXq.js";import"./X-BFVN_Ew8.js";import"./Zap-BvFWTo0d.js";import"./select-DTHMSVvR.js";import"./tooltip-Dm896ony.js";import"./useInfiniteQuery-CI2iG6K5.js";import"./use-infinite-scroll-D_1cIQuB.js";import"./use-connection-Cv9n2bg4.js";import"./use-mcp-client-Beixgeu8.js";import"./auth-BL1qGwfH.js";import"./use-virtual-mcp-DGBXqKbp.js";import"./card-_UBviVQl.js";import"./sidebar-D_-oDydd.js";import"./use-mobile-CINzfRDA.js";import"./table-Dqf82LGl.js";import"./empty-state-BhMUIGeR.js";import"./use-members-DFZua-Mi.js";import"./use-org-auth-client-DjyNTqL5.js";import"./use-clock-tick-DB4wLWKF.js";import"./use-automations-BAuuqtFF.js";import"./studio-tools-Drz6Ql7x.js";import"./useSuspenseInfiniteQuery-MqpBAc3M.js";import"./avatar-D56i9NK7.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-C3J1yKwP.js";import"./calendar-CuwV5_kH.js";import"./dialog-DBHygfOy.js";import"./tab-id-CLMXpokn.js";import"./hooks-_6qLH3a1.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-BqHy9fYR.js";import"./chat-context-B5q0NFRT.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-C90iwQma.js";import"./use-decopilot-events-BjxyNJFw.js";import"./use-organization-settings-ldPN5XeT.js";import"./monaco-editor-CF2PLFdW.js";import"./spinner-C0JZ4pZa.js";import"./index-CMNRmHCU.js";import"./shell-layout-mys1mpVU.js";import"./required-auth-layout-DhWi4UTr.js";import"./use-org-sso-xxLJrDI3.js";import"./integration-icon-DM84oKIR.js";import"./use-navigate-to-agent-DbFXXpsT.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-6Z8zdJku.js";import"./form-C31Guq6I.js";import"./label-QBKT0ian.js";import"./input-Bp5qVo1d.js";import"./switch-y3vto-gq.js";import"./drawer-C97GmoZZ.js";import"./collection-search-DJ06uz8M.js";import"./index-Ckm1UYTd.js";import"./get-initials-D-f_fDFw.js";import"./popover-CArWaBSj.js";import"./dropdown-menu-DxzIdPjM.js";import"./github-repo-picker-lVUi3c9s.js";import"./use-debounced-value-B7BOJtlx.js";import"./authenticate-and-persist-oauth-B-Cee2FB.js";import"./mcp-oauth-DIWhMMB3.js";import"./use-mcp-tools-CR8PDvke.js";import"./extract-connection-data-B0zB4rYk.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-CAXumITS.js";import"./use-tags-dMm8oLa7.js";import"./skeleton-BKzYEyPy.js";import"./command-D474JxD9.js";import"./index-CcjTk66d.js";import"./companions-core-C9f9-EJg.js";import"./tabs-Bpz-Jf9F.js";import"./toggle-group-9kMoq9st.js";import"./use-deco-credits-Comnp1EI.js";import"./alert-dialog-BdZDft22.js";import"./toolbar-CNUb_JNM.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-BjP5_tjD.js";import"./use-registry-connections-BO1HvgEu.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-COZXbZtD.js";import"./connection-form-helpers-0ay5zqRB.js";import"./collection-tabs-CEmKpAsc.js";import"./badge-DozN8el9.js";import"./select-model-C9wCmrpF.js";import"./checkbox-DHCVnLdZ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B09dtn0a.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BiyOR3fI.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-D1_GyAkB.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-VhFCGaYc.js";import"./use-debounced-autosave-BuY-zYWq.js";import"./index-Byy3-ESS.js";import"./search-input-DVLpoloj.js";import"./use-secrets-B_o-zwGG.js";import"./useQueries-CD6pVq1W.js";import"./use-file-configs-BjBZDLRS.js";import"./automation-list-row-jVwnpqZ3.js";function A(d){return typeof d=="string"&&d.trim()?d:void 0}function he(d,e){if(d){if(e)try{const t=new URL(d,e).href;return ue(t)}catch{return}return ue(d)}}function ze(d){if(!d)return{};const e=A(d.title),t=A(d.titleTemplate);return{title:e&&t?.includes("%s")?t.replace(/%s/g,e):e,description:A(d.description),image:A(d.image),favicon:A(d.favicon)}}function De(d){if(!d)return"example.com";try{return new URL(d).host}catch{return"example.com"}}const $e=[{id:"google",labelKey:"sectionsEditor.seoPreview.platformGoogle",color:"#4285F4",layout:"search"},{id:"facebook",labelKey:"sectionsEditor.seoPreview.platformFacebook",color:"#1877F2",layout:"card"},{id:"twitter",labelKey:"sectionsEditor.seoPreview.platformTwitter",color:"#0f1419",layout:"card"},{id:"linkedin",labelKey:"sectionsEditor.seoPreview.platformLinkedin",color:"#0A66C2",layout:"card"},{id:"whatsapp",labelKey:"sectionsEditor.seoPreview.platformWhatsapp",color:"#25D366",layout:"chat"},{id:"telegram",labelKey:"sectionsEditor.seoPreview.platformTelegram",color:"#229ED9",layout:"chat"},{id:"slack",labelKey:"sectionsEditor.seoPreview.platformSlack",color:"#611f69",layout:"attachment"},{id:"discord",labelKey:"sectionsEditor.seoPreview.platformDiscord",color:"#5865F2",layout:"attachment"}];function de(d){const e=T.c(10),{src:t,className:n,iconSize:v}=d,r=v===void 0?20:v;if(t){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={objectFit:"cover"},e[0]=m):m=e[0];let p;return e[1]!==n||e[2]!==t?(p=o.jsx("img",{src:t,alt:"",referrerPolicy:"no-referrer",className:n,style:m}),e[1]=n,e[2]=t,e[3]=p):p=e[3],p}let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s={display:"flex",alignItems:"center",justifyContent:"center",background:"#e5e7eb",color:"#9ca3af"},e[4]=s):s=e[4];let i;e[5]!==r?(i=o.jsx(ye,{size:r}),e[5]=r,e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==i?(a=o.jsx("div",{className:n,style:s,children:i}),e[7]=n,e[8]=i,e[9]=a):a=e[9],a}function Ie(d){const e=T.c(33),{seo:t,host:n,path:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#fff",border:"1px solid #dadce0"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={background:"#f1f3f4"},e[1]=i):i=e[1];let a;e[2]!==t.favicon?(a=o.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full",style:i,children:t.favicon?o.jsx("img",{src:t.favicon,alt:"",className:"size-full object-cover"}):o.jsx(ye,{size:12,color:"#9aa0a6"})}),e[2]=t.favicon,e[3]=a):a=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m={color:"#202124"},e[4]=m):m=e[4];let p;e[5]!==n?(p=o.jsx("div",{className:"truncate text-[13px] leading-tight",style:m,children:n}),e[5]=n,e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={color:"#4d5156"},e[7]=f):f=e[7];let l;e[8]!==n||e[9]!==v?(l=o.jsxs("div",{className:"truncate text-[12px] leading-tight",style:f,children:[n,v]}),e[8]=n,e[9]=v,e[10]=l):l=e[10];let c;e[11]!==p||e[12]!==l?(c=o.jsxs("div",{className:"min-w-0",children:[p,l]}),e[11]=p,e[12]=l,e[13]=c):c=e[13];let h;e[14]!==a||e[15]!==c?(h=o.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[14]=a,e[15]=c,e[16]=h):h=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x={color:"#1a0dab"},e[17]=x):x=e[17];let y;e[18]!==t.title||e[19]!==r?(y=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[18]=t.title,e[19]=r,e[20]=y):y=e[20];let u;e[21]!==y?(u=o.jsx("div",{className:"mt-1.5 truncate text-[18px] leading-snug",style:x,children:y}),e[21]=y,e[22]=u):u=e[22];let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S={color:"#4d5156"},e[23]=S):S=e[23];let g;e[24]!==t.description||e[25]!==r?(g=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[24]=t.description,e[25]=r,e[26]=g):g=e[26];let b;e[27]!==g?(b=o.jsx("div",{className:"mt-0.5 line-clamp-2 text-[13px] leading-snug",style:S,children:g}),e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==u||e[30]!==b||e[31]!==h?(j=o.jsxs("div",{className:"rounded-lg p-3 text-left",style:s,children:[h,u,b]}),e[29]=u,e[30]=b,e[31]=h,e[32]=j):j=e[32],j}function Le(d){const e=T.c(26),{seo:t,host:n,t:v}=d;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={background:"#fff",border:"1px solid #e2e8f0"},e[0]=r):r=e[0];let s;e[1]!==t.image?(s=o.jsx(de,{src:t.image,className:"h-40 w-full"}),e[1]=t.image,e[2]=s):s=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={borderTop:"1px solid #e2e8f0"},e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={color:"#8a9099"},e[4]=a):a=e[4];let m;e[5]!==n?(m=o.jsx("div",{className:"truncate text-[11px]",style:a,children:n}),e[5]=n,e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={color:"#1c2024"},e[7]=p):p=e[7];let f;e[8]!==t.title||e[9]!==v?(f=t.title??v("sectionsEditor.seoPreview.fallbackTitle"),e[8]=t.title,e[9]=v,e[10]=f):f=e[10];let l;e[11]!==f?(l=o.jsx("div",{className:"line-clamp-1 text-[14px] font-semibold",style:p,children:f}),e[11]=f,e[12]=l):l=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#60666c"},e[13]=c):c=e[13];let h;e[14]!==t.description||e[15]!==v?(h=t.description??v("sectionsEditor.seoPreview.fallbackDescription"),e[14]=t.description,e[15]=v,e[16]=h):h=e[16];let x;e[17]!==h?(x=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:c,children:h}),e[17]=h,e[18]=x):x=e[18];let y;e[19]!==x||e[20]!==m||e[21]!==l?(y=o.jsxs("div",{className:"px-3 py-2",style:i,children:[m,l,x]}),e[19]=x,e[20]=m,e[21]=l,e[22]=y):y=e[22];let u;return e[23]!==y||e[24]!==s?(u=o.jsxs("div",{className:"overflow-hidden rounded-lg text-left",style:r,children:[s,y]}),e[23]=y,e[24]=s,e[25]=u):u=e[25],u}function Be(d){const e=T.c(36),{seo:t,host:n,accent:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#f0f2f5"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={color:"#3b4045"},e[1]=i):i=e[1];let a;e[2]!==r?(a=r("sectionsEditor.seoPreview.chatCardHint"),e[2]=r,e[3]=a):a=e[3];let m;e[4]!==a?(m=o.jsx("p",{className:"px-1 pb-1.5 text-[12px]",style:i,children:a}),e[4]=a,e[5]=m):m=e[5];const p=`3px solid ${v}`;let f;e[6]!==p?(f={background:"#fff",borderLeft:p},e[6]=p,e[7]=f):f=e[7];let l;e[8]!==t.image?(l=o.jsx(de,{src:t.image,className:"h-28 w-full",iconSize:18}),e[8]=t.image,e[9]=l):l=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#1c2024"},e[10]=c):c=e[10];let h;e[11]!==t.title||e[12]!==r?(h=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[11]=t.title,e[12]=r,e[13]=h):h=e[13];let x;e[14]!==h?(x=o.jsx("div",{className:"line-clamp-1 text-[12px] font-semibold",style:c,children:h}),e[14]=h,e[15]=x):x=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y={color:"#60666c"},e[16]=y):y=e[16];let u;e[17]!==t.description||e[18]!==r?(u=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[17]=t.description,e[18]=r,e[19]=u):u=e[19];let S;e[20]!==u?(S=o.jsx("div",{className:"line-clamp-2 text-[11px]",style:y,children:u}),e[20]=u,e[21]=S):S=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g={color:"#8a9099"},e[22]=g):g=e[22];let b;e[23]!==n?(b=o.jsx("div",{className:"mt-0.5 text-[10px]",style:g,children:n}),e[23]=n,e[24]=b):b=e[24];let j;e[25]!==x||e[26]!==S||e[27]!==b?(j=o.jsxs("div",{className:"px-2.5 py-1.5",children:[x,S,b]}),e[25]=x,e[26]=S,e[27]=b,e[28]=j):j=e[28];let k;e[29]!==j||e[30]!==f||e[31]!==l?(k=o.jsxs("div",{className:"overflow-hidden rounded-md",style:f,children:[l,j]}),e[29]=j,e[30]=f,e[31]=l,e[32]=k):k=e[32];let N;return e[33]!==k||e[34]!==m?(N=o.jsxs("div",{className:"rounded-lg p-2 text-left",style:s,children:[m,k]}),e[33]=k,e[34]=m,e[35]=N):N=e[35],N}function Oe(d){const e=T.c(39),{seo:t,host:n,accent:v,dark:r,t:s}=d,i=r?"#2b2d31":"#fff",a=r?"#00a8fc":"#1264a3",m=r?"#dbdee1":"#3b4045",p=r?"#949ba4":"#8a9099",f=r?"none":"1px solid #e2e8f0";let l;e[0]!==i||e[1]!==f?(l={background:i,border:f},e[0]=i,e[1]=f,e[2]=l):l=e[2];const c=`3px solid ${v}`;let h;e[3]!==c?(h={borderLeft:c,borderRadius:2},e[3]=c,e[4]=h):h=e[4];let x;e[5]!==p?(x={color:p},e[5]=p,e[6]=x):x=e[6];let y;e[7]!==n||e[8]!==x?(y=o.jsx("div",{className:"text-[10px]",style:x,children:n}),e[7]=n,e[8]=x,e[9]=y):y=e[9];let u;e[10]!==a?(u={color:a},e[10]=a,e[11]=u):u=e[11];let S;e[12]!==t.title||e[13]!==s?(S=t.title??s("sectionsEditor.seoPreview.fallbackTitle"),e[12]=t.title,e[13]=s,e[14]=S):S=e[14];let g;e[15]!==u||e[16]!==S?(g=o.jsx("div",{className:"line-clamp-1 text-[13px] font-semibold",style:u,children:S}),e[15]=u,e[16]=S,e[17]=g):g=e[17];let b;e[18]!==m?(b={color:m},e[18]=m,e[19]=b):b=e[19];let j;e[20]!==t.description||e[21]!==s?(j=t.description??s("sectionsEditor.seoPreview.fallbackDescription"),e[20]=t.description,e[21]=s,e[22]=j):j=e[22];let k;e[23]!==b||e[24]!==j?(k=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:b,children:j}),e[23]=b,e[24]=j,e[25]=k):k=e[25];let N;e[26]!==k||e[27]!==y||e[28]!==g?(N=o.jsxs("div",{className:"min-w-0 flex-1",children:[y,g,k]}),e[26]=k,e[27]=y,e[28]=g,e[29]=N):N=e[29];let w;e[30]!==t.image?(w=o.jsx(de,{src:t.image,className:"size-14 shrink-0 rounded",iconSize:16}),e[30]=t.image,e[31]=w):w=e[31];let _;e[32]!==N||e[33]!==w||e[34]!==h?(_=o.jsxs("div",{className:"flex gap-2.5 pl-2.5",style:h,children:[N,w]}),e[32]=N,e[33]=w,e[34]=h,e[35]=_):_=e[35];let P;return e[36]!==_||e[37]!==l?(P=o.jsx("div",{className:"rounded-lg p-2.5 text-left",style:l,children:_}),e[36]=_,e[37]=l,e[38]=P):P=e[38],P}function Ue(d){const e=T.c(21),{platform:t,seo:n,host:v,path:r,t:s}=d;let i;e[0]!==v||e[1]!==r||e[2]!==t.color||e[3]!==t.id||e[4]!==t.layout||e[5]!==n||e[6]!==s?(i=t.layout==="search"?o.jsx(Ie,{seo:n,host:v,path:r,t:s}):t.layout==="card"?o.jsx(Le,{seo:n,host:v,path:r,t:s}):t.layout==="chat"?o.jsx(Be,{seo:n,host:v,path:r,accent:t.color,t:s}):o.jsx(Oe,{seo:n,host:v,path:r,accent:t.color,dark:t.id==="discord",t:s}),e[0]=v,e[1]=r,e[2]=t.color,e[3]=t.id,e[4]=t.layout,e[5]=n,e[6]=s,e[7]=i):i=e[7];const a=i;let m;e[8]!==t.color?(m=o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:t.color}}),e[8]=t.color,e[9]=m):m=e[9];let p;e[10]!==t.labelKey||e[11]!==s?(p=s(t.labelKey),e[10]=t.labelKey,e[11]=s,e[12]=p):p=e[12];let f;e[13]!==p?(f=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[13]=p,e[14]=f):f=e[14];let l;e[15]!==m||e[16]!==f?(l=o.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[m,f]}),e[15]=m,e[16]=f,e[17]=l):l=e[17];let c;return e[18]!==a||e[19]!==l?(c=o.jsxs("div",{children:[l,a]}),e[18]=a,e[19]=l,e[20]=c):c=e[20],c}function Ae(d){const e=T.c(18),{seo:t,url:n,path:v}=d,r=v===void 0?"/":v,s=ve();let i,a,m;if(e[0]!==t||e[1]!==n){const u=ze(t);i=u,a=he(u.image,n),m=he(u.favicon,n),e[0]=t,e[1]=n,e[2]=i,e[3]=a,e[4]=m}else i=e[2],a=e[3],m=e[4];let p;e[5]!==i||e[6]!==a||e[7]!==m?(p={...i,image:a,favicon:m},e[5]=i,e[6]=a,e[7]=m,e[8]=p):p=e[8];const f=p;let l;e[9]!==n?(l=De(n),e[9]=n,e[10]=l):l=e[10];const c=l,h=r==="/"?"":r;let x;e[11]!==h||e[12]!==c||e[13]!==s||e[14]!==f?(x=$e.map(u=>o.jsx(Ue,{platform:u,seo:f,host:c,path:h,t:s},u.id)),e[11]=h,e[12]=c,e[13]=s,e[14]=f,e[15]=x):x=e[15];let y;return e[16]!==x?(y=o.jsx("div",{className:"grid grid-cols-1 gap-4 @2xl:grid-cols-2",children:x}),e[16]=x,e[17]=y):y=e[17],y}function zi(d){const e=T.c(70),{orgSlug:t,virtualMcpId:n,branch:v,decofile:r,meta:s,target:i,previewBaseUrl:a,onSaved:m,onEditDefaultSeo:p,onBack:f}=d,l=ve(),c=Ne(r,i,s),h=c?.seoData,x=i.kind==="site"?"site":i.pageKey,[y,u]=ee.useState(x),[S,g]=ee.useState(null),[b,j]=ee.useState(0),[k,N]=ee.useState(void 0);y!==x&&(u(x),g(null),N(void 0),j(Ge));const{persistSeo:w,persistRawSeo:_,flush:P,isPending:te}=we({orgSlug:t,virtualMcpId:n,branch:v,target:i,resolved:c,onSaved:m}),M=i.kind==="page",ge=M?c?.rawSeoData:void 0,U=k!==void 0?k:ge,be=M?_e(U)??void 0:void 0,E=S??be??h??{},F=c?Ee(E,c):null,K=F&&(!M||Pe(U))?Ke(F,s):null;let G;e[0]!==s?(G=Te(s),e[0]=s,e[1]=G):G=e[1];const oe=G;let R,H;e[2]!==r||e[3]!==E||e[4]!==s||e[5]!==i.kind?(R=i.kind==="page"?Fe(r,s)?.seoData??{}:{},H=i.kind==="page"?Ve(R,E):E,e[2]=r,e[3]=E,e[4]=s,e[5]=i.kind,e[6]=R,e[7]=H):(R=e[6],H=e[7]);const ie=H;let V;e[8]!==w||e[9]!==c||e[10]!==g?(V=C=>{if(!c)return;const pe=C;g(pe),w(pe)},e[8]=w,e[9]=c,e[10]=g,e[11]=V):V=e[11];const se=V;let W;e[12]!==g?(W=()=>g(null),e[12]=g,e[13]=W):W=e[13];const le=W;let q;e[14]!==j?(q=()=>j(Me),e[14]=j,e[15]=q):q=e[15];const re=q;let J;e[16]!==P||e[17]!==f?(J=()=>{P(),f?.()},e[16]=P,e[17]=f,e[18]=J):J=e[18];const ce=J,z=i.kind==="page"?i.path:"/";let Q;e[19]!==z||e[20]!==a||e[21]!==i.kind?(Q=i.kind==="page"&&a?He(z,a):a??null,e[19]=z,e[20]=a,e[21]=i.kind,e[22]=Q):Q=e[22];const ne=Q;let X;e[23]!==c||e[24]!==l||e[25]!==i.kind?(X=i.kind==="site"?l("sectionsEditor.seoEditor.noSiteSeoBlock"):l(c?"sectionsEditor.seoEditor.noSeoSchema":"sectionsEditor.seoEditor.couldNotLoadSeo"),e[23]=c,e[24]=l,e[25]=i.kind,e[26]=X):X=e[26];const ae=X,Y=M&&c,me=i.kind==="site"&&c&&K;let D;e[27]!==ce||e[28]!==l||e[29]!==i.kind||e[30]!==i.pageName?(D=i.kind==="page"?o.jsxs("nav",{className:"flex min-w-0 items-center gap-1 text-sm",children:[o.jsx("button",{type:"button",onClick:ce,title:i.pageName,className:"min-w-0 truncate rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:i.pageName}),o.jsx(ke,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("span",{className:"px-1 py-0.5 font-medium text-foreground",children:"SEO"})]}):o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(fe,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:l("sectionsEditor.seoEditor.defaultSeoLabel")}),o.jsxs("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:["· ",l("sectionsEditor.seoEditor.appliedToEveryPage")]})]}),e[27]=ce,e[28]=l,e[29]=i.kind,e[30]=i.pageName,e[31]=D):D=e[31];let $;e[32]!==te?($=te&&o.jsx(Se,{size:14,className:"animate-spin text-muted-foreground"}),e[32]=te,e[33]=$):$=e[33];let I;e[34]!==p||e[35]!==l||e[36]!==i.kind?(I=i.kind==="page"&&p&&o.jsxs(je,{type:"button",variant:"outline",size:"sm",onClick:p,children:[o.jsx(fe,{size:14}),l("sectionsEditor.seoEditor.editDefaultSeoButton")]}),e[34]=p,e[35]=l,e[36]=i.kind,e[37]=I):I=e[37];let L;e[38]!==$||e[39]!==I?(L=o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[$,I]}),e[38]=$,e[39]=I,e[40]=L):L=e[40];let B;e[41]!==L||e[42]!==D?(B=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[D,L]}),e[41]=L,e[42]=D,e[43]=B):B=e[43];let O;e[44]!==F||e[45]!==re||e[46]!==le||e[47]!==oe||e[48]!==U||e[49]!==E||e[50]!==ae||e[51]!==b||e[52]!==se||e[53]!==z||e[54]!==_||e[55]!==w||e[56]!==ie||e[57]!==ne||e[58]!==c||e[59]!==K||e[60]!==g||e[61]!==N||e[62]!==Y||e[63]!==me||e[64]!==R||e[65]!==l?(O=!c||!Y&&!me?o.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground",children:ae}):o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx(xe,{className:"w-full max-w-md shrink-0 border-r [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-5 py-4",children:Y?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:l("sectionsEditor.seoEditor.emptyFieldsHint")}),o.jsx(Re,{rawSeo:U,innerSeo:E,defaultResolveType:oe,seoSchema:K,activeResolveType:F,seoTypeOptions:c.seoTypeOptions,formResetKey:b,siteDefaultSeo:R,onPersistRaw:C=>{N(C),_(C)},onInnerChange:C=>{g(C),w(C)},onClearForm:le,onBumpFormKey:re})]}):K&&F&&o.jsx(Ce,{schema:K,resolveType:F,value:E,formResetKey:b,onChange:se})})}),o.jsx(xe,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"@container px-5 py-4",children:o.jsx(Ae,{seo:ie,url:ne,path:z})})})]}),e[44]=F,e[45]=re,e[46]=le,e[47]=oe,e[48]=U,e[49]=E,e[50]=ae,e[51]=b,e[52]=se,e[53]=z,e[54]=_,e[55]=w,e[56]=ie,e[57]=ne,e[58]=c,e[59]=K,e[60]=g,e[61]=N,e[62]=Y,e[63]=me,e[64]=R,e[65]=l,e[66]=O):O=e[66];let Z;return e[67]!==B||e[68]!==O?(Z=o.jsxs("div",{className:"flex h-full w-full flex-col",children:[B,O]}),e[67]=B,e[68]=O,e[69]=Z):Z=e[69],Z}function Me(d){return d+1}function Ge(d){return d+1}function He(d,e){try{return new URL(d,e).href}catch{return e}}function Ve(d,e){const t=e.__resolveType,n=d.__resolveType;if(typeof t=="string"&&typeof n=="string"&&t!==n)return{...e};const v={...d};for(const[r,s]of Object.entries(e))r!=="__resolveType"&&s!=null&&(typeof s=="string"&&s.trim()===""||(v[r]=s));return v}export{zi as SeoEditor};
1
+ import{c as T,b as ve,j as o,r as ee,B as je,k as Se}from"./index-BwtPwDkT.js";import{i as ke}from"./ChevronRight-D8qRMofp.js";import{a6 as fe}from"./agent-icon-D24e3m8a.js";import{l as xe}from"./automation-runs-CefJAXbk.js";import{r as Ne,c as we,u as _e,a as Ee,i as Pe,d as Te,f as Fe,P as Re,S as Ce}from"./page-seo-form-DR8h-gQE.js";import{a8 as ue,a0 as Ke}from"./index-DAs-9e2l.js";import{a as ye}from"./Tool01-Czi-69SR.js";import"./AlertCircle-DLzeWW_T.js";import"./ArrowUp-CxvtSdkN.js";import"./Settings02-CzZapEug.js";import"./Tool02-DbFQnKm7.js";import"./XCircle-tVWlex9c.js";import"./ArrowUpRight-DPC10cdm.js";import"./TrendUp01-Dx0eGCHh.js";import"./ZapSquare-DWTmsWCw.js";import"./Users03-C8IQMkHF.js";import"./CheckCircle-CKFQ-ojS.js";import"./Check-Cc1URztt.js";import"./ChevronDown-CGQNWnd1.js";import"./ChevronUp-B1MCgjPT.js";import"./DotsVertical-CVUQFIq0.js";import"./Stars02-BQiI_7bO.js";import"./Copy01-B_uUNvC1.js";import"./CpuChip01-TRNsH071.js";import"./Eye-YusYyNwB.js";import"./FilterLines-CnFW7BL3.js";import"./Star01-D-FnejVv.js";import"./Palette-PEJqZgK-.js";import"./SwitchHorizontal01-BMdCcnbl.js";import"./HardDrive-Dy4jOdZa.js";import"./Key01-VrpEHfUN.js";import"./LayoutLeft-wIsOdHDO.js";import"./LinkExternal01-C08SeV4q.js";import"./LogOut01-CjdQdSFl.js";import"./Monitor01-B18puA3q.js";import"./Sun-Czb40wa5.js";import"./Play-DlOwS4QV.js";import"./Plus-BPKrERKg.js";import"./SearchLg-CvzWiMCw.js";import"./SearchMd-CzLFcViF.js";import"./Shield01--IU-F9zy.js";import"./Stars01-CO1ZsKSM.js";import"./Trash01-CJ5MTqKD.js";import"./Upload01-DEQX-M-s.js";import"./User01-aqOULbJy.js";import"./Users01-Bd1Jrc1q.js";import"./XClose-D7FEmbyQ.js";import"./X-C8pctpGF.js";import"./Zap-C7Zkgnxi.js";import"./select-BbYS1E3l.js";import"./tooltip-DpCQ4VIp.js";import"./useInfiniteQuery-Cm_QWUqt.js";import"./use-infinite-scroll-BerLzyTb.js";import"./use-connection-Vb2VF6Hp.js";import"./use-mcp-client-FfMc8-rx.js";import"./auth-DRteaRo7.js";import"./use-virtual-mcp-LvfbHggF.js";import"./card-Sy0U3-Wx.js";import"./sidebar-BAUTb--2.js";import"./use-mobile-Ce6m_tdj.js";import"./table-osBzVewG.js";import"./empty-state-B6Syio-N.js";import"./use-members-DmA1JBPe.js";import"./use-org-auth-client-qRcVIjeO.js";import"./use-clock-tick-Bc1o7i2J.js";import"./use-automations-D1WDAUDw.js";import"./studio-tools-B0hGD5Gd.js";import"./useSuspenseInfiniteQuery-Ghh8fdTf.js";import"./avatar-BoeRrsu0.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CHvgH5Lh.js";import"./calendar-C7p8Pfcr.js";import"./dialog-CLRqjexh.js";import"./tab-id-7BtS1Sf2.js";import"./hooks-B8L2k77M.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-B-yIIkq7.js";import"./chat-context-B6_ywnmh.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-fwwaVRz9.js";import"./use-decopilot-events-C7QhM8s6.js";import"./use-organization-settings-DIoSfGxH.js";import"./monaco-editor-34s3IYG-.js";import"./spinner-C3MmgrM8.js";import"./index-DdrlaVv3.js";import"./shell-layout-DfiKUJAA.js";import"./required-auth-layout-BPywrnYN.js";import"./use-org-sso-CeCv1N-8.js";import"./integration-icon-D00h7u0u.js";import"./use-navigate-to-agent-BywRVo4r.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-pzs3vvOZ.js";import"./form-5ssuGL92.js";import"./label-CfD3KdnG.js";import"./input-CWOf_06B.js";import"./switch-B3bEiCXf.js";import"./drawer-CJG4KQ31.js";import"./collection-search-Dp6F4e-r.js";import"./index-B2y9Di3y.js";import"./get-initials-D-f_fDFw.js";import"./popover-BHleKabJ.js";import"./dropdown-menu-LjQEXf6I.js";import"./github-repo-picker-CLYbDMRM.js";import"./use-debounced-value-B7GbcCk6.js";import"./authenticate-and-persist-oauth-DS1Wi7hh.js";import"./mcp-oauth-Cf4CBqV8.js";import"./use-mcp-tools-CJRQx9mh.js";import"./extract-connection-data-CGhHKZyY.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-CAXumITS.js";import"./use-tags-xUIAqM8l.js";import"./skeleton-EeUOKHea.js";import"./command-CIKiJ9mI.js";import"./index-BZ3okQg1.js";import"./companions-core-a4SdW3uj.js";import"./tabs-Dwdju4U8.js";import"./toggle-group-oSJPzYP5.js";import"./use-deco-credits-Dp9kIRuI.js";import"./alert-dialog-BoL4E1L1.js";import"./toolbar-1x2OYBi0.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-CJ1zmea6.js";import"./use-registry-connections-BW6UlzJ3.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-8dJKevB7.js";import"./connection-form-helpers-Cz30_EcT.js";import"./collection-tabs-D7xdcSRl.js";import"./badge-DHPndUF3.js";import"./select-model-pTvdtWWw.js";import"./checkbox-6YGZXahW.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-D2FgE1NH.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DtpMl-Yx.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-DBxj3ZBy.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-BCEeD3p5.js";import"./use-debounced-autosave-CBX0zn4k.js";import"./index-D0lOXkKe.js";import"./search-input-Dm_eTyGl.js";import"./use-secrets-6OQFbWZR.js";import"./useQueries-_Xy4vtop.js";import"./use-file-configs-CAMwu8_0.js";import"./automation-list-row-E0ENAv6T.js";function A(d){return typeof d=="string"&&d.trim()?d:void 0}function he(d,e){if(d){if(e)try{const t=new URL(d,e).href;return ue(t)}catch{return}return ue(d)}}function ze(d){if(!d)return{};const e=A(d.title),t=A(d.titleTemplate);return{title:e&&t?.includes("%s")?t.replace(/%s/g,e):e,description:A(d.description),image:A(d.image),favicon:A(d.favicon)}}function De(d){if(!d)return"example.com";try{return new URL(d).host}catch{return"example.com"}}const $e=[{id:"google",labelKey:"sectionsEditor.seoPreview.platformGoogle",color:"#4285F4",layout:"search"},{id:"facebook",labelKey:"sectionsEditor.seoPreview.platformFacebook",color:"#1877F2",layout:"card"},{id:"twitter",labelKey:"sectionsEditor.seoPreview.platformTwitter",color:"#0f1419",layout:"card"},{id:"linkedin",labelKey:"sectionsEditor.seoPreview.platformLinkedin",color:"#0A66C2",layout:"card"},{id:"whatsapp",labelKey:"sectionsEditor.seoPreview.platformWhatsapp",color:"#25D366",layout:"chat"},{id:"telegram",labelKey:"sectionsEditor.seoPreview.platformTelegram",color:"#229ED9",layout:"chat"},{id:"slack",labelKey:"sectionsEditor.seoPreview.platformSlack",color:"#611f69",layout:"attachment"},{id:"discord",labelKey:"sectionsEditor.seoPreview.platformDiscord",color:"#5865F2",layout:"attachment"}];function de(d){const e=T.c(10),{src:t,className:n,iconSize:v}=d,r=v===void 0?20:v;if(t){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={objectFit:"cover"},e[0]=m):m=e[0];let p;return e[1]!==n||e[2]!==t?(p=o.jsx("img",{src:t,alt:"",referrerPolicy:"no-referrer",className:n,style:m}),e[1]=n,e[2]=t,e[3]=p):p=e[3],p}let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s={display:"flex",alignItems:"center",justifyContent:"center",background:"#e5e7eb",color:"#9ca3af"},e[4]=s):s=e[4];let i;e[5]!==r?(i=o.jsx(ye,{size:r}),e[5]=r,e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==i?(a=o.jsx("div",{className:n,style:s,children:i}),e[7]=n,e[8]=i,e[9]=a):a=e[9],a}function Ie(d){const e=T.c(33),{seo:t,host:n,path:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#fff",border:"1px solid #dadce0"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={background:"#f1f3f4"},e[1]=i):i=e[1];let a;e[2]!==t.favicon?(a=o.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full",style:i,children:t.favicon?o.jsx("img",{src:t.favicon,alt:"",className:"size-full object-cover"}):o.jsx(ye,{size:12,color:"#9aa0a6"})}),e[2]=t.favicon,e[3]=a):a=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m={color:"#202124"},e[4]=m):m=e[4];let p;e[5]!==n?(p=o.jsx("div",{className:"truncate text-[13px] leading-tight",style:m,children:n}),e[5]=n,e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={color:"#4d5156"},e[7]=f):f=e[7];let l;e[8]!==n||e[9]!==v?(l=o.jsxs("div",{className:"truncate text-[12px] leading-tight",style:f,children:[n,v]}),e[8]=n,e[9]=v,e[10]=l):l=e[10];let c;e[11]!==p||e[12]!==l?(c=o.jsxs("div",{className:"min-w-0",children:[p,l]}),e[11]=p,e[12]=l,e[13]=c):c=e[13];let h;e[14]!==a||e[15]!==c?(h=o.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[14]=a,e[15]=c,e[16]=h):h=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x={color:"#1a0dab"},e[17]=x):x=e[17];let y;e[18]!==t.title||e[19]!==r?(y=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[18]=t.title,e[19]=r,e[20]=y):y=e[20];let u;e[21]!==y?(u=o.jsx("div",{className:"mt-1.5 truncate text-[18px] leading-snug",style:x,children:y}),e[21]=y,e[22]=u):u=e[22];let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S={color:"#4d5156"},e[23]=S):S=e[23];let g;e[24]!==t.description||e[25]!==r?(g=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[24]=t.description,e[25]=r,e[26]=g):g=e[26];let b;e[27]!==g?(b=o.jsx("div",{className:"mt-0.5 line-clamp-2 text-[13px] leading-snug",style:S,children:g}),e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==u||e[30]!==b||e[31]!==h?(j=o.jsxs("div",{className:"rounded-lg p-3 text-left",style:s,children:[h,u,b]}),e[29]=u,e[30]=b,e[31]=h,e[32]=j):j=e[32],j}function Le(d){const e=T.c(26),{seo:t,host:n,t:v}=d;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={background:"#fff",border:"1px solid #e2e8f0"},e[0]=r):r=e[0];let s;e[1]!==t.image?(s=o.jsx(de,{src:t.image,className:"h-40 w-full"}),e[1]=t.image,e[2]=s):s=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={borderTop:"1px solid #e2e8f0"},e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={color:"#8a9099"},e[4]=a):a=e[4];let m;e[5]!==n?(m=o.jsx("div",{className:"truncate text-[11px]",style:a,children:n}),e[5]=n,e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={color:"#1c2024"},e[7]=p):p=e[7];let f;e[8]!==t.title||e[9]!==v?(f=t.title??v("sectionsEditor.seoPreview.fallbackTitle"),e[8]=t.title,e[9]=v,e[10]=f):f=e[10];let l;e[11]!==f?(l=o.jsx("div",{className:"line-clamp-1 text-[14px] font-semibold",style:p,children:f}),e[11]=f,e[12]=l):l=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#60666c"},e[13]=c):c=e[13];let h;e[14]!==t.description||e[15]!==v?(h=t.description??v("sectionsEditor.seoPreview.fallbackDescription"),e[14]=t.description,e[15]=v,e[16]=h):h=e[16];let x;e[17]!==h?(x=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:c,children:h}),e[17]=h,e[18]=x):x=e[18];let y;e[19]!==x||e[20]!==m||e[21]!==l?(y=o.jsxs("div",{className:"px-3 py-2",style:i,children:[m,l,x]}),e[19]=x,e[20]=m,e[21]=l,e[22]=y):y=e[22];let u;return e[23]!==y||e[24]!==s?(u=o.jsxs("div",{className:"overflow-hidden rounded-lg text-left",style:r,children:[s,y]}),e[23]=y,e[24]=s,e[25]=u):u=e[25],u}function Be(d){const e=T.c(36),{seo:t,host:n,accent:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#f0f2f5"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={color:"#3b4045"},e[1]=i):i=e[1];let a;e[2]!==r?(a=r("sectionsEditor.seoPreview.chatCardHint"),e[2]=r,e[3]=a):a=e[3];let m;e[4]!==a?(m=o.jsx("p",{className:"px-1 pb-1.5 text-[12px]",style:i,children:a}),e[4]=a,e[5]=m):m=e[5];const p=`3px solid ${v}`;let f;e[6]!==p?(f={background:"#fff",borderLeft:p},e[6]=p,e[7]=f):f=e[7];let l;e[8]!==t.image?(l=o.jsx(de,{src:t.image,className:"h-28 w-full",iconSize:18}),e[8]=t.image,e[9]=l):l=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#1c2024"},e[10]=c):c=e[10];let h;e[11]!==t.title||e[12]!==r?(h=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[11]=t.title,e[12]=r,e[13]=h):h=e[13];let x;e[14]!==h?(x=o.jsx("div",{className:"line-clamp-1 text-[12px] font-semibold",style:c,children:h}),e[14]=h,e[15]=x):x=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y={color:"#60666c"},e[16]=y):y=e[16];let u;e[17]!==t.description||e[18]!==r?(u=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[17]=t.description,e[18]=r,e[19]=u):u=e[19];let S;e[20]!==u?(S=o.jsx("div",{className:"line-clamp-2 text-[11px]",style:y,children:u}),e[20]=u,e[21]=S):S=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g={color:"#8a9099"},e[22]=g):g=e[22];let b;e[23]!==n?(b=o.jsx("div",{className:"mt-0.5 text-[10px]",style:g,children:n}),e[23]=n,e[24]=b):b=e[24];let j;e[25]!==x||e[26]!==S||e[27]!==b?(j=o.jsxs("div",{className:"px-2.5 py-1.5",children:[x,S,b]}),e[25]=x,e[26]=S,e[27]=b,e[28]=j):j=e[28];let k;e[29]!==j||e[30]!==f||e[31]!==l?(k=o.jsxs("div",{className:"overflow-hidden rounded-md",style:f,children:[l,j]}),e[29]=j,e[30]=f,e[31]=l,e[32]=k):k=e[32];let N;return e[33]!==k||e[34]!==m?(N=o.jsxs("div",{className:"rounded-lg p-2 text-left",style:s,children:[m,k]}),e[33]=k,e[34]=m,e[35]=N):N=e[35],N}function Oe(d){const e=T.c(39),{seo:t,host:n,accent:v,dark:r,t:s}=d,i=r?"#2b2d31":"#fff",a=r?"#00a8fc":"#1264a3",m=r?"#dbdee1":"#3b4045",p=r?"#949ba4":"#8a9099",f=r?"none":"1px solid #e2e8f0";let l;e[0]!==i||e[1]!==f?(l={background:i,border:f},e[0]=i,e[1]=f,e[2]=l):l=e[2];const c=`3px solid ${v}`;let h;e[3]!==c?(h={borderLeft:c,borderRadius:2},e[3]=c,e[4]=h):h=e[4];let x;e[5]!==p?(x={color:p},e[5]=p,e[6]=x):x=e[6];let y;e[7]!==n||e[8]!==x?(y=o.jsx("div",{className:"text-[10px]",style:x,children:n}),e[7]=n,e[8]=x,e[9]=y):y=e[9];let u;e[10]!==a?(u={color:a},e[10]=a,e[11]=u):u=e[11];let S;e[12]!==t.title||e[13]!==s?(S=t.title??s("sectionsEditor.seoPreview.fallbackTitle"),e[12]=t.title,e[13]=s,e[14]=S):S=e[14];let g;e[15]!==u||e[16]!==S?(g=o.jsx("div",{className:"line-clamp-1 text-[13px] font-semibold",style:u,children:S}),e[15]=u,e[16]=S,e[17]=g):g=e[17];let b;e[18]!==m?(b={color:m},e[18]=m,e[19]=b):b=e[19];let j;e[20]!==t.description||e[21]!==s?(j=t.description??s("sectionsEditor.seoPreview.fallbackDescription"),e[20]=t.description,e[21]=s,e[22]=j):j=e[22];let k;e[23]!==b||e[24]!==j?(k=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:b,children:j}),e[23]=b,e[24]=j,e[25]=k):k=e[25];let N;e[26]!==k||e[27]!==y||e[28]!==g?(N=o.jsxs("div",{className:"min-w-0 flex-1",children:[y,g,k]}),e[26]=k,e[27]=y,e[28]=g,e[29]=N):N=e[29];let w;e[30]!==t.image?(w=o.jsx(de,{src:t.image,className:"size-14 shrink-0 rounded",iconSize:16}),e[30]=t.image,e[31]=w):w=e[31];let _;e[32]!==N||e[33]!==w||e[34]!==h?(_=o.jsxs("div",{className:"flex gap-2.5 pl-2.5",style:h,children:[N,w]}),e[32]=N,e[33]=w,e[34]=h,e[35]=_):_=e[35];let P;return e[36]!==_||e[37]!==l?(P=o.jsx("div",{className:"rounded-lg p-2.5 text-left",style:l,children:_}),e[36]=_,e[37]=l,e[38]=P):P=e[38],P}function Ue(d){const e=T.c(21),{platform:t,seo:n,host:v,path:r,t:s}=d;let i;e[0]!==v||e[1]!==r||e[2]!==t.color||e[3]!==t.id||e[4]!==t.layout||e[5]!==n||e[6]!==s?(i=t.layout==="search"?o.jsx(Ie,{seo:n,host:v,path:r,t:s}):t.layout==="card"?o.jsx(Le,{seo:n,host:v,path:r,t:s}):t.layout==="chat"?o.jsx(Be,{seo:n,host:v,path:r,accent:t.color,t:s}):o.jsx(Oe,{seo:n,host:v,path:r,accent:t.color,dark:t.id==="discord",t:s}),e[0]=v,e[1]=r,e[2]=t.color,e[3]=t.id,e[4]=t.layout,e[5]=n,e[6]=s,e[7]=i):i=e[7];const a=i;let m;e[8]!==t.color?(m=o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:t.color}}),e[8]=t.color,e[9]=m):m=e[9];let p;e[10]!==t.labelKey||e[11]!==s?(p=s(t.labelKey),e[10]=t.labelKey,e[11]=s,e[12]=p):p=e[12];let f;e[13]!==p?(f=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[13]=p,e[14]=f):f=e[14];let l;e[15]!==m||e[16]!==f?(l=o.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[m,f]}),e[15]=m,e[16]=f,e[17]=l):l=e[17];let c;return e[18]!==a||e[19]!==l?(c=o.jsxs("div",{children:[l,a]}),e[18]=a,e[19]=l,e[20]=c):c=e[20],c}function Ae(d){const e=T.c(18),{seo:t,url:n,path:v}=d,r=v===void 0?"/":v,s=ve();let i,a,m;if(e[0]!==t||e[1]!==n){const u=ze(t);i=u,a=he(u.image,n),m=he(u.favicon,n),e[0]=t,e[1]=n,e[2]=i,e[3]=a,e[4]=m}else i=e[2],a=e[3],m=e[4];let p;e[5]!==i||e[6]!==a||e[7]!==m?(p={...i,image:a,favicon:m},e[5]=i,e[6]=a,e[7]=m,e[8]=p):p=e[8];const f=p;let l;e[9]!==n?(l=De(n),e[9]=n,e[10]=l):l=e[10];const c=l,h=r==="/"?"":r;let x;e[11]!==h||e[12]!==c||e[13]!==s||e[14]!==f?(x=$e.map(u=>o.jsx(Ue,{platform:u,seo:f,host:c,path:h,t:s},u.id)),e[11]=h,e[12]=c,e[13]=s,e[14]=f,e[15]=x):x=e[15];let y;return e[16]!==x?(y=o.jsx("div",{className:"grid grid-cols-1 gap-4 @2xl:grid-cols-2",children:x}),e[16]=x,e[17]=y):y=e[17],y}function zi(d){const e=T.c(70),{orgSlug:t,virtualMcpId:n,branch:v,decofile:r,meta:s,target:i,previewBaseUrl:a,onSaved:m,onEditDefaultSeo:p,onBack:f}=d,l=ve(),c=Ne(r,i,s),h=c?.seoData,x=i.kind==="site"?"site":i.pageKey,[y,u]=ee.useState(x),[S,g]=ee.useState(null),[b,j]=ee.useState(0),[k,N]=ee.useState(void 0);y!==x&&(u(x),g(null),N(void 0),j(Ge));const{persistSeo:w,persistRawSeo:_,flush:P,isPending:te}=we({orgSlug:t,virtualMcpId:n,branch:v,target:i,resolved:c,onSaved:m}),M=i.kind==="page",ge=M?c?.rawSeoData:void 0,U=k!==void 0?k:ge,be=M?_e(U)??void 0:void 0,E=S??be??h??{},F=c?Ee(E,c):null,K=F&&(!M||Pe(U))?Ke(F,s):null;let G;e[0]!==s?(G=Te(s),e[0]=s,e[1]=G):G=e[1];const oe=G;let R,H;e[2]!==r||e[3]!==E||e[4]!==s||e[5]!==i.kind?(R=i.kind==="page"?Fe(r,s)?.seoData??{}:{},H=i.kind==="page"?Ve(R,E):E,e[2]=r,e[3]=E,e[4]=s,e[5]=i.kind,e[6]=R,e[7]=H):(R=e[6],H=e[7]);const ie=H;let V;e[8]!==w||e[9]!==c||e[10]!==g?(V=C=>{if(!c)return;const pe=C;g(pe),w(pe)},e[8]=w,e[9]=c,e[10]=g,e[11]=V):V=e[11];const se=V;let W;e[12]!==g?(W=()=>g(null),e[12]=g,e[13]=W):W=e[13];const le=W;let q;e[14]!==j?(q=()=>j(Me),e[14]=j,e[15]=q):q=e[15];const re=q;let J;e[16]!==P||e[17]!==f?(J=()=>{P(),f?.()},e[16]=P,e[17]=f,e[18]=J):J=e[18];const ce=J,z=i.kind==="page"?i.path:"/";let Q;e[19]!==z||e[20]!==a||e[21]!==i.kind?(Q=i.kind==="page"&&a?He(z,a):a??null,e[19]=z,e[20]=a,e[21]=i.kind,e[22]=Q):Q=e[22];const ne=Q;let X;e[23]!==c||e[24]!==l||e[25]!==i.kind?(X=i.kind==="site"?l("sectionsEditor.seoEditor.noSiteSeoBlock"):l(c?"sectionsEditor.seoEditor.noSeoSchema":"sectionsEditor.seoEditor.couldNotLoadSeo"),e[23]=c,e[24]=l,e[25]=i.kind,e[26]=X):X=e[26];const ae=X,Y=M&&c,me=i.kind==="site"&&c&&K;let D;e[27]!==ce||e[28]!==l||e[29]!==i.kind||e[30]!==i.pageName?(D=i.kind==="page"?o.jsxs("nav",{className:"flex min-w-0 items-center gap-1 text-sm",children:[o.jsx("button",{type:"button",onClick:ce,title:i.pageName,className:"min-w-0 truncate rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:i.pageName}),o.jsx(ke,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("span",{className:"px-1 py-0.5 font-medium text-foreground",children:"SEO"})]}):o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(fe,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:l("sectionsEditor.seoEditor.defaultSeoLabel")}),o.jsxs("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:["· ",l("sectionsEditor.seoEditor.appliedToEveryPage")]})]}),e[27]=ce,e[28]=l,e[29]=i.kind,e[30]=i.pageName,e[31]=D):D=e[31];let $;e[32]!==te?($=te&&o.jsx(Se,{size:14,className:"animate-spin text-muted-foreground"}),e[32]=te,e[33]=$):$=e[33];let I;e[34]!==p||e[35]!==l||e[36]!==i.kind?(I=i.kind==="page"&&p&&o.jsxs(je,{type:"button",variant:"outline",size:"sm",onClick:p,children:[o.jsx(fe,{size:14}),l("sectionsEditor.seoEditor.editDefaultSeoButton")]}),e[34]=p,e[35]=l,e[36]=i.kind,e[37]=I):I=e[37];let L;e[38]!==$||e[39]!==I?(L=o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[$,I]}),e[38]=$,e[39]=I,e[40]=L):L=e[40];let B;e[41]!==L||e[42]!==D?(B=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[D,L]}),e[41]=L,e[42]=D,e[43]=B):B=e[43];let O;e[44]!==F||e[45]!==re||e[46]!==le||e[47]!==oe||e[48]!==U||e[49]!==E||e[50]!==ae||e[51]!==b||e[52]!==se||e[53]!==z||e[54]!==_||e[55]!==w||e[56]!==ie||e[57]!==ne||e[58]!==c||e[59]!==K||e[60]!==g||e[61]!==N||e[62]!==Y||e[63]!==me||e[64]!==R||e[65]!==l?(O=!c||!Y&&!me?o.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground",children:ae}):o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx(xe,{className:"w-full max-w-md shrink-0 border-r [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-5 py-4",children:Y?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:l("sectionsEditor.seoEditor.emptyFieldsHint")}),o.jsx(Re,{rawSeo:U,innerSeo:E,defaultResolveType:oe,seoSchema:K,activeResolveType:F,seoTypeOptions:c.seoTypeOptions,formResetKey:b,siteDefaultSeo:R,onPersistRaw:C=>{N(C),_(C)},onInnerChange:C=>{g(C),w(C)},onClearForm:le,onBumpFormKey:re})]}):K&&F&&o.jsx(Ce,{schema:K,resolveType:F,value:E,formResetKey:b,onChange:se})})}),o.jsx(xe,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"@container px-5 py-4",children:o.jsx(Ae,{seo:ie,url:ne,path:z})})})]}),e[44]=F,e[45]=re,e[46]=le,e[47]=oe,e[48]=U,e[49]=E,e[50]=ae,e[51]=b,e[52]=se,e[53]=z,e[54]=_,e[55]=w,e[56]=ie,e[57]=ne,e[58]=c,e[59]=K,e[60]=g,e[61]=N,e[62]=Y,e[63]=me,e[64]=R,e[65]=l,e[66]=O):O=e[66];let Z;return e[67]!==B||e[68]!==O?(Z=o.jsxs("div",{className:"flex h-full w-full flex-col",children:[B,O]}),e[67]=B,e[68]=O,e[69]=Z):Z=e[69],Z}function Me(d){return d+1}function Ge(d){return d+1}function He(d,e){try{return new URL(d,e).href}catch{return e}}function Ve(d,e){const t=e.__resolveType,n=d.__resolveType;if(typeof t=="string"&&typeof n=="string"&&t!==n)return{...e};const v={...d};for(const[r,s]of Object.entries(e))r!=="__resolveType"&&s!=null&&(typeof s=="string"&&s.trim()===""||(v[r]=s));return v}export{zi as SeoEditor};