@baasix/baasix 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (666) hide show
  1. package/LICENSE.MD +85 -0
  2. package/README.md +526 -0
  3. package/assets/banner.jpg +0 -0
  4. package/assets/banner_small.jpg +0 -0
  5. package/assets/logo_icon.svg +20 -0
  6. package/assets/logo_icon_rounded.svg +20 -0
  7. package/dist/LICENSE.MD +85 -0
  8. package/dist/README.md +526 -0
  9. package/dist/app/404/index.html +1 -0
  10. package/dist/app/404.html +1 -0
  11. package/dist/app/_next/static/chunks/041e1f03-56ae8a902a7f2fe6.js +24 -0
  12. package/dist/app/_next/static/chunks/1117-05479929a8da73e3.js +1 -0
  13. package/dist/app/_next/static/chunks/1299.77cc7b7b76b75cba.js +1 -0
  14. package/dist/app/_next/static/chunks/1303-35a96e9c9cdeab9d.js +1 -0
  15. package/dist/app/_next/static/chunks/1509-56ac00cdaaecdf53.js +1 -0
  16. package/dist/app/_next/static/chunks/1668-e3eabd0f6753c780.js +1 -0
  17. package/dist/app/_next/static/chunks/1783-d9fb550fd324300c.js +1 -0
  18. package/dist/app/_next/static/chunks/2117-29b5fa47421595ad.js +2 -0
  19. package/dist/app/_next/static/chunks/2344.35b46d2179a765b5.js +1 -0
  20. package/dist/app/_next/static/chunks/257.990da16794a31292.js +1 -0
  21. package/dist/app/_next/static/chunks/2676-73b0ee7c80073a84.js +1 -0
  22. package/dist/app/_next/static/chunks/3563-b8842744384391fe.js +1 -0
  23. package/dist/app/_next/static/chunks/363642f4-933b579ed3c85f60.js +1 -0
  24. package/dist/app/_next/static/chunks/3817-e20c8f0a0810fc95.js +1 -0
  25. package/dist/app/_next/static/chunks/3834.84944e390d902509.js +2 -0
  26. package/dist/app/_next/static/chunks/4043-3a30c8a75896f241.js +1 -0
  27. package/dist/app/_next/static/chunks/4225-14090c7c0cd9dec6.js +1 -0
  28. package/dist/app/_next/static/chunks/4438-c9a12ca15b6e9160.js +1 -0
  29. package/dist/app/_next/static/chunks/4458-679fd0c6884f456a.js +1 -0
  30. package/dist/app/_next/static/chunks/4475-8bdfbd536fba8c48.js +1 -0
  31. package/dist/app/_next/static/chunks/4883-8a924721bb21b3b0.js +1 -0
  32. package/dist/app/_next/static/chunks/489-683ab07188f9df2b.js +1 -0
  33. package/dist/app/_next/static/chunks/4952-1b97320cf61f3f21.js +1 -0
  34. package/dist/app/_next/static/chunks/5094-8d53e403235d4ca6.js +1 -0
  35. package/dist/app/_next/static/chunks/5101-3a146e0625747ad1.js +1 -0
  36. package/dist/app/_next/static/chunks/54a60aa6-d9747982e0a81f58.js +79 -0
  37. package/dist/app/_next/static/chunks/5650-f096291df402bfc2.js +1 -0
  38. package/dist/app/_next/static/chunks/600-539045311240f579.js +1 -0
  39. package/dist/app/_next/static/chunks/6170-803b82e19d3ade6d.js +89 -0
  40. package/dist/app/_next/static/chunks/6241-30d7169d1010e5a4.js +1 -0
  41. package/dist/app/_next/static/chunks/6530-a91e10cffa4200c4.js +1 -0
  42. package/dist/app/_next/static/chunks/6547-4bbbdb5c399aef1e.js +1 -0
  43. package/dist/app/_next/static/chunks/6712-781937c53a2c49da.js +1 -0
  44. package/dist/app/_next/static/chunks/6fcbdc68-90be1a5480b8d353.js +1 -0
  45. package/dist/app/_next/static/chunks/70e0d97a-aeaf0cdc26ba1a58.js +1 -0
  46. package/dist/app/_next/static/chunks/7214-5154a89d08d24dde.js +1 -0
  47. package/dist/app/_next/static/chunks/7324-b53229c59a640880.js +10 -0
  48. package/dist/app/_next/static/chunks/7636-66424f0b51d350e9.js +1 -0
  49. package/dist/app/_next/static/chunks/7874-39a3f2541165a675.js +1 -0
  50. package/dist/app/_next/static/chunks/7982-9da12b83f11e3f5f.js +1 -0
  51. package/dist/app/_next/static/chunks/8213a2eb-da25a3b3c5521b2b.js +1 -0
  52. package/dist/app/_next/static/chunks/8473-6598318371eca31b.js +1 -0
  53. package/dist/app/_next/static/chunks/8640fa6b-72e43370f68e5587.js +1 -0
  54. package/dist/app/_next/static/chunks/9090-3ef676f29c95f1c7.js +1 -0
  55. package/dist/app/_next/static/chunks/9124-a02f9e209e6e3cce.js +1 -0
  56. package/dist/app/_next/static/chunks/926-156f32067d111d6b.js +1 -0
  57. package/dist/app/_next/static/chunks/9487-b17481605e513b83.js +1 -0
  58. package/dist/app/_next/static/chunks/9599-a7e572bb88c3392b.js +1 -0
  59. package/dist/app/_next/static/chunks/9881-419697138376e755.js +1 -0
  60. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/all-activity/page-8917930b4d663405.js +1 -0
  61. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/email-log/page-b27a6ee32782d7df.js +1 -0
  62. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/notifications/page-b7eda523ede2702c.js +1 -0
  63. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/page-1cfa62d1caedaed0.js +1 -0
  64. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/sessions/page-3e21e20db90aeff7.js +1 -0
  65. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-executions/page-27bcc26b747fb29b.js +1 -0
  66. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-logs/page-9f9e9e952aef436e.js +1 -0
  67. package/dist/app/_next/static/chunks/app/(authenticated)/change-password/page-8d61aa499eabb127.js +1 -0
  68. package/dist/app/_next/static/chunks/app/(authenticated)/dashboard/page-1ceeac9e72997a8a.js +1 -0
  69. package/dist/app/_next/static/chunks/app/(authenticated)/data-browser/page-8cda2b57759dd670.js +1 -0
  70. package/dist/app/_next/static/chunks/app/(authenticated)/file-manager/page-8c6f1b1da66ad7e4.js +1 -0
  71. package/dist/app/_next/static/chunks/app/(authenticated)/layout-f70d225b2759c998.js +1 -0
  72. package/dist/app/_next/static/chunks/app/(authenticated)/settings/migrations/page-aacec8f7cfb40ab2.js +1 -0
  73. package/dist/app/_next/static/chunks/app/(authenticated)/settings/permissions/page-828110cfcde429c6.js +1 -0
  74. package/dist/app/_next/static/chunks/app/(authenticated)/settings/project/page-420e794bb76bd204.js +1 -0
  75. package/dist/app/_next/static/chunks/app/(authenticated)/settings/roles/page-9001d02b28f70708.js +1 -0
  76. package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-899574f35091dd58.js +1 -0
  77. package/dist/app/_next/static/chunks/app/(authenticated)/settings/tasks/page-ad7ab3e27c83f44f.js +1 -0
  78. package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/edit/page-bd83414cb8c4cb04.js +1 -0
  79. package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/page-3181447f8772b1d3.js +1 -0
  80. package/dist/app/_next/static/chunks/app/(authenticated)/settings/tenants/page-ef9bfbacef5a1d73.js +1 -0
  81. package/dist/app/_next/static/chunks/app/(authenticated)/users/invites/page-480306b7b2bbac7e.js +1 -0
  82. package/dist/app/_next/static/chunks/app/(authenticated)/users/list/page-74da51254c2606b3.js +1 -0
  83. package/dist/app/_next/static/chunks/app/(authenticated)/users/page-e99c6f0b915001b2.js +1 -0
  84. package/dist/app/_next/static/chunks/app/(authenticated)/users/preferences/page-1a935630ce8f2b12.js +1 -0
  85. package/dist/app/_next/static/chunks/app/(authenticated)/users/user-roles/page-901dfb8ea1f39ca8.js +1 -0
  86. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/detail/page-9a6b839aea688ca4.js +1 -0
  87. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/edit/page-11774efbc2fecae2.js +1 -0
  88. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/execution/page-8ec1aea90412c03d.js +1 -0
  89. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/page-88bc5b36ccb0a1f7.js +1 -0
  90. package/dist/app/_next/static/chunks/app/(public)/forgot-password/page-ed263fd46ef81c20.js +1 -0
  91. package/dist/app/_next/static/chunks/app/(public)/layout-f538977545844af8.js +1 -0
  92. package/dist/app/_next/static/chunks/app/(public)/login/page-c0a10b137f346096.js +1 -0
  93. package/dist/app/_next/static/chunks/app/(public)/register/page-4cb7644893efd9b3.js +1 -0
  94. package/dist/app/_next/static/chunks/app/_not-found/page-653f8815b78256cc.js +1 -0
  95. package/dist/app/_next/static/chunks/app/layout-591ca7a3e16528a1.js +1 -0
  96. package/dist/app/_next/static/chunks/app/page-dd19d124b5fa2577.js +1 -0
  97. package/dist/app/_next/static/chunks/c37d3baf.c2ff165f5b02c692.js +1 -0
  98. package/dist/app/_next/static/chunks/d0deef33.0379166a4ec23470.js +1 -0
  99. package/dist/app/_next/static/chunks/fd9d1056-54169f07cd680d6c.js +1 -0
  100. package/dist/app/_next/static/chunks/framework-8e0e0f4a6b83a956.js +1 -0
  101. package/dist/app/_next/static/chunks/main-324e91f5a430cddf.js +1 -0
  102. package/dist/app/_next/static/chunks/main-app-55bcae20c77aaf0e.js +1 -0
  103. package/dist/app/_next/static/chunks/pages/_app-3c9ca398d360b709.js +1 -0
  104. package/dist/app/_next/static/chunks/pages/_error-cf5ca766ac8f493f.js +1 -0
  105. package/dist/app/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  106. package/dist/app/_next/static/chunks/webpack-2c306566f7ee1b63.js +1 -0
  107. package/dist/app/_next/static/css/6c4002bae4e236b2.css +3 -0
  108. package/dist/app/_next/static/css/a275cc2b185e04f8.css +1 -0
  109. package/dist/app/_next/static/eCWhKA8XHqmB1zgFcEtN2/_buildManifest.js +1 -0
  110. package/dist/app/_next/static/eCWhKA8XHqmB1zgFcEtN2/_ssgManifest.js +1 -0
  111. package/dist/app/activity-log/all-activity/index.html +1 -0
  112. package/dist/app/activity-log/all-activity/index.txt +14 -0
  113. package/dist/app/activity-log/email-log/index.html +1 -0
  114. package/dist/app/activity-log/email-log/index.txt +14 -0
  115. package/dist/app/activity-log/index.html +1 -0
  116. package/dist/app/activity-log/index.txt +14 -0
  117. package/dist/app/activity-log/notifications/index.html +1 -0
  118. package/dist/app/activity-log/notifications/index.txt +14 -0
  119. package/dist/app/activity-log/sessions/index.html +1 -0
  120. package/dist/app/activity-log/sessions/index.txt +14 -0
  121. package/dist/app/activity-log/workflow-executions/index.html +1 -0
  122. package/dist/app/activity-log/workflow-executions/index.txt +14 -0
  123. package/dist/app/activity-log/workflow-logs/index.html +1 -0
  124. package/dist/app/activity-log/workflow-logs/index.txt +14 -0
  125. package/dist/app/change-password/index.html +1 -0
  126. package/dist/app/change-password/index.txt +14 -0
  127. package/dist/app/dashboard/index.html +1 -0
  128. package/dist/app/dashboard/index.txt +14 -0
  129. package/dist/app/data-browser/index.html +1 -0
  130. package/dist/app/data-browser/index.txt +14 -0
  131. package/dist/app/file-manager/index.html +1 -0
  132. package/dist/app/file-manager/index.txt +14 -0
  133. package/dist/app/forgot-password/index.html +1 -0
  134. package/dist/app/forgot-password/index.txt +13 -0
  135. package/dist/app/index.html +1 -0
  136. package/dist/app/index.txt +9 -0
  137. package/dist/app/login/index.html +1 -0
  138. package/dist/app/login/index.txt +13 -0
  139. package/dist/app/logo-dark.png +0 -0
  140. package/dist/app/logo-icon.svg +81 -0
  141. package/dist/app/logo-light.png +0 -0
  142. package/dist/app/register/index.html +1 -0
  143. package/dist/app/register/index.txt +13 -0
  144. package/dist/app/settings/migrations/index.html +1 -0
  145. package/dist/app/settings/migrations/index.txt +14 -0
  146. package/dist/app/settings/permissions/index.html +1 -0
  147. package/dist/app/settings/permissions/index.txt +14 -0
  148. package/dist/app/settings/project/index.html +1 -0
  149. package/dist/app/settings/project/index.txt +14 -0
  150. package/dist/app/settings/roles/index.html +1 -0
  151. package/dist/app/settings/roles/index.txt +14 -0
  152. package/dist/app/settings/schema/index.html +1 -0
  153. package/dist/app/settings/schema/index.txt +14 -0
  154. package/dist/app/settings/tasks/index.html +1 -0
  155. package/dist/app/settings/tasks/index.txt +14 -0
  156. package/dist/app/settings/templates/edit/index.html +1 -0
  157. package/dist/app/settings/templates/edit/index.txt +14 -0
  158. package/dist/app/settings/templates/index.html +1 -0
  159. package/dist/app/settings/templates/index.txt +14 -0
  160. package/dist/app/settings/tenants/index.html +1 -0
  161. package/dist/app/settings/tenants/index.txt +14 -0
  162. package/dist/app/users/index.html +1 -0
  163. package/dist/app/users/index.txt +14 -0
  164. package/dist/app/users/invites/index.html +1 -0
  165. package/dist/app/users/invites/index.txt +14 -0
  166. package/dist/app/users/list/index.html +1 -0
  167. package/dist/app/users/list/index.txt +14 -0
  168. package/dist/app/users/preferences/index.html +1 -0
  169. package/dist/app/users/preferences/index.txt +14 -0
  170. package/dist/app/users/user-roles/index.html +1 -0
  171. package/dist/app/users/user-roles/index.txt +14 -0
  172. package/dist/app/workflows/detail/index.html +1 -0
  173. package/dist/app/workflows/detail/index.txt +14 -0
  174. package/dist/app/workflows/edit/index.html +1 -0
  175. package/dist/app/workflows/edit/index.txt +14 -0
  176. package/dist/app/workflows/execution/index.html +1 -0
  177. package/dist/app/workflows/execution/index.txt +14 -0
  178. package/dist/app/workflows/index.html +1 -0
  179. package/dist/app/workflows/index.txt +14 -0
  180. package/dist/app.d.ts +36 -0
  181. package/dist/app.d.ts.map +1 -0
  182. package/dist/app.js +546 -0
  183. package/dist/app.js.map +1 -0
  184. package/dist/auth/adapters/baasix-adapter.d.ts +12 -0
  185. package/dist/auth/adapters/baasix-adapter.d.ts.map +1 -0
  186. package/dist/auth/adapters/baasix-adapter.js +318 -0
  187. package/dist/auth/adapters/baasix-adapter.js.map +1 -0
  188. package/dist/auth/adapters/index.d.ts +6 -0
  189. package/dist/auth/adapters/index.d.ts.map +1 -0
  190. package/dist/auth/adapters/index.js +5 -0
  191. package/dist/auth/adapters/index.js.map +1 -0
  192. package/dist/auth/core.d.ts +73 -0
  193. package/dist/auth/core.d.ts.map +1 -0
  194. package/dist/auth/core.js +528 -0
  195. package/dist/auth/core.js.map +1 -0
  196. package/dist/auth/index.d.ts +56 -0
  197. package/dist/auth/index.d.ts.map +1 -0
  198. package/dist/auth/index.js +58 -0
  199. package/dist/auth/index.js.map +1 -0
  200. package/dist/auth/oauth2/index.d.ts +5 -0
  201. package/dist/auth/oauth2/index.d.ts.map +1 -0
  202. package/dist/auth/oauth2/index.js +5 -0
  203. package/dist/auth/oauth2/index.js.map +1 -0
  204. package/dist/auth/oauth2/utils.d.ts +90 -0
  205. package/dist/auth/oauth2/utils.d.ts.map +1 -0
  206. package/dist/auth/oauth2/utils.js +167 -0
  207. package/dist/auth/oauth2/utils.js.map +1 -0
  208. package/dist/auth/providers/apple.d.ts +28 -0
  209. package/dist/auth/providers/apple.d.ts.map +1 -0
  210. package/dist/auth/providers/apple.js +192 -0
  211. package/dist/auth/providers/apple.js.map +1 -0
  212. package/dist/auth/providers/credential.d.ts +87 -0
  213. package/dist/auth/providers/credential.d.ts.map +1 -0
  214. package/dist/auth/providers/credential.js +162 -0
  215. package/dist/auth/providers/credential.js.map +1 -0
  216. package/dist/auth/providers/facebook.d.ts +26 -0
  217. package/dist/auth/providers/facebook.d.ts.map +1 -0
  218. package/dist/auth/providers/facebook.js +112 -0
  219. package/dist/auth/providers/facebook.js.map +1 -0
  220. package/dist/auth/providers/github.d.ts +29 -0
  221. package/dist/auth/providers/github.d.ts.map +1 -0
  222. package/dist/auth/providers/github.js +144 -0
  223. package/dist/auth/providers/github.js.map +1 -0
  224. package/dist/auth/providers/google.d.ts +32 -0
  225. package/dist/auth/providers/google.d.ts.map +1 -0
  226. package/dist/auth/providers/google.js +145 -0
  227. package/dist/auth/providers/google.js.map +1 -0
  228. package/dist/auth/providers/index.d.ts +22 -0
  229. package/dist/auth/providers/index.d.ts.map +1 -0
  230. package/dist/auth/providers/index.js +17 -0
  231. package/dist/auth/providers/index.js.map +1 -0
  232. package/dist/auth/routes.d.ts +63 -0
  233. package/dist/auth/routes.d.ts.map +1 -0
  234. package/dist/auth/routes.js +827 -0
  235. package/dist/auth/routes.js.map +1 -0
  236. package/dist/auth/services/index.d.ts +10 -0
  237. package/dist/auth/services/index.d.ts.map +1 -0
  238. package/dist/auth/services/index.js +7 -0
  239. package/dist/auth/services/index.js.map +1 -0
  240. package/dist/auth/services/session.d.ts +81 -0
  241. package/dist/auth/services/session.d.ts.map +1 -0
  242. package/dist/auth/services/session.js +186 -0
  243. package/dist/auth/services/session.js.map +1 -0
  244. package/dist/auth/services/token.d.ts +41 -0
  245. package/dist/auth/services/token.d.ts.map +1 -0
  246. package/dist/auth/services/token.js +44 -0
  247. package/dist/auth/services/token.js.map +1 -0
  248. package/dist/auth/services/verification.d.ts +77 -0
  249. package/dist/auth/services/verification.d.ts.map +1 -0
  250. package/dist/auth/services/verification.js +143 -0
  251. package/dist/auth/services/verification.js.map +1 -0
  252. package/dist/auth/types.d.ts +318 -0
  253. package/dist/auth/types.d.ts.map +1 -0
  254. package/dist/auth/types.js +6 -0
  255. package/dist/auth/types.js.map +1 -0
  256. package/dist/customTypes/arrays.d.ts +200 -0
  257. package/dist/customTypes/arrays.d.ts.map +1 -0
  258. package/dist/customTypes/arrays.js +309 -0
  259. package/dist/customTypes/arrays.js.map +1 -0
  260. package/dist/customTypes/index.d.ts +8 -0
  261. package/dist/customTypes/index.d.ts.map +1 -0
  262. package/dist/customTypes/index.js +11 -0
  263. package/dist/customTypes/index.js.map +1 -0
  264. package/dist/customTypes/postgis.d.ts +146 -0
  265. package/dist/customTypes/postgis.d.ts.map +1 -0
  266. package/dist/customTypes/postgis.js +315 -0
  267. package/dist/customTypes/postgis.js.map +1 -0
  268. package/dist/customTypes/ranges.d.ts +128 -0
  269. package/dist/customTypes/ranges.d.ts.map +1 -0
  270. package/dist/customTypes/ranges.js +257 -0
  271. package/dist/customTypes/ranges.js.map +1 -0
  272. package/dist/index.d.ts +37 -0
  273. package/dist/index.d.ts.map +1 -0
  274. package/dist/index.js +42 -0
  275. package/dist/index.js.map +1 -0
  276. package/dist/migrations/0.1.0-alpha.0_initial_setup.d.ts +29 -0
  277. package/dist/migrations/0.1.0-alpha.0_initial_setup.d.ts.map +1 -0
  278. package/dist/migrations/0.1.0-alpha.0_initial_setup.js +72 -0
  279. package/dist/migrations/0.1.0-alpha.0_initial_setup.js.map +1 -0
  280. package/dist/migrations/_example_migration.d.ts +31 -0
  281. package/dist/migrations/_example_migration.d.ts.map +1 -0
  282. package/dist/migrations/_example_migration.js +75 -0
  283. package/dist/migrations/_example_migration.js.map +1 -0
  284. package/dist/plugins/definePlugin.d.ts +49 -0
  285. package/dist/plugins/definePlugin.d.ts.map +1 -0
  286. package/dist/plugins/definePlugin.js +131 -0
  287. package/dist/plugins/definePlugin.js.map +1 -0
  288. package/dist/plugins/softDelete.d.ts +179 -0
  289. package/dist/plugins/softDelete.d.ts.map +1 -0
  290. package/dist/plugins/softDelete.js +235 -0
  291. package/dist/plugins/softDelete.js.map +1 -0
  292. package/dist/routes/auth.route.d.ts +14 -0
  293. package/dist/routes/auth.route.d.ts.map +1 -0
  294. package/dist/routes/auth.route.js +421 -0
  295. package/dist/routes/auth.route.js.map +1 -0
  296. package/dist/routes/file.route.d.ts +7 -0
  297. package/dist/routes/file.route.d.ts.map +1 -0
  298. package/dist/routes/file.route.js +274 -0
  299. package/dist/routes/file.route.js.map +1 -0
  300. package/dist/routes/items.route.d.ts +7 -0
  301. package/dist/routes/items.route.d.ts.map +1 -0
  302. package/dist/routes/items.route.js +369 -0
  303. package/dist/routes/items.route.js.map +1 -0
  304. package/dist/routes/migration.route.d.ts +7 -0
  305. package/dist/routes/migration.route.d.ts.map +1 -0
  306. package/dist/routes/migration.route.js +225 -0
  307. package/dist/routes/migration.route.js.map +1 -0
  308. package/dist/routes/notification.route.d.ts +7 -0
  309. package/dist/routes/notification.route.d.ts.map +1 -0
  310. package/dist/routes/notification.route.js +124 -0
  311. package/dist/routes/notification.route.js.map +1 -0
  312. package/dist/routes/openapi.route.d.ts +7 -0
  313. package/dist/routes/openapi.route.d.ts.map +1 -0
  314. package/dist/routes/openapi.route.js +2169 -0
  315. package/dist/routes/openapi.route.js.map +1 -0
  316. package/dist/routes/permission.route.d.ts +7 -0
  317. package/dist/routes/permission.route.d.ts.map +1 -0
  318. package/dist/routes/permission.route.js +158 -0
  319. package/dist/routes/permission.route.js.map +1 -0
  320. package/dist/routes/realtime.route.d.ts +21 -0
  321. package/dist/routes/realtime.route.d.ts.map +1 -0
  322. package/dist/routes/realtime.route.js +243 -0
  323. package/dist/routes/realtime.route.js.map +1 -0
  324. package/dist/routes/reports.route.d.ts +7 -0
  325. package/dist/routes/reports.route.d.ts.map +1 -0
  326. package/dist/routes/reports.route.js +95 -0
  327. package/dist/routes/reports.route.js.map +1 -0
  328. package/dist/routes/schema.route.d.ts +7 -0
  329. package/dist/routes/schema.route.d.ts.map +1 -0
  330. package/dist/routes/schema.route.js +1780 -0
  331. package/dist/routes/schema.route.js.map +1 -0
  332. package/dist/routes/settings.route.d.ts +7 -0
  333. package/dist/routes/settings.route.d.ts.map +1 -0
  334. package/dist/routes/settings.route.js +154 -0
  335. package/dist/routes/settings.route.js.map +1 -0
  336. package/dist/routes/templates.route.d.ts +7 -0
  337. package/dist/routes/templates.route.d.ts.map +1 -0
  338. package/dist/routes/templates.route.js +91 -0
  339. package/dist/routes/templates.route.js.map +1 -0
  340. package/dist/routes/utils.route.d.ts +7 -0
  341. package/dist/routes/utils.route.d.ts.map +1 -0
  342. package/dist/routes/utils.route.js +33 -0
  343. package/dist/routes/utils.route.js.map +1 -0
  344. package/dist/routes/workflow.route.d.ts +7 -0
  345. package/dist/routes/workflow.route.d.ts.map +1 -0
  346. package/dist/routes/workflow.route.js +787 -0
  347. package/dist/routes/workflow.route.js.map +1 -0
  348. package/dist/services/AssetsService.d.ts +39 -0
  349. package/dist/services/AssetsService.d.ts.map +1 -0
  350. package/dist/services/AssetsService.js +255 -0
  351. package/dist/services/AssetsService.js.map +1 -0
  352. package/dist/services/CacheService.d.ts +169 -0
  353. package/dist/services/CacheService.d.ts.map +1 -0
  354. package/dist/services/CacheService.js +722 -0
  355. package/dist/services/CacheService.js.map +1 -0
  356. package/dist/services/FilesService.d.ts +30 -0
  357. package/dist/services/FilesService.d.ts.map +1 -0
  358. package/dist/services/FilesService.js +268 -0
  359. package/dist/services/FilesService.js.map +1 -0
  360. package/dist/services/HooksManager.d.ts +38 -0
  361. package/dist/services/HooksManager.d.ts.map +1 -0
  362. package/dist/services/HooksManager.js +165 -0
  363. package/dist/services/HooksManager.js.map +1 -0
  364. package/dist/services/ItemsService.d.ts +273 -0
  365. package/dist/services/ItemsService.d.ts.map +1 -0
  366. package/dist/services/ItemsService.js +2458 -0
  367. package/dist/services/ItemsService.js.map +1 -0
  368. package/dist/services/MailService.d.ts +76 -0
  369. package/dist/services/MailService.d.ts.map +1 -0
  370. package/dist/services/MailService.js +585 -0
  371. package/dist/services/MailService.js.map +1 -0
  372. package/dist/services/MigrationService.d.ts +243 -0
  373. package/dist/services/MigrationService.d.ts.map +1 -0
  374. package/dist/services/MigrationService.js +914 -0
  375. package/dist/services/MigrationService.js.map +1 -0
  376. package/dist/services/NotificationService.d.ts +35 -0
  377. package/dist/services/NotificationService.d.ts.map +1 -0
  378. package/dist/services/NotificationService.js +159 -0
  379. package/dist/services/NotificationService.js.map +1 -0
  380. package/dist/services/PermissionService.d.ts +128 -0
  381. package/dist/services/PermissionService.d.ts.map +1 -0
  382. package/dist/services/PermissionService.js +373 -0
  383. package/dist/services/PermissionService.js.map +1 -0
  384. package/dist/services/PluginManager.d.ts +138 -0
  385. package/dist/services/PluginManager.d.ts.map +1 -0
  386. package/dist/services/PluginManager.js +463 -0
  387. package/dist/services/PluginManager.js.map +1 -0
  388. package/dist/services/RealtimeService.d.ts +209 -0
  389. package/dist/services/RealtimeService.d.ts.map +1 -0
  390. package/dist/services/RealtimeService.js +978 -0
  391. package/dist/services/RealtimeService.js.map +1 -0
  392. package/dist/services/ReportService.d.ts +13 -0
  393. package/dist/services/ReportService.d.ts.map +1 -0
  394. package/dist/services/ReportService.js +91 -0
  395. package/dist/services/ReportService.js.map +1 -0
  396. package/dist/services/SettingsService.d.ts +60 -0
  397. package/dist/services/SettingsService.d.ts.map +1 -0
  398. package/dist/services/SettingsService.js +474 -0
  399. package/dist/services/SettingsService.js.map +1 -0
  400. package/dist/services/SocketService.d.ts +129 -0
  401. package/dist/services/SocketService.d.ts.map +1 -0
  402. package/dist/services/SocketService.js +600 -0
  403. package/dist/services/SocketService.js.map +1 -0
  404. package/dist/services/StatsService.d.ts +10 -0
  405. package/dist/services/StatsService.d.ts.map +1 -0
  406. package/dist/services/StatsService.js +40 -0
  407. package/dist/services/StatsService.js.map +1 -0
  408. package/dist/services/StorageService.d.ts +20 -0
  409. package/dist/services/StorageService.d.ts.map +1 -0
  410. package/dist/services/StorageService.js +164 -0
  411. package/dist/services/StorageService.js.map +1 -0
  412. package/dist/services/TasksService.d.ts +74 -0
  413. package/dist/services/TasksService.d.ts.map +1 -0
  414. package/dist/services/TasksService.js +404 -0
  415. package/dist/services/TasksService.js.map +1 -0
  416. package/dist/services/WorkflowService.d.ts +305 -0
  417. package/dist/services/WorkflowService.d.ts.map +1 -0
  418. package/dist/services/WorkflowService.js +1811 -0
  419. package/dist/services/WorkflowService.js.map +1 -0
  420. package/dist/templates/logo/logo.png +0 -0
  421. package/dist/templates/mails/default.liquid +23 -0
  422. package/dist/types/aggregation.d.ts +40 -0
  423. package/dist/types/aggregation.d.ts.map +1 -0
  424. package/dist/types/aggregation.js +6 -0
  425. package/dist/types/aggregation.js.map +1 -0
  426. package/dist/types/assets.d.ts +32 -0
  427. package/dist/types/assets.d.ts.map +1 -0
  428. package/dist/types/assets.js +6 -0
  429. package/dist/types/assets.js.map +1 -0
  430. package/dist/types/auth.d.ts +50 -0
  431. package/dist/types/auth.d.ts.map +1 -0
  432. package/dist/types/auth.js +6 -0
  433. package/dist/types/auth.js.map +1 -0
  434. package/dist/types/cache.d.ts +47 -0
  435. package/dist/types/cache.d.ts.map +1 -0
  436. package/dist/types/cache.js +6 -0
  437. package/dist/types/cache.js.map +1 -0
  438. package/dist/types/database.d.ts +16 -0
  439. package/dist/types/database.d.ts.map +1 -0
  440. package/dist/types/database.js +6 -0
  441. package/dist/types/database.js.map +1 -0
  442. package/dist/types/fields.d.ts +71 -0
  443. package/dist/types/fields.d.ts.map +1 -0
  444. package/dist/types/fields.js +6 -0
  445. package/dist/types/fields.js.map +1 -0
  446. package/dist/types/files.d.ts +33 -0
  447. package/dist/types/files.d.ts.map +1 -0
  448. package/dist/types/files.js +6 -0
  449. package/dist/types/files.js.map +1 -0
  450. package/dist/types/hooks.d.ts +29 -0
  451. package/dist/types/hooks.d.ts.map +1 -0
  452. package/dist/types/hooks.js +6 -0
  453. package/dist/types/hooks.js.map +1 -0
  454. package/dist/types/import-export.d.ts +62 -0
  455. package/dist/types/import-export.d.ts.map +1 -0
  456. package/dist/types/import-export.js +6 -0
  457. package/dist/types/import-export.js.map +1 -0
  458. package/dist/types/index.d.ts +31 -0
  459. package/dist/types/index.d.ts.map +1 -0
  460. package/dist/types/index.js +58 -0
  461. package/dist/types/index.js.map +1 -0
  462. package/dist/types/mail.d.ts +34 -0
  463. package/dist/types/mail.d.ts.map +1 -0
  464. package/dist/types/mail.js +6 -0
  465. package/dist/types/mail.js.map +1 -0
  466. package/dist/types/notifications.d.ts +16 -0
  467. package/dist/types/notifications.d.ts.map +1 -0
  468. package/dist/types/notifications.js +6 -0
  469. package/dist/types/notifications.js.map +1 -0
  470. package/dist/types/plugin.d.ts +351 -0
  471. package/dist/types/plugin.d.ts.map +1 -0
  472. package/dist/types/plugin.js +8 -0
  473. package/dist/types/plugin.js.map +1 -0
  474. package/dist/types/query.d.ts +71 -0
  475. package/dist/types/query.d.ts.map +1 -0
  476. package/dist/types/query.js +6 -0
  477. package/dist/types/query.js.map +1 -0
  478. package/dist/types/relations.d.ts +111 -0
  479. package/dist/types/relations.d.ts.map +1 -0
  480. package/dist/types/relations.js +6 -0
  481. package/dist/types/relations.js.map +1 -0
  482. package/dist/types/reports.d.ts +17 -0
  483. package/dist/types/reports.d.ts.map +1 -0
  484. package/dist/types/reports.js +6 -0
  485. package/dist/types/reports.js.map +1 -0
  486. package/dist/types/schema.d.ts +26 -0
  487. package/dist/types/schema.d.ts.map +1 -0
  488. package/dist/types/schema.js +6 -0
  489. package/dist/types/schema.js.map +1 -0
  490. package/dist/types/seed.d.ts +27 -0
  491. package/dist/types/seed.d.ts.map +1 -0
  492. package/dist/types/seed.js +6 -0
  493. package/dist/types/seed.js.map +1 -0
  494. package/dist/types/services.d.ts +68 -0
  495. package/dist/types/services.d.ts.map +1 -0
  496. package/dist/types/services.js +6 -0
  497. package/dist/types/services.js.map +1 -0
  498. package/dist/types/settings.d.ts +36 -0
  499. package/dist/types/settings.d.ts.map +1 -0
  500. package/dist/types/settings.js +6 -0
  501. package/dist/types/settings.js.map +1 -0
  502. package/dist/types/sockets.d.ts +26 -0
  503. package/dist/types/sockets.d.ts.map +1 -0
  504. package/dist/types/sockets.js +6 -0
  505. package/dist/types/sockets.js.map +1 -0
  506. package/dist/types/sort.d.ts +25 -0
  507. package/dist/types/sort.d.ts.map +1 -0
  508. package/dist/types/sort.js +6 -0
  509. package/dist/types/sort.js.map +1 -0
  510. package/dist/types/spatial.d.ts +19 -0
  511. package/dist/types/spatial.d.ts.map +1 -0
  512. package/dist/types/spatial.js +6 -0
  513. package/dist/types/spatial.js.map +1 -0
  514. package/dist/types/stats.d.ts +21 -0
  515. package/dist/types/stats.d.ts.map +1 -0
  516. package/dist/types/stats.js +6 -0
  517. package/dist/types/stats.js.map +1 -0
  518. package/dist/types/storage.d.ts +19 -0
  519. package/dist/types/storage.d.ts.map +1 -0
  520. package/dist/types/storage.js +6 -0
  521. package/dist/types/storage.js.map +1 -0
  522. package/dist/types/tasks.d.ts +14 -0
  523. package/dist/types/tasks.d.ts.map +1 -0
  524. package/dist/types/tasks.js +6 -0
  525. package/dist/types/tasks.js.map +1 -0
  526. package/dist/types/utils.d.ts +54 -0
  527. package/dist/types/utils.d.ts.map +1 -0
  528. package/dist/types/utils.js +6 -0
  529. package/dist/types/utils.js.map +1 -0
  530. package/dist/types/workflow.d.ts +17 -0
  531. package/dist/types/workflow.d.ts.map +1 -0
  532. package/dist/types/workflow.js +6 -0
  533. package/dist/types/workflow.js.map +1 -0
  534. package/dist/utils/aggregationUtils.d.ts +192 -0
  535. package/dist/utils/aggregationUtils.d.ts.map +1 -0
  536. package/dist/utils/aggregationUtils.js +450 -0
  537. package/dist/utils/aggregationUtils.js.map +1 -0
  538. package/dist/utils/auth.d.ts +93 -0
  539. package/dist/utils/auth.d.ts.map +1 -0
  540. package/dist/utils/auth.js +557 -0
  541. package/dist/utils/auth.js.map +1 -0
  542. package/dist/utils/cache.d.ts +64 -0
  543. package/dist/utils/cache.d.ts.map +1 -0
  544. package/dist/utils/cache.js +464 -0
  545. package/dist/utils/cache.js.map +1 -0
  546. package/dist/utils/common.d.ts +53 -0
  547. package/dist/utils/common.d.ts.map +1 -0
  548. package/dist/utils/common.js +162 -0
  549. package/dist/utils/common.js.map +1 -0
  550. package/dist/utils/db.d.ts +101 -0
  551. package/dist/utils/db.d.ts.map +1 -0
  552. package/dist/utils/db.js +413 -0
  553. package/dist/utils/db.js.map +1 -0
  554. package/dist/utils/dirname.d.ts +30 -0
  555. package/dist/utils/dirname.d.ts.map +1 -0
  556. package/dist/utils/dirname.js +95 -0
  557. package/dist/utils/dirname.js.map +1 -0
  558. package/dist/utils/dynamicVariableResolver.d.ts +17 -0
  559. package/dist/utils/dynamicVariableResolver.d.ts.map +1 -0
  560. package/dist/utils/dynamicVariableResolver.js +262 -0
  561. package/dist/utils/dynamicVariableResolver.js.map +1 -0
  562. package/dist/utils/env.d.ts +38 -0
  563. package/dist/utils/env.d.ts.map +1 -0
  564. package/dist/utils/env.js +80 -0
  565. package/dist/utils/env.js.map +1 -0
  566. package/dist/utils/errorHandler.d.ts +14 -0
  567. package/dist/utils/errorHandler.d.ts.map +1 -0
  568. package/dist/utils/errorHandler.js +79 -0
  569. package/dist/utils/errorHandler.js.map +1 -0
  570. package/dist/utils/fieldExpansion.d.ts +30 -0
  571. package/dist/utils/fieldExpansion.d.ts.map +1 -0
  572. package/dist/utils/fieldExpansion.js +145 -0
  573. package/dist/utils/fieldExpansion.js.map +1 -0
  574. package/dist/utils/fieldUtils.d.ts +179 -0
  575. package/dist/utils/fieldUtils.d.ts.map +1 -0
  576. package/dist/utils/fieldUtils.js +424 -0
  577. package/dist/utils/fieldUtils.js.map +1 -0
  578. package/dist/utils/filterOperators.d.ts +472 -0
  579. package/dist/utils/filterOperators.d.ts.map +1 -0
  580. package/dist/utils/filterOperators.js +1229 -0
  581. package/dist/utils/filterOperators.js.map +1 -0
  582. package/dist/utils/importUtils.d.ts +127 -0
  583. package/dist/utils/importUtils.d.ts.map +1 -0
  584. package/dist/utils/importUtils.js +437 -0
  585. package/dist/utils/importUtils.js.map +1 -0
  586. package/dist/utils/index.d.ts +75 -0
  587. package/dist/utils/index.d.ts.map +1 -0
  588. package/dist/utils/index.js +101 -0
  589. package/dist/utils/index.js.map +1 -0
  590. package/dist/utils/logger.d.ts +41 -0
  591. package/dist/utils/logger.d.ts.map +1 -0
  592. package/dist/utils/logger.js +217 -0
  593. package/dist/utils/logger.js.map +1 -0
  594. package/dist/utils/orderUtils.d.ts +117 -0
  595. package/dist/utils/orderUtils.d.ts.map +1 -0
  596. package/dist/utils/orderUtils.js +249 -0
  597. package/dist/utils/orderUtils.js.map +1 -0
  598. package/dist/utils/queryBuilder.d.ts +118 -0
  599. package/dist/utils/queryBuilder.d.ts.map +1 -0
  600. package/dist/utils/queryBuilder.js +489 -0
  601. package/dist/utils/queryBuilder.js.map +1 -0
  602. package/dist/utils/relationLoader.d.ts +65 -0
  603. package/dist/utils/relationLoader.d.ts.map +1 -0
  604. package/dist/utils/relationLoader.js +1081 -0
  605. package/dist/utils/relationLoader.js.map +1 -0
  606. package/dist/utils/relationPathResolver.d.ts +30 -0
  607. package/dist/utils/relationPathResolver.d.ts.map +1 -0
  608. package/dist/utils/relationPathResolver.js +173 -0
  609. package/dist/utils/relationPathResolver.js.map +1 -0
  610. package/dist/utils/relationUtils.d.ts +139 -0
  611. package/dist/utils/relationUtils.d.ts.map +1 -0
  612. package/dist/utils/relationUtils.js +711 -0
  613. package/dist/utils/relationUtils.js.map +1 -0
  614. package/dist/utils/router.d.ts +6 -0
  615. package/dist/utils/router.d.ts.map +1 -0
  616. package/dist/utils/router.js +95 -0
  617. package/dist/utils/router.js.map +1 -0
  618. package/dist/utils/schema.d.ts +88 -0
  619. package/dist/utils/schema.d.ts.map +1 -0
  620. package/dist/utils/schema.js +24 -0
  621. package/dist/utils/schema.js.map +1 -0
  622. package/dist/utils/schemaManager.d.ts +238 -0
  623. package/dist/utils/schemaManager.d.ts.map +1 -0
  624. package/dist/utils/schemaManager.js +1992 -0
  625. package/dist/utils/schemaManager.js.map +1 -0
  626. package/dist/utils/schemaValidator.d.ts +83 -0
  627. package/dist/utils/schemaValidator.d.ts.map +1 -0
  628. package/dist/utils/schemaValidator.js +491 -0
  629. package/dist/utils/schemaValidator.js.map +1 -0
  630. package/dist/utils/seed.d.ts +45 -0
  631. package/dist/utils/seed.d.ts.map +1 -0
  632. package/dist/utils/seed.js +248 -0
  633. package/dist/utils/seed.js.map +1 -0
  634. package/dist/utils/sessionCleanup.d.ts +10 -0
  635. package/dist/utils/sessionCleanup.d.ts.map +1 -0
  636. package/dist/utils/sessionCleanup.js +49 -0
  637. package/dist/utils/sessionCleanup.js.map +1 -0
  638. package/dist/utils/sortUtils.d.ts +117 -0
  639. package/dist/utils/sortUtils.d.ts.map +1 -0
  640. package/dist/utils/sortUtils.js +232 -0
  641. package/dist/utils/sortUtils.js.map +1 -0
  642. package/dist/utils/spatialUtils.d.ts +244 -0
  643. package/dist/utils/spatialUtils.d.ts.map +1 -0
  644. package/dist/utils/spatialUtils.js +359 -0
  645. package/dist/utils/spatialUtils.js.map +1 -0
  646. package/dist/utils/systemschema.d.ts +11040 -0
  647. package/dist/utils/systemschema.d.ts.map +1 -0
  648. package/dist/utils/systemschema.js +1777 -0
  649. package/dist/utils/systemschema.js.map +1 -0
  650. package/dist/utils/tenantUtils.d.ts +34 -0
  651. package/dist/utils/tenantUtils.d.ts.map +1 -0
  652. package/dist/utils/tenantUtils.js +124 -0
  653. package/dist/utils/tenantUtils.js.map +1 -0
  654. package/dist/utils/typeMapper.d.ts +25 -0
  655. package/dist/utils/typeMapper.d.ts.map +1 -0
  656. package/dist/utils/typeMapper.js +282 -0
  657. package/dist/utils/typeMapper.js.map +1 -0
  658. package/dist/utils/valueValidator.d.ts +60 -0
  659. package/dist/utils/valueValidator.d.ts.map +1 -0
  660. package/dist/utils/valueValidator.js +303 -0
  661. package/dist/utils/valueValidator.js.map +1 -0
  662. package/dist/utils/workflow.d.ts +87 -0
  663. package/dist/utils/workflow.d.ts.map +1 -0
  664. package/dist/utils/workflow.js +205 -0
  665. package/dist/utils/workflow.js.map +1 -0
  666. package/package.json +115 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4850],{45330:function(e,s,t){Promise.resolve().then(t.bind(t,97015))},79205:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});var a=t(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.filter((e,s,t)=>!!e&&t.indexOf(e)===s).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,s)=>{let{color:t="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:u,...m}=e;return(0,a.createElement)("svg",{ref:s,...n,width:l,height:l,stroke:t,strokeWidth:i?24*Number(c)/Number(l):c,className:r("lucide",o),...m},[...u.map(e=>{let[s,t]=e;return(0,a.createElement)(s,t)}),...Array.isArray(d)?d:[d]])}),i=(e,s)=>{let t=(0,a.forwardRef)((t,n)=>{let{className:i,...o}=t;return(0,a.createElement)(c,{ref:n,iconNode:s,className:r("lucide-".concat(l(e)),i),...o})});return t.displayName="".concat(e),t}},51817:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},97015:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return _}});var a=t(57437),l=t(2265),r=t(72135),n=t(14438),c=t(12381),i=t(40279),o=t(69174),d=t(91032),u=t(75060),m=t(17168),h=t(53113);let x=(0,t(79205).Z)("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);var f=t(48736),p=t(69658),j=t(42208),w=t(15868),g=t(92735),v=t(18930),N=t(17689),k=t(98335),y=t(32489),b=t(51817),C=t(71096),z=t.n(C),Z=t(72337);let F=e=>{if(0===e)return"0 B";let s=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,s)).toFixed(2))+" "+["B","KB","MB","GB"][s]},S=e=>(null==e?void 0:e.startsWith("image/"))||!1,A=e=>(null==e?void 0:e.startsWith("video/"))||!1,E=e=>S(e)?(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}):A(e)?(0,a.jsx)(x,{className:"h-4 w-4 text-purple-500"}):(null==e?void 0:e.includes("pdf"))||(null==e?void 0:e.includes("document"))?(0,a.jsx)(f.Z,{className:"h-4 w-4 text-orange-500"}):(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-500"}),M=e=>{let{record:s,apiUrl:t,token:r,size:n="sm"}=e,[c,i]=(0,l.useState)(!1),o=S(s.type),d={sm:"h-8 w-8",md:"h-12 w-12",lg:"h-48 w-full max-w-md"};if(!o||c)return(0,a.jsx)("div",{className:"".concat(d[n]," flex items-center justify-center bg-muted rounded ").concat("lg"===n?"aspect-video":""),children:E(s.type)});let u="".concat(t,"/assets/").concat(s.id,"?access_token=").concat(r).concat("sm"===n?"&width=64&height=64&fit=contain":"md"===n?"&width=96&height=96&fit=contain":"");return(0,a.jsx)("img",{src:u,alt:s.title||"File thumbnail",className:"".concat(d[n]," object-contain rounded ").concat("lg"===n?"max-h-64":""),onError:()=>i(!0),loading:"lazy"})},R=()=>{let[e,s]=(0,l.useState)(!1),[t,n]=(0,l.useState)(0),i=(0,r.Ji)(),d=localStorage.getItem("token"),u=e=>{let s="".concat(i,"/assets/").concat(e.id,"?download=true&access_token=").concat(d);window.open(s,"_blank")},m=(0,a.jsx)(c.z,{size:"icon",onClick:()=>s(!0),title:"Upload File",children:(0,a.jsx)(N.Z,{className:"h-4 w-4"})});return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsx)(Z.DataBrowserInner,{selectedCollection:"baasix_File",title:"File Manager",enableSearch:!0,enableFilters:!0,enableCreate:!1,enableView:!0,enableFilePreview:!0,enableEdit:!0,enableDelete:!0,enableExport:!0,enableImport:!0,enableBulkSelect:!0,enableColumnSettings:!0,defaultSorters:[{field:"createdAt",order:"desc"}],defaultVisibleColumns:["title","type","size","createdAt"],headerActions:m,renderRowActions:e=>{let{record:s,onView:t,onEdit:l,onDelete:r}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t,title:"View",children:(0,a.jsx)(j.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:l,title:"Edit",children:(0,a.jsx)(w.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(s),title:"Download",children:(0,a.jsx)(g.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:r,title:"Delete",children:(0,a.jsx)(v.Z,{className:"h-4 w-4"})})]})},customColumnRenderers:{title:(e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(M,{record:s,apiUrl:i,token:d,size:"sm"}),(0,a.jsx)("span",{className:"font-medium truncate max-w-xs",children:e})]}),type:e=>(0,a.jsx)(o.C,{variant:"secondary",className:"capitalize",children:e}),size:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:F(e||0)}),createdAt:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:e?z()(e).format("MMM D, YYYY h:mm A"):"-"})},onRefresh:()=>n(e=>e+1)},t),(0,a.jsx)(U,{open:e,onClose:()=>s(!1),onSuccess:()=>{n(e=>e+1),s(!1)}})]})},U=e=>{let{open:s,onClose:t,onSuccess:o}=e,[h,x]=(0,l.useState)("local"),[f,j]=(0,l.useState)([]),[w,g]=(0,l.useState)(""),[v,C]=(0,l.useState)(!1),z=(0,l.useRef)(null),{mutate:Z}=(0,r.RO)(),{mutate:S}=(0,r.uC)(),A=(0,l.useCallback)(e=>{e.preventDefault(),j(Array.from(e.dataTransfer.files))},[]),E=(0,l.useCallback)(e=>{e.preventDefault()},[]),M=e=>{j(f.filter((s,t)=>t!==e))},R=async()=>{C(!0);try{if("local"===h&&f.length>0){for(let e of f){let s=new FormData;s.append("file",e),await new Promise((t,a)=>{Z({resource:"files",values:s},{onSuccess:()=>{t()},onError:s=>{n.Am.error("Failed to upload ".concat(e.name,": ").concat(s.message)),a(s)}})})}n.Am.success("".concat(f.length," file(s) uploaded successfully")),j([]),o()}else"url"===h&&w&&S({url:"/files/upload-from-url",method:"post",values:{url:w}},{onSuccess:()=>{n.Am.success("File uploaded from URL successfully"),g(""),o()},onError:e=>{n.Am.error("Failed to upload from URL: ".concat(e.message))}})}catch(e){console.error("Upload error:",e)}finally{C(!1)}};return(0,a.jsx)(d.yo,{open:s,onOpenChange:e=>!e&&t(),children:(0,a.jsxs)(d.ue,{className:"w-[400px] sm:w-[450px]",children:[(0,a.jsx)(d.Tu,{children:(0,a.jsx)(d.bC,{children:"Upload Files"})}),(0,a.jsxs)("div",{className:"mt-6 space-y-6",children:[(0,a.jsxs)(m.mQ,{value:h,onValueChange:e=>x(e),children:[(0,a.jsxs)(m.dr,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(m.SP,{value:"local",children:[(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Local File"]}),(0,a.jsxs)(m.SP,{value:"url",children:[(0,a.jsx)(k.Z,{className:"mr-2 h-4 w-4"}),"From URL"]})]}),(0,a.jsxs)(m.nU,{value:"local",className:"mt-4 space-y-4",children:[(0,a.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var e;return null===(e=z.current)||void 0===e?void 0:e.click()},onDrop:A,onDragOver:E,children:[(0,a.jsx)(N.Z,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),(0,a.jsx)("p",{className:"text-sm font-medium",children:"Drag and drop files here"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"or click to browse"}),(0,a.jsx)("input",{ref:z,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&j(Array.from(e.target.files))}})]}),f.length>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{children:"Selected Files"}),(0,a.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:f.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-muted rounded",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm truncate",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:["(",F(e.size),")"]})]}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>M(s),children:(0,a.jsx)(y.Z,{className:"h-3 w-3"})})]},s))})]})]}),(0,a.jsx)(m.nU,{value:"url",className:"mt-4 space-y-4",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{htmlFor:"url",children:"File URL"}),(0,a.jsx)(i.I,{id:"url",placeholder:"https://example.com/file.pdf",value:w,onChange:e=>g(e.target.value)}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter the URL of the file you want to upload"})]})})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(c.z,{variant:"outline",onClick:t,children:"Cancel"}),(0,a.jsxs)(c.z,{onClick:R,disabled:v||"local"===h&&0===f.length||"url"===h&&!w,children:[v?(0,a.jsx)(b.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Upload"]})]})]})]})})};function _(){return(0,a.jsx)(R,{})}}},function(e){e.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,6547,489,1303,3817,2971,2117,1744],function(){return e(e.s=45330)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2760],{24654:function(){},57166:function(e,t,r){Promise.resolve().then(r.bind(r,47750))},47750:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return ed}});var s=r(57437),a=r(2265),n=r(72135),l=r(99376),i=r(12381),o=r(90641),d=r(96246),c=r(32060),u=r(71488),f=r(27648),m=r(45114),x=r(81853),p=r(25466),h=r(50091),g=r(95805),b=r(48736),y=r(13781),v=r(98728),j=r(65621),N=r(30755),w=r(54001),k=r(85929),P=r(97226),C=r(47692);let S=[{key:"dashboard",icon:p.Z,href:"/dashboard",label:"Dashboard"},{key:"data-browser",icon:h.Z,href:"/data-browser",label:"Data Browser"},{key:"users",icon:g.Z,href:"/users/list",label:"Users"},{key:"file-manager",icon:b.Z,href:"/file-manager",label:"File Manager"},{key:"workflows",icon:y.Z,href:"/workflows",label:"Workflows"},{key:"settings",icon:v.Z,href:"/settings/roles",label:"Settings"},{key:"activity-log",icon:j.Z,href:"/activity-log/all-activity",label:"Activity Log"}],R=e=>{var t,r,a,p,h,g;let{selectedMenu:b,setSelectedMenu:y,onToggleSidebarSheet:v,showSidebarToggle:j}=e,R=(0,l.useRouter)(),{data:D}=(0,n.kS)(),{mutate:E}=(0,n.aU)(),{setMode:z,mode:T}=(0,m.Fg)(),{projectSettings:A}=(0,x.PY)(),_=(0,n.Ji)(),M="".concat("/admin","/logo-icon.svg"),Z=(null==A?void 0:null===(t=A.branding)||void 0===t?void 0:t.icon)||(null==A?void 0:null===(r=A.branding)||void 0===r?void 0:r["logo-light"]),L=Z&&_&&"/"!==_?"".concat(_,"/assets/").concat(Z):_&&"/"!==_?"".concat(_,"/assets/project_icon"):M,F=(null==A?void 0:A.color)||"#663399",V=function(e){let t=e.replace("#",""),r=parseInt(t.substring(0,2),16);return(.299*r+.587*parseInt(t.substring(2,4),16)+.114*parseInt(t.substring(4,6),16))/255>.5}(F),O=V?"#1a1a2e":"#ffffff",I=V?"rgba(0, 0, 0, 0.1)":"rgba(255, 255, 255, 0.1)",Y=V?"rgba(0, 0, 0, 0.15)":"rgba(255, 255, 255, 0.2)",U=V?"rgba(0, 0, 0, 0.1)":"rgba(255, 255, 255, 0.1)";return(0,s.jsxs)("div",{className:"flex flex-col h-screen w-[60px] border-r fixed left-0 top-0 z-50",style:{backgroundColor:F,borderColor:U,color:O},children:[(0,s.jsx)("div",{className:"p-2 flex justify-center border-b",style:{borderColor:U},children:(0,s.jsx)(f.default,{href:"/",children:(0,s.jsx)("img",{alt:"logo",src:L,className:"w-10 h-10 object-contain",onError:e=>{e.target.src=M}})})}),j&&(0,s.jsx)("div",{className:"p-2 flex justify-center border-b md:hidden",style:{borderColor:U},children:(0,s.jsxs)(u.u,{children:[(0,s.jsx)(u.aJ,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"w-10 h-10",style:{color:O},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=I},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},onClick:v,children:(0,s.jsx)(N.Z,{className:"h-5 w-5"})})}),(0,s.jsx)(u._v,{side:"right",children:(0,s.jsx)("p",{children:"Toggle Menu"})})]})}),(0,s.jsx)(o.x,{className:"flex-1 py-2",children:(0,s.jsx)("div",{className:"flex flex-col items-center gap-1",children:S.map(e=>(0,s.jsxs)(u.u,{children:[(0,s.jsx)(u.aJ,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"w-10 h-10",style:{color:O,backgroundColor:b===e.key?Y:"transparent"},onMouseEnter:t=>{b!==e.key&&(t.currentTarget.style.backgroundColor=I)},onMouseLeave:t=>{b!==e.key&&(t.currentTarget.style.backgroundColor="transparent")},onClick:()=>{y(e.key),R.push(e.href)},children:(0,s.jsx)(e.icon,{className:"h-5 w-5"})})}),(0,s.jsx)(u._v,{side:"right",children:(0,s.jsx)("p",{children:e.label})})]},e.key))})}),(0,s.jsx)("div",{className:"p-2 border-t flex justify-center",style:{borderColor:U},children:(0,s.jsxs)(c.h_,{children:[(0,s.jsx)(c.$F,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"rounded-full",style:{color:O},children:(0,s.jsxs)(d.qE,{className:"h-8 w-8",children:[(0,s.jsx)(d.F$,{src:null==D?void 0:D.avatar}),(0,s.jsxs)(d.Q5,{style:{backgroundColor:I,color:O},children:[null==D?void 0:null===(p=D.firstName)||void 0===p?void 0:null===(a=p.charAt(0))||void 0===a?void 0:a.toUpperCase(),null==D?void 0:null===(g=D.lastName)||void 0===g?void 0:null===(h=g.charAt(0))||void 0===h?void 0:h.toUpperCase()]})]})})}),(0,s.jsxs)(c.AW,{align:"end",side:"right",className:"w-56",children:[(0,s.jsx)(c.Ju,{children:(null==D?void 0:D.fullName)||"".concat((null==D?void 0:D.firstName)||""," ").concat((null==D?void 0:D.lastName)||"").trim()}),(0,s.jsx)(c.VD,{}),(0,s.jsx)(c.Xi,{asChild:!0,children:(0,s.jsxs)(f.default,{href:"/change-password",children:[(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Change Password"]})}),(0,s.jsx)(c.Xi,{onClick:()=>z(),children:"dark"===T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(k.Z,{className:"mr-2 h-4 w-4"}),"Light Mode"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.Z,{className:"mr-2 h-4 w-4"}),"Dark Mode"]})}),(0,s.jsx)(c.VD,{}),(0,s.jsxs)(c.Xi,{onClick:()=>E(),children:[(0,s.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Logout"]})]})]})})]})};var D=r(93448),E=r(40279),z=r(29696),T=r(73247);let A=e=>{let{selectedMenu:t,selectedSubMenu:r,onSelectSubMenu:n}=e,d=(0,l.useRouter)(),{schemas:c}=(0,z.I_)(),{isMultiTenant:u}=(0,x.PY)(),[f,m]=(0,a.useState)("");a.useEffect(()=>{m("")},[t]);let p=(0,a.useMemo)(()=>{let e=c||[],t=f.toLowerCase().trim();return e.filter(e=>{var t;return!(null===(t=e.collectionName)||void 0===t?void 0:t.startsWith("baasix_"))}).filter(e=>{var r,s,a;if(!t)return!0;let n=(null==e?void 0:null===(s=e.schema)||void 0===s?void 0:null===(r=s.name)||void 0===r?void 0:r.toLowerCase())||"",l=(null==e?void 0:null===(a=e.collectionName)||void 0===a?void 0:a.toLowerCase())||"";return n.includes(t)||l.includes(t)})},[c,f]),h=(e,r)=>{switch(n(e),t){case"data-browser":d.push("/data-browser/?collection=".concat(e,"&schema=").concat(encodeURIComponent(r||"")));break;case"users":d.push("/users/".concat(e,"/"));break;case"file-manager":d.push("/file-manager/".concat(e,"/"));break;case"settings":d.push("/settings/".concat(e,"/"));break;case"activity-log":d.push("/activity-log/".concat(e,"/"))}},g=e=>(0,s.jsx)(i.z,{variant:r===e.collectionName?"secondary":"ghost",className:(0,D.cn)("w-full justify-start text-sm",r===e.collectionName&&"bg-accent"),onClick:()=>{var t;return h(e.collectionName,null===(t=e.schema)||void 0===t?void 0:t.name)},children:e.collectionName},e.collectionName);return(0,s.jsx)("div",{className:"flex flex-col h-full w-full border-r bg-sidebar overflow-hidden",children:(()=>{switch(t){case"data-browser":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"p-2 border-b",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(T.Z,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,s.jsx)(E.I,{placeholder:"Search collections...",value:f,onChange:e=>m(e.target.value),className:"pl-8"})]})}),(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:p.length>0?p.map(g):(0,s.jsx)("p",{className:"text-sm text-muted-foreground px-2 py-1",children:"No collections found"})})})]});case"users":return(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:[{key:"list",label:"Users List"},{key:"invites",label:"Invites"},{key:"user-roles",label:"User Roles"},{key:"preferences",label:"Preferences"}].map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,D.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});case"settings":let e=[{key:"roles",label:"Roles"},{key:"permissions",label:"Permissions"},{key:"schema",label:"Collections"},{key:"tasks",label:"Tasks"},{key:"migrations",label:"Migrations"},{key:"templates",label:"Email Templates"}];return u&&e.push({key:"tenants",label:"Tenants"}),e.push({key:"project",label:"Project Settings"}),(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:e.map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,D.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});case"activity-log":return(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:[{key:"all-activity",label:"All Activity"},{key:"email-log",label:"Email Log"},{key:"notifications",label:"Notifications"},{key:"sessions",label:"Sessions"},{key:"workflow-executions",label:"Workflow Executions"},{key:"workflow-logs",label:"Workflow Logs"}].map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,D.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});default:return null}})()})};var _=r(41905),M=r(23374);let Z=e=>{let{className:t,...r}=e;return(0,s.jsx)(M.eh,{className:(0,D.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...r})},L=M.s_,F=e=>{let{withHandle:t,className:r,...a}=e;return(0,s.jsx)(M.OT,{className:(0,D.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...a,children:t&&(0,s.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,s.jsx)(_.Z,{className:"h-2.5 w-2.5"})})})};var V=r(91032);let O=e=>{let{children:t}=e,r=(0,l.usePathname)(),n=(0,l.useSearchParams)(),[i,o]=(0,a.useState)("data-browser"),[d,c]=(0,a.useState)(""),[u,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=r.split("/").filter(Boolean);if(e.length>0){if(o(e[0]),"data-browser"===e[0]){let e=n.get("collection");e?c(e):c("")}else e.length>1?c(e[1]):c("")}},[r,n]);let m=e=>{c(e),f(!1)},x=r.startsWith("/settings/templates/edit"),p="file-manager"!==i&&"dashboard"!==i&&"workflows"!==i&&"change-password"!==i&&!x;return(0,s.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,s.jsx)(R,{selectedMenu:i,setSelectedMenu:e=>{o(e),c("")},onToggleSidebarSheet:()=>f(!0),showSidebarToggle:p}),(0,s.jsx)("div",{className:"ml-[60px] flex-1 flex flex-col overflow-hidden",children:p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"hidden md:flex flex-1 overflow-hidden",children:(0,s.jsxs)(Z,{direction:"horizontal",className:"flex-1",children:[(0,s.jsx)(L,{defaultSize:15,minSize:10,maxSize:25,className:"flex flex-col",children:(0,s.jsx)(A,{selectedMenu:i,selectedSubMenu:d,onSelectSubMenu:m})}),(0,s.jsx)(F,{withHandle:!0}),(0,s.jsx)(L,{defaultSize:85,className:"flex flex-col",children:(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:t})})]})}),(0,s.jsx)(V.yo,{open:u,onOpenChange:f,children:(0,s.jsxs)(V.ue,{side:"left",className:"w-[280px] p-0 left-[60px]",children:[(0,s.jsx)(V.bC,{className:"sr-only",children:"Navigation Menu"}),(0,s.jsx)(A,{selectedMenu:i,selectedSubMenu:d,onSelectSubMenu:m})]})}),(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col md:hidden",children:t})]}):(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:t})})]})};var I=r(63751);let Y=String.fromCharCode(104,116,116,112,115,58,47,47,119,119,119,46,98,97,97,115,105,120,46,99,111,109,47,97,112,105,47,118,101,114,105,102,121,45,108,105,99,101,110,115,101),U=(0,a.createContext)({status:"loading",subscriptionData:null,error:null,isLoading:!0,isValid:!1,refetch:async()=>{}}),q=()=>a.useContext(U)||(console.warn("useSubscription used outside of SubscriptionProvider, using defaults"),{status:"loading",subscriptionData:null,error:null,isLoading:!0,isValid:!1,refetch:async()=>{}}),W=e=>{let{children:t}=e,[r,n]=(0,a.useState)("loading"),[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{var e,t,r,s,a;let l=window.location.hostname;"localhost"===l||"127.0.0.1"===l||"0.0.0.0"===l||l.endsWith(".local")||l.endsWith(".localhost"),n("loading"),d(null);try{let r=new AbortController,s=setTimeout(()=>r.abort(),15e3),a=await fetch(Y,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:l}),signal:r.signal});if(clearTimeout(s),!a.ok){let e="Failed to verify subscription";try{e=(await a.json()).error||e}catch(e){}n("error"),d({type:"unknown",message:"Subscription verification failed",details:"Server responded with status ".concat(a.status,": ").concat(e)}),i(null);return}let o=await a.json();if(o.subscribed)n("valid"),i({subscribed:!0,domain:o.domain,plan:o.plan,expiresAt:o.expiresAt,inGracePeriod:o.inGracePeriod,gracePeriodDaysRemaining:o.gracePeriodDaysRemaining,message:o.message}),d(null);else{n("invalid"),i({subscribed:!1,domain:o.domain,plan:o.plan,expiresAt:o.expiresAt,message:o.message});let r="not_found";((null===(e=o.message)||void 0===e?void 0:e.toLowerCase().includes("expired"))||(null===(t=o.message)||void 0===t?void 0:t.toLowerCase().includes("grace period ended")))&&(r="expired"),d({type:r,message:o.message||"No active subscription found for this domain"})}}catch(e){n("error"),"AbortError"===e.name?d({type:"network",message:"Connection timed out",details:"The subscription verification request took too long to complete. Please check your internet connection and try again."}):(null===(r=e.message)||void 0===r?void 0:r.includes("Failed to fetch"))||(null===(s=e.message)||void 0===s?void 0:s.includes("NetworkError"))||(null===(a=e.message)||void 0===a?void 0:a.includes("Network request failed"))?d({type:"network",message:"Network error",details:"Unable to connect to the Baasix license server. Please check your internet connection and try again."}):d({type:"unknown",message:"Verification failed",details:e.message||"An unexpected error occurred while verifying the subscription."}),i(null)}},[]);return(0,a.useEffect)(()=>{c()},[c]),(0,s.jsx)(U.Provider,{value:{status:r,subscriptionData:l,error:o,isLoading:"loading"===r,isValid:"valid"===r,refetch:c},children:t})};var B=r(75395),$=r(49322),G=r(91723),J=r(83578),X=r(99388),H=r(82431),Q=r(96362);function K(e){let{status:t,error:r,subscriptionData:n,onRetry:l}=e,[i,o]=a.useState(!1),d=async()=>{o(!0),await l(),o(!1)};return(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"max-w-md w-full",children:[(0,s.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-2xl shadow-2xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-indigo-600 to-blue-600 px-6 py-8 text-center",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white/20 rounded-full mb-4",children:(()=>{if("error"===t)return(null==r?void 0:r.type)==="network"?(0,s.jsx)(B.Z,{className:"h-16 w-16 text-orange-500"}):(0,s.jsx)($.Z,{className:"h-16 w-16 text-red-500"});switch(null==r?void 0:r.type){case"expired":return(0,s.jsx)(G.Z,{className:"h-16 w-16 text-amber-500"});case"not_found":return(0,s.jsx)(J.Z,{className:"h-16 w-16 text-red-500"});default:return(0,s.jsx)(X.Z,{className:"h-16 w-16 text-red-500"})}})()}),(0,s.jsx)("h1",{className:"text-2xl font-bold text-white",children:(()=>{if("error"===t)return(null==r?void 0:r.type)==="network"?"Connection Error":"Verification Error";switch(null==r?void 0:r.type){case"expired":return"Subscription Expired";case"not_found":return"No Active Subscription";default:return"Subscription Required"}})()})]}),(0,s.jsxs)("div",{className:"px-6 py-8",children:[(0,s.jsx)("p",{className:"text-slate-600 dark:text-slate-300 text-center mb-6",children:"error"===t&&(null==r?void 0:r.type)==="network"?"We couldn't connect to the Baasix license server to verify your subscription.":(null==r?void 0:r.type)==="expired"?"Your Baasix subscription has expired. Please renew to continue using the admin panel.":"A valid Baasix subscription is required to use this admin panel."}),r&&(0,s.jsxs)("div",{className:"bg-slate-100 dark:bg-slate-700/50 rounded-lg p-4 mb-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-slate-700 dark:text-slate-300 mb-2",children:"Error Details"}),(0,s.jsx)("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:r.message}),r.details&&(0,s.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-500 mt-2",children:r.details})]}),(null==n?void 0:n.domain)&&(0,s.jsxs)("div",{className:"bg-slate-100 dark:bg-slate-700/50 rounded-lg p-4 mb-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Domain"}),(0,s.jsx)("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300",children:n.domain})]}),n.plan&&(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Previous Plan"}),(0,s.jsx)("span",{className:"text-sm font-medium text-slate-700 dark:text-slate-300 capitalize",children:n.plan})]}),n.expiresAt&&(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Expired On"}),(0,s.jsx)("span",{className:"text-sm text-slate-700 dark:text-slate-300",children:new Date(n.expiresAt).toLocaleDateString()})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:["error"===t&&(0,s.jsxs)("button",{onClick:d,disabled:i,className:"w-full flex items-center justify-center gap-2 bg-slate-100 dark:bg-slate-700 hover:bg-slate-200 dark:hover:bg-slate-600 text-slate-700 dark:text-slate-300 font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-50",children:[(0,s.jsx)(H.Z,{className:"h-4 w-4 ".concat(i?"animate-spin":"")}),i?"Retrying...":"Try Again"]}),(0,s.jsxs)("a",{href:"https://www.baasix.com/#pricing",target:"_blank",rel:"noopener noreferrer",className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-indigo-600 to-blue-600 hover:from-indigo-700 hover:to-blue-700 text-white font-medium py-3 px-4 rounded-lg transition-all shadow-lg shadow-indigo-500/25",children:[(null==r?void 0:r.type)==="expired"?"Renew Subscription":"Get Subscription",(0,s.jsx)(Q.Z,{className:"h-4 w-4"})]}),(0,s.jsxs)("a",{href:"https://www.baasix.com",target:"_blank",rel:"noopener noreferrer",className:"w-full flex items-center justify-center gap-2 text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 font-medium py-2 px-4 rounded-lg transition-colors",children:["Visit baasix.com",(0,s.jsx)(Q.Z,{className:"h-4 w-4"})]})]})]}),(0,s.jsx)("div",{className:"bg-slate-50 dark:bg-slate-900/50 px-6 py-4 text-center border-t border-slate-200 dark:border-slate-700",children:(0,s.jsxs)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:["Need help?"," ",(0,s.jsx)("a",{href:"mailto:support@baasix.com",className:"text-indigo-600 dark:text-indigo-400 hover:underline",children:"Contact support"})]})})]}),(0,s.jsx)("div",{className:"mt-6 text-center",children:(0,s.jsxs)("p",{className:"text-slate-400 text-sm",children:["Starting at just"," ",(0,s.jsx)("span",{className:"text-white font-semibold",children:"$9.99/year"})," per domain"]})})]})})}var ee=r(76865),et=r(30767);function er(e){if(!e)return null;let t=new Date(e),r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}function es(){let e=new Date().toISOString().split("T")[0];return"".concat("baasix_subscription_warning_dismissed","_").concat(e)}function ea(e){let{subscriptionData:t}=e,[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!t||"development"===t.plan||"lifetime"===t.plan)return;let e=es();if("true"===sessionStorage.getItem(e))return;if(t.inGracePeriod){i("grace"),n(!0);return}let r=er(t.expiresAt);null!==r&&r<=14&&(i("expiring"),n(!0))},[t]);let o=()=>{let e=es();sessionStorage.setItem(e,"true"),n(!1)};if(!t||!l)return null;let d=er(t.expiresAt),c=t.gracePeriodDaysRemaining;return(0,s.jsx)(et.aR,{open:r,onOpenChange:n,children:(0,s.jsxs)(et._T,{className:"max-w-md",children:[(0,s.jsx)(et.fY,{children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:["grace"===l?(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:(0,s.jsx)(ee.Z,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}):(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30",children:(0,s.jsx)(G.Z,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),(0,s.jsx)(et.f$,{className:"text-left",children:"grace"===l?"Subscription Expired - Grace Period ends in "+(c?" ".concat(c," ").concat(1===c?"day":"days"):""):"Subscription Expiring On"+(t.expiresAt?" ".concat(new Date(t.expiresAt).toLocaleDateString()):"")})]})}),(0,s.jsxs)("div",{className:"space-y-4 text-sm text-muted-foreground",children:["grace"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{children:["Your Baasix subscription has expired. You are currently in the"," ",(0,s.jsx)("strong",{children:"grace period"}),"."]}),(0,s.jsxs)("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 dark:text-red-300",children:"Grace period remaining"}),(0,s.jsxs)("span",{className:"text-lg font-bold text-red-600 dark:text-red-400",children:[c," ",1===c?"day":"days"]})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:"After the grace period ends, you will lose access to the admin panel."})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:"Your Baasix subscription will expire soon. Renew now to avoid any interruption in service."}),(0,s.jsxs)("div",{className:"rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Days until expiry"}),(0,s.jsxs)("span",{className:"text-lg font-bold text-amber-600 dark:text-amber-400",children:[d," ",1===d?"day":"days"]})]}),t.expiresAt&&(0,s.jsxs)("p",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Expires on"," ",new Date(t.expiresAt).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})]})]})]}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Domain: ",(0,s.jsx)("span",{className:"font-mono",children:t.domain})]})]}),(0,s.jsxs)(et.xo,{className:"flex-col sm:flex-row gap-2",children:[(0,s.jsx)(et.le,{onClick:o,className:"sm:order-1",children:"Remind Me Later"}),(0,s.jsxs)(et.OL,{onClick:()=>{window.open("https://www.baasix.com/#pricing","_blank"),o()},className:"grace"===l?"bg-red-600 hover:bg-red-700 sm:order-2":"bg-amber-600 hover:bg-amber-700 sm:order-2",children:["Renew Now",(0,s.jsx)(Q.Z,{className:"ml-2 h-4 w-4"})]})]})]})})}function en(e){let{children:t}=e,{status:r,error:a,subscriptionData:n,isLoading:l,refetch:i}=q();return l?(0,s.jsx)("div",{className:"flex h-screen w-screen items-center justify-center bg-background",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"h-8 w-8 mx-auto animate-spin rounded-full border-4 border-primary border-t-transparent"}),(0,s.jsx)("p",{className:"mt-4 text-muted-foreground",children:"Verifying setup..."})]})}):"invalid"===r||"error"===r?(0,s.jsx)(K,{status:r,error:a,subscriptionData:n,onRetry:i}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ea,{subscriptionData:n}),t]})}function el(e){let{children:t}=e;return(0,s.jsx)(W,{children:(0,s.jsx)(en,{children:t})})}function ei(){return(0,s.jsx)("div",{className:"flex h-screen w-screen items-center justify-center",children:(0,s.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}function eo(e){let{children:t}=e,r=(0,l.useRouter)(),{data:i,isLoading:o}=(0,n.kq)();return((0,a.useEffect)(()=>{o||(null==i?void 0:i.authenticated)!==!1||r.replace("/login")},[o,i,r]),!o&&(null==i?void 0:i.authenticated))?(0,s.jsx)(el,{children:(0,s.jsx)(z.A1,{children:(0,s.jsx)(I.CE,{children:(0,s.jsx)(O,{children:t})})})}):(0,s.jsx)(ei,{})}function ed(e){let{children:t}=e;return(0,s.jsx)(a.Suspense,{fallback:(0,s.jsx)(ei,{}),children:(0,s.jsx)(eo,{children:t})})}},30767:function(e,t,r){"use strict";r.d(t,{OL:function(){return g},_T:function(){return f},aR:function(){return o},f$:function(){return p},fY:function(){return m},le:function(){return b},vW:function(){return d},xo:function(){return x},yT:function(){return h}});var s=r(57437),a=r(2265),n=r(16720),l=r(93448),i=r(12381);let o=n.fC,d=n.xz,c=n.h_,u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{className:(0,l.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a,ref:t})});u.displayName="AlertDialogOverlay";let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(n.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",r),...a})]})});f.displayName="AlertDialogContent";let m=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};m.displayName="AlertDialogHeader";let x=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};x.displayName="AlertDialogFooter";let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold",r),...a})});p.displayName="AlertDialogTitle";let h=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",r),...a})});h.displayName="AlertDialogDescription";let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aU,{ref:t,className:(0,l.cn)((0,i.d)(),r),...a})});g.displayName="AlertDialogAction";let b=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.$j,{ref:t,className:(0,l.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",r),...a})});b.displayName="AlertDialogCancel"},96246:function(e,t,r){"use strict";r.d(t,{F$:function(){return o},Q5:function(){return d},qE:function(){return i}});var s=r(57437),a=r(2265),n=r(27954),l=r(93448);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,l.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",r),...a})});i.displayName=n.fC.displayName;let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Ee,{ref:t,className:(0,l.cn)("aspect-square h-full w-full",r),...a})});o.displayName=n.Ee.displayName;let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.NY,{ref:t,className:(0,l.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",r),...a})});d.displayName=n.NY.displayName},12381:function(e,t,r){"use strict";r.d(t,{d:function(){return o},z:function(){return d}});var s=r(57437),a=r(2265),n=r(37053),l=r(90535),i=r(93448);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef((e,t)=>{let{className:r,variant:a,size:l,asChild:d=!1,...c}=e,u=d?n.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(o({variant:a,size:l,className:r})),ref:t,...c})});d.displayName="Button"},32060:function(e,t,r){"use strict";r.d(t,{$F:function(){return u},AW:function(){return f},Ju:function(){return x},VD:function(){return p},Xi:function(){return m},h_:function(){return c}});var s=r(57437),a=r(2265),n=r(28119),l=r(10407),i=r(30401),o=r(40519),d=r(93448);let c=n.fC,u=n.xz;n.ZA,n.Uv,n.Tr,n.Ee,a.forwardRef((e,t)=>{let{className:r,inset:a,children:i,...o}=e;return(0,s.jsxs)(n.fF,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",r),...o,children:[i,(0,s.jsx)(l.Z,{className:"ml-auto h-4 w-4"})]})}).displayName=n.fF.displayName,a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.tu,{ref:t,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...a})}).displayName=n.tu.displayName;let f=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...l}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...l})})});f.displayName=n.VY.displayName;let m=a.forwardRef((e,t)=>{let{className:r,inset:a,...l}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",r),...l})});m.displayName=n.ck.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,checked:l,...o}=e;return(0,s.jsxs)(n.oC,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:l,...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})}),a]})}).displayName=n.oC.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,...l}=e;return(0,s.jsxs)(n.Rk,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...l,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(o.Z,{className:"h-2 w-2 fill-current"})})}),a]})}).displayName=n.Rk.displayName;let x=a.forwardRef((e,t)=>{let{className:r,inset:a,...l}=e;return(0,s.jsx)(n.__,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r),...l})});x.displayName=n.__.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",r),...a})});p.displayName=n.Z0.displayName},40279:function(e,t,r){"use strict";r.d(t,{I:function(){return l}});var s=r(57437),a=r(2265),n=r(93448);let l=a.forwardRef((e,t)=>{let{className:r,type:a,...l}=e;return(0,s.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...l})});l.displayName="Input"},90641:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var s=r(57437),a=r(2265),n=r(43643),l=r(93448);let i=a.forwardRef((e,t)=>{let{className:r,children:a,...i}=e;return(0,s.jsxs)(n.fC,{ref:t,className:(0,l.cn)("relative overflow-hidden",r),...i,children:[(0,s.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:a}),(0,s.jsx)(o,{}),(0,s.jsx)(n.Ns,{})]})});i.displayName=n.fC.displayName;let o=a.forwardRef((e,t)=>{let{className:r,orientation:a="vertical",...i}=e;return(0,s.jsx)(n.gb,{ref:t,orientation:a,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...i,children:(0,s.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=n.gb.displayName},91032:function(e,t,r){"use strict";r.d(t,{Ei:function(){return b},FF:function(){return h},Tu:function(){return p},bC:function(){return g},sw:function(){return c},ue:function(){return x},yo:function(){return d}});var s=r(57437),a=r(2265),n=r(70001),l=r(90535),i=r(32489),o=r(93448);let d=n.fC;n.xz;let c=n.x8,u=n.h_,f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{className:(0,o.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a,ref:t})});f.displayName=n.aV.displayName;let m=(0,l.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out overflow-hidden",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-full sm:w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full sm:w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"}},defaultVariants:{side:"right"}}),x=a.forwardRef((e,t)=>{let{side:r="right",className:a,children:l,hideDefaultClose:d=!1,...c}=e;return(0,s.jsxs)(u,{children:[(0,s.jsx)(f,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,o.cn)(m({side:r}),a),...c,children:[!d&&(0,s.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,s.jsx)(i.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]}),l]})]})});x.displayName=n.VY.displayName;let p=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};p.displayName="SheetHeader";let h=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};h.displayName="SheetFooter";let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold text-foreground",r),...a})});g.displayName=n.Dx.displayName;let b=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",r),...a})});b.displayName=n.dk.displayName},71488:function(e,t,r){"use strict";r.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return o}});var s=r(57437),a=r(2265),n=r(91668),l=r(93448);let i=n.zt,o=n.fC,d=n.xz,c=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...i}=e;return(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,l.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i})});c.displayName=n.VY.displayName},93448:function(e,t,r){"use strict";r.d(t,{cn:function(){return n}});var s=r(61994),a=r(53335);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.m6)((0,s.W)(t))}},63751:function(e,t,r){"use strict";r.d(t,{CE:function(){return d},Gn:function(){return o}});var s=r(57437),a=r(2265),n=r(72135),l=r(14438);let i=(0,a.createContext)(void 0),o=()=>{let e=(0,a.useContext)(i);if(!e)throw Error("usePreferences must be used within a PreferencesProvider");return e};function d(e){var t;let{children:r}=e,[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!1),{data:f}=(0,n.kS)(),m=(null==f?void 0:f.id)||(null==f?void 0:null===(t=f.user)||void 0===t?void 0:t.id)||null,{data:x,isLoading:p,refetch:h}=(0,n.sm)({resource:"baasix_UserPreference",queryOptions:{enabled:!!m},filters:m?[{field:"userId",operator:"eq",value:m}]:[],pagination:{pageSize:-1,mode:"off"}}),{mutate:g}=(0,n.RO)({resource:"baasix_UserPreference"}),{mutate:b}=(0,n.PQ)({resource:"baasix_UserPreference"});(0,a.useEffect)(()=>{(null==x?void 0:x.data)?(d(x.data),u(!0)):m&&!p&&(d([]),u(!0))},[x,m,p]);let y=(0,a.useMemo)(()=>{let e={};return o.forEach(t=>{t.isDefault&&(e[t.collectionName]||(e[t.collectionName]={}),e[t.collectionName][t.preferenceType]=t)}),e},[o]),v=(0,a.useCallback)((e,t)=>{var r;return(null===(r=y[e])||void 0===r?void 0:r[t])||null},[y]),j=(0,a.useCallback)(async(e,t,r)=>{if(!m){console.warn("No user ID available for saving preferences");return}let s=v(e,t),a={userId:m,collectionName:e,preferenceType:t,preferenceData:r,isDefault:!0};try{(null==s?void 0:s.id)?await new Promise((e,t)=>{b({id:s.id,values:a,successNotification:!1},{onSuccess:()=>{h(),e()},onError:e=>{console.error("Error updating preference:",e),t(e)}})}):await new Promise((e,t)=>{g({values:a,successNotification:!1},{onSuccess:()=>{h(),e()},onError:e=>{console.error("Error creating preference:",e),t(e)}})})}catch(e){throw l.Am.error("Failed to save preferences"),e}},[m,v,g,b,h]),N=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.columns;return r?r.preferenceData:null},[y]),w=(0,a.useCallback)(async(e,t)=>{await j(e,"columns",t)},[j]),k=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.filters;return r?r.preferenceData:null},[y]),P=(0,a.useCallback)(async(e,t)=>{await j(e,"filters",t)},[j]),C=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.sorting;return r?r.preferenceData:null},[y]),S=(0,a.useCallback)(async(e,t)=>{await j(e,"sorting",t)},[j]),R=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.pagination;return r?r.preferenceData:null},[y]),D=(0,a.useCallback)(async(e,t)=>{await j(e,"pagination",t)},[j]);return(0,s.jsx)(i.Provider,{value:{getColumnPreferences:N,saveColumnPreferences:w,getFilterPreferences:k,saveFilterPreferences:P,getSortingPreferences:C,saveSortingPreferences:S,getPaginationPreferences:R,savePaginationPreferences:D,isLoading:p,isInitialized:c,refetchPreferences:h},children:r})}},81853:function(e,t,r){"use strict";r.d(t,{Ml:function(){return i},PY:function(){return l}});var s=r(57437),a=r(2265);let n=(0,a.createContext)({projectSettings:null,isMultiTenant:!1,isLoading:!0,refetch:()=>{}}),l=()=>a.useContext(n)||(console.warn("useProject used outside of ProjectContextProvider, using defaults"),{projectSettings:null,isMultiTenant:!1,isLoading:!1,refetch:()=>{}}),i=e=>{let{children:t,baasixClient:r}=e,[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{try{d(!0);let e=await r.server.info();i(null==e?void 0:e.project)}catch(e){console.error("Failed to fetch project settings",e)}finally{d(!1)}},[r]);(0,a.useEffect)(()=>{c()},[c]);let u=(null==l?void 0:l.multitenant)===!0||(null==l?void 0:l.multitenant)==="true";return(0,s.jsx)(n.Provider,{value:{projectSettings:l,isMultiTenant:u,isLoading:o,refetch:c},children:t})}},29696:function(e,t,r){"use strict";r.d(t,{A1:function(){return o},I_:function(){return i}});var s=r(57437),a=r(2265),n=r(72135);let l=(0,a.createContext)(void 0),i=()=>{let e=(0,a.useContext)(l);if(!e)throw Error("useSchema must be used within a SchemaProvider");return e};function o(e){let{children:t}=e,{data:r,isLoading:a,refetch:i}=(0,n.sm)({resource:"collections",queryOptions:{enabled:!0},sorters:[{field:"collectionName",order:"asc"}],pagination:{pageSize:500}}),o=(null==r?void 0:r.data)||[],d=e=>o.find(t=>t.collectionName===e),c=e=>{let t=d(e),r=null==t?void 0:t.schema.fields;if(r){let t={...r};for(let[e,r]of Object.entries(t))r.hidden&&delete t[e];return"baasix_Account"===e&&(delete t.password,delete t.accessToken,delete t.refreshToken,delete t.idToken),"baasix_Verification"===e&&delete t.value,"baasix_Sessions"===e&&delete t.token,t}return r},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===r)return[];let a=c(e);return a?Object.entries(a).map(e=>{let[a,n]=e,l=t?"".concat(t,".").concat(a):a,i=s?{title:n.relType?l+".*":l,value:n.relType?l+".*":l,key:n.relType?l+".*":l,isLeaf:!n.relType}:{title:l,value:l,key:l,isLeaf:!n.relType};return n.relType&&n.target&&(i.children=u(n.target,l,r-1,s)),i}):[]};return(0,s.jsx)(l.Provider,{value:{schemas:o,isLoading:a,refetch:i,getSchemaByName:d,getFieldsByCollection:c,getCollectionChoices:()=>o.map(e=>({label:e.schema.name,value:e.collectionName})),getTargetFields:e=>{let t=c(e);return t?Object.entries(t).map(e=>{let[t]=e;return{label:t,value:t}}):[]},formatRelationshipDisplay:(e,t)=>e&&t?null==t?void 0:t.split(",").map(t=>{let r=t.trim();return e[r]||r}).join(""):"",getNestedFields:e=>u(e),getPermissionFields:e=>[{title:"*",value:"*",key:"*",isLeaf:!0},...u(e,"",6,!0),{title:"*.*",value:"*.*",key:"*.*",isLeaf:!0},{title:"*.*.*",value:"*.*.*",key:"*.*.*",isLeaf:!0},{title:"*.*.*.*",value:"*.*.*.*",key:"*.*.*.*",isLeaf:!0}],isSortEnabled:e=>{var t;let r=d(e);return(null==r?void 0:null===(t=r.schema)||void 0===t?void 0:t.sortEnabled)===!0}},children:t})}},45114:function(e,t,r){"use strict";r.d(t,{Fg:function(){return o},ze:function(){return f}});var s=r(57437),a=r(2265),n=r(25922),l=r(81853);let i=(0,a.createContext)({}),o=()=>{let e=a.useContext(i);if(!e)throw Error("useTheme must be used within a ThemeContextProvider");return e};function d(e,t,r){return"".concat(e," ").concat(t,"% ").concat(r,"%")}function c(e,t,r){return Math.min(Math.max(e,t),r)}let u=e=>{let{children:t,defaultMode:r="dark"}=e,{setTheme:o,resolvedTheme:u}=(0,n.F)(),{projectSettings:f}=(0,l.PY)(),[m,x]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{x(!0)},[]),(0,a.useEffect)(()=>{m&&(null==f?void 0:f.color)&&function(e,t){let r=function(e){if(6!==(e=e.replace(/^#/,"")).length)return null;let t=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,s=parseInt(e.substring(4,6),16)/255,a=Math.max(t,r,s),n=Math.min(t,r,s),l=0,i=0,o=(a+n)/2;if(a!==n){let e=a-n;switch(i=o>.5?e/(2-a-n):e/(a+n),a){case t:l=((r-s)/e+(r<s?6:0))/6;break;case r:l=((s-t)/e+2)/6;break;case s:l=((t-r)/e+4)/6}}return{h:Math.round(360*l),s:Math.round(100*i),l:Math.round(100*o)}}(e);if(!r)return;let s=document.documentElement,{h:a,s:n,l}=r,i=d(a,n,l);s.style.setProperty("--primary",i);let o=l>50?d(a,c(n-10,0,100),10):d(a,c(n-10,0,100),98);if(s.style.setProperty("--primary-foreground",o),s.style.setProperty("--ring",i),t){let e=d(a,c(n-20,10,40),c(l-5,15,25));s.style.setProperty("--accent",e),s.style.setProperty("--accent-foreground",d(a,c(n-30,0,30),95));let t=d(a,c(n-25,5,35),c(l-10,15,22));s.style.setProperty("--muted",t),s.style.setProperty("--muted-foreground",d(a,c(n-30,5,25),65)),s.style.setProperty("--secondary",d(a,c(n-20,10,35),c(l-8,15,22))),s.style.setProperty("--secondary-foreground",d(a,c(n-30,0,30),95)),s.style.setProperty("--border",d(a,c(n-25,5,35),c(l-10,18,28))),s.style.setProperty("--input",d(a,c(n-25,5,35),c(l-10,18,28))),s.style.setProperty("--sidebar-background",d(a,c(n-30,5,20),8)),s.style.setProperty("--sidebar-foreground",d(a,c(n-30,5,20),92)),s.style.setProperty("--sidebar-primary",i),s.style.setProperty("--sidebar-primary-foreground",o),s.style.setProperty("--sidebar-accent",d(a,c(n-25,5,25),15)),s.style.setProperty("--sidebar-accent-foreground",d(a,c(n-30,5,20),92)),s.style.setProperty("--sidebar-border",d(a,c(n-30,5,20),15)),s.style.setProperty("--sidebar-ring",i),s.style.setProperty("--chart-1",d(a,70,50)),s.style.setProperty("--chart-2",d((a+60)%360,60,45)),s.style.setProperty("--chart-3",d((a+120)%360,80,55)),s.style.setProperty("--chart-4",d((a+180)%360,65,60)),s.style.setProperty("--chart-5",d((a+240)%360,75,55))}else{let e=d(a,c(n-10,20,50),c(l+30,90,97));s.style.setProperty("--accent",e),s.style.setProperty("--accent-foreground",d(a,c(n,30,60),15));let t=d(a,c(n-20,10,45),c(l+35,94,98));s.style.setProperty("--muted",t),s.style.setProperty("--muted-foreground",d(a,c(n-20,10,30),45)),s.style.setProperty("--secondary",d(a,c(n-15,15,45),c(l+32,92,97))),s.style.setProperty("--secondary-foreground",d(a,c(n,30,60),15)),s.style.setProperty("--border",d(a,c(n-20,10,35),88)),s.style.setProperty("--input",d(a,c(n-20,10,35),88)),s.style.setProperty("--sidebar-background",d(a,c(n-25,5,25),97)),s.style.setProperty("--sidebar-foreground",d(a,c(n-20,10,30),25)),s.style.setProperty("--sidebar-primary",i),s.style.setProperty("--sidebar-primary-foreground",o),s.style.setProperty("--sidebar-accent",d(a,c(n-15,10,40),93)),s.style.setProperty("--sidebar-accent-foreground",d(a,c(n-20,10,30),20)),s.style.setProperty("--sidebar-border",d(a,c(n-25,5,25),90)),s.style.setProperty("--sidebar-ring",i),s.style.setProperty("--chart-1",d(a,76,61)),s.style.setProperty("--chart-2",d((a+60)%360,58,39)),s.style.setProperty("--chart-3",d((a+120)%360,37,24)),s.style.setProperty("--chart-4",d((a+180)%360,74,66)),s.style.setProperty("--chart-5",d((a+240)%360,87,67))}}(f.color,"dark"===u)},[m,null==f?void 0:f.color,u]),m)?(0,s.jsx)(i.Provider,{value:{setMode:()=>{o("light"===u?"dark":"light")},mode:u||r,primaryColor:(null==f?void 0:f.color)||"#644152"},children:t}):null},f=e=>{let{children:t,defaultMode:r="dark"}=e;return(0,s.jsx)(n.f,{attribute:"class",defaultTheme:r,enableSystem:!0,children:(0,s.jsx)(u,{defaultMode:r,children:t})})}}},function(e){e.O(0,[7999,5094,4438,6530,4475,6241,926,600,1668,9124,8473,3563,7982,2971,2117,1744],function(){return e(e.s=57166)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3753],{55203:function(e,s,a){Promise.resolve().then(a.bind(a,36818))},36818:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return F}});var l=a(57437),t=a(2265),n=a(72135),r=a(14438),i=a(79820),c=a(12381),d=a(69174),o=a(40279),m=a(43368),x=a(75060),u=a(23675),h=a(17168),j=a(90641),g=a(69140),p=a(33804),f=a(30767),v=a(74291),N=a(15291),b=a(92934),w=a(91723),y=a(51817),k=a(99388),C=a(69076),Z=a(76865),S=a(16066),M=a(49322),A=a(50091),z=a(71947),R=a(82431),O=a(99397),_=a(33276),D=a(10866),T=a(65621),L=a(22135),E=a(40875),V=a(7598),U=a(27107);let B=e=>{let{status:s}=e,a={completed:{variant:"default",icon:(0,l.jsx)(b.Z,{className:"h-3 w-3 mr-1"}),label:"Completed"},pending:{variant:"secondary",icon:(0,l.jsx)(w.Z,{className:"h-3 w-3 mr-1"}),label:"Pending"},running:{variant:"outline",icon:(0,l.jsx)(y.Z,{className:"h-3 w-3 mr-1 animate-spin"}),label:"Running"},failed:{variant:"destructive",icon:(0,l.jsx)(k.Z,{className:"h-3 w-3 mr-1"}),label:"Failed"},rolled_back:{variant:"outline",icon:(0,l.jsx)(C.Z,{className:"h-3 w-3 mr-1"}),label:"Rolled Back"},skipped:{variant:"secondary",icon:(0,l.jsx)(Z.Z,{className:"h-3 w-3 mr-1"}),label:"Skipped"}}[s]||{variant:"secondary",icon:null,label:s};return(0,l.jsxs)(d.C,{variant:a.variant,className:"flex items-center",children:[a.icon,a.label]})},Y=e=>{let{type:s}=e,a={upgrade:{color:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",icon:(0,l.jsx)(S.Z,{className:"h-3 w-3 mr-1"})},hotfix:{color:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",icon:(0,l.jsx)(M.Z,{className:"h-3 w-3 mr-1"})},rollback:{color:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",icon:(0,l.jsx)(C.Z,{className:"h-3 w-3 mr-1"})},data:{color:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",icon:(0,l.jsx)(A.Z,{className:"h-3 w-3 mr-1"})},schema:{color:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",icon:(0,l.jsx)(z.Z,{className:"h-3 w-3 mr-1"})}}[s]||{color:"bg-gray-100 text-gray-800",icon:null};return(0,l.jsxs)(d.C,{variant:"outline",className:"flex items-center ".concat(a.color),children:[a.icon,s]})},P=()=>{var e,s,a;let k=(0,n.Ji)(),[S,M]=(0,t.useState)("status"),[z,P]=(0,t.useState)(""),[F,H]=(0,t.useState)([]),[Q,q]=(0,t.useState)(new Set),[$,I]=(0,t.useState)(!1),[W,J]=(0,t.useState)(!1),[K,G]=(0,t.useState)(!1),[X,ee]=(0,t.useState)(!1),[es,ea]=(0,t.useState)(!1),[el,et]=(0,t.useState)(null),[en,er]=(0,t.useState)({name:"",description:"",type:"upgrade"}),{data:ei,isLoading:ec,refetch:ed}=(0,n.EV)({url:"".concat(k,"/migrations/status"),method:"get",queryOptions:{refetchInterval:5e3}}),{data:eo,isLoading:em,refetch:ex}=(0,n.EV)({url:"".concat(k,"/migrations"),method:"get"}),{data:eu,isLoading:eh,refetch:ej}=(0,n.EV)({url:"".concat(k,"/migrations/pending"),method:"get"}),{mutate:eg,isLoading:ep}=(0,n.uC)(),{mutate:ef,isLoading:ev}=(0,n.uC)(),{mutate:eN,isLoading:eb}=(0,n.uC)(),{mutate:ew,isLoading:ey}=(0,n.uC)(),{mutate:ek,isLoading:eC}=(0,n.uC)(),{mutate:eZ,isLoading:eS}=(0,n.uC)(),eM=null==ei?void 0:null===(e=ei.data)||void 0===e?void 0:e.data,eA=(null==eo?void 0:null===(s=eo.data)||void 0===s?void 0:s.data)||[],ez=(null==eu?void 0:null===(a=eu.data)||void 0===a?void 0:a.data)||[],eR=(0,t.useMemo)(()=>{if(!z.trim())return eA;let e=z.toLowerCase();return eA.filter(s=>{var a;return s.version.toLowerCase().includes(e)||s.name.toLowerCase().includes(e)||(null===(a=s.description)||void 0===a?void 0:a.toLowerCase().includes(e))})},[eA,z]),eO=()=>{ed(),ex(),ej()},e_=e=>{ef({url:"".concat(k,"/migrations/rollback/").concat(encodeURIComponent(e)),method:"post",values:{}},{onSuccess:()=>{r.Am.success("Successfully rolled back migration ".concat(e)),J(!1),et(null),eO()},onError:e=>{r.Am.error("Failed to rollback: ".concat(e.message))}})},eD=e=>{eZ({url:"".concat(k,"/migrations/rollback-batch"),method:"post",values:{batch:e}},{onSuccess:s=>{var a,l;let t=null==s?void 0:null===(a=s.data)||void 0===a?void 0:a.data;r.Am.success("Successfully rolled back ".concat((null==t?void 0:null===(l=t.rolledBack)||void 0===l?void 0:l.length)||0," migration(s) from batch ").concat(e)),eO()},onError:e=>{r.Am.error("Failed to rollback batch: ".concat(e.message))}})},eT=e=>{eN({url:"".concat(k,"/migrations/mark-completed/").concat(encodeURIComponent(e)),method:"post",values:{}},{onSuccess:()=>{r.Am.success("Marked migration ".concat(e," as completed")),G(!1),eO()},onError:e=>{r.Am.error("Failed to mark as completed: ".concat(e.message))}})},eL=e=>{q(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})},eE=e=>{et(e),ea(!0)};return ec?(0,l.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(g.O,{className:"h-8 w-48"}),(0,l.jsx)(g.O,{className:"h-10 w-32"})]}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,l.jsx)(g.O,{className:"h-24"},e))}),(0,l.jsx)(g.O,{className:"h-96"})]}):(0,l.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 flex-shrink-0",children:[(0,l.jsx)("h1",{className:"text-lg font-semibold",children:"Database Migrations"}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(c.z,{variant:"outline",size:"icon",onClick:eO,children:(0,l.jsx)(R.Z,{className:"h-4 w-4"})}),(0,l.jsxs)(c.z,{variant:"outline",onClick:()=>ee(!0),children:[(0,l.jsx)(O.Z,{className:"mr-2 h-4 w-4"}),"Create Migration"]}),(0,l.jsxs)(c.z,{onClick:()=>I(!0),disabled:!ez.length||ep,children:[ep?(0,l.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,l.jsx)(_.Z,{className:"mr-2 h-4 w-4"}),"Run Migrations"]})]})]}),(null==eM?void 0:eM.isSequelizeUpgrade)&&(0,l.jsx)(i.Zb,{className:"border-amber-500 bg-amber-50 dark:bg-amber-950",children:(0,l.jsx)(i.aY,{className:"py-4",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(Z.Z,{className:"h-5 w-5 text-amber-600"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-amber-800 dark:text-amber-200",children:"Sequelize to Drizzle Upgrade Detected"}),(0,l.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Your database appears to be from an older Sequelize-based version. Please run the pending migrations to complete the upgrade."})]})]})})}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 flex-shrink-0",children:[(0,l.jsx)(i.Zb,{children:(0,l.jsxs)(i.Ol,{className:"pb-2",children:[(0,l.jsx)(i.SZ,{children:"Current Version"}),(0,l.jsx)(i.ll,{className:"text-2xl font-mono",children:(null==eM?void 0:eM.currentVersion)||"No migrations"})]})}),(0,l.jsx)(i.Zb,{children:(0,l.jsxs)(i.Ol,{className:"pb-2",children:[(0,l.jsx)(i.SZ,{children:"Applied Migrations"}),(0,l.jsx)(i.ll,{className:"text-2xl",children:(null==eM?void 0:eM.appliedCount)||0})]})}),(0,l.jsx)(i.Zb,{className:(null==eM?void 0:eM.pendingCount)?"border-amber-500":"",children:(0,l.jsxs)(i.Ol,{className:"pb-2",children:[(0,l.jsx)(i.SZ,{children:"Pending Migrations"}),(0,l.jsxs)(i.ll,{className:"text-2xl flex items-center gap-2",children:[(null==eM?void 0:eM.pendingCount)||0,(null==eM?void 0:eM.pendingCount)?(0,l.jsx)(Z.Z,{className:"h-5 w-5 text-amber-500"}):(0,l.jsx)(b.Z,{className:"h-5 w-5 text-green-500"})]})]})}),(0,l.jsx)(i.Zb,{children:(0,l.jsxs)(i.Ol,{className:"pb-2",children:[(0,l.jsx)(i.SZ,{children:"Last Batch"}),(0,l.jsxs)(i.ll,{className:"text-2xl",children:["#",(null==eM?void 0:eM.lastBatch)||0]})]})})]}),(0,l.jsxs)(h.mQ,{value:S,onValueChange:M,className:"flex-1 flex flex-col min-h-0",children:[(0,l.jsxs)(h.dr,{className:"grid w-full max-w-md grid-cols-3",children:[(0,l.jsxs)(h.SP,{value:"status",children:[(0,l.jsx)(D.Z,{className:"h-4 w-4 mr-2"}),"Status"]}),(0,l.jsxs)(h.SP,{value:"pending",children:[(0,l.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Pending (",ez.length,")"]}),(0,l.jsxs)(h.SP,{value:"history",children:[(0,l.jsx)(T.Z,{className:"h-4 w-4 mr-2"}),"History"]})]}),(0,l.jsx)(h.nU,{value:"status",className:"flex-1 overflow-hidden",children:(0,l.jsxs)(i.Zb,{className:"h-full",children:[(0,l.jsxs)(i.Ol,{children:[(0,l.jsx)(i.ll,{children:"Migration Status"}),(0,l.jsx)(i.SZ,{children:"Overview of your database migration state"})]}),(0,l.jsxs)(i.aY,{className:"space-y-6",children:[(null==eM?void 0:eM.lastMigration)&&(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Last Applied Migration"}),(0,l.jsx)(i.Zb,{children:(0,l.jsx)(i.aY,{className:"py-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-mono font-medium",children:eM.lastMigration.version}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:eM.lastMigration.name})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(B,{status:eM.lastMigration.status}),eM.lastMigration.executedAt&&(0,l.jsx)("span",{className:"text-sm text-muted-foreground",children:(0,V.Q)(new Date(eM.lastMigration.executedAt),{addSuffix:!0})})]})]})})})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Quick Actions"}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxs)(c.z,{variant:"outline",onClick:()=>I(!0),disabled:!ez.length,children:[(0,l.jsx)(_.Z,{className:"h-4 w-4 mr-2"}),"Run All Pending"]}),(0,l.jsxs)(c.z,{variant:"outline",onClick:()=>{ew({url:"".concat(k,"/migrations/mark-all-completed"),method:"post",values:{}},{onSuccess:e=>{var s,a;let l=(null==e?void 0:null===(a=e.data)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.markedCount)||0;r.Am.success("Marked ".concat(l," migration(s) as completed")),eO()},onError:e=>{r.Am.error("Failed to mark all as completed: ".concat(e.message))}})},disabled:ey||!ez.length,children:[ey?(0,l.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,l.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Mark All as Completed"]}),(null==eM?void 0:eM.lastBatch)&&eM.lastBatch>0&&(0,l.jsxs)(c.z,{variant:"outline",onClick:()=>eD(eM.lastBatch),disabled:eS,children:[eS?(0,l.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,l.jsx)(C.Z,{className:"h-4 w-4 mr-2"}),"Rollback Batch #",eM.lastBatch]})]})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"System Information"}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-muted-foreground",children:"Total Migrations:"}),(0,l.jsx)("span",{className:"ml-2 font-medium",children:(null==eM?void 0:eM.totalMigrations)||0})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-muted-foreground",children:"Status:"}),(0,l.jsx)("span",{className:"ml-2",children:(null==eM?void 0:eM.isUpToDate)?(0,l.jsxs)(d.C,{variant:"default",children:[(0,l.jsx)(b.Z,{className:"h-3 w-3 mr-1"}),"Up to Date"]}):(0,l.jsxs)(d.C,{variant:"secondary",children:[(0,l.jsx)(Z.Z,{className:"h-3 w-3 mr-1"}),"Updates Available"]})})]})]})]})]})]})}),(0,l.jsx)(h.nU,{value:"pending",className:"flex-1 overflow-hidden",children:(0,l.jsxs)(i.Zb,{className:"h-full flex flex-col",children:[(0,l.jsxs)(i.Ol,{children:[(0,l.jsx)(i.ll,{children:"Pending Migrations"}),(0,l.jsx)(i.SZ,{children:"Migrations waiting to be applied"})]}),(0,l.jsx)(i.aY,{className:"flex-1 overflow-hidden",children:eh?(0,l.jsx)("div",{className:"space-y-2",children:[1,2,3].map(e=>(0,l.jsx)(g.O,{className:"h-16"},e))}):0===ez.length?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[(0,l.jsx)(b.Z,{className:"h-12 w-12 mb-4 text-green-500"}),(0,l.jsx)("p",{className:"text-lg font-medium",children:"All migrations are up to date!"}),(0,l.jsx)("p",{className:"text-sm",children:"No pending migrations to run."})]}):(0,l.jsx)(j.x,{className:"h-full",children:(0,l.jsx)("div",{className:"space-y-2",children:ez.map((e,s)=>(0,l.jsx)(i.Zb,{children:(0,l.jsx)(i.aY,{className:"py-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsxs)("span",{className:"text-muted-foreground w-6",children:[s+1,"."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-mono font-medium",children:e.version}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:e.name}),e.description&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.description})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(Y,{type:e.type}),e.canRollback&&(0,l.jsx)(d.C,{variant:"outline",className:"text-xs",children:"Reversible"}),(0,l.jsx)(c.z,{size:"sm",variant:"outline",onClick:()=>eT(e.version),children:"Mark Done"})]})]})})},e.version))})})})]})}),(0,l.jsx)(h.nU,{value:"history",className:"flex-1 overflow-hidden",children:(0,l.jsxs)(i.Zb,{className:"h-full flex flex-col",children:[(0,l.jsx)(i.Ol,{className:"flex-shrink-0",children:(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(i.ll,{children:"Migration History"}),(0,l.jsx)(i.SZ,{children:"All applied migrations"})]}),(0,l.jsx)(m.t,{value:z,onChange:P,placeholder:"Search migrations...",expandedWidth:"w-64"})]})}),(0,l.jsx)(i.aY,{className:"flex-1 overflow-hidden p-0",children:em?(0,l.jsx)("div",{className:"p-6 space-y-2",children:[1,2,3,4,5].map(e=>(0,l.jsx)(g.O,{className:"h-12"},e))}):0===eR.length?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[(0,l.jsx)(A.Z,{className:"h-12 w-12 mb-4"}),(0,l.jsx)("p",{className:"text-lg font-medium",children:"No migrations found"}),(0,l.jsx)("p",{className:"text-sm",children:z?"Try a different search term":"No migrations have been run yet"})]}):(0,l.jsx)(j.x,{className:"h-full",children:(0,l.jsxs)(p.iA,{children:[(0,l.jsx)(p.xD,{className:"sticky top-0 bg-background",children:(0,l.jsxs)(p.SC,{children:[(0,l.jsx)(p.ss,{className:"w-8"}),(0,l.jsx)(p.ss,{children:"Version"}),(0,l.jsx)(p.ss,{children:"Name"}),(0,l.jsx)(p.ss,{children:"Type"}),(0,l.jsx)(p.ss,{children:"Status"}),(0,l.jsx)(p.ss,{children:"Batch"}),(0,l.jsx)(p.ss,{children:"Executed"}),(0,l.jsx)(p.ss,{children:"Duration"}),(0,l.jsx)(p.ss,{className:"w-24",children:"Actions"})]})}),(0,l.jsx)(p.RM,{children:eR.map(e=>(0,l.jsxs)(t.Fragment,{children:[(0,l.jsxs)(p.SC,{className:"failed"===e.status?"bg-red-50 dark:bg-red-950":"",children:[(0,l.jsx)(p.pj,{children:(e.errorMessage||e.description)&&(0,l.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>eL(e.id),children:Q.has(e.id)?(0,l.jsx)(L.Z,{className:"h-4 w-4"}):(0,l.jsx)(E.Z,{className:"h-4 w-4"})})}),(0,l.jsx)(p.pj,{className:"font-mono text-sm",children:e.version}),(0,l.jsx)(p.pj,{children:e.name}),(0,l.jsx)(p.pj,{children:(0,l.jsx)(Y,{type:e.type})}),(0,l.jsx)(p.pj,{children:(0,l.jsx)(B,{status:e.status})}),(0,l.jsxs)(p.pj,{children:["#",e.batch||"-"]}),(0,l.jsx)(p.pj,{children:e.executedAt?(0,U.WU)(new Date(e.executedAt),"MMM d, yyyy HH:mm"):"-"}),(0,l.jsx)(p.pj,{children:e.executionTimeMs?"".concat(e.executionTimeMs,"ms"):"-"}),(0,l.jsx)(p.pj,{children:(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>eE(e),children:(0,l.jsx)(D.Z,{className:"h-4 w-4"})}),e.canRollback&&"completed"===e.status&&(0,l.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{et(e),J(!0)},children:(0,l.jsx)(C.Z,{className:"h-4 w-4"})})]})})]}),Q.has(e.id)&&(0,l.jsx)(p.SC,{children:(0,l.jsxs)(p.pj,{colSpan:9,className:"bg-muted/50 p-4",children:[e.description&&(0,l.jsxs)("p",{className:"text-sm mb-2",children:[(0,l.jsx)("strong",{children:"Description:"})," ",e.description]}),e.errorMessage&&(0,l.jsxs)("div",{className:"text-sm text-red-600 dark:text-red-400",children:[(0,l.jsx)("strong",{children:"Error:"}),(0,l.jsx)("pre",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900 rounded text-xs overflow-x-auto",children:e.errorMessage}),e.errorStack&&(0,l.jsxs)("details",{className:"mt-2",children:[(0,l.jsx)("summary",{className:"cursor-pointer text-xs",children:"Stack trace"}),(0,l.jsx)("pre",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900 rounded text-xs overflow-x-auto",children:e.errorStack})]})]})]})})]},e.id))})]})})})]})})]}),(0,l.jsx)(f.aR,{open:$,onOpenChange:I,children:(0,l.jsxs)(f._T,{children:[(0,l.jsxs)(f.fY,{children:[(0,l.jsx)(f.f$,{children:"Run Pending Migrations?"}),(0,l.jsxs)(f.yT,{children:["This will execute ",ez.length," pending migration(s). Make sure you have a database backup before proceeding."]})]}),(0,l.jsx)("div",{className:"max-h-48 overflow-y-auto my-4",children:(0,l.jsx)("div",{className:"space-y-2",children:ez.map(e=>(0,l.jsxs)("div",{className:"text-sm p-2 bg-muted rounded flex items-center justify-between",children:[(0,l.jsx)("span",{className:"font-mono",children:e.version}),(0,l.jsx)(Y,{type:e.type})]},e.version))})}),(0,l.jsxs)(f.xo,{children:[(0,l.jsx)(f.le,{children:"Cancel"}),(0,l.jsxs)(f.OL,{onClick:()=>{eg({url:"".concat(k,"/migrations/run"),method:"post",values:{}},{onSuccess:e=>{var s,a,l;let t=null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.data;(null==t?void 0:null===(a=t.applied)||void 0===a?void 0:a.length)>0?r.Am.success("Successfully ran ".concat(t.applied.length," migration(s)")):r.Am.info("No pending migrations to run"),(null==t?void 0:null===(l=t.failed)||void 0===l?void 0:l.length)>0&&r.Am.error("".concat(t.failed.length," migration(s) failed")),I(!1),eO()},onError:e=>{r.Am.error("Failed to run migrations: ".concat(e.message))}})},disabled:ep,className:"bg-primary",children:[ep?(0,l.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,l.jsx)(_.Z,{className:"mr-2 h-4 w-4"}),"Run Migrations"]})]})]})}),(0,l.jsx)(f.aR,{open:W,onOpenChange:J,children:(0,l.jsxs)(f._T,{children:[(0,l.jsxs)(f.fY,{children:[(0,l.jsx)(f.f$,{children:"Rollback Migration?"}),(0,l.jsxs)(f.yT,{children:["This will rollback migration"," ",(0,l.jsx)("span",{className:"font-mono font-medium",children:null==el?void 0:el.version}),". This action may cause data loss. Are you sure?"]})]}),(0,l.jsxs)(f.xo,{children:[(0,l.jsx)(f.le,{children:"Cancel"}),(0,l.jsxs)(f.OL,{onClick:()=>el&&e_(el.version),disabled:ev,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[ev?(0,l.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,l.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Rollback"]})]})]})}),(0,l.jsx)(v.Vq,{open:X,onOpenChange:ee,children:(0,l.jsxs)(v.cZ,{children:[(0,l.jsxs)(v.fK,{children:[(0,l.jsx)(v.$N,{children:"Create New Migration"}),(0,l.jsx)(v.Be,{children:"Generate a new migration file in the migrations directory"})]}),(0,l.jsxs)("div",{className:"space-y-4 py-4",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(x._,{htmlFor:"name",children:"Migration Name"}),(0,l.jsx)(o.I,{id:"name",placeholder:"e.g., add_user_preferences",value:en.name,onChange:e=>er({...en,name:e.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(x._,{htmlFor:"type",children:"Type"}),(0,l.jsxs)(N.Ph,{value:en.type,onValueChange:e=>er({...en,type:e}),children:[(0,l.jsx)(N.i4,{children:(0,l.jsx)(N.ki,{})}),(0,l.jsxs)(N.Bw,{children:[(0,l.jsx)(N.Ql,{value:"upgrade",children:"Upgrade"}),(0,l.jsx)(N.Ql,{value:"hotfix",children:"Hotfix"}),(0,l.jsx)(N.Ql,{value:"data",children:"Data Migration"}),(0,l.jsx)(N.Ql,{value:"schema",children:"Schema Change"})]})]})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(x._,{htmlFor:"description",children:"Description (optional)"}),(0,l.jsx)(u.g,{id:"description",placeholder:"Describe what this migration does...",value:en.description,onChange:e=>er({...en,description:e.target.value})})]})]}),(0,l.jsxs)(v.cN,{children:[(0,l.jsx)(c.z,{variant:"outline",onClick:()=>ee(!1),children:"Cancel"}),(0,l.jsxs)(c.z,{onClick:()=>{if(!en.name.trim()){r.Am.error("Migration name is required");return}ek({url:"".concat(k,"/migrations/create"),method:"post",values:en},{onSuccess:e=>{var s,a;r.Am.success("Created migration: ".concat(null==e?void 0:null===(a=e.data)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.filename)),ee(!1),er({name:"",description:"",type:"upgrade"}),eO()},onError:e=>{r.Am.error("Failed to create migration: ".concat(e.message))}})},disabled:eC,children:[eC?(0,l.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,l.jsx)(O.Z,{className:"mr-2 h-4 w-4"}),"Create Migration"]})]})]})}),(0,l.jsx)(v.Vq,{open:es,onOpenChange:ea,children:(0,l.jsxs)(v.cZ,{className:"max-w-2xl",children:[(0,l.jsxs)(v.fK,{children:[(0,l.jsx)(v.$N,{children:"Migration Details"}),(0,l.jsxs)(v.Be,{children:[null==el?void 0:el.version," - ",null==el?void 0:el.name]})]}),el&&(0,l.jsx)("div",{className:"max-h-[60vh] overflow-y-auto pr-2",children:(0,l.jsxs)("div",{className:"space-y-4 py-4",children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Version"}),(0,l.jsx)("p",{className:"font-mono",children:el.version})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Name"}),(0,l.jsx)("p",{children:el.name})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Type"}),(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsx)(Y,{type:el.type})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Status"}),(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsx)(B,{status:el.status})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Batch"}),(0,l.jsxs)("p",{children:["#",el.batch||"-"]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Execution Time"}),(0,l.jsxs)("p",{children:[el.executionTimeMs,"ms"]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Executed At"}),(0,l.jsx)("p",{children:el.executedAt?(0,U.WU)(new Date(el.executedAt),"MMM d, yyyy HH:mm:ss"):"-"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Can Rollback"}),(0,l.jsx)("p",{children:el.canRollback?"Yes":"No"})]})]}),el.description&&(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Description"}),(0,l.jsx)("p",{className:"mt-1",children:el.description})]}),el.checksum&&(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Checksum"}),(0,l.jsx)("p",{className:"mt-1 font-mono text-xs break-all",children:el.checksum})]}),el.errorMessage&&(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground text-red-600",children:"Error"}),(0,l.jsx)("pre",{className:"mt-1 p-3 bg-red-100 dark:bg-red-900 rounded text-sm whitespace-pre-wrap break-words text-red-700 dark:text-red-300",children:el.errorMessage})]}),el.metadata&&Object.keys(el.metadata).length>0&&(0,l.jsxs)("div",{children:[(0,l.jsx)(x._,{className:"text-muted-foreground",children:"Metadata"}),(0,l.jsx)("pre",{className:"mt-1 p-3 bg-muted rounded text-sm whitespace-pre-wrap break-words",children:JSON.stringify(el.metadata,null,2)})]})]})}),(0,l.jsxs)(v.cN,{children:[(0,l.jsx)(c.z,{variant:"outline",onClick:()=>ea(!1),children:"Close"}),(null==el?void 0:el.canRollback)&&(null==el?void 0:el.status)==="completed"&&(0,l.jsxs)(c.z,{variant:"destructive",onClick:()=>{ea(!1),J(!0)},children:[(0,l.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Rollback"]})]})]})})]})};var F=()=>(0,l.jsx)(P,{})},30767:function(e,s,a){"use strict";a.d(s,{OL:function(){return p},_T:function(){return x},aR:function(){return c},f$:function(){return j},fY:function(){return u},le:function(){return f},vW:function(){return d},xo:function(){return h},yT:function(){return g}});var l=a(57437),t=a(2265),n=a(16720),r=a(93448),i=a(12381);let c=n.fC,d=n.xz,o=n.h_,m=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.aV,{className:(0,r.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...t,ref:s})});m.displayName="AlertDialogOverlay";let x=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsxs)(o,{children:[(0,l.jsx)(m,{}),(0,l.jsx)(n.VY,{ref:s,className:(0,r.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",a),...t})]})});x.displayName="AlertDialogContent";let u=e=>{let{className:s,...a}=e;return(0,l.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...a})};u.displayName="AlertDialogHeader";let h=e=>{let{className:s,...a}=e;return(0,l.jsx)("div",{className:(0,r.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a})};h.displayName="AlertDialogFooter";let j=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.Dx,{ref:s,className:(0,r.cn)("text-lg font-semibold",a),...t})});j.displayName="AlertDialogTitle";let g=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.dk,{ref:s,className:(0,r.cn)("text-sm text-muted-foreground",a),...t})});g.displayName="AlertDialogDescription";let p=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.aU,{ref:s,className:(0,r.cn)((0,i.d)(),a),...t})});p.displayName="AlertDialogAction";let f=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.$j,{ref:s,className:(0,r.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",a),...t})});f.displayName="AlertDialogCancel"},69140:function(e,s,a){"use strict";a.d(s,{O:function(){return n}});var l=a(57437),t=a(93448);function n(e){let{className:s,...a}=e;return(0,l.jsx)("div",{className:(0,t.cn)("animate-pulse rounded-md bg-muted",s),...a})}},17168:function(e,s,a){"use strict";a.d(s,{SP:function(){return d},dr:function(){return c},mQ:function(){return i},nU:function(){return o}});var l=a(57437),t=a(2265),n=a(20271),r=a(93448);let i=n.fC,c=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.aV,{ref:s,className:(0,r.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...t})});c.displayName=n.aV.displayName;let d=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.xz,{ref:s,className:(0,r.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...t})});d.displayName=n.xz.displayName;let o=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)(n.VY,{ref:s,className:(0,r.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...t})});o.displayName=n.VY.displayName}},function(e){e.O(0,[7999,5094,4438,6530,4475,6241,926,600,1509,9487,3563,4952,6547,2971,2117,1744],function(){return e(e.s=55203)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8154],{80723:function(n,e,u){Promise.resolve().then(u.bind(u,64310))},64310:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.HD,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,5650,6547,489,1303,3817,9599,2971,2117,1744],function(){return n(n.s=80723)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6691],{57433:function(n,e,u){Promise.resolve().then(u.bind(u,67306))},67306:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.iL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,5650,6547,489,1303,3817,9599,2971,2117,1744],function(){return n(n.s=57433)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9735],{38509:function(n,e,u){Promise.resolve().then(u.bind(u,83975))},83975:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.kL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,5650,6547,489,1303,3817,9599,2971,2117,1744],function(){return n(n.s=38509)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[842],{49204:function(e,a,l){Promise.resolve().then(l.bind(l,67028))},79205:function(e,a,l){"use strict";l.d(a,{Z:function(){return d}});var s=l(2265);let t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,a=Array(e),l=0;l<e;l++)a[l]=arguments[l];return a.filter((e,a,l)=>!!e&&l.indexOf(e)===a).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let r=(0,s.forwardRef)((e,a)=>{let{color:l="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:d,className:c="",children:o,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:a,...i,width:t,height:t,stroke:l,strokeWidth:d?24*Number(r)/Number(t):r,className:n("lucide",c),...h},[...u.map(e=>{let[a,l]=e;return(0,s.createElement)(a,l)}),...Array.isArray(o)?o:[o]])}),d=(e,a)=>{let l=(0,s.forwardRef)((l,i)=>{let{className:d,...c}=l;return(0,s.createElement)(r,{ref:i,iconNode:a,className:n("lucide-".concat(t(e)),d),...c})});return l.displayName="".concat(e),l}},41671:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},54001:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},51817:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},67028:function(e,a,l){"use strict";l.r(a),l.d(a,{default:function(){return eo}});var s=l(57437),t=l(2265),n=l(72135),i=l(29696),r=l(14438),d=l(79820),c=l(12381),o=l(43368),u=l(69174),h=l(33804),m=l(30767),x=l(82431),p=l(99397),j=l(17689),v=l(92735),f=l(51817),g=l(50091),N=l(79205);let y=(0,N.Z)("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var b=l(54001),C=l(98728),w=l(18930),S=l(91032),I=l(40279),k=l(75060),A=l(94589),_=l(15291);let T=e=>{let{open:a,onClose:l,onSuccess:d}=e,[o,u]=(0,t.useState)(""),[h,m]=(0,t.useState)("id"),[x,p]=(0,t.useState)("UUID"),[j,v]=(0,t.useState)(!0),[g,N]=(0,t.useState)(!0),[y,b]=(0,t.useState)(!1),{mutate:C,isLoading:w}=(0,n.RO)(),{refetch:T}=(0,i.I_)(),D=()=>{u(""),m("id"),p("UUID"),v(!0),N(!0),b(!1)};return(0,s.jsx)(S.yo,{open:a,onOpenChange:e=>!e&&l(),children:(0,s.jsxs)(S.ue,{className:"w-[500px] sm:w-[600px]",children:[(0,s.jsx)(S.Tu,{children:(0,s.jsx)(S.bC,{children:"Create New Schema"})}),(0,s.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!o.trim()){r.Am.error("Please enter a schema name");return}if(o.length>63){r.Am.error("Schema name must be 63 characters or less (PostgreSQL identifier limit)");return}C({resource:"collections",values:{collectionName:o.toLowerCase(),schema:{name:o,fields:{[h]:{type:x,primaryKey:!0,defaultValue:"UUID"===x?{type:"UUIDV4"}:"Integer"===x?{type:"AUTOINCREMENT"}:"SUID"===x?{type:"SUID"}:void 0}},timestamps:j,paranoid:y,usertrack:g}}},{onSuccess:()=>{r.Am.success("Schema created successfully"),T(),D(),d()},onError:e=>{r.Am.error("Error creating schema: ".concat(e.message))}})},className:"mt-6 space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"schemaName",children:"Schema Name"}),(0,s.jsx)(I.I,{id:"schemaName",placeholder:"Enter schema name",value:o,onChange:e=>u(e.target.value),maxLength:63,className:o.length>63?"border-red-500":"",required:!0}),(0,s.jsxs)("p",{className:"text-xs ".concat(o.length>63?"text-red-600":o.length>50?"text-yellow-600":"text-muted-foreground"),children:[o.length,"/63 characters",o.length>63&&" - Name too long for PostgreSQL!"]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"primaryKeyName",children:"Primary Key Name"}),(0,s.jsx)(I.I,{id:"primaryKeyName",placeholder:"id",value:h,onChange:e=>m(e.target.value),required:!0})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"primaryKeyType",children:"Primary Key Type"}),(0,s.jsxs)(_.Ph,{value:x,onValueChange:p,children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select type"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"UUID",children:"UUID"}),(0,s.jsx)(_.Ql,{value:"Integer",children:"Integer"}),(0,s.jsx)(_.Ql,{value:"String",children:"String"}),(0,s.jsx)(_.Ql,{value:"SUID",children:"Short UID"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Timestamps"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add createdAt and updatedAt fields"})]}),(0,s.jsx)(A.r,{checked:j,onCheckedChange:v})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Audit Logs"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Track user changes to records"})]}),(0,s.jsx)(A.r,{checked:g,onCheckedChange:N})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Soft Delete"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Mark records as deleted instead of removing them"})]}),(0,s.jsx)(A.r,{checked:y,onCheckedChange:b})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4",children:[(0,s.jsx)(c.z,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),(0,s.jsxs)(c.z,{type:"submit",disabled:w,children:[w&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Schema"]})]})]})]})})},D=(0,N.Z)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var M=l(45675),R=l(23675),E=l(68245),U=l(33245),V=l(32489),L=l(71488),O=l(12749),Z=l(93448),z=l(54572);let P=[{value:" - ",label:"Dash ( - )"},{value:" ",label:"Space ( )"},{value:", ",label:"Comma (, )"},{value:"_",label:"Underscore (_)"},{value:" & ",label:"Ampersand ( & )"},{value:" | ",label:"Pipe ( | )"},{value:" (",label:"Open Paren ( ()"},{value:") ",label:"Close Paren ( ))"},{value:"(",label:"Open Paren (()"},{value:")",label:"Close Paren ())"}],F={text:[{value:"String",label:"String"},{value:"Text",label:"Text"},{value:"HTML",label:"HTML (Rich Text)"},{value:"CiText",label:"Text (Case Insensitive)"},{value:"ENUM",label:"ENUM"}],numeric:[{value:"Integer",label:"Integer"},{value:"BigInt",label:"BigInt"},{value:"Decimal",label:"Decimal"},{value:"Double",label:"Double"},{value:"Real",label:"Real"}],date:[{value:"DateTime",label:"DateTime (with timezone)"},{value:"DateTime_NO_TZ",label:"DateTime (no timezone)"},{value:"Date",label:"Date"},{value:"Time",label:"Time (with timezone)"},{value:"Time_NO_TZ",label:"Time (no timezone)"}],other:[{value:"Boolean",label:"Boolean"},{value:"UUID",label:"UUID"},{value:"SUID",label:"Short UID"},{value:"JSON",label:"JSON"},{value:"JSONB",label:"JSONB"},{value:"VIRTUAL",label:"Virtual"}],array:[{value:"Array_Integer",label:"Array Integer"},{value:"Array_String",label:"Array String"},{value:"Array_Double",label:"Array Double"},{value:"Array_Date",label:"Array Date"},{value:"Array_DateTime",label:"Array DateTime (with timezone)"},{value:"Array_DateTime_NO_TZ",label:"Array DateTime (no timezone)"},{value:"Array_Time",label:"Array Time (with timezone)"},{value:"Array_Time_NO_TZ",label:"Array Time (no timezone)"},{value:"Array_Boolean",label:"Array Boolean"}],range:[{value:"Range_Integer",label:"Range Integer"},{value:"Range_Double",label:"Range Double"},{value:"Range_Decimal",label:"Range Decimal"},{value:"Range_Date",label:"Range Date"},{value:"Range_DateTime",label:"Range DateTime (with timezone)"},{value:"Range_DateTime_NO_TZ",label:"Range DateTime (no timezone)"},{value:"Range_Time",label:"Range Time (with timezone)"},{value:"Range_Time_NO_TZ",label:"Range Time (no timezone)"}],geo:[{value:"Point",label:"Point"},{value:"Polygon",label:"Polygon"},{value:"LineString",label:"LineString"}]},Q=[{value:"M2O",label:"Many-to-One"},{value:"O2O",label:"One-to-One"},{value:"M2M",label:"Many-to-Many"},{value:"M2A",label:"Many-to-Any"}],B=e=>["DateTime","DateTime_NO_TZ","Date","Time","Time_NO_TZ"].includes(e),$=e=>{var a,l,d,o,h;let{open:m,onClose:x,collectionName:p,fieldName:j,isRelationship:v,onSuccess:g}=e,[N,y]=(0,t.useState)({name:"",type:"",allowNull:!0,hidden:!1,defaultValue:"",values:[],stringLength:"",precision:"",scale:"",calculated:"",target:"",relType:"",onDelete:"CASCADE",onUpdate:"CASCADE",alias:"",through:"",tables:[],showAs:[],polymorphic:!1,description:"",validateMin:"",validateMax:"",validateIsInt:!1,validateNotEmpty:!1,validateIsEmail:!1,validateIsUrl:!1,validateMinLength:"",validateMaxLength:"",validatePattern:""}),[b,C]=(0,t.useState)([]),{getSchemaByName:w,getNestedFields:T,schemas:D,refetch:M}=(0,i.I_)(),$=(0,t.useMemo)(()=>m&&p?{data:w(p)}:null,[m,p,w]),q=(0,t.useMemo)(()=>(null==D?void 0:D.map(e=>({id:e.collectionName,name:e.collectionName})))||[],[D]),J=(0,t.useMemo)(()=>N.target&&(null==T?void 0:T(N.target))||[],[N.target,T]),{mutate:W,isLoading:K}=(0,n.PQ)(),{mutate:X,isLoading:H}=(0,n.RO)(),Y=!!j,G=K||H;(0,t.useEffect)(()=>{if(m&&(null==$?void 0:$.data)&&j){var e,a,l,s,t,n,i,r;let d=$.data.schema.fields[j]||{},c=d.values||[],o="",u="",h="";d.values&&"object"==typeof d.values&&!Array.isArray(d.values)&&(o=d.values.stringLength||"",u=d.values.precision||"",h=d.values.scale||"",c=[]);let m="";d.defaultValue&&(m="object"==typeof d.defaultValue&&"NOW"===d.defaultValue.type?"$NOW":"object"==typeof d.defaultValue&&"UUIDV4"===d.defaultValue.type?"$UUIDV4":"object"==typeof d.defaultValue&&"SUID"===d.defaultValue.type?"$SUID":"object"==typeof d.defaultValue&&"AUTOINCREMENT"===d.defaultValue.type?"$AUTOINCREMENT":"boolean"==typeof d.defaultValue?d.defaultValue?"true":"false":String(d.defaultValue));let x=d.validate||{};y({name:j,type:d.type||"",allowNull:null===(l=d.allowNull)||void 0===l||l,hidden:null!==(s=d.hidden)&&void 0!==s&&s,defaultValue:m,values:c,stringLength:o,precision:u,scale:h,calculated:d.calculated||"",target:d.target||"",relType:d.relType||"",onDelete:d.onDelete||"CASCADE",onUpdate:d.onUpdate||"CASCADE",alias:d.alias||"",through:d.through||"",tables:d.tables||[],showAs:d.showAs||[],polymorphic:d.polymorphic||!1,description:d.description||"",validateMin:void 0!==x.min?String(x.min):"",validateMax:void 0!==x.max?String(x.max):"",validateIsInt:null!==(t=x.isInt)&&void 0!==t&&t,validateNotEmpty:null!==(n=x.notEmpty)&&void 0!==n&&n,validateIsEmail:null!==(i=x.isEmail)&&void 0!==i&&i,validateIsUrl:null!==(r=x.isUrl)&&void 0!==r&&r,validateMinLength:(null===(e=x.len)||void 0===e?void 0:e[0])!==void 0?String(x.len[0]):"",validateMaxLength:(null===(a=x.len)||void 0===a?void 0:a[1])!==void 0?String(x.len[1]):"",validatePattern:x.is||x.matches||""}),d.showAs&&Array.isArray(d.showAs)?C(d.showAs):C([])}else m&&!j&&(y({name:"",type:"",allowNull:!0,hidden:!1,defaultValue:"",values:[],stringLength:"",precision:"",scale:"",calculated:"",target:"",relType:"",onDelete:"CASCADE",onUpdate:"CASCADE",alias:"",through:"",tables:[],showAs:[],polymorphic:!1,description:"",validateMin:"",validateMax:"",validateIsInt:!1,validateNotEmpty:!1,validateIsEmail:!1,validateIsUrl:!1,validateMinLength:"",validateMaxLength:"",validatePattern:""}),C([]))},[m,$,j]),(0,t.useEffect)(()=>{if(!Y&&v&&("M2M"===N.type||"M2A"===N.type)){let e="";"M2M"===N.type&&N.target&&N.name?e="".concat(p,"_").concat(N.target,"_").concat(N.name,"_junction"):"M2A"===N.type&&N.name&&(e="".concat(p,"_").concat(N.name,"_junction")),e&&(!N.through||N.through.endsWith("_junction"))&&y(a=>({...a,through:e}))}},[N.type,N.target,N.name,p,Y,v]);let ee=()=>{var e;let a={name:N.name,type:N.type,target:N.target,onDelete:N.onDelete,onUpdate:N.onUpdate};N.alias&&(a.alias=N.alias),N.through&&("M2M"===N.type||"M2A"===N.type)&&(a.through=N.through),(null===(e=N.tables)||void 0===e?void 0:e.length)&&(a.tables=N.tables),(null==b?void 0:b.length)>0&&(a.showAs=b),(j?W:X)({resource:"relationships",meta:{collectionName:p},values:a,...j&&{id:j}},{onSuccess:()=>{r.Am.success("Relationship ".concat(j?"updated":"created"," successfully")),M(),x(),g()},onError:e=>{r.Am.error("Error ".concat(j?"updating":"creating"," relationship: ").concat(e.message))}})},ea=e=>["Integer","BigInt","Decimal","Double","Real","Array_Integer","Array_BigInt","Array_Double","Array_Decimal","Range_Integer","Range_BigInt","Range_Double","Range_Decimal"].includes(e),el=e=>["String","Text","CiText"].includes(e),es=()=>{var e,a;let l=w(p),s={...null==l?void 0:null===(e=l.schema)||void 0===e?void 0:e.fields},t={type:N.type,allowNull:N.allowNull};if(N.hidden&&(t.hidden=!0),N.defaultValue&&("$NOW"===N.defaultValue?t.defaultValue={type:"NOW"}:"$UUIDV4"===N.defaultValue?t.defaultValue={type:"UUIDV4"}:"$SUID"===N.defaultValue?t.defaultValue={type:"SUID"}:"$AUTOINCREMENT"===N.defaultValue?t.defaultValue={type:"AUTOINCREMENT"}:"Boolean"===N.type?t.defaultValue="true"===N.defaultValue:"Integer"!==N.type&&"BigInt"!==N.type||isNaN(Number(N.defaultValue))?t.defaultValue=N.defaultValue:t.defaultValue=parseInt(N.defaultValue,10)),"ENUM"===N.type&&(null===(a=N.values)||void 0===a?void 0:a.length)>0&&(t.values=N.values),"VIRTUAL"===N.type&&N.calculated&&(t.calculated=N.calculated),"String"===N.type&&N.stringLength&&(t.values={stringLength:N.stringLength}),"Decimal"===N.type&&(N.precision||N.scale)){let e={};N.precision&&(e.precision=parseInt(N.precision,10)),N.scale&&(e.scale=parseInt(N.scale,10)),t.values=e}if(ea(N.type)){let e={};""!==N.validateMin&&null!==N.validateMin&&void 0!==N.validateMin&&(e.min=parseFloat(N.validateMin)),""!==N.validateMax&&null!==N.validateMax&&void 0!==N.validateMax&&(e.max=parseFloat(N.validateMax)),N.validateIsInt&&(e.isInt=!0),Object.keys(e).length>0&&(t.validate=e)}if(el(N.type)){let e={};N.validateNotEmpty&&(e.notEmpty=!0),N.validateIsEmail&&(e.isEmail=!0),N.validateIsUrl&&(e.isUrl=!0);let a=""!==N.validateMinLength?parseInt(N.validateMinLength,10):null,l=""!==N.validateMaxLength?parseInt(N.validateMaxLength,10):null;(null!==a||null!==l)&&(e.len=[null!=a?a:0,null!=l?l:999999]),N.validatePattern&&(e.is=N.validatePattern),Object.keys(e).length>0&&(t.validate=e)}if(Y){let e={...s[j]};e.hidden&&!N.hidden&&delete e.hidden,e.validate&&!t.validate&&delete e.validate,s[j]={...e,...t}}else s[N.name]=t;W({resource:"collections",id:p,values:{schema:{...null==l?void 0:l.schema,fields:s}}},{onSuccess:()=>{r.Am.success("Field ".concat(Y?"updated":"added"," successfully")),M(),x(),g()},onError:e=>{r.Am.error("Error ".concat(Y?"updating":"adding"," field: ").concat(e.message))}})},et=(e,a)=>{y(l=>({...l,[e]:a}))};return(0,s.jsx)(S.yo,{open:m,onOpenChange:e=>!e&&x(),children:(0,s.jsxs)(S.ue,{className:"!w-full sm:!w-[600px] overflow-y-auto",children:[(0,s.jsx)(S.Tu,{children:(0,s.jsxs)(S.bC,{children:[Y?"Edit":"Create"," ",v?"Relationship":"Field"]})}),(0,s.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!N.name){r.Am.error("Please enter a field name");return}v?ee():es()},className:"mt-6 space-y-5",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"name",children:"Field Name"}),(0,s.jsx)(I.I,{id:"name",placeholder:"Enter field name",value:N.name,onChange:e=>et("name",e.target.value),disabled:Y,required:!0})]}),v?(0,s.jsxs)(s.Fragment,{children:[Y&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Description"}),(0,s.jsx)(I.I,{value:N.description||"",disabled:!0})]}),!Y&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Relationship Type"}),(0,s.jsxs)(_.Ph,{value:N.type,onValueChange:e=>{et("type",e),C([])},children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select relationship type"})}),(0,s.jsx)(_.Bw,{children:Q.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))})]})]}),Y&&N.relType&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Relation Type"}),(0,s.jsxs)(_.Ph,{value:N.relType,disabled:!0,children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"BelongsTo",children:"BelongsTo"}),(0,s.jsx)(_.Ql,{value:"HasOne",children:"HasOne"}),(0,s.jsx)(_.Ql,{value:"HasMany",children:"HasMany"}),(0,s.jsx)(_.Ql,{value:"BelongsToMany",children:"BelongsToMany"})]})]})]}),"M2A"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Target Collection"}),(0,s.jsxs)(_.Ph,{value:N.target,onValueChange:e=>{et("target",e),C([])},disabled:Y,children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select target collection"})}),(0,s.jsx)(_.Bw,{children:q.map(e=>(0,s.jsx)(_.Ql,{value:e.id,children:e.name},e.id))})]})]}),N.target&&"M2A"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(k._,{children:"Display Format"}),(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{children:(0,s.jsx)("p",{children:"Select fields to display for this relationship"})})]})})]}),(0,s.jsxs)(O.J2,{children:[(0,s.jsx)(O.xo,{asChild:!0,children:(0,s.jsx)(c.z,{variant:"outline",role:"combobox",className:"w-full justify-start font-normal h-auto min-h-10",children:b.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:b.map((e,a)=>(0,s.jsxs)(u.C,{variant:"secondary",className:"mr-1",children:[e,(0,s.jsx)("button",{type:"button",className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:e=>{e.stopPropagation(),C(b.filter((e,l)=>l!==a))},children:(0,s.jsx)(V.Z,{className:"h-3 w-3"})})]},"".concat(e,"-").concat(a)))}):(0,s.jsx)("span",{className:"text-muted-foreground",children:"Select fields to display..."})})}),(0,s.jsxs)(O.yk,{className:"w-[300px] p-0",align:"start",children:[(0,s.jsx)("div",{className:"p-2 border-b",children:(0,s.jsx)("div",{className:"text-sm font-medium",children:"Target Fields"})}),(0,s.jsx)("div",{className:"max-h-[200px] overflow-y-auto p-2",children:J.length>0?J.map(e=>(0,s.jsxs)("div",{className:"flex items-center space-x-2 py-1.5 px-2 hover:bg-muted rounded cursor-pointer",onClick:()=>{let a=e.value||e;b.includes(a)||C([...b,a])},children:[(0,s.jsx)(E.X,{checked:b.includes(e.value||e),onCheckedChange:a=>{let l=e.value||e;a?C([...b,l]):C(b.filter(e=>e!==l))}}),(0,s.jsx)("span",{className:"text-sm",children:e.title||e.value||e})]},e.value||e)):(0,s.jsx)("div",{className:"text-sm text-muted-foreground p-2",children:"No fields available"})}),(0,s.jsxs)("div",{className:"p-2 border-t",children:[(0,s.jsx)("div",{className:"text-sm font-medium mb-2",children:"Dividers"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:P.map(e=>(0,s.jsx)(c.z,{type:"button",variant:"outline",size:"sm",onClick:()=>{C([...b,e.value])},children:e.label},e.value))})]})]})]})]}),!Y&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"alias",children:"Target Alias (optional)"}),(0,s.jsx)(I.I,{id:"alias",placeholder:"Enter alias",value:N.alias,onChange:e=>et("alias",e.target.value)})]}),!Y&&("M2M"===N.type||"M2A"===N.type)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(k._,{htmlFor:"through",children:"Junction Table Name"}),(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:"Name for the junction table. PostgreSQL limits table names to 63 characters. Modify if the auto-generated name is too long."})})]})})]}),(0,s.jsx)(I.I,{id:"through",placeholder:"Enter junction table name",value:N.through,onChange:e=>et("through",e.target.value),maxLength:63,className:N.through&&N.through.length>63?"border-red-500":""}),(0,s.jsxs)("p",{className:(0,Z.cn)("text-xs",(null===(a=N.through)||void 0===a?void 0:a.length)>63?"text-red-600":(null===(l=N.through)||void 0===l?void 0:l.length)>50?"text-amber-600":"text-muted-foreground"),children:[(null===(d=N.through)||void 0===d?void 0:d.length)||0,"/63 characters",(null===(o=N.through)||void 0===o?void 0:o.length)>63&&" - Name too long!"]})]}),("M2A"===N.type||N.polymorphic)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Tables (for Many-to-Any)"}),(0,s.jsxs)(O.J2,{children:[(0,s.jsx)(O.xo,{asChild:!0,children:(0,s.jsx)(c.z,{variant:"outline",role:"combobox",className:"w-full justify-start font-normal h-auto min-h-10",children:(null===(h=N.tables)||void 0===h?void 0:h.length)>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:N.tables.map(e=>(0,s.jsxs)(u.C,{variant:"secondary",className:"mr-1",children:[e,(0,s.jsx)("button",{type:"button",className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:a=>{a.stopPropagation(),et("tables",N.tables.filter(a=>a!==e))},children:(0,s.jsx)(V.Z,{className:"h-3 w-3"})})]},e))}):(0,s.jsx)("span",{className:"text-muted-foreground",children:"Select tables..."})})}),(0,s.jsx)(O.yk,{className:"w-[300px] p-0",align:"start",children:(0,s.jsx)("div",{className:"max-h-[200px] overflow-y-auto p-2",children:q.map(e=>{var a;return(0,s.jsxs)("div",{className:"flex items-center space-x-2 py-1.5 px-2 hover:bg-muted rounded cursor-pointer",onClick:()=>{let a=N.tables||[];a.includes(e.id)||et("tables",[...a,e.id])},children:[(0,s.jsx)(E.X,{checked:null===(a=N.tables)||void 0===a?void 0:a.includes(e.id),onCheckedChange:a=>{let l=N.tables||[];a?et("tables",[...l,e.id]):et("tables",l.filter(a=>a!==e.id))}}),(0,s.jsx)("span",{className:"text-sm",children:e.name})]},e.id)})})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(k._,{className:"flex items-center gap-2",children:["On Delete",(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{side:"right",className:"max-w-xs",children:(0,s.jsxs)("p",{children:["Action when a record in ",(0,s.jsx)("strong",{children:N.target||"target"})," is deleted"]})})]})})]}),(0,s.jsxs)(_.Ph,{value:N.onDelete,onValueChange:e=>et("onDelete",e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"CASCADE",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"CASCADE"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Delete ",p," records when ",N.target||"target"," is deleted"]})]})}),(0,s.jsx)(_.Ql,{value:"SET NULL",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"SET NULL"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Set reference to null in ",p," when ",N.target||"target"," is deleted"]})]})}),(0,s.jsx)(_.Ql,{value:"RESTRICT",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"RESTRICT"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Prevent deleting ",N.target||"target"," if ",p," references it"]})]})}),(0,s.jsx)(_.Ql,{value:"NO ACTION",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"NO ACTION"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Similar to RESTRICT, checked at end of transaction"})]})})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(k._,{className:"flex items-center gap-2",children:["On Update",(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{side:"right",className:"max-w-xs",children:(0,s.jsxs)("p",{children:["Action when the primary key of ",(0,s.jsx)("strong",{children:N.target||"target"})," is updated"]})})]})})]}),(0,s.jsxs)(_.Ph,{value:N.onUpdate,onValueChange:e=>et("onUpdate",e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"CASCADE",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"CASCADE"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Update reference in ",p," when ",N.target||"target"," key changes"]})]})}),(0,s.jsx)(_.Ql,{value:"SET NULL",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"SET NULL"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Set reference to null in ",p," when ",N.target||"target"," key changes"]})]})}),(0,s.jsx)(_.Ql,{value:"RESTRICT",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"RESTRICT"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Prevent updating ",N.target||"target"," key if ",p," references it"]})]})}),(0,s.jsx)(_.Ql,{value:"NO ACTION",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"NO ACTION"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Similar to RESTRICT, checked at end of transaction"})]})})]})]})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Field Type"}),(0,s.jsxs)(_.Ph,{value:N.type,onValueChange:e=>et("type",e),disabled:Y,children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select field type"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Text Types"}),F.text.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Numeric Types"}),F.numeric.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Date Types"}),F.date.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Other Types"}),F.other.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Array Types"}),F.array.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Range Types"}),F.range.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(_.DI,{children:[(0,s.jsx)(_.n5,{children:"Geo Types"}),F.geo.map(e=>(0,s.jsx)(_.Ql,{value:e.value,children:e.label},e.value))]})]})]})]}),"VIRTUAL"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"calculated",children:"Calculation String"}),(0,s.jsx)(R.g,{id:"calculated",placeholder:"${this.firstName} ${this.lastName}",value:N.calculated,onChange:e=>et("calculated",e.target.value)}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Use $","{this.fieldName}"," syntax to reference other fields"]})]}):"ENUM"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Enum Values"}),(0,s.jsx)(z.OF,{value:N.values||[],onChange:e=>et("values",e),itemType:"string",placeholder:"Type a value and press Enter"})]}):"String"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"stringLength",children:"Maximum Length"}),(0,s.jsx)(I.I,{id:"stringLength",type:"number",placeholder:"255",value:N.stringLength||"",onChange:e=>et("stringLength",e.target.value)})]}):"Decimal"===N.type?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"precision",children:"Precision (Total Digits)"}),(0,s.jsx)(I.I,{id:"precision",type:"number",placeholder:"e.g., 10",value:N.precision||"",onChange:e=>et("precision",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total number of digits (before and after decimal point)"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"scale",children:"Scale (Decimal Places)"}),(0,s.jsx)(I.I,{id:"scale",type:"number",placeholder:"e.g., 2",value:N.scale||"",onChange:e=>et("scale",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Number of digits after the decimal point"})]})]}):null,(0,s.jsxs)(s.Fragment,{children:[(()=>{if(!ea(N.type))return null;let e=["Integer","BigInt","Array_Integer","Array_BigInt","Range_Integer","Range_BigInt"].includes(N.type),a=N.type.startsWith("Range_"),l=N.type.startsWith("Array_");return(0,s.jsxs)("div",{className:"space-y-4 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(k._,{className:"text-sm font-medium",children:"Validation Rules"}),(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:a?"Min/max values apply to both lower and upper bounds of the range.":l?"Min/max values apply to each element in the array.":"Set minimum and maximum allowed values for this field."})})]})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"validateMin",children:"Minimum Value"}),(0,s.jsx)(I.I,{id:"validateMin",type:"number",step:e?"1":"any",placeholder:"No minimum",value:N.validateMin,onChange:e=>et("validateMin",e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"validateMax",children:"Maximum Value"}),(0,s.jsx)(I.I,{id:"validateMax",type:"number",step:e?"1":"any",placeholder:"No maximum",value:N.validateMax,onChange:e=>et("validateMax",e.target.value)})]})]}),!e&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(E.X,{id:"validateIsInt",checked:N.validateIsInt,onCheckedChange:e=>et("validateIsInt",!0===e)}),(0,s.jsx)(k._,{htmlFor:"validateIsInt",className:"text-sm font-normal cursor-pointer",children:"Require integer values (no decimals)"})]})]})})(),el(N.type)?(0,s.jsxs)("div",{className:"space-y-4 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(k._,{className:"text-sm font-medium",children:"Validation Rules"}),(0,s.jsx)(L.pn,{children:(0,s.jsxs)(L.u,{children:[(0,s.jsx)(L.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(L._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:"Configure validation rules for string content and format."})})]})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{className:"text-sm text-muted-foreground",children:"Format Validation"}),(0,s.jsxs)(_.Ph,{value:N.validateIsEmail?"email":N.validateIsUrl?"url":N.validateNotEmpty?"notEmpty":"none",onValueChange:e=>{et("validateNotEmpty","notEmpty"===e),et("validateIsEmail","email"===e),et("validateIsUrl","url"===e)},children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"No format validation"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"none",children:"No format validation"}),(0,s.jsx)(_.Ql,{value:"notEmpty",children:"Required (cannot be empty)"}),(0,s.jsx)(_.Ql,{value:"email",children:"Must be valid email format"}),(0,s.jsx)(_.Ql,{value:"url",children:"Must be valid URL format"})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"validateMinLength",children:"Min Length"}),(0,s.jsx)(I.I,{id:"validateMinLength",type:"number",min:"0",placeholder:"No minimum",value:N.validateMinLength,onChange:e=>et("validateMinLength",e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"validateMaxLength",children:"Max Length"}),(0,s.jsx)(I.I,{id:"validateMaxLength",type:"number",min:"0",placeholder:"No maximum",value:N.validateMaxLength,onChange:e=>et("validateMaxLength",e.target.value)})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"validatePattern",children:"Regex Pattern"}),(0,s.jsx)(I.I,{id:"validatePattern",placeholder:"e.g., ^[A-Z]{2}\\\\d{4}$",value:N.validatePattern,onChange:e=>et("validatePattern",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Regular expression pattern the value must match"})]})]}):null]}),"VIRTUAL"!==N.type&&(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Nullable"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Allow null values for this field"})]}),(0,s.jsx)(A.r,{checked:N.allowNull,onCheckedChange:e=>et("allowNull",e)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Hidden"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Never return this field in API responses (for sensitive data like passwords)"})]}),(0,s.jsx)(A.r,{checked:N.hidden,onCheckedChange:e=>et("hidden",e)})]}),"VIRTUAL"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"defaultValue",children:"Default Value"}),B(N.type)?(0,s.jsxs)(_.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>et("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(_.Ql,{value:"$NOW",children:"Current Date/Time"})]})]}):"UUID"===N.type?(0,s.jsxs)(_.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>et("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(_.Ql,{value:"$UUIDV4",children:"Auto-generate UUID"})]})]}):"SUID"===N.type?(0,s.jsxs)(_.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>et("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(_.Ql,{value:"$SUID",children:"Auto-generate Short UID"})]})]}):"Boolean"===N.type?(0,s.jsxs)(_.Ph,{value:""===N.defaultValue?"_none_":N.defaultValue,onValueChange:e=>et("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(_.Ql,{value:"true",children:"True"}),(0,s.jsx)(_.Ql,{value:"false",children:"False"})]})]}):"Integer"===N.type||"BigInt"===N.type?(0,s.jsxs)(_.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>et("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(_.i4,{children:(0,s.jsx)(_.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(_.Bw,{children:[(0,s.jsx)(_.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(_.Ql,{value:"$AUTOINCREMENT",children:"Auto-increment"}),(0,s.jsx)(_.Ql,{value:"$CUSTOM",children:"Custom value..."})]})]}):(0,s.jsx)(I.I,{id:"defaultValue",placeholder:"Enter default value",value:N.defaultValue,onChange:e=>et("defaultValue",e.target.value)}),("Integer"===N.type||"BigInt"===N.type)&&"$CUSTOM"===N.defaultValue&&(0,s.jsx)(I.I,{id:"defaultValueCustom",type:"number",placeholder:"Enter numeric default value",className:"mt-2",onChange:e=>{e.target.value&&et("defaultValue",e.target.value)}})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4",children:[(0,s.jsx)(c.z,{type:"button",variant:"outline",onClick:x,children:"Cancel"}),(0,s.jsxs)(c.z,{type:"submit",disabled:G,children:[G&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),Y?"Update":"Create"," ",v?"Relationship":"Field"]})]})]})]})})},q=e=>{var a,l;let{open:d,onClose:o,collectionName:x,onSuccess:j}=e,[v,g]=(0,t.useState)(!1),[N,y]=(0,t.useState)(null),[b,C]=(0,t.useState)(!1),[I,k]=(0,t.useState)([]),[A,_]=(0,t.useState)(!1),[T,R]=(0,t.useState)(null),{getSchemaByName:E,isLoading:U,refetch:V}=(0,i.I_)(),L=(0,t.useMemo)(()=>d&&x?{data:E(x)}:null,[d,x,E]),{mutate:O,isLoading:Z}=(0,n.PQ)(),{mutate:z,isLoading:P}=(0,n.R2)();(0,t.useEffect)(()=>{var e,a;(null==L?void 0:null===(a=L.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)&&k(Object.entries(L.data.schema.fields).map(e=>{let[a,l]=e;return{name:a,...l}}))},[L]);let F=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y(null),C(e),g(!0)},Q=e=>{let a=I.find(a=>a.name===e);y(e),C(!!(null==a?void 0:a.relType)),g(!0)},B=e=>{R(e),_(!0)},q=e=>e.relType?(0,s.jsxs)(u.C,{variant:"outline",className:"gap-1",children:[(0,s.jsx)(D,{className:"h-3 w-3"}),e.relType]}):(0,s.jsx)(u.C,{variant:"secondary",children:e.type});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(S.yo,{open:d,onOpenChange:e=>!e&&o(),children:(0,s.jsx)(S.ue,{className:"!w-full sm:!w-[800px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(S.Tu,{children:(0,s.jsxs)(S.bC,{className:"truncate max-w-[250px] sm:max-w-full",children:["Manage Fields - ",null==L?void 0:null===(l=L.data)||void 0===l?void 0:null===(a=l.schema)||void 0===a?void 0:a.name]})}),(0,s.jsxs)("div",{className:"mt-6 space-y-4 flex-1 flex flex-col min-h-0",children:[(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsxs)(c.z,{onClick:()=>F(!1),size:"sm",children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Add Field"]}),(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>F(!0),children:[(0,s.jsx)(D,{className:"mr-2 h-4 w-4"}),"Add Relationship"]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{className:"min-w-[500px]",children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.xD,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Name"}),(0,s.jsx)(h.ss,{children:"Type"}),(0,s.jsx)(h.ss,{children:"Nullable"}),(0,s.jsx)(h.ss,{className:"w-28",children:"Actions"})]})}),(0,s.jsx)(h.RM,{children:U?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center",children:(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mx-auto"})})}):0===I.length?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center text-muted-foreground",children:"No fields defined"})}):I.map(e=>(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium",children:e.name}),e.primaryKey&&(0,s.jsx)(u.C,{variant:"default",className:"text-xs",children:"PK"}),e.SystemGenerated&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"System"})]})}),(0,s.jsx)(h.pj,{children:q(e)}),(0,s.jsx)(h.pj,{children:e.allowNull?(0,s.jsx)(u.C,{variant:"outline",children:"Yes"}):(0,s.jsx)(u.C,{variant:"secondary",children:"No"})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Q(e.name),children:(0,s.jsx)(M.Z,{className:"h-4 w-4"})}),!e.SystemGenerated&&!e.primaryKey&&(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>B(e),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]})})]},e.name))})]})})})]})]})})}),(0,s.jsx)($,{open:v,onClose:()=>g(!1),collectionName:x,fieldName:N,isRelationship:b,onSuccess:()=>{g(!1),V(),j()}}),(0,s.jsx)(m.aR,{open:A,onOpenChange:_,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Field"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the field "',null==T?void 0:T.name,'"? This action cannot be undone.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{var e;if(!T)return;let a=E(x);if(!(null==a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)||0===Object.keys(a.schema.fields).length){r.Am.error("Unable to get current schema data");return}if(T.relType)z({resource:"relationships",meta:{collectionName:x},id:T.name},{onSuccess:()=>{r.Am.success("Field deleted successfully"),V(),_(!1),R(null)},onError:e=>{r.Am.error("Error deleting field: ".concat(e.message))}});else{let e={...a.schema.fields};delete e[T.name],O({resource:"collections",id:x,values:{schema:{...a.schema,fields:e}}},{onSuccess:()=>{r.Am.success("Field deleted successfully"),V(),j(),_(!1),R(null)},onError:e=>{r.Am.error("Error deleting field: ".concat(e.message))}})}},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P||Z?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var J=l(74291);let W=e=>{var a,l;let{open:d,onClose:o,collectionName:x}=e,[j,v]=(0,t.useState)(!1),[g,N]=(0,t.useState)(""),[y,C]=(0,t.useState)([]),[A,_]=(0,t.useState)(!1),[T,D]=(0,t.useState)(!1),[M,R]=(0,t.useState)(!1),[U,V]=(0,t.useState)(null),[L,O]=(0,t.useState)([]),{getSchemaByName:Z,isLoading:z,refetch:P}=(0,i.I_)(),F=(0,t.useMemo)(()=>d&&x?{data:Z(x)}:null,[d,x,Z]),Q=(0,t.useMemo)(()=>{var e,a;return(null==F?void 0:null===(a=F.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)?Object.keys(F.data.schema.fields):[]},[F]);(0,t.useEffect)(()=>{var e,a;(null==F?void 0:null===(a=F.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.indexes)?O(F.data.schema.indexes):O([])},[F]);let{mutate:B,isLoading:$}=(0,n.RO)(),{mutate:q,isLoading:W}=(0,n.R2)(),K=()=>{N(""),C([]),_(!1),D(!1)},X=()=>{P()},H=e=>{V(e),R(!0)},Y=e=>{y.includes(e)?C(y.filter(a=>a!==e)):C([...y,e])};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(S.yo,{open:d,onOpenChange:e=>!e&&o(),children:(0,s.jsx)(S.ue,{className:"!w-full sm:!w-[700px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(S.Tu,{children:(0,s.jsxs)(S.bC,{className:"truncate max-w-[250px] sm:max-w-full",children:["Manage Indexes - ",null==F?void 0:null===(l=F.data)||void 0===l?void 0:null===(a=l.schema)||void 0===a?void 0:a.name]})}),(0,s.jsxs)("div",{className:"mt-6 space-y-4 flex-1 flex flex-col min-h-0",children:[(0,s.jsxs)(c.z,{onClick:()=>v(!0),size:"sm",children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Add Index"]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{className:"min-w-[450px]",children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.xD,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Name"}),(0,s.jsx)(h.ss,{children:"Fields"}),(0,s.jsx)(h.ss,{children:"Type"}),(0,s.jsx)(h.ss,{className:"w-20",children:"Actions"})]})}),(0,s.jsx)(h.RM,{children:z?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center",children:(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mx-auto"})})}):0===L.length?(0,s.jsx)(h.SC,{children:(0,s.jsxs)(h.pj,{colSpan:4,className:"h-32 text-center text-muted-foreground",children:[(0,s.jsx)(b.Z,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,s.jsx)("p",{children:"No indexes defined"})]})}):L.map(e=>(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{className:"font-medium",children:e.name||e.id}),(0,s.jsx)(h.pj,{children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:(e.fields||[]).map(e=>(0,s.jsx)(u.C,{variant:"secondary",children:e},e))})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[e.unique?(0,s.jsx)(u.C,{variant:"default",children:"Unique"}):(0,s.jsx)(u.C,{variant:"outline",children:"Standard"}),e.nullsNotDistinct&&(0,s.jsx)(u.C,{variant:"secondary",className:"text-xs",children:"NULLS NOT DISTINCT"})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>H(e.name||e.id),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})})]},e.name||e.id))})]})})})]})]})})}),(0,s.jsx)(J.Vq,{open:j,onOpenChange:v,children:(0,s.jsxs)(J.cZ,{children:[(0,s.jsx)(J.fK,{children:(0,s.jsx)(J.$N,{children:"Create Index"})}),(0,s.jsxs)("div",{className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{htmlFor:"indexName",children:"Index Name"}),(0,s.jsx)(I.I,{id:"indexName",placeholder:"Enter index name",value:g,onChange:e=>N(e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(k._,{children:"Select Fields"}),(0,s.jsx)("div",{className:"border rounded-md p-3 space-y-2 max-h-48 overflow-y-auto",children:Q.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(E.X,{id:e,checked:y.includes(e),onCheckedChange:()=>Y(e)}),(0,s.jsx)(k._,{htmlFor:e,className:"cursor-pointer",children:e})]},e))})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(E.X,{id:"unique",checked:A,onCheckedChange:e=>{_(e),e||D(!1)}}),(0,s.jsx)(k._,{htmlFor:"unique",className:"cursor-pointer",children:"Unique Index"})]}),A&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(E.X,{id:"nullsNotDistinct",checked:T,onCheckedChange:e=>D(e)}),(0,s.jsxs)(k._,{htmlFor:"nullsNotDistinct",className:"cursor-pointer flex items-center gap-1",children:["Nulls Not Distinct",(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"(treat NULLs as equal)"})]})]})]}),(0,s.jsxs)(J.cN,{children:[(0,s.jsx)(c.z,{variant:"outline",onClick:()=>{K(),v(!1)},children:"Cancel"}),(0,s.jsxs)(c.z,{onClick:()=>{if(!g.trim()){r.Am.error("Please enter an index name");return}if(0===y.length){r.Am.error("Please select at least one field");return}B({resource:"indexes",meta:{collectionName:x},values:{name:g,fields:y,unique:A,...A&&T?{nullsNotDistinct:!0}:{}}},{onSuccess:()=>{r.Am.success("Index created successfully"),K(),v(!1),X()},onError:e=>{r.Am.error("Error creating index: ".concat(e.message))}})},disabled:$,children:[$&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Index"]})]})]})}),(0,s.jsx)(m.aR,{open:M,onOpenChange:R,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Index"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the index "',U,'"? This action cannot be undone.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{U&&q({resource:"indexes",meta:{collectionName:x},id:U},{onSuccess:()=>{r.Am.success("Index deleted successfully"),R(!1),V(null),X()},onError:e=>{r.Am.error("Error deleting index: ".concat(e.message))}})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[W?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var K=l(95937),X=l(90641),H=l(962);let Y=H.fC,G=H.wy,ee=H.Fw;var ea=l(40875),el=l(10407);let es=(0,N.Z)("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);var et=l(41671);let en=e=>{if(!e)return"disabled";if(!0===e)return"enabled (all actions)";if("object"==typeof e){if(!e.enabled)return"disabled";let a=e.actions||["insert","update","delete"];return"enabled (".concat(a.join(", "),")")}return"disabled"},ei=e=>{let{open:a,onClose:l}=e,[d,o]=(0,t.useState)(null),[h,m]=(0,t.useState)(null),[x,v]=(0,t.useState)(["new","modified","deleted"]),g=(0,t.useRef)(null),N=(0,n.Ji)(),{refetch:y}=(0,i.I_)(),{mutate:b,isLoading:C}=(0,n.uC)(),{mutate:I,isLoading:k}=(0,n.uC)(),A=()=>{o(null),m(null),g.current&&(g.current.value="")},_=async e=>{var a;let l=null===(a=e.target.files)||void 0===a?void 0:a[0];if(!l)return;o(l),m(null);let s=new FormData;s.append("schema",l),b({url:"".concat(N,"/schemas-preview-import"),method:"post",values:s},{onSuccess:e=>{m(null==e?void 0:e.data)},onError:e=>{r.Am.error("Preview failed: ".concat(e.message||"Unknown error")),m(null)}})},T=async()=>{if(!d)return;let e=new FormData;e.append("schema",d),I({url:"".concat(N,"/schemas-import"),method:"post",values:e},{onSuccess:()=>{r.Am.success("Schemas imported successfully"),y(),A(),l()},onError:e=>{r.Am.error("Import failed: ".concat(e.message||"Unknown error"))}})},D=e=>{v(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},R=function(e,a,l,t){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"default";if(!e||0===e.length)return null;let i=x.includes(t);return(0,s.jsxs)(Y,{open:i,onOpenChange:()=>D(t),children:[(0,s.jsxs)(G,{className:"flex items-center justify-between w-full p-3 bg-muted/50 rounded-lg hover:bg-muted transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a,(0,s.jsx)("span",{className:"font-medium",children:l}),(0,s.jsx)(u.C,{variant:n,children:e.length})]}),i?(0,s.jsx)(ea.Z,{className:"h-4 w-4"}):(0,s.jsx)(el.Z,{className:"h-4 w-4"})]}),(0,s.jsx)(ee,{children:(0,s.jsx)("div",{className:"mt-2 space-y-2 pl-4",children:e.map((e,l)=>(0,s.jsxs)("div",{className:"p-2 rounded border bg-background",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a,(0,s.jsx)("span",{children:"string"==typeof e?e:e.collectionName}),e.differences&&Object.keys(e.differences).length>0&&(0,s.jsxs)(u.C,{variant:"outline",className:"ml-auto",children:[Object.keys(e.differences).length," change(s)"]})]}),e.differences&&Object.keys(e.differences).length>0&&(0,s.jsx)("div",{className:"mt-2 pl-6 text-xs space-y-1",children:Object.entries(e.differences).map(e=>{let[a,l]=e;return(0,s.jsx)("div",{className:"flex items-start gap-2 text-muted-foreground",children:"realtime"===a?(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(es,{className:"h-3 w-3"}),(0,s.jsx)("span",{className:"font-medium",children:"Realtime:"}),(0,s.jsx)("span",{className:"text-red-500 line-through",children:en(l.from)}),(0,s.jsx)("span",{children:"→"}),(0,s.jsx)("span",{className:"text-green-500",children:en(l.to)})]}):(0,s.jsxs)("span",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[a,":"]})," ","added"===l.type&&(0,s.jsx)("span",{className:"text-green-500",children:"added"}),"removed"===l.type&&(0,s.jsx)("span",{className:"text-red-500",children:"removed"}),"modified"===l.type&&(0,s.jsx)("span",{className:"text-yellow-500",children:"modified"})]})},a)})})]},l))})})]})},E=h&&(h.changes.new.length>0||h.changes.modified.length>0||h.changes.deleted.length>0);return(0,s.jsx)(S.yo,{open:a,onOpenChange:e=>{e||(A(),l())},children:(0,s.jsxs)(S.ue,{className:"w-[600px] sm:w-[700px] sm:max-w-[700px] flex flex-col",children:[(0,s.jsx)(S.Tu,{children:(0,s.jsx)(S.bC,{children:"Import Schema"})}),(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col mt-6",children:[(0,s.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-primary transition-colors flex-shrink-0",onClick:()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.click()},children:[(0,s.jsx)(j.Z,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),d?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:d.name}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Click to select a different file"})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"Click or drag schema file to upload"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Support for single JSON file upload only"})]}),(0,s.jsx)("input",{ref:g,type:"file",accept:".json",className:"hidden",onChange:_})]}),C&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mr-2"}),(0,s.jsx)("span",{children:"Analyzing schema changes..."})]}),h&&(0,s.jsx)(X.x,{className:"flex-1 mt-4",children:(0,s.jsxs)("div",{className:"space-y-4 pr-4",children:[(0,s.jsxs)(K.bZ,{children:[(0,s.jsx)(U.Z,{className:"h-4 w-4"}),(0,s.jsx)(K.Cd,{children:"Schema Analysis Complete"}),(0,s.jsxs)(K.X,{children:["Import version: ",h.importVersion," (",h.importTimestamp,")"]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[R(h.changes.new,(0,s.jsx)(p.Z,{className:"h-4 w-4 text-green-500"}),"New Schemas","new","default"),R(h.changes.modified,(0,s.jsx)(M.Z,{className:"h-4 w-4 text-yellow-500"}),"Modified Schemas","modified","secondary"),R(h.changes.deleted,(0,s.jsx)(w.Z,{className:"h-4 w-4 text-red-500"}),"Deleted Schemas","deleted","destructive"),R(h.changes.unchanged,(0,s.jsx)(et.Z,{className:"h-4 w-4 text-green-500"}),"Unchanged Schemas","unchanged","outline")]}),!E&&(0,s.jsxs)(K.bZ,{children:[(0,s.jsx)(et.Z,{className:"h-4 w-4"}),(0,s.jsx)(K.X,{children:"No changes detected. All schemas are already up to date."})]})]})})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t mt-4 flex-shrink-0",children:[(0,s.jsx)(c.z,{variant:"outline",onClick:()=>{A(),l()},children:"Cancel"}),h&&(0,s.jsxs)(c.z,{onClick:T,disabled:k,children:[k&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirm Import"]})]})]})})};var er=l(31593);let ed=e=>{let{open:a,onClose:l,onSuccess:d,schema:o,collectionName:u}=e,[h,m]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!1),[j,v]=(0,t.useState)(!1),[g,N]=(0,t.useState)(!1),[y,b]=(0,t.useState)(!1),[w,I]=(0,t.useState)(["insert","update","delete"]),{getSchemaByName:_,refetch:T}=(0,i.I_)(),{mutate:D,isLoading:M}=(0,n.PQ)(),R=a?_(u):null,U=(null==R?void 0:R.schema)||o;(0,t.useEffect)(()=>{if(a&&U){let e=!0===U.timestamps,a=!0===U.usertrack,l=!0===U.paranoid,s=!0===U.sortEnabled,t=!1,n=["insert","update","delete"];!0===U.realtime?t=!0:"object"==typeof U.realtime&&null!==U.realtime&&(t=!0===U.realtime.enabled,n=U.realtime.actions||["insert","update","delete"]),console.log("Schema settings loaded:",{collectionName:u,timestamps:U.timestamps,usertrack:U.usertrack,paranoid:U.paranoid,sortEnabled:U.sortEnabled,realtime:U.realtime,parsed:{ts:e,ut:a,pn:l,se:s,rtEnabled:t,rtActions:n}}),m(e),p(a),v(l),N(s),b(t),I(n)}},[a,u,U]);let V=(e,a)=>{a?I(a=>[...a,e]):I(a=>a.filter(a=>a!==e))};return(0,s.jsx)(S.yo,{open:a,onOpenChange:e=>!e&&l(),children:(0,s.jsx)(S.ue,{className:"!w-full sm:!w-[500px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(S.Tu,{className:"flex-shrink-0",children:(0,s.jsxs)(S.bC,{className:"flex items-center gap-2",children:[(0,s.jsx)(C.Z,{className:"h-5 w-5 flex-shrink-0"}),"Schema Settings"]})}),(0,s.jsx)(X.x,{className:"flex-1 mt-6",children:(0,s.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,s.jsxs)("div",{className:"p-4 rounded-lg bg-muted",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate max-w-[250px] sm:max-w-[400px]",title:null==U?void 0:U.name,children:null==U?void 0:U.name}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground truncate max-w-[250px] sm:max-w-[400px]",title:u,children:["Collection: ",u]})]}),(0,s.jsx)(er.Z,{}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Timestamps"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add createdAt and updatedAt fields automatically"})]}),(0,s.jsx)(A.r,{checked:h,onCheckedChange:m})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"User Tracking"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Track who created and modified records"})]}),(0,s.jsx)(A.r,{checked:x,onCheckedChange:p})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Sorting"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enable sorting capabilities for this collection"})]}),(0,s.jsx)(A.r,{checked:g,onCheckedChange:N})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(k._,{children:"Soft Delete"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Mark records as deleted instead of removing them"}),(null==U?void 0:U.paranoid)&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:"⚠️ Cannot be disabled once enabled"})]}),(0,s.jsx)(A.r,{checked:j,onCheckedChange:v,disabled:null==U?void 0:U.paranoid})]}),(0,s.jsx)(er.Z,{}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsxs)(k._,{className:"flex items-center gap-2",children:[(0,s.jsx)(es,{className:"h-4 w-4"}),"Realtime"]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Broadcast changes via WebSocket using PostgreSQL WAL"})]}),(0,s.jsx)(A.r,{checked:y,onCheckedChange:b})]}),y&&(0,s.jsxs)("div",{className:"pl-4 space-y-3 border-l-2 border-muted",children:[(0,s.jsx)(k._,{className:"text-xs text-muted-foreground",children:"Broadcast on:"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(E.X,{id:"rt-insert",checked:w.includes("insert"),onCheckedChange:e=>V("insert",e)}),(0,s.jsx)("label",{htmlFor:"rt-insert",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Insert"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(E.X,{id:"rt-update",checked:w.includes("update"),onCheckedChange:e=>V("update",e)}),(0,s.jsx)("label",{htmlFor:"rt-update",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Update"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(E.X,{id:"rt-delete",checked:w.includes("delete"),onCheckedChange:e=>V("delete",e)}),(0,s.jsx)("label",{htmlFor:"rt-delete",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Delete"})]})]}),0===w.length&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:"⚠️ Select at least one action to broadcast"})]})]})]})]})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t mt-4 flex-shrink-0",children:[(0,s.jsx)(c.z,{variant:"outline",onClick:l,children:"Cancel"}),(0,s.jsxs)(c.z,{onClick:()=>{let e=_(u),a=y?{enabled:!0,actions:w}:{enabled:!1,actions:[]};D({resource:"collections",id:u,values:{schema:{...null==e?void 0:e.schema,timestamps:h,usertrack:x,paranoid:j,sortEnabled:g,realtime:a}}},{onSuccess:()=>{r.Am.success("Schema settings updated successfully"),T(),d(),l()},onError:e=>{r.Am.error("Error updating settings: ".concat(e.message))}})},disabled:M,children:[M&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Changes"]})]})]})})})},ec=()=>{let[e,a]=(0,t.useState)(!1),[l,N]=(0,t.useState)(!1),[S,I]=(0,t.useState)(!1),[k,A]=(0,t.useState)(!1),[_,D]=(0,t.useState)(!1),[M,R]=(0,t.useState)(null),[E,U]=(0,t.useState)(null),[V,L]=(0,t.useState)(""),[O,Z]=(0,t.useState)(!1),[z,P]=(0,t.useState)(null),F=(0,n.Ji)(),{schemas:Q,isLoading:B,refetch:$}=(0,i.I_)(),{mutate:J,isLoading:K}=(0,n.R2)(),X=(0,t.useMemo)(()=>Q&&V.trim()?Q.filter(e=>{var a,l,s;let t=(null==e?void 0:null===(l=e.schema)||void 0===l?void 0:null===(a=l.name)||void 0===a?void 0:a.toLowerCase())||"",n=(null==e?void 0:null===(s=e.collectionName)||void 0===s?void 0:s.toLowerCase())||"",i=V.toLowerCase();return t.includes(i)||n.includes(i)}):Q||[],[Q,V]),H=e=>{R(e),N(!0)},Y=e=>{R(e),I(!0)},G=e=>{R(e.collectionName),U(e.schema),D(!0)},ee=e=>{P(e),Z(!0)},{refetch:ea}=(0,n.EV)({url:"".concat(F,"/schemas-export"),method:"get",queryOptions:{enabled:!1,retry:!1}}),el=async()=>{try{var e;let a=await ea(),l=null==a?void 0:a.data;if(!(null==l?void 0:l.data)){r.Am.error("No schemas found to export");return}let s=window.URL.createObjectURL(new Blob([JSON.stringify(l.data)])),t=document.createElement("a");t.href=s,t.setAttribute("download","schema-export-".concat((null===(e=l.data)||void 0===e?void 0:e.timestamp)||Date.now(),".json")),document.body.appendChild(t),t.click(),t.remove(),r.Am.success("Schemas exported successfully")}catch(e){r.Am.error("Error exporting schemas: ".concat(e.message))}},es=e=>Object.keys((null==e?void 0:e.fields)||{}).length;return(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 flex-shrink-0",children:[(0,s.jsx)("h1",{className:"text-lg font-semibold",children:"Collections Management"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(o.t,{value:V,onChange:L,placeholder:"Search collections...",expandedWidth:"w-64"}),(0,s.jsx)(c.z,{variant:"outline",size:"icon",onClick:()=>$(),children:(0,s.jsx)(x.Z,{className:"h-4 w-4"})}),(0,s.jsxs)(c.z,{onClick:()=>a(!0),children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Create Schema"]}),(0,s.jsxs)(c.z,{variant:"outline",onClick:()=>A(!0),children:[(0,s.jsx)(j.Z,{className:"mr-2 h-4 w-4"}),"Import"]}),(0,s.jsxs)(c.z,{variant:"outline",onClick:el,children:[(0,s.jsx)(v.Z,{className:"mr-2 h-4 w-4"}),"Export"]})]})]}),(0,s.jsx)(d.Zb,{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-max",children:[(0,s.jsx)("thead",{className:"sticky top-0 z-10 bg-background border-b",children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Schema Name"}),(0,s.jsx)(h.ss,{children:"Fields"}),(0,s.jsx)(h.ss,{children:"Options"}),(0,s.jsx)(h.ss,{className:"w-64",children:"Actions"})]})}),(0,s.jsx)("tbody",{children:B?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-48 text-center",children:(0,s.jsx)(f.Z,{className:"h-8 w-8 animate-spin mx-auto"})})}):0===X.length?(0,s.jsx)(h.SC,{children:(0,s.jsxs)(h.pj,{colSpan:4,className:"h-48 text-center text-muted-foreground",children:[(0,s.jsx)(g.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,s.jsx)("p",{children:"No collections found"}),(0,s.jsxs)(c.z,{variant:"outline",className:"mt-4",onClick:()=>a(!0),children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Create your first collection"]})]})}):X.map(e=>{var a,l,t,n,i;return(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(g.Z,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"font-medium",children:null===(a=e.schema)||void 0===a?void 0:a.name}),(null===(l=e.schema)||void 0===l?void 0:l.name)!==e.collectionName&&(0,s.jsx)("code",{className:"text-xs text-muted-foreground bg-muted px-1 py-0.5 rounded w-fit",children:e.collectionName})]})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)(u.C,{variant:"secondary",children:[es(e.schema)," fields"]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(null===(t=e.schema)||void 0===t?void 0:t.timestamps)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Timestamps"}),(null===(n=e.schema)||void 0===n?void 0:n.paranoid)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Soft Delete"}),(null===(i=e.schema)||void 0===i?void 0:i.usertrack)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Audit"})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>H(e.collectionName),children:[(0,s.jsx)(y,{className:"mr-1 h-3 w-3"}),"Fields"]}),(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>Y(e.collectionName),children:[(0,s.jsx)(b.Z,{className:"mr-1 h-3 w-3"}),"Indexes"]}),(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(e),children:(0,s.jsx)(C.Z,{className:"h-4 w-4"})}),!e.collectionName.includes("baasix_")&&(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>ee(e.collectionName),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]})})]},e.collectionName)})})]})})}),(0,s.jsx)(T,{open:e,onClose:()=>a(!1),onSuccess:()=>{a(!1),$()}}),M&&(0,s.jsx)(q,{open:l,onClose:()=>N(!1),collectionName:M,onSuccess:()=>$()}),M&&(0,s.jsx)(W,{open:S,onClose:()=>I(!1),collectionName:M}),(0,s.jsx)(ei,{open:k,onClose:()=>{A(!1),$()}}),M&&E&&(0,s.jsx)(ed,{open:_,onClose:()=>D(!1),onSuccess:()=>$(),schema:E,collectionName:M}),(0,s.jsx)(m.aR,{open:O,onOpenChange:Z,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Schema"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the schema "',z,'"? This action cannot be undone and will remove all data in this collection.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{z&&J({resource:"collections",id:z},{onSuccess:()=>{r.Am.success("Schema deleted successfully"),Z(!1),P(null),$()},onError:e=>{r.Am.error("Error deleting schema: ".concat(e.message))}})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[K?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var eo=()=>(0,s.jsx)(ec,{})},30767:function(e,a,l){"use strict";l.d(a,{OL:function(){return v},_T:function(){return h},aR:function(){return d},f$:function(){return p},fY:function(){return m},le:function(){return f},vW:function(){return c},xo:function(){return x},yT:function(){return j}});var s=l(57437),t=l(2265),n=l(16720),i=l(93448),r=l(12381);let d=n.fC,c=n.xz,o=n.h_,u=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.aV,{className:(0,i.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...t,ref:a})});u.displayName="AlertDialogOverlay";let h=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsxs)(o,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(n.VY,{ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",l),...t})]})});h.displayName="AlertDialogContent";let m=e=>{let{className:a,...l}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...l})};m.displayName="AlertDialogHeader";let x=e=>{let{className:a,...l}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l})};x.displayName="AlertDialogFooter";let p=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.Dx,{ref:a,className:(0,i.cn)("text-lg font-semibold",l),...t})});p.displayName="AlertDialogTitle";let j=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.dk,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",l),...t})});j.displayName="AlertDialogDescription";let v=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.aU,{ref:a,className:(0,i.cn)((0,r.d)(),l),...t})});v.displayName="AlertDialogAction";let f=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.$j,{ref:a,className:(0,i.cn)((0,r.d)({variant:"outline"}),"mt-2 sm:mt-0",l),...t})});f.displayName="AlertDialogCancel"},31593:function(e,a,l){"use strict";l.d(a,{Z:function(){return r}});var s=l(57437),t=l(2265),n=l(90759),i=l(93448);let r=t.forwardRef((e,a)=>{let{className:l,orientation:t="horizontal",decorative:r=!0,...d}=e;return(0,s.jsx)(n.f,{ref:a,decorative:r,orientation:t,className:(0,i.cn)("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",l),...d})});r.displayName=n.f.displayName},962:function(e,a,l){"use strict";l.d(a,{Fw:function(){return b},VY:function(){return k},fC:function(){return S},p_:function(){return p},wy:function(){return N},xz:function(){return I}});var s=l(2265),t=l(6741),n=l(73966),i=l(80886),r=l(61188),d=l(98575),c=l(82912),o=l(71599),u=l(99255),h=l(57437),m="Collapsible",[x,p]=(0,n.b)(m),[j,v]=x(m),f=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,open:t,defaultOpen:n,disabled:r,onOpenChange:d,...o}=e,[x,p]=(0,i.T)({prop:t,defaultProp:null!=n&&n,onChange:d,caller:m});return(0,h.jsx)(j,{scope:l,disabled:r,contentId:(0,u.M)(),open:x,onOpenToggle:s.useCallback(()=>p(e=>!e),[p]),children:(0,h.jsx)(c.WV.div,{"data-state":w(x),"data-disabled":r?"":void 0,...o,ref:a})})});f.displayName=m;var g="CollapsibleTrigger",N=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,...s}=e,n=v(g,l);return(0,h.jsx)(c.WV.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":w(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...s,ref:a,onClick:(0,t.Mj)(e.onClick,n.onOpenToggle)})});N.displayName=g;var y="CollapsibleContent",b=s.forwardRef((e,a)=>{let{forceMount:l,...s}=e,t=v(y,e.__scopeCollapsible);return(0,h.jsx)(o.z,{present:l||t.open,children:e=>{let{present:l}=e;return(0,h.jsx)(C,{...s,ref:a,present:l})}})});b.displayName=y;var C=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,present:t,children:n,...i}=e,o=v(y,l),[u,m]=s.useState(t),x=s.useRef(null),p=(0,d.e)(a,x),j=s.useRef(0),f=j.current,g=s.useRef(0),N=g.current,b=o.open||u,C=s.useRef(b),S=s.useRef(void 0);return s.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,r.b)(()=>{let e=x.current;if(e){S.current=S.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let a=e.getBoundingClientRect();j.current=a.height,g.current=a.width,C.current||(e.style.transitionDuration=S.current.transitionDuration,e.style.animationName=S.current.animationName),m(t)}},[o.open,t]),(0,h.jsx)(c.WV.div,{"data-state":w(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!b,...i,ref:p,style:{"--radix-collapsible-content-height":f?"".concat(f,"px"):void 0,"--radix-collapsible-content-width":N?"".concat(N,"px"):void 0,...e.style},children:b&&n})});function w(e){return e?"open":"closed"}var S=f,I=N,k=b},370:function(e,a,l){"use strict";l.d(a,{f:function(){return d}});var s=l(2265);l(54887);var t=l(37053),n=l(57437),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,a)=>{let l=(0,t.Z8)(`Primitive.${a}`),i=s.forwardRef((e,s)=>{let{asChild:t,...i}=e,r=t?l:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,n.jsx)(r,{...i,ref:s})});return i.displayName=`Primitive.${a}`,{...e,[a]:i}},{}),r=s.forwardRef((e,a)=>(0,n.jsx)(i.label,{...e,ref:a,onMouseDown:a=>{var l;a.target.closest("button, input, select, textarea")||(null===(l=e.onMouseDown)||void 0===l||l.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));r.displayName="Label";var d=r},90759:function(e,a,l){"use strict";l.d(a,{f:function(){return o}});var s=l(2265);l(54887);var t=l(37053),n=l(57437),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,a)=>{let l=(0,t.Z8)(`Primitive.${a}`),i=s.forwardRef((e,s)=>{let{asChild:t,...i}=e,r=t?l:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,n.jsx)(r,{...i,ref:s})});return i.displayName=`Primitive.${a}`,{...e,[a]:i}},{}),r="horizontal",d=["horizontal","vertical"],c=s.forwardRef((e,a)=>{let{decorative:l,orientation:s=r,...t}=e,c=d.includes(s)?s:r;return(0,n.jsx)(i.div,{"data-orientation":c,...l?{role:"none"}:{"aria-orientation":"vertical"===c?c:void 0,role:"separator"},...t,ref:a})});c.displayName="Separator";var o=c}},function(e){e.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1509,1668,9487,1783,9881,7324,3563,6547,489,2971,2117,1744],function(){return e(e.s=49204)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8344],{28439:function(e,t,n){Promise.resolve().then(n.bind(n,37161))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:i?24*Number(a)/Number(l):a,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:i,...s}=n;return(0,r.createElement)(a,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),i),...s})});return n.displayName="".concat(e),n}},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return l.a}});var r=n(55775),l=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(47043);n(57437),n(2265);let l=r._(n(15602));function u(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let u={...r,...t};return(0,l.default)({...u,modules:null==(n=u.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let r=n(18993);function l(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),l=n(2265),u=n(81523),o=n(70049);function a(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},s=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(a)),s=t.loading;function d(e){let a=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(o.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(u.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(l.Suspense,{fallback:a,children:i})}return d.displayName="LoadableComponent",d}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return u}});let r=n(57437),l=n(20544);function u(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,l.getExpectedRequestStore)("next/dynamic css"),u=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));u.push(...t)}}return 0===u.length?null:(0,r.jsx)(r.Fragment,{children:u.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},37161:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(57437);n(2265);var l=n(30166),u=n(51817);function o(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(u.Z,{className:"h-8 w-8 animate-spin"})})}let a=(0,l.default)(()=>Promise.all([n.e(7999),n.e(3572),n.e(7902),n.e(5094),n.e(4438),n.e(6530),n.e(4475),n.e(6241),n.e(926),n.e(600),n.e(2676),n.e(1509),n.e(1668),n.e(9487),n.e(7636),n.e(1783),n.e(9881),n.e(7324),n.e(9124),n.e(6712),n.e(6547),n.e(489),n.e(1303),n.e(3817)]).then(n.bind(n,72337)).then(e=>e.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{selectedCollection:"baasix_Tasks",title:"Tasks",enableView:!0,defaultVisibleColumns:["type","task_status","scheduled_time","userCreated","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=28439)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1619],{24654:function(){},35191:function(e,t,a){Promise.resolve().then(a.bind(a,31836))},31836:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return E}});var r=a(57437),s=a(29),o=a.n(s),n=a(2265),i=a(99376),l=a(72135),c=a(8567),d=a(19180),m=a.n(d),u=a(12381),p=a(32660),g=a(51817),h=a(99897),x=a(28553),f=a(33388),b=a(64935),v=a(83229),j=a(62883),y=a(74291),k=a(30166),w=a(57805),N=a(69413),C=a(38436),z=a(39164),T=a(29099),B=a(14438);let L=(0,k.default)(()=>a.e(2344).then(a.bind(a,32344)),{loadableGenerated:{webpack:()=>[null]},ssr:!1}),S=[{name:"First Name",value:"{{user.firstName}}",category:"User"},{name:"Last Name",value:"{{user.lastName}}",category:"User"},{name:"Full Name",value:"{{user.fullName}}",category:"User"},{name:"Email",value:"{{user.email}}",category:"User"},{name:"Phone",value:"{{user.phone}}",category:"User"},{name:"Company Name",value:"{{tenant.name}}",category:"Tenant"},{name:"Company Logo",value:"{{tenant.logo}}",category:"Tenant"},{name:"Company Website",value:"{{tenant.website}}",category:"Tenant"},{name:"Company Address",value:"{{tenant.address}}",category:"Tenant"},{name:"Company Phone",value:"{{tenant.phone}}",category:"Tenant"},{name:"Company Email",value:"{{tenant.email}}",category:"Tenant"},{name:"Magic Link",value:"{{magicLink}}",category:"Auth"},{name:"Magic Code",value:"{{magicCode}}",category:"Auth"},{name:"Reset Password Link",value:"{{resetPasswordLink}}",category:"Auth"},{name:"Verification Link",value:"{{verificationLink}}",category:"Auth"},{name:"Invite Link",value:"{{inviteLink}}",category:"Auth"},{name:"Login Link",value:"{{loginLink}}",category:"Auth"},{name:"Current Date",value:"{{currentDate}}",category:"DateTime"},{name:"Current Time",value:"{{currentTime}}",category:"DateTime"},{name:"Current Year",value:"{{currentYear}}",category:"DateTime"},{name:"Custom Variable 1",value:"{{custom1}}",category:"Custom"},{name:"Custom Variable 2",value:"{{custom2}}",category:"Custom"},{name:"Custom Variable 3",value:"{{custom3}}",category:"Custom"}];function A(){let e=(0,i.useRouter)(),t=(0,i.useSearchParams)().get("id"),a=(0,n.useRef)(null),s=(0,n.useRef)(null),[d,k]=(0,n.useState)(!1),[A,E]=(0,n.useState)(!1),[M,D]=(0,n.useState)("desktop"),[Z,V]=(0,n.useState)(!1),[F,P]=(0,n.useState)(""),[R,_]=(0,n.useState)(""),{data:W,isLoading:H}=(0,l.rD)({resource:"baasix_Template",id:t||"",queryOptions:{enabled:!!t}}),{mutate:U}=(0,l.PQ)(),O=null==W?void 0:W.data;(0,n.useEffect)(()=>{let e="grapesjs-css";if(document.getElementById(e))E(!0);else{let t=document.createElement("link");t.id=e,t.rel="stylesheet",t.href="https://unpkg.com/grapesjs@0.21.10/dist/css/grapes.min.css",t.onload=()=>E(!0),document.head.appendChild(t)}},[]),(0,n.useEffect)(()=>{if(!a.current||!A||H||!O)return;s.current&&(s.current.destroy(),s.current=null);let e=c.default.init({container:a.current,height:"100%",width:"auto",fromElement:!1,storageManager:!1,plugins:[m()],pluginsOpts:{[m()]:{modalTitleImport:"Import template"}},deviceManager:{devices:[{name:"Desktop",width:""},{name:"Tablet",width:"768px",widthMedia:"992px"},{name:"Mobile",width:"375px",widthMedia:"480px"}]}});if(Array.from(new Set(S.map(e=>e.category))).forEach(t=>{S.filter(e=>e.category===t).forEach(a=>{e.BlockManager.add("var-".concat(a.value),{label:a.name,category:"Variables - ".concat(t),content:'<span style="background-color: #e8f4fd; padding: 2px 6px; border-radius: 3px; font-family: monospace; color: #1e88e5;">'.concat(a.value,"</span>"),attributes:{class:"fa fa-code"}})})}),e.BlockManager.add("text-block",{label:"Text",category:"Basic",content:'<p style="margin: 0; padding: 10px;">Add your text here</p>',attributes:{class:"fa fa-font"}}),e.BlockManager.add("heading-block",{label:"Heading",category:"Basic",content:'<h2 style="margin: 0; padding: 10px;">Heading</h2>',attributes:{class:"fa fa-header"}}),e.BlockManager.add("button-block",{label:"Button",category:"Basic",content:'<a href="#" style="display: inline-block; padding: 12px 24px; background-color: #007bff; color: white; text-decoration: none; border-radius: 4px; font-weight: bold;">Click Here</a>',attributes:{class:"fa fa-square"}}),e.BlockManager.add("divider-block",{label:"Divider",category:"Basic",content:'<hr style="border: none; border-top: 1px solid #ddd; margin: 20px 0;">',attributes:{class:"fa fa-minus"}}),e.BlockManager.add("spacer-block",{label:"Spacer",category:"Basic",content:'<div style="height: 30px;"></div>',attributes:{class:"fa fa-arrows-v"}}),e.BlockManager.add("image-block",{label:"Image",category:"Basic",content:'<img src="https://via.placeholder.com/600x200" style="max-width: 100%; height: auto;">',attributes:{class:"fa fa-image"}}),O.body)try{let t=JSON.parse(O.body);t&&(t.pages||t.styles||t.components)?e.loadProjectData(t):e.setComponents(O.body)}catch(t){e.setComponents(O.body)}return s.current=e,()=>{s.current&&(s.current.destroy(),s.current=null)}},[A,H,O]),(0,n.useEffect)(()=>{if(!s.current)return;let e=s.current;e.setDevice({desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"}[M]),setTimeout(()=>{e.refresh()},100)},[M]);let G=async()=>{if(s.current&&(null==O?void 0:O.id)){k(!0);try{let e=s.current.getHtml(),t=s.current.getCss(),a=t?"<style>".concat(t,"</style>").concat(e):e;U({resource:"baasix_Template",id:O.id,values:{body:a}},{onSuccess:()=>{B.Am.success("Template saved successfully")},onError:e=>{console.error("Error saving template:",e),B.Am.error("Failed to save template")}})}catch(e){console.error("Error saving template:",e),B.Am.error("Failed to save template")}finally{k(!1)}}};return t?H||!A?(0,r.jsxs)("div",{className:"flex items-center justify-center h-screen",children:[(0,r.jsx)(g.Z,{className:"h-8 w-8 animate-spin text-primary"}),(0,r.jsx)("span",{className:"ml-2",children:"Loading editor..."})]}):(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex flex-col h-screen bg-background",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center justify-between px-4 py-2 border-b bg-card",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center gap-4",children:[(0,r.jsxs)(u.z,{variant:"ghost",size:"sm",onClick:()=>e.push("/settings/templates"),children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 mr-2"}),"Back"]}),(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc h-6 w-px bg-border"}),(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc",children:[(0,r.jsx)("h1",{className:"jsx-5411eda743d2adcc text-sm font-semibold",children:null==O?void 0:O.type}),(0,r.jsx)("p",{className:"jsx-5411eda743d2adcc text-xs text-muted-foreground",children:null==O?void 0:O.subject})]})]}),(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center gap-1 p-1 bg-muted rounded-md",children:[(0,r.jsx)(u.z,{variant:"desktop"===M?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>D("desktop"),children:(0,r.jsx)(h.Z,{className:"h-4 w-4"})}),(0,r.jsx)(u.z,{variant:"tablet"===M?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>D("tablet"),children:(0,r.jsx)(x.Z,{className:"h-4 w-4"})}),(0,r.jsx)(u.z,{variant:"mobile"===M?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>D("mobile"),children:(0,r.jsx)(f.Z,{className:"h-4 w-4"})})]}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>{if(s.current){let e=s.current.getHtml(),t=s.current.getCss();P(e||""),_(t||""),V(!0)}},children:[(0,r.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Edit Code"]}),(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc h-6 w-px bg-border"}),(0,r.jsxs)(u.z,{onClick:G,disabled:d,children:[d?(0,r.jsx)(g.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,r.jsx)(v.Z,{className:"h-4 w-4 mr-2"}),"Save Template"]})]})]}),(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc flex-1 overflow-hidden",children:(0,r.jsx)("div",{ref:a,className:"jsx-5411eda743d2adcc h-full w-full"})}),(0,r.jsx)(o(),{id:"5411eda743d2adcc",children:".gjs-pn-devices-c,.gjs-devices-c{display:none!important}.gjs-pn-views-container{width:300px!important;min-width:300px!important}.gjs-pn-views{width:300px!important}.gjs-pn-buttons{-webkit-box-pack:end!important;-webkit-justify-content:flex-end!important;-moz-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.gjs-cv-canvas{width:-webkit-calc(100% - 300px)!important;width:-moz-calc(100% - 300px)!important;width:calc(100% - 300px)!important}.gjs-pn-options{right:300px!important}.gjs-one-bg{background-color:hsl(var(--card))!important}.gjs-two-color{color:hsl(var(--foreground))!important}.gjs-three-bg{background-color:hsl(var(--muted))!important}.gjs-four-color,.gjs-four-color-h:hover{color:hsl(var(--primary))!important}.gjs-frame-wrapper{background-color:white!important;-webkit-box-shadow:0 2px 10px rgba(0,0,0,.1)!important;-moz-box-shadow:0 2px 10px rgba(0,0,0,.1)!important;box-shadow:0 2px 10px rgba(0,0,0,.1)!important;margin:20px auto!important;-webkit-transition:width.3s ease!important;-moz-transition:width.3s ease!important;-o-transition:width.3s ease!important;transition:width.3s ease!important}.gjs-one-bg{background-color:hsl(var(--card))!important}.gjs-two-color{color:hsl(var(--foreground))!important}.gjs-three-bg{background-color:hsl(var(--muted))!important}.gjs-four-color,.gjs-four-color-h:hover{color:hsl(var(--primary))!important}.gjs-block{border:1px solid hsl(var(--border))!important;-webkit-border-radius:4px!important;-moz-border-radius:4px!important;border-radius:4px!important;margin:4px!important;padding:8px!important;background-color:hsl(var(--card))!important;-webkit-transition:all.2s!important;-moz-transition:all.2s!important;-o-transition:all.2s!important;transition:all.2s!important}.gjs-block:hover{background-color:hsl(var(--accent))!important}.gjs-block-label{font-size:11px!important;color:hsl(var(--foreground))!important}.gjs-block-category{border-bottom:1px solid hsl(var(--border))!important}.gjs-block-category .gjs-title{background-color:hsl(var(--muted))!important;color:hsl(var(--foreground))!important;font-weight:500!important;padding:10px!important}.gjs-sm-sector{border-bottom:1px solid hsl(var(--border))!important}.gjs-sm-sector-title{background-color:hsl(var(--muted))!important;color:hsl(var(--foreground))!important}.gjs-sm-property{margin-bottom:8px!important}.gjs-field{background-color:hsl(var(--background))!important;border:1px solid hsl(var(--border))!important;-webkit-border-radius:4px!important;-moz-border-radius:4px!important;border-radius:4px!important;color:hsl(var(--foreground))!important}.gjs-field:focus{border-color:hsl(var(--ring))!important}.gjs-layer{background-color:hsl(var(--card))!important;border-bottom:1px solid hsl(var(--border))!important}.gjs-layer:hover{background-color:hsl(var(--accent))!important}.gjs-toolbar{background-color:hsl(var(--card))!important;border:1px solid hsl(var(--border))!important;-webkit-border-radius:4px!important;-moz-border-radius:4px!important;border-radius:4px!important}.gjs-toolbar-item{color:hsl(var(--foreground))!important}.gjs-toolbar-item:hover{color:hsl(var(--primary))!important}.gjs-selected{outline:2px solid hsl(var(--primary))!important}.gjs-resizer-h{background-color:hsl(var(--primary))!important}.gjs-field-color-picker{z-index:9999!important}.sp-container{z-index:99999!important}.gjs-rte-toolbar{z-index:9999!important;background-color:hsl(var(--card))!important;border:1px solid hsl(var(--border))!important;-webkit-border-radius:4px!important;-moz-border-radius:4px!important;border-radius:4px!important}.gjs-rte-action{color:hsl(var(--foreground))!important}.gjs-rte-action:hover{background-color:hsl(var(--accent))!important}"}),(0,r.jsx)(y.Vq,{open:Z,onOpenChange:V,children:(0,r.jsxs)(y.cZ,{className:"max-w-5xl h-[85vh] flex flex-col",children:[(0,r.jsx)(y.fK,{className:"flex-shrink-0",children:(0,r.jsx)(y.$N,{children:"Edit Code"})}),(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex gap-4 flex-1 min-h-0 overflow-hidden",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex-1 flex flex-col min-w-0",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center justify-between mb-2",children:[(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc text-sm font-medium text-muted-foreground",children:"HTML"}),(0,r.jsxs)(u.z,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:async()=>{try{let e=await C.WU(F,{parser:"html",plugins:[z],printWidth:80,tabWidth:2});P(e)}catch(e){console.error("Format error:",e)}},children:[(0,r.jsx)(j.Z,{className:"h-3 w-3 mr-1"}),"Format"]})]}),(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc flex-1 border rounded-md overflow-hidden",children:(0,r.jsx)(L,{value:F,height:"100%",style:{height:"100%",overflow:"auto"},extensions:[(0,w.dy)()],onChange:e=>P(e),theme:"dark",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0}})})]}),(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex-1 flex flex-col min-w-0",children:[(0,r.jsxs)("div",{className:"jsx-5411eda743d2adcc flex items-center justify-between mb-2",children:[(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc text-sm font-medium text-muted-foreground",children:"CSS"}),(0,r.jsxs)(u.z,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:async()=>{try{let e=await C.WU(R,{parser:"css",plugins:[T],printWidth:80,tabWidth:2});_(e)}catch(e){console.error("Format error:",e)}},children:[(0,r.jsx)(j.Z,{className:"h-3 w-3 mr-1"}),"Format"]})]}),(0,r.jsx)("div",{className:"jsx-5411eda743d2adcc flex-1 border rounded-md overflow-hidden",children:(0,r.jsx)(L,{value:R,height:"100%",style:{height:"100%",overflow:"auto"},extensions:[(0,N.iv)()],onChange:e=>_(e),theme:"dark",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0}})})]})]}),(0,r.jsxs)(y.cN,{className:"flex-shrink-0 mt-4",children:[(0,r.jsx)(u.z,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),(0,r.jsx)(u.z,{onClick:()=>{s.current&&(s.current.setComponents(F),s.current.setStyle(R),V(!1))},children:"Apply Changes"})]})]})})]}):(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"No Template Selected"}),(0,r.jsx)("p",{className:"text-muted-foreground mb-4",children:"Please select a template to edit"}),(0,r.jsxs)(u.z,{onClick:()=>e.push("/settings/templates"),children:[(0,r.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Back to Templates"]})]})})}function E(){return(0,r.jsx)(n.Suspense,{fallback:(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,r.jsx)(g.Z,{className:"h-8 w-8 animate-spin text-primary"})}),children:(0,r.jsx)(A,{})})}},12381:function(e,t,a){"use strict";a.d(t,{d:function(){return l},z:function(){return c}});var r=a(57437),s=a(2265),o=a(37053),n=a(90535),i=a(93448);let l=(0,n.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,t)=>{let{className:a,variant:s,size:n,asChild:c=!1,...d}=e,m=c?o.g7:"button";return(0,r.jsx)(m,{className:(0,i.cn)(l({variant:s,size:n,className:a})),ref:t,...d})});c.displayName="Button"},74291:function(e,t,a){"use strict";a.d(t,{$N:function(){return g},Be:function(){return h},Vq:function(){return l},cN:function(){return p},cZ:function(){return m},fK:function(){return u}});var r=a(57437),s=a(2265),o=a(70001),n=a(32489),i=a(93448);let l=o.fC;o.xz;let c=o.h_;o.x8;let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.aV,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s})});d.displayName=o.aV.displayName;let m=s.forwardRef((e,t)=>{let{className:a,children:s,...l}=e;return(0,r.jsxs)(c,{children:[(0,r.jsx)(d,{}),(0,r.jsxs)(o.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l,children:[s,(0,r.jsxs)(o.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=o.VY.displayName;let u=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};u.displayName="DialogHeader";let p=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};p.displayName="DialogFooter";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});g.displayName=o.Dx.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});h.displayName=o.dk.displayName},93448:function(e,t,a){"use strict";a.d(t,{cn:function(){return o}});var r=a(61994),s=a(53335);function o(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.m6)((0,r.W)(t))}}},function(e){e.O(0,[7999,129,6211,8021,6401,5094,4438,6530,4475,6170,2971,2117,1744],function(){return e(e.s=35191)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4111],{30086:function(n,e,u){Promise.resolve().then(u.bind(u,15006))},15006:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.h2,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,5650,6547,489,1303,3817,9599,2971,2117,1744],function(){return n(n.s=30086)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5714],{51454:function(n,e,u){Promise.resolve().then(u.bind(u,77498))},77498:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.Xx,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,5650,6547,489,1303,3817,9599,2971,2117,1744],function(){return n(n.s=51454)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1242],{58247:function(e,t,n){Promise.resolve().then(n.bind(n,55048))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:a?24*Number(i)/Number(l):i,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),a=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:a,...s}=n;return(0,r.createElement)(i,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),a),...s})});return n.displayName="".concat(e),n}},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return l.a}});var r=n(55775),l=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(47043);n(57437),n(2265);let l=r._(n(15602));function u(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let u={...r,...t};return(0,l.default)({...u,modules:null==(n=u.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let r=n(18993);function l(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),l=n(2265),u=n(81523),o=n(70049);function i(e){return{default:e&&"default"in e?e.default:e}}let a={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},s=function(e){let t={...a,...e},n=(0,l.lazy)(()=>t.loader().then(i)),s=t.loading;function d(e){let i=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,a=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(o.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(u.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(l.Suspense,{fallback:i,children:a})}return d.displayName="LoadableComponent",d}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return u}});let r=n(57437),l=n(20544);function u(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,l.getExpectedRequestStore)("next/dynamic css"),u=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));u.push(...t)}}return 0===u.length?null:(0,r.jsx)(r.Fragment,{children:u.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},55048:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(57437);n(2265);var l=n(30166),u=n(51817);function o(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(u.Z,{className:"h-8 w-8 animate-spin"})})}let i=(0,l.default)(()=>Promise.all([n.e(7999),n.e(3572),n.e(7902),n.e(5094),n.e(4438),n.e(6530),n.e(4475),n.e(6241),n.e(926),n.e(600),n.e(2676),n.e(1509),n.e(1668),n.e(9487),n.e(7636),n.e(1783),n.e(9881),n.e(7324),n.e(9124),n.e(6712),n.e(6547),n.e(489),n.e(1303),n.e(3817)]).then(n.bind(n,72337)).then(e=>e.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function a(){return(0,r.jsx)(i,{selectedCollection:"baasix_Invite",title:"User Invites",enableView:!0,defaultVisibleColumns:["email","role","tenant","status","inviter","expiresAt","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=58247)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3353],{88752:function(n,t,u){Promise.resolve().then(u.bind(u,18407))},18407:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,6547,489,1303,3817,7214,2971,2117,1744],function(){return n(n.s=88752)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8800],{46393:function(n,t,u){Promise.resolve().then(u.bind(u,9565))},9565:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,2676,1509,1668,9487,7636,1783,9881,7324,9124,6712,6547,489,1303,3817,7214,2971,2117,1744],function(){return n(n.s=46393)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7165],{37373:function(e,t,n){Promise.resolve().then(n.bind(n,544))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:i?24*Number(a)/Number(l):a,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:i,...s}=n;return(0,r.createElement)(a,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),i),...s})});return n.displayName="".concat(e),n}},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return l.a}});var r=n(55775),l=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(47043);n(57437),n(2265);let l=r._(n(15602));function u(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let u={...r,...t};return(0,l.default)({...u,modules:null==(n=u.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let r=n(18993);function l(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),l=n(2265),u=n(81523),o=n(70049);function a(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},s=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(a)),s=t.loading;function d(e){let a=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(o.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(u.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(l.Suspense,{fallback:a,children:i})}return d.displayName="LoadableComponent",d}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return u}});let r=n(57437),l=n(20544);function u(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,l.getExpectedRequestStore)("next/dynamic css"),u=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));u.push(...t)}}return 0===u.length?null:(0,r.jsx)(r.Fragment,{children:u.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},544:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(57437);n(2265);var l=n(30166),u=n(51817);function o(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(u.Z,{className:"h-8 w-8 animate-spin"})})}let a=(0,l.default)(()=>Promise.all([n.e(7999),n.e(3572),n.e(7902),n.e(5094),n.e(4438),n.e(6530),n.e(4475),n.e(6241),n.e(926),n.e(600),n.e(2676),n.e(1509),n.e(1668),n.e(9487),n.e(7636),n.e(1783),n.e(9881),n.e(7324),n.e(9124),n.e(6712),n.e(6547),n.e(489),n.e(1303),n.e(3817)]).then(n.bind(n,72337)).then(e=>e.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{selectedCollection:"baasix_UserPreference",title:"User Preferences",enableView:!0,defaultVisibleColumns:["user","collectionName","preferenceType","isDefault","name","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=37373)}),_N_E=e.O()}]);