1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{r as p}from"./vendor-react-E98sgxjj.js";import{b as te,a as ne}from"./vendor-query-bOUN_gKe.js";import{du as P}from"./vendor-fa-Bn2dnpnC.js";import{u as E,a6 as $,d as k,L as B,aj as C,a1 as j,J as re,K as oe,b as H,M as ae}from"./index-BKzE8EQ8.js";import{u as ie}from"./useLocaleNavigate-BNriJdRU.js";import{C as L,S as K}from"./SettingsRowCard--YUcmpPt.js";import"./plans-CbMJY2XS.js";import{B as de}from"./BillingStatusBanner-BNsUbBIW.js";import{i as le,u as ce,j as me,k as Q,l as ue,m as xe,f as pe,n as ge,p as be,o as fe}from"./organization-BuGhuc22.js";import{M as he}from"./MemberAvatar-CfukMFmI.js";import{U as T}from"./UsageBar-ChIMgZII.js";import{S as ve}from"./SettingsPageShell-wmP4-RpH.js";import"./Avatar-B60wpoS5.js";import"./MediaImage-DKgx-nW4.js";const je="h-9 w-full rounded-md border border-border bg-transparent px-3 text-sm text-foreground outline-none transition-colors focus:border-foreground/40";function Ne({open:s,onClose:m,memberName:n,current:t,companyDefault:d,saving:l,onSave:o}){const{t:r,i18n:i}=E("company"),[c,u]=p.useState(t==null),[x,y]=p.useState(t!=null?String(t):"");p.useEffect(()=>{s&&(u(t==null),y(t!=null?String(t):""))},[s,t]);const g=Number(x),b=c||x.trim()!==""&&Number.isInteger(g)&&g>=0,h=d==null?r("caps.defaultUnlimited"):r("caps.defaultIs",{value:d.toLocaleString(i.language)});return e.jsx($,{open:s,onClose:m,locked:l,title:r("caps.title",{name:n}),description:r("caps.description"),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",disabled:!b||l,onClick:()=>o(c?null:g),className:"h-10 cursor-pointer rounded-md bg-foreground px-4 text-sm text-background transition-opacity hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-40",children:r(l?"common.saving":"common.save")}),e.jsx("button",{type:"button",onClick:m,disabled:l,className:"h-10 cursor-pointer rounded-md bg-foreground
1/6 px-4 text-sm text-foreground transition-colors hover:bg-foreground/10",children:r("common.cancel")})]}),children:e.jsxs("fieldset",{className:"flex flex-col gap-3",children:[e.jsx("legend",{className:"sr-only",children:r("caps.title",{name:n})}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-md border border-border p-3",children:[e.jsx("input",{type:"radio",name:"cap-mode",checked:c,onChange:()=>u(!0),className:"mt-1 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm text-foreground",children:r("caps.useDefault")}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:h})]})]}),e.jsxs("label",{className:k("flex cursor-pointer items-start gap-3 rounded-md border border-border p-3"),children:[e.jsx("input",{type:"radio",name:"cap-mode",checked:!c,onChange:()=>u(!1),className:"mt-1 accent-accent"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm text-foreground",children:r("caps.custom")}),e.jsxs("span",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"number",inputMode:"numeric",min:0,step:1e3,value:x,disabled:c,onFocus:()=>u(!1),onChange:_=>y(_.target.value),"aria-label":r("caps.custom"),className:k(je,"max-w-[180px] disabled:opacity-50")}),e.jsx("span",{className:"text-sm text-muted-foreground",children:r("caps.perMonth")})]})]})]})]})})}function G({value:s,onChange:m,roles:n,labelFor:t,label:d,disabled:l,className:o}){const{t:r}=E("company");return e.jsxs("span",{className:k("relative inline-block",o),children:[e.jsx("select",{value:s,"aria-label":d,disabled:l,onChange:i=>m(i.target.value),className:"h-8 w-full cursor-pointer appearance-none rounded-md border border-border bg-transparent pl-2.5 pr-8 text-sm text-foreground outline-none transition-colors hover:border-border-hover focus:border-foreground
1/40 disabled:cursor-not-allowed disabled:opacity-50",children:n.map(i=>e.jsx("option",{value:i,children:t?t(i):r(`roles.${i}`)},i))}),e.jsx(P,{icon:["far","chevron-down"],className:"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground","aria-hidden":!0})]})}const ye=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,we=["member","admin","admin_no_seat"],Se={member:"invite.memberHint",admin:"invite.adminHint",admin_no_seat:"invite.adminNoSeatHint"};function _e({open:s,onClose:m,org:n}){const{t}=E("company"),[d,l]=p.useState(""),[o,r]=p.useState("member"),[i,c]=p.useState(null),u=le();p.useEffect(()=>{s&&(l(""),r("member"),c(null),u.reset())},[s]);const{seat_limit:x,seats_used:y,pending_invites:g}=n.billing,b=Math.max(0,x-y-g),h=o!=="admin_no_seat",_=h&&b===0,w=n.email_domains,I=w.map(v=>`@${v}`).join(", "),S=d.trim().toLowerCase(),M=!S.includes("@")||w.length===0||w.some(v=>S.endsWith(`@${v.toLowerCase()}`)),A=()=>{if(!ye.test(S)){c(t("invite.invalidEmail"));return}if(!M){c(t("errors.email_domain_not_allowed",{domains:I}));return}c(null),u.mutate({email:S,role:o==="member"?"member":"admin",uses_seat:h},{onSuccess:()=>{j.success(t("invite.sent",{email:S})),m()},onError:v=>c(C(t,v,t("common.somethingWrong"),{domains:I,org:n.name}))})};return e.jsx($,{open:s,onClose:m,locked:u.isPending,title:t("invite.title",{org:n.name}),description:t("invite.description"),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"submit",form:"org-invite-form",disabled:u.isPending||_||!S,className:"h-10 cursor-pointer rounded-md bg-foreground px-4 text-sm text-background transition-opacity hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-40",children:u.isPending?t("invite.sending"):t("invite.send")}),e.jsx("button",{type:"button",onClick:m,disabled:u.isPending,className:"h-10 cursor-pointer rounded-md bg-foreground
1/6 px-4 text-sm text-foreground transition-colors hover:bg-foreground/10",children:t("common.cancel")})]}),children:e.jsxs("form",{id:"org-invite-form",className:"flex flex-col gap-4",onSubmit:v=>{v.preventDefault(),A()},noValidate:!0,children:[e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("invite.email")}),e.jsx("input",{type:"email",autoFocus:!0,autoComplete:"off",value:d,onChange:v=>{l(v.target.value),c(null)},placeholder:w[0]?`name@${w[0]}`:"[email protected]","aria-invalid":!!i||!M,"aria-describedby":"org-invite-hint",className:k("h-9 w-full rounded-md border bg-transparent px-3 text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground/60",i||!M?"border-destructive/60 focus:border-destructive":"border-border focus:border-foreground/40")}),w.length>0&&e.jsx("span",{id:"org-invite-hint",className:"text-xs text-muted-foreground",children:t("invite.domainHint",{domains:I})})]}),e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("invite.role")}),e.jsx(G,{value:o,onChange:r,roles:we,labelFor:v=>t(v==="admin_no_seat"?"roles.adminNoSeat":`roles.${v}`),label:t("invite.role"),className:"w-full"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t(Se[o])})]}),e.jsxs("p",{className:k("text-sm",_?"text-destructive":"text-muted-foreground"),children:[h?b===0?t("invite.noSeats",{limit:x}):t("invite.seatsLeft",{left:b,limit:x}):t("invite.noSeatNeeded"),_&&e.jsxs(e.Fragment,{children:[" ",e.jsx(B,{to:"/settings/company/billing",onClick:m,className:"text-foreground underline decoration-foreground/30 hover:decoration-foreground",children:t("invite.addSeats")})]})]}),i&&e.jsx("p",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/8 p-3 text-sm text-destructive",children:i})]})})}function Ce({open:s,onClose:m,orgName:n,member:t,recipients:d,defaultRecipientId:l,removing:o,error:r,onConfirm:i}){const{t:c}=E("company"),[u,x]=p.useState(l);p.useEffect(()=>{s&&x(l)},[s,l]);const y=t?t.user.name||t.user.username:"",g=t?.games_count??0;return e.jsxs($,{open:s,onClose:m,locked:o,title:c("remove.title",{name:y,org:n}),description:c("remove.description",{org:n}),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>i(u),disabled:o||!t,className:"h-10 cursor-pointer rounded-md bg-red-500/10 px-4 text-sm text-red-400 transition-colors hover:bg-red-500/15 disabled:cursor-not-allowed disabled:opacity-50",children:c(o?"remove.removing":"remove.confirm")}),e.jsx("button",{type:"button",onClick:m,disabled:o,className:"h-10 cursor-pointer rounded-md bg-foreground
1/6 px-4 text-sm text-foreground transition-colors hover:bg-foreground/10",children:c("common.cancel")})]}),children:[e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:g>0?c("remove.transferLabelCount",{games:g}):c("remove.transferLabel")}),e.jsxs("span",{className:"relative block",children:[e.jsx("select",{value:u,onChange:b=>x(Number(b.target.value)),className:"h-9 w-full cursor-pointer appearance-none rounded-md border border-border bg-transparent px-3 pr-9 text-sm text-foreground outline-none focus:border-foreground/40",children:d.map(b=>e.jsxs("option",{value:b.id,children:[b.user.name||b.user.username,b.id===l?` (${c("common.you")})`:""]},b.id))}),e.jsx(P,{icon:["far","chevron-down"],className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted-foreground","aria-hidden":!0})]})]}),r&&e.jsx("p",{role:"alert",className:"mt-4 rounded-md border border-destructive/30 bg-destructive/8 p-3 text-sm text-destructive",children:r})]})}function ke({items:s,label:m}){const[n,t]=p.useState(!1),d=p.useRef(null),l=p.useId();return p.useEffect(()=>{if(!n)return;const o=i=>{d.current&&!d.current.contains(i.target)&&t(!1)},r=i=>{i.key==="Escape"&&t(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",r),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",r)}},[n]),s.length===0?e.jsx("span",{className:"block size-8","aria-hidden":!0}):e.jsxs("div",{ref:d,className:"relative",children:[e.jsx("button",{type:"button","aria-label":m,"aria-haspopup":"menu","aria-expanded":n,"aria-controls":l,onClick:()=>t(o=>!o),className:"flex size-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-foreground
1/6 hover:text-foreground",children:e.jsx(P,{icon:["far","ellipsis"],"aria-hidden":!0})}),e.jsx("div",{id:l,role:"menu",className:k("absolute right-0 top-full z-30 mt-1 min-w-[200px] rounded-md border border-border bg-card p-1.5 shadow-xl transition-all duration-150",n?"scale-100 opacity-100":"pointer-events-none scale-95 opacity-0"),children:s.map(o=>e.jsxs("button",{type:"button",role:"menuitem",tabIndex:n?0:-1,disabled:o.disabled,onClick:()=>{t(!1),o.onSelect()},className:k("flex w-full cursor-pointer items-center gap-2 whitespace-nowrap rounded-sm px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40",o.destructive?"text-red-400 hover:bg-red-500/8 hover:text-red-300":"text-muted-foreground hover:bg-foreground/3 hover:text-foreground"),children:[e.jsx(P,{icon:["far",o.icon],className:"w-4 text-sm","aria-hidden":!0}),o.label]},o.label))})]})}function Ge(){const{t:s,i18n:m}=E("company"),n=re(),t=oe(),d=ce(),l=me(),o=Q(),r=d.data,i=l.data,[c,u]=p.useState(!1),[x,y]=p.useState(null),[g,b]=p.useState(null),[h,_]=p.useState(null),w=ue(),I=xe(),S=r?.my_membership_id??-1,M=r?.my_role??n?.role??"member",A=i?.filter(a=>a.role==="owner").length??0,v=a=>a.toLocaleString(m.language),J=p.useMemo(()=>{const a={owner:0,admin:1,member:2};return[...i??[]].sort((f,N)=>+(N.id===S)-+(f.id===S)||a[f.role]-a[N.role]||(f.user.name||f.user.username).localeCompare(N.user.n
1ame||N.user.username))},[i,S]),X=(a,f)=>{const N=f==="member"&&a.uses_seat===!1?{role:f,uses_seat:!0}:{role:f};w.mutate({id:a.id,data:N},{onSuccess:()=>j.success(s("members.roleUpdated",{name:F(a),role:s(`roles.${f}`)})),onError:R=>j.error(C(s,R,s("common.saveFailed")))})},D=(a,f)=>{w.mutate({id:a.id,data:{uses_seat:f}},{onSuccess:()=>j.success(s(f?"members.seatGiven":"members.seatRemoved",{name:F(a)})),onError:N=>j.error(C(s,N,s("common.saveFailed")))})},Y=a=>{x&&w.mutate({id:x.id,data:{monthly_credit_cap:a}},{onSuccess:()=>{j.success(s("caps.saved",{name:F(x)})),y(null)},onError:f=>j.error(C(s,f,s("common.saveFailed")))})},Z=a=>{g&&(_(null),I.mutate({id:g.id,transferTo:a},{onSuccess:()=>{j.success(s("remove.done",{name:F(g)})),b(null)},onError:f=>_(C(s,f,s("common.somethingWrong")))}))},z=r?.name??n?.name??"";return e.jsxs(ve,{title:s("members.pageTitle",{org:z}),heading:z,subtitle:s("members.subtitle"),midWide:!0,children:[r&&e.jsx(de,{org:r,isAdmin:t,className:"mb-6"}),e.jsx("section",{className:"mb-8",children:r?e.jsx(Ee,{org:r,isAdmin:t}):e.jsx(Fe,{failed:d.isError,onRetry:()=>d.refetch()})}),e.jsxs("section",{className:"mb-8",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[e.jsx("h2",{className:"text-lg text-foreground",children:s("members.heading")}),t&&r&&e.jsxs(L,{tone:"primary",onClick:()=>u(!0),children:[e.jsx(P,{icon:["far","user-plus"],className:"text-sm","aria-hidden":!0}),s("members.invite")]})]}),e.jsxs("div",{className:"rounded-md border border-border bg-card",children:[e.jsxs("div",{className:k("hidden border-b border-border px-4 py-3 text-xs text-muted-foreground md:grid md:gap-4",t?"md:grid-cols-[minmax(0,1.6fr)_140px_minmax(0,1fr)_32px]":"md:grid-cols-[minmax(0,1.6fr)_140px_100px]"),children:[e.jsx("span",{children:s("members.colMember")}),e.jsx("span",{children:s("members.colRole")}),t?e.jsx("span",{children:s("members.colCredits")}):e.jsx("span",{className:"text-right",children:s("members.colGames")}),t&&e.jsx("span",{className:"sr-only",children:s("members.colActions")})]}),l.isLoading&&e.jsx(Ie,{}),l.isError&&e.jsx(V,{message:s("common.loadFailed"),onRetry:()=>l.refetch(),retryLabel:s("common.retry")}),e.jsx("ul",{children:J.map(a=>{const f=a.id===S,N=F(a),R=t&&!f&&(M==="owner"||a.role!=="owner"),ee=M==="owner"?["owner","admin","member"]:a.role==="owner"?["owner"]:["admin","member"],W=a.credits_used_this_cycle??0,U=a.effective_monthly_cap,O=a.uses_seat===!1,se=R&&a.role!=="member";return e.jsxs("li",{className:k("grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-3 border-b border-border px-4 py-3 last:border-b-0",t?"md:grid-cols-[minmax(0,1.6fr)_140px_minmax(0,1fr)_32px]":"md:grid-cols-[minmax(0,1.6fr)_140px_100px]"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(he,{user:a.user}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"flex items-center gap-2 truncate text-sm text-foreground",children:[e.jsx("span",{className:"truncate",children:N}
1),f&&e.jsx("span",{className:"shrink-0 rounded-sm bg-foreground/6 px-1.5 py-px text-[11px] text-muted-foreground",children:s("common.you")}),O&&e.jsx("span",{className:"shrink-0 rounded-sm border border-border px-1.5 py-px text-[11px] text-muted-foreground",children:s("members.noSeat")})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.user.email||`@${a.user.username}`})]})]}),e.jsx("div",{className:"order-last col-span-2 md:order-none md:col-span-1",children:R?e.jsx(G,{value:a.role,roles:ee,label:s("members.roleFor",{name:N}),disabled:w.isPending,onChange:q=>q!==a.role&&X(a,q),className:"w-full md:w-[140px]"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:s(`roles.${a.role}`)})}),t?e.jsx("div",{className:"order-last col-span-2 min-w-0 md:order-none md:col-span-1",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("members.noSeatCredits")}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-foreground",children:[v(W),e.jsxs("span",{className:"text-muted-foreground",children:[" / ",U==null?s("caps.noCap"):v(U)]})]}),U!=null&&e.jsx(T,{used:W,limit:U,label:s("members.capFor",{name:N}),className:"mt-1.5 max-w-[220px]"})]})}):e.jsxs("p",{className:"text-sm text-muted-foreground md:text-right",children:[e.jsxs("span",{className:"md:hidden",children:[s("members.colGames"),": "]}),a.games_count]}),t&&e.jsx("div",{className:"row-start-1 col-start-2 justify-self-end md:row-auto md:col-auto",children:e.jsx(ke,{label:s("members.actionsFor",{name:N}),items:[...O?[]:[{label:s("caps.set"),icon:"gauge",onSelect:()=>y(a)}],...se?[O?{label:s("members.giveSeat"),icon:"user-check",onSelect:()=>D(a,!0)}:{label:s("members.removeSeat"),icon:"user-gear",onSelect:()=>D(a,!1)}]:[],...R?[{label:s("remove.menu"),icon:"user-minus",destructive:!0,onSelect:()=>{_(null),b(a)}}]:[]]})})]},a.id)})})]})]}),t&&(o.data?.length??0)>0&&e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-lg text-foreground",children:s("pendingInvites.heading")}),e.jsx(Me,{})]}),r&&i&&e.jsx(Le,{org:r,isLastOwner:M==="owner"&&A<=1}),r&&e.jsx(_e,{open:c,onClose:()=>u(!1),org:r}),e.jsx(Ne,{open:!!x,onClose:()=>y(null),memberName:x?F(x):"",current:x?.monthly_credit_cap??null,companyDefault:r?.policies.default_member_credit_cap??null,saving:w.isPending,onSave:Y}),e.jsx(Ce,{open:!!g,onClose:()=>b(null),orgName:z,member:g,recipients:(i??[]).filter(a=>a.id!==g?.id&&a.status==="active"),defaultRecipientId:S,removing:I.isPending,error:h,onConfirm:Z})]})}function F(s){return s.user.name||s.user.username}function Ee({org:s,isAdmin:m}){const{t:n}=E("company"),[t,d]=p.useState(!1),[l,o]=p.useState(s.name),r=pe(),{refreshUser:i}=H(),{seat_limit:c,seats_used:u,pending_invites:x}=s.billing,y=s.billing.plan.charAt(0).toUpperCase()+s.billing.plan.slice(1),g=l.trim(),b=()=>{if(!g||g===s.name){d(!1);return}r.mutate({name:g},{onSuccess:()=>{d(!1),j.success(n("overview.renamed")),i()},onError:h=>j.error(C(n,h,n("common.saveFailed")))})};return e.jsxs(K,{title:t?e.jsxs("form",{className:"flex items-center gap-2",onSubmit:h=>{h.preventDefault(),b()},children:[e.jsx("input",{autoFocus:!0,value:l,maxLength:80,"aria-label":n("overview.nameLabel"),onChange:h=>o(h.target.value),onKeyDown:h=>h.key==="Escape"&&d(!1),className:"h-9 w-full max-w-xs rounded-md border border-border bg-transparent px-3 text-sm text-foreground outline-none focus:border-foreground
1/40"}),e.jsx(L,{tone:"secondary",type:"submit",disabled:r.isPending||!g,children:r.isPending?n("common.saving"):n("common.save")}),e.jsx(L,{tone:"quiet",onClick:()=>d(!1),disabled:r.isPending,children:n("common.cancel")})]}):s.name,description:t?void 0:n("overview.planLine",{plan:y,domains:s.email_domains.map(h=>`@${h}`).join(", ")}),action:m&&!t?e.jsx(L,{tone:"quiet",onClick:()=>{o(s.name),d(!0)},children:n("overview.rename")}):void 0,children:[e.jsx("div",{className:"my-4 h-px bg-border","aria-hidden":!0}),e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[n("overview.seatsUsed",{used:u,limit:c}),x>0&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",n("overview.pendingInvites",{pending:x})]}),(s.billing.admins_without_seat??0)>0&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",n("overview.adminsWithoutSeat",{count:s.billing.admins_without_seat})]})]}),m&&e.jsx(B,{to:"/settings/company/billing",className:"text-sm text-muted-foreground transition-colors hover:text-foreground",children:n("overview.manageSeats")})]}),e.jsx(T,{used:u+x,limit:c,label:n("overview.seatsLabel"),size:"md",className:"mt-3"}),s.billing.pending_seat_limit!=null&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:n("overview.pendingSeatChange",{seats:s.billing.pending_seat_limit})})]})}function Me(){const{t:s,i18n:m}=E("company"),{data:n}=Q(),t=ge(),d=be(),l=o=>o?new Date(o).toLocaleDateString(m.language,{month:"short",day:"numeric"}):"â";return e.jsx("ul",{className:"rounded-md border border-border bg-card",children:(n??[]).map(o=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-border px-4 py-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-foreground
1/6 text-muted-foreground",children:e.jsx(P,{icon:["far","envelope"],className:"text-xs","aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-foreground",children:o.email}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("pendingInvites.meta",{role:s(o.uses_seat===!1?"roles.adminNoSeat":`roles.${o.role}`),by:o.invited_by?.username??"â",date:l(o.expires_at)})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{tone:"quiet",disabled:t.isPending&&t.variables===o.id,onClick:()=>t.mutate(o.id,{onSuccess:()=>j.success(s("pendingInvites.resent",{email:o.email})),onError:r=>j.error(C(s,r,s("common.somethingWrong")))}),children:s("pendingInvites.resend")}),e.jsx(L,{tone:"quiet",disabled:d.isPending&&d.variables===o.id,onClick:()=>d.mutate(o.id,{onSuccess:()=>j.success(s("pendingInvites.revoked",{email:o.email})),onError:r=>j.error(C(s,r,s("common.somethingWrong")))}),children:s("pendingInvites.revoke")})]})]},o.id))})}function Le({org:s,isLastOwner:m}){const{t:n}=E("company"),{refreshUser:t}=H(),d=ie(),l=te(),[o,r]=p.useState(!1),[i,c]=p.useState(null),u=ne({mutationFn:ae.leave,onSuccess:async()=>{r(!1),l.removeQueries({queryKey:fe.all}),await t().catch(()=>{}),j.success(n("leave.done",{org:s.name})),d("/settings/account",{replace:!0})},onError:x=>c(C(n,x,n("common.somethingWrong")))});return e.jsxs("section",{children:[e.jsx(K,{title:n("leave.title",{org:s.name}),description:m?n("leave.lastOwner"):n("leave.description",{org:s.name}),action:e.jsx("button",{type:"button",disabled:m,onClick:()=>{c(null),r(!0)},className:"h-9 cursor-pointer rounded-md bg-red-500/8 px-3 text-sm text-red-400 transition-colors hover:bg-red-500/12 disabled:cursor-not-allowed disabled:opacity-40",children:n("leave.button")})}),e.jsx($,{open:o,onClose:()=>r(!1),locked:u.isPending,title:n("leave.confirmTitle",{org:s.name}),description:n("leave.confirmBody",{org:s.name}),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>u.mutate(),disabled:u.isPending,className:"h-10 cursor-pointer rounded-md bg-red-500/10 px-4 text-sm text-red-400 transition-colors hover:bg-red-500/15 disabled:opacity-50",children:u.isPending?n("leave.leaving"):n("leave.confirm")}),e.jsx("button",{type:"button",onClick:()=>r(!1),disabled:u.isPending,className:"h-10 cursor-pointer rounded-md bg-foreground
1/6 px-4 text-sm text-foreground transition-colors hover:bg-foreground/10",children:n("common.cancel")})]}),children:i&&e.jsx("p",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/8 p-3 text-sm text-destructive",children:i})})]})}function Ie(){return e.jsx("div",{className:"space-y-2 p-4","aria-hidden":!0,children:[0,1,2,3].map(s=>e.jsx("div",{className:"h-10 animate-pulse rounded bg-foreground/10"},s))})}function Fe({failed:s,onRetry:m}){const{t:n}=E("company");return s?e.jsx("div",{className:"rounded-md border border-border bg-card",children:e.jsx(V,{message:n("common.loadFailed"),onRetry:m,retryLabel:n("common.retry")})}):e.jsx("div",{className:"h-40 animate-pulse rounded-md border border-border bg-card","aria-hidden":!0})}function V({message:s,onRetry:m,retryLabel:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e.jsx(L,{tone:"quiet",onClick:m,children:n})]})}export{Ge as default};
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.