@akshar-technosoft/ui 1.0.6 → 1.0.7

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