@akshar-technosoft/ui 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as za,getCoreRowModel as Fa,getFilteredRowModel as Aa,getPaginationRowModel as Ia,getSortedRowModel as Ba,useReactTable as La}from"@tanstack/react-table";import{Loader2 as Wn}from"lucide-react";import{Slot as Gr}from"radix-ui";import{cva as _r}from"class-variance-authority";import{clsx as Lr}from"clsx";import{twMerge as Er}from"tailwind-merge";function r(...e){return Er(Lr(e))}import{jsx as Or}from"react/jsx-runtime";var Kt=_r("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] 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 dark:focus-visible:border-ring",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 y({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?Gr.Slot:"button";return Or(i,{"data-slot":"button",className:r(Kt({variant:t,size:o,className:e})),...s})}import{jsx as Qe}from"react/jsx-runtime";function xo({className:e,...t}){return Qe("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:Qe("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Xo({className:e,...t}){return Qe("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Yo({className:e,...t}){return Qe("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function Jt({className:e,...t}){return Qe("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Se({className:e,...t}){return Qe("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Zo({className:e,...t}){return Qe("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Le({className:e,...t}){return Qe("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as Qo}from"react/jsx-runtime";function Ue({className:e,...t}){return Qo("div",{"data-slot":"card",className:r("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function We({className:e,...t}){return Qo("div",{"data-slot":"card-content",className:r("px-6",e),...t})}import{Tooltip as kt}from"radix-ui";import{jsx as Rt,jsxs as Vr}from"react/jsx-runtime";function ht({delayDuration:e=0,...t}){return Rt(kt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function et({...e}){return Rt(ht,{children:Rt(kt.Root,{"data-slot":"tooltip",...e})})}function tt({...e}){return Rt(kt.Trigger,{"data-slot":"tooltip-trigger",...e})}function ot({className:e,sideOffset:t=0,children:o,...n}){return Rt(kt.Portal,{children:Vr(kt.Content,{"data-slot":"tooltip-content",sideOffset:t,className:r("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[o,Rt(kt.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as sa,RefreshCw as la,Download as da,Settings2 as ca,Filter as vn,FilterX as ua,ArrowUpDown as ma,PinOff as pa,ChevronDown as ga,Calculator as fa,Check as ba,X as xa}from"lucide-react";import{jsx as Hr}from"react/jsx-runtime";function Mt({className:e,type:t,...o}){return Hr("input",{type:t,"data-slot":"input",className:r("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),...o})}import{DropdownMenu as ue}from"radix-ui";import{CheckIcon as jr,ChevronRightIcon as $r,CircleIcon as es}from"lucide-react";import{jsx as de,jsxs as nn}from"react/jsx-runtime";function Pe({...e}){return de(ue.Root,{"data-slot":"dropdown-menu",...e})}function De({...e}){return de(ue.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ke({className:e,sideOffset:t=4,...o}){return de(ue.Portal,{children:de(ue.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:r("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),...o})})}function ho({...e}){return de(ue.Group,{"data-slot":"dropdown-menu-group",...e})}function U({className:e,inset:t,variant:o="default",...n}){return de(ue.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:r("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),...n})}function Xt({className:e,children:t,checked:o,...n}){return nn(ue.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:r("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:o,...n,children:[de("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:de(ue.ItemIndicator,{children:de(jr,{className:"size-4"})})}),t]})}function re({className:e,inset:t,...o}){return de(ue.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:r("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function ce({className:e,...t}){return de(ue.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function en({...e}){return de(ue.Sub,{"data-slot":"dropdown-menu-sub",...e})}function tn({className:e,inset:t,children:o,...n}){return nn(ue.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:r("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),...n,children:[o,de($r,{className:"ml-auto size-4"})]})}function on({className:e,...t}){return de(ue.SubContent,{"data-slot":"dropdown-menu-sub-content",className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var Ur=new Set(["select","serialNumber"]);function Yt(e){let t=e.getVisibleLeafColumns().filter(n=>Ur.has(n.id)?!1:!!n.columnDef.exportValue||!!n.accessorFn),o=e.getPrePaginationRowModel().rows;return{columns:t.map(n=>{let s=n.columnDef;return{id:n.id,header:s.exportHeader??(typeof s.header=="string"?s.header:n.id)}}),rows:o.map(n=>t.map(s=>{let i=s.columnDef;return i.exportValue?i.exportValue(n.original):n.getValue(s.id)})),originals:o.map(n=>n.original)}}import{useEffect as ha,useRef as yn,useState as Cn}from"react";import{useEffect as Yr,useState as cn}from"react";import{Calendar as Zr}from"lucide-react";import{format as Qr}from"date-fns";import{Popover as Zt}from"radix-ui";import{jsx as Qt}from"react/jsx-runtime";function rn({...e}){return Qt(Zt.Root,{"data-slot":"popover",...e})}function an({...e}){return Qt(Zt.Trigger,{"data-slot":"popover-trigger",...e})}function sn({className:e,align:t="center",sideOffset:o=4,...n}){return Qt(Zt.Portal,{children:Qt(Zt.Content,{"data-slot":"popover-content",align:t,sideOffset:o,className:r("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),...n})})}import*as eo from"react";import{ChevronDownIcon as Wr,ChevronLeftIcon as qr,ChevronRightIcon as Kr}from"lucide-react";import{DayPicker as Jr,getDefaultClassNames as ln}from"react-day-picker";import{jsx as nt}from"react/jsx-runtime";function dn({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:u,...d}){let a=ln();return nt(Jr,{showOutsideDays:o,className:r("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:n,formatters:{formatMonthDropdown:m=>m.toLocaleString("default",{month:"short"}),...i},classNames:{root:r("w-fit",a.root),months:r("flex gap-4 flex-col md:flex-row relative",a.months),month:r("flex flex-col w-full gap-4",a.month),nav:r("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",a.nav),button_previous:r(Kt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(Kt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_next),month_caption:r("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",a.month_caption),dropdowns:r("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",a.dropdowns),dropdown_root:r("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",a.dropdown_root),dropdown:r("absolute bg-popover inset-0 opacity-0",a.dropdown),caption_label:r("select-none font-medium",n==="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",a.caption_label),table:"w-full border-collapse",weekdays:r("flex",a.weekdays),weekday:r("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",a.weekday),week:r("flex w-full mt-2",a.week),week_number_header:r("select-none w-(--cell-size)",a.week_number_header),week_number:r("text-[0.8rem] select-none text-muted-foreground",a.week_number),day:r("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",a.day),range_start:r("rounded-l-md bg-accent",a.range_start),range_middle:r("rounded-none",a.range_middle),range_end:r("rounded-r-md bg-accent",a.range_end),today:r("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",a.today),outside:r("text-muted-foreground aria-selected:text-muted-foreground",a.outside),disabled:r("text-muted-foreground opacity-50",a.disabled),hidden:r("invisible",a.hidden),...t},components:{Root:({className:m,rootRef:f,...p})=>nt("div",{"data-slot":"calendar",ref:f,className:r(m),...p}),Chevron:({className:m,orientation:f,...p})=>f==="left"?nt(qr,{className:r("size-4",m),...p}):f==="right"?nt(Kr,{className:r("size-4",m),...p}):nt(Wr,{className:r("size-4",m),...p}),DayButton:Xr,WeekNumber:({children:m,...f})=>nt("td",{...f,children:nt("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...u},...d})}function Xr({className:e,day:t,modifiers:o,...n}){let s=ln(),i=eo.useRef(null);return eo.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),nt(y,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":o.selected&&!o.range_start&&!o.range_end&&!o.range_middle,"data-range-start":o.range_start,"data-range-end":o.range_end,"data-range-middle":o.range_middle,className:r("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",s.day,e),...n})}import{jsx as vt,jsxs as Vt}from"react/jsx-runtime";function un({value:e,onChange:t,placeholder:o,mode:n,externalSearch:s,onExternalChange:i,dateFormat:u,triggerClassName:d}){let a=u?u.replace(/Y/g,"y").replace(/D/g,"d"):null,[m,f]=cn(!1),[p,g]=cn(e);Yr(()=>{g(e)},[e]);let c=v=>{if(v==null)return null;if(v instanceof Date)return isNaN(v.getTime())?null:v;let C=new Date(v);return isNaN(C.getTime())?null:C},P=(v,C)=>{let A=c(v);return A?Qr(A,C):null},w=v=>{s?i?.(v):t?.(v)},R=()=>{w(p),f(!1)},b=()=>{g(e),f(!1)},D=()=>{let v=n==="single"?null:{from:null,to:null};g(v),w(v),f(!1)},T=()=>{let v=e;if(!v)return o;if(n==="single")return P(v,a||"PPP")??o;if(v.from&&v.to){let C=P(v.from,a||"MMM dd"),A=P(v.to,a||"MMM dd, yyyy");return C&&A?`${C} - ${A}`:o}if(v.from){let C=P(v.from,a||"MMM dd, yyyy");return C?`From ${C}`:o}if(v.to){let C=P(v.to,a||"MMM dd, yyyy");return C?`To ${C}`:o}return o},x=v=>{g(n==="single"?v:v||{from:null,to:null})};return Vt(rn,{open:m,onOpenChange:f,children:[vt(an,{className:"h-8",asChild:!0,children:Vt(y,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",T()===o&&"text-muted-foreground",d),children:[vt(Zr,{className:"mr-2 h-4 w-4 shrink-0"}),T()]})}),Vt(sn,{className:"w-auto p-0",align:"start",children:[vt("div",{className:"p-3",children:vt(dn,{mode:n,selected:p,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),Vt("div",{className:"flex items-center justify-between p-3 border-t",children:[vt(y,{variant:"ghost",size:"sm",onClick:D,children:"Clear"}),Vt("div",{className:"flex gap-2",children:[vt(y,{variant:"outline",size:"sm",onClick:b,children:"Cancel"}),vt(y,{size:"sm",onClick:R,disabled:n==="range"&&(!p?.from||!p?.to),children:"Apply"})]})]})]})]})}import{Calculator as ta,ChevronDown as gn,Columns3 as oa}from"lucide-react";import{Checkbox as mn}from"radix-ui";import{CheckIcon as ea}from"lucide-react";import{jsx as vo}from"react/jsx-runtime";function yt({className:e,...t}){return vo(mn.Root,{"data-slot":"checkbox",className:r("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:vo(mn.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:vo(ea,{className:"size-3.5"})})})}import{jsx as E,jsxs as ae}from"react/jsx-runtime";var pn=[{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"}],yo=(e,t)=>(t&&e.startsWith(`${t}.`)?e.replace(`${t}.`,""):e).split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");function Co(e,t){t&&Object.keys(e).forEach(o=>{let n=e[o];n&&t(o,{...n,enabled:!1,functions:[]})})}var fn=e=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1);function bn({table:e,aggregations:t,onAggregationChange:o}){let n=fn(e).filter(d=>d.id==="select"||d.id==="serialNumber"?!1:d.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(a=>{let m=a.getValue(d.id);return typeof m=="number"||typeof m=="string"&&!isNaN(parseFloat(String(m)))||typeof m=="object"&&m!==null&&"props"in m}));if(n.length===0||!o)return null;let s=Object.values(t).some(d=>d?.enabled),i=d=>{let a=t[d];o(d,{enabled:!a?.enabled,functions:a?.functions||["sum","average"]})},u=(d,a)=>{let m=t[d]?.functions||[],f=m.includes(a)?m.filter(p=>p!==a):[...m,a];o(d,{enabled:f.length>0,functions:f})};return ae(Pe,{children:[E(De,{asChild:!0,children:ae(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[E(ta,{className:"size-4"}),E("span",{children:"Aggregations"}),E(gn,{className:"opacity-50 size-4"})]})}),ae(ke,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[ae(re,{className:"flex items-center justify-between px-4 py-2",children:[E("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&E(y,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>Co(t,o),children:"Clear All"})]}),E(ce,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return ae(en,{children:[E(tn,{className:"text-sm",children:ae("div",{className:"flex items-center w-full gap-2",children:[E(yt,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),E("span",{className:r("flex-1",m&&"font-medium text-primary"),children:yo(d.id)}),m&&ae("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(f=>E("div",{className:"w-2 h-2 rounded-full bg-primary",title:pn.find(p=>p.value===f)?.label},f)),a?.functions&&a.functions.length>2&&ae("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),ae(on,{className:"w-48 rounded-lg",children:[E(re,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),pn.map(f=>E(Xt,{checked:a?.functions?.includes(f.value)||!1,onCheckedChange:()=>u(d.id,f.value),className:"py-2 text-sm",children:ae("div",{className:"flex flex-col",children:[E("span",{children:f.label}),E("span",{className:"text-xs text-muted-foreground",children:f.description})]})},f.value))]})]},d.id)})]})]})}function xn({table:e}){let t=fn(e),o=e.getAllColumns().filter(i=>!e.getAllLeafColumns().includes(i)&&i.columns?.length&&i.columns.some(u=>u.getCanHide?.()!==!1)),n=new Set(o.flatMap(i=>i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>u.id)||[])),s=t.filter(i=>!n.has(i.id));return ae(Pe,{children:[E(De,{asChild:!0,children:ae(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[E(oa,{className:"size-4"}),E("span",{children:"Columns"}),E(gn,{className:"opacity-50 size-4"})]})}),ae(ke,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[E(re,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),E(ce,{}),s.length>0&&ae(ho,{children:[E(re,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>E(Xt,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:u=>i.toggleVisibility(!!u),children:yo(i.id)},i.id))]}),o.map(i=>ae(ho,{children:[E(ce,{}),E(re,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:i.id}),i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>E(Xt,{className:"text-sm",checked:u.getIsVisible(),onCheckedChange:d=>u.toggleVisibility(!!d),children:yo(u.id,i.id)},u.id))]},i.id))]})]})}import{Select as fe}from"radix-ui";import{CheckIcon as na,ChevronDownIcon as hn,ChevronUpIcon as ra}from"lucide-react";import{jsx as te,jsxs as wo}from"react/jsx-runtime";function rt({...e}){return te(fe.Root,{"data-slot":"select",...e})}function at({...e}){return te(fe.Value,{"data-slot":"select-value",...e})}function it({className:e,size:t="default",children:o,...n}){return wo(fe.Trigger,{"data-slot":"select-trigger","data-size":t,className:r("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),...n,children:[o,te(fe.Icon,{asChild:!0,children:te(hn,{className:"size-4 opacity-50"})})]})}function st({className:e,children:t,position:o="popper",...n}){return te(fe.Portal,{children:wo(fe.Content,{"data-slot":"select-content",className:r("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",o==="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:o,...n,children:[te(aa,{}),te(fe.Viewport,{className:r("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),te(ia,{})]})})}function Ee({className:e,children:t,...o}){return wo(fe.Item,{"data-slot":"select-item",className:r("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),...o,children:[te("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:te(fe.ItemIndicator,{children:te(na,{className:"size-4"})})}),te(fe.ItemText,{children:t})]})}function aa({className:e,...t}){return te(fe.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:te(ra,{className:"size-4"})})}function ia({className:e,...t}){return te(fe.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:te(hn,{className:"size-4"})})}import{Fragment as va,jsx as k,jsxs as V}from"react/jsx-runtime";var oe=e=>e.id??e.key;function No({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:d=!1,enableColumnVisibility:a=!0,onClearSorting:m,onClearFilters:f,enableColumnPinning:p=!1,onExternalSearch:g,initialExternalValues:c,aggregations:P={},onAggregationChange:w,groupedFilterLabel:R="Global",showFilterChips:b=!0,initialGroupedField:D,onGroupedFieldChange:T}){let[x,v]=Cn(c??{}),[C,A]=Cn(D??"all"),G=yn(c??{}),j=yn(void 0);ha(()=>()=>clearTimeout(j.current),[]);let O=(l,L,Q=!1)=>{let $={...G.current,[l]:L};G.current=$,v($),clearTimeout(j.current),Q?j.current=setTimeout(()=>g?.($),500):g?.($)},ne=()=>{clearTimeout(j.current),G.current={},v({}),A("all"),T?.("all"),f(),g?.({})},he=l=>t.find(Q=>oe(Q)===l)?.externalSearch?x[l]??"":e.getColumn(l)?.getFilterValue(),J=(l,L)=>{let Q=t.find($=>oe($)===l);Q?.externalSearch?O(l,L,Q.type==="text"):e.getColumn(l)?.setFilterValue(L)},Ve=l=>{A(l),T?.(l),l!=="all"&&n("")},Fe=Object.values(P).some(l=>l?.enabled),St=l=>!!e.getColumn(oe(l))||!!l.externalSearch,ve=l=>{let L=he(oe(l));return L==null||L===""?!1:typeof L=="object"?!!(L.from||L.to):!0},mt=l=>l.type==="date"||l.type==="daterange",Ae=l=>{J(oe(l),mt(l)?null:"")},pt=l=>{let L=he(oe(l));return l.type==="select"?l.options?.find(Q=>Q.value===L)?.label??String(L):mt(l)?"set":String(L)},ye=(l,L)=>{let Q=L?.embedded;if(l.type==="select"){let $=oe(l),gt=he($);return V(rt,{value:gt?String(gt):"",onValueChange:Ce=>J($,Ce==="__all__"?"":Ce),children:[k(it,{size:"sm",className:r("w-full",Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),children:V("span",{className:"flex items-center gap-2 truncate",children:[l.icon&&k(l.icon,{className:"size-4 shrink-0 text-muted-foreground"}),k(at,{placeholder:l.placeholder})]})}),V(st,{className:"rounded-lg",children:[k(Ee,{value:"__all__",children:"All"}),l.options?.map(Ce=>k(Ee,{value:Ce.value,children:Ce.label},Ce.value))]})]})}return l.type==="date"||l.type==="daterange"?k(un,{value:he(oe(l)),onChange:$=>J(oe(l),$),placeholder:l.placeholder,mode:l.type==="daterange"?"range":"single",dateFormat:l.dateFormat,externalSearch:l.externalSearch,onExternalChange:$=>O(oe(l),$),triggerClassName:Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":void 0}):V("div",{className:"relative w-full",children:[l.icon&&k(l.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),k(Mt,{placeholder:l.placeholder,value:he(oe(l))??"",onChange:$=>{J(oe(l),$.target.value)},className:r("h-8",l.icon&&"pl-9",Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),type:l.type==="number"?"number":"text"})]})},He=t.filter(l=>(l.placement??"bar")==="bar"),Z=t.filter(l=>l.placement==="menu"),pe=s&&Z.length>0,Ye=Z.filter(ve),je=e.getState().columnFilters.length>0||!!o||t.some(ve),{left:Ie=[],right:Bt=[]}=e.getState().columnPinning,Be=Ie.some(l=>l!=="serialNumber"&&l!=="select")||Bt.length>0,$e=[{value:"all",label:"All Fields"},...Z.map(l=>({value:oe(l),label:l.placeholder}))];return V("div",{className:"flex flex-wrap items-center gap-3",children:[He.length>0&&k(vn,{className:"size-4 text-muted-foreground shrink-0"}),He.map(l=>St(l)?k("div",{className:r("relative min-w-[150px]",l.width),children:ye(l)},oe(l)):null),b&&Ye.map(l=>V("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[V("span",{className:"text-muted-foreground",children:[l.placeholder,":"]}),k("span",{className:"font-medium truncate max-w-[120px]",children:pt(l)}),k("button",{type:"button",onClick:()=>Ae(l),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${l.placeholder}`,children:k(xa,{className:"size-3.5"})})]},`chip-${oe(l)}`)),je&&V(y,{variant:"ghost",size:"sm",onClick:ne,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[k(ua,{className:"size-4"}),"Clear Filters"]}),V("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&V("div",{className:r("flex items-center",pe&&"bg-background border rounded-lg"),children:[pe&&V(Pe,{children:[k(De,{asChild:!0,children:V(y,{variant:"ghost",size:"sm",className:"gap-1 border border-transparent border-r-border rounded-l-lg rounded-r-none hover:bg-transparent shrink-0 relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:[k("span",{className:"text-sm font-medium max-w-28 truncate",children:C==="all"?R:$e.find(l=>l.value===C)?.label}),k(ga,{className:"opacity-50 size-4"})]})}),k(ke,{align:"start",className:"w-48 rounded-lg",children:$e.map(l=>V(U,{onClick:()=>Ve(l.value),className:"flex items-center justify-between",children:[k("span",{children:l.label}),C===l.value&&k(ba,{className:"size-4 text-primary"})]},l.value))})]}),(()=>{let l=pe&&C!=="all"?Z.find(L=>oe(L)===C):void 0;return l?k("div",{className:"w-48",children:ye(l,{embedded:!0})}):V("div",{className:"relative",children:[k(sa,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),k(Mt,{placeholder:pe?"Search all fields...":"Global search...",value:o??"",onChange:L=>n(L.target.value),className:r("pl-9 h-8 w-48",pe&&"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]")})]})})()]}),k(bn,{table:e,aggregations:P,onAggregationChange:w}),a&&k(xn,{table:e}),V(Pe,{children:[k(De,{asChild:!0,children:k(y,{variant:"outline",size:"sm",className:"rounded-lg",children:k(ca,{className:"size-4"})})}),V(ke,{align:"end",className:"w-[200px] rounded-lg",children:[k(re,{children:"Table Settings"}),k(ce,{}),i&&V(U,{onClick:()=>{let l=Yt(e);i(l.originals,l)},children:[k(da,{className:"size-4"}),"Export"]}),V(U,{onClick:m,disabled:e.getState().sorting.length===0,children:[k(ma,{className:"size-4"}),"Clear All Sorting"]}),V(U,{onClick:ne,disabled:!je,children:[k(vn,{className:"size-4"}),"Clear All Filters"]}),Object.keys(P).length>0&&V(U,{onClick:()=>Co(P,w),disabled:!Fe,children:[k(fa,{className:"size-4"}),"Clear Aggregations"]}),p&&V(va,{children:[k(ce,{}),k(re,{children:"Column Pinning"}),V(U,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Be,children:[k(pa,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),u&&k(y,{variant:"outline",size:"sm",onClick:u,disabled:d,className:"rounded-lg",children:k(la,{className:r("h-4 w-4",d&&"animate-spin")})})]})]})}import{ChevronLeft as ya,ChevronRight as Ca}from"lucide-react";import{Fragment as Na,jsx as be,jsxs as lt}from"react/jsx-runtime";function wa(e,t,o=1){let n=e+1,s=o*2+5;if(t<=s)return Array.from({length:t},(p,g)=>g+1);let i=Math.max(n-o,1),u=Math.min(n+o,t),d=i>2,a=u<t-1,m=3+o*2,f=[];if(!d&&a){for(let p=1;p<=m;p++)f.push(p);f.push("ellipsis",t)}else if(d&&!a){f.push(1,"ellipsis");for(let p=t-m+1;p<=t;p++)f.push(p)}else{f.push(1,"ellipsis");for(let p=i;p<=u;p++)f.push(p);f.push("ellipsis",t)}return f}function To({table:e,config:t}){if(!t)return null;let o=e.getPageCount(),n=e.getState().pagination.pageIndex,s=e.getState().pagination.pageSize,i=e.getFilteredRowModel().rows.length,u="size-8 p-0 rounded-lg";return lt("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&<("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:["Showing ",i===0?0:n*s+1," to"," ",Math.min((n+1)*s,i)," of ",i," entries"]}),lt("div",{className:"flex items-center gap-3",children:[(()=>{let d=t.pageSizeOptions??[10,25,50,100,-1];if(d.length===0)return null;let a=d.includes(-1),m=i>0&&s>=i,f=a&&m?"-1":`${s}`;return lt("div",{className:"flex items-center gap-2",children:[be("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),lt(rt,{value:f,onValueChange:p=>e.setPageSize(p==="-1"?Math.max(i,1):Number(p)),children:[be(it,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:be(at,{})}),be(st,{side:"top",className:"rounded-lg",children:d.map(p=>be(Ee,{value:`${p}`,children:p===-1?"All":p},p))})]})]})})(),o>1&<("div",{className:"flex items-center gap-1",children:[be(y,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:u,children:be(ya,{className:"size-4"})}),t.showPageNumbers&<(Na,{children:[lt("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),be("div",{className:"hidden items-center gap-1 sm:flex",children:wa(n,o).map((d,a)=>d==="ellipsis"?be("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):be(y,{variant:d-1===n?"default":"outline",size:"sm",className:r(u,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),be(y,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:u,children:be(Ca,{className:"size-4"})})]})]})]})}import{useCallback as Io,useEffect as Ke,useMemo as ro,useRef as Ge,useState as xe}from"react";function Ct(e,t){if(!t)return{};let o=e.getIsPinned();if(!o)return{};let n=e.getSize();return{position:"sticky",left:o==="left"?e.getStart("left"):void 0,right:o==="right"?e.getAfter("right"):void 0,width:n,minWidth:n,maxWidth:n,boxShadow:o==="right"&&e.getIsFirstColumn("right")?"inset 1px 0 0 0 var(--border)":void 0}}var Re=(e,t)=>t||e!==150?e:"auto";function wn(e,t){return{left:[...t,...(e.left??[]).filter(o=>!t.includes(o))],right:(e.right??[]).filter(o=>!t.includes(o))}}function Nn(e,t,o,n){if(o===!1)e.setColumnSizing(d=>{let a={...d};return delete a[t],a});else{let d=n.container?.querySelector(`[data-col-id="${t}"]`),a=d?Math.round(d.getBoundingClientRect().width):0;a>0&&e.setColumnSizing(m=>({...m,[t]:a}))}let{alwaysPinnedLeft:s}=n,i=e.getState().columnPinning,u={left:(i.left??[]).filter(d=>s.includes(d)),right:[...i.right??[]]};o==="right"?u.right.includes(t)||u.right.push(t):o==="left"?(u.right=u.right.filter(d=>d!==t),!u.left.includes(t)&&!s.includes(t)&&u.left.push(t)):(u.left=u.left.filter(d=>d!==t),u.right=u.right.filter(d=>d!==t)),e.setColumnPinning(u)}var Tn={sum:e=>e.reduce((t,o)=>t+o,0),average:e=>e.length>0?e.reduce((t,o)=>t+o,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((n,s)=>n-s),o=Math.floor(t.length/2);return t.length%2===0?(t[o-1]+t[o])/2:t[o]}};function Sn(e,t){if(!t||Object.keys(t).length===0)return{};let o={},n=e.getFilteredRowModel().rows;return Object.entries(t).forEach(([s,i])=>{if(!i?.enabled)return;let u=n.map(a=>{if(i.accessor)return i.accessor(a.original);let m=a.getValue(s);return typeof m=="number"?m:parseFloat(String(m))}).filter(a=>a!==null&&!isNaN(a)),d={};i.functions?.forEach(a=>{Tn[a]&&(d[a]=Tn[a](u))}),Object.keys(d).length>0&&(o[s]=d)}),o}function Pn(e,t){return typeof t=="number"?e==="count"||e==="unique"?t.toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):t}function Ta(e,t){return t.split(".").reduce((o,n)=>o&&o[n],e)}function Dn(e,t=new Set){for(let o of e){let n=o.id??o.accessorKey;n&&t.add(String(n)),o.columns&&Dn(o.columns,t)}return t}function to(e,t){let o=Dn(e),n=[];for(let s of t){if(s.externalSearch)continue;let i=typeof s.filterFn=="function",u=i?s.id:s.key;if(!u||o.has(String(u)))continue;let d=s.key;n.push({id:String(u),accessorFn:d?a=>Ta(a,d):()=>null,...i&&{filterFn:(a,m,f)=>s.filterFn(a.original,f)},enableHiding:!1,enableSorting:!1,enablePinning:!1,enableGlobalFilter:!1,meta:{filterOnly:!0}})}return n}import{jsx as Ht}from"react/jsx-runtime";function kn({initialColumns:e,filters:t,showSerialNumbers:o,enableRowSelection:n,selectionMode:s,showCheckbox:i,enableHeaderCheckbox:u,isRowSelectable:d}){let a=p=>p.map(g=>{if(g.id==="select"||g.id==="serialNumber")return g;let c={...g,enablePinning:!0};return g.columns&&(c.columns=a(g.columns)),c}),m=a([...e]),f={id:"select",header:({table:p})=>{if(s==="single")return null;let g=p.getRowModel().rows.filter(w=>d?.(w.original)??!0),c=g.length>0&&g.every(w=>w.getIsSelected()),P=g.some(w=>w.getIsSelected());return Ht(yt,{checked:c||P&&"indeterminate",onCheckedChange:w=>{g.forEach(R=>R.toggleSelected(!!w))},disabled:!u||g.length===0,"aria-label":"Select all selectable rows"})},cell:({row:p})=>{let g=d?.(p.original)??!0;return Ht("div",{className:r("flex justify-center items-center",!g&&"opacity-50"),children:s==="multiple"?Ht(yt,{checked:p.getIsSelected(),onCheckedChange:c=>g&&p.toggleSelected(!!c),"aria-label":"Select row",disabled:!g}):i?Ht("input",{type:"radio",checked:p.getIsSelected(),onChange:()=>g&&p.toggleSelected(!0),disabled:!g,className:"border-primary rounded-full focus:ring-primary w-4 h-4 text-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:s==="multiple"?40:30};return n&&m.unshift(f),o&&m.unshift({id:"serialNumber",header:"No.",cell:({row:p})=>Ht("div",{className:"font-medium text-muted-foreground text-center",children:p.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...to(e,t)]}import{useEffect as Sa,useMemo as Pa,useRef as Mo}from"react";var Rn="atsui:tbl:v1:",Do=new Map,Mn=new Map;function ko(e){try{let t=localStorage.getItem(Rn+e);return t?JSON.parse(t):void 0}catch{return}}function zn(e,t){try{localStorage.setItem(Rn+e,JSON.stringify(t))}catch{}}function Fn(e){return e?typeof e=="string"?{key:e}:e:null}function Ro(e,t){return Do.get(e)??(t?ko(e):void 0)??{}}function wt(e,t,o){let n={...Ro(e,t),...o};Do.set(e,n),t&&zn(e,n)}var Po=new Map;function An(e,t){let o=Po.get(e);return o||(o=new Set,Po.set(e,o)),o.add(t),()=>{o.delete(t)}}function oo(e){return{...ko("g:"+e)??{},...Mn.get(e)??{}}}function no(e,t,o,n){let s=oo(e),i=n==null||n==="";if(i?s[o]===void 0:s[o]===n)return;let u={...s};i?delete u[o]:u[o]=n,Mn.set(e,u),t&&zn("g:"+e,u),Po.get(e)?.forEach(d=>d())}function In(e,t){if(wt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)no(e.group,e.local,o,void 0)}function Bn(e){return(Do.get(e)??ko(e))?.external??{}}var So=new Set;function Ln(e){return So.has(e)&&console.warn(`[DataTable] persist key "${e}" is used by two mounted tables \u2014 they will overwrite each other's saved state. Give each table a unique key.`),So.add(e),()=>{So.delete(e)}}var zo=e=>{if(e==null||e instanceof Date)return e;let t=new Date(e);return isNaN(t.getTime())?e:t},En=e=>{if(e&&typeof e=="object"&&("from"in e||"to"in e)){let t=zo(e.from),o=zo(e.to);return t===e.from&&o===e.to?e:{from:t,to:o}}return zo(e)};function Gn(e,t,o){let n=Fn(e),s=t.map(b=>({id:String(b.id??b.key),shared:b.shared,persist:b.persist!==!1,external:!!b.externalSearch,isDate:b.type==="date"||b.type==="daterange"})),i=Mo(s);i.current=s;let u=Pa(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let b=Ro(n.key,n.local),D=n.group?oo(n.group):{},T=C=>{let A=C.shared&&n.group?D[C.shared]:b.filters?.[C.id]??b.external?.[C.id];return C.isDate?En(A):A},x=[],v={};for(let C of s){if(!C.persist)continue;let A=T(C);A==null||A===""||(C.external?v[C.id]=A:x.push({id:C.id,value:A}))}return{columnFilters:x,globalFilter:b.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?b.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?b.pagination?.pageSize??o:o},external:v,groupedField:b.groupedField??"all"}},[]),d=Mo(u.pagination.pageIndex),a=Mo(u.pagination.pageIndex===0);return Sa(()=>{if(n)return!n.group&&i.current.some(b=>b.shared)&&console.warn(`[DataTable] persist key "${n.key}": filters use \`shared\` but the table has no \`persist.group\` \u2014 shared is inert. Add a group to enable it.`),Ln(n.key)},[]),{enabled:!!n,initial:u,persistFilters:b=>{if(!n)return;let D={};for(let x of b)D[x.id]=x.value;let T={};for(let x of i.current)!x.persist||x.external||(x.shared&&n.group?no(n.group,n.local,x.shared,D[x.id]):D[x.id]!==void 0&&(T[x.id]=D[x.id]));wt(n.key,n.local,{filters:T})},persistGlobalFilter:b=>{n&&wt(n.key,n.local,{globalFilter:b})},persistExternal:b=>{if(!n)return;let D={};for(let T of i.current)!T.persist||!T.external||(T.shared&&n.group?no(n.group,n.local,T.shared,b[T.id]):b[T.id]!==void 0&&(D[T.id]=b[T.id]));wt(n.key,n.local,{external:D})},persistPagination:b=>{!n||n.pagination===!1||a.current&&wt(n.key,n.local,{pagination:{pageIndex:b.pageIndex,pageSize:b.pageSize}})},persistGroupedField:b=>{n&&wt(n.key,n.local,{groupedField:b})},restorePageIndex:(b,D)=>{if(!n||a.current||b.getCoreRowModel().rows.length===0)return;let T=Math.min(d.current,Math.max(b.getPageCount()-1,0));a.current=!0,T>0&&D({pageIndex:T,pageSize:b.getState().pagination.pageSize})},syncSharedSlots:b=>{if(!n?.group)return;let D=n.group,T=i.current.filter(x=>x.shared&&x.persist&&!x.external);if(T.length!==0)return An(D,()=>{let x=oo(D);for(let v of T){let C=b.getColumn(v.id);if(!C)continue;let A=x[v.shared],G=A===void 0?void 0:v.isDate?En(A):A,j=C.getFilterValue();Object.is(j??void 0,G??void 0)||C.setFilterValue(G)}})},clearAll:()=>{n&&In(n,i.current.filter(b=>b.shared).map(b=>b.shared))}}}import{flexRender as _n}from"@tanstack/react-table";import{ChevronUp as On,ChevronDown as Vn,ChevronsUpDown as Hn,EyeOff as Da,MoreHorizontal as ka,MoveRightIcon as Ra,PinOffIcon as Ma,Calculator as jn}from"lucide-react";import{Fragment as Fo,jsx as _,jsxs as ie}from"react/jsx-runtime";function $n({table:e,aggregations:t,enableColumnPinning:o,enableColumnResizing:n,enableColumnVisibility:s,enableRowSelection:i,fixedCheckboxColumn:u,bordered:d,compact:a,onPinColumn:m}){let f=e.getVisibleLeafColumns().filter(g=>!g.getIsPinned()),p=f[f.length-1]?.id;return _(Fo,{children:e.getHeaderGroups().map(g=>_(Se,{className:"hover:bg-transparent",children:g.headers.map((c,P)=>{let w=c.depth===0&&c.colSpan>1,R=o&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&i),b=o&&c.column.getIsPinned()==="right",D=c.column.getCanSort(),T=o&&c.column.columnDef.enablePinning!==!1,x=c.column.id==="serialNumber",v=c.column.id==="select",C=x||v&&u,A=c.column.columnDef.headerAlign||"left",G=t&&t[c.column.id]?.enabled,j=s&&!C&&c.column.getCanHide(),O=D||T&&!C||j,ne=c.column.getIsSorted(),he={left:"justify-start",center:"justify-center",right:"justify-end"}[A];return ie(Zo,{colSpan:c.colSpan,"data-col-id":w?void 0:c.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&P<g.headers.length-1&&c.column.id!==p&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar/95",b&&"sticky right-0 z-25 bg-sidebar/95",(x||v)&&"sticky left-0 z-25 bg-sidebar/95",w?"text-center":"text-left"),style:{width:Re(c.getSize(),R||b),minWidth:Re(c.getSize(),R||b),...Ct(c.column,o)},children:[w?ie("div",{className:"flex justify-center items-center",children:[_n(c.column.columnDef.header,c.getContext()),G&&_(jn,{className:"ml-1 w-3 h-3 text-primary"})]}):ie("div",{className:r("relative flex items-center px-2 w-full",he,D&&"cursor-pointer select-none"),onClick:D?J=>{J.target.closest("button, a, input, select, [role=button], [role=checkbox]")||c.column.getToggleSortingHandler()?.(J)}:void 0,children:[ie("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",ne&&"pr-6"),children:[G&&_(jn,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),c.isPlaceholder?null:_("span",{className:"truncate",children:_n(c.column.columnDef.header,c.getContext())})]}),(O||D)&&ie("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[_("div",{className:r("absolute inset-0 bg-gradient-to-l from-sidebar from-45% to-transparent","transition-opacity duration-200 ease-out","opacity-0 group-hover:opacity-100 group-has-[[data-state=open]]:opacity-100")}),D&&_("span",{className:"relative shrink-0",children:ne?ne==="asc"?_(On,{className:"w-4 h-4"}):_(Vn,{className:"w-4 h-4"}):_(Hn,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),O&&ie(Pe,{children:[_(De,{asChild:!0,children:_(y,{variant:"ghost",size:"icon",tabIndex:-1,"aria-label":"Column options",onClick:J=>J.stopPropagation(),className:r("relative size-6 rounded-sm pointer-events-auto overflow-hidden","bg-sidebar hover:bg-border dark:bg-sidebar dark:hover:bg-accent","w-0 opacity-0 ml-0 group-hover:w-5 group-hover:opacity-100",D&&"group-hover:ml-0.5","data-[state=open]:w-5 data-[state=open]:opacity-100",D&&"data-[state=open]:ml-0.5","transition-all duration-200 ease-out"),children:_(ka,{className:"w-4 h-4"})})}),ie(ke,{align:"end",className:"w-48",onClick:J=>J.stopPropagation(),children:[D&&ie(Fo,{children:[_(re,{children:"Sorting"}),ie(U,{onClick:()=>c.column.toggleSorting(!1),disabled:ne==="asc",children:[_(On,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),ie(U,{onClick:()=>c.column.toggleSorting(!0),disabled:ne==="desc",children:[_(Vn,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),ie(U,{onClick:()=>c.column.clearSorting(),disabled:!ne,children:[_(Hn,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(T&&!C||j)&&_(ce,{})]}),T&&!C&&ie(Fo,{children:[_(re,{children:"Pin Column"}),ie(U,{onClick:()=>m(c.column.id,"right"),disabled:c.column.getIsPinned()==="right",children:[_(Ra,{}),"Pin Right"]}),ie(U,{onClick:()=>m(c.column.id,!1),disabled:!c.column.getIsPinned(),children:[_(Ma,{}),"Unpin"]}),j&&_(ce,{})]}),j&&ie(U,{onClick:()=>c.column.toggleVisibility(!1),children:[_(Da,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),_("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",G?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&c.column.getCanResize()&&!w&&c.colSpan===1&&_("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 select-none touch-none",onMouseDown:c.getResizeHandler(),onTouchStart:c.getResizeHandler(),onClick:J=>J.stopPropagation()})]},c.id)})},g.id))})}import{jsx as qe,jsxs as Ao}from"react/jsx-runtime";function Un({table:e,columnAggregations:t,aggregations:o,enableColumnPinning:n,enableRowSelection:s,showSerialNumbers:i,compact:u}){let d=Object.keys(t).length>0,a=e.getHeaderGroups()[0]?.headers.some(c=>c.column.columnDef.customFooter),m=i&&e.getFilteredRowModel().rows.length>0&&(d||a),f=e.getHeaderGroups()[0]?.headers.length??0,p=e.getVisibleLeafColumns().filter(c=>!c.getIsPinned()),g=p[p.length-1]?.id;return!d&&!a&&!m?null:qe(Jt,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:qe(Se,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((c,P)=>{let w=c.column.id,R=t[w],b=n&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&s),D=n&&c.column.getIsPinned()==="right",T=c.column.id==="serialNumber",x=c.column.id==="select",C=c.column.columnDef.customFooter;return R||C||T&&m?Ao(Le,{className:r("relative px-2 py-2 font-semibold text-sm",P<f-1&&"border-r",u&&"py-1",b&&"sticky left-0 z-30 bg-sidebar",D&&"sticky right-0 z-30 bg-sidebar",(T||x)&&"sticky left-0 z-30 bg-sidebar",C?.className),style:{width:Re(c.getSize(),b||D),minWidth:Re(c.getSize(),b||D),...Ct(c.column,n)},children:[qe("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(C?.content){let G=typeof C.content=="function"?C.content(e):C.content;return qe("div",{className:r("w-full h-full",C.align==="center"&&"text-center",C.align==="right"&&"text-right",C.align==="left"&&"text-left"),children:G})}return R?qe("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(R).map(([G,j])=>Ao("div",{className:"flex justify-between items-center text-muted-foreground",children:[qe("span",{className:"text-xs capitalize",children:G}),qe("span",{className:"font-medium text-foreground",children:o?.[w]?.format?.(j,G)??Pn(G,j)})]},G))}):T&&m?Ao("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${c.id}`):qe(Le,{className:r("relative px-0 py-0",P<f-1&&c.column.id!==g&&"border-r",u&&"py-0",b&&"sticky left-0 z-30 bg-sidebar",D&&"sticky right-0 z-30 bg-sidebar",(T||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:Re(c.getSize(),b||D),minWidth:Re(c.getSize(),b||D),...Ct(c.column,n)},children:qe("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${c.id}`)})})})}import{jsx as S,jsxs as Nt}from"react/jsx-runtime";function qn({data:e,columns:t,filters:o=[],pagination:n,settings:s={},header:i,footer:u,className:d="",maxHeight:a="100%",loading:m=!1,error:f,emptyMessage:p="No data available",onRowSelectionChange:g,onExport:c,onRefresh:P,onTableReady:w,children:R,isRowSelectable:b,getRowId:D,defaultSelectedRows:T,onExternalSearch:x,aggregations:v={},onAggregationChange:C,rowClassName:A,persist:G}){let j=!!n,O=Gn(G,o,n?.pageSize||10),ne=Ge(O.initial.external),[he,J]=xe([]),[Ve,Fe]=xe(O.initial.columnFilters),[St,ve]=xe(O.initial.pagination),[mt,Ae]=xe(()=>Object.fromEntries(to(t,o).map(h=>[h.id,!1]))),[pt,ye]=xe({}),[He,Z]=xe(O.initial.globalFilter),[pe,Ye]=xe([]),[je,Ie]=xe(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Bt=Ge(null),Be=Ge(null),$e=Ge(null),l=Ge(null),[L,Q]=xe(0),[$,gt]=xe(0),[Ce,co]=xe(0),Ze=Ge(null),[Lt,Wt]=xe(!1),{enableSorting:ft=!0,enableFiltering:Et=!0,enableGlobalFilter:Gt=!0,enableColumnVisibility:Pt=!0,enableRowSelection:N=!0,showToolbar:z=!1,enableHeaderCheckbox:F=!0,toolbarPosition:K="default",showSerialNumbers:X=!0,fixedCheckboxColumn:we=!0,striped:bt=!0,hoverable:xt=!0,compact:qt=!0,bordered:uo=!0,fullHeight:Vo=!1,enableColumnResizing:Ho=!1,enableColumnPinning:Ne=!0,showHeader:yr=!0,selectionMode:Dt="multiple",showCheckbox:jo=!0,groupedFilterLabel:Cr="Global",showFilterChips:wr=!0}=s;Ke(()=>{o.length>0&&!z&&console.warn("[DataTable] `filters` are provided but settings.showToolbar is off \u2014 filters live in the toolbar, so none will render."),o.some(h=>h.placement==="menu")&&!Gt&&console.warn("[DataTable] placement:'menu' filters are reached through the global search's field picker \u2014 with enableGlobalFilter off they are unreachable (only their chips would show).")},[]),Ke(()=>{let h=()=>{Ze.current&&Wt(Ze.current.scrollTop>0)},B=Ze.current;if(B)return B.addEventListener("scroll",h),()=>B.removeEventListener("scroll",h)},[]),Ke(()=>{let h=()=>{Be.current&&Q(Be.current.offsetHeight+16),$e.current&>($e.current.offsetHeight+16),l.current&&co(l.current.offsetHeight+16)};h();let B=new ResizeObserver(()=>{setTimeout(h,50)});return Be.current&&B.observe(Be.current),$e.current&&B.observe($e.current),l.current&&B.observe(l.current),()=>{B.disconnect()}},[z,i,K]);let Nr=h=>Fe(B=>{let ee=typeof h=="function"?h(B):h;return O.persistFilters(ee),ee}),$o=h=>Z(B=>{let ee=typeof h=="function"?h(B):h;return O.persistGlobalFilter(ee),ee}),Tr=h=>ve(B=>{let ee=typeof h=="function"?h(B):h;return O.persistPagination(ee),ee}),Sr=h=>{ne.current=h,O.persistExternal(h),x?.(h)},mo=ro(()=>kn({initialColumns:t,filters:o,showSerialNumbers:X,enableRowSelection:N,selectionMode:Dt,showCheckbox:jo,enableHeaderCheckbox:F,isRowSelectable:b}),[t,o,X,N,b,Dt,jo,F]),I=La({data:e,columns:mo,getRowId:D,onSortingChange:ft?J:void 0,onColumnFiltersChange:Et?Nr:void 0,onGlobalFilterChange:Gt?$o:void 0,getCoreRowModel:Fa(),getPaginationRowModel:j?Ia():void 0,getSortedRowModel:ft?Ba():void 0,getFilteredRowModel:Et?Aa():void 0,onColumnVisibilityChange:Pt?Ae:void 0,onRowSelectionChange:N?ye:void 0,onColumnOrderChange:Ye,onColumnPinningChange:Ne?h=>Ie(B=>wn(typeof h=="function"?h(B):h,[...X?["serialNumber"]:[],...N?["select"]:[]])):void 0,state:{sorting:ft?he:void 0,columnFilters:Et?Ve:void 0,columnVisibility:Pt?mt:void 0,rowSelection:N?pt:{},globalFilter:He,pagination:j?St:void 0,columnOrder:pe,columnPinning:Ne?je:{}},onPaginationChange:j?Tr:void 0,initialState:{columnPinning:Ne?{left:[...X?["serialNumber"]:[],...N?["select"]:[]],right:[]}:void 0},enableRowSelection:N?h=>b?.(h.original)??!0:!1,enableColumnResizing:Ho,enableColumnPinning:Ne,columnResizeMode:"onChange"}),po=ro(()=>Sn(I,v),[I,v,e,Ve,He]),Pr=ro(()=>Object.keys(po).length>0||mo.some(h=>h.customFooter),[po,mo]),Uo=Ge({onRowSelectionChange:g,isRowSelectable:b});Uo.current={onRowSelectionChange:g,isRowSelectable:b};let Wo=Ge(!1);Ke(()=>{if(Wo.current||!T||!N)return;let h=I.getCoreRowModel().rows;if(h.length===0)return;let B={};for(let ee of h)ee.getCanSelect()&&T(ee.original)&&(B[ee.id]=!0);Wo.current=!0,Object.keys(B).length>0&&ye(B)},[T,N,I,e]),Ke(()=>{let{onRowSelectionChange:h,isRowSelectable:B}=Uo.current;if(N&&h){let ee=I.getFilteredSelectedRowModel().rows.filter(Ot=>B?.(Ot.original)??!0).map(Ot=>Ot.original);h(ee)}},[pt,N,I]);let Dr=Io(h=>{Dt==="single"?(I.resetRowSelection(),h.toggleSelected(!0)):h.toggleSelected()},[Dt,I]),qo=Ge(w);qo.current=w,Ke(()=>{qo.current?.(I)},[I]);let Ko=Ge(!1);Ke(()=>{Ko.current||(Ko.current=!0,Object.keys(O.initial.external).length>0&&x?.(O.initial.external))},[]),Ke(()=>O.syncSharedSlots(I),[I]),Ke(()=>{j&&O.restorePageIndex(I,ve)},[e]);let kr=Io(()=>{J([])},[]),Rr=Io(()=>{Fe([]),Z(""),O.clearAll()},[]),Mr=(h,B)=>{Ne&&Nn(I,h,B,{container:Ze.current,alwaysPinnedLeft:[...X?["serialNumber"]:[],...N&&we?["select"]:[]]})},zr=h=>h&&typeof h=="object"&&"content"in h,Te=ro(()=>i?zr(i)?{content:i.content,align:i.align||"left",className:i.className||"",showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",showOnEmpty:!0}:null,[i]);if(f)return S(Ue,{className:"shadow-sm rounded-xl w-full",children:S(We,{className:"flex justify-center items-center",children:Nt("div",{className:"text-center",children:[S("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),S("p",{className:"mb-4 text-muted-foreground text-sm",children:f}),P&&Nt(y,{variant:"outline",size:"sm",onClick:P,className:"rounded-lg",children:[S(Wn,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let go=()=>z?S(No,{table:I,filters:o,globalFilter:He,onGlobalFilterChange:h=>$o(h),enableGlobalFilter:Gt,onExport:c,onRefresh:P,loading:m,enableColumnVisibility:Pt,enableColumnPinning:Ne,showFilterChips:wr,onClearSorting:kr,onClearFilters:Rr,onExternalSearch:Sr,initialExternalValues:ne.current,aggregations:v,onAggregationChange:C,groupedFilterLabel:Cr,initialGroupedField:O.initial.groupedField,onGroupedFieldChange:O.persistGroupedField}):null,Fr=()=>{let h=0;return K==="above-header"&&(h+=L),Te&&(h+=Ce),K==="below-header"&&(h+=$),h},Jo=I.getVisibleLeafColumns().filter(h=>!h.getIsPinned()),Ar=Jo[Jo.length-1]?.id,_t=Math.max(I.getVisibleLeafColumns().length,1);return S(ht,{children:Nt("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[z&&K==="default"&&S("div",{ref:Bt,className:"z-40 relative",children:go()}),S(Ue,{className:r("shadow-sm overflow-hidden py-0",Vo&&"flex-1 min-h-0"),children:S(We,{className:"h-full p-0",children:Nt("div",{className:"relative flex flex-col justify-between h-full",children:[m&&S("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:Nt("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[S(Wn,{className:"size-5 text-primary animate-spin"}),S("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),S("div",{ref:Ze,className:r("relative overflow-auto rounded-t-xl",Vo?"flex-1 min-h-0":I.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:Nt(xo,{className:r("w-full border-separate border-spacing-0 relative",I.getState().columnSizingInfo.isResizingColumn&&"select-none",I.getRowModel().rows?.length===0&&"h-full"),children:[z&&K==="above-header"&&S("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:S(Se,{className:"hover:bg-transparent",children:S(Le,{colSpan:_t,className:"p-2 bg-sidebar border-b shadow-sm",children:S("div",{ref:Be,children:go()})})})}),Te&&(Te.showOnEmpty||I.getRowModel().rows?.length>0)&&S("thead",{className:r("sticky bg-sidebar border-b",Lt&&"shadow-sm"),style:{top:K==="above-header"?`${L}px`:"0px",zIndex:35},children:S(Se,{className:"hover:bg-transparent",children:S(Le,{colSpan:_t,className:r("bg-sidebar p-2 font-semibold text-foreground",qt?"py-2":"py-4",Te.className),children:S("div",{ref:l,className:r("flex items-center w-full",Te.align==="center"&&"justify-center",Te.align==="right"&&"justify-end",Te.align==="left"&&"justify-start"),children:typeof Te.content=="string"?S("span",{className:"font-bold text-foreground text-lg tracking-tight",children:Te.content}):Te.content})})})}),z&&K==="below-header"&&S("thead",{className:r("sticky bg-sidebar border-b",Lt&&"shadow-sm"),style:{top:Te?`${Ce}px`:"0px",zIndex:35},children:S(Se,{className:"hover:bg-transparent",children:S(Le,{colSpan:_t,className:"bg-sidebar p-2",children:S("div",{ref:$e,children:go()})})})}),yr&&S(Xo,{className:r("sticky bg-sidebar [&_tr]:border-b-0",Lt&&"shadow-sm"),style:{top:`${Fr()}px`,zIndex:30},children:S($n,{table:I,aggregations:v,enableColumnPinning:Ne,enableColumnResizing:Ho,enableColumnVisibility:Pt,enableRowSelection:N,fixedCheckboxColumn:we,bordered:uo,compact:qt,onPinColumn:Mr})}),S(Yo,{children:I.getRowModel().rows?.length?I.getRowModel().rows.map((h,B)=>{let ee=B===I.getRowModel().rows.length-1,Ot=A?A(h):"";return S(Se,{"data-index":B,"data-state":h.getIsSelected()&&"selected",className:r(xt&&"hover:bg-muted/50",bt&&B%2===0&&"bg-muted/20",h.getIsSelected()&&"bg-muted",Dt==="single"&&"cursor-pointer",Ot),onClick:()=>{Dt==="single"&&Dr(h)},children:h.getVisibleCells().map((ge,Ir)=>{let fo=Ne&&(ge.column.getIsPinned()==="left"||ge.column.id==="serialNumber"||ge.column.id==="select"&&N),bo=Ne&&ge.column.getIsPinned()==="right",Br=ge.column.id==="serialNumber";return S(Le,{className:r(qt?"py-2":"py-4",uo&&Ir<h.getVisibleCells().length-1&&ge.column.id!==Ar&&"border-r",(!ee||!Pr)&&"border-b",fo&&"sticky left-0 z-20 bg-sidebar/95",Br&&"sticky left-0 z-20 bg-card/95",bo&&"sticky right-0 z-20 bg-sidebar/95","p-1"),style:{width:Re(ge.column.getSize(),fo||bo),minWidth:Re(ge.column.getSize(),fo||bo),...Ct(ge.column,Ne)},children:za(ge.column.columnDef.cell,ge.getContext())},ge.id)})},h.id)}):S(Se,{children:S(Le,{colSpan:_t,className:"border-0 h-32 text-center",children:Nt("div",{className:"flex flex-col items-center gap-3",children:[S("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),S("p",{className:"font-medium text-muted-foreground",children:p})]})})})}),S(Un,{table:I,columnAggregations:po,aggregations:v,enableColumnPinning:Ne,enableRowSelection:N,showSerialNumbers:X,bordered:uo,compact:qt})]})}),u&&S("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:S(xo,{children:S(Jt,{children:S(Se,{className:"bg-sidebar",children:S(Le,{colSpan:_t,className:"p-2",children:u})})})})})]})})}),S(To,{table:I,config:n}),R&&R(I)]})})}import{Separator as Ea}from"radix-ui";import{jsx as Ga}from"react/jsx-runtime";function ao({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return Ga(Ea.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:r("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}import{Loader as _a,X as Oa}from"lucide-react";import{AnimatePresence as Va,motion as Ha}from"framer-motion";import*as dt from"react";import*as Kn from"react-dom";import{jsx as se,jsxs as jt}from"react/jsx-runtime";function Jn({table:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=dt.useState(!1);dt.useLayoutEffect(()=>{d(!0)},[]),dt.useEffect(()=>{function f(p){p.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=t??e.getFilteredSelectedRowModel().rows.length>0;return Kn.createPortal(se(Va,{children:m&&se(Ha.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",s),...i,children:se(ht,{children:n})})}),a)}function Xn({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...u}){let d=se(y,{variant:"secondary",size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...u,children:o?se(_a,{className:"animate-spin"}):i});return t?jt(et,{children:[se(tt,{asChild:!0,children:d}),se(ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:se("p",{children:t})})]}):d}function Yn({table:e}){let t=dt.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?jt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[jt("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),se(ao,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),jt(et,{children:[se(tt,{asChild:!0,children:se(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:se(Oa,{className:"size-3.5"})})}),jt(ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[se("p",{children:"Clear selection"}),se("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:se("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{useState as ct,useEffect as Qn,useMemo as Lo,useCallback as zt,useRef as ei}from"react";import{Loader2 as er}from"lucide-react";import{Search as ja,Download as $a,RefreshCw as Ua,Filter as Wa,ChevronDown as qa,Settings2 as Ka}from"lucide-react";import{Fragment as Ja,jsx as M,jsxs as Y}from"react/jsx-runtime";function Bo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:d,onSortChange:a,selectedCount:m,totalCount:f,visibleCount:p,onExport:g,onRefresh:c,loading:P,onClearFilters:w,onClearSorting:R}){let b=e.filter(x=>x.sortable),D=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",T=u!=="";return M("div",{className:"rounded-xl p-0.5",children:M("div",{className:"px-2",children:M("div",{className:"flex flex-col gap-6",children:Y("div",{className:"flex items-center justify-between",children:[M("div",{className:"flex items-center gap-3",children:t.length>0&&Y("div",{className:"flex items-center gap-3 flex-wrap",children:[M("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:M(Wa,{className:"h-4 w-4"})}),t.map(x=>M("div",{className:"relative min-w-[150px]",children:x.type==="select"?Y(rt,{value:s[x.key]||"all",onValueChange:v=>i(x.key,v),children:[x.icon&&M(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),M(it,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:M(at,{placeholder:x.placeholder||"Select..."})}),Y(st,{className:"rounded-lg",children:[M(Ee,{value:"all",children:"All"}),x.options?.map(v=>M(Ee,{value:v.value,children:v.label},v.value))]})]}):Y("div",{className:"relative",children:[x.icon&&M(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),M(Mt,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:v=>i(x.key,v.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),Y("div",{className:"flex items-center gap-2",children:[Y("div",{className:"relative",children:[M(ja,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),M(Mt,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),b.length>0&&Y(Pe,{children:[M(De,{asChild:!0,children:Y(y,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[M("span",{children:"Sort"}),M(qa,{className:"h-4 w-4 opacity-50"})]})}),Y(ke,{align:"end",className:"w-[200px] rounded-lg",children:[M(re,{children:"Sort By"}),M(ce,{}),b.map(x=>Y("div",{children:[Y(U,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),Y(U,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),T&&Y(Ja,{children:[M(ce,{}),M(U,{onClick:R,children:"Clear All Sorting"})]})]})]}),Y(Pe,{children:[M(De,{asChild:!0,children:M(y,{variant:"outline",size:"sm",className:"rounded-lg",children:M(Ka,{className:"h-4 w-4"})})}),Y(ke,{align:"end",className:"w-[200px] rounded-lg",children:[M(re,{children:"Table Settings"}),M(ce,{}),M(U,{onClick:R,children:"Clear All Sorting"}),M(U,{onClick:w,children:"Clear All Filters"})]})]}),g&&Y(y,{variant:"outline",size:"sm",onClick:g,className:"rounded-lg",children:[M($a,{className:"mr-2 h-4 w-4"}),"Export"]}),c&&M(y,{variant:"outline",size:"sm",onClick:c,disabled:P,className:"rounded-lg",children:M(Ua,{className:r("h-4 w-4",P&&"animate-spin")})})]})]})})})})}import{ChevronLeft as Xa,ChevronRight as Ya,ChevronsLeft as Za,ChevronsRight as Qa}from"lucide-react";import{jsx as W,jsxs as Me}from"react/jsx-runtime";function Zn({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:u}){if(!u)return null;let d=u.pageSizeOptions||[10,20,50,100],a=(e-1)*o+1,m=Math.min(e*o,n),f=e>1,p=e<t,g=()=>{let P=[],w=[];for(let R=Math.max(2,e-2);R<=Math.min(t-1,e+2);R++)P.push(R);return e-2>2?w.push(1,"..."):w.push(1),w.push(...P),e+2<t-1?w.push("...",t):t>1&&w.push(t),w};return W("div",{className:"rounded-xl",children:Me("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[W("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&Me("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),Me("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&Me("div",{className:"flex items-center gap-2",children:[W("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Me(rt,{value:`${o}`,onValueChange:c=>i(Number(c)),children:[W(it,{className:"h-9 w-[70px] rounded-lg",children:W(at,{})}),W(st,{side:"top",className:"rounded-lg",children:d.map(c=>W(Ee,{value:`${c}`,children:c},c))})]})]}),Me("div",{className:"flex items-center gap-2",children:[Me(y,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!f,className:"hidden sm:flex rounded-lg",children:[W(Za,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to first page"})]}),Me(y,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!f,className:"rounded-lg",children:[W(Xa,{className:"h-4 w-4 sm:mr-2"}),W("span",{className:"hidden sm:inline",children:"Previous"}),W("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&W("div",{className:"hidden sm:flex items-center gap-1",children:g().map((c,P)=>{if(c==="...")return W("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${P}`);let w=c;return W(y,{variant:w===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(w),children:w},w)})}),Me("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),Me(y,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!p,className:"rounded-lg",children:[W("span",{className:"hidden sm:inline",children:"Next"}),W(Ya,{className:"h-4 w-4 sm:ml-2"}),W("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Me(y,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!p,className:"hidden sm:flex rounded-lg",children:[W(Qa,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as H,jsxs as Tt}from"react/jsx-runtime";function tr({data:e,template:t,fields:o=[],filters:n=[],pagination:s,settings:i={},header:u,footer:d,className:a="",loading:m=!1,error:f,emptyMessage:p="No items found",emptyIcon:g,onSelectionChange:c,onExport:P,onRefresh:w,onTemplateReady:R,children:b}){let{enableSorting:D=!0,enableFiltering:T=!0,enableGlobalSearch:x=!0,enableSelection:v=!1,enableExport:C=!1,showToolbar:A=!0,selectionMode:G="multiple",gridCols:j={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:O=4,aspectRatio:ne="auto",minCardWidth:he=350,maxCardWidth:J=350}=i,Ve=!!s,[Fe,St]=ct(""),[ve,mt]=ct({}),[Ae,pt]=ct(""),[ye,He]=ct("asc"),[Z,pe]=ct(new Set),[Ye,je]=ct(1),[Ie,Bt]=ct(s?.pageSize||12),[Be,$e]=ct(j.default),l=Lo(()=>{let N=[...e];if(x&&Fe){let z=o.filter(F=>F.searchable!==!1);N=N.filter(F=>z.some(K=>F[K.key]?.toString().toLowerCase().includes(Fe.toLowerCase())))}if(T&&Object.keys(ve).forEach(z=>{let F=ve[z];if(F!=null&&F!==""){let K=o.find(X=>X.key===z);K&&(N=N.filter(X=>{let we=X[z];return K.type==="boolean"?we===(F==="true"):K.type==="number"?we===Number(F):we?.toString().toLowerCase().includes(String(F).toLowerCase())}))}}),D&&Ae){let z=o.find(F=>F.key===Ae);z&&N.sort((F,K)=>{let X=F[Ae],we=K[Ae];if(z.type==="number")return ye==="asc"?Number(X)-Number(we):Number(we)-Number(X);if(z.type==="date"){let bt=new Date(X),xt=new Date(we);return ye==="asc"?bt.getTime()-xt.getTime():xt.getTime()-bt.getTime()}else{let bt=String(X).toLowerCase(),xt=String(we).toLowerCase();return ye==="asc"?bt.localeCompare(xt):xt.localeCompare(bt)}})}return N},[e,Fe,ve,Ae,ye,o,x,T,D]),L=Lo(()=>{if(!Ve)return l;let N=(Ye-1)*Ie,z=N+Ie;return l.slice(N,z)},[l,Ye,Ie,Ve]),Q=Math.ceil(l.length/Ie),$=zt(N=>{v&&pe(z=>{let F=new Set(z);return G==="single"?(F.clear(),F.add(N)):F.has(N)?F.delete(N):F.add(N),F})},[v,G]),gt=zt(()=>{!v||G==="single"||(Z.size===l.length?pe(new Set):pe(new Set(l.map((N,z)=>z))))},[v,G,Z.size,l.length]),Ce=zt((N,z)=>{mt(F=>({...F,[N]:z})),je(1)},[]),co=zt((N,z)=>{pt(N),He(z)},[]),Ze=zt(()=>{St(""),mt({}),je(1)},[]),Lt=zt(()=>{pt(""),He("asc")},[]),Wt=Lo(()=>({getSelectedItems:()=>Array.from(Z).map(N=>l[N]),clearSelection:()=>pe(new Set),selectAll:gt,getFilteredData:()=>l,getTotalCount:()=>e.length,getVisibleCount:()=>l.length,refresh:()=>w?.(),exportData:()=>P?.(l)}),[Z,l,e.length,gt,w,P]),ft=ei(null);ft.current=Wt,Qn(()=>{R&&ft.current&&R(ft.current)},[]),Qn(()=>{if(v&&c){let N=Array.from(Z).map(z=>l[z]);c(N)}},[Z]);let Et=r("w-full","overflow-hidden",a),Gt=r("grid",`gap-${O}`,"w-full","mx-auto","items-start"),Pt={gridTemplateColumns:Be===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${he}px, calc(100%/${Be} - ${O*4}px), ${J}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return f?H(Ue,{className:"w-full",children:H(We,{className:"flex items-center justify-center py-12",children:Tt("div",{className:"text-center",children:[H("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),H("p",{className:"text-sm text-muted-foreground mb-4",children:f}),w&&Tt(y,{variant:"outline",size:"sm",onClick:w,children:[H(er,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):Tt("div",{className:r("w-full flex gap-2 flex-col h-full",Et),children:[u&&H(Ue,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:H(We,{className:"p-2",children:u})}),A&&H(Bo,{fields:o,filters:n,globalFilter:Fe,onGlobalFilterChange:St,fieldFilters:ve,onFieldFilterChange:Ce,sortField:Ae,sortDirection:ye,onSortChange:co,selectedCount:Z.size,totalCount:e.length,visibleCount:l.length,onExport:C?()=>P?.(l):void 0,onRefresh:w,loading:m,onClearFilters:Ze,onClearSorting:Lt}),H(Ue,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:H(We,{className:"px-0",children:Tt("div",{className:"relative",children:[m&&H("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:Tt("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[H(er,{className:"size-5 animate-spin text-primary"}),H("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),L.length>0?H("div",{className:r(Gt),style:Pt,children:L.map((N,z)=>{let F=Ve?(Ye-1)*Ie+z:z,K=Z.has(F);return Tt("div",{className:r("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",ne==="square"?"aspect-square":"",ne==="video"?"aspect-video":"",v?"cursor-pointer":"",K?"ring-2 ring-primary":""),onClick:()=>v&&$(F),children:[v&&G==="multiple"&&H("div",{className:"absolute top-2 right-2 z-10",children:H(yt,{checked:K,onCheckedChange:()=>$(F),className:"bg-background/80 backdrop-blur-sm",onClick:X=>X.stopPropagation()})}),t(N,z,K,()=>$(F))]},F)})}):Tt("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[H("div",{className:"text-6xl",children:g||"\u{1F4CB}"}),H("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:p}),(Fe||Object.values(ve).some(N=>N))&&H(y,{variant:"outline",onClick:Ze,children:"Clear Filters"})]})]})})}),Ve&&H("div",{className:"pb-1",children:H(Zn,{currentPage:Ye,totalPages:Q,pageSize:Ie,totalItems:l.length,onPageChange:je,onPageSizeChange:N=>{Bt(N),je(1)},config:s})}),d&&H("div",{className:"p-2 m-0.5",children:d}),b&&b(Wt)]})}import{Loader as ti,X as oi}from"lucide-react";import{AnimatePresence as ni,motion as ri}from"framer-motion";import*as ut from"react";import*as or from"react-dom";import{jsx as le,jsxs as $t}from"react/jsx-runtime";function nr({controller:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=ut.useState(!1);ut.useLayoutEffect(()=>{d(!0)},[]),ut.useEffect(()=>{function p(g){g.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=e.getSelectedItems(),f=t??m.length>0;return or.createPortal(le(ni,{children:f&&le(ri.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",s),...i,children:le(ht,{children:n})})}),a)}function rr({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:u,onClick:d,...a}){let m=le(y,{variant:t,size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:d,...a,children:n?le(ti,{className:"animate-spin"}):u});return o?$t(et,{children:[le(tt,{asChild:!0,children:m}),le(ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:le("p",{children:o})})]}):m}function ar({controller:e}){let t=ut.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return $t("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[$t("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),le(ao,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),$t(et,{children:[le(tt,{asChild:!0,children:le(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:le(oi,{className:"size-3.5"})})}),$t(ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[le("p",{children:"Clear selection"}),le("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:le("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as ii}from"react/jsx-runtime";var ai=({children:e,className:t})=>ii("div",{className:r("flex flex-col h-full gap-2",t),children:e});import{ArrowLeftIcon as ir}from"lucide-react";import{NavLink as si}from"react-router";import{jsx as _e,jsxs as Ut}from"react/jsx-runtime";var li=({className:e,title:t,description:o,backAction:n,metadata:s,children:i,childrenClassName:u})=>{let d=()=>{if(!n)return null;let m={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.href?_e(si,{to:n.href,children:_e(y,{...m,children:_e(ir,{className:"size-6"})})}):_e(y,{...m,onClick:n.onClick,children:_e(ir,{className:"size-6"})})},a=()=>!s||s.length===0?null:_e("div",{className:"flex gap-4",children:s.map((m,f)=>m.value&&Ut("div",{className:"text-sm",children:[Ut("span",{className:"text-muted-foreground",children:[m.label," "]}),_e("span",{children:m.value})]},f))});return Ut("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[Ut("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),Ut("div",{className:"flex flex-col gap-2 w-max",children:[_e("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&_e("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&_e("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",u),children:i})]})};import so from"react";import{jsx as Oe,jsxs as io}from"react/jsx-runtime";var sr="(min-width: 1024px)",di=()=>{let[e,t]=so.useState(()=>typeof window>"u"||window.matchMedia(sr).matches);return so.useEffect(()=>{let o=window.matchMedia(sr),n=()=>t(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[]),e},lr=e=>null,dr=e=>null,cr=e=>null,ci=({children:e,className:t,contentClassName:o})=>{let n=di(),s,i,u,d,a,m=so.Children.toArray(e).filter(g=>{if(so.isValidElement(g)){if(g.type===lr){let c=g.props;return s=c.children,i=c.className,!1}if(g.type===dr){let c=g.props;return u=c.children,d=c.className,!1}if(g.type===cr)return a=g.props,!1}return!0}),f=Oe("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),p=g=>{let{side:c="right"}=g,P=(g.overlay??!0)||!n,w=r("w-[420px] max-w-full",g.className),R=r("h-full bg-background",c==="right"?"border-l":"border-r"),b=Oe("div",{className:r("h-full p-2",o),children:m});return P?io("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[Oe("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:b}),io("div",{tabIndex:-1,inert:!g.open,className:r("absolute inset-0 z-20",!g.open&&"pointer-events-none"),children:[Oe("div",{className:r("absolute inset-0 bg-black/50 transition-opacity duration-500",g.open?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>g.onOpenChange(!1)}),Oe("div",{tabIndex:-1,className:r("absolute inset-y-0 z-50 h-full overflow-y-auto backdrop-blur-2xl","transition-all duration-500 ease-in-out",c==="right"?"right-0":"left-0",g.open?"translate-x-0 opacity-100":r(c==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),R,w),children:g.children})]})]}):io("div",{className:"flex relative flex-1 overflow-hidden",children:[c==="left"&&Oe("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,g.open?w:"w-0 border-0"),children:g.children}),Oe("div",{className:r("h-full flex-1 min-w-0 overflow-auto transition-all duration-500",g.open&&"overflow-y-auto overflow-x-hidden"),children:b}),c==="right"&&Oe("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,g.open?w:"w-0 border-0"),children:g.children})]})};return io("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&Oe("div",{className:r("border-b p-2",i),children:s}),a?p(a):f,u&&Oe("div",{className:r("border-t p-2",d),children:u})]})};import{jsx as mi}from"react/jsx-runtime";var ui=({className:e,children:t})=>t==null?null:mi("div",{className:r("flex items-center w-full gap-4 p-2 [&>*:last-child]:ml-auto",e),children:t});import{useState as ur}from"react";import{Copy as pi,Check as gi,Loader2Icon as fi}from"lucide-react";import{jsx as Je,jsxs as mr}from"react/jsx-runtime";var Eo=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(o){throw console.error("Failed to copy text:",o),o}}static CopyToClipboard=({text:t,children:o,className:n,size:s="icon",variant:i="ghost"})=>{let[u,d]=ur(!1),[a,m]=ur(!1),f=async()=>{if(!(!t||a)){m(!0);try{await this.copyToClipboard(t),d(!0),setTimeout(()=>d(!1),2e3)}catch(p){console.error("Failed to copy text:",p)}finally{m(!1)}}};return mr(et,{children:[Je(tt,{asChild:!0,children:Je(y,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:f,disabled:a||!t,children:a?Je(fi,{className:"animate-spin"}):u?Je(gi,{className:"h-3 w-3"}):o||Je(pi,{className:"h-3 w-3"})})}),Je(ot,{children:u?"Copied!":a?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:u=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let d=t<0,a=Math.abs(t),f=(u&&a>=1e5?this.compactFormatter:this.currencyFormatter).format(a).replace("\u20B9","");return`${n}${d?"- ":""}${i?"\u20B9 ":""}${f}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),d=String(i.getMonth()+1).padStart(2,"0"),a=this.MONTH_NAMES_SHORT[i.getMonth()],m=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${u}${s}${a}${s}${m}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${u}${s}${d}${s}${m}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((o,n,s)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(s[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:s=!0,size:i="md",variant:u="outline",customColors:d,icon:a,trueMessage:m="active",falseMessage:f="inactive"})=>{let p=typeof t=="boolean"?t?m:f:typeof t=="number"?t>0?m:f:t.toLowerCase(),g={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},c=g[p.toLowerCase()]||g.inactive,P=d||c[u],w={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},R=s?p.charAt(0).toUpperCase()+p.slice(1):p;return Je("div",{className:"flex justify-center",children:mr("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",P.bg,P.text,P.border,w[i],o),children:[n&&(a?Je("span",{className:"flex items-center",children:a}):Je("span",{className:r("size-2 rounded-full",P.dot),"aria-hidden":"true"})),R]})})}};import{AlertTriangleIcon as bi}from"lucide-react";import{useRouteError as xi,isRouteErrorResponse as hi,useNavigate as vi}from"react-router";import{Fragment as Go,jsx as ze,jsxs as Ft}from"react/jsx-runtime";var pr=()=>{let e=xi(),t=vi();return ze("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:Ft("div",{className:"flex flex-col items-center space-y-4 text-center",children:[ze(bi,{className:"h-16 w-16 text-destructive"}),hi(e)?Ft(Go,{children:[Ft("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?Ft(Go,{children:[ze("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&Ft("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[ze("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),ze("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):Ft(Go,{children:[ze("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),ze(y,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as Xe}from"framer-motion";import{jsx as q,jsxs as me}from"react/jsx-runtime";function yi({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return me(Xe.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[q("title",{children:"Animated Checkmark"}),q(Xe.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),q(Xe.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function gr(){return q(Ue,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:me(We,{className:"space-y-4 flex flex-col items-center justify-center",children:[q(Xe.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:me("div",{className:"relative",children:[q(Xe.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),q(yi,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),me(Xe.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[q(Xe.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),q("div",{className:"flex items-center gap-4",children:q(Xe.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:me("div",{className:"flex flex-col items-start gap-2",children:[me("div",{className:"space-y-1.5",children:[me("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[me("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"From"}),q("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),me("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),q("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),me("div",{className:"space-y-1.5",children:[me("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[me("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"To"}),q("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),me("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),q(Xe.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as lo,jsxs as Ci}from"react/jsx-runtime";var fr=()=>lo("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:Ci("div",{className:"flex flex-col items-center space-y-4",children:[lo("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),lo("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),lo("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as wi}from"react-router";import{GhostIcon as Ni}from"lucide-react";import{NavLink as Ti,useNavigate as Si}from"react-router";import{jsx as At,jsxs as _o}from"react/jsx-runtime";var br=()=>{let e=wi(),t=Si(),o=()=>{window.history.length>2?t(-1):t("/")};return _o("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[At(Ni,{className:"h-15 w-15 text-destructive mb-4"}),At("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),_o("p",{className:"text-xl mb-4",children:["The page ",At("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),_o("div",{className:"flex space-x-4",children:[At(y,{variant:"outline",onClick:o,children:"Go Back"}),At(y,{variant:"ghost",children:At(Ti,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as Pi}from"lucide-react";import{jsx as Oo,jsxs as Di}from"react/jsx-runtime";var xr=()=>Di("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[Oo(Pi,{className:"h-15 w-15 text-destructive mb-4"}),Oo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Oo("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as ki}from"lucide-react";import{NavLink as Ri,useNavigate as Mi}from"react-router";import{jsx as It,jsxs as hr}from"react/jsx-runtime";var vr=()=>{let e=Mi();return hr("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[It(ki,{className:"h-15 w-15 text-destructive mb-4"}),It("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),It("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),hr("div",{className:"flex space-x-4",children:[It(y,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),It(y,{variant:"ghost",children:It(Ri,{to:"/",children:"Go to Home"})})]})]})};export{ai as AppContainer,ci as AppContent,dr as AppContentFooter,lr as AppContentHeader,ui as AppFooter,li as AppHeader,cr as AppSheet,gr as CurrencyTransfer,qn as DataTable,Jn as DataTableActionBar,Xn as DataTableActionBarAction,Yn as DataTableActionBarSelection,tr as DataTemplate,nr as DataTemplateActionBar,rr as DataTemplateActionBarAction,ar as DataTemplateActionBarSelection,pr as ErrorComponent,Eo as GeneralHelper,fr as Loader,br as NotFound,xr as OfflineUI,vr as Unauthorized,Yt as getTableExportView,Bn as readPersistedExternal};
|
|
2
|
+
import{flexRender as ka,getCoreRowModel as Ra,getFilteredRowModel as Ma,getPaginationRowModel as za,getSortedRowModel as Fa,useReactTable as Aa}from"@tanstack/react-table";import{Loader2 as Un}from"lucide-react";import{Slot as Br}from"radix-ui";import{cva as Lr}from"class-variance-authority";import{clsx as Ar}from"clsx";import{twMerge as Ir}from"tailwind-merge";function r(...e){return Ir(Ar(e))}import{jsx as Er}from"react/jsx-runtime";var Kt=Lr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] 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 dark:focus-visible:border-ring",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 v({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?Br.Slot:"button";return Er(i,{"data-slot":"button",className:r(Kt({variant:t,size:o,className:e})),...s})}import{jsx as Qe}from"react/jsx-runtime";function ho({className:e,...t}){return Qe("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:Qe("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Jo({className:e,...t}){return Qe("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Xo({className:e,...t}){return Qe("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function Jt({className:e,...t}){return Qe("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function De({className:e,...t}){return Qe("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Yo({className:e,...t}){return Qe("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Ge({className:e,...t}){return Qe("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as Zo}from"react/jsx-runtime";function Ue({className:e,...t}){return Zo("div",{"data-slot":"card",className:r("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function We({className:e,...t}){return Zo("div",{"data-slot":"card-content",className:r("px-6",e),...t})}import{Tooltip as kt}from"radix-ui";import{jsx as Rt,jsxs as Gr}from"react/jsx-runtime";function vt({delayDuration:e=0,...t}){return Rt(kt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function et({...e}){return Rt(vt,{children:Rt(kt.Root,{"data-slot":"tooltip",...e})})}function tt({...e}){return Rt(kt.Trigger,{"data-slot":"tooltip-trigger",...e})}function ot({className:e,sideOffset:t=0,children:o,...n}){return Rt(kt.Portal,{children:Gr(kt.Content,{"data-slot":"tooltip-content",sideOffset:t,className:r("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[o,Rt(kt.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as ra,RefreshCw as aa,Download as ia,Settings2 as sa,Filter as hn,FilterX as la,ArrowUpDown as da,PinOff as ca,ChevronDown as ua,Calculator as ma,Check as pa,X as ga}from"lucide-react";import{jsx as _r}from"react/jsx-runtime";function Mt({className:e,type:t,...o}){return _r("input",{type:t,"data-slot":"input",className:r("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),...o})}import{DropdownMenu as ce}from"radix-ui";import{CheckIcon as Or,ChevronRightIcon as Vr,CircleIcon as Yi}from"lucide-react";import{jsx as le,jsxs as on}from"react/jsx-runtime";function ke({...e}){return le(ce.Root,{"data-slot":"dropdown-menu",...e})}function Re({...e}){return le(ce.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Me({className:e,sideOffset:t=4,...o}){return le(ce.Portal,{children:le(ce.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:r("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),...o})})}function vo({...e}){return le(ce.Group,{"data-slot":"dropdown-menu-group",...e})}function U({className:e,inset:t,variant:o="default",...n}){return le(ce.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:r("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),...n})}function Xt({className:e,children:t,checked:o,...n}){return on(ce.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:r("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:o,...n,children:[le("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:le(ce.ItemIndicator,{children:le(Or,{className:"size-4"})})}),t]})}function ne({className:e,inset:t,...o}){return le(ce.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:r("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function de({className:e,...t}){return le(ce.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function Qo({...e}){return le(ce.Sub,{"data-slot":"dropdown-menu-sub",...e})}function en({className:e,inset:t,children:o,...n}){return on(ce.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:r("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),...n,children:[o,le(Vr,{className:"ml-auto size-4"})]})}function tn({className:e,...t}){return le(ce.SubContent,{"data-slot":"dropdown-menu-sub-content",className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var Hr=new Set(["select","serialNumber"]);function Yt(e){let t=e.getVisibleLeafColumns().filter(n=>Hr.has(n.id)?!1:!!n.columnDef.exportValue||!!n.accessorFn),o=e.getPrePaginationRowModel().rows;return{columns:t.map(n=>{let s=n.columnDef;return{id:n.id,header:s.exportHeader??(typeof s.header=="string"?s.header:n.id)}}),rows:o.map(n=>t.map(s=>{let i=s.columnDef;return i.exportValue?i.exportValue(n.original):n.getValue(s.id)})),originals:o.map(n=>n.original)}}import{useEffect as fa,useRef as vn,useState as yn}from"react";import{useEffect as Kr,useState as dn}from"react";import{Calendar as Jr}from"lucide-react";import{format as Xr}from"date-fns";import{Popover as Zt}from"radix-ui";import{jsx as Qt}from"react/jsx-runtime";function nn({...e}){return Qt(Zt.Root,{"data-slot":"popover",...e})}function rn({...e}){return Qt(Zt.Trigger,{"data-slot":"popover-trigger",...e})}function an({className:e,align:t="center",sideOffset:o=4,...n}){return Qt(Zt.Portal,{children:Qt(Zt.Content,{"data-slot":"popover-content",align:t,sideOffset:o,className:r("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),...n})})}import*as eo from"react";import{ChevronDownIcon as jr,ChevronLeftIcon as $r,ChevronRightIcon as Ur}from"lucide-react";import{DayPicker as Wr,getDefaultClassNames as sn}from"react-day-picker";import{jsx as nt}from"react/jsx-runtime";function ln({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:u,...d}){let a=sn();return nt(Wr,{showOutsideDays:o,className:r("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:n,formatters:{formatMonthDropdown:m=>m.toLocaleString("default",{month:"short"}),...i},classNames:{root:r("w-fit",a.root),months:r("flex gap-4 flex-col md:flex-row relative",a.months),month:r("flex flex-col w-full gap-4",a.month),nav:r("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",a.nav),button_previous:r(Kt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(Kt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_next),month_caption:r("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",a.month_caption),dropdowns:r("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",a.dropdowns),dropdown_root:r("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",a.dropdown_root),dropdown:r("absolute bg-popover inset-0 opacity-0",a.dropdown),caption_label:r("select-none font-medium",n==="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",a.caption_label),table:"w-full border-collapse",weekdays:r("flex",a.weekdays),weekday:r("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",a.weekday),week:r("flex w-full mt-2",a.week),week_number_header:r("select-none w-(--cell-size)",a.week_number_header),week_number:r("text-[0.8rem] select-none text-muted-foreground",a.week_number),day:r("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",a.day),range_start:r("rounded-l-md bg-accent",a.range_start),range_middle:r("rounded-none",a.range_middle),range_end:r("rounded-r-md bg-accent",a.range_end),today:r("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",a.today),outside:r("text-muted-foreground aria-selected:text-muted-foreground",a.outside),disabled:r("text-muted-foreground opacity-50",a.disabled),hidden:r("invisible",a.hidden),...t},components:{Root:({className:m,rootRef:f,...p})=>nt("div",{"data-slot":"calendar",ref:f,className:r(m),...p}),Chevron:({className:m,orientation:f,...p})=>f==="left"?nt($r,{className:r("size-4",m),...p}):f==="right"?nt(Ur,{className:r("size-4",m),...p}):nt(jr,{className:r("size-4",m),...p}),DayButton:qr,WeekNumber:({children:m,...f})=>nt("td",{...f,children:nt("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...u},...d})}function qr({className:e,day:t,modifiers:o,...n}){let s=sn(),i=eo.useRef(null);return eo.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),nt(v,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":o.selected&&!o.range_start&&!o.range_end&&!o.range_middle,"data-range-start":o.range_start,"data-range-end":o.range_end,"data-range-middle":o.range_middle,className:r("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",s.day,e),...n})}import{jsx as yt,jsxs as Vt}from"react/jsx-runtime";function cn({value:e,onChange:t,placeholder:o,mode:n,externalSearch:s,onExternalChange:i,dateFormat:u,triggerClassName:d}){let a=u?u.replace(/Y/g,"y").replace(/D/g,"d"):null,[m,f]=dn(!1),[p,g]=dn(e);Kr(()=>{g(e)},[e]);let c=h=>{if(h==null)return null;if(h instanceof Date)return isNaN(h.getTime())?null:h;let y=new Date(h);return isNaN(y.getTime())?null:y},P=(h,y)=>{let A=c(h);return A?Xr(A,y):null},C=h=>{s?i?.(h):t?.(h)},R=()=>{C(p),f(!1)},b=()=>{g(e),f(!1)},D=()=>{let h=n==="single"?null:{from:null,to:null};g(h),C(h),f(!1)},T=()=>{let h=e;if(!h)return o;if(n==="single")return P(h,a||"PPP")??o;if(h.from&&h.to){let y=P(h.from,a||"MMM dd"),A=P(h.to,a||"MMM dd, yyyy");return y&&A?`${y} - ${A}`:o}if(h.from){let y=P(h.from,a||"MMM dd, yyyy");return y?`From ${y}`:o}if(h.to){let y=P(h.to,a||"MMM dd, yyyy");return y?`To ${y}`:o}return o},x=h=>{g(n==="single"?h:h||{from:null,to:null})};return Vt(nn,{open:m,onOpenChange:f,children:[yt(rn,{className:"h-8",asChild:!0,children:Vt(v,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",T()===o&&"text-muted-foreground",d),children:[yt(Jr,{className:"mr-2 h-4 w-4 shrink-0"}),T()]})}),Vt(an,{className:"w-auto p-0",align:"start",children:[yt("div",{className:"p-3",children:yt(ln,{mode:n,selected:p,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),Vt("div",{className:"flex items-center justify-between p-3 border-t",children:[yt(v,{variant:"ghost",size:"sm",onClick:D,children:"Clear"}),Vt("div",{className:"flex gap-2",children:[yt(v,{variant:"outline",size:"sm",onClick:b,children:"Cancel"}),yt(v,{size:"sm",onClick:R,disabled:n==="range"&&(!p?.from||!p?.to),children:"Apply"})]})]})]})]})}import{Calculator as Zr,ChevronDown as pn,Columns3 as Qr}from"lucide-react";import{Checkbox as un}from"radix-ui";import{CheckIcon as Yr}from"lucide-react";import{jsx as yo}from"react/jsx-runtime";function wt({className:e,...t}){return yo(un.Root,{"data-slot":"checkbox",className:r("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:yo(un.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:yo(Yr,{className:"size-3.5"})})})}import{jsx as L,jsxs as re}from"react/jsx-runtime";var mn=[{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"}],wo=(e,t)=>(t&&e.startsWith(`${t}.`)?e.replace(`${t}.`,""):e).split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");function Co(e,t){t&&Object.keys(e).forEach(o=>{let n=e[o];n&&t(o,{...n,enabled:!1,functions:[]})})}var gn=e=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1);function fn({table:e,aggregations:t,onAggregationChange:o}){let n=gn(e).filter(d=>d.id==="select"||d.id==="serialNumber"?!1:d.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(a=>{let m=a.getValue(d.id);return typeof m=="number"||typeof m=="string"&&!isNaN(parseFloat(String(m)))||typeof m=="object"&&m!==null&&"props"in m}));if(n.length===0||!o)return null;let s=Object.values(t).some(d=>d?.enabled),i=d=>{let a=t[d];o(d,{enabled:!a?.enabled,functions:a?.functions||["sum","average"]})},u=(d,a)=>{let m=t[d]?.functions||[],f=m.includes(a)?m.filter(p=>p!==a):[...m,a];o(d,{enabled:f.length>0,functions:f})};return re(ke,{children:[L(Re,{asChild:!0,children:re(v,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[L(Zr,{className:"size-4"}),L("span",{children:"Aggregations"}),L(pn,{className:"opacity-50 size-4"})]})}),re(Me,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[re(ne,{className:"flex items-center justify-between px-4 py-2",children:[L("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&L(v,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>Co(t,o),children:"Clear All"})]}),L(de,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return re(Qo,{children:[L(en,{className:"text-sm",children:re("div",{className:"flex items-center w-full gap-2",children:[L(wt,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),L("span",{className:r("flex-1",m&&"font-medium text-primary"),children:wo(d.id)}),m&&re("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(f=>L("div",{className:"w-2 h-2 rounded-full bg-primary",title:mn.find(p=>p.value===f)?.label},f)),a?.functions&&a.functions.length>2&&re("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),re(tn,{className:"w-48 rounded-lg",children:[L(ne,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),mn.map(f=>L(Xt,{checked:a?.functions?.includes(f.value)||!1,onCheckedChange:()=>u(d.id,f.value),className:"py-2 text-sm",children:re("div",{className:"flex flex-col",children:[L("span",{children:f.label}),L("span",{className:"text-xs text-muted-foreground",children:f.description})]})},f.value))]})]},d.id)})]})]})}function bn({table:e}){let t=gn(e),o=e.getAllColumns().filter(i=>!e.getAllLeafColumns().includes(i)&&i.columns?.length&&i.columns.some(u=>u.getCanHide?.()!==!1)),n=new Set(o.flatMap(i=>i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>u.id)||[])),s=t.filter(i=>!n.has(i.id));return re(ke,{children:[L(Re,{asChild:!0,children:re(v,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[L(Qr,{className:"size-4"}),L("span",{children:"Columns"}),L(pn,{className:"opacity-50 size-4"})]})}),re(Me,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[L(ne,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),L(de,{}),s.length>0&&re(vo,{children:[L(ne,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>L(Xt,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:u=>i.toggleVisibility(!!u),children:wo(i.id)},i.id))]}),o.map(i=>re(vo,{children:[L(de,{}),L(ne,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:i.id}),i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>L(Xt,{className:"text-sm",checked:u.getIsVisible(),onCheckedChange:d=>u.toggleVisibility(!!d),children:wo(u.id,i.id)},u.id))]},i.id))]})]})}import{Select as ge}from"radix-ui";import{CheckIcon as ea,ChevronDownIcon as xn,ChevronUpIcon as ta}from"lucide-react";import{jsx as ee,jsxs as No}from"react/jsx-runtime";function rt({...e}){return ee(ge.Root,{"data-slot":"select",...e})}function at({...e}){return ee(ge.Value,{"data-slot":"select-value",...e})}function it({className:e,size:t="default",children:o,...n}){return No(ge.Trigger,{"data-slot":"select-trigger","data-size":t,className:r("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),...n,children:[o,ee(ge.Icon,{asChild:!0,children:ee(xn,{className:"size-4 opacity-50"})})]})}function st({className:e,children:t,position:o="popper",...n}){return ee(ge.Portal,{children:No(ge.Content,{"data-slot":"select-content",className:r("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",o==="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:o,...n,children:[ee(oa,{}),ee(ge.Viewport,{className:r("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),ee(na,{})]})})}function _e({className:e,children:t,...o}){return No(ge.Item,{"data-slot":"select-item",className:r("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),...o,children:[ee("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:ee(ge.ItemIndicator,{children:ee(ea,{className:"size-4"})})}),ee(ge.ItemText,{children:t})]})}function oa({className:e,...t}){return ee(ge.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:ee(ta,{className:"size-4"})})}function na({className:e,...t}){return ee(ge.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:ee(xn,{className:"size-4"})})}import{Fragment as ba,jsx as k,jsxs as V}from"react/jsx-runtime";var te=e=>e.id??e.key;function To({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:d=!1,enableColumnVisibility:a=!0,onClearSorting:m,onClearFilters:f,enableColumnPinning:p=!1,onExternalSearch:g,initialExternalValues:c,aggregations:P={},onAggregationChange:C,groupedFilterLabel:R="Global",showFilterChips:b=!0,initialGroupedField:D,onGroupedFieldChange:T}){let[x,h]=yn(c??{}),[y,A]=yn(D??"all"),E=vn(c??{}),j=vn(void 0);fa(()=>()=>clearTimeout(j.current),[]);let _=(l,B,Q=!1)=>{let $={...E.current,[l]:B};E.current=$,h($),clearTimeout(j.current),Q?j.current=setTimeout(()=>g?.($),500):g?.($)},oe=()=>{clearTimeout(j.current),E.current={},h({}),A("all"),T?.("all"),f(),g?.({})},he=l=>t.find(Q=>te(Q)===l)?.externalSearch?x[l]??"":e.getColumn(l)?.getFilterValue(),J=(l,B)=>{let Q=t.find($=>te($)===l);Q?.externalSearch?_(l,B,Q.type==="text"):e.getColumn(l)?.setFilterValue(B)},ve=l=>{A(l),T?.(l),l!=="all"&&n("")},Ie=Object.values(P).some(l=>l?.enabled),Xe=l=>!!l.externalSearch||!!e.getColumn(te(l)),ye=l=>{let B=he(te(l));return B==null||B===""?!1:typeof B=="object"?!!(B.from||B.to):!0},mt=l=>l.type==="date"||l.type==="daterange",Be=l=>{J(te(l),mt(l)?null:"")},pt=l=>{let B=he(te(l));return l.type==="select"?l.options?.find(Q=>Q.value===B)?.label??String(B):mt(l)?"set":String(B)},we=(l,B)=>{let Q=B?.embedded;if(l.type==="select"){let $=te(l),gt=he($);return V(rt,{value:gt?String(gt):"",onValueChange:Ne=>J($,Ne==="__all__"?"":Ne),children:[k(it,{size:"sm",className:r("w-full",Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),children:V("span",{className:"flex items-center gap-2 truncate",children:[l.icon&&k(l.icon,{className:"size-4 shrink-0 text-muted-foreground"}),k(at,{placeholder:l.placeholder})]})}),V(st,{className:"rounded-lg",children:[k(_e,{value:"__all__",children:"All"}),l.options?.map(Ne=>k(_e,{value:Ne.value,children:Ne.label},Ne.value))]})]})}return l.type==="date"||l.type==="daterange"?k(cn,{value:he(te(l)),onChange:$=>J(te(l),$),placeholder:l.placeholder,mode:l.type==="daterange"?"range":"single",dateFormat:l.dateFormat,externalSearch:l.externalSearch,onExternalChange:$=>_(te(l),$),triggerClassName:Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":void 0}):V("div",{className:"relative w-full",children:[l.icon&&k(l.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),k(Mt,{placeholder:l.placeholder,value:he(te(l))??"",onChange:$=>{J(te(l),$.target.value)},className:r("h-8",l.icon&&"pl-9",Q?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),type:l.type==="number"?"number":"text"})]})},Ce=t.filter(l=>(l.placement??"bar")==="bar"),Y=t.filter(l=>l.placement==="menu"),me=s&&Y.length>0,Ye=Y.filter(ye),je=e.getState().columnFilters.length>0||!!o||t.some(ye),{left:Le=[],right:Bt=[]}=e.getState().columnPinning,Ee=Le.some(l=>l!=="serialNumber"&&l!=="select")||Bt.length>0,$e=[{value:"all",label:"All Fields"},...Y.map(l=>({value:te(l),label:l.placeholder}))];return V("div",{className:"flex flex-wrap items-center gap-3",children:[Ce.length>0&&k(hn,{className:"size-4 text-muted-foreground shrink-0"}),Ce.map(l=>Xe(l)?k("div",{className:r("relative min-w-[150px]",l.width),children:we(l)},te(l)):null),b&&Ye.map(l=>V("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[V("span",{className:"text-muted-foreground",children:[l.placeholder,":"]}),k("span",{className:"font-medium truncate max-w-[120px]",children:pt(l)}),k("button",{type:"button",onClick:()=>Be(l),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${l.placeholder}`,children:k(ga,{className:"size-3.5"})})]},`chip-${te(l)}`)),je&&V(v,{variant:"ghost",size:"sm",onClick:oe,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[k(la,{className:"size-4"}),"Clear Filters"]}),V("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&V("div",{className:r("flex items-center",me&&"bg-background border rounded-lg"),children:[me&&V(ke,{children:[k(Re,{asChild:!0,children:V(v,{variant:"ghost",size:"sm",className:"gap-1 border border-transparent border-r-border rounded-l-lg rounded-r-none hover:bg-transparent shrink-0 relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:[k("span",{className:"text-sm font-medium max-w-28 truncate",children:y==="all"?R:$e.find(l=>l.value===y)?.label}),k(ua,{className:"opacity-50 size-4"})]})}),k(Me,{align:"start",className:"w-48 rounded-lg",children:$e.map(l=>V(U,{onClick:()=>ve(l.value),className:"flex items-center justify-between",children:[k("span",{children:l.label}),y===l.value&&k(pa,{className:"size-4 text-primary"})]},l.value))})]}),(()=>{let l=me&&y!=="all"?Y.find(B=>te(B)===y):void 0;return l?k("div",{className:"w-48",children:we(l,{embedded:!0})}):V("div",{className:"relative",children:[k(ra,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),k(Mt,{placeholder:me?"Search all fields...":"Global search...",value:o??"",onChange:B=>n(B.target.value),className:r("pl-9 h-8 w-48",me&&"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]")})]})})()]}),k(fn,{table:e,aggregations:P,onAggregationChange:C}),a&&k(bn,{table:e}),V(ke,{children:[k(Re,{asChild:!0,children:k(v,{variant:"outline",size:"sm",className:"rounded-lg",children:k(sa,{className:"size-4"})})}),V(Me,{align:"end",className:"w-[200px] rounded-lg",children:[k(ne,{children:"Table Settings"}),k(de,{}),i&&V(U,{onClick:()=>{let l=Yt(e);i(l.originals,l)},children:[k(ia,{className:"size-4"}),"Export"]}),V(U,{onClick:m,disabled:e.getState().sorting.length===0,children:[k(da,{className:"size-4"}),"Clear All Sorting"]}),V(U,{onClick:oe,disabled:!je,children:[k(hn,{className:"size-4"}),"Clear All Filters"]}),Object.keys(P).length>0&&V(U,{onClick:()=>Co(P,C),disabled:!Ie,children:[k(ma,{className:"size-4"}),"Clear Aggregations"]}),p&&V(ba,{children:[k(de,{}),k(ne,{children:"Column Pinning"}),V(U,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Ee,children:[k(ca,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),u&&k(v,{variant:"outline",size:"sm",onClick:u,disabled:d,className:"rounded-lg",children:k(aa,{className:r("h-4 w-4",d&&"animate-spin")})})]})]})}import{ChevronLeft as xa,ChevronRight as ha}from"lucide-react";import{Fragment as ya,jsx as fe,jsxs as lt}from"react/jsx-runtime";function va(e,t,o=1){let n=e+1,s=o*2+5;if(t<=s)return Array.from({length:t},(p,g)=>g+1);let i=Math.max(n-o,1),u=Math.min(n+o,t),d=i>2,a=u<t-1,m=3+o*2,f=[];if(!d&&a){for(let p=1;p<=m;p++)f.push(p);f.push("ellipsis",t)}else if(d&&!a){f.push(1,"ellipsis");for(let p=t-m+1;p<=t;p++)f.push(p)}else{f.push(1,"ellipsis");for(let p=i;p<=u;p++)f.push(p);f.push("ellipsis",t)}return f}function So({table:e,config:t}){if(!t)return null;let o=e.getPageCount(),n=e.getState().pagination.pageIndex,s=e.getState().pagination.pageSize,i=e.getFilteredRowModel().rows.length,u="size-8 p-0 rounded-lg";return lt("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&<("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:["Showing ",i===0?0:n*s+1," to"," ",Math.min((n+1)*s,i)," of ",i," entries"]}),lt("div",{className:"flex items-center gap-3",children:[(()=>{let d=t.pageSizeOptions??[10,25,50,100,-1];if(d.length===0)return null;let a=d.includes(-1),m=i>0&&s>=i,f=a&&m?"-1":`${s}`;return lt("div",{className:"flex items-center gap-2",children:[fe("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),lt(rt,{value:f,onValueChange:p=>e.setPageSize(p==="-1"?Math.max(i,1):Number(p)),children:[fe(it,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:fe(at,{})}),fe(st,{side:"top",className:"rounded-lg",children:d.map(p=>fe(_e,{value:`${p}`,children:p===-1?"All":p},p))})]})]})})(),o>1&<("div",{className:"flex items-center gap-1",children:[fe(v,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:u,children:fe(xa,{className:"size-4"})}),t.showPageNumbers&<(ya,{children:[lt("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),fe("div",{className:"hidden items-center gap-1 sm:flex",children:va(n,o).map((d,a)=>d==="ellipsis"?fe("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):fe(v,{variant:d-1===n?"default":"outline",size:"sm",className:r(u,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),fe(v,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:u,children:fe(ha,{className:"size-4"})})]})]})]})}import{useCallback as Io,useEffect as be,useMemo as ao,useRef as Oe,useState as xe}from"react";function Ct(e,t){if(!t)return{};let o=e.getIsPinned();if(!o)return{};let n=e.getSize();return{position:"sticky",left:o==="left"?e.getStart("left"):void 0,right:o==="right"?e.getAfter("right"):void 0,width:n,minWidth:n,maxWidth:n,boxShadow:o==="right"&&e.getIsFirstColumn("right")?"inset 1px 0 0 0 var(--border)":void 0}}var ze=(e,t)=>t||e!==150?e:"auto";function wn(e,t){return{left:[...t,...(e.left??[]).filter(o=>!t.includes(o))],right:(e.right??[]).filter(o=>!t.includes(o))}}function Cn(e,t,o,n){if(o===!1)e.setColumnSizing(d=>{let a={...d};return delete a[t],a});else{let d=n.container?.querySelector(`[data-col-id="${t}"]`),a=d?Math.round(d.getBoundingClientRect().width):0;a>0&&e.setColumnSizing(m=>({...m,[t]:a}))}let{alwaysPinnedLeft:s}=n,i=e.getState().columnPinning,u={left:(i.left??[]).filter(d=>s.includes(d)),right:[...i.right??[]]};o==="right"?u.right.includes(t)||u.right.push(t):o==="left"?(u.right=u.right.filter(d=>d!==t),!u.left.includes(t)&&!s.includes(t)&&u.left.push(t)):(u.left=u.left.filter(d=>d!==t),u.right=u.right.filter(d=>d!==t)),e.setColumnPinning(u)}var Nn={sum:e=>e.reduce((t,o)=>t+o,0),average:e=>e.length>0?e.reduce((t,o)=>t+o,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((n,s)=>n-s),o=Math.floor(t.length/2);return t.length%2===0?(t[o-1]+t[o])/2:t[o]}};function Tn(e,t){if(!t||Object.keys(t).length===0)return{};let o={},n=e.getFilteredRowModel().rows;return Object.entries(t).forEach(([s,i])=>{if(!i?.enabled)return;let u=n.map(a=>{if(i.accessor)return i.accessor(a.original);let m=a.getValue(s);return typeof m=="number"?m:parseFloat(String(m))}).filter(a=>a!==null&&!isNaN(a)),d={};i.functions?.forEach(a=>{Nn[a]&&(d[a]=Nn[a](u))}),Object.keys(d).length>0&&(o[s]=d)}),o}function Sn(e,t){return typeof t=="number"?e==="count"||e==="unique"?t.toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):t}function wa(e,t){return t.split(".").reduce((o,n)=>o&&o[n],e)}function Pn(e,t=new Set){for(let o of e){let n=o.id??o.accessorKey;n&&t.add(String(n)),o.columns&&Pn(o.columns,t)}return t}function to(e,t){let o=Pn(e),n=[];for(let s of t){if(s.externalSearch)continue;let i=typeof s.filterFn=="function",u=i?s.id:s.key;if(!u||o.has(String(u)))continue;let d=s.key;n.push({id:String(u),accessorFn:d?a=>wa(a,d):()=>null,...i&&{filterFn:(a,m,f)=>s.filterFn(a.original,f)},enableHiding:!1,enableSorting:!1,enablePinning:!1,enableGlobalFilter:!1,meta:{filterOnly:!0}})}return n}import{jsx as Ht}from"react/jsx-runtime";function Dn({initialColumns:e,filters:t,showSerialNumbers:o,enableRowSelection:n,selectionMode:s,showCheckbox:i,enableHeaderCheckbox:u,isRowSelectable:d}){let a=p=>p.map(g=>{if(g.id==="select"||g.id==="serialNumber")return g;let c={...g,enablePinning:!0};return g.columns&&(c.columns=a(g.columns)),c}),m=a([...e]),f={id:"select",header:({table:p})=>{if(s==="single")return null;let g=p.getRowModel().rows.filter(C=>d?.(C.original)??!0),c=g.length>0&&g.every(C=>C.getIsSelected()),P=g.some(C=>C.getIsSelected());return Ht(wt,{checked:c||P&&"indeterminate",onCheckedChange:C=>{g.forEach(R=>R.toggleSelected(!!C))},disabled:!u||g.length===0,"aria-label":"Select all selectable rows"})},cell:({row:p})=>{let g=d?.(p.original)??!0;return Ht("div",{className:r("flex justify-center items-center",!g&&"opacity-50"),children:s==="multiple"?Ht(wt,{checked:p.getIsSelected(),onCheckedChange:c=>g&&p.toggleSelected(!!c),"aria-label":"Select row",disabled:!g}):i?Ht("input",{type:"radio",checked:p.getIsSelected(),onChange:()=>g&&p.toggleSelected(!0),disabled:!g,className:"border-primary rounded-full focus:ring-primary w-4 h-4 text-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:s==="multiple"?40:30};return n&&m.unshift(f),o&&m.unshift({id:"serialNumber",header:"No.",cell:({row:p})=>Ht("div",{className:"font-medium text-muted-foreground text-center",children:p.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...to(e,t)]}import{useEffect as Ca,useMemo as Na,useRef as Mo}from"react";var kn="atsui:tbl:v1:",ko=new Map,Rn=new Map;function oo(e){try{let t=localStorage.getItem(kn+e);return t?JSON.parse(t):void 0}catch{return}}function Mn(e,t){try{localStorage.setItem(kn+e,JSON.stringify(t))}catch{}}function zn(e){return e?typeof e=="string"?{key:e}:e:null}function Ro(e,t){return ko.get(e)??(t?oo(e):void 0)??{}}function Nt(e,t,o){let n={...Ro(e,t),...o};ko.set(e,n),t&&Mn(e,n)}var Do=new Map;function Fn(e,t){let o=Do.get(e);return o||(o=new Set,Do.set(e,o)),o.add(t),()=>{o.delete(t)}}function no(e){return{...oo("g:"+e)??{},...Rn.get(e)??{}}}function ro(e,t,o,n){let s=no(e),i=n==null||n==="";if(i?s[o]===void 0:s[o]===n)return;let u={...s};i?delete u[o]:u[o]=n,Rn.set(e,u),(t||oo("g:"+e)!==void 0)&&Mn("g:"+e,u),Do.get(e)?.forEach(d=>d())}function An(e,t){if(Nt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)ro(e.group,e.local,o,void 0)}function In(e){return(ko.get(e)??oo(e))?.external??{}}var Po=new Set;function Bn(e){return Po.has(e)&&console.warn(`[DataTable] persist key "${e}" is used by two mounted tables \u2014 they will overwrite each other's saved state. Give each table a unique key.`),Po.add(e),()=>{Po.delete(e)}}var zo=e=>{if(e==null||e instanceof Date)return e;let t=new Date(e);return isNaN(t.getTime())?e:t},Ln=e=>{if(e&&typeof e=="object"&&("from"in e||"to"in e)){let t=zo(e.from),o=zo(e.to);return t===e.from&&o===e.to?e:{from:t,to:o}}return zo(e)};function En(e,t,o){let n=zn(e),s=t.map(b=>({id:String(b.id??b.key),shared:b.shared,persist:b.persist!==!1,external:!!b.externalSearch,isDate:b.type==="date"||b.type==="daterange"})),i=Mo(s);i.current=s;let u=Na(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let b=Ro(n.key,n.local),D=n.group?no(n.group):{},T=y=>{let A=y.shared&&n.group?D[y.shared]:b.filters?.[y.id]??b.external?.[y.id];return y.isDate?Ln(A):A},x=[],h={};for(let y of s){if(!y.persist)continue;let A=T(y);A==null||A===""||(y.external?h[y.id]=A:x.push({id:y.id,value:A}))}return{columnFilters:x,globalFilter:b.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?b.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?b.pagination?.pageSize??o:o},external:h,groupedField:b.groupedField??"all"}},[]),d=Mo(u.pagination.pageIndex),a=Mo(u.pagination.pageIndex===0);return Ca(()=>{if(n)return!n.group&&i.current.some(b=>b.shared)&&console.warn(`[DataTable] persist key "${n.key}": filters use \`shared\` but the table has no \`persist.group\` \u2014 shared is inert. Add a group to enable it.`),Bn(n.key)},[]),{enabled:!!n,initial:u,persistFilters:b=>{if(!n)return;let D={};for(let x of b)D[x.id]=x.value;let T={};for(let x of i.current)!x.persist||x.external||(x.shared&&n.group?ro(n.group,n.local,x.shared,D[x.id]):D[x.id]!==void 0&&(T[x.id]=D[x.id]));Nt(n.key,n.local,{filters:T})},persistGlobalFilter:b=>{n&&Nt(n.key,n.local,{globalFilter:b})},persistExternal:b=>{if(!n)return;let D={};for(let T of i.current)!T.persist||!T.external||(T.shared&&n.group?ro(n.group,n.local,T.shared,b[T.id]):b[T.id]!==void 0&&(D[T.id]=b[T.id]));Nt(n.key,n.local,{external:D})},persistPagination:b=>{!n||n.pagination===!1||a.current&&Nt(n.key,n.local,{pagination:{pageIndex:b.pageIndex,pageSize:b.pageSize}})},persistGroupedField:b=>{n&&Nt(n.key,n.local,{groupedField:b})},restorePageIndex:(b,D)=>{if(!n||a.current||b.getCoreRowModel().rows.length===0)return;let T=Math.min(d.current,Math.max(b.getPageCount()-1,0));a.current=!0,T>0&&D({pageIndex:T,pageSize:b.getState().pagination.pageSize})},syncSharedSlots:b=>{if(!n?.group)return;let D=n.group,T=i.current.filter(x=>x.shared&&x.persist&&!x.external);if(T.length!==0)return Fn(D,()=>{let x=no(D);for(let h of T){let y=b.getColumn(h.id);if(!y)continue;let A=x[h.shared],E=A===void 0?void 0:h.isDate?Ln(A):A,j=y.getFilterValue();Object.is(j??void 0,E??void 0)||y.setFilterValue(E)}})},clearAll:()=>{n&&An(n,i.current.filter(b=>b.shared).map(b=>b.shared))}}}import{flexRender as Gn}from"@tanstack/react-table";import{ChevronUp as _n,ChevronDown as On,ChevronsUpDown as Vn,EyeOff as Ta,MoreHorizontal as Sa,MoveRightIcon as Pa,PinOffIcon as Da,Calculator as Hn}from"lucide-react";import{Fragment as Fo,jsx as G,jsxs as ae}from"react/jsx-runtime";function jn({table:e,aggregations:t,enableColumnPinning:o,enableColumnResizing:n,enableColumnVisibility:s,enableRowSelection:i,fixedCheckboxColumn:u,bordered:d,compact:a,onPinColumn:m}){let f=e.getVisibleLeafColumns().filter(g=>!g.getIsPinned()),p=f[f.length-1]?.id;return G(Fo,{children:e.getHeaderGroups().map(g=>G(De,{className:"hover:bg-transparent",children:g.headers.map((c,P)=>{let C=c.depth===0&&c.colSpan>1,R=o&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&i),b=o&&c.column.getIsPinned()==="right",D=c.column.getCanSort(),T=o&&c.column.columnDef.enablePinning!==!1,x=c.column.id==="serialNumber",h=c.column.id==="select",y=x||h&&u,A=c.column.columnDef.headerAlign||"left",E=t&&t[c.column.id]?.enabled,j=s&&!y&&c.column.getCanHide(),_=D||T&&!y||j,oe=c.column.getIsSorted(),he={left:"justify-start",center:"justify-center",right:"justify-end"}[A];return ae(Yo,{colSpan:c.colSpan,"data-col-id":C?void 0:c.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&P<g.headers.length-1&&c.column.id!==p&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar/95",b&&"sticky right-0 z-25 bg-sidebar/95",(x||h)&&"sticky left-0 z-25 bg-sidebar/95",C?"text-center":"text-left"),style:{width:ze(c.getSize(),R||b),minWidth:ze(c.getSize(),R||b),...Ct(c.column,o)},children:[C?ae("div",{className:"flex justify-center items-center",children:[Gn(c.column.columnDef.header,c.getContext()),E&&G(Hn,{className:"ml-1 w-3 h-3 text-primary"})]}):ae("div",{className:r("relative flex items-center px-2 w-full",he,D&&"cursor-pointer select-none"),onClick:D?J=>{J.target.closest("button, a, input, select, [role=button], [role=checkbox]")||c.column.getToggleSortingHandler()?.(J)}:void 0,children:[ae("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",oe&&"pr-6"),children:[E&&G(Hn,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),c.isPlaceholder?null:G("span",{className:"truncate",children:Gn(c.column.columnDef.header,c.getContext())})]}),(_||D)&&ae("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[G("div",{className:r("absolute inset-0 bg-gradient-to-l from-sidebar from-45% to-transparent","transition-opacity duration-200 ease-out","opacity-0 group-hover:opacity-100 group-has-[[data-state=open]]:opacity-100")}),D&&G("span",{className:"relative shrink-0",children:oe?oe==="asc"?G(_n,{className:"w-4 h-4"}):G(On,{className:"w-4 h-4"}):G(Vn,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),_&&ae(ke,{children:[G(Re,{asChild:!0,children:G(v,{variant:"ghost",size:"icon",tabIndex:-1,"aria-label":"Column options",onClick:J=>J.stopPropagation(),className:r("relative size-6 rounded-sm pointer-events-auto overflow-hidden","bg-sidebar hover:bg-border dark:bg-sidebar dark:hover:bg-accent","w-0 opacity-0 ml-0 group-hover:w-5 group-hover:opacity-100",D&&"group-hover:ml-0.5","data-[state=open]:w-5 data-[state=open]:opacity-100",D&&"data-[state=open]:ml-0.5","transition-all duration-200 ease-out"),children:G(Sa,{className:"w-4 h-4"})})}),ae(Me,{align:"end",className:"w-48",onClick:J=>J.stopPropagation(),children:[D&&ae(Fo,{children:[G(ne,{children:"Sorting"}),ae(U,{onClick:()=>c.column.toggleSorting(!1),disabled:oe==="asc",children:[G(_n,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),ae(U,{onClick:()=>c.column.toggleSorting(!0),disabled:oe==="desc",children:[G(On,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),ae(U,{onClick:()=>c.column.clearSorting(),disabled:!oe,children:[G(Vn,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(T&&!y||j)&&G(de,{})]}),T&&!y&&ae(Fo,{children:[G(ne,{children:"Pin Column"}),ae(U,{onClick:()=>m(c.column.id,"right"),disabled:c.column.getIsPinned()==="right",children:[G(Pa,{}),"Pin Right"]}),ae(U,{onClick:()=>m(c.column.id,!1),disabled:!c.column.getIsPinned(),children:[G(Da,{}),"Unpin"]}),j&&G(de,{})]}),j&&ae(U,{onClick:()=>c.column.toggleVisibility(!1),children:[G(Ta,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),G("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",E?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&c.column.getCanResize()&&!C&&c.colSpan===1&&G("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 select-none touch-none",onMouseDown:c.getResizeHandler(),onTouchStart:c.getResizeHandler(),onClick:J=>J.stopPropagation()})]},c.id)})},g.id))})}import{jsx as qe,jsxs as Ao}from"react/jsx-runtime";function $n({table:e,columnAggregations:t,aggregations:o,enableColumnPinning:n,enableRowSelection:s,showSerialNumbers:i,compact:u}){let d=Object.keys(t).length>0,a=e.getHeaderGroups()[0]?.headers.some(c=>c.column.columnDef.customFooter),m=i&&e.getFilteredRowModel().rows.length>0&&(d||a),f=e.getHeaderGroups()[0]?.headers.length??0,p=e.getVisibleLeafColumns().filter(c=>!c.getIsPinned()),g=p[p.length-1]?.id;return!d&&!a&&!m?null:qe(Jt,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:qe(De,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((c,P)=>{let C=c.column.id,R=t[C],b=n&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&s),D=n&&c.column.getIsPinned()==="right",T=c.column.id==="serialNumber",x=c.column.id==="select",y=c.column.columnDef.customFooter;return R||y||T&&m?Ao(Ge,{className:r("relative px-2 py-2 font-semibold text-sm",P<f-1&&"border-r",u&&"py-1",b&&"sticky left-0 z-30 bg-sidebar",D&&"sticky right-0 z-30 bg-sidebar",(T||x)&&"sticky left-0 z-30 bg-sidebar",y?.className),style:{width:ze(c.getSize(),b||D),minWidth:ze(c.getSize(),b||D),...Ct(c.column,n)},children:[qe("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(y?.content){let E=typeof y.content=="function"?y.content(e):y.content;return qe("div",{className:r("w-full h-full",y.align==="center"&&"text-center",y.align==="right"&&"text-right",y.align==="left"&&"text-left"),children:E})}return R?qe("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(R).map(([E,j])=>Ao("div",{className:"flex justify-between items-center text-muted-foreground",children:[qe("span",{className:"text-xs capitalize",children:E}),qe("span",{className:"font-medium text-foreground",children:o?.[C]?.format?.(j,E)??Sn(E,j)})]},E))}):T&&m?Ao("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${c.id}`):qe(Ge,{className:r("relative px-0 py-0",P<f-1&&c.column.id!==g&&"border-r",u&&"py-0",b&&"sticky left-0 z-30 bg-sidebar",D&&"sticky right-0 z-30 bg-sidebar",(T||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:ze(c.getSize(),b||D),minWidth:ze(c.getSize(),b||D),...Ct(c.column,n)},children:qe("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${c.id}`)})})})}import{jsx as S,jsxs as Tt}from"react/jsx-runtime";function Wn({data:e,columns:t,filters:o=[],pagination:n,settings:s={},header:i,footer:u,className:d="",maxHeight:a="100%",loading:m=!1,error:f,emptyMessage:p="No data available",onRowSelectionChange:g,onExport:c,onRefresh:P,onTableReady:C,children:R,isRowSelectable:b,getRowId:D,defaultSelectedRows:T,onExternalSearch:x,aggregations:h={},onAggregationChange:y,rowClassName:A,persist:E}){let j=!!n,_=En(E,o,n?.pageSize||10),oe=Oe(_.initial.external),[he,J]=xe([]),[ve,Ie]=xe(_.initial.columnFilters),[Xe,ye]=xe(_.initial.pagination),[mt,Be]=xe(()=>Object.fromEntries(to(t,o).map(w=>[w.id,!1]))),[pt,we]=xe({}),[Ce,Y]=xe(_.initial.globalFilter),[me,Ye]=xe([]),[je,Le]=xe(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Bt=Oe(null),Ee=Oe(null),$e=Oe(null),l=Oe(null),[B,Q]=xe(0),[$,gt]=xe(0),[Ne,uo]=xe(0),Ze=Oe(null),[Lt,Wt]=xe(!1),{enableSorting:ft=!0,enableFiltering:Et=!0,enableGlobalFilter:Gt=!0,enableColumnVisibility:Pt=!0,enableRowSelection:N=!0,showToolbar:z=!1,enableHeaderCheckbox:F=!0,toolbarPosition:K="default",showSerialNumbers:X=!0,fixedCheckboxColumn:Te=!0,striped:bt=!0,hoverable:xt=!0,compact:qt=!0,bordered:mo=!0,fullHeight:Vo=!1,enableColumnResizing:Ho=!1,enableColumnPinning:Se=!0,showHeader:vr=!0,selectionMode:Dt="multiple",showCheckbox:jo=!0,groupedFilterLabel:yr="Global",showFilterChips:wr=!0}=s;be(()=>{o.length>0&&!z&&console.warn("[DataTable] `filters` are provided but settings.showToolbar is off \u2014 filters live in the toolbar, so none will render."),o.some(w=>w.placement==="menu")&&!Gt&&console.warn("[DataTable] placement:'menu' filters are reached through the global search's field picker \u2014 with enableGlobalFilter off they are unreachable (only their chips would show).")},[]),be(()=>{let w=()=>{Ze.current&&Wt(Ze.current.scrollTop>0)},O=Ze.current;if(O)return O.addEventListener("scroll",w),()=>O.removeEventListener("scroll",w)},[]),be(()=>{let w=()=>{Ee.current&&Q(Ee.current.offsetHeight+16),$e.current&>($e.current.offsetHeight+16),l.current&&uo(l.current.offsetHeight+16)};w();let O=new ResizeObserver(()=>{setTimeout(w,50)});return Ee.current&&O.observe(Ee.current),$e.current&&O.observe($e.current),l.current&&O.observe(l.current),()=>{O.disconnect()}},[z,i,K]),be(()=>{_.persistFilters(ve)},[ve]),be(()=>{_.persistGlobalFilter(Ce)},[Ce]),be(()=>{_.persistPagination(Xe)},[Xe]);let Cr=w=>{oe.current=w,_.persistExternal(w),x?.(w)},po=ao(()=>Dn({initialColumns:t,filters:o,showSerialNumbers:X,enableRowSelection:N,selectionMode:Dt,showCheckbox:jo,enableHeaderCheckbox:F,isRowSelectable:b}),[t,o,X,N,b,Dt,jo,F]),I=Aa({data:e,columns:po,getRowId:D,onSortingChange:ft?J:void 0,onColumnFiltersChange:Et?Ie:void 0,onGlobalFilterChange:Gt?Y:void 0,getCoreRowModel:Ra(),getPaginationRowModel:j?za():void 0,getSortedRowModel:ft?Fa():void 0,getFilteredRowModel:Et?Ma():void 0,onColumnVisibilityChange:Pt?Be:void 0,onRowSelectionChange:N?we:void 0,onColumnOrderChange:Ye,onColumnPinningChange:Se?w=>Le(O=>wn(typeof w=="function"?w(O):w,[...X?["serialNumber"]:[],...N?["select"]:[]])):void 0,state:{sorting:ft?he:void 0,columnFilters:Et?ve:void 0,columnVisibility:Pt?mt:void 0,rowSelection:N?pt:{},globalFilter:Ce,pagination:j?Xe:void 0,columnOrder:me,columnPinning:Se?je:{}},onPaginationChange:j?ye:void 0,initialState:{columnPinning:Se?{left:[...X?["serialNumber"]:[],...N?["select"]:[]],right:[]}:void 0},enableRowSelection:N?w=>b?.(w.original)??!0:!1,enableColumnResizing:Ho,enableColumnPinning:Se,columnResizeMode:"onChange"}),go=ao(()=>Tn(I,h),[I,h,e,ve,Ce]),Nr=ao(()=>Object.keys(go).length>0||po.some(w=>w.customFooter),[go,po]),$o=Oe({onRowSelectionChange:g,isRowSelectable:b});$o.current={onRowSelectionChange:g,isRowSelectable:b};let Uo=Oe(!1);be(()=>{if(Uo.current||!T||!N)return;let w=I.getCoreRowModel().rows;if(w.length===0)return;let O={};for(let ht of w)ht.getCanSelect()&&T(ht.original)&&(O[ht.id]=!0);Uo.current=!0,Object.keys(O).length>0&&we(O)},[T,N,I,e]),be(()=>{let{onRowSelectionChange:w,isRowSelectable:O}=$o.current;if(N&&w){let ht=I.getFilteredSelectedRowModel().rows.filter(Ot=>O?.(Ot.original)??!0).map(Ot=>Ot.original);w(ht)}},[pt,N,I]);let Tr=Io(w=>{Dt==="single"?(I.resetRowSelection(),w.toggleSelected(!0)):w.toggleSelected()},[Dt,I]),Wo=Oe(C);Wo.current=C,be(()=>{Wo.current?.(I)},[I]);let qo=Oe(!1);be(()=>{qo.current||(qo.current=!0,Object.keys(_.initial.external).length>0&&x?.(_.initial.external))},[]),be(()=>_.syncSharedSlots(I),[I]),be(()=>{j&&_.restorePageIndex(I,ye)},[e]);let Sr=Io(()=>{J([])},[]),Pr=Io(()=>{Ie([]),Y(""),_.clearAll()},[]),Dr=(w,O)=>{Se&&Cn(I,w,O,{container:Ze.current,alwaysPinnedLeft:[...X?["serialNumber"]:[],...N&&Te?["select"]:[]]})},kr=w=>w&&typeof w=="object"&&"content"in w,Pe=ao(()=>i?kr(i)?{content:i.content,align:i.align||"left",className:i.className||"",showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",showOnEmpty:!0}:null,[i]);if(f)return S(Ue,{className:"shadow-sm rounded-xl w-full",children:S(We,{className:"flex justify-center items-center",children:Tt("div",{className:"text-center",children:[S("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),S("p",{className:"mb-4 text-muted-foreground text-sm",children:f}),P&&Tt(v,{variant:"outline",size:"sm",onClick:P,className:"rounded-lg",children:[S(Un,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let fo=()=>z?S(To,{table:I,filters:o,globalFilter:Ce,onGlobalFilterChange:w=>Y(w),enableGlobalFilter:Gt,onExport:c,onRefresh:P,loading:m,enableColumnVisibility:Pt,enableColumnPinning:Se,showFilterChips:wr,onClearSorting:Sr,onClearFilters:Pr,onExternalSearch:Cr,initialExternalValues:oe.current,aggregations:h,onAggregationChange:y,groupedFilterLabel:yr,initialGroupedField:_.initial.groupedField,onGroupedFieldChange:_.persistGroupedField}):null,Rr=()=>{let w=0;return K==="above-header"&&(w+=B),Pe&&(w+=Ne),K==="below-header"&&(w+=$),w},Ko=I.getVisibleLeafColumns().filter(w=>!w.getIsPinned()),Mr=Ko[Ko.length-1]?.id,_t=Math.max(I.getVisibleLeafColumns().length,1);return S(vt,{children:Tt("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[z&&K==="default"&&S("div",{ref:Bt,className:"z-40 relative",children:fo()}),S(Ue,{className:r("shadow-sm overflow-hidden py-0",Vo&&"flex-1 min-h-0"),children:S(We,{className:"h-full p-0",children:Tt("div",{className:"relative flex flex-col justify-between h-full",children:[m&&S("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:Tt("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[S(Un,{className:"size-5 text-primary animate-spin"}),S("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),S("div",{ref:Ze,className:r("relative overflow-auto rounded-t-xl",Vo?"flex-1 min-h-0":I.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:Tt(ho,{className:r("w-full border-separate border-spacing-0 relative",I.getState().columnSizingInfo.isResizingColumn&&"select-none",I.getRowModel().rows?.length===0&&"h-full"),children:[z&&K==="above-header"&&S("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:S(De,{className:"hover:bg-transparent",children:S(Ge,{colSpan:_t,className:"p-2 bg-sidebar border-b shadow-sm",children:S("div",{ref:Ee,children:fo()})})})}),Pe&&(Pe.showOnEmpty||I.getRowModel().rows?.length>0)&&S("thead",{className:r("sticky bg-sidebar border-b",Lt&&"shadow-sm"),style:{top:K==="above-header"?`${B}px`:"0px",zIndex:35},children:S(De,{className:"hover:bg-transparent",children:S(Ge,{colSpan:_t,className:r("bg-sidebar p-2 font-semibold text-foreground",qt?"py-2":"py-4",Pe.className),children:S("div",{ref:l,className:r("flex items-center w-full",Pe.align==="center"&&"justify-center",Pe.align==="right"&&"justify-end",Pe.align==="left"&&"justify-start"),children:typeof Pe.content=="string"?S("span",{className:"font-bold text-foreground text-lg tracking-tight",children:Pe.content}):Pe.content})})})}),z&&K==="below-header"&&S("thead",{className:r("sticky bg-sidebar border-b",Lt&&"shadow-sm"),style:{top:Pe?`${Ne}px`:"0px",zIndex:35},children:S(De,{className:"hover:bg-transparent",children:S(Ge,{colSpan:_t,className:"bg-sidebar p-2",children:S("div",{ref:$e,children:fo()})})})}),vr&&S(Jo,{className:r("sticky bg-sidebar [&_tr]:border-b-0",Lt&&"shadow-sm"),style:{top:`${Rr()}px`,zIndex:30},children:S(jn,{table:I,aggregations:h,enableColumnPinning:Se,enableColumnResizing:Ho,enableColumnVisibility:Pt,enableRowSelection:N,fixedCheckboxColumn:Te,bordered:mo,compact:qt,onPinColumn:Dr})}),S(Xo,{children:I.getRowModel().rows?.length?I.getRowModel().rows.map((w,O)=>{let ht=O===I.getRowModel().rows.length-1,Ot=A?A(w):"";return S(De,{"data-index":O,"data-state":w.getIsSelected()&&"selected",className:r(xt&&"hover:bg-muted/50",bt&&O%2===0&&"bg-muted/20",w.getIsSelected()&&"bg-muted",Dt==="single"&&"cursor-pointer",Ot),onClick:()=>{Dt==="single"&&Tr(w)},children:w.getVisibleCells().map((pe,zr)=>{let bo=Se&&(pe.column.getIsPinned()==="left"||pe.column.id==="serialNumber"||pe.column.id==="select"&&N),xo=Se&&pe.column.getIsPinned()==="right",Fr=pe.column.id==="serialNumber";return S(Ge,{className:r(qt?"py-2":"py-4",mo&&zr<w.getVisibleCells().length-1&&pe.column.id!==Mr&&"border-r",(!ht||!Nr)&&"border-b",bo&&"sticky left-0 z-20 bg-sidebar/95",Fr&&"sticky left-0 z-20 bg-card/95",xo&&"sticky right-0 z-20 bg-sidebar/95","p-1"),style:{width:ze(pe.column.getSize(),bo||xo),minWidth:ze(pe.column.getSize(),bo||xo),...Ct(pe.column,Se)},children:ka(pe.column.columnDef.cell,pe.getContext())},pe.id)})},w.id)}):S(De,{children:S(Ge,{colSpan:_t,className:"border-0 h-32 text-center",children:Tt("div",{className:"flex flex-col items-center gap-3",children:[S("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),S("p",{className:"font-medium text-muted-foreground",children:p})]})})})}),S($n,{table:I,columnAggregations:go,aggregations:h,enableColumnPinning:Se,enableRowSelection:N,showSerialNumbers:X,bordered:mo,compact:qt})]})}),u&&S("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:S(ho,{children:S(Jt,{children:S(De,{className:"bg-sidebar",children:S(Ge,{colSpan:_t,className:"p-2",children:u})})})})})]})})}),S(So,{table:I,config:n}),R&&R(I)]})})}import{Separator as Ia}from"radix-ui";import{jsx as Ba}from"react/jsx-runtime";function io({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return Ba(Ia.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:r("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}import{Loader as La,X as Ea}from"lucide-react";import{AnimatePresence as Ga,motion as _a}from"framer-motion";import*as dt from"react";import*as qn from"react-dom";import{jsx as ie,jsxs as jt}from"react/jsx-runtime";function Kn({table:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=dt.useState(!1);dt.useLayoutEffect(()=>{d(!0)},[]),dt.useEffect(()=>{function f(p){p.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=t??e.getFilteredSelectedRowModel().rows.length>0;return qn.createPortal(ie(Ga,{children:m&&ie(_a.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",s),...i,children:ie(vt,{children:n})})}),a)}function Jn({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...u}){let d=ie(v,{variant:"secondary",size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...u,children:o?ie(La,{className:"animate-spin"}):i});return t?jt(et,{children:[ie(tt,{asChild:!0,children:d}),ie(ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:ie("p",{children:t})})]}):d}function Xn({table:e}){let t=dt.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?jt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[jt("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),ie(io,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),jt(et,{children:[ie(tt,{asChild:!0,children:ie(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:ie(Ea,{className:"size-3.5"})})}),jt(ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[ie("p",{children:"Clear selection"}),ie("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:ie("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{useState as ct,useEffect as Zn,useMemo as Lo,useCallback as zt,useRef as Ya}from"react";import{Loader2 as Qn}from"lucide-react";import{Search as Oa,Download as Va,RefreshCw as Ha,Filter as ja,ChevronDown as $a,Settings2 as Ua}from"lucide-react";import{Fragment as Wa,jsx as M,jsxs as Z}from"react/jsx-runtime";function Bo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:d,onSortChange:a,selectedCount:m,totalCount:f,visibleCount:p,onExport:g,onRefresh:c,loading:P,onClearFilters:C,onClearSorting:R}){let b=e.filter(x=>x.sortable),D=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",T=u!=="";return M("div",{className:"rounded-xl p-0.5",children:M("div",{className:"px-2",children:M("div",{className:"flex flex-col gap-6",children:Z("div",{className:"flex items-center justify-between",children:[M("div",{className:"flex items-center gap-3",children:t.length>0&&Z("div",{className:"flex items-center gap-3 flex-wrap",children:[M("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:M(ja,{className:"h-4 w-4"})}),t.map(x=>M("div",{className:"relative min-w-[150px]",children:x.type==="select"?Z(rt,{value:s[x.key]||"all",onValueChange:h=>i(x.key,h),children:[x.icon&&M(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),M(it,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:M(at,{placeholder:x.placeholder||"Select..."})}),Z(st,{className:"rounded-lg",children:[M(_e,{value:"all",children:"All"}),x.options?.map(h=>M(_e,{value:h.value,children:h.label},h.value))]})]}):Z("div",{className:"relative",children:[x.icon&&M(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),M(Mt,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:h=>i(x.key,h.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),Z("div",{className:"flex items-center gap-2",children:[Z("div",{className:"relative",children:[M(Oa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),M(Mt,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),b.length>0&&Z(ke,{children:[M(Re,{asChild:!0,children:Z(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[M("span",{children:"Sort"}),M($a,{className:"h-4 w-4 opacity-50"})]})}),Z(Me,{align:"end",className:"w-[200px] rounded-lg",children:[M(ne,{children:"Sort By"}),M(de,{}),b.map(x=>Z("div",{children:[Z(U,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),Z(U,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),T&&Z(Wa,{children:[M(de,{}),M(U,{onClick:R,children:"Clear All Sorting"})]})]})]}),Z(ke,{children:[M(Re,{asChild:!0,children:M(v,{variant:"outline",size:"sm",className:"rounded-lg",children:M(Ua,{className:"h-4 w-4"})})}),Z(Me,{align:"end",className:"w-[200px] rounded-lg",children:[M(ne,{children:"Table Settings"}),M(de,{}),M(U,{onClick:R,children:"Clear All Sorting"}),M(U,{onClick:C,children:"Clear All Filters"})]})]}),g&&Z(v,{variant:"outline",size:"sm",onClick:g,className:"rounded-lg",children:[M(Va,{className:"mr-2 h-4 w-4"}),"Export"]}),c&&M(v,{variant:"outline",size:"sm",onClick:c,disabled:P,className:"rounded-lg",children:M(Ha,{className:r("h-4 w-4",P&&"animate-spin")})})]})]})})})})}import{ChevronLeft as qa,ChevronRight as Ka,ChevronsLeft as Ja,ChevronsRight as Xa}from"lucide-react";import{jsx as W,jsxs as Fe}from"react/jsx-runtime";function Yn({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:u}){if(!u)return null;let d=u.pageSizeOptions||[10,20,50,100],a=(e-1)*o+1,m=Math.min(e*o,n),f=e>1,p=e<t,g=()=>{let P=[],C=[];for(let R=Math.max(2,e-2);R<=Math.min(t-1,e+2);R++)P.push(R);return e-2>2?C.push(1,"..."):C.push(1),C.push(...P),e+2<t-1?C.push("...",t):t>1&&C.push(t),C};return W("div",{className:"rounded-xl",children:Fe("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[W("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&Fe("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),Fe("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&Fe("div",{className:"flex items-center gap-2",children:[W("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Fe(rt,{value:`${o}`,onValueChange:c=>i(Number(c)),children:[W(it,{className:"h-9 w-[70px] rounded-lg",children:W(at,{})}),W(st,{side:"top",className:"rounded-lg",children:d.map(c=>W(_e,{value:`${c}`,children:c},c))})]})]}),Fe("div",{className:"flex items-center gap-2",children:[Fe(v,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!f,className:"hidden sm:flex rounded-lg",children:[W(Ja,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to first page"})]}),Fe(v,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!f,className:"rounded-lg",children:[W(qa,{className:"h-4 w-4 sm:mr-2"}),W("span",{className:"hidden sm:inline",children:"Previous"}),W("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&W("div",{className:"hidden sm:flex items-center gap-1",children:g().map((c,P)=>{if(c==="...")return W("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${P}`);let C=c;return W(v,{variant:C===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(C),children:C},C)})}),Fe("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),Fe(v,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!p,className:"rounded-lg",children:[W("span",{className:"hidden sm:inline",children:"Next"}),W(Ka,{className:"h-4 w-4 sm:ml-2"}),W("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Fe(v,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!p,className:"hidden sm:flex rounded-lg",children:[W(Xa,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as H,jsxs as St}from"react/jsx-runtime";function er({data:e,template:t,fields:o=[],filters:n=[],pagination:s,settings:i={},header:u,footer:d,className:a="",loading:m=!1,error:f,emptyMessage:p="No items found",emptyIcon:g,onSelectionChange:c,onExport:P,onRefresh:C,onTemplateReady:R,children:b}){let{enableSorting:D=!0,enableFiltering:T=!0,enableGlobalSearch:x=!0,enableSelection:h=!1,enableExport:y=!1,showToolbar:A=!0,selectionMode:E="multiple",gridCols:j={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:_=4,aspectRatio:oe="auto",minCardWidth:he=350,maxCardWidth:J=350}=i,ve=!!s,[Ie,Xe]=ct(""),[ye,mt]=ct({}),[Be,pt]=ct(""),[we,Ce]=ct("asc"),[Y,me]=ct(new Set),[Ye,je]=ct(1),[Le,Bt]=ct(s?.pageSize||12),[Ee,$e]=ct(j.default),l=Lo(()=>{let N=[...e];if(x&&Ie){let z=o.filter(F=>F.searchable!==!1);N=N.filter(F=>z.some(K=>F[K.key]?.toString().toLowerCase().includes(Ie.toLowerCase())))}if(T&&Object.keys(ye).forEach(z=>{let F=ye[z];if(F!=null&&F!==""){let K=o.find(X=>X.key===z);K&&(N=N.filter(X=>{let Te=X[z];return K.type==="boolean"?Te===(F==="true"):K.type==="number"?Te===Number(F):Te?.toString().toLowerCase().includes(String(F).toLowerCase())}))}}),D&&Be){let z=o.find(F=>F.key===Be);z&&N.sort((F,K)=>{let X=F[Be],Te=K[Be];if(z.type==="number")return we==="asc"?Number(X)-Number(Te):Number(Te)-Number(X);if(z.type==="date"){let bt=new Date(X),xt=new Date(Te);return we==="asc"?bt.getTime()-xt.getTime():xt.getTime()-bt.getTime()}else{let bt=String(X).toLowerCase(),xt=String(Te).toLowerCase();return we==="asc"?bt.localeCompare(xt):xt.localeCompare(bt)}})}return N},[e,Ie,ye,Be,we,o,x,T,D]),B=Lo(()=>{if(!ve)return l;let N=(Ye-1)*Le,z=N+Le;return l.slice(N,z)},[l,Ye,Le,ve]),Q=Math.ceil(l.length/Le),$=zt(N=>{h&&me(z=>{let F=new Set(z);return E==="single"?(F.clear(),F.add(N)):F.has(N)?F.delete(N):F.add(N),F})},[h,E]),gt=zt(()=>{!h||E==="single"||(Y.size===l.length?me(new Set):me(new Set(l.map((N,z)=>z))))},[h,E,Y.size,l.length]),Ne=zt((N,z)=>{mt(F=>({...F,[N]:z})),je(1)},[]),uo=zt((N,z)=>{pt(N),Ce(z)},[]),Ze=zt(()=>{Xe(""),mt({}),je(1)},[]),Lt=zt(()=>{pt(""),Ce("asc")},[]),Wt=Lo(()=>({getSelectedItems:()=>Array.from(Y).map(N=>l[N]),clearSelection:()=>me(new Set),selectAll:gt,getFilteredData:()=>l,getTotalCount:()=>e.length,getVisibleCount:()=>l.length,refresh:()=>C?.(),exportData:()=>P?.(l)}),[Y,l,e.length,gt,C,P]),ft=Ya(null);ft.current=Wt,Zn(()=>{R&&ft.current&&R(ft.current)},[]),Zn(()=>{if(h&&c){let N=Array.from(Y).map(z=>l[z]);c(N)}},[Y]);let Et=r("w-full","overflow-hidden",a),Gt=r("grid",`gap-${_}`,"w-full","mx-auto","items-start"),Pt={gridTemplateColumns:Ee===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${he}px, calc(100%/${Ee} - ${_*4}px), ${J}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return f?H(Ue,{className:"w-full",children:H(We,{className:"flex items-center justify-center py-12",children:St("div",{className:"text-center",children:[H("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),H("p",{className:"text-sm text-muted-foreground mb-4",children:f}),C&&St(v,{variant:"outline",size:"sm",onClick:C,children:[H(Qn,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):St("div",{className:r("w-full flex gap-2 flex-col h-full",Et),children:[u&&H(Ue,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:H(We,{className:"p-2",children:u})}),A&&H(Bo,{fields:o,filters:n,globalFilter:Ie,onGlobalFilterChange:Xe,fieldFilters:ye,onFieldFilterChange:Ne,sortField:Be,sortDirection:we,onSortChange:uo,selectedCount:Y.size,totalCount:e.length,visibleCount:l.length,onExport:y?()=>P?.(l):void 0,onRefresh:C,loading:m,onClearFilters:Ze,onClearSorting:Lt}),H(Ue,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:H(We,{className:"px-0",children:St("div",{className:"relative",children:[m&&H("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:St("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[H(Qn,{className:"size-5 animate-spin text-primary"}),H("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),B.length>0?H("div",{className:r(Gt),style:Pt,children:B.map((N,z)=>{let F=ve?(Ye-1)*Le+z:z,K=Y.has(F);return St("div",{className:r("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",oe==="square"?"aspect-square":"",oe==="video"?"aspect-video":"",h?"cursor-pointer":"",K?"ring-2 ring-primary":""),onClick:()=>h&&$(F),children:[h&&E==="multiple"&&H("div",{className:"absolute top-2 right-2 z-10",children:H(wt,{checked:K,onCheckedChange:()=>$(F),className:"bg-background/80 backdrop-blur-sm",onClick:X=>X.stopPropagation()})}),t(N,z,K,()=>$(F))]},F)})}):St("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[H("div",{className:"text-6xl",children:g||"\u{1F4CB}"}),H("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:p}),(Ie||Object.values(ye).some(N=>N))&&H(v,{variant:"outline",onClick:Ze,children:"Clear Filters"})]})]})})}),ve&&H("div",{className:"pb-1",children:H(Yn,{currentPage:Ye,totalPages:Q,pageSize:Le,totalItems:l.length,onPageChange:je,onPageSizeChange:N=>{Bt(N),je(1)},config:s})}),d&&H("div",{className:"p-2 m-0.5",children:d}),b&&b(Wt)]})}import{Loader as Za,X as Qa}from"lucide-react";import{AnimatePresence as ei,motion as ti}from"framer-motion";import*as ut from"react";import*as tr from"react-dom";import{jsx as se,jsxs as $t}from"react/jsx-runtime";function or({controller:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=ut.useState(!1);ut.useLayoutEffect(()=>{d(!0)},[]),ut.useEffect(()=>{function p(g){g.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=e.getSelectedItems(),f=t??m.length>0;return tr.createPortal(se(ei,{children:f&&se(ti.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",s),...i,children:se(vt,{children:n})})}),a)}function nr({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:u,onClick:d,...a}){let m=se(v,{variant:t,size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:d,...a,children:n?se(Za,{className:"animate-spin"}):u});return o?$t(et,{children:[se(tt,{asChild:!0,children:m}),se(ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:se("p",{children:o})})]}):m}function rr({controller:e}){let t=ut.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return $t("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[$t("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),se(io,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),$t(et,{children:[se(tt,{asChild:!0,children:se(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:se(Qa,{className:"size-3.5"})})}),$t(ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[se("p",{children:"Clear selection"}),se("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:se("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as ni}from"react/jsx-runtime";var oi=({children:e,className:t})=>ni("div",{className:r("flex flex-col h-full gap-2",t),children:e});import{ArrowLeftIcon as ar}from"lucide-react";import{NavLink as ri}from"react-router";import{jsx as Ve,jsxs as Ut}from"react/jsx-runtime";var ai=({className:e,title:t,description:o,backAction:n,metadata:s,children:i,childrenClassName:u})=>{let d=()=>{if(!n)return null;let m={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.href?Ve(ri,{to:n.href,children:Ve(v,{...m,children:Ve(ar,{className:"size-6"})})}):Ve(v,{...m,onClick:n.onClick,children:Ve(ar,{className:"size-6"})})},a=()=>!s||s.length===0?null:Ve("div",{className:"flex gap-4",children:s.map((m,f)=>m.value&&Ut("div",{className:"text-sm",children:[Ut("span",{className:"text-muted-foreground",children:[m.label," "]}),Ve("span",{children:m.value})]},f))});return Ut("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[Ut("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),Ut("div",{className:"flex flex-col gap-2 w-max",children:[Ve("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&Ve("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&Ve("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",u),children:i})]})};import lo from"react";import{jsx as He,jsxs as so}from"react/jsx-runtime";var ir="(min-width: 1024px)",ii=()=>{let[e,t]=lo.useState(()=>typeof window>"u"||window.matchMedia(ir).matches);return lo.useEffect(()=>{let o=window.matchMedia(ir),n=()=>t(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[]),e},sr=e=>null,lr=e=>null,dr=e=>null,si=({children:e,className:t,contentClassName:o})=>{let n=ii(),s,i,u,d,a,m=lo.Children.toArray(e).filter(g=>{if(lo.isValidElement(g)){if(g.type===sr){let c=g.props;return s=c.children,i=c.className,!1}if(g.type===lr){let c=g.props;return u=c.children,d=c.className,!1}if(g.type===dr)return a=g.props,!1}return!0}),f=He("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),p=g=>{let{side:c="right"}=g,P=(g.overlay??!0)||!n,C=r("w-[420px] max-w-full",g.className),R=r("h-full bg-background",c==="right"?"border-l":"border-r"),b=He("div",{className:r("h-full p-2",o),children:m});return P?so("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[He("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:b}),so("div",{tabIndex:-1,inert:!g.open,className:r("absolute inset-0 z-20",!g.open&&"pointer-events-none"),children:[He("div",{className:r("absolute inset-0 bg-black/50 transition-opacity duration-500",g.open?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>g.onOpenChange(!1)}),He("div",{tabIndex:-1,className:r("absolute inset-y-0 z-50 h-full overflow-y-auto backdrop-blur-2xl","transition-all duration-500 ease-in-out",c==="right"?"right-0":"left-0",g.open?"translate-x-0 opacity-100":r(c==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),R,C),children:g.children})]})]}):so("div",{className:"flex relative flex-1 overflow-hidden",children:[c==="left"&&He("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,g.open?C:"w-0 border-0"),children:g.children}),He("div",{className:r("h-full flex-1 min-w-0 overflow-auto transition-all duration-500",g.open&&"overflow-y-auto overflow-x-hidden"),children:b}),c==="right"&&He("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,g.open?C:"w-0 border-0"),children:g.children})]})};return so("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&He("div",{className:r("border-b p-2",i),children:s}),a?p(a):f,u&&He("div",{className:r("border-t p-2",d),children:u})]})};import{jsx as di}from"react/jsx-runtime";var li=({className:e,children:t})=>t==null?null:di("div",{className:r("flex items-center w-full gap-4 p-2 [&>*:last-child]:ml-auto",e),children:t});import{useState as cr}from"react";import{Copy as ci,Check as ui,Loader2Icon as mi}from"lucide-react";import{jsx as Ke,jsxs as ur}from"react/jsx-runtime";var Eo=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(o){throw console.error("Failed to copy text:",o),o}}static CopyToClipboard=({text:t,children:o,className:n,size:s="icon",variant:i="ghost"})=>{let[u,d]=cr(!1),[a,m]=cr(!1),f=async()=>{if(!(!t||a)){m(!0);try{await this.copyToClipboard(t),d(!0),setTimeout(()=>d(!1),2e3)}catch(p){console.error("Failed to copy text:",p)}finally{m(!1)}}};return ur(et,{children:[Ke(tt,{asChild:!0,children:Ke(v,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:f,disabled:a||!t,children:a?Ke(mi,{className:"animate-spin"}):u?Ke(ui,{className:"h-3 w-3"}):o||Ke(ci,{className:"h-3 w-3"})})}),Ke(ot,{children:u?"Copied!":a?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:u=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let d=t<0,a=Math.abs(t),f=(u&&a>=1e5?this.compactFormatter:this.currencyFormatter).format(a).replace("\u20B9","");return`${n}${d?"- ":""}${i?"\u20B9 ":""}${f}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),d=String(i.getMonth()+1).padStart(2,"0"),a=this.MONTH_NAMES_SHORT[i.getMonth()],m=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${u}${s}${a}${s}${m}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${u}${s}${d}${s}${m}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((o,n,s)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(s[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:s=!0,size:i="md",variant:u="outline",customColors:d,icon:a,trueMessage:m="active",falseMessage:f="inactive"})=>{let p=typeof t=="boolean"?t?m:f:typeof t=="number"?t>0?m:f:t.toLowerCase(),g={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},c=g[p.toLowerCase()]||g.inactive,P=d||c[u],C={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},R=s?p.charAt(0).toUpperCase()+p.slice(1):p;return Ke("div",{className:"flex justify-center",children:ur("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",P.bg,P.text,P.border,C[i],o),children:[n&&(a?Ke("span",{className:"flex items-center",children:a}):Ke("span",{className:r("size-2 rounded-full",P.dot),"aria-hidden":"true"})),R]})})}};import{AlertTriangleIcon as pi}from"lucide-react";import{useRouteError as gi,isRouteErrorResponse as fi,useNavigate as bi}from"react-router";import{Fragment as Go,jsx as Ae,jsxs as Ft}from"react/jsx-runtime";var mr=()=>{let e=gi(),t=bi();return Ae("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:Ft("div",{className:"flex flex-col items-center space-y-4 text-center",children:[Ae(pi,{className:"h-16 w-16 text-destructive"}),fi(e)?Ft(Go,{children:[Ft("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?Ae("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&Ae("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?Ft(Go,{children:[Ae("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),Ae("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&Ft("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[Ae("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),Ae("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):Ft(Go,{children:[Ae("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),Ae("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),Ae(v,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as Je}from"framer-motion";import{jsx as q,jsxs as ue}from"react/jsx-runtime";function xi({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return ue(Je.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[q("title",{children:"Animated Checkmark"}),q(Je.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),q(Je.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function pr(){return q(Ue,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:ue(We,{className:"space-y-4 flex flex-col items-center justify-center",children:[q(Je.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:ue("div",{className:"relative",children:[q(Je.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),q(xi,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),ue(Je.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[q(Je.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),q("div",{className:"flex items-center gap-4",children:q(Je.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:ue("div",{className:"flex flex-col items-start gap-2",children:[ue("div",{className:"space-y-1.5",children:[ue("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[ue("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"From"}),q("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),ue("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),q("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),ue("div",{className:"space-y-1.5",children:[ue("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[ue("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"To"}),q("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),ue("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),q(Je.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as co,jsxs as hi}from"react/jsx-runtime";var gr=()=>co("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:hi("div",{className:"flex flex-col items-center space-y-4",children:[co("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),co("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),co("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as vi}from"react-router";import{GhostIcon as yi}from"lucide-react";import{NavLink as wi,useNavigate as Ci}from"react-router";import{jsx as At,jsxs as _o}from"react/jsx-runtime";var fr=()=>{let e=vi(),t=Ci(),o=()=>{window.history.length>2?t(-1):t("/")};return _o("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[At(yi,{className:"h-15 w-15 text-destructive mb-4"}),At("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),_o("p",{className:"text-xl mb-4",children:["The page ",At("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),_o("div",{className:"flex space-x-4",children:[At(v,{variant:"outline",onClick:o,children:"Go Back"}),At(v,{variant:"ghost",children:At(wi,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as Ni}from"lucide-react";import{jsx as Oo,jsxs as Ti}from"react/jsx-runtime";var br=()=>Ti("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[Oo(Ni,{className:"h-15 w-15 text-destructive mb-4"}),Oo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Oo("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as Si}from"lucide-react";import{NavLink as Pi,useNavigate as Di}from"react-router";import{jsx as It,jsxs as xr}from"react/jsx-runtime";var hr=()=>{let e=Di();return xr("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[It(Si,{className:"h-15 w-15 text-destructive mb-4"}),It("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),It("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),xr("div",{className:"flex space-x-4",children:[It(v,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),It(v,{variant:"ghost",children:It(Pi,{to:"/",children:"Go to Home"})})]})]})};export{oi as AppContainer,si as AppContent,lr as AppContentFooter,sr as AppContentHeader,li as AppFooter,ai as AppHeader,dr as AppSheet,pr as CurrencyTransfer,Wn as DataTable,Kn as DataTableActionBar,Jn as DataTableActionBarAction,Xn as DataTableActionBarSelection,er as DataTemplate,or as DataTemplateActionBar,nr as DataTemplateActionBarAction,rr as DataTemplateActionBarSelection,mr as ErrorComponent,Eo as GeneralHelper,gr as Loader,fr as NotFound,br as OfflineUI,hr as Unauthorized,Yt as getTableExportView,In as readPersistedExternal};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|