@jmruthers/pace-core 0.5.185 → 0.5.187

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 (300) hide show
  1. package/dist/{DataTable-Z9NLVJh0.d.ts → DataTable-IVYljGJ6.d.ts} +1 -1
  2. package/dist/{DataTable-IX2NBUTP.js → DataTable-K3RJRSOX.js} +7 -7
  3. package/dist/{PublicPageProvider-BABf6JCh.d.ts → PublicPageProvider-DrLDztHt.d.ts} +214 -107
  4. package/dist/{UnifiedAuthProvider-A4BCQRJY.js → UnifiedAuthProvider-B76OWOAT.js} +2 -2
  5. package/dist/{api-BMFCXVQX.js → api-YP7XD5L6.js} +3 -3
  6. package/dist/{audit-WRS3KJKI.js → audit-B5P6FFIR.js} +2 -2
  7. package/dist/{chunk-445GEP27.js → chunk-3IC5WCMO.js} +33 -8
  8. package/dist/chunk-3IC5WCMO.js.map +1 -0
  9. package/dist/{chunk-OKI34GZD.js → chunk-3NFNJOO7.js} +8 -8
  10. package/dist/chunk-3NFNJOO7.js.map +1 -0
  11. package/dist/{chunk-FSFQFJCU.js → chunk-63FOKYGO.js} +174 -6
  12. package/dist/chunk-63FOKYGO.js.map +1 -0
  13. package/dist/{chunk-MX3EIJGQ.js → chunk-C4OYJOV4.js} +631 -97
  14. package/dist/chunk-C4OYJOV4.js.map +1 -0
  15. package/dist/{chunk-HGPQUCBC.js → chunk-FMTK4XNN.js} +3 -3
  16. package/dist/{chunk-U6WNSFX5.js → chunk-HEHYGYOX.js} +279 -44
  17. package/dist/chunk-HEHYGYOX.js.map +1 -0
  18. package/dist/{chunk-XAUHJD3L.js → chunk-K2JGDXGU.js} +2 -2
  19. package/dist/{chunk-HC67NW5K.js → chunk-LBBUPSSC.js} +863 -552
  20. package/dist/chunk-LBBUPSSC.js.map +1 -0
  21. package/dist/{chunk-IXSNYUCT.js → chunk-SAUPYVLF.js} +1 -1
  22. package/dist/chunk-SAUPYVLF.js.map +1 -0
  23. package/dist/{chunk-AISXLWGZ.js → chunk-T6ZJVI3A.js} +27 -23
  24. package/dist/chunk-T6ZJVI3A.js.map +1 -0
  25. package/dist/{chunk-STTZQK2I.js → chunk-ULX5FYEM.js} +9 -7
  26. package/dist/chunk-ULX5FYEM.js.map +1 -0
  27. package/dist/{chunk-FXFJRTKI.js → chunk-WK2Y6TGA.js} +3 -3
  28. package/dist/chunk-WK2Y6TGA.js.map +1 -0
  29. package/dist/chunk-YHCN776L.js +447 -0
  30. package/dist/chunk-YHCN776L.js.map +1 -0
  31. package/dist/components.d.ts +4 -4
  32. package/dist/components.js +12 -10
  33. package/dist/components.js.map +1 -1
  34. package/dist/{database.generated-CBmg2950.d.ts → database.generated-DI89OQeI.d.ts} +63 -9
  35. package/dist/{file-reference-BjR39ktt.d.ts → file-reference-D037xOFK.d.ts} +3 -1
  36. package/dist/hooks.d.ts +265 -6
  37. package/dist/hooks.js +148 -49
  38. package/dist/hooks.js.map +1 -1
  39. package/dist/index.d.ts +25 -10
  40. package/dist/index.js +65 -30
  41. package/dist/index.js.map +1 -1
  42. package/dist/providers.js +1 -1
  43. package/dist/rbac/index.d.ts +125 -8
  44. package/dist/rbac/index.js +27 -7
  45. package/dist/{types-DUyCRSTj.d.ts → types-Bwgl--Xo.d.ts} +162 -1
  46. package/dist/types.d.ts +2 -2
  47. package/dist/types.js +1 -1
  48. package/dist/{usePublicRouteParams-CvnC3d-e.d.ts → usePublicRouteParams-CTDELQ7H.d.ts} +3 -3
  49. package/dist/utils.d.ts +214 -4
  50. package/dist/utils.js +22 -2
  51. package/dist/utils.js.map +1 -1
  52. package/docs/api/classes/ColumnFactory.md +1 -1
  53. package/docs/api/classes/ErrorBoundary.md +1 -1
  54. package/docs/api/classes/InvalidScopeError.md +1 -1
  55. package/docs/api/classes/Logger.md +1 -1
  56. package/docs/api/classes/MissingUserContextError.md +1 -1
  57. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  58. package/docs/api/classes/PermissionDeniedError.md +1 -1
  59. package/docs/api/classes/RBACAuditManager.md +21 -17
  60. package/docs/api/classes/RBACCache.md +31 -23
  61. package/docs/api/classes/RBACEngine.md +6 -6
  62. package/docs/api/classes/RBACError.md +1 -1
  63. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  64. package/docs/api/classes/SecureSupabaseClient.md +5 -5
  65. package/docs/api/classes/StorageUtils.md +1 -1
  66. package/docs/api/enums/FileCategory.md +1 -1
  67. package/docs/api/enums/LogLevel.md +1 -1
  68. package/docs/api/enums/RBACErrorCode.md +1 -1
  69. package/docs/api/enums/RPCFunction.md +1 -1
  70. package/docs/api/interfaces/AddressFieldProps.md +241 -0
  71. package/docs/api/interfaces/AddressFieldRef.md +94 -0
  72. package/docs/api/interfaces/AggregateConfig.md +1 -1
  73. package/docs/api/interfaces/AutocompleteOptions.md +75 -0
  74. package/docs/api/interfaces/BadgeProps.md +1 -1
  75. package/docs/api/interfaces/ButtonProps.md +1 -1
  76. package/docs/api/interfaces/CalendarProps.md +1 -1
  77. package/docs/api/interfaces/CardProps.md +1 -1
  78. package/docs/api/interfaces/ColorPalette.md +1 -1
  79. package/docs/api/interfaces/ColorShade.md +1 -1
  80. package/docs/api/interfaces/ComplianceResult.md +1 -1
  81. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  82. package/docs/api/interfaces/DataRecord.md +1 -1
  83. package/docs/api/interfaces/DataTableAction.md +1 -1
  84. package/docs/api/interfaces/DataTableColumn.md +1 -1
  85. package/docs/api/interfaces/DataTableProps.md +1 -1
  86. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  87. package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
  88. package/docs/api/interfaces/DatabaseIssue.md +1 -1
  89. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  90. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  91. package/docs/api/interfaces/EventAppRoleData.md +1 -1
  92. package/docs/api/interfaces/ExportColumn.md +1 -1
  93. package/docs/api/interfaces/ExportOptions.md +1 -1
  94. package/docs/api/interfaces/FileDisplayProps.md +15 -15
  95. package/docs/api/interfaces/FileMetadata.md +1 -1
  96. package/docs/api/interfaces/FileReference.md +1 -1
  97. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  98. package/docs/api/interfaces/FileUploadOptions.md +33 -9
  99. package/docs/api/interfaces/FileUploadProps.md +36 -14
  100. package/docs/api/interfaces/FooterProps.md +1 -1
  101. package/docs/api/interfaces/FormFieldProps.md +1 -1
  102. package/docs/api/interfaces/FormProps.md +1 -1
  103. package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
  104. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  105. package/docs/api/interfaces/InputProps.md +1 -1
  106. package/docs/api/interfaces/LabelProps.md +1 -1
  107. package/docs/api/interfaces/LoggerConfig.md +1 -1
  108. package/docs/api/interfaces/LoginFormProps.md +1 -1
  109. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  110. package/docs/api/interfaces/NavigationContextType.md +1 -1
  111. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  112. package/docs/api/interfaces/NavigationItem.md +1 -1
  113. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  114. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  115. package/docs/api/interfaces/Organisation.md +1 -1
  116. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  117. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  118. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  119. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  120. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  121. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  122. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  123. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  124. package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
  125. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  126. package/docs/api/interfaces/PaletteData.md +1 -1
  127. package/docs/api/interfaces/ParsedAddress.md +120 -0
  128. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  129. package/docs/api/interfaces/ProgressProps.md +1 -1
  130. package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
  131. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  132. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  133. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  134. package/docs/api/interfaces/QuickFix.md +1 -1
  135. package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
  136. package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
  137. package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
  138. package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
  139. package/docs/api/interfaces/RBACConfig.md +27 -4
  140. package/docs/api/interfaces/RBACContext.md +1 -1
  141. package/docs/api/interfaces/RBACLogger.md +5 -5
  142. package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
  143. package/docs/api/interfaces/RBACPerformanceMetrics.md +138 -0
  144. package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
  145. package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
  146. package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
  147. package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
  148. package/docs/api/interfaces/RBACResult.md +1 -1
  149. package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
  150. package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
  151. package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
  152. package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
  153. package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
  154. package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
  155. package/docs/api/interfaces/RBACRolesListParams.md +1 -1
  156. package/docs/api/interfaces/RBACRolesListResult.md +1 -1
  157. package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
  158. package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
  159. package/docs/api/interfaces/ResourcePermissions.md +1 -1
  160. package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
  161. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  162. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  163. package/docs/api/interfaces/RoleManagementResult.md +1 -1
  164. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  165. package/docs/api/interfaces/RouteConfig.md +1 -1
  166. package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
  167. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  168. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  169. package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
  170. package/docs/api/interfaces/SetupIssue.md +1 -1
  171. package/docs/api/interfaces/StorageConfig.md +1 -1
  172. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  173. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  174. package/docs/api/interfaces/StorageListOptions.md +1 -1
  175. package/docs/api/interfaces/StorageListResult.md +1 -1
  176. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  177. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  178. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  179. package/docs/api/interfaces/StyleImport.md +1 -1
  180. package/docs/api/interfaces/SwitchProps.md +1 -1
  181. package/docs/api/interfaces/TabsContentProps.md +1 -1
  182. package/docs/api/interfaces/TabsListProps.md +1 -1
  183. package/docs/api/interfaces/TabsProps.md +1 -1
  184. package/docs/api/interfaces/TabsTriggerProps.md +1 -1
  185. package/docs/api/interfaces/TextareaProps.md +1 -1
  186. package/docs/api/interfaces/ToastActionElement.md +1 -1
  187. package/docs/api/interfaces/ToastProps.md +1 -1
  188. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  189. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  190. package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
  191. package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
  192. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  193. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  194. package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
  195. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  196. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  197. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  198. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
  199. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  200. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  201. package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
  202. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  203. package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
  204. package/docs/api/interfaces/UserEventAccess.md +1 -1
  205. package/docs/api/interfaces/UserMenuProps.md +1 -1
  206. package/docs/api/interfaces/UserProfile.md +1 -1
  207. package/docs/api/modules.md +328 -69
  208. package/docs/api-reference/components.md +26 -12
  209. package/docs/best-practices/performance.md +11 -0
  210. package/docs/implementation-guides/file-reference-system.md +24 -2
  211. package/docs/implementation-guides/file-upload-storage.md +38 -1
  212. package/docs/rbac/README.md +2 -1
  213. package/docs/rbac/api-reference.md +11 -0
  214. package/docs/rbac/performance.md +320 -0
  215. package/docs/standards/01-architecture-standard.md +5 -0
  216. package/docs/standards/05-security-standard.md +12 -0
  217. package/package.json +1 -1
  218. package/scripts/check-pace-core-compliance.js +512 -0
  219. package/src/components/AddressField/AddressField.test.tsx +411 -0
  220. package/src/components/AddressField/AddressField.tsx +323 -0
  221. package/src/components/AddressField/README.md +336 -0
  222. package/src/components/AddressField/index.ts +10 -0
  223. package/src/components/AddressField/types.ts +65 -0
  224. package/src/components/FileDisplay/FileDisplay.test.tsx +454 -0
  225. package/src/components/FileDisplay/FileDisplay.tsx +28 -1
  226. package/src/components/FileUpload/FileUpload.test.tsx +2 -0
  227. package/src/components/FileUpload/FileUpload.tsx +7 -1
  228. package/src/components/Header/Header.tsx +2 -5
  229. package/src/components/ProtectedRoute/ProtectedRoute.tsx +134 -1
  230. package/src/components/index.ts +2 -0
  231. package/src/hooks/__tests__/useFileDisplay.unit.test.ts +30 -5
  232. package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +11 -10
  233. package/src/hooks/__tests__/usePublicFileDisplay.test.ts +31 -6
  234. package/src/hooks/index.ts +9 -0
  235. package/src/hooks/public/usePublicFileDisplay.ts +8 -10
  236. package/src/hooks/useAddressAutocomplete.test.ts +318 -0
  237. package/src/hooks/useAddressAutocomplete.ts +268 -0
  238. package/src/hooks/useFileDisplay.ts +3 -15
  239. package/src/hooks/useFileReference.test.ts +21 -3
  240. package/src/hooks/useFileReference.ts +3 -24
  241. package/src/hooks/useFileUrlCache.ts +246 -0
  242. package/src/hooks/useInactivityTracker.ts +31 -20
  243. package/src/hooks/useOrganisationSecurity.test.ts +10 -7
  244. package/src/hooks/useOrganisationSecurity.ts +3 -3
  245. package/src/hooks/usePreventTabReload.ts +106 -0
  246. package/src/hooks/useQueryCache.ts +315 -0
  247. package/src/hooks/useSecureDataAccess.ts +2 -2
  248. package/src/index.ts +2 -0
  249. package/src/providers/services/EventServiceProvider.tsx +4 -1
  250. package/src/rbac/__tests__/rbac-role-isolation.test.ts +456 -0
  251. package/src/rbac/api.test.ts +21 -6
  252. package/src/rbac/api.ts +32 -11
  253. package/src/rbac/audit-batched.ts +223 -0
  254. package/src/rbac/audit-enhanced.ts +2 -2
  255. package/src/rbac/audit.test.ts +6 -5
  256. package/src/rbac/audit.ts +34 -6
  257. package/src/rbac/cache-invalidation.ts +63 -12
  258. package/src/rbac/cache.test.ts +2 -2
  259. package/src/rbac/cache.ts +61 -14
  260. package/src/rbac/components/PagePermissionGuard.tsx +19 -10
  261. package/src/rbac/components/__tests__/PagePermissionGuard.performance.test.tsx +248 -0
  262. package/src/rbac/config.ts +9 -0
  263. package/src/rbac/engine.ts +2 -21
  264. package/src/rbac/hooks/usePermissions.ts +21 -5
  265. package/src/rbac/index.ts +19 -0
  266. package/src/rbac/performance.ts +210 -0
  267. package/src/rbac/request-deduplication.ts +87 -0
  268. package/src/rbac/utils/deep-equal.ts +93 -0
  269. package/src/styles/core.css +5 -5
  270. package/src/types/database.generated.ts +63 -9
  271. package/src/types/file-reference.ts +3 -1
  272. package/src/utils/file-reference/__tests__/file-reference.test.ts +89 -8
  273. package/src/utils/file-reference/index.ts +56 -17
  274. package/src/utils/google-places/googlePlacesUtils.test.ts +403 -0
  275. package/src/utils/google-places/googlePlacesUtils.ts +475 -0
  276. package/src/utils/google-places/index.ts +26 -0
  277. package/src/utils/google-places/loadGoogleMapsScript.ts +207 -0
  278. package/src/utils/google-places/types.ts +94 -0
  279. package/src/utils/index.ts +23 -0
  280. package/src/utils/request-deduplication.ts +165 -0
  281. package/src/utils/security/secureDataAccess.ts +1 -1
  282. package/src/utils/storage/helpers.ts +211 -4
  283. package/dist/chunk-445GEP27.js.map +0 -1
  284. package/dist/chunk-AISXLWGZ.js.map +0 -1
  285. package/dist/chunk-FMUCXFII.js +0 -76
  286. package/dist/chunk-FMUCXFII.js.map +0 -1
  287. package/dist/chunk-FSFQFJCU.js.map +0 -1
  288. package/dist/chunk-FXFJRTKI.js.map +0 -1
  289. package/dist/chunk-HC67NW5K.js.map +0 -1
  290. package/dist/chunk-IXSNYUCT.js.map +0 -1
  291. package/dist/chunk-MX3EIJGQ.js.map +0 -1
  292. package/dist/chunk-OKI34GZD.js.map +0 -1
  293. package/dist/chunk-STTZQK2I.js.map +0 -1
  294. package/dist/chunk-U6WNSFX5.js.map +0 -1
  295. /package/dist/{DataTable-IX2NBUTP.js.map → DataTable-K3RJRSOX.js.map} +0 -0
  296. /package/dist/{UnifiedAuthProvider-A4BCQRJY.js.map → UnifiedAuthProvider-B76OWOAT.js.map} +0 -0
  297. /package/dist/{api-BMFCXVQX.js.map → api-YP7XD5L6.js.map} +0 -0
  298. /package/dist/{audit-WRS3KJKI.js.map → audit-B5P6FFIR.js.map} +0 -0
  299. /package/dist/{chunk-HGPQUCBC.js.map → chunk-FMTK4XNN.js.map} +0 -0
  300. /package/dist/{chunk-XAUHJD3L.js.map → chunk-K2JGDXGU.js.map} +0 -0
@@ -25,41 +25,44 @@ import {
25
25
  SelectSeparator,
26
26
  SelectTrigger,
27
27
  SelectValue
28
- } from "./chunk-HGPQUCBC.js";
28
+ } from "./chunk-FMTK4XNN.js";
29
29
  import {
30
30
  useCan,
31
31
  usePermissions,
32
32
  useRBAC,
33
33
  useResolvedScope
34
- } from "./chunk-445GEP27.js";
34
+ } from "./chunk-3IC5WCMO.js";
35
35
  import {
36
36
  isSuperAdmin
37
- } from "./chunk-U6WNSFX5.js";
37
+ } from "./chunk-HEHYGYOX.js";
38
38
  import {
39
39
  ErrorBoundary,
40
40
  PublicPageContext,
41
41
  createFileReferenceService,
42
+ generateFileUrlsBatch,
42
43
  getPublicUrl,
43
44
  getSignedUrl,
44
45
  uploadFileWithReference,
46
+ useAddressAutocomplete,
45
47
  useAppConfig,
46
48
  useEventTheme,
47
49
  useFileDisplay,
48
50
  useIsPublicPage,
51
+ usePreventTabReload,
49
52
  usePublicFileDisplay
50
- } from "./chunk-MX3EIJGQ.js";
53
+ } from "./chunk-C4OYJOV4.js";
51
54
  import {
52
55
  useToast
53
56
  } from "./chunk-6C4YBBJM.js";
54
57
  import {
55
58
  useEvents,
56
59
  useOrganisations
57
- } from "./chunk-XAUHJD3L.js";
60
+ } from "./chunk-K2JGDXGU.js";
58
61
  import {
59
62
  EventServiceContext,
60
63
  useSessionRestoration,
61
64
  useUnifiedAuth
62
- } from "./chunk-FXFJRTKI.js";
65
+ } from "./chunk-WK2Y6TGA.js";
63
66
  import {
64
67
  assertAppId
65
68
  } from "./chunk-QXHPKYJV.js";
@@ -81,14 +84,240 @@ import {
81
84
  logger
82
85
  } from "./chunk-PWLANIRT.js";
83
86
 
84
- // src/components/Label/Label.tsx
87
+ // src/components/AddressField/AddressField.tsx
85
88
  import * as React from "react";
