@akshar-technosoft/ui 1.0.18 → 1.0.19

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.
Files changed (34) hide show
  1. package/dist/components/data/data-table/data-table-toolbar.cjs +1 -1
  2. package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -1
  3. package/dist/components/data/data-table/data-table-toolbar.d.cts +4 -1
  4. package/dist/components/data/data-table/data-table-toolbar.d.ts +4 -1
  5. package/dist/components/data/data-table/data-table-toolbar.js +1 -1
  6. package/dist/components/data/data-table/data-table-toolbar.js.map +1 -1
  7. package/dist/components/data/data-table/data-table-types.cjs.map +1 -1
  8. package/dist/components/data/data-table/data-table-types.d.cts +1 -0
  9. package/dist/components/data/data-table/data-table-types.d.ts +1 -0
  10. package/dist/components/data/data-table/data-table.cjs +1 -1
  11. package/dist/components/data/data-table/data-table.cjs.map +1 -1
  12. package/dist/components/data/data-table/data-table.js +1 -1
  13. package/dist/components/data/data-table/data-table.js.map +1 -1
  14. package/dist/components/data/data-table/index.cjs +1 -1
  15. package/dist/components/data/data-table/index.cjs.map +1 -1
  16. package/dist/components/data/data-table/index.js +1 -1
  17. package/dist/components/data/data-table/index.js.map +1 -1
  18. package/dist/components/layouts/app-content.cjs +1 -1
  19. package/dist/components/layouts/app-content.cjs.map +1 -1
  20. package/dist/components/layouts/app-content.js +1 -1
  21. package/dist/components/layouts/app-content.js.map +1 -1
  22. package/dist/components/layouts/factories.cjs +1 -1
  23. package/dist/components/layouts/factories.cjs.map +1 -1
  24. package/dist/components/layouts/factories.js +1 -1
  25. package/dist/components/layouts/factories.js.map +1 -1
  26. package/dist/components/layouts/index.cjs +1 -1
  27. package/dist/components/layouts/index.cjs.map +1 -1
  28. package/dist/components/layouts/index.js +1 -1
  29. package/dist/components/layouts/index.js.map +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  "use client"
