decocms 4.339.1 → 4.340.1

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 (255) hide show
  1. package/dist/client/assets/{AlertCircle-COFB2d-k.js → AlertCircle-BzfLgQxW.js} +1 -1
  2. package/dist/client/assets/{AreaChart-xaiGT9tS.js → AreaChart-NXV3zXu6.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-B_Sm8nZF.js → ArrowLeft-ZtHY0hHS.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DtnUC7b1.js → ArrowUp-GtlqrtUG.js} +1 -1
  5. package/dist/client/assets/{Check-RwOXYzpY.js → Check-D1RndvMl.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BakDkudF.js → CheckCircle-kXqYZ4lp.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BId4MMJ9.js → ChevronRight-BXbNr5x_.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-BPZJCzil.js → ChevronSelectorVertical-BvOjX3vH.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CKGVkzNf.js → ChevronUp-B-O6lb_g.js} +1 -1
  10. package/dist/client/assets/{Copy01-D8F1H1Rm.js → Copy01-Cz4gIH9t.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-hwp2k2z5.js → CreditCard01-CV7AlRJM.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CiZ90LaC.js → DotsVertical-BzMxyiyI.js} +1 -1
  13. package/dist/client/assets/{Download01-BFWoFyp5.js → Download01-D4vSzFHt.js} +1 -1
  14. package/dist/client/assets/{ErrorBarContext-DgbmJPin.js → ErrorBarContext-0x81WJuU.js} +1 -1
  15. package/dist/client/assets/{Eye-BkYoLh_d.js → Eye-CQf7Good.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-wBN2Zyoy.js → GitBranch01-DO9pv3PP.js} +1 -1
  17. package/dist/client/assets/{Globe01-D_ldoikY.js → Globe01-B1SjH2oA.js} +1 -1
  18. package/dist/client/assets/{HardDrive-ChbOVw3L.js → HardDrive-1tMtWfEi.js} +1 -1
  19. package/dist/client/assets/{Image01-CVmN_WRr.js → Image01-DcplqJxC.js} +1 -1
  20. package/dist/client/assets/{Key01-n-kxmORy.js → Key01-Bka_ZL3e.js} +1 -1
  21. package/dist/client/assets/{Link01-ngcEVr-U.js → Link01-D-5fFI_p.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-CYGJDolS.js → LinkExternal01-BJBRYdix.js} +1 -1
  23. package/dist/client/assets/{Monitor01-B3YP0Q4Y.js → Monitor01-BVJVkRyL.js} +1 -1
  24. package/dist/client/assets/{Package-D3FCZEz9.js → Package-StGHMY-P.js} +1 -1
  25. package/dist/client/assets/{Palette-B8VxVOuh.js → Palette-BKW_8aCv.js} +1 -1
  26. package/dist/client/assets/{Play-BJDJ0Cd_.js → Play-Cuda6UNO.js} +1 -1
  27. package/dist/client/assets/{Plus-f1J7CslD.js → Plus-cEc0jpzJ.js} +1 -1
  28. package/dist/client/assets/{SearchLg-ijCBByfF.js → SearchLg-DXo2LFfn.js} +1 -1
  29. package/dist/client/assets/{SearchMd-BxQNX78D.js → SearchMd-IS_lUYp2.js} +1 -1
  30. package/dist/client/assets/{Sector-DjNoLuA2.js → Sector-CzUzYulK.js} +1 -1
  31. package/dist/client/assets/{Settings02-DI7LVcro.js → Settings02-CCqfjQqM.js} +1 -1
  32. package/dist/client/assets/{Share07-BlQxtP9X.js → Share07-UUisBlZD.js} +1 -1
  33. package/dist/client/assets/{Shield01-arn3OL5A.js → Shield01-Bu8fodHD.js} +1 -1
  34. package/dist/client/assets/{Stars01-C7zRxa-s.js → Stars01-Dd7BmkuI.js} +1 -1
  35. package/dist/client/assets/{Sun-CudPxUwF.js → Sun-BjhJpIdB.js} +1 -1
  36. package/dist/client/assets/{Tool01-CsI9zgpV.js → Tool01-C-tPOEIT.js} +1 -1
  37. package/dist/client/assets/{Tool02-BFWUmpcW.js → Tool02-BE6l5Twz.js} +1 -1
  38. package/dist/client/assets/{Trash01-JArTmXvL.js → Trash01-mvzeyawb.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-BXyuZrfj.js → TrendUp01-C83A2OZW.js} +1 -1
  40. package/dist/client/assets/{Upload01-TH_UzEO5.js → Upload01-CEpgeOQo.js} +1 -1
  41. package/dist/client/assets/{User01-BQutGTr9.js → User01-DfurwKCt.js} +1 -1
  42. package/dist/client/assets/{UserSquare-EeCR50Jd.js → UserSquare-BF6cbCMy.js} +1 -1
  43. package/dist/client/assets/{Users01-BlGMCWje.js → Users01-CvV0EOpL.js} +1 -1
  44. package/dist/client/assets/{Users03-DBIwkies.js → Users03-C_KwnO8j.js} +1 -1
  45. package/dist/client/assets/{XCircle-B-U8MZ3l.js → XCircle-C5OuQHlS.js} +1 -1
  46. package/dist/client/assets/{XClose-Dz9b9dRZ.js → XClose-B3VYnfFA.js} +1 -1
  47. package/dist/client/assets/{Zap-Dpl5zC2B.js → Zap-XKzdZrkx.js} +1 -1
  48. package/dist/client/assets/{ZoomOut-d1whDSJ4.js → ZoomOut-BgLMQCGy.js} +1 -1
  49. package/dist/client/assets/{access-gate-CgpWlbs5.js → access-gate-71_9IB2B.js} +1 -1
  50. package/dist/client/assets/{agent-icon-COOgI3ay.js → agent-icon-BqwQnN-H.js} +1 -1
  51. package/dist/client/assets/{agents-list-B3Y5y06D.js → agents-list-DDVHqmKW.js} +1 -1
  52. package/dist/client/assets/{ai-providers-C9ObWIua.js → ai-providers-BhjTLCpT.js} +1 -1
  53. package/dist/client/assets/{alert--Dt-uESS.js → alert-CV80KCdi.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-CADzi4i2.js → alert-dialog-Diiy_s1s.js} +1 -1
  55. package/dist/client/assets/{analytics-tab-BzVQHWsw.js → analytics-tab-ka3rVQGP.js} +1 -1
  56. package/dist/client/assets/api-keys-ALdi9hXk.js +1 -0
  57. package/dist/client/assets/{api-keys-DR6-cuN4.js → api-keys-DWiHCkdk.js} +1 -1
  58. package/dist/client/assets/app-editor-CxXdpHfH.js +1 -0
  59. package/dist/client/assets/{auth-CDNWJs_H.js → auth-CQrAJgcB.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-DL3O1q4B.js → auth-catchall-B9vVUGmK.js} +1 -1
  61. package/dist/client/assets/{auth-entry-C1LZapjz.js → auth-entry-B65aE7ca.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-Gop3ynxc.js → auth-split-layout-VVCPfvYJ.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-Bc7-Czof.js → authenticate-and-persist-oauth-f6JOL-_R.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-DTvuVLg8.js → automation-list-row-oVa0VxYK.js} +1 -1
  65. package/dist/client/assets/{automation-runs-jJdD2kMw.js → automation-runs-CLGrPldK.js} +1 -1
  66. package/dist/client/assets/{automations-DtgECkvr.js → automations-Xn-kNOgb.js} +1 -1
  67. package/dist/client/assets/{autosend-DnWitnAW.js → autosend-DqG3RWl9.js} +1 -1
  68. package/dist/client/assets/{avatar-DelCpRBk.js → avatar-D42nRXCs.js} +1 -1
  69. package/dist/client/assets/{badge-CzoDeQX5.js → badge-D_ofFGRW.js} +1 -1
  70. package/dist/client/assets/{block-document-CYynEyMa.js → block-document-Cyw3PVye.js} +1 -1
  71. package/dist/client/assets/{breadcrumb-Ci8qwvwh.js → breadcrumb-Q6Ic1TbG.js} +1 -1
  72. package/dist/client/assets/{buckets-7DRsNGEd.js → buckets-BbnCcISt.js} +1 -1
  73. package/dist/client/assets/{bulk-category-panel-CBcpSaVj.js → bulk-category-panel-C4UoAyci.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-GWNWVbL6.js → capability-load-error-CKiRrnmu.js} +1 -1
  75. package/dist/client/assets/{cards-Cj23GDZ7.js → cards-DxWUWsUt.js} +1 -1
  76. package/dist/client/assets/{category-editor-242jZ9R1.js → category-editor-BbuX9iC0.js} +1 -1
  77. package/dist/client/assets/{cdn-tab-CxrKZ9BM.js → cdn-tab-mJBUwSPN.js} +1 -1
  78. package/dist/client/assets/{chart-xWqOKrT9.js → chart-BcRbuRFX.js} +1 -1
  79. package/dist/client/assets/{chat-context-YazMDsfb.js → chat-context-DyxdiM-D.js} +5 -5
  80. package/dist/client/assets/{checkbox-5kuFpJGJ.js → checkbox-Br8eTE9Q.js} +1 -1
  81. package/dist/client/assets/{choose-editor-CoN8FJC-.js → choose-editor-C0gDcFoj.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-BR4HnqSw.js → cli-auth-success-LuPD3OyG.js} +1 -1
  83. package/dist/client/assets/{client-icons-BJAudV-4.js → client-icons-BTlLq4AS.js} +1 -1
  84. package/dist/client/assets/{collection-detail-TohUC5eL.js → collection-detail-DbO3l89Z.js} +1 -1
  85. package/dist/client/assets/{collection-display-button-C3Z23sMQ.js → collection-display-button-B_lNaZN2.js} +1 -1
  86. package/dist/client/assets/{collection-search-x0S64zby.js → collection-search-mHMIaP-Q.js} +1 -1
  87. package/dist/client/assets/{collection-table-wrapper-Be1BrSKV.js → collection-table-wrapper-JEUUV8vN.js} +1 -1
  88. package/dist/client/assets/{collection-tabs-BI0Rhp1n.js → collection-tabs-Cn7IgPGQ.js} +1 -1
  89. package/dist/client/assets/{command-DvAIiR-Z.js → command-HZlL54qe.js} +1 -1
  90. package/dist/client/assets/{commerce-onboarding-rsu4xpmu.js → commerce-onboarding-Cdg1Lxob.js} +1 -1
  91. package/dist/client/assets/{connect-CPAQI-Wa.js → connect-ErQsSVID.js} +1 -1
  92. package/dist/client/assets/{connect-layout-DnTik73n.js → connect-layout-UN7qnCBS.js} +1 -1
  93. package/dist/client/assets/{connection-DVZ0x-CQ.js → connection-Sl8tunew.js} +1 -1
  94. package/dist/client/assets/{connection-card-CSJ2w0Dp.js → connection-card-fSTKvJcu.js} +1 -1
  95. package/dist/client/assets/{connection-detail-BQl9INRf.js → connection-detail-NjpMO4r7.js} +1 -1
  96. package/dist/client/assets/{connection-form-helpers-BGULertj.js → connection-form-helpers-B0ki2Dj1.js} +1 -1
  97. package/dist/client/assets/{connections-CJ3AQ7bL.js → connections-C_oAO3se.js} +1 -1
  98. package/dist/client/assets/{create-organization-dialog-BrRJMZ9P.js → create-organization-dialog-C9joAAsU.js} +1 -1
  99. package/dist/client/assets/{decopilot-sse-pool-T7r443E8.js → decopilot-sse-pool-Z9qQzEfU.js} +1 -1
  100. package/dist/client/assets/{dialog-ClXo-ILY.js → dialog-CNh5j8Ij.js} +1 -1
  101. package/dist/client/assets/{domain-settings-D4vHkL29.js → domain-settings-CMnPU1dt.js} +1 -1
  102. package/dist/client/assets/{drawer-4yZNiDGz.js → drawer-DkaTBCFj.js} +1 -1
  103. package/dist/client/assets/{dropdown-menu-ChRlmtGH.js → dropdown-menu-Dwv2NZje.js} +1 -1
  104. package/dist/client/assets/{e2e-tab-DE_h1PjG.js → e2e-tab-Bd-AJops.js} +1 -1
  105. package/dist/client/assets/{editor-C8IlfhPf.js → editor-BawOduQH.js} +1 -1
  106. package/dist/client/assets/{empty-state-CmJs9n9u.js → empty-state-5gWmdRtE.js} +1 -1
  107. package/dist/client/assets/{empty-state-CMDRQGT-.js → empty-state-BKEY6gPA.js} +1 -1
  108. package/dist/client/assets/{extract-connection-data-CBaHjHii.js → extract-connection-data-ZZXv8aem.js} +1 -1
  109. package/dist/client/assets/{file-explorer-bszPPJMi.js → file-explorer-Jbt-gHZ7.js} +1 -1
  110. package/dist/client/assets/{file-type-icon-CCS82EWp.js → file-type-icon-BsvWo3X0.js} +1 -1
  111. package/dist/client/assets/{folder-icon-BprwUfXF.js → folder-icon-BG6ZKjpD.js} +1 -1
  112. package/dist/client/assets/{form-BbPYrZM0.js → form-B6Rxlr4w.js} +1 -1
  113. package/dist/client/assets/{general-Jx6iT4LG.js → general-BZb-4XgT.js} +1 -1
  114. package/dist/client/assets/{github-icon-BamvWtlu.js → github-icon-D1ImZTL0.js} +1 -1
  115. package/dist/client/assets/{github-repo-picker-_9hUfw1v.js → github-repo-picker-9y0JtRji.js} +1 -1
  116. package/dist/client/assets/{gitlab-icon-BvCV8hCq.js → gitlab-icon-CNLKhv3h.js} +1 -1
  117. package/dist/client/assets/{hooks-Dp9_KjXz.js → hooks-CVCDBZ_q.js} +1 -1
  118. package/dist/client/assets/{hosting-tab-CvfAAsG1.js → hosting-tab-CDj19muk.js} +1 -1
  119. package/dist/client/assets/{index-DE8RFRam.js → index-BbR1yInm.js} +1 -1
  120. package/dist/client/assets/{index-CeY5DP2H.js → index-CLxPOse6.js} +1 -1
  121. package/dist/client/assets/{index-xqZUEhiq.js → index-CQR5qovd.js} +1 -1
  122. package/dist/client/assets/{index-DIek05Ni.js → index-CSRM1f8q.js} +4 -4
  123. package/dist/client/assets/{index-Bo46yES1.js → index-CqtkQPoY.js} +1 -1
  124. package/dist/client/assets/{index-B59o9_T8.js → index-DAaD02_4.js} +1 -1
  125. package/dist/client/assets/{index-Cg7xMas6.js → index-DeZZ_dDI.js} +1 -1
  126. package/dist/client/assets/{index-DMbrlz1m.js → index-DuMy9MwF.js} +1 -1
  127. package/dist/client/assets/{index-DMoSkttT.js → index-PQGtBCCF.js} +1 -1
  128. package/dist/client/assets/{index-owJhPnZu.js → index-PYBlFE43.js} +6 -6
  129. package/dist/client/assets/{index-redirect-BSQNK0c5.js → index-redirect-C97l6niv.js} +1 -1
  130. package/dist/client/assets/{infra-billing-D81JNr_4.js → infra-billing-DDkNrUqa.js} +1 -1
  131. package/dist/client/assets/{input-B6-nFuh0.js → input-BS0hECon.js} +1 -1
  132. package/dist/client/assets/{integration-icon-BdFo1XXn.js → integration-icon-C1WwgYjH.js} +1 -1
  133. package/dist/client/assets/{invite-member-dialog-D9VCDEZZ.js → invite-member-dialog-g-3glVQe.js} +1 -1
  134. package/dist/client/assets/{label-Bzd8c-RA.js → label-Cc7Rkk65.js} +1 -1
  135. package/dist/client/assets/{layout-BZVLMtZ0.js → layout-CjAR7zjm.js} +1 -1
  136. package/dist/client/assets/{login-DbWxzcWy.js → login-D7zbWP3h.js} +1 -1
  137. package/dist/client/assets/{markdown-CtbNHSiX.js → markdown-DiQc9Tr_.js} +1 -1
  138. package/dist/client/assets/{mcp-app-renderer-BtErdXgT.js → mcp-app-renderer-oLhTvIMa.js} +1 -1
  139. package/dist/client/assets/{mcp-oauth-D3PGb0x2.js → mcp-oauth-BJExp-m2.js} +1 -1
  140. package/dist/client/assets/{members-X7tkSv1G.js → members-DX1SvDgD.js} +1 -1
  141. package/dist/client/assets/{monaco-editor-DMcAThqN.js → monaco-editor-No4JVyH1.js} +1 -1
  142. package/dist/client/assets/{monitoring-stats-row-DKvLbjkP.js → monitoring-stats-row-DDuwuem1.js} +1 -1
  143. package/dist/client/assets/{multi-select-DGNYTNEk.js → multi-select-l2Ha7sZX.js} +1 -1
  144. package/dist/client/assets/{oauth-callback-Ca0yqV1C.js → oauth-callback-Chx6oBaI.js} +1 -1
  145. package/dist/client/assets/{oauth-callback-ai-provider-DOQ0G2c1.js → oauth-callback-ai-provider-Br9HSpkj.js} +1 -1
  146. package/dist/client/assets/{onboarding-CiXSJ2qw.js → onboarding-Cqok_-S0.js} +1 -1
  147. package/dist/client/assets/{org-layout-CPBdd6Bg.js → org-layout-CX1ali2o.js} +1 -1
  148. package/dist/client/assets/{organization-choice-DW679eUB.js → organization-choice-BvjYcUgL.js} +1 -1
  149. package/dist/client/assets/{orgs-CbnIGbcT.js → orgs-LMX-WnJ3.js} +1 -1
  150. package/dist/client/assets/{page-seo-form-CNpNwABh.js → page-seo-form-ByfB018R.js} +1 -1
  151. package/dist/client/assets/{popover-DNtfUsCB.js → popover-DCbBhRIu.js} +1 -1
  152. package/dist/client/assets/{post-calendar-B07y2JsG.js → post-calendar-BmnVmB1c.js} +1 -1
  153. package/dist/client/assets/{post-editor-B2SPGEHG.js → post-editor-2IIEXlMc.js} +1 -1
  154. package/dist/client/assets/{primitives-CDC6DfBN.js → primitives-D3Byu5gP.js} +1 -1
  155. package/dist/client/assets/{profile-D0A66T6t.js → profile-C8QqbhfC.js} +1 -1
  156. package/dist/client/assets/{project-app-view-D3HZP3xn.js → project-app-view-bc7KoHNm.js} +1 -1
  157. package/dist/client/assets/{project-icon-BKwNPyDH.js → project-icon-OuMDwoA3.js} +1 -1
  158. package/dist/client/assets/{prompts-f-nECtr8.js → prompts-Bzm8zwb7.js} +1 -1
  159. package/dist/client/assets/record-editor-CFIOX_Yr.js +1 -0
  160. package/dist/client/assets/redirect-editor-ZRxBDumi.js +1 -0
  161. package/dist/client/assets/registry-epsDJaNV.js +2 -0
  162. package/dist/client/assets/{registry-layout-_YKt4pUw.js → registry-layout--QJbMHJw.js} +1 -1
  163. package/dist/client/assets/{reports-CJdrG2bq.js → reports-Cp5SOQdj.js} +1 -1
  164. package/dist/client/assets/{repositories-DSl4FF_U.js → repositories-D7jt6s7N.js} +1 -1
  165. package/dist/client/assets/{require-capability-CsSJsgrd.js → require-capability-DCcOMqgN.js} +1 -1
  166. package/dist/client/assets/{required-auth-layout-XPR00FzH.js → required-auth-layout-Cn1LfVyd.js} +1 -1
  167. package/dist/client/assets/{reset-password-C7jgcNbQ.js → reset-password-BnOeZ70l.js} +1 -1
  168. package/dist/client/assets/{review-settings-Md-jLxYt.js → review-settings-DEOzdgEG.js} +1 -1
  169. package/dist/client/assets/{roles-CXp8d28s.js → roles-BthEMu9X.js} +1 -1
  170. package/dist/client/assets/{schema-DWDQ6ryI.js → schema-CbckVqfN.js} +1 -1
  171. package/dist/client/assets/{scroll-area-DGWiXZ1w.js → scroll-area-Bvq02Hbr.js} +1 -1
  172. package/dist/client/assets/{search-input-C6-gsMRW.js → search-input-BXExtOld.js} +1 -1
  173. package/dist/client/assets/{secrets-DhZRaOsn.js → secrets-Cg_hxWXW.js} +1 -1
  174. package/dist/client/assets/{sections-editor-Bj3bltq-.js → sections-editor--931iFv5.js} +1 -1
  175. package/dist/client/assets/{select-model-CNLldzs6.js → select-model-BA84Djxj.js} +1 -1
  176. package/dist/client/assets/{select-DQ8iiyqK.js → select-zQOHiEA6.js} +1 -1
  177. package/dist/client/assets/{self-tool-result-BklMHu3Z.js → self-tool-result-CL8jNSxU.js} +1 -1
  178. package/dist/client/assets/{seo-editor-DZXDnR6Q.js → seo-editor-Cjng28hf.js} +1 -1
  179. package/dist/client/assets/settings-layout-CiAYVX75.js +1 -0
  180. package/dist/client/assets/{settings-sidebar-C4thiWjt.js → settings-sidebar-DvQnn6jo.js} +1 -1
  181. package/dist/client/assets/{shell-controls-D1BhH3wU.js → shell-controls-B93Aqrsy.js} +1 -1
  182. package/dist/client/assets/{shell-layout-DPGy1SNU.js → shell-layout-u7vIjAJ2.js} +1 -1
  183. package/dist/client/assets/{skill-preview-uCDTII4c.js → skill-preview-DUckxm1M.js} +1 -1
  184. package/dist/client/assets/{skills-NhAovMUS.js → skills-BQ2p7mU8.js} +1 -1
  185. package/dist/client/assets/{sso-DvAkMGsr.js → sso-BlTkwMs_.js} +1 -1
  186. package/dist/client/assets/{store-BXnHEyof.js → store-DpW30yeH.js} +1 -1
  187. package/dist/client/assets/store-registry-DZ23YwZo.js +2 -0
  188. package/dist/client/assets/{switch-PGr_evzH.js → switch-Crn1m8Ty.js} +1 -1
  189. package/dist/client/assets/{synced-repos-CnYBF3Cu.js → synced-repos-DEQNXeOM.js} +1 -1
  190. package/dist/client/assets/{table-CSG_zh9i.js → table-CPfPQObG.js} +1 -1
  191. package/dist/client/assets/{tabs-2whhUI-U.js → tabs-PHr5-Sm6.js} +1 -1
  192. package/dist/client/assets/{task-board-Cc_Je1Tl.js → task-board-HxgCbes1.js} +1 -1
  193. package/dist/client/assets/{task-route-DwIJjDqc.js → task-route-Cj5NLhi7.js} +1 -1
  194. package/dist/client/assets/{tasks-cqDWMluZ.js → tasks-ptgYP-TN.js} +1 -1
  195. package/dist/client/assets/{textarea-Bd7RaMNl.js → textarea-SZQQtpOJ.js} +1 -1
  196. package/dist/client/assets/{thread-intent-8XofJk4L.js → thread-intent-CZrpPLgb.js} +1 -1
  197. package/dist/client/assets/{thread-route-d5I3uQSg.js → thread-route-CP1A3IMw.js} +1 -1
  198. package/dist/client/assets/{toggle-group-HtX54j1S.js → toggle-group-DSF6RKWs.js} +1 -1
  199. package/dist/client/assets/{toolbar-icon-button-TVZ9wV20.js → toolbar-icon-button-DYkGGfZd.js} +1 -1
  200. package/dist/client/assets/{toolbar-aNyqdI6F.js → toolbar-u1uvCeRu.js} +1 -1
  201. package/dist/client/assets/{track-CJ7UTAbv.js → track-Dk6T6yFd.js} +1 -1
  202. package/dist/client/assets/{types-WjdgXYHr.js → types-zV_J5pVR.js} +1 -1
  203. package/dist/client/assets/{use-ai-providers-4XpSsDac.js → use-ai-providers-BQvDcCtZ.js} +1 -1
  204. package/dist/client/assets/{use-automations-DDYhlGUd.js → use-automations-jxcz423f.js} +1 -1
  205. package/dist/client/assets/{use-autosave-BjCysC8V.js → use-autosave-DGIFo8wk.js} +1 -1
  206. package/dist/client/assets/{use-connection-CwE_S8Fn.js → use-connection-Dd6kUAU0.js} +1 -1
  207. package/dist/client/assets/{use-copy-ijs7Eg_a.js → use-copy-B3ZxAdyf.js} +1 -1
  208. package/dist/client/assets/{use-create-virtual-mcp-oTZRb5vp.js → use-create-virtual-mcp-bVNFPJww.js} +1 -1
  209. package/dist/client/assets/{use-debounced-autosave-D655Ka7O.js → use-debounced-autosave-DZmV54Pv.js} +1 -1
  210. package/dist/client/assets/{use-debounced-value-BbelcnFE.js → use-debounced-value-BULHGxEc.js} +1 -1
  211. package/dist/client/assets/{use-decopilot-events-DmOH7Ko7.js → use-decopilot-events-Y3bBtckC.js} +1 -1
  212. package/dist/client/assets/{use-delete-connection-CLOPkvMX.js → use-delete-connection-C_piTU4W.js} +1 -1
  213. package/dist/client/assets/{use-deployment-admin-Cwa1-AYh.js → use-deployment-admin-DVMeISn6.js} +1 -1
  214. package/dist/client/assets/{use-destination-route-5cTdDwgV.js → use-destination-route-BbXFM1pX.js} +1 -1
  215. package/dist/client/assets/{use-file-configs-C_x_aysA.js → use-file-configs-CdZKiWeS.js} +1 -1
  216. package/dist/client/assets/{use-infinite-scroll-DqFZUY4N.js → use-infinite-scroll-C5Ep99oQ.js} +1 -1
  217. package/dist/client/assets/{use-join-requests-BQwmRhwt.js → use-join-requests-CQ3Z4Qrw.js} +1 -1
  218. package/dist/client/assets/{use-mcp-auth-status-DS6JPyoV.js → use-mcp-auth-status-Zi2E6ZyD.js} +1 -1
  219. package/dist/client/assets/{use-mcp-client-TErTfSlr.js → use-mcp-client-GjCeFgDH.js} +1 -1
  220. package/dist/client/assets/{use-mcp-prompts-Cdr9RVeH.js → use-mcp-prompts-CGlW_da5.js} +1 -1
  221. package/dist/client/assets/{use-mcp-tools-CUsFOk8y.js → use-mcp-tools-CXwKYIie.js} +1 -1
  222. package/dist/client/assets/{use-members-DHc3PfZ3.js → use-members-CD_T8b9k.js} +1 -1
  223. package/dist/client/assets/{use-navigate-to-agent-DVwAusa4.js → use-navigate-to-agent-BC0hw-vb.js} +1 -1
  224. package/dist/client/assets/{use-org-auth-client-iR6n2Ufe.js → use-org-auth-client-DMcrJO43.js} +1 -1
  225. package/dist/client/assets/{use-org-notice-DXsc-iYj.js → use-org-notice-B4YUBZRP.js} +1 -1
  226. package/dist/client/assets/{use-org-sso-B84iMdmV.js → use-org-sso-u9wHl90t.js} +1 -1
  227. package/dist/client/assets/{use-organization-roles-DD8iZIN6.js → use-organization-roles-D_fJiyY7.js} +1 -1
  228. package/dist/client/assets/{use-organization-settings-Bbmygdp8.js → use-organization-settings-BH1NOa50.js} +1 -1
  229. package/dist/client/assets/{use-panel-navigate-By4OUY2Q.js → use-panel-navigate-2xdG0afb.js} +1 -1
  230. package/dist/client/assets/{use-registry-connections-DECk2LFw.js → use-registry-connections-yodN_YsJ.js} +1 -1
  231. package/dist/client/assets/{use-secrets-JuG9mGc4.js → use-secrets-Cn2wvy2G.js} +1 -1
  232. package/dist/client/assets/{use-section-preview-base-PbBwq_3M.js → use-section-preview-base-C5A6LIdf.js} +1 -1
  233. package/dist/client/assets/{use-status-sounds-D9R6Dfxe.js → use-status-sounds-CONvuMNp.js} +1 -1
  234. package/dist/client/assets/{use-tags-jHUVem-1.js → use-tags-DUbHFFkW.js} +1 -1
  235. package/dist/client/assets/{use-view-mode-C9jdp1Mr.js → use-view-mode-DXppc9Ne.js} +1 -1
  236. package/dist/client/assets/{use-virtual-mcp-B0KZ5f7x.js → use-virtual-mcp-B2EgYaXF.js} +1 -1
  237. package/dist/client/assets/useInfiniteQuery-B3e5h8-g.js +1 -0
  238. package/dist/client/assets/useSuspenseInfiniteQuery-DgElf62-.js +1 -0
  239. package/dist/client/assets/{users-D-CFyrsb.js → users-D4knlE5Y.js} +1 -1
  240. package/dist/client/assets/{variant-calendar-B-Z6ag4J.js → variant-calendar-liGK8R6N.js} +1 -1
  241. package/dist/client/assets/{view-mode-toggle-B2DIjtO4.js → view-mode-toggle-Da1Cv3i4.js} +1 -1
  242. package/dist/client/index.html +1 -1
  243. package/dist/server/cli.js +683 -610
  244. package/dist/server/migrate.js +254 -181
  245. package/dist/server/server.js +343 -343
  246. package/package.json +1 -1
  247. package/dist/client/assets/api-keys-Cyhr6yA9.js +0 -1
  248. package/dist/client/assets/app-editor-D4awjVz8.js +0 -1
  249. package/dist/client/assets/record-editor-BO0tdXdW.js +0 -1
  250. package/dist/client/assets/redirect-editor-aVa1U6bV.js +0 -1
  251. package/dist/client/assets/registry-CavqWnpp.js +0 -2
  252. package/dist/client/assets/settings-layout-B3CufETO.js +0 -1
  253. package/dist/client/assets/store-registry-CW_ddR1G.js +0 -2
  254. package/dist/client/assets/useInfiniteQuery-CwkiBLlS.js +0 -1
  255. package/dist/client/assets/useSuspenseInfiniteQuery-BTeTh9yc.js +0 -1