89
+ import { jsx, jsxs } from "react/jsx-runtime";
90
+ var AddressField = React.forwardRef(
91
+ ({
92
+ apiKey,
93
+ value: controlledValue,
94
+ defaultValue = "",
95
+ onChange,
96
+ onInputChange,
97
+ placeholder = "Enter address",
98
+ error,
99
+ disabled,
100
+ className,
101
+ size = "md",
102
+ variant = "default",
103
+ autocompleteOptions,
104
+ debounceDelay,
105
+ cacheEnabled = true,
106
+ cacheTTL,
107
+ ...props
108
+ }, ref) => {
109
+ const [internalValue, setInternalValue] = React.useState(defaultValue);
110
+ const [isOpen, setIsOpen] = React.useState(false);
111
+ const [selectedIndex, setSelectedIndex] = React.useState(-1);
112
+ const [inputFocused, setInputFocused] = React.useState(false);
113
+ const inputRef = React.useRef(null);
114
+ const suggestionsRef = React.useRef(null);
115
+ const containerRef = React.useRef(null);
116
+ const value = controlledValue !== void 0 ? controlledValue : internalValue;
117
+ const { suggestions, isLoading, error: autocompleteError, selectAddress, clearSuggestions } = useAddressAutocomplete(apiKey, value, {
118
+ autocompleteOptions,
119
+ debounceDelay,
120
+ cacheEnabled,
121
+ cacheTTL
122
+ });
123
+ React.useEffect(() => {
124
+ if (suggestions.length > 0 && inputFocused && value.trim()) {
125
+ setIsOpen(true);
126
+ } else if (suggestions.length === 0 || !value.trim()) {
127
+ setIsOpen(false);
128
+ }
129
+ }, [suggestions, inputFocused, value]);
130
+ const handleInputChange = React.useCallback(
131
+ (e) => {
132
+ const newValue = e.target.value;
133
+ if (controlledValue === void 0) {
134
+ setInternalValue(newValue);
135
+ }
136
+ onInputChange?.(newValue);
137
+ setSelectedIndex(-1);
138
+ if (!newValue.trim()) {
139
+ onChange?.(null);
140
+ clearSuggestions();
141
+ }
142
+ },
143
+ [controlledValue, onInputChange, onChange, clearSuggestions]
144
+ );
145
+ const handleSelectAddress = React.useCallback(
146
+ async (placeId) => {
147
+ setIsOpen(false);
148
+ setSelectedIndex(-1);
149
+ const address = await selectAddress(placeId);
150
+ if (address) {
151
+ const displayValue = address.full_address || "";
152
+ if (controlledValue === void 0) {
153
+ setInternalValue(displayValue);
154
+ }
155
+ onInputChange?.(displayValue);
156
+ onChange?.(address);
157
+ }
158
+ inputRef.current?.blur();
159
+ },
160
+ [selectAddress, onChange, onInputChange, controlledValue]
161
+ );
162
+ const handleKeyDown = React.useCallback(
163
+ (e) => {
164
+ if (!isOpen || suggestions.length === 0) {
165
+ if (e.key === "Escape") {
166
+ setIsOpen(false);
167
+ inputRef.current?.blur();
168
+ }
169
+ return;
170
+ }
171
+ switch (e.key) {
172
+ case "ArrowDown":
173
+ e.preventDefault();
174
+ setSelectedIndex((prev) => prev < suggestions.length - 1 ? prev + 1 : prev);
175
+ break;
176
+ case "ArrowUp":
177
+ e.preventDefault();
178
+ setSelectedIndex((prev) => prev > 0 ? prev - 1 : -1);
179
+ break;
180
+ case "Enter":
181
+ e.preventDefault();
182
+ if (selectedIndex >= 0 && selectedIndex < suggestions.length) {
183
+ handleSelectAddress(suggestions[selectedIndex].place_id);
184
+ }
185
+ break;
186
+ case "Escape":
187
+ e.preventDefault();
188
+ setIsOpen(false);
189
+ setSelectedIndex(-1);
190
+ inputRef.current?.blur();
191
+ break;
192
+ case "Tab":
193
+ setIsOpen(false);
194
+ setSelectedIndex(-1);
195
+ break;
196
+ }
197
+ },
198
+ [isOpen, suggestions, selectedIndex, handleSelectAddress]
199
+ );
200
+ const handleFocus = React.useCallback(() => {
201
+ setInputFocused(true);
202
+ if (suggestions.length > 0 && value.trim()) {
203
+ setIsOpen(true);
204
+ }
205
+ }, [suggestions, value]);
206
+ const handleBlur = React.useCallback(
207
+ (e) => {
208
+ setTimeout(() => {
209
+ if (!containerRef.current?.contains(document.activeElement)) {
210
+ setInputFocused(false);
211
+ setIsOpen(false);
212
+ setSelectedIndex(-1);
213
+ }
214
+ }, 200);
215
+ },
216
+ []
217
+ );
218
+ React.useEffect(() => {
219
+ const handleClickOutside = (event) => {
220
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
221
+ setIsOpen(false);
222
+ setSelectedIndex(-1);
223
+ }
224
+ };
225
+ if (isOpen) {
226
+ document.addEventListener("mousedown", handleClickOutside);
227
+ return () => {
228
+ document.removeEventListener("mousedown", handleClickOutside);
229
+ };
230
+ }
231
+ }, [isOpen]);
232
+ React.useEffect(() => {
233
+ if (selectedIndex >= 0 && suggestionsRef.current) {
234
+ const selectedItem = suggestionsRef.current.children[selectedIndex];
235
+ if (selectedItem && typeof selectedItem.scrollIntoView === "function") {
236
+ selectedItem.scrollIntoView({ block: "nearest", behavior: "smooth" });
237
+ }
238
+ }
239
+ }, [selectedIndex]);
240
+ React.useImperativeHandle(ref, () => inputRef.current);
241
+ const suggestionsId = React.useId();
242
+ const hasError = error || !!autocompleteError;
243
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative w-full", className), children: [
244
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
245
+ /* @__PURE__ */ jsx(
246
+ Input,
247
+ {
248
+ ref: inputRef,
249
+ type: "text",
250
+ value,
251
+ onChange: handleInputChange,
252
+ onKeyDown: handleKeyDown,
253
+ onFocus: handleFocus,
254
+ onBlur: handleBlur,
255
+ placeholder,
256
+ disabled,
257
+ error: hasError,
258
+ size,
259
+ variant,
260
+ role: "combobox",
261
+ "aria-expanded": isOpen,
262
+ "aria-autocomplete": "list",
263
+ "aria-controls": suggestionsId,
264
+ "aria-haspopup": "listbox",
265
+ "aria-activedescendant": selectedIndex >= 0 ? `${suggestionsId}-item-${selectedIndex}` : void 0,
266
+ ...props
267
+ }
268
+ ),
269
+ isLoading && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx(LoadingSpinner, { size: "sm" }) })
270
+ ] }),
271
+ isOpen && suggestions.length > 0 && /* @__PURE__ */ jsx(
272
+ "ul",
273
+ {
274
+ ref: suggestionsRef,
275
+ id: suggestionsId,
276
+ role: "listbox",
277
+ className: cn(
278
+ "absolute z-[99999] w-full mt-1 max-h-60 overflow-y-auto",
279
+ "border border-main-300 bg-main-50 shadow-lg rounded-md",
280
+ "list-none p-0 m-0"
281
+ ),
282
+ "data-testid": "address-suggestions",
283
+ children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(
284
+ "li",
285
+ {
286
+ id: `${suggestionsId}-item-${index}`,
287
+ role: "option",
288
+ "aria-selected": selectedIndex === index,
289
+ className: cn(
290
+ "px-3 py-2 cursor-pointer text-sm",
291
+ "hover:bg-main-100 focus:bg-main-100",
292
+ "border-b border-main-200 last:border-b-0",
293
+ selectedIndex === index && "bg-main-100"
294
+ ),
295
+ onClick: () => handleSelectAddress(suggestion.place_id),
296
+ onMouseEnter: () => setSelectedIndex(index),
297
+ "data-testid": `address-suggestion-${index}`,
298
+ children: [
299
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-main-900", children: suggestion.structured_formatting?.main_text || suggestion.description }),
300
+ suggestion.structured_formatting?.secondary_text && /* @__PURE__ */ jsx("div", { className: "text-xs text-main-600 mt-0.5", children: suggestion.structured_formatting.secondary_text })
301
+ ]
302
+ },
303
+ suggestion.place_id
304
+ ))
305
+ }
306
+ ),
307
+ autocompleteError && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-destructive", role: "alert", children: autocompleteError.message })
308
+ ] });
309
+ }
310
+ );
311
+ AddressField.displayName = "AddressField";
312
+
313
+ // src/components/Label/Label.tsx
314
+ import * as React2 from "react";
86
315
  import * as LabelPrimitive from "@radix-ui/react-label";
87
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
316
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
88
317
  var getLabelClasses = () => {
89
318
  return "font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70";
90
319
  };
