1import{r as e,j as t}from"./react-vendor-BR2bEzcq.js";import{A as s}from"./AdminLayout-CGe_m4jz.js";import{S as a}from"./StandardDropdown-BTdJSuUI.js";import{z as l,a as r}from"./axios-DY9rj2-D.js";import{m as n,al as i,I as d,bd as c,be as o,at as m,J as x,ad as u,aj as h,af as p}from"./index-We6CJOzg.js";import{F as b}from"./UserGroupIcon-Dh6gZ7jK.js";import{F as g}from"./InformationCircleIcon-eSHHHva-.js";import{F as j}from"./CheckIcon-911ghGV7.js";import{F as f}from"./TrashIcon-DpBbAWEC.js";import{F as v}from"./UsersIcon-Cq0n9pYE.js";import{F as N}from"./ChartBarIcon-DE9LOE0Q.js";import{F as y}from"./CircleStackIcon-BhtkXEpt.js";import{F as w}from"./PlusIcon-Ca5ILnR9.js";import{F as k}from"./CheckCircleIcon-Cby2gbWo.js";import{F as _}from"./XCircleIcon-DMtANYs8.js";import{F as C}from"./EyeIcon-D3kwsJLA.js";import{F as S}from"./PencilIcon-D8Kevv51.js";function D({title:t,titleId:s,...a},l){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":s},a),t?e.createElement("title",{id:s},t):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"}))}const L=e.forwardRef(D),E=({guild:s,onSave:r,onCancel:c})=>{const[o,m]=e.useState({guild_name:"",server:"",region:"US",faction:"Alliance",is_active:!0,description:"",max_members:1e3,timezone:"UTC",language:"en",raid_schedule:"",loot_system:"DKP",public_logs:!1,recruitment_open:!1,website:"",discord_invite:"",contact_email:""}),[x,u]=e.useState({}),[h,p]=e.useState(!1);e.useEffect(()=>{s&&m({guild_name:s.guild_name||"",server:s.server||"",region:s.region||"US",faction:s.faction||"Alliance",is_active:!1!==s.is_active,description:s.description||"",max_members:s.max_members||1e3,timezone:s.timezone||"UTC",language:s.language||"en",raid_schedule:s.raid_schedule||"",loot_system:s.loot_system||"DKP",public_logs:s.public_logs||!1,recruitment_open:s.recruitment_open||!1,website:s.website||"",discord_invite:s.discord_invite||"",contact_email:s.contact_email||""})},[s]);const f=e=>{try{return new URL(e),!0}catch(t){return!1}},v=(e,t)=>{m(s=>({...s,[e]:t})),x[e]&&u(t=>({...t,[e]:void 0}))};return t.jsx("div",{className:"min-h-screen bg-neutral-950",children:t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"p-6",children:[t.jsx("div",{className:"mb-8",children:t.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-neutral-100 mb-2",children:s?"Edit Guild":"Create New Guild"}),t.jsx("p",{className:"text-neutral-400",children:s?"Modify guild settings and configuration":"Add a new guild tenant to the system"})]}),t.jsxs("button",{onClick:c,className:"inline-flex items-center px-4 py-2 border border-neutral-700 rounded-md shadow-xs text-sm font-medium text-neutral-200 bg-neutral-900 hover:bg-neutral-800",children:[t.jsx(i,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})})}),t.jsxs(n.form,{onSubmit:async e=>{if(e.preventDefault(),(()=>{const e={};return o.guild_name.trim()?(o.guild_name.length<2||o.guild_name.length>100)&&(e.guild_name="Guild name must be between 2 and 100 characters"):e.guild_name="Guild name is required",o.server.trim()?(o.server.length<2||o.server.length>100)&&(e.server="Server name must be between 2 and 100 characters"):e.server="Server name is required",o.region||(e.region="Region is required"),o.faction||(e.faction="Faction is required"),(o.max_members<1||o.max_members>1e4)&&(e.max_members="Max members must be between 1 and 10,000"),o.website&&!f(o.website)&&(e.website="Please enter a valid URL"),o.discord_invite&&!f(o.discord_invite)&&(e.discord_invite="Please enter a valid Discord invite URL"),o.contact_email&&(t=o.contact_email,!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))&&(e.contact_email="Please enter a valid email address"),u(e),0===Object.keys(e).length;var t})()){p(!0);try{await r(o)}catch(t){console.error("Error saving guild:",t),l.error("Failed to save guild")}finally{p(!1)}}else l.error("Please fix the validation errors")},initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},className:"space-y-8",children:[t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center mb-6",children:[t.jsx(b,{className:"h-6 w-6 text-sky-400 mr-3"}),t.jsx("h2",{className:"text-xl font-semibold text-neutral-100",children:"Basic Information"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Guild Name *"}),t.jsx("input",{type:"text",value:o.guild_name,onChange:e=>v("guild_name",e.target.value),className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.guild_name?"border-red-500":"border-neutral-700"),placeholder:"Enter guild name"}),x.guild_name&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.guild_name})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Server *"}),t.jsx("input",{type:"text",value:o.server,onChange:e=>v("server",e.target.value),className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.server?"border-red-500":"border-neutral-700"),placeholder:"Enter server name"}),x.server&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.server})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Region *"}),t.jsx(a,{value:o.region,onChange:e=>v("region",e),options:[{value:"US",label:"United States"},{value:"EU",label:"Europe"},{value:"KR",label:"Korea"},{value:"CN",label:"China"}],error:!!x.region,className:"w-full"}),x.region&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.region})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Faction *"}),t.jsx(a,{value:o.faction,onChange:e=>v("faction",e),options:[{value:"Alliance",label:"Alliance"},{value:"Horde",label:"Horde"}],error:!!x.faction,className:"w-full"}),x.faction&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.faction})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Timezone"}),t.jsx(a,{value:o.timezone,onChange:e=>v("timezone",e),options:["UTC","EST","CST","MST","PST","GMT","CET","JST","KST","AEST"].map(e=>({value:e,label:e})),className:"w-full"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Language"}),t.jsx(a,{value:o.language,onChange:e=>v("language",e),options:[{value:"en",label:"English"},{value:"es",label:"Spanish"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"ru",label:"Russian"},{value:"zh",label:"Chinese"},{value:"ja",label:"Japanese"},{value:"ko",label:"Korean"}],className:"w-full"})]})]}),t.jsxs("div",{className:"mt-6",children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Description"}),t.jsx("textarea",{value:o.description,onChange:e=>v("description",e.target.value),rows:3,className:"w-full px-3 py-2 border border-neutral-700 rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500",placeholder:"Brief description of the guild..."})]})]}),t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center mb-6",children:[t.jsx(d,{className:"h-6 w-6 text-emerald-400 mr-3"}),t.jsx("h2",{className:"text-xl font-semibold text-neutral-100",children:"Guild Configuration"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Max Members"}),t.jsx("input",{type:"number",value:o.max_members,onChange:e=>v("max_members",parseInt(e.target.value)||0),min:"1",max:"10000",className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.max_members?"border-red-500":"border-neutral-700")}),x.max_members&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.max_members})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Loot System"}),t.jsx(a,{value:o.loot_system,onChange:e=>v("loot_system",e),options:[{value:"DKP",label:"Dragon Kill Points (DKP)"},{value:"EPGP",label:"Effort Points / Gear Points (EPGP)"},{value:"Loot_Council",label:"Loot Council"},{value:"Free_Roll",label:"Free Roll"},{value:"Need_Before_Greed",label:"Need Before Greed"},{value:"Other",label:"Other"}],className:"w-full"})]}),t.jsxs("div",{className:"md:col-span-2",children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Raid Schedule"}),t.jsx("input",{type:"text",value:o.raid_schedule,onChange:e=>v("raid_schedule",e.target.value),className:"w-full px-3 py-2 border border-neutral-700 rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500",placeholder:"e.g., Tue/Thu/Sun 8-11 EST"})]})]}),t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",id:"is_active",checked:o.is_active,onChange:e=>v("is_active",e.target.checked),className:"h-4 w-4 text-sky-400 focus:ring-sky-500 border-neutral-700 rounded-sm"}),t.jsx("label",{htmlFor:"is_active",className:"ml-3 text-sm font-medium text-neutral-200",children:"Guild is active"})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",id:"public_logs",checked:o.public_logs,onChange:e=>v("public_logs",e.target.checked),className:"h-4 w-4 text-sky-400 focus:ring-sky-500 border-neutral-700 rounded-sm"}),t.jsx("label",{htmlFor:"public_logs",className:"ml-3 text-sm font-medium text-neutral-200",children:"Public combat logs"})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",id:"recruitment_open",checked:o.recruitment_open,onChange:e=>v("recruitment_open",e.target.checked),className:"h-4 w-4 text-sky-400 focus:ring-sky-500 border-neutral-700 rounded-sm"}),t.jsx("label",{htmlFor:"recruitment_open",className:"ml-3 text-sm font-medium text-neutral-200",children:"Recruitment is open"})]})]})]}),t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center mb-6",children:[t.jsx(g,{className:"h-6 w-6 text-violet-400 mr-3"}),t.jsx("h2",{className:"text-xl font-semibold text-neutral-100",children:"Contact Information"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Website"}),t.jsx("input",{type:"url",value:o.website,onChange:e=>v("website",e.target.value),className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.website?"border-red-500":"border-neutral-700"),placeholder:"https://example.com"}),x.website&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.website})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Discord Invite"}),t.jsx("input",{type:"url",value:o.discord_invite,onChange:e=>v("discord_invite",e.target.value),className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.discord_invite?"border-red-500":"border-neutral-700"),placeholder:"https://discord.gg/..."}),x.discord_invite&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.discord_invite})]}),t.jsxs("div",{className:"md:col-span-2",children:[t.jsx("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:"Contact Email"}),t.jsx("input",{type:"email",value:o.contact_email,onChange:e=>v("contact_email",e.target.value),className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 "+(x.contact_email?"border-red-500":"border-neutral-700"),placeholder:"[email protected]"}),x.contact_email&&t.jsx("p",{className:"mt-1 text-sm text-red-400",children:x.contact_email})]})]})]}),t.jsxs("div",{className:"flex items-center justify-end space-x-4 py-6",children:[t.jsx("button",{type:"button",onClick:c,className:"px-6 py-2 border border-neutral-700 rounded-md shadow-xs text-sm font-medium text-neutral-200 bg-neutral-900 hover:bg-neutral-800 focus:outline-hidden focu
1s:ring-2 focus:ring-offset-2 focus:ring-sky-500",children:"Cancel"}),t.jsx("button",{type:"submit",disabled:h,className:"inline-flex items-center px-6 py-2 border border-transparent rounded-md shadow-xs text-sm font-medium text-white "+(h?"bg-neutral-600 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"),children:h?t.jsxs(t.Fragment,{children:[t.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Saving..."]}):t.jsxs(t.Fragment,{children:[t.jsx(j,{className:"h-4 w-4 mr-2"}),s?"Update Guild":"Create Guild"]})})]})]})]})})})},F=({guild:s,onClose:a,onRefresh:d})=>{const[h,p]=e.useState(!0),[b,j]=e.useState(null),[w,k]=e.useState("overview"),[_,C]=e.useState(!1),[S,D]=e.useState(""),[E,F]=e.useState(!1),I=[{id:"overview",name:"Overview",icon:g},{id:"characters",name:"Characters",icon:v},{id:"loot",name:"Loot Entries",icon:o},{id:"logs",name:"Combat Logs",icon:L}
1,{id:"discord",name:"Discord Data",icon:m},{id:"analytics",name:"Analytics",icon:N},{id:"raw",name:"Raw Data",icon:y}];e.useEffect(()=>{A()},[s.id]);const A=async()=>{try{p(!0);const e=await r.get(`/api/admin/guilds/${s.id}/data`);j(e.data)}catch(e){console.error("Error loading guild data:",e),l.error("Failed to load guild data")}finally{p(!1)}},G=async(e="all")=>{try{F(!0);const t=await r.get(`/api/admin/guilds/${s.id}/export`,{params:{type:e},responseType:"blob"}),a=window.URL.createObjectURL(new Blob([t.data])),n=document.createElement("a");n.href=a,n.setAttribute("download",`${s.guild_name}-${e}-${(new Date).toISOString().split("T")[0]}.zip`),document.body.appendChild(n),n.click(),n.remove(),l.success(`${e} data exported successfully`)}catch(t){console.error("Error exporting data:",t),l.error("Failed to export data")}finally{F(!1)}},T=(e,s,a,l)=>t.jsxs("div",{className:"bg-neutral-900/50 rounded-lg p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(Icon,{className:"h-5 w-5 text-neutral-400 mr-2"}),t.jsx("h4",{className:"text-sm font-medium text-neutral-100",children:e})]}),t.jsx("button",{onClick:()=>G(e.toLowerCase().replace(/\s+/g,"_")),className:"text-sky-400 hover:text-sky-200 text-sm",children:"Export"})]}),t.jsx("p",{className:"text-xs text-neutral-500 mb-2",children:l}),t.jsx("div",{className:"text-2xl font-bold text-neutral-100",children:s?.toLocaleString()||"0"})]});return t.jsxs("div",{className:"min-h-screen bg-neutral-950",children:[t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"p-6",children:[t.jsx("div",{className:"mb-8",children:t.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsxs("h1",{className:"text-3xl font-bold text-neutral-100 mb-2",children:[s.guild_name," Data Management"]}),t.jsx("p",{className:"text-neutral-400",children:"View, export, and manage all data for this guild"}),t.jsxs("div",{className:"mt-2 text-sm text-neutral-500",children:["Server: ",s.server," ⢠Region: ",s.region]})]}),t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("button",{onClick:()=>G("all"),disabled:E,className:"inline-flex items-center px-4 py-2 border border-neutral-700 rounded-md shadow-xs text-sm font-medium text-neutral-200 bg-neutral-900 hover:bg-neutral-800 disabled:opacity-50",children:[t.jsx(c,{className:"h-4 w-4 mr-2"}),"Export All Data"]}),t.jsxs("button",{onClick:()=>C(!0),className:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-xs text-sm font-medium text-white bg-red-600 hover:bg-red-700",children:[t.jsx(f,{className:"h-4 w-4 mr-2"}),"Delete Guild Data"]}),t.jsxs("button",{onClick:a,className:"inline-flex items-center px-4 py-2 border border-neutral-700 rounded-md shadow-xs text-sm font-medium text-neutral-200 bg-neutral-900 hover:bg-neutral-800",children:[t.jsx(i,{className:"h-4 w-4 mr-2"}),"Close"]})]})]})})}),t.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},className:"mb-8",children:t.jsx("div",{className:"border-b border-neutral-800",children:t.jsx("nav",{className:"-mb-px flex space-x-8",children:I.map(e=>{const s=e.icon;return t.jsxs("button",{onClick:()=>k(e.id),className:"flex items-center py-2 px-1 border-b-2 font-medium text-sm "+(w===e.id?"border-blue-500 text-sky-400":"border-transparent text-neutral-500 hover:text-neutral-200 hover:border-neutral-700"),children:[t.jsx(s,{className:"h-4 w-4 mr-2"}),e.name]},e.id)})})})}),t.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},children:(()=>{if(h)return t.jsxs("div",{className:"flex items-center justify-center h-64",children:[t.jsx(u,{className:"h-8 w-8 animate-spin text-neutral-500"}),t.jsx("span",{className:"ml-2 text-neutral-400",children:"Loading guild data..."})]});if(!b)return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(x,{className:"h-12 w-12 mx-auto text-neutral-500 mb-4"}),t.jsx("p",{className:"text-neutral-500",children:"Failed to load guild data"})]});switch(w){case"overview":return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[T("Characters",b.counts?.characters,0,"Player characters in this guild"),T("Loot Entries",b.counts?.loot_entries,0,"Loot distribution records"),T("Form Responses",b.counts?.form_responses,0,"Form submission records"),T("Discord Users",b.counts?.discord_users,0,"Linked Discord accounts")]}),t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-neutral-100 mb-4",children:"Data Summary"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-neutral-100 mb-2",children:"Storage Usage"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"Database Records:"}),t.jsx("span",{className:"text-sm font-medium",children:b.storage?.database_records||0})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"File Storage:"}),t.jsx("span",{className:"text-sm font-medium",children:b.storage?.file_size||"0 MB"})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"Cache Usage:"}),t.jsx("span",{className:"text-sm font-medium",children:b.storage?.cache_size||"0 MB"})]})]})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-neutral-100 mb-2",children:"Recent Activity"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"Last Loot Entry:"}),t.jsx("span",{className:"text-sm font-medium",children:b.activity?.last_loot_entry?new Date(b.activity.last_loot_entry).toLocaleDateString():"N/A"})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"Last Form Response:"}),t.jsx("span",{className:"text-sm font-medium",children:b.activity?.last_form_response?new Date(b.activity.last_form_response).toLocaleDateString():"N/A"})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm text-neutral-400",children:"Last Login:"}),t.jsx("span",{className:"text-sm font-medium",children:b.activity?.last_character_update?new Date(b.activity.last_character_update).toLocaleDateString():"N/A"})]})]})]})]})]})]});case"characters":return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-6 py-4 border-b border-neutral-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-lg font-semibold text-neutral-100",children:"Characters"}),t.jsx("button",{onClick:()=>G("characters"),className:"text-sky-400 hover:text-sky-200 text-sm",children:"Export Characters"})]})}),t.jsx("div",{className:"p-6",children:b.characters&&b.characters.length>0?t.jsxs("div",{className:"overflow-x-auto",children:[t.jsxs("table",{className:"min-w-full divide-y divide-neutral-800",children:[t.jsx("thead",{className:"bg-neutral-900/50",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-500 uppercase",children:"Name"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-500 uppercase",children:"Class"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-500 uppercase",children:"Level"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-neutral-500 uppercase",children:"Last Seen"})]})}),t.jsx("tbody",{className:"divide-y divide-neutral-800",children:b.characters.slice(0,10).map(e=>t.jsxs("tr",{children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-neutral-100",children:e.name}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-neutral-500",children:e.class}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-neutral-500",children:e.level}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-neutral-500",children:e.last_seen?new Date(e.last_seen).toLocaleDateString():"N/A"})]},e.id))})]}),b.characters.length>10&&t.jsxs("p",{className:"text-sm text-neutral-500 mt-4 text-center",children:["Showing first 10 of ",b.characters.length," characters. Export for full list."]})]}):t.jsx("p",{className:"text-neutral-500",children:"No characters found for this guild."})})]})});case"loot":return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-neutral-100",children:"Loot Distribution"}),t.jsx("button",{onClick:()=>G("loot"),className:"text-sky-400 hover:text-sky-200 text-sm",children:"Export Loot Data"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[t.jsxs("div",{className:"bg-neutral-900/50 rounded-lg p-4",children:[t.jsx("div",{className:"text-2xl font-bold text-neutral-100",children:b.loot?.total_entries||0}),t.jsx("div",{className:"text-sm text-neutral-400",children:"Total Loot Entries"})]}),t.jsxs("div",{className:"bg-neutral-900/50 rounded-lg p-4",children:[t.jsx("div",{className:"text-2xl font-bold text-neutral-100",children:b.loot?.unique_items||0}),t.jsx("div",{className:"text-sm text-neutral-400",children:"Unique Items"})]}),t.jsxs("div",{className:"bg-neutral-900/50 rounded-lg p-4",children:[t.jsx("div",{className:"text-2xl font-bold text-neutral-100",children:b.loot?.recent_drops||0}),t.jsx("div",{className:"text-sm text-neutral-400",children:"Recent Drops (30 days)"})]})]}),b.loot?.recent&&b.loot.recent.length>0?t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-neutral-100 mb-3",children:"Recent Loot"}),t.jsx("div",{className:"space-y-2",children:b.loot.recent.slice(0,5).map((e,s)=>t.jsxs("div",{className:"flex items-center justify-between bg-neutral-900/50 rounded-sm p-3",children:[t.jsxs("div",{children:[t.jsx("span",{className:"font-medium text-neutral-100",children:e.item_name}),t.jsxs("span",{className:"text-sm text-neutral-500 ml-2",children:["â ",e.character_name]})]}),t.jsx("span",{className:"text-xs text-neutral-500",children:new Date(e.timestamp).toLocaleDateString()})]},s))})]}):t.jsx("p",{className:"text-neutral-500",children:"No recent loot entries found."})]})});case"raw":return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"bg-neutral-900 rounded-lg shadow-sm p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-neutral-100 mb-4",children:"Raw Data Access"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-amber-900/20 border border-yellow-200 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx(x,{className:"h-5 w-5 text-yellow-500 mr-2"}),t.jsx("span",{className:"text-sm font-medium text-amber-300",children:"Raw data exports contain sensitive information and should be handled carefully."})]})}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("button",{onClick:()=>G("database_dump"),disabled:E,className:"p-4 border border-neutral-700 rounded-lg hover:bg-neutral-800 text-left disabled:opacity-50",children:[t.jsx(y,{className:"h-6 w-6 text-neutral-400 mb-2"}),t.jsx("h4",{className:"font-medium text-neutral-100",children:"Database Dump"}),t.jsx("p",{className:"text-sm text-neutral-500",children:"Complete database export for this guild"})]}),t.jsxs("button",{onClick:()=>G("json_export"),disabled:E,className:"p-4 border border-neutral-700 rounded-lg hover:bg-neutral-800 text-left disabled:opacity-50",children:[t.jsx(c,{className:"h-6 w-6 text-neutral-400 mb-2"}),t.jsx("h4",{className:"font-medium text-neutral-100",children:"JSON Export"}),t.jsx("p",{className:"text-sm text-neutral-500",children:"Structured data in JSON format"})]})]})]})]})});default:return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(g,{className:"h-12 w-12 mx-auto text-neutral-500 mb-4"}),t.jsxs("p",{className:"text-neutral-500",children:["Content for ",w," tab is not yet implemented."]})]})}})()},w)]})}),_&&t.jsx("div",{className:"fixed inset-0 bg-neutral-900 bg-opacity-50 overflow-y-auto h-full w-full z-50",children:t.jsx("div",{className:"relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-neutral-900",children:t.jsxs("div",{className:"mt-3 text-center",children:[t.jsx(x,{className:"mx-auto h-12 w-12 text-red-500 mb-4"}),t.jsx("h3",{className:"text-lg font-medium text-neutral-100 mb-2",children:"Delete Guild Data"}),t.jsxs("p",{className:"text-sm text-neutral-500 mb-4",children:['This will permanently delete ALL data associated with "',s.guild_name,'". This includes characters, loot entries, form responses, and more.']}),t.jsx("p",{className:"text-sm font-medium text-red-400 mb-4",children:"This action cannot be undone!"}),t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-neutral-200 mb-2",children:["Type the guild name to confirm: ",t.jsx("strong",{children:s.guild_name})]}),t.jsx("input",{type:"text",value:S,onChange:e=>D(e.target.value),className:"w-full px-3 py-2 border border-neutral-700 rounded-md focus:ring-2 focus:ring-red-500 focus:border-red-500",placeholder:"Enter guild name"})]}),t.jsxs("div",{className:"flex justify-center space-x-4",children:[t.jsx("button",{onClick:()=>{C(!1),D("")},className:"px-4 py-2 bg-neutral-700 text-neutral-200 rounded-md hover:bg-neutral-600",children:"Cancel"}),t.jsx("button",{onClick:async()=>
1{if(S===s.guild_name)try{F(!0),await r.delete(`/api/admin/guilds/${s.id}/data`),l.success("Guild data deleted successfully"),d(),a()}catch(e){console.error("Error deleting guild data:",e),l.error("Failed to delete guild data")}finally{F(!1)}else l.error("Guild name confirmation does not match")},disabled:S!==s.guild_name||E,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed",children:E?"Deleting...":"Delete All Data"})]})]})})})]})},I=()=>{const[s,i]=e.useState([]),[d,o]=e.useState(!0),[m,b]=e.useState(""),[g,j]=e.useState("all"),[N,y]=e.useState(null),[D,L]=e.useState(!1),[I,A]=e.useState(!1),[G,T]=e.useState(null),[R,M]=e.useState(null),[P,U]=e.useState([]),[z,$]=e.useState(1),[B]=e.useState(10),[O,H]=e.useState(0),[K,V]=e.useState({total:0,active:0,inactive:0,regions:{}});e.useEffect(()=>{q(),J()},[z,m,g]);const q=async()=>{try{o(!0);const e={page:z,limit:B,search:m,status:"all"!==g?g:void 0},t=await r.get("/api/admin/guilds",{params:e});i(t.data.guilds),H(t.data.total)}catch(e){console.error("Error loading guilds:",e),l.error("Failed to load guilds")}finally{o(!1)}},J=async()=>{try{const e=await r.get("/api/admin/guild-stats");V(e.data)}catch(e){console.error("Error loading stats:",e)}},Z=async e=>{if(0!==P.length)try{switch(e){case"activate":await r.patch("/api/admin/guilds/bulk",{guildIds:P,action:"activate"}),l.success(`Activated ${P.length} guild(s)`);break;case"deactivate":await r.patch("/api/admin/guilds/bulk",{guildIds:P,action:"deactivate"}),l.success(`Deactivated ${P.length} guild(s)`);break;case"delete":window.confirm(`Are you sure you want to delete ${P.length} guild(s)? This action cannot be undone.`)&&(await r.delete("/api/admin/guilds/bulk",{data:{guildIds:P}}),l.success(`Deleted ${P.length} guild(s)`));break;default:return void l.error("Invalid action")}U([]),q(),J()}catch(t){console.error("Error performing bulk action:",t),l.error("Failed to perform bulk action")}else l.error("No guilds selected")},W=(s||[]).filter(e=>{if(!e)return!1;const t=(m||"").toLowerCase(),s=(e.guild_name||e.name||"").toLowerCase(),a=(null!=e.id?String(e.id):"").toLowerCase(),l=!t||s.includes(t)||a.includes(t),r="all"===g||"active"===g&&e.is_active||"inactive"===g&&!e.is_active;return l&&r}),Q=Math.ceil(O/B);return D?t.jsx(E,{guild:G,onSave:async e=>{try{G?(await r.put(`/api/admin/guilds/${G.id}`,e),l.success("Guild updated successfully")):(await r.post("/api/admin/guilds",e),l.success("Guild created successfully")),L(!1),T(null),q(),J()}catch(t){console.error("Error saving guild:",t),l.error("Failed to save guild")}},onCancel:()=>{L(!1),T(null)}}):I&&N?t.jsx(F,{guild:N,onClose:()=>{A(!1),y(null)},onRefresh:q}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-neutral-100",children:"Guild Management"}),t.jsx("p",{className:"mt-1 text-sm text-neutral-400",children:"Manage Discord guilds (server tenants) across the platform"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:async()=>{try{const e=await r.get("/api/admin/guilds/export",{responseType:"blob"}),t=window.URL.createObjectURL(new Blob([e.data])),s=document.createElement("a");s.href=t,s.setAttribute("download",`guilds-export-${(new Date).toISOString().split("T")[0]}.csv`),document.body.appendChild(s),s.click(),s.remove(),l.success("Guild data exported successfully")}catch(e){console.error("Error exporting guilds:",e),l.error("Failed to export guild data")}},className:"inline-flex items-center px-3 py-2 border border-neutral-700 rounded-md text-sm font-medium text-neutral-200 bg-neutral-900 hover:bg-neutral-800 focus:outline-hidden focus:ring-2 focus:ring-sky-500",children:[t.jsx(c,{className:"h-4 w-4 mr-2"}),"Export"]}),t.jsxs("button",{onClick:()=>{T(null),L(!0)},className:"inline-flex items-center px-3 py-2 rounded-md text-sm font-medium text-white bg-sky-600 hover:bg-sky-500 focus:outline-hidden focu
1s:ring-2 focus:ring-sky-500",children:[t.jsx(w,{className:"h-4 w-4 mr-2"}),"Create Guild"]})]})]}),t.jsxs(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.05},className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[t.jsx("div",{className:"bg-neutral-900 border border-neutral-800 rounded-lg p-5",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-2 rounded-lg bg-sky-900/30 border border-sky-800/50",children:t.jsx(v,{className:"h-5 w-5 text-sky-400"})}),t.jsxs("div",{className:"ml-3",children:[t.jsx("p",{className:"text-xs text-neutral-400",children:"Total Guilds"}),t.jsx("p",{className:"text-2xl font-bold text-neutral-100 tabular-nums",children:K.total??0})]})]})}),t.jsx("div",{className:"bg-neutral-900 border border-neutral-800 rounded-lg p-5",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-2 rounded-lg bg-emerald-900/30 border border-emerald-800/50",children:t.jsx(k,{className:"h-5 w-5 text-emerald-400"})}),t.jsxs("div",{className:"ml-3",children:[t.jsx("p",{className:"text-xs text-neutral-400",children:"Active Guilds"}),t.jsx("p",{className:"text-2xl font-bold text-neutral-100 tabular-nums",children:K.active??0})]})]})}),t.jsx("div",{className:"bg-neutral-900 border border-neutral-800 rounded-lg p-5",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-2 rounded-lg bg-red-900/30 border border-red-800/50",children:t.jsx(_,{className:"h-5 w-5 text-red-400"})}),t.jsxs("div",{className:"ml-3",children:[t.jsx("p",{className:"text-xs text-neutral-400",children:"Inactive Guilds"}),t.jsx("p",{className:"text-2xl font-bold text-neutral-100 tabular-nums",children:K.inactive??0})]})]})}),t.jsx("div",{className:"bg-neutral-900 border border-neutral-800 rounded-lg p-5",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-2 rounded-lg bg-violet-900/30 border border-violet-800/50",children:t.jsx(h,{className:"h-5 w-5 text-violet-400"})}),t.jsxs("div",{className:"ml-3",children:[t.jsx("p",{className:"text-xs text-neutral-400",children:"Bot Installed"}),t.jsx("p",{className:"text-2xl font-bold text-neutral-100 tabular-nums",children:(s||[]).filter(e=>e.botInstalled).length})]})]})})]}),t.jsxs(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},className:"bg-neutral-900 border border-neutral-800 rounded-lg p-4",children:[t.jsxs("div",{className:"flex flex-col lg:flex-row gap-3",children:[t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"relative",children:[t.jsx(p,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5 text-neutral-500"}),t.jsx("input",{type:"text",placeholder:"Search guilds by name or ID...",value:m,onChange:e=>b(e.target.value),className:"pl-10 pr-4 py-2 w-full border border-neutral-700 rounded-lg bg-neutral-950 text-neutral-100 placeholder-neutral-500 focus:ring-2 focus:ring-sky-500 focus:border-sky-500"})]})}),t.jsx("div",{className:"lg:w-48",children:t.jsx(a,{value:g,onChange:e=>j(e),options:[{value:"all",label:"All Status"},{value:"active",label:"Active"},{value:"inactive",label:"Inactive"}],className:"w-full"})})]}),P.length>0&&t.jsx("div",{className:"mt-4 p-3 bg-sky-900/20 rounded-lg border border-sky-800/50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("p",{className:"text-sm font-medium text-sky-300",children:[P.length," guild(s) selected"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>Z("activate"),className:"px-3 py-1 text-xs font-medium text-emerald-300 bg-emerald-900/30 border border-emerald-800/50 rounded-full hover:bg-emerald-900/50",children:"Activate"}),t.jsx("button",{onClick:()=>Z("deactivate"),className:"px-3 py-1 text-xs font-medium text-amber-300 bg-amber-900/30 border border-amber-800/50 rounded-full hover:bg-amber-900/50",children:"Deactivate"}),t.jsx("button",{onClick:()=>Z("delete"),className:"px-3 py-1 text-xs font-medium text-red-300 bg-red-900/30 border border-red-800/50 rounded-full hover:bg-red-900/50",children:"Delete"}),t.jsx("button",{onClick:()=>U([]),className:"px-3 py-1 text-xs font-medium text-neutral-300 bg-neutral-800 border border-neutral-700 rounded-full hover:bg-neutral-700",children:"Clear"})]})]})})]}),t.jsxs(n.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.4,delay:.15},className:"bg-neutral-900 border border-neutral-800 rounded-lg overflow-hidden",children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-neutral-800",children:[t.jsx("thead",{className:"bg-neutral-900/50",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-5 py-3 text-left text-xs font-medium text-neutral-500 uppercase tracking-wider",children:t.jsx("input",{type:"checkbox",checked:P.length===W.length&&W.length>0,onChange:e=>{e.target.checked?U(W.map(e=>e.id)):U([])},className:"rounded-sm border-neutral-700 bg-neutral-800 text-sky-500 focus:ring-sky-500"})}),t.jsx("th",{className:"px-5 py-3 text-left text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Guild"}),t.jsx("th",{className:"px-5 py-3 text-left text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-5 py-3 text-left text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Bot"}),t.jsx("th",{className:"px-5 py-3 text-right text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Discord Members"}),t.jsx("th",{className:"px-5 py-3 text-right text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Characters"}),t.jsx("th",{className:"px-5 py-3 text-left text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Created"}),t.jsx("th",{className:"px-5 py-3 text-right text-xs font-medium text-neutral-500 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"divide-y divide-neutral-800",children:d?t.jsx("tr",{children:t.jsxs("td",{colSpan:"8",className:"px-5 py-12 text-center",children:[t.jsx(u,{className:"h-8 w-8 animate-spin mx-auto text-neutral-500 mb-4"}),t.jsx("p",{className:"text-neutral-500",children:"Loading guilds..."})]})}):0===W.length?t.jsx("tr",{children:t.jsxs("td",{colSpan:"8",className:"px-5 py-12 text-center",children:[t.jsx(v,{className:"h-12 w-12 mx-auto text-neutral-600 mb-4"}),t.jsx("p",{className:"text-neutral-300 text-lg",children:"No guilds found"}),t.jsx("p",{className:"text-neutral-500 text-sm",children:"Try adjusting your search or filters"})]})}):W.map(e=>{return t.jsxs("tr",{className:"hover:bg-neutral-800/50 transition-colors",children:[t.jsx("td",{className:"px-5 py-3 whitespace-nowrap",children:t.jsx("input",{type:"checkbox",checked:P.includes(e.id),onChange:t=>{t.target.checked?U([...P,e.id]):U(P.filter(t=>t!==e.id))},className:"rounded-sm border-neutral-700 bg-neutral-800 text-sky-500 focus:ring-sky-500"})}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"shrink-0 h-9 w-9",children:t.jsx("div",{className:"h-9 w-9 rounded-lg bg-sky-900/40 border border-sky-800/50 flex items-center justify-center",children:t.jsx(v,{className:"h-5 w-5 text-sky-400"})})}),t.jsxs("div",{className:"ml-3 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-neutral-100 truncate max-w-xs",title:e.guild_name,children:e.guild_name||t.jsx("span",{className:"text-neutral-500 italic",children:"(unnamed)"})}),t.jsx("div",{className:"text-xs text-neutral-500 font-mono truncate max-w-xs",children:e.id})]})]})}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap",children:(s=e.is_active,s?t.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-emerald-900/30 text-emerald-300 border border-emerald-800/50",children:"Active"}):t.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-900/30 text-red-300 border border-red-800/50",children:"Inactive"}))}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap text-sm text-neutral-300",children:e.botInstalled?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(k,{className:"h-4 w-4 text-emerald-400"}),t.jsx("span",{className:"text-xs",children:e.botPermissionLevel||"installed"})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-neutral-500",children:[t.jsx(_,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs",children:"not installed"})]})}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap text-sm text-neutral-200 text-right tabular-nums",children:Number(e.discordMemberCount??0).toLocaleStr
1ing()}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap text-sm text-neutral-200 text-right tabular-nums",children:Number(e.memberCount??0).toLocaleString()}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap text-sm text-neutral-400",children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"â"}),t.jsx("td",{className:"px-5 py-3 whitespace-nowrap text-right text-sm font-medium",children:t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsx("button",{onClick:()=>(e=>{y(e),A(!0)})(e),className:"p-1 text-sky-400 hover:text-sky-300 hover:bg-neutral-800 rounded-sm",title:"View Data",children:t.jsx(C,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>(e=>{T(e),L(!0)})(e),className:"p-1 text-violet-400 hover:text-violet-300 hover:bg-neutral-800 rounded-sm",title:"Edit",children:t.jsx(S,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>M(e),className:"p-1 text-red-400 hover:text-red-300 hover:bg-neutral-800 rounded-sm",title:"Delete",children:t.jsx(f,{className:"h-4 w-4"})})]})})]},e.id);var s})})]})}),Q>1&&t.jsx("div",{className:"bg-neutral-900 px-4 py-3 border-t border-neutral-800 sm:px-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex-1 flex justify-between sm:hidden",children:[t.jsx("button",{onClick:()=>$(Math.max(1,z-1)),disabled:1===z,className:"relative inline-flex items-center px-3 py-2 border border-neutral-700 text-sm font-medium rounded-md text-neutral-200 bg-neutral-900 hover:bg-neutral-800 disabled:opacity-50",children:"Previous"}),t.jsx("button",{onClick:()=>$(Math.min(Q,z+1)),disabled:z===Q,className:"ml-3 relative inline-flex items-center px-3 py-2 border border-neutral-700 text-sm font-medium rounded-md text-neutral-200 bg-neutral-900 hover:bg-neutral-800 disabled:opacity-50",children:"Next"})]}),t.jsxs("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[t.jsxs("p",{className:"text-sm text-neutral-400",children:["Showing"," ",t.jsx("span",{className:"font-medium text-neutral-200",children:(z-1)*B+1})," ","to"," ",t.jsx("span",{className:"font-medium text-neutral-200",children:Math.min(z*B,O)})," ","of"," ",t.jsx("span",{className:"font-medium text-neutral-200",children:O})," ","results"]}),t.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-xs -space-x-px",children:[t.jsx("button",{onClick:()=>$(Math.max(1,z-1)),disabled:1===z,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-neutral-700 bg-neutral-900 text-sm font-medium text-neutral-400 hover:bg-neutral-800 disabled:opacity-50",children:"Previous"}),Array.from({length:Math.min(Q,5)},(e,s)=>{const a=z<=3?s+1:z-2+s;return a<=Q?t.jsx("button",{onClick:()=>$(a),className:"relative inline-flex items-center px-4 py-2 border text-sm font-medium "+(a===z?"z-10 bg-sky-900/50 border-sky-700 text-sky-300":"bg-neutral-900 border-neutral-700 text-neutral-400 hover:bg-neutral-800"),children:a},a):null}),t.jsx("button",{onClick:()=>$(Math.min(Q,z+1)),disabled:z===Q,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-neutral-700 bg-neutral-900 text-sm font-medium text-neutral-400 hover:bg-neutral-800 disabled:opacity-50",children:"Next"})]})]})]})})]}),R&&t.jsx("div",{className:"fixed inset-0 bg-black/70 overflow-y-auto h-full w-full z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"relative bg-neutral-900 border border-neutral-800 rounded-lg shadow-xl max-w-md w-full p-6",children:t.jsxs("div",{className:"text-center",children:[t.jsx(x,{className:"mx-auto h-12 w-12 text-red-400 mb-3"}),t.jsx("h3",{className:"text-lg font-semibold text-neutral-100 mb-2",children:"Delete Guild"}),t.jsxs("p",{className:"text-sm text-neutral-400 mb-6",children:["Are you sure you want to delete ",t.jsxs("span",{className:"font-medium text-neutral-200",children:['"',R.guild_name,'"']}),"? This action cannot be undone and will delete all associated data."]}),t.jsxs("div",{className:"flex justify-center gap-3",children:[t.jsx("button",{onClick:()=>M(null),className:"px-4 py-2 bg-neutral-800 text-neutral-200 border border-neutral-700 rounded-md hover:bg-neutral-700 focus:outline-hidden focu
1s:ring-2 focus:ring-neutral-500",children:"Cancel"}),t.jsx("button",{onClick:()=>(async e=>{try{await r.delete(`/api/admin/guilds/${e.id}`),l.success("Guild deleted successfully"),M(null),q(),J()}catch(t){console.error("Error deleting guild:",t),l.error("Failed to delete guild")}})(R),className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-500 focus:outline-hidden focus:ring-2 focus:ring-red-500",children:"Delete"})]})]})})})]})};function A(){return t.jsx(s,{children:t.jsx(I,{})})}export{A as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.