2
- import{flexRender as Qt,getCoreRowModel as Gn,getFilteredRowModel as jn,getPaginationRowModel as Un,getSortedRowModel as $n,useReactTable as qn}from"@tanstack/react-table";import{Loader2 as Fo,ChevronUp as Yt,ChevronDown as Zt,ChevronsUpDown as Wn,MoreHorizontal as Xn,MoveRightIcon as Kn,PinOffIcon as Jn,Calculator as _o}from"lucide-react";import{Slot as cn}from"radix-ui";import{cva as mn}from"class-variance-authority";import{clsx as ln}from"clsx";import{twMerge as dn}from"tailwind-merge";function n(...e){return dn(ln(e))}import{jsx as un}from"react/jsx-runtime";var mt=mn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:t,size:a,asChild:u=!1,...v}){let m=u?cn.Slot:"button";return un(m,{"data-slot":"button",className:n(mt({variant:t,size:a,className:e}),"transition-none"),...v})}import{jsx as fe}from"react/jsx-runtime";function _t({className:e,...t}){return fe("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:fe("table",{"data-slot":"table",className:n("w-full caption-bottom text-sm",e),...t})})}function lo({className:e,...t}){return fe("thead",{"data-slot":"table-header",className:n("[&_tr]:border-b",e),...t})}function co({className:e,...t}){return fe("tbody",{"data-slot":"table-body",className:n("[&_tr:last-child]:border-0",e),...t})}function Vt({className:e,...t}){return fe("tfoot",{"data-slot":"table-footer",className:n("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function de({className:e,...t}){return fe("tr",{"data-slot":"table-row",className:n("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function mo({className:e,...t}){return fe("th",{"data-slot":"table-head",className:n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function ce({className:e,...t}){return fe("td",{"data-slot":"table-cell",className:n("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as uo}from"react/jsx-runtime";function At({className:e,...t}){return uo("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Bt({className:e,...t}){return uo("div",{"data-slot":"card-content",className:n("px-6",e),...t})}import{Tooltip as Te}from"radix-ui";import{jsx as Se,jsxs as pn}from"react/jsx-runtime";function $e({delayDuration:e=0,...t}){return Se(Te.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ht({...e}){return Se($e,{children:Se(Te.Root,{"data-slot":"tooltip",...e})})}function Lt({...e}){return Se(Te.Trigger,{"data-slot":"tooltip-trigger",...e})}function Ot({className:e,sideOffset:t=0,children:a,...u}){return Se(Te.Portal,{children:pn(Te.Content,{"data-slot":"tooltip-content",sideOffset:t,className:n("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...u,children:[a,Se(Te.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as wo,RefreshCw as Sn,Download as kn,Settings2 as Rn,Filter as No,ArrowUpDown as zn,PinOff as Mn,Pin as In,ChevronDown as $t,Calculator as qt,Check as Po}from"lucide-react";import{jsx as gn}from"react/jsx-runtime";function Et({className:e,type:t,...a}){return gn("input",{type:t,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}import{Command as we}from"cmdk";import{SearchIcon as fn}from"lucide-react";import{Dialog as Ga}from"radix-ui";import{XIcon as Ua}from"lucide-react";import{jsx as Wa,jsxs as Xa}from"react/jsx-runtime";import{jsx as be,jsxs as bn}from"react/jsx-runtime";function ut({className:e,...t}){return be(we,{"data-slot":"command",className:n("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function pt({className:e,...t}){return bn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[be(fn,{className:"size-4 shrink-0 opacity-50"}),be(we.Input,{"data-slot":"command-input",className:n("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function gt({className:e,...t}){return be(we.List,{"data-slot":"command-list",className:n("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function ft({...e}){return be(we.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function qe({className:e,...t}){return be(we.Group,{"data-slot":"command-group",className:n("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function po({className:e,...t}){return be(we.Separator,{"data-slot":"command-separator",className:n("bg-border -mx-1 h-px",e),...t})}function ke({className:e,...t}){return be(we.Item,{"data-slot":"command-item",className:n("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}import{DropdownMenu as $}from"radix-ui";import{CheckIcon as vn,ChevronRightIcon as hn,CircleIcon as dr}from"lucide-react";import{jsx as O,jsxs as vo}from"react/jsx-runtime";function re({...e}){return O($.Root,{"data-slot":"dropdown-menu",...e})}function ie({...e}){return O($.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function se({className:e,sideOffset:t=4,...a}){return O($.Portal,{children:O($.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...a})})}function Gt({...e}){return O($.Group,{"data-slot":"dropdown-menu-group",...e})}function V({className:e,inset:t,variant:a="default",...u}){return O($.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:n("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...u})}function Re({className:e,children:t,checked:a,...u}){return vo($.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:n("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...u,children:[O("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:O($.ItemIndicator,{children:O(vn,{className:"size-4"})})}),t]})}function q({className:e,inset:t,...a}){return O($.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function K({className:e,...t}){return O($.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t})}function go({...e}){return O($.Sub,{"data-slot":"dropdown-menu-sub",...e})}function fo({className:e,inset:t,children:a,...u}){return vo($.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:n("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...u,children:[a,O(hn,{className:"ml-auto size-4"})]})}function bo({className:e,...t}){return O($.SubContent,{"data-slot":"dropdown-menu-sub-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as Wt}from"react";import{useEffect as Pn,useState as jt}from"react";import{Calendar as Dn}from"lucide-react";import{format as We}from"date-fns";import{Popover as bt}from"radix-ui";import{jsx as vt}from"react/jsx-runtime";function ze({...e}){return vt(bt.Root,{"data-slot":"popover",...e})}function Me({...e}){return vt(bt.Trigger,{"data-slot":"popover-trigger",...e})}function Ie({className:e,align:t="center",sideOffset:a=4,...u}){return vt(bt.Portal,{children:vt(bt.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...u})})}import*as ht from"react";import{ChevronDownIcon as xn,ChevronLeftIcon as Cn,ChevronRightIcon as yn}from"lucide-react";import{DayPicker as wn,getDefaultClassNames as ho}from"react-day-picker";import{jsx as ve}from"react/jsx-runtime";function xo({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:u="label",buttonVariant:v="ghost",formatters:m,components:k,...I}){let h=ho();return ve(wn,{showOutsideDays:a,className:n("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:u,formatters:{formatMonthDropdown:P=>P.toLocaleString("default",{month:"short"}),...m},classNames:{root:n("w-fit",h.root),months:n("flex gap-4 flex-col md:flex-row relative",h.months),month:n("flex flex-col w-full gap-4",h.month),nav:n("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",h.nav),button_previous:n(mt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_previous),button_next:n(mt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_next),month_caption:n("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",h.month_caption),dropdowns:n("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",h.dropdowns),dropdown_root:n("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",h.dropdown_root),dropdown:n("absolute bg-popover inset-0 opacity-0",h.dropdown),caption_label:n("select-none font-medium",u==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",h.caption_label),table:"w-full border-collapse",weekdays:n("flex",h.weekdays),weekday:n("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",h.weekday),week:n("flex w-full mt-2",h.week),week_number_header:n("select-none w-(--cell-size)",h.week_number_header),week_number:n("text-[0.8rem] select-none text-muted-foreground",h.week_number),day:n("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",h.day),range_start:n("rounded-l-md bg-accent",h.range_start),range_middle:n("rounded-none",h.range_middle),range_end:n("rounded-r-md bg-accent",h.range_end),today:n("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",h.today),outside:n("text-muted-foreground aria-selected:text-muted-foreground",h.outside),disabled:n("text-muted-foreground opacity-50",h.disabled),hidden:n("invisible",h.hidden),...t},components:{Root:({className:P,rootRef:R,...L})=>ve("div",{"data-slot":"calendar",ref:R,className:n(P),...L}),Chevron:({className:P,orientation:R,...L})=>R==="left"?ve(Cn,{className:n("size-4",P),...L}):R==="right"?ve(yn,{className:n("size-4",P),...L}):ve(xn,{className:n("size-4",P),...L}),DayButton:Nn,WeekNumber:({children:P,...R})=>ve("td",{...R,children:ve("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:P})}),...k},...I})}function Nn({className:e,day:t,modifiers:a,...u}){let v=ho(),m=ht.useRef(null);return ht.useEffect(()=>{a.focused&&m.current?.focus()},[a.focused]),ve(C,{ref:m,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:n("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",v.day,e),...u})}import{jsx as Ne,jsxs as Xe}from"react/jsx-runtime";function Co({value:e,onChange:t,placeholder:a,mode:u,externalSearch:v,onExternalChange:m,onlyExternal:k=!1}){let[I,h]=jt(!1),[P,R]=jt(e),[L,Q]=jt(e);Pn(()=>{k||Q(e)},[e,k]);let me=()=>{k||t(P),Q(P),v&&m&&m(P),h(!1)},te=()=>{R(L),h(!1)},X=()=>{let y=u==="single"?null:{from:null,to:null};R(y),k||t(y),Q(y),v&&m&&m(y),h(!1)},G=()=>{let y=k?L:e;return y?u==="single"?We(y,"PPP"):y.from&&y.to?`${We(y.from,"MMM dd")} - ${We(y.to,"MMM dd, yyyy")}`:y.from?`From ${We(y.from,"MMM dd, yyyy")}`:y.to?`To ${We(y.to,"MMM dd, yyyy")}`:a:a},Y=y=>{R(u==="single"?y:y||{from:null,to:null})};return Xe(ze,{open:I,onOpenChange:h,children:[Ne(Me,{className:"h-8",asChild:!0,children:Xe(C,{variant:"outline",className:n("w-full justify-start text-left font-normal h-9",!G()&&"text-muted-foreground"),children:[Ne(Dn,{className:"mr-2 h-4 w-4"}),G()]})}),Xe(Ie,{className:"w-auto p-0",align:"start",children:[Ne("div",{className:"p-3",children:Ne(xo,{mode:u,selected:P,onSelect:Y,numberOfMonths:u==="range"?2:1,className:"rounded-md border",...u==="range"&&{required:!0}})}),Xe("div",{className:"flex items-center justify-between p-3 border-t",children:[Ne(C,{variant:"ghost",size:"sm",onClick:X,children:"Clear"}),Xe("div",{className:"flex gap-2",children:[Ne(C,{variant:"outline",size:"sm",onClick:te,children:"Cancel"}),Ne(C,{size:"sm",onClick:me,disabled:u==="range"&&(!P?.from||!P?.to),children:"Apply"})]})]})]})]})}import{Checkbox as yo}from"radix-ui";import{CheckIcon as Tn}from"lucide-react";import{jsx as Ut}from"react/jsx-runtime";function Ke({className:e,...t}){return Ut(yo.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:Ut(yo.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Ut(Tn,{className:"size-3.5"})})})}import{Fragment as Fn,jsx as l,jsxs as b}from"react/jsx-runtime";var Do=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function Xt({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:u,enableGlobalFilter:v=!0,onExport:m,onRefresh:k,loading:I=!1,enableColumnVisibility:h=!0,data:P,onClearSorting:R,onClearFilters:L,enableColumnPinning:Q=!1,onExternalSearch:me,onCustomFilterChange:te,aggregations:X={},onAggregationChange:G}){let[Y,y]=Wt({}),[Ae,oe]=Wt({}),[Ze,et]=Wt({}),Be=()=>e.getAllLeafColumns().filter(o=>o.getCanHide?.()!==!1),He=()=>e.getAllColumns().filter(o=>!e.getAllLeafColumns().includes(o)&&o.columns?.length&&o.columns.some(c=>c.getCanHide?.()!==!1)),tt=()=>{let o=new Set(He().flatMap(c=>c.columns?.filter(p=>p.getCanHide?.()!==!1).map(p=>p.id)||[]));return Be().filter(c=>!o.has(c.id))},Pe=(o,c)=>c&&o.startsWith(`${c}.`)?o.replace(`${c}.`,"").split("_").map(S=>S.slice(1)).join(" "):o.split("_").map(p=>p.charAt(0).toUpperCase()+p.slice(1)).join(" "),Le=(o,c)=>{let p={...Y,[o]:c};y(p)},Pt=(o,c)=>{let p={...Ae,[o]:c};oe(p),te&&te(o,c),t.find(S=>S.key===o)?.externalSearch&&Le(o,c)},ot=()=>{me&&me(Y)},Dt=()=>{y({}),oe({}),L(),me&&me({}),te&&Object.keys(Ae).forEach(o=>{te(o,"")})},ne=o=>t.find(p=>p.key===o)?.customFilter?Ae[o]??"":e.getColumn(o)?.getFilterValue(),ue=(o,c)=>{let p=t.find(S=>S.key===o);p?.customFilter?Pt(o,c):(e.getColumn(o)?.setFilterValue(c),p?.externalSearch&&Le(o,c))},Oe=(o,c)=>{et(p=>({...p,[o]:c}))},Tt=o=>{if(G){let c=X[o],p={enabled:!c?.enabled,functions:c?.functions||["sum","average"]};G(o,p)}},Ee=(o,c)=>{if(G){let S=X[o]?.functions||[],j=S.includes(c)?S.filter(rt=>rt!==c):[...S,c];G(o,{enabled:j.length>0,functions:j})}},nt=()=>{G&&Object.keys(X).forEach(o=>{let c=X[o];c&&G(o,{...c,enabled:!1,functions:[]})})},Ge=Be().filter(o=>o.id==="select"||o.id==="serialNumber"?!1:o.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(S=>{let j=S.getValue(o.id);return typeof j=="number"||typeof j=="string"&&!isNaN(parseFloat(String(j)))||typeof j=="object"&&j!==null&&"props"in j})),le=Object.values(X).some(o=>o?.enabled);return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:b("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:t.length>0&&b("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(No,{className:"size-4"})}),t.map(o=>!e.getColumn(o.key)&&!o.customFilter&&!o.externalSearch?null:l("div",{className:n("relative min-w-[150px]",o.width),children:o.type==="select"?b(ze,{open:Ze[o.key],onOpenChange:p=>Oe(o.key,p),children:[l(Me,{asChild:!0,children:b("div",{className:"relative w-full",children:[o.icon&&l(o.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),b(C,{variant:"outline",role:"combobox","aria-expanded":Ze[o.key],className:n("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!ne(o.key)&&"text-muted-foreground"),children:[l("span",{className:n("truncate",o.icon&&"pl-6"),children:ne(o.key)?o.options?.find(p=>p.value===ne(o.key))?.label:o.placeholder}),l($t,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),l(Ie,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:b(ut,{className:"rounded-lg",children:[l(pt,{placeholder:`Search ${o.placeholder?.toLowerCase()}...`}),b(gt,{children:[l(ft,{children:"No option found."}),b(qe,{children:[b(ke,{value:"all",onSelect:()=>{ue(o.key,""),Oe(o.key,!1)},className:"flex items-center cursor-pointer",children:[l(Po,{className:n("mr-2 size-4 shrink-0",ne(o.key)?"opacity-0":"opacity-100")}),l("span",{children:"All"})]}),o.options?.map(p=>b(ke,{value:p.label,onSelect:()=>{ue(o.key,p.value),Oe(o.key,!1)},className:"flex items-center cursor-pointer",children:[l(Po,{className:n("mr-2 size-4 shrink-0",ne(o.key)===p.value?"opacity-100":"opacity-0")}),l("span",{children:p.label})]},p.label))]})]})]})})]}):o.type==="date"?l(Co,{value:ne(o.key),onChange:p=>{o.onlyExternal||ue(o.key,p)},placeholder:o.placeholder,mode:o.dateMode||"single",externalSearch:o.externalSearch,onlyExternal:o.onlyExternal,onExternalChange:p=>Le(o.key,p)}):b("div",{className:"relative",children:[o.icon&&l(o.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Et,{placeholder:o.placeholder,value:ne(o.key)??"",onChange:p=>{ue(o.key,p.target.value)},className:n("h-8 rounded-lg",o.icon&&"pl-9"),type:o.type==="number"?"number":"text"})]})},o.key)),(t.some(o=>o.externalSearch)||t.some(o=>o.customFilter))&&b(C,{variant:"default",size:"sm",onClick:ot,className:"rounded-lg h-7",children:[l(wo,{className:"size-4"}),t.find(o=>o.externalSearch||o.customFilter)?.searchButtonText||"Search"]})]})}),b("div",{className:"flex items-center gap-2",children:[v&&b("div",{className:"relative",children:[l(wo,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Et,{placeholder:"Global search...",value:a??"",onChange:o=>u(o.target.value),className:"pl-9 h-8 max-w-max"})]}),Ge.length>0&&G&&b(re,{children:[l(ie,{asChild:!0,children:b(C,{variant:"outline",size:"sm",className:n("rounded-lg gap-1",le&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(qt,{className:"size-4"}),l("span",{children:"Aggregations"}),l($t,{className:"opacity-50 size-4"})]})}),b(se,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[b(q,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),le&&l(C,{variant:"ghost",size:"sm",onClick:nt,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(K,{}),Ge.map(o=>{let c=X[o.id],p=c?.enabled;return b(go,{children:[l(fo,{className:"text-sm",children:b("div",{className:"flex items-center w-full gap-2",children:[l(Ke,{checked:p,onCheckedChange:()=>Tt(o.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:n("flex-1",p&&"font-medium text-primary"),children:Pe(o.id)}),p&&b("div",{className:"flex items-center gap-1",children:[c?.functions?.slice(0,2).map(S=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:Do.find(j=>j.value===S)?.label},S)),c?.functions&&c.functions.length>2&&b("div",{className:"text-xs text-muted-foreground",children:["+",c.functions.length-2]})]})]})}),b(bo,{className:"w-48 rounded-lg",children:[l(q,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),Do.map(S=>l(Re,{checked:c?.functions?.includes(S.value)||!1,onCheckedChange:()=>Ee(o.id,S.value),className:"py-2 text-sm",children:b("div",{className:"flex flex-col",children:[l("span",{children:S.label}),l("span",{className:"text-xs text-muted-foreground",children:S.description})]})},S.value))]})]},o.id)}),Ge.length===0&&b("div",{className:"px-3 py-4 text-center",children:[l(qt,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),m&&b(C,{variant:"outline",size:"sm",onClick:()=>m(P),className:"rounded-lg",children:[l(kn,{className:"size-4"}),"Export"]}),h&&b(re,{children:[l(ie,{asChild:!0,className:"h-7",children:b(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l($t,{className:"opacity-50 size-4"})]})}),b(se,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l(q,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(K,{}),tt().length>0&&b(Gt,{children:[l(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),tt().map(o=>l(Re,{className:"text-sm",checked:o.getIsVisible(),onCheckedChange:c=>o.toggleVisibility(!!c),children:Pe(o.id)},o.id))]}),He().map(o=>b(Gt,{children:[l(K,{}),l(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:o.id}),o.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>l(Re,{className:"text-sm",checked:c.getIsVisible(),onCheckedChange:p=>c.toggleVisibility(!!p),children:Pe(c.id,o.id)},c.id))]},o.id))]})]}),b(re,{children:[l(ie,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(Rn,{className:"size-4"})})}),b(se,{align:"end",className:"w-[200px] rounded-lg",children:[l(q,{children:"Table Settings"}),l(K,{}),b(V,{onClick:R,children:[l(zn,{className:"size-4"}),"Clear All Sorting"]}),b(V,{onClick:Dt,children:[l(No,{className:"size-4"}),"Clear All Filters"]}),le&&b(V,{onClick:nt,children:[l(qt,{className:"size-4"}),"Clear Aggregations"]}),Q&&b(Fn,{children:[l(K,{}),l(q,{children:"Column Pinning"}),b(V,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(Mn,{className:"size-4"}),"Reset All Pinning"]}),b(V,{onClick:()=>{let o=Be().filter(c=>c.getCanPin?.()!==!1).map(c=>c.id);e.setColumnPinning({left:[],right:o})},children:[l(In,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),k&&l(C,{variant:"outline",size:"sm",onClick:k,disabled:I,className:"rounded-lg",children:l(Sn,{className:n("h-4 w-4",I&&"animate-spin")})})]})]})})})})}import{Select as J}from"radix-ui";import{CheckIcon as _n,ChevronDownIcon as To,ChevronUpIcon as Vn}from"lucide-react";import{jsx as A,jsxs as Kt}from"react/jsx-runtime";function So({...e}){return A(J.Root,{"data-slot":"select",...e})}function ko({...e}){return A(J.Value,{"data-slot":"select-value",...e})}function Ro({className:e,size:t="default",children:a,...u}){return Kt(J.Trigger,{"data-slot":"select-trigger","data-size":t,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...u,children:[a,A(J.Icon,{asChild:!0,children:A(To,{className:"size-4 opacity-50"})})]})}function zo({className:e,children:t,position:a="popper",...u}){return A(J.Portal,{children:Kt(J.Content,{"data-slot":"select-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...u,children:[A(An,{}),A(J.Viewport,{className:n("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),A(Bn,{})]})})}function Mo({className:e,children:t,...a}){return Kt(J.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[A("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:A(J.ItemIndicator,{children:A(_n,{className:"size-4"})})}),A(J.ItemText,{children:t})]})}function An({className:e,...t}){return A(J.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:A(Vn,{className:"size-4"})})}function Bn({className:e,...t}){return A(J.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:A(To,{className:"size-4"})})}import{jsx as E,jsxs as Fe}from"react/jsx-runtime";function Jt({table:e,config:t}){return t.enabled?E("div",{className:"rounded-xl",children:E("div",{children:Fe("div",{className:"flex items-center justify-between",children:[E("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Fe("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Fe("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Fe("div",{className:"flex items-center gap-2",children:[E("span",{className:"text-sm font-medium",children:"Rows per page:"}),Fe(So,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[E(Ro,{className:"h-9 w-[70px] rounded-lg",children:E(ko,{})}),E(zo,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>E(Mo,{value:`${a}`,children:a},a))})]})]}),Fe("div",{className:"flex items-center gap-2",children:[E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&E("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,u)=>{let v=e.getState().pagination.pageIndex,m=v+u;return m<1||m>e.getPageCount()?null:E(C,{variant:m===v+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(m-1),children:m},m)})}),E(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Hn}from"radix-ui";import{cva as Ln}from"class-variance-authority";import{jsx as En}from"react/jsx-runtime";var On=Ln("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Io({className:e,variant:t,size:a,noBg:u,...v}){return En(Hn.Root,{"data-slot":"toggle",className:n(On({className:e,variant:t,size:a,bg:u?"disabled":"enabled"})),...v})}import{useCallback as xt,useEffect as Ct,useMemo as yt,useRef as Je,useState as W}from"react";import{Fragment as Ao,jsx as s,jsxs as D}from"react/jsx-runtime";var Vo={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((u,v)=>u-v),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function Qn({data:e,columns:t,filters:a=[],pagination:u={enabled:!1},settings:v={},header:m,footer:k,className:I="",maxHeight:h="100%",loading:P=!1,error:R,emptyMessage:L="No data available",onRowSelectionChange:Q,onExport:me,onRefresh:te,onTableReady:X,children:G,isRowDisabled:Y,isRowSelectable:y,onExternalSearch:Ae,aggregations:oe={},onAggregationChange:Ze,rowClassName:et}){let[Be,He]=W([]),[tt,Pe]=W([]),[Le,Pt]=W({}),[ot,Dt]=W({}),[ne,ue]=W(""),[Oe,Tt]=W([]),[Ee,nt]=W(v.enableColumnPinning?{left:[],right:[]}:{}),[at,Ge]=W({}),le=Je(null),o=Je(null),c=Je(null),p=Je(null),[S,j]=W(0),[rt,Lo]=W(0),[Oo,Eo]=W(0),[to,Go]=W(0),it=Je(null),[St,jo]=W(!1),{enableSorting:kt=!0,enableFiltering:Rt=!0,enableGlobalFilter:oo=!0,enableColumnVisibility:zt=!0,enableRowSelection:U=!0,stickyHeader:xa=!0,toolbar:je=!1,disableHeaderCheckbox:Uo=!1,toolbarPosition:Ce="default",showSerialNumbers:ae=!0,fixedCheckboxColumn:st=!0,striped:$o=!0,hoverable:qo=!0,compact:Ue=!0,bordered:no=!0,fullHeight:Wo=!1,enableColumnResizing:ao=!1,enableColumnPinning:B=!0,hideHeader:Xo=!1,selectionMode:pe="multiple",showCheckBox:Ko=!0,checkboxColumnPosition:ro=0}=v;Ct(()=>{let d=()=>{it.current&&jo(it.current.scrollTop>0)},g=it.current;if(g)return g.addEventListener("scroll",d),()=>g.removeEventListener("scroll",d)},[]),Ct(()=>{let d=()=>{le.current&&j(le.current.offsetHeight+16),o.current&&Lo(o.current.offsetHeight+16),c.current&&Eo(c.current.offsetHeight+16),p.current&&Go(p.current.offsetHeight+16)};d();let g=new ResizeObserver(()=>{setTimeout(d,50)});return le.current&&g.observe(le.current),o.current&&g.observe(o.current),c.current&&g.observe(c.current),p.current&&g.observe(p.current),()=>{g.disconnect()}},[je,m,Ce]);let Jo=(d,g)=>g.split(".").reduce((i,r)=>i&&i[r],d),Mt=yt(()=>Object.keys(at).length===0?e:e.filter(d=>Object.entries(at).every(([g,i])=>{if(!i||i==="")return!0;let r=Jo(d,g);return typeof i=="string"?String(r).toLowerCase().includes(i.toLowerCase()):r===i})),[e,at]),Qo=xt((d,g)=>{Ge(i=>{let r={...i};return g===""||g===null||g===void 0?delete r[d]:r[d]=g,r})},[]),De=yt(()=>{let d=[...t],g=f=>f.map(x=>{if(x.id==="select"||x.id==="serialNumber")return x;let N={...x,enablePinning:!0};return x.columns&&(N.columns=g(x.columns)),N}),i=g(d),r={id:"select",header:({table:f})=>{if(pe==="single")return null;let x=f.getRowModel().rows.filter(z=>!Y?.(z.original)&&(y?y(z.original):!0)),N=x.length>0&&x.every(z=>z.getIsSelected()),T=x.some(z=>z.getIsSelected());return s(Ke,{checked:N||T&&"indeterminate",onCheckedChange:z=>{x.forEach(F=>F.toggleSelected(!!z))},disabled:Uo||x.length===0,"aria-label":"Select all selectable rows"})},cell:({row:f})=>{let x=Y?Y(f.original):!1,N=y?y(f.original):!0;return s("div",{className:n("flex items-center justify-center",x&&"opacity-50"),children:pe==="multiple"?s(Ke,{checked:f.getIsSelected(),onCheckedChange:T=>N&&f.toggleSelected(!!T),"aria-label":"Select row",disabled:x||!N}):Ko?s("input",{type:"radio",checked:f.getIsSelected(),onChange:()=>N&&f.toggleSelected(!0),disabled:x||!N,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:pe==="multiple"?40:30};if(U){let f=ro;f<0&&(f=i.length+f+1),f=Math.max(0,Math.min(f,i.length)),i.splice(f,0,r)}if(ae){let f={id:"serialNumber",header:"No.",cell:({row:x})=>s("div",{className:"font-medium text-center text-muted-foreground",children:x.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};i.unshift(f)}return i},[t,ae,U,st,Y,y,pe,ro]),w=qn({data:Mt,columns:De,onSortingChange:kt?He:void 0,onColumnFiltersChange:Rt?Pe:void 0,onGlobalFilterChange:oo?ue:void 0,getCoreRowModel:Gn(),getPaginationRowModel:u.enabled?Un():void 0,getSortedRowModel:kt?$n():void 0,getFilteredRowModel:Rt?jn():void 0,onColumnVisibilityChange:zt?Pt:void 0,onRowSelectionChange:U?Dt:void 0,onColumnOrderChange:Tt,onColumnPinningChange:B?nt:void 0,state:{sorting:kt?Be:void 0,columnFilters:Rt?tt:void 0,columnVisibility:zt?Le:void 0,rowSelection:U?ot:{},globalFilter:ne,columnOrder:Oe,columnPinning:B?Ee:{}},initialState:{pagination:u.enabled?{pageSize:u.pageSize||10}:void 0,columnPinning:B?{left:[...ae?["serialNumber"]:[],...U?["select"]:[]],right:[]}:void 0},enableRowSelection:U,enableColumnResizing:ao,enableColumnPinning:B,columnResizeMode:"onChange"}),io=yt(()=>{if(!oe||Object.keys(oe).length===0)return{};let d={},g=w.getFilteredRowModel().rows;return Object.entries(oe).forEach(([i,r])=>{if(!r?.enabled)return;let f=g.map(N=>{if(r.accessor)return r.accessor(N.original);{let T=N.getValue(i);return typeof T=="number"?T:parseFloat(String(T))||0}}).filter(N=>N!==null&&!isNaN(N)),x={};r.functions?.forEach(N=>{Vo[N]&&(x[N]=Vo[N](f))}),Object.keys(x).length>0&&(d[i]=x)}),d},[Mt,oe,w?.getFilteredRowModel().rows]);Ct(()=>{if(U&&Q){let d=w.getFilteredSelectedRowModel().rows.filter(g=>!Y?.(g.original)&&(y?y(g.original):!0)).map(g=>g.original);Q(d)}},[ot,U,Q,w,Y,y]);let Yo=xt(d=>{pe==="single"?(w.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[pe,w]);Ct(()=>{X&&X(w)},[w,X]);let Zo=xt(()=>{He([])},[]),en=xt(()=>{Pe([]),ue("")},[]),so=(d,g)=>{if(!B)return;let i=[...ae?["serialNumber"]:[],...U&&st?["select"]:[]],r={left:[...(Ee.left??[]).filter(f=>i.includes(f))],right:[...Ee.right??[]]};g===!1?(r.left=r.left.filter(f=>f!==d),r.right=r.right.filter(f=>f!==d)):g==="right"?(r.left=r.left.filter(f=>f!==d),r.right.includes(d)||r.right.push(d)):g==="left"&&(r.right=r.right.filter(f=>f!==d),!r.left.includes(d)&&!i.includes(d)&&r.left.push(d)),w.setColumnPinning(r)},tn=()=>{let d=Object.keys(io).length>0,g=w.getHeaderGroups()[0]?.headers.some(r=>r.column.columnDef.customFooter),i=ae&&w.getFilteredRowModel().rows.length>0&&(d||g);return!d&&!g&&!i?null:s(Vt,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:s(de,{className:"hover:bg-transparent bg-sidebar",children:w.getHeaderGroups()[0]?.headers.map((r,f)=>{let x=r.column.id,N=io[x],T=B&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&U),z=B&&r.column.getIsPinned()==="right",F=r.column.id==="serialNumber",ge=r.column.id==="select",_=r.column.columnDef.customFooter;return N||_||F&&i?s(ce,{className:n("font-semibold text-sm py-2 px-2 border-r",Ue&&"py-1",T&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(F||ge)&&"sticky left-0 z-30 bg-sidebar/95",_?.className),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...T&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...z&&{right:dt(r.column)},...F&&{left:0}},children:(()=>{if(_?.content){let ye=typeof _.content=="function"?_.content(w):_.content;return s("div",{className:n("w-full h-full",_.align==="center"&&"text-center",_.align==="right"&&"text-right",_.align==="left"&&"text-left"),children:ye})}return N?s("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(N).map(([ye,sn])=>D("div",{className:"flex items-center justify-between text-muted-foreground",children:[D("span",{className:"text-xs capitalize",children:[ye,":"]}),s("span",{className:"font-medium text-foreground",children:on(ye,sn)})]},ye))}):F&&i?D("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",w.getFilteredRowModel().rows.length]}):null})()},`agg-${r.id}`):s(ce,{className:n("py-0 px-0 border-r",Ue&&"py-0",T&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(F||ge)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...T&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...z&&{right:dt(r.column)},...F&&{left:0}}},`agg-${r.id}`)})})})},on=(d,g)=>typeof g=="number"?d==="count"||d==="unique"?g.toLocaleString():g.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):g,nn=()=>w.getHeaderGroups().map((d,g)=>s(de,{className:"hover:bg-transparent",children:d.headers.map((i,r)=>{let f=i.depth===0&&i.colSpan>1,x=B&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&U),N=B&&i.column.getIsPinned()==="right",T=i.column.getCanSort(),z=B&&i.column.columnDef.enablePinning!==!1,F=i.column.id==="serialNumber",ge=i.column.id==="select",Ft=F||ge&&st,_=i.column.columnDef.headerAlign||"left",ct=oe&&oe[i.column.id]?.enabled,ye={left:"justify-start",center:"justify-center",right:"justify-end"}[_];return D(mo,{colSpan:i.colSpan,className:n("font-semibold text-foreground bg-sidebar group px-0",!Ue&&"py-2",no&&r<d.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-25 bg-sidebar",N&&"sticky right-0 z-25 bg-sidebar",(F||ge)&&"sticky left-0 z-25 bg-sidebar",f?"text-center":"text-left",ct&&"border-b-2 border-primary/30"),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...x&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(i.column)},...N&&{right:dt(i.column)},...F&&{left:0}},children:[f?D("div",{className:"flex items-center justify-center",children:[Qt(i.column.columnDef.header,i.getContext()),ct&&s(_o,{className:"w-3 h-3 ml-1 text-primary"})]}):D("div",{className:n("relative flex items-center w-full px-2",ye),children:[D("div",{className:"flex items-center gap-1",children:[ct&&s(_o,{className:"w-3 h-3 mr-1 text-primary"}),T&&_==="right"&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(Yt,{className:"w-4 h-4"}),desc:s(Zt,{className:"w-4 h-4"})}[i.column.getIsSorted()]}),i.isPlaceholder?null:Qt(i.column.columnDef.header,i.getContext()),T&&_!=="right"&&i.column.getIsSorted()&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(Yt,{className:"w-4 h-4"}),desc:s(Zt,{className:"w-4 h-4"})}[i.column.getIsSorted()]})]}),(T||z&&!Ft)&&D(re,{children:[s(ie,{asChild:!0,className:n("absolute",_==="left"&&"right-1",_==="center"&&"right-1",_==="right"&&"left-1"),children:s(Io,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:s(Xn,{className:"w-4 h-4"})})}),D(se,{align:"end",className:"w-48",children:[T&&D(Ao,{children:[s(q,{children:"Sorting"}),D(V,{onClick:()=>i.column.toggleSorting(!1),children:[s(Yt,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),D(V,{onClick:()=>i.column.toggleSorting(!0),children:[s(Zt,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),D(V,{onClick:()=>i.column.clearSorting(),disabled:!i.column.getIsSorted(),children:[s(Wn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),s(K,{})]}),z&&!Ft&&D(Ao,{children:[s(q,{children:"Pin Column"}),D(V,{onClick:()=>so(i.column.id,"right"),disabled:i.column.getIsPinned()==="right",children:[s(Kn,{}),"Pin Right"]}),D(V,{onClick:()=>so(i.column.id,!1),disabled:!i.column.getIsPinned(),children:[s(Jn,{}),"Unpin"]})]})]})]})]}),ao&&i.column.getCanResize()&&!f&&i.colSpan===1&&s("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:i.getResizeHandler()})]},i.id)})},d.id)),lt=d=>{if(!B)return;let g=0,i=w.getLeftHeaderGroups()[0]?.headers||[],r=[...ae?["serialNumber"]:[],...U?["select"]:[]];for(let f of i){if(f.id===d.id)break;if(r.includes(f.id)){let x=w.getColumn(f.id);x&&(g+=x.getSize())}}return g},dt=d=>{if(!B)return;let g=w.getState().columnPinning.right||[],i=g.indexOf(d.id);if(i===-1)return;let r=0;for(let f=i+1;f<g.length;f++){let x=w.getColumn(g[f]);x&&(r+=x.getSize())}return r};if(R)return s(At,{className:"w-full shadow-sm rounded-xl",children:s(Bt,{className:"flex items-center justify-center",children:D("div",{className:"text-center",children:[s("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),s("p",{className:"mb-4 text-sm text-muted-foreground",children:R}),te&&D(C,{variant:"outline",size:"sm",onClick:te,className:"rounded-lg",children:[s(Fo,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let an=d=>d&&typeof d=="object"&&"content"in d,Z=yt(()=>m?an(m)?{content:m.content,align:m.align||"left",className:m.className||"",sticky:m.sticky!==void 0?m.sticky:!0,showOnEmpty:m.showOnEmpty!==void 0?m.showOnEmpty:!0}:{content:m,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[m]),It=()=>je?s(Xt,{table:w,filters:a,globalFilter:ne,onGlobalFilterChange:ue,enableGlobalFilter:oo,onExport:me,onRefresh:te,loading:P,enableColumnVisibility:zt,enableColumnPinning:B,data:Mt,onClearSorting:Zo,onClearFilters:en,onExternalSearch:Ae,onCustomFilterChange:Qo,aggregations:oe,onAggregationChange:Ze}):null,rn=()=>{let d=0;return Ce==="above-header"&&(d+=rt),Z&&(d+=to),Ce==="below-header"&&(d+=Oo),d};return s($e,{children:D("div",{className:n("w-full space-y-2 flex flex-col h-full",I),children:[je&&Ce==="default"&&s("div",{ref:le,className:"relative z-40",children:It()}),s(At,{className:n("shadow-sm overflow-hidden py-0",Wo&&"flex-1"),children:s(Bt,{className:"h-full p-0",children:D("div",{className:"relative flex flex-col justify-between h-full",children:[P&&s("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:D("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[s(Fo,{className:"size-5 animate-spin text-primary"}),s("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),s("div",{ref:it,className:n("relative overflow-auto border-b rounded-t-xl",w.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:h},children:D(_t,{className:n("w-full border-collapse relative",w.getRowModel().rows?.length===0&&"h-full"),children:[je&&Ce==="above-header"&&s("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:"p-2 bg-sidebar border-b shadow-sm",children:s("div",{ref:o,children:It()})})})}),Z&&(Z.showOnEmpty||w.getRowModel().rows?.length>0)&&s("thead",{className:n("sticky bg-sidebar border-b",St&&"shadow-sm"),style:{top:Ce==="above-header"?`${rt}px`:"0px",zIndex:35},children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:n("p-2 font-semibold text-foreground bg-sidebar",Ue?"py-2":"py-4",Z.className),children:s("div",{ref:p,className:n("flex items-center w-full",Z.align==="center"&&"justify-center",Z.align==="right"&&"justify-end",Z.align==="left"&&"justify-start"),children:typeof Z.content=="string"?s("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Z.content}):Z.content})})})}),je&&Ce==="below-header"&&s("thead",{className:n("sticky bg-sidebar border-b",St&&"shadow-sm"),style:{top:Z?`${to}px`:"0px",zIndex:35},children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:"p-2 bg-sidebar",children:s("div",{ref:c,children:It()})})})}),!Xo&&s(lo,{className:n("sticky bg-sidebar",St&&"shadow-sm"),style:{top:`${rn()}px`,zIndex:30},children:nn()}),s(co,{children:w.getRowModel().rows?.length?w.getRowModel().rows.map((d,g)=>{let i=et?et(d):"";return s(de,{"data-state":d.getIsSelected()&&"selected",className:n(qo&&"hover:bg-muted/50",$o&&g%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",pe==="single"&&"cursor-pointer",i),onClick:()=>{pe==="single"&&Yo(d)},children:d.getVisibleCells().map((r,f)=>{let x=B&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&U),N=B&&r.column.getIsPinned()==="right",T=r.column.id==="serialNumber",z=r.column.id==="select",F=T||z&&st;return s(ce,{className:n(Ue?"py-2":"py-4",no&&f<d.getVisibleCells().length&&"border-r",x&&"sticky left-0 z-20 bg-sidebar/95",N&&"sticky right-0 z-20 bg-sidebar/95",T&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:r.column.getSize()!==150?r.column.getSize():"auto",minWidth:r.column.getSize()!==150?r.column.getSize():"auto",...x&&{left:T?0:z?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...N&&{right:dt(r.column)},...T&&{left:0}},children:Qt(r.column.columnDef.cell,r.getContext())},r.id)})},d.id)}):s(de,{children:s(ce,{colSpan:De.length,className:"h-32 text-center border-0",children:D("div",{className:"flex flex-col items-center gap-3",children:[s("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),s("p",{className:"font-medium text-muted-foreground",children:L})]})})})}),tn()]})}),k&&s("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:s(_t,{children:s(Vt,{children:s(de,{className:"bg-sidebar",children:s(ce,{colSpan:De.length,className:"p-2",children:k})})})})})]})})}),s(Jt,{table:w,config:u}),G&&G(w)]})})}import{Separator as Yn}from"radix-ui";import{jsx as Zn}from"react/jsx-runtime";function wt({className:e,orientation:t="horizontal",decorative:a=!0,...u}){return Zn(Yn.Root,{"data-slot":"separator-root",decorative:a,orientation:t,className:n("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...u})}import{Loader as ea,X as ta}from"lucide-react";import{AnimatePresence as oa,motion as na}from"framer-motion";import*as he from"react";import*as Bo from"react-dom";import{jsx as H,jsxs as Qe}from"react/jsx-runtime";function aa({table:e,visible:t,container:a,children:u,className:v,...m}){let[k,I]=he.useState(!1);he.useLayoutEffect(()=>{I(!0)},[]),he.useEffect(()=>{function R(L){L.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e]);let h=a??(k?globalThis.document?.body:null);if(!h||!e)return null;let P=t??e.getFilteredSelectedRowModel().rows.length>0;return Bo.createPortal(H(oa,{children:P&&H(na.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:n("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",v),...m,children:H($e,{children:u})})}),h)}function ra({size:e="sm",tooltip:t,isPending:a,disabled:u,className:v,children:m,...k}){let I=H(C,{variant:"secondary",size:e,className:n("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",v),disabled:u||a,...k,children:a?H(ea,{className:"animate-spin"}):m});return t?Qe(Ht,{children:[H(Lt,{asChild:!0,children:I}),H(Ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:H("p",{children:t})})]}):I}function ia({table:e}){let t=he.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Qe("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Qe("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),H(wt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Qe(Ht,{children:[H(Lt,{asChild:!0,children:H(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:H(ta,{className:"size-3.5"})})}),Qe(Ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[H("p",{children:"Clear selection"}),H("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:H("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as Ye,EyeOff as sa}from"lucide-react";import{jsx as ee,jsxs as _e}from"react/jsx-runtime";function la({column:e,title:t,className:a}){return e.getCanSort()?ee("div",{className:n("flex items-center space-x-2",a),children:_e(re,{children:[ee(ie,{asChild:!0,children:_e(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[ee("span",{children:t}),e.getIsSorted()==="desc"?ee(Ye,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?ee(Ye,{className:"ml-2 h-4 w-4"}):ee(Ye,{className:"ml-2 h-4 w-4"})]})}),_e(se,{align:"start",className:"rounded-lg",children:[_e(V,{onClick:()=>e.toggleSorting(!1),children:[ee(Ye,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),_e(V,{onClick:()=>e.toggleSorting(!0),children:[ee(Ye,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),ee(K,{}),_e(V,{onClick:()=>e.toggleVisibility(!1),children:[ee(sa,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):ee("div",{className:n(a),children:t})}import{ChevronDown as da,Eye as ca}from"lucide-react";import{jsx as Ve,jsxs as eo}from"react/jsx-runtime";function ma({table:e}){return eo(re,{children:[Ve(ie,{asChild:!0,children:eo(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[Ve(ca,{className:"mr-2 h-4 w-4"}),"Columns ",Ve(da,{className:"ml-2 h-4 w-4"})]})}),eo(se,{align:"end",className:"w-[200px] rounded-lg",children:[Ve(q,{children:"Toggle Columns"}),Ve(K,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>Ve(Re,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:a=>t.toggleVisibility(!!a),children:t.id},t.id))]})]})}import{Slot as ua}from"radix-ui";import{cva as pa}from"class-variance-authority";import{jsx as fa}from"react/jsx-runtime";var ga=pa("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Nt({className:e,variant:t,asChild:a=!1,...u}){let v=a?ua.Slot:"span";return fa(v,{"data-slot":"badge",className:n(ga({variant:t}),e),...u})}import{CheckIcon as ba,PlusCircleIcon as va}from"lucide-react";import{Fragment as Ho,jsx as M,jsxs as xe}from"react/jsx-runtime";function ha({column:e,title:t,options:a}){let u=e?.getFacetedUniqueValues(),v=new Set(e?.getFilterValue());return xe(ze,{children:[M(Me,{asChild:!0,children:xe(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(va,{className:"mr-2 h-4 w-4"}),t,v?.size>0&&xe(Ho,{children:[M(wt,{orientation:"vertical",className:"mx-2 h-4"}),M(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:v.size}),M("div",{className:"hidden space-x-1 lg:flex",children:v.size>2?xe(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[v.size," selected"]}):a.filter(m=>v.has(m.value)).map(m=>M(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:m.label},m.value))})]})]})}),M(Ie,{className:"w-[200px] p-0 rounded-lg",align:"start",children:xe(ut,{className:"rounded-lg",children:[M(pt,{placeholder:t}),xe(gt,{children:[M(ft,{children:"No results found."}),M(qe,{children:a.map(m=>{let k=v.has(m.value);return xe(ke,{onSelect:()=>{k?v.delete(m.value):v.add(m.value);let I=Array.from(v);e?.setFilterValue(I.length?I:void 0)},children:[M("div",{className:n("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(ba,{className:n("h-4 w-4")})}),m.icon&&M(m.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:m.label}),u?.get(m.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:u.get(m.value)})]},m.value)})}),v.size>0&&xe(Ho,{children:[M(po,{}),M(qe,{children:M(ke,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{Qn as DataTable,aa as DataTableActionBar,ra as DataTableActionBarAction,ia as DataTableActionBarSelection,la as DataTableColumnHeader,ha as DataTableFacetedFilter,Jt as DataTablePagination,Xt as DataTableToolbar,ma as DataTableViewOptions};
2
+ import{flexRender as ao,getCoreRowModel as jn,getFilteredRowModel as Un,getPaginationRowModel as $n,getSortedRowModel as qn,useReactTable as Wn}from"@tanstack/react-table";import{Loader2 as Lo,ChevronUp as ro,ChevronDown as io,ChevronsUpDown as Xn,MoreHorizontal as Kn,MoveRightIcon as Jn,PinOffIcon as Qn,Calculator as Oo}from"lucide-react";import{Slot as mn}from"radix-ui";import{cva as un}from"class-variance-authority";import{clsx as dn}from"clsx";import{twMerge as cn}from"tailwind-merge";function n(...e){return cn(dn(e))}import{jsx as pn}from"react/jsx-runtime";var gt=un("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:o,size:a,asChild:u=!1,...v}){let m=u?mn.Slot:"button";return pn(m,{"data-slot":"button",className:n(gt({variant:o,size:a,className:e}),"transition-none"),...v})}import{jsx as fe}from"react/jsx-runtime";function Gt({className:e,...o}){return fe("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:fe("table",{"data-slot":"table",className:n("w-full caption-bottom text-sm",e),...o})})}function bo({className:e,...o}){return fe("thead",{"data-slot":"table-header",className:n("[&_tr]:border-b",e),...o})}function vo({className:e,...o}){return fe("tbody",{"data-slot":"table-body",className:n("[&_tr:last-child]:border-0",e),...o})}function jt({className:e,...o}){return fe("tfoot",{"data-slot":"table-footer",className:n("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...o})}function le({className:e,...o}){return fe("tr",{"data-slot":"table-row",className:n("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...o})}function ho({className:e,...o}){return fe("th",{"data-slot":"table-head",className:n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...o})}function de({className:e,...o}){return fe("td",{"data-slot":"table-cell",className:n("p-2 align-middle whitespace-nowrap",e),...o})}import{jsx as xo}from"react/jsx-runtime";function Ut({className:e,...o}){return xo("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...o})}function $t({className:e,...o}){return xo("div",{"data-slot":"card-content",className:n("px-6",e),...o})}import{Tooltip as _e}from"radix-ui";import{jsx as Ve,jsxs as gn}from"react/jsx-runtime";function Ye({delayDuration:e=0,...o}){return Ve(_e.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...o})}function qt({...e}){return Ve(Ye,{children:Ve(_e.Root,{"data-slot":"tooltip",...e})})}function Wt({...e}){return Ve(_e.Trigger,{"data-slot":"tooltip-trigger",...e})}function Xt({className:e,sideOffset:o=0,children:a,...u}){return Ve(_e.Portal,{children:gn(_e.Content,{"data-slot":"tooltip-content",sideOffset:o,className:n("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...u,children:[a,Ve(_e.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as Ro,RefreshCw as kn,Download as Rn,Settings2 as zn,Filter as zo,ArrowUpDown as Mn,PinOff as In,Pin as Fn,ChevronDown as wt,Calculator as Zt,Check as eo}from"lucide-react";import{jsx as fn}from"react/jsx-runtime";function Kt({className:e,type:o,...a}){return fn("input",{type:o,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}import{Command as Se}from"cmdk";import{SearchIcon as bn}from"lucide-react";import{Dialog as ja}from"radix-ui";import{XIcon as $a}from"lucide-react";import{jsx as Xa,jsxs as Ka}from"react/jsx-runtime";import{jsx as be,jsxs as vn}from"react/jsx-runtime";function ft({className:e,...o}){return be(Se,{"data-slot":"command",className:n("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...o})}function bt({className:e,...o}){return vn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[be(bn,{className:"size-4 shrink-0 opacity-50"}),be(Se.Input,{"data-slot":"command-input",className:n("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...o})]})}function vt({className:e,...o}){return be(Se.List,{"data-slot":"command-list",className:n("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...o})}function ht({...e}){return be(Se.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Ze({className:e,...o}){return be(Se.Group,{"data-slot":"command-group",className:n("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...o})}function Co({className:e,...o}){return be(Se.Separator,{"data-slot":"command-separator",className:n("bg-border -mx-1 h-px",e),...o})}function Ae({className:e,...o}){return be(Se.Item,{"data-slot":"command-item",className:n("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}import{DropdownMenu as q}from"radix-ui";import{CheckIcon as hn,ChevronRightIcon as xn,CircleIcon as cr}from"lucide-react";import{jsx as G,jsxs as Po}from"react/jsx-runtime";function ee({...e}){return G(q.Root,{"data-slot":"dropdown-menu",...e})}function te({...e}){return G(q.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function oe({className:e,sideOffset:o=4,...a}){return G(q.Portal,{children:G(q.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...a})})}function Jt({...e}){return G(q.Group,{"data-slot":"dropdown-menu-group",...e})}function I({className:e,inset:o,variant:a="default",...u}){return G(q.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:n("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...u})}function Be({className:e,children:o,checked:a,...u}){return Po(q.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:n("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...u,children:[G("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:G(q.ItemIndicator,{children:G(hn,{className:"size-4"})})}),o]})}function W({className:e,inset:o,...a}){return G(q.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function J({className:e,...o}){return G(q.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...o})}function yo({...e}){return G(q.Sub,{"data-slot":"dropdown-menu-sub",...e})}function wo({className:e,inset:o,children:a,...u}){return Po(q.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:n("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...u,children:[a,G(xn,{className:"ml-auto size-4"})]})}function No({className:e,...o}){return G(q.SubContent,{"data-slot":"dropdown-menu-sub-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...o})}import{useState as Nt}from"react";import{useEffect as Dn,useState as Qt}from"react";import{Calendar as Tn}from"lucide-react";import{format as et}from"date-fns";import{Popover as xt}from"radix-ui";import{jsx as Ct}from"react/jsx-runtime";function He({...e}){return Ct(xt.Root,{"data-slot":"popover",...e})}function Le({...e}){return Ct(xt.Trigger,{"data-slot":"popover-trigger",...e})}function Oe({className:e,align:o="center",sideOffset:a=4,...u}){return Ct(xt.Portal,{children:Ct(xt.Content,{"data-slot":"popover-content",align:o,sideOffset:a,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...u})})}import*as yt from"react";import{ChevronDownIcon as Cn,ChevronLeftIcon as yn,ChevronRightIcon as wn}from"lucide-react";import{DayPicker as Nn,getDefaultClassNames as Do}from"react-day-picker";import{jsx as ve}from"react/jsx-runtime";function To({className:e,classNames:o,showOutsideDays:a=!0,captionLayout:u="label",buttonVariant:v="ghost",formatters:m,components:k,...F}){let h=Do();return ve(Nn,{showOutsideDays:a,className:n("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:u,formatters:{formatMonthDropdown:D=>D.toLocaleString("default",{month:"short"}),...m},classNames:{root:n("w-fit",h.root),months:n("flex gap-4 flex-col md:flex-row relative",h.months),month:n("flex flex-col w-full gap-4",h.month),nav:n("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",h.nav),button_previous:n(gt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_previous),button_next:n(gt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_next),month_caption:n("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",h.month_caption),dropdowns:n("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",h.dropdowns),dropdown_root:n("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",h.dropdown_root),dropdown:n("absolute bg-popover inset-0 opacity-0",h.dropdown),caption_label:n("select-none font-medium",u==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",h.caption_label),table:"w-full border-collapse",weekdays:n("flex",h.weekdays),weekday:n("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",h.weekday),week:n("flex w-full mt-2",h.week),week_number_header:n("select-none w-(--cell-size)",h.week_number_header),week_number:n("text-[0.8rem] select-none text-muted-foreground",h.week_number),day:n("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",h.day),range_start:n("rounded-l-md bg-accent",h.range_start),range_middle:n("rounded-none",h.range_middle),range_end:n("rounded-r-md bg-accent",h.range_end),today:n("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",h.today),outside:n("text-muted-foreground aria-selected:text-muted-foreground",h.outside),disabled:n("text-muted-foreground opacity-50",h.disabled),hidden:n("invisible",h.hidden),...o},components:{Root:({className:D,rootRef:R,...O})=>ve("div",{"data-slot":"calendar",ref:R,className:n(D),...O}),Chevron:({className:D,orientation:R,...O})=>R==="left"?ve(yn,{className:n("size-4",D),...O}):R==="right"?ve(wn,{className:n("size-4",D),...O}):ve(Cn,{className:n("size-4",D),...O}),DayButton:Pn,WeekNumber:({children:D,...R})=>ve("td",{...R,children:ve("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:D})}),...k},...F})}function Pn({className:e,day:o,modifiers:a,...u}){let v=Do(),m=yt.useRef(null);return yt.useEffect(()=>{a.focused&&m.current?.focus()},[a.focused]),ve(C,{ref:m,variant:"ghost",size:"icon","data-day":o.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:n("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",v.day,e),...u})}import{jsx as ke,jsxs as tt}from"react/jsx-runtime";function So({value:e,onChange:o,placeholder:a,mode:u,externalSearch:v,onExternalChange:m,onlyExternal:k=!1}){let[F,h]=Qt(!1),[D,R]=Qt(e),[O,Y]=Qt(e);Dn(()=>{k||Y(e)},[e,k]);let ce=()=>{k||o(D),Y(D),v&&m&&m(D),h(!1)},ae=()=>{R(O),h(!1)},K=()=>{let w=u==="single"?null:{from:null,to:null};R(w),k||o(w),Y(w),v&&m&&m(w),h(!1)},U=()=>{let w=k?O:e;return w?u==="single"?et(w,"PPP"):w.from&&w.to?`${et(w.from,"MMM dd")} - ${et(w.to,"MMM dd, yyyy")}`:w.from?`From ${et(w.from,"MMM dd, yyyy")}`:w.to?`To ${et(w.to,"MMM dd, yyyy")}`:a:a},E=w=>{R(u==="single"?w:w||{from:null,to:null})};return tt(He,{open:F,onOpenChange:h,children:[ke(Le,{className:"h-8",asChild:!0,children:tt(C,{variant:"outline",className:n("w-full justify-start text-left font-normal h-9",!U()&&"text-muted-foreground"),children:[ke(Tn,{className:"mr-2 h-4 w-4"}),U()]})}),tt(Oe,{className:"w-auto p-0",align:"start",children:[ke("div",{className:"p-3",children:ke(To,{mode:u,selected:D,onSelect:E,numberOfMonths:u==="range"?2:1,className:"rounded-md border",...u==="range"&&{required:!0}})}),tt("div",{className:"flex items-center justify-between p-3 border-t",children:[ke(C,{variant:"ghost",size:"sm",onClick:K,children:"Clear"}),tt("div",{className:"flex gap-2",children:[ke(C,{variant:"outline",size:"sm",onClick:ae,children:"Cancel"}),ke(C,{size:"sm",onClick:ce,disabled:u==="range"&&(!D?.from||!D?.to),children:"Apply"})]})]})]})]})}import{Checkbox as ko}from"radix-ui";import{CheckIcon as Sn}from"lucide-react";import{jsx as Yt}from"react/jsx-runtime";function ot({className:e,...o}){return Yt(ko.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...o,children:Yt(ko.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Yt(Sn,{className:"size-3.5"})})})}import{Fragment as _n,jsx as l,jsxs as b}from"react/jsx-runtime";var Mo=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function to({table:e,filters:o=[],globalFilter:a,onGlobalFilterChange:u,enableGlobalFilter:v=!0,onExport:m,onRefresh:k,loading:F=!1,enableColumnVisibility:h=!0,data:D,onClearSorting:R,onClearFilters:O,enableColumnPinning:Y=!1,onExternalSearch:ce,onCustomFilterChange:ae,aggregations:K={},onAggregationChange:U,enableGroupedGlobalFilter:E=!1,groupedFilterLabel:w="Search in",onGroupedFilterChange:Re}){let[re,it]=Nt({}),[ze,st]=Nt({}),[Ue,Rt]=Nt({}),[Ce,zt]=Nt("all"),$e=()=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1),qe=()=>e.getAllColumns().filter(t=>!e.getAllLeafColumns().includes(t)&&t.columns?.length&&t.columns.some(c=>c.getCanHide?.()!==!1)),lt=()=>{let t=new Set(qe().flatMap(c=>c.columns?.filter(f=>f.getCanHide?.()!==!1).map(f=>f.id)||[]));return $e().filter(c=>!t.has(c.id))},Me=(t,c)=>c&&t.startsWith(`${c}.`)?t.replace(`${c}.`,"").split("_").map(P=>P.slice(1)).join(" "):t.split("_").map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" "),ye=(t,c)=>{let f={...re,[t]:c};it(f)},Mt=(t,c)=>{let f={...ze,[t]:c};st(f),ae&&ae(t,c),o.find(P=>P.key===t)?.externalSearch&&ye(t,c)},It=()=>{ce&&ce(re)},We=()=>{it({}),st({}),O(),ce&&ce({}),ae&&Object.keys(ze).forEach(t=>{ae(t,"")})},se=t=>o.find(f=>f.key===t)?.customFilter?ze[t]??"":e.getColumn(t)?.getFilterValue(),me=(t,c)=>{let f=o.find(P=>P.key===t);f?.customFilter?Mt(t,c):(e.getColumn(t)?.setFilterValue(c),f?.externalSearch&&ye(t,c))},Xe=(t,c)=>{Rt(f=>({...f,[t]:c}))},we=t=>{if(U){let c=K[t],f={enabled:!c?.enabled,functions:c?.functions||["sum","average"]};U(t,f)}},Ne=(t,c)=>{if(U){let P=K[t]?.functions||[],B=P.includes(c)?P.filter(_t=>_t!==c):[...P,c];U(t,{enabled:B.length>0,functions:B})}},ue=()=>{U&&Object.keys(K).forEach(t=>{let c=K[t];c&&U(t,{...c,enabled:!1,functions:[]})})},Pe=()=>$e().filter(t=>t.id==="select"||t.id==="serialNumber"?!1:t.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(P=>{let B=P.getValue(t.id);return typeof B=="number"||typeof B=="string"&&!isNaN(parseFloat(String(B)))||typeof B=="object"&&B!==null&&"props"in B})),lo=t=>{zt(t),Re&&Re(t,a)},Ft=t=>{u(t),Re&&E&&Re(Ce,t)},Ie=Pe(),Ke=Object.values(K).some(t=>t?.enabled),dt=[{value:"all",label:"All Fields"},...o.map(t=>({value:t.key,label:t.placeholder}))];return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:b("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:o.length>0&&b("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(zo,{className:"size-4"})}),o.map(t=>!e.getColumn(t.key)&&!t.customFilter&&!t.externalSearch?null:l("div",{className:n("relative min-w-[150px]",t.width),children:t.type==="select"?b(He,{open:Ue[t.key],onOpenChange:f=>Xe(t.key,f),children:[l(Le,{asChild:!0,children:b("div",{className:"relative w-full",children:[t.icon&&l(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),b(C,{variant:"outline",role:"combobox","aria-expanded":Ue[t.key],className:n("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!se(t.key)&&"text-muted-foreground"),children:[l("span",{className:n("truncate",t.icon&&"pl-6"),children:se(t.key)?t.options?.find(f=>f.value===se(t.key))?.label:t.placeholder}),l(wt,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),l(Oe,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:b(ft,{className:"rounded-lg",children:[l(bt,{placeholder:`Search ${t.placeholder?.toLowerCase()}...`}),b(vt,{children:[l(ht,{children:"No option found."}),b(Ze,{children:[b(Ae,{value:"all",onSelect:()=>{me(t.key,""),Xe(t.key,!1)},className:"flex items-center cursor-pointer",children:[l(eo,{className:n("mr-2 size-4 shrink-0",se(t.key)?"opacity-0":"opacity-100")}),l("span",{children:"All"})]}),t.options?.map(f=>b(Ae,{value:f.label,onSelect:()=>{me(t.key,f.value),Xe(t.key,!1)},className:"flex items-center cursor-pointer",children:[l(eo,{className:n("mr-2 size-4 shrink-0",se(t.key)===f.value?"opacity-100":"opacity-0")}),l("span",{children:f.label})]},f.label))]})]})]})})]}):t.type==="date"?l(So,{value:se(t.key),onChange:f=>{t.onlyExternal||me(t.key,f)},placeholder:t.placeholder,mode:t.dateMode||"single",externalSearch:t.externalSearch,onlyExternal:t.onlyExternal,onExternalChange:f=>ye(t.key,f)}):b("div",{className:"relative",children:[t.icon&&l(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Kt,{placeholder:t.placeholder,value:se(t.key)??"",onChange:f=>{me(t.key,f.target.value)},className:n("h-8 rounded-lg",t.icon&&"pl-9"),type:t.type==="number"?"number":"text"})]})},t.key)),(o.some(t=>t.externalSearch)||o.some(t=>t.customFilter))&&b(C,{variant:"default",size:"sm",onClick:It,className:"rounded-lg h-7",children:[l(Ro,{className:"size-4"}),o.find(t=>t.externalSearch||t.customFilter)?.searchButtonText||"Search"]})]})}),b("div",{className:"flex items-center gap-2",children:[v&&b("div",{className:n("flex items-center",E?"bg-background border rounded-lg":""),children:[E&&b(ee,{children:[l(te,{asChild:!0,children:b(C,{variant:"ghost",size:"sm",className:"gap-1 border-0 border-r rounded-r-none hover:bg-transparent",children:[l("span",{className:"text-sm font-medium",children:w}),l(wt,{className:"opacity-50 size-4"})]})}),l(oe,{align:"end",className:"w-48 rounded-lg",children:dt.map(t=>b(I,{onClick:()=>lo(t.value),className:"flex items-center justify-between",children:[l("span",{children:t.label}),Ce===t.value&&l(eo,{className:"size-4 text-primary"})]},t.value))})]}),b("div",{className:"relative flex-1",children:[l(Ro,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Kt,{placeholder:E&&Ce!=="all"?`Search in ${dt.find(t=>t.value===Ce)?.label}...`:"Global search...",value:a??"",onChange:t=>Ft(t.target.value),className:n("pl-9 h-8 max-w-max",E&&"border-0 rounded-l-none")})]})]}),Ie.length>0&&U&&b(ee,{children:[l(te,{asChild:!0,children:b(C,{variant:"outline",size:"sm",className:n("rounded-lg gap-1",Ke&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(Zt,{className:"size-4"}),l("span",{children:"Aggregations"}),l(wt,{className:"opacity-50 size-4"})]})}),b(oe,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[b(W,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),Ke&&l(C,{variant:"ghost",size:"sm",onClick:ue,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(J,{}),Ie.map(t=>{let c=K[t.id],f=c?.enabled;return b(yo,{children:[l(wo,{className:"text-sm",children:b("div",{className:"flex items-center w-full gap-2",children:[l(ot,{checked:f,onCheckedChange:()=>we(t.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:n("flex-1",f&&"font-medium text-primary"),children:Me(t.id)}),f&&b("div",{className:"flex items-center gap-1",children:[c?.functions?.slice(0,2).map(P=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:Mo.find(B=>B.value===P)?.label},P)),c?.functions&&c.functions.length>2&&b("div",{className:"text-xs text-muted-foreground",children:["+",c.functions.length-2]})]})]})}),b(No,{className:"w-48 rounded-lg",children:[l(W,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),Mo.map(P=>l(Be,{checked:c?.functions?.includes(P.value)||!1,onCheckedChange:()=>Ne(t.id,P.value),className:"py-2 text-sm",children:b("div",{className:"flex flex-col",children:[l("span",{children:P.label}),l("span",{className:"text-xs text-muted-foreground",children:P.description})]})},P.value))]})]},t.id)}),Ie.length===0&&b("div",{className:"px-3 py-4 text-center",children:[l(Zt,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),m&&b(C,{variant:"outline",size:"sm",onClick:()=>m(D),className:"rounded-lg",children:[l(Rn,{className:"size-4"}),"Export"]}),h&&b(ee,{children:[l(te,{asChild:!0,className:"h-7",children:b(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l(wt,{className:"opacity-50 size-4"})]})}),b(oe,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l(W,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(J,{}),lt().length>0&&b(Jt,{children:[l(W,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),lt().map(t=>l(Be,{className:"text-sm",checked:t.getIsVisible(),onCheckedChange:c=>t.toggleVisibility(!!c),children:Me(t.id)},t.id))]}),qe().map(t=>b(Jt,{children:[l(J,{}),l(W,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:t.id}),t.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>l(Be,{className:"text-sm",checked:c.getIsVisible(),onCheckedChange:f=>c.toggleVisibility(!!f),children:Me(c.id,t.id)},c.id))]},t.id))]})]}),b(ee,{children:[l(te,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(zn,{className:"size-4"})})}),b(oe,{align:"end",className:"w-[200px] rounded-lg",children:[l(W,{children:"Table Settings"}),l(J,{}),b(I,{onClick:R,children:[l(Mn,{className:"size-4"}),"Clear All Sorting"]}),b(I,{onClick:We,children:[l(zo,{className:"size-4"}),"Clear All Filters"]}),Ke&&b(I,{onClick:ue,children:[l(Zt,{className:"size-4"}),"Clear Aggregations"]}),Y&&b(_n,{children:[l(J,{}),l(W,{children:"Column Pinning"}),b(I,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(In,{className:"size-4"}),"Reset All Pinning"]}),b(I,{onClick:()=>{let t=$e().filter(c=>c.getCanPin?.()!==!1).map(c=>c.id);e.setColumnPinning({left:[],right:t})},children:[l(Fn,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),k&&l(C,{variant:"outline",size:"sm",onClick:k,disabled:F,className:"rounded-lg",children:l(kn,{className:n("h-4 w-4",F&&"animate-spin")})})]})]})})})})}import{Select as Q}from"radix-ui";import{CheckIcon as Vn,ChevronDownIcon as Io,ChevronUpIcon as An}from"lucide-react";import{jsx as A,jsxs as oo}from"react/jsx-runtime";function Fo({...e}){return A(Q.Root,{"data-slot":"select",...e})}function _o({...e}){return A(Q.Value,{"data-slot":"select-value",...e})}function Vo({className:e,size:o="default",children:a,...u}){return oo(Q.Trigger,{"data-slot":"select-trigger","data-size":o,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...u,children:[a,A(Q.Icon,{asChild:!0,children:A(Io,{className:"size-4 opacity-50"})})]})}function Ao({className:e,children:o,position:a="popper",...u}){return A(Q.Portal,{children:oo(Q.Content,{"data-slot":"select-content",className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...u,children:[A(Bn,{}),A(Q.Viewport,{className:n("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),A(Hn,{})]})})}function Bo({className:e,children:o,...a}){return oo(Q.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[A("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:A(Q.ItemIndicator,{children:A(Vn,{className:"size-4"})})}),A(Q.ItemText,{children:o})]})}function Bn({className:e,...o}){return A(Q.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...o,children:A(An,{className:"size-4"})})}function Hn({className:e,...o}){return A(Q.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...o,children:A(Io,{className:"size-4"})})}import{jsx as j,jsxs as Ee}from"react/jsx-runtime";function no({table:e,config:o}){return o.enabled?j("div",{className:"rounded-xl",children:j("div",{children:Ee("div",{className:"flex items-center justify-between",children:[j("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:o.showInfo!==!1&&Ee("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Ee("div",{className:"flex items-center gap-4",children:[o.pageSizeOptions&&Ee("div",{className:"flex items-center gap-2",children:[j("span",{className:"text-sm font-medium",children:"Rows per page:"}),Ee(Fo,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[j(Vo,{className:"h-9 w-[70px] rounded-lg",children:j(_o,{})}),j(Ao,{side:"top",className:"rounded-lg",children:o.pageSizeOptions.map(a=>j(Bo,{value:`${a}`,children:a},a))})]})]}),Ee("div",{className:"flex items-center gap-2",children:[j(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),j(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),o.showPageNumbers&&j("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,u)=>{let v=e.getState().pagination.pageIndex,m=v+u;return m<1||m>e.getPageCount()?null:j(C,{variant:m===v+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(m-1),children:m},m)})}),j(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),j(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Ln}from"radix-ui";import{cva as On}from"class-variance-authority";import{jsx as Gn}from"react/jsx-runtime";var En=On("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Ho({className:e,variant:o,size:a,noBg:u,...v}){return Gn(Ln.Root,{"data-slot":"toggle",className:n(En({className:e,variant:o,size:a,bg:u?"disabled":"enabled"})),...v})}import{useCallback as Pt,useEffect as Dt,useMemo as Tt,useRef as nt,useState as X}from"react";import{Fragment as Go,jsx as s,jsxs as T}from"react/jsx-runtime";var Eo={sum:e=>e.reduce((o,a)=>o+a,0),average:e=>e.length>0?e.reduce((o,a)=>o+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let o=[...e].sort((u,v)=>u-v),a=Math.floor(o.length/2);return o.length%2===0?(o[a-1]+o[a])/2:o[a]}};function Yn({data:e,columns:o,filters:a=[],pagination:u={enabled:!1},settings:v={},header:m,footer:k,className:F="",maxHeight:h="100%",loading:D=!1,error:R,emptyMessage:O="No data available",onRowSelectionChange:Y,onExport:ce,onRefresh:ae,onTableReady:K,children:U,isRowDisabled:E,isRowSelectable:w,onExternalSearch:Re,aggregations:re={},onAggregationChange:it,rowClassName:ze}){let[st,Ue]=X([]),[Rt,Ce]=X([]),[zt,$e]=X({}),[qe,lt]=X({}),[Me,ye]=X(""),[Mt,It]=X([]),[We,se]=X(v.enableColumnPinning?{left:[],right:[]}:{}),[me,Xe]=X({}),we=nt(null),Ne=nt(null),ue=nt(null),Pe=nt(null),[lo,Ft]=X(0),[Ie,Ke]=X(0),[dt,t]=X(0),[c,f]=X(0),P=nt(null),[B,_t]=X(!1),{enableSorting:Vt=!0,enableFiltering:At=!0,enableGlobalFilter:co=!0,enableColumnVisibility:Bt=!0,enableRowSelection:$=!0,stickyHeader:Ca=!0,toolbar:Je=!1,disableHeaderCheckbox:$o=!1,toolbarPosition:De="default",showSerialNumbers:ie=!0,fixedCheckboxColumn:ct=!0,striped:qo=!0,hoverable:Wo=!0,compact:Qe=!0,bordered:mo=!0,fullHeight:Xo=!1,enableColumnResizing:uo=!1,enableColumnPinning:H=!0,hideHeader:Ko=!1,selectionMode:pe="multiple",showCheckBox:Jo=!0,checkboxColumnPosition:po=0,rounded:Ht=!0}=v;Dt(()=>{let d=()=>{P.current&&_t(P.current.scrollTop>0)},p=P.current;if(p)return p.addEventListener("scroll",d),()=>p.removeEventListener("scroll",d)},[]),Dt(()=>{let d=()=>{we.current&&Ft(we.current.offsetHeight+16),Ne.current&&Ke(Ne.current.offsetHeight+16),ue.current&&t(ue.current.offsetHeight+16),Pe.current&&f(Pe.current.offsetHeight+16)};d();let p=new ResizeObserver(()=>{setTimeout(d,50)});return we.current&&p.observe(we.current),Ne.current&&p.observe(Ne.current),ue.current&&p.observe(ue.current),Pe.current&&p.observe(Pe.current),()=>{p.disconnect()}},[Je,m,De]);let Qo=(d,p)=>p.split(".").reduce((i,r)=>i&&i[r],d),Lt=Tt(()=>Object.keys(me).length===0?e:e.filter(d=>Object.entries(me).every(([p,i])=>{if(!i||i==="")return!0;let r=Qo(d,p);return typeof i=="string"?String(r).toLowerCase().includes(i.toLowerCase()):r===i})),[e,me]),Yo=Pt((d,p)=>{Xe(i=>{let r={...i};return p===""||p===null||p===void 0?delete r[d]:r[d]=p,r})},[]),Fe=Tt(()=>{let d=[...o],p=g=>g.map(x=>{if(x.id==="select"||x.id==="serialNumber")return x;let N={...x,enablePinning:!0};return x.columns&&(N.columns=p(x.columns)),N}),i=p(d),r={id:"select",header:({table:g})=>{if(pe==="single")return null;let x=g.getRowModel().rows.filter(z=>!E?.(z.original)&&(w?w(z.original):!0)),N=x.length>0&&x.every(z=>z.getIsSelected()),S=x.some(z=>z.getIsSelected());return s(ot,{checked:N||S&&"indeterminate",onCheckedChange:z=>{x.forEach(_=>_.toggleSelected(!!z))},disabled:$o||x.length===0,"aria-label":"Select all selectable rows"})},cell:({row:g})=>{let x=E?E(g.original):!1,N=w?w(g.original):!0;return s("div",{className:n("flex items-center justify-center",x&&"opacity-50"),children:pe==="multiple"?s(ot,{checked:g.getIsSelected(),onCheckedChange:S=>N&&g.toggleSelected(!!S),"aria-label":"Select row",disabled:x||!N}):Jo?s("input",{type:"radio",checked:g.getIsSelected(),onChange:()=>N&&g.toggleSelected(!0),disabled:x||!N,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:pe==="multiple"?40:30};if($){let g=po;g<0&&(g=i.length+g+1),g=Math.max(0,Math.min(g,i.length)),i.splice(g,0,r)}if(ie){let g={id:"serialNumber",header:"No.",cell:({row:x})=>s("div",{className:"font-medium text-center text-muted-foreground",children:x.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};i.unshift(g)}return i},[o,ie,$,ct,E,w,pe,po]),y=Wn({data:Lt,columns:Fe,onSortingChange:Vt?Ue:void 0,onColumnFiltersChange:At?Ce:void 0,onGlobalFilterChange:co?ye:void 0,getCoreRowModel:jn(),getPaginationRowModel:u.enabled?$n():void 0,getSortedRowModel:Vt?qn():void 0,getFilteredRowModel:At?Un():void 0,onColumnVisibilityChange:Bt?$e:void 0,onRowSelectionChange:$?lt:void 0,onColumnOrderChange:It,onColumnPinningChange:H?se:void 0,state:{sorting:Vt?st:void 0,columnFilters:At?Rt:void 0,columnVisibility:Bt?zt:void 0,rowSelection:$?qe:{},globalFilter:Me,columnOrder:Mt,columnPinning:H?We:{}},initialState:{pagination:u.enabled?{pageSize:u.pageSize||10}:void 0,columnPinning:H?{left:[...ie?["serialNumber"]:[],...$?["select"]:[]],right:[]}:void 0},enableRowSelection:$,enableColumnResizing:uo,enableColumnPinning:H,columnResizeMode:"onChange"}),go=Tt(()=>{if(!re||Object.keys(re).length===0)return{};let d={},p=y.getFilteredRowModel().rows;return Object.entries(re).forEach(([i,r])=>{if(!r?.enabled)return;let g=p.map(N=>{if(r.accessor)return r.accessor(N.original);{let S=N.getValue(i);return typeof S=="number"?S:parseFloat(String(S))||0}}).filter(N=>N!==null&&!isNaN(N)),x={};r.functions?.forEach(N=>{Eo[N]&&(x[N]=Eo[N](g))}),Object.keys(x).length>0&&(d[i]=x)}),d},[Lt,re,y?.getFilteredRowModel().rows]);Dt(()=>{if($&&Y){let d=y.getFilteredSelectedRowModel().rows.filter(p=>!E?.(p.original)&&(w?w(p.original):!0)).map(p=>p.original);Y(d)}},[qe,$,Y,y,E,w]);let Zo=Pt(d=>{pe==="single"?(y.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[pe,y]);Dt(()=>{K&&K(y)},[y,K]);let en=Pt(()=>{Ue([])},[]),tn=Pt(()=>{Ce([]),ye("")},[]),fo=(d,p)=>{if(!H)return;let i=[...ie?["serialNumber"]:[],...$&&ct?["select"]:[]],r={left:[...(We.left??[]).filter(g=>i.includes(g))],right:[...We.right??[]]};p===!1?(r.left=r.left.filter(g=>g!==d),r.right=r.right.filter(g=>g!==d)):p==="right"?(r.left=r.left.filter(g=>g!==d),r.right.includes(d)||r.right.push(d)):p==="left"&&(r.right=r.right.filter(g=>g!==d),!r.left.includes(d)&&!i.includes(d)&&r.left.push(d)),y.setColumnPinning(r)},on=()=>{let d=Object.keys(go).length>0,p=y.getHeaderGroups()[0]?.headers.some(r=>r.column.columnDef.customFooter),i=ie&&y.getFilteredRowModel().rows.length>0&&(d||p);return!d&&!p&&!i?null:s(jt,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:s(le,{className:"hover:bg-transparent bg-sidebar",children:y.getHeaderGroups()[0]?.headers.map((r,g)=>{let x=r.column.id,N=go[x],S=H&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&$),z=H&&r.column.getIsPinned()==="right",_=r.column.id==="serialNumber",ge=r.column.id==="select",V=r.column.columnDef.customFooter;return N||V||_&&i?s(de,{className:n("font-semibold text-sm py-2 px-2 border-r",Qe&&"py-1",S&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(_||ge)&&"sticky left-0 z-30 bg-sidebar/95",V?.className),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...S&&{left:_?0:ge?ie&&y.getColumn("serialNumber")?.getSize()||0:mt(r.column)},...z&&{right:ut(r.column)},..._&&{left:0}},children:(()=>{if(V?.content){let Te=typeof V.content=="function"?V.content(y):V.content;return s("div",{className:n("w-full h-full",V.align==="center"&&"text-center",V.align==="right"&&"text-right",V.align==="left"&&"text-left"),children:Te})}return N?s("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(N).map(([Te,ln])=>T("div",{className:"flex items-center justify-between text-muted-foreground",children:[T("span",{className:"text-xs capitalize",children:[Te,":"]}),s("span",{className:"font-medium text-foreground",children:nn(Te,ln)})]},Te))}):_&&i?T("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",y.getFilteredRowModel().rows.length]}):null})()},`agg-${r.id}`):s(de,{className:n("py-0 px-0 border-r",Qe&&"py-0",S&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(_||ge)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...S&&{left:_?0:ge?ie&&y.getColumn("serialNumber")?.getSize()||0:mt(r.column)},...z&&{right:ut(r.column)},..._&&{left:0}}},`agg-${r.id}`)})})})},nn=(d,p)=>typeof p=="number"?d==="count"||d==="unique"?p.toLocaleString():p.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):p,an=()=>y.getHeaderGroups().map((d,p)=>s(le,{className:"hover:bg-transparent",children:d.headers.map((i,r)=>{let g=i.depth===0&&i.colSpan>1,x=H&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&$),N=H&&i.column.getIsPinned()==="right",S=i.column.getCanSort(),z=H&&i.column.columnDef.enablePinning!==!1,_=i.column.id==="serialNumber",ge=i.column.id==="select",Et=_||ge&&ct,V=i.column.columnDef.headerAlign||"left",pt=re&&re[i.column.id]?.enabled,Te={left:"justify-start",center:"justify-center",right:"justify-end"}[V];return T(ho,{colSpan:i.colSpan,className:n("font-semibold text-foreground bg-sidebar group px-0",!Qe&&"py-2",mo&&r<d.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-25 bg-sidebar",N&&"sticky right-0 z-25 bg-sidebar",(_||ge)&&"sticky left-0 z-25 bg-sidebar",g?"text-center":"text-left",pt&&"border-b-2 border-primary/30"),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...x&&{left:_?0:ge?ie&&y.getColumn("serialNumber")?.getSize()||0:mt(i.column)},...N&&{right:ut(i.column)},..._&&{left:0}},children:[g?T("div",{className:"flex items-center justify-center",children:[ao(i.column.columnDef.header,i.getContext()),pt&&s(Oo,{className:"w-3 h-3 ml-1 text-primary"})]}):T("div",{className:n("relative flex items-center w-full px-2",Te),children:[T("div",{className:"flex items-center gap-1",children:[pt&&s(Oo,{className:"w-3 h-3 mr-1 text-primary"}),S&&V==="right"&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(ro,{className:"w-4 h-4"}),desc:s(io,{className:"w-4 h-4"})}[i.column.getIsSorted()]}),i.isPlaceholder?null:ao(i.column.columnDef.header,i.getContext()),S&&V!=="right"&&i.column.getIsSorted()&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(ro,{className:"w-4 h-4"}),desc:s(io,{className:"w-4 h-4"})}[i.column.getIsSorted()]})]}),(S||z&&!Et)&&T(ee,{children:[s(te,{asChild:!0,className:n("absolute",V==="left"&&"right-1",V==="center"&&"right-1",V==="right"&&"left-1"),children:s(Ho,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:s(Kn,{className:"w-4 h-4"})})}),T(oe,{align:"end",className:"w-48",children:[S&&T(Go,{children:[s(W,{children:"Sorting"}),T(I,{onClick:()=>i.column.toggleSorting(!1),children:[s(ro,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),T(I,{onClick:()=>i.column.toggleSorting(!0),children:[s(io,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),T(I,{onClick:()=>i.column.clearSorting(),disabled:!i.column.getIsSorted(),children:[s(Xn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),s(J,{})]}),z&&!Et&&T(Go,{children:[s(W,{children:"Pin Column"}),T(I,{onClick:()=>fo(i.column.id,"right"),disabled:i.column.getIsPinned()==="right",children:[s(Jn,{}),"Pin Right"]}),T(I,{onClick:()=>fo(i.column.id,!1),disabled:!i.column.getIsPinned(),children:[s(Qn,{}),"Unpin"]})]})]})]})]}),uo&&i.column.getCanResize()&&!g&&i.colSpan===1&&s("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:i.getResizeHandler()})]},i.id)})},d.id)),mt=d=>{if(!H)return;let p=0,i=y.getLeftHeaderGroups()[0]?.headers||[],r=[...ie?["serialNumber"]:[],...$?["select"]:[]];for(let g of i){if(g.id===d.id)break;if(r.includes(g.id)){let x=y.getColumn(g.id);x&&(p+=x.getSize())}}return p},ut=d=>{if(!H)return;let p=y.getState().columnPinning.right||[],i=p.indexOf(d.id);if(i===-1)return;let r=0;for(let g=i+1;g<p.length;g++){let x=y.getColumn(p[g]);x&&(r+=x.getSize())}return r};if(R)return s(Ut,{className:"w-full shadow-sm rounded-xl",children:s($t,{className:"flex items-center justify-center",children:T("div",{className:"text-center",children:[s("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),s("p",{className:"mb-4 text-sm text-muted-foreground",children:R}),ae&&T(C,{variant:"outline",size:"sm",onClick:ae,className:"rounded-lg",children:[s(Lo,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let rn=d=>d&&typeof d=="object"&&"content"in d,Z=Tt(()=>m?rn(m)?{content:m.content,align:m.align||"left",className:m.className||"",sticky:m.sticky!==void 0?m.sticky:!0,showOnEmpty:m.showOnEmpty!==void 0?m.showOnEmpty:!0}:{content:m,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[m]),Ot=()=>Je?s(to,{table:y,filters:a,globalFilter:Me,onGlobalFilterChange:ye,enableGlobalFilter:co,onExport:ce,onRefresh:ae,loading:D,enableColumnVisibility:Bt,enableColumnPinning:H,data:Lt,onClearSorting:en,onClearFilters:tn,onExternalSearch:Re,onCustomFilterChange:Yo,aggregations:re,onAggregationChange:it}):null,sn=()=>{let d=0;return De==="above-header"&&(d+=Ie),Z&&(d+=c),De==="below-header"&&(d+=dt),d};return s(Ye,{children:T("div",{className:n("w-full space-y-2 flex flex-col h-full",F),children:[Je&&De==="default"&&s("div",{ref:we,className:"relative z-40",children:Ot()}),s(Ut,{className:n("shadow-sm overflow-hidden py-0",Xo&&"flex-1",!Ht&&"rounded-none"),children:s($t,{className:"h-full p-0",children:T("div",{className:"relative flex flex-col justify-between h-full",children:[D&&s("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:T("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[s(Lo,{className:"size-5 animate-spin text-primary"}),s("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),s("div",{ref:P,className:n("relative overflow-auto border-b rounded-t-xl",y.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:h},children:T(Gt,{className:n("w-full border-collapse relative",y.getRowModel().rows?.length===0&&"h-full",!Ht&&"rounded-none"),children:[Je&&De==="above-header"&&s("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:s(le,{className:"hover:bg-transparent",children:s(de,{colSpan:Fe.length,className:n("p-2 bg-sidebar border-b shadow-sm",!Ht&&"rounded-none"),children:s("div",{ref:Ne,children:Ot()})})})}),Z&&(Z.showOnEmpty||y.getRowModel().rows?.length>0)&&s("thead",{className:n("sticky bg-sidebar border-b",B&&"shadow-sm"),style:{top:De==="above-header"?`${Ie}px`:"0px",zIndex:35},children:s(le,{className:"hover:bg-transparent",children:s(de,{colSpan:Fe.length,className:n("p-2 font-semibold text-foreground bg-sidebar",Qe?"py-2":"py-4",Z.className),children:s("div",{ref:Pe,className:n("flex items-center w-full",Z.align==="center"&&"justify-center",Z.align==="right"&&"justify-end",Z.align==="left"&&"justify-start"),children:typeof Z.content=="string"?s("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Z.content}):Z.content})})})}),Je&&De==="below-header"&&s("thead",{className:n("sticky bg-sidebar border-b",B&&"shadow-sm"),style:{top:Z?`${c}px`:"0px",zIndex:35},children:s(le,{className:"hover:bg-transparent",children:s(de,{colSpan:Fe.length,className:"p-2 bg-sidebar",children:s("div",{ref:ue,children:Ot()})})})}),!Ko&&s(bo,{className:n("sticky bg-sidebar",B&&"shadow-sm"),style:{top:`${sn()}px`,zIndex:30},children:an()}),s(vo,{children:y.getRowModel().rows?.length?y.getRowModel().rows.map((d,p)=>{let i=ze?ze(d):"";return s(le,{"data-state":d.getIsSelected()&&"selected",className:n(Wo&&"hover:bg-muted/50",qo&&p%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",pe==="single"&&"cursor-pointer",i),onClick:()=>{pe==="single"&&Zo(d)},children:d.getVisibleCells().map((r,g)=>{let x=H&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&$),N=H&&r.column.getIsPinned()==="right",S=r.column.id==="serialNumber",z=r.column.id==="select",_=S||z&&ct;return s(de,{className:n(Qe?"py-2":"py-4",mo&&g<d.getVisibleCells().length&&"border-r",x&&"sticky left-0 z-20 bg-sidebar/95",N&&"sticky right-0 z-20 bg-sidebar/95",S&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:r.column.getSize()!==150?r.column.getSize():"auto",minWidth:r.column.getSize()!==150?r.column.getSize():"auto",...x&&{left:S?0:z?ie&&y.getColumn("serialNumber")?.getSize()||0:mt(r.column)},...N&&{right:ut(r.column)},...S&&{left:0}},children:ao(r.column.columnDef.cell,r.getContext())},r.id)})},d.id)}):s(le,{children:s(de,{colSpan:Fe.length,className:"h-32 text-center border-0",children:T("div",{className:"flex flex-col items-center gap-3",children:[s("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),s("p",{className:"font-medium text-muted-foreground",children:O})]})})})}),on()]})}),k&&s("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:s(Gt,{children:s(jt,{children:s(le,{className:"bg-sidebar",children:s(de,{colSpan:Fe.length,className:"p-2",children:k})})})})})]})})}),s(no,{table:y,config:u}),U&&U(y)]})})}import{Separator as Zn}from"radix-ui";import{jsx as ea}from"react/jsx-runtime";function St({className:e,orientation:o="horizontal",decorative:a=!0,...u}){return ea(Zn.Root,{"data-slot":"separator-root",decorative:a,orientation:o,className:n("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...u})}import{Loader as ta,X as oa}from"lucide-react";import{AnimatePresence as na,motion as aa}from"framer-motion";import*as he from"react";import*as jo from"react-dom";import{jsx as L,jsxs as at}from"react/jsx-runtime";function ra({table:e,visible:o,container:a,children:u,className:v,...m}){let[k,F]=he.useState(!1);he.useLayoutEffect(()=>{F(!0)},[]),he.useEffect(()=>{function R(O){O.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e]);let h=a??(k?globalThis.document?.body:null);if(!h||!e)return null;let D=o??e.getFilteredSelectedRowModel().rows.length>0;return jo.createPortal(L(na,{children:D&&L(aa.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:n("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",v),...m,children:L(Ye,{children:u})})}),h)}function ia({size:e="sm",tooltip:o,isPending:a,disabled:u,className:v,children:m,...k}){let F=L(C,{variant:"secondary",size:e,className:n("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",v),disabled:u||a,...k,children:a?L(ta,{className:"animate-spin"}):m});return o?at(qt,{children:[L(Wt,{asChild:!0,children:F}),L(Xt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:L("p",{children:o})})]}):F}function sa({table:e}){let o=he.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?at("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[at("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),L(St,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),at(qt,{children:[L(Wt,{asChild:!0,children:L(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:o,children:L(oa,{className:"size-3.5"})})}),at(Xt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[L("p",{children:"Clear selection"}),L("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:L("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as rt,EyeOff as la}from"lucide-react";import{jsx as ne,jsxs as Ge}from"react/jsx-runtime";function da({column:e,title:o,className:a}){return e.getCanSort()?ne("div",{className:n("flex items-center space-x-2",a),children:Ge(ee,{children:[ne(te,{asChild:!0,children:Ge(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[ne("span",{children:o}),e.getIsSorted()==="desc"?ne(rt,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?ne(rt,{className:"ml-2 h-4 w-4"}):ne(rt,{className:"ml-2 h-4 w-4"})]})}),Ge(oe,{align:"start",className:"rounded-lg",children:[Ge(I,{onClick:()=>e.toggleSorting(!1),children:[ne(rt,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),Ge(I,{onClick:()=>e.toggleSorting(!0),children:[ne(rt,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),ne(J,{}),Ge(I,{onClick:()=>e.toggleVisibility(!1),children:[ne(la,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):ne("div",{className:n(a),children:o})}import{ChevronDown as ca,Eye as ma}from"lucide-react";import{jsx as je,jsxs as so}from"react/jsx-runtime";function ua({table:e}){return so(ee,{children:[je(te,{asChild:!0,children:so(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[je(ma,{className:"mr-2 h-4 w-4"}),"Columns ",je(ca,{className:"ml-2 h-4 w-4"})]})}),so(oe,{align:"end",className:"w-[200px] rounded-lg",children:[je(W,{children:"Toggle Columns"}),je(J,{}),e.getAllColumns().filter(o=>typeof o.accessorFn<"u"&&o.getCanHide()).map(o=>je(Be,{className:"capitalize",checked:o.getIsVisible(),onCheckedChange:a=>o.toggleVisibility(!!a),children:o.id},o.id))]})]})}import{Slot as pa}from"radix-ui";import{cva as ga}from"class-variance-authority";import{jsx as ba}from"react/jsx-runtime";var fa=ga("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function kt({className:e,variant:o,asChild:a=!1,...u}){let v=a?pa.Slot:"span";return ba(v,{"data-slot":"badge",className:n(fa({variant:o}),e),...u})}import{CheckIcon as va,PlusCircleIcon as ha}from"lucide-react";import{Fragment as Uo,jsx as M,jsxs as xe}from"react/jsx-runtime";function xa({column:e,title:o,options:a}){let u=e?.getFacetedUniqueValues(),v=new Set(e?.getFilterValue());return xe(He,{children:[M(Le,{asChild:!0,children:xe(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(ha,{className:"mr-2 h-4 w-4"}),o,v?.size>0&&xe(Uo,{children:[M(St,{orientation:"vertical",className:"mx-2 h-4"}),M(kt,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:v.size}),M("div",{className:"hidden space-x-1 lg:flex",children:v.size>2?xe(kt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[v.size," selected"]}):a.filter(m=>v.has(m.value)).map(m=>M(kt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:m.label},m.value))})]})]})}),M(Oe,{className:"w-[200px] p-0 rounded-lg",align:"start",children:xe(ft,{className:"rounded-lg",children:[M(bt,{placeholder:o}),xe(vt,{children:[M(ht,{children:"No results found."}),M(Ze,{children:a.map(m=>{let k=v.has(m.value);return xe(Ae,{onSelect:()=>{k?v.delete(m.value):v.add(m.value);let F=Array.from(v);e?.setFilterValue(F.length?F:void 0)},children:[M("div",{className:n("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(va,{className:n("h-4 w-4")})}),m.icon&&M(m.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:m.label}),u?.get(m.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:u.get(m.value)})]},m.value)})}),v.size>0&&xe(Uo,{children:[M(Co,{}),M(Ze,{children:M(Ae,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{Yn as DataTable,ra as DataTableActionBar,ia as DataTableActionBarAction,sa as DataTableActionBarSelection,da as DataTableColumnHeader,xa as DataTableFacetedFilter,no as DataTablePagination,to as DataTableToolbar,ua as DataTableViewOptions};
3
3
  //# sourceMappingURL=index.js.map