1import{u as f,h as p,b,a4 as j,r as N,j as e,B as t}from"./index-_aijvlUq.js";import{P as v}from"./PageHeader-DCofr6qo.js";import{E as z}from"./EmptyState-CPGKooqj.js";const m={active:{label:"Active",className:"bg-green-100 text-green-700"},suspended:{label:"Suspended",className:"bg-amber-100 text-amber-700"},offboarded:{label:"Offboarded",className:"bg-red-100 text-red-700"}};function w(){const a=f(),{orgs:i,currentOrg:x,switchOrg:o,updateOrg:h}=p(),{user:u}=b(),n=u?.role===j.SUPERADMIN;N.useEffect(()=>{!n&&i.length===1&&a(`/settings/organizations/${i[0].id}`,{replace:!0})},[n,i,a]);function g(s){o(s.id)}async function l(s,r){try{await h(s.id,{status:r})}catch{}}return e.jsxs("div",{className:"px-4 md:px-0",children:[e.jsx(v,{title:"Organizations",breadcrumbs:[{label:"Home",to:"/"},{label:"Settings"},{label:"Organizations"}],actions:n&&e.jsx(t,{onClick:()=>a("/settings/organizations/new"),children:"New organization"})}),i.length===0?e.jsx(z,{card:!0,title:"No organizations found.",action:n?e.jsx(t,{onClick:()=>a("/settings/organizations/new"),children:"Create first organization"}):null}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:i.map(s=>{const r=s.id===x?.id,d=m[s.status]??m.active;return e.jsxs("div",{className:`bg-white rounded-xl border p-5 flex flex-col gap-4 ${r?"border-band-400 ring-1 ring-band-400":"border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[s.logoUrl?e.jsx("img",{src:s.logoUrl,alt:s.name,className:"h-12 w-12 rounded-full object-cover shrink-0"}):e.jsx("div",{className:"h-12 w-12 rounded-full shrink-0 flex items-center justify-center text-white font-bold text-sm",style:{background:s.colorChrome},children:s.shortName?.slice(0,2)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"font-semibold text-gray-900 text-sm truncate",children:s.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium shrink-0 ${d.className}`,children:d.label})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:s.tagline}),s.ownerEmail&&e.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:s.ownerEmail})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-400 mr-1",children:"Colors"}),e.jsx(c,{color:s.colorChrome,title:"Chrome"}),e.jsx(c,{color:s.colorPrimary,title:"Primary"}),e.jsx(c,{color:s.colorAccent,title:"Accent"}),e.jsx("span",{className:"ml-auto text-xs text-gray-400 font-mono",children:s.shortName})]}),n&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.status!=="active"&&e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>l(s,"active"),children:"Activate"}),s.status!=="suspended"&&e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>l(s,"suspended"),children:"Suspend"}),s.status!=="offboarded"&&e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>l(s,"offboarded"),children:"Offboard"}),e.jsx(t,{variant:"secondary",size:"sm",onClick:()=>g(s),className:"ml-auto",children:"Impersonate"})]}),e.jsxs("div",{className:"flex gap-2 pt-1 border-t border-gray-100",children:[!r&&e.jsx(t,{variant:"secondary",size:"sm",onClick:()=>
1o(s.id),children:"Switch"}),e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>a(`/settings/organizations/${s.id}/ensembles`),children:"Ensembles"}),e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>a(`/settings/organizations/${s.id}/sections`),children:"Sections"}),e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>a(`/settings/organizations/${s.id}`),children:"Edit"})]})]},s.id)})})]})}function c({color:a,title:i}){return e.jsx("span",{title:i,className:"h-5 w-5 rounded-full border border-gray-200 shrink-0",style:{background:a}})}export{w as OrganizationsPage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.