@akshar-technosoft/ui 1.0.23 → 1.0.25

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