vendor: 19,202 bytes, line 1
1import{j as e,u as Vn,b as te}from"./query-Q_ThwKGI.js";import{r as a,i as Ge}from"./react-vendor-wefok28f.js";import{s as U}from"./client-DjLwxtrO.js";import{B as Me}from"./button-DrepnwkX.js";import{I as Wn}from"./input-Cu6Tiemi.js";import{T as zn,a as Hn,b as pe,c as I,d as Xn,e as j}from"./table-D25X3X5Y.js";import{B as Yn}from"./badge-u_30_p7s.js";import{S as v}from"./skeleton-B8BTwlen.js";import{m as Qn,e as Ke,s as $e,A as Jn,v as ge,o as ce,p as C,D as Zn,C as er,f as J,g as qe,w as nr,x as Ve,S as rr,y as tr,z as or,R as sr,n as ar,q as ke,c as G,u as We}from"./index-C4Kq7kkR.js";import{u as ir}from"./index-CryppvJw.js";import{h as cr,u as lr,F as dr,R as ur}from"./index-DviHZN-M.js";import{c as ze,R as mr,I as pr}from"./index-lwN0GFAE.js";import{a0 as fr,v as xr,av as hr,aH as gr,aR as vr,b as wr,z as jr,aG as Cr,w as Mr,aS as Nr,U as Oe,aT as br,aU as _r,F as yr,M as Rr,P as Sr,aV as Dr,Q as Er,a4 as Pr,l as Ir,D as Fe,W as Ue,aW as Ar,r as Tr,J as kr}from"./icons-By8asZST.js";import{E as Or}from"./EditUserDialog-DQ1lqMqf.js";import{C as Fr}from"./card-DYyqUxY6.js";import{f as Ur}from"./format-NnwPU_mP.js";import"./supabase-COHOFxoQ.js";import"./index-DC33WZD-.js";import"./index.esm-CGhUaq_S.js";import"./form-BxaLnFV4.js";import"./label-Ch0F7L4t.js";import"./select-DECm7gW5.js";import"./index-CSO0Tzy2.js";import"./checkbox-Gmf95s3M.js";var Ce=["Enter"," "],Lr=["ArrowDown","PageUp","Home"],He=["ArrowUp","PageDown","End"],Br=[...Lr,...He],Gr={ltr:[...Ce,"ArrowRight"],rtl:[...Ce,"ArrowLeft"]},Kr={ltr:["ArrowLeft"],rtl:["ArrowRight"]},le="Menu",[se,$r,qr]=Qn(le),[q,Xe]=Ke(le,[qr,$e,ze]),ve=$e(),Ye=ze(),[Vr,V]=q(le),[Wr,de]=q(le),Qe=n=>{const{__scopeMenu:t,open:r=!1,children:o,dir:s,onOpenChange:i,modal:u=!0}=n,x=ve(t),[m,h]=a.useState(null),p=a.useRef(!1),d=qe(i),l=ir(s);return a.useEffect(()=>{const b=()=>{p.current=!0,document.addEventListener("pointerdown",N,{capture:!0,once:!0}),document.addEventListener("pointermove",N,{capture:!0,once:!0})},N=()=>p.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),e.jsx(sr,{...x,children:e.jsx(Vr,{scope:t,open:r,onOpenChange:d,content:m,onContentChange:h,children:e.jsx(Wr,{scope:t,onClose:a.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:p,dir:l,modal:u,children:o})})})};Qe.displayName=le;var zr="MenuAnchor",Ne=a.forwardRef((n,t)=>{const{__scopeMenu:r,...o}=n,s=ve(r);return e.jsx(Jn,{...s,...o,ref:t})});Ne.displayName=zr;var be="MenuPortal",[Hr,Je]=q(be,{forceMount:void 0}),Ze=n=>{const{__scopeMenu:t,forceMount:r,children:o,container:s}=n,i=V(be,t);return e.jsx(Hr,{scope:t,forceMount:r,children:e.jsx(ge,{present:r||i.open,children:e.jsx(or,{asChild:!0,container:s,children:o})})})};Ze.displayName=be;var A="MenuContent",[Xr,_e]=q(A),en=a.forwardRef((n,t)=>{const r=Je(A,n.__scopeMenu),{forceMount:o=r.forceMount,...s}=n,i=V(A,n.__scopeMenu),u=de(A,n.__scopeMenu);return e.jsx(se.Provider,{scope:n.__scopeMenu,children:e.jsx(ge,{present:o||i.open,children:e.jsx(se.Slot,{scope:n.__scopeMenu,children:u.modal?e.jsx(Yr,{...s,ref:t}):e.jsx(Qr,{...s,ref:t})})})})}),Yr=a.forwardRef((n,t)=>{const r=V(A,n.__scopeMenu),o=a.useRef(null),s=ce(t,o);return a.useEffect(()=>{const i=o.current;if(i)return cr(i)},[]),e.jsx(ye,{...n,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:C(n.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Qr=a.forwardRef((n,t)=>{const r=V(A,n.__scopeMenu);return e.jsx(ye,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ye=a.forwardRef((n,t)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:u,disableOutsidePointerEvents:x,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:d,onInteractOutside:l,onDismiss:b,disableOutsideScroll:N,...P}=n,T=V(A,r),L=de(A,r),K=ve(r),$=Ye(r),O=$r(r),[W,ue]=a.useState(null),z=a.useRef(null),me=ce(t,z,T.onContentChange),H=a.useRef(0),X=a.useRef(""),je=a.useRef(0),Z=a.useRef(null),c=a.useRef("right"),w=a.useRef(0),_=N?ur:a.Fragment,D=N?{as:rr,allowPinchZoom:!0}:void 0,g=f=>{var Y,Ae;const y=X.current+f,E=O().filter(F=>!F.disabled),k=document.activeElement,ee=(Y=E.find(F=>F.ref.current===k))==null?void 0:Y.textValue,ne=E.map(F=>F.textValue),Ie=lt(ne,y,ee),re=(Ae=E.find(F=>F.textValue===Ie))==null?void 0:Ae.ref.current;(function F(Te){X.current=Te,window.clearTimeout(H.current),Te!==""&&(H.current=window.setTimeout(()=>F(""),1e3))})(y),re&&setTimeout(()=>re.focus())};a.useEffect(()=>()=>window.clearTimeout(H.current),[]),lr();const M=a.useCallback(f=>{var E,k;return c.current===((E=Z.current)==null?void 0:E.side)&&ut(f,(k=Z.current)==null?void 0:k.area)},[]);return e.jsx(Xr,{scope:r,searchRef:X,onItemEnter:a.useCallback(f=>{M(f)&&f.preventDefault()},[M]),onItemLeave:a.useCallback(f=>{var y;M(f)||((y=z.current)==null||y.focus(),ue(null))},[M]),onTriggerLeave:a.useCallback(f=>{M(f)&&f.preventDefault()},[M]),pointerGraceTimerRef:je,onPointerGraceIntentChange:a.useCallback(f=>{Z.current=f},[]),children:e.jsx(_,{...D,children:e.jsx(dr,{asChild:!0,trapped:s,onMountAutoFocus:C(i,f=>{var y;f.preventDefault(),(y=z.current)==null||y.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:e.jsx(Zn,{asChild:!0,disableOutsidePointerEvents:x,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:d,onInteractOutside:l,onDismiss:b,children:e.jsx(mr,{asChild:!0,...$,dir:L.dir,orientation:"vertical",loop:o,currentTabStopId:W,onCurrentTabStopIdChange:ue,onEntryFocus:C(m,f=>{L.isUsingKeyboardRef.current||f.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(er,{role:"menu","aria-orientation":"vertical","data-state":gn(T.open),"data-radix-menu-content":"",dir:L.dir,...K,...P,ref:me,style:{outline:"none",...P.style},onKeyDown:C(P.onKeyDown,f=>{const E=f.target.closest("[data-radix-menu-content]")===f.currentTarget,k=f.ctrlKey||f.altKey||f.metaKey,ee=f.key.length===1;E&&(f.key==="Tab"&&f.preventDefault(),!k&&ee&&g(f.key));const ne=z.current;if(f.target!==ne||!Br.includes(f.key))return;f.preventDefault();const re=O().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);He.includes(f.key)&&re.reverse(),it(re)}),onBlur:C(n.onBlur,f=>{f.currentTarget.contains(f.target)||(window.clearTimeout(H.current),X.current="")}),onPointerMove:C(n.onPointerMove,ae(f=>{const y=f.target,E=w.current!==f.clientX;if(f.currentTarget.contains(y)&&E){const k=f.clientX>w.current?"right":"left";c.current=k,w.current=f.clientX}}))})})})})})})});en.displayName=A;var Jr="MenuGroup",Re=a.forwardRef((n,t)=>{const{__scopeMenu:r,...o}=n;return e.jsx(J.div,{role:"group",...o,ref:t})});Re.displayName=Jr;var Zr="MenuLabel",nn=a.forwardRef((n,t)=>{const{__scopeMenu:r,...o}=n;return e.jsx(J.div,{...o,ref:t})});nn.displayName=Zr;var xe="MenuItem",Le="menu.itemSelect",we=a.forwardRef((n,t)=>{const{disabled:r=!1,onSelect:o,...s}=n,i=a.useRef(null),u=de(xe,n.__scopeMenu),x=_e(xe,n.__scopeMenu),m=ce(t,i),h=a.useRef(!1),p=()=>{const d=i.current;if(!r&&d){const l=new CustomEvent(Le,{bubbles:!0,cancelable:!0});d.addEventListener(Le,b=>o==null?void 0:o(b),{once:!0}),tr(d,l),l.defaultPrevented?h.current=!1:u.onClose()}};return e.jsx(rn,{...s,ref:m,disabled:r,onClick:C(n.onClick,p),onPointerDown:d=>{var l;(l=n.onPointerDown)==null||l.call(n,d),h.current=!0},onPointerUp:C(n.onPointerUp,d=>{var l;h.current||(l=d.currentTarget)==null||l.click()}),onKeyDown:C(n.onKeyDown,d=>{const l=x.searchRef.current!=="";r||l&&d.key===" "||Ce.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});we.displayName=xe;var rn=a.forwardRef((n,t)=>{const{__scopeMenu:r,disabled:o=!1,textValue:s,...i}=n,u=_e(xe,r),x=Ye(r),m=a.useRef(null),h=ce(t,m),[p,d]=a.useState(!1),[l,b]=a.useState("");return a.useEffect(()=>{const N=m.current;N&&b((N.textContent??"").trim())},[i.children]),e.jsx(se.ItemSlot,{scope:r,disabled:o,textValue:s??l,children:e.jsx(pr,{asChild:!0,...x,focusable:!o,children:e.jsx(J.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...i,ref:h,onPointerMove:C(n.onPointerMove,ae(N=>{o?u.onItemLeave(N):(u.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:C(n.onPointerLeave,ae(N=>u.onItemLeave(N))),onFocus:C(n.onFocus,()=>d(!0)),onBlur:C(n.onBlur,()=>d(!1))})})})}),et="MenuCheckboxItem",tn=a.forwardRef((n,t)=>{const{checked:r=!1,onCheckedChange:o,...s}=n;return e.jsx(ln,{scope:n.__scopeMenu,checked:r,children:e.jsx(we,{role:"menuitemcheckbox","aria-checked":he(r)?"mixed":r,...s,ref:t,"data-state":De(r),onSelect:C(s.onSelect,()=>o==null?void 0:o(he(r)?!0:!r),{checkForDefaultPrevented:!1})})})});tn.displayName=et;var on="MenuRadioGroup",[nt,rt]=q(on,{value:void 0,onValueChange:()=>{}}),sn=a.forwardRef((n,t)=>{const{value:r,onValueChange:o,...s}=n,i=qe(o);return e.jsx(nt,{scope:n.__scopeMenu,value:r,onValueChange:i,children:e.jsx(Re,{...s,ref:t})})});sn.displayName=on;var an="MenuRadioItem",cn=a.forwardRef((n,t)=>{const{value:r,...o}=n,s=rt(an,n.__scopeMenu),i=r===s.value;return e.jsx(ln,{scope:n.__scopeMenu,checked:i,children:e.jsx(we,{role:"menuitemradio","aria-checked":i,...o,ref:t,"data-state":De(i),onSelect:C(o.onSelect,()=>{var u;return(u=s.onValueChange)==null?void 0:u.call(s,r)},{checkForDefaultPrevented:!1})})})});cn.displayName=an;var Se="MenuItemIndicator",[ln,tt]=q(Se,{checked:!1}),dn=a.forwardRef((n,t)=>{const{__scopeMenu:r,forceMount:o,...s}=n,i=tt(Se,r);return e.jsx(ge,{present:o||he(i.checked)||i.checked===!0,children:e.jsx(J.span,{...s,ref:t,"data-state":De(i.checked)})})});dn.displayName=Se;var ot="MenuSeparator",un=a.forwardRef((n,t)=>{const{__scopeMenu:r,...o}=n;return e.jsx(J.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});un.displayName=ot;var st="MenuArrow",mn=a.forwardRef((n,t)=>{const{__scopeMenu:r,...o}=n,s=ve(r);return e.jsx(nr,{...s,...o,ref:t})});mn.displayName=st;var at="MenuSub",[bo,pn]=q(at),oe="MenuSubTrigger",fn=a.forwardRef((n,t)=>{const r=V(oe,n.__scopeMenu),o=de(oe,n.__scopeMenu),s=pn(oe,n.__scopeMenu),i=_e(oe,n.__scopeMenu),u=a.useRef(null),{pointerGraceTimerRef:x,onPointerGraceIntentChange:m}=i,h={__scopeMenu:n.__scopeMenu},p=a.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return a.useEffect(()=>p,[p]),a.useEffect(()=>{const d=x.current;return()=>{window.clearTimeout(d),m(null)}},[x,m]),e.jsx(Ne,{asChild:!0,...h,children:e.jsx(rn,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gn(r.open),...n,ref:Ve(t,s.onTriggerChange),onClick:d=>{var l;(l=n.onClick)==null||l.call(n,d),!(n.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:C(n.onPointerMove,ae(d=>{i.onItemEnter(d),!d.defaultPrevented&&!n.disabled&&!r.open&&!u.current&&(i.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),p()},100))})),onPointerLeave:C(n.onPointerLeave,ae(d=>{var b,N;p();const l=(b=r.content)==null?void 0:b.getBoundingClientRect();if(l){const P=(N=r.content)==null?void 0:N.dataset.side,T=P==="right",L=T?-5:5,K=l[T?"left":"right"],$=l[T?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+L,y:d.clientY},{x:K,y:l.top},{x:$,y:l.top},{x:$,y:l.bottom},{x:K,y:l.bottom}],side:P}),window.clearTimeout(x.current),x.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:C(n.onKeyDown,d=>{var b;const l=i.searchRef.current!=="";n.disabled||l&&d.key===" "||Gr[o.dir].includes(d.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),d.preventDefault())})})})});fn.displayName=oe;var xn="MenuSubContent",hn=a.forwardRef((n,t)=>{const r=Je(A,n.__scopeMenu),{forceMount:o=r.forceMount,...s}=n,i=V(A,n.__scopeMenu),u=de(A,n.__scopeMenu),x=pn(xn,n.__scopeMenu),m=a.useRef(null),h=ce(t,m);return e.jsx(se.Provider,{scope:n.__scopeMenu,children:e.jsx(ge,{present:o||i.open,children:e.jsx(se.Slot,{scope:n.__scopeMenu,children:e.jsx(ye,{id:x.contentId,"aria-labelledby":x.triggerId,...s,ref:h,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var d;u.isUsingKeyboardRef.current&&((d=m.current)==null||d.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:C(n.onFocusOutside,p=>{p.target!==x.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:C(n.onEscapeKeyDown,p=>{u.onClose(),p.preventDefault()}),onKeyDown:C(n.onKeyDown,p=>{var b;const d=p.currentTarget.contains(p.target),l=Kr[u.dir].includes(p.key);d&&l&&(i.onOpenChange(!1),(b=x.trigger)==null||b.focus(),p.preventDefault())})})})})})});hn.displayName=xn;function gn(n){return n?"open":"closed"}function he(n){return n==="indeterminate"}function De(n){return he(n)?"indeterminate":n?"checked":"unchecked"}function it(n){const t=document.activeElement;for(const r of n)if(r===t||(r.focus(),document.activeElement!==t))return}function ct(n,t){return n.map((r,o)=>n[(t+o)%n.length])}function lt(n,t,r){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=r?n.indexOf(r):-1;let u=ct(n,Math.max(i,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function dt(n,t){const{x:r,y:o}=n;let s=!1;for(let i=0,u=t.length-1;i<t.length;u=i++){const x=t[i].x,m=t[i].y,h=t[u].x,p=t[u].y;m>o!=p>o&&r<(h-x)*(o-m)/(p-m)+x&&(s=!s)}return s}function ut(n,t){if(!t)return!1;const r={x:n.clientX,y:n.clientY};return dt(r,t)}function ae(n){return t=>t.pointerType==="mouse"?n(t):void 0}var mt=Qe,pt=Ne,ft=Ze,xt=en,ht=Re,gt=nn,vt=we,wt=tn,jt=sn,Ct=cn,Mt=dn,Nt=un,bt=mn,_t=fn,yt=hn,Ee="DropdownMenu",[Rt,_o]=Ke(Ee,[Xe]),S=Xe(),[St,vn]=Rt(Ee),wn=n=>{const{__scopeDropdownMenu:t,children:r,dir:o,open:s,defaultOpen:i,onOpenChange:u,modal:x=!0}=n,m=S(t),h=a.useRef(null),[p=!1,d]=ar({prop:s,defaultProp:i,onChange:u});return e.jsx(St,{scope:t,triggerId:ke(),triggerRef:h,contentId:ke(),open:p,onOpenChange:d,onOpenToggle:a.useCallback(()=>d(l=>!l),[d]),modal:x,children:e.jsx(mt,{...m,open:p,onOpenChange:d,dir:o,modal:x,children:r})})};wn.displayName=Ee;var jn="DropdownMenuTrigger",Cn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...s}=n,i=vn(jn,r),u=S(r);return e.jsx(pt,{asChild:!0,...u,children:e.jsx(J.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...s,ref:Ve(t,i.triggerRef),onPointerDown:C(n.onPointerDown,x=>{!o&&x.button===0&&x.ctrlKey===!1&&(i.onOpenToggle(),i.open||x.preventDefault())}),onKeyDown:C(n.onKeyDown,x=>{o||(["Enter"," "].includes(x.key)&&i.onOpenToggle(),x.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(x.key)&&x.preventDefault())})})})});Cn.displayName=jn;var Dt="DropdownMenuPortal",Mn=n=>{const{__scopeDropdownMenu:t,...r}=n,o=S(t);return e.jsx(ft,{...o,...r})};Mn.displayName=Dt;var Nn="DropdownMenuContent",bn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=vn(Nn,r),i=S(r),u=a.useRef(!1);return e.jsx(xt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...o,ref:t,onCloseAutoFocus:C(n.onCloseAutoFocus,x=>{var m;u.current||(m=s.triggerRef.current)==null||m.focus(),u.current=!1,x.preventDefault()}),onInteractOutside:C(n.onInteractOutside,x=>{const m=x.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,p=m.button===2||h;(!s.modal||p)&&(u.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bn.displayName=Nn;var Et="DropdownMenuGroup",Pt=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(ht,{...s,...o,ref:t})});Pt.displayName=Et;var It="DropdownMenuLabel",_n=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(gt,{...s,...o,ref:t})});_n.displayName=It;var At="DropdownMenuItem",yn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(vt,{...s,...o,ref:t})});yn.displayName=At;var Tt="DropdownMenuCheckboxItem",Rn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(wt,{...s,...o,ref:t})});Rn.displayName=Tt;var kt="DropdownMenuRadioGroup",Sn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(jt,{...s,...o,ref:t})});Sn.displayName=kt;var Ot="DropdownMenuRadioItem",Dn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(Ct,{...s,...o,ref:t})});Dn.displayName=Ot;var Ft="DropdownMenuItemIndicator",En=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(Mt,{...s,...o,ref:t})});En.displayName=Ft;var Ut="DropdownMenuSeparator",Pn=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(Nt,{...s,...o,ref:t})});Pn.displayName=Ut;var Lt="DropdownMenuArrow",Bt=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(bt,{...s,...o,ref:t})});Bt.displayName=Lt;var Gt="DropdownMenuSubTrigger",In=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(_t,{...s,...o,ref:t})});In.displayName=Gt;var Kt="DropdownMenuSubContent",An=a.forwardRef((n,t)=>{const{__scopeDropdownMenu:r,...o}=n,s=S(r);return e.jsx(yt,{...s,...o,ref:t,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});An.displayName=Kt;var $t=wn,qt=Cn,Vt=Mn,Tn=bn,kn=_n,On=yn,Fn=Rn,Wt=Sn,Un=Dn,Ln=En,Bn=Pn,Gn=In,Kn=An;const $n=$t,qn=qt,Be=Wt,zt=a.forwardRef(({className:n,inset:t,children:r,...o},s)=>e.jsxs(Gn,{ref:s,className:G("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",n),...o,children:[r,e.jsx(fr,{className:"ml-auto h-4 w-4"})]}));zt.displayName=Gn.displayName;const Ht=a.forwardRef(({className:n,...t},r)=>e.jsx(Kn,{ref:r,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...t}));Ht.displayName=Kn.displayName;const Pe=a.forwardRef(({className:n,sideOffset:t=4,...r},o)=>e.jsx(Vt,{children:e.jsx(Tn,{ref:o,sideOffset:t,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));Pe.displayName=Tn.displayName;const Q=a.forwardRef(({className:n,inset:t,...r},o)=>e.jsx(On,{ref:o,className:G("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",n),...r}));Q.displayName=On.displayName;const Xt=a.forwardRef(({className:n,children:t,checked:r,...o},s)=>e.jsxs(Fn,{ref:s,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),checked:r,...o,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ln,{children:e.jsx(xr,{className:"h-4 w-4"})})}),t]}));Xt.displayName=Fn.displayName;const B=a.forwardRef(({className:n,children:t,...r},o)=>e.jsxs(Un,{ref:o,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ln,{children:e.jsx(hr,{className:"h-2 w-2 fill-current"})})}),t]}));B.displayName=Un.displayName;const fe=a.forwardRef(({className:n,inset:t,...r},o)=>e.jsx(kn,{ref:o,className:G("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",n),...r}));fe.displayName=kn.displayName;const ie=a.forwardRef(({className:n,...t},r)=>e.jsx(Bn,{ref:r,className:G("-mx-1 my-1 h-px bg-muted",n),...t}));ie.displayName=Bn.displayName;const Yt=({subscriptionFilter:n,statusFilter:t,onSubscriptionFilterChange:r,onStatusFilterChange:o})=>e.jsxs($n,{children:[e.jsx(qn,{asChild:!0,children:e.jsxs(Me,{variant:"outline",className:"min-w-[130px]",children:[e.jsx(gr,{className:"mr-2 h-4 w-4"}),"Filters"]})}),e.jsxs(Pe,{align:"end",className:"w-56",children:[e.jsx(fe,{children:"Filter Options"}),e.jsx(ie,{}),e.jsx(fe,{className:"text-xs font-medium text-muted-foreground pt-2",children:"Subscription Plan"}),e.jsxs(Be,{value:n,onValueChange:s=>r(s),children:[e.jsx(B,{value:"all",children:"All Plans"}),e.jsx(B,{value:"free",children:"Free"}),e.jsx(B,{value:"basic",children:"Basic"}),e.jsx(B,{value:"premium",children:"Premium"})]}),e.jsx(ie,{}),e.jsx(fe,{className:"text-xs font-medium text-muted-foreground",children:"Status"}),e.jsxs(Be,{value:t,onValueChange:s=>o(s),children:[e.jsx(B,{value:"all",children:"All Status"}),e.jsx(B,{value:"active",children:"Active"}),e.jsx(B,{value:"inactive",children:"Inactive"})]})]})]}),Qt=({user:n})=>
1{const t=Ge(),{toast:r}=We(),o=Vn(),[s,i]=a.useState(!1),u=async(m,h)=>{switch(m.stopPropagation(),h){case"view":t(`/admin/users/${n.id}`);break;case"email":window.location.href=`mailto:${n.email}`;break;case"edit":i(!0);break;case"makeAdmin":case"removeAdmin":try{const{error:p}=await U.from("profiles").update({is_admin:!n.is_admin}).eq("id",n.id);if(p)throw p;r({title:"Admin privileges",description:`Updated admin status for ${n.full_name||n.email}`}),o.invalidateQueries({queryKey:["adminUsers"]})}catch(p){r({variant:"destructive",title:"Error updating user",description:p.message||"There was a problem updating the user status."})}break;case"suspend":r({title:"User suspended",description:`${n.full_name||n.email} has been suspended.`});break}},x=()=>{o.invalidateQueries({queryKey:["adminUsers"]})};return e.jsxs(e.Fragment,{children:[e.jsxs($n,{children:[e.jsx(qn,{asChild:!0,onClick:m=>m.stopPropagation(),children:e.jsxs(Me,{variant:"ghost",size:"icon",children:[e.jsx(vr,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open menu"})]})}),e.jsxs(Pe,{align:"end",children:[e.jsxs(Q,{onClick:m=>u(m,"view"),children:[e.jsx(wr,{className:"mr-2 h-4 w-4"}),"View Details"]}),e.jsxs(Q,{onClick:m=>u(m,"email"),children:[e.jsx(jr,{className:"mr-2 h-4 w-4"}),"Send Email"]}),e.jsxs(Q,{onClick:m=>u(m,"edit"),children:[e.jsx(Cr,{className:"mr-2 h-4 w-4"}),"Edit User"]}),e.jsx(ie,{}),e.jsxs(Q,{onClick:m=>u(m,n.is_admin?"removeAdmin":"makeAdmin"),children:[e.jsx(Mr,{className:"mr-2 h-4 w-4"}),n.is_admin?"Remove Admin":"Make Admin"]}),e.jsx(ie,{}),e.jsxs(Q,{className:"text-destructive focus:text-destructive",onClick:m=>u(m,"suspend"),children:[e.jsx(Nr,{className:"mr-2 h-4 w-4"}),"Suspend User"]})]})]}),e.jsx(Or,{user:n,open:s,onOpenChange:i,onUserUpdated:x})]})},R=({title:n,value:t,icon:r,description:o,className:s,iconColor:i="text-primary",iconBgColor:u="bg-primary/10"})=>e.jsxs(Fr,{className:`p-4 flex items-start gap-4 ${s}`,children:[e.jsx("div",{className:`rounded-md p-2 ${u}`,children:e.jsx(r,{className:`h-5 w-5 ${i}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:n}),e.jsx("h3",{className:"text-2xl font-bold mt-1",children:t}),o&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]})]}),Jt=()=>{const{data:n,isLoading:t}=te({queryKey:["admin-dashboard-stats"],queryFn:async()=>{const{data:o,error:s}=await U.functions.invoke("admin-analytics",{body:{action:"dashboard"}});if(s)throw s;if(!(o!=null&&o.success))throw new Error((o==null?void 0:o.error)||"Failed to load admin stats");return o.data}}),r=o=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:0,maximumFractionDigits:0}).format(o);return t?e.jsxs("div",{className:"space-y-8 mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Users Overview"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[...Array(3)].map((o,s)=>e.jsx(v,{className:"h-24 w-full"},s))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Modules Overview"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(4)].map((o,s)=>e.jsx(v,{className:"h-24 w-full"},`module-${s}`))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Sales Pages"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[...Array(3)].map((o,s)=>e.jsx(v,{className:"h-24 w-full"},`sp-${s}`))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"CRM & Sales"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[...Array(3)].map((o,s)=>e.jsx(v,{className:"h-24 w-full"},`crm-${s}`))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Integrations"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[...Array(3)].map((o,s)=>e.jsx(v,{className:"h-24 w-full"},`int-${s}`))})]})]}):e.jsxs("div",{className:"space-y-8 mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-medium mb-4",children:"Users Overview"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(R,{title:"Total Users",value:(n==null?void 0:n.totalUsers)||0,icon:Oe,description:"All registered users"}),e.jsx(R,{title:"Premium Users",value:(n==null?void 0:n.activeUsers)||0,icon:br,description:"Paid plan users",iconColor:"text-[#8B5CF6]",iconBgColor:"bg-[#E5DEFF]"}),e.jsx(R,{title:"Free Users",value:(n==null?void 0:n.inactiveUsers)||0,icon:_r,description:"Basic/free plan users",iconColor:"text-gray-500",iconBgColor:"bg-gray-100"})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-medium mb-4",children:"Modules Overview"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(R,{title:"Total Forms",value:(n==null?void 0:n.formsCount)||0,icon:yr,description:"All forms created"}),e.jsx(R,{title:"Total Leads",value:(n==null?void 0:n.leadsCount)||0,icon:Oe,description:"Captured contacts"}),e.jsx(R,{title:"Redirect Campaigns",value:(n==null?void 0:n.groupsCount)||0,icon:Rr,description:"WhatsApp campaigns"}
1),e.jsx(R,{title:"Webinars",value:(n==null?void 0:n.webinarsCount)||0,icon:Sr,description:"Created webinars"})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-medium mb-4",children:"Sales Pages"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(R,{title:"Total Pages",value:(n==null?void 0:n.salesPagesCount)||0,icon:Dr,description:"Created sales pages",iconColor:"text-blue-600",iconBgColor:"bg-blue-100"}),e.jsx(R,{title:"Total Views",value:(n==null?void 0:n.salesPagesViews)||0,icon:Er,description:"Page views",iconColor:"text-green-600",iconBgColor:"bg-green-100"}),e.jsx(R,{title:"CTA Clicks",value:(n==null?void 0:n.salesPagesCTAClicks)||0,icon:Pr,description:"Button clicks",iconColor:"text-orange-600",iconBgColor:"bg-orange-100"})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-medium mb-4",children:"CRM & Sales"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(R,{title:"Opportunities",value:(n==null?void 0:n.opportunitiesCount)||0,icon:Ir,description:"CRM opportunities",iconColor:"text-purple-600",iconBgColor:"bg-purple-100"}),e.jsx(R,{title:"Total Sales",value:(n==null?void 0:n.salesCount)||0,icon:Fe,description:"Processed sales",iconColor:"text-emerald-600",iconBgColor:"bg-emerald-100"}),e.jsx(R,{title:"Total Revenue",value:r((n==null?void 0:n.totalRevenue)||0),icon:Fe,description:"Net revenue",iconColor:"text-emerald-600",iconBgColor:"bg-emerald-100"})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-medium mb-4",children:"Integrations"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(R,{title:"Webhook Endpoints",value:(n==null?void 0:n.webhookEndpointsCount)||0,icon:Ue,description:"Active webhooks",iconColor:"text-indigo-600",iconBgColor:"bg-indigo-100"}),e.jsx(R,{title:"Webhook Requests",value:(n==null?void 0:n.webhookTotalRequests)||0,icon:Ue,description:"Total requests received",iconColor:"text-indigo-600",iconBgColor:"bg-indigo-100"}),e.jsx(R,{title:"API Tokens",value:(n==null?void 0:n.apiTokensCount)||0,icon:Ar,description:"Active tokens",iconColor:"text-amber-600",iconBgColor:"bg-amber-100"})]})]})]})},yo=()=>{const n=Ge(),{toast:t}=We(),[r,o]=a.useState(""),[s,i]=a.useState("all"),[u,x]=a.useState("all"),[m,h]=a.useState("created_at"),[p,d]=a.useState("desc"),{data:l,isLoading:b,error:N}=te({queryKey:["adminUsers",r,s,u,m,p],queryFn:async()=>{let c=U.from("profiles").select("*");s!=="all"&&(c=c.eq("subscription_plan",s.toUpperCase())),r&&(c=c.or(`email.ilike.%${r}%,full_name.ilike.%${r}%`)),c=c.order(m,{ascending:p==="asc"});const{data:w,error:_}=await c;if(_)throw _;return w}}),{data:P,isLoading:T}=te({queryKey:["userLeadsAndFormsCountsForAdmin"],queryFn:async()=>{if(!l||l.length===0)return{leads:{},forms:{}};const c={},w={},{data:_,error:D}=await U.from("forms").select("id, user_id");if(D)throw D;if(!_||_.length===0)return{leads:c,forms:w};const g={};_.forEach(M=>{g[M.user_id]||(g[M.user_id]=[]),g[M.user_id].push(M.id)});for(const M in g)w[M]=g[M].length;for(const M in g){const f=g[M];if(f.length>0){const{count:y,error:E}=await U.from("leads").select("id",{count:"exact",head:!0}).in("form_id",f);if(E)continue;c[M]=y||0}else c[M]=0}return{leads:c,forms:w}},enabled:!!l&&l.length>0}),{data:L,isLoading:K}=te({queryKey:["userCampaignDataForAdmin"],queryFn:async()=>{if(!l||l.length===0)return{};const c={};l.forEach(g=>{c[g.id]={totalCampaigns:0,totalRedirects:0,totalGroups:0}});const{data:w,error:_}=await U.from("campaigns").select("id, user_id");if(_)throw _;if(!w||w.length===0)return c;const D={};w.forEach(g=>{D[g.user_id]||(D[g.user_id]=[]),D[g.user_id].push(g.id),c[g.user_id]&&c[g.user_id].totalCampaigns++});for(const g in D){const M=D[g];if(M.length>0){const{data:f,error:y}=await U.from("campaign_groups").select("group_id").in("campaign_id",M);if(y)continue;if(f&&f.length>0){c[g].totalGroups=f.length;const E=f.map(ne=>ne.group_id),{count:k,error:ee}=await U.from("group_redirects").select("id",{count:"exact",head:!0}).in("group_id",E);ee||(c[g].totalRedirects=k||0)}}}return c},enabled:!!l&&l.length>0}),{data:$,isLoading:O}=te({queryKey:["adminUsersUsage",l==null?void 0:l.map(c=>c.id).join(",")],queryFn:async()=>{const c=(l||[]).map(D=>D.id);if(c.length===0)return{};const{data:w,error:_}=await U.functions.invoke("admin-analytics",{body:{action:"users-usage",userIds:c}});if(_)throw _;if(!(w!=null&&w.success))throw new Error((w==null?void 0:w.error)||"Failed to load usage");return w.data},enabled:!!l&&l.length>0}),W=c=>{m===c?d(p==="asc"?"desc":"asc"):(h(c),d("desc"))},ue=c=>{n(`/admin/users/${c}`)};N&&t({variant:"destructive",title:"Error loading users",description:"There was a problem loading the users."});const z=c=>{switch(c){case"FREE":return"outline";case"BASIC":return"secondary";case"PREMIUM":return"default";default:return"outline"}},me=c=>T||!P?null:P.leads[c]!==void 0?P.leads[c]:null,H=c=>T||!P?null:P.forms[c]??0,X=c=>K||!L?{totalCampaigns:0,totalRedirects:0,totalGroups:0}:L[c]||{totalCampaigns:0,totalRedirects:0,totalGroups:0},je=c=>
1O||!$?{sales_pages:{count:0,views:0,cta_clicks:0},crm:{opportunities:0,sales:0,revenue:0},webhooks:{endpoints:0,requests:0},api_tokens:{count:0}}:$[c]||{sales_pages:{count:0,views:0,cta_clicks:0},crm:{opportunities:0,sales:0,revenue:0},webhooks:{endpoints:0,requests:0},api_tokens:{count:0}},Z=c=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:0,maximumFractionDigits:0}).format(c);return e.jsxs("div",{className:"container mx-auto py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold",children:"User Management"}),e.jsxs(Me,{className:"ml-4",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4"})," Add User"]})]}),e.jsx(Jt,{}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(kr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(Wn,{placeholder:"Search by name or email",className:"pl-9",value:r,onChange:c=>o(c.target.value)})]}),e.jsx(Yt,{subscriptionFilter:s,statusFilter:u,onSubscriptionFilterChange:i,onStatusFilterChange:x})]}),e.jsx("div",{className:"border rounded-md overflow-x-auto",children:e.jsxs(zn,{children:[e.jsx(Hn,{children:e.jsxs(pe,{children:[e.jsxs(I,{className:"w-[180px] cursor-pointer",onClick:()=>W("full_name"),children:["User",m==="full_name"&&(p==="asc"?" â":" â")]}),e.jsxs(I,{className:"cursor-pointer",onClick:()=>W("subscription_plan"),children:["Plan",m==="subscription_plan"&&(p==="asc"?" â":" â")]}),e.jsxs(I,{className:"cursor-pointer",onClick:()=>W("leads_count"),children:["Leads",m==="leads_count"&&(p==="asc"?" â":" â")]}),e.jsx(I,{children:"Forms"}),e.jsx(I,{children:"Campaigns"}),e.jsx(I,{children:"Sales Pages"}),e.jsx(I,{children:"Opportunities"}),e.jsx(I,{children:"Transactions"}),e.jsx(I,{children:"Webhooks"}),e.jsx(I,{children:"API Tokens"}),e.jsxs(I,{className:"hidden md:table-cell cursor-pointer",onClick:()=>W("created_at"),children:["Signup",m==="created_at"&&(p==="asc"?" â":" â")]}),e.jsx(I,{className:"text-right",children:"Actions"})]})}),e.jsxs(Xn,{children:[b&&Array(5).fill(0).map((c,w)=>e.jsxs(pe,{children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(v,{className:"h-10 w-10 rounded-full"}),e.jsxs("div",{className:"ml-4 space-y-1",children:[e.jsx(v,{className:"h-4 w-[120px]"}),e.jsx(v,{className:"h-3 w-[80px]"})]})]})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-14"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-12"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-12"})}),e.jsx(j,{children:e.jsx(v,{className:"h-4 w-8"})}),e.jsx(j,{className:"hidden md:table-cell",children:e.jsx(v,{className:"h-4 w-20"})}),e.jsx(j,{className:"text-right",children:e.jsx(v,{className:"h-8 w-8 ml-auto"})})]},w)),l==null?void 0:l.map(c=>{const w=X(c.id),_=je(c.id),D=_.sales_pages,g=_.crm,M=_.webhooks;return e.jsxs(pe,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>ue(c.id),children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary font-medium",children:c.full_name?c.full_name.charAt(0).toUpperCase():c.email.charAt(0).toUpperCase()}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"font-medium text-sm truncate max-w-[120px]",children:c.full_name||"Unnamed"}),e.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:c.email})]})]})}),e.jsx(j,{children:e.jsx(Yn,{variant:z(c.subscription_plan),className:"text-xs",children:c.subscription_plan})}),e.jsx(j,{children:T?e.jsx(v,{className:"h-4 w-12"}):e.jsxs("span",{className:`text-sm ${me(c.id)>=c.leads_limit?"text-destructive":""}`,children:[me(c.id)??c.leads_count,"/",c.leads_limit]})}),e.jsx(j,{children:T?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:H(c.id)})}),e.jsx(j,{children:K?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:w.totalCampaigns})}),e.jsx(j,{children:O?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:D.count})}),e.jsx(j,{children:O?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:g.opportunities})}),e.jsx(j,{children:O?e.jsx(v,{className:"h-4 w-12"}):e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{children:g.sales}),g.revenue>0&&e.jsxs("span",{className:"text-muted-foreground text-xs ml-1",children:["(",Z(g.revenue),")"]})]})}),e.jsx(j,{children:O?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:M.endpoints})}),e.jsx(j,{children:O?e.jsx(v,{className:"h-4 w-8"}):e.jsx("span",{className:"text-sm",children:_.api_tokens.count})}),e.jsx(j,{className:"hidden md:table-cell text-sm",children:Ur(new Date(c.created_at),"MMM d, yyyy")}),e.jsx(j,{className:"text-right",children:e.jsx(Qt,{user:c})})]},c.id)}),(l==null?void 0:l.length)===0&&!b&&e.jsx(pe,{children:e.jsx(j,{colSpan:12,className:"h-24 text-center",children:"No users found."})})]})]})})]})};export{yo 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.