@decocms/mesh 2.128.3 → 2.129.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 (180) hide show
  1. package/dist/client/assets/{AlertCircle-DQQcPtgD.js → AlertCircle-DFllIHYc.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-hF9xAZsV.js → AlertOctagon-DkJGqjxz.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-Cf0RNEZQ.js → ArrowDown-BCqJRKTw.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-D7lFQljS.js → ArrowLeft-DUx23LCt.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-CKXiX_Ao.js → ArrowUp-CKW1WeCp.js} +1 -1
  6. package/dist/client/assets/{Check-B_1XgGXq.js → Check-CFpzkHgf.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-teFEREuu.js → CheckCircle-DAEjX2-S.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-BlB1S8hb.js → CheckDone01-BeTexMq0.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-C72zve8A.js → CheckVerified02-Cl4WUPt6.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-BCXsTPO0.js → ChevronDown-CZDY410N.js} +1 -1
  11. package/dist/client/assets/{ChevronRight-Dv5Kd3sh.js → ChevronRight-DmlQyyes.js} +1 -1
  12. package/dist/client/assets/{Clock-B4Ctq7dH.js → Clock-BYhPEf3s.js} +1 -1
  13. package/dist/client/assets/{Code01-gdNPPDL2.js → Code01-tDuxE9sy.js} +1 -1
  14. package/dist/client/assets/{Container-JCSa3G3B.js → Container-CwxPOY0d.js} +1 -1
  15. package/dist/client/assets/{Copy01-B1lCFyqr.js → Copy01-CbgFtFXW.js} +1 -1
  16. package/dist/client/assets/{Dataflow03-CmiJ_a2x.js → Dataflow03-IGdQIxop.js} +1 -1
  17. package/dist/client/assets/{DotsHorizontal-DYVOSQNI.js → DotsHorizontal-Dy3izT0z.js} +1 -1
  18. package/dist/client/assets/{DotsVertical-Dv4tBZU-.js → DotsVertical-D74uB5qh.js} +1 -1
  19. package/dist/client/assets/{Download01-DIwP2P7D.js → Download01-CaDNSpb8.js} +1 -1
  20. package/dist/client/assets/{Edit01-DDXcCS4H.js → Edit01-D8XxDVwQ.js} +1 -1
  21. package/dist/client/assets/{Eye-BZHp_wD7.js → Eye-BIF9gjXL.js} +1 -1
  22. package/dist/client/assets/{File02-D8nm9j-J.js → File02-DUrYDugN.js} +1 -1
  23. package/dist/client/assets/{File06-D-_j0iW5.js → File06-CGEI1byM.js} +1 -1
  24. package/dist/client/assets/{FilterLines-BP-6W-PZ.js → FilterLines-ezUjepvA.js} +1 -1
  25. package/dist/client/assets/{Globe01-BUQmYqse.js → Globe01-DQFjI7NL.js} +1 -1
  26. package/dist/client/assets/{Globe02-CitacpSB.js → Globe02-BxR836tG.js} +1 -1
  27. package/dist/client/assets/{Grid01-9bvbF-2s.js → Grid01-NpQl-yoZ.js} +1 -1
  28. package/dist/client/assets/{Hash02-B1Ogol6o.js → Hash02-D1T_na-O.js} +1 -1
  29. package/dist/client/assets/{Home02-BQf2Bq1d.js → Home02-DJFtS4tr.js} +1 -1
  30. package/dist/client/assets/{Image01-DQT9mrMs.js → Image01-Cqm47hN-.js} +1 -1
  31. package/dist/client/assets/{Inbox01-jnM9oRqF.js → Inbox01-DiDAxgDg.js} +1 -1
  32. package/dist/client/assets/{InfoCircle-CGMOojOv.js → InfoCircle-CNFZi0eo.js} +1 -1
  33. package/dist/client/assets/{Key01-xmVowZ8K.js → Key01-BMRBT_9o.js} +1 -1
  34. package/dist/client/assets/{LinkExternal01-D9XuFg7K.js → LinkExternal01-y5rFoKhK.js} +1 -1
  35. package/dist/client/assets/{List-klt4Ktng.js → List-CIQbhdro.js} +1 -1
  36. package/dist/client/assets/{Loading01-fS4L07xH.js → Loading01-Ccov_H-l.js} +1 -1
  37. package/dist/client/assets/{Lock01-BKSJ7A3p.js → Lock01-BjIJeI7d.js} +1 -1
  38. package/dist/client/assets/{Play-xVtvzzCw.js → Play-CipTDlMn.js} +1 -1
  39. package/dist/client/assets/{Plus-J6pIe2uV.js → Plus-DJThru9X.js} +1 -1
  40. package/dist/client/assets/{RefreshCcw01-CL_G5oMs.js → RefreshCcw01-Df3WKdLs.js} +1 -1
  41. package/dist/client/assets/{Rows03-cUxIL8D0.js → Rows03-Agi3cY0I.js} +1 -1
  42. package/dist/client/assets/{Save01-CdMTv6PL.js → Save01-CkhL7WEQ.js} +1 -1
  43. package/dist/client/assets/{SearchMd-CifRamFZ.js → SearchMd-ePwgMcp4.js} +1 -1
  44. package/dist/client/assets/{Settings01-B28HDbDZ.js → Settings01-MsrMRIJf.js} +1 -1
  45. package/dist/client/assets/{Shield01-BrHq9skT.js → Shield01-Cz2zDuKP.js} +1 -1
  46. package/dist/client/assets/{Terminal-BPUAzvCO.js → Terminal-CzMkefpC.js} +1 -1
  47. package/dist/client/assets/{Tool01-6ldn8KE7.js → Tool01-nfCGcgBE.js} +1 -1
  48. package/dist/client/assets/{Trash01-BGRjTxek.js → Trash01-B_x31FCQ.js} +1 -1
  49. package/dist/client/assets/{Upload01-Z7XprHF7.js → Upload01-BVrA_p4D.js} +1 -1
  50. package/dist/client/assets/{Users03-DkrzV9ZI.js → Users03-Ca4cP5ST.js} +1 -1
  51. package/dist/client/assets/{X-BY3es49B.js → X-ep0AhpnZ.js} +1 -1
  52. package/dist/client/assets/{XCircle-DZ1yCOQ6.js → XCircle-CcrJwxck.js} +1 -1
  53. package/dist/client/assets/{XClose-Cc-gaidr.js → XClose-mrXHjywb.js} +1 -1
  54. package/dist/client/assets/{agent-connections-preview-pDe7P7Ta.js → agent-connections-preview-GRtBimaN.js} +1 -1
  55. package/dist/client/assets/{agent-detail-2TyklQZz.js → agent-detail-fZVm9X6-.js} +1 -1
  56. package/dist/client/assets/{agents-DKPHVEr-.js → agents-C9M716Em.js} +1 -1
  57. package/dist/client/assets/{alert-dialog-Dcn63g6g.js → alert-dialog-zUkzI1I7.js} +1 -1
  58. package/dist/client/assets/{auth-catchall-Dho6OcVz.js → auth-catchall-fybxbD8B.js} +1 -1
  59. package/dist/client/assets/{avatar-PHdbjFDw.js → avatar-KzEgSlwf.js} +1 -1
  60. package/dist/client/assets/{badge-SF6wUW5L.js → badge-CrsiM596.js} +1 -1
  61. package/dist/client/assets/{binder-D_h2ibfT.js → binder-5QwQ3F8k.js} +1 -1
  62. package/dist/client/assets/{breadcrumb-C0g6Pt2_.js → breadcrumb-r6RP68pk.js} +1 -1
  63. package/dist/client/assets/{card-BdxqmIDs.js → card-BaUmkbam.js} +1 -1
  64. package/dist/client/assets/{chart-BUZSWI3B.js → chart-B4Ia32VW.js} +1 -1
  65. package/dist/client/assets/{checkbox-LKkMIiIW.js → checkbox-vQNHi_v9.js} +1 -1
  66. package/dist/client/assets/{circle-alert-tYCIieku.js → circle-alert-D6oWLxFc.js} +1 -1
  67. package/dist/client/assets/{collection-detail-ByuFgV2Y.js → collection-detail-CFInmxp-.js} +1 -1
  68. package/dist/client/assets/{collection-search-qyutGH6l.js → collection-search-BGdQ1HZ8.js} +1 -1
  69. package/dist/client/assets/{collection-tab-BbAfStP-.js → collection-tab-BHc2Ls-Q.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-C9APekgb.js → collection-table-wrapper-M66G0byU.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-h2vOc-_S.js → collection-tabs-DItGBx7f.js} +1 -1
  72. package/dist/client/assets/{command-FPE9wf0f.js → command-KORb7ru1.js} +1 -1
  73. package/dist/client/assets/{connect-CX8KQP6_.js → connect-CzYEo8md.js} +1 -1
  74. package/dist/client/assets/{connection-card-ZsVFtnK9.js → connection-card-DT2iuc8p.js} +1 -1
  75. package/dist/client/assets/{connection-detail-pqk6mgg9.js → connection-detail-BN6XxwJe.js} +1 -1
  76. package/dist/client/assets/{connections-BohwKULL.js → connections-ziNJ3ykn.js} +1 -1
  77. package/dist/client/assets/{constants-CYyFC-Sp.js → constants-C_615zcG.js} +1 -1
  78. package/dist/client/assets/constants-D6R-nCdz.js +1 -0
  79. package/dist/client/assets/{context-DCvH3r3j.js → context-BIs40mE3.js} +4 -4
  80. package/dist/client/assets/{create-organization-dialog-BCgnCEPh.js → create-organization-dialog-DBkFyVL_.js} +1 -1
  81. package/dist/client/assets/{create-project-dialog-CrEm4IvG.js → create-project-dialog-Bcpvnfjn.js} +1 -1
  82. package/dist/client/assets/{dialog-DjBLF9Xz.js → dialog-BzlH8DMm.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-dMkqHp7f.js → dropdown-menu-un00sO73.js} +1 -1
  84. package/dist/client/assets/{dynamic-plugin-layout-DnTEhExp.js → dynamic-plugin-layout-lJBDHqhW.js} +1 -1
  85. package/dist/client/assets/{editable-thread-title-CGN0Mgzr.js → editable-thread-title-BXoC2F2B.js} +1 -1
  86. package/dist/client/assets/{empty-state-B6tWKHPM.js → empty-state-CzmPKPTk.js} +1 -1
  87. package/dist/client/assets/{env-vars-editor-D0A2SEWh.js → env-vars-editor-BXh1cAnk.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Bc1UBsWZ.js → extract-connection-data-BfKkaRZL.js} +1 -1
  89. package/dist/client/assets/{file-browser-BAUqIo1x.js → file-browser-Cu1bln-O.js} +2 -2
  90. package/dist/client/assets/{form-DKDTPBJL.js → form-BZ0ccRRa.js} +1 -1
  91. package/dist/client/assets/{grid-view-DBeJ-u7v.js → grid-view-Cv27YWYR.js} +1 -1
  92. package/dist/client/assets/{home-o-8rSFPM.js → home-Dm_ASFW3.js} +1 -1
  93. package/dist/client/assets/{index-nz17Zavj.js → index-B09G3SMh.js} +1 -1
  94. package/dist/client/assets/{index-DCxyPrpA.js → index-BTQG2DxP.js} +1 -1
  95. package/dist/client/assets/index-BcDQ75Aq.css +1 -0
  96. package/dist/client/assets/{index-DXe5aLcB.js → index-CXMp_veu.js} +1 -1
  97. package/dist/client/assets/{index-BoZYckTW.js → index-CdCtpL83.js} +1 -1
  98. package/dist/client/assets/{index-CxnWkZZb.js → index-CkihBNKz.js} +1 -1
  99. package/dist/client/assets/{index-Cr71gOj3.js → index-CouTVB4u.js} +1 -1
  100. package/dist/client/assets/{index-DL3qqjep.js → index-CyQ-uP58.js} +3 -3
  101. package/dist/client/assets/{index-Bf_CY3qu.js → index-D6zrhjd3.js} +1 -1
  102. package/dist/client/assets/{index-EAWMJGj2.js → index-SPlTfTNO.js} +59 -59
  103. package/dist/client/assets/{infiniteQueryObserver-QkJ406yX.js → infiniteQueryObserver-BvfDXev6.js} +1 -1
  104. package/dist/client/assets/{input-pcdA_rWs.js → input-Xyw1Rs5H.js} +1 -1
  105. package/dist/client/assets/{integration-icon-CDKf5lkP.js → integration-icon-BmabWqd3.js} +1 -1
  106. package/dist/client/assets/{label-Cs0rMyA0.js → label-B9X06NrD.js} +1 -1
  107. package/dist/client/assets/{layout-BM96F8A6.js → layout-2YnSaip-.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-DuRbtKex.js → localstorage-keys-DNCBj8Gv.js} +1 -1
  109. package/dist/client/assets/{login-UlwWZHgc.js → login-BcqaQ8OJ.js} +1 -1
  110. package/dist/client/assets/{markdown-CN9uWcE5.js → markdown-DE0d269S.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-1reN8tHJ.js → mcp-oauth-dc0YrLAp.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-BvqzVqbR.js → mcp-server-card-BgAf5sxh.js} +1 -1
  113. package/dist/client/assets/{mcp-server-detail-44WaE8j1.js → mcp-server-detail-a4HlkEwh.js} +2 -2
  114. package/dist/client/assets/{members-Dlu0JdHg.js → members-vlAhS-xk.js} +1 -1
  115. package/dist/client/assets/{monitoring-BkGKM_nf.js → monitoring-B8ViJcuj.js} +1 -1
  116. package/dist/client/assets/{monitoring-dashboard-edit-Bh6jLPJ-.js → monitoring-dashboard-edit-9lG0jGgS.js} +1 -1
  117. package/dist/client/assets/{monitoring-dashboard-view-BR_gx-ah.js → monitoring-dashboard-view-AyjrHVH9.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-My1FCnBz.js → oauth-callback-DEcWaD8W.js} +1 -1
  119. package/dist/client/assets/{page-CTS2P4X2.js → page-Dst-G5FY.js} +1 -1
  120. package/dist/client/assets/{page-CrdufU7i.js → page-L5wi1xJD.js} +1 -1
  121. package/dist/client/assets/{plugin-empty-state-BL9scDTN.js → plugin-empty-state-4dVaQq4C.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-CM6Dryag.js → plugin-empty-state-FWA0Jb1Z.js} +1 -1
  123. package/dist/client/assets/{plugin-header-C1mnXf_l.js → plugin-header-DerB5s8s.js} +1 -1
  124. package/dist/client/assets/{plugin-header-UsujlRy8.js → plugin-header-gerJlK-i.js} +1 -1
  125. package/dist/client/assets/{popover-DVJVvDk4.js → popover-2STAmX7J.js} +1 -1
  126. package/dist/client/assets/{project-layout-ChFI6quF.js → project-layout-Bq2NwHqQ.js} +1 -1
  127. package/dist/client/assets/{projects-list-tpjdpWOF.js → projects-list-Bfrhv7v-.js} +1 -1
  128. package/dist/client/assets/{ranking-layout-CrYiPhgR.js → ranking-layout-Bz2FMj3O.js} +1 -1
  129. package/dist/client/assets/{readme-viewer-B2f4puJD.js → readme-viewer-D0xX-U32.js} +1 -1
  130. package/dist/client/assets/{registry-layout-C0R7NUsH.js → registry-layout-BJov_nag.js} +1 -1
  131. package/dist/client/assets/{registry-utils-D-aIeu5g.js → registry-utils-Dr7PbEVZ.js} +1 -1
  132. package/dist/client/assets/{reports-layout-DXj87viG.js → reports-layout-VEiewUO1.js} +1 -1
  133. package/dist/client/assets/{reset-password-BlWYJ3vA.js → reset-password-Cv1xeKO6.js} +1 -1
  134. package/dist/client/assets/{resizable-BejyKOGo.js → resizable-Cf9qjEcV.js} +1 -1
  135. package/dist/client/assets/{save-actions-DT09KS_7.js → save-actions-8q-tMpO7.js} +1 -1
  136. package/dist/client/assets/{scroll-area-pgllOsbM.js → scroll-area-DSF7aa78.js} +1 -1
  137. package/dist/client/assets/{select-Dz5z65Jw.js → select-BWSXn9LF.js} +1 -1
  138. package/dist/client/assets/{shell-layout-BeWeSxb6.js → shell-layout-C4umZGSP.js} +2 -2
  139. package/dist/client/assets/{skeleton-tlo_AcXS.js → skeleton-CGDNbJij.js} +1 -1
  140. package/dist/client/assets/{spinner-DL1kXbn_.js → spinner-DdFkIebA.js} +1 -1
  141. package/dist/client/assets/{store-invite-KhqhYrJe.js → store-invite-BpVpumwK.js} +1 -1
  142. package/dist/client/assets/{switch-D5s4GvE7.js → switch-DCjQmRaz.js} +1 -1
  143. package/dist/client/assets/{table-JlnXtC1o.js → table-KBcJzih3.js} +1 -1
  144. package/dist/client/assets/{tabs-BMRmFudX.js → tabs-A5nHR5hM.js} +1 -1
  145. package/dist/client/assets/{tasks-BdJ0UZyL.js → tasks-C_zqDZzb.js} +1 -1
  146. package/dist/client/assets/{textarea-_RA9G-2H.js → textarea-BflLsOYJ.js} +1 -1
  147. package/dist/client/assets/{time-range-picker-Z6Jl1sx4.js → time-range-picker-C7BBQ3V_.js} +1 -1
  148. package/dist/client/assets/{toggle-group-X_GdAmsv.js → toggle-group-CVheqlM7.js} +1 -1
  149. package/dist/client/assets/{tools-list-RgSwLK9F.js → tools-list-DEuI3Via.js} +1 -1
  150. package/dist/client/assets/{tooltip--eNCFRSk.js → tooltip-CNx0bR-5.js} +1 -1
  151. package/dist/client/assets/{topbar-portal-D3cWepwE.js → topbar-portal-BPt1GU-U.js} +1 -1
  152. package/dist/client/assets/{types-Dz8v8wA9.js → types-BOWXxXIK.js} +1 -1
  153. package/dist/client/assets/{use-binding-DWmbEHQx.js → use-binding-rYSemil4.js} +1 -1
  154. package/dist/client/assets/{use-connection-CKm1ISVV.js → use-connection-B5TQguFn.js} +1 -1
  155. package/dist/client/assets/{use-copy-DvH_rwny.js → use-copy-DFl3Lkrw.js} +1 -1
  156. package/dist/client/assets/{use-create-virtual-mcp-Cl3FIypU.js → use-create-virtual-mcp-ClS20pFb.js} +1 -1
  157. package/dist/client/assets/{use-deco-chat-open-BifT_Q7T.js → use-deco-chat-open-DUl097r7.js} +1 -1
  158. package/dist/client/assets/{use-install-from-registry-DxwNEXQz.js → use-install-from-registry-BBtc_IYr.js} +1 -1
  159. package/dist/client/assets/{use-list-state-5G9UAtpG.js → use-list-state-CSmezZQi.js} +1 -1
  160. package/dist/client/assets/{use-llm-CZ5h-I5e.js → use-llm-_rAHFXdn.js} +1 -1
  161. package/dist/client/assets/{use-mcp-prompts-C-kJi0NP.js → use-mcp-prompts-CgOsBYjP.js} +1 -1
  162. package/dist/client/assets/{use-mcp-tools-Du7LOEev.js → use-mcp-tools-Cr3o97c-.js} +1 -1
  163. package/dist/client/assets/{use-members-JNLhgbe4.js → use-members-BO46Bzs-.js} +1 -1
  164. package/dist/client/assets/{use-mobile-BVeJwtRE.js → use-mobile-CcJ4cdUT.js} +1 -1
  165. package/dist/client/assets/{use-project-BznKdNgg.js → use-project-ab2lCPHD.js} +1 -1
  166. package/dist/client/assets/{use-settings-modal-DikSOkid.js → use-settings-modal-DnkPiNI5.js} +1 -1
  167. package/dist/client/assets/{use-view-mode-BUENrs7s.js → use-view-mode-nDNhs-vV.js} +1 -1
  168. package/dist/client/assets/{use-virtual-mcp-DQ9c7C3W.js → use-virtual-mcp-DZfG-iWT.js} +1 -1
  169. package/dist/client/assets/useInfiniteQuery-fhnMOikS.js +1 -0
  170. package/dist/client/assets/{useMutation-UrnS9vWD.js → useMutation-DMT5NBQ4.js} +1 -1
  171. package/dist/client/assets/useQuery-DLHdWLmJ.js +1 -0
  172. package/dist/client/assets/useSuspenseInfiniteQuery-TsQmjpXC.js +1 -0
  173. package/dist/client/assets/{workflow-Bed30GUE.js → workflow-BjckQ0gZ.js} +1 -1
  174. package/dist/client/index.html +2 -2
  175. package/package.json +1 -1
  176. package/dist/client/assets/constants-DllrcpiP.js +0 -1
  177. package/dist/client/assets/index-CJXotA7N.css +0 -1
  178. package/dist/client/assets/useInfiniteQuery-XciTiRf0.js +0 -1
  179. package/dist/client/assets/useQuery-J1yQO0sX.js +0 -1
  180. package/dist/client/assets/useSuspenseInfiniteQuery-BcyK5gD4.js +0 -1
