decocms 4.84.2 → 4.84.3
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-D-N2zo0t.js → AlertCircle-C5oYI4HJ.js} +1 -1
- package/dist/client/assets/{AreaChart-Dr8apG2o.js → AreaChart-h32jSrWe.js} +1 -1
- package/dist/client/assets/{ArrowUp-CbFM-kat.js → ArrowUp-DFJMdP7L.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-B3juowcn.js → ArrowUpRight-2vxY4Qdy.js} +1 -1
- package/dist/client/assets/{CheckCircle-COZrjV2D.js → CheckCircle-BpW-GNB-.js} +1 -1
- package/dist/client/assets/{ChevronDown-DB-nMQrk.js → ChevronDown-r-_rh5EY.js} +1 -1
- package/dist/client/assets/{ChevronRight-Bx5egFn0.js → ChevronRight-u7xgpYrW.js} +1 -1
- package/dist/client/assets/{ChevronUp-D80f0FTg.js → ChevronUp-Bw0ymM9W.js} +1 -1
- package/dist/client/assets/{Copy01-BqsecaGs.js → Copy01-hSZZYKG1.js} +1 -1
- package/dist/client/assets/{DotsVertical-C0wpBby-.js → DotsVertical-B0JjGCi3.js} +1 -1
- package/dist/client/assets/{Eye-BAfEF8fF.js → Eye-BaRLBEn3.js} +1 -1
- package/dist/client/assets/{FilterLines-B-9Tqd7m.js → FilterLines-C3sUXVMn.js} +1 -1
- package/dist/client/assets/{Globe01-DmADoGPI.js → Globe01-C61HP1tI.js} +1 -1
- package/dist/client/assets/{Globe04-w8mYPfRz.js → Globe04-B8-Xh0JM.js} +1 -1
- package/dist/client/assets/{HardDrive--s3dp5HX.js → HardDrive-CxF9Spzl.js} +1 -1
- package/dist/client/assets/{Image01-BawkYWiW.js → Image01-pHDGsVL2.js} +1 -1
- package/dist/client/assets/{Key01-B7WRTr_v.js → Key01-CbbQm-Sw.js} +1 -1
- package/dist/client/assets/{LayoutLeft-BykCJohu.js → LayoutLeft-4JMUy8vk.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Di0_qTZx.js → LinkExternal01-C1NU5pfm.js} +1 -1
- package/dist/client/assets/{Monitor01-DVl9ktwW.js → Monitor01-BxTuXOOp.js} +1 -1
- package/dist/client/assets/{Package-C9K3k9W0.js → Package-BkECyMbs.js} +1 -1
- package/dist/client/assets/{Palette-BksDGTkK.js → Palette-Sm9M4nVN.js} +1 -1
- package/dist/client/assets/{Play-CV7tfmkl.js → Play-DayjM7Kd.js} +1 -1
- package/dist/client/assets/{Plus-DXkuTrJe.js → Plus-Ci7K4Ct_.js} +1 -1
- package/dist/client/assets/{SearchLg-CY-S3YHF.js → SearchLg-CtM9p2dR.js} +1 -1
- package/dist/client/assets/{SearchMd-Q_sOOlOx.js → SearchMd-CPkaKF5i.js} +1 -1
- package/dist/client/assets/{Settings02-ClmBsuLw.js → Settings02-CWJz4nAO.js} +1 -1
- package/dist/client/assets/{Shield01-sbh3mCf9.js → Shield01-39s6HRtv.js} +1 -1
- package/dist/client/assets/{Star01-NP90SIIV.js → Star01-BE9ERhe_.js} +1 -1
- package/dist/client/assets/{Stars01-BDpjTrRF.js → Stars01-DBWFZ5hV.js} +1 -1
- package/dist/client/assets/{Stars02-CxStza3y.js → Stars02-Dgtkk5Y-.js} +1 -1
- package/dist/client/assets/{Sun-DikBiI37.js → Sun-C89FtXYW.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-C_C-ncG2.js → SwitchHorizontal01-5-1OAjem.js} +1 -1
- package/dist/client/assets/{Tool01-B1Bx5MP5.js → Tool01-xoOv4_7Y.js} +1 -1
- package/dist/client/assets/{Tool02-CdRpz1ks.js → Tool02-DrpXqZ3Z.js} +1 -1
- package/dist/client/assets/{Trash01-Dids5Odl.js → Trash01-D4uxHMnz.js} +1 -1
- package/dist/client/assets/{TrendUp01-DNBXzGjW.js → TrendUp01-DJSEsaa4.js} +1 -1
- package/dist/client/assets/{Upload01-iEqn2jOl.js → Upload01-C0m7KK_e.js} +1 -1
- package/dist/client/assets/{User01-8Z9pGyaU.js → User01-CL8Lqoqa.js} +1 -1
- package/dist/client/assets/{Users01-CBJblExt.js → Users01-C8GYGUG1.js} +1 -1
- package/dist/client/assets/{Users03-C7jw3CTG.js → Users03-C11myK4v.js} +1 -1
- package/dist/client/assets/{X-pkqCD6UJ.js → X-FfTODUnY.js} +1 -1
- package/dist/client/assets/{XCircle-CLiB0gTf.js → XCircle-eSQqLKYa.js} +1 -1
- package/dist/client/assets/{XClose-DTJCOkfy.js → XClose-B3-TWCDz.js} +1 -1
- package/dist/client/assets/{Zap-DWQIGw09.js → Zap-BoFXRgmU.js} +1 -1
- package/dist/client/assets/{ZapSquare-Dmu-LhOR.js → ZapSquare-DhJf-bn6.js} +1 -1
- package/dist/client/assets/{ZoomOut-iy3hLtzE.js → ZoomOut-D4ZRPuxd.js} +1 -1
- package/dist/client/assets/{access-gate-DOjseIrY.js → access-gate-kTO9SnvL.js} +1 -1
- package/dist/client/assets/{add-section-modal-Cg59aAQa.js → add-section-modal-CEyQogiS.js} +1 -1
- package/dist/client/assets/{agent-icon-DAlT66eM.js → agent-icon-CB_-JSjj.js} +1 -1
- package/dist/client/assets/{agents-list-PZAOhJyz.js → agents-list-BRsTaG9z.js} +1 -1
- package/dist/client/assets/{ai-providers-BuqwTGiq.js → ai-providers-Bz8XwABe.js} +1 -1
- package/dist/client/assets/{alert-Byyfs8Va.js → alert-Fjjng6hL.js} +1 -1
- package/dist/client/assets/{alert-dialog-CCrCAp3W.js → alert-dialog-BmRsNwN9.js} +1 -1
- package/dist/client/assets/{app-editor-CLVZtIeX.js → app-editor-BEjeG945.js} +1 -1
- package/dist/client/assets/{auth-BacK4a-e.js → auth-B54kii7x.js} +1 -1
- package/dist/client/assets/{auth-catchall-CK6fTAjS.js → auth-catchall-B3UfVpFT.js} +1 -1
- package/dist/client/assets/{auth-entry-DrC66VU5.js → auth-entry-C5JdYt8L.js} +1 -1
- package/dist/client/assets/{auth-split-layout-K6aCRANc.js → auth-split-layout-CUHd8r6T.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-C-TnzHrX.js → authenticate-and-persist-oauth-CJok6jUd.js} +1 -1
- package/dist/client/assets/{automation-list-row-BPhHE9s6.js → automation-list-row-Dh102Lw3.js} +1 -1
- package/dist/client/assets/{automation-runs-DxF85IV8.js → automation-runs-D_QDuFCw.js} +1 -1
- package/dist/client/assets/{automations-Bi-A1X9A.js → automations-DzYrMSmv.js} +1 -1
- package/dist/client/assets/{autosend-B0R-Ptqb.js → autosend-CkIV8p4Q.js} +1 -1
- package/dist/client/assets/{avatar-CplMWphM.js → avatar-BazXLkz7.js} +1 -1
- package/dist/client/assets/{badge-jIl8YgDk.js → badge-DNd7ajkN.js} +1 -1
- package/dist/client/assets/{block-document-Cw5Ea9-e.js → block-document-BPqUAW97.js} +1 -1
- package/dist/client/assets/{brand-context-DN6co5BO.js → brand-context-DswG1e_y.js} +1 -1
- package/dist/client/assets/{buckets-CoX68l6Q.js → buckets-CXh4_2nv.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-6DdTtg9N.js → bulk-category-panel-CwIMxHwL.js} +1 -1
- package/dist/client/assets/{calendar-ANB8ZB6P.js → calendar-E0PNlIgV.js} +1 -1
- package/dist/client/assets/{capability-load-error-be5cMIr1.js → capability-load-error-CVIIPd0O.js} +1 -1
- package/dist/client/assets/{card-Bf5hIqR-.js → card-D8J7Ri-1.js} +1 -1
- package/dist/client/assets/{category-editor-abtpUFAS.js → category-editor-DTIOnuPB.js} +1 -1
- package/dist/client/assets/{chat-context-cAuhh1bq.js → chat-context-BUbzUhOw.js} +1 -1
- package/dist/client/assets/{checkbox-CrwWp9mY.js → checkbox-TB3JO09j.js} +1 -1
- package/dist/client/assets/{cli-auth-success-B6-RbWjM.js → cli-auth-success-DSI2Uch8.js} +1 -1
- package/dist/client/assets/{collection-detail-BItZpfZ6.js → collection-detail-DPD8UtGx.js} +1 -1
- package/dist/client/assets/{collection-display-button-R7ABciZu.js → collection-display-button-fzDrGsXO.js} +1 -1
- package/dist/client/assets/{collection-search-_tE5WTnF.js → collection-search-CSoSzgWh.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DSXrYyrO.js → collection-table-wrapper-DDxYCHhc.js} +1 -1
- package/dist/client/assets/{collection-tabs-BrNwinEF.js → collection-tabs-CDruT76J.js} +1 -1
- package/dist/client/assets/{command-DO1ZDzTT.js → command-Bj2qn6yr.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-CGGuxa43.js → commerce-onboarding-Dbl4XVgW.js} +1 -1
- package/dist/client/assets/{companions-core-eXjmPSzw.js → companions-core-BH0fr5JT.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-BYiTlLLa.js → connect-desktop-dialog-B5qEVpzb.js} +1 -1
- package/dist/client/assets/{connection-card-B0P0Mlp0.js → connection-card-UBiS44sg.js} +1 -1
- package/dist/client/assets/{connection-detail-3BQFhnUn.js → connection-detail-BouIw1xA.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B90djqcF.js → connection-form-helpers-DPhduFQi.js} +1 -1
- package/dist/client/assets/{connections-H21ZTvTf.js → connections-DcGm9lo8.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DhSLHuvP.js → decopilot-sse-pool-3tG4lnzy.js} +1 -1
- package/dist/client/assets/{dialog-BAajFxgb.js → dialog-DWi0JlTh.js} +1 -1
- package/dist/client/assets/{domain-settings-uh6_I1rx.js → domain-settings-CZXBbiGA.js} +1 -1
- package/dist/client/assets/{drawer-DnACySRD.js → drawer-BLFVbiL_.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DH5kQn8D.js → dropdown-menu-C1VVmRJP.js} +1 -1
- package/dist/client/assets/{empty-state-1onECIW_.js → empty-state-CwKWqf4t.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CVdsdS6x.js → extract-connection-data-DW5nl8RN.js} +1 -1
- package/dist/client/assets/{file-explorer-Cl02qrK4.js → file-explorer-Ctzeeunw.js} +1 -1
- package/dist/client/assets/{file-type-icon-B4D4xZ16.js → file-type-icon-JSO6qaid.js} +1 -1
- package/dist/client/assets/{files-D4mr26Ep.js → files-DpWF2qYk.js} +1 -1
- package/dist/client/assets/{form-gXVysHyg.js → form-Dh4tluSC.js} +1 -1
- package/dist/client/assets/{general-BVIXl5aR.js → general-Byw8_9hg.js} +1 -1
- package/dist/client/assets/{github-repo-picker-D7dnKNbV.js → github-repo-picker-DkcIZtn-.js} +1 -1
- package/dist/client/assets/{hooks-CFU5t0uY.js → hooks-BPppL9UW.js} +1 -1
- package/dist/client/assets/{index-CNxmDBOM.js → index-AQIh7ZmC.js} +1 -1
- package/dist/client/assets/{index-Ca5hVpRS.js → index-BMnoeLAK.js} +1 -1
- package/dist/client/assets/{index-C5EWLDtX.js → index-BOo29nkh.js} +1 -1
- package/dist/client/assets/{index-Dq2w61kp.js → index-BZRnn28t.js} +3 -3
- package/dist/client/assets/{index-Cu7BulT0.js → index-Bpp38t32.js} +1 -1
- package/dist/client/assets/{index-DoeTN8dG.js → index-CRlTKiBF.js} +1 -1
- package/dist/client/assets/{index-C2CoDb5Q.js → index-CRzftGrP.js} +1 -1
- package/dist/client/assets/{index-DfmK1Hb7.js → index-CbUefO5d.js} +1 -1
- package/dist/client/assets/{index-DWzwfSlq.js → index-Ch7cVlJo.js} +1 -1
- package/dist/client/assets/{index-CmvC1D_3.js → index-DU2vtCjc.js} +1 -1
- package/dist/client/assets/{index-Bs33RUxr.js → index-DYsXJQBT.js} +6 -6
- package/dist/client/assets/{index-B_5nj9O3.js → index-Db_vIyP1.js} +2 -2
- package/dist/client/assets/{index-Cs78FSkl.js → index-DgPXCSqH.js} +1 -1
- package/dist/client/assets/{index-redirect-B4Oxi7pk.js → index-redirect-DSrU5uu8.js} +1 -1
- package/dist/client/assets/{index-CgiZT2_5.js → index-tIwFyQlt.js} +1 -1
- package/dist/client/assets/{input-C9lf6RHW.js → input-BsGAL_rg.js} +1 -1
- package/dist/client/assets/{integration-icon-Dt8c_xDl.js → integration-icon-CGJHKREq.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-Dk_aEZP3.js → invite-member-dialog-H38CIaX1.js} +1 -1
- package/dist/client/assets/{label-TC44lPSR.js → label-DbY0_RCi.js} +1 -1
- package/dist/client/assets/{layout-BCVQijWF.js → layout-Cpp71r3-.js} +1 -1
- package/dist/client/assets/{login-Dtv3DTON.js → login-CiKw7P11.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BccHUoE7.js → mcp-oauth-D700t2XZ.js} +1 -1
- package/dist/client/assets/{members-DjsTKjwO.js → members-D-a3VkwI.js} +1 -1
- package/dist/client/assets/{monaco-editor-araxZLbA.js → monaco-editor-BX8ARTuF.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CSgNIGfs.js → monitoring-stats-row-BO3FkcsX.js} +1 -1
- package/dist/client/assets/{multi-select-BJkQ67Qr.js → multi-select-BlGwy_5n.js} +1 -1
- package/dist/client/assets/{oauth-callback-BtFIKOtO.js → oauth-callback-DQJPsP1g.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-2Ld6qUNB.js → oauth-callback-ai-provider-BinjbB99.js} +1 -1
- package/dist/client/assets/{onboarding-BLadlWp4.js → onboarding-AmIgMaGl.js} +1 -1
- package/dist/client/assets/{org-install-2j7rBKfx.js → org-install-D4eWyomM.js} +1 -1
- package/dist/client/assets/{org-layout-C-fu_skT.js → org-layout-DUXHS5IG.js} +1 -1
- package/dist/client/assets/{organization-choice-DUbZG9_A.js → organization-choice-CtODp9lF.js} +1 -1
- package/dist/client/assets/{orgs-Y8EnH_si.js → orgs-CMlgiNDj.js} +1 -1
- package/dist/client/assets/{page-seo-form-Ul03RbrF.js → page-seo-form-BSHsNdod.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CCadS2Br.js +1 -0
- package/dist/client/assets/{popover-DwCKPV_t.js → popover-Cnsk2Qp7.js} +1 -1
- package/dist/client/assets/{post-editor-FL4mLEh-.js → post-editor-CFu__7Gx.js} +1 -1
- package/dist/client/assets/{primitives-DSYHc53L.js → primitives-CKEeazKH.js} +1 -1
- package/dist/client/assets/{profile-MkmJEoUL.js → profile-BoTwXvPX.js} +1 -1
- package/dist/client/assets/project-app-view-DUt4n_TC.js +1 -0
- package/dist/client/assets/record-editor-a-hGS4ui.js +1 -0
- package/dist/client/assets/redirect-editor-Q0cXs5Tr.js +1 -0
- package/dist/client/assets/registry-DsiCnQK6.js +2 -0
- package/dist/client/assets/{registry-layout-R1Ywv9AF.js → registry-layout-D8e1_YTK.js} +1 -1
- package/dist/client/assets/{reports-C2ABtWgo.js → reports-ByJ3Qvyy.js} +1 -1
- package/dist/client/assets/{require-capability-DKCGamzx.js → require-capability-BlRAXRCN.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CeDo_fHK.js → required-auth-layout-BVAnajeN.js} +1 -1
- package/dist/client/assets/{reset-password-Cwb1jHH1.js → reset-password-BnnT_f-_.js} +1 -1
- package/dist/client/assets/{roles-D0_E3cEA.js → roles-CHNzch6D.js} +1 -1
- package/dist/client/assets/{search-input-uqn8CBGQ.js → search-input-6ZHO1XcX.js} +1 -1
- package/dist/client/assets/{secrets-fEvWYkCG.js → secrets-BVZgca_M.js} +1 -1
- package/dist/client/assets/sections-editor-DQqEVuE1.js +2 -0
- package/dist/client/assets/{select-DkGjfHIq.js → select-lfM4Lwzr.js} +1 -1
- package/dist/client/assets/{select-model-CokxJg0w.js → select-model-CtXSPQFB.js} +1 -1
- package/dist/client/assets/{self-tool-result-BiNutjqZ.js → self-tool-result-rA0VOMZb.js} +1 -1
- package/dist/client/assets/{seo-editor-BVIJxdug.js → seo-editor-CtXfyhqT.js} +1 -1
- package/dist/client/assets/{settings-layout--KWgb6Np.js → settings-layout-Cx392WJ8.js} +1 -1
- package/dist/client/assets/{settings-section-CCdyPa0C.js → settings-section-B87HV-a9.js} +1 -1
- package/dist/client/assets/{shell-controls-BpEiuvTA.js → shell-controls-jANBMyCl.js} +1 -1
- package/dist/client/assets/{shell-layout-BqfsjVl_.js → shell-layout-BD6vqj7S.js} +1 -1
- package/dist/client/assets/{sidebar-B4fG5ofy.js → sidebar-D4fUdPe4.js} +1 -1
- package/dist/client/assets/{skeleton-BD7-PLEJ.js → skeleton-TuoSjBy9.js} +1 -1
- package/dist/client/assets/{sso-CQyVIQzG.js → sso-kY7wPx_9.js} +1 -1
- package/dist/client/assets/{store-CCjzmtt7.js → store-Dva1x9Kg.js} +1 -1
- package/dist/client/assets/store-registry-Dyc0TfkF.js +2 -0
- package/dist/client/assets/{studio-tools-CLtpdtPp.js → studio-tools-golej29y.js} +1 -1
- package/dist/client/assets/{switch-Bdw-skzX.js → switch-nIBx4J9q.js} +1 -1
- package/dist/client/assets/{table-DS5JGldL.js → table-BcHiNdGb.js} +1 -1
- package/dist/client/assets/{tabs-Bx4-LRsx.js → tabs-6GAFTC_y.js} +1 -1
- package/dist/client/assets/{textarea-DVwdpBob.js → textarea-DP8OZ3qJ.js} +1 -1
- package/dist/client/assets/{toggle-group-CE1dW64g.js → toggle-group-BSH8KQA-.js} +1 -1
- package/dist/client/assets/{toolbar-CzEj_RW_.js → toolbar-B_Q1qPs6.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-DUT1W08N.js → toolbar-icon-button-BEczZJQm.js} +1 -1
- package/dist/client/assets/{tooltip-BchavdQC.js → tooltip-CSoIf1Gs.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BBuUcz2r.js → use-ai-providers-DBQVAoIe.js} +1 -1
- package/dist/client/assets/{use-automations-D3QFWgnR.js → use-automations-2-PZs3p0.js} +1 -1
- package/dist/client/assets/{use-autosave-BcTqb8g8.js → use-autosave-BFlJDBXr.js} +1 -1
- package/dist/client/assets/{use-capability-BPLt9L0U.js → use-capability-BXzerJwY.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BYKRfxr_.js → use-clock-tick-D1puefsG.js} +1 -1
- package/dist/client/assets/{use-collections-DJ2RC7yo.js → use-collections-DIkw9r9e.js} +1 -1
- package/dist/client/assets/{use-connection-BnBlMOuO.js → use-connection-RTnczTQK.js} +1 -1
- package/dist/client/assets/{use-copy-Bt4sB3j7.js → use-copy-CVTt9IJU.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Jorv_qS7.js → use-create-virtual-mcp-C8VqBj08.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DBwlbCt1.js → use-debounced-autosave-CsDyPqsy.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CD7BkKdl.js → use-debounced-value-BuM9rzzK.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BR8sQTGv.js → use-deco-credits-Bb7OVBAv.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BYghM__V.js → use-decopilot-events-BEpCD1C0.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BNshNXL9.js → use-delete-connection-DZ9-Zx9f.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Bdd3faVY.js → use-deployment-admin-Byw4hBEw.js} +1 -1
- package/dist/client/assets/{use-file-configs-BVoGCgiS.js → use-file-configs-i87gxX6o.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-LuK278-n.js → use-infinite-scroll-TDMfqV2g.js} +1 -1
- package/dist/client/assets/{use-join-requests-CQxjjDxb.js → use-join-requests-C5Rp8M-O.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-C1Lj91HG.js → use-mcp-auth-status-DkXX0hZv.js} +1 -1
- package/dist/client/assets/{use-mcp-client-B7FFuYvl.js → use-mcp-client-Dh6o9WX9.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-wclqBnqX.js → use-mcp-tools-CKIdVct5.js} +1 -1
- package/dist/client/assets/{use-members-DDi0QlY3.js → use-members-Bp2qK5jv.js} +1 -1
- package/dist/client/assets/{use-mobile-BkH8q52P.js → use-mobile-B1WZXmvP.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DcZXQgvu.js → use-navigate-to-agent-eAYZfmSG.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CHx6afFP.js → use-org-auth-client-C2iy2Xil.js} +1 -1
- package/dist/client/assets/{use-org-sso-Bo2xQ2X9.js → use-org-sso-DHHmUCXe.js} +1 -1
- package/dist/client/assets/{use-organization-roles-Cwo_cZiu.js → use-organization-roles-CHkQ1Wa0.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CpEpmpcK.js → use-organization-settings-C0wRGLWg.js} +1 -1
- package/dist/client/assets/{use-registry-app-CwiK5Z0B.js → use-registry-app-Y2QR0Yv5.js} +1 -1
- package/dist/client/assets/{use-registry-connections-ByaFhGED.js → use-registry-connections-Cg8olX4z.js} +1 -1
- package/dist/client/assets/{use-secrets-Bza3Sx_r.js → use-secrets-C3iR1Q_U.js} +1 -1
- package/dist/client/assets/{use-status-sounds-BEcwK-z_.js → use-status-sounds-HNftVODV.js} +1 -1
- package/dist/client/assets/{use-view-mode-BCr-fyRr.js → use-view-mode-C3eM3uQ1.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Cicr-hYo.js → use-virtual-mcp-T5LZEHOm.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-5k36gfAQ.js +1 -0
- package/dist/client/assets/{useRouterState-CEPagBC5.js → useRouterState-DAE3RGs1.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-mfBchPKj.js +1 -0
- package/dist/client/assets/{users-Cq3cOSfR.js → users-xtgr8V4o.js} +1 -1
- package/dist/client/assets/{variant-calendar-D9kMRCsv.js → variant-calendar-vajrwOVy.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-86cnBlNn.js → view-mode-toggle-BpdyGEJn.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-rwidY7xh.js +0 -1
- package/dist/client/assets/project-app-view-DH33byyA.js +0 -1
- package/dist/client/assets/record-editor-DPRpkaaW.js +0 -1
- package/dist/client/assets/redirect-editor-CUXi3DXm.js +0 -1
- package/dist/client/assets/registry-DVFoiUHE.js +0 -2
- package/dist/client/assets/sections-editor-DwZGJ1xQ.js +0 -2
- package/dist/client/assets/store-registry-DYH6eOJ2.js +0 -2
- package/dist/client/assets/useInfiniteQuery-CSqMgqdm.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-dyHoJqEo.js +0 -1
package/dist/client/assets/{require-capability-DKCGamzx.js → require-capability-BlRAXRCN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,j as m}from"./index-
|
|
1
|
+
import{c as p,j as m}from"./index-BZRnn28t.js";import{u as l}from"./use-capability-BXzerJwY.js";import{A as u}from"./access-gate-kTO9SnvL.js";function b(c){const t=p.c(6),{capability:n,area:e,children:i}=c,{granted:a,loading:o,error:s}=l(n);let r;return t[0]!==e||t[1]!==i||t[2]!==s||t[3]!==a||t[4]!==o?(r=m.jsx(u,{granted:a,loading:o,error:s,area:e,children:i}),t[0]=e,t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=r):r=t[5],r}export{b as R};
|
package/dist/client/assets/{required-auth-layout-CeDo_fHK.js → required-auth-layout-BVAnajeN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as l,j as s,A as a,S as m,f as h,h as u,N as f}from"./index-
|
|
1
|
+
import{c as l,j as s,A as a,S as m,f as h,h as u,N as f}from"./index-BZRnn28t.js";function x(){const o=l.c(1),e=window.location.pathname+window.location.search;let t;if(o[0]===Symbol.for("react.memo_cache_sentinel")){const n=e==="/login"||e.startsWith("/login?")?{}:{next:e};t=s.jsx(f,{to:"/login",search:n,replace:!0}),o[0]=t}else t=o[0];return t}function g(o){const e=l.c(6),{children:t}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(a,{children:s.jsx(m,{})}),e[0]=i):i=e[0];let n;e[1]!==t?(n=s.jsx(h,{children:t}),e[1]=t,e[2]=n):n=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(u,{children:s.jsx(x,{})}),e[3]=r):r=e[3];let c;return e[4]!==n?(c=s.jsxs(s.Fragment,{children:[i,n,r]}),e[4]=n,e[5]=c):c=e[5],c}export{g as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as q,u as Y,b as A,r as B,d as G,j as s,B as z,a as K}from"./index-
|
|
1
|
+
import{c as q,u as Y,b as A,r as B,d as G,j as s,B as z,a as K}from"./index-BZRnn28t.js";import{I as L}from"./input-BsGAL_rg.js";function H(){const e=q.c(45);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/reset-password"},e[0]=n):n=e[0];const{token:r,error:h}=Y(n),a=A(),[o,D]=B.useState(""),[l,M]=B.useState(""),[t,T]=B.useState(!1),i=h==="INVALID_TOKEN";let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j={mutationFn:O,onSuccess:()=>{T(!0)}},e[1]=j):j=e[1];const w=G(j),v=o===l,c=o.length>=8&&l.length>=8&&v,d=w.isPending,N=w.error;let y;e[2]!==c||e[3]!==o||e[4]!==w||e[5]!==r?(y=b=>{b.preventDefault(),!(!r||!c)&&w.mutate({newPassword:o,token:r})},e[2]=c,e[3]=o,e[4]=w,e[5]=r,e[6]=y):y=e[6];const F=y;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e[7]=k):k=e[7];let S,_,P,C;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),_=s.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),P=s.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),C=s.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e[8]=S,e[9]=_,e[10]=P,e[11]=C):(S=e[8],_=e[9],P=e[10],C=e[11]);let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e[12]=E):E=e[12];const I=t?"Password reset successful":"Set a new password";let m;e[13]!==I?(m=s.jsx("div",{className:"text-center space-y-1",children:s.jsx("p",{className:"text-sm text-foreground/70",children:I})}),e[13]=I,e[14]=m):m=e[14];let u;e[15]!==i||e[16]!==a||e[17]!==t||e[18]!==r?(u=(i||!r&&!t)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:"This reset link is invalid or has expired."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Back to login"})]}),e[15]=i,e[16]=a,e[17]=t,e[18]=r,e[19]=u):u=e[19];let x;e[20]!==N?(x=N&&s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:N.message||"Failed to reset password. Please try again."}),e[20]=N,e[21]=x):x=e[21];let g;e[22]!==a||e[23]!==t?(g=t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:"Your password has been reset. You can now sign in with your new password."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Go to login"})]}),e[22]=a,e[23]=t,e[24]=g):g=e[24];let f;e[25]!==c||e[26]!==l||e[27]!==F||e[28]!==i||e[29]!==d||e[30]!==o||e[31]!==v||e[32]!==t||e[33]!==r?(f=r&&!i&&!t&&s.jsxs("form",{onSubmit:F,className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"New password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:o,onChange:b=>D(b.target.value),required:!0,minLength:8,disabled:d})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Confirm password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:l,onChange:b=>M(b.target.value),required:!0,minLength:8,disabled:d}),l&&!v&&s.jsx("p",{className:"text-xs text-destructive mt-1.5",children:"Passwords do not match"})]}),s.jsx(z,{type:"submit",disabled:d||!c,className:"w-full font-semibold",size:"lg",children:d?"Resetting...":"Reset password"})]}),e[25]=c,e[26]=l,e[27]=F,e[28]=i,e[29]=d,e[30]=o,e[31]=v,e[32]=t,e[33]=r,e[34]=f):f=e[34];let p;e[35]!==a||e[36]!==t?(p=!t&&s.jsx("div",{className:"text-center",children:s.jsx(z,{type:"button",variant:"link",onClick:()=>a({to:"/login"}),className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"})}),e[35]=a,e[36]=t,e[37]=p):p=e[37];let R;return e[38]!==m||e[39]!==u||e[40]!==x||e[41]!==g||e[42]!==f||e[43]!==p?(R=s.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[k,s.jsxs("div",{className:"relative z-10",children:[S,_,P,C,s.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[E,m,u,x,g,f,p]})]})]}),e[38]=m,e[39]=u,e[40]=x,e[41]=g,e[42]=f,e[43]=p,e[44]=R):R=e[44],R}async function O(e){const{newPassword:n,token:r}=e,h=await K.resetPassword({newPassword:n,token:r});if(h.error)throw new Error(h.error.message||"Failed to reset password");return h}export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as F,C as Ne,K as re,b4 as ct,m as Ce,j as s,l as K,i as fe,B as le,c as H,H as we,ad as be,I as se,af as Le,ag as Pe,n as ze,M as dt,J as mt,d as Ye,t as he,p as Ae,w as Fe,x as ut,E as ft,b as ht,u as xt}from"./index-Dq2w61kp.js";import{u as pt}from"./use-organization-roles-Cwo_cZiu.js";import{u as Re}from"./use-org-auth-client-CHx6afFP.js";import{g as $e,a as gt}from"./role-color-Dn2tXDDF.js";import{B as xe}from"./badge-jIl8YgDk.js";import{f as Ke,a as Qe,b as He,c as qe,d as Ze,A as Je,e as Xe,g as We}from"./alert-dialog-CCrCAp3W.js";import{D as Tt,a as Et,c as _t,d as It}from"./dropdown-menu-DH5kQn8D.js";import{i as bt}from"./DotsVertical-C0wpBby-.js";import{s as Se}from"./Plus-DXkuTrJe.js";import{s as Nt}from"./Trash01-Dids5Odl.js";import{C as St}from"./collection-table-wrapper-DSXrYyrO.js";import{P as te}from"./index-Ca5hVpRS.js";import{E as De}from"./empty-state-1onECIW_.js";import{S as Oe}from"./search-input-uqn8CBGQ.js";import{P as et,D as tt}from"./ai-providers-logos-DD3qZ33J.js";import{I as je}from"./integration-icon-Dt8c_xDl.js";import{u as Ct}from"./use-infinite-scroll-LuK278-n.js";import{C as ve}from"./checkbox-CrwWp9mY.js";import{b as At}from"./Settings02-ClmBsuLw.js";import{u as Rt}from"./useSuspenseInfiniteQuery-dyHoJqEo.js";import{u as Ot,S as jt}from"./use-mcp-client-B7FFuYvl.js";import{C as vt}from"./collection-search-_tE5WTnF.js";import{u as st}from"./use-members-DDi0QlY3.js";import{g as lt}from"./get-initials-D-f_fDFw.js";import{u as yt}from"./use-connection-BnBlMOuO.js";import{u as Mt,c as wt}from"./use-ai-providers-BBuUcz2r.js";import{A as nt}from"./avatar-CplMWphM.js";import{S as pe}from"./switch-Bdw-skzX.js";import{c as ge,b as Te,T as Ee,a as _e}from"./tooltip-BchavdQC.js";import{S as ke,a as Ge,b as Ue}from"./settings-section-CCdyPa0C.js";import{t as Lt}from"./ChevronDown-DB-nMQrk.js";import{i as Pt}from"./ChevronRight-Bx5egFn0.js";import{i as Be}from"./X-pkqCD6UJ.js";import{a as Dt}from"./use-capability-BPLt9L0U.js";import{A as kt}from"./access-gate-DOjseIrY.js";import"./ChevronUp-D80f0FTg.js";import"./table-DS5JGldL.js";import"./ArrowUp-CbFM-kat.js";import"./sidebar-B4fG5ofy.js";import"./LayoutLeft-BykCJohu.js";import"./use-mobile-BkH8q52P.js";import"./SearchMd-Q_sOOlOx.js";import"./Tool02-CdRpz1ks.js";import"./agent-icon-DAlT66eM.js";import"./AlertCircle-D-N2zo0t.js";import"./Tool01-B1Bx5MP5.js";import"./XCircle-CLiB0gTf.js";import"./ArrowUpRight-B3juowcn.js";import"./TrendUp01-DNBXzGjW.js";import"./ZapSquare-Dmu-LhOR.js";import"./ZoomOut-iy3hLtzE.js";import"./Users03-C7jw3CTG.js";import"./CheckCircle-COZrjV2D.js";import"./Stars02-CxStza3y.js";import"./Copy01-BqsecaGs.js";import"./Globe01-DmADoGPI.js";import"./Eye-BAfEF8fF.js";import"./FilterLines-B-9Tqd7m.js";import"./Star01-NP90SIIV.js";import"./Globe04-w8mYPfRz.js";import"./SwitchHorizontal01-C_C-ncG2.js";import"./HardDrive--s3dp5HX.js";import"./Image01-BawkYWiW.js";import"./Key01-B7WRTr_v.js";import"./LinkExternal01-Di0_qTZx.js";import"./Monitor01-DVl9ktwW.js";import"./Sun-DikBiI37.js";import"./Package-C9K3k9W0.js";import"./Palette-BksDGTkK.js";import"./Play-CV7tfmkl.js";import"./SearchLg-CY-S3YHF.js";import"./Shield01-sbh3mCf9.js";import"./Stars01-BDpjTrRF.js";import"./Upload01-iEqn2jOl.js";import"./User01-8Z9pGyaU.js";import"./Users01-CBJblExt.js";import"./XClose-DTJCOkfy.js";import"./Zap-DWQIGw09.js";import"./auth-BacK4a-e.js";import"./use-collections-DJ2RC7yo.js";import"./studio-tools-CLtpdtPp.js";import"./card-Bf5hIqR-.js";import"./capability-load-error-be5cMIr1.js";const ye="basic-usage",Me=[{id:ye,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","TASK_BOARD_ITEM_PRS_GET"]},{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}];[...Me.find(t=>t.id===ye)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Bt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function Vt(t,e,l){if(l){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const n=new Set(e);for(const i of t.tools)n.delete(i);return Array.from(n)}function zt(t){const e=H.c(21),{connection:l,isSelected:n,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,x=n?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==x?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",x),e[0]=x,e[1]=f):f=e[1];let a;e[2]!==l.icon||e[3]!==l.title?(a=s.jsx(je,{icon:l.icon,name:l.title,size:"xs"}),e[2]=l.icon,e[3]=l.title,e[4]=a):a=e[4];let p;e[5]!==l.title?(p=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),e[5]=l.title,e[6]=p):p=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==p?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,p]}),e[7]=h,e[8]=a,e[9]=p,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==l.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(ve,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=l.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function Ft(t){const e=H.c(18),{connectionId:l,tool:n,isSelected:i,onToggle:r}=t,d=`tool-${l}-${n.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 x;e[2]!==c||e[3]!==n.name?(x=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:n.name})}),e[2]=c,e[3]=n.name,e[4]=x):x=e[4];let f;e[5]!==n.description?(f=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:n.description}),e[5]=n.description,e[6]=f):f=e[6];let a;e[7]!==x||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[x,f]}),e[7]=x,e[8]=f,e[9]=a):a=e[9];const p=`tool-${l}-${n.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==p?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ve,{id:p,checked:i,onCheckedChange:r,onClick:$t})}),e[10]=i,e[11]=r,e[12]=p,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 $t(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[i,r]=F.useState(""),d=n!==void 0?n:i,h=F.useDeferredValue(d),[c,x]=F.useState("all"),[f,a]=F.useState(!1),p=F.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,_=h.trim(),E=_?{operator:"or",conditions:[{field:["title"],operator:"contains",value:_},{field:["description"],operator:"contains",value:_}]}:void 0,S=!!l,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:I,fetchNextPage:R,hasNextPage:g,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:T=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:T,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,D)=>{if(T?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),b=I?.pages.flatMap(T=>T?.items??[])??[],j=Ct(R,g??!1,O),u=l?b.filter(T=>T.connection_type!=="VIRTUAL"?!0:ct(T.connection_url)!==l):b,M=p.current,A=[...M.values()].map(T=>u.find(D=>D.id===T)).filter(T=>T!==void 0),k=u.filter(T=>!M.has(T.id)),G=[...A,...k],U=T=>{const D=t[T];return D!==void 0&&D.length>0},B=G.filter(T=>{if(c==="all")return!0;const D=U(T.id);return c==="selected"?D:c==="unselected"?!D:!0}),[w,z]=F.useState(G[0]?.id??null),y=w?G.find(T=>T.id===w)??null:null,{data:L,isFetching:Y}=Ce({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}),$=L?.tools??[],J=(T,D)=>t[T]?.includes(D)??!1,X=(T,D)=>{const Q=t[T]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[T]:W[T]=Z}else W[T]=[...Q,D];e(W)},ne=T=>{const D=T===w?$:[];if(!D.length)return;const Q=t[T]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[T]:(Z[T]=q,z(T)),e(Z)},oe=T=>{z(T),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:[n===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:()=>x("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:()=>x("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:()=>x("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(T=>{const D=w===T.id,Q=D?$.length:0,q=t[T.id]?.length??0;return s.jsx(zt,{connection:{...T,tools:D?$:T.tools},isSelected:D,hasToolsEnabled:U(T.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(T.id),onToggle:()=>ne(T.id)},T.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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(le,{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(je,{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"})}):$.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:$.map(T=>s.jsx(Ft,{connectionId:y.id,tool:T,isSelected:J(y.id,T.name),onToggle:()=>X(y.id,T.name)},T.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 Qt=we({role:we({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Pe(),staticPermissions:be(se()),toolSet:Le(se(),be(se())),allowAllModels:Pe(),modelSet:Le(se(),be(se())),memberIds:be(se())});function Ve(t,e,l){const n=s.jsx(pe,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Ht(t){const e=H.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let x;e[0]!==h?(x=h.trim().toLowerCase(),e[0]=h,e[1]=x):x=e[1];const f=F.useDeferredValue(x);let a;if(e[2]!==l||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==n){const p=Ut(),o=(v,I)=>{if(!c){if(l&&I){const R=p.flatMap(Jt).flatMap(Zt);i(!1),r(R.filter(g=>!v.tools.includes(g)));return}l||r(Vt(v,n,!I))}};let m;e[10]!==f?(m=v=>{const{section:I,capabilities:R}=v;return{section:I,capabilities:R.filter(g=>!f||g.label.toLowerCase().includes(f)||g.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=p.map(m).filter(qt);let _;e[12]!==l||e[13]!==i||e[14]!==r?(_=()=>{i(!l),r([])},e[12]=l,e[13]=i,e[14]=r,e[15]=_):_=e[15];let E;e[16]!==l||e[17]!==c||e[18]!==_?(E=Ve(l,c,_),e[16]=l,e[17]=c,e[18]=_,e[19]=E):E=e[19];let S;e[20]!==l||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!l),r([])},e[20]=l,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==E||e[26]!==S?(C=s.jsx(ke,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:E,onClick:S})})}),e[25]=E,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:I,capabilities:R}=v;return s.jsx(ke,{title:I,children:s.jsx(Ge,{children:R.map(g=>{const O=Bt(g,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[g.label,g.dangerous&&s.jsx(ut,{size:12,className:"text-warning shrink-0"})]}),description:g.description,action:Ve(O,c,()=>o(g,O)),onClick:c?void 0:()=>o(g,O)},g.id)})})},I)})]})}),e[2]=l,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=n,e[9]=a}else a=e[9];return a}function qt(t){return t.capabilities.length>0}function Zt(t){return t.tools}function Jt(t){return t.capabilities}const ot={anthropic:"Anthropic",openrouter:"OpenRouter"},Xt={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 Wt(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function es(t){return Xt[t]??ot[t]??t}function ts(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const it=30;function ss(t){const e=H.c(44),{connectionId:l,subProviderId:n,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:x,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:p,readOnly:o,defaultExpanded:m}=t,[N,_]=F.useState(m),E=m||N,S=_,[C,v]=F.useState(it);let I;e[0]!==f||e[1]!==x||e[2]!==c?(I=j=>x||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=x,e[2]=c,e[3]=I):I=e[3];const R=I;let g;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],g=d.filter(j),e[4]=R,e[5]=d,e[6]=g}else g=e[6];const O=g.length;let b;if(e[9]!==h||e[10]!==x||e[11]!==l||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||e[16]!==d||e[17]!==p||e[18]!==a||e[19]!==o||e[20]!==n||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=()=>S(is),e[24]=M):M=e[24];const A=r??et[n]??tt;let k;e[25]!==i||e[26]!==A?(k=s.jsx(je,{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]!==O||e[34]!==d.length?(B=s.jsxs(xe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let w;e[36]!==E?(w=E?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,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],b=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=R(L.id),$=()=>{if(!o){if(x){p(l,h,L.id);return}a(l,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:$,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:os,children:o?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:Y,disabled:!0,onCheckedChange:ns})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:Y,onCheckedChange:$})})]},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(ls),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=x,e[11]=l,e[12]=O,e[13]=E,e[14]=r,e[15]=R,e[16]=d,e[17]=p,e[18]=a,e[19]=o,e[20]=n,e[21]=i,e[22]=C,e[23]=b}else b=e[23];return b}function ls(t){return t+it}function ns(){}function os(t){return t.stopPropagation()}function is(t){return!t}function rs(t){const e=H.c(33),{connection:l,selectedModels:n,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:x}=t,f=wt(l.id);let a,p,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==x||e[9]!==c||e[10]!==n){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==l.label?(S=A=>({...A,id:A.modelId,provider:l.label}),e[16]=l.label,e[17]=S):S=e[17];const C=f.filter(ms).map(S),v=c.trim().toLowerCase(),I=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(I.length===0){N=null;break e}const R=new Map;for(const A of I){const k=Wt(A.id,l.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ts(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const g=Array.from(R.entries()).map(ds).sort(cs),O=g.length===1||v.length>0;o="flex flex-col gap-3";const b=et[l.providerId]??tt;let j;e[18]!==l.providerId||e[19]!==b?(j=s.jsx("img",{src:b,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=b,e[20]=j):j=e[20];const u=ot[l.providerId]??l.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",p=g.map(A=>s.jsx(ss,{connectionId:l.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(as),selectedModels:n,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:x,defaultExpanded:O},A.id))}e[0]=h,e[1]=i,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=x,e[9]=c,e[10]=n,e[11]=a,e[12]=p,e[13]=o,e[14]=m,e[15]=N}else a=e[11],p=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let _;e[26]!==a||e[27]!==p?(_=s.jsx("div",{className:a,children:p}),e[26]=a,e[27]=p,e[28]=_):_=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==_?(E=s.jsxs("div",{className:o,children:[m,_]}),e[29]=o,e[30]=m,e[31]=_,e[32]=E):E=e[32],E}function as(t){return t.id}function cs(t,e){return t.name.localeCompare(e.name)}function ds(t){const[e,l]=t;return{id:e,name:es(e),logo:l.logo,models:l.models}}function ms(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function us(t){const e=H.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,x=F.useDeferredValue(h),f=Mt();let a;e[0]!==n||e[1]!==r?(a=(g,O)=>{const b=n[g]??[],j={...n};if(b.includes(O)){const u=b.filter(M=>M!==O);u.length===0?delete j[g]:j[g]=u}else j[g]=[...b,O];r(j)},e[0]=n,e[1]=r,e[2]=a):a=e[2];const p=a;let o;e[3]!==n||e[4]!==i||e[5]!==r?(o=(g,O,b)=>{i(!1),r({...n,[g]:O.filter(j=>j!==b)})},e[3]=n,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let _;e[7]!==N?(_=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=_):_=e[8];let E;e[9]!==l||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const g=!l;i(g),g&&r({})},e[9]=l,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==l||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:hs,children:c?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:l,disabled:!0,onCheckedChange:fs})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:l,onCheckedChange:g=>{i(g),g&&r({})}})}),e[15]=l,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==_||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:_,onClick:E,children:[S,C]}),e[20]=_,e[21]=E,e[22]=C,e[23]=v):v=e[23];let I;e[24]!==f||e[25]!==l||e[26]!==x||e[27]!==m||e[28]!==n||e[29]!==c||e[30]!==p?(I=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(g=>s.jsx(F.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(rs,{connection:g,selectedModels:n[g.id]??[],allowAllModels:l,onToggleModel:p,onExitAllowAll:m,allConnectionModelsSelected:(n[g.id]??[]).includes("*"),searchQuery:x,readOnly:c})},g.id)),e[24]=f,e[25]=l,e[26]=x,e[27]=m,e[28]=n,e[29]=c,e[30]=p,e[31]=I):I=e[31];let R;return e[32]!==I||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,I]}),e[32]=I,e[33]=v,e[34]=R):R=e[34],R}function fs(){}function hs(t){return t.stopPropagation()}function xs(t){const e=H.c(52),{open:l,onOpenChange:n,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=F.useState(""),c=F.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[f,a]=F.useState(x),{data:p}=st();let o,m,N,_,E,S,C,v,I,R,g;if(e[1]!==p?.data?.members||e[2]!==c||e[3]!==r||e[4]!==n||e[5]!==l||e[6]!==f||e[7]!==d||e[8]!==i){const U=p?.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]!==n||e[24]!==f?(z=()=>{r(f),a([]),n(!1)},e[22]=r,e[23]=n,e[24]=f,e[25]=z):z=e[25],N=z,m=Ke,R=l,g=n,o=Qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(qe,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=I):I=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],_="flex-1 overflow-auto",E=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.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(ve,{checked:$||Y,onCheckedChange:()=>{!L||Y||a(J=>J.includes(y.id)?J.filter(X=>X!==y.id):[...J,y.id])},disabled:!L||Y}),s.jsx(nt,{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(xe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(xe,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=p?.data?.members,e[2]=c,e[3]=r,e[4]=n,e[5]=l,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=_,e[13]=E,e[14]=S,e[15]=C,e[16]=v,e[17]=I,e[18]=R,e[19]=g}else o=e[9],m=e[10],N=e[11],_=e[12],E=e[13],S=e[14],C=e[15],v=e[16],I=e[17],R=e[18],g=e[19];let O;e[29]!==_||e[30]!==E?(O=s.jsx("div",{className:_,children:E}),e[29]=_,e[30]=E,e[31]=O):O=e[31];let b;e[32]!==O||e[33]!==S||e[34]!==C?(b=s.jsxs("div",{className:S,children:[C,O]}),e[32]=O,e[33]=S,e[34]=C,e[35]=b):b=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,M=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==M?(A=s.jsxs(Xe,{className:"px-6 pb-6",children:[j,s.jsxs(We,{onClick:N,disabled:u,children:["Add ",M]})]}),e[37]=N,e[38]=u,e[39]=M,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==b||e[43]!==A||e[44]!==v||e[45]!==I?(k=s.jsxs(o,{className:v,children:[I,b,A]}),e[41]=o,e[42]=b,e[43]=A,e[44]=v,e[45]=I,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==g?(G=s.jsx(m,{open:R,onOpenChange:g,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=g,e[51]=G):G=e[51],G}function ps(t){const e=H.c(29),{memberIds:l,onMemberIdsChange:n,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,x=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=F.useDeferredValue(d),{data:p}=st();let o,m,N;if(e[0]!==p?.data?.members||e[1]!==a||e[2]!==l||e[3]!==n||e[4]!==x||e[5]!==f||e[6]!==d){const v=p?.data?.members??[];let I;e[10]!==l?(I=b=>l.includes(b.id),e[10]=l,e[11]=I):I=e[11];const R=v.filter(I);let g;e[12]!==a?(g=b=>{const j=a.toLowerCase();return b.user?.name?.toLowerCase().includes(j)||b.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=g):g=e[13];const O=R.filter(g);N="flex flex-col h-full",o="flex-1 overflow-auto",m=R.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."})]})}):O.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:O.map(b=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:b.user?.image??void 0,fallback:lt(b.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:b.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.user?.email})]}),x?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(_e,{children:s.jsx("p",{children:f})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(j=>j!==b.id)),children:s.jsx(Be,{size:16})})]},b.id))}),e[0]=p?.data?.members,e[1]=a,e[2]=l,e[3]=n,e[4]=x,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let _;e[14]!==o||e[15]!==m?(_=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=_):_=e[16];let E;e[17]!==l||e[18]!==n?(E=v=>n([...l,...v]),e[17]=l,e[18]=n,e[19]=E):E=e[19];let S;e[20]!==h||e[21]!==l||e[22]!==c||e[23]!==E?(S=s.jsx(xs,{open:h,onOpenChange:c,selectedMemberIds:l,onAddMembers:E}),e[20]=h,e[21]=l,e[22]=c,e[23]=E,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==_||e[27]!==S?(C=s.jsxs("div",{className:N,children:[_,S]}),e[25]=N,e[26]=_,e[27]=S,e[28]=C):C=e[28],C}function gs(t){const e=H.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(F.Suspense,{fallback:l,children:s.jsx(ps,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Ts={owner:[],admin:[],user:[]};function Es(t,e,l,n){const i=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:Ts[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function _s(t,e,l){const n=t.permission||{},i=n.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,p]of Object.entries(n))if(!(a==="self"||a==="models"))if(a==="*")for(const o of l)h[o.id]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p;else{const o=l.find(m=>m.id===a);o&&(h[a]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p)}const c=n.models||[],x=c.length===0||c.includes("*:*"),f={};if(!x)for(const a of c){const p=a.indexOf(":");if(p===-1)continue;const o=a.slice(0,p),m=a.slice(p+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:x,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Is(t,e){const l={};t.allowAllStaticPermissions?l.self=["*"]:t.staticPermissions.length>0&&(l.self=t.staticPermissions);for(const[n,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===n)?.tools?.map(h=>h.name)??[];l[n]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)n.push(`${i}:${d}`);n.length>0&&(l.models=n)}return l}function bs(t,e,l){return t.kind==="builtin"?Es(t.role,e,void 0):t.kind==="custom"?_s(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=H.c(6),{readOnly:l,readOnlyMessage:n,onOpen:i}=t,r=n===void 0?"Owner membership cannot be changed":n;if(l){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Se,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let x;return e[1]!==r?(x=s.jsx(ge,{children:s.jsxs(Te,{children:[c,s.jsx(_e,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=x):x=e[2],x}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Se,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(le,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Ss(t){const e=H.c(14),{locator:l}=Ne(),n=Re(),i=yt();let r;e[0]!==l?(r=re.members(l),e[0]=l,e[1]=r):r=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,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:x}=Ce(h);if(x||!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 p;return e[10]!==i||e[11]!==a||e[12]!==t?(p=s.jsx(Cs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=p):p=e[13],p}function Cs({target:t,onBack:e,onSaved:l,members:n,connections:i}){const{locator:r}=Ne(),d=Re(),h=ze(),c=t.kind==="builtin",x=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,p]=F.useState(c?"org":"mcp"),o=dt({resolver:mt(Qt),defaultValues:bs(t,n,i)}),m=o.formState.isValid,N=o.formState.isDirty,_=Ye({mutationFn:async u=>{const M=Is(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=n.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;Ae(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),l(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}_.mutate(u)}),S=!x,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...x?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[I,R]=F.useState(""),[g,O]=F.useState(!1),b=u=>{p(u),R("")},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:S&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:_.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:E,disabled:_.isPending||!m||!N,children:_.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"?$e(t.role,!0):gt(o.watch("role.label")))}),x&&s.jsx(Fe,{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:()=>b(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(Oe,{value:I,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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"&&!x&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:I}),a==="org"&&s.jsx(Ht,{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:x,searchQuery:I}),a==="models"&&s.jsx(us,{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:x,searchQuery:I}),a==="members"&&s.jsx(gs,{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:I,addMemberDialogOpen:g,onAddMemberDialogOpenChange:O})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function Rs(t){const e=H.c(6),{area:l,children:n}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==l||e[1]!==n||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:l,children:n}),e[0]=l,e[1]=n,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const Os=[{role:"owner",label:"Owner"},{role:"admin",label:"Admin"},{role:"user",label:"User"}];function js(){const t=H.c(77),[e,l]=F.useState(""),[n,i]=F.useState(null),r=ht();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}=Ne(),x=Re(),f=ze(),{customRoles:a,refetch:p}=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 N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={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);N=V?{kind:"custom",role:V}:null}const _=N;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let S;t[7]!==x?(S=()=>x.organization.listMembers(),t[7]=x,t[8]=S):S=t[8];let C;t[9]!==E||t[10]!==S?(C={queryKey:E,queryFn:S},t[9]=E,t[10]=S,t[11]=C):C=t[11];const{data:v}=Ce(C);let I;t[12]!==v?.data?.members?(I=v?.data?.members??[],t[12]=v?.data?.members,t[13]=I):I=t[13];const R=I;let g;t[14]!==R?(g=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=g):g=t[15];const O=g;let b;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=Os.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const rt=a.map(ae);if(b=[...V,...rt],e){const ce=e.toLowerCase();b=b.filter(at=>at.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=b}else b=t[19];let j;t[24]!==x?(j=async P=>{const V=await x.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=x,t[25]=j):j=t[25];const u=Ye({mutationFn:j,onSuccess:(P,V)=>{Ae("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),p(),_?.kind==="custom"&&_.role.id===V&&m(void 0)},onError:Ds});let M,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Ps,cellClassName:"flex-1 min-w-0",sortable:!0},M={id:"type",header:"Type",render:Ls,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:ws,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Ms,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(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ys,children:s.jsx(bt,{size:16})})}),s.jsx(_t,{align:"end",onClick:vs,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(Nt,{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(_){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==p||t[36]!==m?(V=()=>{p(),m(void 0)},t[35]=p,t[36]=m,t[37]=V):V=t[37],s.jsx(Ss,{target:_,onBack:P,onSaved:V},As(_))}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"&&(l(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let $;t[42]!==m?($=()=>m("new"),t[42]=m,t[43]=$):$=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Se,{size:16}),t[44]=J):J=t[44];let X;t[45]!==$?(X=s.jsxs(le,{onClick:$,children:[J,"Create Role"]}),t[45]=$,t[46]=X):X=t[46];let ne;t[47]!==Y||t[48]!==X?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,X]}),t[47]=Y,t[48]=X,t[49]=ne):ne=t[49];let oe;t[50]!==e?(oe=e?s.jsx(De,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(De,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==b||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(St,{columns:B,data:b,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=b,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let T;t[57]!==ne||t[58]!==ie?(T=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,ne,ie]})})}),t[57]=ne,t[58]=ie,t[59]=T):T=t[59];const D=n!==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(qe,{children:"Delete Role"}),t[61]=q):q=t[61];const W=n?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[q,s.jsxs(Ze,{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(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==n?(de=s.jsxs(Xe,{children:[ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(Qe,{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(Ke,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let Ie;return t[74]!==T||t[75]!==ue?(Ie=s.jsxs(te,{children:[T,ue]}),t[74]=T,t[75]=ue,t[76]=Ie):Ie=t[76],Ie}function vs(t){return t.stopPropagation()}function ys(t){return t.stopPropagation()}function Ms(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ws(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,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ls(t){return t.kind==="builtin"?s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(xe,{variant:"outline",className:"text-xs",children:"Custom"})}function Ps(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",$e(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(Fe,{size:12,className:"text-muted-foreground shrink-0"})]})}function Ds(t,e){Ae("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 ks(){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 l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ft,{fallback:e,children:s.jsx(F.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(js,{})})}),t[1]=l):l=t[1],l}function hn(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Rs,{area:"roles",children:s.jsx(ks,{})}),t[0]=e):e=t[0],e}export{hn as default};
|
|
1
|
+
import{r as F,C as Ne,K as re,b4 as ct,m as Ce,j as s,l as K,i as fe,B as le,c as H,H as we,ad as be,I as se,af as Le,ag as Pe,n as ze,M as dt,J as mt,d as Ye,t as he,p as Ae,w as Fe,x as ut,E as ft,b as ht,u as xt}from"./index-BZRnn28t.js";import{u as pt}from"./use-organization-roles-CHkQ1Wa0.js";import{u as Re}from"./use-org-auth-client-C2iy2Xil.js";import{g as $e,a as gt}from"./role-color-Dn2tXDDF.js";import{B as xe}from"./badge-DNd7ajkN.js";import{f as Ke,a as Qe,b as He,c as qe,d as Ze,A as Je,e as Xe,g as We}from"./alert-dialog-BmRsNwN9.js";import{D as Tt,a as Et,c as _t,d as It}from"./dropdown-menu-C1VVmRJP.js";import{i as bt}from"./DotsVertical-B0JjGCi3.js";import{s as Se}from"./Plus-Ci7K4Ct_.js";import{s as Nt}from"./Trash01-D4uxHMnz.js";import{C as St}from"./collection-table-wrapper-DDxYCHhc.js";import{P as te}from"./index-BMnoeLAK.js";import{E as De}from"./empty-state-CwKWqf4t.js";import{S as Oe}from"./search-input-6ZHO1XcX.js";import{P as et,D as tt}from"./ai-providers-logos-DD3qZ33J.js";import{I as je}from"./integration-icon-CGJHKREq.js";import{u as Ct}from"./use-infinite-scroll-TDMfqV2g.js";import{C as ve}from"./checkbox-TB3JO09j.js";import{b as At}from"./Settings02-CWJz4nAO.js";import{u as Rt}from"./useSuspenseInfiniteQuery-mfBchPKj.js";import{u as Ot,S as jt}from"./use-mcp-client-Dh6o9WX9.js";import{C as vt}from"./collection-search-CSoSzgWh.js";import{u as st}from"./use-members-Bp2qK5jv.js";import{g as lt}from"./get-initials-D-f_fDFw.js";import{u as yt}from"./use-connection-RTnczTQK.js";import{u as Mt,c as wt}from"./use-ai-providers-DBQVAoIe.js";import{A as nt}from"./avatar-BazXLkz7.js";import{S as pe}from"./switch-nIBx4J9q.js";import{c as ge,b as Te,T as Ee,a as _e}from"./tooltip-CSoIf1Gs.js";import{S as ke,a as Ge,b as Ue}from"./settings-section-B87HV-a9.js";import{t as Lt}from"./ChevronDown-r-_rh5EY.js";import{i as Pt}from"./ChevronRight-u7xgpYrW.js";import{i as Be}from"./X-FfTODUnY.js";import{a as Dt}from"./use-capability-BXzerJwY.js";import{A as kt}from"./access-gate-kTO9SnvL.js";import"./ChevronUp-Bw0ymM9W.js";import"./table-BcHiNdGb.js";import"./ArrowUp-DFJMdP7L.js";import"./sidebar-D4fUdPe4.js";import"./LayoutLeft-4JMUy8vk.js";import"./use-mobile-B1WZXmvP.js";import"./SearchMd-CPkaKF5i.js";import"./Tool02-DrpXqZ3Z.js";import"./agent-icon-CB_-JSjj.js";import"./AlertCircle-C5oYI4HJ.js";import"./Tool01-xoOv4_7Y.js";import"./XCircle-eSQqLKYa.js";import"./ArrowUpRight-2vxY4Qdy.js";import"./TrendUp01-DJSEsaa4.js";import"./ZapSquare-DhJf-bn6.js";import"./ZoomOut-D4ZRPuxd.js";import"./Users03-C11myK4v.js";import"./CheckCircle-BpW-GNB-.js";import"./Stars02-Dgtkk5Y-.js";import"./Copy01-hSZZYKG1.js";import"./Globe01-C61HP1tI.js";import"./Eye-BaRLBEn3.js";import"./FilterLines-C3sUXVMn.js";import"./Star01-BE9ERhe_.js";import"./Globe04-B8-Xh0JM.js";import"./SwitchHorizontal01-5-1OAjem.js";import"./HardDrive-CxF9Spzl.js";import"./Image01-pHDGsVL2.js";import"./Key01-CbbQm-Sw.js";import"./LinkExternal01-C1NU5pfm.js";import"./Monitor01-BxTuXOOp.js";import"./Sun-C89FtXYW.js";import"./Package-BkECyMbs.js";import"./Palette-Sm9M4nVN.js";import"./Play-DayjM7Kd.js";import"./SearchLg-CtM9p2dR.js";import"./Shield01-39s6HRtv.js";import"./Stars01-DBWFZ5hV.js";import"./Upload01-C0m7KK_e.js";import"./User01-CL8Lqoqa.js";import"./Users01-C8GYGUG1.js";import"./XClose-B3-TWCDz.js";import"./Zap-BoFXRgmU.js";import"./auth-B54kii7x.js";import"./use-collections-DIkw9r9e.js";import"./studio-tools-golej29y.js";import"./card-D8J7Ri-1.js";import"./capability-load-error-CVIIPd0O.js";const ye="basic-usage",Me=[{id:ye,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","TASK_BOARD_ITEM_PRS_GET"]},{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}];[...Me.find(t=>t.id===ye)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Bt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function Vt(t,e,l){if(l){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const n=new Set(e);for(const i of t.tools)n.delete(i);return Array.from(n)}function zt(t){const e=H.c(21),{connection:l,isSelected:n,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,x=n?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==x?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",x),e[0]=x,e[1]=f):f=e[1];let a;e[2]!==l.icon||e[3]!==l.title?(a=s.jsx(je,{icon:l.icon,name:l.title,size:"xs"}),e[2]=l.icon,e[3]=l.title,e[4]=a):a=e[4];let p;e[5]!==l.title?(p=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),e[5]=l.title,e[6]=p):p=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==p?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,p]}),e[7]=h,e[8]=a,e[9]=p,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==l.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(ve,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=l.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function Ft(t){const e=H.c(18),{connectionId:l,tool:n,isSelected:i,onToggle:r}=t,d=`tool-${l}-${n.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 x;e[2]!==c||e[3]!==n.name?(x=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:n.name})}),e[2]=c,e[3]=n.name,e[4]=x):x=e[4];let f;e[5]!==n.description?(f=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:n.description}),e[5]=n.description,e[6]=f):f=e[6];let a;e[7]!==x||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[x,f]}),e[7]=x,e[8]=f,e[9]=a):a=e[9];const p=`tool-${l}-${n.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==p?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ve,{id:p,checked:i,onCheckedChange:r,onClick:$t})}),e[10]=i,e[11]=r,e[12]=p,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 $t(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[i,r]=F.useState(""),d=n!==void 0?n:i,h=F.useDeferredValue(d),[c,x]=F.useState("all"),[f,a]=F.useState(!1),p=F.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,_=h.trim(),E=_?{operator:"or",conditions:[{field:["title"],operator:"contains",value:_},{field:["description"],operator:"contains",value:_}]}:void 0,S=!!l,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:I,fetchNextPage:R,hasNextPage:g,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:T=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:T,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,D)=>{if(T?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),b=I?.pages.flatMap(T=>T?.items??[])??[],j=Ct(R,g??!1,O),u=l?b.filter(T=>T.connection_type!=="VIRTUAL"?!0:ct(T.connection_url)!==l):b,M=p.current,A=[...M.values()].map(T=>u.find(D=>D.id===T)).filter(T=>T!==void 0),k=u.filter(T=>!M.has(T.id)),G=[...A,...k],U=T=>{const D=t[T];return D!==void 0&&D.length>0},B=G.filter(T=>{if(c==="all")return!0;const D=U(T.id);return c==="selected"?D:c==="unselected"?!D:!0}),[w,z]=F.useState(G[0]?.id??null),y=w?G.find(T=>T.id===w)??null:null,{data:L,isFetching:Y}=Ce({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}),$=L?.tools??[],J=(T,D)=>t[T]?.includes(D)??!1,X=(T,D)=>{const Q=t[T]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[T]:W[T]=Z}else W[T]=[...Q,D];e(W)},ne=T=>{const D=T===w?$:[];if(!D.length)return;const Q=t[T]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[T]:(Z[T]=q,z(T)),e(Z)},oe=T=>{z(T),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:[n===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:()=>x("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:()=>x("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:()=>x("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(T=>{const D=w===T.id,Q=D?$.length:0,q=t[T.id]?.length??0;return s.jsx(zt,{connection:{...T,tools:D?$:T.tools},isSelected:D,hasToolsEnabled:U(T.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(T.id),onToggle:()=>ne(T.id)},T.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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(le,{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(je,{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"})}):$.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:$.map(T=>s.jsx(Ft,{connectionId:y.id,tool:T,isSelected:J(y.id,T.name),onToggle:()=>X(y.id,T.name)},T.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 Qt=we({role:we({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Pe(),staticPermissions:be(se()),toolSet:Le(se(),be(se())),allowAllModels:Pe(),modelSet:Le(se(),be(se())),memberIds:be(se())});function Ve(t,e,l){const n=s.jsx(pe,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Ht(t){const e=H.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let x;e[0]!==h?(x=h.trim().toLowerCase(),e[0]=h,e[1]=x):x=e[1];const f=F.useDeferredValue(x);let a;if(e[2]!==l||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==n){const p=Ut(),o=(v,I)=>{if(!c){if(l&&I){const R=p.flatMap(Jt).flatMap(Zt);i(!1),r(R.filter(g=>!v.tools.includes(g)));return}l||r(Vt(v,n,!I))}};let m;e[10]!==f?(m=v=>{const{section:I,capabilities:R}=v;return{section:I,capabilities:R.filter(g=>!f||g.label.toLowerCase().includes(f)||g.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=p.map(m).filter(qt);let _;e[12]!==l||e[13]!==i||e[14]!==r?(_=()=>{i(!l),r([])},e[12]=l,e[13]=i,e[14]=r,e[15]=_):_=e[15];let E;e[16]!==l||e[17]!==c||e[18]!==_?(E=Ve(l,c,_),e[16]=l,e[17]=c,e[18]=_,e[19]=E):E=e[19];let S;e[20]!==l||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!l),r([])},e[20]=l,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==E||e[26]!==S?(C=s.jsx(ke,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:E,onClick:S})})}),e[25]=E,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:I,capabilities:R}=v;return s.jsx(ke,{title:I,children:s.jsx(Ge,{children:R.map(g=>{const O=Bt(g,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[g.label,g.dangerous&&s.jsx(ut,{size:12,className:"text-warning shrink-0"})]}),description:g.description,action:Ve(O,c,()=>o(g,O)),onClick:c?void 0:()=>o(g,O)},g.id)})})},I)})]})}),e[2]=l,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=n,e[9]=a}else a=e[9];return a}function qt(t){return t.capabilities.length>0}function Zt(t){return t.tools}function Jt(t){return t.capabilities}const ot={anthropic:"Anthropic",openrouter:"OpenRouter"},Xt={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 Wt(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function es(t){return Xt[t]??ot[t]??t}function ts(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const it=30;function ss(t){const e=H.c(44),{connectionId:l,subProviderId:n,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:x,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:p,readOnly:o,defaultExpanded:m}=t,[N,_]=F.useState(m),E=m||N,S=_,[C,v]=F.useState(it);let I;e[0]!==f||e[1]!==x||e[2]!==c?(I=j=>x||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=x,e[2]=c,e[3]=I):I=e[3];const R=I;let g;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],g=d.filter(j),e[4]=R,e[5]=d,e[6]=g}else g=e[6];const O=g.length;let b;if(e[9]!==h||e[10]!==x||e[11]!==l||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||e[16]!==d||e[17]!==p||e[18]!==a||e[19]!==o||e[20]!==n||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=()=>S(is),e[24]=M):M=e[24];const A=r??et[n]??tt;let k;e[25]!==i||e[26]!==A?(k=s.jsx(je,{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]!==O||e[34]!==d.length?(B=s.jsxs(xe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let w;e[36]!==E?(w=E?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,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],b=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=R(L.id),$=()=>{if(!o){if(x){p(l,h,L.id);return}a(l,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:$,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:os,children:o?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:Y,disabled:!0,onCheckedChange:ns})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:Y,onCheckedChange:$})})]},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(ls),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=x,e[11]=l,e[12]=O,e[13]=E,e[14]=r,e[15]=R,e[16]=d,e[17]=p,e[18]=a,e[19]=o,e[20]=n,e[21]=i,e[22]=C,e[23]=b}else b=e[23];return b}function ls(t){return t+it}function ns(){}function os(t){return t.stopPropagation()}function is(t){return!t}function rs(t){const e=H.c(33),{connection:l,selectedModels:n,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:x}=t,f=wt(l.id);let a,p,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==x||e[9]!==c||e[10]!==n){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==l.label?(S=A=>({...A,id:A.modelId,provider:l.label}),e[16]=l.label,e[17]=S):S=e[17];const C=f.filter(ms).map(S),v=c.trim().toLowerCase(),I=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(I.length===0){N=null;break e}const R=new Map;for(const A of I){const k=Wt(A.id,l.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ts(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const g=Array.from(R.entries()).map(ds).sort(cs),O=g.length===1||v.length>0;o="flex flex-col gap-3";const b=et[l.providerId]??tt;let j;e[18]!==l.providerId||e[19]!==b?(j=s.jsx("img",{src:b,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=b,e[20]=j):j=e[20];const u=ot[l.providerId]??l.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",p=g.map(A=>s.jsx(ss,{connectionId:l.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(as),selectedModels:n,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:x,defaultExpanded:O},A.id))}e[0]=h,e[1]=i,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=x,e[9]=c,e[10]=n,e[11]=a,e[12]=p,e[13]=o,e[14]=m,e[15]=N}else a=e[11],p=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let _;e[26]!==a||e[27]!==p?(_=s.jsx("div",{className:a,children:p}),e[26]=a,e[27]=p,e[28]=_):_=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==_?(E=s.jsxs("div",{className:o,children:[m,_]}),e[29]=o,e[30]=m,e[31]=_,e[32]=E):E=e[32],E}function as(t){return t.id}function cs(t,e){return t.name.localeCompare(e.name)}function ds(t){const[e,l]=t;return{id:e,name:es(e),logo:l.logo,models:l.models}}function ms(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function us(t){const e=H.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,x=F.useDeferredValue(h),f=Mt();let a;e[0]!==n||e[1]!==r?(a=(g,O)=>{const b=n[g]??[],j={...n};if(b.includes(O)){const u=b.filter(M=>M!==O);u.length===0?delete j[g]:j[g]=u}else j[g]=[...b,O];r(j)},e[0]=n,e[1]=r,e[2]=a):a=e[2];const p=a;let o;e[3]!==n||e[4]!==i||e[5]!==r?(o=(g,O,b)=>{i(!1),r({...n,[g]:O.filter(j=>j!==b)})},e[3]=n,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let _;e[7]!==N?(_=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=_):_=e[8];let E;e[9]!==l||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const g=!l;i(g),g&&r({})},e[9]=l,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==l||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:hs,children:c?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:l,disabled:!0,onCheckedChange:fs})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:l,onCheckedChange:g=>{i(g),g&&r({})}})}),e[15]=l,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==_||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:_,onClick:E,children:[S,C]}),e[20]=_,e[21]=E,e[22]=C,e[23]=v):v=e[23];let I;e[24]!==f||e[25]!==l||e[26]!==x||e[27]!==m||e[28]!==n||e[29]!==c||e[30]!==p?(I=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(g=>s.jsx(F.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(rs,{connection:g,selectedModels:n[g.id]??[],allowAllModels:l,onToggleModel:p,onExitAllowAll:m,allConnectionModelsSelected:(n[g.id]??[]).includes("*"),searchQuery:x,readOnly:c})},g.id)),e[24]=f,e[25]=l,e[26]=x,e[27]=m,e[28]=n,e[29]=c,e[30]=p,e[31]=I):I=e[31];let R;return e[32]!==I||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,I]}),e[32]=I,e[33]=v,e[34]=R):R=e[34],R}function fs(){}function hs(t){return t.stopPropagation()}function xs(t){const e=H.c(52),{open:l,onOpenChange:n,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=F.useState(""),c=F.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[f,a]=F.useState(x),{data:p}=st();let o,m,N,_,E,S,C,v,I,R,g;if(e[1]!==p?.data?.members||e[2]!==c||e[3]!==r||e[4]!==n||e[5]!==l||e[6]!==f||e[7]!==d||e[8]!==i){const U=p?.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]!==n||e[24]!==f?(z=()=>{r(f),a([]),n(!1)},e[22]=r,e[23]=n,e[24]=f,e[25]=z):z=e[25],N=z,m=Ke,R=l,g=n,o=Qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(qe,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=I):I=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],_="flex-1 overflow-auto",E=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.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(ve,{checked:$||Y,onCheckedChange:()=>{!L||Y||a(J=>J.includes(y.id)?J.filter(X=>X!==y.id):[...J,y.id])},disabled:!L||Y}),s.jsx(nt,{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(xe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(xe,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=p?.data?.members,e[2]=c,e[3]=r,e[4]=n,e[5]=l,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=_,e[13]=E,e[14]=S,e[15]=C,e[16]=v,e[17]=I,e[18]=R,e[19]=g}else o=e[9],m=e[10],N=e[11],_=e[12],E=e[13],S=e[14],C=e[15],v=e[16],I=e[17],R=e[18],g=e[19];let O;e[29]!==_||e[30]!==E?(O=s.jsx("div",{className:_,children:E}),e[29]=_,e[30]=E,e[31]=O):O=e[31];let b;e[32]!==O||e[33]!==S||e[34]!==C?(b=s.jsxs("div",{className:S,children:[C,O]}),e[32]=O,e[33]=S,e[34]=C,e[35]=b):b=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,M=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==M?(A=s.jsxs(Xe,{className:"px-6 pb-6",children:[j,s.jsxs(We,{onClick:N,disabled:u,children:["Add ",M]})]}),e[37]=N,e[38]=u,e[39]=M,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==b||e[43]!==A||e[44]!==v||e[45]!==I?(k=s.jsxs(o,{className:v,children:[I,b,A]}),e[41]=o,e[42]=b,e[43]=A,e[44]=v,e[45]=I,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==g?(G=s.jsx(m,{open:R,onOpenChange:g,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=g,e[51]=G):G=e[51],G}function ps(t){const e=H.c(29),{memberIds:l,onMemberIdsChange:n,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,x=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=F.useDeferredValue(d),{data:p}=st();let o,m,N;if(e[0]!==p?.data?.members||e[1]!==a||e[2]!==l||e[3]!==n||e[4]!==x||e[5]!==f||e[6]!==d){const v=p?.data?.members??[];let I;e[10]!==l?(I=b=>l.includes(b.id),e[10]=l,e[11]=I):I=e[11];const R=v.filter(I);let g;e[12]!==a?(g=b=>{const j=a.toLowerCase();return b.user?.name?.toLowerCase().includes(j)||b.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=g):g=e[13];const O=R.filter(g);N="flex flex-col h-full",o="flex-1 overflow-auto",m=R.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."})]})}):O.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:O.map(b=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:b.user?.image??void 0,fallback:lt(b.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:b.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.user?.email})]}),x?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(_e,{children:s.jsx("p",{children:f})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(j=>j!==b.id)),children:s.jsx(Be,{size:16})})]},b.id))}),e[0]=p?.data?.members,e[1]=a,e[2]=l,e[3]=n,e[4]=x,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let _;e[14]!==o||e[15]!==m?(_=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=_):_=e[16];let E;e[17]!==l||e[18]!==n?(E=v=>n([...l,...v]),e[17]=l,e[18]=n,e[19]=E):E=e[19];let S;e[20]!==h||e[21]!==l||e[22]!==c||e[23]!==E?(S=s.jsx(xs,{open:h,onOpenChange:c,selectedMemberIds:l,onAddMembers:E}),e[20]=h,e[21]=l,e[22]=c,e[23]=E,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==_||e[27]!==S?(C=s.jsxs("div",{className:N,children:[_,S]}),e[25]=N,e[26]=_,e[27]=S,e[28]=C):C=e[28],C}function gs(t){const e=H.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(F.Suspense,{fallback:l,children:s.jsx(ps,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Ts={owner:[],admin:[],user:[]};function Es(t,e,l,n){const i=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:Ts[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function _s(t,e,l){const n=t.permission||{},i=n.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,p]of Object.entries(n))if(!(a==="self"||a==="models"))if(a==="*")for(const o of l)h[o.id]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p;else{const o=l.find(m=>m.id===a);o&&(h[a]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p)}const c=n.models||[],x=c.length===0||c.includes("*:*"),f={};if(!x)for(const a of c){const p=a.indexOf(":");if(p===-1)continue;const o=a.slice(0,p),m=a.slice(p+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:x,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Is(t,e){const l={};t.allowAllStaticPermissions?l.self=["*"]:t.staticPermissions.length>0&&(l.self=t.staticPermissions);for(const[n,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===n)?.tools?.map(h=>h.name)??[];l[n]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)n.push(`${i}:${d}`);n.length>0&&(l.models=n)}return l}function bs(t,e,l){return t.kind==="builtin"?Es(t.role,e,void 0):t.kind==="custom"?_s(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=H.c(6),{readOnly:l,readOnlyMessage:n,onOpen:i}=t,r=n===void 0?"Owner membership cannot be changed":n;if(l){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Se,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let x;return e[1]!==r?(x=s.jsx(ge,{children:s.jsxs(Te,{children:[c,s.jsx(_e,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=x):x=e[2],x}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Se,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(le,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Ss(t){const e=H.c(14),{locator:l}=Ne(),n=Re(),i=yt();let r;e[0]!==l?(r=re.members(l),e[0]=l,e[1]=r):r=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,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:x}=Ce(h);if(x||!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 p;return e[10]!==i||e[11]!==a||e[12]!==t?(p=s.jsx(Cs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=p):p=e[13],p}function Cs({target:t,onBack:e,onSaved:l,members:n,connections:i}){const{locator:r}=Ne(),d=Re(),h=ze(),c=t.kind==="builtin",x=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,p]=F.useState(c?"org":"mcp"),o=dt({resolver:mt(Qt),defaultValues:bs(t,n,i)}),m=o.formState.isValid,N=o.formState.isDirty,_=Ye({mutationFn:async u=>{const M=Is(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=n.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;Ae(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),l(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}_.mutate(u)}),S=!x,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...x?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[I,R]=F.useState(""),[g,O]=F.useState(!1),b=u=>{p(u),R("")},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:S&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:_.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:E,disabled:_.isPending||!m||!N,children:_.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"?$e(t.role,!0):gt(o.watch("role.label")))}),x&&s.jsx(Fe,{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:()=>b(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(Oe,{value:I,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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"&&!x&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:I}),a==="org"&&s.jsx(Ht,{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:x,searchQuery:I}),a==="models"&&s.jsx(us,{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:x,searchQuery:I}),a==="members"&&s.jsx(gs,{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:I,addMemberDialogOpen:g,onAddMemberDialogOpenChange:O})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function Rs(t){const e=H.c(6),{area:l,children:n}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==l||e[1]!==n||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:l,children:n}),e[0]=l,e[1]=n,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const Os=[{role:"owner",label:"Owner"},{role:"admin",label:"Admin"},{role:"user",label:"User"}];function js(){const t=H.c(77),[e,l]=F.useState(""),[n,i]=F.useState(null),r=ht();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}=Ne(),x=Re(),f=ze(),{customRoles:a,refetch:p}=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 N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={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);N=V?{kind:"custom",role:V}:null}const _=N;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let S;t[7]!==x?(S=()=>x.organization.listMembers(),t[7]=x,t[8]=S):S=t[8];let C;t[9]!==E||t[10]!==S?(C={queryKey:E,queryFn:S},t[9]=E,t[10]=S,t[11]=C):C=t[11];const{data:v}=Ce(C);let I;t[12]!==v?.data?.members?(I=v?.data?.members??[],t[12]=v?.data?.members,t[13]=I):I=t[13];const R=I;let g;t[14]!==R?(g=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=g):g=t[15];const O=g;let b;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=Os.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const rt=a.map(ae);if(b=[...V,...rt],e){const ce=e.toLowerCase();b=b.filter(at=>at.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=b}else b=t[19];let j;t[24]!==x?(j=async P=>{const V=await x.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=x,t[25]=j):j=t[25];const u=Ye({mutationFn:j,onSuccess:(P,V)=>{Ae("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),p(),_?.kind==="custom"&&_.role.id===V&&m(void 0)},onError:Ds});let M,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Ps,cellClassName:"flex-1 min-w-0",sortable:!0},M={id:"type",header:"Type",render:Ls,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:ws,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Ms,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(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ys,children:s.jsx(bt,{size:16})})}),s.jsx(_t,{align:"end",onClick:vs,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(Nt,{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(_){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==p||t[36]!==m?(V=()=>{p(),m(void 0)},t[35]=p,t[36]=m,t[37]=V):V=t[37],s.jsx(Ss,{target:_,onBack:P,onSaved:V},As(_))}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"&&(l(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let $;t[42]!==m?($=()=>m("new"),t[42]=m,t[43]=$):$=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Se,{size:16}),t[44]=J):J=t[44];let X;t[45]!==$?(X=s.jsxs(le,{onClick:$,children:[J,"Create Role"]}),t[45]=$,t[46]=X):X=t[46];let ne;t[47]!==Y||t[48]!==X?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,X]}),t[47]=Y,t[48]=X,t[49]=ne):ne=t[49];let oe;t[50]!==e?(oe=e?s.jsx(De,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(De,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==b||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(St,{columns:B,data:b,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=b,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let T;t[57]!==ne||t[58]!==ie?(T=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,ne,ie]})})}),t[57]=ne,t[58]=ie,t[59]=T):T=t[59];const D=n!==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(qe,{children:"Delete Role"}),t[61]=q):q=t[61];const W=n?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[q,s.jsxs(Ze,{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(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==n?(de=s.jsxs(Xe,{children:[ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(Qe,{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(Ke,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let Ie;return t[74]!==T||t[75]!==ue?(Ie=s.jsxs(te,{children:[T,ue]}),t[74]=T,t[75]=ue,t[76]=Ie):Ie=t[76],Ie}function vs(t){return t.stopPropagation()}function ys(t){return t.stopPropagation()}function Ms(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ws(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,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ls(t){return t.kind==="builtin"?s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(xe,{variant:"outline",className:"text-xs",children:"Custom"})}function Ps(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",$e(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(Fe,{size:12,className:"text-muted-foreground shrink-0"})]})}function Ds(t,e){Ae("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 ks(){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 l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ft,{fallback:e,children:s.jsx(F.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(js,{})})}),t[1]=l):l=t[1],l}function hn(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Rs,{area:"roles",children:s.jsx(ks,{})}),t[0]=e):e=t[0],e}export{hn 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-BZRnn28t.js";import{i as N}from"./SearchMd-CPkaKF5i.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,E as P,r as j,w,B as S,t as y}from"./index-
|
|
1
|
+
import{c as p,j as t,E as P,r as j,w,B as S,t as y}from"./index-BZRnn28t.js";import{i as k}from"./AlertCircle-C5oYI4HJ.js";import{s as z}from"./Plus-Ci7K4Ct_.js";import{s as E}from"./User01-CL8Lqoqa.js";import{t as F}from"./Users01-C8GYGUG1.js";import{e as $,d as I,D as O,a as A,h as R,c as T}from"./dialog-DWi0JlTh.js";import{I as N}from"./input-BsGAL_rg.js";import{L as g}from"./label-DbY0_RCi.js";import{S as B,a as V,b as L,c as q,d as C}from"./select-lfM4Lwzr.js";import{S as H}from"./skeleton-TuoSjBy9.js";import{T as K}from"./textarea-DP8OZ3qJ.js";import{P as b}from"./index-BMnoeLAK.js";import{c as W}from"./settings-section-B87HV-a9.js";import{u as Y,a as G}from"./use-secrets-C3iR1Q_U.js";import{R as J}from"./require-capability-BlRAXRCN.js";import"./X-FfTODUnY.js";import"./tooltip-CSoIf1Gs.js";import"./ChevronUp-Bw0ymM9W.js";import"./ChevronDown-r-_rh5EY.js";import"./sidebar-D4fUdPe4.js";import"./LayoutLeft-4JMUy8vk.js";import"./use-mobile-B1WZXmvP.js";import"./card-D8J7Ri-1.js";import"./ArrowUpRight-2vxY4Qdy.js";import"./studio-tools-golej29y.js";import"./use-capability-BXzerJwY.js";import"./access-gate-kTO9SnvL.js";import"./capability-load-error-CVIIPd0O.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"?E:F,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 D(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(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{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(P,{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 $e(){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{$e as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as ze,r as N,l as Ee,j as n,B as Ge,i as Fn,n as vs,t as G,K as Ss}from"./index-BZRnn28t.js";import{a0 as xs,a1 as bs,a2 as ys,F as In,H as zt,K as zn,P as Hn,i as Un,a3 as _s,U as Wn,V as Gn,a4 as js,G as ks,a5 as ws,J as Yn,L as Rt,O as qn,Q as Jn,M as Qn,Z as Zn,a6 as Xn,a7 as Rs,a8 as Nt,a9 as Ns,S as ea,aa as tt,ab as Ds,ac as Vs,ad as Cs,ae as Ps,e as Ts,k as As,af as Ms,ag as Es,ah as Ks,ai as $s,r as Ot,aj as Bt,ak as Os,al as ut,am as jt,an as Bs,ao as Ls,ap as Je,aq as Dn,ar as Fs,as as kt,at as Lt,au as Is,av as sn,aw as zs,ax as xt,ay as Hs,az as Us,aA as Ws,aB as Gs,aC as Ys,aD as dt,aE as qs,aF as Js,aG as Qs,m as Zs,aH as Vn,aI as wt,aJ as Xs,aK as er,aL as tr,aM as nr,aN as rn,aO as Cn,aP as Pn,aQ as bt,aR as Ft,aS as Tn,aT as ar,aU as on,aV as sr,aW as rr,aX as or,aY as An,aZ as ir}from"./index-DYsXJQBT.js";import{t as lr}from"./ChevronDown-r-_rh5EY.js";import{X as cn,Q as ta,C as cr,w as na,Y as ur,Z as dr}from"./agent-icon-CB_-JSjj.js";import{i as aa}from"./ChevronRight-u7xgpYrW.js";import{n as mr}from"./ChevronUp-Bw0ymM9W.js";import{i as fr}from"./Globe01-C61HP1tI.js";import{m as It}from"./automation-runs-D_QDuFCw.js";import{b as mt,T as ft,a as pt}from"./tooltip-CSoIf1Gs.js";import{a as pr,D as hr,h as gr,c as vr,d as Sr,e as xr}from"./dialog-DWi0JlTh.js";import{I as br}from"./input-BsGAL_rg.js";import{a as sa}from"./Copy01-hSZZYKG1.js";import{b as yr}from"./ZoomOut-D4ZRPuxd.js";import{i as _r}from"./Settings02-CWJz4nAO.js";import{s as jr}from"./Eye-BaRLBEn3.js";import{s as ra}from"./TrendUp01-DJSEsaa4.js";import{s as un}from"./Plus-Ci7K4Ct_.js";import{s as oa}from"./Trash01-D4uxHMnz.js";import{i as kr}from"./Zap-BoFXRgmU.js";import{d as it,a as ia,D as la,c as ca,j as wr}from"./dropdown-menu-C1VVmRJP.js";import{S as Rr,r as Mn,a as Nr,d as Dr,b as Vr,i as Cr,f as Pr,P as Tr,c as Ar}from"./page-seo-form-BSHsNdod.js";import{b as Mr}from"./Tool01-xoOv4_7Y.js";import{A as Er}from"./add-section-modal-CEyQogiS.js";import"./ArrowUp-DFJMdP7L.js";import"./chat-context-BUbzUhOw.js";import"./autosend-CkIV8p4Q.js";import"./hooks-BPppL9UW.js";import"./use-mcp-client-Dh6o9WX9.js";import"./auth-B54kii7x.js";import"./decopilot-sse-pool-3tG4lnzy.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-golej29y.js";import"./use-virtual-mcp-T5LZEHOm.js";import"./use-collections-DIkw9r9e.js";import"./use-ai-providers-DBQVAoIe.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-BEpCD1C0.js";import"./use-organization-settings-C0wRGLWg.js";import"./drawer-BLFVbiL_.js";import"./collection-search-CSoSzgWh.js";import"./SearchMd-CPkaKF5i.js";import"./use-mobile-B1WZXmvP.js";import"./AreaChart-h32jSrWe.js";import"./index-AQIh7ZmC.js";import"./calendar-E0PNlIgV.js";import"./X-FfTODUnY.js";import"./shell-layout-BD6vqj7S.js";import"./avatar-BazXLkz7.js";import"./User01-CL8Lqoqa.js";import"./Users03-C11myK4v.js";import"./SearchLg-CtM9p2dR.js";import"./Stars02-Dgtkk5Y-.js";import"./XClose-B3-TWCDz.js";import"./CheckCircle-BpW-GNB-.js";import"./FilterLines-C3sUXVMn.js";import"./required-auth-layout-BVAnajeN.js";import"./use-org-sso-DHHmUCXe.js";import"./index-Db_vIyP1.js";import"./get-initials-D-f_fDFw.js";import"./SwitchHorizontal01-5-1OAjem.js";import"./use-registry-app-Y2QR0Yv5.js";import"./use-mcp-tools-CKIdVct5.js";import"./use-connection-RTnczTQK.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-CJok6jUd.js";import"./mcp-oauth-D700t2XZ.js";import"./extract-connection-data-DW5nl8RN.js";import"./use-members-Bp2qK5jv.js";import"./use-org-auth-client-C2iy2Xil.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-C5oYI4HJ.js";import"./DotsVertical-B0JjGCi3.js";import"./popover-Cnsk2Qp7.js";import"./command-Bj2qn6yr.js";import"./index-BOo29nkh.js";import"./use-copy-CVTt9IJU.js";import"./LinkExternal01-C1NU5pfm.js";import"./ZapSquare-DhJf-bn6.js";import"./Star01-BE9ERhe_.js";import"./Image01-pHDGsVL2.js";import"./Upload01-C0m7KK_e.js";import"./form-Dh4tluSC.js";import"./label-DbY0_RCi.js";import"./select-lfM4Lwzr.js";import"./XCircle-eSQqLKYa.js";import"./tabs-6GAFTC_y.js";import"./Tool02-DrpXqZ3Z.js";import"./toggle-group-BSH8KQA-.js";import"./use-deco-credits-Bb7OVBAv.js";import"./connection-card-UBiS44sg.js";import"./use-registry-connections-Cg8olX4z.js";import"./useInfiniteQuery-5k36gfAQ.js";import"./use-infinite-scroll-TDMfqV2g.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-D8J7Ri-1.js";import"./integration-icon-CGJHKREq.js";import"./textarea-DP8OZ3qJ.js";import"./connection-form-helpers-DPhduFQi.js";import"./collection-tabs-CDruT76J.js";import"./badge-DNd7ajkN.js";import"./useSuspenseInfiniteQuery-mfBchPKj.js";import"./Monitor01-BxTuXOOp.js";import"./connect-desktop-dialog-B5qEVpzb.js";import"./select-model-CtXSPQFB.js";import"./checkbox-TB3JO09j.js";import"./skeleton-TuoSjBy9.js";import"./Key01-CbbQm-Sw.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B87HV-a9.js";import"./ArrowUpRight-2vxY4Qdy.js";import"./Stars01-DBWFZ5hV.js";import"./index-DU2vtCjc.js";import"./Palette-Sm9M4nVN.js";import"./alert-dialog-BmRsNwN9.js";import"./file-type-icon-JSO6qaid.js";import"./toolbar-B_Q1qPs6.js";import"./Package-BkECyMbs.js";import"./use-debounced-value-BuM9rzzK.js";import"./index-Bpp38t32.js";import"./LayoutLeft-4JMUy8vk.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-HNftVODV.js";import"./empty-state-CwKWqf4t.js";import"./use-capability-BXzerJwY.js";import"./toolbar-icon-button-BEczZJQm.js";import"./Play-DayjM7Kd.js";import"./use-debounced-autosave-CsDyPqsy.js";import"./index-BMnoeLAK.js";import"./sidebar-D4fUdPe4.js";import"./search-input-6ZHO1XcX.js";import"./use-mcp-auth-status-DkXX0hZv.js";import"./switch-nIBx4J9q.js";import"./github-repo-picker-DkcIZtn-.js";import"./use-navigate-to-agent-eAYZfmSG.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./Users01-C8GYGUG1.js";import"./use-secrets-C3iR1Q_U.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./companions-core-BH0fr5JT.js";import"./monaco-editor-BX8ARTuF.js";import"./use-file-configs-i87gxX6o.js";import"./use-automations-2-PZs3p0.js";import"./automation-list-row-Dh102Lw3.js";import"./Globe04-B8-Xh0JM.js";import"./HardDrive-CxF9Spzl.js";import"./Sun-C89FtXYW.js";import"./Shield01-39s6HRtv.js";import"./table-BcHiNdGb.js";import"./use-clock-tick-D1puefsG.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let u=typeof c.image=="string"?c.image:void 0;if(!u&&Array.isArray(c.allOf)){const g=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof g=="string"){const S=g.replace("#/definitions/",""),f=r[S];u=typeof f?.image=="string"?f.image:void 0}}if(u?.includes("{{{"))return u}function Or(m,e){if(!e)return;const r=xs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const u=bs(c,r.data);if(u)return ys(u)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="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 En(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ua(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return ua(m.slice(0,e));const r=Array.from({length:e-m.length},(c,u)=>({id:crypto.randomUUID(),index:m.length+u}));return[...m,...r]}function da(m){const e=ze.c(20),{section:r,raw:c,meta:u}=m,g=r.isSavedBlock===!0,S=r.isMultivariate===!0;let f;e[0]!==u||e[1]!==c?(f=c&&u?Or(c,u):void 0,e[0]=u,e[1]=c,e[2]=f):f=e[2];const v=f;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=h):h=e[3];let x;e[4]!==v?(x=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]=x):x=e[5];let D;e[6]!==S||e[7]!==g?(D=g?{color:ks}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=g,e[8]=D):D=e[8];let k;e[9]!==D?(k=n.jsx(cn,{className:"h-4 w-4 shrink-0",style:D}),e[9]=D,e[10]=k):k=e[10];const _=r.isHidden&&"line-through opacity-50";let j;e[11]!==_?(j=Ee("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=j):j=e[12];let o;e[13]!==r.label||e[14]!==j?(o=n.jsx("span",{className:j,children:r.label}),e[13]=r.label,e[14]=j,e[15]=o):o=e[15];let w;return e[16]!==x||e[17]!==k||e[18]!==o?(w=n.jsxs(n.Fragment,{children:[h,x,k,o]}),e[16]=x,e[17]=k,e[18]=o,e[19]=w):w=e[19],w}function ma(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"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(m){const e=ze.c(64),{section:r,raw:c,meta:u,sortableId:g,selected:S,onSelect:f,onDelete:v,onDuplicate:h,onMakeReusable:x,onToggleHidden:D,onToggleLazy:k,onAddVariant:_,onDetach:j}=m,o=c?Un(c.__resolveType??""):!1;let w;e[0]!==r?(w=_s(r),e[0]=r,e[1]=w):w=e[1];const i=w;let K;e[2]!==g?(K={id:g,animateLayoutChanges:Gr},e[2]=g,e[3]=K):K=e[3];const{attributes:E,listeners:M,setNodeRef:d,transform:P,isDragging:ae}=Wn(K);let T;e[4]!==P?(T=Gn.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=ae?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 F;e[9]!==r?(F=js(r),e[9]=r,e[10]=F):F=e[10];const te=F,oe="button",Te=0;let O;e[11]!==f?(O=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),f())},e[11]=f,e[12]=O):O=e[12];const ue=ae?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Ee("touch-none transition-colors",ue,ma(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==u||e[18]!==c||e[19]!==r?(je=n.jsx(da,{section:r,raw:c,meta:u}),e[17]=u,e[18]=c,e[19]=r,e[20]=je):je=e[20];const $=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ee("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),k()},onPointerDown:Wr,children:n.jsx(kr,{className:Ee("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==D||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ee("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),D()},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(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=D,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let Z;e[25]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(ia,{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(ta,{className:"h-3.5 w-3.5"})})}),e[25]=Z):Z=e[25];let De;e[26]!==h?(De=B=>{B.stopPropagation(),h()},e[26]=h,e[27]=De):De=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(sa,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let se;e[29]!==De?(se=n.jsxs(it,{onClick:De,children:[ve,"Duplicate"]}),e[29]=De,e[30]=se):se=e[30];let Y;e[31]!==i||e[32]!==_?(Y=i&&n.jsxs(it,{className:ws,onClick:B=>{B.stopPropagation(),_()},children:[n.jsx(ra,{className:"h-4 w-4"}),"Add variant"]}),e[31]=i,e[32]=_,e[33]=Y):Y=e[33];let q;e[34]!==te||e[35]!==x?(q=te&&n.jsxs(it,{className:Lr,onClick:B=>{B.stopPropagation(),x()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=x,e[36]=q):q=e[36];let ne;e[37]!==j||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:B=>{B.stopPropagation(),j()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Detach"]}),e[37]=j,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=B=>{B.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(oa,{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]!==se||e[47]!==Y||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(la,{children:[Z,n.jsxs(ca,{align:"end",className:"w-44",children:[se,Y,q,ne,Se]})]}),e[46]=se,e[47]=Y,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let ye;return e[52]!==E||e[53]!==M||e[54]!==f||e[55]!==d||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==$||e[60]!==Ae||e[61]!==de||e[62]!==O?(ye=n.jsxs("div",{ref:d,style:ce,...E,...M,role:oe,tabIndex:Te,onClick:f,onKeyDown:O,className:ie,children:[je,$,Ae,de]}),e[52]=E,e[53]=M,e[54]=f,e[55]=d,e[56]=ce,e[57]=ie,e[58]=je,e[59]=$,e[60]=Ae,e[61]=de,e[62]=O,e[63]=ye):ye=e[63],ye}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Wr(m){return m.stopPropagation()}function Gr(){return!1}function Yr(m){const e=ze.c(90),{listKey:r,rawSections:c,sections:u,meta:g,selectedIndex:S,onSelect:f,onReorder:v,onDelete:h,onDuplicate:x,onMakeReusable:D,onToggleHidden:k,onToggleLazy:_,onAddVariant:j,onDetach:o,onAddSection:w,canAddSection:i}=m,K=i===void 0?!0:i;let E;e[0]!==u.length?(E=()=>En(u.length),e[0]=u.length,e[1]=E):E=e[1];const[M,d]=N.useState(E),[P,ae]=N.useState(null),[T,pe]=N.useState(r),[V,ce]=N.useState(u.length),F=N.useRef(!1);T!==r?(pe(r),ce(u.length),d(En(u.length))):V!==u.length&&(ce(u.length),d(I=>Fr(I,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:Yn},e[3]=oe):oe=e[3];const Te=In(zt(Hn,te),zt(zn,oe));let O;e[4]!==M?(O=M.map(qr),e[4]=M,e[5]=O):O=e[5];const ue=O;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=I=>{ae(String(I.active.id))},e[6]=ie):ie=e[6];const je=ie;let $;e[7]!==ue||e[8]!==v?($=I=>{ae(null);const{active:re,over:Q}=I;if(!Q||re.id===Q.id)return;const Ie=ue.indexOf(String(re.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(d(Qe=>ua(Rt([...Qe],Ie,he))),F.current=!0,requestAnimationFrame(()=>{F.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=$):$=e[9];const Ae=$;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{ae(null)},e[10]=Z):Z=e[10];const De=Z;let ve,se,Y,q,ne,le,ke,Se,de,ye,B,X,we,Ke,$e;if(e[11]!==P||e[12]!==K||e[13]!==M||e[14]!==ue||e[15]!==Ae||e[16]!==g||e[17]!==w||e[18]!==j||e[19]!==h||e[20]!==o||e[21]!==x||e[22]!==D||e[23]!==f||e[24]!==k||e[25]!==_||e[26]!==c||e[27]!==u||e[28]!==S||e[29]!==Te){Ke=Symbol.for("react.early_return_sentinel");e:{const I=re=>{F.current||f(re)};if(e[45]!==P||e[46]!==K||e[47]!==M||e[48]!==w||e[49]!==c||e[50]!==u){const re=P?M.find(Q=>Q.id===P):null;if(q=re!=null?u[re.index]:null,Y=re!=null?c[re.index]:void 0,M.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=!K;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(un,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==w||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:w,children:[he,"Add section"]})]}),e[56]=w,e[57]=Ie,e[58]=Qe):Qe=e[58],Ke=Qe;break e}we=Ee(re&&"cursor-grabbing"),e[45]=P,e[46]=K,e[47]=M,e[48]=w,e[49]=c,e[50]=u,e[51]=Y,e[52]=q,e[53]=we}else Y=e[51],q=e[52],we=e[53];se=qn,Se=Te,de=Jn,ye=je,B=Ae,X=De,ve=Qn,le=ue,ke=Zn,$e="space-y-1",ne=M.map(re=>{const Q=u[re.index];return Q?n.jsx(Ir,{sortableId:re.id,section:Q,raw:c[re.index],meta:g,selected:S===re.index,onSelect:()=>I(re.index),onDelete:()=>h(re.index),onDuplicate:()=>x(re.index),onMakeReusable:()=>D(re.index),onToggleHidden:()=>k(re.index),onToggleLazy:()=>_(re.index),onAddVariant:()=>j(re.index),onDetach:()=>o(re.index)},re.id):null})}e[11]=P,e[12]=K,e[13]=M,e[14]=ue,e[15]=Ae,e[16]=g,e[17]=w,e[18]=j,e[19]=h,e[20]=o,e[21]=x,e[22]=D,e[23]=f,e[24]=k,e[25]=_,e[26]=c,e[27]=u,e[28]=S,e[29]=Te,e[30]=ve,e[31]=se,e[32]=Y,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=ye,e[40]=B,e[41]=X,e[42]=we,e[43]=Ke,e[44]=$e}else ve=e[30],se=e[31],Y=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],ye=e[39],B=e[40],X=e[41],we=e[42],Ke=e[43],$e=e[44];if(Ke!==Symbol.for("react.early_return_sentinel"))return Ke;let Le;e[59]!==ne||e[60]!==$e?(Le=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Le):Le=e[61];let Ce;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Ce=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Ce):Ce=e[66];let Oe;e[67]!==Y||e[68]!==q||e[69]!==g?(Oe=q?n.jsx("div",{className:Ee("cursor-grabbing shadow-lg ring-1 ring-border/60",ma(q,!1)),children:n.jsx(da,{section:q,raw:Y,meta:g})}):null,e[67]=Y,e[68]=q,e[69]=g,e[70]=Oe):Oe=e[70];let Fe;e[71]!==Oe?(Fe=n.jsx(Xn,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=Fe):Fe=e[72];let Me;e[73]!==se||e[74]!==Se||e[75]!==de||e[76]!==ye||e[77]!==B||e[78]!==X||e[79]!==Ce||e[80]!==Fe?(Me=n.jsxs(se,{sensors:Se,collisionDetection:de,onDragStart:ye,onDragEnd:B,onDragCancel:X,children:[Ce,Fe]}),e[73]=se,e[74]=Se,e[75]=de,e[76]=ye,e[77]=B,e[78]=X,e[79]=Ce,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!K;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==w||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:w,children:[Re,"Add section"]}),e[83]=w,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 qr(m){return m.id}function Kn(m){const e=ze.c(38),{open:r,initialName:c,autoLabel:u,isPending:g,onSubmit:S,onOpenChange:f}=m,v=g===void 0?!1:g,[h,x]=N.useState(c),[D,k]=N.useState(r);r!==D&&(k(r),r&&x(c));let _;e[0]!==v||e[1]!==f?(_=oe=>{!oe&&!v&&f(!1)},e[0]=v,e[1]=f,e[2]=_):_=e[2];const j=_;let o;e[3]!==v||e[4]!==h||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(h.trim())},e[3]=v,e[4]=h,e[5]=S,e[6]=o):o=e[6];const w=o;let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(pr,{children:"Rename variant"}),e[7]=i):i=e[7];const K=u||"the rule";let E;e[8]!==K?(E=n.jsxs(hr,{children:[i,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:K}),"."]})]}),e[8]=K,e[9]=E):E=e[9];let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=M):M=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=oe=>x(oe.target.value),e[11]=d):d=e[11];let P;e[12]!==u||e[13]!==v||e[14]!==h?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[M,n.jsx(br,{id:"variant-rename-name",value:h,onChange:d,placeholder:u,autoFocus:!0,disabled:v})]}),e[12]=u,e[13]=v,e[14]=h,e[15]=P):P=e[15];let ae;e[16]!==f?(ae=()=>f(!1),e[16]=f,e[17]=ae):ae=e[17];let T;e[18]!==v||e[19]!==ae?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:ae,disabled:v,children:"Cancel"}),e[18]=v,e[19]=ae,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(Fn,{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 F;e[29]!==w||e[30]!==ce||e[31]!==E||e[32]!==P?(F=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[E,P,ce]})}),e[29]=w,e[30]=ce,e[31]=E,e[32]=P,e[33]=F):F=e[33];let te;return e[34]!==j||e[35]!==r||e[36]!==F?(te=n.jsx(xr,{open:r,onOpenChange:j,children:F}),e[34]=j,e[35]=r,e[36]=F,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)]",fa="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 pa(m){const e=ze.c(5),{rule:r,matchers:c}=m,u=r?.__resolveType??"";let g;if(e[0]!==c||e[1]!==u){const h=c.find(x=>x.resolveType===u)?.iconName??Rs(u);g=cr(h),e[0]=c,e[1]=u,e[2]=g}else g=e[2];const S=g;if(!S)return null;let f;return e[3]!==S?(f=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=f):f=e[4],f}function $n(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
|
+
`)}function ln(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(m){return m.map((e,r)=>({...e,index:r}))}function ha(m){const e=ze.c(16),{label:r,effectiveRule:c,matchers:u,canDelete:g,dragging:S,onRename:f,onDuplicate:v,onDelete:h}=m;let x;e[0]!==c||e[1]!==u?(x=n.jsx(pa,{rule:c,matchers:u}),e[0]=c,e[1]=u,e[2]=x):x=e[2];let D;e[3]!==r?(D=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=D):D=e[4];let k;e[5]!==g||e[6]!==S||e[7]!==r||e[8]!==h||e[9]!==v||e[10]!==f?(k=!S&&n.jsxs(la,{children:[n.jsx(ia,{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:Xr,onPointerDown:Zr,children:n.jsx(ta,{size:14})})}),n.jsxs(ca,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:j=>{j.stopPropagation(),f?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:j=>{j.stopPropagation(),v?.()},children:[n.jsx(sa,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!g,onClick:j=>{j.stopPropagation(),h?.()},children:[n.jsx(oa,{size:14}),"Delete"]})]})]}),e[5]=g,e[6]=S,e[7]=r,e[8]=h,e[9]=v,e[10]=f,e[11]=k):k=e[11];let _;return e[12]!==x||e[13]!==D||e[14]!==k?(_=n.jsxs(n.Fragment,{children:[x,D,k]}),e[12]=x,e[13]=D,e[14]=k,e[15]=_):_=e[15],_}function Zr(m){return m.stopPropagation()}function Xr(m){return m.stopPropagation()}function eo(m){const e=ze.c(33),{entry:r,sortableId:c,isActive:u,canDelete:g,decofile:S,meta:f,matchers:v,onSelect:h,onRename:x,onDuplicate:D,onDelete:k}=m;let _;e[0]!==c?(_={id:c,animateLayoutChanges:to},e[0]=c,e[1]=_):_=e[1];const{attributes:j,listeners:o,setNodeRef:w,transform:i,isDragging:K}=Wn(_);let E;e[2]!==i?(E=Gn.Transform.toString(i?{...i,x:0}:null),e[2]=i,e[3]=E):E=e[3];const M=K?0:void 0;let d;e[4]!==E||e[5]!==M?(d={transform:E,opacity:M},e[4]=E,e[5]=M,e[6]=d):d=e[6];const P=d,ae=f??void 0;let T;e[7]!==S||e[8]!==r.variant.rule||e[9]!==ae?(T=Nt(r.variant.rule,S,ae),e[7]=S,e[8]=r.variant.rule,e[9]=ae,e[10]=T):T=e[10];const pe=T;let V;e[11]!==h?(V=O=>{O.target===O.currentTarget&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),h())},e[11]=h,e[12]=V):V=e[12];const ce=K?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",F=u?fa:Jr;let te;e[13]!==ce||e[14]!==F?(te=Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,F),e[13]=ce,e[14]=F,e[15]=te):te=e[15];let oe;e[16]!==g||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==k||e[21]!==D||e[22]!==x?(oe=n.jsx(ha,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:g,onRename:x,onDuplicate:D,onDelete:k}),e[16]=g,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=k,e[21]=D,e[22]=x,e[23]=oe):oe=e[23];let Te;return e[24]!==j||e[25]!==o||e[26]!==h||e[27]!==w||e[28]!==P||e[29]!==te||e[30]!==oe||e[31]!==V?(Te=n.jsx("div",{ref:w,style:P,...j,...o,onClick:h,onKeyDown:V,className:te,children:oe}),e[24]=j,e[25]=o,e[26]=h,e[27]=w,e[28]=P,e[29]=te,e[30]=oe,e[31]=V,e[32]=Te):Te=e[32],Te}function to(){return!1}function no(m){const e=ze.c(9),{variant:r,decofile:c,meta:u,matchers:g}=m,S=u??void 0;let f;e[0]!==c||e[1]!==S||e[2]!==r.rule?(f=Nt(r.rule,c,S),e[0]=c,e[1]=S,e[2]=r.rule,e[3]=f):f=e[3];const v=f;let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=Ee("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",fa),e[4]=h):h=e[4];let x;return e[5]!==v||e[6]!==g||e[7]!==r.label?(x=n.jsx("div",{className:h,children:n.jsx(ha,{label:r.label,effectiveRule:v,matchers:g,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=g,e[7]=r.label,e[8]=x):x=e[8],x}function ao(m){const e=ze.c(77),{listKey:r,variants:c,activeIndex:u,decofile:g,meta:S,matchers:f,onSelect:v,onReorder:h,onRename:x,onDuplicate:D,onDelete:k,onAdd:_}=m;let j;e[0]!==c?(j=()=>ln(c),e[0]=c,e[1]=j):j=e[1];const[o,w]=N.useState(j),[i,K]=N.useState(null),[E,M]=N.useState(r),[d,P]=N.useState(c.length);let ae;e[2]!==c?(ae=()=>$n(c),e[2]=c,e[3]=ae):ae=e[3];const[T,pe]=N.useState(ae),V=N.useRef(!1),ce=$n(c);E!==r?(M(r),P(c.length),pe(ce),w(ln(c))):d!==c.length?(P(c.length),pe(ce),w(ln(c))):T!==ce&&(pe(ce),w(Me=>c.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let F;e[4]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[4]=F):F=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:Yn},e[5]=te):te=e[5];const oe=In(zt(Hn,F),zt(zn,te));let Te;e[6]!==o?(Te=o.map(so),e[6]=o,e[7]=Te):Te=e[7];const O=Te,ue=c.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);K(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let $;e[10]!==O||e[11]!==h?($=Me=>{K(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=O.indexOf(String(xe.id)),ee=O.indexOf(String(Re.id));me===-1||ee===-1||(w(I=>Qr(Rt([...I],me,ee))),V.current=!0,requestAnimationFrame(()=>{V.current=!1}),h(me,ee))},e[10]=O,e[11]=h,e[12]=$):$=e[12];const Ae=$;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{K(null)},e[13]=Z):Z=e[13];const De=Z;let ve,se,Y,q,ne,le,ke,Se,de,ye,B,X,we;if(e[14]!==u||e[15]!==ue||e[16]!==g||e[17]!==o||e[18]!==O||e[19]!==Ae||e[20]!==je||e[21]!==f||e[22]!==S||e[23]!==_||e[24]!==k||e[25]!==D||e[26]!==x||e[27]!==v||e[28]!==oe){const Me=I=>{V.current||v(I)};B="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(un,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(ft,{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(pt,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(X=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(mt,{children:[me,ee]})]}),e[47]=me,e[48]=X):X=e[48],se=qn,le=oe,ke=Jn,Se=je,de=Ae,ye=De,ve=Qn,q=O,ne=Zn,we="space-y-0.5",Y=o.map(I=>n.jsx(eo,{sortableId:I.id,entry:I,isActive:I.index===u,canDelete:ue,decofile:g,meta:S,matchers:f,onSelect:()=>Me(I.index),onRename:()=>x(I.index),onDuplicate:()=>D(I.index),onDelete:()=>k(I.index)},I.id)),e[14]=u,e[15]=ue,e[16]=g,e[17]=o,e[18]=O,e[19]=Ae,e[20]=je,e[21]=f,e[22]=S,e[23]=_,e[24]=k,e[25]=D,e[26]=x,e[27]=v,e[28]=oe,e[29]=ve,e[30]=se,e[31]=Y,e[32]=q,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=ye,e[39]=B,e[40]=X,e[41]=we}else ve=e[29],se=e[30],Y=e[31],q=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],ye=e[38],B=e[39],X=e[40],we=e[41];let Ke;e[49]!==Y||e[50]!==we?(Ke=n.jsx("div",{className:we,children:Y}),e[49]=Y,e[50]=we,e[51]=Ke):Ke=e[51];let $e;e[52]!==ve||e[53]!==q||e[54]!==ne||e[55]!==Ke?($e=n.jsx(ve,{items:q,strategy:ne,children:Ke}),e[52]=ve,e[53]=q,e[54]=ne,e[55]=Ke,e[56]=$e):$e=e[56];let Le;e[57]!==i||e[58]!==g||e[59]!==f||e[60]!==S?(Le=i?n.jsx(no,{variant:i.variant,decofile:g,meta:S,matchers:f}):null,e[57]=i,e[58]=g,e[59]=f,e[60]=S,e[61]=Le):Le=e[61];let Ce;e[62]!==Le?(Ce=n.jsx(Xn,{dropAnimation:null,children:Le}),e[62]=Le,e[63]=Ce):Ce=e[63];let Oe;e[64]!==se||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==ye||e[70]!==$e||e[71]!==Ce?(Oe=n.jsxs(se,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:ye,children:[$e,Ce]}),e[64]=se,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=ye,e[70]=$e,e[71]=Ce,e[72]=Oe):Oe=e[72];let Fe;return e[73]!==B||e[74]!==X||e[75]!==Oe?(Fe=n.jsxs("div",{className:B,children:[X,Oe]}),e[73]=B,e[74]=X,e[75]=Oe,e[76]=Fe):Fe=e[76],Fe}function so(m){return m.id}function ro(m){const e=ze.c(15),{schema:r,value:c,onChange:u,meta:g,decofile:S,onSaveReferencedBlock:f,sandbox:v}=m;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[x,D]=N.useState(h);let k;e[1]!==x?(k=x.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:()=>D([]),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(na,{className:"size-3.5"})}),x.map((o,w)=>{const i=w===x.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[w>0&&n.jsx(aa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>D(x.slice(0,w+1)),title:o,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",i?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${w}`)})]}),e[1]=x,e[2]=k):k=e[2];let _;e[3]!==x||e[4]!==S||e[5]!==g||e[6]!==u||e[7]!==f||e[8]!==v||e[9]!==r||e[10]!==c?(_=n.jsx(ea,{schema:r,value:c,onChange:u,basePath:"",breadcrumbPath:x,onBreadcrumbChange:D,meta:g,decofile:S,onSaveReferencedBlock:f,sandbox:v}),e[3]=x,e[4]=S,e[5]=g,e[6]=u,e[7]=f,e[8]=v,e[9]=r,e[10]=c,e[11]=_):_=e[11];let j;return e[12]!==k||e[13]!==_?(j=n.jsxs("div",{className:"space-y-2",children:[k,_]}),e[12]=k,e[13]=_,e[14]=j):j=e[14],j}function On(m){const e=ze.c(21),{activeSchema:r,formValue:c,formResetKey:u,onFormChange:g,onBreadcrumbChange:S,breadcrumbPath:f,emptyMessage:v,beforeForm:h,seoResolveType:x,siteDefaultSeo:D,meta:k,decofile:_,onSaveReferencedBlock:j,sandbox:o}=m;let w;e[0]!==f?(w=f===void 0?[]:f,e[0]=f,e[1]=w):w=e[1];const i=w;let K;e[2]!==r||e[3]!==i||e[4]!==_||e[5]!==u||e[6]!==c||e[7]!==k||e[8]!==S||e[9]!==g||e[10]!==j||e[11]!==o||e[12]!==x||e[13]!==D?(K=r&&c?x?n.jsx(Rr,{schema:r,resolveType:x,value:c,formResetKey:u,onChange:g,onBreadcrumbChange:S,siteDefaultSeo:D}):n.jsx(ea,{schema:r,value:c,onChange:g,basePath:"",breadcrumbPath:i,onBreadcrumbChange:S,meta:k,decofile:_,onSaveReferencedBlock:j,sandbox:o},u):null,e[2]=r,e[3]=i,e[4]=_,e[5]=u,e[6]=c,e[7]=k,e[8]=S,e[9]=g,e[10]=j,e[11]=o,e[12]=x,e[13]=D,e[14]=K):K=e[14];const E=K;let M;e[15]!==v||e[16]!==E?(M=E??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=E,e[17]=M):M=e[17];let d;return e[18]!==h||e[19]!==M?(d=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:[h,M]})}),e[18]=h,e[19]=M,e[20]=d):d=e[20],d}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(m,e){return Ns(m,e,tt)}function lo(m){const e=ze.c(13),{pageKey:r,initialName:c,initialPath:u,onFieldChange:g}=m,[S,f]=N.useState(c),[v,h]=N.useState(u),[x,D]=N.useState(r);x!==r&&(D(r),f(c),h(u));let k;e[0]!==g?(k=i=>{f(i.target.value),g("name",i.target.value)},e[0]=g,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 j;e[5]!==g?(j=i=>{h(i.target.value),g("path",i.target.value)},e[5]=g,e[6]=j):j=e[6];let o;e[7]!==v||e[8]!==j?(o=n.jsx("input",{type:"text",value:v,onChange:j,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]=j,e[9]=o):o=e[9];let w;return e[10]!==_||e[11]!==o?(w=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=w):w=e[12],w}function Bn(m){const e=ze.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ra,{size:14}),e[0]=c):c=e[0];let u;e[1]!==r?(u=n.jsx(ft,{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:c})}),e[1]=r,e[2]=u):u=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=g):g=e[3];let S;return e[4]!==u?(S=n.jsxs(mt,{children:[u,g]}),e[4]=u,e[5]=S):S=e[5],S}function Ln(m){const e=ze.c(21),{currentRt:r,currentLabel:c,currentGlobalKey:u,matchers:g,globals:S,onSelect:f,onSelectGlobal:v,schema:h,formValue:x,onChange:D,formKey:k,formWrapperClassName:_,meta:j,decofile:o,onSaveReferencedBlock:w,sandbox:i}=m;let K;e[0]!==u||e[1]!==c||e[2]!==r||e[3]!==S||e[4]!==g||e[5]!==f||e[6]!==v?(K=n.jsx(Ds,{currentRt:r,currentLabel:c,currentGlobalKey:u,matchers:g,globals:S,onSelect:f,onSelectGlobal:v}),e[0]=u,e[1]=c,e[2]=r,e[3]=S,e[4]=g,e[5]=f,e[6]=v,e[7]=K):K=e[7];let E;e[8]!==o||e[9]!==k||e[10]!==x||e[11]!==_||e[12]!==j||e[13]!==D||e[14]!==w||e[15]!==i||e[16]!==h?(E=h&&x&&n.jsx("div",{className:_,children:n.jsx(ro,{schema:h,value:x,onChange:D,meta:j,decofile:o,onSaveReferencedBlock:w,sandbox:i},k)}),e[8]=o,e[9]=k,e[10]=x,e[11]=_,e[12]=j,e[13]=D,e[14]=w,e[15]=i,e[16]=h,e[17]=E):E=e[17];let M;return e[18]!==K||e[19]!==E?(M=n.jsxs(n.Fragment,{children:[K,E]}),e[18]=K,e[19]=E,e[20]=M):M=e[20],M}function nc({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:u,currentPath:g,activePageBlockKey:S=null,activeGlobalBlockKey:f=null,externalSelectedIndex:v,onSaved:h,initialEditSeo:x=!1,onExitSeo:D,onViewJsonFile:k,onVariantPreviewOverride:_}){const j=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:u}:null,{data:o,isLoading:w}=Vs(j),{data:i,isLoading:K}=Cs(j),E=Ps(),M=E?.entity?.id===e?E.entity.metadata?.siteSlug??null:null,[d,P]=N.useState(null),[ae,T]=N.useState(null),[pe,V]=N.useState(null),[ce,F]=N.useState(0),[te,oe]=N.useState(void 0),[Te,O]=N.useState(null),[ue,ie]=N.useState(null),[je,$]=N.useState([]),[Ae,Z]=N.useState(0),[De,ve]=N.useState(null),[se,Y]=N.useState(null),[q,ne]=N.useState(null),[le,ke]=N.useState(!0),[Se,de]=N.useState(!1),[ye,B]=N.useState(!1),[X,we]=N.useState(x),[Ke,$e]=N.useState(x);x&&!Ke&&($e(!0),we(!0),P(null),T(null),V(null),$([])),!x&&Ke&&$e(!1);const[Le,Ce]=N.useState(null),[Oe,Fe]=N.useState(void 0),[Me,xe]=N.useState([]),[Re,me]=N.useState(0),[ee,I]=N.useState(0),[re,Q]=N.useState(null),[Ie,he]=N.useState(null),[Qe,dn]=N.useState(null),ga=vs(),va=`${m}/${e}/${r}`,Ht=Ts({orgSlug:m,virtualMcpId:e,branch:r}),[Sa,xa]=N.useState(g),[ba,ya]=N.useState(S),[_a,ja]=N.useState(f);(Sa!==g||ba!==S||_a!==f)&&(queueMicrotask(()=>Ht.flush()),xa(g),ya(S),ja(f),P(null),T(null),V(null),F(0),O(null),ie(null),I(0),Q(null),he(null),$([]),Z(t=>t+1),we(!1),Ce(null),Fe(void 0),xe([]),me(t=>t+1));const be=As({orgSlug:m,virtualMcpId:e,branch:r}),Dt=Zs((t,a)=>{be.mutate({blockKey:t,data:a},{onSuccess:()=>h?.(),onError:s=>G.error(`Save failed: ${s.message}`)})}),Ut=Ms({orgSlug:m,virtualMcpId:e,branch:r}),[yt,Vt]=N.useState(!1),Wt=N.useRef(null),ht=N.useRef(null),gt=N.useRef(null),Gt=N.useRef({}),Ye=N.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||w||K)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Fn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!i)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 ka=Es(o),_e=!!f,He=_e?null:Ks(ka,g,S),R=_e?f:He?.key??null,Yt=_e&&f?o[f]:void 0,mn=_e&&f&&Yt?$s(f,Yt):_e&&f?f:"",Ct=!_e&&R&&o[R]?o[R]:null,qt=X&&o&&i&&R&&He?Mn(o,{kind:"page",pageKey:R,pageName:String(He.name??""),path:String(He.path??"")},i):null,wa=X?Ct?.seo:void 0,Jt=Oe!==void 0?Oe:wa,Ra=X?Nr(Jt):void 0,Na=qt?.seoTypeOptions??[],Da=X&&i?Dr(i):"",fn=Le??Ra??{},Qt=X&&qt?Vr(fn,qt):null,Va=X&&Qt&&Cr(Jt)?Ot(Qt,i):null,Ca=X?Pr(o,i)?.seoData:void 0,Be=_e?[{label:"Default",sections:[{__resolveType:f}]}]:io(Ct?.sections,o??{}),Pt=Be.length>1,Ve=Math.min(ce,Be.length-1),nt=Be[Ve],H=nt?.sections??[],Pe=Bt(H,o),pn=!_e&&Os(Ct?.sections);if(_e&&f&&Qe!==f){dn(f);const t=H[0],a=Pe[0];if(t&&a){P(0),I(0),$([]);const s=ut(t,a,o);s&&(T(s.data),V(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&dn(null),Ye.current={rawSections:H,parsedSections:Pe,decofile:o??{},activePageKey:R,pageVariants:Be,variantIndex:Ve,sectionVariantIndex:ee,selectedSectionIndex:d};const Pa=()=>({multivariate:pn,index:Ve,variants:Be.map(t=>({rule:t.rule}))}),hn=(t,a)=>{if(!_)return;if(!R||!pn||t.length<=1){_(null);return}const s=Tn(R,{multivariate:!0,index:a,variants:t},o,i);_(s.length>0?s:null)},vt=(t,a,s)=>{if(!_)return;if(!R){_(null);return}const l=Pa(),p=Tn(R,l,o,i);if(!t||a<0){_(p.length>0?p:null);return}const y=ar({pageKey:R,page:l,sectionIndex:a,sectionLazy:Pe[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:i}),b=[...p,...y];_(b.length>0?b:null)},at=(t,a,s,l=d??-1,p=!1)=>{const y=Je(t,a);if(!y){T(null),V(null),he(null),Q(null),p&&vt(null,l,s);return}const C=Dn(y,tt)[s];if(!C){T(null),V(null),he(null),Q(null),p&&vt(null,l,s);return}const J=Hs(C.value,o);T(J?.data??null),V(J?.resolveType??null);const{resolveType:A,formValue:L}=jt(C.rule,o,i??void 0);he(A),Q(L),p&&vt(y,l,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=H[v],a=Pe[v];if(t&&a)if(P(v),I(0),$([]),Z(s=>s+1),a.isMultivariate)at(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:m,virtualMcpId:e,branch:r,previewUrl:u??void 0,siteSlug:M},Zt=pe&&i?Ot(pe,i):null,Ue=(t,a)=>{if(!R)return;const s=wt(o,R,t,Ve,Be);be.mutate({blockKey:R,data:s},{onSuccess:()=>a?.onSuccess?.()??h?.(),onError:l=>G.error(`Save failed: ${l.message}`)})},St=()=>{P(null),T(null),V(null),I(0),Q(null),he(null),$([]),Z(t=>t+1)},Ta=(t,a)=>{Wt.current&&clearTimeout(Wt.current);const s=Ye.current.sectionVariantIndex;Wt.current=setTimeout(()=>{const{rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current,A=l[a];if(!A)return;const L=p[a];if(!L)return;if(L.isSavedBlock){const U=L.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;be.mutate({blockKey:U,data:t},{onSuccess:()=>h?.(),onError:W=>G.error(`Save failed: ${W.message}`)});return}if(!b)return;const z={...y[b]},ge=[...l];if(L.isMultivariate){const U=Je(A,L);if(!U||!b)return;const W=rr(U,s,t);ge[a]=dt(A,L,W)}else if(L.isHidden){const U=Un(A.__resolveType),W=U?{...A.section}:{...A},Ne=Array.isArray(W.variants)?[...W.variants]:[];Ne[0]&&(Ne[0]={...Ne[0],value:t}),W.variants=Ne,U?ge[a]={...A,section:W}:ge[a]=W}else L.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(C.length>1){const U=z.sections,W=[...U?.variants??[]];W[J]&&(W[J]={...W[J],value:ge}),z.sections={...U,variants:W}}else z.sections=ge;be.mutate({blockKey:b,data:z},{onSuccess:()=>h?.(),onError:U=>G.error(`Save failed: ${U.message}`)})},on)},Aa=t=>{P(t),I(0),$([]),Z(p=>p+1);const a=H[t],s=Pe[t];if(!a||!s)return;if(s.isMultivariate){at(a,s,0,t);return}const l=ut(a,s,o);if(!l){T(null),V(null),he(null),Q(null),vt(null,t,0);return}T(l.data),V(l.resolveType),he(null),Q(null),vt(null,t,0)},gn=t=>{const a=t;T(a),d!==null&&Ta(a,d)},Xt=t=>{if(!R||!o||!i||!He)return;const a={kind:"page",pageKey:R,pageName:String(He.name??""),path:String(He.path??"")},s=Mn(o,a,i);s&&Ht.save(R,()=>{const l=ga.getQueryData(Ss.decofile(va))?.[R];if(!l||typeof l!="object"||l===null||Array.isArray(l))return null;const p={...l,...Gt.current};return Gt.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Ar(a,s,p,t.inner):p})},Ma=(t,a)=>{R&&(Gt.current[t]=a,Xt())},Ea=(t,a)=>{if(!R)return;const s=Rt([...H],t,a);d!==null&&(d===t?P(a):t<d&&a>=d?P(d-1):t>d&&a<=d&&P(d+1)),Ue(s)},Ka=t=>{if(!R)return;const a=H.filter((s,l)=>l!==t);d===t?St():d!==null&&d>t&&P(d-1),Ue(a)},$a=t=>{if(!R)return;const a=H[t];if(!a)return;const s=[...H];s.splice(t+1,0,nr(a)),d!==null&&d>t&&P(d+1),Ue(s)},Oa=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const l=s.isHidden?er(a):tr(a);if(!l)return;const p=[...H];p[t]=l,d===t&&St(),Ue(p)},Ba=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const l=Xs(a);if(!l)return;const p=[...H];p[t]=l,d===t&&St(),Ue(p)},La=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s?.isSavedBlock)return;const l=ut(a,s,o);if(!l?.data)return;const{name:p,...y}=l.data,b=[...H];s.isLazy?b[t]={...a,section:y}:b[t]=y,d===t&&St(),Ue(b)},Fa=t=>{if(!R)return;const a=[...H,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),P(s),I(0),$([]),Z(b=>b+1);const l=a[s],p=Bt(a,o)[s];if(!l||!p)return;if(p.isMultivariate){at(l,p,0);return}const y=ut(l,p,o);if(!y){T(null),V(null),he(null),Q(null);return}T(y.data),V(y.resolveType),he(null),Q(null)}})},Ia=t=>{if(d===null)return;const a=H[d],s=Pe[d];!a||!s?.isMultivariate||(I(t),$([]),Z(l=>l+1),at(a,s,t,d,!0))},za=t=>{if(d===null||!R)return;const a=H[d],s=Pe[d];if(!a||!s?.isMultivariate)return;const l=Je(a,s);if(!l)return;const p=Js(l,t);if(!p){G.error("Cannot delete the only variant.");return}const y=[...H];y[d]=dt(a,s,p);const b=p.variants;let C=ee;t===ee?C=Math.min(t,b.length-1):t<ee&&(C=ee-1),I(C),$([]),Z(J=>J+1),at(y[d],s,C),Ue(y)},Ha=t=>{if(d===null||!R)return;const a=H[d],s=Pe[d];if(!a||!s?.isMultivariate)return;const l=Je(a,s);if(!l)return;const p=Qs(l,t),y=[...H];y[d]=dt(a,s,p);const b=t+1;I(b),$([]),Z(C=>C+1),at(y[d],s,b),Ue(y)},Ua=(t,a)=>{if(d===null||!R||t===a)return;const s=H[d],l=Pe[d];if(!s||!l?.isMultivariate)return;const p=Je(s,l);if(!p)return;const y=Ys(p,t,a),b=[...H];b[d]=dt(s,l,y);let C=ee;ee===t?C=a:t<ee&&a>=ee?C=ee-1:t>ee&&a<=ee&&(C=ee+1),I(C),at(b[d],l,C),Ue(b)},en=t=>{const a=t??d;if(a===null||!R)return;const s=H[a],l=Pe[a];if(!s||!l)return;const p=Us(s,l);if(!p){G.error("This section cannot have variants.");return}const y=[...H];y[a]=p.section;const b=Bt(y,o)[a];if(!b?.isMultivariate){G.error("Could not add variant.");return}P(a),I(p.newVariantIndex),$([]),Z(C=>C+1),at(p.section,b,p.newVariantIndex,a),Ue(y)},Wa=()=>{if(d===null||!R)return;const t=H[d],a=Pe[d];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const l=qs(t,a,s);if(!l){G.error("Could not remove variants.");return}const p=[...H];p[d]=l;const y=Bt(p,o)[d];if(!y)return;I(0),he(null),Q(null),$([]),Z(C=>C+1);const b=ut(l,y,o);b?(T(b.data),V(b.resolveType)):(T(null),V(null)),vt(null,d,0),Ue(p)},Ga=async t=>{if(De===null||!R)return;const a=rn(t,o);if(a){G.error(a);return}const s=H[De],l=Pe[De];if(!s||!l)return;const p=ut(s,l,o);if(!p){G.error("This section cannot be saved as global.");return}const y={...p.data,name:t};try{await be.mutateAsync({blockKey:t,data:y});const b=[...H];b[De]={__resolveType:t},await be.mutateAsync({blockKey:R,data:wt(o,R,b,Ve,Be)}),d===De&&St(),ve(null),G.success(`Saved global block "${t}"`),h?.()}catch(b){G.error(b instanceof Error?b.message:"Failed to save global block")}},vn=nt?.rule;if(Pt&&d===null&&ue===null&&vn){const{resolveType:t,formValue:a}=jt(vn,o??{},i??void 0);ie(t),O(a)}const At=i?Bs(i):[],Sn=i&&o?Ls(i,o):[],Ya=!_e&&!!(u&&i&&o),qa=ue&&i?Ot(ue,i):null,Mt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,a)=>{if(!(sr(a,t,i)>0))try{await Ut.mutateAsync({blockKey:t})}catch(s){G.error(s instanceof Error?s.message:"Could not delete matcher block")}},xn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:l}=Ye.current;if(!a)return;const p={...s[a]},y={...p.sections},b=[...y.variants??[]],C=b[l],J=C?.rule;if(xt(J,s,i)){const A=J?.__resolveType??"",L=s[A],z=typeof L?.name=="string"?L.name:A,{__resolveType:ge,...U}=t;be.mutate({blockKey:A,data:bt(ge??"",U,z)},{onSuccess:()=>h?.(),onError:W=>G.error(`Save failed: ${W.message}`)});return}C&&(b[l]={...C,rule:t}),p.sections={...y,variants:b},be.mutate({blockKey:a,data:p},{onSuccess:()=>h?.(),onError:A=>G.error(`Save failed: ${A.message}`)})},on)},Ja=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:An};O({}),xn(a)},Qa=t=>{const a=t;O(a);const s=ue?{__resolveType:ue,...a}:{...a};xn(s)},Za=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:l}=Ye.current;if(!a)return;const p=s[a],y=p?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const b=y;if(!Array.isArray(b.variants))return;const C=[...b.variants],J=C[l];if(!J)return;const A=kt(J.rule,s,i),L=Ft(t);C[l]={...J,rule:L};const z={...s,[a]:{...p,sections:{...b,variants:C}}},{resolveType:ge,formValue:U}=jt(L,z,i??void 0);ie(ge),O(U);try{await be.mutateAsync({blockKey:a,data:z[a]}),A&&A!==t&&await _t(A,z),h?.()}catch(W){G.error(W instanceof Error?W.message:"Could not apply saved rule")}},bn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=Ye.current;a!==null&&(gt.current=setTimeout(()=>{const{rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(!b)return;const A=l[a],L=p[a];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const U=(z.variants??[])[s]?.rule;if(xt(U,y,i)){const fe=U?.__resolveType??"",We=y[fe],Xe=typeof We?.name=="string"?We.name:fe,{__resolveType:rt,...et}=t;be.mutate({blockKey:fe,data:bt(rt??"",et,Xe)},{onSuccess:()=>h?.(),onError:ot=>G.error(`Save failed: ${ot.message}`)});return}const W=Vn(z,s,t),Ne=[...l];Ne[a]=dt(A,L,W);const qe=wt(y,b,Ne,J,C);be.mutate({blockKey:b,data:qe},{onSuccess:()=>h?.(),onError:fe=>G.error(`Save failed: ${fe.message}`)})},on))},Xa=t=>{he(t),Q({}),bn(t?{__resolveType:t}:{__resolveType:An})},es=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};bn(s)},ts=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(a===null||!b)return;const A=l[a],L=p[a];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const ge=z.variants??[],U=kt(ge[s]?.rule,y,i),W=Ft(t),Ne=Vn(z,s,W),qe=[...l];qe[a]=dt(A,L,Ne);const fe=wt(y,b,qe,J,C),We={...y,[b]:fe},{resolveType:Xe,formValue:rt}=jt(W,We,i??void 0);he(Xe),Q(rt);try{await be.mutateAsync({blockKey:b,data:fe}),U&&U!==t&&await _t(U,We),h?.()}catch(et){G.error(et instanceof Error?et.message:"Could not apply saved rule")}};if(!_e&&!He)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",g]});if(_e&&!Yt)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 st=d!==null?Pe[d]??null:null,yn=d!==null?H[d]:null,_n=yn&&st?.isMultivariate?Je(yn,st):null,lt=_n?Dn(_n,tt):[],tn=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[tn]??null,ct=st?.isMultivariate===!0,jn=d!==null&&st!==null,Kt=jn&&(ct||!!(Zt&&ae)),ns=Kt&&!_e&&st?.isSavedBlock===!0,Ze=_e||ns,as=_e?mn:st?.label??"",ss=Ie&&i?Ot(Ie,i):null,nn=Kt&&(!_e||je.length>0)?_e?[mn,...je]:[He.name,st.label,...ct&&Et?[Et.label]:[],...je]:[],rs=X&&He?[He.name,"SEO",...Me]:[],$t=X?rs:Ze?nn.length>0?nn:[as]:nn,kn=()=>{if(!R)return;const t=o[R],a=Ws(t.sections,H);if(!a)return;const s=Gs(a);be.mutate({blockKey:R,data:{...t,sections:a}},{onSuccess:()=>{F(s),P(null),T(null),V(null),$([]),O(null),ie(null)},onError:l=>G.error(`Save failed: ${l.message}`)})},an=(t,a,s)=>{if(!R)return;const l=o[R],p=l.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const y=p;if(!Array.isArray(y.variants))return;const b=t([...y.variants]);if(!b)return;const C=or(y,b),J={...o,[R]:{...l,sections:C}};be.mutate({blockKey:R,data:J[R]},{onSuccess:()=>{a?.(),s&&_t(s,J)},onError:A=>G.error(`Save failed: ${A.message}`)})},os=t=>{Y(null),F(t),P(null),T(null),V(null),$([]);const a=Be[t]?.rule,{resolveType:s,formValue:l}=jt(a,o??{},i??void 0);ie(s),O(l),hn(Be.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),F(s);const l=Rt(Be.map(p=>({rule:p.rule})),t,a);hn(l,s),an(p=>Rt(p,t,a))},ls=t=>{const a=Be[t]?.rule,s=kt(a,o??{},i??void 0);an(l=>l.length<=1?null:(l.splice(t,1),l),()=>{Be.length-1===1?F(0):t<Ve?F(Ve-1):t===Ve&&F(Math.max(0,t-1)),P(null),T(null),V(null),$([]),O(null),ie(null)},s)},cs=t=>{an(a=>ir(a,t),()=>{F(t+1),P(null),T(null),V(null),$([]),O(null),ie(null)})},us=async(t,a)=>{Mt();const s=Ye.current.activePageKey,l=Ye.current.decofile;if(!s)return;const p=l[s],y=p.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const b=y;if(!Array.isArray(b.variants))return;const C=[...b.variants],J=C[t];if(!J?.rule||typeof J.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const A=J.rule,L=a.trim();Vt(!0);try{if(!L){if(!xt(A,l,i)){Y(null);return}const qe=A.__resolveType??"";C[t]={...J,rule:Cn(A,l,i)};const fe={...l,[s]:{...p,sections:{...b,variants:C}}};await be.mutateAsync({blockKey:s,data:fe[s]}),await _t(qe,fe),Y(null),h?.();return}const z=Pn(A,l,i);if(!z){G.error("Could not read this variant's matcher rule.");return}if(z.blockKey){await be.mutateAsync({blockKey:z.blockKey,data:bt(z.resolveType,z.data,L)}),Y(null),h?.();return}const ge=sn(L),U=rn(ge,l);if(U){G.error(U);return}const W=bt(z.resolveType,z.data,L);let Ne=null;try{await be.mutateAsync({blockKey:ge,data:W}),Ne=ge,C[t]={...J,rule:Ft(ge)},await be.mutateAsync({blockKey:s,data:{...p,sections:{...b,variants:C}}}),Ne=null}catch(qe){throw Ne&&await Ut.mutateAsync({blockKey:Ne}).catch(()=>{}),qe}Y(null),G.success(`Saved matcher as global block "${L}"`),h?.()}catch(z){G.error(z instanceof Error?z.message:"Failed to rename variant")}finally{Vt(!1)}},ds=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(s===null||!b)return;const A=l[s],L=p[s];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const ge=z.variants??[],U=ge[t];if(!U?.rule||typeof U.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const W=U.rule,Ne=a.trim();Vt(!0);const qe=async fe=>{const We={...z,variants:fe},Xe=[...l];Xe[s]=dt(A,L,We);const rt=wt(y,b,Xe,J,C);return await be.mutateAsync({blockKey:b,data:rt}),{...y,[b]:rt}};try{if(!Ne){if(!xt(W,y,i)){ne(null);return}const ot=W.__resolveType??"",Nn=[...ge];Nn[t]={...U,rule:Cn(W,y,i)};const gs=await qe(Nn);await _t(ot,gs),ne(null),h?.();return}const fe=Pn(W,y,i);if(!fe){G.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await be.mutateAsync({blockKey:fe.blockKey,data:bt(fe.resolveType,fe.data,Ne)}),ne(null),h?.();return}const We=sn(Ne),Xe=rn(We,y);if(Xe){G.error(Xe);return}const rt=bt(fe.resolveType,fe.data,Ne);let et=null;try{await be.mutateAsync({blockKey:We,data:rt}),et=We;const ot=[...ge];ot[t]={...U,rule:Ft(We)},await qe(ot),et=null}catch(ot){throw et&&await Ut.mutateAsync({blockKey:et}).catch(()=>{}),ot}ne(null),G.success(`Saved matcher as global block "${Ne}"`),h?.()}catch(fe){G.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Vt(!1)}},wn=()=>{St()},ms=t=>{Ce(t),Xt({inner:t})},fs=t=>{Fe(t),Xt({raw:t})},ps=()=>{Ce(null),xe([])},hs=()=>me(t=>t+1),Rn=t=>{if(X){if(t===0){Ht.flush(),we(!1),Ce(null),Fe(void 0),xe([]),me(s=>s+1),D?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){$(je.slice(0,t)),Z(s=>s+1);return}if(t===0){wn();return}if(t===1){$([]),Z(s=>s+1);return}if(ct&&t===2){$([]),Z(s=>s+1);return}const a=ct?2:1;$(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:Ze||Kt||X?n.jsxs("div",{className:Ee("border-b px-3 py-2.5",Ze&&"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:[$t.length>1&&n.jsx("button",{type:"button",onClick:()=>Rn($t.length-2),title:"Back","aria-label":"Back",className:Ee("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",Ze?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(na,{className:"size-4"})}),!_e&&Pt&&nt&&n.jsxs("button",{type:"button",onClick:wn,title:`Editing in variant: ${nt.label}`,className:Ee("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(pa,{rule:Nt(nt.rule,o??{},i??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:nt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:$t.map((t,a)=>{const s=a===$t.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(aa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Rn(a),title:t,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?Ze?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Ze?"text-foreground/80":"text-muted-foreground",Ze?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),Ze&&n.jsxs(mt,{children:[n.jsx(ft,{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(pt,{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&&!st?.isHidden&&R&&n.jsx(Bn,{onClick:()=>en()})]}),Ze&&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:R,initialName:He.name,initialPath:He.path,onFieldChange:Ma})}),n.jsxs(mt,{children:[n.jsx(ft,{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(ur,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>k&&R?k(R):B(!0),children:n.jsx(dr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(Bn,{onClick:kn})]})}),X?n.jsx(It,{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&&R?n.jsx(Tr,{rawSeo:Jt,innerSeo:fn,defaultResolveType:Da,seoSchema:Va,activeResolveType:Qt,seoTypeOptions:Na,formResetKey:Re,siteDefaultSeo:Ca,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."})})})}):Kt?n.jsxs(It,{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:`${R??""}:${d??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:tn,onSelect:Ia,onRename:ne,onDuplicate:Ha,onDelete:za,onRemoveAll:Wa,onReorder:Ua,onAdd:()=>en()}),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(Ln,{currentRt:Ie??"",currentLabel:Lt(Et?.rule,o??{},tt,i??void 0),currentGlobalKey:kt(Et?.rule,o??{},i??void 0)??void 0,matchers:At,globals:Sn,onSelect:Xa,onSelectGlobal:ts,schema:ss,formValue:re,onChange:es,formKey:`${d??"none"}:${tn}:${Ie??""}`,formWrapperClassName:"pt-1",meta:i??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})]})]}),n.jsx(On,{activeSchema:Zt,formValue:ae,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:$,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:i,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})]}):_e?n.jsx(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(On,{activeSchema:Zt,formValue:ae,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:$,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:i,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})}):n.jsxs(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&R&&n.jsx(ao,{listKey:R,variants:Be,activeIndex:Ve,decofile:o??{},meta:i,matchers:At,onSelect:os,onReorder:is,onRename:Y,onDuplicate:cs,onDelete:ls,onAdd:kn}),Pt&&ue!==null&&n.jsxs("div",{className:Ee("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(mr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(lr,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsx("div",{className:Ee("space-y-3",yt&&"pointer-events-none opacity-50"),children:n.jsx(Ln,{currentRt:ue,currentLabel:Lt(nt?.rule,o??{},tt,i??void 0),currentGlobalKey:kt(nt?.rule,o??{},i??void 0)??void 0,matchers:At,globals:Sn,onSelect:Ja,onSelectGlobal:Za,schema:qa,formValue:Te,onChange:Qa,formKey:`${Ve}:${ue??""}`,formWrapperClassName:"space-y-3",meta:i??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Yr,{listKey:`${R??""}-${Ve}`,rawSections:H,sections:Pe,meta:i,selectedIndex:d,onSelect:Aa,onReorder:Ea,onDelete:Ka,onDuplicate:$a,onMakeReusable:ve,onToggleHidden:Oa,onToggleLazy:Ba,onAddVariant:en,onDetach:La,onAddSection:()=>de(!0),canAddSection:Ya})})]}),n.jsx(Is,{open:De!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:De!==null?sn(Pe[De]?.label??""):"",isPending:be.isPending,onSubmit:Ga}),u&&n.jsx(Er,{open:Se,onOpenChange:de,meta:i,decofile:o,previewBaseUrl:u,onSelect:Fa}),ye&&R&&o&&n.jsx(zs,{open:ye,onOpenChange:B,pageKey:R,decofile:o}),se!==null&&n.jsx(Kn,{open:!0,initialName:xt(Be[se]?.rule,o??{},i??void 0)?Lt(Be[se]?.rule,o??{},tt,i??void 0):"",autoLabel:tt(Nt(Be[se]?.rule,o??{},i??void 0)),isPending:yt,onSubmit:async t=>{await us(se,t)},onOpenChange:t=>{!t&&!yt&&Y(null)}}),q!==null&&n.jsx(Kn,{open:!0,initialName:xt(lt[q]?.rule,o??{},i??void 0)?Lt(lt[q]?.rule,o??{},tt,i??void 0):"",autoLabel:tt(Nt(lt[q]?.rule,o??{},i??void 0)),isPending:yt,onSubmit:async t=>{await ds(q,t)},onOpenChange:t=>{!t&&!yt&&ne(null)}})]})}export{nc as SectionsEditor};
|