@decocms/mesh 2.132.0 → 2.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/client/assets/{AlertCircle-Dvy3oHwl.js → AlertCircle-DtdVhcv9.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-C1Pd8crU.js → AlignLeft-CRHzRLnb.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-B0XF9QfR.js → ArrowDown-CD9f6dVF.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-Ddv8Es1G.js → ArrowLeft-Dse_UWo5.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-CjPyEOxC.js → ArrowUp-C5pU0t20.js} +1 -1
  6. package/dist/client/assets/{Check-BGWNBpXb.js → Check-llxZXJNk.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-CDdaecse.js → CheckCircle-naMxBwcc.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-DgNkGXSd.js → CheckDone01-DArNoCeR.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-yC2IepeU.js → CheckVerified02-B5N8FkZi.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-CxLgy5uI.js → ChevronDown-BPvdqfh0.js} +1 -1
  11. package/dist/client/assets/ChevronLeft-BmfUl3Br.js +1 -0
  12. package/dist/client/assets/{ChevronRight-B-dZm0Fo.js → ChevronRight-bI92hTEK.js} +1 -1
  13. package/dist/client/assets/{Clock-DjTfMWYb.js → Clock-DCqyBdVg.js} +1 -1
  14. package/dist/client/assets/{Code01-C4dpeKsY.js → Code01-Cw3aSJX_.js} +1 -1
  15. package/dist/client/assets/{Container-CH2V2ATa.js → Container-BcN3rU1W.js} +1 -1
  16. package/dist/client/assets/{Copy01-Ba42JLNP.js → Copy01-DOsfcAr7.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-Dbafm5jn.js → Dataflow03-BzHLq4N3.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-DF0XToJT.js → DotsHorizontal-jg8p8szZ.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-D-x0DTAA.js → DotsVertical-D7GBR06C.js} +1 -1
  20. package/dist/client/assets/{Download01-x2RmdAQh.js → Download01-Dqv2OtJR.js} +1 -1
  21. package/dist/client/assets/{Edit01-NXKv8M2Y.js → Edit01-PGiGF51x.js} +1 -1
  22. package/dist/client/assets/{Eye-Da9OHWjs.js → Eye-BHQjRrk8.js} +1 -1
  23. package/dist/client/assets/{File02-BBbAYdh-.js → File02-8H6UbpEV.js} +1 -1
  24. package/dist/client/assets/{File06-CZSeKcKm.js → File06-C1Sd5E1A.js} +1 -1
  25. package/dist/client/assets/{FilterLines-CR4t6v_B.js → FilterLines-C4D0sIiB.js} +1 -1
  26. package/dist/client/assets/{Globe01-sstJp1qH.js → Globe01-DvHitX1A.js} +1 -1
  27. package/dist/client/assets/{Globe02-DED7nhMo.js → Globe02-8eZbLs7z.js} +1 -1
  28. package/dist/client/assets/{Grid01-C85povgK.js → Grid01-CfCG1RrY.js} +1 -1
  29. package/dist/client/assets/{Hash02-B-r__uQj.js → Hash02-B4zt7eqf.js} +1 -1
  30. package/dist/client/assets/{Home02-P9zxIWnB.js → Home02-BgWCBPhH.js} +1 -1
  31. package/dist/client/assets/{Image01-CyQ-9pmM.js → Image01-B8svV61f.js} +1 -1
  32. package/dist/client/assets/{Inbox01-DUxLR6jm.js → Inbox01-DktY8c3P.js} +1 -1
  33. package/dist/client/assets/{InfoCircle-ORvzz6Jj.js → InfoCircle-DDBpFLdR.js} +1 -1
  34. package/dist/client/assets/{Key01-B3LfJVTz.js → Key01-eAlJ77G3.js} +1 -1
  35. package/dist/client/assets/{LayersTwo01-D0hB1mlt.js → LayersTwo01-Cre7WmYe.js} +1 -1
  36. package/dist/client/assets/{LayoutLeft-CIizJ9p-.js → LayoutLeft-BdPuu6bH.js} +1 -1
  37. package/dist/client/assets/{LinkExternal01-zIQsCZyp.js → LinkExternal01-1-7TA6Ra.js} +1 -1
  38. package/dist/client/assets/{List-Dy03iFlP.js → List-uQZNVPQ-.js} +1 -1
  39. package/dist/client/assets/{Loading01-DvHkBn5K.js → Loading01-DUUFtL7S.js} +1 -1
  40. package/dist/client/assets/{Lock01-b36hjLYg.js → Lock01-BqRcOfbm.js} +1 -1
  41. package/dist/client/assets/{Play-B4gSKcOc.js → Play-DTlFqxwD.js} +1 -1
  42. package/dist/client/assets/{Plus-C48LE9QF.js → Plus-2wrCLrAD.js} +1 -1
  43. package/dist/client/assets/{RefreshCcw01-B_P3Otqi.js → RefreshCcw01-CmQ_Zyfb.js} +1 -1
  44. package/dist/client/assets/{Rows03-RYFV31vk.js → Rows03-CeP6X8F6.js} +1 -1
  45. package/dist/client/assets/{Save01-C9eXS7Z1.js → Save01-Cq59fc-a.js} +1 -1
  46. package/dist/client/assets/{SearchMd-Bec1mZCp.js → SearchMd-DOdaT51-.js} +1 -1
  47. package/dist/client/assets/{Settings01-CGjDKLLq.js → Settings01-jEDDrq49.js} +1 -1
  48. package/dist/client/assets/{Shield01-QPvxKI9B.js → Shield01-_lpY_BlD.js} +1 -1
  49. package/dist/client/assets/{Terminal-Dg9FTns0.js → Terminal-CZIzfu4H.js} +1 -1
  50. package/dist/client/assets/{Trash01-DfwWsbuW.js → Trash01-DJpn1VG4.js} +1 -1
  51. package/dist/client/assets/{Upload01-CBnp-ZgO.js → Upload01-c6QpJwvP.js} +1 -1
  52. package/dist/client/assets/{Users03-zNQ-U5kI.js → Users03--eiqKjb_.js} +1 -1
  53. package/dist/client/assets/{X-BaOBrQh9.js → X-BGHsyt4s.js} +1 -1
  54. package/dist/client/assets/{XCircle-CGBoiIiF.js → XCircle-BJSW1V34.js} +1 -1
  55. package/dist/client/assets/{XClose-D5oa0b17.js → XClose-CYrOe1GU.js} +1 -1
  56. package/dist/client/assets/{Zap-B8kjj6jV.js → Zap-Div5wKlF.js} +1 -1
  57. package/dist/client/assets/{agent-connections-preview-CpRlCZek.js → agent-connections-preview-B33aUr8j.js} +1 -1
  58. package/dist/client/assets/agent-detail-B1r6DbgP.js +2 -0
  59. package/dist/client/assets/agents--1wlh1On.js +1 -0
  60. package/dist/client/assets/{alert-dialog-CHhoNaC0.js → alert-dialog-WtbKGn3h.js} +1 -1
  61. package/dist/client/assets/{auth-catchall-Bks-N8b9.js → auth-catchall-C-FIrDOU.js} +1 -1
  62. package/dist/client/assets/{avatar-DX9xarA9.js → avatar-C0Za2Leb.js} +1 -1
  63. package/dist/client/assets/{badge-CMOYVtO8.js → badge-zns1OAW0.js} +1 -1
  64. package/dist/client/assets/{binder-CN-yhtfQ.js → binder-C2Kwp5aI.js} +1 -1
  65. package/dist/client/assets/{breadcrumb-CtNnsyqL.js → breadcrumb-BF7wgZMj.js} +1 -1
  66. package/dist/client/assets/{card-BECXECFc.js → card-yVoc5Dl_.js} +1 -1
  67. package/dist/client/assets/{chart-CA07zGfe.js → chart-C09J-0j8.js} +1 -1
  68. package/dist/client/assets/{checkbox-Bs5NWE_x.js → checkbox-C_yzLnRo.js} +1 -1
  69. package/dist/client/assets/{circle-alert-CEhC-Q81.js → circle-alert-DEWKfuYJ.js} +1 -1
  70. package/dist/client/assets/collapsible-e1478K7w.js +23 -0
  71. package/dist/client/assets/{collection-detail-CNXxywSm.js → collection-detail-12bPsl9i.js} +3 -3
  72. package/dist/client/assets/{collection-search-aEfiIRVT.js → collection-search-g7bCyEl4.js} +1 -1
  73. package/dist/client/assets/collection-tab-hxaftEha.js +1 -0
  74. package/dist/client/assets/{collection-table-wrapper-hM0ppyEG.js → collection-table-wrapper-Bx_0GgHe.js} +1 -1
  75. package/dist/client/assets/{collection-tabs-Dc6gZtTz.js → collection-tabs-CGvjmn7e.js} +1 -1
  76. package/dist/client/assets/{command-DI3JwfrE.js → command-DvXRXkaf.js} +1 -1
  77. package/dist/client/assets/{connect-C0SuJwzK.js → connect-BHcfLUsx.js} +1 -1
  78. package/dist/client/assets/{connection-card-CzCUOjTN.js → connection-card-Of-LfoL9.js} +1 -1
  79. package/dist/client/assets/connection-detail-Bfp_CthH.js +1 -0
  80. package/dist/client/assets/connections-CMRFgF2z.js +1 -0
  81. package/dist/client/assets/constants-BMZNxJu4.js +1 -0
  82. package/dist/client/assets/{constants-0JLhMmM7.js → constants-DLWxw8L_.js} +1 -1
  83. package/dist/client/assets/{create-organization-dialog-BRKsH8XB.js → create-organization-dialog-DHmNDQVx.js} +1 -1
  84. package/dist/client/assets/{create-project-dialog-BUAUU3kY.js → create-project-dialog-BURFxz7l.js} +1 -1
  85. package/dist/client/assets/{danger--r_qw5of.js → danger-D0vNOgTj.js} +1 -1
  86. package/dist/client/assets/{danger-zone-fH4LWpAE.js → danger-zone-Dhz8OLxh.js} +1 -1
  87. package/dist/client/assets/decopilot-events-C1i2IOcF.js +1 -0
  88. package/dist/client/assets/{dependencies-CfLZZ12D.js → dependencies-DQgcVkpb.js} +1 -1
  89. package/dist/client/assets/{dialog-CzmRWg_H.js → dialog-B8ODwZHJ.js} +1 -1
  90. package/dist/client/assets/{dropdown-menu-bZQdGgsX.js → dropdown-menu-Bv0kDZGf.js} +1 -1
  91. package/dist/client/assets/{dynamic-plugin-layout-B44KCK2N.js → dynamic-plugin-layout-CfJ2iWdk.js} +1 -1
  92. package/dist/client/assets/editable-task-title-BECK0S9m.js +16 -0
  93. package/dist/client/assets/{empty-state-BuKC-FeY.js → empty-state-CS91-o6R.js} +1 -1
  94. package/dist/client/assets/{env-vars-editor-BUYd05S1.js → env-vars-editor-BoUKrNdn.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-CDK2P3aY.js → extract-connection-data-DPrPXrw7.js} +1 -1
  96. package/dist/client/assets/{file-browser-B8HL2Mki.js → file-browser-Dyg6fn_p.js} +2 -2
  97. package/dist/client/assets/{form-EW4LFI0z.js → form-Bqy3P0kv.js} +1 -1
  98. package/dist/client/assets/{general-B-SJAejg.js → general-CcOfiluy.js} +1 -1
  99. package/dist/client/assets/{grid-view-B2G72x7D.js → grid-view-uc2-Xd10.js} +1 -1
  100. package/dist/client/assets/{home-C_Jstend.js → home-DYjBdnSm.js} +1 -1
  101. package/dist/client/assets/{index-RIE02s6T.js → index-1pfseT2B.js} +1 -1
  102. package/dist/client/assets/{index-BeKO7nFo.js → index-5XdaBbnC.js} +1 -1
  103. package/dist/client/assets/{index-hfshaOuF.js → index-B1uFfuid.js} +1 -1
  104. package/dist/client/assets/{index-gksA6r5d.js → index-BLvVZqmB.js} +1 -1
  105. package/dist/client/assets/{index-kE57LLiG.js → index-Br7gqIns.js} +22 -22
  106. package/dist/client/assets/{index-Cp50RRud.js → index-CLZkaGlC.js} +1 -1
  107. package/dist/client/assets/index-CUEtQJPr.css +1 -0
  108. package/dist/client/assets/index-CjU9lWJN.js +1 -0
  109. package/dist/client/assets/{index-CzFqQvXW.js → index-DVHuYwO5.js} +4 -4
  110. package/dist/client/assets/{index-V5ecgDUm.js → index-tDb6lai2.js} +1 -1
  111. package/dist/client/assets/{infiniteQueryObserver-B0QSZ6Wg.js → infiniteQueryObserver-BU31NXJd.js} +1 -1
  112. package/dist/client/assets/{input-Rcf9et7W.js → input-CImrwNsE.js} +1 -1
  113. package/dist/client/assets/{integration-icon-Cr629JYK.js → integration-icon-CqdgwTQM.js} +1 -1
  114. package/dist/client/assets/{label-DdGHGWov.js → label-BEcdY3zl.js} +1 -1
  115. package/dist/client/assets/{layout-CUeJn5m4.js → layout-Cegg55DQ.js} +1 -1
  116. package/dist/client/assets/{layout-DvurrRZC.js → layout-D1FJR7dQ.js} +1 -1
  117. package/dist/client/assets/localstorage-keys-B3yhvN27.js +1 -0
  118. package/dist/client/assets/{login-C70j40x2.js → login-gpMZSjc_.js} +1 -1
  119. package/dist/client/assets/{markdown-BsZjpnFH.js → markdown-DigmZCi5.js} +1 -1
  120. package/dist/client/assets/{mcp-app-renderer-aRjr0jcc.js → mcp-app-renderer-elbh_bK3.js} +1 -1
  121. package/dist/client/assets/{mcp-oauth-Dk3osgIf.js → mcp-oauth-BJK3oSr3.js} +1 -1
  122. package/dist/client/assets/{mcp-server-card-znSfWcaP.js → mcp-server-card-B_3KckAV.js} +1 -1
  123. package/dist/client/assets/{mcp-server-detail-Csm9j29j.js → mcp-server-detail-BGmK7vBO.js} +2 -2
  124. package/dist/client/assets/{members-WbcVb7yX.js → members-DkvmaHrL.js} +1 -1
  125. package/dist/client/assets/{monitoring-dashboard-edit-ChxkdsCv.js → monitoring-dashboard-edit-Dq449CGn.js} +1 -1
  126. package/dist/client/assets/{monitoring-dashboard-view-CL8P3Zx7.js → monitoring-dashboard-view-KyEbCseW.js} +2 -2
  127. package/dist/client/assets/{monitoring-Dth-Uzfq.js → monitoring-mMb4oyh8.js} +2 -2
  128. package/dist/client/assets/{oauth-callback-CXzK_RYv.js → oauth-callback-BWIw_10O.js} +1 -1
  129. package/dist/client/assets/page-LuWQuTOB.js +1 -0
  130. package/dist/client/assets/{page-CCrDZNhS.js → page-MLghIZgZ.js} +1 -1
  131. package/dist/client/assets/{plugin-empty-state-D7gmiZlA.js → plugin-empty-state-BYi0xCDZ.js} +1 -1
  132. package/dist/client/assets/{plugin-empty-state-BIuYztei.js → plugin-empty-state-CfkX75Qn.js} +1 -1
  133. package/dist/client/assets/{plugin-header-BLBENlfU.js → plugin-header-Bpxodj_N.js} +1 -1
  134. package/dist/client/assets/{plugin-header-CmlDS_hv.js → plugin-header-C8NyMNoe.js} +1 -1
  135. package/dist/client/assets/plugins-VAc5tGcP.js +1 -0
  136. package/dist/client/assets/{popover-C5F2AcFP.js → popover-R_PT2IPW.js} +1 -1
  137. package/dist/client/assets/{project-app-view-NryMJvXO.js → project-app-view-Bai-Qf0R.js} +1 -1
  138. package/dist/client/assets/project-layout-daZ99y7q.js +1 -0
  139. package/dist/client/assets/{project-plugins-QbLHCPXi.js → project-plugins-D9btRO1g.js} +1 -1
  140. package/dist/client/assets/{projects-list-B_wyuNYf.js → projects-list-DLyGtlCx.js} +1 -1
  141. package/dist/client/assets/{ranking-layout-CVBOyQIw.js → ranking-layout-Difw19Tu.js} +1 -1
  142. package/dist/client/assets/{readme-viewer-BmxWIpiS.js → readme-viewer-DMIs62Jq.js} +1 -1
  143. package/dist/client/assets/{registry-layout-DHUM9TZu.js → registry-layout-DUQv-gnE.js} +1 -1
  144. package/dist/client/assets/{registry-utils-DRX9Fl5Z.js → registry-utils-BL3Z-ZuV.js} +1 -1
  145. package/dist/client/assets/{reports-layout-GUNpInzx.js → reports-layout-DOweGRAi.js} +1 -1
  146. package/dist/client/assets/{reset-password-C_jAWNzd.js → reset-password-gTGJs4eA.js} +1 -1
  147. package/dist/client/assets/{resizable-CmbMtBt6.js → resizable-C-gCkuLt.js} +1 -1
  148. package/dist/client/assets/{save-actions-CH-zbfme.js → save-actions-CdZGxDIR.js} +1 -1
  149. package/dist/client/assets/{scroll-area-B5BKtcc-.js → scroll-area-DsCd8vj6.js} +1 -1
  150. package/dist/client/assets/{select-CSl7KVC3.js → select-CZ5oa2ZG.js} +1 -1
  151. package/dist/client/assets/shell-layout-D95AudRc.js +3 -0
  152. package/dist/client/assets/{sidebar-settings-98pHpdNk.js → sidebar-settings-DoYo5_2f.js} +1 -1
  153. package/dist/client/assets/{skeleton-BGGjmBE-.js → skeleton-DIOpAjh1.js} +1 -1
  154. package/dist/client/assets/{spinner-BubUCjpb.js → spinner-B-yGP95y.js} +1 -1
  155. package/dist/client/assets/{store-invite-BidZUMAQ.js → store-invite-COyr13nI.js} +1 -1
  156. package/dist/client/assets/{switch-D_s2nP_j.js → switch-C_rwAMG7.js} +1 -1
  157. package/dist/client/assets/{table-C7IfzCau.js → table-BwN-DdG1.js} +1 -1
  158. package/dist/client/assets/tabs-CTOkjsDF.js +1 -0
  159. package/dist/client/assets/tasks-CxbK_rAM.js +1 -0
  160. package/dist/client/assets/tasks-panel-CI07RnJW.js +1 -0
  161. package/dist/client/assets/{textarea-CumbsokS.js → textarea-BOlS_fKd.js} +1 -1
  162. package/dist/client/assets/{time-range-picker-Brh1Ym1N.js → time-range-picker-DWAp9G7R.js} +4 -4
  163. package/dist/client/assets/{toggle-group-DaSKpJH5.js → toggle-group-CRwxfPk7.js} +1 -1
  164. package/dist/client/assets/{tools-list-BvNNjQQL.js → tools-list-CQrrEoBF.js} +1 -1
  165. package/dist/client/assets/{tooltip-BGn6dJhi.js → tooltip-BsUirxUt.js} +1 -1
  166. package/dist/client/assets/{topbar-portal-mNbAP1zZ.js → topbar-portal-Cy4hr4gX.js} +1 -1
  167. package/dist/client/assets/{types-CnosXlf3.js → types-gEqZqH3b.js} +1 -1
  168. package/dist/client/assets/{use-binding-Ctbwf5zu.js → use-binding-Dx_NAnJa.js} +1 -1
  169. package/dist/client/assets/{use-connection-CmCfM9T5.js → use-connection-CwB1S0Lk.js} +1 -1
  170. package/dist/client/assets/{use-copy-Dn5NzC6Z.js → use-copy-uCRP4yn6.js} +1 -1
  171. package/dist/client/assets/{use-create-virtual-mcp-b6Af6scy.js → use-create-virtual-mcp-Bm7L9HAR.js} +1 -1
  172. package/dist/client/assets/{use-install-from-registry-D4coW5d-.js → use-install-from-registry-CMYlie1K.js} +1 -1
  173. package/dist/client/assets/use-list-state-EN77XpOY.js +1 -0
  174. package/dist/client/assets/{use-llm-CPv795TN.js → use-llm-C5Q0H0cZ.js} +1 -1
  175. package/dist/client/assets/{use-mcp-resources--6yZ25c2.js → use-mcp-resources-kkSzYGiM.js} +1 -1
  176. package/dist/client/assets/{use-mcp-tools-BTHDM3P3.js → use-mcp-tools-CT-LTM8z.js} +1 -1
  177. package/dist/client/assets/{use-members-Dzw-FOpA.js → use-members-CYCHCBAZ.js} +1 -1
  178. package/dist/client/assets/{use-mobile-DIBT-lEk.js → use-mobile-Bot_hVI8.js} +1 -1
  179. package/dist/client/assets/{use-project-Bd8syAM2.js → use-project-C5wS8512.js} +1 -1
  180. package/dist/client/assets/{use-settings-modal-D-rqbyuf.js → use-settings-modal-TyiexX8v.js} +1 -1
  181. package/dist/client/assets/{use-view-mode-k6uWDVq8.js → use-view-mode-CS5zZIj8.js} +1 -1
  182. package/dist/client/assets/{use-virtual-mcp-CaM9kbfY.js → use-virtual-mcp-CGnbrFrJ.js} +1 -1
  183. package/dist/client/assets/useInfiniteQuery-CutnJ4kj.js +1 -0
  184. package/dist/client/assets/{useMutation-DsQcwaJP.js → useMutation-BskhtN65.js} +1 -1
  185. package/dist/client/assets/useQuery-CxvwMb--.js +1 -0
  186. package/dist/client/assets/useSuspenseInfiniteQuery-DrLfXfJc.js +1 -0
  187. package/dist/client/assets/user-BRVh4xuS.js +1 -0
  188. package/dist/client/assets/workflow-D7s-e1ZH.js +1 -0
  189. package/dist/client/index.html +2 -2
  190. package/dist/server/cli.js +2 -1
  191. package/dist/server/server.js +2 -1
  192. package/package.json +1 -1
  193. package/dist/client/assets/AlertOctagon-Y8Xx5Uc4.js +0 -1
  194. package/dist/client/assets/agent-detail-ge8lRsMy.js +0 -2
  195. package/dist/client/assets/agents-CYp6eaDL.js +0 -1
  196. package/dist/client/assets/collapsible-KhZqz8s6.js +0 -1
  197. package/dist/client/assets/collection-tab-ByOYG4eu.js +0 -1
  198. package/dist/client/assets/connection-detail-FUvYBL_f.js +0 -1
  199. package/dist/client/assets/connections-CZWiV45b.js +0 -1
  200. package/dist/client/assets/constants-BnCnMsvC.js +0 -1
  201. package/dist/client/assets/context-CnW_lI9R.js +0 -23
  202. package/dist/client/assets/decopilot-events-Brt4gAR6.js +0 -1
  203. package/dist/client/assets/editable-thread-title-BT5MJN2M.js +0 -16
  204. package/dist/client/assets/index-Bl1kPuE1.css +0 -1
  205. package/dist/client/assets/index-CLgM5v39.js +0 -1
  206. package/dist/client/assets/localstorage-keys-DtK7peUq.js +0 -1
  207. package/dist/client/assets/page-JQWUx5cS.js +0 -1
  208. package/dist/client/assets/plugins-kPtsND7u.js +0 -1
  209. package/dist/client/assets/project-layout-CDz2d0hE.js +0 -1
  210. package/dist/client/assets/shell-layout-DH6hyOML.js +0 -3
  211. package/dist/client/assets/tabs-BzChyqs4.js +0 -1
  212. package/dist/client/assets/tasks-fA5J94Ed.js +0 -1
  213. package/dist/client/assets/use-list-state-pp-Ywt5d.js +0 -1
  214. package/dist/client/assets/use-mcp-prompts-Bvv0Gku4.js +0 -1
  215. package/dist/client/assets/use-preferences-fTjyFgCz.js +0 -1
  216. package/dist/client/assets/useInfiniteQuery-BRjF-D1B.js +0 -1
  217. package/dist/client/assets/useQuery-BE7O7fKt.js +0 -1
  218. package/dist/client/assets/useSuspenseInfiniteQuery-BSW1dpRq.js +0 -1
  219. package/dist/client/assets/workflow-BfURwr1_.js +0 -1
