decocms 4.286.2 → 4.286.4
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.
- package/dist/client/assets/{AlertCircle-hiOqJcW5.js → AlertCircle-CjPPe_Es.js} +1 -1
- package/dist/client/assets/{AreaChart-BqfhkmRW.js → AreaChart-z-wKOY4Q.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DEFSUc-V.js → ArrowLeft-xVEL6Xri.js} +1 -1
- package/dist/client/assets/{ArrowUp-CHCWVGsK.js → ArrowUp-B504DwzE.js} +1 -1
- package/dist/client/assets/{Check-yS6TBRKx.js → Check-D-tWl3Ph.js} +1 -1
- package/dist/client/assets/{CheckCircle-DUmezbyG.js → CheckCircle-1al5Y-iY.js} +1 -1
- package/dist/client/assets/{ChevronDown-RrKk7H6I.js → ChevronDown-B_ixPCTO.js} +1 -1
- package/dist/client/assets/{ChevronRight-B3-5oKsn.js → ChevronRight-C3-hRZ4f.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-CqILirh0.js → ChevronSelectorVertical-BhgvMMhD.js} +1 -1
- package/dist/client/assets/{ChevronUp-7BeD5K4q.js → ChevronUp-CcbaTGNZ.js} +1 -1
- package/dist/client/assets/Circle-BAeolOWX.js +1 -0
- package/dist/client/assets/{Copy01-DH1C4T5n.js → Copy01-neaxsIAM.js} +1 -1
- package/dist/client/assets/{CreditCard01-DxOjVad1.js → CreditCard01-ww7LUBF4.js} +1 -1
- package/dist/client/assets/DotsVertical-CWvHeX6p.js +1 -0
- package/dist/client/assets/{Download01-uGF8VQkc.js → Download01-Cpj3pMZO.js} +1 -1
- package/dist/client/assets/{Eye-BP8ZftGB.js → Eye-DZppzI4K.js} +1 -1
- package/dist/client/assets/{FilterLines-DQxyjNBq.js → FilterLines-BoU3nKXE.js} +1 -1
- package/dist/client/assets/Flag01-Cks7Hcsj.js +1 -0
- package/dist/client/assets/{Globe01-DZMulFU5.js → Globe01-Blrb9QCE.js} +1 -1
- package/dist/client/assets/{Globe04-DCtFs4xl.js → Globe04-nqeXJchO.js} +1 -1
- package/dist/client/assets/{HardDrive-BLuff5wS.js → HardDrive-AUMHLymc.js} +1 -1
- package/dist/client/assets/{Key01-DLwJ7Ckf.js → Key01-CBfmNloZ.js} +1 -1
- package/dist/client/assets/{LinkExternal01--8l2Mzfp.js → LinkExternal01-CSXhEw69.js} +1 -1
- package/dist/client/assets/{LockUnlocked01-DiNL4sfs.js → LockUnlocked01-Dp6LUDzs.js} +1 -1
- package/dist/client/assets/{LogOut01-DDaRu_3P.js → LogOut01-BwKRFWiv.js} +1 -1
- package/dist/client/assets/{Monitor01-i2p8_gzb.js → Monitor01-BmwzRY8Z.js} +1 -1
- package/dist/client/assets/{Palette-xsvHNVzX.js → Palette-B_zZgvh3.js} +1 -1
- package/dist/client/assets/{Play-BAPfXOmA.js → Play-d1wMPqu_.js} +1 -1
- package/dist/client/assets/{Plus-BAv6QwTj.js → Plus-CS3JRZHD.js} +1 -1
- package/dist/client/assets/{SearchLg-C-Eqo4y8.js → SearchLg-Bgx75S-8.js} +1 -1
- package/dist/client/assets/{SearchMd-BsqgJ4OR.js → SearchMd-Bhs-AY-t.js} +1 -1
- package/dist/client/assets/{Settings02-EAB5l-Jo.js → Settings02-1WpCazPC.js} +1 -1
- package/dist/client/assets/{Share07-D3k-RSTq.js → Share07-C_MGXbKu.js} +1 -1
- package/dist/client/assets/{Shield01-XqMu5Nf3.js → Shield01-hY2vXu_p.js} +1 -1
- package/dist/client/assets/{Stars01-CqDHtnom.js → Stars01-DrSh3zMF.js} +1 -1
- package/dist/client/assets/{Stars02-DvnkqIQI.js → Stars02-BnPoIjHT.js} +1 -1
- package/dist/client/assets/{Sun-BArbxBTe.js → Sun-BW56eukD.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-V4kh4_ID.js → SwitchHorizontal01-l1VxUcA6.js} +1 -1
- package/dist/client/assets/Tag01-B7UGGBpr.js +1 -0
- package/dist/client/assets/ThumbsUp-CzeOya0s.js +1 -0
- package/dist/client/assets/{Tool01-Bi7x_pFT.js → Tool01-dqpaqZjV.js} +1 -1
- package/dist/client/assets/{Tool02-BahI2w-F.js → Tool02-y2Kt_Mle.js} +1 -1
- package/dist/client/assets/{Trash01-CxXI4uLo.js → Trash01-DXi7qmjb.js} +1 -1
- package/dist/client/assets/TrendUp01-DlR3MMdY.js +1 -0
- package/dist/client/assets/{Upload01-Dx6t-7oj.js → Upload01-zXZzID1Z.js} +1 -1
- package/dist/client/assets/{User01-Bs6_V_tl.js → User01-D5qvxe7_.js} +1 -1
- package/dist/client/assets/UserSquare-BCsy6lPT.js +1 -0
- package/dist/client/assets/{Users01-UmcM8Jww.js → Users01-BNl3O1xq.js} +1 -1
- package/dist/client/assets/{Users03-xamSOp-f.js → Users03-D4uJ1x7m.js} +1 -1
- package/dist/client/assets/{XCircle-DbIIvoOs.js → XCircle-DP3o1KVc.js} +1 -1
- package/dist/client/assets/{XClose-BWO2zbra.js → XClose-DcJ8LsPY.js} +1 -1
- package/dist/client/assets/{YAxis-ByFmlys2.js → YAxis-Bh0QJVqk.js} +1 -1
- package/dist/client/assets/{Zap-DrubYVJC.js → Zap-QaC6OykZ.js} +1 -1
- package/dist/client/assets/{ZapSquare-BWMDlPC4.js → ZapSquare-rS3NzNGE.js} +1 -1
- package/dist/client/assets/{access-gate-BxOMxDlN.js → access-gate-Cxk9l6b9.js} +1 -1
- package/dist/client/assets/agent-icon-CQ4qTxJT.js +1 -0
- package/dist/client/assets/agents-list-BF8Sxquk.js +1 -0
- package/dist/client/assets/{ai-providers-DudSkLhI.js → ai-providers-0lVVwipt.js} +1 -1
- package/dist/client/assets/{alert-Bz2oKGcW.js → alert-Di8wV19j.js} +1 -1
- package/dist/client/assets/{alert-dialog-C7gi43qw.js → alert-dialog-C2gjYbmU.js} +1 -1
- package/dist/client/assets/{api-keys-BmwPSJJx.js → api-keys-D-qkBRR0.js} +1 -1
- package/dist/client/assets/app-editor-Dq0blITG.js +1 -0
- package/dist/client/assets/{auth-XA3XVIU6.js → auth-CR0_WHnM.js} +1 -1
- package/dist/client/assets/{auth-catchall-C9aYupjX.js → auth-catchall-QvGPbVjd.js} +1 -1
- package/dist/client/assets/{auth-entry-DxkDBhzc.js → auth-entry-CWY4gCWi.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Dl6V6Y4j.js → auth-split-layout-DzhkGA45.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-C4F2LaiG.js → authenticate-and-persist-oauth-DePShlsb.js} +1 -1
- package/dist/client/assets/{automation-list-row-CmUv79s4.js → automation-list-row-Cj-qk1co.js} +1 -1
- package/dist/client/assets/{automation-runs-DHi91GZY.js → automation-runs-DGZfbF0y.js} +1 -1
- package/dist/client/assets/automations-CUtamPLl.js +1 -0
- package/dist/client/assets/{avatar-BKEDMSnX.js → avatar-gygO8t0k.js} +1 -1
- package/dist/client/assets/{badge-BVOT5cY1.js → badge-CagNBc4U.js} +1 -1
- package/dist/client/assets/{block-document-CIjl4dWS.js → block-document-CpLnMzDW.js} +2 -2
- package/dist/client/assets/{breadcrumb-DcuBWgU6.js → breadcrumb-BLJkl04u.js} +1 -1
- package/dist/client/assets/{buckets-BxUOH6pm.js → buckets-CQX7ELNp.js} +1 -1
- package/dist/client/assets/bulk-category-panel-pYKTv68z.js +1 -0
- package/dist/client/assets/{capability-load-error-Bz8fYgjS.js → capability-load-error-BbaDF84A.js} +1 -1
- package/dist/client/assets/{cards-XUuMSfqb.js → cards-2NqNY4R9.js} +1 -1
- package/dist/client/assets/category-editor-Cw-qgPeh.js +1 -0
- package/dist/client/assets/{chart-Ck_FKld6.js → chart-DNRpbEQG.js} +1 -1
- package/dist/client/assets/{chat-context-cfHPN5ei.js → chat-context-DdGr3_g8.js} +1 -1
- package/dist/client/assets/{checkbox-hfjBf94F.js → checkbox-CvS4qhxI.js} +1 -1
- package/dist/client/assets/choose-editor-CRVToY1R.js +1 -0
- package/dist/client/assets/{cli-auth-success-CyoOzdgx.js → cli-auth-success-BxxY4YVS.js} +1 -1
- package/dist/client/assets/collection-detail-DBFBDjmC.js +1 -0
- package/dist/client/assets/{collection-display-button-C-VYkKeK.js → collection-display-button-BeDXWwQw.js} +1 -1
- package/dist/client/assets/{collection-search-Bw_HysKr.js → collection-search-D3XcAdbv.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D6YxcBlE.js → collection-table-wrapper-DXgYFbn3.js} +1 -1
- package/dist/client/assets/{collection-tabs-B_gvi_U1.js → collection-tabs-DqgsWWuc.js} +1 -1
- package/dist/client/assets/{command-DmgErSks.js → command-98mCceOP.js} +1 -1
- package/dist/client/assets/commerce-onboarding-COoKJya8.js +1 -0
- package/dist/client/assets/config-DY6hf3s8.js +1 -0
- package/dist/client/assets/{connect-B3CB3NbU.js → connect-DP6XodOs.js} +1 -1
- package/dist/client/assets/{connection-Du-s9JTq.js → connection-BFaWbm0C.js} +1 -1
- package/dist/client/assets/{connection-card-qmGgp48y.js → connection-card-Cv0RsJJ_.js} +1 -1
- package/dist/client/assets/connection-detail-Dqb7DdBc.js +1 -0
- package/dist/client/assets/{connection-form-helpers-CEN5IzSB.js → connection-form-helpers-Df8e763X.js} +1 -1
- package/dist/client/assets/connections-D5Ay3kJB.js +1 -0
- package/dist/client/assets/{decopilot-sse-pool-JfBMouUo.js → decopilot-sse-pool-DVw1gZjG.js} +1 -1
- package/dist/client/assets/{dialog-qy0Z1aJp.js → dialog-BuvuvAYC.js} +1 -1
- package/dist/client/assets/{domain-settings-BAj4VRPx.js → domain-settings-DSbKp6qA.js} +1 -1
- package/dist/client/assets/{drawer-Ba-RJ-Vm.js → drawer-DmEn61SS.js} +1 -1
- package/dist/client/assets/dropdown-menu-Czbd_AJy.js +1 -0
- package/dist/client/assets/{empty-state-jsXC5kwN.js → empty-state-_lAZnBi4.js} +1 -1
- package/dist/client/assets/{extract-connection-data-C4yVX3dU.js → extract-connection-data-CW9bBZne.js} +1 -1
- package/dist/client/assets/file-explorer-BbAtNM55.js +2 -0
- package/dist/client/assets/{file-type-icon-Qndp-c2z.js → file-type-icon-BSfc7Wfg.js} +1 -1
- package/dist/client/assets/{form-YGkaTcsZ.js → form-CHh_Bz9U.js} +1 -1
- package/dist/client/assets/general-Bwm-UhNq.js +1 -0
- package/dist/client/assets/github-icon-C4IsZh8Y.js +1 -0
- package/dist/client/assets/github-repo-picker-C9RaVBvS.js +1 -0
- package/dist/client/assets/{hooks-BQCR9h_s.js → hooks-BBdeXd44.js} +1 -1
- package/dist/client/assets/{index-66BUlUCq.js → index-2iYjeWO7.js} +3 -3
- package/dist/client/assets/{index-CYDZxSyh.js → index-4kWhKkvd.js} +1 -1
- package/dist/client/assets/index-B5o3n9Kb.js +1 -0
- package/dist/client/assets/{index-B069nvZi.js → index-Bn1REJqN.js} +1 -1
- package/dist/client/assets/{index-B_cjnmHp.js → index-BqGmkqxx.js} +1 -1
- package/dist/client/assets/{index-CXN6bmWL.js → index-C5_rudyt.js} +61 -61
- package/dist/client/assets/{index-BlALgPn0.js → index-C9hnclQJ.js} +1 -1
- package/dist/client/assets/{index-w7SC22aY.js → index-D297vbs1.js} +2 -2
- package/dist/client/assets/index-DINrMtim.js +1 -0
- package/dist/client/assets/{index-CP07biT3.js → index-DmDieVAU.js} +1 -1
- package/dist/client/assets/{index-redirect-CCwJiDzA.js → index-redirect-DulA9_vk.js} +1 -1
- package/dist/client/assets/{infra-billing-BMnY0AH9.js → infra-billing-BhAeXe1T.js} +1 -1
- package/dist/client/assets/{input-DSNlRZp-.js → input-D8Zm47Jt.js} +1 -1
- package/dist/client/assets/{integration-icon-DgpBd9x9.js → integration-icon-DF5D8dzf.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-BxVvTBsq.js → invite-member-dialog-DIFWrpMK.js} +1 -1
- package/dist/client/assets/{label-CqOwuXw5.js → label-BXmVgc4R.js} +1 -1
- package/dist/client/assets/{layout-BX1xrGBZ.js → layout-C2umEqat.js} +1 -1
- package/dist/client/assets/{login-CdYcIAH1.js → login-BA5Gn4nV.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CCK0vzqY.js → mcp-oauth-EIjqmOGW.js} +1 -1
- package/dist/client/assets/members-WEbYgK-E.js +1 -0
- package/dist/client/assets/{monaco-editor-doGausTU.js → monaco-editor-CLceT9Kc.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BE0x_Y2T.js → monitoring-stats-row-C1J4-yvD.js} +1 -1
- package/dist/client/assets/{multi-select-CpP6bWVL.js → multi-select-8nHOrqP6.js} +1 -1
- package/dist/client/assets/{oauth-callback-DDLCnMS3.js → oauth-callback-B1gi_QXh.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BdKpH2mQ.js → oauth-callback-ai-provider-BR3jc69B.js} +1 -1
- package/dist/client/assets/{onboarding-BhdMYjwb.js → onboarding-CJb7w2u2.js} +1 -1
- package/dist/client/assets/{org-layout-6Z4I0hHW.js → org-layout-9As--daQ.js} +1 -1
- package/dist/client/assets/{organization-choice-BP7uSM89.js → organization-choice-Dk9tfw5m.js} +1 -1
- package/dist/client/assets/{orgs-Dg1CXVTF.js → orgs-D04LOh9A.js} +1 -1
- package/dist/client/assets/{page-seo-form-CqsF5lXU.js → page-seo-form-CPmgmD8Q.js} +1 -1
- package/dist/client/assets/{popover-B-hxuR7_.js → popover-pV1E5Yae.js} +1 -1
- package/dist/client/assets/post-calendar-BskyHDPL.js +1 -0
- package/dist/client/assets/post-editor--Zt9kpwk.js +1 -0
- package/dist/client/assets/{primitives-DFmC6p_Q.js → primitives-RaFkl2kw.js} +1 -1
- package/dist/client/assets/{profile-Dkr0W5iY.js → profile-DZM1TgC_.js} +1 -1
- package/dist/client/assets/project-app-view-D9hKZwXZ.js +1 -0
- package/dist/client/assets/{prompts-7twTnqOX.js → prompts-BC28h6-t.js} +1 -1
- package/dist/client/assets/record-editor-BK6RtSPc.js +1 -0
- package/dist/client/assets/redirect-editor-BMHZJK5a.js +1 -0
- package/dist/client/assets/registry-C-Y3lVMm.js +2 -0
- package/dist/client/assets/{registry-layout-BKOsGixf.js → registry-layout-CDi54rAy.js} +2 -2
- package/dist/client/assets/{reports-DRMI8_m1.js → reports-BM4wctLR.js} +2 -2
- package/dist/client/assets/{require-capability-NxUQlfkl.js → require-capability-B6_CSUE8.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CHGHhIp4.js → required-auth-layout-CPH_QLZq.js} +1 -1
- package/dist/client/assets/{reset-password-DqdRqc5j.js → reset-password-CKTbNXE2.js} +1 -1
- package/dist/client/assets/review-settings-CvDMhhLj.js +1 -0
- package/dist/client/assets/roles-BBbgP0OS.js +1 -0
- package/dist/client/assets/{scroll-area-5vzmt2fx.js → scroll-area-CrW7xE2P.js} +1 -1
- package/dist/client/assets/{search-input-fSMW29Ha.js → search-input-CUhyYijt.js} +1 -1
- package/dist/client/assets/{secrets-DZUJRYpg.js → secrets-BS5YBU3b.js} +1 -1
- package/dist/client/assets/{sections-editor-dUiZNQ0T.js → sections-editor-B1dtTQTT.js} +2 -2
- package/dist/client/assets/{select-BxxMay64.js → select-BvLYuOCD.js} +1 -1
- package/dist/client/assets/{select-model-3PUtzWOF.js → select-model-DSpI71RT.js} +1 -1
- package/dist/client/assets/self-tool-result-C15mzmUL.js +1 -0
- package/dist/client/assets/seo-editor-Drt9uDgy.js +1 -0
- package/dist/client/assets/{settings-layout-68cErOzo.js → settings-layout-Dw0kRTPi.js} +1 -1
- package/dist/client/assets/{shell-controls-CnzOBK-d.js → shell-controls-DUuG6V04.js} +1 -1
- package/dist/client/assets/{shell-layout-BAPiuVCF.js → shell-layout-DEm7qxZk.js} +1 -1
- package/dist/client/assets/{spinner-5kJIZwhC.js → spinner-Wicci2m_.js} +1 -1
- package/dist/client/assets/{sso-BSgokATe.js → sso-Dc5dEHUK.js} +1 -1
- package/dist/client/assets/{store-BDt4_0eK.js → store-DbIF8Srw.js} +1 -1
- package/dist/client/assets/store-registry-B6ZdpEm_.js +2 -0
- package/dist/client/assets/super-agent-icon-DqHrlyQ5.js +1 -0
- package/dist/client/assets/{switch-DranR37-.js → switch-Bgl3Wxgz.js} +1 -1
- package/dist/client/assets/synced-repos-CxD3U_ap.js +1 -0
- package/dist/client/assets/{tab-id-rV9ba-P7.js → tab-id-B343rgJA.js} +1 -1
- package/dist/client/assets/{table-BaBcwP7i.js → table-DQye_KJa.js} +1 -1
- package/dist/client/assets/{tabs-C4RG823b.js → tabs-BD0mG09G.js} +1 -1
- package/dist/client/assets/{task-board-U9ekmgf6.js → task-board-BrhfV0Xn.js} +1 -1
- package/dist/client/assets/task-filters-D8uPSMj4.js +1 -0
- package/dist/client/assets/tasks-BccmO9V1.js +1 -0
- package/dist/client/assets/{textarea-BJRhlIeX.js → textarea-f884xv9A.js} +1 -1
- package/dist/client/assets/{toggle-group-BjESUsiw.js → toggle-group-Bha-KoNy.js} +1 -1
- package/dist/client/assets/{toolbar-B7xp1f_g.js → toolbar-BK5xyxK4.js} +1 -1
- package/dist/client/assets/{track-CLV6okT5.js → track-BdMpnoYO.js} +1 -1
- package/dist/client/assets/{types-Dptm8vRS.js → types-Dlbctr00.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Dnx2BwXA.js → use-ai-providers-ApFi-RQM.js} +1 -1
- package/dist/client/assets/{use-api-keys-9J2chZIl.js → use-api-keys-JXVd1lCZ.js} +1 -1
- package/dist/client/assets/{use-automations-hHGlxB3Q.js → use-automations-Cleu9yjO.js} +1 -1
- package/dist/client/assets/{use-autosave-CjMVnZ9D.js → use-autosave-BNILGimX.js} +1 -1
- package/dist/client/assets/use-commerce-diagnostic-whzF46SQ.js +1 -0
- package/dist/client/assets/{use-connection-lpB7Ak3D.js → use-connection-C6hvABLD.js} +1 -1
- package/dist/client/assets/{use-copy-cPUcRSDk.js → use-copy-C-tpPcSH.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BE3_FLPI.js → use-create-virtual-mcp-BYzHv7h6.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BTblZwgG.js → use-debounced-autosave-upXMLcwd.js} +1 -1
- package/dist/client/assets/{use-debounced-value-C1RgoEO7.js → use-debounced-value-BZvqBs8z.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BKdVQlWj.js → use-decopilot-events-uN4mE2mp.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D-APxGPc.js → use-delete-connection-DdhDmPIr.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-BaYSlZon.js → use-deployment-admin-b1b5Xb8Z.js} +1 -1
- package/dist/client/assets/{use-file-configs-CwqLdhuz.js → use-file-configs-BTbQBv0E.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll--Ew0plMX.js → use-infinite-scroll-ngbg-f4B.js} +1 -1
- package/dist/client/assets/{use-join-requests-C7H_x6Qk.js → use-join-requests-BCF9SiKI.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-5BY6Nzu_.js → use-mcp-auth-status-WmUL9ybR.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DPpSkRNd.js → use-mcp-client-DjvuKLjH.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BgQkZEa9.js → use-mcp-tools-CxRnxARj.js} +1 -1
- package/dist/client/assets/{use-members-ZgUYxfoN.js → use-members-DYGPMjBz.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BDnGtSYT.js → use-navigate-to-agent-zMgG6J1K.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-s5DfOquz.js → use-org-auth-client-CDziQeOJ.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BVrqXPPs.js → use-org-repo-syncs-BJjI7-Fw.js} +1 -1
- package/dist/client/assets/{use-org-sso-4XYfaR1R.js → use-org-sso-DucjgbBl.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BhSD9m9-.js → use-organization-roles-DwfEId2H.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DyKnNOU1.js → use-organization-settings-DjpZoScC.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CumAXYCD.js → use-registry-connections-25RcS4jV.js} +1 -1
- package/dist/client/assets/{use-secrets-Dv8l4-qt.js → use-secrets-enFOK9gr.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-DNZmvPJ8.js → use-section-preview-base-MCctBdnO.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Lkn4Z7sU.js → use-status-sounds-Dks597jZ.js} +1 -1
- package/dist/client/assets/{use-tags-mKLoUee7.js → use-tags-CPkOatUi.js} +1 -1
- package/dist/client/assets/{use-view-mode-C2aXQ0iB.js → use-view-mode-DmoKnHoh.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CE8tx9or.js → use-virtual-mcp-CcIco7Kt.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-C4QcHYKZ.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CwmI6XzH.js +1 -0
- package/dist/client/assets/{users-B59tCokk.js → users-D_1RV0_X.js} +1 -1
- package/dist/client/assets/variant-calendar-CK-1Nkq7.js +1 -0
- package/dist/client/assets/{view-mode-toggle-D1UCXWa2.js → view-mode-toggle-B-svGARb.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +518 -518
- package/dist/server/server.js +344 -344
- package/package.json +1 -1
- package/dist/client/assets/DotsVertical-DL_xKTby.js +0 -1
- package/dist/client/assets/TrendUp01-CYU0S4zQ.js +0 -1
- package/dist/client/assets/UserSquare-BaeuOy58.js +0 -1
- package/dist/client/assets/agent-icon-Dk522vgR.js +0 -1
- package/dist/client/assets/agents-list-DPxzcA1Q.js +0 -1
- package/dist/client/assets/app-editor-CyR5TnHa.js +0 -1
- package/dist/client/assets/automations-CbhqrSJB.js +0 -1
- package/dist/client/assets/bulk-category-panel-BLG4ug1F.js +0 -1
- package/dist/client/assets/category-editor-CdqRjEq-.js +0 -1
- package/dist/client/assets/choose-editor-Zlcu6_gN.js +0 -1
- package/dist/client/assets/collection-detail-BltlsBDt.js +0 -1
- package/dist/client/assets/commerce-onboarding-CVXvwgis.js +0 -1
- package/dist/client/assets/config-Bhu5kCwB.js +0 -1
- package/dist/client/assets/connection-detail-CdS57-hi.js +0 -1
- package/dist/client/assets/connections-4JE1f-NA.js +0 -1
- package/dist/client/assets/dropdown-menu-U_vACpBP.js +0 -1
- package/dist/client/assets/file-explorer-BQ3uCYfn.js +0 -2
- package/dist/client/assets/general-MN_YuUqq.js +0 -1
- package/dist/client/assets/github-repo-picker-BqSmN9CA.js +0 -1
- package/dist/client/assets/index-BbuG8Jbg.js +0 -1
- package/dist/client/assets/index-BpfHCkMo.js +0 -1
- package/dist/client/assets/members-DArjgHPY.js +0 -1
- package/dist/client/assets/post-calendar-CwOyzayg.js +0 -1
- package/dist/client/assets/post-editor-CMogJsWz.js +0 -1
- package/dist/client/assets/project-app-view-CU0pWUxg.js +0 -1
- package/dist/client/assets/record-editor-B5zgmpPT.js +0 -1
- package/dist/client/assets/redirect-editor-CBQTBNAl.js +0 -1
- package/dist/client/assets/registry-CT7qFX2T.js +0 -2
- package/dist/client/assets/review-settings-hF6_ejz-.js +0 -1
- package/dist/client/assets/roles-DNg-v40Q.js +0 -1
- package/dist/client/assets/self-tool-result-CnLvIY_a.js +0 -1
- package/dist/client/assets/seo-editor-C771IjDu.js +0 -1
- package/dist/client/assets/store-registry-417KFpib.js +0 -2
- package/dist/client/assets/synced-repos-C9zoHXsA.js +0 -1
- package/dist/client/assets/task-key-n93QwSK2.js +0 -1
- package/dist/client/assets/tasks-CLCpAm24.js +0 -1
- package/dist/client/assets/use-commerce-diagnostic-Brb2fqiq.js +0 -1
- package/dist/client/assets/use-task-board-items-DhOTd2ok.js +0 -1
- package/dist/client/assets/useInfiniteQuery-1rU8yXy8.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DiMhuD_T.js +0 -1
- package/dist/client/assets/variant-calendar-C9x2S-wB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as X,H as Ne,o as Ae,p as Ue,e as Pe,ac as Me,t as V,b as oe,r as q,j as t,B as Q,aX as ge,k as Ye,n as te,av as Gs,a8 as Qs,a9 as Ys,ab as Ws,bR as Js,bS as Xs}from"./index-
|
|
1
|
+
import{c as X,H as Ne,o as Ae,p as Ue,e as Pe,ac as Me,t as V,b as oe,r as q,j as t,B as Q,aX as ge,k as Ye,n as te,av as Gs,a8 as Qs,a9 as Ys,ab as Ws,bR as Js,bS as Xs}from"./index-2iYjeWO7.js";import{i as ss,a as ps,t as Zs,c as er,n as tr,b as sr}from"./Tool02-y2Kt_Mle.js";import{i as We}from"./CheckCircle-1al5Y-iY.js";import{s as Ft,b as rr,i as ir,a as nr}from"./Settings02-1WpCazPC.js";import{u as Fe}from"./use-mcp-client-DjvuKLjH.js";import{S as Oe,W as or}from"./constants-dLUUoWH7.js";import{u as hs}from"./useInfiniteQuery-C4QcHYKZ.js";import{B as H}from"./badge-CagNBc4U.js";import{I as je}from"./input-D8Zm47Jt.js";import{D as ft,a as Ie,b as yt,c as jt,j as rs,k as is,i as ar}from"./dropdown-menu-Czbd_AJy.js";import{c as $t,e as zt,a as Je,d as he,b as Ot,T as fe}from"./table-DQye_KJa.js";import{T as lr,a as ns}from"./toggle-group-Bha-KoNy.js";import{u as cr}from"./use-view-mode-DmoKnHoh.js";import{i as Bt}from"./DotsVertical-CWvHeX6p.js";import{i as dr}from"./FilterLines-BoU3nKXE.js";import{i as fs}from"./Globe01-Blrb9QCE.js";import{i as ur}from"./SearchMd-Bhs-AY-t.js";import{e as vt,d as bt,b as Nt,h as Ct,a as wt,c as _t}from"./dialog-BuvuvAYC.js";import{i as st}from"./AlertCircle-CjPPe_Es.js";import{n as mr}from"./Download01-Cpj3pMZO.js";import{i as os}from"./Upload01-zXZzID1Z.js";import{g as ke,w as Pt}from"./metadata-dUsYcpuu.js";import{c as rt,d as it,b as nt,f as ot,g as at,e as lt,a as ct,A as dt}from"./alert-dialog-C2gjYbmU.js";import{s as ut}from"./Trash01-DXi7qmjb.js";import{L as le}from"./label-BXmVgc4R.js";import{S as gr,a as xr,b as pr,c as hr,d as qt}from"./select-BvLYuOCD.js";import{S as Ge}from"./switch-Bgl3Wxgz.js";import{T as Rt}from"./textarea-f884xv9A.js";import{i as fr}from"./ArrowLeft-xVEL6Xri.js";import{b as yr,i as jr,a as vr}from"./XCircle-DP3o1KVc.js";import{t as br}from"./ChevronDown-B_ixPCTO.js";import{n as Nr}from"./ChevronUp-CcbaTGNZ.js";import{C as as}from"./checkbox-CvS4qhxI.js";import{s as ys}from"./Eye-DZppzI4K.js";import{n as Cr}from"./LinkExternal01-CSXhEw69.js";import{u as wr}from"./use-infinite-scroll-ngbg-f4B.js";import{u as Et}from"./use-copy-C-tpPcSH.js";import{i as Lt}from"./Check-D-tWl3Ph.js";import{a as At}from"./Copy01-neaxsIAM.js";import{i as _r}from"./Key01-CBfmNloZ.js";import{s as Pr}from"./Plus-CS3JRZHD.js";import{i as Rr,a as kr}from"./mcp-oauth-EIjqmOGW.js";import{i as Ir}from"./Play-d1wMPqu_.js";import"./auth-CR0_WHnM.js";import"./ChevronRight-C3-hRZ4f.js";import"./Circle-BAeolOWX.js";const Ve="private-registry",Sr=`
|
|
2
2
|
You are an MCP tool tester running automated integration checks.
|
|
3
3
|
|
|
4
4
|
Goal:
|
|
@@ -24,4 +24,4 @@ At the end, provide a concise summary of:
|
|
|
24
24
|
my-mcp-server,My MCP Server,A useful MCP server,https://example.com/mcp,http,ai|tools,productivity,true
|
|
25
25
|
another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function Xr(){const s=new Blob([Jr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(s),r=document.createElement("a");r.href=e,r.download="registry-import-template.csv",r.click(),URL.revokeObjectURL(e)}function Zr(s){const e=X.c(101),{open:r,onOpenChange:i,isImporting:n,onImport:c}=s,l=n===void 0?!1:n,o=oe(),[a,u]=q.useState(null),[d,m]=q.useState(null),[h,g]=q.useState(null),p=q.useRef(null);let x;e[0]!==i?(x=U=>{i(U),U||(u(null),m(null),g(null),p.current&&(p.current.value=""))},e[0]=i,e[1]=x):x=e[1];const f=x;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=async U=>{if(!U)return;g(U.name),m(null);const F=await U.text();u(Wr(F))},e[2]=y):y=e[2];const v=y;let C;e[3]!==c||e[4]!==a?(C=async()=>{if(!a?.items.length)return;const U=await c(a.items);m(U)},e[3]=c,e[4]=a,e[5]=C):C=e[5];const _=C;let b,L,I,R,P,S,E,D,N,k,T;if(e[6]!==h||e[7]!==_||e[8]!==f||e[9]!==d||e[10]!==l||e[11]!==r||e[12]!==a||e[13]!==o){const U=a?.items??[];let F;e[25]!==a?.warnings?(F=a?.warnings??[],e[25]=a?.warnings,e[26]=F):F=e[26];const j=F;let z;e[27]!==j?(z=j.some(ti),e[27]=j,e[28]=z):z=e[28];const K=z,W=d!==null;I=vt,P=r,S=f,L=bt,k="sm:max-w-3xl max-h-[85vh] flex flex-col";let J;e[29]!==o?(J=o("registry.csvImportDialog.title"),e[29]=o,e[30]=J):J=e[30];let ue;e[31]!==J?(ue=t.jsx(Nt,{children:J}),e[31]=J,e[32]=ue):ue=e[32];let ce;e[33]!==o?(ce=o("registry.csvImportDialog.description"),e[33]=o,e[34]=ce):ce=e[34];let se;e[35]!==ce?(se=t.jsx(Ct,{children:ce}),e[35]=ce,e[36]=se):se=e[36],e[37]!==ue||e[38]!==se?(T=t.jsxs(wt,{children:[ue,se]}),e[37]=ue,e[38]=se,e[39]=T):T=e[39];let xe;e[40]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>p.current?.click(),e[40]=xe):xe=e[40];let me;e[41]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx(os,{size:14}),e[41]=me):me=e[41];let ae;e[42]!==h||e[43]!==o?(ae=o(h?"registry.csvImportDialog.changeFile":"registry.csvImportDialog.chooseCsvFile"),e[42]=h,e[43]=o,e[44]=ae):ae=e[44];let re;e[45]!==l||e[46]!==ae?(re=t.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5",onClick:xe,disabled:l,children:[me,ae]}),e[45]=l,e[46]=ae,e[47]=re):re=e[47];let w;e[48]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("input",{ref:p,type:"file",accept:".csv,text/csv",className:"hidden",onChange:ve=>v(ve.target.files?.[0]??null)}),e[48]=w):w=e[48];let B;e[49]!==h?(B=h&&t.jsx("span",{className:"text-sm text-muted-foreground truncate",children:h}),e[49]=h,e[50]=B):B=e[50];let Z;e[51]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx("div",{className:"flex-1"}),e[51]=Z):Z=e[51];let ne;e[52]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(mr,{size:14}),e[52]=ne):ne=e[52];let de;e[53]!==o?(de=o("registry.csvImportDialog.downloadTemplate"),e[53]=o,e[54]=de):de=e[54];let ie;e[55]!==de?(ie=t.jsxs(Q,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:Xr,children:[ne,de]}),e[55]=de,e[56]=ie):ie=e[56];let Se;e[57]!==re||e[58]!==B||e[59]!==ie?(Se=t.jsxs("div",{className:"flex items-center gap-3",children:[re,w,B,Z,ie]}),e[57]=re,e[58]=B,e[59]=ie,e[60]=Se):Se=e[60];let O;e[61]!==o||e[62]!==j?(O=j.length>0&&t.jsx("div",{className:"rounded-lg border border-warning/20 bg-warning/10 p-3 grid gap-1",children:j.map((ve,gt)=>t.jsxs("p",{className:"text-xs text-warning flex items-start gap-1.5",children:[t.jsx(st,{size:12,className:"shrink-0 mt-0.5"}),t.jsxs("span",{children:[ve.line>0&&t.jsx("span",{className:"font-mono text-[10px] mr-1",children:o("registry.csvImportDialog.linePrefix",{line:ve.line})}),ve.message]})]},`${ve.line}-${gt}`))}),e[61]=o,e[62]=j,e[63]=O):O=e[63];const pe=U.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium",children:o("registry.csvImportDialog.preview")}),t.jsx(H,{variant:"secondary",children:o("registry.csvImportDialog.itemsCount",{count:U.length})}),a?.skipped?t.jsx(H,{variant:"outline",className:"text-warning",children:o("registry.csvImportDialog.skippedCount",{count:a.skipped})}):null]}),t.jsx("div",{className:"border rounded-lg overflow-hidden",children:t.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:t.jsxs($t,{children:[t.jsx(zt,{children:t.jsxs(Je,{children:[t.jsx(he,{className:"w-[140px]",children:o("registry.csvImportDialog.tableIdHeader")}),t.jsx(he,{children:o("registry.csvImportDialog.tableTitleHeader")}),t.jsx(he,{children:o("registry.csvImportDialog.tableUrlHeader")}),t.jsx(he,{className:"w-[80px] text-center",children:o("registry.csvImportDialog.tablePublicHeader")}),t.jsx(he,{children:o("registry.csvImportDialog.tableTagsHeader")})]})}),t.jsx(Ot,{children:U.map(ve=>t.jsxs(Je,{children:[t.jsx(fe,{className:"font-mono text-xs",children:ve.id}),t.jsx(fe,{className:"text-sm",children:ve.title}),t.jsx(fe,{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:ve.server.remotes?.[0]?.url??t.jsx("span",{className:"italic",children:o("registry.csvImportDialog.tableNoneValue")})}),t.jsx(fe,{className:"text-center",children:ve.is_public?t.jsx(H,{variant:"secondary",className:"text-[10px] bg-success/10 text-success",children:o("registry.csvImportDialog.tableYesValue")}):t.jsx("span",{className:"text-xs text-muted-foreground",children:o("registry.csvImportDialog.tableNoValue")})}),t.jsx(fe,{className:"text-xs text-muted-foreground",children:(ke(ve._meta)?.tags??[]).join(", ")||"-"})]},ve.id))})]})})})]});let Ce;e[64]!==d||e[65]!==o?(Ce=d&&t.jsxs("div",{className:"rounded-lg border p-3 grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[t.jsx(We,{size:16,className:"text-success"}),o("registry.csvImportDialog.importedCount",{count:d.created})]}),d.errors.length>0&&t.jsx("div",{className:"grid gap-1 mt-1",children:d.errors.map(ei)})]}),e[64]=d,e[65]=o,e[66]=Ce):Ce=e[66];let Re;e[67]!==W||e[68]!==a||e[69]!==o?(Re=!a&&!W&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[t.jsx(os,{size:32,className:"text-muted-foreground/40 mb-3"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:o("registry.csvImportDialog.emptyStateHint")}),t.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Required columns: ",t.jsx("code",{children:"id"}),", ",t.jsx("code",{children:"title"}),". Optional:"," ",t.jsx("code",{children:"description"}),", ",t.jsx("code",{children:"remote_url"}),","," ",t.jsx("code",{children:"remote_type"}),", ",t.jsx("code",{children:"tags"}),","," ",t.jsx("code",{children:"categories"}),", ",t.jsx("code",{children:"is_public"}),"."]}),t.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Use ",t.jsx("code",{children:"|"})," or ",t.jsx("code",{children:";"})," to separate multiple tags/categories within a cell."]})]}),e[67]=W,e[68]=a,e[69]=o,e[70]=Re):Re=e[70],e[71]!==Se||e[72]!==O||e[73]!==pe||e[74]!==Ce||e[75]!==Re?(R=t.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[Se,O,pe,Ce,Re]}),e[71]=Se,e[72]=O,e[73]=pe,e[74]=Ce,e[75]=Re,e[76]=R):R=e[76],b=_t,E="gap-2 sm:gap-0";let $e;e[77]!==f?($e=()=>f(!1),e[77]=f,e[78]=$e):$e=e[78];let ze;e[79]!==W||e[80]!==o?(ze=o(W?"registry.csvImportDialog.doneButton":"registry.csvImportDialog.cancelButton"),e[79]=W,e[80]=o,e[81]=ze):ze=e[81],e[82]!==$e||e[83]!==ze?(D=t.jsx(Q,{variant:"outline",onClick:$e,children:ze}),e[82]=$e,e[83]=ze,e[84]=D):D=e[84],N=!W&&t.jsx(Q,{onClick:_,disabled:l||U.length===0||K,children:l?o("registry.csvImportDialog.importingButton"):o("registry.csvImportDialog.importButton",{count:U.length})}),e[6]=h,e[7]=_,e[8]=f,e[9]=d,e[10]=l,e[11]=r,e[12]=a,e[13]=o,e[14]=b,e[15]=L,e[16]=I,e[17]=R,e[18]=P,e[19]=S,e[20]=E,e[21]=D,e[22]=N,e[23]=k,e[24]=T}else b=e[14],L=e[15],I=e[16],R=e[17],P=e[18],S=e[19],E=e[20],D=e[21],N=e[22],k=e[23],T=e[24];let $;e[85]!==b||e[86]!==E||e[87]!==D||e[88]!==N?($=t.jsxs(b,{className:E,children:[D,N]}),e[85]=b,e[86]=E,e[87]=D,e[88]=N,e[89]=$):$=e[89];let M;e[90]!==L||e[91]!==R||e[92]!==$||e[93]!==k||e[94]!==T?(M=t.jsxs(L,{className:k,children:[T,R,$]}),e[90]=L,e[91]=R,e[92]=$,e[93]=k,e[94]=T,e[95]=M):M=e[95];let A;return e[96]!==I||e[97]!==P||e[98]!==S||e[99]!==M?(A=t.jsx(I,{open:P,onOpenChange:S,children:M}),e[96]=I,e[97]=P,e[98]=S,e[99]=M,e[100]=A):A=e[100],A}function ei(s){return t.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[t.jsx(st,{size:12,className:"shrink-0 mt-0.5"}),t.jsxs("span",{children:[t.jsx("span",{className:"font-mono",children:s.id}),": ",s.error]})]},s.id)}function ti(s){return s.message.startsWith("Missing required column:")}function si(s){const e=X.c(34),{open:r,onOpenChange:i,title:n,isDeleting:c,onConfirm:l}=s,o=c===void 0?!1:c,a=oe();let u;e[0]!==a?(u=a("registry.deleteConfirmDialog.title"),e[0]=a,e[1]=u):u=e[1];let d;e[2]!==u?(d=t.jsx(rt,{children:u}),e[2]=u,e[3]=d):d=e[3];let m;e[4]!==a||e[5]!==n?(m=a("registry.deleteConfirmDialog.description",{title:n}),e[4]=a,e[5]=n,e[6]=m):m=e[6];let h;e[7]!==m?(h=t.jsx(it,{children:m}),e[7]=m,e[8]=h):h=e[8];let g;e[9]!==d||e[10]!==h?(g=t.jsxs(nt,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=g):g=e[11];let p;e[12]!==a?(p=a("registry.deleteConfirmDialog.cancel"),e[12]=a,e[13]=p):p=e[13];let x;e[14]!==o||e[15]!==p?(x=t.jsx(ot,{disabled:o,children:p}),e[14]=o,e[15]=p,e[16]=x):x=e[16];let f;e[17]!==o||e[18]!==a?(f=a(o?"registry.deleteConfirmDialog.deleting":"registry.deleteConfirmDialog.delete"),e[17]=o,e[18]=a,e[19]=f):f=e[19];let y;e[20]!==o||e[21]!==l||e[22]!==f?(y=t.jsx(at,{disabled:o,onClick:l,children:f}),e[20]=o,e[21]=l,e[22]=f,e[23]=y):y=e[23];let v;e[24]!==y||e[25]!==x?(v=t.jsxs(lt,{children:[x,y]}),e[24]=y,e[25]=x,e[26]=v):v=e[26];let C;e[27]!==v||e[28]!==g?(C=t.jsxs(ct,{children:[g,v]}),e[27]=v,e[28]=g,e[29]=C):C=e[29];let _;return e[30]!==i||e[31]!==r||e[32]!==C?(_=t.jsx(dt,{open:r,onOpenChange:i,children:C}),e[30]=i,e[31]=r,e[32]=C,e[33]=_):_=e[33],_}function ri(s){const[e]=s.id.split("/");return e??"provider"}function ii(s){return ke(s._meta)?.tags??[]}function ni(s){return ke(s._meta)?.categories??[]}function oi(s){return s.server?.icons?.[0]?.src??null}function ai(s){const e=X.c(109),{item:r,onEdit:i,onDelete:n,onToggleVerified:c,onToggleOfficial:l}=s,o=oe();let a;e[0]!==r?(a=oi(r),e[0]=r,e[1]=a):a=e[1];const u=a;let d;e[2]!==r._meta?(d=ke(r._meta),e[2]=r._meta,e[3]=d):d=e[3];const m=d,h=m?.verified===!0,g=m?.official===!0;let p;e[4]!==r?(p=[...ii(r),...ni(r)],e[4]=r,e[5]=p):p=e[5];const x=p;let f;e[6]!==x?(f=x.slice(0,3),e[6]=x,e[7]=f):f=e[7];const y=f,v=Math.max(0,x.length-y.length);let C;e[8]!==u||e[9]!==r.title?(C=t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:u?t.jsx("img",{src:u,alt:r.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:r.title.charAt(0).toUpperCase()})}),e[8]=u,e[9]=r.title,e[10]=C):C=e[10];let _;e[11]!==r.title?(_=t.jsx("p",{className:"font-medium truncate",children:r.title}),e[11]=r.title,e[12]=_):_=e[12];let b;e[13]!==r?(b=ri(r),e[13]=r,e[14]=b):b=e[14];let L;e[15]!==b?(L=t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b}),e[15]=b,e[16]=L):L=e[16];let I;e[17]!==r.is_public||e[18]!==o?(I=r.is_public?t.jsxs(H,{variant:"default",className:"gap-1",children:[t.jsx(fs,{size:10}),o("registry.registryItemCard.public")]}):t.jsx(H,{variant:"secondary",children:o("registry.registryItemCard.private")}),e[17]=r.is_public,e[18]=o,e[19]=I):I=e[19];let R;e[20]!==g||e[21]!==o?(R=g&&t.jsxs(H,{variant:"outline",className:"gap-1 text-primary",children:[t.jsx(ss,{size:10}),o("registry.registryItemCard.official")]}),e[20]=g,e[21]=o,e[22]=R):R=e[22];let P;e[23]!==g||e[24]!==h||e[25]!==o?(P=!g&&h&&t.jsxs(H,{variant:"outline",className:"gap-1 text-success",children:[t.jsx(ss,{size:10}),o("registry.registryItemCard.verified")]}),e[23]=g,e[24]=h,e[25]=o,e[26]=P):P=e[26];let S;e[27]!==R||e[28]!==P||e[29]!==L||e[30]!==I?(S=t.jsxs("div",{className:"flex items-center gap-2",children:[L,I,R,P]}),e[27]=R,e[28]=P,e[29]=L,e[30]=I,e[31]=S):S=e[31];let E;e[32]!==S||e[33]!==_?(E=t.jsxs("div",{className:"min-w-0 flex-1",children:[_,S]}),e[32]=S,e[33]=_,e[34]=E):E=e[34];let D;e[35]!==E||e[36]!==C?(D=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[C,E]}),e[35]=E,e[36]=C,e[37]=D):D=e[37];let N;e[38]!==r.title||e[39]!==o?(N=o("registry.registryItemCard.actionsFor",{title:r.title}),e[38]=r.title,e[39]=o,e[40]=N):N=e[40];let k;e[41]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Bt,{size:18}),e[41]=k):k=e[41];let T;e[42]!==N?(T=t.jsx(ft,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":N,children:k})}),e[42]=N,e[43]=T):T=e[43];let $;e[44]!==r||e[45]!==i?($=()=>i(r),e[44]=r,e[45]=i,e[46]=$):$=e[46];let M;e[47]!==o?(M=o("registry.registryItemCard.edit"),e[47]=o,e[48]=M):M=e[48];let A;e[49]!==$||e[50]!==M?(A=t.jsx(Ie,{onClick:$,children:M}),e[49]=$,e[50]=M,e[51]=A):A=e[51];let U;e[52]!==r||e[53]!==c?(U=()=>c(r),e[52]=r,e[53]=c,e[54]=U):U=e[54];let F;e[55]!==h||e[56]!==o?(F=o(h?"registry.registryItemCard.unmarkAsVerified":"registry.registryItemCard.markAsVerified"),e[55]=h,e[56]=o,e[57]=F):F=e[57];let j;e[58]!==U||e[59]!==F?(j=t.jsx(Ie,{onClick:U,children:F}),e[58]=U,e[59]=F,e[60]=j):j=e[60];let z;e[61]!==r||e[62]!==l?(z=()=>l(r),e[61]=r,e[62]=l,e[63]=z):z=e[63];let K;e[64]!==g||e[65]!==o?(K=o(g?"registry.registryItemCard.unmarkAsOfficial":"registry.registryItemCard.markAsOfficial"),e[64]=g,e[65]=o,e[66]=K):K=e[66];let W;e[67]!==z||e[68]!==K?(W=t.jsx(Ie,{onClick:z,children:K}),e[67]=z,e[68]=K,e[69]=W):W=e[69];let J;e[70]!==r||e[71]!==n?(J=()=>n(r),e[70]=r,e[71]=n,e[72]=J):J=e[72];let ue;e[73]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(ut,{size:14}),e[73]=ue):ue=e[73];let ce;e[74]!==o?(ce=o("registry.registryItemCard.delete"),e[74]=o,e[75]=ce):ce=e[75];let se;e[76]!==J||e[77]!==ce?(se=t.jsxs(Ie,{variant:"destructive",onClick:J,children:[ue,ce]}),e[76]=J,e[77]=ce,e[78]=se):se=e[78];let xe;e[79]!==A||e[80]!==j||e[81]!==W||e[82]!==se?(xe=t.jsxs(yt,{align:"end",children:[A,j,W,se]}),e[79]=A,e[80]=j,e[81]=W,e[82]=se,e[83]=xe):xe=e[83];let me;e[84]!==T||e[85]!==xe?(me=t.jsxs(jt,{children:[T,xe]}),e[84]=T,e[85]=xe,e[86]=me):me=e[86];let ae;e[87]!==D||e[88]!==me?(ae=t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[D,me]}),e[87]=D,e[88]=me,e[89]=ae):ae=e[89];let re;e[90]!==r.description||e[91]!==r.server||e[92]!==m?.short_description||e[93]!==o?(re=m?.short_description||r.description||r.server.description||o("registry.registryItemCard.noDescriptionProvided"),e[90]=r.description,e[91]=r.server,e[92]=m?.short_description,e[93]=o,e[94]=re):re=e[94];let w;e[95]!==re?(w=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:re}),e[95]=re,e[96]=w):w=e[96];let B;e[97]!==r.id||e[98]!==y?(B=y.map(ie=>t.jsx(H,{variant:"secondary",children:ie},`${r.id}-badge-${ie}`)),e[97]=r.id,e[98]=y,e[99]=B):B=e[99];let Z;e[100]!==v?(Z=v>0&&t.jsxs(H,{variant:"outline",children:["+",v]}),e[100]=v,e[101]=Z):Z=e[101];let ne;e[102]!==B||e[103]!==Z?(ne=t.jsxs("div",{className:"flex flex-wrap gap-1",children:[B,Z]}),e[102]=B,e[103]=Z,e[104]=ne):ne=e[104];let de;return e[105]!==ae||e[106]!==w||e[107]!==ne?(de=t.jsxs(ge,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[ae,w,ne]}),e[105]=ae,e[106]=w,e[107]=ne,e[108]=de):de=e[108],de}function ws(s){const e=X.c(33),{value:r,onChange:i,onBlur:n,onFileUpload:c,error:l,isUploading:o}=s,a=o===void 0?!1:o,u=oe(),[d,m]=q.useState(!1),[h,g]=q.useState(!1),p=q.useRef(null);let x;e[0]!==a?(x=k=>{k.preventDefault(),a||m(!0)},e[0]=a,e[1]=x):x=e[1];const f=x;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=k=>{k.preventDefault(),m(!1)},e[2]=y):y=e[2];const v=y;let C;e[3]!==a||e[4]!==c?(C=async k=>{if(k.preventDefault(),k.stopPropagation(),m(!1),a)return;const T=k.dataTransfer.files[0];T&&await c(T)},e[3]=a,e[4]=c,e[5]=C):C=e[5];const _=C;let b;e[6]!==a||e[7]!==c?(b=async k=>{const T=k.target.files?.[0];T&&!a&&await c(T),k.target.value=""},e[6]=a,e[7]=c,e[8]=b):b=e[8];const L=b,I=r.length>0;let R;e[9]!==u?(R=u("registry.imageUpload.image"),e[9]=u,e[10]=R):R=e[10];let P;e[11]!==R?(P=t.jsx(le,{children:R}),e[11]=R,e[12]=P):P=e[12];let S;e[13]!==f||e[14]!==_||e[15]!==I||e[16]!==d||e[17]!==a||e[18]!==n||e[19]!==i||e[20]!==h||e[21]!==u||e[22]!==r?(S=I?t.jsx("div",{className:"relative group min-h-[180px] rounded-xl border border-border overflow-hidden bg-muted/10",children:t.jsxs("div",{className:"flex items-center gap-3 p-3 h-full",children:[t.jsx("div",{className:"size-20 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0",children:t.jsx("img",{src:r,alt:u("registry.imageUpload.previewAlt"),className:"w-full h-full object-cover"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>p.current?.click(),disabled:a,children:[t.jsx(Ft,{className:"size-3"}),u("registry.imageUpload.change")]}),t.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{i(""),g(!1)},disabled:a,children:[t.jsx(ut,{className:"size-3"}),u("registry.imageUpload.remove")]})]})]})]})}):a?t.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:[t.jsx(Ye,{className:"size-8 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:u("registry.imageUpload.uploadingImage")})]}):t.jsxs("div",{className:te("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",d?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:f,onDragLeave:v,onDrop:_,onClick:()=>p.current?.click(),children:[t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6 px-4 flex-1",children:[t.jsx("div",{className:te("size-10 rounded-lg flex items-center justify-center transition-colors",d?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:t.jsx(rr,{size:20})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:u(d?"registry.imageUpload.dropImageHere":"registry.imageUpload.clickOrDragToUpload")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:u("registry.imageUpload.supportedFormats")})]})]}),h?t.jsx("div",{className:"border-t border-border px-3 py-2",onClick:li,children:t.jsx(je,{placeholder:u("registry.imageUpload.urlPlaceholder"),value:r,className:"text-xs h-8",onChange:k=>i(k.target.value),onBlur:n})}):t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.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:k=>{k.stopPropagation(),g(!0)},children:[t.jsx(yr,{className:"size-3"}),u("registry.imageUpload.orPasteImageUrl")]})})]}),e[13]=f,e[14]=_,e[15]=I,e[16]=d,e[17]=a,e[18]=n,e[19]=i,e[20]=h,e[21]=u,e[22]=r,e[23]=S):S=e[23];let E;e[24]!==L?(E=t.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:L}),e[24]=L,e[25]=E):E=e[25];let D;e[26]!==l?(D=l&&t.jsx("p",{className:"text-xs text-destructive",children:l}),e[26]=l,e[27]=D):D=e[27];let N;return e[28]!==D||e[29]!==P||e[30]!==S||e[31]!==E?(N=t.jsxs("div",{className:"grid gap-1.5",children:[P,S,E,D]}),e[28]=D,e[29]=P,e[30]=S,e[31]=E,e[32]=N):N=e[32],N}function li(s){return s.stopPropagation()}function _s(){const s=oe(),[e,r]=q.useState("idle"),[i,n]=q.useState(null),c=Me();return{discover:async(a,u)=>{if(!a)return null;r("loading"),n(null);try{const d=await c.call("REGISTRY_DISCOVER_TOOLS",{url:a,type:u==="sse"?"sse":"http"});return d.error?ci(d.error)?(n(d.error),r("auth_required"),null):(n(d.error),r("error"),null):!d.tools||d.tools.length===0?(n(s("registry.discoverTools.noToolsFound")),r("error"),null):(r("success"),d.tools)}catch(d){const m=d instanceof Error?d.message:String(d);return n(m||s("registry.discoverTools.couldNotDiscoverTools")),r("error"),null}},discoverStatus:e,discoverError:i,resetDiscover:()=>{r("idle"),n(null)}}}function ci(s){const e=s.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function di(s){const e=X.c(62),{tools:r,onChange:i,remoteUrl:n,remoteType:c,externalDiscoverStatus:l,externalDiscoverError:o}=s,a=oe(),[u,d]=q.useState(r.length>0),{discover:m,discoverStatus:h,discoverError:g,resetDiscover:p}=_s(),x=l??h,f=o??g;let y;e[0]!==m||e[1]!==i||e[2]!==c||e[3]!==n?(y=async()=>{if(!n)return;const j=await m(n,c??"http");j&&(i(j),d(!0))},e[0]=m,e[1]=i,e[2]=c,e[3]=n,e[4]=y):y=e[4];const v=y;let C;e[5]!==i||e[6]!==p?(C=()=>{i([]),p()},e[5]=i,e[6]=p,e[7]=C):C=e[7];const _=C;let b;e[8]!==u?(b=()=>d(!u),e[8]=u,e[9]=b):b=e[9];let L;e[10]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(ps,{size:14,className:"text-muted-foreground"}),e[10]=L):L=e[10];let I;e[11]!==a?(I=a("registry.toolsEditor.tools"),e[11]=a,e[12]=I):I=e[12];let R;e[13]!==I?(R=t.jsx("span",{children:I}),e[13]=I,e[14]=R):R=e[14];let P;e[15]!==r.length?(P=r.length>0&&t.jsx(H,{variant:"secondary",className:"text-xs px-1.5 py-0",children:r.length}),e[15]=r.length,e[16]=P):P=e[16];let S;e[17]!==u?(S=u?t.jsx(Nr,{size:14,className:"text-muted-foreground"}):t.jsx(br,{size:14,className:"text-muted-foreground"}),e[17]=u,e[18]=S):S=e[18];let E;e[19]!==b||e[20]!==R||e[21]!==P||e[22]!==S?(E=t.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:b,children:[L,R,P,S]}),e[19]=b,e[20]=R,e[21]=P,e[22]=S,e[23]=E):E=e[23];let D;e[24]!==_||e[25]!==a||e[26]!==r.length?(D=r.length>0&&t.jsxs(Q,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:_,children:[t.jsx(ut,{size:12}),a("registry.toolsEditor.clear")]}),e[24]=_,e[25]=a,e[26]=r.length,e[27]=D):D=e[27];let N;e[28]!==x||e[29]!==v||e[30]!==n||e[31]!==a||e[32]!==r.length?(N=n&&t.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 border-success/30 text-success shadow-[0_0_8px_color-mix(in_oklch,var(--success)_30%,transparent)] hover:shadow-[0_0_14px_color-mix(in_oklch,var(--success)_50%,transparent)] hover:border-success/50 transition-all",onClick:v,disabled:x==="loading",children:[x==="loading"?t.jsx(Ye,{size:12,className:"animate-spin"}):t.jsx(Ft,{size:12}),x==="loading"?a("registry.toolsEditor.discovering"):r.length>0?a("registry.toolsEditor.refresh"):a("registry.toolsEditor.autoDiscover")]}),e[28]=x,e[29]=v,e[30]=n,e[31]=a,e[32]=r.length,e[33]=N):N=e[33];let k;e[34]!==D||e[35]!==N?(k=t.jsxs("div",{className:"flex items-center gap-2",children:[D,N]}),e[34]=D,e[35]=N,e[36]=k):k=e[36];let T;e[37]!==k||e[38]!==E?(T=t.jsxs("div",{className:"flex items-center justify-between",children:[E,k]}),e[37]=k,e[38]=E,e[39]=T):T=e[39];let $;e[40]!==x||e[41]!==a||e[42]!==r.length?($=x==="success"&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-success bg-success/10 rounded-lg px-3 py-2",children:[t.jsx(We,{size:14,className:"shrink-0"}),t.jsx("span",{children:a("registry.toolsEditor.discoveredSuccess",{count:r.length})})]}),e[40]=x,e[41]=a,e[42]=r.length,e[43]=$):$=e[43];let M;e[44]!==f||e[45]!==x?(M=x==="error"&&f&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[t.jsx(st,{size:14,className:"shrink-0"}),t.jsx("span",{children:f})]}),e[44]=f,e[45]=x,e[46]=M):M=e[46];let A;e[47]!==u||e[48]!==r?(A=u&&r.length>0&&t.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:r.map(ui)}),e[47]=u,e[48]=r,e[49]=A):A=e[49];let U;e[50]!==x||e[51]!==u||e[52]!==n||e[53]!==a||e[54]!==r.length?(U=u&&r.length===0&&x==="idle"&&t.jsx("p",{className:"text-xs text-muted-foreground px-1",children:a(n?"registry.toolsEditor.emptyHintWithUrl":"registry.toolsEditor.emptyHintWithoutUrl")}),e[50]=x,e[51]=u,e[52]=n,e[53]=a,e[54]=r.length,e[55]=U):U=e[55];let F;return e[56]!==T||e[57]!==$||e[58]!==M||e[59]!==A||e[60]!==U?(F=t.jsxs("div",{className:"space-y-3",children:[T,$,M,A,U]}),e[56]=T,e[57]=$,e[58]=M,e[59]=A,e[60]=U,e[61]=F):F=e[61],F}function ui(s){return t.jsx("div",{className:"flex items-center gap-3 px-3 py-2",children:t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-mono truncate",children:s.name}),s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description})]})},s.name)}function Ps(s){const e=oe(),{org:r}=Ne(),[i,n]=q.useState(!1),l=typeof window<"u"&&window.location.hostname==="localhost"?`${r.id}_dev-assets`:null,o=Fe({connectionId:l??"noop",orgId:r.id,orgSlug:r.slug});return{uploadImage:async(u,d)=>{if(!l)return V.error(e("registry.imageUpload.needsObjectStorageConnection")),null;if(!u.type.startsWith("image/"))return V.error(e("registry.imageUpload.onlyImageFiles")),null;if(u.size>5*1024*1024)return V.error(e("registry.imageUpload.sizeTooLarge")),null;n(!0);try{const m=await o.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:d,contentType:u.type}}),h=m.structuredContent?.url||m.url;if(!h)throw new Error(e("registry.imageUpload.failedToGetPresignedUrl"));const g=await fetch(h,{method:"PUT",body:u,headers:{"Content-Type":u.type}});if(!g.ok)throw new Error(e("registry.imageUpload.uploadFailed",{statusText:g.statusText}));const p=await o.callTool({name:"GET_PRESIGNED_URL",arguments:{key:d,expiresIn:31536e3}}),x=p.structuredContent?.url||p.url;if(!x)throw new Error(e("registry.imageUpload.failedToGetPublicUrl"));return x}catch(m){return console.error("Image upload failed:",m),V.error(m instanceof Error?m.message:e("registry.imageUpload.failedToUpload")),null}finally{n(!1)}},isUploading:i}}const mi=new Set(["http","sse","stdio"]),gi=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,xi=["internal","automation","support","sales","ops","ai"],pi=["productivity","communication","customer-support","development","data","operations"],hi=["registry.registryItemDialog.essentials","registry.registryItemDialog.details","registry.registryItemDialog.advanced"],fi="h-7 text-xs border-success/30 text-success shadow-[0_0_8px_color-mix(in_oklch,var(--success)_30%,transparent)] hover:shadow-[0_0_14px_color-mix(in_oklch,var(--success)_50%,transparent)] hover:border-success/50 transition-all";function us(s){return s.replace(/^https?:\/\//i,"").trim()}function tt(s){const e=s.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function Qe(s){return s.trim().toLowerCase()}function kt(s){return Array.from(new Set(s.map(Qe).filter(e=>e.length>0)))}function Ke(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function yi(s){const e=X.c(5),{current:r}=s,i=oe();let n;e[0]!==r||e[1]!==i?(n=hi.map((l,o)=>{const a=o+1,u=a===r,d=a<r;return t.jsxs("div",{className:"flex items-center gap-1.5",children:[o>0&&t.jsx("div",{className:te("w-4 h-px",d?"bg-primary":"bg-border")}),t.jsxs("div",{className:te("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",u?"bg-primary/10 text-primary font-medium":d?"text-primary":"text-muted-foreground"),children:[t.jsx("span",{className:te("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",u?"bg-primary text-primary-foreground":d?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:a}),t.jsx("span",{className:"hidden sm:inline",children:i(l)})]})]},l)}),e[0]=r,e[1]=i,e[2]=n):n=e[2];let c;return e[3]!==n?(c=t.jsx("div",{className:"flex items-center gap-1.5",children:n}),e[3]=n,e[4]=c):c=e[4],c}function ji(s){const e=X.c(32),{id:r,labelKey:i,values:n,availableOptions:c,placeholderKey:l,onChange:o}=s,a=oe(),[u,d]=q.useState(""),[m,h]=q.useState(!1);let g,p,x,f,y;if(e[0]!==c||e[1]!==r||e[2]!==u||e[3]!==m||e[4]!==i||e[5]!==o||e[6]!==l||e[7]!==a||e[8]!==n){const _=kt(c),b=kt(n),L=new Set(b),I=Qe(u),R=_.filter(M=>!L.has(M)).filter(M=>I?M.includes(I):!0).slice(0,8),P=M=>{const A=Qe(M);!A||L.has(A)||o([...b,A])},S=M=>{o(b.filter(A=>A!==M))},E=()=>{const M=u.split(/[,\n;]/).map(Qe).filter(Boolean);if(M.length===0)return;const A=[...b];for(const U of M)A.includes(U)||A.push(U);o(A),d("")},D=I;f="grid gap-2";let N;e[14]!==i||e[15]!==a?(N=a(i),e[14]=i,e[15]=a,e[16]=N):N=e[16],e[17]!==r||e[18]!==N?(y=t.jsx(le,{htmlFor:r,children:N}),e[17]=r,e[18]=N,e[19]=y):y=e[19],g="relative";let k;e[20]!==r?(k=()=>{const M=document.getElementById(r);M instanceof HTMLInputElement&&M.focus()},e[20]=r,e[21]=k):k=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>h(!0),e[22]=T):T=e[22];let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=M=>d(M.target.value),e[23]=$):$=e[23],p=t.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:k,children:t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[b.map(M=>t.jsxs(H,{variant:"secondary",className:"gap-1",children:[M,t.jsx("button",{type:"button",onClick:A=>{A.preventDefault(),A.stopPropagation(),S(M)},children:t.jsx(Gs,{size:12})})]},`${r}-${M}`)),t.jsx("input",{id:r,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:b.length?"":a(l),value:u,onFocus:T,onBlur:()=>{h(!1),E()},onChange:$,onKeyDown:M=>{if(M.key==="Enter"||M.key===","){M.preventDefault(),E();return}M.key==="Backspace"&&!u&&b.length&&S(b[b.length-1]??"")}})]})}),x=m&&t.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:R.length>0?R.map(M=>t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:bi,onClick:()=>{P(M),d("")},children:M},`${r}-suggestion-${M}`)):D?t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:vi,onClick:()=>{P(D),d("")},children:a("registry.registryItemDialog.createTag",{value:D})}):t.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:a("registry.registryItemDialog.typeToSearchOrCreate")})}),e[0]=c,e[1]=r,e[2]=u,e[3]=m,e[4]=i,e[5]=o,e[6]=l,e[7]=a,e[8]=n,e[9]=g,e[10]=p,e[11]=x,e[12]=f,e[13]=y}else g=e[9],p=e[10],x=e[11],f=e[12],y=e[13];let v;e[24]!==g||e[25]!==p||e[26]!==x?(v=t.jsxs("div",{className:g,children:[p,x]}),e[24]=g,e[25]=p,e[26]=x,e[27]=v):v=e[27];let C;return e[28]!==f||e[29]!==y||e[30]!==v?(C=t.jsxs("div",{className:f,children:[y,v]}),e[28]=f,e[29]=y,e[30]=v,e[31]=C):C=e[31],C}function vi(s){return s.preventDefault()}function bi(s){return s.preventDefault()}function Ni({id:s,value:e,availableOptions:r,onChange:i}){const n=oe(),[c,l]=q.useState(e),[o,a]=q.useState(!1),u=q.useRef(e);u.current!==e&&(u.current=e,l(e));const d=kt([...pi,...r,e]).filter(Boolean),m=Qe(c),h=d.filter(p=>m?p.includes(m):!0).slice(0,8),g=p=>{const x=Qe(p);i(x),l(x),a(!1)};return t.jsxs("div",{className:"grid gap-2",children:[t.jsx(le,{htmlFor:s,children:n("registry.registryItemDialog.category")}),t.jsxs("div",{className:"relative",children:[t.jsx(je,{id:s,className:"h-9 text-sm",placeholder:n("registry.registryItemDialog.selectOrCreateCategory"),value:c,onFocus:()=>{l(e),a(!0)},onBlur:()=>{g(c)},onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),g(c))}}),e&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground hover:text-foreground",onMouseDown:p=>p.preventDefault(),onClick:()=>{i(""),l("")},children:n("registry.registryItemDialog.clear")}),o&&t.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:h.length>0?h.map(p=>t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:x=>x.preventDefault(),onClick:()=>g(p),children:p},`${s}-${p}`)):m?t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:p=>p.preventDefault(),onClick:()=>g(m),children:n("registry.registryItemDialog.createCategory",{value:m})}):t.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:n("registry.registryItemDialog.typeToSearchOrCreate")})})]})]})}function Ci({open:s,onOpenChange:e,item:r,draft:i,availableTags:n=[],availableCategories:c=[],isSubmitting:l=!1,onSubmit:o}){const a=oe(),{org:u}=Ne(),{uploadImage:d,isUploading:m}=Ps(),{discover:h,discoverStatus:g,discoverError:p,resetDiscover:x}=_s(),f=!!r,y=ke(r?._meta),v=ke(i?._meta),C=r?.title??i?.title??"",_=r?.id?.split("/")[0]??i?.id?.split("/")[0]??"",b=r?.description??i?.description??"",L=y?.short_description??v?.short_description??"",I=y?.owner??v?.owner??"",R=r?.server?.repository?.url??i?.server?.repository?.url??"",P=y?.readme??v?.readme??"",S=y?.readme_url??v?.readme_url??"",E=us(r?.server?.remotes?.[0]?.url??i?.server?.remotes?.[0]?.url??""),D=r?.server?.remotes?.[0]?.type??i?.server?.remotes?.[0]?.type??"http",N=y?.tags??v?.tags??[],k=y?.categories?.[0]??v?.categories?.[0]??"",T=r?.server?.icons?.[0]?.src??i?.server?.icons?.[0]?.src??"",$=y?.tools??v?.tools??[],M=r?.is_public??i?.is_public??!1,A=y?.verified??v?.verified??!1,U=y?.official??v?.official??!1,[F,j]=q.useState(1),[z,K]=q.useState(C),[W,J]=q.useState(_),[ue,ce]=q.useState(b),[se,xe]=q.useState(L),[me,ae]=q.useState(I),[re,w]=q.useState(R),[B,Z]=q.useState(P),[ne,de]=q.useState(S),[ie,Se]=q.useState(P?"content":"link"),[O,pe]=q.useState(E),[Ce,Re]=q.useState(D),[$e,ze]=q.useState(N),[ve,gt]=q.useState(k),[Xe,St]=q.useState(T),[De,xt]=q.useState($),[Vt,Gt]=q.useState(M),[Qt,Yt]=q.useState(A),[Wt,Jt]=q.useState(U),[ye,Ze]=q.useState({}),Xt=()=>{j(1),K(C),J(_),ce(b),xe(L),ae(I),w(R),Z(P),de(S),Se(P?"content":"link"),pe(E),Re(D),ze(N),gt(k),St(T),xt($),Gt(M),Yt(A),Jt(U),Ze({}),x(),pt.current="",we.current&&(clearTimeout(we.current),we.current=null)},Ds=async G=>{if(!G)return;const ee=f?r?.id:`${W}/${z}`.toLowerCase(),_e=Ke(ee||"temp"),qe=G.name.split(".").pop()||"png",Ee=`registry/${u.id}/${_e}/icon.${qe}`,Be=await d(G,Ee);Be?(St(Be),Ze(Le=>({...Le,imageUrl:void 0}))):Ze(Le=>({...Le,imageUrl:a("registry.registryItemDialog.failedToUploadImage")}))},we=q.useRef(null),pt=q.useRef(""),Dt=q.useRef(Ce);Dt.current=Ce;const Zt=G=>{!G&&we.current&&(clearTimeout(we.current),we.current=null),e(G),G||Xt()},Ts=async()=>{const G=tt(O);if(!G)return;we.current&&(clearTimeout(we.current),we.current=null),pt.current=G;const ee=await h(G,Dt.current);ee&&xt(ee)},Ms=G=>{we.current&&clearTimeout(we.current);const ee=tt(G);!ee||ee===pt.current||G.includes(".")&&(we.current=setTimeout(async()=>{pt.current=ee;const _e=await h(ee,Dt.current);_e&&xt(_e)},800))},es=G=>{const ee={};if(G===1){const _e=Ke(W),qe=Ke(z),Ee=`${_e}/${qe}`;z.trim()||(ee.title=a("registry.registryItemDialog.nameIsRequired")),f||(_e?qe?gi.test(Ee)||(ee.provider=a("registry.registryItemDialog.useValidIdFormat")):ee.title=a("registry.registryItemDialog.nameMustContainValidCharacters"):ee.provider=a("registry.registryItemDialog.providerIsRequired"));const Be=tt(O),Le=Ce.trim().toLowerCase();if(Le!=="stdio"&&Be)try{const et=new URL(Be);["http:","https:"].includes(et.protocol)||(ee.remoteUrl=a("registry.registryItemDialog.remoteUrlMustBeHttps"))}catch{ee.remoteUrl=a("registry.registryItemDialog.remoteUrlIsInvalid")}if(Le&&!mi.has(Le)&&(ee.remoteType=a("registry.registryItemDialog.remoteTypeMustBe")),Xe.trim()&&!Xe.trim().startsWith("data:image/"))try{const Tt=new URL(Xe.trim());["http:","https:"].includes(Tt.protocol)||(ee.imageUrl=a("registry.registryItemDialog.imageUrlMustBeHttps"))}catch{ee.imageUrl=a("registry.registryItemDialog.imageUrlIsInvalid")}}if(G===2&&(ue.length>1500&&(ee.description=a("registry.registryItemDialog.descriptionMaxLength")),se.trim().length>160&&(ee.shortDescription=a("registry.registryItemDialog.shortDescriptionMaxLength"))),G===3){const _e=ne.trim();if(_e)try{const Ee=new URL(_e);["http:","https:"].includes(Ee.protocol)||(ee.readmeUrl=a("registry.registryItemDialog.readmeUrlMustBeHttps"))}catch{ee.readmeUrl=a("registry.registryItemDialog.readmeUrlIsInvalid")}B.trim().length>5e4&&(ee.readme=a("registry.registryItemDialog.readmeMaxLength"));const qe=re.trim();if(qe)try{const Ee=new URL(qe);["http:","https:"].includes(Ee.protocol)||(ee.repositoryUrl=a("registry.registryItemDialog.repositoryUrlMustBeHttps"))}catch{ee.repositoryUrl=a("registry.registryItemDialog.repositoryUrlIsInvalid")}}return Ze(ee),Object.values(ee).every(_e=>_e===void 0)},qs=()=>{es(F)&&(F===1&&we.current&&(clearTimeout(we.current),we.current=null),F<3&&j(F+1))},Es=()=>{F>1&&j(F-1)},Ls=async()=>{if(!es(3))return;const G=z.trim(),ee=Ke(W),_e=Ke(G),qe=`${ee}/${_e}`,Ee=tt(O),Be=Ce.trim().toLowerCase(),Le=Xe.trim(),et=re.trim(),Tt=se.trim(),$s=B.trim(),zs=ne.trim(),Os=kt($e),Bs=ve?[Qe(ve)]:[],Ks=r?r.server?.name??r.id:"",Hs=(f?Ks:qe).trim(),Mt=ue.trim(),Vs=me.trim(),ts={title:G,description:Mt.length>0?Mt:null,is_public:Vt,_meta:Pt(void 0,{verified:Qt,official:Wt,tags:Os,categories:Bs,short_description:Tt||null,owner:Vs||null,readme:$s||null,readme_url:zs||null,...De.length>0?{tools:De}:{}}),server:{name:Hs,title:G,description:Mt||void 0,icons:Le?[{src:Le}]:[],repository:et?{url:et}:void 0,remotes:Ee?[{type:Be||"http",url:Ee}]:[]}};if(f&&r){await o({id:r.id,data:ts}),e(!1);return}await o({id:qe,...ts}),e(!1),Xt()},As=t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"row-span-2 grid gap-3 content-start",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"registry-item-provider",children:a("registry.registryItemDialog.provider")}),t.jsx(je,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:W,onChange:G=>J(G.target.value),disabled:f}),!f&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[a("registry.registryItemDialog.itemId")," ",t.jsx("span",{className:"font-mono",children:`${Ke(W)||"provider"}/${Ke(z)||"name"}`})]}),ye.provider&&t.jsx("p",{className:"text-xs text-destructive",children:ye.provider})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"registry-item-title",children:a("registry.registryItemDialog.name")}),t.jsx(je,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:z,onChange:G=>K(G.target.value)}),ye.title&&t.jsx("p",{className:"text-xs text-destructive",children:ye.title})]})]}),t.jsx("div",{className:"row-span-2 content-start",children:t.jsx(ws,{value:Xe,onChange:G=>{St(G),Ze(ee=>({...ee,imageUrl:void 0}))},onFileUpload:Ds,error:ye.imageUrl,isUploading:m})}),t.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[t.jsx(le,{htmlFor:"registry-remote-url",children:a("registry.registryItemDialog.remoteUrl")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex-1 flex items-center rounded-xl border border-input px-3",children:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground mr-1",children:"https://"}),t.jsx("input",{id:"registry-remote-url",className:"flex-1 h-9 bg-transparent outline-none text-sm",placeholder:"example.com/mcp",value:O,onChange:G=>{const ee=us(G.target.value);pe(ee),Ms(ee)}})]}),t.jsxs(gr,{value:Ce,onValueChange:Re,children:[t.jsx(xr,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:t.jsx(pr,{placeholder:a("registry.registryItemDialog.type")})}),t.jsxs(hr,{children:[t.jsx(qt,{value:"http",children:"http"}),t.jsx(qt,{value:"sse",children:"sse"}),t.jsx(qt,{value:"stdio",children:"stdio"})]})]})]}),ye.remoteUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ye.remoteUrl}),ye.remoteType&&t.jsx("p",{className:"text-xs text-destructive",children:ye.remoteType})]}),O.trim()&&t.jsxs("div",{className:"col-span-2 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:te(fi,"gap-1.5"),onClick:Ts,disabled:g==="loading",children:[g==="loading"?t.jsx(Ye,{size:12,className:"animate-spin"}):t.jsx(Ft,{size:12}),g==="loading"?a("registry.registryItemDialog.discoveringTools"):De.length>0?a("registry.registryItemDialog.rediscoverTools"):a("registry.registryItemDialog.discoverToolsFromUrl")]}),De.length>0&&g!=="loading"&&t.jsx("span",{className:"text-xs text-muted-foreground",children:a("registry.registryItemDialog.toolsLoaded",{count:De.length.toString()})})]}),g==="success"&&De.length>0&&t.jsxs("div",{className:"rounded-lg border border-success/20 bg-success/10 px-3 py-2 space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-success",children:[t.jsx(We,{size:14,className:"shrink-0"}),t.jsx("span",{className:"font-medium",children:a("registry.registryItemDialog.toolsDiscovered",{count:De.length.toString()})})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[De.slice(0,8).map(G=>t.jsx(H,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:G.name},G.name)),De.length>8&&t.jsx("span",{className:"text-[10px] text-muted-foreground self-center",children:a("registry.registryItemDialog.andMore",{count:(De.length-8).toString()})})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("registry.registryItemDialog.toolsWillEnrich")})]}),g==="auth_required"&&p&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-warning bg-warning/10 border border-warning/20 rounded-lg px-3 py-2",children:[t.jsx(st,{size:14,className:"shrink-0"}),t.jsx("span",{children:a("registry.registryItemDialog.authRequiredMessage")})]}),g==="error"&&p&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[t.jsx(st,{size:14,className:"shrink-0"}),t.jsx("span",{children:p})]})]})]}),Us=t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(le,{htmlFor:"registry-item-short-description",children:a("registry.registryItemDialog.shortDescription")}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[se.length,"/160"]})]}),t.jsx(je,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:a("registry.registryItemDialog.shortSummaryForStoreCard"),value:se,maxLength:160,onChange:G=>xe(G.target.value)}),ye.shortDescription&&t.jsx("p",{className:"text-xs text-destructive",children:ye.shortDescription})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(le,{htmlFor:"registry-item-description",children:a("registry.registryItemDialog.description")}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[ue.length,"/1500"]})]}),t.jsx(Rt,{id:"registry-item-description",className:"text-sm max-h-28 overflow-y-auto resize-none",placeholder:a("registry.registryItemDialog.briefDescription"),rows:2,value:ue,onChange:G=>ce(G.target.value)}),ye.description&&t.jsx("p",{className:"text-xs text-destructive",children:ye.description})]}),t.jsx("div",{className:"border-t border-border"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx("div",{className:"grid content-start gap-2",children:t.jsx(Ni,{id:"registry-category",value:ve,availableOptions:c,onChange:gt})}),t.jsx("div",{className:"grid content-start gap-2",children:t.jsx(ji,{id:"registry-tags",labelKey:"registry.registryItemDialog.tags",values:$e,availableOptions:[...xi,...n],placeholderKey:"registry.registryItemDialog.typeAndPressEnter",onChange:ze})})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(le,{htmlFor:"registry-is-public",className:"text-sm",children:a("registry.registryItemDialog.public")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a("registry.registryItemDialog.makeThisMcpVisible")})]}),t.jsx(Ge,{id:"registry-is-public",checked:Vt,onCheckedChange:Gt})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(le,{htmlFor:"registry-is-verified",className:"text-sm",children:a("registry.registryItemDialog.verified")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a("registry.registryItemDialog.curatedAndApproved")})]}),t.jsx(Ge,{id:"registry-is-verified",checked:Qt,onCheckedChange:Yt})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(le,{htmlFor:"registry-is-official",className:"text-sm",children:a("registry.registryItemDialog.official")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a("registry.registryItemDialog.madeAndHostedByServiceProvider")})]}),t.jsx(Ge,{id:"registry-is-official",checked:Wt,onCheckedChange:Jt})]})]}),Fs=t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"registry-item-owner",children:a("registry.registryItemDialog.ownerOptional")}),t.jsx(je,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:a("registry.registryItemDialog.teamCompanyOrPerson"),value:me,onChange:G=>ae(G.target.value)})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"registry-item-repository-url",children:a("registry.registryItemDialog.repositoryUrlOptional")}),t.jsx(je,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:re,onChange:G=>w(G.target.value)}),ye.repositoryUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ye.repositoryUrl})]})]}),t.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(le,{children:a("registry.registryItemDialog.readme")}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[B.length,"/50000"]})]}),t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:["link","content"].map(G=>t.jsx("button",{type:"button",className:te("px-2.5 py-1 text-xs rounded-md",ie===G?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>Se(G),children:a(G==="link"?"registry.registryItemDialog.link":"registry.registryItemDialog.content")},G))}),ie==="link"&&t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(je,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:ne,onChange:G=>de(G.target.value)}),ye.readmeUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ye.readmeUrl})]}),ie==="content"&&t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(Rt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
|
|
26
26
|
|
|
27
|
-
Describe your MCP here...`,rows:6,value:B,onChange:G=>Z(G.target.value)}),ye.readme&&t.jsx("p",{className:"text-xs text-destructive",children:ye.readme})]})]}),t.jsx(di,{tools:De,onChange:xt,remoteUrl:tt(O)||void 0,remoteType:Ce,externalDiscoverStatus:g,externalDiscoverError:p})]});return t.jsx(vt,{open:s,onOpenChange:Zt,children:t.jsxs(bt,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[t.jsxs(wt,{className:"space-y-3",children:[t.jsx(Nt,{children:a(f?"registry.registryItemDialog.editMcpServer":"registry.registryItemDialog.addMcpServer")}),t.jsx(yi,{current:F}),t.jsxs(Ct,{children:[F===1&&a("registry.registryItemDialog.step1Description"),F===2&&a("registry.registryItemDialog.step2Description"),F===3&&a("registry.registryItemDialog.step3Description")]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[F===1&&As,F===2&&Us,F===3&&Fs]}),t.jsxs(_t,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[t.jsx("div",{children:F>1&&t.jsxs(Q,{variant:"ghost",size:"sm",onClick:Es,children:[t.jsx(fr,{size:14}),a("registry.registryItemDialog.back")]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Q,{variant:"outline",size:"sm",onClick:()=>Zt(!1),disabled:l,children:a("registry.registryItemDialog.cancel")}),F<3?t.jsxs(Q,{size:"sm",onClick:qs,children:[a("registry.registryItemDialog.next"),t.jsx(jr,{size:14})]}):t.jsx(Q,{size:"sm",onClick:Ls,disabled:l,children:a(l?"registry.registryItemDialog.saving":f?"registry.registryItemDialog.saveChanges":"registry.registryItemDialog.create")})]})]})]})})}function ms(s,e){return s.includes(e)?s.filter(r=>r!==e):[...s,e]}function wi(s){return ke(s._meta)?.tags??[]}function _i(s){return ke(s._meta)?.categories??[]}function Pi(s){return s.server?.remotes?.[0]?.url??"-"}function Ri(){const s=oe(),e="h-8",[r,i]=q.useState(""),n=q.useDeferredValue(r),[c,l]=q.useState([]),[o,a]=q.useState([]),[u,d]=q.useState(!1),[m,h]=q.useState(!1),[g,p]=q.useState(null),[x,f]=q.useState(null),[y,v]=cr("private-registry-list","cards"),C=q.useRef(null),_=Ns({search:n,tags:c,categories:o}),b=Fr(),{createMutation:L,updateMutation:I,deleteMutation:R,bulkCreateMutation:P}=Ht(),S=_.data?.pages.flatMap(j=>j.items??[]).filter(Boolean)??[],E=_.data?.pages[0]?.totalCount??S.length,D=c.length>0||o.length>0||n.length>0,N=b.data,k=Array.isArray(N?.tags)?N.tags:[],T=Array.isArray(N?.categories)?N.categories:[],$=j=>{C.current&&(C.current.disconnect(),C.current=null),!(!j||!_.hasNextPage||_.isFetchingNextPage)&&(C.current=new IntersectionObserver(z=>{z[0]?.isIntersecting&&_.hasNextPage&&!_.isFetchingNextPage&&_.fetchNextPage()},{rootMargin:"240px 0px"}),C.current.observe(j))},M=async j=>{try{"data"in j?(await I.mutateAsync(j),V.success(s("registry.registryItemsPage.registryItemUpdated"))):(await L.mutateAsync(j),V.success(s("registry.registryItemsPage.registryItemCreated")))}catch(z){throw V.error(z instanceof Error?z.message:s("registry.registryItemsPage.failedToSaveItem")),z}},A=async j=>{const z=ke(j._meta),K=z?.verified===!0;try{await I.mutateAsync({id:j.id,data:{_meta:Pt(j._meta,{...z,verified:!K})}}),V.success(s(K?"registry.registryItemsPage.removedVerifiedStatus":"registry.registryItemsPage.markedAsVerified"))}catch(W){V.error(W instanceof Error?W.message:s("registry.registryItemsPage.failedToUpdateItem"))}},U=async j=>{const z=ke(j._meta),K=z?.official===!0;try{await I.mutateAsync({id:j.id,data:{_meta:Pt(j._meta,{...z,official:!K})}}),V.success(s(K?"registry.registryItemsPage.removedOfficialStatus":"registry.registryItemsPage.markedAsOfficial"))}catch(W){V.error(W instanceof Error?W.message:s("registry.registryItemsPage.failedToUpdateItem"))}},F=async()=>{if(x)try{await R.mutateAsync(x.id),V.success(s("registry.registryItemsPage.registryItemDeleted")),f(null)}catch(j){V.error(j instanceof Error?j.message:s("registry.registryItemsPage.failedToDeleteItem"))}};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"shrink-0 border-b border-border",children:[t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:s("registry.registryItemsPage.items")}),t.jsx(H,{variant:"secondary",className:"text-xs",children:E})]}),t.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs(Q,{variant:"outline",size:"sm",className:te(e,"gap-1.5"),children:[t.jsx(dr,{size:14}),s("registry.registryItemsPage.filters")]})}),t.jsxs(yt,{align:"end",className:"w-[260px]",children:[t.jsx(rs,{children:s("registry.registryItemsPage.tags")}),k.length>0?k.map(j=>t.jsxs(is,{checked:c.includes(j.value),onCheckedChange:()=>l(z=>ms(z,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ie,{disabled:!0,children:s("registry.registryItemsPage.noTagsAvailable")}),t.jsx(ar,{}),t.jsx(rs,{children:s("registry.registryItemsPage.categories")}),T.length>0?T.map(j=>t.jsxs(is,{checked:o.includes(j.value),onCheckedChange:()=>a(z=>ms(z,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ie,{disabled:!0,children:s("registry.registryItemsPage.noCategoriesAvailable")})]})]}),t.jsxs(lr,{type:"single",value:y,onValueChange:j=>{(j==="cards"||j==="table")&&v(j)},variant:"outline",className:e,children:[t.jsx(ns,{value:"cards","aria-label":s("registry.registryItemsPage.cardsViewAriaLabel"),className:e,children:s("registry.registryItemsPage.cards")}),t.jsx(ns,{value:"table","aria-label":s("registry.registryItemsPage.tableViewAriaLabel"),className:e,children:s("registry.registryItemsPage.table")})]}),t.jsx(Q,{variant:"outline",size:"sm",className:e,onClick:()=>h(!0),children:s("registry.registryItemsPage.importCsv")}),t.jsx(Q,{size:"sm",className:e,onClick:()=>d(!0),children:s("registry.registryItemsPage.addMcpServers")})]})]}),t.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:t.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[t.jsx(ur,{size:16,className:"text-muted-foreground shrink-0"}),t.jsx(je,{value:r,onChange:j=>i(j.target.value),placeholder:s("registry.registryItemsPage.searchPlaceholder"),className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),D&&t.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[c.map(j=>t.jsxs(H,{variant:"default",children:["#",j]},`selected-tag-${j}`)),o.map(j=>t.jsx(H,{variant:"outline",children:j},`selected-category-${j}`)),r.trim()&&t.jsxs(H,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",r]}),t.jsx(Q,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{i(""),l([]),a([])},children:s("registry.registryItemsPage.clearFilters")})]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.length===0?t.jsx("div",{className:"min-h-[320px] rounded-xl border border-dashed border-border flex flex-col items-center justify-center gap-3 p-6 text-center",children:_.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(Ye,{className:"size-5 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:s("registry.registryItemsPage.loadingItems")})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-base font-medium",children:s(D?"registry.registryItemsPage.noItemsFound":"registry.registryItemsPage.noMcpsInRegistry")}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:s(D?"registry.registryItemsPage.tryRemovingFilters":"registry.registryItemsPage.addFirstMcpItem")}),!D&&t.jsx(Q,{size:"lg",onClick:()=>d(!0),children:s("registry.registryItemsPage.addMcpServers")})]})}):y==="cards"?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:S.map(j=>t.jsx(ai,{item:j,onEdit:p,onDelete:f,onToggleVerified:A,onToggleOfficial:U},j.id))}),_.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"border rounded-lg overflow-auto",children:t.jsxs($t,{children:[t.jsx(zt,{children:t.jsxs(Je,{children:[t.jsx(he,{className:"w-[56px]",children:s("registry.registryItemsPage.icon")}),t.jsx(he,{children:s("registry.registryItemsPage.title")}),t.jsx(he,{children:s("registry.registryItemsPage.id")}),t.jsx(he,{children:s("registry.registryItemsPage.tags")}),t.jsx(he,{children:s("registry.registryItemsPage.categories")}),t.jsx(he,{children:s("registry.registryItemsPage.remoteUrl")}),t.jsx(he,{children:s("registry.registryItemsPage.visibility")}),t.jsx(he,{className:"text-right w-[68px]",children:s("registry.registryItemsPage.actions")})]})}),t.jsx(Ot,{children:S.map(j=>t.jsxs(Je,{children:[t.jsx(fe,{children:t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:j.server?.icons?.[0]?.src?t.jsx("img",{src:j.server.icons[0].src,alt:j.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:j.title.charAt(0).toUpperCase()})})}),t.jsx(fe,{children:j.title}),t.jsx(fe,{className:"font-mono",children:j.id}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:wi(j).slice(0,3).map(z=>t.jsx(H,{variant:"outline",children:z},`${j.id}-tag-${z}`))})}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:_i(j).slice(0,3).map(z=>t.jsx(H,{variant:"outline",children:z},`${j.id}-category-${z}`))})}),t.jsx(fe,{children:Pi(j)}),t.jsx(fe,{children:j.is_public?t.jsxs(H,{variant:"default",className:"gap-1",children:[t.jsx(fs,{size:10}),s("registry.registryItemsPage.public")]}):t.jsx(H,{variant:"secondary",children:s("registry.registryItemsPage.private")})}),t.jsx(fe,{className:"text-right",children:t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":s("registry.registryItemsPage.actionsFor",{title:j.title}),children:t.jsx(Bt,{size:18})})}),t.jsxs(yt,{align:"end",children:[t.jsx(Ie,{onClick:()=>p(j),children:s("registry.registryItemsPage.edit")}),t.jsx(Ie,{variant:"destructive",onClick:()=>f(j),children:s("registry.registryItemsPage.delete")})]})]})})]},j.id))})]})}),_.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}),_.isFetchingNextPage&&t.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(Ye,{className:"size-4 animate-spin"}),s("registry.registryItemsPage.loadingMoreItems")]})]}),t.jsx(Ci,{open:u||!!g,onOpenChange:j=>{j||(d(!1),p(null))},item:g,availableTags:k.map(j=>j.value),availableCategories:T.map(j=>j.value),isSubmitting:L.isPending||I.isPending,onSubmit:M},g?.id??"create"),t.jsx(Zr,{open:m,onOpenChange:h,isImporting:P.isPending,onImport:async j=>{try{const z=await P.mutateAsync(j);return V.success(s("registry.registryItemsPage.importedItems",{count:z.created})),z}catch(z){throw V.error(z instanceof Error?z.message:s("registry.registryItemsPage.failedToImportCsv")),z}}}),t.jsx(si,{open:!!x,onOpenChange:j=>{j||f(null)},title:x?.title??x?.id??"",isDeleting:R.isPending,onConfirm:F})]})}const ki=[{value:"pending",labelKey:"registry.registryRequestsPage.statusPending"},{value:"approved",labelKey:"registry.registryRequestsPage.statusApproved"},{value:"rejected",labelKey:"registry.registryRequestsPage.statusRejected"}];function gs(s){const e=new Date(s);return Number.isNaN(e.getTime())?s:e.toLocaleDateString()}function xs(s){return{id:s.requested_id??s.server?.name,title:s.title,description:s.description??"",_meta:s._meta,server:s.server,is_public:!1}}function Ut(s){const e=s.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ht(s){const e=ke(s._meta);return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Ii(){const s=oe(),[e,r]=q.useState("pending"),[i,n]=q.useState("created_at"),[c,l]=q.useState("asc"),[o,a]=q.useState(new Set),[u,d]=q.useState(!1),[m,h]=q.useState("private"),[g,p]=q.useState(!1),[x,f]=q.useState(null),[y,v]=q.useState(null),[C,_]=q.useState(null),[b,L]=q.useState(null),I=ke(b?._meta),[R,P]=q.useState(""),S=zr({status:e,sortBy:i,sortDirection:c}),{reviewMutation:E,deleteMutation:D}=Hr(),{createMutation:N}=Ht(),k=S.data?.pages.flatMap(w=>w.items)??[],T=S.data?.pages[0]?.totalCount??0,$=S.isFetchingNextPage,M=!!S.hasNextPage,A=wr(()=>{S.isFetchingNextPage||S.fetchNextPage()},M,$),U=new Set(k.filter(w=>w.status==="pending").map(w=>w.id)),F=k.filter(w=>U.has(w.id)),j=o.size,z=F.filter(w=>o.has(w.id)),K=k.filter(w=>o.has(w.id)).length,W=F.length>0&&F.every(w=>o.has(w.id)),J=()=>a(new Set),ue=(w,B)=>{a(Z=>{const ne=new Set(Z);return B?ne.add(w):ne.delete(w),ne})},ce=w=>{a(B=>{const Z=new Set(B);return Z.has(w)?Z.delete(w):Z.add(w),Z})},se=()=>{a(w=>{const B=new Set(w);for(const Z of F)B.add(Z.id);return B})},xe=async()=>{const w=y;if(w){v(null),f(w.id);try{await E.mutateAsync({id:w.id,status:"approved",reviewerNotes:void 0});const B=xs(w);await N.mutateAsync({id:B.id,title:B.title,description:B.description,_meta:B._meta,server:B.server,is_public:B.is_public}),V.success(s("registry.registryRequestsPage.requestApprovedAndAdded"))}catch(B){const Z=B instanceof Error?B.message:"Failed to approve request";Z.includes("UNIQUE constraint")||Z.includes("already exists")?V.error(s("registry.registryRequestsPage.itemAlreadyExists")):V.error(Z)}finally{f(null)}}},me=async()=>{if(C)try{await E.mutateAsync({id:C.id,status:"rejected",reviewerNotes:R.trim()||void 0}),V.success(s("registry.registryRequestsPage.requestRejected")),_(null),P("")}catch(w){V.error(w instanceof Error?w.message:"Failed to reject request")}},ae=async w=>{try{await D.mutateAsync(w.id),V.success(s("registry.registryRequestsPage.requestDeleted"))}catch(B){V.error(B instanceof Error?B.message:"Failed to delete request")}},re=async()=>{if(z.length===0||g)return;p(!0),d(!1);let w=0;const B=new Set;for(const ne of z)try{await E.mutateAsync({id:ne.id,status:"approved",reviewerNotes:void 0});const de=xs(ne);await N.mutateAsync({id:de.id,title:de.title,description:de.description,_meta:de._meta,server:de.server,is_public:m==="public"}),w++}catch{B.add(ne.id)}const Z=B.size;w>0&&Z===0?V.success(s("registry.registryRequestsPage.bulkApproveSuccess",{approvedCount:w,bulkVisibility:m})):w>0&&Z>0?V.warning(s("registry.registryRequestsPage.bulkApprovePartial",{approvedCount:w,failedCount:Z})):V.error(s("registry.registryRequestsPage.bulkApproveFailed")),a(B),p(!1)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"shrink-0 border-b border-border",children:t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:s("registry.registryRequestsPage.requestsToPublish")}),t.jsx(H,{variant:"secondary",className:"text-xs",children:T})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:ki.map(w=>t.jsx("button",{type:"button",className:te("px-2.5 py-1 text-xs rounded-md transition-colors",e===w.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r(w.value),onClickCapture:()=>J(),children:s(w.labelKey)},w.value))}),t.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${i}:${c}`,onChange:w=>{const[B,Z]=w.target.value.split(":");n(B),l(Z)},children:[t.jsx("option",{value:"created_at:asc",children:s("registry.registryRequestsPage.sortCreatedOldest")}),t.jsx("option",{value:"created_at:desc",children:s("registry.registryRequestsPage.sortCreatedNewest")}),t.jsx("option",{value:"title:asc",children:s("registry.registryRequestsPage.sortAlphaAZ")}),t.jsx("option",{value:"title:desc",children:s("registry.registryRequestsPage.sortAlphaZA")})]})]})]})}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.isLoading?t.jsx("div",{className:"text-sm text-muted-foreground",children:s("registry.registryRequestsPage.loadingRequests")}):S.isError?t.jsxs("div",{className:"p-8 text-center rounded-lg border border-border",children:[t.jsx("p",{className:"text-sm text-destructive",children:s("registry.registryRequestsPage.failedLoadRequests")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.error instanceof Error?S.error.message:s("registry.registryRequestsPage.unknownError")})]}):k.length===0?t.jsx("div",{className:"p-8 text-center rounded-lg border border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:s(e==="pending"?"registry.registryRequestsPage.noPendingRequests":e==="approved"?"registry.registryRequestsPage.noApprovedRequests":"registry.registryRequestsPage.noRejectedRequests")})}):t.jsxs($t,{children:[t.jsx(zt,{children:t.jsxs(Je,{children:[e==="pending"&&t.jsx(he,{className:"w-10",children:t.jsx(as,{checked:W&&F.length>0,onCheckedChange:w=>{w?se():J()}})}),t.jsx(he,{children:s("registry.registryRequestsPage.columnName")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnRequester")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnTags")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnStatus")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnDate")}),t.jsx(he,{className:"text-right",children:s("registry.registryRequestsPage.columnActions")})]})}),t.jsx(Ot,{children:k.map(w=>{const B=Ut(w),Z=ke(w._meta)?.tags??[],ne=U.has(w.id),de=o.has(w.id);return t.jsxs(Je,{className:te(ne&&"cursor-pointer",de&&"bg-accent/20"),onClick:()=>{ne&&ce(w.id)},children:[e==="pending"&&t.jsx(fe,{children:t.jsx(as,{checked:de,onCheckedChange:ie=>ue(w.id,ie===!0),onClick:ie=>ie.stopPropagation()})}),t.jsx(fe,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:B?t.jsx("img",{src:B,alt:w.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:w.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:w.title}),w.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:w.description})]})]})}),t.jsx(fe,{children:t.jsx("span",{className:"text-sm text-muted-foreground truncate",children:w.requester_name||w.requester_email||"-"})}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:Z.slice(0,3).map(ie=>t.jsx(H,{variant:"secondary",className:"text-[10px]",children:ie},`${w.id}-tag-${ie}`))})}),t.jsx(fe,{children:t.jsx(H,{variant:"secondary",className:"capitalize text-[11px]",children:w.status})}),t.jsx(fe,{children:t.jsx("span",{className:"text-sm text-muted-foreground",children:gs(w.created_at)})}),t.jsx(fe,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsxs(Q,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),L(w)},children:[t.jsx(ys,{size:13}),s("registry.registryRequestsPage.buttonView")]}),ne?t.jsxs(t.Fragment,{children:[t.jsxs(Q,{size:"sm",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),v(w)},disabled:x!==null||g||de,children:[t.jsx(We,{size:13}),x===w.id?s("registry.registryRequestsPage.approving"):s(de?"registry.registryRequestsPage.selected":"registry.registryRequestsPage.buttonApprove")]}),t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),_(w),P("")},disabled:E.isPending,children:[t.jsx(vr,{size:13}),s("registry.registryRequestsPage.buttonReject")]})]}):t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),ae(w)},disabled:D.isPending,children:[t.jsx(ut,{size:13}),s("registry.registryRequestsPage.buttonDelete")]})]})})]},w.id)})})]}),k.length>0&&M?t.jsx("div",{ref:A,className:"h-1 w-full"}):null,$&&k.length>0?t.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:s("registry.registryRequestsPage.loadingMoreRequests")}):null]}),j>0?t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground pr-1",children:s("registry.registryRequestsPage.selectedCount",{selectedCount:j})}),t.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:se,disabled:W,children:s("registry.registryRequestsPage.selectAll")}),t.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J,children:s("registry.registryRequestsPage.clearSelection")}),t.jsxs(Q,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>d(!0),disabled:g,children:[t.jsx(We,{size:13}),s("registry.registryRequestsPage.approveSelected")]})]})}):null,t.jsx(vt,{open:!!b,onOpenChange:w=>{w||L(null)},children:t.jsxs(bt,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[t.jsxs(wt,{children:[t.jsx(Nt,{children:b?.title??s("registry.registryRequestsPage.requestDetails")}),t.jsx(Ct,{children:s("registry.registryRequestsPage.reviewMetadataDescription")})]}),b&&t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[t.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Ut(b)?t.jsx("img",{src:Ut(b)||"",alt:b.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:b.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:b.title}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.server?.name||b.id})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelStatus")}),t.jsx("span",{className:"capitalize",children:b.status})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelSubmitted")}),t.jsx("span",{children:gs(b.created_at)})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelRequester")}),t.jsx("span",{children:b.requester_name||"-"})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelEmail")}),t.jsx("span",{children:b.requester_email||"-"})]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelRemoteURL")}),t.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:b.server?.remotes?.[0]?.url??"-"})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelDescription")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:b.description||s("registry.registryRequestsPage.noDescriptionProvided")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelTags")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(I?.tags??[]).length?(I?.tags??[]).map(w=>t.jsx(H,{variant:"secondary",children:w},`${b.id}-detail-tag-${w}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelCategories")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(I?.categories??[]).length?(I?.categories??[]).map(w=>t.jsx(H,{variant:"secondary",children:w},`${b.id}-detail-category-${w}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelREADME")}),ht(b).hasReadmeContent?t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap max-h-40 overflow-y-auto rounded-md border border-border bg-muted/20 px-2.5 py-2",children:ht(b).readmeContent}):ht(b).hasReadmeLink?t.jsxs("a",{href:ht(b).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:[s("registry.registryRequestsPage.openREADMELink"),t.jsx(Cr,{size:14})]}):t.jsx("span",{className:"text-sm text-muted-foreground",children:s("registry.registryRequestsPage.noREADMEProvided")})]})]}),t.jsx(_t,{children:t.jsx(Q,{variant:"outline",onClick:()=>L(null),children:s("registry.registryRequestsPage.buttonClose")})})]})}),t.jsx(dt,{open:!!y,onOpenChange:w=>{w||v(null)},children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:s("registry.registryRequestsPage.approvePublishRequestTitle")}),t.jsx(it,{children:s("registry.registryRequestsPage.approvePublishRequestDesc",{title:y?.title??""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(at,{onClick:xe,children:s("registry.registryRequestsPage.buttonApprove")})]})]})}),t.jsx(dt,{open:u,onOpenChange:d,children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:s("registry.registryRequestsPage.approveSelectedRequestsTitle")}),t.jsx(it,{children:s("registry.registryRequestsPage.approveSelectedRequestsDesc",{count:z.length})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"bulk-visibility",children:s("registry.registryRequestsPage.visibilityForAll")}),t.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:m,onChange:w=>h(w.target.value),children:[t.jsx("option",{value:"private",children:s("registry.registryRequestsPage.visibilityPrivate")}),t.jsx("option",{value:"public",children:s("registry.registryRequestsPage.visibilityPublic")})]})]}),t.jsxs(lt,{children:[t.jsx(ot,{disabled:g,children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(at,{onClick:re,disabled:g||K===0,children:s(g?"registry.registryRequestsPage.approving":"registry.registryRequestsPage.approveSelected")})]})]})}),t.jsx(vt,{open:!!C,onOpenChange:w=>{w||(_(null),P(""))},children:t.jsxs(bt,{children:[t.jsxs(wt,{children:[t.jsx(Nt,{children:s("registry.registryRequestsPage.rejectPublishRequestTitle")}),t.jsx(Ct,{children:s("registry.registryRequestsPage.rejectPublishRequestDesc")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"reject-notes",children:s("registry.registryRequestsPage.reviewerNotes")}),t.jsx(Rt,{id:"reject-notes",rows:4,value:R,onChange:w=>P(w.target.value),placeholder:s("registry.registryRequestsPage.reasonForRejectionPlaceholder")})]}),t.jsxs(_t,{children:[t.jsx(Q,{variant:"outline",onClick:()=>{_(null),P("")},children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(Q,{onClick:me,disabled:E.isPending,children:E.isPending?s("registry.registryRequestsPage.rejecting"):s("registry.registryRequestsPage.buttonReject")})]})]})})]})}function Si({revealedKey:s,onRevealedKeyChange:e}){const r=oe(),{org:i}=Ne(),{uploadImage:n,isUploading:c}=Ps(),{registryName:l,registryIcon:o,acceptPublishRequests:a,requireApiToken:u,storePrivateOnly:d,rateLimitEnabled:m,rateLimitWindow:h,rateLimitMax:g,isSaving:p,updateConfig:x}=Cs(Ve),[f,y]=q.useState(l),[v,C]=q.useState(l);l!==v&&(C(l),y(l));const[_,b]=q.useState(o),[L,I]=q.useState(o);o!==L&&(I(o),b(o));const[R,P]=q.useState(String(g)),[S,E]=q.useState(g);g!==S&&(E(g),P(String(g)));const D=Vr(),{generateMutation:N,revokeMutation:k}=Gr(),[T,$]=q.useState(""),[M,A]=q.useState(!1),[U,F]=q.useState(null),{handleCopy:j,copied:z}=Et(),{handleCopy:K,copied:W}=Et(),{handleCopy:J,copied:ue}=Et(),ce=Ns({search:"",tags:[],categories:[],limit:50}),se=`${window.location.origin}/org/${i.slug}/registry/mcp`,me=(ce.data?.pages.flatMap(O=>O.items??[])??[]).filter(O=>O.is_public).length,ae=`${window.location.origin}/org/${i.slug}/registry/publish-request`,re=s?.slice(0,12)??null,w=!!(re&&(D.data?.items??[]).some(O=>O.prefix===re)),B=p||c,Z=()=>{const O=f.trim();!O||O===l||x({registryName:O})},ne=()=>{const O=Number.parseInt(R,10),pe=Number.isFinite(O)&&O>=1?O:100;P(String(pe)),pe!==g&&x({rateLimitMax:pe})},de=async O=>{if(!O)return;const pe=O.name.split(".").pop()||"png",Ce=`registry/${i.id}/identity/icon.${pe}`,Re=await n(O,Ce);Re?(b(Re),x({registryIcon:Re})):V.error(r("registry.registrySettingsPage.failedUploadIcon"))},ie=async()=>{const O=T.trim();if(O)try{const pe=await N.mutateAsync(O);pe?.key&&(e(pe.key),A(!1),$(""),V.success(r("registry.registrySettingsPage.apiKeyGenerated")))}catch(pe){V.error(pe instanceof Error?pe.message:r("registry.registrySettingsPage.failedGenerateApiKey"))}},Se=async O=>{try{await k.mutateAsync(O),e(null),F(null),V.success(r("registry.registrySettingsPage.apiKeyRevoked"))}catch(pe){V.error(pe instanceof Error?pe.message:r("registry.registrySettingsPage.failedRevokeApiKey"))}};return t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[t.jsx("div",{className:"grid gap-4 min-w-0 content-start",children:t.jsxs(ge,{className:"min-w-0 p-4 grid gap-4 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.registryIdentity")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.configureNameIcon")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"identity-name",children:r("registry.registrySettingsPage.name")}),t.jsx(je,{id:"identity-name",value:f,onChange:O=>y(O.target.value),onBlur:Z,disabled:B,placeholder:r("registry.registrySettingsPage.namePlaceholder")})]}),t.jsx(ws,{value:_,onChange:b,onBlur:()=>{const O=_.trim();O!==o&&x({registryIcon:O})},onFileUpload:de,isUploading:c})]})}),t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.publicRegistry")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.publicRegistryDescription")})]}),t.jsxs(H,{variant:"secondary",children:[me," ",r(me===1?"registry.registrySettingsPage.publicItem":"registry.registrySettingsPage.publicItems")]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:se}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>j(se),children:z?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]})]}),t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.storeVisibility")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.storeVisibilityDescription")})]}),t.jsx(Ge,{id:"store-private-only",checked:d,onCheckedChange:O=>x({storePrivateOnly:O}),disabled:B})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.storeVisibilityHelp")})]}),t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.publishRequests")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.publishRequestsDescription")})]}),t.jsx(Ge,{id:"accept-publish-requests",checked:a,onCheckedChange:O=>x({acceptPublishRequests:O}),disabled:B})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:ae}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>K(ae),children:W?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(le,{className:"text-sm font-medium",children:r("registry.registrySettingsPage.requireApiToken")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.requireApiTokenHelp")})]}),t.jsx(Ge,{id:"require-api-token",checked:u,onCheckedChange:O=>x({requireApiToken:O}),disabled:B})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(le,{className:"text-sm font-medium",children:r("registry.registrySettingsPage.rateLimit")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.rateLimitHelp")})]}),t.jsx(Ge,{id:"publish-rate-limit",checked:m,onCheckedChange:O=>x({rateLimitEnabled:O}),disabled:B})]}),m&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(le,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:r("registry.registrySettingsPage.maxRequests")}),t.jsx(je,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:R,onChange:O=>P(O.target.value),onBlur:ne,disabled:B,placeholder:r("registry.registrySettingsPage.maxRequestsPlaceholder")})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(le,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:r("registry.registrySettingsPage.window")}),t.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",value:h,onChange:O=>x({rateLimitWindow:O.target.value}),disabled:B,children:[t.jsx("option",{value:"minute",children:r("registry.registrySettingsPage.perMinute")}),t.jsx("option",{value:"hour",children:r("registry.registrySettingsPage.perHour")})]})]})]}),a&&u&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[t.jsx(_r,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:r("registry.registrySettingsPage.apiKeys")})]}),s&&!w&&t.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.newKeyRefreshing")}),t.jsx(je,{readOnly:!0,value:s,className:"h-8 text-xs font-mono bg-background"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs("div",{className:"grid gap-1.5 flex-1",children:[t.jsx(le,{htmlFor:"api-key-name",className:"text-xs",children:r("registry.registrySettingsPage.keyName")}),t.jsx(je,{id:"api-key-name",value:T,onChange:O=>$(O.target.value),placeholder:r("registry.registrySettingsPage.keyNamePlaceholder"),className:"h-8 text-sm"})]}),t.jsxs(Q,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!T.trim()||N.isPending,onClick:ie,children:[N.isPending?t.jsx(Ye,{size:14,className:"animate-spin"}):t.jsx(Pr,{size:14}),r("registry.registrySettingsPage.generate")]})]}),(D.data?.items?.length??0)>0&&t.jsx("div",{className:"grid gap-2",children:D.data?.items?.map(O=>t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[t.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium truncate leading-none",children:O.name}),re===O.prefix?t.jsx(je,{readOnly:!0,value:M?s??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):t.jsx(je,{readOnly:!0,value:`${O.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[re===O.prefix&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>A(pe=>!pe),children:M?t.jsx(ir,{size:14}):t.jsx(ys,{size:14})}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!s,onClick:()=>s&&J(s),children:ue?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:k.isPending,onClick:()=>F({id:O.id,name:O.name}),children:t.jsx(ut,{size:14})})]})]},O.id))})]})]})]})]}),t.jsx(dt,{open:!!U,onOpenChange:O=>{!O&&!k.isPending&&F(null)},children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:r("registry.registrySettingsPage.revokeApiKeyTitle")}),t.jsx(it,{children:r("registry.registrySettingsPage.revokeApiKeyDescription",{keyName:U?.name??""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{disabled:k.isPending,children:r("registry.registrySettingsPage.cancel")}),t.jsx(at,{disabled:!U||k.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>U&&Se(U.id),children:k.isPending?r("registry.registrySettingsPage.revoking"):r("registry.registrySettingsPage.revokeKey")})]})]})})]})}function Di(s){const e=X.c(8),{results:r}=s,i=oe();if(r.length===0){let l;e[0]!==i?(l=i("registry.brokenMcpList.noBrokenMcps"),e[0]=i,e[1]=l):l=e[1];let o;return e[2]!==l?(o=t.jsx(ge,{className:"p-4 text-sm text-muted-foreground text-center",children:l}),e[2]=l,e[3]=o):o=e[3],o}let n;e[4]!==r?(n=r.map(Ti),e[4]=r,e[5]=n):n=e[5];let c;return e[6]!==n?(c=t.jsx("div",{className:"space-y-2",children:n}),e[6]=n,e[7]=c):c=e[7],c}function Ti(s){return t.jsx(Mi,{result:s},s.id)}function Mi(s){const e=X.c(56),{result:r}=s,i=oe(),[n,c]=q.useState(!1);let l;if(e[0]!==n||e[1]!==r.action_taken||e[2]!==r.connection_ok||e[3]!==r.duration_ms||e[4]!==r.error_message||e[5]!==r.id||e[6]!==r.item_title||e[7]!==r.status||e[8]!==r.tool_results||e[9]!==r.tools_listed||e[10]!==i){const o=r.tool_results.filter(Li);let a;e[12]!==n?(a=()=>c(!n),e[12]=n,e[13]=a):a=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-destructive text-sm mt-0.5",children:"✗"}),e[14]=u):u=e[14];let d;e[15]!==r.item_title?(d=t.jsx("h4",{className:"text-sm font-medium truncate",children:r.item_title}),e[15]=r.item_title,e[16]=d):d=e[16];let m;e[17]!==r.status?(m=r.status.replace("_"," "),e[17]=r.status,e[18]=m):m=e[18];let h;e[19]!==m?(h=t.jsx(H,{variant:"destructive",className:"capitalize text-[10px] shrink-0",children:m}),e[19]=m,e[20]=h):h=e[20];let g;e[21]!==d||e[22]!==h?(g=t.jsxs("div",{className:"flex items-center gap-2",children:[d,h]}),e[21]=d,e[22]=h,e[23]=g):g=e[23];let p;e[24]!==i?(p=i("registry.brokenMcpList.connStatus"),e[24]=i,e[25]=p):p=e[25];const x=r.connection_ok?"✓":"✗";let f;e[26]!==p||e[27]!==x?(f=t.jsxs("span",{children:[p,":"," ",x]}),e[26]=p,e[27]=x,e[28]=f):f=e[28];let y;e[29]!==i?(y=i("registry.brokenMcpList.toolsListed"),e[29]=i,e[30]=y):y=e[30];const v=r.tools_listed?"✓":"✗";let C;e[31]!==y||e[32]!==v?(C=t.jsxs("span",{children:[y,":"," ",v]}),e[31]=y,e[32]=v,e[33]=C):C=e[33];let _;e[34]!==r.duration_ms?(_=t.jsxs("span",{children:[r.duration_ms,"ms"]}),e[34]=r.duration_ms,e[35]=_):_=e[35];const b=o.length>0&&t.jsx("span",{className:"text-destructive",children:i("registry.brokenMcpList.toolsFailed",{count:o.length})});let L;e[36]!==r.action_taken?(L=r.action_taken!=="none"&&t.jsx(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:r.action_taken.replace(/_/g," ")}),e[36]=r.action_taken,e[37]=L):L=e[37];let I;e[38]!==f||e[39]!==C||e[40]!==_||e[41]!==b||e[42]!==L?(I=t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[f,C,_,b,L]}),e[38]=f,e[39]=C,e[40]=_,e[41]=b,e[42]=L,e[43]=I):I=e[43];let R;e[44]!==r.error_message?(R=r.error_message&&t.jsx("p",{className:"text-xs text-destructive line-clamp-2",children:r.error_message}),e[44]=r.error_message,e[45]=R):R=e[45];let P;e[46]!==I||e[47]!==R||e[48]!==g?(P=t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[g,I,R]}),e[46]=I,e[47]=R,e[48]=g,e[49]=P):P=e[49];const S=n?"▲":"▼";let E;e[50]!==S?(E=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:S}),e[50]=S,e[51]=E):E=e[51];let D;e[52]!==P||e[53]!==a||e[54]!==E?(D=t.jsxs("button",{type:"button",className:"w-full text-left p-3 flex items-start gap-3 hover:bg-muted/30 transition-colors",onClick:a,children:[u,P,E]}),e[52]=P,e[53]=a,e[54]=E,e[55]=D):D=e[55],l=t.jsxs(ge,{className:"overflow-hidden",children:[D,n&&t.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[r.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.brokenMcpList.fullError")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2.5 py-1.5 whitespace-pre-wrap break-all text-destructive",children:r.error_message})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.connectionLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?i("registry.brokenMcpList.statusOk"):i("registry.brokenMcpList.statusFailed")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.toolsListedLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?i("registry.brokenMcpList.yes"):i("registry.brokenMcpList.no")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.durationLabel")}),t.jsxs("p",{className:"text-xs font-medium",children:[r.duration_ms,"ms"]})]})]}),o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.brokenMcpList.failedToolsHeader",{count:o.length})}),o.map(N=>t.jsxs("div",{className:"rounded border border-destructive/10 bg-destructive/5 px-2.5 py-1.5 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono font-medium text-destructive",children:N.toolName}),t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[N.durationMs,"ms"]})]}),N.error&&t.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-destructive",children:N.error})]},`${r.id}-${N.toolName}`))]}),r.tool_results.length>0&&r.tool_results.some(Ei)&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.brokenMcpList.passingTools")}),t.jsx("div",{className:"flex flex-wrap gap-1",children:r.tool_results.filter(qi).map(N=>t.jsxs(H,{variant:"secondary",className:"text-[10px]",children:["✓ ",N.toolName]},`${r.id}-${N.toolName}-pass`))})]})]})]}),e[0]=n,e[1]=r.action_taken,e[2]=r.connection_ok,e[3]=r.duration_ms,e[4]=r.error_message,e[5]=r.id,e[6]=r.item_title,e[7]=r.status,e[8]=r.tool_results,e[9]=r.tools_listed,e[10]=i,e[11]=l}else l=e[11];return l}function qi(s){return s.success}function Ei(s){return s.success}function Li(s){return!s.success}function Ai(s,e){return s.onFailure!==e.onFailure||s.perMcpTimeoutMs!==e.perMcpTimeoutMs||s.perToolTimeoutMs!==e.perToolTimeoutMs||s.maxAgentSteps!==e.maxAgentSteps||s.testPublicOnly!==e.testPublicOnly||s.testPrivateOnly!==e.testPrivateOnly||s.includePendingRequests!==e.includePendingRequests||(s.agentContext??"")!==(e.agentContext??"")}function Ui(){const s=oe(),{settings:e,saveMutation:r}=vs(),i=q.useRef(e),[n,c]=q.useState(e),[l,o]=q.useState(!1),[a,u]=q.useState(!1);i.current!==e&&(i.current=e,c(e));const d=Ai(n,e),m=g=>{o(!1),c(p=>({...p,...g}))},h=async()=>{const g={...n,agentContext:(n.agentContext??"").trim()};await r.mutateAsync(g),c(g),o(!0),setTimeout(()=>o(!1),3e3)};return t.jsxs(ge,{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:s("registry.monitorConfiguration.qaConfiguration")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("registry.monitorConfiguration.description")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[d&&t.jsx(H,{className:"bg-warning/10 text-warning border-warning/20 text-[10px]",children:s("registry.monitorConfiguration.unsavedChanges")}),l&&t.jsxs(H,{className:"bg-success/10 text-success border-success/20 text-[10px]",children:["✓ ",s("registry.monitorConfiguration.saved")]}),t.jsx(Q,{size:"sm",onClick:h,disabled:r.isPending||!d,children:r.isPending?s("registry.monitorConfiguration.saving"):s("registry.monitorConfiguration.saveSettings")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.onFailureLabel"),hint:s("registry.monitorConfiguration.onFailureHint")}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:n.onFailure,onChange:g=>m({onFailure:g.target.value}),children:[t.jsx("option",{value:"none",children:s("registry.monitorConfiguration.onFailureNone")}),t.jsx("option",{value:"unlisted",children:s("registry.monitorConfiguration.onFailureUnlisted")}),t.jsx("option",{value:"remove_public",children:s("registry.monitorConfiguration.onFailureRemovePublic")}),t.jsx("option",{value:"remove_private",children:s("registry.monitorConfiguration.onFailureRemovePrivate")}),t.jsx("option",{value:"remove_all",children:s("registry.monitorConfiguration.onFailureRemoveAll")})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.testScopeLabel"),hint:s("registry.monitorConfiguration.testScopeHint")}),t.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.testPublicOnly,onChange:g=>m({testPublicOnly:g.target.checked,testPrivateOnly:g.target.checked?!1:n.testPrivateOnly})}),s("registry.monitorConfiguration.publicOnly")]}),t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.testPrivateOnly,onChange:g=>m({testPrivateOnly:g.target.checked,testPublicOnly:g.target.checked?!1:n.testPublicOnly})}),s("registry.monitorConfiguration.privateOnly")]})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.publishRequestsLabel"),hint:s("registry.monitorConfiguration.publishRequestsHint")}),t.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.includePendingRequests,onChange:g=>m({includePendingRequests:g.target.checked})}),s("registry.monitorConfiguration.includePendingRequests")]})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx(He,{label:s("registry.monitorConfiguration.additionalTestContextLabel"),hint:s("registry.monitorConfiguration.additionalTestContextHint")}),t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7",onClick:()=>u(g=>!g),children:[s(a?"registry.monitorConfiguration.hideDefaultPrompt":"registry.monitorConfiguration.viewDefaultPrompt")," ",s("registry.monitorConfiguration.defaultSystemPrompt")]})]}),t.jsx(Rt,{value:n.agentContext??"",onChange:g=>m({agentContext:g.target.value}),placeholder:s("registry.monitorConfiguration.agentContextPlaceholder"),rows:3}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:s("registry.monitorConfiguration.agentContextHelper")}),a&&t.jsx("pre",{className:"text-[11px] bg-muted/50 border border-border rounded px-3 py-2 whitespace-pre-wrap max-h-64 overflow-auto",children:Sr})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.perMcpTimeoutLabel"),hint:s("registry.monitorConfiguration.perMcpTimeoutHint")}),t.jsx(je,{type:"number",value:n.perMcpTimeoutMs,onChange:g=>m({perMcpTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.perToolTimeoutLabel"),hint:s("registry.monitorConfiguration.perToolTimeoutHint")}),t.jsx(je,{type:"number",value:n.perToolTimeoutMs,onChange:g=>m({perToolTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.maxAgentStepsLabel"),hint:s("registry.monitorConfiguration.maxAgentStepsHint")}),t.jsx(je,{type:"number",value:n.maxAgentSteps,onChange:g=>m({maxAgentSteps:Number(g.target.value)}),min:1,max:30})]})]})]})}function He(s){const e=X.c(16),{label:r,hint:i}=s,n=oe();let c;e[0]!==r?(c=t.jsx(le,{children:r}),e[0]=r,e[1]=c):c=e[1];let l;e[2]!==r||e[3]!==n?(l=n("registry.monitorConfiguration.aboutLabel",{label:r}),e[2]=r,e[3]=n,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Zs,{size:14}),e[5]=o):o=e[5];let a;e[6]!==l?(a=t.jsx(Qs,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":l,children:o})}),e[6]=l,e[7]=a):a=e[7];let u;e[8]!==i?(u=t.jsx(Ys,{side:"top",className:"max-w-72",children:i}),e[8]=i,e[9]=u):u=e[9];let d;e[10]!==a||e[11]!==u?(d=t.jsxs(Ws,{children:[a,u]}),e[10]=a,e[11]=u,e[12]=d):d=e[12];let m;return e[13]!==c||e[14]!==d?(m=t.jsxs("div",{className:"flex items-center gap-1.5",children:[c,d]}),e[13]=c,e[14]=d,e[15]=m):m=e[15],m}function Fi(s){switch(s){case"authenticated":return"bg-success/10 text-success border-success/20";case"needs_auth":return"bg-warning/10 text-warning border-warning/20";default:return"bg-muted text-muted-foreground border-border"}}function $i(s,e){switch(s){case"authenticated":return e("registry.monitorConnectionsPanel.authenticated");case"needs_auth":return e("registry.monitorConnectionsPanel.needsAuth");default:return e("registry.monitorConnectionsPanel.notChecked")}}function zi(s){const e=X.c(4),{icon:r,title:i}=s,[n,c]=q.useState(!1);let l;return e[0]!==r||e[1]!==n||e[2]!==i?(l=t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:r&&!n?t.jsx("img",{src:r,alt:i,className:"h-full w-full object-cover",loading:"lazy",onError:()=>c(!0)}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:i.charAt(0).toUpperCase()})}),e[0]=r,e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function Oi({entry:s,onAuthChanged:e,failedToolsCount:r,failedResultCount:i}){const[n,c]=q.useState(!1),[l,o]=q.useState(""),[a,u]=q.useState(!1),d=oe(),m=Er(),{updateMutation:h}=Ht(),{org:g}=Ne(),p=Me(),x=Ue(),f=s.mapping.connection_id,y=s.mapping.auth_status,v=s.item?.title??s.mapping.item_id,C=s.item?.server?.icons?.[0]?.src??null,_=s.item?.is_public??!1,b=s.item?.is_unlisted??!1,L=s.source==="request",I=Ae({queryKey:Y.monitorConnectionAuthProbe(g.id,f),queryFn:async()=>Rr({url:`/api/${g.slug}/mcp/${f}`,token:null,orgId:g.id}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),R=I.data,P=I.isLoading,S=R?.supportsOAuth??!1,E=R?.hasOAuthToken??!1,D=R?.isServerError??!1,N=R?.isAuthenticated??!1,k=D?void 0:R?.error,T=P?"checking":D?"server_error":k?"unreachable":S?N?E?"oauth_connected":"connected":"oauth_available":N?"connected":"token_required",$=()=>{m.mutate({connectionId:f,authStatus:"authenticated"},{onSuccess:()=>{e(),Js(f),x.invalidateQueries({predicate:K=>K.queryKey[1]===Xs&&K.queryKey[3]===f})},onError:K=>V.error(d("registry.monitorConnectionsPanel.failedToSaveAuthStatus",{title:v,error:K instanceof Error?K.message:String(K)}))})},M=async()=>{c(!0);try{const W=(await I.refetch()).data;if(!W){V.error(d("registry.monitorConnectionsPanel.couldNotReachConnection",{title:v}));return}if(W.isAuthenticated){V.success(d("registry.monitorConnectionsPanel.connectionReachable",{title:v}));return}if(W.isServerError){V.error(d("registry.monitorConnectionsPanel.serverErrorConnection",{title:v}));return}if(W.error){V.error(d("registry.monitorConnectionsPanel.connectionUnreachable",{title:v,error:W.error}));return}if(!W.supportsOAuth){V.warning(d("registry.monitorConnectionsPanel.noOAuthSupport",{title:v}));return}V.info(d("registry.monitorConnectionsPanel.openingAuthWindow",{title:v}));const J=await kr({connectionId:f,orgSlug:g.slug,clientName:`MCP Test - ${v}`,timeout:18e4,scope:"offline_access"});if(J.error){V.error(d("registry.monitorConnectionsPanel.oauthFailed",{title:v,error:J.error}));return}if(J.tokenInfo){if(!(await fetch(`/api/${g.slug}/connections/${f}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:J.tokenInfo.accessToken,refreshToken:J.tokenInfo.refreshToken,expiresIn:J.tokenInfo.expiresIn,scope:J.tokenInfo.scope,clientId:J.tokenInfo.clientId,clientSecret:J.tokenInfo.clientSecret,tokenEndpoint:J.tokenInfo.tokenEndpoint})})).ok)if(J.token)await A(J.token);else{V.error(d("registry.monitorConnectionsPanel.failedToSaveOAuthTokens",{title:v}));return}}else J.token&&await A(J.token);V.success(d("registry.monitorConnectionsPanel.connectionAuthenticated",{title:v})),$(),await I.refetch()}catch(K){console.error("[MonitorConnectionsPanel] Auth error:",K),V.error(d("registry.monitorConnectionsPanel.authError",{error:K instanceof Error?K.message:String(K)}))}finally{c(!1)}},A=async K=>{await p.call("COLLECTION_CONNECTIONS_UPDATE",{id:f,data:{connection_token:K}})},U=async()=>{if(!l.trim()){V.error(d("registry.monitorConnectionsPanel.tokenCannotBeEmpty"));return}c(!0);try{await A(l),V.success(d("registry.monitorConnectionsPanel.tokenSaved",{title:v})),u(!1),o(""),$(),await I.refetch()}catch(K){V.error(d("registry.monitorConnectionsPanel.errorSavingToken",{error:K instanceof Error?K.message:String(K)}))}finally{c(!1)}},F=!P&&y==="authenticated"&&!E&&!a&&l.length===0,j=P&&y==="authenticated"&&!a&&l.length===0,z=async K=>{if(L){V.info(d("registry.monitorConnectionsPanel.visibilityOnlyForStore"));return}if(!s.item){V.error(d("registry.monitorConnectionsPanel.registryItemNotFound"));return}try{await h.mutateAsync({id:s.item.id,data:K}),V.success(d("registry.monitorConnectionsPanel.visibilityUpdated")),e()}catch(W){V.error(W instanceof Error?W.message:d("registry.monitorConnectionsPanel.failedToUpdateVisibility"))}};return t.jsxs(ge,{className:"p-3 space-y-3 h-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.jsx(zi,{icon:C,title:v},C??v),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v}),t.jsx("p",{className:"text-xs text-muted-foreground break-all",children:s.remoteUrl??"-"}),t.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[t.jsx(H,{variant:"outline",className:te("text-[10px]",Fi(y)),children:$i(y,d)}),t.jsx(H,{variant:_?"default":"secondary",className:"text-[10px]",children:d(_?"registry.monitorConnectionsPanel.public":"registry.monitorConnectionsPanel.notPublic")}),t.jsx(H,{variant:"outline",className:"text-[10px]",children:d(L?"registry.monitorConnectionsPanel.request":"registry.monitorConnectionsPanel.store")}),t.jsxs(H,{variant:"outline",className:te("text-[10px]",T==="server_error"||T==="unreachable"?"border-destructive/40 text-destructive":T==="oauth_connected"?"border-success/30 text-success":T==="oauth_available"?"border-sky-500/30 text-sky-600":T==="token_required"?"border-warning/30 text-warning":"text-muted-foreground"),children:[T==="checking"&&d("registry.monitorConnectionsPanel.checkingAuth"),T==="server_error"&&d("registry.monitorConnectionsPanel.serverError"),T==="unreachable"&&d("registry.monitorConnectionsPanel.unreachable"),T==="oauth_connected"&&d("registry.monitorConnectionsPanel.oauthConnected"),T==="oauth_available"&&d("registry.monitorConnectionsPanel.oauthAvailable"),T==="token_required"&&d("registry.monitorConnectionsPanel.tokenManualAuth"),T==="connected"&&d("registry.monitorConnectionsPanel.connected")]}),b&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:d("registry.monitorConnectionsPanel.hiddenInPrivate")}),(i>0||r>0)&&t.jsx(H,{variant:"destructive",className:"text-[10px]",children:d("registry.monitorConnectionsPanel.failedCount",{mcpCount:i,toolsCount:r})})]})]})]}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":d("registry.monitorConnectionsPanel.actionsFor",{title:v}),children:t.jsx(Bt,{size:16})})}),t.jsx(yt,{align:"end",children:L?t.jsx(Ie,{disabled:!0,children:d("registry.monitorConnectionsPanel.requestItemNoControls")}):t.jsxs(t.Fragment,{children:[t.jsx(Ie,{onClick:()=>z({is_public:!1}),children:d("registry.monitorConnectionsPanel.hideFromPublicStore")}),t.jsx(Ie,{onClick:()=>z({is_unlisted:!0}),children:d("registry.monitorConnectionsPanel.hideFromPrivateStore")}),t.jsx(Ie,{onClick:()=>z({is_public:!0,is_unlisted:!1}),children:d("registry.monitorConnectionsPanel.showInBothStores")})]})})]})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[S&&t.jsx(Q,{size:"sm",onClick:M,disabled:n,children:n?"...":d(E?"registry.monitorConnectionsPanel.reAuthOAuth":"registry.monitorConnectionsPanel.oauth")}),t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>I.refetch(),disabled:n||P,children:d(P?"registry.monitorConnectionsPanel.checking":"registry.monitorConnectionsPanel.reCheck")})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("registry.monitorConnectionsPanel.tokenApiKeyDescription")}),j?t.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/30 text-muted-foreground text-xs",children:d("registry.monitorConnectionsPanel.checkingAuth")}):F?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/50 text-muted-foreground font-mono text-xs",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>u(!0),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted",title:d("registry.monitorConnectionsPanel.replaceToken"),children:d("registry.monitorConnectionsPanel.edit")})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(je,{type:"password",placeholder:d("registry.monitorConnectionsPanel.pasteApiTokenPlaceholder"),value:l,onChange:K=>o(K.target.value),className:"h-8 text-xs flex-1",onKeyDown:K=>{K.key==="Enter"&&!n&&l.trim()&&U()}}),t.jsx(Q,{size:"sm",className:"h-8 text-xs",onClick:U,disabled:n||!l.trim(),children:d("registry.monitorConnectionsPanel.save")}),t.jsx(Q,{size:"sm",variant:"ghost",className:"h-8 text-xs","aria-label":d("registry.monitorConnectionsPanel.cancelReplaceToken"),onClick:()=>{u(!1),o("")},children:"✕"})]})]})]})}function Bi(){const s=X.c(87),e=oe(),r=js(),n=It("completed").data?.items?.[0],c=mt(n?.id,void 0,n?.status),l=qr(),[o,a]=q.useState("all");let u,d,m,h,g,p;if(s[0]!==r||s[1]!==c.data?.items||s[2]!==o||s[3]!==l||s[4]!==e){const y=r.data?.items??[];let v;s[11]!==c.data?.items?(v=(c.data?.items??[]).reduce(Ki,{}),s[11]=c.data?.items,s[12]=v):v=s[12];const C=v;let _;s[13]!==o?(_=B=>o==="all"?!0:B.source===o,s[13]=o,s[14]=_):_=s[14];const b=y.filter(_);u=ge,g="p-4 space-y-3";let L;s[15]!==e?(L=e("registry.monitorConnectionsPanel.title"),s[15]=e,s[16]=L):L=s[16];let I;s[17]!==L?(I=t.jsx("h3",{className:"text-sm font-semibold",children:L}),s[17]=L,s[18]=I):I=s[18];let R;s[19]!==e?(R=e("registry.monitorConnectionsPanel.description1"),s[19]=e,s[20]=R):R=s[20];let P;s[21]!==R?(P=t.jsx("p",{className:"text-[10px] text-muted-foreground",children:R}),s[21]=R,s[22]=P):P=s[22];let S;s[23]!==e?(S=e("registry.monitorConnectionsPanel.description2"),s[23]=e,s[24]=S):S=s[24];let E;s[25]!==S?(E=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S}),s[25]=S,s[26]=E):E=s[26];let D;s[27]!==e?(D=e("registry.monitorConnectionsPanel.description3"),s[27]=e,s[28]=D):D=s[28];let N;s[29]!==D?(N=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:D}),s[29]=D,s[30]=N):N=s[30];const k=o==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let T;s[31]!==k?(T=te("px-2.5 py-1 text-xs rounded-md transition-colors",k),s[31]=k,s[32]=T):T=s[32];let $;s[33]===Symbol.for("react.memo_cache_sentinel")?($=()=>a("all"),s[33]=$):$=s[33];let M;s[34]!==e?(M=e("registry.monitorConnectionsPanel.filterAll"),s[34]=e,s[35]=M):M=s[35];let A;s[36]!==T||s[37]!==M?(A=t.jsx("button",{type:"button",className:T,onClick:$,children:M}),s[36]=T,s[37]=M,s[38]=A):A=s[38];const U=o==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let F;s[39]!==U?(F=te("px-2.5 py-1 text-xs rounded-md transition-colors",U),s[39]=U,s[40]=F):F=s[40];let j;s[41]===Symbol.for("react.memo_cache_sentinel")?(j=()=>a("store"),s[41]=j):j=s[41];let z;s[42]!==e?(z=e("registry.monitorConnectionsPanel.filterStore"),s[42]=e,s[43]=z):z=s[43];let K;s[44]!==F||s[45]!==z?(K=t.jsx("button",{type:"button",className:F,onClick:j,children:z}),s[44]=F,s[45]=z,s[46]=K):K=s[46];const W=o==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let J;s[47]!==W?(J=te("px-2.5 py-1 text-xs rounded-md transition-colors",W),s[47]=W,s[48]=J):J=s[48];let ue;s[49]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>a("request"),s[49]=ue):ue=s[49];let ce;s[50]!==e?(ce=e("registry.monitorConnectionsPanel.filterRequests"),s[50]=e,s[51]=ce):ce=s[51];let se;s[52]!==J||s[53]!==ce?(se=t.jsx("button",{type:"button",className:J,onClick:ue,children:ce}),s[52]=J,s[53]=ce,s[54]=se):se=s[54];let xe;s[55]!==A||s[56]!==K||s[57]!==se?(xe=t.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[A,K,se]}),s[55]=A,s[56]=K,s[57]=se,s[58]=xe):xe=s[58];let me;s[59]!==P||s[60]!==E||s[61]!==N||s[62]!==xe||s[63]!==I?(me=t.jsxs("div",{children:[I,P,E,N,xe]}),s[59]=P,s[60]=E,s[61]=N,s[62]=xe,s[63]=I,s[64]=me):me=s[64];let ae;s[65]!==l||s[66]!==e?(ae=()=>{l.mutate(void 0,{onSuccess:()=>V.success(e("registry.monitorConnectionsPanel.connectionsSynced")),onError:B=>V.error(e("registry.monitorConnectionsPanel.syncFailed",{error:B.message}))})},s[65]=l,s[66]=e,s[67]=ae):ae=s[67];let re;s[68]!==l.isPending||s[69]!==e?(re=l.isPending?e("registry.monitorConnectionsPanel.syncing"):e("registry.monitorConnectionsPanel.sync"),s[68]=l.isPending,s[69]=e,s[70]=re):re=s[70];let w;s[71]!==l.isPending||s[72]!==ae||s[73]!==re?(w=t.jsx(Q,{size:"sm",variant:"outline",onClick:ae,disabled:l.isPending,children:re}),s[71]=l.isPending,s[72]=ae,s[73]=re,s[74]=w):w=s[74],s[75]!==me||s[76]!==w?(p=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[me,w]}),s[75]=me,s[76]=w,s[77]=p):p=s[77],d="space-y-2",m=r.isLoading?t.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:e("registry.monitorConnectionsPanel.loadingConnections")}):r.isError?t.jsxs("div",{className:"p-8 text-center rounded-lg border border-border",children:[t.jsx("p",{className:"text-sm text-destructive",children:e("registry.monitorConnectionsPanel.loadFailed")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.error instanceof Error?r.error.message:e("registry.monitorConnectionsPanel.unknownError")})]}):b.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:e("registry.monitorConnectionsPanel.noConnectionsForFilter")}),h=!r.isLoading&&!r.isError&&b.length>0&&t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:b.map(B=>{const Z=C[B.mapping.item_id]??{failedTools:0,failedResults:0};return t.jsx(Oi,{entry:B,onAuthChanged:()=>r.refetch(),failedToolsCount:Z.failedTools,failedResultCount:Z.failedResults},B.mapping.id)})}),s[0]=r,s[1]=c.data?.items,s[2]=o,s[3]=l,s[4]=e,s[5]=u,s[6]=d,s[7]=m,s[8]=h,s[9]=g,s[10]=p}else u=s[5],d=s[6],m=s[7],h=s[8],g=s[9],p=s[10];let x;s[78]!==d||s[79]!==m||s[80]!==h?(x=t.jsxs("div",{className:d,children:[m,h]}),s[78]=d,s[79]=m,s[80]=h,s[81]=x):x=s[81];let f;return s[82]!==u||s[83]!==g||s[84]!==p||s[85]!==x?(f=t.jsxs(u,{className:g,children:[p,x]}),s[82]=u,s[83]=g,s[84]=p,s[85]=x,s[86]=f):f=s[86],f}function Ki(s,e){const r=s[e.item_id]??{failedTools:0,failedResults:0},i=e.tool_results.filter(Hi).length;return r.failedTools=r.failedTools+i,(e.status==="failed"||e.status==="error")&&(r.failedResults=r.failedResults+1),s[e.item_id]=r,s}function Hi(s){return!s.success}function Rs(s){switch(s){case"running":return"bg-primary/10 text-primary border-primary/20";case"completed":return"bg-success/10 text-success border-success/20";case"failed":return"bg-destructive/10 text-destructive border-destructive/20";case"cancelled":return"bg-muted text-muted-foreground border-border";case"pending":return"bg-warning/10 text-warning border-warning/20";default:return""}}function ks(s,e){if(!s)return null;const r=e?new Date(e).getTime():Date.now(),i=new Date(s).getTime(),n=r-i;return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function Vi(s){const e=new Map;for(const r of s)e.has(r.toolName)&&e.delete(r.toolName),e.set(r.toolName,r);return Array.from(e.values())}function Is(s){const e=Vi(s),r=e.every(l=>l.outputPreview==="health_check: not called"),i=e.filter(l=>l.outputPreview!=="health_check: not called"),n=i.filter(l=>l.success).length,c=i.filter(l=>!l.success).length;return{latestToolResults:e,realToolTests:i,isHealthCheck:r,passedTools:n,failedTools:c,hasToolTests:i.length>0}}function Gi(s){return s.total_items?Math.min(100,Math.round(s.tested_items/s.total_items*100)):0}function Qi(s){if(!s)return null;const e=s.match(/Not executed tools \((\d+)\/(\d+)\):/i);if(!e)return null;const r=Number(e[2]);return Number.isFinite(r)&&r>=0?r:null}function Yi(s){const e=X.c(45),{result:r,index:i,icon:n}=s,c=oe(),[l,o]=q.useState(!1);let a;if(e[0]!==l||e[1]!==n||e[2]!==i||e[3]!==r.action_taken||e[4]!==r.agent_summary||e[5]!==r.connection_ok||e[6]!==r.duration_ms||e[7]!==r.error_message||e[8]!==r.id||e[9]!==r.item_title||e[10]!==r.status||e[11]!==r.tool_results||e[12]!==r.tools_listed||e[13]!==c){const{latestToolResults:u,realToolTests:d,isHealthCheck:m,passedTools:h,failedTools:g,hasToolTests:p}=Is(r.tool_results),x=d.length;let f;e[15]!==r.agent_summary?(f=Qi(r.agent_summary),e[15]=r.agent_summary,e[16]=f):f=e[16];const y=f,v=Math.max(u.length,y??0),C=v>0?c("registry.monitorDashboard.toolsTestedCount",{tested:x,discovered:v}):c("registry.monitorDashboard.noTools");let _;e[17]!==l?(_=()=>o(!l),e[17]=l,e[18]=_):_=e[18];const b=i+1;let L;e[19]!==b?(L=t.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:b}),e[19]=b,e[20]=L):L=e[20];let I;e[21]!==n||e[22]!==r.item_title?(I=t.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:n?t.jsx("img",{src:n,alt:r.item_title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:r.item_title.charAt(0).toUpperCase()})}),e[21]=n,e[22]=r.item_title,e[23]=I):I=e[23];const R=r.status==="passed"?"text-success":r.status==="needs_auth"?"text-warning":"text-destructive";let P;e[24]!==R?(P=te("shrink-0",R),e[24]=R,e[25]=P):P=e[25];const S=r.status==="passed"?"✓":r.status==="needs_auth"?"🔑":"✗";let E;e[26]!==P||e[27]!==S?(E=t.jsx("span",{className:P,children:S}),e[26]=P,e[27]=S,e[28]=E):E=e[28];let D;e[29]!==r.item_title?(D=t.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:r.item_title}),e[29]=r.item_title,e[30]=D):D=e[30];let N;e[31]!==r.duration_ms?(N=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[r.duration_ms,"ms"]}),e[31]=r.duration_ms,e[32]=N):N=e[32];const k=r.status==="passed"?"text-success border-success/20":r.status==="needs_auth"?"text-warning border-warning/20":"text-destructive border-destructive/20";let T;e[33]!==k?(T=te("text-[9px] capitalize shrink-0",k),e[33]=k,e[34]=T):T=e[34];let $;e[35]!==r.status?($=r.status.replace("_"," "),e[35]=r.status,e[36]=$):$=e[36];let M;e[37]!==T||e[38]!==$?(M=t.jsx(H,{variant:"outline",className:T,children:$}),e[37]=T,e[38]=$,e[39]=M):M=e[39];let A;e[40]!==r.connection_ok||e[41]!==c?(A=r.connection_ok?t.jsx("span",{className:"text-[10px] text-success shrink-0",title:c("registry.monitorDashboard.connOkTitle"),children:"conn✓"}):t.jsx("span",{className:"text-[10px] text-destructive shrink-0",title:c("registry.monitorDashboard.connFailTitle"),children:"conn✗"}),e[40]=r.connection_ok,e[41]=c,e[42]=A):A=e[42];const U=l?"▲":"▼";let F;e[43]!==U?(F=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:U}),e[43]=U,e[44]=F):F=e[44],a=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[t.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors",onClick:_,children:[L,I,E,D,N,M,A,r.tools_listed&&t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-success",children:[h,"✓"]})," ",t.jsxs("span",{className:te(g>0?"text-destructive":""),children:[g,"✗"]})]}):m&&u.length>0?t.jsx("span",{children:c("registry.monitorDashboard.toolsFoundCount",{count:u.length})}):c("registry.monitorDashboard.noToolsLabel")}),t.jsx(H,{variant:"outline",className:"text-[9px] shrink-0",children:C}),F]}),l&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[r.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:c("registry.monitorDashboard.errorLabel")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-destructive max-h-20 overflow-auto",children:r.error_message})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[t.jsxs("span",{children:[c("registry.monitorDashboard.connectionLabel")," ",t.jsx("span",{className:te(r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?c("registry.monitorDashboard.statusOk"):c("registry.monitorDashboard.statusFailed")})]}),t.jsxs("span",{children:[c("registry.monitorDashboard.toolsListedLabel")," ",t.jsx("span",{className:te(r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?c("registry.monitorDashboard.yes"):c("registry.monitorDashboard.no")})]}),r.action_taken!=="none"&&t.jsxs(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",r.action_taken]})]}),p?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:c("registry.monitorDashboard.toolsTestedDetails",{passed:h,failed:g})}),t.jsx("div",{className:"space-y-0.5",children:d.map((j,z)=>t.jsx(Wi,{tool:j},`${r.id}-${j.toolName}-${z}`))})]}):m&&u.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:c("registry.monitorDashboard.toolsDiscoveredHealthCheck",{count:u.length})}),t.jsx("div",{className:"flex flex-wrap gap-1",children:u.map((j,z)=>t.jsx(H,{variant:"outline",className:"text-[10px] font-mono",children:j.toolName},`${r.id}-${j.toolName}-${z}`))})]}):r.tools_listed?t.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:c("registry.monitorDashboard.noToolsFound")}):null,r.agent_summary&&t.jsx("p",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5",children:r.agent_summary})]})]}),e[0]=l,e[1]=n,e[2]=i,e[3]=r.action_taken,e[4]=r.agent_summary,e[5]=r.connection_ok,e[6]=r.duration_ms,e[7]=r.error_message,e[8]=r.id,e[9]=r.item_title,e[10]=r.status,e[11]=r.tool_results,e[12]=r.tools_listed,e[13]=c,e[14]=a}else a=e[14];return a}function Wi(s){const e=X.c(31),{tool:r}=s,i=oe(),[n,c]=q.useState(!1);let l;e[0]!==n?(l=()=>c(!n),e[0]=n,e[1]=l):l=e[1];const o=r.success?"text-success":"text-destructive";let a;e[2]!==o?(a=te("font-bold",o),e[2]=o,e[3]=a):a=e[3];const u=r.success?"✓":"✗";let d;e[4]!==a||e[5]!==u?(d=t.jsx("span",{className:a,children:u}),e[4]=a,e[5]=u,e[6]=d):d=e[6];let m;e[7]!==r.toolName?(m=t.jsx("span",{className:"font-mono truncate flex-1",children:r.toolName}),e[7]=r.toolName,e[8]=m):m=e[8];let h;e[9]!==r.durationMs?(h=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[r.durationMs,"ms"]}),e[9]=r.durationMs,e[10]=h):h=e[10];let g;e[11]!==r.error?(g=r.error&&t.jsx("span",{className:"text-destructive truncate max-w-28",title:r.error,children:r.error}),e[11]=r.error,e[12]=g):g=e[12];const p=n?"▲":"▼";let x;e[13]!==p?(x=t.jsx("span",{className:"text-muted-foreground",children:p}),e[13]=p,e[14]=x):x=e[14];let f;e[15]!==l||e[16]!==x||e[17]!==d||e[18]!==m||e[19]!==h||e[20]!==g?(f=t.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1 text-[11px] hover:bg-muted/30 transition-colors",onClick:l,children:[d,m,h,g,x]}),e[15]=l,e[16]=x,e[17]=d,e[18]=m,e[19]=h,e[20]=g,e[21]=f):f=e[21];let y;e[22]!==n||e[23]!==i||e[24]!==r.error||e[25]!==r.input||e[26]!==r.outputPreview?(y=n&&t.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[r.error&&t.jsx("pre",{className:"bg-destructive/5 border border-destructive/10 rounded px-2 py-1 whitespace-pre-wrap break-all text-destructive max-h-20 overflow-auto",children:r.error}),r.input&&Object.keys(r.input).length>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorDashboard.inputLabel")}),t.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:JSON.stringify(r.input,null,2)})]}),r.outputPreview&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorDashboard.outputLabel")}),t.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:r.outputPreview})]})]}),e[22]=n,e[23]=i,e[24]=r.error,e[25]=r.input,e[26]=r.outputPreview,e[27]=y):y=e[27];let v;return e[28]!==f||e[29]!==y?(v=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[f,y]}),e[28]=f,e[29]=y,e[30]=v):v=e[30],v}function Ji({activeRunId:s,onRunChange:e}){const r=oe(),{settings:i}=vs(),[n,c]=q.useState(null),[l,o]=q.useState(!1),a=q.useRef(0),u=q.useRef(null),d=Dr(),m=Tr(),h=Kt(s),g=It(),p=js(),x=h.data?.run??null,f=x?.status,y=x?.config_snapshot?.monitorMode??x?.config_snapshot?.testMode,v=mt(s,void 0,f),C=(g.data?.items??[]).find(N=>N.status==="running"),_=g.data?.items?.[0]?.id;!s&&_&&u.current!==_&&(u.current=_,queueMicrotask(()=>{e(_)}));const b=async()=>{const N=Date.now();if(N-a.current<1e3)return;a.current=N;const k=n??i.monitorMode,T=await d.mutateAsync({...i,monitorMode:k});e(T.run.id)},L=async()=>{if(C&&C.id!==s&&C.status==="running"){o(!0);return}await b()},I=async()=>{s&&await m.mutateAsync(s)},R=x?.status==="running",P=x?ks(x.started_at,x.finished_at):null,S=v.data?.items??[],E=(p.data?.items??[]).reduce((N,k)=>(N[k.mapping.item_id]=k.item?.server?.icons?.[0]?.src??null,N),{}),D=n??i.monitorMode;return t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs(ge,{className:"p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:r("registry.monitorDashboard.currentQaRunTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.currentQaRunDescription")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[C&&C.id!==s&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.runInProgressBadge",{runId:C.id.slice(0,8)})}),t.jsxs(Q,{size:"sm",onClick:L,disabled:d.isPending||R,className:"gap-1.5",children:[t.jsx(Ir,{size:14}),d.isPending?r("registry.monitorDashboard.startingButton"):C&&C.id!==s?r("registry.monitorDashboard.startAnotherRunButton"):r("registry.monitorDashboard.startQaRunButton")]}),t.jsxs(Q,{size:"sm",variant:"outline",onClick:I,disabled:!s||!R,className:"gap-1.5",children:[t.jsx(er,{size:14}),r("registry.monitorDashboard.cancelButton")]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaModeLabel")}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:D,onChange:N=>c(N.target.value),disabled:R,children:[t.jsx("option",{value:"health_check",children:r("registry.monitorDashboard.modeHealthCheck")}),t.jsx("option",{value:"tool_call",children:r("registry.monitorDashboard.modeToolCall")}),t.jsx("option",{value:"full_agent",children:r("registry.monitorDashboard.modeAgentic")})]})]}),t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaRunHistoryLabel")}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:s??"",onChange:N=>e(N.target.value||void 0),children:[t.jsx("option",{value:"",children:r("registry.monitorDashboard.autoSelectLatestRun")}),(g.data?.items??[]).map(N=>t.jsxs("option",{value:N.id,children:[new Date(N.created_at).toLocaleString()," -"," ",N.status]},N.id))]})]})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:r(D==="health_check"?"registry.monitorDashboard.modeDescriptionHealthCheck":D==="tool_call"?"registry.monitorDashboard.modeDescriptionToolCall":"registry.monitorDashboard.modeDescriptionAgentic")}),x?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsx(H,{className:te("capitalize",Rs(x.status),x.status==="running"?"animate-pulse":""),children:x.status}),t.jsx("span",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.itemsTestedCount",{tested:x.tested_items,total:x.total_items})}),P&&t.jsx("span",{className:"text-xs text-muted-foreground",children:P}),R&&x.current_item_id&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:[r("registry.monitorDashboard.qaOnLabel")," ",t.jsx("span",{className:"font-mono",children:x.current_item_id})]})]}),t.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:t.jsx("div",{className:te("h-full transition-all duration-500",x.failed_items>0?"bg-warning":"bg-success",R?"animate-pulse":""),style:{width:`${Gi(x)}%`}})}),t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-success",children:r("registry.monitorDashboard.passedLabel")}),t.jsx("p",{className:"text-lg font-bold text-success",children:x.passed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-destructive",children:r("registry.monitorDashboard.failedLabel")}),t.jsx("p",{className:"text-lg font-bold text-destructive",children:x.failed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:r("registry.monitorDashboard.skippedLabel")}),t.jsx("p",{className:"text-lg font-bold",children:x.skipped_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:r("registry.monitorDashboard.totalLabel")}),t.jsx("p",{className:"text-lg font-bold",children:x.total_items})]})]})]}):t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.noRunSelectedMessage")})]}),t.jsxs(ge,{className:"p-4 space-y-2 min-h-[360px]",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:r("registry.monitorDashboard.qaResultsLogTitle",{count:S.length})}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaResultsLogDescription")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[R&&t.jsx(H,{className:"bg-primary/10 text-primary border-primary/20 animate-pulse",children:r("registry.monitorDashboard.runInProgressLabel")}),x&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.progressBadge",{tested:x.tested_items,total:x.total_items})}),y&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.modeBadge",{mode:y.replace("_"," ")})})]})]}),S.length===0?t.jsx("div",{className:"h-[280px] rounded border border-dashed border-border flex items-center justify-center text-xs text-muted-foreground",children:r("registry.monitorDashboard.noResultsYetMessage")}):t.jsx("div",{ref:N=>{N&&R&&N.scrollHeight-N.scrollTop-N.clientHeight<120&&requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:S.map((N,k)=>t.jsx(Yi,{result:N,index:k,icon:E[N.item_id]},N.id))})]})]}),t.jsx(dt,{open:l,onOpenChange:o,children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:r("registry.monitorDashboard.confirmStartTitle")}),t.jsx(it,{children:r("registry.monitorDashboard.confirmStartDescription",{runId:C?` (${C.id})`:""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{children:r("registry.monitorDashboard.cancelButtonDialog")}),t.jsx(at,{onClick:()=>{o(!1),b()},children:r("registry.monitorDashboard.startAnywayButton")})]})]})})]})}function Ss(s){switch(s){case"passed":return"bg-success/10 text-success border-success/20";case"failed":case"error":return"bg-destructive/10 text-destructive border-destructive/20";case"needs_auth":return"bg-warning/10 text-warning border-warning/20";case"skipped":return"bg-muted text-muted-foreground border-border";default:return""}}function Xi(s){switch(s){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function Zi(s){const e=X.c(28),{tool:r}=s,i=oe(),[n,c]=q.useState(!1);let l;e[0]!==n?(l=()=>c(!n),e[0]=n,e[1]=l):l=e[1];const o=r.success?"text-success":"text-destructive";let a;e[2]!==o?(a=te("text-xs font-bold",o),e[2]=o,e[3]=a):a=e[3];const u=r.success?"✓":"✗";let d;e[4]!==a||e[5]!==u?(d=t.jsx("span",{className:a,children:u}),e[4]=a,e[5]=u,e[6]=d):d=e[6];let m;e[7]!==r.toolName?(m=t.jsx("span",{className:"text-xs font-mono truncate flex-1",children:r.toolName}),e[7]=r.toolName,e[8]=m):m=e[8];let h;e[9]!==r.durationMs?(h=t.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[r.durationMs,"ms"]}),e[9]=r.durationMs,e[10]=h):h=e[10];const g=n?"▲":"▼";let p;e[11]!==g?(p=t.jsx("span",{className:"text-[10px] text-muted-foreground",children:g}),e[11]=g,e[12]=p):p=e[12];let x;e[13]!==l||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==p?(x=t.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",onClick:l,children:[d,m,h,p]}),e[13]=l,e[14]=d,e[15]=m,e[16]=h,e[17]=p,e[18]=x):x=e[18];let f;e[19]!==n||e[20]!==i||e[21]!==r.error||e[22]!==r.input||e[23]!==r.outputPreview?(f=n&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[r.error&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.monitorRunDetail.error")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-destructive",children:r.error})]}),r.input&&Object.keys(r.input).length>0&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.input")}),t.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:JSON.stringify(r.input,null,2)})]}),r.outputPreview&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.outputPreview")}),t.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:r.outputPreview})]}),!r.error&&!r.outputPreview&&(!r.input||Object.keys(r.input).length===0)&&t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.noAdditionalDetails")})]}),e[19]=n,e[20]=i,e[21]=r.error,e[22]=r.input,e[23]=r.outputPreview,e[24]=f):f=e[24];let y;return e[25]!==x||e[26]!==f?(y=t.jsxs("div",{className:"rounded border border-border",children:[x,f]}),e[25]=x,e[26]=f,e[27]=y):y=e[27],y}function en(s){const e=X.c(60),{result:r}=s,i=oe(),[n,c]=q.useState(r.status!=="passed");let l;if(e[0]!==n||e[1]!==r.action_taken||e[2]!==r.agent_summary||e[3]!==r.connection_ok||e[4]!==r.duration_ms||e[5]!==r.error_message||e[6]!==r.id||e[7]!==r.item_title||e[8]!==r.status||e[9]!==r.tool_results||e[10]!==r.tools_listed||e[11]!==i){const{latestToolResults:o,realToolTests:a,isHealthCheck:u,passedTools:d,failedTools:m,hasToolTests:h}=Is(r.tool_results);let g;e[13]!==n?(g=()=>c(!n),e[13]=n,e[14]=g):g=e[14];let p;e[15]!==r.status?(p=Xi(r.status),e[15]=r.status,e[16]=p):p=e[16];let x;e[17]!==p?(x=t.jsx("span",{className:"text-base shrink-0",children:p}),e[17]=p,e[18]=x):x=e[18];let f;e[19]!==r.item_title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:r.item_title}),e[19]=r.item_title,e[20]=f):f=e[20];let y;e[21]!==r.duration_ms?(y=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[r.duration_ms,"ms"]}),e[21]=r.duration_ms,e[22]=y):y=e[22];let v;e[23]!==i?(v=i("registry.monitorRunDetail.conn"),e[23]=i,e[24]=v):v=e[24];const C=r.connection_ok?"✓":"✗";let _;e[25]!==v||e[26]!==C?(_=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v,":"," ",C]}),e[25]=v,e[26]=C,e[27]=_):_=e[27];let b;e[28]!==i?(b=i("registry.monitorRunDetail.toolsListed"),e[28]=i,e[29]=b):b=e[29];const L=r.tools_listed?"✓":"✗";let I;e[30]!==b||e[31]!==L?(I=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[b,":"," ",L]}),e[30]=b,e[31]=L,e[32]=I):I=e[32];const R=o.length>0&&t.jsx("span",{className:"text-[10px] text-muted-foreground",children:h?t.jsxs(t.Fragment,{children:[i("registry.monitorRunDetail.tools"),": ",d,"✓"," ",m,"✗"]}):t.jsxs(t.Fragment,{children:[o.length," ",i("registry.monitorRunDetail.toolsFound")]})});let P;e[33]!==r.action_taken||e[34]!==i?(P=r.action_taken!=="none"&&t.jsxs(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:[i("registry.monitorRunDetail.action"),": ",r.action_taken]}),e[33]=r.action_taken,e[34]=i,e[35]=P):P=e[35];let S;e[36]!==I||e[37]!==R||e[38]!==P||e[39]!==y||e[40]!==_?(S=t.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[y,_,I,R,P]}),e[36]=I,e[37]=R,e[38]=P,e[39]=y,e[40]=_,e[41]=S):S=e[41];let E;e[42]!==S||e[43]!==f?(E=t.jsxs("div",{className:"min-w-0 flex-1",children:[f,S]}),e[42]=S,e[43]=f,e[44]=E):E=e[44];let D;e[45]!==r.status?(D=te("capitalize shrink-0",Ss(r.status)),e[45]=r.status,e[46]=D):D=e[46];let N;e[47]!==r.status?(N=r.status.replace("_"," "),e[47]=r.status,e[48]=N):N=e[48];let k;e[49]!==D||e[50]!==N?(k=t.jsx(H,{className:D,children:N}),e[49]=D,e[50]=N,e[51]=k):k=e[51];const T=n?"▲":"▼";let $;e[52]!==T?($=t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:T}),e[52]=T,e[53]=$):$=e[53];let M;e[54]!==E||e[55]!==k||e[56]!==g||e[57]!==$||e[58]!==x?(M=t.jsxs("button",{type:"button",className:"w-full text-left px-4 py-3 flex items-center gap-3 hover:bg-muted/30 transition-colors",onClick:g,children:[x,E,k,$]}),e[54]=E,e[55]=k,e[56]=g,e[57]=$,e[58]=x,e[59]=M):M=e[59],l=t.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[M,n&&t.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.connection")}),t.jsx("p",{className:te("text-xs font-medium",r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?i("registry.monitorRunDetail.connected"):i("registry.monitorRunDetail.failed")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.toolsListedLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?i("registry.monitorRunDetail.yesWithCount",{count:o.length}):i("registry.monitorRunDetail.no")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.duration")}),t.jsxs("p",{className:"text-xs font-medium",children:[r.duration_ms,"ms"]})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.actionTaken")}),t.jsx("p",{className:"text-xs font-medium capitalize",children:r.action_taken.replace(/_/g," ")})]})]}),r.error_message&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.monitorRunDetail.errorMessage")}),t.jsx("pre",{className:"text-xs bg-destructive/5 border border-destructive/10 rounded px-3 py-2 whitespace-pre-wrap break-all text-destructive",children:r.error_message})]}),h?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.toolResults",{passed:d,failed:m})}),t.jsx("div",{className:"space-y-1",children:a.map((A,U)=>t.jsx(Zi,{tool:A},`${r.id}-${A.toolName}-${U}`))})]}):u&&o.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.toolsDiscovered",{count:o.length})}),t.jsx("div",{className:"flex flex-wrap gap-1",children:o.map((A,U)=>t.jsx(H,{variant:"outline",className:"text-[10px] font-mono",children:A.toolName},`${r.id}-${A.toolName}-${U}`))})]}):null,r.agent_summary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.agentSummary")}),t.jsx("p",{className:"text-xs bg-muted/50 rounded px-3 py-2",children:r.agent_summary})]})]})]}),e[0]=n,e[1]=r.action_taken,e[2]=r.agent_summary,e[3]=r.connection_ok,e[4]=r.duration_ms,e[5]=r.error_message,e[6]=r.id,e[7]=r.item_title,e[8]=r.status,e[9]=r.tool_results,e[10]=r.tools_listed,e[11]=i,e[12]=l}else l=e[12];return l}function tn(s){const e=X.c(4),{value:r,onChange:i}=s,n=oe();let c;if(e[0]!==i||e[1]!==n||e[2]!==r){const l=[{value:"all",labelKey:"registry.monitorRunDetail.filterAll"},{value:"passed",labelKey:"registry.monitorRunDetail.filterPassed"},{value:"failed",labelKey:"registry.monitorRunDetail.filterFailed"},{value:"error",labelKey:"registry.monitorRunDetail.filterError"},{value:"needs_auth",labelKey:"registry.monitorRunDetail.filterNeedsAuth"},{value:"skipped",labelKey:"registry.monitorRunDetail.filterSkipped"}];c=t.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(o=>t.jsx("button",{type:"button",className:te("text-[11px] px-2 py-0.5 rounded-full border transition-colors",r===o.value?"bg-primary text-primary-foreground border-primary":"bg-muted/30 border-border hover:bg-muted/50"),onClick:()=>i(o.value),children:n(o.labelKey)},o.value))}),e[0]=i,e[1]=n,e[2]=r,e[3]=c}else c=e[3];return c}function sn(s){const e=X.c(81),{runId:r}=s,i=oe(),[n,c]=q.useState("all"),l=Kt(r),o=l.data?.run,a=mt(r,void 0,o?.status);let u,d,m,h,g,p,x,f,y,v,C,_,b;if(e[0]!==a||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==n||e[5]!==i){g=Symbol.for("react.early_return_sentinel");e:{if(u=a.data?.items??[],d=n==="all"?u:u.filter(j=>j.status===n),!r){let j;e[19]!==i?(j=i("registry.monitorRunDetail.selectRunToInspect"),e[19]=i,e[20]=j):j=e[20];let z;e[21]!==j?(z=t.jsx(ge,{className:"p-6 text-center space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:j})}),e[21]=j,e[22]=z):z=e[22],g=z;break e}C="space-y-3";let D;e[23]!==i?(D=i("registry.monitorRunDetail.runDetail"),e[23]=i,e[24]=D):D=e[24];let N;e[25]!==D?(N=t.jsx("h3",{className:"text-sm font-semibold",children:D}),e[25]=D,e[26]=N):N=e[26];let k;e[27]!==r?(k=t.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:r}),e[27]=r,e[28]=k):k=e[28];let T;e[29]!==N||e[30]!==k?(T=t.jsxs("div",{children:[N,k]}),e[29]=N,e[30]=k,e[31]=T):T=e[31];let $;e[32]!==o?($=o&&t.jsx(H,{className:te("capitalize",Ss(o.status)),children:o.status}),e[32]=o,e[33]=$):$=e[33];let M;e[34]!==a||e[35]!==l?(M=()=>{l.refetch(),a.refetch()},e[34]=a,e[35]=l,e[36]=M):M=e[36];let A;e[37]!==i?(A=i("registry.monitorRunDetail.refresh"),e[37]=i,e[38]=A):A=e[38];let U;e[39]!==M||e[40]!==A?(U=t.jsx(Q,{size:"sm",variant:"outline",onClick:M,children:A}),e[39]=M,e[40]=A,e[41]=U):U=e[41];let F;e[42]!==$||e[43]!==U?(F=t.jsxs("div",{className:"flex items-center gap-2",children:[$,U]}),e[42]=$,e[43]=U,e[44]=F):F=e[44],e[45]!==T||e[46]!==F?(_=t.jsx(ge,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,F]})}),e[45]=T,e[46]=F,e[47]=_):_=e[47],e[48]!==o||e[49]!==i?(b=o&&t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.total")}),t.jsx("p",{className:"text-lg font-bold",children:o.total_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.tested")}),t.jsx("p",{className:"text-lg font-bold",children:o.tested_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-success",children:i("registry.monitorRunDetail.passed")}),t.jsx("p",{className:"text-lg font-bold text-success",children:o.passed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-destructive",children:i("registry.monitorRunDetail.failed")}),t.jsx("p",{className:"text-lg font-bold text-destructive",children:o.failed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.skipped")}),t.jsx("p",{className:"text-lg font-bold",children:o.skipped_items})]})]}),e[48]=o,e[49]=i,e[50]=b):b=e[50],e[51]!==o||e[52]!==i?(h=o&&(o.started_at||o.finished_at)&&t.jsxs(ge,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[o.started_at&&t.jsxs("span",{children:[i("registry.monitorRunDetail.started"),":"," ",new Date(o.started_at).toLocaleString()]}),o.finished_at&&t.jsxs("span",{children:[i("registry.monitorRunDetail.finished"),":"," ",new Date(o.finished_at).toLocaleString()]}),o.started_at&&o.finished_at&&t.jsxs("span",{className:"font-medium text-foreground",children:[i("registry.monitorRunDetail.durationLabel"),":"," ",((new Date(o.finished_at).getTime()-new Date(o.started_at).getTime())/1e3).toFixed(1),"s"]})]}),e[51]=o,e[52]=i,e[53]=h):h=e[53],y="flex items-center justify-between gap-2",e[54]!==n?(v=t.jsx(tn,{value:n,onChange:c}),e[54]=n,e[55]=v):v=e[55],m="text-xs text-muted-foreground",p=d.length,x=" ",f=i("registry.monitorRunDetail.result",{count:d.length})}e[0]=a,e[1]=o,e[2]=r,e[3]=l,e[4]=n,e[5]=i,e[6]=u,e[7]=d,e[8]=m,e[9]=h,e[10]=g,e[11]=p,e[12]=x,e[13]=f,e[14]=y,e[15]=v,e[16]=C,e[17]=_,e[18]=b}else u=e[6],d=e[7],m=e[8],h=e[9],g=e[10],p=e[11],x=e[12],f=e[13],y=e[14],v=e[15],C=e[16],_=e[17],b=e[18];if(g!==Symbol.for("react.early_return_sentinel"))return g;let L;e[56]!==m||e[57]!==p||e[58]!==x||e[59]!==f?(L=t.jsxs("span",{className:m,children:[p,x,f]}),e[56]=m,e[57]=p,e[58]=x,e[59]=f,e[60]=L):L=e[60];let I;e[61]!==L||e[62]!==y||e[63]!==v?(I=t.jsxs("div",{className:y,children:[v,L]}),e[61]=L,e[62]=y,e[63]=v,e[64]=I):I=e[64];let R;e[65]!==u||e[66]!==d.length||e[67]!==i?(R=d.length===0&&t.jsx(ge,{className:"p-4 text-sm text-muted-foreground text-center",children:u.length===0?i("registry.monitorRunDetail.noTestResultsYet"):i("registry.monitorRunDetail.noResultsMatchFilter")}),e[65]=u,e[66]=d.length,e[67]=i,e[68]=R):R=e[68];let P;e[69]!==d?(P=d.map(rn),e[69]=d,e[70]=P):P=e[70];let S;e[71]!==R||e[72]!==P?(S=t.jsxs("div",{className:"space-y-2",children:[R,P]}),e[71]=R,e[72]=P,e[73]=S):S=e[73];let E;return e[74]!==h||e[75]!==I||e[76]!==S||e[77]!==C||e[78]!==_||e[79]!==b?(E=t.jsxs("div",{className:C,children:[_,b,h,I,S]}),e[74]=h,e[75]=I,e[76]=S,e[77]=C,e[78]=_,e[79]=b,e[80]=E):E=e[80],E}function rn(s){return t.jsx(en,{result:s},s.id)}function nn(s){return s.tested_items?`${Math.round(s.passed_items/s.tested_items*100)}%`:"-"}function on(s){const e=X.c(20),{selectedRunId:r,onSelectRun:i}=s,n=It();let c;e[0]!==n.data?.items?(c=n.data?.items??[],e[0]=n.data?.items,e[1]=c):c=e[1];const l=c;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=o):o=e[2];let a;e[3]!==n?(a=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o,t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>n.refetch(),children:"Refresh"})]}),e[3]=n,e[4]=a):a=e[4];let u;e[5]!==l.length?(u=l.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs yet. Start QA from the Dashboard tab."}),e[5]=l.length,e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==l||e[9]!==r){let g;e[11]!==i||e[12]!==r?(g=p=>{const x=ks(p.started_at,p.finished_at),f=nn(p),y=r===p.id;return t.jsxs("button",{type:"button",onClick:()=>i(p.id),className:te("w-full text-left rounded-lg border p-3 transition-colors",y?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(p.created_at).toLocaleString()})}),t.jsx(H,{className:te("capitalize",Rs(p.status)),children:p.status})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[t.jsxs("span",{className:"text-muted-foreground",children:[p.tested_items,"/",p.total_items," tested"]}),t.jsxs("span",{className:"text-success font-medium",children:[p.passed_items," passed"]}),p.failed_items>0&&t.jsxs("span",{className:"text-destructive font-medium",children:[p.failed_items," failed"]}),p.skipped_items>0&&t.jsxs("span",{className:"text-muted-foreground",children:[p.skipped_items," skipped"]}),t.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",f]}),x&&t.jsx("span",{className:"text-muted-foreground",children:x})]}),p.config_snapshot&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.jsx(H,{variant:"outline",className:"text-[9px]",children:(p.config_snapshot.monitorMode??p.config_snapshot.testMode??"health_check").replace("_"," ")}),p.config_snapshot.onFailure!=="none"&&t.jsxs(H,{variant:"outline",className:"text-[9px] text-destructive",children:["on fail:"," ",p.config_snapshot.onFailure.replace(/_/g," ")]})]})]},p.id)},e[11]=i,e[12]=r,e[13]=g):g=e[13],d=l.map(g),e[7]=i,e[8]=l,e[9]=r,e[10]=d}else d=e[10];let m;e[14]!==u||e[15]!==d?(m=t.jsxs("div",{className:"space-y-2 max-h-[520px] overflow-auto",children:[u,d]}),e[14]=u,e[15]=d,e[16]=m):m=e[16];let h;return e[17]!==a||e[18]!==m?(h=t.jsx(ge,{className:"p-4",children:t.jsxs("div",{className:"space-y-3",children:[a,m]})}),e[17]=a,e[18]=m,e[19]=h):h=e[19],h}function an(){const s=X.c(21),e=oe(),[r,i]=q.useState(void 0),[n,c]=q.useState("tests"),o=Kt(r).data?.run?.status,a=mt(r,void 0,o);let u;s[0]!==a.data?.items?(u=a.data?.items??[],s[0]=a.data?.items,s[1]=u):u=s[1];let d;s[2]!==u?(d=u.filter(ln),s[2]=u,s[3]=d):d=s[3];const m=d;let h;s[4]!==n||s[5]!==e?(h=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:[{id:"tests",labelKey:"registry.registryMonitorPage.tabTests"},{id:"configuration",labelKey:"registry.registryMonitorPage.tabConfiguration"},{id:"connections",labelKey:"registry.registryMonitorPage.tabConnections"}].map(y=>{const v=n===y.id;return t.jsx("button",{type:"button",className:te("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",v?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>c(y.id),children:t.jsx("span",{children:e(y.labelKey)})},y.id)})}),s[4]=n,s[5]=e,s[6]=h):h=s[6];let g;s[7]!==r||s[8]!==n||s[9]!==m||s[10]!==e?(g=n==="tests"&&t.jsxs("div",{className:"space-y-6",children:[t.jsx(Ji,{activeRunId:r,onRunChange:i}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[t.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[r&&t.jsx(sn,{runId:r}),t.jsx(on,{selectedRunId:r,onSelectRun:i})]}),t.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[t.jsxs("h3",{className:"text-sm font-semibold",children:[e("registry.registryMonitorPage.brokenMcps")," ",m.length>0&&t.jsx(H,{variant:"destructive",className:"text-[10px] ml-1",children:m.length})]}),t.jsx(Di,{results:m})]})]})]}),s[7]=r,s[8]=n,s[9]=m,s[10]=e,s[11]=g):g=s[11];let p;s[12]!==n?(p=n==="configuration"&&t.jsx(Ui,{}),s[12]=n,s[13]=p):p=s[13];let x;s[14]!==n?(x=n==="connections"&&t.jsx(Bi,{}),s[14]=n,s[15]=x):x=s[15];let f;return s[16]!==h||s[17]!==g||s[18]!==p||s[19]!==x?(f=t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[h,g,p,x]}),s[16]=h,s[17]=g,s[18]=p,s[19]=x,s[20]=f):f=s[20],f}function ln(s){return s.status==="failed"||s.status==="error"}function cn(s){const e=X.c(9),{activeTab:r,onChange:i,items:n}=s;let c;if(e[0]!==r||e[1]!==n||e[2]!==i){let o;e[4]!==r||e[5]!==i?(o=a=>{const u=r===a.tab,d=a.icon;return t.jsxs("button",{type:"button",className:te("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",u?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(a.tab),children:[t.jsx(d,{size:14}),t.jsx("span",{children:a.label}),typeof a.count=="number"&&a.count>0&&t.jsx("span",{className:"min-w-4 h-4 px-1 inline-flex items-center justify-center rounded-full bg-primary/15 text-[10px] font-semibold",children:a.count})]},a.id)},e[4]=r,e[5]=i,e[6]=o):o=e[6],c=n.map(o),e[0]=r,e[1]=n,e[2]=i,e[3]=c}else c=e[3];let l;return e[7]!==c?(l=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:c}),e[7]=c,e[8]=l):l=e[8],l}function to(s){const e=X.c(59),{onBack:r}=s,i=oe(),[n,c]=q.useState("items"),[l,o]=q.useState(null),{registryName:a,registryIcon:u,acceptPublishRequests:d}=Cs(Ve),m=Kr(),h=Lr();!d&&n==="requests"&&c("items");const g=m.data?.pending??0;let p;e[0]!==i?(p=i("registry.registryLayout.itemsTab"),e[0]=i,e[1]=p):p=e[1];const x=h.brokenCount>0?h.brokenCount:void 0;let f;e[2]!==p||e[3]!==x?(f={id:"items",label:p,icon:tr,tab:"items",count:x},e[2]=p,e[3]=x,e[4]=f):f=e[4];let y;e[5]!==d||e[6]!==g||e[7]!==i?(y=d?[{id:"requests",label:i("registry.registryLayout.requestsTab"),icon:We,tab:"requests",count:g}]:[],e[5]=d,e[6]=g,e[7]=i,e[8]=y):y=e[8];let v;e[9]!==i?(v=i("registry.registryLayout.qaTab"),e[9]=i,e[10]=v):v=e[10];let C;e[11]!==v?(C={id:"qa",label:v,icon:ps,tab:"qa"},e[11]=v,e[12]=C):C=e[12];let _;e[13]!==i?(_=i("registry.registryLayout.settingsTab"),e[13]=i,e[14]=_):_=e[14];let b;e[15]!==_?(b={id:"settings",label:_,icon:nr,tab:"settings"},e[15]=_,e[16]=b):b=e[16];let L;e[17]!==f||e[18]!==y||e[19]!==C||e[20]!==b?(L=[f,...y,C,b],e[17]=f,e[18]=y,e[19]=C,e[20]=b,e[21]=L):L=e[21];const I=L;let R;e[22]!==r?(R=r&&t.jsx("button",{type:"button",className:"shrink-0 p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors cursor-pointer",onClick:r,children:t.jsx(sr,{size:16})}),e[22]=r,e[23]=R):R=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=()=>c("settings"),e[24]=P):P=e[24];let S;e[25]!==u||e[26]!==a?(S=t.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:u?t.jsx("img",{src:u,alt:a,className:"h-full w-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:a.slice(0,1).toUpperCase()})}),e[25]=u,e[26]=a,e[27]=S):S=e[27];let E;e[28]!==a?(E=t.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:a}),e[28]=a,e[29]=E):E=e[29];let D;e[30]!==S||e[31]!==E?(D=t.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:P,children:[S,E]}),e[30]=S,e[31]=E,e[32]=D):D=e[32];let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),e[33]=N):N=e[33];let k;e[34]!==n||e[35]!==I?(k=t.jsx(cn,{activeTab:n,onChange:c,items:I}),e[34]=n,e[35]=I,e[36]=k):k=e[36];let T;e[37]!==R||e[38]!==D||e[39]!==k?(T=t.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[R,D,N,k]})}),e[37]=R,e[38]=D,e[39]=k,e[40]=T):T=e[40];let $;e[41]!==n?($=n==="items"&&t.jsx(Ri,{}),e[41]=n,e[42]=$):$=e[42];let M;e[43]!==d||e[44]!==n?(M=n==="requests"&&d&&t.jsx(Ii,{}),e[43]=d,e[44]=n,e[45]=M):M=e[45];let A;e[46]!==n?(A=n==="qa"&&t.jsx(an,{}),e[46]=n,e[47]=A):A=e[47];let U;e[48]!==n||e[49]!==l?(U=n==="settings"&&t.jsx(Si,{revealedKey:l,onRevealedKeyChange:o}),e[48]=n,e[49]=l,e[50]=U):U=e[50];let F;e[51]!==$||e[52]!==M||e[53]!==A||e[54]!==U?(F=t.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[$,M,A,U]}),e[51]=$,e[52]=M,e[53]=A,e[54]=U,e[55]=F):F=e[55];let j;return e[56]!==T||e[57]!==F?(j=t.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[T,F]}),e[56]=T,e[57]=F,e[58]=j):j=e[58],j}export{to as default};
|
|
27
|
+
Describe your MCP here...`,rows:6,value:B,onChange:G=>Z(G.target.value)}),ye.readme&&t.jsx("p",{className:"text-xs text-destructive",children:ye.readme})]})]}),t.jsx(di,{tools:De,onChange:xt,remoteUrl:tt(O)||void 0,remoteType:Ce,externalDiscoverStatus:g,externalDiscoverError:p})]});return t.jsx(vt,{open:s,onOpenChange:Zt,children:t.jsxs(bt,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[t.jsxs(wt,{className:"space-y-3",children:[t.jsx(Nt,{children:a(f?"registry.registryItemDialog.editMcpServer":"registry.registryItemDialog.addMcpServer")}),t.jsx(yi,{current:F}),t.jsxs(Ct,{children:[F===1&&a("registry.registryItemDialog.step1Description"),F===2&&a("registry.registryItemDialog.step2Description"),F===3&&a("registry.registryItemDialog.step3Description")]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[F===1&&As,F===2&&Us,F===3&&Fs]}),t.jsxs(_t,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[t.jsx("div",{children:F>1&&t.jsxs(Q,{variant:"ghost",size:"sm",onClick:Es,children:[t.jsx(fr,{size:14}),a("registry.registryItemDialog.back")]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Q,{variant:"outline",size:"sm",onClick:()=>Zt(!1),disabled:l,children:a("registry.registryItemDialog.cancel")}),F<3?t.jsxs(Q,{size:"sm",onClick:qs,children:[a("registry.registryItemDialog.next"),t.jsx(jr,{size:14})]}):t.jsx(Q,{size:"sm",onClick:Ls,disabled:l,children:a(l?"registry.registryItemDialog.saving":f?"registry.registryItemDialog.saveChanges":"registry.registryItemDialog.create")})]})]})]})})}function ms(s,e){return s.includes(e)?s.filter(r=>r!==e):[...s,e]}function wi(s){return ke(s._meta)?.tags??[]}function _i(s){return ke(s._meta)?.categories??[]}function Pi(s){return s.server?.remotes?.[0]?.url??"-"}function Ri(){const s=oe(),e="h-8",[r,i]=q.useState(""),n=q.useDeferredValue(r),[c,l]=q.useState([]),[o,a]=q.useState([]),[u,d]=q.useState(!1),[m,h]=q.useState(!1),[g,p]=q.useState(null),[x,f]=q.useState(null),[y,v]=cr("private-registry-list","cards"),C=q.useRef(null),_=Ns({search:n,tags:c,categories:o}),b=Fr(),{createMutation:L,updateMutation:I,deleteMutation:R,bulkCreateMutation:P}=Ht(),S=_.data?.pages.flatMap(j=>j.items??[]).filter(Boolean)??[],E=_.data?.pages[0]?.totalCount??S.length,D=c.length>0||o.length>0||n.length>0,N=b.data,k=Array.isArray(N?.tags)?N.tags:[],T=Array.isArray(N?.categories)?N.categories:[],$=j=>{C.current&&(C.current.disconnect(),C.current=null),!(!j||!_.hasNextPage||_.isFetchingNextPage)&&(C.current=new IntersectionObserver(z=>{z[0]?.isIntersecting&&_.hasNextPage&&!_.isFetchingNextPage&&_.fetchNextPage()},{rootMargin:"240px 0px"}),C.current.observe(j))},M=async j=>{try{"data"in j?(await I.mutateAsync(j),V.success(s("registry.registryItemsPage.registryItemUpdated"))):(await L.mutateAsync(j),V.success(s("registry.registryItemsPage.registryItemCreated")))}catch(z){throw V.error(z instanceof Error?z.message:s("registry.registryItemsPage.failedToSaveItem")),z}},A=async j=>{const z=ke(j._meta),K=z?.verified===!0;try{await I.mutateAsync({id:j.id,data:{_meta:Pt(j._meta,{...z,verified:!K})}}),V.success(s(K?"registry.registryItemsPage.removedVerifiedStatus":"registry.registryItemsPage.markedAsVerified"))}catch(W){V.error(W instanceof Error?W.message:s("registry.registryItemsPage.failedToUpdateItem"))}},U=async j=>{const z=ke(j._meta),K=z?.official===!0;try{await I.mutateAsync({id:j.id,data:{_meta:Pt(j._meta,{...z,official:!K})}}),V.success(s(K?"registry.registryItemsPage.removedOfficialStatus":"registry.registryItemsPage.markedAsOfficial"))}catch(W){V.error(W instanceof Error?W.message:s("registry.registryItemsPage.failedToUpdateItem"))}},F=async()=>{if(x)try{await R.mutateAsync(x.id),V.success(s("registry.registryItemsPage.registryItemDeleted")),f(null)}catch(j){V.error(j instanceof Error?j.message:s("registry.registryItemsPage.failedToDeleteItem"))}};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"shrink-0 border-b border-border",children:[t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:s("registry.registryItemsPage.items")}),t.jsx(H,{variant:"secondary",className:"text-xs",children:E})]}),t.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs(Q,{variant:"outline",size:"sm",className:te(e,"gap-1.5"),children:[t.jsx(dr,{size:14}),s("registry.registryItemsPage.filters")]})}),t.jsxs(yt,{align:"end",className:"w-[260px]",children:[t.jsx(rs,{children:s("registry.registryItemsPage.tags")}),k.length>0?k.map(j=>t.jsxs(is,{checked:c.includes(j.value),onCheckedChange:()=>l(z=>ms(z,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ie,{disabled:!0,children:s("registry.registryItemsPage.noTagsAvailable")}),t.jsx(ar,{}),t.jsx(rs,{children:s("registry.registryItemsPage.categories")}),T.length>0?T.map(j=>t.jsxs(is,{checked:o.includes(j.value),onCheckedChange:()=>a(z=>ms(z,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ie,{disabled:!0,children:s("registry.registryItemsPage.noCategoriesAvailable")})]})]}),t.jsxs(lr,{type:"single",value:y,onValueChange:j=>{(j==="cards"||j==="table")&&v(j)},variant:"outline",className:e,children:[t.jsx(ns,{value:"cards","aria-label":s("registry.registryItemsPage.cardsViewAriaLabel"),className:e,children:s("registry.registryItemsPage.cards")}),t.jsx(ns,{value:"table","aria-label":s("registry.registryItemsPage.tableViewAriaLabel"),className:e,children:s("registry.registryItemsPage.table")})]}),t.jsx(Q,{variant:"outline",size:"sm",className:e,onClick:()=>h(!0),children:s("registry.registryItemsPage.importCsv")}),t.jsx(Q,{size:"sm",className:e,onClick:()=>d(!0),children:s("registry.registryItemsPage.addMcpServers")})]})]}),t.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:t.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[t.jsx(ur,{size:16,className:"text-muted-foreground shrink-0"}),t.jsx(je,{value:r,onChange:j=>i(j.target.value),placeholder:s("registry.registryItemsPage.searchPlaceholder"),className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),D&&t.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[c.map(j=>t.jsxs(H,{variant:"default",children:["#",j]},`selected-tag-${j}`)),o.map(j=>t.jsx(H,{variant:"outline",children:j},`selected-category-${j}`)),r.trim()&&t.jsxs(H,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",r]}),t.jsx(Q,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{i(""),l([]),a([])},children:s("registry.registryItemsPage.clearFilters")})]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.length===0?t.jsx("div",{className:"min-h-[320px] rounded-xl border border-dashed border-border flex flex-col items-center justify-center gap-3 p-6 text-center",children:_.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(Ye,{className:"size-5 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:s("registry.registryItemsPage.loadingItems")})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-base font-medium",children:s(D?"registry.registryItemsPage.noItemsFound":"registry.registryItemsPage.noMcpsInRegistry")}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:s(D?"registry.registryItemsPage.tryRemovingFilters":"registry.registryItemsPage.addFirstMcpItem")}),!D&&t.jsx(Q,{size:"lg",onClick:()=>d(!0),children:s("registry.registryItemsPage.addMcpServers")})]})}):y==="cards"?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:S.map(j=>t.jsx(ai,{item:j,onEdit:p,onDelete:f,onToggleVerified:A,onToggleOfficial:U},j.id))}),_.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"border rounded-lg overflow-auto",children:t.jsxs($t,{children:[t.jsx(zt,{children:t.jsxs(Je,{children:[t.jsx(he,{className:"w-[56px]",children:s("registry.registryItemsPage.icon")}),t.jsx(he,{children:s("registry.registryItemsPage.title")}),t.jsx(he,{children:s("registry.registryItemsPage.id")}),t.jsx(he,{children:s("registry.registryItemsPage.tags")}),t.jsx(he,{children:s("registry.registryItemsPage.categories")}),t.jsx(he,{children:s("registry.registryItemsPage.remoteUrl")}),t.jsx(he,{children:s("registry.registryItemsPage.visibility")}),t.jsx(he,{className:"text-right w-[68px]",children:s("registry.registryItemsPage.actions")})]})}),t.jsx(Ot,{children:S.map(j=>t.jsxs(Je,{children:[t.jsx(fe,{children:t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:j.server?.icons?.[0]?.src?t.jsx("img",{src:j.server.icons[0].src,alt:j.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:j.title.charAt(0).toUpperCase()})})}),t.jsx(fe,{children:j.title}),t.jsx(fe,{className:"font-mono",children:j.id}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:wi(j).slice(0,3).map(z=>t.jsx(H,{variant:"outline",children:z},`${j.id}-tag-${z}`))})}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:_i(j).slice(0,3).map(z=>t.jsx(H,{variant:"outline",children:z},`${j.id}-category-${z}`))})}),t.jsx(fe,{children:Pi(j)}),t.jsx(fe,{children:j.is_public?t.jsxs(H,{variant:"default",className:"gap-1",children:[t.jsx(fs,{size:10}),s("registry.registryItemsPage.public")]}):t.jsx(H,{variant:"secondary",children:s("registry.registryItemsPage.private")})}),t.jsx(fe,{className:"text-right",children:t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":s("registry.registryItemsPage.actionsFor",{title:j.title}),children:t.jsx(Bt,{size:18})})}),t.jsxs(yt,{align:"end",children:[t.jsx(Ie,{onClick:()=>p(j),children:s("registry.registryItemsPage.edit")}),t.jsx(Ie,{variant:"destructive",onClick:()=>f(j),children:s("registry.registryItemsPage.delete")})]})]})})]},j.id))})]})}),_.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}),_.isFetchingNextPage&&t.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(Ye,{className:"size-4 animate-spin"}),s("registry.registryItemsPage.loadingMoreItems")]})]}),t.jsx(Ci,{open:u||!!g,onOpenChange:j=>{j||(d(!1),p(null))},item:g,availableTags:k.map(j=>j.value),availableCategories:T.map(j=>j.value),isSubmitting:L.isPending||I.isPending,onSubmit:M},g?.id??"create"),t.jsx(Zr,{open:m,onOpenChange:h,isImporting:P.isPending,onImport:async j=>{try{const z=await P.mutateAsync(j);return V.success(s("registry.registryItemsPage.importedItems",{count:z.created})),z}catch(z){throw V.error(z instanceof Error?z.message:s("registry.registryItemsPage.failedToImportCsv")),z}}}),t.jsx(si,{open:!!x,onOpenChange:j=>{j||f(null)},title:x?.title??x?.id??"",isDeleting:R.isPending,onConfirm:F})]})}const ki=[{value:"pending",labelKey:"registry.registryRequestsPage.statusPending"},{value:"approved",labelKey:"registry.registryRequestsPage.statusApproved"},{value:"rejected",labelKey:"registry.registryRequestsPage.statusRejected"}];function gs(s){const e=new Date(s);return Number.isNaN(e.getTime())?s:e.toLocaleDateString()}function xs(s){return{id:s.requested_id??s.server?.name,title:s.title,description:s.description??"",_meta:s._meta,server:s.server,is_public:!1}}function Ut(s){const e=s.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ht(s){const e=ke(s._meta);return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Ii(){const s=oe(),[e,r]=q.useState("pending"),[i,n]=q.useState("created_at"),[c,l]=q.useState("asc"),[o,a]=q.useState(new Set),[u,d]=q.useState(!1),[m,h]=q.useState("private"),[g,p]=q.useState(!1),[x,f]=q.useState(null),[y,v]=q.useState(null),[C,_]=q.useState(null),[b,L]=q.useState(null),I=ke(b?._meta),[R,P]=q.useState(""),S=zr({status:e,sortBy:i,sortDirection:c}),{reviewMutation:E,deleteMutation:D}=Hr(),{createMutation:N}=Ht(),k=S.data?.pages.flatMap(w=>w.items)??[],T=S.data?.pages[0]?.totalCount??0,$=S.isFetchingNextPage,M=!!S.hasNextPage,A=wr(()=>{S.isFetchingNextPage||S.fetchNextPage()},M,$),U=new Set(k.filter(w=>w.status==="pending").map(w=>w.id)),F=k.filter(w=>U.has(w.id)),j=o.size,z=F.filter(w=>o.has(w.id)),K=k.filter(w=>o.has(w.id)).length,W=F.length>0&&F.every(w=>o.has(w.id)),J=()=>a(new Set),ue=(w,B)=>{a(Z=>{const ne=new Set(Z);return B?ne.add(w):ne.delete(w),ne})},ce=w=>{a(B=>{const Z=new Set(B);return Z.has(w)?Z.delete(w):Z.add(w),Z})},se=()=>{a(w=>{const B=new Set(w);for(const Z of F)B.add(Z.id);return B})},xe=async()=>{const w=y;if(w){v(null),f(w.id);try{await E.mutateAsync({id:w.id,status:"approved",reviewerNotes:void 0});const B=xs(w);await N.mutateAsync({id:B.id,title:B.title,description:B.description,_meta:B._meta,server:B.server,is_public:B.is_public}),V.success(s("registry.registryRequestsPage.requestApprovedAndAdded"))}catch(B){const Z=B instanceof Error?B.message:"Failed to approve request";Z.includes("UNIQUE constraint")||Z.includes("already exists")?V.error(s("registry.registryRequestsPage.itemAlreadyExists")):V.error(Z)}finally{f(null)}}},me=async()=>{if(C)try{await E.mutateAsync({id:C.id,status:"rejected",reviewerNotes:R.trim()||void 0}),V.success(s("registry.registryRequestsPage.requestRejected")),_(null),P("")}catch(w){V.error(w instanceof Error?w.message:"Failed to reject request")}},ae=async w=>{try{await D.mutateAsync(w.id),V.success(s("registry.registryRequestsPage.requestDeleted"))}catch(B){V.error(B instanceof Error?B.message:"Failed to delete request")}},re=async()=>{if(z.length===0||g)return;p(!0),d(!1);let w=0;const B=new Set;for(const ne of z)try{await E.mutateAsync({id:ne.id,status:"approved",reviewerNotes:void 0});const de=xs(ne);await N.mutateAsync({id:de.id,title:de.title,description:de.description,_meta:de._meta,server:de.server,is_public:m==="public"}),w++}catch{B.add(ne.id)}const Z=B.size;w>0&&Z===0?V.success(s("registry.registryRequestsPage.bulkApproveSuccess",{approvedCount:w,bulkVisibility:m})):w>0&&Z>0?V.warning(s("registry.registryRequestsPage.bulkApprovePartial",{approvedCount:w,failedCount:Z})):V.error(s("registry.registryRequestsPage.bulkApproveFailed")),a(B),p(!1)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"shrink-0 border-b border-border",children:t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:s("registry.registryRequestsPage.requestsToPublish")}),t.jsx(H,{variant:"secondary",className:"text-xs",children:T})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:ki.map(w=>t.jsx("button",{type:"button",className:te("px-2.5 py-1 text-xs rounded-md transition-colors",e===w.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r(w.value),onClickCapture:()=>J(),children:s(w.labelKey)},w.value))}),t.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${i}:${c}`,onChange:w=>{const[B,Z]=w.target.value.split(":");n(B),l(Z)},children:[t.jsx("option",{value:"created_at:asc",children:s("registry.registryRequestsPage.sortCreatedOldest")}),t.jsx("option",{value:"created_at:desc",children:s("registry.registryRequestsPage.sortCreatedNewest")}),t.jsx("option",{value:"title:asc",children:s("registry.registryRequestsPage.sortAlphaAZ")}),t.jsx("option",{value:"title:desc",children:s("registry.registryRequestsPage.sortAlphaZA")})]})]})]})}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.isLoading?t.jsx("div",{className:"text-sm text-muted-foreground",children:s("registry.registryRequestsPage.loadingRequests")}):S.isError?t.jsxs("div",{className:"p-8 text-center rounded-lg border border-border",children:[t.jsx("p",{className:"text-sm text-destructive",children:s("registry.registryRequestsPage.failedLoadRequests")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.error instanceof Error?S.error.message:s("registry.registryRequestsPage.unknownError")})]}):k.length===0?t.jsx("div",{className:"p-8 text-center rounded-lg border border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:s(e==="pending"?"registry.registryRequestsPage.noPendingRequests":e==="approved"?"registry.registryRequestsPage.noApprovedRequests":"registry.registryRequestsPage.noRejectedRequests")})}):t.jsxs($t,{children:[t.jsx(zt,{children:t.jsxs(Je,{children:[e==="pending"&&t.jsx(he,{className:"w-10",children:t.jsx(as,{checked:W&&F.length>0,onCheckedChange:w=>{w?se():J()}})}),t.jsx(he,{children:s("registry.registryRequestsPage.columnName")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnRequester")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnTags")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnStatus")}),t.jsx(he,{children:s("registry.registryRequestsPage.columnDate")}),t.jsx(he,{className:"text-right",children:s("registry.registryRequestsPage.columnActions")})]})}),t.jsx(Ot,{children:k.map(w=>{const B=Ut(w),Z=ke(w._meta)?.tags??[],ne=U.has(w.id),de=o.has(w.id);return t.jsxs(Je,{className:te(ne&&"cursor-pointer",de&&"bg-accent/20"),onClick:()=>{ne&&ce(w.id)},children:[e==="pending"&&t.jsx(fe,{children:t.jsx(as,{checked:de,onCheckedChange:ie=>ue(w.id,ie===!0),onClick:ie=>ie.stopPropagation()})}),t.jsx(fe,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:B?t.jsx("img",{src:B,alt:w.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:w.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:w.title}),w.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:w.description})]})]})}),t.jsx(fe,{children:t.jsx("span",{className:"text-sm text-muted-foreground truncate",children:w.requester_name||w.requester_email||"-"})}),t.jsx(fe,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:Z.slice(0,3).map(ie=>t.jsx(H,{variant:"secondary",className:"text-[10px]",children:ie},`${w.id}-tag-${ie}`))})}),t.jsx(fe,{children:t.jsx(H,{variant:"secondary",className:"capitalize text-[11px]",children:w.status})}),t.jsx(fe,{children:t.jsx("span",{className:"text-sm text-muted-foreground",children:gs(w.created_at)})}),t.jsx(fe,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsxs(Q,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),L(w)},children:[t.jsx(ys,{size:13}),s("registry.registryRequestsPage.buttonView")]}),ne?t.jsxs(t.Fragment,{children:[t.jsxs(Q,{size:"sm",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),v(w)},disabled:x!==null||g||de,children:[t.jsx(We,{size:13}),x===w.id?s("registry.registryRequestsPage.approving"):s(de?"registry.registryRequestsPage.selected":"registry.registryRequestsPage.buttonApprove")]}),t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),_(w),P("")},disabled:E.isPending,children:[t.jsx(vr,{size:13}),s("registry.registryRequestsPage.buttonReject")]})]}):t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),ae(w)},disabled:D.isPending,children:[t.jsx(ut,{size:13}),s("registry.registryRequestsPage.buttonDelete")]})]})})]},w.id)})})]}),k.length>0&&M?t.jsx("div",{ref:A,className:"h-1 w-full"}):null,$&&k.length>0?t.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:s("registry.registryRequestsPage.loadingMoreRequests")}):null]}),j>0?t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground pr-1",children:s("registry.registryRequestsPage.selectedCount",{selectedCount:j})}),t.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:se,disabled:W,children:s("registry.registryRequestsPage.selectAll")}),t.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J,children:s("registry.registryRequestsPage.clearSelection")}),t.jsxs(Q,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>d(!0),disabled:g,children:[t.jsx(We,{size:13}),s("registry.registryRequestsPage.approveSelected")]})]})}):null,t.jsx(vt,{open:!!b,onOpenChange:w=>{w||L(null)},children:t.jsxs(bt,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[t.jsxs(wt,{children:[t.jsx(Nt,{children:b?.title??s("registry.registryRequestsPage.requestDetails")}),t.jsx(Ct,{children:s("registry.registryRequestsPage.reviewMetadataDescription")})]}),b&&t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[t.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Ut(b)?t.jsx("img",{src:Ut(b)||"",alt:b.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:b.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:b.title}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.server?.name||b.id})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelStatus")}),t.jsx("span",{className:"capitalize",children:b.status})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelSubmitted")}),t.jsx("span",{children:gs(b.created_at)})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelRequester")}),t.jsx("span",{children:b.requester_name||"-"})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("registry.registryRequestsPage.labelEmail")}),t.jsx("span",{children:b.requester_email||"-"})]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelRemoteURL")}),t.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:b.server?.remotes?.[0]?.url??"-"})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelDescription")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:b.description||s("registry.registryRequestsPage.noDescriptionProvided")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelTags")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(I?.tags??[]).length?(I?.tags??[]).map(w=>t.jsx(H,{variant:"secondary",children:w},`${b.id}-detail-tag-${w}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelCategories")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(I?.categories??[]).length?(I?.categories??[]).map(w=>t.jsx(H,{variant:"secondary",children:w},`${b.id}-detail-category-${w}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{children:s("registry.registryRequestsPage.labelREADME")}),ht(b).hasReadmeContent?t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap max-h-40 overflow-y-auto rounded-md border border-border bg-muted/20 px-2.5 py-2",children:ht(b).readmeContent}):ht(b).hasReadmeLink?t.jsxs("a",{href:ht(b).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:[s("registry.registryRequestsPage.openREADMELink"),t.jsx(Cr,{size:14})]}):t.jsx("span",{className:"text-sm text-muted-foreground",children:s("registry.registryRequestsPage.noREADMEProvided")})]})]}),t.jsx(_t,{children:t.jsx(Q,{variant:"outline",onClick:()=>L(null),children:s("registry.registryRequestsPage.buttonClose")})})]})}),t.jsx(dt,{open:!!y,onOpenChange:w=>{w||v(null)},children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:s("registry.registryRequestsPage.approvePublishRequestTitle")}),t.jsx(it,{children:s("registry.registryRequestsPage.approvePublishRequestDesc",{title:y?.title??""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(at,{onClick:xe,children:s("registry.registryRequestsPage.buttonApprove")})]})]})}),t.jsx(dt,{open:u,onOpenChange:d,children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:s("registry.registryRequestsPage.approveSelectedRequestsTitle")}),t.jsx(it,{children:s("registry.registryRequestsPage.approveSelectedRequestsDesc",{count:z.length})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"bulk-visibility",children:s("registry.registryRequestsPage.visibilityForAll")}),t.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:m,onChange:w=>h(w.target.value),children:[t.jsx("option",{value:"private",children:s("registry.registryRequestsPage.visibilityPrivate")}),t.jsx("option",{value:"public",children:s("registry.registryRequestsPage.visibilityPublic")})]})]}),t.jsxs(lt,{children:[t.jsx(ot,{disabled:g,children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(at,{onClick:re,disabled:g||K===0,children:s(g?"registry.registryRequestsPage.approving":"registry.registryRequestsPage.approveSelected")})]})]})}),t.jsx(vt,{open:!!C,onOpenChange:w=>{w||(_(null),P(""))},children:t.jsxs(bt,{children:[t.jsxs(wt,{children:[t.jsx(Nt,{children:s("registry.registryRequestsPage.rejectPublishRequestTitle")}),t.jsx(Ct,{children:s("registry.registryRequestsPage.rejectPublishRequestDesc")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"reject-notes",children:s("registry.registryRequestsPage.reviewerNotes")}),t.jsx(Rt,{id:"reject-notes",rows:4,value:R,onChange:w=>P(w.target.value),placeholder:s("registry.registryRequestsPage.reasonForRejectionPlaceholder")})]}),t.jsxs(_t,{children:[t.jsx(Q,{variant:"outline",onClick:()=>{_(null),P("")},children:s("registry.registryRequestsPage.buttonCancel")}),t.jsx(Q,{onClick:me,disabled:E.isPending,children:E.isPending?s("registry.registryRequestsPage.rejecting"):s("registry.registryRequestsPage.buttonReject")})]})]})})]})}function Si({revealedKey:s,onRevealedKeyChange:e}){const r=oe(),{org:i}=Ne(),{uploadImage:n,isUploading:c}=Ps(),{registryName:l,registryIcon:o,acceptPublishRequests:a,requireApiToken:u,storePrivateOnly:d,rateLimitEnabled:m,rateLimitWindow:h,rateLimitMax:g,isSaving:p,updateConfig:x}=Cs(Ve),[f,y]=q.useState(l),[v,C]=q.useState(l);l!==v&&(C(l),y(l));const[_,b]=q.useState(o),[L,I]=q.useState(o);o!==L&&(I(o),b(o));const[R,P]=q.useState(String(g)),[S,E]=q.useState(g);g!==S&&(E(g),P(String(g)));const D=Vr(),{generateMutation:N,revokeMutation:k}=Gr(),[T,$]=q.useState(""),[M,A]=q.useState(!1),[U,F]=q.useState(null),{handleCopy:j,copied:z}=Et(),{handleCopy:K,copied:W}=Et(),{handleCopy:J,copied:ue}=Et(),ce=Ns({search:"",tags:[],categories:[],limit:50}),se=`${window.location.origin}/org/${i.slug}/registry/mcp`,me=(ce.data?.pages.flatMap(O=>O.items??[])??[]).filter(O=>O.is_public).length,ae=`${window.location.origin}/org/${i.slug}/registry/publish-request`,re=s?.slice(0,12)??null,w=!!(re&&(D.data?.items??[]).some(O=>O.prefix===re)),B=p||c,Z=()=>{const O=f.trim();!O||O===l||x({registryName:O})},ne=()=>{const O=Number.parseInt(R,10),pe=Number.isFinite(O)&&O>=1?O:100;P(String(pe)),pe!==g&&x({rateLimitMax:pe})},de=async O=>{if(!O)return;const pe=O.name.split(".").pop()||"png",Ce=`registry/${i.id}/identity/icon.${pe}`,Re=await n(O,Ce);Re?(b(Re),x({registryIcon:Re})):V.error(r("registry.registrySettingsPage.failedUploadIcon"))},ie=async()=>{const O=T.trim();if(O)try{const pe=await N.mutateAsync(O);pe?.key&&(e(pe.key),A(!1),$(""),V.success(r("registry.registrySettingsPage.apiKeyGenerated")))}catch(pe){V.error(pe instanceof Error?pe.message:r("registry.registrySettingsPage.failedGenerateApiKey"))}},Se=async O=>{try{await k.mutateAsync(O),e(null),F(null),V.success(r("registry.registrySettingsPage.apiKeyRevoked"))}catch(pe){V.error(pe instanceof Error?pe.message:r("registry.registrySettingsPage.failedRevokeApiKey"))}};return t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[t.jsx("div",{className:"grid gap-4 min-w-0 content-start",children:t.jsxs(ge,{className:"min-w-0 p-4 grid gap-4 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.registryIdentity")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.configureNameIcon")})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(le,{htmlFor:"identity-name",children:r("registry.registrySettingsPage.name")}),t.jsx(je,{id:"identity-name",value:f,onChange:O=>y(O.target.value),onBlur:Z,disabled:B,placeholder:r("registry.registrySettingsPage.namePlaceholder")})]}),t.jsx(ws,{value:_,onChange:b,onBlur:()=>{const O=_.trim();O!==o&&x({registryIcon:O})},onFileUpload:de,isUploading:c})]})}),t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.publicRegistry")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.publicRegistryDescription")})]}),t.jsxs(H,{variant:"secondary",children:[me," ",r(me===1?"registry.registrySettingsPage.publicItem":"registry.registrySettingsPage.publicItems")]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:se}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>j(se),children:z?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]})]}),t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.storeVisibility")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.storeVisibilityDescription")})]}),t.jsx(Ge,{id:"store-private-only",checked:d,onCheckedChange:O=>x({storePrivateOnly:O}),disabled:B})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.storeVisibilityHelp")})]}),t.jsxs(ge,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:r("registry.registrySettingsPage.publishRequests")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:r("registry.registrySettingsPage.publishRequestsDescription")})]}),t.jsx(Ge,{id:"accept-publish-requests",checked:a,onCheckedChange:O=>x({acceptPublishRequests:O}),disabled:B})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:ae}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>K(ae),children:W?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(le,{className:"text-sm font-medium",children:r("registry.registrySettingsPage.requireApiToken")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.requireApiTokenHelp")})]}),t.jsx(Ge,{id:"require-api-token",checked:u,onCheckedChange:O=>x({requireApiToken:O}),disabled:B})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(le,{className:"text-sm font-medium",children:r("registry.registrySettingsPage.rateLimit")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.rateLimitHelp")})]}),t.jsx(Ge,{id:"publish-rate-limit",checked:m,onCheckedChange:O=>x({rateLimitEnabled:O}),disabled:B})]}),m&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(le,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:r("registry.registrySettingsPage.maxRequests")}),t.jsx(je,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:R,onChange:O=>P(O.target.value),onBlur:ne,disabled:B,placeholder:r("registry.registrySettingsPage.maxRequestsPlaceholder")})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(le,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:r("registry.registrySettingsPage.window")}),t.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",value:h,onChange:O=>x({rateLimitWindow:O.target.value}),disabled:B,children:[t.jsx("option",{value:"minute",children:r("registry.registrySettingsPage.perMinute")}),t.jsx("option",{value:"hour",children:r("registry.registrySettingsPage.perHour")})]})]})]}),a&&u&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[t.jsx(_r,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:r("registry.registrySettingsPage.apiKeys")})]}),s&&!w&&t.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:r("registry.registrySettingsPage.newKeyRefreshing")}),t.jsx(je,{readOnly:!0,value:s,className:"h-8 text-xs font-mono bg-background"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs("div",{className:"grid gap-1.5 flex-1",children:[t.jsx(le,{htmlFor:"api-key-name",className:"text-xs",children:r("registry.registrySettingsPage.keyName")}),t.jsx(je,{id:"api-key-name",value:T,onChange:O=>$(O.target.value),placeholder:r("registry.registrySettingsPage.keyNamePlaceholder"),className:"h-8 text-sm"})]}),t.jsxs(Q,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!T.trim()||N.isPending,onClick:ie,children:[N.isPending?t.jsx(Ye,{size:14,className:"animate-spin"}):t.jsx(Pr,{size:14}),r("registry.registrySettingsPage.generate")]})]}),(D.data?.items?.length??0)>0&&t.jsx("div",{className:"grid gap-2",children:D.data?.items?.map(O=>t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[t.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium truncate leading-none",children:O.name}),re===O.prefix?t.jsx(je,{readOnly:!0,value:M?s??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):t.jsx(je,{readOnly:!0,value:`${O.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[re===O.prefix&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>A(pe=>!pe),children:M?t.jsx(ir,{size:14}):t.jsx(ys,{size:14})}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!s,onClick:()=>s&&J(s),children:ue?t.jsx(Lt,{size:14}):t.jsx(At,{size:14})})]}),t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:k.isPending,onClick:()=>F({id:O.id,name:O.name}),children:t.jsx(ut,{size:14})})]})]},O.id))})]})]})]})]}),t.jsx(dt,{open:!!U,onOpenChange:O=>{!O&&!k.isPending&&F(null)},children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:r("registry.registrySettingsPage.revokeApiKeyTitle")}),t.jsx(it,{children:r("registry.registrySettingsPage.revokeApiKeyDescription",{keyName:U?.name??""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{disabled:k.isPending,children:r("registry.registrySettingsPage.cancel")}),t.jsx(at,{disabled:!U||k.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>U&&Se(U.id),children:k.isPending?r("registry.registrySettingsPage.revoking"):r("registry.registrySettingsPage.revokeKey")})]})]})})]})}function Di(s){const e=X.c(8),{results:r}=s,i=oe();if(r.length===0){let l;e[0]!==i?(l=i("registry.brokenMcpList.noBrokenMcps"),e[0]=i,e[1]=l):l=e[1];let o;return e[2]!==l?(o=t.jsx(ge,{className:"p-4 text-sm text-muted-foreground text-center",children:l}),e[2]=l,e[3]=o):o=e[3],o}let n;e[4]!==r?(n=r.map(Ti),e[4]=r,e[5]=n):n=e[5];let c;return e[6]!==n?(c=t.jsx("div",{className:"space-y-2",children:n}),e[6]=n,e[7]=c):c=e[7],c}function Ti(s){return t.jsx(Mi,{result:s},s.id)}function Mi(s){const e=X.c(56),{result:r}=s,i=oe(),[n,c]=q.useState(!1);let l;if(e[0]!==n||e[1]!==r.action_taken||e[2]!==r.connection_ok||e[3]!==r.duration_ms||e[4]!==r.error_message||e[5]!==r.id||e[6]!==r.item_title||e[7]!==r.status||e[8]!==r.tool_results||e[9]!==r.tools_listed||e[10]!==i){const o=r.tool_results.filter(Li);let a;e[12]!==n?(a=()=>c(!n),e[12]=n,e[13]=a):a=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-destructive text-sm mt-0.5",children:"✗"}),e[14]=u):u=e[14];let d;e[15]!==r.item_title?(d=t.jsx("h4",{className:"text-sm font-medium truncate",children:r.item_title}),e[15]=r.item_title,e[16]=d):d=e[16];let m;e[17]!==r.status?(m=r.status.replace("_"," "),e[17]=r.status,e[18]=m):m=e[18];let h;e[19]!==m?(h=t.jsx(H,{variant:"destructive",className:"capitalize text-[10px] shrink-0",children:m}),e[19]=m,e[20]=h):h=e[20];let g;e[21]!==d||e[22]!==h?(g=t.jsxs("div",{className:"flex items-center gap-2",children:[d,h]}),e[21]=d,e[22]=h,e[23]=g):g=e[23];let p;e[24]!==i?(p=i("registry.brokenMcpList.connStatus"),e[24]=i,e[25]=p):p=e[25];const x=r.connection_ok?"✓":"✗";let f;e[26]!==p||e[27]!==x?(f=t.jsxs("span",{children:[p,":"," ",x]}),e[26]=p,e[27]=x,e[28]=f):f=e[28];let y;e[29]!==i?(y=i("registry.brokenMcpList.toolsListed"),e[29]=i,e[30]=y):y=e[30];const v=r.tools_listed?"✓":"✗";let C;e[31]!==y||e[32]!==v?(C=t.jsxs("span",{children:[y,":"," ",v]}),e[31]=y,e[32]=v,e[33]=C):C=e[33];let _;e[34]!==r.duration_ms?(_=t.jsxs("span",{children:[r.duration_ms,"ms"]}),e[34]=r.duration_ms,e[35]=_):_=e[35];const b=o.length>0&&t.jsx("span",{className:"text-destructive",children:i("registry.brokenMcpList.toolsFailed",{count:o.length})});let L;e[36]!==r.action_taken?(L=r.action_taken!=="none"&&t.jsx(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:r.action_taken.replace(/_/g," ")}),e[36]=r.action_taken,e[37]=L):L=e[37];let I;e[38]!==f||e[39]!==C||e[40]!==_||e[41]!==b||e[42]!==L?(I=t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[f,C,_,b,L]}),e[38]=f,e[39]=C,e[40]=_,e[41]=b,e[42]=L,e[43]=I):I=e[43];let R;e[44]!==r.error_message?(R=r.error_message&&t.jsx("p",{className:"text-xs text-destructive line-clamp-2",children:r.error_message}),e[44]=r.error_message,e[45]=R):R=e[45];let P;e[46]!==I||e[47]!==R||e[48]!==g?(P=t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[g,I,R]}),e[46]=I,e[47]=R,e[48]=g,e[49]=P):P=e[49];const S=n?"▲":"▼";let E;e[50]!==S?(E=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:S}),e[50]=S,e[51]=E):E=e[51];let D;e[52]!==P||e[53]!==a||e[54]!==E?(D=t.jsxs("button",{type:"button",className:"w-full text-left p-3 flex items-start gap-3 hover:bg-muted/30 transition-colors",onClick:a,children:[u,P,E]}),e[52]=P,e[53]=a,e[54]=E,e[55]=D):D=e[55],l=t.jsxs(ge,{className:"overflow-hidden",children:[D,n&&t.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[r.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.brokenMcpList.fullError")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2.5 py-1.5 whitespace-pre-wrap break-all text-destructive",children:r.error_message})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.connectionLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?i("registry.brokenMcpList.statusOk"):i("registry.brokenMcpList.statusFailed")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.toolsListedLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?i("registry.brokenMcpList.yes"):i("registry.brokenMcpList.no")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.brokenMcpList.durationLabel")}),t.jsxs("p",{className:"text-xs font-medium",children:[r.duration_ms,"ms"]})]})]}),o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.brokenMcpList.failedToolsHeader",{count:o.length})}),o.map(N=>t.jsxs("div",{className:"rounded border border-destructive/10 bg-destructive/5 px-2.5 py-1.5 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono font-medium text-destructive",children:N.toolName}),t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[N.durationMs,"ms"]})]}),N.error&&t.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-destructive",children:N.error})]},`${r.id}-${N.toolName}`))]}),r.tool_results.length>0&&r.tool_results.some(Ei)&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.brokenMcpList.passingTools")}),t.jsx("div",{className:"flex flex-wrap gap-1",children:r.tool_results.filter(qi).map(N=>t.jsxs(H,{variant:"secondary",className:"text-[10px]",children:["✓ ",N.toolName]},`${r.id}-${N.toolName}-pass`))})]})]})]}),e[0]=n,e[1]=r.action_taken,e[2]=r.connection_ok,e[3]=r.duration_ms,e[4]=r.error_message,e[5]=r.id,e[6]=r.item_title,e[7]=r.status,e[8]=r.tool_results,e[9]=r.tools_listed,e[10]=i,e[11]=l}else l=e[11];return l}function qi(s){return s.success}function Ei(s){return s.success}function Li(s){return!s.success}function Ai(s,e){return s.onFailure!==e.onFailure||s.perMcpTimeoutMs!==e.perMcpTimeoutMs||s.perToolTimeoutMs!==e.perToolTimeoutMs||s.maxAgentSteps!==e.maxAgentSteps||s.testPublicOnly!==e.testPublicOnly||s.testPrivateOnly!==e.testPrivateOnly||s.includePendingRequests!==e.includePendingRequests||(s.agentContext??"")!==(e.agentContext??"")}function Ui(){const s=oe(),{settings:e,saveMutation:r}=vs(),i=q.useRef(e),[n,c]=q.useState(e),[l,o]=q.useState(!1),[a,u]=q.useState(!1);i.current!==e&&(i.current=e,c(e));const d=Ai(n,e),m=g=>{o(!1),c(p=>({...p,...g}))},h=async()=>{const g={...n,agentContext:(n.agentContext??"").trim()};await r.mutateAsync(g),c(g),o(!0),setTimeout(()=>o(!1),3e3)};return t.jsxs(ge,{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:s("registry.monitorConfiguration.qaConfiguration")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("registry.monitorConfiguration.description")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[d&&t.jsx(H,{className:"bg-warning/10 text-warning border-warning/20 text-[10px]",children:s("registry.monitorConfiguration.unsavedChanges")}),l&&t.jsxs(H,{className:"bg-success/10 text-success border-success/20 text-[10px]",children:["✓ ",s("registry.monitorConfiguration.saved")]}),t.jsx(Q,{size:"sm",onClick:h,disabled:r.isPending||!d,children:r.isPending?s("registry.monitorConfiguration.saving"):s("registry.monitorConfiguration.saveSettings")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.onFailureLabel"),hint:s("registry.monitorConfiguration.onFailureHint")}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:n.onFailure,onChange:g=>m({onFailure:g.target.value}),children:[t.jsx("option",{value:"none",children:s("registry.monitorConfiguration.onFailureNone")}),t.jsx("option",{value:"unlisted",children:s("registry.monitorConfiguration.onFailureUnlisted")}),t.jsx("option",{value:"remove_public",children:s("registry.monitorConfiguration.onFailureRemovePublic")}),t.jsx("option",{value:"remove_private",children:s("registry.monitorConfiguration.onFailureRemovePrivate")}),t.jsx("option",{value:"remove_all",children:s("registry.monitorConfiguration.onFailureRemoveAll")})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.testScopeLabel"),hint:s("registry.monitorConfiguration.testScopeHint")}),t.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.testPublicOnly,onChange:g=>m({testPublicOnly:g.target.checked,testPrivateOnly:g.target.checked?!1:n.testPrivateOnly})}),s("registry.monitorConfiguration.publicOnly")]}),t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.testPrivateOnly,onChange:g=>m({testPrivateOnly:g.target.checked,testPublicOnly:g.target.checked?!1:n.testPublicOnly})}),s("registry.monitorConfiguration.privateOnly")]})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.publishRequestsLabel"),hint:s("registry.monitorConfiguration.publishRequestsHint")}),t.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:n.includePendingRequests,onChange:g=>m({includePendingRequests:g.target.checked})}),s("registry.monitorConfiguration.includePendingRequests")]})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx(He,{label:s("registry.monitorConfiguration.additionalTestContextLabel"),hint:s("registry.monitorConfiguration.additionalTestContextHint")}),t.jsxs(Q,{size:"sm",variant:"outline",className:"h-7",onClick:()=>u(g=>!g),children:[s(a?"registry.monitorConfiguration.hideDefaultPrompt":"registry.monitorConfiguration.viewDefaultPrompt")," ",s("registry.monitorConfiguration.defaultSystemPrompt")]})]}),t.jsx(Rt,{value:n.agentContext??"",onChange:g=>m({agentContext:g.target.value}),placeholder:s("registry.monitorConfiguration.agentContextPlaceholder"),rows:3}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:s("registry.monitorConfiguration.agentContextHelper")}),a&&t.jsx("pre",{className:"text-[11px] bg-muted/50 border border-border rounded px-3 py-2 whitespace-pre-wrap max-h-64 overflow-auto",children:Sr})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.perMcpTimeoutLabel"),hint:s("registry.monitorConfiguration.perMcpTimeoutHint")}),t.jsx(je,{type:"number",value:n.perMcpTimeoutMs,onChange:g=>m({perMcpTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.perToolTimeoutLabel"),hint:s("registry.monitorConfiguration.perToolTimeoutHint")}),t.jsx(je,{type:"number",value:n.perToolTimeoutMs,onChange:g=>m({perToolTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(He,{label:s("registry.monitorConfiguration.maxAgentStepsLabel"),hint:s("registry.monitorConfiguration.maxAgentStepsHint")}),t.jsx(je,{type:"number",value:n.maxAgentSteps,onChange:g=>m({maxAgentSteps:Number(g.target.value)}),min:1,max:30})]})]})]})}function He(s){const e=X.c(16),{label:r,hint:i}=s,n=oe();let c;e[0]!==r?(c=t.jsx(le,{children:r}),e[0]=r,e[1]=c):c=e[1];let l;e[2]!==r||e[3]!==n?(l=n("registry.monitorConfiguration.aboutLabel",{label:r}),e[2]=r,e[3]=n,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Zs,{size:14}),e[5]=o):o=e[5];let a;e[6]!==l?(a=t.jsx(Qs,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":l,children:o})}),e[6]=l,e[7]=a):a=e[7];let u;e[8]!==i?(u=t.jsx(Ys,{side:"top",className:"max-w-72",children:i}),e[8]=i,e[9]=u):u=e[9];let d;e[10]!==a||e[11]!==u?(d=t.jsxs(Ws,{children:[a,u]}),e[10]=a,e[11]=u,e[12]=d):d=e[12];let m;return e[13]!==c||e[14]!==d?(m=t.jsxs("div",{className:"flex items-center gap-1.5",children:[c,d]}),e[13]=c,e[14]=d,e[15]=m):m=e[15],m}function Fi(s){switch(s){case"authenticated":return"bg-success/10 text-success border-success/20";case"needs_auth":return"bg-warning/10 text-warning border-warning/20";default:return"bg-muted text-muted-foreground border-border"}}function $i(s,e){switch(s){case"authenticated":return e("registry.monitorConnectionsPanel.authenticated");case"needs_auth":return e("registry.monitorConnectionsPanel.needsAuth");default:return e("registry.monitorConnectionsPanel.notChecked")}}function zi(s){const e=X.c(4),{icon:r,title:i}=s,[n,c]=q.useState(!1);let l;return e[0]!==r||e[1]!==n||e[2]!==i?(l=t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:r&&!n?t.jsx("img",{src:r,alt:i,className:"h-full w-full object-cover",loading:"lazy",onError:()=>c(!0)}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:i.charAt(0).toUpperCase()})}),e[0]=r,e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function Oi({entry:s,onAuthChanged:e,failedToolsCount:r,failedResultCount:i}){const[n,c]=q.useState(!1),[l,o]=q.useState(""),[a,u]=q.useState(!1),d=oe(),m=Er(),{updateMutation:h}=Ht(),{org:g}=Ne(),p=Me(),x=Ue(),f=s.mapping.connection_id,y=s.mapping.auth_status,v=s.item?.title??s.mapping.item_id,C=s.item?.server?.icons?.[0]?.src??null,_=s.item?.is_public??!1,b=s.item?.is_unlisted??!1,L=s.source==="request",I=Ae({queryKey:Y.monitorConnectionAuthProbe(g.id,f),queryFn:async()=>Rr({url:`/api/${g.slug}/mcp/${f}`,token:null,orgId:g.id}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),R=I.data,P=I.isLoading,S=R?.supportsOAuth??!1,E=R?.hasOAuthToken??!1,D=R?.isServerError??!1,N=R?.isAuthenticated??!1,k=D?void 0:R?.error,T=P?"checking":D?"server_error":k?"unreachable":S?N?E?"oauth_connected":"connected":"oauth_available":N?"connected":"token_required",$=()=>{m.mutate({connectionId:f,authStatus:"authenticated"},{onSuccess:()=>{e(),Js(f),x.invalidateQueries({predicate:K=>K.queryKey[1]===Xs&&K.queryKey[3]===f})},onError:K=>V.error(d("registry.monitorConnectionsPanel.failedToSaveAuthStatus",{title:v,error:K instanceof Error?K.message:String(K)}))})},M=async()=>{c(!0);try{const W=(await I.refetch()).data;if(!W){V.error(d("registry.monitorConnectionsPanel.couldNotReachConnection",{title:v}));return}if(W.isAuthenticated){V.success(d("registry.monitorConnectionsPanel.connectionReachable",{title:v}));return}if(W.isServerError){V.error(d("registry.monitorConnectionsPanel.serverErrorConnection",{title:v}));return}if(W.error){V.error(d("registry.monitorConnectionsPanel.connectionUnreachable",{title:v,error:W.error}));return}if(!W.supportsOAuth){V.warning(d("registry.monitorConnectionsPanel.noOAuthSupport",{title:v}));return}V.info(d("registry.monitorConnectionsPanel.openingAuthWindow",{title:v}));const J=await kr({connectionId:f,orgSlug:g.slug,clientName:`MCP Test - ${v}`,timeout:18e4,scope:"offline_access"});if(J.error){V.error(d("registry.monitorConnectionsPanel.oauthFailed",{title:v,error:J.error}));return}if(J.tokenInfo){if(!(await fetch(`/api/${g.slug}/connections/${f}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:J.tokenInfo.accessToken,refreshToken:J.tokenInfo.refreshToken,expiresIn:J.tokenInfo.expiresIn,scope:J.tokenInfo.scope,clientId:J.tokenInfo.clientId,clientSecret:J.tokenInfo.clientSecret,tokenEndpoint:J.tokenInfo.tokenEndpoint})})).ok)if(J.token)await A(J.token);else{V.error(d("registry.monitorConnectionsPanel.failedToSaveOAuthTokens",{title:v}));return}}else J.token&&await A(J.token);V.success(d("registry.monitorConnectionsPanel.connectionAuthenticated",{title:v})),$(),await I.refetch()}catch(K){console.error("[MonitorConnectionsPanel] Auth error:",K),V.error(d("registry.monitorConnectionsPanel.authError",{error:K instanceof Error?K.message:String(K)}))}finally{c(!1)}},A=async K=>{await p.call("COLLECTION_CONNECTIONS_UPDATE",{id:f,data:{connection_token:K}})},U=async()=>{if(!l.trim()){V.error(d("registry.monitorConnectionsPanel.tokenCannotBeEmpty"));return}c(!0);try{await A(l),V.success(d("registry.monitorConnectionsPanel.tokenSaved",{title:v})),u(!1),o(""),$(),await I.refetch()}catch(K){V.error(d("registry.monitorConnectionsPanel.errorSavingToken",{error:K instanceof Error?K.message:String(K)}))}finally{c(!1)}},F=!P&&y==="authenticated"&&!E&&!a&&l.length===0,j=P&&y==="authenticated"&&!a&&l.length===0,z=async K=>{if(L){V.info(d("registry.monitorConnectionsPanel.visibilityOnlyForStore"));return}if(!s.item){V.error(d("registry.monitorConnectionsPanel.registryItemNotFound"));return}try{await h.mutateAsync({id:s.item.id,data:K}),V.success(d("registry.monitorConnectionsPanel.visibilityUpdated")),e()}catch(W){V.error(W instanceof Error?W.message:d("registry.monitorConnectionsPanel.failedToUpdateVisibility"))}};return t.jsxs(ge,{className:"p-3 space-y-3 h-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.jsx(zi,{icon:C,title:v},C??v),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v}),t.jsx("p",{className:"text-xs text-muted-foreground break-all",children:s.remoteUrl??"-"}),t.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[t.jsx(H,{variant:"outline",className:te("text-[10px]",Fi(y)),children:$i(y,d)}),t.jsx(H,{variant:_?"default":"secondary",className:"text-[10px]",children:d(_?"registry.monitorConnectionsPanel.public":"registry.monitorConnectionsPanel.notPublic")}),t.jsx(H,{variant:"outline",className:"text-[10px]",children:d(L?"registry.monitorConnectionsPanel.request":"registry.monitorConnectionsPanel.store")}),t.jsxs(H,{variant:"outline",className:te("text-[10px]",T==="server_error"||T==="unreachable"?"border-destructive/40 text-destructive":T==="oauth_connected"?"border-success/30 text-success":T==="oauth_available"?"border-sky-500/30 text-sky-600":T==="token_required"?"border-warning/30 text-warning":"text-muted-foreground"),children:[T==="checking"&&d("registry.monitorConnectionsPanel.checkingAuth"),T==="server_error"&&d("registry.monitorConnectionsPanel.serverError"),T==="unreachable"&&d("registry.monitorConnectionsPanel.unreachable"),T==="oauth_connected"&&d("registry.monitorConnectionsPanel.oauthConnected"),T==="oauth_available"&&d("registry.monitorConnectionsPanel.oauthAvailable"),T==="token_required"&&d("registry.monitorConnectionsPanel.tokenManualAuth"),T==="connected"&&d("registry.monitorConnectionsPanel.connected")]}),b&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:d("registry.monitorConnectionsPanel.hiddenInPrivate")}),(i>0||r>0)&&t.jsx(H,{variant:"destructive",className:"text-[10px]",children:d("registry.monitorConnectionsPanel.failedCount",{mcpCount:i,toolsCount:r})})]})]})]}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs(jt,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":d("registry.monitorConnectionsPanel.actionsFor",{title:v}),children:t.jsx(Bt,{size:16})})}),t.jsx(yt,{align:"end",children:L?t.jsx(Ie,{disabled:!0,children:d("registry.monitorConnectionsPanel.requestItemNoControls")}):t.jsxs(t.Fragment,{children:[t.jsx(Ie,{onClick:()=>z({is_public:!1}),children:d("registry.monitorConnectionsPanel.hideFromPublicStore")}),t.jsx(Ie,{onClick:()=>z({is_unlisted:!0}),children:d("registry.monitorConnectionsPanel.hideFromPrivateStore")}),t.jsx(Ie,{onClick:()=>z({is_public:!0,is_unlisted:!1}),children:d("registry.monitorConnectionsPanel.showInBothStores")})]})})]})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[S&&t.jsx(Q,{size:"sm",onClick:M,disabled:n,children:n?"...":d(E?"registry.monitorConnectionsPanel.reAuthOAuth":"registry.monitorConnectionsPanel.oauth")}),t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>I.refetch(),disabled:n||P,children:d(P?"registry.monitorConnectionsPanel.checking":"registry.monitorConnectionsPanel.reCheck")})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:d("registry.monitorConnectionsPanel.tokenApiKeyDescription")}),j?t.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/30 text-muted-foreground text-xs",children:d("registry.monitorConnectionsPanel.checkingAuth")}):F?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/50 text-muted-foreground font-mono text-xs",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>u(!0),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted",title:d("registry.monitorConnectionsPanel.replaceToken"),children:d("registry.monitorConnectionsPanel.edit")})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(je,{type:"password",placeholder:d("registry.monitorConnectionsPanel.pasteApiTokenPlaceholder"),value:l,onChange:K=>o(K.target.value),className:"h-8 text-xs flex-1",onKeyDown:K=>{K.key==="Enter"&&!n&&l.trim()&&U()}}),t.jsx(Q,{size:"sm",className:"h-8 text-xs",onClick:U,disabled:n||!l.trim(),children:d("registry.monitorConnectionsPanel.save")}),t.jsx(Q,{size:"sm",variant:"ghost",className:"h-8 text-xs","aria-label":d("registry.monitorConnectionsPanel.cancelReplaceToken"),onClick:()=>{u(!1),o("")},children:"✕"})]})]})]})}function Bi(){const s=X.c(87),e=oe(),r=js(),n=It("completed").data?.items?.[0],c=mt(n?.id,void 0,n?.status),l=qr(),[o,a]=q.useState("all");let u,d,m,h,g,p;if(s[0]!==r||s[1]!==c.data?.items||s[2]!==o||s[3]!==l||s[4]!==e){const y=r.data?.items??[];let v;s[11]!==c.data?.items?(v=(c.data?.items??[]).reduce(Ki,{}),s[11]=c.data?.items,s[12]=v):v=s[12];const C=v;let _;s[13]!==o?(_=B=>o==="all"?!0:B.source===o,s[13]=o,s[14]=_):_=s[14];const b=y.filter(_);u=ge,g="p-4 space-y-3";let L;s[15]!==e?(L=e("registry.monitorConnectionsPanel.title"),s[15]=e,s[16]=L):L=s[16];let I;s[17]!==L?(I=t.jsx("h3",{className:"text-sm font-semibold",children:L}),s[17]=L,s[18]=I):I=s[18];let R;s[19]!==e?(R=e("registry.monitorConnectionsPanel.description1"),s[19]=e,s[20]=R):R=s[20];let P;s[21]!==R?(P=t.jsx("p",{className:"text-[10px] text-muted-foreground",children:R}),s[21]=R,s[22]=P):P=s[22];let S;s[23]!==e?(S=e("registry.monitorConnectionsPanel.description2"),s[23]=e,s[24]=S):S=s[24];let E;s[25]!==S?(E=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S}),s[25]=S,s[26]=E):E=s[26];let D;s[27]!==e?(D=e("registry.monitorConnectionsPanel.description3"),s[27]=e,s[28]=D):D=s[28];let N;s[29]!==D?(N=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:D}),s[29]=D,s[30]=N):N=s[30];const k=o==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let T;s[31]!==k?(T=te("px-2.5 py-1 text-xs rounded-md transition-colors",k),s[31]=k,s[32]=T):T=s[32];let $;s[33]===Symbol.for("react.memo_cache_sentinel")?($=()=>a("all"),s[33]=$):$=s[33];let M;s[34]!==e?(M=e("registry.monitorConnectionsPanel.filterAll"),s[34]=e,s[35]=M):M=s[35];let A;s[36]!==T||s[37]!==M?(A=t.jsx("button",{type:"button",className:T,onClick:$,children:M}),s[36]=T,s[37]=M,s[38]=A):A=s[38];const U=o==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let F;s[39]!==U?(F=te("px-2.5 py-1 text-xs rounded-md transition-colors",U),s[39]=U,s[40]=F):F=s[40];let j;s[41]===Symbol.for("react.memo_cache_sentinel")?(j=()=>a("store"),s[41]=j):j=s[41];let z;s[42]!==e?(z=e("registry.monitorConnectionsPanel.filterStore"),s[42]=e,s[43]=z):z=s[43];let K;s[44]!==F||s[45]!==z?(K=t.jsx("button",{type:"button",className:F,onClick:j,children:z}),s[44]=F,s[45]=z,s[46]=K):K=s[46];const W=o==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let J;s[47]!==W?(J=te("px-2.5 py-1 text-xs rounded-md transition-colors",W),s[47]=W,s[48]=J):J=s[48];let ue;s[49]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>a("request"),s[49]=ue):ue=s[49];let ce;s[50]!==e?(ce=e("registry.monitorConnectionsPanel.filterRequests"),s[50]=e,s[51]=ce):ce=s[51];let se;s[52]!==J||s[53]!==ce?(se=t.jsx("button",{type:"button",className:J,onClick:ue,children:ce}),s[52]=J,s[53]=ce,s[54]=se):se=s[54];let xe;s[55]!==A||s[56]!==K||s[57]!==se?(xe=t.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[A,K,se]}),s[55]=A,s[56]=K,s[57]=se,s[58]=xe):xe=s[58];let me;s[59]!==P||s[60]!==E||s[61]!==N||s[62]!==xe||s[63]!==I?(me=t.jsxs("div",{children:[I,P,E,N,xe]}),s[59]=P,s[60]=E,s[61]=N,s[62]=xe,s[63]=I,s[64]=me):me=s[64];let ae;s[65]!==l||s[66]!==e?(ae=()=>{l.mutate(void 0,{onSuccess:()=>V.success(e("registry.monitorConnectionsPanel.connectionsSynced")),onError:B=>V.error(e("registry.monitorConnectionsPanel.syncFailed",{error:B.message}))})},s[65]=l,s[66]=e,s[67]=ae):ae=s[67];let re;s[68]!==l.isPending||s[69]!==e?(re=l.isPending?e("registry.monitorConnectionsPanel.syncing"):e("registry.monitorConnectionsPanel.sync"),s[68]=l.isPending,s[69]=e,s[70]=re):re=s[70];let w;s[71]!==l.isPending||s[72]!==ae||s[73]!==re?(w=t.jsx(Q,{size:"sm",variant:"outline",onClick:ae,disabled:l.isPending,children:re}),s[71]=l.isPending,s[72]=ae,s[73]=re,s[74]=w):w=s[74],s[75]!==me||s[76]!==w?(p=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[me,w]}),s[75]=me,s[76]=w,s[77]=p):p=s[77],d="space-y-2",m=r.isLoading?t.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:e("registry.monitorConnectionsPanel.loadingConnections")}):r.isError?t.jsxs("div",{className:"p-8 text-center rounded-lg border border-border",children:[t.jsx("p",{className:"text-sm text-destructive",children:e("registry.monitorConnectionsPanel.loadFailed")}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.error instanceof Error?r.error.message:e("registry.monitorConnectionsPanel.unknownError")})]}):b.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:e("registry.monitorConnectionsPanel.noConnectionsForFilter")}),h=!r.isLoading&&!r.isError&&b.length>0&&t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:b.map(B=>{const Z=C[B.mapping.item_id]??{failedTools:0,failedResults:0};return t.jsx(Oi,{entry:B,onAuthChanged:()=>r.refetch(),failedToolsCount:Z.failedTools,failedResultCount:Z.failedResults},B.mapping.id)})}),s[0]=r,s[1]=c.data?.items,s[2]=o,s[3]=l,s[4]=e,s[5]=u,s[6]=d,s[7]=m,s[8]=h,s[9]=g,s[10]=p}else u=s[5],d=s[6],m=s[7],h=s[8],g=s[9],p=s[10];let x;s[78]!==d||s[79]!==m||s[80]!==h?(x=t.jsxs("div",{className:d,children:[m,h]}),s[78]=d,s[79]=m,s[80]=h,s[81]=x):x=s[81];let f;return s[82]!==u||s[83]!==g||s[84]!==p||s[85]!==x?(f=t.jsxs(u,{className:g,children:[p,x]}),s[82]=u,s[83]=g,s[84]=p,s[85]=x,s[86]=f):f=s[86],f}function Ki(s,e){const r=s[e.item_id]??{failedTools:0,failedResults:0},i=e.tool_results.filter(Hi).length;return r.failedTools=r.failedTools+i,(e.status==="failed"||e.status==="error")&&(r.failedResults=r.failedResults+1),s[e.item_id]=r,s}function Hi(s){return!s.success}function Rs(s){switch(s){case"running":return"bg-primary/10 text-primary border-primary/20";case"completed":return"bg-success/10 text-success border-success/20";case"failed":return"bg-destructive/10 text-destructive border-destructive/20";case"cancelled":return"bg-muted text-muted-foreground border-border";case"pending":return"bg-warning/10 text-warning border-warning/20";default:return""}}function ks(s,e){if(!s)return null;const r=e?new Date(e).getTime():Date.now(),i=new Date(s).getTime(),n=r-i;return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function Vi(s){const e=new Map;for(const r of s)e.has(r.toolName)&&e.delete(r.toolName),e.set(r.toolName,r);return Array.from(e.values())}function Is(s){const e=Vi(s),r=e.every(l=>l.outputPreview==="health_check: not called"),i=e.filter(l=>l.outputPreview!=="health_check: not called"),n=i.filter(l=>l.success).length,c=i.filter(l=>!l.success).length;return{latestToolResults:e,realToolTests:i,isHealthCheck:r,passedTools:n,failedTools:c,hasToolTests:i.length>0}}function Gi(s){return s.total_items?Math.min(100,Math.round(s.tested_items/s.total_items*100)):0}function Qi(s){if(!s)return null;const e=s.match(/Not executed tools \((\d+)\/(\d+)\):/i);if(!e)return null;const r=Number(e[2]);return Number.isFinite(r)&&r>=0?r:null}function Yi(s){const e=X.c(45),{result:r,index:i,icon:n}=s,c=oe(),[l,o]=q.useState(!1);let a;if(e[0]!==l||e[1]!==n||e[2]!==i||e[3]!==r.action_taken||e[4]!==r.agent_summary||e[5]!==r.connection_ok||e[6]!==r.duration_ms||e[7]!==r.error_message||e[8]!==r.id||e[9]!==r.item_title||e[10]!==r.status||e[11]!==r.tool_results||e[12]!==r.tools_listed||e[13]!==c){const{latestToolResults:u,realToolTests:d,isHealthCheck:m,passedTools:h,failedTools:g,hasToolTests:p}=Is(r.tool_results),x=d.length;let f;e[15]!==r.agent_summary?(f=Qi(r.agent_summary),e[15]=r.agent_summary,e[16]=f):f=e[16];const y=f,v=Math.max(u.length,y??0),C=v>0?c("registry.monitorDashboard.toolsTestedCount",{tested:x,discovered:v}):c("registry.monitorDashboard.noTools");let _;e[17]!==l?(_=()=>o(!l),e[17]=l,e[18]=_):_=e[18];const b=i+1;let L;e[19]!==b?(L=t.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:b}),e[19]=b,e[20]=L):L=e[20];let I;e[21]!==n||e[22]!==r.item_title?(I=t.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:n?t.jsx("img",{src:n,alt:r.item_title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:r.item_title.charAt(0).toUpperCase()})}),e[21]=n,e[22]=r.item_title,e[23]=I):I=e[23];const R=r.status==="passed"?"text-success":r.status==="needs_auth"?"text-warning":"text-destructive";let P;e[24]!==R?(P=te("shrink-0",R),e[24]=R,e[25]=P):P=e[25];const S=r.status==="passed"?"✓":r.status==="needs_auth"?"🔑":"✗";let E;e[26]!==P||e[27]!==S?(E=t.jsx("span",{className:P,children:S}),e[26]=P,e[27]=S,e[28]=E):E=e[28];let D;e[29]!==r.item_title?(D=t.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:r.item_title}),e[29]=r.item_title,e[30]=D):D=e[30];let N;e[31]!==r.duration_ms?(N=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[r.duration_ms,"ms"]}),e[31]=r.duration_ms,e[32]=N):N=e[32];const k=r.status==="passed"?"text-success border-success/20":r.status==="needs_auth"?"text-warning border-warning/20":"text-destructive border-destructive/20";let T;e[33]!==k?(T=te("text-[9px] capitalize shrink-0",k),e[33]=k,e[34]=T):T=e[34];let $;e[35]!==r.status?($=r.status.replace("_"," "),e[35]=r.status,e[36]=$):$=e[36];let M;e[37]!==T||e[38]!==$?(M=t.jsx(H,{variant:"outline",className:T,children:$}),e[37]=T,e[38]=$,e[39]=M):M=e[39];let A;e[40]!==r.connection_ok||e[41]!==c?(A=r.connection_ok?t.jsx("span",{className:"text-[10px] text-success shrink-0",title:c("registry.monitorDashboard.connOkTitle"),children:"conn✓"}):t.jsx("span",{className:"text-[10px] text-destructive shrink-0",title:c("registry.monitorDashboard.connFailTitle"),children:"conn✗"}),e[40]=r.connection_ok,e[41]=c,e[42]=A):A=e[42];const U=l?"▲":"▼";let F;e[43]!==U?(F=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:U}),e[43]=U,e[44]=F):F=e[44],a=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[t.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors",onClick:_,children:[L,I,E,D,N,M,A,r.tools_listed&&t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-success",children:[h,"✓"]})," ",t.jsxs("span",{className:te(g>0?"text-destructive":""),children:[g,"✗"]})]}):m&&u.length>0?t.jsx("span",{children:c("registry.monitorDashboard.toolsFoundCount",{count:u.length})}):c("registry.monitorDashboard.noToolsLabel")}),t.jsx(H,{variant:"outline",className:"text-[9px] shrink-0",children:C}),F]}),l&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[r.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:c("registry.monitorDashboard.errorLabel")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-destructive max-h-20 overflow-auto",children:r.error_message})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[t.jsxs("span",{children:[c("registry.monitorDashboard.connectionLabel")," ",t.jsx("span",{className:te(r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?c("registry.monitorDashboard.statusOk"):c("registry.monitorDashboard.statusFailed")})]}),t.jsxs("span",{children:[c("registry.monitorDashboard.toolsListedLabel")," ",t.jsx("span",{className:te(r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?c("registry.monitorDashboard.yes"):c("registry.monitorDashboard.no")})]}),r.action_taken!=="none"&&t.jsxs(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",r.action_taken]})]}),p?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:c("registry.monitorDashboard.toolsTestedDetails",{passed:h,failed:g})}),t.jsx("div",{className:"space-y-0.5",children:d.map((j,z)=>t.jsx(Wi,{tool:j},`${r.id}-${j.toolName}-${z}`))})]}):m&&u.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:c("registry.monitorDashboard.toolsDiscoveredHealthCheck",{count:u.length})}),t.jsx("div",{className:"flex flex-wrap gap-1",children:u.map((j,z)=>t.jsx(H,{variant:"outline",className:"text-[10px] font-mono",children:j.toolName},`${r.id}-${j.toolName}-${z}`))})]}):r.tools_listed?t.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:c("registry.monitorDashboard.noToolsFound")}):null,r.agent_summary&&t.jsx("p",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5",children:r.agent_summary})]})]}),e[0]=l,e[1]=n,e[2]=i,e[3]=r.action_taken,e[4]=r.agent_summary,e[5]=r.connection_ok,e[6]=r.duration_ms,e[7]=r.error_message,e[8]=r.id,e[9]=r.item_title,e[10]=r.status,e[11]=r.tool_results,e[12]=r.tools_listed,e[13]=c,e[14]=a}else a=e[14];return a}function Wi(s){const e=X.c(31),{tool:r}=s,i=oe(),[n,c]=q.useState(!1);let l;e[0]!==n?(l=()=>c(!n),e[0]=n,e[1]=l):l=e[1];const o=r.success?"text-success":"text-destructive";let a;e[2]!==o?(a=te("font-bold",o),e[2]=o,e[3]=a):a=e[3];const u=r.success?"✓":"✗";let d;e[4]!==a||e[5]!==u?(d=t.jsx("span",{className:a,children:u}),e[4]=a,e[5]=u,e[6]=d):d=e[6];let m;e[7]!==r.toolName?(m=t.jsx("span",{className:"font-mono truncate flex-1",children:r.toolName}),e[7]=r.toolName,e[8]=m):m=e[8];let h;e[9]!==r.durationMs?(h=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[r.durationMs,"ms"]}),e[9]=r.durationMs,e[10]=h):h=e[10];let g;e[11]!==r.error?(g=r.error&&t.jsx("span",{className:"text-destructive truncate max-w-28",title:r.error,children:r.error}),e[11]=r.error,e[12]=g):g=e[12];const p=n?"▲":"▼";let x;e[13]!==p?(x=t.jsx("span",{className:"text-muted-foreground",children:p}),e[13]=p,e[14]=x):x=e[14];let f;e[15]!==l||e[16]!==x||e[17]!==d||e[18]!==m||e[19]!==h||e[20]!==g?(f=t.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1 text-[11px] hover:bg-muted/30 transition-colors",onClick:l,children:[d,m,h,g,x]}),e[15]=l,e[16]=x,e[17]=d,e[18]=m,e[19]=h,e[20]=g,e[21]=f):f=e[21];let y;e[22]!==n||e[23]!==i||e[24]!==r.error||e[25]!==r.input||e[26]!==r.outputPreview?(y=n&&t.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[r.error&&t.jsx("pre",{className:"bg-destructive/5 border border-destructive/10 rounded px-2 py-1 whitespace-pre-wrap break-all text-destructive max-h-20 overflow-auto",children:r.error}),r.input&&Object.keys(r.input).length>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorDashboard.inputLabel")}),t.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:JSON.stringify(r.input,null,2)})]}),r.outputPreview&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorDashboard.outputLabel")}),t.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:r.outputPreview})]})]}),e[22]=n,e[23]=i,e[24]=r.error,e[25]=r.input,e[26]=r.outputPreview,e[27]=y):y=e[27];let v;return e[28]!==f||e[29]!==y?(v=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[f,y]}),e[28]=f,e[29]=y,e[30]=v):v=e[30],v}function Ji({activeRunId:s,onRunChange:e}){const r=oe(),{settings:i}=vs(),[n,c]=q.useState(null),[l,o]=q.useState(!1),a=q.useRef(0),u=q.useRef(null),d=Dr(),m=Tr(),h=Kt(s),g=It(),p=js(),x=h.data?.run??null,f=x?.status,y=x?.config_snapshot?.monitorMode??x?.config_snapshot?.testMode,v=mt(s,void 0,f),C=(g.data?.items??[]).find(N=>N.status==="running"),_=g.data?.items?.[0]?.id;!s&&_&&u.current!==_&&(u.current=_,queueMicrotask(()=>{e(_)}));const b=async()=>{const N=Date.now();if(N-a.current<1e3)return;a.current=N;const k=n??i.monitorMode,T=await d.mutateAsync({...i,monitorMode:k});e(T.run.id)},L=async()=>{if(C&&C.id!==s&&C.status==="running"){o(!0);return}await b()},I=async()=>{s&&await m.mutateAsync(s)},R=x?.status==="running",P=x?ks(x.started_at,x.finished_at):null,S=v.data?.items??[],E=(p.data?.items??[]).reduce((N,k)=>(N[k.mapping.item_id]=k.item?.server?.icons?.[0]?.src??null,N),{}),D=n??i.monitorMode;return t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs(ge,{className:"p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:r("registry.monitorDashboard.currentQaRunTitle")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.currentQaRunDescription")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[C&&C.id!==s&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.runInProgressBadge",{runId:C.id.slice(0,8)})}),t.jsxs(Q,{size:"sm",onClick:L,disabled:d.isPending||R,className:"gap-1.5",children:[t.jsx(Ir,{size:14}),d.isPending?r("registry.monitorDashboard.startingButton"):C&&C.id!==s?r("registry.monitorDashboard.startAnotherRunButton"):r("registry.monitorDashboard.startQaRunButton")]}),t.jsxs(Q,{size:"sm",variant:"outline",onClick:I,disabled:!s||!R,className:"gap-1.5",children:[t.jsx(er,{size:14}),r("registry.monitorDashboard.cancelButton")]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaModeLabel")}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:D,onChange:N=>c(N.target.value),disabled:R,children:[t.jsx("option",{value:"health_check",children:r("registry.monitorDashboard.modeHealthCheck")}),t.jsx("option",{value:"tool_call",children:r("registry.monitorDashboard.modeToolCall")}),t.jsx("option",{value:"full_agent",children:r("registry.monitorDashboard.modeAgentic")})]})]}),t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaRunHistoryLabel")}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:s??"",onChange:N=>e(N.target.value||void 0),children:[t.jsx("option",{value:"",children:r("registry.monitorDashboard.autoSelectLatestRun")}),(g.data?.items??[]).map(N=>t.jsxs("option",{value:N.id,children:[new Date(N.created_at).toLocaleString()," -"," ",N.status]},N.id))]})]})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:r(D==="health_check"?"registry.monitorDashboard.modeDescriptionHealthCheck":D==="tool_call"?"registry.monitorDashboard.modeDescriptionToolCall":"registry.monitorDashboard.modeDescriptionAgentic")}),x?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsx(H,{className:te("capitalize",Rs(x.status),x.status==="running"?"animate-pulse":""),children:x.status}),t.jsx("span",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.itemsTestedCount",{tested:x.tested_items,total:x.total_items})}),P&&t.jsx("span",{className:"text-xs text-muted-foreground",children:P}),R&&x.current_item_id&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:[r("registry.monitorDashboard.qaOnLabel")," ",t.jsx("span",{className:"font-mono",children:x.current_item_id})]})]}),t.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:t.jsx("div",{className:te("h-full transition-all duration-500",x.failed_items>0?"bg-warning":"bg-success",R?"animate-pulse":""),style:{width:`${Gi(x)}%`}})}),t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-success",children:r("registry.monitorDashboard.passedLabel")}),t.jsx("p",{className:"text-lg font-bold text-success",children:x.passed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-destructive",children:r("registry.monitorDashboard.failedLabel")}),t.jsx("p",{className:"text-lg font-bold text-destructive",children:x.failed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:r("registry.monitorDashboard.skippedLabel")}),t.jsx("p",{className:"text-lg font-bold",children:x.skipped_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:r("registry.monitorDashboard.totalLabel")}),t.jsx("p",{className:"text-lg font-bold",children:x.total_items})]})]})]}):t.jsx("p",{className:"text-xs text-muted-foreground",children:r("registry.monitorDashboard.noRunSelectedMessage")})]}),t.jsxs(ge,{className:"p-4 space-y-2 min-h-[360px]",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:r("registry.monitorDashboard.qaResultsLogTitle",{count:S.length})}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:r("registry.monitorDashboard.qaResultsLogDescription")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[R&&t.jsx(H,{className:"bg-primary/10 text-primary border-primary/20 animate-pulse",children:r("registry.monitorDashboard.runInProgressLabel")}),x&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.progressBadge",{tested:x.tested_items,total:x.total_items})}),y&&t.jsx(H,{variant:"outline",className:"text-[10px]",children:r("registry.monitorDashboard.modeBadge",{mode:y.replace("_"," ")})})]})]}),S.length===0?t.jsx("div",{className:"h-[280px] rounded border border-dashed border-border flex items-center justify-center text-xs text-muted-foreground",children:r("registry.monitorDashboard.noResultsYetMessage")}):t.jsx("div",{ref:N=>{N&&R&&N.scrollHeight-N.scrollTop-N.clientHeight<120&&requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:S.map((N,k)=>t.jsx(Yi,{result:N,index:k,icon:E[N.item_id]},N.id))})]})]}),t.jsx(dt,{open:l,onOpenChange:o,children:t.jsxs(ct,{children:[t.jsxs(nt,{children:[t.jsx(rt,{children:r("registry.monitorDashboard.confirmStartTitle")}),t.jsx(it,{children:r("registry.monitorDashboard.confirmStartDescription",{runId:C?` (${C.id})`:""})})]}),t.jsxs(lt,{children:[t.jsx(ot,{children:r("registry.monitorDashboard.cancelButtonDialog")}),t.jsx(at,{onClick:()=>{o(!1),b()},children:r("registry.monitorDashboard.startAnywayButton")})]})]})})]})}function Ss(s){switch(s){case"passed":return"bg-success/10 text-success border-success/20";case"failed":case"error":return"bg-destructive/10 text-destructive border-destructive/20";case"needs_auth":return"bg-warning/10 text-warning border-warning/20";case"skipped":return"bg-muted text-muted-foreground border-border";default:return""}}function Xi(s){switch(s){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function Zi(s){const e=X.c(28),{tool:r}=s,i=oe(),[n,c]=q.useState(!1);let l;e[0]!==n?(l=()=>c(!n),e[0]=n,e[1]=l):l=e[1];const o=r.success?"text-success":"text-destructive";let a;e[2]!==o?(a=te("text-xs font-bold",o),e[2]=o,e[3]=a):a=e[3];const u=r.success?"✓":"✗";let d;e[4]!==a||e[5]!==u?(d=t.jsx("span",{className:a,children:u}),e[4]=a,e[5]=u,e[6]=d):d=e[6];let m;e[7]!==r.toolName?(m=t.jsx("span",{className:"text-xs font-mono truncate flex-1",children:r.toolName}),e[7]=r.toolName,e[8]=m):m=e[8];let h;e[9]!==r.durationMs?(h=t.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[r.durationMs,"ms"]}),e[9]=r.durationMs,e[10]=h):h=e[10];const g=n?"▲":"▼";let p;e[11]!==g?(p=t.jsx("span",{className:"text-[10px] text-muted-foreground",children:g}),e[11]=g,e[12]=p):p=e[12];let x;e[13]!==l||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==p?(x=t.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",onClick:l,children:[d,m,h,p]}),e[13]=l,e[14]=d,e[15]=m,e[16]=h,e[17]=p,e[18]=x):x=e[18];let f;e[19]!==n||e[20]!==i||e[21]!==r.error||e[22]!==r.input||e[23]!==r.outputPreview?(f=n&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[r.error&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.monitorRunDetail.error")}),t.jsx("pre",{className:"text-[11px] bg-destructive/5 border border-destructive/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-destructive",children:r.error})]}),r.input&&Object.keys(r.input).length>0&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.input")}),t.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:JSON.stringify(r.input,null,2)})]}),r.outputPreview&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.outputPreview")}),t.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:r.outputPreview})]}),!r.error&&!r.outputPreview&&(!r.input||Object.keys(r.input).length===0)&&t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.noAdditionalDetails")})]}),e[19]=n,e[20]=i,e[21]=r.error,e[22]=r.input,e[23]=r.outputPreview,e[24]=f):f=e[24];let y;return e[25]!==x||e[26]!==f?(y=t.jsxs("div",{className:"rounded border border-border",children:[x,f]}),e[25]=x,e[26]=f,e[27]=y):y=e[27],y}function en(s){const e=X.c(60),{result:r}=s,i=oe(),[n,c]=q.useState(r.status!=="passed");let l;if(e[0]!==n||e[1]!==r.action_taken||e[2]!==r.agent_summary||e[3]!==r.connection_ok||e[4]!==r.duration_ms||e[5]!==r.error_message||e[6]!==r.id||e[7]!==r.item_title||e[8]!==r.status||e[9]!==r.tool_results||e[10]!==r.tools_listed||e[11]!==i){const{latestToolResults:o,realToolTests:a,isHealthCheck:u,passedTools:d,failedTools:m,hasToolTests:h}=Is(r.tool_results);let g;e[13]!==n?(g=()=>c(!n),e[13]=n,e[14]=g):g=e[14];let p;e[15]!==r.status?(p=Xi(r.status),e[15]=r.status,e[16]=p):p=e[16];let x;e[17]!==p?(x=t.jsx("span",{className:"text-base shrink-0",children:p}),e[17]=p,e[18]=x):x=e[18];let f;e[19]!==r.item_title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:r.item_title}),e[19]=r.item_title,e[20]=f):f=e[20];let y;e[21]!==r.duration_ms?(y=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[r.duration_ms,"ms"]}),e[21]=r.duration_ms,e[22]=y):y=e[22];let v;e[23]!==i?(v=i("registry.monitorRunDetail.conn"),e[23]=i,e[24]=v):v=e[24];const C=r.connection_ok?"✓":"✗";let _;e[25]!==v||e[26]!==C?(_=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v,":"," ",C]}),e[25]=v,e[26]=C,e[27]=_):_=e[27];let b;e[28]!==i?(b=i("registry.monitorRunDetail.toolsListed"),e[28]=i,e[29]=b):b=e[29];const L=r.tools_listed?"✓":"✗";let I;e[30]!==b||e[31]!==L?(I=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[b,":"," ",L]}),e[30]=b,e[31]=L,e[32]=I):I=e[32];const R=o.length>0&&t.jsx("span",{className:"text-[10px] text-muted-foreground",children:h?t.jsxs(t.Fragment,{children:[i("registry.monitorRunDetail.tools"),": ",d,"✓"," ",m,"✗"]}):t.jsxs(t.Fragment,{children:[o.length," ",i("registry.monitorRunDetail.toolsFound")]})});let P;e[33]!==r.action_taken||e[34]!==i?(P=r.action_taken!=="none"&&t.jsxs(H,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:[i("registry.monitorRunDetail.action"),": ",r.action_taken]}),e[33]=r.action_taken,e[34]=i,e[35]=P):P=e[35];let S;e[36]!==I||e[37]!==R||e[38]!==P||e[39]!==y||e[40]!==_?(S=t.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[y,_,I,R,P]}),e[36]=I,e[37]=R,e[38]=P,e[39]=y,e[40]=_,e[41]=S):S=e[41];let E;e[42]!==S||e[43]!==f?(E=t.jsxs("div",{className:"min-w-0 flex-1",children:[f,S]}),e[42]=S,e[43]=f,e[44]=E):E=e[44];let D;e[45]!==r.status?(D=te("capitalize shrink-0",Ss(r.status)),e[45]=r.status,e[46]=D):D=e[46];let N;e[47]!==r.status?(N=r.status.replace("_"," "),e[47]=r.status,e[48]=N):N=e[48];let k;e[49]!==D||e[50]!==N?(k=t.jsx(H,{className:D,children:N}),e[49]=D,e[50]=N,e[51]=k):k=e[51];const T=n?"▲":"▼";let $;e[52]!==T?($=t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:T}),e[52]=T,e[53]=$):$=e[53];let M;e[54]!==E||e[55]!==k||e[56]!==g||e[57]!==$||e[58]!==x?(M=t.jsxs("button",{type:"button",className:"w-full text-left px-4 py-3 flex items-center gap-3 hover:bg-muted/30 transition-colors",onClick:g,children:[x,E,k,$]}),e[54]=E,e[55]=k,e[56]=g,e[57]=$,e[58]=x,e[59]=M):M=e[59],l=t.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[M,n&&t.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.connection")}),t.jsx("p",{className:te("text-xs font-medium",r.connection_ok?"text-success":"text-destructive"),children:r.connection_ok?i("registry.monitorRunDetail.connected"):i("registry.monitorRunDetail.failed")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.toolsListedLabel")}),t.jsx("p",{className:te("text-xs font-medium",r.tools_listed?"text-success":"text-destructive"),children:r.tools_listed?i("registry.monitorRunDetail.yesWithCount",{count:o.length}):i("registry.monitorRunDetail.no")})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.duration")}),t.jsxs("p",{className:"text-xs font-medium",children:[r.duration_ms,"ms"]})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.actionTaken")}),t.jsx("p",{className:"text-xs font-medium capitalize",children:r.action_taken.replace(/_/g," ")})]})]}),r.error_message&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-destructive",children:i("registry.monitorRunDetail.errorMessage")}),t.jsx("pre",{className:"text-xs bg-destructive/5 border border-destructive/10 rounded px-3 py-2 whitespace-pre-wrap break-all text-destructive",children:r.error_message})]}),h?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.toolResults",{passed:d,failed:m})}),t.jsx("div",{className:"space-y-1",children:a.map((A,U)=>t.jsx(Zi,{tool:A},`${r.id}-${A.toolName}-${U}`))})]}):u&&o.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.toolsDiscovered",{count:o.length})}),t.jsx("div",{className:"flex flex-wrap gap-1",children:o.map((A,U)=>t.jsx(H,{variant:"outline",className:"text-[10px] font-mono",children:A.toolName},`${r.id}-${A.toolName}-${U}`))})]}):null,r.agent_summary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:i("registry.monitorRunDetail.agentSummary")}),t.jsx("p",{className:"text-xs bg-muted/50 rounded px-3 py-2",children:r.agent_summary})]})]})]}),e[0]=n,e[1]=r.action_taken,e[2]=r.agent_summary,e[3]=r.connection_ok,e[4]=r.duration_ms,e[5]=r.error_message,e[6]=r.id,e[7]=r.item_title,e[8]=r.status,e[9]=r.tool_results,e[10]=r.tools_listed,e[11]=i,e[12]=l}else l=e[12];return l}function tn(s){const e=X.c(4),{value:r,onChange:i}=s,n=oe();let c;if(e[0]!==i||e[1]!==n||e[2]!==r){const l=[{value:"all",labelKey:"registry.monitorRunDetail.filterAll"},{value:"passed",labelKey:"registry.monitorRunDetail.filterPassed"},{value:"failed",labelKey:"registry.monitorRunDetail.filterFailed"},{value:"error",labelKey:"registry.monitorRunDetail.filterError"},{value:"needs_auth",labelKey:"registry.monitorRunDetail.filterNeedsAuth"},{value:"skipped",labelKey:"registry.monitorRunDetail.filterSkipped"}];c=t.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(o=>t.jsx("button",{type:"button",className:te("text-[11px] px-2 py-0.5 rounded-full border transition-colors",r===o.value?"bg-primary text-primary-foreground border-primary":"bg-muted/30 border-border hover:bg-muted/50"),onClick:()=>i(o.value),children:n(o.labelKey)},o.value))}),e[0]=i,e[1]=n,e[2]=r,e[3]=c}else c=e[3];return c}function sn(s){const e=X.c(81),{runId:r}=s,i=oe(),[n,c]=q.useState("all"),l=Kt(r),o=l.data?.run,a=mt(r,void 0,o?.status);let u,d,m,h,g,p,x,f,y,v,C,_,b;if(e[0]!==a||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==n||e[5]!==i){g=Symbol.for("react.early_return_sentinel");e:{if(u=a.data?.items??[],d=n==="all"?u:u.filter(j=>j.status===n),!r){let j;e[19]!==i?(j=i("registry.monitorRunDetail.selectRunToInspect"),e[19]=i,e[20]=j):j=e[20];let z;e[21]!==j?(z=t.jsx(ge,{className:"p-6 text-center space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:j})}),e[21]=j,e[22]=z):z=e[22],g=z;break e}C="space-y-3";let D;e[23]!==i?(D=i("registry.monitorRunDetail.runDetail"),e[23]=i,e[24]=D):D=e[24];let N;e[25]!==D?(N=t.jsx("h3",{className:"text-sm font-semibold",children:D}),e[25]=D,e[26]=N):N=e[26];let k;e[27]!==r?(k=t.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:r}),e[27]=r,e[28]=k):k=e[28];let T;e[29]!==N||e[30]!==k?(T=t.jsxs("div",{children:[N,k]}),e[29]=N,e[30]=k,e[31]=T):T=e[31];let $;e[32]!==o?($=o&&t.jsx(H,{className:te("capitalize",Ss(o.status)),children:o.status}),e[32]=o,e[33]=$):$=e[33];let M;e[34]!==a||e[35]!==l?(M=()=>{l.refetch(),a.refetch()},e[34]=a,e[35]=l,e[36]=M):M=e[36];let A;e[37]!==i?(A=i("registry.monitorRunDetail.refresh"),e[37]=i,e[38]=A):A=e[38];let U;e[39]!==M||e[40]!==A?(U=t.jsx(Q,{size:"sm",variant:"outline",onClick:M,children:A}),e[39]=M,e[40]=A,e[41]=U):U=e[41];let F;e[42]!==$||e[43]!==U?(F=t.jsxs("div",{className:"flex items-center gap-2",children:[$,U]}),e[42]=$,e[43]=U,e[44]=F):F=e[44],e[45]!==T||e[46]!==F?(_=t.jsx(ge,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,F]})}),e[45]=T,e[46]=F,e[47]=_):_=e[47],e[48]!==o||e[49]!==i?(b=o&&t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.total")}),t.jsx("p",{className:"text-lg font-bold",children:o.total_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.tested")}),t.jsx("p",{className:"text-lg font-bold",children:o.tested_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-success",children:i("registry.monitorRunDetail.passed")}),t.jsx("p",{className:"text-lg font-bold text-success",children:o.passed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-destructive",children:i("registry.monitorRunDetail.failed")}),t.jsx("p",{className:"text-lg font-bold text-destructive",children:o.failed_items})]}),t.jsxs(ge,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:i("registry.monitorRunDetail.skipped")}),t.jsx("p",{className:"text-lg font-bold",children:o.skipped_items})]})]}),e[48]=o,e[49]=i,e[50]=b):b=e[50],e[51]!==o||e[52]!==i?(h=o&&(o.started_at||o.finished_at)&&t.jsxs(ge,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[o.started_at&&t.jsxs("span",{children:[i("registry.monitorRunDetail.started"),":"," ",new Date(o.started_at).toLocaleString()]}),o.finished_at&&t.jsxs("span",{children:[i("registry.monitorRunDetail.finished"),":"," ",new Date(o.finished_at).toLocaleString()]}),o.started_at&&o.finished_at&&t.jsxs("span",{className:"font-medium text-foreground",children:[i("registry.monitorRunDetail.durationLabel"),":"," ",((new Date(o.finished_at).getTime()-new Date(o.started_at).getTime())/1e3).toFixed(1),"s"]})]}),e[51]=o,e[52]=i,e[53]=h):h=e[53],y="flex items-center justify-between gap-2",e[54]!==n?(v=t.jsx(tn,{value:n,onChange:c}),e[54]=n,e[55]=v):v=e[55],m="text-xs text-muted-foreground",p=d.length,x=" ",f=i("registry.monitorRunDetail.result",{count:d.length})}e[0]=a,e[1]=o,e[2]=r,e[3]=l,e[4]=n,e[5]=i,e[6]=u,e[7]=d,e[8]=m,e[9]=h,e[10]=g,e[11]=p,e[12]=x,e[13]=f,e[14]=y,e[15]=v,e[16]=C,e[17]=_,e[18]=b}else u=e[6],d=e[7],m=e[8],h=e[9],g=e[10],p=e[11],x=e[12],f=e[13],y=e[14],v=e[15],C=e[16],_=e[17],b=e[18];if(g!==Symbol.for("react.early_return_sentinel"))return g;let L;e[56]!==m||e[57]!==p||e[58]!==x||e[59]!==f?(L=t.jsxs("span",{className:m,children:[p,x,f]}),e[56]=m,e[57]=p,e[58]=x,e[59]=f,e[60]=L):L=e[60];let I;e[61]!==L||e[62]!==y||e[63]!==v?(I=t.jsxs("div",{className:y,children:[v,L]}),e[61]=L,e[62]=y,e[63]=v,e[64]=I):I=e[64];let R;e[65]!==u||e[66]!==d.length||e[67]!==i?(R=d.length===0&&t.jsx(ge,{className:"p-4 text-sm text-muted-foreground text-center",children:u.length===0?i("registry.monitorRunDetail.noTestResultsYet"):i("registry.monitorRunDetail.noResultsMatchFilter")}),e[65]=u,e[66]=d.length,e[67]=i,e[68]=R):R=e[68];let P;e[69]!==d?(P=d.map(rn),e[69]=d,e[70]=P):P=e[70];let S;e[71]!==R||e[72]!==P?(S=t.jsxs("div",{className:"space-y-2",children:[R,P]}),e[71]=R,e[72]=P,e[73]=S):S=e[73];let E;return e[74]!==h||e[75]!==I||e[76]!==S||e[77]!==C||e[78]!==_||e[79]!==b?(E=t.jsxs("div",{className:C,children:[_,b,h,I,S]}),e[74]=h,e[75]=I,e[76]=S,e[77]=C,e[78]=_,e[79]=b,e[80]=E):E=e[80],E}function rn(s){return t.jsx(en,{result:s},s.id)}function nn(s){return s.tested_items?`${Math.round(s.passed_items/s.tested_items*100)}%`:"-"}function on(s){const e=X.c(20),{selectedRunId:r,onSelectRun:i}=s,n=It();let c;e[0]!==n.data?.items?(c=n.data?.items??[],e[0]=n.data?.items,e[1]=c):c=e[1];const l=c;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=o):o=e[2];let a;e[3]!==n?(a=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o,t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>n.refetch(),children:"Refresh"})]}),e[3]=n,e[4]=a):a=e[4];let u;e[5]!==l.length?(u=l.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs yet. Start QA from the Dashboard tab."}),e[5]=l.length,e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==l||e[9]!==r){let g;e[11]!==i||e[12]!==r?(g=p=>{const x=ks(p.started_at,p.finished_at),f=nn(p),y=r===p.id;return t.jsxs("button",{type:"button",onClick:()=>i(p.id),className:te("w-full text-left rounded-lg border p-3 transition-colors",y?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(p.created_at).toLocaleString()})}),t.jsx(H,{className:te("capitalize",Rs(p.status)),children:p.status})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[t.jsxs("span",{className:"text-muted-foreground",children:[p.tested_items,"/",p.total_items," tested"]}),t.jsxs("span",{className:"text-success font-medium",children:[p.passed_items," passed"]}),p.failed_items>0&&t.jsxs("span",{className:"text-destructive font-medium",children:[p.failed_items," failed"]}),p.skipped_items>0&&t.jsxs("span",{className:"text-muted-foreground",children:[p.skipped_items," skipped"]}),t.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",f]}),x&&t.jsx("span",{className:"text-muted-foreground",children:x})]}),p.config_snapshot&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.jsx(H,{variant:"outline",className:"text-[9px]",children:(p.config_snapshot.monitorMode??p.config_snapshot.testMode??"health_check").replace("_"," ")}),p.config_snapshot.onFailure!=="none"&&t.jsxs(H,{variant:"outline",className:"text-[9px] text-destructive",children:["on fail:"," ",p.config_snapshot.onFailure.replace(/_/g," ")]})]})]},p.id)},e[11]=i,e[12]=r,e[13]=g):g=e[13],d=l.map(g),e[7]=i,e[8]=l,e[9]=r,e[10]=d}else d=e[10];let m;e[14]!==u||e[15]!==d?(m=t.jsxs("div",{className:"space-y-2 max-h-[520px] overflow-auto",children:[u,d]}),e[14]=u,e[15]=d,e[16]=m):m=e[16];let h;return e[17]!==a||e[18]!==m?(h=t.jsx(ge,{className:"p-4",children:t.jsxs("div",{className:"space-y-3",children:[a,m]})}),e[17]=a,e[18]=m,e[19]=h):h=e[19],h}function an(){const s=X.c(21),e=oe(),[r,i]=q.useState(void 0),[n,c]=q.useState("tests"),o=Kt(r).data?.run?.status,a=mt(r,void 0,o);let u;s[0]!==a.data?.items?(u=a.data?.items??[],s[0]=a.data?.items,s[1]=u):u=s[1];let d;s[2]!==u?(d=u.filter(ln),s[2]=u,s[3]=d):d=s[3];const m=d;let h;s[4]!==n||s[5]!==e?(h=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:[{id:"tests",labelKey:"registry.registryMonitorPage.tabTests"},{id:"configuration",labelKey:"registry.registryMonitorPage.tabConfiguration"},{id:"connections",labelKey:"registry.registryMonitorPage.tabConnections"}].map(y=>{const v=n===y.id;return t.jsx("button",{type:"button",className:te("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",v?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>c(y.id),children:t.jsx("span",{children:e(y.labelKey)})},y.id)})}),s[4]=n,s[5]=e,s[6]=h):h=s[6];let g;s[7]!==r||s[8]!==n||s[9]!==m||s[10]!==e?(g=n==="tests"&&t.jsxs("div",{className:"space-y-6",children:[t.jsx(Ji,{activeRunId:r,onRunChange:i}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[t.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[r&&t.jsx(sn,{runId:r}),t.jsx(on,{selectedRunId:r,onSelectRun:i})]}),t.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[t.jsxs("h3",{className:"text-sm font-semibold",children:[e("registry.registryMonitorPage.brokenMcps")," ",m.length>0&&t.jsx(H,{variant:"destructive",className:"text-[10px] ml-1",children:m.length})]}),t.jsx(Di,{results:m})]})]})]}),s[7]=r,s[8]=n,s[9]=m,s[10]=e,s[11]=g):g=s[11];let p;s[12]!==n?(p=n==="configuration"&&t.jsx(Ui,{}),s[12]=n,s[13]=p):p=s[13];let x;s[14]!==n?(x=n==="connections"&&t.jsx(Bi,{}),s[14]=n,s[15]=x):x=s[15];let f;return s[16]!==h||s[17]!==g||s[18]!==p||s[19]!==x?(f=t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[h,g,p,x]}),s[16]=h,s[17]=g,s[18]=p,s[19]=x,s[20]=f):f=s[20],f}function ln(s){return s.status==="failed"||s.status==="error"}function cn(s){const e=X.c(9),{activeTab:r,onChange:i,items:n}=s;let c;if(e[0]!==r||e[1]!==n||e[2]!==i){let o;e[4]!==r||e[5]!==i?(o=a=>{const u=r===a.tab,d=a.icon;return t.jsxs("button",{type:"button",className:te("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",u?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(a.tab),children:[t.jsx(d,{size:14}),t.jsx("span",{children:a.label}),typeof a.count=="number"&&a.count>0&&t.jsx("span",{className:"min-w-4 h-4 px-1 inline-flex items-center justify-center rounded-full bg-primary/15 text-[10px] font-semibold",children:a.count})]},a.id)},e[4]=r,e[5]=i,e[6]=o):o=e[6],c=n.map(o),e[0]=r,e[1]=n,e[2]=i,e[3]=c}else c=e[3];let l;return e[7]!==c?(l=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:c}),e[7]=c,e[8]=l):l=e[8],l}function so(s){const e=X.c(59),{onBack:r}=s,i=oe(),[n,c]=q.useState("items"),[l,o]=q.useState(null),{registryName:a,registryIcon:u,acceptPublishRequests:d}=Cs(Ve),m=Kr(),h=Lr();!d&&n==="requests"&&c("items");const g=m.data?.pending??0;let p;e[0]!==i?(p=i("registry.registryLayout.itemsTab"),e[0]=i,e[1]=p):p=e[1];const x=h.brokenCount>0?h.brokenCount:void 0;let f;e[2]!==p||e[3]!==x?(f={id:"items",label:p,icon:tr,tab:"items",count:x},e[2]=p,e[3]=x,e[4]=f):f=e[4];let y;e[5]!==d||e[6]!==g||e[7]!==i?(y=d?[{id:"requests",label:i("registry.registryLayout.requestsTab"),icon:We,tab:"requests",count:g}]:[],e[5]=d,e[6]=g,e[7]=i,e[8]=y):y=e[8];let v;e[9]!==i?(v=i("registry.registryLayout.qaTab"),e[9]=i,e[10]=v):v=e[10];let C;e[11]!==v?(C={id:"qa",label:v,icon:ps,tab:"qa"},e[11]=v,e[12]=C):C=e[12];let _;e[13]!==i?(_=i("registry.registryLayout.settingsTab"),e[13]=i,e[14]=_):_=e[14];let b;e[15]!==_?(b={id:"settings",label:_,icon:nr,tab:"settings"},e[15]=_,e[16]=b):b=e[16];let L;e[17]!==f||e[18]!==y||e[19]!==C||e[20]!==b?(L=[f,...y,C,b],e[17]=f,e[18]=y,e[19]=C,e[20]=b,e[21]=L):L=e[21];const I=L;let R;e[22]!==r?(R=r&&t.jsx("button",{type:"button",className:"shrink-0 p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors cursor-pointer",onClick:r,children:t.jsx(sr,{size:16})}),e[22]=r,e[23]=R):R=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=()=>c("settings"),e[24]=P):P=e[24];let S;e[25]!==u||e[26]!==a?(S=t.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:u?t.jsx("img",{src:u,alt:a,className:"h-full w-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:a.slice(0,1).toUpperCase()})}),e[25]=u,e[26]=a,e[27]=S):S=e[27];let E;e[28]!==a?(E=t.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:a}),e[28]=a,e[29]=E):E=e[29];let D;e[30]!==S||e[31]!==E?(D=t.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:P,children:[S,E]}),e[30]=S,e[31]=E,e[32]=D):D=e[32];let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),e[33]=N):N=e[33];let k;e[34]!==n||e[35]!==I?(k=t.jsx(cn,{activeTab:n,onChange:c,items:I}),e[34]=n,e[35]=I,e[36]=k):k=e[36];let T;e[37]!==R||e[38]!==D||e[39]!==k?(T=t.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[R,D,N,k]})}),e[37]=R,e[38]=D,e[39]=k,e[40]=T):T=e[40];let $;e[41]!==n?($=n==="items"&&t.jsx(Ri,{}),e[41]=n,e[42]=$):$=e[42];let M;e[43]!==d||e[44]!==n?(M=n==="requests"&&d&&t.jsx(Ii,{}),e[43]=d,e[44]=n,e[45]=M):M=e[45];let A;e[46]!==n?(A=n==="qa"&&t.jsx(an,{}),e[46]=n,e[47]=A):A=e[47];let U;e[48]!==n||e[49]!==l?(U=n==="settings"&&t.jsx(Si,{revealedKey:l,onRevealedKeyChange:o}),e[48]=n,e[49]=l,e[50]=U):U=e[50];let F;e[51]!==$||e[52]!==M||e[53]!==A||e[54]!==U?(F=t.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[$,M,A,U]}),e[51]=$,e[52]=M,e[53]=A,e[54]=U,e[55]=F):F=e[55];let j;return e[56]!==T||e[57]!==F?(j=t.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[T,F]}),e[56]=T,e[57]=F,e[58]=j):j=e[58],j}export{so as default};
|