import{j as s,r as x}from"./react-vendor-MPLM8hiW.js";import{a as f,P as b,u as S,p as K,i as v,k,aC as q,aD as w,t as j,q as g}from"./index-saDuzM6I.js";import{I as D}from"./InjectionZone-NSGneYFC.js";import{b as N}from"./pluginAdminHelpers-BaIhTGH8.js";import{SettingsGeneralPage as pe}from"./SettingsGeneralPage-BO0H2nmA.js";import{SettingsRolesPage as ge}from"./RolesPage-C7WltuMZ.js";import{E as A,Q as P,aF as F,U as I,B as L,bi as C,bj as E,a8 as M,ai as B,a3 as H,l as u,bk as O,n as m,J as Q}from"./icons-vendor-H2PpUqT3.js";import{O as R,r as T,q as U,N as G}from"./vendor-CwCtuXvS.js";import"./tanstack-vendor-Dk_RmDT8.js";import"./radix-vendor-aVdTdbL0.js";import"./EntityTimeline-DQwiujhx.js";import"./activity-format-CSLEHg8d.js";import"./AccessDeniedCard-Dsgkzv6T.js";const J=[{icon:A,labelKey:"settings.general",href:"/settings",descriptionKey:"settings.generalDescription"},{icon:P,labelKey:"settings.platform",href:"/settings/platform",descriptionKey:"settings.platformDescription",requiredScopes:["*","admin:*","admin:settings:read"]},{icon:F,labelKey:"settings.content",href:"/settings/content",descriptionKey:"settings.contentDescription"},{icon:I,labelKey:"settings.team",href:"/settings/team",descriptionKey:"settings.teamDescription"},{icon:L,labelKey:"roles.title",href:"/settings/roles",descriptionKey:"settings.rolesDescription"},{icon:C,labelKey:"settings.permissionInspector",href:"/settings/permissions",descriptionKey:"settings.permissionInspectorDescription",requiredScopes:["admin:roles:read"]},{icon:E,labelKey:"settings.workspaces",href:"/settings/workspaces",descriptionKey:"settings.workspacesDescription",requiredScopes:["admin:workspaces:read"],requiredFeature:"enterprise.workspaces"},{icon:M,labelKey:"settings.access",href:"/settings/access",descriptionKey:"settings.accessDescription",requiredScopes:["admin:api-tokens:read","admin:service-accounts:read"]},{icon:B,labelKey:"settings.preview",href:"/settings/preview",descriptionKey:"settings.previewDescription",requiredScopes:["preview:read"],requiredFeature:"preview.tokens"},{icon:H,labelKey:"settings.sso",href:"/settings/sso",descriptionKey:"settings.ssoDescription",requiredFeature:"enterprise.sso"},{icon:u,labelKey:"settings.mfa",href:"/settings/mfa",descriptionKey:"settings.mfaDescription"},{icon:O,labelKey:"settings.compliance",href:"/settings/compliance",descriptionKey:"settings.complianceDescription",requiredModule:"business.compliance"},{icon:u,labelKey:"settings.securityCenter",href:"/settings/security",descriptionKey:"settings.securityCenterDescription",requiredScopes:["*"]},{icon:m,labelKey:"settings.aiAudit",href:"/settings/ai-audit",descriptionKey:"settings.aiAuditDescription",requiredScopes:["admin:ai:read"],requiredFeature:"ai.guardrails"},{icon:m,labelKey:"settings.aiScaffolding",href:"/settings/ai-scaffolding",descriptionKey:"settings.aiScaffoldingDescription",requiredScopes:["*"],requiredFeature:"ai.schema-assistant"}];function W(){const i=U(),{t:l}=f(),p=S(e=>e.user),r=K(e=>e.getAllSettingsSections)(),a=v().data,h=x.useMemo(()=>{const e=J.filter(t=>(!t.requiredScopes||t.requiredScopes.some(n=>k(p,n)))&&!q(a,t.requiredModule)&&!w(a,t.requiredFeature));if(r.length===0)return e;const o=r.map(t=>({icon:j(t.icon,Q),labelKey:t.label,href:N(t.pluginName,t.path),descriptionKey:t.description??""}));return[...e,...o]},[a,r,p]);return s.jsx("nav",{className:"p-2 md:p-4 flex md:flex-col gap-1 md:space-y-0",children:h.map(e=>{const o=i.pathname===e.href||e.href!=="/settings"&&i.pathname.startsWith(e.href),n=e.href==="/settings"&&i.pathname==="/settings"||e.href!=="/settings"&&o,d=l(e.labelKey),c=e.descriptionKey?l(e.descriptionKey):"",y=[d,c].filter(Boolean).join(" · ");return s.jsxs(G,{to:e.href,title:y,className:g("flex min-w-max items-center gap-2 rounded-lg px-3 py-2 transition-colors md:w-full md:min-w-0 md:gap-3 md:px-4 md:py-3",n?"bg-primary text-white":"text-text-secondary hover:bg-surface-active hover:text-text-primary"),children:[s.jsx(e.icon,{className:"h-5 w-5 flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[s.jsx("div",{className:"truncate text-sm font-medium leading-tight md:text-base",children:d}),c&&s.jsx("div",{className:g("hidden truncate text-xs md:block",n?"text-white/70":"opacity-70"),children:c})]})]},e.href)})})}function ae(){const{t:i}=f();return s.jsx(b,{title:i("settings.title"),description:i("settings.description"),sidebar:s.jsx(W,{}),children:s.jsxs("div",{className:"space-y-6",children:[s.jsx(D,{name:"settings:top"}),s.jsx(R,{})]})})}function oe(){return s.jsx(T,{to:"/settings/access",replace:!0})}export{oe as SettingsApiTokensPage,pe as SettingsGeneralPage,ae as SettingsPage,ge as SettingsRolesPage};
