decocms 4.43.2 → 4.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-CeIhzN_l.js → AlertCircle-B4rVzjGb.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DfTCnzGD.js → ArrowUpRight-Dfyxpo1c.js} +1 -1
- package/dist/client/assets/{Check-WVQH5yxa.js → Check-B8jlzVAe.js} +1 -1
- package/dist/client/assets/{CheckCircle-DSPF4aUN.js → CheckCircle-BGBFQ7TU.js} +1 -1
- package/dist/client/assets/{ChevronDown-BCfLIH5T.js → ChevronDown-spisuOMX.js} +1 -1
- package/dist/client/assets/{ChevronRight-B-Oyy1K1.js → ChevronRight-ClO8KFuz.js} +1 -1
- package/dist/client/assets/{ChevronUp-BLdWjTR3.js → ChevronUp-CjW_m4ZD.js} +1 -1
- package/dist/client/assets/{Circle-DHcpjdb_.js → Circle-DbRXoiZZ.js} +1 -1
- package/dist/client/assets/{Copy01-CzY5zLtf.js → Copy01-B3rMPdnI.js} +1 -1
- package/dist/client/assets/{DotsVertical-BLsfOrM4.js → DotsVertical-D6_pKTzA.js} +1 -1
- package/dist/client/assets/{Eye-gA6jVXAd.js → Eye-Bca7Lcn-.js} +1 -1
- package/dist/client/assets/{FilterLines-EBWqq7Xu.js → FilterLines-C_kuJjS_.js} +1 -1
- package/dist/client/assets/{Globe01-feY0nKh_.js → Globe01-t_Xn7EOD.js} +1 -1
- package/dist/client/assets/{Globe04-C7AAKLVZ.js → Globe04-C4us4GD8.js} +1 -1
- package/dist/client/assets/{HardDrive-B_0butHa.js → HardDrive-DPY2W1oq.js} +1 -1
- package/dist/client/assets/{Key01-DMqGym6L.js → Key01-C4NN9OUR.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CCd2X9Ad.js → LayoutLeft-SufEyqlt.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CcywGheJ.js → LinkExternal01-CarrE4qF.js} +1 -1
- package/dist/client/assets/{List-CVGAxKAX.js → List-DdFdW6qh.js} +1 -1
- package/dist/client/assets/{Loading02-CmiQu1pl.js → Loading02-DpP2ZUzL.js} +1 -1
- package/dist/client/assets/{Monitor01-DAch4x7c.js → Monitor01-Di2J1pIG.js} +1 -1
- package/dist/client/assets/{Palette-DFnIddyo.js → Palette-DfvsIzkI.js} +1 -1
- package/dist/client/assets/{Play-vqCUlmDD.js → Play-C4x8-9Mt.js} +1 -1
- package/dist/client/assets/{Plus-ZE1JxTF6.js → Plus-B0nun22d.js} +1 -1
- package/dist/client/assets/{SearchLg-D2N8R9Nk.js → SearchLg-DQbhUEwD.js} +1 -1
- package/dist/client/assets/{SearchMd-CaBT-6p_.js → SearchMd-ByGwfofO.js} +1 -1
- package/dist/client/assets/{Settings02-DdGp-K93.js → Settings02-DOBWjsq7.js} +1 -1
- package/dist/client/assets/{Shield01-FoHeAFEB.js → Shield01-Cbocz3h7.js} +1 -1
- package/dist/client/assets/{Star01-D4eDNr0F.js → Star01-DVZvfUNG.js} +1 -1
- package/dist/client/assets/{Stars01-BM9lgZA4.js → Stars01-BQBCKlQH.js} +1 -1
- package/dist/client/assets/{Stars02-DxqFtma3.js → Stars02-5EW8AGHQ.js} +1 -1
- package/dist/client/assets/{Sun-jMKWVpok.js → Sun-iQ9ZpSHi.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DQYstVKd.js → SwitchHorizontal01-l385tnk6.js} +1 -1
- package/dist/client/assets/{Tool01-C8AkhemH.js → Tool01-DqOmVP7D.js} +1 -1
- package/dist/client/assets/{Trash01-CHOvnt78.js → Trash01-DUs3g8yj.js} +1 -1
- package/dist/client/assets/{Upload01-3eWew1xB.js → Upload01-pIKYD9iV.js} +1 -1
- package/dist/client/assets/{User01-BN69CLHJ.js → User01-B-D44sqE.js} +1 -1
- package/dist/client/assets/{Users01-Ci_ws_VC.js → Users01-DQ-Z1cTM.js} +1 -1
- package/dist/client/assets/{Users03-B59cocJE.js → Users03-DUE7duSR.js} +1 -1
- package/dist/client/assets/{X-A4bflze9.js → X-DXVAJV8x.js} +1 -1
- package/dist/client/assets/{XCircle-CVhc7f91.js → XCircle-DWSiH6uW.js} +1 -1
- package/dist/client/assets/{XClose-CT2qln5j.js → XClose-CiCDgOUG.js} +1 -1
- package/dist/client/assets/{Zap-BsBjWU3t.js → Zap-BnHiHTqy.js} +1 -1
- package/dist/client/assets/{ZapSquare-DLhh9jUV.js → ZapSquare-6fv6OHRe.js} +1 -1
- package/dist/client/assets/{ZoomOut-Ba8by3et.js → ZoomOut-H4y0o0fz.js} +1 -1
- package/dist/client/assets/{access-gate-CX7dYbyt.js → access-gate-Ba3RACeg.js} +1 -1
- package/dist/client/assets/{add-section-modal-B4RbvfBl.js → add-section-modal-AWqdUvsG.js} +1 -1
- package/dist/client/assets/{agent-capabilities-Cy_FyUQh.js → agent-capabilities-C8aAokhv.js} +1 -1
- package/dist/client/assets/{agent-icon-RfWwE9MD.js → agent-icon-CNKD9od7.js} +1 -1
- package/dist/client/assets/{agents-list-BzCcnsIz.js → agents-list-BTPTEMfn.js} +1 -1
- package/dist/client/assets/{ai-providers-ChDNRsKv.js → ai-providers-BLlVFynS.js} +1 -1
- package/dist/client/assets/{alert-CXIV50wi.js → alert-CDpGekNd.js} +1 -1
- package/dist/client/assets/{alert-dialog-yqhgP4hj.js → alert-dialog-NIL7nG4k.js} +1 -1
- package/dist/client/assets/{app-editor-NgHZcWof.js → app-editor-wfvFpkuk.js} +1 -1
- package/dist/client/assets/{auth-catchall-BKadDqF1.js → auth-catchall-B1PaA5ER.js} +1 -1
- package/dist/client/assets/{auth-entry-Cwowy8mG.js → auth-entry-CY4VryVo.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CpAHZeyz.js → auth-split-layout-DfErsUKb.js} +1 -1
- package/dist/client/assets/{auth-2QEQeQe9.js → auth-stk4L42H.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-G879iPre.js → authenticate-and-persist-oauth-XK4s1c0p.js} +1 -1
- package/dist/client/assets/{automation-list-row-CpS2pwCu.js → automation-list-row-CY9TbBsv.js} +1 -1
- package/dist/client/assets/{automation-runs-qnj_dOPl.js → automation-runs-CZZ0My05.js} +45 -45
- package/dist/client/assets/{automations-9kOyweqT.js → automations-DCNHo59-.js} +1 -1
- package/dist/client/assets/{autosend-Ca67mpUq.js → autosend-CIRnSFlG.js} +1 -1
- package/dist/client/assets/{avatar-DNqtrvfI.js → avatar-DovY7muZ.js} +1 -1
- package/dist/client/assets/{badge-BprYFRtN.js → badge-D4pyOmCp.js} +1 -1
- package/dist/client/assets/{block-document-Urr2c0F_.js → block-document-BYDEsiJ_.js} +1 -1
- package/dist/client/assets/{brand-context-CNOSkfr0.js → brand-context-DvYi6-XP.js} +1 -1
- package/dist/client/assets/{breadcrumb-BQp3Ac7T.js → breadcrumb-pCkbw6OY.js} +1 -1
- package/dist/client/assets/{buckets-ZVDvkyWX.js → buckets-BsC8nyU2.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DZRvy3EL.js → bulk-category-panel-CoeA7JSk.js} +1 -1
- package/dist/client/assets/{calendar-Dxh-u67O.js → calendar-0_GqbDzm.js} +1 -1
- package/dist/client/assets/{capability-load-error-Cv8z3yAp.js → capability-load-error-B60fSBlC.js} +1 -1
- package/dist/client/assets/{card-BM-m_xgk.js → card-dWlW4g_n.js} +1 -1
- package/dist/client/assets/{category-editor-CRA_C7ch.js → category-editor-DruE0BjC.js} +1 -1
- package/dist/client/assets/{chat-context-BIEy3GO6.js → chat-context-DHy9Wrla.js} +1 -1
- package/dist/client/assets/{checkbox-BvN2_X-L.js → checkbox-Y7mBxqC3.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BRtHcFrZ.js → cli-auth-success-DiCbL1Er.js} +1 -1
- package/dist/client/assets/{collection-detail-CTekAu0w.js → collection-detail-l361o0RK.js} +1 -1
- package/dist/client/assets/{collection-display-button-DKCH885f.js → collection-display-button-Cf-bCK_T.js} +1 -1
- package/dist/client/assets/{collection-search-z1c-OIMq.js → collection-search-DI69OYkt.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BvEPqoQz.js → collection-table-wrapper-B66nKUMI.js} +1 -1
- package/dist/client/assets/{collection-tabs-CwsBPM-c.js → collection-tabs-CQALAm3p.js} +1 -1
- package/dist/client/assets/{command-eUIMnfT_.js → command-COJkBM8v.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-DEKvlmZy.js → commerce-onboarding-DXRmlM2N.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-tWWNbof3.js → connect-desktop-dialog-D-rafo3k.js} +1 -1
- package/dist/client/assets/{connection-card-BAiqBQka.js → connection-card-ByKWgKNO.js} +1 -1
- package/dist/client/assets/{connection-detail-CdYi1qHz.js → connection-detail-Dg36mp8u.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-D7avntPs.js → connection-form-helpers-BX_278as.js} +1 -1
- package/dist/client/assets/{connections-rM94yjHl.js → connections-CZHHO9KT.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-Ddi9cv7p.js → decopilot-sse-pool-CEetn8QJ.js} +1 -1
- package/dist/client/assets/{dialog-DVfr6U1Q.js → dialog-DLuAdZWN.js} +1 -1
- package/dist/client/assets/{domain-settings-Ccomq6mi.js → domain-settings-2jpVqBax.js} +1 -1
- package/dist/client/assets/{drawer-DrJLyRrS.js → drawer-BT0nO7Gh.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Y95r2cEN.js → dropdown-menu-DzMUoAiU.js} +1 -1
- package/dist/client/assets/{empty-state-BZYzMqQn.js → empty-state-3-SuFfhy.js} +1 -1
- package/dist/client/assets/{extract-connection-data-GBMA3Mly.js → extract-connection-data-89-kNEsj.js} +1 -1
- package/dist/client/assets/{file-explorer-BVkd5Orn.js → file-explorer-0aXwnpWs.js} +1 -1
- package/dist/client/assets/{file-type-icon-BMuZwTUw.js → file-type-icon-D3Rdi0rC.js} +1 -1
- package/dist/client/assets/{files-BDA5Iui2.js → files-B027snaR.js} +1 -1
- package/dist/client/assets/{form-Cr_F07qT.js → form-B7RrBOMB.js} +1 -1
- package/dist/client/assets/{general-Dzm5xAsA.js → general-MXo-eiCz.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BeZYm6Y_.js → github-repo-picker-Dykj2qFx.js} +1 -1
- package/dist/client/assets/{hooks-airELZ_8.js → hooks-BmOjuM2y.js} +1 -1
- package/dist/client/assets/{index-D-SwvQEx.js → index-B6-R74kF.js} +1 -1
- package/dist/client/assets/{index-7DOewpHx.js → index-BHnyvT_3.js} +1 -1
- package/dist/client/assets/{index-XJyq3Z1f.js → index-BKUm7yV5.js} +1 -1
- package/dist/client/assets/{index-ClYtmMEi.js → index-C88R47Te.js} +1 -1
- package/dist/client/assets/{index-DbCdW3fQ.js → index-CHV2oFtV.js} +1 -1
- package/dist/client/assets/{index-DXQaR7BD.js → index-Co9s1ivM.js} +1 -1
- package/dist/client/assets/{index-BzDAMSl8.js → index-D4SvmBXn.js} +1 -1
- package/dist/client/assets/{index-BI1D40Bb.js → index-Dsd_iuEd.js} +3 -3
- package/dist/client/assets/{index-BKIAYB4q.js → index-HPYN2PdL.js} +28 -28
- package/dist/client/assets/{index-Bc33NLzg.js → index-RuoMzh-H.js} +1 -1
- package/dist/client/assets/{index-DXgMPhVD.js → index-Vjr9jkQV.js} +1 -1
- package/dist/client/assets/{index-D6lqM2He.js → index-Y-ZfkmZF.js} +1 -1
- package/dist/client/assets/{index-CpEjZ19A.js → index-aXWMNPUL.js} +1 -1
- package/dist/client/assets/{index-redirect-DXhzmGs_.js → index-redirect-Bd7v9-WJ.js} +1 -1
- package/dist/client/assets/{index-DT7Spi_3.js → index-v9USPf5e.js} +1 -1
- package/dist/client/assets/{input-CFV763iN.js → input-DVEzPKKj.js} +1 -1
- package/dist/client/assets/{integration-icon-BzRUrmhb.js → integration-icon-DqkK9Eex.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-BdjfV4Pz.js → invite-member-dialog-aSyF--9v.js} +1 -1
- package/dist/client/assets/{label-D3fiZK_8.js → label-KpXEJk-h.js} +1 -1
- package/dist/client/assets/{login-BOVNSU48.js → login-BGtPU3zp.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BmK9oSzX.js → mcp-oauth-5ck9cQwI.js} +1 -1
- package/dist/client/assets/{members-DuaXGl7e.js → members-idKzRDYv.js} +1 -1
- package/dist/client/assets/{monaco-editor-DJ2sFoTh.js → monaco-editor-Cnz_x1QX.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CiaOXH84.js → monitoring-stats-row-T8_LT2mu.js} +1 -1
- package/dist/client/assets/{oauth-callback-BtVF3x2r.js → oauth-callback-I9jTcfGb.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-B6tsvy2q.js → oauth-callback-ai-provider-CU_1ZVLh.js} +1 -1
- package/dist/client/assets/{onboarding-r6196vI_.js → onboarding-Bt8QKfCp.js} +1 -1
- package/dist/client/assets/{org-install-shtuxsdR.js → org-install-C2zin4AI.js} +1 -1
- package/dist/client/assets/{org-layout-CN9CDejf.js → org-layout-Bh3-XY86.js} +1 -1
- package/dist/client/assets/{organization-choice-DP81BQn8.js → organization-choice-JDEOL7JM.js} +1 -1
- package/dist/client/assets/{page-seo-form-rz6XACmv.js → page-seo-form-DeODCAhK.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CVR9HjS8.js +1 -0
- package/dist/client/assets/{popover-C2A6_B6a.js → popover-3culmC-p.js} +1 -1
- package/dist/client/assets/{post-editor-CxYAqhcv.js → post-editor-DIJccDUr.js} +1 -1
- package/dist/client/assets/{primitives-B_LaT2mw.js → primitives-BbmSNqPJ.js} +1 -1
- package/dist/client/assets/{profile-Dwvov7La.js → profile-CuAydmDk.js} +1 -1
- package/dist/client/assets/project-app-view-DGhuLLKh.js +1 -0
- package/dist/client/assets/record-editor-BTu8np7Q.js +1 -0
- package/dist/client/assets/registry-B4WUAUlx.js +2 -0
- package/dist/client/assets/{registry-layout-BYYPG8AZ.js → registry-layout-CiCt5ymy.js} +1 -1
- package/dist/client/assets/{require-capability-CTiv9Z0m.js → require-capability-BSa2WA-C.js} +1 -1
- package/dist/client/assets/{required-auth-layout-yvVLN6Hm.js → required-auth-layout-Dpk92TPe.js} +1 -1
- package/dist/client/assets/{reset-password-rhtFYAvJ.js → reset-password-BEbPod4b.js} +1 -1
- package/dist/client/assets/{roles-1up0vpJR.js → roles-B9iwgL6L.js} +1 -1
- package/dist/client/assets/{search-input-z-SZ5xmX.js → search-input-Db1F0jx-.js} +1 -1
- package/dist/client/assets/{secrets-DXWs6lzR.js → secrets-ChiNNGn-.js} +1 -1
- package/dist/client/assets/{sections-editor-DvO7fC1v.js → sections-editor-B9Rsf1XY.js} +1 -1
- package/dist/client/assets/{select-DtepIC1g.js → select-BkgqDf7e.js} +1 -1
- package/dist/client/assets/{select-model-pOunWX2H.js → select-model-CwXaZaFK.js} +1 -1
- package/dist/client/assets/{seo-editor-D_Gd5FQ3.js → seo-editor-BIHoQK1Q.js} +1 -1
- package/dist/client/assets/{settings-layout-IdkMWTo4.js → settings-layout-GT95_RRP.js} +1 -1
- package/dist/client/assets/{settings-section-BxArx8B4.js → settings-section-B1yWeiiF.js} +1 -1
- package/dist/client/assets/{shell-controls-DIkDIVCH.js → shell-controls-Bi1SklEo.js} +1 -1
- package/dist/client/assets/{shell-layout-BG9xor_B.js → shell-layout-BIM9a05w.js} +1 -1
- package/dist/client/assets/{sidebar-CoQlGXUH.js → sidebar-BBuVIXs3.js} +1 -1
- package/dist/client/assets/{skeleton-Cpt27Mrt.js → skeleton-DSOwcq5l.js} +1 -1
- package/dist/client/assets/{sso-BlmthKGR.js → sso-Dcnx4HXH.js} +1 -1
- package/dist/client/assets/{store-C2evtg_N.js → store-Cqpx1B5k.js} +1 -1
- package/dist/client/assets/store-registry-C0Mlgj0K.js +2 -0
- package/dist/client/assets/{studio-tools-DEGpQ95m.js → studio-tools-CTXw_HGo.js} +1 -1
- package/dist/client/assets/{switch-B7feKVs7.js → switch-Dukm50CX.js} +1 -1
- package/dist/client/assets/{table-BbTBSKn5.js → table-1C1nYcaS.js} +1 -1
- package/dist/client/assets/{tabs-DjXPPUR2.js → tabs-E6RgSpIm.js} +1 -1
- package/dist/client/assets/{textarea-Dq7eH56b.js → textarea-Cq3eLWgU.js} +1 -1
- package/dist/client/assets/{toggle-group-2w_n_L5K.js → toggle-group-DSuixrOu.js} +1 -1
- package/dist/client/assets/{toolbar-CeFkCbVX.js → toolbar-BgxtbB8k.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-CLKQStf7.js → toolbar-icon-button-AVA73zGb.js} +1 -1
- package/dist/client/assets/{tools-list-uNF3PJAj.js → tools-list-C1X0VZfQ.js} +1 -1
- package/dist/client/assets/{tooltip-DYkdUcwK.js → tooltip-CQRmXLdK.js} +1 -1
- package/dist/client/assets/{types-qnoLRMPf.js → types-DkVBp3lw.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CAsm11ID.js → use-ai-providers-BvN_YPeM.js} +1 -1
- package/dist/client/assets/{use-automations-AFDXGXPs.js → use-automations-C-qbYs9z.js} +1 -1
- package/dist/client/assets/{use-capability-DGt12O9N.js → use-capability-odB-d61W.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DG2pLp-q.js → use-clock-tick-fro43T2v.js} +1 -1
- package/dist/client/assets/{use-collections-BpWFaBIs.js → use-collections-YymHP9DJ.js} +1 -1
- package/dist/client/assets/{use-connection-DPLDQYO_.js → use-connection-BjAQgmP6.js} +1 -1
- package/dist/client/assets/{use-copy-B_rqSo6t.js → use-copy-Bk6Ve8B3.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BefguK-c.js → use-create-virtual-mcp-DLqqtGBm.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-4yffmoWA.js → use-debounced-autosave-CV4B4Gkf.js} +1 -1
- package/dist/client/assets/{use-debounced-value-DNKtJ7rs.js → use-debounced-value-BU9d5vE5.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-C_VHZWO-.js → use-decopilot-events-TPOfwfqa.js} +1 -1
- package/dist/client/assets/{use-delete-connection-eSU40H6l.js → use-delete-connection-BhAWG9Xb.js} +1 -1
- package/dist/client/assets/{use-file-configs-Cq7kWeal.js → use-file-configs-DA4-SvXK.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CSzTWLnA.js → use-infinite-scroll-BDJdA7B_.js} +1 -1
- package/dist/client/assets/{use-join-requests-DZ57jRcU.js → use-join-requests-C7vqcl8I.js} +1 -1
- package/dist/client/assets/{use-mcp-client-9lFASwC0.js → use-mcp-client-B6xEVCdZ.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DTsMk0A1.js → use-mcp-prompts-C2qEigUb.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DUQ6pfgC.js → use-mcp-tools-CMNfuH8d.js} +1 -1
- package/dist/client/assets/{use-members-Dr-MIVal.js → use-members-DfknS5vp.js} +1 -1
- package/dist/client/assets/{use-mobile-CCpRJzNQ.js → use-mobile-zlseXNZw.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BLGuQu2W.js → use-navigate-to-agent-DukigbvT.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-DXbKeKAB.js → use-org-auth-client-C-Z33Ztc.js} +1 -1
- package/dist/client/assets/{use-org-sso-DeEfR5na.js → use-org-sso-BxT29NsJ.js} +1 -1
- package/dist/client/assets/{use-organization-roles-6jciUWXs.js → use-organization-roles-CGYFQ6NZ.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CG0jiKsK.js → use-organization-settings-DVhD0MdP.js} +1 -1
- package/dist/client/assets/{use-registry-connections-NeJTwcjk.js → use-registry-connections-vzpQSjWc.js} +1 -1
- package/dist/client/assets/{use-secrets-BPpuxuTF.js → use-secrets-B-_MN6-3.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DwBuWAo_.js → use-status-sounds-BERlBf-i.js} +1 -1
- package/dist/client/assets/{use-view-mode-D0JomyIt.js → use-view-mode-FN-UaNtL.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-uIDmqhnP.js → use-virtual-mcp-CR8RESJp.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BZ1RPZ6t.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-5igL8BlZ.js +1 -0
- package/dist/client/assets/{variant-calendar-AOQNJVM8.js → variant-calendar-qksd53wK.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-8ZM9vm8_.js → view-mode-toggle-BNlr5OK8.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +426 -425
- package/dist/server/server.js +299 -298
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-BiiSKqR8.js +0 -1
- package/dist/client/assets/project-app-view-Clk59c4z.js +0 -1
- package/dist/client/assets/record-editor-NkNhuLct.js +0 -1
- package/dist/client/assets/registry-ChnwJUmp.js +0 -2
- package/dist/client/assets/store-registry-CedYa-Zn.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DV3NRVjb.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-xlgt9BjN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as $,$ as Se,K as re,b0 as dt,k as Oe,j as s,l as K,i as fe,B as ne,c as H,G as Pe,a8 as Ie,H as se,aa as De,ab as ke,p as $e,J as mt,I as ut,d as Fe,t as he,M as Re,aC as Ke,ag as ft,P as ht,b as gt,u as xt}from"./index-BI1D40Bb.js";import{u as pt}from"./use-organization-roles-6jciUWXs.js";import{u as je}from"./use-org-auth-client-DXbKeKAB.js";import{B as ge}from"./badge-BprYFRtN.js";import{f as Qe,a as He,b as qe,c as Ze,d as Je,A as Xe,e as We,g as et}from"./alert-dialog-yqhgP4hj.js";import{D as bt,a as Tt,c as Et,d as _t}from"./dropdown-menu-Y95r2cEN.js";import{i as It}from"./DotsVertical-BLsfOrM4.js";import{s as Ae}from"./Plus-ZE1JxTF6.js";import{s as St}from"./Trash01-CHOvnt78.js";import{C as Nt}from"./collection-table-wrapper-BvEPqoQz.js";import{P as te}from"./index-CpEjZ19A.js";import{E as Ge}from"./empty-state-BZYzMqQn.js";import{S as ve}from"./search-input-z-SZ5xmX.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-BzRUrmhb.js";import{u as Ct}from"./use-infinite-scroll-CSzTWLnA.js";import{C as Me}from"./checkbox-BvN2_X-L.js";import{b as At}from"./Settings02-DdGp-K93.js";import{u as Ot}from"./useSuspenseInfiniteQuery-xlgt9BjN.js";import{u as Rt}from"./use-mcp-client-9lFASwC0.js";import{S as jt}from"./constants-B72Xmt_K.js";import{C as vt}from"./collection-search-z1c-OIMq.js";import{u as nt}from"./use-members-Dr-MIVal.js";import{g as lt}from"./get-initials-D-f_fDFw.js";import{u as yt}from"./use-connection-DPLDQYO_.js";import{u as Mt,c as wt}from"./use-ai-providers-CAsm11ID.js";import{A as ot}from"./avatar-DNqtrvfI.js";import{S as xe}from"./switch-B7feKVs7.js";import{c as pe,T as be,a as Te,b as Ee}from"./tooltip-DYkdUcwK.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-BxArx8B4.js";import{t as Lt}from"./ChevronDown-BCfLIH5T.js";import{i as Pt}from"./ChevronRight-B-Oyy1K1.js";import{i as ze}from"./X-A4bflze9.js";import{a as Dt}from"./use-capability-DGt12O9N.js";import{A as kt}from"./access-gate-CX7dYbyt.js";import"./Check-WVQH5yxa.js";import"./Circle-DHcpjdb_.js";import"./table-BbTBSKn5.js";import"./SwitchHorizontal01-DQYstVKd.js";import"./sidebar-CoQlGXUH.js";import"./LayoutLeft-CCd2X9Ad.js";import"./use-mobile-CCpRJzNQ.js";import"./SearchMd-CaBT-6p_.js";import"./XCircle-CVhc7f91.js";import"./agent-icon-RfWwE9MD.js";import"./AlertCircle-CeIhzN_l.js";import"./Tool01-C8AkhemH.js";import"./ArrowUpRight-DfTCnzGD.js";import"./ZapSquare-DLhh9jUV.js";import"./Users03-B59cocJE.js";import"./Loading02-CmiQu1pl.js";import"./CheckCircle-DSPF4aUN.js";import"./ChevronUp-BLdWjTR3.js";import"./Stars02-DxqFtma3.js";import"./Copy01-CzY5zLtf.js";import"./ZoomOut-Ba8by3et.js";import"./Globe01-feY0nKh_.js";import"./Eye-gA6jVXAd.js";import"./FilterLines-EBWqq7Xu.js";import"./Star01-D4eDNr0F.js";import"./Globe04-C7AAKLVZ.js";import"./HardDrive-B_0butHa.js";import"./Key01-DMqGym6L.js";import"./LinkExternal01-CcywGheJ.js";import"./List-CVGAxKAX.js";import"./Monitor01-DAch4x7c.js";import"./Sun-jMKWVpok.js";import"./Palette-DFnIddyo.js";import"./Play-vqCUlmDD.js";import"./SearchLg-D2N8R9Nk.js";import"./Shield01-FoHeAFEB.js";import"./Stars01-BM9lgZA4.js";import"./Upload01-3eWew1xB.js";import"./User01-BN69CLHJ.js";import"./Users01-Ci_ws_VC.js";import"./XClose-CT2qln5j.js";import"./Zap-BsBjWU3t.js";import"./auth-2QEQeQe9.js";import"./use-collections-BpWFaBIs.js";import"./studio-tools-DEGpQ95m.js";import"./card-BM-m_xgk.js";import"./capability-load-error-Cv8z3yAp.js";const we="basic-usage",Le=[{id:we,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER","TASK_BOARD_ITEM_CREATE","TASK_BOARD_ITEM_LIST","TASK_BOARD_ITEM_UPDATE","TASK_BOARD_ITEM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","COMMERCE_DISCOVERY_SETUP","COMMERCE_DISCOVERY_RUN","COMMERCE_DISCOVERY_BIND","COMMERCE_DISCOVERY_CONNECTION_STATUS"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===we)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===we)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=H.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(Me,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(Me,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Se(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,N=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,M=x.current,A=[...M.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!M.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[w,z]=$.useState(G[0]?.id??null),y=w?G.find(b=>b.id===w)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",w??""),queryFn:async()=>w?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:w}})).structuredContent?.item??null:null,enabled:!!w,staleTime:3e4}),F=L?.tools??[],J=(b,D)=>t[b]?.includes(D)??!1,X=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===w?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=w===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:J(y.id,b.name),onToggle:()=>X(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Ne=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ht(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}function qt(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Jt(t){const e=H.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Xt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==T||e[26]!==N?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:N})})}),e[25]=T,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Xt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=H.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[S,E]=$.useState(m),T=m||S,N=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let M;e[24]===Symbol.for("react.memo_cache_sentinel")?(M=()=>N(cs),e[24]=M):M=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let w;e[36]!==T?(w=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=w):w=e[37];let z;e[38]!==w||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,w]}),e[38]=w,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:M,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=wt(n.id);let a,x,o,m,S;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){S=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let M;e[21]!==u?(M=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=M):M=e[22],e[23]!==M||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,M]}),e[23]=M,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=H.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=Mt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(M=>M!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==S?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[N,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,S,E,T,N,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const w=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],S=z,m=Qe,O=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Je,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],N="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=w.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:w.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(Me,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(J=>J.includes(y.id)?J.filter(X=>X!==y.id):[...J,y.id])},disabled:!L||Y}),s.jsx(ot,{url:y.user?.image??void 0,fallback:lt(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=S,e[12]=E,e[13]=T,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],S=e[11],E=e[12],T=e[13],N=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,R]}),e[32]=R,e[33]=N,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Xe,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,M=f.length>0&&`(${f.length})`;let A;e[37]!==S||e[38]!==u||e[39]!==M?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",M]})]}),e[37]=S,e[38]=u,e[39]=M,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=H.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,S;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(ot,{url:I.user?.image??void 0,fallback:lt(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=S}else o=e[7],m=e[8],S=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==E||e[27]!==N?(C=s.jsxs("div",{className:S,children:[E,N]}),e[25]=S,e[26]=E,e[27]=N,e[28]=C):C=e[28],C}function Es(t){const e=H.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ss(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ns(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ss(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=H.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=H.c(14),{locator:n}=Se(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,S=o.formState.isDirty,E=Fe({mutationFn:async u=>{const M=Ns(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const w=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!w.includes(L)),y=w.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,w=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:M,...w?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(w?U:B,w?B:void 0),w?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:M});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const w=await d.organization.updateMemberRole({memberId:B,role:[A]});if(w?.error)throw new Error(w.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,M)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!M.role.id&&!M.role.slug,k=M.role.slug==="owner"&&!M.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:M.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),N=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!S,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?qt(t.role):Ht(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Jt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Ms(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const ws={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?ws[t]??"bg-neutral-400":Ms(t)}function Ps(){const t=H.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Se(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);S=V?{kind:"custom",role:V}:null}const E=S;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==T||t[10]!==N?(C={queryKey:T,queryFn:N},t[9]=T,t[10]=N,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let M,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},M={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=M,t[27]=A,t[28]=k,t[29]=G):(M=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,M,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(bt,{children:[s.jsx(Tt,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(It,{size:16})})}),s.jsx(Et,{align:"end",onClick:Ds,children:s.jsxs(_t,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let w;t[31]!==m?(w=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=w):w=t[32];const z=w;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Ae,{size:16}),t[44]=J):J=t[44];let X;t[45]!==F?(X=s.jsxs(ne,{onClick:F,children:[J,"Create Role"]}),t[45]=F,t[46]=X):X=t[46];let le;t[47]!==Y||t[48]!==X?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,X]}),t[47]=Y,t[48]=X,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(Nt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,s.jsxs(Je,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Xe,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(He,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function Tl(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{Tl as default};
|
|
1
|
+
import{r as $,$ as Se,K as re,b0 as dt,k as Oe,j as s,l as K,i as fe,B as ne,c as H,G as Pe,a8 as Ie,H as se,aa as De,ab as ke,p as $e,J as mt,I as ut,d as Fe,t as he,M as Re,aC as Ke,ag as ft,P as ht,b as gt,u as xt}from"./index-Dsd_iuEd.js";import{u as pt}from"./use-organization-roles-CGYFQ6NZ.js";import{u as je}from"./use-org-auth-client-C-Z33Ztc.js";import{B as ge}from"./badge-D4pyOmCp.js";import{f as Qe,a as He,b as qe,c as Ze,d as Je,A as Xe,e as We,g as et}from"./alert-dialog-NIL7nG4k.js";import{D as bt,a as Tt,c as Et,d as _t}from"./dropdown-menu-DzMUoAiU.js";import{i as It}from"./DotsVertical-D6_pKTzA.js";import{s as Ae}from"./Plus-B0nun22d.js";import{s as St}from"./Trash01-DUs3g8yj.js";import{C as Nt}from"./collection-table-wrapper-B66nKUMI.js";import{P as te}from"./index-aXWMNPUL.js";import{E as Ge}from"./empty-state-3-SuFfhy.js";import{S as ve}from"./search-input-Db1F0jx-.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-DqkK9Eex.js";import{u as Ct}from"./use-infinite-scroll-BDJdA7B_.js";import{C as Me}from"./checkbox-Y7mBxqC3.js";import{b as At}from"./Settings02-DOBWjsq7.js";import{u as Ot}from"./useSuspenseInfiniteQuery-5igL8BlZ.js";import{u as Rt}from"./use-mcp-client-B6xEVCdZ.js";import{S as jt}from"./constants-B72Xmt_K.js";import{C as vt}from"./collection-search-DI69OYkt.js";import{u as nt}from"./use-members-DfknS5vp.js";import{g as lt}from"./get-initials-D-f_fDFw.js";import{u as yt}from"./use-connection-BjAQgmP6.js";import{u as Mt,c as wt}from"./use-ai-providers-BvN_YPeM.js";import{A as ot}from"./avatar-DovY7muZ.js";import{S as xe}from"./switch-Dukm50CX.js";import{c as pe,T as be,a as Te,b as Ee}from"./tooltip-CQRmXLdK.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-B1yWeiiF.js";import{t as Lt}from"./ChevronDown-spisuOMX.js";import{i as Pt}from"./ChevronRight-ClO8KFuz.js";import{i as ze}from"./X-DXVAJV8x.js";import{a as Dt}from"./use-capability-odB-d61W.js";import{A as kt}from"./access-gate-Ba3RACeg.js";import"./Check-B8jlzVAe.js";import"./Circle-DbRXoiZZ.js";import"./table-1C1nYcaS.js";import"./SwitchHorizontal01-l385tnk6.js";import"./sidebar-BBuVIXs3.js";import"./LayoutLeft-SufEyqlt.js";import"./use-mobile-zlseXNZw.js";import"./SearchMd-ByGwfofO.js";import"./XCircle-DWSiH6uW.js";import"./agent-icon-CNKD9od7.js";import"./AlertCircle-B4rVzjGb.js";import"./Tool01-DqOmVP7D.js";import"./ArrowUpRight-Dfyxpo1c.js";import"./ZapSquare-6fv6OHRe.js";import"./Users03-DUE7duSR.js";import"./Loading02-DpP2ZUzL.js";import"./CheckCircle-BGBFQ7TU.js";import"./ChevronUp-CjW_m4ZD.js";import"./Stars02-5EW8AGHQ.js";import"./Copy01-B3rMPdnI.js";import"./ZoomOut-H4y0o0fz.js";import"./Globe01-t_Xn7EOD.js";import"./Eye-Bca7Lcn-.js";import"./FilterLines-C_kuJjS_.js";import"./Star01-DVZvfUNG.js";import"./Globe04-C4us4GD8.js";import"./HardDrive-DPY2W1oq.js";import"./Key01-C4NN9OUR.js";import"./LinkExternal01-CarrE4qF.js";import"./List-DdFdW6qh.js";import"./Monitor01-Di2J1pIG.js";import"./Sun-iQ9ZpSHi.js";import"./Palette-DfvsIzkI.js";import"./Play-C4x8-9Mt.js";import"./SearchLg-DQbhUEwD.js";import"./Shield01-Cbocz3h7.js";import"./Stars01-BQBCKlQH.js";import"./Upload01-pIKYD9iV.js";import"./User01-B-D44sqE.js";import"./Users01-DQ-Z1cTM.js";import"./XClose-CiCDgOUG.js";import"./Zap-BnHiHTqy.js";import"./auth-stk4L42H.js";import"./use-collections-YymHP9DJ.js";import"./studio-tools-CTXw_HGo.js";import"./card-dWlW4g_n.js";import"./capability-load-error-B60fSBlC.js";const we="basic-usage",Le=[{id:we,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER","TASK_BOARD_ITEM_CREATE","TASK_BOARD_ITEM_LIST","TASK_BOARD_ITEM_UPDATE","TASK_BOARD_ITEM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","COMMERCE_DISCOVERY_SETUP","COMMERCE_DISCOVERY_RUN","COMMERCE_DISCOVERY_BIND","COMMERCE_DISCOVERY_CONNECTION_STATUS"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===we)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===we)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=H.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(Me,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(Me,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Se(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,N=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,M=x.current,A=[...M.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!M.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[w,z]=$.useState(G[0]?.id??null),y=w?G.find(b=>b.id===w)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",w??""),queryFn:async()=>w?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:w}})).structuredContent?.item??null:null,enabled:!!w,staleTime:3e4}),F=L?.tools??[],J=(b,D)=>t[b]?.includes(D)??!1,X=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===w?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=w===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:J(y.id,b.name),onToggle:()=>X(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Ne=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ht(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}function qt(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Jt(t){const e=H.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Xt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==T||e[26]!==N?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:N})})}),e[25]=T,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Xt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=H.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[S,E]=$.useState(m),T=m||S,N=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let M;e[24]===Symbol.for("react.memo_cache_sentinel")?(M=()=>N(cs),e[24]=M):M=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let w;e[36]!==T?(w=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=w):w=e[37];let z;e[38]!==w||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,w]}),e[38]=w,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:M,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=wt(n.id);let a,x,o,m,S;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){S=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let M;e[21]!==u?(M=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=M):M=e[22],e[23]!==M||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,M]}),e[23]=M,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=H.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=Mt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(M=>M!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==S?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[N,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,S,E,T,N,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const w=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],S=z,m=Qe,O=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Je,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],N="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=w.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:w.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(Me,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(J=>J.includes(y.id)?J.filter(X=>X!==y.id):[...J,y.id])},disabled:!L||Y}),s.jsx(ot,{url:y.user?.image??void 0,fallback:lt(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=S,e[12]=E,e[13]=T,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],S=e[11],E=e[12],T=e[13],N=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,R]}),e[32]=R,e[33]=N,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Xe,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,M=f.length>0&&`(${f.length})`;let A;e[37]!==S||e[38]!==u||e[39]!==M?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",M]})]}),e[37]=S,e[38]=u,e[39]=M,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=H.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,S;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(ot,{url:I.user?.image??void 0,fallback:lt(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=S}else o=e[7],m=e[8],S=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==E||e[27]!==N?(C=s.jsxs("div",{className:S,children:[E,N]}),e[25]=S,e[26]=E,e[27]=N,e[28]=C):C=e[28],C}function Es(t){const e=H.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ss(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ns(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ss(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=H.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=H.c(14),{locator:n}=Se(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,S=o.formState.isDirty,E=Fe({mutationFn:async u=>{const M=Ns(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const w=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!w.includes(L)),y=w.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,w=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:M,...w?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(w?U:B,w?B:void 0),w?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:M});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const w=await d.organization.updateMemberRole({memberId:B,role:[A]});if(w?.error)throw new Error(w.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,M)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!M.role.id&&!M.role.slug,k=M.role.slug==="owner"&&!M.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:M.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),N=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!S,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?qt(t.role):Ht(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Jt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Ms(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const ws={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?ws[t]??"bg-neutral-400":Ms(t)}function Ps(){const t=H.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Se(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);S=V?{kind:"custom",role:V}:null}const E=S;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==T||t[10]!==N?(C={queryKey:T,queryFn:N},t[9]=T,t[10]=N,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let M,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},M={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=M,t[27]=A,t[28]=k,t[29]=G):(M=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,M,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(bt,{children:[s.jsx(Tt,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(It,{size:16})})}),s.jsx(Et,{align:"end",onClick:Ds,children:s.jsxs(_t,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let w;t[31]!==m?(w=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=w):w=t[32];const z=w;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Ae,{size:16}),t[44]=J):J=t[44];let X;t[45]!==F?(X=s.jsxs(ne,{onClick:F,children:[J,"Create Role"]}),t[45]=F,t[46]=X):X=t[46];let le;t[47]!==Y||t[48]!==X?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,X]}),t[47]=Y,t[48]=X,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(Nt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,s.jsxs(Je,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Xe,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(He,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function Tl(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{Tl as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as b,l as w,j as a,i as j}from"./index-
|
|
1
|
+
import{c as b,l as w,j as a,i as j}from"./index-Dsd_iuEd.js";import{i as N}from"./SearchMd-ByGwfofO.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,j as t,P as D,r as j,aC as w,B as S,t as y}from"./index-
|
|
1
|
+
import{c as p,j as t,P as D,r as j,aC as w,B as S,t as y}from"./index-Dsd_iuEd.js";import{i as k}from"./AlertCircle-B4rVzjGb.js";import{s as z}from"./Plus-B0nun22d.js";import{s as F}from"./User01-B-D44sqE.js";import{t as E}from"./Users01-DQ-Z1cTM.js";import{e as $,d as I,c as O,a as A,b as R,D as T}from"./dialog-DLuAdZWN.js";import{I as N}from"./input-DVEzPKKj.js";import{L as g}from"./label-KpXEJk-h.js";import{a as B,c as V,d as L,S as q,b as C}from"./select-BkgqDf7e.js";import{S as H}from"./skeleton-DSOwcq5l.js";import{T as K}from"./textarea-Cq3eLWgU.js";import{P as b}from"./index-aXWMNPUL.js";import{c as W}from"./settings-section-B1yWeiiF.js";import{u as Y,a as G}from"./use-secrets-B-_MN6-3.js";import{R as J}from"./require-capability-BSa2WA-C.js";import"./X-DXVAJV8x.js";import"./tooltip-CQRmXLdK.js";import"./Check-B8jlzVAe.js";import"./ChevronDown-spisuOMX.js";import"./ChevronUp-CjW_m4ZD.js";import"./sidebar-BBuVIXs3.js";import"./LayoutLeft-SufEyqlt.js";import"./use-mobile-zlseXNZw.js";import"./card-dWlW4g_n.js";import"./ArrowUpRight-Dfyxpo1c.js";import"./studio-tools-CTXw_HGo.js";import"./use-capability-odB-d61W.js";import"./access-gate-Ba3RACeg.js";import"./capability-load-error-B60fSBlC.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function P(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(P,{secret:s},s.id)}function ee(s){return t.jsx(P,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(D,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as He,r as R,l as Be,j as n,B as Ge,i as zn,p as Ss,t as W,K as xs}from"./index-BI1D40Bb.js";import{r as ys,a as bs,s as _s,u as Hn,b as It,K as Un,P as Wn,i as Gn,c as js,d as qn,C as Yn,e as ks,G as ws,V as Rs,f as Jn,g as Rt,D as Qn,h as Xn,S as Zn,v as ea,j as ta,k as Ds,l as Dt,m as mt,n as bt,o as Ns,p as Vs,q as Cs,t as Ps,w as Ts,x as As,y as Ms,z as Es,A as $s,B as Kt,E as Ot,F as Ks,H as ut,I as kt,J as Os,L as Bs,M as Je,N as Vn,O as Fs,Q as Cn,R as Bt,T as Ls,U as an,W as Is,X as et,Y as zs,Z as Hs,_ as Us,$ as Ws,a0 as Gs,a1 as qs,a2 as dt,a3 as Ys,a4 as Js,a5 as Qs,a6 as Pn,a7 as wt,a8 as Xs,a9 as Zs,aa as er,ab as tr,ac as nr,ad as sn,ae as Tn,af as An,ag as yt,ah as Ft,ai as ar,aj as rn,ak as sr,al as rr,am as na,an as Mn,ao as or}from"./index-BKIAYB4q.js";import{t as ir}from"./ChevronDown-BCfLIH5T.js";import{s as aa,n as lr}from"./Loading02-CmiQu1pl.js";import{i as sa}from"./ChevronRight-B-Oyy1K1.js";import{n as cr}from"./ChevronUp-BLdWjTR3.js";import{U as ln,P as ra,C as ur,V as dr,W as mr}from"./agent-icon-RfWwE9MD.js";import{i as fr}from"./Globe01-feY0nKh_.js";import{A as Lt}from"./automation-runs-qnj_dOPl.js";import{T as ft,a as pt,b as ht}from"./tooltip-DYkdUcwK.js";import{a as pr,c as hr,b as gr,D as vr,d as Sr,e as xr}from"./dialog-DVfr6U1Q.js";import{I as yr}from"./input-CFV763iN.js";import{a as oa}from"./Copy01-CzY5zLtf.js";import{b as br}from"./ZoomOut-Ba8by3et.js";import{i as _r}from"./Settings02-DdGp-K93.js";import{s as jr}from"./Eye-gA6jVXAd.js";import{s as cn}from"./Plus-ZE1JxTF6.js";import{s as ia}from"./Trash01-CHOvnt78.js";import{i as kr}from"./Zap-BsBjWU3t.js";import{d as it,a as la,D as ca,c as ua,j as wr}from"./dropdown-menu-Y95r2cEN.js";import{r as En,u as Rr,d as Dr,a as Nr,i as Vr,f as Cr,P as Pr,b as Tr,S as Ar}from"./page-seo-form-rz6XACmv.js";import{c as Mr}from"./Tool01-C8AkhemH.js";import{A as Er}from"./add-section-modal-B4RbvfBl.js";import"./SwitchHorizontal01-DQYstVKd.js";import"./chat-context-BIEy3GO6.js";import"./autosend-Ca67mpUq.js";import"./hooks-airELZ_8.js";import"./use-mcp-client-9lFASwC0.js";import"./constants-B72Xmt_K.js";import"./auth-2QEQeQe9.js";import"./decopilot-sse-pool-Ddi9cv7p.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-uIDmqhnP.js";import"./use-collections-BpWFaBIs.js";import"./use-ai-providers-CAsm11ID.js";import"./studio-tools-DEGpQ95m.js";import"./use-decopilot-events-C_VHZWO-.js";import"./tab-id-DAJ8K7VA.js";import"./use-organization-settings-CG0jiKsK.js";import"./drawer-DrJLyRrS.js";import"./collection-search-z1c-OIMq.js";import"./SearchMd-CaBT-6p_.js";import"./use-mobile-CCpRJzNQ.js";import"./use-mcp-prompts-DTsMk0A1.js";import"./X-A4bflze9.js";import"./shell-layout-BG9xor_B.js";import"./avatar-DNqtrvfI.js";import"./User01-BN69CLHJ.js";import"./Users03-B59cocJE.js";import"./SearchLg-D2N8R9Nk.js";import"./Stars02-DxqFtma3.js";import"./XClose-CT2qln5j.js";import"./CheckCircle-DSPF4aUN.js";import"./FilterLines-EBWqq7Xu.js";import"./alert-dialog-yqhgP4hj.js";import"./required-auth-layout-yvVLN6Hm.js";import"./use-org-sso-DeEfR5na.js";import"./ZapSquare-DLhh9jUV.js";import"./Check-WVQH5yxa.js";import"./Star01-D4eDNr0F.js";import"./Upload01-3eWew1xB.js";import"./AlertCircle-CeIhzN_l.js";import"./form-Cr_F07qT.js";import"./label-D3fiZK_8.js";import"./select-DtepIC1g.js";import"./XCircle-CVhc7f91.js";import"./tabs-DjXPPUR2.js";import"./toggle-group-2w_n_L5K.js";import"./agent-capabilities-Cy_FyUQh.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BAiqBQka.js";import"./use-registry-connections-NeJTwcjk.js";import"./use-connection-DPLDQYO_.js";import"./useInfiniteQuery-DV3NRVjb.js";import"./use-infinite-scroll-CSzTWLnA.js";import"./extract-connection-data-GBMA3Mly.js";import"./card-BM-m_xgk.js";import"./integration-icon-BzRUrmhb.js";import"./collection-tabs-CwsBPM-c.js";import"./badge-BprYFRtN.js";import"./textarea-Dq7eH56b.js";import"./connection-form-helpers-D7avntPs.js";import"./authenticate-and-persist-oauth-G879iPre.js";import"./mcp-oauth-BmK9oSzX.js";import"./useSuspenseInfiniteQuery-xlgt9BjN.js";import"./Monitor01-DAch4x7c.js";import"./connect-desktop-dialog-tWWNbof3.js";import"./select-model-pOunWX2H.js";import"./checkbox-BvN2_X-L.js";import"./skeleton-Cpt27Mrt.js";import"./Key01-DMqGym6L.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BxArx8B4.js";import"./ArrowUpRight-DfTCnzGD.js";import"./Stars01-BM9lgZA4.js";import"./command-eUIMnfT_.js";import"./index-BzDAMSl8.js";import"./popover-C2A6_B6a.js";import"./index-D6lqM2He.js";import"./Palette-DFnIddyo.js";import"./file-type-icon-BMuZwTUw.js";import"./toolbar-CeFkCbVX.js";import"./use-debounced-value-DNKtJ7rs.js";import"./DotsVertical-BLsfOrM4.js";import"./LinkExternal01-CcywGheJ.js";import"./index-ClYtmMEi.js";import"./LayoutLeft-CCd2X9Ad.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DwBuWAo_.js";import"./empty-state-BZYzMqQn.js";import"./use-mcp-tools-DUQ6pfgC.js";import"./types-qnoLRMPf.js";import"./use-capability-DGt12O9N.js";import"./tools-list-uNF3PJAj.js";import"./switch-B7feKVs7.js";import"./Play-vqCUlmDD.js";import"./use-debounced-autosave-4yffmoWA.js";import"./index-CpEjZ19A.js";import"./sidebar-CoQlGXUH.js";import"./search-input-z-SZ5xmX.js";import"./github-repo-picker-BeZYm6Y_.js";import"./use-navigate-to-agent-BLGuQu2W.js";import"./reusable-new-chat-qqWu133U.js";import"./github-installations-DzN1UQ4x.js";import"./Users01-Ci_ws_VC.js";import"./use-secrets-BPpuxuTF.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-members-Dr-MIVal.js";import"./use-org-auth-client-DXbKeKAB.js";import"./index-XJyq3Z1f.js";import"./get-initials-D-f_fDFw.js";import"./List-CVGAxKAX.js";import"./format-time-Cy7tTmZp.js";import"./Circle-DHcpjdb_.js";import"./calendar-Dxh-u67O.js";import"./toolbar-icon-button-CLKQStf7.js";import"./use-file-configs-Cq7kWeal.js";import"./monaco-editor-DJ2sFoTh.js";import"./use-automations-AFDXGXPs.js";import"./automation-list-row-CpS2pwCu.js";import"./Globe04-C7AAKLVZ.js";import"./HardDrive-B_0butHa.js";import"./Sun-jMKWVpok.js";import"./Shield01-FoHeAFEB.js";import"./table-BbTBSKn5.js";import"./use-clock-tick-DG2pLp-q.js";import"./use-copy-B_rqSo6t.js";function $r(d){return d.schema?.definitions??d.schema?.$defs??{}}function Kr(d,e){const r=$r(e),l=r[btoa(d)];if(!l)return;let u=typeof l.image=="string"?l.image:void 0;if(!u&&Array.isArray(l.allOf)){const h=l.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof h=="string"){const S=h.replace("#/definitions/",""),m=r[S];u=typeof m?.image=="string"?m.image:void 0}}if(u?.includes("{{{"))return u}function Or(d,e){if(!e)return;const r=ys(d);if(!r)return;const l=Kr(r.resolveType,e);if(!l)return;const u=bs(l,r.data);if(u)return _s(u)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Fr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function $n(d){return Array.from({length:d},(e,r)=>({id:crypto.randomUUID(),index:r}))}function da(d){return d.map((e,r)=>({...e,index:r}))}function Lr(d,e){if(e===d.length)return d;if(e<d.length)return da(d.slice(0,e));const r=Array.from({length:e-d.length},(l,u)=>({id:crypto.randomUUID(),index:d.length+u}));return[...d,...r]}function ma(d){const e=He.c(20),{section:r,raw:l,meta:u}=d,h=r.isSavedBlock===!0,S=r.isMultivariate===!0;let m;e[0]!==u||e[1]!==l?(m=l&&u?Or(l,u):void 0,e[0]=u,e[1]=l,e[2]=m):m=e[2];const v=m;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(br,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let y;e[4]!==v?(y=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=y):y=e[5];let N;e[6]!==S||e[7]!==h?(N=h?{color:ws}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=h,e[8]=N):N=e[8];let k;e[9]!==N?(k=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:N}),e[9]=N,e[10]=k):k=e[10];const _=r.isHidden&&"line-through opacity-50";let w;e[11]!==_?(w=Be("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=w):w=e[12];let o;e[13]!==r.label||e[14]!==w?(o=n.jsx("span",{className:w,children:r.label}),e[13]=r.label,e[14]=w,e[15]=o):o=e[15];let D;return e[16]!==y||e[17]!==k||e[18]!==o?(D=n.jsxs(n.Fragment,{children:[g,y,k,o]}),e[16]=y,e[17]=k,e[18]=o,e[19]=D):D=e[19],D}function fa(d,e){const r=d.isSavedBlock===!0,l=d.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:l?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ir(d){const e=He.c(64),{section:r,raw:l,meta:u,sortableId:h,selected:S,onSelect:m,onDelete:v,onDuplicate:g,onMakeReusable:y,onToggleHidden:N,onToggleLazy:k,onAddVariant:_,onDetach:w}=d,o=l?Gn(l.__resolveType??""):!1;let D;e[0]!==r?(D=js(r),e[0]=r,e[1]=D):D=e[1];const c=D;let J;e[2]!==h?(J={id:h,animateLayoutChanges:Gr},e[2]=h,e[3]=J):J=e[3];const{attributes:H,listeners:$,setNodeRef:f,transform:P,isDragging:se}=qn(J);let T;e[4]!==P?(T=Yn.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=se?0:void 0;let V;e[6]!==T||e[7]!==pe?(V={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=V):V=e[8];const ce=V;let B;e[9]!==r?(B=ks(r),e[9]=r,e[10]=B):B=e[10];const te=B,oe="button",Ce=0;let E;e[11]!==m?(E=K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),m())},e[11]=m,e[12]=E):E=e[12];const ue=se?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Be("touch-none transition-colors",ue,fa(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==u||e[18]!==l||e[19]!==r?(je=n.jsx(ma,{section:r,raw:l,meta:u}),e[17]=u,e[18]=l,e[19]=r,e[20]=je):je=e[20];const M=!r.isMultivariate&&n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Be("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),k()},onPointerDown:Wr,children:n.jsx(kr,{className:Be("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(ht,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==N||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Be("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),N()},onPointerDown:Ur,children:r.isHidden?n.jsx(_r,{className:"h-3.5 w-3.5"}):n.jsx(jr,{className:"h-3.5 w-3.5"})})}),n.jsx(ht,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=N,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(la,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(ra,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let Ne;e[26]!==g?(Ne=K=>{K.stopPropagation(),g()},e[26]=g,e[27]=Ne):Ne=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(oa,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let re;e[29]!==Ne?(re=n.jsxs(it,{onClick:Ne,children:[ve,"Duplicate"]}),e[29]=Ne,e[30]=re):re=e[30];let G;e[31]!==c||e[32]!==_?(G=c&&n.jsxs(it,{className:Rs,onClick:K=>{K.stopPropagation(),_()},children:[n.jsx(aa,{className:"h-4 w-4"}),"Add variant"]}),e[31]=c,e[32]=_,e[33]=G):G=e[33];let q;e[34]!==te||e[35]!==y?(q=te&&n.jsxs(it,{className:Fr,onClick:K=>{K.stopPropagation(),y()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=y,e[36]=q):q=e[36];let ne;e[37]!==w||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:K=>{K.stopPropagation(),w()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=w,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=K=>{K.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(ia,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==re||e[47]!==G||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(ca,{children:[X,n.jsxs(ua,{align:"end",className:"w-44",children:[re,G,q,ne,Se]})]}),e[46]=re,e[47]=G,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let be;return e[52]!==H||e[53]!==$||e[54]!==m||e[55]!==f||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==M||e[60]!==Ae||e[61]!==de||e[62]!==E?(be=n.jsxs("div",{ref:f,style:ce,...H,...$,role:oe,tabIndex:Ce,onClick:m,onKeyDown:E,className:ie,children:[je,M,Ae,de]}),e[52]=H,e[53]=$,e[54]=m,e[55]=f,e[56]=ce,e[57]=ie,e[58]=je,e[59]=M,e[60]=Ae,e[61]=de,e[62]=E,e[63]=be):be=e[63],be}function zr(d){return d.stopPropagation()}function Hr(d){return d.stopPropagation()}function Ur(d){return d.stopPropagation()}function Wr(d){return d.stopPropagation()}function Gr(){return!1}function qr(d){const e=He.c(90),{listKey:r,rawSections:l,sections:u,meta:h,selectedIndex:S,onSelect:m,onReorder:v,onDelete:g,onDuplicate:y,onMakeReusable:N,onToggleHidden:k,onToggleLazy:_,onAddVariant:w,onDetach:o,onAddSection:D,canAddSection:c}=d,J=c===void 0?!0:c;let H;e[0]!==u.length?(H=()=>$n(u.length),e[0]=u.length,e[1]=H):H=e[1];const[$,f]=R.useState(H),[P,se]=R.useState(null),[T,pe]=R.useState(r),[V,ce]=R.useState(u.length),B=R.useRef(!1);T!==r?(pe(r),ce(u.length),f($n(u.length))):V!==u.length&&(ce(u.length),f(F=>Lr(F,u.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Jn},e[3]=oe):oe=e[3];const Ce=Hn(It(Wn,te),It(Un,oe));let E;e[4]!==$?(E=$.map(Yr),e[4]=$,e[5]=E):E=e[5];const ue=E;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=F=>{se(String(F.active.id))},e[6]=ie):ie=e[6];const je=ie;let M;e[7]!==ue||e[8]!==v?(M=F=>{se(null);const{active:ae,over:Q}=F;if(!Q||ae.id===Q.id)return;const Ie=ue.indexOf(String(ae.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(f(Qe=>da(Rt([...Qe],Ie,he))),B.current=!0,requestAnimationFrame(()=>{B.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=M):M=e[9];const Ae=M;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{se(null)},e[10]=X):X=e[10];const Ne=X;let ve,re,G,q,ne,le,ke,Se,de,be,K,Z,we,Ee,$e;if(e[11]!==P||e[12]!==J||e[13]!==$||e[14]!==ue||e[15]!==Ae||e[16]!==h||e[17]!==D||e[18]!==w||e[19]!==g||e[20]!==o||e[21]!==y||e[22]!==N||e[23]!==m||e[24]!==k||e[25]!==_||e[26]!==l||e[27]!==u||e[28]!==S||e[29]!==Ce){Ee=Symbol.for("react.early_return_sentinel");e:{const F=ae=>{B.current||m(ae)};if(e[45]!==P||e[46]!==J||e[47]!==$||e[48]!==D||e[49]!==l||e[50]!==u){const ae=P?$.find(Q=>Q.id===P):null;if(q=ae!=null?u[ae.index]:null,G=ae!=null?l[ae.index]:void 0,$.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!J;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(cn,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==D||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:D,children:[he,"Add section"]})]}),e[56]=D,e[57]=Ie,e[58]=Qe):Qe=e[58],Ee=Qe;break e}we=Be(ae&&"cursor-grabbing"),e[45]=P,e[46]=J,e[47]=$,e[48]=D,e[49]=l,e[50]=u,e[51]=G,e[52]=q,e[53]=we}else G=e[51],q=e[52],we=e[53];re=Qn,Se=Ce,de=Xn,be=je,K=Ae,Z=Ne,ve=Zn,le=ue,ke=ea,$e="space-y-1",ne=$.map(ae=>{const Q=u[ae.index];return Q?n.jsx(Ir,{sortableId:ae.id,section:Q,raw:l[ae.index],meta:h,selected:S===ae.index,onSelect:()=>F(ae.index),onDelete:()=>g(ae.index),onDuplicate:()=>y(ae.index),onMakeReusable:()=>N(ae.index),onToggleHidden:()=>k(ae.index),onToggleLazy:()=>_(ae.index),onAddVariant:()=>w(ae.index),onDetach:()=>o(ae.index)},ae.id):null})}e[11]=P,e[12]=J,e[13]=$,e[14]=ue,e[15]=Ae,e[16]=h,e[17]=D,e[18]=w,e[19]=g,e[20]=o,e[21]=y,e[22]=N,e[23]=m,e[24]=k,e[25]=_,e[26]=l,e[27]=u,e[28]=S,e[29]=Ce,e[30]=ve,e[31]=re,e[32]=G,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=be,e[40]=K,e[41]=Z,e[42]=we,e[43]=Ee,e[44]=$e}else ve=e[30],re=e[31],G=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],be=e[39],K=e[40],Z=e[41],we=e[42],Ee=e[43],$e=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Fe;e[59]!==ne||e[60]!==$e?(Fe=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Fe):Fe=e[61];let Pe;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Fe?(Pe=n.jsx(ve,{items:le,strategy:ke,children:Fe}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Fe,e[66]=Pe):Pe=e[66];let Ke;e[67]!==G||e[68]!==q||e[69]!==h?(Ke=q?n.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",fa(q,!1)),children:n.jsx(ma,{section:q,raw:G,meta:h})}):null,e[67]=G,e[68]=q,e[69]=h,e[70]=Ke):Ke=e[70];let Le;e[71]!==Ke?(Le=n.jsx(ta,{dropAnimation:null,children:Ke}),e[71]=Ke,e[72]=Le):Le=e[72];let Me;e[73]!==re||e[74]!==Se||e[75]!==de||e[76]!==be||e[77]!==K||e[78]!==Z||e[79]!==Pe||e[80]!==Le?(Me=n.jsxs(re,{sensors:Se,collisionDetection:de,onDragStart:be,onDragEnd:K,onDragCancel:Z,children:[Pe,Le]}),e[73]=re,e[74]=Se,e[75]=de,e[76]=be,e[77]=K,e[78]=Z,e[79]=Pe,e[80]=Le,e[81]=Me):Me=e[81];const xe=!J;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==D||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:D,children:[Re,"Add section"]}),e[83]=D,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function Yr(d){return d.id}function Kn(d){const e=He.c(38),{open:r,initialName:l,autoLabel:u,isPending:h,onSubmit:S,onOpenChange:m}=d,v=h===void 0?!1:h,[g,y]=R.useState(l),[N,k]=R.useState(r);r!==N&&(k(r),r&&y(l));let _;e[0]!==v||e[1]!==m?(_=oe=>{!oe&&!v&&m(!1)},e[0]=v,e[1]=m,e[2]=_):_=e[2];const w=_;let o;e[3]!==v||e[4]!==g||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(g.trim())},e[3]=v,e[4]=g,e[5]=S,e[6]=o):o=e[6];const D=o;let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(pr,{children:"Rename variant"}),e[7]=c):c=e[7];const J=u||"the rule";let H;e[8]!==J?(H=n.jsxs(hr,{children:[c,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:J}),"."]})]}),e[8]=J,e[9]=H):H=e[9];let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=$):$=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=oe=>y(oe.target.value),e[11]=f):f=e[11];let P;e[12]!==u||e[13]!==v||e[14]!==g?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[$,n.jsx(yr,{id:"variant-rename-name",value:g,onChange:f,placeholder:u,autoFocus:!0,disabled:v})]}),e[12]=u,e[13]=v,e[14]=g,e[15]=P):P=e[15];let se;e[16]!==m?(se=()=>m(!1),e[16]=m,e[17]=se):se=e[17];let T;e[18]!==v||e[19]!==se?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:se,disabled:v,children:"Cancel"}),e[18]=v,e[19]=se,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(zn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let V;e[23]!==v||e[24]!==pe?(V=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=V):V=e[25];let ce;e[26]!==T||e[27]!==V?(ce=n.jsxs(vr,{children:[T,V]}),e[26]=T,e[27]=V,e[28]=ce):ce=e[28];let B;e[29]!==D||e[30]!==ce||e[31]!==H||e[32]!==P?(B=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:D,children:[H,P,ce]})}),e[29]=D,e[30]=ce,e[31]=H,e[32]=P,e[33]=B):B=e[33];let te;return e[34]!==w||e[35]!==r||e[36]!==B?(te=n.jsx(xr,{open:r,onOpenChange:w,children:B}),e[34]=w,e[35]=r,e[36]=B,e[37]=te):te=e[37],te}const Jr="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",pa="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]";function ha(d){const e=He.c(5),{rule:r,matchers:l}=d,u=r?.__resolveType??"";let h;if(e[0]!==l||e[1]!==u){const g=l.find(y=>y.resolveType===u)?.iconName??Ds(u);h=ur(g),e[0]=l,e[1]=u,e[2]=h}else h=e[2];const S=h;if(!S)return null;let m;return e[3]!==S?(m=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=m):m=e[4],m}function On(d){return d.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{c as He,r as R,l as Be,j as n,B as Ge,i as zn,p as Ss,t as W,K as xs}from"./index-Dsd_iuEd.js";import{r as ys,a as bs,s as _s,u as Hn,b as It,K as Un,P as Wn,i as Gn,c as js,d as qn,C as Yn,e as ks,G as ws,V as Rs,f as Jn,g as Rt,D as Qn,h as Xn,S as Zn,v as ea,j as ta,k as Ds,l as Dt,m as mt,n as bt,o as Ns,p as Vs,q as Cs,t as Ps,w as Ts,x as As,y as Ms,z as Es,A as $s,B as Kt,E as Ot,F as Ks,H as ut,I as kt,J as Os,L as Bs,M as Je,N as Vn,O as Fs,Q as Cn,R as Bt,T as Ls,U as an,W as Is,X as et,Y as zs,Z as Hs,_ as Us,$ as Ws,a0 as Gs,a1 as qs,a2 as dt,a3 as Ys,a4 as Js,a5 as Qs,a6 as Pn,a7 as wt,a8 as Xs,a9 as Zs,aa as er,ab as tr,ac as nr,ad as sn,ae as Tn,af as An,ag as yt,ah as Ft,ai as ar,aj as rn,ak as sr,al as rr,am as na,an as Mn,ao as or}from"./index-HPYN2PdL.js";import{t as ir}from"./ChevronDown-spisuOMX.js";import{s as aa,n as lr}from"./Loading02-DpP2ZUzL.js";import{i as sa}from"./ChevronRight-ClO8KFuz.js";import{n as cr}from"./ChevronUp-CjW_m4ZD.js";import{U as ln,P as ra,C as ur,V as dr,W as mr}from"./agent-icon-CNKD9od7.js";import{i as fr}from"./Globe01-t_Xn7EOD.js";import{A as Lt}from"./automation-runs-CZZ0My05.js";import{T as ft,a as pt,b as ht}from"./tooltip-CQRmXLdK.js";import{a as pr,c as hr,b as gr,D as vr,d as Sr,e as xr}from"./dialog-DLuAdZWN.js";import{I as yr}from"./input-DVEzPKKj.js";import{a as oa}from"./Copy01-B3rMPdnI.js";import{b as br}from"./ZoomOut-H4y0o0fz.js";import{i as _r}from"./Settings02-DOBWjsq7.js";import{s as jr}from"./Eye-Bca7Lcn-.js";import{s as cn}from"./Plus-B0nun22d.js";import{s as ia}from"./Trash01-DUs3g8yj.js";import{i as kr}from"./Zap-BnHiHTqy.js";import{d as it,a as la,D as ca,c as ua,j as wr}from"./dropdown-menu-DzMUoAiU.js";import{r as En,u as Rr,d as Dr,a as Nr,i as Vr,f as Cr,P as Pr,b as Tr,S as Ar}from"./page-seo-form-DeODCAhK.js";import{c as Mr}from"./Tool01-DqOmVP7D.js";import{A as Er}from"./add-section-modal-AWqdUvsG.js";import"./SwitchHorizontal01-l385tnk6.js";import"./chat-context-DHy9Wrla.js";import"./autosend-CIRnSFlG.js";import"./hooks-BmOjuM2y.js";import"./use-mcp-client-B6xEVCdZ.js";import"./constants-B72Xmt_K.js";import"./auth-stk4L42H.js";import"./decopilot-sse-pool-CEetn8QJ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CR8RESJp.js";import"./use-collections-YymHP9DJ.js";import"./use-ai-providers-BvN_YPeM.js";import"./studio-tools-CTXw_HGo.js";import"./use-decopilot-events-TPOfwfqa.js";import"./tab-id-DAJ8K7VA.js";import"./use-organization-settings-DVhD0MdP.js";import"./drawer-BT0nO7Gh.js";import"./collection-search-DI69OYkt.js";import"./SearchMd-ByGwfofO.js";import"./use-mobile-zlseXNZw.js";import"./use-mcp-prompts-C2qEigUb.js";import"./X-DXVAJV8x.js";import"./shell-layout-BIM9a05w.js";import"./avatar-DovY7muZ.js";import"./User01-B-D44sqE.js";import"./Users03-DUE7duSR.js";import"./SearchLg-DQbhUEwD.js";import"./Stars02-5EW8AGHQ.js";import"./XClose-CiCDgOUG.js";import"./CheckCircle-BGBFQ7TU.js";import"./FilterLines-C_kuJjS_.js";import"./alert-dialog-NIL7nG4k.js";import"./required-auth-layout-Dpk92TPe.js";import"./use-org-sso-BxT29NsJ.js";import"./ZapSquare-6fv6OHRe.js";import"./Check-B8jlzVAe.js";import"./Star01-DVZvfUNG.js";import"./Upload01-pIKYD9iV.js";import"./AlertCircle-B4rVzjGb.js";import"./form-B7RrBOMB.js";import"./label-KpXEJk-h.js";import"./select-BkgqDf7e.js";import"./XCircle-DWSiH6uW.js";import"./tabs-E6RgSpIm.js";import"./toggle-group-DSuixrOu.js";import"./agent-capabilities-C8aAokhv.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-ByKWgKNO.js";import"./use-registry-connections-vzpQSjWc.js";import"./use-connection-BjAQgmP6.js";import"./useInfiniteQuery-BZ1RPZ6t.js";import"./use-infinite-scroll-BDJdA7B_.js";import"./extract-connection-data-89-kNEsj.js";import"./card-dWlW4g_n.js";import"./integration-icon-DqkK9Eex.js";import"./collection-tabs-CQALAm3p.js";import"./badge-D4pyOmCp.js";import"./textarea-Cq3eLWgU.js";import"./connection-form-helpers-BX_278as.js";import"./authenticate-and-persist-oauth-XK4s1c0p.js";import"./mcp-oauth-5ck9cQwI.js";import"./useSuspenseInfiniteQuery-5igL8BlZ.js";import"./Monitor01-Di2J1pIG.js";import"./connect-desktop-dialog-D-rafo3k.js";import"./select-model-CwXaZaFK.js";import"./checkbox-Y7mBxqC3.js";import"./skeleton-DSOwcq5l.js";import"./Key01-C4NN9OUR.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B1yWeiiF.js";import"./ArrowUpRight-Dfyxpo1c.js";import"./Stars01-BQBCKlQH.js";import"./command-COJkBM8v.js";import"./index-D4SvmBXn.js";import"./popover-3culmC-p.js";import"./index-Y-ZfkmZF.js";import"./Palette-DfvsIzkI.js";import"./file-type-icon-D3Rdi0rC.js";import"./toolbar-BgxtbB8k.js";import"./use-debounced-value-BU9d5vE5.js";import"./DotsVertical-D6_pKTzA.js";import"./LinkExternal01-CarrE4qF.js";import"./index-C88R47Te.js";import"./LayoutLeft-SufEyqlt.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BERlBf-i.js";import"./empty-state-3-SuFfhy.js";import"./use-mcp-tools-CMNfuH8d.js";import"./types-DkVBp3lw.js";import"./use-capability-odB-d61W.js";import"./tools-list-C1X0VZfQ.js";import"./switch-Dukm50CX.js";import"./Play-C4x8-9Mt.js";import"./use-debounced-autosave-CV4B4Gkf.js";import"./index-aXWMNPUL.js";import"./sidebar-BBuVIXs3.js";import"./search-input-Db1F0jx-.js";import"./github-repo-picker-Dykj2qFx.js";import"./use-navigate-to-agent-DukigbvT.js";import"./reusable-new-chat-qqWu133U.js";import"./github-installations-DzN1UQ4x.js";import"./Users01-DQ-Z1cTM.js";import"./use-secrets-B-_MN6-3.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-members-DfknS5vp.js";import"./use-org-auth-client-C-Z33Ztc.js";import"./index-BKUm7yV5.js";import"./get-initials-D-f_fDFw.js";import"./List-DdFdW6qh.js";import"./format-time-Cy7tTmZp.js";import"./Circle-DbRXoiZZ.js";import"./calendar-0_GqbDzm.js";import"./toolbar-icon-button-AVA73zGb.js";import"./use-file-configs-DA4-SvXK.js";import"./monaco-editor-Cnz_x1QX.js";import"./use-automations-C-qbYs9z.js";import"./automation-list-row-CY9TbBsv.js";import"./Globe04-C4us4GD8.js";import"./HardDrive-DPY2W1oq.js";import"./Sun-iQ9ZpSHi.js";import"./Shield01-Cbocz3h7.js";import"./table-1C1nYcaS.js";import"./use-clock-tick-fro43T2v.js";import"./use-copy-Bk6Ve8B3.js";function $r(d){return d.schema?.definitions??d.schema?.$defs??{}}function Kr(d,e){const r=$r(e),l=r[btoa(d)];if(!l)return;let u=typeof l.image=="string"?l.image:void 0;if(!u&&Array.isArray(l.allOf)){const h=l.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof h=="string"){const S=h.replace("#/definitions/",""),m=r[S];u=typeof m?.image=="string"?m.image:void 0}}if(u?.includes("{{{"))return u}function Or(d,e){if(!e)return;const r=ys(d);if(!r)return;const l=Kr(r.resolveType,e);if(!l)return;const u=bs(l,r.data);if(u)return _s(u)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Fr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function $n(d){return Array.from({length:d},(e,r)=>({id:crypto.randomUUID(),index:r}))}function da(d){return d.map((e,r)=>({...e,index:r}))}function Lr(d,e){if(e===d.length)return d;if(e<d.length)return da(d.slice(0,e));const r=Array.from({length:e-d.length},(l,u)=>({id:crypto.randomUUID(),index:d.length+u}));return[...d,...r]}function ma(d){const e=He.c(20),{section:r,raw:l,meta:u}=d,h=r.isSavedBlock===!0,S=r.isMultivariate===!0;let m;e[0]!==u||e[1]!==l?(m=l&&u?Or(l,u):void 0,e[0]=u,e[1]=l,e[2]=m):m=e[2];const v=m;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(br,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let y;e[4]!==v?(y=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=y):y=e[5];let N;e[6]!==S||e[7]!==h?(N=h?{color:ws}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=h,e[8]=N):N=e[8];let k;e[9]!==N?(k=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:N}),e[9]=N,e[10]=k):k=e[10];const _=r.isHidden&&"line-through opacity-50";let w;e[11]!==_?(w=Be("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=w):w=e[12];let o;e[13]!==r.label||e[14]!==w?(o=n.jsx("span",{className:w,children:r.label}),e[13]=r.label,e[14]=w,e[15]=o):o=e[15];let D;return e[16]!==y||e[17]!==k||e[18]!==o?(D=n.jsxs(n.Fragment,{children:[g,y,k,o]}),e[16]=y,e[17]=k,e[18]=o,e[19]=D):D=e[19],D}function fa(d,e){const r=d.isSavedBlock===!0,l=d.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:l?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ir(d){const e=He.c(64),{section:r,raw:l,meta:u,sortableId:h,selected:S,onSelect:m,onDelete:v,onDuplicate:g,onMakeReusable:y,onToggleHidden:N,onToggleLazy:k,onAddVariant:_,onDetach:w}=d,o=l?Gn(l.__resolveType??""):!1;let D;e[0]!==r?(D=js(r),e[0]=r,e[1]=D):D=e[1];const c=D;let J;e[2]!==h?(J={id:h,animateLayoutChanges:Gr},e[2]=h,e[3]=J):J=e[3];const{attributes:H,listeners:$,setNodeRef:f,transform:P,isDragging:se}=qn(J);let T;e[4]!==P?(T=Yn.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=se?0:void 0;let V;e[6]!==T||e[7]!==pe?(V={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=V):V=e[8];const ce=V;let B;e[9]!==r?(B=ks(r),e[9]=r,e[10]=B):B=e[10];const te=B,oe="button",Ce=0;let E;e[11]!==m?(E=K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),m())},e[11]=m,e[12]=E):E=e[12];const ue=se?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Be("touch-none transition-colors",ue,fa(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==u||e[18]!==l||e[19]!==r?(je=n.jsx(ma,{section:r,raw:l,meta:u}),e[17]=u,e[18]=l,e[19]=r,e[20]=je):je=e[20];const M=!r.isMultivariate&&n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Be("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),k()},onPointerDown:Wr,children:n.jsx(kr,{className:Be("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(ht,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==N||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Be("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),N()},onPointerDown:Ur,children:r.isHidden?n.jsx(_r,{className:"h-3.5 w-3.5"}):n.jsx(jr,{className:"h-3.5 w-3.5"})})}),n.jsx(ht,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=N,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(la,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(ra,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let Ne;e[26]!==g?(Ne=K=>{K.stopPropagation(),g()},e[26]=g,e[27]=Ne):Ne=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(oa,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let re;e[29]!==Ne?(re=n.jsxs(it,{onClick:Ne,children:[ve,"Duplicate"]}),e[29]=Ne,e[30]=re):re=e[30];let G;e[31]!==c||e[32]!==_?(G=c&&n.jsxs(it,{className:Rs,onClick:K=>{K.stopPropagation(),_()},children:[n.jsx(aa,{className:"h-4 w-4"}),"Add variant"]}),e[31]=c,e[32]=_,e[33]=G):G=e[33];let q;e[34]!==te||e[35]!==y?(q=te&&n.jsxs(it,{className:Fr,onClick:K=>{K.stopPropagation(),y()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=y,e[36]=q):q=e[36];let ne;e[37]!==w||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:K=>{K.stopPropagation(),w()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=w,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=K=>{K.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(ia,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==re||e[47]!==G||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(ca,{children:[X,n.jsxs(ua,{align:"end",className:"w-44",children:[re,G,q,ne,Se]})]}),e[46]=re,e[47]=G,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let be;return e[52]!==H||e[53]!==$||e[54]!==m||e[55]!==f||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==M||e[60]!==Ae||e[61]!==de||e[62]!==E?(be=n.jsxs("div",{ref:f,style:ce,...H,...$,role:oe,tabIndex:Ce,onClick:m,onKeyDown:E,className:ie,children:[je,M,Ae,de]}),e[52]=H,e[53]=$,e[54]=m,e[55]=f,e[56]=ce,e[57]=ie,e[58]=je,e[59]=M,e[60]=Ae,e[61]=de,e[62]=E,e[63]=be):be=e[63],be}function zr(d){return d.stopPropagation()}function Hr(d){return d.stopPropagation()}function Ur(d){return d.stopPropagation()}function Wr(d){return d.stopPropagation()}function Gr(){return!1}function qr(d){const e=He.c(90),{listKey:r,rawSections:l,sections:u,meta:h,selectedIndex:S,onSelect:m,onReorder:v,onDelete:g,onDuplicate:y,onMakeReusable:N,onToggleHidden:k,onToggleLazy:_,onAddVariant:w,onDetach:o,onAddSection:D,canAddSection:c}=d,J=c===void 0?!0:c;let H;e[0]!==u.length?(H=()=>$n(u.length),e[0]=u.length,e[1]=H):H=e[1];const[$,f]=R.useState(H),[P,se]=R.useState(null),[T,pe]=R.useState(r),[V,ce]=R.useState(u.length),B=R.useRef(!1);T!==r?(pe(r),ce(u.length),f($n(u.length))):V!==u.length&&(ce(u.length),f(F=>Lr(F,u.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Jn},e[3]=oe):oe=e[3];const Ce=Hn(It(Wn,te),It(Un,oe));let E;e[4]!==$?(E=$.map(Yr),e[4]=$,e[5]=E):E=e[5];const ue=E;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=F=>{se(String(F.active.id))},e[6]=ie):ie=e[6];const je=ie;let M;e[7]!==ue||e[8]!==v?(M=F=>{se(null);const{active:ae,over:Q}=F;if(!Q||ae.id===Q.id)return;const Ie=ue.indexOf(String(ae.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(f(Qe=>da(Rt([...Qe],Ie,he))),B.current=!0,requestAnimationFrame(()=>{B.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=M):M=e[9];const Ae=M;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{se(null)},e[10]=X):X=e[10];const Ne=X;let ve,re,G,q,ne,le,ke,Se,de,be,K,Z,we,Ee,$e;if(e[11]!==P||e[12]!==J||e[13]!==$||e[14]!==ue||e[15]!==Ae||e[16]!==h||e[17]!==D||e[18]!==w||e[19]!==g||e[20]!==o||e[21]!==y||e[22]!==N||e[23]!==m||e[24]!==k||e[25]!==_||e[26]!==l||e[27]!==u||e[28]!==S||e[29]!==Ce){Ee=Symbol.for("react.early_return_sentinel");e:{const F=ae=>{B.current||m(ae)};if(e[45]!==P||e[46]!==J||e[47]!==$||e[48]!==D||e[49]!==l||e[50]!==u){const ae=P?$.find(Q=>Q.id===P):null;if(q=ae!=null?u[ae.index]:null,G=ae!=null?l[ae.index]:void 0,$.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!J;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(cn,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==D||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:D,children:[he,"Add section"]})]}),e[56]=D,e[57]=Ie,e[58]=Qe):Qe=e[58],Ee=Qe;break e}we=Be(ae&&"cursor-grabbing"),e[45]=P,e[46]=J,e[47]=$,e[48]=D,e[49]=l,e[50]=u,e[51]=G,e[52]=q,e[53]=we}else G=e[51],q=e[52],we=e[53];re=Qn,Se=Ce,de=Xn,be=je,K=Ae,Z=Ne,ve=Zn,le=ue,ke=ea,$e="space-y-1",ne=$.map(ae=>{const Q=u[ae.index];return Q?n.jsx(Ir,{sortableId:ae.id,section:Q,raw:l[ae.index],meta:h,selected:S===ae.index,onSelect:()=>F(ae.index),onDelete:()=>g(ae.index),onDuplicate:()=>y(ae.index),onMakeReusable:()=>N(ae.index),onToggleHidden:()=>k(ae.index),onToggleLazy:()=>_(ae.index),onAddVariant:()=>w(ae.index),onDetach:()=>o(ae.index)},ae.id):null})}e[11]=P,e[12]=J,e[13]=$,e[14]=ue,e[15]=Ae,e[16]=h,e[17]=D,e[18]=w,e[19]=g,e[20]=o,e[21]=y,e[22]=N,e[23]=m,e[24]=k,e[25]=_,e[26]=l,e[27]=u,e[28]=S,e[29]=Ce,e[30]=ve,e[31]=re,e[32]=G,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=be,e[40]=K,e[41]=Z,e[42]=we,e[43]=Ee,e[44]=$e}else ve=e[30],re=e[31],G=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],be=e[39],K=e[40],Z=e[41],we=e[42],Ee=e[43],$e=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Fe;e[59]!==ne||e[60]!==$e?(Fe=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Fe):Fe=e[61];let Pe;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Fe?(Pe=n.jsx(ve,{items:le,strategy:ke,children:Fe}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Fe,e[66]=Pe):Pe=e[66];let Ke;e[67]!==G||e[68]!==q||e[69]!==h?(Ke=q?n.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",fa(q,!1)),children:n.jsx(ma,{section:q,raw:G,meta:h})}):null,e[67]=G,e[68]=q,e[69]=h,e[70]=Ke):Ke=e[70];let Le;e[71]!==Ke?(Le=n.jsx(ta,{dropAnimation:null,children:Ke}),e[71]=Ke,e[72]=Le):Le=e[72];let Me;e[73]!==re||e[74]!==Se||e[75]!==de||e[76]!==be||e[77]!==K||e[78]!==Z||e[79]!==Pe||e[80]!==Le?(Me=n.jsxs(re,{sensors:Se,collisionDetection:de,onDragStart:be,onDragEnd:K,onDragCancel:Z,children:[Pe,Le]}),e[73]=re,e[74]=Se,e[75]=de,e[76]=be,e[77]=K,e[78]=Z,e[79]=Pe,e[80]=Le,e[81]=Me):Me=e[81];const xe=!J;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==D||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:D,children:[Re,"Add section"]}),e[83]=D,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function Yr(d){return d.id}function Kn(d){const e=He.c(38),{open:r,initialName:l,autoLabel:u,isPending:h,onSubmit:S,onOpenChange:m}=d,v=h===void 0?!1:h,[g,y]=R.useState(l),[N,k]=R.useState(r);r!==N&&(k(r),r&&y(l));let _;e[0]!==v||e[1]!==m?(_=oe=>{!oe&&!v&&m(!1)},e[0]=v,e[1]=m,e[2]=_):_=e[2];const w=_;let o;e[3]!==v||e[4]!==g||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(g.trim())},e[3]=v,e[4]=g,e[5]=S,e[6]=o):o=e[6];const D=o;let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(pr,{children:"Rename variant"}),e[7]=c):c=e[7];const J=u||"the rule";let H;e[8]!==J?(H=n.jsxs(hr,{children:[c,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:J}),"."]})]}),e[8]=J,e[9]=H):H=e[9];let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=$):$=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=oe=>y(oe.target.value),e[11]=f):f=e[11];let P;e[12]!==u||e[13]!==v||e[14]!==g?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[$,n.jsx(yr,{id:"variant-rename-name",value:g,onChange:f,placeholder:u,autoFocus:!0,disabled:v})]}),e[12]=u,e[13]=v,e[14]=g,e[15]=P):P=e[15];let se;e[16]!==m?(se=()=>m(!1),e[16]=m,e[17]=se):se=e[17];let T;e[18]!==v||e[19]!==se?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:se,disabled:v,children:"Cancel"}),e[18]=v,e[19]=se,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(zn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let V;e[23]!==v||e[24]!==pe?(V=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=V):V=e[25];let ce;e[26]!==T||e[27]!==V?(ce=n.jsxs(vr,{children:[T,V]}),e[26]=T,e[27]=V,e[28]=ce):ce=e[28];let B;e[29]!==D||e[30]!==ce||e[31]!==H||e[32]!==P?(B=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:D,children:[H,P,ce]})}),e[29]=D,e[30]=ce,e[31]=H,e[32]=P,e[33]=B):B=e[33];let te;return e[34]!==w||e[35]!==r||e[36]!==B?(te=n.jsx(xr,{open:r,onOpenChange:w,children:B}),e[34]=w,e[35]=r,e[36]=B,e[37]=te):te=e[37],te}const Jr="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",pa="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]";function ha(d){const e=He.c(5),{rule:r,matchers:l}=d,u=r?.__resolveType??"";let h;if(e[0]!==l||e[1]!==u){const g=l.find(y=>y.resolveType===u)?.iconName??Ds(u);h=ur(g),e[0]=l,e[1]=u,e[2]=h}else h=e[2];const S=h;if(!S)return null;let m;return e[3]!==S?(m=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=m):m=e[4],m}function On(d){return d.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function on(d){return d.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(d){return d.map((e,r)=>({...e,index:r}))}function ga(d){const e=He.c(16),{label:r,effectiveRule:l,matchers:u,canDelete:h,dragging:S,onRename:m,onDuplicate:v,onDelete:g}=d;let y;e[0]!==l||e[1]!==u?(y=n.jsx(ha,{rule:l,matchers:u}),e[0]=l,e[1]=u,e[2]=y):y=e[2];let N;e[3]!==r?(N=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=N):N=e[4];let k;e[5]!==h||e[6]!==S||e[7]!==r||e[8]!==g||e[9]!==v||e[10]!==m?(k=!S&&n.jsxs(ca,{children:[n.jsx(la,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":`Actions for ${r}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Zr,onPointerDown:Xr,children:n.jsx(ra,{size:14})})}),n.jsxs(ua,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:w=>{w.stopPropagation(),m?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:w=>{w.stopPropagation(),v?.()},children:[n.jsx(oa,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!h,onClick:w=>{w.stopPropagation(),g?.()},children:[n.jsx(ia,{size:14}),"Delete"]})]})]}),e[5]=h,e[6]=S,e[7]=r,e[8]=g,e[9]=v,e[10]=m,e[11]=k):k=e[11];let _;return e[12]!==y||e[13]!==N||e[14]!==k?(_=n.jsxs(n.Fragment,{children:[y,N,k]}),e[12]=y,e[13]=N,e[14]=k,e[15]=_):_=e[15],_}function Xr(d){return d.stopPropagation()}function Zr(d){return d.stopPropagation()}function eo(d){const e=He.c(33),{entry:r,sortableId:l,isActive:u,canDelete:h,decofile:S,meta:m,matchers:v,onSelect:g,onRename:y,onDuplicate:N,onDelete:k}=d;let _;e[0]!==l?(_={id:l,animateLayoutChanges:to},e[0]=l,e[1]=_):_=e[1];const{attributes:w,listeners:o,setNodeRef:D,transform:c,isDragging:J}=qn(_);let H;e[2]!==c?(H=Yn.Transform.toString(c?{...c,x:0}:null),e[2]=c,e[3]=H):H=e[3];const $=J?0:void 0;let f;e[4]!==H||e[5]!==$?(f={transform:H,opacity:$},e[4]=H,e[5]=$,e[6]=f):f=e[6];const P=f,se=m??void 0;let T;e[7]!==S||e[8]!==r.variant.rule||e[9]!==se?(T=Dt(r.variant.rule,S,se),e[7]=S,e[8]=r.variant.rule,e[9]=se,e[10]=T):T=e[10];const pe=T;let V;e[11]!==g?(V=E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),g())},e[11]=g,e[12]=V):V=e[12];const ce=J?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",B=u?pa:Jr;let te;e[13]!==ce||e[14]!==B?(te=Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,B),e[13]=ce,e[14]=B,e[15]=te):te=e[15];let oe;e[16]!==h||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==k||e[21]!==N||e[22]!==y?(oe=n.jsx(ga,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:h,onRename:y,onDuplicate:N,onDelete:k}),e[16]=h,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=k,e[21]=N,e[22]=y,e[23]=oe):oe=e[23];let Ce;return e[24]!==w||e[25]!==o||e[26]!==g||e[27]!==D||e[28]!==P||e[29]!==te||e[30]!==oe||e[31]!==V?(Ce=n.jsx("div",{ref:D,style:P,...w,...o,onClick:g,onKeyDown:V,className:te,children:oe}),e[24]=w,e[25]=o,e[26]=g,e[27]=D,e[28]=P,e[29]=te,e[30]=oe,e[31]=V,e[32]=Ce):Ce=e[32],Ce}function to(){return!1}function no(d){const e=He.c(9),{variant:r,decofile:l,meta:u,matchers:h}=d,S=u??void 0;let m;e[0]!==l||e[1]!==S||e[2]!==r.rule?(m=Dt(r.rule,l,S),e[0]=l,e[1]=S,e[2]=r.rule,e[3]=m):m=e[3];const v=m;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=Be("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",pa),e[4]=g):g=e[4];let y;return e[5]!==v||e[6]!==h||e[7]!==r.label?(y=n.jsx("div",{className:g,children:n.jsx(ga,{label:r.label,effectiveRule:v,matchers:h,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=h,e[7]=r.label,e[8]=y):y=e[8],y}function ao(d){const e=He.c(77),{listKey:r,variants:l,activeIndex:u,decofile:h,meta:S,matchers:m,onSelect:v,onReorder:g,onRename:y,onDuplicate:N,onDelete:k,onAdd:_}=d;let w;e[0]!==l?(w=()=>on(l),e[0]=l,e[1]=w):w=e[1];const[o,D]=R.useState(w),[c,J]=R.useState(null),[H,$]=R.useState(r),[f,P]=R.useState(l.length);let se;e[2]!==l?(se=()=>On(l),e[2]=l,e[3]=se):se=e[3];const[T,pe]=R.useState(se),V=R.useRef(!1),ce=On(l);H!==r?($(r),P(l.length),pe(ce),D(on(l))):f!==l.length?(P(l.length),pe(ce),D(on(l))):T!==ce&&(pe(ce),D(Me=>l.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let B;e[4]===Symbol.for("react.memo_cache_sentinel")?(B={activationConstraint:{distance:8}},e[4]=B):B=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:Jn},e[5]=te):te=e[5];const oe=Hn(It(Wn,B),It(Un,te));let Ce;e[6]!==o?(Ce=o.map(so),e[6]=o,e[7]=Ce):Ce=e[7];const E=Ce,ue=l.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);J(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let M;e[10]!==E||e[11]!==g?(M=Me=>{J(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=E.indexOf(String(xe.id)),ee=E.indexOf(String(Re.id));me===-1||ee===-1||(D(F=>Qr(Rt([...F],me,ee))),V.current=!0,requestAnimationFrame(()=>{V.current=!1}),g(me,ee))},e[10]=E,e[11]=g,e[12]=M):M=e[12];const Ae=M;let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[13]=X):X=e[13];const Ne=X;let ve,re,G,q,ne,le,ke,Se,de,be,K,Z,we;if(e[14]!==u||e[15]!==ue||e[16]!==h||e[17]!==o||e[18]!==E||e[19]!==Ae||e[20]!==je||e[21]!==m||e[22]!==S||e[23]!==_||e[24]!==k||e[25]!==N||e[26]!==y||e[27]!==v||e[28]!==oe){const Me=F=>{V.current||v(F)};K="space-y-1 border-b p-2";let xe;e[42]===Symbol.for("react.memo_cache_sentinel")?(xe=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[42]=xe):xe=e[42];let Re;e[43]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(cn,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:_,children:Re})}),e[44]=_,e[45]=me):me=e[45];let ee;e[46]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(ht,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(Z=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(ft,{children:[me,ee]})]}),e[47]=me,e[48]=Z):Z=e[48],re=Qn,le=oe,ke=Xn,Se=je,de=Ae,be=Ne,ve=Zn,q=E,ne=ea,we="space-y-0.5",G=o.map(F=>n.jsx(eo,{sortableId:F.id,entry:F,isActive:F.index===u,canDelete:ue,decofile:h,meta:S,matchers:m,onSelect:()=>Me(F.index),onRename:()=>y(F.index),onDuplicate:()=>N(F.index),onDelete:()=>k(F.index)},F.id)),e[14]=u,e[15]=ue,e[16]=h,e[17]=o,e[18]=E,e[19]=Ae,e[20]=je,e[21]=m,e[22]=S,e[23]=_,e[24]=k,e[25]=N,e[26]=y,e[27]=v,e[28]=oe,e[29]=ve,e[30]=re,e[31]=G,e[32]=q,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=be,e[39]=K,e[40]=Z,e[41]=we}else ve=e[29],re=e[30],G=e[31],q=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],be=e[38],K=e[39],Z=e[40],we=e[41];let Ee;e[49]!==G||e[50]!==we?(Ee=n.jsx("div",{className:we,children:G}),e[49]=G,e[50]=we,e[51]=Ee):Ee=e[51];let $e;e[52]!==ve||e[53]!==q||e[54]!==ne||e[55]!==Ee?($e=n.jsx(ve,{items:q,strategy:ne,children:Ee}),e[52]=ve,e[53]=q,e[54]=ne,e[55]=Ee,e[56]=$e):$e=e[56];let Fe;e[57]!==c||e[58]!==h||e[59]!==m||e[60]!==S?(Fe=c?n.jsx(no,{variant:c.variant,decofile:h,meta:S,matchers:m}):null,e[57]=c,e[58]=h,e[59]=m,e[60]=S,e[61]=Fe):Fe=e[61];let Pe;e[62]!==Fe?(Pe=n.jsx(ta,{dropAnimation:null,children:Fe}),e[62]=Fe,e[63]=Pe):Pe=e[63];let Ke;e[64]!==re||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==be||e[70]!==$e||e[71]!==Pe?(Ke=n.jsxs(re,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:be,children:[$e,Pe]}),e[64]=re,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=be,e[70]=$e,e[71]=Pe,e[72]=Ke):Ke=e[72];let Le;return e[73]!==K||e[74]!==Z||e[75]!==Ke?(Le=n.jsxs("div",{className:K,children:[Z,Ke]}),e[73]=K,e[74]=Z,e[75]=Ke,e[76]=Le):Le=e[76],Le}function so(d){return d.id}function va({pageKey:d,prefix:e,variants:r,selectedIndex:l,decofile:u,meta:h}){if(!d||l<0||l>=r.length)return[];const S=[];for(let m=0;m<=l;m++){const v=r[m];if(!v)continue;const g=v.rule,y=m===l?"1":"0",k=(mt(g,u,h)?bt(g,u,h):null)??`${d}@${e}.${m}.rule`;S.push(`${k}=${y}`)}return S}function Bn(d,e,r,l){return!e.multivariate||e.variants.length<=1?[]:va({pageKey:d,prefix:"sections.variants",variants:e.variants,selectedIndex:e.index,decofile:r,meta:l})}function ro({pageKey:d,page:e,sectionIndex:r,sectionLazy:l,mvObj:u,selectedVariantIndex:h,decofile:S,meta:m}){if(r<0)return[];const g=`${e.multivariate?`sections.variants.${e.index}.value`:"sections"}.${r}${l?".section":""}.variants`,y=Array.isArray(u.variants)?u.variants:[];return va({pageKey:d,prefix:g,variants:y,selectedIndex:h,decofile:S,meta:m})}function Fn(d){const e=He.c(15),{schema:r,value:l,onChange:u,meta:h,decofile:S,onSaveReferencedBlock:m,sandbox:v}=d;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[y,N]=R.useState(g);let k;e[1]!==y?(k=y.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>N([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:"Back to rule",children:n.jsx(lr,{className:"size-3.5"})}),y.map((o,D)=>{const c=D===y.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[D>0&&n.jsx(sa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>N(y.slice(0,D+1)),title:o,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",c?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${D}`)})]}),e[1]=y,e[2]=k):k=e[2];let _;e[3]!==y||e[4]!==S||e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==v||e[9]!==r||e[10]!==l?(_=n.jsx(na,{schema:r,value:l,onChange:u,basePath:"",breadcrumbPath:y,onBreadcrumbChange:N,meta:h,decofile:S,onSaveReferencedBlock:m,sandbox:v}),e[3]=y,e[4]=S,e[5]=h,e[6]=u,e[7]=m,e[8]=v,e[9]=r,e[10]=l,e[11]=_):_=e[11];let w;return e[12]!==k||e[13]!==_?(w=n.jsxs("div",{className:"space-y-2",children:[k,_]}),e[12]=k,e[13]=_,e[14]=w):w=e[14],w}function Ln(d){const e=He.c(21),{activeSchema:r,formValue:l,formResetKey:u,onFormChange:h,onBreadcrumbChange:S,breadcrumbPath:m,emptyMessage:v,beforeForm:g,seoResolveType:y,siteDefaultSeo:N,meta:k,decofile:_,onSaveReferencedBlock:w,sandbox:o}=d;let D;e[0]!==m?(D=m===void 0?[]:m,e[0]=m,e[1]=D):D=e[1];const c=D;let J;e[2]!==r||e[3]!==c||e[4]!==_||e[5]!==u||e[6]!==l||e[7]!==k||e[8]!==S||e[9]!==h||e[10]!==w||e[11]!==o||e[12]!==y||e[13]!==N?(J=r&&l?y?n.jsx(Ar,{schema:r,resolveType:y,value:l,formResetKey:u,onChange:h,onBreadcrumbChange:S,siteDefaultSeo:N}):n.jsx(na,{schema:r,value:l,onChange:h,basePath:"",breadcrumbPath:c,onBreadcrumbChange:S,meta:k,decofile:_,onSaveReferencedBlock:w,sandbox:o},u):null,e[2]=r,e[3]=c,e[4]=_,e[5]=u,e[6]=l,e[7]=k,e[8]=S,e[9]=h,e[10]=w,e[11]=o,e[12]=y,e[13]=N,e[14]=J):J=e[14];const H=J;let $;e[15]!==v||e[16]!==H?($=H??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=H,e[17]=$):$=e[17];let f;return e[18]!==g||e[19]!==$?(f=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[g,$]})}),e[18]=g,e[19]=$,e[20]=f):f=e[20],f}const oo="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function io(d,e){return zs(d,e,et)}function lo(d){const e=He.c(13),{pageKey:r,initialName:l,initialPath:u,onFieldChange:h}=d,[S,m]=R.useState(l),[v,g]=R.useState(u),[y,N]=R.useState(r);y!==r&&(N(r),m(l),g(u));let k;e[0]!==h?(k=c=>{m(c.target.value),h("name",c.target.value)},e[0]=h,e[1]=k):k=e[1];let _;e[2]!==S||e[3]!==k?(_=n.jsx("input",{type:"text",value:S,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=S,e[3]=k,e[4]=_):_=e[4];let w;e[5]!==h?(w=c=>{g(c.target.value),h("path",c.target.value)},e[5]=h,e[6]=w):w=e[6];let o;e[7]!==v||e[8]!==w?(o=n.jsx("input",{type:"text",value:v,onChange:w,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"/path"}),e[7]=v,e[8]=w,e[9]=o):o=e[9];let D;return e[10]!==_||e[11]!==o?(D=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=D):D=e[12],D}function In(d){const e=He.c(6),{onClick:r}=d;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(aa,{size:14}),e[0]=l):l=e[0];let u;e[1]!==r?(u=n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:l})}),e[1]=r,e[2]=u):u=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ht,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let S;return e[4]!==u?(S=n.jsxs(ft,{children:[u,h]}),e[4]=u,e[5]=S):S=e[5],S}function Ql({orgSlug:d,virtualMcpId:e,branch:r,previewReady:l=!0,previewUrl:u,currentPath:h,activePageBlockKey:S=null,activeGlobalBlockKey:m=null,externalSelectedIndex:v,onSaved:g,initialEditSeo:y=!1,onExitSeo:N,onViewJsonFile:k,onVariantPreviewOverride:_}){const w=l?{orgSlug:d,virtualMcpId:e,branch:r,previewUrl:u}:null,{data:o,isLoading:D}=Ns(w),{data:c,isLoading:J}=Vs(w),H=Cs(),$=H?.entity?.id===e?H.entity.metadata?.siteSlug??null:null,[f,P]=R.useState(null),[se,T]=R.useState(null),[pe,V]=R.useState(null),[ce,B]=R.useState(0),[te,oe]=R.useState(void 0),[Ce,E]=R.useState(null),[ue,ie]=R.useState(null),[je,M]=R.useState([]),[Ae,X]=R.useState(0),[Ne,ve]=R.useState(null),[re,G]=R.useState(null),[q,ne]=R.useState(null),[le,ke]=R.useState(!0),[Se,de]=R.useState(!1),[be,K]=R.useState(!1),[Z,we]=R.useState(y),[Ee,$e]=R.useState(y);y&&!Ee&&($e(!0),we(!0),P(null),T(null),V(null),M([])),!y&&Ee&&$e(!1);const[Fe,Pe]=R.useState(null),[Ke,Le]=R.useState(void 0),[Me,xe]=R.useState([]),[Re,me]=R.useState(0),[ee,F]=R.useState(0),[ae,Q]=R.useState(null),[Ie,he]=R.useState(null),[Qe,un]=R.useState(null),Sa=Ss(),xa=`${d}/${e}/${r}`,zt=Ps({orgSlug:d,virtualMcpId:e,branch:r}),[ya,ba]=R.useState(h),[_a,ja]=R.useState(S),[ka,wa]=R.useState(m);(ya!==h||_a!==S||ka!==m)&&(queueMicrotask(()=>zt.flush()),ba(h),ja(S),wa(m),P(null),T(null),V(null),B(0),E(null),ie(null),F(0),Q(null),he(null),M([]),X(t=>t+1),we(!1),Pe(null),Le(void 0),xe([]),me(t=>t+1));const ye=Ts({orgSlug:d,virtualMcpId:e,branch:r}),Nt=Xs((t,a)=>{ye.mutate({blockKey:t,data:a},{onSuccess:()=>g?.(),onError:s=>W.error(`Save failed: ${s.message}`)})}),Ht=As({orgSlug:d,virtualMcpId:e,branch:r}),[_t,Vt]=R.useState(!1),Ut=R.useRef(null),gt=R.useRef(null),vt=R.useRef(null),Wt=R.useRef({}),qe=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!l||D||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(zn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!c)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const Ra=Ms(o),_e=!!m,ze=_e?null:Es(Ra,h,S),j=_e?m:ze?.key??null,Gt=_e&&m?o[m]:void 0,dn=_e&&m&&Gt?$s(m,Gt):_e&&m?m:"",Ct=!_e&&j&&o[j]?o[j]:null,qt=Z&&o&&c&&j&&ze?En(o,{kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},c):null,Da=Z?Ct?.seo:void 0,Yt=Ke!==void 0?Ke:Da,Na=Z?Rr(Yt):void 0,Va=qt?.seoTypeOptions??[],Ca=Z&&c?Dr(c):"",mn=Fe??Na??{},Jt=Z&&qt?Nr(mn,qt):null,Pa=Z&&Jt&&Vr(Yt)?Kt(Jt,c):null,Ta=Z?Cr(o,c)?.seoData:void 0,Oe=_e?[{label:"Default",sections:[{__resolveType:m}]}]:io(Ct?.sections,o??{}),Pt=Oe.length>1,Ve=Math.min(ce,Oe.length-1),tt=Oe[Ve],I=tt?.sections??[],Te=Ot(I,o),fn=!_e&&Ks(Ct?.sections);if(_e&&m&&Qe!==m){un(m);const t=I[0],a=Te[0];if(t&&a){P(0),F(0),M([]);const s=ut(t,a,o);s&&(T(s.data),V(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&un(null),qe.current={rawSections:I,parsedSections:Te,decofile:o??{},activePageKey:j,pageVariants:Oe,variantIndex:Ve,sectionVariantIndex:ee,selectedSectionIndex:f};const Aa=()=>({multivariate:fn,index:Ve,variants:Oe.map(t=>({rule:t.rule}))}),pn=(t,a)=>{if(!_)return;if(!j||!fn||t.length<=1){_(null);return}const s=Bn(j,{multivariate:!0,index:a,variants:t},o,c);_(s.length>0?s:null)},St=(t,a,s)=>{if(!_)return;if(!j){_(null);return}const i=Aa(),p=Bn(j,i,o,c);if(!t||a<0){_(p.length>0?p:null);return}const b=ro({pageKey:j,page:i,sectionIndex:a,sectionLazy:Te[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:c}),x=[...p,...b];_(x.length>0?x:null)},nt=(t,a,s,i=f??-1,p=!1)=>{const b=Je(t,a);if(!b){T(null),V(null),he(null),Q(null),p&&St(null,i,s);return}const C=Vn(b,et)[s];if(!C){T(null),V(null),he(null),Q(null),p&&St(null,i,s);return}const Y=Hs(C.value,o);T(Y?.data??null),V(Y?.resolveType??null);const{resolveType:A,formValue:O}=kt(C.rule,o,c??void 0);he(A),Q(O),p&&St(b,i,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=I[v],a=Te[v];if(t&&a)if(P(v),F(0),M([]),X(s=>s+1),a.isMultivariate)nt(t,a,0,v);else{const s=ut(t,a,o);s?(T(s.data),V(s.resolveType)):(T(null),V(null)),he(null),Q(null)}}const Tt={orgSlug:d,virtualMcpId:e,branch:r,previewUrl:u??void 0,siteSlug:$},Qt=pe&&c?Kt(pe,c):null,Ue=(t,a)=>{if(!j)return;const s=wt(o,j,t,Ve,Oe);ye.mutate({blockKey:j,data:s},{onSuccess:()=>a?.onSuccess?.()??g?.(),onError:i=>W.error(`Save failed: ${i.message}`)})},xt=()=>{P(null),T(null),V(null),F(0),Q(null),he(null),M([]),X(t=>t+1)},Ma=(t,a)=>{Ut.current&&clearTimeout(Ut.current);const s=qe.current.sectionVariantIndex;Ut.current=setTimeout(()=>{const{rawSections:i,parsedSections:p,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current,A=i[a];if(!A)return;const O=p[a];if(!O)return;if(O.isSavedBlock){const z=O.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;ye.mutate({blockKey:z,data:t},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}if(!x)return;const L={...b[x]},ge=[...i];if(O.isMultivariate){const z=Je(A,O);if(!z||!x)return;const U=sr(z,s,t);ge[a]=dt(A,O,U)}else if(O.isHidden){const z=Gn(A.__resolveType),U=z?{...A.section}:{...A},De=Array.isArray(U.variants)?[...U.variants]:[];De[0]&&(De[0]={...De[0],value:t}),U.variants=De,z?ge[a]={...A,section:U}:ge[a]=U}else O.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(C.length>1){const z=L.sections,U=[...z?.variants??[]];U[Y]&&(U[Y]={...U[Y],value:ge}),L.sections={...z,variants:U}}else L.sections=ge;ye.mutate({blockKey:x,data:L},{onSuccess:()=>g?.(),onError:z=>W.error(`Save failed: ${z.message}`)})},rn)},Ea=t=>{P(t),F(0),M([]),X(p=>p+1);const a=I[t],s=Te[t];if(!a||!s)return;if(s.isMultivariate){nt(a,s,0,t);return}const i=ut(a,s,o);if(!i){T(null),V(null),he(null),Q(null),St(null,t,0);return}T(i.data),V(i.resolveType),he(null),Q(null),St(null,t,0)},hn=t=>{const a=t;T(a),f!==null&&Ma(a,f)},Xt=t=>{if(!j||!o||!c||!ze)return;const a={kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},s=En(o,a,c);s&&zt.save(j,()=>{const i=Sa.getQueryData(xs.decofile(xa))?.[j];if(!i||typeof i!="object"||i===null||Array.isArray(i))return null;const p={...i,...Wt.current};return Wt.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Tr(a,s,p,t.inner):p})},$a=(t,a)=>{j&&(Wt.current[t]=a,Xt())},Ka=(t,a)=>{if(!j)return;const s=Rt([...I],t,a);f!==null&&(f===t?P(a):t<f&&a>=f?P(f-1):t>f&&a<=f&&P(f+1)),Ue(s)},Oa=t=>{if(!j)return;const a=I.filter((s,i)=>i!==t);f===t?xt():f!==null&&f>t&&P(f-1),Ue(a)},Ba=t=>{if(!j)return;const a=I[t];if(!a)return;const s=[...I];s.splice(t+1,0,nr(a)),f!==null&&f>t&&P(f+1),Ue(s)},Fa=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=s.isHidden?er(a):tr(a);if(!i)return;const p=[...I];p[t]=i,f===t&&xt(),Ue(p)},La=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s||s.isMultivariate)return;const i=Zs(a);if(!i)return;const p=[...I];p[t]=i,f===t&&xt(),Ue(p)},Ia=t=>{if(!j)return;const a=I[t],s=Te[t];if(!a||!s?.isSavedBlock)return;const i=ut(a,s,o);if(!i?.data)return;const{name:p,...b}=i.data,x=[...I];s.isLazy?x[t]={...a,section:b}:x[t]=b,f===t&&xt(),Ue(x)},za=t=>{if(!j)return;const a=[...I,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),P(s),F(0),M([]),X(x=>x+1);const i=a[s],p=Ot(a,o)[s];if(!i||!p)return;if(p.isMultivariate){nt(i,p,0);return}const b=ut(i,p,o);if(!b){T(null),V(null),he(null),Q(null);return}T(b.data),V(b.resolveType),he(null),Q(null)}})},Ha=t=>{if(f===null)return;const a=I[f],s=Te[f];!a||!s?.isMultivariate||(F(t),M([]),X(i=>i+1),nt(a,s,t,f,!0))},Ua=t=>{if(f===null||!j)return;const a=I[f],s=Te[f];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const p=Js(i,t);if(!p){W.error("Cannot delete the only variant.");return}const b=[...I];b[f]=dt(a,s,p);const x=p.variants;let C=ee;t===ee?C=Math.min(t,x.length-1):t<ee&&(C=ee-1),F(C),M([]),X(Y=>Y+1),nt(b[f],s,C),Ue(b)},Wa=t=>{if(f===null||!j)return;const a=I[f],s=Te[f];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const p=Qs(i,t),b=[...I];b[f]=dt(a,s,p);const x=t+1;F(x),M([]),X(C=>C+1),nt(b[f],s,x),Ue(b)},Ga=(t,a)=>{if(f===null||!j||t===a)return;const s=I[f],i=Te[f];if(!s||!i?.isMultivariate)return;const p=Je(s,i);if(!p)return;const b=qs(p,t,a),x=[...I];x[f]=dt(s,i,b);let C=ee;ee===t?C=a:t<ee&&a>=ee?C=ee-1:t>ee&&a<=ee&&(C=ee+1),F(C),nt(x[f],i,C),Ue(x)},Zt=t=>{const a=t??f;if(a===null||!j)return;const s=I[a],i=Te[a];if(!s||!i)return;const p=Us(s,i);if(!p){W.error("This section cannot have variants.");return}const b=[...I];b[a]=p.section;const x=Ot(b,o)[a];if(!x?.isMultivariate){W.error("Could not add variant.");return}P(a),F(p.newVariantIndex),M([]),X(C=>C+1),nt(p.section,x,p.newVariantIndex,a),Ue(b)},qa=()=>{if(f===null||!j)return;const t=I[f],a=Te[f];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const i=Ys(t,a,s);if(!i){W.error("Could not remove variants.");return}const p=[...I];p[f]=i;const b=Ot(p,o)[f];if(!b)return;F(0),he(null),Q(null),M([]),X(C=>C+1);const x=ut(i,b,o);x?(T(x.data),V(x.resolveType)):(T(null),V(null)),St(null,f,0),Ue(p)},Ya=async t=>{if(Ne===null||!j)return;const a=sn(t,o);if(a){W.error(a);return}const s=I[Ne],i=Te[Ne];if(!s||!i)return;const p=ut(s,i,o);if(!p){W.error("This section cannot be saved as global.");return}const b={...p.data,name:t};try{await ye.mutateAsync({blockKey:t,data:b});const x=[...I];x[Ne]={__resolveType:t},await ye.mutateAsync({blockKey:j,data:wt(o,j,x,Ve,Oe)}),f===Ne&&xt(),ve(null),W.success(`Saved global block "${t}"`),g?.()}catch(x){W.error(x instanceof Error?x.message:"Failed to save global block")}},gn=tt?.rule;if(Pt&&f===null&&ue===null&&gn){const{resolveType:t,formValue:a}=kt(gn,o??{},c??void 0);ie(t),E(a)}const At=c?Os(c):[],vn=c&&o?Bs(c,o):[],Ja=!_e&&!!(u&&c&&o),Sn=ue&&c?Kt(ue,c):null,Mt=()=>{gt.current&&(clearTimeout(gt.current),gt.current=null),vt.current&&(clearTimeout(vt.current),vt.current=null)},jt=async(t,a)=>{if(!(ar(a,t,c)>0))try{await Ht.mutateAsync({blockKey:t})}catch(s){W.error(s instanceof Error?s.message:"Could not delete matcher block")}},xn=t=>{gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:i}=qe.current;if(!a)return;const p={...s[a]},b={...p.sections},x=[...b.variants??[]],C=x[i],Y=C?.rule;if(mt(Y,s,c)){const A=Y?.__resolveType??"",O=s[A],L=typeof O?.name=="string"?O.name:A,{__resolveType:ge,...z}=t;ye.mutate({blockKey:A,data:yt(ge??"",z,L)},{onSuccess:()=>g?.(),onError:U=>W.error(`Save failed: ${U.message}`)});return}C&&(x[i]={...C,rule:t}),p.sections={...b,variants:x},ye.mutate({blockKey:a,data:p},{onSuccess:()=>g?.(),onError:A=>W.error(`Save failed: ${A.message}`)})},rn)},Qa=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:Mn};E({}),xn(a)},Xa=t=>{const a=t;E(a);const s=ue?{__resolveType:ue,...a}:{...a};xn(s)},Za=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:i}=qe.current;if(!a)return;const p=s[a],b=p?.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const x=b;if(!Array.isArray(x.variants))return;const C=[...x.variants],Y=C[i];if(!Y)return;const A=bt(Y.rule,s,c),O=Ft(t);C[i]={...Y,rule:O};const L={...s,[a]:{...p,sections:{...x,variants:C}}},{resolveType:ge,formValue:z}=kt(O,L,c??void 0);ie(ge),E(z);try{await ye.mutateAsync({blockKey:a,data:L[a]}),A&&A!==t&&await jt(A,L),g?.()}catch(U){W.error(U instanceof Error?U.message:"Could not apply saved rule")}},yn=t=>{vt.current&&clearTimeout(vt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=qe.current;a!==null&&(vt.current=setTimeout(()=>{const{rawSections:i,parsedSections:p,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(!x)return;const A=i[a],O=p[a];if(!A||!O?.isMultivariate)return;const L=Je(A,O);if(!L)return;const z=(L.variants??[])[s]?.rule;if(mt(z,b,c)){const fe=z?.__resolveType??"",We=b[fe],Xe=typeof We?.name=="string"?We.name:fe,{__resolveType:rt,...Ze}=t;ye.mutate({blockKey:fe,data:yt(rt??"",Ze,Xe)},{onSuccess:()=>g?.(),onError:ot=>W.error(`Save failed: ${ot.message}`)});return}const U=Pn(L,s,t),De=[...i];De[a]=dt(A,O,U);const Ye=wt(b,x,De,Y,C);ye.mutate({blockKey:x,data:Ye},{onSuccess:()=>g?.(),onError:fe=>W.error(`Save failed: ${fe.message}`)})},rn))},es=t=>{he(t),Q({}),yn(t?{__resolveType:t}:{__resolveType:Mn})},ts=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};yn(s)},ns=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:i,parsedSections:p,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(a===null||!x)return;const A=i[a],O=p[a];if(!A||!O?.isMultivariate)return;const L=Je(A,O);if(!L)return;const ge=L.variants??[],z=bt(ge[s]?.rule,b,c),U=Ft(t),De=Pn(L,s,U),Ye=[...i];Ye[a]=dt(A,O,De);const fe=wt(b,x,Ye,Y,C),We={...b,[x]:fe},{resolveType:Xe,formValue:rt}=kt(U,We,c??void 0);he(Xe),Q(rt);try{await ye.mutateAsync({blockKey:x,data:fe}),z&&z!==t&&await jt(z,We),g?.()}catch(Ze){W.error(Ze instanceof Error?Ze.message:"Could not apply saved rule")}};if(!_e&&!ze)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(_e&&!Gt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const at=f!==null?Te[f]??null:null,bn=f!==null?I[f]:null,_n=bn&&at?.isMultivariate?Je(bn,at):null,lt=_n?Vn(_n,et):[],en=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[en]??null,ct=at?.isMultivariate===!0,jn=f!==null&&at!==null,$t=jn&&(ct||!!(Qt&&se)),as=$t&&!_e&&at?.isSavedBlock===!0,st=_e||as,ss=_e?dn:at?.label??"",kn=Ie&&c?Kt(Ie,c):null,tn=$t&&(!_e||je.length>0)?_e?[dn,...je]:[ze.name,at.label,...ct&&Et?[Et.label]:[],...je]:[],rs=Z&&ze?[ze.name,"SEO",...Me]:[],wn=Z?rs:st?tn.length>0?tn:[ss]:tn,Rn=()=>{if(!j)return;const t=o[j],a=Ws(t.sections,I);if(!a)return;const s=Gs(a);ye.mutate({blockKey:j,data:{...t,sections:a}},{onSuccess:()=>{B(s),P(null),T(null),V(null),M([]),E(null),ie(null)},onError:i=>W.error(`Save failed: ${i.message}`)})},nn=(t,a,s)=>{if(!j)return;const i=o[j],p=i.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const b=p;if(!Array.isArray(b.variants))return;const x=t([...b.variants]);if(!x)return;const C=rr(b,x),Y={...o,[j]:{...i,sections:C}};ye.mutate({blockKey:j,data:Y[j]},{onSuccess:()=>{a?.(),s&&jt(s,Y)},onError:A=>W.error(`Save failed: ${A.message}`)})},os=t=>{G(null),B(t),P(null),T(null),V(null),M([]);const a=Oe[t]?.rule,{resolveType:s,formValue:i}=kt(a,o??{},c??void 0);ie(s),E(i),pn(Oe.map(p=>({rule:p.rule})),t)},is=(t,a)=>{if(t===a)return;let s=Ve;Ve===t?s=a:t<Ve&&a>=Ve?s=Ve-1:t>Ve&&a<=Ve&&(s=Ve+1),B(s);const i=Rt(Oe.map(p=>({rule:p.rule})),t,a);pn(i,s),nn(p=>Rt(p,t,a))},ls=t=>{const a=Oe[t]?.rule,s=bt(a,o??{},c??void 0);nn(i=>i.length<=1?null:(i.splice(t,1),i),()=>{Oe.length-1===1?B(0):t<Ve?B(Ve-1):t===Ve&&B(Math.max(0,t-1)),P(null),T(null),V(null),M([]),E(null),ie(null)},s)},cs=t=>{nn(a=>or(a,t),()=>{B(t+1),P(null),T(null),V(null),M([]),E(null),ie(null)})},us=async(t,a)=>{Mt();const s=qe.current.activePageKey,i=qe.current.decofile;if(!s)return;const p=i[s],b=p.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const x=b;if(!Array.isArray(x.variants))return;const C=[...x.variants],Y=C[t];if(!Y?.rule||typeof Y.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const A=Y.rule,O=a.trim();Vt(!0);try{if(!O){if(!mt(A,i,c)){G(null);return}const Ye=A.__resolveType??"";C[t]={...Y,rule:Tn(A,i,c)};const fe={...i,[s]:{...p,sections:{...x,variants:C}}};await ye.mutateAsync({blockKey:s,data:fe[s]}),await jt(Ye,fe),G(null),g?.();return}const L=An(A,i,c);if(!L){W.error("Could not read this variant's matcher rule.");return}if(L.blockKey){await ye.mutateAsync({blockKey:L.blockKey,data:yt(L.resolveType,L.data,O)}),G(null),g?.();return}const ge=an(O),z=sn(ge,i);if(z){W.error(z);return}const U=yt(L.resolveType,L.data,O);let De=null;try{await ye.mutateAsync({blockKey:ge,data:U}),De=ge,C[t]={...Y,rule:Ft(ge)},await ye.mutateAsync({blockKey:s,data:{...p,sections:{...x,variants:C}}}),De=null}catch(Ye){throw De&&await Ht.mutateAsync({blockKey:De}).catch(()=>{}),Ye}G(null),W.success(`Saved matcher as global block "${O}"`),g?.()}catch(L){W.error(L instanceof Error?L.message:"Failed to rename variant")}finally{Vt(!1)}},ds=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:i,parsedSections:p,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(s===null||!x)return;const A=i[s],O=p[s];if(!A||!O?.isMultivariate)return;const L=Je(A,O);if(!L)return;const ge=L.variants??[],z=ge[t];if(!z?.rule||typeof z.rule!="object"){W.error("This variant has no matcher rule to rename.");return}const U=z.rule,De=a.trim();Vt(!0);const Ye=async fe=>{const We={...L,variants:fe},Xe=[...i];Xe[s]=dt(A,O,We);const rt=wt(b,x,Xe,Y,C);return await ye.mutateAsync({blockKey:x,data:rt}),{...b,[x]:rt}};try{if(!De){if(!mt(U,b,c)){ne(null);return}const ot=U.__resolveType??"",Nn=[...ge];Nn[t]={...z,rule:Tn(U,b,c)};const vs=await Ye(Nn);await jt(ot,vs),ne(null),g?.();return}const fe=An(U,b,c);if(!fe){W.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await ye.mutateAsync({blockKey:fe.blockKey,data:yt(fe.resolveType,fe.data,De)}),ne(null),g?.();return}const We=an(De),Xe=sn(We,b);if(Xe){W.error(Xe);return}const rt=yt(fe.resolveType,fe.data,De);let Ze=null;try{await ye.mutateAsync({blockKey:We,data:rt}),Ze=We;const ot=[...ge];ot[t]={...z,rule:Ft(We)},await Ye(ot),Ze=null}catch(ot){throw Ze&&await Ht.mutateAsync({blockKey:Ze}).catch(()=>{}),ot}ne(null),W.success(`Saved matcher as global block "${De}"`),g?.()}catch(fe){W.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Vt(!1)}},Dn=()=>{xt()},ms=t=>{Pe(t),Xt({inner:t})},fs=t=>{Le(t),Xt({raw:t})},ps=()=>{Pe(null),xe([])},hs=()=>me(t=>t+1),gs=t=>{if(Z){if(t===0){zt.flush(),we(!1),Pe(null),Le(void 0),xe([]),me(s=>s+1),N?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){M(je.slice(0,t)),X(s=>s+1);return}if(t===0){Dn();return}if(t===1){M([]),X(s=>s+1);return}if(ct&&t===2){M([]),X(s=>s+1);return}const a=ct?2:1;M(je.slice(0,t-a))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:st||$t||Z?n.jsxs("div",{className:Be("border-b px-3 py-2.5",st&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!_e&&Pt&&tt&&n.jsxs("button",{type:"button",onClick:Dn,title:`Editing in variant: ${tt.label}`,className:Be("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",oo),children:[n.jsx(ha,{rule:Dt(tt.rule,o??{},c??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:tt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:wn.map((t,a)=>{const s=a===wn.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(sa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>gs(a),title:t,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?st?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":st?"text-foreground/80":"text-muted-foreground",st?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),st&&n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(fr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(ht,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),jn&&!ct&&!at?.isHidden&&j&&n.jsx(In,{onClick:()=>Zt()})]}),st&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(lo,{pageKey:j,initialName:ze.name,initialPath:ze.path,onFieldChange:$a})}),n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>we(!0),children:n.jsx(dr,{size:14})})}),n.jsx(ht,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(ft,{children:[n.jsx(pt,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>k&&j?k(j):K(!0),children:n.jsx(mr,{size:14})})}),n.jsx(ht,{side:"bottom",children:"View JSON"})]}),n.jsx(In,{onClick:Rn})]})}),Z?n.jsx(Lt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ct&&j?n.jsx(Pr,{rawSeo:Yt,innerSeo:mn,defaultResolveType:Ca,seoSchema:Pa,activeResolveType:Jt,seoTypeOptions:Va,formResetKey:Re,siteDefaultSeo:Ta,onBreadcrumbChange:xe,onPersistRaw:fs,onInnerChange:ms,onClearForm:ps,onBumpFormKey:hs}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):$t?n.jsxs(Lt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&<.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Fs,{listKey:`${j??""}:${f??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:en,onSelect:Ha,onRename:ne,onDuplicate:Wa,onDelete:Ua,onRemoveAll:qa,onReorder:Ga,onAdd:()=>Zt()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Cn,{currentRt:Ie??"",currentLabel:Bt(Et?.rule,o??{},et,c??void 0),currentGlobalKey:bt(Et?.rule,o??{},c??void 0)??void 0,matchers:At,globals:vn,onSelect:es,onSelectGlobal:ns}),kn&&ae&&n.jsx("div",{className:"pt-1",children:n.jsx(Fn,{schema:kn,value:ae,onChange:ts,meta:c??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${f??"none"}:${en}:${Ie??""}`)})]})]}),n.jsx(Ln,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:c,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})]}):_e?n.jsx(Lt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Ln,{activeSchema:Qt,formValue:se,formResetKey:Ae,onFormChange:hn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:c,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt})}):n.jsxs(Lt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&j&&n.jsx(ao,{listKey:j,variants:Oe,activeIndex:Ve,decofile:o??{},meta:c,matchers:At,onSelect:os,onReorder:is,onRename:G,onDuplicate:cs,onDelete:ls,onAdd:Rn}),Pt&&ue!==null&&n.jsxs("div",{className:Be("px-3 border-b",le?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":le,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),le?n.jsx(cr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ir,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsxs("div",{className:Be("space-y-3",_t&&"pointer-events-none opacity-50"),children:[n.jsx(Cn,{currentRt:ue,currentLabel:Bt(tt?.rule,o??{},et,c??void 0),currentGlobalKey:bt(tt?.rule,o??{},c??void 0)??void 0,matchers:At,globals:vn,onSelect:Qa,onSelectGlobal:Za}),Sn&&Ce&&n.jsx("div",{className:"space-y-3",children:n.jsx(Fn,{schema:Sn,value:Ce,onChange:Xa,meta:c??void 0,decofile:o,onSaveReferencedBlock:Nt,sandbox:Tt},`${Ve}:${ue??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(qr,{listKey:`${j??""}-${Ve}`,rawSections:I,sections:Te,meta:c,selectedIndex:f,onSelect:Ea,onReorder:Ka,onDelete:Oa,onDuplicate:Ba,onMakeReusable:ve,onToggleHidden:Fa,onToggleLazy:La,onAddVariant:Zt,onDetach:Ia,onAddSection:()=>de(!0),canAddSection:Ja})})]}),n.jsx(Ls,{open:Ne!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:Ne!==null?an(Te[Ne]?.label??""):"",isPending:ye.isPending,onSubmit:Ya}),u&&n.jsx(Er,{open:Se,onOpenChange:de,meta:c,decofile:o,previewBaseUrl:u,onSelect:za}),be&&j&&o&&n.jsx(Is,{open:be,onOpenChange:K,pageKey:j,decofile:o}),re!==null&&n.jsx(Kn,{open:!0,initialName:mt(Oe[re]?.rule,o??{},c??void 0)?Bt(Oe[re]?.rule,o??{},et,c??void 0):"",autoLabel:et(Dt(Oe[re]?.rule,o??{},c??void 0)),isPending:_t,onSubmit:async t=>{await us(re,t)},onOpenChange:t=>{!t&&!_t&&G(null)}}),q!==null&&n.jsx(Kn,{open:!0,initialName:mt(lt[q]?.rule,o??{},c??void 0)?Bt(lt[q]?.rule,o??{},et,c??void 0):"",autoLabel:et(Dt(lt[q]?.rule,o??{},c??void 0)),isPending:_t,onSubmit:async t=>{await ds(q,t)},onOpenChange:t=>{!t&&!_t&&ne(null)}})]})}export{Ql as SectionsEditor};
|