@akshar-technosoft/ui 1.1.3 → 1.1.4

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.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client"
2
- "use strict";var _r=Object.create;var Qt=Object.defineProperty;var Or=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Hr=Object.getPrototypeOf,jr=Object.prototype.hasOwnProperty;var $r=(e,t)=>{for(var o in t)Qt(e,o,{get:t[o],enumerable:!0})},hn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Vr(t))!jr.call(e,s)&&s!==o&&Qt(e,s,{get:()=>t[s],enumerable:!(n=Or(t,s))||n.enumerable});return e};var zt=(e,t,o)=>(o=e!=null?_r(Hr(e)):{},hn(t||!e||!e.__esModule?Qt(o,"default",{value:e,enumerable:!0}):o,e)),Ur=e=>hn(Qt({},"__esModule",{value:!0}),e);var ea={};$r(ea,{AppContainer:()=>mr,AppContent:()=>xr,AppContentFooter:()=>en,AppContentHeader:()=>Qo,AppFooter:()=>hr,AppHeader:()=>fr,AppSheet:()=>tn,CurrencyTransfer:()=>rn,DataTable:()=>Ho,DataTableActionBar:()=>jo,DataTableActionBarAction:()=>$o,DataTableActionBarSelection:()=>Uo,DataTemplate:()=>Ko,DataTemplateActionBar:()=>Jo,DataTemplateActionBarAction:()=>Xo,DataTemplateActionBarSelection:()=>Yo,ErrorComponent:()=>nn,GeneralHelper:()=>bo,Loader:()=>an,NotFound:()=>sn,OfflineUI:()=>ln,Unauthorized:()=>dn,getTableExportView:()=>Ut,readPersistedExternal:()=>Go});module.exports=Ur(ea);var we=require("@tanstack/react-table"),Vo=require("lucide-react");var wn=require("radix-ui"),Cn=require("class-variance-authority");var vn=require("clsx"),yn=require("tailwind-merge");function r(...e){return(0,yn.twMerge)((0,vn.clsx)(e))}var Nn=require("react/jsx-runtime"),eo=(0,Cn.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 dark:focus-visible:border-ring",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function y({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?wn.Slot.Slot:"button";return(0,Nn.jsx)(i,{"data-slot":"button",className:r(eo({variant:t,size:o,className:e})),...s})}var Ke=require("react/jsx-runtime");function Po({className:e,...t}){return(0,Ke.jsx)("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:(0,Ke.jsx)("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Tn({className:e,...t}){return(0,Ke.jsx)("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Sn({className:e,...t}){return(0,Ke.jsx)("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function to({className:e,...t}){return(0,Ke.jsx)("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Fe({className:e,...t}){return(0,Ke.jsx)("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Pn({className:e,...t}){return(0,Ke.jsx)("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function He({className:e,...t}){return(0,Ke.jsx)("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}var Do=require("react/jsx-runtime");function Je({className:e,...t}){return(0,Do.jsx)("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 Xe({className:e,...t}){return(0,Do.jsx)("div",{"data-slot":"card-content",className:r("px-6",e),...t})}var wt=require("radix-ui");var Ye=require("react/jsx-runtime");function Ct({delayDuration:e=0,...t}){return(0,Ye.jsx)(wt.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ot({...e}){return(0,Ye.jsx)(Ct,{children:(0,Ye.jsx)(wt.Tooltip.Root,{"data-slot":"tooltip",...e})})}function nt({...e}){return(0,Ye.jsx)(wt.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function rt({className:e,sideOffset:t=0,children:o,...n}){return(0,Ye.jsx)(wt.Tooltip.Portal,{children:(0,Ye.jsxs)(wt.Tooltip.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,(0,Ye.jsx)(wt.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var j=require("lucide-react");var Dn=require("react/jsx-runtime");function Ft({className:e,type:t,...o}){return(0,Dn.jsx)("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})}var pe=require("radix-ui"),$t=require("lucide-react");var ae=require("react/jsx-runtime");function Ae({...e}){return(0,ae.jsx)(pe.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function Ie({...e}){return(0,ae.jsx)(pe.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Be({className:e,sideOffset:t=4,...o}){return(0,ae.jsx)(pe.DropdownMenu.Portal,{children:(0,ae.jsx)(pe.DropdownMenu.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 ko({...e}){return(0,ae.jsx)(pe.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function ee({className:e,inset:t,variant:o="default",...n}){return(0,ae.jsx)(pe.DropdownMenu.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 oo({className:e,children:t,checked:o,...n}){return(0,ae.jsxs)(pe.DropdownMenu.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:[(0,ae.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,ae.jsx)(pe.DropdownMenu.ItemIndicator,{children:(0,ae.jsx)($t.CheckIcon,{className:"size-4"})})}),t]})}function me({className:e,inset:t,...o}){return(0,ae.jsx)(pe.DropdownMenu.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 ge({className:e,...t}){return(0,ae.jsx)(pe.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function kn({...e}){return(0,ae.jsx)(pe.DropdownMenu.Sub,{"data-slot":"dropdown-menu-sub",...e})}function Rn({className:e,inset:t,children:o,...n}){return(0,ae.jsxs)(pe.DropdownMenu.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,(0,ae.jsx)($t.ChevronRightIcon,{className:"ml-auto size-4"})]})}function Mn({className:e,...t}){return(0,ae.jsx)(pe.DropdownMenu.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 Wr=new Set(["select","serialNumber"]);function Ut(e){let t=e.getVisibleLeafColumns().filter(n=>Wr.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)}}var dt=require("react");var Jt=require("react"),Bn=require("lucide-react"),Ln=require("date-fns");var Wt=require("radix-ui");var qt=require("react/jsx-runtime");function zn({...e}){return(0,qt.jsx)(Wt.Popover.Root,{"data-slot":"popover",...e})}function Fn({...e}){return(0,qt.jsx)(Wt.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function An({className:e,align:t="center",sideOffset:o=4,...n}){return(0,qt.jsx)(Wt.Popover.Portal,{children:(0,qt.jsx)(Wt.Popover.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})})}var no=zt(require("react"),1),At=require("lucide-react"),Kt=require("react-day-picker");var Ze=require("react/jsx-runtime");function In({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:u,...d}){let a=(0,Kt.getDefaultClassNames)();return(0,Ze.jsx)(Kt.DayPicker,{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(eo({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(eo({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})=>(0,Ze.jsx)("div",{"data-slot":"calendar",ref:f,className:r(m),...p}),Chevron:({className:m,orientation:f,...p})=>f==="left"?(0,Ze.jsx)(At.ChevronLeftIcon,{className:r("size-4",m),...p}):f==="right"?(0,Ze.jsx)(At.ChevronRightIcon,{className:r("size-4",m),...p}):(0,Ze.jsx)(At.ChevronDownIcon,{className:r("size-4",m),...p}),DayButton:qr,WeekNumber:({children:m,...f})=>(0,Ze.jsx)("td",{...f,children:(0,Ze.jsx)("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=(0,Kt.getDefaultClassNames)(),i=no.useRef(null);return no.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),(0,Ze.jsx)(y,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":o.selected&&!o.range_start&&!o.range_end&&!o.range_middle,"data-range-start":o.range_start,"data-range-end":o.range_end,"data-range-middle":o.range_middle,className:r("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,e),...n})}var fe=require("react/jsx-runtime");function En({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]=(0,Jt.useState)(!1),[p,g]=(0,Jt.useState)(e);(0,Jt.useEffect)(()=>{g(e)},[e]);let c=v=>{if(v==null)return null;if(v instanceof Date)return isNaN(v.getTime())?null:v;let w=new Date(v);return isNaN(w.getTime())?null:w},z=(v,w)=>{let _=c(v);return _?(0,Ln.format)(_,w):null},S=v=>{s?i?.(v):t?.(v)},I=()=>{S(p),f(!1)},b=()=>{g(e),f(!1)},F=()=>{let v=n==="single"?null:{from:null,to:null};g(v),S(v),f(!1)},R=()=>{let v=e;if(!v)return o;if(n==="single")return z(v,a||"PPP")??o;if(v.from&&v.to){let w=z(v.from,a||"MMM dd"),_=z(v.to,a||"MMM dd, yyyy");return w&&_?`${w} - ${_}`:o}if(v.from){let w=z(v.from,a||"MMM dd, yyyy");return w?`From ${w}`:o}if(v.to){let w=z(v.to,a||"MMM dd, yyyy");return w?`To ${w}`:o}return o},x=v=>{g(n==="single"?v:v||{from:null,to:null})};return(0,fe.jsxs)(zn,{open:m,onOpenChange:f,children:[(0,fe.jsx)(Fn,{className:"h-8",asChild:!0,children:(0,fe.jsxs)(y,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",R()===o&&"text-muted-foreground",d),children:[(0,fe.jsx)(Bn.Calendar,{className:"mr-2 h-4 w-4 shrink-0"}),R()]})}),(0,fe.jsxs)(An,{className:"w-auto p-0",align:"start",children:[(0,fe.jsx)("div",{className:"p-3",children:(0,fe.jsx)(In,{mode:n,selected:p,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),(0,fe.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,fe.jsx)(y,{variant:"ghost",size:"sm",onClick:F,children:"Clear"}),(0,fe.jsxs)("div",{className:"flex gap-2",children:[(0,fe.jsx)(y,{variant:"outline",size:"sm",onClick:b,children:"Cancel"}),(0,fe.jsx)(y,{size:"sm",onClick:I,disabled:n==="range"&&(!p?.from||!p?.to),children:"Apply"})]})]})]})]})}var Tt=require("lucide-react");var Ro=require("radix-ui"),Gn=require("lucide-react");var ro=require("react/jsx-runtime");function Nt({className:e,...t}){return(0,ro.jsx)(Ro.Checkbox.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:(0,ro.jsx)(Ro.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,ro.jsx)(Gn.CheckIcon,{className:"size-3.5"})})})}var M=require("react/jsx-runtime"),_n=[{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"}],Mo=(e,t)=>(t&&e.startsWith(`${t}.`)?e.replace(`${t}.`,""):e).split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");function zo(e,t){t&&Object.keys(e).forEach(o=>{let n=e[o];n&&t(o,{...n,enabled:!1,functions:[]})})}var On=e=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1);function Vn({table:e,aggregations:t,onAggregationChange:o}){let n=On(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(0,M.jsxs)(Ae,{children:[(0,M.jsx)(Ie,{asChild:!0,children:(0,M.jsxs)(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,M.jsx)(Tt.Calculator,{className:"size-4"}),(0,M.jsx)("span",{children:"Aggregations"}),(0,M.jsx)(Tt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,M.jsxs)(Be,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[(0,M.jsxs)(me,{className:"flex items-center justify-between px-4 py-2",children:[(0,M.jsx)("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&(0,M.jsx)(y,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>zo(t,o),children:"Clear All"})]}),(0,M.jsx)(ge,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return(0,M.jsxs)(kn,{children:[(0,M.jsx)(Rn,{className:"text-sm",children:(0,M.jsxs)("div",{className:"flex items-center w-full gap-2",children:[(0,M.jsx)(Nt,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),(0,M.jsx)("span",{className:r("flex-1",m&&"font-medium text-primary"),children:Mo(d.id)}),m&&(0,M.jsxs)("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(f=>(0,M.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary",title:_n.find(p=>p.value===f)?.label},f)),a?.functions&&a.functions.length>2&&(0,M.jsxs)("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),(0,M.jsxs)(Mn,{className:"w-48 rounded-lg",children:[(0,M.jsx)(me,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),_n.map(f=>(0,M.jsx)(oo,{checked:a?.functions?.includes(f.value)||!1,onCheckedChange:()=>u(d.id,f.value),className:"py-2 text-sm",children:(0,M.jsxs)("div",{className:"flex flex-col",children:[(0,M.jsx)("span",{children:f.label}),(0,M.jsx)("span",{className:"text-xs text-muted-foreground",children:f.description})]})},f.value))]})]},d.id)})]})]})}function Hn({table:e}){let t=On(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(0,M.jsxs)(Ae,{children:[(0,M.jsx)(Ie,{asChild:!0,children:(0,M.jsxs)(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,M.jsx)(Tt.Columns3,{className:"size-4"}),(0,M.jsx)("span",{children:"Columns"}),(0,M.jsx)(Tt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,M.jsxs)(Be,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,M.jsx)(me,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,M.jsx)(ge,{}),s.length>0&&(0,M.jsxs)(ko,{children:[(0,M.jsx)(me,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>(0,M.jsx)(oo,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:u=>i.toggleVisibility(!!u),children:Mo(i.id)},i.id))]}),o.map(i=>(0,M.jsxs)(ko,{children:[(0,M.jsx)(ge,{}),(0,M.jsx)(me,{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=>(0,M.jsx)(oo,{className:"text-sm",checked:u.getIsVisible(),onCheckedChange:d=>u.toggleVisibility(!!d),children:Mo(u.id,i.id)},u.id))]},i.id))]})]})}var xe=require("radix-ui"),St=require("lucide-react");var Q=require("react/jsx-runtime");function at({...e}){return(0,Q.jsx)(xe.Select.Root,{"data-slot":"select",...e})}function it({...e}){return(0,Q.jsx)(xe.Select.Value,{"data-slot":"select-value",...e})}function st({className:e,size:t="default",children:o,...n}){return(0,Q.jsxs)(xe.Select.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,(0,Q.jsx)(xe.Select.Icon,{asChild:!0,children:(0,Q.jsx)(St.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function lt({className:e,children:t,position:o="popper",...n}){return(0,Q.jsx)(xe.Select.Portal,{children:(0,Q.jsxs)(xe.Select.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:[(0,Q.jsx)(Kr,{}),(0,Q.jsx)(xe.Select.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}),(0,Q.jsx)(Jr,{})]})})}function je({className:e,children:t,...o}){return(0,Q.jsxs)(xe.Select.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:[(0,Q.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,Q.jsx)(xe.Select.ItemIndicator,{children:(0,Q.jsx)(St.CheckIcon,{className:"size-4"})})}),(0,Q.jsx)(xe.Select.ItemText,{children:t})]})}function Kr({className:e,...t}){return(0,Q.jsx)(xe.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(St.ChevronUpIcon,{className:"size-4"})})}function Jr({className:e,...t}){return(0,Q.jsx)(xe.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(St.ChevronDownIcon,{className:"size-4"})})}var h=require("react/jsx-runtime"),de=e=>e.id??e.key;function Fo({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:z={},onAggregationChange:S,groupedFilterLabel:I="Global",showFilterChips:b=!0,initialGroupedField:F,onGroupedFieldChange:R}){let[x,v]=(0,dt.useState)(c??{}),[w,_]=(0,dt.useState)(F??"all"),H=(0,dt.useRef)(c??{}),Y=(0,dt.useRef)(void 0);(0,dt.useEffect)(()=>()=>clearTimeout(Y.current),[]);let U=(l,V,le=!1)=>{let Z={...H.current,[l]:V};H.current=Z,v(Z),clearTimeout(Y.current),le?Y.current=setTimeout(()=>g?.(Z),500):g?.(Z)},ue=()=>{clearTimeout(Y.current),H.current={},v({}),_("all"),R?.("all"),f(),g?.({})},Ne=l=>t.find(le=>de(le)===l)?.externalSearch?x[l]??"":e.getColumn(l)?.getFilterValue(),ne=(l,V)=>{let le=t.find(Z=>de(Z)===l);le?.externalSearch?U(l,V,le.type==="text"):e.getColumn(l)?.setFilterValue(V)},Te=l=>{_(l),R?.(l),l!=="all"&&n("")},Ge=Object.values(z).some(l=>l?.enabled),Qe=l=>!!l.externalSearch||!!e.getColumn(de(l)),Se=l=>{let V=Ne(de(l));return V==null||V===""?!1:typeof V=="object"?!!(V.from||V.to):!0},gt=l=>l.type==="date"||l.type==="daterange",_e=l=>{ne(de(l),gt(l)?null:"")},ft=l=>{let V=Ne(de(l));return l.type==="select"?l.options?.find(le=>le.value===V)?.label??String(V):gt(l)?"set":String(V)},Pe=(l,V)=>{let le=V?.embedded;if(l.type==="select"){let Z=de(l),bt=Ne(Z);return(0,h.jsxs)(at,{value:bt?String(bt):"",onValueChange:ke=>ne(Z,ke==="__all__"?"":ke),children:[(0,h.jsx)(st,{size:"sm",className:r("w-full",le?"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:(0,h.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[l.icon&&(0,h.jsx)(l.icon,{className:"size-4 shrink-0 text-muted-foreground"}),(0,h.jsx)(it,{placeholder:l.placeholder})]})}),(0,h.jsxs)(lt,{className:"rounded-lg",children:[(0,h.jsx)(je,{value:"__all__",children:"All"}),l.options?.map(ke=>(0,h.jsx)(je,{value:ke.value,children:ke.label},ke.value))]})]})}return l.type==="date"||l.type==="daterange"?(0,h.jsx)(En,{value:Ne(de(l)),onChange:Z=>ne(de(l),Z),placeholder:l.placeholder,mode:l.type==="daterange"?"range":"single",dateFormat:l.dateFormat,externalSearch:l.externalSearch,onExternalChange:Z=>U(de(l),Z),triggerClassName:le?"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}):(0,h.jsxs)("div",{className:"relative w-full",children:[l.icon&&(0,h.jsx)(l.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,h.jsx)(Ft,{placeholder:l.placeholder,value:Ne(de(l))??"",onChange:Z=>{ne(de(l),Z.target.value)},className:r("h-8",l.icon&&"pl-9",le?"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"})]})},De=t.filter(l=>(l.placement??"bar")==="bar"),ie=t.filter(l=>l.placement==="menu"),ve=s&&ie.length>0,et=ie.filter(Se),We=e.getState().columnFilters.length>0||!!o||t.some(Se),{left:Oe=[],right:Gt=[]}=e.getState().columnPinning,Ve=Oe.some(l=>l!=="serialNumber"&&l!=="select")||Gt.length>0,qe=[{value:"all",label:"All Fields"},...ie.map(l=>({value:de(l),label:l.placeholder}))];return(0,h.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[De.length>0&&(0,h.jsx)(j.Filter,{className:"size-4 text-muted-foreground shrink-0"}),De.map(l=>Qe(l)?(0,h.jsx)("div",{className:r("relative min-w-[150px]",l.width),children:Pe(l)},de(l)):null),b&&et.map(l=>(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[(0,h.jsxs)("span",{className:"text-muted-foreground",children:[l.placeholder,":"]}),(0,h.jsx)("span",{className:"font-medium truncate max-w-[120px]",children:ft(l)}),(0,h.jsx)("button",{type:"button",onClick:()=>_e(l),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${l.placeholder}`,children:(0,h.jsx)(j.X,{className:"size-3.5"})})]},`chip-${de(l)}`)),We&&(0,h.jsxs)(y,{variant:"ghost",size:"sm",onClick:ue,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[(0,h.jsx)(j.FilterX,{className:"size-4"}),"Clear Filters"]}),(0,h.jsxs)("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&(0,h.jsxs)("div",{className:r("flex items-center",ve&&"bg-background border rounded-lg"),children:[ve&&(0,h.jsxs)(Ae,{children:[(0,h.jsx)(Ie,{asChild:!0,children:(0,h.jsxs)(y,{variant:"ghost",size:"sm",className:"gap-1 border border-transparent border-r-border rounded-l-lg rounded-r-none hover:bg-transparent shrink-0 relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:[(0,h.jsx)("span",{className:"text-sm font-medium max-w-28 truncate",children:w==="all"?I:qe.find(l=>l.value===w)?.label}),(0,h.jsx)(j.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,h.jsx)(Be,{align:"start",className:"w-48 rounded-lg",children:qe.map(l=>(0,h.jsxs)(ee,{onClick:()=>Te(l.value),className:"flex items-center justify-between",children:[(0,h.jsx)("span",{children:l.label}),w===l.value&&(0,h.jsx)(j.Check,{className:"size-4 text-primary"})]},l.value))})]}),(()=>{let l=ve&&w!=="all"?ie.find(V=>de(V)===w):void 0;return l?(0,h.jsx)("div",{className:"w-48",children:Pe(l,{embedded:!0})}):(0,h.jsxs)("div",{className:"relative",children:[(0,h.jsx)(j.Search,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,h.jsx)(Ft,{placeholder:ve?"Search all fields...":"Global search...",value:o??"",onChange:V=>n(V.target.value),className:r("pl-9 h-8 w-48",ve&&"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]")})]})})()]}),(0,h.jsx)(Vn,{table:e,aggregations:z,onAggregationChange:S}),a&&(0,h.jsx)(Hn,{table:e}),(0,h.jsxs)(Ae,{children:[(0,h.jsx)(Ie,{asChild:!0,children:(0,h.jsx)(y,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,h.jsx)(j.Settings2,{className:"size-4"})})}),(0,h.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,h.jsx)(me,{children:"Table Settings"}),(0,h.jsx)(ge,{}),i&&(0,h.jsxs)(ee,{onClick:()=>{let l=Ut(e);i(l.originals,l)},children:[(0,h.jsx)(j.Download,{className:"size-4"}),"Export"]}),(0,h.jsxs)(ee,{onClick:m,disabled:e.getState().sorting.length===0,children:[(0,h.jsx)(j.ArrowUpDown,{className:"size-4"}),"Clear All Sorting"]}),(0,h.jsxs)(ee,{onClick:ue,disabled:!We,children:[(0,h.jsx)(j.Filter,{className:"size-4"}),"Clear All Filters"]}),Object.keys(z).length>0&&(0,h.jsxs)(ee,{onClick:()=>zo(z,S),disabled:!Ge,children:[(0,h.jsx)(j.Calculator,{className:"size-4"}),"Clear Aggregations"]}),p&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ge,{}),(0,h.jsx)(me,{children:"Column Pinning"}),(0,h.jsxs)(ee,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Ve,children:[(0,h.jsx)(j.PinOff,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),u&&(0,h.jsx)(y,{variant:"outline",size:"sm",onClick:u,disabled:d,className:"rounded-lg",children:(0,h.jsx)(j.RefreshCw,{className:r("h-4 w-4",d&&"animate-spin")})})]})]})}var ao=require("lucide-react");var W=require("react/jsx-runtime");function Xr(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 Ao({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(0,W.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&&(0,W.jsxs)("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"]}),(0,W.jsxs)("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(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),(0,W.jsxs)(at,{value:f,onValueChange:p=>e.setPageSize(p==="-1"?Math.max(i,1):Number(p)),children:[(0,W.jsx)(st,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:(0,W.jsx)(it,{})}),(0,W.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(p=>(0,W.jsx)(je,{value:`${p}`,children:p===-1?"All":p},p))})]})]})})(),o>1&&(0,W.jsxs)("div",{className:"flex items-center gap-1",children:[(0,W.jsx)(y,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:u,children:(0,W.jsx)(ao.ChevronLeft,{className:"size-4"})}),t.showPageNumbers&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),(0,W.jsx)("div",{className:"hidden items-center gap-1 sm:flex",children:Xr(n,o).map((d,a)=>d==="ellipsis"?(0,W.jsx)("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):(0,W.jsx)(y,{variant:d-1===n?"default":"outline",size:"sm",className:r(u,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),(0,W.jsx)(y,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:u,children:(0,W.jsx)(ao.ChevronRight,{className:"size-4"})})]})]})]})}var D=require("react");function Pt(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 Le=(e,t)=>t||e!==150?e:"auto";function jn(e,t){return{left:[...t,...(e.left??[]).filter(o=>!t.includes(o))],right:(e.right??[]).filter(o=>!t.includes(o))}}function $n(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 Un={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 Wn(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=>{Un[a]&&(d[a]=Un[a](u))}),Object.keys(d).length>0&&(o[s]=d)}),o}function qn(e,t){return typeof t=="number"?e==="count"||e==="unique"?t.toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):t}function Yr(e,t){return t.split(".").reduce((o,n)=>o&&o[n],e)}function Kn(e,t=new Set){for(let o of e){let n=o.id??o.accessorKey;n&&t.add(String(n)),o.columns&&Kn(o.columns,t)}return t}function io(e,t){let o=Kn(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=>Yr(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}var It=require("react/jsx-runtime");function Jn({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(S=>d?.(S.original)??!0),c=g.length>0&&g.every(S=>S.getIsSelected()),z=g.some(S=>S.getIsSelected());return(0,It.jsx)(Nt,{checked:c||z&&"indeterminate",onCheckedChange:S=>{g.forEach(I=>I.toggleSelected(!!S))},disabled:!u||g.length===0,"aria-label":"Select all selectable rows"})},cell:({row:p})=>{let g=d?.(p.original)??!0;return(0,It.jsx)("div",{className:r("flex justify-center items-center",!g&&"opacity-50"),children:s==="multiple"?(0,It.jsx)(Nt,{checked:p.getIsSelected(),onCheckedChange:c=>g&&p.toggleSelected(!!c),"aria-label":"Select row",disabled:!g}):i?(0,It.jsx)("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})=>(0,It.jsx)("div",{className:"font-medium text-muted-foreground text-center",children:p.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...io(e,t)]}var ct=require("react");var Xn="atsui:tbl:v1:",Lo=new Map,Yn=new Map;function so(e){try{let t=localStorage.getItem(Xn+e);return t?JSON.parse(t):void 0}catch{return}}function Zn(e,t){try{localStorage.setItem(Xn+e,JSON.stringify(t))}catch{}}function Qn(e){return e?typeof e=="string"?{key:e}:e:null}function Eo(e,t){return Lo.get(e)??(t?so(e):void 0)??{}}function Dt(e,t,o){let n={...Eo(e,t),...o};Lo.set(e,n),t&&Zn(e,n)}var Bo=new Map;function er(e,t){let o=Bo.get(e);return o||(o=new Set,Bo.set(e,o)),o.add(t),()=>{o.delete(t)}}function lo(e){return{...so("g:"+e)??{},...Yn.get(e)??{}}}function co(e,t,o,n){let s=lo(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,Yn.set(e,u),(t||so("g:"+e)!==void 0)&&Zn("g:"+e,u),Bo.get(e)?.forEach(d=>d())}function tr(e,t){if(Dt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)co(e.group,e.local,o,void 0)}function Go(e){return(Lo.get(e)??so(e))?.external??{}}var Io=new Set;function or(e){return Io.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.`),Io.add(e),()=>{Io.delete(e)}}var _o=e=>{if(e==null||e instanceof Date)return e;let t=new Date(e);return isNaN(t.getTime())?e:t},nr=e=>{if(e&&typeof e=="object"&&("from"in e||"to"in e)){let t=_o(e.from),o=_o(e.to);return t===e.from&&o===e.to?e:{from:t,to:o}}return _o(e)};function rr(e,t,o){let n=Qn(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=(0,ct.useRef)(s);i.current=s;let u=(0,ct.useMemo)(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let b=Eo(n.key,n.local),F=n.group?lo(n.group):{},R=w=>{let _=w.shared&&n.group?F[w.shared]:b.filters?.[w.id]??b.external?.[w.id];return w.isDate?nr(_):_},x=[],v={};for(let w of s){if(!w.persist)continue;let _=R(w);_==null||_===""||(w.external?v[w.id]=_:x.push({id:w.id,value:_}))}return{columnFilters:x,globalFilter:b.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?b.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?b.pagination?.pageSize??o:o},external:v,groupedField:b.groupedField??"all"}},[]),d=(0,ct.useRef)(u.pagination.pageIndex),a=(0,ct.useRef)(u.pagination.pageIndex===0);return(0,ct.useEffect)(()=>{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.`),or(n.key)},[]),{enabled:!!n,initial:u,persistFilters:b=>{if(!n)return;let F={};for(let x of b)F[x.id]=x.value;let R={};for(let x of i.current)!x.persist||x.external||(x.shared&&n.group?co(n.group,n.local,x.shared,F[x.id]):F[x.id]!==void 0&&(R[x.id]=F[x.id]));Dt(n.key,n.local,{filters:R})},persistGlobalFilter:b=>{n&&Dt(n.key,n.local,{globalFilter:b})},persistExternal:b=>{if(!n)return;let F={};for(let R of i.current)!R.persist||!R.external||(R.shared&&n.group?co(n.group,n.local,R.shared,b[R.id]):b[R.id]!==void 0&&(F[R.id]=b[R.id]));Dt(n.key,n.local,{external:F})},persistPagination:b=>{!n||n.pagination===!1||a.current&&Dt(n.key,n.local,{pagination:{pageIndex:b.pageIndex,pageSize:b.pageSize}})},persistGroupedField:b=>{n&&Dt(n.key,n.local,{groupedField:b})},restorePageIndex:(b,F)=>{if(!n||a.current||b.getCoreRowModel().rows.length===0)return;let R=Math.min(d.current,Math.max(b.getPageCount()-1,0));a.current=!0,R>0&&F({pageIndex:R,pageSize:b.getState().pagination.pageSize})},syncSharedSlots:b=>{if(!n?.group)return;let F=n.group,R=i.current.filter(x=>x.shared&&x.persist&&!x.external);if(R.length!==0)return er(F,()=>{let x=lo(F);for(let v of R){let w=b.getColumn(v.id);if(!w)continue;let _=x[v.shared],H=_===void 0?void 0:v.isDate?nr(_):_,Y=w.getFilterValue();Object.is(Y??void 0,H??void 0)||w.setFilterValue(H)}})},clearAll:()=>{n&&tr(n,i.current.filter(b=>b.shared).map(b=>b.shared))}}}var Oo=require("@tanstack/react-table"),te=require("lucide-react");var P=require("react/jsx-runtime");function ar({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(0,P.jsx)(P.Fragment,{children:e.getHeaderGroups().map(g=>(0,P.jsx)(Fe,{className:"hover:bg-transparent",children:g.headers.map((c,z)=>{let S=c.depth===0&&c.colSpan>1,I=o&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&i),b=o&&c.column.getIsPinned()==="right",F=c.column.getCanSort(),R=o&&c.column.columnDef.enablePinning!==!1,x=c.column.id==="serialNumber",v=c.column.id==="select",w=x||v&&u,_=c.column.columnDef.headerAlign||"left",H=t&&t[c.column.id]?.enabled,Y=s&&!w&&c.column.getCanHide(),U=F||R&&!w||Y,ue=c.column.getIsSorted(),Ne={left:"justify-start",center:"justify-center",right:"justify-end"}[_];return(0,P.jsxs)(Pn,{colSpan:c.colSpan,"data-col-id":S?void 0:c.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&z<g.headers.length-1&&c.column.id!==p&&"border-r","relative",I&&"sticky left-0 z-25 bg-sidebar/95",b&&"sticky right-0 z-25 bg-sidebar/95",(x||v)&&"sticky left-0 z-25 bg-sidebar/95",S?"text-center":"text-left"),style:{width:Le(c.getSize(),I||b),minWidth:Le(c.getSize(),I||b),...Pt(c.column,o)},children:[S?(0,P.jsxs)("div",{className:"flex justify-center items-center",children:[(0,Oo.flexRender)(c.column.columnDef.header,c.getContext()),H&&(0,P.jsx)(te.Calculator,{className:"ml-1 w-3 h-3 text-primary"})]}):(0,P.jsxs)("div",{className:r("relative flex items-center px-2 w-full",Ne,F&&"cursor-pointer select-none"),onClick:F?ne=>{ne.target.closest("button, a, input, select, [role=button], [role=checkbox]")||c.column.getToggleSortingHandler()?.(ne)}:void 0,children:[(0,P.jsxs)("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",ue&&"pr-6"),children:[H&&(0,P.jsx)(te.Calculator,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),c.isPlaceholder?null:(0,P.jsx)("span",{className:"truncate",children:(0,Oo.flexRender)(c.column.columnDef.header,c.getContext())})]}),(U||F)&&(0,P.jsxs)("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[(0,P.jsx)("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")}),F&&(0,P.jsx)("span",{className:"relative shrink-0",children:ue?ue==="asc"?(0,P.jsx)(te.ChevronUp,{className:"w-4 h-4"}):(0,P.jsx)(te.ChevronDown,{className:"w-4 h-4"}):(0,P.jsx)(te.ChevronsUpDown,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),U&&(0,P.jsxs)(Ae,{children:[(0,P.jsx)(Ie,{asChild:!0,children:(0,P.jsx)(y,{variant:"ghost",size:"icon",tabIndex:-1,"aria-label":"Column options",onClick:ne=>ne.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",F&&"group-hover:ml-0.5","data-[state=open]:w-5 data-[state=open]:opacity-100",F&&"data-[state=open]:ml-0.5","transition-all duration-200 ease-out"),children:(0,P.jsx)(te.MoreHorizontal,{className:"w-4 h-4"})})}),(0,P.jsxs)(Be,{align:"end",className:"w-48",onClick:ne=>ne.stopPropagation(),children:[F&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{children:"Sorting"}),(0,P.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!1),disabled:ue==="asc",children:[(0,P.jsx)(te.ChevronUp,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),(0,P.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!0),disabled:ue==="desc",children:[(0,P.jsx)(te.ChevronDown,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),(0,P.jsxs)(ee,{onClick:()=>c.column.clearSorting(),disabled:!ue,children:[(0,P.jsx)(te.ChevronsUpDown,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(R&&!w||Y)&&(0,P.jsx)(ge,{})]}),R&&!w&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{children:"Pin Column"}),(0,P.jsxs)(ee,{onClick:()=>m(c.column.id,"right"),disabled:c.column.getIsPinned()==="right",children:[(0,P.jsx)(te.MoveRightIcon,{}),"Pin Right"]}),(0,P.jsxs)(ee,{onClick:()=>m(c.column.id,!1),disabled:!c.column.getIsPinned(),children:[(0,P.jsx)(te.PinOffIcon,{}),"Unpin"]}),Y&&(0,P.jsx)(ge,{})]}),Y&&(0,P.jsxs)(ee,{onClick:()=>c.column.toggleVisibility(!1),children:[(0,P.jsx)(te.EyeOff,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),(0,P.jsx)("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",H?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&c.column.getCanResize()&&!S&&c.colSpan===1&&(0,P.jsx)("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:ne=>ne.stopPropagation()})]},c.id)})},g.id))})}var be=require("react/jsx-runtime");function ir({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:(0,be.jsx)(to,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:(0,be.jsx)(Fe,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((c,z)=>{let S=c.column.id,I=t[S],b=n&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&s),F=n&&c.column.getIsPinned()==="right",R=c.column.id==="serialNumber",x=c.column.id==="select",w=c.column.columnDef.customFooter;return I||w||R&&m?(0,be.jsxs)(He,{className:r("relative px-2 py-2 font-semibold text-sm",z<f-1&&"border-r",u&&"py-1",b&&"sticky left-0 z-30 bg-sidebar",F&&"sticky right-0 z-30 bg-sidebar",(R||x)&&"sticky left-0 z-30 bg-sidebar",w?.className),style:{width:Le(c.getSize(),b||F),minWidth:Le(c.getSize(),b||F),...Pt(c.column,n)},children:[(0,be.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(w?.content){let H=typeof w.content=="function"?w.content(e):w.content;return(0,be.jsx)("div",{className:r("w-full h-full",w.align==="center"&&"text-center",w.align==="right"&&"text-right",w.align==="left"&&"text-left"),children:H})}return I?(0,be.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(I).map(([H,Y])=>(0,be.jsxs)("div",{className:"flex justify-between items-center text-muted-foreground",children:[(0,be.jsx)("span",{className:"text-xs capitalize",children:H}),(0,be.jsx)("span",{className:"font-medium text-foreground",children:o?.[S]?.format?.(Y,H)??qn(H,Y)})]},H))}):R&&m?(0,be.jsxs)("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${c.id}`):(0,be.jsx)(He,{className:r("relative px-0 py-0",z<f-1&&c.column.id!==g&&"border-r",u&&"py-0",b&&"sticky left-0 z-30 bg-sidebar",F&&"sticky right-0 z-30 bg-sidebar",(R||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:Le(c.getSize(),b||F),minWidth:Le(c.getSize(),b||F),...Pt(c.column,n)},children:(0,be.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${c.id}`)})})})}var T=require("react/jsx-runtime");function Ho({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:z,onTableReady:S,children:I,isRowSelectable:b,getRowId:F,defaultSelectedRows:R,onExternalSearch:x,aggregations:v={},onAggregationChange:w,rowClassName:_,persist:H}){let Y=!!n,U=rr(H,o,n?.pageSize||10),ue=(0,D.useRef)(U.initial.external),[Ne,ne]=(0,D.useState)([]),[Te,Ge]=(0,D.useState)(U.initial.columnFilters),[Qe,Se]=(0,D.useState)(U.initial.pagination),[gt,_e]=(0,D.useState)(()=>Object.fromEntries(io(t,o).map(N=>[N.id,!1]))),[ft,Pe]=(0,D.useState)({}),[De,ie]=(0,D.useState)(U.initial.globalFilter),[ve,et]=(0,D.useState)([]),[We,Oe]=(0,D.useState)(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Gt=(0,D.useRef)(null),Ve=(0,D.useRef)(null),qe=(0,D.useRef)(null),l=(0,D.useRef)(null),[V,le]=(0,D.useState)(0),[Z,bt]=(0,D.useState)(0),[ke,vo]=(0,D.useState)(0),tt=(0,D.useRef)(null),[_t,Yt]=(0,D.useState)(!1),{enableSorting:xt=!0,enableFiltering:Ot=!0,enableGlobalFilter:Vt=!0,enableColumnVisibility:Rt=!0,enableRowSelection:k=!0,showToolbar:L=!1,enableHeaderCheckbox:E=!0,toolbarPosition:oe="default",showSerialNumbers:re=!0,fixedCheckboxColumn:Re=!0,striped:ht=!0,hoverable:vt=!0,compact:Zt=!0,bordered:yo=!0,fullHeight:cn=!1,enableColumnResizing:un=!1,enableColumnPinning:Me=!0,showHeader:Sr=!0,selectionMode:Mt="multiple",showCheckbox:mn=!0,groupedFilterLabel:Pr="Global",showFilterChips:Dr=!0}=s;(0,D.useEffect)(()=>{o.length>0&&!L&&console.warn("[DataTable] `filters` are provided but settings.showToolbar is off \u2014 filters live in the toolbar, so none will render."),o.some(N=>N.placement==="menu")&&!Vt&&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).")},[]),(0,D.useEffect)(()=>{let N=()=>{tt.current&&Yt(tt.current.scrollTop>0)},K=tt.current;if(K)return K.addEventListener("scroll",N),()=>K.removeEventListener("scroll",N)},[]),(0,D.useEffect)(()=>{let N=()=>{Ve.current&&le(Ve.current.offsetHeight+16),qe.current&&bt(qe.current.offsetHeight+16),l.current&&vo(l.current.offsetHeight+16)};N();let K=new ResizeObserver(()=>{setTimeout(N,50)});return Ve.current&&K.observe(Ve.current),qe.current&&K.observe(qe.current),l.current&&K.observe(l.current),()=>{K.disconnect()}},[L,i,oe]),(0,D.useEffect)(()=>{U.persistFilters(Te)},[Te]),(0,D.useEffect)(()=>{U.persistGlobalFilter(De)},[De]),(0,D.useEffect)(()=>{U.persistPagination(Qe)},[Qe]);let kr=N=>{ue.current=N,U.persistExternal(N),x?.(N)},wo=(0,D.useMemo)(()=>Jn({initialColumns:t,filters:o,showSerialNumbers:re,enableRowSelection:k,selectionMode:Mt,showCheckbox:mn,enableHeaderCheckbox:E,isRowSelectable:b}),[t,o,re,k,b,Mt,mn,E]),O=(0,we.useReactTable)({data:e,columns:wo,getRowId:F,onSortingChange:xt?ne:void 0,onColumnFiltersChange:Ot?Ge:void 0,onGlobalFilterChange:Vt?ie:void 0,getCoreRowModel:(0,we.getCoreRowModel)(),getPaginationRowModel:Y?(0,we.getPaginationRowModel)():void 0,getSortedRowModel:xt?(0,we.getSortedRowModel)():void 0,getFilteredRowModel:Ot?(0,we.getFilteredRowModel)():void 0,onColumnVisibilityChange:Rt?_e:void 0,onRowSelectionChange:k?Pe:void 0,onColumnOrderChange:et,onColumnPinningChange:Me?N=>Oe(K=>jn(typeof N=="function"?N(K):N,[...re?["serialNumber"]:[],...k?["select"]:[]])):void 0,state:{sorting:xt?Ne:void 0,columnFilters:Ot?Te:void 0,columnVisibility:Rt?gt:void 0,rowSelection:k?ft:{},globalFilter:De,pagination:Y?Qe:void 0,columnOrder:ve,columnPinning:Me?We:{}},onPaginationChange:Y?Se:void 0,initialState:{columnPinning:Me?{left:[...re?["serialNumber"]:[],...k?["select"]:[]],right:[]}:void 0},enableRowSelection:k?N=>b?.(N.original)??!0:!1,enableColumnResizing:un,enableColumnPinning:Me,columnResizeMode:"onChange"}),Co=(0,D.useMemo)(()=>Wn(O,v),[O,v,e,Te,De]),Rr=(0,D.useMemo)(()=>Object.keys(Co).length>0||wo.some(N=>N.customFooter),[Co,wo]),pn=(0,D.useRef)({onRowSelectionChange:g,isRowSelectable:b});pn.current={onRowSelectionChange:g,isRowSelectable:b};let gn=(0,D.useRef)(!1);(0,D.useEffect)(()=>{if(gn.current||!R||!k)return;let N=O.getCoreRowModel().rows;if(N.length===0)return;let K={};for(let yt of N)yt.getCanSelect()&&R(yt.original)&&(K[yt.id]=!0);gn.current=!0,Object.keys(K).length>0&&Pe(K)},[R,k,O,e]),(0,D.useEffect)(()=>{let{onRowSelectionChange:N,isRowSelectable:K}=pn.current;if(k&&N){let yt=O.getFilteredSelectedRowModel().rows.filter(jt=>K?.(jt.original)??!0).map(jt=>jt.original);N(yt)}},[ft,k,O]);let Mr=(0,D.useCallback)(N=>{Mt==="single"?(O.resetRowSelection(),N.toggleSelected(!0)):N.toggleSelected()},[Mt,O]),fn=(0,D.useRef)(S);fn.current=S,(0,D.useEffect)(()=>{fn.current?.(O)},[O]);let bn=(0,D.useRef)(!1);(0,D.useEffect)(()=>{bn.current||(bn.current=!0,Object.keys(U.initial.external).length>0&&x?.(U.initial.external))},[]),(0,D.useEffect)(()=>U.syncSharedSlots(O),[O]),(0,D.useEffect)(()=>{Y&&U.restorePageIndex(O,Se)},[e]);let zr=(0,D.useCallback)(()=>{ne([])},[]),Fr=(0,D.useCallback)(()=>{Ge([]),ie(""),U.clearAll()},[]),Ar=(N,K)=>{Me&&$n(O,N,K,{container:tt.current,alwaysPinnedLeft:[...re?["serialNumber"]:[],...k&&Re?["select"]:[]]})},Ir=N=>N&&typeof N=="object"&&"content"in N,ze=(0,D.useMemo)(()=>i?Ir(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(0,T.jsx)(Je,{className:"shadow-sm rounded-xl w-full",children:(0,T.jsx)(Xe,{className:"flex justify-center items-center",children:(0,T.jsxs)("div",{className:"text-center",children:[(0,T.jsx)("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),(0,T.jsx)("p",{className:"mb-4 text-muted-foreground text-sm",children:f}),z&&(0,T.jsxs)(y,{variant:"outline",size:"sm",onClick:z,className:"rounded-lg",children:[(0,T.jsx)(Vo.Loader2,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let No=()=>L?(0,T.jsx)(Fo,{table:O,filters:o,globalFilter:De,onGlobalFilterChange:N=>ie(N),enableGlobalFilter:Vt,onExport:c,onRefresh:z,loading:m,enableColumnVisibility:Rt,enableColumnPinning:Me,showFilterChips:Dr,onClearSorting:zr,onClearFilters:Fr,onExternalSearch:kr,initialExternalValues:ue.current,aggregations:v,onAggregationChange:w,groupedFilterLabel:Pr,initialGroupedField:U.initial.groupedField,onGroupedFieldChange:U.persistGroupedField}):null,Br=()=>{let N=0;return oe==="above-header"&&(N+=V),ze&&(N+=ke),oe==="below-header"&&(N+=Z),N},xn=O.getVisibleLeafColumns().filter(N=>!N.getIsPinned()),Lr=xn[xn.length-1]?.id,Ht=Math.max(O.getVisibleLeafColumns().length,1);return(0,T.jsx)(Ct,{children:(0,T.jsxs)("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[L&&oe==="default"&&(0,T.jsx)("div",{ref:Gt,className:"z-40 relative",children:No()}),(0,T.jsx)(Je,{className:r("shadow-sm overflow-hidden py-0",cn&&"flex-1 min-h-0"),children:(0,T.jsx)(Xe,{className:"h-full p-0",children:(0,T.jsxs)("div",{className:"relative flex flex-col justify-between h-full",children:[m&&(0,T.jsx)("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:(0,T.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[(0,T.jsx)(Vo.Loader2,{className:"size-5 text-primary animate-spin"}),(0,T.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),(0,T.jsx)("div",{ref:tt,className:r("relative overflow-auto rounded-t-xl",cn?"flex-1 min-h-0":O.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:(0,T.jsxs)(Po,{className:r("w-full border-separate border-spacing-0 relative",O.getState().columnSizingInfo.isResizingColumn&&"select-none",O.getRowModel().rows?.length===0&&"h-full"),children:[L&&oe==="above-header"&&(0,T.jsx)("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:(0,T.jsx)(Fe,{className:"hover:bg-transparent",children:(0,T.jsx)(He,{colSpan:Ht,className:"p-2 bg-sidebar border-b shadow-sm",children:(0,T.jsx)("div",{ref:Ve,children:No()})})})}),ze&&(ze.showOnEmpty||O.getRowModel().rows?.length>0)&&(0,T.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:oe==="above-header"?`${V}px`:"0px",zIndex:35},children:(0,T.jsx)(Fe,{className:"hover:bg-transparent",children:(0,T.jsx)(He,{colSpan:Ht,className:r("bg-sidebar p-2 font-semibold text-foreground",Zt?"py-2":"py-4",ze.className),children:(0,T.jsx)("div",{ref:l,className:r("flex items-center w-full",ze.align==="center"&&"justify-center",ze.align==="right"&&"justify-end",ze.align==="left"&&"justify-start"),children:typeof ze.content=="string"?(0,T.jsx)("span",{className:"font-bold text-foreground text-lg tracking-tight",children:ze.content}):ze.content})})})}),L&&oe==="below-header"&&(0,T.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:ze?`${ke}px`:"0px",zIndex:35},children:(0,T.jsx)(Fe,{className:"hover:bg-transparent",children:(0,T.jsx)(He,{colSpan:Ht,className:"bg-sidebar p-2",children:(0,T.jsx)("div",{ref:qe,children:No()})})})}),Sr&&(0,T.jsx)(Tn,{className:r("sticky bg-sidebar [&_tr]:border-b-0",_t&&"shadow-sm"),style:{top:`${Br()}px`,zIndex:30},children:(0,T.jsx)(ar,{table:O,aggregations:v,enableColumnPinning:Me,enableColumnResizing:un,enableColumnVisibility:Rt,enableRowSelection:k,fixedCheckboxColumn:Re,bordered:yo,compact:Zt,onPinColumn:Ar})}),(0,T.jsx)(Sn,{children:O.getRowModel().rows?.length?O.getRowModel().rows.map((N,K)=>{let yt=K===O.getRowModel().rows.length-1,jt=_?_(N):"";return(0,T.jsx)(Fe,{"data-index":K,"data-state":N.getIsSelected()&&"selected",className:r(vt&&"hover:bg-muted/50",ht&&K%2===0&&"bg-muted/20",N.getIsSelected()&&"bg-muted",Mt==="single"&&"cursor-pointer",jt),onClick:()=>{Mt==="single"&&Mr(N)},children:N.getVisibleCells().map((ye,Er)=>{let To=Me&&(ye.column.getIsPinned()==="left"||ye.column.id==="serialNumber"||ye.column.id==="select"&&k),So=Me&&ye.column.getIsPinned()==="right",Gr=ye.column.id==="serialNumber";return(0,T.jsx)(He,{className:r(Zt?"py-2":"py-4",yo&&Er<N.getVisibleCells().length-1&&ye.column.id!==Lr&&"border-r",(!yt||!Rr)&&"border-b",To&&"sticky left-0 z-20 bg-sidebar/95",Gr&&"sticky left-0 z-20 bg-card/95",So&&"sticky right-0 z-20 bg-sidebar/95","p-1"),style:{width:Le(ye.column.getSize(),To||So),minWidth:Le(ye.column.getSize(),To||So),...Pt(ye.column,Me)},children:(0,we.flexRender)(ye.column.columnDef.cell,ye.getContext())},ye.id)})},N.id)}):(0,T.jsx)(Fe,{children:(0,T.jsx)(He,{colSpan:Ht,className:"border-0 h-32 text-center",children:(0,T.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,T.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,T.jsx)("p",{className:"font-medium text-muted-foreground",children:p})]})})})}),(0,T.jsx)(ir,{table:O,columnAggregations:Co,aggregations:v,enableColumnPinning:Me,enableRowSelection:k,showSerialNumbers:re,bordered:yo,compact:Zt})]})}),u&&(0,T.jsx)("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:(0,T.jsx)(Po,{children:(0,T.jsx)(to,{children:(0,T.jsx)(Fe,{className:"bg-sidebar",children:(0,T.jsx)(He,{colSpan:Ht,className:"p-2",children:u})})})})})]})})}),(0,T.jsx)(Ao,{table:O,config:n}),I&&I(O)]})})}var sr=require("radix-ui");var lr=require("react/jsx-runtime");function uo({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return(0,lr.jsx)(sr.Separator.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})}var mo=require("lucide-react"),po=require("framer-motion"),ut=zt(require("react"),1),dr=zt(require("react-dom"),1),J=require("react/jsx-runtime");function jo({table:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=ut.useState(!1);ut.useLayoutEffect(()=>{d(!0)},[]),ut.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 dr.createPortal((0,J.jsx)(po.AnimatePresence,{children:m&&(0,J.jsx)(po.motion.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:(0,J.jsx)(Ct,{children:n})})}),a)}function $o({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...u}){let d=(0,J.jsx)(y,{variant:"secondary",size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...u,children:o?(0,J.jsx)(mo.Loader,{className:"animate-spin"}):i});return t?(0,J.jsxs)(ot,{children:[(0,J.jsx)(nt,{asChild:!0,children:d}),(0,J.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,J.jsx)("p",{children:t})})]}):d}function Uo({table:e}){let t=ut.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,J.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,J.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,J.jsx)(uo,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,J.jsxs)(ot,{children:[(0,J.jsx)(nt,{asChild:!0,children:(0,J.jsx)(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,J.jsx)(mo.X,{className:"size-3.5"})})}),(0,J.jsxs)(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:[(0,J.jsx)("p",{children:"Clear selection"}),(0,J.jsx)("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:(0,J.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var $=require("react"),qo=require("lucide-react");var Ce=require("lucide-react");var C=require("react/jsx-runtime");function Wo({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:z,onClearFilters:S,onClearSorting:I}){let b=e.filter(x=>x.sortable),F=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",R=u!=="";return(0,C.jsx)("div",{className:"rounded-xl p-0.5",children:(0,C.jsx)("div",{className:"px-2",children:(0,C.jsx)("div",{className:"flex flex-col gap-6",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,C.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,C.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,C.jsx)(Ce.Filter,{className:"h-4 w-4"})}),t.map(x=>(0,C.jsx)("div",{className:"relative min-w-[150px]",children:x.type==="select"?(0,C.jsxs)(at,{value:s[x.key]||"all",onValueChange:v=>i(x.key,v),children:[x.icon&&(0,C.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,C.jsx)(st,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:(0,C.jsx)(it,{placeholder:x.placeholder||"Select..."})}),(0,C.jsxs)(lt,{className:"rounded-lg",children:[(0,C.jsx)(je,{value:"all",children:"All"}),x.options?.map(v=>(0,C.jsx)(je,{value:v.value,children:v.label},v.value))]})]}):(0,C.jsxs)("div",{className:"relative",children:[x.icon&&(0,C.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,C.jsx)(Ft,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:v=>i(x.key,v.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsxs)("div",{className:"relative",children:[(0,C.jsx)(Ce.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,C.jsx)(Ft,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),b.length>0&&(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Ie,{asChild:!0,children:(0,C.jsxs)(y,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,C.jsx)("span",{children:"Sort"}),(0,C.jsx)(Ce.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,C.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,C.jsx)(me,{children:"Sort By"}),(0,C.jsx)(ge,{}),b.map(x=>(0,C.jsxs)("div",{children:[(0,C.jsxs)(ee,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),(0,C.jsxs)(ee,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),R&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ge,{}),(0,C.jsx)(ee,{onClick:I,children:"Clear All Sorting"})]})]})]}),(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Ie,{asChild:!0,children:(0,C.jsx)(y,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,C.jsx)(Ce.Settings2,{className:"h-4 w-4"})})}),(0,C.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,C.jsx)(me,{children:"Table Settings"}),(0,C.jsx)(ge,{}),(0,C.jsx)(ee,{onClick:I,children:"Clear All Sorting"}),(0,C.jsx)(ee,{onClick:S,children:"Clear All Filters"})]})]}),g&&(0,C.jsxs)(y,{variant:"outline",size:"sm",onClick:g,className:"rounded-lg",children:[(0,C.jsx)(Ce.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),c&&(0,C.jsx)(y,{variant:"outline",size:"sm",onClick:c,disabled:z,className:"rounded-lg",children:(0,C.jsx)(Ce.RefreshCw,{className:r("h-4 w-4",z&&"animate-spin")})})]})]})})})})}var mt=require("lucide-react");var B=require("react/jsx-runtime");function cr({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 z=[],S=[];for(let I=Math.max(2,e-2);I<=Math.min(t-1,e+2);I++)z.push(I);return e-2>2?S.push(1,"..."):S.push(1),S.push(...z),e+2<t-1?S.push("...",t):t>1&&S.push(t),S};return(0,B.jsx)("div",{className:"rounded-xl",children:(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,B.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&(0,B.jsxs)("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,B.jsxs)(at,{value:`${o}`,onValueChange:c=>i(Number(c)),children:[(0,B.jsx)(st,{className:"h-9 w-[70px] rounded-lg",children:(0,B.jsx)(it,{})}),(0,B.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(c=>(0,B.jsx)(je,{value:`${c}`,children:c},c))})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!f,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsLeft,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!f,className:"rounded-lg",children:[(0,B.jsx)(mt.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,B.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&(0,B.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:g().map((c,z)=>{if(c==="...")return(0,B.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${z}`);let S=c;return(0,B.jsx)(y,{variant:S===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(S),children:S},S)})}),(0,B.jsxs)("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]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!p,className:"rounded-lg",children:[(0,B.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,B.jsx)(mt.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!p,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsRight,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var G=require("react/jsx-runtime");function Ko({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:z,onRefresh:S,onTemplateReady:I,children:b}){let{enableSorting:F=!0,enableFiltering:R=!0,enableGlobalSearch:x=!0,enableSelection:v=!1,enableExport:w=!1,showToolbar:_=!0,selectionMode:H="multiple",gridCols:Y={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:U=4,aspectRatio:ue="auto",minCardWidth:Ne=350,maxCardWidth:ne=350}=i,Te=!!s,[Ge,Qe]=(0,$.useState)(""),[Se,gt]=(0,$.useState)({}),[_e,ft]=(0,$.useState)(""),[Pe,De]=(0,$.useState)("asc"),[ie,ve]=(0,$.useState)(new Set),[et,We]=(0,$.useState)(1),[Oe,Gt]=(0,$.useState)(s?.pageSize||12),[Ve,qe]=(0,$.useState)(Y.default),l=(0,$.useMemo)(()=>{let k=[...e];if(x&&Ge){let L=o.filter(E=>E.searchable!==!1);k=k.filter(E=>L.some(oe=>E[oe.key]?.toString().toLowerCase().includes(Ge.toLowerCase())))}if(R&&Object.keys(Se).forEach(L=>{let E=Se[L];if(E!=null&&E!==""){let oe=o.find(re=>re.key===L);oe&&(k=k.filter(re=>{let Re=re[L];return oe.type==="boolean"?Re===(E==="true"):oe.type==="number"?Re===Number(E):Re?.toString().toLowerCase().includes(String(E).toLowerCase())}))}}),F&&_e){let L=o.find(E=>E.key===_e);L&&k.sort((E,oe)=>{let re=E[_e],Re=oe[_e];if(L.type==="number")return Pe==="asc"?Number(re)-Number(Re):Number(Re)-Number(re);if(L.type==="date"){let ht=new Date(re),vt=new Date(Re);return Pe==="asc"?ht.getTime()-vt.getTime():vt.getTime()-ht.getTime()}else{let ht=String(re).toLowerCase(),vt=String(Re).toLowerCase();return Pe==="asc"?ht.localeCompare(vt):vt.localeCompare(ht)}})}return k},[e,Ge,Se,_e,Pe,o,x,R,F]),V=(0,$.useMemo)(()=>{if(!Te)return l;let k=(et-1)*Oe,L=k+Oe;return l.slice(k,L)},[l,et,Oe,Te]),le=Math.ceil(l.length/Oe),Z=(0,$.useCallback)(k=>{v&&ve(L=>{let E=new Set(L);return H==="single"?(E.clear(),E.add(k)):E.has(k)?E.delete(k):E.add(k),E})},[v,H]),bt=(0,$.useCallback)(()=>{!v||H==="single"||(ie.size===l.length?ve(new Set):ve(new Set(l.map((k,L)=>L))))},[v,H,ie.size,l.length]),ke=(0,$.useCallback)((k,L)=>{gt(E=>({...E,[k]:L})),We(1)},[]),vo=(0,$.useCallback)((k,L)=>{ft(k),De(L)},[]),tt=(0,$.useCallback)(()=>{Qe(""),gt({}),We(1)},[]),_t=(0,$.useCallback)(()=>{ft(""),De("asc")},[]),Yt=(0,$.useMemo)(()=>({getSelectedItems:()=>Array.from(ie).map(k=>l[k]),clearSelection:()=>ve(new Set),selectAll:bt,getFilteredData:()=>l,getTotalCount:()=>e.length,getVisibleCount:()=>l.length,refresh:()=>S?.(),exportData:()=>z?.(l)}),[ie,l,e.length,bt,S,z]),xt=(0,$.useRef)(null);xt.current=Yt,(0,$.useEffect)(()=>{I&&xt.current&&I(xt.current)},[]),(0,$.useEffect)(()=>{if(v&&c){let k=Array.from(ie).map(L=>l[L]);c(k)}},[ie]);let Ot=r("w-full","overflow-hidden",a),Vt=r("grid",`gap-${U}`,"w-full","mx-auto","items-start"),Rt={gridTemplateColumns:Ve===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Ne}px, calc(100%/${Ve} - ${U*4}px), ${ne}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return f?(0,G.jsx)(Je,{className:"w-full",children:(0,G.jsx)(Xe,{className:"flex items-center justify-center py-12",children:(0,G.jsxs)("div",{className:"text-center",children:[(0,G.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,G.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:f}),S&&(0,G.jsxs)(y,{variant:"outline",size:"sm",onClick:S,children:[(0,G.jsx)(qo.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,G.jsxs)("div",{className:r("w-full flex gap-2 flex-col h-full",Ot),children:[u&&(0,G.jsx)(Je,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,G.jsx)(Xe,{className:"p-2",children:u})}),_&&(0,G.jsx)(Wo,{fields:o,filters:n,globalFilter:Ge,onGlobalFilterChange:Qe,fieldFilters:Se,onFieldFilterChange:ke,sortField:_e,sortDirection:Pe,onSortChange:vo,selectedCount:ie.size,totalCount:e.length,visibleCount:l.length,onExport:w?()=>z?.(l):void 0,onRefresh:S,loading:m,onClearFilters:tt,onClearSorting:_t}),(0,G.jsx)(Je,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,G.jsx)(Xe,{className:"px-0",children:(0,G.jsxs)("div",{className:"relative",children:[m&&(0,G.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,G.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,G.jsx)(qo.Loader2,{className:"size-5 animate-spin text-primary"}),(0,G.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),V.length>0?(0,G.jsx)("div",{className:r(Vt),style:Rt,children:V.map((k,L)=>{let E=Te?(et-1)*Oe+L:L,oe=ie.has(E);return(0,G.jsxs)("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",ue==="square"?"aspect-square":"",ue==="video"?"aspect-video":"",v?"cursor-pointer":"",oe?"ring-2 ring-primary":""),onClick:()=>v&&Z(E),children:[v&&H==="multiple"&&(0,G.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,G.jsx)(Nt,{checked:oe,onCheckedChange:()=>Z(E),className:"bg-background/80 backdrop-blur-sm",onClick:re=>re.stopPropagation()})}),t(k,L,oe,()=>Z(E))]},E)})}):(0,G.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,G.jsx)("div",{className:"text-6xl",children:g||"\u{1F4CB}"}),(0,G.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:p}),(Ge||Object.values(Se).some(k=>k))&&(0,G.jsx)(y,{variant:"outline",onClick:tt,children:"Clear Filters"})]})]})})}),Te&&(0,G.jsx)("div",{className:"pb-1",children:(0,G.jsx)(cr,{currentPage:et,totalPages:le,pageSize:Oe,totalItems:l.length,onPageChange:We,onPageSizeChange:k=>{Gt(k),We(1)},config:s})}),d&&(0,G.jsx)("div",{className:"p-2 m-0.5",children:d}),b&&b(Yt)]})}var go=require("lucide-react"),fo=require("framer-motion"),pt=zt(require("react"),1),ur=zt(require("react-dom"),1),X=require("react/jsx-runtime");function Jo({controller:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=pt.useState(!1);pt.useLayoutEffect(()=>{d(!0)},[]),pt.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 ur.createPortal((0,X.jsx)(fo.AnimatePresence,{children:f&&(0,X.jsx)(fo.motion.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:(0,X.jsx)(Ct,{children:n})})}),a)}function Xo({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:u,onClick:d,...a}){let m=(0,X.jsx)(y,{variant:t,size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:d,...a,children:n?(0,X.jsx)(go.Loader,{className:"animate-spin"}):u});return o?(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:m}),(0,X.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,X.jsx)("p",{children:o})})]}):m}function Yo({controller:e}){let t=pt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return(0,X.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,X.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),(0,X.jsx)(uo,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:(0,X.jsx)(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,X.jsx)(go.X,{className:"size-3.5"})})}),(0,X.jsxs)(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:[(0,X.jsx)("p",{children:"Clear selection"}),(0,X.jsx)("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:(0,X.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var pr=require("react/jsx-runtime"),mr=({children:e,className:t})=>(0,pr.jsx)("div",{className:r("flex flex-col h-full gap-2",t),children:e});var Zo=require("lucide-react");var gr=require("react-router"),se=require("react/jsx-runtime"),fr=({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?(0,se.jsx)(gr.NavLink,{to:n.href,children:(0,se.jsx)(y,{...m,children:(0,se.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})}):(0,se.jsx)(y,{...m,onClick:n.onClick,children:(0,se.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})},a=()=>!s||s.length===0?null:(0,se.jsx)("div",{className:"flex gap-4",children:s.map((m,f)=>m.value&&(0,se.jsxs)("div",{className:"text-sm",children:[(0,se.jsxs)("span",{className:"text-muted-foreground",children:[m.label," "]}),(0,se.jsx)("span",{children:m.value})]},f))});return(0,se.jsxs)("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[(0,se.jsxs)("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),(0,se.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,se.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&(0,se.jsx)("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&(0,se.jsx)("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",u),children:i})]})};var Xt=zt(require("react"),1),ce=require("react/jsx-runtime"),br="(min-width: 1024px)",Zr=()=>{let[e,t]=Xt.default.useState(()=>typeof window>"u"||window.matchMedia(br).matches);return Xt.default.useEffect(()=>{let o=window.matchMedia(br),n=()=>t(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[]),e},Qo=e=>null,en=e=>null,tn=e=>null,xr=({children:e,className:t,contentClassName:o})=>{let n=Zr(),s,i,u,d,a,m=Xt.default.Children.toArray(e).filter(g=>{if(Xt.default.isValidElement(g)){if(g.type===Qo){let c=g.props;return s=c.children,i=c.className,!1}if(g.type===en){let c=g.props;return u=c.children,d=c.className,!1}if(g.type===tn)return a=g.props,!1}return!0}),f=(0,ce.jsx)("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),p=g=>{let{side:c="right"}=g,z=(g.overlay??!0)||!n,S=r("w-1/3 max-w-full",g.className),I=r("h-full bg-background",c==="right"?"border-l":"border-r"),b=(0,ce.jsx)("div",{className:r("h-full p-2",o),children:m});return z?(0,ce.jsxs)("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[(0,ce.jsx)("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:b}),(0,ce.jsxs)("div",{tabIndex:-1,inert:!g.open,className:r("absolute inset-0 z-20",!g.open&&"pointer-events-none"),children:[(0,ce.jsx)("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)}),(0,ce.jsx)("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"),I,S),children:g.children})]})]}):(0,ce.jsxs)("div",{className:"flex relative flex-1 overflow-hidden",children:[c==="left"&&(0,ce.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,g.open?S:"w-0 border-0"),children:g.children}),(0,ce.jsx)("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"&&(0,ce.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,g.open?S:"w-0 border-0"),children:g.children})]})};return(0,ce.jsxs)("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&(0,ce.jsx)("div",{className:r("border-b p-2",i),children:s}),a?p(a):f,u&&(0,ce.jsx)("div",{className:r("border-t p-2",d),children:u})]})};var vr=require("react/jsx-runtime"),hr=({className:e,children:t})=>t==null?null:(0,vr.jsx)("div",{className:r("flex items-center w-full gap-4 p-2 [&>*:last-child]:ml-auto",e),children:t});var on=require("react"),Bt=require("lucide-react");var he=require("react/jsx-runtime"),bo=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]=(0,on.useState)(!1),[a,m]=(0,on.useState)(!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(0,he.jsxs)(ot,{children:[(0,he.jsx)(nt,{asChild:!0,children:(0,he.jsx)(y,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:f,disabled:a||!t,children:a?(0,he.jsx)(Bt.Loader2Icon,{className:"animate-spin"}):u?(0,he.jsx)(Bt.Check,{className:"h-3 w-3"}):o||(0,he.jsx)(Bt.Copy,{className:"h-3 w-3"})})}),(0,he.jsx)(rt,{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,z=d||c[u],S={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},I=s?p.charAt(0).toUpperCase()+p.slice(1):p;return(0,he.jsx)("div",{className:"flex justify-center",children:(0,he.jsxs)("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",z.bg,z.text,z.border,S[i],o),children:[n&&(a?(0,he.jsx)("span",{className:"flex items-center",children:a}):(0,he.jsx)("span",{className:r("size-2 rounded-full",z.dot),"aria-hidden":"true"})),I]})})}};var yr=require("lucide-react"),Lt=require("react-router"),q=require("react/jsx-runtime"),nn=()=>{let e=(0,Lt.useRouteError)(),t=(0,Lt.useNavigate)();return(0,q.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,q.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,q.jsx)(yr.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,Lt.isRouteErrorResponse)(e)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,q.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,q.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,q.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,q.jsx)("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)})]}),(0,q.jsx)(y,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var $e=require("framer-motion");var A=require("react/jsx-runtime");function Qr({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return(0,A.jsxs)($e.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[(0,A.jsx)("title",{children:"Animated Checkmark"}),(0,A.jsx)($e.motion.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,A.jsx)($e.motion.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function rn(){return(0,A.jsx)(Je,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,A.jsxs)(Xe,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,A.jsx)($e.motion.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:(0,A.jsxs)("div",{className:"relative",children:[(0,A.jsx)($e.motion.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"}}),(0,A.jsx)(Qr,{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)]"})]})}),(0,A.jsxs)($e.motion.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:[(0,A.jsx)($e.motion.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"}),(0,A.jsx)("div",{className:"flex items-center gap-4",children:(0,A.jsx)($e.motion.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:(0,A.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("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:[(0,A.jsx)("title",{children:"From"}),(0,A.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("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:"$"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,A.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("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:[(0,A.jsx)("title",{children:"To"}),(0,A.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("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"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,A.jsx)($e.motion.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"})]})]})})}var kt=require("react/jsx-runtime"),an=()=>(0,kt.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,kt.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,kt.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,kt.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,kt.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var wr=require("react-router");var Cr=require("lucide-react"),xo=require("react-router"),Ee=require("react/jsx-runtime"),sn=()=>{let e=(0,wr.useLocation)(),t=(0,xo.useNavigate)(),o=()=>{window.history.length>2?t(-1):t("/")};return(0,Ee.jsxs)("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:[(0,Ee.jsx)(Cr.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Ee.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,Ee.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,Ee.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,Ee.jsxs)("div",{className:"flex space-x-4",children:[(0,Ee.jsx)(y,{variant:"outline",onClick:o,children:"Go Back"}),(0,Ee.jsx)(y,{variant:"ghost",children:(0,Ee.jsx)(xo.NavLink,{to:"/",children:"Return Home"})})]})]})};var Nr=require("lucide-react"),Et=require("react/jsx-runtime"),ln=()=>(0,Et.jsxs)("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:[(0,Et.jsx)(Nr.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Et.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,Et.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var Tr=require("lucide-react");var ho=require("react-router"),Ue=require("react/jsx-runtime"),dn=()=>{let e=(0,ho.useNavigate)();return(0,Ue.jsxs)("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:[(0,Ue.jsx)(Tr.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Ue.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,Ue.jsx)("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."}),(0,Ue.jsxs)("div",{className:"flex space-x-4",children:[(0,Ue.jsx)(y,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,Ue.jsx)(y,{variant:"ghost",children:(0,Ue.jsx)(ho.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppContainer,AppContent,AppContentFooter,AppContentHeader,AppFooter,AppHeader,AppSheet,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,getTableExportView,readPersistedExternal});
2
+ "use strict";var _r=Object.create;var Qt=Object.defineProperty;var Or=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Hr=Object.getPrototypeOf,jr=Object.prototype.hasOwnProperty;var $r=(e,t)=>{for(var o in t)Qt(e,o,{get:t[o],enumerable:!0})},hn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Vr(t))!jr.call(e,s)&&s!==o&&Qt(e,s,{get:()=>t[s],enumerable:!(n=Or(t,s))||n.enumerable});return e};var zt=(e,t,o)=>(o=e!=null?_r(Hr(e)):{},hn(t||!e||!e.__esModule?Qt(o,"default",{value:e,enumerable:!0}):o,e)),Ur=e=>hn(Qt({},"__esModule",{value:!0}),e);var ea={};$r(ea,{AppContainer:()=>mr,AppContent:()=>xr,AppContentFooter:()=>en,AppContentHeader:()=>Qo,AppFooter:()=>hr,AppHeader:()=>fr,AppSheet:()=>tn,CurrencyTransfer:()=>rn,DataTable:()=>Ho,DataTableActionBar:()=>jo,DataTableActionBarAction:()=>$o,DataTableActionBarSelection:()=>Uo,DataTemplate:()=>Ko,DataTemplateActionBar:()=>Jo,DataTemplateActionBarAction:()=>Xo,DataTemplateActionBarSelection:()=>Yo,ErrorComponent:()=>nn,GeneralHelper:()=>bo,Loader:()=>an,NotFound:()=>sn,OfflineUI:()=>ln,Unauthorized:()=>dn,getTableExportView:()=>Ut,readPersistedExternal:()=>Go});module.exports=Ur(ea);var we=require("@tanstack/react-table"),Vo=require("lucide-react");var wn=require("radix-ui"),Cn=require("class-variance-authority");var vn=require("clsx"),yn=require("tailwind-merge");function r(...e){return(0,yn.twMerge)((0,vn.clsx)(e))}var Nn=require("react/jsx-runtime"),eo=(0,Cn.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 dark:focus-visible:border-ring",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function y({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?wn.Slot.Slot:"button";return(0,Nn.jsx)(i,{"data-slot":"button",className:r(eo({variant:t,size:o,className:e})),...s})}var Ke=require("react/jsx-runtime");function Po({className:e,...t}){return(0,Ke.jsx)("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:(0,Ke.jsx)("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Tn({className:e,...t}){return(0,Ke.jsx)("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Sn({className:e,...t}){return(0,Ke.jsx)("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function to({className:e,...t}){return(0,Ke.jsx)("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Fe({className:e,...t}){return(0,Ke.jsx)("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Pn({className:e,...t}){return(0,Ke.jsx)("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function He({className:e,...t}){return(0,Ke.jsx)("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}var Do=require("react/jsx-runtime");function Je({className:e,...t}){return(0,Do.jsx)("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 Xe({className:e,...t}){return(0,Do.jsx)("div",{"data-slot":"card-content",className:r("px-6",e),...t})}var wt=require("radix-ui");var Ye=require("react/jsx-runtime");function Ct({delayDuration:e=0,...t}){return(0,Ye.jsx)(wt.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ot({...e}){return(0,Ye.jsx)(Ct,{children:(0,Ye.jsx)(wt.Tooltip.Root,{"data-slot":"tooltip",...e})})}function nt({...e}){return(0,Ye.jsx)(wt.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function rt({className:e,sideOffset:t=0,children:o,...n}){return(0,Ye.jsx)(wt.Tooltip.Portal,{children:(0,Ye.jsxs)(wt.Tooltip.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,(0,Ye.jsx)(wt.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var $=require("lucide-react");var Dn=require("react/jsx-runtime");function Ft({className:e,type:t,...o}){return(0,Dn.jsx)("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})}var pe=require("radix-ui"),$t=require("lucide-react");var ae=require("react/jsx-runtime");function Ae({...e}){return(0,ae.jsx)(pe.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function Ie({...e}){return(0,ae.jsx)(pe.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Be({className:e,sideOffset:t=4,...o}){return(0,ae.jsx)(pe.DropdownMenu.Portal,{children:(0,ae.jsx)(pe.DropdownMenu.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 ko({...e}){return(0,ae.jsx)(pe.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function ee({className:e,inset:t,variant:o="default",...n}){return(0,ae.jsx)(pe.DropdownMenu.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 oo({className:e,children:t,checked:o,...n}){return(0,ae.jsxs)(pe.DropdownMenu.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:[(0,ae.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,ae.jsx)(pe.DropdownMenu.ItemIndicator,{children:(0,ae.jsx)($t.CheckIcon,{className:"size-4"})})}),t]})}function me({className:e,inset:t,...o}){return(0,ae.jsx)(pe.DropdownMenu.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 ge({className:e,...t}){return(0,ae.jsx)(pe.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function kn({...e}){return(0,ae.jsx)(pe.DropdownMenu.Sub,{"data-slot":"dropdown-menu-sub",...e})}function Rn({className:e,inset:t,children:o,...n}){return(0,ae.jsxs)(pe.DropdownMenu.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,(0,ae.jsx)($t.ChevronRightIcon,{className:"ml-auto size-4"})]})}function Mn({className:e,...t}){return(0,ae.jsx)(pe.DropdownMenu.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 Wr=new Set(["select","serialNumber"]);function Ut(e){let t=e.getVisibleLeafColumns().filter(n=>Wr.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)}}var dt=require("react");var Jt=require("react"),Bn=require("lucide-react"),Ln=require("date-fns");var Wt=require("radix-ui");var qt=require("react/jsx-runtime");function zn({...e}){return(0,qt.jsx)(Wt.Popover.Root,{"data-slot":"popover",...e})}function Fn({...e}){return(0,qt.jsx)(Wt.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function An({className:e,align:t="center",sideOffset:o=4,...n}){return(0,qt.jsx)(Wt.Popover.Portal,{children:(0,qt.jsx)(Wt.Popover.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})})}var no=zt(require("react"),1),At=require("lucide-react"),Kt=require("react-day-picker");var Ze=require("react/jsx-runtime");function In({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:u,...d}){let a=(0,Kt.getDefaultClassNames)();return(0,Ze.jsx)(Kt.DayPicker,{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(eo({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(eo({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})=>(0,Ze.jsx)("div",{"data-slot":"calendar",ref:b,className:r(m),...g}),Chevron:({className:m,orientation:b,...g})=>b==="left"?(0,Ze.jsx)(At.ChevronLeftIcon,{className:r("size-4",m),...g}):b==="right"?(0,Ze.jsx)(At.ChevronRightIcon,{className:r("size-4",m),...g}):(0,Ze.jsx)(At.ChevronDownIcon,{className:r("size-4",m),...g}),DayButton:qr,WeekNumber:({children:m,...b})=>(0,Ze.jsx)("td",{...b,children:(0,Ze.jsx)("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=(0,Kt.getDefaultClassNames)(),i=no.useRef(null);return no.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),(0,Ze.jsx)(y,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":o.selected&&!o.range_start&&!o.range_end&&!o.range_middle,"data-range-start":o.range_start,"data-range-end":o.range_end,"data-range-middle":o.range_middle,className:r("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,e),...n})}var fe=require("react/jsx-runtime");function En({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,b]=(0,Jt.useState)(!1),[g,f]=(0,Jt.useState)(e);(0,Jt.useEffect)(()=>{f(e)},[e]);let c=p=>{if(p==null)return null;if(p instanceof Date)return isNaN(p.getTime())?null:p;let D=new Date(p);return isNaN(D.getTime())?null:D},M=(p,D)=>{let L=c(p);return L?(0,Ln.format)(L,D):null},T=p=>{s?i?.(p):t?.(p)},I=()=>{T(g),b(!1)},O=()=>{f(e),b(!1)},h=()=>{let p=n==="single"?null:{from:null,to:null};f(p),T(p),b(!1)},z=()=>{let p=e;if(!p)return o;if(n==="single")return M(p,a||"PPP")??o;if(p.from&&p.to){let D=M(p.from,a||"MMM dd"),L=M(p.to,a||"MMM dd, yyyy");return D&&L?`${D} - ${L}`:o}if(p.from){let D=M(p.from,a||"MMM dd, yyyy");return D?`From ${D}`:o}if(p.to){let D=M(p.to,a||"MMM dd, yyyy");return D?`To ${D}`:o}return o},x=p=>{f(n==="single"?p:p||{from:null,to:null})};return(0,fe.jsxs)(zn,{open:m,onOpenChange:b,children:[(0,fe.jsx)(Fn,{className:"h-8",asChild:!0,children:(0,fe.jsxs)(y,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",z()===o&&"text-muted-foreground",d),children:[(0,fe.jsx)(Bn.Calendar,{className:"mr-2 h-4 w-4 shrink-0"}),z()]})}),(0,fe.jsxs)(An,{className:"w-auto p-0",align:"start",children:[(0,fe.jsx)("div",{className:"p-3",children:(0,fe.jsx)(In,{mode:n,selected:g,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),(0,fe.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,fe.jsx)(y,{variant:"ghost",size:"sm",onClick:h,children:"Clear"}),(0,fe.jsxs)("div",{className:"flex gap-2",children:[(0,fe.jsx)(y,{variant:"outline",size:"sm",onClick:O,children:"Cancel"}),(0,fe.jsx)(y,{size:"sm",onClick:I,disabled:n==="range"&&(!g?.from||!g?.to),children:"Apply"})]})]})]})]})}var Tt=require("lucide-react");var Ro=require("radix-ui"),Gn=require("lucide-react");var ro=require("react/jsx-runtime");function Nt({className:e,...t}){return(0,ro.jsx)(Ro.Checkbox.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:(0,ro.jsx)(Ro.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,ro.jsx)(Gn.CheckIcon,{className:"size-3.5"})})})}var R=require("react/jsx-runtime"),_n=[{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"}],Mo=(e,t)=>(t&&e.startsWith(`${t}.`)?e.replace(`${t}.`,""):e).split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");function zo(e,t){t&&Object.keys(e).forEach(o=>{let n=e[o];n&&t(o,{...n,enabled:!1,functions:[]})})}var On=e=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1);function Vn({table:e,aggregations:t,onAggregationChange:o}){let n=On(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||[],b=m.includes(a)?m.filter(g=>g!==a):[...m,a];o(d,{enabled:b.length>0,functions:b})};return(0,R.jsxs)(Ae,{children:[(0,R.jsx)(Ie,{asChild:!0,children:(0,R.jsxs)(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,R.jsx)(Tt.Calculator,{className:"size-4"}),(0,R.jsx)("span",{children:"Aggregations"}),(0,R.jsx)(Tt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,R.jsxs)(Be,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[(0,R.jsxs)(me,{className:"flex items-center justify-between px-4 py-2",children:[(0,R.jsx)("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&(0,R.jsx)(y,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>zo(t,o),children:"Clear All"})]}),(0,R.jsx)(ge,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return(0,R.jsxs)(kn,{children:[(0,R.jsx)(Rn,{className:"text-sm",children:(0,R.jsxs)("div",{className:"flex items-center w-full gap-2",children:[(0,R.jsx)(Nt,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),(0,R.jsx)("span",{className:r("flex-1",m&&"font-medium text-primary"),children:Mo(d.id)}),m&&(0,R.jsxs)("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(b=>(0,R.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary",title:_n.find(g=>g.value===b)?.label},b)),a?.functions&&a.functions.length>2&&(0,R.jsxs)("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),(0,R.jsxs)(Mn,{className:"w-48 rounded-lg",children:[(0,R.jsx)(me,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),_n.map(b=>(0,R.jsx)(oo,{checked:a?.functions?.includes(b.value)||!1,onCheckedChange:()=>u(d.id,b.value),className:"py-2 text-sm",children:(0,R.jsxs)("div",{className:"flex flex-col",children:[(0,R.jsx)("span",{children:b.label}),(0,R.jsx)("span",{className:"text-xs text-muted-foreground",children:b.description})]})},b.value))]})]},d.id)})]})]})}function Hn({table:e}){let t=On(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(0,R.jsxs)(Ae,{children:[(0,R.jsx)(Ie,{asChild:!0,children:(0,R.jsxs)(y,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,R.jsx)(Tt.Columns3,{className:"size-4"}),(0,R.jsx)("span",{children:"Columns"}),(0,R.jsx)(Tt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,R.jsxs)(Be,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,R.jsx)(me,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,R.jsx)(ge,{}),s.length>0&&(0,R.jsxs)(ko,{children:[(0,R.jsx)(me,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>(0,R.jsx)(oo,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:u=>i.toggleVisibility(!!u),children:Mo(i.id)},i.id))]}),o.map(i=>(0,R.jsxs)(ko,{children:[(0,R.jsx)(ge,{}),(0,R.jsx)(me,{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=>(0,R.jsx)(oo,{className:"text-sm",checked:u.getIsVisible(),onCheckedChange:d=>u.toggleVisibility(!!d),children:Mo(u.id,i.id)},u.id))]},i.id))]})]})}var xe=require("radix-ui"),St=require("lucide-react");var Q=require("react/jsx-runtime");function at({...e}){return(0,Q.jsx)(xe.Select.Root,{"data-slot":"select",...e})}function it({...e}){return(0,Q.jsx)(xe.Select.Value,{"data-slot":"select-value",...e})}function st({className:e,size:t="default",children:o,...n}){return(0,Q.jsxs)(xe.Select.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,(0,Q.jsx)(xe.Select.Icon,{asChild:!0,children:(0,Q.jsx)(St.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function lt({className:e,children:t,position:o="popper",...n}){return(0,Q.jsx)(xe.Select.Portal,{children:(0,Q.jsxs)(xe.Select.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:[(0,Q.jsx)(Kr,{}),(0,Q.jsx)(xe.Select.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}),(0,Q.jsx)(Jr,{})]})})}function je({className:e,children:t,...o}){return(0,Q.jsxs)(xe.Select.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:[(0,Q.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,Q.jsx)(xe.Select.ItemIndicator,{children:(0,Q.jsx)(St.CheckIcon,{className:"size-4"})})}),(0,Q.jsx)(xe.Select.ItemText,{children:t})]})}function Kr({className:e,...t}){return(0,Q.jsx)(xe.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(St.ChevronUpIcon,{className:"size-4"})})}function Jr({className:e,...t}){return(0,Q.jsx)(xe.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(St.ChevronDownIcon,{className:"size-4"})})}var v=require("react/jsx-runtime"),de=e=>e.id??e.key;function Fo({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:d=!1,enableColumnVisibility:a=!0,onClearSorting:m,onClearFilters:b,enableColumnPinning:g=!1,onExternalSearch:f,initialExternalValues:c,aggregations:M={},onAggregationChange:T,groupedFilterLabel:I="Global",showFilterChips:O=!0,initialGroupedField:h,onGroupedFieldChange:z}){let[x,p]=(0,dt.useState)(c??{}),[D,L]=(0,dt.useState)(h??"all"),F=(0,dt.useRef)(c??{}),K=(0,dt.useRef)(void 0);(0,dt.useEffect)(()=>()=>clearTimeout(K.current),[]);let H=(l,j,le=!1)=>{let Z={...F.current,[l]:j};F.current=Z,p(Z),clearTimeout(K.current),le?K.current=setTimeout(()=>f?.(Z),500):f?.(Z)},ue=()=>{clearTimeout(K.current),F.current={},p({}),L("all"),z?.("all"),b(),f?.({})},Ne=l=>t.find(le=>de(le)===l)?.externalSearch?x[l]??"":e.getColumn(l)?.getFilterValue(),ne=(l,j)=>{let le=t.find(Z=>de(Z)===l);le?.externalSearch?H(l,j,le.type==="text"):e.getColumn(l)?.setFilterValue(j)},Te=l=>{L(l),z?.(l),l!=="all"&&n("")},Ge=Object.values(M).some(l=>l?.enabled),Qe=l=>!!l.externalSearch||!!e.getColumn(de(l)),Se=l=>{let j=Ne(de(l));return j==null||j===""?!1:typeof j=="object"?!!(j.from||j.to):!0},gt=l=>l.type==="date"||l.type==="daterange",_e=l=>{ne(de(l),gt(l)?null:"")},ft=l=>{let j=Ne(de(l));return l.type==="select"?l.options?.find(le=>le.value===j)?.label??String(j):gt(l)?"set":String(j)},Pe=(l,j)=>{let le=j?.embedded;if(l.type==="select"){let Z=de(l),bt=Ne(Z);return(0,v.jsxs)(at,{value:bt?String(bt):"",onValueChange:ke=>ne(Z,ke==="__all__"?"":ke),children:[(0,v.jsx)(st,{size:"sm",className:r("w-full",le?"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:(0,v.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[l.icon&&(0,v.jsx)(l.icon,{className:"size-4 shrink-0 text-muted-foreground"}),(0,v.jsx)(it,{placeholder:l.placeholder})]})}),(0,v.jsxs)(lt,{className:"rounded-lg",children:[(0,v.jsx)(je,{value:"__all__",children:"All"}),l.options?.map(ke=>(0,v.jsx)(je,{value:ke.value,children:ke.label},ke.value))]})]})}return l.type==="date"||l.type==="daterange"?(0,v.jsx)(En,{value:Ne(de(l)),onChange:Z=>ne(de(l),Z),placeholder:l.placeholder,mode:l.type==="daterange"?"range":"single",dateFormat:l.dateFormat,externalSearch:l.externalSearch,onExternalChange:Z=>H(de(l),Z),triggerClassName:le?"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}):(0,v.jsxs)("div",{className:"relative w-full",children:[l.icon&&(0,v.jsx)(l.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,v.jsx)(Ft,{placeholder:l.placeholder,value:Ne(de(l))??"",onChange:Z=>{ne(de(l),Z.target.value)},className:r("h-8",l.icon&&"pl-9",le?"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"})]})},De=t.filter(l=>(l.placement??"bar")==="bar"),ie=t.filter(l=>l.placement==="menu"),ve=s&&ie.length>0,et=ie.filter(Se),We=e.getState().columnFilters.length>0||!!o||t.some(Se),{left:Oe=[],right:Gt=[]}=e.getState().columnPinning,Ve=Oe.some(l=>l!=="serialNumber"&&l!=="select")||Gt.length>0,qe=[{value:"all",label:"All Fields"},...ie.map(l=>({value:de(l),label:l.placeholder}))];return(0,v.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[De.length>0&&(0,v.jsx)($.Filter,{className:"size-4 text-muted-foreground shrink-0"}),De.map(l=>Qe(l)?(0,v.jsx)("div",{className:r("relative min-w-[150px]",l.width),children:Pe(l)},de(l)):null),O&&et.map(l=>(0,v.jsxs)("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[(0,v.jsxs)("span",{className:"text-muted-foreground",children:[l.placeholder,":"]}),(0,v.jsx)("span",{className:"font-medium truncate max-w-[120px]",children:ft(l)}),(0,v.jsx)("button",{type:"button",onClick:()=>_e(l),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${l.placeholder}`,children:(0,v.jsx)($.X,{className:"size-3.5"})})]},`chip-${de(l)}`)),We&&(0,v.jsxs)(y,{variant:"ghost",size:"sm",onClick:ue,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[(0,v.jsx)($.FilterX,{className:"size-4"}),"Clear Filters"]}),(0,v.jsxs)("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&(0,v.jsxs)("div",{className:r("flex items-center",ve&&"bg-background border rounded-lg"),children:[ve&&(0,v.jsxs)(Ae,{children:[(0,v.jsx)(Ie,{asChild:!0,children:(0,v.jsxs)(y,{variant:"ghost",size:"sm",className:"gap-1 border border-transparent border-r-border rounded-l-lg rounded-r-none hover:bg-transparent shrink-0 relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:[(0,v.jsx)("span",{className:"text-sm font-medium max-w-28 truncate",children:D==="all"?I:qe.find(l=>l.value===D)?.label}),(0,v.jsx)($.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,v.jsx)(Be,{align:"start",className:"w-48 rounded-lg",children:qe.map(l=>(0,v.jsxs)(ee,{onClick:()=>Te(l.value),className:"flex items-center justify-between",children:[(0,v.jsx)("span",{children:l.label}),D===l.value&&(0,v.jsx)($.Check,{className:"size-4 text-primary"})]},l.value))})]}),(()=>{let l=ve&&D!=="all"?ie.find(j=>de(j)===D):void 0;return l?(0,v.jsx)("div",{className:"w-48",children:Pe(l,{embedded:!0})}):(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)($.Search,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,v.jsx)(Ft,{placeholder:ve?"Search all fields...":"Global search...",value:o??"",onChange:j=>n(j.target.value),className:r("pl-9 h-8 w-48",ve&&"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]")})]})})()]}),(0,v.jsx)(Vn,{table:e,aggregations:M,onAggregationChange:T}),a&&(0,v.jsx)(Hn,{table:e}),(0,v.jsxs)(Ae,{children:[(0,v.jsx)(Ie,{asChild:!0,children:(0,v.jsx)(y,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,v.jsx)($.Settings2,{className:"size-4"})})}),(0,v.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,v.jsx)(me,{children:"Table Settings"}),(0,v.jsx)(ge,{}),i&&(0,v.jsxs)(ee,{onClick:()=>{let l=Ut(e);i(l.originals,l)},children:[(0,v.jsx)($.Download,{className:"size-4"}),"Export"]}),(0,v.jsxs)(ee,{onClick:m,disabled:e.getState().sorting.length===0,children:[(0,v.jsx)($.ArrowUpDown,{className:"size-4"}),"Clear All Sorting"]}),(0,v.jsxs)(ee,{onClick:ue,disabled:!We,children:[(0,v.jsx)($.Filter,{className:"size-4"}),"Clear All Filters"]}),Object.keys(M).length>0&&(0,v.jsxs)(ee,{onClick:()=>zo(M,T),disabled:!Ge,children:[(0,v.jsx)($.Calculator,{className:"size-4"}),"Clear Aggregations"]}),g&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ge,{}),(0,v.jsx)(me,{children:"Column Pinning"}),(0,v.jsxs)(ee,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Ve,children:[(0,v.jsx)($.PinOff,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),u&&(0,v.jsx)(y,{variant:"outline",size:"sm",onClick:u,disabled:d,className:"rounded-lg",children:(0,v.jsx)($.RefreshCw,{className:r("h-4 w-4",d&&"animate-spin")})})]})]})}var ao=require("lucide-react");var W=require("react/jsx-runtime");function Xr(e,t,o=1){let n=e+1,s=o*2+5;if(t<=s)return Array.from({length:t},(g,f)=>f+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,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<=u;g++)b.push(g);b.push("ellipsis",t)}return b}function Ao({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(0,W.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&&(0,W.jsxs)("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"]}),(0,W.jsxs)("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(0,W.jsxs)("div",{className:"flex items-center gap-2",children:[(0,W.jsx)("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),(0,W.jsxs)(at,{value:b,onValueChange:g=>e.setPageSize(g==="-1"?Math.max(i,1):Number(g)),children:[(0,W.jsx)(st,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:(0,W.jsx)(it,{})}),(0,W.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(g=>(0,W.jsx)(je,{value:`${g}`,children:g===-1?"All":g},g))})]})]})})(),o>1&&(0,W.jsxs)("div",{className:"flex items-center gap-1",children:[(0,W.jsx)(y,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:u,children:(0,W.jsx)(ao.ChevronLeft,{className:"size-4"})}),t.showPageNumbers&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),(0,W.jsx)("div",{className:"hidden items-center gap-1 sm:flex",children:Xr(n,o).map((d,a)=>d==="ellipsis"?(0,W.jsx)("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):(0,W.jsx)(y,{variant:d-1===n?"default":"outline",size:"sm",className:r(u,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),(0,W.jsx)(y,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:u,children:(0,W.jsx)(ao.ChevronRight,{className:"size-4"})})]})]})]})}var P=require("react");function Pt(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 Le=(e,t)=>t||e!==150?e:"auto";function jn(e,t){return{left:[...t,...(e.left??[]).filter(o=>!t.includes(o))],right:(e.right??[]).filter(o=>!t.includes(o))}}function $n(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 Un={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 Wn(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=>{Un[a]&&(d[a]=Un[a](u))}),Object.keys(d).length>0&&(o[s]=d)}),o}function qn(e,t){return typeof t=="number"?e==="count"||e==="unique"?t.toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):t}function Yr(e,t){return t.split(".").reduce((o,n)=>o&&o[n],e)}function Kn(e,t=new Set){for(let o of e){let n=o.id??o.accessorKey;n&&t.add(String(n)),o.columns&&Kn(o.columns,t)}return t}function io(e,t){let o=Kn(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=>Yr(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}var It=require("react/jsx-runtime");function Jn({initialColumns:e,filters:t,showSerialNumbers:o,enableRowSelection:n,selectionMode:s,showCheckbox:i,enableHeaderCheckbox:u,isRowSelectable:d}){let a=g=>g.map(f=>{if(f.id==="select"||f.id==="serialNumber")return f;let c={...f,enablePinning:!0};return f.columns&&(c.columns=a(f.columns)),c}),m=a([...e]),b={id:"select",header:({table:g})=>{if(s==="single")return null;let f=g.getRowModel().rows.filter(T=>d?.(T.original)??!0),c=f.length>0&&f.every(T=>T.getIsSelected()),M=f.some(T=>T.getIsSelected());return(0,It.jsx)(Nt,{checked:c||M&&"indeterminate",onCheckedChange:T=>{f.forEach(I=>I.toggleSelected(!!T))},disabled:!u||f.length===0,"aria-label":"Select all selectable rows"})},cell:({row:g})=>{let f=d?.(g.original)??!0;return(0,It.jsx)("div",{className:r("flex justify-center items-center",!f&&"opacity-50"),children:s==="multiple"?(0,It.jsx)(Nt,{checked:g.getIsSelected(),onCheckedChange:c=>f&&g.toggleSelected(!!c),"aria-label":"Select row",disabled:!f}):i?(0,It.jsx)("input",{type:"radio",checked:g.getIsSelected(),onChange:()=>f&&g.toggleSelected(!0),disabled:!f,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})=>(0,It.jsx)("div",{className:"font-medium text-muted-foreground text-center",children:g.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...io(e,t)]}var ct=require("react");var Xn="atsui:tbl:v1:",Lo=new Map,Yn=new Map;function so(e){try{let t=localStorage.getItem(Xn+e);return t?JSON.parse(t):void 0}catch{return}}function Zn(e,t){try{localStorage.setItem(Xn+e,JSON.stringify(t))}catch{}}function Qn(e){return e?typeof e=="string"?{key:e}:e:null}function Eo(e,t){return Lo.get(e)??(t?so(e):void 0)??{}}function Dt(e,t,o){let n={...Eo(e,t),...o};Lo.set(e,n),t&&Zn(e,n)}var Bo=new Map;function er(e,t){let o=Bo.get(e);return o||(o=new Set,Bo.set(e,o)),o.add(t),()=>{o.delete(t)}}function lo(e){return{...so("g:"+e)??{},...Yn.get(e)??{}}}function co(e,t,o,n){let s=lo(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,Yn.set(e,u),(t||so("g:"+e)!==void 0)&&Zn("g:"+e,u),Bo.get(e)?.forEach(d=>d())}function tr(e,t){if(Dt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)co(e.group,e.local,o,void 0)}function Go(e){return(Lo.get(e)??so(e))?.external??{}}var Io=new Set;function or(e){return Io.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.`),Io.add(e),()=>{Io.delete(e)}}var _o=e=>{if(e==null||e instanceof Date)return e;let t=new Date(e);return isNaN(t.getTime())?e:t},nr=e=>{if(e&&typeof e=="object"&&("from"in e||"to"in e)){let t=_o(e.from),o=_o(e.to);return t===e.from&&o===e.to?e:{from:t,to:o}}return _o(e)};function rr(e,t,o){let n=Qn(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=(0,ct.useRef)(s);i.current=s;let u=(0,ct.useMemo)(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let h=Eo(n.key,n.local),z=n.group?lo(n.group):{},x=L=>{let F=L.shared&&n.group?z[L.shared]:h.filters?.[L.id]??h.external?.[L.id];return L.isDate?nr(F):F},p=[],D={};for(let L of s){if(!L.persist)continue;let F=x(L);F==null||F===""||(L.external?D[L.id]=F:p.push({id:L.id,value:F}))}return{columnFilters:p,globalFilter:h.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?h.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?h.pagination?.pageSize??o:o},external:D,groupedField:h.groupedField??"all"}},[]),d=(0,ct.useRef)(u.pagination.pageIndex),a=(0,ct.useRef)(u.pagination.pageIndex===0);return(0,ct.useEffect)(()=>{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.`),or(n.key)},[]),{enabled:!!n,initial:u,persistFilters:h=>{if(!n)return;let z={};for(let p of h)z[p.id]=p.value;let x={};for(let p of i.current)!p.persist||p.external||(p.shared&&n.group?co(n.group,n.local,p.shared,z[p.id]):z[p.id]!==void 0&&(x[p.id]=z[p.id]));Dt(n.key,n.local,{filters:x})},persistGlobalFilter:h=>{n&&Dt(n.key,n.local,{globalFilter:h})},persistExternal:h=>{if(!n)return;let z={};for(let x of i.current)!x.persist||!x.external||(x.shared&&n.group?co(n.group,n.local,x.shared,h[x.id]):h[x.id]!==void 0&&(z[x.id]=h[x.id]));Dt(n.key,n.local,{external:z})},persistPagination:h=>{!n||n.pagination===!1||a.current&&Dt(n.key,n.local,{pagination:{pageIndex:h.pageIndex,pageSize:h.pageSize}})},persistGroupedField:h=>{n&&Dt(n.key,n.local,{groupedField:h})},restorePageIndex:(h,z)=>{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&&z({pageIndex:x,pageSize:h.getState().pagination.pageSize})},syncSharedSlots:h=>{if(!n?.group)return;let z=n.group,x=i.current.filter(p=>p.shared&&p.persist&&!p.external);if(x.length!==0)return er(z,()=>{let p=lo(z);for(let D of x){let L=h.getColumn(D.id);if(!L)continue;let F=p[D.shared],K=F===void 0?void 0:D.isDate?nr(F):F,H=L.getFilterValue();Object.is(H??void 0,K??void 0)||L.setFilterValue(K)}})},clearAll:()=>{n&&tr(n,i.current.filter(h=>h.shared).map(h=>h.shared))},pendingPageRestore:()=>!!n&&n.pagination!==!1&&!a.current}}var Oo=require("@tanstack/react-table"),te=require("lucide-react");var S=require("react/jsx-runtime");function ar({table:e,aggregations:t,enableColumnPinning:o,enableColumnResizing:n,enableColumnVisibility:s,enableRowSelection:i,fixedCheckboxColumn:u,bordered:d,compact:a,onPinColumn:m}){let b=e.getVisibleLeafColumns().filter(f=>!f.getIsPinned()),g=b[b.length-1]?.id;return(0,S.jsx)(S.Fragment,{children:e.getHeaderGroups().map(f=>(0,S.jsx)(Fe,{className:"hover:bg-transparent",children:f.headers.map((c,M)=>{let T=c.depth===0&&c.colSpan>1,I=o&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&i),O=o&&c.column.getIsPinned()==="right",h=c.column.getCanSort(),z=o&&c.column.columnDef.enablePinning!==!1,x=c.column.id==="serialNumber",p=c.column.id==="select",D=x||p&&u,L=c.column.columnDef.headerAlign||"left",F=t&&t[c.column.id]?.enabled,K=s&&!D&&c.column.getCanHide(),H=h||z&&!D||K,ue=c.column.getIsSorted(),Ne={left:"justify-start",center:"justify-center",right:"justify-end"}[L];return(0,S.jsxs)(Pn,{colSpan:c.colSpan,"data-col-id":T?void 0:c.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&M<f.headers.length-1&&c.column.id!==g&&"border-r","relative",I&&"sticky left-0 z-25 bg-sidebar/95",O&&"sticky right-0 z-25 bg-sidebar/95",(x||p)&&"sticky left-0 z-25 bg-sidebar/95",T?"text-center":"text-left"),style:{width:Le(c.getSize(),I||O),minWidth:Le(c.getSize(),I||O),...Pt(c.column,o)},children:[T?(0,S.jsxs)("div",{className:"flex justify-center items-center",children:[(0,Oo.flexRender)(c.column.columnDef.header,c.getContext()),F&&(0,S.jsx)(te.Calculator,{className:"ml-1 w-3 h-3 text-primary"})]}):(0,S.jsxs)("div",{className:r("relative flex items-center px-2 w-full",Ne,h&&"cursor-pointer select-none"),onClick:h?ne=>{ne.target.closest("button, a, input, select, [role=button], [role=checkbox]")||c.column.getToggleSortingHandler()?.(ne)}:void 0,children:[(0,S.jsxs)("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",ue&&"pr-6"),children:[F&&(0,S.jsx)(te.Calculator,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),c.isPlaceholder?null:(0,S.jsx)("span",{className:"truncate",children:(0,Oo.flexRender)(c.column.columnDef.header,c.getContext())})]}),(H||h)&&(0,S.jsxs)("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[(0,S.jsx)("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&&(0,S.jsx)("span",{className:"relative shrink-0",children:ue?ue==="asc"?(0,S.jsx)(te.ChevronUp,{className:"w-4 h-4"}):(0,S.jsx)(te.ChevronDown,{className:"w-4 h-4"}):(0,S.jsx)(te.ChevronsUpDown,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),H&&(0,S.jsxs)(Ae,{children:[(0,S.jsx)(Ie,{asChild:!0,children:(0,S.jsx)(y,{variant:"ghost",size:"icon",tabIndex:-1,"aria-label":"Column options",onClick:ne=>ne.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:(0,S.jsx)(te.MoreHorizontal,{className:"w-4 h-4"})})}),(0,S.jsxs)(Be,{align:"end",className:"w-48",onClick:ne=>ne.stopPropagation(),children:[h&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(me,{children:"Sorting"}),(0,S.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!1),disabled:ue==="asc",children:[(0,S.jsx)(te.ChevronUp,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),(0,S.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!0),disabled:ue==="desc",children:[(0,S.jsx)(te.ChevronDown,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),(0,S.jsxs)(ee,{onClick:()=>c.column.clearSorting(),disabled:!ue,children:[(0,S.jsx)(te.ChevronsUpDown,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(z&&!D||K)&&(0,S.jsx)(ge,{})]}),z&&!D&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(me,{children:"Pin Column"}),(0,S.jsxs)(ee,{onClick:()=>m(c.column.id,"right"),disabled:c.column.getIsPinned()==="right",children:[(0,S.jsx)(te.MoveRightIcon,{}),"Pin Right"]}),(0,S.jsxs)(ee,{onClick:()=>m(c.column.id,!1),disabled:!c.column.getIsPinned(),children:[(0,S.jsx)(te.PinOffIcon,{}),"Unpin"]}),K&&(0,S.jsx)(ge,{})]}),K&&(0,S.jsxs)(ee,{onClick:()=>c.column.toggleVisibility(!1),children:[(0,S.jsx)(te.EyeOff,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),(0,S.jsx)("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",F?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&c.column.getCanResize()&&!T&&c.colSpan===1&&(0,S.jsx)("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:ne=>ne.stopPropagation()})]},c.id)})},f.id))})}var be=require("react/jsx-runtime");function ir({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),b=e.getHeaderGroups()[0]?.headers.length??0,g=e.getVisibleLeafColumns().filter(c=>!c.getIsPinned()),f=g[g.length-1]?.id;return!d&&!a&&!m?null:(0,be.jsx)(to,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:(0,be.jsx)(Fe,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((c,M)=>{let T=c.column.id,I=t[T],O=n&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&s),h=n&&c.column.getIsPinned()==="right",z=c.column.id==="serialNumber",x=c.column.id==="select",D=c.column.columnDef.customFooter;return I||D||z&&m?(0,be.jsxs)(He,{className:r("relative px-2 py-2 font-semibold text-sm",M<b-1&&"border-r",u&&"py-1",O&&"sticky left-0 z-30 bg-sidebar",h&&"sticky right-0 z-30 bg-sidebar",(z||x)&&"sticky left-0 z-30 bg-sidebar",D?.className),style:{width:Le(c.getSize(),O||h),minWidth:Le(c.getSize(),O||h),...Pt(c.column,n)},children:[(0,be.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(D?.content){let F=typeof D.content=="function"?D.content(e):D.content;return(0,be.jsx)("div",{className:r("w-full h-full",D.align==="center"&&"text-center",D.align==="right"&&"text-right",D.align==="left"&&"text-left"),children:F})}return I?(0,be.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(I).map(([F,K])=>(0,be.jsxs)("div",{className:"flex justify-between items-center text-muted-foreground",children:[(0,be.jsx)("span",{className:"text-xs capitalize",children:F}),(0,be.jsx)("span",{className:"font-medium text-foreground",children:o?.[T]?.format?.(K,F)??qn(F,K)})]},F))}):z&&m?(0,be.jsxs)("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${c.id}`):(0,be.jsx)(He,{className:r("relative px-0 py-0",M<b-1&&c.column.id!==f&&"border-r",u&&"py-0",O&&"sticky left-0 z-30 bg-sidebar",h&&"sticky right-0 z-30 bg-sidebar",(z||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:Le(c.getSize(),O||h),minWidth:Le(c.getSize(),O||h),...Pt(c.column,n)},children:(0,be.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${c.id}`)})})})}var N=require("react/jsx-runtime");function Ho({data:e,columns:t,filters:o=[],pagination:n,settings:s={},header:i,footer:u,className:d="",maxHeight:a="100%",loading:m=!1,error:b,emptyMessage:g="No data available",onRowSelectionChange:f,onExport:c,onRefresh:M,onTableReady:T,children:I,isRowSelectable:O,getRowId:h,defaultSelectedRows:z,onExternalSearch:x,aggregations:p={},onAggregationChange:D,rowClassName:L,persist:F}){let K=!!n,H=rr(F,o,n?.pageSize||10),ue=(0,P.useRef)(H.initial.external),[Ne,ne]=(0,P.useState)([]),[Te,Ge]=(0,P.useState)(H.initial.columnFilters),[Qe,Se]=(0,P.useState)(H.initial.pagination),[gt,_e]=(0,P.useState)(()=>Object.fromEntries(io(t,o).map(C=>[C.id,!1]))),[ft,Pe]=(0,P.useState)({}),[De,ie]=(0,P.useState)(H.initial.globalFilter),[ve,et]=(0,P.useState)([]),[We,Oe]=(0,P.useState)(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Gt=(0,P.useRef)(null),Ve=(0,P.useRef)(null),qe=(0,P.useRef)(null),l=(0,P.useRef)(null),[j,le]=(0,P.useState)(0),[Z,bt]=(0,P.useState)(0),[ke,vo]=(0,P.useState)(0),tt=(0,P.useRef)(null),[_t,Yt]=(0,P.useState)(!1),{enableSorting:xt=!0,enableFiltering:Ot=!0,enableGlobalFilter:Vt=!0,enableColumnVisibility:Rt=!0,enableRowSelection:k=!0,showToolbar:E=!1,enableHeaderCheckbox:G=!0,toolbarPosition:oe="default",showSerialNumbers:re=!0,fixedCheckboxColumn:Re=!0,striped:ht=!0,hoverable:vt=!0,compact:Zt=!0,bordered:yo=!0,fullHeight:cn=!1,enableColumnResizing:un=!1,enableColumnPinning:Me=!0,showHeader:Sr=!0,selectionMode:Mt="multiple",showCheckbox:mn=!0,groupedFilterLabel:Pr="Global",showFilterChips:Dr=!0}=s;(0,P.useEffect)(()=>{o.length>0&&!E&&console.warn("[DataTable] `filters` are provided but settings.showToolbar is off \u2014 filters live in the toolbar, so none will render."),o.some(C=>C.placement==="menu")&&!Vt&&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).")},[]),(0,P.useEffect)(()=>{let C=()=>{tt.current&&Yt(tt.current.scrollTop>0)},J=tt.current;if(J)return J.addEventListener("scroll",C),()=>J.removeEventListener("scroll",C)},[]),(0,P.useEffect)(()=>{let C=()=>{Ve.current&&le(Ve.current.offsetHeight+16),qe.current&&bt(qe.current.offsetHeight+16),l.current&&vo(l.current.offsetHeight+16)};C();let J=new ResizeObserver(()=>{setTimeout(C,50)});return Ve.current&&J.observe(Ve.current),qe.current&&J.observe(qe.current),l.current&&J.observe(l.current),()=>{J.disconnect()}},[E,i,oe]),(0,P.useEffect)(()=>{H.persistFilters(Te)},[Te]),(0,P.useEffect)(()=>{H.persistGlobalFilter(De)},[De]),(0,P.useEffect)(()=>{H.persistPagination(Qe)},[Qe]);let kr=C=>{ue.current=C,H.persistExternal(C),x?.(C)},wo=(0,P.useMemo)(()=>Jn({initialColumns:t,filters:o,showSerialNumbers:re,enableRowSelection:k,selectionMode:Mt,showCheckbox:mn,enableHeaderCheckbox:G,isRowSelectable:O}),[t,o,re,k,O,Mt,mn,G]),V=(0,we.useReactTable)({data:e,columns:wo,getRowId:h,onSortingChange:xt?ne:void 0,onColumnFiltersChange:Ot?Ge:void 0,onGlobalFilterChange:Vt?ie:void 0,getCoreRowModel:(0,we.getCoreRowModel)(),getPaginationRowModel:K?(0,we.getPaginationRowModel)():void 0,getSortedRowModel:xt?(0,we.getSortedRowModel)():void 0,getFilteredRowModel:Ot?(0,we.getFilteredRowModel)():void 0,onColumnVisibilityChange:Rt?_e:void 0,onRowSelectionChange:k?Pe:void 0,onColumnOrderChange:et,onColumnPinningChange:Me?C=>Oe(J=>jn(typeof C=="function"?C(J):C,[...re?["serialNumber"]:[],...k?["select"]:[]])):void 0,state:{sorting:xt?Ne:void 0,columnFilters:Ot?Te:void 0,columnVisibility:Rt?gt:void 0,rowSelection:k?ft:{},globalFilter:De,pagination:K?Qe:void 0,columnOrder:ve,columnPinning:Me?We:{}},onPaginationChange:K?Se:void 0,initialState:{columnPinning:Me?{left:[...re?["serialNumber"]:[],...k?["select"]:[]],right:[]}:void 0},enableRowSelection:k?C=>O?.(C.original)??!0:!1,enableColumnResizing:un,enableColumnPinning:Me,columnResizeMode:"onChange",autoResetPageIndex:!H.pendingPageRestore()}),Co=(0,P.useMemo)(()=>Wn(V,p),[V,p,e,Te,De]),Rr=(0,P.useMemo)(()=>Object.keys(Co).length>0||wo.some(C=>C.customFooter),[Co,wo]),pn=(0,P.useRef)({onRowSelectionChange:f,isRowSelectable:O});pn.current={onRowSelectionChange:f,isRowSelectable:O};let gn=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(gn.current||!z||!k)return;let C=V.getCoreRowModel().rows;if(C.length===0)return;let J={};for(let yt of C)yt.getCanSelect()&&z(yt.original)&&(J[yt.id]=!0);gn.current=!0,Object.keys(J).length>0&&Pe(J)},[z,k,V,e]),(0,P.useEffect)(()=>{let{onRowSelectionChange:C,isRowSelectable:J}=pn.current;if(k&&C){let yt=V.getFilteredSelectedRowModel().rows.filter(jt=>J?.(jt.original)??!0).map(jt=>jt.original);C(yt)}},[ft,k,V]);let Mr=(0,P.useCallback)(C=>{Mt==="single"?(V.resetRowSelection(),C.toggleSelected(!0)):C.toggleSelected()},[Mt,V]),fn=(0,P.useRef)(T);fn.current=T,(0,P.useEffect)(()=>{fn.current?.(V)},[V]);let bn=(0,P.useRef)(!1);(0,P.useEffect)(()=>{bn.current||(bn.current=!0,Object.keys(H.initial.external).length>0&&x?.(H.initial.external))},[]),(0,P.useEffect)(()=>H.syncSharedSlots(V),[V]),(0,P.useEffect)(()=>{K&&H.restorePageIndex(V,Se)},[e]);let zr=(0,P.useCallback)(()=>{ne([])},[]),Fr=(0,P.useCallback)(()=>{Ge([]),ie(""),H.clearAll()},[]),Ar=(C,J)=>{Me&&$n(V,C,J,{container:tt.current,alwaysPinnedLeft:[...re?["serialNumber"]:[],...k&&Re?["select"]:[]]})},Ir=C=>C&&typeof C=="object"&&"content"in C,ze=(0,P.useMemo)(()=>i?Ir(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(0,N.jsx)(Je,{className:"shadow-sm rounded-xl w-full",children:(0,N.jsx)(Xe,{className:"flex justify-center items-center",children:(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),(0,N.jsx)("p",{className:"mb-4 text-muted-foreground text-sm",children:b}),M&&(0,N.jsxs)(y,{variant:"outline",size:"sm",onClick:M,className:"rounded-lg",children:[(0,N.jsx)(Vo.Loader2,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let No=()=>E?(0,N.jsx)(Fo,{table:V,filters:o,globalFilter:De,onGlobalFilterChange:C=>ie(C),enableGlobalFilter:Vt,onExport:c,onRefresh:M,loading:m,enableColumnVisibility:Rt,enableColumnPinning:Me,showFilterChips:Dr,onClearSorting:zr,onClearFilters:Fr,onExternalSearch:kr,initialExternalValues:ue.current,aggregations:p,onAggregationChange:D,groupedFilterLabel:Pr,initialGroupedField:H.initial.groupedField,onGroupedFieldChange:H.persistGroupedField}):null,Br=()=>{let C=0;return oe==="above-header"&&(C+=j),ze&&(C+=ke),oe==="below-header"&&(C+=Z),C},xn=V.getVisibleLeafColumns().filter(C=>!C.getIsPinned()),Lr=xn[xn.length-1]?.id,Ht=Math.max(V.getVisibleLeafColumns().length,1);return(0,N.jsx)(Ct,{children:(0,N.jsxs)("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[E&&oe==="default"&&(0,N.jsx)("div",{ref:Gt,className:"z-40 relative",children:No()}),(0,N.jsx)(Je,{className:r("shadow-sm overflow-hidden py-0",cn&&"flex-1 min-h-0"),children:(0,N.jsx)(Xe,{className:"h-full p-0",children:(0,N.jsxs)("div",{className:"relative flex flex-col justify-between h-full",children:[m&&(0,N.jsx)("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:(0,N.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[(0,N.jsx)(Vo.Loader2,{className:"size-5 text-primary animate-spin"}),(0,N.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),(0,N.jsx)("div",{ref:tt,className:r("relative overflow-auto rounded-t-xl",cn?"flex-1 min-h-0":V.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:(0,N.jsxs)(Po,{className:r("w-full border-separate border-spacing-0 relative",V.getState().columnSizingInfo.isResizingColumn&&"select-none",V.getRowModel().rows?.length===0&&"h-full"),children:[E&&oe==="above-header"&&(0,N.jsx)("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:(0,N.jsx)(Fe,{className:"hover:bg-transparent",children:(0,N.jsx)(He,{colSpan:Ht,className:"p-2 bg-sidebar border-b shadow-sm",children:(0,N.jsx)("div",{ref:Ve,children:No()})})})}),ze&&(ze.showOnEmpty||V.getRowModel().rows?.length>0)&&(0,N.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:oe==="above-header"?`${j}px`:"0px",zIndex:35},children:(0,N.jsx)(Fe,{className:"hover:bg-transparent",children:(0,N.jsx)(He,{colSpan:Ht,className:r("bg-sidebar p-2 font-semibold text-foreground",Zt?"py-2":"py-4",ze.className),children:(0,N.jsx)("div",{ref:l,className:r("flex items-center w-full",ze.align==="center"&&"justify-center",ze.align==="right"&&"justify-end",ze.align==="left"&&"justify-start"),children:typeof ze.content=="string"?(0,N.jsx)("span",{className:"font-bold text-foreground text-lg tracking-tight",children:ze.content}):ze.content})})})}),E&&oe==="below-header"&&(0,N.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:ze?`${ke}px`:"0px",zIndex:35},children:(0,N.jsx)(Fe,{className:"hover:bg-transparent",children:(0,N.jsx)(He,{colSpan:Ht,className:"bg-sidebar p-2",children:(0,N.jsx)("div",{ref:qe,children:No()})})})}),Sr&&(0,N.jsx)(Tn,{className:r("sticky bg-sidebar [&_tr]:border-b-0",_t&&"shadow-sm"),style:{top:`${Br()}px`,zIndex:30},children:(0,N.jsx)(ar,{table:V,aggregations:p,enableColumnPinning:Me,enableColumnResizing:un,enableColumnVisibility:Rt,enableRowSelection:k,fixedCheckboxColumn:Re,bordered:yo,compact:Zt,onPinColumn:Ar})}),(0,N.jsx)(Sn,{children:V.getRowModel().rows?.length?V.getRowModel().rows.map((C,J)=>{let yt=J===V.getRowModel().rows.length-1,jt=L?L(C):"";return(0,N.jsx)(Fe,{"data-index":J,"data-state":C.getIsSelected()&&"selected",className:r(vt&&"hover:bg-muted/50",ht&&J%2===0&&"bg-muted/20",C.getIsSelected()&&"bg-muted",Mt==="single"&&"cursor-pointer",jt),onClick:()=>{Mt==="single"&&Mr(C)},children:C.getVisibleCells().map((ye,Er)=>{let To=Me&&(ye.column.getIsPinned()==="left"||ye.column.id==="serialNumber"||ye.column.id==="select"&&k),So=Me&&ye.column.getIsPinned()==="right",Gr=ye.column.id==="serialNumber";return(0,N.jsx)(He,{className:r(Zt?"py-2":"py-4",yo&&Er<C.getVisibleCells().length-1&&ye.column.id!==Lr&&"border-r",(!yt||!Rr)&&"border-b",To&&"sticky left-0 z-20 bg-sidebar/95",Gr&&"sticky left-0 z-20 bg-card/95",So&&"sticky right-0 z-20 bg-sidebar/95","p-1"),style:{width:Le(ye.column.getSize(),To||So),minWidth:Le(ye.column.getSize(),To||So),...Pt(ye.column,Me)},children:(0,we.flexRender)(ye.column.columnDef.cell,ye.getContext())},ye.id)})},C.id)}):(0,N.jsx)(Fe,{children:(0,N.jsx)(He,{colSpan:Ht,className:"border-0 h-32 text-center",children:(0,N.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,N.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,N.jsx)("p",{className:"font-medium text-muted-foreground",children:g})]})})})}),(0,N.jsx)(ir,{table:V,columnAggregations:Co,aggregations:p,enableColumnPinning:Me,enableRowSelection:k,showSerialNumbers:re,bordered:yo,compact:Zt})]})}),u&&(0,N.jsx)("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:(0,N.jsx)(Po,{children:(0,N.jsx)(to,{children:(0,N.jsx)(Fe,{className:"bg-sidebar",children:(0,N.jsx)(He,{colSpan:Ht,className:"p-2",children:u})})})})})]})})}),(0,N.jsx)(Ao,{table:V,config:n}),I&&I(V)]})})}var sr=require("radix-ui");var lr=require("react/jsx-runtime");function uo({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return(0,lr.jsx)(sr.Separator.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})}var mo=require("lucide-react"),po=require("framer-motion"),ut=zt(require("react"),1),dr=zt(require("react-dom"),1),X=require("react/jsx-runtime");function jo({table:e,visible:t,container:o,children:n,className:s,...i}){let[u,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??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=t??e.getFilteredSelectedRowModel().rows.length>0;return dr.createPortal((0,X.jsx)(po.AnimatePresence,{children:m&&(0,X.jsx)(po.motion.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:(0,X.jsx)(Ct,{children:n})})}),a)}function $o({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...u}){let d=(0,X.jsx)(y,{variant:"secondary",size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...u,children:o?(0,X.jsx)(mo.Loader,{className:"animate-spin"}):i});return t?(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:d}),(0,X.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,X.jsx)("p",{children:t})})]}):d}function Uo({table:e}){let t=ut.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,X.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,X.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,X.jsx)(uo,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:(0,X.jsx)(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,X.jsx)(mo.X,{className:"size-3.5"})})}),(0,X.jsxs)(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:[(0,X.jsx)("p",{children:"Clear selection"}),(0,X.jsx)("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:(0,X.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var U=require("react"),qo=require("lucide-react");var Ce=require("lucide-react");var w=require("react/jsx-runtime");function Wo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:d,onSortChange:a,selectedCount:m,totalCount:b,visibleCount:g,onExport:f,onRefresh:c,loading:M,onClearFilters:T,onClearSorting:I}){let O=e.filter(x=>x.sortable),h=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",z=u!=="";return(0,w.jsx)("div",{className:"rounded-xl p-0.5",children:(0,w.jsx)("div",{className:"px-2",children:(0,w.jsx)("div",{className:"flex flex-col gap-6",children:(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,w.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,w.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,w.jsx)(Ce.Filter,{className:"h-4 w-4"})}),t.map(x=>(0,w.jsx)("div",{className:"relative min-w-[150px]",children:x.type==="select"?(0,w.jsxs)(at,{value:s[x.key]||"all",onValueChange:p=>i(x.key,p),children:[x.icon&&(0,w.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,w.jsx)(st,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:(0,w.jsx)(it,{placeholder:x.placeholder||"Select..."})}),(0,w.jsxs)(lt,{className:"rounded-lg",children:[(0,w.jsx)(je,{value:"all",children:"All"}),x.options?.map(p=>(0,w.jsx)(je,{value:p.value,children:p.label},p.value))]})]}):(0,w.jsxs)("div",{className:"relative",children:[x.icon&&(0,w.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,w.jsx)(Ft,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:p=>i(x.key,p.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsxs)("div",{className:"relative",children:[(0,w.jsx)(Ce.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,w.jsx)(Ft,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),O.length>0&&(0,w.jsxs)(Ae,{children:[(0,w.jsx)(Ie,{asChild:!0,children:(0,w.jsxs)(y,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,w.jsx)("span",{children:"Sort"}),(0,w.jsx)(Ce.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,w.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,w.jsx)(me,{children:"Sort By"}),(0,w.jsx)(ge,{}),O.map(x=>(0,w.jsxs)("div",{children:[(0,w.jsxs)(ee,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),(0,w.jsxs)(ee,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),z&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ge,{}),(0,w.jsx)(ee,{onClick:I,children:"Clear All Sorting"})]})]})]}),(0,w.jsxs)(Ae,{children:[(0,w.jsx)(Ie,{asChild:!0,children:(0,w.jsx)(y,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,w.jsx)(Ce.Settings2,{className:"h-4 w-4"})})}),(0,w.jsxs)(Be,{align:"end",className:"w-[200px] rounded-lg",children:[(0,w.jsx)(me,{children:"Table Settings"}),(0,w.jsx)(ge,{}),(0,w.jsx)(ee,{onClick:I,children:"Clear All Sorting"}),(0,w.jsx)(ee,{onClick:T,children:"Clear All Filters"})]})]}),f&&(0,w.jsxs)(y,{variant:"outline",size:"sm",onClick:f,className:"rounded-lg",children:[(0,w.jsx)(Ce.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),c&&(0,w.jsx)(y,{variant:"outline",size:"sm",onClick:c,disabled:M,className:"rounded-lg",children:(0,w.jsx)(Ce.RefreshCw,{className:r("h-4 w-4",M&&"animate-spin")})})]})]})})})})}var mt=require("lucide-react");var B=require("react/jsx-runtime");function cr({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),b=e>1,g=e<t,f=()=>{let M=[],T=[];for(let I=Math.max(2,e-2);I<=Math.min(t-1,e+2);I++)M.push(I);return e-2>2?T.push(1,"..."):T.push(1),T.push(...M),e+2<t-1?T.push("...",t):t>1&&T.push(t),T};return(0,B.jsx)("div",{className:"rounded-xl",children:(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,B.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&(0,B.jsxs)("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,B.jsxs)(at,{value:`${o}`,onValueChange:c=>i(Number(c)),children:[(0,B.jsx)(st,{className:"h-9 w-[70px] rounded-lg",children:(0,B.jsx)(it,{})}),(0,B.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(c=>(0,B.jsx)(je,{value:`${c}`,children:c},c))})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!b,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsLeft,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!b,className:"rounded-lg",children:[(0,B.jsx)(mt.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,B.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&(0,B.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:f().map((c,M)=>{if(c==="...")return(0,B.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${M}`);let T=c;return(0,B.jsx)(y,{variant:T===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(T),children:T},T)})}),(0,B.jsxs)("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]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!g,className:"rounded-lg",children:[(0,B.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,B.jsx)(mt.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,B.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!g,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsRight,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var _=require("react/jsx-runtime");function Ko({data:e,template:t,fields:o=[],filters:n=[],pagination:s,settings:i={},header:u,footer:d,className:a="",loading:m=!1,error:b,emptyMessage:g="No items found",emptyIcon:f,onSelectionChange:c,onExport:M,onRefresh:T,onTemplateReady:I,children:O}){let{enableSorting:h=!0,enableFiltering:z=!0,enableGlobalSearch:x=!0,enableSelection:p=!1,enableExport:D=!1,showToolbar:L=!0,selectionMode:F="multiple",gridCols:K={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:H=4,aspectRatio:ue="auto",minCardWidth:Ne=350,maxCardWidth:ne=350}=i,Te=!!s,[Ge,Qe]=(0,U.useState)(""),[Se,gt]=(0,U.useState)({}),[_e,ft]=(0,U.useState)(""),[Pe,De]=(0,U.useState)("asc"),[ie,ve]=(0,U.useState)(new Set),[et,We]=(0,U.useState)(1),[Oe,Gt]=(0,U.useState)(s?.pageSize||12),[Ve,qe]=(0,U.useState)(K.default),l=(0,U.useMemo)(()=>{let k=[...e];if(x&&Ge){let E=o.filter(G=>G.searchable!==!1);k=k.filter(G=>E.some(oe=>G[oe.key]?.toString().toLowerCase().includes(Ge.toLowerCase())))}if(z&&Object.keys(Se).forEach(E=>{let G=Se[E];if(G!=null&&G!==""){let oe=o.find(re=>re.key===E);oe&&(k=k.filter(re=>{let Re=re[E];return oe.type==="boolean"?Re===(G==="true"):oe.type==="number"?Re===Number(G):Re?.toString().toLowerCase().includes(String(G).toLowerCase())}))}}),h&&_e){let E=o.find(G=>G.key===_e);E&&k.sort((G,oe)=>{let re=G[_e],Re=oe[_e];if(E.type==="number")return Pe==="asc"?Number(re)-Number(Re):Number(Re)-Number(re);if(E.type==="date"){let ht=new Date(re),vt=new Date(Re);return Pe==="asc"?ht.getTime()-vt.getTime():vt.getTime()-ht.getTime()}else{let ht=String(re).toLowerCase(),vt=String(Re).toLowerCase();return Pe==="asc"?ht.localeCompare(vt):vt.localeCompare(ht)}})}return k},[e,Ge,Se,_e,Pe,o,x,z,h]),j=(0,U.useMemo)(()=>{if(!Te)return l;let k=(et-1)*Oe,E=k+Oe;return l.slice(k,E)},[l,et,Oe,Te]),le=Math.ceil(l.length/Oe),Z=(0,U.useCallback)(k=>{p&&ve(E=>{let G=new Set(E);return F==="single"?(G.clear(),G.add(k)):G.has(k)?G.delete(k):G.add(k),G})},[p,F]),bt=(0,U.useCallback)(()=>{!p||F==="single"||(ie.size===l.length?ve(new Set):ve(new Set(l.map((k,E)=>E))))},[p,F,ie.size,l.length]),ke=(0,U.useCallback)((k,E)=>{gt(G=>({...G,[k]:E})),We(1)},[]),vo=(0,U.useCallback)((k,E)=>{ft(k),De(E)},[]),tt=(0,U.useCallback)(()=>{Qe(""),gt({}),We(1)},[]),_t=(0,U.useCallback)(()=>{ft(""),De("asc")},[]),Yt=(0,U.useMemo)(()=>({getSelectedItems:()=>Array.from(ie).map(k=>l[k]),clearSelection:()=>ve(new Set),selectAll:bt,getFilteredData:()=>l,getTotalCount:()=>e.length,getVisibleCount:()=>l.length,refresh:()=>T?.(),exportData:()=>M?.(l)}),[ie,l,e.length,bt,T,M]),xt=(0,U.useRef)(null);xt.current=Yt,(0,U.useEffect)(()=>{I&&xt.current&&I(xt.current)},[]),(0,U.useEffect)(()=>{if(p&&c){let k=Array.from(ie).map(E=>l[E]);c(k)}},[ie]);let Ot=r("w-full","overflow-hidden",a),Vt=r("grid",`gap-${H}`,"w-full","mx-auto","items-start"),Rt={gridTemplateColumns:Ve===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Ne}px, calc(100%/${Ve} - ${H*4}px), ${ne}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return b?(0,_.jsx)(Je,{className:"w-full",children:(0,_.jsx)(Xe,{className:"flex items-center justify-center py-12",children:(0,_.jsxs)("div",{className:"text-center",children:[(0,_.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,_.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:b}),T&&(0,_.jsxs)(y,{variant:"outline",size:"sm",onClick:T,children:[(0,_.jsx)(qo.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,_.jsxs)("div",{className:r("w-full flex gap-2 flex-col h-full",Ot),children:[u&&(0,_.jsx)(Je,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,_.jsx)(Xe,{className:"p-2",children:u})}),L&&(0,_.jsx)(Wo,{fields:o,filters:n,globalFilter:Ge,onGlobalFilterChange:Qe,fieldFilters:Se,onFieldFilterChange:ke,sortField:_e,sortDirection:Pe,onSortChange:vo,selectedCount:ie.size,totalCount:e.length,visibleCount:l.length,onExport:D?()=>M?.(l):void 0,onRefresh:T,loading:m,onClearFilters:tt,onClearSorting:_t}),(0,_.jsx)(Je,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,_.jsx)(Xe,{className:"px-0",children:(0,_.jsxs)("div",{className:"relative",children:[m&&(0,_.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,_.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,_.jsx)(qo.Loader2,{className:"size-5 animate-spin text-primary"}),(0,_.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),j.length>0?(0,_.jsx)("div",{className:r(Vt),style:Rt,children:j.map((k,E)=>{let G=Te?(et-1)*Oe+E:E,oe=ie.has(G);return(0,_.jsxs)("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",ue==="square"?"aspect-square":"",ue==="video"?"aspect-video":"",p?"cursor-pointer":"",oe?"ring-2 ring-primary":""),onClick:()=>p&&Z(G),children:[p&&F==="multiple"&&(0,_.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,_.jsx)(Nt,{checked:oe,onCheckedChange:()=>Z(G),className:"bg-background/80 backdrop-blur-sm",onClick:re=>re.stopPropagation()})}),t(k,E,oe,()=>Z(G))]},G)})}):(0,_.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,_.jsx)("div",{className:"text-6xl",children:f||"\u{1F4CB}"}),(0,_.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:g}),(Ge||Object.values(Se).some(k=>k))&&(0,_.jsx)(y,{variant:"outline",onClick:tt,children:"Clear Filters"})]})]})})}),Te&&(0,_.jsx)("div",{className:"pb-1",children:(0,_.jsx)(cr,{currentPage:et,totalPages:le,pageSize:Oe,totalItems:l.length,onPageChange:We,onPageSizeChange:k=>{Gt(k),We(1)},config:s})}),d&&(0,_.jsx)("div",{className:"p-2 m-0.5",children:d}),O&&O(Yt)]})}var go=require("lucide-react"),fo=require("framer-motion"),pt=zt(require("react"),1),ur=zt(require("react-dom"),1),Y=require("react/jsx-runtime");function Jo({controller:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=pt.useState(!1);pt.useLayoutEffect(()=>{d(!0)},[]),pt.useEffect(()=>{function g(f){f.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=e.getSelectedItems(),b=t??m.length>0;return ur.createPortal((0,Y.jsx)(fo.AnimatePresence,{children:b&&(0,Y.jsx)(fo.motion.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:(0,Y.jsx)(Ct,{children:n})})}),a)}function Xo({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:u,onClick:d,...a}){let m=(0,Y.jsx)(y,{variant:t,size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:d,...a,children:n?(0,Y.jsx)(go.Loader,{className:"animate-spin"}):u});return o?(0,Y.jsxs)(ot,{children:[(0,Y.jsx)(nt,{asChild:!0,children:m}),(0,Y.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,Y.jsx)("p",{children:o})})]}):m}function Yo({controller:e}){let t=pt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return(0,Y.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,Y.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),(0,Y.jsx)(uo,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,Y.jsxs)(ot,{children:[(0,Y.jsx)(nt,{asChild:!0,children:(0,Y.jsx)(y,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,Y.jsx)(go.X,{className:"size-3.5"})})}),(0,Y.jsxs)(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:[(0,Y.jsx)("p",{children:"Clear selection"}),(0,Y.jsx)("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:(0,Y.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var pr=require("react/jsx-runtime"),mr=({children:e,className:t})=>(0,pr.jsx)("div",{className:r("flex flex-col h-full gap-2",t),children:e});var Zo=require("lucide-react");var gr=require("react-router"),se=require("react/jsx-runtime"),fr=({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?(0,se.jsx)(gr.NavLink,{to:n.href,children:(0,se.jsx)(y,{...m,children:(0,se.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})}):(0,se.jsx)(y,{...m,onClick:n.onClick,children:(0,se.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})},a=()=>!s||s.length===0?null:(0,se.jsx)("div",{className:"flex gap-4",children:s.map((m,b)=>m.value&&(0,se.jsxs)("div",{className:"text-sm",children:[(0,se.jsxs)("span",{className:"text-muted-foreground",children:[m.label," "]}),(0,se.jsx)("span",{children:m.value})]},b))});return(0,se.jsxs)("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[(0,se.jsxs)("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),(0,se.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,se.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&(0,se.jsx)("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&(0,se.jsx)("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",u),children:i})]})};var Xt=zt(require("react"),1),ce=require("react/jsx-runtime"),br="(min-width: 1024px)",Zr=()=>{let[e,t]=Xt.default.useState(()=>typeof window>"u"||window.matchMedia(br).matches);return Xt.default.useEffect(()=>{let o=window.matchMedia(br),n=()=>t(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[]),e},Qo=e=>null,en=e=>null,tn=e=>null,xr=({children:e,className:t,contentClassName:o})=>{let n=Zr(),s,i,u,d,a,m=Xt.default.Children.toArray(e).filter(f=>{if(Xt.default.isValidElement(f)){if(f.type===Qo){let c=f.props;return s=c.children,i=c.className,!1}if(f.type===en){let c=f.props;return u=c.children,d=c.className,!1}if(f.type===tn)return a=f.props,!1}return!0}),b=(0,ce.jsx)("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),g=f=>{let{side:c="right"}=f,M=(f.overlay??!0)||!n,T=r("w-1/3 max-w-full",f.className),I=r("h-full bg-background",c==="right"?"border-l":"border-r"),O=(0,ce.jsx)("div",{className:r("h-full p-2",o),children:m});return M?(0,ce.jsxs)("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[(0,ce.jsx)("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:O}),(0,ce.jsxs)("div",{tabIndex:-1,inert:!f.open,className:r("absolute inset-0 z-20",!f.open&&"pointer-events-none"),children:[(0,ce.jsx)("div",{className:r("absolute inset-0 bg-black/50 transition-opacity duration-500",f.open?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>f.onOpenChange(!1)}),(0,ce.jsx)("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",f.open?"translate-x-0 opacity-100":r(c==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),I,T),children:f.children})]})]}):(0,ce.jsxs)("div",{className:"flex relative flex-1 overflow-hidden",children:[c==="left"&&(0,ce.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,f.open?T:"w-0 border-0"),children:f.children}),(0,ce.jsx)("div",{className:r("h-full flex-1 min-w-0 overflow-auto transition-all duration-500",f.open&&"overflow-y-auto overflow-x-hidden"),children:O}),c==="right"&&(0,ce.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,f.open?T:"w-0 border-0"),children:f.children})]})};return(0,ce.jsxs)("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&(0,ce.jsx)("div",{className:r("border-b p-2",i),children:s}),a?g(a):b,u&&(0,ce.jsx)("div",{className:r("border-t p-2",d),children:u})]})};var vr=require("react/jsx-runtime"),hr=({className:e,children:t})=>t==null?null:(0,vr.jsx)("div",{className:r("flex items-center w-full gap-4 p-2 [&>*:last-child]:ml-auto",e),children:t});var on=require("react"),Bt=require("lucide-react");var he=require("react/jsx-runtime"),bo=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]=(0,on.useState)(!1),[a,m]=(0,on.useState)(!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(0,he.jsxs)(ot,{children:[(0,he.jsx)(nt,{asChild:!0,children:(0,he.jsx)(y,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:b,disabled:a||!t,children:a?(0,he.jsx)(Bt.Loader2Icon,{className:"animate-spin"}):u?(0,he.jsx)(Bt.Check,{className:"h-3 w-3"}):o||(0,he.jsx)(Bt.Copy,{className:"h-3 w-3"})})}),(0,he.jsx)(rt,{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),b=(u&&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 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:b="inactive"})=>{let g=typeof t=="boolean"?t?m:b:typeof t=="number"?t>0?m:b:t.toLowerCase(),f={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=f[g.toLowerCase()]||f.inactive,M=d||c[u],T={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},I=s?g.charAt(0).toUpperCase()+g.slice(1):g;return(0,he.jsx)("div",{className:"flex justify-center",children:(0,he.jsxs)("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",M.bg,M.text,M.border,T[i],o),children:[n&&(a?(0,he.jsx)("span",{className:"flex items-center",children:a}):(0,he.jsx)("span",{className:r("size-2 rounded-full",M.dot),"aria-hidden":"true"})),I]})})}};var yr=require("lucide-react"),Lt=require("react-router"),q=require("react/jsx-runtime"),nn=()=>{let e=(0,Lt.useRouteError)(),t=(0,Lt.useNavigate)();return(0,q.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,q.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,q.jsx)(yr.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,Lt.isRouteErrorResponse)(e)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,q.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,q.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,q.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,q.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,q.jsx)("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)})]}),(0,q.jsx)(y,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var $e=require("framer-motion");var A=require("react/jsx-runtime");function Qr({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return(0,A.jsxs)($e.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[(0,A.jsx)("title",{children:"Animated Checkmark"}),(0,A.jsx)($e.motion.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,A.jsx)($e.motion.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function rn(){return(0,A.jsx)(Je,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,A.jsxs)(Xe,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,A.jsx)($e.motion.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:(0,A.jsxs)("div",{className:"relative",children:[(0,A.jsx)($e.motion.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"}}),(0,A.jsx)(Qr,{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)]"})]})}),(0,A.jsxs)($e.motion.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:[(0,A.jsx)($e.motion.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"}),(0,A.jsx)("div",{className:"flex items-center gap-4",children:(0,A.jsx)($e.motion.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:(0,A.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("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:[(0,A.jsx)("title",{children:"From"}),(0,A.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("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:"$"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,A.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("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:[(0,A.jsx)("title",{children:"To"}),(0,A.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("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"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,A.jsx)($e.motion.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"})]})]})})}var kt=require("react/jsx-runtime"),an=()=>(0,kt.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,kt.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,kt.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,kt.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,kt.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var wr=require("react-router");var Cr=require("lucide-react"),xo=require("react-router"),Ee=require("react/jsx-runtime"),sn=()=>{let e=(0,wr.useLocation)(),t=(0,xo.useNavigate)(),o=()=>{window.history.length>2?t(-1):t("/")};return(0,Ee.jsxs)("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:[(0,Ee.jsx)(Cr.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Ee.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,Ee.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,Ee.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,Ee.jsxs)("div",{className:"flex space-x-4",children:[(0,Ee.jsx)(y,{variant:"outline",onClick:o,children:"Go Back"}),(0,Ee.jsx)(y,{variant:"ghost",children:(0,Ee.jsx)(xo.NavLink,{to:"/",children:"Return Home"})})]})]})};var Nr=require("lucide-react"),Et=require("react/jsx-runtime"),ln=()=>(0,Et.jsxs)("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:[(0,Et.jsx)(Nr.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Et.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,Et.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var Tr=require("lucide-react");var ho=require("react-router"),Ue=require("react/jsx-runtime"),dn=()=>{let e=(0,ho.useNavigate)();return(0,Ue.jsxs)("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:[(0,Ue.jsx)(Tr.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Ue.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,Ue.jsx)("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."}),(0,Ue.jsxs)("div",{className:"flex space-x-4",children:[(0,Ue.jsx)(y,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,Ue.jsx)(y,{variant:"ghost",children:(0,Ue.jsx)(ho.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppContainer,AppContent,AppContentFooter,AppContentHeader,AppFooter,AppHeader,AppSheet,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,getTableExportView,readPersistedExternal});
3
3
  //# sourceMappingURL=index.cjs.map