import{jsx as e,jsxs as l}from"react/jsx-runtime";import{B as n}from"./button-BvFBRYHq.js";import{T as h,a as g,b as s,c as u,d as f,e as d}from"./table-BrXe3s2z.js";import{ArrowUpDown as o,Users as N,Gift as v}from"lucide-react";import{flexRender as m}from"@tanstack/react-table";import{router as p}from"@inertiajs/react";import"@radix-ui/react-slot";import"class-variance-authority";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";function D({table:c,columns:t,searchQuery:i}){return e("div",{className:"rounded-md border overflow-x-auto",children:l(h,{children:[e(g,{children:c.getHeaderGroups().map(a=>e(s,{children:a.headers.map(r=>e(u,{children:r.isPlaceholder?null:m(r.column.columnDef.header,r.getContext())},r.id))},a.id))}),e(f,{children:c.getRowModel().rows?.length?c.getRowModel().rows.map(a=>e(s,{"data-state":a.getIsSelected()&&"selected",children:a.getVisibleCells().map(r=>e(d,{children:m(r.column.columnDef.cell,r.getContext())},r.id))},a.id)):e(s,{children:e(d,{colSpan:t.length,className:"h-24 text-center",children:i?"No factions found.":'Enter a Faction ID or Name to search, or click "Show All Factions".'})})})]})})}function B(c){return[{accessorKey:"id",header:({column:t})=>e("div",{className:"text-center",children:l(n,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:["Faction ID",e(o,{className:"ml-2 h-4 w-4"})]})}),cell:({row:t})=>e("div",{className:"text-center font-mono font-semibold",children:t.getValue("id")})},{accessorKey:"name",header:({column:t})=>e("div",{className:"text-center",children:l(n,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:["Faction Name",e(o,{className:"ml-2 h-4 w-4"})]})}),cell:({row:t})=>e("div",{className:"text-center font-medium",children:t.getValue("name")})},{accessorKey:"level",header:({column:t})=>e("div",{className:"text-center",children:l(n,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:["Level",e(o,{className:"ml-2 h-4 w-4"})]})}),cell:({row:t})=>e("div",{className:"text-center font-mono",children:t.getValue("level")})},{accessorKey:"member_count",header:({column:t})=>e("div",{className:"text-center",children:l(n,{variant:"ghost",onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:["Members",e(o,{className:"ml-2 h-4 w-4"})]})}),cell:({row:t})=>e("div",{className:"text-center font-mono",children:t.getValue("member_count")})},{id:"actions",header:()=>e("div",{className:"text-center",children:"Action"}),cell:({row:t})=>{const i=t.original;return l("div",{className:"flex items-center justify-center gap-1",children:[e(n,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"View Members",onClick:()=>p.visit(route("admin.manage-factions.show",i.id)),children:e(N,{className:"h-4 w-4"})}),e(n,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>c(i),title:"Set Bonus",children:e(v,{className:"h-4 w-4"})})]})}}]}export{D as FactionTable,B as createFactionColumns};
