@tirth_jasoliya/ui 1.0.10 → 1.0.11
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/components/data/data-table/data-table-action-bar.cjs +1 -1
- package/dist/components/data/data-table/data-table-action-bar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-action-bar.js +1 -1
- package/dist/components/data/data-table/data-table-action-bar.js.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.cjs +1 -1
- package/dist/components/data/data-table/data-table-pagination.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.js +1 -1
- package/dist/components/data/data-table/data-table-pagination.js.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.d.cts +6 -2
- package/dist/components/data/data-table/data-table-toolbar.d.ts +6 -2
- package/dist/components/data/data-table/data-table-toolbar.js +1 -1
- package/dist/components/data/data-table/data-table-toolbar.js.map +1 -1
- package/dist/components/data/data-table/data-table-types.cjs +1 -1
- package/dist/components/data/data-table/data-table-types.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-types.d.cts +48 -2
- package/dist/components/data/data-table/data-table-types.d.ts +48 -2
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.d.cts +1 -1
- package/dist/components/data/data-table/data-table.d.ts +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/components/date-helper.cjs +3 -0
- package/dist/components/date-helper.cjs.map +1 -0
- package/dist/components/date-helper.d.cts +27 -0
- package/dist/components/date-helper.d.ts +27 -0
- package/dist/components/date-helper.js +3 -0
- package/dist/components/date-helper.js.map +1 -0
- package/dist/components/helper/date-filter.cjs +3 -0
- package/dist/components/helper/date-filter.cjs.map +1 -0
- package/dist/components/helper/date-filter.d.cts +14 -0
- package/dist/components/helper/date-filter.d.ts +14 -0
- package/dist/components/helper/date-filter.js +3 -0
- package/dist/components/helper/date-filter.js.map +1 -0
- package/dist/components/layouts/app-content.cjs +1 -1
- package/dist/components/layouts/app-content.cjs.map +1 -1
- package/dist/components/layouts/app-content.d.cts +2 -2
- package/dist/components/layouts/app-content.d.ts +2 -2
- package/dist/components/layouts/app-content.js +1 -1
- package/dist/components/layouts/app-content.js.map +1 -1
- package/dist/components/layouts/factories.cjs +1 -1
- package/dist/components/layouts/factories.cjs.map +1 -1
- package/dist/components/layouts/factories.js +1 -1
- package/dist/components/layouts/factories.js.map +1 -1
- package/dist/components/layouts/index.cjs +1 -1
- package/dist/components/layouts/index.cjs.map +1 -1
- package/dist/components/layouts/index.js +1 -1
- package/dist/components/layouts/index.js.map +1 -1
- package/dist/components/ui/calendar.cjs +3 -0
- package/dist/components/ui/calendar.cjs.map +1 -0
- package/dist/components/ui/calendar.d.cts +13 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.js +3 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/table.cjs +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +28 -16
- package/dist/styles.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as Vt,getCoreRowModel as Na,getFilteredRowModel as Pa,getPaginationRowModel as Ta,getSortedRowModel as Sa,useReactTable as Da}from"@tanstack/react-table";import{Loader2 as co,ChevronUp as _t,ChevronDown as Gt,ChevronsUpDown as ka,MoreHorizontal as Ra,MoveRightIcon as Ma,PinOffIcon as Aa}from"lucide-react";import{Slot as Zo}from"radix-ui";import{cva as Qo}from"class-variance-authority";import{clsx as Ko}from"clsx";import{twMerge as Yo}from"tailwind-merge";function a(...e){return Yo(Ko(e))}import{jsx as ta}from"react/jsx-runtime";var ea=Qo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function f({className:e,variant:t,size:o,asChild:n=!1,...l}){let r=n?Zo.Slot:"button";return ta(r,{"data-slot":"button",className:a(ea({variant:t,size:o,className:e}),"transition-none"),...l})}import{jsx as Re}from"react/jsx-runtime";function zt({className:e,...t}){return Re("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:Re("table",{"data-slot":"table",className:a("w-full caption-bottom text-sm",e),...t})})}function Qt({className:e,...t}){return Re("thead",{"data-slot":"table-header",className:a("[&_tr]:border-b",e),...t})}function eo({className:e,...t}){return Re("tbody",{"data-slot":"table-body",className:a("[&_tr:last-child]:border-0",e),...t})}function to({className:e,...t}){return Re("tfoot",{"data-slot":"table-footer",className:a("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function pt({className:e,...t}){return Re("tr",{"data-slot":"table-row",className:a("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function oo({className:e,...t}){return Re("th",{"data-slot":"table-head",className:a("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Tt({className:e,...t}){return Re("td",{"data-slot":"table-cell",className:a("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as ao}from"react/jsx-runtime";function pe({className:e,...t}){return ao("div",{"data-slot":"card",className:a("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function ue({className:e,...t}){return ao("div",{"data-slot":"card-content",className:a("px-6",e),...t})}import{Tooltip as Ze}from"radix-ui";import{jsx as Qe,jsxs as oa}from"react/jsx-runtime";function je({delayDuration:e=0,...t}){return Qe(Ze.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Me({...e}){return Qe(je,{children:Qe(Ze.Root,{"data-slot":"tooltip",...e})})}function Ae({...e}){return Qe(Ze.Trigger,{"data-slot":"tooltip-trigger",...e})}function ze({className:e,sideOffset:t=0,children:o,...n}){return Qe(Ze.Portal,{children:oa(Ze.Content,{"data-slot":"tooltip-content",sideOffset:t,className:a("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,Qe(Ze.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as ca,RefreshCw as ma,Download as pa,Settings2 as ua,Filter as ro,ArrowUpDown as ga,PinOff as fa,Pin as io,ChevronDown as ba}from"lucide-react";import{jsx as aa}from"react/jsx-runtime";function et({className:e,type:t,...o}){return aa("input",{type:t,"data-slot":"input",className:a("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}import{Select as re}from"radix-ui";import{CheckIcon as na,ChevronDownIcon as no,ChevronUpIcon as ra}from"lucide-react";import{jsx as U,jsxs as It}from"react/jsx-runtime";function Ie({...e}){return U(re.Root,{"data-slot":"select",...e})}function Be({...e}){return U(re.Value,{"data-slot":"select-value",...e})}function Fe({className:e,size:t="default",children:o,...n}){return It(re.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("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,U(re.Icon,{asChild:!0,children:U(no,{className:"size-4 opacity-50"})})]})}function Le({className:e,children:t,position:o="popper",...n}){return U(re.Portal,{children:It(re.Content,{"data-slot":"select-content",className:a("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:[U(ia,{}),U(re.Viewport,{className:a("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),U(sa,{})]})})}function ge({className:e,children:t,...o}){return It(re.Item,{"data-slot":"select-item",className:a("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:[U("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:U(re.ItemIndicator,{children:U(na,{className:"size-4"})})}),U(re.ItemText,{children:t})]})}function ia({className:e,...t}){return U(re.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:U(ra,{className:"size-4"})})}function sa({className:e,...t}){return U(re.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:U(no,{className:"size-4"})})}import{DropdownMenu as fe}from"radix-ui";import{CheckIcon as la,ChevronRightIcon as fr,CircleIcon as br}from"lucide-react";import{jsx as ie,jsxs as da}from"react/jsx-runtime";function be({...e}){return ie(fe.Root,{"data-slot":"dropdown-menu",...e})}function ve({...e}){return ie(fe.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function he({className:e,sideOffset:t=4,...o}){return ie(fe.Portal,{children:ie(fe.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:a("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 Bt({...e}){return ie(fe.Group,{"data-slot":"dropdown-menu-group",...e})}function H({className:e,inset:t,variant:o="default",...n}){return ie(fe.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:a("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 St({className:e,children:t,checked:o,...n}){return da(fe.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:a("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:[ie("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:ie(fe.ItemIndicator,{children:ie(la,{className:"size-4"})})}),t]})}function te({className:e,inset:t,...o}){return ie(fe.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function oe({className:e,...t}){return ie(fe.Separator,{"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t})}import{Fragment as va,jsx as x,jsxs as L}from"react/jsx-runtime";function Ft({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:l=!0,onExport:r,onRefresh:c,loading:h=!1,enableColumnVisibility:C=!0,data:u,onClearSorting:m,onClearFilters:N,enableColumnPinning:z=!1}){let R=()=>e.getAllLeafColumns().filter(d=>d.getCanHide?.()!==!1),k=()=>e.getAllColumns().filter(d=>!e.getAllLeafColumns().includes(d)&&d.columns?.length&&d.columns.some(g=>g.getCanHide?.()!==!1)),T=()=>{let d=new Set(k().flatMap(g=>g.columns?.filter(B=>B.getCanHide?.()!==!1).map(B=>B.id)||[]));return R().filter(g=>!d.has(g.id))},M=(d,g)=>g&&d.startsWith(`${g}.`)?d.replace(`${g}.`,"").split("_").map(b=>b.slice(1)).join(" "):d.split("_").map(B=>B.charAt(0).toUpperCase()+B.slice(1)).join(" ");return x("div",{className:"rounded-xl",children:x("div",{className:"px-2",children:x("div",{className:"flex flex-col gap-6",children:L("div",{className:"flex items-center justify-between",children:[x("div",{className:"flex items-center gap-3",children:t.length>0&&L("div",{className:"flex items-center gap-3 flex-wrap",children:[x("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:x(ro,{className:"h-4 w-4"})}),t.map(d=>x("div",{className:a("relative min-w-[150px]",d.width),children:d.type==="select"?L(Ie,{value:e.getColumn(d.key)?.getFilterValue()??"",onValueChange:g=>e.getColumn(d.key)?.setFilterValue(g==="all"?"":g),children:[d.icon&&x("span",{children:x(d.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),x(Fe,{className:a("h-9 rounded-lg w-full",d.icon&&"pl-9"),children:x(Be,{placeholder:d.placeholder})}),L(Le,{className:"rounded-lg",children:[x(ge,{value:"all",children:"All"}),d.options?.map(g=>x(ge,{value:g.value,children:g.label},g.label))]})]}):L("div",{className:"relative",children:[d.icon&&x("span",{children:x(d.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),x(et,{placeholder:d.placeholder,value:e.getColumn(d.key)?.getFilterValue()??"",onChange:g=>e.getColumn(d.key)?.setFilterValue(g.target.value),className:a("h-9 rounded-lg",d.icon&&"pl-9"),type:d.type==="number"?"number":d.type==="date"?"date":"text"})]})},d.key))]})}),L("div",{className:"flex items-center gap-2",children:[l&&L("div",{className:"relative",children:[x(ca,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),x(et,{placeholder:"Global search...",value:o??"",onChange:d=>n(d.target.value),className:"pl-9 max-w-max"})]}),r&&L(f,{variant:"outline",size:"sm",onClick:()=>r(u),className:"rounded-lg",children:[x(pa,{className:"mr-2 h-4 w-4"}),"Export"]}),C&&L(be,{children:[x(ve,{asChild:!0,children:L(f,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[x("span",{children:"Columns"}),x(ba,{className:"h-4 w-4 opacity-50"})]})}),L(he,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[x(te,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),x(oe,{}),T().length>0&&L(Bt,{children:[x(te,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),T().map(d=>x(St,{className:"text-sm",checked:d.getIsVisible(),onCheckedChange:g=>d.toggleVisibility(!!g),children:M(d.id)},d.id))]}),k().map(d=>L(Bt,{children:[x(oe,{}),x(te,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:d.id}),d.columns?.filter(g=>g.getCanHide?.()!==!1).map(g=>x(St,{className:"text-sm",checked:g.getIsVisible(),onCheckedChange:B=>g.toggleVisibility(!!B),children:M(g.id,d.id)},g.id))]},d.id))]})]}),L(be,{children:[x(ve,{asChild:!0,children:x(f,{variant:"outline",size:"sm",className:"rounded-lg",children:x(ua,{className:"h-4 w-4"})})}),L(he,{align:"end",className:"w-[200px] rounded-lg",children:[x(te,{children:"Table Settings"}),x(oe,{}),L(H,{onClick:m,children:[x(ga,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),L(H,{onClick:N,children:[x(ro,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),z&&L(va,{children:[x(oe,{}),x(te,{children:"Column Pinning"}),L(H,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[x(fa,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),L(H,{onClick:()=>{let d=R().filter(g=>g.getCanPin?.()!==!1).map(g=>g.id);e.setColumnPinning({left:d,right:[]})},children:[x(io,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),L(H,{onClick:()=>{let d=R().filter(g=>g.getCanPin?.()!==!1).map(g=>g.id);e.setColumnPinning({left:[],right:d})},children:[x(io,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),c&&x(f,{variant:"outline",size:"sm",onClick:c,disabled:h,className:"rounded-lg",children:x(ma,{className:a("h-4 w-4",h&&"animate-spin")})})]})]})})})})}import{jsx as Y,jsxs as tt}from"react/jsx-runtime";function Lt({table:e,config:t}){return t.enabled?Y("div",{className:"rounded-xl",children:Y("div",{children:tt("div",{className:"flex items-center justify-between",children:[Y("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&tt("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),tt("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&tt("div",{className:"flex items-center gap-2",children:[Y("span",{className:"text-sm font-medium",children:"Rows per page:"}),tt(Ie,{value:`${e.getState().pagination.pageSize}`,onValueChange:o=>e.setPageSize(Number(o)),children:[Y(Fe,{className:"h-9 w-[70px] rounded-lg",children:Y(Be,{})}),Y(Le,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(o=>Y(ge,{value:`${o}`,children:o},o))})]})]}),tt("div",{className:"flex items-center gap-2",children:[Y(f,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),Y(f,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&Y("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(o,n)=>{let l=e.getState().pagination.pageIndex,r=l-2+n+1;return r<1||r>e.getPageCount()?null:Y(f,{variant:r===l+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(r-1),children:r},r)})}),Y(f,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),Y(f,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as ha}from"radix-ui";import{cva as xa}from"class-variance-authority";import{jsx as ya}from"react/jsx-runtime";var Ca=xa("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function so({className:e,variant:t,size:o,noBg:n,...l}){return ya(ha.Root,{"data-slot":"toggle",className:a(Ca({className:e,variant:t,size:o,bg:n?"disabled":"enabled"})),...l})}import{Checkbox as lo}from"radix-ui";import{CheckIcon as wa}from"lucide-react";import{jsx as Ot}from"react/jsx-runtime";function ut({className:e,...t}){return Ot(lo.Root,{"data-slot":"checkbox",className:a("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:Ot(lo.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Ot(wa,{className:"size-3.5"})})})}import{useCallback as mo,useEffect as po,useMemo as za,useState as $e}from"react";import{Fragment as uo,jsx as p,jsxs as E}from"react/jsx-runtime";function go({data:e,columns:t,filters:o=[],pagination:n={enabled:!1},settings:l={},header:r,footer:c,className:h="",maxHeight:C="600px",loading:u=!1,error:m,emptyMessage:N="No data available",onRowSelectionChange:z,onExport:R,onRefresh:k,onTableReady:T,children:M}){let[d,g]=$e([]),[B,b]=$e([]),[A,Se]=$e({}),[De,de]=$e({}),[ce,xe]=$e(""),[K,Ge]=$e([]),[ne,He]=$e(l.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:qe=!0,enableFiltering:Ce=!0,enableGlobalFilter:dt=!0,enableColumnVisibility:me=!0,enableRowSelection:W=!0,stickyHeader:Ee=!0,toolbar:vt=!1,showSerialNumbers:$=!0,fixedCheckboxColumn:ye=!0,striped:Xe=!0,hoverable:Ke=!0,compact:we=!0,bordered:ht=!0,fullHeight:xt=!1,enableColumnResizing:Mt=!1,enableColumnPinning:S=!0,hideHeader:Ct=!1}=l,ct=za(()=>{let P=[...t],O=D=>D.map(s=>{if(s.id==="select"||s.id==="serialNumber")return s;let v={...s,enablePinning:!0};return s.columns&&(v.columns=O(s.columns)),v}),i=O(P);if(W){let D={id:"select",header:({table:s})=>p(ut,{checked:s.getIsAllPageRowsSelected()||s.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:v=>s.toggleAllPageRowsSelected(!!v),"aria-label":"Select all"}),cell:({row:s})=>p("div",{className:a("flex items-center justify-center"),children:p(ut,{checked:s.getIsSelected(),onCheckedChange:v=>s.toggleSelected(!!v),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};i.unshift(D)}if($){let D={id:"serialNumber",header:"No.",cell:({row:s})=>p("div",{className:"text-center font-medium text-muted-foreground",children:s.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};i.unshift(D)}return i},[t,$,W,ye]),F=Da({data:e,columns:ct,onSortingChange:qe?g:void 0,onColumnFiltersChange:Ce?b:void 0,onGlobalFilterChange:dt?xe:void 0,getCoreRowModel:Na(),getPaginationRowModel:n.enabled?Ta():void 0,getSortedRowModel:qe?Sa():void 0,getFilteredRowModel:Ce?Pa():void 0,onColumnVisibilityChange:me?Se:void 0,onRowSelectionChange:W?de:void 0,onColumnOrderChange:Ge,onColumnPinningChange:S?He:void 0,state:{sorting:qe?d:void 0,columnFilters:Ce?B:void 0,columnVisibility:me?A:void 0,rowSelection:W?De:{},globalFilter:ce,columnOrder:K,columnPinning:S?ne:{}},initialState:{pagination:n.enabled?{pageSize:n.pageSize||10}:void 0,columnPinning:S?{left:[...$?["serialNumber"]:[],...W?["select"]:[]],right:[]}:void 0},enableRowSelection:W,enableColumnResizing:Mt,enableColumnPinning:S,columnResizeMode:"onChange"});po(()=>{T&&T(F)},[F,T]),po(()=>{if(W&&z){let P=F.getFilteredSelectedRowModel().rows.map(O=>O.original);z(P)}},[De,W,z,F]);let yt=mo(()=>{g([])},[]),At=mo(()=>{b([]),xe("")},[]),wt=(P,O)=>{if(!S)return;let i=[...$?["serialNumber"]:[],...W&&ye?["select"]:[]],D={left:[...(ne.left??[]).filter(s=>i.includes(s))],right:[...ne.right??[]]};O===!1?(D.left=D.left.filter(s=>s!==P),D.right=D.right.filter(s=>s!==P)):O==="right"?(D.left=D.left.filter(s=>s!==P),D.right.includes(P)||D.right.push(P)):O==="left"&&(D.right=D.right.filter(s=>s!==P),!D.left.includes(P)&&!i.includes(P)&&D.left.push(P)),F.setColumnPinning(D)},Nt=()=>p(Qt,{className:a(Ee&&"sticky top-0 bg-sidebar z-20"),children:F.getHeaderGroups().map((P,O)=>p(pt,{className:"hover:bg-transparent",children:P.headers.map((i,D)=>{let s=i.depth===0&&i.colSpan>1,v=S&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&W),y=S&&i.column.getIsPinned()==="right",G=i.column.getCanSort(),J=S&&i.column.columnDef.enablePinning!==!1,ee=i.column.id==="serialNumber",Ne=i.column.id==="select",ke=ee||Ne&&ye,Ye=i.column.columnDef.headerAlign||"left",Xo={left:"justify-start",center:"justify-center",right:"justify-end"}[Ye];return E(oo,{colSpan:i.colSpan,className:a("font-semibold text-foreground bg-sidebar group px-0",!we&&"py-2",ht&&D<P.headers.length-1&&"border-r","relative",v&&"sticky left-0 z-15 bg-sidebar",y&&"sticky right-0 z-15 bg-sidebar",(ee||Ne)&&"sticky left-0 z-15 bg-sidebar",s?"text-center":"text-left"),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...v&&{left:ee?0:Ne?$&&F.getColumn("serialNumber")?.getSize()||0:Pt(i.column)},...y&&{right:mt(i.column)},...ee&&{left:0}},children:[s?p("div",{className:"flex items-center justify-center",children:Vt(i.column.columnDef.header,i.getContext())}):E("div",{className:a("relative flex items-center w-full px-2",Xo),children:[E("div",{className:"flex items-center gap-1",children:[G&&Ye==="right"&&p("span",{className:"ml-1 order-2",children:i.column.getIsSorted()&&{asc:p(_t,{className:"h-4 w-4"}),desc:p(Gt,{className:"h-4 w-4"})}[i.column.getIsSorted()]}),i.isPlaceholder?null:Vt(i.column.columnDef.header,i.getContext()),G&&Ye!=="right"&&i.column.getIsSorted()&&p("span",{className:"ml-1 order-2",children:i.column.getIsSorted()&&{asc:p(_t,{className:"h-4 w-4"}),desc:p(Gt,{className:"h-4 w-4"})}[i.column.getIsSorted()]})]}),(G||J&&!ke)&&E(be,{children:[p(ve,{asChild:!0,className:a("absolute",Ye==="left"&&"right-1",Ye==="center"&&"right-1",Ye==="right"&&"left-1"),children:p(so,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:p(Ra,{className:"h-4 w-4"})})}),E(he,{align:"end",className:"w-48",children:[G&&E(uo,{children:[p(te,{children:"Sorting"}),E(H,{onClick:()=>i.column.toggleSorting(!1),children:[p(_t,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),E(H,{onClick:()=>i.column.toggleSorting(!0),children:[p(Gt,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),E(H,{onClick:()=>i.column.clearSorting(),disabled:!i.column.getIsSorted(),children:[p(ka,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),p(oe,{})]}),J&&!ke&&E(uo,{children:[p(te,{children:"Pin Column"}),E(H,{onClick:()=>wt(i.column.id,"right"),disabled:i.column.getIsPinned()==="right",children:[p(Ma,{}),"Pin Right"]}),E(H,{onClick:()=>wt(i.column.id,!1),disabled:!i.column.getIsPinned(),children:[p(Aa,{}),"Unpin"]})]})]})]})]}),Mt&&i.column.getCanResize()&&!s&&i.colSpan===1&&p("div",{className:"absolute right-0 top-0 h-full w-1 bg-border hover:bg-primary cursor-col-resize opacity-0 hover:opacity-100 transition-opacity",onMouseDown:i.getResizeHandler()})]},i.id)})},P.id))}),Pt=P=>{if(!S)return;let O=0,i=F.getLeftHeaderGroups()[0]?.headers||[],D=[...$?["serialNumber"]:[],...W?["select"]:[]];for(let s of i){if(s.id===P.id)break;if(D.includes(s.id)){let v=F.getColumn(s.id);v&&(O+=v.getSize())}}return O},mt=P=>{if(!S)return;let O=F.getState().columnPinning.right||[],i=O.indexOf(P.id);if(i===-1)return;let D=0;for(let s=i+1;s<O.length;s++){let v=F.getColumn(O[s]);v&&(D+=v.getSize())}return D};return m?p(pe,{className:"w-full rounded-xl shadow-sm",children:p(ue,{className:"flex items-center justify-center",children:E("div",{className:"text-center",children:[p("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),p("p",{className:"text-sm text-muted-foreground mb-4",children:m}),k&&E(f,{variant:"outline",size:"sm",onClick:k,className:"rounded-lg",children:[p(co,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):p(je,{children:E("div",{className:a("w-full space-y-2 flex flex-col h-full",h),children:[r&&p(pe,{className:"rounded-2xl py-2 sticky top-0 z-20",children:p(ue,{className:"px-2",children:r})}),vt&&p(Ft,{table:F,filters:o,globalFilter:ce,onGlobalFilterChange:xe,enableGlobalFilter:dt,onExport:R,onRefresh:k,loading:u,enableColumnVisibility:me,enableColumnPinning:S,data:e,onClearSorting:yt,onClearFilters:At}),p(pe,{className:a("shadow-sm overflow-auto py-0",xt&&"flex-1"),children:p(ue,{className:"p-0 h-full",children:E("div",{className:"relative flex flex-col h-full justify-between",children:[u&&p("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:E("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[p(co,{className:"size-5 animate-spin text-primary"}),p("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),p("div",{className:"relative rounded-t-xl overflow-auto border-b",children:E(zt,{className:"border-collapse w-full",children:[!Ct&&Nt(),p(eo,{children:F.getRowModel().rows?.length?F.getRowModel().rows.map((P,O)=>p(pt,{"data-state":P.getIsSelected()&&"selected",className:a(Ke&&"hover:bg-muted/50",Xe&&O%2===0&&"bg-muted/20",P.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:P.getVisibleCells().map((i,D)=>{let s=S&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&W),v=S&&i.column.getIsPinned()==="right",y=i.column.id==="serialNumber",G=i.column.id==="select",J=y||G&&ye;return p(Tt,{className:a(we?"py-2":"py-4",ht&&D<P.getVisibleCells().length&&"border-r",s&&"sticky left-0 z-10 bg-sidebar/97",v&&"sticky right-0 z-10 bg-sidebar/97",y&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:i.column.getSize()!==150?i.column.getSize():"auto",minWidth:i.column.getSize()!==150?i.column.getSize():"auto",...s&&{left:y?0:G?$&&F.getColumn("serialNumber")?.getSize()||0:Pt(i.column)},...v&&{right:mt(i.column)},...y&&{left:0}},children:Vt(i.column.columnDef.cell,i.getContext())},i.id)})},P.id)):p(pt,{children:p(Tt,{colSpan:ct.length,className:"h-32 text-center border-0",children:E("div",{className:"flex flex-col items-center gap-3",children:[p("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),p("p",{className:"text-muted-foreground font-medium",children:N})]})})})})]})}),c&&p("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:p(zt,{children:p(to,{children:p(pt,{className:"bg-sidebar",children:p(Tt,{colSpan:ct.length,className:"p-2",children:c})})})})})]})})}),p(Lt,{table:F,config:n}),M&&M(F)]})})}import{Separator as Ia}from"radix-ui";import{jsx as Ba}from"react/jsx-runtime";function gt({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return Ba(Ia.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:a("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}import{Loader as Fa,X as La}from"lucide-react";import{AnimatePresence as Oa,motion as Va}from"framer-motion";import*as Oe from"react";import*as fo from"react-dom";import{jsx as Z,jsxs as ot}from"react/jsx-runtime";function bo({table:e,visible:t,container:o,children:n,className:l,...r}){let[c,h]=Oe.useState(!1);Oe.useLayoutEffect(()=>{h(!0)},[]),Oe.useEffect(()=>{function m(N){N.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e]);let C=o??(c?globalThis.document?.body:null);if(!C||!e)return null;let u=t??e.getFilteredSelectedRowModel().rows.length>0;return fo.createPortal(Z(Oa,{children:u&&Z(Va.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:a("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",l),...r,children:ot(je,{children:["1",n]})})}),C)}function vo({size:e="sm",tooltip:t,isPending:o,disabled:n,className:l,children:r,...c}){let h=Z(f,{variant:"secondary",size:e,className:a("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",l),disabled:n||o,...c,children:o?Z(Fa,{className:"animate-spin"}):r});return t?ot(Me,{children:[Z(Ae,{asChild:!0,children:h}),Z(ze,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:Z("p",{children:t})})]}):h}function ho({table:e}){let t=Oe.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?ot("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[ot("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),Z(gt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),ot(Me,{children:[Z(Ae,{asChild:!0,children:Z(f,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:Z(La,{className:"size-3.5"})})}),ot(ze,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[Z("p",{children:"Clear selection"}),Z("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:Z("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as bi,EyeOff as vi}from"lucide-react";import{jsx as wi,jsxs as Ni}from"react/jsx-runtime";import{ChevronDown as Si,Eye as Di}from"lucide-react";import{jsx as Ai,jsxs as zi}from"react/jsx-runtime";import{Slot as Fi}from"radix-ui";import{cva as _a}from"class-variance-authority";import{jsx as Gi}from"react/jsx-runtime";var Vi=_a("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});import{Command as as}from"cmdk";import{SearchIcon as rs}from"lucide-react";import{Dialog as ji}from"radix-ui";import{XIcon as Ui}from"lucide-react";import{jsx as qi,jsxs as Xi}from"react/jsx-runtime";import{jsx as ds,jsxs as cs}from"react/jsx-runtime";import{Popover as us}from"radix-ui";import{jsx as bs}from"react/jsx-runtime";import{CheckIcon as Ls,PlusCircleIcon as Os}from"lucide-react";import{Fragment as Hs,jsx as _s,jsxs as Gs}from"react/jsx-runtime";import{useState as Ve,useEffect as Co,useMemo as Et,useCallback as at,useRef as Ya}from"react";import{Loader2 as yo}from"lucide-react";import{Search as Ga,Download as Ha,RefreshCw as Ea,Filter as ja,ChevronDown as $a,Settings2 as Ua}from"lucide-react";import{Fragment as Wa,jsx as w,jsxs as j}from"react/jsx-runtime";function Ht({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:l,onFieldFilterChange:r,sortField:c,sortDirection:h,onSortChange:C,selectedCount:u,totalCount:m,visibleCount:N,onExport:z,onRefresh:R,loading:k,onClearFilters:T,onClearSorting:M}){let d=e.filter(b=>b.sortable),g=Object.values(l).some(b=>b!=null&&b!=="")||o!=="",B=c!=="";return w("div",{className:"rounded-xl p-0.5",children:w("div",{className:"px-2",children:w("div",{className:"flex flex-col gap-6",children:j("div",{className:"flex items-center justify-between",children:[w("div",{className:"flex items-center gap-3",children:t.length>0&&j("div",{className:"flex items-center gap-3 flex-wrap",children:[w("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:w(ja,{className:"h-4 w-4"})}),t.map(b=>w("div",{className:"relative min-w-[150px]",children:b.type==="select"?j(Ie,{value:l[b.key]||"all",onValueChange:A=>r(b.key,A),children:[b.icon&&w(b.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(Fe,{className:a("h-9 rounded-lg w-full",b.icon&&"pl-9"),children:w(Be,{placeholder:b.placeholder||"Select..."})}),j(Le,{className:"rounded-lg",children:[w(ge,{value:"all",children:"All"}),b.options?.map(A=>w(ge,{value:A.value,children:A.label},A.value))]})]}):j("div",{className:"relative",children:[b.icon&&w(b.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(et,{type:b.type,placeholder:b.placeholder,value:l[b.key]||"",onChange:A=>r(b.key,A.target.value),className:a("h-9 rounded-lg",b.icon&&"pl-9")})]})},String(b.key)))]})}),j("div",{className:"flex items-center gap-2",children:[j("div",{className:"relative",children:[w(Ga,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),w(et,{placeholder:"Global search...",value:o,onChange:b=>n(b.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),d.length>0&&j(be,{children:[w(ve,{asChild:!0,children:j(f,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[w("span",{children:"Sort"}),w($a,{className:"h-4 w-4 opacity-50"})]})}),j(he,{align:"end",className:"w-[200px] rounded-lg",children:[w(te,{children:"Sort By"}),w(oe,{}),d.map(b=>j("div",{children:[j(H,{onClick:()=>C(b.key,"asc"),children:[b.label," (A-Z)"]}),j(H,{onClick:()=>C(b.key,"desc"),children:[b.label," (Z-A)"]})]},String(b.key))),B&&j(Wa,{children:[w(oe,{}),w(H,{onClick:M,children:"Clear All Sorting"})]})]})]}),j(be,{children:[w(ve,{asChild:!0,children:w(f,{variant:"outline",size:"sm",className:"rounded-lg",children:w(Ua,{className:"h-4 w-4"})})}),j(he,{align:"end",className:"w-[200px] rounded-lg",children:[w(te,{children:"Table Settings"}),w(oe,{}),w(H,{onClick:M,children:"Clear All Sorting"}),w(H,{onClick:T,children:"Clear All Filters"})]})]}),z&&j(f,{variant:"outline",size:"sm",onClick:z,className:"rounded-lg",children:[w(Ha,{className:"mr-2 h-4 w-4"}),"Export"]}),R&&w(f,{variant:"outline",size:"sm",onClick:R,disabled:k,className:"rounded-lg",children:w(Ea,{className:a("h-4 w-4",k&&"animate-spin")})})]})]})})})})}import{ChevronLeft as Ja,ChevronRight as qa,ChevronsLeft as Xa,ChevronsRight as Ka}from"lucide-react";import{jsx as V,jsxs as se}from"react/jsx-runtime";function xo({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:l,onPageSizeChange:r,config:c}){if(!c.enabled)return null;let h=c.pageSizeOptions||[10,20,50,100],C=(e-1)*o+1,u=Math.min(e*o,n),m=e>1,N=e<t,z=()=>{let k=[],T=[];for(let M=Math.max(2,e-2);M<=Math.min(t-1,e+2);M++)k.push(M);return e-2>2?T.push(1,"..."):T.push(1),T.push(...k),e+2<t-1?T.push("...",t):t>1&&T.push(t),T};return V("div",{className:"rounded-xl",children:se("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[V("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:c.showInfo!==!1&&se("span",{children:["Showing ",C," to ",u," of ",n," entries"]})}),se("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[h&&se("div",{className:"flex items-center gap-2",children:[V("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),se(Ie,{value:`${o}`,onValueChange:R=>r(Number(R)),children:[V(Fe,{className:"h-9 w-[70px] rounded-lg",children:V(Be,{})}),V(Le,{side:"top",className:"rounded-lg",children:h.map(R=>V(ge,{value:`${R}`,children:R},R))})]})]}),se("div",{className:"flex items-center gap-2",children:[se(f,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:!m,className:"hidden sm:flex rounded-lg",children:[V(Xa,{className:"h-4 w-4"}),V("span",{className:"sr-only",children:"Go to first page"})]}),se(f,{variant:"outline",size:"sm",onClick:()=>l(e-1),disabled:!m,className:"rounded-lg",children:[V(Ja,{className:"h-4 w-4 sm:mr-2"}),V("span",{className:"hidden sm:inline",children:"Previous"}),V("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),c.showPageNumbers&&t>1&&V("div",{className:"hidden sm:flex items-center gap-1",children:z().map((R,k)=>{if(R==="...")return V("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${k}`);let T=R;return V(f,{variant:T===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>l(T),children:T},T)})}),se("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]}),se(f,{variant:"outline",size:"sm",onClick:()=>l(e+1),disabled:!N,className:"rounded-lg",children:[V("span",{className:"hidden sm:inline",children:"Next"}),V(qa,{className:"h-4 w-4 sm:ml-2"}),V("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),se(f,{variant:"outline",size:"sm",onClick:()=>l(t),disabled:!N,className:"hidden sm:flex rounded-lg",children:[V(Ka,{className:"h-4 w-4"}),V("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as I,jsxs as Ue}from"react/jsx-runtime";function wo({data:e,template:t,fields:o=[],filters:n=[],pagination:l={enabled:!1},settings:r={},header:c,footer:h,className:C="",loading:u=!1,error:m,emptyMessage:N="No items found",emptyIcon:z,onSelectionChange:R,onExport:k,onRefresh:T,onTemplateReady:M,children:d}){let{enableSorting:g=!0,enableFiltering:B=!0,enableGlobalSearch:b=!0,enableSelection:A=!1,enableExport:Se=!1,toolbar:De=!0,selectionMode:de="multiple",gridCols:ce={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:xe=4,aspectRatio:K="auto",minCardWidth:Ge=350,maxCardWidth:ne=350}=r,[He,qe]=Ve(""),[Ce,dt]=Ve({}),[me,W]=Ve(""),[Ee,vt]=Ve("asc"),[$,ye]=Ve(new Set),[Xe,Ke]=Ve(1),[we,ht]=Ve(l.pageSize||12),[xt,Mt]=Ve(ce.default),S=Et(()=>{let s=[...e];if(b&&He){let v=o.filter(y=>y.searchable!==!1);s=s.filter(y=>v.some(G=>y[G.key]?.toString().toLowerCase().includes(He.toLowerCase())))}if(B&&Object.keys(Ce).forEach(v=>{let y=Ce[v];if(y!=null&&y!==""){let G=o.find(J=>J.key===v);G&&(s=s.filter(J=>{let ee=J[v];return G.type==="boolean"?ee===(y==="true"):G.type==="number"?ee===Number(y):ee?.toString().toLowerCase().includes(String(y).toLowerCase())}))}}),g&&me){let v=o.find(y=>y.key===me);v&&s.sort((y,G)=>{let J=y[me],ee=G[me];if(v.type==="number")return Ee==="asc"?Number(J)-Number(ee):Number(ee)-Number(J);if(v.type==="date"){let Ne=new Date(J),ke=new Date(ee);return Ee==="asc"?Ne.getTime()-ke.getTime():ke.getTime()-Ne.getTime()}else{let Ne=String(J).toLowerCase(),ke=String(ee).toLowerCase();return Ee==="asc"?Ne.localeCompare(ke):ke.localeCompare(Ne)}})}return s},[e,He,Ce,me,Ee,o,b,B,g]),Ct=Et(()=>{if(!l.enabled)return S;let s=(Xe-1)*we,v=s+we;return S.slice(s,v)},[S,Xe,we,l.enabled]),ct=Math.ceil(S.length/we),F=at(s=>{A&&ye(v=>{let y=new Set(v);return de==="single"?(y.clear(),y.add(s)):y.has(s)?y.delete(s):y.add(s),y})},[A,de]),yt=at(()=>{!A||de==="single"||($.size===S.length?ye(new Set):ye(new Set(S.map((s,v)=>v))))},[A,de,$.size,S.length]),At=at((s,v)=>{dt(y=>({...y,[s]:v})),Ke(1)},[]),wt=at((s,v)=>{W(s),vt(v)},[]),Nt=at(()=>{qe(""),dt({}),Ke(1)},[]),Pt=at(()=>{W(""),vt("asc")},[]),mt=Et(()=>({getSelectedItems:()=>Array.from($).map(s=>S[s]),clearSelection:()=>ye(new Set),selectAll:yt,getFilteredData:()=>S,getTotalCount:()=>e.length,getVisibleCount:()=>S.length,refresh:()=>T?.(),exportData:()=>k?.(S)}),[$,S,e.length,yt,T,k]),P=Ya(null);P.current=mt,Co(()=>{M&&P.current&&M(P.current)},[]),Co(()=>{if(A&&R){let s=Array.from($).map(v=>S[v]);R(s)}},[$]);let O=a("w-full","overflow-hidden",C),i=a("grid",`gap-${xe}`,"w-full","mx-auto","items-start"),D={gridTemplateColumns:xt===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Ge}px, calc(100%/${xt} - ${xe*4}px), ${ne}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return m?I(pe,{className:"w-full",children:I(ue,{className:"flex items-center justify-center py-12",children:Ue("div",{className:"text-center",children:[I("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),I("p",{className:"text-sm text-muted-foreground mb-4",children:m}),T&&Ue(f,{variant:"outline",size:"sm",onClick:T,children:[I(yo,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):Ue("div",{className:a("w-full flex gap-2 flex-col h-full",O),children:[c&&I(pe,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:I(ue,{className:"p-2",children:c})}),De&&I(Ht,{fields:o,filters:n,globalFilter:He,onGlobalFilterChange:qe,fieldFilters:Ce,onFieldFilterChange:At,sortField:me,sortDirection:Ee,onSortChange:wt,selectedCount:$.size,totalCount:e.length,visibleCount:S.length,onExport:Se?()=>k?.(S):void 0,onRefresh:T,loading:u,onClearFilters:Nt,onClearSorting:Pt}),I(pe,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:I(ue,{className:"px-0",children:Ue("div",{className:"relative",children:[u&&I("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:Ue("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[I(yo,{className:"size-5 animate-spin text-primary"}),I("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),Ct.length>0?I("div",{className:a(i),style:D,children:Ct.map((s,v)=>{let y=l.enabled?(Xe-1)*we+v:v,G=$.has(y);return Ue("div",{className:a("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",K==="square"?"aspect-square":"",K==="video"?"aspect-video":"",A?"cursor-pointer":"",G?"ring-2 ring-primary":""),onClick:()=>A&&F(y),children:[A&&de==="multiple"&&I("div",{className:"absolute top-2 right-2 z-10",children:I(ut,{checked:G,onCheckedChange:()=>F(y),className:"bg-background/80 backdrop-blur-sm",onClick:J=>J.stopPropagation()})}),t(s,v,G,()=>F(y))]},y)})}):Ue("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[I("div",{className:"text-6xl",children:z||"\u{1F4CB}"}),I("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:N}),(He||Object.values(Ce).some(s=>s))&&I(f,{variant:"outline",onClick:Nt,children:"Clear Filters"})]})]})})}),l.enabled&&I("div",{className:"pb-1",children:I(xo,{currentPage:Xe,totalPages:ct,pageSize:we,totalItems:S.length,onPageChange:Ke,onPageSizeChange:s=>{ht(s),Ke(1)},config:l})}),h&&I("div",{className:"p-2 m-0.5",children:h}),d&&d(mt)]})}import{Loader as Za,X as Qa}from"lucide-react";import{AnimatePresence as en,motion as tn}from"framer-motion";import*as _e from"react";import*as No from"react-dom";import{jsx as q,jsxs as ft}from"react/jsx-runtime";function Po({controller:e,visible:t,container:o,children:n,className:l,...r}){let[c,h]=_e.useState(!1);_e.useLayoutEffect(()=>{h(!0)},[]),_e.useEffect(()=>{function N(z){z.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[e]);let C=o??(c?globalThis.document?.body:null);if(!C||!e)return null;let u=e.getSelectedItems(),m=t??u.length>0;return No.createPortal(q(en,{children:m&&q(tn.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:a("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",l),...r,children:q(je,{children:n})})}),C)}function To({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:l,className:r,children:c,onClick:h,...C}){let u=q(f,{variant:t,size:e,className:a("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",r),disabled:l||n,onClick:h,...C,children:n?q(Za,{className:"animate-spin"}):c});return o?ft(Me,{children:[q(Ae,{asChild:!0,children:u}),q(ze,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:q("p",{children:o})})]}):u}function So({controller:e}){let t=_e.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return ft("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[ft("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),q(gt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),ft(Me,{children:[q(Ae,{asChild:!0,children:q(f,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:q(Qa,{className:"size-3.5"})})}),ft(ze,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[q("p",{children:"Clear selection"}),q("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:q("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as nn}from"react/jsx-runtime";var on={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},an={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Do=({children:e,className:t,spacing:o="tight",padding:n="none"})=>nn("div",{className:a("flex flex-col h-full",on[o],an[n],t),children:e});import{ArrowLeftIcon as ko,ChevronRight as rn}from"lucide-react";import{NavLink as sn}from"react-router";import{jsx as Q,jsxs as We}from"react/jsx-runtime";var Ro=({className:e,columns:t=[],showBackButton:o=!0,meta:n={title:""}})=>{let l=()=>{if(!n.backAction||!o)return null;let m={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.backAction.href?Q(sn,{to:n.backAction.href,children:We(f,{...m,children:[Q(ko,{className:"size-6"}),n.backAction.content]})}):We(f,{...m,onClick:n.backAction.onClick,children:[Q(ko,{className:"size-6"}),n.backAction.content]})},r=()=>!n.metadata||n.metadata.length===0?null:Q("div",{className:"flex gap-4",children:n.metadata.map((m,N)=>m.value&&We("div",{className:"text-sm",children:[We("span",{className:"text-muted-foreground",children:[m.label," "]}),Q("span",{children:m.value})]},N))}),c=()=>n.status?Q("span",{className:a("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[n.status.color]),children:n.status.content}):null,h={content:We("div",{className:"flex gap-2 items-center",children:[l(),We("div",{className:"flex flex-col gap-2 w-max",children:[Q("h1",{className:"text-2xl font-bold tracking-tight",children:n.title}),c(),n.description&&Q("p",{className:"text-muted-foreground",children:n.description}),r(),n.breadcrumbs&&n.breadcrumbs.length>0&&Q("div",{className:"flex items-center text-sm text-muted-foreground",children:n.breadcrumbs.map((m,N)=>We("div",{className:"flex items-center",children:[m.href?Q("span",{className:"hover:text-primary hover:underline",children:m.label}):Q("span",{children:m.label}),N<n.breadcrumbs.length-1&&Q(rn,{className:"mx-2 h-4 w-4"})]},N))})]})]}),align:"left",width:"fill"},C={content:n.primaryActions,align:"right",width:"auto"},u=[h,...t.filter(m=>m!==void 0),C];return Q("div",{className:a("flex items-center w-full gap-4 p-2",e),children:u.map((m,N)=>Q("div",{className:a("flex items-center h-full",m.className,{"justify-start":m.align==="left","justify-center":m.align==="center","justify-end":m.align==="right","flex-1":m.width==="fill"}),children:m.content},N))})};import dn,{useState as cn,createContext as mn,useContext as pn}from"react";import{Dialog as nt}from"radix-ui";import{XIcon as ln}from"lucide-react";import{jsx as Je,jsxs as jt}from"react/jsx-runtime";function Mo({...e}){return Je(nt.Root,{"data-slot":"sheet",...e})}function Ao({...e}){return Je(nt.Trigger,{"data-slot":"sheet-trigger",...e})}function $t({...e}){return Je(nt.Portal,{"data-slot":"sheet-portal",...e})}function Ut({className:e,...t}){return Je(nt.Overlay,{"data-slot":"sheet-overlay",className:a("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function zo({className:e,children:t,side:o="right",...n}){return jt($t,{children:[Je(Ut,{}),jt(nt.Content,{"data-slot":"sheet-content",className:a("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",o==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",o==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",o==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",o==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,jt(nt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[Je(ln,{className:"size-4"}),Je("span",{className:"sr-only",children:"Close"})]})]})]})}import{jsx as X,jsxs as rt}from"react/jsx-runtime";var Io=mn(!1),Wt={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},bt={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},un=(e,t)=>{let[o,n]=Wt[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:a("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?o:n,sheetPushClass:e==="right"?n:o}},gn="flex flex-col overflow-hidden rounded-2xl relative",fn={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},Bo=e=>{let{children:t,className:o,variant:n="default",layout:l="full",header:r,footer:c,headerClassName:h,footerClassName:C,parentContainer:u=!1,padding:m=u?"none":"tight"}=e,N=pn(Io),[z,R]=cn(!1),k=dn.useCallback(M=>X("div",{className:a("flex-1 overflow-auto h-full no-scrollbar",u&&"flex",!u&&bt[m]),children:M}),[m,u]),T=()=>{switch(l){case"split":{let{splitRatio:M="three-fourth",reverse:d=!1}=e;if(!Array.isArray(t)||t.length!==2)return X("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[g,B]=Wt[M],[b,A]=d?[t[1],t[0]]:[t[0],t[1]],[Se,De]=d?[B,g]:[g,B];return rt("div",{className:"flex h-full gap-2",children:[X("div",{className:a(Se,"overflow-auto"),children:k(b)}),X("div",{className:a(De,"overflow-auto"),children:k(A)})]})}case"with-sheet":{let{sheetContent:M,sheetWidth:d="four-fifth",sheetSide:g="right",sheetMode:B="container",sheetTrigger:b,sheetClassName:A,isSheetOpen:Se,onSheetOpenChange:De,showSheetOverlay:de=!0,disableOverlay:ce=!0}=e,xe=Se!==void 0,K=xe?Se:z,Ge=xe?De:R;if(B==="container"){let ne=un(g,d);return rt("div",{className:a("flex relative flex-1 overflow-hidden",K&&ce&&["left","right"].includes(g)),children:[rt("div",{className:a("h-full overflow-auto transition-all duration-500",K&&ce&&["left","right"].includes(g)?ne.contentPushClass:"w-full",K&&ce&&"overflow-y-auto overflow-x-hidden"),children:[b&&X("div",{onClick:()=>Ge?.(!K),children:b}),X("div",{className:a("h-full",!u&&bt[m]),children:t})]}),X("div",{className:a(ne.container,"transition-all duration-500 ease-in-out",K&&ce&&["left","right"].includes(g)?a(ne.sheetPushClass,"overflow-y-auto"):K?ne.transformOpen:a(ne.transform,"hidden"),"overflow-y-auto"),children:X("div",{className:a(ne.content,A,"h-full"),children:M})}),K&&de&&!ce&&X("div",{className:a("absolute inset-0 bg-secondary/20 z-40","transition-opacity duration-500 ease-in-out","opacity-0",K?"opacity-100":"opacity-0"),onClick:()=>Ge?.(!1)})]})}return rt(Mo,{open:K,onOpenChange:Ge,children:[b&&X(Ao,{asChild:!0,children:b}),rt($t,{children:[de&&X(Ut,{className:"fixed inset-0 bg-secondary/50 z-50"}),X(zo,{side:g,className:a("fixed bg-background border","transition-all duration-500 ease-in-out",Wt[d][1],A),children:M})]})]})}default:return k(t)}};return X(Io.Provider,{value:!0,children:rt("div",{className:a(gn,fn[n],bt[m],N&&"flex-1",u&&"h-full",!u&&"rounded-2xl",o),children:[r&&X("div",{className:a("border-b",h,n==="card"&&!u&&"rounded-t-2xl",n==="border"&&"border-b-2",bt[m]),children:r}),T(),c&&X("div",{className:a("border-t",C,n==="card"&&!u&&"rounded-b-2xl",n==="border"&&"border-t-2",bt[m]),children:c})]})})};import{jsx as Jt}from"react/jsx-runtime";var Fo=({className:e,columns:t=[],meta:o={title:""}})=>{let n={content:Jt("div",{className:"flex items-center gap-4 p-2",children:o.secondaryActions}),align:"right",width:"fill"},l=[...t.filter(r=>r!==void 0),n];return Jt("div",{className:a("flex items-center w-full gap-4",e),children:l.map((r,c)=>Jt("div",{className:a("flex items-center h-full",r.className,{"justify-start":r.align==="left","justify-center":r.align==="center","justify-end":r.align==="right","flex-1":r.width==="fill"}),children:r.content},c))})};import{jsx as Dt}from"react/jsx-runtime";function bn({useTypedAppMeta:e}){return{AppHeader:r=>{let{meta:c}=e();return Dt(Ro,{...r,meta:c})},AppFooter:r=>{let{meta:c}=e();return Dt(Fo,{...r,meta:c})},AppContent:r=>Dt(Bo,{...r}),AppContainer:r=>Dt(Do,{...r})}}import{createContext as Lo,useContext as vn,useState as Oo,useCallback as kt,useMemo as Vo}from"react";import{jsx as _o}from"react/jsx-runtime";var hn=Lo(void 0),xn=({children:e})=>{let[t,o]=Oo({title:"",description:"",breadcrumbs:[]}),n=kt(c=>{o(h=>Object.keys(c).some(u=>JSON.stringify(h[u])!==JSON.stringify(c[u]))?{...h,...c}:h)},[]),l=kt(()=>{o(c=>c.title===""&&c.description===""&&(c.breadcrumbs?.length??0)===0?c:{title:"",description:"",breadcrumbs:[]})},[]),r=Vo(()=>({meta:t,setMeta:n,resetMeta:l}),[t,n,l]);return _o(hn.Provider,{value:r,children:e})};function Cn(){let e=Lo(void 0);return{TypedAppMetaProvider:({children:n})=>{let[l,r]=Oo({title:"",description:"",breadcrumbs:[]}),c=kt(u=>{r(m=>Object.keys(u).some(z=>{let R=m[z],k=u[z];return JSON.stringify(R)!==JSON.stringify(k)})?{...m,...u}:m)},[]),h=kt(()=>{r(u=>u.title===""&&u.description===""&&(u.breadcrumbs?.length??0)===0?u:{title:"",description:"",breadcrumbs:[]})},[]),C=Vo(()=>({meta:l,setMeta:c,resetMeta:h}),[l,c,h]);return _o(e.Provider,{value:C,children:n})},useTypedAppMeta:()=>{let n=vn(e);if(!n)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return n},TypedAppMetaContext:e}}import{useEffect as yn,useMemo as qt}from"react";function wn({useTypedAppMeta:e}){function t(o){let{setMeta:n,resetMeta:l}=e(),r=qt(()=>{if(o.backAction)return{...o.backAction,onClick:o.backAction.onClick}},[o.backAction?.content,o.backAction?.href,o.backAction?.onClick?.toString()]),c=qt(()=>o.metadata,[JSON.stringify(o.metadata)]),h=qt(()=>({...o,backAction:r,metadata:c}),[o.title,o.description,o.breadcrumbs,o.primaryActions,o.secondaryActions,o.pagination,o.status,r,c]);yn(()=>(n(h),()=>l()),[h,n,l])}return{usePageTemplate:t}}import{useState as Go}from"react";import{Copy as Nn,Check as Pn,Loader2Icon as Tn}from"lucide-react";import{jsx as Pe,jsxs as Ho}from"react/jsx-runtime";var Xt=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:l="icon",variant:r="ghost"})=>{let[c,h]=Go(!1),[C,u]=Go(!1),m=async()=>{if(!(!t||C)){u(!0);try{await this.copyToClipboard(t),h(!0),setTimeout(()=>h(!1),2e3)}catch(N){console.error("Failed to copy text:",N)}finally{u(!1)}}};return Ho(Me,{children:[Pe(Ae,{asChild:!0,children:Pe(f,{variant:r,size:l,className:a(l==="icon"&&"size-6",n),onClick:m,disabled:C||!t,children:C?Pe(Tn,{className:"animate-spin"}):c?Pe(Pn,{className:"h-3 w-3"}):o||Pe(Nn,{className:"h-3 w-3"})})}),Pe(ze,{children:c?"Copied!":C?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:l="",withSymbol:r=!0,compact:c=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${r?"\u20B9 ":""}0.00${l}`;let h=t<0,C=Math.abs(t),m=(c&&C>=1e5?this.compactFormatter:this.currencyFormatter).format(C).replace("\u20B9","");return`${n}${h?"- ":""}${r?"\u20B9 ":""}${m}${l}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:l="-"}=o,r=new Date(t);if(isNaN(r.getTime()))return"";let c=String(r.getDate()).padStart(2,"0"),h=String(r.getMonth()+1).padStart(2,"0"),C=this.MONTH_NAMES_SHORT[r.getMonth()],u=r.getFullYear();switch(n){case"dd-mmm-yyyy":return`${c}${l}${C}${l}${u}`;case"iso":return r.toISOString().split("T")[0];case"long":return r.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return r.toLocaleDateString("en-IN");default:return`${c}${l}${h}${l}${u}`}}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,l)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(l[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:l=!0,size:r="md",variant:c="outline",customColors:h,icon:C,trueMessage:u="active",falseMessage:m="inactive"})=>{let N=typeof t=="boolean"?t?u:m:typeof t=="number"?t>0?u:m:t.toLowerCase(),z={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"}}},R=z[N.toLowerCase()]||z.inactive,k=h||R[c],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"},M=l?N.charAt(0).toUpperCase()+N.slice(1):N;return Pe("div",{className:"flex justify-center",children:Ho("span",{className:a("inline-flex items-center gap-1.5 rounded-full border font-medium",k.bg,k.text,k.border,T[r],o),children:[n&&(C?Pe("span",{className:"flex items-center",children:C}):Pe("span",{className:a("size-2 rounded-full",k.dot),"aria-hidden":"true"})),M]})})}};import{AlertTriangleIcon as Sn}from"lucide-react";import{useRouteError as Dn,isRouteErrorResponse as kn,useNavigate as Rn}from"react-router";import{Fragment as Kt,jsx as le,jsxs as it}from"react/jsx-runtime";var Eo=()=>{let e=Dn(),t=Rn();return le("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:it("div",{className:"flex flex-col items-center space-y-4 text-center",children:[le(Sn,{className:"h-16 w-16 text-destructive"}),kn(e)?it(Kt,{children:[it("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?le("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&le("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?it(Kt,{children:[le("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),le("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&it("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[le("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),le("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):it(Kt,{children:[le("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),le("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)})]}),le(f,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as Te}from"framer-motion";import{jsx as _,jsxs as ae}from"react/jsx-runtime";function Mn({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return ae(Te.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[_("title",{children:"Animated Checkmark"}),_(Te.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),_(Te.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function jo(){return _(pe,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:ae(ue,{className:"space-y-4 flex flex-col items-center justify-center",children:[_(Te.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:ae("div",{className:"relative",children:[_(Te.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"}}),_(Mn,{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)]"})]})}),ae(Te.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:[_(Te.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"}),_("div",{className:"flex items-center gap-4",children:_(Te.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:ae("div",{className:"flex flex-col items-start gap-2",children:[ae("div",{className:"space-y-1.5",children:[ae("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[ae("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:[_("title",{children:"From"}),_("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),ae("div",{className:"flex items-center gap-2.5 group transition-all",children:[_("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:"$"}),_("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),_("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),ae("div",{className:"space-y-1.5",children:[ae("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[ae("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:[_("title",{children:"To"}),_("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),ae("div",{className:"flex items-center gap-2.5 group transition-all",children:[_("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"}),_("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),_(Te.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as Rt,jsxs as An}from"react/jsx-runtime";var $o=()=>Rt("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:An("div",{className:"flex flex-col items-center space-y-4",children:[Rt("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),Rt("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),Rt("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as zn}from"react-router";import{GhostIcon as In}from"lucide-react";import{NavLink as Bn,useNavigate as Fn}from"react-router";import{jsx as st,jsxs as Yt}from"react/jsx-runtime";var Uo=()=>{let e=zn(),t=Fn(),o=()=>{window.history.length>2?t(-1):t("/")};return Yt("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:[st(In,{className:"h-15 w-15 text-destructive mb-4"}),st("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),Yt("p",{className:"text-xl mb-4",children:["The page ",st("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),Yt("div",{className:"flex space-x-4",children:[st(f,{variant:"outline",onClick:o,children:"Go Back"}),st(f,{variant:"ghost",children:st(Bn,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as Ln}from"lucide-react";import{jsx as Zt,jsxs as On}from"react/jsx-runtime";var Wo=()=>On("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:[Zt(Ln,{className:"h-15 w-15 text-destructive mb-4"}),Zt("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Zt("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as Vn}from"lucide-react";import{NavLink as _n,useNavigate as Gn}from"react-router";import{jsx as lt,jsxs as Jo}from"react/jsx-runtime";var qo=()=>{let e=Gn();return Jo("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:[lt(Vn,{className:"h-15 w-15 text-destructive mb-4"}),lt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),lt("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."}),Jo("div",{className:"flex space-x-4",children:[lt(f,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),lt(f,{variant:"ghost",children:lt(_n,{to:"/",children:"Go to Home"})})]})]})};export{xn as AppMetaProvider,jo as CurrencyTransfer,go as DataTable,bo as DataTableActionBar,vo as DataTableActionBarAction,ho as DataTableActionBarSelection,wo as DataTemplate,Po as DataTemplateActionBar,To as DataTemplateActionBarAction,So as DataTemplateActionBarSelection,Eo as ErrorComponent,Xt as GeneralHelper,$o as Loader,Uo as NotFound,Wo as OfflineUI,qo as Unauthorized,bn as createLayoutComponents,wn as createPageTemplateHook,Cn as createTypedAppMetaContext};
|
|
2
|
+
import{flexRender as To,getCoreRowModel as _n,getFilteredRowModel as Vn,getPaginationRowModel as Hn,getSortedRowModel as En,useReactTable as Gn}from"@tanstack/react-table";import{Loader2 as sa,ChevronUp as So,ChevronDown as Po,ChevronsUpDown as jn,MoreHorizontal as $n,MoveRightIcon as Un,PinOffIcon as Wn,Calculator as la}from"lucide-react";import{Slot as ln}from"radix-ui";import{cva as dn}from"class-variance-authority";import{clsx as rn}from"clsx";import{twMerge as sn}from"tailwind-merge";function o(...e){return sn(rn(e))}import{jsx as cn}from"react/jsx-runtime";var qt=dn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function v({className:e,variant:t,size:a,asChild:n=!1,...l}){let i=n?ln.Slot:"button";return cn(i,{"data-slot":"button",className:o(qt({variant:t,size:a,className:e}),"transition-none"),...l})}import{jsx as Je}from"react/jsx-runtime";function po({className:e,...t}){return Je("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:Je("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function Go({className:e,...t}){return Je("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function jo({className:e,...t}){return Je("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function uo({className:e,...t}){return Je("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Ve({className:e,...t}){return Je("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function $o({className:e,...t}){return Je("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Xe({className:e,...t}){return Je("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as Uo}from"react/jsx-runtime";function He({className:e,...t}){return Uo("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ee({className:e,...t}){return Uo("div",{"data-slot":"card-content",className:o("px-6",e),...t})}import{Tooltip as yt}from"radix-ui";import{jsx as Ct,jsxs as mn}from"react/jsx-runtime";function pt({delayDuration:e=0,...t}){return Ct(yt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ke({...e}){return Ct(pt,{children:Ct(yt.Root,{"data-slot":"tooltip",...e})})}function Ye({...e}){return Ct(yt.Trigger,{"data-slot":"tooltip-trigger",...e})}function Ze({className:e,sideOffset:t=0,children:a,...n}){return Ct(yt.Portal,{children:mn(yt.Content,{"data-slot":"tooltip-content",sideOffset:t,className:o("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:[a,Ct(yt.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as ta,RefreshCw as Dn,Download as kn,Settings2 as Rn,Filter as oa,ArrowUpDown as Mn,PinOff as zn,Pin as An,ChevronDown as aa,Calculator as Co}from"lucide-react";import{jsx as pn}from"react/jsx-runtime";function wt({className:e,type:t,...a}){return pn("input",{type:t,"data-slot":"input",className:o("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}import{Select as Ne}from"radix-ui";import{CheckIcon as un,ChevronDownIcon as Wo,ChevronUpIcon as gn}from"lucide-react";import{jsx as ee,jsxs as go}from"react/jsx-runtime";function Qe({...e}){return ee(Ne.Root,{"data-slot":"select",...e})}function et({...e}){return ee(Ne.Value,{"data-slot":"select-value",...e})}function tt({className:e,size:t="default",children:a,...n}){return go(Ne.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[a,ee(Ne.Icon,{asChild:!0,children:ee(Wo,{className:"size-4 opacity-50"})})]})}function ot({className:e,children:t,position:a="popper",...n}){return ee(Ne.Portal,{children:go(Ne.Content,{"data-slot":"select-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...n,children:[ee(fn,{}),ee(Ne.Viewport,{className:o("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),ee(bn,{})]})})}function Ie({className:e,children:t,...a}){return go(Ne.Item,{"data-slot":"select-item",className:o("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[ee("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:ee(Ne.ItemIndicator,{children:ee(un,{className:"size-4"})})}),ee(Ne.ItemText,{children:t})]})}function fn({className:e,...t}){return ee(Ne.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:ee(gn,{className:"size-4"})})}function bn({className:e,...t}){return ee(Ne.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:ee(Wo,{className:"size-4"})})}import{DropdownMenu as xe}from"radix-ui";import{CheckIcon as vn,ChevronRightIcon as hn,CircleIcon as Mi}from"lucide-react";import{jsx as ce,jsxs as Ko}from"react/jsx-runtime";function De({...e}){return ce(xe.Root,{"data-slot":"dropdown-menu",...e})}function ke({...e}){return ce(xe.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Re({className:e,sideOffset:t=4,...a}){return ce(xe.Portal,{children:ce(xe.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...a})})}function fo({...e}){return ce(xe.Group,{"data-slot":"dropdown-menu-group",...e})}function J({className:e,inset:t,variant:a="default",...n}){return ce(xe.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:o("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function Lt({className:e,children:t,checked:a,...n}){return Ko(xe.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:o("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...n,children:[ce("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:ce(xe.ItemIndicator,{children:ce(vn,{className:"size-4"})})}),t]})}function se({className:e,inset:t,...a}){return ce(xe.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function me({className:e,...t}){return ce(xe.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function qo({...e}){return ce(xe.Sub,{"data-slot":"dropdown-menu-sub",...e})}function Jo({className:e,inset:t,children:a,...n}){return Ko(xe.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...n,children:[a,ce(hn,{className:"ml-auto size-4"})]})}function Xo({className:e,...t}){return ce(xe.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as na}from"react";import{useEffect as Tn,useState as xo}from"react";import{Calendar as Sn}from"lucide-react";import{format as Ot}from"date-fns";import{Popover as Jt}from"radix-ui";import{jsx as Xt}from"react/jsx-runtime";function bo({...e}){return Xt(Jt.Root,{"data-slot":"popover",...e})}function vo({...e}){return Xt(Jt.Trigger,{"data-slot":"popover-trigger",...e})}function ho({className:e,align:t="center",sideOffset:a=4,...n}){return Xt(Jt.Portal,{children:Xt(Jt.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}import*as Kt from"react";import{ChevronDownIcon as xn,ChevronLeftIcon as yn,ChevronRightIcon as Cn}from"lucide-react";import{DayPicker as wn,getDefaultClassNames as Yo}from"react-day-picker";import{jsx as at}from"react/jsx-runtime";function Zo({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:n="label",buttonVariant:l="ghost",formatters:i,components:u,...w}){let m=Yo();return at(wn,{showOutsideDays:a,className:o("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:n,formatters:{formatMonthDropdown:b=>b.toLocaleString("default",{month:"short"}),...i},classNames:{root:o("w-fit",m.root),months:o("flex gap-4 flex-col md:flex-row relative",m.months),month:o("flex flex-col w-full gap-4",m.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",m.nav),button_previous:o(qt({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_previous),button_next:o(qt({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",m.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",m.dropdowns),dropdown_root:o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",m.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",m.dropdown),caption_label:o("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",m.caption_label),table:"w-full border-collapse",weekdays:o("flex",m.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",m.weekday),week:o("flex w-full mt-2",m.week),week_number_header:o("select-none w-(--cell-size)",m.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",m.week_number),day:o("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",m.day),range_start:o("rounded-l-md bg-accent",m.range_start),range_middle:o("rounded-none",m.range_middle),range_end:o("rounded-r-md bg-accent",m.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:o("text-muted-foreground opacity-50",m.disabled),hidden:o("invisible",m.hidden),...t},components:{Root:({className:b,rootRef:p,...N})=>at("div",{"data-slot":"calendar",ref:p,className:o(b),...N}),Chevron:({className:b,orientation:p,...N})=>p==="left"?at(yn,{className:o("size-4",b),...N}):p==="right"?at(Cn,{className:o("size-4",b),...N}):at(xn,{className:o("size-4",b),...N}),DayButton:Nn,WeekNumber:({children:b,...p})=>at("td",{...p,children:at("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:b})}),...u},...w})}function Nn({className:e,day:t,modifiers:a,...n}){let l=Yo(),i=Kt.useRef(null);return Kt.useEffect(()=>{a.focused&&i.current?.focus()},[a.focused]),at(v,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:o("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",l.day,e),...n})}import{jsx as ut,jsxs as _t}from"react/jsx-runtime";function Qo({value:e,onChange:t,placeholder:a,mode:n,externalSearch:l,onExternalChange:i,onlyExternal:u=!1}){let[w,m]=xo(!1),[b,p]=xo(e),[N,O]=xo(e);Tn(()=>{u||O(e)},[e,u]);let L=()=>{u||t(b),O(b),l&&i&&i(b),m(!1)},I=()=>{p(N),m(!1)},P=()=>{let T=n==="single"?null:{from:null,to:null};p(T),u||t(T),O(T),l&&i&&i(T),m(!1)},H=()=>{let T=u?N:e;return T?n==="single"?Ot(T,"PPP"):T.from&&T.to?`${Ot(T.from,"MMM dd")} - ${Ot(T.to,"MMM dd, yyyy")}`:T.from?`From ${Ot(T.from,"MMM dd, yyyy")}`:T.to?`To ${Ot(T.to,"MMM dd, yyyy")}`:a:a},E=T=>{p(n==="single"?T:T||{from:null,to:null})};return _t(bo,{open:w,onOpenChange:m,children:[ut(vo,{className:"h-8",asChild:!0,children:_t(v,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!H()&&"text-muted-foreground"),children:[ut(Sn,{className:"mr-2 h-4 w-4"}),H()]})}),_t(ho,{className:"w-auto p-0",align:"start",children:[ut("div",{className:"p-3",children:ut(Zo,{mode:n,selected:b,onSelect:E,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),_t("div",{className:"flex items-center justify-between p-3 border-t",children:[ut(v,{variant:"ghost",size:"sm",onClick:P,children:"Clear"}),_t("div",{className:"flex gap-2",children:[ut(v,{variant:"outline",size:"sm",onClick:I,children:"Cancel"}),ut(v,{size:"sm",onClick:L,disabled:n==="range"&&(!b?.from||!b?.to),children:"Apply"})]})]})]})]})}import{Checkbox as ea}from"radix-ui";import{CheckIcon as Pn}from"lucide-react";import{jsx as yo}from"react/jsx-runtime";function gt({className:e,...t}){return yo(ea.Root,{"data-slot":"checkbox",className:o("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:yo(ea.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:yo(Pn,{className:"size-3.5"})})})}import{Fragment as In,jsx as f,jsxs as z}from"react/jsx-runtime";var ra=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function wo({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:n,enableGlobalFilter:l=!0,onExport:i,onRefresh:u,loading:w=!1,enableColumnVisibility:m=!0,data:b,onClearSorting:p,onClearFilters:N,enableColumnPinning:O=!1,onExternalSearch:L,onCustomFilterChange:I,aggregations:P={},onAggregationChange:H}){let[E,T]=na({}),[q,x]=na({}),_=()=>e.getAllLeafColumns().filter(r=>r.getCanHide?.()!==!1),Te=()=>e.getAllColumns().filter(r=>!e.getAllLeafColumns().includes(r)&&r.columns?.length&&r.columns.some(g=>g.getCanHide?.()!==!1)),we=()=>{let r=new Set(Te().flatMap(g=>g.columns?.filter(h=>h.getCanHide?.()!==!1).map(h=>h.id)||[]));return _().filter(g=>!r.has(g.id))},te=(r,g)=>g&&r.startsWith(`${g}.`)?r.replace(`${g}.`,"").split("_").map(F=>F.slice(1)).join(" "):r.split("_").map(h=>h.charAt(0).toUpperCase()+h.slice(1)).join(" "),Ae=(r,g)=>{let h={...E,[r]:g};T(h)},Fe=(r,g)=>{let h={...q,[r]:g};x(h),I&&I(r,g),t.find(F=>F.key===r)?.externalSearch&&Ae(r,g)},oe=()=>{L&&L(E)},Be=()=>{T({}),x({}),N(),L&&L({}),I&&Object.keys(q).forEach(r=>{I(r,"")})},Q=r=>t.find(h=>h.key===r)?.customFilter?q[r]??"":e.getColumn(r)?.getFilterValue(),ae=(r,g)=>{let h=t.find(F=>F.key===r);h?.customFilter?Fe(r,g):(e.getColumn(r)?.setFilterValue(g),h?.externalSearch&&Ae(r,g))},$e=r=>{if(H){let g=P[r],h={enabled:!g?.enabled,functions:g?.functions||["sum","average"]};H(r,h)}},Le=(r,g)=>{if(H){let F=P[r]?.functions||[],j=F.includes(g)?F.filter(Oe=>Oe!==g):[...F,g];H(r,{enabled:j.length>0,functions:j})}},st=()=>{H&&Object.keys(P).forEach(r=>{let g=P[r];g&&H(r,{...g,enabled:!1,functions:[]})})},Ue=_().filter(r=>r.id==="select"||r.id==="serialNumber"?!1:r.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(F=>{let j=F.getValue(r.id);return typeof j=="number"||typeof j=="string"&&!isNaN(parseFloat(String(j)))||typeof j=="object"&&j!==null&&"props"in j})),ge=Object.values(P).some(r=>r?.enabled);return f("div",{className:"rounded-xl",children:f("div",{className:"px-2",children:f("div",{className:"flex flex-col gap-6",children:z("div",{className:"flex items-center justify-between",children:[f("div",{className:"flex items-center gap-3",children:t.length>0&&z("div",{className:"flex flex-wrap items-center gap-3",children:[f("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:f(oa,{className:"size-4"})}),t.map(r=>!e.getColumn(r.key)&&!r.customFilter&&!r.externalSearch?null:f("div",{className:o("relative min-w-[150px]",r.width),children:r.type==="select"?z(Qe,{value:Q(r.key)??"",onValueChange:h=>{ae(r.key,h==="all"?"":h)},children:[r.icon&&f("span",{children:f(r.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),f(tt,{className:o("h-7 sm:h-7 rounded-lg w-full",r.icon&&"pl-9"),children:f(et,{placeholder:r.placeholder})}),z(ot,{className:"rounded-lg",children:[f(Ie,{value:"all",children:"All"}),r.options?.map(h=>f(Ie,{value:h.value,children:h.label},h.label))]})]}):r.type==="date"?f(Qo,{value:Q(r.key),onChange:h=>{r.onlyExternal||ae(r.key,h)},placeholder:r.placeholder,mode:r.dateMode||"single",externalSearch:r.externalSearch,onlyExternal:r.onlyExternal,onExternalChange:h=>Ae(r.key,h)}):z("div",{className:"relative",children:[r.icon&&f("span",{children:f(r.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"})}),f(wt,{placeholder:r.placeholder,value:Q(r.key)??"",onChange:h=>{ae(r.key,h.target.value)},className:o("h-7 rounded-lg",r.icon&&"pl-9"),type:r.type==="number"?"number":"text"})]})},r.key)),(t.some(r=>r.externalSearch)||t.some(r=>r.customFilter))&&z(v,{variant:"default",size:"sm",onClick:oe,className:"rounded-lg h-7",children:[f(ta,{className:"size-4"}),t.find(r=>r.externalSearch||r.customFilter)?.searchButtonText||"Search"]})]})}),z("div",{className:"flex items-center gap-2",children:[l&&z("div",{className:"relative",children:[f(ta,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),f(wt,{placeholder:"Global search...",value:a??"",onChange:r=>n(r.target.value),className:"pl-9 h-7 max-w-max"})]}),Ue.length>0&&H&&z(De,{children:[f(ke,{asChild:!0,children:z(v,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",ge&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[f(Co,{className:"size-4"}),f("span",{children:"Aggregations"}),f(aa,{className:"opacity-50 size-4"})]})}),z(Re,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[z(se,{className:"flex items-center justify-between px-4 py-2",children:[f("span",{className:"text-sm font-medium",children:"Column Aggregations"}),ge&&f(v,{variant:"ghost",size:"sm",onClick:st,className:"h-6 px-2 text-xs",children:"Clear All"})]}),f(me,{}),Ue.map(r=>{let g=P[r.id],h=g?.enabled;return z(qo,{children:[f(Jo,{className:"text-sm",children:z("div",{className:"flex items-center w-full gap-2",children:[f(gt,{checked:h,onCheckedChange:()=>$e(r.id),className:"data-[state=checked]:bg-primary"}),f("span",{className:o("flex-1",h&&"font-medium text-primary"),children:te(r.id)}),h&&z("div",{className:"flex items-center gap-1",children:[g?.functions?.slice(0,2).map(F=>f("div",{className:"w-2 h-2 rounded-full bg-primary",title:ra.find(j=>j.value===F)?.label},F)),g?.functions&&g.functions.length>2&&z("div",{className:"text-xs text-muted-foreground",children:["+",g.functions.length-2]})]})]})}),z(Xo,{className:"w-48 rounded-lg",children:[f(se,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),ra.map(F=>f(Lt,{checked:g?.functions?.includes(F.value)||!1,onCheckedChange:()=>Le(r.id,F.value),className:"py-2 text-sm",children:z("div",{className:"flex flex-col",children:[f("span",{children:F.label}),f("span",{className:"text-xs text-muted-foreground",children:F.description})]})},F.value))]})]},r.id)}),Ue.length===0&&z("div",{className:"px-3 py-4 text-center",children:[f(Co,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),f("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),i&&z(v,{variant:"outline",size:"sm",onClick:()=>i(b),className:"rounded-lg",children:[f(kn,{className:"size-4"}),"Export"]}),m&&z(De,{children:[f(ke,{asChild:!0,className:"h-7",children:z(v,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[f("span",{children:"Columns"}),f(aa,{className:"opacity-50 size-4"})]})}),z(Re,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[f(se,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),f(me,{}),we().length>0&&z(fo,{children:[f(se,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),we().map(r=>f(Lt,{className:"text-sm",checked:r.getIsVisible(),onCheckedChange:g=>r.toggleVisibility(!!g),children:te(r.id)},r.id))]}),Te().map(r=>z(fo,{children:[f(me,{}),f(se,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:r.id}),r.columns?.filter(g=>g.getCanHide?.()!==!1).map(g=>f(Lt,{className:"text-sm",checked:g.getIsVisible(),onCheckedChange:h=>g.toggleVisibility(!!h),children:te(g.id,r.id)},g.id))]},r.id))]})]}),z(De,{children:[f(ke,{asChild:!0,className:"h-7",children:f(v,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:f(Rn,{className:"size-4"})})}),z(Re,{align:"end",className:"w-[200px] rounded-lg",children:[f(se,{children:"Table Settings"}),f(me,{}),z(J,{onClick:p,children:[f(Mn,{className:"size-4"}),"Clear All Sorting"]}),z(J,{onClick:Be,children:[f(oa,{className:"size-4"}),"Clear All Filters"]}),ge&&z(J,{onClick:st,children:[f(Co,{className:"size-4"}),"Clear Aggregations"]}),O&&z(In,{children:[f(me,{}),f(se,{children:"Column Pinning"}),z(J,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[f(zn,{className:"size-4"}),"Reset All Pinning"]}),z(J,{onClick:()=>{let r=_().filter(g=>g.getCanPin?.()!==!1).map(g=>g.id);e.setColumnPinning({left:[],right:r})},children:[f(An,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),u&&f(v,{variant:"outline",size:"sm",onClick:u,disabled:w,className:"rounded-lg",children:f(Dn,{className:o("h-4 w-4",w&&"animate-spin")})})]})]})})})})}import{jsx as pe,jsxs as Nt}from"react/jsx-runtime";function No({table:e,config:t}){return t.enabled?pe("div",{className:"rounded-xl",children:pe("div",{children:Nt("div",{className:"flex items-center justify-between",children:[pe("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Nt("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Nt("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Nt("div",{className:"flex items-center gap-2",children:[pe("span",{className:"text-sm font-medium",children:"Rows per page:"}),Nt(Qe,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[pe(tt,{className:"h-9 w-[70px] rounded-lg",children:pe(et,{})}),pe(ot,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>pe(Ie,{value:`${a}`,children:a},a))})]})]}),Nt("div",{className:"flex items-center gap-2",children:[pe(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),pe(v,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&pe("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,n)=>{let l=e.getState().pagination.pageIndex,i=l+n;return i<1||i>e.getPageCount()?null:pe(v,{variant:i===l+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(i-1),children:i},i)})}),pe(v,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),pe(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Fn}from"radix-ui";import{cva as Bn}from"class-variance-authority";import{jsx as On}from"react/jsx-runtime";var Ln=Bn("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function ia({className:e,variant:t,size:a,noBg:n,...l}){return On(Fn.Root,{"data-slot":"toggle",className:o(Ln({className:e,variant:t,size:a,bg:n?"disabled":"enabled"})),...l})}import{useCallback as Yt,useEffect as Zt,useMemo as Qt,useRef as Vt,useState as ye}from"react";import{Fragment as ca,jsx as c,jsxs as G}from"react/jsx-runtime";var da={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((n,l)=>n-l),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function ma({data:e,columns:t,filters:a=[],pagination:n={enabled:!1},settings:l={},header:i,footer:u,className:w="",maxHeight:m="100%",loading:b=!1,error:p,emptyMessage:N="No data available",onRowSelectionChange:O,onExport:L,onRefresh:I,onTableReady:P,children:H,isRowDisabled:E,isRowSelectable:T,onExternalSearch:q,aggregations:x={},onAggregationChange:_}){let[Te,we]=ye([]),[te,Ae]=ye([]),[Fe,oe]=ye({}),[Be,Q]=ye({}),[ae,$e]=ye(""),[Le,st]=ye([]),[Se,Ue]=ye(l.enableColumnPinning?{left:[],right:[]}:{}),[ge,r]=ye({}),g=Vt(null),h=Vt(null),F=Vt(null),j=Vt(null),[Oe,no]=ye(0),[zt,Oo]=ye(0),[K,$t]=ye(0),[Ut,At]=ye(0),lt=Vt(null),[It,ro]=ye(!1),{enableSorting:vt=!0,enableFiltering:Ft=!0,enableGlobalFilter:Bt=!0,enableColumnVisibility:dt=!0,enableRowSelection:ne=!0,stickyHeader:_o=!0,toolbar:ct=!1,toolbarPosition:D="default",showSerialNumbers:R=!0,fixedCheckboxColumn:M=!0,striped:fe=!0,hoverable:be=!0,compact:ve=!0,bordered:We=!0,fullHeight:mt=!1,enableColumnResizing:Vo=!1,enableColumnPinning:re=!0,hideHeader:Ua=!1,selectionMode:qe="multiple",showCheckBox:Wa=!0,checkboxColumnPosition:Ho=0}=l;Zt(()=>{let d=()=>{lt.current&&ro(lt.current.scrollTop>0)},C=lt.current;if(C)return C.addEventListener("scroll",d),()=>C.removeEventListener("scroll",d)},[]),Zt(()=>{let d=()=>{g.current&&no(g.current.offsetHeight+16),h.current&&Oo(h.current.offsetHeight+16),F.current&&$t(F.current.offsetHeight+16),j.current&&At(j.current.offsetHeight+16)};d();let C=new ResizeObserver(()=>{setTimeout(d,50)});return g.current&&C.observe(g.current),h.current&&C.observe(h.current),F.current&&C.observe(F.current),j.current&&C.observe(j.current),()=>{C.disconnect()}},[ct,i,D]);let qa=(d,C)=>C.split(".").reduce((s,S)=>s&&s[S],d),io=Qt(()=>Object.keys(ge).length===0?e:e.filter(d=>Object.entries(ge).every(([C,s])=>{if(!s||s==="")return!0;let S=qa(d,C);return typeof s=="string"?String(S).toLowerCase().includes(s.toLowerCase()):S===s})),[e,ge]),Ja=Yt((d,C)=>{r(s=>{let S={...s};return C===""||C===null||C===void 0?delete S[d]:S[d]=C,S})},[]),ht=Qt(()=>{let d=[...t],C=y=>y.map(k=>{if(k.id==="select"||k.id==="serialNumber")return k;let B={...k,enablePinning:!0};return k.columns&&(B.columns=C(k.columns)),B}),s=C(d),S={id:"select",header:({table:y})=>{if(qe==="single")return null;let k=y.getRowModel().rows.filter(he=>!E?.(he.original)&&(T?T(he.original):!0)),B=k.length>0&&k.every(he=>he.getIsSelected()),Y=k.some(he=>he.getIsSelected());return c(gt,{checked:B||Y&&"indeterminate",onCheckedChange:he=>{k.forEach(ie=>ie.toggleSelected(!!he))},"aria-label":"Select all selectable rows"})},cell:({row:y})=>{let k=E?E(y.original):!1,B=T?T(y.original):!0;return c("div",{className:o("flex items-center justify-center",k&&"opacity-50"),children:qe==="multiple"?c(gt,{checked:y.getIsSelected(),onCheckedChange:Y=>B&&y.toggleSelected(!!Y),"aria-label":"Select row",disabled:k||!B}):Wa?c("input",{type:"radio",checked:y.getIsSelected(),onChange:()=>B&&y.toggleSelected(!0),disabled:k||!B,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:qe==="multiple"?40:30};if(ne){let y=Ho;y<0&&(y=s.length+y+1),y=Math.max(0,Math.min(y,s.length)),s.splice(y,0,S)}if(R){let y={id:"serialNumber",header:"No.",cell:({row:k})=>c("div",{className:"font-medium text-center text-muted-foreground",children:k.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};s.unshift(y)}return s},[t,R,ne,M,E,T,qe,Ho]),V=Gn({data:io,columns:ht,onSortingChange:vt?we:void 0,onColumnFiltersChange:Ft?Ae:void 0,onGlobalFilterChange:Bt?$e:void 0,getCoreRowModel:_n(),getPaginationRowModel:n.enabled?Hn():void 0,getSortedRowModel:vt?En():void 0,getFilteredRowModel:Ft?Vn():void 0,onColumnVisibilityChange:dt?oe:void 0,onRowSelectionChange:ne?Q:void 0,onColumnOrderChange:st,onColumnPinningChange:re?Ue:void 0,state:{sorting:vt?Te:void 0,columnFilters:Ft?te:void 0,columnVisibility:dt?Fe:void 0,rowSelection:ne?Be:{},globalFilter:ae,columnOrder:Le,columnPinning:re?Se:{}},initialState:{pagination:n.enabled?{pageSize:n.pageSize||10}:void 0,columnPinning:re?{left:[...R?["serialNumber"]:[],...ne?["select"]:[]],right:[]}:void 0},enableRowSelection:ne,enableColumnResizing:Vo,enableColumnPinning:re,columnResizeMode:"onChange"}),Xa=Qt(()=>{if(!x||Object.keys(x).length===0)return{};let d={},C=V.getFilteredRowModel().rows;return Object.entries(x).forEach(([s,S])=>{if(!S?.enabled)return;let y=C.map(B=>{if(S.accessor)return S.accessor(B.original);{let Y=B.getValue(s);return typeof Y=="number"?Y:parseFloat(String(Y))||0}}).filter(B=>B!==null&&!isNaN(B)),k={};S.functions?.forEach(B=>{da[B]&&(k[B]=da[B](y))}),Object.keys(k).length>0&&(d[s]=k)}),d},[io,x,V?.getFilteredRowModel().rows]);Zt(()=>{if(ne&&O){let d=V.getFilteredSelectedRowModel().rows.filter(C=>!E?.(C.original)&&(T?T(C.original):!0)).map(C=>C.original);O(d)}},[Be,ne,O,V,E,T]);let Ka=Yt(d=>{qe==="single"?(V.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[qe,V]);Zt(()=>{P&&P(V)},[V,P]);let Ya=Yt(()=>{we([])},[]),Za=Yt(()=>{Ae([]),$e("")},[]),Eo=(d,C)=>{if(!re)return;let s=[...R?["serialNumber"]:[],...ne&&M?["select"]:[]],S={left:[...(Se.left??[]).filter(y=>s.includes(y))],right:[...Se.right??[]]};C===!1?(S.left=S.left.filter(y=>y!==d),S.right=S.right.filter(y=>y!==d)):C==="right"?(S.left=S.left.filter(y=>y!==d),S.right.includes(d)||S.right.push(d)):C==="left"&&(S.right=S.right.filter(y=>y!==d),!S.left.includes(d)&&!s.includes(d)&&S.left.push(d)),V.setColumnPinning(S)},Qa=()=>c(uo,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:c(Ve,{className:"hover:bg-transparent bg-sidebar",children:V.getHeaderGroups()[0]?.headers.map((d,C)=>{let s=d.column.id,S=Xa[s],y=re&&(d.column.getIsPinned()==="left"||d.column.id==="serialNumber"||d.column.id==="select"&&ne),k=re&&d.column.getIsPinned()==="right",B=d.column.id==="serialNumber",Y=d.column.id==="select",ie=d.column.columnDef.customFooter;return c(Xe,{className:o("font-semibold text-sm py-2 px-2 border-r",ve&&"py-1",y&&"sticky left-0 z-30 bg-sidebar/95",k&&"sticky right-0 z-30 bg-sidebar/95",(B||Y)&&"sticky left-0 z-30 bg-sidebar/95",ie?.className),style:{width:d.getSize()!==150?d.getSize():"auto",minWidth:d.getSize()!==150?d.getSize():"auto",...y&&{left:B?0:Y?R&&V.getColumn("serialNumber")?.getSize()||0:so(d.column)},...k&&{right:lo(d.column)},...B&&{left:0}},children:(()=>{if(ie?.content){let _e=typeof ie.content=="function"?ie.content(V):ie.content;return c("div",{className:o("w-full h-full",ie.align==="center"&&"text-center",ie.align==="right"&&"text-right",ie.align==="left"&&"text-left"),children:_e})}return S?c("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(S).map(([_e,Wt])=>G("div",{className:"flex items-center justify-between text-muted-foreground",children:[G("span",{className:"text-xs capitalize",children:[_e,":"]}),c("span",{className:"font-medium text-foreground",children:en(_e,Wt)})]},_e))}):s==="serialNumber"?G("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",V.getFilteredRowModel().rows.length]}):null})()},`agg-${d.id}`)})})}),en=(d,C)=>typeof C=="number"?d==="count"||d==="unique"?C.toLocaleString():C.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):C,tn=()=>V.getHeaderGroups().map((d,C)=>c(Ve,{className:"hover:bg-transparent",children:d.headers.map((s,S)=>{let y=s.depth===0&&s.colSpan>1,k=re&&(s.column.getIsPinned()==="left"||s.column.id==="serialNumber"||s.column.id==="select"&&ne),B=re&&s.column.getIsPinned()==="right",Y=s.column.getCanSort(),he=re&&s.column.columnDef.enablePinning!==!1,ie=s.column.id==="serialNumber",_e=s.column.id==="select",Wt=ie||_e&&M,xt=s.column.columnDef.headerAlign||"left",mo=x&&x[s.column.id]?.enabled,nn={left:"justify-start",center:"justify-center",right:"justify-end"}[xt];return G($o,{colSpan:s.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!ve&&"py-2",We&&S<d.headers.length-1&&"border-r","relative",k&&"sticky left-0 z-25 bg-sidebar",B&&"sticky right-0 z-25 bg-sidebar",(ie||_e)&&"sticky left-0 z-25 bg-sidebar",y?"text-center":"text-left",mo&&"border-b-2 border-primary/30"),style:{width:s.getSize()!==150?s.getSize():"auto",minWidth:s.getSize()!==150?s.getSize():"auto",...k&&{left:ie?0:_e?R&&V.getColumn("serialNumber")?.getSize()||0:so(s.column)},...B&&{right:lo(s.column)},...ie&&{left:0}},children:[y?G("div",{className:"flex items-center justify-center",children:[To(s.column.columnDef.header,s.getContext()),mo&&c(la,{className:"w-3 h-3 ml-1 text-primary"})]}):G("div",{className:o("relative flex items-center w-full px-2",nn),children:[G("div",{className:"flex items-center gap-1",children:[mo&&c(la,{className:"w-3 h-3 mr-1 text-primary"}),Y&&xt==="right"&&c("span",{className:"order-2 ml-1",children:s.column.getIsSorted()&&{asc:c(So,{className:"w-4 h-4"}),desc:c(Po,{className:"w-4 h-4"})}[s.column.getIsSorted()]}),s.isPlaceholder?null:To(s.column.columnDef.header,s.getContext()),Y&&xt!=="right"&&s.column.getIsSorted()&&c("span",{className:"order-2 ml-1",children:s.column.getIsSorted()&&{asc:c(So,{className:"w-4 h-4"}),desc:c(Po,{className:"w-4 h-4"})}[s.column.getIsSorted()]})]}),(Y||he&&!Wt)&&G(De,{children:[c(ke,{asChild:!0,className:o("absolute",xt==="left"&&"right-1",xt==="center"&&"right-1",xt==="right"&&"left-1"),children:c(ia,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:c($n,{className:"w-4 h-4"})})}),G(Re,{align:"end",className:"w-48",children:[Y&&G(ca,{children:[c(se,{children:"Sorting"}),G(J,{onClick:()=>s.column.toggleSorting(!1),children:[c(So,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),G(J,{onClick:()=>s.column.toggleSorting(!0),children:[c(Po,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),G(J,{onClick:()=>s.column.clearSorting(),disabled:!s.column.getIsSorted(),children:[c(jn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),c(me,{})]}),he&&!Wt&&G(ca,{children:[c(se,{children:"Pin Column"}),G(J,{onClick:()=>Eo(s.column.id,"right"),disabled:s.column.getIsPinned()==="right",children:[c(Un,{}),"Pin Right"]}),G(J,{onClick:()=>Eo(s.column.id,!1),disabled:!s.column.getIsPinned(),children:[c(Wn,{}),"Unpin"]})]})]})]})]}),Vo&&s.column.getCanResize()&&!y&&s.colSpan===1&&c("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:s.getResizeHandler()})]},s.id)})},d.id)),so=d=>{if(!re)return;let C=0,s=V.getLeftHeaderGroups()[0]?.headers||[],S=[...R?["serialNumber"]:[],...ne?["select"]:[]];for(let y of s){if(y.id===d.id)break;if(S.includes(y.id)){let k=V.getColumn(y.id);k&&(C+=k.getSize())}}return C},lo=d=>{if(!re)return;let C=V.getState().columnPinning.right||[],s=C.indexOf(d.id);if(s===-1)return;let S=0;for(let y=s+1;y<C.length;y++){let k=V.getColumn(C[y]);k&&(S+=k.getSize())}return S};if(p)return c(He,{className:"w-full shadow-sm rounded-xl",children:c(Ee,{className:"flex items-center justify-center",children:G("div",{className:"text-center",children:[c("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),c("p",{className:"mb-4 text-sm text-muted-foreground",children:p}),I&&G(v,{variant:"outline",size:"sm",onClick:I,className:"rounded-lg",children:[c(sa,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let on=d=>d&&typeof d=="object"&&"content"in d,Pe=Qt(()=>i?on(i)?{content:i.content,align:i.align||"left",className:i.className||"",sticky:i.sticky!==void 0?i.sticky:!0,showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[i]),co=()=>ct?c(wo,{table:V,filters:a,globalFilter:ae,onGlobalFilterChange:$e,enableGlobalFilter:Bt,onExport:L,onRefresh:I,loading:b,enableColumnVisibility:dt,enableColumnPinning:re,data:io,onClearSorting:Ya,onClearFilters:Za,onExternalSearch:q,onCustomFilterChange:Ja,aggregations:x,onAggregationChange:_}):null,an=()=>{let d=0;return D==="above-header"&&(d+=zt),Pe&&(d+=Ut),D==="below-header"&&(d+=K),d};return c(pt,{children:G("div",{className:o("w-full space-y-2 flex flex-col h-full",w),children:[ct&&D==="default"&&c("div",{ref:g,className:"relative z-40",children:co()}),c(He,{className:o("shadow-sm overflow-hidden py-0",mt&&"flex-1"),children:c(Ee,{className:"h-full p-0",children:G("div",{className:"relative flex flex-col justify-between h-full",children:[b&&c("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:G("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[c(sa,{className:"size-5 animate-spin text-primary"}),c("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),c("div",{ref:lt,className:o("relative overflow-auto border-b rounded-t-xl",V.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:m},children:G(po,{className:o("w-full border-collapse relative",V.getRowModel().rows?.length===0&&"h-full"),children:[ct&&D==="above-header"&&c("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:c(Ve,{className:"hover:bg-transparent",children:c(Xe,{colSpan:ht.length,className:"p-2 bg-sidebar border-b shadow-sm",children:c("div",{ref:h,children:co()})})})}),Pe&&(Pe.showOnEmpty||V.getRowModel().rows?.length>0)&&c("thead",{className:o("sticky bg-sidebar border-b",It&&"shadow-sm"),style:{top:D==="above-header"?`${zt}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(Xe,{colSpan:ht.length,className:o("p-2 font-semibold text-foreground bg-sidebar",ve?"py-2":"py-4",Pe.className),children:c("div",{ref:j,className:o("flex items-center w-full",Pe.align==="center"&&"justify-center",Pe.align==="right"&&"justify-end",Pe.align==="left"&&"justify-start"),children:typeof Pe.content=="string"?c("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Pe.content}):Pe.content})})})}),ct&&D==="below-header"&&c("thead",{className:o("sticky bg-sidebar border-b",It&&"shadow-sm"),style:{top:Pe?`${Ut}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(Xe,{colSpan:ht.length,className:"p-2 bg-sidebar",children:c("div",{ref:F,children:co()})})})}),!Ua&&c(Go,{className:o("sticky bg-sidebar",It&&"shadow-sm"),style:{top:`${an()}px`,zIndex:30},children:tn()}),c(jo,{children:V.getRowModel().rows?.length?V.getRowModel().rows.map((d,C)=>c(Ve,{"data-state":d.getIsSelected()&&"selected",className:o(be&&"hover:bg-muted/50",fe&&C%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",qe==="single"&&"cursor-pointer"),onClick:()=>{qe==="single"&&Ka(d)},children:d.getVisibleCells().map((s,S)=>{let y=re&&(s.column.getIsPinned()==="left"||s.column.id==="serialNumber"||s.column.id==="select"&&ne),k=re&&s.column.getIsPinned()==="right",B=s.column.id==="serialNumber",Y=s.column.id==="select",he=B||Y&&M;return c(Xe,{className:o(ve?"py-2":"py-4",We&&S<d.getVisibleCells().length&&"border-r",y&&"sticky left-0 z-20 bg-sidebar/95",k&&"sticky right-0 z-20 bg-sidebar/95",B&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:s.column.getSize()!==150?s.column.getSize():"auto",minWidth:s.column.getSize()!==150?s.column.getSize():"auto",...y&&{left:B?0:Y?R&&V.getColumn("serialNumber")?.getSize()||0:so(s.column)},...k&&{right:lo(s.column)},...B&&{left:0}},children:To(s.column.columnDef.cell,s.getContext())},s.id)})},d.id)):c(Ve,{children:c(Xe,{colSpan:ht.length,className:"h-32 text-center border-0",children:G("div",{className:"flex flex-col items-center gap-3",children:[c("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),c("p",{className:"font-medium text-muted-foreground",children:N})]})})})}),Qa()]})}),u&&c("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:c(po,{children:c(uo,{children:c(Ve,{className:"bg-sidebar",children:c(Xe,{colSpan:ht.length,className:"p-2",children:u})})})})})]})})}),c(No,{table:V,config:n}),H&&H(V)]})})}import{Separator as qn}from"radix-ui";import{jsx as Jn}from"react/jsx-runtime";function Ht({className:e,orientation:t="horizontal",decorative:a=!0,...n}){return Jn(qn.Root,{"data-slot":"separator-root",decorative:a,orientation:t,className:o("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}import{Loader as Xn,X as Kn}from"lucide-react";import{AnimatePresence as Yn,motion as Zn}from"framer-motion";import*as nt from"react";import*as pa from"react-dom";import{jsx as le,jsxs as Et}from"react/jsx-runtime";function ua({table:e,visible:t,container:a,children:n,className:l,...i}){let[u,w]=nt.useState(!1);nt.useLayoutEffect(()=>{w(!0)},[]),nt.useEffect(()=>{function p(N){N.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let b=t??e.getFilteredSelectedRowModel().rows.length>0;return pa.createPortal(le(Yn,{children:b&&le(Zn.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:o("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",l),...i,children:le(pt,{children:n})})}),m)}function ga({size:e="sm",tooltip:t,isPending:a,disabled:n,className:l,children:i,...u}){let w=le(v,{variant:"secondary",size:e,className:o("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",l),disabled:n||a,...u,children:a?le(Xn,{className:"animate-spin"}):i});return t?Et(Ke,{children:[le(Ye,{asChild:!0,children:w}),le(Ze,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:le("p",{children:t})})]}):w}function fa({table:e}){let t=nt.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Et("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Et("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),le(Ht,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Et(Ke,{children:[le(Ye,{asChild:!0,children:le(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:le(Kn,{className:"size-3.5"})})}),Et(Ze,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[le("p",{children:"Clear selection"}),le("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:le("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as ol,EyeOff as al}from"lucide-react";import{jsx as ll,jsxs as dl}from"react/jsx-runtime";import{ChevronDown as pl,Eye as ul}from"lucide-react";import{jsx as vl,jsxs as hl}from"react/jsx-runtime";import{Slot as Cl}from"radix-ui";import{cva as Qn}from"class-variance-authority";import{jsx as Pl}from"react/jsx-runtime";var Tl=Qn("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});import{Command as jl}from"cmdk";import{SearchIcon as Ul}from"lucide-react";import{Dialog as Rl}from"radix-ui";import{XIcon as zl}from"lucide-react";import{jsx as Fl,jsxs as Bl}from"react/jsx-runtime";import{jsx as Xl,jsxs as Kl}from"react/jsx-runtime";import{CheckIcon as ud,PlusCircleIcon as gd}from"lucide-react";import{Fragment as hd,jsx as bd,jsxs as vd}from"react/jsx-runtime";import{useState as rt,useEffect as va,useMemo as ko,useCallback as Tt,useRef as mr}from"react";import{Loader2 as ha}from"lucide-react";import{Search as er,Download as tr,RefreshCw as or,Filter as ar,ChevronDown as nr,Settings2 as rr}from"lucide-react";import{Fragment as ir,jsx as A,jsxs as Z}from"react/jsx-runtime";function Do({fields:e,filters:t,globalFilter:a,onGlobalFilterChange:n,fieldFilters:l,onFieldFilterChange:i,sortField:u,sortDirection:w,onSortChange:m,selectedCount:b,totalCount:p,visibleCount:N,onExport:O,onRefresh:L,loading:I,onClearFilters:P,onClearSorting:H}){let E=e.filter(x=>x.sortable),T=Object.values(l).some(x=>x!=null&&x!=="")||a!=="",q=u!=="";return A("div",{className:"rounded-xl p-0.5",children:A("div",{className:"px-2",children:A("div",{className:"flex flex-col gap-6",children:Z("div",{className:"flex items-center justify-between",children:[A("div",{className:"flex items-center gap-3",children:t.length>0&&Z("div",{className:"flex items-center gap-3 flex-wrap",children:[A("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:A(ar,{className:"h-4 w-4"})}),t.map(x=>A("div",{className:"relative min-w-[150px]",children:x.type==="select"?Z(Qe,{value:l[x.key]||"all",onValueChange:_=>i(x.key,_),children:[x.icon&&A(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),A(tt,{className:o("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:A(et,{placeholder:x.placeholder||"Select..."})}),Z(ot,{className:"rounded-lg",children:[A(Ie,{value:"all",children:"All"}),x.options?.map(_=>A(Ie,{value:_.value,children:_.label},_.value))]})]}):Z("div",{className:"relative",children:[x.icon&&A(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),A(wt,{type:x.type,placeholder:x.placeholder,value:l[x.key]||"",onChange:_=>i(x.key,_.target.value),className:o("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),Z("div",{className:"flex items-center gap-2",children:[Z("div",{className:"relative",children:[A(er,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),A(wt,{placeholder:"Global search...",value:a,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),E.length>0&&Z(De,{children:[A(ke,{asChild:!0,children:Z(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[A("span",{children:"Sort"}),A(nr,{className:"h-4 w-4 opacity-50"})]})}),Z(Re,{align:"end",className:"w-[200px] rounded-lg",children:[A(se,{children:"Sort By"}),A(me,{}),E.map(x=>Z("div",{children:[Z(J,{onClick:()=>m(x.key,"asc"),children:[x.label," (A-Z)"]}),Z(J,{onClick:()=>m(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),q&&Z(ir,{children:[A(me,{}),A(J,{onClick:H,children:"Clear All Sorting"})]})]})]}),Z(De,{children:[A(ke,{asChild:!0,children:A(v,{variant:"outline",size:"sm",className:"rounded-lg",children:A(rr,{className:"h-4 w-4"})})}),Z(Re,{align:"end",className:"w-[200px] rounded-lg",children:[A(se,{children:"Table Settings"}),A(me,{}),A(J,{onClick:H,children:"Clear All Sorting"}),A(J,{onClick:P,children:"Clear All Filters"})]})]}),O&&Z(v,{variant:"outline",size:"sm",onClick:O,className:"rounded-lg",children:[A(tr,{className:"mr-2 h-4 w-4"}),"Export"]}),L&&A(v,{variant:"outline",size:"sm",onClick:L,disabled:I,className:"rounded-lg",children:A(or,{className:o("h-4 w-4",I&&"animate-spin")})})]})]})})})})}import{ChevronLeft as sr,ChevronRight as lr,ChevronsLeft as dr,ChevronsRight as cr}from"lucide-react";import{jsx as U,jsxs as Me}from"react/jsx-runtime";function ba({currentPage:e,totalPages:t,pageSize:a,totalItems:n,onPageChange:l,onPageSizeChange:i,config:u}){if(!u.enabled)return null;let w=u.pageSizeOptions||[10,20,50,100],m=(e-1)*a+1,b=Math.min(e*a,n),p=e>1,N=e<t,O=()=>{let I=[],P=[];for(let H=Math.max(2,e-2);H<=Math.min(t-1,e+2);H++)I.push(H);return e-2>2?P.push(1,"..."):P.push(1),P.push(...I),e+2<t-1?P.push("...",t):t>1&&P.push(t),P};return U("div",{className:"rounded-xl",children:Me("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[U("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&Me("span",{children:["Showing ",m," to ",b," of ",n," entries"]})}),Me("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[w&&Me("div",{className:"flex items-center gap-2",children:[U("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Me(Qe,{value:`${a}`,onValueChange:L=>i(Number(L)),children:[U(tt,{className:"h-9 w-[70px] rounded-lg",children:U(et,{})}),U(ot,{side:"top",className:"rounded-lg",children:w.map(L=>U(Ie,{value:`${L}`,children:L},L))})]})]}),Me("div",{className:"flex items-center gap-2",children:[Me(v,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:!p,className:"hidden sm:flex rounded-lg",children:[U(dr,{className:"h-4 w-4"}),U("span",{className:"sr-only",children:"Go to first page"})]}),Me(v,{variant:"outline",size:"sm",onClick:()=>l(e-1),disabled:!p,className:"rounded-lg",children:[U(sr,{className:"h-4 w-4 sm:mr-2"}),U("span",{className:"hidden sm:inline",children:"Previous"}),U("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&U("div",{className:"hidden sm:flex items-center gap-1",children:O().map((L,I)=>{if(L==="...")return U("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${I}`);let P=L;return U(v,{variant:P===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>l(P),children:P},P)})}),Me("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),Me(v,{variant:"outline",size:"sm",onClick:()=>l(e+1),disabled:!N,className:"rounded-lg",children:[U("span",{className:"hidden sm:inline",children:"Next"}),U(lr,{className:"h-4 w-4 sm:ml-2"}),U("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Me(v,{variant:"outline",size:"sm",onClick:()=>l(t),disabled:!N,className:"hidden sm:flex rounded-lg",children:[U(cr,{className:"h-4 w-4"}),U("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as $,jsxs as ft}from"react/jsx-runtime";function xa({data:e,template:t,fields:a=[],filters:n=[],pagination:l={enabled:!1},settings:i={},header:u,footer:w,className:m="",loading:b=!1,error:p,emptyMessage:N="No items found",emptyIcon:O,onSelectionChange:L,onExport:I,onRefresh:P,onTemplateReady:H,children:E}){let{enableSorting:T=!0,enableFiltering:q=!0,enableGlobalSearch:x=!0,enableSelection:_=!1,enableExport:Te=!1,toolbar:we=!0,selectionMode:te="multiple",gridCols:Ae={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Fe=4,aspectRatio:oe="auto",minCardWidth:Be=350,maxCardWidth:Q=350}=i,[ae,$e]=rt(""),[Le,st]=rt({}),[Se,Ue]=rt(""),[ge,r]=rt("asc"),[g,h]=rt(new Set),[F,j]=rt(1),[Oe,no]=rt(l.pageSize||12),[zt,Oo]=rt(Ae.default),K=ko(()=>{let D=[...e];if(x&&ae){let R=a.filter(M=>M.searchable!==!1);D=D.filter(M=>R.some(fe=>M[fe.key]?.toString().toLowerCase().includes(ae.toLowerCase())))}if(q&&Object.keys(Le).forEach(R=>{let M=Le[R];if(M!=null&&M!==""){let fe=a.find(be=>be.key===R);fe&&(D=D.filter(be=>{let ve=be[R];return fe.type==="boolean"?ve===(M==="true"):fe.type==="number"?ve===Number(M):ve?.toString().toLowerCase().includes(String(M).toLowerCase())}))}}),T&&Se){let R=a.find(M=>M.key===Se);R&&D.sort((M,fe)=>{let be=M[Se],ve=fe[Se];if(R.type==="number")return ge==="asc"?Number(be)-Number(ve):Number(ve)-Number(be);if(R.type==="date"){let We=new Date(be),mt=new Date(ve);return ge==="asc"?We.getTime()-mt.getTime():mt.getTime()-We.getTime()}else{let We=String(be).toLowerCase(),mt=String(ve).toLowerCase();return ge==="asc"?We.localeCompare(mt):mt.localeCompare(We)}})}return D},[e,ae,Le,Se,ge,a,x,q,T]),$t=ko(()=>{if(!l.enabled)return K;let D=(F-1)*Oe,R=D+Oe;return K.slice(D,R)},[K,F,Oe,l.enabled]),Ut=Math.ceil(K.length/Oe),At=Tt(D=>{_&&h(R=>{let M=new Set(R);return te==="single"?(M.clear(),M.add(D)):M.has(D)?M.delete(D):M.add(D),M})},[_,te]),lt=Tt(()=>{!_||te==="single"||(g.size===K.length?h(new Set):h(new Set(K.map((D,R)=>R))))},[_,te,g.size,K.length]),It=Tt((D,R)=>{st(M=>({...M,[D]:R})),j(1)},[]),ro=Tt((D,R)=>{Ue(D),r(R)},[]),vt=Tt(()=>{$e(""),st({}),j(1)},[]),Ft=Tt(()=>{Ue(""),r("asc")},[]),Bt=ko(()=>({getSelectedItems:()=>Array.from(g).map(D=>K[D]),clearSelection:()=>h(new Set),selectAll:lt,getFilteredData:()=>K,getTotalCount:()=>e.length,getVisibleCount:()=>K.length,refresh:()=>P?.(),exportData:()=>I?.(K)}),[g,K,e.length,lt,P,I]),dt=mr(null);dt.current=Bt,va(()=>{H&&dt.current&&H(dt.current)},[]),va(()=>{if(_&&L){let D=Array.from(g).map(R=>K[R]);L(D)}},[g]);let ne=o("w-full","overflow-hidden",m),_o=o("grid",`gap-${Fe}`,"w-full","mx-auto","items-start"),ct={gridTemplateColumns:zt===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Be}px, calc(100%/${zt} - ${Fe*4}px), ${Q}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return p?$(He,{className:"w-full",children:$(Ee,{className:"flex items-center justify-center py-12",children:ft("div",{className:"text-center",children:[$("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),$("p",{className:"text-sm text-muted-foreground mb-4",children:p}),P&&ft(v,{variant:"outline",size:"sm",onClick:P,children:[$(ha,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):ft("div",{className:o("w-full flex gap-2 flex-col h-full",ne),children:[u&&$(He,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:$(Ee,{className:"p-2",children:u})}),we&&$(Do,{fields:a,filters:n,globalFilter:ae,onGlobalFilterChange:$e,fieldFilters:Le,onFieldFilterChange:It,sortField:Se,sortDirection:ge,onSortChange:ro,selectedCount:g.size,totalCount:e.length,visibleCount:K.length,onExport:Te?()=>I?.(K):void 0,onRefresh:P,loading:b,onClearFilters:vt,onClearSorting:Ft}),$(He,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:$(Ee,{className:"px-0",children:ft("div",{className:"relative",children:[b&&$("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:ft("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[$(ha,{className:"size-5 animate-spin text-primary"}),$("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),$t.length>0?$("div",{className:o(_o),style:ct,children:$t.map((D,R)=>{let M=l.enabled?(F-1)*Oe+R:R,fe=g.has(M);return ft("div",{className:o("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",oe==="square"?"aspect-square":"",oe==="video"?"aspect-video":"",_?"cursor-pointer":"",fe?"ring-2 ring-primary":""),onClick:()=>_&&At(M),children:[_&&te==="multiple"&&$("div",{className:"absolute top-2 right-2 z-10",children:$(gt,{checked:fe,onCheckedChange:()=>At(M),className:"bg-background/80 backdrop-blur-sm",onClick:be=>be.stopPropagation()})}),t(D,R,fe,()=>At(M))]},M)})}):ft("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[$("div",{className:"text-6xl",children:O||"\u{1F4CB}"}),$("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:N}),(ae||Object.values(Le).some(D=>D))&&$(v,{variant:"outline",onClick:vt,children:"Clear Filters"})]})]})})}),l.enabled&&$("div",{className:"pb-1",children:$(ba,{currentPage:F,totalPages:Ut,pageSize:Oe,totalItems:K.length,onPageChange:j,onPageSizeChange:D=>{no(D),j(1)},config:l})}),w&&$("div",{className:"p-2 m-0.5",children:w}),E&&E(Bt)]})}import{Loader as pr,X as ur}from"lucide-react";import{AnimatePresence as gr,motion as fr}from"framer-motion";import*as it from"react";import*as ya from"react-dom";import{jsx as de,jsxs as Gt}from"react/jsx-runtime";function Ca({controller:e,visible:t,container:a,children:n,className:l,...i}){let[u,w]=it.useState(!1);it.useLayoutEffect(()=>{w(!0)},[]),it.useEffect(()=>{function N(O){O.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let b=e.getSelectedItems(),p=t??b.length>0;return ya.createPortal(de(gr,{children:p&&de(fr.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:o("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",l),...i,children:de(pt,{children:n})})}),m)}function wa({size:e="sm",variant:t="secondary",tooltip:a,isPending:n,disabled:l,className:i,children:u,onClick:w,...m}){let b=de(v,{variant:t,size:e,className:o("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:l||n,onClick:w,...m,children:n?de(pr,{className:"animate-spin"}):u});return a?Gt(Ke,{children:[de(Ye,{asChild:!0,children:b}),de(Ze,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:de("p",{children:a})})]}):b}function Na({controller:e}){let t=it.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let a=e.getSelectedItems();return Gt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Gt("span",{className:"whitespace-nowrap text-sm font-medium",children:[a.length," selected"]}),de(Ht,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Gt(Ke,{children:[de(Ye,{asChild:!0,children:de(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:de(ur,{className:"size-3.5"})})}),Gt(Ze,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[de("p",{children:"Clear selection"}),de("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:de("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as hr}from"react/jsx-runtime";var br={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},vr={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Ta=({children:e,className:t,spacing:a="tight",padding:n="none"})=>hr("div",{className:o("flex flex-col h-full",br[a],vr[n],t),children:e});import{ArrowLeftIcon as Sa,ChevronRight as xr}from"lucide-react";import{NavLink as yr}from"react-router";import{jsx as ue,jsxs as bt}from"react/jsx-runtime";var Pa=({className:e,columns:t=[],showBackButton:a=!0,meta:n={title:""}})=>{let l=()=>{if(!n.backAction||!a)return null;let p={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.backAction.href?ue(yr,{to:n.backAction.href,children:bt(v,{...p,children:[ue(Sa,{className:"size-6"}),n.backAction.content]})}):bt(v,{...p,onClick:n.backAction.onClick,children:[ue(Sa,{className:"size-6"}),n.backAction.content]})},i=()=>!n.metadata||n.metadata.length===0?null:ue("div",{className:"flex gap-4",children:n.metadata.map((p,N)=>p.value&&bt("div",{className:"text-sm",children:[bt("span",{className:"text-muted-foreground",children:[p.label," "]}),ue("span",{children:p.value})]},N))}),u=()=>n.status?ue("span",{className:o("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[n.status.color]),children:n.status.content}):null,w={content:bt("div",{className:"flex gap-2 items-center",children:[l(),bt("div",{className:"flex flex-col gap-2 w-max",children:[ue("h1",{className:"text-2xl font-bold tracking-tight",children:n.title}),u(),n.description&&ue("p",{className:"text-muted-foreground",children:n.description}),i(),n.breadcrumbs&&n.breadcrumbs.length>0&&ue("div",{className:"flex items-center text-sm text-muted-foreground",children:n.breadcrumbs.map((p,N)=>bt("div",{className:"flex items-center",children:[p.href?ue("span",{className:"hover:text-primary hover:underline",children:p.label}):ue("span",{children:p.label}),N<n.breadcrumbs.length-1&&ue(xr,{className:"mx-2 h-4 w-4"})]},N))})]})]}),align:"left",width:"fill"},m={content:n.primaryActions,align:"right",width:"auto"},b=[w,...t.filter(p=>p!==void 0),m];return ue("div",{className:o("flex items-center w-full gap-4 p-2",e),children:b.map((p,N)=>ue("div",{className:o("flex items-center h-full",p.className,{"justify-start":p.align==="left","justify-center":p.align==="center","justify-end":p.align==="right","flex-1":p.width==="fill"}),children:p.content},N))})};import Nr,{useState as Tr,createContext as Sr,useContext as Pr}from"react";import{Dialog as jt}from"radix-ui";import{XIcon as Cr}from"lucide-react";import{jsx as St,jsxs as Ro}from"react/jsx-runtime";function Da({...e}){return St(jt.Root,{"data-slot":"sheet",...e})}function Mo({...e}){return St(jt.Portal,{"data-slot":"sheet-portal",...e})}function wr({className:e,...t}){return St(jt.Overlay,{"data-slot":"sheet-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function ka({className:e,children:t,side:a="right",...n}){return Ro(Mo,{children:[St(wr,{}),Ro(jt.Content,{"data-slot":"sheet-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,Ro(jt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[St(Cr,{className:"size-4"}),St("span",{className:"sr-only",children:"Close"})]})]})]})}import{Fragment as Mr,jsx as X,jsxs as Dt}from"react/jsx-runtime";var Ra=Sr(!1),eo={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},Pt={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Dr=(e,t)=>{let[a,n]=eo[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:o("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?n:a,sheetPushClass:e==="right"?a:n}},kr="flex flex-col overflow-hidden rounded-2xl relative",Rr={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},Ma=e=>{let{children:t,className:a,variant:n="default",layout:l="full",header:i,footer:u,headerClassName:w,contentClassName:m,footerClassName:b,parentContainer:p=!1,padding:N=p?"none":"tight"}=e,O=Pr(Ra),[L,I]=Tr(!1),P=Nr.useCallback(E=>X("div",{className:o("flex-1 overflow-auto h-full no-scrollbar",p&&"flex",!p&&Pt[N],m),children:E}),[N,p,m]),H=()=>{switch(l){case"split":{let{splitRatio:E="three-fourth",reverse:T=!1}=e;if(!Array.isArray(t)||t.length!==2)return X("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[q,x]=eo[E],[_,Te]=T?[t[1],t[0]]:[t[0],t[1]],[we,te]=T?[x,q]:[q,x];return Dt("div",{className:"flex h-full gap-2",children:[X("div",{className:o(we,"overflow-auto"),children:P(_)}),X("div",{className:o(te,"overflow-auto"),children:P(Te)})]})}case"with-sheet":{let{sheetContent:E,sheetWidth:T="four-fifth",sheetSide:q="right",sheetMode:x="container",sheetClassName:_,isSheetOpen:Te,onSheetOpenChange:we,disableOverlay:te=!0,showSheetOverlay:Ae=!0}=e,Fe=Te!==void 0&&we,oe=Fe?Te:L,Be=Fe?we:I;if(x==="container"){let Q=Dr(q,T),ae=eo[T][0];return te?Dt("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[X("div",{className:o("h-full overflow-auto transition-all duration-500",oe?Q.contentPushClass:"w-full",oe&&"overflow-y-auto overflow-x-hidden"),children:X("div",{className:o("h-full",!p&&Pt[N]),children:t})}),X("div",{className:o(Q.container,"transition-all duration-500 ease-in-out h-full",ae,oe&&["left","right"].includes(q)?o(Q.sheetPushClass,"overflow-y-auto"):oe?Q.transformOpen:o(Q.transform,"hidden"),"overflow-y-auto"),children:X("div",{className:o(Q.content,_,"h-full"),children:E})})]}):Dt("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[X("div",{className:o("h-full overflow-auto w-full transition-all duration-500 relative z-10"),children:X("div",{className:o("h-full",!p&&Pt[N]),children:t})}),Dt("div",{className:o("absolute inset-0 z-20",!oe&&"pointer-events-none"),children:[Ae&&X("div",{className:o("absolute inset-0 bg-black/50 transition-opacity duration-500",oe?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>Be(!1)}),X("div",{className:o(Q.container,"transition-all duration-500 backdrop-blur-2xl ease-in-out h-full absolute",ae,oe?"translate-x-0 opacity-100":o(q==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),"overflow-y-auto"),style:{[q]:0},children:X("div",{className:o(Q.content,_,"h-full"),children:E})})]})]})}return Dt(Mr,{children:[t,X(Da,{open:oe,onOpenChange:Be,children:X(Mo,{children:X(ka,{side:q,className:o("fixed bg-background border sm:max-w-full","transition-all duration-500 ease-in-out",eo[T][0],_),children:E})})})]})}default:return P(t)}};return X(Ra.Provider,{value:!0,children:Dt("div",{className:o(kr,Rr[n],Pt[N],O&&"flex-1",p&&"h-full",!p&&"rounded-2xl",a),children:[i&&X("div",{className:o("border-b",w,n==="card"&&!p&&"rounded-t-2xl",n==="border"&&"border-b-2",Pt[N]),children:i}),H(),u&&X("div",{className:o("border-t",b,n==="card"&&!p&&"rounded-b-2xl",n==="border"&&"border-t-2",Pt[N]),children:u})]})})};import{jsx as zo}from"react/jsx-runtime";var za=({className:e,columns:t=[],meta:a={title:""}})=>{let n={content:zo("div",{className:"flex items-center gap-4 p-2",children:a.secondaryActions}),align:"right",width:"fill"},l=[...t.filter(i=>i!==void 0),n];return zo("div",{className:o("flex items-center w-full gap-4",e),children:l.map((i,u)=>zo("div",{className:o("flex items-center h-full",i.className,{"justify-start":i.align==="left","justify-center":i.align==="center","justify-end":i.align==="right","flex-1":i.width==="fill"}),children:i.content},u))})};import{jsx as to}from"react/jsx-runtime";function zr({useTypedAppMeta:e}){return{AppHeader:i=>{let{meta:u}=e();return to(Pa,{...i,meta:u})},AppFooter:i=>{let{meta:u}=e();return to(za,{...i,meta:u})},AppContent:i=>to(Ma,{...i}),AppContainer:i=>to(Ta,{...i})}}import{createContext as Aa,useContext as Ar,useState as Ia,useCallback as oo,useMemo as Fa}from"react";import{jsx as Ba}from"react/jsx-runtime";var Ir=Aa(void 0),Fr=({children:e})=>{let[t,a]=Ia({title:"",description:"",breadcrumbs:[]}),n=oo(u=>{a(w=>Object.keys(u).some(b=>JSON.stringify(w[b])!==JSON.stringify(u[b]))?{...w,...u}:w)},[]),l=oo(()=>{a(u=>u.title===""&&u.description===""&&(u.breadcrumbs?.length??0)===0?u:{title:"",description:"",breadcrumbs:[]})},[]),i=Fa(()=>({meta:t,setMeta:n,resetMeta:l}),[t,n,l]);return Ba(Ir.Provider,{value:i,children:e})};function Br(){let e=Aa(void 0);return{TypedAppMetaProvider:({children:n})=>{let[l,i]=Ia({title:"",description:"",breadcrumbs:[]}),u=oo(b=>{i(p=>Object.keys(b).some(O=>{let L=p[O],I=b[O];return JSON.stringify(L)!==JSON.stringify(I)})?{...p,...b}:p)},[]),w=oo(()=>{i(b=>b.title===""&&b.description===""&&(b.breadcrumbs?.length??0)===0?b:{title:"",description:"",breadcrumbs:[]})},[]),m=Fa(()=>({meta:l,setMeta:u,resetMeta:w}),[l,u,w]);return Ba(e.Provider,{value:m,children:n})},useTypedAppMeta:()=>{let n=Ar(e);if(!n)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return n},TypedAppMetaContext:e}}import{useEffect as Lr,useMemo as Ao}from"react";function Or({useTypedAppMeta:e}){function t(a){let{setMeta:n,resetMeta:l}=e(),i=Ao(()=>{if(a.backAction)return{...a.backAction,onClick:a.backAction.onClick}},[a.backAction?.content,a.backAction?.href,a.backAction?.onClick?.toString()]),u=Ao(()=>a.metadata,[JSON.stringify(a.metadata)]),w=Ao(()=>({...a,backAction:i,metadata:u}),[a.title,a.description,a.breadcrumbs,a.primaryActions,a.secondaryActions,a.pagination,a.status,i,u]);Lr(()=>(n(w),()=>l()),[w,n,l])}return{usePageTemplate:t}}import{useState as La}from"react";import{Copy as _r,Check as Vr,Loader2Icon as Hr}from"lucide-react";import{jsx as Ge,jsxs as Oa}from"react/jsx-runtime";var Io=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(a){throw console.error("Failed to copy text:",a),a}}static CopyToClipboard=({text:t,children:a,className:n,size:l="icon",variant:i="ghost"})=>{let[u,w]=La(!1),[m,b]=La(!1),p=async()=>{if(!(!t||m)){b(!0);try{await this.copyToClipboard(t),w(!0),setTimeout(()=>w(!1),2e3)}catch(N){console.error("Failed to copy text:",N)}finally{b(!1)}}};return Oa(Ke,{children:[Ge(Ye,{asChild:!0,children:Ge(v,{variant:i,size:l,className:o(l==="icon"&&"size-6",n),onClick:p,disabled:m||!t,children:m?Ge(Hr,{className:"animate-spin"}):u?Ge(Vr,{className:"h-3 w-3"}):a||Ge(_r,{className:"h-3 w-3"})})}),Ge(Ze,{children:u?"Copied!":m?"Copying...":"Copy to clipboard"})]})};static formatINR(t,a={}){let{prefix:n="",suffix:l="",withSymbol:i=!0,compact:u=!1}=a;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${l}`;let w=t<0,m=Math.abs(t),p=(u&&m>=1e5?this.compactFormatter:this.currencyFormatter).format(m).replace("\u20B9","");return`${n}${w?"- ":""}${i?"\u20B9 ":""}${p}${l}`}static formatDate(t,a={}){let{format:n="dd-mm-yyyy",separator:l="-"}=a,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),w=String(i.getMonth()+1).padStart(2,"0"),m=this.MONTH_NAMES_SHORT[i.getMonth()],b=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${u}${l}${m}${l}${b}`;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}${l}${w}${l}${b}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((a,n,l)=>["-","'"," "].includes(a)||n>0&&["-","'"].includes(l[n-1])?a:a.charAt(0).toUpperCase()+a.slice(1)).join(""):""}static StatusBadge=({status:t,className:a,showDot:n=!0,capitalize:l=!0,size:i="md",variant:u="outline",customColors:w,icon:m,trueMessage:b="active",falseMessage:p="inactive"})=>{let N=typeof t=="boolean"?t?b:p:typeof t=="number"?t>0?b:p:t.toLowerCase(),O={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},L=O[N.toLowerCase()]||O.inactive,I=w||L[u],P={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},H=l?N.charAt(0).toUpperCase()+N.slice(1):N;return Ge("div",{className:"flex justify-center",children:Oa("span",{className:o("inline-flex items-center gap-1.5 rounded-full border font-medium",I.bg,I.text,I.border,P[i],a),children:[n&&(m?Ge("span",{className:"flex items-center",children:m}):Ge("span",{className:o("size-2 rounded-full",I.dot),"aria-hidden":"true"})),H]})})}};import{AlertTriangleIcon as Er}from"lucide-react";import{useRouteError as Gr,isRouteErrorResponse as jr,useNavigate as $r}from"react-router";import{Fragment as Fo,jsx as ze,jsxs as kt}from"react/jsx-runtime";var _a=()=>{let e=Gr(),t=$r();return ze("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:kt("div",{className:"flex flex-col items-center space-y-4 text-center",children:[ze(Er,{className:"h-16 w-16 text-destructive"}),jr(e)?kt(Fo,{children:[kt("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?kt(Fo,{children:[ze("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&kt("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[ze("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),ze("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):kt(Fo,{children:[ze("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),ze("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),ze(v,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as je}from"framer-motion";import{jsx as W,jsxs as Ce}from"react/jsx-runtime";function Ur({size:e=100,strokeWidth:t=2,color:a="currentColor",className:n=""}){return Ce(je.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[W("title",{children:"Animated Checkmark"}),W(je.circle,{cx:"50",cy:"50",r:"40",stroke:a,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),W(je.path,{d:"M30 50L45 65L70 35",stroke:a,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function Va(){return W(He,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:Ce(Ee,{className:"space-y-4 flex flex-col items-center justify-center",children:[W(je.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:Ce("div",{className:"relative",children:[W(je.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),W(Ur,{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)]"})]})}),Ce(je.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[W(je.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),W("div",{className:"flex items-center gap-4",children:W(je.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:Ce("div",{className:"flex flex-col items-start gap-2",children:[Ce("div",{className:"space-y-1.5",children:[Ce("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ce("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:[W("title",{children:"From"}),W("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),Ce("div",{className:"flex items-center gap-2.5 group transition-all",children:[W("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:"$"}),W("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),W("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),Ce("div",{className:"space-y-1.5",children:[Ce("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ce("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:[W("title",{children:"To"}),W("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),Ce("div",{className:"flex items-center gap-2.5 group transition-all",children:[W("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"}),W("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),W(je.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as ao,jsxs as Wr}from"react/jsx-runtime";var Ha=()=>ao("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:Wr("div",{className:"flex flex-col items-center space-y-4",children:[ao("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),ao("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),ao("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as qr}from"react-router";import{GhostIcon as Jr}from"lucide-react";import{NavLink as Xr,useNavigate as Kr}from"react-router";import{jsx as Rt,jsxs as Bo}from"react/jsx-runtime";var Ea=()=>{let e=qr(),t=Kr(),a=()=>{window.history.length>2?t(-1):t("/")};return Bo("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:[Rt(Jr,{className:"h-15 w-15 text-destructive mb-4"}),Rt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),Bo("p",{className:"text-xl mb-4",children:["The page ",Rt("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),Bo("div",{className:"flex space-x-4",children:[Rt(v,{variant:"outline",onClick:a,children:"Go Back"}),Rt(v,{variant:"ghost",children:Rt(Xr,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as Yr}from"lucide-react";import{jsx as Lo,jsxs as Zr}from"react/jsx-runtime";var Ga=()=>Zr("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:[Lo(Yr,{className:"h-15 w-15 text-destructive mb-4"}),Lo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Lo("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as Qr}from"lucide-react";import{NavLink as ei,useNavigate as ti}from"react-router";import{jsx as Mt,jsxs as ja}from"react/jsx-runtime";var $a=()=>{let e=ti();return ja("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:[Mt(Qr,{className:"h-15 w-15 text-destructive mb-4"}),Mt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),Mt("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."}),ja("div",{className:"flex space-x-4",children:[Mt(v,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),Mt(v,{variant:"ghost",children:Mt(ei,{to:"/",children:"Go to Home"})})]})]})};export{Fr as AppMetaProvider,Va as CurrencyTransfer,ma as DataTable,ua as DataTableActionBar,ga as DataTableActionBarAction,fa as DataTableActionBarSelection,xa as DataTemplate,Ca as DataTemplateActionBar,wa as DataTemplateActionBarAction,Na as DataTemplateActionBarSelection,_a as ErrorComponent,Io as GeneralHelper,Ha as Loader,Ea as NotFound,Ga as OfflineUI,$a as Unauthorized,zr as createLayoutComponents,Or as createPageTemplateHook,Br as createTypedAppMetaContext};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|