91
- var Label = React.forwardRef(({
320
+ var Label = React2.forwardRef(({
92
321
  className,
93
322
  required = false,
94
323
  requiredIndicator,
@@ -103,8 +332,8 @@ var Label = React.forwardRef(({
103
332
  }, ref) => {
104
333
  const hasError = !!error;
105
334
  const showHelperText = helperText && !hasError;
106
- return /* @__PURE__ */ jsxs(Fragment, { children: [
107
- /* @__PURE__ */ jsxs(
335
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
336
+ /* @__PURE__ */ jsxs2(
108
337
  LabelPrimitive.Root,
109
338
  {
110
339
  ref,
@@ -117,7 +346,7 @@ var Label = React.forwardRef(({
117
346
  ...props,
118
347
  children: [
119
348
  children,
120
- required && /* @__PURE__ */ jsx(
349
+ required && /* @__PURE__ */ jsx2(
121
350
  "span",
122
351
  {
123
352
  "aria-label": "required",
@@ -131,8 +360,8 @@ var Label = React.forwardRef(({
131
360
  ]
132
361
  }
133
362
  ),
134
- showHelperText && /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground", helperTextClassName), children: helperText }),
135
- hasError && /* @__PURE__ */ jsx(
363
+ showHelperText && /* @__PURE__ */ jsx2("p", { className: cn("text-muted-foreground", helperTextClassName), children: helperText }),
364
+ hasError && /* @__PURE__ */ jsx2(
136
365
  "p",
137
366
  {
138
367
  role: "alert",
@@ -146,11 +375,11 @@ var Label = React.forwardRef(({
146
375
  Label.displayName = LabelPrimitive.Root.displayName;
147
376
 
148
377
  // src/components/Textarea/Textarea.tsx
149
- import * as React2 from "react";
150
- import { jsx as jsx2 } from "react/jsx-runtime";
151
- var Textarea = React2.forwardRef(
378
+ import * as React3 from "react";
379
+ import { jsx as jsx3 } from "react/jsx-runtime";
380
+ var Textarea = React3.forwardRef(
152
381
  ({ className, variant = "default", size = "md", error, ...props }, ref) => {
153
- return /* @__PURE__ */ jsx2(
382
+ return /* @__PURE__ */ jsx3(
154
383
  "textarea",
155
384
  {
156
385
  className: cn(
@@ -178,10 +407,10 @@ var Textarea = React2.forwardRef(
178
407
  Textarea.displayName = "Textarea";
179
408
 
180
409
  // src/components/Avatar/Avatar.tsx
181
- import * as React3 from "react";
410
+ import * as React4 from "react";
182
411
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
183
- import { jsx as jsx3 } from "react/jsx-runtime";
184
- var Avatar = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
412
+ import { jsx as jsx4 } from "react/jsx-runtime";
413
+ var Avatar = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
185
414
  AvatarPrimitive.Root,
186
415
  {
187
416
  ref,
@@ -193,7 +422,7 @@ var Avatar = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
193
422
  }
194
423
  ));
195
424
  Avatar.displayName = AvatarPrimitive.Root.displayName;
196
- var AvatarImage = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
425
+ var AvatarImage = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
197
426
  AvatarPrimitive.Image,
198
427
  {
199
428
  ref,
@@ -202,7 +431,7 @@ var AvatarImage = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
202
431
  }
203
432
  ));
204
433
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
205
- var AvatarFallback = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
434
+ var AvatarFallback = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
206
435
  AvatarPrimitive.Fallback,
207
436
  {
208
437
  ref,
@@ -216,8 +445,8 @@ var AvatarFallback = React3.forwardRef(({ className, ...props }, ref) => /* @__P
216
445
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
217
446
 
218
447
  // src/components/Badge/Badge.tsx
219
- import * as React4 from "react";
220
- import { jsx as jsx4 } from "react/jsx-runtime";
448
+ import * as React5 from "react";
449
+ import { jsx as jsx5 } from "react/jsx-runtime";
221
450
  var shadeConfig = {
222
451
  muted: {
223
452
  bg: 200,
@@ -282,7 +511,7 @@ function getBadgeClasses(variant = "solid-main-normal") {
282
511
  const baseClasses = "text-balance rounded-2xl px-3 py-1 mr-1 text-xs font-medium transition-colors box-border";
283
512
  return `${baseClasses} ${variantClassesMap[variant]}`;
284
513
  }
285
- var Badge = React4.forwardRef(
514
+ var Badge = React5.forwardRef(
286
515
  ({ className, variant = "solid-main-normal", ...props }, ref) => {
287
516
  const isSoftVariant = variant.startsWith("soft-");
288
517
  if (isSoftVariant) {
@@ -292,7 +521,7 @@ var Badge = React4.forwardRef(
292
521
  const classesWithoutShadows = variantClasses.replace(/\bshadow-badge-soft\b/g, "").replace(/\bshadow-\w+-\d+\b/g, "").replace(/\s+/g, " ").trim();
293
522
  const mergedClasses = cn(classesWithoutShadows, className);
294
523
  const finalClasses = `${mergedClasses} shadow-badge-soft ${shadowColorClass}`.trim();
295
- return /* @__PURE__ */ jsx4(
524
+ return /* @__PURE__ */ jsx5(
296
525
  "span",
297
526
  {
298
527
  ref,
@@ -301,7 +530,7 @@ var Badge = React4.forwardRef(
301
530
  }
302
531
  );
303
532
  }
304
- return /* @__PURE__ */ jsx4(
533
+ return /* @__PURE__ */ jsx5(
305
534
  "span",
306
535
  {
307
536
  ref,
@@ -314,10 +543,10 @@ var Badge = React4.forwardRef(
314
543
  Badge.displayName = "Badge";
315
544
 
316
545
  // src/components/Switch/Switch.tsx
317
- import * as React5 from "react";
546
+ import * as React6 from "react";
318
547
  import * as SwitchPrimitive from "@radix-ui/react-switch";
319
- import { jsx as jsx5 } from "react/jsx-runtime";
320
- var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
548
+ import { jsx as jsx6 } from "react/jsx-runtime";
549
+ var Switch = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
321
550
  SwitchPrimitive.Root,
322
551
  {
323
552
  className: cn(
@@ -339,7 +568,7 @@ var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
339
568
  ),
340
569
  ...props,
341
570
  ref,
342
- children: /* @__PURE__ */ jsx5(
571
+ children: /* @__PURE__ */ jsx6(
343
572
  SwitchPrimitive.Thumb,
344
573
  {
345
574
  className: cn(
@@ -360,12 +589,12 @@ var Switch = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
360
589
  Switch.displayName = SwitchPrimitive.Root.displayName;
361
590
 
362
591
  // src/components/Tabs/Tabs.tsx
363
- import * as React6 from "react";
592
+ import * as React7 from "react";
364
593
  import * as TabsPrimitive from "@radix-ui/react-tabs";
365
- import { jsx as jsx6 } from "react/jsx-runtime";
366
- var Tabs = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx6("section", { ref, className, children }) }));
594
+ import { jsx as jsx7 } from "react/jsx-runtime";
595
+ var Tabs = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx7("section", { ref, className, children }) }));
367
596
  Tabs.displayName = TabsPrimitive.Root.displayName || "Tabs";
368
- var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6(TabsPrimitive.List, { asChild: true, ...props, children: /* @__PURE__ */ jsx6(
597
+ var TabsList = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7(TabsPrimitive.List, { asChild: true, ...props, children: /* @__PURE__ */ jsx7(
369
598
  "nav",
370
599
  {
371
600
  ref,
@@ -377,8 +606,8 @@ var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /*
377
606
  }
378
607
  ) }));
379
608
  TabsList.displayName = TabsPrimitive.List.displayName || "TabsList";
380
- var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...props }, ref) => {
381
- return /* @__PURE__ */ jsx6(TabsPrimitive.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx6(
609
+ var TabsTrigger = React7.forwardRef(({ className, variant, size, children, ...props }, ref) => {
610
+ return /* @__PURE__ */ jsx7(TabsPrimitive.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx7(
382
611
  Button,
383
612
  {
384
613
  ref,
@@ -396,7 +625,7 @@ var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...pr
396
625
  ) });
397
626
  });
398
627
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName || "TabsTrigger";
399
- var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6(TabsPrimitive.Content, { asChild: true, ...props, children: /* @__PURE__ */ jsx6(
628
+ var TabsContent = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7(TabsPrimitive.Content, { asChild: true, ...props, children: /* @__PURE__ */ jsx7(
400
629
  "aside",
401
630
  {
402
631
  ref,
@@ -410,13 +639,13 @@ var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) =>
410
639
  TabsContent.displayName = TabsPrimitive.Content.displayName || "TabsContent";
411
640
 
412
641
  // src/components/Calendar/Calendar.tsx
413
- import * as React7 from "react";
642
+ import * as React8 from "react";
414
643
  import { DayPicker } from "react-day-picker";
415
- import { jsx as jsx7 } from "react/jsx-runtime";
416
- var Calendar = React7.forwardRef(
644
+ import { jsx as jsx8 } from "react/jsx-runtime";
645
+ var Calendar = React8.forwardRef(
417
646
  ({ className, classNames, mode, components, ...props }, ref) => {
418
647
  const defaultComponents = {
419
- IconLeft: ({ ...iconProps }) => /* @__PURE__ */ jsx7(
648
+ IconLeft: ({ ...iconProps }) => /* @__PURE__ */ jsx8(
420
649
  "svg",
421
650
  {
422
651
  xmlns: "http://www.w3.org/2000/svg",
@@ -428,10 +657,10 @@ var Calendar = React7.forwardRef(
428
657
  strokeLinejoin: "round",
429
658
  className: "h-4 w-4",
430
659
  ...iconProps,
431
- children: /* @__PURE__ */ jsx7("path", { d: "m15 18-6-6 6-6" })
660
+ children: /* @__PURE__ */ jsx8("path", { d: "m15 18-6-6 6-6" })
432
661
  }
433
662
  ),
434
- IconRight: ({ ...iconProps }) => /* @__PURE__ */ jsx7(
663
+ IconRight: ({ ...iconProps }) => /* @__PURE__ */ jsx8(
435
664
  "svg",
436
665
  {
437
666
  xmlns: "http://www.w3.org/2000/svg",
@@ -443,12 +672,12 @@ var Calendar = React7.forwardRef(
443
672
  strokeLinejoin: "round",
444
673
  className: "h-4 w-4",
445
674
  ...iconProps,
446
- children: /* @__PURE__ */ jsx7("path", { d: "m9 18 6-6-6-6" })
675
+ children: /* @__PURE__ */ jsx8("path", { d: "m9 18 6-6-6-6" })
447
676
  }
448
677
  ),
449
678
  ...components
450
679
  };
451
- return /* @__PURE__ */ jsx7("div", { ref, className: cn("p-3", className), children: /* @__PURE__ */ jsx7(
680
+ return /* @__PURE__ */ jsx8("div", { ref, className: cn("p-3", className), children: /* @__PURE__ */ jsx8(
452
681
  DayPicker,
453
682
  {
454
683
  ...mode ? { mode } : {},
@@ -496,12 +725,12 @@ var Calendar = React7.forwardRef(
496
725
  Calendar.displayName = "Calendar";
497
726
 
498
727
  // src/components/Toast/Toast.tsx
499
- import * as React8 from "react";
728
+ import * as React9 from "react";
500
729
  import * as ToastPrimitives from "@radix-ui/react-toast";
501
730
  import { X } from "lucide-react";
502
- import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
731
+ import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
503
732
  var ToastProvider = ToastPrimitives.Provider;
504
- var ToastViewport = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
733
+ var ToastViewport = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
505
734
  ToastPrimitives.Viewport,
506
735
  {
507
736
  ref,
@@ -514,8 +743,8 @@ var ToastViewport = React8.forwardRef(({ className, ...props }, ref) => /* @__PU
514
743
  }
515
744
  ));
516
745
  ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
517
- var Toast = React8.forwardRef(({ className, ...props }, ref) => {
518
- return /* @__PURE__ */ jsx8(
746
+ var Toast = React9.forwardRef(({ className, ...props }, ref) => {
747
+ return /* @__PURE__ */ jsx9(
519
748
  ToastPrimitives.Root,
520
749
  {
521
750
  ref,
@@ -529,7 +758,7 @@ var Toast = React8.forwardRef(({ className, ...props }, ref) => {
529
758
  );
530
759
  });
531
760
  Toast.displayName = ToastPrimitives.Root.displayName;
532
- var ToastAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
761
+ var ToastAction = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
533
762
  ToastPrimitives.Action,
534
763
  {
535
764
  ref,
@@ -542,7 +771,7 @@ var ToastAction = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
542
771
  }
543
772
  ));
544
773
  ToastAction.displayName = ToastPrimitives.Action.displayName;
545
- var ToastClose = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
774
+ var ToastClose = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
546
775
  ToastPrimitives.Close,
547
776
  {
548
777
  ref,
@@ -553,11 +782,11 @@ var ToastClose = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE_
553
782
  ),
554
783
  "toast-close": "",
555
784
  ...props,
556
- children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" })
785
+ children: /* @__PURE__ */ jsx9(X, { className: "h-4 w-4" })
557
786
  }
558
787
  ));
559
788
  ToastClose.displayName = ToastPrimitives.Close.displayName;
560
- var ToastTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
789
+ var ToastTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
561
790
  ToastPrimitives.Title,
562
791
  {
563
792
  ref,
@@ -567,7 +796,7 @@ var ToastTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE_
567
796
  }
568
797
  ));
569
798
  ToastTitle.displayName = ToastPrimitives.Title.displayName;
570
- var ToastDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
799
+ var ToastDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
571
800
  ToastPrimitives.Description,
572
801
  {
573
802
  ref,
@@ -579,15 +808,15 @@ var ToastDescription = React8.forwardRef(({ className, ...props }, ref) => /* @_
579
808
  ToastDescription.displayName = ToastPrimitives.Description.displayName;
580
809
  function Toaster() {
581
810
  const { toasts } = useToast();
582
- return /* @__PURE__ */ jsxs2(ToastProvider, { "data-testid": "toast-provider", children: [
583
- /* @__PURE__ */ jsx8(ToastViewport, {}),
811
+ return /* @__PURE__ */ jsxs3(ToastProvider, { "data-testid": "toast-provider", children: [
812
+ /* @__PURE__ */ jsx9(ToastViewport, {}),
584
813
  toasts.map((toast) => {
585
814
  const { id, title, description, action, dismiss, duration, ...toastProps } = toast;
586
- return /* @__PURE__ */ jsxs2(Toast, { ...toastProps, duration, children: [
587
- title && /* @__PURE__ */ jsx8(ToastTitle, { children: title }),
588
- description && /* @__PURE__ */ jsx8(ToastDescription, { children: description }),
815
+ return /* @__PURE__ */ jsxs3(Toast, { ...toastProps, duration, children: [
816
+ title && /* @__PURE__ */ jsx9(ToastTitle, { children: title }),
817
+ description && /* @__PURE__ */ jsx9(ToastDescription, { children: description }),
589
818
  action && action,
590
- /* @__PURE__ */ jsx8(ToastClose, { onClick: dismiss })
819
+ /* @__PURE__ */ jsx9(ToastClose, { onClick: dismiss })
591
820
  ] }, id);
592
821
  })
593
822
  ] });
@@ -596,7 +825,7 @@ function Toaster() {
596
825
  // src/components/Form/Form.tsx
597
826
  import { useForm, FormProvider, useFormContext, Controller } from "react-hook-form";
598
827
  import { zodResolver } from "@hookform/resolvers/zod";
599
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
828
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
600
829
  function Form({
601
830
  schema,
602
831
  defaultValues,
@@ -612,7 +841,7 @@ function Form({
612
841
  mode
613
842
  });
614
843
  const handleSubmit = methods.handleSubmit(onSubmit, onError);
615
- return /* @__PURE__ */ jsx9(FormProvider, { ...methods, children: /* @__PURE__ */ jsx9("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: typeof children === "function" ? children(methods) : children }) });
844
+ return /* @__PURE__ */ jsx10(FormProvider, { ...methods, children: /* @__PURE__ */ jsx10("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: typeof children === "function" ? children(methods) : children }) });
616
845
  }
617
846
  function FormField({
618
847
  name,
@@ -628,12 +857,12 @@ function FormField({
628
857
  const { control, formState: { errors } } = useFormContext();
629
858
  const fieldError = errors[name];
630
859
  const errorMessage = fieldError && typeof fieldError === "object" && "message" in fieldError ? String(fieldError.message) : void 0;
631
- return /* @__PURE__ */ jsxs3("div", { className: cn("space-y-2", className), children: [
632
- label && /* @__PURE__ */ jsxs3(Label, { htmlFor: name, children: [
860
+ return /* @__PURE__ */ jsxs4("div", { className: cn("space-y-2", className), children: [
861
+ label && /* @__PURE__ */ jsxs4(Label, { htmlFor: name, children: [
633
862
  label,
634
- validation?.required && /* @__PURE__ */ jsx9("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
863
+ validation?.required && /* @__PURE__ */ jsx10("span", { className: "text-destructive ml-1", "aria-label": "required", children: "*" })
635
864
  ] }),
636
- /* @__PURE__ */ jsx9(
865
+ /* @__PURE__ */ jsx10(
637
866
  Controller,
638
867
  {
639
868
  name,
@@ -643,7 +872,7 @@ function FormField({
643
872
  if (render) {
644
873
  return render(props);
645
874
  }
646
- return /* @__PURE__ */ jsx9(
875
+ return /* @__PURE__ */ jsx10(
647
876
  "input",
648
877
  {
649
878
  ...props.field,
@@ -661,14 +890,14 @@ function FormField({
661
890
  }
662
891
  }
663
892
  ),
664
- errorMessage && /* @__PURE__ */ jsx9("p", { className: "text-destructive", role: "alert", children: errorMessage })
893
+ errorMessage && /* @__PURE__ */ jsx10("p", { className: "text-destructive", role: "alert", children: errorMessage })
665
894
  ] });
666
895
  }
667
896
 
668
897
  // src/components/LoginForm/LoginForm.tsx
669
- import React9, { useState, useCallback, useMemo } from "react";
670
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
671
- var LoginForm = React9.memo(({
898
+ import React10, { useState as useState2, useCallback as useCallback2, useMemo } from "react";
899
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
900
+ var LoginForm = React10.memo(({
672
901
  onSignIn,
673
902
  onSuccess,
674
903
  onError,
@@ -680,18 +909,18 @@ var LoginForm = React9.memo(({
680
909
  onSignUp,
681
910
  className
682
911
  }) => {
683
- const [formData, setFormData] = useState({ email: "", password: "" });
684
- const [error, setError] = useState(null);
912
+ const [formData, setFormData] = useState2({ email: "", password: "" });
913
+ const [error, setError] = useState2(null);
685
914
  const isFormValid = useMemo(() => {
686
915
  return formData.email.length > 0 && formData.password.length > 0;
687
916
  }, [formData.email, formData.password]);
688
- const handleEmailChange = useCallback((e) => {
917
+ const handleEmailChange = useCallback2((e) => {
689
918
  setFormData((prev) => ({ ...prev, email: e.target.value }));
690
919
  }, []);
691
- const handlePasswordChange = useCallback((e) => {
920
+ const handlePasswordChange = useCallback2((e) => {
692
921
  setFormData((prev) => ({ ...prev, password: e.target.value }));
693
922
  }, []);
694
- const handleSubmit = useCallback(async (e) => {
923
+ const handleSubmit = useCallback2(async (e) => {
695
924
  e.preventDefault();
696
925
  setError(null);
697
926
  if (!isFormValid || isLoading) return;
@@ -704,20 +933,20 @@ var LoginForm = React9.memo(({
704
933
  onError?.(err instanceof Error ? err : new Error(errorMessage));
705
934
  }
706
935
  }, [formData, isFormValid, isLoading, onSignIn, onSuccess, onError]);
707
- const handleSignUpClick = useCallback(() => {
936
+ const handleSignUpClick = useCallback2(() => {
708
937
  onSignUp?.();
709
938
  }, [onSignUp]);
710
939
  const displayTitle = useMemo(() => title || (appName ? `Sign in to ${appName}` : "Sign In"), [title, appName]);
711
940
  const displaySubtitle = useMemo(() => subtitle || "Enter your credentials to continue.", [subtitle]);
712
- return /* @__PURE__ */ jsx10(Card, { className: cn("w-full max-w-md mx-auto", className), children: /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, "data-testid": "login-form", children: [
713
- /* @__PURE__ */ jsxs4(CardHeader, { className: "space-y-1", children: [
714
- /* @__PURE__ */ jsx10(CardTitle, { className: "text-2xl text-center", children: displayTitle }),
715
- /* @__PURE__ */ jsx10(CardDescription, { className: "text-center", children: displaySubtitle })
941
+ return /* @__PURE__ */ jsx11(Card, { className: cn("w-full max-w-md mx-auto", className), children: /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, "data-testid": "login-form", children: [
942
+ /* @__PURE__ */ jsxs5(CardHeader, { className: "space-y-1", children: [
943
+ /* @__PURE__ */ jsx11(CardTitle, { className: "text-2xl text-center", children: displayTitle }),
944
+ /* @__PURE__ */ jsx11(CardDescription, { className: "text-center", children: displaySubtitle })
716
945
  ] }),
717
- /* @__PURE__ */ jsxs4(CardContent, { className: "space-y-4", children: [
718
- error && /* @__PURE__ */ jsx10(Alert, { variant: "destructive", role: "alert", "aria-live": "assertive", children: /* @__PURE__ */ jsx10(AlertDescription, { children: error }) }),
719
- /* @__PURE__ */ jsx10(Label, { htmlFor: "email", children: "Email" }),
720
- /* @__PURE__ */ jsx10(
946
+ /* @__PURE__ */ jsxs5(CardContent, { className: "space-y-4", children: [
947
+ error && /* @__PURE__ */ jsx11(Alert, { variant: "destructive", role: "alert", "aria-live": "assertive", children: /* @__PURE__ */ jsx11(AlertDescription, { children: error }) }),
948
+ /* @__PURE__ */ jsx11(Label, { htmlFor: "email", children: "Email" }),
949
+ /* @__PURE__ */ jsx11(
721
950
  Input,
722
951
  {
723
952
  id: "email",
@@ -729,8 +958,8 @@ var LoginForm = React9.memo(({
729
958
  disabled: isLoading
730
959
  }
731
960
  ),
732
- /* @__PURE__ */ jsx10(Label, { htmlFor: "password", children: "Password" }),
733
- /* @__PURE__ */ jsx10(
961
+ /* @__PURE__ */ jsx11(Label, { htmlFor: "password", children: "Password" }),
962
+ /* @__PURE__ */ jsx11(
734
963
  Input,
735
964
  {
736
965
  id: "password",
@@ -743,8 +972,8 @@ var LoginForm = React9.memo(({
743
972
  }
744
973
  )
745
974
  ] }),
746
- /* @__PURE__ */ jsxs4(CardFooter, { className: "flex flex-col space-y-4", children: [
747
- /* @__PURE__ */ jsx10(
975
+ /* @__PURE__ */ jsxs5(CardFooter, { className: "flex flex-col space-y-4", children: [
976
+ /* @__PURE__ */ jsx11(
748
977
  Button,
749
978
  {
750
979
  type: "submit",
@@ -753,7 +982,7 @@ var LoginForm = React9.memo(({
753
982
  children: isLoading ? "Signing in..." : "Sign In"
754
983
  }
755
984
  ),
756
- showSignUp && (onSignUp ? /* @__PURE__ */ jsx10("div", { className: "text-sm text-center text-muted-foreground", children: /* @__PURE__ */ jsx10(
985
+ showSignUp && (onSignUp ? /* @__PURE__ */ jsx11("div", { className: "text-sm text-center text-muted-foreground", children: /* @__PURE__ */ jsx11(
757
986
  "button",
758
987
  {
759
988
  type: "button",
@@ -761,10 +990,10 @@ var LoginForm = React9.memo(({
761
990
  className: "text-primary hover:underline",
762
991
  children: "Don't have an account? Sign up"
763
992
  }
764
- ) }) : /* @__PURE__ */ jsxs4("p", { className: "text-center text-muted-foreground", children: [
993
+ ) }) : /* @__PURE__ */ jsxs5("p", { className: "text-center text-muted-foreground", children: [
765
994
  "Don't have an account?",
766
995
  " ",
767
- /* @__PURE__ */ jsx10("a", { href: "/signup", className: "text-primary hover:underline", children: "Sign up" })
996
+ /* @__PURE__ */ jsx11("a", { href: "/signup", className: "text-primary hover:underline", children: "Sign up" })
768
997
  ] }))
769
998
  ] })
770
999
  ] }) });
@@ -772,8 +1001,8 @@ var LoginForm = React9.memo(({
772
1001
 
773
1002
  // src/components/EventSelector/EventSelector.tsx
774
1003
  import { RefreshCw, AlertCircle, Lock, Calendar as Calendar2, Star } from "lucide-react";
775
- import { useEffect, useMemo as useMemo2, useRef } from "react";
776
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1004
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
1005
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
777
1006
  function EventSelector({
778
1007
  placeholder = "Select an event",
779
1008
  className,
@@ -835,10 +1064,10 @@ function EventSelector({
835
1064
  const getTime = (e) => e.event_date ? new Date(e.event_date).getTime() : Number.NEGATIVE_INFINITY;
836
1065
  return [...events].sort((a, b) => getTime(b) - getTime(a));
837
1066
  }, [events]);
838
- const prevEventsLengthRef = useRef(events.length);
839
- const prevSelectedEventIdRef = useRef(selectedEvent?.event_id);
840
- const hasAutoSelectedRef = useRef(false);
841
- useEffect(() => {
1067
+ const prevEventsLengthRef = useRef2(events.length);
1068
+ const prevSelectedEventIdRef = useRef2(selectedEvent?.event_id);
1069
+ const hasAutoSelectedRef = useRef2(false);
1070
+ useEffect2(() => {
842
1071
  const eventsLengthChanged = events.length !== prevEventsLengthRef.current;
843
1072
  const selectedEventChanged = selectedEvent?.event_id !== prevSelectedEventIdRef.current;
844
1073
  if (eventsLengthChanged) {
@@ -879,17 +1108,17 @@ function EventSelector({
879
1108
  }
880
1109
  }, [events.length, selectedEvent?.event_id, isLoading, setSelectedEvent, onEventChange]);
881
1110
  if (isLoading) {
882
- return /* @__PURE__ */ jsxs5("div", { className: `flex items-center gap-2 ${className}`, children: [
883
- /* @__PURE__ */ jsx11(LoadingSpinner, { size: "sm" }),
884
- /* @__PURE__ */ jsx11("span", { className: "text-sm text-muted-foreground", children: "Loading events..." })
1111
+ return /* @__PURE__ */ jsxs6("div", { className: `flex items-center gap-2 ${className}`, children: [
1112
+ /* @__PURE__ */ jsx12(LoadingSpinner, { size: "sm" }),
1113
+ /* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "Loading events..." })
885
1114
  ] });
886
1115
  }
887
1116
  if (error) {
888
- return /* @__PURE__ */ jsx11("div", { className, children: /* @__PURE__ */ jsxs5(Alert, { variant: "destructive", children: [
889
- /* @__PURE__ */ jsx11(Lock, { className: "h-4 w-4" }),
890
- /* @__PURE__ */ jsxs5(AlertDescription, { className: "flex items-center justify-between", children: [
891
- /* @__PURE__ */ jsx11("span", { children: error.message }),
892
- showRetryButton && /* @__PURE__ */ jsxs5(
1117
+ return /* @__PURE__ */ jsx12("div", { className, children: /* @__PURE__ */ jsxs6(Alert, { variant: "destructive", children: [
1118
+ /* @__PURE__ */ jsx12(Lock, { className: "h-4 w-4" }),
1119
+ /* @__PURE__ */ jsxs6(AlertDescription, { className: "flex items-center justify-between", children: [
1120
+ /* @__PURE__ */ jsx12("span", { children: error.message }),
1121
+ showRetryButton && /* @__PURE__ */ jsxs6(
893
1122
  Button,
894
1123
  {
895
1124
  variant: "outline",
@@ -897,7 +1126,7 @@ function EventSelector({
897
1126
  onClick: handleRetry,
898
1127
  className: "ml-2",
899
1128
  children: [
900
- /* @__PURE__ */ jsx11(RefreshCw, { className: "h-3 w-3 mr-1" }),
1129
+ /* @__PURE__ */ jsx12(RefreshCw, { className: "h-3 w-3 mr-1" }),
901
1130
  "Retry"
902
1131
  ]
903
1132
  }
@@ -907,11 +1136,11 @@ function EventSelector({
907
1136
  }
908
1137
  if (events.length === 0) {
909
1138
  if (showNoEventsMessage) {
910
- return /* @__PURE__ */ jsx11("div", { className, children: /* @__PURE__ */ jsxs5(Alert, { variant: "inline", children: [
911
- /* @__PURE__ */ jsx11(AlertCircle, { className: "h-4 w-4 text-acc-700" }),
912
- /* @__PURE__ */ jsxs5(AlertDescription, { className: "flex items-center justify-between", children: [
913
- /* @__PURE__ */ jsx11("span", { children: "No events available." }),
914
- showRetryButton && /* @__PURE__ */ jsxs5(
1139
+ return /* @__PURE__ */ jsx12("div", { className, children: /* @__PURE__ */ jsxs6(Alert, { variant: "inline", children: [
1140
+ /* @__PURE__ */ jsx12(AlertCircle, { className: "h-4 w-4 text-acc-700" }),
1141
+ /* @__PURE__ */ jsxs6(AlertDescription, { className: "flex items-center justify-between", children: [
1142
+ /* @__PURE__ */ jsx12("span", { children: "No events available." }),
1143
+ showRetryButton && /* @__PURE__ */ jsxs6(
915
1144
  Button,
916
1145
  {
917
1146
  variant: "outline",
@@ -919,7 +1148,7 @@ function EventSelector({
919
1148
  onClick: handleRetry,
920
1149
  className: "ml-2",
921
1150
  children: [
922
- /* @__PURE__ */ jsx11(RefreshCw, { className: "h-3 w-3 mr-1" }),
1151
+ /* @__PURE__ */ jsx12(RefreshCw, { className: "h-3 w-3 mr-1" }),
923
1152
  "Refresh"
924
1153
  ]
925
1154
  }
@@ -929,43 +1158,43 @@ function EventSelector({
929
1158
  }
930
1159
  return null;
931
1160
  }
932
- return /* @__PURE__ */ jsxs5(
1161
+ return /* @__PURE__ */ jsxs6(
933
1162
  Select,
934
1163
  {
935
1164
  value: selectedEvent ? selectedEvent.event_id || selectedEvent.id : "",
936
1165
  onValueChange: handleValueChange,
937
1166
  className,
938
1167
  children: [
939
- /* @__PURE__ */ jsx11(SelectTrigger, { className: "text-left", variant: "outline", children: /* @__PURE__ */ jsx11(SelectValue, { placeholder, children: selectedEvent && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
940
- /* @__PURE__ */ jsx11(Calendar2, { className: "h-4 w-4 flex-shrink-0" }),
941
- /* @__PURE__ */ jsx11("span", { className: "truncate", children: selectedEvent.event_name }),
942
- selectedEvent.event_date && /* @__PURE__ */ jsxs5("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: [
1168
+ /* @__PURE__ */ jsx12(SelectTrigger, { className: "text-left", variant: "outline", children: /* @__PURE__ */ jsx12(SelectValue, { placeholder, children: selectedEvent && /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1169
+ /* @__PURE__ */ jsx12(Calendar2, { className: "h-4 w-4 flex-shrink-0" }),
1170
+ /* @__PURE__ */ jsx12("span", { className: "truncate", children: selectedEvent.event_name }),
1171
+ selectedEvent.event_date && /* @__PURE__ */ jsxs6("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: [
943
1172
  "(",
944
1173
  formatEventDate(selectedEvent.event_date),
945
1174
  ")"
946
1175
  ] })
947
1176
  ] }) }) }),
948
- /* @__PURE__ */ jsx11(SelectContent, { children: sortedEvents.map((event) => {
1177
+ /* @__PURE__ */ jsx12(SelectContent, { children: sortedEvents.map((event) => {
949
1178
  const isNext = isNextEvent(event);
950
1179
  const isSelected = selectedEvent && (selectedEvent.event_id === event.event_id || selectedEvent.id === event.id);
951
- return /* @__PURE__ */ jsx11(
1180
+ return /* @__PURE__ */ jsx12(
952
1181
  SelectItem,
953
1182
  {
954
1183
  value: event.event_id || event.id,
955
1184
  className: "flex items-center justify-between",
956
- children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 w-full", children: [
957
- showNextEventIndicator && isNext && /* @__PURE__ */ jsx11(Star, { className: "h-3 w-3 text-acc-500" }),
958
- /* @__PURE__ */ jsxs5("div", { className: "flex-1", children: [
959
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
960
- /* @__PURE__ */ jsx11("span", { className: isSelected ? "font-semibold" : "", children: event.event_name }),
961
- isSelected && /* @__PURE__ */ jsx11("span", { className: "text-xs bg-primary text-primary-foreground px-1 rounded", children: "Current" })
1185
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 w-full", children: [
1186
+ showNextEventIndicator && isNext && /* @__PURE__ */ jsx12(Star, { className: "h-3 w-3 text-acc-500" }),
1187
+ /* @__PURE__ */ jsxs6("div", { className: "flex-1", children: [
1188
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1189
+ /* @__PURE__ */ jsx12("span", { className: isSelected ? "font-semibold" : "", children: event.event_name }),
1190
+ isSelected && /* @__PURE__ */ jsx12("span", { className: "text-xs bg-primary text-primary-foreground px-1 rounded", children: "Current" })
962
1191
  ] }),
963
- showEventDetails && event.event_date && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
964
- /* @__PURE__ */ jsx11(Calendar2, { className: "h-3 w-3" }),
965
- /* @__PURE__ */ jsx11("span", { children: formatEventDate(event.event_date) }),
966
- showNextEventIndicator && isNext && /* @__PURE__ */ jsx11("span", { className: "text-acc-600 font-medium", children: "(Next)" })
1192
+ showEventDetails && event.event_date && /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
1193
+ /* @__PURE__ */ jsx12(Calendar2, { className: "h-3 w-3" }),
1194
+ /* @__PURE__ */ jsx12("span", { children: formatEventDate(event.event_date) }),
1195
+ showNextEventIndicator && isNext && /* @__PURE__ */ jsx12("span", { className: "text-acc-600 font-medium", children: "(Next)" })
967
1196
  ] }),
968
- showEventDetails && event.event_venue && /* @__PURE__ */ jsxs5("div", { className: "text-xs text-muted-foreground", children: [
1197
+ showEventDetails && event.event_venue && /* @__PURE__ */ jsxs6("div", { className: "text-xs text-muted-foreground", children: [
969
1198
  "\u{1F4CD} ",
970
1199
  event.event_venue
971
1200
  ] })
@@ -981,9 +1210,9 @@ function EventSelector({
981
1210
  }
982
1211
 
983
1212
  // src/components/OrganisationSelector/OrganisationSelector.tsx
984
- import { useState as useState2, useCallback as useCallback2 } from "react";
1213
+ import { useState as useState3, useCallback as useCallback3 } from "react";
985
1214
  import { RefreshCw as RefreshCw2, AlertCircle as AlertCircle2, Building2, Shield } from "lucide-react";
986
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1215
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
987
1216
  function OrganisationSelector({
988
1217
  placeholder = "Select organisation",
989
1218
  className,
@@ -994,8 +1223,8 @@ function OrganisationSelector({
994
1223
  compact = false,
995
1224
  disabled = false
996
1225
  }) {
997
- const [isLoading, setIsLoading] = useState2(false);
998
- const [switchError, setSwitchError] = useState2(null);
1226
+ const [isLoading, setIsLoading] = useState3(false);
1227
+ const [switchError, setSwitchError] = useState3(null);
999
1228
  const {
1000
1229
  organisations,
1001
1230
  selectedOrganisation,
@@ -1006,7 +1235,7 @@ function OrganisationSelector({
1006
1235
  validateOrganisationAccess,
1007
1236
  refreshOrganisations
1008
1237
  } = useOrganisations();
1009
- const handleOrganisationChange = useCallback2(async (orgId) => {
1238
+ const handleOrganisationChange = useCallback3(async (orgId) => {
1010
1239
  if (disabled || isLoading) return;
1011
1240
  setSwitchError(null);
1012
1241
  setIsLoading(true);
@@ -1034,7 +1263,7 @@ function OrganisationSelector({
1034
1263
  organisations,
1035
1264
  onOrganisationChange
1036
1265
  ]);
1037
- const handleRetry = useCallback2(async () => {
1266
+ const handleRetry = useCallback3(async () => {
1038
1267
  setIsLoading(true);
1039
1268
  setSwitchError(null);
1040
1269
  try {
@@ -1047,21 +1276,21 @@ function OrganisationSelector({
1047
1276
  }
1048
1277
  }, [refreshOrganisations]);
1049
1278
  if (orgLoading) {
1050
- return /* @__PURE__ */ jsxs6("div", { className: `flex items-center gap-2 ${className}`, children: [
1051
- /* @__PURE__ */ jsx12(LoadingSpinner, { size: "sm" }),
1052
- /* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: compact ? "Loading..." : "Loading organisations..." })
1279
+ return /* @__PURE__ */ jsxs7("div", { className: `flex items-center gap-2 ${className}`, children: [
1280
+ /* @__PURE__ */ jsx13(LoadingSpinner, { size: "sm" }),
1281
+ /* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: compact ? "Loading..." : "Loading organisations..." })
1053
1282
  ] });
1054
1283
  }
1055
1284
  if (orgError) {
1056
- return /* @__PURE__ */ jsxs6("div", { className: `space-y-2 ${className}`, children: [
1057
- /* @__PURE__ */ jsxs6(Alert, { variant: "destructive", children: [
1058
- /* @__PURE__ */ jsx12(AlertCircle2, { className: "h-4 w-4" }),
1059
- /* @__PURE__ */ jsxs6(AlertDescription, { children: [
1285
+ return /* @__PURE__ */ jsxs7("div", { className: `space-y-2 ${className}`, children: [
1286
+ /* @__PURE__ */ jsxs7(Alert, { variant: "destructive", children: [
1287
+ /* @__PURE__ */ jsx13(AlertCircle2, { className: "h-4 w-4" }),
1288
+ /* @__PURE__ */ jsxs7(AlertDescription, { children: [
1060
1289
  "Failed to load organisations: ",
1061
1290
  orgError.message
1062
1291
  ] })
1063
1292
  ] }),
1064
- showRetryButton && /* @__PURE__ */ jsxs6(
1293
+ showRetryButton && /* @__PURE__ */ jsxs7(
1065
1294
  Button,
1066
1295
  {
1067
1296
  variant: "outline",
@@ -1070,7 +1299,7 @@ function OrganisationSelector({
1070
1299
  disabled: isLoading,
1071
1300
  className: "w-full",
1072
1301
  children: [
1073
- /* @__PURE__ */ jsx12(RefreshCw2, { className: `h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
1302
+ /* @__PURE__ */ jsx13(RefreshCw2, { className: `h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
1074
1303
  "Retry"
1075
1304
  ]
1076
1305
  }
@@ -1079,12 +1308,12 @@ function OrganisationSelector({
1079
1308
  }
1080
1309
  if (organisations.length === 0) {
1081
1310
  if (showNoOrganisationsMessage) {
1082
- return /* @__PURE__ */ jsxs6("div", { className: `space-y-2 ${className}`, children: [
1083
- /* @__PURE__ */ jsxs6(Alert, { children: [
1084
- /* @__PURE__ */ jsx12(Building2, { className: "h-4 w-4" }),
1085
- /* @__PURE__ */ jsx12(AlertDescription, { children: "No organisations available. Please contact your administrator to be added to an organisation." })
1311
+ return /* @__PURE__ */ jsxs7("div", { className: `space-y-2 ${className}`, children: [
1312
+ /* @__PURE__ */ jsxs7(Alert, { children: [
1313
+ /* @__PURE__ */ jsx13(Building2, { className: "h-4 w-4" }),
1314
+ /* @__PURE__ */ jsx13(AlertDescription, { children: "No organisations available. Please contact your administrator to be added to an organisation." })
1086
1315
  ] }),
1087
- showRetryButton && /* @__PURE__ */ jsxs6(
1316
+ showRetryButton && /* @__PURE__ */ jsxs7(
1088
1317
  Button,
1089
1318
  {
1090
1319
  variant: "outline",
@@ -1093,7 +1322,7 @@ function OrganisationSelector({
1093
1322
  disabled: isLoading,
1094
1323
  className: "w-full",
1095
1324
  children: [
1096
- /* @__PURE__ */ jsx12(RefreshCw2, { className: `h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
1325
+ /* @__PURE__ */ jsx13(RefreshCw2, { className: `h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
1097
1326
  "Check Again"
1098
1327
  ]
1099
1328
  }
@@ -1102,42 +1331,42 @@ function OrganisationSelector({
1102
1331
  }
1103
1332
  return null;
1104
1333
  }
1105
- const switchErrorDisplay = switchError && /* @__PURE__ */ jsxs6(Alert, { variant: "destructive", className: "mt-2", children: [
1106
- /* @__PURE__ */ jsx12(AlertCircle2, { className: "h-4 w-4" }),
1107
- /* @__PURE__ */ jsx12(AlertDescription, { children: switchError })
1334
+ const switchErrorDisplay = switchError && /* @__PURE__ */ jsxs7(Alert, { variant: "destructive", className: "mt-2", children: [
1335
+ /* @__PURE__ */ jsx13(AlertCircle2, { className: "h-4 w-4" }),
1336
+ /* @__PURE__ */ jsx13(AlertDescription, { children: switchError })
1108
1337
  ] });
1109
- return /* @__PURE__ */ jsxs6("div", { className: `space-y-2 ${className}`, children: [
1110
- /* @__PURE__ */ jsxs6(
1338
+ return /* @__PURE__ */ jsxs7("div", { className: `space-y-2 ${className}`, children: [
1339
+ /* @__PURE__ */ jsxs7(
1111
1340
  Select,
1112
1341
  {
1113
1342
  value: selectedOrganisation?.id || "",
1114
1343
  onValueChange: handleOrganisationChange,
1115
1344
  disabled: disabled || isLoading || !selectedOrganisation,
1116
1345
  children: [
1117
- /* @__PURE__ */ jsx12(SelectTrigger, { className: `${isLoading ? "opacity-50" : ""}`, children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1118
- isLoading ? /* @__PURE__ */ jsx12(LoadingSpinner, { size: "sm" }) : /* @__PURE__ */ jsx12(Building2, { className: "h-4 w-4 text-muted-foreground" }),
1119
- /* @__PURE__ */ jsx12(SelectValue, { placeholder })
1346
+ /* @__PURE__ */ jsx13(SelectTrigger, { className: `${isLoading ? "opacity-50" : ""}`, children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
1347
+ isLoading ? /* @__PURE__ */ jsx13(LoadingSpinner, { size: "sm" }) : /* @__PURE__ */ jsx13(Building2, { className: "h-4 w-4 text-muted-foreground" }),
1348
+ /* @__PURE__ */ jsx13(SelectValue, { placeholder })
1120
1349
  ] }) }),
1121
- /* @__PURE__ */ jsx12(SelectContent, { children: organisations.map((org) => {
1350
+ /* @__PURE__ */ jsx13(SelectContent, { children: organisations.map((org) => {
1122
1351
  const userRole = getUserRole(org.id);
1123
1352
  const hasAccess = validateOrganisationAccess(org.id);
1124
- return /* @__PURE__ */ jsx12(
1353
+ return /* @__PURE__ */ jsx13(
1125
1354
  SelectItem,
1126
1355
  {
1127
1356
  value: org.id,
1128
1357
  disabled: !hasAccess,
1129
1358
  className: !hasAccess ? "opacity-50" : "",
1130
- children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between w-full", children: [
1131
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1132
- /* @__PURE__ */ jsx12(Building2, { className: "h-4 w-4" }),
1133
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
1134
- /* @__PURE__ */ jsx12("span", { className: "font-medium", children: org.display_name }),
1135
- !compact && org.description && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground truncate max-w-40", children: org.description })
1359
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between w-full", children: [
1360
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
1361
+ /* @__PURE__ */ jsx13(Building2, { className: "h-4 w-4" }),
1362
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-col", children: [
1363
+ /* @__PURE__ */ jsx13("span", { className: "font-medium", children: org.display_name }),
1364
+ !compact && org.description && /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground truncate max-w-40", children: org.description })
1136
1365
  ] })
1137
1366
  ] }),
1138
- showRole && /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 ml-4", children: [
1139
- /* @__PURE__ */ jsx12(Shield, { className: "h-3 w-3 text-muted-foreground" }),
1140
- /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground capitalize", children: userRole?.replace("_", " ") || "No Role" })
1367
+ showRole && /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1 ml-4", children: [
1368
+ /* @__PURE__ */ jsx13(Shield, { className: "h-3 w-3 text-muted-foreground" }),
1369
+ /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground capitalize", children: userRole?.replace("_", " ") || "No Role" })
1141
1370
  ] })
1142
1371
  ] })
1143
1372
  },
@@ -1152,13 +1381,13 @@ function OrganisationSelector({
1152
1381
  }
1153
1382
 
1154
1383
  // src/components/PasswordChange/PasswordChangeForm.tsx
1155
- import { useState as useState3 } from "react";
1156
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1384
+ import { useState as useState4 } from "react";
1385
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1157
1386
  function PasswordChangeForm({ onSubmit, className }) {
1158
- const [newPassword, setNewPassword] = useState3("");
1159
- const [confirmPassword, setConfirmPassword] = useState3("");
1160
- const [error, setError] = useState3(null);
1161
- const [isSubmitting, setIsSubmitting] = useState3(false);
1387
+ const [newPassword, setNewPassword] = useState4("");
1388
+ const [confirmPassword, setConfirmPassword] = useState4("");
1389
+ const [error, setError] = useState4(null);
1390
+ const [isSubmitting, setIsSubmitting] = useState4(false);
1162
1391
  const handleSubmit = async (e) => {
1163
1392
  e.preventDefault();
1164
1393
  setError(null);
@@ -1183,11 +1412,11 @@ function PasswordChangeForm({ onSubmit, className }) {
1183
1412
  setIsSubmitting(false);
1184
1413
  }
1185
1414
  };
1186
- return /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
1187
- error && /* @__PURE__ */ jsx13("div", { role: "alert", children: error }),
1188
- /* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
1189
- /* @__PURE__ */ jsx13(Label, { htmlFor: "new-password", children: "New Password" }),
1190
- /* @__PURE__ */ jsx13(
1415
+ return /* @__PURE__ */ jsxs8("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
1416
+ error && /* @__PURE__ */ jsx14("div", { role: "alert", children: error }),
1417
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
1418
+ /* @__PURE__ */ jsx14(Label, { htmlFor: "new-password", children: "New Password" }),
1419
+ /* @__PURE__ */ jsx14(
1191
1420
  Input,
1192
1421
  {
1193
1422
  id: "new-password",
@@ -1199,9 +1428,9 @@ function PasswordChangeForm({ onSubmit, className }) {
1199
1428
  }
1200
1429
  )
1201
1430
  ] }),
1202
- /* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
1203
- /* @__PURE__ */ jsx13(Label, { htmlFor: "confirm-password", children: "Confirm Password" }),
1204
- /* @__PURE__ */ jsx13(
1431
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
1432
+ /* @__PURE__ */ jsx14(Label, { htmlFor: "confirm-password", children: "Confirm Password" }),
1433
+ /* @__PURE__ */ jsx14(
1205
1434
  Input,
1206
1435
  {
1207
1436
  id: "confirm-password",
@@ -1213,7 +1442,7 @@ function PasswordChangeForm({ onSubmit, className }) {
1213
1442
  }
1214
1443
  )
1215
1444
  ] }),
1216
- /* @__PURE__ */ jsx13(
1445
+ /* @__PURE__ */ jsx14(
1217
1446
  Button,
1218
1447
  {
1219
1448
  type: "submit",
@@ -1226,17 +1455,17 @@ function PasswordChangeForm({ onSubmit, className }) {
1226
1455
  }
1227
1456
 
1228
1457
  // src/components/UserMenu/UserMenu.tsx
1229
- import React12, { useCallback as useCallback3, useMemo as useMemo3, useState as useState4 } from "react";
1458
+ import React13, { useCallback as useCallback4, useMemo as useMemo3, useState as useState5 } from "react";
1230
1459
  import { ChevronDown, LogOut, KeyRound } from "lucide-react";
1231
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1232
- var UserMenu = React12.memo(function UserMenu2({
1460
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1461
+ var UserMenu = React13.memo(function UserMenu2({
1233
1462
  user,
1234
1463
  onSignOut,
1235
1464
  onChangePassword,
1236
1465
  className,
1237
1466
  showAvatar = true
1238
1467
  }) {
1239
- const [isPasswordDialogOpen, setPasswordDialogOpen] = useState4(false);
1468
+ const [isPasswordDialogOpen, setPasswordDialogOpen] = useState5(false);
1240
1469
  const userInfo = useMemo3(() => {
1241
1470
  if (!user) return null;
1242
1471
  return {
@@ -1246,42 +1475,42 @@ var UserMenu = React12.memo(function UserMenu2({
1246
1475
  initial: (user.user_metadata?.display_name || user.user_metadata?.full_name || user.email || "U").charAt(0).toUpperCase()
1247
1476
  };
1248
1477
  }, [user]);
1249
- const handleSignOut = useCallback3(async () => {
1478
+ const handleSignOut = useCallback4(async () => {
1250
1479
  if (onSignOut) await onSignOut();
1251
1480
  }, [onSignOut]);
1252
1481
  if (!user || !userInfo) {
1253
1482
  return null;
1254
1483
  }
1255
- return /* @__PURE__ */ jsxs8(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: [
1256
- /* @__PURE__ */ jsxs8(Select, { className, children: [
1257
- /* @__PURE__ */ jsx14(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
1258
- showAvatar && /* @__PURE__ */ jsxs8(Avatar, { className: "size-7", children: [
1259
- /* @__PURE__ */ jsx14(AvatarImage, { src: userInfo.avatarUrl, alt: userInfo.displayName }),
1260
- /* @__PURE__ */ jsx14(AvatarFallback, { children: userInfo.initial })
1484
+ return /* @__PURE__ */ jsxs9(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: [
1485
+ /* @__PURE__ */ jsxs9(Select, { className, children: [
1486
+ /* @__PURE__ */ jsx15(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
1487
+ showAvatar && /* @__PURE__ */ jsxs9(Avatar, { className: "size-7", children: [
1488
+ /* @__PURE__ */ jsx15(AvatarImage, { src: userInfo.avatarUrl, alt: userInfo.displayName }),
1489
+ /* @__PURE__ */ jsx15(AvatarFallback, { children: userInfo.initial })
1261
1490
  ] }),
1262
- /* @__PURE__ */ jsx14("span", { children: userInfo.displayName }),
1263
- /* @__PURE__ */ jsx14(ChevronDown, { className: "h-4 w-4" })
1491
+ /* @__PURE__ */ jsx15("span", { children: userInfo.displayName }),
1492
+ /* @__PURE__ */ jsx15(ChevronDown, { className: "h-4 w-4" })
1264
1493
  ] }) }),
1265
- /* @__PURE__ */ jsxs8(SelectContent, { children: [
1266
- /* @__PURE__ */ jsx14(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col space-y-1", children: [
1267
- /* @__PURE__ */ jsx14("p", { className: "font-medium", children: userInfo.displayName }),
1268
- /* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: userInfo.email })
1494
+ /* @__PURE__ */ jsxs9(SelectContent, { children: [
1495
+ /* @__PURE__ */ jsx15(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col space-y-1", children: [
1496
+ /* @__PURE__ */ jsx15("p", { className: "font-medium", children: userInfo.displayName }),
1497
+ /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: userInfo.email })
1269
1498
  ] }) }),
1270
- /* @__PURE__ */ jsx14(SelectSeparator, {}),
1271
- /* @__PURE__ */ jsx14(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(SelectItem, { value: "change-password", children: [
1272
- /* @__PURE__ */ jsx14(KeyRound, { className: "mr-2 h-4 w-4" }),
1273
- /* @__PURE__ */ jsx14("span", { children: "Change Password" })
1499
+ /* @__PURE__ */ jsx15(SelectSeparator, {}),
1500
+ /* @__PURE__ */ jsx15(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(SelectItem, { value: "change-password", children: [
1501
+ /* @__PURE__ */ jsx15(KeyRound, { className: "mr-2 h-4 w-4" }),
1502
+ /* @__PURE__ */ jsx15("span", { children: "Change Password" })
1274
1503
  ] }) }),
1275
- /* @__PURE__ */ jsxs8(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
1276
- /* @__PURE__ */ jsx14(LogOut, { className: "mr-2 h-4 w-4" }),
1277
- /* @__PURE__ */ jsx14("span", { children: "Sign out" })
1504
+ /* @__PURE__ */ jsxs9(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
1505
+ /* @__PURE__ */ jsx15(LogOut, { className: "mr-2 h-4 w-4" }),
1506
+ /* @__PURE__ */ jsx15("span", { children: "Sign out" })
1278
1507
  ] })
1279
1508
  ] })
1280
1509
  ] }),
1281
- /* @__PURE__ */ jsx14(DialogOverlay, {}),
1282
- /* @__PURE__ */ jsxs8(DialogContent, { className, children: [
1283
- /* @__PURE__ */ jsx14(DialogHeader, { children: /* @__PURE__ */ jsx14(DialogTitle, { children: "Change Password" }) }),
1284
- /* @__PURE__ */ jsx14(
1510
+ /* @__PURE__ */ jsx15(DialogOverlay, {}),
1511
+ /* @__PURE__ */ jsxs9(DialogContent, { className, children: [
1512
+ /* @__PURE__ */ jsx15(DialogHeader, { children: /* @__PURE__ */ jsx15(DialogTitle, { children: "Change Password" }) }),
1513
+ /* @__PURE__ */ jsx15(
1285
1514
  PasswordChangeForm,
1286
1515
  {
1287
1516
  onSubmit: async ({ newPassword, confirmPassword }) => {
@@ -1299,31 +1528,31 @@ var UserMenu = React12.memo(function UserMenu2({
1299
1528
  ] })
1300
1529
  ] });
1301
1530
  });
1302
- var UserMenuLoading = React12.memo(function UserMenuLoading2() {
1303
- return /* @__PURE__ */ jsxs8("div", { className: "relative inline-block text-left", children: [
1304
- /* @__PURE__ */ jsxs8(
1531
+ var UserMenuLoading = React13.memo(function UserMenuLoading2() {
1532
+ return /* @__PURE__ */ jsxs9("div", { className: "relative inline-block text-left", children: [
1533
+ /* @__PURE__ */ jsxs9(
1305
1534
  "button",
1306
1535
  {
1307
1536
  type: "button",
1308
1537
  disabled: true,
1309
1538
  className: "flex items-center space-x-2 px-3 py-2 text-sm font-medium text-muted-foreground bg-muted border border-input rounded-md",
1310
1539
  children: [
1311
- /* @__PURE__ */ jsx14("div", { className: "w-6 h-6 rounded-full bg-muted animate-pulse" }),
1312
- /* @__PURE__ */ jsx14("span", { className: "truncate max-w-[150px]", children: "Loading..." }),
1313
- /* @__PURE__ */ jsx14(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
1540
+ /* @__PURE__ */ jsx15("div", { className: "w-6 h-6 rounded-full bg-muted animate-pulse" }),
1541
+ /* @__PURE__ */ jsx15("span", { className: "truncate max-w-[150px]", children: "Loading..." }),
1542
+ /* @__PURE__ */ jsx15(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
1314
1543
  ]
1315
1544
  }
1316
1545
  ),
1317
- /* @__PURE__ */ jsx14("div", { role: "status", "aria-label": "Loading user menu", "aria-live": "polite", className: "w-6 h-6 rounded-full bg-muted animate-pulse" })
1546
+ /* @__PURE__ */ jsx15("div", { role: "status", "aria-label": "Loading user menu", "aria-live": "polite", className: "w-6 h-6 rounded-full bg-muted animate-pulse" })
1318
1547
  ] });
1319
1548
  });
1320
1549
  UserMenu.Loading = UserMenuLoading;
1321
1550
 
1322
1551
  // src/components/NavigationMenu/NavigationMenu.tsx
1323
- import * as React13 from "react";
1552
+ import * as React14 from "react";
1324
1553
  import { ChevronDown as ChevronDown2 } from "lucide-react";
1325
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1326
- var NavigationMenu = React13.forwardRef(({
1554
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1555
+ var NavigationMenu = React14.forwardRef(({
1327
1556
  items,
1328
1557
  mode = "dropdown",
1329
1558
  currentPath,
@@ -1341,8 +1570,8 @@ var NavigationMenu = React13.forwardRef(({
1341
1570
  itemsPreFiltered = false,
1342
1571
  ...props
1343
1572
  }, ref) => {
1344
- const [expandedItems, setExpandedItems] = React13.useState(/* @__PURE__ */ new Set());
1345
- const buttonRef = React13.useRef(null);
1573
+ const [expandedItems, setExpandedItems] = React14.useState(/* @__PURE__ */ new Set());
1574
+ const buttonRef = React14.useRef(null);
1346
1575
  let authContext = null;
1347
1576
  try {
1348
1577
  authContext = useUnifiedAuth();
@@ -1367,15 +1596,15 @@ var NavigationMenu = React13.forwardRef(({
1367
1596
  selectedOrganisationId: itemsPreFiltered ? null : selectedOrganisation?.id || null,
1368
1597
  selectedEventId: itemsPreFiltered ? null : selectedEvent?.event_id || null
1369
1598
  });
1370
- const [resolvedAppId, setResolvedAppId] = React13.useState(void 0);
1371
- React13.useEffect(() => {
1599
+ const [resolvedAppId, setResolvedAppId] = React14.useState(void 0);
1600
+ React14.useEffect(() => {
1372
1601
  if (!scopeLoading && !resolvedScope?.appId && selectedOrganisation?.id && authContext?.appName && authContext?.user?.id && !resolvedAppId) {
1373
1602
  if (!authContext.user || !authContext.appName) {
1374
1603
  return;
1375
1604
  }
1376
1605
  const userId2 = authContext.user.id;
1377
1606
  const appName = authContext.appName;
1378
- import("./api-BMFCXVQX.js").then(({ resolveAppContext }) => {
1607
+ import("./api-YP7XD5L6.js").then(({ resolveAppContext }) => {
1379
1608
  resolveAppContext({
1380
1609
  userId: userId2,
1381
1610
  appName
@@ -1389,7 +1618,7 @@ var NavigationMenu = React13.forwardRef(({
1389
1618
  });
1390
1619
  }
1391
1620
  }, [scopeLoading, resolvedScope?.appId, selectedOrganisation?.id, authContext?.appName, authContext?.user?.id, resolvedAppId]);
1392
- const effectiveScope = React13.useMemo(() => {
1621
+ const effectiveScope = React14.useMemo(() => {
1393
1622
  if (resolvedScope?.organisationId) {
1394
1623
  return resolvedScope;
1395
1624
  }
@@ -1404,7 +1633,7 @@ var NavigationMenu = React13.forwardRef(({
1404
1633
  return null;
1405
1634
  }, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
1406
1635
  const scopeKey = effectiveScope ? `${effectiveScope.organisationId || ""}-${effectiveScope.eventId || ""}-${effectiveScope.appId || ""}` : "empty";
1407
- const stableScope = React13.useMemo(() => {
1636
+ const stableScope = React14.useMemo(() => {
1408
1637
  if (effectiveScope?.organisationId) {
1409
1638
  return {
1410
1639
  organisationId: effectiveScope.organisationId,
@@ -1429,8 +1658,8 @@ var NavigationMenu = React13.forwardRef(({
1429
1658
  itemsPreFiltered ? void 0 : stableScope.appId
1430
1659
  // Skip if pre-filtered
1431
1660
  );
1432
- const previousFilteredItemsRef = React13.useRef([]);
1433
- const filteredItems = React13.useMemo(() => {
1661
+ const previousFilteredItemsRef = React14.useRef([]);
1662
+ const filteredItems = React14.useMemo(() => {
1434
1663
  if (itemsPreFiltered && items && items.length > 0) {
1435
1664
  const visibleItems = (items || []).filter((item) => !item.meta?.hidden);
1436
1665
  previousFilteredItemsRef.current = visibleItems;
@@ -1726,8 +1955,8 @@ var NavigationMenu = React13.forwardRef(({
1726
1955
  const hasChildren = item.children && item.children.length > 0;
1727
1956
  const isExpanded = expandedItems.has(item.id);
1728
1957
  const itemIsActive = isActiveItem(item);
1729
- return /* @__PURE__ */ jsx15("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs9("div", { children: [
1730
- /* @__PURE__ */ jsxs9(
1958
+ return /* @__PURE__ */ jsx16("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs10("div", { children: [
1959
+ /* @__PURE__ */ jsxs10(
1731
1960
  "button",
1732
1961
  {
1733
1962
  onClick: () => toggleExpanded(item.id),
@@ -1736,21 +1965,21 @@ var NavigationMenu = React13.forwardRef(({
1736
1965
  "aria-controls": `submenu-${item.id}`,
1737
1966
  "aria-current": itemIsActive ? "page" : void 0,
1738
1967
  children: [
1739
- /* @__PURE__ */ jsx15("span", { children: item.label }),
1740
- /* @__PURE__ */ jsx15(ChevronDown2, { "aria-hidden": "true" })
1968
+ /* @__PURE__ */ jsx16("span", { children: item.label }),
1969
+ /* @__PURE__ */ jsx16(ChevronDown2, { "aria-hidden": "true" })
1741
1970
  ]
1742
1971
  }
1743
1972
  ),
1744
- isExpanded && item.children && /* @__PURE__ */ jsx15(
1973
+ isExpanded && item.children && /* @__PURE__ */ jsx16(
1745
1974
  "ul",
1746
1975
  {
1747
1976
  id: `submenu-${item.id}`,
1748
1977
  role: "menu",
1749
1978
  "aria-label": `${item.label} submenu`,
1750
- children: item.children.map((child) => /* @__PURE__ */ jsx15(React13.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
1979
+ children: item.children.map((child) => /* @__PURE__ */ jsx16(React14.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
1751
1980
  }
1752
1981
  )
1753
- ] }) : /* @__PURE__ */ jsx15(
1982
+ ] }) : /* @__PURE__ */ jsx16(
1754
1983
  "a",
1755
1984
  {
1756
1985
  href: item.href || "#",
@@ -1768,26 +1997,26 @@ var NavigationMenu = React13.forwardRef(({
1768
1997
  ) });
1769
1998
  };
1770
1999
  if (mode === "dropdown") {
1771
- return /* @__PURE__ */ jsxs9(
2000
+ return /* @__PURE__ */ jsxs10(
1772
2001
  Select,
1773
2002
  {
1774
2003
  onValueChange: handleNavigationSelect,
1775
2004
  className,
1776
2005
  "data-testid": "navigation-menu-root",
1777
2006
  children: [
1778
- /* @__PURE__ */ jsx15(
2007
+ /* @__PURE__ */ jsx16(
1779
2008
  SelectTrigger,
1780
2009
  {
1781
2010
  ref: buttonRef,
1782
2011
  disabled,
1783
2012
  "aria-label": buttonText,
1784
2013
  "data-testid": "navigation-menu-trigger",
1785
- children: /* @__PURE__ */ jsx15(SelectValue, { placeholder: buttonText })
2014
+ children: /* @__PURE__ */ jsx16(SelectValue, { placeholder: buttonText })
1786
2015
  }
1787
2016
  ),
1788
- /* @__PURE__ */ jsx15(SelectContent, { children: filteredItems.map((item) => {
2017
+ /* @__PURE__ */ jsx16(SelectContent, { children: filteredItems.map((item) => {
1789
2018
  const isActive = isActiveItem(item);
1790
- return /* @__PURE__ */ jsx15(
2019
+ return /* @__PURE__ */ jsx16(
1791
2020
  SelectItem,
1792
2021
  {
1793
2022
  value: item.id,
@@ -1802,14 +2031,14 @@ var NavigationMenu = React13.forwardRef(({
1802
2031
  }
1803
2032
  );
1804
2033
  }
1805
- return /* @__PURE__ */ jsx15(
2034
+ return /* @__PURE__ */ jsx16(
1806
2035
  "nav",
1807
2036
  {
1808
2037
  ref,
1809
2038
  className,
1810
2039
  "aria-label": navigationLabel,
1811
2040
  ...props,
1812
- children: /* @__PURE__ */ jsx15("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx15(React13.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
2041
+ children: /* @__PURE__ */ jsx16("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx16(React14.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
1813
2042
  }
1814
2043
  );
1815
2044
  });
@@ -1817,7 +2046,7 @@ NavigationMenu.displayName = "NavigationMenu";
1817
2046
 
1818
2047
  // src/components/Header/Header.tsx
1819
2048
  import { Link } from "react-router-dom";
1820
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
2049
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1821
2050
  function Header({
1822
2051
  logoUrl,
1823
2052
  logoAlt = "Logo",
@@ -1836,32 +2065,32 @@ function Header({
1836
2065
  onNavigate,
1837
2066
  logoHref
1838
2067
  }) {
1839
- return /* @__PURE__ */ jsx16("header", { className: cn(
2068
+ return /* @__PURE__ */ jsx17("header", { className: cn(
1840
2069
  "w-full border-b border-main-200 h-16 shadow-sm bg-main-100 ",
1841
2070
  className
1842
- ), role: "banner", children: /* @__PURE__ */ jsxs10("nav", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto grid grid-cols-[auto_auto_1fr_auto] gap-4 h-full items-center", children: [
1843
- logo ? logoHref ? /* @__PURE__ */ jsx16(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: logo }) : logo : logoUrl ? logoHref ? /* @__PURE__ */ jsx16(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx16(
2071
+ ), role: "banner", children: /* @__PURE__ */ jsxs11("nav", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto flex items-center gap-4 h-full", children: [
2072
+ logo ? logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: logo }) : logo : logoUrl ? logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx17(
1844
2073
  "img",
1845
2074
  {
1846
2075
  src: logoUrl,
1847
2076
  alt: logoAlt || "Logo",
1848
2077
  className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
1849
2078
  }
1850
- ) }) : /* @__PURE__ */ jsx16(
2079
+ ) }) : /* @__PURE__ */ jsx17(
1851
2080
  "img",
1852
2081
  {
1853
2082
  src: logoUrl,
1854
2083
  alt: logoAlt || "Logo",
1855
2084
  className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
1856
2085
  }
1857
- ) : logoHref ? /* @__PURE__ */ jsx16(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx16(
2086
+ ) : logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx17(
1858
2087
  "img",
1859
2088
  {
1860
2089
  src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
1861
2090
  alt: logoAlt || "Logo",
1862
2091
  className: "h-8 w-8 shadow-md"
1863
2092
  }
1864
- ) }) : /* @__PURE__ */ jsx16(
2093
+ ) }) : /* @__PURE__ */ jsx17(
1865
2094
  "img",
1866
2095
  {
1867
2096
  src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
@@ -1869,7 +2098,7 @@ function Header({
1869
2098
  className: "h-8 w-8 shadow-md"
1870
2099
  }
1871
2100
  ),
1872
- navItems && navItems.length > 0 && /* @__PURE__ */ jsx16(
2101
+ navItems && navItems.length > 0 && /* @__PURE__ */ jsx17(
1873
2102
  NavigationMenu,
1874
2103
  {
1875
2104
  items: navItems,
@@ -1880,8 +2109,8 @@ function Header({
1880
2109
  itemsPreFiltered: true
1881
2110
  }
1882
2111
  ),
1883
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-4 justify-end", children: [
1884
- showOrgSelector ? /* @__PURE__ */ jsx16(
2112
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 ml-auto", children: [
2113
+ showOrgSelector ? /* @__PURE__ */ jsx17(
1885
2114
  OrganisationSelector,
1886
2115
  {
1887
2116
  placeholder: "Select organisation",
@@ -1890,18 +2119,16 @@ function Header({
1890
2119
  compact: true
1891
2120
  }
1892
2121
  ) : null,
1893
- showEventSelector ? /* @__PURE__ */ jsx16(
2122
+ showEventSelector ? /* @__PURE__ */ jsx17(
1894
2123
  EventSelector,
1895
2124
  {
1896
2125
  placeholder: "Select event",
1897
2126
  className: "w-96",
1898
2127
  "data-testid": "event-selector"
1899
2128
  }
1900
- ) : null
1901
- ] }),
1902
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-4", children: [
2129
+ ) : null,
1903
2130
  actions,
1904
- showUserMenu && (userMenu ? userMenu : /* @__PURE__ */ jsx16(
2131
+ showUserMenu && (userMenu ? userMenu : /* @__PURE__ */ jsx17(
1905
2132
  UserMenu,
1906
2133
  {
1907
2134
  user: user || null,
@@ -1915,8 +2142,8 @@ function Header({
1915
2142
  }
1916
2143
 
1917
2144
  // src/components/Footer/Footer.tsx
1918
- import React14 from "react";
1919
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2145
+ import React15 from "react";
2146
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1920
2147
  var FooterComponent = ({
1921
2148
  companyName = "Solvera Solutions Pty Ltd",
1922
2149
  year = (/* @__PURE__ */ new Date()).getFullYear(),
@@ -1927,21 +2154,21 @@ var FooterComponent = ({
1927
2154
  children
1928
2155
  }) => {
1929
2156
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
1930
- return /* @__PURE__ */ jsx17("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs11("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
1931
- logo && /* @__PURE__ */ jsx17("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
1932
- children && /* @__PURE__ */ jsx17(Fragment3, { children }),
1933
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: copyrightText }),
1934
- links && links.length > 0 && /* @__PURE__ */ jsx17("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
2157
+ return /* @__PURE__ */ jsx18("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs12("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
2158
+ logo && /* @__PURE__ */ jsx18("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
2159
+ children && /* @__PURE__ */ jsx18(Fragment3, { children }),
2160
+ /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: copyrightText }),
2161
+ links && links.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx18("li", { children: /* @__PURE__ */ jsx18("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
1935
2162
  ] }) });
1936
2163
  };
1937
2164
  FooterComponent.displayName = "Footer";
1938
- var Footer = React14.memo(FooterComponent);
2165
+ var Footer = React15.memo(FooterComponent);
1939
2166
  Footer.displayName = "Footer";
1940
2167
 
1941
2168
  // src/components/PaceAppLayout/PaceAppLayout.tsx
1942
- import { useState as useState6, useEffect as useEffect3, useMemo as useMemo5 } from "react";
2169
+ import { useState as useState7, useEffect as useEffect4, useMemo as useMemo5 } from "react";
1943
2170
  import { Outlet, useNavigate, useLocation } from "react-router-dom";
1944
- import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
2171
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
1945
2172
  var EMPTY_PAGE_ID_MAPPING = {};
1946
2173
  var EMPTY_ROUTE_PERMISSIONS = {};
1947
2174
  function PaceAppLayout({
@@ -2035,9 +2262,9 @@ function PaceAppLayout({
2035
2262
  const permissionString = `${currentRoutePermission}:page.${currentPageId}`;
2036
2263
  return permissionString;
2037
2264
  }, [enforcePermissions, currentRoutePermission, currentPageId]);
2038
- const [isSuperAdminUser, setIsSuperAdminUser] = useState6(false);
2039
- const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState6(false);
2040
- useEffect3(() => {
2265
+ const [isSuperAdminUser, setIsSuperAdminUser] = useState7(false);
2266
+ const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState7(false);
2267
+ useEffect4(() => {
2041
2268
  const checkSuperAdminStatus = async () => {
2042
2269
  if (!user?.id) {
2043
2270
  setIsSuperAdminUser(false);
@@ -2067,7 +2294,7 @@ function PaceAppLayout({
2067
2294
  );
2068
2295
  const can = isSuperAdminUser ? true : canFromHook;
2069
2296
  const hasPermission = enforcePermissions ? can : true;
2070
- useEffect3(() => {
2297
+ useEffect4(() => {
2071
2298
  if (!enforcePermissions) {
2072
2299
  return;
2073
2300
  }
@@ -2090,8 +2317,8 @@ function PaceAppLayout({
2090
2317
  onPageAccessDenied(currentPageId, currentRoutePermission);
2091
2318
  }
2092
2319
  }, [enforcePermissions, can, isCheckingPermission, isCheckingSuperAdmin, isSuperAdminUser, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
2093
- const [filteredMenuItems, setFilteredMenuItems] = useState6(baseMenuItems);
2094
- useEffect3(() => {
2320
+ const [filteredMenuItems, setFilteredMenuItems] = useState7(baseMenuItems);
2321
+ useEffect4(() => {
2095
2322
  let isMounted = true;
2096
2323
  const filterItems = async () => {
2097
2324
  if (!user?.id) {
@@ -2117,7 +2344,7 @@ function PaceAppLayout({
2117
2344
  return;
2118
2345
  }
2119
2346
  try {
2120
- const { isSuperAdmin: isSuperAdmin2 } = await import("./api-BMFCXVQX.js");
2347
+ const { isSuperAdmin: isSuperAdmin2 } = await import("./api-YP7XD5L6.js");
2121
2348
  const isSuper = await isSuperAdmin2(user.id);
2122
2349
  if (isSuper) {
2123
2350
  if (isMounted) {
@@ -2132,7 +2359,7 @@ function PaceAppLayout({
2132
2359
  }
2133
2360
  }
2134
2361
  try {
2135
- const { getPermissionMap } = await import("./api-BMFCXVQX.js");
2362
+ const { getPermissionMap } = await import("./api-YP7XD5L6.js");
2136
2363
  const permissionScope = {
2137
2364
  organisationId: currentScope.organisationId,
2138
2365
  eventId: currentScope.eventId,
@@ -2166,7 +2393,7 @@ function PaceAppLayout({
2166
2393
  isMounted = false;
2167
2394
  };
2168
2395
  }, [baseMenuItems, pageIdMapping, routePermissions, defaultPermission, can, user?.id, scope, scopeLoading, contextAppId, resolvedScope?.appId, selectedOrganisation?.id]);
2169
- useEffect3(() => {
2396
+ useEffect4(() => {
2170
2397
  if (!roleBasedRouting || routeConfig.length === 0) return;
2171
2398
  let isMounted = true;
2172
2399
  const checkRouteAccess = async () => {
@@ -2188,7 +2415,7 @@ function PaceAppLayout({
2188
2415
  let hasAccess = true;
2189
2416
  if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
2190
2417
  try {
2191
- const { isPermittedCached } = await import("./api-BMFCXVQX.js");
2418
+ const { isPermittedCached } = await import("./api-YP7XD5L6.js");
2192
2419
  const hasPagePermission = await isPermittedCached({
2193
2420
  userId: user?.id || "",
2194
2421
  scope,
@@ -2204,7 +2431,7 @@ function PaceAppLayout({
2204
2431
  }
2205
2432
  }
2206
2433
  if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
2207
- const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-A4BCQRJY.js");
2434
+ const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-B76OWOAT.js");
2208
2435
  hasAccess = true;
2209
2436
  }
2210
2437
  if (!isMounted) return;
@@ -2251,31 +2478,31 @@ function PaceAppLayout({
2251
2478
  return {};
2252
2479
  };
2253
2480
  if (enforcePermissions && (isCheckingSuperAdmin || isCheckingPermission)) {
2254
- return /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs12("div", { className: "text-center", children: [
2255
- /* @__PURE__ */ jsx18("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-sec-900 mx-auto mb-4" }),
2256
- /* @__PURE__ */ jsx18("p", { className: "text-sec-600", children: "Checking permissions..." })
2481
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs13("div", { className: "text-center", children: [
2482
+ /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-sec-900 mx-auto mb-4" }),
2483
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Checking permissions..." })
2257
2484
  ] }) });
2258
2485
  }
2259
2486
  if (enforcePermissions && permissionError && !isSuperAdminUser) {
2260
- return /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs12("div", { className: "text-center", children: [
2261
- /* @__PURE__ */ jsx18("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
2262
- /* @__PURE__ */ jsx18("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
2263
- /* @__PURE__ */ jsx18(Button, { onClick: () => navigate("/"), children: "Go Home" })
2487
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs13("div", { className: "text-center", children: [
2488
+ /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
2489
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
2490
+ /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" })
2264
2491
  ] }) });
2265
2492
  }
2266
2493
  if (enforcePermissions && hasPermission === false && !isCheckingSuperAdmin && !isSuperAdminUser) {
2267
2494
  if (enforcePagePermissions && pagePermissionFallback) {
2268
- return /* @__PURE__ */ jsx18(Fragment4, { children: pagePermissionFallback });
2495
+ return /* @__PURE__ */ jsx19(Fragment4, { children: pagePermissionFallback });
2269
2496
  }
2270
2497
  if (permissionFallback) {
2271
- return /* @__PURE__ */ jsx18(Fragment4, { children: permissionFallback });
2498
+ return /* @__PURE__ */ jsx19(Fragment4, { children: permissionFallback });
2272
2499
  }
2273
- return /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs12("div", { className: "text-center", children: [
2274
- /* @__PURE__ */ jsx18("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
2275
- /* @__PURE__ */ jsx18("p", { className: "text-sec-600 mb-4", children: "You don't have permission to access this page." }),
2276
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-2 justify-center", children: [
2277
- /* @__PURE__ */ jsx18(Button, { onClick: () => navigate("/"), children: "Go Home" }),
2278
- /* @__PURE__ */ jsx18(
2500
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs13("div", { className: "text-center", children: [
2501
+ /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
2502
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: "You don't have permission to access this page." }),
2503
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-2 justify-center", children: [
2504
+ /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" }),
2505
+ /* @__PURE__ */ jsx19(
2279
2506
  Button,
2280
2507
  {
2281
2508
  variant: "outline",
@@ -2289,8 +2516,8 @@ function PaceAppLayout({
2289
2516
  ] })
2290
2517
  ] }) });
2291
2518
  }
2292
- return /* @__PURE__ */ jsxs12(Fragment4, { children: [
2293
- /* @__PURE__ */ jsx18(
2519
+ return /* @__PURE__ */ jsxs13(Fragment4, { children: [
2520
+ /* @__PURE__ */ jsx19(
2294
2521
  Header,
2295
2522
  {
2296
2523
  logo: customLogo || void 0,
@@ -2315,15 +2542,15 @@ function PaceAppLayout({
2315
2542
  className: headerClassName || "sticky top-0 z-[40] w-full"
2316
2543
  }
2317
2544
  ),
2318
- /* @__PURE__ */ jsx18("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: /* @__PURE__ */ jsx18(Outlet, {}) }),
2319
- /* @__PURE__ */ jsx18(Footer, {})
2545
+ /* @__PURE__ */ jsx19("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: /* @__PURE__ */ jsx19(Outlet, {}) }),
2546
+ /* @__PURE__ */ jsx19(Footer, {})
2320
2547
  ] });
2321
2548
  }
2322
2549
 
2323
2550
  // src/components/PaceLoginPage/PaceLoginPage.tsx
2324
- import { useEffect as useEffect4, useState as useState7, useContext } from "react";
2551
+ import { useEffect as useEffect5, useState as useState8, useContext } from "react";
2325
2552
  import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
2326
- import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
2553
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
2327
2554
  var PaceLoginPage = ({
2328
2555
  appName = "Pace",
2329
2556
  onSuccessRedirectPath = "/",
@@ -2332,21 +2559,21 @@ var PaceLoginPage = ({
2332
2559
  const { signIn, isAuthenticated, isLoading, authError, user, supabase } = useUnifiedAuth();
2333
2560
  const navigate = useNavigate2();
2334
2561
  const location = useLocation2();
2335
- const [isSigningIn, setIsSigningIn] = useState7(false);
2336
- const [accessError, setAccessError] = useState7(null);
2337
- const [isCheckingAccess, setIsCheckingAccess] = useState7(false);
2562
+ const [isSigningIn, setIsSigningIn] = useState8(false);
2563
+ const [accessError, setAccessError] = useState8(null);
2564
+ const [isCheckingAccess, setIsCheckingAccess] = useState8(false);
2338
2565
  const eventServiceContext = useContext(EventServiceContext);
2339
2566
  const eventService = eventServiceContext?.eventService || null;
2340
- useEffect4(() => {
2567
+ useEffect5(() => {
2341
2568
  clearPalette();
2342
2569
  }, []);
2343
- useEffect4(() => {
2570
+ useEffect5(() => {
2344
2571
  const isOnLoginPage = location.pathname === "/login" || location.pathname.startsWith("/login");
2345
2572
  if (isOnLoginPage) {
2346
2573
  clearPalette();
2347
2574
  }
2348
2575
  }, [location.pathname]);
2349
- useEffect4(() => {
2576
+ useEffect5(() => {
2350
2577
  const restoreEvent = async () => {
2351
2578
  try {
2352
2579
  const isOnLoginPage = window.location.pathname === "/login" || window.location.pathname.startsWith("/login");
@@ -2362,7 +2589,7 @@ var PaceLoginPage = ({
2362
2589
  }, 100);
2363
2590
  return () => clearTimeout(timeoutId);
2364
2591
  }, [eventService]);
2365
- useEffect4(() => {
2592
+ useEffect5(() => {
2366
2593
  if (!requireAppAccess || !isAuthenticated || isLoading || !user || !supabase) {
2367
2594
  return;
2368
2595
  }
@@ -2454,8 +2681,8 @@ var PaceLoginPage = ({
2454
2681
  setIsSigningIn(false);
2455
2682
  }
2456
2683
  };
2457
- return /* @__PURE__ */ jsxs13("main", { className: "min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8", "aria-label": `${appName} Login Page`, children: [
2458
- /* @__PURE__ */ jsx19(
2684
+ return /* @__PURE__ */ jsxs14("main", { className: "min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8", "aria-label": `${appName} Login Page`, children: [
2685
+ /* @__PURE__ */ jsx20(
2459
2686
  "img",
2460
2687
  {
2461
2688
  src: `/${appName.toLowerCase()}_logo_square.svg`,
@@ -2463,7 +2690,7 @@ var PaceLoginPage = ({
2463
2690
  className: "h-48"
2464
2691
  }
2465
2692
  ),
2466
- /* @__PURE__ */ jsx19(
2693
+ /* @__PURE__ */ jsx20(
2467
2694
  LoginForm,
2468
2695
  {
2469
2696
  className: "w-md",
@@ -2477,20 +2704,20 @@ var PaceLoginPage = ({
2477
2704
  ),
2478
2705
  (() => {
2479
2706
  const benign = !!(authError && (authError.name === "AuthSessionMissingError" || /Auth session missing/i.test(authError.message)));
2480
- return authError && !benign ? /* @__PURE__ */ jsx19("em", { className: "mt-4 text-destructive text-center", children: authError.message }) : null;
2707
+ return authError && !benign ? /* @__PURE__ */ jsx20("em", { className: "mt-4 text-destructive text-center", children: authError.message }) : null;
2481
2708
  })(),
2482
- accessError && /* @__PURE__ */ jsx19("em", { className: "mt-4 text-destructive text-center", children: accessError }),
2483
- isCheckingAccess && /* @__PURE__ */ jsx19("em", { className: "mt-4 text-muted-foreground text-center", children: "Checking permissions..." })
2709
+ accessError && /* @__PURE__ */ jsx20("em", { className: "mt-4 text-destructive text-center", children: accessError }),
2710
+ isCheckingAccess && /* @__PURE__ */ jsx20("em", { className: "mt-4 text-muted-foreground text-center", children: "Checking permissions..." })
2484
2711
  ] });
2485
2712
  };
2486
2713
 
2487
2714
  // src/components/SessionRestorationLoader/SessionRestorationLoader.tsx
2488
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
2715
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2489
2716
  var SessionRestorationLoader = ({
2490
2717
  message = "Restoring session...",
2491
2718
  className
2492
2719
  }) => {
2493
- return /* @__PURE__ */ jsxs14(
2720
+ return /* @__PURE__ */ jsxs15(
2494
2721
  "div",
2495
2722
  {
2496
2723
  className: cn(
@@ -2501,17 +2728,17 @@ var SessionRestorationLoader = ({
2501
2728
  "aria-live": "polite",
2502
2729
  "aria-label": message,
2503
2730
  children: [
2504
- /* @__PURE__ */ jsx20(LoadingSpinner, { size: "lg" }),
2505
- /* @__PURE__ */ jsx20("div", { className: "text-sm text-sec-600", children: message })
2731
+ /* @__PURE__ */ jsx21(LoadingSpinner, { size: "lg" }),
2732
+ /* @__PURE__ */ jsx21("div", { className: "text-sm text-sec-600", children: message })
2506
2733
  ]
2507
2734
  }
2508
2735
  );
2509
2736
  };
2510
2737
 
2511
2738
  // src/components/ProtectedRoute/ProtectedRoute.tsx
2512
- import { useMemo as useMemo6 } from "react";
2739
+ import { useMemo as useMemo6, useEffect as useEffect6, useRef as useRef4, useState as useState9 } from "react";
2513
2740
  import { Navigate, Outlet as Outlet2 } from "react-router-dom";
2514
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2741
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2515
2742
  function ProtectedRoute({
2516
2743
  requireEvent = false,
2517
2744
  allowSuperAdminBypass = false,
@@ -2525,6 +2752,67 @@ function ProtectedRoute({
2525
2752
  const events = requireEvent ? eventsContext.events || [] : [];
2526
2753
  const eventLoading = requireEvent ? eventsContext.isLoading || false : false;
2527
2754
  const sessionRestoration = useSessionRestoration();
2755
+ usePreventTabReload({ enabled: true, gracePeriodMs: 2e3 });
2756
+ const wasAuthenticatedRef = useRef4(false);
2757
+ const [shouldRedirect, setShouldRedirect] = useState9(false);
2758
+ const tabJustBecameVisibleRef = useRef4(false);
2759
+ useEffect6(() => {
2760
+ if (isAuthenticated) {
2761
+ wasAuthenticatedRef.current = true;
2762
+ setShouldRedirect(false);
2763
+ tabJustBecameVisibleRef.current = false;
2764
+ }
2765
+ }, [isAuthenticated]);
2766
+ useEffect6(() => {
2767
+ if (typeof document === "undefined") return;
2768
+ let timeoutId = null;
2769
+ let wasHidden = document.hidden;
2770
+ const handleVisibilityChange = () => {
2771
+ const isNowVisible = !document.hidden;
2772
+ if (isNowVisible && wasHidden) {
2773
+ if (!isAuthenticated && wasAuthenticatedRef.current) {
2774
+ tabJustBecameVisibleRef.current = true;
2775
+ setShouldRedirect(false);
2776
+ if (timeoutId) {
2777
+ clearTimeout(timeoutId);
2778
+ }
2779
+ timeoutId = setTimeout(() => {
2780
+ tabJustBecameVisibleRef.current = false;
2781
+ setShouldRedirect((prev) => {
2782
+ return prev;
2783
+ });
2784
+ }, 2e3);
2785
+ }
2786
+ } else if (!isNowVisible) {
2787
+ tabJustBecameVisibleRef.current = false;
2788
+ if (timeoutId) {
2789
+ clearTimeout(timeoutId);
2790
+ timeoutId = null;
2791
+ }
2792
+ }
2793
+ wasHidden = !isNowVisible;
2794
+ };
2795
+ if (!document.hidden && !isAuthenticated && wasAuthenticatedRef.current) {
2796
+ tabJustBecameVisibleRef.current = true;
2797
+ setShouldRedirect(false);
2798
+ timeoutId = setTimeout(() => {
2799
+ tabJustBecameVisibleRef.current = false;
2800
+ }, 2e3);
2801
+ }
2802
+ document.addEventListener("visibilitychange", handleVisibilityChange);
2803
+ return () => {
2804
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
2805
+ if (timeoutId) {
2806
+ clearTimeout(timeoutId);
2807
+ }
2808
+ };
2809
+ }, [isAuthenticated]);
2810
+ useEffect6(() => {
2811
+ if (isAuthenticated) {
2812
+ setShouldRedirect(false);
2813
+ tabJustBecameVisibleRef.current = false;
2814
+ }
2815
+ }, [isAuthenticated]);
2528
2816
  const isRestoringSession = useMemo6(() => {
2529
2817
  return sessionRestoration.isRestoring && !sessionRestoration.restorationComplete && !sessionRestoration.restorationError && !sessionRestoration.hasTimedOut;
2530
2818
  }, [
@@ -2534,13 +2822,13 @@ function ProtectedRoute({
2534
2822
  sessionRestoration.hasTimedOut
2535
2823
  ]);
2536
2824
  if (isRestoringSession) {
2537
- return /* @__PURE__ */ jsx21(SessionRestorationLoader, {});
2825
+ return /* @__PURE__ */ jsx22(SessionRestorationLoader, {});
2538
2826
  }
2539
2827
  if (requireEvent && eventLoading) {
2540
- return /* @__PURE__ */ jsx21(Outlet2, {});
2828
+ return /* @__PURE__ */ jsx22(Outlet2, {});
2541
2829
  }
2542
2830
  if (isLoading && !sessionRestoration.hasTimedOut) {
2543
- return loadingFallback || /* @__PURE__ */ jsx21("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx21(LoadingSpinner, {}) });
2831
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
2544
2832
  }
2545
2833
  if (!isAuthenticated) {
2546
2834
  if (sessionRestoration.hasTimedOut || sessionRestoration.restorationError) {
@@ -2548,33 +2836,47 @@ function ProtectedRoute({
2548
2836
  timedOut: sessionRestoration.hasTimedOut,
2549
2837
  error: sessionRestoration.restorationError?.message
2550
2838
  });
2839
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
2840
+ }
2841
+ if (!wasAuthenticatedRef.current) {
2842
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
2843
+ }
2844
+ const isTabVisible = typeof document !== "undefined" && !document.hidden;
2845
+ if (tabJustBecameVisibleRef.current || isTabVisible && wasAuthenticatedRef.current && isLoading) {
2846
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
2847
+ }
2848
+ if (shouldRedirect) {
2849
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
2551
2850
  }
2552
- return /* @__PURE__ */ jsx21(Navigate, { to: loginPath, replace: true });
2851
+ if (isLoading) {
2852
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
2853
+ }
2854
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
2553
2855
  }
2554
2856
  if (!requireEvent) {
2555
- return /* @__PURE__ */ jsx21(Outlet2, {});
2857
+ return /* @__PURE__ */ jsx22(Outlet2, {});
2556
2858
  }
2557
2859
  if (!events || events.length === 0) {
2558
- return noEventsFallback || /* @__PURE__ */ jsx21("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh", padding: "2rem" }, children: /* @__PURE__ */ jsxs15(Alert, { variant: "destructive", className: "max-w-md", children: [
2559
- /* @__PURE__ */ jsx21(AlertTitle, { children: "No Events Available" }),
2560
- /* @__PURE__ */ jsx21(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
2860
+ return noEventsFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh", padding: "2rem" }, children: /* @__PURE__ */ jsxs16(Alert, { variant: "destructive", className: "max-w-md", children: [
2861
+ /* @__PURE__ */ jsx22(AlertTitle, { children: "No Events Available" }),
2862
+ /* @__PURE__ */ jsx22(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
2561
2863
  ] }) });
2562
2864
  }
2563
2865
  if (!selectedEvent) {
2564
2866
  logger.debug("ProtectedRoute", "Events available but none selected - allowing render so selector is visible");
2565
- return /* @__PURE__ */ jsx21(Outlet2, {});
2867
+ return /* @__PURE__ */ jsx22(Outlet2, {});
2566
2868
  }
2567
- return /* @__PURE__ */ jsx21(Outlet2, {});
2869
+ return /* @__PURE__ */ jsx22(Outlet2, {});
2568
2870
  }
2569
2871
 
2570
2872
  // src/hooks/useFileReference.ts
2571
- import { useState as useState8, useCallback as useCallback5, useEffect as useEffect5, useRef as useRef3, useMemo as useMemo7 } from "react";
2873
+ import { useState as useState10, useCallback as useCallback6, useEffect as useEffect7, useRef as useRef5, useMemo as useMemo7 } from "react";
2572
2874
  var log = createLogger("useFileReference");
2573
2875
  function useFileReference(supabase) {
2574
- const [isLoading, setIsLoading] = useState8(false);
2575
- const [error, setError] = useState8(null);
2876
+ const [isLoading, setIsLoading] = useState10(false);
2877
+ const [error, setError] = useState10(null);
2576
2878
  const service = useMemo7(() => createFileReferenceService(supabase), [supabase]);
2577
- const uploadFile = useCallback5(async (options, file) => {
2879
+ const uploadFile = useCallback6(async (options, file) => {
2578
2880
  setIsLoading(true);
2579
2881
  setError(null);
2580
2882
  try {
@@ -2588,7 +2890,7 @@ function useFileReference(supabase) {
2588
2890
  setIsLoading(false);
2589
2891
  }
2590
2892
  }, [supabase]);
2591
- const getFileReference = useCallback5(async (table_name, record_id, organisation_id) => {
2893
+ const getFileReference = useCallback6(async (table_name, record_id, organisation_id) => {
2592
2894
  setIsLoading(true);
2593
2895
  setError(null);
2594
2896
  try {
@@ -2601,7 +2903,7 @@ function useFileReference(supabase) {
2601
2903
  setIsLoading(false);
2602
2904
  }
2603
2905
  }, [service]);
2604
- const getFileUrl = useCallback5(async (table_name, record_id, organisation_id) => {
2906
+ const getFileUrl = useCallback6(async (table_name, record_id, organisation_id) => {
2605
2907
  setIsLoading(true);
2606
2908
  setError(null);
2607
2909
  try {
@@ -2614,7 +2916,7 @@ function useFileReference(supabase) {
2614
2916
  setIsLoading(false);
2615
2917
  }
2616
2918
  }, [service]);
2617
- const getSignedUrl2 = useCallback5(async (table_name, record_id, organisation_id, expires_in) => {
2919
+ const getSignedUrl3 = useCallback6(async (table_name, record_id, organisation_id, expires_in) => {
2618
2920
  setIsLoading(true);
2619
2921
  setError(null);
2620
2922
  try {
@@ -2627,7 +2929,7 @@ function useFileReference(supabase) {
2627
2929
  setIsLoading(false);
2628
2930
  }
2629
2931
  }, [service]);
2630
- const updateFileReference = useCallback5(async (id, updates) => {
2932
+ const updateFileReference = useCallback6(async (id, updates) => {
2631
2933
  setIsLoading(true);
2632
2934
  setError(null);
2633
2935
  try {
@@ -2640,7 +2942,7 @@ function useFileReference(supabase) {
2640
2942
  setIsLoading(false);
2641
2943
  }
2642
2944
  }, [service]);
2643
- const deleteFileReference = useCallback5(async (table_name, record_id, organisation_id, delete_file) => {
2945
+ const deleteFileReference = useCallback6(async (table_name, record_id, organisation_id, delete_file) => {
2644
2946
  setIsLoading(true);
2645
2947
  setError(null);
2646
2948
  try {
@@ -2653,7 +2955,7 @@ function useFileReference(supabase) {
2653
2955
  setIsLoading(false);
2654
2956
  }
2655
2957
  }, [service]);
2656
- const listFileReferences = useCallback5(async (table_name, record_id, organisation_id) => {
2958
+ const listFileReferences = useCallback6(async (table_name, record_id, organisation_id) => {
2657
2959
  setIsLoading(true);
2658
2960
  setError(null);
2659
2961
  try {
@@ -2666,7 +2968,7 @@ function useFileReference(supabase) {
2666
2968
  setIsLoading(false);
2667
2969
  }
2668
2970
  }, [service]);
2669
- const getFileCount = useCallback5(async (table_name, record_id, organisation_id) => {
2971
+ const getFileCount = useCallback6(async (table_name, record_id, organisation_id) => {
2670
2972
  setIsLoading(true);
2671
2973
  setError(null);
2672
2974
  try {
@@ -2679,7 +2981,7 @@ function useFileReference(supabase) {
2679
2981
  setIsLoading(false);
2680
2982
  }
2681
2983
  }, [service]);
2682
- const getFileReferenceById = useCallback5(async (id, organisation_id) => {
2984
+ const getFileReferenceById = useCallback6(async (id, organisation_id) => {
2683
2985
  setIsLoading(true);
2684
2986
  setError(null);
2685
2987
  try {
@@ -2692,7 +2994,7 @@ function useFileReference(supabase) {
2692
2994
  setIsLoading(false);
2693
2995
  }
2694
2996
  }, [service]);
2695
- const getFilesByCategory = useCallback5(async (table_name, record_id, category, organisation_id) => {
2997
+ const getFilesByCategory = useCallback6(async (table_name, record_id, category, organisation_id) => {
2696
2998
  setIsLoading(true);
2697
2999
  setError(null);
2698
3000
  try {
@@ -2705,7 +3007,7 @@ function useFileReference(supabase) {
2705
3007
  setIsLoading(false);
2706
3008
  }
2707
3009
  }, [service]);
2708
- const clearError = useCallback5(() => {
3010
+ const clearError = useCallback6(() => {
2709
3011
  setError(null);
2710
3012
  }, []);
2711
3013
  return {
@@ -2715,7 +3017,7 @@ function useFileReference(supabase) {
2715
3017
  getFileReference,
2716
3018
  getFileReferenceById,
2717
3019
  getFileUrl,
2718
- getSignedUrl: getSignedUrl2,
3020
+ getSignedUrl: getSignedUrl3,
2719
3021
  updateFileReference,
2720
3022
  deleteFileReference,
2721
3023
  listFileReferences,
@@ -2736,32 +3038,32 @@ function useFileReferenceForRecord(supabase, table_name, record_id, organisation
2736
3038
  getFileCount,
2737
3039
  clearError
2738
3040
  } = useFileReference(supabase);
2739
- const [fileUrl, setFileUrl] = useState8(null);
2740
- const [fileReference, setFileReference] = useState8(null);
2741
- const [fileReferences, setFileReferences] = useState8([]);
2742
- const [fileCount, setFileCount] = useState8(0);
2743
- const urlRefreshIntervalRef = useRef3(null);
2744
- const loadFileReference = useCallback5(async () => {
3041
+ const [fileUrl, setFileUrl] = useState10(null);
3042
+ const [fileReference, setFileReference] = useState10(null);
3043
+ const [fileReferences, setFileReferences] = useState10([]);
3044
+ const [fileCount, setFileCount] = useState10(0);
3045
+ const urlRefreshIntervalRef = useRef5(null);
3046
+ const loadFileReference = useCallback6(async () => {
2745
3047
  const reference = await getFileReference(table_name, record_id, organisation_id);
2746
3048
  setFileReference(reference);
2747
3049
  return reference;
2748
3050
  }, [getFileReference, table_name, record_id, organisation_id]);
2749
- const loadFileUrl = useCallback5(async () => {
3051
+ const loadFileUrl = useCallback6(async () => {
2750
3052
  const url = await getFileUrl(table_name, record_id, organisation_id);
2751
3053
  setFileUrl(url);
2752
3054
  return url;
2753
3055
  }, [getFileUrl, table_name, record_id, organisation_id]);
2754
- const loadFileReferences = useCallback5(async () => {
3056
+ const loadFileReferences = useCallback6(async () => {
2755
3057
  const references = await listFileReferences(table_name, record_id, organisation_id);
2756
3058
  setFileReferences(references);
2757
3059
  return references;
2758
3060
  }, [listFileReferences, table_name, record_id, organisation_id]);
2759
- const loadFileCount = useCallback5(async () => {
3061
+ const loadFileCount = useCallback6(async () => {
2760
3062
  const count = await getFileCount(table_name, record_id, organisation_id);
2761
3063
  setFileCount(count);
2762
3064
  return count;
2763
3065
  }, [getFileCount, table_name, record_id, organisation_id]);
2764
- const deleteFile = useCallback5(async (delete_file) => {
3066
+ const deleteFile = useCallback6(async (delete_file) => {
2765
3067
  const success = await deleteFileReference(table_name, record_id, organisation_id, delete_file);
2766
3068
  if (success) {
2767
3069
  setFileReference(null);
@@ -2770,7 +3072,7 @@ function useFileReferenceForRecord(supabase, table_name, record_id, organisation
2770
3072
  }
2771
3073
  return success;
2772
3074
  }, [deleteFileReference, table_name, record_id, organisation_id, loadFileCount]);
2773
- useEffect5(() => {
3075
+ useEffect7(() => {
2774
3076
  if (!fileReference || fileReference.is_public) {
2775
3077
  if (urlRefreshIntervalRef.current) {
2776
3078
  clearInterval(urlRefreshIntervalRef.current);
@@ -2811,9 +3113,9 @@ function useFileReferenceById(supabase, fileReferenceId, organisationId) {
2811
3113
  getFileReferenceById,
2812
3114
  clearError
2813
3115
  } = useFileReference(supabase);
2814
- const [fileReference, setFileReference] = useState8(null);
2815
- const [fileUrl, setFileUrl] = useState8(null);
2816
- const loadFileReference = useCallback5(async () => {
3116
+ const [fileReference, setFileReference] = useState10(null);
3117
+ const [fileUrl, setFileUrl] = useState10(null);
3118
+ const loadFileReference = useCallback6(async () => {
2817
3119
  if (!fileReferenceId || !organisationId) {
2818
3120
  setFileReference(null);
2819
3121
  setFileUrl(null);
@@ -2823,10 +3125,10 @@ function useFileReferenceById(supabase, fileReferenceId, organisationId) {
2823
3125
  setFileReference(reference);
2824
3126
  return reference;
2825
3127
  }, [getFileReferenceById, fileReferenceId, organisationId]);
2826
- useEffect5(() => {
3128
+ useEffect7(() => {
2827
3129
  loadFileReference();
2828
3130
  }, [loadFileReference]);
2829
- useEffect5(() => {
3131
+ useEffect7(() => {
2830
3132
  if (!fileReference || !fileReferenceId || !organisationId) {
2831
3133
  setFileUrl(null);
2832
3134
  return;
@@ -2858,9 +3160,9 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
2858
3160
  getFilesByCategory,
2859
3161
  clearError
2860
3162
  } = useFileReference(supabase);
2861
- const [fileReferences, setFileReferences] = useState8([]);
2862
- const [fileUrls, setFileUrls] = useState8(/* @__PURE__ */ new Map());
2863
- const loadFiles = useCallback5(async () => {
3163
+ const [fileReferences, setFileReferences] = useState10([]);
3164
+ const [fileUrls, setFileUrls] = useState10(/* @__PURE__ */ new Map());
3165
+ const loadFiles = useCallback6(async () => {
2864
3166
  if (!category || !organisation_id) {
2865
3167
  setFileReferences([]);
2866
3168
  setFileUrls(/* @__PURE__ */ new Map());
@@ -2868,31 +3170,15 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
2868
3170
  }
2869
3171
  const files = await getFilesByCategory(table_name, record_id, category, organisation_id);
2870
3172
  setFileReferences(files);
2871
- const urlMap = /* @__PURE__ */ new Map();
2872
- for (const fileRef of files) {
2873
- try {
2874
- let url = null;
2875
- if (fileRef.is_public) {
2876
- url = getPublicUrl(supabase, fileRef.file_path, true);
2877
- } else {
2878
- const signedUrlResult = await getSignedUrl(supabase, fileRef.file_path, {
2879
- appName: "file-reference",
2880
- orgId: organisation_id,
2881
- expiresIn: 3600
2882
- });
2883
- url = signedUrlResult?.url || null;
2884
- }
2885
- if (url) {
2886
- urlMap.set(fileRef.id, url);
2887
- }
2888
- } catch (err) {
2889
- log.error(`Failed to load URL for file ${fileRef.id}:`, err);
2890
- }
2891
- }
3173
+ const urlMap = await generateFileUrlsBatch(supabase, files, {
3174
+ appName: "file-reference",
3175
+ orgId: organisation_id,
3176
+ expiresIn: 3600
3177
+ });
2892
3178
  setFileUrls(urlMap);
2893
3179
  return files;
2894
3180
  }, [table_name, record_id, category, organisation_id, supabase, getFilesByCategory]);
2895
- useEffect5(() => {
3181
+ useEffect7(() => {
2896
3182
  loadFiles();
2897
3183
  }, [loadFiles]);
2898
3184
  return {
@@ -2906,8 +3192,8 @@ function useFilesByCategory(supabase, table_name, record_id, category, organisat
2906
3192
  }
2907
3193
 
2908
3194
  // src/components/FileUpload/FileUpload.tsx
2909
- import { useState as useState9, useCallback as useCallback6, useRef as useRef4, useEffect as useEffect6, useMemo as useMemo8 } from "react";
2910
- import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
3195
+ import { useState as useState11, useCallback as useCallback7, useRef as useRef6, useEffect as useEffect8, useMemo as useMemo8 } from "react";
3196
+ import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
2911
3197
  function FileUpload({
2912
3198
  supabase,
2913
3199
  table_name,
@@ -2915,7 +3201,9 @@ function FileUpload({
2915
3201
  organisation_id,
2916
3202
  app_id,
2917
3203
  category,
3204
+ folder,
2918
3205
  pageContext,
3206
+ event_id,
2919
3207
  accept = "*/*",
2920
3208
  maxSize = 10 * 1024 * 1024,
2921
3209
  // 10MB default
@@ -2930,14 +3218,14 @@ function FileUpload({
2930
3218
  onProgress,
2931
3219
  children
2932
3220
  }) {
2933
- const [isDragging, setIsDragging] = useState9(false);
2934
- const [uploadStates, setUploadStates] = useState9(/* @__PURE__ */ new Map());
2935
- const [resolvedAppId, setResolvedAppId] = useState9(app_id || null);
2936
- const [isResolvingAppId, setIsResolvingAppId] = useState9(!app_id);
2937
- const [appIdError, setAppIdError] = useState9(null);
2938
- const fileInputRef = useRef4(null);
3221
+ const [isDragging, setIsDragging] = useState11(false);
3222
+ const [uploadStates, setUploadStates] = useState11(/* @__PURE__ */ new Map());
3223
+ const [resolvedAppId, setResolvedAppId] = useState11(app_id || null);
3224
+ const [isResolvingAppId, setIsResolvingAppId] = useState11(!app_id);
3225
+ const [appIdError, setAppIdError] = useState11(null);
3226
+ const fileInputRef = useRef6(null);
2939
3227
  const { uploadFile, isLoading, error } = useFileReference(supabase);
2940
- useEffect6(() => {
3228
+ useEffect8(() => {
2941
3229
  if (app_id) {
2942
3230
  setResolvedAppId(app_id);
2943
3231
  setIsResolvingAppId(false);
@@ -2980,7 +3268,7 @@ function FileUpload({
2980
3268
  const isDisabled = useMemo8(() => {
2981
3269
  return disabled || isUploading || isResolvingAppId || !resolvedAppId;
2982
3270
  }, [disabled, isUploading, isResolvingAppId, resolvedAppId]);
2983
- const generatePreview = useCallback6((file) => {
3271
+ const generatePreview = useCallback7((file) => {
2984
3272
  return new Promise((resolve) => {
2985
3273
  if (!file.type.startsWith("image/")) {
2986
3274
  resolve(null);
@@ -2994,7 +3282,7 @@ function FileUpload({
2994
3282
  reader.readAsDataURL(file);
2995
3283
  });
2996
3284
  }, []);
2997
- const validateFile = useCallback6((file) => {
3285
+ const validateFile = useCallback7((file) => {
2998
3286
  if (file.size > maxSize) {
2999
3287
  return `File "${file.name}" exceeds maximum size of ${Math.round(maxSize / 1024 / 1024)}MB`;
3000
3288
  }
@@ -3018,7 +3306,7 @@ function FileUpload({
3018
3306
  }
3019
3307
  return null;
3020
3308
  }, [accept, maxSize]);
3021
- const handleFileSelect = useCallback6(async (files) => {
3309
+ const handleFileSelect = useCallback7(async (files) => {
3022
3310
  if (!files || files.length === 0) return;
3023
3311
  const fileArray = Array.from(files);
3024
3312
  const validationErrors = [];
@@ -3103,7 +3391,9 @@ function FileUpload({
3103
3391
  organisation_id,
3104
3392
  app_id: resolvedAppId ? assertAppId(resolvedAppId) : assertAppId(""),
3105
3393
  category,
3394
+ folder,
3106
3395
  pageContext,
3396
+ event_id,
3107
3397
  is_public: isPublic
3108
3398
  }, file);
3109
3399
  clearInterval(progressInterval);
@@ -3190,20 +3480,20 @@ function FileUpload({
3190
3480
  onUploadError?.(errorMessage, file);
3191
3481
  }
3192
3482
  }
3193
- }, [uploadFile, table_name, record_id, organisation_id, resolvedAppId, category, isPublic, maxSize, onUploadSuccess, onUploadError, onProgress, validateFile, generatePreview, showPreview, appIdError]);
3194
- const handleDragOver = useCallback6((e) => {
3483
+ }, [uploadFile, table_name, record_id, organisation_id, resolvedAppId, category, folder, isPublic, maxSize, onUploadSuccess, onUploadError, onProgress, validateFile, generatePreview, showPreview, appIdError]);
3484
+ const handleDragOver = useCallback7((e) => {
3195
3485
  e.preventDefault();
3196
3486
  e.stopPropagation();
3197
3487
  if (!isDisabled) {
3198
3488
  setIsDragging(true);
3199
3489
  }
3200
3490
  }, [isDisabled]);
3201
- const handleDragLeave = useCallback6((e) => {
3491
+ const handleDragLeave = useCallback7((e) => {
3202
3492
  e.preventDefault();
3203
3493
  e.stopPropagation();
3204
3494
  setIsDragging(false);
3205
3495
  }, []);
3206
- const handleDrop = useCallback6((e) => {
3496
+ const handleDrop = useCallback7((e) => {
3207
3497
  e.preventDefault();
3208
3498
  e.stopPropagation();
3209
3499
  setIsDragging(false);
@@ -3211,13 +3501,13 @@ function FileUpload({
3211
3501
  const files = e.dataTransfer.files;
3212
3502
  handleFileSelect(files);
3213
3503
  }, [isDisabled, handleFileSelect]);
3214
- const handleFileInputChange = useCallback6((e) => {
3504
+ const handleFileInputChange = useCallback7((e) => {
3215
3505
  handleFileSelect(e.target.files);
3216
3506
  if (e.target) {
3217
3507
  e.target.value = "";
3218
3508
  }
3219
3509
  }, [handleFileSelect]);
3220
- const handleClick = useCallback6(() => {
3510
+ const handleClick = useCallback7(() => {
3221
3511
  if (!isDisabled && fileInputRef.current) {
3222
3512
  fileInputRef.current.click();
3223
3513
  }
@@ -3231,8 +3521,8 @@ function FileUpload({
3231
3521
  };
3232
3522
  const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
3233
3523
  const disabledClasses = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
3234
- return /* @__PURE__ */ jsxs16("div", { className: `space-y-4 ${className}`, children: [
3235
- /* @__PURE__ */ jsxs16(
3524
+ return /* @__PURE__ */ jsxs17("div", { className: `space-y-4 ${className}`, children: [
3525
+ /* @__PURE__ */ jsxs17(
3236
3526
  "div",
3237
3527
  {
3238
3528
  role: "button",
@@ -3251,8 +3541,8 @@ function FileUpload({
3251
3541
  }
3252
3542
  } : void 0,
3253
3543
  children: [
3254
- children || /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
3255
- /* @__PURE__ */ jsx22(
3544
+ children || /* @__PURE__ */ jsxs17("div", { className: "space-y-2", children: [
3545
+ /* @__PURE__ */ jsx23(
3256
3546
  "input",
3257
3547
  {
3258
3548
  ref: fileInputRef,
@@ -3265,64 +3555,64 @@ function FileUpload({
3265
3555
  "data-testid": "file-input"
3266
3556
  }
3267
3557
  ),
3268
- /* @__PURE__ */ jsx22("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs16(Fragment5, { children: [
3269
- /* @__PURE__ */ jsx22("span", { className: "font-medium", children: "Click to upload" }),
3558
+ /* @__PURE__ */ jsx23("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs17(Fragment5, { children: [
3559
+ /* @__PURE__ */ jsx23("span", { className: "font-medium", children: "Click to upload" }),
3270
3560
  " ",
3271
3561
  "or drag and drop"
3272
3562
  ] }) }),
3273
- /* @__PURE__ */ jsxs16("div", { className: "text-sm text-sec-500", children: [
3563
+ /* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
3274
3564
  !isResolvingAppId && accept !== "*/*" && `Accepted formats: ${accept}`,
3275
3565
  !isResolvingAppId && maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
3276
3566
  !isResolvingAppId && multiple && " \u2022 Multiple files allowed"
3277
3567
  ] })
3278
3568
  ] }),
3279
- isUploading && !showProgress && /* @__PURE__ */ jsx22(
3569
+ isUploading && !showProgress && /* @__PURE__ */ jsx23(
3280
3570
  "div",
3281
3571
  {
3282
3572
  className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center",
3283
3573
  role: "status",
3284
3574
  "aria-live": "polite",
3285
3575
  "aria-label": "Uploading file",
3286
- children: /* @__PURE__ */ jsx22("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500", "aria-hidden": "true" })
3576
+ children: /* @__PURE__ */ jsx23("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500", "aria-hidden": "true" })
3287
3577
  }
3288
3578
  )
3289
3579
  ]
3290
3580
  }
3291
3581
  ),
3292
- showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx22("div", { className: "space-y-2", children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
3582
+ showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
3293
3583
  const { file, progress, preview, result } = uploadState;
3294
3584
  const isError = progress.status === "error";
3295
3585
  const isCompleted = progress.status === "completed";
3296
3586
  const isUploading2 = progress.status === "uploading" || progress.status === "processing";
3297
- return /* @__PURE__ */ jsxs16(
3587
+ return /* @__PURE__ */ jsxs17(
3298
3588
  "div",
3299
3589
  {
3300
3590
  className: `flex items-center space-x-3 p-3 rounded-lg border ${isError ? "bg-acc-50 border-acc-200" : isCompleted ? "bg-success-50 border-success-200" : "bg-sec-50 border-sec-200"}`,
3301
3591
  children: [
3302
- /* @__PURE__ */ jsx22("div", { className: "flex-shrink-0", children: preview ? /* @__PURE__ */ jsx22(
3592
+ /* @__PURE__ */ jsx23("div", { className: "flex-shrink-0", children: preview ? /* @__PURE__ */ jsx23(
3303
3593
  "img",
3304
3594
  {
3305
3595
  src: preview,
3306
3596
  alt: file.name,
3307
3597
  className: "w-12 h-12 object-cover rounded"
3308
3598
  }
3309
- ) : /* @__PURE__ */ jsx22("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-200 rounded", children: /* @__PURE__ */ jsx22("span", { className: "text-2xl", children: "\u{1F4C4}" }) }) }),
3310
- /* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
3311
- /* @__PURE__ */ jsx22("div", { className: "font-medium text-sec-900 truncate", children: file.name }),
3312
- /* @__PURE__ */ jsxs16("div", { className: "text-sm text-sec-500", children: [
3599
+ ) : /* @__PURE__ */ jsx23("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-200 rounded", children: /* @__PURE__ */ jsx23("span", { className: "text-2xl", children: "\u{1F4C4}" }) }) }),
3600
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
3601
+ /* @__PURE__ */ jsx23("div", { className: "font-medium text-sec-900 truncate", children: file.name }),
3602
+ /* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
3313
3603
  formatFileSize(file.size),
3314
3604
  isCompleted && result && " \u2022 Uploaded",
3315
3605
  isError && progress.error && ` \u2022 ${progress.error}`
3316
3606
  ] }),
3317
- showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs16("div", { className: "mt-2", children: [
3318
- /* @__PURE__ */ jsx22("div", { className: "w-full bg-sec-200 rounded-full h-2", children: /* @__PURE__ */ jsx22(
3607
+ showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs17("div", { className: "mt-2", children: [
3608
+ /* @__PURE__ */ jsx23("div", { className: "w-full bg-sec-200 rounded-full h-2", children: /* @__PURE__ */ jsx23(
3319
3609
  "div",
3320
3610
  {
3321
3611
  className: `h-2 rounded-full transition-all duration-300 ${isError ? "bg-acc-500" : "bg-main-500"}`,
3322
3612
  style: { width: `${progress.percentage}%` }
3323
3613
  }
3324
3614
  ) }),
3325
- isUploading2 && /* @__PURE__ */ jsxs16("div", { className: "text-xs text-sec-500 mt-1", children: [
3615
+ isUploading2 && /* @__PURE__ */ jsxs17("div", { className: "text-xs text-sec-500 mt-1", children: [
3326
3616
  progress.percentage,
3327
3617
  "% \u2022 ",
3328
3618
  formatFileSize(progress.loaded),
@@ -3331,10 +3621,10 @@ function FileUpload({
3331
3621
  ] })
3332
3622
  ] })
3333
3623
  ] }),
3334
- /* @__PURE__ */ jsxs16("div", { className: "flex-shrink-0", children: [
3335
- isCompleted && /* @__PURE__ */ jsx22("span", { className: "text-success-500 text-xl", children: "\u2713" }),
3336
- isError && /* @__PURE__ */ jsx22("span", { className: "text-acc-500 text-xl", children: "\u2715" }),
3337
- isUploading2 && /* @__PURE__ */ jsx22(
3624
+ /* @__PURE__ */ jsxs17("div", { className: "flex-shrink-0", children: [
3625
+ isCompleted && /* @__PURE__ */ jsx23("span", { className: "text-success-500 text-xl", children: "\u2713" }),
3626
+ isError && /* @__PURE__ */ jsx23("span", { className: "text-acc-500 text-xl", children: "\u2715" }),
3627
+ isUploading2 && /* @__PURE__ */ jsx23(
3338
3628
  "div",
3339
3629
  {
3340
3630
  className: "animate-spin rounded-full h-5 w-5 border-b-2 border-main-500",
@@ -3349,7 +3639,7 @@ function FileUpload({
3349
3639
  fileId
3350
3640
  );
3351
3641
  }) }),
3352
- appIdError && /* @__PURE__ */ jsx22(
3642
+ appIdError && /* @__PURE__ */ jsx23(
3353
3643
  "div",
3354
3644
  {
3355
3645
  className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
@@ -3358,7 +3648,7 @@ function FileUpload({
3358
3648
  children: appIdError
3359
3649
  }
3360
3650
  ),
3361
- error && /* @__PURE__ */ jsx22(
3651
+ error && /* @__PURE__ */ jsx23(
3362
3652
  "div",
3363
3653
  {
3364
3654
  className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
@@ -3371,18 +3661,19 @@ function FileUpload({
3371
3661
  }
3372
3662
 
3373
3663
  // src/components/FileDisplay/FileDisplay.tsx
3374
- import { useState as useState11, useEffect as useEffect8, useRef as useRef6, useContext as useContext2, useMemo as useMemo9 } from "react";
3664
+ import { useState as useState13, useEffect as useEffect10, useRef as useRef8, useContext as useContext2, useMemo as useMemo9 } from "react";
3665
+ import { FileText, ExternalLink } from "lucide-react";
3375
3666
 
3376
3667
  // src/hooks/useFileUrl.ts
3377
- import { useState as useState10, useEffect as useEffect7, useCallback as useCallback7, useRef as useRef5 } from "react";
3668
+ import { useState as useState12, useEffect as useEffect9, useCallback as useCallback8, useRef as useRef7 } from "react";
3378
3669
  var log2 = createLogger("useFileUrl");
3379
3670
  function useFileUrl(fileReference, options) {
3380
3671
  const { organisation_id, supabase, autoLoad = true } = options;
3381
- const [url, setUrl] = useState10(null);
3382
- const [isLoading, setIsLoading] = useState10(false);
3383
- const [error, setError] = useState10(null);
3384
- const fileReferenceIdRef = useRef5(null);
3385
- const loadUrl = useCallback7(async () => {
3672
+ const [url, setUrl] = useState12(null);
3673
+ const [isLoading, setIsLoading] = useState12(false);
3674
+ const [error, setError] = useState12(null);
3675
+ const fileReferenceIdRef = useRef7(null);
3676
+ const loadUrl = useCallback8(async () => {
3386
3677
  if (!fileReference) {
3387
3678
  setUrl(null);
3388
3679
  setIsLoading(false);
@@ -3418,13 +3709,13 @@ function useFileUrl(fileReference, options) {
3418
3709
  setIsLoading(false);
3419
3710
  }
3420
3711
  }, [fileReference, supabase, organisation_id, isLoading, url]);
3421
- const clear = useCallback7(() => {
3712
+ const clear = useCallback8(() => {
3422
3713
  setUrl(null);
3423
3714
  setError(null);
3424
3715
  setIsLoading(false);
3425
3716
  fileReferenceIdRef.current = null;
3426
3717
  }, []);
3427
- useEffect7(() => {
3718
+ useEffect9(() => {
3428
3719
  if (autoLoad) {
3429
3720
  if (fileReferenceIdRef.current !== fileReference?.id) {
3430
3721
  setUrl(null);
@@ -3445,7 +3736,7 @@ function useFileUrl(fileReference, options) {
3445
3736
  }
3446
3737
 
3447
3738
  // src/components/FileDisplay/FileDisplay.tsx
3448
- import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
3739
+ import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
3449
3740
  var fallbackSizeClasses = {
3450
3741
  xs: "h-4 w-4 text-xs",
3451
3742
  sm: "h-6 w-6 text-sm",
@@ -3484,10 +3775,10 @@ function FileDisplayContent({
3484
3775
  fallbackText,
3485
3776
  fallbackSize = "md"
3486
3777
  }) {
3487
- const [imageError, setImageError] = useState11(false);
3488
- const [internalFileUrls, setInternalFileUrls] = useState11(new Map(fileUrls));
3489
- const [deleteDialogOpen, setDeleteDialogOpen] = useState11(false);
3490
- const fileReferencesRef = useRef6([]);
3778
+ const [imageError, setImageError] = useState13(false);
3779
+ const [internalFileUrls, setInternalFileUrls] = useState13(new Map(fileUrls));
3780
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState13(false);
3781
+ const fileReferencesRef = useRef8([]);
3491
3782
  const computedFallbackText = useMemo9(() => {
3492
3783
  if (fallbackText) return fallbackText;
3493
3784
  const fileName = fileReference?.file_metadata?.fileName;
@@ -3498,7 +3789,7 @@ function FileDisplayContent({
3498
3789
  const baseClasses = "flex items-center justify-center bg-sec-100 text-sec-600 font-semibold rounded";
3499
3790
  return `${baseClasses} ${sizeClass} ${className}`.trim();
3500
3791
  }, [fallbackSize, className]);
3501
- useEffect8(() => {
3792
+ useEffect10(() => {
3502
3793
  const currentIds = fileReferences.map((f) => f.id).join(",");
3503
3794
  const prevIds = fileReferencesRef.current.map((f) => f.id).join(",");
3504
3795
  if (currentIds !== prevIds) {
@@ -3552,17 +3843,17 @@ function FileDisplayContent({
3552
3843
  };
3553
3844
  if (error) {
3554
3845
  if (ErrorComponent) {
3555
- return /* @__PURE__ */ jsx23(ErrorComponent, { error, retry: clearError });
3846
+ return /* @__PURE__ */ jsx24(ErrorComponent, { error, retry: clearError });
3556
3847
  }
3557
3848
  if (showFallback) {
3558
- return /* @__PURE__ */ jsx23("div", { className: fallbackClasses, title: "File unavailable", children: computedFallbackText });
3849
+ return /* @__PURE__ */ jsx24("div", { className: fallbackClasses, title: "File unavailable", children: computedFallbackText });
3559
3850
  }
3560
- return /* @__PURE__ */ jsxs17("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
3561
- /* @__PURE__ */ jsxs17("div", { className: "text-acc-600", children: [
3851
+ return /* @__PURE__ */ jsxs18("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
3852
+ /* @__PURE__ */ jsxs18("div", { className: "text-acc-600", children: [
3562
3853
  "Error loading file: ",
3563
3854
  error instanceof Error ? error.message : String(error)
3564
3855
  ] }),
3565
- clearError && /* @__PURE__ */ jsx23(
3856
+ clearError && /* @__PURE__ */ jsx24(
3566
3857
  "button",
3567
3858
  {
3568
3859
  onClick: clearError,
@@ -3575,38 +3866,38 @@ function FileDisplayContent({
3575
3866
  }
3576
3867
  if (fileCount === 0 && !isLoading) {
3577
3868
  if (showFallback) {
3578
- return /* @__PURE__ */ jsxs17("div", { className: fallbackClasses, title: "No file", children: [
3869
+ return /* @__PURE__ */ jsxs18("div", { className: fallbackClasses, title: "No file", children: [
3579
3870
  computedFallbackText,
3580
3871
  children
3581
3872
  ] });
3582
3873
  }
3583
- return /* @__PURE__ */ jsxs17("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
3874
+ return /* @__PURE__ */ jsxs18("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
3584
3875
  "No files found",
3585
3876
  children
3586
3877
  ] });
3587
3878
  }
3588
3879
  if (isLoading && showFallback && fileCount === 0) {
3589
- return /* @__PURE__ */ jsxs17("div", { className: fallbackClasses, title: "Loading...", children: [
3880
+ return /* @__PURE__ */ jsxs18("div", { className: fallbackClasses, title: "Loading...", children: [
3590
3881
  computedFallbackText,
3591
3882
  children
3592
3883
  ] });
3593
3884
  }
3594
3885
  if (isLoading) {
3595
3886
  if (LoadingComponent) {
3596
- return /* @__PURE__ */ jsx23(LoadingComponent, {});
3887
+ return /* @__PURE__ */ jsx24(LoadingComponent, {});
3597
3888
  }
3598
- return /* @__PURE__ */ jsx23("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx23("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
3889
+ return /* @__PURE__ */ jsx24("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx24("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
3599
3890
  }
3600
3891
  if ((category || displayOnly) && fileReference) {
3601
3892
  const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
3602
3893
  if (displayOnly && isImage && !showDelete) {
3603
3894
  if (imageError && showFallback) {
3604
- return /* @__PURE__ */ jsx23("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
3895
+ return /* @__PURE__ */ jsx24("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
3605
3896
  }
3606
3897
  if (!fileUrl) {
3607
- return /* @__PURE__ */ jsx23("div", { className: `bg-sec-100 rounded animate-pulse ${className || "max-w-full h-48"}`, children: /* @__PURE__ */ jsx23("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx23("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) }) });
3898
+ return /* @__PURE__ */ jsx24("div", { className: `bg-sec-100 rounded animate-pulse ${className || "max-w-full h-48"}`, children: /* @__PURE__ */ jsx24("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx24("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) }) });
3608
3899
  }
3609
- return /* @__PURE__ */ jsx23(
3900
+ return /* @__PURE__ */ jsx24(
3610
3901
  "img",
3611
3902
  {
3612
3903
  src: fileUrl,
@@ -3616,12 +3907,31 @@ function FileDisplayContent({
3616
3907
  }
3617
3908
  );
3618
3909
  }
3910
+ if (displayOnly && !isImage && fileUrl && fileReference && !showDelete) {
3911
+ const fileName = fileReference.file_metadata?.fileName || "Document";
3912
+ const ariaLabel = `Open ${fileName} in new tab`;
3913
+ return /* @__PURE__ */ jsxs18(
3914
+ "a",
3915
+ {
3916
+ href: fileUrl,
3917
+ target: "_blank",
3918
+ rel: "noopener noreferrer",
3919
+ "aria-label": ariaLabel,
3920
+ className: `flex items-center gap-2 p-3 bg-sec-50 border border-sec-200 rounded-lg hover:bg-sec-100 transition-colors text-main-600 hover:text-main-700 focus:outline-none focus:ring-2 focus:ring-main-500 focus:ring-offset-2 ${className || ""}`.trim(),
3921
+ children: [
3922
+ /* @__PURE__ */ jsx24(FileText, { className: "h-5 w-5 shrink-0", "aria-hidden": "true" }),
3923
+ /* @__PURE__ */ jsx24("span", { className: "flex-1 font-medium truncate", children: fileName }),
3924
+ /* @__PURE__ */ jsx24(ExternalLink, { className: "h-5 w-5 shrink-0", "aria-hidden": "true" })
3925
+ ]
3926
+ }
3927
+ );
3928
+ }
3619
3929
  if (displayOnly && showFallback && (!fileUrl || imageError || !isImage)) {
3620
- return /* @__PURE__ */ jsx23("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
3930
+ return /* @__PURE__ */ jsx24("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
3621
3931
  }
3622
- return /* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${className}`, children: [
3623
- isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
3624
- /* @__PURE__ */ jsx23(
3932
+ return /* @__PURE__ */ jsxs18("div", { className: `space-y-2 ${className}`, children: [
3933
+ isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
3934
+ /* @__PURE__ */ jsx24(
3625
3935
  "img",
3626
3936
  {
3627
3937
  src: fileUrl,
@@ -3630,8 +3940,8 @@ function FileDisplayContent({
3630
3940
  onError: handleImageError
3631
3941
  }
3632
3942
  ),
3633
- showDelete && /* @__PURE__ */ jsxs17(Fragment6, { children: [
3634
- /* @__PURE__ */ jsx23(
3943
+ showDelete && /* @__PURE__ */ jsxs18(Fragment6, { children: [
3944
+ /* @__PURE__ */ jsx24(
3635
3945
  "button",
3636
3946
  {
3637
3947
  onClick: handleDeleteClick,
@@ -3641,29 +3951,29 @@ function FileDisplayContent({
3641
3951
  children: "\xD7"
3642
3952
  }
3643
3953
  ),
3644
- /* @__PURE__ */ jsx23(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs17(DialogContent, { size: "sm", children: [
3645
- /* @__PURE__ */ jsx23(DialogHeader, { children: /* @__PURE__ */ jsx23(DialogTitle, { children: "Confirm Delete" }) }),
3646
- /* @__PURE__ */ jsx23(DialogBody, { children: /* @__PURE__ */ jsx23("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
3647
- /* @__PURE__ */ jsxs17(DialogFooter, { children: [
3648
- /* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
3649
- /* @__PURE__ */ jsx23(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
3954
+ /* @__PURE__ */ jsx24(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs18(DialogContent, { size: "sm", children: [
3955
+ /* @__PURE__ */ jsx24(DialogHeader, { children: /* @__PURE__ */ jsx24(DialogTitle, { children: "Confirm Delete" }) }),
3956
+ /* @__PURE__ */ jsx24(DialogBody, { children: /* @__PURE__ */ jsx24("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
3957
+ /* @__PURE__ */ jsxs18(DialogFooter, { children: [
3958
+ /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
3959
+ /* @__PURE__ */ jsx24(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
3650
3960
  ] })
3651
3961
  ] }) })
3652
3962
  ] })
3653
3963
  ] }) : isImage && imageError && showFallback ? (
3654
3964
  // Show fallback when image fails to load and fallback is enabled
3655
- /* @__PURE__ */ jsx23("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText })
3656
- ) : /* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
3657
- /* @__PURE__ */ jsx23("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
3658
- /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
3659
- /* @__PURE__ */ jsx23("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
3660
- /* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
3965
+ /* @__PURE__ */ jsx24("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText })
3966
+ ) : /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
3967
+ /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
3968
+ /* @__PURE__ */ jsxs18("div", { className: "flex-1 min-w-0", children: [
3969
+ /* @__PURE__ */ jsx24("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
3970
+ /* @__PURE__ */ jsxs18("div", { className: "text-sm text-sec-500", children: [
3661
3971
  fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
3662
3972
  fileReference.file_metadata.fileType && ` \u2022 ${fileReference.file_metadata.fileType}`
3663
3973
  ] })
3664
3974
  ] }),
3665
- showDelete && /* @__PURE__ */ jsxs17(Fragment6, { children: [
3666
- /* @__PURE__ */ jsx23(
3975
+ showDelete && /* @__PURE__ */ jsxs18(Fragment6, { children: [
3976
+ /* @__PURE__ */ jsx24(
3667
3977
  "button",
3668
3978
  {
3669
3979
  onClick: handleDeleteClick,
@@ -3673,12 +3983,12 @@ function FileDisplayContent({
3673
3983
  children: "\xD7"
3674
3984
  }
3675
3985
  ),
3676
- /* @__PURE__ */ jsx23(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs17(DialogContent, { size: "sm", children: [
3677
- /* @__PURE__ */ jsx23(DialogHeader, { children: /* @__PURE__ */ jsx23(DialogTitle, { children: "Confirm Delete" }) }),
3678
- /* @__PURE__ */ jsx23(DialogBody, { children: /* @__PURE__ */ jsx23("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
3679
- /* @__PURE__ */ jsxs17(DialogFooter, { children: [
3680
- /* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
3681
- /* @__PURE__ */ jsx23(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
3986
+ /* @__PURE__ */ jsx24(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs18(DialogContent, { size: "sm", children: [
3987
+ /* @__PURE__ */ jsx24(DialogHeader, { children: /* @__PURE__ */ jsx24(DialogTitle, { children: "Confirm Delete" }) }),
3988
+ /* @__PURE__ */ jsx24(DialogBody, { children: /* @__PURE__ */ jsx24("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
3989
+ /* @__PURE__ */ jsxs18(DialogFooter, { children: [
3990
+ /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
3991
+ /* @__PURE__ */ jsx24(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
3682
3992
  ] })
3683
3993
  ] }) })
3684
3994
  ] })
@@ -3686,13 +3996,13 @@ function FileDisplayContent({
3686
3996
  children
3687
3997
  ] });
3688
3998
  }
3689
- return /* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${className}`, children: [
3999
+ return /* @__PURE__ */ jsxs18("div", { className: `space-y-2 ${className}`, children: [
3690
4000
  fileReferences.map((fileRef) => {
3691
4001
  const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
3692
4002
  const fileUrl2 = internalFileUrls.get(fileRef.id) || null;
3693
4003
  const canDownload = !isImage && fileUrl2;
3694
- return /* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
3695
- isImage && fileUrl2 ? /* @__PURE__ */ jsx23(
4004
+ return /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
4005
+ isImage && fileUrl2 ? /* @__PURE__ */ jsx24(
3696
4006
  "img",
3697
4007
  {
3698
4008
  src: fileUrl2,
@@ -3700,17 +4010,17 @@ function FileDisplayContent({
3700
4010
  className: "w-12 h-12 object-cover rounded",
3701
4011
  onError: handleImageError
3702
4012
  }
3703
- ) : /* @__PURE__ */ jsx23("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
3704
- /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
3705
- /* @__PURE__ */ jsx23("div", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
3706
- /* @__PURE__ */ jsxs17("div", { className: "text-sm text-sec-500", children: [
4013
+ ) : /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
4014
+ /* @__PURE__ */ jsxs18("div", { className: "flex-1 min-w-0", children: [
4015
+ /* @__PURE__ */ jsx24("div", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
4016
+ /* @__PURE__ */ jsxs18("div", { className: "text-sm text-sec-500", children: [
3707
4017
  fileRef.file_metadata.fileSize && formatFileSize(fileRef.file_metadata.fileSize),
3708
4018
  fileRef.file_metadata.fileType && ` \u2022 ${fileRef.file_metadata.fileType}`,
3709
4019
  fileRef.file_metadata.category && ` \u2022 ${fileRef.file_metadata.category}`
3710
4020
  ] })
3711
4021
  ] }),
3712
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center space-x-2", children: [
3713
- canDownload && /* @__PURE__ */ jsx23(
4022
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-2", children: [
4023
+ canDownload && /* @__PURE__ */ jsx24(
3714
4024
  "a",
3715
4025
  {
3716
4026
  href: fileRef.file_path,
@@ -3720,7 +4030,7 @@ function FileDisplayContent({
3720
4030
  children: "\u2193"
3721
4031
  }
3722
4032
  ),
3723
- showDelete && onDelete && /* @__PURE__ */ jsx23(
4033
+ showDelete && onDelete && /* @__PURE__ */ jsx24(
3724
4034
  "button",
3725
4035
  {
3726
4036
  onClick: handleDeleteClick,
@@ -3756,7 +4066,7 @@ function FileDisplayPublic({
3756
4066
  const supabase = publicPageContext?.supabase ?? null;
3757
4067
  if (!supabase) {
3758
4068
  if (showFallback) {
3759
- return /* @__PURE__ */ jsx23(
4069
+ return /* @__PURE__ */ jsx24(
3760
4070
  FileDisplayContent,
3761
4071
  {
3762
4072
  isLoading: false,
@@ -3782,7 +4092,7 @@ function FileDisplayPublic({
3782
4092
  }
3783
4093
  );
3784
4094
  }
3785
- return /* @__PURE__ */ jsx23("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in public context" });
4095
+ return /* @__PURE__ */ jsx24("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in public context" });
3786
4096
  }
3787
4097
  const {
3788
4098
  fileUrl,
@@ -3826,7 +4136,7 @@ function FileDisplayPublic({
3826
4136
  finalFileCount = 1;
3827
4137
  finalFileUrl = fileUrls.get(targetFile.id) || null;
3828
4138
  }
3829
- return /* @__PURE__ */ jsx23(
4139
+ return /* @__PURE__ */ jsx24(
3830
4140
  FileDisplayContent,
3831
4141
  {
3832
4142
  isLoading,
@@ -3870,7 +4180,7 @@ function FileDisplayAuthenticated({
3870
4180
  }) {
3871
4181
  const { supabase } = useUnifiedAuth();
3872
4182
  if (!supabase) {
3873
- return /* @__PURE__ */ jsx23("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in authenticated context" });
4183
+ return /* @__PURE__ */ jsx24("div", { className: `text-sec-500 text-center p-4 ${className}`, children: "Supabase client not available in authenticated context" });
3874
4184
  }
3875
4185
  const {
3876
4186
  fileUrl,
@@ -3888,7 +4198,7 @@ function FileDisplayAuthenticated({
3888
4198
  category,
3889
4199
  { supabase }
3890
4200
  );
3891
- const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState11(null);
4201
+ const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState13(null);
3892
4202
  const displayOnlyFileUrlFromMap = displayOnlyFileReference ? fileUrls.get(displayOnlyFileReference.id) : null;
3893
4203
  const displayOnlyFileUrlHook = useFileUrl(
3894
4204
  displayOnlyFileReference && !displayOnlyFileUrlFromMap ? displayOnlyFileReference : null,
@@ -3899,7 +4209,7 @@ function FileDisplayAuthenticated({
3899
4209
  }
3900
4210
  );
3901
4211
  const displayOnlyFileUrl = displayOnlyFileUrlFromMap || displayOnlyFileUrlHook.url;
3902
- useEffect8(() => {
4212
+ useEffect10(() => {
3903
4213
  if (displayOnly && !category && fileReferences.length > 0) {
3904
4214
  const imageFiles = fileReferences.filter(
3905
4215
  (f) => f.file_metadata.fileType?.startsWith("image/")
@@ -3928,7 +4238,7 @@ function FileDisplayAuthenticated({
3928
4238
  finalError = error || displayOnlyFileUrlHook.error;
3929
4239
  }
3930
4240
  }
3931
- return /* @__PURE__ */ jsx23(
4241
+ return /* @__PURE__ */ jsx24(
3932
4242
  FileDisplayContent,
3933
4243
  {
3934
4244
  isLoading: finalIsLoading,
@@ -3973,7 +4283,7 @@ function FileDisplay({
3973
4283
  }) {
3974
4284
  const isPublicPage = useIsPublicPage();
3975
4285
  if (isPublicPage) {
3976
- return /* @__PURE__ */ jsx23(
4286
+ return /* @__PURE__ */ jsx24(
3977
4287
  FileDisplayPublic,
3978
4288
  {
3979
4289
  table_name,
@@ -3993,7 +4303,7 @@ function FileDisplay({
3993
4303
  }
3994
4304
  );
3995
4305
  }
3996
- return /* @__PURE__ */ jsx23(
4306
+ return /* @__PURE__ */ jsx24(
3997
4307
  FileDisplayAuthenticated,
3998
4308
  {
3999
4309
  table_name,
@@ -4015,9 +4325,9 @@ function FileDisplay({
4015
4325
  }
4016
4326
 
4017
4327
  // src/components/Table/Table.tsx
4018
- import * as React20 from "react";
4019
- import { jsx as jsx24 } from "react/jsx-runtime";
4020
- var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4328
+ import * as React21 from "react";
4329
+ import { jsx as jsx25 } from "react/jsx-runtime";
4330
+ var Table = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4021
4331
  "table",
4022
4332
  {
4023
4333
  ref,
@@ -4026,9 +4336,9 @@ var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
4026
4336
  }
4027
4337
  ));
4028
4338
  Table.displayName = "Table";
4029
- var TableHeader = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
4339
+ var TableHeader = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
4030
4340
  TableHeader.displayName = "TableHeader";
4031
- var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4341
+ var TableBody = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4032
4342
  "tbody",
4033
4343
  {
4034
4344
  ref,
@@ -4037,7 +4347,7 @@ var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4037
4347
  }
4038
4348
  ));
4039
4349
  TableBody.displayName = "TableBody";
4040
- var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4350
+ var TableFooter = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4041
4351
  "tfoot",
4042
4352
  {
4043
4353
  ref,
@@ -4049,7 +4359,7 @@ var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PUR
4049
4359
  }
4050
4360
  ));
4051
4361
  TableFooter.displayName = "TableFooter";
4052
- var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4362
+ var TableRow = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4053
4363
  "tr",
4054
4364
  {
4055
4365
  ref,
@@ -4061,7 +4371,7 @@ var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__
4061
4371
  }
4062
4372
  ));
4063
4373
  TableRow.displayName = "TableRow";
4064
- var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4374
+ var TableHead = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4065
4375
  "th",
4066
4376
  {
4067
4377
  ref,
@@ -4073,7 +4383,7 @@ var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4073
4383
  }
4074
4384
  ));
4075
4385
  TableHead.displayName = "TableHead";
4076
- var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4386
+ var TableCell = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4077
4387
  "td",
4078
4388
  {
4079
4389
  ref,
@@ -4082,7 +4392,7 @@ var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4082
4392
  }
4083
4393
  ));
4084
4394
  TableCell.displayName = "TableCell";
4085
- var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4395
+ var TableCaption = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4086
4396
  "caption",
4087
4397
  {
4088
4398
  ref,
@@ -4093,7 +4403,7 @@ var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PU
4093
4403
  TableCaption.displayName = "TableCaption";
4094
4404
 
4095
4405
  // src/components/PublicLayout/PublicPageLayout.tsx
4096
- import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
4406
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
4097
4407
  function PublicPageHeader({
4098
4408
  event,
4099
4409
  eventCode,
@@ -4106,11 +4416,11 @@ function PublicPageHeader({
4106
4416
  customEventLogo
4107
4417
  }) {
4108
4418
  const { appName } = useAppConfig();
4109
- return /* @__PURE__ */ jsxs18("header", { className: cn(
4419
+ return /* @__PURE__ */ jsxs19("header", { className: cn(
4110
4420
  "w-full px-[max(0rem,calc((100vw-var(--app-width))/2-0.5rem))] grid grid-cols-[auto_1fr_auto] place-items-center gap-2",
4111
4421
  className
4112
4422
  ), children: [
4113
- showAppLogo && appName && /* @__PURE__ */ jsx25(
4423
+ showAppLogo && appName && /* @__PURE__ */ jsx26(
4114
4424
  "img",
4115
4425
  {
4116
4426
  className: "ml-4 max-w-36 object-contain row-span-2",
@@ -4118,9 +4428,9 @@ function PublicPageHeader({
4118
4428
  alt: appName
4119
4429
  }
4120
4430
  ),
4121
- event && /* @__PURE__ */ jsxs18(Fragment7, { children: [
4122
- /* @__PURE__ */ jsx25("h1", { children: event.event_name }),
4123
- showEventLogo && event && /* @__PURE__ */ jsx25(Fragment7, { children: customEventLogo || /* @__PURE__ */ jsx25(
4431
+ event && /* @__PURE__ */ jsxs19(Fragment7, { children: [
4432
+ /* @__PURE__ */ jsx26("h1", { children: event.event_name }),
4433
+ showEventLogo && event && /* @__PURE__ */ jsx26(Fragment7, { children: customEventLogo || /* @__PURE__ */ jsx26(
4124
4434
  FileDisplay,
4125
4435
  {
4126
4436
  table_name: "event",
@@ -4137,13 +4447,13 @@ function PublicPageHeader({
4137
4447
  }
4138
4448
  }
4139
4449
  ) }),
4140
- event.event_venue && /* @__PURE__ */ jsx25("h4", { children: event.event_venue })
4450
+ event.event_venue && /* @__PURE__ */ jsx26("h4", { children: event.event_venue })
4141
4451
  ] }),
4142
- title && /* @__PURE__ */ jsxs18(Fragment7, { children: [
4143
- /* @__PURE__ */ jsx25("h1", { children: title }),
4144
- description && /* @__PURE__ */ jsx25("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
4452
+ title && /* @__PURE__ */ jsxs19(Fragment7, { children: [
4453
+ /* @__PURE__ */ jsx26("h1", { children: title }),
4454
+ description && /* @__PURE__ */ jsx26("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
4145
4455
  ] }),
4146
- children && /* @__PURE__ */ jsx25(Fragment7, { children })
4456
+ children && /* @__PURE__ */ jsx26(Fragment7, { children })
4147
4457
  ] });
4148
4458
  }
4149
4459
  function PublicPageFooter({
@@ -4157,11 +4467,11 @@ function PublicPageFooter({
4157
4467
  children
4158
4468
  }) {
4159
4469
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
4160
- return /* @__PURE__ */ jsx25("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs18("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
4161
- logo && /* @__PURE__ */ jsx25("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
4162
- children && /* @__PURE__ */ jsx25(Fragment7, { children }),
4163
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: copyrightText }),
4164
- links && links.length > 0 && /* @__PURE__ */ jsx25("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx25("li", { children: /* @__PURE__ */ jsx25("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
4470
+ return /* @__PURE__ */ jsx26("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs19("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
4471
+ logo && /* @__PURE__ */ jsx26("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
4472
+ children && /* @__PURE__ */ jsx26(Fragment7, { children }),
4473
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: copyrightText }),
4474
+ links && links.length > 0 && /* @__PURE__ */ jsx26("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
4165
4475
  ] }) });
4166
4476
  }
4167
4477
  function PublicPageLayout({
@@ -4185,48 +4495,49 @@ function PublicPageLayout({
4185
4495
  });
4186
4496
  if (isLoading) {
4187
4497
  if (LoadingFallback) {
4188
- return /* @__PURE__ */ jsx25(LoadingFallback, {});
4498
+ return /* @__PURE__ */ jsx26(LoadingFallback, {});
4189
4499
  }
4190
- return /* @__PURE__ */ jsx25("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs18("div", { className: "max-w-md mx-auto text-center px-4", children: [
4191
- /* @__PURE__ */ jsx25(LoadingSpinner, { size: "lg", className: "mx-auto mb-4" }),
4192
- loadingMessage && /* @__PURE__ */ jsx25("p", { className: "text-sec-600", children: loadingMessage })
4500
+ return /* @__PURE__ */ jsx26("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs19("div", { className: "max-w-md mx-auto text-center px-4", children: [
4501
+ /* @__PURE__ */ jsx26(LoadingSpinner, { size: "lg", className: "mx-auto mb-4" }),
4502
+ loadingMessage && /* @__PURE__ */ jsx26("p", { className: "text-sec-600", children: loadingMessage })
4193
4503
  ] }) });
4194
4504
  }
4195
4505
  if (error && showValidationErrors) {
4196
4506
  if (ErrorFallback) {
4197
- return /* @__PURE__ */ jsx25(ErrorFallback, { error, retry: handleRefetch });
4507
+ return /* @__PURE__ */ jsx26(ErrorFallback, { error, retry: handleRefetch });
4198
4508
  }
4199
- return /* @__PURE__ */ jsxs18("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4200
- /* @__PURE__ */ jsx25("h1", { children: "Event Not Found" }),
4201
- /* @__PURE__ */ jsxs18("p", { children: [
4509
+ return /* @__PURE__ */ jsxs19("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4510
+ /* @__PURE__ */ jsx26("h1", { children: "Event Not Found" }),
4511
+ /* @__PURE__ */ jsxs19("p", { children: [
4202
4512
  'The event code "',
4203
4513
  eventCode,
4204
4514
  '" is invalid or the event is not available for public viewing.'
4205
4515
  ] }),
4206
- /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
4516
+ /* @__PURE__ */ jsx26(Button, { onClick: handleRefetch, children: "Try Again" })
4207
4517
  ] });
4208
4518
  }
4209
4519
  if (!event && showValidationErrors) {
4210
- return /* @__PURE__ */ jsxs18("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4211
- /* @__PURE__ */ jsx25("h1", { children: "Event Not Available" }),
4212
- /* @__PURE__ */ jsx25("p", { children: "This event is not available for public viewing." }),
4213
- handleRefetch && /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
4520
+ return /* @__PURE__ */ jsxs19("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4521
+ /* @__PURE__ */ jsx26("h1", { children: "Event Not Available" }),
4522
+ /* @__PURE__ */ jsx26("p", { children: "This event is not available for public viewing." }),
4523
+ handleRefetch && /* @__PURE__ */ jsx26(Button, { onClick: handleRefetch, children: "Try Again" })
4214
4524
  ] });
4215
4525
  }
4216
- return /* @__PURE__ */ jsx25(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs18(Fragment7, { children: [
4217
- customHeader || /* @__PURE__ */ jsx25(
4526
+ return /* @__PURE__ */ jsx26(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs19(Fragment7, { children: [
4527
+ customHeader || /* @__PURE__ */ jsx26(
4218
4528
  PublicPageHeader,
4219
4529
  {
4220
4530
  event: event || void 0,
4221
4531
  eventCode
4222
4532
  }
4223
4533
  ),
4224
- /* @__PURE__ */ jsx25("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
4225
- showFooter && event && (customFooter || /* @__PURE__ */ jsx25(PublicPageFooter, { event }))
4534
+ /* @__PURE__ */ jsx26("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
4535
+ showFooter && event && (customFooter || /* @__PURE__ */ jsx26(PublicPageFooter, { event }))
4226
4536
  ] }) });
4227
4537
  }
4228
4538
 
4229
4539
  export {
4540
+ AddressField,
4230
4541
  Label,
4231
4542
  Textarea,
4232
4543
  Avatar,
@@ -4279,4 +4590,4 @@ export {
4279
4590
  PublicPageFooter,
4280
4591
  PublicPageLayout
4281
4592
  };
4282
- //# sourceMappingURL=chunk-HC67NW5K.js.map
4593
+ //# sourceMappingURL=chunk-LBBUPSSC.js.map