@akshar-technosoft/ui 1.0.24 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/README.md +466 -215
  2. package/dist/components/date-helper.cjs.map +1 -1
  3. package/dist/components/date-helper.d.cts +36 -0
  4. package/dist/components/date-helper.d.ts +36 -0
  5. package/dist/components/date-helper.js.map +1 -1
  6. package/dist/components/general.cjs +1 -1
  7. package/dist/components/general.cjs.map +1 -1
  8. package/dist/components/general.d.cts +25 -0
  9. package/dist/components/general.d.ts +25 -0
  10. package/dist/components/general.js +1 -1
  11. package/dist/components/general.js.map +1 -1
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +817 -28
  15. package/dist/index.d.ts +817 -28
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/lib/utils.cjs.map +1 -1
  19. package/dist/lib/utils.js.map +1 -1
  20. package/package.json +94 -87
  21. package/dist/components/core/error.cjs +0 -3
  22. package/dist/components/core/error.cjs.map +0 -1
  23. package/dist/components/core/error.d.cts +0 -5
  24. package/dist/components/core/error.d.ts +0 -5
  25. package/dist/components/core/error.js +0 -3
  26. package/dist/components/core/error.js.map +0 -1
  27. package/dist/components/core/event-success.cjs +0 -3
  28. package/dist/components/core/event-success.cjs.map +0 -1
  29. package/dist/components/core/event-success.d.cts +0 -5
  30. package/dist/components/core/event-success.d.ts +0 -5
  31. package/dist/components/core/event-success.js +0 -3
  32. package/dist/components/core/event-success.js.map +0 -1
  33. package/dist/components/core/index.cjs +0 -3
  34. package/dist/components/core/index.cjs.map +0 -1
  35. package/dist/components/core/index.d.cts +0 -7
  36. package/dist/components/core/index.d.ts +0 -7
  37. package/dist/components/core/index.js +0 -3
  38. package/dist/components/core/index.js.map +0 -1
  39. package/dist/components/core/loader.cjs +0 -3
  40. package/dist/components/core/loader.cjs.map +0 -1
  41. package/dist/components/core/loader.d.cts +0 -5
  42. package/dist/components/core/loader.d.ts +0 -5
  43. package/dist/components/core/loader.js +0 -3
  44. package/dist/components/core/loader.js.map +0 -1
  45. package/dist/components/core/notfound.cjs +0 -3
  46. package/dist/components/core/notfound.cjs.map +0 -1
  47. package/dist/components/core/notfound.d.cts +0 -5
  48. package/dist/components/core/notfound.d.ts +0 -5
  49. package/dist/components/core/notfound.js +0 -3
  50. package/dist/components/core/notfound.js.map +0 -1
  51. package/dist/components/core/offline-content.cjs +0 -3
  52. package/dist/components/core/offline-content.cjs.map +0 -1
  53. package/dist/components/core/offline-content.d.cts +0 -5
  54. package/dist/components/core/offline-content.d.ts +0 -5
  55. package/dist/components/core/offline-content.js +0 -3
  56. package/dist/components/core/offline-content.js.map +0 -1
  57. package/dist/components/core/unauthorized.cjs +0 -3
  58. package/dist/components/core/unauthorized.cjs.map +0 -1
  59. package/dist/components/core/unauthorized.d.cts +0 -5
  60. package/dist/components/core/unauthorized.d.ts +0 -5
  61. package/dist/components/core/unauthorized.js +0 -3
  62. package/dist/components/core/unauthorized.js.map +0 -1
  63. package/dist/components/data/data-table/data-table-action-bar.cjs +0 -3
  64. package/dist/components/data/data-table/data-table-action-bar.cjs.map +0 -1
  65. package/dist/components/data/data-table/data-table-action-bar.d.cts +0 -26
  66. package/dist/components/data/data-table/data-table-action-bar.d.ts +0 -26
  67. package/dist/components/data/data-table/data-table-action-bar.js +0 -3
  68. package/dist/components/data/data-table/data-table-action-bar.js.map +0 -1
  69. package/dist/components/data/data-table/data-table-column-header.cjs +0 -3
  70. package/dist/components/data/data-table/data-table-column-header.cjs.map +0 -1
  71. package/dist/components/data/data-table/data-table-column-header.d.cts +0 -11
  72. package/dist/components/data/data-table/data-table-column-header.d.ts +0 -11
  73. package/dist/components/data/data-table/data-table-column-header.js +0 -3
  74. package/dist/components/data/data-table/data-table-column-header.js.map +0 -1
  75. package/dist/components/data/data-table/data-table-faceted-filter.cjs +0 -3
  76. package/dist/components/data/data-table/data-table-faceted-filter.cjs.map +0 -1
  77. package/dist/components/data/data-table/data-table-faceted-filter.d.cts +0 -18
  78. package/dist/components/data/data-table/data-table-faceted-filter.d.ts +0 -18
  79. package/dist/components/data/data-table/data-table-faceted-filter.js +0 -3
  80. package/dist/components/data/data-table/data-table-faceted-filter.js.map +0 -1
  81. package/dist/components/data/data-table/data-table-pagination.cjs +0 -3
  82. package/dist/components/data/data-table/data-table-pagination.cjs.map +0 -1
  83. package/dist/components/data/data-table/data-table-pagination.d.cts +0 -12
  84. package/dist/components/data/data-table/data-table-pagination.d.ts +0 -12
  85. package/dist/components/data/data-table/data-table-pagination.js +0 -3
  86. package/dist/components/data/data-table/data-table-pagination.js.map +0 -1
  87. package/dist/components/data/data-table/data-table-toolbar.cjs +0 -3
  88. package/dist/components/data/data-table/data-table-toolbar.cjs.map +0 -1
  89. package/dist/components/data/data-table/data-table-toolbar.d.cts +0 -27
  90. package/dist/components/data/data-table/data-table-toolbar.d.ts +0 -27
  91. package/dist/components/data/data-table/data-table-toolbar.js +0 -3
  92. package/dist/components/data/data-table/data-table-toolbar.js.map +0 -1
  93. package/dist/components/data/data-table/data-table-types.cjs +0 -3
  94. package/dist/components/data/data-table/data-table-types.cjs.map +0 -1
  95. package/dist/components/data/data-table/data-table-types.d.cts +0 -117
  96. package/dist/components/data/data-table/data-table-types.d.ts +0 -117
  97. package/dist/components/data/data-table/data-table-types.js +0 -2
  98. package/dist/components/data/data-table/data-table-types.js.map +0 -1
  99. package/dist/components/data/data-table/data-table-view-options.cjs +0 -3
  100. package/dist/components/data/data-table/data-table-view-options.cjs.map +0 -1
  101. package/dist/components/data/data-table/data-table-view-options.d.cts +0 -9
  102. package/dist/components/data/data-table/data-table-view-options.d.ts +0 -9
  103. package/dist/components/data/data-table/data-table-view-options.js +0 -3
  104. package/dist/components/data/data-table/data-table-view-options.js.map +0 -1
  105. package/dist/components/data/data-table/data-table.cjs +0 -3
  106. package/dist/components/data/data-table/data-table.cjs.map +0 -1
  107. package/dist/components/data/data-table/data-table.d.cts +0 -8
  108. package/dist/components/data/data-table/data-table.d.ts +0 -8
  109. package/dist/components/data/data-table/data-table.js +0 -3
  110. package/dist/components/data/data-table/data-table.js.map +0 -1
  111. package/dist/components/data/data-table/index.cjs +0 -3
  112. package/dist/components/data/data-table/index.cjs.map +0 -1
  113. package/dist/components/data/data-table/index.d.cts +0 -16
  114. package/dist/components/data/data-table/index.d.ts +0 -16
  115. package/dist/components/data/data-table/index.js +0 -3
  116. package/dist/components/data/data-table/index.js.map +0 -1
  117. package/dist/components/data/data-template/data-template-action-bar.cjs +0 -3
  118. package/dist/components/data/data-template/data-template-action-bar.cjs.map +0 -1
  119. package/dist/components/data/data-template/data-template-action-bar.d.cts +0 -14
  120. package/dist/components/data/data-template/data-template-action-bar.d.ts +0 -14
  121. package/dist/components/data/data-template/data-template-action-bar.js +0 -3
  122. package/dist/components/data/data-template/data-template-action-bar.js.map +0 -1
  123. package/dist/components/data/data-template/data-template-pagination.cjs +0 -3
  124. package/dist/components/data/data-template/data-template-pagination.cjs.map +0 -1
  125. package/dist/components/data/data-template/data-template-pagination.d.cts +0 -17
  126. package/dist/components/data/data-template/data-template-pagination.d.ts +0 -17
  127. package/dist/components/data/data-template/data-template-pagination.js +0 -3
  128. package/dist/components/data/data-template/data-template-pagination.js.map +0 -1
  129. package/dist/components/data/data-template/data-template-toolbar.cjs +0 -3
  130. package/dist/components/data/data-template/data-template-toolbar.cjs.map +0 -1
  131. package/dist/components/data/data-template/data-template-toolbar.d.cts +0 -27
  132. package/dist/components/data/data-template/data-template-toolbar.d.ts +0 -27
  133. package/dist/components/data/data-template/data-template-toolbar.js +0 -3
  134. package/dist/components/data/data-template/data-template-toolbar.js.map +0 -1
  135. package/dist/components/data/data-template/data-template-types.cjs +0 -3
  136. package/dist/components/data/data-template/data-template-types.cjs.map +0 -1
  137. package/dist/components/data/data-template/data-template-types.d.cts +0 -107
  138. package/dist/components/data/data-template/data-template-types.d.ts +0 -107
  139. package/dist/components/data/data-template/data-template-types.js +0 -2
  140. package/dist/components/data/data-template/data-template-types.js.map +0 -1
  141. package/dist/components/data/data-template/data-template.cjs +0 -3
  142. package/dist/components/data/data-template/data-template.cjs.map +0 -1
  143. package/dist/components/data/data-template/data-template.d.cts +0 -8
  144. package/dist/components/data/data-template/data-template.d.ts +0 -8
  145. package/dist/components/data/data-template/data-template.js +0 -3
  146. package/dist/components/data/data-template/data-template.js.map +0 -1
  147. package/dist/components/data/data-template/index.cjs +0 -3
  148. package/dist/components/data/data-template/index.cjs.map +0 -1
  149. package/dist/components/data/data-template/index.d.cts +0 -8
  150. package/dist/components/data/data-template/index.d.ts +0 -8
  151. package/dist/components/data/data-template/index.js +0 -3
  152. package/dist/components/data/data-template/index.js.map +0 -1
  153. package/dist/components/helper/date-filter.cjs +0 -3
  154. package/dist/components/helper/date-filter.cjs.map +0 -1
  155. package/dist/components/helper/date-filter.d.cts +0 -14
  156. package/dist/components/helper/date-filter.d.ts +0 -14
  157. package/dist/components/helper/date-filter.js +0 -3
  158. package/dist/components/helper/date-filter.js.map +0 -1
  159. package/dist/components/layouts/app-container.cjs +0 -3
  160. package/dist/components/layouts/app-container.cjs.map +0 -1
  161. package/dist/components/layouts/app-container.d.cts +0 -13
  162. package/dist/components/layouts/app-container.d.ts +0 -13
  163. package/dist/components/layouts/app-container.js +0 -3
  164. package/dist/components/layouts/app-container.js.map +0 -1
  165. package/dist/components/layouts/app-content.cjs +0 -3
  166. package/dist/components/layouts/app-content.cjs.map +0 -1
  167. package/dist/components/layouts/app-content.d.cts +0 -45
  168. package/dist/components/layouts/app-content.d.ts +0 -45
  169. package/dist/components/layouts/app-content.js +0 -3
  170. package/dist/components/layouts/app-content.js.map +0 -1
  171. package/dist/components/layouts/app-footer.cjs +0 -3
  172. package/dist/components/layouts/app-footer.cjs.map +0 -1
  173. package/dist/components/layouts/app-footer.d.cts +0 -18
  174. package/dist/components/layouts/app-footer.d.ts +0 -18
  175. package/dist/components/layouts/app-footer.js +0 -3
  176. package/dist/components/layouts/app-footer.js.map +0 -1
  177. package/dist/components/layouts/app-header.cjs +0 -3
  178. package/dist/components/layouts/app-header.cjs.map +0 -1
  179. package/dist/components/layouts/app-header.d.cts +0 -19
  180. package/dist/components/layouts/app-header.d.ts +0 -19
  181. package/dist/components/layouts/app-header.js +0 -3
  182. package/dist/components/layouts/app-header.js.map +0 -1
  183. package/dist/components/layouts/factories.cjs +0 -3
  184. package/dist/components/layouts/factories.cjs.map +0 -1
  185. package/dist/components/layouts/factories.d.cts +0 -18
  186. package/dist/components/layouts/factories.d.ts +0 -18
  187. package/dist/components/layouts/factories.js +0 -3
  188. package/dist/components/layouts/factories.js.map +0 -1
  189. package/dist/components/layouts/index.cjs +0 -3
  190. package/dist/components/layouts/index.cjs.map +0 -1
  191. package/dist/components/layouts/index.d.cts +0 -8
  192. package/dist/components/layouts/index.d.ts +0 -8
  193. package/dist/components/layouts/index.js +0 -3
  194. package/dist/components/layouts/index.js.map +0 -1
  195. package/dist/components/ui/badge.cjs +0 -3
  196. package/dist/components/ui/badge.cjs.map +0 -1
  197. package/dist/components/ui/badge.d.cts +0 -13
  198. package/dist/components/ui/badge.d.ts +0 -13
  199. package/dist/components/ui/badge.js +0 -3
  200. package/dist/components/ui/badge.js.map +0 -1
  201. package/dist/components/ui/button.cjs +0 -3
  202. package/dist/components/ui/button.cjs.map +0 -1
  203. package/dist/components/ui/button.d.cts +0 -14
  204. package/dist/components/ui/button.d.ts +0 -14
  205. package/dist/components/ui/button.js +0 -3
  206. package/dist/components/ui/button.js.map +0 -1
  207. package/dist/components/ui/calendar.cjs +0 -3
  208. package/dist/components/ui/calendar.cjs.map +0 -1
  209. package/dist/components/ui/calendar.d.cts +0 -13
  210. package/dist/components/ui/calendar.d.ts +0 -13
  211. package/dist/components/ui/calendar.js +0 -3
  212. package/dist/components/ui/calendar.js.map +0 -1
  213. package/dist/components/ui/card.cjs +0 -3
  214. package/dist/components/ui/card.cjs.map +0 -1
  215. package/dist/components/ui/card.d.cts +0 -12
  216. package/dist/components/ui/card.d.ts +0 -12
  217. package/dist/components/ui/card.js +0 -3
  218. package/dist/components/ui/card.js.map +0 -1
  219. package/dist/components/ui/checkbox.cjs +0 -3
  220. package/dist/components/ui/checkbox.cjs.map +0 -1
  221. package/dist/components/ui/checkbox.d.cts +0 -7
  222. package/dist/components/ui/checkbox.d.ts +0 -7
  223. package/dist/components/ui/checkbox.js +0 -3
  224. package/dist/components/ui/checkbox.js.map +0 -1
  225. package/dist/components/ui/command.cjs +0 -3
  226. package/dist/components/ui/command.cjs.map +0 -1
  227. package/dist/components/ui/command.d.cts +0 -20
  228. package/dist/components/ui/command.d.ts +0 -20
  229. package/dist/components/ui/command.js +0 -3
  230. package/dist/components/ui/command.js.map +0 -1
  231. package/dist/components/ui/dialog.cjs +0 -3
  232. package/dist/components/ui/dialog.cjs.map +0 -1
  233. package/dist/components/ui/dialog.d.cts +0 -16
  234. package/dist/components/ui/dialog.d.ts +0 -16
  235. package/dist/components/ui/dialog.js +0 -3
  236. package/dist/components/ui/dialog.js.map +0 -1
  237. package/dist/components/ui/dropdown-menu.cjs +0 -3
  238. package/dist/components/ui/dropdown-menu.cjs.map +0 -1
  239. package/dist/components/ui/dropdown-menu.d.cts +0 -28
  240. package/dist/components/ui/dropdown-menu.d.ts +0 -28
  241. package/dist/components/ui/dropdown-menu.js +0 -3
  242. package/dist/components/ui/dropdown-menu.js.map +0 -1
  243. package/dist/components/ui/input.cjs +0 -3
  244. package/dist/components/ui/input.cjs.map +0 -1
  245. package/dist/components/ui/input.d.cts +0 -6
  246. package/dist/components/ui/input.d.ts +0 -6
  247. package/dist/components/ui/input.js +0 -3
  248. package/dist/components/ui/input.js.map +0 -1
  249. package/dist/components/ui/popover.cjs +0 -3
  250. package/dist/components/ui/popover.cjs.map +0 -1
  251. package/dist/components/ui/popover.d.cts +0 -10
  252. package/dist/components/ui/popover.d.ts +0 -10
  253. package/dist/components/ui/popover.js +0 -3
  254. package/dist/components/ui/popover.js.map +0 -1
  255. package/dist/components/ui/select.cjs +0 -3
  256. package/dist/components/ui/select.cjs.map +0 -1
  257. package/dist/components/ui/select.d.cts +0 -18
  258. package/dist/components/ui/select.d.ts +0 -18
  259. package/dist/components/ui/select.js +0 -3
  260. package/dist/components/ui/select.js.map +0 -1
  261. package/dist/components/ui/separator.cjs +0 -3
  262. package/dist/components/ui/separator.cjs.map +0 -1
  263. package/dist/components/ui/separator.d.cts +0 -7
  264. package/dist/components/ui/separator.d.ts +0 -7
  265. package/dist/components/ui/separator.js +0 -3
  266. package/dist/components/ui/separator.js.map +0 -1
  267. package/dist/components/ui/sheet.cjs +0 -3
  268. package/dist/components/ui/sheet.cjs.map +0 -1
  269. package/dist/components/ui/sheet.d.cts +0 -18
  270. package/dist/components/ui/sheet.d.ts +0 -18
  271. package/dist/components/ui/sheet.js +0 -3
  272. package/dist/components/ui/sheet.js.map +0 -1
  273. package/dist/components/ui/table.cjs +0 -3
  274. package/dist/components/ui/table.cjs.map +0 -1
  275. package/dist/components/ui/table.d.cts +0 -13
  276. package/dist/components/ui/table.d.ts +0 -13
  277. package/dist/components/ui/table.js +0 -3
  278. package/dist/components/ui/table.js.map +0 -1
  279. package/dist/components/ui/toggle.cjs +0 -3
  280. package/dist/components/ui/toggle.cjs.map +0 -1
  281. package/dist/components/ui/toggle.d.cts +0 -16
  282. package/dist/components/ui/toggle.d.ts +0 -16
  283. package/dist/components/ui/toggle.js +0 -3
  284. package/dist/components/ui/toggle.js.map +0 -1
  285. package/dist/components/ui/tooltip.cjs +0 -3
  286. package/dist/components/ui/tooltip.cjs.map +0 -1
  287. package/dist/components/ui/tooltip.d.cts +0 -10
  288. package/dist/components/ui/tooltip.d.ts +0 -10
  289. package/dist/components/ui/tooltip.js +0 -3
  290. package/dist/components/ui/tooltip.js.map +0 -1
  291. package/dist/context/app-meta/context.cjs +0 -3
  292. package/dist/context/app-meta/context.cjs.map +0 -1
  293. package/dist/context/app-meta/context.d.cts +0 -18
  294. package/dist/context/app-meta/context.d.ts +0 -18
  295. package/dist/context/app-meta/context.js +0 -3
  296. package/dist/context/app-meta/context.js.map +0 -1
  297. package/dist/context/app-meta/hooks.cjs +0 -3
  298. package/dist/context/app-meta/hooks.cjs.map +0 -1
  299. package/dist/context/app-meta/hooks.d.cts +0 -10
  300. package/dist/context/app-meta/hooks.d.ts +0 -10
  301. package/dist/context/app-meta/hooks.js +0 -3
  302. package/dist/context/app-meta/hooks.js.map +0 -1
  303. package/dist/context/app-meta/index.cjs +0 -3
  304. package/dist/context/app-meta/index.cjs.map +0 -1
  305. package/dist/context/app-meta/index.d.cts +0 -5
  306. package/dist/context/app-meta/index.d.ts +0 -5
  307. package/dist/context/app-meta/index.js +0 -3
  308. package/dist/context/app-meta/index.js.map +0 -1
  309. package/dist/context/app-meta/types.cjs +0 -3
  310. package/dist/context/app-meta/types.cjs.map +0 -1
  311. package/dist/context/app-meta/types.d.cts +0 -48
  312. package/dist/context/app-meta/types.d.ts +0 -48
  313. package/dist/context/app-meta/types.js +0 -2
  314. package/dist/context/app-meta/types.js.map +0 -1
  315. package/dist/context/index.cjs +0 -3
  316. package/dist/context/index.cjs.map +0 -1
  317. package/dist/context/index.d.cts +0 -5
  318. package/dist/context/index.d.ts +0 -5
  319. package/dist/context/index.js +0 -3
  320. package/dist/context/index.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client"