@@ -1 +1 @@
1
- import{b8 as U,c as O,u as H,v as G,j as s,aJ as J,r as I,b as M,B as R,O as V}from"./index-DL3qqjep.js";import{u as q}from"./use-project-BznKdNgg.js";import{P as D}from"./index-DCxyPrpA.js";import{E as T,C as F}from"./collection-search-qyutGH6l.js";import{A as K}from"./avatar-PHdbjFDw.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-CrEm4IvG.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-C0g6Pt2_.js";import"./useQuery-J1yQO0sX.js";import"./constants-CYyFC-Sp.js";import"./use-mobile-BVeJwtRE.js";import"./X-BY3es49B.js";import"./tooltip--eNCFRSk.js";import"./index-Bf_CY3qu.js";import"./Loading01-fS4L07xH.js";import"./SearchMd-CifRamFZ.js";import"./input-pcdA_rWs.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./useMutation-UrnS9vWD.js";import"./dialog-DjBLF9Xz.js";import"./form-DKDTPBJL.js";import"./label-Cs0rMyA0.js";import"./textarea-_RA9G-2H.js";import"./Check-B_1XgGXq.js";import"./ChevronRight-Dv5Kd3sh.js";const te=U("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=G("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors","opacity-0 group-hover:opacity-100"),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(J,{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}=q(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=M();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/settings",params:{org:e.slug,project: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(F,{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!==V}export{Ae as default};
1
+ import{b8 as U,c as O,u as H,v as G,j as s,aJ as J,r as I,b as M,B as R,O as V}from"./index-CyQ-uP58.js";import{u as q}from"./use-project-ab2lCPHD.js";import{P as D}from"./index-BTQG2DxP.js";import{E as T,C as F}from"./collection-search-BGdQ1HZ8.js";import{A as K}from"./avatar-KzEgSlwf.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-Bcpvnfjn.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-r6RP68pk.js";import"./useQuery-DLHdWLmJ.js";import"./constants-C_615zcG.js";import"./use-mobile-CcJ4cdUT.js";import"./X-ep0AhpnZ.js";import"./tooltip-CNx0bR-5.js";import"./index-D6zrhjd3.js";import"./Loading01-Ccov_H-l.js";import"./SearchMd-ePwgMcp4.js";import"./input-Xyw1Rs5H.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./useMutation-DMT5NBQ4.js";import"./dialog-BzlH8DMm.js";import"./form-BZ0ccRRa.js";import"./label-B9X06NrD.js";import"./textarea-BflLsOYJ.js";import"./Check-CFpzkHgf.js";import"./ChevronRight-DmlQyyes.js";const te=U("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=G("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors","opacity-0 group-hover:opacity-100"),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(J,{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}=q(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=M();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/settings",params:{org:e.slug,project: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(F,{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!==V}export{Ae as default};
@@ -1 +1 @@
1
- import{r as L,j as s,B as A,c3 as ke,c as _,v as F,t as Re,u as qe,a as Ue,b as We,m as Xe,c4 as He,c5 as Ke}from"./index-DL3qqjep.js";import{c as Le}from"./binder-D_h2ibfT.js";import{u as xe}from"./useQuery-J1yQO0sX.js";import{h as Ge}from"./use-connection-CKm1ISVV.js";import{a as Qe,u as Ze,j as Te}from"./constants-CYyFC-Sp.js";import{u as Ie,P as Je}from"./topbar-portal-D3cWepwE.js";import{i as Z}from"./Loading01-fS4L07xH.js";import{t as Ye}from"./Settings01-B28HDbDZ.js";import{D as et,a as tt,b as st,c as nt,d as lt,e as it}from"./dialog-DjBLF9Xz.js";import{D as ot,a as rt,b as at,c as ct}from"./dropdown-menu-dMkqHp7f.js";import{I as ue}from"./input-pcdA_rWs.js";import{S as De}from"./switch-D5s4GvE7.js";import{i as dt}from"./DotsVertical-Dv4tBZU-.js";import{s as mt}from"./Plus-J6pIe2uV.js";import{i as ut}from"./SearchMd-CifRamFZ.js";import{i as Se}from"./AlertCircle-DQQcPtgD.js";import{i as we}from"./ArrowLeft-D7lFQljS.js";import{s as xt}from"./Clock-B4Ctq7dH.js";import{b as $e,c as z,a as ft,T as P,e as pt,d as gt}from"./table-JlnXtC1o.js";import{M as ht}from"./markdown-CN9uWcE5.js";import{n as jt}from"./ArrowDown-Cf0RNEZQ.js";import{i as bt}from"./ArrowUp-CKXiX_Ao.js";import{i as Nt}from"./CheckVerified02-C72zve8A.js";import{i as ze}from"./File02-D8nm9j-J.js";import{s as yt}from"./Hash02-B1Ogol6o.js";import{s as Pe,i as vt}from"./Rows03-cUxIL8D0.js";import{u as Ct}from"./useMutation-UrnS9vWD.js";import{i as wt}from"./CheckCircle-teFEREuu.js";import{i as kt}from"./InfoCircle-CGMOojOv.js";import{i as It}from"./XCircle-DZ1yCOQ6.js";import{t as St}from"./ChevronDown-BCXsTPO0.js";import"./X-BY3es49B.js";import"./Check-B_1XgGXq.js";import"./ChevronRight-Dv5Kd3sh.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,c3 as ke,c as _,v as F,t as Re,u as qe,a as Ue,b as We,m as Xe,c4 as He,c5 as Ke}from"./index-CyQ-uP58.js";import{c as Le}from"./binder-5QwQ3F8k.js";import{u as xe}from"./useQuery-DLHdWLmJ.js";import{h as Ge}from"./use-connection-B5TQguFn.js";import{a as Qe,u as Ze,j as Te}from"./constants-C_615zcG.js";import{u as Ie,P as Je}from"./topbar-portal-BPt1GU-U.js";import{i as Z}from"./Loading01-Ccov_H-l.js";import{t as Ye}from"./Settings01-MsrMRIJf.js";import{D as et,a as tt,b as st,c as nt,d as lt,e as it}from"./dialog-BzlH8DMm.js";import{D as ot,a as rt,b as at,c as ct}from"./dropdown-menu-un00sO73.js";import{I as ue}from"./input-Xyw1Rs5H.js";import{S as De}from"./switch-DCjQmRaz.js";import{i as dt}from"./DotsVertical-D74uB5qh.js";import{s as mt}from"./Plus-DJThru9X.js";import{i as ut}from"./SearchMd-ePwgMcp4.js";import{i as Se}from"./AlertCircle-DFllIHYc.js";import{i as we}from"./ArrowLeft-DUx23LCt.js";import{s as xt}from"./Clock-BYhPEf3s.js";import{b as $e,c as z,a as ft,T as P,e as pt,d as gt}from"./table-KBcJzih3.js";import{M as ht}from"./markdown-DE0d269S.js";import{n as jt}from"./ArrowDown-BCqJRKTw.js";import{i as bt}from"./ArrowUp-CKW1WeCp.js";import{i as Nt}from"./CheckVerified02-Cl4WUPt6.js";import{i as ze}from"./File02-DUrYDugN.js";import{s as yt}from"./Hash02-D1T_na-O.js";import{s as Pe,i as vt}from"./Rows03-Agi3cY0I.js";import{u as Ct}from"./useMutation-DMT5NBQ4.js";import{i as wt}from"./CheckCircle-DAEjX2-S.js";import{i as kt}from"./InfoCircle-CNFZi0eo.js";import{i as It}from"./XCircle-CcrJwxck.js";import{t as St}from"./ChevronDown-CZDY410N.js";import"./X-ep0AhpnZ.js";import"./Check-CFpzkHgf.js";import"./ChevronRight-DmlQyyes.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-DL3qqjep.js";import{u as R}from"./useQuery-J1yQO0sX.js";import{i as j}from"./File06-D-_j0iW5.js";import{i as v}from"./Loading01-fS4L07xH.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-CyQ-uP58.js";import{u as R}from"./useQuery-DLHdWLmJ.js";import{i as j}from"./File06-CGEI1byM.js";import{i as v}from"./Loading01-Ccov_H-l.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,4 +1,4 @@
1
- import{r as S,c as X,u as he,m as Qe,b_ as tt,j as s,B as F,v as ne,t as Z,cg as dn}from"./index-DL3qqjep.js";import{i as ft}from"./CheckCircle-teFEREuu.js";import{n as mn}from"./Container-JCSa3G3B.js";import{t as un}from"./Settings01-B28HDbDZ.js";import{u as Ze}from"./useQuery-J1yQO0sX.js";import{u as $e}from"./useMutation-UrnS9vWD.js";import{a as ve,u as be,j as js}from"./constants-CYyFC-Sp.js";import{u as bs}from"./useInfiniteQuery-XciTiRf0.js";import{B as G}from"./badge-SF6wUW5L.js";import{I as je}from"./input-pcdA_rWs.js";import{a as Dt,c as Je,D as $t,b as Lt,h as ls,i as as,g as xn}from"./dropdown-menu-dMkqHp7f.js";import{e as vs,a as ys,b as At,T as Oe,d as Ns,c as Ue}from"./table-JlnXtC1o.js";import{a as os,T as hn}from"./toggle-group-X_GdAmsv.js";import{u as pn}from"./use-view-mode-BUENrs7s.js";import{i as Xt}from"./DotsVertical-Dv4tBZU-.js";import{i as fn}from"./FilterLines-BP-6W-PZ.js";import{i as ws}from"./Globe01-BUQmYqse.js";import{i as ut}from"./Loading01-fS4L07xH.js";import{i as Cs}from"./SearchMd-CifRamFZ.js";import{b as zt,c as Ot,d as Ut,e as qt,a as Ft,D as Bt}from"./dialog-DjBLF9Xz.js";import{i as vt}from"./AlertCircle-DQQcPtgD.js";import{n as gn}from"./Download01-DIwP2P7D.js";import{i as cs}from"./Upload01-Z7XprHF7.js";import{c as yt,b as Nt,d as wt,A as Ct,g as _t,e as kt,a as St,f as Rt}from"./alert-dialog-Dcn63g6g.js";import{C as me}from"./card-BdxqmIDs.js";import{s as It}from"./Trash01-BGRjTxek.js";import{L as le}from"./label-Cs0rMyA0.js";import{n as jn,S as _s,a as ks,b as Ss,c as Rs,d as Et}from"./select-Dz5z65Jw.js";import{S as bt}from"./switch-D5s4GvE7.js";import{T as Gt}from"./textarea-_RA9G-2H.js";import{i as bn}from"./ArrowLeft-D7lFQljS.js";import{i as vn,u as Ht,t as yn}from"./use-copy-DvH_rwny.js";import{s as es}from"./RefreshCcw01-CL_G5oMs.js";import{i as Nn}from"./X-BY3es49B.js";import{t as Ts}from"./ChevronDown-BCXsTPO0.js";import{C as wn}from"./checkbox-LKkMIiIW.js";import{s as Is}from"./Eye-BZHp_wD7.js";import{n as Cn}from"./LinkExternal01-D9XuFg7K.js";import{i as _n}from"./XCircle-DZ1yCOQ6.js";import{h as Ms,e as Ps}from"./use-connection-CKm1ISVV.js";import{b as kn,P as Sn,a as Rn}from"./popover-DVJVvDk4.js";import{i as Wt}from"./Check-B_1XgGXq.js";import{a as Jt}from"./Copy01-B1lCFyqr.js";import{i as Tn,a as In}from"./Save01-CdMTv6PL.js";import{i as Mn}from"./Key01-xmVowZ8K.js";import{s as Pn}from"./Plus-J6pIe2uV.js";import{a as En,b as Dn,T as $n}from"./tooltip--eNCFRSk.js";import{a as Ln,i as An}from"./mcp-oauth-1reN8tHJ.js";import{i as zn}from"./Play-xVtvzzCw.js";import"./infiniteQueryObserver-QkJ406yX.js";import"./ChevronRight-Dv5Kd3sh.js";import"./use-mobile-BVeJwtRE.js";import"./index-Bf_CY3qu.js";const Es=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243"}));Es.displayName="EyeOff";const Ds=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M12.5 3H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H17c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122C21 18.395 21 17.93 21 17m-2-9V2m-3 3h6M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4.49 3.418-8.459 7.69c-.476.433-.714.649-.735.836a.5.5 0 0 0 .167.431C6.105 21 6.426 21 7.07 21h9.387c1.44 0 2.159 0 2.724-.242a3 3 0 0 0 1.578-1.578c.242-.565.242-1.285.242-2.724 0-.484 0-.726-.053-.952a2.001 2.001 0 0 0-.374-.778c-.143-.182-.332-.333-.71-.636l-2.797-2.237c-.379-.303-.568-.454-.776-.508a1 1 0 0 0-.557.018c-.205.066-.384.23-.743.555Z"}));Ds.displayName="ImagePlus";const $s=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));$s.displayName="Link01";const Ls=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}),S.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));Ls.displayName="StopSquare";const ts=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"m6 6 4.5 4.5M6 6H3L2 3l1-1 3 1v3Zm13.259-3.259-2.628 2.628c-.396.396-.594.594-.668.822a1 1 0 0 0 0 .618c.074.228.272.426.668.822l.238.238c.396.396.594.594.822.668a1 1 0 0 0 .618 0c.228-.074.426-.272.822-.668L21.59 5.41a5.5 5.5 0 0 1-6.16 7.485c-.485-.096-.729-.144-.876-.13a.836.836 0 0 0-.373.114c-.13.07-.261.201-.523.463L6.5 20.5a2.121 2.121 0 0 1-3-3l7.157-7.157c.262-.262.393-.393.463-.524a.836.836 0 0 0 .113-.372c.015-.148-.033-.39-.129-.877a5.5 5.5 0 0 1 8.155-5.83ZM12 15l5.5 5.5a2.121 2.121 0 0 0 3-3l-4.525-4.525a5.475 5.475 0 0 1-.934-.17c-.39-.107-.816-.03-1.101.255L12 15Z"}));ts.displayName="Tool02";const H={all:["private-registry"],items:()=>[...H.all,"items"],itemsList:(t,e,n,r)=>[...H.items(),"list",{search:t,tags:e,categories:n,limit:r}],item:t=>[...H.items(),"item",t],filters:()=>[...H.all,"filters"],registryConfig:()=>[...H.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...H.registryConfig(),t,e],publishRequests:()=>[...H.all,"publish-requests"],publishRequestsByOrg:t=>[...H.publishRequests(),"org",t],publishRequestsList:(t,e,n)=>[...H.publishRequests(),"list",{status:t??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(t,e,n,r)=>[...H.publishRequestsByOrg(t),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...H.publishRequests(),"count"],publishRequestsCountByOrg:t=>[...H.publishRequestsByOrg(t),"count"],publishApiKeys:()=>[...H.all,"publish-api-keys"],monitor:()=>[...H.all,"monitor"],monitorRuns:()=>[...H.monitor(),"runs"],monitorRunsList:t=>[...H.monitorRuns(),"list",{status:t??"all"}],monitorRun:t=>[...H.monitorRuns(),"run",t??"none"],monitorResults:()=>[...H.monitor(),"results"],monitorResultsList:(t,e)=>[...H.monitorResults(),"list",{runId:t??"none",status:e??"all"}],monitorConnections:()=>[...H.monitor(),"connections"],monitorConnectionAuthProbe:t=>[...H.monitorConnections(),"auth-probe",t]};async function qe(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function On(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_START",{config:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorResults()})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Un(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async(c,m)=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorRun(m)})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qt(t){const e=X.c(10),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRunsList(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_LIST",{status:t,limit:100}),e[4]=o,e[5]=t,e[6]=a):a=e[6];let i;return e[7]!==l||e[8]!==a?(i={queryKey:l,queryFn:a,staleTime:5e3},e[7]=l,e[8]=a,e[9]=i):i=e[9],Ze(i)}function ss(t){const e=X.c(11),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRun(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_GET",{runId:t}),e[4]=o,e[5]=t,e[6]=a):a=e[6];const i=!!t;let c;return e[7]!==l||e[8]!==a||e[9]!==i?(c={queryKey:l,queryFn:a,enabled:i,refetchInterval:qn},e[7]=l,e[8]=a,e[9]=i,e[10]=c):c=e[10],Ze(c)}function qn(t){return t.state.data?.run?.status==="running"?5e3:!1}function Mt(t,e,n){const r=X.c(14),{org:o}=he();let l;r[0]!==o.id?(l={connectionId:ve,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=be(l);let i;r[2]!==t||r[3]!==e?(i=H.monitorResultsList(t,e),r[2]=t,r[3]=e,r[4]=i):i=r[4];let c;r[5]!==a||r[6]!==t||r[7]!==e?(c=async()=>qe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:t,status:e,limit:200,offset:0}),r[5]=a,r[6]=t,r[7]=e,r[8]=c):c=r[8];const m=!!t,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==c||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:c,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=c,r[11]=m,r[12]=u,r[13]=x):x=r[13],Ze(x)}function As(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.monitorConnections(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>qe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function Fn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async()=>qe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Bn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>{const{connectionId:m,authStatus:u}=c;return qe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}const ds={monitorMode:"health_check",onFailure:"none",schedule:"manual",cronExpression:"",scheduleEventId:"",perMcpTimeoutMs:3e4,perToolTimeoutMs:1e4,maxAgentSteps:15,testPublicOnly:!1,testPrivateOnly:!1,includePendingRequests:!1,agentContext:"",llmConnectionId:"",llmModelId:""};function zs(){const t=X.c(33),{org:e,project:n}=he();let r;t[0]!==e.id?(r={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const o=be(r),l=Qe();let a;t[2]!==n.id?(a=H.registryConfigByPlugin(n.id??"",tt),t[2]=n.id,t[3]=a):a=t[3];let i;t[4]!==o||t[5]!==n.id?(i=async()=>qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}),t[4]=o,t[5]=n.id,t[6]=i):i=t[6];const c=!!n.id;let m;t[7]!==a||t[8]!==i||t[9]!==c?(m={queryKey:a,queryFn:i,enabled:c},t[7]=a,t[8]=i,t[9]=c,t[10]=m):m=t[10];const u=Ze(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,d=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let b;t[11]!==p?(b=p??{},t[11]=p,t[12]=b):b=t[12];let j;t[13]!==d||t[14]!==x||t[15]!==p?(j=d&&!p?x:{},t[13]=d,t[14]=x,t[15]=p,t[16]=j):j=t[16];let _;t[17]!==b||t[18]!==j?(_={...ds,...b,...j},t[17]=b,t[18]=j,t[19]=_):_=t[19];const k=_;let y;t[20]!==o||t[21]!==n.id?(y=async R=>{const N=(await qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}))?.config?.settings??{};return qe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:tt,settings:{...N,testConfig:{...ds,...N.testConfig??{},...R}}})},t[20]=o,t[21]=n.id,t[22]=y):y=t[22];let g;t[23]!==n.id||t[24]!==l?(g=async()=>{await l.invalidateQueries({queryKey:H.registryConfigByPlugin(n.id??"",tt)})},t[23]=n.id,t[24]=l,t[25]=g):g=t[25];let I;t[26]!==y||t[27]!==g?(I={mutationFn:y,onSuccess:g},t[26]=y,t[27]=g,t[28]=I):I=t[28];const f=$e(I);let w;return t[29]!==u.isLoading||t[30]!==f||t[31]!==k?(w={settings:k,isLoading:u.isLoading,saveMutation:f},t[29]=u.isLoading,t[30]=f,t[31]=k,t[32]=w):w=t[32],w}function Gn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_SET",c),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Kn(){const t=X.c(3),e=Qt("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Mt(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return t[0]!==l||t[1]!==a?(i={brokenCount:l,isLoading:a},t[0]=l,t[1]=a,t[2]=i):i=t[2],i}const Os=24;function Vn(t){return t.trim()}async function Le(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function Us(t){const e=X.c(19),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l,a,i,c;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(a=Vn(t.search),l=t.limit??Os,c=bs,i=H.itemsList(a,t.tags,t.categories,l),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=c):(l=e[6],a=e[7],i=e[8],c=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==t.categories||e[13]!==t.tags||e[14]!==a?(m=async x=>{const{pageParam:p}=x,h=a.length>0?{operator:"or",conditions:[{field:["title"],operator:"contains",value:a},{field:["description"],operator:"contains",value:a},{field:["id"],operator:"contains",value:a},{field:["server","name"],operator:"contains",value:a}]}:void 0;return Le(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=t.categories,e[13]=t.tags,e[14]=a,e[15]=m):m=e[15];let u;return e[16]!==i||e[17]!==m?(u={queryKey:i,queryFn:m,initialPageParam:void 0,getNextPageParam:Yn,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],c(u)}function Yn(t){return t.nextCursor}function Hn(){const t=X.c(8),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.filters(),t[2]=o):o=t[2];let l;t[3]!==r?(l=async()=>Le(r,"REGISTRY_ITEM_FILTERS",{}),t[3]=r,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},t[5]=a):a=t[5];let i;return t[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},t[6]=l,t[7]=i):i=t[7],Ze(i)}function ns(){const t=X.c(29),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.items()}),e.invalidateQueries({queryKey:H.filters()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async g=>(await Le(o,"REGISTRY_ITEM_CREATE",{data:g})).item,t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async g=>{const{id:I,data:f}=g;return(await Le(o,"REGISTRY_ITEM_UPDATE",{id:I,data:f})).item},t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;t[14]!==o?(h=async g=>(await Le(o,"REGISTRY_ITEM_DELETE",{id:g})).item,t[14]=o,t[15]=h):h=t[15];let d;t[16]!==a||t[17]!==h?(d={mutationFn:h,onSuccess:a},t[16]=a,t[17]=h,t[18]=d):d=t[18];const b=$e(d);let j;t[19]!==o?(j=async g=>Le(o,"REGISTRY_ITEM_BULK_CREATE",{items:g}),t[19]=o,t[20]=j):j=t[20];let _;t[21]!==a||t[22]!==j?(_={mutationFn:j,onSuccess:a},t[21]=a,t[22]=j,t[23]=_):_=t[23];const k=$e(_);let y;return t[24]!==k||t[25]!==m||t[26]!==b||t[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:b,bulkCreateMutation:k},t[24]=k,t[25]=m,t[26]=b,t[27]=p,t[28]=y):y=t[28],y}function Kt(t){const e=X.c(37),{org:n,project:r}=he();let o;e[0]!==n.id?(o={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=be(o),a=Qe();let i;e[2]!==t||e[3]!==r.id?(i=H.registryConfigByPlugin(r.id??"",t),e[2]=t,e[3]=r.id,e[4]=i):i=e[4];let c;e[5]!==l||e[6]!==t||e[7]!==r.id?(c=async()=>Le(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}),e[5]=l,e[6]=t,e[7]=r.id,e[8]=c):c=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==c||e[11]!==m?(u={queryKey:i,queryFn:c,enabled:m,staleTime:6e4},e[9]=i,e[10]=c,e[11]=m,e[12]=u):u=e[12];const x=Ze(u);let p;e[13]!==l||e[14]!==t||e[15]!==r.id?(p=async $=>{const M=(await Le(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}))?.config?.settings??{};return Le(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:t,settings:{...M,...$}})},e[13]=l,e[14]=t,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==t||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:H.registryConfigByPlugin(r.id??"",t)})},e[17]=t,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let d;e[21]!==p||e[22]!==h?(d={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=d):d=e[23];const b=$e(d),j=x.data?.config?.settings?.registryName??"Private Registry",_=x.data?.config?.settings?.registryIcon??"",k=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",g=x.data?.config?.settings?.acceptPublishRequests??!1,I=x.data?.config?.settings?.requireApiToken??!1,f=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,P=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",N=x.data?.config?.settings?.rateLimitMax,T=typeof N=="number"&&N>=1?Math.floor(N):100;let v;return e[24]!==g||e[25]!==x.isLoading||e[26]!==w||e[27]!==T||e[28]!==P||e[29]!==_||e[30]!==k||e[31]!==y||e[32]!==j||e[33]!==I||e[34]!==b||e[35]!==f?(v={registryName:j,registryIcon:_,registryLLMConnectionId:k,registryLLMModelId:y,acceptPublishRequests:g,requireApiToken:I,storePrivateOnly:f,rateLimitEnabled:w,rateLimitWindow:P,rateLimitMax:T,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:b},e[24]=g,e[25]=x.isLoading,e[26]=w,e[27]=T,e[28]=P,e[29]=_,e[30]=k,e[31]=y,e[32]=j,e[33]=I,e[34]=b,e[35]=f,e[36]=v):v=e[36],v}function Wn(t){const e=X.c(15),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==n.id||e[3]!==t.sortBy||e[4]!==t.sortDirection||e[5]!==t.status?(l=H.publishRequestsListByOrg(n.id,t.status,t.sortBy,t.sortDirection),e[2]=n.id,e[3]=t.sortBy,e[4]=t.sortDirection,e[5]=t.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==t.sortBy||e[9]!==t.sortDirection||e[10]!==t.status?(a=async c=>{const{pageParam:m}=c;return Le(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t.status,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:Os,offset:m})},e[7]=o,e[8]=t.sortBy,e[9]=t.sortDirection,e[10]=t.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:Jn,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],bs(i)}function Jn(t,e){const n=e.reduce(Zn,0);return n<t.totalCount?n:void 0}function Zn(t,e){return t+e.items.length}function Xn(){const t=X.c(9),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]!==e.id?(o=H.publishRequestsCountByOrg(e.id),t[2]=e.id,t[3]=o):o=t[3];let l;t[4]!==r?(l=async()=>Le(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),t[4]=r,t[5]=l):l=t[5];let a;return t[6]!==o||t[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},t[6]=o,t[7]=l,t[8]=a):a=t[8],Ze(a)}function er(){const t=X.c(17),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.publishRequests()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async d=>Le(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",d),t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async d=>Le(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:d}),t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;return t[14]!==p||t[15]!==m?(h={reviewMutation:m,deleteMutation:p},t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function tr(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.publishApiKeys(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>Le(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function sr(){const t=X.c(19),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async d=>Le(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:d}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[4]=e,t[5]=a):a=t[5];let i;t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8];const c=$e(i);let m;t[9]!==o?(m=async d=>Le(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:d}),t[9]=o,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let x;t[13]!==m||t[14]!==u?(x={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=x):x=t[15];const p=$e(x);let h;return t[16]!==c||t[17]!==p?(h={generateMutation:c,revokeMutation:p},t[16]=c,t[17]=p,t[18]=h):h=t[18],h}function ms(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function us(t){const e=[];let n="",r=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(l==='"'){r&&a==='"'?(n+='"',o+=1):r=!r;continue}if(l===","&&!r){e.push(n.trim()),n="";continue}n+=l}return e.push(n.trim()),e}const nr=["id","title"],rr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ir(t){const e=t.split(/\r?\n/).map(m=>m.trim()).filter(Boolean);if(e.length<2)return{items:[],warnings:[{line:0,message:"CSV must have a header row and at least one data row"}],skipped:0};const n=us(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of nr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!rr.includes(u)&&o.push({line:1,message:`Unknown column "${m}" will be ignored`})}if(!r.has("id")||!r.has("title"))return{items:[],warnings:o,skipped:0};const l=(m,u)=>{const x=r.get(u);return typeof x=="number"?m[x]??"":""},a=[],i=new Set;let c=0;for(let m=1;m<e.length;m+=1){const u=us(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),c+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),c+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),c+=1;continue}i.add(x);const h=l(u,"description").trim(),d=l(u,"remote_url").trim(),j=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",_=ms(l(u,"tags")),k=ms(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),g=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:g,_meta:{"mcp.mesh":{..._.length>0?{tags:_}:{},...k.length>0?{categories:k}:{}}},server:{name:x,title:p,description:h||void 0,remotes:d?[{type:j,url:d}]:[]}})}return{items:a,warnings:o,skipped:c}}const lr=`id,title,description,remote_url,remote_type,tags,categories,is_public
1
+ import{r as S,c as X,u as he,m as Qe,b_ as tt,j as s,B as F,v as ne,t as Z,cg as dn}from"./index-CyQ-uP58.js";import{i as ft}from"./CheckCircle-DAEjX2-S.js";import{n as mn}from"./Container-CwxPOY0d.js";import{t as un}from"./Settings01-MsrMRIJf.js";import{u as Ze}from"./useQuery-DLHdWLmJ.js";import{u as $e}from"./useMutation-DMT5NBQ4.js";import{a as ve,u as be,j as js}from"./constants-C_615zcG.js";import{u as bs}from"./useInfiniteQuery-fhnMOikS.js";import{B as G}from"./badge-CrsiM596.js";import{I as je}from"./input-Xyw1Rs5H.js";import{a as Dt,c as Je,D as $t,b as Lt,h as ls,i as as,g as xn}from"./dropdown-menu-un00sO73.js";import{e as vs,a as ys,b as At,T as Oe,d as Ns,c as Ue}from"./table-KBcJzih3.js";import{a as os,T as hn}from"./toggle-group-CVheqlM7.js";import{u as pn}from"./use-view-mode-nDNhs-vV.js";import{i as Xt}from"./DotsVertical-D74uB5qh.js";import{i as fn}from"./FilterLines-ezUjepvA.js";import{i as ws}from"./Globe01-DQFjI7NL.js";import{i as ut}from"./Loading01-Ccov_H-l.js";import{i as Cs}from"./SearchMd-ePwgMcp4.js";import{b as zt,c as Ot,d as Ut,e as qt,a as Ft,D as Bt}from"./dialog-BzlH8DMm.js";import{i as vt}from"./AlertCircle-DFllIHYc.js";import{n as gn}from"./Download01-CaDNSpb8.js";import{i as cs}from"./Upload01-BVrA_p4D.js";import{c as yt,b as Nt,d as wt,A as Ct,g as _t,e as kt,a as St,f as Rt}from"./alert-dialog-zUkzI1I7.js";import{C as me}from"./card-BaUmkbam.js";import{s as It}from"./Trash01-B_x31FCQ.js";import{L as le}from"./label-B9X06NrD.js";import{n as jn,S as _s,a as ks,b as Ss,c as Rs,d as Et}from"./select-BWSXn9LF.js";import{S as bt}from"./switch-DCjQmRaz.js";import{T as Gt}from"./textarea-BflLsOYJ.js";import{i as bn}from"./ArrowLeft-DUx23LCt.js";import{i as vn,u as Ht,t as yn}from"./use-copy-DFl3Lkrw.js";import{s as es}from"./RefreshCcw01-Df3WKdLs.js";import{i as Nn}from"./X-ep0AhpnZ.js";import{t as Ts}from"./ChevronDown-CZDY410N.js";import{C as wn}from"./checkbox-vQNHi_v9.js";import{s as Is}from"./Eye-BIF9gjXL.js";import{n as Cn}from"./LinkExternal01-y5rFoKhK.js";import{i as _n}from"./XCircle-CcrJwxck.js";import{h as Ms,e as Ps}from"./use-connection-B5TQguFn.js";import{b as kn,P as Sn,a as Rn}from"./popover-2STAmX7J.js";import{i as Wt}from"./Check-CFpzkHgf.js";import{a as Jt}from"./Copy01-CbgFtFXW.js";import{i as Tn,a as In}from"./Save01-CkhL7WEQ.js";import{i as Mn}from"./Key01-BMRBT_9o.js";import{s as Pn}from"./Plus-DJThru9X.js";import{a as En,b as Dn,T as $n}from"./tooltip-CNx0bR-5.js";import{a as Ln,i as An}from"./mcp-oauth-dc0YrLAp.js";import{i as zn}from"./Play-CipTDlMn.js";import"./infiniteQueryObserver-BvfDXev6.js";import"./ChevronRight-DmlQyyes.js";import"./use-mobile-CcJ4cdUT.js";import"./index-D6zrhjd3.js";const Es=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243"}));Es.displayName="EyeOff";const Ds=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M12.5 3H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H17c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122C21 18.395 21 17.93 21 17m-2-9V2m-3 3h6M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4.49 3.418-8.459 7.69c-.476.433-.714.649-.735.836a.5.5 0 0 0 .167.431C6.105 21 6.426 21 7.07 21h9.387c1.44 0 2.159 0 2.724-.242a3 3 0 0 0 1.578-1.578c.242-.565.242-1.285.242-2.724 0-.484 0-.726-.053-.952a2.001 2.001 0 0 0-.374-.778c-.143-.182-.332-.333-.71-.636l-2.797-2.237c-.379-.303-.568-.454-.776-.508a1 1 0 0 0-.557.018c-.205.066-.384.23-.743.555Z"}));Ds.displayName="ImagePlus";const $s=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));$s.displayName="Link01";const Ls=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}),S.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));Ls.displayName="StopSquare";const ts=({size:t=24,color:e="currentColor",...n})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},S.createElement("path",{d:"m6 6 4.5 4.5M6 6H3L2 3l1-1 3 1v3Zm13.259-3.259-2.628 2.628c-.396.396-.594.594-.668.822a1 1 0 0 0 0 .618c.074.228.272.426.668.822l.238.238c.396.396.594.594.822.668a1 1 0 0 0 .618 0c.228-.074.426-.272.822-.668L21.59 5.41a5.5 5.5 0 0 1-6.16 7.485c-.485-.096-.729-.144-.876-.13a.836.836 0 0 0-.373.114c-.13.07-.261.201-.523.463L6.5 20.5a2.121 2.121 0 0 1-3-3l7.157-7.157c.262-.262.393-.393.463-.524a.836.836 0 0 0 .113-.372c.015-.148-.033-.39-.129-.877a5.5 5.5 0 0 1 8.155-5.83ZM12 15l5.5 5.5a2.121 2.121 0 0 0 3-3l-4.525-4.525a5.475 5.475 0 0 1-.934-.17c-.39-.107-.816-.03-1.101.255L12 15Z"}));ts.displayName="Tool02";const H={all:["private-registry"],items:()=>[...H.all,"items"],itemsList:(t,e,n,r)=>[...H.items(),"list",{search:t,tags:e,categories:n,limit:r}],item:t=>[...H.items(),"item",t],filters:()=>[...H.all,"filters"],registryConfig:()=>[...H.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...H.registryConfig(),t,e],publishRequests:()=>[...H.all,"publish-requests"],publishRequestsByOrg:t=>[...H.publishRequests(),"org",t],publishRequestsList:(t,e,n)=>[...H.publishRequests(),"list",{status:t??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(t,e,n,r)=>[...H.publishRequestsByOrg(t),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...H.publishRequests(),"count"],publishRequestsCountByOrg:t=>[...H.publishRequestsByOrg(t),"count"],publishApiKeys:()=>[...H.all,"publish-api-keys"],monitor:()=>[...H.all,"monitor"],monitorRuns:()=>[...H.monitor(),"runs"],monitorRunsList:t=>[...H.monitorRuns(),"list",{status:t??"all"}],monitorRun:t=>[...H.monitorRuns(),"run",t??"none"],monitorResults:()=>[...H.monitor(),"results"],monitorResultsList:(t,e)=>[...H.monitorResults(),"list",{runId:t??"none",status:e??"all"}],monitorConnections:()=>[...H.monitor(),"connections"],monitorConnectionAuthProbe:t=>[...H.monitorConnections(),"auth-probe",t]};async function qe(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function On(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_START",{config:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorResults()})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Un(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async(c,m)=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorRun(m)})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qt(t){const e=X.c(10),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRunsList(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_LIST",{status:t,limit:100}),e[4]=o,e[5]=t,e[6]=a):a=e[6];let i;return e[7]!==l||e[8]!==a?(i={queryKey:l,queryFn:a,staleTime:5e3},e[7]=l,e[8]=a,e[9]=i):i=e[9],Ze(i)}function ss(t){const e=X.c(11),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRun(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_GET",{runId:t}),e[4]=o,e[5]=t,e[6]=a):a=e[6];const i=!!t;let c;return e[7]!==l||e[8]!==a||e[9]!==i?(c={queryKey:l,queryFn:a,enabled:i,refetchInterval:qn},e[7]=l,e[8]=a,e[9]=i,e[10]=c):c=e[10],Ze(c)}function qn(t){return t.state.data?.run?.status==="running"?5e3:!1}function Mt(t,e,n){const r=X.c(14),{org:o}=he();let l;r[0]!==o.id?(l={connectionId:ve,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=be(l);let i;r[2]!==t||r[3]!==e?(i=H.monitorResultsList(t,e),r[2]=t,r[3]=e,r[4]=i):i=r[4];let c;r[5]!==a||r[6]!==t||r[7]!==e?(c=async()=>qe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:t,status:e,limit:200,offset:0}),r[5]=a,r[6]=t,r[7]=e,r[8]=c):c=r[8];const m=!!t,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==c||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:c,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=c,r[11]=m,r[12]=u,r[13]=x):x=r[13],Ze(x)}function As(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.monitorConnections(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>qe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function Fn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async()=>qe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Bn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>{const{connectionId:m,authStatus:u}=c;return qe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}const ds={monitorMode:"health_check",onFailure:"none",schedule:"manual",cronExpression:"",scheduleEventId:"",perMcpTimeoutMs:3e4,perToolTimeoutMs:1e4,maxAgentSteps:15,testPublicOnly:!1,testPrivateOnly:!1,includePendingRequests:!1,agentContext:"",llmConnectionId:"",llmModelId:""};function zs(){const t=X.c(33),{org:e,project:n}=he();let r;t[0]!==e.id?(r={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const o=be(r),l=Qe();let a;t[2]!==n.id?(a=H.registryConfigByPlugin(n.id??"",tt),t[2]=n.id,t[3]=a):a=t[3];let i;t[4]!==o||t[5]!==n.id?(i=async()=>qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}),t[4]=o,t[5]=n.id,t[6]=i):i=t[6];const c=!!n.id;let m;t[7]!==a||t[8]!==i||t[9]!==c?(m={queryKey:a,queryFn:i,enabled:c},t[7]=a,t[8]=i,t[9]=c,t[10]=m):m=t[10];const u=Ze(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,d=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let b;t[11]!==p?(b=p??{},t[11]=p,t[12]=b):b=t[12];let j;t[13]!==d||t[14]!==x||t[15]!==p?(j=d&&!p?x:{},t[13]=d,t[14]=x,t[15]=p,t[16]=j):j=t[16];let _;t[17]!==b||t[18]!==j?(_={...ds,...b,...j},t[17]=b,t[18]=j,t[19]=_):_=t[19];const k=_;let y;t[20]!==o||t[21]!==n.id?(y=async R=>{const N=(await qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}))?.config?.settings??{};return qe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:tt,settings:{...N,testConfig:{...ds,...N.testConfig??{},...R}}})},t[20]=o,t[21]=n.id,t[22]=y):y=t[22];let g;t[23]!==n.id||t[24]!==l?(g=async()=>{await l.invalidateQueries({queryKey:H.registryConfigByPlugin(n.id??"",tt)})},t[23]=n.id,t[24]=l,t[25]=g):g=t[25];let I;t[26]!==y||t[27]!==g?(I={mutationFn:y,onSuccess:g},t[26]=y,t[27]=g,t[28]=I):I=t[28];const f=$e(I);let w;return t[29]!==u.isLoading||t[30]!==f||t[31]!==k?(w={settings:k,isLoading:u.isLoading,saveMutation:f},t[29]=u.isLoading,t[30]=f,t[31]=k,t[32]=w):w=t[32],w}function Gn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_SET",c),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Kn(){const t=X.c(3),e=Qt("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Mt(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return t[0]!==l||t[1]!==a?(i={brokenCount:l,isLoading:a},t[0]=l,t[1]=a,t[2]=i):i=t[2],i}const Os=24;function Vn(t){return t.trim()}async function Le(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function Us(t){const e=X.c(19),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l,a,i,c;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(a=Vn(t.search),l=t.limit??Os,c=bs,i=H.itemsList(a,t.tags,t.categories,l),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=c):(l=e[6],a=e[7],i=e[8],c=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==t.categories||e[13]!==t.tags||e[14]!==a?(m=async x=>{const{pageParam:p}=x,h=a.length>0?{operator:"or",conditions:[{field:["title"],operator:"contains",value:a},{field:["description"],operator:"contains",value:a},{field:["id"],operator:"contains",value:a},{field:["server","name"],operator:"contains",value:a}]}:void 0;return Le(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=t.categories,e[13]=t.tags,e[14]=a,e[15]=m):m=e[15];let u;return e[16]!==i||e[17]!==m?(u={queryKey:i,queryFn:m,initialPageParam:void 0,getNextPageParam:Yn,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],c(u)}function Yn(t){return t.nextCursor}function Hn(){const t=X.c(8),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.filters(),t[2]=o):o=t[2];let l;t[3]!==r?(l=async()=>Le(r,"REGISTRY_ITEM_FILTERS",{}),t[3]=r,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},t[5]=a):a=t[5];let i;return t[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},t[6]=l,t[7]=i):i=t[7],Ze(i)}function ns(){const t=X.c(29),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.items()}),e.invalidateQueries({queryKey:H.filters()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async g=>(await Le(o,"REGISTRY_ITEM_CREATE",{data:g})).item,t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async g=>{const{id:I,data:f}=g;return(await Le(o,"REGISTRY_ITEM_UPDATE",{id:I,data:f})).item},t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;t[14]!==o?(h=async g=>(await Le(o,"REGISTRY_ITEM_DELETE",{id:g})).item,t[14]=o,t[15]=h):h=t[15];let d;t[16]!==a||t[17]!==h?(d={mutationFn:h,onSuccess:a},t[16]=a,t[17]=h,t[18]=d):d=t[18];const b=$e(d);let j;t[19]!==o?(j=async g=>Le(o,"REGISTRY_ITEM_BULK_CREATE",{items:g}),t[19]=o,t[20]=j):j=t[20];let _;t[21]!==a||t[22]!==j?(_={mutationFn:j,onSuccess:a},t[21]=a,t[22]=j,t[23]=_):_=t[23];const k=$e(_);let y;return t[24]!==k||t[25]!==m||t[26]!==b||t[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:b,bulkCreateMutation:k},t[24]=k,t[25]=m,t[26]=b,t[27]=p,t[28]=y):y=t[28],y}function Kt(t){const e=X.c(37),{org:n,project:r}=he();let o;e[0]!==n.id?(o={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=be(o),a=Qe();let i;e[2]!==t||e[3]!==r.id?(i=H.registryConfigByPlugin(r.id??"",t),e[2]=t,e[3]=r.id,e[4]=i):i=e[4];let c;e[5]!==l||e[6]!==t||e[7]!==r.id?(c=async()=>Le(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}),e[5]=l,e[6]=t,e[7]=r.id,e[8]=c):c=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==c||e[11]!==m?(u={queryKey:i,queryFn:c,enabled:m,staleTime:6e4},e[9]=i,e[10]=c,e[11]=m,e[12]=u):u=e[12];const x=Ze(u);let p;e[13]!==l||e[14]!==t||e[15]!==r.id?(p=async $=>{const M=(await Le(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}))?.config?.settings??{};return Le(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:t,settings:{...M,...$}})},e[13]=l,e[14]=t,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==t||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:H.registryConfigByPlugin(r.id??"",t)})},e[17]=t,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let d;e[21]!==p||e[22]!==h?(d={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=d):d=e[23];const b=$e(d),j=x.data?.config?.settings?.registryName??"Private Registry",_=x.data?.config?.settings?.registryIcon??"",k=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",g=x.data?.config?.settings?.acceptPublishRequests??!1,I=x.data?.config?.settings?.requireApiToken??!1,f=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,P=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",N=x.data?.config?.settings?.rateLimitMax,T=typeof N=="number"&&N>=1?Math.floor(N):100;let v;return e[24]!==g||e[25]!==x.isLoading||e[26]!==w||e[27]!==T||e[28]!==P||e[29]!==_||e[30]!==k||e[31]!==y||e[32]!==j||e[33]!==I||e[34]!==b||e[35]!==f?(v={registryName:j,registryIcon:_,registryLLMConnectionId:k,registryLLMModelId:y,acceptPublishRequests:g,requireApiToken:I,storePrivateOnly:f,rateLimitEnabled:w,rateLimitWindow:P,rateLimitMax:T,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:b},e[24]=g,e[25]=x.isLoading,e[26]=w,e[27]=T,e[28]=P,e[29]=_,e[30]=k,e[31]=y,e[32]=j,e[33]=I,e[34]=b,e[35]=f,e[36]=v):v=e[36],v}function Wn(t){const e=X.c(15),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==n.id||e[3]!==t.sortBy||e[4]!==t.sortDirection||e[5]!==t.status?(l=H.publishRequestsListByOrg(n.id,t.status,t.sortBy,t.sortDirection),e[2]=n.id,e[3]=t.sortBy,e[4]=t.sortDirection,e[5]=t.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==t.sortBy||e[9]!==t.sortDirection||e[10]!==t.status?(a=async c=>{const{pageParam:m}=c;return Le(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t.status,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:Os,offset:m})},e[7]=o,e[8]=t.sortBy,e[9]=t.sortDirection,e[10]=t.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:Jn,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],bs(i)}function Jn(t,e){const n=e.reduce(Zn,0);return n<t.totalCount?n:void 0}function Zn(t,e){return t+e.items.length}function Xn(){const t=X.c(9),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]!==e.id?(o=H.publishRequestsCountByOrg(e.id),t[2]=e.id,t[3]=o):o=t[3];let l;t[4]!==r?(l=async()=>Le(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),t[4]=r,t[5]=l):l=t[5];let a;return t[6]!==o||t[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},t[6]=o,t[7]=l,t[8]=a):a=t[8],Ze(a)}function er(){const t=X.c(17),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.publishRequests()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async d=>Le(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",d),t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async d=>Le(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:d}),t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;return t[14]!==p||t[15]!==m?(h={reviewMutation:m,deleteMutation:p},t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function tr(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.publishApiKeys(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>Le(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function sr(){const t=X.c(19),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async d=>Le(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:d}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[4]=e,t[5]=a):a=t[5];let i;t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8];const c=$e(i);let m;t[9]!==o?(m=async d=>Le(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:d}),t[9]=o,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let x;t[13]!==m||t[14]!==u?(x={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=x):x=t[15];const p=$e(x);let h;return t[16]!==c||t[17]!==p?(h={generateMutation:c,revokeMutation:p},t[16]=c,t[17]=p,t[18]=h):h=t[18],h}function ms(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function us(t){const e=[];let n="",r=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(l==='"'){r&&a==='"'?(n+='"',o+=1):r=!r;continue}if(l===","&&!r){e.push(n.trim()),n="";continue}n+=l}return e.push(n.trim()),e}const nr=["id","title"],rr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ir(t){const e=t.split(/\r?\n/).map(m=>m.trim()).filter(Boolean);if(e.length<2)return{items:[],warnings:[{line:0,message:"CSV must have a header row and at least one data row"}],skipped:0};const n=us(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of nr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!rr.includes(u)&&o.push({line:1,message:`Unknown column "${m}" will be ignored`})}if(!r.has("id")||!r.has("title"))return{items:[],warnings:o,skipped:0};const l=(m,u)=>{const x=r.get(u);return typeof x=="number"?m[x]??"":""},a=[],i=new Set;let c=0;for(let m=1;m<e.length;m+=1){const u=us(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),c+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),c+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),c+=1;continue}i.add(x);const h=l(u,"description").trim(),d=l(u,"remote_url").trim(),j=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",_=ms(l(u,"tags")),k=ms(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),g=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:g,_meta:{"mcp.mesh":{..._.length>0?{tags:_}:{},...k.length>0?{categories:k}:{}}},server:{name:x,title:p,description:h||void 0,remotes:d?[{type:j,url:d}]:[]}})}return{items:a,warnings:o,skipped:c}}const lr=`id,title,description,remote_url,remote_type,tags,categories,is_public
2
2
  my-mcp-server,My MCP Server,A useful MCP server,https://example.com/mcp,http,ai|tools,productivity,true
3
3
  another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function ar(){const t=new Blob([lr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="registry-import-template.csv",n.click(),URL.revokeObjectURL(e)}function or(t){const e=X.c(63),{open:n,onOpenChange:r,isImporting:o,onImport:l}=t,a=o===void 0?!1:o,[i,c]=S.useState(null),[m,u]=S.useState(null),[x,p]=S.useState(null),h=S.useRef(null);let d;e[0]!==r?(d=V=>{r(V),V||(c(null),u(null),p(null),h.current&&(h.current.value=""))},e[0]=r,e[1]=d):d=e[1];const b=d;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=async V=>{if(!V)return;p(V.name),u(null);const ce=await V.text();c(ir(ce))},e[2]=j):j=e[2];const _=j;let k;e[3]!==l||e[4]!==i?(k=async()=>{if(!i?.items.length)return;const V=await l(i.items);u(V)},e[3]=l,e[4]=i,e[5]=k):k=e[5];const y=k;let g;e[6]!==i?.items?(g=i?.items??[],e[6]=i?.items,e[7]=g):g=e[7];const I=g;let f;e[8]!==i?.warnings?(f=i?.warnings??[],e[8]=i?.warnings,e[9]=f):f=e[9];const w=f;let R;e[10]!==w?(R=w.some(ur),e[10]=w,e[11]=R):R=e[11];const P=R,N=m!==null;let T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsxs(zt,{children:[s.jsx(Ot,{children:"Import MCP Servers from CSV"}),s.jsx(Ut,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=T):T=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=()=>h.current?.click(),e[13]=v):v=e[13];let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(cs,{size:14}),e[14]=$):$=e[14];const D=x?"Change file":"Choose CSV file";let M;e[15]!==a||e[16]!==D?(M=s.jsxs(F,{variant:"outline",size:"sm",className:"gap-1.5",onClick:v,disabled:a,children:[$,D]}),e[15]=a,e[16]=D,e[17]=M):M=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("input",{ref:h,type:"file",accept:".csv,text/csv",className:"hidden",onChange:V=>_(V.target.files?.[0]??null)}),e[18]=E):E=e[18];let L;e[19]!==x?(L=x&&s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),e[19]=x,e[20]=L):L=e[20];let q;e[21]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx("div",{className:"flex-1"}),e[21]=q):q=e[21];let z;e[22]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsxs(F,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:ar,children:[s.jsx(gn,{size:14}),"Download template"]}),e[22]=z):z=e[22];let O;e[23]!==M||e[24]!==L?(O=s.jsxs("div",{className:"flex items-center gap-3",children:[M,E,L,q,z]}),e[23]=M,e[24]=L,e[25]=O):O=e[25];let B;e[26]!==w?(B=w.length>0&&s.jsx("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-950/30 p-3 grid gap-1",children:w.map(mr)}),e[26]=w,e[27]=B):B=e[27];let Q;e[28]!==I||e[29]!==i?(Q=I.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:"Preview"}),s.jsxs(G,{variant:"secondary",children:[I.length," items"]}),i?.skipped?s.jsxs(G,{variant:"outline",className:"text-yellow-600",children:[i.skipped," skipped"]}):null]}),s.jsx("div",{className:"border rounded-lg overflow-hidden",children:s.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:s.jsxs(vs,{children:[s.jsx(ys,{children:s.jsxs(At,{children:[s.jsx(Oe,{className:"w-[140px]",children:"ID"}),s.jsx(Oe,{children:"Title"}),s.jsx(Oe,{children:"Remote URL"}),s.jsx(Oe,{className:"w-[80px] text-center",children:"Public"}),s.jsx(Oe,{children:"Tags"})]})}),s.jsx(Ns,{children:I.map(dr)})]})})})]}),e[28]=I,e[29]=i,e[30]=Q):Q=e[30];let te;e[31]!==m?(te=m&&s.jsxs("div",{className:"rounded-lg border p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(ft,{size:16,className:"text-emerald-600"}),"Imported ",m.created," item(s) successfully"]}),m.errors.length>0&&s.jsx("div",{className:"grid gap-1 mt-1",children:m.errors.map(cr)})]}),e[31]=m,e[32]=te):te=e[32];let se;e[33]!==N||e[34]!==i?(se=!i&&!N&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(cs,{size:32,className:"text-muted-foreground/40 mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a CSV file or download the template to get started."}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Required columns: ",s.jsx("code",{children:"id"}),", ",s.jsx("code",{children:"title"}),". Optional:"," ",s.jsx("code",{children:"description"}),", ",s.jsx("code",{children:"remote_url"}),","," ",s.jsx("code",{children:"remote_type"}),", ",s.jsx("code",{children:"tags"}),","," ",s.jsx("code",{children:"categories"}),", ",s.jsx("code",{children:"is_public"}),"."]}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Use ",s.jsx("code",{children:"|"})," or ",s.jsx("code",{children:";"})," to separate multiple tags/categories within a cell."]})]}),e[33]=N,e[34]=i,e[35]=se):se=e[35];let re;e[36]!==O||e[37]!==B||e[38]!==Q||e[39]!==te||e[40]!==se?(re=s.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[O,B,Q,te,se]}),e[36]=O,e[37]=B,e[38]=Q,e[39]=te,e[40]=se,e[41]=re):re=e[41];let ie;e[42]!==b?(ie=()=>b(!1),e[42]=b,e[43]=ie):ie=e[43];const ae=N?"Done":"Cancel";let oe;e[44]!==ie||e[45]!==ae?(oe=s.jsx(F,{variant:"outline",onClick:ie,children:ae}),e[44]=ie,e[45]=ae,e[46]=oe):oe=e[46];let pe;e[47]!==y||e[48]!==P||e[49]!==N||e[50]!==a||e[51]!==I.length?(pe=!N&&s.jsx(F,{onClick:y,disabled:a||I.length===0||P,children:a?"Importing...":`Import ${I.length} item(s)`}),e[47]=y,e[48]=P,e[49]=N,e[50]=a,e[51]=I.length,e[52]=pe):pe=e[52];let ue;e[53]!==oe||e[54]!==pe?(ue=s.jsxs(qt,{className:"gap-2 sm:gap-0",children:[oe,pe]}),e[53]=oe,e[54]=pe,e[55]=ue):ue=e[55];let C;e[56]!==re||e[57]!==ue?(C=s.jsxs(Ft,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[T,re,ue]}),e[56]=re,e[57]=ue,e[58]=C):C=e[58];let K;return e[59]!==b||e[60]!==n||e[61]!==C?(K=s.jsx(Bt,{open:n,onOpenChange:b,children:C}),e[59]=b,e[60]=n,e[61]=C,e[62]=K):K=e[62],K}function cr(t){return s.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[s.jsx(vt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono",children:t.id}),": ",t.error]})]},t.id)}function dr(t){return s.jsxs(At,{children:[s.jsx(Ue,{className:"font-mono text-xs",children:t.id}),s.jsx(Ue,{className:"text-sm",children:t.title}),s.jsx(Ue,{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:t.server.remotes?.[0]?.url??s.jsx("span",{className:"italic",children:"none"})}),s.jsx(Ue,{className:"text-center",children:t.is_public?s.jsx(G,{variant:"secondary",className:"text-[10px] bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:"Yes"}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"No"})}),s.jsx(Ue,{className:"text-xs text-muted-foreground",children:(t._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},t.id)}function mr(t,e){return s.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 flex items-start gap-1.5",children:[s.jsx(vt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[t.line>0&&s.jsxs("span",{className:"font-mono text-[10px] mr-1",children:["Line ",t.line,":"]}),t.message]})]},`${t.line}-${e}`)}function ur(t){return t.message.startsWith("Missing required column:")}function xr(t){const e=X.c(19),{open:n,onOpenChange:r,title:o,isDeleting:l,onConfirm:a}=t,i=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{children:"Delete registry item?"}),e[0]=c):c=e[0];let m;e[1]!==o?(m=s.jsxs(Nt,{children:[c,s.jsxs(wt,{children:["This action cannot be undone. Item ",s.jsx("strong",{children:o})," will be permanently removed from this private registry."]})]}),e[1]=o,e[2]=m):m=e[2];let u;e[3]!==i?(u=s.jsx(Ct,{disabled:i,children:"Cancel"}),e[3]=i,e[4]=u):u=e[4];const x=i?"Deleting...":"Delete";let p;e[5]!==i||e[6]!==a||e[7]!==x?(p=s.jsx(_t,{disabled:i,onClick:a,children:x}),e[5]=i,e[6]=a,e[7]=x,e[8]=p):p=e[8];let h;e[9]!==u||e[10]!==p?(h=s.jsxs(kt,{children:[u,p]}),e[9]=u,e[10]=p,e[11]=h):h=e[11];let d;e[12]!==m||e[13]!==h?(d=s.jsxs(St,{children:[m,h]}),e[12]=m,e[13]=h,e[14]=d):d=e[14];let b;return e[15]!==r||e[16]!==n||e[17]!==d?(b=s.jsx(Rt,{open:n,onOpenChange:r,children:d}),e[15]=r,e[16]=n,e[17]=d,e[18]=b):b=e[18],b}function hr(t){const[e]=t.id.split("/");return e??"provider"}function pr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function fr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function gr(t){return t.server?.icons?.[0]?.src??null}function jr(t){const e=X.c(56),{item:n,onEdit:r,onDelete:o}=t;let l;e[0]!==n?(l=gr(n),e[0]=n,e[1]=l):l=e[1];const a=l;let i;e[2]!==n?(i=[...pr(n),...fr(n)],e[2]=n,e[3]=i):i=e[3];const c=i;let m;e[4]!==c?(m=c.slice(0,3),e[4]=c,e[5]=m):m=e[5];const u=m,x=Math.max(0,c.length-u.length);let p;e[6]!==a||e[7]!==n.title?(p=s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:a?s.jsx("img",{src:a,alt:n.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:n.title.charAt(0).toUpperCase()})}),e[6]=a,e[7]=n.title,e[8]=p):p=e[8];let h;e[9]!==n.title?(h=s.jsx("p",{className:"font-medium truncate",children:n.title}),e[9]=n.title,e[10]=h):h=e[10];let d;e[11]!==n?(d=hr(n),e[11]=n,e[12]=d):d=e[12];let b;e[13]!==d?(b=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:d}),e[13]=d,e[14]=b):b=e[14];let j;e[15]!==n.is_public?(j=n.is_public?s.jsxs(G,{variant:"default",className:"gap-1",children:[s.jsx(ws,{size:10}),"Public"]}):s.jsx(G,{variant:"secondary",children:"Private"}),e[15]=n.is_public,e[16]=j):j=e[16];let _;e[17]!==b||e[18]!==j?(_=s.jsxs("div",{className:"flex items-center gap-2",children:[b,j]}),e[17]=b,e[18]=j,e[19]=_):_=e[19];let k;e[20]!==h||e[21]!==_?(k=s.jsxs("div",{className:"min-w-0 flex-1",children:[h,_]}),e[20]=h,e[21]=_,e[22]=k):k=e[22];let y;e[23]!==k||e[24]!==p?(y=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p,k]}),e[23]=k,e[24]=p,e[25]=y):y=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),e[26]=g):g=e[26];let I;e[27]!==n||e[28]!==r?(I=s.jsx(Je,{onClick:()=>r(n),children:"Edit"}),e[27]=n,e[28]=r,e[29]=I):I=e[29];let f;e[30]!==n||e[31]!==o?(f=()=>o(n),e[30]=n,e[31]=o,e[32]=f):f=e[32];let w;e[33]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(It,{size:14}),e[33]=w):w=e[33];let R;e[34]!==f?(R=s.jsxs(Je,{variant:"destructive",onClick:f,children:[w,"Delete"]}),e[34]=f,e[35]=R):R=e[35];let P;e[36]!==I||e[37]!==R?(P=s.jsxs($t,{children:[g,s.jsxs(Lt,{align:"end",children:[I,R]})]}),e[36]=I,e[37]=R,e[38]=P):P=e[38];let N;e[39]!==y||e[40]!==P?(N=s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[y,P]}),e[39]=y,e[40]=P,e[41]=N):N=e[41];const T=n._meta?.["mcp.mesh"]?.short_description||n.description||n.server.description||"No description provided.";let v;e[42]!==T?(v=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:T}),e[42]=T,e[43]=v):v=e[43];let $;e[44]!==n.id||e[45]!==u?($=u.map(L=>s.jsx(G,{variant:"secondary",children:L},`${n.id}-badge-${L}`)),e[44]=n.id,e[45]=u,e[46]=$):$=e[46];let D;e[47]!==x?(D=x>0&&s.jsxs(G,{variant:"outline",children:["+",x]}),e[47]=x,e[48]=D):D=e[48];let M;e[49]!==$||e[50]!==D?(M=s.jsxs("div",{className:"flex flex-wrap gap-1",children:[$,D]}),e[49]=$,e[50]=D,e[51]=M):M=e[51];let E;return e[52]!==N||e[53]!==v||e[54]!==M?(E=s.jsxs(me,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[N,v,M]}),e[52]=N,e[53]=v,e[54]=M,e[55]=E):E=e[55],E}function qs(t){const e=X.c(27),{value:n,onChange:r,onFileUpload:o,error:l,isUploading:a}=t,i=a===void 0?!1:a,[c,m]=S.useState(!1),[u,x]=S.useState(!1),p=S.useRef(null);let h;e[0]!==i?(h=T=>{T.preventDefault(),i||m(!0)},e[0]=i,e[1]=h):h=e[1];const d=h;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=T=>{T.preventDefault(),m(!1)},e[2]=b):b=e[2];const j=b;let _;e[3]!==i||e[4]!==o?(_=async T=>{if(T.preventDefault(),m(!1),i)return;const v=T.dataTransfer.files[0];v&&await o(v)},e[3]=i,e[4]=o,e[5]=_):_=e[5];const k=_;let y;e[6]!==i||e[7]!==o?(y=async T=>{const v=T.target.files?.[0];v&&!i&&await o(v),T.target.value=""},e[6]=i,e[7]=o,e[8]=y):y=e[8];const g=y,I=n.length>0;let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(le,{children:"Image"}),e[9]=f):f=e[9];let w;e[10]!==d||e[11]!==k||e[12]!==I||e[13]!==c||e[14]!==i||e[15]!==r||e[16]!==u||e[17]!==n?(w=I?s.jsx("div",{className:"relative group min-h-[180px] rounded-xl border border-border overflow-hidden bg-muted/10",children:s.jsxs("div",{className:"flex items-center gap-3 p-3 h-full",children:[s.jsx("div",{className:"size-20 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0",children:s.jsx("img",{src:n,alt:"Preview",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>p.current?.click(),disabled:i,children:[s.jsx(es,{className:"size-3"}),"Change"]}),s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{r(""),x(!1)},disabled:i,children:[s.jsx(It,{className:"size-3"}),"Remove"]})]})]})]})}):i?s.jsxs("div",{className:"relative min-h-[180px] rounded-xl border border-border bg-muted/10 flex flex-col items-center justify-center gap-3",children:[s.jsx(ut,{className:"size-8 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):s.jsxs("div",{className:ne("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",c?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:d,onDragLeave:j,onDrop:k,onClick:()=>p.current?.click(),children:[s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6 px-4 flex-1",children:[s.jsx("div",{className:ne("size-10 rounded-lg flex items-center justify-center transition-colors",c?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:s.jsx(Ds,{size:20})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:c?"Drop image here":"Click or drag to upload"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"PNG, JPG, SVG up to 2MB"})]})]}),u?s.jsx("div",{className:"border-t border-border px-3 py-2",onClick:br,children:s.jsx(je,{placeholder:"https://example.com/logo.png",value:n,className:"text-xs h-8",onChange:T=>r(T.target.value)})}):s.jsx("div",{className:"border-t border-border px-4 py-2",children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-full justify-center",onClick:T=>{T.stopPropagation(),x(!0)},children:[s.jsx($s,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=d,e[11]=k,e[12]=I,e[13]=c,e[14]=i,e[15]=r,e[16]=u,e[17]=n,e[18]=w):w=e[18];let R;e[19]!==g?(R=s.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:g}),e[19]=g,e[20]=R):R=e[20];let P;e[21]!==l?(P=l&&s.jsx("p",{className:"text-xs text-destructive",children:l}),e[21]=l,e[22]=P):P=e[22];let N;return e[23]!==w||e[24]!==R||e[25]!==P?(N=s.jsxs("div",{className:"grid gap-1.5",children:[f,w,R,P]}),e[23]=w,e[24]=R,e[25]=P,e[26]=N):N=e[26],N}function br(t){return t.stopPropagation()}function Fs(){const[t,e]=S.useState("idle"),[n,r]=S.useState(null),{org:o}=he(),l=be({connectionId:ve,orgId:o.id});return{discover:async(c,m)=>{if(!c)return null;e("loading"),r(null);try{const u=await l.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:c,type:m==="sse"?"sse":"http"}}),x=u.structuredContent??u;if(u.isError){const p=u.content?.find(h=>h.type==="text")?.text??"Tool returned an error";return r(p),e("error"),null}return x.error?vr(x.error)?(r(x.error),e("auth_required"),null):(r(x.error),e("error"),null):!x.tools||x.tools.length===0?(r("No tools found on this MCP server."),e("error"),null):(e("success"),x.tools)}catch(u){const x=u instanceof Error?u.message:String(u);return r(x||"Could not discover tools."),e("error"),null}},discoverStatus:t,discoverError:n,resetDiscover:()=>{e("idle"),r(null)}}}function vr(t){const e=t.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function yr(t){const e=X.c(54),{tools:n,onChange:r,remoteUrl:o,remoteType:l,externalDiscoverStatus:a,externalDiscoverError:i}=t,[c,m]=S.useState(n.length>0),{discover:u,discoverStatus:x,discoverError:p,resetDiscover:h}=Fs(),d=a??x,b=i??p;let j;e[0]!==u||e[1]!==r||e[2]!==l||e[3]!==o?(j=async()=>{if(!o)return;const z=await u(o,l??"http");z&&(r(z),m(!0))},e[0]=u,e[1]=r,e[2]=l,e[3]=o,e[4]=j):j=e[4];const _=j;let k;e[5]!==r||e[6]!==h?(k=()=>{r([]),h()},e[5]=r,e[6]=h,e[7]=k):k=e[7];const y=k;let g;e[8]!==c?(g=()=>m(!c),e[8]=c,e[9]=g):g=e[9];let I,f;e[10]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(ts,{size:14,className:"text-muted-foreground"}),f=s.jsx("span",{children:"Tools"}),e[10]=I,e[11]=f):(I=e[10],f=e[11]);let w;e[12]!==n.length?(w=n.length>0&&s.jsx(G,{variant:"secondary",className:"text-xs px-1.5 py-0",children:n.length}),e[12]=n.length,e[13]=w):w=e[13];let R;e[14]!==c?(R=c?s.jsx(jn,{size:14,className:"text-muted-foreground"}):s.jsx(Ts,{size:14,className:"text-muted-foreground"}),e[14]=c,e[15]=R):R=e[15];let P;e[16]!==g||e[17]!==w||e[18]!==R?(P=s.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:g,children:[I,f,w,R]}),e[16]=g,e[17]=w,e[18]=R,e[19]=P):P=e[19];let N;e[20]!==y||e[21]!==n.length?(N=n.length>0&&s.jsxs(F,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:y,children:[s.jsx(It,{size:12}),"Clear"]}),e[20]=y,e[21]=n.length,e[22]=N):N=e[22];let T;e[23]!==d||e[24]!==_||e[25]!==o||e[26]!==n.length?(T=o&&s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all",onClick:_,disabled:d==="loading",children:[d==="loading"?s.jsx(ut,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),d==="loading"?"Discovering...":n.length>0?"Refresh":"Auto-discover"]}),e[23]=d,e[24]=_,e[25]=o,e[26]=n.length,e[27]=T):T=e[27];let v;e[28]!==T||e[29]!==N?(v=s.jsxs("div",{className:"flex items-center gap-2",children:[N,T]}),e[28]=T,e[29]=N,e[30]=v):v=e[30];let $;e[31]!==v||e[32]!==P?($=s.jsxs("div",{className:"flex items-center justify-between",children:[P,v]}),e[31]=v,e[32]=P,e[33]=$):$=e[33];let D;e[34]!==d||e[35]!==n.length?(D=d==="success"&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-950/30 rounded-lg px-3 py-2",children:[s.jsx(ft,{size:14,className:"shrink-0"}),s.jsxs("span",{children:["Discovered ",n.length," tool",n.length!==1?"s":""," ","successfully."]})]}),e[34]=d,e[35]=n.length,e[36]=D):D=e[36];let M;e[37]!==b||e[38]!==d?(M=d==="error"&&b&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:b})]}),e[37]=b,e[38]=d,e[39]=M):M=e[39];let E;e[40]!==c||e[41]!==n?(E=c&&n.length>0&&s.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:n.map(Nr)}),e[40]=c,e[41]=n,e[42]=E):E=e[42];let L;e[43]!==d||e[44]!==c||e[45]!==o||e[46]!==n.length?(L=c&&n.length===0&&d==="idle"&&s.jsx("p",{className:"text-xs text-muted-foreground px-1",children:o?'Click "Auto-discover" to load tools from the MCP server.':"Add a Remote URL first, then tools can be auto-discovered."}),e[43]=d,e[44]=c,e[45]=o,e[46]=n.length,e[47]=L):L=e[47];let q;return e[48]!==$||e[49]!==D||e[50]!==M||e[51]!==E||e[52]!==L?(q=s.jsxs("div",{className:"space-y-3",children:[$,D,M,E,L]}),e[48]=$,e[49]=D,e[50]=M,e[51]=E,e[52]=L,e[53]=q):q=e[53],q}function Nr(t){return s.jsx("div",{className:"flex items-center gap-3 px-3 py-2",children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-mono truncate",children:t.name}),t.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.description})]})},t.name)}function Bs(t){const{org:e}=he(),[n,r]=S.useState(!1),l=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,a=be({connectionId:l??"noop",orgId:e.id});return{uploadImage:async(c,m)=>{if(!l)return Z.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!c.type.startsWith("image/"))return Z.error("Only image files are supported"),null;if(c.size>5*1024*1024)return Z.error("Image size must be less than 5MB"),null;r(!0);try{const u=await a.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:m,contentType:c.type}}),x=u.structuredContent?.url||u.url;if(!x)throw new Error("Failed to get presigned URL");const p=await fetch(x,{method:"PUT",body:c,headers:{"Content-Type":c.type}});if(!p.ok)throw new Error(`Upload failed: ${p.statusText}`);const h=await a.callTool({name:"GET_PRESIGNED_URL",arguments:{key:m,expiresIn:31536e3}}),d=h.structuredContent?.url||h.url;if(!d)throw new Error("Failed to get public URL");return d}catch(u){return console.error("Image upload failed:",u),Z.error(u instanceof Error?u.message:"Failed to upload image. Please try again."),null}finally{r(!1)}},isUploading:n}}function wr(){const{org:t}=he(),[e,n]=S.useState(null),r=S.useRef(0),o=be({connectionId:ve,orgId:t.id});return{generate:async a=>{r.current+=1,n(a.type);try{const i=await o.callTool({name:"REGISTRY_AI_GENERATE",arguments:a});if(i.isError){const c=i.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(c)}return i.structuredContent??i}finally{r.current-=1,r.current===0&&n(null)}},loadingType:e,isGenerating:e!==null}}const Cr=new Set(["http","sse","stdio"]),_r=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,xs=["internal","automation","support","sales","ops","ai"],Gs=["productivity","communication","customer-support","development","data","operations"],kr=["Essentials","Details","Advanced"],ht="h-7 text-xs border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all";function hs(t){return t.replace(/^https?:\/\//i,"").trim()}function pt(t){const e=t.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function ot(t){return t.trim().toLowerCase()}function Tt(t){return Array.from(new Set(t.map(ot).filter(e=>e.length>0)))}function mt(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Sr(t){const e=X.c(4),{current:n}=t;let r;e[0]!==n?(r=kr.map((l,a)=>{const i=a+1,c=i===n,m=i<n;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[a>0&&s.jsx("div",{className:ne("w-4 h-px",m?"bg-primary":"bg-border")}),s.jsxs("div",{className:ne("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",c?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[s.jsx("span",{className:ne("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",c?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:i}),s.jsx("span",{className:"hidden sm:inline",children:l})]})]},l)}),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center gap-1.5",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Rr(t){const e=X.c(28),{id:n,label:r,values:o,availableOptions:l,placeholder:a,onChange:i}=t,[c,m]=S.useState(""),[u,x]=S.useState(!1);let p,h,d,b,j;if(e[0]!==l||e[1]!==n||e[2]!==c||e[3]!==u||e[4]!==r||e[5]!==i||e[6]!==a||e[7]!==o){const y=Tt(l),g=Tt(o),I=new Set(g),f=ot(c),w=y.filter(M=>!I.has(M)).filter(M=>f?M.includes(f):!0).slice(0,8),R=M=>{const E=ot(M);!E||I.has(E)||i([...g,E])},P=M=>{i(g.filter(E=>E!==M))},N=()=>{const M=c.split(/[,\n;]/).map(ot).filter(Boolean);if(M.length===0)return;const E=[...g];for(const L of M)E.includes(L)||E.push(L);i(E),m("")},T=f;b="grid gap-2",e[13]!==n||e[14]!==r?(j=s.jsx(le,{htmlFor:n,children:r}),e[13]=n,e[14]=r,e[15]=j):j=e[15],p="relative";let v;e[16]!==n?(v=()=>{const M=document.getElementById(n);M instanceof HTMLInputElement&&M.focus()},e[16]=n,e[17]=v):v=e[17];let $;e[18]===Symbol.for("react.memo_cache_sentinel")?($=()=>x(!0),e[18]=$):$=e[18];let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=M=>m(M.target.value),e[19]=D):D=e[19],h=s.jsx("div",{className:"min-h-9 w-full rounded-xl border border-input bg-background px-2.5 py-1.5 text-sm focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",onClick:v,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[g.map(M=>s.jsxs(G,{variant:"secondary",className:"gap-1",children:[M,s.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),P(M)},children:s.jsx(Nn,{size:12})})]},`${n}-${M}`)),s.jsx("input",{id:n,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:g.length?"":a,value:c,onFocus:$,onBlur:()=>{x(!1),N()},onChange:D,onKeyDown:M=>{if(M.key==="Enter"||M.key===","){M.preventDefault(),N();return}M.key==="Backspace"&&!c&&g.length&&P(g[g.length-1]??"")}})]})}),d=u&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:w.length>0?w.map(M=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Ir,onClick:()=>{R(M),m("")},children:M},`${n}-suggestion-${M}`)):T?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Tr,onClick:()=>{R(T),m("")},children:['Create "',T,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})}),e[0]=l,e[1]=n,e[2]=c,e[3]=u,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=p,e[9]=h,e[10]=d,e[11]=b,e[12]=j}else p=e[8],h=e[9],d=e[10],b=e[11],j=e[12];let _;e[20]!==p||e[21]!==h||e[22]!==d?(_=s.jsxs("div",{className:p,children:[h,d]}),e[20]=p,e[21]=h,e[22]=d,e[23]=_):_=e[23];let k;return e[24]!==b||e[25]!==j||e[26]!==_?(k=s.jsxs("div",{className:b,children:[j,_]}),e[24]=b,e[25]=j,e[26]=_,e[27]=k):k=e[27],k}function Tr(t){return t.preventDefault()}function Ir(t){return t.preventDefault()}function Mr({id:t,value:e,availableOptions:n,onChange:r}){const[o,l]=S.useState(e),[a,i]=S.useState(!1),c=S.useRef(e);c.current!==e&&(c.current=e,l(e));const m=Tt([...Gs,...n,e]).filter(Boolean),u=ot(o),x=m.filter(h=>u?h.includes(u):!0).slice(0,8),p=h=>{const d=ot(h);r(d),l(d),i(!1)};return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(le,{htmlFor:t,children:"Category"}),s.jsxs("div",{className:"relative",children:[s.jsx(je,{id:t,className:"h-9 text-sm",placeholder:"Select or create category",value:o,onFocus:()=>{l(e),i(!0)},onBlur:()=>{p(o)},onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),p(o))}}),e&&s.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground hover:text-foreground",onMouseDown:h=>h.preventDefault(),onClick:()=>{r(""),l("")},children:"clear"}),a&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:x.length>0?x.map(h=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:d=>d.preventDefault(),onClick:()=>p(h),children:h},`${t}-${h}`)):u?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:h=>h.preventDefault(),onClick:()=>p(u),children:['Create "',u,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})})]})]})}function Pr({open:t,onOpenChange:e,item:n,draft:r,availableTags:o=[],availableCategories:l=[],defaultLLMConnectionId:a="",defaultLLMModelId:i="",isSubmitting:c=!1,onSubmit:m}){const{org:u}=he(),{uploadImage:x,isUploading:p}=Bs(),{generate:h,loadingType:d}=wr(),{discover:b,discoverStatus:j,discoverError:_,resetDiscover:k}=Fs(),y=!!n,g=r?._meta?.["mcp.mesh"],I=n?.title??r?.title??"",f=n?.id?.split("/")[0]??r?.id?.split("/")[0]??"",w=n?.description??r?.description??"",R=n?._meta?.["mcp.mesh"]?.short_description??g?.short_description??"",P=n?._meta?.["mcp.mesh"]?.owner??g?.owner??"",N=n?.server?.repository?.url??r?.server?.repository?.url??"",T=n?._meta?.["mcp.mesh"]?.readme??g?.readme??"",v=n?._meta?.["mcp.mesh"]?.readme_url??g?.readme_url??"",$=hs(n?.server?.remotes?.[0]?.url??r?.server?.remotes?.[0]?.url??""),D=n?.server?.remotes?.[0]?.type??r?.server?.remotes?.[0]?.type??"http",M=n?._meta?.["mcp.mesh"]?.tags??g?.tags??[],E=n?._meta?.["mcp.mesh"]?.categories?.[0]??g?.categories?.[0]??"",L=n?.server?.icons?.[0]?.src??r?.server?.icons?.[0]?.src??"",q=n?._meta?.["mcp.mesh"]?.tools??g?.tools??[],z=n?.is_public??r?.is_public??!1,[O,B]=S.useState(1),[Q,te]=S.useState(I),[se,re]=S.useState(f),[ie,ae]=S.useState(w),[oe,pe]=S.useState(R),[ue,C]=S.useState(P),[K,V]=S.useState(N),[ce,fe]=S.useState(T),[we,Ce]=S.useState(v),[J,_e]=S.useState(T?"content":"link"),[xe,ke]=S.useState($),[ee,ge]=S.useState(D),[Re,ye]=S.useState(M),[Me,Ee]=S.useState(E),[Se,ze]=S.useState(L),[Ne,Fe]=S.useState(q),[Be,Xe]=S.useState(z),[A,de]=S.useState({}),Te=!!(a&&i),De=()=>{B(1),te(I),re(f),ae(w),pe(R),C(P),V(N),fe(T),Ce(v),_e(T?"content":"link"),ke($),ge(D),ye(M),Ee(E),ze(L),Fe(q),Xe(z),de({}),k(),Ge.current="",Pe.current&&(clearTimeout(Pe.current),Pe.current=null)},st=async U=>{if(!U)return;const Y=y?n?.id:`${se}/${Q}`.toLowerCase(),Ae=mt(Y||"temp"),Ye=U.name.split(".").pop()||"png",He=`registry/${u.id}/${Ae}/icon.${Ye}`,dt=await x(U,He);dt?(ze(dt),de(We=>({...We,imageUrl:void 0}))):de(We=>({...We,imageUrl:"Failed to upload image. Please try again."}))},Pe=S.useRef(null),Ge=S.useRef(""),nt=S.useRef(ee);nt.current=ee;const ct=U=>{!U&&Pe.current&&(clearTimeout(Pe.current),Pe.current=null),e(U),U||De()},rt=async()=>{const U=pt(xe);if(!U)return;Ge.current=U;const Y=await b(U,nt.current);Y&&Fe(Y)},it=U=>{Pe.current&&clearTimeout(Pe.current);const Y=pt(U);!Y||Y===Ge.current||U.includes(".")&&(Pe.current=setTimeout(async()=>{Ge.current=Y;const Ae=await b(Y,nt.current);Ae&&Fe(Ae)},800))},Ke=()=>Te?{llmConnectionId:a,modelId:i}:null,Ve=()=>({name:Q.trim(),provider:se.trim(),url:pt(xe),owner:ue.trim(),repositoryUrl:K.trim(),description:ie.trim(),shortDescription:oe.trim(),tags:Re,categories:Me?[Me]:[],availableTags:[...xs,...o],availableCategories:[...Gs,...l],tools:Ne}),lt=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"description",context:Ve()});Y.result&&ae(Y.result.slice(0,1500))},at=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"short_description",context:Ve()});Y.result&&pe(Y.result.slice(0,160))},W=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"tags",context:Ve()});Y.items?.length&&ye(Tt(Y.items))},Ie=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"categories",context:Ve()});Y.items?.[0]&&Ee(ot(Y.items[0]))},xt=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"readme",context:Ve()});Y.result&&(fe(Y.result.slice(0,5e4)),_e("content"))},rs=U=>{const Y={};if(U===1){const Ae=mt(se),Ye=mt(Q),He=`${Ae}/${Ye}`;Q.trim()||(Y.title="Name is required."),y||(Ae?Ye?_r.test(He)||(Y.provider="Use lowercase letters/numbers and separators '/' or '-'."):Y.title="Name must contain valid characters.":Y.provider="Provider is required.");const dt=pt(xe),We=ee.trim().toLowerCase();if(We!=="stdio"&&dt)try{const gt=new URL(dt);["http:","https:"].includes(gt.protocol)||(Y.remoteUrl="Remote URL must be http(s).")}catch{Y.remoteUrl="Remote URL is invalid."}if(We&&!Cr.has(We)&&(Y.remoteType="Remote type must be: http, sse or stdio."),Se.trim()&&!Se.trim().startsWith("data:image/"))try{const Vt=new URL(Se.trim());["http:","https:"].includes(Vt.protocol)||(Y.imageUrl="Image URL must be http(s).")}catch{Y.imageUrl="Image URL is invalid."}}if(U===2&&(ie.length>1500&&(Y.description="Description must be 1500 characters or less."),oe.trim().length>160&&(Y.shortDescription="Short description must be 160 characters or less.")),U===3){const Ae=we.trim();if(Ae)try{const He=new URL(Ae);["http:","https:"].includes(He.protocol)||(Y.readmeUrl="README URL must be http(s).")}catch{Y.readmeUrl="README URL is invalid."}ce.trim().length>5e4&&(Y.readme="README must be 50 000 characters or less.");const Ye=K.trim();if(Ye)try{const He=new URL(Ye);["http:","https:"].includes(He.protocol)||(Y.repositoryUrl="Repository URL must be http(s).")}catch{Y.repositoryUrl="Repository URL is invalid."}}return de(Y),Object.values(Y).every(Ae=>Ae===void 0)},Ws=()=>{rs(O)&&O<3&&B(O+1)},Js=()=>{O>1&&B(O-1)},Zs=async()=>{if(!rs(3))return;const U=Q.trim(),Y=mt(se),Ae=mt(U),Ye=`${Y}/${Ae}`,He=pt(xe),dt=ee.trim().toLowerCase(),We=Se.trim(),gt=K.trim(),Vt=oe.trim(),sn=ce.trim(),nn=we.trim(),rn=Tt(Re),ln=Me?[ot(Me)]:[],an=n?n.server?.name??n.id:"",on=(y?an:Ye).trim(),Yt=ie.trim(),cn=ue.trim(),is={title:U,description:Yt.length>0?Yt:null,is_public:Be,_meta:{"mcp.mesh":{tags:rn,categories:ln,short_description:Vt||null,owner:cn||null,readme:sn||null,readme_url:nn||null,...Ne.length>0?{tools:Ne}:{}}},server:{name:on,title:U,description:Yt||void 0,icons:We?[{src:We}]:[],repository:gt?{url:gt}:void 0,remotes:He?[{type:dt||"http",url:He}]:[]}};if(y&&n){await m({id:n.id,data:is}),e(!1);return}await m({id:Ye,...is}),e(!1),De()},Xs=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"row-span-2 grid gap-3 content-start",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-provider",children:"Provider"}),s.jsx(je,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:se,onChange:U=>re(U.target.value),disabled:y}),!y&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",s.jsx("span",{className:"font-mono",children:`${mt(se)||"provider"}/${mt(Q)||"name"}`})]}),A.provider&&s.jsx("p",{className:"text-xs text-destructive",children:A.provider})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-title",children:"Name"}),s.jsx(je,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:Q,onChange:U=>te(U.target.value)}),A.title&&s.jsx("p",{className:"text-xs text-destructive",children:A.title})]})]}),s.jsx("div",{className:"row-span-2 content-start",children:s.jsx(qs,{value:Se,onChange:U=>{ze(U),de(Y=>({...Y,imageUrl:void 0}))},onFileUpload:st,error:A.imageUrl,isUploading:p})}),s.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-remote-url",children:"Remote URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex-1 flex items-center rounded-xl border border-input px-3",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground mr-1",children:"https://"}),s.jsx("input",{id:"registry-remote-url",className:"flex-1 h-9 bg-transparent outline-none text-sm",placeholder:"example.com/mcp",value:xe,onChange:U=>{const Y=hs(U.target.value);ke(Y),it(Y)}})]}),s.jsxs(_s,{value:ee,onValueChange:ge,children:[s.jsx(ks,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:s.jsx(Ss,{placeholder:"Type"})}),s.jsxs(Rs,{children:[s.jsx(Et,{value:"http",children:"http"}),s.jsx(Et,{value:"sse",children:"sse"}),s.jsx(Et,{value:"stdio",children:"stdio"})]})]})]}),A.remoteUrl&&s.jsx("p",{className:"text-xs text-destructive",children:A.remoteUrl}),A.remoteType&&s.jsx("p",{className:"text-xs text-destructive",children:A.remoteType})]}),xe.trim()&&s.jsxs("div",{className:"col-span-2 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"gap-1.5"),onClick:rt,disabled:j==="loading",children:[j==="loading"?s.jsx(ut,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),j==="loading"?"Discovering tools...":Ne.length>0?"Re-discover tools":"Discover tools from URL"]}),Ne.length>0&&j!=="loading"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ne.length," tool",Ne.length!==1?"s":""," loaded"]})]}),j==="success"&&Ne.length>0&&s.jsxs("div",{className:"rounded-lg border border-green-500/20 bg-green-50 dark:bg-green-950/20 px-3 py-2 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400",children:[s.jsx(ft,{size:14,className:"shrink-0"}),s.jsxs("span",{className:"font-medium",children:[Ne.length," tool",Ne.length!==1?"s":""," discovered"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[Ne.slice(0,8).map(U=>s.jsx(G,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:U.name},U.name)),Ne.length>8&&s.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",Ne.length-8," more"]})]}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"These tools will enrich AI-generated descriptions, tags and categories in the next step."})]}),j==="auth_required"&&_&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 border border-amber-500/20 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:"This server requires authentication. The connection is valid but tools cannot be listed without credentials."})]}),j==="error"&&_&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:_})]})]})]}),en=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{htmlFor:"registry-item-short-description",children:"Short Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[oe.length,"/160"]}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="short_description",onClick:at,children:d==="short_description"?"Generating...":"AI Generate"})]})]}),s.jsx(je,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:oe,maxLength:160,onChange:U=>pe(U.target.value)}),A.shortDescription&&s.jsx("p",{className:"text-xs text-destructive",children:A.shortDescription})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{htmlFor:"registry-item-description",children:"Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ie.length,"/1500"]}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="description",onClick:lt,children:d==="description"?"Generating...":"AI Generate"})]})]}),s.jsx(Gt,{id:"registry-item-description",className:"text-sm max-h-28 overflow-y-auto resize-none",placeholder:"Brief description of this MCP server",rows:2,value:ie,onChange:U=>ae(U.target.value)}),A.description&&s.jsx("p",{className:"text-xs text-destructive",children:A.description})]}),s.jsx("div",{className:"border-t border-border"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Mr,{id:"registry-category",value:Me,availableOptions:l,onChange:Ee}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"justify-self-start"),disabled:d==="categories",onClick:Ie,children:d==="categories"?"Suggesting...":"AI Suggest"})]}),s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Rr,{id:"registry-tags",label:"Tags",values:Re,availableOptions:[...xs,...o],placeholder:"Type and press Enter or comma",onChange:ye}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"justify-self-start"),disabled:d==="tags",onClick:W,children:d==="tags"?"Suggesting...":"AI Suggest"})]})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx(le,{htmlFor:"registry-is-public",className:"text-sm",children:"Public"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Make this MCP visible in the public store URL."})]}),s.jsx(bt,{id:"registry-is-public",checked:Be,onCheckedChange:Xe})]})]}),tn=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),s.jsx(je,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:ue,onChange:U=>C(U.target.value)})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),s.jsx(je,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:K,onChange:U=>V(U.target.value)}),A.repositoryUrl&&s.jsx("p",{className:"text-xs text-destructive",children:A.repositoryUrl})]})]}),s.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{children:"README"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ce.length,"/50000"]})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(Te?["link","content","generate"]:["link","content"]).map(U=>s.jsx("button",{type:"button",className:ne("px-2.5 py-1 text-xs rounded-md",J===U?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>_e(U),children:U==="link"?"Link":U==="content"?"Content":"Generate"},U))}),J==="link"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(je,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:we,onChange:U=>Ce(U.target.value)}),A.readmeUrl&&s.jsx("p",{className:"text-xs text-destructive",children:A.readmeUrl})]}),J==="content"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Gt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
4
4
 
@@ -1 +1 @@
1
- import"./index-DL3qqjep.js";import{c as s}from"./constants-CYyFC-Sp.js";function m(t){if(!t)return"";const r=t.find(n=>n.name==="COLLECTION_REGISTRY_APP_LIST");if(r)return r.name;const e=t.find(n=>n.name==="REGISTRY_ITEM_LIST");if(e)return e.name;const i=t.find(n=>n.name.startsWith("COLLECTION_REGISTRY_APP_")&&n.name.endsWith("_LIST"));return i?i.name:""}function o(t){if(!t)return"";const r=t.find(n=>n.name==="COLLECTION_REGISTRY_APP_FILTERS");if(r)return r.name;const e=t.find(n=>n.name==="REGISTRY_ITEM_FILTERS");if(e)return e.name;const i=t.find(n=>n.name.startsWith("COLLECTION_REGISTRY_APP_")&&n.name.endsWith("_FILTERS"));return i?i.name:""}function I(t,r){if(!t)return"";const e=t.find(f=>f.name===`COLLECTION_REGISTRY_APP${r}`);if(e)return e.name;const i={_GET:"REGISTRY_ITEM_GET",_VERSIONS:"REGISTRY_ITEM_VERSIONS",_SEARCH:"REGISTRY_ITEM_SEARCH"},n=t.find(f=>f.name===i[r]);if(n)return n.name;const a=t.find(f=>f.name.startsWith("COLLECTION_REGISTRY_APP_")&&f.name.endsWith(r));return a?a.name:""}function R(t){if(!t)return[];const r=[];for(const e of t){let i=[];if(Array.isArray(e))i=e;else if(typeof e=="object"&&e!==null){const n=Object.keys(e).find(a=>Array.isArray(e[a]));n&&(i=e[n])}r.push(...i)}return r}const c={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function E(t){return t?c[t]??t.toUpperCase():null}function _(t){return t?t.match(/schemas\/([\d-]+)/)?.[1]??null:null}function S(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null){const r=Object.keys(t).find(e=>Array.isArray(t[e]));if(r)return t[r]}return[]}async function d(t,r,e,i){const n=await s({connectionId:t,orgId:r});try{const a=await n.callTool({name:e,arguments:i});return a.structuredContent??a}finally{await n.close().catch(console.error)}}export{R as a,o as b,d as c,I as d,S as e,m as f,E as g,_ as h};
1
+ import"./index-CyQ-uP58.js";import{c as s}from"./constants-C_615zcG.js";function m(t){if(!t)return"";const r=t.find(n=>n.name==="COLLECTION_REGISTRY_APP_LIST");if(r)return r.name;const e=t.find(n=>n.name==="REGISTRY_ITEM_LIST");if(e)return e.name;const i=t.find(n=>n.name.startsWith("COLLECTION_REGISTRY_APP_")&&n.name.endsWith("_LIST"));return i?i.name:""}function o(t){if(!t)return"";const r=t.find(n=>n.name==="COLLECTION_REGISTRY_APP_FILTERS");if(r)return r.name;const e=t.find(n=>n.name==="REGISTRY_ITEM_FILTERS");if(e)return e.name;const i=t.find(n=>n.name.startsWith("COLLECTION_REGISTRY_APP_")&&n.name.endsWith("_FILTERS"));return i?i.name:""}function I(t,r){if(!t)return"";const e=t.find(f=>f.name===`COLLECTION_REGISTRY_APP${r}`);if(e)return e.name;const i={_GET:"REGISTRY_ITEM_GET",_VERSIONS:"REGISTRY_ITEM_VERSIONS",_SEARCH:"REGISTRY_ITEM_SEARCH"},n=t.find(f=>f.name===i[r]);if(n)return n.name;const a=t.find(f=>f.name.startsWith("COLLECTION_REGISTRY_APP_")&&f.name.endsWith(r));return a?a.name:""}function R(t){if(!t)return[];const r=[];for(const e of t){let i=[];if(Array.isArray(e))i=e;else if(typeof e=="object"&&e!==null){const n=Object.keys(e).find(a=>Array.isArray(e[a]));n&&(i=e[n])}r.push(...i)}return r}const c={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function E(t){return t?c[t]??t.toUpperCase():null}function _(t){return t?t.match(/schemas\/([\d-]+)/)?.[1]??null:null}function S(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null){const r=Object.keys(t).find(e=>Array.isArray(t[e]));if(r)return t[r]}return[]}async function d(t,r,e,i){const n=await s({connectionId:t,orgId:r});try{const a=await n.callTool({name:e,arguments:i});return a.structuredContent??a}finally{await n.close().catch(console.error)}}export{R as a,o as b,d as c,I as d,S as e,m as f,E as g,_ as h};