convex-cms 0.0.5-alpha.0 → 0.0.5-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/README.md +95 -144
  2. package/admin/README.md +99 -0
  3. package/admin/src/components/AdminLayout.tsx +22 -0
  4. package/admin/src/components/BreakingChangesWarningDialog.tsx +81 -0
  5. package/admin/src/components/BulkActionBar.tsx +190 -0
  6. package/admin/src/components/BulkOperationModal.tsx +177 -0
  7. package/admin/src/components/ContentEntryEditor.tsx +1104 -0
  8. package/admin/src/components/ContentTypeFormModal.tsx +1012 -0
  9. package/admin/src/components/ErrorBoundary.tsx +83 -0
  10. package/admin/src/components/ErrorState.tsx +147 -0
  11. package/admin/src/components/Header.tsx +294 -0
  12. package/admin/src/components/RouteGuard.tsx +264 -0
  13. package/admin/src/components/Sidebar.tsx +90 -0
  14. package/admin/src/components/TaxonomyEditor.tsx +348 -0
  15. package/admin/src/components/TermTree.tsx +533 -0
  16. package/admin/src/components/UploadDropzone.tsx +383 -0
  17. package/admin/src/components/VersionCompare.tsx +250 -0
  18. package/admin/src/components/VersionHistory.tsx +279 -0
  19. package/admin/src/components/VersionRollbackModal.tsx +79 -0
  20. package/admin/src/components/cmsds/CmsButton.tsx +101 -0
  21. package/admin/src/components/cmsds/CmsDialog.tsx +139 -0
  22. package/admin/src/components/cmsds/CmsDropdown.tsx +62 -0
  23. package/admin/src/components/cmsds/CmsEmptyState.tsx +54 -0
  24. package/admin/src/components/cmsds/CmsField.tsx +47 -0
  25. package/admin/src/components/cmsds/CmsPageHeader.tsx +35 -0
  26. package/admin/src/components/cmsds/CmsStatusBadge.tsx +153 -0
  27. package/admin/src/components/cmsds/CmsSurface.tsx +52 -0
  28. package/admin/src/components/cmsds/CmsTable.tsx +164 -0
  29. package/admin/src/components/cmsds/CmsToolbar.tsx +58 -0
  30. package/admin/src/components/cmsds/index.ts +10 -0
  31. package/admin/src/components/fields/BooleanField.tsx +74 -0
  32. package/admin/src/components/fields/CategoryField.tsx +394 -0
  33. package/admin/src/components/fields/DateField.tsx +173 -0
  34. package/admin/src/components/fields/DefaultFieldRenderer.tsx +74 -0
  35. package/admin/src/components/fields/FieldRenderer.tsx +180 -0
  36. package/admin/src/components/fields/FieldWrapper.tsx +57 -0
  37. package/admin/src/components/fields/JsonField.tsx +172 -0
  38. package/admin/src/components/fields/MediaField.tsx +367 -0
  39. package/admin/src/components/fields/MultiSelectField.tsx +118 -0
  40. package/admin/src/components/fields/NumberField.tsx +77 -0
  41. package/admin/src/components/fields/ReferenceField.tsx +386 -0
  42. package/admin/src/components/fields/RichTextField.tsx +171 -0
  43. package/admin/src/components/fields/SelectField.tsx +62 -0
  44. package/admin/src/components/fields/TagField.tsx +325 -0
  45. package/admin/src/components/fields/TextAreaField.tsx +68 -0
  46. package/admin/src/components/fields/TextField.tsx +56 -0
  47. package/admin/src/components/fields/index.ts +54 -0
  48. package/admin/src/components/fields/registry.ts +64 -0
  49. package/admin/src/components/fields/types.ts +217 -0
  50. package/admin/src/components/filters/TaxonomyFilter.tsx +254 -0
  51. package/admin/src/components/filters/index.ts +1 -0
  52. package/admin/src/components/index.ts +8 -0
  53. package/admin/src/components/media/MediaAssetActions.tsx +115 -0
  54. package/admin/src/components/media/MediaAssetEditDialog.tsx +217 -0
  55. package/admin/src/components/media/MediaBulkActionBar.tsx +51 -0
  56. package/admin/src/components/media/MediaFolderActions.tsx +69 -0
  57. package/admin/src/components/media/MediaFolderEditDialog.tsx +126 -0
  58. package/admin/src/components/media/MediaMoveModal.tsx +179 -0
  59. package/admin/src/components/media/MediaPreviewModal.tsx +370 -0
  60. package/admin/src/components/media/MediaTaxonomyPicker.tsx +304 -0
  61. package/admin/src/components/media/MediaTrashBulkActionBar.tsx +59 -0
  62. package/admin/src/components/ui/accordion.tsx +64 -0
  63. package/admin/src/components/ui/alert-dialog.tsx +155 -0
  64. package/admin/src/components/ui/alert.tsx +66 -0
  65. package/admin/src/components/ui/avatar.tsx +53 -0
  66. package/admin/src/components/ui/badge.tsx +46 -0
  67. package/admin/src/components/ui/breadcrumb.tsx +109 -0
  68. package/admin/src/components/ui/button.tsx +62 -0
  69. package/admin/src/components/ui/calendar.tsx +220 -0
  70. package/admin/src/components/ui/card.tsx +92 -0
  71. package/admin/src/components/ui/checkbox.tsx +30 -0
  72. package/admin/src/components/ui/command.tsx +182 -0
  73. package/admin/src/components/ui/dialog.tsx +143 -0
  74. package/admin/src/components/ui/dropdown-menu.tsx +257 -0
  75. package/admin/src/components/ui/form.tsx +167 -0
  76. package/admin/src/components/ui/input.tsx +21 -0
  77. package/admin/src/components/ui/label.tsx +24 -0
  78. package/admin/src/components/ui/popover.tsx +46 -0
  79. package/admin/src/components/ui/scroll-area.tsx +56 -0
  80. package/admin/src/components/ui/select.tsx +190 -0
  81. package/admin/src/components/ui/separator.tsx +26 -0
  82. package/admin/src/components/ui/sheet.tsx +137 -0
  83. package/admin/src/components/ui/sidebar.tsx +724 -0
  84. package/admin/src/components/ui/skeleton.tsx +13 -0
  85. package/admin/src/components/ui/sonner.tsx +38 -0
  86. package/admin/src/components/ui/switch.tsx +31 -0
  87. package/admin/src/components/ui/table.tsx +114 -0
  88. package/admin/src/components/ui/tabs.tsx +66 -0
  89. package/admin/src/components/ui/textarea.tsx +18 -0
  90. package/admin/src/components/ui/tooltip.tsx +61 -0
  91. package/admin/src/contexts/AdminConfigContext.tsx +30 -0
  92. package/admin/src/contexts/AuthContext.tsx +330 -0
  93. package/admin/src/contexts/BreadcrumbContext.tsx +49 -0
  94. package/admin/src/contexts/SettingsConfigContext.tsx +57 -0
  95. package/admin/src/contexts/ThemeContext.tsx +91 -0
  96. package/admin/src/contexts/index.ts +20 -0
  97. package/admin/src/embed/components/EmbedHeader.tsx +103 -0
  98. package/admin/src/embed/components/EmbedLayout.tsx +29 -0
  99. package/admin/src/embed/components/EmbedSidebar.tsx +119 -0
  100. package/admin/src/embed/components/index.ts +3 -0
  101. package/admin/src/embed/contexts/ApiContext.tsx +32 -0
  102. package/admin/src/embed/index.tsx +184 -0
  103. package/admin/src/embed/navigation.tsx +202 -0
  104. package/admin/src/embed/pages/Content.tsx +19 -0
  105. package/admin/src/embed/pages/ContentTypes.tsx +19 -0
  106. package/admin/src/embed/pages/Dashboard.tsx +19 -0
  107. package/admin/src/embed/pages/Media.tsx +19 -0
  108. package/admin/src/embed/pages/Settings.tsx +22 -0
  109. package/admin/src/embed/pages/Taxonomies.tsx +22 -0
  110. package/admin/src/embed/pages/Trash.tsx +22 -0
  111. package/admin/src/embed/pages/index.ts +7 -0
  112. package/admin/src/embed/types.ts +24 -0
  113. package/admin/src/hooks/index.ts +2 -0
  114. package/admin/src/hooks/use-mobile.ts +19 -0
  115. package/admin/src/hooks/useBreadcrumbLabel.ts +15 -0
  116. package/admin/src/hooks/usePermissions.ts +211 -0
  117. package/admin/src/lib/admin-config.ts +111 -0
  118. package/admin/src/lib/cn.ts +6 -0
  119. package/admin/src/lib/config.server.ts +56 -0
  120. package/admin/src/lib/convex.ts +26 -0
  121. package/admin/src/lib/embed-adapter.ts +80 -0
  122. package/admin/src/lib/icons.tsx +96 -0
  123. package/admin/src/lib/loadAdminConfig.ts +92 -0
  124. package/admin/src/lib/motion.ts +29 -0
  125. package/admin/src/lib/navigation.ts +43 -0
  126. package/admin/src/lib/tanstack-adapter.ts +82 -0
  127. package/admin/src/pages/ContentPage.tsx +337 -0
  128. package/admin/src/pages/ContentTypesPage.tsx +457 -0
  129. package/admin/src/pages/DashboardPage.tsx +163 -0
  130. package/admin/src/pages/MediaPage.tsx +34 -0
  131. package/admin/src/pages/SettingsPage.tsx +486 -0
  132. package/admin/src/pages/TaxonomiesPage.tsx +289 -0
  133. package/admin/src/pages/TrashPage.tsx +421 -0
  134. package/admin/src/pages/index.ts +14 -0
  135. package/admin/src/routeTree.gen.ts +262 -0
  136. package/admin/src/router.tsx +22 -0
  137. package/admin/src/routes/__root.tsx +250 -0
  138. package/admin/src/routes/content-types.tsx +20 -0
  139. package/admin/src/routes/content.tsx +20 -0
  140. package/admin/src/routes/entries/$entryId.tsx +107 -0
  141. package/admin/src/routes/entries/new.$contentTypeId.tsx +69 -0
  142. package/admin/src/routes/entries/type/$contentTypeId.tsx +503 -0
  143. package/admin/src/routes/index.tsx +20 -0
  144. package/admin/src/routes/media.tsx +1095 -0
  145. package/admin/src/routes/settings.tsx +20 -0
  146. package/admin/src/routes/taxonomies.tsx +20 -0
  147. package/admin/src/routes/trash.tsx +20 -0
  148. package/admin/src/styles/globals.css +69 -0
  149. package/admin/src/styles/tailwind-config.css +74 -0
  150. package/admin/src/styles/theme.css +73 -0
  151. package/admin/src/types/index.ts +221 -0
  152. package/admin/src/utils/errorParsing.ts +163 -0
  153. package/admin/src/utils/index.ts +5 -0
  154. package/admin/src/vite-env.d.ts +14 -0
  155. package/admin/tailwind.preset.cjs +102 -0
  156. package/admin-dist/nitro.json +1 -1
  157. package/admin-dist/public/assets/{CmsEmptyState-CiMQwSQV.js → CmsEmptyState-CkqBIab3.js} +1 -1
  158. package/admin-dist/public/assets/{CmsPageHeader-ohOq0luT.js → CmsPageHeader-CUtl5MMG.js} +1 -1
  159. package/admin-dist/public/assets/{CmsStatusBadge-BdNf0V9v.js → CmsStatusBadge-CUYFgEe-.js} +1 -1
  160. package/admin-dist/public/assets/{CmsSurface-CWup6Jh7.js → CmsSurface-CsJfAVa3.js} +1 -1
  161. package/admin-dist/public/assets/{CmsToolbar-cEBlCHa3.js → CmsToolbar-CnfbcxeP.js} +1 -1
  162. package/admin-dist/public/assets/{ContentEntryEditor-BY5ypfUs.js → ContentEntryEditor-BU220CCy.js} +1 -1
  163. package/admin-dist/public/assets/TaxonomyFilter-CWCxC5HZ.js +1 -0
  164. package/admin-dist/public/assets/_contentTypeId-DK8cskRt.js +1 -0
  165. package/admin-dist/public/assets/{_entryId-BpSmrfAm.js → _entryId-CuVMExbb.js} +1 -1
  166. package/admin-dist/public/assets/{alert-Bf2l8kxw.js → alert-CF1BSzGR.js} +1 -1
  167. package/admin-dist/public/assets/{badge-qPrc4AUM.js → badge-CmuOIVKp.js} +1 -1
  168. package/admin-dist/public/assets/{circle-check-big-Dgozy3vV.js → circle-check-big-BKDVG6DU.js} +1 -1
  169. package/admin-dist/public/assets/{command-QOmNhlb0.js → command-XJxnF2Sd.js} +1 -1
  170. package/admin-dist/public/assets/content-QBUxdxbS.js +1 -0
  171. package/admin-dist/public/assets/content-types-CrNEm8Hf.js +2 -0
  172. package/admin-dist/public/assets/globals-B7Wsfh_v.css +1 -0
  173. package/admin-dist/public/assets/index-C7xOwudI.js +1 -0
  174. package/admin-dist/public/assets/{label-DCsUdvFh.js → label-CHCnXeBk.js} +1 -1
  175. package/admin-dist/public/assets/{link-2-Czw1N61H.js → link-2-Bb34judH.js} +1 -1
  176. package/admin-dist/public/assets/{list-DtCsXj8-.js → list-9Pzt48ld.js} +1 -1
  177. package/admin-dist/public/assets/{main-CXgkZMhe.js → main-CjQ2VI9L.js} +3 -3
  178. package/admin-dist/public/assets/media-Dc5PWt2Q.js +1 -0
  179. package/admin-dist/public/assets/{new._contentTypeId-CoTDxKzf.js → new._contentTypeId-C_I4YxIa.js} +1 -1
  180. package/admin-dist/public/assets/{plus-xCFJK0RC.js → plus-Ceef7DHk.js} +1 -1
  181. package/admin-dist/public/assets/{rotate-ccw-DIqK63wY.js → rotate-ccw-7k7-4VUq.js} +1 -1
  182. package/admin-dist/public/assets/{scroll-area-B-yrE66a.js → scroll-area-CC6wujnp.js} +1 -1
  183. package/admin-dist/public/assets/{search-CbCbboeU.js → search-DwoUV2pv.js} +1 -1
  184. package/admin-dist/public/assets/{select-Co3TZFJb.js → select-hOZTp8aC.js} +1 -1
  185. package/admin-dist/public/assets/{settings-BspTTv_o.js → settings-t2PbCZh4.js} +1 -1
  186. package/admin-dist/public/assets/{switch-CfavASmR.js → switch-jX2pDaNU.js} +1 -1
  187. package/admin-dist/public/assets/{tabs-CN5s5u2W.js → tabs-q4EbZk7c.js} +1 -1
  188. package/admin-dist/public/assets/{tanstack-adapter-npeE3RdY.js → tanstack-adapter-B-Glm4kH.js} +1 -1
  189. package/admin-dist/public/assets/taxonomies-kyk5P4ZW.js +1 -0
  190. package/admin-dist/public/assets/{textarea-BJ0XFZpT.js → textarea-B6SfBmr0.js} +1 -1
  191. package/admin-dist/public/assets/trash-BOCnIznD.js +1 -0
  192. package/admin-dist/public/assets/{triangle-alert-BZRcqsUg.js → triangle-alert-CXFIO_Gu.js} +1 -1
  193. package/admin-dist/public/assets/{useBreadcrumbLabel-DwZlwvFF.js → useBreadcrumbLabel-_6qBagc3.js} +1 -1
  194. package/admin-dist/public/assets/{usePermissions-C1JQhfqb.js → usePermissions-M1ijZ7a6.js} +1 -1
  195. package/admin-dist/server/_ssr/{CmsButton-B45JAKR1.mjs → CmsButton-DOiTVKQq.mjs} +1 -1
  196. package/admin-dist/server/_ssr/{CmsEmptyState-D_BQFAVR.mjs → CmsEmptyState-fbnGt3LD.mjs} +2 -2
  197. package/admin-dist/server/_ssr/{CmsPageHeader-CrUZA59A.mjs → CmsPageHeader-DHRrdOZa.mjs} +1 -1
  198. package/admin-dist/server/_ssr/{CmsStatusBadge-B-sj6yaj.mjs → CmsStatusBadge-s7obWbKZ.mjs} +2 -2
  199. package/admin-dist/server/_ssr/{CmsSurface-DKJZhpjk.mjs → CmsSurface-rFoYjb62.mjs} +1 -1
  200. package/admin-dist/server/_ssr/{CmsToolbar-ByaW5iXf.mjs → CmsToolbar-zTE45z2q.mjs} +2 -2
  201. package/admin-dist/server/_ssr/{ContentEntryEditor-D3_Jb1dq.mjs → ContentEntryEditor-BLoEjT_m.mjs} +12 -12
  202. package/admin-dist/server/_ssr/{TaxonomyFilter-BRJkuCtA.mjs → TaxonomyFilter-XAtaJC2z.mjs} +5 -5
  203. package/admin-dist/server/_ssr/{_contentTypeId-B9kA6CaM.mjs → _contentTypeId-Csl4822C.mjs} +13 -13
  204. package/admin-dist/server/_ssr/{_entryId-BddcMkZN.mjs → _entryId-D8alLFBx.mjs} +15 -15
  205. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-BffZedId.mjs +4 -0
  206. package/admin-dist/server/_ssr/{command-CGtVr8Gb.mjs → command-C0Di14--.mjs} +1 -1
  207. package/admin-dist/server/_ssr/{content-D1tbeOd0.mjs → content-CT-FPsmV.mjs} +12 -55
  208. package/admin-dist/server/_ssr/{content-types-BZqY_BER.mjs → content-types-C8cBFdzE.mjs} +15 -46
  209. package/admin-dist/server/_ssr/{index-BIdq4xaC.mjs → index-BJtcrEc-.mjs} +5 -5
  210. package/admin-dist/server/_ssr/index.mjs +2 -2
  211. package/admin-dist/server/_ssr/{label-T-QNKAr6.mjs → label-qn2Afwl4.mjs} +1 -1
  212. package/admin-dist/server/_ssr/{media-C-xqjBrl.mjs → media-qv5IAsMZ.mjs} +14 -14
  213. package/admin-dist/server/_ssr/{new._contentTypeId-DWic9cRq.mjs → new._contentTypeId-DdGyrhqs.mjs} +13 -13
  214. package/admin-dist/server/_ssr/{router-D1BMAMJT.mjs → router-nSVkxb6Y.mjs} +11 -11
  215. package/admin-dist/server/_ssr/{scroll-area-C0pic_WA.mjs → scroll-area-BCinP455.mjs} +1 -1
  216. package/admin-dist/server/_ssr/{select-CqmuN2F6.mjs → select-BKQlQScw.mjs} +1 -1
  217. package/admin-dist/server/_ssr/{settings-CAkncGGV.mjs → settings-BCr2KQlk.mjs} +55 -40
  218. package/admin-dist/server/_ssr/{switch-CgmuJkT9.mjs → switch-BaOi42fE.mjs} +1 -1
  219. package/admin-dist/server/_ssr/{tabs-CnMj0aRy.mjs → tabs-DYXEi9kq.mjs} +2 -2
  220. package/admin-dist/server/_ssr/{tanstack-adapter-BXZrMauE.mjs → tanstack-adapter-Bsz8kha-.mjs} +1 -1
  221. package/admin-dist/server/_ssr/{taxonomies-thl3BfVm.mjs → taxonomies-CueMHTbE.mjs} +30 -19
  222. package/admin-dist/server/_ssr/{textarea-4K5OJgeh.mjs → textarea-CI0Jqx2x.mjs} +1 -1
  223. package/admin-dist/server/_ssr/{trash-B40Gx5zP.mjs → trash-DE6W8GoX.mjs} +20 -17
  224. package/admin-dist/server/_ssr/{useBreadcrumbLabel-rn-fL4zV.mjs → useBreadcrumbLabel-B5Yi72lM.mjs} +1 -1
  225. package/admin-dist/server/_ssr/{usePermissions-CKeM6_Vw.mjs → usePermissions-C3nZ-Izm.mjs} +1 -1
  226. package/admin-dist/server/index.mjs +187 -194
  227. package/dist/client/admin/bulk.d.ts +79 -0
  228. package/dist/client/admin/bulk.d.ts.map +1 -0
  229. package/dist/client/admin/bulk.js +72 -0
  230. package/dist/client/admin/bulk.js.map +1 -0
  231. package/dist/client/admin/contentLock.d.ts +118 -0
  232. package/dist/client/admin/contentLock.d.ts.map +1 -0
  233. package/dist/client/admin/contentLock.js +81 -0
  234. package/dist/client/admin/contentLock.js.map +1 -0
  235. package/dist/client/{adminApi.d.ts → admin/contentTypes.d.ts} +39 -1134
  236. package/dist/client/admin/contentTypes.d.ts.map +1 -0
  237. package/dist/client/admin/contentTypes.js +122 -0
  238. package/dist/client/admin/contentTypes.js.map +1 -0
  239. package/dist/client/admin/dashboard.d.ts +16 -0
  240. package/dist/client/admin/dashboard.d.ts.map +1 -0
  241. package/dist/client/admin/dashboard.js +33 -0
  242. package/dist/client/admin/dashboard.js.map +1 -0
  243. package/dist/client/admin/entries.d.ts +358 -0
  244. package/dist/client/admin/entries.d.ts.map +1 -0
  245. package/dist/client/admin/entries.js +220 -0
  246. package/dist/client/admin/entries.js.map +1 -0
  247. package/dist/client/admin/index.d.ts +6568 -0
  248. package/dist/client/admin/index.d.ts.map +1 -0
  249. package/dist/client/admin/index.js +305 -0
  250. package/dist/client/admin/index.js.map +1 -0
  251. package/dist/client/admin/media.d.ts +1038 -0
  252. package/dist/client/admin/media.d.ts.map +1 -0
  253. package/dist/client/admin/media.js +489 -0
  254. package/dist/client/admin/media.js.map +1 -0
  255. package/dist/client/admin/taxonomies.d.ts +339 -0
  256. package/dist/client/admin/taxonomies.d.ts.map +1 -0
  257. package/dist/client/admin/taxonomies.js +364 -0
  258. package/dist/client/admin/taxonomies.js.map +1 -0
  259. package/dist/client/admin/trash.d.ts +91 -0
  260. package/dist/client/admin/trash.d.ts.map +1 -0
  261. package/dist/client/admin/trash.js +71 -0
  262. package/dist/client/admin/trash.js.map +1 -0
  263. package/dist/client/admin/types.d.ts +320 -0
  264. package/dist/client/admin/types.d.ts.map +1 -0
  265. package/dist/client/admin/types.js +7 -0
  266. package/dist/client/admin/types.js.map +1 -0
  267. package/dist/client/admin/validators.d.ts +3886 -0
  268. package/dist/client/admin/validators.d.ts.map +1 -0
  269. package/dist/client/admin/validators.js +322 -0
  270. package/dist/client/admin/validators.js.map +1 -0
  271. package/dist/client/admin/versions.d.ts +106 -0
  272. package/dist/client/admin/versions.d.ts.map +1 -0
  273. package/dist/client/admin/versions.js +57 -0
  274. package/dist/client/admin/versions.js.map +1 -0
  275. package/dist/client/adminApiTypes.d.ts +27 -0
  276. package/dist/client/adminApiTypes.d.ts.map +1 -0
  277. package/dist/client/adminApiTypes.js +12 -0
  278. package/dist/client/adminApiTypes.js.map +1 -0
  279. package/dist/client/{admin-config.d.ts → adminConfig.d.ts} +2 -2
  280. package/dist/client/adminConfig.d.ts.map +1 -0
  281. package/dist/client/{admin-config.js → adminConfig.js} +1 -1
  282. package/dist/client/adminConfig.js.map +1 -0
  283. package/dist/client/agentTools.d.ts +4 -4
  284. package/dist/client/index.d.ts +2 -2
  285. package/dist/client/index.d.ts.map +1 -1
  286. package/dist/client/index.js +15 -2
  287. package/dist/client/index.js.map +1 -1
  288. package/dist/component/contentEntries.d.ts +4 -4
  289. package/dist/component/contentEntryMutations.d.ts +46 -0
  290. package/dist/component/contentEntryMutations.d.ts.map +1 -1
  291. package/dist/component/contentEntryMutations.js +1 -1
  292. package/dist/component/contentEntryMutations.js.map +1 -1
  293. package/dist/component/contentTypeMigration.d.ts +1 -1
  294. package/dist/component/contentTypeMutations.d.ts +22 -0
  295. package/dist/component/contentTypeMutations.d.ts.map +1 -1
  296. package/dist/component/contentTypeMutations.js +1 -1
  297. package/dist/component/contentTypeMutations.js.map +1 -1
  298. package/dist/component/mediaAssetMutations.d.ts +47 -0
  299. package/dist/component/mediaAssetMutations.d.ts.map +1 -1
  300. package/dist/component/mediaAssetMutations.js +1 -1
  301. package/dist/component/mediaAssetMutations.js.map +1 -1
  302. package/dist/component/schema.d.ts +9 -0
  303. package/dist/component/schema.d.ts.map +1 -1
  304. package/dist/component/schema.js +1 -1
  305. package/dist/component/schema.js.map +1 -1
  306. package/package.json +85 -3
  307. package/admin-dist/public/assets/ErrorState-C4nJ-ml4.js +0 -1
  308. package/admin-dist/public/assets/TaxonomyFilter-BgE_SR_O.js +0 -1
  309. package/admin-dist/public/assets/_contentTypeId-DtZectcC.js +0 -1
  310. package/admin-dist/public/assets/content-OEBGlxg1.js +0 -1
  311. package/admin-dist/public/assets/content-types-CjQliqVV.js +0 -2
  312. package/admin-dist/public/assets/globals-hAmgC66w.css +0 -1
  313. package/admin-dist/public/assets/index-BH_ECMhv.js +0 -1
  314. package/admin-dist/public/assets/media-DTJ3-ViE.js +0 -1
  315. package/admin-dist/public/assets/taxonomies-CgG46fIF.js +0 -1
  316. package/admin-dist/public/assets/trash-B3daldm5.js +0 -1
  317. package/admin-dist/server/_ssr/ErrorState-cI-bKLez.mjs +0 -89
  318. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-Dd7AmelK.mjs +0 -4
  319. package/dist/client/admin-config.d.ts.map +0 -1
  320. package/dist/client/admin-config.js.map +0 -1
  321. package/dist/client/adminApi.d.ts.map +0 -1
  322. package/dist/client/adminApi.js +0 -736
  323. package/dist/client/adminApi.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trash-B3daldm5.js","assets/CmsPageHeader-ohOq0luT.js","assets/CmsToolbar-cEBlCHa3.js","assets/CmsEmptyState-CiMQwSQV.js","assets/badge-qPrc4AUM.js","assets/search-CbCbboeU.js","assets/CmsSurface-CWup6Jh7.js","assets/select-Co3TZFJb.js","assets/alert-Bf2l8kxw.js","assets/triangle-alert-BZRcqsUg.js","assets/rotate-ccw-DIqK63wY.js","assets/tanstack-adapter-npeE3RdY.js","assets/taxonomies-CgG46fIF.js","assets/label-DCsUdvFh.js","assets/textarea-BJ0XFZpT.js","assets/plus-xCFJK0RC.js","assets/scroll-area-B-yrE66a.js","assets/settings-BspTTv_o.js","assets/usePermissions-C1JQhfqb.js","assets/switch-CfavASmR.js","assets/media-DTJ3-ViE.js","assets/tabs-CN5s5u2W.js","assets/TaxonomyFilter-BgE_SR_O.js","assets/command-QOmNhlb0.js","assets/link-2-Czw1N61H.js","assets/content-types-CjQliqVV.js","assets/list-DtCsXj8-.js","assets/ErrorState-C4nJ-ml4.js","assets/content-OEBGlxg1.js","assets/circle-check-big-Dgozy3vV.js","assets/CmsStatusBadge-BdNf0V9v.js","assets/index-BH_ECMhv.js","assets/_entryId-BpSmrfAm.js","assets/ContentEntryEditor-BY5ypfUs.js","assets/useBreadcrumbLabel-DwZlwvFF.js","assets/_contentTypeId-DtZectcC.js","assets/new._contentTypeId-CoTDxKzf.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trash-BOCnIznD.js","assets/CmsPageHeader-CUtl5MMG.js","assets/CmsToolbar-CnfbcxeP.js","assets/CmsEmptyState-CkqBIab3.js","assets/badge-CmuOIVKp.js","assets/search-DwoUV2pv.js","assets/CmsSurface-CsJfAVa3.js","assets/select-hOZTp8aC.js","assets/alert-CF1BSzGR.js","assets/triangle-alert-CXFIO_Gu.js","assets/rotate-ccw-7k7-4VUq.js","assets/tanstack-adapter-B-Glm4kH.js","assets/taxonomies-kyk5P4ZW.js","assets/label-CHCnXeBk.js","assets/textarea-B6SfBmr0.js","assets/plus-Ceef7DHk.js","assets/scroll-area-CC6wujnp.js","assets/settings-t2PbCZh4.js","assets/usePermissions-M1ijZ7a6.js","assets/switch-jX2pDaNU.js","assets/media-Dc5PWt2Q.js","assets/tabs-q4EbZk7c.js","assets/TaxonomyFilter-CWCxC5HZ.js","assets/command-XJxnF2Sd.js","assets/link-2-Bb34judH.js","assets/content-types-CrNEm8Hf.js","assets/list-9Pzt48ld.js","assets/content-QBUxdxbS.js","assets/circle-check-big-BKDVG6DU.js","assets/CmsStatusBadge-CUYFgEe-.js","assets/index-C7xOwudI.js","assets/_entryId-CuVMExbb.js","assets/ContentEntryEditor-BU220CCy.js","assets/useBreadcrumbLabel-_6qBagc3.js","assets/_contentTypeId-DK8cskRt.js","assets/new._contentTypeId-C_I4YxIa.js"])))=>i.map(i=>d[i]);
