@akshar-technosoft/ui 1.1.3 → 1.2.0

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/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client"
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&&lt("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&&lt("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&&lt(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&&gt($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-1/3 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};
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 Gr}from"react/jsx-runtime";var Jt=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 Gr(i,{"data-slot":"button",className:r(Jt({variant:t,size:o,className:e})),...s})}import{jsx as tt}from"react/jsx-runtime";function ho({className:e,...t}){return tt("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:tt("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Jo({className:e,...t}){return tt("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Xo({className:e,...t}){return tt("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function Xt({className:e,...t}){return tt("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Re({className:e,...t}){return tt("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 tt("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Ve({className:e,...t}){return tt("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as Zo}from"react/jsx-runtime";function We({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 qe({className:e,...t}){return Zo("div",{"data-slot":"card-content",className:r("px-6",e),...t})}import{Tooltip as Rt}from"radix-ui";import{jsx as Mt,jsxs as Er}from"react/jsx-runtime";function yt({delayDuration:e=0,...t}){return Mt(Rt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ot({...e}){return Mt(yt,{children:Mt(Rt.Root,{"data-slot":"tooltip",...e})})}function nt({...e}){return Mt(Rt.Trigger,{"data-slot":"tooltip-trigger",...e})}function rt({className:e,sideOffset:t=0,children:o,...n}){return Mt(Rt.Portal,{children:Er(Rt.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,Mt(Rt.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 zt({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 me}from"radix-ui";import{CheckIcon as Vr,ChevronRightIcon as Or,CircleIcon as Yi}from"lucide-react";import{jsx as de,jsxs as on}from"react/jsx-runtime";function Me({...e}){return de(me.Root,{"data-slot":"dropdown-menu",...e})}function ze({...e}){return de(me.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Fe({className:e,sideOffset:t=4,...o}){return de(me.Portal,{children:de(me.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 de(me.Group,{"data-slot":"dropdown-menu-group",...e})}function W({className:e,inset:t,variant:o="default",...n}){return de(me.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 Yt({className:e,children:t,checked:o,...n}){return on(me.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(me.ItemIndicator,{children:de(Vr,{className:"size-4"})})}),t]})}function re({className:e,inset:t,...o}){return de(me.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(me.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function Qo({...e}){return de(me.Sub,{"data-slot":"dropdown-menu-sub",...e})}function en({className:e,inset:t,children:o,...n}){return on(me.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(Or,{className:"ml-auto size-4"})]})}function tn({className:e,...t}){return de(me.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 Zt(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 Qt}from"radix-ui";import{jsx as eo}from"react/jsx-runtime";function nn({...e}){return eo(Qt.Root,{"data-slot":"popover",...e})}function rn({...e}){return eo(Qt.Trigger,{"data-slot":"popover-trigger",...e})}function an({className:e,align:t="center",sideOffset:o=4,...n}){return eo(Qt.Portal,{children:eo(Qt.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 to 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 at}from"react/jsx-runtime";function ln({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:c,...d}){let a=sn();return at(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(Jt({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(Jt({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:b,...g})=>at("div",{"data-slot":"calendar",ref:b,className:r(m),...g}),Chevron:({className:m,orientation:b,...g})=>b==="left"?at($r,{className:r("size-4",m),...g}):b==="right"?at(Ur,{className:r("size-4",m),...g}):at(jr,{className:r("size-4",m),...g}),DayButton:qr,WeekNumber:({children:m,...b})=>at("td",{...b,children:at("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...c},...d})}function qr({className:e,day:t,modifiers:o,...n}){let s=sn(),i=to.useRef(null);return to.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),at(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 wt,jsxs as Ht}from"react/jsx-runtime";function cn({value:e,onChange:t,placeholder:o,mode:n,externalSearch:s,onExternalChange:i,dateFormat:c,triggerClassName:d}){let a=c?c.replace(/Y/g,"y").replace(/D/g,"d"):null,[m,b]=dn(!1),[g,p]=dn(e);Kr(()=>{p(e)},[e]);let l=f=>{if(f==null)return null;if(f instanceof Date)return isNaN(f.getTime())?null:f;let T=new Date(f);return isNaN(T.getTime())?null:T},S=(f,T)=>{let k=l(f);return k?Xr(k,T):null},y=f=>{s?i?.(f):t?.(f)},R=()=>{y(g),b(!1)},I=()=>{p(e),b(!1)},h=()=>{let f=n==="single"?null:{from:null,to:null};p(f),y(f),b(!1)},D=()=>{let f=e;if(!f)return o;if(n==="single")return S(f,a||"PPP")??o;if(f.from&&f.to){let T=S(f.from,a||"MMM dd"),k=S(f.to,a||"MMM dd, yyyy");return T&&k?`${T} - ${k}`:o}if(f.from){let T=S(f.from,a||"MMM dd, yyyy");return T?`From ${T}`:o}if(f.to){let T=S(f.to,a||"MMM dd, yyyy");return T?`To ${T}`:o}return o},x=f=>{p(n==="single"?f:f||{from:null,to:null})};return Ht(nn,{open:m,onOpenChange:b,children:[wt(rn,{className:"h-8",asChild:!0,children:Ht(v,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",D()===o&&"text-muted-foreground",d),children:[wt(Jr,{className:"mr-2 h-4 w-4 shrink-0"}),D()]})}),Ht(an,{className:"w-auto p-0",align:"start",children:[wt("div",{className:"p-3",children:wt(ln,{mode:n,selected:g,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),Ht("div",{className:"flex items-center justify-between p-3 border-t",children:[wt(v,{variant:"ghost",size:"sm",onClick:h,children:"Clear"}),Ht("div",{className:"flex gap-2",children:[wt(v,{variant:"outline",size:"sm",onClick:I,children:"Cancel"}),wt(v,{size:"sm",onClick:R,disabled:n==="range"&&(!g?.from||!g?.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 Ct({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 G,jsxs as ae}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"]})},c=(d,a)=>{let m=t[d]?.functions||[],b=m.includes(a)?m.filter(g=>g!==a):[...m,a];o(d,{enabled:b.length>0,functions:b})};return ae(Me,{children:[G(ze,{asChild:!0,children:ae(v,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[G(Zr,{className:"size-4"}),G("span",{children:"Aggregations"}),G(pn,{className:"opacity-50 size-4"})]})}),ae(Fe,{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:[G("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&G(v,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>Co(t,o),children:"Clear All"})]}),G(ce,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return ae(Qo,{children:[G(en,{className:"text-sm",children:ae("div",{className:"flex items-center w-full gap-2",children:[G(Ct,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),G("span",{className:r("flex-1",m&&"font-medium text-primary"),children:wo(d.id)}),m&&ae("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(b=>G("div",{className:"w-2 h-2 rounded-full bg-primary",title:mn.find(g=>g.value===b)?.label},b)),a?.functions&&a.functions.length>2&&ae("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),ae(tn,{className:"w-48 rounded-lg",children:[G(re,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),mn.map(b=>G(Yt,{checked:a?.functions?.includes(b.value)||!1,onCheckedChange:()=>c(d.id,b.value),className:"py-2 text-sm",children:ae("div",{className:"flex flex-col",children:[G("span",{children:b.label}),G("span",{className:"text-xs text-muted-foreground",children:b.description})]})},b.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(c=>c.getCanHide?.()!==!1)),n=new Set(o.flatMap(i=>i.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>c.id)||[])),s=t.filter(i=>!n.has(i.id));return ae(Me,{children:[G(ze,{asChild:!0,children:ae(v,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[G(Qr,{className:"size-4"}),G("span",{children:"Columns"}),G(pn,{className:"opacity-50 size-4"})]})}),ae(Fe,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[G(re,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),G(ce,{}),s.length>0&&ae(vo,{children:[G(re,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>G(Yt,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:c=>i.toggleVisibility(!!c),children:wo(i.id)},i.id))]}),o.map(i=>ae(vo,{children:[G(ce,{}),G(re,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:i.id}),i.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>G(Yt,{className:"text-sm",checked:c.getIsVisible(),onCheckedChange:d=>c.toggleVisibility(!!d),children:wo(c.id,i.id)},c.id))]},i.id))]})]})}import{Select as he}from"radix-ui";import{CheckIcon as ea,ChevronDownIcon as xn,ChevronUpIcon as ta}from"lucide-react";import{jsx as te,jsxs as No}from"react/jsx-runtime";function it({...e}){return te(he.Root,{"data-slot":"select",...e})}function st({...e}){return te(he.Value,{"data-slot":"select-value",...e})}function lt({className:e,size:t="default",children:o,...n}){return No(he.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(he.Icon,{asChild:!0,children:te(xn,{className:"size-4 opacity-50"})})]})}function dt({className:e,children:t,position:o="popper",...n}){return te(he.Portal,{children:No(he.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(oa,{}),te(he.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(na,{})]})})}function Oe({className:e,children:t,...o}){return No(he.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(he.ItemIndicator,{children:te(ea,{className:"size-4"})})}),te(he.ItemText,{children:t})]})}function oa({className:e,...t}){return te(he.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:te(ta,{className:"size-4"})})}function na({className:e,...t}){return te(he.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:te(xn,{className:"size-4"})})}import{Fragment as ba,jsx as P,jsxs as H}from"react/jsx-runtime";var oe=e=>e.id??e.key;function To({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:c,loading:d=!1,enableColumnVisibility:a=!0,onClearSorting:m,onClearFilters:b,enableColumnPinning:g=!1,enableSorting:p=!0,onExternalSearch:l,initialExternalValues:S,aggregations:y={},onAggregationChange:R,groupedFilterLabel:I="Global",showFilterChips:h=!0,initialGroupedField:D,onGroupedFieldChange:x}){let[f,T]=yn(S??{}),[k,M]=yn(D??"all"),$=vn(S??{}),L=vn(void 0);fa(()=>()=>clearTimeout(L.current),[]);let ge=(u,_,Y=!1)=>{let U={...$.current,[u]:_};$.current=U,T(U),clearTimeout(L.current),Y?L.current=setTimeout(()=>l?.(U),500):l?.(U)},ue=()=>{clearTimeout(L.current),$.current={},T({}),M("all"),x?.("all"),b(),l?.({})},fe=u=>t.find(Y=>oe(Y)===u)?.externalSearch?f[u]??"":e.getColumn(u)?.getFilterValue(),ee=(u,_)=>{let Y=t.find(U=>oe(U)===u);Y?.externalSearch?ge(u,_,Y.type==="text"):e.getColumn(u)?.setFilterValue(_)},J=u=>{M(u),x?.(u),u!=="all"&&n("")},Ye=Object.values(y).some(u=>u?.enabled),Le=u=>!!u.externalSearch||!!e.getColumn(oe(u)),gt=u=>{let _=fe(oe(u));return _==null||_===""?!1:typeof _=="object"?!!(_.from||_.to):!0},Ce=u=>u.type==="date"||u.type==="daterange",ft=u=>{ee(oe(u),Ce(u)?null:"")},Ge=u=>{let _=fe(oe(u));return u.type==="select"?u.options?.find(Y=>Y.value===_)?.label??String(_):Ce(u)?"set":String(_)},Ne=(u,_)=>{let Y=_?.embedded;if(u.type==="select"){let U=oe(u),bt=fe(U);return H(it,{value:bt?String(bt):"",onValueChange:_e=>ee(U,_e==="__all__"?"":_e),children:[P(lt,{size:"sm",className:r("w-full",Y?"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:H("span",{className:"flex items-center gap-2 truncate",children:[u.icon&&P(u.icon,{className:"size-4 shrink-0 text-muted-foreground"}),P(st,{placeholder:u.placeholder})]})}),H(dt,{className:"rounded-lg",children:[P(Oe,{value:"__all__",children:"All"}),u.options?.map(_e=>P(Oe,{value:_e.value,children:_e.label},_e.value))]})]})}return u.type==="date"||u.type==="daterange"?P(cn,{value:fe(oe(u)),onChange:U=>ee(oe(u),U),placeholder:u.placeholder,mode:u.type==="daterange"?"range":"single",dateFormat:u.dateFormat,externalSearch:u.externalSearch,onExternalChange:U=>ge(oe(u),U),triggerClassName:Y?"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}):H("div",{className:"relative w-full",children:[u.icon&&P(u.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),P(zt,{placeholder:u.placeholder,value:fe(oe(u))??"",onChange:U=>{ee(oe(u),U.target.value)},className:r("h-8",u.icon&&"pl-9",Y?"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:u.type==="number"?"number":"text"})]})},ne=t.filter(u=>(u.placement??"bar")==="bar"),Te=t.filter(u=>u.placement==="menu"),be=s&&Te.length>0,Ze=Te.filter(gt),Se=e.getState().columnFilters.length>0||!!o||t.some(gt),{left:Lt=[],right:Ee=[]}=e.getState().columnPinning,Qe=Lt.some(u=>u!=="serialNumber"&&u!=="select")||Ee.length>0,E=[{value:"all",label:"All Fields"},...Te.map(u=>({value:oe(u),label:u.placeholder}))];return H("div",{className:"flex flex-wrap items-center gap-3",children:[ne.length>0&&P(hn,{className:"size-4 text-muted-foreground shrink-0"}),ne.map(u=>Le(u)?P("div",{className:r("relative min-w-[150px]",u.width),children:Ne(u)},oe(u)):null),h&&Ze.map(u=>H("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[H("span",{className:"text-muted-foreground",children:[u.placeholder,":"]}),P("span",{className:"font-medium truncate max-w-[120px]",children:Ge(u)}),P("button",{type:"button",onClick:()=>ft(u),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${u.placeholder}`,children:P(ga,{className:"size-3.5"})})]},`chip-${oe(u)}`)),Se&&H(v,{variant:"ghost",size:"sm",onClick:ue,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[P(la,{className:"size-4"}),"Clear Filters"]}),H("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&H("div",{className:r("flex items-center",be&&"bg-background border rounded-lg"),children:[be&&H(Me,{children:[P(ze,{asChild:!0,children:H(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:[P("span",{className:"text-sm font-medium max-w-28 truncate",children:k==="all"?I:E.find(u=>u.value===k)?.label}),P(ua,{className:"opacity-50 size-4"})]})}),P(Fe,{align:"start",className:"w-48 rounded-lg",children:E.map(u=>H(W,{onClick:()=>J(u.value),className:"flex items-center justify-between",children:[P("span",{children:u.label}),k===u.value&&P(pa,{className:"size-4 text-primary"})]},u.value))})]}),(()=>{let u=be&&k!=="all"?Te.find(_=>oe(_)===k):void 0;return u?P("div",{className:"w-48",children:Ne(u,{embedded:!0})}):H("div",{className:"relative",children:[P(ra,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),P(zt,{placeholder:be?"Search all fields...":"Global search...",value:o??"",onChange:_=>n(_.target.value),className:r("pl-9 h-8 w-48",be&&"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]")})]})})()]}),P(fn,{table:e,aggregations:y,onAggregationChange:R}),a&&P(bn,{table:e}),H(Me,{children:[P(ze,{asChild:!0,children:P(v,{variant:"outline",size:"sm",className:"rounded-lg",children:P(sa,{className:"size-4"})})}),H(Fe,{align:"end",className:"w-[200px] rounded-lg",children:[P(re,{children:"Table Settings"}),P(ce,{}),i&&H(W,{onClick:()=>{let u=Zt(e);i(u.originals,u)},children:[P(ia,{className:"size-4"}),"Export"]}),p&&H(W,{onClick:m,disabled:e.getState().sorting.length===0,children:[P(da,{className:"size-4"}),"Clear All Sorting"]}),H(W,{onClick:ue,disabled:!Se,children:[P(hn,{className:"size-4"}),"Clear All Filters"]}),Object.keys(y).length>0&&H(W,{onClick:()=>Co(y,R),disabled:!Ye,children:[P(ma,{className:"size-4"}),"Clear Aggregations"]}),g&&H(ba,{children:[P(ce,{}),P(re,{children:"Column Pinning"}),H(W,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Qe,children:[P(ca,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),c&&P(v,{variant:"outline",size:"sm",onClick:c,disabled:d,className:"rounded-lg",children:P(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 ve,jsxs as ct}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},(g,p)=>p+1);let i=Math.max(n-o,1),c=Math.min(n+o,t),d=i>2,a=c<t-1,m=3+o*2,b=[];if(!d&&a){for(let g=1;g<=m;g++)b.push(g);b.push("ellipsis",t)}else if(d&&!a){b.push(1,"ellipsis");for(let g=t-m+1;g<=t;g++)b.push(g)}else{b.push(1,"ellipsis");for(let g=i;g<=c;g++)b.push(g);b.push("ellipsis",t)}return b}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,c="size-8 p-0 rounded-lg";return ct("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&&ct("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"]}),ct("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,b=a&&m?"-1":`${s}`;return ct("div",{className:"flex items-center gap-2",children:[ve("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),ct(it,{value:b,onValueChange:g=>e.setPageSize(g==="-1"?Math.max(i,1):Number(g)),children:[ve(lt,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:ve(st,{})}),ve(dt,{side:"top",className:"rounded-lg",children:d.map(g=>ve(Oe,{value:`${g}`,children:g===-1?"All":g},g))})]})]})})(),o>1&&ct("div",{className:"flex items-center gap-1",children:[ve(v,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:c,children:ve(xa,{className:"size-4"})}),t.showPageNumbers&&ct(ya,{children:[ct("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),ve("div",{className:"hidden items-center gap-1 sm:flex",children:va(n,o).map((d,a)=>d==="ellipsis"?ve("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):ve(v,{variant:d-1===n?"default":"outline",size:"sm",className:r(c,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),ve(v,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:c,children:ve(ha,{className:"size-4"})})]})]})]})}import{useCallback as Io,useEffect as ye,useMemo as io,useRef as He,useState as we}from"react";function Nt(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 Ae=(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,c={left:(i.left??[]).filter(d=>s.includes(d)),right:[...i.right??[]]};o==="right"?c.right.includes(t)||c.right.push(t):o==="left"?(c.right=c.right.filter(d=>d!==t),!c.left.includes(t)&&!s.includes(t)&&c.left.push(t)):(c.left=c.left.filter(d=>d!==t),c.right=c.right.filter(d=>d!==t)),e.setColumnPinning(c)}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 c=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](c))}),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 oo(e,t){let o=Pn(e),n=[];for(let s of t){if(s.externalSearch)continue;let i=typeof s.filterFn=="function",c=i?s.id:s.key;if(!c||o.has(String(c)))continue;let d=s.key;n.push({id:String(c),accessorFn:d?a=>wa(a,d):()=>null,...i&&{filterFn:(a,m,b)=>s.filterFn(a.original,b)},enableHiding:!1,enableSorting:!1,enablePinning:!1,enableGlobalFilter:!1,meta:{filterOnly:!0}})}return n}import{jsx as jt}from"react/jsx-runtime";function Dn({initialColumns:e,filters:t,showSerialNumbers:o,enableRowSelection:n,selectionMode:s,showCheckbox:i,enableHeaderCheckbox:c,isRowSelectable:d}){let a=g=>g.map(p=>{if(p.id==="select"||p.id==="serialNumber")return p;let l={...p,enablePinning:!0};return p.enableColumnVisibility!==void 0&&p.enableHiding===void 0&&(l.enableHiding=p.enableColumnVisibility),p.columns&&(l.columns=a(p.columns)),l}),m=a([...e]),b={id:"select",header:({table:g})=>{if(s==="single")return null;let p=g.getRowModel().rows.filter(y=>d?.(y.original)??!0),l=p.length>0&&p.every(y=>y.getIsSelected()),S=p.some(y=>y.getIsSelected());return jt(Ct,{checked:l||S&&"indeterminate",onCheckedChange:y=>{p.forEach(R=>R.toggleSelected(!!y))},disabled:!c||p.length===0,"aria-label":"Select all selectable rows"})},cell:({row:g})=>{let p=d?.(g.original)??!0;return jt("div",{className:r("flex justify-center items-center",!p&&"opacity-50"),children:s==="multiple"?jt(Ct,{checked:g.getIsSelected(),onCheckedChange:l=>p&&g.toggleSelected(!!l),"aria-label":"Select row",disabled:!p}):i?jt("input",{type:"radio",checked:g.getIsSelected(),onChange:()=>p&&g.toggleSelected(!0),disabled:!p,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(b),o&&m.unshift({id:"serialNumber",header:"No.",cell:({row:g})=>jt("div",{className:"font-medium text-muted-foreground text-center",children:g.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...oo(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 no(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?no(e):void 0)??{}}function Tt(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 ro(e){return{...no("g:"+e)??{},...Rn.get(e)??{}}}function ao(e,t,o,n){let s=ro(e),i=n==null||n==="";if(i?s[o]===void 0:s[o]===n)return;let c={...s};i?delete c[o]:c[o]=n,Rn.set(e,c),(t||no("g:"+e)!==void 0)&&Mn("g:"+e,c),Do.get(e)?.forEach(d=>d())}function An(e,t){if(Tt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)ao(e.group,e.local,o,void 0)}function In(e){return(ko.get(e)??no(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 Gn(e,t,o){let n=zn(e),s=t.map(h=>({id:String(h.id??h.key),shared:h.shared,persist:h.persist!==!1,external:!!h.externalSearch,isDate:h.type==="date"||h.type==="daterange"})),i=Mo(s);i.current=s;let c=Na(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let h=Ro(n.key,n.local),D=n.group?ro(n.group):{},x=k=>{let M=k.shared&&n.group?D[k.shared]:h.filters?.[k.id]??h.external?.[k.id];return k.isDate?Ln(M):M},f=[],T={};for(let k of s){if(!k.persist)continue;let M=x(k);M==null||M===""||(k.external?T[k.id]=M:f.push({id:k.id,value:M}))}return{columnFilters:f,globalFilter:h.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?h.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?h.pagination?.pageSize??o:o},external:T,groupedField:h.groupedField??"all"}},[]),d=Mo(c.pagination.pageIndex),a=Mo(c.pagination.pageIndex===0);return Ca(()=>{if(n)return!n.group&&i.current.some(h=>h.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:c,persistFilters:h=>{if(!n)return;let D={};for(let f of h)D[f.id]=f.value;let x={};for(let f of i.current)!f.persist||f.external||(f.shared&&n.group?ao(n.group,n.local,f.shared,D[f.id]):D[f.id]!==void 0&&(x[f.id]=D[f.id]));Tt(n.key,n.local,{filters:x})},persistGlobalFilter:h=>{n&&Tt(n.key,n.local,{globalFilter:h})},persistExternal:h=>{if(!n)return;let D={};for(let x of i.current)!x.persist||!x.external||(x.shared&&n.group?ao(n.group,n.local,x.shared,h[x.id]):h[x.id]!==void 0&&(D[x.id]=h[x.id]));Tt(n.key,n.local,{external:D})},persistPagination:h=>{!n||n.pagination===!1||a.current&&Tt(n.key,n.local,{pagination:{pageIndex:h.pageIndex,pageSize:h.pageSize}})},persistGroupedField:h=>{n&&Tt(n.key,n.local,{groupedField:h})},restorePageIndex:(h,D)=>{if(!n||a.current||h.getCoreRowModel().rows.length===0)return;let x=Math.min(d.current,Math.max(h.getPageCount()-1,0));a.current=!0,x>0&&D({pageIndex:x,pageSize:h.getState().pagination.pageSize})},syncSharedSlots:h=>{if(!n?.group)return;let D=n.group,x=i.current.filter(f=>f.shared&&f.persist&&!f.external);if(x.length!==0)return Fn(D,()=>{let f=ro(D);for(let T of x){let k=h.getColumn(T.id);if(!k)continue;let M=f[T.shared],$=M===void 0?void 0:T.isDate?Ln(M):M,L=k.getFilterValue();Object.is(L??void 0,$??void 0)||k.setFilterValue($)}})},clearAll:()=>{n&&An(n,i.current.filter(h=>h.shared).map(h=>h.shared))},pendingPageRestore:()=>!!n&&n.pagination!==!1&&!a.current}}import{flexRender as En}from"@tanstack/react-table";import{ChevronUp as _n,ChevronDown as Vn,ChevronsUpDown as On,EyeOff as Ta,MoreHorizontal as Sa,MoveRightIcon as Pa,PinOffIcon as Da,Calculator as Hn}from"lucide-react";import{Fragment as Fo,jsx as V,jsxs as ie}from"react/jsx-runtime";function jn({table:e,aggregations:t,enableColumnPinning:o,enableColumnResizing:n,enableColumnVisibility:s,enableRowSelection:i,fixedCheckboxColumn:c,bordered:d,compact:a,onPinColumn:m}){let b=e.getVisibleLeafColumns().filter(p=>!p.getIsPinned()),g=b[b.length-1]?.id;return V(Fo,{children:e.getHeaderGroups().map(p=>V(Re,{className:"hover:bg-transparent",children:p.headers.map((l,S)=>{let y=l.depth===0&&l.colSpan>1,R=o&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&i),I=o&&l.column.getIsPinned()==="right",h=l.column.getCanSort(),D=o&&l.column.columnDef.enablePinning!==!1,x=l.column.id==="serialNumber",f=l.column.id==="select",T=x||f&&c,k=l.column.columnDef.headerAlign||"left",M=t&&t[l.column.id]?.enabled,$=s&&!T&&l.column.getCanHide(),ge=l.column.columnDef.enableHeaderMenu!==!1&&(h||D&&!T||$),ue=l.column.getIsSorted(),fe=l.column.columnDef.reserveMenuSpace===!0,ee={left:"justify-start",center:"justify-center",right:"justify-end"}[k];return ie(Yo,{colSpan:l.colSpan,"data-col-id":y?void 0:l.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&S<p.headers.length-1&&l.column.id!==g&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar/95",I&&"sticky right-0 z-25 bg-sidebar/95",(x||f)&&"sticky left-0 z-25 bg-sidebar/95",y?"text-center":"text-left"),style:{width:Ae(l.getSize(),R||I),minWidth:Ae(l.getSize(),R||I),...Nt(l.column,o)},children:[y?ie("div",{className:"flex justify-center items-center",children:[En(l.column.columnDef.header,l.getContext()),M&&V(Hn,{className:"ml-1 w-3 h-3 text-primary"})]}):ie("div",{className:r("relative flex items-center px-2 w-full",ee,h&&"cursor-pointer select-none"),onClick:h?J=>{J.target.closest("button, a, input, select, [role=button], [role=checkbox]")||l.column.getToggleSortingHandler()?.(J)}:void 0,children:[ie("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",ue&&"pr-6",fe&&(ge?"pr-12":"pr-6")),children:[M&&V(Hn,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),l.isPlaceholder?null:V("span",{className:"truncate",children:En(l.column.columnDef.header,l.getContext())})]}),(ge||h)&&ie("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[V("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")}),h&&V("span",{className:"relative shrink-0",children:ue?ue==="asc"?V(_n,{className:"w-4 h-4"}):V(Vn,{className:"w-4 h-4"}):V(On,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),ge&&ie(Me,{children:[V(ze,{asChild:!0,children:V(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",h&&"group-hover:ml-0.5","data-[state=open]:w-5 data-[state=open]:opacity-100",h&&"data-[state=open]:ml-0.5","transition-all duration-200 ease-out"),children:V(Sa,{className:"w-4 h-4"})})}),ie(Fe,{align:"end",className:"w-48",onClick:J=>J.stopPropagation(),children:[h&&ie(Fo,{children:[V(re,{children:"Sorting"}),ie(W,{onClick:()=>l.column.toggleSorting(!1),disabled:ue==="asc",children:[V(_n,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),ie(W,{onClick:()=>l.column.toggleSorting(!0),disabled:ue==="desc",children:[V(Vn,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),ie(W,{onClick:()=>l.column.clearSorting(),disabled:!ue,children:[V(On,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(D&&!T||$)&&V(ce,{})]}),D&&!T&&ie(Fo,{children:[V(re,{children:"Pin Column"}),ie(W,{onClick:()=>m(l.column.id,"right"),disabled:l.column.getIsPinned()==="right",children:[V(Pa,{}),"Pin Right"]}),ie(W,{onClick:()=>m(l.column.id,!1),disabled:!l.column.getIsPinned(),children:[V(Da,{}),"Unpin"]}),$&&V(ce,{})]}),$&&ie(W,{onClick:()=>l.column.toggleVisibility(!1),children:[V(Ta,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),V("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",M?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&l.column.getCanResize()&&!y&&l.colSpan===1&&V("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:l.getResizeHandler(),onTouchStart:l.getResizeHandler(),onClick:J=>J.stopPropagation()})]},l.id)})},p.id))})}import{jsx as Ke,jsxs as Ao}from"react/jsx-runtime";function $n({table:e,columnAggregations:t,aggregations:o,enableColumnPinning:n,enableRowSelection:s,showSerialNumbers:i,compact:c}){let d=Object.keys(t).length>0,a=e.getHeaderGroups()[0]?.headers.some(l=>l.column.columnDef.customFooter),m=i&&e.getFilteredRowModel().rows.length>0&&(d||a),b=e.getHeaderGroups()[0]?.headers.length??0,g=e.getVisibleLeafColumns().filter(l=>!l.getIsPinned()),p=g[g.length-1]?.id;return!d&&!a&&!m?null:Ke(Xt,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:Ke(Re,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((l,S)=>{let y=l.column.id,R=t[y],I=n&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&s),h=n&&l.column.getIsPinned()==="right",D=l.column.id==="serialNumber",x=l.column.id==="select",T=l.column.columnDef.customFooter;return R||T||D&&m?Ao(Ve,{className:r("relative px-2 py-2 font-semibold text-sm",S<b-1&&"border-r",c&&"py-1",I&&"sticky left-0 z-30 bg-sidebar",h&&"sticky right-0 z-30 bg-sidebar",(D||x)&&"sticky left-0 z-30 bg-sidebar",T?.className),style:{width:Ae(l.getSize(),I||h),minWidth:Ae(l.getSize(),I||h),...Nt(l.column,n)},children:[Ke("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(T?.content){let M=typeof T.content=="function"?T.content(e):T.content;return Ke("div",{className:r("w-full h-full",T.align==="center"&&"text-center",T.align==="right"&&"text-right",T.align==="left"&&"text-left"),children:M})}return R?Ke("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(R).map(([M,$])=>Ao("div",{className:"flex justify-between items-center text-muted-foreground",children:[Ke("span",{className:"text-xs capitalize",children:M}),Ke("span",{className:"font-medium text-foreground",children:o?.[y]?.format?.($,M)??Sn(M,$)})]},M))}):D&&m?Ao("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${l.id}`):Ke(Ve,{className:r("relative px-0 py-0",S<b-1&&l.column.id!==p&&"border-r",c&&"py-0",I&&"sticky left-0 z-30 bg-sidebar",h&&"sticky right-0 z-30 bg-sidebar",(D||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:Ae(l.getSize(),I||h),minWidth:Ae(l.getSize(),I||h),...Nt(l.column,n)},children:Ke("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${l.id}`)})})})}import{jsx as N,jsxs as St}from"react/jsx-runtime";function Wn({data:e,columns:t,filters:o=[],pagination:n,settings:s={},header:i,footer:c,className:d="",maxHeight:a="100%",loading:m=!1,error:b,emptyMessage:g="No data available",onRowSelectionChange:p,onExport:l,onRefresh:S,onTableReady:y,children:R,isRowSelectable:I,getRowId:h,defaultSelectedRows:D,onExternalSearch:x,aggregations:f={},onAggregationChange:T,rowClassName:k,persist:M}){let $=!!n,L=Gn(M,o,n?.pageSize||10),ge=He(L.initial.external),[ue,fe]=we([]),[ee,J]=we(L.initial.columnFilters),[Ye,Le]=we(L.initial.pagination),[gt,Ce]=we(()=>Object.fromEntries(oo(t,o).map(w=>[w.id,!1]))),[ft,Ge]=we({}),[Ne,ne]=we(L.initial.globalFilter),[Te,be]=we([]),[Ze,Se]=we(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Lt=He(null),Ee=He(null),Qe=He(null),E=He(null),[u,_]=we(0),[Y,U]=we(0),[bt,_e]=we(0),et=He(null),[Gt,qt]=we(!1),{enableSorting:Ue=!0,enableFiltering:Et=!0,enableGlobalFilter:_t=!0,enableColumnVisibility:Dt=!0,enableRowSelection:C=!0,showToolbar:F=!1,enableHeaderCheckbox:A=!0,toolbarPosition:X="default",showSerialNumbers:Z=!0,fixedCheckboxColumn:Pe=!0,striped:xt=!0,hoverable:ht=!0,compact:Kt=!0,bordered:mo=!0,fullHeight:Oo=!1,enableColumnResizing:Ho=!1,enableColumnPinning:De=!0,showHeader:vr=!0,selectionMode:kt="multiple",showCheckbox:jo=!0,groupedFilterLabel:yr="Global",showFilterChips:wr=!0}=s;ye(()=>{o.length>0&&!F&&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")&&!_t&&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).")},[]),ye(()=>{let w=()=>{et.current&&qt(et.current.scrollTop>0)},O=et.current;if(O)return O.addEventListener("scroll",w),()=>O.removeEventListener("scroll",w)},[]),ye(()=>{let w=()=>{Ee.current&&_(Ee.current.offsetHeight+16),Qe.current&&U(Qe.current.offsetHeight+16),E.current&&_e(E.current.offsetHeight+16)};w();let O=new ResizeObserver(()=>{setTimeout(w,50)});return Ee.current&&O.observe(Ee.current),Qe.current&&O.observe(Qe.current),E.current&&O.observe(E.current),()=>{O.disconnect()}},[F,i,X]),ye(()=>{L.persistFilters(ee)},[ee]),ye(()=>{L.persistGlobalFilter(Ne)},[Ne]),ye(()=>{L.persistPagination(Ye)},[Ye]);let Cr=w=>{ge.current=w,L.persistExternal(w),x?.(w)},po=io(()=>Dn({initialColumns:t,filters:o,showSerialNumbers:Z,enableRowSelection:C,selectionMode:kt,showCheckbox:jo,enableHeaderCheckbox:A,isRowSelectable:I}),[t,o,Z,C,I,kt,jo,A]),B=Aa({data:e,columns:po,getRowId:h,onSortingChange:Ue?fe:void 0,onColumnFiltersChange:Et?J:void 0,onGlobalFilterChange:_t?ne:void 0,getCoreRowModel:Ra(),getPaginationRowModel:$?za():void 0,getSortedRowModel:Ue?Fa():void 0,getFilteredRowModel:Et?Ma():void 0,onColumnVisibilityChange:Dt?Ce:void 0,onRowSelectionChange:C?Ge:void 0,onColumnOrderChange:be,onColumnPinningChange:De?w=>Se(O=>wn(typeof w=="function"?w(O):w,[...Z?["serialNumber"]:[],...C?["select"]:[]])):void 0,state:{sorting:Ue?ue:void 0,columnFilters:Et?ee:void 0,columnVisibility:Dt?gt:void 0,rowSelection:C?ft:{},globalFilter:Ne,pagination:$?Ye:void 0,columnOrder:Te,columnPinning:De?Ze:{}},onPaginationChange:$?Le:void 0,initialState:{columnPinning:De?{left:[...Z?["serialNumber"]:[],...C?["select"]:[]],right:[]}:void 0},enableRowSelection:C?w=>I?.(w.original)??!0:!1,enableSorting:Ue,enableColumnResizing:Ho,enableColumnPinning:De,columnResizeMode:"onChange",autoResetPageIndex:!L.pendingPageRestore()}),go=io(()=>Tn(B,f),[B,f,e,ee,Ne]),Nr=io(()=>Object.keys(go).length>0||po.some(w=>w.customFooter),[go,po]),$o=He({onRowSelectionChange:p,isRowSelectable:I});$o.current={onRowSelectionChange:p,isRowSelectable:I};let Uo=He(!1);ye(()=>{if(Uo.current||!D||!C)return;let w=B.getCoreRowModel().rows;if(w.length===0)return;let O={};for(let vt of w)vt.getCanSelect()&&D(vt.original)&&(O[vt.id]=!0);Uo.current=!0,Object.keys(O).length>0&&Ge(O)},[D,C,B,e]),ye(()=>{let{onRowSelectionChange:w,isRowSelectable:O}=$o.current;if(C&&w){let vt=B.getFilteredSelectedRowModel().rows.filter(Ot=>O?.(Ot.original)??!0).map(Ot=>Ot.original);w(vt)}},[ft,C,B]);let Tr=Io(w=>{kt==="single"?(B.resetRowSelection(),w.toggleSelected(!0)):w.toggleSelected()},[kt,B]),Wo=He(y);Wo.current=y,ye(()=>{Wo.current?.(B)},[B]);let qo=He(!1);ye(()=>{qo.current||(qo.current=!0,Object.keys(L.initial.external).length>0&&x?.(L.initial.external))},[]),ye(()=>L.syncSharedSlots(B),[B]),ye(()=>{$&&L.restorePageIndex(B,Le)},[e]);let Sr=Io(()=>{fe([])},[]),Pr=Io(()=>{J([]),ne(""),L.clearAll()},[]),Dr=(w,O)=>{De&&Cn(B,w,O,{container:et.current,alwaysPinnedLeft:[...Z?["serialNumber"]:[],...C&&Pe?["select"]:[]]})},kr=w=>w&&typeof w=="object"&&"content"in w,ke=io(()=>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(b)return N(We,{className:"shadow-sm rounded-xl w-full",children:N(qe,{className:"flex justify-center items-center",children:St("div",{className:"text-center",children:[N("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),N("p",{className:"mb-4 text-muted-foreground text-sm",children:b}),S&&St(v,{variant:"outline",size:"sm",onClick:S,className:"rounded-lg",children:[N(Un,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let fo=()=>F?N(To,{table:B,filters:o,globalFilter:Ne,onGlobalFilterChange:w=>ne(w),enableGlobalFilter:_t,onExport:l,onRefresh:S,loading:m,enableColumnVisibility:Dt,enableColumnPinning:De,enableSorting:Ue,showFilterChips:wr,onClearSorting:Sr,onClearFilters:Pr,onExternalSearch:Cr,initialExternalValues:ge.current,aggregations:f,onAggregationChange:T,groupedFilterLabel:yr,initialGroupedField:L.initial.groupedField,onGroupedFieldChange:L.persistGroupedField}):null,Rr=()=>{let w=0;return X==="above-header"&&(w+=u),ke&&(w+=bt),X==="below-header"&&(w+=Y),w},Ko=B.getVisibleLeafColumns().filter(w=>!w.getIsPinned()),Mr=Ko[Ko.length-1]?.id,Vt=Math.max(B.getVisibleLeafColumns().length,1);return N(yt,{children:St("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[F&&X==="default"&&N("div",{ref:Lt,className:"z-40 relative",children:fo()}),N(We,{className:r("shadow-sm overflow-hidden py-0",Oo&&"flex-1 min-h-0"),children:N(qe,{className:"h-full p-0",children:St("div",{className:"relative flex flex-col justify-between h-full",children:[m&&N("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:St("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[N(Un,{className:"size-5 text-primary animate-spin"}),N("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),N("div",{ref:et,className:r("relative overflow-auto rounded-t-xl",Oo?"flex-1 min-h-0":B.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:St(ho,{className:r("w-full border-separate border-spacing-0 relative",B.getState().columnSizingInfo.isResizingColumn&&"select-none",B.getRowModel().rows?.length===0&&"h-full"),children:[F&&X==="above-header"&&N("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:N(Re,{className:"hover:bg-transparent",children:N(Ve,{colSpan:Vt,className:"p-2 bg-sidebar border-b shadow-sm",children:N("div",{ref:Ee,children:fo()})})})}),ke&&(ke.showOnEmpty||B.getRowModel().rows?.length>0)&&N("thead",{className:r("sticky bg-sidebar border-b",Gt&&"shadow-sm"),style:{top:X==="above-header"?`${u}px`:"0px",zIndex:35},children:N(Re,{className:"hover:bg-transparent",children:N(Ve,{colSpan:Vt,className:r("bg-sidebar p-2 font-semibold text-foreground",Kt?"py-2":"py-4",ke.className),children:N("div",{ref:E,className:r("flex items-center w-full",ke.align==="center"&&"justify-center",ke.align==="right"&&"justify-end",ke.align==="left"&&"justify-start"),children:typeof ke.content=="string"?N("span",{className:"font-bold text-foreground text-lg tracking-tight",children:ke.content}):ke.content})})})}),F&&X==="below-header"&&N("thead",{className:r("sticky bg-sidebar border-b",Gt&&"shadow-sm"),style:{top:ke?`${bt}px`:"0px",zIndex:35},children:N(Re,{className:"hover:bg-transparent",children:N(Ve,{colSpan:Vt,className:"bg-sidebar p-2",children:N("div",{ref:Qe,children:fo()})})})}),vr&&N(Jo,{className:r("sticky bg-sidebar [&_tr]:border-b-0",Gt&&"shadow-sm"),style:{top:`${Rr()}px`,zIndex:30},children:N(jn,{table:B,aggregations:f,enableColumnPinning:De,enableColumnResizing:Ho,enableColumnVisibility:Dt,enableRowSelection:C,fixedCheckboxColumn:Pe,bordered:mo,compact:Kt,onPinColumn:Dr})}),N(Xo,{children:B.getRowModel().rows?.length?B.getRowModel().rows.map((w,O)=>{let vt=O===B.getRowModel().rows.length-1,Ot=k?k(w):"";return N(Re,{"data-index":O,"data-state":w.getIsSelected()&&"selected",className:r(ht&&"hover:bg-muted/50",xt&&O%2===0&&"bg-muted/20",w.getIsSelected()&&"bg-muted",kt==="single"&&"cursor-pointer",Ot),onClick:()=>{kt==="single"&&Tr(w)},children:w.getVisibleCells().map((xe,zr)=>{let bo=De&&(xe.column.getIsPinned()==="left"||xe.column.id==="serialNumber"||xe.column.id==="select"&&C),xo=De&&xe.column.getIsPinned()==="right",Fr=xe.column.id==="serialNumber";return N(Ve,{className:r(Kt?"py-2":"py-4",mo&&zr<w.getVisibleCells().length-1&&xe.column.id!==Mr&&"border-r",(!vt||!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:Ae(xe.column.getSize(),bo||xo),minWidth:Ae(xe.column.getSize(),bo||xo),...Nt(xe.column,De)},children:ka(xe.column.columnDef.cell,xe.getContext())},xe.id)})},w.id)}):N(Re,{children:N(Ve,{colSpan:Vt,className:"border-0 h-32 text-center",children:St("div",{className:"flex flex-col items-center gap-3",children:[N("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),N("p",{className:"font-medium text-muted-foreground",children:g})]})})})}),N($n,{table:B,columnAggregations:go,aggregations:f,enableColumnPinning:De,enableRowSelection:C,showSerialNumbers:Z,bordered:mo,compact:Kt})]})}),c&&N("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:N(ho,{children:N(Xt,{children:N(Re,{className:"bg-sidebar",children:N(Ve,{colSpan:Vt,className:"p-2",children:c})})})})})]})})}),N(So,{table:B,config:n}),R&&R(B)]})})}import{Separator as Ia}from"radix-ui";import{jsx as Ba}from"react/jsx-runtime";function so({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 Ga}from"lucide-react";import{AnimatePresence as Ea,motion as _a}from"framer-motion";import*as ut from"react";import*as qn from"react-dom";import{jsx as se,jsxs as $t}from"react/jsx-runtime";function Kn({table:e,visible:t,container:o,children:n,className:s,...i}){let[c,d]=ut.useState(!1);ut.useLayoutEffect(()=>{d(!0)},[]),ut.useEffect(()=>{function b(g){g.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[e]);let a=o??(c?globalThis.document?.body:null);if(!a||!e)return null;let m=t??e.getFilteredSelectedRowModel().rows.length>0;return qn.createPortal(se(Ea,{children:m&&se(_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:se(yt,{children:n})})}),a)}function Jn({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...c}){let d=se(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,...c,children:o?se(La,{className:"animate-spin"}):i});return t?$t(ot,{children:[se(nt,{asChild:!0,children:d}),se(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:se("p",{children:t})})]}):d}function Xn({table:e}){let t=ut.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?$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:[e.getFilteredSelectedRowModel().rows.length," selected"]}),se(so,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),$t(ot,{children:[se(nt,{asChild:!0,children:se(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:se(Ga,{className:"size-3.5"})})}),$t(rt,{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 mt,useEffect as Zn,useMemo as Lo,useCallback as Ft,useRef as Ya}from"react";import{Loader2 as Qn}from"lucide-react";import{Search as Va,Download as Oa,RefreshCw as Ha,Filter as ja,ChevronDown as $a,Settings2 as Ua}from"lucide-react";import{Fragment as Wa,jsx as z,jsxs as Q}from"react/jsx-runtime";function Bo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:c,sortDirection:d,onSortChange:a,selectedCount:m,totalCount:b,visibleCount:g,onExport:p,onRefresh:l,loading:S,onClearFilters:y,onClearSorting:R}){let I=e.filter(x=>x.sortable),h=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",D=c!=="";return z("div",{className:"rounded-xl p-0.5",children:z("div",{className:"px-2",children:z("div",{className:"flex flex-col gap-6",children:Q("div",{className:"flex items-center justify-between",children:[z("div",{className:"flex items-center gap-3",children:t.length>0&&Q("div",{className:"flex items-center gap-3 flex-wrap",children:[z("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:z(ja,{className:"h-4 w-4"})}),t.map(x=>z("div",{className:"relative min-w-[150px]",children:x.type==="select"?Q(it,{value:s[x.key]||"all",onValueChange:f=>i(x.key,f),children:[x.icon&&z(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(lt,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:z(st,{placeholder:x.placeholder||"Select..."})}),Q(dt,{className:"rounded-lg",children:[z(Oe,{value:"all",children:"All"}),x.options?.map(f=>z(Oe,{value:f.value,children:f.label},f.value))]})]}):Q("div",{className:"relative",children:[x.icon&&z(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(zt,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:f=>i(x.key,f.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),Q("div",{className:"flex items-center gap-2",children:[Q("div",{className:"relative",children:[z(Va,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),z(zt,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),I.length>0&&Q(Me,{children:[z(ze,{asChild:!0,children:Q(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[z("span",{children:"Sort"}),z($a,{className:"h-4 w-4 opacity-50"})]})}),Q(Fe,{align:"end",className:"w-[200px] rounded-lg",children:[z(re,{children:"Sort By"}),z(ce,{}),I.map(x=>Q("div",{children:[Q(W,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),Q(W,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),D&&Q(Wa,{children:[z(ce,{}),z(W,{onClick:R,children:"Clear All Sorting"})]})]})]}),Q(Me,{children:[z(ze,{asChild:!0,children:z(v,{variant:"outline",size:"sm",className:"rounded-lg",children:z(Ua,{className:"h-4 w-4"})})}),Q(Fe,{align:"end",className:"w-[200px] rounded-lg",children:[z(re,{children:"Table Settings"}),z(ce,{}),z(W,{onClick:R,children:"Clear All Sorting"}),z(W,{onClick:y,children:"Clear All Filters"})]})]}),p&&Q(v,{variant:"outline",size:"sm",onClick:p,className:"rounded-lg",children:[z(Oa,{className:"mr-2 h-4 w-4"}),"Export"]}),l&&z(v,{variant:"outline",size:"sm",onClick:l,disabled:S,className:"rounded-lg",children:z(Ha,{className:r("h-4 w-4",S&&"animate-spin")})})]})]})})})})}import{ChevronLeft as qa,ChevronRight as Ka,ChevronsLeft as Ja,ChevronsRight as Xa}from"lucide-react";import{jsx as q,jsxs as Ie}from"react/jsx-runtime";function Yn({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:c}){if(!c)return null;let d=c.pageSizeOptions||[10,20,50,100],a=(e-1)*o+1,m=Math.min(e*o,n),b=e>1,g=e<t,p=()=>{let S=[],y=[];for(let R=Math.max(2,e-2);R<=Math.min(t-1,e+2);R++)S.push(R);return e-2>2?y.push(1,"..."):y.push(1),y.push(...S),e+2<t-1?y.push("...",t):t>1&&y.push(t),y};return q("div",{className:"rounded-xl",children:Ie("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[q("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:c.showInfo!==!1&&Ie("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),Ie("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&Ie("div",{className:"flex items-center gap-2",children:[q("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Ie(it,{value:`${o}`,onValueChange:l=>i(Number(l)),children:[q(lt,{className:"h-9 w-[70px] rounded-lg",children:q(st,{})}),q(dt,{side:"top",className:"rounded-lg",children:d.map(l=>q(Oe,{value:`${l}`,children:l},l))})]})]}),Ie("div",{className:"flex items-center gap-2",children:[Ie(v,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!b,className:"hidden sm:flex rounded-lg",children:[q(Ja,{className:"h-4 w-4"}),q("span",{className:"sr-only",children:"Go to first page"})]}),Ie(v,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!b,className:"rounded-lg",children:[q(qa,{className:"h-4 w-4 sm:mr-2"}),q("span",{className:"hidden sm:inline",children:"Previous"}),q("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),c.showPageNumbers&&t>1&&q("div",{className:"hidden sm:flex items-center gap-1",children:p().map((l,S)=>{if(l==="...")return q("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${S}`);let y=l;return q(v,{variant:y===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(y),children:y},y)})}),Ie("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]}),Ie(v,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!g,className:"rounded-lg",children:[q("span",{className:"hidden sm:inline",children:"Next"}),q(Ka,{className:"h-4 w-4 sm:ml-2"}),q("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Ie(v,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!g,className:"hidden sm:flex rounded-lg",children:[q(Xa,{className:"h-4 w-4"}),q("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as j,jsxs as Pt}from"react/jsx-runtime";function er({data:e,template:t,fields:o=[],filters:n=[],pagination:s,settings:i={},header:c,footer:d,className:a="",loading:m=!1,error:b,emptyMessage:g="No items found",emptyIcon:p,onSelectionChange:l,onExport:S,onRefresh:y,onTemplateReady:R,children:I}){let{enableSorting:h=!0,enableFiltering:D=!0,enableGlobalSearch:x=!0,enableSelection:f=!1,enableExport:T=!1,showToolbar:k=!0,selectionMode:M="multiple",gridCols:$={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:L=4,aspectRatio:ge="auto",minCardWidth:ue=350,maxCardWidth:fe=350}=i,ee=!!s,[J,Ye]=mt(""),[Le,gt]=mt({}),[Ce,ft]=mt(""),[Ge,Ne]=mt("asc"),[ne,Te]=mt(new Set),[be,Ze]=mt(1),[Se,Lt]=mt(s?.pageSize||12),[Ee,Qe]=mt($.default),E=Lo(()=>{let C=[...e];if(x&&J){let F=o.filter(A=>A.searchable!==!1);C=C.filter(A=>F.some(X=>A[X.key]?.toString().toLowerCase().includes(J.toLowerCase())))}if(D&&Object.keys(Le).forEach(F=>{let A=Le[F];if(A!=null&&A!==""){let X=o.find(Z=>Z.key===F);X&&(C=C.filter(Z=>{let Pe=Z[F];return X.type==="boolean"?Pe===(A==="true"):X.type==="number"?Pe===Number(A):Pe?.toString().toLowerCase().includes(String(A).toLowerCase())}))}}),h&&Ce){let F=o.find(A=>A.key===Ce);F&&C.sort((A,X)=>{let Z=A[Ce],Pe=X[Ce];if(F.type==="number")return Ge==="asc"?Number(Z)-Number(Pe):Number(Pe)-Number(Z);if(F.type==="date"){let xt=new Date(Z),ht=new Date(Pe);return Ge==="asc"?xt.getTime()-ht.getTime():ht.getTime()-xt.getTime()}else{let xt=String(Z).toLowerCase(),ht=String(Pe).toLowerCase();return Ge==="asc"?xt.localeCompare(ht):ht.localeCompare(xt)}})}return C},[e,J,Le,Ce,Ge,o,x,D,h]),u=Lo(()=>{if(!ee)return E;let C=(be-1)*Se,F=C+Se;return E.slice(C,F)},[E,be,Se,ee]),_=Math.ceil(E.length/Se),Y=Ft(C=>{f&&Te(F=>{let A=new Set(F);return M==="single"?(A.clear(),A.add(C)):A.has(C)?A.delete(C):A.add(C),A})},[f,M]),U=Ft(()=>{!f||M==="single"||(ne.size===E.length?Te(new Set):Te(new Set(E.map((C,F)=>F))))},[f,M,ne.size,E.length]),bt=Ft((C,F)=>{gt(A=>({...A,[C]:F})),Ze(1)},[]),_e=Ft((C,F)=>{ft(C),Ne(F)},[]),et=Ft(()=>{Ye(""),gt({}),Ze(1)},[]),Gt=Ft(()=>{ft(""),Ne("asc")},[]),qt=Lo(()=>({getSelectedItems:()=>Array.from(ne).map(C=>E[C]),clearSelection:()=>Te(new Set),selectAll:U,getFilteredData:()=>E,getTotalCount:()=>e.length,getVisibleCount:()=>E.length,refresh:()=>y?.(),exportData:()=>S?.(E)}),[ne,E,e.length,U,y,S]),Ue=Ya(null);Ue.current=qt,Zn(()=>{R&&Ue.current&&R(Ue.current)},[]),Zn(()=>{if(f&&l){let C=Array.from(ne).map(F=>E[F]);l(C)}},[ne]);let Et=r("w-full","overflow-hidden",a),_t=r("grid",`gap-${L}`,"w-full","mx-auto","items-start"),Dt={gridTemplateColumns:Ee===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${ue}px, calc(100%/${Ee} - ${L*4}px), ${fe}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return b?j(We,{className:"w-full",children:j(qe,{className:"flex items-center justify-center py-12",children:Pt("div",{className:"text-center",children:[j("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),j("p",{className:"text-sm text-muted-foreground mb-4",children:b}),y&&Pt(v,{variant:"outline",size:"sm",onClick:y,children:[j(Qn,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):Pt("div",{className:r("w-full flex gap-2 flex-col h-full",Et),children:[c&&j(We,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:j(qe,{className:"p-2",children:c})}),k&&j(Bo,{fields:o,filters:n,globalFilter:J,onGlobalFilterChange:Ye,fieldFilters:Le,onFieldFilterChange:bt,sortField:Ce,sortDirection:Ge,onSortChange:_e,selectedCount:ne.size,totalCount:e.length,visibleCount:E.length,onExport:T?()=>S?.(E):void 0,onRefresh:y,loading:m,onClearFilters:et,onClearSorting:Gt}),j(We,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:j(qe,{className:"px-0",children:Pt("div",{className:"relative",children:[m&&j("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:Pt("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[j(Qn,{className:"size-5 animate-spin text-primary"}),j("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),u.length>0?j("div",{className:r(_t),style:Dt,children:u.map((C,F)=>{let A=ee?(be-1)*Se+F:F,X=ne.has(A);return Pt("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",ge==="square"?"aspect-square":"",ge==="video"?"aspect-video":"",f?"cursor-pointer":"",X?"ring-2 ring-primary":""),onClick:()=>f&&Y(A),children:[f&&M==="multiple"&&j("div",{className:"absolute top-2 right-2 z-10",children:j(Ct,{checked:X,onCheckedChange:()=>Y(A),className:"bg-background/80 backdrop-blur-sm",onClick:Z=>Z.stopPropagation()})}),t(C,F,X,()=>Y(A))]},A)})}):Pt("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[j("div",{className:"text-6xl",children:p||"\u{1F4CB}"}),j("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:g}),(J||Object.values(Le).some(C=>C))&&j(v,{variant:"outline",onClick:et,children:"Clear Filters"})]})]})})}),ee&&j("div",{className:"pb-1",children:j(Yn,{currentPage:be,totalPages:_,pageSize:Se,totalItems:E.length,onPageChange:Ze,onPageSizeChange:C=>{Lt(C),Ze(1)},config:s})}),d&&j("div",{className:"p-2 m-0.5",children:d}),I&&I(qt)]})}import{Loader as Za,X as Qa}from"lucide-react";import{AnimatePresence as ei,motion as ti}from"framer-motion";import*as pt from"react";import*as tr from"react-dom";import{jsx as le,jsxs as Ut}from"react/jsx-runtime";function or({controller:e,visible:t,container:o,children:n,className:s,...i}){let[c,d]=pt.useState(!1);pt.useLayoutEffect(()=>{d(!0)},[]),pt.useEffect(()=>{function g(p){p.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e]);let a=o??(c?globalThis.document?.body:null);if(!a||!e)return null;let m=e.getSelectedItems(),b=t??m.length>0;return tr.createPortal(le(ei,{children:b&&le(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:le(yt,{children:n})})}),a)}function nr({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:c,onClick:d,...a}){let m=le(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?le(Za,{className:"animate-spin"}):c});return o?Ut(ot,{children:[le(nt,{asChild:!0,children:m}),le(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:le("p",{children:o})})]}):m}function rr({controller:e}){let t=pt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return Ut("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Ut("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),le(so,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Ut(ot,{children:[le(nt,{asChild:!0,children:le(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:le(Qa,{className:"size-3.5"})})}),Ut(rt,{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 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 je,jsxs as Wt}from"react/jsx-runtime";var ai=({className:e,title:t,description:o,backAction:n,metadata:s,children:i,childrenClassName:c})=>{let d=()=>{if(!n)return null;let m={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.href?je(ri,{to:n.href,children:je(v,{...m,children:je(ar,{className:"size-6"})})}):je(v,{...m,onClick:n.onClick,children:je(ar,{className:"size-6"})})},a=()=>!s||s.length===0?null:je("div",{className:"flex gap-4",children:s.map((m,b)=>m.value&&Wt("div",{className:"text-sm",children:[Wt("span",{className:"text-muted-foreground",children:[m.label," "]}),je("span",{children:m.value})]},b))});return Wt("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[Wt("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),Wt("div",{className:"flex flex-col gap-2 w-max",children:[je("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&je("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&je("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",c),children:i})]})};import co from"react";import{jsx as $e,jsxs as lo}from"react/jsx-runtime";var ir="(min-width: 1024px)",ii=()=>{let[e,t]=co.useState(()=>typeof window>"u"||window.matchMedia(ir).matches);return co.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,c,d,a,m=co.Children.toArray(e).filter(p=>{if(co.isValidElement(p)){if(p.type===sr){let l=p.props;return s=l.children,i=l.className,!1}if(p.type===lr){let l=p.props;return c=l.children,d=l.className,!1}if(p.type===dr)return a=p.props,!1}return!0}),b=$e("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),g=p=>{let{side:l="right"}=p,S=(p.overlay??!0)||!n,y=r("w-1/3 max-w-full",p.className),R=r("h-full bg-background",l==="right"?"border-l":"border-r"),I=$e("div",{className:r("h-full p-2",o),children:m});return S?lo("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[$e("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:I}),lo("div",{tabIndex:-1,inert:!p.open,className:r("absolute inset-0 z-20",!p.open&&"pointer-events-none"),children:[$e("div",{className:r("absolute inset-0 bg-black/50 transition-opacity duration-500",p.open?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>p.onOpenChange(!1)}),$e("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",l==="right"?"right-0":"left-0",p.open?"translate-x-0 opacity-100":r(l==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),R,y),children:p.children})]})]}):lo("div",{className:"flex relative flex-1 overflow-hidden",children:[l==="left"&&$e("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,p.open?y:"w-0 border-0"),children:p.children}),$e("div",{className:r("h-full flex-1 min-w-0 overflow-auto transition-all duration-500",p.open&&"overflow-y-auto overflow-x-hidden"),children:I}),l==="right"&&$e("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",R,p.open?y:"w-0 border-0"),children:p.children})]})};return lo("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&$e("div",{className:r("border-b p-2",i),children:s}),a?g(a):b,c&&$e("div",{className:r("border-t p-2",d),children:c})]})};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 Je,jsxs as ur}from"react/jsx-runtime";var Go=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[c,d]=cr(!1),[a,m]=cr(!1),b=async()=>{if(!(!t||a)){m(!0);try{await this.copyToClipboard(t),d(!0),setTimeout(()=>d(!1),2e3)}catch(g){console.error("Failed to copy text:",g)}finally{m(!1)}}};return ur(ot,{children:[Je(nt,{asChild:!0,children:Je(v,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:b,disabled:a||!t,children:a?Je(mi,{className:"animate-spin"}):c?Je(ui,{className:"h-3 w-3"}):o||Je(ci,{className:"h-3 w-3"})})}),Je(rt,{children:c?"Copied!":a?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:c=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let d=t<0,a=Math.abs(t),b=(c&&a>=1e5?this.compactFormatter:this.currencyFormatter).format(a).replace("\u20B9","");return`${n}${d?"- ":""}${i?"\u20B9 ":""}${b}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let c=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`${c}${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`${c}${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:c="outline",customColors:d,icon:a,trueMessage:m="active",falseMessage:b="inactive"})=>{let g=typeof t=="boolean"?t?m:b:typeof t=="number"?t>0?m:b:t.toLowerCase(),p={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"}}},l=p[g.toLowerCase()]||p.inactive,S=d||l[c],y={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?g.charAt(0).toUpperCase()+g.slice(1):g;return Je("div",{className:"flex justify-center",children:ur("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",S.bg,S.text,S.border,y[i],o),children:[n&&(a?Je("span",{className:"flex items-center",children:a}):Je("span",{className:r("size-2 rounded-full",S.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 Eo,jsx as Be,jsxs as At}from"react/jsx-runtime";var mr=()=>{let e=gi(),t=bi();return Be("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:At("div",{className:"flex flex-col items-center space-y-4 text-center",children:[Be(pi,{className:"h-16 w-16 text-destructive"}),fi(e)?At(Eo,{children:[At("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?At(Eo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&At("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[Be("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),Be("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):At(Eo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),Be("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)})]}),Be(v,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as Xe}from"framer-motion";import{jsx as K,jsxs as pe}from"react/jsx-runtime";function xi({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return pe(Xe.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[K("title",{children:"Animated Checkmark"}),K(Xe.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),K(Xe.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function pr(){return K(We,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:pe(qe,{className:"space-y-4 flex flex-col items-center justify-center",children:[K(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:pe("div",{className:"relative",children:[K(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"}}),K(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)]"})]})}),pe(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:[K(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"}),K("div",{className:"flex items-center gap-4",children:K(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:pe("div",{className:"flex flex-col items-start gap-2",children:[pe("div",{className:"space-y-1.5",children:[pe("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[pe("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:[K("title",{children:"From"}),K("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),pe("div",{className:"flex items-center gap-2.5 group transition-all",children:[K("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:"$"}),K("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),K("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),pe("div",{className:"space-y-1.5",children:[pe("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[pe("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:[K("title",{children:"To"}),K("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),pe("div",{className:"flex items-center gap-2.5 group transition-all",children:[K("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"}),K("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),K(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 uo,jsxs as hi}from"react/jsx-runtime";var gr=()=>uo("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:[uo("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),uo("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),uo("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 It,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:[It(yi,{className:"h-15 w-15 text-destructive mb-4"}),It("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),_o("p",{className:"text-xl mb-4",children:["The page ",It("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:[It(v,{variant:"outline",onClick:o,children:"Go Back"}),It(v,{variant:"ghost",children:It(wi,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as Ni}from"lucide-react";import{jsx as Vo,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:[Vo(Ni,{className:"h-15 w-15 text-destructive mb-4"}),Vo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Vo("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 Bt,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:[Bt(Si,{className:"h-15 w-15 text-destructive mb-4"}),Bt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),Bt("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:[Bt(v,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),Bt(v,{variant:"ghost",children:Bt(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,Go as GeneralHelper,gr as Loader,fr as NotFound,br as OfflineUI,hr as Unauthorized,Zt as getTableExportView,In as readPersistedExternal};
3
3
  //# sourceMappingURL=index.js.map