@@ -1 +1 @@
1
- import{r as K,j as t,v as ee,B as W,u as te,m as ne,t as X,K as z,b8 as Q,ba as se,c as Z,bb as ie}from"./index-CzFqQvXW.js";import{u as oe}from"./useQuery-BE7O7fKt.js";import{u as re}from"./useMutation-DsQcwaJP.js";import{u as le,a as ae}from"./constants-0JLhMmM7.js";import{S as ce}from"./switch-D_s2nP_j.js";import{L as $}from"./label-DdGHGWov.js";import{n as de}from"./Container-CH2V2ATa.js";import{h as ue}from"./use-connection-CmCfM9T5.js";import{a as ge,c as me}from"./use-binding-Ctbwf5zu.js";import{u as pe}from"./use-install-from-registry-D4coW5d-.js";import{i as fe}from"./Loading01-DvHkBn5K.js";import{s as xe}from"./Plus-C48LE9QF.js";import{S as he,a as je,b as be,c as Ce,d as Y}from"./select-CSl7KVC3.js";function H({value:r,onValueChange:e,placeholder:o="Select a connection...",binding:a,bindingType:c,onAddNew:v,className:w,disabled:x=!1}){const[N,h]=K.useState(!1),{installByBinding:u,isInstalling:B}=pe(),P=N||B,j=ue(),I=ge({connections:j,binding:typeof a=="string"?a:void 0}),E=!a||!j?j??[]:typeof a=="string"?I:Array.isArray(a)&&a.length>0?j.filter(i=>me(i,a)):j,S=(()=>{if(!c?.startsWith("@"))return null;const[i,y]=c.replace("@","").split("/");return i&&y?{scope:i,appName:y}:null})(),b=(()=>{let i=E;const y=Array.isArray(a)&&a.length>0;if(S&&!y&&(i=i.filter(p=>{const n=p.app_name,s=p.metadata?.scopeName;return n===S.appName&&s===S.scope})),r&&!i.some(p=>p.id===r)){const p=j?.find(n=>n.id===r);if(p)return[p,...i]}return i})(),C=c?.startsWith("@"),k=async()=>{if(C&&c){h(!0);try{const i=await u(c);i&&e(i.id)}finally{h(!1)}return}v?.()},f=b.find(i=>i.id===r);return t.jsxs(he,{value:r??"none",onValueChange:i=>e(i==="none"?null:i),disabled:x,children:[t.jsx(je,{size:"sm",className:ee("w-[200px]",w),children:t.jsx(be,{placeholder:o,children:f?t.jsxs("div",{className:"flex items-center gap-2",children:[f.icon?t.jsx("img",{src:f.icon,alt:f.title,className:"w-4 h-4 rounded shrink-0"}):t.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:f.title.slice(0,1).toUpperCase()}),t.jsx("span",{className:"truncate",children:f.title})]}):o})}),t.jsxs(Ce,{children:[t.jsx(Y,{value:"none",children:"No connection"}),b.length===0?t.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):b.map(i=>t.jsx(Y,{value:i.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"w-4 h-4 rounded"}):t.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:i.title.slice(0,1).toUpperCase()}),t.jsx("span",{children:i.title})]})},i.id)),(v||C)&&t.jsx("div",{className:"border-t border-border",children:t.jsx(W,{onPointerDown:i=>i.stopPropagation(),onClick:i=>{i.preventDefault(),i.stopPropagation(),k()},disabled:P||x,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:P?t.jsxs(t.Fragment,{children:[t.jsx(fe,{size:16,className:"animate-spin"}),t.jsx("span",{children:"Connecting..."})]}):t.jsxs(t.Fragment,{children:[t.jsx(xe,{size:16}),t.jsx("span",{children:"Add Connection"})]})})})]})]})}const ye=r=>{if(!r||typeof r!="object")return!1;const e=r;return e.type==="text"&&typeof e.text=="string"&&e.text.trim().toLowerCase().startsWith("error")},J=r=>{const e=r.structuredContent??r,o=e&&typeof e=="object"?e:null,a=o?.content?.[0]?.text&&typeof o.content[0].text=="string"?o.content[0].text:null;if(o?.isError)throw new Error(a??"Tool call failed");if(ye(e))throw new Error(e.text);return e};function ve(r){return r.requiresMcpBinding===!0?!0:r.binding!==void 0}function Ne(r){const e=Z.c(62),{plugin:o,isEnabled:a,isSaving:c,pendingBinding:v,pendingVtexBinding:w,description:x,label:N,icon:h,projectId:u,client:B,onBindingChange:P,onVtexBindingChange:j,onToggle:I}=r;let E;e[0]!==o?(E=ve(o),e[0]=o,e[1]=E):E=e[1];const S=E;let b;e[2]!==o.id||e[3]!==u?(b=z.projectPluginConfig(u??"",o.id),e[2]=o.id,e[3]=u,e[4]=b):b=e[4];let C;e[5]!==B||e[6]!==o.id||e[7]!==u?(C=async()=>{if(!u)throw new Error("Project ID is required to load plugin config.");const V=await B.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:u,pluginId:o.id}});return J(V)},e[5]=B,e[6]=o.id,e[7]=u,e[8]=C):C=e[8];const k=!!u&&S;let f;e[9]!==b||e[10]!==C||e[11]!==k?(f={queryKey:b,queryFn:C,enabled:k},e[9]=b,e[10]=C,e[11]=k,e[12]=f):f=e[12];const{data:i,isLoading:y}=oe(f),p=i?.config?.connectionId??null,n=v!==void 0?v:p,s=i?.config?.settings&&typeof i.config.settings=="object"?i.config.settings:null,l=typeof s?.vtexConnectionId=="string"?s.vtexConnectionId:null,d=w!==void 0?w.value:l,g=o.id==="collection-reorder-ranking";let m;e[13]!==a||e[14]!==c||e[15]!==I||e[16]!==o.id?(m=()=>!c&&I(o.id,!a),e[13]=a,e[14]=c,e[15]=I,e[16]=o.id,e[17]=m):m=e[17];const T=c?void 0:"pointer";let O;e[18]!==T?(O={cursor:T},e[18]=T,e[19]=O):O=e[19];let L;e[20]!==h?(L=h&&t.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0 [&>svg]:size-4",children:h}),e[20]=h,e[21]=L):L=e[21];let R;e[22]!==N?(R=t.jsx("p",{className:"text-sm font-medium text-foreground",children:N}),e[22]=N,e[23]=R):R=e[23];let F;e[24]!==x?(F=x&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:x}),e[24]=x,e[25]=F):F=e[25];let _;e[26]!==R||e[27]!==F?(_=t.jsxs("div",{className:"min-w-0",children:[R,F]}),e[26]=R,e[27]=F,e[28]=_):_=e[28];let A;e[29]!==_||e[30]!==L?(A=t.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[L,_]}),e[29]=_,e[30]=L,e[31]=A):A=e[31];let U;e[32]!==I||e[33]!==o.id?(U=V=>I(o.id,V),e[32]=I,e[33]=o.id,e[34]=U):U=e[34];let D;e[35]!==a||e[36]!==c||e[37]!==U?(D=t.jsx("div",{onClick:Ie,className:"shrink-0",children:t.jsx(ce,{checked:a,onCheckedChange:U,disabled:c})}),e[35]=a,e[36]=c,e[37]=U,e[38]=D):D=e[38];let q;e[39]!==A||e[40]!==D?(q=t.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[A,D]}),e[39]=A,e[40]=D,e[41]=q):q=e[41];let G;e[42]!==g||e[43]!==y||e[44]!==a||e[45]!==c||e[46]!==S||e[47]!==P||e[48]!==j||e[49]!==o.binding||e[50]!==o.id||e[51]!==n||e[52]!==p||e[53]!==s||e[54]!==l||e[55]!==d?(G=a&&S&&t.jsxs("div",{className:"pb-4 pl-7 space-y-2",onClick:Pe,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),t.jsx(H,{value:n??null,onValueChange:V=>P(o.id,V,p),binding:o.binding,placeholder:"Select connection...",className:"w-56",disabled:c||y})]}),g&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($,{className:"text-xs text-muted-foreground w-24",children:"VTEX"}),t.jsx(H,{value:d??null,onValueChange:V=>j(o.id,V,l,s),binding:ie,placeholder:"Select VTEX connection...",className:"w-56",disabled:c||y})]})]}),e[42]=g,e[43]=y,e[44]=a,e[45]=c,e[46]=S,e[47]=P,e[48]=j,e[49]=o.binding,e[50]=o.id,e[51]=n,e[52]=p,e[53]=s,e[54]=l,e[55]=d,e[56]=G):G=e[56];let M;return e[57]!==q||e[58]!==G||e[59]!==m||e[60]!==O?(M=t.jsxs("div",{className:"flex flex-col border-b border-border last:border-0",onClick:m,style:O,children:[q,G]}),e[57]=q,e[58]=G,e[59]=m,e[60]=O,e[61]=M):M=e[61],M}function Pe(r){return r.stopPropagation()}function Ie(r){return r.stopPropagation()}function Se(){const{org:r,project:e}=te(),o=ne(),a=le({connectionId:ae,orgId:r.id}),[c,v]=K.useState({}),[w,x]=K.useState({}),[N,h]=K.useState({}),[u,B]=K.useState(!1),P=e.enabledPlugins??[],j=n=>{const s=c[n];return s!==void 0?s:P.includes(n)},I=()=>{const n=new Set(P);for(const[s,l]of Object.entries(c))l?n.add(s):n.delete(s);return Array.from(n)},E=Object.keys(c).length>0||Object.keys(w).length>0||Object.keys(N).length>0,S=(n,s)=>{const l=P.includes(n);v(s===l?d=>{const{[n]:g,...m}=d;return m}:d=>({...d,[n]:s}))},b=(n,s,l)=>{if(s===l){x(d=>{const{[n]:g,...m}=d;return m});return}x(d=>({...d,[n]:s}))},C=(n,s,l,d)=>{if(s===l){h(g=>{const{[n]:m,...T}=g;return T});return}h(g=>({...g,[n]:{value:s,baseSettings:d}}))},k=re({mutationFn:async n=>{const s=[];if(n.updatePlugins){const l=await a.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:n.enabledPlugins}});s.push(J(l))}if(n.bindingUpdates.length>0){const l=await Promise.all(n.bindingUpdates.map(async({pluginId:d,connectionId:g,settings:m})=>{const T=await a.callTool({name:"PROJECT_PLUGIN_CONFIG_UPDATE",arguments:{projectId:e.id,pluginId:d,connectionId:g,settings:m}});return J(T)}));s.push(...l)}return s},onSuccess:(n,s)=>{s.updatePlugins&&(o.invalidateQueries({queryKey:z.project(r.id,e.slug)}),o.invalidateQueries({queryKey:z.projects(r.id)})),s.bindingUpdates.forEach(({pluginId:l})=>{o.invalidateQueries({queryKey:z.projectPluginConfig(e.id??"",l)})}),v({}),x({}),h({}),X.success("Plugins updated successfully")},onError:n=>{X.error("Failed to update plugins: "+(n instanceof Error?n.message:"Unknown error"))},onSettled:()=>{B(!1)}}),f=()=>{B(!0);const n=new Set([...Object.keys(w),...Object.keys(N)]),s=Array.from(n).map(l=>{const d=w[l],g=N[l],m=g?{...g.baseSettings??{},vtexConnectionId:g.value}:void 0;return{pluginId:l,connectionId:d!==void 0?d:void 0,settings:m}});k.mutate({enabledPlugins:I(),updatePlugins:Object.keys(c).length>0,bindingUpdates:s})},i=()=>{v({}),x({}),h({})},y=n=>{const s=se.find(l=>l.pluginId===n);return s?{label:s.label,icon:s.items[0]?.icon}:null},p=n=>Q.find(l=>l.id===n)?.description??null;return Q.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"flex flex-col",children:Q.map(n=>{const s=y(n.id),l=p(n.id),d=j(n.id);return t.jsx(Ne,{plugin:n,isEnabled:d,isSaving:u,pendingBinding:w[n.id],pendingVtexBinding:N[n.id],description:l,label:s?.label??n.id,icon:s?.icon??t.jsx(de,{size:14}),projectId:e.id,client:a,onBindingChange:b,onVtexBindingChange:C,onToggle:S},n.id)})}),t.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[t.jsx(W,{variant:"outline",onClick:i,disabled:!E||u,children:"Cancel"}),t.jsx(W,{onClick:f,disabled:!E||u,className:"min-w-24",children:u?"Saving...":"Save Changes"})]})]})}function De(){const r=Z.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Features"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Extend your project with built-in capabilities that activate automatically on any connection that supports them."})]}),t.jsx(Se,{})]}),r[0]=e):e=r[0],e}export{De as P};
1
+ import{r as K,j as t,v as ee,B as W,u as te,n as ne,t as X,K as z,b8 as Q,ba as se,c as Z,bb as ie}from"./index-DVHuYwO5.js";import{u as oe}from"./useQuery-CxvwMb--.js";import{u as re}from"./useMutation-BskhtN65.js";import{u as le,a as ae}from"./constants-DLWxw8L_.js";import{S as ce}from"./switch-C_rwAMG7.js";import{L as $}from"./label-BEcdY3zl.js";import{n as de}from"./Container-BcN3rU1W.js";import{h as ue}from"./use-connection-CwB1S0Lk.js";import{a as ge,c as me}from"./use-binding-Dx_NAnJa.js";import{u as pe}from"./use-install-from-registry-CMYlie1K.js";import{i as fe}from"./Loading01-DUUFtL7S.js";import{s as xe}from"./Plus-2wrCLrAD.js";import{S as he,a as je,b as be,c as Ce,d as Y}from"./select-CZ5oa2ZG.js";function H({value:r,onValueChange:e,placeholder:o="Select a connection...",binding:a,bindingType:c,onAddNew:v,className:w,disabled:x=!1}){const[N,h]=K.useState(!1),{installByBinding:u,isInstalling:B}=pe(),P=N||B,j=ue(),I=ge({connections:j,binding:typeof a=="string"?a:void 0}),E=!a||!j?j??[]:typeof a=="string"?I:Array.isArray(a)&&a.length>0?j.filter(i=>me(i,a)):j,S=(()=>{if(!c?.startsWith("@"))return null;const[i,y]=c.replace("@","").split("/");return i&&y?{scope:i,appName:y}:null})(),b=(()=>{let i=E;const y=Array.isArray(a)&&a.length>0;if(S&&!y&&(i=i.filter(p=>{const n=p.app_name,s=p.metadata?.scopeName;return n===S.appName&&s===S.scope})),r&&!i.some(p=>p.id===r)){const p=j?.find(n=>n.id===r);if(p)return[p,...i]}return i})(),C=c?.startsWith("@"),k=async()=>{if(C&&c){h(!0);try{const i=await u(c);i&&e(i.id)}finally{h(!1)}return}v?.()},f=b.find(i=>i.id===r);return t.jsxs(he,{value:r??"none",onValueChange:i=>e(i==="none"?null:i),disabled:x,children:[t.jsx(je,{size:"sm",className:ee("w-[200px]",w),children:t.jsx(be,{placeholder:o,children:f?t.jsxs("div",{className:"flex items-center gap-2",children:[f.icon?t.jsx("img",{src:f.icon,alt:f.title,className:"w-4 h-4 rounded shrink-0"}):t.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:f.title.slice(0,1).toUpperCase()}),t.jsx("span",{className:"truncate",children:f.title})]}):o})}),t.jsxs(Ce,{children:[t.jsx(Y,{value:"none",children:"No connection"}),b.length===0?t.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):b.map(i=>t.jsx(Y,{value:i.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"w-4 h-4 rounded"}):t.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:i.title.slice(0,1).toUpperCase()}),t.jsx("span",{children:i.title})]})},i.id)),(v||C)&&t.jsx("div",{className:"border-t border-border",children:t.jsx(W,{onPointerDown:i=>i.stopPropagation(),onClick:i=>{i.preventDefault(),i.stopPropagation(),k()},disabled:P||x,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:P?t.jsxs(t.Fragment,{children:[t.jsx(fe,{size:16,className:"animate-spin"}),t.jsx("span",{children:"Connecting..."})]}):t.jsxs(t.Fragment,{children:[t.jsx(xe,{size:16}),t.jsx("span",{children:"Add Connection"})]})})})]})]})}const ye=r=>{if(!r||typeof r!="object")return!1;const e=r;return e.type==="text"&&typeof e.text=="string"&&e.text.trim().toLowerCase().startsWith("error")},J=r=>{const e=r.structuredContent??r,o=e&&typeof e=="object"?e:null,a=o?.content?.[0]?.text&&typeof o.content[0].text=="string"?o.content[0].text:null;if(o?.isError)throw new Error(a??"Tool call failed");if(ye(e))throw new Error(e.text);return e};function ve(r){return r.requiresMcpBinding===!0?!0:r.binding!==void 0}function Ne(r){const e=Z.c(62),{plugin:o,isEnabled:a,isSaving:c,pendingBinding:v,pendingVtexBinding:w,description:x,label:N,icon:h,projectId:u,client:B,onBindingChange:P,onVtexBindingChange:j,onToggle:I}=r;let E;e[0]!==o?(E=ve(o),e[0]=o,e[1]=E):E=e[1];const S=E;let b;e[2]!==o.id||e[3]!==u?(b=z.projectPluginConfig(u??"",o.id),e[2]=o.id,e[3]=u,e[4]=b):b=e[4];let C;e[5]!==B||e[6]!==o.id||e[7]!==u?(C=async()=>{if(!u)throw new Error("Project ID is required to load plugin config.");const V=await B.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:u,pluginId:o.id}});return J(V)},e[5]=B,e[6]=o.id,e[7]=u,e[8]=C):C=e[8];const k=!!u&&S;let f;e[9]!==b||e[10]!==C||e[11]!==k?(f={queryKey:b,queryFn:C,enabled:k},e[9]=b,e[10]=C,e[11]=k,e[12]=f):f=e[12];const{data:i,isLoading:y}=oe(f),p=i?.config?.connectionId??null,n=v!==void 0?v:p,s=i?.config?.settings&&typeof i.config.settings=="object"?i.config.settings:null,l=typeof s?.vtexConnectionId=="string"?s.vtexConnectionId:null,d=w!==void 0?w.value:l,g=o.id==="collection-reorder-ranking";let m;e[13]!==a||e[14]!==c||e[15]!==I||e[16]!==o.id?(m=()=>!c&&I(o.id,!a),e[13]=a,e[14]=c,e[15]=I,e[16]=o.id,e[17]=m):m=e[17];const T=c?void 0:"pointer";let O;e[18]!==T?(O={cursor:T},e[18]=T,e[19]=O):O=e[19];let L;e[20]!==h?(L=h&&t.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0 [&>svg]:size-4",children:h}),e[20]=h,e[21]=L):L=e[21];let R;e[22]!==N?(R=t.jsx("p",{className:"text-sm font-medium text-foreground",children:N}),e[22]=N,e[23]=R):R=e[23];let F;e[24]!==x?(F=x&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:x}),e[24]=x,e[25]=F):F=e[25];let _;e[26]!==R||e[27]!==F?(_=t.jsxs("div",{className:"min-w-0",children:[R,F]}),e[26]=R,e[27]=F,e[28]=_):_=e[28];let A;e[29]!==_||e[30]!==L?(A=t.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[L,_]}),e[29]=_,e[30]=L,e[31]=A):A=e[31];let U;e[32]!==I||e[33]!==o.id?(U=V=>I(o.id,V),e[32]=I,e[33]=o.id,e[34]=U):U=e[34];let D;e[35]!==a||e[36]!==c||e[37]!==U?(D=t.jsx("div",{onClick:Ie,className:"shrink-0",children:t.jsx(ce,{checked:a,onCheckedChange:U,disabled:c})}),e[35]=a,e[36]=c,e[37]=U,e[38]=D):D=e[38];let q;e[39]!==A||e[40]!==D?(q=t.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[A,D]}),e[39]=A,e[40]=D,e[41]=q):q=e[41];let G;e[42]!==g||e[43]!==y||e[44]!==a||e[45]!==c||e[46]!==S||e[47]!==P||e[48]!==j||e[49]!==o.binding||e[50]!==o.id||e[51]!==n||e[52]!==p||e[53]!==s||e[54]!==l||e[55]!==d?(G=a&&S&&t.jsxs("div",{className:"pb-4 pl-7 space-y-2",onClick:Pe,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),t.jsx(H,{value:n??null,onValueChange:V=>P(o.id,V,p),binding:o.binding,placeholder:"Select connection...",className:"w-56",disabled:c||y})]}),g&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($,{className:"text-xs text-muted-foreground w-24",children:"VTEX"}),t.jsx(H,{value:d??null,onValueChange:V=>j(o.id,V,l,s),binding:ie,placeholder:"Select VTEX connection...",className:"w-56",disabled:c||y})]})]}),e[42]=g,e[43]=y,e[44]=a,e[45]=c,e[46]=S,e[47]=P,e[48]=j,e[49]=o.binding,e[50]=o.id,e[51]=n,e[52]=p,e[53]=s,e[54]=l,e[55]=d,e[56]=G):G=e[56];let M;return e[57]!==q||e[58]!==G||e[59]!==m||e[60]!==O?(M=t.jsxs("div",{className:"flex flex-col border-b border-border last:border-0",onClick:m,style:O,children:[q,G]}),e[57]=q,e[58]=G,e[59]=m,e[60]=O,e[61]=M):M=e[61],M}function Pe(r){return r.stopPropagation()}function Ie(r){return r.stopPropagation()}function Se(){const{org:r,project:e}=te(),o=ne(),a=le({connectionId:ae,orgId:r.id}),[c,v]=K.useState({}),[w,x]=K.useState({}),[N,h]=K.useState({}),[u,B]=K.useState(!1),P=e.enabledPlugins??[],j=n=>{const s=c[n];return s!==void 0?s:P.includes(n)},I=()=>{const n=new Set(P);for(const[s,l]of Object.entries(c))l?n.add(s):n.delete(s);return Array.from(n)},E=Object.keys(c).length>0||Object.keys(w).length>0||Object.keys(N).length>0,S=(n,s)=>{const l=P.includes(n);v(s===l?d=>{const{[n]:g,...m}=d;return m}:d=>({...d,[n]:s}))},b=(n,s,l)=>{if(s===l){x(d=>{const{[n]:g,...m}=d;return m});return}x(d=>({...d,[n]:s}))},C=(n,s,l,d)=>{if(s===l){h(g=>{const{[n]:m,...T}=g;return T});return}h(g=>({...g,[n]:{value:s,baseSettings:d}}))},k=re({mutationFn:async n=>{const s=[];if(n.updatePlugins){const l=await a.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:n.enabledPlugins}});s.push(J(l))}if(n.bindingUpdates.length>0){const l=await Promise.all(n.bindingUpdates.map(async({pluginId:d,connectionId:g,settings:m})=>{const T=await a.callTool({name:"PROJECT_PLUGIN_CONFIG_UPDATE",arguments:{projectId:e.id,pluginId:d,connectionId:g,settings:m}});return J(T)}));s.push(...l)}return s},onSuccess:(n,s)=>{s.updatePlugins&&(o.invalidateQueries({queryKey:z.project(r.id,e.slug)}),o.invalidateQueries({queryKey:z.projects(r.id)})),s.bindingUpdates.forEach(({pluginId:l})=>{o.invalidateQueries({queryKey:z.projectPluginConfig(e.id??"",l)})}),v({}),x({}),h({}),X.success("Plugins updated successfully")},onError:n=>{X.error("Failed to update plugins: "+(n instanceof Error?n.message:"Unknown error"))},onSettled:()=>{B(!1)}}),f=()=>{B(!0);const n=new Set([...Object.keys(w),...Object.keys(N)]),s=Array.from(n).map(l=>{const d=w[l],g=N[l],m=g?{...g.baseSettings??{},vtexConnectionId:g.value}:void 0;return{pluginId:l,connectionId:d!==void 0?d:void 0,settings:m}});k.mutate({enabledPlugins:I(),updatePlugins:Object.keys(c).length>0,bindingUpdates:s})},i=()=>{v({}),x({}),h({})},y=n=>{const s=se.find(l=>l.pluginId===n);return s?{label:s.label,icon:s.items[0]?.icon}:null},p=n=>Q.find(l=>l.id===n)?.description??null;return Q.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"flex flex-col",children:Q.map(n=>{const s=y(n.id),l=p(n.id),d=j(n.id);return t.jsx(Ne,{plugin:n,isEnabled:d,isSaving:u,pendingBinding:w[n.id],pendingVtexBinding:N[n.id],description:l,label:s?.label??n.id,icon:s?.icon??t.jsx(de,{size:14}),projectId:e.id,client:a,onBindingChange:b,onVtexBindingChange:C,onToggle:S},n.id)})}),t.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[t.jsx(W,{variant:"outline",onClick:i,disabled:!E||u,children:"Cancel"}),t.jsx(W,{onClick:f,disabled:!E||u,className:"min-w-24",children:u?"Saving...":"Save Changes"})]})]})}function De(){const r=Z.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Features"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Extend your project with built-in capabilities that activate automatically on any connection that supports them."})]}),t.jsx(Se,{})]}),r[0]=e):e=r[0],e}export{De as P};
@@ -1 +1 @@
1
- import{b9 as G,c as O,u as H,v as M,j as s,aD as V,r as I,b as q,B as R,O as U}from"./index-CzFqQvXW.js";import{a as F}from"./use-project-Bd8syAM2.js";import{P as D}from"./index-BeKO7nFo.js";import{E as T,C as J}from"./collection-search-aEfiIRVT.js";import{A as K}from"./avatar-DX9xarA9.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-BUAUU3kY.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-CtNnsyqL.js";import"./useQuery-BE7O7fKt.js";import"./constants-0JLhMmM7.js";import"./localstorage-keys-DtK7peUq.js";import"./useMutation-DsQcwaJP.js";import"./tooltip-BGn6dJhi.js";import"./index-gksA6r5d.js";import"./Loading01-DvHkBn5K.js";import"./SearchMd-Bec1mZCp.js";import"./input-Rcf9et7W.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dialog-CzmRWg_H.js";import"./X-BaOBrQh9.js";import"./form-EW4LFI0z.js";import"./label-DdGHGWov.js";import"./textarea-CumbsokS.js";import"./Check-BGWNBpXb.js";import"./ChevronRight-B-dZm0Fo.js";const te=G("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function se(t){const e=O.c(58),{project:l,onSettingsClick:c}=t,{org:r}=H(),d=l.ui?.themeColor??"#60a5fa",b=l.ui?.bannerColor??d,m=l.ui?.banner?`url(${l.ui.banner})`:void 0;let i;e[0]!==b||e[1]!==m?(i={backgroundColor:b,backgroundImage:m,backgroundSize:"cover",backgroundPosition:"center"},e[0]=b,e[1]=m,e[2]=i):i=e[2];const _=i;let u;e[3]!==r.slug||e[4]!==l.slug?(u={org:r.slug,project:l.slug},e[3]=r.slug,e[4]=l.slug,e[5]=u):u=e[5];let f;e[6]!==c?(f=B=>{B.preventDefault(),B.stopPropagation(),c?.(B)},e[6]=c,e[7]=f):f=e[7];let x,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=M("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors"),v=s.jsx(te,{className:"size-3.5 text-white"}),e[8]=x,e[9]=v):(x=e[8],v=e[9]);let g;e[10]!==f?(g=s.jsx("button",{type:"button",onClick:f,className:x,children:v}),e[10]=f,e[11]=g):g=e[11];let p;e[12]!==_||e[13]!==g?(p=s.jsx("div",{className:"h-20 relative",style:_,children:g}),e[12]=_,e[13]=g,e[14]=p):p=e[14];let n;e[15]!==l.name||e[16]!==l.ui||e[17]!==d?(n=l.ui?.icon?s.jsx("img",{src:l.ui.icon,alt:"",className:"size-8 rounded-md object-cover"}):s.jsx("div",{className:"size-8 rounded-md flex items-center justify-center",style:{backgroundColor:d},children:s.jsx("span",{className:"text-sm font-medium text-white",children:l.name.charAt(0).toUpperCase()})}),e[15]=l.name,e[16]=l.ui,e[17]=d,e[18]=n):n=e[18];let a;e[19]!==l.name?(a=s.jsx("h3",{className:"font-medium text-base text-foreground truncate",children:l.name}),e[19]=l.name,e[20]=a):a=e[20];let h;e[21]!==l.updatedAt?(h=Q(new Date(l.updatedAt),{addSuffix:!0}),e[21]=l.updatedAt,e[22]=h):h=e[22];let j;e[23]!==h?(j=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edited"," ",h]}),e[23]=h,e[24]=j):j=e[24];let C;e[25]!==a||e[26]!==j?(C=s.jsxs("div",{className:"flex flex-col",children:[a,j]}),e[25]=a,e[26]=j,e[27]=C):C=e[27];let N;e[28]!==n||e[29]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-4",children:[n,C]}),e[28]=n,e[29]=C,e[30]=N):N=e[30];let k;e[31]!==l.boundConnections?(k=l.boundConnections.slice(0,4).map(le),e[31]=l.boundConnections,e[32]=k):k=e[32];let P;e[33]!==l.boundConnections.length?(P=l.boundConnections.length>4&&s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsxs("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center text-xs text-muted-foreground",children:["+",l.boundConnections.length-4]})}),e[33]=l.boundConnections.length,e[34]=P):P=e[34];let y;e[35]!==k||e[36]!==P?(y=s.jsxs("div",{className:"flex pr-2",children:[k,P]}),e[35]=k,e[36]=P,e[37]=y):y=e[37];const z=r.logo??void 0;let w;e[38]!==r.name||e[39]!==z?(w=s.jsx(K,{url:z,fallback:r.name,size:"2xs",className:"shrink-0 rounded",objectFit:"cover"}),e[38]=r.name,e[39]=z,e[40]=w):w=e[40];let S;e[41]!==r.name?(S=s.jsx("span",{className:"truncate max-w-20",children:r.name}),e[41]=r.name,e[42]=S):S=e[42];let o;e[43]!==w||e[44]!==S?(o=s.jsxs("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[w,S]}),e[43]=w,e[44]=S,e[45]=o):o=e[45];let L;e[46]!==y||e[47]!==o?(L=s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[y,o]}),e[46]=y,e[47]=o,e[48]=L):L=e[48];let $;e[49]!==N||e[50]!==L?($=s.jsxs("div",{className:"flex flex-col flex-1 justify-between p-4",children:[N,L]}),e[49]=N,e[50]=L,e[51]=$):$=e[51];let A;e[52]!==$||e[53]!==p?(A=s.jsxs("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[p,$]}),e[52]=$,e[53]=p,e[54]=A):A=e[54];let E;return e[55]!==A||e[56]!==u?(E=s.jsx(V,{to:"/$org/$project",params:u,className:"block group",children:A}),e[55]=A,e[56]=u,e[57]=E):E=e[57],E}function le(t){return s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsx(re,{connection:t})},t.id)}function re(t){const e=O.c(13),{connection:l}=t;if(l.icon){let m;e[0]!==l.icon||e[1]!==l.title?(m=s.jsx("img",{src:l.icon,alt:l.title,className:"size-4 object-cover"}),e[0]=l.icon,e[1]=l.title,e[2]=m):m=e[2];let i;return e[3]!==l.title||e[4]!==m?(i=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:l.title,children:m}),e[3]=l.title,e[4]=m,e[5]=i):i=e[5],i}const c=l.title;let r;e[6]!==l.title?(r=l.title.charAt(0).toUpperCase(),e[6]=l.title,e[7]=r):r=e[7];let d;e[8]!==r?(d=s.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:r}),e[8]=r,e[9]=d):d=e[9];let b;return e[10]!==l.title||e[11]!==d?(b=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:c,children:d}),e[10]=l.title,e[11]=d,e[12]=b):b=e[12],b}function Ae(){const t=O.c(40),{org:e}=H(),{data:l,isLoading:c}=F(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=q();let _,u,f,x,v,g,p,n,a;if(t[0]!==c||t[1]!==i||t[2]!==e.slug||t[3]!==l||t[4]!==r){const N=l?.filter(ie)?.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())||o.description?.toLowerCase().includes(r.toLowerCase()))??[];let k;t[14]!==i||t[15]!==e.slug?(k=o=>{i({to:"/$org/$project/projects/$slug/settings/general",params:{org:e.slug,project:U,slug:o}})},t[14]=i,t[15]=e.slug,t[16]=k):k=t[16];const P=k;let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m(!0)},t[17]=y):y=t[17];const z=y;u=D;let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(D.Header.Left,{children:s.jsx(X,{children:s.jsx(Y,{children:s.jsx(Z,{children:s.jsx(ee,{children:"Projects"})})})})}),t[18]=w):w=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(D.Header,{children:[w,s.jsx(D.Header.Right,{children:s.jsx(R,{onClick:z,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Create new project"})})]}),t[19]=n):n=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o=>{o.key==="Escape"&&(d(""),o.target.blur())},t[20]=S):S=t[20],t[21]!==r?(a=s.jsx(J,{value:r,onChange:d,placeholder:"Search for a project...",onKeyDown:S}),t[21]=r,t[22]=a):a=t[22],_=D.Content,f="@container",t[23]!==c?(x=c&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:[...Array(4)].map(oe)})}),t[23]=c,t[24]=x):x=t[24],v=!c&&N.length===0&&r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects found",description:`No projects match "${r}"`})}),g=!c&&N.length===0&&!r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects yet",description:"Create a project to get started.",actions:s.jsx(R,{onClick:z,children:"Create new project"})})}),p=!c&&N.length>0&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:N.map(o=>s.jsx(se,{project:o,onSettingsClick:()=>P(o.slug)},o.id))})}),t[0]=c,t[1]=i,t[2]=e.slug,t[3]=l,t[4]=r,t[5]=_,t[6]=u,t[7]=f,t[8]=x,t[9]=v,t[10]=g,t[11]=p,t[12]=n,t[13]=a}else _=t[5],u=t[6],f=t[7],x=t[8],v=t[9],g=t[10],p=t[11],n=t[12],a=t[13];let h;t[25]!==_||t[26]!==f||t[27]!==x||t[28]!==v||t[29]!==g||t[30]!==p?(h=s.jsxs(_,{className:f,children:[x,v,g,p]}),t[25]=_,t[26]=f,t[27]=x,t[28]=v,t[29]=g,t[30]=p,t[31]=h):h=t[31];let j;t[32]!==b?(j=s.jsx(W,{open:b,onOpenChange:m}),t[32]=b,t[33]=j):j=t[33];let C;return t[34]!==u||t[35]!==n||t[36]!==a||t[37]!==h||t[38]!==j?(C=s.jsxs(u,{children:[n,a,h,j]}),t[34]=u,t[35]=n,t[36]=a,t[37]=h,t[38]=j,t[39]=C):C=t[39],C}function oe(t,e){return s.jsx("div",{className:"h-[240px] rounded-xl bg-muted animate-pulse"},e)}function ie(t){return t.slug!==U}export{Ae as default};
1
+ import{b9 as G,c as O,u as H,v as M,j as s,aD as V,r as I,b as q,B as R,O as U}from"./index-DVHuYwO5.js";import{a as F}from"./use-project-C5wS8512.js";import{P as D}from"./index-5XdaBbnC.js";import{E as T,C as J}from"./collection-search-g7bCyEl4.js";import{A as K}from"./avatar-C0Za2Leb.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-BURFxz7l.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-BF7wgZMj.js";import"./useQuery-CxvwMb--.js";import"./constants-DLWxw8L_.js";import"./localstorage-keys-B3yhvN27.js";import"./useMutation-BskhtN65.js";import"./tooltip-BsUirxUt.js";import"./index-BLvVZqmB.js";import"./Loading01-DUUFtL7S.js";import"./SearchMd-DOdaT51-.js";import"./input-CImrwNsE.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dialog-B8ODwZHJ.js";import"./X-BGHsyt4s.js";import"./form-Bqy3P0kv.js";import"./label-BEcdY3zl.js";import"./textarea-BOlS_fKd.js";import"./Check-llxZXJNk.js";import"./ChevronRight-bI92hTEK.js";const te=G("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function se(t){const e=O.c(58),{project:l,onSettingsClick:c}=t,{org:r}=H(),d=l.ui?.themeColor??"#60a5fa",b=l.ui?.bannerColor??d,m=l.ui?.banner?`url(${l.ui.banner})`:void 0;let i;e[0]!==b||e[1]!==m?(i={backgroundColor:b,backgroundImage:m,backgroundSize:"cover",backgroundPosition:"center"},e[0]=b,e[1]=m,e[2]=i):i=e[2];const _=i;let u;e[3]!==r.slug||e[4]!==l.slug?(u={org:r.slug,project:l.slug},e[3]=r.slug,e[4]=l.slug,e[5]=u):u=e[5];let f;e[6]!==c?(f=B=>{B.preventDefault(),B.stopPropagation(),c?.(B)},e[6]=c,e[7]=f):f=e[7];let x,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=M("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors"),v=s.jsx(te,{className:"size-3.5 text-white"}),e[8]=x,e[9]=v):(x=e[8],v=e[9]);let g;e[10]!==f?(g=s.jsx("button",{type:"button",onClick:f,className:x,children:v}),e[10]=f,e[11]=g):g=e[11];let p;e[12]!==_||e[13]!==g?(p=s.jsx("div",{className:"h-20 relative",style:_,children:g}),e[12]=_,e[13]=g,e[14]=p):p=e[14];let n;e[15]!==l.name||e[16]!==l.ui||e[17]!==d?(n=l.ui?.icon?s.jsx("img",{src:l.ui.icon,alt:"",className:"size-8 rounded-md object-cover"}):s.jsx("div",{className:"size-8 rounded-md flex items-center justify-center",style:{backgroundColor:d},children:s.jsx("span",{className:"text-sm font-medium text-white",children:l.name.charAt(0).toUpperCase()})}),e[15]=l.name,e[16]=l.ui,e[17]=d,e[18]=n):n=e[18];let a;e[19]!==l.name?(a=s.jsx("h3",{className:"font-medium text-base text-foreground truncate",children:l.name}),e[19]=l.name,e[20]=a):a=e[20];let h;e[21]!==l.updatedAt?(h=Q(new Date(l.updatedAt),{addSuffix:!0}),e[21]=l.updatedAt,e[22]=h):h=e[22];let j;e[23]!==h?(j=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edited"," ",h]}),e[23]=h,e[24]=j):j=e[24];let C;e[25]!==a||e[26]!==j?(C=s.jsxs("div",{className:"flex flex-col",children:[a,j]}),e[25]=a,e[26]=j,e[27]=C):C=e[27];let N;e[28]!==n||e[29]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-4",children:[n,C]}),e[28]=n,e[29]=C,e[30]=N):N=e[30];let k;e[31]!==l.boundConnections?(k=l.boundConnections.slice(0,4).map(le),e[31]=l.boundConnections,e[32]=k):k=e[32];let P;e[33]!==l.boundConnections.length?(P=l.boundConnections.length>4&&s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsxs("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center text-xs text-muted-foreground",children:["+",l.boundConnections.length-4]})}),e[33]=l.boundConnections.length,e[34]=P):P=e[34];let y;e[35]!==k||e[36]!==P?(y=s.jsxs("div",{className:"flex pr-2",children:[k,P]}),e[35]=k,e[36]=P,e[37]=y):y=e[37];const z=r.logo??void 0;let w;e[38]!==r.name||e[39]!==z?(w=s.jsx(K,{url:z,fallback:r.name,size:"2xs",className:"shrink-0 rounded",objectFit:"cover"}),e[38]=r.name,e[39]=z,e[40]=w):w=e[40];let S;e[41]!==r.name?(S=s.jsx("span",{className:"truncate max-w-20",children:r.name}),e[41]=r.name,e[42]=S):S=e[42];let o;e[43]!==w||e[44]!==S?(o=s.jsxs("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[w,S]}),e[43]=w,e[44]=S,e[45]=o):o=e[45];let L;e[46]!==y||e[47]!==o?(L=s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[y,o]}),e[46]=y,e[47]=o,e[48]=L):L=e[48];let $;e[49]!==N||e[50]!==L?($=s.jsxs("div",{className:"flex flex-col flex-1 justify-between p-4",children:[N,L]}),e[49]=N,e[50]=L,e[51]=$):$=e[51];let A;e[52]!==$||e[53]!==p?(A=s.jsxs("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[p,$]}),e[52]=$,e[53]=p,e[54]=A):A=e[54];let E;return e[55]!==A||e[56]!==u?(E=s.jsx(V,{to:"/$org/$project",params:u,className:"block group",children:A}),e[55]=A,e[56]=u,e[57]=E):E=e[57],E}function le(t){return s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsx(re,{connection:t})},t.id)}function re(t){const e=O.c(13),{connection:l}=t;if(l.icon){let m;e[0]!==l.icon||e[1]!==l.title?(m=s.jsx("img",{src:l.icon,alt:l.title,className:"size-4 object-cover"}),e[0]=l.icon,e[1]=l.title,e[2]=m):m=e[2];let i;return e[3]!==l.title||e[4]!==m?(i=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:l.title,children:m}),e[3]=l.title,e[4]=m,e[5]=i):i=e[5],i}const c=l.title;let r;e[6]!==l.title?(r=l.title.charAt(0).toUpperCase(),e[6]=l.title,e[7]=r):r=e[7];let d;e[8]!==r?(d=s.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:r}),e[8]=r,e[9]=d):d=e[9];let b;return e[10]!==l.title||e[11]!==d?(b=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:c,children:d}),e[10]=l.title,e[11]=d,e[12]=b):b=e[12],b}function Ae(){const t=O.c(40),{org:e}=H(),{data:l,isLoading:c}=F(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=q();let _,u,f,x,v,g,p,n,a;if(t[0]!==c||t[1]!==i||t[2]!==e.slug||t[3]!==l||t[4]!==r){const N=l?.filter(ie)?.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())||o.description?.toLowerCase().includes(r.toLowerCase()))??[];let k;t[14]!==i||t[15]!==e.slug?(k=o=>{i({to:"/$org/$project/projects/$slug/settings/general",params:{org:e.slug,project:U,slug:o}})},t[14]=i,t[15]=e.slug,t[16]=k):k=t[16];const P=k;let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m(!0)},t[17]=y):y=t[17];const z=y;u=D;let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(D.Header.Left,{children:s.jsx(X,{children:s.jsx(Y,{children:s.jsx(Z,{children:s.jsx(ee,{children:"Projects"})})})})}),t[18]=w):w=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(D.Header,{children:[w,s.jsx(D.Header.Right,{children:s.jsx(R,{onClick:z,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Create new project"})})]}),t[19]=n):n=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o=>{o.key==="Escape"&&(d(""),o.target.blur())},t[20]=S):S=t[20],t[21]!==r?(a=s.jsx(J,{value:r,onChange:d,placeholder:"Search for a project...",onKeyDown:S}),t[21]=r,t[22]=a):a=t[22],_=D.Content,f="@container",t[23]!==c?(x=c&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:[...Array(4)].map(oe)})}),t[23]=c,t[24]=x):x=t[24],v=!c&&N.length===0&&r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects found",description:`No projects match "${r}"`})}),g=!c&&N.length===0&&!r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects yet",description:"Create a project to get started.",actions:s.jsx(R,{onClick:z,children:"Create new project"})})}),p=!c&&N.length>0&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:N.map(o=>s.jsx(se,{project:o,onSettingsClick:()=>P(o.slug)},o.id))})}),t[0]=c,t[1]=i,t[2]=e.slug,t[3]=l,t[4]=r,t[5]=_,t[6]=u,t[7]=f,t[8]=x,t[9]=v,t[10]=g,t[11]=p,t[12]=n,t[13]=a}else _=t[5],u=t[6],f=t[7],x=t[8],v=t[9],g=t[10],p=t[11],n=t[12],a=t[13];let h;t[25]!==_||t[26]!==f||t[27]!==x||t[28]!==v||t[29]!==g||t[30]!==p?(h=s.jsxs(_,{className:f,children:[x,v,g,p]}),t[25]=_,t[26]=f,t[27]=x,t[28]=v,t[29]=g,t[30]=p,t[31]=h):h=t[31];let j;t[32]!==b?(j=s.jsx(W,{open:b,onOpenChange:m}),t[32]=b,t[33]=j):j=t[33];let C;return t[34]!==u||t[35]!==n||t[36]!==a||t[37]!==h||t[38]!==j?(C=s.jsxs(u,{children:[n,a,h,j]}),t[34]=u,t[35]=n,t[36]=a,t[37]=h,t[38]=j,t[39]=C):C=t[39],C}function oe(t,e){return s.jsx("div",{className:"h-[240px] rounded-xl bg-muted animate-pulse"},e)}function ie(t){return t.slug!==U}export{Ae as default};
@@ -1 +1 @@
1
- import{r as L,j as s,B as A,c5 as ke,c as _,v as F,t as Re,u as qe,a as Ue,b as We,m as Xe,c6 as He,bb as Ke}from"./index-CzFqQvXW.js";import{c as Le}from"./binder-CN-yhtfQ.js";import{u as xe}from"./useQuery-BE7O7fKt.js";import{h as Ge}from"./use-connection-CmCfM9T5.js";import{a as Qe,u as Ze,j as Te}from"./constants-0JLhMmM7.js";import{u as Ie,P as Je}from"./topbar-portal-mNbAP1zZ.js";import{i as Z}from"./Loading01-DvHkBn5K.js";import{t as Ye}from"./Settings01-CGjDKLLq.js";import{D as et,a as tt,b as st,c as nt,d as lt,e as it}from"./dialog-CzmRWg_H.js";import{D as ot,a as rt,b as at,c as ct}from"./dropdown-menu-bZQdGgsX.js";import{I as ue}from"./input-Rcf9et7W.js";import{S as De}from"./switch-D_s2nP_j.js";import{i as dt}from"./DotsVertical-D-x0DTAA.js";import{s as mt}from"./Plus-C48LE9QF.js";import{i as ut}from"./SearchMd-Bec1mZCp.js";import{i as Se}from"./AlertCircle-Dvy3oHwl.js";import{i as we}from"./ArrowLeft-Ddv8Es1G.js";import{s as xt}from"./Clock-DjTfMWYb.js";import{b as $e,c as z,a as ft,T as P,e as pt,d as gt}from"./table-C7IfzCau.js";import{M as ht}from"./markdown-BsZjpnFH.js";import{n as jt}from"./ArrowDown-B0XF9QfR.js";import{i as bt}from"./ArrowUp-CjPyEOxC.js";import{i as Nt}from"./CheckVerified02-yC2IepeU.js";import{i as ze}from"./File02-BBbAYdh-.js";import{s as yt}from"./Hash02-B-r__uQj.js";import{s as Pe,i as vt}from"./Rows03-RYFV31vk.js";import{u as Ct}from"./useMutation-DsQcwaJP.js";import{i as wt}from"./CheckCircle-CDdaecse.js";import{i as kt}from"./InfoCircle-ORvzz6Jj.js";import{i as It}from"./XCircle-CGBoiIiF.js";import{t as St}from"./ChevronDown-CxLgy5uI.js";import"./X-BaOBrQh9.js";import"./Check-BGWNBpXb.js";import"./ChevronRight-B-dZm0Fo.js";const Ae=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"M21 10H3m13-8v4M8 2v4m2.5 8 1.5-1v5m-1.25 0h2.5M7.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 19.72 21 18.88 21 17.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C18.72 4 17.88 4 16.2 4H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 6.28 3 7.12 3 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 22 6.12 22 7.8 22Z"}));Ae.displayName="CalendarDate";const Oe=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 17-7.869-7.869c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L9.13 11.87c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L2 7m20 10h-7m7 0v-7"}));Oe.displayName="TrendDown01";const Me=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 7-7.869 7.869c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L9.13 12.13c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L2 17M22 7h-7m7 0v7"}));Me.displayName="TrendUp01";const M={collectionsList:t=>["collection-reorder-ranking","collections","list",t],reportsList:(t,e)=>["collection-reorder-ranking","reports","list",t,e],report:(t,e)=>["collection-reorder-ranking","reports","detail",t,e],pluginConfig:(t,e)=>["project-plugin-config",t,e]};function Tt({collections:t,onSelectCollection:e,onAddCollection:i,onDeleteCollection:o,onToggleCollection:l}){const[n,r]=L.useState(!1),[a,c]=L.useState(""),[d,g]=L.useState(""),[m,p]=L.useState(""),[h,j]=L.useState(!1),[I,y]=L.useState(null),[v,C]=L.useState(null),[N,k]=L.useState(""),S=t.filter(f=>!N.trim()||f.title.toLowerCase().includes(N.toLowerCase())||f.farmCollectionId.includes(N)),R=()=>{c(""),g(""),p("")},T=f=>{r(f),f||R()},x=async()=>{const f=a.trim(),b=d.trim();if(!(!f||!b)){j(!0);try{await i({title:f,farmCollectionId:b,decoCollectionId:m.trim()||void 0}),T(!1)}finally{j(!1)}}},D=async(f,b)=>{y(f.id);try{await l(f,b)}finally{y(null)}},E=async f=>{C(f.id);try{await o(f)}finally{C(null)}};return s.jsxs("div",{className:"flex flex-col h-full bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border",children:[s.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"PLP Optimizations"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(ut,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(ue,{value:N,onChange:f=>k(f.target.value),placeholder:"Search for a PLP...",className:"pl-9 w-56 h-9 text-sm"})]}),s.jsxs(A,{size:"sm",className:"bg-black text-white hover:bg-black/80 font-medium border-none",onClick:()=>r(!0),children:[s.jsx(mt,{size:14,className:"mr-1"}),"New collection"]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:t.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Nenhuma collection ainda"}),s.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Adicione sua primeira collection para começar a visualizar os reports de ranking."})]}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-6 py-3 w-full",children:"Name"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Farm ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Deco ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Status"}),s.jsx("th",{className:"px-4 py-3 w-10"})]})}),s.jsxs("tbody",{children:[S.map(f=>s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors group",children:[s.jsx("td",{className:"px-6 py-4 cursor-pointer",onClick:()=>e(f),children:s.jsx("span",{className:"font-medium text-foreground hover:underline",children:f.title})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.farmCollectionId})}),s.jsx("td",{className:"px-4 py-4",children:f.decoCollectionId?s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.decoCollectionId}):s.jsx("span",{className:"text-xs text-muted-foreground/50",children:"—"})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(De,{className:"cursor-pointer",checked:f.isEnabled,disabled:I===f.id,onCheckedChange:b=>{D(f,b)},onClick:b=>b.stopPropagation()})}),s.jsx("td",{className:"px-4 py-4",children:s.jsxs(ot,{children:[s.jsx(rt,{asChild:!0,children:s.jsx("button",{type:"button",className:"cursor-pointer opacity-0 group-hover:opacity-100 inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-opacity",onClick:b=>b.stopPropagation(),children:s.jsx(dt,{size:16,className:"text-muted-foreground"})})}),s.jsx(at,{align:"end",children:s.jsx(ct,{className:"text-destructive focus:text-destructive",disabled:v===f.id,onSelect:()=>{E(f)},children:v===f.id?"Removendo...":"Remover collection"})})]})})]},f.id)),S.length===0&&s.jsx("tr",{children:s.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center text-muted-foreground text-sm",children:["Nenhuma collection encontrada para “",N,"”"]})})]})]})}),s.jsx(et,{open:n,onOpenChange:T,children:s.jsxs(tt,{className:"sm:max-w-md",children:[s.jsxs(st,{children:[s.jsx(nt,{children:"New collection"}),s.jsx(lt,{children:"Configure o nome e os IDs da collection."})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx(ue,{value:a,onChange:f=>c(f.target.value),placeholder:"Nome da collection (ex: Vestidos)"}),s.jsx(ue,{value:d,onChange:f=>g(f.target.value),placeholder:"Farm Collection ID (ex: 1031)"}),s.jsx(ue,{value:m,onChange:f=>p(f.target.value),placeholder:"Deco Collection ID (ex: 2247)"})]}),s.jsxs(it,{children:[s.jsx(A,{variant:"outline",onClick:()=>T(!1),disabled:h,children:"Cancelar"}),s.jsx(A,{onClick:()=>{x()},disabled:h||!a.trim()||!d.trim()||!m.trim(),children:h?"Salvando...":"Criar collection"})]})]})})]})}function Et(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==t||e[1]!==i?(l=M.reportsList(i,t),e[0]=t,e[1]=i,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>(await o("report_list",{collectionId:t,limit:200})).items??[],e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function _t(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==i||e[1]!==t?(l=M.report(i,t),e[0]=i,e[1]=t,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>{const c=await o("report_get",{id:t});if(!c.item)throw new Error("Report not found");return c.item},e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function Rt(t,e){if(t.length===0)return{ok:!1,error:"Nao ha itens na sugestao para aplicar."};const i=[...t].sort((l,n)=>l.position-n.position),o=[];for(const l of i){const n=l,r=n.productId??n.product_id??n.ProductId??n.id,a=r!=null?String(r):null;if(!a)return{ok:!1,error:`Product ID ausente no item #${l.position} (${l.label}).`};o.push(a)}return{ok:!0,collectionId:String(e),productIds:o,productCount:o.length}}const Fe=L.createContext(null);function Lt(t){const e=_.c(3),{value:i,children:o}=t;let l;return e[0]!==o||e[1]!==i?(l=s.jsx(Fe.Provider,{value:i,children:o}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function Dt(){const t=L.useContext(Fe);if(!t)throw new Error("useVtexConnectionContext must be used within VtexConnectionProvider");return t}const $t={passing:"bg-emerald-500",warning:"bg-amber-500",failing:"bg-red-500",info:"bg-blue-500"},Ee=["#A595FF","#FFC116","#DE3A6E"];function fe(t){const e=_.c(7),{icon:i,title:o}=t;let l;e[0]!==i?(l=s.jsx(i,{size:16,className:"opacity-75 shrink-0 text-foreground"}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=s.jsx("span",{className:"text-base text-foreground opacity-75",children:o}),e[2]=o,e[3]=n):n=e[3];let r;return e[4]!==l||e[5]!==n?(r=s.jsxs("div",{className:"flex gap-2 items-center",children:[l,n]}),e[4]=l,e[5]=n,e[6]=r):r=e[6],r}function zt(t){const e=_.c(15),{metric:i}=t;let o;e[0]!==i.unit?(o=i.unit&&s.jsx("span",{className:"text-base text-muted-foreground ml-1",children:i.unit}),e[0]=i.unit,e[1]=o):o=e[1];let l;e[2]!==i.value||e[3]!==o?(l=s.jsxs("div",{className:"text-2xl leading-8 text-foreground font-normal tabular-nums",children:[i.value,o]}),e[2]=i.value,e[3]=o,e[4]=l):l=e[4];let n;e[5]!==i.status?(n=i.status&&s.jsx("span",{className:F("inline-block size-2 rounded-full shrink-0",$t[i.status]??"bg-muted-foreground")}),e[5]=i.status,e[6]=n):n=e[6];let r;e[7]!==i.label?(r=s.jsx("span",{className:"text-sm text-foreground",children:i.label}),e[7]=i.label,e[8]=r):r=e[8];let a;e[9]!==n||e[10]!==r?(a=s.jsxs("div",{className:"flex gap-1.5 items-center",children:[n,r]}),e[9]=n,e[10]=r,e[11]=a):a=e[11];let c;return e[12]!==l||e[13]!==a?(c=s.jsxs("div",{className:"flex flex-col gap-3 items-start justify-end border border-border rounded-lg p-5 flex-1",children:[l,a]}),e[12]=l,e[13]=a,e[14]=c):c=e[14],c}function Pt(t){const e=_.c(9),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Pe,title:i}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=o.map(At),e[2]=o,e[3]=n):n=e[3];let r;e[4]!==n?(r=s.jsx("div",{className:"flex gap-4 items-stretch",children:n}),e[4]=n,e[5]=r):r=e[5];let a;return e[6]!==l||e[7]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[6]=l,e[7]=r,e[8]=a):a=e[8],a}function At(t,e){return s.jsx(zt,{metric:t},`${t.label}-${e}`)}function Ot(t){const e=_.c(11),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Nt,title:i}),e[0]=i,e[1]=l):l=e[1];let n;if(e[2]!==o){let c;e[4]!==o.length?(c=(d,g)=>s.jsxs("div",{className:"flex gap-4 items-stretch",children:[s.jsxs("div",{className:"flex flex-col items-center justify-center w-4 shrink-0",children:[s.jsx("div",{className:"h-full w-px bg-border"}),s.jsx("div",{className:"w-2 h-4 rounded-full flex",style:{backgroundColor:Ee[g%Ee.length]}}),s.jsx("div",{className:F("h-full w-px bg-border",g===o.length-1&&"invisible")})]}),s.jsxs("div",{className:"flex flex-col gap-2 items-start py-3 pb-4 min-w-0",children:[s.jsx("span",{className:"text-sm font-medium text-foreground leading-none",children:d.label}),d.description&&s.jsx("p",{className:"text-sm text-foreground opacity-80 leading-5",children:d.description})]})]},`${d.label}-${g}`),e[4]=o.length,e[5]=c):c=e[5],n=o.map(c),e[2]=o,e[3]=n}else n=e[3];let r;e[6]!==n?(r=s.jsx("div",{className:"flex flex-col",children:n}),e[6]=n,e[7]=r):r=e[7];let a;return e[8]!==l||e[9]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[8]=l,e[9]=r,e[10]=a):a=e[10],a}function Mt(t){const e=_.c(3),{content:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(fe,{icon:ze,title:"Notas"}),e[0]=o):o=e[0];let l;return e[1]!==i?(l=s.jsxs("div",{className:"space-y-4",children:[o,s.jsx(ht,{children:i})]}),e[1]=i,e[2]=l):l=e[2],l}function Ft(t){const e=_.c(11),{delta:i}=t;if(i===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("span",{className:"inline-flex items-center justify-center",children:s.jsx(vt,{size:16,className:"text-muted-foreground"})}),e[0]=d):d=e[0],d}const o=i>0,l=o?"text-emerald-600":"text-destructive";let n;e[1]!==l?(n=F("inline-flex items-center gap-0.5 text-sm font-medium",l),e[1]=l,e[2]=n):n=e[2];let r;e[3]!==o?(r=o?s.jsx(bt,{size:16}):s.jsx(jt,{size:16}),e[3]=o,e[4]=r):r=e[4];let a;e[5]!==i?(a=Math.abs(i),e[5]=i,e[6]=a):a=e[6];let c;return e[7]!==n||e[8]!==r||e[9]!==a?(c=s.jsxs("span",{className:n,children:[r,a]}),e[7]=n,e[8]=r,e[9]=a,e[10]=c):c=e[10],c}function Vt(t){const e=_.c(5),{rows:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ft,{className:"sticky top-0 bg-background z-10",children:s.jsxs($e,{children:[s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"#"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"DELTA"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PRODUTO"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SESSÕES"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SELECT RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"ADD TO CART"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PURCHASE RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"DISPONIB."})]})}),e[0]=o):o=e[0];let l;e[1]!==i?(l=i.map(Bt),e[1]=i,e[2]=l):l=e[2];let n;return e[3]!==l?(n=s.jsx("div",{className:"border border-border rounded-lg overflow-auto max-h-[820px]",children:s.jsxs(pt,{children:[o,s.jsx(gt,{children:l})]})}),e[3]=l,e[4]=n):n=e[4],n}function Bt(t,e){return s.jsxs($e,{children:[s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-1 opacity-50",children:[s.jsx(yt,{size:16,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium text-muted-foreground tabular-nums",children:t.position})]})}),s.jsx(z,{children:t.delta!==void 0?s.jsx(Ft,{delta:t.delta}):"—"}),s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.image&&s.jsx("img",{src:t.image,alt:"",className:"h-12 w-8 object-cover rounded-sm shrink-0 bg-muted"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate max-w-48",children:t.label})]})}),s.jsx(z,{className:"text-sm tabular-nums",children:t.sessions?.toLocaleString()??"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueSelectRate??(t.selectRate!=null?`${(t.selectRate*100).toFixed(2)}%`:"—")}),s.jsx(z,{className:"text-sm tabular-nums",children:t.addToCartRate!=null?`${(t.addToCartRate*100).toFixed(2)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.purchaseRate!=null?`${(t.purchaseRate*100).toFixed(3)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueAvailability??"—"})]},e)}function qt(t){const e=_.c(40),{title:i,rows:o,decoCollectionId:l}=t,{connection:n}=Ie(),{connection:r,toolCaller:a}=Dt();let c;e[0]!==l||e[1]!==o?(c=l?Rt(o,l):{ok:!1,error:"decoCollectionId não disponível para esta collection."},e[0]=l,e[1]=o,e[2]=c):c=e[2];const d=c;let g;e[3]!==r?.tools?(g=r?.tools?.some(Wt)??!1,e[3]=r?.tools,e[4]=g):g=e[4];const m=g,p=!r||!a,h=p?"Configure uma conexão VTEX para aplicar a sugestão.":m?d.ok?null:d.error:"A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.";let j;e[5]!==d||e[6]!==m||e[7]!==p||e[8]!==o||e[9]!==a?(j=async()=>{if(console.log("[Farmrio Reorder] Ranked list recebido para apply:",o),p||!a)throw new Error("Configure uma conexão VTEX para aplicar a sugestão.");if(!m)throw new Error("A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.");if(!d.ok)throw new Error(d.error);return console.log("[Farmrio Reorder] Payload enviado para VTEX_REORDER_COLLECTION:",{collectionId:d.collectionId,productIds:d.productIds,productCount:d.productCount}),a("VTEX_REORDER_COLLECTION",{collectionId:d.collectionId,productIds:d.productIds})},e[5]=d,e[6]=m,e[7]=p,e[8]=o,e[9]=a,e[10]=j):j=e[10];let I;e[11]!==d||e[12]!==o?(I=()=>{const b=d.ok?d.productCount:o.length;Re.success(`Sugestão aplicada com sucesso (${b} produtos).`)},e[11]=d,e[12]=o,e[13]=I):I=e[13];let y;e[14]!==j||e[15]!==I?(y={mutationFn:j,onSuccess:I,onError:Ut},e[14]=j,e[15]=I,e[16]=y):y=e[16];const v=Ct(y);let C;e[17]!==i?(C=i&&s.jsx(fe,{icon:Pe,title:i}),e[17]=i,e[18]=C):C=e[18];let N;e[19]!==v?(N=()=>v.mutate(),e[19]=v,e[20]=N):N=e[20];const k=v.isPending||!!h,S=h??void 0;let R;e[21]!==v.isPending?(R=v.isPending?s.jsx(Z,{size:14,className:"animate-spin"}):null,e[21]=v.isPending,e[22]=R):R=e[22];let T;e[23]!==R||e[24]!==N||e[25]!==k||e[26]!==S?(T=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(A,{type:"button",size:"sm",onClick:N,disabled:k,title:S,children:[R,"Apply Suggestion"]})}),e[23]=R,e[24]=N,e[25]=k,e[26]=S,e[27]=T):T=e[27];let x;e[28]!==T||e[29]!==C?(x=s.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[C,T]}),e[28]=T,e[29]=C,e[30]=x):x=e[30];let D;e[31]!==h||e[32]!==n?(D=h?s.jsx("p",{className:"text-xs text-muted-foreground",children:h}):s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Report via: ",n.title]}),e[31]=h,e[32]=n,e[33]=D):D=e[33];let E;e[34]!==o?(E=s.jsx(Vt,{rows:o}),e[34]=o,e[35]=E):E=e[35];let f;return e[36]!==x||e[37]!==D||e[38]!==E?(f=s.jsxs("div",{className:"space-y-4",children:[x,D,E]}),e[36]=x,e[37]=D,e[38]=E,e[39]=f):f=e[39],f}function Ut(t){const e=t instanceof Error?t.message:"Falha ao aplicar sugestão.";Re.error(e)}function Wt(t){return t.name==="VTEX_REORDER_COLLECTION"}function Xt(t){const e=_.c(18),{section:i,decoCollectionId:o}=t;switch(i.type){case"metrics":{let l;e[0]!==i.metricItems?(l=i.metricItems??[],e[0]=i.metricItems,e[1]=l):l=e[1];let n;return e[2]!==i.title||e[3]!==l?(n=s.jsx(Pt,{title:i.title,items:l}),e[2]=i.title,e[3]=l,e[4]=n):n=e[4],n}case"criteria":{let l;e[5]!==i.criteriaItems?(l=i.criteriaItems??[],e[5]=i.criteriaItems,e[6]=l):l=e[6];let n;return e[7]!==i.title||e[8]!==l?(n=s.jsx(Ot,{title:i.title,items:l}),e[7]=i.title,e[8]=l,e[9]=n):n=e[9],n}case"note":{let l;return e[10]!==i.content?(l=i.content?s.jsx(Mt,{content:i.content}):null,e[10]=i.content,e[11]=l):l=e[11],l}case"ranked-list":{let l;e[12]!==i.rankedItems?(l=i.rankedItems??[],e[12]=i.rankedItems,e[13]=l):l=e[13];let n;return e[14]!==o||e[15]!==i.title||e[16]!==l?(n=s.jsx(qt,{title:i.title,rows:l,decoCollectionId:o}),e[14]=o,e[15]=i.title,e[16]=l,e[17]=n):n=e[17],n}default:return null}}const _e={passing:{label:"Passing",color:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-emerald-500/25",icon:wt},warning:{label:"Warning",color:"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/25",icon:Se},failing:{label:"Failing",color:"bg-red-500/15 text-red-700 dark:text-red-400 border-red-500/25",icon:It},info:{label:"Info",color:"bg-blue-500/15 text-blue-700 dark:text-blue-400 border-blue-500/25",icon:kt}};function Ht(t){const e=_.c(10),{status:i,size:o}=t,l=o===void 0?"default":o,n=_e[i]??_e.info,r=n.icon,a=l==="sm",c=a?"px-2 py-0.5":"px-2.5 py-1";let d;e[0]!==n.color||e[1]!==c?(d=F("inline-flex items-center gap-1 rounded-full border text-xs font-medium",c,n.color),e[0]=n.color,e[1]=c,e[2]=d):d=e[2];const g=a?12:14;let m;e[3]!==r||e[4]!==g?(m=s.jsx(r,{size:g}),e[3]=r,e[4]=g,e[5]=m):m=e[5];let p;return e[6]!==n.label||e[7]!==d||e[8]!==m?(p=s.jsxs("span",{className:d,children:[m,n.label]}),e[6]=n.label,e[7]=d,e[8]=m,e[9]=p):p=e[9],p}function Kt(t){return new Date(t).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Gt(t){const e=_.c(68),{reportId:i,collection:o,onBack:l}=t,{data:n,isLoading:r,error:a}=_t(i);if(r){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando report..."})]}),e[0]=j):j=e[0],j}if(a||!n){let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Se,{size:48,className:"text-destructive mb-4"}),e[1]=j):j=e[1];const I=a?"Erro ao carregar report":"Report não encontrado";let y;e[2]!==I?(y=s.jsx("h3",{className:"text-lg font-medium mb-2",children:I}),e[2]=I,e[3]=y):y=e[3];const v=a?.message??"O report solicitado não foi encontrado.";let C;e[4]!==v?(C=s.jsx("p",{className:"text-muted-foreground text-center mb-4",children:v}),e[4]=v,e[5]=C):C=e[5];let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(we,{size:14,className:"mr-1"}),e[6]=N):N=e[6];let k;e[7]!==l?(k=s.jsxs(A,{variant:"outline",onClick:l,children:[N,"Voltar aos reports"]}),e[7]=l,e[8]=k):k=e[8];let S;return e[9]!==y||e[10]!==C||e[11]!==k?(S=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[j,y,C,k]}),e[9]=y,e[10]=C,e[11]=k,e[12]=S):S=e[12],S}let c,d,g,m;if(e[13]!==o||e[14]!==l||e[15]!==n.category||e[16]!==n.sections||e[17]!==n.source||e[18]!==n.status||e[19]!==n.summary||e[20]!==n.title||e[21]!==n.updatedAt){const j=[...n.sections??[]].sort(Qt);g="flex flex-col h-full overflow-y-auto py-6 px-64";let I;e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(we,{size:14,className:"mr-1"}),e[26]=I):I=e[26];let y;e[27]!==l?(y=s.jsxs(A,{variant:"ghost",size:"sm",onClick:l,className:"self-start -ml-2 mb-2 text-muted-foreground hover:text-foreground",children:[I,"Voltar"]}),e[27]=l,e[28]=y):y=e[28];let v;e[29]!==n.title?(v=s.jsx("h1",{className:"text-xl font-semibold leading-tight",children:n.title}),e[29]=n.title,e[30]=v):v=e[30];let C;e[31]!==n.summary?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:n.summary}),e[31]=n.summary,e[32]=C):C=e[32];let N;e[33]!==v||e[34]!==C?(N=s.jsxs("div",{className:"space-y-1 min-w-0",children:[v,C]}),e[33]=v,e[34]=C,e[35]=N):N=e[35];let k;e[36]!==n.status?(k=n.status&&s.jsx(Ht,{status:n.status}),e[36]=n.status,e[37]=k):k=e[37];let S;e[38]!==k||e[39]!==N?(S=s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[N,k]}),e[38]=k,e[39]=N,e[40]=S):S=e[40];let R;e[41]!==n.category?(R=n.category&&s.jsx("span",{className:"capitalize",children:n.category}),e[41]=n.category,e[42]=R):R=e[42];let T;e[43]!==n.source?(T=n.source&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-border",children:"|"}),s.jsx("span",{children:n.source})]}),e[43]=n.source,e[44]=T):T=e[44];let x;e[45]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("span",{className:"text-border",children:"|"}),e[45]=x):x=e[45];let D;e[46]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(xt,{size:12}),e[46]=D):D=e[46];let E;e[47]!==n.updatedAt?(E=Kt(n.updatedAt),e[47]=n.updatedAt,e[48]=E):E=e[48];let f;e[49]!==E?(f=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[D,E]}),e[49]=E,e[50]=f):f=e[50];let b;e[51]!==R||e[52]!==T||e[53]!==f?(b=s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[R,T,x,f]}),e[51]=R,e[52]=T,e[53]=f,e[54]=b):b=e[54],e[55]!==S||e[56]!==b||e[57]!==y?(m=s.jsxs("div",{className:"border-b border-border py-4 space-y-3",children:[y,S,b]}),e[55]=S,e[56]=b,e[57]=y,e[58]=m):m=e[58],c="flex-1 py-6 space-y-8";let w;e[59]!==o?(w=(V,B)=>s.jsx(Xt,{section:V,decoCollectionId:o.decoCollectionId},V.id??B),e[59]=o,e[60]=w):w=e[60],d=j.map(w),e[13]=o,e[14]=l,e[15]=n.category,e[16]=n.sections,e[17]=n.source,e[18]=n.status,e[19]=n.summary,e[20]=n.title,e[21]=n.updatedAt,e[22]=c,e[23]=d,e[24]=g,e[25]=m}else c=e[22],d=e[23],g=e[24],m=e[25];let p;e[61]!==c||e[62]!==d?(p=s.jsx("div",{className:c,children:d}),e[61]=c,e[62]=d,e[63]=p):p=e[63];let h;return e[64]!==g||e[65]!==m||e[66]!==p?(h=s.jsxs("div",{className:g,children:[m,p]}),e[64]=g,e[65]=m,e[66]=p,e[67]=h):h=e[67],h}function Qt(t,e){return(t.position??0)-(e.position??0)}function Zt(){const t=_.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No report source connected"}),s.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an MCP server that provides reports to view collection reorder ranking insights."})]}),t[0]=e):e=t[0],e}function Jt(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ve(t,e){if(!t)return null;const i=t.find(l=>l.toLowerCase().startsWith(`${e}:`));if(!i)return null;const o=parseInt(i.split(":")[1]??"",10);return Number.isNaN(o)?null:o}function Be(t,e){const i=t.match(e);if(!i||!i[1])return null;const o=parseInt(i[1],10);return Number.isNaN(o)?null:o}function Yt(t){const e=Ve(t.tags,"products");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*products?/i);return i!==null?String(i):"-"}function es(t){const e=Ve(t.tags,"moves");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*moves?/i);return i!==null?String(i):"-"}function ts(t){return t&&t.toLowerCase().includes("week")?"Weekly":"Daily"}function ss(t){const e=_.c(8),{category:i}=t;let o;e[0]!==i?(o=ts(i),e[0]=i,e[1]=o):o=e[1];const l=o,r=l==="Weekly"?"bg-purple-50 text-purple-700 border-purple-200":"bg-sky-50 text-sky-700 border-sky-200";let a;e[2]!==r?(a=F("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border",r),e[2]=r,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ae,{size:11}),e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==a?(d=s.jsxs("span",{className:a,children:[c,l]}),e[5]=l,e[6]=a,e[7]=d):d=e[7],d}function ns(t){const e=_.c(9),{status:i}=t;if(!i){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-muted-foreground",children:"-"}),e[0]=c):c=e[0],c}let o,l,n;if(e[1]!==i){const c={passing:"text-emerald-700",applied:"text-emerald-700",warning:"text-amber-700",failing:"text-red-600",info:"text-blue-600"};let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d={passing:"Applied",applied:"Applied",warning:"Warning",failing:"Failed",info:"Info"},e[5]=d):d=e[5],o=d,l=i.toLowerCase(),n=F("text-sm font-medium",c[l]??"text-foreground"),e[1]=i,e[2]=o,e[3]=l,e[4]=n}else o=e[2],l=e[3],n=e[4];const r=o[l]??i;let a;return e[6]!==n||e[7]!==r?(a=s.jsx("span",{className:n,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a}function ls(t){const e=_.c(11),{variant:i}=t,o=i===void 0?"up":i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={up:"M0,32 C10,28 20,24 30,20 S50,14 60,10 S80,6 90,4 S110,2 120,0",down:"M0,4 C10,8 20,12 30,16 S50,22 60,26 S80,30 90,32 S110,34 120,36",flat:"M0,20 C20,18 40,22 60,20 S80,18 100,20 S110,20 120,20"},e[0]=l):l=e[0];const n=l;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={up:{stroke:"#6366f1",fill:"rgba(99,102,241,0.12)"},down:{stroke:"#f59e0b",fill:"rgba(245,158,11,0.12)"},flat:{stroke:"#94a3b8",fill:"rgba(148,163,184,0.08)"}},e[1]=r):r=e[1];const a=r,{stroke:c,fill:d}=a[o],g=n[o],m=`${g} L120,40 L0,40 Z`;let p;e[2]!==m||e[3]!==d?(p=s.jsx("path",{d:m,fill:d}),e[2]=m,e[3]=d,e[4]=p):p=e[4];let h;e[5]!==g||e[6]!==c?(h=s.jsx("path",{d:g,stroke:c,strokeWidth:"1.5",fill:"none"}),e[5]=g,e[6]=c,e[7]=h):h=e[7];let j;return e[8]!==p||e[9]!==h?(j=s.jsxs("svg",{width:120,height:40,viewBox:"0 0 120 40",className:"opacity-80",children:[p,h]}),e[8]=p,e[9]=h,e[10]=j):j=e[10],j}function is(t){const e=_.c(18),{label:i,value:o,delta:l,trending:n,sparkVariant:r}=t;let a;e[0]!==i?(a=s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:i})}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==o?(c=s.jsx("span",{className:"text-2xl font-semibold text-foreground leading-none",children:o}),e[2]=o,e[3]=c):c=e[3];let d;e[4]!==l||e[5]!==n?(d=l&&s.jsxs("div",{className:F("flex items-center gap-1 text-xs font-medium",n==="up"?"text-emerald-600":"text-amber-600"),children:[n==="up"?s.jsx(Me,{size:12}):s.jsx(Oe,{size:12}),l]}),e[4]=l,e[5]=n,e[6]=d):d=e[6];let g;e[7]!==c||e[8]!==d?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,d]}),e[7]=c,e[8]=d,e[9]=g):g=e[9];let m;e[10]!==r?(m=s.jsx(ls,{variant:r}),e[10]=r,e[11]=m):m=e[11];let p;e[12]!==g||e[13]!==m?(p=s.jsxs("div",{className:"flex items-end justify-between gap-2",children:[g,m]}),e[12]=g,e[13]=m,e[14]=p):p=e[14];let h;return e[15]!==a||e[16]!==p?(h=s.jsxs("div",{className:"p-5 flex flex-col gap-2 min-w-0",children:[a,p]}),e[15]=a,e[16]=p,e[17]=h):h=e[17],h}const os=[{label:"Sessions",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Engagement",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Add Cart",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Revenue",value:"-",delta:null,trending:null,sparkVariant:"flat"}];function rs({collection:t,onBack:e,onSelectReport:i,onToggleCollection:o}){const{data:l=[],isLoading:n,error:r}=Et(t.id),[a,c]=L.useState(!1),d=async m=>{if(o){c(!0);try{await o(t,m)}finally{c(!1)}}},g=[...l].sort((m,p)=>new Date(p.updatedAt).getTime()-new Date(m.updatedAt).getTime());return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:s.jsx(we,{size:15})}),s.jsx("span",{className:"text-muted-foreground text-base select-none",children:"/"}),s.jsx("span",{className:"text-base font-semibold text-foreground",children:t.title}),s.jsx(De,{checked:t.isEnabled,disabled:a||!o,onCheckedChange:m=>{d(m)},className:"ml-1 cursor-pointer"})]}),s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors rounded px-2 py-1 hover:bg-muted",children:[s.jsxs("span",{children:[new Date(Date.now()-744*60*60*1e3).toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})," ","-"," ",new Date().toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})]}),s.jsx(St,{size:14})]})]}),s.jsx("div",{className:"grid grid-cols-4 border-b border-border divide-x divide-border shrink-0",children:os.map(m=>s.jsx(is,{...m},m.label))}),s.jsxs("div",{className:"flex items-center gap-4 px-5 py-3 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-4 rounded border border-border flex items-center justify-center shrink-0",children:s.jsx("div",{className:"size-2 rounded-sm bg-foreground"})}),s.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:"A/B TEST"})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"AI 50%"}),s.jsxs("div",{className:"flex-1 h-3.5 flex rounded-full overflow-hidden",children:[s.jsx("div",{className:"flex-1 bg-indigo-500"}),s.jsx("div",{className:"flex-1 bg-amber-400"})]}),s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"50% MANUAL"})]}),s.jsx(A,{size:"sm",variant:"outline",className:"shrink-0 h-8 text-xs",children:"Compare A/B"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:n?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:28,className:"animate-spin text-muted-foreground mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading runs..."})]}):r?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(Se,{size:40,className:"text-destructive mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"Error loading runs"}),s.jsx("p",{className:"text-muted-foreground text-center text-sm",children:r.message})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:40,className:"text-muted-foreground mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"No runs yet"}),s.jsx("p",{className:"text-muted-foreground max-w-sm text-sm",children:"Runs will appear here once the MCP generates rankings for this collection."})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-5 pt-5 pb-3",children:s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Runs"})}),s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-5 py-2.5 w-14",children:"#"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Run Date"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Type"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Products"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Moves"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Status"}),s.jsx("th",{className:"w-8"})]})}),s.jsx("tbody",{children:g.map(m=>{const p=Yt(m),h=es(m),j=!!m.summary;return s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors cursor-pointer group",onClick:()=>i(m.id),children:[s.jsxs("td",{className:"px-5 py-4 text-sm text-muted-foreground font-mono",children:["#",m.id]}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground whitespace-nowrap",children:Jt(m.updatedAt)}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ss,{category:m.category})}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:p}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:h}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ns,{status:m.status})}),s.jsx("td",{className:"px-3 py-4",children:j&&s.jsx(ze,{size:14,className:"text-muted-foreground/50 opacity-0 group-hover:opacity-100 transition-opacity"})})]},m.id)})})]})]})})]})}function as(t){return t?t.filter(e=>Le(e,He)):[]}function Ws(){const t=_.c(100),{org:e,project:i}=qe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const l=Ue(o),n=We(),r=Xe(),a=Ge(),c=l.collectionId??null,d=l.reportId??null;let g;t[1]!==n?(g=u=>{n({search:u?{collectionId:u}:{},replace:!0})},t[1]=n,t[2]=g):g=t[2];const m=g;let p;t[3]!==c||t[4]!==n?(p=u=>{c&&n({search:u?{collectionId:c,reportId:String(u)}:{collectionId:c},replace:!0})},t[3]=c,t[4]=n,t[5]=p):p=t[5];const h=p;let j;t[6]!==e.id?(j={connectionId:Qe,orgId:e.id},t[6]=e.id,t[7]=j):j=t[7];const I=Ze(j);let y;t[8]!==i.id?(y=M.pluginConfig(i.id??"","collection-reorder-ranking"),t[8]=i.id,t[9]=y):y=t[9];let v;t[10]!==i.id||t[11]!==I?(v=async()=>{const u=await I.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:i.id,pluginId:"collection-reorder-ranking"}});return u.structuredContent??u},t[10]=i.id,t[11]=I,t[12]=v):v=t[12];const C=!!i.id;let N;t[13]!==y||t[14]!==v||t[15]!==C?(N={queryKey:y,queryFn:v,enabled:C},t[13]=y,t[14]=v,t[15]=C,t[16]=N):N=t[16];const{data:k,isLoading:S}=xe(N),R=as(a),T=k?.config?.connectionId,x=T?R.find(u=>u.id===T):null,D=k?.config?.settings&&typeof k.config.settings=="object"?k.config.settings:null,E=typeof D?.vtexConnectionId=="string"?D.vtexConnectionId:null;let f;t[17]!==a||t[18]!==E?(f=E?a?.find(u=>u.id===E&&Le(u,Ke))??null:null,t[17]=a,t[18]=E,t[19]=f):f=t[19];const b=f,w=Te({connectionId:x?.id,orgId:e.id}),V=b?.id;let B;t[20]!==e.id||t[21]!==V?(B={connectionId:V,orgId:e.id},t[20]=e.id,t[21]=V,t[22]=B):B=t[22];const J=Te(B),pe=M.collectionsList(x?.id??"");let q;t[23]!==w?(q=async()=>{const u=await w.callTool({name:"collection_list",arguments:{isEnabled:!0,limit:200}});return(u.structuredContent??u).items??[]},t[23]=w,t[24]=q):q=t[24];const ge=!!w&&!!x;let Y;t[25]!==pe||t[26]!==q||t[27]!==ge?(Y={queryKey:pe,queryFn:q,enabled:ge},t[25]=pe,t[26]=q,t[27]=ge,t[28]=Y):Y=t[28];const{data:he,isLoading:ee}=xe(Y);let te;t[29]!==he?(te=he??[],t[29]=he,t[30]=te):te=t[30];const U=te;let se;t[31]!==c||t[32]!==U?(se=c?U.find(u=>String(u.id)===c)??null:null,t[31]=c,t[32]=U,t[33]=se):se=t[33];const O=se;let ne;t[34]!==e.id||t[35]!==e.name||t[36]!==e.slug?(ne={id:e.id,slug:e.slug,name:e.name},t[34]=e.id,t[35]=e.name,t[36]=e.slug,t[37]=ne):ne=t[37];const je=ne;let le;t[38]!==w||t[39]!==x?.id||t[40]!==r?(le=async u=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_create",arguments:{title:u.title,farmCollectionId:u.farmCollectionId,decoCollectionId:u.decoCollectionId}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[38]=w,t[39]=x?.id,t[40]=r,t[41]=le):le=t[41];const be=le;let ie;t[42]!==c||t[43]!==w||t[44]!==x?.id||t[45]!==r||t[46]!==m?(ie=async u=>{if(c===String(u.id)&&m(null),!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:!1}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[42]=c,t[43]=w,t[44]=x?.id,t[45]=r,t[46]=m,t[47]=ie):ie=t[47];const Ne=ie;let oe;t[48]!==w||t[49]!==x?.id||t[50]!==r?(oe=async(u,$)=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:$}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[48]=w,t[49]=x?.id,t[50]=r,t[51]=oe):oe=t[51];const re=oe;if(S){let u;return t[52]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),t[52]=u):u=t[52],u}if(R.length===0){let u;return t[53]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Zt,{}),t[53]=u):u=t[53],u}if(!x){let u;return t[54]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx(Ye,{size:48,className:"text-muted-foreground mb-2"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Plugin Not Configured"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This plugin requires a Farmrio reorder connection to be configured. Go to project settings to select which integration to use."})]})}),t[54]=u):u=t[54],u}if(c&&!O&&!ee){let u;t[55]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Collection Not Found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"The selected collection was not found."})]}),t[55]=u):u=t[55];let $;return t[56]!==m?($=s.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:[u,s.jsx(A,{variant:"outline",onClick:()=>m(null),children:"Back to collections"})]}),t[56]=m,t[57]=$):$=t[57],$}let W;t[58]!==x.app_id||t[59]!==x.app_name||t[60]!==x.description||t[61]!==x.icon||t[62]!==x.id||t[63]!==x.metadata||t[64]!==x.title||t[65]!==x.tools?(W={id:x.id,title:x.title,icon:x.icon,description:x.description,app_name:x.app_name,app_id:x.app_id,tools:x.tools,metadata:x.metadata},t[58]=x.app_id,t[59]=x.app_name,t[60]=x.description,t[61]=x.icon,t[62]=x.id,t[63]=x.metadata,t[64]=x.title,t[65]=x.tools,t[66]=W):W=t[66];let ae;t[67]!==w?(ae=(u,$)=>w?w.callTool({name:u,arguments:$}).then(ds):Promise.reject(new Error("MCP client is not available")),t[67]=w,t[68]=ae):ae=t[68];const ye=ae;let ce;t[69]!==x.id||t[70]!==je||t[71]!==W||t[72]!==ye?(ce={connectionId:x.id,connection:W,toolCaller:ye,org:je,session:null},t[69]=x.id,t[70]=je,t[71]=W,t[72]=ye,t[73]=ce):ce=t[73];const ve=ce;let X;t[74]!==b?(X=b?{id:b.id,title:b.title,icon:b.icon,description:b.description,app_name:b.app_name,app_id:b.app_id,tools:b.tools,metadata:b.metadata}:null,t[74]=b,t[75]=X):X=t[75];let H;t[76]!==J?(H=J?(u,$)=>J.callTool({name:u,arguments:$}).then(cs):null,t[76]=J,t[77]=H):H=t[77];let de;t[78]!==X||t[79]!==H?(de={connection:X,toolCaller:H},t[78]=X,t[79]=H,t[80]=de):de=t[80];const Ce=de;let K;t[81]!==c||t[82]!==U||t[83]!==be||t[84]!==Ne||t[85]!==re||t[86]!==ee||t[87]!==d||t[88]!==O||t[89]!==m||t[90]!==h?(K=ee&&!c?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading collections..."})]}):c?d&&O?s.jsx(Gt,{reportId:Number(d),collection:O,onBack:()=>h(null)}):O?s.jsx(rs,{collection:O,onBack:()=>m(null),onSelectReport:u=>h(u),onToggleCollection:re}):null:s.jsx(Tt,{collections:U,onSelectCollection:u=>m(String(u.id)),onAddCollection:be,onDeleteCollection:Ne,onToggleCollection:re}),t[81]=c,t[82]=U,t[83]=be,t[84]=Ne,t[85]=re,t[86]=ee,t[87]=d,t[88]=O,t[89]=m,t[90]=h,t[91]=K):K=t[91];let G;t[92]!==K?(G=s.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:s.jsx("div",{className:"flex-1 overflow-hidden",children:K})}),t[92]=K,t[93]=G):G=t[93];let Q;t[94]!==G||t[95]!==Ce?(Q=s.jsx(Lt,{value:Ce,children:G}),t[94]=G,t[95]=Ce,t[96]=Q):Q=t[96];let me;return t[97]!==ve||t[98]!==Q?(me=s.jsx(Je,{value:ve,children:Q}),t[97]=ve,t[98]=Q,t[99]=me):me=t[99],me}function cs(t){return t.structuredContent??t}function ds(t){return t.structuredContent??t}export{Ws as default};
1
+ import{r as L,j as s,B as A,c5 as ke,c as _,v as F,t as Re,u as qe,a as Ue,b as We,n as Xe,c6 as He,bb as Ke}from"./index-DVHuYwO5.js";import{c as Le}from"./binder-C2Kwp5aI.js";import{u as xe}from"./useQuery-CxvwMb--.js";import{h as Ge}from"./use-connection-CwB1S0Lk.js";import{a as Qe,u as Ze,j as Te}from"./constants-DLWxw8L_.js";import{u as Ie,P as Je}from"./topbar-portal-Cy4hr4gX.js";import{i as Z}from"./Loading01-DUUFtL7S.js";import{t as Ye}from"./Settings01-jEDDrq49.js";import{D as et,a as tt,b as st,c as nt,d as lt,e as it}from"./dialog-B8ODwZHJ.js";import{D as ot,a as rt,b as at,c as ct}from"./dropdown-menu-Bv0kDZGf.js";import{I as ue}from"./input-CImrwNsE.js";import{S as De}from"./switch-C_rwAMG7.js";import{i as dt}from"./DotsVertical-D7GBR06C.js";import{s as mt}from"./Plus-2wrCLrAD.js";import{i as ut}from"./SearchMd-DOdaT51-.js";import{i as Se}from"./AlertCircle-DtdVhcv9.js";import{i as we}from"./ArrowLeft-Dse_UWo5.js";import{s as xt}from"./Clock-DCqyBdVg.js";import{b as $e,c as z,a as ft,T as P,e as pt,d as gt}from"./table-BwN-DdG1.js";import{M as ht}from"./markdown-DigmZCi5.js";import{n as jt}from"./ArrowDown-CD9f6dVF.js";import{i as bt}from"./ArrowUp-C5pU0t20.js";import{i as Nt}from"./CheckVerified02-B5N8FkZi.js";import{i as ze}from"./File02-8H6UbpEV.js";import{s as yt}from"./Hash02-B4zt7eqf.js";import{s as Pe,i as vt}from"./Rows03-CeP6X8F6.js";import{u as Ct}from"./useMutation-BskhtN65.js";import{i as wt}from"./CheckCircle-naMxBwcc.js";import{i as kt}from"./InfoCircle-DDBpFLdR.js";import{i as It}from"./XCircle-BJSW1V34.js";import{t as St}from"./ChevronDown-BPvdqfh0.js";import"./X-BGHsyt4s.js";import"./Check-llxZXJNk.js";import"./ChevronRight-bI92hTEK.js";const Ae=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"M21 10H3m13-8v4M8 2v4m2.5 8 1.5-1v5m-1.25 0h2.5M7.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 19.72 21 18.88 21 17.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C18.72 4 17.88 4 16.2 4H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 6.28 3 7.12 3 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 22 6.12 22 7.8 22Z"}));Ae.displayName="CalendarDate";const Oe=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 17-7.869-7.869c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L9.13 11.87c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L2 7m20 10h-7m7 0v-7"}));Oe.displayName="TrendDown01";const Me=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 7-7.869 7.869c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L9.13 12.13c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L2 17M22 7h-7m7 0v7"}));Me.displayName="TrendUp01";const M={collectionsList:t=>["collection-reorder-ranking","collections","list",t],reportsList:(t,e)=>["collection-reorder-ranking","reports","list",t,e],report:(t,e)=>["collection-reorder-ranking","reports","detail",t,e],pluginConfig:(t,e)=>["project-plugin-config",t,e]};function Tt({collections:t,onSelectCollection:e,onAddCollection:i,onDeleteCollection:o,onToggleCollection:l}){const[n,r]=L.useState(!1),[a,c]=L.useState(""),[d,g]=L.useState(""),[m,p]=L.useState(""),[h,j]=L.useState(!1),[I,y]=L.useState(null),[v,C]=L.useState(null),[N,k]=L.useState(""),S=t.filter(f=>!N.trim()||f.title.toLowerCase().includes(N.toLowerCase())||f.farmCollectionId.includes(N)),R=()=>{c(""),g(""),p("")},T=f=>{r(f),f||R()},x=async()=>{const f=a.trim(),b=d.trim();if(!(!f||!b)){j(!0);try{await i({title:f,farmCollectionId:b,decoCollectionId:m.trim()||void 0}),T(!1)}finally{j(!1)}}},D=async(f,b)=>{y(f.id);try{await l(f,b)}finally{y(null)}},E=async f=>{C(f.id);try{await o(f)}finally{C(null)}};return s.jsxs("div",{className:"flex flex-col h-full bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border",children:[s.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"PLP Optimizations"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(ut,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(ue,{value:N,onChange:f=>k(f.target.value),placeholder:"Search for a PLP...",className:"pl-9 w-56 h-9 text-sm"})]}),s.jsxs(A,{size:"sm",className:"bg-black text-white hover:bg-black/80 font-medium border-none",onClick:()=>r(!0),children:[s.jsx(mt,{size:14,className:"mr-1"}),"New collection"]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:t.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Nenhuma collection ainda"}),s.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Adicione sua primeira collection para começar a visualizar os reports de ranking."})]}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-6 py-3 w-full",children:"Name"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Farm ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Deco ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Status"}),s.jsx("th",{className:"px-4 py-3 w-10"})]})}),s.jsxs("tbody",{children:[S.map(f=>s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors group",children:[s.jsx("td",{className:"px-6 py-4 cursor-pointer",onClick:()=>e(f),children:s.jsx("span",{className:"font-medium text-foreground hover:underline",children:f.title})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.farmCollectionId})}),s.jsx("td",{className:"px-4 py-4",children:f.decoCollectionId?s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.decoCollectionId}):s.jsx("span",{className:"text-xs text-muted-foreground/50",children:"—"})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(De,{className:"cursor-pointer",checked:f.isEnabled,disabled:I===f.id,onCheckedChange:b=>{D(f,b)},onClick:b=>b.stopPropagation()})}),s.jsx("td",{className:"px-4 py-4",children:s.jsxs(ot,{children:[s.jsx(rt,{asChild:!0,children:s.jsx("button",{type:"button",className:"cursor-pointer opacity-0 group-hover:opacity-100 inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-opacity",onClick:b=>b.stopPropagation(),children:s.jsx(dt,{size:16,className:"text-muted-foreground"})})}),s.jsx(at,{align:"end",children:s.jsx(ct,{className:"text-destructive focus:text-destructive",disabled:v===f.id,onSelect:()=>{E(f)},children:v===f.id?"Removendo...":"Remover collection"})})]})})]},f.id)),S.length===0&&s.jsx("tr",{children:s.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center text-muted-foreground text-sm",children:["Nenhuma collection encontrada para “",N,"”"]})})]})]})}),s.jsx(et,{open:n,onOpenChange:T,children:s.jsxs(tt,{className:"sm:max-w-md",children:[s.jsxs(st,{children:[s.jsx(nt,{children:"New collection"}),s.jsx(lt,{children:"Configure o nome e os IDs da collection."})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx(ue,{value:a,onChange:f=>c(f.target.value),placeholder:"Nome da collection (ex: Vestidos)"}),s.jsx(ue,{value:d,onChange:f=>g(f.target.value),placeholder:"Farm Collection ID (ex: 1031)"}),s.jsx(ue,{value:m,onChange:f=>p(f.target.value),placeholder:"Deco Collection ID (ex: 2247)"})]}),s.jsxs(it,{children:[s.jsx(A,{variant:"outline",onClick:()=>T(!1),disabled:h,children:"Cancelar"}),s.jsx(A,{onClick:()=>{x()},disabled:h||!a.trim()||!d.trim()||!m.trim(),children:h?"Salvando...":"Criar collection"})]})]})})]})}function Et(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==t||e[1]!==i?(l=M.reportsList(i,t),e[0]=t,e[1]=i,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>(await o("report_list",{collectionId:t,limit:200})).items??[],e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function _t(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==i||e[1]!==t?(l=M.report(i,t),e[0]=i,e[1]=t,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>{const c=await o("report_get",{id:t});if(!c.item)throw new Error("Report not found");return c.item},e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function Rt(t,e){if(t.length===0)return{ok:!1,error:"Nao ha itens na sugestao para aplicar."};const i=[...t].sort((l,n)=>l.position-n.position),o=[];for(const l of i){const n=l,r=n.productId??n.product_id??n.ProductId??n.id,a=r!=null?String(r):null;if(!a)return{ok:!1,error:`Product ID ausente no item #${l.position} (${l.label}).`};o.push(a)}return{ok:!0,collectionId:String(e),productIds:o,productCount:o.length}}const Fe=L.createContext(null);function Lt(t){const e=_.c(3),{value:i,children:o}=t;let l;return e[0]!==o||e[1]!==i?(l=s.jsx(Fe.Provider,{value:i,children:o}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function Dt(){const t=L.useContext(Fe);if(!t)throw new Error("useVtexConnectionContext must be used within VtexConnectionProvider");return t}const $t={passing:"bg-emerald-500",warning:"bg-amber-500",failing:"bg-red-500",info:"bg-blue-500"},Ee=["#A595FF","#FFC116","#DE3A6E"];function fe(t){const e=_.c(7),{icon:i,title:o}=t;let l;e[0]!==i?(l=s.jsx(i,{size:16,className:"opacity-75 shrink-0 text-foreground"}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=s.jsx("span",{className:"text-base text-foreground opacity-75",children:o}),e[2]=o,e[3]=n):n=e[3];let r;return e[4]!==l||e[5]!==n?(r=s.jsxs("div",{className:"flex gap-2 items-center",children:[l,n]}),e[4]=l,e[5]=n,e[6]=r):r=e[6],r}function zt(t){const e=_.c(15),{metric:i}=t;let o;e[0]!==i.unit?(o=i.unit&&s.jsx("span",{className:"text-base text-muted-foreground ml-1",children:i.unit}),e[0]=i.unit,e[1]=o):o=e[1];let l;e[2]!==i.value||e[3]!==o?(l=s.jsxs("div",{className:"text-2xl leading-8 text-foreground font-normal tabular-nums",children:[i.value,o]}),e[2]=i.value,e[3]=o,e[4]=l):l=e[4];let n;e[5]!==i.status?(n=i.status&&s.jsx("span",{className:F("inline-block size-2 rounded-full shrink-0",$t[i.status]??"bg-muted-foreground")}),e[5]=i.status,e[6]=n):n=e[6];let r;e[7]!==i.label?(r=s.jsx("span",{className:"text-sm text-foreground",children:i.label}),e[7]=i.label,e[8]=r):r=e[8];let a;e[9]!==n||e[10]!==r?(a=s.jsxs("div",{className:"flex gap-1.5 items-center",children:[n,r]}),e[9]=n,e[10]=r,e[11]=a):a=e[11];let c;return e[12]!==l||e[13]!==a?(c=s.jsxs("div",{className:"flex flex-col gap-3 items-start justify-end border border-border rounded-lg p-5 flex-1",children:[l,a]}),e[12]=l,e[13]=a,e[14]=c):c=e[14],c}function Pt(t){const e=_.c(9),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Pe,title:i}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=o.map(At),e[2]=o,e[3]=n):n=e[3];let r;e[4]!==n?(r=s.jsx("div",{className:"flex gap-4 items-stretch",children:n}),e[4]=n,e[5]=r):r=e[5];let a;return e[6]!==l||e[7]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[6]=l,e[7]=r,e[8]=a):a=e[8],a}function At(t,e){return s.jsx(zt,{metric:t},`${t.label}-${e}`)}function Ot(t){const e=_.c(11),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Nt,title:i}),e[0]=i,e[1]=l):l=e[1];let n;if(e[2]!==o){let c;e[4]!==o.length?(c=(d,g)=>s.jsxs("div",{className:"flex gap-4 items-stretch",children:[s.jsxs("div",{className:"flex flex-col items-center justify-center w-4 shrink-0",children:[s.jsx("div",{className:"h-full w-px bg-border"}),s.jsx("div",{className:"w-2 h-4 rounded-full flex",style:{backgroundColor:Ee[g%Ee.length]}}),s.jsx("div",{className:F("h-full w-px bg-border",g===o.length-1&&"invisible")})]}),s.jsxs("div",{className:"flex flex-col gap-2 items-start py-3 pb-4 min-w-0",children:[s.jsx("span",{className:"text-sm font-medium text-foreground leading-none",children:d.label}),d.description&&s.jsx("p",{className:"text-sm text-foreground opacity-80 leading-5",children:d.description})]})]},`${d.label}-${g}`),e[4]=o.length,e[5]=c):c=e[5],n=o.map(c),e[2]=o,e[3]=n}else n=e[3];let r;e[6]!==n?(r=s.jsx("div",{className:"flex flex-col",children:n}),e[6]=n,e[7]=r):r=e[7];let a;return e[8]!==l||e[9]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[8]=l,e[9]=r,e[10]=a):a=e[10],a}function Mt(t){const e=_.c(3),{content:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(fe,{icon:ze,title:"Notas"}),e[0]=o):o=e[0];let l;return e[1]!==i?(l=s.jsxs("div",{className:"space-y-4",children:[o,s.jsx(ht,{children:i})]}),e[1]=i,e[2]=l):l=e[2],l}function Ft(t){const e=_.c(11),{delta:i}=t;if(i===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("span",{className:"inline-flex items-center justify-center",children:s.jsx(vt,{size:16,className:"text-muted-foreground"})}),e[0]=d):d=e[0],d}const o=i>0,l=o?"text-emerald-600":"text-destructive";let n;e[1]!==l?(n=F("inline-flex items-center gap-0.5 text-sm font-medium",l),e[1]=l,e[2]=n):n=e[2];let r;e[3]!==o?(r=o?s.jsx(bt,{size:16}):s.jsx(jt,{size:16}),e[3]=o,e[4]=r):r=e[4];let a;e[5]!==i?(a=Math.abs(i),e[5]=i,e[6]=a):a=e[6];let c;return e[7]!==n||e[8]!==r||e[9]!==a?(c=s.jsxs("span",{className:n,children:[r,a]}),e[7]=n,e[8]=r,e[9]=a,e[10]=c):c=e[10],c}function Vt(t){const e=_.c(5),{rows:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ft,{className:"sticky top-0 bg-background z-10",children:s.jsxs($e,{children:[s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"#"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"DELTA"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PRODUTO"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SESSÕES"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SELECT RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"ADD TO CART"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PURCHASE RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"DISPONIB."})]})}),e[0]=o):o=e[0];let l;e[1]!==i?(l=i.map(Bt),e[1]=i,e[2]=l):l=e[2];let n;return e[3]!==l?(n=s.jsx("div",{className:"border border-border rounded-lg overflow-auto max-h-[820px]",children:s.jsxs(pt,{children:[o,s.jsx(gt,{children:l})]})}),e[3]=l,e[4]=n):n=e[4],n}function Bt(t,e){return s.jsxs($e,{children:[s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-1 opacity-50",children:[s.jsx(yt,{size:16,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium text-muted-foreground tabular-nums",children:t.position})]})}),s.jsx(z,{children:t.delta!==void 0?s.jsx(Ft,{delta:t.delta}):"—"}),s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.image&&s.jsx("img",{src:t.image,alt:"",className:"h-12 w-8 object-cover rounded-sm shrink-0 bg-muted"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate max-w-48",children:t.label})]})}),s.jsx(z,{className:"text-sm tabular-nums",children:t.sessions?.toLocaleString()??"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueSelectRate??(t.selectRate!=null?`${(t.selectRate*100).toFixed(2)}%`:"—")}),s.jsx(z,{className:"text-sm tabular-nums",children:t.addToCartRate!=null?`${(t.addToCartRate*100).toFixed(2)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.purchaseRate!=null?`${(t.purchaseRate*100).toFixed(3)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueAvailability??"—"})]},e)}function qt(t){const e=_.c(40),{title:i,rows:o,decoCollectionId:l}=t,{connection:n}=Ie(),{connection:r,toolCaller:a}=Dt();let c;e[0]!==l||e[1]!==o?(c=l?Rt(o,l):{ok:!1,error:"decoCollectionId não disponível para esta collection."},e[0]=l,e[1]=o,e[2]=c):c=e[2];const d=c;let g;e[3]!==r?.tools?(g=r?.tools?.some(Wt)??!1,e[3]=r?.tools,e[4]=g):g=e[4];const m=g,p=!r||!a,h=p?"Configure uma conexão VTEX para aplicar a sugestão.":m?d.ok?null:d.error:"A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.";let j;e[5]!==d||e[6]!==m||e[7]!==p||e[8]!==o||e[9]!==a?(j=async()=>{if(console.log("[Farmrio Reorder] Ranked list recebido para apply:",o),p||!a)throw new Error("Configure uma conexão VTEX para aplicar a sugestão.");if(!m)throw new Error("A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.");if(!d.ok)throw new Error(d.error);return console.log("[Farmrio Reorder] Payload enviado para VTEX_REORDER_COLLECTION:",{collectionId:d.collectionId,productIds:d.productIds,productCount:d.productCount}),a("VTEX_REORDER_COLLECTION",{collectionId:d.collectionId,productIds:d.productIds})},e[5]=d,e[6]=m,e[7]=p,e[8]=o,e[9]=a,e[10]=j):j=e[10];let I;e[11]!==d||e[12]!==o?(I=()=>{const b=d.ok?d.productCount:o.length;Re.success(`Sugestão aplicada com sucesso (${b} produtos).`)},e[11]=d,e[12]=o,e[13]=I):I=e[13];let y;e[14]!==j||e[15]!==I?(y={mutationFn:j,onSuccess:I,onError:Ut},e[14]=j,e[15]=I,e[16]=y):y=e[16];const v=Ct(y);let C;e[17]!==i?(C=i&&s.jsx(fe,{icon:Pe,title:i}),e[17]=i,e[18]=C):C=e[18];let N;e[19]!==v?(N=()=>v.mutate(),e[19]=v,e[20]=N):N=e[20];const k=v.isPending||!!h,S=h??void 0;let R;e[21]!==v.isPending?(R=v.isPending?s.jsx(Z,{size:14,className:"animate-spin"}):null,e[21]=v.isPending,e[22]=R):R=e[22];let T;e[23]!==R||e[24]!==N||e[25]!==k||e[26]!==S?(T=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(A,{type:"button",size:"sm",onClick:N,disabled:k,title:S,children:[R,"Apply Suggestion"]})}),e[23]=R,e[24]=N,e[25]=k,e[26]=S,e[27]=T):T=e[27];let x;e[28]!==T||e[29]!==C?(x=s.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[C,T]}),e[28]=T,e[29]=C,e[30]=x):x=e[30];let D;e[31]!==h||e[32]!==n?(D=h?s.jsx("p",{className:"text-xs text-muted-foreground",children:h}):s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Report via: ",n.title]}),e[31]=h,e[32]=n,e[33]=D):D=e[33];let E;e[34]!==o?(E=s.jsx(Vt,{rows:o}),e[34]=o,e[35]=E):E=e[35];let f;return e[36]!==x||e[37]!==D||e[38]!==E?(f=s.jsxs("div",{className:"space-y-4",children:[x,D,E]}),e[36]=x,e[37]=D,e[38]=E,e[39]=f):f=e[39],f}function Ut(t){const e=t instanceof Error?t.message:"Falha ao aplicar sugestão.";Re.error(e)}function Wt(t){return t.name==="VTEX_REORDER_COLLECTION"}function Xt(t){const e=_.c(18),{section:i,decoCollectionId:o}=t;switch(i.type){case"metrics":{let l;e[0]!==i.metricItems?(l=i.metricItems??[],e[0]=i.metricItems,e[1]=l):l=e[1];let n;return e[2]!==i.title||e[3]!==l?(n=s.jsx(Pt,{title:i.title,items:l}),e[2]=i.title,e[3]=l,e[4]=n):n=e[4],n}case"criteria":{let l;e[5]!==i.criteriaItems?(l=i.criteriaItems??[],e[5]=i.criteriaItems,e[6]=l):l=e[6];let n;return e[7]!==i.title||e[8]!==l?(n=s.jsx(Ot,{title:i.title,items:l}),e[7]=i.title,e[8]=l,e[9]=n):n=e[9],n}case"note":{let l;return e[10]!==i.content?(l=i.content?s.jsx(Mt,{content:i.content}):null,e[10]=i.content,e[11]=l):l=e[11],l}case"ranked-list":{let l;e[12]!==i.rankedItems?(l=i.rankedItems??[],e[12]=i.rankedItems,e[13]=l):l=e[13];let n;return e[14]!==o||e[15]!==i.title||e[16]!==l?(n=s.jsx(qt,{title:i.title,rows:l,decoCollectionId:o}),e[14]=o,e[15]=i.title,e[16]=l,e[17]=n):n=e[17],n}default:return null}}const _e={passing:{label:"Passing",color:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-emerald-500/25",icon:wt},warning:{label:"Warning",color:"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/25",icon:Se},failing:{label:"Failing",color:"bg-red-500/15 text-red-700 dark:text-red-400 border-red-500/25",icon:It},info:{label:"Info",color:"bg-blue-500/15 text-blue-700 dark:text-blue-400 border-blue-500/25",icon:kt}};function Ht(t){const e=_.c(10),{status:i,size:o}=t,l=o===void 0?"default":o,n=_e[i]??_e.info,r=n.icon,a=l==="sm",c=a?"px-2 py-0.5":"px-2.5 py-1";let d;e[0]!==n.color||e[1]!==c?(d=F("inline-flex items-center gap-1 rounded-full border text-xs font-medium",c,n.color),e[0]=n.color,e[1]=c,e[2]=d):d=e[2];const g=a?12:14;let m;e[3]!==r||e[4]!==g?(m=s.jsx(r,{size:g}),e[3]=r,e[4]=g,e[5]=m):m=e[5];let p;return e[6]!==n.label||e[7]!==d||e[8]!==m?(p=s.jsxs("span",{className:d,children:[m,n.label]}),e[6]=n.label,e[7]=d,e[8]=m,e[9]=p):p=e[9],p}function Kt(t){return new Date(t).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Gt(t){const e=_.c(68),{reportId:i,collection:o,onBack:l}=t,{data:n,isLoading:r,error:a}=_t(i);if(r){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando report..."})]}),e[0]=j):j=e[0],j}if(a||!n){let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Se,{size:48,className:"text-destructive mb-4"}),e[1]=j):j=e[1];const I=a?"Erro ao carregar report":"Report não encontrado";let y;e[2]!==I?(y=s.jsx("h3",{className:"text-lg font-medium mb-2",children:I}),e[2]=I,e[3]=y):y=e[3];const v=a?.message??"O report solicitado não foi encontrado.";let C;e[4]!==v?(C=s.jsx("p",{className:"text-muted-foreground text-center mb-4",children:v}),e[4]=v,e[5]=C):C=e[5];let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(we,{size:14,className:"mr-1"}),e[6]=N):N=e[6];let k;e[7]!==l?(k=s.jsxs(A,{variant:"outline",onClick:l,children:[N,"Voltar aos reports"]}),e[7]=l,e[8]=k):k=e[8];let S;return e[9]!==y||e[10]!==C||e[11]!==k?(S=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[j,y,C,k]}),e[9]=y,e[10]=C,e[11]=k,e[12]=S):S=e[12],S}let c,d,g,m;if(e[13]!==o||e[14]!==l||e[15]!==n.category||e[16]!==n.sections||e[17]!==n.source||e[18]!==n.status||e[19]!==n.summary||e[20]!==n.title||e[21]!==n.updatedAt){const j=[...n.sections??[]].sort(Qt);g="flex flex-col h-full overflow-y-auto py-6 px-64";let I;e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(we,{size:14,className:"mr-1"}),e[26]=I):I=e[26];let y;e[27]!==l?(y=s.jsxs(A,{variant:"ghost",size:"sm",onClick:l,className:"self-start -ml-2 mb-2 text-muted-foreground hover:text-foreground",children:[I,"Voltar"]}),e[27]=l,e[28]=y):y=e[28];let v;e[29]!==n.title?(v=s.jsx("h1",{className:"text-xl font-semibold leading-tight",children:n.title}),e[29]=n.title,e[30]=v):v=e[30];let C;e[31]!==n.summary?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:n.summary}),e[31]=n.summary,e[32]=C):C=e[32];let N;e[33]!==v||e[34]!==C?(N=s.jsxs("div",{className:"space-y-1 min-w-0",children:[v,C]}),e[33]=v,e[34]=C,e[35]=N):N=e[35];let k;e[36]!==n.status?(k=n.status&&s.jsx(Ht,{status:n.status}),e[36]=n.status,e[37]=k):k=e[37];let S;e[38]!==k||e[39]!==N?(S=s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[N,k]}),e[38]=k,e[39]=N,e[40]=S):S=e[40];let R;e[41]!==n.category?(R=n.category&&s.jsx("span",{className:"capitalize",children:n.category}),e[41]=n.category,e[42]=R):R=e[42];let T;e[43]!==n.source?(T=n.source&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-border",children:"|"}),s.jsx("span",{children:n.source})]}),e[43]=n.source,e[44]=T):T=e[44];let x;e[45]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("span",{className:"text-border",children:"|"}),e[45]=x):x=e[45];let D;e[46]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(xt,{size:12}),e[46]=D):D=e[46];let E;e[47]!==n.updatedAt?(E=Kt(n.updatedAt),e[47]=n.updatedAt,e[48]=E):E=e[48];let f;e[49]!==E?(f=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[D,E]}),e[49]=E,e[50]=f):f=e[50];let b;e[51]!==R||e[52]!==T||e[53]!==f?(b=s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[R,T,x,f]}),e[51]=R,e[52]=T,e[53]=f,e[54]=b):b=e[54],e[55]!==S||e[56]!==b||e[57]!==y?(m=s.jsxs("div",{className:"border-b border-border py-4 space-y-3",children:[y,S,b]}),e[55]=S,e[56]=b,e[57]=y,e[58]=m):m=e[58],c="flex-1 py-6 space-y-8";let w;e[59]!==o?(w=(V,B)=>s.jsx(Xt,{section:V,decoCollectionId:o.decoCollectionId},V.id??B),e[59]=o,e[60]=w):w=e[60],d=j.map(w),e[13]=o,e[14]=l,e[15]=n.category,e[16]=n.sections,e[17]=n.source,e[18]=n.status,e[19]=n.summary,e[20]=n.title,e[21]=n.updatedAt,e[22]=c,e[23]=d,e[24]=g,e[25]=m}else c=e[22],d=e[23],g=e[24],m=e[25];let p;e[61]!==c||e[62]!==d?(p=s.jsx("div",{className:c,children:d}),e[61]=c,e[62]=d,e[63]=p):p=e[63];let h;return e[64]!==g||e[65]!==m||e[66]!==p?(h=s.jsxs("div",{className:g,children:[m,p]}),e[64]=g,e[65]=m,e[66]=p,e[67]=h):h=e[67],h}function Qt(t,e){return(t.position??0)-(e.position??0)}function Zt(){const t=_.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No report source connected"}),s.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an MCP server that provides reports to view collection reorder ranking insights."})]}),t[0]=e):e=t[0],e}function Jt(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ve(t,e){if(!t)return null;const i=t.find(l=>l.toLowerCase().startsWith(`${e}:`));if(!i)return null;const o=parseInt(i.split(":")[1]??"",10);return Number.isNaN(o)?null:o}function Be(t,e){const i=t.match(e);if(!i||!i[1])return null;const o=parseInt(i[1],10);return Number.isNaN(o)?null:o}function Yt(t){const e=Ve(t.tags,"products");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*products?/i);return i!==null?String(i):"-"}function es(t){const e=Ve(t.tags,"moves");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*moves?/i);return i!==null?String(i):"-"}function ts(t){return t&&t.toLowerCase().includes("week")?"Weekly":"Daily"}function ss(t){const e=_.c(8),{category:i}=t;let o;e[0]!==i?(o=ts(i),e[0]=i,e[1]=o):o=e[1];const l=o,r=l==="Weekly"?"bg-purple-50 text-purple-700 border-purple-200":"bg-sky-50 text-sky-700 border-sky-200";let a;e[2]!==r?(a=F("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border",r),e[2]=r,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ae,{size:11}),e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==a?(d=s.jsxs("span",{className:a,children:[c,l]}),e[5]=l,e[6]=a,e[7]=d):d=e[7],d}function ns(t){const e=_.c(9),{status:i}=t;if(!i){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-muted-foreground",children:"-"}),e[0]=c):c=e[0],c}let o,l,n;if(e[1]!==i){const c={passing:"text-emerald-700",applied:"text-emerald-700",warning:"text-amber-700",failing:"text-red-600",info:"text-blue-600"};let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d={passing:"Applied",applied:"Applied",warning:"Warning",failing:"Failed",info:"Info"},e[5]=d):d=e[5],o=d,l=i.toLowerCase(),n=F("text-sm font-medium",c[l]??"text-foreground"),e[1]=i,e[2]=o,e[3]=l,e[4]=n}else o=e[2],l=e[3],n=e[4];const r=o[l]??i;let a;return e[6]!==n||e[7]!==r?(a=s.jsx("span",{className:n,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a}function ls(t){const e=_.c(11),{variant:i}=t,o=i===void 0?"up":i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={up:"M0,32 C10,28 20,24 30,20 S50,14 60,10 S80,6 90,4 S110,2 120,0",down:"M0,4 C10,8 20,12 30,16 S50,22 60,26 S80,30 90,32 S110,34 120,36",flat:"M0,20 C20,18 40,22 60,20 S80,18 100,20 S110,20 120,20"},e[0]=l):l=e[0];const n=l;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={up:{stroke:"#6366f1",fill:"rgba(99,102,241,0.12)"},down:{stroke:"#f59e0b",fill:"rgba(245,158,11,0.12)"},flat:{stroke:"#94a3b8",fill:"rgba(148,163,184,0.08)"}},e[1]=r):r=e[1];const a=r,{stroke:c,fill:d}=a[o],g=n[o],m=`${g} L120,40 L0,40 Z`;let p;e[2]!==m||e[3]!==d?(p=s.jsx("path",{d:m,fill:d}),e[2]=m,e[3]=d,e[4]=p):p=e[4];let h;e[5]!==g||e[6]!==c?(h=s.jsx("path",{d:g,stroke:c,strokeWidth:"1.5",fill:"none"}),e[5]=g,e[6]=c,e[7]=h):h=e[7];let j;return e[8]!==p||e[9]!==h?(j=s.jsxs("svg",{width:120,height:40,viewBox:"0 0 120 40",className:"opacity-80",children:[p,h]}),e[8]=p,e[9]=h,e[10]=j):j=e[10],j}function is(t){const e=_.c(18),{label:i,value:o,delta:l,trending:n,sparkVariant:r}=t;let a;e[0]!==i?(a=s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:i})}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==o?(c=s.jsx("span",{className:"text-2xl font-semibold text-foreground leading-none",children:o}),e[2]=o,e[3]=c):c=e[3];let d;e[4]!==l||e[5]!==n?(d=l&&s.jsxs("div",{className:F("flex items-center gap-1 text-xs font-medium",n==="up"?"text-emerald-600":"text-amber-600"),children:[n==="up"?s.jsx(Me,{size:12}):s.jsx(Oe,{size:12}),l]}),e[4]=l,e[5]=n,e[6]=d):d=e[6];let g;e[7]!==c||e[8]!==d?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,d]}),e[7]=c,e[8]=d,e[9]=g):g=e[9];let m;e[10]!==r?(m=s.jsx(ls,{variant:r}),e[10]=r,e[11]=m):m=e[11];let p;e[12]!==g||e[13]!==m?(p=s.jsxs("div",{className:"flex items-end justify-between gap-2",children:[g,m]}),e[12]=g,e[13]=m,e[14]=p):p=e[14];let h;return e[15]!==a||e[16]!==p?(h=s.jsxs("div",{className:"p-5 flex flex-col gap-2 min-w-0",children:[a,p]}),e[15]=a,e[16]=p,e[17]=h):h=e[17],h}const os=[{label:"Sessions",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Engagement",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Add Cart",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Revenue",value:"-",delta:null,trending:null,sparkVariant:"flat"}];function rs({collection:t,onBack:e,onSelectReport:i,onToggleCollection:o}){const{data:l=[],isLoading:n,error:r}=Et(t.id),[a,c]=L.useState(!1),d=async m=>{if(o){c(!0);try{await o(t,m)}finally{c(!1)}}},g=[...l].sort((m,p)=>new Date(p.updatedAt).getTime()-new Date(m.updatedAt).getTime());return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:s.jsx(we,{size:15})}),s.jsx("span",{className:"text-muted-foreground text-base select-none",children:"/"}),s.jsx("span",{className:"text-base font-semibold text-foreground",children:t.title}),s.jsx(De,{checked:t.isEnabled,disabled:a||!o,onCheckedChange:m=>{d(m)},className:"ml-1 cursor-pointer"})]}),s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors rounded px-2 py-1 hover:bg-muted",children:[s.jsxs("span",{children:[new Date(Date.now()-744*60*60*1e3).toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})," ","-"," ",new Date().toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})]}),s.jsx(St,{size:14})]})]}),s.jsx("div",{className:"grid grid-cols-4 border-b border-border divide-x divide-border shrink-0",children:os.map(m=>s.jsx(is,{...m},m.label))}),s.jsxs("div",{className:"flex items-center gap-4 px-5 py-3 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-4 rounded border border-border flex items-center justify-center shrink-0",children:s.jsx("div",{className:"size-2 rounded-sm bg-foreground"})}),s.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:"A/B TEST"})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"AI 50%"}),s.jsxs("div",{className:"flex-1 h-3.5 flex rounded-full overflow-hidden",children:[s.jsx("div",{className:"flex-1 bg-indigo-500"}),s.jsx("div",{className:"flex-1 bg-amber-400"})]}),s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"50% MANUAL"})]}),s.jsx(A,{size:"sm",variant:"outline",className:"shrink-0 h-8 text-xs",children:"Compare A/B"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:n?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:28,className:"animate-spin text-muted-foreground mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading runs..."})]}):r?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(Se,{size:40,className:"text-destructive mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"Error loading runs"}),s.jsx("p",{className:"text-muted-foreground text-center text-sm",children:r.message})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:40,className:"text-muted-foreground mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"No runs yet"}),s.jsx("p",{className:"text-muted-foreground max-w-sm text-sm",children:"Runs will appear here once the MCP generates rankings for this collection."})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-5 pt-5 pb-3",children:s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Runs"})}),s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-5 py-2.5 w-14",children:"#"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Run Date"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Type"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Products"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Moves"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Status"}),s.jsx("th",{className:"w-8"})]})}),s.jsx("tbody",{children:g.map(m=>{const p=Yt(m),h=es(m),j=!!m.summary;return s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors cursor-pointer group",onClick:()=>i(m.id),children:[s.jsxs("td",{className:"px-5 py-4 text-sm text-muted-foreground font-mono",children:["#",m.id]}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground whitespace-nowrap",children:Jt(m.updatedAt)}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ss,{category:m.category})}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:p}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:h}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ns,{status:m.status})}),s.jsx("td",{className:"px-3 py-4",children:j&&s.jsx(ze,{size:14,className:"text-muted-foreground/50 opacity-0 group-hover:opacity-100 transition-opacity"})})]},m.id)})})]})]})})]})}function as(t){return t?t.filter(e=>Le(e,He)):[]}function Ws(){const t=_.c(100),{org:e,project:i}=qe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const l=Ue(o),n=We(),r=Xe(),a=Ge(),c=l.collectionId??null,d=l.reportId??null;let g;t[1]!==n?(g=u=>{n({search:u?{collectionId:u}:{},replace:!0})},t[1]=n,t[2]=g):g=t[2];const m=g;let p;t[3]!==c||t[4]!==n?(p=u=>{c&&n({search:u?{collectionId:c,reportId:String(u)}:{collectionId:c},replace:!0})},t[3]=c,t[4]=n,t[5]=p):p=t[5];const h=p;let j;t[6]!==e.id?(j={connectionId:Qe,orgId:e.id},t[6]=e.id,t[7]=j):j=t[7];const I=Ze(j);let y;t[8]!==i.id?(y=M.pluginConfig(i.id??"","collection-reorder-ranking"),t[8]=i.id,t[9]=y):y=t[9];let v;t[10]!==i.id||t[11]!==I?(v=async()=>{const u=await I.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:i.id,pluginId:"collection-reorder-ranking"}});return u.structuredContent??u},t[10]=i.id,t[11]=I,t[12]=v):v=t[12];const C=!!i.id;let N;t[13]!==y||t[14]!==v||t[15]!==C?(N={queryKey:y,queryFn:v,enabled:C},t[13]=y,t[14]=v,t[15]=C,t[16]=N):N=t[16];const{data:k,isLoading:S}=xe(N),R=as(a),T=k?.config?.connectionId,x=T?R.find(u=>u.id===T):null,D=k?.config?.settings&&typeof k.config.settings=="object"?k.config.settings:null,E=typeof D?.vtexConnectionId=="string"?D.vtexConnectionId:null;let f;t[17]!==a||t[18]!==E?(f=E?a?.find(u=>u.id===E&&Le(u,Ke))??null:null,t[17]=a,t[18]=E,t[19]=f):f=t[19];const b=f,w=Te({connectionId:x?.id,orgId:e.id}),V=b?.id;let B;t[20]!==e.id||t[21]!==V?(B={connectionId:V,orgId:e.id},t[20]=e.id,t[21]=V,t[22]=B):B=t[22];const J=Te(B),pe=M.collectionsList(x?.id??"");let q;t[23]!==w?(q=async()=>{const u=await w.callTool({name:"collection_list",arguments:{isEnabled:!0,limit:200}});return(u.structuredContent??u).items??[]},t[23]=w,t[24]=q):q=t[24];const ge=!!w&&!!x;let Y;t[25]!==pe||t[26]!==q||t[27]!==ge?(Y={queryKey:pe,queryFn:q,enabled:ge},t[25]=pe,t[26]=q,t[27]=ge,t[28]=Y):Y=t[28];const{data:he,isLoading:ee}=xe(Y);let te;t[29]!==he?(te=he??[],t[29]=he,t[30]=te):te=t[30];const U=te;let se;t[31]!==c||t[32]!==U?(se=c?U.find(u=>String(u.id)===c)??null:null,t[31]=c,t[32]=U,t[33]=se):se=t[33];const O=se;let ne;t[34]!==e.id||t[35]!==e.name||t[36]!==e.slug?(ne={id:e.id,slug:e.slug,name:e.name},t[34]=e.id,t[35]=e.name,t[36]=e.slug,t[37]=ne):ne=t[37];const je=ne;let le;t[38]!==w||t[39]!==x?.id||t[40]!==r?(le=async u=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_create",arguments:{title:u.title,farmCollectionId:u.farmCollectionId,decoCollectionId:u.decoCollectionId}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[38]=w,t[39]=x?.id,t[40]=r,t[41]=le):le=t[41];const be=le;let ie;t[42]!==c||t[43]!==w||t[44]!==x?.id||t[45]!==r||t[46]!==m?(ie=async u=>{if(c===String(u.id)&&m(null),!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:!1}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[42]=c,t[43]=w,t[44]=x?.id,t[45]=r,t[46]=m,t[47]=ie):ie=t[47];const Ne=ie;let oe;t[48]!==w||t[49]!==x?.id||t[50]!==r?(oe=async(u,$)=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:$}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[48]=w,t[49]=x?.id,t[50]=r,t[51]=oe):oe=t[51];const re=oe;if(S){let u;return t[52]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),t[52]=u):u=t[52],u}if(R.length===0){let u;return t[53]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Zt,{}),t[53]=u):u=t[53],u}if(!x){let u;return t[54]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx(Ye,{size:48,className:"text-muted-foreground mb-2"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Plugin Not Configured"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This plugin requires a Farmrio reorder connection to be configured. Go to project settings to select which integration to use."})]})}),t[54]=u):u=t[54],u}if(c&&!O&&!ee){let u;t[55]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Collection Not Found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"The selected collection was not found."})]}),t[55]=u):u=t[55];let $;return t[56]!==m?($=s.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:[u,s.jsx(A,{variant:"outline",onClick:()=>m(null),children:"Back to collections"})]}),t[56]=m,t[57]=$):$=t[57],$}let W;t[58]!==x.app_id||t[59]!==x.app_name||t[60]!==x.description||t[61]!==x.icon||t[62]!==x.id||t[63]!==x.metadata||t[64]!==x.title||t[65]!==x.tools?(W={id:x.id,title:x.title,icon:x.icon,description:x.description,app_name:x.app_name,app_id:x.app_id,tools:x.tools,metadata:x.metadata},t[58]=x.app_id,t[59]=x.app_name,t[60]=x.description,t[61]=x.icon,t[62]=x.id,t[63]=x.metadata,t[64]=x.title,t[65]=x.tools,t[66]=W):W=t[66];let ae;t[67]!==w?(ae=(u,$)=>w?w.callTool({name:u,arguments:$}).then(ds):Promise.reject(new Error("MCP client is not available")),t[67]=w,t[68]=ae):ae=t[68];const ye=ae;let ce;t[69]!==x.id||t[70]!==je||t[71]!==W||t[72]!==ye?(ce={connectionId:x.id,connection:W,toolCaller:ye,org:je,session:null},t[69]=x.id,t[70]=je,t[71]=W,t[72]=ye,t[73]=ce):ce=t[73];const ve=ce;let X;t[74]!==b?(X=b?{id:b.id,title:b.title,icon:b.icon,description:b.description,app_name:b.app_name,app_id:b.app_id,tools:b.tools,metadata:b.metadata}:null,t[74]=b,t[75]=X):X=t[75];let H;t[76]!==J?(H=J?(u,$)=>J.callTool({name:u,arguments:$}).then(cs):null,t[76]=J,t[77]=H):H=t[77];let de;t[78]!==X||t[79]!==H?(de={connection:X,toolCaller:H},t[78]=X,t[79]=H,t[80]=de):de=t[80];const Ce=de;let K;t[81]!==c||t[82]!==U||t[83]!==be||t[84]!==Ne||t[85]!==re||t[86]!==ee||t[87]!==d||t[88]!==O||t[89]!==m||t[90]!==h?(K=ee&&!c?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading collections..."})]}):c?d&&O?s.jsx(Gt,{reportId:Number(d),collection:O,onBack:()=>h(null)}):O?s.jsx(rs,{collection:O,onBack:()=>m(null),onSelectReport:u=>h(u),onToggleCollection:re}):null:s.jsx(Tt,{collections:U,onSelectCollection:u=>m(String(u.id)),onAddCollection:be,onDeleteCollection:Ne,onToggleCollection:re}),t[81]=c,t[82]=U,t[83]=be,t[84]=Ne,t[85]=re,t[86]=ee,t[87]=d,t[88]=O,t[89]=m,t[90]=h,t[91]=K):K=t[91];let G;t[92]!==K?(G=s.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:s.jsx("div",{className:"flex-1 overflow-hidden",children:K})}),t[92]=K,t[93]=G):G=t[93];let Q;t[94]!==G||t[95]!==Ce?(Q=s.jsx(Lt,{value:Ce,children:G}),t[94]=G,t[95]=Ce,t[96]=Q):Q=t[96];let me;return t[97]!==ve||t[98]!==Q?(me=s.jsx(Je,{value:ve,children:Q}),t[97]=ve,t[98]=Q,t[99]=me):me=t[99],me}function cs(t){return t.structuredContent??t}function ds(t){return t.structuredContent??t}export{Ws as default};
@@ -1 +1 @@
1
- import{c as b,K as E,j as l}from"./index-CzFqQvXW.js";import{u as R}from"./useQuery-BE7O7fKt.js";import{i as j}from"./File06-CZSeKcKm.js";import{i as v}from"./Loading01-DvHkBn5K.js";import{e as _}from"./github-icon-Dp3wHhYE.js";function w(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function A(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,r)=>{let t=e;return r.includes("target=")?t=t.replace(/target="[^"]*"/gi,'target="_blank"'):t=t.replace(/>/,' target="_blank">'),r.includes("rel=")?t=t.replace(/rel="[^"]*"/gi,'rel="noopener noreferrer"'):t=t.replace(/>/,' rel="noopener noreferrer">'),t})}function H(s){let e=w(s);return e=A(e),e}async function L(s,e){try{const r=await fetch(`https://api.github.com/repos/${s}/${e}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!r.ok){if(r.status===404)return null;throw new Error(`Failed to fetch README: ${r.statusText}`)}const t=await r.text();return H(t)}catch(r){return console.error("Error fetching README:",r),null}}function D(s){const e=b.c(18),{repository:r,html:t,isLoading:g,queryKey:h}=s;let n,o,a,m;e[0]!==t||e[1]!==h||e[2]!==r?(n=r?_(r):null,o=!!n&&t===void 0,m=R,a=h??E.githubReadme(n?.owner,n?.repo),e[0]=t,e[1]=h,e[2]=r,e[3]=n,e[4]=o,e[5]=a,e[6]=m):(n=e[3],o=e[4],a=e[5],m=e[6]);let c;e[7]!==n?(c=async()=>n?L(n.owner,n.repo):null,e[7]=n,e[8]=c):c=e[8];let u;e[9]!==o||e[10]!==a||e[11]!==c?(u={queryKey:a,queryFn:c,enabled:o,staleTime:36e5,gcTime:864e5},e[9]=o,e[10]=a,e[11]=c,e[12]=u):u=e[12];const{data:x,isLoading:y}=m(u),f=t??x;if(g??(o&&y)){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(v,{size:32,className:"animate-spin text-muted-foreground"})}),e[13]=i):i=e[13],i}if(!f){let i;return e[14]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[l.jsx(j,{size:48,className:"text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),l.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]}),e[14]=i):i=e[14],i}let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d={backgroundColor:"transparent"},e[15]=d):d=e[15];let p;return e[16]!==f?(p=l.jsx("div",{className:"p-5 markdown-body",style:d,dangerouslySetInnerHTML:{__html:f}}),e[16]=f,e[17]=p):p=e[17],p}export{D as R};
1
+ import{c as b,K as E,j as l}from"./index-DVHuYwO5.js";import{u as R}from"./useQuery-CxvwMb--.js";import{i as j}from"./File06-C1Sd5E1A.js";import{i as v}from"./Loading01-DUUFtL7S.js";import{e as _}from"./github-icon-Dp3wHhYE.js";function w(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function A(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,r)=>{let t=e;return r.includes("target=")?t=t.replace(/target="[^"]*"/gi,'target="_blank"'):t=t.replace(/>/,' target="_blank">'),r.includes("rel=")?t=t.replace(/rel="[^"]*"/gi,'rel="noopener noreferrer"'):t=t.replace(/>/,' rel="noopener noreferrer">'),t})}function H(s){let e=w(s);return e=A(e),e}async function L(s,e){try{const r=await fetch(`https://api.github.com/repos/${s}/${e}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!r.ok){if(r.status===404)return null;throw new Error(`Failed to fetch README: ${r.statusText}`)}const t=await r.text();return H(t)}catch(r){return console.error("Error fetching README:",r),null}}function D(s){const e=b.c(18),{repository:r,html:t,isLoading:g,queryKey:h}=s;let n,o,a,m;e[0]!==t||e[1]!==h||e[2]!==r?(n=r?_(r):null,o=!!n&&t===void 0,m=R,a=h??E.githubReadme(n?.owner,n?.repo),e[0]=t,e[1]=h,e[2]=r,e[3]=n,e[4]=o,e[5]=a,e[6]=m):(n=e[3],o=e[4],a=e[5],m=e[6]);let c;e[7]!==n?(c=async()=>n?L(n.owner,n.repo):null,e[7]=n,e[8]=c):c=e[8];let u;e[9]!==o||e[10]!==a||e[11]!==c?(u={queryKey:a,queryFn:c,enabled:o,staleTime:36e5,gcTime:864e5},e[9]=o,e[10]=a,e[11]=c,e[12]=u):u=e[12];const{data:x,isLoading:y}=m(u),f=t??x;if(g??(o&&y)){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(v,{size:32,className:"animate-spin text-muted-foreground"})}),e[13]=i):i=e[13],i}if(!f){let i;return e[14]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[l.jsx(j,{size:48,className:"text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),l.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]}),e[14]=i):i=e[14],i}let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d={backgroundColor:"transparent"},e[15]=d):d=e[15];let p;return e[16]!==f?(p=l.jsx("div",{className:"p-5 markdown-body",style:d,dangerouslySetInnerHTML:{__html:f}}),e[16]=f,e[17]=p):p=e[17],p}export{D as R};