1import{r as e,j as t}from"./vendor-BrFbdvfN.js";import{A as s}from"./index-Dfu6jSUb.js";import{A as a}from"./index-DuveTdGO.js";import{A as n}from"./index-acUzuHvQ.js";import{A as r}from"./index-TuALcKuB.js";import{A as i}from"./index-l8GLbxks.js";import{q as o,n as c}from"./index-C_PVNRFj.js";import{c as l}from"./query-OVg_3KLz.js";import{f as d}from"./org-C2qMp_-z.js";import{u as x}from"./i18n-BRRhXaHa.js";import{a2 as m,G as h}from"./icons-BM-S0DN8.js";import"./index-D5OYaf12.js";import"./router-D1D-CY2D.js";import"./motion-D0-MsV41.js";import"./use-auth-D9QQ1h8S.js";import"./zustand-BcOr8Ggu.js";function j(){const[t,s]=e.useState(1),[a]=e.useState(20),[n,r]=e.useState(""),[i,c]=e.useState(""),x=e.useRef(void 0);e.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(n),s(1)},300),()=>{x.current&&clearTimeout(x.current)}),[n]);const{data:m,isLoading:h}=(j=i?{page:t,page_size:a,q:i}:{page:t,page_size:a},l({queryKey:[...o.org.list(),j],queryFn:()=>d(j).then(e=>e.data),staleTime:3e4}));var j;return{page:t,pageSize:a,searchQuery:n,setSearchQuery:r,setPage:s,data:m,isLoading:h}}const u={active:"success",suspended:"warning",deleted:"error"};function g(){const{t:e}=x("org"),{page:a,pageSize:o,searchQuery:c,setSearchQuery:l,setPage:d,data:h,isLoading:u}=j(),g=h?.items??[],f=h?.total??0,N=0===f?0:(a-1)*o+1,b=Math.min(a*o,f);return t.jsx(s,{children:t.jsxs(r,{className:"flex-1 flex flex-col",children:[t.jsxs(r.Header,{className:"justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-7 h-7 rounded-md flex items-center justify-center shrink-0 bg-aino-accent-subtle border border-aino-accent-border",children:t.jsx(m,{className:"w-4 h-4 text-aino-accent"})}),t.jsx("h2",{className:"text-sm font-semibold text-aino-text",children:e("organization.title")})]}),t.jsx(i,{placeholder:e("organization.search_placeholder"),value:c,onChange:e=>l(e.target.value)})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 bg-aino-bg",children:t.jsxs(n,{children:[t.jsxs("table",{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:e("organization.table.col_name")}),t.jsx("th",{children:e("organization.table.col_domain")}),t.jsx("th",{children:e("organization.table.col_status")}),t.jsx("th",{children:e("organization.table.col_owner")}),t.jsx("th",{className:"text-right",children:e("organization.table.col_max_users")}),t.jsx("th",{className:"text-right",children:e("organization.table.col_created_at")})]})}),t.jsxs("tbody",{children:[u&&0===g.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"text-center text-aino-text-muted",children:e("organization.loading")})}),!u&&0===g.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"text-center text-aino-text-muted",children:e("organization.empty")})}),g.map(s=>t.jsx(p,{org:s,t:e},s.id))]})]}),t.jsx(n.Footer,{page:a,pageSize:o,total:f,onPageChange:d,label:e("pagination.showing",{from:N,to:b,total:f})})]})})]})})}function p({org:e,t:s}){const{i18n:n}=x(),r=s(`organization.status_${e.status}`),i=u[e.status]??"default",o=e.created_at?new Date(e.created_at).toLocaleDateString(n.language):"-";return t.jsxs("tr",{children:[t.jsx("td",{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0 bg-aino-accent-subtle",children:t.jsx(m,{className:"w-4 h-4 text-aino-accent"})}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"font-semibold truncate text-aino-text",children:e.display_name}),t.jsx("span",{className:"text-xs truncate mt-0.5 text-aino-text-muted",children:e.name})]})]})}),t.jsx("td",{children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(h,{className:"w-3.5 h-3.5 text-aino-text-muted shrink-0"}),t.jsxs("span",{className:"text-xs font-mono text-aino-text",children:[e.domain_slug,".",c()]})]})}),t.jsx("td",{children:t.jsx(a,{variant:i,pill:!0,size:"md",children:r})}),t.jsx("td",{children:t.jsx("span",{className:"text-sm text-aino-text",children:e.owner_email})}),t.jsx("td",{className:"text-right",children:t.jsx("span",{className:"text-sm text-aino-text",children:e.max_users})}),t.jsx("td",{className:"text-right",children:t.jsx("span",{className:"text-sm text-aino-text",children:o})})]})}export{g as OrganizationPage};
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.