2
2
  function q2(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const l=Object.getOwnPropertyDescriptor(s,a);l&&Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function XS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ch={exports:{}},ba={};var Ab;function V2(){if(Ab)return ba;Ab=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var f in a)f!=="key"&&(l[f]=a[f])}else l=a;return a=l.ref,{$$typeof:e,type:s,key:u,ref:a!==void 0?a:null,props:l}}return ba.Fragment=t,ba.jsx=r,ba.jsxs=r,ba}var Ob;function H2(){return Ob||(Ob=1,ch.exports=V2()),ch.exports}var _=H2(),lh={exports:{}},Se={};var Mb;function F2(){if(Mb)return Se;Mb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(N){return N===null||typeof N!="object"?null:(N=b&&N[b]||N["@@iterator"],typeof N=="function"?N:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function O(N,G,ee){this.props=N,this.context=G,this.refs=C,this.updater=ee||E}O.prototype.isReactComponent={},O.prototype.setState=function(N,G){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,G,"setState")},O.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function U(){}U.prototype=O.prototype;function k(N,G,ee){this.props=N,this.context=G,this.refs=C,this.updater=ee||E}var L=k.prototype=new U;L.constructor=k,x(L,O.prototype),L.isPureReactComponent=!0;var I=Array.isArray;function F(){}var $={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function W(N,G,ee){var re=ee.ref;return{$$typeof:e,type:N,key:G,ref:re!==void 0?re:null,props:ee}}function ne(N,G){return W(N.type,G,N.props)}function oe(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function ie(N){var G={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(ee){return G[ee]})}var de=/\/+/g;function ue(N,G){return typeof N=="object"&&N!==null&&N.key!=null?ie(""+N.key):G.toString(36)}function ve(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(F,F):(N.status="pending",N.then(function(G){N.status==="pending"&&(N.status="fulfilled",N.value=G)},function(G){N.status==="pending"&&(N.status="rejected",N.reason=G)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function j(N,G,ee,re,he){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var se=!1;if(N===null)se=!0;else switch(ge){case"bigint":case"string":case"number":se=!0;break;case"object":switch(N.$$typeof){case e:case t:se=!0;break;case y:return se=N._init,j(se(N._payload),G,ee,re,he)}}if(se)return he=he(N),se=re===""?"."+ue(N,0):re,I(he)?(ee="",se!=null&&(ee=se.replace(de,"$&/")+"/"),j(he,G,ee,"",function(ht){return ht})):he!=null&&(oe(he)&&(he=ne(he,ee+(he.key==null||N&&N.key===he.key?"":(""+he.key).replace(de,"$&/")+"/")+se)),G.push(he)),1;se=0;var Pe=re===""?".":re+":";if(I(N))for(var Ne=0;Ne<N.length;Ne++)re=N[Ne],ge=Pe+ue(re,Ne),se+=j(re,G,ee,ge,he);else if(Ne=S(N),typeof Ne=="function")for(N=Ne.call(N),Ne=0;!(re=N.next()).done;)re=re.value,ge=Pe+ue(re,Ne++),se+=j(re,G,ee,ge,he);else if(ge==="object"){if(typeof N.then=="function")return j(ve(N),G,ee,re,he);throw G=String(N),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return se}function Y(N,G,ee){if(N==null)return N;var re=[],he=0;return j(N,re,"","",function(ge){return G.call(ee,ge,he++)}),re}function V(N){if(N._status===-1){var G=N._result;G=G(),G.then(function(ee){(N._status===0||N._status===-1)&&(N._status=1,N._result=ee)},function(ee){(N._status===0||N._status===-1)&&(N._status=2,N._result=ee)}),N._status===-1&&(N._status=0,N._result=G)}if(N._status===1)return N._result.default;throw N._result}var te=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},be={map:Y,forEach:function(N,G,ee){Y(N,function(){G.apply(this,arguments)},ee)},count:function(N){var G=0;return Y(N,function(){G++}),G},toArray:function(N){return Y(N,function(G){return G})||[]},only:function(N){if(!oe(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Se.Activity=g,Se.Children=be,Se.Component=O,Se.Fragment=r,Se.Profiler=a,Se.PureComponent=k,Se.StrictMode=s,Se.Suspense=h,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Se.__COMPILER_RUNTIME={__proto__:null,c:function(N){return $.H.useMemoCache(N)}},Se.cache=function(N){return function(){return N.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(N,G,ee){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var re=x({},N.props),he=N.key;if(G!=null)for(ge in G.key!==void 0&&(he=""+G.key),G)!D.call(G,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&G.ref===void 0||(re[ge]=G[ge]);var ge=arguments.length-2;if(ge===1)re.children=ee;else if(1<ge){for(var se=Array(ge),Pe=0;Pe<ge;Pe++)se[Pe]=arguments[Pe+2];re.children=se}return W(N.type,he,re)},Se.createContext=function(N){return N={$$typeof:u,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:l,_context:N},N},Se.createElement=function(N,G,ee){var re,he={},ge=null;if(G!=null)for(re in G.key!==void 0&&(ge=""+G.key),G)D.call(G,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(he[re]=G[re]);var se=arguments.length-2;if(se===1)he.children=ee;else if(1<se){for(var Pe=Array(se),Ne=0;Ne<se;Ne++)Pe[Ne]=arguments[Ne+2];he.children=Pe}if(N&&N.defaultProps)for(re in se=N.defaultProps,se)he[re]===void 0&&(he[re]=se[re]);return W(N,ge,he)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(N){return{$$typeof:f,render:N}},Se.isValidElement=oe,Se.lazy=function(N){return{$$typeof:y,_payload:{_status:-1,_result:N},_init:V}},Se.memo=function(N,G){return{$$typeof:m,type:N,compare:G===void 0?null:G}},Se.startTransition=function(N){var G=$.T,ee={};$.T=ee;try{var re=N(),he=$.S;he!==null&&he(ee,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(F,te)}catch(ge){te(ge)}finally{G!==null&&ee.types!==null&&(G.types=ee.types),$.T=G}},Se.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Se.use=function(N){return $.H.use(N)},Se.useActionState=function(N,G,ee){return $.H.useActionState(N,G,ee)},Se.useCallback=function(N,G){return $.H.useCallback(N,G)},Se.useContext=function(N){return $.H.useContext(N)},Se.useDebugValue=function(){},Se.useDeferredValue=function(N,G){return $.H.useDeferredValue(N,G)},Se.useEffect=function(N,G){return $.H.useEffect(N,G)},Se.useEffectEvent=function(N){return $.H.useEffectEvent(N)},Se.useId=function(){return $.H.useId()},Se.useImperativeHandle=function(N,G,ee){return $.H.useImperativeHandle(N,G,ee)},Se.useInsertionEffect=function(N,G){return $.H.useInsertionEffect(N,G)},Se.useLayoutEffect=function(N,G){return $.H.useLayoutEffect(N,G)},Se.useMemo=function(N,G){return $.H.useMemo(N,G)},Se.useOptimistic=function(N,G){return $.H.useOptimistic(N,G)},Se.useReducer=function(N,G,ee){return $.H.useReducer(N,G,ee)},Se.useRef=function(N){return $.H.useRef(N)},Se.useState=function(N){return $.H.useState(N)},Se.useSyncExternalStore=function(N,G,ee){return $.H.useSyncExternalStore(N,G,ee)},Se.useTransition=function(){return $.H.useTransition()},Se.version="19.2.3",Se}var kb;function Ga(){return kb||(kb=1,lh.exports=F2()),lh.exports}var w=Ga();const Ot=XS(w),_u=q2({__proto__:null,default:Ot},[w]);var uh={exports:{}},Sa={},fh={exports:{}},dh={};var Nb;function Z2(){return Nb||(Nb=1,(function(e){function t(j,Y){var V=j.length;j.push(Y);e:for(;0<V;){var te=V-1>>>1,be=j[te];if(0<a(be,Y))j[te]=Y,j[V]=be,V=te;else break e}}function r(j){return j.length===0?null:j[0]}function s(j){if(j.length===0)return null;var Y=j[0],V=j.pop();if(V!==Y){j[0]=V;e:for(var te=0,be=j.length,N=be>>>1;te<N;){var G=2*(te+1)-1,ee=j[G],re=G+1,he=j[re];if(0>a(ee,V))re<be&&0>a(he,ee)?(j[te]=he,j[re]=V,te=re):(j[te]=ee,j[G]=V,te=G);else if(re<be&&0>a(he,V))j[te]=he,j[re]=V,te=re;else break e}}return Y}function a(j,Y){var V=j.sortIndex-Y.sortIndex;return V!==0?V:j.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],m=[],y=1,g=null,b=3,S=!1,E=!1,x=!1,C=!1,O=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function L(j){for(var Y=r(m);Y!==null;){if(Y.callback===null)s(m);else if(Y.startTime<=j)s(m),Y.sortIndex=Y.expirationTime,t(h,Y);else break;Y=r(m)}}function I(j){if(x=!1,L(j),!E)if(r(h)!==null)E=!0,F||(F=!0,ie());else{var Y=r(m);Y!==null&&ve(I,Y.startTime-j)}}var F=!1,$=-1,D=5,W=-1;function ne(){return C?!0:!(e.unstable_now()-W<D)}function oe(){if(C=!1,F){var j=e.unstable_now();W=j;var Y=!0;try{e:{E=!1,x&&(x=!1,U($),$=-1),S=!0;var V=b;try{t:{for(L(j),g=r(h);g!==null&&!(g.expirationTime>j&&ne());){var te=g.callback;if(typeof te=="function"){g.callback=null,b=g.priorityLevel;var be=te(g.expirationTime<=j);if(j=e.unstable_now(),typeof be=="function"){g.callback=be,L(j),Y=!0;break t}g===r(h)&&s(h),L(j)}else s(h);g=r(h)}if(g!==null)Y=!0;else{var N=r(m);N!==null&&ve(I,N.startTime-j),Y=!1}}break e}finally{g=null,b=V,S=!1}Y=void 0}}finally{Y?ie():F=!1}}}var ie;if(typeof k=="function")ie=function(){k(oe)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,ue=de.port2;de.port1.onmessage=oe,ie=function(){ue.postMessage(null)}}else ie=function(){O(oe,0)};function ve(j,Y){$=O(function(){j(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(j){switch(b){case 1:case 2:case 3:var Y=3;break;default:Y=b}var V=b;b=Y;try{return j()}finally{b=V}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(j,Y){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var V=b;b=j;try{return Y()}finally{b=V}},e.unstable_scheduleCallback=function(j,Y,V){var te=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?te+V:te):V=te,j){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=V+be,j={id:y++,callback:Y,priorityLevel:j,startTime:V,expirationTime:be,sortIndex:-1},V>te?(j.sortIndex=V,t(m,j),r(h)===null&&j===r(m)&&(x?(U($),$=-1):x=!0,ve(I,V-te))):(j.sortIndex=be,t(h,j),E||S||(E=!0,F||(F=!0,ie()))),j},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(j){var Y=b;return function(){var V=b;b=Y;try{return j.apply(this,arguments)}finally{b=V}}}})(dh)),dh}var zb;function Q2(){return zb||(zb=1,fh.exports=Z2()),fh.exports}var hh={exports:{}},At={};var Lb;function G2(){if(Lb)return At;Lb=1;var e=Ga();function t(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(h,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:h,containerInfo:m,implementation:y}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return At.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,At.createPortal=function(h,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(h,m,null,y)},At.flushSync=function(h){var m=u.T,y=s.p;try{if(u.T=null,s.p=2,h)return h()}finally{u.T=m,s.p=y,s.d.f()}},At.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(h,m))},At.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},At.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?s.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):y==="script"&&s.d.X(h,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},At.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);s.d.M(h,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(h)},At.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);s.d.L(h,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},At.preloadModule=function(h,m){if(typeof h=="string")if(m){var y=f(m.as,m.crossOrigin);s.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(h)},At.requestFormReset=function(h){s.d.r(h)},At.unstable_batchedUpdates=function(h,m){return h(m)},At.useFormState=function(h,m,y){return u.H.useFormState(h,m,y)},At.useFormStatus=function(){return u.H.useHostTransitionStatus()},At.version="19.2.3",At}var Db;function JS(){if(Db)return hh.exports;Db=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),hh.exports=G2(),hh.exports}var jb;function Y2(){if(jb)return Sa;jb=1;var e=Q2(),t=Ga(),r=JS();function s(n){var o="https://react.dev/errors/"+n;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)o+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var o=n,i=n;if(n.alternate)for(;o.return;)o=o.return;else{n=o;do o=n,(o.flags&4098)!==0&&(i=o.return),n=o.return;while(n)}return o.tag===3?i:null}function u(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function f(n){if(n.tag===31){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function h(n){if(l(n)!==n)throw Error(s(188))}function m(n){var o=n.alternate;if(!o){if(o=l(n),o===null)throw Error(s(188));return o!==n?null:n}for(var i=n,c=o;;){var d=i.return;if(d===null)break;var p=d.alternate;if(p===null){if(c=d.return,c!==null){i=c;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===i)return h(d),n;if(p===c)return h(d),o;p=p.sibling}throw Error(s(188))}if(i.return!==c.return)i=d,c=p;else{for(var v=!1,R=d.child;R;){if(R===i){v=!0,i=d,c=p;break}if(R===c){v=!0,c=d,i=p;break}R=R.sibling}if(!v){for(R=p.child;R;){if(R===i){v=!0,i=p,c=d;break}if(R===c){v=!0,c=p,i=d;break}R=R.sibling}if(!v)throw Error(s(189))}}if(i.alternate!==c)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?n:o}function y(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n;for(n=n.child;n!==null;){if(o=y(n),o!==null)return o;n=n.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),k=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function ie(n){return n===null||typeof n!="object"?null:(n=oe&&n[oe]||n["@@iterator"],typeof n=="function"?n:null)}var de=Symbol.for("react.client.reference");function ue(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===de?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case x:return"Fragment";case O:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case F:return"SuspenseList";case W:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case k:return n.displayName||"Context";case U:return(n._context.displayName||"Context")+".Consumer";case L:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return o=n.displayName||null,o!==null?o:ue(n.type)||"Memo";case D:o=n._payload,n=n._init;try{return ue(n(o))}catch{}}return null}var ve=Array.isArray,j=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},te=[],be=-1;function N(n){return{current:n}}function G(n){0>be||(n.current=te[be],te[be]=null,be--)}function ee(n,o){be++,te[be]=n.current,n.current=o}var re=N(null),he=N(null),ge=N(null),se=N(null);function Pe(n,o){switch(ee(ge,o),ee(he,n),ee(re,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?Xv(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=Xv(o),n=Jv(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(re),ee(re,n)}function Ne(){G(re),G(he),G(ge)}function ht(n){n.memoizedState!==null&&ee(se,n);var o=re.current,i=Jv(o,n.type);o!==i&&(ee(he,n),ee(re,i))}function Pt(n){he.current===n&&(G(re),G(he)),se.current===n&&(G(se),ma._currentValue=V)}var Ut,kt;function tr(n){if(Ut===void 0)try{throw Error()}catch(i){var o=i.stack.trim().match(/\n( *(at )?)/);Ut=o&&o[1]||"",kt=-1<i.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Ut+n+kt}var Ei=!1;function ss(n,o){if(!n||Ei)return"";Ei=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(o){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(Z){var H=Z}Reflect.construct(n,[],J)}else{try{J.call()}catch(Z){H=Z}n.call(J.prototype)}}else{try{throw Error()}catch(Z){H=Z}(J=n())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(Z){if(Z&&H&&typeof Z.stack=="string")return[Z.stack,H.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=c.DetermineComponentFrameRoot(),v=p[0],R=p[1];if(v&&R){var M=v.split(`
@@ -16,7 +16,7 @@ Error generating stack: `+c.message+`
16
16
  `);if(m>=0){const y=a.slice(0,m).trim();a=a.slice(m+1),y.length>0&&(u=JSON.parse(y),l=!0)}}}return(async()=>{try{for(;;){const{value:f,done:h}=await s.read();f&&(a+=f);const m=a.lastIndexOf(`
17
17
  `);if(m>=0){const y=a.slice(0,m);a=a.slice(m+1);const g=y.split(`
18
18
  `).filter(Boolean);for(const b of g)try{t(JSON.parse(b))}catch(S){r?.(`Invalid JSON line: ${b}`,S)}}if(h)break}}catch(f){r?.("Stream processing error:",f)}})(),t(u)}async function rk({jsonStream:e,onMessage:t,onError:r}){const s=e.getReader(),{value:a,done:l}=await s.read();if(l||!a)throw new Error("Stream ended before first object");const u=JSON.parse(a);return(async()=>{try{for(;;){const{value:f,done:h}=await s.read();if(h)break;if(f)try{t(JSON.parse(f))}catch(m){r?.(`Invalid JSON: ${f}`,m)}}}catch(f){r?.("Stream processing error:",f)}})(),t(u)}function l_(e){const t="/_serverFn/"+e;return Object.assign((...a)=>{const l=Pp()?.serverFns?.fetch;return WM(t,a,l??fetch)},{url:t,serverFnMeta:{id:e},[ip]:!0})}const ok={key:"$TSS/serverfn",test:e=>typeof e!="function"||!(ip in e)?!1:!!e[ip],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>l_(e)};var Vn=[],En=[],sk=Uint8Array,kh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Fs=0,ik=kh.length;Fs<ik;++Fs)Vn[Fs]=kh[Fs],En[kh.charCodeAt(Fs)]=Fs;En[45]=62;En[95]=63;function ak(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var s=r===t?0:4-r%4;return[r,s]}function ck(e,t,r){return(t+r)*3/4-r}function Ua(e){var t,r=ak(e),s=r[0],a=r[1],l=new sk(ck(e,s,a)),u=0,f=a>0?s-4:s,h;for(h=0;h<f;h+=4)t=En[e.charCodeAt(h)]<<18|En[e.charCodeAt(h+1)]<<12|En[e.charCodeAt(h+2)]<<6|En[e.charCodeAt(h+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=t&255;return a===2&&(t=En[e.charCodeAt(h)]<<2|En[e.charCodeAt(h+1)]>>4,l[u++]=t&255),a===1&&(t=En[e.charCodeAt(h)]<<10|En[e.charCodeAt(h+1)]<<4|En[e.charCodeAt(h+2)]>>2,l[u++]=t>>8&255,l[u++]=t&255),l}function lk(e){return Vn[e>>18&63]+Vn[e>>12&63]+Vn[e>>6&63]+Vn[e&63]}function uk(e,t,r){for(var s,a=[],l=t;l<r;l+=3)s=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),a.push(lk(s));return a.join("")}function $a(e){for(var t,r=e.length,s=r%3,a=[],l=16383,u=0,f=r-s;u<f;u+=l)a.push(uk(e,u,u+l>f?f:u+l));return s===1?(t=e[r-1],a.push(Vn[t>>2]+Vn[t<<4&63]+"==")):s===2&&(t=(e[r-2]<<8)+e[r-1],a.push(Vn[t>>10]+Vn[t>>4&63]+Vn[t<<2&63]+"=")),a.join("")}function xr(e){if(e===void 0)return{};if(!u_(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function fk(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function u_(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),s=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&s}const f_=!0,di=BigInt("-9223372036854775808"),Up=BigInt("9223372036854775807"),ap=BigInt("0"),dk=BigInt("8"),hk=BigInt("256");function d_(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function pk(e){e<ap&&(e-=di+di);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let s=0;for(const a of t.match(/.{2}/g).reverse())r.set([parseInt(a,16)],s++),e>>=dk;return $a(r)}function mk(e){const t=Ua(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=ap,s=ap;for(const a of t)r+=BigInt(a)*hk**s,s++;return r>Up&&(r+=di+di),r}function gk(e){if(e<di||Up<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),$a(new Uint8Array(t))}function yk(e){const t=Ua(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}const vk=DataView.prototype.setBigInt64?gk:pk,bk=DataView.prototype.getBigInt64?yk:mk,y0=1024;function h_(e){if(e.length>y0)throw new Error(`Field name ${e} exceeds maximum field name length ${y0}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function hi(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>hi(s));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const s=t[0][0];if(s==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Ua(e.$bytes).buffer}if(s==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return bk(e.$integer)}if(s==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const a=Ua(e.$float);if(a.byteLength!==8)throw new Error(`Received ${a.byteLength} bytes, expected 8 for $float`);const u=new DataView(a.buffer).getFloat64(0,f_);if(!d_(u))throw new Error(`Float ${u} should be encoded as a number`);return u}if(s==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(s==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[s,a]of Object.entries(e))h_(s),r[s]=hi(a);return r}const v0=16384;function za(e){const t=JSON.stringify(e,(r,s)=>s===void 0?"undefined":typeof s=="bigint"?`${s.toString()}n`:s);if(t.length>v0){const r="[...truncated]";let s=v0-r.length;const a=t.codePointAt(s-1);return a!==void 0&&a>65535&&(s-=1),t.substring(0,s)+r}return t}function cp(e,t,r,s){if(e===void 0){const u=r&&` (present at path ${r} in original object ${za(t)})`;throw new Error(`undefined is not a valid Convex value${u}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<di||Up<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:vk(e)}}if(typeof e=="number")if(d_(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,f_),{$float:$a(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:$a(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,f)=>cp(u,t,r+`[${f}]`));if(e instanceof Set)throw new Error(Nh(r,"Set",[...e],t));if(e instanceof Map)throw new Error(Nh(r,"Map",[...e],t));if(!u_(e)){const u=e?.constructor?.name,f=u?`${u} `:"";throw new Error(Nh(r,f,e,t))}const a={},l=Object.entries(e);l.sort(([u,f],[h,m])=>u===h?0:u<h?-1:1);for(const[u,f]of l)f!==void 0&&(h_(u),a[u]=cp(f,t,r+`.${u}`));return a}function Nh(e,t,r,s){return e?`${t}${za(r)} is not a supported Convex type (present at path ${e} in original object ${za(s)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${za(r)} is not a supported Convex type.`}function zn(e){return cp(e,e,"")}var Sk=Object.defineProperty,wk=(e,t,r)=>t in e?Sk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ke=(e,t,r)=>wk(e,typeof t!="symbol"?t+"":t,r);const _k="https://docs.convex.dev/error#undefined-validator";function Ia(e,t){const r=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${r} in ${e}. This is often caused by circular imports. See ${_k} for details.`)}class fn{constructor({isOptional:t}){Ke(this,"type"),Ke(this,"fieldPaths"),Ke(this,"isOptional"),Ke(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}}class $p extends fn{constructor({isOptional:t,tableName:r}){if(super({isOptional:t}),Ke(this,"tableName"),Ke(this,"kind","id"),typeof r!="string")throw new Error("v.id(tableName) requires a string");this.tableName=r}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new $p({isOptional:"optional",tableName:this.tableName})}}class su extends fn{constructor(){super(...arguments),Ke(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new su({isOptional:"optional"})}}class iu extends fn{constructor(){super(...arguments),Ke(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new iu({isOptional:"optional"})}}class Ip extends fn{constructor(){super(...arguments),Ke(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new Ip({isOptional:"optional"})}}class Bp extends fn{constructor(){super(...arguments),Ke(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new Bp({isOptional:"optional"})}}class qp extends fn{constructor(){super(...arguments),Ke(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new qp({isOptional:"optional"})}}class Vp extends fn{constructor(){super(...arguments),Ke(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new Vp({isOptional:"optional"})}}class Hp extends fn{constructor(){super(...arguments),Ke(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new Hp({isOptional:"optional"})}}class Bo extends fn{constructor({isOptional:t,fields:r}){super({isOptional:t}),Ke(this,"fields"),Ke(this,"kind","object"),globalThis.Object.entries(r).forEach(([s,a])=>{if(a===void 0&&Ia("v.object()",s),!a.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=r}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,r])=>[t,{fieldType:r.json,optional:r.isOptional==="optional"}]))}}asOptional(){return new Bo({isOptional:"optional",fields:this.fields})}omit(...t){const r={...this.fields};for(const s of t)delete r[s];return new Bo({isOptional:this.isOptional,fields:r})}pick(...t){const r={};for(const s of t)r[s]=this.fields[s];return new Bo({isOptional:this.isOptional,fields:r})}partial(){const t={};for(const[r,s]of globalThis.Object.entries(this.fields))t[r]=s.asOptional();return new Bo({isOptional:this.isOptional,fields:t})}extend(t){return new Bo({isOptional:this.isOptional,fields:{...this.fields,...t}})}}class Fp extends fn{constructor({isOptional:t,value:r}){if(super({isOptional:t}),Ke(this,"value"),Ke(this,"kind","literal"),typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"&&typeof r!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=r}get json(){return{type:this.kind,value:zn(this.value)}}asOptional(){return new Fp({isOptional:"optional",value:this.value})}}class Zp extends fn{constructor({isOptional:t,element:r}){super({isOptional:t}),Ke(this,"element"),Ke(this,"kind","array"),r===void 0&&Ia("v.array()"),this.element=r}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new Zp({isOptional:"optional",element:this.element})}}class Qp extends fn{constructor({isOptional:t,key:r,value:s}){if(super({isOptional:t}),Ke(this,"key"),Ke(this,"value"),Ke(this,"kind","record"),r===void 0&&Ia("v.record()","key"),s===void 0&&Ia("v.record()","value"),r.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(s.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!r.isConvexValidator||!s.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=r,this.value=s}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new Qp({isOptional:"optional",key:this.key,value:this.value})}}class Gp extends fn{constructor({isOptional:t,members:r}){super({isOptional:t}),Ke(this,"members"),Ke(this,"kind","union"),r.forEach((s,a)=>{if(s===void 0&&Ia("v.union()",`member at index ${a}`),!s.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=r}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new Gp({isOptional:"optional",members:this.members})}}const Fe={id:e=>new $p({isOptional:"required",tableName:e}),null:()=>new Vp({isOptional:"required"}),number:()=>new su({isOptional:"required"}),float64:()=>new su({isOptional:"required"}),bigint:()=>new iu({isOptional:"required"}),int64:()=>new iu({isOptional:"required"}),boolean:()=>new Ip({isOptional:"required"}),string:()=>new qp({isOptional:"required"}),bytes:()=>new Bp({isOptional:"required"}),literal:e=>new Fp({isOptional:"required",value:e}),array:e=>new Zp({isOptional:"required",element:e}),object:e=>new Bo({isOptional:"required",fields:e}),record:(e,t)=>new Qp({isOptional:"required",key:e,value:t}),union:(...e)=>new Gp({isOptional:"required",members:e}),any:()=>new Hp({isOptional:"required"}),optional:e=>e.asOptional(),nullable:e=>Fe.union(e,Fe.null())};var xk=Object.defineProperty,Ek=(e,t,r)=>t in e?xk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zh=(e,t,r)=>Ek(e,typeof t!="symbol"?t+"":t,r),b0,S0;const Rk=Symbol.for("ConvexError");class lp extends(S0=Error,b0=Rk,S0){constructor(t){super(typeof t=="string"?t:za(t)),zh(this,"name","ConvexError"),zh(this,"data"),zh(this,b0,!0),this.data=t}}const p_=()=>Array.from({length:4},()=>0);p_();p_();const w0="1.31.6";var Ck=Object.defineProperty,Tk=(e,t,r)=>t in e?Ck(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_0=(e,t,r)=>Tk(e,typeof t!="symbol"?t+"":t,r);const Ak="color:rgb(0, 145, 255)";function m_(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class g_{constructor(t){_0(this,"_onLogLineFuncs"),_0(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let r=Math.random().toString(36).substring(2,15);for(let s=0;s<10&&this._onLogLineFuncs[r]!==void 0;s++)r=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[r]=t,()=>{delete this._onLogLineFuncs[r]}}logVerbose(...t){if(this._verbose)for(const r of Object.values(this._onLogLineFuncs))r("debug",`${new Date().toISOString()}`,...t)}log(...t){for(const r of Object.values(this._onLogLineFuncs))r("info",...t)}warn(...t){for(const r of Object.values(this._onLogLineFuncs))r("warn",...t)}error(...t){for(const r of Object.values(this._onLogLineFuncs))r("error",...t)}}function y_(e){const t=new g_(e);return t.addLogLineListener((r,...s)=>{switch(r){case"debug":console.debug(...s);break;case"info":console.log(...s);break;case"warn":console.warn(...s);break;case"error":console.error(...s);break;default:console.log(...s)}}),t}function v_(e){return new g_(e)}function au(e,t,r,s,a){const l=m_(r);if(typeof a=="object"&&(a=`ConvexError ${JSON.stringify(a.errorData,null,2)}`),t==="info"){const u=a.match(/^\[.*?\] /);if(u===null){e.error(`[CONVEX ${l}(${s})] Could not parse console.log`);return}const f=a.slice(1,u[0].length-2),h=a.slice(u[0].length);e.log(`%c[CONVEX ${l}(${s})] [${f}]`,Ak,h)}else e.error(`[CONVEX ${l}(${s})] ${a}`)}function Ok(e,t){const r=`[CONVEX FATAL ERROR] ${t}`;return e.error(r),new Error(r)}function Ws(e,t,r){return`[CONVEX ${m_(e)}(${t})] ${r.errorMessage}
19
- Called by client`}function up(e,t){return t.data=e.errorData,t}function Xo(e){const t=e.split(":");let r,s;return t.length===1?(r=t[0],s="default"):(r=t.slice(0,t.length-1).join(":"),s=t[t.length-1]),r.endsWith(".js")&&(r=r.slice(0,-3)),`${r}:${s}`}function Qo(e,t){return JSON.stringify({udfPath:Xo(e),args:zn(t)})}function x0(e,t,r){const{initialNumItems:s,id:a}=r;return JSON.stringify({type:"paginated",udfPath:Xo(e),args:zn(t),options:zn({initialNumItems:s,id:a})})}var Mk=Object.defineProperty,kk=(e,t,r)=>t in e?Mk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Bn=(e,t,r)=>kk(e,typeof t!="symbol"?t+"":t,r);class Nk{constructor(){Bn(this,"nextQueryId"),Bn(this,"querySetVersion"),Bn(this,"querySet"),Bn(this,"queryIdToToken"),Bn(this,"identityVersion"),Bn(this,"auth"),Bn(this,"outstandingQueriesOlderThanRestart"),Bn(this,"outstandingAuthOlderThanRestart"),Bn(this,"paused"),Bn(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(t,r,s,a){const l=Xo(t),u=Qo(l,r),f=this.querySet.get(u);if(f!==void 0)return f.numSubscribers+=1,{queryToken:u,modification:null,unsubscribe:()=>this.removeSubscriber(u)};{const h=this.nextQueryId++,m={id:h,canonicalizedUdfPath:l,args:r,numSubscribers:1,journal:s,componentPath:a};this.querySet.set(u,m),this.queryIdToToken.set(h,u);const y=this.querySetVersion,g=this.querySetVersion+1,b={type:"Add",queryId:h,udfPath:l,args:[zn(r)],journal:s,componentPath:a};return this.paused?this.pendingQuerySetModifications.set(h,b):this.querySetVersion=g,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:y,newVersion:g,modifications:[b]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const r of t.modifications)switch(r.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);const s=r.journal;if(s!==void 0){const a=this.queryIdToToken.get(r.queryId);a!==void 0&&(this.querySet.get(a).journal=s)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}}queryId(t,r){const s=Xo(t),a=Qo(s,r),l=this.querySet.get(a);return l!==void 0?l.id:null}isCurrentOrNewerAuthVersion(t){return t>=this.identityVersion}getAuth(){return this.auth}setAuth(t){this.auth={tokenType:"User",value:t};const r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...this.auth}}setAdminAuth(t,r){const s={tokenType:"Admin",value:t,impersonating:r};this.auth=s;const a=this.identityVersion;return this.paused||(this.identityVersion=a+1),{type:"Authenticate",baseVersion:a,...s}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",tokenType:"None",baseVersion:t}}hasAuth(){return!!this.auth}isNewAuth(t){return this.auth?.value!==t}queryPath(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).canonicalizedUdfPath:null}queryArgs(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).args:null}queryToken(t){return this.queryIdToToken.get(t)??null}queryJournal(t){return this.querySet.get(t)?.journal}restart(t){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const r=[];for(const l of this.querySet.values()){const u={type:"Add",queryId:l.id,udfPath:l.canonicalizedUdfPath,args:[zn(l.args)],journal:l.journal,componentPath:l.componentPath};r.push(u),t.has(l.id)||this.outstandingQueriesOlderThanRestart.add(l.id)}this.querySetVersion=1;const s={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:r};if(!this.auth)return this.identityVersion=0,[s,void 0];this.outstandingAuthOlderThanRestart=!0;const a={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[s,a]}pause(){this.paused=!0}resume(){const t=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,r=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,r]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const r=this.querySet.get(t);if(r.numSubscribers>1)return r.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(r.id),this.outstandingQueriesOlderThanRestart.delete(r.id);const s=this.querySetVersion,a=this.querySetVersion+1,l={type:"Remove",queryId:r.id};return this.paused?this.pendingQuerySetModifications.has(r.id)?this.pendingQuerySetModifications.delete(r.id):this.pendingQuerySetModifications.set(r.id,l):this.querySetVersion=a,{type:"ModifyQuerySet",baseVersion:s,newVersion:a,modifications:[l]}}}}var zk=Object.defineProperty,Lk=(e,t,r)=>t in e?zk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Cl=(e,t,r)=>Lk(e,typeof t!="symbol"?t+"":t,r);class Dk{constructor(t,r){this.logger=t,this.markConnectionStateDirty=r,Cl(this,"inflightRequests"),Cl(this,"requestsOlderThanRestart"),Cl(this,"inflightMutationsCount",0),Cl(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,r){const s=new Promise(a=>{const l=r?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:l,requestedAt:new Date,onResult:a}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),s}onResponse(t){const r=this.inflightRequests.get(t.requestId);if(r===void 0||r.status.status==="Completed")return null;const s=r.message.type==="Mutation"?"mutation":"action",a=r.message.udfPath;for(const h of t.logLines)au(this.logger,"info",s,a,h);const l=r.status;let u,f;if(t.success)u={success:!0,logLines:t.logLines,value:hi(t.result)},f=()=>l.onResult(u);else{const h=t.result,{errorData:m}=t;au(this.logger,"error",s,a,h),u={success:!1,errorMessage:h,errorData:m!==void 0?hi(m):void 0,logLines:t.logLines},f=()=>l.onResult(u)}return t.type==="ActionResponse"||!t.success?(f(),this.inflightRequests.delete(t.requestId),this.requestsOlderThanRestart.delete(t.requestId),r.message.type==="Action"?this.inflightActionsCount--:r.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(r.status={status:"Completed",result:u,ts:t.ts,onResolve:f},null)}removeCompleted(t){const r=new Map;for(const[s,a]of this.inflightRequests.entries()){const l=a.status;l.status==="Completed"&&l.ts.lessThanOrEqual(t)&&(l.onResolve(),r.set(s,l.result),a.message.type==="Mutation"?this.inflightMutationsCount--:a.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(s),this.requestsOlderThanRestart.delete(s))}return r.size>0&&this.markConnectionStateDirty(),r}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[r,s]of this.inflightRequests){if(s.status.status==="NotSent"){s.status.status="Requested",t.push(s.message);continue}if(s.message.type==="Mutation")t.push(s.message);else if(s.message.type==="Action"){if(this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r),this.inflightActionsCount--,s.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");s.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,r]of this.inflightRequests)if(r.status.status==="NotSent"){r.status.status="Requested",t.push(r.message);continue}return t}hasIncompleteRequests(){for(const t of this.inflightRequests.values())if(t.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let t=Date.now();for(const r of this.inflightRequests.values())r.status.status!=="Completed"&&r.status.requestedAt.getTime()<t&&(t=r.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const Ba=Symbol.for("functionName"),b_=Symbol.for("toReferencePath");function jk(e){return e[b_]??null}function Pk(e){return e.startsWith("function://")}function Uk(e){let t;if(typeof e=="string")Pk(e)?t={functionHandle:e}:t={name:e};else if(e[Ba])t={name:e[Ba]};else{const r=jk(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}function Yt(e){const t=Uk(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const r=e[Ba];if(!r)throw new Error(`${e} is not a functionReference`);return r}function S_(e){return{[Ba]:e}}function w_(e=[]){const t={get(r,s){if(typeof s=="string"){const a=[...e,s];return w_(a)}else if(s===Ba){if(e.length<2){const u=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${u}\``)}const a=e.slice(0,-1).join("/"),l=e[e.length-1];return l==="default"?a:a+":"+l}else return s===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const $k=w_();var Ik=Object.defineProperty,Bk=(e,t,r)=>t in e?Ik(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cu=(e,t,r)=>Bk(e,typeof t!="symbol"?t+"":t,r);class qa{constructor(t){cu(this,"queryResults"),cu(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...r){const s=xr(r[0]),a=Yt(t),l=this.queryResults.get(Qo(a,s));if(l!==void 0)return qa.queryValue(l.result)}getAllQueries(t){const r=[],s=Yt(t);for(const a of this.queryResults.values())a.udfPath===Xo(s)&&r.push({args:a.args,value:qa.queryValue(a.result)});return r}setQuery(t,r,s){const a=xr(r),l=Yt(t),u=Qo(l,a);let f;s===void 0?f=void 0:f={success:!0,value:s,logLines:[]};const h={udfPath:l,args:a,result:f};this.queryResults.set(u,h),this.modifiedQueries.push(u)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}}class qk{constructor(){cu(this,"queryResults"),cu(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,r){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!r.has(u.mutationId));const s=this.queryResults;this.queryResults=new Map(t);const a=new qa(this.queryResults);for(const u of this.optimisticUpdates)u.update(a);const l=[];for(const[u,f]of this.queryResults){const h=s.get(u);(h===void 0||h.result!==f.result)&&l.push(u)}return l}applyOptimisticUpdate(t,r){this.optimisticUpdates.push({update:t,mutationId:r});const s=new qa(this.queryResults);return t(s),s.modifiedQueries}rawQueryResult(t){const r=this.queryResults.get(t);if(r!==void 0)return r.result}queryResult(t){const r=this.queryResults.get(t);if(r===void 0)return;const s=r.result;if(s!==void 0){if(s.success)return s.value;throw s.errorData!==void 0?up(s,new lp(Ws("query",r.udfPath,s))):new Error(Ws("query",r.udfPath,s))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var Vk=Object.defineProperty,Hk=(e,t,r)=>t in e?Vk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Lh=(e,t,r)=>Hk(e,typeof t!="symbol"?t+"":t,r);class Qt{constructor(t,r){Lh(this,"low"),Lh(this,"high"),Lh(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new Qt(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?E0:t>=Fk?Zk:new Qt(t%La|0,t/La|0)}toString(){return(BigInt(this.high)*BigInt(La)+BigInt(this.low)).toString()}equals(t){return Qt.isLong(t)||(t=Qt.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return Qt.isLong(t)||(t=Qt.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?Qt.fromNumber(t):new Qt(t.low,t.high)}}const E0=new Qt(0,0),R0=65536,La=R0*R0,Fk=La*La,Zk=new Qt(-1,-1);var Qk=Object.defineProperty,Gk=(e,t,r)=>t in e?Qk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Tl=(e,t,r)=>Gk(e,typeof t!="symbol"?t+"":t,r);class C0{constructor(t,r){Tl(this,"version"),Tl(this,"remoteQuerySet"),Tl(this,"queryPath"),Tl(this,"logger"),this.version={querySet:0,ts:Qt.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=r}transition(t){const r=t.startVersion;if(this.version.querySet!==r.querySet||this.version.ts.notEquals(r.ts)||this.version.identity!==r.identity)throw new Error(`Invalid start version: ${r.ts.toString()}:${r.querySet}:${r.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const s of t.modifications)switch(s.type){case"QueryUpdated":{const a=this.queryPath(s.queryId);if(a)for(const u of s.logLines)au(this.logger,"info","query",a,u);const l=hi(s.value??null);this.remoteQuerySet.set(s.queryId,{success:!0,value:l,logLines:s.logLines});break}case"QueryFailed":{const a=this.queryPath(s.queryId);if(a)for(const u of s.logLines)au(this.logger,"info","query",a,u);const{errorData:l}=s;this.remoteQuerySet.set(s.queryId,{success:!1,errorMessage:s.errorMessage,errorData:l!==void 0?hi(l):void 0,logLines:s.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(s.queryId);break}default:throw new Error(`Invalid modification ${s.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Dh(e){const t=Ua(e);return Qt.fromBytesLE(Array.from(t))}function Yk(e){const t=new Uint8Array(e.toBytesLE());return $a(t)}function T0(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Dh(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Dh(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Dh(e.endVersion.ts)}}}}function Kk(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:Yk(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var Xk=Object.defineProperty,Jk=(e,t,r)=>t in e?Xk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ut=(e,t,r)=>Jk(e,typeof t!="symbol"?t+"":t,r);const Wk=1e3,eN=1001,tN=1005,nN=4040;let ql;function Xs(){return ql===void 0&&(ql=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(ql+performance.now())}function A0(){return`t=${Math.round((Xs()-ql)/100)/10}s`}const __={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function rN(e){if(e===void 0)return"Unknown";for(const t of Object.keys(__))if(e.startsWith(t))return t;return"Unknown"}class oN{constructor(t,r,s,a,l,u){this.markConnectionStateDirty=l,this.debug=u,ut(this,"socket"),ut(this,"connectionCount"),ut(this,"_hasEverConnected",!1),ut(this,"lastCloseReason"),ut(this,"transitionChunkBuffer",null),ut(this,"defaultInitialBackoff"),ut(this,"maxBackoff"),ut(this,"retries"),ut(this,"serverInactivityThreshold"),ut(this,"reconnectDueToServerInactivityTimeout"),ut(this,"scheduledReconnect",null),ut(this,"networkOnlineHandler",null),ut(this,"pendingNetworkRecoveryInfo",null),ut(this,"uri"),ut(this,"onOpen"),ut(this,"onResume"),ut(this,"onMessage"),ut(this,"webSocketConstructor"),ut(this,"logger"),ut(this,"onServerDisconnectError"),this.webSocketConstructor=s,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=t,this.onOpen=r.onOpen,this.onResume=r.onResume,this.onMessage=r.onMessage,this.onServerDisconnectError=r.onServerDisconnectError,this.logger=a,this.setupNetworkListener(),this.connect()}setSocketState(t){this.socket=t,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(t){if(t.partNumber<0||t.partNumber>=t.totalParts||t.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==t.totalParts||this.transitionChunkBuffer.transitionId!==t.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:t.totalParts,transitionId:t.transitionId}),t.partNumber!==this.transitionChunkBuffer.chunks.length){const r=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${r}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const r=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const s=T0(JSON.parse(r));if(s.type!=="Transition")throw new Error(`Expected Transition, got ${s.type} after assembling chunks`);return s}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const t=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:t,paused:"no"}),this.resetServerInactivityTimeout(),t.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:t,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Xs()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",A0(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",A0())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:r}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:r}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(r/1e3)}s of waiting`)}},t.onerror=r=>{this.transitionChunkBuffer=null;const s=r.message;s&&this.logger.log(`WebSocket error message: ${s}`)},t.onmessage=r=>{this.resetServerInactivityTimeout();const s=r.data.length;let a=T0(JSON.parse(r.data));if(this._logVerbose(`received ws message with type ${a.type}`),a.type==="Ping")return;if(a.type==="TransitionChunk"){const u=this.assembleTransition(a);if(!u)return;a=u,this._logVerbose(`assembled full ws message of type ${a.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${a.type} while buffering TransitionChunks`)),a.type==="Transition"&&this.reportLargeTransition({messageLength:s,transition:a}),this.onMessage(a).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=r=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=r.reason||`closed with code ${r.code}`),r.code!==Wk&&r.code!==eN&&r.code!==tN&&r.code!==nN){let a=`WebSocket closed with code ${r.code}`;r.reason&&(a+=`: ${r.reason}`),this.logger.log(a),this.onServerDisconnectError&&r.reason&&this.onServerDisconnectError(a)}const s=rN(r.reason);this.scheduleReconnect(s)}}socketState(){return this.socket.state}sendMessage(t){const r={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const s=Kk(t),a=JSON.stringify(s);let l=!1;try{this.socket.ws.send(a),l=!0}catch(u){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${u}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${l?"sent":"failed to send"} message with type ${t.type}: ${JSON.stringify(r)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(r)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(t){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const r=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(r)}ms`);const s=Xs(),a=setTimeout(()=>{this.scheduledReconnect?.timeout===a&&(this.scheduledReconnect=null,this.connect())},r);this.scheduledReconnect={timeout:a,scheduledAt:s,backoffMs:r}}closeAndReconnect(t){switch(this._logVerbose(`begin closeAndReconnect with reason ${t}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=t,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const t=this.socket.ws;return t.onmessage=r=>{this._logVerbose("Ignoring message received after close")},new Promise(r=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),r()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=s=>{this._logVerbose("Ignoring message received after close")};const r=new Promise(s=>{t.onclose=()=>{s()}});return t.close(),r}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const t=this.close();return this.setSocketState({state:"terminated"}),t}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const t=this.close();return this.socket={state:"stopped"},t}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let t=null;if(this.scheduledReconnect){const r=Xs()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-r),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(r)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=t!==null?{timeSavedMs:t}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Xs()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(t){this.logger.logVerbose(t)}nextBackoff(t){const s=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:__[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const a=Math.min(s,this.maxBackoff),l=a*(Math.random()-.5);return a+l}reportLargeTransition({transition:t,messageLength:r}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const s=Xs()-t.clientClockSkew-t.serverTs/1e6,a=`${Math.round(s)}ms`,l=`${Math.round(r/1e4)/100}MB`,u=r/(s/1e3),f=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${l} transition in ${a} at ${f}`),r>2e7?this.logger.log(`received query results totaling more that 20MB (${l}) which will take a long time to download on slower connections`):s>2e4&&this.logger.log(`received query results totaling ${l} which took more than 20s to arrive (${a})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:s,messageLength:r}})}}function sN(){return iN()}function iN(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class Ta extends Error{}Ta.prototype.name="InvalidTokenError";function aN(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let s=r.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function cN(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return aN(t)}catch{return atob(t)}}function x_(e,t){if(typeof e!="string")throw new Ta("Invalid token specified: must be a string");t||(t={});const r=t.header===!0?0:1,s=e.split(".")[r];if(typeof s!="string")throw new Ta(`Invalid token specified: missing part #${r+1}`);let a;try{a=cN(s)}catch(l){throw new Ta(`Invalid token specified: invalid base64 for part #${r+1} (${l.message})`)}try{return JSON.parse(a)}catch(l){throw new Ta(`Invalid token specified: invalid json for part #${r+1} (${l.message})`)}}var lN=Object.defineProperty,uN=(e,t,r)=>t in e?lN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_n=(e,t,r)=>uN(e,typeof t!="symbol"?t+"":t,r);const fN=480*60*60*1e3,O0=2;class dN{constructor(t,r,s){_n(this,"authState",{state:"noAuth"}),_n(this,"configVersion",0),_n(this,"syncState"),_n(this,"authenticate"),_n(this,"stopSocket"),_n(this,"tryRestartSocket"),_n(this,"pauseSocket"),_n(this,"resumeSocket"),_n(this,"clearAuth"),_n(this,"logger"),_n(this,"refreshTokenLeewaySeconds"),_n(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=r.authenticate,this.stopSocket=r.stopSocket,this.tryRestartSocket=r.tryRestartSocket,this.pauseSocket=r.pauseSocket,this.resumeSocket=r.resumeSocket,this.clearAuth=r.clearAuth,this.logger=s.logger,this.refreshTokenLeewaySeconds=s.refreshTokenLeewaySeconds}async setConfig(t,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const s=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});s.isFromOutdatedConfig||(s.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:r},hasRetried:!1}),this.authenticate(s.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:r}}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket())}onTransition(t){if(this.syncState.isCurrentOrNewerAuthVersion(t.endVersion.identity)&&!(t.endVersion.identity<=t.startVersion.identity)){if(this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid"),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(t){if(t.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:r}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(r+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(t)}async tryToReauthenticate(t){if(this._logVerbose(`attempting to reauthenticate: ${t.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=O0){this.logger.error(`Failed to authenticate: "${t.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${O0-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const r=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});r.isFromOutdatedConfig||(r.value&&this.syncState.isNewAuth(r.value)?(this.authenticate(r.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:r.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value?this.syncState.isNewAuth(t.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:t.value,config:this.authState.config}),this.authenticate(t.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(t){if(this.authState.state==="noAuth")return;const r=this.decodeToken(t);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:s,exp:a}=r;if(!s||!a){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const l=a-s;if(l<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(fN,(l-this.refreshTokenLeewaySeconds)*1e3);u<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${l}s`),u=0);const f=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},u);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:f,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${u}ms`)}async fetchTokenAndGuardAgainstRace(t,r){const s=++this.configVersion;this._logVerbose(`fetching token with config version ${s}`);const a=await t(r);return this.configVersion!==s?(this._logVerbose(`stale config version, expected ${s}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:a}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(t){t(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:"noAuth"})}setAuthState(t){const r=t.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:t.hadAuth,state:t.state,token:`...${t.token.slice(-7)}`}:{state:t.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(r)}`),t.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&(clearTimeout(this.authState.refetchTokenTimeoutId),this.syncState.markAuthCompletion()),this.authState=t}decodeToken(t){try{return x_(t)}catch(r){return this._logVerbose(`Error decoding token: ${r instanceof Error?r.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const hN=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function pN(e,t){const r={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:r})}function mN(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function gN(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const r of hN){const s=performance.getEntriesByName(r).filter(a=>a.entryType==="mark").filter(a=>a.detail.sessionId===e);t.push(...s)}return t.map(mN)}var yN=Object.defineProperty,vN=(e,t,r)=>t in e?yN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ft=(e,t,r)=>vN(e,typeof t!="symbol"?t+"":t,r);class bN{constructor(t,r,s){if(ft(this,"address"),ft(this,"state"),ft(this,"requestManager"),ft(this,"webSocketManager"),ft(this,"authenticationManager"),ft(this,"remoteQuerySet"),ft(this,"optimisticQueryResults"),ft(this,"_transitionHandlerCounter",0),ft(this,"_nextRequestId"),ft(this,"_onTransitionFns",new Map),ft(this,"_sessionId"),ft(this,"firstMessageReceived",!1),ft(this,"debug"),ft(this,"logger"),ft(this,"maxObservedTimestamp"),ft(this,"connectionStateSubscribers",new Map),ft(this,"nextConnectionStateSubscriberId",0),ft(this,"_lastPublishedConnectionState"),ft(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const S=this.connectionState();if(JSON.stringify(S)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=S;for(const E of this.connectionStateSubscribers.values())E(S)}})}),ft(this,"mark",S=>{this.debug&&pN(S,this.sessionId)}),typeof t=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");s?.skipConvexDeploymentUrlCheck!==!0&&fk(t),s={...s};const a=s.authRefreshTokenLeewaySeconds??2;let l=s.webSocketConstructor;if(!l&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");l=l||WebSocket,this.debug=s.reportDebugInfoToConvex??!1,this.address=t,this.logger=s.logger===!1?v_({verbose:s.verbose??!1}):s.logger!==!0&&s.logger?s.logger:y_({verbose:s.verbose??!1});const u=t.search("://");if(u===-1)throw new Error("Provided address was not an absolute URL.");const f=t.substring(u+3),h=t.substring(0,u);let m;if(h==="http")m="ws";else if(h==="https")m="wss";else throw new Error(`Unknown parent protocol ${h}`);const y=`${m}://${f}/api/${w0}/sync`;this.state=new Nk,this.remoteQuerySet=new C0(S=>this.state.queryPath(S),this.logger),this.requestManager=new Dk(this.logger,this.markConnectionStateDirty);const g=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new dN(this.state,{authenticate:S=>{const E=this.state.setAuth(S);return this.webSocketManager.sendMessage(E),E.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:g,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:a}),this.optimisticQueryResults=new qk,this.addOnTransitionHandler(S=>{r(S.queries.map(E=>E.token))}),this._nextRequestId=0,this._sessionId=sN();const{unsavedChangesWarning:b}=s;if(typeof window>"u"||typeof window.addEventListener>"u"){if(b===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else b!==!1&&window.addEventListener("beforeunload",S=>{if(this.requestManager.hasIncompleteRequests()){S.preventDefault();const E="Are you sure you want to leave? Your changes may not be saved.";return(S||window.event).returnValue=E,E}});this.webSocketManager=new oN(y,{onOpen:S=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...S,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const E=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new C0(O=>this.state.queryPath(O),this.logger);const[x,C]=this.state.restart(E);C&&this.webSocketManager.sendMessage(C),this.webSocketManager.sendMessage(x);for(const O of this.requestManager.restart())this.webSocketManager.sendMessage(O)},onResume:()=>{const[S,E]=this.state.resume();E&&this.webSocketManager.sendMessage(E),S&&this.webSocketManager.sendMessage(S);for(const x of this.requestManager.resume())this.webSocketManager.sendMessage(x)},onMessage:S=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),S.type){case"Transition":{this.observedTimestamp(S.endVersion.ts),this.authenticationManager.onTransition(S),this.remoteQuerySet.transition(S),this.state.transition(S);const E=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(E);break}case"MutationResponse":{S.success&&this.observedTimestamp(S.ts);const E=this.requestManager.onResponse(S);E!==null&&this.notifyOnQueryResultChanges(new Map([[E.requestId,E.result]]));break}case"ActionResponse":{this.requestManager.onResponse(S);break}case"AuthError":{this.authenticationManager.onAuthError(S);break}case"FatalError":{const E=Ok(this.logger,S.error);throw this.webSocketManager.terminate(),E}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:s.onServerDisconnectError},l,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),s.expectAuth&&g()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()||this.state.hasSyncedPastLastReconnect()}observedTimestamp(t){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(t))&&(this.maxObservedTimestamp=t)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(t){const r=this.remoteQuerySet.remoteQueryResults(),s=new Map;for(const[l,u]of r){const f=this.state.queryToken(l);if(f!==null){const h={result:u,udfPath:this.state.queryPath(l),args:this.state.queryArgs(l)};s.set(f,h)}}const a=this.optimisticQueryResults.ingestQueryResultsFromServer(s,new Set(t.keys()));this.handleTransition({queries:a.map(l=>{const u=this.optimisticQueryResults.rawQueryResult(l);return{token:l,modification:{kind:"Updated",result:u}}}),reflectedMutations:Array.from(t).map(([l,u])=>({requestId:l,result:u})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(t){for(const r of this._onTransitionFns.values())r(t)}addOnTransitionHandler(t){const r=this._transitionHandlerCounter++;return this._onTransitionFns.set(r,t),()=>this._onTransitionFns.delete(r)}getCurrentAuthClaims(){const t=this.state.getAuth();let r={};if(t&&t.tokenType==="User")try{r=t?x_(t.value):{}}catch{r={}}else return;return{token:t.value,decoded:r}}setAuth(t,r){this.authenticationManager.setConfig(t,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,r){const s=this.state.setAdminAuth(t,r);this.webSocketManager.sendMessage(s)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,r,s){const a=xr(r),{modification:l,queryToken:u,unsubscribe:f}=this.state.subscribe(t,a,s?.journal,s?.componentPath);return l!==null&&this.webSocketManager.sendMessage(l),{queryToken:u,unsubscribe:()=>{const h=f();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,r){const s=xr(r),a=Qo(t,s);return this.optimisticQueryResults.queryResult(a)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,r){const s=xr(r),a=Qo(t,s);return this.optimisticQueryResults.queryLogs(a)}queryJournal(t,r){const s=xr(r),a=Qo(t,s);return this.state.queryJournal(a)}connectionState(){const t=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:t.isConnected,hasEverConnected:t.hasEverConnected,connectionCount:t.connectionCount,connectionRetries:t.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(t){const r=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(r,t),()=>{this.connectionStateSubscribers.delete(r)}}async mutation(t,r,s){const a=await this.mutationInternal(t,r,s);if(!a.success)throw a.errorData!==void 0?up(a,new lp(Ws("mutation",t,a))):new Error(Ws("mutation",t,a));return a.value}async mutationInternal(t,r,s,a){const{mutationPromise:l}=this.enqueueMutation(t,r,s,a);return l}enqueueMutation(t,r,s,a){const l=xr(r);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,s!==void 0){const y=s.optimisticUpdate;if(y!==void 0){const g=E=>{y(E,l)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},S=this.optimisticQueryResults.applyOptimisticUpdate(g,u).map(E=>{const x=this.localQueryResultByToken(E);return{token:E,modification:{kind:"Updated",result:x===void 0?void 0:{success:!0,value:x,logLines:[]}}}});this.handleTransition({queries:S,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const f={type:"Mutation",requestId:u,udfPath:t,componentPath:a,args:[zn(l)]},h=this.webSocketManager.sendMessage(f),m=this.requestManager.request(f,h);return{requestId:u,mutationPromise:m}}async action(t,r){const s=await this.actionInternal(t,r);if(!s.success)throw s.errorData!==void 0?up(s,new lp(Ws("action",t,s))):new Error(Ws("action",t,s));return s.value}async actionInternal(t,r,s){const a=xr(r),l=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:l,udfPath:t,componentPath:s,args:[zn(a)]},f=this.webSocketManager.sendMessage(u);return this.requestManager.request(u,f)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const t=gN(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:t})}}tryReportLongDisconnect(){if(!this.debug)return;const t=this.connectionState().timeOfOldestInflightRequest;if(t===null||Date.now()-t.getTime()<=60*1e3)return;const r=`${this.address}/api/debug_event`;fetch(r,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${w0}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(s=>{s.ok||this.logger.warn("Analytics request failed with response:",s.body)}).catch(s=>{this.logger.warn("Analytics response failed with error:",s)})}}function jh(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var SN=Object.defineProperty,wN=(e,t,r)=>t in e?SN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M0=(e,t,r)=>wN(e,typeof t!="symbol"?t+"":t,r);class _N{constructor(t,r){this.client=t,this.onTransition=r,M0(this,"paginatedQuerySet",new Map),M0(this,"lastTransitionTs"),this.lastTransitionTs=Qt.fromNumber(0),this.client.addOnTransitionHandler(s=>this.onBaseTransition(s))}subscribe(t,r,s){const a=Xo(t),l=x0(a,r,s),u=()=>this.removePaginatedQuerySubscriber(l),f=this.paginatedQuerySet.get(l);return f?(f.numSubscribers+=1,{paginatedQueryToken:l,unsubscribe:u}):(this.paginatedQuerySet.set(l,{token:l,canonicalizedUdfPath:a,args:r,numSubscribers:1,options:{initialNumItems:s.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:s.id}),this.addPageToPaginatedQuery(l,null,s.initialNumItems),{paginatedQueryToken:l,unsubscribe:u})}localQueryResult(t,r,s){const a=Xo(t),l=x0(a,r,s);return this.localQueryResultByToken(l)}localQueryResultByToken(t){const r=this.paginatedQuerySet.get(t);if(!r)return;const s=this.activePageQueryTokens(r);if(s.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let a=[],l=!1,u=!1;for(const h of s){const m=this.client.localQueryResultByToken(h);if(m===void 0){l=!0,u=!1;continue}const y=jh(m);a=a.concat(y.page),u=!!y.isDone}let f;return l?f=a.length===0?"LoadingFirstPage":"LoadingMore":u?f="Exhausted":f="CanLoadMore",{results:a,status:f,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const r=t.queries.map(u=>u.token),s=this.queriesContainingTokens(r);let a=[];s.length>0&&(this.processPaginatedQuerySplits(s,u=>this.client.localQueryResultByToken(u)),a=s.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const l={...t,paginatedQueries:a};this.onTransition(l)}loadMoreOfPaginatedQuery(t,r){this.mustGetPaginatedQuery(t);const s=this.queryTokenForLastPageOfPaginatedQuery(t),a=this.client.localQueryResultByToken(s);if(!a)return!1;const l=jh(a);if(l.isDone)return!1;this.addPageToPaginatedQuery(t,l.continueCursor,r);const u={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:t,modification:{kind:"Updated",result:this.localQueryResultByToken(t)}}]};return this.onTransition(u),!0}queriesContainingTokens(t){if(t.length===0)return[];const r=[],s=new Set(t);for(const[a,l]of this.paginatedQuerySet)for(const u of this.allQueryTokens(l))if(s.has(u)){r.push(a);break}return r}processPaginatedQuerySplits(t,r){for(const s of t){const a=this.mustGetPaginatedQuery(s),{ongoingSplits:l,pageKeyToQuery:u,pageKeys:f}=a;for(const[h,[m,y]]of l)r(u.get(m).queryToken)!==void 0&&r(u.get(y).queryToken)!==void 0&&this.completePaginatedQuerySplit(a,h,m,y);for(const h of f){if(l.has(h))continue;const m=u.get(h).queryToken,y=r(m);if(!y)continue;const g=jh(y);g.splitCursor&&(g.pageStatus==="SplitRecommended"||g.pageStatus==="SplitRequired"||g.page.length>a.options.initialNumItems*2)&&this.splitPaginatedQueryPage(a,h,g.splitCursor,g.continueCursor)}}}splitPaginatedQueryPage(t,r,s,a){const l=t.nextPageKey++,u=t.nextPageKey++,f={cursor:a,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:null,endCursor:s}});t.pageKeyToQuery.set(l,h);const m=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:s,endCursor:a}});t.pageKeyToQuery.set(u,m),t.ongoingSplits.set(r,[l,u])}addPageToPaginatedQuery(t,r,s){const a=this.mustGetPaginatedQuery(t),l=a.nextPageKey++,u={cursor:r,numItems:s,id:a.id},f={...a.args,paginationOpts:u},h=this.client.subscribe(a.canonicalizedUdfPath,f);return a.pageKeys.push(l),a.pageKeyToQuery.set(l,h),h}removePaginatedQuerySubscriber(t){const r=this.paginatedQuerySet.get(t);if(r&&(r.numSubscribers-=1,!(r.numSubscribers>0))){for(const s of r.pageKeyToQuery.values())s.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,r,s,a){const l=t.pageKeyToQuery.get(r);t.pageKeyToQuery.delete(r);const u=t.pageKeys.indexOf(r);t.pageKeys.splice(u,1,s,a),t.ongoingSplits.delete(r),l.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(r=>t.pageKeyToQuery.get(r).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(r=>r.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const r=this.mustGetPaginatedQuery(t),s=r.pageKeys[r.pageKeys.length-1];if(s===void 0)throw new Error(`No pages for paginated query ${t}`);return r.pageKeyToQuery.get(s).queryToken}mustGetPaginatedQuery(t){const r=this.paginatedQuerySet.get(t);if(!r)throw new Error("paginated query no longer exists for token "+t);return r}}function xN({getCurrentValue:e,subscribe:t}){const[r,s]=w.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let a=r.value;return(r.getCurrentValue!==e||r.subscribe!==t)&&(a=e(),s({getCurrentValue:e,subscribe:t,value:a})),w.useEffect(()=>{let l=!1;const u=()=>{l||s(h=>{if(h.getCurrentValue!==e||h.subscribe!==t)return h;const m=e();return h.value===m?h:{...h,value:m}})},f=t(u);return u(),()=>{l=!0,f()}},[e,t]),a}var EN=Object.defineProperty,RN=(e,t,r)=>t in e?EN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wr=(e,t,r)=>RN(e,typeof t!="symbol"?t+"":t,r);const CN=5e3;if(typeof Ot>"u")throw new Error("Required dependency 'react' not found");function E_(e,t,r){function s(a){return kN(a),t.mutation(e,a,{optimisticUpdate:r})}return s.withOptimisticUpdate=function(l){if(r!==void 0)throw new Error(`Already specified optimistic update for mutation ${Yt(e)}`);return E_(e,t,l)},s}class TN{constructor(t,r){if(wr(this,"address"),wr(this,"cachedSync"),wr(this,"cachedPaginatedQueryClient"),wr(this,"listeners"),wr(this,"options"),wr(this,"closed",!1),wr(this,"_logger"),wr(this,"adminAuth"),wr(this,"fakeUserIdentity"),t===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof t!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof t} instead.`);if(!t.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=t,this.listeners=new Map,this._logger=r?.logger===!1?v_({verbose:r?.verbose??!1}):r?.logger!==!0&&r?.logger?r.logger:y_({verbose:r?.verbose??!1}),this.options={...r,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new bN(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new _N(this.cachedSync,t=>this.handleTransition(t)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(t,r){if(typeof t=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(t,r??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,r){if(this.adminAuth=t,this.fakeUserIdentity=r,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,r)}watchQuery(t,...r){const[s,a]=r,l=Yt(t);return{onUpdate:u=>{const{queryToken:f,unsubscribe:h}=this.sync.subscribe(l,s,a),m=this.listeners.get(f);return m!==void 0?m.add(u):this.listeners.set(f,new Set([u])),()=>{if(this.closed)return;const y=this.listeners.get(f);y.delete(u),y.size===0&&this.listeners.delete(f),h()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(l,s)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(l,s)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(l,s)}}}prewarmQuery(t){const r=t.extendSubscriptionFor??CN,a=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(a,r)}watchPaginatedQuery(t,r,s){const a=Yt(t);return{onUpdate:l=>{const{paginatedQueryToken:u,unsubscribe:f}=this.paginatedQueryClient.subscribe(a,r||{},s),h=this.listeners.get(u);return h!==void 0?h.add(l):this.listeners.set(u,new Set([l])),()=>{if(this.closed)return;const m=this.listeners.get(u);m.delete(l),m.size===0&&this.listeners.delete(u),f()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(a,r,s)}}mutation(t,...r){const[s,a]=r,l=Yt(t);return this.sync.mutation(l,s,a)}action(t,...r){const s=Yt(t);return this.sync.action(s,...r)}query(t,...r){const s=this.watchQuery(t,...r),a=s.localQueryResult();return a!==void 0?Promise.resolve(a):new Promise((l,u)=>{const f=s.onUpdate(()=>{f();try{l(s.localQueryResult())}catch(h){u(h)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(t){return this.sync.subscribeToConnectionState(t)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const t=this.cachedSync;this.cachedSync=void 0,await t.close()}}handleTransition(t){const r=t.queries.map(a=>a.token),s=t.paginatedQueries.map(a=>a.token);this.transition([...r,...s])}transition(t){for(const r of t){const s=this.listeners.get(r);if(s)for(const a of s)a()}}}const Yp=Ot.createContext(void 0);function AN(){return w.useContext(Yp)}const ON=({client:e,children:t})=>Ot.createElement(Yp.Provider,{value:e},t);function MN(e,...t){const r=t[0]==="skip",s=t[0]==="skip"?{}:xr(t[0]),a=typeof e=="string"?S_(e):e,l=Yt(a),u=w.useMemo(()=>r?{}:{query:{query:a,args:s}},[JSON.stringify(zn(s)),l,r]),h=DN(u).query;if(h instanceof Error)throw h;return h}function HB(e){const t=typeof e=="string"?S_(e):e,r=w.useContext(Yp);if(r===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>E_(t,r),[r,Yt(t)])}function kN(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var NN=Object.defineProperty,zN=(e,t,r)=>t in e?NN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ph=(e,t,r)=>zN(e,typeof t!="symbol"?t+"":t,r);class LN{constructor(t){Ph(this,"createWatch"),Ph(this,"queries"),Ph(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const r of Object.keys(t)){const{query:s,args:a,paginationOptions:l}=t[r];if(Yt(s),this.queries[r]===void 0)this.addQuery(r,s,a,l?{paginationOptions:l}:{});else{const u=this.queries[r];(Yt(s)!==Yt(u.query)||JSON.stringify(zn(a))!==JSON.stringify(zn(u.args))||JSON.stringify(l)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(r),this.addQuery(r,s,a,l?{paginationOptions:l}:{}))}}for(const r of Object.keys(this.queries))t[r]===void 0&&this.removeQuery(r)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const r={};for(const s of Object.keys(t)){const{query:a,args:l}=t[s],u=t[s].paginationOptions;Yt(a);const f=this.createWatch(a,l,u?{paginationOptions:u}:{});let h;try{h=f.localQueryResult()}catch(m){if(m instanceof Error)h=m;else throw m}r[s]=h}return r}setCreateWatch(t){this.createWatch=t;for(const r of Object.keys(this.queries)){const{query:s,args:a,watch:l,paginationOptions:u}=this.queries[r],f="journal"in l?l.journal():void 0;this.removeQuery(r),this.addQuery(r,s,a,{...f?{journal:f}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,r,s,{paginationOptions:a,journal:l}){if(this.queries[t]!==void 0)throw new Error(`Tried to add a new query with identifier ${t} when it already exists.`);const u=this.createWatch(r,s,{...l?{journal:l}:[],...a?{paginationOptions:a}:{}}),f=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:r,args:s,watch:u,unsubscribe:f,...a?{paginationOptions:a}:{}}}removeQuery(t){const r=this.queries[t];if(r===void 0)throw new Error(`No query found with identifier ${t}.`);r.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function DN(e){const t=AN();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const r=w.useMemo(()=>(s,a,{journal:l,paginationOptions:u})=>u?t.watchPaginatedQuery(s,a,u):t.watchQuery(s,a,l?{journal:l}:{}),[t]);return jN(e,r)}function jN(e,t){const[r]=w.useState(()=>new LN(t));r.createWatch!==t&&r.setCreateWatch(t),w.useEffect(()=>()=>r.destroy(),[r]);const s=w.useMemo(()=>({getCurrentValue:()=>r.getLocalResults(e),subscribe:a=>(r.setQueries(e),r.subscribe(a))}),[r,e]);return xN(s)}const PN="/assets/globals-hAmgC66w.css";const R_=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();const UN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const $N=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());const k0=e=>{const t=$N(e);return t.charAt(0).toUpperCase()+t.slice(1)};var IN={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"};const BN=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const qN=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:u,...f},h)=>w.createElement("svg",{ref:h,...IN,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:R_("lucide",a),...!l&&!BN(f)&&{"aria-hidden":"true"},...f},[...u.map(([m,y])=>w.createElement(m,y)),...Array.isArray(l)?l:[l]]));const we=(e,t)=>{const r=w.forwardRef(({className:s,...a},l)=>w.createElement(qN,{ref:l,iconNode:t,className:R_(`lucide-${UN(k0(e))}`,`lucide-${e}`,s),...a}));return r.displayName=k0(e),r};const VN=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],HN=we("archive",VN);const FN=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],fp=we("bell",FN);const ZN=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],QN=we("book",ZN);const GN=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],YN=we("bookmark",GN);const KN=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],XN=we("braces",KN);const JN=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],WN=we("calendar",JN);const ez=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],C_=we("chevron-down",ez);const tz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nz=we("chevron-right",tz);const rz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],oz=we("circle-alert",rz);const sz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],T_=we("circle-question-mark",sz);const iz=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],az=we("clock",iz);const cz=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lz=we("code",cz);const uz=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],fz=we("dollar-sign",uz);const dz=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],hz=we("external-link",dz);const pz=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],mz=we("eye",pz);const gz=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],yz=we("file-code",gz);const vz=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],bz=we("file-text",vz);const Sz=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],wz=we("flag",Sz);const _z=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],xz=we("folder",_z);const Ez=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Rz=we("globe",Ez);const Cz=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Tz=we("hash",Cz);const Az=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Oz=we("heart",Az);const Mz=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],A_=we("house",Mz);const kz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Nz=we("image",kz);const zz=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],O_=we("layers",zz);const Lz=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Dz=we("layout-dashboard",Lz);const jz=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Pz=we("link",jz);const Uz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$z=we("loader-circle",Uz);const Iz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Bz=we("lock",Iz);const qz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Vz=we("log-out",qz);const Hz=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Fz=we("mail",Hz);const Zz=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Qz=we("map-pin",Zz);const Gz=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Yz=we("message-square",Gz);const Kz=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Xz=we("package",Kz);const Jz=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Wz=we("phone",Jz);const e3=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t3=we("settings",e3);const n3=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],r3=we("square-check-big",n3);const o3=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],s3=we("square-pen",o3);const i3=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],a3=we("star",i3);const c3=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],l3=we("tags",c3);const u3=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],f3=we("toggle-left",u3);const d3=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],h3=we("trash-2",d3);const p3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],M_=we("user",p3);function k_(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=k_(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function N_(){for(var e,t,r=0,s="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=k_(e))&&(s&&(s+=" "),s+=t);return s}const m3=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},g3=(e,t)=>({classGroupId:e,validator:t}),z_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),lu="-",N0=[],y3="arbitrary..",v3=e=>{const t=S3(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return b3(u);const f=u.split(lu),h=f[0]===""&&f.length>1?1:0;return L_(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=s[u],m=r[u];return h?m?m3(m,h):h:m||N0}return r[u]||N0}}},L_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],l=r.nextPart.get(a);if(l){const m=L_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const f=t===0?e.join(lu):e.slice(t).join(lu),h=u.length;for(let m=0;m<h;m++){const y=u[m];if(y.validator(f))return y.classGroupId}},b3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?y3+s:void 0})(),S3=e=>{const{theme:t,classGroups:r}=e;return w3(r,t)},w3=(e,t)=>{const r=z_();for(const s in e){const a=e[s];Kp(a,r,s,t)}return r},Kp=(e,t,r,s)=>{const a=e.length;for(let l=0;l<a;l++){const u=e[l];_3(u,t,r,s)}},_3=(e,t,r,s)=>{if(typeof e=="string"){x3(e,t,r);return}if(typeof e=="function"){E3(e,t,r,s);return}R3(e,t,r,s)},x3=(e,t,r)=>{const s=e===""?t:D_(t,e);s.classGroupId=r},E3=(e,t,r,s)=>{if(C3(e)){Kp(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(g3(r,e))},R3=(e,t,r,s)=>{const a=Object.entries(e),l=a.length;for(let u=0;u<l;u++){const[f,h]=a[u];Kp(h,D_(t,f),r,s)}},D_=(e,t)=>{let r=e;const s=t.split(lu),a=s.length;for(let l=0;l<a;l++){const u=s[l];let f=r.nextPart.get(u);f||(f=z_(),r.nextPart.set(u,f)),r=f}return r},C3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,T3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const a=(l,u)=>{r[l]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return a(l,u),u},set(l,u){l in r?r[l]=u:a(l,u)}}},dp="!",z0=":",A3=[],L0=(e,t,r,s,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:a}),O3=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=a=>{const l=[];let u=0,f=0,h=0,m;const y=a.length;for(let x=0;x<y;x++){const C=a[x];if(u===0&&f===0){if(C===z0){l.push(a.slice(h,x)),h=x+1;continue}if(C==="/"){m=x;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const g=l.length===0?a:a.slice(h);let b=g,S=!1;g.endsWith(dp)?(b=g.slice(0,-1),S=!0):g.startsWith(dp)&&(b=g.slice(1),S=!0);const E=m&&m>h?m-h:void 0;return L0(l,S,b,E)};if(t){const a=t+z0,l=s;s=u=>u.startsWith(a)?l(u.slice(a.length)):L0(A3,!1,u,void 0,!0)}if(r){const a=s;s=l=>r({className:l,parseClassName:a})}return s},M3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let a=[];for(let l=0;l<r.length;l++){const u=r[l],f=u[0]==="[",h=t.has(u);f||h?(a.length>0&&(a.sort(),s.push(...a),a=[]),s.push(u)):a.push(u)}return a.length>0&&(a.sort(),s.push(...a)),s}},k3=e=>({cache:T3(e.cacheSize),parseClassName:O3(e),sortModifiers:M3(e),...v3(e)}),N3=/\s+/,z3=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:l}=t,u=[],f=e.trim().split(N3);let h="";for(let m=f.length-1;m>=0;m-=1){const y=f[m],{isExternal:g,modifiers:b,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:x}=r(y);if(g){h=y+(h.length>0?" "+h:h);continue}let C=!!x,O=s(C?E.substring(0,x):E);if(!O){if(!C){h=y+(h.length>0?" "+h:h);continue}if(O=s(E),!O){h=y+(h.length>0?" "+h:h);continue}C=!1}const U=b.length===0?"":b.length===1?b[0]:l(b).join(":"),k=S?U+dp:U,L=k+O;if(u.indexOf(L)>-1)continue;u.push(L);const I=a(O,C);for(let F=0;F<I.length;++F){const $=I[F];u.push(k+$)}h=y+(h.length>0?" "+h:h)}return h},L3=(...e)=>{let t=0,r,s,a="";for(;t<e.length;)(r=e[t++])&&(s=j_(r))&&(a&&(a+=" "),a+=s);return a},j_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=j_(e[s]))&&(r&&(r+=" "),r+=t);return r},D3=(e,...t)=>{let r,s,a,l;const u=h=>{const m=t.reduce((y,g)=>g(y),e());return r=k3(m),s=r.cache.get,a=r.cache.set,l=f,f(h)},f=h=>{const m=s(h);if(m)return m;const y=z3(h,r);return a(h,y),y};return l=u,(...h)=>l(L3(...h))},j3=[],gt=e=>{const t=r=>r[e]||j3;return t.isThemeGetter=!0,t},P_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,U_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,P3=/^\d+\/\d+$/,U3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,I3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zs=e=>P3.test(e),Re=e=>!!e&&!Number.isNaN(Number(e)),no=e=>!!e&&Number.isInteger(Number(e)),Uh=e=>e.endsWith("%")&&Re(e.slice(0,-1)),_r=e=>U3.test(e),V3=()=>!0,H3=e=>$3.test(e)&&!I3.test(e),$_=()=>!1,F3=e=>B3.test(e),Z3=e=>q3.test(e),Q3=e=>!ce(e)&&!le(e),G3=e=>yi(e,q_,$_),ce=e=>P_.test(e),Io=e=>yi(e,V_,H3),$h=e=>yi(e,W3,Re),D0=e=>yi(e,I_,$_),Y3=e=>yi(e,B_,Z3),Al=e=>yi(e,H_,F3),le=e=>U_.test(e),Ra=e=>vi(e,V_),K3=e=>vi(e,eL),j0=e=>vi(e,I_),X3=e=>vi(e,q_),J3=e=>vi(e,B_),Ol=e=>vi(e,H_,!0),yi=(e,t,r)=>{const s=P_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},vi=(e,t,r=!1)=>{const s=U_.exec(e);return s?s[1]?t(s[1]):r:!1},I_=e=>e==="position"||e==="percentage",B_=e=>e==="image"||e==="url",q_=e=>e==="length"||e==="size"||e==="bg-size",V_=e=>e==="length",W3=e=>e==="number",eL=e=>e==="family-name",H_=e=>e==="shadow",tL=()=>{const e=gt("color"),t=gt("font"),r=gt("text"),s=gt("font-weight"),a=gt("tracking"),l=gt("leading"),u=gt("breakpoint"),f=gt("container"),h=gt("spacing"),m=gt("radius"),y=gt("shadow"),g=gt("inset-shadow"),b=gt("text-shadow"),S=gt("drop-shadow"),E=gt("blur"),x=gt("perspective"),C=gt("aspect"),O=gt("ease"),U=gt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...L(),le,ce],F=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],D=()=>[le,ce,h],W=()=>[Zs,"full","auto",...D()],ne=()=>[no,"none","subgrid",le,ce],oe=()=>["auto",{span:["full",no,le,ce]},no,le,ce],ie=()=>[no,"auto",le,ce],de=()=>["auto","min","max","fr",le,ce],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ve=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...D()],Y=()=>[Zs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],V=()=>[e,le,ce],te=()=>[...L(),j0,D0,{position:[le,ce]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",X3,G3,{size:[le,ce]}],G=()=>[Uh,Ra,Io],ee=()=>["","none","full",m,le,ce],re=()=>["",Re,Ra,Io],he=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Re,Uh,j0,D0],Pe=()=>["","none",E,le,ce],Ne=()=>["none",Re,le,ce],ht=()=>["none",Re,le,ce],Pt=()=>[Re,le,ce],Ut=()=>[Zs,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_r],breakpoint:[_r],color:[V3],container:[_r],"drop-shadow":[_r],ease:["in","out","in-out"],font:[Q3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_r],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_r],shadow:[_r],spacing:["px",Re],text:[_r],"text-shadow":[_r],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zs,ce,le,C]}],container:["container"],columns:[{columns:[Re,ce,le,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{start:W()}],end:[{end:W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[no,"auto",le,ce]}],basis:[{basis:[Zs,"full","auto",f,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Zs,"auto","initial","none",ce]}],grow:[{grow:["",Re,le,ce]}],shrink:[{shrink:["",Re,le,ce]}],order:[{order:[no,"first","last","none",le,ce]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:oe()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...ve()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...ve(),"baseline"]}],"place-self":[{"place-self":["auto",...ve()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[f,"screen",...Y()]}],"min-w":[{"min-w":[f,"screen","none",...Y()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,Ra,Io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,le,$h]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Uh,ce]}],"font-family":[{font:[K3,ce,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,le,ce]}],"line-clamp":[{"line-clamp":[Re,"none",le,$h]}],leading:[{leading:[l,...D()]}],"list-image":[{"list-image":["none",le,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",le,Io]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Re,"auto",le,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},no,le,ce],radial:["",le,ce],conic:[no,le,ce]},J3,Y3]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,le,ce]}],"outline-w":[{outline:["",Re,Ra,Io]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",y,Ol,Al]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",g,Ol,Al]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Re,Io]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",b,Ol,Al]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Re,le,ce]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[le,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":L()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,ce]}],filter:[{filter:["","none",le,ce]}],blur:[{blur:Pe()}],brightness:[{brightness:[Re,le,ce]}],contrast:[{contrast:[Re,le,ce]}],"drop-shadow":[{"drop-shadow":["","none",S,Ol,Al]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Re,le,ce]}],"hue-rotate":[{"hue-rotate":[Re,le,ce]}],invert:[{invert:["",Re,le,ce]}],saturate:[{saturate:[Re,le,ce]}],sepia:[{sepia:["",Re,le,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",le,ce]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[Re,le,ce]}],"backdrop-contrast":[{"backdrop-contrast":[Re,le,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,le,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,le,ce]}],"backdrop-invert":[{"backdrop-invert":["",Re,le,ce]}],"backdrop-opacity":[{"backdrop-opacity":[Re,le,ce]}],"backdrop-saturate":[{"backdrop-saturate":[Re,le,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,le,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",le,ce]}],ease:[{ease:["linear","initial",O,le,ce]}],delay:[{delay:[Re,le,ce]}],animate:[{animate:["none",U,le,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,le,ce]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:ht()}],"scale-x":[{"scale-x":ht()}],"scale-y":[{"scale-y":ht()}],"scale-z":[{"scale-z":ht()}],"scale-3d":["scale-3d"],skew:[{skew:Pt()}],"skew-x":[{"skew-x":Pt()}],"skew-y":[{"skew-y":Pt()}],transform:[{transform:[le,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ut()}],"translate-x":[{"translate-x":Ut()}],"translate-y":[{"translate-y":Ut()}],"translate-z":[{"translate-z":Ut()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le,ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le,ce]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Re,Ra,Io,$h]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nL=D3(tL);function Dt(...e){return nL(N_(e))}Fe.union(Fe.literal("admin"),Fe.literal("editor"),Fe.literal("author"),Fe.literal("viewer"));const rL=Fe.union(Fe.literal("contentTypes"),Fe.literal("contentEntries"),Fe.literal("mediaItems"),Fe.literal("settings")),oL=Fe.union(Fe.literal("create"),Fe.literal("read"),Fe.literal("update"),Fe.literal("delete"),Fe.literal("publish"),Fe.literal("unpublish"),Fe.literal("restore"),Fe.literal("manage"),Fe.literal("move"));Fe.object({resource:rL,action:oL,scope:Fe.optional(Fe.union(Fe.literal("all"),Fe.literal("own")))});function Da(e,t="all"){return[{resource:e,action:"create",scope:t},{resource:e,action:"read",scope:t},{resource:e,action:"update",scope:t},{resource:e,action:"delete",scope:t}]}function ai(e,t="all"){return[{resource:e,action:"read",scope:t}]}function F_(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const sL={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...Da("contentTypes"),...Da("contentEntries"),...F_(),{resource:"contentEntries",action:"restore"},...Da("mediaItems"),{resource:"settings",action:"manage"},...ai("settings")]},iL={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...ai("contentTypes"),...Da("contentEntries"),...F_(),{resource:"contentEntries",action:"restore"},...Da("mediaItems")]},aL={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...ai("contentTypes"),{resource:"contentEntries",action:"create"},{resource:"contentEntries",action:"read",scope:"own"},{resource:"contentEntries",action:"update",scope:"own"},{resource:"contentEntries",action:"delete",scope:"own"},{resource:"contentEntries",action:"publish",scope:"own"},{resource:"contentEntries",action:"unpublish",scope:"own"},{resource:"mediaItems",action:"create"},{resource:"mediaItems",action:"read",scope:"all"},{resource:"mediaItems",action:"update",scope:"own"},{resource:"mediaItems",action:"delete",scope:"own"}]},cL={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...ai("contentTypes"),...ai("contentEntries"),...ai("mediaItems")]},Xp={admin:sL,editor:iL,author:aL,viewer:cL};function lL(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const r=e.scope??"all",s=t.scope??"all";return r==="all"?!0:s==="own"}function uL(e,t,r){const s=Xp[e]??r?.[e];return s?s.permissions.some(a=>lL(a,t)):!1}function fL(e,t){return(Xp[e]??t?.[e])?.permissions??[]}function dL(e,t){return Xp[e]??t?.[e]}function hL(e,t,r){return fL(e,r).filter(s=>s.resource===t)}function FB(e,t,r){return hL(e,t,r).length>0}const Z_=w.createContext(null);function pL({children:e,getUser:t,getUserRole:r,onLogout:s,autoRedirectToLogin:a=!1,loginUrl:l="/login"}){const[u,f]=w.useState(null),[h,m]=w.useState(null),[y,g]=w.useState("loading"),[b,S]=w.useState(null),E=w.useCallback(async()=>{g("loading"),S(null);try{const k=await t();if(!k){f(null),m(null),g("unauthenticated"),a&&typeof window<"u"&&(window.location.href=l);return}const L=await r({userId:k.id});f(k),m(L),g("authenticated")}catch(k){console.error("Authentication error:",k),f(null),m(null),S(k instanceof Error?k.message:"Authentication failed"),g("error")}},[t,r,a,l]);w.useEffect(()=>{E()},[E]);const x=w.useCallback(k=>h?uL(h,k):!1,[h]),C=w.useCallback(async()=>{try{s&&await s(),f(null),m(null),g("unauthenticated"),a&&typeof window<"u"&&(window.location.href=l)}catch(k){console.error("Logout error:",k),S(k instanceof Error?k.message:"Logout failed")}},[s,a,l]),O=w.useCallback(async()=>{await E()},[E]),U={user:u,role:h,authState:y,isLoading:y==="loading",isAuthenticated:y==="authenticated",error:b,checkPermission:x,logout:C,refresh:O};return _.jsx(Z_.Provider,{value:U,children:e})}function Q_(){const e=w.useContext(Z_);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const G_=w.createContext(null),Y_="convex-cms-theme";function P0(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function U0(){if(typeof window>"u")return"system";const e=localStorage.getItem(Y_);return e==="light"||e==="dark"||e==="system"?e:"system"}function mL({children:e}){const[t,r]=w.useState(()=>U0()),[s,a]=w.useState(()=>{const f=U0();return f==="system"?P0():f}),l=w.useCallback(f=>{const h=f==="system"?P0():f;a(h);const m=document.documentElement;m.classList.remove("light","dark"),m.classList.add(h)},[]),u=w.useCallback(f=>{r(f),localStorage.setItem(Y_,f),l(f)},[l]);return w.useEffect(()=>{l(t)},[t,l]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t==="system"&&l("system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[t,l]),_.jsx(G_.Provider,{value:{theme:t,resolvedTheme:s,setTheme:u},children:e})}function ZB(){const e=w.useContext(G_);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function X(e,t,r){function s(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);const m=u.prototype,y=Object.keys(m);for(let g=0;g<y.length;g++){const b=y[g];b in f||(f[b]=m[b].bind(f))}}const a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function u(f){var h;const m=r?.Parent?new l:this;s(m,f),(h=m._zod).deferred??(h.deferred=[]);for(const y of m._zod.deferred)y();return m}return Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class K_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const X_={};function uo(e){return X_}function J_(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,a])=>t.indexOf(+s)===-1).map(([s,a])=>a)}function hp(e,t){return typeof t=="bigint"?t.toString():t}function Jp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wp(e){return e==null}function em(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function gL(e,t){const r=(e.toString().split(".")[1]||"").length,s=t.toString();let a=(s.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(s)){const h=s.match(/\d?e-(\d?)/);h?.[1]&&(a=Number.parseInt(h[1]))}const l=r>a?r:a,u=Number.parseInt(e.toFixed(l).replace(".","")),f=Number.parseInt(t.toFixed(l).replace(".",""));return u%f/10**l}const $0=Symbol("evaluating");function Ie(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==$0)return s===void 0&&(s=$0,s=r()),s},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function ts(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vo(...e){const t={};for(const r of e){const s=Object.getOwnPropertyDescriptors(r);Object.assign(t,s)}return Object.defineProperties({},t)}function I0(e){return JSON.stringify(e)}function yL(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const W_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function uu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vL=Jp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function pi(e){if(uu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(uu(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function e1(e){return pi(e)?{...e}:Array.isArray(e)?[...e]:e}const bL=new Set(["string","number","symbol"]);function Lu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bo(e,t,r){const s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function me(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function SL(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const wL={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function _L(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=vo(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=r.shape[f])}return ts(this,"shape",u),u},checks:[]});return bo(e,l)}function xL(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=vo(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return ts(this,"shape",u),u},checks:[]});return bo(e,l)}function EL(e,t){if(!pi(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const a=vo(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return ts(this,"shape",l),l}});return bo(e,a)}function RL(e,t){if(!pi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=vo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ts(this,"shape",s),s}});return bo(e,r)}function CL(e,t){const r=vo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ts(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return bo(e,r)}function TL(e,t,r){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=vo(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(r)for(const m in r){if(!(m in f))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(h[m]=e?new e({type:"optional",innerType:f[m]}):f[m])}else for(const m in f)h[m]=e?new e({type:"optional",innerType:f[m]}):f[m];return ts(this,"shape",h),h},checks:[]});return bo(t,u)}function AL(e,t,r){const s=vo(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:a[u]}))}else for(const u in a)l[u]=new e({type:"nonoptional",innerType:a[u]});return ts(this,"shape",l),l}});return bo(t,s)}function ei(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ti(e,t){return t.map(r=>{var s;return(s=r).path??(s.path=[]),r.path.unshift(e),r})}function Ml(e){return typeof e=="string"?e:e?.message}function fo(e,t,r){const s={...e,path:e.path??[]};if(!e.message){const a=Ml(e.inst?._zod.def?.error?.(e))??Ml(t?.error?.(e))??Ml(r.customError?.(e))??Ml(r.localeError?.(e))??"Invalid input";s.message=a}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function tm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Va(...e){const[t,r,s]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:s}:{...t}}const t1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,hp,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},n1=X("$ZodError",t1),r1=X("$ZodError",t1,{Parent:Error});function OL(e,t=r=>r.message){const r={},s=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):s.push(t(a));return{formErrors:s,fieldErrors:r}}function ML(e,t=r=>r.message){const r={_errors:[]},s=a=>{for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>s({issues:u}));else if(l.code==="invalid_key")s({issues:l.issues});else if(l.code==="invalid_element")s({issues:l.issues});else if(l.path.length===0)r._errors.push(t(l));else{let u=r,f=0;for(;f<l.path.length;){const h=l.path[f];f===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return s(e),r}const nm=e=>(t,r,s,a)=>{const l=s?Object.assign(s,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new ci;if(u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>fo(h,l,uo())));throw W_(f,a?.callee),f}return u.value},rm=e=>async(t,r,s,a)=>{const l=s?Object.assign(s,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>fo(h,l,uo())));throw W_(f,a?.callee),f}return u.value},Du=e=>(t,r,s)=>{const a=s?{...s,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},a);if(l instanceof Promise)throw new ci;return l.issues.length?{success:!1,error:new(e??n1)(l.issues.map(u=>fo(u,a,uo())))}:{success:!0,data:l.value}},kL=Du(r1),ju=e=>async(t,r,s)=>{const a=s?Object.assign(s,{async:!0}):{async:!0};let l=t._zod.run({value:r,issues:[]},a);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>fo(u,a,uo())))}:{success:!0,data:l.value}},NL=ju(r1),zL=e=>(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return nm(e)(t,r,a)},LL=e=>(t,r,s)=>nm(e)(t,r,s),DL=e=>async(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return rm(e)(t,r,a)},jL=e=>async(t,r,s)=>rm(e)(t,r,s),PL=e=>(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Du(e)(t,r,a)},UL=e=>(t,r,s)=>Du(e)(t,r,s),$L=e=>async(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ju(e)(t,r,a)},IL=e=>async(t,r,s)=>ju(e)(t,r,s),BL=/^[cC][^\s-]{8,}$/,qL=/^[0-9a-z]+$/,VL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,HL=/^[0-9a-vA-V]{20}$/,FL=/^[A-Za-z0-9]{27}$/,ZL=/^[a-zA-Z0-9_-]{21}$/,QL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,GL=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B0=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,YL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function XL(){return new RegExp(KL,"u")}const JL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,WL=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eD=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o1=/^[A-Za-z0-9_-]*$/,rD=/^\+[1-9]\d{6,14}$/,s1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oD=new RegExp(`^${s1}$`);function i1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sD(e){return new RegExp(`^${i1(e)}$`)}function iD(e){const t=i1({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${r.join("|")})`;return new RegExp(`^${s1}T(?:${s})$`)}const aD=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},cD=/^-?\d+$/,a1=/^-?\d+(?:\.\d+)?$/,lD=/^(?:true|false)$/i,uD=/^[^A-Z]*$/,fD=/^[^a-z]*$/,Xt=X("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),c1={number:"number",bigint:"bigint",object:"date"},l1=X("$ZodCheckLessThan",(e,t)=>{Xt.init(e,t);const r=c1[typeof t.value];e._zod.onattach.push(s=>{const a=s._zod.bag,l=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),u1=X("$ZodCheckGreaterThan",(e,t)=>{Xt.init(e,t);const r=c1[typeof t.value];e._zod.onattach.push(s=>{const a=s._zod.bag,l=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dD=X("$ZodCheckMultipleOf",(e,t)=>{Xt.init(e,t),e._zod.onattach.push(r=>{var s;(s=r._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):gL(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),hD=X("$ZodCheckNumberFormat",(e,t)=>{Xt.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),s=r?"int":"number",[a,l]=wL[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=a,f.maximum=l,r&&(f.pattern=cD)}),e._zod.check=u=>{const f=u.value;if(r){if(!Number.isInteger(f)){u.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}f<a&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),f>l&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),pD=X("$ZodCheckMaxLength",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const a=s.value;if(a.length<=t.maximum)return;const u=tm(a);s.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),mD=X("$ZodCheckMinLength",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const a=s.value;if(a.length>=t.minimum)return;const u=tm(a);s.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),gD=X("$ZodCheckLengthEquals",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=s=>{const a=s.value,l=a.length;if(l===t.length)return;const u=tm(a),f=l>t.length;s.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),Pu=X("$ZodCheckStringFormat",(e,t)=>{var r,s;Xt.init(e,t),e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),yD=X("$ZodCheckRegex",(e,t)=>{Pu.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vD=X("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uD),Pu.init(e,t)}),bD=X("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fD),Pu.init(e,t)}),SD=X("$ZodCheckIncludes",(e,t)=>{Xt.init(e,t);const r=Lu(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(s)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),wD=X("$ZodCheckStartsWith",(e,t)=>{Xt.init(e,t);const r=new RegExp(`^${Lu(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),_D=X("$ZodCheckEndsWith",(e,t)=>{Xt.init(e,t);const r=new RegExp(`.*${Lu(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),xD=X("$ZodCheckOverwrite",(e,t)=>{Xt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class ED{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const s=t.split(`
19
+ Called by client`}function up(e,t){return t.data=e.errorData,t}function Xo(e){const t=e.split(":");let r,s;return t.length===1?(r=t[0],s="default"):(r=t.slice(0,t.length-1).join(":"),s=t[t.length-1]),r.endsWith(".js")&&(r=r.slice(0,-3)),`${r}:${s}`}function Qo(e,t){return JSON.stringify({udfPath:Xo(e),args:zn(t)})}function x0(e,t,r){const{initialNumItems:s,id:a}=r;return JSON.stringify({type:"paginated",udfPath:Xo(e),args:zn(t),options:zn({initialNumItems:s,id:a})})}var Mk=Object.defineProperty,kk=(e,t,r)=>t in e?Mk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Bn=(e,t,r)=>kk(e,typeof t!="symbol"?t+"":t,r);class Nk{constructor(){Bn(this,"nextQueryId"),Bn(this,"querySetVersion"),Bn(this,"querySet"),Bn(this,"queryIdToToken"),Bn(this,"identityVersion"),Bn(this,"auth"),Bn(this,"outstandingQueriesOlderThanRestart"),Bn(this,"outstandingAuthOlderThanRestart"),Bn(this,"paused"),Bn(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(t,r,s,a){const l=Xo(t),u=Qo(l,r),f=this.querySet.get(u);if(f!==void 0)return f.numSubscribers+=1,{queryToken:u,modification:null,unsubscribe:()=>this.removeSubscriber(u)};{const h=this.nextQueryId++,m={id:h,canonicalizedUdfPath:l,args:r,numSubscribers:1,journal:s,componentPath:a};this.querySet.set(u,m),this.queryIdToToken.set(h,u);const y=this.querySetVersion,g=this.querySetVersion+1,b={type:"Add",queryId:h,udfPath:l,args:[zn(r)],journal:s,componentPath:a};return this.paused?this.pendingQuerySetModifications.set(h,b):this.querySetVersion=g,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:y,newVersion:g,modifications:[b]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const r of t.modifications)switch(r.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);const s=r.journal;if(s!==void 0){const a=this.queryIdToToken.get(r.queryId);a!==void 0&&(this.querySet.get(a).journal=s)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}}queryId(t,r){const s=Xo(t),a=Qo(s,r),l=this.querySet.get(a);return l!==void 0?l.id:null}isCurrentOrNewerAuthVersion(t){return t>=this.identityVersion}getAuth(){return this.auth}setAuth(t){this.auth={tokenType:"User",value:t};const r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...this.auth}}setAdminAuth(t,r){const s={tokenType:"Admin",value:t,impersonating:r};this.auth=s;const a=this.identityVersion;return this.paused||(this.identityVersion=a+1),{type:"Authenticate",baseVersion:a,...s}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",tokenType:"None",baseVersion:t}}hasAuth(){return!!this.auth}isNewAuth(t){return this.auth?.value!==t}queryPath(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).canonicalizedUdfPath:null}queryArgs(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).args:null}queryToken(t){return this.queryIdToToken.get(t)??null}queryJournal(t){return this.querySet.get(t)?.journal}restart(t){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const r=[];for(const l of this.querySet.values()){const u={type:"Add",queryId:l.id,udfPath:l.canonicalizedUdfPath,args:[zn(l.args)],journal:l.journal,componentPath:l.componentPath};r.push(u),t.has(l.id)||this.outstandingQueriesOlderThanRestart.add(l.id)}this.querySetVersion=1;const s={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:r};if(!this.auth)return this.identityVersion=0,[s,void 0];this.outstandingAuthOlderThanRestart=!0;const a={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[s,a]}pause(){this.paused=!0}resume(){const t=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,r=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,r]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const r=this.querySet.get(t);if(r.numSubscribers>1)return r.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(r.id),this.outstandingQueriesOlderThanRestart.delete(r.id);const s=this.querySetVersion,a=this.querySetVersion+1,l={type:"Remove",queryId:r.id};return this.paused?this.pendingQuerySetModifications.has(r.id)?this.pendingQuerySetModifications.delete(r.id):this.pendingQuerySetModifications.set(r.id,l):this.querySetVersion=a,{type:"ModifyQuerySet",baseVersion:s,newVersion:a,modifications:[l]}}}}var zk=Object.defineProperty,Lk=(e,t,r)=>t in e?zk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Cl=(e,t,r)=>Lk(e,typeof t!="symbol"?t+"":t,r);class Dk{constructor(t,r){this.logger=t,this.markConnectionStateDirty=r,Cl(this,"inflightRequests"),Cl(this,"requestsOlderThanRestart"),Cl(this,"inflightMutationsCount",0),Cl(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,r){const s=new Promise(a=>{const l=r?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:l,requestedAt:new Date,onResult:a}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),s}onResponse(t){const r=this.inflightRequests.get(t.requestId);if(r===void 0||r.status.status==="Completed")return null;const s=r.message.type==="Mutation"?"mutation":"action",a=r.message.udfPath;for(const h of t.logLines)au(this.logger,"info",s,a,h);const l=r.status;let u,f;if(t.success)u={success:!0,logLines:t.logLines,value:hi(t.result)},f=()=>l.onResult(u);else{const h=t.result,{errorData:m}=t;au(this.logger,"error",s,a,h),u={success:!1,errorMessage:h,errorData:m!==void 0?hi(m):void 0,logLines:t.logLines},f=()=>l.onResult(u)}return t.type==="ActionResponse"||!t.success?(f(),this.inflightRequests.delete(t.requestId),this.requestsOlderThanRestart.delete(t.requestId),r.message.type==="Action"?this.inflightActionsCount--:r.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(r.status={status:"Completed",result:u,ts:t.ts,onResolve:f},null)}removeCompleted(t){const r=new Map;for(const[s,a]of this.inflightRequests.entries()){const l=a.status;l.status==="Completed"&&l.ts.lessThanOrEqual(t)&&(l.onResolve(),r.set(s,l.result),a.message.type==="Mutation"?this.inflightMutationsCount--:a.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(s),this.requestsOlderThanRestart.delete(s))}return r.size>0&&this.markConnectionStateDirty(),r}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[r,s]of this.inflightRequests){if(s.status.status==="NotSent"){s.status.status="Requested",t.push(s.message);continue}if(s.message.type==="Mutation")t.push(s.message);else if(s.message.type==="Action"){if(this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r),this.inflightActionsCount--,s.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");s.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,r]of this.inflightRequests)if(r.status.status==="NotSent"){r.status.status="Requested",t.push(r.message);continue}return t}hasIncompleteRequests(){for(const t of this.inflightRequests.values())if(t.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let t=Date.now();for(const r of this.inflightRequests.values())r.status.status!=="Completed"&&r.status.requestedAt.getTime()<t&&(t=r.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const Ba=Symbol.for("functionName"),b_=Symbol.for("toReferencePath");function jk(e){return e[b_]??null}function Pk(e){return e.startsWith("function://")}function Uk(e){let t;if(typeof e=="string")Pk(e)?t={functionHandle:e}:t={name:e};else if(e[Ba])t={name:e[Ba]};else{const r=jk(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}function Yt(e){const t=Uk(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const r=e[Ba];if(!r)throw new Error(`${e} is not a functionReference`);return r}function S_(e){return{[Ba]:e}}function w_(e=[]){const t={get(r,s){if(typeof s=="string"){const a=[...e,s];return w_(a)}else if(s===Ba){if(e.length<2){const u=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${u}\``)}const a=e.slice(0,-1).join("/"),l=e[e.length-1];return l==="default"?a:a+":"+l}else return s===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const $k=w_();var Ik=Object.defineProperty,Bk=(e,t,r)=>t in e?Ik(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cu=(e,t,r)=>Bk(e,typeof t!="symbol"?t+"":t,r);class qa{constructor(t){cu(this,"queryResults"),cu(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...r){const s=xr(r[0]),a=Yt(t),l=this.queryResults.get(Qo(a,s));if(l!==void 0)return qa.queryValue(l.result)}getAllQueries(t){const r=[],s=Yt(t);for(const a of this.queryResults.values())a.udfPath===Xo(s)&&r.push({args:a.args,value:qa.queryValue(a.result)});return r}setQuery(t,r,s){const a=xr(r),l=Yt(t),u=Qo(l,a);let f;s===void 0?f=void 0:f={success:!0,value:s,logLines:[]};const h={udfPath:l,args:a,result:f};this.queryResults.set(u,h),this.modifiedQueries.push(u)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}}class qk{constructor(){cu(this,"queryResults"),cu(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,r){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!r.has(u.mutationId));const s=this.queryResults;this.queryResults=new Map(t);const a=new qa(this.queryResults);for(const u of this.optimisticUpdates)u.update(a);const l=[];for(const[u,f]of this.queryResults){const h=s.get(u);(h===void 0||h.result!==f.result)&&l.push(u)}return l}applyOptimisticUpdate(t,r){this.optimisticUpdates.push({update:t,mutationId:r});const s=new qa(this.queryResults);return t(s),s.modifiedQueries}rawQueryResult(t){const r=this.queryResults.get(t);if(r!==void 0)return r.result}queryResult(t){const r=this.queryResults.get(t);if(r===void 0)return;const s=r.result;if(s!==void 0){if(s.success)return s.value;throw s.errorData!==void 0?up(s,new lp(Ws("query",r.udfPath,s))):new Error(Ws("query",r.udfPath,s))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var Vk=Object.defineProperty,Hk=(e,t,r)=>t in e?Vk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Lh=(e,t,r)=>Hk(e,typeof t!="symbol"?t+"":t,r);class Qt{constructor(t,r){Lh(this,"low"),Lh(this,"high"),Lh(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new Qt(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?E0:t>=Fk?Zk:new Qt(t%La|0,t/La|0)}toString(){return(BigInt(this.high)*BigInt(La)+BigInt(this.low)).toString()}equals(t){return Qt.isLong(t)||(t=Qt.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return Qt.isLong(t)||(t=Qt.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?Qt.fromNumber(t):new Qt(t.low,t.high)}}const E0=new Qt(0,0),R0=65536,La=R0*R0,Fk=La*La,Zk=new Qt(-1,-1);var Qk=Object.defineProperty,Gk=(e,t,r)=>t in e?Qk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Tl=(e,t,r)=>Gk(e,typeof t!="symbol"?t+"":t,r);class C0{constructor(t,r){Tl(this,"version"),Tl(this,"remoteQuerySet"),Tl(this,"queryPath"),Tl(this,"logger"),this.version={querySet:0,ts:Qt.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=r}transition(t){const r=t.startVersion;if(this.version.querySet!==r.querySet||this.version.ts.notEquals(r.ts)||this.version.identity!==r.identity)throw new Error(`Invalid start version: ${r.ts.toString()}:${r.querySet}:${r.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const s of t.modifications)switch(s.type){case"QueryUpdated":{const a=this.queryPath(s.queryId);if(a)for(const u of s.logLines)au(this.logger,"info","query",a,u);const l=hi(s.value??null);this.remoteQuerySet.set(s.queryId,{success:!0,value:l,logLines:s.logLines});break}case"QueryFailed":{const a=this.queryPath(s.queryId);if(a)for(const u of s.logLines)au(this.logger,"info","query",a,u);const{errorData:l}=s;this.remoteQuerySet.set(s.queryId,{success:!1,errorMessage:s.errorMessage,errorData:l!==void 0?hi(l):void 0,logLines:s.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(s.queryId);break}default:throw new Error(`Invalid modification ${s.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Dh(e){const t=Ua(e);return Qt.fromBytesLE(Array.from(t))}function Yk(e){const t=new Uint8Array(e.toBytesLE());return $a(t)}function T0(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Dh(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Dh(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Dh(e.endVersion.ts)}}}}function Kk(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:Yk(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var Xk=Object.defineProperty,Jk=(e,t,r)=>t in e?Xk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ut=(e,t,r)=>Jk(e,typeof t!="symbol"?t+"":t,r);const Wk=1e3,eN=1001,tN=1005,nN=4040;let ql;function Xs(){return ql===void 0&&(ql=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(ql+performance.now())}function A0(){return`t=${Math.round((Xs()-ql)/100)/10}s`}const __={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function rN(e){if(e===void 0)return"Unknown";for(const t of Object.keys(__))if(e.startsWith(t))return t;return"Unknown"}class oN{constructor(t,r,s,a,l,u){this.markConnectionStateDirty=l,this.debug=u,ut(this,"socket"),ut(this,"connectionCount"),ut(this,"_hasEverConnected",!1),ut(this,"lastCloseReason"),ut(this,"transitionChunkBuffer",null),ut(this,"defaultInitialBackoff"),ut(this,"maxBackoff"),ut(this,"retries"),ut(this,"serverInactivityThreshold"),ut(this,"reconnectDueToServerInactivityTimeout"),ut(this,"scheduledReconnect",null),ut(this,"networkOnlineHandler",null),ut(this,"pendingNetworkRecoveryInfo",null),ut(this,"uri"),ut(this,"onOpen"),ut(this,"onResume"),ut(this,"onMessage"),ut(this,"webSocketConstructor"),ut(this,"logger"),ut(this,"onServerDisconnectError"),this.webSocketConstructor=s,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=t,this.onOpen=r.onOpen,this.onResume=r.onResume,this.onMessage=r.onMessage,this.onServerDisconnectError=r.onServerDisconnectError,this.logger=a,this.setupNetworkListener(),this.connect()}setSocketState(t){this.socket=t,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(t){if(t.partNumber<0||t.partNumber>=t.totalParts||t.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==t.totalParts||this.transitionChunkBuffer.transitionId!==t.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:t.totalParts,transitionId:t.transitionId}),t.partNumber!==this.transitionChunkBuffer.chunks.length){const r=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${r}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const r=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const s=T0(JSON.parse(r));if(s.type!=="Transition")throw new Error(`Expected Transition, got ${s.type} after assembling chunks`);return s}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const t=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:t,paused:"no"}),this.resetServerInactivityTimeout(),t.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:t,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Xs()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",A0(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",A0())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:r}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:r}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(r/1e3)}s of waiting`)}},t.onerror=r=>{this.transitionChunkBuffer=null;const s=r.message;s&&this.logger.log(`WebSocket error message: ${s}`)},t.onmessage=r=>{this.resetServerInactivityTimeout();const s=r.data.length;let a=T0(JSON.parse(r.data));if(this._logVerbose(`received ws message with type ${a.type}`),a.type==="Ping")return;if(a.type==="TransitionChunk"){const u=this.assembleTransition(a);if(!u)return;a=u,this._logVerbose(`assembled full ws message of type ${a.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${a.type} while buffering TransitionChunks`)),a.type==="Transition"&&this.reportLargeTransition({messageLength:s,transition:a}),this.onMessage(a).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=r=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=r.reason||`closed with code ${r.code}`),r.code!==Wk&&r.code!==eN&&r.code!==tN&&r.code!==nN){let a=`WebSocket closed with code ${r.code}`;r.reason&&(a+=`: ${r.reason}`),this.logger.log(a),this.onServerDisconnectError&&r.reason&&this.onServerDisconnectError(a)}const s=rN(r.reason);this.scheduleReconnect(s)}}socketState(){return this.socket.state}sendMessage(t){const r={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const s=Kk(t),a=JSON.stringify(s);let l=!1;try{this.socket.ws.send(a),l=!0}catch(u){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${u}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${l?"sent":"failed to send"} message with type ${t.type}: ${JSON.stringify(r)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(r)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(t){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const r=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(r)}ms`);const s=Xs(),a=setTimeout(()=>{this.scheduledReconnect?.timeout===a&&(this.scheduledReconnect=null,this.connect())},r);this.scheduledReconnect={timeout:a,scheduledAt:s,backoffMs:r}}closeAndReconnect(t){switch(this._logVerbose(`begin closeAndReconnect with reason ${t}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=t,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const t=this.socket.ws;return t.onmessage=r=>{this._logVerbose("Ignoring message received after close")},new Promise(r=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),r()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=s=>{this._logVerbose("Ignoring message received after close")};const r=new Promise(s=>{t.onclose=()=>{s()}});return t.close(),r}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const t=this.close();return this.setSocketState({state:"terminated"}),t}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const t=this.close();return this.socket={state:"stopped"},t}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let t=null;if(this.scheduledReconnect){const r=Xs()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-r),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(r)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=t!==null?{timeSavedMs:t}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Xs()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(t){this.logger.logVerbose(t)}nextBackoff(t){const s=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:__[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const a=Math.min(s,this.maxBackoff),l=a*(Math.random()-.5);return a+l}reportLargeTransition({transition:t,messageLength:r}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const s=Xs()-t.clientClockSkew-t.serverTs/1e6,a=`${Math.round(s)}ms`,l=`${Math.round(r/1e4)/100}MB`,u=r/(s/1e3),f=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${l} transition in ${a} at ${f}`),r>2e7?this.logger.log(`received query results totaling more that 20MB (${l}) which will take a long time to download on slower connections`):s>2e4&&this.logger.log(`received query results totaling ${l} which took more than 20s to arrive (${a})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:s,messageLength:r}})}}function sN(){return iN()}function iN(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class Ta extends Error{}Ta.prototype.name="InvalidTokenError";function aN(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let s=r.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function cN(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return aN(t)}catch{return atob(t)}}function x_(e,t){if(typeof e!="string")throw new Ta("Invalid token specified: must be a string");t||(t={});const r=t.header===!0?0:1,s=e.split(".")[r];if(typeof s!="string")throw new Ta(`Invalid token specified: missing part #${r+1}`);let a;try{a=cN(s)}catch(l){throw new Ta(`Invalid token specified: invalid base64 for part #${r+1} (${l.message})`)}try{return JSON.parse(a)}catch(l){throw new Ta(`Invalid token specified: invalid json for part #${r+1} (${l.message})`)}}var lN=Object.defineProperty,uN=(e,t,r)=>t in e?lN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_n=(e,t,r)=>uN(e,typeof t!="symbol"?t+"":t,r);const fN=480*60*60*1e3,O0=2;class dN{constructor(t,r,s){_n(this,"authState",{state:"noAuth"}),_n(this,"configVersion",0),_n(this,"syncState"),_n(this,"authenticate"),_n(this,"stopSocket"),_n(this,"tryRestartSocket"),_n(this,"pauseSocket"),_n(this,"resumeSocket"),_n(this,"clearAuth"),_n(this,"logger"),_n(this,"refreshTokenLeewaySeconds"),_n(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=r.authenticate,this.stopSocket=r.stopSocket,this.tryRestartSocket=r.tryRestartSocket,this.pauseSocket=r.pauseSocket,this.resumeSocket=r.resumeSocket,this.clearAuth=r.clearAuth,this.logger=s.logger,this.refreshTokenLeewaySeconds=s.refreshTokenLeewaySeconds}async setConfig(t,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const s=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});s.isFromOutdatedConfig||(s.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:r},hasRetried:!1}),this.authenticate(s.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:r}}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket())}onTransition(t){if(this.syncState.isCurrentOrNewerAuthVersion(t.endVersion.identity)&&!(t.endVersion.identity<=t.startVersion.identity)){if(this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid"),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(t){if(t.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:r}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(r+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(t)}async tryToReauthenticate(t){if(this._logVerbose(`attempting to reauthenticate: ${t.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=O0){this.logger.error(`Failed to authenticate: "${t.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${O0-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const r=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});r.isFromOutdatedConfig||(r.value&&this.syncState.isNewAuth(r.value)?(this.authenticate(r.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:r.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value?this.syncState.isNewAuth(t.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:t.value,config:this.authState.config}),this.authenticate(t.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(t){if(this.authState.state==="noAuth")return;const r=this.decodeToken(t);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:s,exp:a}=r;if(!s||!a){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const l=a-s;if(l<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(fN,(l-this.refreshTokenLeewaySeconds)*1e3);u<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${l}s`),u=0);const f=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},u);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:f,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${u}ms`)}async fetchTokenAndGuardAgainstRace(t,r){const s=++this.configVersion;this._logVerbose(`fetching token with config version ${s}`);const a=await t(r);return this.configVersion!==s?(this._logVerbose(`stale config version, expected ${s}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:a}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(t){t(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:"noAuth"})}setAuthState(t){const r=t.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:t.hadAuth,state:t.state,token:`...${t.token.slice(-7)}`}:{state:t.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(r)}`),t.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&(clearTimeout(this.authState.refetchTokenTimeoutId),this.syncState.markAuthCompletion()),this.authState=t}decodeToken(t){try{return x_(t)}catch(r){return this._logVerbose(`Error decoding token: ${r instanceof Error?r.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const hN=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function pN(e,t){const r={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:r})}function mN(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function gN(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const r of hN){const s=performance.getEntriesByName(r).filter(a=>a.entryType==="mark").filter(a=>a.detail.sessionId===e);t.push(...s)}return t.map(mN)}var yN=Object.defineProperty,vN=(e,t,r)=>t in e?yN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ft=(e,t,r)=>vN(e,typeof t!="symbol"?t+"":t,r);class bN{constructor(t,r,s){if(ft(this,"address"),ft(this,"state"),ft(this,"requestManager"),ft(this,"webSocketManager"),ft(this,"authenticationManager"),ft(this,"remoteQuerySet"),ft(this,"optimisticQueryResults"),ft(this,"_transitionHandlerCounter",0),ft(this,"_nextRequestId"),ft(this,"_onTransitionFns",new Map),ft(this,"_sessionId"),ft(this,"firstMessageReceived",!1),ft(this,"debug"),ft(this,"logger"),ft(this,"maxObservedTimestamp"),ft(this,"connectionStateSubscribers",new Map),ft(this,"nextConnectionStateSubscriberId",0),ft(this,"_lastPublishedConnectionState"),ft(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const S=this.connectionState();if(JSON.stringify(S)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=S;for(const E of this.connectionStateSubscribers.values())E(S)}})}),ft(this,"mark",S=>{this.debug&&pN(S,this.sessionId)}),typeof t=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");s?.skipConvexDeploymentUrlCheck!==!0&&fk(t),s={...s};const a=s.authRefreshTokenLeewaySeconds??2;let l=s.webSocketConstructor;if(!l&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");l=l||WebSocket,this.debug=s.reportDebugInfoToConvex??!1,this.address=t,this.logger=s.logger===!1?v_({verbose:s.verbose??!1}):s.logger!==!0&&s.logger?s.logger:y_({verbose:s.verbose??!1});const u=t.search("://");if(u===-1)throw new Error("Provided address was not an absolute URL.");const f=t.substring(u+3),h=t.substring(0,u);let m;if(h==="http")m="ws";else if(h==="https")m="wss";else throw new Error(`Unknown parent protocol ${h}`);const y=`${m}://${f}/api/${w0}/sync`;this.state=new Nk,this.remoteQuerySet=new C0(S=>this.state.queryPath(S),this.logger),this.requestManager=new Dk(this.logger,this.markConnectionStateDirty);const g=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new dN(this.state,{authenticate:S=>{const E=this.state.setAuth(S);return this.webSocketManager.sendMessage(E),E.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:g,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:a}),this.optimisticQueryResults=new qk,this.addOnTransitionHandler(S=>{r(S.queries.map(E=>E.token))}),this._nextRequestId=0,this._sessionId=sN();const{unsavedChangesWarning:b}=s;if(typeof window>"u"||typeof window.addEventListener>"u"){if(b===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else b!==!1&&window.addEventListener("beforeunload",S=>{if(this.requestManager.hasIncompleteRequests()){S.preventDefault();const E="Are you sure you want to leave? Your changes may not be saved.";return(S||window.event).returnValue=E,E}});this.webSocketManager=new oN(y,{onOpen:S=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...S,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const E=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new C0(O=>this.state.queryPath(O),this.logger);const[x,C]=this.state.restart(E);C&&this.webSocketManager.sendMessage(C),this.webSocketManager.sendMessage(x);for(const O of this.requestManager.restart())this.webSocketManager.sendMessage(O)},onResume:()=>{const[S,E]=this.state.resume();E&&this.webSocketManager.sendMessage(E),S&&this.webSocketManager.sendMessage(S);for(const x of this.requestManager.resume())this.webSocketManager.sendMessage(x)},onMessage:S=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),S.type){case"Transition":{this.observedTimestamp(S.endVersion.ts),this.authenticationManager.onTransition(S),this.remoteQuerySet.transition(S),this.state.transition(S);const E=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(E);break}case"MutationResponse":{S.success&&this.observedTimestamp(S.ts);const E=this.requestManager.onResponse(S);E!==null&&this.notifyOnQueryResultChanges(new Map([[E.requestId,E.result]]));break}case"ActionResponse":{this.requestManager.onResponse(S);break}case"AuthError":{this.authenticationManager.onAuthError(S);break}case"FatalError":{const E=Ok(this.logger,S.error);throw this.webSocketManager.terminate(),E}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:s.onServerDisconnectError},l,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),s.expectAuth&&g()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()||this.state.hasSyncedPastLastReconnect()}observedTimestamp(t){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(t))&&(this.maxObservedTimestamp=t)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(t){const r=this.remoteQuerySet.remoteQueryResults(),s=new Map;for(const[l,u]of r){const f=this.state.queryToken(l);if(f!==null){const h={result:u,udfPath:this.state.queryPath(l),args:this.state.queryArgs(l)};s.set(f,h)}}const a=this.optimisticQueryResults.ingestQueryResultsFromServer(s,new Set(t.keys()));this.handleTransition({queries:a.map(l=>{const u=this.optimisticQueryResults.rawQueryResult(l);return{token:l,modification:{kind:"Updated",result:u}}}),reflectedMutations:Array.from(t).map(([l,u])=>({requestId:l,result:u})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(t){for(const r of this._onTransitionFns.values())r(t)}addOnTransitionHandler(t){const r=this._transitionHandlerCounter++;return this._onTransitionFns.set(r,t),()=>this._onTransitionFns.delete(r)}getCurrentAuthClaims(){const t=this.state.getAuth();let r={};if(t&&t.tokenType==="User")try{r=t?x_(t.value):{}}catch{r={}}else return;return{token:t.value,decoded:r}}setAuth(t,r){this.authenticationManager.setConfig(t,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,r){const s=this.state.setAdminAuth(t,r);this.webSocketManager.sendMessage(s)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,r,s){const a=xr(r),{modification:l,queryToken:u,unsubscribe:f}=this.state.subscribe(t,a,s?.journal,s?.componentPath);return l!==null&&this.webSocketManager.sendMessage(l),{queryToken:u,unsubscribe:()=>{const h=f();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,r){const s=xr(r),a=Qo(t,s);return this.optimisticQueryResults.queryResult(a)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,r){const s=xr(r),a=Qo(t,s);return this.optimisticQueryResults.queryLogs(a)}queryJournal(t,r){const s=xr(r),a=Qo(t,s);return this.state.queryJournal(a)}connectionState(){const t=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:t.isConnected,hasEverConnected:t.hasEverConnected,connectionCount:t.connectionCount,connectionRetries:t.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(t){const r=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(r,t),()=>{this.connectionStateSubscribers.delete(r)}}async mutation(t,r,s){const a=await this.mutationInternal(t,r,s);if(!a.success)throw a.errorData!==void 0?up(a,new lp(Ws("mutation",t,a))):new Error(Ws("mutation",t,a));return a.value}async mutationInternal(t,r,s,a){const{mutationPromise:l}=this.enqueueMutation(t,r,s,a);return l}enqueueMutation(t,r,s,a){const l=xr(r);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,s!==void 0){const y=s.optimisticUpdate;if(y!==void 0){const g=E=>{y(E,l)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},S=this.optimisticQueryResults.applyOptimisticUpdate(g,u).map(E=>{const x=this.localQueryResultByToken(E);return{token:E,modification:{kind:"Updated",result:x===void 0?void 0:{success:!0,value:x,logLines:[]}}}});this.handleTransition({queries:S,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const f={type:"Mutation",requestId:u,udfPath:t,componentPath:a,args:[zn(l)]},h=this.webSocketManager.sendMessage(f),m=this.requestManager.request(f,h);return{requestId:u,mutationPromise:m}}async action(t,r){const s=await this.actionInternal(t,r);if(!s.success)throw s.errorData!==void 0?up(s,new lp(Ws("action",t,s))):new Error(Ws("action",t,s));return s.value}async actionInternal(t,r,s){const a=xr(r),l=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:l,udfPath:t,componentPath:s,args:[zn(a)]},f=this.webSocketManager.sendMessage(u);return this.requestManager.request(u,f)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const t=gN(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:t})}}tryReportLongDisconnect(){if(!this.debug)return;const t=this.connectionState().timeOfOldestInflightRequest;if(t===null||Date.now()-t.getTime()<=60*1e3)return;const r=`${this.address}/api/debug_event`;fetch(r,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${w0}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(s=>{s.ok||this.logger.warn("Analytics request failed with response:",s.body)}).catch(s=>{this.logger.warn("Analytics response failed with error:",s)})}}function jh(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var SN=Object.defineProperty,wN=(e,t,r)=>t in e?SN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M0=(e,t,r)=>wN(e,typeof t!="symbol"?t+"":t,r);class _N{constructor(t,r){this.client=t,this.onTransition=r,M0(this,"paginatedQuerySet",new Map),M0(this,"lastTransitionTs"),this.lastTransitionTs=Qt.fromNumber(0),this.client.addOnTransitionHandler(s=>this.onBaseTransition(s))}subscribe(t,r,s){const a=Xo(t),l=x0(a,r,s),u=()=>this.removePaginatedQuerySubscriber(l),f=this.paginatedQuerySet.get(l);return f?(f.numSubscribers+=1,{paginatedQueryToken:l,unsubscribe:u}):(this.paginatedQuerySet.set(l,{token:l,canonicalizedUdfPath:a,args:r,numSubscribers:1,options:{initialNumItems:s.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:s.id}),this.addPageToPaginatedQuery(l,null,s.initialNumItems),{paginatedQueryToken:l,unsubscribe:u})}localQueryResult(t,r,s){const a=Xo(t),l=x0(a,r,s);return this.localQueryResultByToken(l)}localQueryResultByToken(t){const r=this.paginatedQuerySet.get(t);if(!r)return;const s=this.activePageQueryTokens(r);if(s.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let a=[],l=!1,u=!1;for(const h of s){const m=this.client.localQueryResultByToken(h);if(m===void 0){l=!0,u=!1;continue}const y=jh(m);a=a.concat(y.page),u=!!y.isDone}let f;return l?f=a.length===0?"LoadingFirstPage":"LoadingMore":u?f="Exhausted":f="CanLoadMore",{results:a,status:f,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const r=t.queries.map(u=>u.token),s=this.queriesContainingTokens(r);let a=[];s.length>0&&(this.processPaginatedQuerySplits(s,u=>this.client.localQueryResultByToken(u)),a=s.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const l={...t,paginatedQueries:a};this.onTransition(l)}loadMoreOfPaginatedQuery(t,r){this.mustGetPaginatedQuery(t);const s=this.queryTokenForLastPageOfPaginatedQuery(t),a=this.client.localQueryResultByToken(s);if(!a)return!1;const l=jh(a);if(l.isDone)return!1;this.addPageToPaginatedQuery(t,l.continueCursor,r);const u={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:t,modification:{kind:"Updated",result:this.localQueryResultByToken(t)}}]};return this.onTransition(u),!0}queriesContainingTokens(t){if(t.length===0)return[];const r=[],s=new Set(t);for(const[a,l]of this.paginatedQuerySet)for(const u of this.allQueryTokens(l))if(s.has(u)){r.push(a);break}return r}processPaginatedQuerySplits(t,r){for(const s of t){const a=this.mustGetPaginatedQuery(s),{ongoingSplits:l,pageKeyToQuery:u,pageKeys:f}=a;for(const[h,[m,y]]of l)r(u.get(m).queryToken)!==void 0&&r(u.get(y).queryToken)!==void 0&&this.completePaginatedQuerySplit(a,h,m,y);for(const h of f){if(l.has(h))continue;const m=u.get(h).queryToken,y=r(m);if(!y)continue;const g=jh(y);g.splitCursor&&(g.pageStatus==="SplitRecommended"||g.pageStatus==="SplitRequired"||g.page.length>a.options.initialNumItems*2)&&this.splitPaginatedQueryPage(a,h,g.splitCursor,g.continueCursor)}}}splitPaginatedQueryPage(t,r,s,a){const l=t.nextPageKey++,u=t.nextPageKey++,f={cursor:a,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:null,endCursor:s}});t.pageKeyToQuery.set(l,h);const m=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:s,endCursor:a}});t.pageKeyToQuery.set(u,m),t.ongoingSplits.set(r,[l,u])}addPageToPaginatedQuery(t,r,s){const a=this.mustGetPaginatedQuery(t),l=a.nextPageKey++,u={cursor:r,numItems:s,id:a.id},f={...a.args,paginationOpts:u},h=this.client.subscribe(a.canonicalizedUdfPath,f);return a.pageKeys.push(l),a.pageKeyToQuery.set(l,h),h}removePaginatedQuerySubscriber(t){const r=this.paginatedQuerySet.get(t);if(r&&(r.numSubscribers-=1,!(r.numSubscribers>0))){for(const s of r.pageKeyToQuery.values())s.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,r,s,a){const l=t.pageKeyToQuery.get(r);t.pageKeyToQuery.delete(r);const u=t.pageKeys.indexOf(r);t.pageKeys.splice(u,1,s,a),t.ongoingSplits.delete(r),l.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(r=>t.pageKeyToQuery.get(r).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(r=>r.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const r=this.mustGetPaginatedQuery(t),s=r.pageKeys[r.pageKeys.length-1];if(s===void 0)throw new Error(`No pages for paginated query ${t}`);return r.pageKeyToQuery.get(s).queryToken}mustGetPaginatedQuery(t){const r=this.paginatedQuerySet.get(t);if(!r)throw new Error("paginated query no longer exists for token "+t);return r}}function xN({getCurrentValue:e,subscribe:t}){const[r,s]=w.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let a=r.value;return(r.getCurrentValue!==e||r.subscribe!==t)&&(a=e(),s({getCurrentValue:e,subscribe:t,value:a})),w.useEffect(()=>{let l=!1;const u=()=>{l||s(h=>{if(h.getCurrentValue!==e||h.subscribe!==t)return h;const m=e();return h.value===m?h:{...h,value:m}})},f=t(u);return u(),()=>{l=!0,f()}},[e,t]),a}var EN=Object.defineProperty,RN=(e,t,r)=>t in e?EN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wr=(e,t,r)=>RN(e,typeof t!="symbol"?t+"":t,r);const CN=5e3;if(typeof Ot>"u")throw new Error("Required dependency 'react' not found");function E_(e,t,r){function s(a){return kN(a),t.mutation(e,a,{optimisticUpdate:r})}return s.withOptimisticUpdate=function(l){if(r!==void 0)throw new Error(`Already specified optimistic update for mutation ${Yt(e)}`);return E_(e,t,l)},s}class TN{constructor(t,r){if(wr(this,"address"),wr(this,"cachedSync"),wr(this,"cachedPaginatedQueryClient"),wr(this,"listeners"),wr(this,"options"),wr(this,"closed",!1),wr(this,"_logger"),wr(this,"adminAuth"),wr(this,"fakeUserIdentity"),t===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof t!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof t} instead.`);if(!t.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=t,this.listeners=new Map,this._logger=r?.logger===!1?v_({verbose:r?.verbose??!1}):r?.logger!==!0&&r?.logger?r.logger:y_({verbose:r?.verbose??!1}),this.options={...r,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new bN(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new _N(this.cachedSync,t=>this.handleTransition(t)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(t,r){if(typeof t=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(t,r??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,r){if(this.adminAuth=t,this.fakeUserIdentity=r,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,r)}watchQuery(t,...r){const[s,a]=r,l=Yt(t);return{onUpdate:u=>{const{queryToken:f,unsubscribe:h}=this.sync.subscribe(l,s,a),m=this.listeners.get(f);return m!==void 0?m.add(u):this.listeners.set(f,new Set([u])),()=>{if(this.closed)return;const y=this.listeners.get(f);y.delete(u),y.size===0&&this.listeners.delete(f),h()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(l,s)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(l,s)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(l,s)}}}prewarmQuery(t){const r=t.extendSubscriptionFor??CN,a=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(a,r)}watchPaginatedQuery(t,r,s){const a=Yt(t);return{onUpdate:l=>{const{paginatedQueryToken:u,unsubscribe:f}=this.paginatedQueryClient.subscribe(a,r||{},s),h=this.listeners.get(u);return h!==void 0?h.add(l):this.listeners.set(u,new Set([l])),()=>{if(this.closed)return;const m=this.listeners.get(u);m.delete(l),m.size===0&&this.listeners.delete(u),f()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(a,r,s)}}mutation(t,...r){const[s,a]=r,l=Yt(t);return this.sync.mutation(l,s,a)}action(t,...r){const s=Yt(t);return this.sync.action(s,...r)}query(t,...r){const s=this.watchQuery(t,...r),a=s.localQueryResult();return a!==void 0?Promise.resolve(a):new Promise((l,u)=>{const f=s.onUpdate(()=>{f();try{l(s.localQueryResult())}catch(h){u(h)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(t){return this.sync.subscribeToConnectionState(t)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const t=this.cachedSync;this.cachedSync=void 0,await t.close()}}handleTransition(t){const r=t.queries.map(a=>a.token),s=t.paginatedQueries.map(a=>a.token);this.transition([...r,...s])}transition(t){for(const r of t){const s=this.listeners.get(r);if(s)for(const a of s)a()}}}const Yp=Ot.createContext(void 0);function AN(){return w.useContext(Yp)}const ON=({client:e,children:t})=>Ot.createElement(Yp.Provider,{value:e},t);function MN(e,...t){const r=t[0]==="skip",s=t[0]==="skip"?{}:xr(t[0]),a=typeof e=="string"?S_(e):e,l=Yt(a),u=w.useMemo(()=>r?{}:{query:{query:a,args:s}},[JSON.stringify(zn(s)),l,r]),h=DN(u).query;if(h instanceof Error)throw h;return h}function HB(e){const t=typeof e=="string"?S_(e):e,r=w.useContext(Yp);if(r===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>E_(t,r),[r,Yt(t)])}function kN(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var NN=Object.defineProperty,zN=(e,t,r)=>t in e?NN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ph=(e,t,r)=>zN(e,typeof t!="symbol"?t+"":t,r);class LN{constructor(t){Ph(this,"createWatch"),Ph(this,"queries"),Ph(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const r of Object.keys(t)){const{query:s,args:a,paginationOptions:l}=t[r];if(Yt(s),this.queries[r]===void 0)this.addQuery(r,s,a,l?{paginationOptions:l}:{});else{const u=this.queries[r];(Yt(s)!==Yt(u.query)||JSON.stringify(zn(a))!==JSON.stringify(zn(u.args))||JSON.stringify(l)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(r),this.addQuery(r,s,a,l?{paginationOptions:l}:{}))}}for(const r of Object.keys(this.queries))t[r]===void 0&&this.removeQuery(r)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const r={};for(const s of Object.keys(t)){const{query:a,args:l}=t[s],u=t[s].paginationOptions;Yt(a);const f=this.createWatch(a,l,u?{paginationOptions:u}:{});let h;try{h=f.localQueryResult()}catch(m){if(m instanceof Error)h=m;else throw m}r[s]=h}return r}setCreateWatch(t){this.createWatch=t;for(const r of Object.keys(this.queries)){const{query:s,args:a,watch:l,paginationOptions:u}=this.queries[r],f="journal"in l?l.journal():void 0;this.removeQuery(r),this.addQuery(r,s,a,{...f?{journal:f}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,r,s,{paginationOptions:a,journal:l}){if(this.queries[t]!==void 0)throw new Error(`Tried to add a new query with identifier ${t} when it already exists.`);const u=this.createWatch(r,s,{...l?{journal:l}:[],...a?{paginationOptions:a}:{}}),f=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:r,args:s,watch:u,unsubscribe:f,...a?{paginationOptions:a}:{}}}removeQuery(t){const r=this.queries[t];if(r===void 0)throw new Error(`No query found with identifier ${t}.`);r.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function DN(e){const t=AN();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const r=w.useMemo(()=>(s,a,{journal:l,paginationOptions:u})=>u?t.watchPaginatedQuery(s,a,u):t.watchQuery(s,a,l?{journal:l}:{}),[t]);return jN(e,r)}function jN(e,t){const[r]=w.useState(()=>new LN(t));r.createWatch!==t&&r.setCreateWatch(t),w.useEffect(()=>()=>r.destroy(),[r]);const s=w.useMemo(()=>({getCurrentValue:()=>r.getLocalResults(e),subscribe:a=>(r.setQueries(e),r.subscribe(a))}),[r,e]);return xN(s)}const PN="/assets/globals-B7Wsfh_v.css";const R_=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();const UN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const $N=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());const k0=e=>{const t=$N(e);return t.charAt(0).toUpperCase()+t.slice(1)};var IN={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"};const BN=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const qN=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:u,...f},h)=>w.createElement("svg",{ref:h,...IN,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:R_("lucide",a),...!l&&!BN(f)&&{"aria-hidden":"true"},...f},[...u.map(([m,y])=>w.createElement(m,y)),...Array.isArray(l)?l:[l]]));const we=(e,t)=>{const r=w.forwardRef(({className:s,...a},l)=>w.createElement(qN,{ref:l,iconNode:t,className:R_(`lucide-${UN(k0(e))}`,`lucide-${e}`,s),...a}));return r.displayName=k0(e),r};const VN=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],HN=we("archive",VN);const FN=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],fp=we("bell",FN);const ZN=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],QN=we("book",ZN);const GN=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],YN=we("bookmark",GN);const KN=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],XN=we("braces",KN);const JN=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],WN=we("calendar",JN);const ez=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],C_=we("chevron-down",ez);const tz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nz=we("chevron-right",tz);const rz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],oz=we("circle-alert",rz);const sz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],T_=we("circle-question-mark",sz);const iz=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],az=we("clock",iz);const cz=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lz=we("code",cz);const uz=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],fz=we("dollar-sign",uz);const dz=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],hz=we("external-link",dz);const pz=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],mz=we("eye",pz);const gz=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],yz=we("file-code",gz);const vz=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],bz=we("file-text",vz);const Sz=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],wz=we("flag",Sz);const _z=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],xz=we("folder",_z);const Ez=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Rz=we("globe",Ez);const Cz=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Tz=we("hash",Cz);const Az=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Oz=we("heart",Az);const Mz=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],A_=we("house",Mz);const kz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Nz=we("image",kz);const zz=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],O_=we("layers",zz);const Lz=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Dz=we("layout-dashboard",Lz);const jz=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Pz=we("link",jz);const Uz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$z=we("loader-circle",Uz);const Iz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Bz=we("lock",Iz);const qz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Vz=we("log-out",qz);const Hz=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Fz=we("mail",Hz);const Zz=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Qz=we("map-pin",Zz);const Gz=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Yz=we("message-square",Gz);const Kz=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Xz=we("package",Kz);const Jz=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Wz=we("phone",Jz);const e3=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t3=we("settings",e3);const n3=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],r3=we("square-check-big",n3);const o3=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],s3=we("square-pen",o3);const i3=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],a3=we("star",i3);const c3=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],l3=we("tags",c3);const u3=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],f3=we("toggle-left",u3);const d3=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],h3=we("trash-2",d3);const p3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],M_=we("user",p3);function k_(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=k_(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function N_(){for(var e,t,r=0,s="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=k_(e))&&(s&&(s+=" "),s+=t);return s}const m3=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},g3=(e,t)=>({classGroupId:e,validator:t}),z_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),lu="-",N0=[],y3="arbitrary..",v3=e=>{const t=S3(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return b3(u);const f=u.split(lu),h=f[0]===""&&f.length>1?1:0;return L_(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=s[u],m=r[u];return h?m?m3(m,h):h:m||N0}return r[u]||N0}}},L_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],l=r.nextPart.get(a);if(l){const m=L_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const f=t===0?e.join(lu):e.slice(t).join(lu),h=u.length;for(let m=0;m<h;m++){const y=u[m];if(y.validator(f))return y.classGroupId}},b3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?y3+s:void 0})(),S3=e=>{const{theme:t,classGroups:r}=e;return w3(r,t)},w3=(e,t)=>{const r=z_();for(const s in e){const a=e[s];Kp(a,r,s,t)}return r},Kp=(e,t,r,s)=>{const a=e.length;for(let l=0;l<a;l++){const u=e[l];_3(u,t,r,s)}},_3=(e,t,r,s)=>{if(typeof e=="string"){x3(e,t,r);return}if(typeof e=="function"){E3(e,t,r,s);return}R3(e,t,r,s)},x3=(e,t,r)=>{const s=e===""?t:D_(t,e);s.classGroupId=r},E3=(e,t,r,s)=>{if(C3(e)){Kp(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(g3(r,e))},R3=(e,t,r,s)=>{const a=Object.entries(e),l=a.length;for(let u=0;u<l;u++){const[f,h]=a[u];Kp(h,D_(t,f),r,s)}},D_=(e,t)=>{let r=e;const s=t.split(lu),a=s.length;for(let l=0;l<a;l++){const u=s[l];let f=r.nextPart.get(u);f||(f=z_(),r.nextPart.set(u,f)),r=f}return r},C3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,T3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const a=(l,u)=>{r[l]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return a(l,u),u},set(l,u){l in r?r[l]=u:a(l,u)}}},dp="!",z0=":",A3=[],L0=(e,t,r,s,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:a}),O3=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=a=>{const l=[];let u=0,f=0,h=0,m;const y=a.length;for(let x=0;x<y;x++){const C=a[x];if(u===0&&f===0){if(C===z0){l.push(a.slice(h,x)),h=x+1;continue}if(C==="/"){m=x;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const g=l.length===0?a:a.slice(h);let b=g,S=!1;g.endsWith(dp)?(b=g.slice(0,-1),S=!0):g.startsWith(dp)&&(b=g.slice(1),S=!0);const E=m&&m>h?m-h:void 0;return L0(l,S,b,E)};if(t){const a=t+z0,l=s;s=u=>u.startsWith(a)?l(u.slice(a.length)):L0(A3,!1,u,void 0,!0)}if(r){const a=s;s=l=>r({className:l,parseClassName:a})}return s},M3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let a=[];for(let l=0;l<r.length;l++){const u=r[l],f=u[0]==="[",h=t.has(u);f||h?(a.length>0&&(a.sort(),s.push(...a),a=[]),s.push(u)):a.push(u)}return a.length>0&&(a.sort(),s.push(...a)),s}},k3=e=>({cache:T3(e.cacheSize),parseClassName:O3(e),sortModifiers:M3(e),...v3(e)}),N3=/\s+/,z3=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:l}=t,u=[],f=e.trim().split(N3);let h="";for(let m=f.length-1;m>=0;m-=1){const y=f[m],{isExternal:g,modifiers:b,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:x}=r(y);if(g){h=y+(h.length>0?" "+h:h);continue}let C=!!x,O=s(C?E.substring(0,x):E);if(!O){if(!C){h=y+(h.length>0?" "+h:h);continue}if(O=s(E),!O){h=y+(h.length>0?" "+h:h);continue}C=!1}const U=b.length===0?"":b.length===1?b[0]:l(b).join(":"),k=S?U+dp:U,L=k+O;if(u.indexOf(L)>-1)continue;u.push(L);const I=a(O,C);for(let F=0;F<I.length;++F){const $=I[F];u.push(k+$)}h=y+(h.length>0?" "+h:h)}return h},L3=(...e)=>{let t=0,r,s,a="";for(;t<e.length;)(r=e[t++])&&(s=j_(r))&&(a&&(a+=" "),a+=s);return a},j_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=j_(e[s]))&&(r&&(r+=" "),r+=t);return r},D3=(e,...t)=>{let r,s,a,l;const u=h=>{const m=t.reduce((y,g)=>g(y),e());return r=k3(m),s=r.cache.get,a=r.cache.set,l=f,f(h)},f=h=>{const m=s(h);if(m)return m;const y=z3(h,r);return a(h,y),y};return l=u,(...h)=>l(L3(...h))},j3=[],gt=e=>{const t=r=>r[e]||j3;return t.isThemeGetter=!0,t},P_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,U_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,P3=/^\d+\/\d+$/,U3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,I3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zs=e=>P3.test(e),Re=e=>!!e&&!Number.isNaN(Number(e)),no=e=>!!e&&Number.isInteger(Number(e)),Uh=e=>e.endsWith("%")&&Re(e.slice(0,-1)),_r=e=>U3.test(e),V3=()=>!0,H3=e=>$3.test(e)&&!I3.test(e),$_=()=>!1,F3=e=>B3.test(e),Z3=e=>q3.test(e),Q3=e=>!ce(e)&&!le(e),G3=e=>yi(e,q_,$_),ce=e=>P_.test(e),Io=e=>yi(e,V_,H3),$h=e=>yi(e,W3,Re),D0=e=>yi(e,I_,$_),Y3=e=>yi(e,B_,Z3),Al=e=>yi(e,H_,F3),le=e=>U_.test(e),Ra=e=>vi(e,V_),K3=e=>vi(e,eL),j0=e=>vi(e,I_),X3=e=>vi(e,q_),J3=e=>vi(e,B_),Ol=e=>vi(e,H_,!0),yi=(e,t,r)=>{const s=P_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},vi=(e,t,r=!1)=>{const s=U_.exec(e);return s?s[1]?t(s[1]):r:!1},I_=e=>e==="position"||e==="percentage",B_=e=>e==="image"||e==="url",q_=e=>e==="length"||e==="size"||e==="bg-size",V_=e=>e==="length",W3=e=>e==="number",eL=e=>e==="family-name",H_=e=>e==="shadow",tL=()=>{const e=gt("color"),t=gt("font"),r=gt("text"),s=gt("font-weight"),a=gt("tracking"),l=gt("leading"),u=gt("breakpoint"),f=gt("container"),h=gt("spacing"),m=gt("radius"),y=gt("shadow"),g=gt("inset-shadow"),b=gt("text-shadow"),S=gt("drop-shadow"),E=gt("blur"),x=gt("perspective"),C=gt("aspect"),O=gt("ease"),U=gt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...L(),le,ce],F=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],D=()=>[le,ce,h],W=()=>[Zs,"full","auto",...D()],ne=()=>[no,"none","subgrid",le,ce],oe=()=>["auto",{span:["full",no,le,ce]},no,le,ce],ie=()=>[no,"auto",le,ce],de=()=>["auto","min","max","fr",le,ce],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ve=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...D()],Y=()=>[Zs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],V=()=>[e,le,ce],te=()=>[...L(),j0,D0,{position:[le,ce]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",X3,G3,{size:[le,ce]}],G=()=>[Uh,Ra,Io],ee=()=>["","none","full",m,le,ce],re=()=>["",Re,Ra,Io],he=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Re,Uh,j0,D0],Pe=()=>["","none",E,le,ce],Ne=()=>["none",Re,le,ce],ht=()=>["none",Re,le,ce],Pt=()=>[Re,le,ce],Ut=()=>[Zs,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_r],breakpoint:[_r],color:[V3],container:[_r],"drop-shadow":[_r],ease:["in","out","in-out"],font:[Q3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_r],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_r],shadow:[_r],spacing:["px",Re],text:[_r],"text-shadow":[_r],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zs,ce,le,C]}],container:["container"],columns:[{columns:[Re,ce,le,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{start:W()}],end:[{end:W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[no,"auto",le,ce]}],basis:[{basis:[Zs,"full","auto",f,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Zs,"auto","initial","none",ce]}],grow:[{grow:["",Re,le,ce]}],shrink:[{shrink:["",Re,le,ce]}],order:[{order:[no,"first","last","none",le,ce]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:oe()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...ve()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...ve(),"baseline"]}],"place-self":[{"place-self":["auto",...ve()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[f,"screen",...Y()]}],"min-w":[{"min-w":[f,"screen","none",...Y()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,Ra,Io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,le,$h]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Uh,ce]}],"font-family":[{font:[K3,ce,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,le,ce]}],"line-clamp":[{"line-clamp":[Re,"none",le,$h]}],leading:[{leading:[l,...D()]}],"list-image":[{"list-image":["none",le,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",le,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",le,Io]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Re,"auto",le,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},no,le,ce],radial:["",le,ce],conic:[no,le,ce]},J3,Y3]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,le,ce]}],"outline-w":[{outline:["",Re,Ra,Io]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",y,Ol,Al]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",g,Ol,Al]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Re,Io]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",b,Ol,Al]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Re,le,ce]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[le,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":L()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",le,ce]}],filter:[{filter:["","none",le,ce]}],blur:[{blur:Pe()}],brightness:[{brightness:[Re,le,ce]}],contrast:[{contrast:[Re,le,ce]}],"drop-shadow":[{"drop-shadow":["","none",S,Ol,Al]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Re,le,ce]}],"hue-rotate":[{"hue-rotate":[Re,le,ce]}],invert:[{invert:["",Re,le,ce]}],saturate:[{saturate:[Re,le,ce]}],sepia:[{sepia:["",Re,le,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",le,ce]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[Re,le,ce]}],"backdrop-contrast":[{"backdrop-contrast":[Re,le,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,le,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,le,ce]}],"backdrop-invert":[{"backdrop-invert":["",Re,le,ce]}],"backdrop-opacity":[{"backdrop-opacity":[Re,le,ce]}],"backdrop-saturate":[{"backdrop-saturate":[Re,le,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,le,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",le,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",le,ce]}],ease:[{ease:["linear","initial",O,le,ce]}],delay:[{delay:[Re,le,ce]}],animate:[{animate:["none",U,le,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,le,ce]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:ht()}],"scale-x":[{"scale-x":ht()}],"scale-y":[{"scale-y":ht()}],"scale-z":[{"scale-z":ht()}],"scale-3d":["scale-3d"],skew:[{skew:Pt()}],"skew-x":[{"skew-x":Pt()}],"skew-y":[{"skew-y":Pt()}],transform:[{transform:[le,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ut()}],"translate-x":[{"translate-x":Ut()}],"translate-y":[{"translate-y":Ut()}],"translate-z":[{"translate-z":Ut()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le,ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le,ce]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Re,Ra,Io,$h]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nL=D3(tL);function Dt(...e){return nL(N_(e))}Fe.union(Fe.literal("admin"),Fe.literal("editor"),Fe.literal("author"),Fe.literal("viewer"));const rL=Fe.union(Fe.literal("contentTypes"),Fe.literal("contentEntries"),Fe.literal("mediaItems"),Fe.literal("settings")),oL=Fe.union(Fe.literal("create"),Fe.literal("read"),Fe.literal("update"),Fe.literal("delete"),Fe.literal("publish"),Fe.literal("unpublish"),Fe.literal("restore"),Fe.literal("manage"),Fe.literal("move"));Fe.object({resource:rL,action:oL,scope:Fe.optional(Fe.union(Fe.literal("all"),Fe.literal("own")))});function Da(e,t="all"){return[{resource:e,action:"create",scope:t},{resource:e,action:"read",scope:t},{resource:e,action:"update",scope:t},{resource:e,action:"delete",scope:t}]}function ai(e,t="all"){return[{resource:e,action:"read",scope:t}]}function F_(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const sL={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...Da("contentTypes"),...Da("contentEntries"),...F_(),{resource:"contentEntries",action:"restore"},...Da("mediaItems"),{resource:"settings",action:"manage"},...ai("settings")]},iL={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...ai("contentTypes"),...Da("contentEntries"),...F_(),{resource:"contentEntries",action:"restore"},...Da("mediaItems")]},aL={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...ai("contentTypes"),{resource:"contentEntries",action:"create"},{resource:"contentEntries",action:"read",scope:"own"},{resource:"contentEntries",action:"update",scope:"own"},{resource:"contentEntries",action:"delete",scope:"own"},{resource:"contentEntries",action:"publish",scope:"own"},{resource:"contentEntries",action:"unpublish",scope:"own"},{resource:"mediaItems",action:"create"},{resource:"mediaItems",action:"read",scope:"all"},{resource:"mediaItems",action:"update",scope:"own"},{resource:"mediaItems",action:"delete",scope:"own"}]},cL={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...ai("contentTypes"),...ai("contentEntries"),...ai("mediaItems")]},Xp={admin:sL,editor:iL,author:aL,viewer:cL};function lL(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const r=e.scope??"all",s=t.scope??"all";return r==="all"?!0:s==="own"}function uL(e,t,r){const s=Xp[e]??r?.[e];return s?s.permissions.some(a=>lL(a,t)):!1}function fL(e,t){return(Xp[e]??t?.[e])?.permissions??[]}function dL(e,t){return Xp[e]??t?.[e]}function hL(e,t,r){return fL(e,r).filter(s=>s.resource===t)}function FB(e,t,r){return hL(e,t,r).length>0}const Z_=w.createContext(null);function pL({children:e,getUser:t,getUserRole:r,onLogout:s,autoRedirectToLogin:a=!1,loginUrl:l="/login"}){const[u,f]=w.useState(null),[h,m]=w.useState(null),[y,g]=w.useState("loading"),[b,S]=w.useState(null),E=w.useCallback(async()=>{g("loading"),S(null);try{const k=await t();if(!k){f(null),m(null),g("unauthenticated"),a&&typeof window<"u"&&(window.location.href=l);return}const L=await r({userId:k.id});f(k),m(L),g("authenticated")}catch(k){console.error("Authentication error:",k),f(null),m(null),S(k instanceof Error?k.message:"Authentication failed"),g("error")}},[t,r,a,l]);w.useEffect(()=>{E()},[E]);const x=w.useCallback(k=>h?uL(h,k):!1,[h]),C=w.useCallback(async()=>{try{s&&await s(),f(null),m(null),g("unauthenticated"),a&&typeof window<"u"&&(window.location.href=l)}catch(k){console.error("Logout error:",k),S(k instanceof Error?k.message:"Logout failed")}},[s,a,l]),O=w.useCallback(async()=>{await E()},[E]),U={user:u,role:h,authState:y,isLoading:y==="loading",isAuthenticated:y==="authenticated",error:b,checkPermission:x,logout:C,refresh:O};return _.jsx(Z_.Provider,{value:U,children:e})}function Q_(){const e=w.useContext(Z_);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const G_=w.createContext(null),Y_="convex-cms-theme";function P0(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function U0(){if(typeof window>"u")return"system";const e=localStorage.getItem(Y_);return e==="light"||e==="dark"||e==="system"?e:"system"}function mL({children:e}){const[t,r]=w.useState(()=>U0()),[s,a]=w.useState(()=>{const f=U0();return f==="system"?P0():f}),l=w.useCallback(f=>{const h=f==="system"?P0():f;a(h);const m=document.documentElement;m.classList.remove("light","dark"),m.classList.add(h)},[]),u=w.useCallback(f=>{r(f),localStorage.setItem(Y_,f),l(f)},[l]);return w.useEffect(()=>{l(t)},[t,l]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t==="system"&&l("system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[t,l]),_.jsx(G_.Provider,{value:{theme:t,resolvedTheme:s,setTheme:u},children:e})}function ZB(){const e=w.useContext(G_);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function X(e,t,r){function s(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);const m=u.prototype,y=Object.keys(m);for(let g=0;g<y.length;g++){const b=y[g];b in f||(f[b]=m[b].bind(f))}}const a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function u(f){var h;const m=r?.Parent?new l:this;s(m,f),(h=m._zod).deferred??(h.deferred=[]);for(const y of m._zod.deferred)y();return m}return Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class K_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const X_={};function uo(e){return X_}function J_(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,a])=>t.indexOf(+s)===-1).map(([s,a])=>a)}function hp(e,t){return typeof t=="bigint"?t.toString():t}function Jp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wp(e){return e==null}function em(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function gL(e,t){const r=(e.toString().split(".")[1]||"").length,s=t.toString();let a=(s.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(s)){const h=s.match(/\d?e-(\d?)/);h?.[1]&&(a=Number.parseInt(h[1]))}const l=r>a?r:a,u=Number.parseInt(e.toFixed(l).replace(".","")),f=Number.parseInt(t.toFixed(l).replace(".",""));return u%f/10**l}const $0=Symbol("evaluating");function Ie(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==$0)return s===void 0&&(s=$0,s=r()),s},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function ts(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vo(...e){const t={};for(const r of e){const s=Object.getOwnPropertyDescriptors(r);Object.assign(t,s)}return Object.defineProperties({},t)}function I0(e){return JSON.stringify(e)}function yL(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const W_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function uu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vL=Jp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function pi(e){if(uu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(uu(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function e1(e){return pi(e)?{...e}:Array.isArray(e)?[...e]:e}const bL=new Set(["string","number","symbol"]);function Lu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bo(e,t,r){const s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function me(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function SL(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const wL={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function _L(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=vo(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=r.shape[f])}return ts(this,"shape",u),u},checks:[]});return bo(e,l)}function xL(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=vo(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return ts(this,"shape",u),u},checks:[]});return bo(e,l)}function EL(e,t){if(!pi(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const a=vo(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return ts(this,"shape",l),l}});return bo(e,a)}function RL(e,t){if(!pi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=vo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ts(this,"shape",s),s}});return bo(e,r)}function CL(e,t){const r=vo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ts(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return bo(e,r)}function TL(e,t,r){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=vo(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(r)for(const m in r){if(!(m in f))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(h[m]=e?new e({type:"optional",innerType:f[m]}):f[m])}else for(const m in f)h[m]=e?new e({type:"optional",innerType:f[m]}):f[m];return ts(this,"shape",h),h},checks:[]});return bo(t,u)}function AL(e,t,r){const s=vo(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:a[u]}))}else for(const u in a)l[u]=new e({type:"nonoptional",innerType:a[u]});return ts(this,"shape",l),l}});return bo(t,s)}function ei(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ti(e,t){return t.map(r=>{var s;return(s=r).path??(s.path=[]),r.path.unshift(e),r})}function Ml(e){return typeof e=="string"?e:e?.message}function fo(e,t,r){const s={...e,path:e.path??[]};if(!e.message){const a=Ml(e.inst?._zod.def?.error?.(e))??Ml(t?.error?.(e))??Ml(r.customError?.(e))??Ml(r.localeError?.(e))??"Invalid input";s.message=a}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function tm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Va(...e){const[t,r,s]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:s}:{...t}}const t1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,hp,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},n1=X("$ZodError",t1),r1=X("$ZodError",t1,{Parent:Error});function OL(e,t=r=>r.message){const r={},s=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):s.push(t(a));return{formErrors:s,fieldErrors:r}}function ML(e,t=r=>r.message){const r={_errors:[]},s=a=>{for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>s({issues:u}));else if(l.code==="invalid_key")s({issues:l.issues});else if(l.code==="invalid_element")s({issues:l.issues});else if(l.path.length===0)r._errors.push(t(l));else{let u=r,f=0;for(;f<l.path.length;){const h=l.path[f];f===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return s(e),r}const nm=e=>(t,r,s,a)=>{const l=s?Object.assign(s,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new ci;if(u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>fo(h,l,uo())));throw W_(f,a?.callee),f}return u.value},rm=e=>async(t,r,s,a)=>{const l=s?Object.assign(s,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>fo(h,l,uo())));throw W_(f,a?.callee),f}return u.value},Du=e=>(t,r,s)=>{const a=s?{...s,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},a);if(l instanceof Promise)throw new ci;return l.issues.length?{success:!1,error:new(e??n1)(l.issues.map(u=>fo(u,a,uo())))}:{success:!0,data:l.value}},kL=Du(r1),ju=e=>async(t,r,s)=>{const a=s?Object.assign(s,{async:!0}):{async:!0};let l=t._zod.run({value:r,issues:[]},a);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>fo(u,a,uo())))}:{success:!0,data:l.value}},NL=ju(r1),zL=e=>(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return nm(e)(t,r,a)},LL=e=>(t,r,s)=>nm(e)(t,r,s),DL=e=>async(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return rm(e)(t,r,a)},jL=e=>async(t,r,s)=>rm(e)(t,r,s),PL=e=>(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Du(e)(t,r,a)},UL=e=>(t,r,s)=>Du(e)(t,r,s),$L=e=>async(t,r,s)=>{const a=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ju(e)(t,r,a)},IL=e=>async(t,r,s)=>ju(e)(t,r,s),BL=/^[cC][^\s-]{8,}$/,qL=/^[0-9a-z]+$/,VL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,HL=/^[0-9a-vA-V]{20}$/,FL=/^[A-Za-z0-9]{27}$/,ZL=/^[a-zA-Z0-9_-]{21}$/,QL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,GL=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B0=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,YL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function XL(){return new RegExp(KL,"u")}const JL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,WL=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eD=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o1=/^[A-Za-z0-9_-]*$/,rD=/^\+[1-9]\d{6,14}$/,s1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oD=new RegExp(`^${s1}$`);function i1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sD(e){return new RegExp(`^${i1(e)}$`)}function iD(e){const t=i1({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${r.join("|")})`;return new RegExp(`^${s1}T(?:${s})$`)}const aD=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},cD=/^-?\d+$/,a1=/^-?\d+(?:\.\d+)?$/,lD=/^(?:true|false)$/i,uD=/^[^A-Z]*$/,fD=/^[^a-z]*$/,Xt=X("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),c1={number:"number",bigint:"bigint",object:"date"},l1=X("$ZodCheckLessThan",(e,t)=>{Xt.init(e,t);const r=c1[typeof t.value];e._zod.onattach.push(s=>{const a=s._zod.bag,l=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),u1=X("$ZodCheckGreaterThan",(e,t)=>{Xt.init(e,t);const r=c1[typeof t.value];e._zod.onattach.push(s=>{const a=s._zod.bag,l=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dD=X("$ZodCheckMultipleOf",(e,t)=>{Xt.init(e,t),e._zod.onattach.push(r=>{var s;(s=r._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):gL(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),hD=X("$ZodCheckNumberFormat",(e,t)=>{Xt.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),s=r?"int":"number",[a,l]=wL[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=a,f.maximum=l,r&&(f.pattern=cD)}),e._zod.check=u=>{const f=u.value;if(r){if(!Number.isInteger(f)){u.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}f<a&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),f>l&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),pD=X("$ZodCheckMaxLength",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const a=s.value;if(a.length<=t.maximum)return;const u=tm(a);s.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),mD=X("$ZodCheckMinLength",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const a=s.value;if(a.length>=t.minimum)return;const u=tm(a);s.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),gD=X("$ZodCheckLengthEquals",(e,t)=>{var r;Xt.init(e,t),(r=e._zod.def).when??(r.when=s=>{const a=s.value;return!Wp(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=s=>{const a=s.value,l=a.length;if(l===t.length)return;const u=tm(a),f=l>t.length;s.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),Pu=X("$ZodCheckStringFormat",(e,t)=>{var r,s;Xt.init(e,t),e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),yD=X("$ZodCheckRegex",(e,t)=>{Pu.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vD=X("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uD),Pu.init(e,t)}),bD=X("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fD),Pu.init(e,t)}),SD=X("$ZodCheckIncludes",(e,t)=>{Xt.init(e,t);const r=Lu(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(s)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),wD=X("$ZodCheckStartsWith",(e,t)=>{Xt.init(e,t);const r=new RegExp(`^${Lu(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),_D=X("$ZodCheckEndsWith",(e,t)=>{Xt.init(e,t);const r=new RegExp(`.*${Lu(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),xD=X("$ZodCheckOverwrite",(e,t)=>{Xt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class ED{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const s=t.split(`
20
20
  `).filter(u=>u),a=Math.min(...s.map(u=>u.length-u.trimStart().length)),l=s.map(u=>u.slice(a)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,r=this?.args,a=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...r,a.join(`
21
21
  `))}}const RD={major:4,minor:3,patch:6},nt=X("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=RD;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const a of s)for(const l of a._zod.onattach)l(e);if(s.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(u,f,h)=>{let m=ei(u),y;for(const g of f){if(g._zod.def.when){if(!g._zod.def.when(u))continue}else if(m)continue;const b=u.issues.length,S=g._zod.check(u);if(S instanceof Promise&&h?.async===!1)throw new ci;if(y||S instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await S,u.issues.length!==b&&(m||(m=ei(u,b)))});else{if(u.issues.length===b)continue;m||(m=ei(u,b))}}return y?y.then(()=>u):u},l=(u,f,h)=>{if(ei(u))return u.aborted=!0,u;const m=a(f,s,h);if(m instanceof Promise){if(h.async===!1)throw new ci;return m.then(y=>e._zod.parse(y,h))}return e._zod.parse(m,h)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const m=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return m instanceof Promise?m.then(y=>l(y,u,f)):l(m,u,f)}const h=e._zod.parse(u,f);if(h instanceof Promise){if(f.async===!1)throw new ci;return h.then(m=>a(m,s,f))}return a(h,s,f)}}Ie(e,"~standard",()=>({validate:a=>{try{const l=kL(e,a);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return NL(e,a).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),om=X("$ZodString",(e,t)=>{nt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??aD(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Xe=X("$ZodStringFormat",(e,t)=>{Pu.init(e,t),om.init(e,t)}),CD=X("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=GL),Xe.init(e,t)}),TD=X("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=B0(s))}else t.pattern??(t.pattern=B0());Xe.init(e,t)}),AD=X("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=YL),Xe.init(e,t)}),OD=X("$ZodURL",(e,t)=>{Xe.init(e,t),e._zod.check=r=>{try{const s=r.value.trim(),a=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=a.href:r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),MD=X("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=XL()),Xe.init(e,t)}),kD=X("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ZL),Xe.init(e,t)}),ND=X("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=BL),Xe.init(e,t)}),zD=X("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qL),Xe.init(e,t)}),LD=X("$ZodULID",(e,t)=>{t.pattern??(t.pattern=VL),Xe.init(e,t)}),DD=X("$ZodXID",(e,t)=>{t.pattern??(t.pattern=HL),Xe.init(e,t)}),jD=X("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=FL),Xe.init(e,t)}),PD=X("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=iD(t)),Xe.init(e,t)}),UD=X("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=oD),Xe.init(e,t)}),$D=X("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sD(t)),Xe.init(e,t)}),ID=X("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=QL),Xe.init(e,t)}),BD=X("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=JL),Xe.init(e,t),e._zod.bag.format="ipv4"}),qD=X("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=WL),Xe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),VD=X("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eD),Xe.init(e,t)}),HD=X("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tD),Xe.init(e,t),e._zod.check=r=>{const s=r.value.split("/");try{if(s.length!==2)throw new Error;const[a,l]=s;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function f1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const FD=X("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nD),Xe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{f1(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ZD(e){if(!o1.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return f1(r)}const QD=X("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=o1),Xe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ZD(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),GD=X("$ZodE164",(e,t)=>{t.pattern??(t.pattern=rD),Xe.init(e,t)});function YD(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[s]=r;if(!s)return!1;const a=JSON.parse(atob(s));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const KD=X("$ZodJWT",(e,t)=>{Xe.init(e,t),e._zod.check=r=>{YD(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),d1=X("$ZodNumber",(e,t)=>{nt.init(e,t),e._zod.pattern=e._zod.bag.pattern??a1,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const a=r.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return r;const l=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...l?{received:l}:{}}),r}}),XD=X("$ZodNumberFormat",(e,t)=>{hD.init(e,t),d1.init(e,t)}),JD=X("$ZodBoolean",(e,t)=>{nt.init(e,t),e._zod.pattern=lD,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch{}const a=r.value;return typeof a=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),WD=X("$ZodUnknown",(e,t)=>{nt.init(e,t),e._zod.parse=r=>r}),e4=X("$ZodNever",(e,t)=>{nt.init(e,t),e._zod.parse=(r,s)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function q0(e,t,r){e.issues.length&&t.issues.push(...ti(r,e.issues)),t.value[r]=e.value}const t4=X("$ZodArray",(e,t)=>{nt.init(e,t),e._zod.parse=(r,s)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const l=[];for(let u=0;u<a.length;u++){const f=a[u],h=t.element._zod.run({value:f,issues:[]},s);h instanceof Promise?l.push(h.then(m=>q0(m,r,u))):q0(h,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function fu(e,t,r,s,a){if(e.issues.length){if(a&&!(r in s))return;t.issues.push(...ti(r,e.issues))}e.value===void 0?r in s&&(t.value[r]=void 0):t.value[r]=e.value}function h1(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const r=SL(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function p1(e,t,r,s,a,l){const u=[],f=a.keySet,h=a.catchall._zod,m=h.def.type,y=h.optout==="optional";for(const g in t){if(f.has(g))continue;if(m==="never"){u.push(g);continue}const b=h.run({value:t[g],issues:[]},s);b instanceof Promise?e.push(b.then(S=>fu(S,r,g,t,y))):fu(b,r,g,t,y)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>r):r}const n4=X("$ZodObject",(e,t)=>{if(nt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const h={...f};return Object.defineProperty(t,"shape",{value:h}),h}})}const s=Jp(()=>h1(t));Ie(e._zod,"propValues",()=>{const f=t.shape,h={};for(const m in f){const y=f[m]._zod;if(y.values){h[m]??(h[m]=new Set);for(const g of y.values)h[m].add(g)}}return h});const a=uu,l=t.catchall;let u;e._zod.parse=(f,h)=>{u??(u=s.value);const m=f.value;if(!a(m))return f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f;f.value={};const y=[],g=u.shape;for(const b of u.keys){const S=g[b],E=S._zod.optout==="optional",x=S._zod.run({value:m[b],issues:[]},h);x instanceof Promise?y.push(x.then(C=>fu(C,f,b,m,E))):fu(x,f,b,m,E)}return l?p1(y,m,f,h,s.value,e):y.length?Promise.all(y).then(()=>f):f}}),r4=X("$ZodObjectJIT",(e,t)=>{n4.init(e,t);const r=e._zod.parse,s=Jp(()=>h1(t)),a=b=>{const S=new ED(["shape","payload","ctx"]),E=s.value,x=k=>{const L=I0(k);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};S.write("const input = payload.value;");const C=Object.create(null);let O=0;for(const k of E.keys)C[k]=`key_${O++}`;S.write("const newResult = {};");for(const k of E.keys){const L=C[k],I=I0(k),$=b[k]?._zod?.optout==="optional";S.write(`const ${L} = ${x(k)};`),$?S.write(`
22
22
  if (${L}.issues.length) {
@@ -94,4 +94,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
94
94
  `)},NS=function(){var e=parseInt(document.body.getAttribute(ui)||"0",10);return isFinite(e)?e:0},m8=function(){w.useEffect(function(){return document.body.setAttribute(ui,(NS()+1).toString()),function(){var e=NS()-1;e<=0?document.body.removeAttribute(ui):document.body.setAttribute(ui,e.toString())}},[])},g8=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;m8();var l=w.useMemo(function(){return d8(a)},[a]);return w.createElement(h8,{styles:p8(l,!t,a,r?"":"!important")})},wp=!1;if(typeof window<"u")try{var Pl=Object.defineProperty({},"passive",{get:function(){return wp=!0,!0}});window.addEventListener("test",Pl,Pl),window.removeEventListener("test",Pl,Pl)}catch{wp=!1}var Gs=wp?{passive:!1}:!1,y8=function(e){return e.tagName==="TEXTAREA"},xx=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!y8(e)&&r[t]==="visible")},v8=function(e){return xx(e,"overflowY")},b8=function(e){return xx(e,"overflowX")},zS=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=Ex(e,s);if(a){var l=Rx(e,s),u=l[1],f=l[2];if(u>f)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},S8=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},w8=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},Ex=function(e,t){return e==="v"?v8(t):b8(t)},Rx=function(e,t){return e==="v"?S8(t):w8(t)},_8=function(e,t){return e==="h"&&t==="rtl"?-1:1},x8=function(e,t,r,s,a){var l=_8(e,window.getComputedStyle(t).direction),u=l*s,f=r.target,h=t.contains(f),m=!1,y=u>0,g=0,b=0;do{if(!f)break;var S=Rx(e,f),E=S[0],x=S[1],C=S[2],O=x-C-l*E;(E||O)&&Ex(e,f)&&(g+=O,b+=E);var U=f.parentNode;f=U&&U.nodeType===Node.DOCUMENT_FRAGMENT_NODE?U.host:U}while(!h&&f!==document.body||h&&(t.contains(f)||t===f));return(y&&Math.abs(g)<1||!y&&Math.abs(b)<1)&&(m=!0),m},Ul=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},LS=function(e){return[e.deltaX,e.deltaY]},DS=function(e){return e&&"current"in e?e.current:e},E8=function(e,t){return e[0]===t[0]&&e[1]===t[1]},R8=function(e){return`
95
95
  .block-interactivity-`.concat(e,` {pointer-events: none;}
96
96
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
97
- `)},C8=0,Ys=[];function T8(e){var t=w.useRef([]),r=w.useRef([0,0]),s=w.useRef(),a=w.useState(C8++)[0],l=w.useState(_x)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=GU([e.lockRef.current],(e.shards||[]).map(DS),!0).filter(Boolean);return x.forEach(function(C){return C.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var f=w.useCallback(function(x,C){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!u.current.allowPinchZoom;var O=Ul(x),U=r.current,k="deltaX"in x?x.deltaX:U[0]-O[0],L="deltaY"in x?x.deltaY:U[1]-O[1],I,F=x.target,$=Math.abs(k)>Math.abs(L)?"h":"v";if("touches"in x&&$==="h"&&F.type==="range")return!1;var D=window.getSelection(),W=D&&D.anchorNode,ne=W?W===F||W.contains(F):!1;if(ne)return!1;var oe=zS($,F);if(!oe)return!0;if(oe?I=$:(I=$==="v"?"h":"v",oe=zS($,F)),!oe)return!1;if(!s.current&&"changedTouches"in x&&(k||L)&&(s.current=I),!I)return!0;var ie=s.current||I;return x8(ie,C,x,ie==="h"?k:L)},[]),h=w.useCallback(function(x){var C=x;if(!(!Ys.length||Ys[Ys.length-1]!==l)){var O="deltaY"in C?LS(C):Ul(C),U=t.current.filter(function(I){return I.name===C.type&&(I.target===C.target||C.target===I.shadowParent)&&E8(I.delta,O)})[0];if(U&&U.should){C.cancelable&&C.preventDefault();return}if(!U){var k=(u.current.shards||[]).map(DS).filter(Boolean).filter(function(I){return I.contains(C.target)}),L=k.length>0?f(C,k[0]):!u.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),m=w.useCallback(function(x,C,O,U){var k={name:x,delta:C,target:O,should:U,shadowParent:A8(O)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(L){return L!==k})},1)},[]),y=w.useCallback(function(x){r.current=Ul(x),s.current=void 0},[]),g=w.useCallback(function(x){m(x.type,LS(x),x.target,f(x,e.lockRef.current))},[]),b=w.useCallback(function(x){m(x.type,Ul(x),x.target,f(x,e.lockRef.current))},[]);w.useEffect(function(){return Ys.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:b}),document.addEventListener("wheel",h,Gs),document.addEventListener("touchmove",h,Gs),document.addEventListener("touchstart",y,Gs),function(){Ys=Ys.filter(function(x){return x!==l}),document.removeEventListener("wheel",h,Gs),document.removeEventListener("touchmove",h,Gs),document.removeEventListener("touchstart",y,Gs)}},[]);var S=e.removeScrollBar,E=e.inert;return w.createElement(w.Fragment,null,E?w.createElement(l,{styles:R8(a)}):null,S?w.createElement(g8,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function A8(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const O8=r8(wx,T8);var Sm=w.forwardRef(function(e,t){return w.createElement(Vu,Fn({},e,{ref:t,sideCar:O8}))});Sm.classNames=Vu.classNames;var _p=["Enter"," "],M8=["ArrowDown","PageUp","Home"],Cx=["ArrowUp","PageDown","End"],k8=[...M8,...Cx],N8={ltr:[..._p,"ArrowRight"],rtl:[..._p,"ArrowLeft"]},z8={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ja="Menu",[Za,L8,D8]=D1(Ja),[rs,Tx]=wi(Ja,[D8,qu,dx]),Hu=qu(),Ax=dx(),[j8,os]=rs(Ja),[P8,Wa]=rs(Ja),Ox=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:a,onOpenChange:l,modal:u=!0}=e,f=Hu(t),[h,m]=w.useState(null),y=w.useRef(!1),g=Kn(l),b=j1(a);return w.useEffect(()=>{const S=()=>{y.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>y.current=!1;return document.addEventListener("keydown",S,{capture:!0}),()=>{document.removeEventListener("keydown",S,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),_.jsx(cx,{...f,children:_.jsx(j8,{scope:t,open:r,onOpenChange:g,content:h,onContentChange:m,children:_.jsx(P8,{scope:t,onClose:w.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:y,dir:b,modal:u,children:s})})})};Ox.displayName=Ja;var U8="MenuAnchor",wm=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,a=Hu(r);return _.jsx(vm,{...a,...s,ref:t})});wm.displayName=U8;var _m="MenuPortal",[$8,Mx]=rs(_m,{forceMount:void 0}),kx=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:a}=e,l=os(_m,t);return _.jsx($8,{scope:t,forceMount:r,children:_.jsx(ns,{present:r||l.open,children:_.jsx(bm,{asChild:!0,container:a,children:s})})})};kx.displayName=_m;var Rn="MenuContent",[I8,xm]=rs(Rn),Nx=w.forwardRef((e,t)=>{const r=Mx(Rn,e.__scopeMenu),{forceMount:s=r.forceMount,...a}=e,l=os(Rn,e.__scopeMenu),u=Wa(Rn,e.__scopeMenu);return _.jsx(Za.Provider,{scope:e.__scopeMenu,children:_.jsx(ns,{present:s||l.open,children:_.jsx(Za.Slot,{scope:e.__scopeMenu,children:u.modal?_.jsx(B8,{...a,ref:t}):_.jsx(q8,{...a,ref:t})})})})}),B8=w.forwardRef((e,t)=>{const r=os(Rn,e.__scopeMenu),s=w.useRef(null),a=Mt(t,s);return w.useEffect(()=>{const l=s.current;if(l)return vx(l)},[]),_.jsx(Em,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),q8=w.forwardRef((e,t)=>{const r=os(Rn,e.__scopeMenu);return _.jsx(Em,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),V8=$U("MenuContent.ScrollLock"),Em=w.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:S,disableOutsideScroll:E,...x}=e,C=os(Rn,r),O=Wa(Rn,r),U=Hu(r),k=Ax(r),L=L8(r),[I,F]=w.useState(null),$=w.useRef(null),D=Mt(t,$,C.onContentChange),W=w.useRef(0),ne=w.useRef(""),oe=w.useRef(0),ie=w.useRef(null),de=w.useRef("right"),ue=w.useRef(0),ve=E?Sm:w.Fragment,j=E?{as:V8,allowPinchZoom:!0}:void 0,Y=te=>{const be=ne.current+te,N=L().filter(se=>!se.disabled),G=document.activeElement,ee=N.find(se=>se.ref.current===G)?.textValue,re=N.map(se=>se.textValue),he=t$(re,be,ee),ge=N.find(se=>se.textValue===he)?.ref.current;(function se(Pe){ne.current=Pe,window.clearTimeout(W.current),Pe!==""&&(W.current=window.setTimeout(()=>se(""),1e3))})(be),ge&&setTimeout(()=>ge.focus())};w.useEffect(()=>()=>window.clearTimeout(W.current),[]),$1();const V=w.useCallback(te=>de.current===ie.current?.side&&r$(te,ie.current?.area),[]);return _.jsx(I8,{scope:r,searchRef:ne,onItemEnter:w.useCallback(te=>{V(te)&&te.preventDefault()},[V]),onItemLeave:w.useCallback(te=>{V(te)||($.current?.focus(),F(null))},[V]),onTriggerLeave:w.useCallback(te=>{V(te)&&te.preventDefault()},[V]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:w.useCallback(te=>{ie.current=te},[]),children:_.jsx(ve,{...j,children:_.jsx(lm,{asChild:!0,trapped:a,onMountAutoFocus:Ce(l,te=>{te.preventDefault(),$.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:_.jsx(cm,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:S,children:_.jsx(PU,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:s,currentTabStopId:I,onCurrentTabStopIdChange:F,onEntryFocus:Ce(h,te=>{O.isUsingKeyboardRef.current||te.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(lx,{role:"menu","aria-orientation":"vertical","data-state":Gx(C.open),"data-radix-menu-content":"",dir:O.dir,...U,...x,ref:D,style:{outline:"none",...x.style},onKeyDown:Ce(x.onKeyDown,te=>{const N=te.target.closest("[data-radix-menu-content]")===te.currentTarget,G=te.ctrlKey||te.altKey||te.metaKey,ee=te.key.length===1;N&&(te.key==="Tab"&&te.preventDefault(),!G&&ee&&Y(te.key));const re=$.current;if(te.target!==re||!k8.includes(te.key))return;te.preventDefault();const ge=L().filter(se=>!se.disabled).map(se=>se.ref.current);Cx.includes(te.key)&&ge.reverse(),W8(ge)}),onBlur:Ce(e.onBlur,te=>{te.currentTarget.contains(te.target)||(window.clearTimeout(W.current),ne.current="")}),onPointerMove:Ce(e.onPointerMove,Qa(te=>{const be=te.target,N=ue.current!==te.clientX;if(te.currentTarget.contains(be)&&N){const G=te.clientX>ue.current?"right":"left";de.current=G,ue.current=te.clientX}}))})})})})})})});Nx.displayName=Rn;var H8="MenuGroup",Rm=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{role:"group",...s,ref:t})});Rm.displayName=H8;var F8="MenuLabel",zx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{...s,ref:t})});zx.displayName=F8;var Su="MenuItem",jS="menu.itemSelect",Fu=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...a}=e,l=w.useRef(null),u=Wa(Su,e.__scopeMenu),f=xm(Su,e.__scopeMenu),h=Mt(t,l),m=w.useRef(!1),y=()=>{const g=l.current;if(!r&&g){const b=new CustomEvent(jS,{bubbles:!0,cancelable:!0});g.addEventListener(jS,S=>s?.(S),{once:!0}),L1(g,b),b.defaultPrevented?m.current=!1:u.onClose()}};return _.jsx(Lx,{...a,ref:h,disabled:r,onClick:Ce(e.onClick,y),onPointerDown:g=>{e.onPointerDown?.(g),m.current=!0},onPointerUp:Ce(e.onPointerUp,g=>{m.current||g.currentTarget?.click()}),onKeyDown:Ce(e.onKeyDown,g=>{const b=f.searchRef.current!=="";r||b&&g.key===" "||_p.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Fu.displayName=Su;var Lx=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:a,...l}=e,u=xm(Su,r),f=Ax(r),h=w.useRef(null),m=Mt(t,h),[y,g]=w.useState(!1),[b,S]=w.useState("");return w.useEffect(()=>{const E=h.current;E&&S((E.textContent??"").trim())},[l.children]),_.jsx(Za.ItemSlot,{scope:r,disabled:s,textValue:a??b,children:_.jsx(UU,{asChild:!0,...f,focusable:!s,children:_.jsx(Tt.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:Ce(e.onPointerMove,Qa(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,Qa(E=>u.onItemLeave(E))),onFocus:Ce(e.onFocus,()=>g(!0)),onBlur:Ce(e.onBlur,()=>g(!1))})})})}),Z8="MenuCheckboxItem",Dx=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...a}=e;return _.jsx(Ix,{scope:e.__scopeMenu,checked:r,children:_.jsx(Fu,{role:"menuitemcheckbox","aria-checked":wu(r)?"mixed":r,...a,ref:t,"data-state":Tm(r),onSelect:Ce(a.onSelect,()=>s?.(wu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Dx.displayName=Z8;var jx="MenuRadioGroup",[Q8,G8]=rs(jx,{value:void 0,onValueChange:()=>{}}),Px=w.forwardRef((e,t)=>{const{value:r,onValueChange:s,...a}=e,l=Kn(s);return _.jsx(Q8,{scope:e.__scopeMenu,value:r,onValueChange:l,children:_.jsx(Rm,{...a,ref:t})})});Px.displayName=jx;var Ux="MenuRadioItem",$x=w.forwardRef((e,t)=>{const{value:r,...s}=e,a=G8(Ux,e.__scopeMenu),l=r===a.value;return _.jsx(Ix,{scope:e.__scopeMenu,checked:l,children:_.jsx(Fu,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Tm(l),onSelect:Ce(s.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});$x.displayName=Ux;var Cm="MenuItemIndicator",[Ix,Y8]=rs(Cm,{checked:!1}),Bx=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...a}=e,l=Y8(Cm,r);return _.jsx(ns,{present:s||wu(l.checked)||l.checked===!0,children:_.jsx(Tt.span,{...a,ref:t,"data-state":Tm(l.checked)})})});Bx.displayName=Cm;var K8="MenuSeparator",qx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});qx.displayName=K8;var X8="MenuArrow",Vx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,a=Hu(r);return _.jsx(ux,{...a,...s,ref:t})});Vx.displayName=X8;var J8="MenuSub",[YB,Hx]=rs(J8),Oa="MenuSubTrigger",Fx=w.forwardRef((e,t)=>{const r=os(Oa,e.__scopeMenu),s=Wa(Oa,e.__scopeMenu),a=Hx(Oa,e.__scopeMenu),l=xm(Oa,e.__scopeMenu),u=w.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=w.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return w.useEffect(()=>y,[y]),w.useEffect(()=>{const g=f.current;return()=>{window.clearTimeout(g),h(null)}},[f,h]),_.jsx(wm,{asChild:!0,...m,children:_.jsx(Lx,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":Gx(r.open),...e,ref:So(t,a.onTriggerChange),onClick:g=>{e.onClick?.(g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,Qa(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Ce(e.onPointerLeave,Qa(g=>{y();const b=r.content?.getBoundingClientRect();if(b){const S=r.content?.dataset.side,E=S==="right",x=E?-5:5,C=b[E?"left":"right"],O=b[E?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:C,y:b.top},{x:O,y:b.top},{x:O,y:b.bottom},{x:C,y:b.bottom}],side:S}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(g),g.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,g=>{const b=l.searchRef.current!=="";e.disabled||b&&g.key===" "||N8[s.dir].includes(g.key)&&(r.onOpenChange(!0),r.content?.focus(),g.preventDefault())})})})});Fx.displayName=Oa;var Zx="MenuSubContent",Qx=w.forwardRef((e,t)=>{const r=Mx(Rn,e.__scopeMenu),{forceMount:s=r.forceMount,...a}=e,l=os(Rn,e.__scopeMenu),u=Wa(Rn,e.__scopeMenu),f=Hx(Zx,e.__scopeMenu),h=w.useRef(null),m=Mt(t,h);return _.jsx(Za.Provider,{scope:e.__scopeMenu,children:_.jsx(ns,{present:s||l.open,children:_.jsx(Za.Slot,{scope:e.__scopeMenu,children:_.jsx(Em,{id:f.contentId,"aria-labelledby":f.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,y=>{y.target!==f.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ce(e.onKeyDown,y=>{const g=y.currentTarget.contains(y.target),b=z8[u.dir].includes(y.key);g&&b&&(l.onOpenChange(!1),f.trigger?.focus(),y.preventDefault())})})})})})});Qx.displayName=Zx;function Gx(e){return e?"open":"closed"}function wu(e){return e==="indeterminate"}function Tm(e){return wu(e)?"indeterminate":e?"checked":"unchecked"}function W8(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function e$(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function t$(e,t,r){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=e$(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==r?h:void 0}function n$(e,t){const{x:r,y:s}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const f=t[l],h=t[u],m=f.x,y=f.y,g=h.x,b=h.y;y>s!=b>s&&r<(g-m)*(s-y)/(b-y)+m&&(a=!a)}return a}function r$(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return n$(r,t)}function Qa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var o$=Ox,s$=wm,i$=kx,a$=Nx,c$=Rm,l$=zx,u$=Fu,f$=Dx,d$=Px,h$=$x,p$=Bx,m$=qx,g$=Vx,y$=Fx,v$=Qx,Zu="DropdownMenu",[b$]=wi(Zu,[Tx]),jt=Tx(),[S$,Yx]=b$(Zu),Kx=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:a,defaultOpen:l,onOpenChange:u,modal:f=!0}=e,h=jt(t),m=w.useRef(null),[y,g]=am({prop:a,defaultProp:l??!1,onChange:u,caller:Zu});return _.jsx(S$,{scope:t,triggerId:mu(),triggerRef:m,contentId:mu(),open:y,onOpenChange:g,onOpenToggle:w.useCallback(()=>g(b=>!b),[g]),modal:f,children:_.jsx(o$,{...h,open:y,onOpenChange:g,dir:s,modal:f,children:r})})};Kx.displayName=Zu;var Xx="DropdownMenuTrigger",Jx=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...a}=e,l=Yx(Xx,r),u=jt(r);return _.jsx(s$,{asChild:!0,...u,children:_.jsx(Tt.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...a,ref:So(t,l.triggerRef),onPointerDown:Ce(e.onPointerDown,f=>{!s&&f.button===0&&f.ctrlKey===!1&&(l.onOpenToggle(),l.open||f.preventDefault())}),onKeyDown:Ce(e.onKeyDown,f=>{s||(["Enter"," "].includes(f.key)&&l.onOpenToggle(),f.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Jx.displayName=Xx;var w$="DropdownMenuPortal",Wx=e=>{const{__scopeDropdownMenu:t,...r}=e,s=jt(t);return _.jsx(i$,{...s,...r})};Wx.displayName=w$;var eE="DropdownMenuContent",tE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=Yx(eE,r),l=jt(r),u=w.useRef(!1);return _.jsx(a$,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...s,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,f=>{u.current||a.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,f=>{const h=f.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tE.displayName=eE;var _$="DropdownMenuGroup",x$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(c$,{...a,...s,ref:t})});x$.displayName=_$;var E$="DropdownMenuLabel",nE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(l$,{...a,...s,ref:t})});nE.displayName=E$;var R$="DropdownMenuItem",rE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(u$,{...a,...s,ref:t})});rE.displayName=R$;var C$="DropdownMenuCheckboxItem",T$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(f$,{...a,...s,ref:t})});T$.displayName=C$;var A$="DropdownMenuRadioGroup",O$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(d$,{...a,...s,ref:t})});O$.displayName=A$;var M$="DropdownMenuRadioItem",k$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(h$,{...a,...s,ref:t})});k$.displayName=M$;var N$="DropdownMenuItemIndicator",z$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(p$,{...a,...s,ref:t})});z$.displayName=N$;var L$="DropdownMenuSeparator",oE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(m$,{...a,...s,ref:t})});oE.displayName=L$;var D$="DropdownMenuArrow",j$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(g$,{...a,...s,ref:t})});j$.displayName=D$;var P$="DropdownMenuSubTrigger",U$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(y$,{...a,...s,ref:t})});U$.displayName=P$;var $$="DropdownMenuSubContent",I$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(v$,{...a,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});I$.displayName=$$;var B$=Kx,q$=Jx,V$=Wx,H$=tE,F$=nE,Z$=rE,Q$=oE;function G$({...e}){return _.jsx(B$,{"data-slot":"dropdown-menu",...e})}function Y$({...e}){return _.jsx(q$,{"data-slot":"dropdown-menu-trigger",...e})}function K$({className:e,sideOffset:t=4,...r}){return _.jsx(V$,{children:_.jsx(H$,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Dt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function PS({className:e,inset:t,variant:r="default",...s}){return _.jsx(Z$,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Dt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s})}function X$({className:e,inset:t,...r}){return _.jsx(F$,{"data-slot":"dropdown-menu-label","data-inset":t,className:Dt("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function US({className:e,...t}){return _.jsx(Q$,{"data-slot":"dropdown-menu-separator",className:Dt("bg-border -mx-1 my-1 h-px",e),...t})}function J$(e,t=[]){let r=[];function s(l,u){const f=w.createContext(u);f.displayName=l+"Context";const h=r.length;r=[...r,u];const m=g=>{const{scope:b,children:S,...E}=g,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return _.jsx(x.Provider,{value:C,children:S})};m.displayName=l+"Provider";function y(g,b){const S=b?.[e]?.[h]||f,E=w.useContext(S);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||l;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return a.scopeName=e,[s,W$(a,...t)]}function W$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=s.reduce((f,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...f,...g}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var eI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Am=eI.reduce((e,t)=>{const r=N1(`Primitive.${t}`),s=w.forwardRef((a,l)=>{const{asChild:u,...f}=a,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(h,{...f,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),tI=Jw();function nI(){return tI.useSyncExternalStore(rI,()=>!0,()=>!1)}function rI(){return()=>{}}var Om="Avatar",[oI]=J$(Om),[sI,sE]=oI(Om),iE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[a,l]=w.useState("idle");return _.jsx(sI,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:l,children:_.jsx(Am.span,{...s,ref:t})})});iE.displayName=Om;var aE="AvatarImage",cE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:a=()=>{},...l}=e,u=sE(aE,r),f=iI(s,l),h=Kn(m=>{a(m),u.onImageLoadingStatusChange(m)});return Ln(()=>{f!=="idle"&&h(f)},[f,h]),f==="loaded"?_.jsx(Am.img,{...l,ref:t,src:s}):null});cE.displayName=aE;var lE="AvatarFallback",uE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...a}=e,l=sE(lE,r),[u,f]=w.useState(s===void 0);return w.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>f(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&l.imageLoadingStatus!=="loaded"?_.jsx(Am.span,{...a,ref:t}):null});uE.displayName=lE;function $S(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function iI(e,{referrerPolicy:t,crossOrigin:r}){const s=nI(),a=w.useRef(null),l=s?(a.current||(a.current=new window.Image),a.current):null,[u,f]=w.useState(()=>$S(l,e));return Ln(()=>{f($S(l,e))},[l,e]),Ln(()=>{const h=g=>()=>{f(g)};if(!l)return;const m=h("loaded"),y=h("error");return l.addEventListener("load",m),l.addEventListener("error",y),t&&(l.referrerPolicy=t),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",m),l.removeEventListener("error",y)}},[l,r,t]),u}var aI=iE,cI=cE,lI=uE;function uI({className:e,...t}){return _.jsx(aI,{"data-slot":"avatar",className:Dt("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function fI({className:e,...t}){return _.jsx(cI,{"data-slot":"avatar-image",className:Dt("aspect-square size-full",e),...t})}function dI({className:e,...t}){return _.jsx(lI,{"data-slot":"avatar-fallback",className:Dt("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const IS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,BS=N_,hI=(e,t)=>r=>{var s;if(t?.variants==null)return BS(e,r?.class,r?.className);const{variants:a,defaultVariants:l}=t,u=Object.keys(a).map(m=>{const y=r?.[m],g=l?.[m];if(y===null)return null;const b=IS(y)||IS(g);return a[m][b]}),f=r&&Object.entries(r).reduce((m,y)=>{let[g,b]=y;return b===void 0||(m[g]=b),m},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,y)=>{let{class:g,className:b,...S}=y;return Object.entries(S).every(E=>{let[x,C]=E;return Array.isArray(C)?C.includes({...l,...f}[x]):{...l,...f}[x]===C})?[...m,g,b]:m},[]);return BS(e,u,h,r?.class,r?.className)},pI=hI("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Jh({className:e,variant:t="default",size:r="default",asChild:s=!1,...a}){const l=s?z1:"button";return _.jsx(l,{"data-slot":"button","data-variant":t,"data-size":r,className:Dt(pI({variant:t,size:r,className:e})),...a})}function mI(e){const t=gI(e),r=w.forwardRef((s,a)=>{const{children:l,...u}=s,f=w.Children.toArray(l),h=f.find(vI);if(h){const m=h.props.children,y=f.map(g=>g===h?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:g);return _.jsx(t,{...u,ref:a,children:w.isValidElement(m)?w.cloneElement(m,void 0,y):null})}return _.jsx(t,{...u,ref:a,children:l})});return r.displayName=`${e}.Slot`,r}function gI(e){const t=w.forwardRef((r,s)=>{const{children:a,...l}=r;if(w.isValidElement(a)){const u=SI(a),f=bI(l,a.props);return a.type!==w.Fragment&&(f.ref=s?So(s,u):u),w.cloneElement(a,f)}return w.Children.count(a)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yI=Symbol("radix.slottable");function vI(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yI}function bI(e,t){const r={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?r[s]=(...f)=>{const h=l(...f);return a(...f),h}:a&&(r[s]=a):s==="style"?r[s]={...a,...l}:s==="className"&&(r[s]=[a,l].filter(Boolean).join(" "))}return{...e,...r}}function SI(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Qu="Popover",[fE]=wi(Qu,[qu]),ec=qu(),[wI,wo]=fE(Qu),dE=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:a,onOpenChange:l,modal:u=!1}=e,f=ec(t),h=w.useRef(null),[m,y]=w.useState(!1),[g,b]=am({prop:s,defaultProp:a??!1,onChange:l,caller:Qu});return _.jsx(cx,{...f,children:_.jsx(wI,{scope:t,contentId:mu(),triggerRef:h,open:g,onOpenChange:b,onOpenToggle:w.useCallback(()=>b(S=>!S),[b]),hasCustomAnchor:m,onCustomAnchorAdd:w.useCallback(()=>y(!0),[]),onCustomAnchorRemove:w.useCallback(()=>y(!1),[]),modal:u,children:r})})};dE.displayName=Qu;var hE="PopoverAnchor",_I=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(hE,r),l=ec(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=a;return w.useEffect(()=>(u(),()=>f()),[u,f]),_.jsx(vm,{...l,...s,ref:t})});_I.displayName=hE;var pE="PopoverTrigger",mE=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(pE,r),l=ec(r),u=Mt(t,a.triggerRef),f=_.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":SE(a.open),...s,ref:u,onClick:Ce(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?f:_.jsx(vm,{asChild:!0,...l,children:f})});mE.displayName=pE;var Mm="PopoverPortal",[xI,EI]=fE(Mm,{forceMount:void 0}),gE=e=>{const{__scopePopover:t,forceMount:r,children:s,container:a}=e,l=wo(Mm,t);return _.jsx(xI,{scope:t,forceMount:r,children:_.jsx(ns,{present:r||l.open,children:_.jsx(bm,{asChild:!0,container:a,children:s})})})};gE.displayName=Mm;var gi="PopoverContent",yE=w.forwardRef((e,t)=>{const r=EI(gi,e.__scopePopover),{forceMount:s=r.forceMount,...a}=e,l=wo(gi,e.__scopePopover);return _.jsx(ns,{present:s||l.open,children:l.modal?_.jsx(CI,{...a,ref:t}):_.jsx(TI,{...a,ref:t})})});yE.displayName=gi;var RI=mI("PopoverContent.RemoveScroll"),CI=w.forwardRef((e,t)=>{const r=wo(gi,e.__scopePopover),s=w.useRef(null),a=Mt(t,s),l=w.useRef(!1);return w.useEffect(()=>{const u=s.current;if(u)return vx(u)},[]),_.jsx(Sm,{as:RI,allowPinchZoom:!0,children:_.jsx(vE,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,u=>{const f=u.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,m=f.button===2||h;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:Ce(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),TI=w.forwardRef((e,t)=>{const r=wo(gi,e.__scopePopover),s=w.useRef(!1),a=w.useRef(!1);return _.jsx(vE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(s.current||r.triggerRef.current?.focus(),l.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),vE=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:y,...g}=e,b=wo(gi,r),S=ec(r);return $1(),_.jsx(lm,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:_.jsx(cm,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:y,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>b.onOpenChange(!1),children:_.jsx(lx,{"data-state":SE(b.open),role:"dialog",id:b.contentId,...S,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),bE="PopoverClose",AI=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(bE,r);return _.jsx(Tt.button,{type:"button",...s,ref:t,onClick:Ce(e.onClick,()=>a.onOpenChange(!1))})});AI.displayName=bE;var OI="PopoverArrow",MI=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=ec(r);return _.jsx(ux,{...a,...s,ref:t})});MI.displayName=OI;function SE(e){return e?"open":"closed"}var kI=dE,NI=mE,zI=gE,LI=yE;function qS({...e}){return _.jsx(kI,{"data-slot":"popover",...e})}function VS({...e}){return _.jsx(NI,{"data-slot":"popover-trigger",...e})}function HS({className:e,align:t="center",sideOffset:r=4,...s}){return _.jsx(zI,{children:_.jsx(LI,{"data-slot":"popover-content",align:t,sideOffset:r,className:Dt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...s})})}const DI=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],jI=[{label:"Documentation",url:"https://docs.convex.dev",icon:QN},{label:"API Reference",url:"https://docs.convex.dev/api",icon:lz},{label:"Community Discord",url:"https://discord.gg/convex",icon:Yz}],PI={"/":"Dashboard","/content":"Content","/media":"Media Library","/content-types":"Content Types","/settings":"Settings","/taxonomies":"Taxonomies","/trash":"Trash","/entries":"Entries","/entries/type":"Content Types","/entries/new":"New Entry"};function UI(e,t,r){const s=[{label:t,to:"/"}];if(e==="/")return s;const a=e.split("/").filter(Boolean);let l="";return a.forEach((u,f)=>{l+=`/${u}`;const h=f===a.length-1;let m=r.get(l)??PI[l];m||(m=u.charAt(0).toUpperCase()+u.slice(1).replace(/-/g," ")),h?s.push({label:m}):s.push({label:m,to:l})}),s}function $I(){const e=Je(),t=Nu(),{branding:r}=im();let s=new Map;try{s=a6().overrides}catch{}const a=UI(e.location.pathname,r.appName,s);let l=null,u=null,f=async()=>{},h=!1;try{const x=Q_();l=x.user,u=x.role,f=x.logout,h=x.isAuthenticated}catch{}const y=(u?dL(u):null)?.displayName??u??"No Role",g=l?.name??l?.email??"User",b=x=>{const C=x.split(" ");return C.length>=2?`${C[0][0]}${C[1][0]}`.toUpperCase():x.slice(0,2).toUpperCase()},S=l?.name?b(l.name):"U",E=async()=>{await f()};return _.jsxs("header",{className:"sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background/95 px-6 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[_.jsx(v6,{children:_.jsx(b6,{children:a.map((x,C)=>_.jsxs(w.Fragment,{children:[C>0&&_.jsx(x6,{}),_.jsx(S6,{children:x.to?_.jsx(w6,{asChild:!0,children:_.jsxs(Pa,{to:x.to,className:"flex items-center gap-1.5",children:[C===0&&_.jsx(A_,{className:"size-3.5"}),_.jsx("span",{children:x.label})]})}):_.jsx(_6,{children:x.label})})]},C))})}),_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsxs(qS,{children:[_.jsx(VS,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",size:"icon",className:"size-9",children:[_.jsx(fp,{className:"size-4"}),_.jsx("span",{className:"sr-only",children:"Notifications"})]})}),_.jsxs(HS,{align:"end",className:"w-80",children:[_.jsx("div",{className:"flex items-center justify-between pb-2",children:_.jsx("h4",{className:"font-medium",children:"Notifications"})}),_.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[_.jsx(fp,{className:"size-8 text-muted-foreground/50"}),_.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),_.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),_.jsxs(qS,{children:[_.jsx(VS,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",size:"icon",className:"size-9",children:[_.jsx(T_,{className:"size-4"}),_.jsx("span",{className:"sr-only",children:"Help"})]})}),_.jsxs(HS,{align:"end",className:"w-72",children:[_.jsx("div",{className:"pb-2",children:_.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),_.jsxs("div",{className:"space-y-4",children:[_.jsxs("div",{children:[_.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),_.jsx("div",{className:"space-y-1",children:DI.map((x,C)=>_.jsxs("div",{className:"flex items-center justify-between text-sm",children:[_.jsx("span",{className:"text-muted-foreground",children:x.description}),_.jsx("div",{className:"flex gap-0.5",children:x.keys.map((O,U)=>_.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:O},U))})]},C))})]}),_.jsxs("div",{children:[_.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),_.jsx("div",{className:"space-y-1",children:jI.map(x=>_.jsxs("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent",children:[_.jsx(x.icon,{className:"size-4 text-muted-foreground"}),_.jsx("span",{className:"flex-1",children:x.label}),_.jsx(hz,{className:"size-3 text-muted-foreground"})]},x.label))})]})]})]})]}),_.jsxs(G$,{children:[_.jsx(Y$,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[_.jsxs(uI,{className:"size-6",children:[_.jsx(fI,{src:l?.avatarUrl,alt:g}),_.jsx(dI,{className:"text-xs",children:S})]}),_.jsx("span",{className:"text-sm font-medium",children:g}),_.jsx(C_,{className:"size-3.5 text-muted-foreground"})]})}),_.jsxs(K$,{align:"end",className:"w-56",children:[_.jsx(X$,{className:"font-normal",children:_.jsxs("div",{className:"flex flex-col space-y-1",children:[_.jsx("p",{className:"text-sm font-medium",children:g}),l?.email&&_.jsx("p",{className:"text-xs text-muted-foreground",children:l.email}),_.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})}),_.jsx(US,{}),_.jsxs(PS,{onClick:()=>t({to:"/settings"}),children:[_.jsx(M_,{className:"mr-2 size-4"}),_.jsx("span",{children:"Profile & Settings"})]}),h&&_.jsxs(_.Fragment,{children:[_.jsx(US,{}),_.jsxs(PS,{onClick:E,className:"text-destructive focus:text-destructive",children:[_.jsx(Vz,{className:"mr-2 size-4"}),_.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function II({children:e}){const{layout:t}=im();return _.jsxs("div",{className:"flex min-h-screen bg-background",children:[_.jsx(u6,{}),_.jsxs("div",{className:"flex flex-1 flex-col",style:{marginLeft:t.sidebarWidth},children:[_.jsx($I,{}),_.jsx("main",{className:"flex-1 overflow-auto p-6",children:e})]})]})}function BI(){return _.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:_.jsx($z,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function qI(){return _.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),_.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),_.jsx("h2",{children:"Authentication Required"}),_.jsx("p",{children:"Please log in to access the admin panel."})]})}function Wh({requiredRole:e,requiredPermission:t}){return _.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"10"}),_.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),_.jsx("h2",{children:"Access Denied"}),_.jsx("p",{children:"You don't have permission to access this page."}),e&&_.jsxs("p",{className:"route-guard-detail",children:["Required role: ",_.jsx("strong",{children:e})]}),t&&_.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",_.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function VI({error:e}){return _.jsxs("div",{className:"route-guard route-guard--error",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"10"}),_.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),_.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),_.jsx("h2",{children:"Authentication Error"}),_.jsx("p",{children:e})]})}function HI({children:e,requiredPermission:t,requiredRole:r,loadingComponent:s,unauthenticatedComponent:a,unauthorizedComponent:l,onUnauthenticated:u,onUnauthorized:f}){const{authState:h,role:m,checkPermission:y,error:g}=Q_();return h==="loading"?_.jsx(_.Fragment,{children:s??_.jsx(BI,{})}):h==="error"?_.jsx(VI,{error:g??"An error occurred"}):h==="unauthenticated"?(u?.(),_.jsx(_.Fragment,{children:a??_.jsx(qI,{})})):m?r&&m!==r?(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})})):t&&!y(t)?(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})})):_.jsx(_.Fragment,{children:e}):(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})}))}const wE=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")};function FS(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function xp(e,t){const r=Object.create(null);if(e)for(const s of Object.keys(e))FS(s)&&(r[s]=e[s]);if(t&&typeof t=="object")for(const s of Object.keys(t))FS(s)&&(r[s]=t[s]);return r}function _E(e){return Object.create(null)}const Zl=(e,t)=>{const r=t||e||{};return typeof r.method>"u"&&(r.method="GET"),Object.assign(l=>{const u={...r,...l};return Zl(void 0,u)},{options:r,middleware:l=>{const u=[...r.middleware||[]];l.map(m=>{u0 in m?m.options.middleware&&u.push(...m.options.middleware):u.push(m)});const f={...r,middleware:u},h=Zl(void 0,f);return h[u0]=!0,h},inputValidator:l=>{const u={...r,inputValidator:l};return Zl(void 0,u)},handler:(...l)=>{const[u,f]=l,h={...r,extractedFn:u,serverFn:f},m=[...h.middleware||[],QI(h)];return Object.assign(async y=>{const g=await ZS(m,"client",{...u,...h,data:y?.data,headers:y?.headers,signal:y?.signal,fetch:y?.fetch,context:_E()}),b=lw(g.error);if(b)throw b;if(g.error)throw g.error;return g.result},{...u,__executeServer:async(y,g)=>{const b=wE(),S=b.contextAfterGlobalMiddlewares,E={...u,...y,serverFnMeta:u.serverFnMeta,context:xp(S,y.context),signal:g,request:b.request};return await ZS(m,"server",E).then(C=>({result:C.result,error:C.error,context:C.sendContext}))}})}})};async function ZS(e,t,r){const s=Pp()?.functionMiddleware||[];let a=FI([...s,...e]);if(t==="server"){const u=wE();u?.executedRequestMiddlewares&&(a=a.filter(f=>!u.executedRequestMiddlewares.has(f)))}const l=async u=>{const f=a.shift();if(!f)return u;try{"inputValidator"in f.options&&f.options.inputValidator&&t==="server"&&(u.data=await ZI(f.options.inputValidator,u.data));let h;if(t==="client"?"client"in f.options&&(h=f.options.client):"server"in f.options&&(h=f.options.server),h){const y=await h({...u,next:async(g={})=>{const b={...u,...g,context:xp(u.context,g.context),sendContext:xp(u.sendContext,g.sendContext),headers:IM(u.headers,g.headers),_callSiteFetch:u._callSiteFetch,fetch:u._callSiteFetch??g.fetch??u.fetch,result:g.result!==void 0?g.result:g instanceof Response?g:u.result,error:g.error??u.error},S=await l(b);if(S.error)throw S.error;return S}});if(ln(y))return{...u,error:y};if(y instanceof Response)return{...u,result:y};if(!y)throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");return y}return l(u)}catch(h){return{...u,error:h}}};return l({...r,headers:r.headers||{},sendContext:r.sendContext||{},context:r.context||_E(),_callSiteFetch:r.fetch})}function FI(e,t=100){const r=new Set,s=[],a=(l,u)=>{if(u>t)throw new Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);l.forEach(f=>{f.options.middleware&&a(f.options.middleware,u+1),r.has(f)||(r.add(f),s.push(f))})};return a(e,0),s}async function ZI(e,t){if(e==null)return{};if("~standard"in e){const r=await e["~standard"].validate(t);if(r.issues)throw new Error(JSON.stringify(r.issues,void 0,2));return r.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function QI(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:r,fetch:s,...a})=>{const l={...a,context:r,fetch:s},u=await e.extractedFn?.(l);return t(u)},server:async({next:t,...r})=>{const s=await e.serverFn?.(r);return t({...r,result:s})}}}}const GI=Zl({method:"GET"}).handler(l_("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819")),QS=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),GS=()=>"admin",YS=()=>{console.log("Logout called (mock mode)")},YI=()=>null,KI=()=>null,XI=()=>{};function JI(e){switch(e){case"mock":case"demo":return{getUser:QS,getUserRole:GS,onLogout:YS};case"none":case"disabled":return{getUser:YI,getUserRole:KI,onLogout:XI};default:return{getUser:QS,getUserRole:GS,onLogout:YS}}}const An=wM({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"Convex CMS Admin"},{name:"description",content:"Admin interface for Convex CMS - manage content, media, and publishing workflows"}],links:[{rel:"stylesheet",href:PN},{rel:"icon",href:"/favicon.ico"}]}),loader:async()=>({config:await GI()}),component:WI});function WI(){const{config:e}=An.useLoaderData(),t=w.useMemo(()=>JI(e.authMode),[e.authMode]),r=w.useMemo(()=>e6(e.adminConfig),[e.adminConfig]);return _.jsx(tB,{children:_.jsx(mL,{children:_.jsx(i6,{children:_.jsx(eB,{config:e,adminConfig:r,children:_.jsx(pL,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:_.jsx(HI,{children:_.jsx(II,{children:_.jsx(n_,{})})})})})})})})}function eB({children:e,config:t,adminConfig:r}){const s=w.useMemo(()=>t.convexUrl?new TN(t.convexUrl):null,[t.convexUrl]);return s?_.jsx(ON,{client:s,children:_.jsx(s6,{baseConfig:r,children:e})}):_.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:_.jsxs("div",{className:"max-w-lg space-y-4 rounded-lg border border-amber-200 bg-amber-50 p-6 text-center",children:[_.jsx("h2",{className:"text-xl font-semibold text-amber-900",children:"Convex Configuration Required"}),_.jsx("p",{className:"text-sm text-amber-800",children:"Please provide a Convex deployment URL to connect to your backend."}),_.jsxs("div",{className:"space-y-2 text-left text-sm text-amber-700",children:[_.jsx("p",{className:"font-medium",children:"Options:"}),_.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[_.jsxs("li",{children:["Run with URL:"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),_.jsxs("li",{children:["Set environment variable:"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]}),_.jsxs("li",{children:["Add to"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:".env.local"}),":"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]}),_.jsxs("p",{className:"text-sm text-amber-700",children:["Run"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex dev"})," to start Convex and get your URL."]})]})})}function tB({children:e}){return _.jsxs("html",{lang:"en",children:[_.jsx("head",{children:_.jsx(PM,{})}),_.jsxs("body",{children:[e,_.jsx(UM,{})]})]})}const nB="modulepreload",rB=function(e){return"/"+e},KS={},er=function(t,r,s){let a=Promise.resolve();if(r&&r.length>0){let h=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");a=h(r.map(m=>{if(m=rB(m),m in KS)return;KS[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":nB,y||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((S,E)=>{b.addEventListener("load",S),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},oB=()=>er(()=>import("./trash-B3daldm5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),sB=Cn("/trash")({component:Jn(oB,"component")}),iB=()=>er(()=>import("./taxonomies-CgG46fIF.js"),__vite__mapDeps([12,3,4,13,14,15,1,6,16,11])),aB=Cn("/taxonomies")({component:Jn(iB,"component")}),cB=()=>er(()=>import("./settings-BspTTv_o.js"),__vite__mapDeps([17,4,13,7,18,1,6,19,8,9,11])),lB=Cn("/settings")({component:Jn(cB,"component")}),uB=()=>er(()=>import("./media-DTJ3-ViE.js"),__vite__mapDeps([20,21,4,1,2,3,5,22,23,13,7,14,15,24,10])),fB=Cn("/media")({component:Jn(uB,"component")}),dB=()=>er(()=>import("./content-types-CjQliqVV.js"),__vite__mapDeps([25,3,4,13,14,7,9,15,26,24,27,1,2,5,11])),hB=Cn("/content-types")({component:Jn(dB,"component")}),pB=()=>er(()=>import("./content-OEBGlxg1.js"),__vite__mapDeps([28,18,4,3,7,27,29,9,1,2,5,30,15,11])),mB=Cn("/content")({component:Jn(pB,"component")}),gB=()=>er(()=>import("./index-BH_ECMhv.js"),__vite__mapDeps([31,1,11])),yB=Cn("/")({component:Jn(gB,"component")}),vB=()=>er(()=>import("./_entryId-BpSmrfAm.js"),__vite__mapDeps([32,33,13,3,4,19,21,14,26,7,5,23,30,15,24,16,9,29,18,34])),bB=Cn("/entries/$entryId")({component:Jn(vB,"component")}),SB=()=>er(()=>import("./_contentTypeId-DtZectcC.js"),__vite__mapDeps([35,18,34,1,2,3,4,5,30,22,23,7,15])),wB=Cn("/entries/type/$contentTypeId")({component:Jn(SB,"component")}),_B=()=>er(()=>import("./new._contentTypeId-CoTDxKzf.js"),__vite__mapDeps([36,33,13,3,4,19,21,14,26,7,5,23,30,15,24,16,9,29,34])),xB=Cn("/entries/new/$contentTypeId")({component:Jn(_B,"component")}),EB=sB.update({id:"/trash",path:"/trash",getParentRoute:()=>An}),RB=aB.update({id:"/taxonomies",path:"/taxonomies",getParentRoute:()=>An}),CB=lB.update({id:"/settings",path:"/settings",getParentRoute:()=>An}),TB=fB.update({id:"/media",path:"/media",getParentRoute:()=>An}),AB=hB.update({id:"/content-types",path:"/content-types",getParentRoute:()=>An}),OB=mB.update({id:"/content",path:"/content",getParentRoute:()=>An}),MB=yB.update({id:"/",path:"/",getParentRoute:()=>An}),kB=bB.update({id:"/entries/$entryId",path:"/entries/$entryId",getParentRoute:()=>An}),NB=wB.update({id:"/entries/type/$contentTypeId",path:"/entries/type/$contentTypeId",getParentRoute:()=>An}),zB=xB.update({id:"/entries/new/$contentTypeId",path:"/entries/new/$contentTypeId",getParentRoute:()=>An}),LB={IndexRoute:MB,ContentRoute:OB,ContentTypesRoute:AB,MediaRoute:TB,SettingsRoute:CB,TaxonomiesRoute:RB,TrashRoute:EB,EntriesEntryIdRoute:kB,EntriesNewContentTypeIdRoute:zB,EntriesTypeContentTypeIdRoute:NB},DB=An._addFileChildren(LB);function jB(){return MM({routeTree:DB,scrollRestoration:!0,defaultPreload:"intent"})}async function PB(){const e=await jB();let t;return t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(ok),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.state.matches.length||await qM(e),e}async function UB(){const e=await PB();return window.$_TSR?.h(),e}let ep;function $B(){return ep||(ep=UB()),_.jsx(JO,{promise:ep,children:e=>_.jsx(zM,{router:e})})}w.startTransition(()=>{X2.hydrateRoot(document,_.jsx(w.StrictMode,{children:_.jsx($B,{})}))});export{az as $,wB as A,Jh as B,C_ as C,G$ as D,mz as E,bz as F,Pa as G,A_ as H,Nz as I,VS as J,HS as K,$z as L,Q_ as M,hL as N,FB as O,qS as P,uL as Q,HI as R,t3 as S,h3 as T,xB as U,Ot as V,pI as W,N1 as X,Pz as Y,lz as Z,oz as _,HB as a,Mt as a0,j1 as a1,Tt as a2,ns as a3,wi as a4,Ce as a5,Kn as a6,Ln as a7,am as a8,gU as a9,mu as aa,PU as ab,UU as ac,dx as ad,a6 as ae,So as af,bm as ag,vx as ah,Sm as ai,$1 as aj,lm as ak,cm as al,GB as am,cx as an,vm as ao,zu as ap,qu as aq,D1 as ar,lx as as,ux as at,z1 as au,o6 as b,Dt as c,we as d,l3 as e,nz as f,QB as g,ZB as h,hI as i,_ as j,Y$ as k,K$ as l,PS as m,US as n,xz as o,Nu as p,XN as q,w as r,WN as s,f3 as t,MN as u,Tz as v,O_ as w,Je as x,Dp as y,bB as z};
97
+ `)},C8=0,Ys=[];function T8(e){var t=w.useRef([]),r=w.useRef([0,0]),s=w.useRef(),a=w.useState(C8++)[0],l=w.useState(_x)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=GU([e.lockRef.current],(e.shards||[]).map(DS),!0).filter(Boolean);return x.forEach(function(C){return C.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var f=w.useCallback(function(x,C){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!u.current.allowPinchZoom;var O=Ul(x),U=r.current,k="deltaX"in x?x.deltaX:U[0]-O[0],L="deltaY"in x?x.deltaY:U[1]-O[1],I,F=x.target,$=Math.abs(k)>Math.abs(L)?"h":"v";if("touches"in x&&$==="h"&&F.type==="range")return!1;var D=window.getSelection(),W=D&&D.anchorNode,ne=W?W===F||W.contains(F):!1;if(ne)return!1;var oe=zS($,F);if(!oe)return!0;if(oe?I=$:(I=$==="v"?"h":"v",oe=zS($,F)),!oe)return!1;if(!s.current&&"changedTouches"in x&&(k||L)&&(s.current=I),!I)return!0;var ie=s.current||I;return x8(ie,C,x,ie==="h"?k:L)},[]),h=w.useCallback(function(x){var C=x;if(!(!Ys.length||Ys[Ys.length-1]!==l)){var O="deltaY"in C?LS(C):Ul(C),U=t.current.filter(function(I){return I.name===C.type&&(I.target===C.target||C.target===I.shadowParent)&&E8(I.delta,O)})[0];if(U&&U.should){C.cancelable&&C.preventDefault();return}if(!U){var k=(u.current.shards||[]).map(DS).filter(Boolean).filter(function(I){return I.contains(C.target)}),L=k.length>0?f(C,k[0]):!u.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),m=w.useCallback(function(x,C,O,U){var k={name:x,delta:C,target:O,should:U,shadowParent:A8(O)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(L){return L!==k})},1)},[]),y=w.useCallback(function(x){r.current=Ul(x),s.current=void 0},[]),g=w.useCallback(function(x){m(x.type,LS(x),x.target,f(x,e.lockRef.current))},[]),b=w.useCallback(function(x){m(x.type,Ul(x),x.target,f(x,e.lockRef.current))},[]);w.useEffect(function(){return Ys.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:b}),document.addEventListener("wheel",h,Gs),document.addEventListener("touchmove",h,Gs),document.addEventListener("touchstart",y,Gs),function(){Ys=Ys.filter(function(x){return x!==l}),document.removeEventListener("wheel",h,Gs),document.removeEventListener("touchmove",h,Gs),document.removeEventListener("touchstart",y,Gs)}},[]);var S=e.removeScrollBar,E=e.inert;return w.createElement(w.Fragment,null,E?w.createElement(l,{styles:R8(a)}):null,S?w.createElement(g8,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function A8(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const O8=r8(wx,T8);var Sm=w.forwardRef(function(e,t){return w.createElement(Vu,Fn({},e,{ref:t,sideCar:O8}))});Sm.classNames=Vu.classNames;var _p=["Enter"," "],M8=["ArrowDown","PageUp","Home"],Cx=["ArrowUp","PageDown","End"],k8=[...M8,...Cx],N8={ltr:[..._p,"ArrowRight"],rtl:[..._p,"ArrowLeft"]},z8={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ja="Menu",[Za,L8,D8]=D1(Ja),[rs,Tx]=wi(Ja,[D8,qu,dx]),Hu=qu(),Ax=dx(),[j8,os]=rs(Ja),[P8,Wa]=rs(Ja),Ox=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:a,onOpenChange:l,modal:u=!0}=e,f=Hu(t),[h,m]=w.useState(null),y=w.useRef(!1),g=Kn(l),b=j1(a);return w.useEffect(()=>{const S=()=>{y.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>y.current=!1;return document.addEventListener("keydown",S,{capture:!0}),()=>{document.removeEventListener("keydown",S,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),_.jsx(cx,{...f,children:_.jsx(j8,{scope:t,open:r,onOpenChange:g,content:h,onContentChange:m,children:_.jsx(P8,{scope:t,onClose:w.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:y,dir:b,modal:u,children:s})})})};Ox.displayName=Ja;var U8="MenuAnchor",wm=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,a=Hu(r);return _.jsx(vm,{...a,...s,ref:t})});wm.displayName=U8;var _m="MenuPortal",[$8,Mx]=rs(_m,{forceMount:void 0}),kx=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:a}=e,l=os(_m,t);return _.jsx($8,{scope:t,forceMount:r,children:_.jsx(ns,{present:r||l.open,children:_.jsx(bm,{asChild:!0,container:a,children:s})})})};kx.displayName=_m;var Rn="MenuContent",[I8,xm]=rs(Rn),Nx=w.forwardRef((e,t)=>{const r=Mx(Rn,e.__scopeMenu),{forceMount:s=r.forceMount,...a}=e,l=os(Rn,e.__scopeMenu),u=Wa(Rn,e.__scopeMenu);return _.jsx(Za.Provider,{scope:e.__scopeMenu,children:_.jsx(ns,{present:s||l.open,children:_.jsx(Za.Slot,{scope:e.__scopeMenu,children:u.modal?_.jsx(B8,{...a,ref:t}):_.jsx(q8,{...a,ref:t})})})})}),B8=w.forwardRef((e,t)=>{const r=os(Rn,e.__scopeMenu),s=w.useRef(null),a=Mt(t,s);return w.useEffect(()=>{const l=s.current;if(l)return vx(l)},[]),_.jsx(Em,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),q8=w.forwardRef((e,t)=>{const r=os(Rn,e.__scopeMenu);return _.jsx(Em,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),V8=$U("MenuContent.ScrollLock"),Em=w.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:S,disableOutsideScroll:E,...x}=e,C=os(Rn,r),O=Wa(Rn,r),U=Hu(r),k=Ax(r),L=L8(r),[I,F]=w.useState(null),$=w.useRef(null),D=Mt(t,$,C.onContentChange),W=w.useRef(0),ne=w.useRef(""),oe=w.useRef(0),ie=w.useRef(null),de=w.useRef("right"),ue=w.useRef(0),ve=E?Sm:w.Fragment,j=E?{as:V8,allowPinchZoom:!0}:void 0,Y=te=>{const be=ne.current+te,N=L().filter(se=>!se.disabled),G=document.activeElement,ee=N.find(se=>se.ref.current===G)?.textValue,re=N.map(se=>se.textValue),he=t$(re,be,ee),ge=N.find(se=>se.textValue===he)?.ref.current;(function se(Pe){ne.current=Pe,window.clearTimeout(W.current),Pe!==""&&(W.current=window.setTimeout(()=>se(""),1e3))})(be),ge&&setTimeout(()=>ge.focus())};w.useEffect(()=>()=>window.clearTimeout(W.current),[]),$1();const V=w.useCallback(te=>de.current===ie.current?.side&&r$(te,ie.current?.area),[]);return _.jsx(I8,{scope:r,searchRef:ne,onItemEnter:w.useCallback(te=>{V(te)&&te.preventDefault()},[V]),onItemLeave:w.useCallback(te=>{V(te)||($.current?.focus(),F(null))},[V]),onTriggerLeave:w.useCallback(te=>{V(te)&&te.preventDefault()},[V]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:w.useCallback(te=>{ie.current=te},[]),children:_.jsx(ve,{...j,children:_.jsx(lm,{asChild:!0,trapped:a,onMountAutoFocus:Ce(l,te=>{te.preventDefault(),$.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:_.jsx(cm,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:S,children:_.jsx(PU,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:s,currentTabStopId:I,onCurrentTabStopIdChange:F,onEntryFocus:Ce(h,te=>{O.isUsingKeyboardRef.current||te.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(lx,{role:"menu","aria-orientation":"vertical","data-state":Gx(C.open),"data-radix-menu-content":"",dir:O.dir,...U,...x,ref:D,style:{outline:"none",...x.style},onKeyDown:Ce(x.onKeyDown,te=>{const N=te.target.closest("[data-radix-menu-content]")===te.currentTarget,G=te.ctrlKey||te.altKey||te.metaKey,ee=te.key.length===1;N&&(te.key==="Tab"&&te.preventDefault(),!G&&ee&&Y(te.key));const re=$.current;if(te.target!==re||!k8.includes(te.key))return;te.preventDefault();const ge=L().filter(se=>!se.disabled).map(se=>se.ref.current);Cx.includes(te.key)&&ge.reverse(),W8(ge)}),onBlur:Ce(e.onBlur,te=>{te.currentTarget.contains(te.target)||(window.clearTimeout(W.current),ne.current="")}),onPointerMove:Ce(e.onPointerMove,Qa(te=>{const be=te.target,N=ue.current!==te.clientX;if(te.currentTarget.contains(be)&&N){const G=te.clientX>ue.current?"right":"left";de.current=G,ue.current=te.clientX}}))})})})})})})});Nx.displayName=Rn;var H8="MenuGroup",Rm=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{role:"group",...s,ref:t})});Rm.displayName=H8;var F8="MenuLabel",zx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{...s,ref:t})});zx.displayName=F8;var Su="MenuItem",jS="menu.itemSelect",Fu=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...a}=e,l=w.useRef(null),u=Wa(Su,e.__scopeMenu),f=xm(Su,e.__scopeMenu),h=Mt(t,l),m=w.useRef(!1),y=()=>{const g=l.current;if(!r&&g){const b=new CustomEvent(jS,{bubbles:!0,cancelable:!0});g.addEventListener(jS,S=>s?.(S),{once:!0}),L1(g,b),b.defaultPrevented?m.current=!1:u.onClose()}};return _.jsx(Lx,{...a,ref:h,disabled:r,onClick:Ce(e.onClick,y),onPointerDown:g=>{e.onPointerDown?.(g),m.current=!0},onPointerUp:Ce(e.onPointerUp,g=>{m.current||g.currentTarget?.click()}),onKeyDown:Ce(e.onKeyDown,g=>{const b=f.searchRef.current!=="";r||b&&g.key===" "||_p.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Fu.displayName=Su;var Lx=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:a,...l}=e,u=xm(Su,r),f=Ax(r),h=w.useRef(null),m=Mt(t,h),[y,g]=w.useState(!1),[b,S]=w.useState("");return w.useEffect(()=>{const E=h.current;E&&S((E.textContent??"").trim())},[l.children]),_.jsx(Za.ItemSlot,{scope:r,disabled:s,textValue:a??b,children:_.jsx(UU,{asChild:!0,...f,focusable:!s,children:_.jsx(Tt.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:Ce(e.onPointerMove,Qa(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,Qa(E=>u.onItemLeave(E))),onFocus:Ce(e.onFocus,()=>g(!0)),onBlur:Ce(e.onBlur,()=>g(!1))})})})}),Z8="MenuCheckboxItem",Dx=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...a}=e;return _.jsx(Ix,{scope:e.__scopeMenu,checked:r,children:_.jsx(Fu,{role:"menuitemcheckbox","aria-checked":wu(r)?"mixed":r,...a,ref:t,"data-state":Tm(r),onSelect:Ce(a.onSelect,()=>s?.(wu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Dx.displayName=Z8;var jx="MenuRadioGroup",[Q8,G8]=rs(jx,{value:void 0,onValueChange:()=>{}}),Px=w.forwardRef((e,t)=>{const{value:r,onValueChange:s,...a}=e,l=Kn(s);return _.jsx(Q8,{scope:e.__scopeMenu,value:r,onValueChange:l,children:_.jsx(Rm,{...a,ref:t})})});Px.displayName=jx;var Ux="MenuRadioItem",$x=w.forwardRef((e,t)=>{const{value:r,...s}=e,a=G8(Ux,e.__scopeMenu),l=r===a.value;return _.jsx(Ix,{scope:e.__scopeMenu,checked:l,children:_.jsx(Fu,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Tm(l),onSelect:Ce(s.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});$x.displayName=Ux;var Cm="MenuItemIndicator",[Ix,Y8]=rs(Cm,{checked:!1}),Bx=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...a}=e,l=Y8(Cm,r);return _.jsx(ns,{present:s||wu(l.checked)||l.checked===!0,children:_.jsx(Tt.span,{...a,ref:t,"data-state":Tm(l.checked)})})});Bx.displayName=Cm;var K8="MenuSeparator",qx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return _.jsx(Tt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});qx.displayName=K8;var X8="MenuArrow",Vx=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,a=Hu(r);return _.jsx(ux,{...a,...s,ref:t})});Vx.displayName=X8;var J8="MenuSub",[YB,Hx]=rs(J8),Oa="MenuSubTrigger",Fx=w.forwardRef((e,t)=>{const r=os(Oa,e.__scopeMenu),s=Wa(Oa,e.__scopeMenu),a=Hx(Oa,e.__scopeMenu),l=xm(Oa,e.__scopeMenu),u=w.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=w.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return w.useEffect(()=>y,[y]),w.useEffect(()=>{const g=f.current;return()=>{window.clearTimeout(g),h(null)}},[f,h]),_.jsx(wm,{asChild:!0,...m,children:_.jsx(Lx,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":Gx(r.open),...e,ref:So(t,a.onTriggerChange),onClick:g=>{e.onClick?.(g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,Qa(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Ce(e.onPointerLeave,Qa(g=>{y();const b=r.content?.getBoundingClientRect();if(b){const S=r.content?.dataset.side,E=S==="right",x=E?-5:5,C=b[E?"left":"right"],O=b[E?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:C,y:b.top},{x:O,y:b.top},{x:O,y:b.bottom},{x:C,y:b.bottom}],side:S}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(g),g.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,g=>{const b=l.searchRef.current!=="";e.disabled||b&&g.key===" "||N8[s.dir].includes(g.key)&&(r.onOpenChange(!0),r.content?.focus(),g.preventDefault())})})})});Fx.displayName=Oa;var Zx="MenuSubContent",Qx=w.forwardRef((e,t)=>{const r=Mx(Rn,e.__scopeMenu),{forceMount:s=r.forceMount,...a}=e,l=os(Rn,e.__scopeMenu),u=Wa(Rn,e.__scopeMenu),f=Hx(Zx,e.__scopeMenu),h=w.useRef(null),m=Mt(t,h);return _.jsx(Za.Provider,{scope:e.__scopeMenu,children:_.jsx(ns,{present:s||l.open,children:_.jsx(Za.Slot,{scope:e.__scopeMenu,children:_.jsx(Em,{id:f.contentId,"aria-labelledby":f.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,y=>{y.target!==f.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ce(e.onKeyDown,y=>{const g=y.currentTarget.contains(y.target),b=z8[u.dir].includes(y.key);g&&b&&(l.onOpenChange(!1),f.trigger?.focus(),y.preventDefault())})})})})})});Qx.displayName=Zx;function Gx(e){return e?"open":"closed"}function wu(e){return e==="indeterminate"}function Tm(e){return wu(e)?"indeterminate":e?"checked":"unchecked"}function W8(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function e$(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function t$(e,t,r){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=e$(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==r?h:void 0}function n$(e,t){const{x:r,y:s}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const f=t[l],h=t[u],m=f.x,y=f.y,g=h.x,b=h.y;y>s!=b>s&&r<(g-m)*(s-y)/(b-y)+m&&(a=!a)}return a}function r$(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return n$(r,t)}function Qa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var o$=Ox,s$=wm,i$=kx,a$=Nx,c$=Rm,l$=zx,u$=Fu,f$=Dx,d$=Px,h$=$x,p$=Bx,m$=qx,g$=Vx,y$=Fx,v$=Qx,Zu="DropdownMenu",[b$]=wi(Zu,[Tx]),jt=Tx(),[S$,Yx]=b$(Zu),Kx=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:a,defaultOpen:l,onOpenChange:u,modal:f=!0}=e,h=jt(t),m=w.useRef(null),[y,g]=am({prop:a,defaultProp:l??!1,onChange:u,caller:Zu});return _.jsx(S$,{scope:t,triggerId:mu(),triggerRef:m,contentId:mu(),open:y,onOpenChange:g,onOpenToggle:w.useCallback(()=>g(b=>!b),[g]),modal:f,children:_.jsx(o$,{...h,open:y,onOpenChange:g,dir:s,modal:f,children:r})})};Kx.displayName=Zu;var Xx="DropdownMenuTrigger",Jx=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...a}=e,l=Yx(Xx,r),u=jt(r);return _.jsx(s$,{asChild:!0,...u,children:_.jsx(Tt.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...a,ref:So(t,l.triggerRef),onPointerDown:Ce(e.onPointerDown,f=>{!s&&f.button===0&&f.ctrlKey===!1&&(l.onOpenToggle(),l.open||f.preventDefault())}),onKeyDown:Ce(e.onKeyDown,f=>{s||(["Enter"," "].includes(f.key)&&l.onOpenToggle(),f.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Jx.displayName=Xx;var w$="DropdownMenuPortal",Wx=e=>{const{__scopeDropdownMenu:t,...r}=e,s=jt(t);return _.jsx(i$,{...s,...r})};Wx.displayName=w$;var eE="DropdownMenuContent",tE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=Yx(eE,r),l=jt(r),u=w.useRef(!1);return _.jsx(a$,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...s,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,f=>{u.current||a.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,f=>{const h=f.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tE.displayName=eE;var _$="DropdownMenuGroup",x$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(c$,{...a,...s,ref:t})});x$.displayName=_$;var E$="DropdownMenuLabel",nE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(l$,{...a,...s,ref:t})});nE.displayName=E$;var R$="DropdownMenuItem",rE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(u$,{...a,...s,ref:t})});rE.displayName=R$;var C$="DropdownMenuCheckboxItem",T$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(f$,{...a,...s,ref:t})});T$.displayName=C$;var A$="DropdownMenuRadioGroup",O$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(d$,{...a,...s,ref:t})});O$.displayName=A$;var M$="DropdownMenuRadioItem",k$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(h$,{...a,...s,ref:t})});k$.displayName=M$;var N$="DropdownMenuItemIndicator",z$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(p$,{...a,...s,ref:t})});z$.displayName=N$;var L$="DropdownMenuSeparator",oE=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(m$,{...a,...s,ref:t})});oE.displayName=L$;var D$="DropdownMenuArrow",j$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(g$,{...a,...s,ref:t})});j$.displayName=D$;var P$="DropdownMenuSubTrigger",U$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(y$,{...a,...s,ref:t})});U$.displayName=P$;var $$="DropdownMenuSubContent",I$=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,a=jt(r);return _.jsx(v$,{...a,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});I$.displayName=$$;var B$=Kx,q$=Jx,V$=Wx,H$=tE,F$=nE,Z$=rE,Q$=oE;function G$({...e}){return _.jsx(B$,{"data-slot":"dropdown-menu",...e})}function Y$({...e}){return _.jsx(q$,{"data-slot":"dropdown-menu-trigger",...e})}function K$({className:e,sideOffset:t=4,...r}){return _.jsx(V$,{children:_.jsx(H$,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Dt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function PS({className:e,inset:t,variant:r="default",...s}){return _.jsx(Z$,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Dt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s})}function X$({className:e,inset:t,...r}){return _.jsx(F$,{"data-slot":"dropdown-menu-label","data-inset":t,className:Dt("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function US({className:e,...t}){return _.jsx(Q$,{"data-slot":"dropdown-menu-separator",className:Dt("bg-border -mx-1 my-1 h-px",e),...t})}function J$(e,t=[]){let r=[];function s(l,u){const f=w.createContext(u);f.displayName=l+"Context";const h=r.length;r=[...r,u];const m=g=>{const{scope:b,children:S,...E}=g,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return _.jsx(x.Provider,{value:C,children:S})};m.displayName=l+"Provider";function y(g,b){const S=b?.[e]?.[h]||f,E=w.useContext(S);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||l;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return a.scopeName=e,[s,W$(a,...t)]}function W$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=s.reduce((f,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...f,...g}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var eI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Am=eI.reduce((e,t)=>{const r=N1(`Primitive.${t}`),s=w.forwardRef((a,l)=>{const{asChild:u,...f}=a,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(h,{...f,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),tI=Jw();function nI(){return tI.useSyncExternalStore(rI,()=>!0,()=>!1)}function rI(){return()=>{}}var Om="Avatar",[oI]=J$(Om),[sI,sE]=oI(Om),iE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[a,l]=w.useState("idle");return _.jsx(sI,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:l,children:_.jsx(Am.span,{...s,ref:t})})});iE.displayName=Om;var aE="AvatarImage",cE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:a=()=>{},...l}=e,u=sE(aE,r),f=iI(s,l),h=Kn(m=>{a(m),u.onImageLoadingStatusChange(m)});return Ln(()=>{f!=="idle"&&h(f)},[f,h]),f==="loaded"?_.jsx(Am.img,{...l,ref:t,src:s}):null});cE.displayName=aE;var lE="AvatarFallback",uE=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...a}=e,l=sE(lE,r),[u,f]=w.useState(s===void 0);return w.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>f(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&l.imageLoadingStatus!=="loaded"?_.jsx(Am.span,{...a,ref:t}):null});uE.displayName=lE;function $S(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function iI(e,{referrerPolicy:t,crossOrigin:r}){const s=nI(),a=w.useRef(null),l=s?(a.current||(a.current=new window.Image),a.current):null,[u,f]=w.useState(()=>$S(l,e));return Ln(()=>{f($S(l,e))},[l,e]),Ln(()=>{const h=g=>()=>{f(g)};if(!l)return;const m=h("loaded"),y=h("error");return l.addEventListener("load",m),l.addEventListener("error",y),t&&(l.referrerPolicy=t),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",m),l.removeEventListener("error",y)}},[l,r,t]),u}var aI=iE,cI=cE,lI=uE;function uI({className:e,...t}){return _.jsx(aI,{"data-slot":"avatar",className:Dt("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function fI({className:e,...t}){return _.jsx(cI,{"data-slot":"avatar-image",className:Dt("aspect-square size-full",e),...t})}function dI({className:e,...t}){return _.jsx(lI,{"data-slot":"avatar-fallback",className:Dt("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const IS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,BS=N_,hI=(e,t)=>r=>{var s;if(t?.variants==null)return BS(e,r?.class,r?.className);const{variants:a,defaultVariants:l}=t,u=Object.keys(a).map(m=>{const y=r?.[m],g=l?.[m];if(y===null)return null;const b=IS(y)||IS(g);return a[m][b]}),f=r&&Object.entries(r).reduce((m,y)=>{let[g,b]=y;return b===void 0||(m[g]=b),m},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,y)=>{let{class:g,className:b,...S}=y;return Object.entries(S).every(E=>{let[x,C]=E;return Array.isArray(C)?C.includes({...l,...f}[x]):{...l,...f}[x]===C})?[...m,g,b]:m},[]);return BS(e,u,h,r?.class,r?.className)},pI=hI("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Jh({className:e,variant:t="default",size:r="default",asChild:s=!1,...a}){const l=s?z1:"button";return _.jsx(l,{"data-slot":"button","data-variant":t,"data-size":r,className:Dt(pI({variant:t,size:r,className:e})),...a})}function mI(e){const t=gI(e),r=w.forwardRef((s,a)=>{const{children:l,...u}=s,f=w.Children.toArray(l),h=f.find(vI);if(h){const m=h.props.children,y=f.map(g=>g===h?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:g);return _.jsx(t,{...u,ref:a,children:w.isValidElement(m)?w.cloneElement(m,void 0,y):null})}return _.jsx(t,{...u,ref:a,children:l})});return r.displayName=`${e}.Slot`,r}function gI(e){const t=w.forwardRef((r,s)=>{const{children:a,...l}=r;if(w.isValidElement(a)){const u=SI(a),f=bI(l,a.props);return a.type!==w.Fragment&&(f.ref=s?So(s,u):u),w.cloneElement(a,f)}return w.Children.count(a)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yI=Symbol("radix.slottable");function vI(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yI}function bI(e,t){const r={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?r[s]=(...f)=>{const h=l(...f);return a(...f),h}:a&&(r[s]=a):s==="style"?r[s]={...a,...l}:s==="className"&&(r[s]=[a,l].filter(Boolean).join(" "))}return{...e,...r}}function SI(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Qu="Popover",[fE]=wi(Qu,[qu]),ec=qu(),[wI,wo]=fE(Qu),dE=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:a,onOpenChange:l,modal:u=!1}=e,f=ec(t),h=w.useRef(null),[m,y]=w.useState(!1),[g,b]=am({prop:s,defaultProp:a??!1,onChange:l,caller:Qu});return _.jsx(cx,{...f,children:_.jsx(wI,{scope:t,contentId:mu(),triggerRef:h,open:g,onOpenChange:b,onOpenToggle:w.useCallback(()=>b(S=>!S),[b]),hasCustomAnchor:m,onCustomAnchorAdd:w.useCallback(()=>y(!0),[]),onCustomAnchorRemove:w.useCallback(()=>y(!1),[]),modal:u,children:r})})};dE.displayName=Qu;var hE="PopoverAnchor",_I=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(hE,r),l=ec(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=a;return w.useEffect(()=>(u(),()=>f()),[u,f]),_.jsx(vm,{...l,...s,ref:t})});_I.displayName=hE;var pE="PopoverTrigger",mE=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(pE,r),l=ec(r),u=Mt(t,a.triggerRef),f=_.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":SE(a.open),...s,ref:u,onClick:Ce(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?f:_.jsx(vm,{asChild:!0,...l,children:f})});mE.displayName=pE;var Mm="PopoverPortal",[xI,EI]=fE(Mm,{forceMount:void 0}),gE=e=>{const{__scopePopover:t,forceMount:r,children:s,container:a}=e,l=wo(Mm,t);return _.jsx(xI,{scope:t,forceMount:r,children:_.jsx(ns,{present:r||l.open,children:_.jsx(bm,{asChild:!0,container:a,children:s})})})};gE.displayName=Mm;var gi="PopoverContent",yE=w.forwardRef((e,t)=>{const r=EI(gi,e.__scopePopover),{forceMount:s=r.forceMount,...a}=e,l=wo(gi,e.__scopePopover);return _.jsx(ns,{present:s||l.open,children:l.modal?_.jsx(CI,{...a,ref:t}):_.jsx(TI,{...a,ref:t})})});yE.displayName=gi;var RI=mI("PopoverContent.RemoveScroll"),CI=w.forwardRef((e,t)=>{const r=wo(gi,e.__scopePopover),s=w.useRef(null),a=Mt(t,s),l=w.useRef(!1);return w.useEffect(()=>{const u=s.current;if(u)return vx(u)},[]),_.jsx(Sm,{as:RI,allowPinchZoom:!0,children:_.jsx(vE,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,u=>{const f=u.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,m=f.button===2||h;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:Ce(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),TI=w.forwardRef((e,t)=>{const r=wo(gi,e.__scopePopover),s=w.useRef(!1),a=w.useRef(!1);return _.jsx(vE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(s.current||r.triggerRef.current?.focus(),l.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),vE=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:y,...g}=e,b=wo(gi,r),S=ec(r);return $1(),_.jsx(lm,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:_.jsx(cm,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:y,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>b.onOpenChange(!1),children:_.jsx(lx,{"data-state":SE(b.open),role:"dialog",id:b.contentId,...S,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),bE="PopoverClose",AI=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=wo(bE,r);return _.jsx(Tt.button,{type:"button",...s,ref:t,onClick:Ce(e.onClick,()=>a.onOpenChange(!1))})});AI.displayName=bE;var OI="PopoverArrow",MI=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=ec(r);return _.jsx(ux,{...a,...s,ref:t})});MI.displayName=OI;function SE(e){return e?"open":"closed"}var kI=dE,NI=mE,zI=gE,LI=yE;function qS({...e}){return _.jsx(kI,{"data-slot":"popover",...e})}function VS({...e}){return _.jsx(NI,{"data-slot":"popover-trigger",...e})}function HS({className:e,align:t="center",sideOffset:r=4,...s}){return _.jsx(zI,{children:_.jsx(LI,{"data-slot":"popover-content",align:t,sideOffset:r,className:Dt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...s})})}const DI=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],jI=[{label:"Documentation",url:"https://docs.convex.dev",icon:QN},{label:"API Reference",url:"https://docs.convex.dev/api",icon:lz},{label:"Community Discord",url:"https://discord.gg/convex",icon:Yz}],PI={"/":"Dashboard","/content":"Content","/media":"Media Library","/content-types":"Content Types","/settings":"Settings","/taxonomies":"Taxonomies","/trash":"Trash","/entries":"Entries","/entries/type":"Content Types","/entries/new":"New Entry"};function UI(e,t,r){const s=[{label:t,to:"/"}];if(e==="/")return s;const a=e.split("/").filter(Boolean);let l="";return a.forEach((u,f)=>{l+=`/${u}`;const h=f===a.length-1;let m=r.get(l)??PI[l];m||(m=u.charAt(0).toUpperCase()+u.slice(1).replace(/-/g," ")),h?s.push({label:m}):s.push({label:m,to:l})}),s}function $I(){const e=Je(),t=Nu(),{branding:r}=im();let s=new Map;try{s=a6().overrides}catch{}const a=UI(e.location.pathname,r.appName,s);let l=null,u=null,f=async()=>{},h=!1;try{const x=Q_();l=x.user,u=x.role,f=x.logout,h=x.isAuthenticated}catch{}const y=(u?dL(u):null)?.displayName??u??"No Role",g=l?.name??l?.email??"User",b=x=>{const C=x.split(" ");return C.length>=2?`${C[0][0]}${C[1][0]}`.toUpperCase():x.slice(0,2).toUpperCase()},S=l?.name?b(l.name):"U",E=async()=>{await f()};return _.jsxs("header",{className:"sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background/95 px-6 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[_.jsx(v6,{children:_.jsx(b6,{children:a.map((x,C)=>_.jsxs(w.Fragment,{children:[C>0&&_.jsx(x6,{}),_.jsx(S6,{children:x.to?_.jsx(w6,{asChild:!0,children:_.jsxs(Pa,{to:x.to,className:"flex items-center gap-1.5",children:[C===0&&_.jsx(A_,{className:"size-3.5"}),_.jsx("span",{children:x.label})]})}):_.jsx(_6,{children:x.label})})]},C))})}),_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsxs(qS,{children:[_.jsx(VS,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",size:"icon",className:"size-9",children:[_.jsx(fp,{className:"size-4"}),_.jsx("span",{className:"sr-only",children:"Notifications"})]})}),_.jsxs(HS,{align:"end",className:"w-80",children:[_.jsx("div",{className:"flex items-center justify-between pb-2",children:_.jsx("h4",{className:"font-medium",children:"Notifications"})}),_.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[_.jsx(fp,{className:"size-8 text-muted-foreground/50"}),_.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),_.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),_.jsxs(qS,{children:[_.jsx(VS,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",size:"icon",className:"size-9",children:[_.jsx(T_,{className:"size-4"}),_.jsx("span",{className:"sr-only",children:"Help"})]})}),_.jsxs(HS,{align:"end",className:"w-72",children:[_.jsx("div",{className:"pb-2",children:_.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),_.jsxs("div",{className:"space-y-4",children:[_.jsxs("div",{children:[_.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),_.jsx("div",{className:"space-y-1",children:DI.map((x,C)=>_.jsxs("div",{className:"flex items-center justify-between text-sm",children:[_.jsx("span",{className:"text-muted-foreground",children:x.description}),_.jsx("div",{className:"flex gap-0.5",children:x.keys.map((O,U)=>_.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:O},U))})]},C))})]}),_.jsxs("div",{children:[_.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),_.jsx("div",{className:"space-y-1",children:jI.map(x=>_.jsxs("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent",children:[_.jsx(x.icon,{className:"size-4 text-muted-foreground"}),_.jsx("span",{className:"flex-1",children:x.label}),_.jsx(hz,{className:"size-3 text-muted-foreground"})]},x.label))})]})]})]})]}),_.jsxs(G$,{children:[_.jsx(Y$,{asChild:!0,children:_.jsxs(Jh,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[_.jsxs(uI,{className:"size-6",children:[_.jsx(fI,{src:l?.avatarUrl,alt:g}),_.jsx(dI,{className:"text-xs",children:S})]}),_.jsx("span",{className:"text-sm font-medium",children:g}),_.jsx(C_,{className:"size-3.5 text-muted-foreground"})]})}),_.jsxs(K$,{align:"end",className:"w-56",children:[_.jsx(X$,{className:"font-normal",children:_.jsxs("div",{className:"flex flex-col space-y-1",children:[_.jsx("p",{className:"text-sm font-medium",children:g}),l?.email&&_.jsx("p",{className:"text-xs text-muted-foreground",children:l.email}),_.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})}),_.jsx(US,{}),_.jsxs(PS,{onClick:()=>t({to:"/settings"}),children:[_.jsx(M_,{className:"mr-2 size-4"}),_.jsx("span",{children:"Profile & Settings"})]}),h&&_.jsxs(_.Fragment,{children:[_.jsx(US,{}),_.jsxs(PS,{onClick:E,className:"text-destructive focus:text-destructive",children:[_.jsx(Vz,{className:"mr-2 size-4"}),_.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function II({children:e}){const{layout:t}=im();return _.jsxs("div",{className:"flex min-h-screen bg-background",children:[_.jsx(u6,{}),_.jsxs("div",{className:"flex flex-1 flex-col",style:{marginLeft:t.sidebarWidth},children:[_.jsx($I,{}),_.jsx("main",{className:"flex-1 overflow-auto p-6",children:e})]})]})}function BI(){return _.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:_.jsx($z,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function qI(){return _.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),_.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),_.jsx("h2",{children:"Authentication Required"}),_.jsx("p",{children:"Please log in to access the admin panel."})]})}function Wh({requiredRole:e,requiredPermission:t}){return _.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"10"}),_.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),_.jsx("h2",{children:"Access Denied"}),_.jsx("p",{children:"You don't have permission to access this page."}),e&&_.jsxs("p",{className:"route-guard-detail",children:["Required role: ",_.jsx("strong",{children:e})]}),t&&_.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",_.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function VI({error:e}){return _.jsxs("div",{className:"route-guard route-guard--error",children:[_.jsx("div",{className:"route-guard-icon",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"10"}),_.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),_.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),_.jsx("h2",{children:"Authentication Error"}),_.jsx("p",{children:e})]})}function HI({children:e,requiredPermission:t,requiredRole:r,loadingComponent:s,unauthenticatedComponent:a,unauthorizedComponent:l,onUnauthenticated:u,onUnauthorized:f}){const{authState:h,role:m,checkPermission:y,error:g}=Q_();return h==="loading"?_.jsx(_.Fragment,{children:s??_.jsx(BI,{})}):h==="error"?_.jsx(VI,{error:g??"An error occurred"}):h==="unauthenticated"?(u?.(),_.jsx(_.Fragment,{children:a??_.jsx(qI,{})})):m?r&&m!==r?(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})})):t&&!y(t)?(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})})):_.jsx(_.Fragment,{children:e}):(f?.(),_.jsx(_.Fragment,{children:l??_.jsx(Wh,{requiredRole:r,requiredPermission:t})}))}const wE=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")};function FS(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function xp(e,t){const r=Object.create(null);if(e)for(const s of Object.keys(e))FS(s)&&(r[s]=e[s]);if(t&&typeof t=="object")for(const s of Object.keys(t))FS(s)&&(r[s]=t[s]);return r}function _E(e){return Object.create(null)}const Zl=(e,t)=>{const r=t||e||{};return typeof r.method>"u"&&(r.method="GET"),Object.assign(l=>{const u={...r,...l};return Zl(void 0,u)},{options:r,middleware:l=>{const u=[...r.middleware||[]];l.map(m=>{u0 in m?m.options.middleware&&u.push(...m.options.middleware):u.push(m)});const f={...r,middleware:u},h=Zl(void 0,f);return h[u0]=!0,h},inputValidator:l=>{const u={...r,inputValidator:l};return Zl(void 0,u)},handler:(...l)=>{const[u,f]=l,h={...r,extractedFn:u,serverFn:f},m=[...h.middleware||[],QI(h)];return Object.assign(async y=>{const g=await ZS(m,"client",{...u,...h,data:y?.data,headers:y?.headers,signal:y?.signal,fetch:y?.fetch,context:_E()}),b=lw(g.error);if(b)throw b;if(g.error)throw g.error;return g.result},{...u,__executeServer:async(y,g)=>{const b=wE(),S=b.contextAfterGlobalMiddlewares,E={...u,...y,serverFnMeta:u.serverFnMeta,context:xp(S,y.context),signal:g,request:b.request};return await ZS(m,"server",E).then(C=>({result:C.result,error:C.error,context:C.sendContext}))}})}})};async function ZS(e,t,r){const s=Pp()?.functionMiddleware||[];let a=FI([...s,...e]);if(t==="server"){const u=wE();u?.executedRequestMiddlewares&&(a=a.filter(f=>!u.executedRequestMiddlewares.has(f)))}const l=async u=>{const f=a.shift();if(!f)return u;try{"inputValidator"in f.options&&f.options.inputValidator&&t==="server"&&(u.data=await ZI(f.options.inputValidator,u.data));let h;if(t==="client"?"client"in f.options&&(h=f.options.client):"server"in f.options&&(h=f.options.server),h){const y=await h({...u,next:async(g={})=>{const b={...u,...g,context:xp(u.context,g.context),sendContext:xp(u.sendContext,g.sendContext),headers:IM(u.headers,g.headers),_callSiteFetch:u._callSiteFetch,fetch:u._callSiteFetch??g.fetch??u.fetch,result:g.result!==void 0?g.result:g instanceof Response?g:u.result,error:g.error??u.error},S=await l(b);if(S.error)throw S.error;return S}});if(ln(y))return{...u,error:y};if(y instanceof Response)return{...u,result:y};if(!y)throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");return y}return l(u)}catch(h){return{...u,error:h}}};return l({...r,headers:r.headers||{},sendContext:r.sendContext||{},context:r.context||_E(),_callSiteFetch:r.fetch})}function FI(e,t=100){const r=new Set,s=[],a=(l,u)=>{if(u>t)throw new Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);l.forEach(f=>{f.options.middleware&&a(f.options.middleware,u+1),r.has(f)||(r.add(f),s.push(f))})};return a(e,0),s}async function ZI(e,t){if(e==null)return{};if("~standard"in e){const r=await e["~standard"].validate(t);if(r.issues)throw new Error(JSON.stringify(r.issues,void 0,2));return r.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function QI(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:r,fetch:s,...a})=>{const l={...a,context:r,fetch:s},u=await e.extractedFn?.(l);return t(u)},server:async({next:t,...r})=>{const s=await e.serverFn?.(r);return t({...r,result:s})}}}}const GI=Zl({method:"GET"}).handler(l_("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819")),QS=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),GS=()=>"admin",YS=()=>{console.log("Logout called (mock mode)")},YI=()=>null,KI=()=>null,XI=()=>{};function JI(e){switch(e){case"mock":case"demo":return{getUser:QS,getUserRole:GS,onLogout:YS};case"none":case"disabled":return{getUser:YI,getUserRole:KI,onLogout:XI};default:return{getUser:QS,getUserRole:GS,onLogout:YS}}}const An=wM({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"Convex CMS Admin"},{name:"description",content:"Admin interface for Convex CMS - manage content, media, and publishing workflows"}],links:[{rel:"stylesheet",href:PN},{rel:"icon",href:"/favicon.ico"}]}),loader:async()=>({config:await GI()}),component:WI});function WI(){const{config:e}=An.useLoaderData(),t=w.useMemo(()=>JI(e.authMode),[e.authMode]),r=w.useMemo(()=>e6(e.adminConfig),[e.adminConfig]);return _.jsx(tB,{children:_.jsx(mL,{children:_.jsx(i6,{children:_.jsx(eB,{config:e,adminConfig:r,children:_.jsx(pL,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:_.jsx(HI,{children:_.jsx(II,{children:_.jsx(n_,{})})})})})})})})}function eB({children:e,config:t,adminConfig:r}){const s=w.useMemo(()=>t.convexUrl?new TN(t.convexUrl):null,[t.convexUrl]);return s?_.jsx(ON,{client:s,children:_.jsx(s6,{baseConfig:r,children:e})}):_.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:_.jsxs("div",{className:"max-w-lg space-y-4 rounded-lg border border-amber-200 bg-amber-50 p-6 text-center",children:[_.jsx("h2",{className:"text-xl font-semibold text-amber-900",children:"Convex Configuration Required"}),_.jsx("p",{className:"text-sm text-amber-800",children:"Please provide a Convex deployment URL to connect to your backend."}),_.jsxs("div",{className:"space-y-2 text-left text-sm text-amber-700",children:[_.jsx("p",{className:"font-medium",children:"Options:"}),_.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[_.jsxs("li",{children:["Run with URL:"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),_.jsxs("li",{children:["Set environment variable:"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]}),_.jsxs("li",{children:["Add to"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:".env.local"}),":"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]}),_.jsxs("p",{className:"text-sm text-amber-700",children:["Run"," ",_.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex dev"})," to start Convex and get your URL."]})]})})}function tB({children:e}){return _.jsxs("html",{lang:"en",children:[_.jsx("head",{children:_.jsx(PM,{})}),_.jsxs("body",{children:[e,_.jsx(UM,{})]})]})}const nB="modulepreload",rB=function(e){return"/"+e},KS={},er=function(t,r,s){let a=Promise.resolve();if(r&&r.length>0){let h=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");a=h(r.map(m=>{if(m=rB(m),m in KS)return;KS[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":nB,y||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((S,E)=>{b.addEventListener("load",S),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},oB=()=>er(()=>import("./trash-BOCnIznD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),sB=Cn("/trash")({component:Jn(oB,"component")}),iB=()=>er(()=>import("./taxonomies-kyk5P4ZW.js"),__vite__mapDeps([12,3,4,13,14,15,1,6,16,11])),aB=Cn("/taxonomies")({component:Jn(iB,"component")}),cB=()=>er(()=>import("./settings-t2PbCZh4.js"),__vite__mapDeps([17,4,13,7,18,1,6,19,8,9,11])),lB=Cn("/settings")({component:Jn(cB,"component")}),uB=()=>er(()=>import("./media-Dc5PWt2Q.js"),__vite__mapDeps([20,21,4,1,2,3,5,22,23,13,7,14,15,24,10])),fB=Cn("/media")({component:Jn(uB,"component")}),dB=()=>er(()=>import("./content-types-CrNEm8Hf.js"),__vite__mapDeps([25,3,4,13,14,7,9,15,26,24,1,2,5,11])),hB=Cn("/content-types")({component:Jn(dB,"component")}),pB=()=>er(()=>import("./content-QBUxdxbS.js"),__vite__mapDeps([27,18,3,4,28,9,1,2,5,29,7,15,11])),mB=Cn("/content")({component:Jn(pB,"component")}),gB=()=>er(()=>import("./index-C7xOwudI.js"),__vite__mapDeps([30,1,11])),yB=Cn("/")({component:Jn(gB,"component")}),vB=()=>er(()=>import("./_entryId-CuVMExbb.js"),__vite__mapDeps([31,32,13,3,4,19,21,14,26,7,5,23,29,15,24,16,9,28,18,33])),bB=Cn("/entries/$entryId")({component:Jn(vB,"component")}),SB=()=>er(()=>import("./_contentTypeId-DK8cskRt.js"),__vite__mapDeps([34,18,33,1,2,3,4,5,29,22,23,7,15])),wB=Cn("/entries/type/$contentTypeId")({component:Jn(SB,"component")}),_B=()=>er(()=>import("./new._contentTypeId-C_I4YxIa.js"),__vite__mapDeps([35,32,13,3,4,19,21,14,26,7,5,23,29,15,24,16,9,28,33])),xB=Cn("/entries/new/$contentTypeId")({component:Jn(_B,"component")}),EB=sB.update({id:"/trash",path:"/trash",getParentRoute:()=>An}),RB=aB.update({id:"/taxonomies",path:"/taxonomies",getParentRoute:()=>An}),CB=lB.update({id:"/settings",path:"/settings",getParentRoute:()=>An}),TB=fB.update({id:"/media",path:"/media",getParentRoute:()=>An}),AB=hB.update({id:"/content-types",path:"/content-types",getParentRoute:()=>An}),OB=mB.update({id:"/content",path:"/content",getParentRoute:()=>An}),MB=yB.update({id:"/",path:"/",getParentRoute:()=>An}),kB=bB.update({id:"/entries/$entryId",path:"/entries/$entryId",getParentRoute:()=>An}),NB=wB.update({id:"/entries/type/$contentTypeId",path:"/entries/type/$contentTypeId",getParentRoute:()=>An}),zB=xB.update({id:"/entries/new/$contentTypeId",path:"/entries/new/$contentTypeId",getParentRoute:()=>An}),LB={IndexRoute:MB,ContentRoute:OB,ContentTypesRoute:AB,MediaRoute:TB,SettingsRoute:CB,TaxonomiesRoute:RB,TrashRoute:EB,EntriesEntryIdRoute:kB,EntriesNewContentTypeIdRoute:zB,EntriesTypeContentTypeIdRoute:NB},DB=An._addFileChildren(LB);function jB(){return MM({routeTree:DB,scrollRestoration:!0,defaultPreload:"intent"})}async function PB(){const e=await jB();let t;return t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(ok),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.state.matches.length||await qM(e),e}async function UB(){const e=await PB();return window.$_TSR?.h(),e}let ep;function $B(){return ep||(ep=UB()),_.jsx(JO,{promise:ep,children:e=>_.jsx(zM,{router:e})})}w.startTransition(()=>{X2.hydrateRoot(document,_.jsx(w.StrictMode,{children:_.jsx($B,{})}))});export{az as $,wB as A,Jh as B,C_ as C,G$ as D,mz as E,bz as F,Pa as G,A_ as H,Nz as I,VS as J,HS as K,$z as L,Q_ as M,hL as N,FB as O,qS as P,uL as Q,HI as R,t3 as S,h3 as T,xB as U,Ot as V,pI as W,N1 as X,Pz as Y,lz as Z,oz as _,HB as a,Mt as a0,j1 as a1,Tt as a2,ns as a3,wi as a4,Ce as a5,Kn as a6,Ln as a7,am as a8,gU as a9,mu as aa,PU as ab,UU as ac,dx as ad,a6 as ae,So as af,bm as ag,vx as ah,Sm as ai,$1 as aj,lm as ak,cm as al,GB as am,cx as an,vm as ao,zu as ap,qu as aq,D1 as ar,lx as as,ux as at,z1 as au,o6 as b,Dt as c,we as d,l3 as e,nz as f,QB as g,ZB as h,hI as i,_ as j,Y$ as k,K$ as l,PS as m,US as n,xz as o,Nu as p,XN as q,w as r,WN as s,f3 as t,MN as u,Tz as v,O_ as w,Je as x,Dp as y,bB as z};