better-auth-studio 1.0.35 → 1.0.36-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -417,7 +417,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
417
417
|
}
|
|
418
418
|
`;document.head.appendChild(sk);const Ie=m.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:`flex h-10 w-full border border-dashed border-white/20 bg-black/30 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,ref:r,...n}));Ie.displayName="Input";const He=m.forwardRef(({className:e,...t},n)=>s.jsx("label",{className:`text-sm font-light text-white ${e}`,ref:n,...t}));He.displayName="Label";function ak({currentPage:e,totalPages:t,onPageChange:n,totalItems:r,startIndex:a,endIndex:i}){const o=()=>{const d=[],h=[];for(let u=Math.max(2,e-2);u<=Math.min(t-1,e+2);u++)d.push(u);return e-2>2?h.push(1,"..."):h.push(1),h.push(...d),e+2<t-1?h.push("...",t):t>1&&h.push(t),h};if(t<=1)return null;const l=o();return s.jsxs("div",{className:"flex items-center justify-between mt-6",children:[s.jsxs("div",{className:"text-sm text-gray-400",children:["Showing ",a+1," to ",Math.min(i,r)," of ",r," items"]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:e===1,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[s.jsx(FN,{className:"w-4 h-4"}),"Previous"]}),l.map((c,d)=>{if(c==="...")return s.jsx(Y,{variant:"outline",size:"sm",disabled:!0,className:"border border-dashed border-white/20 text-white rounded-none",children:s.jsx(UP,{className:"w-4 h-4"})},`dots-${d}`);const h=c,u=e===h;return s.jsx(Y,{variant:u?"default":"outline",size:"sm",onClick:()=>n(h),className:u?"bg-white text-black rounded-none":"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:h},h)}),s.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:["Next",s.jsx(hx,{className:"w-4 h-4"})]})]})]})}const Vl=m.createContext({isOpen:!1,setIsOpen:()=>{}}),pa=m.forwardRef(({className:e,value:t,onValueChange:n,children:r,...a},i)=>{const[o,l]=m.useState(!1);return s.jsx(Vl.Provider,{value:{value:t,onValueChange:n,isOpen:o,setIsOpen:l},children:s.jsx("div",{ref:i,className:`relative ${e}`,...a,children:r})})});pa.displayName="Select";const xa=m.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:a,setIsOpen:i}=m.useContext(Vl);return s.jsxs("button",{ref:r,type:"button",className:`flex h-10 w-full items-center justify-between border bg-black/30 px-3 py-2 text-sm text-white focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,onClick:()=>i(!a),...n,children:[t,s.jsx(zu,{className:`h-4 w-4 text-gray-400 transition-transform ${a?"rotate-180":""}`})]})});xa.displayName="SelectTrigger";const Wx=m.forwardRef(({className:e,placeholder:t,...n},r)=>{const{value:a}=m.useContext(Vl);return s.jsx("span",{ref:r,className:`text-sm text-white ${e}`,...n,children:a||t})});Wx.displayName="SelectValue";const ga=m.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:a}=m.useContext(Vl);return a?s.jsx("div",{ref:r,className:`absolute top-full left-0 right-0 z-50 mt-1 border border-dashed border-white/20 bg-black/90 rounded-none shadow-lg ${e}`,...n,children:t}):null});ga.displayName="SelectContent";const sn=m.forwardRef(({className:e,children:t,value:n,...r},a)=>{const{onValueChange:i,setIsOpen:o}=m.useContext(Vl);return s.jsx("div",{ref:a,className:`px-3 py-2 text-sm text-white hover:bg-white/10 cursor-pointer ${e}`,onClick:()=>{i==null||i(n),o(!1)},...r,children:t})});sn.displayName="SelectItem";function ik(){const e=Mr(),{counts:t,refetchCounts:n}=Xu(),[r,a]=m.useState([]),[i,o]=m.useState(!0),[l,c]=m.useState(null),[d,h]=m.useState(""),[u,f]=m.useState("all"),[p,w]=m.useState([]),[v,b]=m.useState(1),[g]=m.useState(20),[y,x]=m.useState(!1),[N,j]=m.useState(!1),[k,S]=m.useState(!1),[M,A]=m.useState(!1),[I,U]=m.useState(!1),[$,L]=m.useState(!1),[E,O]=m.useState(null),[D,T]=m.useState([]),[C,_]=m.useState(!1),[z,H]=m.useState({name:"",slug:""}),[P,B]=m.useState({name:"",slug:""});m.useEffect(()=>{R()},[]);const q=ae=>ae.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),G=ae=>{const me=q(ae);H({name:ae,slug:me})},se=ae=>{H(me=>({...me,slug:q(ae)}))},re=ae=>{const me=q(ae);B({name:ae,slug:me})},Z=ae=>{B(me=>({...me,slug:q(ae)}))},R=async()=>{try{const me=await(await fetch("/api/plugins")).json(),ze=(me==null?void 0:me.plugins).find(X=>X.id==="organization");c({enabled:!!ze,availablePlugins:(me==null?void 0:me.plugins).map(X=>X.id),configPath:me.configPath,organizationPlugin:(me==null?void 0:me.plugins).find(X=>X.id==="organization")}),ze?await ee():o(!1)}catch(ae){console.error("Failed to check plugin status:",ae),c({enabled:!1,error:"Failed to check plugin status"}),o(!1)}},ee=async()=>{try{const me=await(await fetch("/api/organizations?limit=10000")).json();console.log({lenght:me.organizations.length}),a(me.organizations||[])}catch(ae){console.error("Failed to fetch organizations:",ae),V.error("Failed to fetch organizations")}finally{o(!1)}},J=async ae=>{T([]),_(!0),T([{id:"start",type:"info",message:`Starting organization seeding process for ${ae} organizations...`,timestamp:new Date}]);try{const ze=await(await fetch("/api/seed/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:ae})})).json();if(ze.success){const X=ze.results.map((W,te)=>W.success?{id:`org-${te}`,type:"progress",message:`Creating organization: ${W.organization.name} (${W.organization.slug})`,timestamp:new Date,status:"completed"}:{id:`org-${te}`,type:"error",message:`Failed to create organization ${te+1}: ${W.error}`,timestamp:new Date});T(W=>[...W,...X]);const le=ze.results.filter(W=>W.success).length;T(W=>[...W,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${le}/${ae} organizations successfully`,timestamp:new Date}]),await ee(),await n()}else T(X=>[...X,{id:"error",type:"error",message:`❌ Seeding failed: ${ze.error||"Unknown error"}`,timestamp:new Date}])}catch(me){T(ze=>[...ze,{id:"error",type:"error",message:`❌ Network error: ${me}`,timestamp:new Date}])}finally{_(!1)}},F=ae=>{O(ae),U(!0)},K=ae=>{O(ae),B({name:ae.name,slug:ae.slug}),S(!0)},ne=ae=>{O(ae),A(!0)},ce=async()=>{if(!z.name){V.error("Please fill in the organization name");return}const ae=V.loading("Creating organization...");try{const ze=await(await fetch("/api/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,slug:z.slug})})).json();ze.success?(await ee(),x(!1),H({name:"",slug:""}),V.success("Organization created successfully!",{id:ae})):V.error(`Error creating organization: ${ze.error||"Unknown error"}`,{id:ae})}catch(me){console.error("Error creating organization:",me),V.error("Error creating organization",{id:ae})}},ge=async()=>{if(!E){V.error("No organization selected");return}if(!P.name){V.error("Please fill in the organization name");return}const ae=V.loading("Updating organization...");try{const ze=await(await fetch(`/api/organizations/${E.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,slug:P.slug})})).json();ze.success?(await ee(),S(!1),O(null),B({name:"",slug:""}),V.success("Organization updated successfully!",{id:ae})):V.error(`Error updating organization: ${ze.error||"Unknown error"}`,{id:ae})}catch(me){console.error("Error updating organization:",me),V.error("Error updating organization",{id:ae})}},ve=async()=>{if(!E){V.error("No organization selected");return}const ae=V.loading("Deleting organization...");try{const ze=await(await fetch(`/api/organizations/${E.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();ze.success?(await ee(),await n(),A(!1),O(null),V.success("Organization deleted successfully!",{id:ae})):V.error(`Error deleting organization: ${ze.error||"Unknown error"}`,{id:ae})}catch(me){console.error("Error deleting organization:",me),V.error("Error deleting organization",{id:ae})}},Ae=()=>{if(r.length===0){V.error("No organizations to export");return}const ae=["ID","Name","Slug","Created At","Updated At"],me=r.map(te=>[te.id,te.name||"",te.slug||"",new Date(te.createdAt).toLocaleString(),new Date(te.updatedAt).toLocaleString()]),ze=[ae.join(","),...me.map(te=>te.map(de=>`"${de}"`).join(","))].join(`
|
|
419
419
|
`),X=new Blob([ze],{type:"text/csv;charset=utf-8;"}),le=document.createElement("a"),W=URL.createObjectURL(X);le.setAttribute("href",W),le.setAttribute("download",`organizations-export-${new Date().toISOString().split("T")[0]}.csv`),le.style.visibility="hidden",document.body.appendChild(le),le.click(),document.body.removeChild(le),V.success(`Exported ${r.length} organizations to CSV`)},Te=ae=>{p.some(me=>me.type===ae)||w([...p,{type:ae}])},tt=ae=>{w(p.filter(me=>me.type!==ae))},ut=()=>{w([])},Le=(ae,me)=>{w(ze=>ze.map(X=>X.type===ae?{...X,dateRange:me}:X))},Oe=r.filter(ae=>{const me=ae.name.toLowerCase().includes(d.toLowerCase())||ae.slug.toLowerCase().includes(d.toLowerCase());if(p.length===0)return me;const ze=p.every(X=>{var le,W,te,de;switch(X.type){case"createdAt":{if(!((le=X.dateRange)!=null&&le.from)&&!((W=X.dateRange)!=null&&W.to))return!0;const Ne=new Date(ae.createdAt);return!((te=X.dateRange)!=null&&te.from&&X.dateRange.from>Ne||(de=X.dateRange)!=null&&de.to&&X.dateRange.to<Ne)}default:return!0}});return me&&ze}),Ge=Math.ceil(Oe.length/g),Je=(v-1)*g,ot=Je+g,Ot=Oe.slice(Je,ot),zt=ae=>{b(ae)};return i?s.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(Xr,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading organizations..."})]})}):l&&!l.enabled?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl text-white font-light",children:"Organizations"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"Manage your application organizations"})]})}),s.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:s.jsxs("div",{className:"flex items-start space-x-4",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx(pr,{className:"w-12 h-12 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),s.jsx("p",{className:"text-gray-300 mb-6",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),s.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[s.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),s.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:s.jsxs("li",{children:["Import the plugin in your auth configuration file",l.configPath&&s.jsxs("span",{className:"text-gray-400",children:[" (",l.configPath,")"]}),":"]})}),s.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:s.jsxs("pre",{className:"text-sm text-gray-300",children:[s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",s.jsx("span",{className:"text-blue-400",children:"from"})," ",s.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",s.jsx("br",{}),s.jsx("span",{className:"text-blue-400",children:"export const"})," ",s.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",s.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",s.jsx("br",{}),s.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",s.jsx("br",{}),s.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",s.jsx("br",{}),s.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),s.jsx("br",{}),s.jsx("span",{className:"pl-10",children:"]"})," ",s.jsx("br",{}),"}",") ",s.jsx("br",{})]})}),s.jsx("div",{className:"mt-4",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),s.jsx("div",{className:"mt-2",children:s.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),l.availablePlugins&&l.availablePlugins.length>0&&s.jsx("div",{className:"mb-4",children:s.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",l.availablePlugins.join(", ")]})}),s.jsx(Y,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),s.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",s.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Organizations",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:s.jsx(br,{value:t.organizations??0,className:"text-white font-mono text-sm",prefix:s.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),s.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your organizations and teams"})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:Ae,children:[s.jsx(UN,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>L(!0),children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>x(!0),children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Add Organization"]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search organizations...",value:d,onChange:ae=>h(ae.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx("div",{className:"flex items-center space-x-2",children:s.jsxs(pa,{value:"",onValueChange:Te,children:[s.jsx(xa,{className:"w-[180px]",children:s.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[s.jsx(zs,{className:"w-4 h-4"}),s.jsx("span",{children:"Add Filter"})]})}),s.jsx(ga,{children:!p.some(ae=>ae.type==="createdAt")&&s.jsx(sn,{value:"createdAt",children:"Created Date"})})]})}),p.length>0&&s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx(Y,{onClick:ut,children:"Clear all"})})]}),p.length>0&&s.jsx("div",{className:"space-y-3",children:s.jsx("div",{className:"flex flex-wrap gap-3",children:p.map(ae=>{var me,ze,X,le;return s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[s.jsx(fx,{className:"w-3 h-3 text-white"}),ae.type==="createdAt"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Created:"}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(me=ae.dateRange)!=null&&me.from?An(ae.dateRange.from,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(ze=ae.dateRange)==null?void 0:ze.from,onSelect:W=>{var te;return Le("createdAt",{from:W,to:(te=ae.dateRange)==null?void 0:te.to})},initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(X=ae.dateRange)!=null&&X.to?An(ae.dateRange.to,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(le=ae.dateRange)==null?void 0:le.to,onSelect:W=>{var te;return Le("createdAt",{from:(te=ae.dateRange)==null?void 0:te.from,to:W})},initialFocus:!0,disabled:W=>{var te;return(te=ae.dateRange)!=null&&te.from?W<ae.dateRange.from:!1},className:"rounded-none"})})]})]}),s.jsx("button",{onClick:()=>tt(ae.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:s.jsx(Pt,{className:"w-3 h-3 text-white"})})]},ae.type)})})})]}),s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Organization"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Slug"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:Oe.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(pr,{className:"w-8 h-8 text-white/50"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium text-lg",children:"No organizations found"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:d||u!=="all"?"Try adjusting your search or filter criteria":"Get started by creating your first organization"})]}),!d&&u==="all"&&s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>x(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[s.jsx(zs,{className:"w-4 h-4 mr-2"}),"Create Organization"]}),s.jsxs(Y,{onClick:()=>L(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):Ot.map(ae=>s.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>e(`/organizations/${ae.id}`),children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(pr,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:ae.name}),s.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",ae.id]})]})]})}),s.jsx("td",{className:"py-4 px-4 text-white",children:ae.slug}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:s.jsxs("div",{className:"flex flex-col",children:[new Date(ae.createdAt).toLocaleDateString(),s.jsx("p",{className:"text-xs",children:new Date(ae.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:me=>{me.stopPropagation(),F(ae)},children:s.jsx(Il,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:me=>{me.stopPropagation(),K(ae)},children:s.jsx(Ca,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:me=>{me.stopPropagation(),ne(ae)},children:s.jsx(mx,{className:"w-4 h-4"})})]})})]},ae.id))})]})}),s.jsx(ak,{currentPage:v,totalPages:Ge,onPageChange:zt,totalItems:Oe.length,startIndex:Je,endIndex:ot})]}),$&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[s.jsx("span",{className:"text-white/50 mr-2",children:"["}),s.jsx(pr,{className:"inline mr-2 w-3.5 h-3.5 text-white"}),s.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Organizations"}),s.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"organization-count",className:"text-sm text-gray-400 font-light",children:"Number of organizations"}),s.jsx(Ie,{id:"organization-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var me;const ae=parseInt(((me=document.getElementById("organization-count"))==null?void 0:me.value)||"5",10);J(ae)},disabled:C,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:C?s.jsxs(s.Fragment,{children:[s.jsx(Xr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"w-3 h-3 mr-2"}),"Seed Organizations"]})})]})}),D.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"Organization Seeding Terminal",lines:D,isRunning:C,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),s.jsx("div",{className:"flex justify-end mt-6 pt-6",children:s.jsx(Y,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),y&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create Organization"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"create-name",value:z.name,onChange:ae=>G(ae.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),s.jsx(Ie,{id:"create-slug",value:z.slug,onChange:ae=>se(ae.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{x(!1),H({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ce,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),k&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Organization"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(pr,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.slug})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"edit-name",value:P.name,onChange:ae=>re(ae.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),s.jsx(Ie,{id:"edit-slug",value:P.slug,onChange:ae=>Z(ae.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{S(!1),B({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ge,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),M&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Organization"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>A(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(pr,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.slug})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this organization? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>A(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ve,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),I&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Organization Details"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>U(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(pr,{className:"w-8 h-8 text-white"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.slug})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"ID:"}),s.jsx("span",{className:"text-white text-sm",children:E.id})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Created:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.createdAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Updated:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.updatedAt).toLocaleString()})]})]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(Y,{onClick:()=>U(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function ok(){const e=Mr(),{counts:t,refetchCounts:n}=Xu(),[r,a]=m.useState([]),[i,o]=m.useState(!0),[l,c]=m.useState(""),[d,h]=m.useState([]),[u,f]=m.useState(1),[p]=m.useState(20),[w,v]=m.useState(!1),[b,g]=m.useState(!1),[y,x]=m.useState(!1),[N,j]=m.useState(!1),[k,S]=m.useState(!1),[M,A]=m.useState(!1),[I,U]=m.useState(!1),[$,L]=m.useState(!1),[E,O]=m.useState(null),[D,T]=m.useState(null),[C,_]=m.useState(""),[z,H]=m.useState(),[P,B]=m.useState(!1),[q,G]=m.useState([]),[se,re]=m.useState(!1),Z=m.useCallback(async()=>{try{const le=await(await fetch("/api/users?limit=10000")).json();a(le.users||[])}catch{}finally{o(!1)}},[]),R=m.useCallback(async()=>{try{const le=await(await fetch("/api/admin/status")).json();B(le.enabled)}catch{B(!1)}},[]);m.useEffect(()=>{Z(),R();const X=()=>{D&&T(null)};return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[D,R,Z]);const ee=async X=>{G([]),re(!0),G([{id:"start",type:"info",message:`Starting user seeding process for ${X} users...`,timestamp:new Date}]);try{const W=await(await fetch("/api/seed/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:X})})).json();if(W.success){const te=W.results.map((Ne,Se)=>Ne.success?{id:`user-${Se}`,type:"progress",message:`Creating user: ${Ne.user.name} (${Ne.user.email})`,timestamp:new Date,status:"completed"}:{id:`user-${Se}`,type:"error",message:`Failed to create user ${Se+1}: ${Ne.error}`,timestamp:new Date});G(Ne=>[...Ne,...te]);const de=W.results.filter(Ne=>Ne.success).length;G(Ne=>[...Ne,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${de}/${X} users successfully`,timestamp:new Date}]),await Z(),await n()}else G(te=>[...te,{id:"error",type:"error",message:`❌ Seeding failed: ${W.error||"Unknown error"}`,timestamp:new Date}])}catch(le){G(W=>[...W,{id:"error",type:"error",message:`❌ Network error: ${le}`,timestamp:new Date}])}finally{re(!1)}},J=X=>{O(X),j(!0)},F=X=>{O(X),g(!0)},K=X=>{O(X),x(!0)},ne=async()=>{var de,Ne,Se;const X=(de=document.getElementById("create-name"))==null?void 0:de.value,le=(Ne=document.getElementById("create-email"))==null?void 0:Ne.value,W=(Se=document.getElementById("create-password"))==null?void 0:Se.value;if(!X||!le||!W){V.error("Please fill in all fields");return}const te=V.loading("Creating user...");try{const Pe=await(await fetch("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X,email:le,password:W})})).json();Pe.success?(await Z(),v(!1),document.getElementById("create-name").value="",document.getElementById("create-email").value="",document.getElementById("create-password").value="",V.success("User created successfully!",{id:te})):V.error(`Error creating user: ${Pe.error||"Unknown error"}`,{id:te})}catch{V.error("Error creating user",{id:te})}},ce=async()=>{var te,de;if(!E){V.error("No user selected");return}const X=(te=document.getElementById("edit-name"))==null?void 0:te.value,le=(de=document.getElementById("edit-email"))==null?void 0:de.value;if(!X||!le){V.error("Please fill in all fields");return}const W=V.loading("Updating user...");try{const Se=await(await fetch(`/api/users/${E.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X,email:le})})).json();Se.success?(await Z(),g(!1),O(null),V.success("User updated successfully!",{id:W})):V.error(`Error updating user: ${Se.error||"Unknown error"}`,{id:W})}catch{V.error("Error updating user",{id:W})}},ge=async()=>{if(!E){V.error("No user selected");return}const X=V.loading("Deleting user...");try{const W=await(await fetch(`/api/users/${E.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();W.success?(await Z(),await n(),x(!1),O(null),V.success("User deleted successfully!",{id:X})):V.error(`Error deleting user: ${W.error||"Unknown error"}`,{id:X})}catch{V.error("Error deleting user",{id:X})}},ve=async()=>{if(!E)return;if(!P){V.error("Admin plugin is not enabled");return}const X=V.loading("Banning user...");try{const le=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:E.id,banReason:C||"No reason provided",banExpiresIn:z})}),W=await le.json();le.ok?(V.success("User banned successfully!",{id:X}),A(!1),_(""),H(void 0),O(null),T(null),Z()):V.error(`Error banning user: ${W.error||W.message||"Unknown error"}`,{id:X})}catch{V.error("Error banning user",{id:X})}},Ae=async()=>{if(!E)return;if(!P){V.error("Admin plugin is not enabled");return}const X=V.loading("Unbanning user...");try{const le=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:E.id})}),W=await le.json();le.ok?(V.success("User unbanned successfully!",{id:X}),U(!1),O(null),T(null),Z()):V.error(`Error unbanning user: ${W.error||W.message||"Unknown error"}`,{id:X})}catch{V.error("Error unbanning user",{id:X})}},Te=async()=>{var W;if(!E){V.error("No user selected");return}const X=(W=document.getElementById("update-password"))==null?void 0:W.value;if(!X){V.error("Please enter a new password");return}const le=V.loading("Updating password...");try{const te=await fetch(`/api/users/${E.id}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:X})}),de=await te.json();te.ok&&de.success?(V.success("Password updated successfully!",{id:le}),L(!1),O(null),document.getElementById("update-password").value=""):V.error(`Error updating password: ${de.error||"Unknown error"}`,{id:le})}catch{V.error("Error updating password",{id:le})}},tt=()=>{if(r.length===0){V.error("No users to export");return}const X=["ID","Name","Email","Email Verified","Created At","Updated At"],le=r.map(Se=>[Se.id,Se.name||"",Se.email||"",!!Se.emailVerified,new Date(Se.createdAt).toLocaleString(),new Date(Se.updatedAt).toLocaleString()]),W=[X.join(","),...le.map(Se=>Se.map(ue=>`"${ue}"`).join(","))].join(`
|
|
420
|
-
`),te=new Blob([W],{type:"text/csv;charset=utf-8;"}),de=document.createElement("a"),Ne=URL.createObjectURL(te);de.setAttribute("href",Ne),de.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),de.style.visibility="hidden",document.body.appendChild(de),de.click(),document.body.removeChild(de),V.success(`Exported ${r.length} users to CSV`)},ut=X=>{d.some(W=>W.type===X)||(h(W=>[...W,{type:X}]),f(1))},Le=X=>{h(le=>le.filter(W=>W.type!==X)),f(1)},Oe=(X,le)=>{h(W=>W.map(te=>te.type===X?{...te,value:le}:te))},Ge=(X,le)=>{h(W=>W.map(te=>te.type===X?{...te,dateRange:le}:te))},Je=r.filter(X=>{const le=X.name.toLowerCase().includes(l.toLowerCase())||X.email.toLowerCase().includes(l.toLowerCase());if(d.length===0)return le;const W=d.every(te=>{var de,Ne,Se,ue,Pe;switch(te.type){case"emailVerified":return te.value===void 0?!0:X.emailVerified===(te.value==="true");case"banned":return te.value===void 0?!0:X.banned===(te.value==="true");case"active":return X.banned!==!0;case"createdAt":{if(!((de=te.dateRange)!=null&&de.from)&&!((Ne=te.dateRange)!=null&&Ne.to))return!0;const _e=new Date(X.createdAt);return!((Se=te.dateRange)!=null&&Se.from&&te.dateRange.from>_e||(ue=te.dateRange)!=null&&ue.to&&te.dateRange.to<_e)}case"role":return te.value?(Pe=X.role)==null?void 0:Pe.toLowerCase().includes(te.value.toLowerCase()):!0;default:return!0}});return le&&W}),ot=r.filter(X=>X.banned).length,Ot=Math.ceil(Je.length/p),zt=(u-1)*p,ae=zt+p,me=Je.slice(zt,ae),ze=X=>{f(X)};return i?s.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(Xr,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:s.jsx(br,{value:t.users??0,className:"text-white font-mono text-sm",prefix:s.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),s.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),s.jsx("div",{className:"flex items-center space-x-4 mt-2",children:ot>0&&s.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[s.jsx(Cc,{className:"w-3 h-3"}),s.jsxs("span",{children:[ot," Banned"]})]})})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:tt,children:[s.jsx(UN,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>S(!0),children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>v(!0),children:[s.jsx(Pm,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search users...",value:l,onChange:X=>c(X.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx("div",{className:"flex items-center space-x-2",children:s.jsxs(pa,{value:"",onValueChange:ut,children:[s.jsx(xa,{className:"w-[180px]",children:s.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[s.jsx(zs,{className:"w-4 h-4"}),s.jsx("span",{children:"Add Filter"})]})}),s.jsxs(ga,{children:[!d.some(X=>X.type==="emailVerified")&&s.jsx(sn,{value:"emailVerified",children:"Email Verified"}),!d.some(X=>X.type==="banned")&&s.jsx(sn,{value:"banned",children:"Banned Status"}),!d.some(X=>X.type==="createdAt")&&s.jsx(sn,{value:"createdAt",children:"Created Date"}),!d.some(X=>X.type==="role")&&s.jsx(sn,{value:"role",children:"Role"})]})]})}),d.length>0&&s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx(Y,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),d.length>0&&s.jsx("div",{className:"space-y-3",children:s.jsx("div",{className:"flex flex-wrap gap-3",children:d.map(X=>{var le,W,te,de;return s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[s.jsx(fx,{className:"w-3 h-3 text-white"}),X.type==="emailVerified"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),s.jsxs(pa,{value:X.value||"",onValueChange:Ne=>Oe("emailVerified",Ne),children:[s.jsx(xa,{className:"h-7 w-24 text-xs",children:s.jsx("span",{children:X.value==="true"?"True":X.value==="false"?"False":"Select"})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"true",children:"True"}),s.jsx(sn,{value:"false",children:"False"})]})]})]}),X.type==="banned"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Banned:"}),s.jsxs(pa,{value:X.value||"",onValueChange:Ne=>Oe("banned",Ne),children:[s.jsx(xa,{className:"h-7 w-24 text-xs",children:s.jsx("span",{children:X.value==="true"?"Yes":X.value==="false"?"No":"Select"})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"true",children:"Yes"}),s.jsx(sn,{value:"false",children:"No"})]})]})]}),X.type==="createdAt"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Created:"}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(le=X.dateRange)!=null&&le.from?An(X.dateRange.from,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(W=X.dateRange)==null?void 0:W.from,onSelect:Ne=>{var Se;return Ge("createdAt",{from:Ne,to:(Se=X.dateRange)==null?void 0:Se.to})},initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(te=X.dateRange)!=null&&te.to?An(X.dateRange.to,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(de=X.dateRange)==null?void 0:de.to,onSelect:Ne=>{var Se;return Ge("createdAt",{from:(Se=X.dateRange)==null?void 0:Se.from,to:Ne})},initialFocus:!0,disabled:Ne=>{var Se;return(Se=X.dateRange)!=null&&Se.from?Ne<X.dateRange.from:!1},className:"rounded-none"})})]})]}),X.type==="role"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Role:"}),s.jsx(Ie,{type:"text",value:X.value||"",onChange:Ne=>Oe("role",Ne.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),s.jsx("button",{onClick:()=>Le(X.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:s.jsx(Pt,{className:"w-3 h-3 text-white"})})]},X.type)})})})]}),s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:me.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(Ma,{className:"w-8 h-8 text-white/50"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||d.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&d.length===0&&s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>v(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[s.jsx(Pm,{className:"w-4 h-4 mr-2"}),"Create User"]}),s.jsxs(Y,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):me.map(X=>s.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${X.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${X.id}`),children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:X.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${X.id}`,alt:X.name,className:`w-10 h-10 rounded-none border border-dashed ${X.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),X.banned&&s.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:s.jsx(Cc,{className:"w-3 h-3 text-white"})})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"text-white font-light",children:X.name}),X.banned&&s.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide",children:"Banned"})]}),s.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:X.email})]})]})}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[X.emailVerified?s.jsx(OP,{className:"w-4 h-4 text-green-400"}):s.jsx(Yd,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-sm text-gray-400",children:X.emailVerified?"Verified":"Not Verified"})]})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:s.jsxs("div",{className:"flex flex-col",children:[new Date(X.createdAt).toLocaleDateString(),s.jsx("p",{className:"text-xs",children:new Date(X.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"relative flex items-center justify-end",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:le=>{le.stopPropagation(),T(D===X.id?null:X.id)},children:s.jsx(BP,{className:"w-4 h-4"})}),D===X.id&&s.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg z-50",onClick:le=>le.stopPropagation(),children:[s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),J(X)},children:[s.jsx(Il,{className:"w-4 h-4"}),s.jsx("span",{children:"View Details"})]}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),F(X)},children:[s.jsx(Ca,{className:"w-4 h-4"}),s.jsx("span",{children:"Edit User"})]}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),O(X),L(!0)},children:[s.jsx(Mn,{className:"w-4 h-4"}),s.jsx("span",{children:"Update Password"})]}),P&&(X.banned?s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),O(X),U(!0),T(null)},children:[s.jsx(Cc,{className:"w-4 h-4"}),s.jsx("span",{children:"Unban User"})]}):s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),O(X),A(!0),T(null)},children:[s.jsx(Cc,{className:"w-4 h-4"}),s.jsx("span",{children:"Ban User"})]})),s.jsx("div",{className:"border-t border-white/10 my-1"}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),K(X)},children:[s.jsx(mx,{className:"w-4 h-4"}),s.jsx("span",{children:"Delete User"})]})]})]})})]},X.id))})]})}),s.jsx(ak,{currentPage:u,totalPages:Ot,onPageChange:ze,totalItems:Je.length,startIndex:zt,endIndex:ae})]}),k&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[s.jsx("span",{className:"text-white/50 mr-2",children:"["}),s.jsx(Ma,{className:"inline mr-2 w-3 h-3 text-white"}),s.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),s.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center space-x-2"}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),s.jsx(Ie,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var le;const X=parseInt(((le=document.getElementById("user-count"))==null?void 0:le.value)||"5",10);ee(X)},disabled:se,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:se?s.jsxs(s.Fragment,{children:[s.jsx(Xr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),q.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"User Seeding Terminal",lines:q,isRunning:se,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),s.jsx("div",{className:"flex justify-end mt-6 pt-6",children:s.jsx(Y,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),w&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),s.jsx(Ie,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),s.jsx(Ie,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>v(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ne,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),b&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"edit-name",defaultValue:E.name,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),s.jsx(Ie,{id:"edit-email",type:"email",defaultValue:E.email,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ce,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),y&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>x(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ge,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),N&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"User Details"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"ID:"}),s.jsx("span",{className:"text-white text-sm",children:E.id})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Email Verified:"}),s.jsx("span",{className:"text-white text-sm",children:E.emailVerified?"Yes":"No"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Created:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.createdAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Updated:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.updatedAt).toLocaleString()})]})]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(Y,{onClick:()=>j(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})}),M&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[s.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),s.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",s.jsx("strong",{children:E.name})," from accessing the system."]}),s.jsxs("div",{className:"space-y-4 mb-6",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),s.jsx(Ie,{id:"banReason",value:C,onChange:X=>_(X.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),s.jsx(Ie,{id:"banExpires",type:"number",value:z||"",onChange:X=>H(X.target.value?Number(X.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>{A(!1),_(""),H(void 0),O(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ve,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),I&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[s.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),s.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",s.jsx("strong",{children:E.name}),"? This will restore their access to the system."]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>{U(!1),O(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:Ae,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),$&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{L(!1),O(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),s.jsx(Ie,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{L(!1),O(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:Te,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const So=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function yF(){const[e]=m.useState("overview"),[t,n]=m.useState(!1),[r,a]=m.useState(0),[i,o]=m.useState(0),[l,c]=m.useState("1D"),[d,h]=m.useState("1D"),[u,f]=m.useState(null),[p,w]=m.useState(!1),[v,b]=m.useState("Daily"),[g,y]=m.useState("Daily"),[x,N]=m.useState("Daily"),[j,k]=m.useState("Daily"),[S,M]=m.useState(!1),[A,I]=m.useState(!1),[U,$]=m.useState(!1),[L,E]=m.useState(!1),[O,D]=m.useState(null),[T,C]=m.useState(null),[_,z]=m.useState(null),[H,P]=m.useState(null),[B,q]=m.useState(null),[G,se]=m.useState(void 0),[re,Z]=m.useState(void 0),[R,ee]=m.useState(void 0),[J,F]=m.useState(void 0),[K,ne]=m.useState(void 0),[ce,ge]=m.useState(void 0),[ve,Ae]=m.useState(void 0),[Te,tt]=m.useState(void 0),[ut,Le]=m.useState([]),[Oe,Ge]=m.useState([]),[Je,ot]=m.useState(0),[Ot,zt]=m.useState([]),[ae,me]=m.useState([]),[ze,X]=m.useState(0),[le,W]=m.useState(0),[te,de]=m.useState(0),[Ne,Se]=m.useState(0),[ue,Pe]=m.useState(0),[_e,Fe]=m.useState(!1),[bt,he]=m.useState(!1),[Ve,vt]=m.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[Nt,En]=m.useState([]),[Qe,$t]=m.useState(!1),[lr,qt]=m.useState(0),[Rt,La]=m.useState(0),[hn,Yl]=m.useState(0),[eo,to]=m.useState(0),[eh,th]=m.useState(0),[qs,no]=m.useState([]),[Xl,Fa]=m.useState(0),[Ua,Ba]=m.useState(0),{counts:rs,loading:Ar}=Xu(),ss=Mr(),Gs=["Daily","Weekly","Monthly","Yearly","Custom"],ql={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},nh=m.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),as=fe=>fe==null?"...":nh.format(Number(fe)),is=fe=>fe==null?"...":Number(fe).toLocaleString(),ro=m.useMemo(()=>So.reduce((fe,xe)=>(fe[xe.id]=(Ve[xe.id]||[]).reduce((pe,ie)=>pe+ie,0),fe),{}),[Ve]),rh=m.useMemo(()=>Object.values(ro).reduce((fe,xe)=>fe+xe,0),[ro]),sh=(fe,xe)=>{const pe=fe.currentTarget.getBoundingClientRect();P(xe),q({x:pe.left+pe.width/2,y:pe.top})},ih=(()=>{const fe=[];return O!=null&&O.isOutdated?fe.push({id:"version-check",title:`Update Better-Auth to v${O.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `npm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):O&&fe.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),fe.push(),fe})(),nt=m.useCallback(async(fe,xe,pe,ie)=>{try{const be=new URLSearchParams({type:fe,period:xe});return pe&&be.append("from",pe.toISOString()),ie&&be.append("to",ie.toISOString()),await(await fetch(`/api/analytics?${be.toString()}`)).json()}catch{return null}},[]);m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/users/all")).json();pe!=null&&pe.success&&pe.users&&no(pe.users)}catch{no([])}})()},[]),m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/stats")).json();pe&&(a(pe.activeUsers||0),o(pe.totalUsers||0))}catch{a(0),o(0)}})()},[]),m.useEffect(()=>{(async()=>{const xe=await nt("users",l,G,re);xe&&(Le(xe.data||[]),Ge(xe.labels||[]),ot(xe.percentageChange||0))})()},[l,G,re,nt]),m.useEffect(()=>{if(qs.length===0){Fa(0),Ba(0);return}const fe=new Date;let xe,pe=fe,ie,be;if(g==="Custom"){if(!R||!J){Fa(0),Ba(0);return}xe=new Date(R),pe=new Date(J),pe.setHours(23,59,59,999);const Ut=pe.getTime()-xe.getTime();be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-Ut)}else switch(g){case"Daily":xe=new Date(fe),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-24*60*60*1e3);break;case"Weekly":xe=new Date(fe),xe.setDate(fe.getDate()-fe.getDay()),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-7*24*60*60*1e3);break;case"Monthly":xe=new Date(fe.getFullYear(),fe.getMonth(),1),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(fe.getFullYear(),fe.getMonth()-1,1),ie.setHours(0,0,0,0);break;case"Yearly":xe=new Date(fe.getFullYear(),0,1),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(fe.getFullYear()-1,0,1),ie.setHours(0,0,0,0);break;default:Fa(0),Ba(0);return}const Ce=qs.filter(Ut=>{if(!Ut.createdAt)return!1;const os=new Date(Ut.createdAt);return os>=xe&&os<=pe}),je=qs.filter(Ut=>{if(!Ut.createdAt)return!1;const os=new Date(Ut.createdAt);return os>=ie&&os<=be}),we=Ce.length,Ue=je.length;let tn=0;Ue>0?tn=(we-Ue)/Ue*100:we>0&&(tn=100),Fa(we),Ba(tn)},[qs,g,R,J]),m.useEffect(()=>{(async()=>{if(!(d==="Custom"&&(!R||!J))){$t(!0);try{const[xe,pe,ie,be,Ce]=await Promise.all([nt("newUsers",d,R,J),nt("activeUsers",d,R,J),nt("organizations",d,R,J),nt("teams",d,R,J),nt("sessions",d,R,J)]);xe&&(zt(xe.data||[]),me(xe.labels||[])),vt({signups:(xe==null?void 0:xe.data)||[],logins:(pe==null?void 0:pe.data)||[],organizations:(ie==null?void 0:ie.data)||[],teams:(be==null?void 0:be.data)||[],sessions:(Ce==null?void 0:Ce.data)||[]}),En((xe==null?void 0:xe.labels)||(pe==null?void 0:pe.labels)||(ie==null?void 0:ie.labels)||(be==null?void 0:be.labels)||(Ce==null?void 0:Ce.labels)||[])}finally{$t(!1)}}})()},[d,R,J,nt]),m.useEffect(()=>{(async()=>{const xe=await nt("activeUsers","1D");xe&&X(xe.percentageChange||0)})()},[nt]),m.useEffect(()=>{},[rs.organizations,rs.teams,Ar]),m.useEffect(()=>{(async()=>{const xe=ql[x]||"1D",pe=xe==="Custom";if(!(pe&&(!K||!ce))){Fe(!0);try{const ie=await nt("organizations",xe,pe?K:void 0,pe?ce:void 0);ie&&(Se(ie.total||0),W(ie.percentageChange||0))}catch{Se(0),W(0)}finally{Fe(!1)}}})()},[x,K,ce,nt]),m.useEffect(()=>{(async()=>{const xe=ql[j]||"1D",pe=xe==="Custom";if(!(pe&&(!ve||!Te))){he(!0);try{const ie=await nt("teams",xe,pe?ve:void 0,pe?Te:void 0);ie&&(Pe(ie.total||0),de(ie.percentageChange||0))}catch{Pe(0),de(0)}finally{he(!1)}}})()},[j,ve,Te,nt]),m.useEffect(()=>{(async()=>{const xe=await nt("users","1D");xe&&qt(xe.percentageChange||0);const pe=await nt("organizations","1D");pe&&La(pe.percentageChange||0);const ie=await nt("activeUsers","1D");ie&&Yl(ie.percentageChange||0);const[be,Ce,je,we,Ue]=await Promise.all([nt("newUsers","1D"),nt("activeUsers","1D"),nt("organizations","1D"),nt("teams","1D"),nt("sessions","1D")]),Ut=[(be==null?void 0:be.total)||0,(Ce==null?void 0:Ce.total)||0,(je==null?void 0:je.total)||0,(we==null?void 0:we.total)||0,(Ue==null?void 0:Ue.total)||0].reduce((Ks,ch)=>Ks+ch,0);th(Ut);const ao=[(be==null?void 0:be.previousTotal)||0,(Ce==null?void 0:Ce.previousTotal)||0,(je==null?void 0:je.previousTotal)||0,(we==null?void 0:we.previousTotal)||0,(Ue==null?void 0:Ue.previousTotal)||0].reduce((Ks,ch)=>Ks+ch,0);if(ao>0){const Ks=(Ut-ao)/ao*100;to(Ks)}else Ut>0?to(100):to(0)})()},[nt]),m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/version-check")).json();pe&&D({current:pe.current||"1.0.0",latest:pe.latest||"1.0.0",isOutdated:pe.isOutdated||!1})}catch{try{const be=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Ce="1.5.0";D({current:be,latest:Ce,isOutdated:be!==Ce})}catch{D({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const Gl=fe=>{switch(fe){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Kl=fe=>{switch(fe){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},oh=fe=>{f(fe),w(!0)},so=()=>{w(!1),setTimeout(()=>f(null),300)},Ql=(fe,xe="users")=>{const pe=xe==="users"?Oe:ae,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(pe&&pe.length>0&&pe.length===be)return fe==="1D"?pe.filter((je,we)=>we%4===0).map(je=>{const we=parseInt(je.replace("h",""),10);return we===0?"12am":we<12?`${we}am`:we===12?"12pm":`${we-12}pm`}):fe==="1W"?pe.map(je=>je.length>3?je.substring(0,3):je):fe==="1M"?pe.map(je=>{const we=je.split(" ");return we.length>=2?we[1]:je}):fe==="1Y"||fe==="3M"||fe==="6M"?pe.map(je=>je.length>3?je.substring(0,3):je):pe.map(je=>je.length>3?je.substring(0,3):je);const Ce=new Date;switch(fe){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(je,we)=>new Date(Ce.getTime()-(6-we)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(je,we)=>new Date(Ce.getTime()-(29-we)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(2-we),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(5-we),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(11-we),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(6-we),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},lh=(fe,xe="users")=>{const pe=xe==="users"?Oe:ae,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(pe&&pe.length>0&&pe.length===be)return fe==="1D"?pe.map(je=>{const we=parseInt(je.replace("h",""),10);return we===0?"12am":we<12?`${we}am`:we===12?"12pm":`${we-12}pm`}):fe==="1Y"||fe==="3M"||fe==="6M"?pe.map(je=>{const we=["January","February","March","April","May","June","July","August","September","October","November","December"],tn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(je);return tn!==-1?we[tn]:je}):pe;const Ce=new Date;switch(fe){case"1D":return Array.from({length:24},(je,we)=>{const Ue=new Date;return Ue.setHours(we,0,0,0),Ue.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(je,we)=>new Date(Ce.getTime()-(6-we)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(je,we)=>{const Ue=new Date(Ce.getTime()-(29-we)*24*60*60*1e3),tn=Ue.toLocaleDateString("en-US",{month:"short"}),Ut=Ue.getDate();return`${tn} ${Ut}`});case"3M":return Array.from({length:3},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(2-we),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(5-we),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(11-we),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(6-we),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},Wa=(fe,xe="users")=>{const pe=xe==="users"?ut:Ot,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(!pe||pe.length===0)return Array(be).fill(0);const Ce=[...pe];for(;Ce.length<be;)Ce.push(0);const je=Ce.slice(0,be),we=Math.max(...je,1);return je.map(Ue=>Ue/we*100)},Zl=()=>{const fe=Nt.length>0?Nt:Ql(d,"users"),xe=fe.map((ie,be)=>So.reduce((Ce,je)=>{var we;return Ce+(((we=Ve[je.id])==null?void 0:we[be])??0)},0)),pe=Math.max(...xe,1);return s.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[s.jsx("div",{className:"px-6 overflow-hidden",children:s.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-white/5 border border-white/10 rounded-none overflow-x-auto relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.users)}),s.jsxs("div",{className:`flex items-center gap-1 ${lr>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${lr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(lr).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ln,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.organizations)}),s.jsxs("div",{className:`flex items-center gap-1 ${Rt>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${Rt<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Rt).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(mw,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.sessions)}),s.jsxs("div",{className:`flex items-center gap-1 ${hn>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${hn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(hn).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(hw,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(eh??0)}),s.jsxs("div",{className:`flex items-center gap-1 ${eo>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${eo<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(eo).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(i??0)}),s.jsxs("div",{className:"flex items-center gap-1 text-green-500",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsx("span",{className:"text-sm font-medium",children:"18%"})]})]})]})]})}),s.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),s.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y"].map(ie=>s.jsx("button",{onClick:()=>c(ie),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===ie?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:ie},ie))})]}),s.jsxs("div",{className:"flex justify-between items-end mb-6",children:[s.jsx("p",{className:"text-4xl text-white font-light",children:Ar?"...":as(rs.users)}),s.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[s.jsx("svg",{className:`w-3 h-3 ${Je>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${Je>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Je).toFixed(1),"%"]})]})]}),s.jsxs("div",{className:"space-y-2 relative",children:[s.jsxs("div",{className:"h-32 relative",children:[s.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:s.jsx("defs",{children:s.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[s.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),s.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),s.jsx("div",{className:"h-32 flex items-end justify-between space-x-1 relative z-10",children:Wa(l,"users").map((ie,be)=>{const Ce=T===be;return s.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${ie}%`,background:"url(#usersBarGradient)"},onMouseEnter:je=>{const we=je.currentTarget.getBoundingClientRect(),Ue=we.left+we.width/2,tn=we.top,Ut=150,os=60,ao=Math.max(Ut/2,Math.min(window.innerWidth-Ut/2,Ue)),Ks=Math.max(os+10,Math.min(window.innerHeight-10,tn));C(be),z({x:ao,y:Ks})},onMouseLeave:()=>{C(null),z(null)},children:s.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05))",opacity:Ce?1:.8}})},be)})}),T!==null&&_&&s.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${_.x}px`,top:`${_.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[s.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:lh(l,"users")[T]}),s.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[ut[T]!==void 0?ut[T].toLocaleString():"0"," ",s.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]}),s.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ql(l,"users").map((ie,be)=>s.jsx("span",{className:"flex-1 text-center truncate",children:ie},be))})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),s.jsx("p",{className:"text-4xl text-white font-light mt-1",children:Qe?"...":is(rh)}),s.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),s.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","1M","3M","6M","1Y","ALL"].map(ie=>s.jsx("button",{onClick:()=>h(ie),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${d===ie?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:ie},ie))})]}),s.jsxs("div",{className:"space-y-2 relative",children:[s.jsx("div",{className:"h-40 flex items-end gap-1",children:fe.map((ie,be)=>{const Ce=xe[be]||0;return s.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:je=>sh(je,be),onMouseLeave:()=>{P(null),q(null)},children:So.map(je=>{var tn;const we=((tn=Ve[je.id])==null?void 0:tn[be])??0,Ue=Ce===0||pe===0?0:Math.max(we/pe*100,we>0?4:0);return s.jsx("div",{className:`w-full ${je.barClass}`,style:{height:`${Ue}%`}},`${je.id}-${be}`)})},`${ie}-${be}`)})}),Qe&&s.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),H!==null&&B&&s.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${B.x}px`,top:`${B.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[s.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:fe[H]||`Bucket ${H+1}`}),s.jsx("div",{className:"space-y-1",children:So.map(ie=>{var be;return s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[s.jsx("span",{className:`w-2 h-2 rounded-sm ${ie.dotClass}`}),ie.label]}),s.jsx("span",{className:"text-white font-medium",children:((be=Ve[ie.id])==null?void 0:be[H])??0})]},ie.id)})})]})}),s.jsx("div",{className:`flex justify-between ${d==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:fe.map((ie,be)=>s.jsx("span",{className:"flex-1 text-center truncate",children:ie},be))}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:So.map(ie=>s.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-2 h-2 rounded-sm ${ie.dotClass}`}),ie.label]}),s.jsx("span",{className:"text-white font-medium",children:Qe?"...":is(ro[ie.id]||0)})]},ie.id))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>M(!S),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:v})]}),S&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{b(ie),M(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),v==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),G?An(G,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:G,onSelect:se,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),re?An(re,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:re,onSelect:Z,initialFocus:!0,disabled:ie=>G?ie<G:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:is(r)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${ze>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${ze>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(ze).toFixed(1),"%"]})]})})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>I(!A),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:g})]}),A&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{y(ie),I(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),g==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),R?An(R,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:R,onSelect:ee,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),J?An(J,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:J,onSelect:F,initialFocus:!0,disabled:ie=>R?ie<R:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:is(Xl)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${Ua>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:Ua<0?{transform:"rotate(180deg)"}:{},children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${Ua>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Ua).toFixed(1),"%"]})]})})]})]})]}),s.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>$(!U),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:x})]}),U&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{N(ie),$(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),x==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),K?An(K,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:K,onSelect:ne,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),ce?An(ce,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:ce,onSelect:ge,initialFocus:!0,disabled:ie=>K?ie<K:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:_e?"...":is(Ne)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${le>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${le>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(le).toFixed(1),"%"]})]})})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>E(!L),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:j})]}),L&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{k(ie),E(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),j==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),ve?An(ve,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:ve,onSelect:Ae,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),Te?An(Te,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:Te,onSelect:tt,initialFocus:!0,disabled:ie=>ve?ie<ve:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:bt?"...":is(ue)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${te>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${te>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(te).toFixed(1),"%"]})]})})]})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pt-4 overflow-hidden relative rounded-none flex flex-col",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white/60"}),s.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),s.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),s.jsx("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:ih.map((ie,be)=>s.jsx("div",{onClick:()=>oh(ie),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${be*.1}s both`},children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:s.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:ie.title})}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${Gl(ie.severity)}`,children:ie.severity}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${Kl(ie.status)}`,children:ie.status})]})]}),s.jsx(PP,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},ie.id))})]})]})]})]})};return s.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[s.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?Zl():e==="users"?s.jsx(ok,{}):e==="organizations"?s.jsx(ik,{}):Zl()}),t&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(mw,{className:"w-6 h-6 text-white"}),s.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("button",{onClick:()=>{n(!1),ss("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Ze,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Ln,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(hw,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Hr,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),s.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(J2,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Q2,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),s.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[s.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),p&&u&&s.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:so,children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:fe=>fe.stopPropagation(),children:[s.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx(Mn,{className:"w-6 h-6 text-white"}),s.jsx("h3",{className:"text-xl text-white font-light",children:u.title})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${Gl(u.severity)}`,children:[u.severity," Severity"]}),s.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${Kl(u.status)}`,children:u.status}),u.cve&&s.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:u.cve})]})]}),s.jsx("button",{onClick:so,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:s.jsx(Kt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),s.jsx("p",{className:"text-white",children:new Date(u.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),u.description.includes("npm install")?s.jsxs("div",{children:[s.jsx("p",{className:"text-white leading-relaxed mb-3",children:u.description.split("Run:")[0]}),s.jsx("div",{className:"relative group",children:s.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("code",{children:[s.jsx("span",{className:"text-green-400",children:"$"})," ",s.jsx("span",{className:"text-cyan-400",children:"npm"})," ",s.jsx("span",{className:"text-yellow-400",children:"install"})," ",s.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),V.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:s.jsx(Ym,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):s.jsx("p",{className:"text-white leading-relaxed",children:u.description})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:u.affectedComponents.map((fe,xe)=>s.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${xe*.1}s both`},children:[s.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),s.jsx("span",{className:"text-sm text-white",children:fe})]},xe))})]}),s.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:s.jsxs("div",{className:"flex items-start gap-3",children:[u.status==="applied"&&s.jsxs(s.Fragment,{children:[s.jsx(Ix,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),u.status==="scheduled"&&s.jsxs(s.Fragment,{children:[s.jsx(Z2,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),u.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(JL,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),s.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:s.jsx(Y,{variant:"ghost",onClick:so,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),s.jsx("style",{children:`
|
|
420
|
+
`),te=new Blob([W],{type:"text/csv;charset=utf-8;"}),de=document.createElement("a"),Ne=URL.createObjectURL(te);de.setAttribute("href",Ne),de.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),de.style.visibility="hidden",document.body.appendChild(de),de.click(),document.body.removeChild(de),V.success(`Exported ${r.length} users to CSV`)},ut=X=>{d.some(W=>W.type===X)||(h(W=>[...W,{type:X}]),f(1))},Le=X=>{h(le=>le.filter(W=>W.type!==X)),f(1)},Oe=(X,le)=>{h(W=>W.map(te=>te.type===X?{...te,value:le}:te))},Ge=(X,le)=>{h(W=>W.map(te=>te.type===X?{...te,dateRange:le}:te))},Je=r.filter(X=>{const le=X.name.toLowerCase().includes(l.toLowerCase())||X.email.toLowerCase().includes(l.toLowerCase());if(d.length===0)return le;const W=d.every(te=>{var de,Ne,Se,ue,Pe;switch(te.type){case"emailVerified":return te.value===void 0?!0:X.emailVerified===(te.value==="true");case"banned":return te.value===void 0?!0:X.banned===(te.value==="true");case"active":return X.banned!==!0;case"createdAt":{if(!((de=te.dateRange)!=null&&de.from)&&!((Ne=te.dateRange)!=null&&Ne.to))return!0;const _e=new Date(X.createdAt);return!((Se=te.dateRange)!=null&&Se.from&&te.dateRange.from>_e||(ue=te.dateRange)!=null&&ue.to&&te.dateRange.to<_e)}case"role":return te.value?(Pe=X.role)==null?void 0:Pe.toLowerCase().includes(te.value.toLowerCase()):!0;default:return!0}});return le&&W}),ot=r.filter(X=>X.banned).length,Ot=Math.ceil(Je.length/p),zt=(u-1)*p,ae=zt+p,me=Je.slice(zt,ae),ze=X=>{f(X)};return i?s.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:s.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[s.jsx(Xr,{className:"w-6 h-6 text-white animate-spin"}),s.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",s.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:s.jsx(br,{value:t.users??0,className:"text-white font-mono text-sm",prefix:s.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:s.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),s.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),s.jsx("div",{className:"flex items-center space-x-4 mt-2",children:ot>0&&s.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[s.jsx(Cc,{className:"w-3 h-3"}),s.jsxs("span",{children:[ot," Banned"]})]})})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:tt,children:[s.jsx(UN,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),s.jsxs(Y,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>S(!0),children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed"]}),s.jsxs(Y,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>v(!0),children:[s.jsx(Pm,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(Ea,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),s.jsx(Ie,{placeholder:"Search users...",value:l,onChange:X=>c(X.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx("div",{className:"flex items-center space-x-2",children:s.jsxs(pa,{value:"",onValueChange:ut,children:[s.jsx(xa,{className:"w-[180px]",children:s.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[s.jsx(zs,{className:"w-4 h-4"}),s.jsx("span",{children:"Add Filter"})]})}),s.jsxs(ga,{children:[!d.some(X=>X.type==="emailVerified")&&s.jsx(sn,{value:"emailVerified",children:"Email Verified"}),!d.some(X=>X.type==="banned")&&s.jsx(sn,{value:"banned",children:"Banned Status"}),!d.some(X=>X.type==="createdAt")&&s.jsx(sn,{value:"createdAt",children:"Created Date"}),!d.some(X=>X.type==="role")&&s.jsx(sn,{value:"role",children:"Role"})]})]})}),d.length>0&&s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx(Y,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),d.length>0&&s.jsx("div",{className:"space-y-3",children:s.jsx("div",{className:"flex flex-wrap gap-3",children:d.map(X=>{var le,W,te,de;return s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[s.jsx(fx,{className:"w-3 h-3 text-white"}),X.type==="emailVerified"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),s.jsxs(pa,{value:X.value||"",onValueChange:Ne=>Oe("emailVerified",Ne),children:[s.jsx(xa,{className:"h-7 w-24 text-xs",children:s.jsx("span",{children:X.value==="true"?"True":X.value==="false"?"False":"Select"})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"true",children:"True"}),s.jsx(sn,{value:"false",children:"False"})]})]})]}),X.type==="banned"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Banned:"}),s.jsxs(pa,{value:X.value||"",onValueChange:Ne=>Oe("banned",Ne),children:[s.jsx(xa,{className:"h-7 w-24 text-xs",children:s.jsx("span",{children:X.value==="true"?"Yes":X.value==="false"?"No":"Select"})}),s.jsxs(ga,{children:[s.jsx(sn,{value:"true",children:"Yes"}),s.jsx(sn,{value:"false",children:"No"})]})]})]}),X.type==="createdAt"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Created:"}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(le=X.dateRange)!=null&&le.from?An(X.dateRange.from,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(W=X.dateRange)==null?void 0:W.from,onSelect:Ne=>{var Se;return Ge("createdAt",{from:Ne,to:(Se=X.dateRange)==null?void 0:Se.to})},initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Hd,{className:"mr-1 h-3 w-3"}),(te=X.dateRange)!=null&&te.to?An(X.dateRange.to,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:(de=X.dateRange)==null?void 0:de.to,onSelect:Ne=>{var Se;return Ge("createdAt",{from:(Se=X.dateRange)==null?void 0:Se.from,to:Ne})},initialFocus:!0,disabled:Ne=>{var Se;return(Se=X.dateRange)!=null&&Se.from?Ne<X.dateRange.from:!1},className:"rounded-none"})})]})]}),X.type==="role"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white",children:"Role:"}),s.jsx(Ie,{type:"text",value:X.value||"",onChange:Ne=>Oe("role",Ne.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),s.jsx("button",{onClick:()=>Le(X.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:s.jsx(Pt,{className:"w-3 h-3 text-white"})})]},X.type)})})})]}),s.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),s.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),s.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),s.jsx("tbody",{children:me.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:s.jsx(Ma,{className:"w-8 h-8 text-white/50"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||d.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&d.length===0&&s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs(Y,{onClick:()=>v(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[s.jsx(Pm,{className:"w-4 h-4 mr-2"}),"Create User"]}),s.jsxs(Y,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[s.jsx(mt,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):me.map(X=>s.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${X.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${X.id}`),children:[s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:X.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${X.id}`,alt:X.name,className:`w-10 h-10 rounded-none border border-dashed ${X.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),X.banned&&s.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:s.jsx(Cc,{className:"w-3 h-3 text-white"})})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"text-white font-light",children:X.name}),X.banned&&s.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide",children:"Banned"})]}),s.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:X.email})]})]})}),s.jsx("td",{className:"py-4 px-4",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[X.emailVerified?s.jsx(OP,{className:"w-4 h-4 text-green-400"}):s.jsx(Yd,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-sm text-gray-400",children:X.emailVerified?"Verified":"Not Verified"})]})}),s.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:s.jsxs("div",{className:"flex flex-col",children:[new Date(X.createdAt).toLocaleDateString(),s.jsx("p",{className:"text-xs",children:new Date(X.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),s.jsx("td",{className:"py-4 px-4 text-right",children:s.jsxs("div",{className:"relative flex items-center justify-end",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:le=>{le.stopPropagation(),T(D===X.id?null:X.id)},children:s.jsx(BP,{className:"w-4 h-4"})}),D===X.id&&s.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg z-50",onClick:le=>le.stopPropagation(),children:[s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),J(X)},children:[s.jsx(Il,{className:"w-4 h-4"}),s.jsx("span",{children:"View Details"})]}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),F(X)},children:[s.jsx(Ca,{className:"w-4 h-4"}),s.jsx("span",{children:"Edit User"})]}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),O(X),L(!0)},children:[s.jsx(Mn,{className:"w-4 h-4"}),s.jsx("span",{children:"Update Password"})]}),P&&(X.banned?s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),O(X),U(!0),T(null)},children:[s.jsx(Cc,{className:"w-4 h-4"}),s.jsx("span",{children:"Unban User"})]}):s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),O(X),A(!0),T(null)},children:[s.jsx(Cc,{className:"w-4 h-4"}),s.jsx("span",{children:"Ban User"})]})),s.jsx("div",{className:"border-t border-white/10 my-1"}),s.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:le=>{le.stopPropagation(),T(null),K(X)},children:[s.jsx(mx,{className:"w-4 h-4"}),s.jsx("span",{children:"Delete User"})]})]})]})})]},X.id))})]})}),s.jsx(ak,{currentPage:u,totalPages:Ot,onPageChange:ze,totalItems:Je.length,startIndex:zt,endIndex:ae})]}),k&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[s.jsx("span",{className:"text-white/50 mr-2",children:"["}),s.jsx(Ma,{className:"inline mr-2 w-3 h-3 text-white"}),s.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),s.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center space-x-2"}),s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(He,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),s.jsx(Ie,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsx(Y,{onClick:()=>{var le;const X=parseInt(((le=document.getElementById("user-count"))==null?void 0:le.value)||"5",10);ee(X)},disabled:se,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:se?s.jsxs(s.Fragment,{children:[s.jsx(Xr,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),q.length>0&&s.jsx("div",{className:"mt-6",children:s.jsx(Oa,{title:"User Seeding Terminal",lines:q,isRunning:se,className:"w-full",defaultCollapsed:!0})})]}),s.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),s.jsx("div",{className:"flex justify-end mt-6 pt-6",children:s.jsx(Y,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),w&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),s.jsx(Ie,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),s.jsx(Ie,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>v(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ne,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),b&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Edit User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),s.jsx(Ie,{id:"edit-name",defaultValue:E.name,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),s.jsx(Ie,{id:"edit-email",type:"email",defaultValue:E.email,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ce,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),y&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>x(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ge,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),N&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"User Details"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"ID:"}),s.jsx("span",{className:"text-white text-sm",children:E.id})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Email Verified:"}),s.jsx("span",{className:"text-white text-sm",children:E.emailVerified?"Yes":"No"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Created:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.createdAt).toLocaleString()})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Updated:"}),s.jsx("span",{className:"text-white text-sm",children:new Date(E.updatedAt).toLocaleString()})]})]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(Y,{onClick:()=>j(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})}),M&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[s.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),s.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",s.jsx("strong",{children:E.name})," from accessing the system."]}),s.jsxs("div",{className:"space-y-4 mb-6",children:[s.jsxs("div",{children:[s.jsx(He,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),s.jsx(Ie,{id:"banReason",value:C,onChange:X=>_(X.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),s.jsx(Ie,{id:"banExpires",type:"number",value:z||"",onChange:X=>H(X.target.value?Number(X.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>{A(!1),_(""),H(void 0),O(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:ve,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),I&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[s.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),s.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",s.jsx("strong",{children:E.name}),"? This will restore their access to the system."]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>{U(!1),O(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:Ae,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),$&&E&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{L(!1),O(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Pt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx("img",{src:E.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${E.id}`,alt:E.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white font-light",children:E.name}),s.jsx("div",{className:"text-sm text-gray-400",children:E.email})]})]}),s.jsxs("div",{children:[s.jsx(He,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),s.jsx(Ie,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),s.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[s.jsx(Y,{variant:"outline",onClick:()=>{L(!1),O(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),s.jsx(Y,{onClick:Te,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const So=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function yF(){const[e]=m.useState("overview"),[t,n]=m.useState(!1),[r,a]=m.useState(0),[i,o]=m.useState(0),[l,c]=m.useState("1D"),[d,h]=m.useState("1D"),[u,f]=m.useState(null),[p,w]=m.useState(!1),[v,b]=m.useState("Daily"),[g,y]=m.useState("Daily"),[x,N]=m.useState("Daily"),[j,k]=m.useState("Daily"),[S,M]=m.useState(!1),[A,I]=m.useState(!1),[U,$]=m.useState(!1),[L,E]=m.useState(!1),[O,D]=m.useState(null),[T,C]=m.useState(null),[_,z]=m.useState(null),[H,P]=m.useState(null),[B,q]=m.useState(null),[G,se]=m.useState(void 0),[re,Z]=m.useState(void 0),[R,ee]=m.useState(void 0),[J,F]=m.useState(void 0),[K,ne]=m.useState(void 0),[ce,ge]=m.useState(void 0),[ve,Ae]=m.useState(void 0),[Te,tt]=m.useState(void 0),[ut,Le]=m.useState([]),[Oe,Ge]=m.useState([]),[Je,ot]=m.useState(0),[Ot,zt]=m.useState([]),[ae,me]=m.useState([]),[ze,X]=m.useState(0),[le,W]=m.useState(0),[te,de]=m.useState(0),[Ne,Se]=m.useState(0),[ue,Pe]=m.useState(0),[_e,Fe]=m.useState(!1),[bt,he]=m.useState(!1),[Ve,vt]=m.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[Nt,En]=m.useState([]),[Qe,$t]=m.useState(!1),[lr,qt]=m.useState(0),[Rt,La]=m.useState(0),[hn,Yl]=m.useState(0),[eo,to]=m.useState(0),[eh,th]=m.useState(0),[qs,no]=m.useState([]),[Xl,Fa]=m.useState(0),[Ua,Ba]=m.useState(0),{counts:rs,loading:Ar}=Xu(),ss=Mr(),Gs=["Daily","Weekly","Monthly","Yearly","Custom"],ql={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},nh=m.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),as=fe=>fe==null?"...":nh.format(Number(fe)),is=fe=>fe==null?"...":Number(fe).toLocaleString(),ro=m.useMemo(()=>So.reduce((fe,xe)=>(fe[xe.id]=(Ve[xe.id]||[]).reduce((pe,ie)=>pe+ie,0),fe),{}),[Ve]),rh=m.useMemo(()=>Object.values(ro).reduce((fe,xe)=>fe+xe,0),[ro]),sh=(fe,xe)=>{const pe=fe.currentTarget.getBoundingClientRect();P(xe),q({x:pe.left+pe.width/2,y:pe.top})},ih=(()=>{const fe=[];return O!=null&&O.isOutdated?fe.push({id:"version-check",title:`Update Better-Auth to v${O.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `npm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):O&&fe.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),fe.push(),fe})(),nt=m.useCallback(async(fe,xe,pe,ie)=>{try{const be=new URLSearchParams({type:fe,period:xe});return pe&&be.append("from",pe.toISOString()),ie&&be.append("to",ie.toISOString()),await(await fetch(`/api/analytics?${be.toString()}`)).json()}catch{return null}},[]);m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/users/all")).json();pe!=null&&pe.success&&pe.users&&no(pe.users)}catch{no([])}})()},[]),m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/stats")).json();pe&&(a(pe.activeUsers||0),o(pe.totalUsers||0))}catch{a(0),o(0)}})()},[]),m.useEffect(()=>{(async()=>{const xe=await nt("users",l,G,re);xe&&(Le(xe.data||[]),Ge(xe.labels||[]),ot(xe.percentageChange||0))})()},[l,G,re,nt]),m.useEffect(()=>{if(qs.length===0){Fa(0),Ba(0);return}const fe=new Date;let xe,pe=fe,ie,be;if(g==="Custom"){if(!R||!J){Fa(0),Ba(0);return}xe=new Date(R),pe=new Date(J),pe.setHours(23,59,59,999);const Ut=pe.getTime()-xe.getTime();be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-Ut)}else switch(g){case"Daily":xe=new Date(fe),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-24*60*60*1e3);break;case"Weekly":xe=new Date(fe),xe.setDate(fe.getDate()-fe.getDay()),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(be.getTime()-7*24*60*60*1e3);break;case"Monthly":xe=new Date(fe.getFullYear(),fe.getMonth(),1),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(fe.getFullYear(),fe.getMonth()-1,1),ie.setHours(0,0,0,0);break;case"Yearly":xe=new Date(fe.getFullYear(),0,1),xe.setHours(0,0,0,0),be=new Date(xe.getTime()-1),ie=new Date(fe.getFullYear()-1,0,1),ie.setHours(0,0,0,0);break;default:Fa(0),Ba(0);return}const Ce=qs.filter(Ut=>{if(!Ut.createdAt)return!1;const os=new Date(Ut.createdAt);return os>=xe&&os<=pe}),je=qs.filter(Ut=>{if(!Ut.createdAt)return!1;const os=new Date(Ut.createdAt);return os>=ie&&os<=be}),we=Ce.length,Ue=je.length;let tn=0;Ue>0?tn=(we-Ue)/Ue*100:we>0&&(tn=100),Fa(we),Ba(tn)},[qs,g,R,J]),m.useEffect(()=>{(async()=>{if(!(d==="Custom"&&(!R||!J))){$t(!0);try{const[xe,pe,ie,be,Ce]=await Promise.all([nt("newUsers",d,R,J),nt("activeUsers",d,R,J),nt("organizations",d,R,J),nt("teams",d,R,J),nt("sessions",d,R,J)]);xe&&(zt(xe.data||[]),me(xe.labels||[])),vt({signups:(xe==null?void 0:xe.data)||[],logins:(pe==null?void 0:pe.data)||[],organizations:(ie==null?void 0:ie.data)||[],teams:(be==null?void 0:be.data)||[],sessions:(Ce==null?void 0:Ce.data)||[]}),En((xe==null?void 0:xe.labels)||(pe==null?void 0:pe.labels)||(ie==null?void 0:ie.labels)||(be==null?void 0:be.labels)||(Ce==null?void 0:Ce.labels)||[])}finally{$t(!1)}}})()},[d,R,J,nt]),m.useEffect(()=>{(async()=>{const xe=await nt("activeUsers","1D");xe&&X(xe.percentageChange||0)})()},[nt]),m.useEffect(()=>{},[rs.organizations,rs.teams,Ar]),m.useEffect(()=>{(async()=>{const xe=ql[x]||"1D",pe=xe==="Custom";if(!(pe&&(!K||!ce))){Fe(!0);try{const ie=await nt("organizations",xe,pe?K:void 0,pe?ce:void 0);ie&&(Se(ie.total||0),W(ie.percentageChange||0))}catch{Se(0),W(0)}finally{Fe(!1)}}})()},[x,K,ce,nt]),m.useEffect(()=>{(async()=>{const xe=ql[j]||"1D",pe=xe==="Custom";if(!(pe&&(!ve||!Te))){he(!0);try{const ie=await nt("teams",xe,pe?ve:void 0,pe?Te:void 0);ie&&(Pe(ie.total||0),de(ie.percentageChange||0))}catch{Pe(0),de(0)}finally{he(!1)}}})()},[j,ve,Te,nt]),m.useEffect(()=>{(async()=>{const xe=await nt("users","1D");xe&&qt(xe.percentageChange||0);const pe=await nt("organizations","1D");pe&&La(pe.percentageChange||0);const ie=await nt("activeUsers","1D");ie&&Yl(ie.percentageChange||0);const[be,Ce,je,we,Ue]=await Promise.all([nt("newUsers","1D"),nt("activeUsers","1D"),nt("organizations","1D"),nt("teams","1D"),nt("sessions","1D")]),Ut=[(be==null?void 0:be.total)||0,(Ce==null?void 0:Ce.total)||0,(je==null?void 0:je.total)||0,(we==null?void 0:we.total)||0,(Ue==null?void 0:Ue.total)||0].reduce((Ks,ch)=>Ks+ch,0);th(Ut);const ao=[(be==null?void 0:be.previousTotal)||0,(Ce==null?void 0:Ce.previousTotal)||0,(je==null?void 0:je.previousTotal)||0,(we==null?void 0:we.previousTotal)||0,(Ue==null?void 0:Ue.previousTotal)||0].reduce((Ks,ch)=>Ks+ch,0);if(ao>0){const Ks=(Ut-ao)/ao*100;to(Ks)}else Ut>0?to(100):to(0)})()},[nt]),m.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/version-check")).json();pe&&D({current:pe.current||"1.0.0",latest:pe.latest||"1.0.0",isOutdated:pe.isOutdated||!1})}catch{try{const be=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Ce="1.5.0";D({current:be,latest:Ce,isOutdated:be!==Ce})}catch{D({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const Gl=fe=>{switch(fe){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Kl=fe=>{switch(fe){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},oh=fe=>{f(fe),w(!0)},so=()=>{w(!1),setTimeout(()=>f(null),300)},Ql=(fe,xe="users")=>{const pe=xe==="users"?Oe:ae,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(pe&&pe.length>0&&pe.length===be)return fe==="1D"?pe.filter((je,we)=>we%4===0).map(je=>{const we=parseInt(je.replace("h",""),10);return we===0?"12am":we<12?`${we}am`:we===12?"12pm":`${we-12}pm`}):fe==="1W"?pe.map(je=>je.length>3?je.substring(0,3):je):fe==="1M"?pe.map(je=>{const we=je.split(" ");return we.length>=2?we[1]:je}):fe==="1Y"||fe==="3M"||fe==="6M"?pe.map(je=>je.length>3?je.substring(0,3):je):pe.map(je=>je.length>3?je.substring(0,3):je);const Ce=new Date;switch(fe){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(je,we)=>new Date(Ce.getTime()-(6-we)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(je,we)=>new Date(Ce.getTime()-(29-we)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(2-we),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(5-we),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(11-we),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(6-we),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},lh=(fe,xe="users")=>{const pe=xe==="users"?Oe:ae,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(pe&&pe.length>0&&pe.length===be)return fe==="1D"?pe.map(je=>{const we=parseInt(je.replace("h",""),10);return we===0?"12am":we<12?`${we}am`:we===12?"12pm":`${we-12}pm`}):fe==="1Y"||fe==="3M"||fe==="6M"?pe.map(je=>{const we=["January","February","March","April","May","June","July","August","September","October","November","December"],tn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(je);return tn!==-1?we[tn]:je}):pe;const Ce=new Date;switch(fe){case"1D":return Array.from({length:24},(je,we)=>{const Ue=new Date;return Ue.setHours(we,0,0,0),Ue.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(je,we)=>new Date(Ce.getTime()-(6-we)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(je,we)=>{const Ue=new Date(Ce.getTime()-(29-we)*24*60*60*1e3),tn=Ue.toLocaleDateString("en-US",{month:"short"}),Ut=Ue.getDate();return`${tn} ${Ut}`});case"3M":return Array.from({length:3},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(2-we),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(5-we),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(11-we),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(je,we)=>new Date(Ce.getFullYear(),Ce.getMonth()-(6-we),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},Wa=(fe,xe="users")=>{const pe=xe==="users"?ut:Ot,be={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[fe]||7;if(!pe||pe.length===0)return Array(be).fill(0);const Ce=[...pe];for(;Ce.length<be;)Ce.push(0);const je=Ce.slice(0,be),we=Math.max(...je,1);return je.map(Ue=>Ue/we*100)},Zl=()=>{const fe=Nt.length>0?Nt:Ql(d,"users"),xe=fe.map((ie,be)=>So.reduce((Ce,je)=>{var we;return Ce+(((we=Ve[je.id])==null?void 0:we[be])??0)},0)),pe=Math.max(...xe,1);return s.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[s.jsx("div",{className:"px-6 overflow-hidden",children:s.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-white/5 border border-white/10 rounded-none overflow-x-auto relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.users)}),s.jsxs("div",{className:`flex items-center gap-1 ${lr>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${lr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(lr).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ln,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.organizations)}),s.jsxs("div",{className:`flex items-center gap-1 ${Rt>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${Rt<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(Rt).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(mw,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(rs.sessions)}),s.jsxs("div",{className:`flex items-center gap-1 ${hn>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${hn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(hn).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(hw,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(eh??0)}),s.jsxs("div",{className:`flex items-center gap-1 ${eo>=0?"text-green-500":"text-red-500"}`,children:[s.jsx("svg",{className:`w-3 h-3 ${eo<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(eo).toFixed(1),"%"]})]})]})]}),s.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[s.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Ze,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),s.jsx("span",{className:"text-white text-lg font-medium",children:Ar?"...":as(i??0)}),s.jsxs("div",{className:"flex items-center gap-1 text-green-500",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsx("span",{className:"text-sm font-medium",children:"18%"})]})]})]})]})}),s.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),s.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y"].map(ie=>s.jsx("button",{onClick:()=>c(ie),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===ie?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:ie},ie))})]}),s.jsxs("div",{className:"flex justify-between items-end mb-6",children:[s.jsx("p",{className:"text-4xl text-white font-light",children:Ar?"...":as(rs.users)}),s.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[s.jsx("svg",{className:`w-3 h-3 ${Je>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${Je>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Je).toFixed(1),"%"]})]})]}),s.jsxs("div",{className:"space-y-2 relative",children:[s.jsxs("div",{className:"h-32 relative",children:[s.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:s.jsx("defs",{children:s.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[s.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),s.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),s.jsx("div",{className:"h-32 flex items-end justify-between space-x-1 relative z-10",children:Wa(l,"users").map((ie,be)=>{const Ce=T===be;return s.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${ie}%`,background:"url(#usersBarGradient)"},onMouseEnter:je=>{const we=je.currentTarget.getBoundingClientRect(),Ue=we.left+we.width/2,tn=we.top,Ut=150,os=60,ao=Math.max(Ut/2,Math.min(window.innerWidth-Ut/2,Ue)),Ks=Math.max(os+10,Math.min(window.innerHeight-10,tn));C(be),z({x:ao,y:Ks})},onMouseLeave:()=>{C(null),z(null)},children:s.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05))",opacity:Ce?1:.8}})},be)})}),T!==null&&_&&s.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${_.x}px`,top:`${_.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[s.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:lh(l,"users")[T]}),s.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[ut[T]!==void 0?ut[T].toLocaleString():"0"," ",s.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]}),s.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ql(l,"users").map((ie,be)=>s.jsx("span",{className:"flex-1 text-center truncate",children:ie},be))})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),s.jsx("p",{className:"text-4xl text-white font-light mt-1",children:Qe?"...":is(rh)}),s.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),s.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","1M","3M","6M","1Y","ALL"].map(ie=>s.jsx("button",{onClick:()=>h(ie),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${d===ie?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:ie},ie))})]}),s.jsxs("div",{className:"space-y-2 relative",children:[s.jsx("div",{className:"h-40 flex items-end gap-1",children:fe.map((ie,be)=>{const Ce=xe[be]||0;return s.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:je=>sh(je,be),onMouseLeave:()=>{P(null),q(null)},children:So.map(je=>{var tn;const we=((tn=Ve[je.id])==null?void 0:tn[be])??0,Ue=Ce===0||pe===0?0:Math.max(we/pe*100,we>0?4:0);return s.jsx("div",{className:`w-full ${je.barClass}`,style:{height:`${Ue}%`}},`${je.id}-${be}`)})},`${ie}-${be}`)})}),Qe&&s.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),H!==null&&B&&s.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${B.x}px`,top:`${B.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[s.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:fe[H]||`Bucket ${H+1}`}),s.jsx("div",{className:"space-y-1",children:So.map(ie=>{var be;return s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[s.jsx("span",{className:`w-2 h-2 rounded-sm ${ie.dotClass}`}),ie.label]}),s.jsx("span",{className:"text-white font-medium",children:((be=Ve[ie.id])==null?void 0:be[H])??0})]},ie.id)})})]})}),s.jsx("div",{className:`flex justify-between ${d==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:fe.map((ie,be)=>s.jsx("span",{className:"flex-1 text-center truncate",children:ie},be))}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:So.map(ie=>s.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-2 h-2 rounded-sm ${ie.dotClass}`}),ie.label]}),s.jsx("span",{className:"text-white font-medium",children:Qe?"...":is(ro[ie.id]||0)})]},ie.id))})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>M(!S),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:v})]}),S&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{b(ie),M(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),v==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),G?An(G,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:G,onSelect:se,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),re?An(re,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:re,onSelect:Z,initialFocus:!0,disabled:ie=>G?ie<G:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:is(r)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${ze>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${ze>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(ze).toFixed(1),"%"]})]})})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>I(!A),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:g})]}),A&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{y(ie),I(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),g==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),R?An(R,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:R,onSelect:ee,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),J?An(J,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:J,onSelect:F,initialFocus:!0,disabled:ie=>R?ie<R:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:is(Xl)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${Ua>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:Ua<0?{transform:"rotate(180deg)"}:{},children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${Ua>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Ua).toFixed(1),"%"]})]})})]})]})]}),s.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>$(!U),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:x})]}),U&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{N(ie),$(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),x==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),K?An(K,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:K,onSelect:ne,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),ce?An(ce,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:ce,onSelect:ge,initialFocus:!0,disabled:ie=>K?ie<K:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:_e?"...":is(Ne)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${le>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${le>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(le).toFixed(1),"%"]})]})})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pb-2 relative",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>E(!L),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[s.jsx(zc,{className:"w-3 h-3"}),s.jsx("span",{children:j})]}),L&&s.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Gs.map(ie=>s.jsx("button",{onClick:()=>{k(ie),E(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:ie},ie))})]}),j==="Custom"&&s.jsxs("div",{className:"h-0 flex items-center gap-2",children:[s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),ve?An(ve,"MMM dd yyyy"):"From"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:ve,onSelect:Ae,initialFocus:!0,className:"rounded-none"})})]}),s.jsxs(zn,{children:[s.jsx($n,{asChild:!0,children:s.jsxs(Y,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[s.jsx(Yn,{className:"mr-1 h-3 w-3"}),Te?An(Te,"MMM dd yyyy"):"To"]})}),s.jsx(pn,{className:"w-auto p-0 bg-black border-white/10",children:s.jsx(On,{mode:"single",selected:Te,onSelect:tt,initialFocus:!0,disabled:ie=>ve?ie<ve:!1,className:"rounded-none"})})]})]})]}),s.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),s.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),s.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),s.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[s.jsx("p",{className:"text-3xl text-white font-light",children:bt?"...":is(ue)}),s.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:s.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[s.jsx("svg",{className:`w-3 h-3 ${te>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:s.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),s.jsxs("span",{className:`text-xs font-medium ${te>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(te).toFixed(1),"%"]})]})})]})]})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 p-6 pt-4 overflow-hidden relative rounded-none flex flex-col",children:[s.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/30"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/30"}),s.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-white/60"}),s.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),s.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),s.jsx("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:ih.map((ie,be)=>s.jsx("div",{onClick:()=>oh(ie),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${be*.1}s both`},children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:s.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:ie.title})}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${Gl(ie.severity)}`,children:ie.severity}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${Kl(ie.status)}`,children:ie.status})]})]}),s.jsx(PP,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},ie.id))})]})]})]})]})};return s.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[s.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?Zl():e==="users"?s.jsx(ok,{}):e==="organizations"?s.jsx(ik,{}):Zl()}),t&&s.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center space-x-3",children:[s.jsx(mw,{className:"w-6 h-6 text-white"}),s.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:s.jsx(Kt,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("button",{onClick:()=>{n(!1),ss("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Ze,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Ln,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(hw,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Hr,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),s.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(J2,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),s.jsxs("button",{onClick:()=>{n(!1),ss("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[s.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:s.jsx(Q2,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),s.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),s.jsx(ws,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),s.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:s.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[s.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),p&&u&&s.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:so,children:s.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:fe=>fe.stopPropagation(),children:[s.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx(Mn,{className:"w-6 h-6 text-white"}),s.jsx("h3",{className:"text-xl text-white font-light",children:u.title})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${Gl(u.severity)}`,children:[u.severity," Severity"]}),s.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${Kl(u.status)}`,children:u.status}),u.cve&&s.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:u.cve})]})]}),s.jsx("button",{onClick:so,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:s.jsx(Kt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),s.jsx("p",{className:"text-white",children:new Date(u.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),u.description.includes("npm install")?s.jsxs("div",{children:[s.jsx("p",{className:"text-white leading-relaxed mb-3",children:u.description.split("Run:")[0]}),s.jsx("div",{className:"relative group",children:s.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("code",{children:[s.jsx("span",{className:"text-green-400",children:"$"})," ",s.jsx("span",{className:"text-cyan-400",children:"npm"})," ",s.jsx("span",{className:"text-yellow-400",children:"install"})," ",s.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),V.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:s.jsx(Ym,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):s.jsx("p",{className:"text-white leading-relaxed",children:u.description})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:u.affectedComponents.map((fe,xe)=>s.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${xe*.1}s both`},children:[s.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),s.jsx("span",{className:"text-sm text-white",children:fe})]},xe))})]}),s.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:s.jsxs("div",{className:"flex items-start gap-3",children:[u.status==="applied"&&s.jsxs(s.Fragment,{children:[s.jsx(Ix,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),u.status==="scheduled"&&s.jsxs(s.Fragment,{children:[s.jsx(Z2,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),u.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(JL,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),s.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),s.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:s.jsx(Y,{variant:"ghost",onClick:so,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),s.jsx("style",{children:`
|
|
421
421
|
@keyframes fadeIn {
|
|
422
422
|
from {
|
|
423
423
|
opacity: 0;
|
package/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Better Auth Studio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-InMDrGb8.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/main-9a00gxLg.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|