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