@@ -1 +1 @@
1
- import{r as d,br as st,bp as Ne,j as i,d_ as rt,bt as Ie,bq as k,d$ as lt,bm as j,bs as P,cH as $,e0 as at,aB as Ee,e1 as Re,bn as ct,cC as it,e2 as dt,cL as ut,e3 as pt,e4 as ft,e5 as mt,e6 as ht,e7 as gt,bo as vt,e8 as xt,e9 as St,ea as wt,c as ee,l as oe}from"./index-DIek05Ni.js";import{i as Ct}from"./Check-RwOXYzpY.js";import{t as je,n as yt}from"./ChevronUp-CKGVkzNf.js";function Pe(s,[e,t]){return Math.min(t,Math.max(e,s))}var bt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,Tt]=ct(J),[ne]=vt(J,[Tt,Re]),pe=Re(),[Nt,G]=ne(J),[Pt,_t]=ne(J),Me=s=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:a,value:r,defaultValue:l,onValueChange:c,dir:u,name:m,autoComplete:v,disabled:w,required:C,form:S}=s,p=pe(e),[g,y]=d.useState(null),[h,x]=d.useState(null),[F,M]=d.useState(!1),se=st(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:a,caller:J}),[U,q]=Ne({prop:r,defaultProp:l,onChange:c,caller:J}),L=d.useRef(null),B=g?S||!!g.closest("form"):!0,[W,V]=d.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return i.jsx(rt,{...p,children:i.jsxs(Nt,{required:C,scope:e,trigger:g,onTriggerChange:y,valueNode:h,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:se,triggerPointerDownPosRef:L,disabled:w,children:[i.jsx(de.Provider,{scope:e,children:i.jsx(Pt,{scope:s.__scopeSelect,onNativeOptionAdd:d.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:d.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?i.jsxs(et,{"aria-hidden":!0,required:C,tabIndex:-1,name:m,autoComplete:v,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?i.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};Me.displayName=J;var Ae="SelectTrigger",Oe=d.forwardRef((s,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=s,a=pe(t),r=G(Ae,t),l=r.disabled||o,c=k(e,r.onTriggerChange),u=ue(t),m=d.useRef("touch"),[v,w,C]=ot(p=>{const g=u().filter(x=>!x.disabled),y=g.find(x=>x.value===r.value),h=nt(g,p,y);h!==void 0&&r.onValueChange(h.value)}),S=p=>{l||(r.onOpenChange(!0),C()),p&&(r.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return i.jsx(lt,{asChild:!0,...a,children:i.jsx(j.button,{type:"button",role:"combobox","aria-controls":r.contentId,"aria-expanded":r.open,"aria-required":r.required,"aria-autocomplete":"none",dir:r.dir,"data-state":r.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":tt(r.value)?"":void 0,...n,ref:c,onClick:P(n.onClick,p=>{p.currentTarget.focus(),m.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{m.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const g=v.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(g&&p.key===" ")&&bt.includes(p.key)&&(S(),p.preventDefault())})})})});Oe.displayName=Ae;var De="SelectValue",ke=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,children:a,placeholder:r="",...l}=s,c=G(De,t),{onValueNodeHasChildrenChange:u}=c,m=a!==void 0,v=k(e,c.onValueNodeChange);return $(()=>{u(m)},[u,m]),i.jsx(j.span,{...l,ref:v,style:{pointerEvents:"none"},children:tt(c.value)?i.jsx(i.Fragment,{children:r}):a})});ke.displayName=De;var Et="SelectIcon",Le=d.forwardRef((s,e)=>{const{__scopeSelect:t,children:o,...n}=s;return i.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});Le.displayName=Et;var Rt="SelectPortal",Be=s=>i.jsx(at,{asChild:!0,...s});Be.displayName=Rt;var Q="SelectContent",Ve=d.forwardRef((s,e)=>{const t=G(Q,s.__scopeSelect),[o,n]=d.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const a=o;return a?Ee.createPortal(i.jsx(He,{scope:s.__scopeSelect,children:i.jsx(de.Slot,{scope:s.__scopeSelect,children:i.jsx("div",{children:s.children})})}),a):null}return i.jsx(ze,{...s,ref:e})});Ve.displayName=Q;var A=10,[He,Y]=ne(Q),jt="SelectContentImpl",Mt=xt("SelectContent.RemoveScroll"),ze=d.forwardRef((s,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:r,side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g,...y}=s,h=G(Q,t),[x,F]=d.useState(null),[M,se]=d.useState(null),_=k(e,f=>F(f)),[O,U]=d.useState(null),[q,L]=d.useState(null),B=ue(t),[W,V]=d.useState(!1),H=d.useRef(!1);d.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=d.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[b]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===b&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=d.useCallback(()=>E([O,x]),[E,O,x]);d.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=h;d.useEffect(()=>{if(x){let f={x:0,y:0};const T=b=>{f={x:Math.abs(Math.round(b.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(b.pageY)-(K.current?.y??0))}},R=b=>{f.x<=10&&f.y<=10?b.preventDefault():x.contains(b.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),d.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=ot(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),b=nt(T,f,R);b&&setTimeout(()=>b.ref.current.focus())}),me=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&(U(f),b&&(H.current=!0))},[h.value]),he=d.useCallback(()=>x?.focus(),[x]),te=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&L(f)},[h.value]),ce=o==="popper"?Se:Fe,re=ce===Se?{side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g}:{};return i.jsx(He,{scope:t,content:x,viewport:M,onViewportChange:se,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:i.jsx(mt,{as:Mt,allowPinchZoom:!0,children:i.jsx(ht,{asChild:!0,trapped:h.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{h.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:i.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:i.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:f=>f.preventDefault(),...y,...re,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:P(y.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let b=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=b.indexOf(I);b=b.slice(N+1)}setTimeout(()=>E(b)),f.preventDefault()}})})})})})})});ze.displayName=jt;var At="SelectItemAlignedPosition",Fe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=s,a=G(Q,t),r=Y(Q,t),[l,c]=d.useState(null),[u,m]=d.useState(null),v=k(e,_=>m(_)),w=ue(t),C=d.useRef(!1),S=d.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:h}=r,x=d.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&p&&g&&y){const _=a.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=a.valueNode.getBoundingClientRect(),q=y.getBoundingClientRect();if(a.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,X=_.left-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=w(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(g.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,re=g.offsetHeight/2,f=g.offsetTop+re,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&g===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,re+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&g===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+re)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>C.current=!0)}},[w,a.trigger,a.valueNode,l,u,p,g,y,a.dir,o]);$(()=>x(),[x]);const[F,M]=d.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const se=d.useCallback(_=>{_&&S.current===!0&&(x(),h?.(),S.current=!1)},[x,h]);return i.jsx(Dt,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:C,onScrollButtonChange:se,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:i.jsx(j.div,{...n,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});Fe.displayName=At;var Ot="SelectPopperPosition",Se=d.forwardRef((s,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...a}=s,r=pe(t);return i.jsx(St,{...r,...a,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=Ot;var[Dt,Te]=ne(Q,{}),we="SelectViewport",Ue=d.forwardRef((s,e)=>{const{__scopeSelect:t,nonce:o,...n}=s,a=Y(we,t),r=Te(we,t),l=k(e,a.onViewportChange),c=d.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),i.jsx(de.Slot,{scope:t,children:i.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const m=u.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=r;if(w?.current&&v){const C=Math.abs(c.current-m.scrollTop);if(C>0){const S=window.innerHeight-A*2,p=parseFloat(v.style.minHeight),g=parseFloat(v.style.height),y=Math.max(p,g);if(y<S){const h=y+C,x=Math.min(S,h),F=h-x;v.style.height=x+"px",v.style.bottom==="0px"&&(m.scrollTop=F>0?F:0,v.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[kt,Lt]=ne(We),Bt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Ie();return i.jsx(kt,{scope:t,id:n,children:i.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Bt.displayName=We;var Ke="SelectLabel",Vt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Lt(Ke,t);return i.jsx(j.div,{id:n.id,...o,ref:e})});Vt.displayName=Ke;var ie="SelectItem",[Ht,$e]=ne(ie),Ge=d.forwardRef((s,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:a,...r}=s,l=G(ie,t),c=Y(ie,t),u=l.value===o,[m,v]=d.useState(a??""),[w,C]=d.useState(!1),S=k(e,h=>c.itemRefCallback?.(h,o,n)),p=Ie(),g=d.useRef("touch"),y=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Ht,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:d.useCallback(h=>{v(x=>x||(h?.textContent??"").trim())},[]),children:i.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:m,children:i.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...r,ref:S,onFocus:P(r.onFocus,()=>C(!0)),onBlur:P(r.onBlur,()=>C(!1)),onClick:P(r.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:P(r.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:P(r.onPointerDown,h=>{g.current=h.pointerType}),onPointerMove:P(r.onPointerMove,h=>{g.current=h.pointerType,n?c.onItemLeave?.():g.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(r.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(r.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(It.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Ge.displayName=ie;var le="SelectItemText",Ye=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,...a}=s,r=G(le,t),l=Y(le,t),c=$e(le,t),u=_t(le,t),[m,v]=d.useState(null),w=k(e,y=>v(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),C=m?.textContent,S=d.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:C},c.value),[c.disabled,c.value,C]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return $(()=>(p(S),()=>g(S)),[p,g,S]),i.jsxs(i.Fragment,{children:[i.jsx(j.span,{id:c.textId,...a,ref:w}),c.isSelected&&r.valueNode&&!r.valueNodeHasChildren?Ee.createPortal(a.children,r.valueNode):null]})});Ye.displayName=le;var qe="SelectItemIndicator",Xe=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return $e(qe,t).isSelected?i.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});Xe.displayName=qe;var Ce="SelectScrollUpButton",Ze=d.forwardRef((s,e)=>{const t=Y(Ce,s.__scopeSelect),o=Te(Ce,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Je=d.forwardRef((s,e)=>{const t=Y(ye,s.__scopeSelect),o=Te(ye,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<u;a(m)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Je.displayName=ye;var Qe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=s,a=Y("SelectScrollButton",t),r=d.useRef(null),l=ue(t),c=d.useCallback(()=>{r.current!==null&&(window.clearInterval(r.current),r.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),$(()=>{l().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),i.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{r.current===null&&(r.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{a.onItemLeave?.(),r.current===null&&(r.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{c()})})}),zt="SelectSeparator",Ft=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return i.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});Ft.displayName=zt;var be="SelectArrow",Ut=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=pe(t),a=G(be,t),r=Y(be,t);return a.open&&r.position==="popper"?i.jsx(wt,{...n,...o,ref:e}):null});Ut.displayName=be;var Wt="SelectBubbleInput",et=d.forwardRef(({__scopeSelect:s,value:e,...t},o)=>{const n=d.useRef(null),a=k(o,n),r=it(e);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(r!==e&&m){const v=new Event("change",{bubbles:!0});m.call(l,e),l.dispatchEvent(v)}},[r,e]),i.jsx(j.select,{...t,style:{...dt,...t.style},ref:a,defaultValue:e})});et.displayName=Wt;function tt(s){return s===""||s===void 0}function ot(s){const e=ut(s),t=d.useRef(""),o=d.useRef(0),n=d.useCallback(r=>{const l=t.current+r;e(l),(function c(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))})(l)},[e]),a=d.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,a]}function nt(s,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=t?s.indexOf(t):-1;let r=Kt(s,Math.max(a,0));n.length===1&&(r=r.filter(u=>u!==t));const c=r.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==t?c:void 0}function Kt(s,e){return s.map((t,o)=>s[(e+o)%s.length])}var $t=Me,Gt=Oe,Yt=ke,qt=Le,Xt=Be,Zt=Ve,Jt=Ue,Qt=Ge,_e=Ye,eo=Xe,to=Ze,oo=Je;function co(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx($t,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function io(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(Yt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(s){const e=ee.c(13);let t,o,n,a;e[0]!==s?({className:o,size:a,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a):(t=e[1],o=e[2],n=e[3],a=e[4]);const r=a===void 0?"default":a;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(qt,{asChild:!0,children:i.jsx(je,{className:"size-4 opacity-50"})}),e[7]=c):c=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==r||e[11]!==l?(u=i.jsxs(Gt,{"data-slot":"select-trigger","data-size":r,className:l,...n,children:[t,c]}),e[8]=t,e[9]=n,e[10]=r,e[11]=l,e[12]=u):u=e[12],u}function po(s){const e=ee.c(25);let t,o,n,a,r;e[0]!==s?({className:o,children:t,position:a,hideScrollButtons:r,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=a===void 0?"popper":a,c=r===void 0?!1:r,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let m;e[6]!==o||e[7]!==u?(m=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=m):m=e[8];let v;e[9]!==c?(v=!c&&i.jsx(no,{}),e[9]=c,e[10]=v):v=e[10];const w=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let C;e[11]!==w?(C=oe("p-1",w),e[11]=w,e[12]=C):C=e[12];let S;e[13]!==t||e[14]!==C?(S=i.jsx(Jt,{className:C,children:t}),e[13]=t,e[14]=C,e[15]=S):S=e[15];let p;e[16]!==c?(p=!c&&i.jsx(so,{}),e[16]=c,e[17]=p):p=e[17];let g;return e[18]!==l||e[19]!==n||e[20]!==m||e[21]!==v||e[22]!==S||e[23]!==p?(g=i.jsx(Xt,{children:i.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:m,position:l,...n,children:[v,S,p]})}),e[18]=l,e[19]=n,e[20]=m,e[21]=v,e[22]=S,e[23]=p,e[24]=g):g=e[24],g}function fo(s){const e=ee.c(19);let t,o,n,a,r;e[0]!==s?({className:o,children:t,description:n,hideCheck:r,...a}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=r===void 0?!1:r,c=n&&"items-start py-2";let u;e[6]!==o||e[7]!==c?(u=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",c,o),e[6]=o,e[7]=c,e[8]=u):u=e[8];let m;e[9]!==l?(m=!l&&i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(eo,{children:i.jsx(Ct,{className:"size-4"})})}),e[9]=l,e[10]=m):m=e[10];let v;e[11]!==t||e[12]!==n?(v=n?i.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[i.jsx(_e,{children:t}),i.jsx("span",{className:"text-xs text-muted-foreground whitespace-normal",children:n})]}):i.jsx(_e,{children:t}),e[11]=t,e[12]=n,e[13]=v):v=e[13];let w;return e[14]!==a||e[15]!==u||e[16]!==m||e[17]!==v?(w=i.jsxs(Qt,{"data-slot":"select-item",className:u,...a,children:[m,v]}),e[14]=a,e[15]=u,e[16]=m,e[17]=v,e[18]=w):w=e[18],w}function no(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(yt,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}function so(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(je,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}export{co as S,io as a,uo as b,fo as c,po as d,Pe as e};
1
+ import{r as d,br as st,bp as Ne,j as i,d_ as rt,bt as Ie,bq as k,d$ as lt,bm as j,bs as P,cH as $,e0 as at,aB as Ee,e1 as Re,bn as ct,cC as it,e2 as dt,cL as ut,e3 as pt,e4 as ft,e5 as mt,e6 as ht,e7 as gt,bo as vt,e8 as xt,e9 as St,ea as wt,c as ee,l as oe}from"./index-CSRM1f8q.js";import{i as Ct}from"./Check-D1RndvMl.js";import{t as je,n as yt}from"./ChevronUp-B-O6lb_g.js";function Pe(s,[e,t]){return Math.min(t,Math.max(e,s))}var bt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,Tt]=ct(J),[ne]=vt(J,[Tt,Re]),pe=Re(),[Nt,G]=ne(J),[Pt,_t]=ne(J),Me=s=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:a,value:r,defaultValue:l,onValueChange:c,dir:u,name:m,autoComplete:v,disabled:w,required:C,form:S}=s,p=pe(e),[g,y]=d.useState(null),[h,x]=d.useState(null),[F,M]=d.useState(!1),se=st(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:a,caller:J}),[U,q]=Ne({prop:r,defaultProp:l,onChange:c,caller:J}),L=d.useRef(null),B=g?S||!!g.closest("form"):!0,[W,V]=d.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return i.jsx(rt,{...p,children:i.jsxs(Nt,{required:C,scope:e,trigger:g,onTriggerChange:y,valueNode:h,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:se,triggerPointerDownPosRef:L,disabled:w,children:[i.jsx(de.Provider,{scope:e,children:i.jsx(Pt,{scope:s.__scopeSelect,onNativeOptionAdd:d.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:d.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?i.jsxs(et,{"aria-hidden":!0,required:C,tabIndex:-1,name:m,autoComplete:v,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?i.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};Me.displayName=J;var Ae="SelectTrigger",Oe=d.forwardRef((s,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=s,a=pe(t),r=G(Ae,t),l=r.disabled||o,c=k(e,r.onTriggerChange),u=ue(t),m=d.useRef("touch"),[v,w,C]=ot(p=>{const g=u().filter(x=>!x.disabled),y=g.find(x=>x.value===r.value),h=nt(g,p,y);h!==void 0&&r.onValueChange(h.value)}),S=p=>{l||(r.onOpenChange(!0),C()),p&&(r.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return i.jsx(lt,{asChild:!0,...a,children:i.jsx(j.button,{type:"button",role:"combobox","aria-controls":r.contentId,"aria-expanded":r.open,"aria-required":r.required,"aria-autocomplete":"none",dir:r.dir,"data-state":r.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":tt(r.value)?"":void 0,...n,ref:c,onClick:P(n.onClick,p=>{p.currentTarget.focus(),m.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{m.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const g=v.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(g&&p.key===" ")&&bt.includes(p.key)&&(S(),p.preventDefault())})})})});Oe.displayName=Ae;var De="SelectValue",ke=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,children:a,placeholder:r="",...l}=s,c=G(De,t),{onValueNodeHasChildrenChange:u}=c,m=a!==void 0,v=k(e,c.onValueNodeChange);return $(()=>{u(m)},[u,m]),i.jsx(j.span,{...l,ref:v,style:{pointerEvents:"none"},children:tt(c.value)?i.jsx(i.Fragment,{children:r}):a})});ke.displayName=De;var Et="SelectIcon",Le=d.forwardRef((s,e)=>{const{__scopeSelect:t,children:o,...n}=s;return i.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});Le.displayName=Et;var Rt="SelectPortal",Be=s=>i.jsx(at,{asChild:!0,...s});Be.displayName=Rt;var Q="SelectContent",Ve=d.forwardRef((s,e)=>{const t=G(Q,s.__scopeSelect),[o,n]=d.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const a=o;return a?Ee.createPortal(i.jsx(He,{scope:s.__scopeSelect,children:i.jsx(de.Slot,{scope:s.__scopeSelect,children:i.jsx("div",{children:s.children})})}),a):null}return i.jsx(ze,{...s,ref:e})});Ve.displayName=Q;var A=10,[He,Y]=ne(Q),jt="SelectContentImpl",Mt=xt("SelectContent.RemoveScroll"),ze=d.forwardRef((s,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:r,side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g,...y}=s,h=G(Q,t),[x,F]=d.useState(null),[M,se]=d.useState(null),_=k(e,f=>F(f)),[O,U]=d.useState(null),[q,L]=d.useState(null),B=ue(t),[W,V]=d.useState(!1),H=d.useRef(!1);d.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=d.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[b]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===b&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=d.useCallback(()=>E([O,x]),[E,O,x]);d.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=h;d.useEffect(()=>{if(x){let f={x:0,y:0};const T=b=>{f={x:Math.abs(Math.round(b.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(b.pageY)-(K.current?.y??0))}},R=b=>{f.x<=10&&f.y<=10?b.preventDefault():x.contains(b.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),d.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=ot(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),b=nt(T,f,R);b&&setTimeout(()=>b.ref.current.focus())}),me=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&(U(f),b&&(H.current=!0))},[h.value]),he=d.useCallback(()=>x?.focus(),[x]),te=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&L(f)},[h.value]),ce=o==="popper"?Se:Fe,re=ce===Se?{side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g}:{};return i.jsx(He,{scope:t,content:x,viewport:M,onViewportChange:se,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:i.jsx(mt,{as:Mt,allowPinchZoom:!0,children:i.jsx(ht,{asChild:!0,trapped:h.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{h.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:i.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:i.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:f=>f.preventDefault(),...y,...re,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:P(y.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let b=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=b.indexOf(I);b=b.slice(N+1)}setTimeout(()=>E(b)),f.preventDefault()}})})})})})})});ze.displayName=jt;var At="SelectItemAlignedPosition",Fe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=s,a=G(Q,t),r=Y(Q,t),[l,c]=d.useState(null),[u,m]=d.useState(null),v=k(e,_=>m(_)),w=ue(t),C=d.useRef(!1),S=d.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:h}=r,x=d.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&p&&g&&y){const _=a.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=a.valueNode.getBoundingClientRect(),q=y.getBoundingClientRect();if(a.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,X=_.left-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=w(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(g.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,re=g.offsetHeight/2,f=g.offsetTop+re,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&g===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,re+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&g===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+re)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>C.current=!0)}},[w,a.trigger,a.valueNode,l,u,p,g,y,a.dir,o]);$(()=>x(),[x]);const[F,M]=d.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const se=d.useCallback(_=>{_&&S.current===!0&&(x(),h?.(),S.current=!1)},[x,h]);return i.jsx(Dt,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:C,onScrollButtonChange:se,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:i.jsx(j.div,{...n,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});Fe.displayName=At;var Ot="SelectPopperPosition",Se=d.forwardRef((s,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...a}=s,r=pe(t);return i.jsx(St,{...r,...a,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=Ot;var[Dt,Te]=ne(Q,{}),we="SelectViewport",Ue=d.forwardRef((s,e)=>{const{__scopeSelect:t,nonce:o,...n}=s,a=Y(we,t),r=Te(we,t),l=k(e,a.onViewportChange),c=d.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),i.jsx(de.Slot,{scope:t,children:i.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const m=u.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=r;if(w?.current&&v){const C=Math.abs(c.current-m.scrollTop);if(C>0){const S=window.innerHeight-A*2,p=parseFloat(v.style.minHeight),g=parseFloat(v.style.height),y=Math.max(p,g);if(y<S){const h=y+C,x=Math.min(S,h),F=h-x;v.style.height=x+"px",v.style.bottom==="0px"&&(m.scrollTop=F>0?F:0,v.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[kt,Lt]=ne(We),Bt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Ie();return i.jsx(kt,{scope:t,id:n,children:i.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Bt.displayName=We;var Ke="SelectLabel",Vt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Lt(Ke,t);return i.jsx(j.div,{id:n.id,...o,ref:e})});Vt.displayName=Ke;var ie="SelectItem",[Ht,$e]=ne(ie),Ge=d.forwardRef((s,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:a,...r}=s,l=G(ie,t),c=Y(ie,t),u=l.value===o,[m,v]=d.useState(a??""),[w,C]=d.useState(!1),S=k(e,h=>c.itemRefCallback?.(h,o,n)),p=Ie(),g=d.useRef("touch"),y=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Ht,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:d.useCallback(h=>{v(x=>x||(h?.textContent??"").trim())},[]),children:i.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:m,children:i.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...r,ref:S,onFocus:P(r.onFocus,()=>C(!0)),onBlur:P(r.onBlur,()=>C(!1)),onClick:P(r.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:P(r.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:P(r.onPointerDown,h=>{g.current=h.pointerType}),onPointerMove:P(r.onPointerMove,h=>{g.current=h.pointerType,n?c.onItemLeave?.():g.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(r.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(r.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(It.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Ge.displayName=ie;var le="SelectItemText",Ye=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,...a}=s,r=G(le,t),l=Y(le,t),c=$e(le,t),u=_t(le,t),[m,v]=d.useState(null),w=k(e,y=>v(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),C=m?.textContent,S=d.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:C},c.value),[c.disabled,c.value,C]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return $(()=>(p(S),()=>g(S)),[p,g,S]),i.jsxs(i.Fragment,{children:[i.jsx(j.span,{id:c.textId,...a,ref:w}),c.isSelected&&r.valueNode&&!r.valueNodeHasChildren?Ee.createPortal(a.children,r.valueNode):null]})});Ye.displayName=le;var qe="SelectItemIndicator",Xe=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return $e(qe,t).isSelected?i.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});Xe.displayName=qe;var Ce="SelectScrollUpButton",Ze=d.forwardRef((s,e)=>{const t=Y(Ce,s.__scopeSelect),o=Te(Ce,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Je=d.forwardRef((s,e)=>{const t=Y(ye,s.__scopeSelect),o=Te(ye,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<u;a(m)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Je.displayName=ye;var Qe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=s,a=Y("SelectScrollButton",t),r=d.useRef(null),l=ue(t),c=d.useCallback(()=>{r.current!==null&&(window.clearInterval(r.current),r.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),$(()=>{l().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),i.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{r.current===null&&(r.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{a.onItemLeave?.(),r.current===null&&(r.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{c()})})}),zt="SelectSeparator",Ft=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return i.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});Ft.displayName=zt;var be="SelectArrow",Ut=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=pe(t),a=G(be,t),r=Y(be,t);return a.open&&r.position==="popper"?i.jsx(wt,{...n,...o,ref:e}):null});Ut.displayName=be;var Wt="SelectBubbleInput",et=d.forwardRef(({__scopeSelect:s,value:e,...t},o)=>{const n=d.useRef(null),a=k(o,n),r=it(e);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(r!==e&&m){const v=new Event("change",{bubbles:!0});m.call(l,e),l.dispatchEvent(v)}},[r,e]),i.jsx(j.select,{...t,style:{...dt,...t.style},ref:a,defaultValue:e})});et.displayName=Wt;function tt(s){return s===""||s===void 0}function ot(s){const e=ut(s),t=d.useRef(""),o=d.useRef(0),n=d.useCallback(r=>{const l=t.current+r;e(l),(function c(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))})(l)},[e]),a=d.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,a]}function nt(s,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=t?s.indexOf(t):-1;let r=Kt(s,Math.max(a,0));n.length===1&&(r=r.filter(u=>u!==t));const c=r.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==t?c:void 0}function Kt(s,e){return s.map((t,o)=>s[(e+o)%s.length])}var $t=Me,Gt=Oe,Yt=ke,qt=Le,Xt=Be,Zt=Ve,Jt=Ue,Qt=Ge,_e=Ye,eo=Xe,to=Ze,oo=Je;function co(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx($t,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function io(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(Yt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(s){const e=ee.c(13);let t,o,n,a;e[0]!==s?({className:o,size:a,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a):(t=e[1],o=e[2],n=e[3],a=e[4]);const r=a===void 0?"default":a;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(qt,{asChild:!0,children:i.jsx(je,{className:"size-4 opacity-50"})}),e[7]=c):c=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==r||e[11]!==l?(u=i.jsxs(Gt,{"data-slot":"select-trigger","data-size":r,className:l,...n,children:[t,c]}),e[8]=t,e[9]=n,e[10]=r,e[11]=l,e[12]=u):u=e[12],u}function po(s){const e=ee.c(25);let t,o,n,a,r;e[0]!==s?({className:o,children:t,position:a,hideScrollButtons:r,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=a===void 0?"popper":a,c=r===void 0?!1:r,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let m;e[6]!==o||e[7]!==u?(m=oe("notranslate bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=m):m=e[8];let v;e[9]!==c?(v=!c&&i.jsx(no,{}),e[9]=c,e[10]=v):v=e[10];const w=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let C;e[11]!==w?(C=oe("p-1",w),e[11]=w,e[12]=C):C=e[12];let S;e[13]!==t||e[14]!==C?(S=i.jsx(Jt,{className:C,children:t}),e[13]=t,e[14]=C,e[15]=S):S=e[15];let p;e[16]!==c?(p=!c&&i.jsx(so,{}),e[16]=c,e[17]=p):p=e[17];let g;return e[18]!==l||e[19]!==n||e[20]!==m||e[21]!==v||e[22]!==S||e[23]!==p?(g=i.jsx(Xt,{children:i.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:m,position:l,...n,children:[v,S,p]})}),e[18]=l,e[19]=n,e[20]=m,e[21]=v,e[22]=S,e[23]=p,e[24]=g):g=e[24],g}function fo(s){const e=ee.c(19);let t,o,n,a,r;e[0]!==s?({className:o,children:t,description:n,hideCheck:r,...a}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=r===void 0?!1:r,c=n&&"items-start py-2";let u;e[6]!==o||e[7]!==c?(u=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",c,o),e[6]=o,e[7]=c,e[8]=u):u=e[8];let m;e[9]!==l?(m=!l&&i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(eo,{children:i.jsx(Ct,{className:"size-4"})})}),e[9]=l,e[10]=m):m=e[10];let v;e[11]!==t||e[12]!==n?(v=n?i.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[i.jsx(_e,{children:t}),i.jsx("span",{className:"text-xs text-muted-foreground whitespace-normal",children:n})]}):i.jsx(_e,{children:t}),e[11]=t,e[12]=n,e[13]=v):v=e[13];let w;return e[14]!==a||e[15]!==u||e[16]!==m||e[17]!==v?(w=i.jsxs(Qt,{"data-slot":"select-item",className:u,...a,children:[m,v]}),e[14]=a,e[15]=u,e[16]=m,e[17]=v,e[18]=w):w=e[18],w}function no(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(yt,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}function so(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(je,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}export{co as S,io as a,uo as b,fo as c,po as d,Pe as e};
@@ -1 +1 @@
1
- import{bH as gt,ad as Ie,bI as pt,ac as ht,bJ as Ze,n as ye,bK as bt,bL as yt,r as H,bM as xt,bN as Ct,bO as St,bP as vt,bQ as Me,bR as Ot,bS as jt,bT as _t,c as G,l as fe,j as o,b as te,h as Re,B as Z,e as Te,K as J,ae as xe,ag as ie,ar as Ce,aq as Se,m as be,aR as Nt,t as _e,a4 as Fe,a1 as Le,a2 as Ke,u as Tt,x as je,o as ue,bU as Qe,Q as Et,E as wt,a as It}from"./index-DIek05Ni.js";import{u as Ae}from"./use-mcp-client-TErTfSlr.js";import{W as Je,g as kt,S as Rt}from"./constants-Daqiz8AS.js";import{I as De}from"./integration-icon-BdFo1XXn.js";import{e as ge,d as Xe,c as et,b as tt,D as nt,h as Ft}from"./dialog-ClXo-ILY.js";import{p as ot,aa as st,S as Lt}from"./agent-icon-COOgI3ay.js";import{a as Kt,c as At,e as Dt}from"./extract-connection-data-CBaHjHii.js";import{g as Pt,f as it,a as Bt,p as qt,i as Ut}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{g as rt}from"./metadata-dUsYcpuu.js";import{i as at}from"./CheckCircle-BakDkudF.js";import{d as re,F as ve,a as ae,e as he,b as ce,c as le,f as $t}from"./form-BbPYrZM0.js";import{I as pe}from"./input-B6-nFuh0.js";import{i as Mt}from"./Check-RwOXYzpY.js";import{a as ct}from"./Copy01-D8F1H1Rm.js";import{i as Qt}from"./Settings02-DI7LVcro.js";import{s as zt}from"./Eye-BkYoLh_d.js";import{u as Vt}from"./use-debounced-value-BbelcnFE.js";import{n as Ht}from"./LinkExternal01-CYGJDolS.js";import{a as Gt}from"./authenticate-and-persist-oauth-Bc7-Czof.js";import{r as ze}from"./track-CJ7UTAbv.js";function Ve(n,e){const t=new Set(e);return n.filter(s=>!t.has(s))}function Wt(n,e,t){const s=n.slice(0);return s[e]=t,s}var Yt=class extends gt{#s;#e;#i;#o;#t;#n;#r;#a;#c;#l=[];constructor(n,e,t){super(),this.#s=n,this.#o=t,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(n=>{n.subscribe(e=>{this.#f(n,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(n=>{n.destroy()})}setQueries(n,e){this.#i=n,this.#o=e,Ie.batch(()=>{const t=this.#t,s=this.#m(this.#i);s.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=s.map(d=>d.observer),l=i.map(d=>d.getCurrentResult()),r=t.length!==i.length,a=i.some((d,c)=>d!==t[c]),u=r||a,p=u?!0:l.some((d,c)=>{const f=this.#e[c];return!f||!pt(d,f)});!u&&!p||(u&&(this.#l=s,this.#t=i),this.#e=l,this.hasListeners()&&(u&&(Ve(t,i).forEach(d=>{d.destroy()}),Ve(i,t).forEach(d=>{d.subscribe(c=>{this.#f(d,c)})})),this.#g()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(n=>n.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(n,e){const t=this.#m(n),s=t.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),i=t.map(l=>l.defaultedQueryOptions.queryHash);return[s,l=>this.#u(l??s,e,i),()=>this.#d(s,t)]}#d(n,e){return e.map((t,s)=>{const i=n[s];return t.defaultedQueryOptions.notifyOnChangeProps?i:t.observer.trackResult(i,l=>{e.forEach(r=>{r.observer.trackProp(l)})})})}#u(n,e,t){if(e){const s=this.#c,i=t!==void 0&&s!==void 0&&(s.length!==t.length||t.some((l,r)=>l!==s[r]));return(!this.#n||this.#e!==this.#a||i||e!==this.#r)&&(this.#r=e,this.#a=this.#e,t!==void 0&&(this.#c=t),this.#n=ht(this.#n,e(n))),this.#n}return n}#p(){return this.#o?.combine!==void 0&&this.#t.some((n,e)=>n.options.suspense&&this.#e[e]?.data===void 0)}#m(n){const e=new Map;this.#t.forEach(s=>{const i=s.options.queryHash;if(!i)return;const l=e.get(i);l?l.push(s):e.set(i,[s])});const t=[];return n.forEach(s=>{const i=this.#s.defaultQueryOptions(s),r=e.get(i.queryHash)?.shift()??new Ze(this.#s,i);t.push({defaultedQueryOptions:i,observer:r})}),t}#f(n,e){const t=this.#t.indexOf(n);t!==-1&&(this.#e=Wt(this.#e,t,e),this.#g())}#g(){if(this.hasListeners()){const n=this.#d(this.#e,this.#l),e=this.#p(),t=this.#n,s=e?t:this.#u(n,this.#o?.combine);(e||t!==s)&&Ie.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function Zt({queries:n,...e},t){const s=ye(t),i=bt(),l=yt(),r=H.useMemo(()=>n.map(x=>{const h=s.defaultQueryOptions(x);return h._optimisticResults=i?"isRestoring":"optimistic",h}),[n,s,i]);r.forEach(x=>{xt(x);const h=s.getQueryCache().get(x.queryHash);Ct(x,l,h)}),St(l);const[a]=H.useState(()=>new Yt(s,r,e)),[u,p,d]=a.getOptimisticResult(r,e.combine),c=!i&&e.subscribed!==!1;H.useSyncExternalStore(H.useCallback(x=>c?a.subscribe(Ie.batchCalls(x)):vt,[a,c]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),H.useEffect(()=>{a.setQueries(r,e)},[r,e,a]);const m=u.some((x,h)=>Me(r[h],x))?u.flatMap((x,h)=>{const b=r[h];if(b&&Me(b,x)){const g=new Ze(s,b);return Ot(b,g,l)}return[]}):[];if(m.length>0)throw Promise.all(m);const y=u.find((x,h)=>{const b=r[h];return b&&jt({result:x,errorResetBoundary:l,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(y?.error)throw y.error;return p(d())}function Jt(n,e){return Zt({...n,queries:n.queries.map(t=>({...t,suspense:!0,throwOnError:_t,enabled:!0,placeholderData:void 0}))},e)}const Xt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,en=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,tn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,nn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Ne(n){const e=n.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=Xt.test(e),s=en.test(e),i=tn.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=s?e:`https://${e}`;let r;try{r=new URL(l)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=r.hostname.split(".");return a.length<2||a.some(u=>!u||!nn.test(u))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Uo(n,e){if(!n.trim())return!0;const t=Ne(n);if(!t.ok||!e)return!1;const s=Ne(e);return s.ok&&s.value===t.value}function on(n){if(!n)return null;const e=Ne(n);return e.ok?new URL(e.value).hostname:null}function sn(n){const e=G.c(14),{children:t,className:s,wrapperClassName:i}=n,[l,r]=H.useState(!0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=x=>{if(!x)return;const h=()=>{const g=x.scrollHeight-x.scrollTop-x.clientHeight<8;r(g)};h(),x.addEventListener("scroll",h,{passive:!0});const b=new ResizeObserver(h);b.observe(x);for(const g of Array.from(x.children))b.observe(g);return()=>{x.removeEventListener("scroll",h),b.disconnect()}},e[0]=a):a=e[0];const u=a;let p;e[1]!==i?(p=fe("relative",i),e[1]=i,e[2]=p):p=e[2];let d;e[3]!==t||e[4]!==s?(d=o.jsx("div",{ref:u,className:s,children:t}),e[3]=t,e[4]=s,e[5]=d):d=e[5];const c=l?"opacity-0":"opacity-100";let f;e[6]!==c?(f=fe("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",c),e[6]=c,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("div",{"aria-hidden":!0,className:f}),e[8]=f,e[9]=m):m=e[9];let y;return e[10]!==p||e[11]!==d||e[12]!==m?(y=o.jsxs("div",{className:p,children:[d,m]}),e[10]=p,e[11]=d,e[12]=m,e[13]=y):y=e[13],y}const rn=new Set([]);function an(n){if(n.boundVia==="sa")return!0;const{companionConfig:e,cdConfig:t}=n;switch(n.bindingType){case"vtex":return me(e?.accountName);case"shopify":return me(e?.storeDomain);case"google-analytics":return me(e?.propertyId);case"google-search-console":return me(e?.siteUrl);case"github":return me(t?.github_repo);default:return!0}}function cn(n){const{companionConfig:e,cdConfig:t}=n;switch(n.bindingType){case"vtex":return typeof e?.accountName=="string"?e.accountName:null;case"shopify":return typeof e?.storeDomain=="string"?e.storeDomain:null;case"google-analytics":return typeof e?.propertyId=="string"?e.propertyId:null;case"google-search-console":return typeof e?.siteUrl=="string"?e.siteUrl:null;case"github":return typeof t?.github_repo=="string"?t.github_repo:null;default:return null}}function ln(n){const e=n.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const a=i?.properties?.__type?.const;typeof a=="string"&&a.length>0&&t.push({fieldKey:s,bindingType:a})}return t}const dn=[{fieldKey:"vtex",bindingType:"vtex"},{fieldKey:"shopify",bindingType:"shopify"},{fieldKey:"ga4",bindingType:"google-analytics"},{fieldKey:"gsc",bindingType:"google-search-console"},{fieldKey:"github",bindingType:"github"}];function un(n,e){const t=[];if(n.length&&t.push({field:["id"],operator:"in",value:n}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function ee(n){const e=n;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??n}function mn(n,e,t,s){return{...n??{},[e]:{__type:t,value:s}}}function me(n){return n==null?!1:typeof n=="string"?n.trim().length>0:typeof n=="number"||typeof n=="boolean"?!0:Array.isArray(n)?n.some(me):typeof n=="object"?Object.entries(n).some(([e,t])=>!e.startsWith("__")&&me(t)):!1}const fn={accountName:"commerceOnboarding.companionCard.configField.accountName",appKey:"commerceOnboarding.companionCard.configField.appKey",appToken:"commerceOnboarding.companionCard.configField.appToken",propertyId:"commerceOnboarding.companionCard.configField.propertyId",siteUrl:"commerceOnboarding.companionCard.configField.siteUrl"};function gn(n,e){const t=fn[n];return t?e(t):n.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,s=>s.toUpperCase())}function pn(n){return me(n)?typeof n=="string"?n.trim():typeof n=="number"||typeof n=="boolean"?String(n):JSON.stringify(n):null}function hn(n,e){return n?Object.entries(n).flatMap(([t,s])=>{if(t.startsWith("__"))return[];const i=pn(s);return i?[{key:t,label:gn(t,e),value:i}]:[]}):[]}function He({autoOpenFieldKey:n,card:e}){return n===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function bn(n,e,t){const s=n.filter(i=>(i.app_name===e||!!t&&i.app_id===t)&&Pt(i)===null);return s.length===0?null:(s.sort((i,l)=>{const r=a=>a.status==="active"?0:1;return r(i)!==r(l)?r(i)-r(l):(l.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function yn(n){return n.server?.icons?.[0]?.src??Kt(n.server?.repository)??null}function xn(n,e){const t=rt(n._meta);return t?.friendlyName||t?.friendly_name||n.title||n.server?.title||n.server?.name||e}function Cn(n){const e=[],t=new Map(n.connections.map(s=>[s.id,s]));for(const s of n.requirements){const i=n.curated[s.bindingType],l=i?n.itemsById[i.registryAppId]:n.itemsByName[s.bindingType];if(!l)continue;const r=n.configurationState?.[s.fieldKey]?.value,a=r?t.get(r):void 0,u=r&&a?r:null,p=u?n.connectionReadiness?.[u]!==!1:!1,d=!!u&&p,c=d?void 0:n.saBindings?.[s.bindingType],f=d||!!c,m=d?"oauth":c?"sa":null,y=f&&an({bindingType:s.bindingType,boundVia:m,companionConfig:a?.configuration_state??null,cdConfig:n.configurationState??null});e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:l,title:xn(l,s.bindingType),icon:yn(l),headline:i?.headline??rt(l._meta)?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,configured:y,required:rn.has(s.bindingType),candidateConnectionId:f?null:u||bn(n.connections,s.bindingType,i?.registryAppId),linkedConnectionId:u,configurationState:a?.configuration_state??null,boundVia:m,boundResource:c?.resource??null,connectedDetail:f?cn({bindingType:s.bindingType,companionConfig:a?.configuration_state??null,cdConfig:n.configurationState??null}):null})}return e}function Sn(n,e){if(!n)return null;const t=i=>{const l=i.startsWith("sc-domain:")?i.substring(10):(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`).hostname}catch{return null}})();return l===null?i:l.startsWith("www.")?l.substring(4):l},s=t(n);for(const i of e)if(t(i.siteUrl)===s)return i.siteUrl;return null}function vn(n){return(n?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function On(n){const e=G.c(25),{icon:t,title:s,headline:i,required:l,attention:r,action:a}=n,u=te(),p=r?"border-warning/50 bg-warning/[0.04]":"border-border";let d;e[0]!==p?(d=fe("relative flex items-center justify-between gap-3 rounded-lg border bg-card p-3.5 sm:gap-4 sm:p-4",p),e[0]=p,e[1]=d):d=e[1];let c;e[2]!==l||e[3]!==u?(c=l&&o.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:u("commerceOnboarding.companionCard.required")}),e[2]=l,e[3]=u,e[4]=c):c=e[4];let f;e[5]!==t||e[6]!==s?(f=o.jsx(De,{icon:t,name:s,size:"sm",fit:"contain",className:"shrink-0 p-1"}),e[5]=t,e[6]=s,e[7]=f):f=e[7];let m;e[8]!==s?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),e[8]=s,e[9]=m):m=e[9];let y;e[10]!==i?(y=i&&o.jsx("p",{className:"hidden text-sm leading-5 text-muted-foreground sm:block",children:i}),e[10]=i,e[11]=y):y=e[11];let x;e[12]!==m||e[13]!==y?(x=o.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[m,y]}),e[12]=m,e[13]=y,e[14]=x):x=e[14];let h;e[15]!==f||e[16]!==x?(h=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3 sm:items-start",children:[f,x]}),e[15]=f,e[16]=x,e[17]=h):h=e[17];let b;e[18]!==a?(b=o.jsx("div",{className:"shrink-0",children:a}),e[18]=a,e[19]=b):b=e[19];let g;return e[20]!==d||e[21]!==c||e[22]!==h||e[23]!==b?(g=o.jsxs("div",{className:d,children:[c,h,b]}),e[20]=d,e[21]=c,e[22]=h,e[23]=b,e[24]=g):g=e[24],g}function lt(n){const e=G.c(12),{connecting:t,disabled:s,title:i,primary:l,onConnect:r}=n,a=te(),u=l?"default":"outline",p=s||t;let d;e[0]!==a||e[1]!==i?(d=a("commerceOnboarding.companionCard.connectAriaLabel",{title:i}),e[0]=a,e[1]=i,e[2]=d):d=e[2];let c;e[3]!==t||e[4]!==a?(c=t?o.jsx(Re,{className:"size-4"}):a("commerceOnboarding.companionCard.connect"),e[3]=t,e[4]=a,e[5]=c):c=e[5];let f;return e[6]!==r||e[7]!==u||e[8]!==p||e[9]!==d||e[10]!==c?(f=o.jsx(Z,{type:"button",variant:u,size:"sm",disabled:p,onClick:r,"aria-label":d,children:c}),e[6]=r,e[7]=u,e[8]=p,e[9]=d,e[10]=c,e[11]=f):f=e[11],f}function jn(n){const e=G.c(11),{disabled:t,title:s,onConfigure:i}=n,l=te();let r;e[0]!==l||e[1]!==s?(r=l("commerceOnboarding.companionCard.configureAriaLabel",{title:s}),e[0]=l,e[1]=s,e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(ot,{size:16}),e[3]=a):a=e[3];let u;e[4]!==l?(u=l("commerceOnboarding.companionCard.finishSetup"),e[4]=l,e[5]=u):u=e[5];let p;return e[6]!==t||e[7]!==i||e[8]!==r||e[9]!==u?(p=o.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"border-warning/60 text-warning hover:bg-warning/10 hover:text-warning",disabled:t,onClick:i,"aria-label":r,children:[a,u]}),e[6]=t,e[7]=i,e[8]=r,e[9]=u,e[10]=p):p=e[10],p}function dt(n){const e=G.c(9),{detail:t,controls:s}=n,i=te();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(at,{size:16,className:"text-success"}),e[0]=l):l=e[0];let r;e[1]!==t||e[2]!==i?(r=t?o.jsx("span",{className:"max-w-40 truncate text-foreground",children:t}):i("commerceOnboarding.companionCard.connected"),e[1]=t,e[2]=i,e[3]=r):r=e[3];let a;e[4]!==r?(a=o.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[l," ",r]}),e[4]=r,e[5]=a):a=e[5];let u;return e[6]!==s||e[7]!==a?(u=o.jsxs("div",{className:"flex items-center gap-1",children:[a,s]}),e[6]=s,e[7]=a,e[8]=u):u=e[8],u}function ut(n){const e=G.c(4),{ariaLabel:t,onClick:s}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ot,{size:16}),e[0]=i):i=e[0];let l;return e[1]!==t||e[2]!==s?(l=o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:s,"aria-label":t,children:i}),e[1]=t,e[2]=s,e[3]=l):l=e[3],l}function ke(n){const e=G.c(38);let t,s,i,l,r;e[0]!==n?({value:r,onChange:s,placeholder:i,className:t,...l}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=i,e[4]=l,e[5]=r):(t=e[1],s=e[2],i=e[3],l=e[4],r=e[5]);const[a,u]=H.useState(!1),[p,d]=H.useState(!1);let c;e[6]!==r?(c=async()=>{if(r)try{await navigator.clipboard.writeText(r),d(!0),setTimeout(()=>d(!1),2e3)}catch(N){console.error("Failed to copy text: ",N)}},e[6]=r,e[7]=c):c=e[7];const f=c;let m;e[8]!==a?(m=()=>{u(!a)},e[8]=a,e[9]=m):m=e[9];const y=m,x=a?"text":"password";let h;e[10]!==t?(h=fe("pr-20",t),e[10]=t,e[11]=h):h=e[11];let b;e[12]!==s||e[13]!==i||e[14]!==l||e[15]!==x||e[16]!==h||e[17]!==r?(b=o.jsx(pe,{type:x,value:r,onChange:s,placeholder:i,className:h,...l}),e[12]=s,e[13]=i,e[14]=l,e[15]=x,e[16]=h,e[17]=r,e[18]=b):b=e[18];const g=a?"Hide password":"Show password";let S;e[19]!==a?(S=a?o.jsx(Qt,{size:16}):o.jsx(zt,{size:16}),e[19]=a,e[20]=S):S=e[20];let C;e[21]!==g||e[22]!==S||e[23]!==y?(C=o.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:g,children:S}),e[21]=g,e[22]=S,e[23]=y,e[24]=C):C=e[24];const O=!r,j=p?"Copied!":"Copy token";let _;e[25]!==p?(_=p?o.jsx(Mt,{size:16}):o.jsx(ct,{size:16}),e[25]=p,e[26]=_):_=e[26];let v;e[27]!==f||e[28]!==j||e[29]!==_||e[30]!==O?(v=o.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:f,disabled:O,title:j,children:_}),e[27]=f,e[28]=j,e[29]=_,e[30]=O,e[31]=v):v=e[31];let w;e[32]!==v||e[33]!==C?(w=o.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[C,v]}),e[32]=v,e[33]=C,e[34]=w):w=e[34];let E;return e[35]!==w||e[36]!==b?(E=o.jsxs("div",{className:"relative",children:[b,w]}),e[35]=w,e[36]=b,e[37]=E):E=e[37],E}function Ee(n){const e=G.c(19),{card:t,selfClient:s,org:i,onDone:l,onError:r}=n,a=ye();let u;e[0]!==t||e[1]!==s?(u=async h=>{const{values:b,connectionToken:g}=h,C={configuration_state:{...t.configurationState??{},...b}};g!==void 0&&(C.connection_token=g),await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:C}})},e[0]=t,e[1]=s,e[2]=u):u=e[2];let p;e[3]!==l||e[4]!==i||e[5]!==a?(p=async()=>{await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),l()},e[3]=l,e[4]=i,e[5]=a,e[6]=p):p=e[6];let d;e[7]!==r?(d=h=>{r?.(h)},e[7]=r,e[8]=d):d=e[8];let c;e[9]!==u||e[10]!==p||e[11]!==d?(c={mutationFn:u,onSuccess:p,onError:d},e[9]=u,e[10]=p,e[11]=d,e[12]=c):c=e[12];const f=Te(c);let m;e[13]!==f?(m=(h,b)=>f.mutate({values:h,connectionToken:b?.connectionToken}),e[13]=f,e[14]=m):m=e[14];const y=m;let x;return e[15]!==f.error||e[16]!==f.isPending||e[17]!==y?(x={save:y,isPending:f.isPending,error:f.error},e[15]=f.error,e[16]=f.isPending,e[17]=y,e[18]=x):x=e[18],x}const _n=xe({accountName:ie().min(1,"Informe o nome da conta"),appKey:ie().optional(),appToken:ie().optional()});function Nn(n){const e=G.c(73),{card:t,selfClient:s,org:i,onDone:l,onIsPendingChange:r}=n,a=te();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=Ce(_n),e[0]=u):u=e[0];const p=t.configurationState?.accountName||"",d=t.configurationState?.appKey||"",c=t.configurationState?.appToken||"";let f;e[1]!==p||e[2]!==d||e[3]!==c?(f={resolver:u,defaultValues:{accountName:p,appKey:d,appToken:c}},e[1]=p,e[2]=d,e[3]=c,e[4]=f):f=e[4];const m=Se(f);let y;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==m?(y=()=>{m.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]=m,e[9]=y):y=e[9];let x;e[10]!==t.configurationState||e[11]!==m?(x=[t.configurationState,m],e[10]=t.configurationState,e[11]=m,e[12]=x):x=e[12],H.useEffect(y,x);let h;e[13]!==t||e[14]!==l||e[15]!==i||e[16]!==s?(h={card:t,selfClient:s,org:i,onDone:l},e[13]=t,e[14]=l,e[15]=i,e[16]=s,e[17]=h):h=e[17];const{save:b,isPending:g,error:S}=Ee(h);let C,O;e[18]!==g||e[19]!==r?(O=()=>{r?.(g)},C=[g,r],e[18]=g,e[19]=r,e[20]=C,e[21]=O):(C=e[20],O=e[21]),H.useEffect(O,C);let j;if(e[22]!==m||e[23]!==b){let K;e[25]!==b?(K=async q=>{b(q)},e[25]=b,e[26]=K):K=e[26],j=m.handleSubmit(K),e[22]=m,e[23]=b,e[24]=j}else j=e[24];const _=j;let v;e[27]!==g||e[28]!==a?(v=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.accountNameLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.vtexConfigForm.accountNamePlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[27]=g,e[28]=a,e[29]=v):v=e[29];let w;e[30]!==m.control||e[31]!==v?(w=o.jsx(re,{control:m.control,name:"accountName",render:v}),e[30]=m.control,e[31]=v,e[32]=w):w=e[32];let E;e[33]!==g||e[34]!==a?(E=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.appKeyLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.vtexConfigForm.appKeyPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[33]=g,e[34]=a,e[35]=E):E=e[35];let N;e[36]!==m.control||e[37]!==E?(N=o.jsx(re,{control:m.control,name:"appKey",render:E}),e[36]=m.control,e[37]=E,e[38]=N):N=e[38];let k;e[39]!==g||e[40]!==a?(k=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.appTokenLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.vtexConfigForm.appTokenPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[39]=g,e[40]=a,e[41]=k):k=e[41];let I;e[42]!==m.control||e[43]!==k?(I=o.jsx(re,{control:m.control,name:"appToken",render:k}),e[42]=m.control,e[43]=k,e[44]=I):I=e[44];let F;e[45]!==m||e[46]!==w||e[47]!==N||e[48]!==I?(F=o.jsxs(ve,{...m,children:[w,N,I]}),e[45]=m,e[46]=w,e[47]=N,e[48]=I,e[49]=F):F=e[49];let P;e[50]!==S||e[51]!==a?(P=S&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:a("commerceOnboarding.vtexConfigForm.savingError")}),e[50]=S,e[51]=a,e[52]=P):P=e[52];let T;e[53]!==a?(T=a("commerceOnboarding.vtexConfigForm.cancelButton"),e[53]=a,e[54]=T):T=e[54];let L;e[55]!==g||e[56]!==l||e[57]!==T?(L=o.jsx(Z,{type:"button",variant:"outline",onClick:l,disabled:g,children:T}),e[55]=g,e[56]=l,e[57]=T,e[58]=L):L=e[58];let A;e[59]!==g||e[60]!==a?(A=a(g?"commerceOnboarding.vtexConfigForm.savingButton":"commerceOnboarding.vtexConfigForm.saveButton"),e[59]=g,e[60]=a,e[61]=A):A=e[61];let U;e[62]!==g||e[63]!==A?(U=o.jsx(Z,{type:"submit",disabled:g,children:A}),e[62]=g,e[63]=A,e[64]=U):U=e[64];let B;e[65]!==L||e[66]!==U?(B=o.jsxs(ge,{className:"pt-4",children:[L,U]}),e[65]=L,e[66]=U,e[67]=B):B=e[67];let M;return e[68]!==_||e[69]!==F||e[70]!==P||e[71]!==B?(M=o.jsxs("form",{onSubmit:_,className:"space-y-4",children:[F,P,B]}),e[68]=_,e[69]=F,e[70]=P,e[71]=B,e[72]=M):M=e[72],M}const Tn=(n,e)=>xe({storeDomain:ie().min(1,e("commerceOnboarding.shopifyConfigForm.storeDomainRequired")),accessToken:ie().optional(),apiVersion:ie().optional()}).refine(t=>n||!!t.accessToken?.trim(),{path:["accessToken"],message:e("commerceOnboarding.shopifyConfigForm.accessTokenRequired")});function En(n){const e=G.c(76),{card:t,selfClient:s,org:i,onDone:l,onIsPendingChange:r}=n,a=te();let u;e[0]!==t.configured||e[1]!==a?(u=Ce(Tn(t.configured,a)),e[0]=t.configured,e[1]=a,e[2]=u):u=e[2];const p=t.configurationState?.storeDomain||"",d=t.configurationState?.apiVersion||"";let c;e[3]!==p||e[4]!==d?(c={storeDomain:p,accessToken:"",apiVersion:d},e[3]=p,e[4]=d,e[5]=c):c=e[5];let f;e[6]!==u||e[7]!==c?(f={resolver:u,defaultValues:c},e[6]=u,e[7]=c,e[8]=f):f=e[8];const m=Se(f);let y;e[9]!==t.configurationState?.apiVersion||e[10]!==t.configurationState?.storeDomain||e[11]!==m?(y=()=>{m.reset({storeDomain:t.configurationState?.storeDomain||"",accessToken:"",apiVersion:t.configurationState?.apiVersion||""})},e[9]=t.configurationState?.apiVersion,e[10]=t.configurationState?.storeDomain,e[11]=m,e[12]=y):y=e[12];let x;e[13]!==t.configurationState||e[14]!==m?(x=[t.configurationState,m],e[13]=t.configurationState,e[14]=m,e[15]=x):x=e[15],H.useEffect(y,x);let h;e[16]!==t||e[17]!==l||e[18]!==i||e[19]!==s?(h={card:t,selfClient:s,org:i,onDone:l},e[16]=t,e[17]=l,e[18]=i,e[19]=s,e[20]=h):h=e[20];const{save:b,isPending:g,error:S}=Ee(h);let C,O;e[21]!==g||e[22]!==r?(O=()=>{r?.(g)},C=[g,r],e[21]=g,e[22]=r,e[23]=C,e[24]=O):(C=e[23],O=e[24]),H.useEffect(O,C);let j;if(e[25]!==m||e[26]!==b){let K;e[28]!==b?(K=async q=>{const D=q.apiVersion?.trim(),Q=q.accessToken?.trim();b({storeDomain:q.storeDomain.trim(),...D?{apiVersion:D}:{}},Q?{connectionToken:Q}:void 0)},e[28]=b,e[29]=K):K=e[29],j=m.handleSubmit(K),e[25]=m,e[26]=b,e[27]=j}else j=e[27];const _=j;let v;e[30]!==g||e[31]!==a?(v=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.storeDomainLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.shopifyConfigForm.storeDomainPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[30]=g,e[31]=a,e[32]=v):v=e[32];let w;e[33]!==m.control||e[34]!==v?(w=o.jsx(re,{control:m.control,name:"storeDomain",render:v}),e[33]=m.control,e[34]=v,e[35]=w):w=e[35];let E;e[36]!==g||e[37]!==a?(E=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.accessTokenLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.shopifyConfigForm.accessTokenPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[36]=g,e[37]=a,e[38]=E):E=e[38];let N;e[39]!==m.control||e[40]!==E?(N=o.jsx(re,{control:m.control,name:"accessToken",render:E}),e[39]=m.control,e[40]=E,e[41]=N):N=e[41];let k;e[42]!==g||e[43]!==a?(k=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.apiVersionLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.shopifyConfigForm.apiVersionPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[42]=g,e[43]=a,e[44]=k):k=e[44];let I;e[45]!==m.control||e[46]!==k?(I=o.jsx(re,{control:m.control,name:"apiVersion",render:k}),e[45]=m.control,e[46]=k,e[47]=I):I=e[47];let F;e[48]!==m||e[49]!==w||e[50]!==N||e[51]!==I?(F=o.jsxs(ve,{...m,children:[w,N,I]}),e[48]=m,e[49]=w,e[50]=N,e[51]=I,e[52]=F):F=e[52];let P;e[53]!==S||e[54]!==a?(P=S&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:a("commerceOnboarding.shopifyConfigForm.savingError")}),e[53]=S,e[54]=a,e[55]=P):P=e[55];let T;e[56]!==a?(T=a("commerceOnboarding.shopifyConfigForm.cancelButton"),e[56]=a,e[57]=T):T=e[57];let L;e[58]!==g||e[59]!==l||e[60]!==T?(L=o.jsx(Z,{type:"button",variant:"outline",onClick:l,disabled:g,children:T}),e[58]=g,e[59]=l,e[60]=T,e[61]=L):L=e[61];let A;e[62]!==g||e[63]!==a?(A=a(g?"commerceOnboarding.shopifyConfigForm.savingButton":"commerceOnboarding.shopifyConfigForm.saveButton"),e[62]=g,e[63]=a,e[64]=A):A=e[64];let U;e[65]!==g||e[66]!==A?(U=o.jsx(Z,{type:"submit",disabled:g,children:A}),e[65]=g,e[66]=A,e[67]=U):U=e[67];let B;e[68]!==L||e[69]!==U?(B=o.jsxs(ge,{className:"pt-4",children:[L,U]}),e[68]=L,e[69]=U,e[70]=B):B=e[70];let M;return e[71]!==_||e[72]!==F||e[73]!==P||e[74]!==B?(M=o.jsxs("form",{onSubmit:_,className:"space-y-4",children:[F,P,B]}),e[71]=_,e[72]=F,e[73]=P,e[74]=B,e[75]=M):M=e[75],M}function Pe(n){const e=G.c(31),{options:t,value:s,onChange:i,disabled:l,ariaLabel:r,searchPlaceholder:a,hideSearch:u}=n,p=u===void 0?!1:u,d=te(),[c,f]=H.useState("");let m,y,x;if(e[0]!==t||e[1]!==c||e[2]!==s){const _=c.trim().toLowerCase();m=_?t.filter(v=>v.label.toLowerCase().includes(_)):t,y=m.map(wn),x=y.includes(s)?s:y[0]??"",e[0]=t,e[1]=c,e[2]=s,e[3]=m,e[4]=y,e[5]=x}else m=e[3],y=e[4],x=e[5];const h=x;let b;e[6]!==l||e[7]!==y||e[8]!==i?(b=function(v){if(l||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(v.key))return;v.preventDefault();const E=v.currentTarget.dataset.value,N=y.indexOf(E),k=y.length;if(k===0)return;let I;v.key==="ArrowDown"||v.key==="ArrowRight"?I=(N+1)%k:v.key==="ArrowUp"||v.key==="ArrowLeft"?I=(N-1+k)%k:v.key==="Home"?I=0:I=k-1;const F=y[I];i(F),v.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(F)}"]`)?.focus()},e[6]=l,e[7]=y,e[8]=i,e[9]=b):b=e[9];const g=b;let S;e[10]!==r||e[11]!==l||e[12]!==p||e[13]!==c||e[14]!==a||e[15]!==d?(S=p?null:o.jsxs("div",{className:"relative",children:[o.jsx(st,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),o.jsx(pe,{type:"text",value:c,onChange:_=>f(_.target.value),disabled:l,placeholder:a??d("commerceOnboarding.selectableList.searchPlaceholder"),"aria-label":d("commerceOnboarding.selectableList.searchAriaLabel",{label:r}),className:"h-8 pl-8"})]}),e[10]=r,e[11]=l,e[12]=p,e[13]=c,e[14]=a,e[15]=d,e[16]=S):S=e[16];let C;e[17]!==l||e[18]!==m||e[19]!==g||e[20]!==i||e[21]!==d||e[22]!==h||e[23]!==s?(C=m.length===0?o.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:d("commerceOnboarding.selectableList.noResults")}):m.map(_=>{const v=_.value===s;return o.jsxs("button",{type:"button",role:"radio","aria-checked":v,disabled:l,"data-value":_.value,tabIndex:_.value===h?0:-1,onClick:()=>i(_.value),onKeyDown:g,className:fe("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",v?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[o.jsx("span",{className:"truncate",children:_.label}),v?o.jsx(at,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[17]=l,e[18]=m,e[19]=g,e[20]=i,e[21]=d,e[22]=h,e[23]=s,e[24]=C):C=e[24];let O;e[25]!==r||e[26]!==C?(O=o.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:C}),e[25]=r,e[26]=C,e[27]=O):O=e[27];let j;return e[28]!==S||e[29]!==O?(j=o.jsxs("div",{className:"space-y-2",children:[S,O]}),e[28]=S,e[29]=O,e[30]=j):j=e[30],j}function wn(n){return n.value}function Be(n){const e=G.c(18),{label:t,iconSize:s,className:i,iconClassName:l,labelClassName:r}=n,a=s===void 0?14:s;let u;e[0]!==i?(u=fe("inline-flex items-center gap-2",i),e[0]=i,e[1]=u):u=e[1];let p;e[2]!==l?(p=fe("shrink-0",l),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==a?(d={width:a,height:a},e[4]=a,e[5]=d):d=e[5];let c;e[6]!==p||e[7]!==d?(c=o.jsx(Re,{className:p,style:d}),e[6]=p,e[7]=d,e[8]=c):c=e[8];let f;e[9]!==r?(f=fe("text-sm",r),e[9]=r,e[10]=f):f=e[10];let m;e[11]!==t||e[12]!==f?(m=o.jsx("span",{className:f,children:t}),e[11]=t,e[12]=f,e[13]=m):m=e[13];let y;return e[14]!==u||e[15]!==c||e[16]!==m?(y=o.jsxs("span",{className:u,children:[c,m]}),e[14]=u,e[15]=c,e[16]=m,e[17]=y):y=e[17],y}const In=xe({propertyId:ie().min(1,"Selecione uma propriedade")});function kn(n){const e=G.c(68),{card:t,connectionId:s,companionClient:i,selfClient:l,org:r,onDone:a,onDisconnect:u,onIsPendingChange:p}=n;let d;e[0]!==s||e[1]!==r.id?(d=J.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=d):d=e[2];let c;e[3]!==i?(c=async()=>{const D=await i.callTool({name:"get-account-summaries",arguments:{}}),Q=ee(D);return vn(Q)},e[3]=i,e[4]=c):c=e[4];let f;e[5]!==d||e[6]!==c?(f={queryKey:d,queryFn:c},e[5]=d,e[6]=c,e[7]=f):f=e[7];const m=be(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Ce(In),e[8]=y):y=e[8];const x=t.configurationState?.propertyId||"";let h;e[9]!==x?(h={resolver:y,defaultValues:{propertyId:x}},e[9]=x,e[10]=h):h=e[10];const b=Se(h);let g;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==l?(g={card:t,selfClient:l,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=l,e[15]=g):g=e[15];const{save:S,isPending:C,error:O}=Ee(g);let j,_;e[16]!==C||e[17]!==p?(j=()=>{p?.(C)},_=[C,p],e[16]=C,e[17]=p,e[18]=j,e[19]=_):(j=e[18],_=e[19]),H.useEffect(j,_);let v;if(e[20]!==b||e[21]!==S){let D;e[23]!==S?(D=async Q=>{S(Q)},e[23]=S,e[24]=D):D=e[24],v=b.handleSubmit(D),e[20]=b,e[21]=S,e[22]=v}else v=e[22];const w=v;if(m.isLoading){let D;return e[25]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:o.jsx(Be,{label:"Carregando propriedades..."})}),e[25]=D):D=e[25],D}if(m.isError){let D;return e[26]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=D):D=e[26],D}let E;e[27]!==m.data?(E=m.data||[],e[27]=m.data,e[28]=E):E=e[28];const N=E;if(N.flatMap(Fn).length===0){let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=o.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]=D):D=e[29];let Q;e[30]!==u?(Q=u?o.jsx("button",{type:"button",onClick:u,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):o.jsx("span",{}),e[30]=u,e[31]=Q):Q=e[31];let $;e[32]!==a?($=o.jsx(Z,{type:"button",variant:"outline",onClick:a,children:"Fechar"}),e[32]=a,e[33]=$):$=e[33];let Y;return e[34]!==Q||e[35]!==$?(Y=o.jsxs("div",{className:"space-y-4",children:[D,o.jsxs(ge,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[Q,$]})]}),e[34]=Q,e[35]=$,e[36]=Y):Y=e[36],Y}let I;e[37]!==C||e[38]!==N?(I=D=>{const{field:Q}=D;return o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:N.flatMap(Rn),value:Q.value,onChange:Q.onChange,disabled:C,ariaLabel:"Propriedade do Google Analytics"})}),o.jsx(le,{})]})},e[37]=C,e[38]=N,e[39]=I):I=e[39];let F;e[40]!==b.control||e[41]!==I?(F=o.jsx(re,{control:b.control,name:"propertyId",render:I}),e[40]=b.control,e[41]=I,e[42]=F):F=e[42];let P;e[43]!==b||e[44]!==F?(P=o.jsx(ve,{...b,children:F}),e[43]=b,e[44]=F,e[45]=P):P=e[45];let T;e[46]!==O?(T=O&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:O instanceof Error?O.message:"Não foi possível salvar a configuração"}),e[46]=O,e[47]=T):T=e[47];let L;e[48]!==C||e[49]!==u?(L=u?o.jsx("button",{type:"button",onClick:u,disabled:C,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):o.jsx("span",{}),e[48]=C,e[49]=u,e[50]=L):L=e[50];let A;e[51]!==C||e[52]!==a?(A=o.jsx(Z,{type:"button",variant:"outline",onClick:a,disabled:C,children:"Cancelar"}),e[51]=C,e[52]=a,e[53]=A):A=e[53];const U=C?"Salvando...":"Salvar";let B;e[54]!==C||e[55]!==U?(B=o.jsx(Z,{type:"submit",disabled:C,children:U}),e[54]=C,e[55]=U,e[56]=B):B=e[56];let M;e[57]!==A||e[58]!==B?(M=o.jsxs("div",{className:"flex gap-2",children:[A,B]}),e[57]=A,e[58]=B,e[59]=M):M=e[59];let K;e[60]!==L||e[61]!==M?(K=o.jsxs(ge,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[L,M]}),e[60]=L,e[61]=M,e[62]=K):K=e[62];let q;return e[63]!==w||e[64]!==P||e[65]!==T||e[66]!==K?(q=o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[P,T,K]}),e[63]=w,e[64]=P,e[65]=T,e[66]=K,e[67]=q):q=e[67],q}function Rn(n){return n.options}function Fn(n){return n.options}const Ln=n=>xe({siteUrl:ie().min(1,n("commerceOnboarding.googleSearchConsoleConfigForm.siteRequired"))});function Kn(n){const e=G.c(83),{card:t,connectionId:s,companionClient:i,selfClient:l,org:r,contextSiteUrl:a,onDone:u,onIsPendingChange:p}=n,d=te();let c;e[0]!==s||e[1]!==r.id?(c=J.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=c):c=e[2];let f;e[3]!==i?(f=async()=>{const R=await i.callTool({name:"list_sites",arguments:{}});return ee(R).sites||[]},e[3]=i,e[4]=f):f=e[4];let m;e[5]!==c||e[6]!==f?(m={queryKey:c,queryFn:f},e[5]=c,e[6]=f,e[7]=m):m=e[7];const y=be(m);let x;e[8]!==d?(x=Ce(Ln(d)),e[8]=d,e[9]=x):x=e[9];const h=t.configurationState?.siteUrl||"";let b;e[10]!==h?(b={siteUrl:h},e[10]=h,e[11]=b):b=e[11];let g;e[12]!==x||e[13]!==b?(g={resolver:x,defaultValues:b},e[12]=x,e[13]=b,e[14]=g):g=e[14];const S=Se(g);let C;e[15]!==t||e[16]!==u||e[17]!==r||e[18]!==l?(C={card:t,selfClient:l,org:r,onDone:u},e[15]=t,e[16]=u,e[17]=r,e[18]=l,e[19]=C):C=e[19];const{save:O,isPending:j,error:_}=Ee(C),v=H.useRef(!1),w=t.configurationState?.siteUrl;let E,N;e[20]!==j||e[21]!==p?(N=()=>{p?.(j)},E=[j,p],e[20]=j,e[21]=p,e[22]=E,e[23]=N):(E=e[22],N=e[23]),H.useEffect(N,E);let k,I;e[24]!==a||e[25]!==S||e[26]!==w||e[27]!==y.data||e[28]!==y.isSuccess?(k=()=>{if(!(v.current||!y.isSuccess)){if(v.current=!0,w){S.getValues("siteUrl")!==w&&S.setValue("siteUrl",w);return}if(!S.getValues("siteUrl")){const R=Sn(a,y.data??[]);R&&S.setValue("siteUrl",R)}}},I=[y.isSuccess,y.data,w,a,S],e[24]=a,e[25]=S,e[26]=w,e[27]=y.data,e[28]=y.isSuccess,e[29]=k,e[30]=I):(k=e[29],I=e[30]),H.useEffect(k,I);let F;if(e[31]!==S||e[32]!==O){let R;e[34]!==O?(R=async z=>{O(z)},e[34]=O,e[35]=R):R=e[35],F=S.handleSubmit(R),e[31]=S,e[32]=O,e[33]=F}else F=e[33];const P=F;if(y.isLoading){let R;e[36]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.loadingSites"),e[36]=d,e[37]=R):R=e[37];let z;return e[38]!==R?(z=o.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:o.jsx(Be,{label:R})}),e[38]=R,e[39]=z):z=e[39],z}if(y.isError){let R;e[40]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.loadSitesError"),e[40]=d,e[41]=R):R=e[41];let z;return e[42]!==R?(z=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-destructive",children:R})}),e[42]=R,e[43]=z):z=e[43],z}let T;e[44]!==y.data?(T=y.data||[],e[44]=y.data,e[45]=T):T=e[45];const L=T;if(L.length===0){let R;e[46]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.noSitesFound"),e[46]=d,e[47]=R):R=e[47];let z;return e[48]!==R?(z=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:R})}),e[48]=R,e[49]=z):z=e[49],z}let A;e[50]!==j||e[51]!==L||e[52]!==d?(A=R=>{const{field:z}=R;return o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:L.map(An),value:z.value,onChange:z.onChange,disabled:j,ariaLabel:d("commerceOnboarding.googleSearchConsoleConfigForm.siteAriaLabel")})}),o.jsx(le,{})]})},e[50]=j,e[51]=L,e[52]=d,e[53]=A):A=e[53];let U;e[54]!==S.control||e[55]!==A?(U=o.jsx(re,{control:S.control,name:"siteUrl",render:A}),e[54]=S.control,e[55]=A,e[56]=U):U=e[56];let B;e[57]!==S||e[58]!==U?(B=o.jsx(ve,{...S,children:U}),e[57]=S,e[58]=U,e[59]=B):B=e[59];let M;e[60]!==_||e[61]!==d?(M=_&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:d("commerceOnboarding.googleSearchConsoleConfigForm.savingError")}),e[60]=_,e[61]=d,e[62]=M):M=e[62];let K;e[63]!==d?(K=d("commerceOnboarding.googleSearchConsoleConfigForm.cancelButton"),e[63]=d,e[64]=K):K=e[64];let q;e[65]!==j||e[66]!==u||e[67]!==K?(q=o.jsx(Z,{type:"button",variant:"outline",onClick:u,disabled:j,children:K}),e[65]=j,e[66]=u,e[67]=K,e[68]=q):q=e[68];let D;e[69]!==j||e[70]!==d?(D=d(j?"commerceOnboarding.googleSearchConsoleConfigForm.savingButton":"commerceOnboarding.googleSearchConsoleConfigForm.saveButton"),e[69]=j,e[70]=d,e[71]=D):D=e[71];let Q;e[72]!==j||e[73]!==D?(Q=o.jsx(Z,{type:"submit",disabled:j,children:D}),e[72]=j,e[73]=D,e[74]=Q):Q=e[74];let $;e[75]!==q||e[76]!==Q?($=o.jsxs(ge,{className:"pt-4",children:[q,Q]}),e[75]=q,e[76]=Q,e[77]=$):$=e[77];let Y;return e[78]!==P||e[79]!==B||e[80]!==M||e[81]!==$?(Y=o.jsxs("form",{onSubmit:P,className:"space-y-4",children:[B,M,$]}),e[78]=P,e[79]=B,e[80]=M,e[81]=$,e[82]=Y):Y=e[82],Y}function An(n){return{value:n.siteUrl,label:n.siteUrl}}function Dn(n){const[e,t]=n.split("/");return!e||!t?null:{owner:e,name:t}}function Pn(n){const{existingRepo:e,owner:t,name:s}=n;return e?.connectionId&&e.owner.toLowerCase()===t.toLowerCase()&&e.name.toLowerCase()===s.toLowerCase()?{connectionId:e.connectionId,installationId:e.installationId}:null}function Bn(n){const{existingRepo:e,existingConnections:t,repoConnectionId:s}=n,i=e?.connectionId&&e.connectionId!==s?e.connectionId:void 0,l=[...t.filter(r=>r.connection_id!==s&&r.connection_id!==i),{connection_id:s,selected_tools:[]}];return{staleConnectionId:i,mergedConnections:l}}const qn=xe({githubRepo:ie().min(1,"commerceOnboarding.githubConfigForm.selectRepository")}),Un=15e3,$n=/^[\w.-]+\/[\w.-]+$/;async function Mn(n,e,t,s){const{installations:i}=await it(n,t),l=s.trim(),r=await Promise.allSettled(i.map(async d=>{const c=d.type==="User"?"user":"org",f=l?`${c}:${d.login} ${l} in:name`:`${c}:${d.login}`,y=await e.callTool({name:"search_repositories",arguments:{query:f,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Un)}),x=y.content?.[0]?.text;if(y.isError)throw new Error(x??"search_repositories failed");if(!x)throw new Error("empty search_repositories response");return JSON.parse(x).items??[]})),a=new Map;let u=0;for(const d of r){if(d.status==="rejected"){u+=1;continue}for(const c of d.value)c.full_name&&!a.has(c.full_name)&&a.set(c.full_name,c)}return{repos:Array.from(a.values()).sort((d,c)=>(c.updated_at??"").localeCompare(d.updated_at??"")).map(d=>d.full_name),failed:u,total:i.length}}function Qn({connectionId:n,companionClient:e,selfClient:t,org:s,onDone:i,onIsPendingChange:l}){const r=te(),a=ye(),u=Je.COMMERCE_DISCOVERY(s.id),[p,d]=H.useState(""),c=Vt(p,300),f=H.useRef(!1),m=be({queryKey:J.commerceDiscoveryCompanionGithubSelected(s.id,n),queryFn:async()=>{const N=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:u}}),k=ee(N).item?.configuration_state??null;return typeof k?.github_repo=="string"?k.github_repo:""}}),y=be({queryKey:J.commerceDiscoveryCompanionGithubRepos(s.id,n,c.trim()),queryFn:()=>Mn(N=>t.callTool(N),e,n,c)}),x=Se({resolver:Ce(qn),defaultValues:{githubRepo:""}}),h=Te({mutationFn:async N=>{const k=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:u}}),F={...ee(k).item?.configuration_state??null??{},github_repo:N};await t.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:u,data:{configuration_state:F}}});const P=Dn(N);if(!P)throw new Error(r("commerceOnboarding.githubConfigForm.invalidRepository",{repo:N}));const{owner:T,name:L}=P,A=kt(s.id),U=ee(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:A}})).item,B=U?.metadata?.githubRepo,M=U?.connections??[],K=Pn({existingRepo:B,owner:T,name:L});let q=K?.connectionId,D=K?.installationId,Q;if(!q){const{installations:R}=await it(X=>t.callTool(X),n),z=Bt(R,T);if(!z)throw new Error(r("commerceOnboarding.githubConfigForm.noGithubInstallation",{owner:T}));D=z.installationId;const ne=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}})).item;if(!ne)throw new Error(r("commerceOnboarding.githubConfigForm.githubConnectionNotFound"));const{childConnectionId:oe,reused:W}=await qt({orgSlug:s.slug,sourceConnection:ne,installationId:D,owner:T,repo:L,githubCallTool:X=>e.callTool(X),selfCallTool:X=>t.callTool(X)});q=oe,Q=W?void 0:oe}const{staleConnectionId:$,mergedConnections:Y}=Bn({existingRepo:B,existingConnections:M,repoConnectionId:q});try{if(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:A,data:{connections:Y,metadata:{githubRepo:{owner:T,name:L,url:`https://github.com/${N}`,installationId:D,connectionId:q}}}}}),$){const R=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:$}})).item;R&&!Ut(R)&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:$,force:!0}}).catch(()=>{})}}catch(R){throw Q&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:Q,force:!0}}).catch(()=>{}),R}},onSuccess:async()=>{await a.invalidateQueries({queryKey:J.commerceDiscoveryConnection(s.id,u)}),await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),Nt(a,s.id),i()}}),b=h.isPending;H.useEffect(()=>{l?.(b)},[b,l]);const g=m.data??"";H.useEffect(()=>{!m.isSuccess||f.current||(f.current=!0,m.data&&x.setValue("githubRepo",m.data))},[m.isSuccess,m.data,x]);const S=x.handleSubmit(async N=>{h.mutate(N.githubRepo)}),C=y.data?.repos??[],O=y.data?.failed??0,j=y.data?.total??0,_=c.trim(),v=[...C];_&&$n.test(_)&&!v.includes(_)&&v.unshift(_),g&&!v.includes(g)&&v.push(g);const w=j>0&&O===j,E=y.isError||w?r("commerceOnboarding.githubConfigForm.searchFailedTotal"):O>0?r("commerceOnboarding.githubConfigForm.searchFailedPartial"):null;return o.jsxs("form",{onSubmit:S,className:"space-y-4",children:[o.jsxs("div",{className:"relative",children:[o.jsx(st,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),o.jsx(pe,{type:"text",value:p,onChange:N=>d(N.target.value),disabled:b,placeholder:r("commerceOnboarding.githubConfigForm.searchRepositoryPlaceholder"),"aria-label":r("commerceOnboarding.githubConfigForm.searchRepositoryLabel"),className:"h-8 pl-8"})]}),y.isLoading?o.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:o.jsx(Be,{label:r("commerceOnboarding.githubConfigForm.loadingRepositories")})}):o.jsxs(o.Fragment,{children:[E&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E}),v.length===0?!E&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r("commerceOnboarding.githubConfigForm.noRepositoriesFound")}):o.jsx(ve,{...x,children:o.jsx(re,{control:x.control,name:"githubRepo",render:({field:N})=>o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:v.map(k=>({value:k,label:k})),value:N.value,onChange:N.onChange,disabled:b,ariaLabel:"Repositório",hideSearch:!0})}),o.jsx(le,{})]})})})]}),h.error&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:h.error instanceof Error?h.error.message:r("commerceOnboarding.githubConfigForm.failedToSave")}),o.jsxs(ge,{className:"pt-4",children:[o.jsx(Z,{type:"button",variant:"outline",onClick:i,disabled:b,children:r("commerceOnboarding.githubConfigForm.cancel")}),o.jsx(Z,{type:"submit",disabled:b,children:r(b?"commerceOnboarding.githubConfigForm.saving":"commerceOnboarding.githubConfigForm.save")})]})]})}const mt={vtex:Nn,shopify:En,"google-analytics":kn,"google-search-console":Kn,github:Qn},we="deco-reader@decocms.iam.gserviceaccount.com",ft={"google-analytics":"ga4","google-search-console":"gsc"},zn={ga4:{label:"Google Analytics",consoleUrl:"https://analytics.google.com/analytics/web/#/admin",consoleLinkKey:"commerceOnboarding.saBinding.ga4.openConsole",steps:["commerceOnboarding.saBinding.ga4.step1","commerceOnboarding.saBinding.ga4.step2","commerceOnboarding.saBinding.ga4.step3"],resourceLabelKey:"commerceOnboarding.saBinding.ga4.resourceLabel",resourcePlaceholderKey:"commerceOnboarding.saBinding.ga4.resourcePlaceholder",resourceHintKey:"commerceOnboarding.saBinding.ga4.resourceHint"},gsc:{label:"Google Search Console",consoleUrl:"https://search.google.com/search-console",consoleLinkKey:"commerceOnboarding.saBinding.gsc.openConsole",steps:["commerceOnboarding.saBinding.gsc.step1","commerceOnboarding.saBinding.gsc.step2","commerceOnboarding.saBinding.gsc.step3"],resourceLabelKey:"commerceOnboarding.saBinding.gsc.resourceLabel",resourcePlaceholderKey:"commerceOnboarding.saBinding.gsc.resourcePlaceholder",resourceHintKey:"commerceOnboarding.saBinding.gsc.resourceHint"}};function Vn(n,e){switch(e){case"no-access":return{titleKey:"commerceOnboarding.saBinding.remediation.noAccess.title",stepKeys:n==="ga4"?["commerceOnboarding.saBinding.remediation.noAccess.ga4.1","commerceOnboarding.saBinding.remediation.noAccess.ga4.2","commerceOnboarding.saBinding.remediation.noAccess.ga4.3"]:["commerceOnboarding.saBinding.remediation.noAccess.gsc.1","commerceOnboarding.saBinding.remediation.noAccess.gsc.2","commerceOnboarding.saBinding.remediation.noAccess.gsc.3"]};case"no-web-stream":return{titleKey:"commerceOnboarding.saBinding.remediation.noWebStream.title",stepKeys:["commerceOnboarding.saBinding.remediation.noWebStream.1","commerceOnboarding.saBinding.remediation.noWebStream.2","commerceOnboarding.saBinding.remediation.noWebStream.3","commerceOnboarding.saBinding.remediation.noWebStream.4"]};case"no-match":return{titleKey:"commerceOnboarding.saBinding.remediation.noMatch.title",stepKeys:n==="ga4"?["commerceOnboarding.saBinding.remediation.noMatch.ga4.1","commerceOnboarding.saBinding.remediation.noMatch.ga4.2"]:["commerceOnboarding.saBinding.remediation.noMatch.gsc.1","commerceOnboarding.saBinding.remediation.noMatch.gsc.2"]};case"resource_already_bound":return{titleKey:"commerceOnboarding.saBinding.remediation.alreadyBound.title",stepKeys:["commerceOnboarding.saBinding.remediation.alreadyBound.1","commerceOnboarding.saBinding.remediation.alreadyBound.2"]};default:return{titleKey:"commerceOnboarding.saBinding.remediation.unknown.title",stepKeys:["commerceOnboarding.saBinding.remediation.unknown.1","commerceOnboarding.saBinding.remediation.unknown.2"]}}}function Hn(n){const e=G.c(96),{provider:t,siteUrl:s,siteHost:i,selfClient:l,org:r,initialResourceId:a,onDone:u,onIsPendingChange:p,onOAuthInstead:d}=n,c=te(),f=zn[t],m=ye(),[y,x]=H.useState(null);let h;e[0]!==i||e[1]!==c?(h=i||c("commerceOnboarding.saBinding.sampleDomain"),e[0]=i,e[1]=c,e[2]=h):h=e[2];const b=h;let g,S;if(e[3]!==f.resourceLabelKey||e[4]!==c){const W=xe({resourceId:ie().trim().min(1,c("commerceOnboarding.saBindingForm.resourceIdRequired",{resourceLabel:c(f.resourceLabelKey).toLowerCase()}))});S=Se,g=Ce(W),e[3]=f.resourceLabelKey,e[4]=c,e[5]=g,e[6]=S}else g=e[5],S=e[6];const C=a??"";let O;e[7]!==C?(O={resourceId:C},e[7]=C,e[8]=O):O=e[8];let j;e[9]!==g||e[10]!==O?(j={resolver:g,defaultValues:O},e[9]=g,e[10]=O,e[11]=j):j=e[11];const _=S(j);let v;e[12]!==t||e[13]!==l||e[14]!==s||e[15]!==c?(v=async W=>{if(!s)throw new Error(c("commerceOnboarding.saBindingForm.storeUrlUnavailable"));const X=await l.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:s,provider:t,resourceId:W.resourceId}});return ee(X)},e[12]=t,e[13]=l,e[14]=s,e[15]=c,e[16]=v):v=e[16];let w,E;e[17]!==p?(w=()=>p?.(!0),E=()=>p?.(!1),e[17]=p,e[18]=w,e[19]=E):(w=e[18],E=e[19]);let N;e[20]!==f.label||e[21]!==u||e[22]!==r||e[23]!==t||e[24]!==m||e[25]!==s||e[26]!==c?(N=async W=>{if(W.ok){x(null),_e.success(c("commerceOnboarding.saBindingForm.connectedSuccess",{label:f.label})),s&&await m.invalidateQueries({queryKey:J.commerceDiscoveryConnectionStatus(r.id,s)}),u();return}x({...Vn(t,W.reason??"unknown"),detail:W.detail})},e[20]=f.label,e[21]=u,e[22]=r,e[23]=t,e[24]=m,e[25]=s,e[26]=c,e[27]=N):N=e[27];let k;e[28]!==N||e[29]!==v||e[30]!==w||e[31]!==E?(k={mutationFn:v,onMutate:w,onSettled:E,onSuccess:N},e[28]=N,e[29]=v,e[30]=w,e[31]=E,e[32]=k):k=e[32];const I=Te(k);let F;if(e[33]!==_||e[34]!==I){let W;e[36]!==I?(W=X=>I.mutate(X),e[36]=I,e[37]=W):W=e[37],F=_.handleSubmit(W),e[33]=_,e[34]=I,e[35]=F}else F=e[35];const P=F,T=I.isPending;let L;e[38]!==c?(L=()=>{navigator.clipboard?.writeText(we),_e.success(c("commerceOnboarding.saBindingForm.emailCopied"))},e[38]=c,e[39]=L):L=e[39];const A=L;let U;e[40]!==f.consoleLinkKey||e[41]!==f.consoleUrl||e[42]!==f.resourceHintKey||e[43]!==f.resourceLabelKey||e[44]!==f.resourcePlaceholderKey||e[45]!==A||e[46]!==_||e[47]!==b||e[48]!==T||e[49]!==c?(U=W=>W===0?o.jsxs("a",{href:f.consoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground underline underline-offset-2 hover:text-foreground",children:[o.jsx(Ht,{size:14}),c(f.consoleLinkKey)]}):W===1?o.jsxs("div",{className:"flex w-full items-center gap-2 rounded-lg border border-input bg-muted/40 p-2",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:we}),o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",onClick:A,"aria-label":c("commerceOnboarding.saBindingForm.copyEmailLabel"),children:o.jsx(ct,{size:16})})]}):o.jsx(ve,{..._,children:o.jsx(re,{control:_.control,name:"resourceId",render:X=>{const{field:de}=X;return o.jsxs(ae,{className:"w-full",children:[o.jsx(ce,{children:o.jsx(pe,{...de,placeholder:c(f.resourcePlaceholderKey,{host:b}),disabled:T,autoComplete:"off","aria-label":c(f.resourceLabelKey)})}),o.jsx($t,{children:c(f.resourceHintKey,{host:b})}),o.jsx(le,{})]})}})}),e[40]=f.consoleLinkKey,e[41]=f.consoleUrl,e[42]=f.resourceHintKey,e[43]=f.resourceLabelKey,e[44]=f.resourcePlaceholderKey,e[45]=A,e[46]=_,e[47]=b,e[48]=T,e[49]=c,e[50]=U):U=e[50];const B=U;let M;if(e[51]!==B||e[52]!==f.steps||e[53]!==b||e[54]!==c){let W;e[56]!==B||e[57]!==b||e[58]!==c?(W=(X,de)=>o.jsxs("li",{className:"flex gap-3 rounded-lg border border-border p-4",children:[o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-medium text-foreground",children:de+1}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2",children:[o.jsx("p",{className:"text-sm leading-5 text-foreground",children:c(X,{host:b})}),B(de)]})]},X),e[56]=B,e[57]=b,e[58]=c,e[59]=W):W=e[59],M=f.steps.map(W),e[51]=B,e[52]=f.steps,e[53]=b,e[54]=c,e[55]=M}else M=e[55];let K;e[60]!==M?(K=o.jsx("ol",{className:"space-y-2",children:M}),e[60]=M,e[61]=K):K=e[61];let q;e[62]!==f.label||e[63]!==y||e[64]!==c?(q=y&&o.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:c(y.titleKey,{label:f.label})}),o.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:y.stepKeys.map(W=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{"aria-hidden":!0,children:"•"}),o.jsx("span",{children:c(W,{email:we})})]},W))})]}),e[62]=f.label,e[63]=y,e[64]=c,e[65]=q):q=e[65];let D;e[66]!==I.error||e[67]!==I.isError||e[68]!==c?(D=I.isError&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I.error instanceof Error?I.error.message:c("commerceOnboarding.saBindingForm.bindError")}),e[66]=I.error,e[67]=I.isError,e[68]=c,e[69]=D):D=e[69];let Q;e[70]!==T||e[71]!==d||e[72]!==c?(Q=d&&o.jsxs("p",{className:"text-sm leading-5 text-muted-foreground",children:[c("commerceOnboarding.saBinding.oauthNote")," ",o.jsx("button",{type:"button",onClick:d,disabled:T,className:"underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:c("commerceOnboarding.saBindingForm.googleLoginAlternative")})]}),e[70]=T,e[71]=d,e[72]=c,e[73]=Q):Q=e[73];let $;e[74]!==c?($=c("commerceOnboarding.saBindingForm.cancel"),e[74]=c,e[75]=$):$=e[75];let Y;e[76]!==T||e[77]!==u||e[78]!==$?(Y=o.jsx(Z,{type:"button",variant:"outline",onClick:u,disabled:T,children:$}),e[76]=T,e[77]=u,e[78]=$,e[79]=Y):Y=e[79];let R;e[80]!==T||e[81]!==c?(R=c(T?"commerceOnboarding.saBindingForm.verifying":"commerceOnboarding.saBindingForm.bind"),e[80]=T,e[81]=c,e[82]=R):R=e[82];let z;e[83]!==T||e[84]!==R?(z=o.jsx(Z,{type:"submit",disabled:T,children:R}),e[83]=T,e[84]=R,e[85]=z):z=e[85];let ne;e[86]!==Y||e[87]!==z?(ne=o.jsxs(ge,{className:"gap-2",children:[Y,z]}),e[86]=Y,e[87]=z,e[88]=ne):ne=e[88];let oe;return e[89]!==P||e[90]!==K||e[91]!==q||e[92]!==D||e[93]!==Q||e[94]!==ne?(oe=o.jsxs("form",{onSubmit:P,className:"space-y-5",children:[K,q,D,Q,ne]}),e[89]=P,e[90]=K,e[91]=q,e[92]=D,e[93]=Q,e[94]=ne,e[95]=oe):oe=e[95],oe}function Gn(){const n=G.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0];let t;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t=o.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,o.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[o.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),o.jsx("div",{className:"hidden h-3 w-full animate-pulse rounded bg-muted/60 sm:block"})]}),o.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),n[1]=t):t=n[1],t}function Ge(n){const e=G.c(17),{title:t,disconnecting:s,disabled:i,onDisconnect:l}=n,r=te(),a=i||s;let u;e[0]!==r||e[1]!==t?(u=r("commerceOnboarding.companionCard.disconnectAriaLabel",{title:t}),e[0]=r,e[1]=t,e[2]=u):u=e[2];let p;e[3]!==s?(p=s?o.jsx(Re,{className:"size-4"}):o.jsx(Lt,{size:16}),e[3]=s,e[4]=p):p=e[4];let d;e[5]!==l||e[6]!==a||e[7]!==u||e[8]!==p?(d=o.jsx(Le,{asChild:!0,children:o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:a,onClick:l,"aria-label":u,children:p})}),e[5]=l,e[6]=a,e[7]=u,e[8]=p,e[9]=d):d=e[9];let c;e[10]!==r?(c=r("commerceOnboarding.companionCard.disconnect"),e[10]=r,e[11]=c):c=e[11];let f;e[12]!==c?(f=o.jsx(Ke,{children:c}),e[12]=c,e[13]=f):f=e[13];let m;return e[14]!==d||e[15]!==f?(m=o.jsxs(Fe,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16],m}function Wn(n){const e=G.c(23),{card:t,connecting:s,disconnecting:i,disabled:l,onConnect:r,onDisconnect:a,org:u,selfClient:p,siteUrl:d,autoOpenConfigFieldKey:c,onAutoOpenConfigHandled:f}=n,m=t.linkedConnectionId,y=ft[t.bindingType],x=!!y&&t.boundVia!=="oauth",h=t.satisfied&&!t.configured;let b;e[0]!==c||e[1]!==t||e[2]!==s||e[3]!==l||e[4]!==i||e[5]!==m||e[6]!==h||e[7]!==f||e[8]!==r||e[9]!==a||e[10]!==u||e[11]!==y||e[12]!==p||e[13]!==d||e[14]!==x?(b=x&&y?o.jsx(Yn,{card:t,provider:y,org:u,selfClient:p,siteUrl:d,onOAuthInstead:r,disabled:l,connecting:s,primary:t.required}):t.satisfied&&m?h?o.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[o.jsx(H.Suspense,{fallback:o.jsx(We,{}),children:o.jsx(Ye,{card:t,org:u,selfClient:p,connectionId:m,contextSiteUrl:d,variant:"configure",disabled:l,autoOpen:He({autoOpenFieldKey:c,card:t}),onAutoOpenHandled:f})}),o.jsx(Ge,{title:t.title,disconnecting:i,disabled:l,onDisconnect:a})]}):o.jsx(dt,{detail:t.connectedDetail,controls:o.jsxs(o.Fragment,{children:[o.jsx(H.Suspense,{fallback:o.jsx(We,{}),children:o.jsx(Ye,{card:t,org:u,selfClient:p,connectionId:m,contextSiteUrl:d,variant:"gear",disabled:l,autoOpen:He({autoOpenFieldKey:c,card:t}),onAutoOpenHandled:f})}),o.jsx(Ge,{title:t.title,disconnecting:i,disabled:l,onDisconnect:a})]})}):o.jsx(lt,{connecting:s,disabled:l,title:t.title,primary:t.required,onConnect:r}),e[0]=c,e[1]=t,e[2]=s,e[3]=l,e[4]=i,e[5]=m,e[6]=h,e[7]=f,e[8]=r,e[9]=a,e[10]=u,e[11]=y,e[12]=p,e[13]=d,e[14]=x,e[15]=b):b=e[15];const g=b,S=t.required&&!t.satisfied;let C;return e[16]!==g||e[17]!==t.headline||e[18]!==t.icon||e[19]!==t.title||e[20]!==h||e[21]!==S?(C=o.jsx(o.Fragment,{children:o.jsx(On,{icon:t.icon,title:t.title,headline:t.headline,required:S,attention:h,action:g})}),e[16]=g,e[17]=t.headline,e[18]=t.icon,e[19]=t.title,e[20]=h,e[21]=S,e[22]=C):C=e[22],C}function Yn(n){const e=G.c(22),{card:t,provider:s,org:i,selfClient:l,siteUrl:r,onOAuthInstead:a,disabled:u,connecting:p,primary:d}=n,c=te(),[f,m]=H.useState(!1);let y;e[0]!==t.connectedDetail||e[1]!==t.satisfied||e[2]!==t.title||e[3]!==p||e[4]!==u||e[5]!==d||e[6]!==c?(y=t.satisfied?o.jsx(dt,{detail:t.connectedDetail,controls:o.jsxs(Fe,{children:[o.jsx(Le,{asChild:!0,children:o.jsx(ut,{ariaLabel:c("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>m(!0)})}),o.jsx(Ke,{children:c("commerceOnboarding.companionCard.editConfiguration")})]})}):o.jsx(lt,{connecting:p,disabled:u,title:t.title,primary:d,onConnect:()=>m(!0)}),e[0]=t.connectedDetail,e[1]=t.satisfied,e[2]=t.title,e[3]=p,e[4]=u,e[5]=d,e[6]=c,e[7]=y):y=e[7];let x;e[8]!==t.satisfied||e[9]!==a?(x=t.satisfied?void 0:()=>{m(!1),a()},e[8]=t.satisfied,e[9]=a,e[10]=x):x=e[10];let h;e[11]!==t||e[12]!==f||e[13]!==i||e[14]!==s||e[15]!==l||e[16]!==r||e[17]!==x?(h=o.jsx(Zn,{card:t,provider:s,org:i,selfClient:l,siteUrl:r,open:f,onOpenChange:m,onOAuthInstead:x}),e[11]=t,e[12]=f,e[13]=i,e[14]=s,e[15]=l,e[16]=r,e[17]=x,e[18]=h):h=e[18];let b;return e[19]!==y||e[20]!==h?(b=o.jsxs(o.Fragment,{children:[y,h]}),e[19]=y,e[20]=h,e[21]=b):b=e[21],b}function Zn(n){const e=G.c(31),{card:t,provider:s,org:i,selfClient:l,siteUrl:r,open:a,onOpenChange:u,onOAuthInstead:p}=n,[d,c]=H.useState(!1);let f;e[0]!==u||e[1]!==d?(f=_=>{!_&&d||u(_)},e[0]=u,e[1]=d,e[2]=f):f=e[2];const m=f;let y;e[3]!==t.icon||e[4]!==t.title?(y=o.jsx(De,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1"}),e[3]=t.icon,e[4]=t.title,e[5]=y):y=e[5];let x;e[6]!==t.title?(x=o.jsx(Xe,{className:"min-w-0 flex-1",children:t.title}),e[6]=t.title,e[7]=x):x=e[7];let h;e[8]!==y||e[9]!==x?(h=o.jsxs(et,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[y,x]}),e[8]=y,e[9]=x,e[10]=h):h=e[10];let b;e[11]!==r?(b=on(r),e[11]=r,e[12]=b):b=e[12];const g=t.boundResource??void 0;let S;e[13]!==u?(S=()=>u(!1),e[13]=u,e[14]=S):S=e[14];let C;e[15]!==p||e[16]!==i||e[17]!==s||e[18]!==l||e[19]!==r||e[20]!==b||e[21]!==g||e[22]!==S?(C=o.jsx(Hn,{provider:s,siteUrl:r,siteHost:b,selfClient:l,org:i,initialResourceId:g,onDone:S,onIsPendingChange:c,onOAuthInstead:p}),e[15]=p,e[16]=i,e[17]=s,e[18]=l,e[19]=r,e[20]=b,e[21]=g,e[22]=S,e[23]=C):C=e[23];let O;e[24]!==h||e[25]!==C?(O=o.jsxs(tt,{"aria-describedby":void 0,className:"max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg",children:[h,C]}),e[24]=h,e[25]=C,e[26]=O):O=e[26];let j;return e[27]!==m||e[28]!==a||e[29]!==O?(j=o.jsx(nt,{open:a,onOpenChange:m,children:O}),e[27]=m,e[28]=a,e[29]=O,e[30]=j):j=e[30],j}function We(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0],e}function Ye(n){const e=G.c(25),{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,variant:a,disabled:u,autoOpen:p,onAutoOpenHandled:d}=n,c=te(),[f,m]=H.useState(p);let y;e[0]!==t.configurationState||e[1]!==c?(y=hn(t.configurationState,c),e[0]=t.configurationState,e[1]=c,e[2]=y):y=e[2];const x=y;let h;e[3]!==p||e[4]!==d?(h=()=>{m(!1),p&&d()},e[3]=p,e[4]=d,e[5]=h):h=e[5];const b=h;if(!mt[t.bindingType])return null;let g;e[6]!==t.title||e[7]!==u||e[8]!==x||e[9]!==c||e[10]!==a?(g=a==="configure"?o.jsx(jn,{disabled:u,title:t.title,onConfigure:()=>m(!0)}):o.jsxs(Fe,{children:[o.jsx(Le,{asChild:!0,children:o.jsx(ut,{ariaLabel:c("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>m(!0)})}),o.jsx(Ke,{children:x.length>0?c("commerceOnboarding.companionCard.editConfiguration"):c("commerceOnboarding.companionCard.configure")})]}),e[6]=t.title,e[7]=u,e[8]=x,e[9]=c,e[10]=a,e[11]=g):g=e[11];const S=g;let C;e[12]!==b?(C=_=>_?m(!0):b(),e[12]=b,e[13]=C):C=e[13];let O;e[14]!==t||e[15]!==l||e[16]!==r||e[17]!==f||e[18]!==s||e[19]!==i||e[20]!==C?(O=o.jsx(Jn,{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,open:f,onOpenChange:C}),e[14]=t,e[15]=l,e[16]=r,e[17]=f,e[18]=s,e[19]=i,e[20]=C,e[21]=O):O=e[21];let j;return e[22]!==O||e[23]!==S?(j=o.jsxs(o.Fragment,{children:[S,O]}),e[22]=O,e[23]=S,e[24]=j):j=e[24],j}function Jn(n){const e=G.c(59),{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,open:a,onOpenChange:u}=n,p=te();let d;e[0]!==l||e[1]!==s.id||e[2]!==s.slug?(d={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=l,e[1]=s.id,e[2]=s.slug,e[3]=d):d=e[3];const c=Ae(d),[f,m]=H.useState(!1),y=ye(),x=mt[t.bindingType];let h;e[4]!==l||e[5]!==i?(h=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:l,force:!0}})},e[4]=l,e[5]=i,e[6]=h):h=e[6];let b;e[7]!==t.title||e[8]!==u||e[9]!==s.id||e[10]!==y||e[11]!==p?(b=async()=>{await y.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),_e.success(p("commerceOnboarding.companionCard.disconnectedSuccess",{title:t.title})),u(!1)},e[7]=t.title,e[8]=u,e[9]=s.id,e[10]=y,e[11]=p,e[12]=b):b=e[12];let g;e[13]!==p?(g=()=>{_e.error(p("commerceOnboarding.companionCard.disconnectError"))},e[13]=p,e[14]=g):g=e[14];let S;e[15]!==h||e[16]!==b||e[17]!==g?(S={mutationFn:h,onSuccess:b,onError:g},e[15]=h,e[16]=b,e[17]=g,e[18]=S):S=e[18];const C=Te(S);if(!x)return null;let O;e[19]!==f||e[20]!==u?(O=A=>{!A&&f||u(A)},e[19]=f,e[20]=u,e[21]=O):O=e[21];const j=O;let _;e[22]!==t.icon||e[23]!==t.title?(_=o.jsx(De,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1"}),e[22]=t.icon,e[23]=t.title,e[24]=_):_=e[24];let v;e[25]!==t.title?(v=o.jsx(Xe,{children:t.title}),e[25]=t.title,e[26]=v):v=e[26];let w;e[27]!==t.title||e[28]!==p?(w=p("commerceOnboarding.companionCard.configureDescription",{title:t.title}),e[27]=t.title,e[28]=p,e[29]=w):w=e[29];let E;e[30]!==w?(E=o.jsx(Ft,{children:w}),e[30]=w,e[31]=E):E=e[31];let N;e[32]!==E||e[33]!==v?(N=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[v,E]}),e[32]=E,e[33]=v,e[34]=N):N=e[34];let k;e[35]!==N||e[36]!==_?(k=o.jsxs(et,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[_,N]}),e[35]=N,e[36]=_,e[37]=k):k=e[37];let I;e[38]!==u?(I=()=>u(!1),e[38]=u,e[39]=I):I=e[39];let F;e[40]!==C?(F=()=>C.mutate(),e[40]=C,e[41]=F):F=e[41];let P;e[42]!==x||e[43]!==t||e[44]!==c||e[45]!==l||e[46]!==r||e[47]!==s||e[48]!==i||e[49]!==I||e[50]!==F?(P=o.jsx(x,{card:t,connectionId:l,companionClient:c,selfClient:i,org:s,contextSiteUrl:r,onDone:I,onDisconnect:F,onIsPendingChange:m}),e[42]=x,e[43]=t,e[44]=c,e[45]=l,e[46]=r,e[47]=s,e[48]=i,e[49]=I,e[50]=F,e[51]=P):P=e[51];let T;e[52]!==k||e[53]!==P?(T=o.jsxs(tt,{className:"sm:max-w-lg",children:[k,P]}),e[52]=k,e[53]=P,e[54]=T):T=e[54];let L;return e[55]!==j||e[56]!==a||e[57]!==T?(L=o.jsx(nt,{open:a,onOpenChange:j,children:T}),e[55]=j,e[56]=a,e[57]=T,e[58]=L):L=e[58],L}const qe={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 Xn(n){const e=G.c(44),{selfClient:t,org:s,cdConnectionId:i,siteUrl:l}=n;let r;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const a=Ae(r);let u;e[4]!==i||e[5]!==s.id?(u=J.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=u):u=e[6];let p;e[7]!==a?(p=async()=>{const V=await a.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ee(V)},e[7]=a,e[8]=p):p=e[8];let d;e[9]!==u||e[10]!==p?(d={queryKey:u,queryFn:p,retry:!1},e[9]=u,e[10]=p,e[11]=d):d=e[11];const c=be(d),f=c.data?.stateSchema?ln(c.data.stateSchema):null;let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m={strict:!1},e[12]=m):m=e[12];const{shopify:y}=Tt(m);let x;e[13]!==y?(x=V=>V.bindingType!=="shopify"||y!=null,e[13]=y,e[14]=x):x=e[14];const h=(f&&f.length>0?f:dn).filter(x),b=h.map(lo),g=h.map(co).filter(ao),S=h.filter(ro).map(io),C=[...g,...S].sort().join(",");let O;e[15]!==i||e[16]!==s.id?(O=J.commerceDiscoveryConnection(s.id,i),e[15]=i,e[16]=s.id,e[17]=O):O=e[17];let j;e[18]!==i||e[19]!==t?(j=async()=>{const V=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ee(V)},e[18]=i,e[19]=t,e[20]=j):j=e[20];let _;e[21]!==O||e[22]!==j?(_={queryKey:O,queryFn:j},e[21]=O,e[22]=j,e[23]=_):_=e[23];const w=je(_).data?.item?.configuration_state??null;let E;e[24]!==w?(E=V=>w?.[V.fieldKey]?.value,e[24]=w,e[25]=E):E=e[25];const N=h.map(E).filter(so),k=[...b.map(oo),...g.map(no),...N.map(to)].sort().join(","),F=je({queryKey:J.commerceDiscoveryCompanionConnections(s.id,k),queryFn:async()=>{if(h.length===0)return{items:[]};const V=[{field:["app_name"],operator:"in",value:b},{field:["app_id"],operator:"in",value:g}];N.length>0&&V.push({field:["id"],operator:"in",value:N});const se=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:V},limit:1e3}});return ee(se)}}).data?.items??[],P=new Set(N),T=F.filter(V=>P.has(V.id)),L=T.filter(eo);let A;e[26]!==s.id||e[27]!==s.slug?(A=V=>({queryKey:J.commerceDiscoveryCompanionOAuthStatus(s.id,V.id),queryFn:async()=>{try{const se=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(V.id)}/oauth-token/status`,{credentials:"include"});return se.ok?{hasToken:(await se.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[26]=s.id,e[27]=s.slug,e[28]=A):A=e[28];const U=Jt({queries:L.map(A)});let B;e[29]!==U?(B=(V,se)=>[V.id,U[se]?.data?.hasToken===!0],e[29]=U,e[30]=B):B=e[30];const M=new Map(L.map(B)),K={};for(const V of T)K[V.id]=!V.oauth_config||!!V.connection_token||M.get(V.id)===!0;const q=je({queryKey:J.commerceDiscoveryCompanionRegistry(s.id,C),queryFn:async()=>{if(h.length===0)return{items:[]};const V=un(g,S),se=await At(Je.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...V?{where:V}:{},limit:1e3});return ee(se)}}),D={},Q={};for(const V of q.data?.items??[])D[V.id]=V,V.server?.name&&(Q[V.server.name]=V);let $;e[31]!==s.id||e[32]!==l?($=J.commerceDiscoveryConnectionStatus(s.id,l??""),e[31]=s.id,e[32]=l,e[33]=$):$=e[33];const Y=!!l;let R;e[34]!==t||e[35]!==l?(R=async()=>{const V=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:l}});return ee(V)},e[34]=t,e[35]=l,e[36]=R):R=e[36];let z;e[37]!==$||e[38]!==Y||e[39]!==R?(z={queryKey:$,enabled:Y,queryFn:R},e[37]=$,e[38]=Y,e[39]=R,e[40]=z):z=e[40];const ne=be(z),oe={};for(const[V,se]of Object.entries(ft)){const Oe=ne.data?.providers?.[se];Oe?.connected&&Oe.via==="sa"&&(oe[V]={resource:Oe.resource??null})}const W=!!l&&(ne.isError||ne.data?.claimed===!1),X=Cn({requirements:h,itemsById:D,itemsByName:Q,connections:F,connectionReadiness:K,configurationState:w,curated:qe,saBindings:oe});let de;return e[41]!==X||e[42]!==W?(de={cards:X,saStatusUnavailable:W},e[41]=X,e[42]=W,e[43]=de):de=e[43],de}function eo(n){return n.oauth_config&&!n.connection_token}function to(n){return`linked:${n}`}function no(n){return`app:${n}`}function oo(n){return`binding:${n}`}function so(n){return typeof n=="string"&&n.length>0}function io(n){return n.bindingType}function ro(n){return!qe[n.bindingType]}function ao(n){return!!n}function co(n){return qe[n.bindingType]?.registryAppId}function lo(n){return n.bindingType}function $o(n){const e=G.c(9),{selfClient:t,org:s,cdConnectionId:i}=n;let l;e[0]!==i||e[1]!==s.id?(l=J.commerceDiscoveryConnection(s.id,i),e[0]=i,e[1]=s.id,e[2]=l):l=e[2];let r;e[3]!==i||e[4]!==t?(r=async()=>{const d=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ee(d)},e[3]=i,e[4]=t,e[5]=r):r=e[5];let a;e[6]!==l||e[7]!==r?(a={queryKey:l,queryFn:r,retry:!1},e[6]=l,e[7]=r,e[8]=a):a=e[8];const p=je(a).data.item?.metadata?.siteUrl;return typeof p=="string"?p:void 0}function uo({selfClient:n,org:e,userId:t,cdConnectionId:s,domain:i,siteUrl:l}){const r=ye(),[a,u]=H.useState(null),[p,d]=H.useState(null),[c,f]=H.useState(null),m=async(h,b)=>{const g=await n.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:b}});return ee(g)};async function y(h){u(h.fieldKey),f(null);const b={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:l,...ze(window.location.search)};ue("commerce_onboarding_companion_connect_clicked",b);try{let g=h.candidateConnectionId;if(!g){const v=Dt(h.registryItem,e.id,t,{remoteIndex:0}),w=v.connection_type==="STDIO",E=!!v.connection_url,N=w&&v.connection_headers&&typeof v.connection_headers=="object"&&"command"in v.connection_headers;if(!E&&!N)return ue("commerce_onboarding_companion_connect_failed",{...b,error:"no_connection_method"}),f(Qe("commerceOnboarding.connectSourceDialog.noConnectionMethod",{title:h.title})),!1;const k=await n.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:v}});g=ee(k).item.id}const S=g,C=await Gt({connectionId:S,orgId:e.id,orgSlug:e.slug,persistFallback:v=>m(S,{connection_token:v}).then(()=>{})});if(!C.ok)return ue("commerce_onboarding_companion_connect_failed",{...b,error:C.error}),f(Qe("commerceOnboarding.connectSourceDialog.signInFailed",{title:h.title,error:C.error??""})),!1;const O=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),j=ee(O).item?.configuration_state??null,_=mn(j,h.fieldKey,h.bindingType,S);return h.bindingType==="github"&&delete _.github_repo,await m(s,{configuration_state:_}),await r.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,s)}),await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_connected",b),!0}catch(g){return ue("commerce_onboarding_companion_connect_failed",{...b,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{u(null)}}async function x(h){d(h.fieldKey),f(null);const b={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:l,...ze(window.location.search)};ue("commerce_onboarding_companion_disconnect_clicked",b);try{const g=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),C={...ee(g).item?.configuration_state??null??{}};return delete C[h.fieldKey],h.bindingType==="github"&&delete C.github_repo,await m(s,{configuration_state:C}),await r.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,s)}),await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_disconnected",b),!0}catch(g){return ue("commerce_onboarding_companion_disconnect_failed",{...b,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{d(null)}}return{connect:y,connectingFieldKey:a,disconnect:x,disconnectingFieldKey:p,error:c}}const Ue="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-6";function $e(){const n=G.c(4),e=te();let t;n[0]!==e?(t=e("routes.commerceOnboarding.companionSection.title"),n[0]=e,n[1]=t):t=n[1];let s;return n[2]!==t?(s=o.jsx("h1",{className:"text-lg font-medium leading-6 text-foreground lg:text-xl lg:leading-7",children:t}),n[2]=t,n[3]=s):s=n[3],s}function mo(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2,3].map(fo)}),n[0]=e):e=n[0],e}function fo(n){return o.jsx(Gn,{},n)}function go(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:Ue,children:[o.jsx($e,{}),o.jsx(mo,{})]}),n[0]=e):e=n[0],e}function po(n){const e=G.c(18),{onRetry:t}=n,s=te();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx($e,{}),e[0]=i):i=e[0];let l;e[1]!==s?(l=s("routes.commerceOnboarding.companionSection.loadError"),e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=o.jsx("p",{className:"text-sm text-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let a;e[5]!==s?(a=s("routes.commerceOnboarding.companionSection.loadErrorDescription"),e[5]=s,e[6]=a):a=e[6];let u;e[7]!==a?(u=o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a}),e[7]=a,e[8]=u):u=e[8];let p;e[9]!==s?(p=s("routes.commerceOnboarding.companionSection.retry"),e[9]=s,e[10]=p):p=e[10];let d;e[11]!==t||e[12]!==p?(d=o.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:p}),e[11]=t,e[12]=p,e[13]=d):d=e[13];let c;return e[14]!==r||e[15]!==u||e[16]!==d?(c=o.jsxs("div",{className:Ue,children:[i,o.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[r,u,d]})]}),e[14]=r,e[15]=u,e[16]=d,e[17]=c):c=e[17],c}function Mo(n){const e=G.c(2);let t;return e[0]!==n?(t=o.jsx(Et,{children:s=>{const{reset:i}=s;return o.jsx(wt,{fallback:l=>{const{resetError:r}=l;return o.jsx(po,{onRetry:()=>{i(),r()}})},children:o.jsx(H.Suspense,{fallback:o.jsx(go,{}),children:o.jsx(ho,{...n})})})}}),e[0]=n,e[1]=t):t=e[1],t}function ho(n){const e=G.c(60),{org:t,cdConnectionId:s,siteUrl:i,onReadinessChange:l}=n,r=te(),{data:a}=It.useSession(),u=a?.user?.id??"";let p;if(e[0]!==i){const M=i?Ne(i):null;if(M?.ok)try{p=new URL(M.value).hostname}catch{p=void 0}e[0]=i,e[1]=p}else p=e[1];let d;e[2]!==t.id||e[3]!==t.slug?(d={connectionId:Rt,orgId:t.id,orgSlug:t.slug},e[2]=t.id,e[3]=t.slug,e[4]=d):d=e[4];const c=Ae(d);let f;e[5]!==s||e[6]!==t||e[7]!==c||e[8]!==i?(f={selfClient:c,org:t,cdConnectionId:s,siteUrl:i},e[5]=s,e[6]=t,e[7]=c,e[8]=i,e[9]=f):f=e[9];const{cards:m,saStatusUnavailable:y}=Xn(f);let x;e[10]!==s||e[11]!==t||e[12]!==c||e[13]!==p||e[14]!==i||e[15]!==u?(x={selfClient:c,org:t,userId:u,cdConnectionId:s,domain:p,siteUrl:i},e[10]=s,e[11]=t,e[12]=c,e[13]=p,e[14]=i,e[15]=u,e[16]=x):x=e[16];const{connect:h,connectingFieldKey:b,disconnect:g,disconnectingFieldKey:S,error:C}=uo(x),[O,j]=H.useState(null),_=xo;let v,w,E,N,k,I,F,P,T,L;if(e[17]!==O||e[18]!==m||e[19]!==h||e[20]!==C||e[21]!==b||e[22]!==g||e[23]!==S||e[24]!==l||e[25]!==t||e[26]!==y||e[27]!==c||e[28]!==i||e[29]!==r){N=Symbol.for("react.early_return_sentinel");e:{const M=m.filter(yo),K=m.filter(bo),q=y||(M.length>0?M.every(_):m.length===0||m.some(_));if(l?.(q),m.length===0){N=null;break e}const D=b!==null||S!==null,Q=$=>{const Y=async()=>{await h($)&&j($.fieldKey)};return o.jsx(Wn,{card:$,connecting:b===$.fieldKey,disconnecting:S===$.fieldKey,disabled:D&&b!==$.fieldKey&&S!==$.fieldKey,org:t,selfClient:c,siteUrl:i,autoOpenConfigFieldKey:O,onAutoOpenConfigHandled:()=>j(R=>R===$.fieldKey?null:R),onConnect:()=>{Y()},onDisconnect:()=>{g($)}},$.fieldKey)};w=Ue,e[40]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx($e,{}),e[40]=E):E=e[40],v=sn,F="flex min-h-0 flex-1 flex-col md:block",P="-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",e[41]!==C?(T=C&&o.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:C}),e[41]=C,e[42]=T):T=e[42],e[43]!==y||e[44]!==r?(L=y&&o.jsx("p",{role:"status",className:"mb-3 rounded-lg border border-warning/40 bg-warning/10 p-3 text-sm text-foreground",children:r("routes.commerceOnboarding.companionSection.statusUnavailable")}),e[43]=y,e[44]=r,e[45]=L):L=e[45],k="flex flex-col gap-4 pt-3",I=[...M,...K].map(Q)}e[17]=O,e[18]=m,e[19]=h,e[20]=C,e[21]=b,e[22]=g,e[23]=S,e[24]=l,e[25]=t,e[26]=y,e[27]=c,e[28]=i,e[29]=r,e[30]=v,e[31]=w,e[32]=E,e[33]=N,e[34]=k,e[35]=I,e[36]=F,e[37]=P,e[38]=T,e[39]=L}else v=e[30],w=e[31],E=e[32],N=e[33],k=e[34],I=e[35],F=e[36],P=e[37],T=e[38],L=e[39];if(N!==Symbol.for("react.early_return_sentinel"))return N;let A;e[46]!==k||e[47]!==I?(A=o.jsx("div",{className:k,children:I}),e[46]=k,e[47]=I,e[48]=A):A=e[48];let U;e[49]!==v||e[50]!==A||e[51]!==F||e[52]!==P||e[53]!==T||e[54]!==L?(U=o.jsxs(v,{wrapperClassName:F,className:P,children:[T,L,A]}),e[49]=v,e[50]=A,e[51]=F,e[52]=P,e[53]=T,e[54]=L,e[55]=U):U=e[55];let B;return e[56]!==w||e[57]!==E||e[58]!==U?(B=o.jsxs("div",{className:w,children:[E,U]}),e[56]=w,e[57]=E,e[58]=U,e[59]=B):B=e[59],B}function bo(n){return!n.required}function yo(n){return n.required}function xo(n){return n.satisfied&&n.configured}function Co(n){return n.content?.find(e=>e.text)?.text??"__configurationFailed"}function Qo(n){const e=n;if(e.isError)throw new Error(Co(e));return e.structuredContent??n}export{go as C,Be as L,ft as P,sn as S,Mo as a,$o as b,ee as c,Xn as d,uo as e,Jn as f,Zn as g,Uo as i,Ne as n,Qo as p,on as s,Zt as u};
1
+ import{bH as gt,ad as Ie,bI as pt,ac as ht,bJ as Ze,n as ye,bK as bt,bL as yt,r as H,bM as xt,bN as Ct,bO as St,bP as vt,bQ as Me,bR as Ot,bS as jt,bT as _t,c as G,l as fe,j as o,b as te,h as Re,B as Z,e as Te,K as J,ae as xe,ag as ie,ar as Ce,aq as Se,m as be,aR as Nt,t as _e,a4 as Fe,a1 as Le,a2 as Ke,u as Tt,x as je,o as ue,bU as Qe,Q as Et,E as wt,a as It}from"./index-CSRM1f8q.js";import{u as Ae}from"./use-mcp-client-GjCeFgDH.js";import{W as Je,g as kt,S as Rt}from"./constants-Daqiz8AS.js";import{I as De}from"./integration-icon-C1WwgYjH.js";import{e as ge,d as Xe,c as et,b as tt,D as nt,h as Ft}from"./dialog-CNh5j8Ij.js";import{p as ot,aa as st,S as Lt}from"./agent-icon-BqwQnN-H.js";import{a as Kt,c as At,e as Dt}from"./extract-connection-data-ZZXv8aem.js";import{g as Pt,f as it,a as Bt,p as qt,i as Ut}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{g as rt}from"./metadata-dUsYcpuu.js";import{i as at}from"./CheckCircle-kXqYZ4lp.js";import{d as re,F as ve,a as ae,e as he,b as ce,c as le,f as $t}from"./form-B6Rxlr4w.js";import{I as pe}from"./input-BS0hECon.js";import{i as Mt}from"./Check-D1RndvMl.js";import{a as ct}from"./Copy01-Cz4gIH9t.js";import{i as Qt}from"./Settings02-CCqfjQqM.js";import{s as zt}from"./Eye-CQf7Good.js";import{u as Vt}from"./use-debounced-value-BULHGxEc.js";import{n as Ht}from"./LinkExternal01-BJBRYdix.js";import{a as Gt}from"./authenticate-and-persist-oauth-f6JOL-_R.js";import{r as ze}from"./track-Dk6T6yFd.js";function Ve(n,e){const t=new Set(e);return n.filter(s=>!t.has(s))}function Wt(n,e,t){const s=n.slice(0);return s[e]=t,s}var Yt=class extends gt{#s;#e;#i;#o;#t;#n;#r;#a;#c;#l=[];constructor(n,e,t){super(),this.#s=n,this.#o=t,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(n=>{n.subscribe(e=>{this.#f(n,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(n=>{n.destroy()})}setQueries(n,e){this.#i=n,this.#o=e,Ie.batch(()=>{const t=this.#t,s=this.#m(this.#i);s.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=s.map(d=>d.observer),l=i.map(d=>d.getCurrentResult()),r=t.length!==i.length,a=i.some((d,c)=>d!==t[c]),u=r||a,p=u?!0:l.some((d,c)=>{const f=this.#e[c];return!f||!pt(d,f)});!u&&!p||(u&&(this.#l=s,this.#t=i),this.#e=l,this.hasListeners()&&(u&&(Ve(t,i).forEach(d=>{d.destroy()}),Ve(i,t).forEach(d=>{d.subscribe(c=>{this.#f(d,c)})})),this.#g()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(n=>n.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(n,e){const t=this.#m(n),s=t.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),i=t.map(l=>l.defaultedQueryOptions.queryHash);return[s,l=>this.#u(l??s,e,i),()=>this.#d(s,t)]}#d(n,e){return e.map((t,s)=>{const i=n[s];return t.defaultedQueryOptions.notifyOnChangeProps?i:t.observer.trackResult(i,l=>{e.forEach(r=>{r.observer.trackProp(l)})})})}#u(n,e,t){if(e){const s=this.#c,i=t!==void 0&&s!==void 0&&(s.length!==t.length||t.some((l,r)=>l!==s[r]));return(!this.#n||this.#e!==this.#a||i||e!==this.#r)&&(this.#r=e,this.#a=this.#e,t!==void 0&&(this.#c=t),this.#n=ht(this.#n,e(n))),this.#n}return n}#p(){return this.#o?.combine!==void 0&&this.#t.some((n,e)=>n.options.suspense&&this.#e[e]?.data===void 0)}#m(n){const e=new Map;this.#t.forEach(s=>{const i=s.options.queryHash;if(!i)return;const l=e.get(i);l?l.push(s):e.set(i,[s])});const t=[];return n.forEach(s=>{const i=this.#s.defaultQueryOptions(s),r=e.get(i.queryHash)?.shift()??new Ze(this.#s,i);t.push({defaultedQueryOptions:i,observer:r})}),t}#f(n,e){const t=this.#t.indexOf(n);t!==-1&&(this.#e=Wt(this.#e,t,e),this.#g())}#g(){if(this.hasListeners()){const n=this.#d(this.#e,this.#l),e=this.#p(),t=this.#n,s=e?t:this.#u(n,this.#o?.combine);(e||t!==s)&&Ie.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function Zt({queries:n,...e},t){const s=ye(t),i=bt(),l=yt(),r=H.useMemo(()=>n.map(x=>{const h=s.defaultQueryOptions(x);return h._optimisticResults=i?"isRestoring":"optimistic",h}),[n,s,i]);r.forEach(x=>{xt(x);const h=s.getQueryCache().get(x.queryHash);Ct(x,l,h)}),St(l);const[a]=H.useState(()=>new Yt(s,r,e)),[u,p,d]=a.getOptimisticResult(r,e.combine),c=!i&&e.subscribed!==!1;H.useSyncExternalStore(H.useCallback(x=>c?a.subscribe(Ie.batchCalls(x)):vt,[a,c]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),H.useEffect(()=>{a.setQueries(r,e)},[r,e,a]);const m=u.some((x,h)=>Me(r[h],x))?u.flatMap((x,h)=>{const b=r[h];if(b&&Me(b,x)){const g=new Ze(s,b);return Ot(b,g,l)}return[]}):[];if(m.length>0)throw Promise.all(m);const y=u.find((x,h)=>{const b=r[h];return b&&jt({result:x,errorResetBoundary:l,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(y?.error)throw y.error;return p(d())}function Jt(n,e){return Zt({...n,queries:n.queries.map(t=>({...t,suspense:!0,throwOnError:_t,enabled:!0,placeholderData:void 0}))},e)}const Xt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,en=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,tn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,nn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Ne(n){const e=n.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=Xt.test(e),s=en.test(e),i=tn.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=s?e:`https://${e}`;let r;try{r=new URL(l)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=r.hostname.split(".");return a.length<2||a.some(u=>!u||!nn.test(u))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Uo(n,e){if(!n.trim())return!0;const t=Ne(n);if(!t.ok||!e)return!1;const s=Ne(e);return s.ok&&s.value===t.value}function on(n){if(!n)return null;const e=Ne(n);return e.ok?new URL(e.value).hostname:null}function sn(n){const e=G.c(14),{children:t,className:s,wrapperClassName:i}=n,[l,r]=H.useState(!0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=x=>{if(!x)return;const h=()=>{const g=x.scrollHeight-x.scrollTop-x.clientHeight<8;r(g)};h(),x.addEventListener("scroll",h,{passive:!0});const b=new ResizeObserver(h);b.observe(x);for(const g of Array.from(x.children))b.observe(g);return()=>{x.removeEventListener("scroll",h),b.disconnect()}},e[0]=a):a=e[0];const u=a;let p;e[1]!==i?(p=fe("relative",i),e[1]=i,e[2]=p):p=e[2];let d;e[3]!==t||e[4]!==s?(d=o.jsx("div",{ref:u,className:s,children:t}),e[3]=t,e[4]=s,e[5]=d):d=e[5];const c=l?"opacity-0":"opacity-100";let f;e[6]!==c?(f=fe("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",c),e[6]=c,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("div",{"aria-hidden":!0,className:f}),e[8]=f,e[9]=m):m=e[9];let y;return e[10]!==p||e[11]!==d||e[12]!==m?(y=o.jsxs("div",{className:p,children:[d,m]}),e[10]=p,e[11]=d,e[12]=m,e[13]=y):y=e[13],y}const rn=new Set([]);function an(n){if(n.boundVia==="sa")return!0;const{companionConfig:e,cdConfig:t}=n;switch(n.bindingType){case"vtex":return me(e?.accountName);case"shopify":return me(e?.storeDomain);case"google-analytics":return me(e?.propertyId);case"google-search-console":return me(e?.siteUrl);case"github":return me(t?.github_repo);default:return!0}}function cn(n){const{companionConfig:e,cdConfig:t}=n;switch(n.bindingType){case"vtex":return typeof e?.accountName=="string"?e.accountName:null;case"shopify":return typeof e?.storeDomain=="string"?e.storeDomain:null;case"google-analytics":return typeof e?.propertyId=="string"?e.propertyId:null;case"google-search-console":return typeof e?.siteUrl=="string"?e.siteUrl:null;case"github":return typeof t?.github_repo=="string"?t.github_repo:null;default:return null}}function ln(n){const e=n.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const a=i?.properties?.__type?.const;typeof a=="string"&&a.length>0&&t.push({fieldKey:s,bindingType:a})}return t}const dn=[{fieldKey:"vtex",bindingType:"vtex"},{fieldKey:"shopify",bindingType:"shopify"},{fieldKey:"ga4",bindingType:"google-analytics"},{fieldKey:"gsc",bindingType:"google-search-console"},{fieldKey:"github",bindingType:"github"}];function un(n,e){const t=[];if(n.length&&t.push({field:["id"],operator:"in",value:n}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function ee(n){const e=n;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??n}function mn(n,e,t,s){return{...n??{},[e]:{__type:t,value:s}}}function me(n){return n==null?!1:typeof n=="string"?n.trim().length>0:typeof n=="number"||typeof n=="boolean"?!0:Array.isArray(n)?n.some(me):typeof n=="object"?Object.entries(n).some(([e,t])=>!e.startsWith("__")&&me(t)):!1}const fn={accountName:"commerceOnboarding.companionCard.configField.accountName",appKey:"commerceOnboarding.companionCard.configField.appKey",appToken:"commerceOnboarding.companionCard.configField.appToken",propertyId:"commerceOnboarding.companionCard.configField.propertyId",siteUrl:"commerceOnboarding.companionCard.configField.siteUrl"};function gn(n,e){const t=fn[n];return t?e(t):n.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,s=>s.toUpperCase())}function pn(n){return me(n)?typeof n=="string"?n.trim():typeof n=="number"||typeof n=="boolean"?String(n):JSON.stringify(n):null}function hn(n,e){return n?Object.entries(n).flatMap(([t,s])=>{if(t.startsWith("__"))return[];const i=pn(s);return i?[{key:t,label:gn(t,e),value:i}]:[]}):[]}function He({autoOpenFieldKey:n,card:e}){return n===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function bn(n,e,t){const s=n.filter(i=>(i.app_name===e||!!t&&i.app_id===t)&&Pt(i)===null);return s.length===0?null:(s.sort((i,l)=>{const r=a=>a.status==="active"?0:1;return r(i)!==r(l)?r(i)-r(l):(l.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function yn(n){return n.server?.icons?.[0]?.src??Kt(n.server?.repository)??null}function xn(n,e){const t=rt(n._meta);return t?.friendlyName||t?.friendly_name||n.title||n.server?.title||n.server?.name||e}function Cn(n){const e=[],t=new Map(n.connections.map(s=>[s.id,s]));for(const s of n.requirements){const i=n.curated[s.bindingType],l=i?n.itemsById[i.registryAppId]:n.itemsByName[s.bindingType];if(!l)continue;const r=n.configurationState?.[s.fieldKey]?.value,a=r?t.get(r):void 0,u=r&&a?r:null,p=u?n.connectionReadiness?.[u]!==!1:!1,d=!!u&&p,c=d?void 0:n.saBindings?.[s.bindingType],f=d||!!c,m=d?"oauth":c?"sa":null,y=f&&an({bindingType:s.bindingType,boundVia:m,companionConfig:a?.configuration_state??null,cdConfig:n.configurationState??null});e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:l,title:xn(l,s.bindingType),icon:yn(l),headline:i?.headline??rt(l._meta)?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,configured:y,required:rn.has(s.bindingType),candidateConnectionId:f?null:u||bn(n.connections,s.bindingType,i?.registryAppId),linkedConnectionId:u,configurationState:a?.configuration_state??null,boundVia:m,boundResource:c?.resource??null,connectedDetail:f?cn({bindingType:s.bindingType,companionConfig:a?.configuration_state??null,cdConfig:n.configurationState??null}):null})}return e}function Sn(n,e){if(!n)return null;const t=i=>{const l=i.startsWith("sc-domain:")?i.substring(10):(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`).hostname}catch{return null}})();return l===null?i:l.startsWith("www.")?l.substring(4):l},s=t(n);for(const i of e)if(t(i.siteUrl)===s)return i.siteUrl;return null}function vn(n){return(n?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function On(n){const e=G.c(25),{icon:t,title:s,headline:i,required:l,attention:r,action:a}=n,u=te(),p=r?"border-warning/50 bg-warning/[0.04]":"border-border";let d;e[0]!==p?(d=fe("relative flex items-center justify-between gap-3 rounded-lg border bg-card p-3.5 sm:gap-4 sm:p-4",p),e[0]=p,e[1]=d):d=e[1];let c;e[2]!==l||e[3]!==u?(c=l&&o.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:u("commerceOnboarding.companionCard.required")}),e[2]=l,e[3]=u,e[4]=c):c=e[4];let f;e[5]!==t||e[6]!==s?(f=o.jsx(De,{icon:t,name:s,size:"sm",fit:"contain",className:"shrink-0 p-1"}),e[5]=t,e[6]=s,e[7]=f):f=e[7];let m;e[8]!==s?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),e[8]=s,e[9]=m):m=e[9];let y;e[10]!==i?(y=i&&o.jsx("p",{className:"hidden text-sm leading-5 text-muted-foreground sm:block",children:i}),e[10]=i,e[11]=y):y=e[11];let x;e[12]!==m||e[13]!==y?(x=o.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[m,y]}),e[12]=m,e[13]=y,e[14]=x):x=e[14];let h;e[15]!==f||e[16]!==x?(h=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3 sm:items-start",children:[f,x]}),e[15]=f,e[16]=x,e[17]=h):h=e[17];let b;e[18]!==a?(b=o.jsx("div",{className:"shrink-0",children:a}),e[18]=a,e[19]=b):b=e[19];let g;return e[20]!==d||e[21]!==c||e[22]!==h||e[23]!==b?(g=o.jsxs("div",{className:d,children:[c,h,b]}),e[20]=d,e[21]=c,e[22]=h,e[23]=b,e[24]=g):g=e[24],g}function lt(n){const e=G.c(12),{connecting:t,disabled:s,title:i,primary:l,onConnect:r}=n,a=te(),u=l?"default":"outline",p=s||t;let d;e[0]!==a||e[1]!==i?(d=a("commerceOnboarding.companionCard.connectAriaLabel",{title:i}),e[0]=a,e[1]=i,e[2]=d):d=e[2];let c;e[3]!==t||e[4]!==a?(c=t?o.jsx(Re,{className:"size-4"}):a("commerceOnboarding.companionCard.connect"),e[3]=t,e[4]=a,e[5]=c):c=e[5];let f;return e[6]!==r||e[7]!==u||e[8]!==p||e[9]!==d||e[10]!==c?(f=o.jsx(Z,{type:"button",variant:u,size:"sm",disabled:p,onClick:r,"aria-label":d,children:c}),e[6]=r,e[7]=u,e[8]=p,e[9]=d,e[10]=c,e[11]=f):f=e[11],f}function jn(n){const e=G.c(11),{disabled:t,title:s,onConfigure:i}=n,l=te();let r;e[0]!==l||e[1]!==s?(r=l("commerceOnboarding.companionCard.configureAriaLabel",{title:s}),e[0]=l,e[1]=s,e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(ot,{size:16}),e[3]=a):a=e[3];let u;e[4]!==l?(u=l("commerceOnboarding.companionCard.finishSetup"),e[4]=l,e[5]=u):u=e[5];let p;return e[6]!==t||e[7]!==i||e[8]!==r||e[9]!==u?(p=o.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"border-warning/60 text-warning hover:bg-warning/10 hover:text-warning",disabled:t,onClick:i,"aria-label":r,children:[a,u]}),e[6]=t,e[7]=i,e[8]=r,e[9]=u,e[10]=p):p=e[10],p}function dt(n){const e=G.c(9),{detail:t,controls:s}=n,i=te();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(at,{size:16,className:"text-success"}),e[0]=l):l=e[0];let r;e[1]!==t||e[2]!==i?(r=t?o.jsx("span",{className:"max-w-40 truncate text-foreground",children:t}):i("commerceOnboarding.companionCard.connected"),e[1]=t,e[2]=i,e[3]=r):r=e[3];let a;e[4]!==r?(a=o.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[l," ",r]}),e[4]=r,e[5]=a):a=e[5];let u;return e[6]!==s||e[7]!==a?(u=o.jsxs("div",{className:"flex items-center gap-1",children:[a,s]}),e[6]=s,e[7]=a,e[8]=u):u=e[8],u}function ut(n){const e=G.c(4),{ariaLabel:t,onClick:s}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ot,{size:16}),e[0]=i):i=e[0];let l;return e[1]!==t||e[2]!==s?(l=o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:s,"aria-label":t,children:i}),e[1]=t,e[2]=s,e[3]=l):l=e[3],l}function ke(n){const e=G.c(38);let t,s,i,l,r;e[0]!==n?({value:r,onChange:s,placeholder:i,className:t,...l}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=i,e[4]=l,e[5]=r):(t=e[1],s=e[2],i=e[3],l=e[4],r=e[5]);const[a,u]=H.useState(!1),[p,d]=H.useState(!1);let c;e[6]!==r?(c=async()=>{if(r)try{await navigator.clipboard.writeText(r),d(!0),setTimeout(()=>d(!1),2e3)}catch(N){console.error("Failed to copy text: ",N)}},e[6]=r,e[7]=c):c=e[7];const f=c;let m;e[8]!==a?(m=()=>{u(!a)},e[8]=a,e[9]=m):m=e[9];const y=m,x=a?"text":"password";let h;e[10]!==t?(h=fe("pr-20",t),e[10]=t,e[11]=h):h=e[11];let b;e[12]!==s||e[13]!==i||e[14]!==l||e[15]!==x||e[16]!==h||e[17]!==r?(b=o.jsx(pe,{type:x,value:r,onChange:s,placeholder:i,className:h,...l}),e[12]=s,e[13]=i,e[14]=l,e[15]=x,e[16]=h,e[17]=r,e[18]=b):b=e[18];const g=a?"Hide password":"Show password";let S;e[19]!==a?(S=a?o.jsx(Qt,{size:16}):o.jsx(zt,{size:16}),e[19]=a,e[20]=S):S=e[20];let C;e[21]!==g||e[22]!==S||e[23]!==y?(C=o.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:g,children:S}),e[21]=g,e[22]=S,e[23]=y,e[24]=C):C=e[24];const O=!r,j=p?"Copied!":"Copy token";let _;e[25]!==p?(_=p?o.jsx(Mt,{size:16}):o.jsx(ct,{size:16}),e[25]=p,e[26]=_):_=e[26];let v;e[27]!==f||e[28]!==j||e[29]!==_||e[30]!==O?(v=o.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:f,disabled:O,title:j,children:_}),e[27]=f,e[28]=j,e[29]=_,e[30]=O,e[31]=v):v=e[31];let w;e[32]!==v||e[33]!==C?(w=o.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[C,v]}),e[32]=v,e[33]=C,e[34]=w):w=e[34];let E;return e[35]!==w||e[36]!==b?(E=o.jsxs("div",{className:"relative",children:[b,w]}),e[35]=w,e[36]=b,e[37]=E):E=e[37],E}function Ee(n){const e=G.c(19),{card:t,selfClient:s,org:i,onDone:l,onError:r}=n,a=ye();let u;e[0]!==t||e[1]!==s?(u=async h=>{const{values:b,connectionToken:g}=h,C={configuration_state:{...t.configurationState??{},...b}};g!==void 0&&(C.connection_token=g),await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:C}})},e[0]=t,e[1]=s,e[2]=u):u=e[2];let p;e[3]!==l||e[4]!==i||e[5]!==a?(p=async()=>{await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),l()},e[3]=l,e[4]=i,e[5]=a,e[6]=p):p=e[6];let d;e[7]!==r?(d=h=>{r?.(h)},e[7]=r,e[8]=d):d=e[8];let c;e[9]!==u||e[10]!==p||e[11]!==d?(c={mutationFn:u,onSuccess:p,onError:d},e[9]=u,e[10]=p,e[11]=d,e[12]=c):c=e[12];const f=Te(c);let m;e[13]!==f?(m=(h,b)=>f.mutate({values:h,connectionToken:b?.connectionToken}),e[13]=f,e[14]=m):m=e[14];const y=m;let x;return e[15]!==f.error||e[16]!==f.isPending||e[17]!==y?(x={save:y,isPending:f.isPending,error:f.error},e[15]=f.error,e[16]=f.isPending,e[17]=y,e[18]=x):x=e[18],x}const _n=xe({accountName:ie().min(1,"Informe o nome da conta"),appKey:ie().optional(),appToken:ie().optional()});function Nn(n){const e=G.c(73),{card:t,selfClient:s,org:i,onDone:l,onIsPendingChange:r}=n,a=te();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=Ce(_n),e[0]=u):u=e[0];const p=t.configurationState?.accountName||"",d=t.configurationState?.appKey||"",c=t.configurationState?.appToken||"";let f;e[1]!==p||e[2]!==d||e[3]!==c?(f={resolver:u,defaultValues:{accountName:p,appKey:d,appToken:c}},e[1]=p,e[2]=d,e[3]=c,e[4]=f):f=e[4];const m=Se(f);let y;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==m?(y=()=>{m.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]=m,e[9]=y):y=e[9];let x;e[10]!==t.configurationState||e[11]!==m?(x=[t.configurationState,m],e[10]=t.configurationState,e[11]=m,e[12]=x):x=e[12],H.useEffect(y,x);let h;e[13]!==t||e[14]!==l||e[15]!==i||e[16]!==s?(h={card:t,selfClient:s,org:i,onDone:l},e[13]=t,e[14]=l,e[15]=i,e[16]=s,e[17]=h):h=e[17];const{save:b,isPending:g,error:S}=Ee(h);let C,O;e[18]!==g||e[19]!==r?(O=()=>{r?.(g)},C=[g,r],e[18]=g,e[19]=r,e[20]=C,e[21]=O):(C=e[20],O=e[21]),H.useEffect(O,C);let j;if(e[22]!==m||e[23]!==b){let K;e[25]!==b?(K=async q=>{b(q)},e[25]=b,e[26]=K):K=e[26],j=m.handleSubmit(K),e[22]=m,e[23]=b,e[24]=j}else j=e[24];const _=j;let v;e[27]!==g||e[28]!==a?(v=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.accountNameLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.vtexConfigForm.accountNamePlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[27]=g,e[28]=a,e[29]=v):v=e[29];let w;e[30]!==m.control||e[31]!==v?(w=o.jsx(re,{control:m.control,name:"accountName",render:v}),e[30]=m.control,e[31]=v,e[32]=w):w=e[32];let E;e[33]!==g||e[34]!==a?(E=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.appKeyLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.vtexConfigForm.appKeyPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[33]=g,e[34]=a,e[35]=E):E=e[35];let N;e[36]!==m.control||e[37]!==E?(N=o.jsx(re,{control:m.control,name:"appKey",render:E}),e[36]=m.control,e[37]=E,e[38]=N):N=e[38];let k;e[39]!==g||e[40]!==a?(k=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.vtexConfigForm.appTokenLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.vtexConfigForm.appTokenPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[39]=g,e[40]=a,e[41]=k):k=e[41];let I;e[42]!==m.control||e[43]!==k?(I=o.jsx(re,{control:m.control,name:"appToken",render:k}),e[42]=m.control,e[43]=k,e[44]=I):I=e[44];let F;e[45]!==m||e[46]!==w||e[47]!==N||e[48]!==I?(F=o.jsxs(ve,{...m,children:[w,N,I]}),e[45]=m,e[46]=w,e[47]=N,e[48]=I,e[49]=F):F=e[49];let P;e[50]!==S||e[51]!==a?(P=S&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:a("commerceOnboarding.vtexConfigForm.savingError")}),e[50]=S,e[51]=a,e[52]=P):P=e[52];let T;e[53]!==a?(T=a("commerceOnboarding.vtexConfigForm.cancelButton"),e[53]=a,e[54]=T):T=e[54];let L;e[55]!==g||e[56]!==l||e[57]!==T?(L=o.jsx(Z,{type:"button",variant:"outline",onClick:l,disabled:g,children:T}),e[55]=g,e[56]=l,e[57]=T,e[58]=L):L=e[58];let A;e[59]!==g||e[60]!==a?(A=a(g?"commerceOnboarding.vtexConfigForm.savingButton":"commerceOnboarding.vtexConfigForm.saveButton"),e[59]=g,e[60]=a,e[61]=A):A=e[61];let U;e[62]!==g||e[63]!==A?(U=o.jsx(Z,{type:"submit",disabled:g,children:A}),e[62]=g,e[63]=A,e[64]=U):U=e[64];let B;e[65]!==L||e[66]!==U?(B=o.jsxs(ge,{className:"pt-4",children:[L,U]}),e[65]=L,e[66]=U,e[67]=B):B=e[67];let M;return e[68]!==_||e[69]!==F||e[70]!==P||e[71]!==B?(M=o.jsxs("form",{onSubmit:_,className:"space-y-4",children:[F,P,B]}),e[68]=_,e[69]=F,e[70]=P,e[71]=B,e[72]=M):M=e[72],M}const Tn=(n,e)=>xe({storeDomain:ie().min(1,e("commerceOnboarding.shopifyConfigForm.storeDomainRequired")),accessToken:ie().optional(),apiVersion:ie().optional()}).refine(t=>n||!!t.accessToken?.trim(),{path:["accessToken"],message:e("commerceOnboarding.shopifyConfigForm.accessTokenRequired")});function En(n){const e=G.c(76),{card:t,selfClient:s,org:i,onDone:l,onIsPendingChange:r}=n,a=te();let u;e[0]!==t.configured||e[1]!==a?(u=Ce(Tn(t.configured,a)),e[0]=t.configured,e[1]=a,e[2]=u):u=e[2];const p=t.configurationState?.storeDomain||"",d=t.configurationState?.apiVersion||"";let c;e[3]!==p||e[4]!==d?(c={storeDomain:p,accessToken:"",apiVersion:d},e[3]=p,e[4]=d,e[5]=c):c=e[5];let f;e[6]!==u||e[7]!==c?(f={resolver:u,defaultValues:c},e[6]=u,e[7]=c,e[8]=f):f=e[8];const m=Se(f);let y;e[9]!==t.configurationState?.apiVersion||e[10]!==t.configurationState?.storeDomain||e[11]!==m?(y=()=>{m.reset({storeDomain:t.configurationState?.storeDomain||"",accessToken:"",apiVersion:t.configurationState?.apiVersion||""})},e[9]=t.configurationState?.apiVersion,e[10]=t.configurationState?.storeDomain,e[11]=m,e[12]=y):y=e[12];let x;e[13]!==t.configurationState||e[14]!==m?(x=[t.configurationState,m],e[13]=t.configurationState,e[14]=m,e[15]=x):x=e[15],H.useEffect(y,x);let h;e[16]!==t||e[17]!==l||e[18]!==i||e[19]!==s?(h={card:t,selfClient:s,org:i,onDone:l},e[16]=t,e[17]=l,e[18]=i,e[19]=s,e[20]=h):h=e[20];const{save:b,isPending:g,error:S}=Ee(h);let C,O;e[21]!==g||e[22]!==r?(O=()=>{r?.(g)},C=[g,r],e[21]=g,e[22]=r,e[23]=C,e[24]=O):(C=e[23],O=e[24]),H.useEffect(O,C);let j;if(e[25]!==m||e[26]!==b){let K;e[28]!==b?(K=async q=>{const D=q.apiVersion?.trim(),Q=q.accessToken?.trim();b({storeDomain:q.storeDomain.trim(),...D?{apiVersion:D}:{}},Q?{connectionToken:Q}:void 0)},e[28]=b,e[29]=K):K=e[29],j=m.handleSubmit(K),e[25]=m,e[26]=b,e[27]=j}else j=e[27];const _=j;let v;e[30]!==g||e[31]!==a?(v=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.storeDomainLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.shopifyConfigForm.storeDomainPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[30]=g,e[31]=a,e[32]=v):v=e[32];let w;e[33]!==m.control||e[34]!==v?(w=o.jsx(re,{control:m.control,name:"storeDomain",render:v}),e[33]=m.control,e[34]=v,e[35]=w):w=e[35];let E;e[36]!==g||e[37]!==a?(E=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.accessTokenLabel")}),o.jsx(ce,{children:o.jsx(ke,{placeholder:a("commerceOnboarding.shopifyConfigForm.accessTokenPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[36]=g,e[37]=a,e[38]=E):E=e[38];let N;e[39]!==m.control||e[40]!==E?(N=o.jsx(re,{control:m.control,name:"accessToken",render:E}),e[39]=m.control,e[40]=E,e[41]=N):N=e[41];let k;e[42]!==g||e[43]!==a?(k=K=>{const{field:q}=K;return o.jsxs(ae,{children:[o.jsx(he,{children:a("commerceOnboarding.shopifyConfigForm.apiVersionLabel")}),o.jsx(ce,{children:o.jsx(pe,{placeholder:a("commerceOnboarding.shopifyConfigForm.apiVersionPlaceholder"),...q,disabled:g})}),o.jsx(le,{})]})},e[42]=g,e[43]=a,e[44]=k):k=e[44];let I;e[45]!==m.control||e[46]!==k?(I=o.jsx(re,{control:m.control,name:"apiVersion",render:k}),e[45]=m.control,e[46]=k,e[47]=I):I=e[47];let F;e[48]!==m||e[49]!==w||e[50]!==N||e[51]!==I?(F=o.jsxs(ve,{...m,children:[w,N,I]}),e[48]=m,e[49]=w,e[50]=N,e[51]=I,e[52]=F):F=e[52];let P;e[53]!==S||e[54]!==a?(P=S&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:a("commerceOnboarding.shopifyConfigForm.savingError")}),e[53]=S,e[54]=a,e[55]=P):P=e[55];let T;e[56]!==a?(T=a("commerceOnboarding.shopifyConfigForm.cancelButton"),e[56]=a,e[57]=T):T=e[57];let L;e[58]!==g||e[59]!==l||e[60]!==T?(L=o.jsx(Z,{type:"button",variant:"outline",onClick:l,disabled:g,children:T}),e[58]=g,e[59]=l,e[60]=T,e[61]=L):L=e[61];let A;e[62]!==g||e[63]!==a?(A=a(g?"commerceOnboarding.shopifyConfigForm.savingButton":"commerceOnboarding.shopifyConfigForm.saveButton"),e[62]=g,e[63]=a,e[64]=A):A=e[64];let U;e[65]!==g||e[66]!==A?(U=o.jsx(Z,{type:"submit",disabled:g,children:A}),e[65]=g,e[66]=A,e[67]=U):U=e[67];let B;e[68]!==L||e[69]!==U?(B=o.jsxs(ge,{className:"pt-4",children:[L,U]}),e[68]=L,e[69]=U,e[70]=B):B=e[70];let M;return e[71]!==_||e[72]!==F||e[73]!==P||e[74]!==B?(M=o.jsxs("form",{onSubmit:_,className:"space-y-4",children:[F,P,B]}),e[71]=_,e[72]=F,e[73]=P,e[74]=B,e[75]=M):M=e[75],M}function Pe(n){const e=G.c(31),{options:t,value:s,onChange:i,disabled:l,ariaLabel:r,searchPlaceholder:a,hideSearch:u}=n,p=u===void 0?!1:u,d=te(),[c,f]=H.useState("");let m,y,x;if(e[0]!==t||e[1]!==c||e[2]!==s){const _=c.trim().toLowerCase();m=_?t.filter(v=>v.label.toLowerCase().includes(_)):t,y=m.map(wn),x=y.includes(s)?s:y[0]??"",e[0]=t,e[1]=c,e[2]=s,e[3]=m,e[4]=y,e[5]=x}else m=e[3],y=e[4],x=e[5];const h=x;let b;e[6]!==l||e[7]!==y||e[8]!==i?(b=function(v){if(l||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(v.key))return;v.preventDefault();const E=v.currentTarget.dataset.value,N=y.indexOf(E),k=y.length;if(k===0)return;let I;v.key==="ArrowDown"||v.key==="ArrowRight"?I=(N+1)%k:v.key==="ArrowUp"||v.key==="ArrowLeft"?I=(N-1+k)%k:v.key==="Home"?I=0:I=k-1;const F=y[I];i(F),v.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(F)}"]`)?.focus()},e[6]=l,e[7]=y,e[8]=i,e[9]=b):b=e[9];const g=b;let S;e[10]!==r||e[11]!==l||e[12]!==p||e[13]!==c||e[14]!==a||e[15]!==d?(S=p?null:o.jsxs("div",{className:"relative",children:[o.jsx(st,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),o.jsx(pe,{type:"text",value:c,onChange:_=>f(_.target.value),disabled:l,placeholder:a??d("commerceOnboarding.selectableList.searchPlaceholder"),"aria-label":d("commerceOnboarding.selectableList.searchAriaLabel",{label:r}),className:"h-8 pl-8"})]}),e[10]=r,e[11]=l,e[12]=p,e[13]=c,e[14]=a,e[15]=d,e[16]=S):S=e[16];let C;e[17]!==l||e[18]!==m||e[19]!==g||e[20]!==i||e[21]!==d||e[22]!==h||e[23]!==s?(C=m.length===0?o.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:d("commerceOnboarding.selectableList.noResults")}):m.map(_=>{const v=_.value===s;return o.jsxs("button",{type:"button",role:"radio","aria-checked":v,disabled:l,"data-value":_.value,tabIndex:_.value===h?0:-1,onClick:()=>i(_.value),onKeyDown:g,className:fe("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",v?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[o.jsx("span",{className:"truncate",children:_.label}),v?o.jsx(at,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[17]=l,e[18]=m,e[19]=g,e[20]=i,e[21]=d,e[22]=h,e[23]=s,e[24]=C):C=e[24];let O;e[25]!==r||e[26]!==C?(O=o.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:C}),e[25]=r,e[26]=C,e[27]=O):O=e[27];let j;return e[28]!==S||e[29]!==O?(j=o.jsxs("div",{className:"space-y-2",children:[S,O]}),e[28]=S,e[29]=O,e[30]=j):j=e[30],j}function wn(n){return n.value}function Be(n){const e=G.c(18),{label:t,iconSize:s,className:i,iconClassName:l,labelClassName:r}=n,a=s===void 0?14:s;let u;e[0]!==i?(u=fe("inline-flex items-center gap-2",i),e[0]=i,e[1]=u):u=e[1];let p;e[2]!==l?(p=fe("shrink-0",l),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==a?(d={width:a,height:a},e[4]=a,e[5]=d):d=e[5];let c;e[6]!==p||e[7]!==d?(c=o.jsx(Re,{className:p,style:d}),e[6]=p,e[7]=d,e[8]=c):c=e[8];let f;e[9]!==r?(f=fe("text-sm",r),e[9]=r,e[10]=f):f=e[10];let m;e[11]!==t||e[12]!==f?(m=o.jsx("span",{className:f,children:t}),e[11]=t,e[12]=f,e[13]=m):m=e[13];let y;return e[14]!==u||e[15]!==c||e[16]!==m?(y=o.jsxs("span",{className:u,children:[c,m]}),e[14]=u,e[15]=c,e[16]=m,e[17]=y):y=e[17],y}const In=xe({propertyId:ie().min(1,"Selecione uma propriedade")});function kn(n){const e=G.c(68),{card:t,connectionId:s,companionClient:i,selfClient:l,org:r,onDone:a,onDisconnect:u,onIsPendingChange:p}=n;let d;e[0]!==s||e[1]!==r.id?(d=J.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=d):d=e[2];let c;e[3]!==i?(c=async()=>{const D=await i.callTool({name:"get-account-summaries",arguments:{}}),Q=ee(D);return vn(Q)},e[3]=i,e[4]=c):c=e[4];let f;e[5]!==d||e[6]!==c?(f={queryKey:d,queryFn:c},e[5]=d,e[6]=c,e[7]=f):f=e[7];const m=be(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Ce(In),e[8]=y):y=e[8];const x=t.configurationState?.propertyId||"";let h;e[9]!==x?(h={resolver:y,defaultValues:{propertyId:x}},e[9]=x,e[10]=h):h=e[10];const b=Se(h);let g;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==l?(g={card:t,selfClient:l,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=l,e[15]=g):g=e[15];const{save:S,isPending:C,error:O}=Ee(g);let j,_;e[16]!==C||e[17]!==p?(j=()=>{p?.(C)},_=[C,p],e[16]=C,e[17]=p,e[18]=j,e[19]=_):(j=e[18],_=e[19]),H.useEffect(j,_);let v;if(e[20]!==b||e[21]!==S){let D;e[23]!==S?(D=async Q=>{S(Q)},e[23]=S,e[24]=D):D=e[24],v=b.handleSubmit(D),e[20]=b,e[21]=S,e[22]=v}else v=e[22];const w=v;if(m.isLoading){let D;return e[25]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:o.jsx(Be,{label:"Carregando propriedades..."})}),e[25]=D):D=e[25],D}if(m.isError){let D;return e[26]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=D):D=e[26],D}let E;e[27]!==m.data?(E=m.data||[],e[27]=m.data,e[28]=E):E=e[28];const N=E;if(N.flatMap(Fn).length===0){let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=o.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]=D):D=e[29];let Q;e[30]!==u?(Q=u?o.jsx("button",{type:"button",onClick:u,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):o.jsx("span",{}),e[30]=u,e[31]=Q):Q=e[31];let $;e[32]!==a?($=o.jsx(Z,{type:"button",variant:"outline",onClick:a,children:"Fechar"}),e[32]=a,e[33]=$):$=e[33];let Y;return e[34]!==Q||e[35]!==$?(Y=o.jsxs("div",{className:"space-y-4",children:[D,o.jsxs(ge,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[Q,$]})]}),e[34]=Q,e[35]=$,e[36]=Y):Y=e[36],Y}let I;e[37]!==C||e[38]!==N?(I=D=>{const{field:Q}=D;return o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:N.flatMap(Rn),value:Q.value,onChange:Q.onChange,disabled:C,ariaLabel:"Propriedade do Google Analytics"})}),o.jsx(le,{})]})},e[37]=C,e[38]=N,e[39]=I):I=e[39];let F;e[40]!==b.control||e[41]!==I?(F=o.jsx(re,{control:b.control,name:"propertyId",render:I}),e[40]=b.control,e[41]=I,e[42]=F):F=e[42];let P;e[43]!==b||e[44]!==F?(P=o.jsx(ve,{...b,children:F}),e[43]=b,e[44]=F,e[45]=P):P=e[45];let T;e[46]!==O?(T=O&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:O instanceof Error?O.message:"Não foi possível salvar a configuração"}),e[46]=O,e[47]=T):T=e[47];let L;e[48]!==C||e[49]!==u?(L=u?o.jsx("button",{type:"button",onClick:u,disabled:C,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):o.jsx("span",{}),e[48]=C,e[49]=u,e[50]=L):L=e[50];let A;e[51]!==C||e[52]!==a?(A=o.jsx(Z,{type:"button",variant:"outline",onClick:a,disabled:C,children:"Cancelar"}),e[51]=C,e[52]=a,e[53]=A):A=e[53];const U=C?"Salvando...":"Salvar";let B;e[54]!==C||e[55]!==U?(B=o.jsx(Z,{type:"submit",disabled:C,children:U}),e[54]=C,e[55]=U,e[56]=B):B=e[56];let M;e[57]!==A||e[58]!==B?(M=o.jsxs("div",{className:"flex gap-2",children:[A,B]}),e[57]=A,e[58]=B,e[59]=M):M=e[59];let K;e[60]!==L||e[61]!==M?(K=o.jsxs(ge,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[L,M]}),e[60]=L,e[61]=M,e[62]=K):K=e[62];let q;return e[63]!==w||e[64]!==P||e[65]!==T||e[66]!==K?(q=o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[P,T,K]}),e[63]=w,e[64]=P,e[65]=T,e[66]=K,e[67]=q):q=e[67],q}function Rn(n){return n.options}function Fn(n){return n.options}const Ln=n=>xe({siteUrl:ie().min(1,n("commerceOnboarding.googleSearchConsoleConfigForm.siteRequired"))});function Kn(n){const e=G.c(83),{card:t,connectionId:s,companionClient:i,selfClient:l,org:r,contextSiteUrl:a,onDone:u,onIsPendingChange:p}=n,d=te();let c;e[0]!==s||e[1]!==r.id?(c=J.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=c):c=e[2];let f;e[3]!==i?(f=async()=>{const R=await i.callTool({name:"list_sites",arguments:{}});return ee(R).sites||[]},e[3]=i,e[4]=f):f=e[4];let m;e[5]!==c||e[6]!==f?(m={queryKey:c,queryFn:f},e[5]=c,e[6]=f,e[7]=m):m=e[7];const y=be(m);let x;e[8]!==d?(x=Ce(Ln(d)),e[8]=d,e[9]=x):x=e[9];const h=t.configurationState?.siteUrl||"";let b;e[10]!==h?(b={siteUrl:h},e[10]=h,e[11]=b):b=e[11];let g;e[12]!==x||e[13]!==b?(g={resolver:x,defaultValues:b},e[12]=x,e[13]=b,e[14]=g):g=e[14];const S=Se(g);let C;e[15]!==t||e[16]!==u||e[17]!==r||e[18]!==l?(C={card:t,selfClient:l,org:r,onDone:u},e[15]=t,e[16]=u,e[17]=r,e[18]=l,e[19]=C):C=e[19];const{save:O,isPending:j,error:_}=Ee(C),v=H.useRef(!1),w=t.configurationState?.siteUrl;let E,N;e[20]!==j||e[21]!==p?(N=()=>{p?.(j)},E=[j,p],e[20]=j,e[21]=p,e[22]=E,e[23]=N):(E=e[22],N=e[23]),H.useEffect(N,E);let k,I;e[24]!==a||e[25]!==S||e[26]!==w||e[27]!==y.data||e[28]!==y.isSuccess?(k=()=>{if(!(v.current||!y.isSuccess)){if(v.current=!0,w){S.getValues("siteUrl")!==w&&S.setValue("siteUrl",w);return}if(!S.getValues("siteUrl")){const R=Sn(a,y.data??[]);R&&S.setValue("siteUrl",R)}}},I=[y.isSuccess,y.data,w,a,S],e[24]=a,e[25]=S,e[26]=w,e[27]=y.data,e[28]=y.isSuccess,e[29]=k,e[30]=I):(k=e[29],I=e[30]),H.useEffect(k,I);let F;if(e[31]!==S||e[32]!==O){let R;e[34]!==O?(R=async z=>{O(z)},e[34]=O,e[35]=R):R=e[35],F=S.handleSubmit(R),e[31]=S,e[32]=O,e[33]=F}else F=e[33];const P=F;if(y.isLoading){let R;e[36]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.loadingSites"),e[36]=d,e[37]=R):R=e[37];let z;return e[38]!==R?(z=o.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:o.jsx(Be,{label:R})}),e[38]=R,e[39]=z):z=e[39],z}if(y.isError){let R;e[40]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.loadSitesError"),e[40]=d,e[41]=R):R=e[41];let z;return e[42]!==R?(z=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-destructive",children:R})}),e[42]=R,e[43]=z):z=e[43],z}let T;e[44]!==y.data?(T=y.data||[],e[44]=y.data,e[45]=T):T=e[45];const L=T;if(L.length===0){let R;e[46]!==d?(R=d("commerceOnboarding.googleSearchConsoleConfigForm.noSitesFound"),e[46]=d,e[47]=R):R=e[47];let z;return e[48]!==R?(z=o.jsx("div",{className:"space-y-4",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:R})}),e[48]=R,e[49]=z):z=e[49],z}let A;e[50]!==j||e[51]!==L||e[52]!==d?(A=R=>{const{field:z}=R;return o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:L.map(An),value:z.value,onChange:z.onChange,disabled:j,ariaLabel:d("commerceOnboarding.googleSearchConsoleConfigForm.siteAriaLabel")})}),o.jsx(le,{})]})},e[50]=j,e[51]=L,e[52]=d,e[53]=A):A=e[53];let U;e[54]!==S.control||e[55]!==A?(U=o.jsx(re,{control:S.control,name:"siteUrl",render:A}),e[54]=S.control,e[55]=A,e[56]=U):U=e[56];let B;e[57]!==S||e[58]!==U?(B=o.jsx(ve,{...S,children:U}),e[57]=S,e[58]=U,e[59]=B):B=e[59];let M;e[60]!==_||e[61]!==d?(M=_&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:d("commerceOnboarding.googleSearchConsoleConfigForm.savingError")}),e[60]=_,e[61]=d,e[62]=M):M=e[62];let K;e[63]!==d?(K=d("commerceOnboarding.googleSearchConsoleConfigForm.cancelButton"),e[63]=d,e[64]=K):K=e[64];let q;e[65]!==j||e[66]!==u||e[67]!==K?(q=o.jsx(Z,{type:"button",variant:"outline",onClick:u,disabled:j,children:K}),e[65]=j,e[66]=u,e[67]=K,e[68]=q):q=e[68];let D;e[69]!==j||e[70]!==d?(D=d(j?"commerceOnboarding.googleSearchConsoleConfigForm.savingButton":"commerceOnboarding.googleSearchConsoleConfigForm.saveButton"),e[69]=j,e[70]=d,e[71]=D):D=e[71];let Q;e[72]!==j||e[73]!==D?(Q=o.jsx(Z,{type:"submit",disabled:j,children:D}),e[72]=j,e[73]=D,e[74]=Q):Q=e[74];let $;e[75]!==q||e[76]!==Q?($=o.jsxs(ge,{className:"pt-4",children:[q,Q]}),e[75]=q,e[76]=Q,e[77]=$):$=e[77];let Y;return e[78]!==P||e[79]!==B||e[80]!==M||e[81]!==$?(Y=o.jsxs("form",{onSubmit:P,className:"space-y-4",children:[B,M,$]}),e[78]=P,e[79]=B,e[80]=M,e[81]=$,e[82]=Y):Y=e[82],Y}function An(n){return{value:n.siteUrl,label:n.siteUrl}}function Dn(n){const[e,t]=n.split("/");return!e||!t?null:{owner:e,name:t}}function Pn(n){const{existingRepo:e,owner:t,name:s}=n;return e?.connectionId&&e.owner.toLowerCase()===t.toLowerCase()&&e.name.toLowerCase()===s.toLowerCase()?{connectionId:e.connectionId,installationId:e.installationId}:null}function Bn(n){const{existingRepo:e,existingConnections:t,repoConnectionId:s}=n,i=e?.connectionId&&e.connectionId!==s?e.connectionId:void 0,l=[...t.filter(r=>r.connection_id!==s&&r.connection_id!==i),{connection_id:s,selected_tools:[]}];return{staleConnectionId:i,mergedConnections:l}}const qn=xe({githubRepo:ie().min(1,"commerceOnboarding.githubConfigForm.selectRepository")}),Un=15e3,$n=/^[\w.-]+\/[\w.-]+$/;async function Mn(n,e,t,s){const{installations:i}=await it(n,t),l=s.trim(),r=await Promise.allSettled(i.map(async d=>{const c=d.type==="User"?"user":"org",f=l?`${c}:${d.login} ${l} in:name`:`${c}:${d.login}`,y=await e.callTool({name:"search_repositories",arguments:{query:f,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Un)}),x=y.content?.[0]?.text;if(y.isError)throw new Error(x??"search_repositories failed");if(!x)throw new Error("empty search_repositories response");return JSON.parse(x).items??[]})),a=new Map;let u=0;for(const d of r){if(d.status==="rejected"){u+=1;continue}for(const c of d.value)c.full_name&&!a.has(c.full_name)&&a.set(c.full_name,c)}return{repos:Array.from(a.values()).sort((d,c)=>(c.updated_at??"").localeCompare(d.updated_at??"")).map(d=>d.full_name),failed:u,total:i.length}}function Qn({connectionId:n,companionClient:e,selfClient:t,org:s,onDone:i,onIsPendingChange:l}){const r=te(),a=ye(),u=Je.COMMERCE_DISCOVERY(s.id),[p,d]=H.useState(""),c=Vt(p,300),f=H.useRef(!1),m=be({queryKey:J.commerceDiscoveryCompanionGithubSelected(s.id,n),queryFn:async()=>{const N=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:u}}),k=ee(N).item?.configuration_state??null;return typeof k?.github_repo=="string"?k.github_repo:""}}),y=be({queryKey:J.commerceDiscoveryCompanionGithubRepos(s.id,n,c.trim()),queryFn:()=>Mn(N=>t.callTool(N),e,n,c)}),x=Se({resolver:Ce(qn),defaultValues:{githubRepo:""}}),h=Te({mutationFn:async N=>{const k=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:u}}),F={...ee(k).item?.configuration_state??null??{},github_repo:N};await t.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:u,data:{configuration_state:F}}});const P=Dn(N);if(!P)throw new Error(r("commerceOnboarding.githubConfigForm.invalidRepository",{repo:N}));const{owner:T,name:L}=P,A=kt(s.id),U=ee(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:A}})).item,B=U?.metadata?.githubRepo,M=U?.connections??[],K=Pn({existingRepo:B,owner:T,name:L});let q=K?.connectionId,D=K?.installationId,Q;if(!q){const{installations:R}=await it(X=>t.callTool(X),n),z=Bt(R,T);if(!z)throw new Error(r("commerceOnboarding.githubConfigForm.noGithubInstallation",{owner:T}));D=z.installationId;const ne=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}})).item;if(!ne)throw new Error(r("commerceOnboarding.githubConfigForm.githubConnectionNotFound"));const{childConnectionId:oe,reused:W}=await qt({orgSlug:s.slug,sourceConnection:ne,installationId:D,owner:T,repo:L,githubCallTool:X=>e.callTool(X),selfCallTool:X=>t.callTool(X)});q=oe,Q=W?void 0:oe}const{staleConnectionId:$,mergedConnections:Y}=Bn({existingRepo:B,existingConnections:M,repoConnectionId:q});try{if(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:A,data:{connections:Y,metadata:{githubRepo:{owner:T,name:L,url:`https://github.com/${N}`,installationId:D,connectionId:q}}}}}),$){const R=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:$}})).item;R&&!Ut(R)&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:$,force:!0}}).catch(()=>{})}}catch(R){throw Q&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:Q,force:!0}}).catch(()=>{}),R}},onSuccess:async()=>{await a.invalidateQueries({queryKey:J.commerceDiscoveryConnection(s.id,u)}),await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),Nt(a,s.id),i()}}),b=h.isPending;H.useEffect(()=>{l?.(b)},[b,l]);const g=m.data??"";H.useEffect(()=>{!m.isSuccess||f.current||(f.current=!0,m.data&&x.setValue("githubRepo",m.data))},[m.isSuccess,m.data,x]);const S=x.handleSubmit(async N=>{h.mutate(N.githubRepo)}),C=y.data?.repos??[],O=y.data?.failed??0,j=y.data?.total??0,_=c.trim(),v=[...C];_&&$n.test(_)&&!v.includes(_)&&v.unshift(_),g&&!v.includes(g)&&v.push(g);const w=j>0&&O===j,E=y.isError||w?r("commerceOnboarding.githubConfigForm.searchFailedTotal"):O>0?r("commerceOnboarding.githubConfigForm.searchFailedPartial"):null;return o.jsxs("form",{onSubmit:S,className:"space-y-4",children:[o.jsxs("div",{className:"relative",children:[o.jsx(st,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),o.jsx(pe,{type:"text",value:p,onChange:N=>d(N.target.value),disabled:b,placeholder:r("commerceOnboarding.githubConfigForm.searchRepositoryPlaceholder"),"aria-label":r("commerceOnboarding.githubConfigForm.searchRepositoryLabel"),className:"h-8 pl-8"})]}),y.isLoading?o.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:o.jsx(Be,{label:r("commerceOnboarding.githubConfigForm.loadingRepositories")})}):o.jsxs(o.Fragment,{children:[E&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E}),v.length===0?!E&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r("commerceOnboarding.githubConfigForm.noRepositoriesFound")}):o.jsx(ve,{...x,children:o.jsx(re,{control:x.control,name:"githubRepo",render:({field:N})=>o.jsxs(ae,{children:[o.jsx(ce,{children:o.jsx(Pe,{options:v.map(k=>({value:k,label:k})),value:N.value,onChange:N.onChange,disabled:b,ariaLabel:"Repositório",hideSearch:!0})}),o.jsx(le,{})]})})})]}),h.error&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:h.error instanceof Error?h.error.message:r("commerceOnboarding.githubConfigForm.failedToSave")}),o.jsxs(ge,{className:"pt-4",children:[o.jsx(Z,{type:"button",variant:"outline",onClick:i,disabled:b,children:r("commerceOnboarding.githubConfigForm.cancel")}),o.jsx(Z,{type:"submit",disabled:b,children:r(b?"commerceOnboarding.githubConfigForm.saving":"commerceOnboarding.githubConfigForm.save")})]})]})}const mt={vtex:Nn,shopify:En,"google-analytics":kn,"google-search-console":Kn,github:Qn},we="deco-reader@decocms.iam.gserviceaccount.com",ft={"google-analytics":"ga4","google-search-console":"gsc"},zn={ga4:{label:"Google Analytics",consoleUrl:"https://analytics.google.com/analytics/web/#/admin",consoleLinkKey:"commerceOnboarding.saBinding.ga4.openConsole",steps:["commerceOnboarding.saBinding.ga4.step1","commerceOnboarding.saBinding.ga4.step2","commerceOnboarding.saBinding.ga4.step3"],resourceLabelKey:"commerceOnboarding.saBinding.ga4.resourceLabel",resourcePlaceholderKey:"commerceOnboarding.saBinding.ga4.resourcePlaceholder",resourceHintKey:"commerceOnboarding.saBinding.ga4.resourceHint"},gsc:{label:"Google Search Console",consoleUrl:"https://search.google.com/search-console",consoleLinkKey:"commerceOnboarding.saBinding.gsc.openConsole",steps:["commerceOnboarding.saBinding.gsc.step1","commerceOnboarding.saBinding.gsc.step2","commerceOnboarding.saBinding.gsc.step3"],resourceLabelKey:"commerceOnboarding.saBinding.gsc.resourceLabel",resourcePlaceholderKey:"commerceOnboarding.saBinding.gsc.resourcePlaceholder",resourceHintKey:"commerceOnboarding.saBinding.gsc.resourceHint"}};function Vn(n,e){switch(e){case"no-access":return{titleKey:"commerceOnboarding.saBinding.remediation.noAccess.title",stepKeys:n==="ga4"?["commerceOnboarding.saBinding.remediation.noAccess.ga4.1","commerceOnboarding.saBinding.remediation.noAccess.ga4.2","commerceOnboarding.saBinding.remediation.noAccess.ga4.3"]:["commerceOnboarding.saBinding.remediation.noAccess.gsc.1","commerceOnboarding.saBinding.remediation.noAccess.gsc.2","commerceOnboarding.saBinding.remediation.noAccess.gsc.3"]};case"no-web-stream":return{titleKey:"commerceOnboarding.saBinding.remediation.noWebStream.title",stepKeys:["commerceOnboarding.saBinding.remediation.noWebStream.1","commerceOnboarding.saBinding.remediation.noWebStream.2","commerceOnboarding.saBinding.remediation.noWebStream.3","commerceOnboarding.saBinding.remediation.noWebStream.4"]};case"no-match":return{titleKey:"commerceOnboarding.saBinding.remediation.noMatch.title",stepKeys:n==="ga4"?["commerceOnboarding.saBinding.remediation.noMatch.ga4.1","commerceOnboarding.saBinding.remediation.noMatch.ga4.2"]:["commerceOnboarding.saBinding.remediation.noMatch.gsc.1","commerceOnboarding.saBinding.remediation.noMatch.gsc.2"]};case"resource_already_bound":return{titleKey:"commerceOnboarding.saBinding.remediation.alreadyBound.title",stepKeys:["commerceOnboarding.saBinding.remediation.alreadyBound.1","commerceOnboarding.saBinding.remediation.alreadyBound.2"]};default:return{titleKey:"commerceOnboarding.saBinding.remediation.unknown.title",stepKeys:["commerceOnboarding.saBinding.remediation.unknown.1","commerceOnboarding.saBinding.remediation.unknown.2"]}}}function Hn(n){const e=G.c(96),{provider:t,siteUrl:s,siteHost:i,selfClient:l,org:r,initialResourceId:a,onDone:u,onIsPendingChange:p,onOAuthInstead:d}=n,c=te(),f=zn[t],m=ye(),[y,x]=H.useState(null);let h;e[0]!==i||e[1]!==c?(h=i||c("commerceOnboarding.saBinding.sampleDomain"),e[0]=i,e[1]=c,e[2]=h):h=e[2];const b=h;let g,S;if(e[3]!==f.resourceLabelKey||e[4]!==c){const W=xe({resourceId:ie().trim().min(1,c("commerceOnboarding.saBindingForm.resourceIdRequired",{resourceLabel:c(f.resourceLabelKey).toLowerCase()}))});S=Se,g=Ce(W),e[3]=f.resourceLabelKey,e[4]=c,e[5]=g,e[6]=S}else g=e[5],S=e[6];const C=a??"";let O;e[7]!==C?(O={resourceId:C},e[7]=C,e[8]=O):O=e[8];let j;e[9]!==g||e[10]!==O?(j={resolver:g,defaultValues:O},e[9]=g,e[10]=O,e[11]=j):j=e[11];const _=S(j);let v;e[12]!==t||e[13]!==l||e[14]!==s||e[15]!==c?(v=async W=>{if(!s)throw new Error(c("commerceOnboarding.saBindingForm.storeUrlUnavailable"));const X=await l.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:s,provider:t,resourceId:W.resourceId}});return ee(X)},e[12]=t,e[13]=l,e[14]=s,e[15]=c,e[16]=v):v=e[16];let w,E;e[17]!==p?(w=()=>p?.(!0),E=()=>p?.(!1),e[17]=p,e[18]=w,e[19]=E):(w=e[18],E=e[19]);let N;e[20]!==f.label||e[21]!==u||e[22]!==r||e[23]!==t||e[24]!==m||e[25]!==s||e[26]!==c?(N=async W=>{if(W.ok){x(null),_e.success(c("commerceOnboarding.saBindingForm.connectedSuccess",{label:f.label})),s&&await m.invalidateQueries({queryKey:J.commerceDiscoveryConnectionStatus(r.id,s)}),u();return}x({...Vn(t,W.reason??"unknown"),detail:W.detail})},e[20]=f.label,e[21]=u,e[22]=r,e[23]=t,e[24]=m,e[25]=s,e[26]=c,e[27]=N):N=e[27];let k;e[28]!==N||e[29]!==v||e[30]!==w||e[31]!==E?(k={mutationFn:v,onMutate:w,onSettled:E,onSuccess:N},e[28]=N,e[29]=v,e[30]=w,e[31]=E,e[32]=k):k=e[32];const I=Te(k);let F;if(e[33]!==_||e[34]!==I){let W;e[36]!==I?(W=X=>I.mutate(X),e[36]=I,e[37]=W):W=e[37],F=_.handleSubmit(W),e[33]=_,e[34]=I,e[35]=F}else F=e[35];const P=F,T=I.isPending;let L;e[38]!==c?(L=()=>{navigator.clipboard?.writeText(we),_e.success(c("commerceOnboarding.saBindingForm.emailCopied"))},e[38]=c,e[39]=L):L=e[39];const A=L;let U;e[40]!==f.consoleLinkKey||e[41]!==f.consoleUrl||e[42]!==f.resourceHintKey||e[43]!==f.resourceLabelKey||e[44]!==f.resourcePlaceholderKey||e[45]!==A||e[46]!==_||e[47]!==b||e[48]!==T||e[49]!==c?(U=W=>W===0?o.jsxs("a",{href:f.consoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground underline underline-offset-2 hover:text-foreground",children:[o.jsx(Ht,{size:14}),c(f.consoleLinkKey)]}):W===1?o.jsxs("div",{className:"flex w-full items-center gap-2 rounded-lg border border-input bg-muted/40 p-2",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:we}),o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",onClick:A,"aria-label":c("commerceOnboarding.saBindingForm.copyEmailLabel"),children:o.jsx(ct,{size:16})})]}):o.jsx(ve,{..._,children:o.jsx(re,{control:_.control,name:"resourceId",render:X=>{const{field:de}=X;return o.jsxs(ae,{className:"w-full",children:[o.jsx(ce,{children:o.jsx(pe,{...de,placeholder:c(f.resourcePlaceholderKey,{host:b}),disabled:T,autoComplete:"off","aria-label":c(f.resourceLabelKey)})}),o.jsx($t,{children:c(f.resourceHintKey,{host:b})}),o.jsx(le,{})]})}})}),e[40]=f.consoleLinkKey,e[41]=f.consoleUrl,e[42]=f.resourceHintKey,e[43]=f.resourceLabelKey,e[44]=f.resourcePlaceholderKey,e[45]=A,e[46]=_,e[47]=b,e[48]=T,e[49]=c,e[50]=U):U=e[50];const B=U;let M;if(e[51]!==B||e[52]!==f.steps||e[53]!==b||e[54]!==c){let W;e[56]!==B||e[57]!==b||e[58]!==c?(W=(X,de)=>o.jsxs("li",{className:"flex gap-3 rounded-lg border border-border p-4",children:[o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-medium text-foreground",children:de+1}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2",children:[o.jsx("p",{className:"text-sm leading-5 text-foreground",children:c(X,{host:b})}),B(de)]})]},X),e[56]=B,e[57]=b,e[58]=c,e[59]=W):W=e[59],M=f.steps.map(W),e[51]=B,e[52]=f.steps,e[53]=b,e[54]=c,e[55]=M}else M=e[55];let K;e[60]!==M?(K=o.jsx("ol",{className:"space-y-2",children:M}),e[60]=M,e[61]=K):K=e[61];let q;e[62]!==f.label||e[63]!==y||e[64]!==c?(q=y&&o.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:c(y.titleKey,{label:f.label})}),o.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:y.stepKeys.map(W=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{"aria-hidden":!0,children:"•"}),o.jsx("span",{children:c(W,{email:we})})]},W))})]}),e[62]=f.label,e[63]=y,e[64]=c,e[65]=q):q=e[65];let D;e[66]!==I.error||e[67]!==I.isError||e[68]!==c?(D=I.isError&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I.error instanceof Error?I.error.message:c("commerceOnboarding.saBindingForm.bindError")}),e[66]=I.error,e[67]=I.isError,e[68]=c,e[69]=D):D=e[69];let Q;e[70]!==T||e[71]!==d||e[72]!==c?(Q=d&&o.jsxs("p",{className:"text-sm leading-5 text-muted-foreground",children:[c("commerceOnboarding.saBinding.oauthNote")," ",o.jsx("button",{type:"button",onClick:d,disabled:T,className:"underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:c("commerceOnboarding.saBindingForm.googleLoginAlternative")})]}),e[70]=T,e[71]=d,e[72]=c,e[73]=Q):Q=e[73];let $;e[74]!==c?($=c("commerceOnboarding.saBindingForm.cancel"),e[74]=c,e[75]=$):$=e[75];let Y;e[76]!==T||e[77]!==u||e[78]!==$?(Y=o.jsx(Z,{type:"button",variant:"outline",onClick:u,disabled:T,children:$}),e[76]=T,e[77]=u,e[78]=$,e[79]=Y):Y=e[79];let R;e[80]!==T||e[81]!==c?(R=c(T?"commerceOnboarding.saBindingForm.verifying":"commerceOnboarding.saBindingForm.bind"),e[80]=T,e[81]=c,e[82]=R):R=e[82];let z;e[83]!==T||e[84]!==R?(z=o.jsx(Z,{type:"submit",disabled:T,children:R}),e[83]=T,e[84]=R,e[85]=z):z=e[85];let ne;e[86]!==Y||e[87]!==z?(ne=o.jsxs(ge,{className:"gap-2",children:[Y,z]}),e[86]=Y,e[87]=z,e[88]=ne):ne=e[88];let oe;return e[89]!==P||e[90]!==K||e[91]!==q||e[92]!==D||e[93]!==Q||e[94]!==ne?(oe=o.jsxs("form",{onSubmit:P,className:"space-y-5",children:[K,q,D,Q,ne]}),e[89]=P,e[90]=K,e[91]=q,e[92]=D,e[93]=Q,e[94]=ne,e[95]=oe):oe=e[95],oe}function Gn(){const n=G.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0];let t;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t=o.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,o.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[o.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),o.jsx("div",{className:"hidden h-3 w-full animate-pulse rounded bg-muted/60 sm:block"})]}),o.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),n[1]=t):t=n[1],t}function Ge(n){const e=G.c(17),{title:t,disconnecting:s,disabled:i,onDisconnect:l}=n,r=te(),a=i||s;let u;e[0]!==r||e[1]!==t?(u=r("commerceOnboarding.companionCard.disconnectAriaLabel",{title:t}),e[0]=r,e[1]=t,e[2]=u):u=e[2];let p;e[3]!==s?(p=s?o.jsx(Re,{className:"size-4"}):o.jsx(Lt,{size:16}),e[3]=s,e[4]=p):p=e[4];let d;e[5]!==l||e[6]!==a||e[7]!==u||e[8]!==p?(d=o.jsx(Le,{asChild:!0,children:o.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:a,onClick:l,"aria-label":u,children:p})}),e[5]=l,e[6]=a,e[7]=u,e[8]=p,e[9]=d):d=e[9];let c;e[10]!==r?(c=r("commerceOnboarding.companionCard.disconnect"),e[10]=r,e[11]=c):c=e[11];let f;e[12]!==c?(f=o.jsx(Ke,{children:c}),e[12]=c,e[13]=f):f=e[13];let m;return e[14]!==d||e[15]!==f?(m=o.jsxs(Fe,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16],m}function Wn(n){const e=G.c(23),{card:t,connecting:s,disconnecting:i,disabled:l,onConnect:r,onDisconnect:a,org:u,selfClient:p,siteUrl:d,autoOpenConfigFieldKey:c,onAutoOpenConfigHandled:f}=n,m=t.linkedConnectionId,y=ft[t.bindingType],x=!!y&&t.boundVia!=="oauth",h=t.satisfied&&!t.configured;let b;e[0]!==c||e[1]!==t||e[2]!==s||e[3]!==l||e[4]!==i||e[5]!==m||e[6]!==h||e[7]!==f||e[8]!==r||e[9]!==a||e[10]!==u||e[11]!==y||e[12]!==p||e[13]!==d||e[14]!==x?(b=x&&y?o.jsx(Yn,{card:t,provider:y,org:u,selfClient:p,siteUrl:d,onOAuthInstead:r,disabled:l,connecting:s,primary:t.required}):t.satisfied&&m?h?o.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[o.jsx(H.Suspense,{fallback:o.jsx(We,{}),children:o.jsx(Ye,{card:t,org:u,selfClient:p,connectionId:m,contextSiteUrl:d,variant:"configure",disabled:l,autoOpen:He({autoOpenFieldKey:c,card:t}),onAutoOpenHandled:f})}),o.jsx(Ge,{title:t.title,disconnecting:i,disabled:l,onDisconnect:a})]}):o.jsx(dt,{detail:t.connectedDetail,controls:o.jsxs(o.Fragment,{children:[o.jsx(H.Suspense,{fallback:o.jsx(We,{}),children:o.jsx(Ye,{card:t,org:u,selfClient:p,connectionId:m,contextSiteUrl:d,variant:"gear",disabled:l,autoOpen:He({autoOpenFieldKey:c,card:t}),onAutoOpenHandled:f})}),o.jsx(Ge,{title:t.title,disconnecting:i,disabled:l,onDisconnect:a})]})}):o.jsx(lt,{connecting:s,disabled:l,title:t.title,primary:t.required,onConnect:r}),e[0]=c,e[1]=t,e[2]=s,e[3]=l,e[4]=i,e[5]=m,e[6]=h,e[7]=f,e[8]=r,e[9]=a,e[10]=u,e[11]=y,e[12]=p,e[13]=d,e[14]=x,e[15]=b):b=e[15];const g=b,S=t.required&&!t.satisfied;let C;return e[16]!==g||e[17]!==t.headline||e[18]!==t.icon||e[19]!==t.title||e[20]!==h||e[21]!==S?(C=o.jsx(o.Fragment,{children:o.jsx(On,{icon:t.icon,title:t.title,headline:t.headline,required:S,attention:h,action:g})}),e[16]=g,e[17]=t.headline,e[18]=t.icon,e[19]=t.title,e[20]=h,e[21]=S,e[22]=C):C=e[22],C}function Yn(n){const e=G.c(22),{card:t,provider:s,org:i,selfClient:l,siteUrl:r,onOAuthInstead:a,disabled:u,connecting:p,primary:d}=n,c=te(),[f,m]=H.useState(!1);let y;e[0]!==t.connectedDetail||e[1]!==t.satisfied||e[2]!==t.title||e[3]!==p||e[4]!==u||e[5]!==d||e[6]!==c?(y=t.satisfied?o.jsx(dt,{detail:t.connectedDetail,controls:o.jsxs(Fe,{children:[o.jsx(Le,{asChild:!0,children:o.jsx(ut,{ariaLabel:c("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>m(!0)})}),o.jsx(Ke,{children:c("commerceOnboarding.companionCard.editConfiguration")})]})}):o.jsx(lt,{connecting:p,disabled:u,title:t.title,primary:d,onConnect:()=>m(!0)}),e[0]=t.connectedDetail,e[1]=t.satisfied,e[2]=t.title,e[3]=p,e[4]=u,e[5]=d,e[6]=c,e[7]=y):y=e[7];let x;e[8]!==t.satisfied||e[9]!==a?(x=t.satisfied?void 0:()=>{m(!1),a()},e[8]=t.satisfied,e[9]=a,e[10]=x):x=e[10];let h;e[11]!==t||e[12]!==f||e[13]!==i||e[14]!==s||e[15]!==l||e[16]!==r||e[17]!==x?(h=o.jsx(Zn,{card:t,provider:s,org:i,selfClient:l,siteUrl:r,open:f,onOpenChange:m,onOAuthInstead:x}),e[11]=t,e[12]=f,e[13]=i,e[14]=s,e[15]=l,e[16]=r,e[17]=x,e[18]=h):h=e[18];let b;return e[19]!==y||e[20]!==h?(b=o.jsxs(o.Fragment,{children:[y,h]}),e[19]=y,e[20]=h,e[21]=b):b=e[21],b}function Zn(n){const e=G.c(31),{card:t,provider:s,org:i,selfClient:l,siteUrl:r,open:a,onOpenChange:u,onOAuthInstead:p}=n,[d,c]=H.useState(!1);let f;e[0]!==u||e[1]!==d?(f=_=>{!_&&d||u(_)},e[0]=u,e[1]=d,e[2]=f):f=e[2];const m=f;let y;e[3]!==t.icon||e[4]!==t.title?(y=o.jsx(De,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1"}),e[3]=t.icon,e[4]=t.title,e[5]=y):y=e[5];let x;e[6]!==t.title?(x=o.jsx(Xe,{className:"min-w-0 flex-1",children:t.title}),e[6]=t.title,e[7]=x):x=e[7];let h;e[8]!==y||e[9]!==x?(h=o.jsxs(et,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[y,x]}),e[8]=y,e[9]=x,e[10]=h):h=e[10];let b;e[11]!==r?(b=on(r),e[11]=r,e[12]=b):b=e[12];const g=t.boundResource??void 0;let S;e[13]!==u?(S=()=>u(!1),e[13]=u,e[14]=S):S=e[14];let C;e[15]!==p||e[16]!==i||e[17]!==s||e[18]!==l||e[19]!==r||e[20]!==b||e[21]!==g||e[22]!==S?(C=o.jsx(Hn,{provider:s,siteUrl:r,siteHost:b,selfClient:l,org:i,initialResourceId:g,onDone:S,onIsPendingChange:c,onOAuthInstead:p}),e[15]=p,e[16]=i,e[17]=s,e[18]=l,e[19]=r,e[20]=b,e[21]=g,e[22]=S,e[23]=C):C=e[23];let O;e[24]!==h||e[25]!==C?(O=o.jsxs(tt,{"aria-describedby":void 0,className:"max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg",children:[h,C]}),e[24]=h,e[25]=C,e[26]=O):O=e[26];let j;return e[27]!==m||e[28]!==a||e[29]!==O?(j=o.jsx(nt,{open:a,onOpenChange:m,children:O}),e[27]=m,e[28]=a,e[29]=O,e[30]=j):j=e[30],j}function We(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0],e}function Ye(n){const e=G.c(25),{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,variant:a,disabled:u,autoOpen:p,onAutoOpenHandled:d}=n,c=te(),[f,m]=H.useState(p);let y;e[0]!==t.configurationState||e[1]!==c?(y=hn(t.configurationState,c),e[0]=t.configurationState,e[1]=c,e[2]=y):y=e[2];const x=y;let h;e[3]!==p||e[4]!==d?(h=()=>{m(!1),p&&d()},e[3]=p,e[4]=d,e[5]=h):h=e[5];const b=h;if(!mt[t.bindingType])return null;let g;e[6]!==t.title||e[7]!==u||e[8]!==x||e[9]!==c||e[10]!==a?(g=a==="configure"?o.jsx(jn,{disabled:u,title:t.title,onConfigure:()=>m(!0)}):o.jsxs(Fe,{children:[o.jsx(Le,{asChild:!0,children:o.jsx(ut,{ariaLabel:c("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>m(!0)})}),o.jsx(Ke,{children:x.length>0?c("commerceOnboarding.companionCard.editConfiguration"):c("commerceOnboarding.companionCard.configure")})]}),e[6]=t.title,e[7]=u,e[8]=x,e[9]=c,e[10]=a,e[11]=g):g=e[11];const S=g;let C;e[12]!==b?(C=_=>_?m(!0):b(),e[12]=b,e[13]=C):C=e[13];let O;e[14]!==t||e[15]!==l||e[16]!==r||e[17]!==f||e[18]!==s||e[19]!==i||e[20]!==C?(O=o.jsx(Jn,{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,open:f,onOpenChange:C}),e[14]=t,e[15]=l,e[16]=r,e[17]=f,e[18]=s,e[19]=i,e[20]=C,e[21]=O):O=e[21];let j;return e[22]!==O||e[23]!==S?(j=o.jsxs(o.Fragment,{children:[S,O]}),e[22]=O,e[23]=S,e[24]=j):j=e[24],j}function Jn(n){const e=G.c(59),{card:t,org:s,selfClient:i,connectionId:l,contextSiteUrl:r,open:a,onOpenChange:u}=n,p=te();let d;e[0]!==l||e[1]!==s.id||e[2]!==s.slug?(d={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=l,e[1]=s.id,e[2]=s.slug,e[3]=d):d=e[3];const c=Ae(d),[f,m]=H.useState(!1),y=ye(),x=mt[t.bindingType];let h;e[4]!==l||e[5]!==i?(h=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:l,force:!0}})},e[4]=l,e[5]=i,e[6]=h):h=e[6];let b;e[7]!==t.title||e[8]!==u||e[9]!==s.id||e[10]!==y||e[11]!==p?(b=async()=>{await y.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),_e.success(p("commerceOnboarding.companionCard.disconnectedSuccess",{title:t.title})),u(!1)},e[7]=t.title,e[8]=u,e[9]=s.id,e[10]=y,e[11]=p,e[12]=b):b=e[12];let g;e[13]!==p?(g=()=>{_e.error(p("commerceOnboarding.companionCard.disconnectError"))},e[13]=p,e[14]=g):g=e[14];let S;e[15]!==h||e[16]!==b||e[17]!==g?(S={mutationFn:h,onSuccess:b,onError:g},e[15]=h,e[16]=b,e[17]=g,e[18]=S):S=e[18];const C=Te(S);if(!x)return null;let O;e[19]!==f||e[20]!==u?(O=A=>{!A&&f||u(A)},e[19]=f,e[20]=u,e[21]=O):O=e[21];const j=O;let _;e[22]!==t.icon||e[23]!==t.title?(_=o.jsx(De,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1"}),e[22]=t.icon,e[23]=t.title,e[24]=_):_=e[24];let v;e[25]!==t.title?(v=o.jsx(Xe,{children:t.title}),e[25]=t.title,e[26]=v):v=e[26];let w;e[27]!==t.title||e[28]!==p?(w=p("commerceOnboarding.companionCard.configureDescription",{title:t.title}),e[27]=t.title,e[28]=p,e[29]=w):w=e[29];let E;e[30]!==w?(E=o.jsx(Ft,{children:w}),e[30]=w,e[31]=E):E=e[31];let N;e[32]!==E||e[33]!==v?(N=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[v,E]}),e[32]=E,e[33]=v,e[34]=N):N=e[34];let k;e[35]!==N||e[36]!==_?(k=o.jsxs(et,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[_,N]}),e[35]=N,e[36]=_,e[37]=k):k=e[37];let I;e[38]!==u?(I=()=>u(!1),e[38]=u,e[39]=I):I=e[39];let F;e[40]!==C?(F=()=>C.mutate(),e[40]=C,e[41]=F):F=e[41];let P;e[42]!==x||e[43]!==t||e[44]!==c||e[45]!==l||e[46]!==r||e[47]!==s||e[48]!==i||e[49]!==I||e[50]!==F?(P=o.jsx(x,{card:t,connectionId:l,companionClient:c,selfClient:i,org:s,contextSiteUrl:r,onDone:I,onDisconnect:F,onIsPendingChange:m}),e[42]=x,e[43]=t,e[44]=c,e[45]=l,e[46]=r,e[47]=s,e[48]=i,e[49]=I,e[50]=F,e[51]=P):P=e[51];let T;e[52]!==k||e[53]!==P?(T=o.jsxs(tt,{className:"sm:max-w-lg",children:[k,P]}),e[52]=k,e[53]=P,e[54]=T):T=e[54];let L;return e[55]!==j||e[56]!==a||e[57]!==T?(L=o.jsx(nt,{open:a,onOpenChange:j,children:T}),e[55]=j,e[56]=a,e[57]=T,e[58]=L):L=e[58],L}const qe={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 Xn(n){const e=G.c(44),{selfClient:t,org:s,cdConnectionId:i,siteUrl:l}=n;let r;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const a=Ae(r);let u;e[4]!==i||e[5]!==s.id?(u=J.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=u):u=e[6];let p;e[7]!==a?(p=async()=>{const V=await a.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ee(V)},e[7]=a,e[8]=p):p=e[8];let d;e[9]!==u||e[10]!==p?(d={queryKey:u,queryFn:p,retry:!1},e[9]=u,e[10]=p,e[11]=d):d=e[11];const c=be(d),f=c.data?.stateSchema?ln(c.data.stateSchema):null;let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m={strict:!1},e[12]=m):m=e[12];const{shopify:y}=Tt(m);let x;e[13]!==y?(x=V=>V.bindingType!=="shopify"||y!=null,e[13]=y,e[14]=x):x=e[14];const h=(f&&f.length>0?f:dn).filter(x),b=h.map(lo),g=h.map(co).filter(ao),S=h.filter(ro).map(io),C=[...g,...S].sort().join(",");let O;e[15]!==i||e[16]!==s.id?(O=J.commerceDiscoveryConnection(s.id,i),e[15]=i,e[16]=s.id,e[17]=O):O=e[17];let j;e[18]!==i||e[19]!==t?(j=async()=>{const V=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ee(V)},e[18]=i,e[19]=t,e[20]=j):j=e[20];let _;e[21]!==O||e[22]!==j?(_={queryKey:O,queryFn:j},e[21]=O,e[22]=j,e[23]=_):_=e[23];const w=je(_).data?.item?.configuration_state??null;let E;e[24]!==w?(E=V=>w?.[V.fieldKey]?.value,e[24]=w,e[25]=E):E=e[25];const N=h.map(E).filter(so),k=[...b.map(oo),...g.map(no),...N.map(to)].sort().join(","),F=je({queryKey:J.commerceDiscoveryCompanionConnections(s.id,k),queryFn:async()=>{if(h.length===0)return{items:[]};const V=[{field:["app_name"],operator:"in",value:b},{field:["app_id"],operator:"in",value:g}];N.length>0&&V.push({field:["id"],operator:"in",value:N});const se=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:V},limit:1e3}});return ee(se)}}).data?.items??[],P=new Set(N),T=F.filter(V=>P.has(V.id)),L=T.filter(eo);let A;e[26]!==s.id||e[27]!==s.slug?(A=V=>({queryKey:J.commerceDiscoveryCompanionOAuthStatus(s.id,V.id),queryFn:async()=>{try{const se=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(V.id)}/oauth-token/status`,{credentials:"include"});return se.ok?{hasToken:(await se.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[26]=s.id,e[27]=s.slug,e[28]=A):A=e[28];const U=Jt({queries:L.map(A)});let B;e[29]!==U?(B=(V,se)=>[V.id,U[se]?.data?.hasToken===!0],e[29]=U,e[30]=B):B=e[30];const M=new Map(L.map(B)),K={};for(const V of T)K[V.id]=!V.oauth_config||!!V.connection_token||M.get(V.id)===!0;const q=je({queryKey:J.commerceDiscoveryCompanionRegistry(s.id,C),queryFn:async()=>{if(h.length===0)return{items:[]};const V=un(g,S),se=await At(Je.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...V?{where:V}:{},limit:1e3});return ee(se)}}),D={},Q={};for(const V of q.data?.items??[])D[V.id]=V,V.server?.name&&(Q[V.server.name]=V);let $;e[31]!==s.id||e[32]!==l?($=J.commerceDiscoveryConnectionStatus(s.id,l??""),e[31]=s.id,e[32]=l,e[33]=$):$=e[33];const Y=!!l;let R;e[34]!==t||e[35]!==l?(R=async()=>{const V=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:l}});return ee(V)},e[34]=t,e[35]=l,e[36]=R):R=e[36];let z;e[37]!==$||e[38]!==Y||e[39]!==R?(z={queryKey:$,enabled:Y,queryFn:R},e[37]=$,e[38]=Y,e[39]=R,e[40]=z):z=e[40];const ne=be(z),oe={};for(const[V,se]of Object.entries(ft)){const Oe=ne.data?.providers?.[se];Oe?.connected&&Oe.via==="sa"&&(oe[V]={resource:Oe.resource??null})}const W=!!l&&(ne.isError||ne.data?.claimed===!1),X=Cn({requirements:h,itemsById:D,itemsByName:Q,connections:F,connectionReadiness:K,configurationState:w,curated:qe,saBindings:oe});let de;return e[41]!==X||e[42]!==W?(de={cards:X,saStatusUnavailable:W},e[41]=X,e[42]=W,e[43]=de):de=e[43],de}function eo(n){return n.oauth_config&&!n.connection_token}function to(n){return`linked:${n}`}function no(n){return`app:${n}`}function oo(n){return`binding:${n}`}function so(n){return typeof n=="string"&&n.length>0}function io(n){return n.bindingType}function ro(n){return!qe[n.bindingType]}function ao(n){return!!n}function co(n){return qe[n.bindingType]?.registryAppId}function lo(n){return n.bindingType}function $o(n){const e=G.c(9),{selfClient:t,org:s,cdConnectionId:i}=n;let l;e[0]!==i||e[1]!==s.id?(l=J.commerceDiscoveryConnection(s.id,i),e[0]=i,e[1]=s.id,e[2]=l):l=e[2];let r;e[3]!==i||e[4]!==t?(r=async()=>{const d=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ee(d)},e[3]=i,e[4]=t,e[5]=r):r=e[5];let a;e[6]!==l||e[7]!==r?(a={queryKey:l,queryFn:r,retry:!1},e[6]=l,e[7]=r,e[8]=a):a=e[8];const p=je(a).data.item?.metadata?.siteUrl;return typeof p=="string"?p:void 0}function uo({selfClient:n,org:e,userId:t,cdConnectionId:s,domain:i,siteUrl:l}){const r=ye(),[a,u]=H.useState(null),[p,d]=H.useState(null),[c,f]=H.useState(null),m=async(h,b)=>{const g=await n.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:b}});return ee(g)};async function y(h){u(h.fieldKey),f(null);const b={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:l,...ze(window.location.search)};ue("commerce_onboarding_companion_connect_clicked",b);try{let g=h.candidateConnectionId;if(!g){const v=Dt(h.registryItem,e.id,t,{remoteIndex:0}),w=v.connection_type==="STDIO",E=!!v.connection_url,N=w&&v.connection_headers&&typeof v.connection_headers=="object"&&"command"in v.connection_headers;if(!E&&!N)return ue("commerce_onboarding_companion_connect_failed",{...b,error:"no_connection_method"}),f(Qe("commerceOnboarding.connectSourceDialog.noConnectionMethod",{title:h.title})),!1;const k=await n.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:v}});g=ee(k).item.id}const S=g,C=await Gt({connectionId:S,orgId:e.id,orgSlug:e.slug,persistFallback:v=>m(S,{connection_token:v}).then(()=>{})});if(!C.ok)return ue("commerce_onboarding_companion_connect_failed",{...b,error:C.error}),f(Qe("commerceOnboarding.connectSourceDialog.signInFailed",{title:h.title,error:C.error??""})),!1;const O=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),j=ee(O).item?.configuration_state??null,_=mn(j,h.fieldKey,h.bindingType,S);return h.bindingType==="github"&&delete _.github_repo,await m(s,{configuration_state:_}),await r.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,s)}),await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_connected",b),!0}catch(g){return ue("commerce_onboarding_companion_connect_failed",{...b,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{u(null)}}async function x(h){d(h.fieldKey),f(null);const b={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:l,...ze(window.location.search)};ue("commerce_onboarding_companion_disconnect_clicked",b);try{const g=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),C={...ee(g).item?.configuration_state??null??{}};return delete C[h.fieldKey],h.bindingType==="github"&&delete C.github_repo,await m(s,{configuration_state:C}),await r.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,s)}),await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_disconnected",b),!0}catch(g){return ue("commerce_onboarding_companion_disconnect_failed",{...b,error:g instanceof Error?g.message:String(g)}),f(g instanceof Error?g.message:String(g)),!1}finally{d(null)}}return{connect:y,connectingFieldKey:a,disconnect:x,disconnectingFieldKey:p,error:c}}const Ue="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-6";function $e(){const n=G.c(4),e=te();let t;n[0]!==e?(t=e("routes.commerceOnboarding.companionSection.title"),n[0]=e,n[1]=t):t=n[1];let s;return n[2]!==t?(s=o.jsx("h1",{className:"text-lg font-medium leading-6 text-foreground lg:text-xl lg:leading-7",children:t}),n[2]=t,n[3]=s):s=n[3],s}function mo(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2,3].map(fo)}),n[0]=e):e=n[0],e}function fo(n){return o.jsx(Gn,{},n)}function go(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:Ue,children:[o.jsx($e,{}),o.jsx(mo,{})]}),n[0]=e):e=n[0],e}function po(n){const e=G.c(18),{onRetry:t}=n,s=te();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx($e,{}),e[0]=i):i=e[0];let l;e[1]!==s?(l=s("routes.commerceOnboarding.companionSection.loadError"),e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=o.jsx("p",{className:"text-sm text-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let a;e[5]!==s?(a=s("routes.commerceOnboarding.companionSection.loadErrorDescription"),e[5]=s,e[6]=a):a=e[6];let u;e[7]!==a?(u=o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a}),e[7]=a,e[8]=u):u=e[8];let p;e[9]!==s?(p=s("routes.commerceOnboarding.companionSection.retry"),e[9]=s,e[10]=p):p=e[10];let d;e[11]!==t||e[12]!==p?(d=o.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:p}),e[11]=t,e[12]=p,e[13]=d):d=e[13];let c;return e[14]!==r||e[15]!==u||e[16]!==d?(c=o.jsxs("div",{className:Ue,children:[i,o.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[r,u,d]})]}),e[14]=r,e[15]=u,e[16]=d,e[17]=c):c=e[17],c}function Mo(n){const e=G.c(2);let t;return e[0]!==n?(t=o.jsx(Et,{children:s=>{const{reset:i}=s;return o.jsx(wt,{fallback:l=>{const{resetError:r}=l;return o.jsx(po,{onRetry:()=>{i(),r()}})},children:o.jsx(H.Suspense,{fallback:o.jsx(go,{}),children:o.jsx(ho,{...n})})})}}),e[0]=n,e[1]=t):t=e[1],t}function ho(n){const e=G.c(60),{org:t,cdConnectionId:s,siteUrl:i,onReadinessChange:l}=n,r=te(),{data:a}=It.useSession(),u=a?.user?.id??"";let p;if(e[0]!==i){const M=i?Ne(i):null;if(M?.ok)try{p=new URL(M.value).hostname}catch{p=void 0}e[0]=i,e[1]=p}else p=e[1];let d;e[2]!==t.id||e[3]!==t.slug?(d={connectionId:Rt,orgId:t.id,orgSlug:t.slug},e[2]=t.id,e[3]=t.slug,e[4]=d):d=e[4];const c=Ae(d);let f;e[5]!==s||e[6]!==t||e[7]!==c||e[8]!==i?(f={selfClient:c,org:t,cdConnectionId:s,siteUrl:i},e[5]=s,e[6]=t,e[7]=c,e[8]=i,e[9]=f):f=e[9];const{cards:m,saStatusUnavailable:y}=Xn(f);let x;e[10]!==s||e[11]!==t||e[12]!==c||e[13]!==p||e[14]!==i||e[15]!==u?(x={selfClient:c,org:t,userId:u,cdConnectionId:s,domain:p,siteUrl:i},e[10]=s,e[11]=t,e[12]=c,e[13]=p,e[14]=i,e[15]=u,e[16]=x):x=e[16];const{connect:h,connectingFieldKey:b,disconnect:g,disconnectingFieldKey:S,error:C}=uo(x),[O,j]=H.useState(null),_=xo;let v,w,E,N,k,I,F,P,T,L;if(e[17]!==O||e[18]!==m||e[19]!==h||e[20]!==C||e[21]!==b||e[22]!==g||e[23]!==S||e[24]!==l||e[25]!==t||e[26]!==y||e[27]!==c||e[28]!==i||e[29]!==r){N=Symbol.for("react.early_return_sentinel");e:{const M=m.filter(yo),K=m.filter(bo),q=y||(M.length>0?M.every(_):m.length===0||m.some(_));if(l?.(q),m.length===0){N=null;break e}const D=b!==null||S!==null,Q=$=>{const Y=async()=>{await h($)&&j($.fieldKey)};return o.jsx(Wn,{card:$,connecting:b===$.fieldKey,disconnecting:S===$.fieldKey,disabled:D&&b!==$.fieldKey&&S!==$.fieldKey,org:t,selfClient:c,siteUrl:i,autoOpenConfigFieldKey:O,onAutoOpenConfigHandled:()=>j(R=>R===$.fieldKey?null:R),onConnect:()=>{Y()},onDisconnect:()=>{g($)}},$.fieldKey)};w=Ue,e[40]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx($e,{}),e[40]=E):E=e[40],v=sn,F="flex min-h-0 flex-1 flex-col md:block",P="-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",e[41]!==C?(T=C&&o.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:C}),e[41]=C,e[42]=T):T=e[42],e[43]!==y||e[44]!==r?(L=y&&o.jsx("p",{role:"status",className:"mb-3 rounded-lg border border-warning/40 bg-warning/10 p-3 text-sm text-foreground",children:r("routes.commerceOnboarding.companionSection.statusUnavailable")}),e[43]=y,e[44]=r,e[45]=L):L=e[45],k="flex flex-col gap-4 pt-3",I=[...M,...K].map(Q)}e[17]=O,e[18]=m,e[19]=h,e[20]=C,e[21]=b,e[22]=g,e[23]=S,e[24]=l,e[25]=t,e[26]=y,e[27]=c,e[28]=i,e[29]=r,e[30]=v,e[31]=w,e[32]=E,e[33]=N,e[34]=k,e[35]=I,e[36]=F,e[37]=P,e[38]=T,e[39]=L}else v=e[30],w=e[31],E=e[32],N=e[33],k=e[34],I=e[35],F=e[36],P=e[37],T=e[38],L=e[39];if(N!==Symbol.for("react.early_return_sentinel"))return N;let A;e[46]!==k||e[47]!==I?(A=o.jsx("div",{className:k,children:I}),e[46]=k,e[47]=I,e[48]=A):A=e[48];let U;e[49]!==v||e[50]!==A||e[51]!==F||e[52]!==P||e[53]!==T||e[54]!==L?(U=o.jsxs(v,{wrapperClassName:F,className:P,children:[T,L,A]}),e[49]=v,e[50]=A,e[51]=F,e[52]=P,e[53]=T,e[54]=L,e[55]=U):U=e[55];let B;return e[56]!==w||e[57]!==E||e[58]!==U?(B=o.jsxs("div",{className:w,children:[E,U]}),e[56]=w,e[57]=E,e[58]=U,e[59]=B):B=e[59],B}function bo(n){return!n.required}function yo(n){return n.required}function xo(n){return n.satisfied&&n.configured}function Co(n){return n.content?.find(e=>e.text)?.text??"__configurationFailed"}function Qo(n){const e=n;if(e.isError)throw new Error(Co(e));return e.structuredContent??n}export{go as C,Be as L,ft as P,sn as S,Mo as a,$o as b,ee as c,Xn as d,uo as e,Jn as f,Zn as g,Uo as i,Ne as n,Qo as p,on as s,Zt as u};