2
- "use strict";var Mn=Object.create;var mo=Object.defineProperty;var zn=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty;var Bn=(e,t)=>{for(var a in t)mo(e,a,{get:t[a],enumerable:!0})},ga=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of An(t))!Fn.call(e,d)&&d!==a&&mo(e,d,{get:()=>t[d],enumerable:!(r=zn(t,d))||r.enumerable});return e};var Dt=(e,t,a)=>(a=e!=null?Mn(In(e)):{},ga(t||!e||!e.__esModule?mo(a,"default",{value:e,enumerable:!0}):a,e)),Ln=e=>ga(mo({},"__esModule",{value:!0}),e);var Qn={};Bn(Qn,{AppMetaProvider:()=>ln,CurrencyTransfer:()=>aa,DataTable:()=>Go,DataTableActionBar:()=>jo,DataTableActionBarAction:()=>$o,DataTableActionBarSelection:()=>Uo,DataTemplate:()=>Xo,DataTemplateActionBar:()=>Ko,DataTemplateActionBarAction:()=>Yo,DataTemplateActionBarSelection:()=>Zo,ErrorComponent:()=>oa,GeneralHelper:()=>No,Loader:()=>na,NotFound:()=>ra,OfflineUI:()=>ia,Unauthorized:()=>sa,createLayoutComponents:()=>sn,createPageTemplateHook:()=>cn,createTypedAppMetaContext:()=>dn});module.exports=Ln(Qn);var Se=require("@tanstack/react-table"),Q=require("lucide-react");var va=require("radix-ui"),ha=require("class-variance-authority");var fa=require("clsx"),ba=require("tailwind-merge");function o(...e){return(0,ba.twMerge)((0,fa.clsx)(e))}var xa=require("react/jsx-runtime"),po=(0,ha.cva)("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 h({className:e,variant:t,size:a,asChild:r=!1,...d}){let l=r?va.Slot.Slot:"button";return(0,xa.jsx)(l,{"data-slot":"button",className:o(po({variant:t,size:a,className:e}),"transition-none"),...d})}var qe=require("react/jsx-runtime");function Mo({className:e,...t}){return(0,qe.jsx)("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:(0,qe.jsx)("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function ya({className:e,...t}){return(0,qe.jsx)("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function Ca({className:e,...t}){return(0,qe.jsx)("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function zo({className:e,...t}){return(0,qe.jsx)("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Je({className:e,...t}){return(0,qe.jsx)("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function wa({className:e,...t}){return(0,qe.jsx)("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Xe({className:e,...t}){return(0,qe.jsx)("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}var Ao=require("react/jsx-runtime");function Ke({className:e,...t}){return(0,Ao.jsx)("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 Ye({className:e,...t}){return(0,Ao.jsx)("div",{"data-slot":"card-content",className:o("px-6",e),...t})}var bt=require("radix-ui");var Ze=require("react/jsx-runtime");function vt({delayDuration:e=0,...t}){return(0,Ze.jsx)(bt.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function it({...e}){return(0,Ze.jsx)(vt,{children:(0,Ze.jsx)(bt.Tooltip.Root,{"data-slot":"tooltip",...e})})}function st({...e}){return(0,Ze.jsx)(bt.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function lt({className:e,sideOffset:t=0,children:a,...r}){return(0,Ze.jsx)(bt.Tooltip.Portal,{children:(0,Ze.jsxs)(bt.Tooltip.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),...r,children:[a,(0,Ze.jsx)(bt.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var V=require("lucide-react");var Na=require("react/jsx-runtime");function Rt({className:e,type:t,...a}){return(0,Na.jsx)("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})}var ht=require("cmdk"),Sa=require("lucide-react");var On=require("radix-ui"),_n=require("lucide-react");var Ta=require("react/jsx-runtime");var $e=require("react/jsx-runtime");function Io({className:e,...t}){return(0,$e.jsx)(ht.Command,{"data-slot":"command",className:o("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Fo({className:e,...t}){return(0,$e.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,$e.jsx)(Sa.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),(0,$e.jsx)(ht.Command.Input,{"data-slot":"command-input",className:o("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Bo({className:e,...t}){return(0,$e.jsx)(ht.Command.List,{"data-slot":"command-list",className:o("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Lo({...e}){return(0,$e.jsx)(ht.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Oo({className:e,...t}){return(0,$e.jsx)(ht.Command.Group,{"data-slot":"command-group",className:o("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function uo({className:e,...t}){return(0,$e.jsx)(ht.Command.Item,{"data-slot":"command-item",className:o("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var we=require("radix-ui"),qt=require("lucide-react");var se=require("react/jsx-runtime");function Le({...e}){return(0,se.jsx)(we.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function Oe({...e}){return(0,se.jsx)(we.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function _e({className:e,sideOffset:t=4,...a}){return(0,se.jsx)(we.DropdownMenu.Portal,{children:(0,se.jsx)(we.DropdownMenu.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 _o({...e}){return(0,se.jsx)(we.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function re({className:e,inset:t,variant:a="default",...r}){return(0,se.jsx)(we.DropdownMenu.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),...r})}function Jt({className:e,children:t,checked:a,...r}){return(0,se.jsxs)(we.DropdownMenu.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,...r,children:[(0,se.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,se.jsx)(we.DropdownMenu.ItemIndicator,{children:(0,se.jsx)(qt.CheckIcon,{className:"size-4"})})}),t]})}function he({className:e,inset:t,...a}){return(0,se.jsx)(we.DropdownMenu.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 Ne({className:e,...t}){return(0,se.jsx)(we.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function Pa({...e}){return(0,se.jsx)(we.DropdownMenu.Sub,{"data-slot":"dropdown-menu-sub",...e})}function ka({className:e,inset:t,children:a,...r}){return(0,se.jsxs)(we.DropdownMenu.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...r,children:[a,(0,se.jsx)(qt.ChevronRightIcon,{className:"ml-auto size-4"})]})}function Da({className:e,...t}){return(0,se.jsx)(we.DropdownMenu.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var bo=require("react");var At=require("react"),Ma=require("lucide-react"),zt=require("date-fns");var Xt=require("radix-ui");var Kt=require("react/jsx-runtime");function Yt({...e}){return(0,Kt.jsx)(Xt.Popover.Root,{"data-slot":"popover",...e})}function Zt({...e}){return(0,Kt.jsx)(Xt.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function Qt({className:e,align:t="center",sideOffset:a=4,...r}){return(0,Kt.jsx)(Xt.Popover.Portal,{children:(0,Kt.jsx)(Xt.Popover.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),...r})})}var go=Dt(require("react"),1),Mt=require("lucide-react"),eo=require("react-day-picker");var Qe=require("react/jsx-runtime");function Ra({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:r="label",buttonVariant:d="ghost",formatters:l,components:g,...N}){let p=(0,eo.getDefaultClassNames)();return(0,Qe.jsx)(eo.DayPicker,{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:r,formatters:{formatMonthDropdown:v=>v.toLocaleString("default",{month:"short"}),...l},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(po({variant:d}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",p.button_previous),button_next:o(po({variant:d}),"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",r==="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:v,rootRef:u,...S})=>(0,Qe.jsx)("div",{"data-slot":"calendar",ref:u,className:o(v),...S}),Chevron:({className:v,orientation:u,...S})=>u==="left"?(0,Qe.jsx)(Mt.ChevronLeftIcon,{className:o("size-4",v),...S}):u==="right"?(0,Qe.jsx)(Mt.ChevronRightIcon,{className:o("size-4",v),...S}):(0,Qe.jsx)(Mt.ChevronDownIcon,{className:o("size-4",v),...S}),DayButton:Vn,WeekNumber:({children:v,...u})=>(0,Qe.jsx)("td",{...u,children:(0,Qe.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:v})}),...g},...N})}function Vn({className:e,day:t,modifiers:a,...r}){let d=(0,eo.getDefaultClassNames)(),l=go.useRef(null);return go.useEffect(()=>{a.focused&&l.current?.focus()},[a.focused]),(0,Qe.jsx)(h,{ref:l,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",d.day,e),...r})}var Te=require("react/jsx-runtime");function za({value:e,onChange:t,placeholder:a,mode:r,externalSearch:d,onExternalChange:l,onlyExternal:g=!1}){let[N,p]=(0,At.useState)(!1),[v,u]=(0,At.useState)(e),[S,E]=(0,At.useState)(e);(0,At.useEffect)(()=>{g||E(e)},[e,g]);let O=()=>{g||t(v),E(v),d&&l&&l(v),p(!1)},F=()=>{u(S),p(!1)},k=()=>{let P=r==="single"?null:{from:null,to:null};u(P),g||t(P),E(P),d&&l&&l(P),p(!1)},G=()=>{let P=g?S:e;return P?r==="single"?(0,zt.format)(P,"PPP"):P.from&&P.to?`${(0,zt.format)(P.from,"MMM dd")} - ${(0,zt.format)(P.to,"MMM dd, yyyy")}`:P.from?`From ${(0,zt.format)(P.from,"MMM dd, yyyy")}`:P.to?`To ${(0,zt.format)(P.to,"MMM dd, yyyy")}`:a:a},U=P=>{u(r==="single"?P:P||{from:null,to:null})};return(0,Te.jsxs)(Yt,{open:N,onOpenChange:p,children:[(0,Te.jsx)(Zt,{className:"h-8",asChild:!0,children:(0,Te.jsxs)(h,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!G()&&"text-muted-foreground"),children:[(0,Te.jsx)(Ma.Calendar,{className:"mr-2 h-4 w-4"}),G()]})}),(0,Te.jsxs)(Qt,{className:"w-auto p-0",align:"start",children:[(0,Te.jsx)("div",{className:"p-3",children:(0,Te.jsx)(Ra,{mode:r,selected:v,onSelect:U,numberOfMonths:r==="range"?2:1,className:"rounded-md border",...r==="range"&&{required:!0}})}),(0,Te.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,Te.jsx)(h,{variant:"ghost",size:"sm",onClick:k,children:"Clear"}),(0,Te.jsxs)("div",{className:"flex gap-2",children:[(0,Te.jsx)(h,{variant:"outline",size:"sm",onClick:F,children:"Cancel"}),(0,Te.jsx)(h,{size:"sm",onClick:O,disabled:r==="range"&&(!v?.from||!v?.to),children:"Apply"})]})]})]})]})}var Vo=require("radix-ui"),Aa=require("lucide-react");var fo=require("react/jsx-runtime");function xt({className:e,...t}){return(0,fo.jsx)(Vo.Checkbox.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:(0,fo.jsx)(Vo.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,fo.jsx)(Aa.CheckIcon,{className:"size-3.5"})})})}var i=require("react/jsx-runtime"),Ia=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function Ho({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:r,enableGlobalFilter:d=!0,onExport:l,onRefresh:g,loading:N=!1,enableColumnVisibility:p=!0,data:v,onClearSorting:u,onClearFilters:S,enableColumnPinning:E=!1,onExternalSearch:O,onCustomFilterChange:F,aggregations:k={},onAggregationChange:G}){let[U,P]=(0,bo.useState)({}),[ae,w]=(0,bo.useState)({}),[j,Ie]=(0,bo.useState)({}),Re=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),ge=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(f=>f.getCanHide?.()!==!1)),et=()=>{let n=new Set(ge().flatMap(f=>f.columns?.filter(x=>x.getCanHide?.()!==!1).map(x=>x.id)||[]));return Re().filter(f=>!n.has(f.id))},Me=(n,f)=>f&&n.startsWith(`${f}.`)?n.replace(`${f}.`,"").split("_").map(q=>q.slice(1)).join(" "):n.split("_").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" "),le=(n,f)=>{let x={...U,[n]:f};P(x)},tt=(n,f)=>{let x={...ae,[n]:f};w(x),F&&F(n,f),t.find(q=>q.key===n)?.externalSearch&&le(n,f)},fe=()=>{O&&O(U)},ze=()=>{P({}),w({}),S(),O&&O({}),F&&Object.keys(ae).forEach(n=>{F(n,"")})},Pe=n=>t.find(x=>x.key===n)?.customFilter?ae[n]??"":e.getColumn(n)?.getFilterValue(),xe=(n,f)=>{let x=t.find(q=>q.key===n);x?.customFilter?tt(n,f):(e.getColumn(n)?.setFilterValue(f),x?.externalSearch&&le(n,f))},ot=(n,f)=>{Ie(x=>({...x,[n]:f}))},Ee=n=>{if(G){let f=k[n],x={enabled:!f?.enabled,functions:f?.functions||["sum","average"]};G(n,x)}},at=(n,f)=>{if(G){let q=k[n]?.functions||[],de=q.includes(f)?q.filter(jt=>jt!==f):[...q,f];G(n,{enabled:de.length>0,functions:de})}},Ge=()=>{G&&Object.keys(k).forEach(n=>{let f=k[n];f&&G(n,{...f,enabled:!1,functions:[]})})},ye=Re().filter(n=>n.id==="select"||n.id==="serialNumber"?!1:n.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(q=>{let de=q.getValue(n.id);return typeof de=="number"||typeof de=="string"&&!isNaN(parseFloat(String(de)))||typeof de=="object"&&de!==null&&"props"in de})),Ce=Object.values(k).some(n=>n?.enabled);return(0,i.jsx)("div",{className:"rounded-xl",children:(0,i.jsx)("div",{className:"px-2",children:(0,i.jsx)("div",{className:"flex flex-col gap-6",children:(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,i.jsx)(V.Filter,{className:"size-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:(0,i.jsx)("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?(0,i.jsxs)(Yt,{open:j[n.key],onOpenChange:x=>ot(n.key,x),children:[(0,i.jsx)(Zt,{asChild:!0,children:(0,i.jsxs)("div",{className:"relative w-full",children:[n.icon&&(0,i.jsx)(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),(0,i.jsxs)(h,{variant:"outline",role:"combobox","aria-expanded":j[n.key],className:o("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!Pe(n.key)&&"text-muted-foreground"),children:[(0,i.jsx)("span",{className:o("truncate",n.icon&&"pl-6"),children:Pe(n.key)?n.options?.find(x=>x.value===Pe(n.key))?.label:n.placeholder}),(0,i.jsx)(V.ChevronDown,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),(0,i.jsx)(Qt,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:(0,i.jsxs)(Io,{className:"rounded-lg",children:[(0,i.jsx)(Fo,{placeholder:`Search ${n.placeholder?.toLowerCase()}...`}),(0,i.jsxs)(Bo,{children:[(0,i.jsx)(Lo,{children:"No option found."}),(0,i.jsxs)(Oo,{children:[(0,i.jsxs)(uo,{value:"all",onSelect:()=>{xe(n.key,""),ot(n.key,!1)},className:"flex items-center cursor-pointer",children:[(0,i.jsx)(V.Check,{className:o("mr-2 size-4 shrink-0",Pe(n.key)?"opacity-0":"opacity-100")}),(0,i.jsx)("span",{children:"All"})]}),n.options?.map(x=>(0,i.jsxs)(uo,{value:x.label,onSelect:()=>{xe(n.key,x.value),ot(n.key,!1)},className:"flex items-center cursor-pointer",children:[(0,i.jsx)(V.Check,{className:o("mr-2 size-4 shrink-0",Pe(n.key)===x.value?"opacity-100":"opacity-0")}),(0,i.jsx)("span",{children:x.label})]},x.label))]})]})]})})]}):n.type==="date"?(0,i.jsx)(za,{value:Pe(n.key),onChange:x=>{n.onlyExternal||xe(n.key,x)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:x=>le(n.key,x)}):(0,i.jsxs)("div",{className:"relative",children:[n.icon&&(0,i.jsx)(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,i.jsx)(Rt,{placeholder:n.placeholder,value:Pe(n.key)??"",onChange:x=>{xe(n.key,x.target.value)},className:o("h-8 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&(0,i.jsxs)(h,{variant:"default",size:"sm",onClick:fe,className:"rounded-lg h-7",children:[(0,i.jsx)(V.Search,{className:"size-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[d&&(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)(V.Search,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,i.jsx)(Rt,{placeholder:"Global search...",value:a??"",onChange:n=>r(n.target.value),className:"pl-9 h-8 max-w-max"})]}),ye.length>0&&G&&(0,i.jsxs)(Le,{children:[(0,i.jsx)(Oe,{asChild:!0,children:(0,i.jsxs)(h,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",Ce&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[(0,i.jsx)(V.Calculator,{className:"size-4"}),(0,i.jsx)("span",{children:"Aggregations"}),(0,i.jsx)(V.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,i.jsxs)(_e,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[(0,i.jsxs)(he,{className:"flex items-center justify-between px-4 py-2",children:[(0,i.jsx)("span",{className:"text-sm font-medium",children:"Column Aggregations"}),Ce&&(0,i.jsx)(h,{variant:"ghost",size:"sm",onClick:Ge,className:"h-6 px-2 text-xs",children:"Clear All"})]}),(0,i.jsx)(Ne,{}),ye.map(n=>{let f=k[n.id],x=f?.enabled;return(0,i.jsxs)(Pa,{children:[(0,i.jsx)(ka,{className:"text-sm",children:(0,i.jsxs)("div",{className:"flex items-center w-full gap-2",children:[(0,i.jsx)(xt,{checked:x,onCheckedChange:()=>Ee(n.id),className:"data-[state=checked]:bg-primary"}),(0,i.jsx)("span",{className:o("flex-1",x&&"font-medium text-primary"),children:Me(n.id)}),x&&(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[f?.functions?.slice(0,2).map(q=>(0,i.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary",title:Ia.find(de=>de.value===q)?.label},q)),f?.functions&&f.functions.length>2&&(0,i.jsxs)("div",{className:"text-xs text-muted-foreground",children:["+",f.functions.length-2]})]})]})}),(0,i.jsxs)(Da,{className:"w-48 rounded-lg",children:[(0,i.jsx)(he,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),Ia.map(q=>(0,i.jsx)(Jt,{checked:f?.functions?.includes(q.value)||!1,onCheckedChange:()=>at(n.id,q.value),className:"py-2 text-sm",children:(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsx)("span",{children:q.label}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:q.description})]})},q.value))]})]},n.id)}),ye.length===0&&(0,i.jsxs)("div",{className:"px-3 py-4 text-center",children:[(0,i.jsx)(V.Calculator,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),l&&(0,i.jsxs)(h,{variant:"outline",size:"sm",onClick:()=>l(v),className:"rounded-lg",children:[(0,i.jsx)(V.Download,{className:"size-4"}),"Export"]}),p&&(0,i.jsxs)(Le,{children:[(0,i.jsx)(Oe,{asChild:!0,className:"h-7",children:(0,i.jsxs)(h,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,i.jsx)("span",{children:"Columns"}),(0,i.jsx)(V.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,i.jsxs)(_e,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,i.jsx)(he,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,i.jsx)(Ne,{}),et().length>0&&(0,i.jsxs)(_o,{children:[(0,i.jsx)(he,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),et().map(n=>(0,i.jsx)(Jt,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:f=>n.toggleVisibility(!!f),children:Me(n.id)},n.id))]}),ge().map(n=>(0,i.jsxs)(_o,{children:[(0,i.jsx)(Ne,{}),(0,i.jsx)(he,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(f=>f.getCanHide?.()!==!1).map(f=>(0,i.jsx)(Jt,{className:"text-sm",checked:f.getIsVisible(),onCheckedChange:x=>f.toggleVisibility(!!x),children:Me(f.id,n.id)},f.id))]},n.id))]})]}),(0,i.jsxs)(Le,{children:[(0,i.jsx)(Oe,{asChild:!0,className:"h-7",children:(0,i.jsx)(h,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:(0,i.jsx)(V.Settings2,{className:"size-4"})})}),(0,i.jsxs)(_e,{align:"end",className:"w-[200px] rounded-lg",children:[(0,i.jsx)(he,{children:"Table Settings"}),(0,i.jsx)(Ne,{}),(0,i.jsxs)(re,{onClick:u,children:[(0,i.jsx)(V.ArrowUpDown,{className:"size-4"}),"Clear All Sorting"]}),(0,i.jsxs)(re,{onClick:ze,children:[(0,i.jsx)(V.Filter,{className:"size-4"}),"Clear All Filters"]}),Ce&&(0,i.jsxs)(re,{onClick:Ge,children:[(0,i.jsx)(V.Calculator,{className:"size-4"}),"Clear Aggregations"]}),E&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Ne,{}),(0,i.jsx)(he,{children:"Column Pinning"}),(0,i.jsxs)(re,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,i.jsx)(V.PinOff,{className:"size-4"}),"Reset All Pinning"]}),(0,i.jsxs)(re,{onClick:()=>{let n=Re().filter(f=>f.getCanPin?.()!==!1).map(f=>f.id);e.setColumnPinning({left:[],right:n})},children:[(0,i.jsx)(V.Pin,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),g&&(0,i.jsx)(h,{variant:"outline",size:"sm",onClick:g,disabled:N,className:"rounded-lg",children:(0,i.jsx)(V.RefreshCw,{className:o("h-4 w-4",N&&"animate-spin")})})]})]})})})})}var ke=require("radix-ui"),yt=require("lucide-react");var oe=require("react/jsx-runtime");function It({...e}){return(0,oe.jsx)(ke.Select.Root,{"data-slot":"select",...e})}function Ft({...e}){return(0,oe.jsx)(ke.Select.Value,{"data-slot":"select-value",...e})}function Bt({className:e,size:t="default",children:a,...r}){return(0,oe.jsxs)(ke.Select.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),...r,children:[a,(0,oe.jsx)(ke.Select.Icon,{asChild:!0,children:(0,oe.jsx)(yt.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Lt({className:e,children:t,position:a="popper",...r}){return(0,oe.jsx)(ke.Select.Portal,{children:(0,oe.jsxs)(ke.Select.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,...r,children:[(0,oe.jsx)(Hn,{}),(0,oe.jsx)(ke.Select.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}),(0,oe.jsx)(En,{})]})})}function Ct({className:e,children:t,...a}){return(0,oe.jsxs)(ke.Select.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:[(0,oe.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,oe.jsx)(ke.Select.ItemIndicator,{children:(0,oe.jsx)(yt.CheckIcon,{className:"size-4"})})}),(0,oe.jsx)(ke.Select.ItemText,{children:t})]})}function Hn({className:e,...t}){return(0,oe.jsx)(ke.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:(0,oe.jsx)(yt.ChevronUpIcon,{className:"size-4"})})}function En({className:e,...t}){return(0,oe.jsx)(ke.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:(0,oe.jsx)(yt.ChevronDownIcon,{className:"size-4"})})}var Z=require("react/jsx-runtime");function Eo({table:e,config:t}){return t.enabled?(0,Z.jsx)("div",{className:"rounded-xl",children:(0,Z.jsx)("div",{children:(0,Z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Z.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,Z.jsxs)("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"]})}),(0,Z.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,Z.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Z.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,Z.jsxs)(It,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[(0,Z.jsx)(Bt,{className:"h-9 w-[70px] rounded-lg",children:(0,Z.jsx)(Ft,{})}),(0,Z.jsx)(Lt,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>(0,Z.jsx)(Ct,{value:`${a}`,children:a},a))})]})]}),(0,Z.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Z.jsx)(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,Z.jsx)(h,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,Z.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,r)=>{let d=e.getState().pagination.pageIndex,l=d+r;return l<1||l>e.getPageCount()?null:(0,Z.jsx)(h,{variant:l===d+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(l-1),children:l},l)})}),(0,Z.jsx)(h,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,Z.jsx)(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Fa=require("radix-ui"),Ba=require("class-variance-authority");var Oa=require("react/jsx-runtime"),Gn=(0,Ba.cva)("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 La({className:e,variant:t,size:a,noBg:r,...d}){return(0,Oa.jsx)(Fa.Toggle.Root,{"data-slot":"toggle",className:o(Gn({className:e,variant:t,size:a,bg:r?"disabled":"enabled"})),...d})}var z=require("react"),s=require("react/jsx-runtime"),_a={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((r,d)=>r-d),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function Go({data:e,columns:t,filters:a=[],pagination:r={enabled:!1},settings:d={},header:l,footer:g,className:N="",maxHeight:p="100%",loading:v=!1,error:u,emptyMessage:S="No data available",onRowSelectionChange:E,onExport:O,onRefresh:F,onTableReady:k,children:G,isRowDisabled:U,isRowSelectable:P,onExternalSearch:ae,aggregations:w={},onAggregationChange:j,rowClassName:Ie}){let[Re,ge]=(0,z.useState)([]),[et,Me]=(0,z.useState)([]),[le,tt]=(0,z.useState)({}),[fe,ze]=(0,z.useState)({}),[Pe,xe]=(0,z.useState)(""),[ot,Ee]=(0,z.useState)([]),[at,Ge]=(0,z.useState)(d.enableColumnPinning?{left:[],right:[]}:{}),[ut,ye]=(0,z.useState)({}),Ce=(0,z.useRef)(null),n=(0,z.useRef)(null),f=(0,z.useRef)(null),x=(0,z.useRef)(null),[q,de]=(0,z.useState)(0),[jt,ie]=(0,z.useState)(0),[no,Po]=(0,z.useState)(0),[Nt,ro]=(0,z.useState)(0),Tt=(0,z.useRef)(null),[$t,io]=(0,z.useState)(!1),{enableSorting:Ut=!0,enableFiltering:St=!0,enableGlobalFilter:Pt=!0,enableColumnVisibility:Wt=!0,enableRowSelection:be=!0,stickyHeader:la=!0,toolbar:M=!1,disableHeaderCheckbox:$=!1,toolbarPosition:D="default",showSerialNumbers:K=!0,fixedCheckboxColumn:ce=!0,striped:je=!0,hoverable:gt=!0,compact:Fe=!0,bordered:da=!0,fullHeight:bn=!1,enableColumnResizing:ca=!1,enableColumnPinning:ve=!0,hideHeader:vn=!1,selectionMode:nt="multiple",showCheckBox:hn=!0,checkboxColumnPosition:ma=0}=d;(0,z.useEffect)(()=>{let b=()=>{Tt.current&&io(Tt.current.scrollTop>0)},C=Tt.current;if(C)return C.addEventListener("scroll",b),()=>C.removeEventListener("scroll",b)},[]),(0,z.useEffect)(()=>{let b=()=>{Ce.current&&de(Ce.current.offsetHeight+16),n.current&&ie(n.current.offsetHeight+16),f.current&&Po(f.current.offsetHeight+16),x.current&&ro(x.current.offsetHeight+16)};b();let C=new ResizeObserver(()=>{setTimeout(b,50)});return Ce.current&&C.observe(Ce.current),n.current&&C.observe(n.current),f.current&&C.observe(f.current),x.current&&C.observe(x.current),()=>{C.disconnect()}},[M,l,D]);let xn=(b,C)=>C.split(".").reduce((m,c)=>m&&m[c],b),ko=(0,z.useMemo)(()=>Object.keys(ut).length===0?e:e.filter(b=>Object.entries(ut).every(([C,m])=>{if(!m||m==="")return!0;let c=xn(b,C);return typeof m=="string"?String(c).toLowerCase().includes(m.toLowerCase()):c===m})),[e,ut]),yn=(0,z.useCallback)((b,C)=>{ye(m=>{let c={...m};return C===""||C===null||C===void 0?delete c[b]:c[b]=C,c})},[]),kt=(0,z.useMemo)(()=>{let b=[...t],C=T=>T.map(R=>{if(R.id==="select"||R.id==="serialNumber")return R;let _={...R,enablePinning:!0};return R.columns&&(_.columns=C(R.columns)),_}),m=C(b),c={id:"select",header:({table:T})=>{if(nt==="single")return null;let R=T.getRowModel().rows.filter(ne=>!U?.(ne.original)&&(P?P(ne.original):!0)),_=R.length>0&&R.every(ne=>ne.getIsSelected()),Y=R.some(ne=>ne.getIsSelected());return(0,s.jsx)(xt,{checked:_||Y&&"indeterminate",onCheckedChange:ne=>{R.forEach(me=>me.toggleSelected(!!ne))},disabled:$||R.length===0,"aria-label":"Select all selectable rows"})},cell:({row:T})=>{let R=U?U(T.original):!1,_=P?P(T.original):!0;return(0,s.jsx)("div",{className:o("flex justify-center items-center",R&&"opacity-50"),children:nt==="multiple"?(0,s.jsx)(xt,{checked:T.getIsSelected(),onCheckedChange:Y=>_&&T.toggleSelected(!!Y),"aria-label":"Select row",disabled:R||!_}):hn?(0,s.jsx)("input",{type:"radio",checked:T.getIsSelected(),onChange:()=>_&&T.toggleSelected(!0),disabled:R||!_,className:"border-primary rounded-full focus:ring-primary w-4 h-4 text-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:nt==="multiple"?40:30};if(be){let T=ma;T<0&&(T=m.length+T+1),T=Math.max(0,Math.min(T,m.length)),m.splice(T,0,c)}if(K){let T={id:"serialNumber",header:"No.",cell:({row:R})=>(0,s.jsx)("div",{className:"font-medium text-muted-foreground text-center",children:R.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};m.unshift(T)}return m},[t,K,be,ce,U,P,nt,ma]),B=(0,Se.useReactTable)({data:ko,columns:kt,onSortingChange:Ut?ge:void 0,onColumnFiltersChange:St?Me:void 0,onGlobalFilterChange:Pt?xe:void 0,getCoreRowModel:(0,Se.getCoreRowModel)(),getPaginationRowModel:r.enabled?(0,Se.getPaginationRowModel)():void 0,getSortedRowModel:Ut?(0,Se.getSortedRowModel)():void 0,getFilteredRowModel:St?(0,Se.getFilteredRowModel)():void 0,onColumnVisibilityChange:Wt?tt:void 0,onRowSelectionChange:be?ze:void 0,onColumnOrderChange:Ee,onColumnPinningChange:ve?Ge:void 0,state:{sorting:Ut?Re:void 0,columnFilters:St?et:void 0,columnVisibility:Wt?le:void 0,rowSelection:be?fe:{},globalFilter:Pe,columnOrder:ot,columnPinning:ve?at:{}},initialState:{pagination:r.enabled?{pageSize:r.pageSize||10}:void 0,columnPinning:ve?{left:[...K?["serialNumber"]:[],...be?["select"]:[]],right:[]}:void 0},enableRowSelection:be,enableColumnResizing:ca,enableColumnPinning:ve,columnResizeMode:"onChange"}),pa=(0,z.useMemo)(()=>{if(!w||Object.keys(w).length===0)return{};let b={},C=B.getFilteredRowModel().rows;return Object.entries(w).forEach(([m,c])=>{if(!c?.enabled)return;let T=C.map(_=>{if(c.accessor)return c.accessor(_.original);{let Y=_.getValue(m);return typeof Y=="number"?Y:parseFloat(String(Y))||0}}).filter(_=>_!==null&&!isNaN(_)),R={};c.functions?.forEach(_=>{_a[_]&&(R[_]=_a[_](T))}),Object.keys(R).length>0&&(b[m]=R)}),b},[ko,w,B?.getFilteredRowModel().rows]);(0,z.useEffect)(()=>{if(be&&E){let b=B.getFilteredSelectedRowModel().rows.filter(C=>!U?.(C.original)&&(P?P(C.original):!0)).map(C=>C.original);E(b)}},[fe,be,E,B,U,P]);let Cn=(0,z.useCallback)(b=>{nt==="single"?(B.resetRowSelection(),b.toggleSelected(!0)):b.toggleSelected()},[nt,B]);(0,z.useEffect)(()=>{k&&k(B)},[B,k]);let wn=(0,z.useCallback)(()=>{ge([])},[]),Nn=(0,z.useCallback)(()=>{Me([]),xe("")},[]),ua=(b,C)=>{if(!ve)return;let m=[...K?["serialNumber"]:[],...be&&ce?["select"]:[]],c={left:[...(at.left??[]).filter(T=>m.includes(T))],right:[...at.right??[]]};C===!1?(c.left=c.left.filter(T=>T!==b),c.right=c.right.filter(T=>T!==b)):C==="right"?(c.left=c.left.filter(T=>T!==b),c.right.includes(b)||c.right.push(b)):C==="left"&&(c.right=c.right.filter(T=>T!==b),!c.left.includes(b)&&!m.includes(b)&&c.left.push(b)),B.setColumnPinning(c)},Tn=()=>{let b=Object.keys(pa).length>0,C=B.getHeaderGroups()[0]?.headers.some(c=>c.column.columnDef.customFooter),m=K&&B.getFilteredRowModel().rows.length>0&&(b||C);return!b&&!C&&!m?null:(0,s.jsx)(zo,{className:"bottom-0 z-20 sticky bg-sidebar border-t",children:(0,s.jsx)(Je,{className:"bg-sidebar hover:bg-transparent",children:B.getHeaderGroups()[0]?.headers.map((c,T)=>{let R=c.column.id,_=pa[R],Y=ve&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&be),ne=ve&&c.column.getIsPinned()==="right",me=c.column.id==="serialNumber",rt=c.column.id==="select",pe=c.column.columnDef.customFooter;return _||pe||me&&m?(0,s.jsx)(Xe,{className:o("px-2 py-2 border-r font-semibold text-sm",Fe&&"py-1",Y&&"sticky left-0 z-30 bg-sidebar/95",ne&&"sticky right-0 z-30 bg-sidebar/95",(me||rt)&&"sticky left-0 z-30 bg-sidebar/95",pe?.className),style:{width:c.getSize()!==150?c.getSize():"auto",minWidth:c.getSize()!==150?c.getSize():"auto",...Y&&{left:me?0:rt?K&&B.getColumn("serialNumber")?.getSize()||0:so(c.column)},...ne&&{right:lo(c.column)},...me&&{left:0}},children:(()=>{if(pe?.content){let ft=typeof pe.content=="function"?pe.content(B):pe.content;return(0,s.jsx)("div",{className:o("w-full h-full",pe.align==="center"&&"text-center",pe.align==="right"&&"text-right",pe.align==="left"&&"text-left"),children:ft})}return _?(0,s.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(_).map(([ft,Rn])=>(0,s.jsxs)("div",{className:"flex justify-between items-center text-muted-foreground",children:[(0,s.jsxs)("span",{className:"text-xs capitalize",children:[ft,":"]}),(0,s.jsx)("span",{className:"font-medium text-foreground",children:Sn(ft,Rn)})]},ft))}):me&&m?(0,s.jsxs)("div",{className:"text-muted-foreground text-xs text-center",children:["Total: ",B.getFilteredRowModel().rows.length]}):null})()},`agg-${c.id}`):(0,s.jsx)(Xe,{className:o("px-0 py-0 border-r",Fe&&"py-0",Y&&"sticky left-0 z-30 bg-sidebar/95",ne&&"sticky right-0 z-30 bg-sidebar/95",(me||rt)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:c.getSize()!==150?c.getSize():"auto",minWidth:c.getSize()!==150?c.getSize():"auto",...Y&&{left:me?0:rt?K&&B.getColumn("serialNumber")?.getSize()||0:so(c.column)},...ne&&{right:lo(c.column)},...me&&{left:0}}},`agg-${c.id}`)})})})},Sn=(b,C)=>typeof C=="number"?b==="count"||b==="unique"?C.toLocaleString():C.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):C,Pn=()=>B.getHeaderGroups().map((b,C)=>(0,s.jsx)(Je,{className:"hover:bg-transparent",children:b.headers.map((m,c)=>{let T=m.depth===0&&m.colSpan>1,R=ve&&(m.column.getIsPinned()==="left"||m.column.id==="serialNumber"||m.column.id==="select"&&be),_=ve&&m.column.getIsPinned()==="right",Y=m.column.getCanSort(),ne=ve&&m.column.columnDef.enablePinning!==!1,me=m.column.id==="serialNumber",rt=m.column.id==="select",Ro=me||rt&&ce,pe=m.column.columnDef.headerAlign||"left",co=w&&w[m.column.id]?.enabled,ft={left:"justify-start",center:"justify-center",right:"justify-end"}[pe];return(0,s.jsxs)(wa,{colSpan:m.colSpan,className:o("group bg-sidebar px-0 font-semibold text-foreground",!Fe&&"py-2",da&&c<b.headers.length-1&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar",_&&"sticky right-0 z-25 bg-sidebar",(me||rt)&&"sticky left-0 z-25 bg-sidebar",T?"text-center":"text-left",co&&"border-b-2 border-primary/30"),style:{width:m.getSize()!==150?m.getSize():"auto",minWidth:m.getSize()!==150?m.getSize():"auto",...R&&{left:me?0:rt?K&&B.getColumn("serialNumber")?.getSize()||0:so(m.column)},..._&&{right:lo(m.column)},...me&&{left:0}},children:[T?(0,s.jsxs)("div",{className:"flex justify-center items-center",children:[(0,Se.flexRender)(m.column.columnDef.header,m.getContext()),co&&(0,s.jsx)(Q.Calculator,{className:"ml-1 w-3 h-3 text-primary"})]}):(0,s.jsxs)("div",{className:o("relative flex items-center px-2 w-full",ft),children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[co&&(0,s.jsx)(Q.Calculator,{className:"mr-1 w-3 h-3 text-primary"}),Y&&pe==="right"&&(0,s.jsx)("span",{className:"order-2 ml-1",children:m.column.getIsSorted()&&{asc:(0,s.jsx)(Q.ChevronUp,{className:"w-4 h-4"}),desc:(0,s.jsx)(Q.ChevronDown,{className:"w-4 h-4"})}[m.column.getIsSorted()]}),m.isPlaceholder?null:(0,Se.flexRender)(m.column.columnDef.header,m.getContext()),Y&&pe!=="right"&&m.column.getIsSorted()&&(0,s.jsx)("span",{className:"order-2 ml-1",children:m.column.getIsSorted()&&{asc:(0,s.jsx)(Q.ChevronUp,{className:"w-4 h-4"}),desc:(0,s.jsx)(Q.ChevronDown,{className:"w-4 h-4"})}[m.column.getIsSorted()]})]}),(Y||ne&&!Ro)&&(0,s.jsxs)(Le,{children:[(0,s.jsx)(Oe,{asChild:!0,className:o("absolute",pe==="left"&&"right-1",pe==="center"&&"right-1",pe==="right"&&"left-1"),children:(0,s.jsx)(La,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 data-[state=open]:opacity-100 hover:opacity-100 group-hover:opacity-70",children:(0,s.jsx)(Q.MoreHorizontal,{className:"w-4 h-4"})})}),(0,s.jsxs)(_e,{align:"end",className:"w-48",children:[Y&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(he,{children:"Sorting"}),(0,s.jsxs)(re,{onClick:()=>m.column.toggleSorting(!1),children:[(0,s.jsx)(Q.ChevronUp,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),(0,s.jsxs)(re,{onClick:()=>m.column.toggleSorting(!0),children:[(0,s.jsx)(Q.ChevronDown,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),(0,s.jsxs)(re,{onClick:()=>m.column.clearSorting(),disabled:!m.column.getIsSorted(),children:[(0,s.jsx)(Q.ChevronsUpDown,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(0,s.jsx)(Ne,{})]}),ne&&!Ro&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(he,{children:"Pin Column"}),(0,s.jsxs)(re,{onClick:()=>ua(m.column.id,"right"),disabled:m.column.getIsPinned()==="right",children:[(0,s.jsx)(Q.MoveRightIcon,{}),"Pin Right"]}),(0,s.jsxs)(re,{onClick:()=>ua(m.column.id,!1),disabled:!m.column.getIsPinned(),children:[(0,s.jsx)(Q.PinOffIcon,{}),"Unpin"]})]})]})]})]}),ca&&m.column.getCanResize()&&!T&&m.colSpan===1&&(0,s.jsx)("div",{className:"top-0 right-0 absolute hover:bg-primary opacity-0 hover:opacity-100 bg-border w-1 h-full transition-opacity cursor-col-resize",onMouseDown:m.getResizeHandler()})]},m.id)})},b.id)),so=b=>{if(!ve)return;let C=0,m=B.getLeftHeaderGroups()[0]?.headers||[],c=[...K?["serialNumber"]:[],...be?["select"]:[]];for(let T of m){if(T.id===b.id)break;if(c.includes(T.id)){let R=B.getColumn(T.id);R&&(C+=R.getSize())}}return C},lo=b=>{if(!ve)return;let C=B.getState().columnPinning.right||[],m=C.indexOf(b.id);if(m===-1)return;let c=0;for(let T=m+1;T<C.length;T++){let R=B.getColumn(C[T]);R&&(c+=R.getSize())}return c};if(u)return(0,s.jsx)(Ke,{className:"shadow-sm rounded-xl w-full",children:(0,s.jsx)(Ye,{className:"flex justify-center items-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),(0,s.jsx)("p",{className:"mb-4 text-muted-foreground text-sm",children:u}),F&&(0,s.jsxs)(h,{variant:"outline",size:"sm",onClick:F,className:"rounded-lg",children:[(0,s.jsx)(Q.Loader2,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let kn=b=>b&&typeof b=="object"&&"content"in b,Be=(0,z.useMemo)(()=>l?kn(l)?{content:l.content,align:l.align||"left",className:l.className||"",sticky:l.sticky!==void 0?l.sticky:!0,showOnEmpty:l.showOnEmpty!==void 0?l.showOnEmpty:!0}:{content:l,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[l]),Do=()=>M?(0,s.jsx)(Ho,{table:B,filters:a,globalFilter:Pe,onGlobalFilterChange:xe,enableGlobalFilter:Pt,onExport:O,onRefresh:F,loading:v,enableColumnVisibility:Wt,enableColumnPinning:ve,data:ko,onClearSorting:wn,onClearFilters:Nn,onExternalSearch:ae,onCustomFilterChange:yn,aggregations:w,onAggregationChange:j}):null,Dn=()=>{let b=0;return D==="above-header"&&(b+=jt),Be&&(b+=Nt),D==="below-header"&&(b+=no),b};return(0,s.jsx)(vt,{children:(0,s.jsxs)("div",{className:o("flex flex-col space-y-2 w-full h-full",N),children:[M&&D==="default"&&(0,s.jsx)("div",{ref:Ce,className:"z-40 relative",children:Do()}),(0,s.jsx)(Ke,{className:o("shadow-sm py-0 overflow-hidden",bn&&"flex-1"),children:(0,s.jsx)(Ye,{className:"p-0 h-full",children:(0,s.jsxs)("div",{className:"relative flex flex-col justify-between h-full",children:[v&&(0,s.jsx)("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 backdrop-blur-sm rounded-xl",children:(0,s.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[(0,s.jsx)(Q.Loader2,{className:"size-5 text-primary animate-spin"}),(0,s.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),(0,s.jsx)("div",{ref:Tt,className:o("relative border-b rounded-t-xl overflow-auto",B.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:p},children:(0,s.jsxs)(Mo,{className:o("relative w-full border-collapse",B.getRowModel().rows?.length===0&&"h-full"),children:[M&&D==="above-header"&&(0,s.jsx)("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:(0,s.jsx)(Je,{className:"hover:bg-transparent",children:(0,s.jsx)(Xe,{colSpan:kt.length,className:"bg-sidebar shadow-sm p-2 border-b",children:(0,s.jsx)("div",{ref:n,children:Do()})})})}),Be&&(Be.showOnEmpty||B.getRowModel().rows?.length>0)&&(0,s.jsx)("thead",{className:o("sticky bg-sidebar border-b",$t&&"shadow-sm"),style:{top:D==="above-header"?`${jt}px`:"0px",zIndex:35},children:(0,s.jsx)(Je,{className:"hover:bg-transparent",children:(0,s.jsx)(Xe,{colSpan:kt.length,className:o("bg-sidebar p-2 font-semibold text-foreground",Fe?"py-2":"py-4",Be.className),children:(0,s.jsx)("div",{ref:x,className:o("flex items-center w-full",Be.align==="center"&&"justify-center",Be.align==="right"&&"justify-end",Be.align==="left"&&"justify-start"),children:typeof Be.content=="string"?(0,s.jsx)("span",{className:"font-bold text-foreground text-lg tracking-tight",children:Be.content}):Be.content})})})}),M&&D==="below-header"&&(0,s.jsx)("thead",{className:o("sticky bg-sidebar border-b",$t&&"shadow-sm"),style:{top:Be?`${Nt}px`:"0px",zIndex:35},children:(0,s.jsx)(Je,{className:"hover:bg-transparent",children:(0,s.jsx)(Xe,{colSpan:kt.length,className:"bg-sidebar p-2",children:(0,s.jsx)("div",{ref:f,children:Do()})})})}),!vn&&(0,s.jsx)(ya,{className:o("sticky bg-sidebar",$t&&"shadow-sm"),style:{top:`${Dn()}px`,zIndex:30},children:Pn()}),(0,s.jsx)(Ca,{children:B.getRowModel().rows?.length?B.getRowModel().rows.map((b,C)=>{let m=Ie?Ie(b):"";return(0,s.jsx)(Je,{"data-index":C,"data-state":b.getIsSelected()&&"selected",className:o(gt&&"hover:bg-muted/50",je&&C%2===0&&"bg-muted/20",b.getIsSelected()&&"bg-muted","border-b last:border-b-0",nt==="single"&&"cursor-pointer",m),onClick:()=>{nt==="single"&&Cn(b)},children:b.getVisibleCells().map((c,T)=>{let R=ve&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&be),_=ve&&c.column.getIsPinned()==="right",Y=c.column.id==="serialNumber",ne=c.column.id==="select",me=Y||ne&&ce;return(0,s.jsx)(Xe,{className:o(Fe?"py-2":"py-4",da&&T<b.getVisibleCells().length&&"border-r",R&&"sticky left-0 z-20 bg-sidebar/95",_&&"sticky right-0 z-20 bg-sidebar/95",Y&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:c.column.getSize()!==150?c.column.getSize():"auto",minWidth:c.column.getSize()!==150?c.column.getSize():"auto",...R&&{left:Y?0:ne?K&&B.getColumn("serialNumber")?.getSize()||0:so(c.column)},..._&&{right:lo(c.column)},...Y&&{left:0}},children:(0,Se.flexRender)(c.column.columnDef.cell,c.getContext())},c.id)})},b.id)}):(0,s.jsx)(Je,{children:(0,s.jsx)(Xe,{colSpan:kt.length,className:"border-0 h-32 text-center",children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,s.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,s.jsx)("p",{className:"font-medium text-muted-foreground",children:S})]})})})}),Tn()]})}),g&&(0,s.jsx)("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:(0,s.jsx)(Mo,{children:(0,s.jsx)(zo,{children:(0,s.jsx)(Je,{className:"bg-sidebar",children:(0,s.jsx)(Xe,{colSpan:kt.length,className:"p-2",children:g})})})})})]})})}),(0,s.jsx)(Eo,{table:B,config:r}),G&&G(B)]})})}var Va=require("radix-ui");var Ha=require("react/jsx-runtime");function to({className:e,orientation:t="horizontal",decorative:a=!0,...r}){return(0,Ha.jsx)(Va.Separator.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),...r})}var vo=require("lucide-react"),ho=require("framer-motion"),dt=Dt(require("react"),1),Ea=Dt(require("react-dom"),1),ee=require("react/jsx-runtime");function jo({table:e,visible:t,container:a,children:r,className:d,...l}){let[g,N]=dt.useState(!1);dt.useLayoutEffect(()=>{N(!0)},[]),dt.useEffect(()=>{function u(S){S.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e]);let p=a??(g?globalThis.document?.body:null);if(!p||!e)return null;let v=t??e.getFilteredSelectedRowModel().rows.length>0;return Ea.createPortal((0,ee.jsx)(ho.AnimatePresence,{children:v&&(0,ee.jsx)(ho.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className: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",d),...l,children:(0,ee.jsx)(vt,{children:r})})}),p)}function $o({size:e="sm",tooltip:t,isPending:a,disabled:r,className:d,children:l,...g}){let N=(0,ee.jsx)(h,{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",d),disabled:r||a,...g,children:a?(0,ee.jsx)(vo.Loader,{className:"animate-spin"}):l});return t?(0,ee.jsxs)(it,{children:[(0,ee.jsx)(st,{asChild:!0,children:N}),(0,ee.jsx)(lt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,ee.jsx)("p",{children:t})})]}):N}function Uo({table:e}){let t=dt.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,ee.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,ee.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,ee.jsx)(to,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,ee.jsxs)(it,{children:[(0,ee.jsx)(st,{asChild:!0,children:(0,ee.jsx)(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,ee.jsx)(vo.X,{className:"size-3.5"})})}),(0,ee.jsxs)(lt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,ee.jsx)("p",{children:"Clear selection"}),(0,ee.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,ee.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var Ga=require("lucide-react");var ja=require("react/jsx-runtime");var $a=require("lucide-react");var Ua=require("react/jsx-runtime");var jn=require("radix-ui"),Wa=require("class-variance-authority");var $n=require("react/jsx-runtime"),Ri=(0,Wa.cva)("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"}});var qa=require("lucide-react"),Wo=require("react/jsx-runtime");var W=require("react"),Jo=require("lucide-react");var Ae=require("lucide-react");var y=require("react/jsx-runtime");function qo({fields:e,filters:t,globalFilter:a,onGlobalFilterChange:r,fieldFilters:d,onFieldFilterChange:l,sortField:g,sortDirection:N,onSortChange:p,selectedCount:v,totalCount:u,visibleCount:S,onExport:E,onRefresh:O,loading:F,onClearFilters:k,onClearSorting:G}){let U=e.filter(w=>w.sortable),P=Object.values(d).some(w=>w!=null&&w!=="")||a!=="",ae=g!=="";return(0,y.jsx)("div",{className:"rounded-xl p-0.5",children:(0,y.jsx)("div",{className:"px-2",children:(0,y.jsx)("div",{className:"flex flex-col gap-6",children:(0,y.jsxs)("div",{className:"flex items-center justify-between",children:[(0,y.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,y.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,y.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,y.jsx)(Ae.Filter,{className:"h-4 w-4"})}),t.map(w=>(0,y.jsx)("div",{className:"relative min-w-[150px]",children:w.type==="select"?(0,y.jsxs)(It,{value:d[w.key]||"all",onValueChange:j=>l(w.key,j),children:[w.icon&&(0,y.jsx)(w.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,y.jsx)(Bt,{className:o("h-9 rounded-lg w-full",w.icon&&"pl-9"),children:(0,y.jsx)(Ft,{placeholder:w.placeholder||"Select..."})}),(0,y.jsxs)(Lt,{className:"rounded-lg",children:[(0,y.jsx)(Ct,{value:"all",children:"All"}),w.options?.map(j=>(0,y.jsx)(Ct,{value:j.value,children:j.label},j.value))]})]}):(0,y.jsxs)("div",{className:"relative",children:[w.icon&&(0,y.jsx)(w.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,y.jsx)(Rt,{type:w.type,placeholder:w.placeholder,value:d[w.key]||"",onChange:j=>l(w.key,j.target.value),className:o("h-9 rounded-lg",w.icon&&"pl-9")})]})},String(w.key)))]})}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsxs)("div",{className:"relative",children:[(0,y.jsx)(Ae.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,y.jsx)(Rt,{placeholder:"Global search...",value:a,onChange:w=>r(w.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),U.length>0&&(0,y.jsxs)(Le,{children:[(0,y.jsx)(Oe,{asChild:!0,children:(0,y.jsxs)(h,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,y.jsx)("span",{children:"Sort"}),(0,y.jsx)(Ae.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,y.jsxs)(_e,{align:"end",className:"w-[200px] rounded-lg",children:[(0,y.jsx)(he,{children:"Sort By"}),(0,y.jsx)(Ne,{}),U.map(w=>(0,y.jsxs)("div",{children:[(0,y.jsxs)(re,{onClick:()=>p(w.key,"asc"),children:[w.label," (A-Z)"]}),(0,y.jsxs)(re,{onClick:()=>p(w.key,"desc"),children:[w.label," (Z-A)"]})]},String(w.key))),ae&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ne,{}),(0,y.jsx)(re,{onClick:G,children:"Clear All Sorting"})]})]})]}),(0,y.jsxs)(Le,{children:[(0,y.jsx)(Oe,{asChild:!0,children:(0,y.jsx)(h,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,y.jsx)(Ae.Settings2,{className:"h-4 w-4"})})}),(0,y.jsxs)(_e,{align:"end",className:"w-[200px] rounded-lg",children:[(0,y.jsx)(he,{children:"Table Settings"}),(0,y.jsx)(Ne,{}),(0,y.jsx)(re,{onClick:G,children:"Clear All Sorting"}),(0,y.jsx)(re,{onClick:k,children:"Clear All Filters"})]})]}),E&&(0,y.jsxs)(h,{variant:"outline",size:"sm",onClick:E,className:"rounded-lg",children:[(0,y.jsx)(Ae.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),O&&(0,y.jsx)(h,{variant:"outline",size:"sm",onClick:O,disabled:F,className:"rounded-lg",children:(0,y.jsx)(Ae.RefreshCw,{className:o("h-4 w-4",F&&"animate-spin")})})]})]})})})})}var ct=require("lucide-react");var I=require("react/jsx-runtime");function Ja({currentPage:e,totalPages:t,pageSize:a,totalItems:r,onPageChange:d,onPageSizeChange:l,config:g}){if(!g.enabled)return null;let N=g.pageSizeOptions||[10,20,50,100],p=(e-1)*a+1,v=Math.min(e*a,r),u=e>1,S=e<t,E=()=>{let F=[],k=[];for(let G=Math.max(2,e-2);G<=Math.min(t-1,e+2);G++)F.push(G);return e-2>2?k.push(1,"..."):k.push(1),k.push(...F),e+2<t-1?k.push("...",t):t>1&&k.push(t),k};return(0,I.jsx)("div",{className:"rounded-xl",children:(0,I.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,I.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:g.showInfo!==!1&&(0,I.jsxs)("span",{children:["Showing ",p," to ",v," of ",r," entries"]})}),(0,I.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[N&&(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[(0,I.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,I.jsxs)(It,{value:`${a}`,onValueChange:O=>l(Number(O)),children:[(0,I.jsx)(Bt,{className:"h-9 w-[70px] rounded-lg",children:(0,I.jsx)(Ft,{})}),(0,I.jsx)(Lt,{side:"top",className:"rounded-lg",children:N.map(O=>(0,I.jsx)(Ct,{value:`${O}`,children:O},O))})]})]}),(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[(0,I.jsxs)(h,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:!u,className:"hidden sm:flex rounded-lg",children:[(0,I.jsx)(ct.ChevronsLeft,{className:"h-4 w-4"}),(0,I.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,I.jsxs)(h,{variant:"outline",size:"sm",onClick:()=>d(e-1),disabled:!u,className:"rounded-lg",children:[(0,I.jsx)(ct.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,I.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,I.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),g.showPageNumbers&&t>1&&(0,I.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:E().map((O,F)=>{if(O==="...")return(0,I.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${F}`);let k=O;return(0,I.jsx)(h,{variant:k===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>d(k),children:k},k)})}),(0,I.jsxs)("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),(0,I.jsxs)(h,{variant:"outline",size:"sm",onClick:()=>d(e+1),disabled:!S,className:"rounded-lg",children:[(0,I.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,I.jsx)(ct.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,I.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,I.jsxs)(h,{variant:"outline",size:"sm",onClick:()=>d(t),disabled:!S,className:"hidden sm:flex rounded-lg",children:[(0,I.jsx)(ct.ChevronsRight,{className:"h-4 w-4"}),(0,I.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var L=require("react/jsx-runtime");function Xo({data:e,template:t,fields:a=[],filters:r=[],pagination:d={enabled:!1},settings:l={},header:g,footer:N,className:p="",loading:v=!1,error:u,emptyMessage:S="No items found",emptyIcon:E,onSelectionChange:O,onExport:F,onRefresh:k,onTemplateReady:G,children:U}){let{enableSorting:P=!0,enableFiltering:ae=!0,enableGlobalSearch:w=!0,enableSelection:j=!1,enableExport:Ie=!1,toolbar:Re=!0,selectionMode:ge="multiple",gridCols:et={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Me=4,aspectRatio:le="auto",minCardWidth:tt=350,maxCardWidth:fe=350}=l,[ze,Pe]=(0,W.useState)(""),[xe,ot]=(0,W.useState)({}),[Ee,at]=(0,W.useState)(""),[Ge,ut]=(0,W.useState)("asc"),[ye,Ce]=(0,W.useState)(new Set),[n,f]=(0,W.useState)(1),[x,q]=(0,W.useState)(d.pageSize||12),[de,jt]=(0,W.useState)(et.default),ie=(0,W.useMemo)(()=>{let M=[...e];if(w&&ze){let $=a.filter(D=>D.searchable!==!1);M=M.filter(D=>$.some(K=>D[K.key]?.toString().toLowerCase().includes(ze.toLowerCase())))}if(ae&&Object.keys(xe).forEach($=>{let D=xe[$];if(D!=null&&D!==""){let K=a.find(ce=>ce.key===$);K&&(M=M.filter(ce=>{let je=ce[$];return K.type==="boolean"?je===(D==="true"):K.type==="number"?je===Number(D):je?.toString().toLowerCase().includes(String(D).toLowerCase())}))}}),P&&Ee){let $=a.find(D=>D.key===Ee);$&&M.sort((D,K)=>{let ce=D[Ee],je=K[Ee];if($.type==="number")return Ge==="asc"?Number(ce)-Number(je):Number(je)-Number(ce);if($.type==="date"){let gt=new Date(ce),Fe=new Date(je);return Ge==="asc"?gt.getTime()-Fe.getTime():Fe.getTime()-gt.getTime()}else{let gt=String(ce).toLowerCase(),Fe=String(je).toLowerCase();return Ge==="asc"?gt.localeCompare(Fe):Fe.localeCompare(gt)}})}return M},[e,ze,xe,Ee,Ge,a,w,ae,P]),no=(0,W.useMemo)(()=>{if(!d.enabled)return ie;let M=(n-1)*x,$=M+x;return ie.slice(M,$)},[ie,n,x,d.enabled]),Po=Math.ceil(ie.length/x),Nt=(0,W.useCallback)(M=>{j&&Ce($=>{let D=new Set($);return ge==="single"?(D.clear(),D.add(M)):D.has(M)?D.delete(M):D.add(M),D})},[j,ge]),ro=(0,W.useCallback)(()=>{!j||ge==="single"||(ye.size===ie.length?Ce(new Set):Ce(new Set(ie.map((M,$)=>$))))},[j,ge,ye.size,ie.length]),Tt=(0,W.useCallback)((M,$)=>{ot(D=>({...D,[M]:$})),f(1)},[]),$t=(0,W.useCallback)((M,$)=>{at(M),ut($)},[]),io=(0,W.useCallback)(()=>{Pe(""),ot({}),f(1)},[]),Ut=(0,W.useCallback)(()=>{at(""),ut("asc")},[]),St=(0,W.useMemo)(()=>({getSelectedItems:()=>Array.from(ye).map(M=>ie[M]),clearSelection:()=>Ce(new Set),selectAll:ro,getFilteredData:()=>ie,getTotalCount:()=>e.length,getVisibleCount:()=>ie.length,refresh:()=>k?.(),exportData:()=>F?.(ie)}),[ye,ie,e.length,ro,k,F]),Pt=(0,W.useRef)(null);Pt.current=St,(0,W.useEffect)(()=>{G&&Pt.current&&G(Pt.current)},[]),(0,W.useEffect)(()=>{if(j&&O){let M=Array.from(ye).map($=>ie[$]);O(M)}},[ye]);let Wt=o("w-full","overflow-hidden",p),be=o("grid",`gap-${Me}`,"w-full","mx-auto","items-start"),la={gridTemplateColumns:de===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${tt}px, calc(100%/${de} - ${Me*4}px), ${fe}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return u?(0,L.jsx)(Ke,{className:"w-full",children:(0,L.jsx)(Ye,{className:"flex items-center justify-center py-12",children:(0,L.jsxs)("div",{className:"text-center",children:[(0,L.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,L.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:u}),k&&(0,L.jsxs)(h,{variant:"outline",size:"sm",onClick:k,children:[(0,L.jsx)(Jo.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,L.jsxs)("div",{className:o("w-full flex gap-2 flex-col h-full",Wt),children:[g&&(0,L.jsx)(Ke,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,L.jsx)(Ye,{className:"p-2",children:g})}),Re&&(0,L.jsx)(qo,{fields:a,filters:r,globalFilter:ze,onGlobalFilterChange:Pe,fieldFilters:xe,onFieldFilterChange:Tt,sortField:Ee,sortDirection:Ge,onSortChange:$t,selectedCount:ye.size,totalCount:e.length,visibleCount:ie.length,onExport:Ie?()=>F?.(ie):void 0,onRefresh:k,loading:v,onClearFilters:io,onClearSorting:Ut}),(0,L.jsx)(Ke,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,L.jsx)(Ye,{className:"px-0",children:(0,L.jsxs)("div",{className:"relative",children:[v&&(0,L.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,L.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,L.jsx)(Jo.Loader2,{className:"size-5 animate-spin text-primary"}),(0,L.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),no.length>0?(0,L.jsx)("div",{className:o(be),style:la,children:no.map((M,$)=>{let D=d.enabled?(n-1)*x+$:$,K=ye.has(D);return(0,L.jsxs)("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",le==="square"?"aspect-square":"",le==="video"?"aspect-video":"",j?"cursor-pointer":"",K?"ring-2 ring-primary":""),onClick:()=>j&&Nt(D),children:[j&&ge==="multiple"&&(0,L.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,L.jsx)(xt,{checked:K,onCheckedChange:()=>Nt(D),className:"bg-background/80 backdrop-blur-sm",onClick:ce=>ce.stopPropagation()})}),t(M,$,K,()=>Nt(D))]},D)})}):(0,L.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,L.jsx)("div",{className:"text-6xl",children:E||"\u{1F4CB}"}),(0,L.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:S}),(ze||Object.values(xe).some(M=>M))&&(0,L.jsx)(h,{variant:"outline",onClick:io,children:"Clear Filters"})]})]})})}),d.enabled&&(0,L.jsx)("div",{className:"pb-1",children:(0,L.jsx)(Ja,{currentPage:n,totalPages:Po,pageSize:x,totalItems:ie.length,onPageChange:f,onPageSizeChange:M=>{q(M),f(1)},config:d})}),N&&(0,L.jsx)("div",{className:"p-2 m-0.5",children:N}),U&&U(St)]})}var xo=require("lucide-react"),yo=require("framer-motion"),mt=Dt(require("react"),1),Xa=Dt(require("react-dom"),1),te=require("react/jsx-runtime");function Ko({controller:e,visible:t,container:a,children:r,className:d,...l}){let[g,N]=mt.useState(!1);mt.useLayoutEffect(()=>{N(!0)},[]),mt.useEffect(()=>{function S(E){E.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e]);let p=a??(g?globalThis.document?.body:null);if(!p||!e)return null;let v=e.getSelectedItems(),u=t??v.length>0;return Xa.createPortal((0,te.jsx)(yo.AnimatePresence,{children:u&&(0,te.jsx)(yo.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className: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",d),...l,children:(0,te.jsx)(vt,{children:r})})}),p)}function Yo({size:e="sm",variant:t="secondary",tooltip:a,isPending:r,disabled:d,className:l,children:g,onClick:N,...p}){let v=(0,te.jsx)(h,{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",l),disabled:d||r,onClick:N,...p,children:r?(0,te.jsx)(xo.Loader,{className:"animate-spin"}):g});return a?(0,te.jsxs)(it,{children:[(0,te.jsx)(st,{asChild:!0,children:v}),(0,te.jsx)(lt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,te.jsx)("p",{children:a})})]}):v}function Zo({controller:e}){let t=mt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let a=e.getSelectedItems();return(0,te.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,te.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[a.length," selected"]}),(0,te.jsx)(to,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,te.jsxs)(it,{children:[(0,te.jsx)(st,{asChild:!0,children:(0,te.jsx)(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,te.jsx)(xo.X,{className:"size-3.5"})})}),(0,te.jsxs)(lt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[(0,te.jsx)("p",{children:"Clear selection"}),(0,te.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,te.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var Ya=require("react/jsx-runtime"),Un={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},Wn={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Ka=({children:e,className:t,spacing:a="tight",padding:r="none"})=>(0,Ya.jsx)("div",{className:o("flex flex-col h-full",Un[a],Wn[r],t),children:e});var oo=require("lucide-react");var Za=require("react-router"),J=require("react/jsx-runtime"),Qa=({className:e,columns:t=[],showBackButton:a=!0,meta:r={title:""}})=>{let d=()=>{if(!r.backAction||!a)return null;let u={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return r.backAction.href?(0,J.jsx)(Za.NavLink,{to:r.backAction.href,children:(0,J.jsxs)(h,{...u,children:[(0,J.jsx)(oo.ArrowLeftIcon,{className:"size-6"}),r.backAction.content]})}):(0,J.jsxs)(h,{...u,onClick:r.backAction.onClick,children:[(0,J.jsx)(oo.ArrowLeftIcon,{className:"size-6"}),r.backAction.content]})},l=()=>!r.metadata||r.metadata.length===0?null:(0,J.jsx)("div",{className:"flex gap-4",children:r.metadata.map((u,S)=>u.value&&(0,J.jsxs)("div",{className:"text-sm",children:[(0,J.jsxs)("span",{className:"text-muted-foreground",children:[u.label," "]}),(0,J.jsx)("span",{children:u.value})]},S))}),g=()=>r.status?(0,J.jsx)("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"}[r.status.color]),children:r.status.content}):null,N={content:(0,J.jsxs)("div",{className:"flex gap-2 items-center",children:[d(),(0,J.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,J.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:r.title}),g(),r.description&&(0,J.jsx)("p",{className:"text-muted-foreground",children:r.description}),l(),r.breadcrumbs&&r.breadcrumbs.length>0&&(0,J.jsx)("div",{className:"flex items-center text-sm text-muted-foreground",children:r.breadcrumbs.map((u,S)=>(0,J.jsxs)("div",{className:"flex items-center",children:[u.href?(0,J.jsx)("span",{className:"hover:text-primary hover:underline",children:u.label}):(0,J.jsx)("span",{children:u.label}),S<r.breadcrumbs.length-1&&(0,J.jsx)(oo.ChevronRight,{className:"mx-2 h-4 w-4"})]},S))})]})]}),align:"left",width:"fill"},p={content:r.primaryActions,align:"right",width:"auto"},v=[N,...t.filter(u=>u!==void 0),p];return(0,J.jsx)("div",{className:o("flex items-center w-full gap-4 p-2",e),children:v.map((u,S)=>(0,J.jsx)("div",{className:o("flex items-center h-full",u.className,{"justify-start":u.align==="left","justify-center":u.align==="center","justify-end":u.align==="right","flex-1":u.width==="fill"}),children:u.content},S))})};var pt=Dt(require("react"),1);var Ot=require("radix-ui"),en=require("lucide-react");var Ve=require("react/jsx-runtime");function tn({...e}){return(0,Ve.jsx)(Ot.Dialog.Root,{"data-slot":"sheet",...e})}function Qo({...e}){return(0,Ve.jsx)(Ot.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function qn({className:e,...t}){return(0,Ve.jsx)(Ot.Dialog.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 on({className:e,children:t,side:a="right",...r}){return(0,Ve.jsxs)(Qo,{children:[(0,Ve.jsx)(qn,{}),(0,Ve.jsxs)(Ot.Dialog.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),...r,children:[t,(0,Ve.jsxs)(Ot.Dialog.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:[(0,Ve.jsx)(en.XIcon,{className:"size-4"}),(0,Ve.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var H=require("react/jsx-runtime"),an=(0,pt.createContext)(!1),Co={"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"]},_t={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Jn=(e,t)=>{let[a,r]=Co[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"?r:a,sheetPushClass:e==="right"?a:r}},Xn="flex flex-col overflow-hidden rounded-2xl relative",Kn={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},nn=e=>{let{children:t,className:a,variant:r="default",layout:d="full",header:l,footer:g,headerClassName:N,contentClassName:p,footerClassName:v,parentContainer:u=!1,padding:S=u?"none":"tight"}=e,E=(0,pt.useContext)(an),[O,F]=(0,pt.useState)(!1),k=pt.default.useCallback(U=>(0,H.jsx)("div",{className:o("flex-1 overflow-auto h-full no-scrollbar",u&&"flex",!u&&_t[S],p),children:U}),[S,u,p]),G=()=>{switch(d){case"split":{let{splitRatio:U="three-fourth",reverse:P=!1}=e;if(!Array.isArray(t)||t.length!==2)return(0,H.jsx)("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[ae,w]=Co[U],[j,Ie]=P?[t[1],t[0]]:[t[0],t[1]],[Re,ge]=P?[w,ae]:[ae,w];return(0,H.jsxs)("div",{className:"flex h-full gap-2",children:[(0,H.jsx)("div",{className:o(Re,"overflow-auto"),children:k(j)}),(0,H.jsx)("div",{className:o(ge,"overflow-auto"),children:k(Ie)})]})}case"with-sheet":{let{sheetContent:U,sheetWidth:P="four-fifth",sheetSide:ae="right",sheetMode:w="container",sheetClassName:j,isSheetOpen:Ie,onSheetOpenChange:Re,disableOverlay:ge=!0,showSheetOverlay:et=!0}=e,Me=Ie!==void 0&&Re,le=Me?Ie:O,tt=Me?Re:F;if(w==="container"){let fe=Jn(ae,P),ze=Co[P][0];return ge?(0,H.jsxs)("div",{className:o("flex relative flex-1 overflow-hidden",p),children:[(0,H.jsx)("div",{className:o("h-full overflow-auto transition-all duration-500",le?fe.contentPushClass:"w-full",le&&"overflow-y-auto overflow-x-hidden"),children:(0,H.jsx)("div",{className:o("h-full",!u&&_t[S]),children:t})}),(0,H.jsx)("div",{className:o(fe.container,"transition-all duration-500 ease-in-out h-full",ze,le&&["left","right"].includes(ae)?o(fe.sheetPushClass,"overflow-y-auto"):le?fe.transformOpen:o(fe.transform,"hidden"),"overflow-y-auto"),children:(0,H.jsx)("div",{className:o(fe.content,j,"h-full"),children:U})})]}):(0,H.jsxs)("div",{className:o("flex relative flex-1 overflow-hidden",p),children:[(0,H.jsx)("div",{className:o("h-full overflow-auto w-full transition-all duration-500 relative z-10"),children:(0,H.jsx)("div",{className:o("h-full",!u&&_t[S]),children:t})}),(0,H.jsxs)("div",{className:o("absolute inset-0 z-20",!le&&"pointer-events-none"),children:[et&&(0,H.jsx)("div",{className:o("absolute inset-0 bg-black/50 transition-opacity duration-500",le?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>tt(!1)}),(0,H.jsx)("div",{className:o(fe.container,"transition-all duration-500 backdrop-blur-2xl ease-in-out h-full absolute",ze,le?"translate-x-0 opacity-100":o(ae==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),"overflow-y-auto"),style:{[ae]:0},children:(0,H.jsx)("div",{className:o(fe.content,j,"h-full"),children:U})})]})]})}return(0,H.jsxs)(H.Fragment,{children:[t,(0,H.jsx)(tn,{open:le,onOpenChange:tt,children:(0,H.jsx)(Qo,{children:(0,H.jsx)(on,{side:ae,className:o("fixed bg-background border sm:max-w-full","transition-all duration-500 ease-in-out",Co[P][0],j),children:U})})})]})}default:return k(t)}};return(0,H.jsx)(an.Provider,{value:!0,children:(0,H.jsxs)("div",{className:o(Xn,Kn[r],_t[S],E&&"flex-1",u&&"h-full",!u&&"rounded-2xl",a),children:[l&&(0,H.jsx)("div",{className:o("border-b",N,r==="card"&&!u&&"rounded-t-2xl",r==="border"&&"border-b-2",_t[S]),children:l}),G(),g&&(0,H.jsx)("div",{className:o("border-t",v,r==="card"&&!u&&"rounded-b-2xl",r==="border"&&"border-t-2",_t[S]),children:g})]})})};var wo=require("react/jsx-runtime"),rn=({className:e,columns:t=[],meta:a={title:""}})=>{let r={content:(0,wo.jsx)("div",{className:"flex items-center gap-4 p-2",children:a.secondaryActions}),align:"right",width:"fill"},d=[...t.filter(l=>l!==void 0),r];return(0,wo.jsx)("div",{className:o("flex items-center w-full gap-4",e),children:d.map((l,g)=>(0,wo.jsx)("div",{className:o("flex items-center h-full",l.className,{"justify-start":l.align==="left","justify-center":l.align==="center","justify-end":l.align==="right","flex-1":l.width==="fill"}),children:l.content},g))})};var ao=require("react/jsx-runtime");function sn({useTypedAppMeta:e}){return{AppHeader:l=>{let{meta:g}=e();return(0,ao.jsx)(Qa,{...l,meta:g})},AppFooter:l=>{let{meta:g}=e();return(0,ao.jsx)(rn,{...l,meta:g})},AppContent:l=>(0,ao.jsx)(nn,{...l}),AppContainer:l=>(0,ao.jsx)(Ka,{...l})}}var ue=require("react"),ea=require("react/jsx-runtime"),Yn=(0,ue.createContext)(void 0),ln=({children:e})=>{let[t,a]=(0,ue.useState)({title:"",description:"",breadcrumbs:[]}),r=(0,ue.useCallback)(g=>{a(N=>Object.keys(g).some(v=>JSON.stringify(N[v])!==JSON.stringify(g[v]))?{...N,...g}:N)},[]),d=(0,ue.useCallback)(()=>{a(g=>g.title===""&&g.description===""&&(g.breadcrumbs?.length??0)===0?g:{title:"",description:"",breadcrumbs:[]})},[]),l=(0,ue.useMemo)(()=>({meta:t,setMeta:r,resetMeta:d}),[t,r,d]);return(0,ea.jsx)(Yn.Provider,{value:l,children:e})};function dn(){let e=(0,ue.createContext)(void 0);return{TypedAppMetaProvider:({children:r})=>{let[d,l]=(0,ue.useState)({title:"",description:"",breadcrumbs:[]}),g=(0,ue.useCallback)(v=>{l(u=>Object.keys(v).some(E=>{let O=u[E],F=v[E];return JSON.stringify(O)!==JSON.stringify(F)})?{...u,...v}:u)},[]),N=(0,ue.useCallback)(()=>{l(v=>v.title===""&&v.description===""&&(v.breadcrumbs?.length??0)===0?v:{title:"",description:"",breadcrumbs:[]})},[]),p=(0,ue.useMemo)(()=>({meta:d,setMeta:g,resetMeta:N}),[d,g,N]);return(0,ea.jsx)(e.Provider,{value:p,children:r})},useTypedAppMeta:()=>{let r=(0,ue.useContext)(e);if(!r)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return r},TypedAppMetaContext:e}}var Vt=require("react");function cn({useTypedAppMeta:e}){function t(a){let{setMeta:r,resetMeta:d}=e(),l=(0,Vt.useMemo)(()=>{if(a.backAction)return{...a.backAction,onClick:a.backAction.onClick}},[a.backAction?.content,a.backAction?.href,a.backAction?.onClick?.toString()]),g=(0,Vt.useMemo)(()=>a.metadata,[JSON.stringify(a.metadata)]),N=(0,Vt.useMemo)(()=>({...a,backAction:l,metadata:g}),[a.title,a.description,a.breadcrumbs,a.primaryActions,a.secondaryActions,a.pagination,a.status,l,g]);(0,Vt.useEffect)(()=>(r(N),()=>d()),[N,r,d])}return{usePageTemplate:t}}var ta=require("react"),Ht=require("lucide-react");var De=require("react/jsx-runtime"),No=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:r,size:d="icon",variant:l="ghost"})=>{let[g,N]=(0,ta.useState)(!1),[p,v]=(0,ta.useState)(!1),u=async()=>{if(!(!t||p)){v(!0);try{await this.copyToClipboard(t),N(!0),setTimeout(()=>N(!1),2e3)}catch(S){console.error("Failed to copy text:",S)}finally{v(!1)}}};return(0,De.jsxs)(it,{children:[(0,De.jsx)(st,{asChild:!0,children:(0,De.jsx)(h,{variant:l,size:d,className:o(d==="icon"&&"size-6",r),onClick:u,disabled:p||!t,children:p?(0,De.jsx)(Ht.Loader2Icon,{className:"animate-spin"}):g?(0,De.jsx)(Ht.Check,{className:"h-3 w-3"}):a||(0,De.jsx)(Ht.Copy,{className:"h-3 w-3"})})}),(0,De.jsx)(lt,{children:g?"Copied!":p?"Copying...":"Copy to clipboard"})]})};static formatINR(t,a={}){let{prefix:r="",suffix:d="",withSymbol:l=!0,compact:g=!1}=a;if(typeof t!="number"||isNaN(t))return`${r}${l?"\u20B9 ":""}0.00${d}`;let N=t<0,p=Math.abs(t),u=(g&&p>=1e5?this.compactFormatter:this.currencyFormatter).format(p).replace("\u20B9","");return`${r}${N?"- ":""}${l?"\u20B9 ":""}${u}${d}`}static formatDate(t,a={}){let{format:r="dd-mm-yyyy",separator:d="-"}=a,l=new Date(t);if(isNaN(l.getTime()))return"";let g=String(l.getDate()).padStart(2,"0"),N=String(l.getMonth()+1).padStart(2,"0"),p=this.MONTH_NAMES_SHORT[l.getMonth()],v=l.getFullYear();switch(r){case"dd-mmm-yyyy":return`${g}${d}${p}${d}${v}`;case"iso":return l.toISOString().split("T")[0];case"long":return l.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return l.toLocaleDateString("en-IN");default:return`${g}${d}${N}${d}${v}`}}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,r,d)=>["-","'"," "].includes(a)||r>0&&["-","'"].includes(d[r-1])?a:a.charAt(0).toUpperCase()+a.slice(1)).join(""):""}static StatusBadge=({status:t,className:a,showDot:r=!0,capitalize:d=!0,size:l="md",variant:g="outline",customColors:N,icon:p,trueMessage:v="active",falseMessage:u="inactive"})=>{let S=typeof t=="boolean"?t?v:u:typeof t=="number"?t>0?v:u:t.toLowerCase(),E={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"}}},O=E[S.toLowerCase()]||E.inactive,F=N||O[g],k={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},G=d?S.charAt(0).toUpperCase()+S.slice(1):S;return(0,De.jsx)("div",{className:"flex justify-center",children:(0,De.jsxs)("span",{className:o("inline-flex items-center gap-1.5 rounded-full border font-medium",F.bg,F.text,F.border,k[l],a),children:[r&&(p?(0,De.jsx)("span",{className:"flex items-center",children:p}):(0,De.jsx)("span",{className:o("size-2 rounded-full",F.dot),"aria-hidden":"true"})),G]})})}};var mn=require("lucide-react"),Et=require("react-router"),X=require("react/jsx-runtime"),oa=()=>{let e=(0,Et.useRouteError)(),t=(0,Et.useNavigate)();return(0,X.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,X.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,X.jsx)(mn.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,Et.isRouteErrorResponse)(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,X.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,X.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,X.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,X.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,X.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,X.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),(0,X.jsx)(h,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var Ue=require("framer-motion");var A=require("react/jsx-runtime");function Zn({size:e=100,strokeWidth:t=2,color:a="currentColor",className:r=""}){return(0,A.jsxs)(Ue.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:r,children:[(0,A.jsx)("title",{children:"Animated Checkmark"}),(0,A.jsx)(Ue.motion.circle,{cx:"50",cy:"50",r:"40",stroke:a,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,A.jsx)(Ue.motion.path,{d:"M30 50L45 65L70 35",stroke:a,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function aa(){return(0,A.jsx)(Ke,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,A.jsxs)(Ye,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,A.jsx)(Ue.motion.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:(0,A.jsxs)("div",{className:"relative",children:[(0,A.jsx)(Ue.motion.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),(0,A.jsx)(Zn,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),(0,A.jsxs)(Ue.motion.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[(0,A.jsx)(Ue.motion.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),(0,A.jsx)("div",{className:"flex items-center gap-4",children:(0,A.jsx)(Ue.motion.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:(0,A.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,A.jsx)("title",{children:"From"}),(0,A.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,A.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,A.jsx)("title",{children:"To"}),(0,A.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,A.jsx)(Ue.motion.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}var wt=require("react/jsx-runtime"),na=()=>(0,wt.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,wt.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,wt.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,wt.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,wt.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var pn=require("react-router");var un=require("lucide-react"),To=require("react-router"),He=require("react/jsx-runtime"),ra=()=>{let e=(0,pn.useLocation)(),t=(0,To.useNavigate)(),a=()=>{window.history.length>2?t(-1):t("/")};return(0,He.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,He.jsx)(un.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,He.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,He.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,He.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,He.jsxs)("div",{className:"flex space-x-4",children:[(0,He.jsx)(h,{variant:"outline",onClick:a,children:"Go Back"}),(0,He.jsx)(h,{variant:"ghost",children:(0,He.jsx)(To.NavLink,{to:"/",children:"Return Home"})})]})]})};var gn=require("lucide-react"),Gt=require("react/jsx-runtime"),ia=()=>(0,Gt.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[(0,Gt.jsx)(gn.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Gt.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,Gt.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var fn=require("lucide-react");var So=require("react-router"),We=require("react/jsx-runtime"),sa=()=>{let e=(0,So.useNavigate)();return(0,We.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,We.jsx)(fn.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,We.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,We.jsx)("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),(0,We.jsxs)("div",{className:"flex space-x-4",children:[(0,We.jsx)(h,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,We.jsx)(h,{variant:"ghost",children:(0,We.jsx)(So.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppMetaProvider,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,createLayoutComponents,createPageTemplateHook,createTypedAppMetaContext});
2
+ "use strict";var Hr=Object.create;var Qt=Object.defineProperty;var jr=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var Ur=Object.getPrototypeOf,Wr=Object.prototype.hasOwnProperty;var qr=(e,t)=>{for(var o in t)Qt(e,o,{get:t[o],enumerable:!0})},vn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $r(t))!Wr.call(e,s)&&s!==o&&Qt(e,s,{get:()=>t[s],enumerable:!(n=jr(t,s))||n.enumerable});return e};var zt=(e,t,o)=>(o=e!=null?Hr(Ur(e)):{},vn(t||!e||!e.__esModule?Qt(o,"default",{value:e,enumerable:!0}):o,e)),Kr=e=>vn(Qt({},"__esModule",{value:!0}),e);var na={};qr(na,{AppContainer:()=>pr,AppContent:()=>hr,AppContentFooter:()=>en,AppContentHeader:()=>Qo,AppFooter:()=>vr,AppHeader:()=>br,AppSheet:()=>tn,CurrencyTransfer:()=>rn,DataTable:()=>Ho,DataTableActionBar:()=>jo,DataTableActionBarAction:()=>$o,DataTableActionBarSelection:()=>Uo,DataTemplate:()=>Ko,DataTemplateActionBar:()=>Jo,DataTemplateActionBarAction:()=>Xo,DataTemplateActionBarSelection:()=>Yo,ErrorComponent:()=>nn,GeneralHelper:()=>fo,Loader:()=>an,NotFound:()=>sn,OfflineUI:()=>ln,Unauthorized:()=>dn,getTableExportView:()=>Ut,readPersistedExternal:()=>Go});module.exports=Kr(na);var we=require("@tanstack/react-table"),Vo=require("lucide-react");var wn=require("radix-ui"),Nn=require("class-variance-authority");var yn=require("clsx"),Cn=require("tailwind-merge");function r(...e){return(0,Cn.twMerge)((0,yn.clsx)(e))}var Tn=require("react/jsx-runtime"),eo=(0,Nn.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 dark:focus-visible:border-ring",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?wn.Slot.Slot:"button";return(0,Tn.jsx)(i,{"data-slot":"button",className:r(eo({variant:t,size:o,className:e})),...s})}var Je=require("react/jsx-runtime");function So({className:e,...t}){return(0,Je.jsx)("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:(0,Je.jsx)("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",e),...t})})}function Sn({className:e,...t}){return(0,Je.jsx)("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",e),...t})}function Pn({className:e,...t}){return(0,Je.jsx)("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",e),...t})}function to({className:e,...t}){return(0,Je.jsx)("tfoot",{"data-slot":"table-footer",className:r("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function ze({className:e,...t}){return(0,Je.jsx)("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Dn({className:e,...t}){return(0,Je.jsx)("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Ve({className:e,...t}){return(0,Je.jsx)("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap",e),...t})}var Po=require("react/jsx-runtime");function Xe({className:e,...t}){return(0,Po.jsx)("div",{"data-slot":"card",className:r("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ye({className:e,...t}){return(0,Po.jsx)("div",{"data-slot":"card-content",className:r("px-6",e),...t})}var yt=require("radix-ui");var Ze=require("react/jsx-runtime");function Ct({delayDuration:e=0,...t}){return(0,Ze.jsx)(yt.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ot({...e}){return(0,Ze.jsx)(Ct,{children:(0,Ze.jsx)(yt.Tooltip.Root,{"data-slot":"tooltip",...e})})}function nt({...e}){return(0,Ze.jsx)(yt.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function rt({className:e,sideOffset:t=0,children:o,...n}){return(0,Ze.jsx)(yt.Tooltip.Portal,{children:(0,Ze.jsxs)(yt.Tooltip.Content,{"data-slot":"tooltip-content",sideOffset:t,className:r("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[o,(0,Ze.jsx)(yt.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var $=require("lucide-react");var kn=require("react/jsx-runtime");function Ft({className:e,type:t,...o}){return(0,kn.jsx)("input",{type:t,"data-slot":"input",className:r("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}var ge=require("radix-ui"),$t=require("lucide-react");var ae=require("react/jsx-runtime");function Fe({...e}){return(0,ae.jsx)(ge.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function Ae({...e}){return(0,ae.jsx)(ge.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Ie({className:e,sideOffset:t=4,...o}){return(0,ae.jsx)(ge.DropdownMenu.Portal,{children:(0,ae.jsx)(ge.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...o})})}function Do({...e}){return(0,ae.jsx)(ge.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function ee({className:e,inset:t,variant:o="default",...n}){return(0,ae.jsx)(ge.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:r("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function oo({className:e,children:t,checked:o,...n}){return(0,ae.jsxs)(ge.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:o,...n,children:[(0,ae.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,ae.jsx)(ge.DropdownMenu.ItemIndicator,{children:(0,ae.jsx)($t.CheckIcon,{className:"size-4"})})}),t]})}function pe({className:e,inset:t,...o}){return(0,ae.jsx)(ge.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:r("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function fe({className:e,...t}){return(0,ae.jsx)(ge.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:r("bg-border -mx-1 my-1 h-px",e),...t})}function Rn({...e}){return(0,ae.jsx)(ge.DropdownMenu.Sub,{"data-slot":"dropdown-menu-sub",...e})}function Mn({className:e,inset:t,children:o,...n}){return(0,ae.jsxs)(ge.DropdownMenu.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:r("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...n,children:[o,(0,ae.jsx)($t.ChevronRightIcon,{className:"ml-auto size-4"})]})}function zn({className:e,...t}){return(0,ae.jsx)(ge.DropdownMenu.SubContent,{"data-slot":"dropdown-menu-sub-content",className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var Jr=new Set(["select","serialNumber"]);function Ut(e){let t=e.getVisibleLeafColumns().filter(n=>Jr.has(n.id)?!1:!!n.columnDef.exportValue||!!n.accessorFn),o=e.getPrePaginationRowModel().rows;return{columns:t.map(n=>{let s=n.columnDef;return{id:n.id,header:s.exportHeader??(typeof s.header=="string"?s.header:n.id)}}),rows:o.map(n=>t.map(s=>{let i=s.columnDef;return i.exportValue?i.exportValue(n.original):n.getValue(s.id)})),originals:o.map(n=>n.original)}}var dt=require("react");var Jt=require("react"),Ln=require("lucide-react"),En=require("date-fns");var Wt=require("radix-ui");var qt=require("react/jsx-runtime");function Fn({...e}){return(0,qt.jsx)(Wt.Popover.Root,{"data-slot":"popover",...e})}function An({...e}){return(0,qt.jsx)(Wt.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function In({className:e,align:t="center",sideOffset:o=4,...n}){return(0,qt.jsx)(Wt.Popover.Portal,{children:(0,qt.jsx)(Wt.Popover.Content,{"data-slot":"popover-content",align:t,sideOffset:o,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}var no=zt(require("react"),1),At=require("lucide-react"),Kt=require("react-day-picker");var Qe=require("react/jsx-runtime");function Bn({className:e,classNames:t,showOutsideDays:o=!0,captionLayout:n="label",buttonVariant:s="ghost",formatters:i,components:u,...d}){let a=(0,Kt.getDefaultClassNames)();return(0,Qe.jsx)(Kt.DayPicker,{showOutsideDays:o,className:r("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:n,formatters:{formatMonthDropdown:m=>m.toLocaleString("default",{month:"short"}),...i},classNames:{root:r("w-fit",a.root),months:r("flex gap-4 flex-col md:flex-row relative",a.months),month:r("flex flex-col w-full gap-4",a.month),nav:r("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",a.nav),button_previous:r(eo({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_previous),button_next:r(eo({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",a.button_next),month_caption:r("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",a.month_caption),dropdowns:r("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",a.dropdowns),dropdown_root:r("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",a.dropdown_root),dropdown:r("absolute bg-popover inset-0 opacity-0",a.dropdown),caption_label:r("select-none font-medium",n==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",a.caption_label),table:"w-full border-collapse",weekdays:r("flex",a.weekdays),weekday:r("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",a.weekday),week:r("flex w-full mt-2",a.week),week_number_header:r("select-none w-(--cell-size)",a.week_number_header),week_number:r("text-[0.8rem] select-none text-muted-foreground",a.week_number),day:r("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",a.day),range_start:r("rounded-l-md bg-accent",a.range_start),range_middle:r("rounded-none",a.range_middle),range_end:r("rounded-r-md bg-accent",a.range_end),today:r("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",a.today),outside:r("text-muted-foreground aria-selected:text-muted-foreground",a.outside),disabled:r("text-muted-foreground opacity-50",a.disabled),hidden:r("invisible",a.hidden),...t},components:{Root:({className:m,rootRef:f,...p})=>(0,Qe.jsx)("div",{"data-slot":"calendar",ref:f,className:r(m),...p}),Chevron:({className:m,orientation:f,...p})=>f==="left"?(0,Qe.jsx)(At.ChevronLeftIcon,{className:r("size-4",m),...p}):f==="right"?(0,Qe.jsx)(At.ChevronRightIcon,{className:r("size-4",m),...p}):(0,Qe.jsx)(At.ChevronDownIcon,{className:r("size-4",m),...p}),DayButton:Xr,WeekNumber:({children:m,...f})=>(0,Qe.jsx)("td",{...f,children:(0,Qe.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...u},...d})}function Xr({className:e,day:t,modifiers:o,...n}){let s=(0,Kt.getDefaultClassNames)(),i=no.useRef(null);return no.useEffect(()=>{o.focused&&i.current?.focus()},[o.focused]),(0,Qe.jsx)(C,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":o.selected&&!o.range_start&&!o.range_end&&!o.range_middle,"data-range-start":o.range_start,"data-range-end":o.range_end,"data-range-middle":o.range_middle,className:r("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",s.day,e),...n})}var be=require("react/jsx-runtime");function Gn({value:e,onChange:t,placeholder:o,mode:n,externalSearch:s,onExternalChange:i,dateFormat:u,triggerClassName:d}){let a=u?u.replace(/Y/g,"y").replace(/D/g,"d"):null,[m,f]=(0,Jt.useState)(!1),[p,g]=(0,Jt.useState)(e);(0,Jt.useEffect)(()=>{g(e)},[e]);let c=y=>{if(y==null)return null;if(y instanceof Date)return isNaN(y.getTime())?null:y;let w=new Date(y);return isNaN(w.getTime())?null:w},z=(y,w)=>{let _=c(y);return _?(0,En.format)(_,w):null},S=y=>{s?i?.(y):t?.(y)},I=()=>{S(p),f(!1)},b=()=>{g(e),f(!1)},F=()=>{let y=n==="single"?null:{from:null,to:null};g(y),S(y),f(!1)},k=()=>{let y=e;if(!y)return o;if(n==="single")return z(y,a||"PPP")??o;if(y.from&&y.to){let w=z(y.from,a||"MMM dd"),_=z(y.to,a||"MMM dd, yyyy");return w&&_?`${w} - ${_}`:o}if(y.from){let w=z(y.from,a||"MMM dd, yyyy");return w?`From ${w}`:o}if(y.to){let w=z(y.to,a||"MMM dd, yyyy");return w?`To ${w}`:o}return o},x=y=>{g(n==="single"?y:y||{from:null,to:null})};return(0,be.jsxs)(Fn,{open:m,onOpenChange:f,children:[(0,be.jsx)(An,{className:"h-8",asChild:!0,children:(0,be.jsxs)(C,{variant:"outline",className:r("w-full justify-start text-left font-normal h-8 rounded-lg",k()===o&&"text-muted-foreground",d),children:[(0,be.jsx)(Ln.Calendar,{className:"mr-2 h-4 w-4 shrink-0"}),k()]})}),(0,be.jsxs)(In,{className:"w-auto p-0",align:"start",children:[(0,be.jsx)("div",{className:"p-3",children:(0,be.jsx)(Bn,{mode:n,selected:p,onSelect:x,numberOfMonths:n==="range"?2:1,className:"rounded-md border",...n==="range"&&{required:!0}})}),(0,be.jsxs)("div",{className:"flex items-center justify-between p-3 border-t",children:[(0,be.jsx)(C,{variant:"ghost",size:"sm",onClick:F,children:"Clear"}),(0,be.jsxs)("div",{className:"flex gap-2",children:[(0,be.jsx)(C,{variant:"outline",size:"sm",onClick:b,children:"Cancel"}),(0,be.jsx)(C,{size:"sm",onClick:I,disabled:n==="range"&&(!p?.from||!p?.to),children:"Apply"})]})]})]})]})}var Nt=require("lucide-react");var ko=require("radix-ui"),_n=require("lucide-react");var ro=require("react/jsx-runtime");function wt({className:e,...t}){return(0,ro.jsx)(ko.Checkbox.Root,{"data-slot":"checkbox",className:r("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,ro.jsx)(ko.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,ro.jsx)(_n.CheckIcon,{className:"size-3.5"})})})}var R=require("react/jsx-runtime"),On=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}],Ro=(e,t)=>(t&&e.startsWith(`${t}.`)?e.replace(`${t}.`,""):e).split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");function Mo(e,t){t&&Object.keys(e).forEach(o=>{let n=e[o];n&&t(o,{...n,enabled:!1,functions:[]})})}var Vn=e=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1);function Hn({table:e,aggregations:t,onAggregationChange:o}){let n=Vn(e).filter(d=>d.id==="select"||d.id==="serialNumber"?!1:d.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(a=>{let m=a.getValue(d.id);return typeof m=="number"||typeof m=="string"&&!isNaN(parseFloat(String(m)))||typeof m=="object"&&m!==null&&"props"in m}));if(n.length===0||!o)return null;let s=Object.values(t).some(d=>d?.enabled),i=d=>{let a=t[d];o(d,{enabled:!a?.enabled,functions:a?.functions||["sum","average"]})},u=(d,a)=>{let m=t[d]?.functions||[],f=m.includes(a)?m.filter(p=>p!==a):[...m,a];o(d,{enabled:f.length>0,functions:f})};return(0,R.jsxs)(Fe,{children:[(0,R.jsx)(Ae,{asChild:!0,children:(0,R.jsxs)(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,R.jsx)(Nt.Calculator,{className:"size-4"}),(0,R.jsx)("span",{children:"Aggregations"}),(0,R.jsx)(Nt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,R.jsxs)(Ie,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[(0,R.jsxs)(pe,{className:"flex items-center justify-between px-4 py-2",children:[(0,R.jsx)("span",{className:"text-sm font-medium",children:"Column Aggregations"}),s&&(0,R.jsx)(C,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>Mo(t,o),children:"Clear All"})]}),(0,R.jsx)(fe,{}),n.map(d=>{let a=t[d.id],m=a?.enabled;return(0,R.jsxs)(Rn,{children:[(0,R.jsx)(Mn,{className:"text-sm",children:(0,R.jsxs)("div",{className:"flex items-center w-full gap-2",children:[(0,R.jsx)(wt,{checked:m,onCheckedChange:()=>i(d.id),className:"data-[state=checked]:bg-primary"}),(0,R.jsx)("span",{className:r("flex-1",m&&"font-medium text-primary"),children:Ro(d.id)}),m&&(0,R.jsxs)("div",{className:"flex items-center gap-1",children:[a?.functions?.slice(0,2).map(f=>(0,R.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary",title:On.find(p=>p.value===f)?.label},f)),a?.functions&&a.functions.length>2&&(0,R.jsxs)("div",{className:"text-xs text-muted-foreground",children:["+",a.functions.length-2]})]})]})}),(0,R.jsxs)(zn,{className:"w-48 rounded-lg",children:[(0,R.jsx)(pe,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),On.map(f=>(0,R.jsx)(oo,{checked:a?.functions?.includes(f.value)||!1,onCheckedChange:()=>u(d.id,f.value),className:"py-2 text-sm",children:(0,R.jsxs)("div",{className:"flex flex-col",children:[(0,R.jsx)("span",{children:f.label}),(0,R.jsx)("span",{className:"text-xs text-muted-foreground",children:f.description})]})},f.value))]})]},d.id)})]})]})}function jn({table:e}){let t=Vn(e),o=e.getAllColumns().filter(i=>!e.getAllLeafColumns().includes(i)&&i.columns?.length&&i.columns.some(u=>u.getCanHide?.()!==!1)),n=new Set(o.flatMap(i=>i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>u.id)||[])),s=t.filter(i=>!n.has(i.id));return(0,R.jsxs)(Fe,{children:[(0,R.jsx)(Ae,{asChild:!0,children:(0,R.jsxs)(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[(0,R.jsx)(Nt.Columns3,{className:"size-4"}),(0,R.jsx)("span",{children:"Columns"}),(0,R.jsx)(Nt.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,R.jsxs)(Ie,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,R.jsx)(pe,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,R.jsx)(fe,{}),s.length>0&&(0,R.jsxs)(Do,{children:[(0,R.jsx)(pe,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),s.map(i=>(0,R.jsx)(oo,{className:"text-sm",checked:i.getIsVisible(),onCheckedChange:u=>i.toggleVisibility(!!u),children:Ro(i.id)},i.id))]}),o.map(i=>(0,R.jsxs)(Do,{children:[(0,R.jsx)(fe,{}),(0,R.jsx)(pe,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:i.id}),i.columns?.filter(u=>u.getCanHide?.()!==!1).map(u=>(0,R.jsx)(oo,{className:"text-sm",checked:u.getIsVisible(),onCheckedChange:d=>u.toggleVisibility(!!d),children:Ro(u.id,i.id)},u.id))]},i.id))]})]})}var he=require("radix-ui"),Tt=require("lucide-react");var Q=require("react/jsx-runtime");function at({...e}){return(0,Q.jsx)(he.Select.Root,{"data-slot":"select",...e})}function it({...e}){return(0,Q.jsx)(he.Select.Value,{"data-slot":"select-value",...e})}function st({className:e,size:t="default",children:o,...n}){return(0,Q.jsxs)(he.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:r("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[o,(0,Q.jsx)(he.Select.Icon,{asChild:!0,children:(0,Q.jsx)(Tt.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function lt({className:e,children:t,position:o="popper",...n}){return(0,Q.jsx)(he.Select.Portal,{children:(0,Q.jsxs)(he.Select.Content,{"data-slot":"select-content",className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:o,...n,children:[(0,Q.jsx)(Yr,{}),(0,Q.jsx)(he.Select.Viewport,{className:r("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,Q.jsx)(Zr,{})]})})}function He({className:e,children:t,...o}){return(0,Q.jsxs)(he.Select.Item,{"data-slot":"select-item",className:r("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...o,children:[(0,Q.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,Q.jsx)(he.Select.ItemIndicator,{children:(0,Q.jsx)(Tt.CheckIcon,{className:"size-4"})})}),(0,Q.jsx)(he.Select.ItemText,{children:t})]})}function Yr({className:e,...t}){return(0,Q.jsx)(he.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(Tt.ChevronUpIcon,{className:"size-4"})})}function Zr({className:e,...t}){return(0,Q.jsx)(he.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:r("flex cursor-default items-center justify-center py-1",e),...t,children:(0,Q.jsx)(Tt.ChevronDownIcon,{className:"size-4"})})}var v=require("react/jsx-runtime"),ce=e=>e.id??e.key;function zo({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:d=!1,enableColumnVisibility:a=!0,onClearSorting:m,onClearFilters:f,enableColumnPinning:p=!1,onExternalSearch:g,initialExternalValues:c,aggregations:z={},onAggregationChange:S,groupedFilterLabel:I="Global",showFilterChips:b=!0,initialGroupedField:F,onGroupedFieldChange:k}){let[x,y]=(0,dt.useState)(c??{}),[w,_]=(0,dt.useState)(F??"all"),j=(0,dt.useRef)(c??{}),Y=(0,dt.useRef)(void 0);(0,dt.useEffect)(()=>()=>clearTimeout(Y.current),[]);let W=(l,H,le=!1)=>{let Z={...j.current,[l]:H};j.current=Z,y(Z),clearTimeout(Y.current),le?Y.current=setTimeout(()=>g?.(Z),500):g?.(Z)},me=()=>{clearTimeout(Y.current),j.current={},y({}),_("all"),k?.("all"),f(),g?.({})},Te=l=>t.find(le=>ce(le)===l)?.externalSearch?x[l]??"":e.getColumn(l)?.getFilterValue(),ne=(l,H)=>{let le=t.find(Z=>ce(Z)===l);le?.externalSearch?W(l,H,le.type==="text"):e.getColumn(l)?.setFilterValue(H)},Ue=l=>{_(l),k?.(l),l!=="all"&&n("")},Ee=Object.values(z).some(l=>l?.enabled),kt=l=>!!e.getColumn(ce(l))||!!l.externalSearch,Se=l=>{let H=Te(ce(l));return H==null||H===""?!1:typeof H=="object"?!!(H.from||H.to):!0},gt=l=>l.type==="date"||l.type==="daterange",Ge=l=>{ne(ce(l),gt(l)?null:"")},ft=l=>{let H=Te(ce(l));return l.type==="select"?l.options?.find(le=>le.value===H)?.label??String(H):gt(l)?"set":String(H)},Pe=(l,H)=>{let le=H?.embedded;if(l.type==="select"){let Z=ce(l),bt=Te(Z);return(0,v.jsxs)(at,{value:bt?String(bt):"",onValueChange:De=>ne(Z,De==="__all__"?"":De),children:[(0,v.jsx)(st,{size:"sm",className:r("w-full",le?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),children:(0,v.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[l.icon&&(0,v.jsx)(l.icon,{className:"size-4 shrink-0 text-muted-foreground"}),(0,v.jsx)(it,{placeholder:l.placeholder})]})}),(0,v.jsxs)(lt,{className:"rounded-lg",children:[(0,v.jsx)(He,{value:"__all__",children:"All"}),l.options?.map(De=>(0,v.jsx)(He,{value:De.value,children:De.label},De.value))]})]})}return l.type==="date"||l.type==="daterange"?(0,v.jsx)(Gn,{value:Te(ce(l)),onChange:Z=>ne(ce(l),Z),placeholder:l.placeholder,mode:l.type==="daterange"?"range":"single",dateFormat:l.dateFormat,externalSearch:l.externalSearch,onExternalChange:Z=>W(ce(l),Z),triggerClassName:le?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":void 0}):(0,v.jsxs)("div",{className:"relative w-full",children:[l.icon&&(0,v.jsx)(l.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,v.jsx)(Ft,{placeholder:l.placeholder,value:Te(ce(l))??"",onChange:Z=>{ne(ce(l),Z.target.value)},className:r("h-8",l.icon&&"pl-9",le?"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]":"rounded-lg"),type:l.type==="number"?"number":"text"})]})},We=t.filter(l=>(l.placement??"bar")==="bar"),se=t.filter(l=>l.placement==="menu"),ye=s&&se.length>0,et=se.filter(Se),qe=e.getState().columnFilters.length>0||!!o||t.some(Se),{left:_e=[],right:Gt=[]}=e.getState().columnPinning,Oe=_e.some(l=>l!=="serialNumber"&&l!=="select")||Gt.length>0,Ke=[{value:"all",label:"All Fields"},...se.map(l=>({value:ce(l),label:l.placeholder}))];return(0,v.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[We.length>0&&(0,v.jsx)($.Filter,{className:"size-4 text-muted-foreground shrink-0"}),We.map(l=>kt(l)?(0,v.jsx)("div",{className:r("relative min-w-[150px]",l.width),children:Pe(l)},ce(l)):null),b&&et.map(l=>(0,v.jsxs)("span",{className:"inline-flex items-center gap-1 h-8 px-2 rounded-lg border bg-muted/50 text-sm",children:[(0,v.jsxs)("span",{className:"text-muted-foreground",children:[l.placeholder,":"]}),(0,v.jsx)("span",{className:"font-medium truncate max-w-[120px]",children:ft(l)}),(0,v.jsx)("button",{type:"button",onClick:()=>Ge(l),className:"ml-1 p-0.5 rounded hover:bg-accent","aria-label":`Clear ${l.placeholder}`,children:(0,v.jsx)($.X,{className:"size-3.5"})})]},`chip-${ce(l)}`)),qe&&(0,v.jsxs)(C,{variant:"ghost",size:"sm",onClick:me,className:"h-8 px-2 rounded-lg text-muted-foreground hover:text-foreground",children:[(0,v.jsx)($.FilterX,{className:"size-4"}),"Clear Filters"]}),(0,v.jsxs)("div",{className:"flex flex-wrap items-center gap-2 ml-auto",children:[s&&(0,v.jsxs)("div",{className:r("flex items-center",ye&&"bg-background border rounded-lg"),children:[ye&&(0,v.jsxs)(Fe,{children:[(0,v.jsx)(Ae,{asChild:!0,children:(0,v.jsxs)(C,{variant:"ghost",size:"sm",className:"gap-1 border border-transparent border-r-border rounded-l-lg rounded-r-none hover:bg-transparent shrink-0 relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",children:[(0,v.jsx)("span",{className:"text-sm font-medium max-w-28 truncate",children:w==="all"?I:Ke.find(l=>l.value===w)?.label}),(0,v.jsx)($.ChevronDown,{className:"opacity-50 size-4"})]})}),(0,v.jsx)(Ie,{align:"start",className:"w-48 rounded-lg",children:Ke.map(l=>(0,v.jsxs)(ee,{onClick:()=>Ue(l.value),className:"flex items-center justify-between",children:[(0,v.jsx)("span",{children:l.label}),w===l.value&&(0,v.jsx)($.Check,{className:"size-4 text-primary"})]},l.value))})]}),(()=>{let l=ye&&w!=="all"?se.find(H=>ce(H)===w):void 0;return l?(0,v.jsx)("div",{className:"w-48",children:Pe(l,{embedded:!0})}):(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)($.Search,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),(0,v.jsx)(Ft,{placeholder:ye?"Search all fields...":"Global search...",value:o??"",onChange:H=>n(H.target.value),className:r("pl-9 h-8 w-48",ye&&"border border-transparent rounded-l-none rounded-r-lg shadow-none relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]")})]})})()]}),(0,v.jsx)(Hn,{table:e,aggregations:z,onAggregationChange:S}),a&&(0,v.jsx)(jn,{table:e}),(0,v.jsxs)(Fe,{children:[(0,v.jsx)(Ae,{asChild:!0,children:(0,v.jsx)(C,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,v.jsx)($.Settings2,{className:"size-4"})})}),(0,v.jsxs)(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[(0,v.jsx)(pe,{children:"Table Settings"}),(0,v.jsx)(fe,{}),i&&(0,v.jsxs)(ee,{onClick:()=>{let l=Ut(e);i(l.originals,l)},children:[(0,v.jsx)($.Download,{className:"size-4"}),"Export"]}),(0,v.jsxs)(ee,{onClick:m,disabled:e.getState().sorting.length===0,children:[(0,v.jsx)($.ArrowUpDown,{className:"size-4"}),"Clear All Sorting"]}),(0,v.jsxs)(ee,{onClick:me,disabled:!qe,children:[(0,v.jsx)($.Filter,{className:"size-4"}),"Clear All Filters"]}),Object.keys(z).length>0&&(0,v.jsxs)(ee,{onClick:()=>Mo(z,S),disabled:!Ee,children:[(0,v.jsx)($.Calculator,{className:"size-4"}),"Clear Aggregations"]}),p&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(fe,{}),(0,v.jsx)(pe,{children:"Column Pinning"}),(0,v.jsxs)(ee,{onClick:()=>e.setColumnPinning({left:[],right:[]}),disabled:!Oe,children:[(0,v.jsx)($.PinOff,{className:"size-4"}),"Reset All Pinning"]})]})]})]}),u&&(0,v.jsx)(C,{variant:"outline",size:"sm",onClick:u,disabled:d,className:"rounded-lg",children:(0,v.jsx)($.RefreshCw,{className:r("h-4 w-4",d&&"animate-spin")})})]})]})}var ao=require("lucide-react");var q=require("react/jsx-runtime");function Qr(e,t,o=1){let n=e+1,s=o*2+5;if(t<=s)return Array.from({length:t},(p,g)=>g+1);let i=Math.max(n-o,1),u=Math.min(n+o,t),d=i>2,a=u<t-1,m=3+o*2,f=[];if(!d&&a){for(let p=1;p<=m;p++)f.push(p);f.push("ellipsis",t)}else if(d&&!a){f.push(1,"ellipsis");for(let p=t-m+1;p<=t;p++)f.push(p)}else{f.push(1,"ellipsis");for(let p=i;p<=u;p++)f.push(p);f.push("ellipsis",t)}return f}function Fo({table:e,config:t}){if(!t)return null;let o=e.getPageCount(),n=e.getState().pagination.pageIndex,s=e.getState().pagination.pageSize,i=e.getFilteredRowModel().rows.length,u="size-8 p-0 rounded-lg";return(0,q.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl",children:[t.showInfo!==!1&&(0,q.jsxs)("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:["Showing ",i===0?0:n*s+1," to"," ",Math.min((n+1)*s,i)," of ",i," entries"]}),(0,q.jsxs)("div",{className:"flex items-center gap-3",children:[(()=>{let d=t.pageSizeOptions??[10,25,50,100,-1];if(d.length===0)return null;let a=d.includes(-1),m=i>0&&s>=i,f=a&&m?"-1":`${s}`;return(0,q.jsxs)("div",{className:"flex items-center gap-2",children:[(0,q.jsx)("span",{className:"hidden text-sm font-medium md:inline",children:"Rows"}),(0,q.jsxs)(at,{value:f,onValueChange:p=>e.setPageSize(p==="-1"?Math.max(i,1):Number(p)),children:[(0,q.jsx)(st,{className:"h-8 w-auto min-w-[4rem] gap-1 rounded-lg",children:(0,q.jsx)(it,{})}),(0,q.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(p=>(0,q.jsx)(He,{value:`${p}`,children:p===-1?"All":p},p))})]})]})})(),o>1&&(0,q.jsxs)("div",{className:"flex items-center gap-1",children:[(0,q.jsx)(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),"aria-label":"Previous page",className:u,children:(0,q.jsx)(ao.ChevronLeft,{className:"size-4"})}),t.showPageNumbers&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("span",{className:"px-2 text-sm text-muted-foreground tabular-nums sm:hidden",children:[n+1," / ",o]}),(0,q.jsx)("div",{className:"hidden items-center gap-1 sm:flex",children:Qr(n,o).map((d,a)=>d==="ellipsis"?(0,q.jsx)("span",{className:"flex size-8 items-center justify-center text-sm text-muted-foreground",children:"\u2026"},`e${a}`):(0,q.jsx)(C,{variant:d-1===n?"default":"outline",size:"sm",className:r(u,"tabular-nums"),onClick:()=>e.setPageIndex(d-1),"aria-label":`Page ${d}`,"aria-current":d-1===n?"page":void 0,children:d},d))})]}),(0,q.jsx)(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),"aria-label":"Next page",className:u,children:(0,q.jsx)(ao.ChevronRight,{className:"size-4"})})]})]})]})}var M=require("react");function St(e,t){if(!t)return{};let o=e.getIsPinned();if(!o)return{};let n=e.getSize();return{position:"sticky",left:o==="left"?e.getStart("left"):void 0,right:o==="right"?e.getAfter("right"):void 0,width:n,minWidth:n,maxWidth:n,boxShadow:o==="right"&&e.getIsFirstColumn("right")?"inset 1px 0 0 0 var(--border)":void 0}}var Be=(e,t)=>t||e!==150?e:"auto";function $n(e,t){return{left:[...t,...(e.left??[]).filter(o=>!t.includes(o))],right:(e.right??[]).filter(o=>!t.includes(o))}}function Un(e,t,o,n){if(o===!1)e.setColumnSizing(d=>{let a={...d};return delete a[t],a});else{let d=n.container?.querySelector(`[data-col-id="${t}"]`),a=d?Math.round(d.getBoundingClientRect().width):0;a>0&&e.setColumnSizing(m=>({...m,[t]:a}))}let{alwaysPinnedLeft:s}=n,i=e.getState().columnPinning,u={left:(i.left??[]).filter(d=>s.includes(d)),right:[...i.right??[]]};o==="right"?u.right.includes(t)||u.right.push(t):o==="left"?(u.right=u.right.filter(d=>d!==t),!u.left.includes(t)&&!s.includes(t)&&u.left.push(t)):(u.left=u.left.filter(d=>d!==t),u.right=u.right.filter(d=>d!==t)),e.setColumnPinning(u)}var Wn={sum:e=>e.reduce((t,o)=>t+o,0),average:e=>e.length>0?e.reduce((t,o)=>t+o,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((n,s)=>n-s),o=Math.floor(t.length/2);return t.length%2===0?(t[o-1]+t[o])/2:t[o]}};function qn(e,t){if(!t||Object.keys(t).length===0)return{};let o={},n=e.getFilteredRowModel().rows;return Object.entries(t).forEach(([s,i])=>{if(!i?.enabled)return;let u=n.map(a=>{if(i.accessor)return i.accessor(a.original);let m=a.getValue(s);return typeof m=="number"?m:parseFloat(String(m))}).filter(a=>a!==null&&!isNaN(a)),d={};i.functions?.forEach(a=>{Wn[a]&&(d[a]=Wn[a](u))}),Object.keys(d).length>0&&(o[s]=d)}),o}function Kn(e,t){return typeof t=="number"?e==="count"||e==="unique"?t.toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):t}function ea(e,t){return t.split(".").reduce((o,n)=>o&&o[n],e)}function Jn(e,t=new Set){for(let o of e){let n=o.id??o.accessorKey;n&&t.add(String(n)),o.columns&&Jn(o.columns,t)}return t}function io(e,t){let o=Jn(e),n=[];for(let s of t){if(s.externalSearch)continue;let i=typeof s.filterFn=="function",u=i?s.id:s.key;if(!u||o.has(String(u)))continue;let d=s.key;n.push({id:String(u),accessorFn:d?a=>ea(a,d):()=>null,...i&&{filterFn:(a,m,f)=>s.filterFn(a.original,f)},enableHiding:!1,enableSorting:!1,enablePinning:!1,enableGlobalFilter:!1,meta:{filterOnly:!0}})}return n}var It=require("react/jsx-runtime");function Xn({initialColumns:e,filters:t,showSerialNumbers:o,enableRowSelection:n,selectionMode:s,showCheckbox:i,enableHeaderCheckbox:u,isRowSelectable:d}){let a=p=>p.map(g=>{if(g.id==="select"||g.id==="serialNumber")return g;let c={...g,enablePinning:!0};return g.columns&&(c.columns=a(g.columns)),c}),m=a([...e]),f={id:"select",header:({table:p})=>{if(s==="single")return null;let g=p.getRowModel().rows.filter(S=>d?.(S.original)??!0),c=g.length>0&&g.every(S=>S.getIsSelected()),z=g.some(S=>S.getIsSelected());return(0,It.jsx)(wt,{checked:c||z&&"indeterminate",onCheckedChange:S=>{g.forEach(I=>I.toggleSelected(!!S))},disabled:!u||g.length===0,"aria-label":"Select all selectable rows"})},cell:({row:p})=>{let g=d?.(p.original)??!0;return(0,It.jsx)("div",{className:r("flex justify-center items-center",!g&&"opacity-50"),children:s==="multiple"?(0,It.jsx)(wt,{checked:p.getIsSelected(),onCheckedChange:c=>g&&p.toggleSelected(!!c),"aria-label":"Select row",disabled:!g}):i?(0,It.jsx)("input",{type:"radio",checked:p.getIsSelected(),onChange:()=>g&&p.toggleSelected(!0),disabled:!g,className:"border-primary rounded-full focus:ring-primary w-4 h-4 text-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:s==="multiple"?40:30};return n&&m.unshift(f),o&&m.unshift({id:"serialNumber",header:"No.",cell:({row:p})=>(0,It.jsx)("div",{className:"font-medium text-muted-foreground text-center",children:p.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"}),[...m,...io(e,t)]}var ct=require("react");var Yn="atsui:tbl:v1:",Bo=new Map,Zn=new Map;function Lo(e){try{let t=localStorage.getItem(Yn+e);return t?JSON.parse(t):void 0}catch{return}}function Qn(e,t){try{localStorage.setItem(Yn+e,JSON.stringify(t))}catch{}}function er(e){return e?typeof e=="string"?{key:e}:e:null}function Eo(e,t){return Bo.get(e)??(t?Lo(e):void 0)??{}}function Pt(e,t,o){let n={...Eo(e,t),...o};Bo.set(e,n),t&&Qn(e,n)}var Io=new Map;function tr(e,t){let o=Io.get(e);return o||(o=new Set,Io.set(e,o)),o.add(t),()=>{o.delete(t)}}function so(e){return{...Lo("g:"+e)??{},...Zn.get(e)??{}}}function lo(e,t,o,n){let s=so(e),i=n==null||n==="";if(i?s[o]===void 0:s[o]===n)return;let u={...s};i?delete u[o]:u[o]=n,Zn.set(e,u),t&&Qn("g:"+e,u),Io.get(e)?.forEach(d=>d())}function or(e,t){if(Pt(e.key,e.local,{filters:{},globalFilter:"",external:{},groupedField:"all"}),e.group)for(let o of t)lo(e.group,e.local,o,void 0)}function Go(e){return(Bo.get(e)??Lo(e))?.external??{}}var Ao=new Set;function nr(e){return Ao.has(e)&&console.warn(`[DataTable] persist key "${e}" is used by two mounted tables \u2014 they will overwrite each other's saved state. Give each table a unique key.`),Ao.add(e),()=>{Ao.delete(e)}}var _o=e=>{if(e==null||e instanceof Date)return e;let t=new Date(e);return isNaN(t.getTime())?e:t},rr=e=>{if(e&&typeof e=="object"&&("from"in e||"to"in e)){let t=_o(e.from),o=_o(e.to);return t===e.from&&o===e.to?e:{from:t,to:o}}return _o(e)};function ar(e,t,o){let n=er(e),s=t.map(b=>({id:String(b.id??b.key),shared:b.shared,persist:b.persist!==!1,external:!!b.externalSearch,isDate:b.type==="date"||b.type==="daterange"})),i=(0,ct.useRef)(s);i.current=s;let u=(0,ct.useMemo)(()=>{if(!n)return{columnFilters:[],globalFilter:"",pagination:{pageIndex:0,pageSize:o},external:{},groupedField:"all"};let b=Eo(n.key,n.local),F=n.group?so(n.group):{},k=w=>{let _=w.shared&&n.group?F[w.shared]:b.filters?.[w.id]??b.external?.[w.id];return w.isDate?rr(_):_},x=[],y={};for(let w of s){if(!w.persist)continue;let _=k(w);_==null||_===""||(w.external?y[w.id]=_:x.push({id:w.id,value:_}))}return{columnFilters:x,globalFilter:b.globalFilter??"",pagination:{pageIndex:n.pagination!==!1?b.pagination?.pageIndex??0:0,pageSize:n.pagination!==!1?b.pagination?.pageSize??o:o},external:y,groupedField:b.groupedField??"all"}},[]),d=(0,ct.useRef)(u.pagination.pageIndex),a=(0,ct.useRef)(u.pagination.pageIndex===0);return(0,ct.useEffect)(()=>{if(n)return!n.group&&i.current.some(b=>b.shared)&&console.warn(`[DataTable] persist key "${n.key}": filters use \`shared\` but the table has no \`persist.group\` \u2014 shared is inert. Add a group to enable it.`),nr(n.key)},[]),{enabled:!!n,initial:u,persistFilters:b=>{if(!n)return;let F={};for(let x of b)F[x.id]=x.value;let k={};for(let x of i.current)!x.persist||x.external||(x.shared&&n.group?lo(n.group,n.local,x.shared,F[x.id]):F[x.id]!==void 0&&(k[x.id]=F[x.id]));Pt(n.key,n.local,{filters:k})},persistGlobalFilter:b=>{n&&Pt(n.key,n.local,{globalFilter:b})},persistExternal:b=>{if(!n)return;let F={};for(let k of i.current)!k.persist||!k.external||(k.shared&&n.group?lo(n.group,n.local,k.shared,b[k.id]):b[k.id]!==void 0&&(F[k.id]=b[k.id]));Pt(n.key,n.local,{external:F})},persistPagination:b=>{!n||n.pagination===!1||a.current&&Pt(n.key,n.local,{pagination:{pageIndex:b.pageIndex,pageSize:b.pageSize}})},persistGroupedField:b=>{n&&Pt(n.key,n.local,{groupedField:b})},restorePageIndex:(b,F)=>{if(!n||a.current||b.getCoreRowModel().rows.length===0)return;let k=Math.min(d.current,Math.max(b.getPageCount()-1,0));a.current=!0,k>0&&F({pageIndex:k,pageSize:b.getState().pagination.pageSize})},syncSharedSlots:b=>{if(!n?.group)return;let F=n.group,k=i.current.filter(x=>x.shared&&x.persist&&!x.external);if(k.length!==0)return tr(F,()=>{let x=so(F);for(let y of k){let w=b.getColumn(y.id);if(!w)continue;let _=x[y.shared],j=_===void 0?void 0:y.isDate?rr(_):_,Y=w.getFilterValue();Object.is(Y??void 0,j??void 0)||w.setFilterValue(j)}})},clearAll:()=>{n&&or(n,i.current.filter(b=>b.shared).map(b=>b.shared))}}}var Oo=require("@tanstack/react-table"),te=require("lucide-react");var P=require("react/jsx-runtime");function ir({table:e,aggregations:t,enableColumnPinning:o,enableColumnResizing:n,enableColumnVisibility:s,enableRowSelection:i,fixedCheckboxColumn:u,bordered:d,compact:a,onPinColumn:m}){let f=e.getVisibleLeafColumns().filter(g=>!g.getIsPinned()),p=f[f.length-1]?.id;return(0,P.jsx)(P.Fragment,{children:e.getHeaderGroups().map(g=>(0,P.jsx)(ze,{className:"hover:bg-transparent",children:g.headers.map((c,z)=>{let S=c.depth===0&&c.colSpan>1,I=o&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&i),b=o&&c.column.getIsPinned()==="right",F=c.column.getCanSort(),k=o&&c.column.columnDef.enablePinning!==!1,x=c.column.id==="serialNumber",y=c.column.id==="select",w=x||y&&u,_=c.column.columnDef.headerAlign||"left",j=t&&t[c.column.id]?.enabled,Y=s&&!w&&c.column.getCanHide(),W=F||k&&!w||Y,me=c.column.getIsSorted(),Te={left:"justify-start",center:"justify-center",right:"justify-end"}[_];return(0,P.jsxs)(Dn,{colSpan:c.colSpan,"data-col-id":S?void 0:c.column.id,className:r("group bg-sidebar px-0 font-semibold text-foreground",!a&&"py-2",d&&z<g.headers.length-1&&c.column.id!==p&&"border-r","relative",I&&"sticky left-0 z-25 bg-sidebar/95",b&&"sticky right-0 z-25 bg-sidebar/95",(x||y)&&"sticky left-0 z-25 bg-sidebar/95",S?"text-center":"text-left"),style:{width:Be(c.getSize(),I||b),minWidth:Be(c.getSize(),I||b),...St(c.column,o)},children:[S?(0,P.jsxs)("div",{className:"flex justify-center items-center",children:[(0,Oo.flexRender)(c.column.columnDef.header,c.getContext()),j&&(0,P.jsx)(te.Calculator,{className:"ml-1 w-3 h-3 text-primary"})]}):(0,P.jsxs)("div",{className:r("relative flex items-center px-2 w-full",Te,F&&"cursor-pointer select-none"),onClick:F?ne=>{ne.target.closest("button, a, input, select, [role=button], [role=checkbox]")||c.column.getToggleSortingHandler()?.(ne)}:void 0,children:[(0,P.jsxs)("div",{className:r("flex items-center gap-1 min-w-0 max-w-full",me&&"pr-6"),children:[j&&(0,P.jsx)(te.Calculator,{className:"mr-1 w-3 h-3 text-primary shrink-0"}),c.isPlaceholder?null:(0,P.jsx)("span",{className:"truncate",children:(0,Oo.flexRender)(c.column.columnDef.header,c.getContext())})]}),(W||F)&&(0,P.jsxs)("div",{className:"absolute inset-y-0 right-0 flex items-center pl-8 pr-1 pointer-events-none",children:[(0,P.jsx)("div",{className:r("absolute inset-0 bg-gradient-to-l from-sidebar from-45% to-transparent","transition-opacity duration-200 ease-out","opacity-0 group-hover:opacity-100 group-has-[[data-state=open]]:opacity-100")}),F&&(0,P.jsx)("span",{className:"relative shrink-0",children:me?me==="asc"?(0,P.jsx)(te.ChevronUp,{className:"w-4 h-4"}):(0,P.jsx)(te.ChevronDown,{className:"w-4 h-4"}):(0,P.jsx)(te.ChevronsUpDown,{className:"w-3.5 h-3.5 opacity-0 group-hover:opacity-40 transition-opacity"})}),W&&(0,P.jsxs)(Fe,{children:[(0,P.jsx)(Ae,{asChild:!0,children:(0,P.jsx)(C,{variant:"ghost",size:"icon",tabIndex:-1,"aria-label":"Column options",onClick:ne=>ne.stopPropagation(),className:r("relative size-6 rounded-sm pointer-events-auto overflow-hidden","bg-sidebar hover:bg-border dark:bg-sidebar dark:hover:bg-accent","w-0 opacity-0 ml-0 group-hover:w-5 group-hover:opacity-100",F&&"group-hover:ml-0.5","data-[state=open]:w-5 data-[state=open]:opacity-100",F&&"data-[state=open]:ml-0.5","transition-all duration-200 ease-out"),children:(0,P.jsx)(te.MoreHorizontal,{className:"w-4 h-4"})})}),(0,P.jsxs)(Ie,{align:"end",className:"w-48",onClick:ne=>ne.stopPropagation(),children:[F&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(pe,{children:"Sorting"}),(0,P.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!1),disabled:me==="asc",children:[(0,P.jsx)(te.ChevronUp,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),(0,P.jsxs)(ee,{onClick:()=>c.column.toggleSorting(!0),disabled:me==="desc",children:[(0,P.jsx)(te.ChevronDown,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),(0,P.jsxs)(ee,{onClick:()=>c.column.clearSorting(),disabled:!me,children:[(0,P.jsx)(te.ChevronsUpDown,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),(k&&!w||Y)&&(0,P.jsx)(fe,{})]}),k&&!w&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(pe,{children:"Pin Column"}),(0,P.jsxs)(ee,{onClick:()=>m(c.column.id,"right"),disabled:c.column.getIsPinned()==="right",children:[(0,P.jsx)(te.MoveRightIcon,{}),"Pin Right"]}),(0,P.jsxs)(ee,{onClick:()=>m(c.column.id,!1),disabled:!c.column.getIsPinned(),children:[(0,P.jsx)(te.PinOffIcon,{}),"Unpin"]}),Y&&(0,P.jsx)(fe,{})]}),Y&&(0,P.jsxs)(ee,{onClick:()=>c.column.toggleVisibility(!1),children:[(0,P.jsx)(te.EyeOff,{className:"mr-2 w-4 h-4"}),"Hide Column"]})]})]})]})]}),(0,P.jsx)("div",{className:r("absolute bottom-0 inset-x-0 pointer-events-none",j?"h-0.5 bg-primary/40":"h-px bg-border")}),n&&c.column.getCanResize()&&!S&&c.colSpan===1&&(0,P.jsx)("div",{className:"top-0 right-0 absolute hover:bg-primary opacity-0 hover:opacity-100 bg-border w-1 h-full transition-opacity cursor-col-resize select-none touch-none",onMouseDown:c.getResizeHandler(),onTouchStart:c.getResizeHandler(),onClick:ne=>ne.stopPropagation()})]},c.id)})},g.id))})}var xe=require("react/jsx-runtime");function sr({table:e,columnAggregations:t,aggregations:o,enableColumnPinning:n,enableRowSelection:s,showSerialNumbers:i,compact:u}){let d=Object.keys(t).length>0,a=e.getHeaderGroups()[0]?.headers.some(c=>c.column.columnDef.customFooter),m=i&&e.getFilteredRowModel().rows.length>0&&(d||a),f=e.getHeaderGroups()[0]?.headers.length??0,p=e.getVisibleLeafColumns().filter(c=>!c.getIsPinned()),g=p[p.length-1]?.id;return!d&&!a&&!m?null:(0,xe.jsx)(to,{className:"bottom-0 z-20 sticky bg-sidebar border-t-0 shadow-[0_1px_0_0_var(--border)]",children:(0,xe.jsx)(ze,{className:"bg-sidebar hover:bg-transparent",children:e.getHeaderGroups()[0]?.headers.map((c,z)=>{let S=c.column.id,I=t[S],b=n&&(c.column.getIsPinned()==="left"||c.column.id==="serialNumber"||c.column.id==="select"&&s),F=n&&c.column.getIsPinned()==="right",k=c.column.id==="serialNumber",x=c.column.id==="select",w=c.column.columnDef.customFooter;return I||w||k&&m?(0,xe.jsxs)(Ve,{className:r("relative px-2 py-2 font-semibold text-sm",z<f-1&&"border-r",u&&"py-1",b&&"sticky left-0 z-30 bg-sidebar",F&&"sticky right-0 z-30 bg-sidebar",(k||x)&&"sticky left-0 z-30 bg-sidebar",w?.className),style:{width:Be(c.getSize(),b||F),minWidth:Be(c.getSize(),b||F),...St(c.column,n)},children:[(0,xe.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"}),(()=>{if(w?.content){let j=typeof w.content=="function"?w.content(e):w.content;return(0,xe.jsx)("div",{className:r("w-full h-full",w.align==="center"&&"text-center",w.align==="right"&&"text-right",w.align==="left"&&"text-left"),children:j})}return I?(0,xe.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(I).map(([j,Y])=>(0,xe.jsxs)("div",{className:"flex justify-between items-center text-muted-foreground",children:[(0,xe.jsx)("span",{className:"text-xs capitalize",children:j}),(0,xe.jsx)("span",{className:"font-medium text-foreground",children:o?.[S]?.format?.(Y,j)??Kn(j,Y)})]},j))}):k&&m?(0,xe.jsxs)("div",{className:"text-muted-foreground text-xs text-center",children:["Total ",e.getFilteredRowModel().rows.length]}):null})()]},`agg-${c.id}`):(0,xe.jsx)(Ve,{className:r("relative px-0 py-0",z<f-1&&c.column.id!==g&&"border-r",u&&"py-0",b&&"sticky left-0 z-30 bg-sidebar",F&&"sticky right-0 z-30 bg-sidebar",(k||x)&&"sticky left-0 z-30 bg-sidebar"),style:{width:Be(c.getSize(),b||F),minWidth:Be(c.getSize(),b||F),...St(c.column,n)},children:(0,xe.jsx)("div",{className:"absolute top-0 inset-x-0 h-px bg-border pointer-events-none"})},`agg-${c.id}`)})})})}var T=require("react/jsx-runtime");function Ho({data:e,columns:t,filters:o=[],pagination:n,settings:s={},header:i,footer:u,className:d="",maxHeight:a="100%",loading:m=!1,error:f,emptyMessage:p="No data available",onRowSelectionChange:g,onExport:c,onRefresh:z,onTableReady:S,children:I,isRowSelectable:b,getRowId:F,defaultSelectedRows:k,onExternalSearch:x,aggregations:y={},onAggregationChange:w,rowClassName:_,persist:j}){let Y=!!n,W=ar(j,o,n?.pageSize||10),me=(0,M.useRef)(W.initial.external),[Te,ne]=(0,M.useState)([]),[Ue,Ee]=(0,M.useState)(W.initial.columnFilters),[kt,Se]=(0,M.useState)(W.initial.pagination),[gt,Ge]=(0,M.useState)(()=>Object.fromEntries(io(t,o).map(h=>[h.id,!1]))),[ft,Pe]=(0,M.useState)({}),[We,se]=(0,M.useState)(W.initial.globalFilter),[ye,et]=(0,M.useState)([]),[qe,_e]=(0,M.useState)(s.enableColumnPinning!==!1?{left:[...s.showSerialNumbers!==!1?["serialNumber"]:[],...s.enableRowSelection!==!1?["select"]:[]],right:[]}:{}),Gt=(0,M.useRef)(null),Oe=(0,M.useRef)(null),Ke=(0,M.useRef)(null),l=(0,M.useRef)(null),[H,le]=(0,M.useState)(0),[Z,bt]=(0,M.useState)(0),[De,ho]=(0,M.useState)(0),tt=(0,M.useRef)(null),[_t,Yt]=(0,M.useState)(!1),{enableSorting:xt=!0,enableFiltering:Ot=!0,enableGlobalFilter:Vt=!0,enableColumnVisibility:Rt=!0,enableRowSelection:D=!0,showToolbar:L=!1,enableHeaderCheckbox:E=!0,toolbarPosition:oe="default",showSerialNumbers:re=!0,fixedCheckboxColumn:ke=!0,striped:ht=!0,hoverable:vt=!0,compact:Zt=!0,bordered:vo=!0,fullHeight:cn=!1,enableColumnResizing:un=!1,enableColumnPinning:Re=!0,showHeader:Pr=!0,selectionMode:Mt="multiple",showCheckbox:mn=!0,groupedFilterLabel:Dr="Global",showFilterChips:kr=!0}=s;(0,M.useEffect)(()=>{o.length>0&&!L&&console.warn("[DataTable] `filters` are provided but settings.showToolbar is off \u2014 filters live in the toolbar, so none will render."),o.some(h=>h.placement==="menu")&&!Vt&&console.warn("[DataTable] placement:'menu' filters are reached through the global search's field picker \u2014 with enableGlobalFilter off they are unreachable (only their chips would show).")},[]),(0,M.useEffect)(()=>{let h=()=>{tt.current&&Yt(tt.current.scrollTop>0)},V=tt.current;if(V)return V.addEventListener("scroll",h),()=>V.removeEventListener("scroll",h)},[]),(0,M.useEffect)(()=>{let h=()=>{Oe.current&&le(Oe.current.offsetHeight+16),Ke.current&&bt(Ke.current.offsetHeight+16),l.current&&ho(l.current.offsetHeight+16)};h();let V=new ResizeObserver(()=>{setTimeout(h,50)});return Oe.current&&V.observe(Oe.current),Ke.current&&V.observe(Ke.current),l.current&&V.observe(l.current),()=>{V.disconnect()}},[L,i,oe]);let Rr=h=>Ee(V=>{let de=typeof h=="function"?h(V):h;return W.persistFilters(de),de}),pn=h=>se(V=>{let de=typeof h=="function"?h(V):h;return W.persistGlobalFilter(de),de}),Mr=h=>Se(V=>{let de=typeof h=="function"?h(V):h;return W.persistPagination(de),de}),zr=h=>{me.current=h,W.persistExternal(h),x?.(h)},yo=(0,M.useMemo)(()=>Xn({initialColumns:t,filters:o,showSerialNumbers:re,enableRowSelection:D,selectionMode:Mt,showCheckbox:mn,enableHeaderCheckbox:E,isRowSelectable:b}),[t,o,re,D,b,Mt,mn,E]),O=(0,we.useReactTable)({data:e,columns:yo,getRowId:F,onSortingChange:xt?ne:void 0,onColumnFiltersChange:Ot?Rr:void 0,onGlobalFilterChange:Vt?pn:void 0,getCoreRowModel:(0,we.getCoreRowModel)(),getPaginationRowModel:Y?(0,we.getPaginationRowModel)():void 0,getSortedRowModel:xt?(0,we.getSortedRowModel)():void 0,getFilteredRowModel:Ot?(0,we.getFilteredRowModel)():void 0,onColumnVisibilityChange:Rt?Ge:void 0,onRowSelectionChange:D?Pe:void 0,onColumnOrderChange:et,onColumnPinningChange:Re?h=>_e(V=>$n(typeof h=="function"?h(V):h,[...re?["serialNumber"]:[],...D?["select"]:[]])):void 0,state:{sorting:xt?Te:void 0,columnFilters:Ot?Ue:void 0,columnVisibility:Rt?gt:void 0,rowSelection:D?ft:{},globalFilter:We,pagination:Y?kt:void 0,columnOrder:ye,columnPinning:Re?qe:{}},onPaginationChange:Y?Mr:void 0,initialState:{columnPinning:Re?{left:[...re?["serialNumber"]:[],...D?["select"]:[]],right:[]}:void 0},enableRowSelection:D?h=>b?.(h.original)??!0:!1,enableColumnResizing:un,enableColumnPinning:Re,columnResizeMode:"onChange"}),Co=(0,M.useMemo)(()=>qn(O,y),[O,y,e,Ue,We]),Fr=(0,M.useMemo)(()=>Object.keys(Co).length>0||yo.some(h=>h.customFooter),[Co,yo]),gn=(0,M.useRef)({onRowSelectionChange:g,isRowSelectable:b});gn.current={onRowSelectionChange:g,isRowSelectable:b};let fn=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(fn.current||!k||!D)return;let h=O.getCoreRowModel().rows;if(h.length===0)return;let V={};for(let de of h)de.getCanSelect()&&k(de.original)&&(V[de.id]=!0);fn.current=!0,Object.keys(V).length>0&&Pe(V)},[k,D,O,e]),(0,M.useEffect)(()=>{let{onRowSelectionChange:h,isRowSelectable:V}=gn.current;if(D&&h){let de=O.getFilteredSelectedRowModel().rows.filter(jt=>V?.(jt.original)??!0).map(jt=>jt.original);h(de)}},[ft,D,O]);let Ar=(0,M.useCallback)(h=>{Mt==="single"?(O.resetRowSelection(),h.toggleSelected(!0)):h.toggleSelected()},[Mt,O]),bn=(0,M.useRef)(S);bn.current=S,(0,M.useEffect)(()=>{bn.current?.(O)},[O]);let xn=(0,M.useRef)(!1);(0,M.useEffect)(()=>{xn.current||(xn.current=!0,Object.keys(W.initial.external).length>0&&x?.(W.initial.external))},[]),(0,M.useEffect)(()=>W.syncSharedSlots(O),[O]),(0,M.useEffect)(()=>{Y&&W.restorePageIndex(O,Se)},[e]);let Ir=(0,M.useCallback)(()=>{ne([])},[]),Br=(0,M.useCallback)(()=>{Ee([]),se(""),W.clearAll()},[]),Lr=(h,V)=>{Re&&Un(O,h,V,{container:tt.current,alwaysPinnedLeft:[...re?["serialNumber"]:[],...D&&ke?["select"]:[]]})},Er=h=>h&&typeof h=="object"&&"content"in h,Me=(0,M.useMemo)(()=>i?Er(i)?{content:i.content,align:i.align||"left",className:i.className||"",showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",showOnEmpty:!0}:null,[i]);if(f)return(0,T.jsx)(Xe,{className:"shadow-sm rounded-xl w-full",children:(0,T.jsx)(Ye,{className:"flex justify-center items-center",children:(0,T.jsxs)("div",{className:"text-center",children:[(0,T.jsx)("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),(0,T.jsx)("p",{className:"mb-4 text-muted-foreground text-sm",children:f}),z&&(0,T.jsxs)(C,{variant:"outline",size:"sm",onClick:z,className:"rounded-lg",children:[(0,T.jsx)(Vo.Loader2,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let wo=()=>L?(0,T.jsx)(zo,{table:O,filters:o,globalFilter:We,onGlobalFilterChange:h=>pn(h),enableGlobalFilter:Vt,onExport:c,onRefresh:z,loading:m,enableColumnVisibility:Rt,enableColumnPinning:Re,showFilterChips:kr,onClearSorting:Ir,onClearFilters:Br,onExternalSearch:zr,initialExternalValues:me.current,aggregations:y,onAggregationChange:w,groupedFilterLabel:Dr,initialGroupedField:W.initial.groupedField,onGroupedFieldChange:W.persistGroupedField}):null,Gr=()=>{let h=0;return oe==="above-header"&&(h+=H),Me&&(h+=De),oe==="below-header"&&(h+=Z),h},hn=O.getVisibleLeafColumns().filter(h=>!h.getIsPinned()),_r=hn[hn.length-1]?.id,Ht=Math.max(O.getVisibleLeafColumns().length,1);return(0,T.jsx)(Ct,{children:(0,T.jsxs)("div",{className:r("flex flex-col space-y-2 w-full h-full p-1",d),children:[L&&oe==="default"&&(0,T.jsx)("div",{ref:Gt,className:"z-40 relative",children:wo()}),(0,T.jsx)(Xe,{className:r("shadow-sm overflow-hidden py-0",cn&&"flex-1 min-h-0"),children:(0,T.jsx)(Ye,{className:"h-full p-0",children:(0,T.jsxs)("div",{className:"relative flex flex-col justify-between h-full",children:[m&&(0,T.jsx)("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 rounded-xl",children:(0,T.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[(0,T.jsx)(Vo.Loader2,{className:"size-5 text-primary animate-spin"}),(0,T.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),(0,T.jsx)("div",{ref:tt,className:r("relative overflow-auto rounded-t-xl",cn?"flex-1 min-h-0":O.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:a},children:(0,T.jsxs)(So,{className:r("w-full border-separate border-spacing-0 relative",O.getState().columnSizingInfo.isResizingColumn&&"select-none",O.getRowModel().rows?.length===0&&"h-full"),children:[L&&oe==="above-header"&&(0,T.jsx)("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:(0,T.jsx)(ze,{className:"hover:bg-transparent",children:(0,T.jsx)(Ve,{colSpan:Ht,className:"p-2 bg-sidebar border-b shadow-sm",children:(0,T.jsx)("div",{ref:Oe,children:wo()})})})}),Me&&(Me.showOnEmpty||O.getRowModel().rows?.length>0)&&(0,T.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:oe==="above-header"?`${H}px`:"0px",zIndex:35},children:(0,T.jsx)(ze,{className:"hover:bg-transparent",children:(0,T.jsx)(Ve,{colSpan:Ht,className:r("bg-sidebar p-2 font-semibold text-foreground",Zt?"py-2":"py-4",Me.className),children:(0,T.jsx)("div",{ref:l,className:r("flex items-center w-full",Me.align==="center"&&"justify-center",Me.align==="right"&&"justify-end",Me.align==="left"&&"justify-start"),children:typeof Me.content=="string"?(0,T.jsx)("span",{className:"font-bold text-foreground text-lg tracking-tight",children:Me.content}):Me.content})})})}),L&&oe==="below-header"&&(0,T.jsx)("thead",{className:r("sticky bg-sidebar border-b",_t&&"shadow-sm"),style:{top:Me?`${De}px`:"0px",zIndex:35},children:(0,T.jsx)(ze,{className:"hover:bg-transparent",children:(0,T.jsx)(Ve,{colSpan:Ht,className:"bg-sidebar p-2",children:(0,T.jsx)("div",{ref:Ke,children:wo()})})})}),Pr&&(0,T.jsx)(Sn,{className:r("sticky bg-sidebar [&_tr]:border-b-0",_t&&"shadow-sm"),style:{top:`${Gr()}px`,zIndex:30},children:(0,T.jsx)(ir,{table:O,aggregations:y,enableColumnPinning:Re,enableColumnResizing:un,enableColumnVisibility:Rt,enableRowSelection:D,fixedCheckboxColumn:ke,bordered:vo,compact:Zt,onPinColumn:Lr})}),(0,T.jsx)(Pn,{children:O.getRowModel().rows?.length?O.getRowModel().rows.map((h,V)=>{let de=V===O.getRowModel().rows.length-1,jt=_?_(h):"";return(0,T.jsx)(ze,{"data-index":V,"data-state":h.getIsSelected()&&"selected",className:r(vt&&"hover:bg-muted/50",ht&&V%2===0&&"bg-muted/20",h.getIsSelected()&&"bg-muted",Mt==="single"&&"cursor-pointer",jt),onClick:()=>{Mt==="single"&&Ar(h)},children:h.getVisibleCells().map((Ce,Or)=>{let No=Re&&(Ce.column.getIsPinned()==="left"||Ce.column.id==="serialNumber"||Ce.column.id==="select"&&D),To=Re&&Ce.column.getIsPinned()==="right",Vr=Ce.column.id==="serialNumber";return(0,T.jsx)(Ve,{className:r(Zt?"py-2":"py-4",vo&&Or<h.getVisibleCells().length-1&&Ce.column.id!==_r&&"border-r",(!de||!Fr)&&"border-b",No&&"sticky left-0 z-20 bg-sidebar/95",Vr&&"sticky left-0 z-20 bg-card/95",To&&"sticky right-0 z-20 bg-sidebar/95","p-1"),style:{width:Be(Ce.column.getSize(),No||To),minWidth:Be(Ce.column.getSize(),No||To),...St(Ce.column,Re)},children:(0,we.flexRender)(Ce.column.columnDef.cell,Ce.getContext())},Ce.id)})},h.id)}):(0,T.jsx)(ze,{children:(0,T.jsx)(Ve,{colSpan:Ht,className:"border-0 h-32 text-center",children:(0,T.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,T.jsx)("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),(0,T.jsx)("p",{className:"font-medium text-muted-foreground",children:p})]})})})}),(0,T.jsx)(sr,{table:O,columnAggregations:Co,aggregations:y,enableColumnPinning:Re,enableRowSelection:D,showSerialNumbers:re,bordered:vo,compact:Zt})]})}),u&&(0,T.jsx)("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:(0,T.jsx)(So,{children:(0,T.jsx)(to,{children:(0,T.jsx)(ze,{className:"bg-sidebar",children:(0,T.jsx)(Ve,{colSpan:Ht,className:"p-2",children:u})})})})})]})})}),(0,T.jsx)(Fo,{table:O,config:n}),I&&I(O)]})})}var lr=require("radix-ui");var dr=require("react/jsx-runtime");function co({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return(0,dr.jsx)(lr.Separator.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:r("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}var uo=require("lucide-react"),mo=require("framer-motion"),ut=zt(require("react"),1),cr=zt(require("react-dom"),1),J=require("react/jsx-runtime");function jo({table:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=ut.useState(!1);ut.useLayoutEffect(()=>{d(!0)},[]),ut.useEffect(()=>{function f(p){p.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=t??e.getFilteredSelectedRowModel().rows.length>0;return cr.createPortal((0,J.jsx)(mo.AnimatePresence,{children:m&&(0,J.jsx)(mo.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",s),...i,children:(0,J.jsx)(Ct,{children:n})})}),a)}function $o({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...u}){let d=(0,J.jsx)(C,{variant:"secondary",size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...u,children:o?(0,J.jsx)(uo.Loader,{className:"animate-spin"}):i});return t?(0,J.jsxs)(ot,{children:[(0,J.jsx)(nt,{asChild:!0,children:d}),(0,J.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,J.jsx)("p",{children:t})})]}):d}function Uo({table:e}){let t=ut.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,J.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,J.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,J.jsx)(co,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,J.jsxs)(ot,{children:[(0,J.jsx)(nt,{asChild:!0,children:(0,J.jsx)(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,J.jsx)(uo.X,{className:"size-3.5"})})}),(0,J.jsxs)(rt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,J.jsx)("p",{children:"Clear selection"}),(0,J.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,J.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var U=require("react"),qo=require("lucide-react");var Ne=require("lucide-react");var N=require("react/jsx-runtime");function Wo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:d,onSortChange:a,selectedCount:m,totalCount:f,visibleCount:p,onExport:g,onRefresh:c,loading:z,onClearFilters:S,onClearSorting:I}){let b=e.filter(x=>x.sortable),F=Object.values(s).some(x=>x!=null&&x!=="")||o!=="",k=u!=="";return(0,N.jsx)("div",{className:"rounded-xl p-0.5",children:(0,N.jsx)("div",{className:"px-2",children:(0,N.jsx)("div",{className:"flex flex-col gap-6",children:(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,N.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,N.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,N.jsx)(Ne.Filter,{className:"h-4 w-4"})}),t.map(x=>(0,N.jsx)("div",{className:"relative min-w-[150px]",children:x.type==="select"?(0,N.jsxs)(at,{value:s[x.key]||"all",onValueChange:y=>i(x.key,y),children:[x.icon&&(0,N.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,N.jsx)(st,{className:r("h-9 rounded-lg w-full",x.icon&&"pl-9"),children:(0,N.jsx)(it,{placeholder:x.placeholder||"Select..."})}),(0,N.jsxs)(lt,{className:"rounded-lg",children:[(0,N.jsx)(He,{value:"all",children:"All"}),x.options?.map(y=>(0,N.jsx)(He,{value:y.value,children:y.label},y.value))]})]}):(0,N.jsxs)("div",{className:"relative",children:[x.icon&&(0,N.jsx)(x.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,N.jsx)(Ft,{type:x.type,placeholder:x.placeholder,value:s[x.key]||"",onChange:y=>i(x.key,y.target.value),className:r("h-9 rounded-lg",x.icon&&"pl-9")})]})},String(x.key)))]})}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)(Ne.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,N.jsx)(Ft,{placeholder:"Global search...",value:o,onChange:x=>n(x.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),b.length>0&&(0,N.jsxs)(Fe,{children:[(0,N.jsx)(Ae,{asChild:!0,children:(0,N.jsxs)(C,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,N.jsx)("span",{children:"Sort"}),(0,N.jsx)(Ne.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,N.jsxs)(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[(0,N.jsx)(pe,{children:"Sort By"}),(0,N.jsx)(fe,{}),b.map(x=>(0,N.jsxs)("div",{children:[(0,N.jsxs)(ee,{onClick:()=>a(x.key,"asc"),children:[x.label," (A-Z)"]}),(0,N.jsxs)(ee,{onClick:()=>a(x.key,"desc"),children:[x.label," (Z-A)"]})]},String(x.key))),k&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(fe,{}),(0,N.jsx)(ee,{onClick:I,children:"Clear All Sorting"})]})]})]}),(0,N.jsxs)(Fe,{children:[(0,N.jsx)(Ae,{asChild:!0,children:(0,N.jsx)(C,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,N.jsx)(Ne.Settings2,{className:"h-4 w-4"})})}),(0,N.jsxs)(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[(0,N.jsx)(pe,{children:"Table Settings"}),(0,N.jsx)(fe,{}),(0,N.jsx)(ee,{onClick:I,children:"Clear All Sorting"}),(0,N.jsx)(ee,{onClick:S,children:"Clear All Filters"})]})]}),g&&(0,N.jsxs)(C,{variant:"outline",size:"sm",onClick:g,className:"rounded-lg",children:[(0,N.jsx)(Ne.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),c&&(0,N.jsx)(C,{variant:"outline",size:"sm",onClick:c,disabled:z,className:"rounded-lg",children:(0,N.jsx)(Ne.RefreshCw,{className:r("h-4 w-4",z&&"animate-spin")})})]})]})})})})}var mt=require("lucide-react");var B=require("react/jsx-runtime");function ur({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:u}){if(!u)return null;let d=u.pageSizeOptions||[10,20,50,100],a=(e-1)*o+1,m=Math.min(e*o,n),f=e>1,p=e<t,g=()=>{let z=[],S=[];for(let I=Math.max(2,e-2);I<=Math.min(t-1,e+2);I++)z.push(I);return e-2>2?S.push(1,"..."):S.push(1),S.push(...z),e+2<t-1?S.push("...",t):t>1&&S.push(t),S};return(0,B.jsx)("div",{className:"rounded-xl",children:(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,B.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&(0,B.jsxs)("span",{children:["Showing ",a," to ",m," of ",n," entries"]})}),(0,B.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[d&&(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,B.jsxs)(at,{value:`${o}`,onValueChange:c=>i(Number(c)),children:[(0,B.jsx)(st,{className:"h-9 w-[70px] rounded-lg",children:(0,B.jsx)(it,{})}),(0,B.jsx)(lt,{side:"top",className:"rounded-lg",children:d.map(c=>(0,B.jsx)(He,{value:`${c}`,children:c},c))})]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!f,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsLeft,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,B.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!f,className:"rounded-lg",children:[(0,B.jsx)(mt.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,B.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&(0,B.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:g().map((c,z)=>{if(c==="...")return(0,B.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${z}`);let S=c;return(0,B.jsx)(C,{variant:S===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(S),children:S},S)})}),(0,B.jsxs)("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),(0,B.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!p,className:"rounded-lg",children:[(0,B.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,B.jsx)(mt.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,B.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,B.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!p,className:"hidden sm:flex rounded-lg",children:[(0,B.jsx)(mt.ChevronsRight,{className:"h-4 w-4"}),(0,B.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var G=require("react/jsx-runtime");function Ko({data:e,template:t,fields:o=[],filters:n=[],pagination:s,settings:i={},header:u,footer:d,className:a="",loading:m=!1,error:f,emptyMessage:p="No items found",emptyIcon:g,onSelectionChange:c,onExport:z,onRefresh:S,onTemplateReady:I,children:b}){let{enableSorting:F=!0,enableFiltering:k=!0,enableGlobalSearch:x=!0,enableSelection:y=!1,enableExport:w=!1,showToolbar:_=!0,selectionMode:j="multiple",gridCols:Y={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:W=4,aspectRatio:me="auto",minCardWidth:Te=350,maxCardWidth:ne=350}=i,Ue=!!s,[Ee,kt]=(0,U.useState)(""),[Se,gt]=(0,U.useState)({}),[Ge,ft]=(0,U.useState)(""),[Pe,We]=(0,U.useState)("asc"),[se,ye]=(0,U.useState)(new Set),[et,qe]=(0,U.useState)(1),[_e,Gt]=(0,U.useState)(s?.pageSize||12),[Oe,Ke]=(0,U.useState)(Y.default),l=(0,U.useMemo)(()=>{let D=[...e];if(x&&Ee){let L=o.filter(E=>E.searchable!==!1);D=D.filter(E=>L.some(oe=>E[oe.key]?.toString().toLowerCase().includes(Ee.toLowerCase())))}if(k&&Object.keys(Se).forEach(L=>{let E=Se[L];if(E!=null&&E!==""){let oe=o.find(re=>re.key===L);oe&&(D=D.filter(re=>{let ke=re[L];return oe.type==="boolean"?ke===(E==="true"):oe.type==="number"?ke===Number(E):ke?.toString().toLowerCase().includes(String(E).toLowerCase())}))}}),F&&Ge){let L=o.find(E=>E.key===Ge);L&&D.sort((E,oe)=>{let re=E[Ge],ke=oe[Ge];if(L.type==="number")return Pe==="asc"?Number(re)-Number(ke):Number(ke)-Number(re);if(L.type==="date"){let ht=new Date(re),vt=new Date(ke);return Pe==="asc"?ht.getTime()-vt.getTime():vt.getTime()-ht.getTime()}else{let ht=String(re).toLowerCase(),vt=String(ke).toLowerCase();return Pe==="asc"?ht.localeCompare(vt):vt.localeCompare(ht)}})}return D},[e,Ee,Se,Ge,Pe,o,x,k,F]),H=(0,U.useMemo)(()=>{if(!Ue)return l;let D=(et-1)*_e,L=D+_e;return l.slice(D,L)},[l,et,_e,Ue]),le=Math.ceil(l.length/_e),Z=(0,U.useCallback)(D=>{y&&ye(L=>{let E=new Set(L);return j==="single"?(E.clear(),E.add(D)):E.has(D)?E.delete(D):E.add(D),E})},[y,j]),bt=(0,U.useCallback)(()=>{!y||j==="single"||(se.size===l.length?ye(new Set):ye(new Set(l.map((D,L)=>L))))},[y,j,se.size,l.length]),De=(0,U.useCallback)((D,L)=>{gt(E=>({...E,[D]:L})),qe(1)},[]),ho=(0,U.useCallback)((D,L)=>{ft(D),We(L)},[]),tt=(0,U.useCallback)(()=>{kt(""),gt({}),qe(1)},[]),_t=(0,U.useCallback)(()=>{ft(""),We("asc")},[]),Yt=(0,U.useMemo)(()=>({getSelectedItems:()=>Array.from(se).map(D=>l[D]),clearSelection:()=>ye(new Set),selectAll:bt,getFilteredData:()=>l,getTotalCount:()=>e.length,getVisibleCount:()=>l.length,refresh:()=>S?.(),exportData:()=>z?.(l)}),[se,l,e.length,bt,S,z]),xt=(0,U.useRef)(null);xt.current=Yt,(0,U.useEffect)(()=>{I&&xt.current&&I(xt.current)},[]),(0,U.useEffect)(()=>{if(y&&c){let D=Array.from(se).map(L=>l[L]);c(D)}},[se]);let Ot=r("w-full","overflow-hidden",a),Vt=r("grid",`gap-${W}`,"w-full","mx-auto","items-start"),Rt={gridTemplateColumns:Oe===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${Te}px, calc(100%/${Oe} - ${W*4}px), ${ne}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return f?(0,G.jsx)(Xe,{className:"w-full",children:(0,G.jsx)(Ye,{className:"flex items-center justify-center py-12",children:(0,G.jsxs)("div",{className:"text-center",children:[(0,G.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,G.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:f}),S&&(0,G.jsxs)(C,{variant:"outline",size:"sm",onClick:S,children:[(0,G.jsx)(qo.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,G.jsxs)("div",{className:r("w-full flex gap-2 flex-col h-full",Ot),children:[u&&(0,G.jsx)(Xe,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,G.jsx)(Ye,{className:"p-2",children:u})}),_&&(0,G.jsx)(Wo,{fields:o,filters:n,globalFilter:Ee,onGlobalFilterChange:kt,fieldFilters:Se,onFieldFilterChange:De,sortField:Ge,sortDirection:Pe,onSortChange:ho,selectedCount:se.size,totalCount:e.length,visibleCount:l.length,onExport:w?()=>z?.(l):void 0,onRefresh:S,loading:m,onClearFilters:tt,onClearSorting:_t}),(0,G.jsx)(Xe,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,G.jsx)(Ye,{className:"px-0",children:(0,G.jsxs)("div",{className:"relative",children:[m&&(0,G.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,G.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,G.jsx)(qo.Loader2,{className:"size-5 animate-spin text-primary"}),(0,G.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),H.length>0?(0,G.jsx)("div",{className:r(Vt),style:Rt,children:H.map((D,L)=>{let E=Ue?(et-1)*_e+L:L,oe=se.has(E);return(0,G.jsxs)("div",{className:r("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",me==="square"?"aspect-square":"",me==="video"?"aspect-video":"",y?"cursor-pointer":"",oe?"ring-2 ring-primary":""),onClick:()=>y&&Z(E),children:[y&&j==="multiple"&&(0,G.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,G.jsx)(wt,{checked:oe,onCheckedChange:()=>Z(E),className:"bg-background/80 backdrop-blur-sm",onClick:re=>re.stopPropagation()})}),t(D,L,oe,()=>Z(E))]},E)})}):(0,G.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,G.jsx)("div",{className:"text-6xl",children:g||"\u{1F4CB}"}),(0,G.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:p}),(Ee||Object.values(Se).some(D=>D))&&(0,G.jsx)(C,{variant:"outline",onClick:tt,children:"Clear Filters"})]})]})})}),Ue&&(0,G.jsx)("div",{className:"pb-1",children:(0,G.jsx)(ur,{currentPage:et,totalPages:le,pageSize:_e,totalItems:l.length,onPageChange:qe,onPageSizeChange:D=>{Gt(D),qe(1)},config:s})}),d&&(0,G.jsx)("div",{className:"p-2 m-0.5",children:d}),b&&b(Yt)]})}var po=require("lucide-react"),go=require("framer-motion"),pt=zt(require("react"),1),mr=zt(require("react-dom"),1),X=require("react/jsx-runtime");function Jo({controller:e,visible:t,container:o,children:n,className:s,...i}){let[u,d]=pt.useState(!1);pt.useLayoutEffect(()=>{d(!0)},[]),pt.useEffect(()=>{function p(g){g.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let a=o??(u?globalThis.document?.body:null);if(!a||!e)return null;let m=e.getSelectedItems(),f=t??m.length>0;return mr.createPortal((0,X.jsx)(go.AnimatePresence,{children:f&&(0,X.jsx)(go.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:r("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",s),...i,children:(0,X.jsx)(Ct,{children:n})})}),a)}function Xo({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:u,onClick:d,...a}){let m=(0,X.jsx)(C,{variant:t,size:e,className:r("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:d,...a,children:n?(0,X.jsx)(po.Loader,{className:"animate-spin"}):u});return o?(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:m}),(0,X.jsx)(rt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,X.jsx)("p",{children:o})})]}):m}function Yo({controller:e}){let t=pt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return(0,X.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,X.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),(0,X.jsx)(co,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,X.jsxs)(ot,{children:[(0,X.jsx)(nt,{asChild:!0,children:(0,X.jsx)(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,X.jsx)(po.X,{className:"size-3.5"})})}),(0,X.jsxs)(rt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[(0,X.jsx)("p",{children:"Clear selection"}),(0,X.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,X.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var gr=require("react/jsx-runtime"),pr=({children:e,className:t})=>(0,gr.jsx)("div",{className:r("flex flex-col h-full gap-2",t),children:e});var Zo=require("lucide-react");var fr=require("react-router"),ie=require("react/jsx-runtime"),br=({className:e,title:t,description:o,backAction:n,metadata:s,children:i,childrenClassName:u})=>{let d=()=>{if(!n)return null;let m={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.href?(0,ie.jsx)(fr.NavLink,{to:n.href,children:(0,ie.jsx)(C,{...m,children:(0,ie.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})}):(0,ie.jsx)(C,{...m,onClick:n.onClick,children:(0,ie.jsx)(Zo.ArrowLeftIcon,{className:"size-6"})})},a=()=>!s||s.length===0?null:(0,ie.jsx)("div",{className:"flex gap-4",children:s.map((m,f)=>m.value&&(0,ie.jsxs)("div",{className:"text-sm",children:[(0,ie.jsxs)("span",{className:"text-muted-foreground",children:[m.label," "]}),(0,ie.jsx)("span",{children:m.value})]},f))});return(0,ie.jsxs)("div",{className:r("flex items-center w-full gap-4 p-2",e),children:[(0,ie.jsxs)("div",{className:"flex gap-2 items-center h-full shrink-0",children:[d(),(0,ie.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,ie.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:t}),o&&(0,ie.jsx)("p",{className:"text-muted-foreground",children:o}),a()]})]}),i!=null&&(0,ie.jsx)("div",{className:r("flex flex-1 items-center justify-end gap-4 h-full",u),children:i})]})};var Xt=zt(require("react"),1),ue=require("react/jsx-runtime"),xr="(min-width: 1024px)",ta=()=>{let[e,t]=Xt.default.useState(()=>typeof window>"u"||window.matchMedia(xr).matches);return Xt.default.useEffect(()=>{let o=window.matchMedia(xr),n=()=>t(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[]),e},Qo=e=>null,en=e=>null,tn=e=>null,hr=({children:e,className:t,contentClassName:o})=>{let n=ta(),s,i,u,d,a,m=Xt.default.Children.toArray(e).filter(g=>{if(Xt.default.isValidElement(g)){if(g.type===Qo){let c=g.props;return s=c.children,i=c.className,!1}if(g.type===en){let c=g.props;return u=c.children,d=c.className,!1}if(g.type===tn)return a=g.props,!1}return!0}),f=(0,ue.jsx)("div",{className:r("flex-1 overflow-auto h-full no-scrollbar p-2",o),children:m}),p=g=>{let{side:c="right"}=g,z=(g.overlay??!0)||!n,S=r("w-[420px] max-w-full",g.className),I=r("h-full bg-background",c==="right"?"border-l":"border-r"),b=(0,ue.jsx)("div",{className:r("h-full p-2",o),children:m});return z?(0,ue.jsxs)("div",{tabIndex:-1,className:"flex relative flex-1 overflow-hidden",children:[(0,ue.jsx)("div",{className:"h-full overflow-auto w-full transition-all duration-500 relative z-10",children:b}),(0,ue.jsxs)("div",{tabIndex:-1,inert:!g.open,className:r("absolute inset-0 z-20",!g.open&&"pointer-events-none"),children:[(0,ue.jsx)("div",{className:r("absolute inset-0 bg-black/50 transition-opacity duration-500",g.open?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>g.onOpenChange(!1)}),(0,ue.jsx)("div",{tabIndex:-1,className:r("absolute inset-y-0 z-50 h-full overflow-y-auto backdrop-blur-2xl","transition-all duration-500 ease-in-out",c==="right"?"right-0":"left-0",g.open?"translate-x-0 opacity-100":r(c==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),I,S),children:g.children})]})]}):(0,ue.jsxs)("div",{className:"flex relative flex-1 overflow-hidden",children:[c==="left"&&(0,ue.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,g.open?S:"w-0 border-0"),children:g.children}),(0,ue.jsx)("div",{className:r("h-full flex-1 min-w-0 overflow-auto transition-all duration-500",g.open&&"overflow-y-auto overflow-x-hidden"),children:b}),c==="right"&&(0,ue.jsx)("div",{className:r("shrink-0 overflow-y-auto transition-all duration-500 ease-in-out",I,g.open?S:"w-0 border-0"),children:g.children})]})};return(0,ue.jsxs)("div",{className:r("flex flex-auto flex-col min-h-0 overflow-hidden rounded-2xl relative bg-background p-2",t),children:[s&&(0,ue.jsx)("div",{className:r("border-b p-2",i),children:s}),a?p(a):f,u&&(0,ue.jsx)("div",{className:r("border-t p-2",d),children:u})]})};var yr=require("react/jsx-runtime"),vr=({className:e,children:t})=>t==null?null:(0,yr.jsx)("div",{className:r("flex items-center w-full gap-4 p-2 [&>*:last-child]:ml-auto",e),children:t});var on=require("react"),Bt=require("lucide-react");var ve=require("react/jsx-runtime"),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(o){throw console.error("Failed to copy text:",o),o}}static CopyToClipboard=({text:t,children:o,className:n,size:s="icon",variant:i="ghost"})=>{let[u,d]=(0,on.useState)(!1),[a,m]=(0,on.useState)(!1),f=async()=>{if(!(!t||a)){m(!0);try{await this.copyToClipboard(t),d(!0),setTimeout(()=>d(!1),2e3)}catch(p){console.error("Failed to copy text:",p)}finally{m(!1)}}};return(0,ve.jsxs)(ot,{children:[(0,ve.jsx)(nt,{asChild:!0,children:(0,ve.jsx)(C,{variant:i,size:s,className:r(s==="icon"&&"size-6",n),onClick:f,disabled:a||!t,children:a?(0,ve.jsx)(Bt.Loader2Icon,{className:"animate-spin"}):u?(0,ve.jsx)(Bt.Check,{className:"h-3 w-3"}):o||(0,ve.jsx)(Bt.Copy,{className:"h-3 w-3"})})}),(0,ve.jsx)(rt,{children:u?"Copied!":a?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:u=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let d=t<0,a=Math.abs(t),f=(u&&a>=1e5?this.compactFormatter:this.currencyFormatter).format(a).replace("\u20B9","");return`${n}${d?"- ":""}${i?"\u20B9 ":""}${f}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),d=String(i.getMonth()+1).padStart(2,"0"),a=this.MONTH_NAMES_SHORT[i.getMonth()],m=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${u}${s}${a}${s}${m}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${u}${s}${d}${s}${m}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((o,n,s)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(s[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:s=!0,size:i="md",variant:u="outline",customColors:d,icon:a,trueMessage:m="active",falseMessage:f="inactive"})=>{let p=typeof t=="boolean"?t?m:f:typeof t=="number"?t>0?m:f:t.toLowerCase(),g={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},c=g[p.toLowerCase()]||g.inactive,z=d||c[u],S={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},I=s?p.charAt(0).toUpperCase()+p.slice(1):p;return(0,ve.jsx)("div",{className:"flex justify-center",children:(0,ve.jsxs)("span",{className:r("inline-flex items-center gap-1.5 rounded-full border font-medium",z.bg,z.text,z.border,S[i],o),children:[n&&(a?(0,ve.jsx)("span",{className:"flex items-center",children:a}):(0,ve.jsx)("span",{className:r("size-2 rounded-full",z.dot),"aria-hidden":"true"})),I]})})}};var Cr=require("lucide-react"),Lt=require("react-router"),K=require("react/jsx-runtime"),nn=()=>{let e=(0,Lt.useRouteError)(),t=(0,Lt.useNavigate)();return(0,K.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,K.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,K.jsx)(Cr.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,Lt.isRouteErrorResponse)(e)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,K.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,K.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,K.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,K.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,K.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,K.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,K.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),(0,K.jsx)(C,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var je=require("framer-motion");var A=require("react/jsx-runtime");function oa({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return(0,A.jsxs)(je.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[(0,A.jsx)("title",{children:"Animated Checkmark"}),(0,A.jsx)(je.motion.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,A.jsx)(je.motion.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function rn(){return(0,A.jsx)(Xe,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,A.jsxs)(Ye,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,A.jsx)(je.motion.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:(0,A.jsxs)("div",{className:"relative",children:[(0,A.jsx)(je.motion.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),(0,A.jsx)(oa,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),(0,A.jsxs)(je.motion.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[(0,A.jsx)(je.motion.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),(0,A.jsx)("div",{className:"flex items-center gap-4",children:(0,A.jsx)(je.motion.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:(0,A.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,A.jsx)("title",{children:"From"}),(0,A.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,A.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,A.jsxs)("div",{className:"space-y-1.5",children:[(0,A.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,A.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,A.jsx)("title",{children:"To"}),(0,A.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,A.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,A.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),(0,A.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,A.jsx)(je.motion.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}var Dt=require("react/jsx-runtime"),an=()=>(0,Dt.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,Dt.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,Dt.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,Dt.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,Dt.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var wr=require("react-router");var Nr=require("lucide-react"),bo=require("react-router"),Le=require("react/jsx-runtime"),sn=()=>{let e=(0,wr.useLocation)(),t=(0,bo.useNavigate)(),o=()=>{window.history.length>2?t(-1):t("/")};return(0,Le.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,Le.jsx)(Nr.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Le.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,Le.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,Le.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,Le.jsxs)("div",{className:"flex space-x-4",children:[(0,Le.jsx)(C,{variant:"outline",onClick:o,children:"Go Back"}),(0,Le.jsx)(C,{variant:"ghost",children:(0,Le.jsx)(bo.NavLink,{to:"/",children:"Return Home"})})]})]})};var Tr=require("lucide-react"),Et=require("react/jsx-runtime"),ln=()=>(0,Et.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[(0,Et.jsx)(Tr.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Et.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,Et.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var Sr=require("lucide-react");var xo=require("react-router"),$e=require("react/jsx-runtime"),dn=()=>{let e=(0,xo.useNavigate)();return(0,$e.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,$e.jsx)(Sr.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,$e.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,$e.jsx)("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),(0,$e.jsxs)("div",{className:"flex space-x-4",children:[(0,$e.jsx)(C,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,$e.jsx)(C,{variant:"ghost",children:(0,$e.jsx)(xo.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppContainer,AppContent,AppContentFooter,AppContentHeader,AppFooter,AppHeader,AppSheet,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,getTableExportView,readPersistedExternal});
3
3
  //# sourceMappingURL=index.cjs.map