1import{c as _,k as v,g as Ct,h as ae,u as re,a as _t,r as s,j as t,B as Xe,X as oe,ae as Et}from"./index-DFhUiiAX.js";import{P as Pt}from"./password-dialog-jHNmh4_c.js";import{T as J}from"./table-pagination-BYjNZLec.js";import{P as It}from"./plus-An2xpF0B.js";import{S as U}from"./search-4XzxSTCG.js";import{S as At}from"./shield-check-BOVzWjvQ.js";import{K as $t}from"./key-round-B1W9NFox.js";import{M as Tt}from"./mail-DyrfiXtA.js";import{C as Lt}from"./check-BquVfFDY.js";const Mt=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]],Dt=_("mail-x",Mt);const Ut=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ge=_("refresh-cw",Ut);const zt=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],Je=_("slash",zt);const Ot=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Qe=_("triangle-alert",Ot);const Bt=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ft=_("user-check",Bt);const Vt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],Ht=_("user-x",Vt);function j(){const e=Ct();if(!e)throw new ae("unauthorized","Sesión no válida.",401);return e}function ie(e){const a=new URLSearchParams;for(const[o,i]of Object.entries(e))i==null||i===""||a.set(o,String(i));const r=a.toString();return r?`?${r}`:""}const Kt={async summary(e){return v("/web-admin/access-management/summary",{token:j(),signal:e})}},Q={async list(e={},a){return v(`/web-admin/users${ie({...e})}`,{token:j(),signal:a})},async changeStatus(e,a){return v(`/web-admin/users/${e}/estado`,{method:"PATCH",token:j(),body:{enabled:a}})},async resetPassword(e,a){await v(`/web-admin/users/${e}/reset-password`,{method:"POST",token:j(),body:{password:a,password_confirmation:a}})}},M={async list(e={},a){return v(`/web-admin/user-invitations${ie({...e})}`,{token:j(),signal:a})},async create(e){return v("/web-admin/user-invitations",{method:"POST",token:j(),body:{name:e.name,lastname:e.lastname,email:e.email,phone:e.phone??null,company:e.company??null}})},async resend(e){return v(`/web-admin/user-invitations/${e}/resend`,{method:"POST",token:j()})},async revoke(e){return v(`/web-admin/user-invitations/${e}/revoke`,{method:"POST",token:j()})}},W={async list(e={},a){return v(`/web-admin/access-requests${ie({...e})}`,{token:j(),signal:a})},async approve(e){return v(`/web-admin/access-requests/${e}/approve`,{method:"POST",token:j()})},async reject(e,a){return v(`/web-admin/access-requests/${e}/reject`,{method:"POST",token:j(),body:{reason:a}})}},R={usersView:"users.view",usersChangeStatus:"users.change_status",usersResetPassword:"users.reset_password",accessRequestsView:"access_requests.view",accessRequestsManage:"access_requests.manage",invitationsManage:"user_invitations.manage"},Y=15;function w(e,a){return(e instanceof ae||e instanceof Error)&&e.message||a}function Xt(e){if(!(e instanceof ae)||!e.errors)return{};const a={};for(const[r,o]of Object.entries(e.errors))Array.isArray(o)&&typeof o[0]=="string"?a[r]=o[0]:typeof o=="string"&&(a[r]=o);return a}function Z(e,a=400){const[r,o]=s.useState(e);return s.useEffect(()=>{const i=setTimeout(()=>o(e),a);return()=>clearTimeout(i)},[e,a]),r}function cn(){const{t:e}=re(),{user:a}=_t(),r=s.useMemo(()=>a?.permissions??[],[a]),o=s.useCallback(n=>r.includes(n),[r]),i=o(R.usersView),u=o(R.usersChangeStatus),f=o(R.usersResetPassword),p=o(R.accessRequestsView),x=o(R.accessRequestsManage),l=o(R.invitationsManage),b=s.useMemo(()=>{const n=[];return i&&n.push("usuarios"),l&&n.push("invitaciones"),p&&n.push("solicitudes"),n},[i,l,p]),[m,c]=s.useState("usuarios");s.useEffect(()=>{b.length&&!b.includes(m)&&c(b[0])},[b,m]);const[g,ce]=s.useState(null),E=s.useRef(null),h=s.useCallback((n,d="ok")=>{ce({text:n,tone:d}),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>ce(null),4200)},[]);s.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const[y,le]=s.useState(null),[q,ue]=s.useState(i),[me,pe]=s.useState(null),N=s.useCallback(async()=>
1{if(i){ue(!0),pe(null);try{le(await Kt.summary())}catch(n){le(null),pe(w(n,e("content.admin.equipo.errorResumen")))}finally{ue(!1)}}},[i,e]);s.useEffect(()=>{N()},[N]);const[xe,be]=s.useState([]),[We,fe]=s.useState(!1),[ge,he]=s.useState(null),[z,ve]=s.useState(1),[Ye,Ze]=s.useState(1),[et,tt]=s.useState(0),[je,nt]=s.useState(""),O=Z(je),[P,st]=s.useState("all"),[at,rt]=s.useState(0);s.useEffect(()=>{ve(1)},[O,P]),s.useEffect(()=>{if(!i)return;const n=new AbortController;return fe(!0),he(null),Q.list({page:z,per_page:Y,search:O||void 0,estado:P==="all"?void 0:P,sort_by:"name",sort_dir:"asc"},n.signal).then(d=>{be(d.data??[]),Ze(d.last_page??1),tt(d.total??0)}).catch(d=>{d instanceof DOMException&&d.name==="AbortError"||(be([]),he(w(d,e("content.admin.equipo.errorUsuarios"))))}).finally(()=>fe(!1)),()=>n.abort()},[i,z,O,P,at,e]);const ye=s.useCallback(()=>rt(n=>n+1),[]),[we,Ne]=s.useState([]),[ot,qe]=s.useState(!1),[ke,Se]=s.useState(null),[B,Re]=s.useState(1),[it,dt]=s.useState(1),[Ce,ct]=s.useState(""),F=Z(Ce),[I,lt]=s.useState("all"),[ut,mt]=s.useState(0);s.useEffect(()=>{Re(1)},[F,I]),s.useEffect(()=>{if(!l)return;const n=new AbortController;return qe(!0),Se(null),M.list({page:B,per_page:Y,search:F||void 0,status:I==="all"?void 0:I},n.signal).then(d=>{Ne(d.items??[]),dt(d.meta?.last_page??1)}).catch(d=>{d instanceof DOMException&&d.name==="AbortError"||(Ne([]),Se(w(d,e("content.admin.equipo.errorInvitaciones"))))}).finally(()=>qe(!1)),()=>n.abort()},[l,B,F,I,ut,e]);const A=s.useCallback(()=>mt(n=>n+1),[]),[_e,Ee]=s.useState([]),[pt,Pe]=s.useState(!1),[Ie,Ae]=s.useState(null),[V,$e]=s.useState(1),[xt,bt]=s.useState(1),[Te,ft]=s.useState(""),H=Z(Te),[$,gt]=s.useState("pending"),[ht,vt]=s.useState(0);s.useEffect(()=>{$e(1)},[H,$]),s.useEffect(()=>{if(!p)return;const n=new AbortController;return Pe(!0),Ae(null),W.list({page:V,per_page:Y,search:H||void 0,status:$==="all"?void 0:$},n.signal).then(d=>{Ee(d.items??[]),bt(d.meta?.last_page??1)}).catch(d=>{d instanceof DOMException&&d.name==="AbortError"||(Ee([]),Ae(w(d,e("content.admin.equipo.errorSolicitudes"))))}).finally(()=>Pe(!1)),()=>n.abort()},[p,V,H,$,ht,e]);const K=s.useCallback(()=>vt(n=>n+1),[]),[Le,Me]=s.useState(null),[De,Ue]=s.useState(null),[ze,Oe]=s.useState(null),[Be,Fe]=s.useState(null),[jt,Ve]=s.useState(null),[T,He]=s.useState(null),[yt,X]=s.useState(!1),[L,G]=s.useState(null),Ke=async(n,d)=>{if(Le===null){Me(n.id);try{await Q.changeStatus(n.id,d),h(e(d?"content.admin.equipo.toastAccessActivated":"content.admin.equipo.toastAccessSuspended"),d?"ok":"warn"),ye(),N()}catch(Rt){h(w(Rt,e("content.admin.equipo.errorEstado")),"error")}finally{Me(null)}}},wt=async n=>{if(!De){Ue(n.id);try{const d=await M.resend(n.id);h(d.email_sent?e("content.admin.equipo.toastInviteResent"):e("content.admin.equipo.warnEmailNotSent"),d.email_sent?"ok":"warn"),A(),N()}catch(d){h(w(d,e("content.admin.equipo.errorReenvio")),"error")}finally{Ue(null)}}},Nt=async n=>{if(!ze){Oe(n.id);try{await M.revoke(n.id),h(e("content.admin.equipo.toastInviteRevoked"),"warn"),A(),N()}catch(d){h(w(d,e("content.admin.equipo.errorRevocar")),"error")}finally{Oe(null)}}},qt=async n=>{if(!Be){Fe(n.id);try{const d=await W.approve(n.id);h(d.email_sent?e("content.admin.equipo.toastRequestApproved"):e("content.admin.equipo.warnEmailNotSent"),d.email_sent?"ok":"warn"),K(),A(),N()}catch(d){h(w(d,e("content.admin.equipo.errorAprobar")),"error")}finally{Fe(null)}}},kt=async(n,d)=>{Ve(n.id);try{await W.reject(n.id,d),h(e("content.admin.equipo.toastRequestRejected"),"warn"),G(null),K(),N()}finally{Ve(null)}},St=async n=>{const d=await M.create(n);X(!1),h(d.email_sent?e("content.admin.equipo.toastInviteSent"):e("content.admin.equipo.warnEmailNotSent"),d.email_sent?"ok":"warn"),A(),N(),c("invitaciones")};return b.length===0?t.jsxs("div",{className:"border border-border bg-background p-12 text-center",children:[t.jsx("div",{className:"mx-auto grid h-12 w-12 place-items-center rounded-full bg-secondary text-muted-foreground",children:t.jsx(Je,{className:"h-5 w-5"})}),t.jsx("div",{className:"mt-4 font-display text-xl",children:e("content.admin.equipo.sinPermisosTitle")}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:e("content.admin.equipo.sinPermisosDesc")})]}):t.jsxs("div",{className:"space-y-8",children:[t.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-6",children:[t.jsxs("div",{className:"max-w-2xl min-w-0",children:[t.jsx("div",{className:"eyebrow",children:e("content.admin.equipo.eyebrow")}),t.jsx("h1",{className:"mt-2 font-display text-3xl md:text-4xl",children:e("content.admin.equipo.title")}),t.jsx("p",{className:"mt-3 text-sm text-muted-foreground md:text-base",children:e("content.admin.equipo.description")})]}),l&&t.jsxs("button",{onClick:()=>X(!0),className:"inline-flex h-11 items-center gap-2 bg-bafre-red px-5 text-xs font-medium uppercase tracking-[0.25em] text-bone transition hover:bg-bafre-red/90",children:[t.jsx(It,{className:"h-4 w-4"}),e("content.admin.equipo.btnInvitar")]})]}),i&&(me?t.jsx(D,{message:me,onRetry:()=>{N()},retryLabel:e("content.admin.equipo.reintentar")}
1):t.jsxs("div",{className:"grid gap-3 grid-cols-2 md:grid-cols-4 xl:grid-cols-7",children:[t.jsx(k,{k:e("content.admin.equipo.kpiCuentas"),v:y?.users.total,loading:q}),t.jsx(k,{k:e("content.admin.equipo.kpiActivos"),v:y?.users.active,loading:q,accent:!0}),t.jsx(k,{k:e("content.admin.equipo.kpiSuspendidos"),v:y?.users.suspended,loading:q}),t.jsx(k,{k:e("content.admin.equipo.kpiAdmins"),v:y?.users.administrators,loading:q,compactLabel:!0}),t.jsx(k,{k:e("content.admin.equipo.kpiPremiumPartners"),v:y?.users.premium_partners,loading:q}),t.jsx(k,{k:e("content.admin.equipo.kpiInvitacionesPendientes"),v:y?.invitations.pending,loading:q,warn:!0}),t.jsx(k,{k:e("content.admin.equipo.kpiSolicitudesPendientes"),v:y?.access_requests.pending,loading:q,warn:!0})]})),t.jsx("div",{className:"flex flex-wrap items-center gap-2 border-b border-border",children:b.map(n=>t.jsx("button",{onClick:()=>c(n),className:`-mb-px border-b-2 px-3 py-2 text-[11px] font-mono uppercase tracking-widest transition ${m===n?"border-bafre-red text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:e(`content.admin.equipo.tab.${n}`)},n))}),m==="usuarios"&&i&&t.jsxs("section",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3 border border-border bg-background p-3",children:[t.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[t.jsx(U,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t.jsx("input",{value:je,onChange:n=>nt(n.target.value),placeholder:e("content.admin.equipo.searchPlaceholder"),className:"h-10 w-full border border-border bg-background pl-9 pr-3 text-sm focus:outline-none focus:border-foreground"})]}),t.jsx(te,{value:P,onChange:st,options:[{value:"all",label:e("content.admin.equipo.filterEstado")},{value:"activo",label:e("content.admin.equipo.filterActivos")},{value:"suspendido",label:e("content.admin.equipo.filterSuspendidos")}]})]}),We?t.jsx(ne,{label:e("content.admin.equipo.loading")}):ge?t.jsx(D,{message:ge,onRetry:ye,retryLabel:e("content.admin.equipo.reintentar")}):xe.length===0?t.jsx(se,{title:e("content.admin.equipo.noResults"),desc:e("content.admin.equipo.noResultsDesc")}):t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"divide-y divide-border border border-border bg-background",children:xe.map(n=>t.jsx(Gt,{user:n,busy:Le===n.id,canChangeStatus:u,canResetPassword:f,labels:{activo:e("content.admin.equipo.statusActivo"),suspendido:e("content.admin.equipo.statusSuspendido"),activar:e("content.admin.equipo.actionActivar"),activarAcceso:e("content.admin.equipo.actionActivarAcceso"),suspender:e("content.admin.equipo.actionSuspender"),suspenderAcceso:e("content.admin.equipo.actionSuspenderAcceso"),resetear:e("content.admin.equipo.actionResetearPassword")},onActivate:()=>{Ke(n,!0)},onSuspend:()=>{Ke(n,!1)},onResetPassword:()=>He(n)},n.id))}),t.jsx(J,{page:z,lastPage:Ye,total:et,onPage:ve,prev:e("content.admin.equipo.anterior"),next:e("content.admin.equipo.siguiente"),label:e("content.admin.equipo.paginaDe")})]})]}),m==="invitaciones"&&l&&t.jsxs("section",{className:"space-y-4",children:[y&&y.invitations.email_failed>0&&t.jsxs("div",{className:"flex items-center gap-3 border border-bafre-red/40 bg-bafre-red/5 px-4 py-3 text-sm text-bafre-red",children:[t.jsx(Qe,{className:"h-4 w-4 flex-none"}),t.jsx("span",{children:e("content.admin.equipo.alertEmailFailed").replace("{n}",String(y.invitations.email_failed))})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3 border border-border bg-background p-3",children:[t.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[t.jsx(U,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t.jsx("input",{value:Ce,onChange:n=>ct(n.target.value),placeholder:e("content.admin.equipo.searchInvitacionesPlaceholder"),className:"h-10 w-full border border-border bg-background pl-9 pr-3 text-sm focus:outline-none focus:border-foreground"})]}),t.jsx(te,{value:I,onChange:lt,options:[{value:"all",label:e("content.admin.equipo.filterEstado")},{value:"pending",label:e("content.admin.equipo.invStatusPending")},{value:"accepted",label:e("content.admin.equipo.invStatusAccepted")},{value:"expired",label:e("content.admin.equipo.invStatusExpired")},{value:"revoked",label:e("content.admin.equipo.invStatusRevoked")}]})]}),ot?t.jsx(ne,{label:e("content.admin.equipo.loadingInvitaciones")}):ke?t.jsx(D,{message:ke,onRetry:A,retryLabel:e("content.admin.equipo.reintentar")}
1):we.length===0?t.jsx(se,{title:e("content.admin.equipo.emptyInvitaciones"),desc:e("content.admin.equipo.emptyInvitacionesDesc")}):t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"divide-y divide-border border border-border bg-background",children:we.map(n=>t.jsx(Jt,{invitation:n,resending:De===n.id,revoking:ze===n.id,statusLabel:e(`content.admin.equipo.invStatus${ee(n.status)}`),emailLabel:e(`content.admin.equipo.emailStatus${ee(n.email_delivery?.status??"unknown")}`),resendLabel:e("content.admin.equipo.actionReenviarInvitacion"),revokeLabel:e("content.admin.equipo.actionRevocar"),onResend:()=>{wt(n)},onRevoke:()=>{Nt(n)}},n.id))}),t.jsx(J,{page:B,lastPage:it,onPage:Re,prev:e("content.admin.equipo.anterior"),next:e("content.admin.equipo.siguiente"),label:e("content.admin.equipo.paginaDe")})]})]}),m==="solicitudes"&&p&&t.jsxs("section",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3 border border-border bg-background p-3",children:[t.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[t.jsx(U,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t.jsx("input",{value:Te,onChange:n=>ft(n.target.value),placeholder:e("content.admin.equipo.searchSolicitudesPlaceholder"),className:"h-10 w-full border border-border bg-background pl-9 pr-3 text-sm focus:outline-none focus:border-foreground"})]}),t.jsx(te,{value:$,onChange:gt,options:[{value:"pending",label:e("content.admin.equipo.reqStatusPending")},{value:"approved",label:e("content.admin.equipo.reqStatusApproved")},{value:"rejected",label:e("content.admin.equipo.reqStatusRejected")},{value:"cancelled",label:e("content.admin.equipo.reqStatusCancelled")},{value:"all",label:e("content.admin.equipo.filterTodos")}]})]}),pt?t.jsx(ne,{label:e("content.admin.equipo.loadingSolicitudes")}):Ie?t.jsx(D,{message:Ie,onRetry:K,retryLabel:e("content.admin.equipo.reintentar")}):_e.length===0?t.jsx(se,{title:e("content.admin.equipo.emptySolicitudes"),desc:e("content.admin.equipo.emptySolicitudesDesc")}):t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"divide-y divide-border border border-border bg-background",children:_e.map(n=>t.jsx(Qt,{request:n,approving:Be===n.id,canManage:x,statusLabel:e(`content.admin.equipo.reqStatus${ee(n.status)}`),approveLabel:e("content.admin.equipo.actionAprobar"),rejectLabel:e("content.admin.equipo.actionRechazar"),motivoLabel:e("content.admin.equipo.motivoRechazo"),onApprove:()=>{qt(n)},onReject:()=>G(n)},n.id))}),t.jsx(J,{page:V,lastPage:xt,onPage:$e,prev:e("content.admin.equipo.anterior"),next:e("content.admin.equipo.siguiente"),label:e("content.admin.equipo.paginaDe")})]})]}),g&&t.jsx("div",{className:"fixed bottom-6 right-6 z-50 max-w-[calc(100vw-3rem)] animate-in fade-in slide-in-from-bottom-4",children:t.jsxs("div",{className:`flex items-start gap-3 border bg-background px-4 py-3 shadow-lg ${g.tone==="ok"?"border-bafre-red text-bafre-red":g.tone==="warn"?"border-foreground text-foreground":"border-bafre-red bg-bafre-red/5 text-bafre-red"}`,children:[t.jsx("span",{className:`mt-1.5 h-2 w-2 flex-none rounded-full ${g.tone==="warn"?"bg-foreground":"bg-bafre-red"}`}),t.jsx("span",{className:"text-sm",children:g.text})]})}),yt&&l&&t.jsx(Wt,{onClose:()=>X(!1),onSubmit:St}),L&&t.jsx(Yt,{request:L,submitting:jt===L.id,onClose:()=>G(null),onSubmit:n=>kt(L,n)}),t.jsx(Pt,{open:T!==null,mode:"admin",targetName:T?.name,onClose:()=>He(null),onSubmit:async({newPassword:n})=>{T&&(await Q.resetPassword(T.id,n),h(e("content.admin.equipo.toastPasswordReset")))}})]})}function ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Gt({user:e,busy:a,canChangeStatus:r,canResetPassword:o,labels:i,onActivate:u,onSuspend:f,onResetPassword:p}){const x=e.name.split(" ").filter(Boolean).map(g=>g[0]).slice(0,2).join("").toUpperCase(),l=e.role?.slug??"",b=l==="admin_sistema"||l==="administradorapp",m=e.profile?.cargo??"",c=e.profile?.oficina?.nombre??"";return t.jsxs("li",{className:"grid grid-cols-1 gap-4 px-4 py-4 transition hover:bg-secondary/40 md:grid-cols-[minmax(0,2.2fr)_minmax(0,1.3fr)_minmax(0,0.9fr)_auto] md:items-center md:px-5",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("div",{className:`grid h-11 w-11 flex-none place-items-center text-[12px] font-semibold tracking-widest ${b?"bg-bafre-red text-bone":"bg-ink text-bone"}`,children:x}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate font-medium",children:e.name}),b&&t.jsx(At,{className:"h-3.5 w-3.5 flex-none text-bafre-red","aria-hidden":!0})]}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate text-sm",children:e.role?.name??"â"}),t.jsx("div",{className:"truncate text-[11px] uppercase tracking-widest text-muted-foreground",children:[m,c].filter(
1Boolean).join(" · ")||"â"})]}),t.jsx("div",{children:t.jsx(de,{tone:e.enabled?"accent":"muted",label:e.enabled?i.activo:i.suspendido})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-start gap-1.5 md:justify-end",children:[r&&!e.enabled&&t.jsxs(S,{title:i.activarAcceso,onClick:u,tone:"accent",disabled:a,children:[t.jsx(Ft,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden md:inline",children:i.activar})]}),r&&e.enabled&&t.jsxs(S,{title:i.suspenderAcceso,onClick:f,disabled:a,children:[t.jsx(Ht,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden md:inline",children:i.suspender})]}),o&&t.jsx(S,{title:i.resetear,onClick:p,children:t.jsx($t,{className:"h-3.5 w-3.5"})})]})]})}function Jt({invitation:e,resending:a,revoking:r,statusLabel:o,emailLabel:i,resendLabel:u,revokeLabel:f,onResend:p,onRevoke:x}){const l=[e.name,e.lastname].filter(Boolean).join(" ")||e.email,m=(e.email_delivery?.status??"unknown")==="failed",c=e.status==="pending"||e.status==="expired"||m,g=e.status==="pending";return t.jsxs("li",{className:"grid grid-cols-1 gap-4 px-4 py-4 transition hover:bg-secondary/40 md:grid-cols-[minmax(0,2.2fr)_minmax(0,1.2fr)_minmax(0,1fr)_auto] md:items-center md:px-5",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate font-medium",children:l}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.email}),e.company&&t.jsx("div",{className:"truncate text-[11px] uppercase tracking-widest text-muted-foreground",children:e.company})]}),t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.jsx(de,{tone:e.status==="pending"?"neutral":e.status==="accepted"?"accent":"muted",label:o})}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("span",{className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-widest ${m?"text-bafre-red":"text-muted-foreground"}`,children:[m?t.jsx(Dt,{className:"h-3.5 w-3.5"}):t.jsx(Tt,{className:"h-3.5 w-3.5"}),i]}),m&&e.email_delivery?.last_error&&t.jsx("div",{className:"truncate text-[11px] text-muted-foreground",title:e.email_delivery.last_error,children:e.email_delivery.last_error})]}),t.jsxs("div",{className:"flex flex-wrap items-center justify-start gap-1.5 md:justify-end",children:[c&&t.jsxs(S,{title:u,onClick:p,disabled:a,tone:"accent",children:[t.jsx(Ge,{className:`h-3.5 w-3.5 ${a?"animate-spin":""}`}),t.jsx("span",{className:"hidden md:inline",children:u})]}),g&&t.jsxs(S,{title:f,onClick:x,disabled:r,tone:"danger",children:[t.jsx(Je,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden md:inline",children:f})]})]})]})}function Qt({request:e,approving:a,canManage:r,statusLabel:o,approveLabel:i,rejectLabel:u,motivoLabel:f,onApprove:p,onReject:x}){const l=[e.name,e.lastname].filter(Boolean).join(" ")||e.email;return t.jsxs("li",{className:"grid grid-cols-1 gap-4 px-4 py-4 transition hover:bg-secondary/40 md:grid-cols-[minmax(0,2.2fr)_minmax(0,1.5fr)_minmax(0,0.9fr)_auto] md:items-center md:px-5",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate font-medium",children:l}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.email}),e.message&&t.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:e.message})]}),t.jsxs("div",{className:"min-w-0 text-sm",children:[t.jsx("div",{className:"truncate",children:e.company??"â"}),t.jsx("div",{className:"truncate text-[11px] uppercase tracking-widest text-muted-foreground",children:e.position??"â"}),e.status==="rejected"&&e.rejection_reason&&t.jsxs("div",{className:"mt-1 truncate text-[11px] text-muted-foreground",children:[f,": ",e.rejection_reason]})]}),t.jsx("div",{children:t.jsx(de,{tone:e.status==="pending"?"neutral":e.status==="approved"?"accent":"muted",label:o})}),t.jsx("div",{className:"flex flex-wrap items-center justify-start gap-1.5 md:justify-end",children:r&&e.status==="pending"&&t.jsxs(t.Fragment,{children:[t.jsxs(S,{title:i,onClick:p,tone:"accent",disabled:a,children:[t.jsx(Lt,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden md:inline",children:i})]}),t.jsxs(S,{title:u,onClick:x,tone:"danger",children:[t.jsx(oe,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"hidden md:inline",children:u})]})]})})]})}function de({tone:e,label:a}){const r={accent:{dot:"bg-bafre-red",text:"text-bafre-red",border:"border-bafre-red/40",bg:"bg-bafre-red/5"},neutral:{dot:"bg-foreground",text:"text-foreground",border:"border-border-strong",bg:"bg-secondary"},muted:{dot:"bg-muted-foreground",text:"text-muted-foreground",border:"border-border",bg:"bg-secondary/60"}}[e];return t.jsxs("span",{className:`inline-flex items-center gap-1.5 border px-2 py-1 text-[10px] font-mono uppercase tracking-widest ${r.border} ${r.bg} ${r.text}`,children:[t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${r.dot}`}),a]})}function S({children:e,onClick:a,title:r,tone:o,disabled:i}){const u=o==="danger"?"border-border text-bafre-red hover:border-bafre-red hover:bg-bafre-red/5":o==="accent"?"border-bafre-red/40 text-bafre-red hover:bg-bafre-red hover:text-bone hover:border-bafre-red":"border-border text-muted-foreground hover:border-foreground hover:text-foreground";return t.jsx("button",{onClick:a,title:r,"aria-label":r,disabled:i,className:`inline-flex h-8 items-center gap-1.5 border px-2.5 text-[10px] font-medium uppercase tracking-widest transition disabled:cursor-not-allowed disabled:opacity-50 ${u}`,children:e})}
1function te({value:e,onChange:a,options:r}){return t.jsx("div",{className:"inline-flex flex-wrap border border-border bg-background",children:r.map(o=>{const i=o.value===e;return t.jsx("button",{onClick:()=>a(o.value),className:`h-10 px-3 text-[11px] font-mono uppercase tracking-widest transition ${i?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:o.label},o.value)})})}function k({k:e,v:a,accent:r,warn:o,loading:i,compactLabel:u}){return t.jsxs("div",{className:`border bg-background p-4 ${r?"border-bafre-red":o?"border-foreground":"border-border"}`,children:[t.jsx("div",{className:`font-mono text-[11px] uppercase tracking-widest text-muted-foreground break-words ${u?"xl:text-[9px]":""}`,children:e}),t.jsx("div",{className:`mt-2 font-display text-2xl ${r?"text-bafre-red":""}`,children:i?t.jsx(Xe,{size:"sm",className:"align-middle"}):a??"â"})]})}function ne({label:e}){return t.jsx("div",{className:"border border-border bg-background p-10 text-center text-sm text-muted-foreground",children:t.jsx(Xe,{size:"md",showLabel:!0,label:e})})}function se({title:e,desc:a}){return t.jsxs("div",{className:"border border-dashed border-border bg-background p-12 text-center",children:[t.jsx("div",{className:"mx-auto grid h-12 w-12 place-items-center rounded-full bg-secondary text-muted-foreground",children:t.jsx(U,{className:"h-5 w-5"})}),t.jsx("div",{className:"mt-4 font-display text-lg",children:e}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]})}function D({message:e,onRetry:a,retryLabel:r}){return t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border border-bafre-red/40 bg-bafre-red/5 px-5 py-4",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0 text-sm text-bafre-red",children:[t.jsx(Qe,{className:"mt-0.5 h-4 w-4 flex-none"}),t.jsx("span",{className:"break-words",children:e})]}),t.jsxs("button",{onClick:a,className:"inline-flex h-9 items-center gap-2 border border-bafre-red px-4 text-[10px] font-medium uppercase tracking-widest text-bafre-red transition hover:bg-bafre-red hover:text-bone",children:[t.jsx(Ge,{className:"h-3.5 w-3.5"}),r]})]})}function Wt({onClose:e,onSubmit:a}){const{t:r}=re(),[o,i]=s.useState({name:"",lastname:"",email:"",phone:"",company:""}),[u,f]=s.useState(!1),[p,x]=s.useState(null),[l,b]=s.useState({}),m=async c=>{if(c.preventDefault(),!u){if(!o.name.trim()||!o.lastname.trim()||!o.email.trim()){x(r("content.admin.equipo.validationRequired"));return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email)){x(r("content.admin.equipo.validationEmail"));return}x(null),b({}),f(!0);try{await a({name:o.name.trim(),lastname:o.lastname.trim(),email:o.email.trim().toLowerCase(),phone:o.phone.trim()||null,company:o.company.trim()||null})}catch(g){b(Xt(g)),x(w(g,r("content.admin.equipo.errorDesconocido"))),f(!1)}}};return t.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-ink/60 px-4 py-8 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:e,children:t.jsxs("div",{className:"max-h-full w-full max-w-xl overflow-y-auto border border-border bg-background shadow-2xl",onClick:c=>c.stopPropagation(),children:[t.jsxs("div",{className:"flex items-start justify-between border-b border-border px-6 py-5",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-bafre-red",children:r("content.admin.equipo.inviteDialogEyebrow")}),t.jsx("h2",{className:"mt-1 font-display text-2xl",children:r("content.admin.equipo.inviteDialogTitle")}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r("content.admin.equipo.inviteDialogDesc")})]}),t.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground","aria-label":r("content.admin.equipo.inviteClose"),children:t.jsx(oe,{className:"h-5 w-5"})})]}),t.jsxs("form",{onSubmit:m,className:"grid gap-4 px-6 py-6 md:grid-cols-2",children:[t.jsx(C,{label:r("content.admin.equipo.fieldNombre"),error:l.name,children:t.jsx("input",{required:!0,value:o.name,onChange:c=>i({...o,name:c.target.value}),className:"h-11 w-full border border-border bg-background px-3 text-sm focus:outline-none focus:border-foreground"})}),t.jsx(C,{label:r("content.admin.equipo.fieldApellidos"),error:l.lastname,children:t.jsx("input",{required:!0,value:o.lastname,onChange:c=>i({...o,lastname:c.target.value}),className:"h-11 w-full border border-border bg-background px-3 text-sm focus:outline-none focus:border-foreground"})}),t.jsx(C,{label:r("content.admin.equipo.fieldEmail"),error:l.email,children:t.jsx("input",{required:!0,type:"email",value:o.email,onChange:c=>i({...o,email:c.target.value}),className:"h-11 w-full border border-border bg-background px-3 text-sm focus:outline-none focus:border-foreground"})}),t.jsx(C,{label:r("content.admin.equipo.fieldTelefono"),error:l.phone,children:t.jsx("input",{value:o.phone,onChange:c=>i({...o,phone:c.target.value}),className:"h-11 w-full border border-border bg-background px-3 text-sm focus:outline-none focus:border-foreground"})}),t.jsx(C,{label:r("content.admin.equipo.fieldEmpresa"),error:l.company,children:t.jsx("input",{value:o.company,onChange:c=>i({...o,company:c.target.value}),placeholder:r("content.admin.equipo.fieldOpcional"),className:"h-11 w-full border border-border bg-background px-3 text-sm focus:outline-none focus:border-foreground"})}),p&&t.jsx("div",{className:"md:col-span-2 border border-bafre-red/40 bg-bafre-red/5 px-4 py-2 text-xs text-bafre-red",children:p}),t.jsxs("div",{className:"flex items-center justify-end gap-3 md:col-span-2",children:[t.jsx("button",{type:"button",onClick:e,className:"h-11 border border-border px-5 text-xs font-medium uppercase tracking-[0.25em] text-muted-foreground hover:text-foreground",children:r("content.admin.equipo.btnCancelar")}
1),t.jsxs("button",{type:"submit",disabled:u,className:"inline-flex h-11 items-center gap-2 bg-bafre-red px-6 text-xs font-medium uppercase tracking-[0.25em] text-bone transition hover:bg-bafre-red/90 disabled:opacity-50",children:[t.jsx(Et,{className:"h-4 w-4"}),r(u?"content.admin.equipo.sending":"content.admin.equipo.btnEnviar")]})]})]})]})})}function Yt({request:e,submitting:a,onClose:r,onSubmit:o}){const{t:i}=re(),[u,f]=s.useState(""),[p,x]=s.useState(null),l=async m=>{if(m.preventDefault(),!a){if(!u.trim()){x(i("content.admin.equipo.validationMotivo"));return}x(null);try{await o(u.trim())}catch(c){x(w(c,i("content.admin.equipo.errorRechazar")))}}},b=[e.name,e.lastname].filter(Boolean).join(" ")||e.email;return t.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-ink/60 px-4 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:r,children:t.jsxs("div",{className:"w-full max-w-lg border border-border bg-background shadow-2xl",onClick:m=>m.stopPropagation(),children:[t.jsxs("div",{className:"flex items-start justify-between border-b border-border px-6 py-5",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-bafre-red",children:i("content.admin.equipo.rejectDialogEyebrow")}),t.jsx("h2",{className:"mt-1 font-display text-2xl",children:i("content.admin.equipo.rejectDialogTitle")}),t.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[b," · ",e.email]})]}),t.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-foreground","aria-label":i("content.admin.equipo.inviteClose"),children:t.jsx(oe,{className:"h-5 w-5"})})]}),t.jsxs("form",{onSubmit:l,className:"space-y-4 px-6 py-6",children:[t.jsx(C,{label:i("content.admin.equipo.motivoRechazo"),children:t.jsx("textarea",{value:u,onChange:m=>f(m.target.value),rows:4,className:"w-full border border-border bg-background p-3 text-sm focus:outline-none focus:border-foreground"})}),p&&t.jsx("div",{className:"border border-bafre-red/40 bg-bafre-red/5 px-4 py-2 text-xs text-bafre-red",children:p}),t.jsxs("div",{className:"flex items-center justify-end gap-3",children:[t.jsx("button",{type:"button",onClick:r,className:"h-11 border border-border px-5 text-xs font-medium uppercase tracking-[0.25em] text-muted-foreground hover:text-foreground",children:i("content.admin.equipo.btnCancelar")}),t.jsx("button",{type:"submit",disabled:a,className:"inline-flex h-11 items-center gap-2 bg-bafre-red px-6 text-xs font-medium uppercase tracking-[0.25em] text-bone transition hover:bg-bafre-red/90 disabled:opacity-50",children:i(a?"content.admin.equipo.sending":"content.admin.equipo.actionRechazar")}
1)]})]})]})})}function C({label:e,children:a,error:r}){return t.jsxs("label",{className:"flex flex-col gap-1.5",children:[t.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-muted-foreground",children:e}),a,r&&t.jsx("span",{className:"text-[11px] text-bafre-red",children:r})]})}export{cn as component};
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.