@theobourgeois/ytdb 0.1.0 → 0.1.2

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 (345) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +7 -7
  3. package/.next/build-manifest.json +11 -15
  4. package/.next/next-minimal-server.js.nft.json +1 -1
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/prerender-manifest.json +6 -6
  7. package/.next/required-server-files.json +8 -5
  8. package/.next/server/app/[connectionId]/[schema]/[table]/page.js +1 -14
  9. package/.next/server/app/[connectionId]/[schema]/[table]/page.js.nft.json +1 -1
  10. package/.next/server/app/[connectionId]/[schema]/[table]/page_client-reference-manifest.js +1 -3
  11. package/.next/server/app/[connectionId]/page.js +1 -14
  12. package/.next/server/app/[connectionId]/page.js.nft.json +1 -1
  13. package/.next/server/app/[connectionId]/page_client-reference-manifest.js +1 -3
  14. package/.next/server/app/_global-error/page.js +31 -9
  15. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  16. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -3
  17. package/.next/server/app/_global-error.html +1 -1
  18. package/.next/server/app/_global-error.meta +8 -3
  19. package/.next/server/app/_global-error.rsc +8 -9
  20. package/.next/server/app/_global-error.segments/_full.segment.rsc +8 -9
  21. package/.next/server/app/_global-error.segments/{__PAGE__.segment.rsc → _global-error/__PAGE__.segment.rsc} +11 -11
  22. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/_not-found/page.js +1 -12
  24. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  25. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -3
  26. package/.next/server/app/_not-found.html +1 -1
  27. package/.next/server/app/_not-found.rsc +15 -13
  28. package/.next/server/app/_not-found.segments/_full.segment.rsc +15 -13
  29. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
  30. package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
  31. package/.next/server/app/api/cell/route.js +60 -7
  32. package/.next/server/app/api/cell/route.js.nft.json +1 -1
  33. package/.next/server/app/api/cell/route_client-reference-manifest.js +1 -3
  34. package/.next/server/app/api/definition/route.js +88 -7
  35. package/.next/server/app/api/definition/route.js.nft.json +1 -1
  36. package/.next/server/app/api/definition/route_client-reference-manifest.js +1 -3
  37. package/.next/server/app/api/delete-rows/route.js +19 -7
  38. package/.next/server/app/api/delete-rows/route.js.nft.json +1 -1
  39. package/.next/server/app/api/delete-rows/route_client-reference-manifest.js +1 -3
  40. package/.next/server/app/api/health/route.js +1 -6
  41. package/.next/server/app/api/health/route.js.nft.json +1 -1
  42. package/.next/server/app/api/health/route_client-reference-manifest.js +1 -3
  43. package/.next/server/app/api/lookup/route.js +1 -6
  44. package/.next/server/app/api/lookup/route.js.nft.json +1 -1
  45. package/.next/server/app/api/lookup/route_client-reference-manifest.js +1 -3
  46. package/.next/server/app/api/related/route.js +1 -6
  47. package/.next/server/app/api/related/route.js.nft.json +1 -1
  48. package/.next/server/app/api/related/route_client-reference-manifest.js +1 -3
  49. package/.next/server/app/api/rows/route.js +35 -6
  50. package/.next/server/app/api/rows/route.js.nft.json +1 -1
  51. package/.next/server/app/api/rows/route_client-reference-manifest.js +1 -3
  52. package/.next/server/app/api/tables/route.js +70 -7
  53. package/.next/server/app/api/tables/route.js.nft.json +1 -1
  54. package/.next/server/app/api/tables/route_client-reference-manifest.js +1 -3
  55. package/.next/server/app/favicon.ico/route.js +1 -7
  56. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  57. package/.next/server/app/index.html +1 -1
  58. package/.next/server/app/index.rsc +17 -17
  59. package/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  60. package/.next/server/app/index.segments/_full.segment.rsc +17 -17
  61. package/.next/server/app/index.segments/_tree.segment.rsc +4 -4
  62. package/.next/server/app/page.js +2 -13
  63. package/.next/server/app/page.js.nft.json +1 -1
  64. package/.next/server/app/page_client-reference-manifest.js +1 -3
  65. package/.next/server/app-paths-manifest.json +7 -7
  66. package/.next/server/chunks/189.js +1 -0
  67. package/.next/server/chunks/430.js +193 -0
  68. package/.next/server/chunks/458.js +2 -0
  69. package/.next/server/chunks/673.js +54 -0
  70. package/.next/server/chunks/705.js +1 -0
  71. package/.next/server/chunks/741.js +165 -0
  72. package/.next/server/chunks/824.js +1 -0
  73. package/.next/server/chunks/877.js +1 -0
  74. package/.next/server/chunks/975.js +1 -0
  75. package/.next/server/middleware-build-manifest.js +1 -24
  76. package/.next/server/middleware-manifest.json +2 -2
  77. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  78. package/.next/server/middleware.js +163 -5
  79. package/.next/server/middleware.js.nft.json +1 -1
  80. package/.next/server/next-font-manifest.js +1 -1
  81. package/.next/server/next-font-manifest.json +1 -23
  82. package/.next/server/pages/404.html +1 -1
  83. package/.next/server/pages/500.html +1 -1
  84. package/.next/server/prefetch-hints.json +7 -2
  85. package/.next/server/server-reference-manifest.js +1 -1
  86. package/.next/server/server-reference-manifest.json +1 -5
  87. package/.next/server/webpack-runtime.js +1 -0
  88. package/.next/static/1XSgsefD2UDLUhlypt4pI/_buildManifest.js +1 -0
  89. package/.next/static/chunks/229-780b2182b9503d6b.js +1 -0
  90. package/.next/static/chunks/39-3411368bf75bda4b.js +2 -0
  91. package/.next/static/chunks/425-fd9b52c810ae34b3.js +1 -0
  92. package/.next/static/chunks/4bd1b696-c9cc1fe3b38e59bb.js +1 -0
  93. package/.next/static/chunks/500-2d1136a2b6ea2d76.js +1 -0
  94. package/.next/static/chunks/570-dfd5824398a487d2.js +1 -0
  95. package/.next/static/chunks/645-5bd0bbdb127fd518.js +1 -0
  96. package/.next/static/chunks/794-5400405c4012cb77.js +52 -0
  97. package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-d217664e48055502.js +1 -0
  98. package/.next/static/chunks/app/[connectionId]/layout-ac99fe88c68dace0.js +1 -0
  99. package/.next/static/chunks/app/[connectionId]/page-6cda216c81b2a8a7.js +1 -0
  100. package/.next/static/chunks/app/_global-error/page-6cda216c81b2a8a7.js +1 -0
  101. package/.next/static/chunks/app/_not-found/page-7d003f35937b6517.js +1 -0
  102. package/.next/static/chunks/app/api/cell/route-6cda216c81b2a8a7.js +1 -0
  103. package/.next/static/chunks/app/api/definition/route-6cda216c81b2a8a7.js +1 -0
  104. package/.next/static/chunks/app/api/delete-rows/route-6cda216c81b2a8a7.js +1 -0
  105. package/.next/static/chunks/app/api/health/route-6cda216c81b2a8a7.js +1 -0
  106. package/.next/static/chunks/app/api/lookup/route-6cda216c81b2a8a7.js +1 -0
  107. package/.next/static/chunks/app/api/related/route-6cda216c81b2a8a7.js +1 -0
  108. package/.next/static/chunks/app/api/rows/route-6cda216c81b2a8a7.js +1 -0
  109. package/.next/static/chunks/app/api/tables/route-6cda216c81b2a8a7.js +1 -0
  110. package/.next/static/chunks/app/layout-c79ceb771b7096b8.js +1 -0
  111. package/.next/static/chunks/app/page-ec77b64860d13030.js +2 -0
  112. package/.next/static/chunks/framework-b820d88d6bcfde5e.js +1 -0
  113. package/.next/static/chunks/main-9bf13cd161e78f68.js +5 -0
  114. package/.next/static/chunks/main-app-0d6db150dc913135.js +1 -0
  115. package/.next/static/chunks/next/dist/client/components/builtin/app-error-6cda216c81b2a8a7.js +1 -0
  116. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-6cda216c81b2a8a7.js +1 -0
  117. package/.next/static/chunks/next/dist/client/components/builtin/global-error-bcffd68b8e4dd429.js +1 -0
  118. package/.next/static/chunks/next/dist/client/components/builtin/not-found-6cda216c81b2a8a7.js +1 -0
  119. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6cda216c81b2a8a7.js +1 -0
  120. package/.next/static/chunks/webpack-ebb3367bb840c4e4.js +1 -0
  121. package/.next/static/css/8f0f8132a5d2bad8.css +3 -0
  122. package/README.md +4 -0
  123. package/bin/ytdb.mjs +1 -1
  124. package/package.json +2 -2
  125. package/.next/fallback-build-manifest.json +0 -15
  126. package/.next/server/app/[connectionId]/[schema]/[table]/page/app-paths-manifest.json +0 -3
  127. package/.next/server/app/[connectionId]/[schema]/[table]/page/build-manifest.json +0 -20
  128. package/.next/server/app/[connectionId]/[schema]/[table]/page/next-font-manifest.json +0 -11
  129. package/.next/server/app/[connectionId]/[schema]/[table]/page/server-reference-manifest.json +0 -4
  130. package/.next/server/app/[connectionId]/[schema]/[table]/page.js.map +0 -5
  131. package/.next/server/app/[connectionId]/page/app-paths-manifest.json +0 -3
  132. package/.next/server/app/[connectionId]/page/build-manifest.json +0 -20
  133. package/.next/server/app/[connectionId]/page/next-font-manifest.json +0 -11
  134. package/.next/server/app/[connectionId]/page/react-loadable-manifest.json +0 -1
  135. package/.next/server/app/[connectionId]/page/server-reference-manifest.json +0 -4
  136. package/.next/server/app/[connectionId]/page.js.map +0 -5
  137. package/.next/server/app/_global-error/page/app-paths-manifest.json +0 -3
  138. package/.next/server/app/_global-error/page/build-manifest.json +0 -20
  139. package/.next/server/app/_global-error/page/next-font-manifest.json +0 -6
  140. package/.next/server/app/_global-error/page/react-loadable-manifest.json +0 -1
  141. package/.next/server/app/_global-error/page/server-reference-manifest.json +0 -4
  142. package/.next/server/app/_global-error/page.js.map +0 -5
  143. package/.next/server/app/_not-found/page/app-paths-manifest.json +0 -3
  144. package/.next/server/app/_not-found/page/build-manifest.json +0 -20
  145. package/.next/server/app/_not-found/page/next-font-manifest.json +0 -11
  146. package/.next/server/app/_not-found/page/react-loadable-manifest.json +0 -1
  147. package/.next/server/app/_not-found/page/server-reference-manifest.json +0 -4
  148. package/.next/server/app/_not-found/page.js.map +0 -5
  149. package/.next/server/app/api/cell/route/app-paths-manifest.json +0 -3
  150. package/.next/server/app/api/cell/route/build-manifest.json +0 -12
  151. package/.next/server/app/api/cell/route/server-reference-manifest.json +0 -4
  152. package/.next/server/app/api/cell/route.js.map +0 -5
  153. package/.next/server/app/api/definition/route/app-paths-manifest.json +0 -3
  154. package/.next/server/app/api/definition/route/build-manifest.json +0 -12
  155. package/.next/server/app/api/definition/route/server-reference-manifest.json +0 -4
  156. package/.next/server/app/api/definition/route.js.map +0 -5
  157. package/.next/server/app/api/delete-rows/route/app-paths-manifest.json +0 -3
  158. package/.next/server/app/api/delete-rows/route/build-manifest.json +0 -12
  159. package/.next/server/app/api/delete-rows/route/server-reference-manifest.json +0 -4
  160. package/.next/server/app/api/delete-rows/route.js.map +0 -5
  161. package/.next/server/app/api/health/route/app-paths-manifest.json +0 -3
  162. package/.next/server/app/api/health/route/build-manifest.json +0 -12
  163. package/.next/server/app/api/health/route/server-reference-manifest.json +0 -4
  164. package/.next/server/app/api/health/route.js.map +0 -5
  165. package/.next/server/app/api/lookup/route/app-paths-manifest.json +0 -3
  166. package/.next/server/app/api/lookup/route/build-manifest.json +0 -12
  167. package/.next/server/app/api/lookup/route/server-reference-manifest.json +0 -4
  168. package/.next/server/app/api/lookup/route.js.map +0 -5
  169. package/.next/server/app/api/related/route/app-paths-manifest.json +0 -3
  170. package/.next/server/app/api/related/route/build-manifest.json +0 -12
  171. package/.next/server/app/api/related/route/server-reference-manifest.json +0 -4
  172. package/.next/server/app/api/related/route.js.map +0 -5
  173. package/.next/server/app/api/rows/route/app-paths-manifest.json +0 -3
  174. package/.next/server/app/api/rows/route/build-manifest.json +0 -12
  175. package/.next/server/app/api/rows/route/server-reference-manifest.json +0 -4
  176. package/.next/server/app/api/rows/route.js.map +0 -5
  177. package/.next/server/app/api/tables/route/app-paths-manifest.json +0 -3
  178. package/.next/server/app/api/tables/route/build-manifest.json +0 -12
  179. package/.next/server/app/api/tables/route/server-reference-manifest.json +0 -4
  180. package/.next/server/app/api/tables/route.js.map +0 -5
  181. package/.next/server/app/favicon.ico/route/app-paths-manifest.json +0 -3
  182. package/.next/server/app/favicon.ico/route/build-manifest.json +0 -12
  183. package/.next/server/app/favicon.ico/route.js.map +0 -5
  184. package/.next/server/app/page/app-paths-manifest.json +0 -3
  185. package/.next/server/app/page/build-manifest.json +0 -20
  186. package/.next/server/app/page/next-font-manifest.json +0 -11
  187. package/.next/server/app/page/react-loadable-manifest.json +0 -1
  188. package/.next/server/app/page/server-reference-manifest.json +0 -4
  189. package/.next/server/app/page.js.map +0 -5
  190. package/.next/server/chunks/[externals]__0uarm42._.js +0 -3
  191. package/.next/server/chunks/[externals]__0uarm42._.js.map +0 -1
  192. package/.next/server/chunks/[externals]__1xmnhya._.js +0 -3
  193. package/.next/server/chunks/[externals]__1xmnhya._.js.map +0 -1
  194. package/.next/server/chunks/[root-of-the-server]__08fumu3._.js +0 -56
  195. package/.next/server/chunks/[root-of-the-server]__08fumu3._.js.map +0 -1
  196. package/.next/server/chunks/[root-of-the-server]__09dhqqi._.js +0 -56
  197. package/.next/server/chunks/[root-of-the-server]__09dhqqi._.js.map +0 -1
  198. package/.next/server/chunks/[root-of-the-server]__0dhb8ph._.js +0 -3
  199. package/.next/server/chunks/[root-of-the-server]__0dhb8ph._.js.map +0 -1
  200. package/.next/server/chunks/[root-of-the-server]__0ihdccc._.js +0 -165
  201. package/.next/server/chunks/[root-of-the-server]__0ihdccc._.js.map +0 -1
  202. package/.next/server/chunks/[root-of-the-server]__0q19g3o._.js +0 -37
  203. package/.next/server/chunks/[root-of-the-server]__0q19g3o._.js.map +0 -1
  204. package/.next/server/chunks/[root-of-the-server]__0q_i_0j._.js +0 -3
  205. package/.next/server/chunks/[root-of-the-server]__0q_i_0j._.js.map +0 -1
  206. package/.next/server/chunks/[root-of-the-server]__13v8a92._.js +0 -37
  207. package/.next/server/chunks/[root-of-the-server]__13v8a92._.js.map +0 -1
  208. package/.next/server/chunks/[root-of-the-server]__15bjnu5._.js +0 -5
  209. package/.next/server/chunks/[root-of-the-server]__15bjnu5._.js.map +0 -1
  210. package/.next/server/chunks/[root-of-the-server]__1xtrrux._.js +0 -3
  211. package/.next/server/chunks/[root-of-the-server]__1xtrrux._.js.map +0 -1
  212. package/.next/server/chunks/[turbopack]_runtime.js +0 -939
  213. package/.next/server/chunks/[turbopack]_runtime.js.map +0 -11
  214. package/.next/server/chunks/_0fkh-00._.js +0 -90
  215. package/.next/server/chunks/_0fkh-00._.js.map +0 -1
  216. package/.next/server/chunks/_0isnx44._.js +0 -72
  217. package/.next/server/chunks/_0isnx44._.js.map +0 -1
  218. package/.next/server/chunks/_0r2zpfr._.js +0 -158
  219. package/.next/server/chunks/_0r2zpfr._.js.map +0 -1
  220. package/.next/server/chunks/_0sg4w8e._.js +0 -21
  221. package/.next/server/chunks/_0sg4w8e._.js.map +0 -1
  222. package/.next/server/chunks/_1349_rj._.js +0 -28
  223. package/.next/server/chunks/_1349_rj._.js.map +0 -1
  224. package/.next/server/chunks/_next-internal_server_app_api_cell_route_actions_1u88ru3.js +0 -3
  225. package/.next/server/chunks/_next-internal_server_app_api_cell_route_actions_1u88ru3.js.map +0 -1
  226. package/.next/server/chunks/_next-internal_server_app_api_definition_route_actions_097kjq6.js +0 -3
  227. package/.next/server/chunks/_next-internal_server_app_api_definition_route_actions_097kjq6.js.map +0 -1
  228. package/.next/server/chunks/_next-internal_server_app_api_delete-rows_route_actions_0t2bukg.js +0 -3
  229. package/.next/server/chunks/_next-internal_server_app_api_delete-rows_route_actions_0t2bukg.js.map +0 -1
  230. package/.next/server/chunks/_next-internal_server_app_api_health_route_actions_1ryftkb.js +0 -3
  231. package/.next/server/chunks/_next-internal_server_app_api_health_route_actions_1ryftkb.js.map +0 -1
  232. package/.next/server/chunks/_next-internal_server_app_api_lookup_route_actions_0-ahhwv.js +0 -3
  233. package/.next/server/chunks/_next-internal_server_app_api_lookup_route_actions_0-ahhwv.js.map +0 -1
  234. package/.next/server/chunks/_next-internal_server_app_api_related_route_actions_0sm4hrz.js +0 -3
  235. package/.next/server/chunks/_next-internal_server_app_api_related_route_actions_0sm4hrz.js.map +0 -1
  236. package/.next/server/chunks/_next-internal_server_app_api_rows_route_actions_0unlq8-.js +0 -3
  237. package/.next/server/chunks/_next-internal_server_app_api_rows_route_actions_0unlq8-.js.map +0 -1
  238. package/.next/server/chunks/_next-internal_server_app_api_tables_route_actions_17e99hn.js +0 -3
  239. package/.next/server/chunks/_next-internal_server_app_api_tables_route_actions_17e99hn.js.map +0 -1
  240. package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_0g2jjls.js +0 -3
  241. package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_0g2jjls.js.map +0 -1
  242. package/.next/server/chunks/ssr/[root-of-the-server]__00wmlt8._.js +0 -3
  243. package/.next/server/chunks/ssr/[root-of-the-server]__00wmlt8._.js.map +0 -1
  244. package/.next/server/chunks/ssr/[root-of-the-server]__06x8wuq._.js +0 -33
  245. package/.next/server/chunks/ssr/[root-of-the-server]__06x8wuq._.js.map +0 -1
  246. package/.next/server/chunks/ssr/[root-of-the-server]__0xpcv9w._.js +0 -14
  247. package/.next/server/chunks/ssr/[root-of-the-server]__0xpcv9w._.js.map +0 -1
  248. package/.next/server/chunks/ssr/[root-of-the-server]__0xwhthq._.js +0 -3
  249. package/.next/server/chunks/ssr/[root-of-the-server]__0xwhthq._.js.map +0 -1
  250. package/.next/server/chunks/ssr/[root-of-the-server]__0y_e9do._.js +0 -3
  251. package/.next/server/chunks/ssr/[root-of-the-server]__0y_e9do._.js.map +0 -1
  252. package/.next/server/chunks/ssr/[root-of-the-server]__18cw6e5._.js +0 -3
  253. package/.next/server/chunks/ssr/[root-of-the-server]__18cw6e5._.js.map +0 -1
  254. package/.next/server/chunks/ssr/[root-of-the-server]__1f2jx51._.js +0 -33
  255. package/.next/server/chunks/ssr/[root-of-the-server]__1f2jx51._.js.map +0 -1
  256. package/.next/server/chunks/ssr/[root-of-the-server]__1nu0z_t._.js +0 -3
  257. package/.next/server/chunks/ssr/[root-of-the-server]__1nu0z_t._.js.map +0 -1
  258. package/.next/server/chunks/ssr/[root-of-the-server]__1o8jotz._.js +0 -3
  259. package/.next/server/chunks/ssr/[root-of-the-server]__1o8jotz._.js.map +0 -1
  260. package/.next/server/chunks/ssr/[root-of-the-server]__1v8o_d0._.js +0 -3
  261. package/.next/server/chunks/ssr/[root-of-the-server]__1v8o_d0._.js.map +0 -1
  262. package/.next/server/chunks/ssr/[turbopack]_runtime.js +0 -939
  263. package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +0 -11
  264. package/.next/server/chunks/ssr/_01jes5c._.js +0 -23
  265. package/.next/server/chunks/ssr/_01jes5c._.js.map +0 -1
  266. package/.next/server/chunks/ssr/_0kdlcdh._.js +0 -3
  267. package/.next/server/chunks/ssr/_0kdlcdh._.js.map +0 -1
  268. package/.next/server/chunks/ssr/_15p4s3l._.js +0 -23
  269. package/.next/server/chunks/ssr/_15p4s3l._.js.map +0 -1
  270. package/.next/server/chunks/ssr/_17he7h-._.js +0 -3
  271. package/.next/server/chunks/ssr/_17he7h-._.js.map +0 -1
  272. package/.next/server/chunks/ssr/_1g86oh0._.js +0 -131
  273. package/.next/server/chunks/ssr/_1g86oh0._.js.map +0 -1
  274. package/.next/server/chunks/ssr/_1k73lzj._.js +0 -4
  275. package/.next/server/chunks/ssr/_1k73lzj._.js.map +0 -1
  276. package/.next/server/chunks/ssr/_next-internal_server_app_[connectionId]_[schema]_[table]_page_actions_1kjlfag.js +0 -3
  277. package/.next/server/chunks/ssr/_next-internal_server_app_[connectionId]_[schema]_[table]_page_actions_1kjlfag.js.map +0 -1
  278. package/.next/server/chunks/ssr/_next-internal_server_app_[connectionId]_page_actions_19cz9ih.js +0 -3
  279. package/.next/server/chunks/ssr/_next-internal_server_app_[connectionId]_page_actions_19cz9ih.js.map +0 -1
  280. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0zi5s8-.js +0 -3
  281. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0zi5s8-.js.map +0 -1
  282. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0pt47yr.js +0 -3
  283. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0pt47yr.js.map +0 -1
  284. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_0hhsz1j.js +0 -3
  285. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_0hhsz1j.js.map +0 -1
  286. package/.next/server/chunks/ssr/node_modules_1wax83z._.js +0 -33
  287. package/.next/server/chunks/ssr/node_modules_1wax83z._.js.map +0 -1
  288. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_download_mjs_0z4tf7q._.js +0 -3
  289. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_download_mjs_0z4tf7q._.js.map +0 -1
  290. package/.next/server/chunks/ssr/node_modules_next_dist_1n3w9lb._.js +0 -6
  291. package/.next/server/chunks/ssr/node_modules_next_dist_1n3w9lb._.js.map +0 -1
  292. package/.next/server/chunks/ssr/node_modules_next_dist_1v8aef8._.js +0 -3
  293. package/.next/server/chunks/ssr/node_modules_next_dist_1v8aef8._.js.map +0 -1
  294. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +0 -3
  295. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js.map +0 -1
  296. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js +0 -3
  297. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js.map +0 -1
  298. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0q-w892.js +0 -3
  299. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0q-w892.js.map +0 -1
  300. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js +0 -3
  301. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js.map +0 -1
  302. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_server-async-storage_0t1dato.js +0 -3
  303. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_server-async-storage_0t1dato.js.map +0 -1
  304. package/.next/server/chunks/ssr/src_1924u4n._.js +0 -3
  305. package/.next/server/chunks/ssr/src_1924u4n._.js.map +0 -1
  306. package/.next/server/chunks/ssr/src_components_05iaj8g._.js +0 -4
  307. package/.next/server/chunks/ssr/src_components_05iaj8g._.js.map +0 -1
  308. package/.next/server/chunks/ssr/src_components_explorer_explorer-shell_tsx_0uis8b_._.js +0 -3
  309. package/.next/server/chunks/ssr/src_components_explorer_explorer-shell_tsx_0uis8b_._.js.map +0 -1
  310. package/.next/server/chunks/ssr/src_components_table_table-view_tsx_1c47km-._.js +0 -3
  311. package/.next/server/chunks/ssr/src_components_table_table-view_tsx_1c47km-._.js.map +0 -1
  312. package/.next/server/middleware/middleware-manifest.json +0 -6
  313. package/.next/server/middleware.js.map +0 -5
  314. package/.next/static/BXmOJ7sstE0tf3fFtfiD-/_buildManifest.js +0 -11
  315. package/.next/static/BXmOJ7sstE0tf3fFtfiD-/_clientMiddlewareManifest.js +0 -6
  316. package/.next/static/chunks/067ca5059_fo7.js +0 -1
  317. package/.next/static/chunks/08i4cjis-mty5.js +0 -1
  318. package/.next/static/chunks/08ttfj81-47mu.js +0 -1
  319. package/.next/static/chunks/0d7w4pixfxh4v.js +0 -1
  320. package/.next/static/chunks/0h4f5tc41le47.js +0 -22
  321. package/.next/static/chunks/0vac_z0xf17fa.js +0 -1
  322. package/.next/static/chunks/0wtas4t7k7-y6.js +0 -1
  323. package/.next/static/chunks/14d0hms_nxki9.css +0 -3
  324. package/.next/static/chunks/2c9zyyph1-b60.js +0 -2
  325. package/.next/static/chunks/2i51e627rllld.js +0 -1
  326. package/.next/static/chunks/3fntmmi971322.js +0 -1
  327. package/.next/static/chunks/3i15u02kou8j5.js +0 -2
  328. package/.next/static/chunks/3mc6dra1m0098.js +0 -31
  329. package/.next/static/chunks/3sanpqz1t19j-.js +0 -1
  330. package/.next/static/chunks/turbopack-3pswe3faev0qr.js +0 -1
  331. package/.next/static/media/favicon.2vob68tjqpejf.ico +0 -0
  332. /package/.next/{server/app/[connectionId]/[schema]/[table]/page/react-loadable-manifest.json → react-loadable-manifest.json} +0 -0
  333. /package/.next/static/{BXmOJ7sstE0tf3fFtfiD- → 1XSgsefD2UDLUhlypt4pI}/_ssgManifest.js +0 -0
  334. /package/.next/static/chunks/{0cz1d0mv5g_q7.js → polyfills-42372ed130431b0a.js} +0 -0
  335. /package/.next/static/media/{5ce348bf30bf5439-s.31988l_ccedte.woff2 → 013b72fa676f92e0-s.woff2} +0 -0
  336. /package/.next/static/media/{caa3a2e1cccd8315-s.p.0wgildi0cnwt9.woff2 → 22a5144ee8d83bca-s.p.woff2} +0 -0
  337. /package/.next/static/media/{bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 → 2b5b02fc7e511755-s.woff2} +0 -0
  338. /package/.next/static/media/{6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 → 65f03d54ccadf4a8-s.woff2} +0 -0
  339. /package/.next/static/media/{797e433ab948586e-s.p.0r6juujl39pe6.woff2 → 7d4881bb7e1bf84d-s.p.woff2} +0 -0
  340. /package/.next/static/media/{8a480f0b521d4e75-s.1qq4vpdcun5oj.woff2 → 9766a7e9e2e0ad5a-s.woff2} +0 -0
  341. /package/.next/static/media/{7178b3e590c64307-s.21jp631_3pja2.woff2 → aa016aab0e6d1295-s.woff2} +0 -0
  342. /package/.next/static/media/{53b9e256198e5412-s.390ncx5urfkfu.woff2 → b66cf8e69499582a-s.woff2} +0 -0
  343. /package/.next/static/media/{4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 → b9408752a0c24fb9-s.woff2} +0 -0
  344. /package/.next/static/media/{7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 → e038a29029a234f2-s.woff2} +0 -0
  345. /package/.next/static/media/{fef07dbb0973bf53-s.3p2_lha1f2xer.woff2 → f639721981034f88-s.woff2} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../node_modules/convex/dist/esm/values/validators.js","../../../../node_modules/convex/dist/esm/values/value.js","../../../../src/components/ConvexClientProvider.tsx","../../../../node_modules/convex/dist/esm/values/validator.js","../../../../node_modules/convex/dist/esm/values/errors.js","../../../../node_modules/convex/dist/esm/values/compare.js","../../../../node_modules/convex/dist/esm/values/size.js","../../../../node_modules/convex/dist/esm/values/index.js","../../../../node_modules/convex/dist/esm/browser/sync/udf_path_utils.js","../../../../node_modules/convex/dist/esm/browser/sync/local_state.js","../../../../node_modules/convex/dist/esm/browser/sync/request_manager.js","../../../../node_modules/convex/dist/esm/server/components/paths.js","../../../../node_modules/convex/dist/esm/server/api.js","../../../../node_modules/convex/dist/esm/browser/sync/optimistic_updates_impl.js","../../../../node_modules/convex/dist/esm/browser/sync/remote_query_set.js","../../../../node_modules/convex/dist/esm/browser/sync/protocol.js","../../../../node_modules/convex/dist/esm/browser/sync/web_socket_manager.js","../../../../node_modules/convex/dist/esm/browser/sync/authentication_manager.js","../../../../node_modules/convex/dist/esm/browser/sync/client.js","../../../../node_modules/convex/dist/esm/browser/sync/paginated_query_client.js","../../../../node_modules/convex/dist/esm/browser/simple_client.js","../../../../node_modules/convex/dist/esm/browser/http_client.js","../../../../node_modules/convex/dist/esm/browser/index.js","../../../../node_modules/convex/dist/esm/react/use_subscription.js","../../../../node_modules/convex/dist/esm/react/client.js","../../../../node_modules/convex/dist/esm/react/queries_observer.js","../../../../node_modules/convex/dist/esm/react/use_queries.js","../../../../node_modules/convex/dist/esm/react/use_paginated_query.js","../../../../node_modules/convex/dist/esm/react/use_paginated_query2.js","../../../../node_modules/convex/dist/esm/react/ConvexAuthState.js","../../../../node_modules/convex/dist/esm/react/auth_helpers.js","../../../../node_modules/convex/dist/esm/react/hydration.js","../../../../node_modules/convex/dist/esm/react/index.js","../../../../node_modules/convex/dist/esm/vendor/long.js","../../../../node_modules/convex/dist/esm/browser/logging.js","../../../../node_modules/convex/dist/esm/values/base64.js","../../../../node_modules/convex/dist/esm/browser/sync/metrics.js","../../../../node_modules/convex/dist/esm/index.js","../../../../node_modules/convex/dist/esm/browser/sync/pagination.js","../../../../node_modules/convex/dist/esm/browser/sync/session.js","../../../../node_modules/convex/dist/esm/vendor/jwt-decode/index.js","../../../../node_modules/convex/dist/esm/values/compare_utf8.js","../../../../node_modules/convex/dist/esm/server/functionName.js","../../../../node_modules/convex/dist/esm/common/index.js","../../../../src/components/local-bridge-gate.tsx","../../../../src/components/theme-provider.tsx"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { convexToJson } from \"./value.js\";\nconst UNDEFINED_VALIDATOR_ERROR_URL = \"https://docs.convex.dev/error#undefined-validator\";\nfunction throwUndefinedValidatorError(context, fieldName) {\n const fieldInfo = fieldName !== void 0 ? ` for field \"${fieldName}\"` : \"\";\n throw new Error(\n `A validator is undefined${fieldInfo} in ${context}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`\n );\n}\nclass BaseValidator {\n constructor({ isOptional }) {\n /**\n * Only for TypeScript, the TS type of the JS values validated\n * by this validator.\n */\n __publicField(this, \"type\");\n /**\n * Only for TypeScript, if this an Object validator, then\n * this is the TS type of its property names.\n */\n __publicField(this, \"fieldPaths\");\n /**\n * Whether this is an optional Object property value validator.\n */\n __publicField(this, \"isOptional\");\n /**\n * Always `\"true\"`.\n */\n __publicField(this, \"isConvexValidator\");\n this.isOptional = isOptional;\n this.isConvexValidator = true;\n }\n}\nexport class VId extends BaseValidator {\n /**\n * Usually you'd use `v.id(tableName)` instead.\n */\n constructor({\n isOptional,\n tableName\n }) {\n super({ isOptional });\n /**\n * The name of the table that the validated IDs must belong to.\n */\n __publicField(this, \"tableName\");\n /**\n * The kind of validator, `\"id\"`.\n */\n __publicField(this, \"kind\", \"id\");\n if (typeof tableName !== \"string\") {\n throw new Error(\"v.id(tableName) requires a string\");\n }\n this.tableName = tableName;\n }\n /** @internal */\n get json() {\n return { type: \"id\", tableName: this.tableName };\n }\n /** @internal */\n asOptional() {\n return new VId({\n isOptional: \"optional\",\n tableName: this.tableName\n });\n }\n}\nexport class VFloat64 extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"float64\"`.\n */\n __publicField(this, \"kind\", \"float64\");\n }\n /** @internal */\n get json() {\n return { type: \"number\" };\n }\n /** @internal */\n asOptional() {\n return new VFloat64({\n isOptional: \"optional\"\n });\n }\n}\nexport class VInt64 extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"int64\"`.\n */\n __publicField(this, \"kind\", \"int64\");\n }\n /** @internal */\n get json() {\n return { type: \"bigint\" };\n }\n /** @internal */\n asOptional() {\n return new VInt64({ isOptional: \"optional\" });\n }\n}\nexport class VCommitTs extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"commitTs\"`.\n */\n __publicField(this, \"kind\", \"commitTs\");\n }\n /** @internal */\n get json() {\n return { type: this.kind };\n }\n /** @internal */\n asOptional() {\n return new VCommitTs({\n isOptional: \"optional\"\n });\n }\n}\nexport class VBoolean extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"boolean\"`.\n */\n __publicField(this, \"kind\", \"boolean\");\n }\n /** @internal */\n get json() {\n return { type: this.kind };\n }\n /** @internal */\n asOptional() {\n return new VBoolean({\n isOptional: \"optional\"\n });\n }\n}\nexport class VBytes extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"bytes\"`.\n */\n __publicField(this, \"kind\", \"bytes\");\n }\n /** @internal */\n get json() {\n return { type: this.kind };\n }\n /** @internal */\n asOptional() {\n return new VBytes({ isOptional: \"optional\" });\n }\n}\nexport class VString extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"string\"`.\n */\n __publicField(this, \"kind\", \"string\");\n }\n /** @internal */\n get json() {\n return { type: this.kind };\n }\n /** @internal */\n asOptional() {\n return new VString({\n isOptional: \"optional\"\n });\n }\n}\nexport class VNull extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"null\"`.\n */\n __publicField(this, \"kind\", \"null\");\n }\n /** @internal */\n get json() {\n return { type: this.kind };\n }\n /** @internal */\n asOptional() {\n return new VNull({ isOptional: \"optional\" });\n }\n}\nexport class VAny extends BaseValidator {\n constructor() {\n super(...arguments);\n /**\n * The kind of validator, `\"any\"`.\n */\n __publicField(this, \"kind\", \"any\");\n }\n /** @internal */\n get json() {\n return {\n type: this.kind\n };\n }\n /** @internal */\n asOptional() {\n return new VAny({\n isOptional: \"optional\"\n });\n }\n}\nexport class VObject extends BaseValidator {\n /**\n * Usually you'd use `v.object({ ... })` instead.\n */\n constructor({\n isOptional,\n fields\n }) {\n super({ isOptional });\n /**\n * An object with the validator for each property.\n */\n __publicField(this, \"fields\");\n /**\n * The kind of validator, `\"object\"`.\n */\n __publicField(this, \"kind\", \"object\");\n globalThis.Object.entries(fields).forEach(([fieldName, validator]) => {\n if (validator === void 0) {\n throwUndefinedValidatorError(\"v.object()\", fieldName);\n }\n if (!validator.isConvexValidator) {\n throw new Error(\"v.object() entries must be validators\");\n }\n });\n this.fields = fields;\n }\n /** @internal */\n get json() {\n return {\n type: this.kind,\n value: globalThis.Object.fromEntries(\n globalThis.Object.entries(this.fields).map(([k, v]) => [\n k,\n {\n fieldType: v.json,\n optional: v.isOptional === \"optional\" ? true : false\n }\n ])\n )\n };\n }\n /** @internal */\n asOptional() {\n return new VObject({\n isOptional: \"optional\",\n fields: this.fields\n });\n }\n /**\n * Create a new VObject with the specified fields omitted.\n * @param fields The field names to omit from this VObject.\n */\n omit(...fields) {\n const newFields = { ...this.fields };\n for (const field of fields) {\n delete newFields[field];\n }\n return new VObject({\n isOptional: this.isOptional,\n fields: newFields\n });\n }\n /**\n * Create a new VObject with only the specified fields.\n * @param fields The field names to pick from this VObject.\n */\n pick(...fields) {\n const newFields = {};\n for (const field of fields) {\n newFields[field] = this.fields[field];\n }\n return new VObject({\n isOptional: this.isOptional,\n fields: newFields\n });\n }\n /**\n * Create a new VObject with all fields marked as optional.\n */\n partial() {\n const newFields = {};\n for (const [key, validator] of globalThis.Object.entries(this.fields)) {\n newFields[key] = validator.asOptional();\n }\n return new VObject({\n isOptional: this.isOptional,\n fields: newFields\n });\n }\n /**\n * Create a new VObject with additional fields merged in.\n * @param fields An object with additional validators to merge into this VObject.\n */\n extend(fields) {\n return new VObject({\n isOptional: this.isOptional,\n fields: { ...this.fields, ...fields }\n });\n }\n}\nexport class VLiteral extends BaseValidator {\n /**\n * Usually you'd use `v.literal(value)` instead.\n */\n constructor({ isOptional, value }) {\n super({ isOptional });\n /**\n * The value that the validated values must be equal to.\n */\n __publicField(this, \"value\");\n /**\n * The kind of validator, `\"literal\"`.\n */\n __publicField(this, \"kind\", \"literal\");\n if (typeof value !== \"string\" && typeof value !== \"boolean\" && typeof value !== \"number\" && typeof value !== \"bigint\") {\n throw new Error(\"v.literal(value) must be a string, number, or boolean\");\n }\n this.value = value;\n }\n /** @internal */\n get json() {\n return {\n type: this.kind,\n value: convexToJson(this.value)\n };\n }\n /** @internal */\n asOptional() {\n return new VLiteral({\n isOptional: \"optional\",\n value: this.value\n });\n }\n}\nexport class VArray extends BaseValidator {\n /**\n * Usually you'd use `v.array(element)` instead.\n */\n constructor({\n isOptional,\n element\n }) {\n super({ isOptional });\n /**\n * The validator for the elements of the array.\n */\n __publicField(this, \"element\");\n /**\n * The kind of validator, `\"array\"`.\n */\n __publicField(this, \"kind\", \"array\");\n if (element === void 0) {\n throwUndefinedValidatorError(\"v.array()\");\n }\n this.element = element;\n }\n /** @internal */\n get json() {\n return {\n type: this.kind,\n value: this.element.json\n };\n }\n /** @internal */\n asOptional() {\n return new VArray({\n isOptional: \"optional\",\n element: this.element\n });\n }\n}\nexport class VRecord extends BaseValidator {\n /**\n * Usually you'd use `v.record(key, value)` instead.\n */\n constructor({\n isOptional,\n key,\n value\n }) {\n super({ isOptional });\n /**\n * The validator for the keys of the record.\n */\n __publicField(this, \"key\");\n /**\n * The validator for the values of the record.\n */\n __publicField(this, \"value\");\n /**\n * The kind of validator, `\"record\"`.\n */\n __publicField(this, \"kind\", \"record\");\n if (key === void 0) {\n throwUndefinedValidatorError(\"v.record()\", \"key\");\n }\n if (value === void 0) {\n throwUndefinedValidatorError(\"v.record()\", \"value\");\n }\n if (key.isOptional === \"optional\") {\n throw new Error(\"Record validator cannot have optional keys\");\n }\n if (value.isOptional === \"optional\") {\n throw new Error(\"Record validator cannot have optional values\");\n }\n if (!key.isConvexValidator || !value.isConvexValidator) {\n throw new Error(\"Key and value of v.record() but be validators\");\n }\n this.key = key;\n this.value = value;\n }\n /** @internal */\n get json() {\n return {\n type: this.kind,\n // This cast is needed because TypeScript thinks the key type is too wide\n keys: this.key.json,\n values: {\n fieldType: this.value.json,\n optional: false\n }\n };\n }\n /** @internal */\n asOptional() {\n return new VRecord({\n isOptional: \"optional\",\n key: this.key,\n value: this.value\n });\n }\n}\nexport class VUnion extends BaseValidator {\n /**\n * Usually you'd use `v.union(...members)` instead.\n */\n constructor({ isOptional, members }) {\n super({ isOptional });\n /**\n * The array of validators, one of which must match the value.\n */\n __publicField(this, \"members\");\n /**\n * The kind of validator, `\"union\"`.\n */\n __publicField(this, \"kind\", \"union\");\n members.forEach((member, index) => {\n if (member === void 0) {\n throwUndefinedValidatorError(\"v.union()\", `member at index ${index}`);\n }\n if (!member.isConvexValidator) {\n throw new Error(\"All members of v.union() must be validators\");\n }\n });\n this.members = members;\n }\n /** @internal */\n get json() {\n return {\n type: this.kind,\n value: this.members.map((v) => v.json)\n };\n }\n /** @internal */\n asOptional() {\n return new VUnion({\n isOptional: \"optional\",\n members: this.members\n });\n }\n}\n//# sourceMappingURL=validators.js.map\n","\"use strict\";\nimport * as Base64 from \"./base64.js\";\nimport { isSimpleObject } from \"../common/index.js\";\nconst LITTLE_ENDIAN = true;\nconst MIN_INT64 = BigInt(\"-9223372036854775808\");\nexport const MAX_INT64 = BigInt(\"9223372036854775807\");\nconst ZERO = BigInt(\"0\");\nconst EIGHT = BigInt(\"8\");\nconst TWOFIFTYSIX = BigInt(\"256\");\nconst COMMIT_TS_UNRESOLVED = \"This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.\";\nexport class CommitTsPlaceholder {\n [Symbol.toPrimitive](hint) {\n if (hint === \"string\") {\n return this.toString();\n }\n throw new Error(COMMIT_TS_UNRESOLVED);\n }\n valueOf() {\n throw new Error(COMMIT_TS_UNRESOLVED);\n }\n toJSON() {\n throw new Error(COMMIT_TS_UNRESOLVED);\n }\n toString() {\n return \"[unresolved commit timestamp]\";\n }\n}\nexport const commitTsPlaceholder = new CommitTsPlaceholder();\nfunction isSpecial(n) {\n return Number.isNaN(n) || !Number.isFinite(n) || Object.is(n, -0);\n}\nexport function slowBigIntToBase64(value) {\n if (value < ZERO) {\n value -= MIN_INT64 + MIN_INT64;\n }\n let hex = value.toString(16);\n if (hex.length % 2 === 1) hex = \"0\" + hex;\n const bytes = new Uint8Array(new ArrayBuffer(8));\n let i = 0;\n for (const hexByte of hex.match(/.{2}/g).reverse()) {\n bytes.set([parseInt(hexByte, 16)], i++);\n value >>= EIGHT;\n }\n return Base64.fromByteArray(bytes);\n}\nexport function slowBase64ToBigInt(encoded) {\n const integerBytes = Base64.toByteArray(encoded);\n if (integerBytes.byteLength !== 8) {\n throw new Error(\n `Received ${integerBytes.byteLength} bytes, expected 8 for $integer`\n );\n }\n let value = ZERO;\n let power = ZERO;\n for (const byte of integerBytes) {\n value += BigInt(byte) * TWOFIFTYSIX ** power;\n power++;\n }\n if (value > MAX_INT64) {\n value += MIN_INT64 + MIN_INT64;\n }\n return value;\n}\nexport function modernBigIntToBase64(value) {\n if (value < MIN_INT64 || MAX_INT64 < value) {\n throw new Error(\n `BigInt ${value} does not fit into a 64-bit signed integer.`\n );\n }\n const buffer = new ArrayBuffer(8);\n new DataView(buffer).setBigInt64(0, value, true);\n return Base64.fromByteArray(new Uint8Array(buffer));\n}\nexport function modernBase64ToBigInt(encoded) {\n const integerBytes = Base64.toByteArray(encoded);\n if (integerBytes.byteLength !== 8) {\n throw new Error(\n `Received ${integerBytes.byteLength} bytes, expected 8 for $integer`\n );\n }\n const intBytesView = new DataView(integerBytes.buffer);\n return intBytesView.getBigInt64(0, true);\n}\nexport const bigIntToBase64 = DataView.prototype.setBigInt64 ? modernBigIntToBase64 : slowBigIntToBase64;\nexport const base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;\nconst MAX_IDENTIFIER_LEN = 1024;\nfunction validateObjectField(k) {\n if (k.length > MAX_IDENTIFIER_LEN) {\n throw new Error(\n `Field name ${k} exceeds maximum field name length ${MAX_IDENTIFIER_LEN}.`\n );\n }\n if (k.startsWith(\"$\")) {\n throw new Error(`Field name ${k} starts with a '$', which is reserved.`);\n }\n for (let i = 0; i < k.length; i += 1) {\n const charCode = k.charCodeAt(i);\n if (charCode < 32 || charCode >= 127) {\n throw new Error(\n `Field name ${k} has invalid character '${k[i]}': Field names can only contain non-control ASCII characters`\n );\n }\n }\n}\nexport function jsonToConvex(value) {\n if (value === null) {\n return value;\n }\n if (typeof value === \"boolean\") {\n return value;\n }\n if (typeof value === \"number\") {\n return value;\n }\n if (typeof value === \"string\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map((value2) => jsonToConvex(value2));\n }\n if (typeof value !== \"object\") {\n throw new Error(`Unexpected type of ${value}`);\n }\n const entries = Object.entries(value);\n if (entries.length === 1) {\n const key = entries[0][0];\n if (key === \"$bytes\") {\n if (typeof value.$bytes !== \"string\") {\n throw new Error(`Malformed $bytes field on ${value}`);\n }\n return Base64.toByteArray(value.$bytes).buffer;\n }\n if (key === \"$integer\") {\n if (typeof value.$integer !== \"string\") {\n throw new Error(`Malformed $integer field on ${value}`);\n }\n return base64ToBigInt(value.$integer);\n }\n if (key === \"$float\") {\n if (typeof value.$float !== \"string\") {\n throw new Error(`Malformed $float field on ${value}`);\n }\n const floatBytes = Base64.toByteArray(value.$float);\n if (floatBytes.byteLength !== 8) {\n throw new Error(\n `Received ${floatBytes.byteLength} bytes, expected 8 for $float`\n );\n }\n const floatBytesView = new DataView(floatBytes.buffer);\n const float = floatBytesView.getFloat64(0, LITTLE_ENDIAN);\n if (!isSpecial(float)) {\n throw new Error(`Float ${float} should be encoded as a number`);\n }\n return float;\n }\n if (key === \"$commitTs\") {\n if (value.$commitTs !== null) {\n throw new Error(`Malformed $commitTs field on ${value}`);\n }\n return commitTsPlaceholder;\n }\n if (key === \"$set\") {\n throw new Error(\n `Received a Set which is no longer supported as a Convex type.`\n );\n }\n if (key === \"$map\") {\n throw new Error(\n `Received a Map which is no longer supported as a Convex type.`\n );\n }\n }\n const out = {};\n for (const [k, v] of Object.entries(value)) {\n validateObjectField(k);\n out[k] = jsonToConvex(v);\n }\n return out;\n}\nconst MAX_VALUE_FOR_ERROR_LEN = 16384;\nexport function stringifyValueForError(value) {\n const str = JSON.stringify(value, (_key, value2) => {\n if (value2 === void 0) {\n return \"undefined\";\n }\n if (typeof value2 === \"bigint\") {\n return `${value2.toString()}n`;\n }\n return value2;\n });\n if (str.length > MAX_VALUE_FOR_ERROR_LEN) {\n const rest = \"[...truncated]\";\n let truncateAt = MAX_VALUE_FOR_ERROR_LEN - rest.length;\n const codePoint = str.codePointAt(truncateAt - 1);\n if (codePoint !== void 0 && codePoint > 65535) {\n truncateAt -= 1;\n }\n return str.substring(0, truncateAt) + rest;\n }\n return str;\n}\nfunction convexToJsonInternal(value, originalValue, context, includeTopLevelUndefined) {\n if (value === void 0) {\n const contextText = context && ` (present at path ${context} in original object ${stringifyValueForError(\n originalValue\n )})`;\n throw new Error(\n `undefined is not a valid Convex value${contextText}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`\n );\n }\n if (value === null) {\n return value;\n }\n if (typeof value === \"bigint\") {\n if (value < MIN_INT64 || MAX_INT64 < value) {\n throw new Error(\n `BigInt ${value} does not fit into a 64-bit signed integer.`\n );\n }\n return { $integer: bigIntToBase64(value) };\n }\n if (typeof value === \"number\") {\n if (isSpecial(value)) {\n const buffer = new ArrayBuffer(8);\n new DataView(buffer).setFloat64(0, value, LITTLE_ENDIAN);\n return { $float: Base64.fromByteArray(new Uint8Array(buffer)) };\n } else {\n return value;\n }\n }\n if (typeof value === \"boolean\") {\n return value;\n }\n if (typeof value === \"string\") {\n return value;\n }\n if (value instanceof ArrayBuffer) {\n return { $bytes: Base64.fromByteArray(new Uint8Array(value)) };\n }\n if (value instanceof CommitTsPlaceholder) {\n return { $commitTs: null };\n }\n if (Array.isArray(value)) {\n return value.map(\n (value2, i) => convexToJsonInternal(value2, originalValue, context + `[${i}]`, false)\n );\n }\n if (value instanceof Set) {\n throw new Error(\n errorMessageForUnsupportedType(context, \"Set\", [...value], originalValue)\n );\n }\n if (value instanceof Map) {\n throw new Error(\n errorMessageForUnsupportedType(context, \"Map\", [...value], originalValue)\n );\n }\n if (!isSimpleObject(value)) {\n const theType = value?.constructor?.name;\n const typeName = theType ? `${theType} ` : \"\";\n throw new Error(\n errorMessageForUnsupportedType(context, typeName, value, originalValue)\n );\n }\n const out = {};\n const entries = Object.entries(value);\n entries.sort(([k1, _v1], [k2, _v2]) => k1 === k2 ? 0 : k1 < k2 ? -1 : 1);\n for (const [k, v] of entries) {\n if (v !== void 0) {\n validateObjectField(k);\n out[k] = convexToJsonInternal(v, originalValue, context + `.${k}`, false);\n } else if (includeTopLevelUndefined) {\n validateObjectField(k);\n out[k] = convexOrUndefinedToJsonInternal(\n v,\n originalValue,\n context + `.${k}`\n );\n }\n }\n return out;\n}\nfunction errorMessageForUnsupportedType(context, typeName, value, originalValue) {\n if (context) {\n return `${typeName}${stringifyValueForError(\n value\n )} is not a supported Convex type (present at path ${context} in original object ${stringifyValueForError(\n originalValue\n )}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`;\n } else {\n return `${typeName}${stringifyValueForError(\n value\n )} is not a supported Convex type.`;\n }\n}\nfunction convexOrUndefinedToJsonInternal(value, originalValue, context) {\n if (value === void 0) {\n return { $undefined: null };\n } else {\n if (originalValue === void 0) {\n throw new Error(\n `Programming error. Current value is ${stringifyValueForError(\n value\n )} but original value is undefined`\n );\n }\n return convexToJsonInternal(value, originalValue, context, false);\n }\n}\nexport function convexToJson(value) {\n return convexToJsonInternal(value, value, \"\", false);\n}\nexport function convexOrUndefinedToJson(value) {\n return convexOrUndefinedToJsonInternal(value, value, \"\");\n}\nexport function patchValueToJson(value) {\n return convexToJsonInternal(value, value, \"\", true);\n}\n//# sourceMappingURL=value.js.map\n","\"use client\";\n\nimport { ConvexProvider, ConvexReactClient } from \"convex/react\";\nimport { ReactNode, useMemo } from \"react\";\n\nexport function ConvexClientProvider({ children }: { children: ReactNode }) {\n const url = process.env.NEXT_PUBLIC_CONVEX_URL;\n\n const client = useMemo(() => {\n if (!url) return null;\n return new ConvexReactClient(url);\n }, [url]);\n\n if (!client) {\n return children;\n }\n\n return <ConvexProvider client={client}>{children}</ConvexProvider>;\n}\n","\"use strict\";\nimport {\n VAny,\n VArray,\n VBoolean,\n VBytes,\n VFloat64,\n VId,\n VCommitTs,\n VInt64,\n VLiteral,\n VNull,\n VObject,\n VRecord,\n VString,\n VUnion\n} from \"./validators.js\";\nexport function isValidator(v2) {\n return !!v2.isConvexValidator;\n}\nexport function asObjectValidator(obj) {\n if (isValidator(obj)) {\n return obj;\n } else {\n return v.object(obj);\n }\n}\nexport const v = {\n /**\n * Validates that the value is a document ID for the given table.\n *\n * IDs are strings at runtime but are typed as `Id<\"tableName\">` in\n * TypeScript for type safety.\n *\n * @example\n * ```typescript\n * args: { userId: v.id(\"users\") }\n * ```\n *\n * @param tableName The name of the table.\n */\n id: (tableName) => {\n return new VId({\n isOptional: \"required\",\n tableName\n });\n },\n /**\n * Validates that the value is `null`.\n *\n * Use `returns: v.null()` for functions that don't return a meaningful value.\n * JavaScript `undefined` is not a valid Convex value, it is automatically\n * converted to `null`.\n */\n null: () => {\n return new VNull({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a JavaScript `number` (Convex Float64).\n *\n * Supports all IEEE-754 double-precision floating point numbers including\n * NaN and Infinity.\n *\n * Alias for `v.float64()`.\n */\n number: () => {\n return new VFloat64({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a JavaScript `number` (Convex Float64).\n *\n * Supports all IEEE-754 double-precision floating point numbers.\n */\n float64: () => {\n return new VFloat64({ isOptional: \"required\" });\n },\n /**\n * @deprecated Use `v.int64()` instead.\n */\n bigint: () => {\n return new VInt64({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a JavaScript `bigint` (Convex Int64).\n *\n * Supports BigInts between -2^63 and 2^63-1.\n *\n * @example\n * ```typescript\n * args: { timestamp: v.int64() }\n * // Usage: createDoc({ timestamp: 1234567890n })\n * ```\n */\n int64: () => {\n return new VInt64({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a commit timestamp: an int64 (`bigint`)\n * assigned from the transaction's commit timestamp.\n *\n * An index on a field with this validator orders documents by commit order.\n * Accepts any int64 value; write `db.vars.commitTs` to have the field\n * resolve to the commit timestamp when the mutation commits.\n */\n commitTs: () => {\n return new VCommitTs({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a `boolean`.\n */\n boolean: () => {\n return new VBoolean({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is a `string`.\n *\n * Strings are stored as UTF-8 and their storage size is calculated as their\n * UTF-8 encoded size.\n */\n string: () => {\n return new VString({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is an `ArrayBuffer` (Convex Bytes).\n *\n * Use for binary data.\n */\n bytes: () => {\n return new VBytes({ isOptional: \"required\" });\n },\n /**\n * Validates that the value is exactly equal to the given literal.\n *\n * Useful for discriminated unions and enum-like patterns.\n *\n * @example\n * ```typescript\n * // Discriminated union pattern:\n * v.union(\n * v.object({ kind: v.literal(\"error\"), message: v.string() }),\n * v.object({ kind: v.literal(\"success\"), value: v.number() }),\n * )\n * ```\n *\n * @param literal The literal value to compare against.\n */\n literal: (literal) => {\n return new VLiteral({ isOptional: \"required\", value: literal });\n },\n /**\n * Validates that the value is an `Array` where every element matches the\n * given validator.\n *\n * Arrays can have at most 8192 elements.\n *\n * @example\n * ```typescript\n * args: { tags: v.array(v.string()) }\n * args: { coordinates: v.array(v.number()) }\n * args: { items: v.array(v.object({ name: v.string(), qty: v.number() })) }\n * ```\n *\n * @param element The validator for the elements of the array.\n */\n array: (element) => {\n return new VArray({ isOptional: \"required\", element });\n },\n /**\n * Validates that the value is an `Object` with the specified properties.\n *\n * Objects can have at most 1024 entries. Field names must be non-empty and\n * must not start with `\"$\"` or `\"_\"` (`_` is reserved for system fields\n * like `_id` and `_creationTime`; `$` is reserved for Convex internal use).\n *\n * @example\n * ```typescript\n * args: {\n * user: v.object({\n * name: v.string(),\n * email: v.string(),\n * age: v.optional(v.number()),\n * })\n * }\n * ```\n *\n * @param fields An object mapping property names to their validators.\n */\n object: (fields) => {\n return new VObject({ isOptional: \"required\", fields });\n },\n /**\n * Validates that the value is a `Record` (object with dynamic keys).\n *\n * Records are objects at runtime but allow dynamic keys, unlike `v.object()`\n * which requires known property names. Keys must be ASCII characters only,\n * non-empty, and not start with `\"$\"` or `\"_\"`.\n *\n * @example\n * ```typescript\n * // Map of user IDs to scores:\n * args: { scores: v.record(v.id(\"users\"), v.number()) }\n *\n * // Map of string keys to string values:\n * args: { metadata: v.record(v.string(), v.string()) }\n * ```\n *\n * @param keys The validator for the keys of the record.\n * @param values The validator for the values of the record.\n */\n record: (keys, values) => {\n return new VRecord({\n isOptional: \"required\",\n key: keys,\n value: values\n });\n },\n /**\n * Validates that the value matches at least one of the given validators.\n *\n * @example\n * ```typescript\n * // Allow string or number:\n * args: { value: v.union(v.string(), v.number()) }\n *\n * // Discriminated union (recommended pattern):\n * v.union(\n * v.object({ kind: v.literal(\"text\"), body: v.string() }),\n * v.object({ kind: v.literal(\"image\"), url: v.string() }),\n * )\n *\n * // Nullable value:\n * returns: v.union(v.object({ ... }), v.null())\n * ```\n *\n * @param members The validators to match against.\n */\n union: (...members) => {\n return new VUnion({\n isOptional: \"required\",\n members\n });\n },\n /**\n * A validator that accepts any Convex value without validation.\n *\n * Prefer using specific validators when possible for better type safety\n * and runtime validation.\n */\n any: () => {\n return new VAny({ isOptional: \"required\" });\n },\n /**\n * Makes a property optional in an object validator.\n *\n * An optional property can be omitted entirely when creating a document or\n * calling a function. This is different from `v.nullable()` which requires\n * the property to be present but allows `null`.\n *\n * @example\n * ```typescript\n * v.object({\n * name: v.string(), // required\n * nickname: v.optional(v.string()), // can be omitted\n * })\n *\n * // Valid: { name: \"Alice\" }\n * // Valid: { name: \"Alice\", nickname: \"Ali\" }\n * // Invalid: { name: \"Alice\", nickname: null } - use v.nullable() for this\n * ```\n *\n * @param value The property value validator to make optional.\n */\n optional: (value) => {\n return value.asOptional();\n },\n /**\n * Allows a value to be either the given type or `null`.\n *\n * This is shorthand for `v.union(value, v.null())`. Unlike `v.optional()`,\n * the property must still be present, but may be `null`.\n *\n * @example\n * ```typescript\n * v.object({\n * name: v.string(),\n * deletedAt: v.nullable(v.number()), // must be present, can be null\n * })\n *\n * // Valid: { name: \"Alice\", deletedAt: null }\n * // Valid: { name: \"Alice\", deletedAt: 1234567890 }\n * // Invalid: { name: \"Alice\" } - deletedAt is required\n * ```\n */\n nullable: (value) => {\n return v.union(value, v.null());\n }\n};\n//# sourceMappingURL=validator.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a, _b;\nimport { stringifyValueForError } from \"./value.js\";\nconst IDENTIFYING_FIELD = Symbol.for(\"ConvexError\");\nexport class ConvexError extends (_b = Error, _a = IDENTIFYING_FIELD, _b) {\n constructor(data) {\n super(typeof data === \"string\" ? data : stringifyValueForError(data));\n __publicField(this, \"name\", \"ConvexError\");\n __publicField(this, \"data\");\n __publicField(this, _a, true);\n this.data = data;\n }\n}\n//# sourceMappingURL=errors.js.map\n","\"use strict\";\nimport { CommitTsPlaceholder, MAX_INT64 } from \"./value.js\";\nimport { compareUTF8 } from \"./compare_utf8.js\";\nexport function compareValues(k1, k2) {\n return compareAsTuples(makeComparable(k1), makeComparable(k2));\n}\nfunction compareAsTuples(a, b) {\n if (a[0] === b[0]) {\n return compareSameTypeValues(a[1], b[1]);\n } else if (a[0] < b[0]) {\n return -1;\n }\n return 1;\n}\nfunction compareSameTypeValues(v1, v2) {\n if (v1 === void 0 || v1 === null) {\n return 0;\n }\n if (typeof v1 === \"number\") {\n if (typeof v2 !== \"number\") {\n throw new Error(`Unexpected type ${v2}`);\n }\n return compareNumbers(v1, v2);\n }\n if (typeof v1 === \"string\") {\n if (typeof v2 !== \"string\") {\n throw new Error(`Unexpected type ${v2}`);\n }\n return compareUTF8(v1, v2);\n }\n if (typeof v1 === \"bigint\" || typeof v1 === \"boolean\" || typeof v1 === \"string\") {\n return v1 < v2 ? -1 : v1 === v2 ? 0 : 1;\n }\n if (!Array.isArray(v1) || !Array.isArray(v2)) {\n throw new Error(`Unexpected type ${v1}`);\n }\n for (let i = 0; i < v1.length && i < v2.length; i++) {\n const cmp = compareAsTuples(v1[i], v2[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n if (v1.length < v2.length) {\n return -1;\n }\n if (v1.length > v2.length) {\n return 1;\n }\n return 0;\n}\nfunction compareNumbers(v1, v2) {\n if (isNaN(v1) || isNaN(v2)) {\n const buffer1 = new ArrayBuffer(8);\n const buffer2 = new ArrayBuffer(8);\n new DataView(buffer1).setFloat64(\n 0,\n v1,\n /* little-endian */\n true\n );\n new DataView(buffer2).setFloat64(\n 0,\n v2,\n /* little-endian */\n true\n );\n const v1Bits = BigInt(\n new DataView(buffer1).getBigInt64(\n 0,\n /* little-endian */\n true\n )\n );\n const v2Bits = BigInt(\n new DataView(buffer2).getBigInt64(\n 0,\n /* little-endian */\n true\n )\n );\n const v1Sign = (v1Bits & 0x8000000000000000n) !== 0n;\n const v2Sign = (v2Bits & 0x8000000000000000n) !== 0n;\n if (isNaN(v1) !== isNaN(v2)) {\n if (isNaN(v1)) {\n return v1Sign ? -1 : 1;\n }\n return v2Sign ? 1 : -1;\n }\n if (v1Sign !== v2Sign) {\n return v1Sign ? -1 : 1;\n }\n return v1Bits < v2Bits ? -1 : v1Bits === v2Bits ? 0 : 1;\n }\n if (Object.is(v1, v2)) {\n return 0;\n }\n if (Object.is(v1, -0)) {\n return Object.is(v2, 0) ? -1 : -Math.sign(v2);\n }\n if (Object.is(v2, -0)) {\n return Object.is(v1, 0) ? 1 : Math.sign(v1);\n }\n return v1 < v2 ? -1 : 1;\n}\nfunction makeComparable(v) {\n if (v === void 0) {\n return [0, void 0];\n }\n if (v === null) {\n return [1, null];\n }\n if (typeof v === \"bigint\") {\n return [2, v];\n }\n if (v instanceof CommitTsPlaceholder) {\n return [2, MAX_INT64];\n }\n if (typeof v === \"number\") {\n return [3, v];\n }\n if (typeof v === \"boolean\") {\n return [4, v];\n }\n if (typeof v === \"string\") {\n return [5, v];\n }\n if (v instanceof ArrayBuffer) {\n return [6, Array.from(new Uint8Array(v)).map(makeComparable)];\n }\n if (Array.isArray(v)) {\n return [7, v.map(makeComparable)];\n }\n const keys = Object.keys(v).sort();\n const pojo = keys.map((k) => [k, v[k]]);\n return [9, pojo.map(makeComparable)];\n}\n//# sourceMappingURL=compare.js.map\n","\"use strict\";\nimport { CommitTsPlaceholder } from \"./value.js\";\nimport { isSimpleObject } from \"../common/index.js\";\nexport function getConvexSize(value) {\n if (value === void 0) {\n return 0;\n }\n if (value === null) {\n return 1;\n }\n if (typeof value === \"boolean\") {\n return 1;\n }\n if (typeof value === \"bigint\") {\n return 9;\n }\n if (value instanceof CommitTsPlaceholder) {\n return 9;\n }\n if (typeof value === \"number\") {\n return 9;\n }\n if (typeof value === \"string\") {\n return 2 + getUtf8ByteLength(value);\n }\n if (value instanceof ArrayBuffer) {\n return 2 + value.byteLength;\n }\n if (Array.isArray(value)) {\n let size = 2;\n for (const element of value) {\n size += getConvexSize(element);\n }\n return size;\n }\n if (isSimpleObject(value)) {\n let size = 2;\n for (const [key, val] of Object.entries(value)) {\n if (val !== void 0) {\n size += getUtf8ByteLength(key) + 1 + getConvexSize(val);\n }\n }\n return size;\n }\n throw new Error(`Unsupported value type: ${typeof value}`);\n}\nconst UTF8_LENGTH_THRESHOLD = 500;\nfunction getUtf8ByteLength(str) {\n if (str.length > UTF8_LENGTH_THRESHOLD) {\n return new TextEncoder().encode(str).length;\n }\n let bytes = 0;\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n if (code < 128) {\n bytes += 1;\n } else if (code < 2048) {\n bytes += 2;\n } else if (code >= 55296 && code <= 56319) {\n bytes += 4;\n i++;\n } else {\n bytes += 3;\n }\n }\n return bytes;\n}\nexport const SYSTEM_FIELD_ID_ESTIMATE = 38;\nexport const SYSTEM_FIELD_CREATION_TIME_SIZE = 23;\nexport function getDocumentSize(value, options) {\n const baseSize = getConvexSize(value);\n const hasId = \"_id\" in value && value[\"_id\"] !== void 0;\n const hasCreationTime = \"_creationTime\" in value && value[\"_creationTime\"] !== void 0;\n if (hasId && hasCreationTime) {\n return baseSize;\n }\n let additionalSize = 0;\n if (!hasId) {\n if (options?.customIdLength) {\n additionalSize += options.customIdLength + 6;\n } else {\n additionalSize += SYSTEM_FIELD_ID_ESTIMATE;\n }\n }\n if (!hasCreationTime) {\n additionalSize += SYSTEM_FIELD_CREATION_TIME_SIZE;\n }\n return baseSize + additionalSize;\n}\n//# sourceMappingURL=size.js.map\n","\"use strict\";\nexport { convexToJson, jsonToConvex, CommitTsPlaceholder } from \"./value.js\";\nexport { v, asObjectValidator } from \"./validator.js\";\nimport * as Base64 from \"./base64.js\";\nexport { Base64 };\nexport * from \"./errors.js\";\nexport { compareValues } from \"./compare.js\";\nexport { getConvexSize, getDocumentSize } from \"./size.js\";\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nimport { convexToJson } from \"../../values/index.js\";\nexport function canonicalizeUdfPath(udfPath) {\n const pieces = udfPath.split(\":\");\n let moduleName;\n let functionName;\n if (pieces.length === 1) {\n moduleName = pieces[0];\n functionName = \"default\";\n } else {\n moduleName = pieces.slice(0, pieces.length - 1).join(\":\");\n functionName = pieces[pieces.length - 1];\n }\n if (moduleName.endsWith(\".js\")) {\n moduleName = moduleName.slice(0, -3);\n }\n return `${moduleName}:${functionName}`;\n}\nexport function serializePathAndArgs(udfPath, args) {\n return JSON.stringify({\n udfPath: canonicalizeUdfPath(udfPath),\n args: convexToJson(args)\n });\n}\nexport function serializePaginatedPathAndArgs(udfPath, args, options) {\n const { initialNumItems, id } = options;\n const result = JSON.stringify({\n type: \"paginated\",\n udfPath: canonicalizeUdfPath(udfPath),\n args: convexToJson(args),\n options: convexToJson({ initialNumItems, id })\n });\n return result;\n}\nexport function serializedQueryTokenIsPaginated(token) {\n return JSON.parse(token).type === \"paginated\";\n}\n//# sourceMappingURL=udf_path_utils.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { convexToJson } from \"../../values/index.js\";\nimport {\n canonicalizeUdfPath,\n serializePathAndArgs\n} from \"./udf_path_utils.js\";\nexport class LocalSyncState {\n constructor() {\n __publicField(this, \"nextQueryId\");\n __publicField(this, \"querySetVersion\");\n __publicField(this, \"querySet\");\n __publicField(this, \"queryIdToToken\");\n __publicField(this, \"identityVersion\");\n __publicField(this, \"auth\");\n __publicField(this, \"outstandingQueriesOlderThanRestart\");\n __publicField(this, \"outstandingAuthOlderThanRestart\");\n __publicField(this, \"paused\");\n __publicField(this, \"pendingQuerySetModifications\");\n this.nextQueryId = 0;\n this.querySetVersion = 0;\n this.identityVersion = 0;\n this.querySet = /* @__PURE__ */ new Map();\n this.queryIdToToken = /* @__PURE__ */ new Map();\n this.outstandingQueriesOlderThanRestart = /* @__PURE__ */ new Set();\n this.outstandingAuthOlderThanRestart = false;\n this.paused = false;\n this.pendingQuerySetModifications = /* @__PURE__ */ new Map();\n }\n hasSyncedPastLastReconnect() {\n return this.outstandingQueriesOlderThanRestart.size === 0 && !this.outstandingAuthOlderThanRestart;\n }\n markAuthCompletion() {\n this.outstandingAuthOlderThanRestart = false;\n }\n subscribe(udfPath, args, journal, componentPath) {\n const canonicalizedUdfPath = canonicalizeUdfPath(udfPath);\n const queryToken = serializePathAndArgs(canonicalizedUdfPath, args);\n const existingEntry = this.querySet.get(queryToken);\n if (existingEntry !== void 0) {\n existingEntry.numSubscribers += 1;\n return {\n queryToken,\n modification: null,\n unsubscribe: () => this.removeSubscriber(queryToken)\n };\n } else {\n const queryId = this.nextQueryId++;\n const query = {\n id: queryId,\n canonicalizedUdfPath,\n args,\n numSubscribers: 1,\n journal,\n componentPath\n };\n this.querySet.set(queryToken, query);\n this.queryIdToToken.set(queryId, queryToken);\n const baseVersion = this.querySetVersion;\n const newVersion = this.querySetVersion + 1;\n const add = {\n type: \"Add\",\n queryId,\n udfPath: canonicalizedUdfPath,\n args: [convexToJson(args)],\n journal,\n componentPath\n };\n if (this.paused) {\n this.pendingQuerySetModifications.set(queryId, add);\n } else {\n this.querySetVersion = newVersion;\n }\n const modification = {\n type: \"ModifyQuerySet\",\n baseVersion,\n newVersion,\n modifications: [add]\n };\n return {\n queryToken,\n modification,\n unsubscribe: () => this.removeSubscriber(queryToken)\n };\n }\n }\n transition(transition) {\n for (const modification of transition.modifications) {\n switch (modification.type) {\n case \"QueryUpdated\":\n case \"QueryFailed\": {\n this.outstandingQueriesOlderThanRestart.delete(modification.queryId);\n const journal = modification.journal;\n if (journal !== void 0) {\n const queryToken = this.queryIdToToken.get(modification.queryId);\n if (queryToken !== void 0) {\n this.querySet.get(queryToken).journal = journal;\n }\n }\n break;\n }\n case \"QueryRemoved\": {\n this.outstandingQueriesOlderThanRestart.delete(modification.queryId);\n break;\n }\n default: {\n modification;\n throw new Error(`Invalid modification ${modification.type}`);\n }\n }\n }\n }\n queryId(udfPath, args) {\n const canonicalizedUdfPath = canonicalizeUdfPath(udfPath);\n const queryToken = serializePathAndArgs(canonicalizedUdfPath, args);\n const existingEntry = this.querySet.get(queryToken);\n if (existingEntry !== void 0) {\n return existingEntry.id;\n }\n return null;\n }\n isCurrentOrNewerAuthVersion(version) {\n return version >= this.identityVersion;\n }\n getAuth() {\n return this.auth;\n }\n setAuth(value) {\n this.auth = {\n tokenType: \"User\",\n value\n };\n const baseVersion = this.identityVersion;\n if (!this.paused) {\n this.identityVersion = baseVersion + 1;\n }\n return {\n type: \"Authenticate\",\n baseVersion,\n ...this.auth\n };\n }\n setAdminAuth(value, actingAs) {\n const auth = {\n tokenType: \"Admin\",\n value,\n impersonating: actingAs\n };\n this.auth = auth;\n const baseVersion = this.identityVersion;\n if (!this.paused) {\n this.identityVersion = baseVersion + 1;\n }\n return {\n type: \"Authenticate\",\n baseVersion,\n ...auth\n };\n }\n clearAuth() {\n this.auth = void 0;\n this.markAuthCompletion();\n const baseVersion = this.identityVersion;\n if (!this.paused) {\n this.identityVersion = baseVersion + 1;\n }\n return {\n type: \"Authenticate\",\n tokenType: \"None\",\n baseVersion\n };\n }\n hasAuth() {\n return !!this.auth;\n }\n isNewAuth(value) {\n return this.auth?.value !== value;\n }\n queryPath(queryId) {\n const pathAndArgs = this.queryIdToToken.get(queryId);\n if (pathAndArgs) {\n return this.querySet.get(pathAndArgs).canonicalizedUdfPath;\n }\n return null;\n }\n queryArgs(queryId) {\n const pathAndArgs = this.queryIdToToken.get(queryId);\n if (pathAndArgs) {\n return this.querySet.get(pathAndArgs).args;\n }\n return null;\n }\n queryToken(queryId) {\n return this.queryIdToToken.get(queryId) ?? null;\n }\n queryJournal(queryToken) {\n return this.querySet.get(queryToken)?.journal;\n }\n restart() {\n this.unpause();\n this.outstandingQueriesOlderThanRestart.clear();\n const modifications = [];\n for (const localQuery of this.querySet.values()) {\n const add = {\n type: \"Add\",\n queryId: localQuery.id,\n udfPath: localQuery.canonicalizedUdfPath,\n args: [convexToJson(localQuery.args)],\n journal: localQuery.journal,\n componentPath: localQuery.componentPath\n };\n modifications.push(add);\n this.outstandingQueriesOlderThanRestart.add(localQuery.id);\n }\n this.querySetVersion = 1;\n const querySet = {\n type: \"ModifyQuerySet\",\n baseVersion: 0,\n newVersion: 1,\n modifications\n };\n if (!this.auth) {\n this.identityVersion = 0;\n return [querySet, void 0];\n }\n this.outstandingAuthOlderThanRestart = true;\n const authenticate = {\n type: \"Authenticate\",\n baseVersion: 0,\n ...this.auth\n };\n this.identityVersion = 1;\n return [querySet, authenticate];\n }\n pause() {\n this.paused = true;\n }\n resume() {\n const querySet = this.pendingQuerySetModifications.size > 0 ? {\n type: \"ModifyQuerySet\",\n baseVersion: this.querySetVersion,\n newVersion: ++this.querySetVersion,\n modifications: Array.from(\n this.pendingQuerySetModifications.values()\n )\n } : void 0;\n const authenticate = this.auth !== void 0 ? {\n type: \"Authenticate\",\n baseVersion: this.identityVersion++,\n ...this.auth\n } : void 0;\n this.unpause();\n return [querySet, authenticate];\n }\n unpause() {\n this.paused = false;\n this.pendingQuerySetModifications.clear();\n }\n removeSubscriber(queryToken) {\n const localQuery = this.querySet.get(queryToken);\n if (localQuery.numSubscribers > 1) {\n localQuery.numSubscribers -= 1;\n return null;\n } else {\n this.querySet.delete(queryToken);\n this.queryIdToToken.delete(localQuery.id);\n this.outstandingQueriesOlderThanRestart.delete(localQuery.id);\n const baseVersion = this.querySetVersion;\n const newVersion = this.querySetVersion + 1;\n const remove = {\n type: \"Remove\",\n queryId: localQuery.id\n };\n if (this.paused) {\n if (this.pendingQuerySetModifications.has(localQuery.id)) {\n this.pendingQuerySetModifications.delete(localQuery.id);\n } else {\n this.pendingQuerySetModifications.set(localQuery.id, remove);\n }\n } else {\n this.querySetVersion = newVersion;\n }\n return {\n type: \"ModifyQuerySet\",\n baseVersion,\n newVersion,\n modifications: [remove]\n };\n }\n }\n}\n//# sourceMappingURL=local_state.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { jsonToConvex } from \"../../values/index.js\";\nimport { logForFunction } from \"../logging.js\";\nexport class RequestManager {\n constructor(logger, markConnectionStateDirty) {\n this.logger = logger;\n this.markConnectionStateDirty = markConnectionStateDirty;\n __publicField(this, \"inflightRequests\");\n __publicField(this, \"requestsOlderThanRestart\");\n __publicField(this, \"inflightMutationsCount\", 0);\n __publicField(this, \"inflightActionsCount\", 0);\n this.inflightRequests = /* @__PURE__ */ new Map();\n this.requestsOlderThanRestart = /* @__PURE__ */ new Set();\n }\n request(message, sent) {\n const result = new Promise((resolve) => {\n const status = sent ? \"Requested\" : \"NotSent\";\n this.inflightRequests.set(message.requestId, {\n message,\n status: { status, requestedAt: /* @__PURE__ */ new Date(), onResult: resolve }\n });\n if (message.type === \"Mutation\") {\n this.inflightMutationsCount++;\n } else if (message.type === \"Action\") {\n this.inflightActionsCount++;\n }\n });\n this.markConnectionStateDirty();\n return result;\n }\n /**\n * Update the state after receiving a response.\n *\n * @returns A RequestId if the request is complete and its optimistic update\n * can be dropped, null otherwise.\n */\n onResponse(response) {\n const requestInfo = this.inflightRequests.get(response.requestId);\n if (requestInfo === void 0) {\n return null;\n }\n if (requestInfo.status.status === \"Completed\") {\n return null;\n }\n const udfType = requestInfo.message.type === \"Mutation\" ? \"mutation\" : \"action\";\n const udfPath = requestInfo.message.udfPath;\n for (const line of response.logLines) {\n logForFunction(this.logger, \"info\", udfType, udfPath, line);\n }\n const status = requestInfo.status;\n let result;\n let onResolve;\n if (response.success) {\n result = {\n success: true,\n logLines: response.logLines,\n value: jsonToConvex(response.result)\n };\n onResolve = () => status.onResult(result);\n } else {\n const errorMessage = response.result;\n const { errorData } = response;\n logForFunction(this.logger, \"error\", udfType, udfPath, errorMessage);\n result = {\n success: false,\n errorMessage,\n errorData: errorData !== void 0 ? jsonToConvex(errorData) : void 0,\n logLines: response.logLines\n };\n onResolve = () => status.onResult(result);\n }\n if (response.type === \"ActionResponse\" || !response.success) {\n onResolve();\n this.inflightRequests.delete(response.requestId);\n this.requestsOlderThanRestart.delete(response.requestId);\n if (requestInfo.message.type === \"Action\") {\n this.inflightActionsCount--;\n } else if (requestInfo.message.type === \"Mutation\") {\n this.inflightMutationsCount--;\n }\n this.markConnectionStateDirty();\n return { requestId: response.requestId, result };\n }\n requestInfo.status = {\n status: \"Completed\",\n result,\n ts: response.ts,\n onResolve\n };\n return null;\n }\n // Remove and returns completed requests.\n removeCompleted(ts) {\n const completeRequests = /* @__PURE__ */ new Map();\n for (const [requestId, requestInfo] of this.inflightRequests.entries()) {\n const status = requestInfo.status;\n if (status.status === \"Completed\" && status.ts.lessThanOrEqual(ts)) {\n status.onResolve();\n completeRequests.set(requestId, status.result);\n if (requestInfo.message.type === \"Mutation\") {\n this.inflightMutationsCount--;\n } else if (requestInfo.message.type === \"Action\") {\n this.inflightActionsCount--;\n }\n this.inflightRequests.delete(requestId);\n this.requestsOlderThanRestart.delete(requestId);\n }\n }\n if (completeRequests.size > 0) {\n this.markConnectionStateDirty();\n }\n return completeRequests;\n }\n restart() {\n this.requestsOlderThanRestart = new Set(this.inflightRequests.keys());\n const allMessages = [];\n for (const [requestId, value] of this.inflightRequests) {\n if (value.status.status === \"NotSent\") {\n value.status.status = \"Requested\";\n allMessages.push(value.message);\n continue;\n }\n if (value.message.type === \"Mutation\") {\n allMessages.push(value.message);\n } else if (value.message.type === \"Action\") {\n this.inflightRequests.delete(requestId);\n this.requestsOlderThanRestart.delete(requestId);\n this.inflightActionsCount--;\n if (value.status.status === \"Completed\") {\n throw new Error(\"Action should never be in 'Completed' state\");\n }\n value.status.onResult({\n success: false,\n errorMessage: \"Connection lost while action was in flight\",\n logLines: []\n });\n }\n }\n this.markConnectionStateDirty();\n return allMessages;\n }\n resume() {\n const allMessages = [];\n for (const [, value] of this.inflightRequests) {\n if (value.status.status === \"NotSent\") {\n value.status.status = \"Requested\";\n allMessages.push(value.message);\n continue;\n }\n }\n return allMessages;\n }\n /**\n * @returns true if there are any requests that have been requested but have\n * not be completed yet.\n */\n hasIncompleteRequests() {\n for (const requestInfo of this.inflightRequests.values()) {\n if (requestInfo.status.status === \"Requested\") {\n return true;\n }\n }\n return false;\n }\n /**\n * @returns true if there are any inflight requests, including ones that have\n * completed on the server, but have not been applied.\n */\n hasInflightRequests() {\n return this.inflightRequests.size > 0;\n }\n /**\n * @returns true if there are any inflight requests, that have been hanging around\n * since prior to the most recent restart.\n */\n hasSyncedPastLastReconnect() {\n return this.requestsOlderThanRestart.size === 0;\n }\n timeOfOldestInflightRequest() {\n if (this.inflightRequests.size === 0) {\n return null;\n }\n let oldestInflightRequest = Date.now();\n for (const request of this.inflightRequests.values()) {\n if (request.status.status !== \"Completed\") {\n if (request.status.requestedAt.getTime() < oldestInflightRequest) {\n oldestInflightRequest = request.status.requestedAt.getTime();\n }\n }\n }\n return new Date(oldestInflightRequest);\n }\n /**\n * @returns The number of mutations currently in flight.\n */\n inflightMutations() {\n return this.inflightMutationsCount;\n }\n /**\n * @returns The number of actions currently in flight.\n */\n inflightActions() {\n return this.inflightActionsCount;\n }\n}\n//# sourceMappingURL=request_manager.js.map\n","\"use strict\";\nimport { functionName } from \"../functionName.js\";\nexport const toReferencePath = Symbol.for(\"toReferencePath\");\nexport function setReferencePath(obj, value) {\n obj[toReferencePath] = value;\n}\nexport function extractReferencePath(reference) {\n return reference[toReferencePath] ?? null;\n}\nexport function isFunctionHandle(s) {\n return s.startsWith(\"function://\");\n}\nexport function getFunctionAddress(functionReference) {\n let functionAddress;\n if (typeof functionReference === \"string\") {\n if (isFunctionHandle(functionReference)) {\n functionAddress = { functionHandle: functionReference };\n } else {\n functionAddress = { name: functionReference };\n }\n } else if (functionReference[functionName]) {\n functionAddress = { name: functionReference[functionName] };\n } else {\n const referencePath = extractReferencePath(functionReference);\n if (!referencePath) {\n throw new Error(`${functionReference} is not a functionReference`);\n }\n functionAddress = { reference: referencePath };\n }\n return functionAddress;\n}\n//# sourceMappingURL=paths.js.map\n","\"use strict\";\nimport { functionName } from \"./functionName.js\";\nimport { getFunctionAddress } from \"./components/paths.js\";\nexport function getFunctionName(functionReference) {\n const address = getFunctionAddress(functionReference);\n if (address.name === void 0) {\n if (address.functionHandle !== void 0) {\n throw new Error(\n `Expected function reference like \"api.file.func\" or \"internal.file.func\", but received function handle ${address.functionHandle}`\n );\n } else if (address.reference !== void 0) {\n throw new Error(\n `Expected function reference in the current component like \"api.file.func\" or \"internal.file.func\", but received reference ${address.reference}`\n );\n }\n throw new Error(\n `Expected function reference like \"api.file.func\" or \"internal.file.func\", but received ${JSON.stringify(address)}`\n );\n }\n if (typeof functionReference === \"string\") return functionReference;\n const name = functionReference[functionName];\n if (!name) {\n throw new Error(`${functionReference} is not a functionReference`);\n }\n return name;\n}\nexport function makeFunctionReference(name) {\n return { [functionName]: name };\n}\nfunction createApi(pathParts = []) {\n const handler = {\n get(_, prop) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createApi(newParts);\n } else if (prop === functionName) {\n if (pathParts.length < 2) {\n const found = [\"api\", ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`api.moduleName.functionName\\`. Found: \\`${found}\\``\n );\n }\n const path = pathParts.slice(0, -1).join(\"/\");\n const exportName = pathParts[pathParts.length - 1];\n if (exportName === \"default\") {\n return path;\n } else {\n return path + \":\" + exportName;\n }\n } else if (prop === Symbol.toStringTag) {\n return \"FunctionReference\";\n } else {\n return void 0;\n }\n }\n };\n return new Proxy({}, handler);\n}\nexport function filterApi(api) {\n return api;\n}\nexport function justInternal(api) {\n return api;\n}\nexport function justPublic(api) {\n return api;\n}\nexport function justQueries(api) {\n return api;\n}\nexport function justMutations(api) {\n return api;\n}\nexport function justActions(api) {\n return api;\n}\nexport function justPaginatedQueries(api) {\n return api;\n}\nexport function justSchedulable(api) {\n return api;\n}\nexport const anyApi = createApi();\n//# sourceMappingURL=api.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport {\n getFunctionName\n} from \"../../server/api.js\";\nimport { parseArgs } from \"../../common/index.js\";\nimport { createHybridErrorStacktrace, forwardData } from \"../logging.js\";\nimport {\n canonicalizeUdfPath,\n serializePathAndArgs\n} from \"./udf_path_utils.js\";\nimport { ConvexError } from \"../../values/errors.js\";\nclass OptimisticLocalStoreImpl {\n constructor(queryResults) {\n // A references of the query results in OptimisticQueryResults\n __publicField(this, \"queryResults\");\n // All of the queries modified by this class\n __publicField(this, \"modifiedQueries\");\n this.queryResults = queryResults;\n this.modifiedQueries = [];\n }\n getQuery(query, ...args) {\n const queryArgs = parseArgs(args[0]);\n const name = getFunctionName(query);\n const queryResult = this.queryResults.get(\n serializePathAndArgs(name, queryArgs)\n );\n if (queryResult === void 0) {\n return void 0;\n }\n return OptimisticLocalStoreImpl.queryValue(queryResult.result);\n }\n getAllQueries(query) {\n const queriesWithName = [];\n const name = getFunctionName(query);\n for (const queryResult of this.queryResults.values()) {\n if (queryResult.udfPath === canonicalizeUdfPath(name)) {\n queriesWithName.push({\n args: queryResult.args,\n value: OptimisticLocalStoreImpl.queryValue(queryResult.result)\n });\n }\n }\n return queriesWithName;\n }\n setQuery(queryReference, args, value) {\n const queryArgs = parseArgs(args);\n const name = getFunctionName(queryReference);\n const queryToken = serializePathAndArgs(name, queryArgs);\n let result;\n if (value === void 0) {\n result = void 0;\n } else {\n result = {\n success: true,\n value,\n // It's an optimistic update, so there are no function logs to show.\n logLines: []\n };\n }\n const query = {\n udfPath: name,\n args: queryArgs,\n result\n };\n this.queryResults.set(queryToken, query);\n this.modifiedQueries.push(queryToken);\n }\n static queryValue(result) {\n if (result === void 0) {\n return void 0;\n } else if (result.success) {\n return result.value;\n } else {\n return void 0;\n }\n }\n}\nexport class OptimisticQueryResults {\n constructor() {\n __publicField(this, \"queryResults\");\n __publicField(this, \"optimisticUpdates\");\n this.queryResults = /* @__PURE__ */ new Map();\n this.optimisticUpdates = [];\n }\n /**\n * Apply all optimistic updates on top of server query results\n */\n ingestQueryResultsFromServer(serverQueryResults, optimisticUpdatesToDrop) {\n this.optimisticUpdates = this.optimisticUpdates.filter((updateAndId) => {\n return !optimisticUpdatesToDrop.has(updateAndId.mutationId);\n });\n const oldQueryResults = this.queryResults;\n this.queryResults = new Map(serverQueryResults);\n const localStore = new OptimisticLocalStoreImpl(this.queryResults);\n for (const updateAndId of this.optimisticUpdates) {\n updateAndId.update(localStore);\n }\n const changedQueries = [];\n for (const [queryToken, query] of this.queryResults) {\n const oldQuery = oldQueryResults.get(queryToken);\n if (oldQuery === void 0 || oldQuery.result !== query.result) {\n changedQueries.push(queryToken);\n }\n }\n return changedQueries;\n }\n applyOptimisticUpdate(update, mutationId) {\n this.optimisticUpdates.push({\n update,\n mutationId\n });\n const localStore = new OptimisticLocalStoreImpl(this.queryResults);\n update(localStore);\n return localStore.modifiedQueries;\n }\n /**\n * \"Raw\" with respect to errors vs values, but query results still have\n * optimistic updates applied.\n *\n * @internal\n */\n rawQueryResult(queryToken) {\n const query = this.queryResults.get(queryToken);\n if (query === void 0) {\n return void 0;\n }\n return query.result;\n }\n queryResult(queryToken) {\n const query = this.queryResults.get(queryToken);\n if (query === void 0) {\n return void 0;\n }\n const result = query.result;\n if (result === void 0) {\n return void 0;\n } else if (result.success) {\n return result.value;\n } else {\n if (result.errorData !== void 0) {\n throw forwardData(\n result,\n new ConvexError(\n createHybridErrorStacktrace(\"query\", query.udfPath, result)\n )\n );\n }\n throw new Error(\n createHybridErrorStacktrace(\"query\", query.udfPath, result)\n );\n }\n }\n hasQueryResult(queryToken) {\n return this.queryResults.get(queryToken) !== void 0;\n }\n /**\n * @internal\n */\n queryLogs(queryToken) {\n const query = this.queryResults.get(queryToken);\n return query?.result?.logLines;\n }\n}\n//# sourceMappingURL=optimistic_updates_impl.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { jsonToConvex } from \"../../values/index.js\";\nimport { Long } from \"../../vendor/long.js\";\nimport { logForFunction } from \"../logging.js\";\nexport class RemoteQuerySet {\n constructor(queryPath, logger) {\n __publicField(this, \"version\");\n __publicField(this, \"remoteQuerySet\");\n __publicField(this, \"queryPath\");\n __publicField(this, \"logger\");\n this.version = { querySet: 0, ts: Long.fromNumber(0), identity: 0 };\n this.remoteQuerySet = /* @__PURE__ */ new Map();\n this.queryPath = queryPath;\n this.logger = logger;\n }\n transition(transition) {\n const start = transition.startVersion;\n if (this.version.querySet !== start.querySet || this.version.ts.notEquals(start.ts) || this.version.identity !== start.identity) {\n throw new Error(\n `Invalid start version: ${start.ts.toString()}:${start.querySet}:${start.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`\n );\n }\n for (const modification of transition.modifications) {\n switch (modification.type) {\n case \"QueryUpdated\": {\n const queryPath = this.queryPath(modification.queryId);\n if (queryPath) {\n for (const line of modification.logLines) {\n logForFunction(this.logger, \"info\", \"query\", queryPath, line);\n }\n }\n const value = jsonToConvex(modification.value ?? null);\n this.remoteQuerySet.set(modification.queryId, {\n success: true,\n value,\n logLines: modification.logLines\n });\n break;\n }\n case \"QueryFailed\": {\n const queryPath = this.queryPath(modification.queryId);\n if (queryPath) {\n for (const line of modification.logLines) {\n logForFunction(this.logger, \"info\", \"query\", queryPath, line);\n }\n }\n const { errorData } = modification;\n this.remoteQuerySet.set(modification.queryId, {\n success: false,\n errorMessage: modification.errorMessage,\n errorData: errorData !== void 0 ? jsonToConvex(errorData) : void 0,\n logLines: modification.logLines\n });\n break;\n }\n case \"QueryRemoved\": {\n this.remoteQuerySet.delete(modification.queryId);\n break;\n }\n default: {\n modification;\n throw new Error(`Invalid modification ${modification.type}`);\n }\n }\n }\n this.version = transition.endVersion;\n }\n remoteQueryResults() {\n return this.remoteQuerySet;\n }\n timestamp() {\n return this.version.ts;\n }\n}\n//# sourceMappingURL=remote_query_set.js.map\n","\"use strict\";\nimport { Base64 } from \"../../values/index.js\";\nimport { Long } from \"../../vendor/long.js\";\nexport function u64ToLong(encoded) {\n const integerBytes = Base64.toByteArray(encoded);\n return Long.fromBytesLE(Array.from(integerBytes));\n}\nexport function longToU64(raw) {\n const integerBytes = new Uint8Array(raw.toBytesLE());\n return Base64.fromByteArray(integerBytes);\n}\nexport function parseServerMessage(encoded) {\n switch (encoded.type) {\n case \"FatalError\":\n case \"AuthError\":\n case \"ActionResponse\":\n case \"TransitionChunk\":\n case \"Ping\": {\n return { ...encoded };\n }\n case \"MutationResponse\": {\n if (encoded.success) {\n return { ...encoded, ts: u64ToLong(encoded.ts) };\n } else {\n return { ...encoded };\n }\n }\n case \"Transition\": {\n return {\n ...encoded,\n startVersion: {\n ...encoded.startVersion,\n ts: u64ToLong(encoded.startVersion.ts)\n },\n endVersion: {\n ...encoded.endVersion,\n ts: u64ToLong(encoded.endVersion.ts)\n }\n };\n }\n default: {\n encoded;\n }\n }\n return void 0;\n}\nexport function encodeClientMessage(message) {\n switch (message.type) {\n case \"Authenticate\":\n case \"ModifyQuerySet\":\n case \"Mutation\":\n case \"Action\":\n case \"Event\": {\n return { ...message };\n }\n case \"Connect\": {\n if (message.maxObservedTimestamp !== void 0) {\n return {\n ...message,\n maxObservedTimestamp: longToU64(message.maxObservedTimestamp)\n };\n } else {\n return { ...message, maxObservedTimestamp: void 0 };\n }\n }\n default: {\n message;\n }\n }\n return void 0;\n}\n//# sourceMappingURL=protocol.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport {\n encodeClientMessage,\n parseServerMessage\n} from \"./protocol.js\";\nconst CLOSE_NORMAL = 1e3;\nconst CLOSE_GOING_AWAY = 1001;\nconst CLOSE_NO_STATUS = 1005;\nconst CLOSE_NOT_FOUND = 4040;\nlet firstTime;\nfunction monotonicMillis() {\n if (firstTime === void 0) {\n firstTime = Date.now();\n }\n if (typeof performance === \"undefined\" || !performance.now) {\n return Date.now();\n }\n return Math.round(firstTime + performance.now());\n}\nfunction prettyNow() {\n return `t=${Math.round((monotonicMillis() - firstTime) / 100) / 10}s`;\n}\nconst serverDisconnectErrors = {\n // A known error, e.g. during a restart or push\n InternalServerError: { timeout: 1e3 },\n // ErrorMetadata::overloaded() messages that we realy should back off\n SubscriptionsWorkerFullError: { timeout: 3e3 },\n TooManyConcurrentRequests: { timeout: 3e3 },\n CommitterFullError: { timeout: 3e3 },\n AwsTooManyRequestsException: { timeout: 3e3 },\n ExecuteFullError: { timeout: 3e3 },\n SystemTimeoutError: { timeout: 3e3 },\n ExpiredInQueue: { timeout: 3e3 },\n // ErrorMetadata::feature_temporarily_unavailable() that typically indicate a deploy just happened\n VectorIndexesUnavailable: { timeout: 1e3 },\n SearchIndexesUnavailable: { timeout: 1e3 },\n TableSummariesUnavailable: { timeout: 1e3 },\n // More ErrorMetadata::overloaded()\n VectorIndexTooLarge: { timeout: 3e3 },\n SearchIndexTooLarge: { timeout: 3e3 },\n TooManyWritesInTimePeriod: { timeout: 3e3 }\n};\nfunction classifyDisconnectError(s) {\n if (s === void 0) return \"Unknown\";\n for (const prefix of Object.keys(\n serverDisconnectErrors\n )) {\n if (s.startsWith(prefix)) {\n return prefix;\n }\n }\n return \"Unknown\";\n}\nexport class WebSocketManager {\n constructor(uri, callbacks, webSocketConstructor, logger, markConnectionStateDirty, debug) {\n this.markConnectionStateDirty = markConnectionStateDirty;\n this.debug = debug;\n __publicField(this, \"socket\");\n __publicField(this, \"connectionCount\");\n __publicField(this, \"_hasEverConnected\", false);\n __publicField(this, \"lastCloseReason\");\n // State for assembling the split-up Transition currently being received.\n __publicField(this, \"transitionChunkBuffer\", null);\n /** Upon HTTPS/WSS failure, the first jittered backoff duration, in ms. */\n __publicField(this, \"defaultInitialBackoff\");\n /** We backoff exponentially, but we need to cap that--this is the jittered max. */\n __publicField(this, \"maxBackoff\");\n /** How many times have we failed consecutively? */\n __publicField(this, \"retries\");\n /** How long before lack of server response causes us to initiate a reconnect,\n * in ms */\n __publicField(this, \"serverInactivityThreshold\");\n __publicField(this, \"reconnectDueToServerInactivityTimeout\");\n /** Scheduled reconnect state: timeout handle and timing info */\n __publicField(this, \"scheduledReconnect\", null);\n __publicField(this, \"networkOnlineHandler\", null);\n /** Pending event to send after reconnecting due to network recovery */\n __publicField(this, \"pendingNetworkRecoveryInfo\", null);\n __publicField(this, \"uri\");\n __publicField(this, \"onOpen\");\n __publicField(this, \"onResume\");\n __publicField(this, \"onMessage\");\n __publicField(this, \"webSocketConstructor\");\n __publicField(this, \"logger\");\n __publicField(this, \"onServerDisconnectError\");\n this.webSocketConstructor = webSocketConstructor;\n this.socket = { state: \"disconnected\" };\n this.connectionCount = 0;\n this.lastCloseReason = \"InitialConnect\";\n this.defaultInitialBackoff = 1e3;\n this.maxBackoff = 16e3;\n this.retries = 0;\n this.serverInactivityThreshold = 6e4;\n this.reconnectDueToServerInactivityTimeout = null;\n this.uri = uri;\n this.onOpen = callbacks.onOpen;\n this.onResume = callbacks.onResume;\n this.onMessage = callbacks.onMessage;\n this.onServerDisconnectError = callbacks.onServerDisconnectError;\n this.logger = logger;\n this.setupNetworkListener();\n this.connect();\n }\n setSocketState(state) {\n this.socket = state;\n this._logVerbose(\n `socket state changed: ${this.socket.state}, paused: ${\"paused\" in this.socket ? this.socket.paused : void 0}`\n );\n this.markConnectionStateDirty();\n }\n setupNetworkListener() {\n if (typeof window === \"undefined\" || typeof window.addEventListener !== \"function\") {\n return;\n }\n if (this.networkOnlineHandler !== null) {\n return;\n }\n this.networkOnlineHandler = () => {\n this._logVerbose(\"network online event detected\");\n this.tryReconnectImmediately();\n };\n window.addEventListener(\"online\", this.networkOnlineHandler);\n this._logVerbose(\"network online event listener registered\");\n }\n cleanupNetworkListener() {\n if (this.networkOnlineHandler && typeof window !== \"undefined\" && typeof window.removeEventListener === \"function\") {\n window.removeEventListener(\"online\", this.networkOnlineHandler);\n this.networkOnlineHandler = null;\n this._logVerbose(\"network online event listener removed\");\n }\n }\n assembleTransition(chunk) {\n if (chunk.partNumber < 0 || chunk.partNumber >= chunk.totalParts || chunk.totalParts === 0 || this.transitionChunkBuffer && (this.transitionChunkBuffer.totalParts !== chunk.totalParts || this.transitionChunkBuffer.transitionId !== chunk.transitionId)) {\n this.transitionChunkBuffer = null;\n throw new Error(\"Invalid TransitionChunk\");\n }\n if (this.transitionChunkBuffer === null) {\n this.transitionChunkBuffer = {\n chunks: [],\n totalParts: chunk.totalParts,\n transitionId: chunk.transitionId\n };\n }\n if (chunk.partNumber !== this.transitionChunkBuffer.chunks.length) {\n const expectedLength = this.transitionChunkBuffer.chunks.length;\n this.transitionChunkBuffer = null;\n throw new Error(\n `TransitionChunk received out of order: expected part ${expectedLength}, got ${chunk.partNumber}`\n );\n }\n this.transitionChunkBuffer.chunks.push(chunk.chunk);\n if (this.transitionChunkBuffer.chunks.length === chunk.totalParts) {\n const fullJson = this.transitionChunkBuffer.chunks.join(\"\");\n this.transitionChunkBuffer = null;\n const transition = parseServerMessage(JSON.parse(fullJson));\n if (transition.type !== \"Transition\") {\n throw new Error(\n `Expected Transition, got ${transition.type} after assembling chunks`\n );\n }\n return transition;\n }\n return null;\n }\n connect() {\n if (this.socket.state === \"terminated\") {\n return;\n }\n if (this.socket.state !== \"disconnected\" && this.socket.state !== \"stopped\") {\n throw new Error(\n \"Didn't start connection from disconnected state: \" + this.socket.state\n );\n }\n const ws = new this.webSocketConstructor(this.uri);\n this._logVerbose(\"constructed WebSocket\");\n this.setSocketState({\n state: \"connecting\",\n ws,\n paused: \"no\"\n });\n this.resetServerInactivityTimeout();\n ws.onopen = () => {\n this.logger.logVerbose(\"begin ws.onopen\");\n if (this.socket.state !== \"connecting\") {\n throw new Error(\"onopen called with socket not in connecting state\");\n }\n this.setSocketState({\n state: \"ready\",\n ws,\n paused: this.socket.paused === \"yes\" ? \"uninitialized\" : \"no\"\n });\n this.resetServerInactivityTimeout();\n if (this.socket.paused === \"no\") {\n this._hasEverConnected = true;\n this.onOpen({\n connectionCount: this.connectionCount,\n lastCloseReason: this.lastCloseReason,\n clientTs: monotonicMillis()\n });\n }\n if (this.lastCloseReason !== \"InitialConnect\") {\n if (this.lastCloseReason) {\n this.logger.log(\n \"WebSocket reconnected at\",\n prettyNow(),\n \"after disconnect due to\",\n this.lastCloseReason\n );\n } else {\n this.logger.log(\"WebSocket reconnected at\", prettyNow());\n }\n }\n this.connectionCount += 1;\n this.lastCloseReason = null;\n if (this.pendingNetworkRecoveryInfo !== null) {\n const { timeSavedMs } = this.pendingNetworkRecoveryInfo;\n this.pendingNetworkRecoveryInfo = null;\n this.sendMessage({\n type: \"Event\",\n eventType: \"NetworkRecoveryReconnect\",\n event: { timeSavedMs }\n });\n this.logger.log(\n `Network recovery reconnect saved ~${Math.round(timeSavedMs / 1e3)}s of waiting`\n );\n }\n };\n ws.onerror = (error) => {\n this.transitionChunkBuffer = null;\n const message = error.message;\n if (message) {\n this.logger.log(`WebSocket error message: ${message}`);\n }\n };\n ws.onmessage = (message) => {\n this.resetServerInactivityTimeout();\n const messageLength = message.data.length;\n let serverMessage = parseServerMessage(JSON.parse(message.data));\n this._logVerbose(`received ws message with type ${serverMessage.type}`);\n if (serverMessage.type === \"Ping\") {\n return;\n }\n if (serverMessage.type === \"TransitionChunk\") {\n const transition = this.assembleTransition(serverMessage);\n if (!transition) {\n return;\n }\n serverMessage = transition;\n this._logVerbose(\n `assembled full ws message of type ${serverMessage.type}`\n );\n }\n if (this.transitionChunkBuffer !== null) {\n this.transitionChunkBuffer = null;\n this.logger.log(\n `Received unexpected ${serverMessage.type} while buffering TransitionChunks`\n );\n }\n if (serverMessage.type === \"Transition\") {\n this.reportLargeTransition({\n messageLength,\n transition: serverMessage\n });\n }\n const response = this.onMessage(serverMessage);\n if (response.hasSyncedPastLastReconnect) {\n this.retries = 0;\n this.markConnectionStateDirty();\n }\n };\n ws.onclose = (event) => {\n this._logVerbose(\"begin ws.onclose\");\n this.transitionChunkBuffer = null;\n if (this.lastCloseReason === null) {\n this.lastCloseReason = event.reason || `closed with code ${event.code}`;\n }\n if (event.code !== CLOSE_NORMAL && event.code !== CLOSE_GOING_AWAY && // This commonly gets fired on mobile apps when the app is backgrounded\n event.code !== CLOSE_NO_STATUS && event.code !== CLOSE_NOT_FOUND) {\n let msg = `WebSocket closed with code ${event.code}`;\n if (event.reason) {\n msg += `: ${event.reason}`;\n }\n this.logger.log(msg);\n if (this.onServerDisconnectError && event.reason) {\n this.onServerDisconnectError(msg);\n }\n }\n const reason = classifyDisconnectError(event.reason);\n this.scheduleReconnect(reason);\n return;\n };\n }\n /**\n * @returns The state of the {@link Socket}.\n */\n socketState() {\n return this.socket.state;\n }\n /**\n * @param message - A ClientMessage to send.\n * @returns Whether the message (might have been) sent.\n */\n sendMessage(message) {\n const messageForLog = {\n type: message.type,\n ...message.type === \"Authenticate\" && message.tokenType === \"User\" ? {\n value: `...${message.value.slice(-7)}`\n } : {}\n };\n if (this.socket.state === \"ready\" && this.socket.paused === \"no\") {\n const encodedMessage = encodeClientMessage(message);\n const request = JSON.stringify(encodedMessage);\n let sent = false;\n try {\n this.socket.ws.send(request);\n sent = true;\n } catch (error) {\n this.logger.log(\n `Failed to send message on WebSocket, reconnecting: ${error}`\n );\n this.closeAndReconnect(\"FailedToSendMessage\");\n }\n this._logVerbose(\n `${sent ? \"sent\" : \"failed to send\"} message with type ${message.type}: ${JSON.stringify(\n messageForLog\n )}`\n );\n return true;\n }\n this._logVerbose(\n `message not sent (socket state: ${this.socket.state}, paused: ${\"paused\" in this.socket ? this.socket.paused : void 0}): ${JSON.stringify(\n messageForLog\n )}`\n );\n return false;\n }\n resetServerInactivityTimeout() {\n if (this.socket.state === \"terminated\") {\n return;\n }\n if (this.reconnectDueToServerInactivityTimeout !== null) {\n clearTimeout(this.reconnectDueToServerInactivityTimeout);\n this.reconnectDueToServerInactivityTimeout = null;\n }\n this.reconnectDueToServerInactivityTimeout = setTimeout(() => {\n this.closeAndReconnect(\"InactiveServer\");\n }, this.serverInactivityThreshold);\n }\n scheduleReconnect(reason) {\n if (this.scheduledReconnect) {\n clearTimeout(this.scheduledReconnect.timeout);\n this.scheduledReconnect = null;\n }\n this.socket = { state: \"disconnected\" };\n const backoff = this.nextBackoff(reason);\n this.markConnectionStateDirty();\n this.logger.log(`Attempting reconnect in ${Math.round(backoff)}ms`);\n const scheduledAt = monotonicMillis();\n const timeoutId = setTimeout(() => {\n if (this.scheduledReconnect?.timeout === timeoutId) {\n this.scheduledReconnect = null;\n this.connect();\n }\n }, backoff);\n this.scheduledReconnect = {\n timeout: timeoutId,\n scheduledAt,\n backoffMs: backoff\n };\n }\n /**\n * Close the WebSocket and schedule a reconnect.\n *\n * This should be used when we hit an error and would like to restart the session.\n */\n closeAndReconnect(closeReason) {\n this._logVerbose(`begin closeAndReconnect with reason ${closeReason}`);\n switch (this.socket.state) {\n case \"disconnected\":\n case \"terminated\":\n case \"stopped\":\n return;\n case \"connecting\":\n case \"ready\": {\n this.lastCloseReason = closeReason;\n void this.close();\n this.scheduleReconnect(\"client\");\n return;\n }\n default: {\n this.socket;\n }\n }\n }\n /**\n * Close the WebSocket, being careful to clear the onclose handler to avoid re-entrant\n * calls. Use this instead of directly calling `ws.close()`\n *\n * It is the callers responsibility to update the state after this method is called so that the\n * closed socket is not accessible or used again after this method is called\n */\n close() {\n this.transitionChunkBuffer = null;\n switch (this.socket.state) {\n case \"disconnected\":\n case \"terminated\":\n case \"stopped\":\n return Promise.resolve();\n case \"connecting\": {\n const ws = this.socket.ws;\n ws.onmessage = (_message) => {\n this._logVerbose(\"Ignoring message received after close\");\n };\n return new Promise((r) => {\n ws.onclose = () => {\n this._logVerbose(\"Closed after connecting\");\n r();\n };\n ws.onopen = () => {\n this._logVerbose(\"Opened after connecting\");\n ws.close();\n };\n });\n }\n case \"ready\": {\n this._logVerbose(\"ws.close called\");\n const ws = this.socket.ws;\n ws.onmessage = (_message) => {\n this._logVerbose(\"Ignoring message received after close\");\n };\n const result = new Promise((r) => {\n ws.onclose = () => {\n r();\n };\n });\n ws.close();\n return result;\n }\n default: {\n this.socket;\n return Promise.resolve();\n }\n }\n }\n /**\n * Close the WebSocket and do not reconnect.\n * @returns A Promise that resolves when the WebSocket `onClose` callback is called.\n */\n terminate() {\n if (this.reconnectDueToServerInactivityTimeout) {\n clearTimeout(this.reconnectDueToServerInactivityTimeout);\n }\n if (this.scheduledReconnect) {\n clearTimeout(this.scheduledReconnect.timeout);\n this.scheduledReconnect = null;\n }\n this.cleanupNetworkListener();\n switch (this.socket.state) {\n case \"terminated\":\n case \"stopped\":\n case \"disconnected\":\n case \"connecting\":\n case \"ready\": {\n const result = this.close();\n this.setSocketState({ state: \"terminated\" });\n return result;\n }\n default: {\n this.socket;\n throw new Error(\n `Invalid websocket state: ${this.socket.state}`\n );\n }\n }\n }\n stop() {\n switch (this.socket.state) {\n case \"terminated\":\n return Promise.resolve();\n case \"connecting\":\n case \"stopped\":\n case \"disconnected\":\n case \"ready\": {\n this.cleanupNetworkListener();\n const result = this.close();\n this.socket = { state: \"stopped\" };\n return result;\n }\n default: {\n this.socket;\n return Promise.resolve();\n }\n }\n }\n /**\n * Create a new WebSocket after a previous `stop()`, unless `terminate()` was\n * called before.\n */\n tryRestart() {\n switch (this.socket.state) {\n case \"stopped\":\n break;\n case \"terminated\":\n case \"connecting\":\n case \"ready\":\n case \"disconnected\":\n this.logger.logVerbose(\"Restart called without stopping first\");\n return;\n default: {\n this.socket;\n }\n }\n this.setupNetworkListener();\n this.connect();\n }\n pause() {\n switch (this.socket.state) {\n case \"disconnected\":\n case \"stopped\":\n case \"terminated\":\n return;\n case \"connecting\":\n case \"ready\": {\n this.socket = { ...this.socket, paused: \"yes\" };\n return;\n }\n default: {\n this.socket;\n return;\n }\n }\n }\n /**\n * Try to reconnect immediately, canceling any scheduled reconnect.\n * This is useful when detecting network recovery.\n * Only takes action if we're in disconnected state (waiting to reconnect).\n */\n tryReconnectImmediately() {\n this._logVerbose(\"tryReconnectImmediately called\");\n if (this.socket.state !== \"disconnected\") {\n this._logVerbose(\n `tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`\n );\n return;\n }\n let timeSavedMs = null;\n if (this.scheduledReconnect) {\n const elapsed = monotonicMillis() - this.scheduledReconnect.scheduledAt;\n timeSavedMs = Math.max(0, this.scheduledReconnect.backoffMs - elapsed);\n this._logVerbose(\n `would have waited ${Math.round(timeSavedMs)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(elapsed)}ms)`\n );\n clearTimeout(this.scheduledReconnect.timeout);\n this.scheduledReconnect = null;\n this._logVerbose(\"canceled scheduled reconnect\");\n }\n this.logger.log(\"Network recovery detected, reconnecting immediately\");\n this.pendingNetworkRecoveryInfo = timeSavedMs !== null ? { timeSavedMs } : null;\n this.connect();\n }\n /**\n * Resume the state machine if previously paused.\n */\n resume() {\n switch (this.socket.state) {\n case \"connecting\":\n this.socket = { ...this.socket, paused: \"no\" };\n return;\n case \"ready\":\n if (this.socket.paused === \"uninitialized\") {\n this.socket = { ...this.socket, paused: \"no\" };\n this._hasEverConnected = true;\n this.onOpen({\n connectionCount: this.connectionCount,\n lastCloseReason: this.lastCloseReason,\n clientTs: monotonicMillis()\n });\n } else if (this.socket.paused === \"yes\") {\n this.socket = { ...this.socket, paused: \"no\" };\n this.onResume();\n }\n return;\n case \"terminated\":\n case \"stopped\":\n case \"disconnected\":\n return;\n default: {\n this.socket;\n }\n }\n this.connect();\n }\n connectionState() {\n return {\n isConnected: this.socket.state === \"ready\",\n hasEverConnected: this._hasEverConnected,\n connectionCount: this.connectionCount,\n connectionRetries: this.retries\n };\n }\n _logVerbose(message) {\n this.logger.logVerbose(message);\n }\n nextBackoff(reason) {\n const initialBackoff = reason === \"client\" ? 100 : reason === \"Unknown\" ? this.defaultInitialBackoff : serverDisconnectErrors[reason].timeout;\n const baseBackoff = initialBackoff * Math.pow(2, this.retries);\n this.retries += 1;\n const actualBackoff = Math.min(baseBackoff, this.maxBackoff);\n const jitter = actualBackoff * (Math.random() - 0.5);\n return actualBackoff + jitter;\n }\n reportLargeTransition({\n transition,\n messageLength\n }) {\n if (transition.clientClockSkew === void 0 || transition.serverTs === void 0) {\n return;\n }\n const transitionTransitTime = monotonicMillis() - // client time now\n // clientClockSkew = (server time + upstream latency) - client time\n // clientClockSkew is \"how many milliseconds behind (slow) is the client clock\"\n // but the latency of the Connect message inflates this, making it appear further behind\n transition.clientClockSkew - transition.serverTs / 1e6;\n const prettyTransitionTime = `${Math.round(transitionTransitTime)}ms`;\n const prettyMessageMB = `${Math.round(messageLength / 1e4) / 100}MB`;\n const bytesPerSecond = messageLength / (transitionTransitTime / 1e3);\n const prettyBytesPerSecond = `${Math.round(bytesPerSecond / 1e4) / 100}MB per second`;\n this._logVerbose(\n `received ${prettyMessageMB} transition in ${prettyTransitionTime} at ${prettyBytesPerSecond}`\n );\n if (messageLength > 2e7) {\n this.logger.log(\n `received query results totaling more that 20MB (${prettyMessageMB}) which will take a long time to download on slower connections`\n );\n } else if (transitionTransitTime > 2e4) {\n this.logger.log(\n `received query results totaling ${prettyMessageMB} which took more than 20s to arrive (${prettyTransitionTime})`\n );\n }\n if (this.debug) {\n this.sendMessage({\n type: \"Event\",\n eventType: \"ClientReceivedTransition\",\n event: { transitionTransitTime, messageLength }\n });\n }\n }\n}\n//# sourceMappingURL=web_socket_manager.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { jwtDecode } from \"../../vendor/jwt-decode/index.js\";\nconst MAXIMUM_REFRESH_DELAY = 20 * 24 * 60 * 60 * 1e3;\nconst MAX_TOKEN_CONFIRMATION_ATTEMPTS = 2;\nexport class AuthenticationManager {\n constructor(syncState, callbacks, config) {\n __publicField(this, \"authState\", { state: \"noAuth\" });\n // Used to detect races involving `setConfig` calls\n // while a token is being fetched.\n __publicField(this, \"configVersion\", 0);\n // Shared by the BaseClient so that the auth manager can easily inspect it\n __publicField(this, \"syncState\");\n // Passed down by BaseClient, sends a message to the server\n __publicField(this, \"authenticate\");\n __publicField(this, \"stopSocket\");\n __publicField(this, \"tryRestartSocket\");\n __publicField(this, \"pauseSocket\");\n __publicField(this, \"resumeSocket\");\n // Passed down by BaseClient, sends a message to the server\n __publicField(this, \"clearAuth\");\n __publicField(this, \"logger\");\n __publicField(this, \"refreshTokenLeewaySeconds\");\n __publicField(this, \"initialAuthTokenReuse\");\n // Track last value to avoid redundant calls\n __publicField(this, \"lastRefreshChange\");\n // Number of times we have attempted to confirm the latest token. We retry up\n // to `MAX_TOKEN_CONFIRMATION_ATTEMPTS` times.\n __publicField(this, \"tokenConfirmationAttempts\", 0);\n this.syncState = syncState;\n this.authenticate = callbacks.authenticate;\n this.stopSocket = callbacks.stopSocket;\n this.tryRestartSocket = callbacks.tryRestartSocket;\n this.pauseSocket = callbacks.pauseSocket;\n this.resumeSocket = callbacks.resumeSocket;\n this.clearAuth = callbacks.clearAuth;\n this.logger = config.logger;\n this.refreshTokenLeewaySeconds = config.refreshTokenLeewaySeconds;\n this.initialAuthTokenReuse = config.initialAuthTokenReuse;\n this.lastRefreshChange = false;\n }\n notifyRefreshChange(isRefreshing) {\n if (this.authState.state !== \"noAuth\" && this.authState.state !== \"initialRefetch\" && this.authState.config.onRefreshChange && this.lastRefreshChange !== isRefreshing) {\n this.lastRefreshChange = isRefreshing;\n this.authState.config.onRefreshChange(isRefreshing);\n }\n }\n async setConfig(fetchToken, onChange, onRefreshChange) {\n this.resetAuthState();\n this._logVerbose(\"pausing WS for auth token fetch\");\n this.pauseSocket();\n const token = await this.fetchTokenAndGuardAgainstRace(fetchToken, {\n forceRefreshToken: false\n });\n if (token.isFromOutdatedConfig) {\n return;\n }\n const config = {\n fetchToken,\n onAuthChange: onChange,\n onRefreshChange\n };\n if (token.value) {\n this.setAuthState({\n state: \"waitingForServerConfirmationOfCachedToken\",\n config,\n hasRetried: false\n });\n this.authenticate(token.value);\n } else {\n this.setAuthState({\n state: \"initialRefetch\",\n config\n });\n await this.refetchToken();\n }\n this._logVerbose(\"resuming WS after auth token fetch\");\n this.resumeSocket();\n }\n onTransition(serverMessage) {\n if (!this.syncState.isCurrentOrNewerAuthVersion(\n serverMessage.endVersion.identity\n )) {\n return;\n }\n if (serverMessage.endVersion.identity <= serverMessage.startVersion.identity) {\n return;\n }\n this._logVerbose(\n `auth state is ${this.authState.state} when handling transition`\n );\n this.syncState.markAuthCompletion();\n if (this.authState.state === \"waitingForServerConfirmationOfCachedToken\") {\n this._logVerbose(\"server confirmed auth token is valid\");\n const cachedToken = this.syncState.getAuth()?.value;\n if (this.initialAuthTokenReuse && cachedToken) {\n this.scheduleTokenRefetch(cachedToken, serverMessage.clientClockSkew);\n } else {\n void this.refetchToken();\n }\n this.authState.config.onAuthChange(true);\n return;\n }\n if (this.authState.state === \"waitingForServerConfirmationOfFreshToken\") {\n this._logVerbose(\"server confirmed new auth token is valid\");\n this.notifyRefreshChange(false);\n this.scheduleTokenRefetch(this.authState.token);\n this.tokenConfirmationAttempts = 0;\n if (!this.authState.hadAuth) {\n this.authState.config.onAuthChange(true);\n }\n }\n }\n onAuthError(serverMessage) {\n if (serverMessage.authUpdateAttempted === false && (this.authState.state === \"waitingForServerConfirmationOfFreshToken\" || this.authState.state === \"waitingForServerConfirmationOfCachedToken\")) {\n this._logVerbose(\"ignoring non-auth token expired error\");\n return;\n }\n const { baseVersion } = serverMessage;\n if (!this.syncState.isCurrentOrNewerAuthVersion(baseVersion + 1)) {\n this._logVerbose(\"ignoring auth error for previous auth attempt\");\n return;\n }\n void this.tryToReauthenticate(serverMessage);\n return;\n }\n // This is similar to `refetchToken` defined below, in fact we\n // don't represent them as different states, but it is different\n // in that we pause the WebSocket so that mutations\n // don't retry with bad auth.\n async tryToReauthenticate(serverMessage) {\n this._logVerbose(`attempting to reauthenticate: ${serverMessage.error}`);\n if (\n // No way to fetch another token, kaboom\n this.authState.state === \"noAuth\" || // We failed on a fresh token. After a small number of retries, we give up\n // and clear the auth state to avoid infinite retries.\n this.authState.state === \"waitingForServerConfirmationOfFreshToken\" && this.tokenConfirmationAttempts >= MAX_TOKEN_CONFIRMATION_ATTEMPTS\n ) {\n this.logger.error(\n `Failed to authenticate: \"${serverMessage.error}\", check your server auth config`\n );\n if (this.syncState.hasAuth()) {\n this.syncState.clearAuth();\n }\n if (this.authState.state !== \"noAuth\") {\n this.setAndReportAuthFailed(this.authState.config.onAuthChange);\n }\n return;\n }\n if (this.authState.state === \"waitingForServerConfirmationOfFreshToken\") {\n this.tokenConfirmationAttempts++;\n this._logVerbose(\n `retrying reauthentication, ${MAX_TOKEN_CONFIRMATION_ATTEMPTS - this.tokenConfirmationAttempts} attempts remaining`\n );\n }\n this.notifyRefreshChange(true);\n await this.stopSocket();\n if (this.authState.state === \"noAuth\") {\n return;\n }\n const token = await this.fetchTokenAndGuardAgainstRace(\n this.authState.config.fetchToken,\n {\n forceRefreshToken: true\n }\n );\n if (token.isFromOutdatedConfig) {\n return;\n }\n if (token.value && this.syncState.isNewAuth(token.value)) {\n this.authenticate(token.value);\n this.setAuthState({\n state: \"waitingForServerConfirmationOfFreshToken\",\n config: this.authState.config,\n token: token.value,\n hadAuth: this.authState.state === \"notRefetching\" || this.authState.state === \"waitingForScheduledRefetch\"\n });\n } else {\n this._logVerbose(\"reauthentication failed, could not fetch a new token\");\n if (this.syncState.hasAuth()) {\n this.syncState.clearAuth();\n }\n this.setAndReportAuthFailed(this.authState.config.onAuthChange);\n }\n this.tryRestartSocket();\n }\n // Force refetch the token and schedule another refetch\n // before the token expires - an active client should never\n // need to reauthenticate.\n async refetchToken() {\n if (this.authState.state === \"noAuth\") {\n return;\n }\n this._logVerbose(\"refetching auth token\");\n const token = await this.fetchTokenAndGuardAgainstRace(\n this.authState.config.fetchToken,\n {\n forceRefreshToken: true\n }\n );\n if (token.isFromOutdatedConfig) {\n return;\n }\n if (token.value) {\n if (this.syncState.isNewAuth(token.value)) {\n this.setAuthState({\n state: \"waitingForServerConfirmationOfFreshToken\",\n hadAuth: this.syncState.hasAuth(),\n token: token.value,\n config: this.authState.config\n });\n this.authenticate(token.value);\n } else {\n this.setAuthState({\n state: \"notRefetching\",\n config: this.authState.config\n });\n }\n } else {\n this._logVerbose(\"refetching token failed\");\n if (this.syncState.hasAuth()) {\n this.clearAuth();\n }\n this.setAndReportAuthFailed(this.authState.config.onAuthChange);\n }\n this._logVerbose(\n \"restarting WS after auth token fetch (if currently stopped)\"\n );\n this.tryRestartSocket();\n }\n scheduleTokenRefetch(token, clientClockSkewMs) {\n if (this.authState.state === \"noAuth\") {\n return;\n }\n const decodedToken = this.decodeToken(token);\n if (!decodedToken) {\n this.logger.error(\n \"Auth token is not a valid JWT, cannot refetch the token\"\n );\n return;\n }\n const { iat, exp } = decodedToken;\n if (!iat || !exp) {\n this.logger.error(\n \"Auth token does not have required fields, cannot refetch the token\"\n );\n return;\n }\n const fullLifetimeSeconds = exp - iat;\n if (fullLifetimeSeconds <= 2) {\n this.logger.error(\n \"Auth token does not live long enough, cannot refetch the token\"\n );\n return;\n }\n let tokenValiditySeconds;\n if (clientClockSkewMs !== void 0) {\n const estimatedServerNowSeconds = (Date.now() - clientClockSkewMs) / 1e3;\n tokenValiditySeconds = exp - estimatedServerNowSeconds;\n if (tokenValiditySeconds <= 0) {\n tokenValiditySeconds = 0;\n }\n } else {\n tokenValiditySeconds = fullLifetimeSeconds;\n }\n let delay = Math.min(\n MAXIMUM_REFRESH_DELAY,\n (tokenValiditySeconds - this.refreshTokenLeewaySeconds) * 1e3\n );\n if (delay <= 0) {\n this.logger.warn(\n `Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${tokenValiditySeconds}s`\n );\n delay = 0;\n }\n const refetchTokenTimeoutId = setTimeout(() => {\n this._logVerbose(\"running scheduled token refetch\");\n void this.refetchToken();\n }, delay);\n this.setAuthState({\n state: \"waitingForScheduledRefetch\",\n refetchTokenTimeoutId,\n config: this.authState.config\n });\n this._logVerbose(\n `scheduled preemptive auth token refetching in ${delay}ms`\n );\n }\n // Protects against simultaneous calls to `setConfig`\n // while we're fetching a token\n async fetchTokenAndGuardAgainstRace(fetchToken, fetchArgs) {\n const originalConfigVersion = ++this.configVersion;\n this._logVerbose(\n `fetching token with config version ${originalConfigVersion}`\n );\n const token = await fetchToken(fetchArgs);\n if (this.configVersion !== originalConfigVersion) {\n this._logVerbose(\n `stale config version, expected ${originalConfigVersion}, got ${this.configVersion}`\n );\n return { isFromOutdatedConfig: true };\n }\n return { isFromOutdatedConfig: false, value: token };\n }\n stop() {\n this.resetAuthState();\n this.configVersion++;\n this._logVerbose(`config version bumped to ${this.configVersion}`);\n }\n setAndReportAuthFailed(onAuthChange) {\n onAuthChange(false);\n this.resetAuthState();\n }\n // The sole path to `state === \"noAuth\"`; consumers rely on this firing\n // `notifyRefreshChange(false)` to pair any in-flight `(true)`. May run\n // when refresh state is already false.\n resetAuthState() {\n this.notifyRefreshChange(false);\n this.setAuthState({ state: \"noAuth\" });\n }\n setAuthState(newAuth) {\n const authStateForLog = newAuth.state === \"waitingForServerConfirmationOfFreshToken\" ? {\n hadAuth: newAuth.hadAuth,\n state: newAuth.state,\n token: `...${newAuth.token.slice(-7)}`\n } : { state: newAuth.state };\n this._logVerbose(\n `setting auth state to ${JSON.stringify(authStateForLog)}`\n );\n switch (newAuth.state) {\n case \"waitingForScheduledRefetch\":\n case \"notRefetching\":\n case \"noAuth\":\n this.tokenConfirmationAttempts = 0;\n break;\n case \"waitingForServerConfirmationOfFreshToken\":\n case \"waitingForServerConfirmationOfCachedToken\":\n case \"initialRefetch\":\n break;\n default: {\n newAuth;\n }\n }\n if (this.authState.state === \"waitingForScheduledRefetch\") {\n clearTimeout(this.authState.refetchTokenTimeoutId);\n }\n this.authState = newAuth;\n }\n decodeToken(token) {\n try {\n return jwtDecode(token);\n } catch (e) {\n this._logVerbose(\n `Error decoding token: ${e instanceof Error ? e.message : \"Unknown error\"}`\n );\n return null;\n }\n }\n _logVerbose(message) {\n this.logger.logVerbose(`${message} [v${this.configVersion}]`);\n }\n}\n//# sourceMappingURL=authentication_manager.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { version } from \"../../index.js\";\nimport { convexToJson } from \"../../values/index.js\";\nimport {\n createHybridErrorStacktrace,\n forwardData,\n instantiateDefaultLogger,\n instantiateNoopLogger,\n logFatalError\n} from \"../logging.js\";\nimport { LocalSyncState } from \"./local_state.js\";\nimport { RequestManager } from \"./request_manager.js\";\nimport {\n OptimisticQueryResults\n} from \"./optimistic_updates_impl.js\";\nimport { RemoteQuerySet } from \"./remote_query_set.js\";\nimport { serializePathAndArgs } from \"./udf_path_utils.js\";\nimport { WebSocketManager } from \"./web_socket_manager.js\";\nimport { newSessionId } from \"./session.js\";\nimport {\n AuthenticationManager\n} from \"./authentication_manager.js\";\nimport { getMarksReport, mark } from \"./metrics.js\";\nimport { parseArgs, validateDeploymentUrl } from \"../../common/index.js\";\nimport { ConvexError } from \"../../values/errors.js\";\nimport { jwtDecode } from \"../../vendor/jwt-decode/index.js\";\nexport class BaseConvexClient {\n /**\n * @param address - The url of your Convex deployment, often provided\n * by an environment variable. E.g. `https://small-mouse-123.convex.cloud`.\n * @param onTransition - A callback receiving an array of query tokens\n * corresponding to query results that have changed -- additional handlers\n * can be added via `addOnTransitionHandler`.\n * @param options - See {@link BaseConvexClientOptions} for a full description.\n */\n constructor(address, onTransition, options) {\n __publicField(this, \"address\");\n __publicField(this, \"state\");\n __publicField(this, \"requestManager\");\n __publicField(this, \"webSocketManager\");\n __publicField(this, \"authenticationManager\");\n __publicField(this, \"remoteQuerySet\");\n __publicField(this, \"optimisticQueryResults\");\n __publicField(this, \"_transitionHandlerCounter\", 0);\n __publicField(this, \"_nextRequestId\");\n __publicField(this, \"_onTransitionFns\", /* @__PURE__ */ new Map());\n __publicField(this, \"_sessionId\");\n __publicField(this, \"firstMessageReceived\", false);\n __publicField(this, \"debug\");\n __publicField(this, \"logger\");\n __publicField(this, \"maxObservedTimestamp\");\n __publicField(this, \"connectionStateSubscribers\", /* @__PURE__ */ new Map());\n __publicField(this, \"nextConnectionStateSubscriberId\", 0);\n __publicField(this, \"_lastPublishedConnectionState\");\n /**\n * Call this whenever the connection state may have changed in a way that could\n * require publishing it. Schedules a possibly update.\n */\n __publicField(this, \"markConnectionStateDirty\", () => {\n void Promise.resolve().then(() => {\n const curConnectionState = this.connectionState();\n if (JSON.stringify(curConnectionState) !== JSON.stringify(this._lastPublishedConnectionState)) {\n this._lastPublishedConnectionState = curConnectionState;\n for (const cb of this.connectionStateSubscribers.values()) {\n cb(curConnectionState);\n }\n }\n });\n });\n // Instance property so that `mark()` doesn't need to be called as a method.\n __publicField(this, \"mark\", (name) => {\n if (this.debug) {\n mark(name, this.sessionId);\n }\n });\n if (typeof address === \"object\") {\n throw new Error(\n \"Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.\"\n );\n }\n if (options?.skipConvexDeploymentUrlCheck !== true) {\n validateDeploymentUrl(address);\n }\n options = { ...options };\n const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ?? 10;\n let webSocketConstructor = options.webSocketConstructor;\n if (!webSocketConstructor && typeof WebSocket === \"undefined\") {\n throw new Error(\n \"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\"\n );\n }\n webSocketConstructor = webSocketConstructor || WebSocket;\n this.debug = options.reportDebugInfoToConvex ?? false;\n this.address = address;\n this.logger = options.logger === false ? instantiateNoopLogger({ verbose: options.verbose ?? false }) : options.logger !== true && options.logger ? options.logger : instantiateDefaultLogger({ verbose: options.verbose ?? false });\n const i = address.search(\"://\");\n if (i === -1) {\n throw new Error(\"Provided address was not an absolute URL.\");\n }\n const origin = address.substring(i + 3);\n const protocol = address.substring(0, i);\n let wsProtocol;\n if (protocol === \"http\") {\n wsProtocol = \"ws\";\n } else if (protocol === \"https\") {\n wsProtocol = \"wss\";\n } else {\n throw new Error(`Unknown parent protocol ${protocol}`);\n }\n const wsUri = `${wsProtocol}://${origin}/api/${version}/sync`;\n this.state = new LocalSyncState();\n this.remoteQuerySet = new RemoteQuerySet(\n (queryId) => this.state.queryPath(queryId),\n this.logger\n );\n this.requestManager = new RequestManager(\n this.logger,\n this.markConnectionStateDirty\n );\n const pauseSocket = () => {\n this.webSocketManager.pause();\n this.state.pause();\n };\n this.authenticationManager = new AuthenticationManager(\n this.state,\n {\n authenticate: (token) => {\n const message = this.state.setAuth(token);\n this.webSocketManager.sendMessage(message);\n return message.baseVersion;\n },\n stopSocket: () => this.webSocketManager.stop(),\n tryRestartSocket: () => this.webSocketManager.tryRestart(),\n pauseSocket,\n resumeSocket: () => this.webSocketManager.resume(),\n clearAuth: () => {\n this.clearAuth();\n }\n },\n {\n logger: this.logger,\n refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds,\n initialAuthTokenReuse: options.initialAuthTokenReuse ?? false\n }\n );\n this.optimisticQueryResults = new OptimisticQueryResults();\n this.addOnTransitionHandler((transition) => {\n onTransition(transition.queries.map((q) => q.token));\n });\n this._nextRequestId = 0;\n this._sessionId = newSessionId();\n const { unsavedChangesWarning } = options;\n if (typeof window === \"undefined\" || typeof window.addEventListener === \"undefined\") {\n if (unsavedChangesWarning === true) {\n throw new Error(\n \"unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.\"\n );\n }\n } else if (unsavedChangesWarning !== false) {\n window.addEventListener(\"beforeunload\", (e) => {\n if (this.requestManager.hasIncompleteRequests()) {\n e.preventDefault();\n const confirmationMessage = \"Are you sure you want to leave? Your changes may not be saved.\";\n (e || window.event).returnValue = confirmationMessage;\n return confirmationMessage;\n }\n });\n }\n this.webSocketManager = new WebSocketManager(\n wsUri,\n {\n onOpen: (reconnectMetadata) => {\n this.mark(\"convexWebSocketOpen\");\n this.webSocketManager.sendMessage({\n ...reconnectMetadata,\n type: \"Connect\",\n sessionId: this._sessionId,\n maxObservedTimestamp: this.maxObservedTimestamp\n });\n this.remoteQuerySet = new RemoteQuerySet(\n (queryId) => this.state.queryPath(queryId),\n this.logger\n );\n const [querySetModification, authModification] = this.state.restart();\n if (authModification) {\n this.webSocketManager.sendMessage(authModification);\n }\n this.webSocketManager.sendMessage(querySetModification);\n for (const message of this.requestManager.restart()) {\n this.webSocketManager.sendMessage(message);\n }\n },\n onResume: () => {\n const [querySetModification, authModification] = this.state.resume();\n if (authModification) {\n this.webSocketManager.sendMessage(authModification);\n }\n if (querySetModification) {\n this.webSocketManager.sendMessage(querySetModification);\n }\n for (const message of this.requestManager.resume()) {\n this.webSocketManager.sendMessage(message);\n }\n },\n onMessage: (serverMessage) => {\n if (!this.firstMessageReceived) {\n this.firstMessageReceived = true;\n this.mark(\"convexFirstMessageReceived\");\n this.reportMarks();\n }\n switch (serverMessage.type) {\n case \"Transition\": {\n this.observedTimestamp(serverMessage.endVersion.ts);\n this.authenticationManager.onTransition(serverMessage);\n this.remoteQuerySet.transition(serverMessage);\n this.state.transition(serverMessage);\n const completedRequests = this.requestManager.removeCompleted(\n this.remoteQuerySet.timestamp()\n );\n this.notifyOnQueryResultChanges(completedRequests);\n break;\n }\n case \"MutationResponse\": {\n if (serverMessage.success) {\n this.observedTimestamp(serverMessage.ts);\n }\n const completedMutationInfo = this.requestManager.onResponse(serverMessage);\n if (completedMutationInfo !== null) {\n this.notifyOnQueryResultChanges(\n /* @__PURE__ */ new Map([\n [\n completedMutationInfo.requestId,\n completedMutationInfo.result\n ]\n ])\n );\n }\n break;\n }\n case \"ActionResponse\": {\n this.requestManager.onResponse(serverMessage);\n break;\n }\n case \"AuthError\": {\n this.authenticationManager.onAuthError(serverMessage);\n break;\n }\n case \"FatalError\": {\n const error = logFatalError(this.logger, serverMessage.error);\n void this.webSocketManager.terminate();\n throw error;\n }\n default: {\n serverMessage;\n }\n }\n return {\n hasSyncedPastLastReconnect: this.hasSyncedPastLastReconnect()\n };\n },\n onServerDisconnectError: options.onServerDisconnectError\n },\n webSocketConstructor,\n this.logger,\n this.markConnectionStateDirty,\n this.debug\n );\n this.mark(\"convexClientConstructed\");\n if (options.expectAuth) {\n pauseSocket();\n }\n }\n /**\n * Return true if there is outstanding work from prior to the time of the most recent restart.\n * This indicates that the client has not proven itself to have gotten past the issue that\n * potentially led to the restart. Use this to influence when to reset backoff after a failure.\n */\n hasSyncedPastLastReconnect() {\n const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect() && this.state.hasSyncedPastLastReconnect();\n return hasSyncedPastLastReconnect;\n }\n observedTimestamp(observedTs) {\n if (this.maxObservedTimestamp === void 0 || this.maxObservedTimestamp.lessThanOrEqual(observedTs)) {\n this.maxObservedTimestamp = observedTs;\n }\n }\n getMaxObservedTimestamp() {\n return this.maxObservedTimestamp;\n }\n /**\n * Compute the current query results based on the remoteQuerySet and the\n * current optimistic updates and call `onTransition` for all the changed\n * queries.\n *\n * @param completedMutations - A set of mutation IDs whose optimistic updates\n * are no longer needed.\n */\n notifyOnQueryResultChanges(completedRequests) {\n const remoteQueryResults = this.remoteQuerySet.remoteQueryResults();\n const queryTokenToValue = /* @__PURE__ */ new Map();\n for (const [queryId, result] of remoteQueryResults) {\n const queryToken = this.state.queryToken(queryId);\n if (queryToken !== null) {\n const query = {\n result,\n udfPath: this.state.queryPath(queryId),\n args: this.state.queryArgs(queryId)\n };\n queryTokenToValue.set(queryToken, query);\n }\n }\n const changedQueryTokens = this.optimisticQueryResults.ingestQueryResultsFromServer(\n queryTokenToValue,\n new Set(completedRequests.keys())\n );\n this.handleTransition({\n queries: changedQueryTokens.map((token) => {\n const optimisticResult = this.optimisticQueryResults.rawQueryResult(token);\n return {\n token,\n modification: {\n kind: \"Updated\",\n result: optimisticResult\n }\n };\n }),\n reflectedMutations: Array.from(completedRequests).map(\n ([requestId, result]) => ({\n requestId,\n result\n })\n ),\n timestamp: this.remoteQuerySet.timestamp()\n });\n }\n handleTransition(transition) {\n for (const fn of this._onTransitionFns.values()) {\n fn(transition);\n }\n }\n /**\n * Add a handler that will be called on a transition.\n *\n * Any external side effects (e.g. setting React state) should be handled here.\n *\n * @param fn\n *\n * @returns\n */\n addOnTransitionHandler(fn) {\n const id = this._transitionHandlerCounter++;\n this._onTransitionFns.set(id, fn);\n return () => this._onTransitionFns.delete(id);\n }\n /**\n * Get the current JWT auth token and decoded claims.\n */\n getCurrentAuthClaims() {\n const authToken = this.state.getAuth();\n let decoded = {};\n if (authToken && authToken.tokenType === \"User\") {\n try {\n decoded = authToken ? jwtDecode(authToken.value) : {};\n } catch {\n decoded = {};\n }\n } else {\n return void 0;\n }\n return { token: authToken.value, decoded };\n }\n /**\n * Set the authentication token to be used for subsequent queries and mutations.\n * `fetchToken` will be called automatically again if a token expires.\n * `fetchToken` should return `null` if the token cannot be retrieved, for example\n * when the user's rights were permanently revoked.\n * @param fetchToken - an async function returning the JWT-encoded OpenID Connect Identity Token\n * @param onChange - a callback that will be called when the authentication status changes\n * @param onRefreshChange - a callback called with `true` when the socket is paused to fetch a replacement token after a server rejection, and `false` when refresh completes\n */\n setAuth(fetchToken, onChange, onRefreshChange) {\n void this.authenticationManager.setConfig(\n fetchToken,\n onChange,\n onRefreshChange\n );\n }\n hasAuth() {\n return this.state.hasAuth();\n }\n /** @internal */\n setAdminAuth(value, fakeUserIdentity) {\n const message = this.state.setAdminAuth(value, fakeUserIdentity);\n this.webSocketManager.sendMessage(message);\n }\n clearAuth() {\n const message = this.state.clearAuth();\n this.webSocketManager.sendMessage(message);\n }\n /**\n * Subscribe to a query function.\n *\n * Whenever this query's result changes, the `onTransition` callback\n * passed into the constructor will be called.\n *\n * @param name - The name of the query.\n * @param args - An arguments object for the query. If this is omitted, the\n * arguments will be `{}`.\n * @param options - A {@link SubscribeOptions} options object for this query.\n \n * @returns An object containing a {@link QueryToken} corresponding to this\n * query and an `unsubscribe` callback.\n */\n subscribe(name, args, options) {\n const argsObject = parseArgs(args);\n const { modification, queryToken, unsubscribe } = this.state.subscribe(\n name,\n argsObject,\n options?.journal,\n options?.componentPath\n );\n if (modification !== null) {\n this.webSocketManager.sendMessage(modification);\n }\n return {\n queryToken,\n unsubscribe: () => {\n const modification2 = unsubscribe();\n if (modification2) {\n this.webSocketManager.sendMessage(modification2);\n }\n }\n };\n }\n /**\n * A query result based only on the current, local state.\n *\n * The only way this will return a value is if we're already subscribed to the\n * query or its value has been set optimistically.\n */\n localQueryResult(udfPath, args) {\n const argsObject = parseArgs(args);\n const queryToken = serializePathAndArgs(udfPath, argsObject);\n return this.optimisticQueryResults.queryResult(queryToken);\n }\n /**\n * Get query result by query token based on current, local state\n *\n * The only way this will return a value is if we're already subscribed to the\n * query or its value has been set optimistically.\n *\n * @internal\n */\n localQueryResultByToken(queryToken) {\n return this.optimisticQueryResults.queryResult(queryToken);\n }\n /**\n * Whether local query result is available for a token.\n *\n * This method does not throw if the result is an error.\n *\n * @internal\n */\n hasLocalQueryResultByToken(queryToken) {\n return this.optimisticQueryResults.hasQueryResult(queryToken);\n }\n /**\n * @internal\n */\n localQueryLogs(udfPath, args) {\n const argsObject = parseArgs(args);\n const queryToken = serializePathAndArgs(udfPath, argsObject);\n return this.optimisticQueryResults.queryLogs(queryToken);\n }\n /**\n * Retrieve the current {@link QueryJournal} for this query function.\n *\n * If we have not yet received a result for this query, this will be `undefined`.\n *\n * @param name - The name of the query.\n * @param args - The arguments object for this query.\n * @returns The query's {@link QueryJournal} or `undefined`.\n */\n queryJournal(name, args) {\n const argsObject = parseArgs(args);\n const queryToken = serializePathAndArgs(name, argsObject);\n return this.state.queryJournal(queryToken);\n }\n /**\n * Get the current {@link ConnectionState} between the client and the Convex\n * backend.\n *\n * @returns The {@link ConnectionState} with the Convex backend.\n */\n connectionState() {\n const wsConnectionState = this.webSocketManager.connectionState();\n return {\n hasInflightRequests: this.requestManager.hasInflightRequests(),\n isWebSocketConnected: wsConnectionState.isConnected,\n hasEverConnected: wsConnectionState.hasEverConnected,\n connectionCount: wsConnectionState.connectionCount,\n connectionRetries: wsConnectionState.connectionRetries,\n timeOfOldestInflightRequest: this.requestManager.timeOfOldestInflightRequest(),\n inflightMutations: this.requestManager.inflightMutations(),\n inflightActions: this.requestManager.inflightActions()\n };\n }\n /**\n * Subscribe to the {@link ConnectionState} between the client and the Convex\n * backend, calling a callback each time it changes.\n *\n * Subscribed callbacks will be called when any part of ConnectionState changes.\n * ConnectionState may grow in future versions (e.g. to provide a array of\n * inflight requests) in which case callbacks would be called more frequently.\n *\n * @returns An unsubscribe function to stop listening.\n */\n subscribeToConnectionState(cb) {\n const id = this.nextConnectionStateSubscriberId++;\n this.connectionStateSubscribers.set(id, cb);\n return () => {\n this.connectionStateSubscribers.delete(id);\n };\n }\n /**\n * Execute a mutation function.\n *\n * @param name - The name of the mutation.\n * @param args - An arguments object for the mutation. If this is omitted,\n * the arguments will be `{}`.\n * @param options - A {@link MutationOptions} options object for this mutation.\n \n * @returns - A promise of the mutation's result.\n */\n async mutation(name, args, options) {\n const result = await this.mutationInternal(name, args, options);\n if (!result.success) {\n if (result.errorData !== void 0) {\n throw forwardData(\n result,\n new ConvexError(\n createHybridErrorStacktrace(\"mutation\", name, result)\n )\n );\n }\n throw new Error(createHybridErrorStacktrace(\"mutation\", name, result));\n }\n return result.value;\n }\n /**\n * @internal\n */\n async mutationInternal(udfPath, args, options, componentPath) {\n const { mutationPromise } = this.enqueueMutation(\n udfPath,\n args,\n options,\n componentPath\n );\n return mutationPromise;\n }\n /**\n * @internal\n */\n enqueueMutation(udfPath, args, options, componentPath) {\n const mutationArgs = parseArgs(args);\n this.tryReportLongDisconnect();\n const requestId = this.nextRequestId;\n this._nextRequestId++;\n if (options !== void 0) {\n const optimisticUpdate = options.optimisticUpdate;\n if (optimisticUpdate !== void 0) {\n const wrappedUpdate = (localQueryStore) => {\n const result = optimisticUpdate(\n localQueryStore,\n mutationArgs\n );\n if (result instanceof Promise) {\n this.logger.warn(\n \"Optimistic update handler returned a Promise. Optimistic updates should be synchronous.\"\n );\n }\n };\n const changedQueryTokens = this.optimisticQueryResults.applyOptimisticUpdate(\n wrappedUpdate,\n requestId\n );\n const changedQueries = changedQueryTokens.map((token) => {\n const localResult = this.localQueryResultByToken(token);\n return {\n token,\n modification: {\n kind: \"Updated\",\n result: localResult === void 0 ? void 0 : {\n success: true,\n value: localResult,\n logLines: []\n }\n }\n };\n });\n this.handleTransition({\n queries: changedQueries,\n reflectedMutations: [],\n timestamp: this.remoteQuerySet.timestamp()\n });\n }\n }\n const message = {\n type: \"Mutation\",\n requestId,\n udfPath,\n componentPath,\n args: [convexToJson(mutationArgs)]\n };\n const mightBeSent = this.webSocketManager.sendMessage(message);\n const mutationPromise = this.requestManager.request(message, mightBeSent);\n return {\n requestId,\n mutationPromise\n };\n }\n /**\n * Execute an action function.\n *\n * @param name - The name of the action.\n * @param args - An arguments object for the action. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the action's result.\n */\n async action(name, args) {\n const result = await this.actionInternal(name, args);\n if (!result.success) {\n if (result.errorData !== void 0) {\n throw forwardData(\n result,\n new ConvexError(createHybridErrorStacktrace(\"action\", name, result))\n );\n }\n throw new Error(createHybridErrorStacktrace(\"action\", name, result));\n }\n return result.value;\n }\n /**\n * @internal\n */\n async actionInternal(udfPath, args, componentPath) {\n const actionArgs = parseArgs(args);\n const requestId = this.nextRequestId;\n this._nextRequestId++;\n this.tryReportLongDisconnect();\n const message = {\n type: \"Action\",\n requestId,\n udfPath,\n componentPath,\n args: [convexToJson(actionArgs)]\n };\n const mightBeSent = this.webSocketManager.sendMessage(message);\n return this.requestManager.request(message, mightBeSent);\n }\n /**\n * Close any network handles associated with this client and stop all subscriptions.\n *\n * Call this method when you're done with an {@link BaseConvexClient} to\n * dispose of its sockets and resources.\n *\n * @returns A `Promise` fulfilled when the connection has been completely closed.\n */\n async close() {\n this.authenticationManager.stop();\n return this.webSocketManager.terminate();\n }\n /**\n * Return the address for this client, useful for creating a new client.\n *\n * Not guaranteed to match the address with which this client was constructed:\n * it may be canonicalized.\n */\n get url() {\n return this.address;\n }\n /**\n * @internal\n */\n get nextRequestId() {\n return this._nextRequestId;\n }\n /**\n * @internal\n */\n get sessionId() {\n return this._sessionId;\n }\n /**\n * Reports performance marks to the server. This should only be called when\n * we have a functional websocket.\n */\n reportMarks() {\n if (this.debug) {\n const report = getMarksReport(this.sessionId);\n this.webSocketManager.sendMessage({\n type: \"Event\",\n eventType: \"ClientConnect\",\n event: report\n });\n }\n }\n tryReportLongDisconnect() {\n if (!this.debug) {\n return;\n }\n const timeOfOldestRequest = this.connectionState().timeOfOldestInflightRequest;\n if (timeOfOldestRequest === null || Date.now() - timeOfOldestRequest.getTime() <= 60 * 1e3) {\n return;\n }\n const endpoint = `${this.address}/api/debug_event`;\n fetch(endpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n },\n body: JSON.stringify({ event: \"LongWebsocketDisconnect\" })\n }).then((response) => {\n if (!response.ok) {\n this.logger.warn(\n \"Analytics request failed with response:\",\n response.body\n );\n }\n }).catch((error) => {\n this.logger.warn(\"Analytics response failed with error:\", error);\n });\n }\n}\n//# sourceMappingURL=client.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport {\n serializePaginatedPathAndArgs,\n canonicalizeUdfPath\n} from \"./udf_path_utils.js\";\nimport {\n asPaginationResult\n} from \"./pagination.js\";\nimport { Long } from \"../../vendor/long.js\";\nexport class PaginatedQueryClient {\n constructor(client, onTransition) {\n this.client = client;\n this.onTransition = onTransition;\n __publicField(this, \"paginatedQuerySet\", /* @__PURE__ */ new Map());\n // hold onto a real Transition so we can construct synthetic ones with that timestamp\n __publicField(this, \"lastTransitionTs\");\n this.lastTransitionTs = Long.fromNumber(0);\n this.client.addOnTransitionHandler(\n (transition) => this.onBaseTransition(transition)\n );\n }\n /**\n * Subscribe to a paginated query.\n *\n * @param name - The name of the paginated query function\n * @param args - Arguments for the query (excluding paginationOpts)\n * @param options - Pagination options including initialNumItems\n * @returns Object with paginatedQueryToken and unsubscribe function\n */\n subscribe(name, args, options) {\n const canonicalizedUdfPath = canonicalizeUdfPath(name);\n const token = serializePaginatedPathAndArgs(\n canonicalizedUdfPath,\n args,\n options\n );\n const unsubscribe = () => this.removePaginatedQuerySubscriber(token);\n const existingEntry = this.paginatedQuerySet.get(token);\n if (existingEntry) {\n existingEntry.numSubscribers += 1;\n return {\n paginatedQueryToken: token,\n unsubscribe\n };\n }\n this.paginatedQuerySet.set(token, {\n token,\n canonicalizedUdfPath,\n args,\n numSubscribers: 1,\n options: { initialNumItems: options.initialNumItems },\n nextPageKey: 0,\n pageKeys: [],\n pageKeyToQuery: /* @__PURE__ */ new Map(),\n ongoingSplits: /* @__PURE__ */ new Map(),\n skip: false,\n id: options.id\n });\n this.addPageToPaginatedQuery(token, null, options.initialNumItems);\n return {\n paginatedQueryToken: token,\n unsubscribe\n };\n }\n /**\n * Get current results for a paginated query based on local state.\n *\n * Throws an error when one of the pages has errored.\n */\n localQueryResult(name, args, options) {\n const canonicalizedUdfPath = canonicalizeUdfPath(name);\n const token = serializePaginatedPathAndArgs(\n canonicalizedUdfPath,\n args,\n options\n );\n return this.localQueryResultByToken(token);\n }\n /**\n * @internal\n */\n localQueryResultByToken(token) {\n const paginatedQuery = this.paginatedQuerySet.get(token);\n if (!paginatedQuery) {\n return void 0;\n }\n const activePages = this.activePageQueryTokens(paginatedQuery);\n if (activePages.length === 0) {\n return {\n results: [],\n status: \"LoadingFirstPage\",\n loadMore: (numItems) => {\n return this.loadMoreOfPaginatedQuery(token, numItems);\n }\n };\n }\n let allResults = [];\n let hasUndefined = false;\n let isDone = false;\n for (const pageToken of activePages) {\n const result = this.client.localQueryResultByToken(pageToken);\n if (result === void 0) {\n hasUndefined = true;\n isDone = false;\n continue;\n }\n const paginationResult = asPaginationResult(result);\n allResults = allResults.concat(paginationResult.page);\n isDone = !!paginationResult.isDone;\n }\n let status;\n if (hasUndefined) {\n status = allResults.length === 0 ? \"LoadingFirstPage\" : \"LoadingMore\";\n } else if (isDone) {\n status = \"Exhausted\";\n } else {\n status = \"CanLoadMore\";\n }\n return {\n results: allResults,\n status,\n loadMore: (numItems) => {\n return this.loadMoreOfPaginatedQuery(token, numItems);\n }\n };\n }\n onBaseTransition(transition) {\n const changedBaseTokens = transition.queries.map((q) => q.token);\n const changed = this.queriesContainingTokens(changedBaseTokens);\n let paginatedQueries = [];\n if (changed.length > 0) {\n this.processPaginatedQuerySplits(\n changed,\n (token) => this.client.localQueryResultByToken(token)\n );\n paginatedQueries = changed.map((token) => ({\n token,\n modification: {\n kind: \"Updated\",\n result: this.localQueryResultByToken(token)\n }\n }));\n }\n const extendedTransition = {\n ...transition,\n paginatedQueries\n };\n this.onTransition(extendedTransition);\n }\n /**\n * Load more items for a paginated query.\n *\n * This *always* causes a transition, the status of the query\n * has probably changed from \"CanLoadMore\" to \"LoadingMore\".\n * Data might have changed too: maybe a subscription to this page\n * query already exists (unlikely but possible) or this page query\n * has an optimistic update providing some initial data.\n *\n * @internal\n */\n loadMoreOfPaginatedQuery(token, numItems) {\n this.mustGetPaginatedQuery(token);\n const lastPageToken = this.queryTokenForLastPageOfPaginatedQuery(token);\n const lastPageResult = this.client.localQueryResultByToken(lastPageToken);\n if (!lastPageResult) {\n return false;\n }\n const paginationResult = asPaginationResult(lastPageResult);\n if (paginationResult.isDone) {\n return false;\n }\n this.addPageToPaginatedQuery(\n token,\n paginationResult.continueCursor,\n numItems\n );\n const loadMoreTransition = {\n timestamp: this.lastTransitionTs,\n reflectedMutations: [],\n queries: [],\n paginatedQueries: [\n {\n token,\n modification: {\n kind: \"Updated\",\n result: this.localQueryResultByToken(token)\n }\n }\n ]\n };\n this.onTransition(loadMoreTransition);\n return true;\n }\n /**\n * @internal\n */\n queriesContainingTokens(queryTokens) {\n if (queryTokens.length === 0) {\n return [];\n }\n const changed = [];\n const queryTokenSet = new Set(queryTokens);\n for (const [paginatedToken, paginatedQuery] of this.paginatedQuerySet) {\n for (const pageToken of this.allQueryTokens(paginatedQuery)) {\n if (queryTokenSet.has(pageToken)) {\n changed.push(paginatedToken);\n break;\n }\n }\n }\n return changed;\n }\n /**\n * @internal\n */\n processPaginatedQuerySplits(changed, getResult) {\n for (const paginatedQueryToken of changed) {\n const paginatedQuery = this.mustGetPaginatedQuery(paginatedQueryToken);\n const { ongoingSplits, pageKeyToQuery, pageKeys } = paginatedQuery;\n for (const [pageKey, [splitKey1, splitKey2]] of ongoingSplits) {\n const bothNewPagesLoaded = getResult(pageKeyToQuery.get(splitKey1).queryToken) !== void 0 && getResult(pageKeyToQuery.get(splitKey2).queryToken) !== void 0;\n if (bothNewPagesLoaded) {\n this.completePaginatedQuerySplit(\n paginatedQuery,\n pageKey,\n splitKey1,\n splitKey2\n );\n }\n }\n for (const pageKey of pageKeys) {\n if (ongoingSplits.has(pageKey)) {\n continue;\n }\n const pageEntry = pageKeyToQuery.get(pageKey);\n if (!pageEntry) {\n throw new Error(`No page query for active pageKey ${pageKey}`);\n }\n const pageResult = getResult(pageEntry.queryToken);\n if (!pageResult) {\n continue;\n }\n const result = asPaginationResult(pageResult);\n const shouldSplit = result.splitCursor && (result.pageStatus === \"SplitRecommended\" || result.pageStatus === \"SplitRequired\" || // This client-driven page splitting condition will change in the future.\n result.page.length > paginatedQuery.options.initialNumItems * 2);\n if (shouldSplit) {\n this.splitPaginatedQueryPage(\n paginatedQuery,\n pageKey,\n pageEntry.cursor,\n result.splitCursor,\n // we just checked\n result.continueCursor\n );\n }\n }\n }\n }\n splitPaginatedQueryPage(paginatedQuery, pageKey, startCursor, splitCursor, continueCursor) {\n const splitKey1 = paginatedQuery.nextPageKey++;\n const splitKey2 = paginatedQuery.nextPageKey++;\n const paginationOpts = {\n numItems: paginatedQuery.options.initialNumItems,\n id: paginatedQuery.id\n };\n const firstSubscription = this.client.subscribe(\n paginatedQuery.canonicalizedUdfPath,\n {\n ...paginatedQuery.args,\n paginationOpts: {\n ...paginationOpts,\n cursor: startCursor,\n endCursor: splitCursor\n }\n }\n );\n paginatedQuery.pageKeyToQuery.set(splitKey1, {\n ...firstSubscription,\n cursor: startCursor\n });\n const secondSubscription = this.client.subscribe(\n paginatedQuery.canonicalizedUdfPath,\n {\n ...paginatedQuery.args,\n paginationOpts: {\n ...paginationOpts,\n cursor: splitCursor,\n endCursor: continueCursor\n }\n }\n );\n paginatedQuery.pageKeyToQuery.set(splitKey2, {\n ...secondSubscription,\n cursor: splitCursor\n });\n paginatedQuery.ongoingSplits.set(pageKey, [splitKey1, splitKey2]);\n }\n /**\n * @internal\n */\n addPageToPaginatedQuery(token, continueCursor, numItems) {\n const paginatedQuery = this.mustGetPaginatedQuery(token);\n const pageKey = paginatedQuery.nextPageKey++;\n const paginationOpts = {\n cursor: continueCursor,\n numItems,\n id: paginatedQuery.id\n };\n const pageArgs = {\n ...paginatedQuery.args,\n paginationOpts\n };\n const subscription = this.client.subscribe(\n paginatedQuery.canonicalizedUdfPath,\n pageArgs\n );\n paginatedQuery.pageKeys.push(pageKey);\n paginatedQuery.pageKeyToQuery.set(pageKey, {\n ...subscription,\n cursor: continueCursor\n });\n return subscription;\n }\n removePaginatedQuerySubscriber(token) {\n const paginatedQuery = this.paginatedQuerySet.get(token);\n if (!paginatedQuery) {\n return;\n }\n paginatedQuery.numSubscribers -= 1;\n if (paginatedQuery.numSubscribers > 0) {\n return;\n }\n for (const subscription of paginatedQuery.pageKeyToQuery.values()) {\n subscription.unsubscribe();\n }\n this.paginatedQuerySet.delete(token);\n }\n completePaginatedQuerySplit(paginatedQuery, pageKey, splitKey1, splitKey2) {\n const originalQuery = paginatedQuery.pageKeyToQuery.get(pageKey);\n paginatedQuery.pageKeyToQuery.delete(pageKey);\n const pageIndex = paginatedQuery.pageKeys.indexOf(pageKey);\n paginatedQuery.pageKeys.splice(pageIndex, 1, splitKey1, splitKey2);\n paginatedQuery.ongoingSplits.delete(pageKey);\n originalQuery.unsubscribe();\n }\n /** The query tokens for all active pages, in result order */\n activePageQueryTokens(paginatedQuery) {\n return paginatedQuery.pageKeys.map(\n (pageKey) => paginatedQuery.pageKeyToQuery.get(pageKey).queryToken\n );\n }\n allQueryTokens(paginatedQuery) {\n return Array.from(paginatedQuery.pageKeyToQuery.values()).map(\n (sub) => sub.queryToken\n );\n }\n queryTokenForLastPageOfPaginatedQuery(token) {\n const paginatedQuery = this.mustGetPaginatedQuery(token);\n const lastPageKey = paginatedQuery.pageKeys[paginatedQuery.pageKeys.length - 1];\n if (lastPageKey === void 0) {\n throw new Error(`No pages for paginated query ${token}`);\n }\n return paginatedQuery.pageKeyToQuery.get(lastPageKey).queryToken;\n }\n mustGetPaginatedQuery(token) {\n const paginatedQuery = this.paginatedQuerySet.get(token);\n if (!paginatedQuery) {\n throw new Error(\"paginated query no longer exists for token \" + token);\n }\n return paginatedQuery;\n }\n}\n//# sourceMappingURL=paginated_query_client.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { validateDeploymentUrl } from \"../common/index.js\";\nimport { getFunctionName } from \"../server/api.js\";\nimport {\n BaseConvexClient\n} from \"./sync/client.js\";\nimport {\n PaginatedQueryClient\n} from \"./sync/paginated_query_client.js\";\nimport {\n serializedQueryTokenIsPaginated\n} from \"./sync/udf_path_utils.js\";\nlet defaultWebSocketConstructor;\nexport function setDefaultWebSocketConstructor(ws) {\n defaultWebSocketConstructor = ws;\n}\nexport class ConvexClient {\n /**\n * Construct a client and immediately initiate a WebSocket connection to the passed address.\n *\n * @public\n */\n constructor(address, options = {}) {\n __publicField(this, \"listeners\");\n __publicField(this, \"_client\");\n __publicField(this, \"_paginatedClient\");\n // A synthetic server event to run callbacks the first time\n __publicField(this, \"callNewListenersWithCurrentValuesTimer\");\n __publicField(this, \"_closed\");\n __publicField(this, \"_disabled\");\n if (options.skipConvexDeploymentUrlCheck !== true) {\n validateDeploymentUrl(address);\n }\n const { disabled, ...baseOptions } = options;\n this._closed = false;\n this._disabled = !!disabled;\n if (defaultWebSocketConstructor && !(\"webSocketConstructor\" in baseOptions) && typeof WebSocket === \"undefined\") {\n baseOptions.webSocketConstructor = defaultWebSocketConstructor;\n }\n if (typeof window === \"undefined\" && !(\"unsavedChangesWarning\" in baseOptions)) {\n baseOptions.unsavedChangesWarning = false;\n }\n if (!this.disabled) {\n this._client = new BaseConvexClient(\n address,\n () => {\n },\n // NOP, let the paginated query client do it all\n baseOptions\n );\n this._paginatedClient = new PaginatedQueryClient(\n this._client,\n (transition) => this._transition(transition)\n );\n }\n this.listeners = /* @__PURE__ */ new Set();\n }\n /**\n * Once closed no registered callbacks will fire again.\n */\n get closed() {\n return this._closed;\n }\n get client() {\n if (this._client) return this._client;\n throw new Error(\"ConvexClient is disabled\");\n }\n /**\n * @internal\n */\n get paginatedClient() {\n if (this._paginatedClient) return this._paginatedClient;\n throw new Error(\"ConvexClient is disabled\");\n }\n get disabled() {\n return this._disabled;\n }\n /**\n * Call a callback whenever a new result for a query is received. The callback\n * will run soon after being registered if a result for the query is already\n * in memory.\n *\n * The return value is an {@link Unsubscribe} object which is both a function\n * an an object with properties. Both of the patterns below work with this object:\n *\n *```ts\n * // call the return value as a function\n * const unsubscribe = client.onUpdate(api.messages.list, {}, (messages) => {\n * console.log(messages);\n * });\n * unsubscribe();\n *\n * // unpack the return value into its properties\n * const {\n * getCurrentValue,\n * unsubscribe,\n * } = client.onUpdate(api.messages.list, {}, (messages) => {\n * console.log(messages);\n * });\n *```\n *\n * @param query - A {@link server.FunctionReference} for the public query to run.\n * @param args - The arguments to run the query with.\n * @param callback - Function to call when the query result updates.\n * @param onError - Function to call when the query result updates with an error.\n * If not provided, errors will be thrown instead of calling the callback.\n *\n * @return an {@link Unsubscribe} function to stop calling the onUpdate function.\n */\n onUpdate(query, args, callback, onError) {\n if (this.disabled) {\n return this.createDisabledUnsubscribe();\n }\n const { queryToken, unsubscribe } = this.client.subscribe(\n getFunctionName(query),\n args\n );\n const queryInfo = {\n queryToken,\n callback,\n onError,\n unsubscribe,\n hasEverRun: false,\n query,\n args,\n paginationOptions: void 0\n };\n this.listeners.add(queryInfo);\n if (this.queryResultReady(queryToken) && this.callNewListenersWithCurrentValuesTimer === void 0) {\n this.callNewListenersWithCurrentValuesTimer = setTimeout(\n () => this.callNewListenersWithCurrentValues(),\n 0\n );\n }\n const unsubscribeProps = {\n unsubscribe: () => {\n if (this.closed) {\n return;\n }\n this.listeners.delete(queryInfo);\n unsubscribe();\n },\n getCurrentValue: () => this.client.localQueryResultByToken(queryToken),\n getQueryLogs: () => this.client.localQueryLogs(queryToken)\n };\n const ret = unsubscribeProps.unsubscribe;\n Object.assign(ret, unsubscribeProps);\n return ret;\n }\n /**\n * Call a callback whenever a new result for a paginated query is received.\n *\n * This is an experimental preview: the final API may change.\n * In particular, caching behavior, page splitting, and required paginated query options\n * may change.\n *\n * @param query - A {@link server.FunctionReference} for the public query to run.\n * @param args - The arguments to run the query with.\n * @param options - Options for the paginated query including initialNumItems and id.\n * @param callback - Function to call when the query result updates.\n * @param onError - Function to call when the query result updates with an error.\n *\n * @return an {@link Unsubscribe} function to stop calling the callback.\n */\n onPaginatedUpdate_experimental(query, args, options, callback, onError) {\n if (this.disabled) {\n return this.createDisabledUnsubscribe();\n }\n const paginationOptions = {\n initialNumItems: options.initialNumItems,\n id: -1\n };\n const { paginatedQueryToken, unsubscribe } = this.paginatedClient.subscribe(\n getFunctionName(query),\n args,\n // Simple client doesn't use IDs, there's no expectation that these queries remain separate.\n paginationOptions\n );\n const queryInfo = {\n queryToken: paginatedQueryToken,\n callback,\n onError,\n unsubscribe,\n hasEverRun: false,\n query,\n args,\n paginationOptions\n };\n this.listeners.add(queryInfo);\n if (!!this.paginatedClient.localQueryResultByToken(paginatedQueryToken) && this.callNewListenersWithCurrentValuesTimer === void 0) {\n this.callNewListenersWithCurrentValuesTimer = setTimeout(\n () => this.callNewListenersWithCurrentValues(),\n 0\n );\n }\n const unsubscribeProps = {\n unsubscribe: () => {\n if (this.closed) {\n return;\n }\n this.listeners.delete(queryInfo);\n unsubscribe();\n },\n getCurrentValue: () => {\n const result = this.paginatedClient.localQueryResult(\n getFunctionName(query),\n args,\n paginationOptions\n );\n return result;\n },\n getQueryLogs: () => []\n // Paginated queries don't aggregate their logs\n };\n const ret = unsubscribeProps.unsubscribe;\n Object.assign(ret, unsubscribeProps);\n return ret;\n }\n // Run all callbacks that have never been run before if they have a query\n // result available now.\n callNewListenersWithCurrentValues() {\n this.callNewListenersWithCurrentValuesTimer = void 0;\n this._transition({ queries: [], paginatedQueries: [] }, true);\n }\n queryResultReady(queryToken) {\n return this.client.hasLocalQueryResultByToken(queryToken);\n }\n createDisabledUnsubscribe() {\n const disabledUnsubscribe = (() => {\n });\n const unsubscribeProps = {\n unsubscribe: disabledUnsubscribe,\n getCurrentValue: () => void 0,\n getQueryLogs: () => void 0\n };\n Object.assign(disabledUnsubscribe, unsubscribeProps);\n return disabledUnsubscribe;\n }\n async close() {\n if (this.disabled) return;\n this.listeners.clear();\n this._closed = true;\n if (this._paginatedClient) {\n this._paginatedClient = void 0;\n }\n return this.client.close();\n }\n /**\n * Get the current JWT auth token and decoded claims.\n */\n getAuth() {\n if (this.disabled) return;\n return this.client.getCurrentAuthClaims();\n }\n /**\n * Set the authentication token to be used for subsequent queries and mutations.\n * `fetchToken` will be called automatically again if a token expires.\n * `fetchToken` should return `null` if the token cannot be retrieved, for example\n * when the user's rights were permanently revoked.\n * @param fetchToken - an async function returning the JWT (typically an OpenID Connect Identity Token)\n * @param onChange - a callback that will be called when the authentication status changes\n */\n setAuth(fetchToken, onChange) {\n if (this.disabled) return;\n this.client.setAuth(\n fetchToken,\n onChange ?? (() => {\n })\n );\n }\n /**\n * @internal\n */\n setAdminAuth(token, identity) {\n if (this.closed) {\n throw new Error(\"ConvexClient has already been closed.\");\n }\n if (this.disabled) return;\n this.client.setAdminAuth(token, identity);\n }\n /**\n * @internal\n */\n _transition({\n queries,\n paginatedQueries\n }, callNewListeners = false) {\n const updatedQueries = [\n ...queries.map((q) => q.token),\n ...paginatedQueries.map((q) => q.token)\n ];\n for (const queryInfo of this.listeners) {\n const { callback, queryToken, onError, hasEverRun } = queryInfo;\n const isPaginatedQuery = serializedQueryTokenIsPaginated(queryToken);\n const hasResultReady = isPaginatedQuery ? !!this.paginatedClient.localQueryResultByToken(queryToken) : this.client.hasLocalQueryResultByToken(queryToken);\n if (updatedQueries.includes(queryToken) || callNewListeners && !hasEverRun && hasResultReady) {\n queryInfo.hasEverRun = true;\n let newValue;\n try {\n if (isPaginatedQuery) {\n newValue = this.paginatedClient.localQueryResultByToken(queryToken);\n } else {\n newValue = this.client.localQueryResultByToken(queryToken);\n }\n } catch (error) {\n if (!(error instanceof Error)) throw error;\n if (onError) {\n onError(\n error,\n \"Second argument to onUpdate onError is reserved for later use\"\n );\n } else {\n void Promise.reject(error);\n }\n continue;\n }\n callback(\n newValue,\n \"Second argument to onUpdate callback is reserved for later use\"\n );\n }\n }\n }\n /**\n * Execute a mutation function.\n *\n * @param mutation - A {@link server.FunctionReference} for the public mutation\n * to run.\n * @param args - An arguments object for the mutation.\n * @param options - A {@link MutationOptions} options object for the mutation.\n * @returns A promise of the mutation's result.\n */\n async mutation(mutation, args, options) {\n if (this.disabled) throw new Error(\"ConvexClient is disabled\");\n return await this.client.mutation(getFunctionName(mutation), args, options);\n }\n /**\n * Execute an action function.\n *\n * @param action - A {@link server.FunctionReference} for the public action\n * to run.\n * @param args - An arguments object for the action.\n * @returns A promise of the action's result.\n */\n async action(action, args) {\n if (this.disabled) throw new Error(\"ConvexClient is disabled\");\n return await this.client.action(getFunctionName(action), args);\n }\n /**\n * Fetch a query result once.\n *\n * @param query - A {@link server.FunctionReference} for the public query\n * to run.\n * @param args - An arguments object for the query.\n * @returns A promise of the query's result.\n */\n async query(query, args) {\n if (this.disabled) throw new Error(\"ConvexClient is disabled\");\n const value = this.client.localQueryResult(getFunctionName(query), args);\n if (value !== void 0) return Promise.resolve(value);\n return new Promise((resolve, reject) => {\n const { unsubscribe } = this.onUpdate(\n query,\n args,\n (value2) => {\n unsubscribe();\n resolve(value2);\n },\n (e) => {\n unsubscribe();\n reject(e);\n }\n );\n });\n }\n /**\n * Get the current {@link ConnectionState} between the client and the Convex\n * backend.\n *\n * @returns The {@link ConnectionState} with the Convex backend.\n */\n connectionState() {\n if (this.disabled) throw new Error(\"ConvexClient is disabled\");\n return this.client.connectionState();\n }\n /**\n * Subscribe to the {@link ConnectionState} between the client and the Convex\n * backend, calling a callback each time it changes.\n *\n * Subscribed callbacks will be called when any part of ConnectionState changes.\n * ConnectionState may grow in future versions (e.g. to provide a array of\n * inflight requests) in which case callbacks would be called more frequently.\n *\n * @returns An unsubscribe function to stop listening.\n */\n subscribeToConnectionState(cb) {\n if (this.disabled) return () => {\n };\n return this.client.subscribeToConnectionState(cb);\n }\n}\n//# sourceMappingURL=simple_client.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport {\n getFunctionName\n} from \"../server/api.js\";\nimport { parseArgs, validateDeploymentUrl } from \"../common/index.js\";\nimport { version } from \"../index.js\";\nimport {\n ConvexError,\n convexToJson,\n jsonToConvex\n} from \"../values/index.js\";\nimport {\n instantiateDefaultLogger,\n instantiateNoopLogger,\n logForFunction\n} from \"./logging.js\";\nexport const STATUS_CODE_OK = 200;\nexport const STATUS_CODE_BAD_REQUEST = 400;\nexport const STATUS_CODE_UDF_FAILED = 560;\nlet specifiedFetch = void 0;\nexport function setFetch(f) {\n specifiedFetch = f;\n}\nexport class ConvexHttpClient {\n /**\n * Create a new {@link ConvexHttpClient}.\n *\n * @param address - The url of your Convex deployment, often provided\n * by an environment variable. E.g. `https://small-mouse-123.convex.cloud`.\n * @param options - An object of options.\n * - `skipConvexDeploymentUrlCheck` - Skip validating that the Convex deployment URL looks like\n * `https://happy-animal-123.convex.cloud` or localhost. This can be useful if running a self-hosted\n * Convex backend that uses a different URL.\n * - `logger` - A logger or a boolean. If not provided, logs to the console.\n * You can construct your own logger to customize logging to log elsewhere\n * or not log at all, or use `false` as a shorthand for a no-op logger.\n * A logger is an object with 4 methods: log(), warn(), error(), and logVerbose().\n * These methods can receive multiple arguments of any types, like console.log().\n * - `auth` - A JWT containing identity claims accessible in Convex functions.\n * This identity may expire so it may be necessary to call `setAuth()` later,\n * but for short-lived clients it's convenient to specify this value here.\n * - `fetch` - A custom fetch implementation to use for all HTTP requests made by this client.\n */\n constructor(address, options) {\n __publicField(this, \"address\");\n __publicField(this, \"auth\");\n __publicField(this, \"adminAuth\");\n __publicField(this, \"encodedTsPromise\");\n __publicField(this, \"debug\");\n __publicField(this, \"fetchOptions\");\n __publicField(this, \"fetch\");\n __publicField(this, \"logger\");\n __publicField(this, \"mutationQueue\", []);\n __publicField(this, \"isProcessingQueue\", false);\n if (typeof options === \"boolean\") {\n throw new Error(\n \"skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.\"\n );\n }\n const opts = options ?? {};\n if (opts.skipConvexDeploymentUrlCheck !== true) {\n validateDeploymentUrl(address);\n }\n this.logger = options?.logger === false ? instantiateNoopLogger({ verbose: false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: false });\n this.address = address;\n this.debug = true;\n this.auth = void 0;\n this.adminAuth = void 0;\n this.fetch = options?.fetch;\n if (options?.auth) {\n this.setAuth(options.auth);\n }\n }\n /**\n * Obtain the {@link ConvexHttpClient}'s URL to its backend.\n * @deprecated Use url, which returns the url without /api at the end.\n *\n * @returns The URL to the Convex backend, including the client's API version.\n */\n backendUrl() {\n return `${this.address}/api`;\n }\n /**\n * Return the address for this client, useful for creating a new client.\n *\n * Not guaranteed to match the address with which this client was constructed:\n * it may be canonicalized.\n */\n get url() {\n return this.address;\n }\n /**\n * Set the authentication token to be used for subsequent queries and mutations.\n *\n * Should be called whenever the token changes (i.e. due to expiration and refresh).\n *\n * @param value - JWT-encoded OpenID Connect identity token.\n */\n setAuth(value) {\n this.clearAuth();\n this.auth = value;\n }\n /**\n * Set admin auth token to allow calling internal queries, mutations, and actions\n * and acting as an identity.\n *\n * @internal\n */\n setAdminAuth(token, actingAsIdentity) {\n this.clearAuth();\n if (actingAsIdentity !== void 0) {\n const bytes = new TextEncoder().encode(JSON.stringify(actingAsIdentity));\n const actingAsIdentityEncoded = btoa(String.fromCodePoint(...bytes));\n this.adminAuth = `${token}:${actingAsIdentityEncoded}`;\n } else {\n this.adminAuth = token;\n }\n }\n /**\n * Clear the current authentication token if set.\n */\n clearAuth() {\n this.auth = void 0;\n this.adminAuth = void 0;\n }\n /**\n * Sets whether the result log lines should be printed on the console or not.\n *\n * @internal\n */\n setDebug(debug) {\n this.debug = debug;\n }\n /**\n * Used to customize the fetch behavior in some runtimes.\n *\n * @internal\n */\n setFetchOptions(fetchOptions) {\n this.fetchOptions = fetchOptions;\n }\n /**\n * This API is experimental: it may change or disappear.\n *\n * Execute a Convex query function at the same timestamp as every other\n * consistent query execution run by this HTTP client.\n *\n * This doesn't make sense for long-lived ConvexHttpClients as Convex\n * backends can read a limited amount into the past: beyond 30 seconds\n * in the past may not be available.\n *\n * Create a new client to use a consistent time.\n *\n * @param name - The name of the query.\n * @param args - The arguments object for the query. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the query's result.\n *\n * @deprecated This API is experimental: it may change or disappear.\n */\n async consistentQuery(query, ...args) {\n const queryArgs = parseArgs(args[0]);\n const timestampPromise = this.getTimestamp();\n return await this.queryInner(query, queryArgs, { timestampPromise });\n }\n async getTimestamp() {\n if (this.encodedTsPromise) {\n return this.encodedTsPromise;\n }\n return this.encodedTsPromise = this.getTimestampInner();\n }\n async getTimestampInner() {\n const localFetch = this.fetch || specifiedFetch || fetch;\n const headers = {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n };\n const response = await localFetch(`${this.address}/api/query_ts`, {\n ...this.fetchOptions,\n method: \"POST\",\n headers\n });\n if (!response.ok) {\n throw new Error(await response.text());\n }\n const { ts } = await response.json();\n return ts;\n }\n /**\n * Execute a Convex query function.\n *\n * @param name - The name of the query.\n * @param args - The arguments object for the query. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the query's result.\n */\n async query(query, ...args) {\n const queryArgs = parseArgs(args[0]);\n return await this.queryInner(query, queryArgs, {});\n }\n async queryInner(query, queryArgs, options) {\n const name = getFunctionName(query);\n const args = [convexToJson(queryArgs)];\n const headers = {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n };\n if (this.adminAuth) {\n headers[\"Authorization\"] = `Convex ${this.adminAuth}`;\n } else if (this.auth) {\n headers[\"Authorization\"] = `Bearer ${this.auth}`;\n }\n const localFetch = this.fetch || specifiedFetch || fetch;\n const timestamp = options.timestampPromise ? await options.timestampPromise : void 0;\n const body = JSON.stringify({\n path: name,\n format: \"convex_encoded_json\",\n args,\n ...timestamp ? { ts: timestamp } : {}\n });\n const endpoint = timestamp ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;\n const response = await localFetch(endpoint, {\n ...this.fetchOptions,\n body,\n method: \"POST\",\n headers\n });\n if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {\n throw new Error(await response.text());\n }\n const respJSON = await response.json();\n if (this.debug) {\n for (const line of respJSON.logLines ?? []) {\n logForFunction(this.logger, \"info\", \"query\", name, line);\n }\n }\n switch (respJSON.status) {\n case \"success\":\n return jsonToConvex(respJSON.value);\n case \"error\":\n if (respJSON.errorData !== void 0) {\n throw forwardErrorData(\n respJSON.errorData,\n new ConvexError(respJSON.errorMessage)\n );\n }\n throw new Error(respJSON.errorMessage);\n default:\n throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);\n }\n }\n async mutationInner(mutation, mutationArgs) {\n const name = getFunctionName(mutation);\n const body = JSON.stringify({\n path: name,\n format: \"convex_encoded_json\",\n args: [convexToJson(mutationArgs)]\n });\n const headers = {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n };\n if (this.adminAuth) {\n headers[\"Authorization\"] = `Convex ${this.adminAuth}`;\n } else if (this.auth) {\n headers[\"Authorization\"] = `Bearer ${this.auth}`;\n }\n const localFetch = this.fetch || specifiedFetch || fetch;\n const response = await localFetch(`${this.address}/api/mutation`, {\n ...this.fetchOptions,\n body,\n method: \"POST\",\n headers\n });\n if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {\n throw new Error(await response.text());\n }\n const respJSON = await response.json();\n if (this.debug) {\n for (const line of respJSON.logLines ?? []) {\n logForFunction(this.logger, \"info\", \"mutation\", name, line);\n }\n }\n switch (respJSON.status) {\n case \"success\":\n return jsonToConvex(respJSON.value);\n case \"error\":\n if (respJSON.errorData !== void 0) {\n throw forwardErrorData(\n respJSON.errorData,\n new ConvexError(respJSON.errorMessage)\n );\n }\n throw new Error(respJSON.errorMessage);\n default:\n throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);\n }\n }\n async processMutationQueue() {\n if (this.isProcessingQueue) {\n return;\n }\n this.isProcessingQueue = true;\n while (this.mutationQueue.length > 0) {\n const { mutation, args, resolve, reject } = this.mutationQueue.shift();\n try {\n const result = await this.mutationInner(mutation, args);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n }\n this.isProcessingQueue = false;\n }\n enqueueMutation(mutation, args) {\n return new Promise((resolve, reject) => {\n this.mutationQueue.push({ mutation, args, resolve, reject });\n void this.processMutationQueue();\n });\n }\n /**\n * Execute a Convex mutation function. Mutations are queued by default.\n *\n * @param name - The name of the mutation.\n * @param args - The arguments object for the mutation. If this is omitted,\n * the arguments will be `{}`.\n * @param options - An optional object containing\n * @returns A promise of the mutation's result.\n */\n async mutation(mutation, ...args) {\n const [fnArgs, options] = args;\n const mutationArgs = parseArgs(fnArgs);\n const queued = !options?.skipQueue;\n if (queued) {\n return await this.enqueueMutation(mutation, mutationArgs);\n } else {\n return await this.mutationInner(mutation, mutationArgs);\n }\n }\n /**\n * Execute a Convex action function. Actions are not queued.\n *\n * @param name - The name of the action.\n * @param args - The arguments object for the action. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the action's result.\n */\n async action(action, ...args) {\n const actionArgs = parseArgs(args[0]);\n const name = getFunctionName(action);\n const body = JSON.stringify({\n path: name,\n format: \"convex_encoded_json\",\n args: [convexToJson(actionArgs)]\n });\n const headers = {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n };\n if (this.adminAuth) {\n headers[\"Authorization\"] = `Convex ${this.adminAuth}`;\n } else if (this.auth) {\n headers[\"Authorization\"] = `Bearer ${this.auth}`;\n }\n const localFetch = this.fetch || specifiedFetch || fetch;\n const response = await localFetch(`${this.address}/api/action`, {\n ...this.fetchOptions,\n body,\n method: \"POST\",\n headers\n });\n if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {\n throw new Error(await response.text());\n }\n const respJSON = await response.json();\n if (this.debug) {\n for (const line of respJSON.logLines ?? []) {\n logForFunction(this.logger, \"info\", \"action\", name, line);\n }\n }\n switch (respJSON.status) {\n case \"success\":\n return jsonToConvex(respJSON.value);\n case \"error\":\n if (respJSON.errorData !== void 0) {\n throw forwardErrorData(\n respJSON.errorData,\n new ConvexError(respJSON.errorMessage)\n );\n }\n throw new Error(respJSON.errorMessage);\n default:\n throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);\n }\n }\n /**\n * Execute a Convex function of an unknown type. These function calls are not queued.\n *\n * @param name - The name of the function.\n * @param args - The arguments object for the function. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the function's result.\n *\n * @internal\n */\n async function(anyFunction, componentPath, ...args) {\n const functionArgs = parseArgs(args[0]);\n const name = typeof anyFunction === \"string\" ? anyFunction : getFunctionName(anyFunction);\n const body = JSON.stringify({\n componentPath,\n path: name,\n format: \"convex_encoded_json\",\n args: convexToJson(functionArgs)\n });\n const headers = {\n \"Content-Type\": \"application/json\",\n \"Convex-Client\": `npm-${version}`\n };\n if (this.adminAuth) {\n headers[\"Authorization\"] = `Convex ${this.adminAuth}`;\n } else if (this.auth) {\n headers[\"Authorization\"] = `Bearer ${this.auth}`;\n }\n const localFetch = this.fetch || specifiedFetch || fetch;\n const response = await localFetch(`${this.address}/api/function`, {\n ...this.fetchOptions,\n body,\n method: \"POST\",\n headers\n });\n if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {\n throw new Error(await response.text());\n }\n const respJSON = await response.json();\n if (this.debug) {\n for (const line of respJSON.logLines ?? []) {\n logForFunction(this.logger, \"info\", \"any\", name, line);\n }\n }\n switch (respJSON.status) {\n case \"success\":\n return jsonToConvex(respJSON.value);\n case \"error\":\n if (respJSON.errorData !== void 0) {\n throw forwardErrorData(\n respJSON.errorData,\n new ConvexError(respJSON.errorMessage)\n );\n }\n throw new Error(respJSON.errorMessage);\n default:\n throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);\n }\n }\n}\nfunction forwardErrorData(errorData, error) {\n error.data = jsonToConvex(errorData);\n return error;\n}\n//# sourceMappingURL=http_client.js.map\n","\"use strict\";\nexport { BaseConvexClient } from \"./sync/client.js\";\nexport { ConvexClient } from \"./simple_client.js\";\nexport { ConvexHttpClient } from \"./http_client.js\";\nexport { convexQueryOptions } from \"./query_options.js\";\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nimport { useEffect, useState } from \"react\";\nexport function useSubscription({\n // (Synchronously) returns the current value of our subscription.\n getCurrentValue,\n // This function is passed an event handler to attach to the subscription.\n // It should return an unsubscribe function that removes the handler.\n subscribe\n}) {\n const [state, setState] = useState(() => ({\n getCurrentValue,\n subscribe,\n value: getCurrentValue()\n }));\n let valueToReturn = state.value;\n if (state.getCurrentValue !== getCurrentValue || state.subscribe !== subscribe) {\n valueToReturn = getCurrentValue();\n setState({\n getCurrentValue,\n subscribe,\n value: valueToReturn\n });\n }\n useEffect(() => {\n let didUnsubscribe = false;\n const checkForUpdates = () => {\n if (didUnsubscribe) {\n return;\n }\n setState((prevState) => {\n if (prevState.getCurrentValue !== getCurrentValue || prevState.subscribe !== subscribe) {\n return prevState;\n }\n const value = getCurrentValue();\n if (prevState.value === value) {\n return prevState;\n }\n return { ...prevState, value };\n });\n };\n const unsubscribe = subscribe(checkForUpdates);\n checkForUpdates();\n return () => {\n didUnsubscribe = true;\n unsubscribe();\n };\n }, [getCurrentValue, subscribe]);\n return valueToReturn;\n}\n//# sourceMappingURL=use_subscription.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { BaseConvexClient } from \"../browser/index.js\";\nimport React, { useCallback, useContext, useMemo } from \"react\";\nimport { convexToJson } from \"../values/index.js\";\nimport { useQueries } from \"./use_queries.js\";\nimport { useSubscription } from \"./use_subscription.js\";\nimport { parseArgs } from \"../common/index.js\";\nimport {\n getFunctionName,\n makeFunctionReference\n} from \"../server/api.js\";\nimport {\n instantiateDefaultLogger,\n instantiateNoopLogger\n} from \"../browser/logging.js\";\nimport {\n PaginatedQueryClient\n} from \"../browser/sync/paginated_query_client.js\";\nconst DEFAULT_EXTEND_SUBSCRIPTION_FOR = 5e3;\nif (typeof React === \"undefined\") {\n throw new Error(\"Required dependency 'react' not found\");\n}\nexport function createMutation(mutationReference, client, update) {\n function mutation(args) {\n assertNotAccidentalArgument(args);\n return client.mutation(mutationReference, args, {\n optimisticUpdate: update\n });\n }\n mutation.withOptimisticUpdate = function withOptimisticUpdate(optimisticUpdate) {\n if (update !== void 0) {\n throw new Error(\n `Already specified optimistic update for mutation ${getFunctionName(\n mutationReference\n )}`\n );\n }\n return createMutation(mutationReference, client, optimisticUpdate);\n };\n return mutation;\n}\nfunction createAction(actionReference, client) {\n return function(args) {\n return client.action(actionReference, args);\n };\n}\nexport class ConvexReactClient {\n /**\n * @param address - The url of your Convex deployment, often provided\n * by an environment variable. E.g. `https://small-mouse-123.convex.cloud`.\n * @param options - See {@link ConvexReactClientOptions} for a full description.\n */\n constructor(address, options) {\n __publicField(this, \"address\");\n __publicField(this, \"cachedSync\");\n __publicField(this, \"cachedPaginatedQueryClient\");\n __publicField(this, \"listeners\");\n __publicField(this, \"options\");\n // \"closed\" means this client is done, not just that the underlying WS connection is closed.\n __publicField(this, \"closed\", false);\n __publicField(this, \"_logger\");\n __publicField(this, \"adminAuth\");\n __publicField(this, \"fakeUserIdentity\");\n if (address === void 0) {\n throw new Error(\n \"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.\"\n );\n }\n if (typeof address !== \"string\") {\n throw new Error(\n `ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof address} instead.`\n );\n }\n if (!address.includes(\"://\")) {\n throw new Error(\"Provided address was not an absolute URL.\");\n }\n this.address = address;\n this.listeners = /* @__PURE__ */ new Map();\n this._logger = options?.logger === false ? instantiateNoopLogger({ verbose: options?.verbose ?? false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: options?.verbose ?? false });\n this.options = { ...options, logger: this._logger };\n }\n /**\n * Return the address for this client, useful for creating a new client.\n *\n * Not guaranteed to match the address with which this client was constructed:\n * it may be canonicalized.\n */\n get url() {\n return this.address;\n }\n /**\n * Lazily instantiate the `BaseConvexClient` so we don't create the WebSocket\n * when server-side rendering.\n *\n * @internal\n */\n get sync() {\n if (this.closed) {\n throw new Error(\"ConvexReactClient has already been closed.\");\n }\n if (this.cachedSync) {\n return this.cachedSync;\n }\n this.cachedSync = this.options.baseClient ?? new BaseConvexClient(\n this.address,\n () => {\n },\n // Use the PaginatedQueryClient's transition instead.\n this.options\n );\n if (this.adminAuth) {\n this.cachedSync.setAdminAuth(this.adminAuth, this.fakeUserIdentity);\n }\n this.cachedPaginatedQueryClient = new PaginatedQueryClient(\n this.cachedSync,\n (transition) => this.handleTransition(transition)\n );\n return this.cachedSync;\n }\n /**\n * Lazily instantiate the `PaginatedQueryClient` so we don't create it\n * when server-side rendering.\n *\n * @internal\n */\n get paginatedQueryClient() {\n this.sync;\n if (this.cachedPaginatedQueryClient) {\n return this.cachedPaginatedQueryClient;\n }\n throw new Error(\"Should already be instantiated\");\n }\n /**\n * Set the authentication token to be used for subsequent queries and mutations.\n * `fetchToken` will be called automatically again if a token expires.\n * `fetchToken` should return `null` if the token cannot be retrieved, for example\n * when the user's rights were permanently revoked.\n * @param fetchToken - an async function returning the JWT-encoded OpenID Connect Identity Token\n * @param onChange - a callback that will be called when the authentication status changes\n * @param onRefreshChange - a callback called with `true` when the socket is paused to fetch a replacement token after a server rejection, and `false` when refresh completes\n */\n setAuth(fetchToken, onChange, onRefreshChange) {\n if (typeof fetchToken === \"string\") {\n throw new Error(\n \"Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.\"\n );\n }\n this.sync.setAuth(\n fetchToken,\n onChange ?? (() => {\n }),\n onRefreshChange\n );\n }\n /**\n * Clear the current authentication token if set.\n */\n clearAuth() {\n this.sync.clearAuth();\n }\n /**\n * @internal\n */\n setAdminAuth(token, identity) {\n this.adminAuth = token;\n this.fakeUserIdentity = identity;\n if (this.closed) {\n throw new Error(\"ConvexReactClient has already been closed.\");\n }\n if (this.cachedSync) {\n this.sync.setAdminAuth(token, identity);\n }\n }\n /**\n * Construct a new {@link Watch} on a Convex query function.\n *\n * **Most application code should not call this method directly. Instead use\n * the {@link useQuery} hook.**\n *\n * The act of creating a watch does nothing, a Watch is stateless.\n *\n * @param query - A {@link server.FunctionReference} for the public query to run.\n * @param args - An arguments object for the query. If this is omitted,\n * the arguments will be `{}`.\n * @param options - A {@link WatchQueryOptions} options object for this query.\n *\n * @returns The {@link Watch} object.\n */\n watchQuery(query, ...argsAndOptions) {\n const [args, options] = argsAndOptions;\n const name = getFunctionName(query);\n return {\n onUpdate: (callback) => {\n const { queryToken, unsubscribe } = this.sync.subscribe(\n name,\n args,\n options\n );\n const currentListeners = this.listeners.get(queryToken);\n if (currentListeners !== void 0) {\n currentListeners.add(callback);\n } else {\n this.listeners.set(queryToken, /* @__PURE__ */ new Set([callback]));\n }\n return () => {\n if (this.closed) {\n return;\n }\n const currentListeners2 = this.listeners.get(queryToken);\n currentListeners2.delete(callback);\n if (currentListeners2.size === 0) {\n this.listeners.delete(queryToken);\n }\n unsubscribe();\n };\n },\n localQueryResult: () => {\n if (this.cachedSync) {\n return this.cachedSync.localQueryResult(name, args);\n }\n return void 0;\n },\n localQueryLogs: () => {\n if (this.cachedSync) {\n return this.cachedSync.localQueryLogs(name, args);\n }\n return void 0;\n },\n journal: () => {\n if (this.cachedSync) {\n return this.cachedSync.queryJournal(name, args);\n }\n return void 0;\n }\n };\n }\n // Let's try out a queryOptions-style API.\n // This method is similar to the React Query API `queryClient.prefetchQuery()`.\n // In the future an ensureQueryData(): Promise<Data> method could exist.\n /**\n * Indicates likely future interest in a query subscription.\n *\n * The implementation currently immediately subscribes to a query. In the future this method\n * may prioritize some queries over others, fetch the query result without subscribing, or\n * do nothing in slow network connections or high load scenarios.\n *\n * To use this in a React component, call useQuery() and ignore the return value.\n *\n * @param queryOptions - A query (function reference from an api object) and its args, plus\n * an optional extendSubscriptionFor for how long to subscribe to the query.\n */\n prewarmQuery(queryOptions) {\n const extendSubscriptionFor = queryOptions.extendSubscriptionFor ?? DEFAULT_EXTEND_SUBSCRIPTION_FOR;\n const watch = this.watchQuery(queryOptions.query, queryOptions.args || {});\n const unsubscribe = watch.onUpdate(() => {\n });\n setTimeout(unsubscribe, extendSubscriptionFor);\n }\n /**\n * Construct a new {@link PaginatedWatch} on a Convex paginated query function.\n *\n * **Most application code should not call this method directly. Instead use\n * the {@link usePaginatedQuery} hook.**\n *\n * The act of creating a watch does nothing, a Watch is stateless.\n *\n * @param query - A {@link server.FunctionReference} for the public query to run.\n * @param args - An arguments object for the query. If this is omitted,\n * the arguments will be `{}`.\n * @param options - A {@link WatchPaginatedQueryOptions} options object for this query.\n *\n * @returns The {@link PaginatedWatch} object.\n *\n * @internal\n */\n watchPaginatedQuery(query, args, options) {\n const name = getFunctionName(query);\n return {\n onUpdate: (callback) => {\n const { paginatedQueryToken, unsubscribe } = this.paginatedQueryClient.subscribe(name, args || {}, options);\n const currentListeners = this.listeners.get(paginatedQueryToken);\n if (currentListeners !== void 0) {\n currentListeners.add(callback);\n } else {\n this.listeners.set(paginatedQueryToken, /* @__PURE__ */ new Set([callback]));\n }\n return () => {\n if (this.closed) {\n return;\n }\n const currentListeners2 = this.listeners.get(paginatedQueryToken);\n currentListeners2.delete(callback);\n if (currentListeners2.size === 0) {\n this.listeners.delete(paginatedQueryToken);\n }\n unsubscribe();\n };\n },\n localQueryResult: () => {\n return this.paginatedQueryClient.localQueryResult(name, args, options);\n }\n };\n }\n /**\n * Execute a mutation function.\n *\n * @param mutation - A {@link server.FunctionReference} for the public mutation\n * to run.\n * @param args - An arguments object for the mutation. If this is omitted,\n * the arguments will be `{}`.\n * @param options - A {@link MutationOptions} options object for the mutation.\n * @returns A promise of the mutation's result.\n */\n mutation(mutation, ...argsAndOptions) {\n const [args, options] = argsAndOptions;\n const name = getFunctionName(mutation);\n return this.sync.mutation(name, args, options);\n }\n /**\n * Execute an action function.\n *\n * @param action - A {@link server.FunctionReference} for the public action\n * to run.\n * @param args - An arguments object for the action. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the action's result.\n */\n action(action, ...args) {\n const name = getFunctionName(action);\n return this.sync.action(name, ...args);\n }\n /**\n * Fetch a query result once.\n *\n * **Most application code should subscribe to queries instead, using\n * the {@link useQuery} hook.**\n *\n * @param query - A {@link server.FunctionReference} for the public query\n * to run.\n * @param args - An arguments object for the query. If this is omitted,\n * the arguments will be `{}`.\n * @returns A promise of the query's result.\n */\n query(query, ...args) {\n const watch = this.watchQuery(query, ...args);\n const existingResult = watch.localQueryResult();\n if (existingResult !== void 0) {\n return Promise.resolve(existingResult);\n }\n return new Promise((resolve, reject) => {\n const unsubscribe = watch.onUpdate(() => {\n unsubscribe();\n try {\n resolve(watch.localQueryResult());\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n /**\n * Get the current {@link ConnectionState} between the client and the Convex\n * backend.\n *\n * @returns The {@link ConnectionState} with the Convex backend.\n */\n connectionState() {\n return this.sync.connectionState();\n }\n /**\n * Subscribe to the {@link ConnectionState} between the client and the Convex\n * backend, calling a callback each time it changes.\n *\n * Subscribed callbacks will be called when any part of ConnectionState changes.\n * ConnectionState may grow in future versions (e.g. to provide a array of\n * inflight requests) in which case callbacks would be called more frequently.\n * ConnectionState may also *lose* properties in future versions as we figure\n * out what information is most useful. As such this API is considered unstable.\n *\n * @returns An unsubscribe function to stop listening.\n */\n subscribeToConnectionState(cb) {\n return this.sync.subscribeToConnectionState(cb);\n }\n /**\n * Get the logger for this client.\n *\n * @returns The {@link Logger} for this client.\n */\n get logger() {\n return this._logger;\n }\n /**\n * Close any network handles associated with this client and stop all subscriptions.\n *\n * Call this method when you're done with a {@link ConvexReactClient} to\n * dispose of its sockets and resources.\n *\n * @returns A `Promise` fulfilled when the connection has been completely closed.\n */\n async close() {\n this.closed = true;\n this.listeners = /* @__PURE__ */ new Map();\n if (this.cachedPaginatedQueryClient) {\n this.cachedPaginatedQueryClient = void 0;\n }\n if (this.cachedSync) {\n const sync = this.cachedSync;\n this.cachedSync = void 0;\n await sync.close();\n }\n }\n /**\n * Handle transitions from both base client and paginated client.\n * This ensures all transitions are processed synchronously and in order.\n */\n handleTransition(transition) {\n const simple = transition.queries.map((q) => q.token);\n const paginated = transition.paginatedQueries.map((q) => q.token);\n this.transition([...simple, ...paginated]);\n }\n transition(updatedQueries) {\n for (const queryToken of updatedQueries) {\n const callbacks = this.listeners.get(queryToken);\n if (callbacks) {\n for (const callback of callbacks) {\n callback();\n }\n }\n }\n }\n}\nconst ConvexContext = React.createContext(\n void 0\n // in the future this will be a mocked client for testing\n);\nexport function useConvex() {\n return useContext(ConvexContext);\n}\nexport const ConvexProvider = ({ client, children }) => {\n return React.createElement(\n ConvexContext.Provider,\n { value: client },\n children\n );\n};\nexport function useQuery(query, ...args) {\n const skip = args[0] === \"skip\";\n const argsObject = args[0] === \"skip\" ? {} : parseArgs(args[0]);\n const queryReference = typeof query === \"string\" ? makeFunctionReference(query) : query;\n const queryName = getFunctionName(queryReference);\n const queries = useMemo(\n () => skip ? {} : { query: { query: queryReference, args: argsObject } },\n // Stringify args so args that are semantically the same don't trigger a\n // rerender. Saves developers from adding `useMemo` on every args usage.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(convexToJson(argsObject)), queryName, skip]\n );\n const results = useQueries(queries);\n const result = results[\"query\"];\n if (result instanceof Error) {\n throw result;\n }\n return result;\n}\nexport function useQuery_experimental(options) {\n const throwOnError = options.throwOnError ?? false;\n const queryReference = typeof options.query === \"string\" ? makeFunctionReference(options.query) : options.query;\n const skip = options.args === \"skip\";\n const argsObject = !skip ? parseArgs(options.args) : {};\n const queryName = getFunctionName(queryReference);\n const queries = useMemo(\n () => skip ? {} : { query: { query: queryReference, args: argsObject } },\n // Stringify args so args that are semantically the same don't trigger a\n // rerender. Saves developers from adding `useMemo` on every args usage.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(convexToJson(argsObject)), queryName, skip]\n );\n const results = useQueries(queries);\n const result = results[\"query\"];\n if (result instanceof Error) {\n if (throwOnError) {\n throw result;\n }\n return {\n error: result,\n status: \"error\"\n };\n }\n if (result === void 0) {\n return {\n status: \"pending\"\n };\n }\n return {\n data: result,\n status: \"success\"\n };\n}\nexport function useMutation(mutation) {\n const mutationReference = typeof mutation === \"string\" ? makeFunctionReference(mutation) : mutation;\n const convex = useContext(ConvexContext);\n if (convex === void 0) {\n throw new Error(\n \"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\"\n );\n }\n return useMemo(\n () => createMutation(mutationReference, convex),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [convex, getFunctionName(mutationReference)]\n );\n}\nexport function useAction(action) {\n const convex = useContext(ConvexContext);\n const actionReference = typeof action === \"string\" ? makeFunctionReference(action) : action;\n if (convex === void 0) {\n throw new Error(\n \"Could not find Convex client! `useAction` 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\"\n );\n }\n return useMemo(\n () => createAction(actionReference, convex),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [convex, getFunctionName(actionReference)]\n );\n}\nexport function useConvexConnectionState() {\n const convex = useContext(ConvexContext);\n if (convex === void 0) {\n throw new Error(\n \"Could not find Convex client! `useConvexConnectionState` 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\"\n );\n }\n const getCurrentValue = useCallback(() => {\n return convex.connectionState();\n }, [convex]);\n const subscribe = useCallback(\n (callback) => {\n return convex.subscribeToConnectionState(() => {\n callback();\n });\n },\n [convex]\n );\n return useSubscription({ getCurrentValue, subscribe });\n}\nfunction assertNotAccidentalArgument(value) {\n if (typeof value === \"object\" && value !== null && \"bubbles\" in value && \"persist\" in value && \"isDefaultPrevented\" in value) {\n throw new Error(\n `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.`\n );\n }\n}\n//# sourceMappingURL=client.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { convexToJson } from \"../values/index.js\";\nimport { getFunctionName } from \"../server/api.js\";\nexport class QueriesObserver {\n constructor(createWatch) {\n __publicField(this, \"createWatch\");\n __publicField(this, \"queries\");\n __publicField(this, \"listeners\");\n this.createWatch = createWatch;\n this.queries = {};\n this.listeners = /* @__PURE__ */ new Set();\n }\n setQueries(newQueries) {\n for (const identifier of Object.keys(newQueries)) {\n const { query, args, paginationOptions } = newQueries[identifier];\n getFunctionName(query);\n if (this.queries[identifier] === void 0) {\n this.addQuery(\n identifier,\n query,\n args,\n paginationOptions ? { paginationOptions } : {}\n );\n } else {\n const existingInfo = this.queries[identifier];\n if (getFunctionName(query) !== getFunctionName(existingInfo.query) || JSON.stringify(convexToJson(args)) !== JSON.stringify(convexToJson(existingInfo.args)) || JSON.stringify(paginationOptions) !== JSON.stringify(existingInfo.paginationOptions)) {\n this.removeQuery(identifier);\n this.addQuery(\n identifier,\n query,\n args,\n paginationOptions ? { paginationOptions } : {}\n );\n }\n }\n }\n for (const identifier of Object.keys(this.queries)) {\n if (newQueries[identifier] === void 0) {\n this.removeQuery(identifier);\n }\n }\n }\n subscribe(listener) {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n getLocalResults(queries) {\n const result = {};\n for (const identifier of Object.keys(queries)) {\n const { query, args } = queries[identifier];\n const paginationOptions = queries[identifier].paginationOptions;\n getFunctionName(query);\n const watch = this.createWatch(\n query,\n args,\n paginationOptions ? { paginationOptions } : {}\n );\n let value;\n try {\n value = watch.localQueryResult();\n } catch (e) {\n if (e instanceof Error) {\n value = e;\n } else {\n throw e;\n }\n }\n result[identifier] = value;\n }\n return result;\n }\n setCreateWatch(createWatch) {\n this.createWatch = createWatch;\n for (const identifier of Object.keys(this.queries)) {\n const { query, args, watch, paginationOptions } = this.queries[identifier];\n const journal = \"journal\" in watch ? watch.journal() : void 0;\n this.removeQuery(identifier);\n this.addQuery(identifier, query, args, {\n ...journal ? { journal } : [],\n ...paginationOptions ? { paginationOptions } : {}\n });\n }\n }\n destroy() {\n for (const identifier of Object.keys(this.queries)) {\n this.removeQuery(identifier);\n }\n this.listeners = /* @__PURE__ */ new Set();\n }\n addQuery(identifier, query, args, {\n paginationOptions,\n journal\n }) {\n if (this.queries[identifier] !== void 0) {\n throw new Error(\n `Tried to add a new query with identifier ${identifier} when it already exists.`\n );\n }\n const watch = this.createWatch(query, args, {\n ...journal ? { journal } : [],\n ...paginationOptions ? { paginationOptions } : {}\n });\n const unsubscribe = watch.onUpdate(() => this.notifyListeners());\n this.queries[identifier] = {\n query,\n args,\n watch,\n unsubscribe,\n ...paginationOptions ? { paginationOptions } : {}\n };\n }\n removeQuery(identifier) {\n const info = this.queries[identifier];\n if (info === void 0) {\n throw new Error(`No query found with identifier ${identifier}.`);\n }\n info.unsubscribe();\n delete this.queries[identifier];\n }\n notifyListeners() {\n for (const listener of this.listeners) {\n listener();\n }\n }\n}\n//# sourceMappingURL=queries_observer.js.map\n","\"use strict\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useConvex } from \"./client.js\";\nimport { QueriesObserver } from \"./queries_observer.js\";\nimport { useSubscription } from \"./use_subscription.js\";\nexport function useQueries(queries) {\n const convex = useConvex();\n if (convex === void 0) {\n throw new Error(\n \"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\"\n );\n }\n const createWatch = useMemo(() => {\n return (query, args, {\n journal,\n paginationOptions\n }) => {\n if (paginationOptions) {\n return convex.watchPaginatedQuery(query, args, paginationOptions);\n } else {\n return convex.watchQuery(query, args, journal ? { journal } : {});\n }\n };\n }, [convex]);\n return useQueriesHelper(queries, createWatch);\n}\nexport function useQueriesHelper(queries, createWatch) {\n const [observer] = useState(() => new QueriesObserver(createWatch));\n if (observer.createWatch !== createWatch) {\n observer.setCreateWatch(createWatch);\n }\n useEffect(() => () => observer.destroy(), [observer]);\n const subscription = useMemo(\n () => ({\n getCurrentValue: () => {\n return observer.getLocalResults(queries);\n },\n subscribe: (callback) => {\n observer.setQueries(queries);\n return observer.subscribe(callback);\n }\n }),\n [observer, queries]\n );\n return useSubscription(subscription);\n}\n//# sourceMappingURL=use_queries.js.map\n","\"use strict\";\nimport { useMemo, useState } from \"react\";\nimport { ConvexError, convexToJson } from \"../values/index.js\";\nimport { useQueries } from \"./use_queries.js\";\nimport {\n getFunctionName\n} from \"../server/api.js\";\nimport { useConvex } from \"./client.js\";\nimport { compareValues } from \"../values/compare.js\";\nconst splitQuery = (key, splitCursor, continueCursor) => (prevState) => {\n const queries = { ...prevState.queries };\n const splitKey1 = prevState.nextPageKey;\n const splitKey2 = prevState.nextPageKey + 1;\n const nextPageKey = prevState.nextPageKey + 2;\n queries[splitKey1] = {\n query: prevState.query,\n args: {\n ...prevState.args,\n paginationOpts: {\n ...prevState.queries[key].args.paginationOpts,\n endCursor: splitCursor\n }\n }\n };\n queries[splitKey2] = {\n query: prevState.query,\n args: {\n ...prevState.args,\n paginationOpts: {\n ...prevState.queries[key].args.paginationOpts,\n cursor: splitCursor,\n endCursor: continueCursor\n }\n }\n };\n const ongoingSplits = { ...prevState.ongoingSplits };\n ongoingSplits[key] = [splitKey1, splitKey2];\n return {\n ...prevState,\n nextPageKey,\n queries,\n ongoingSplits\n };\n};\nconst completeSplitQuery = (key) => (prevState) => {\n const completedSplit = prevState.ongoingSplits[key];\n if (completedSplit === void 0) {\n return prevState;\n }\n const queries = { ...prevState.queries };\n delete queries[key];\n const ongoingSplits = { ...prevState.ongoingSplits };\n delete ongoingSplits[key];\n let pageKeys = prevState.pageKeys.slice();\n const pageIndex = prevState.pageKeys.findIndex((v) => v === key);\n if (pageIndex >= 0) {\n pageKeys = [\n ...prevState.pageKeys.slice(0, pageIndex),\n ...completedSplit,\n ...prevState.pageKeys.slice(pageIndex + 1)\n ];\n }\n return {\n ...prevState,\n queries,\n pageKeys,\n ongoingSplits\n };\n};\nexport function usePaginatedQuery(query, args, options) {\n const { user: positionalResult } = usePaginatedQueryInternal(\n query,\n args,\n options,\n true\n );\n return positionalResult;\n}\nexport const includePage = Symbol(\"includePageKeys\");\nexport const page = Symbol(\"page\");\nexport function usePaginatedQueryInternal(query, args, options, throwOnError = true) {\n if (typeof options?.initialNumItems !== \"number\" || options.initialNumItems < 0) {\n throw new Error(\n `\\`options.initialNumItems\\` must be a positive number. Received \\`${options?.initialNumItems}\\`.`\n );\n }\n const skip = args === \"skip\";\n const argsObject = skip ? {} : args;\n const queryName = getFunctionName(query);\n const createInitialState = useMemo(() => {\n return () => {\n const id = nextPaginationId();\n return {\n query,\n args: argsObject,\n id,\n nextPageKey: 1,\n pageKeys: skip ? [] : [0],\n queries: skip ? {} : {\n 0: {\n query,\n args: {\n ...argsObject,\n paginationOpts: {\n numItems: options.initialNumItems,\n cursor: null,\n id\n }\n }\n }\n },\n ongoingSplits: {},\n skip\n };\n };\n }, [\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(convexToJson(argsObject)),\n queryName,\n options.initialNumItems,\n skip\n ]);\n const [state, setState] = useState(createInitialState);\n let currState = state;\n if (getFunctionName(query) !== getFunctionName(state.query) || JSON.stringify(convexToJson(argsObject)) !== JSON.stringify(convexToJson(state.args)) || skip !== state.skip) {\n currState = createInitialState();\n setState(currState);\n }\n const convexClient = useConvex();\n const logger = convexClient.logger;\n const resultsObject = useQueries(currState.queries);\n const isIncludingPageKeys = options[includePage] ?? false;\n const [results, maybeLastResult, maybeError] = useMemo(() => {\n let currResult = void 0;\n const allItems = [];\n for (const pageKey of currState.pageKeys) {\n currResult = resultsObject[pageKey];\n if (currResult === void 0) {\n break;\n }\n if (currResult instanceof Error) {\n if (currResult.message.includes(\"InvalidCursor\") || currResult instanceof ConvexError && typeof currResult.data === \"object\" && currResult.data?.isConvexSystemError === true && currResult.data?.paginationError === \"InvalidCursor\") {\n logger.warn(\n \"usePaginatedQuery hit error, resetting pagination state: \" + currResult.message\n );\n setState(createInitialState);\n return [[], void 0, void 0];\n } else {\n if (throwOnError) {\n throw currResult;\n }\n return [allItems, void 0, currResult];\n }\n }\n const ongoingSplit = currState.ongoingSplits[pageKey];\n if (ongoingSplit !== void 0) {\n if (resultsObject[ongoingSplit[0]] !== void 0 && resultsObject[ongoingSplit[1]] !== void 0) {\n setState(completeSplitQuery(pageKey));\n }\n } else if (currResult.splitCursor && (currResult.pageStatus === \"SplitRecommended\" || currResult.pageStatus === \"SplitRequired\" || currResult.page.length > options.initialNumItems * 2)) {\n setState(\n splitQuery(\n pageKey,\n currResult.splitCursor,\n currResult.continueCursor\n )\n );\n }\n if (currResult.pageStatus === \"SplitRequired\") {\n return [allItems, void 0, void 0];\n }\n allItems.push(\n ...isIncludingPageKeys ? currResult.page.map((i) => ({\n ...i,\n [page]: pageKey.toString()\n })) : currResult.page\n );\n }\n return [allItems, currResult, void 0];\n }, [\n resultsObject,\n currState.pageKeys,\n currState.ongoingSplits,\n options.initialNumItems,\n createInitialState,\n logger,\n isIncludingPageKeys,\n throwOnError\n ]);\n const statusObject = useMemo(() => {\n if (maybeError !== void 0) {\n return {\n status: \"Error\",\n isLoading: false,\n error: maybeError,\n loadMore: () => {\n }\n };\n }\n if (maybeLastResult === void 0) {\n if (currState.nextPageKey === 1) {\n return {\n status: \"LoadingFirstPage\",\n isLoading: true,\n loadMore: () => {\n }\n };\n } else {\n return {\n status: \"LoadingMore\",\n isLoading: true,\n loadMore: (_numItems) => {\n }\n };\n }\n }\n if (maybeLastResult.isDone) {\n return {\n status: \"Exhausted\",\n isLoading: false,\n loadMore: (_numItems) => {\n }\n };\n }\n const continueCursor = maybeLastResult.continueCursor;\n let alreadyLoadingMore = false;\n return {\n status: \"CanLoadMore\",\n isLoading: false,\n loadMore: (numItems) => {\n if (!alreadyLoadingMore) {\n alreadyLoadingMore = true;\n setState((prevState) => {\n const pageKeys = [...prevState.pageKeys, prevState.nextPageKey];\n const queries = { ...prevState.queries };\n queries[prevState.nextPageKey] = {\n query: prevState.query,\n args: {\n ...prevState.args,\n paginationOpts: {\n numItems,\n cursor: continueCursor,\n id: prevState.id\n }\n }\n };\n return {\n ...prevState,\n nextPageKey: prevState.nextPageKey + 1,\n pageKeys,\n queries\n };\n });\n }\n }\n };\n }, [maybeError, maybeLastResult, currState.nextPageKey]);\n return {\n user: {\n results,\n ...statusObject\n },\n internal: { state: currState }\n };\n}\nlet paginationId = 0;\nfunction nextPaginationId() {\n paginationId++;\n return paginationId;\n}\nexport function resetPaginationId() {\n paginationId = 0;\n}\nexport function optimisticallyUpdateValueInPaginatedQuery(localStore, query, args, updateValue) {\n const expectedArgs = JSON.stringify(convexToJson(args));\n for (const queryResult of localStore.getAllQueries(query)) {\n if (queryResult.value !== void 0) {\n const { paginationOpts: _, ...innerArgs } = queryResult.args;\n if (JSON.stringify(convexToJson(innerArgs)) === expectedArgs) {\n const value = queryResult.value;\n if (typeof value === \"object\" && value !== null && Array.isArray(value.page)) {\n localStore.setQuery(query, queryResult.args, {\n ...value,\n page: value.page.map(updateValue)\n });\n }\n }\n }\n }\n}\nexport function insertAtTop(options) {\n const { paginatedQuery, argsToMatch, localQueryStore, item } = options;\n const queries = localQueryStore.getAllQueries(paginatedQuery);\n const queriesThatMatch = queries.filter((q) => {\n if (argsToMatch === void 0) {\n return true;\n }\n return Object.keys(argsToMatch).every(\n // @ts-expect-error -- This should be safe since both should be plain objects\n (k) => compareValues(argsToMatch[k], q.args[k]) === 0\n );\n });\n const firstPage = queriesThatMatch.find(\n (q) => q.args.paginationOpts.cursor === null\n );\n if (firstPage === void 0 || firstPage.value === void 0) {\n return;\n }\n localQueryStore.setQuery(paginatedQuery, firstPage.args, {\n ...firstPage.value,\n page: [item, ...firstPage.value.page]\n });\n}\nexport function insertAtBottomIfLoaded(options) {\n const { paginatedQuery, localQueryStore, item, argsToMatch } = options;\n const queries = localQueryStore.getAllQueries(paginatedQuery);\n const queriesThatMatch = queries.filter((q) => {\n if (argsToMatch === void 0) {\n return true;\n }\n return Object.keys(argsToMatch).every(\n // @ts-expect-error -- This should be safe since both should be plain objects\n (k) => compareValues(argsToMatch[k], q.args[k]) === 0\n );\n });\n const lastPage = queriesThatMatch.find(\n (q) => q.value !== void 0 && q.value.isDone\n );\n if (lastPage === void 0) {\n return;\n }\n localQueryStore.setQuery(paginatedQuery, lastPage.args, {\n ...lastPage.value,\n page: [...lastPage.value.page, item]\n });\n}\nexport function insertAtPosition(options) {\n const {\n paginatedQuery,\n sortOrder,\n sortKeyFromItem,\n localQueryStore,\n item,\n argsToMatch\n } = options;\n const queries = localQueryStore.getAllQueries(paginatedQuery);\n const queryGroups = {};\n for (const query of queries) {\n if (argsToMatch !== void 0 && !Object.keys(argsToMatch).every(\n (k) => (\n // @ts-ignore why is this not working?\n argsToMatch[k] === query.args[k]\n )\n )) {\n continue;\n }\n const key = JSON.stringify(\n Object.fromEntries(\n Object.entries(query.args).map(([k, v]) => [\n k,\n k === \"paginationOpts\" ? v.id : v\n ])\n )\n );\n queryGroups[key] ?? (queryGroups[key] = []);\n queryGroups[key].push(query);\n }\n for (const pageQueries of Object.values(queryGroups)) {\n insertAtPositionInPages({\n pageQueries,\n paginatedQuery,\n sortOrder,\n sortKeyFromItem,\n localQueryStore,\n item\n });\n }\n}\nfunction insertAtPositionInPages(options) {\n const {\n pageQueries,\n sortOrder,\n sortKeyFromItem,\n localQueryStore,\n item,\n paginatedQuery\n } = options;\n const insertedKey = sortKeyFromItem(item);\n const loadedPages = pageQueries.filter(\n (q) => q.value !== void 0 && q.value.page.length > 0\n );\n const sortedPages = loadedPages.sort((a, b) => {\n const aKey = sortKeyFromItem(a.value.page[0]);\n const bKey = sortKeyFromItem(b.value.page[0]);\n if (sortOrder === \"asc\") {\n return compareValues(aKey, bKey);\n } else {\n return compareValues(bKey, aKey);\n }\n });\n const firstLoadedPage = sortedPages[0];\n if (firstLoadedPage === void 0) {\n return;\n }\n const firstPageKey = sortKeyFromItem(firstLoadedPage.value.page[0]);\n const isBeforeFirstPage = sortOrder === \"asc\" ? compareValues(insertedKey, firstPageKey) <= 0 : compareValues(insertedKey, firstPageKey) >= 0;\n if (isBeforeFirstPage) {\n if (firstLoadedPage.args.paginationOpts.cursor === null) {\n localQueryStore.setQuery(paginatedQuery, firstLoadedPage.args, {\n ...firstLoadedPage.value,\n page: [item, ...firstLoadedPage.value.page]\n });\n } else {\n return;\n }\n return;\n }\n const lastLoadedPage = sortedPages[sortedPages.length - 1];\n if (lastLoadedPage === void 0) {\n return;\n }\n const lastPageKey = sortKeyFromItem(\n lastLoadedPage.value.page[lastLoadedPage.value.page.length - 1]\n );\n const isAfterLastPage = sortOrder === \"asc\" ? compareValues(insertedKey, lastPageKey) >= 0 : compareValues(insertedKey, lastPageKey) <= 0;\n if (isAfterLastPage) {\n if (lastLoadedPage.value.isDone) {\n localQueryStore.setQuery(paginatedQuery, lastLoadedPage.args, {\n ...lastLoadedPage.value,\n page: [...lastLoadedPage.value.page, item]\n });\n }\n return;\n }\n const successorPageIndex = sortedPages.findIndex(\n (p) => sortOrder === \"asc\" ? compareValues(sortKeyFromItem(p.value.page[0]), insertedKey) > 0 : compareValues(sortKeyFromItem(p.value.page[0]), insertedKey) < 0\n );\n const pageToUpdate = successorPageIndex === -1 ? sortedPages[sortedPages.length - 1] : sortedPages[successorPageIndex - 1];\n if (pageToUpdate === void 0) {\n return;\n }\n const indexWithinPage = pageToUpdate.value.page.findIndex(\n (e) => sortOrder === \"asc\" ? compareValues(sortKeyFromItem(e), insertedKey) >= 0 : compareValues(sortKeyFromItem(e), insertedKey) <= 0\n );\n const newPage = indexWithinPage === -1 ? [...pageToUpdate.value.page, item] : [\n ...pageToUpdate.value.page.slice(0, indexWithinPage),\n item,\n ...pageToUpdate.value.page.slice(indexWithinPage)\n ];\n localQueryStore.setQuery(paginatedQuery, pageToUpdate.args, {\n ...pageToUpdate.value,\n page: newPage\n });\n}\n//# sourceMappingURL=use_paginated_query.js.map\n","\"use strict\";\nimport { useState } from \"react\";\nimport { getFunctionName } from \"../server/api.js\";\nimport { convexToJson } from \"../values/value.js\";\nimport { useQueries } from \"./use_queries.js\";\nimport { ConvexError } from \"../values/errors.js\";\nimport { useConvex } from \"./client.js\";\nexport function usePaginatedQuery_experimental(queryOrOptions, args, options) {\n const isObjectOptions = typeof queryOrOptions === \"object\" && queryOrOptions !== null && \"query\" in queryOrOptions;\n const query = isObjectOptions ? queryOrOptions.query : queryOrOptions;\n const queryArgs = isObjectOptions ? queryOrOptions.args : args;\n const throwOnError = isObjectOptions ? queryOrOptions.throwOnError ?? false : true;\n const initialOptions = isObjectOptions ? { initialNumItems: queryOrOptions.initialNumItems } : options;\n if (typeof initialOptions?.initialNumItems !== \"number\" || initialOptions.initialNumItems < 0) {\n throw new Error(\n `\\`options.initialNumItems\\` must be a positive number. Received \\`${initialOptions?.initialNumItems}\\`.`\n );\n }\n const skip = queryArgs === \"skip\";\n const argsObject = skip ? {} : queryArgs;\n const convexClient = useConvex();\n const logger = convexClient.logger;\n const createInitialState = () => {\n const id = nextPaginationId();\n return {\n query,\n args: argsObject,\n id,\n // Queries will contain zero or one queries forever.\n queries: skip ? {} : {\n paginatedQuery: {\n query,\n args: {\n ...argsObject\n },\n paginationOptions: {\n initialNumItems: initialOptions.initialNumItems,\n id\n }\n }\n },\n skip\n };\n };\n const [state, setState] = useState(createInitialState);\n let currState = state;\n if (getFunctionName(query) !== getFunctionName(state.query) || JSON.stringify(convexToJson(argsObject)) !== JSON.stringify(convexToJson(state.args)) || skip !== state.skip) {\n currState = createInitialState();\n setState(currState);\n }\n const resultsObject = useQueries(currState.queries);\n if (!(\"paginatedQuery\" in resultsObject)) {\n if (!skip) {\n throw new Error(\"Why is it missing?\");\n }\n const internalResult2 = {\n results: [],\n status: \"LoadingFirstPage\",\n isLoading: true,\n loadMore: function skipNOP(_numItems) {\n return false;\n }\n };\n if (isObjectOptions) {\n return reshapeToObjectForm2(\n internalResult2\n );\n }\n return internalResult2;\n }\n const result = resultsObject.paginatedQuery;\n if (result === void 0) {\n const internalResult2 = {\n results: [],\n loadMore: () => false,\n isLoading: true,\n status: \"LoadingFirstPage\"\n };\n if (isObjectOptions) {\n return reshapeToObjectForm2(\n internalResult2\n );\n }\n return internalResult2;\n }\n if (result instanceof Error) {\n if (result.message.includes(\"InvalidCursor\") || result instanceof ConvexError && typeof result.data === \"object\" && result.data?.isConvexSystemError === true && result.data?.paginationError === \"InvalidCursor\") {\n logger.warn(\n \"usePaginatedQuery hit error, resetting pagination state: \" + result.message\n );\n setState(createInitialState);\n const internalResult2 = {\n results: [],\n loadMore: () => false,\n isLoading: true,\n status: \"LoadingFirstPage\"\n };\n if (isObjectOptions) {\n return reshapeToObjectForm2(\n internalResult2\n );\n }\n return internalResult2;\n } else {\n if (throwOnError) {\n throw result;\n }\n const internalResult2 = {\n results: [],\n loadMore: () => false,\n isLoading: false,\n status: \"Error\",\n error: result\n };\n if (isObjectOptions) {\n return reshapeToObjectForm2(\n internalResult2\n );\n }\n return internalResult2;\n }\n }\n const internalResult = {\n ...result,\n loadMore: (num) => {\n return result.loadMore(num);\n },\n isLoading: result.status === \"LoadingFirstPage\" ? true : result.status === \"LoadingMore\" ? true : false\n };\n if (isObjectOptions) {\n return reshapeToObjectForm2(\n internalResult\n );\n }\n return internalResult;\n}\nfunction reshapeToObjectForm2(internal) {\n const { results, loadMore } = internal;\n if (internal.status === \"Error\" && \"error\" in internal) {\n return {\n data: results,\n status: \"error\",\n canLoadMore: false,\n isLoading: false,\n error: internal.error,\n loadMore\n };\n }\n if (internal.status === \"LoadingFirstPage\" || internal.status === \"LoadingMore\") {\n return {\n data: internal.status === \"LoadingFirstPage\" ? void 0 : results,\n status: \"pending\",\n canLoadMore: false,\n isLoading: true,\n error: void 0,\n loadMore\n };\n }\n return {\n data: results,\n status: \"success\",\n canLoadMore: internal.status === \"CanLoadMore\",\n isLoading: false,\n error: void 0,\n loadMore\n };\n}\nlet paginationId = 0;\nfunction nextPaginationId() {\n paginationId++;\n return paginationId;\n}\nexport function resetPaginationId() {\n paginationId = 0;\n}\n//# sourceMappingURL=use_paginated_query2.js.map\n","\"use strict\";\nimport React, {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useState\n} from \"react\";\nimport { ConvexProvider } from \"./client.js\";\nconst ConvexAuthContext = createContext(void 0);\nexport function useConvexAuth() {\n const authContext = useContext(ConvexAuthContext);\n if (authContext === void 0) {\n throw new Error(\n \"Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.\"\n );\n }\n return authContext;\n}\nexport function ConvexProviderWithAuth({\n children,\n client,\n useAuth\n}) {\n const {\n isLoading: authProviderLoading,\n isAuthenticated: authProviderAuthenticated,\n fetchAccessToken\n } = useAuth();\n const [isConvexAuthenticated, setIsConvexAuthenticated] = useState(null);\n const [isRefreshing, setIsRefreshing] = useState(false);\n if (authProviderLoading && isConvexAuthenticated !== null) {\n setIsConvexAuthenticated(null);\n setIsRefreshing(false);\n }\n if (!authProviderLoading && !authProviderAuthenticated && isConvexAuthenticated !== false) {\n setIsConvexAuthenticated(false);\n setIsRefreshing(false);\n }\n const isAuthenticated = authProviderAuthenticated && (isConvexAuthenticated ?? false);\n const isLoading = isConvexAuthenticated === null;\n const isRefreshingWhileAuthenticated = isRefreshing && isAuthenticated;\n const authState = useMemo(\n () => ({\n isLoading,\n isAuthenticated,\n isRefreshing: isRefreshingWhileAuthenticated\n }),\n [isLoading, isAuthenticated, isRefreshingWhileAuthenticated]\n );\n return /* @__PURE__ */ React.createElement(ConvexAuthContext.Provider, { value: authState }, /* @__PURE__ */ React.createElement(\n ConvexAuthStateFirstEffect,\n {\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n }\n ), /* @__PURE__ */ React.createElement(ConvexProvider, { client }, children), /* @__PURE__ */ React.createElement(\n ConvexAuthStateLastEffect,\n {\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n }\n ));\n}\nfunction ConvexAuthStateFirstEffect({\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n}) {\n useEffect(() => {\n let isThisEffectRelevant = true;\n if (authProviderAuthenticated) {\n client.setAuth(\n fetchAccessToken,\n (backendReportsIsAuthenticated) => {\n if (isThisEffectRelevant) {\n setIsConvexAuthenticated(() => backendReportsIsAuthenticated);\n }\n },\n (isRefreshing) => {\n if (isThisEffectRelevant) {\n setIsRefreshing(isRefreshing);\n }\n }\n );\n return () => {\n isThisEffectRelevant = false;\n setIsConvexAuthenticated(\n (isConvexAuthenticated) => isConvexAuthenticated ? false : null\n );\n setIsRefreshing(false);\n };\n }\n }, [\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n ]);\n return null;\n}\nfunction ConvexAuthStateLastEffect({\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n}) {\n useEffect(() => {\n if (authProviderAuthenticated) {\n return () => {\n client.clearAuth();\n setIsConvexAuthenticated(() => null);\n setIsRefreshing(false);\n };\n }\n }, [\n authProviderAuthenticated,\n fetchAccessToken,\n authProviderLoading,\n client,\n setIsConvexAuthenticated,\n setIsRefreshing\n ]);\n return null;\n}\n//# sourceMappingURL=ConvexAuthState.js.map\n","\"use strict\";\nimport React from \"react\";\nimport { useConvexAuth } from \"./ConvexAuthState.js\";\nexport function Authenticated({ children }) {\n const { isLoading, isAuthenticated } = useConvexAuth();\n if (isLoading || !isAuthenticated) {\n return null;\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, children);\n}\nexport function Unauthenticated({ children }) {\n const { isLoading, isAuthenticated } = useConvexAuth();\n if (isLoading || isAuthenticated) {\n return null;\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, children);\n}\nexport function AuthLoading({ children }) {\n const { isLoading } = useConvexAuth();\n if (!isLoading) {\n return null;\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, children);\n}\nexport function AuthRefreshing({ children }) {\n const { isAuthenticated, isRefreshing } = useConvexAuth();\n if (!isAuthenticated || !isRefreshing) {\n return null;\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, children);\n}\n//# sourceMappingURL=auth_helpers.js.map\n","\"use strict\";\nimport { useMemo } from \"react\";\nimport { useQuery } from \"../react/client.js\";\nimport { makeFunctionReference } from \"../server/api.js\";\nimport { jsonToConvex } from \"../values/index.js\";\nexport function usePreloadedQuery(preloadedQuery) {\n const args = useMemo(\n () => jsonToConvex(preloadedQuery._argsJSON),\n [preloadedQuery._argsJSON]\n );\n const preloadedResult = useMemo(\n () => jsonToConvex(preloadedQuery._valueJSON),\n [preloadedQuery._valueJSON]\n );\n const result = useQuery(\n makeFunctionReference(preloadedQuery._name),\n args\n );\n return result === void 0 ? preloadedResult : result;\n}\n//# sourceMappingURL=hydration.js.map\n","\"use strict\";\nexport * from \"./use_paginated_query.js\";\nexport {\n usePaginatedQuery_experimental\n} from \"./use_paginated_query2.js\";\nexport { usePaginatedQuery } from \"./use_paginated_query.js\";\nexport { useQueries } from \"./use_queries.js\";\nexport * from \"./auth_helpers.js\";\nexport * from \"./ConvexAuthState.js\";\nexport * from \"./hydration.js\";\nexport { useSubscription } from \"./use_subscription.js\";\nexport {\n ConvexReactClient,\n useConvex,\n ConvexProvider,\n useQuery,\n useQuery_experimental,\n useMutation,\n useAction,\n useConvexConnectionState\n} from \"./client.js\";\nexport { convexQueryOptions } from \"../browser/query_options.js\";\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nexport class Long {\n constructor(low, high) {\n __publicField(this, \"low\");\n __publicField(this, \"high\");\n __publicField(this, \"__isUnsignedLong__\");\n this.low = low | 0;\n this.high = high | 0;\n this.__isUnsignedLong__ = true;\n }\n static isLong(obj) {\n return (obj && obj.__isUnsignedLong__) === true;\n }\n // prettier-ignore\n static fromBytesLE(bytes) {\n return new Long(\n bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24,\n bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24\n );\n }\n // prettier-ignore\n toBytesLE() {\n const hi = this.high;\n const lo = this.low;\n return [\n lo & 255,\n lo >>> 8 & 255,\n lo >>> 16 & 255,\n lo >>> 24,\n hi & 255,\n hi >>> 8 & 255,\n hi >>> 16 & 255,\n hi >>> 24\n ];\n }\n static fromNumber(value) {\n if (isNaN(value)) return UZERO;\n if (value < 0) return UZERO;\n if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;\n return new Long(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0);\n }\n toString() {\n return (BigInt(this.high) * BigInt(TWO_PWR_32_DBL) + BigInt(this.low)).toString();\n }\n equals(other) {\n if (!Long.isLong(other)) other = Long.fromValue(other);\n if (this.high >>> 31 === 1 && other.high >>> 31 === 1) return false;\n return this.high === other.high && this.low === other.low;\n }\n notEquals(other) {\n return !this.equals(other);\n }\n comp(other) {\n if (!Long.isLong(other)) other = Long.fromValue(other);\n if (this.equals(other)) return 0;\n return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;\n }\n lessThanOrEqual(other) {\n return this.comp(\n /* validates */\n other\n ) <= 0;\n }\n static fromValue(val) {\n if (typeof val === \"number\") return Long.fromNumber(val);\n return new Long(val.low, val.high);\n }\n}\nconst UZERO = new Long(0, 0);\nconst TWO_PWR_16_DBL = 1 << 16;\nconst TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\nconst TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\nconst MAX_UNSIGNED_VALUE = new Long(4294967295 | 0, 4294967295 | 0);\n//# sourceMappingURL=long.js.map\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nconst INFO_COLOR = \"color:rgb(0, 145, 255)\";\nfunction prefix_for_source(source) {\n switch (source) {\n case \"query\":\n return \"Q\";\n case \"mutation\":\n return \"M\";\n case \"action\":\n return \"A\";\n case \"any\":\n return \"?\";\n }\n}\nexport class DefaultLogger {\n constructor(options) {\n __publicField(this, \"_onLogLineFuncs\");\n __publicField(this, \"_verbose\");\n this._onLogLineFuncs = {};\n this._verbose = options.verbose;\n }\n addLogLineListener(func) {\n let id = Math.random().toString(36).substring(2, 15);\n for (let i = 0; i < 10; i++) {\n if (this._onLogLineFuncs[id] === void 0) {\n break;\n }\n id = Math.random().toString(36).substring(2, 15);\n }\n this._onLogLineFuncs[id] = func;\n return () => {\n delete this._onLogLineFuncs[id];\n };\n }\n logVerbose(...args) {\n if (this._verbose) {\n for (const func of Object.values(this._onLogLineFuncs)) {\n func(\"debug\", `${(/* @__PURE__ */ new Date()).toISOString()}`, ...args);\n }\n }\n }\n log(...args) {\n for (const func of Object.values(this._onLogLineFuncs)) {\n func(\"info\", ...args);\n }\n }\n warn(...args) {\n for (const func of Object.values(this._onLogLineFuncs)) {\n func(\"warn\", ...args);\n }\n }\n error(...args) {\n for (const func of Object.values(this._onLogLineFuncs)) {\n func(\"error\", ...args);\n }\n }\n}\nexport function instantiateDefaultLogger(options) {\n const logger = new DefaultLogger(options);\n logger.addLogLineListener((level, ...args) => {\n switch (level) {\n case \"debug\":\n console.debug(...args);\n break;\n case \"info\":\n console.log(...args);\n break;\n case \"warn\":\n console.warn(...args);\n break;\n case \"error\":\n console.error(...args);\n break;\n default: {\n level;\n console.log(...args);\n }\n }\n });\n return logger;\n}\nexport function instantiateNoopLogger(options) {\n return new DefaultLogger(options);\n}\nexport function logForFunction(logger, type, source, udfPath, message) {\n const prefix = prefix_for_source(source);\n if (typeof message === \"object\") {\n message = `ConvexError ${JSON.stringify(message.errorData, null, 2)}`;\n }\n if (type === \"info\") {\n const match = message.match(/^\\[.*?\\] /);\n if (match === null) {\n logger.error(\n `[CONVEX ${prefix}(${udfPath})] Could not parse console.log`\n );\n return;\n }\n const level = message.slice(1, match[0].length - 2);\n const args = message.slice(match[0].length);\n logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);\n } else {\n logger.error(`[CONVEX ${prefix}(${udfPath})] ${message}`);\n }\n}\nexport function logFatalError(logger, message) {\n const errorMessage = `[CONVEX FATAL ERROR] ${message}`;\n logger.error(errorMessage);\n return new Error(errorMessage);\n}\nexport function createHybridErrorStacktrace(source, udfPath, result) {\n const prefix = prefix_for_source(source);\n return `[CONVEX ${prefix}(${udfPath})] ${result.errorMessage}\n Called by client`;\n}\nexport function forwardData(result, error) {\n error.data = result.errorData;\n return error;\n}\n//# sourceMappingURL=logging.js.map\n","\"use strict\";\nvar lookup = [];\nvar revLookup = [];\nvar Arr = Uint8Array;\nvar code = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n}\nrevLookup[\"-\".charCodeAt(0)] = 62;\nrevLookup[\"_\".charCodeAt(0)] = 63;\nfunction getLens(b64) {\n var len = b64.length;\n if (len % 4 > 0) {\n throw new Error(\"Invalid string. Length must be a multiple of 4\");\n }\n var validLen = b64.indexOf(\"=\");\n if (validLen === -1) validLen = len;\n var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n}\nexport function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\nfunction _byteLength(_b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\nexport function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i;\n for (i = 0; i < len; i += 4) {\n tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n}\nfunction tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n}\nfunction encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join(\"\");\n}\nexport function fromByteArray(uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(\n encodeChunk(\n uint8,\n i,\n i + maxChunkLength > len2 ? len2 : i + maxChunkLength\n )\n );\n }\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + \"==\");\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + \"=\"\n );\n }\n return parts.join(\"\");\n}\nexport function fromByteArrayUrlSafeNoPadding(uint8) {\n return fromByteArray(uint8).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n//# sourceMappingURL=base64.js.map\n","\"use strict\";\nconst markNames = [\n \"convexClientConstructed\",\n \"convexWebSocketOpen\",\n \"convexFirstMessageReceived\"\n];\nexport function mark(name, sessionId) {\n const detail = { sessionId };\n if (typeof performance === \"undefined\" || !performance.mark) return;\n performance.mark(name, { detail });\n}\nfunction performanceMarkToJson(mark2) {\n let name = mark2.name.slice(\"convex\".length);\n name = name.charAt(0).toLowerCase() + name.slice(1);\n return {\n name,\n startTime: mark2.startTime\n };\n}\nexport function getMarksReport(sessionId) {\n if (typeof performance === \"undefined\" || !performance.getEntriesByName) {\n return [];\n }\n const allMarks = [];\n for (const name of markNames) {\n const marks = performance.getEntriesByName(name).filter((entry) => entry.entryType === \"mark\").filter((mark2) => mark2.detail.sessionId === sessionId);\n allMarks.push(...marks);\n }\n return allMarks.map(performanceMarkToJson);\n}\n//# sourceMappingURL=metrics.js.map\n","\"use strict\";\nexport const version = \"1.45.0\";\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nexport function asPaginationArgs(value) {\n if (typeof value.paginationOpts.numItems !== \"number\") {\n throw new Error(`Not valid paginated query args: ${JSON.stringify(value)}`);\n }\n return value;\n}\nexport function asPaginationResult(value) {\n if (typeof value !== \"object\" || value === null || !Array.isArray(value.page) || typeof value.isDone !== \"boolean\" || typeof value.continueCursor !== \"string\") {\n throw new Error(`Not a valid paginated query result: ${value?.toString()}`);\n }\n return value;\n}\n//# sourceMappingURL=pagination.js.map\n","\"use strict\";\nexport function newSessionId() {\n return uuidv4();\n}\nfunction uuidv4() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = Math.random() * 16 | 0, v = c === \"x\" ? r : r & 3 | 8;\n return v.toString(16);\n });\n}\n//# sourceMappingURL=session.js.map\n","\"use strict\";\nexport class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, (_m, p) => {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\nfunction base64UrlDecode(str) {\n let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw new Error(\"base64 string is not of the correct length\");\n }\n try {\n return b64DecodeUnicode(output);\n } catch {\n return atob(output);\n }\n}\nexport function jwtDecode(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n }\n options || (options = {});\n const pos = options.header === true ? 0 : 1;\n const part = token.split(\".\")[pos];\n if (typeof part !== \"string\") {\n throw new InvalidTokenError(\n `Invalid token specified: missing part #${pos + 1}`\n );\n }\n let decoded;\n try {\n decoded = base64UrlDecode(part);\n } catch (e) {\n throw new InvalidTokenError(\n `Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`\n );\n }\n try {\n return JSON.parse(decoded);\n } catch (e) {\n throw new InvalidTokenError(\n `Invalid token specified: invalid json for part #${pos + 1} (${e.message})`\n );\n }\n}\n//# sourceMappingURL=index.js.map\n","\"use strict\";\nexport function compareUTF8(a, b) {\n const aLength = a.length;\n const bLength = b.length;\n const length = Math.min(aLength, bLength);\n for (let i = 0; i < length; ) {\n const aCodePoint = a.codePointAt(i);\n const bCodePoint = b.codePointAt(i);\n if (aCodePoint !== bCodePoint) {\n if (aCodePoint < 128 && bCodePoint < 128) {\n return aCodePoint - bCodePoint;\n }\n const aLength2 = utf8Bytes(aCodePoint, aBytes);\n const bLength2 = utf8Bytes(bCodePoint, bBytes);\n return compareArrays(aBytes, aLength2, bBytes, bLength2);\n }\n i += utf16LengthForCodePoint(aCodePoint);\n }\n return aLength - bLength;\n}\nfunction compareArrays(a, aLength, b, bLength) {\n const length = Math.min(aLength, bLength);\n for (let i = 0; i < length; i++) {\n const aValue = a[i];\n const bValue = b[i];\n if (aValue !== bValue) {\n return aValue - bValue;\n }\n }\n return aLength - bLength;\n}\nexport function utf16LengthForCodePoint(aCodePoint) {\n return aCodePoint > 65535 ? 2 : 1;\n}\nconst arr = () => Array.from({ length: 4 }, () => 0);\nconst aBytes = arr();\nconst bBytes = arr();\nfunction utf8Bytes(codePoint, bytes) {\n if (codePoint < 128) {\n bytes[0] = codePoint;\n return 1;\n }\n let count;\n let offset;\n if (codePoint <= 2047) {\n count = 1;\n offset = 192;\n } else if (codePoint <= 65535) {\n count = 2;\n offset = 224;\n } else if (codePoint <= 1114111) {\n count = 3;\n offset = 240;\n } else {\n throw new Error(\"Invalid code point\");\n }\n bytes[0] = (codePoint >> 6 * count) + offset;\n let i = 1;\n for (; count > 0; count--) {\n const temp = codePoint >> 6 * (count - 1);\n bytes[i++] = 128 | temp & 63;\n }\n return i;\n}\nexport function greaterThan(a, b) {\n return compareUTF8(a, b) > 0;\n}\nexport function greaterThanEq(a, b) {\n return compareUTF8(a, b) >= 0;\n}\nexport function lessThan(a, b) {\n return compareUTF8(a, b) < 0;\n}\nexport function lessThanEq(a, b) {\n return compareUTF8(a, b) <= 0;\n}\n//# sourceMappingURL=compare_utf8.js.map\n","\"use strict\";\nexport const functionName = Symbol.for(\"functionName\");\n//# sourceMappingURL=functionName.js.map\n","\"use strict\";\nexport function parseArgs(args) {\n if (args === void 0) {\n return {};\n }\n if (!isSimpleObject(args)) {\n throw new Error(\n `The arguments to a Convex function must be an object. Received: ${args}`\n );\n }\n return args;\n}\nexport function validateDeploymentUrl(deploymentUrl) {\n if (typeof deploymentUrl === \"undefined\") {\n throw new Error(\n `Client created with undefined deployment address. If you used an environment variable, check that it's set.`\n );\n }\n if (typeof deploymentUrl !== \"string\") {\n throw new Error(\n `Invalid deployment address: found ${deploymentUrl}\".`\n );\n }\n if (!(deploymentUrl.startsWith(\"http:\") || deploymentUrl.startsWith(\"https:\"))) {\n throw new Error(\n `Invalid deployment address: Must start with \"https://\" or \"http://\". Found \"${deploymentUrl}\".`\n );\n }\n try {\n new URL(deploymentUrl);\n } catch {\n throw new Error(\n `Invalid deployment address: \"${deploymentUrl}\" is not a valid URL. If you believe this URL is correct, use the \\`skipConvexDeploymentUrlCheck\\` option to bypass this.`\n );\n }\n if (deploymentUrl.endsWith(\".convex.site\")) {\n throw new Error(\n `Invalid deployment address: \"${deploymentUrl}\" 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.`\n );\n }\n}\nexport function isSimpleObject(value) {\n const isObject = typeof value === \"object\";\n const prototype = Object.getPrototypeOf(value);\n const isSimple = prototype === null || prototype === Object.prototype || // Objects generated from other contexts (e.g. across Node.js `vm` modules) will not satisfy the previous\n // conditions but are still simple objects.\n prototype?.constructor?.name === \"Object\";\n return isObject && isSimple;\n}\n//# sourceMappingURL=index.js.map\n","\"use client\";\n\nimport { useEffect, useState, type ReactNode } from \"react\";\nimport { bridgeFetch, getBridgeConfig, isHostedUi } from \"@/lib/bridge\";\n\ntype Status = \"local\" | \"checking\" | \"missing\" | \"offline\" | \"ready\";\n\nexport function LocalBridgeGate({ children }: { children: ReactNode }) {\n const [status, setStatus] = useState<Status>(\"checking\");\n useEffect(() => {\n const controller = new AbortController();\n const check = async (): Promise<Status> => {\n if (!isHostedUi()) { getBridgeConfig(); return \"local\"; }\n if (!getBridgeConfig()) return \"missing\";\n const response = await bridgeFetch(\"/api/health\", { signal: controller.signal });\n if (!response.ok) throw new Error(\"The local bridge rejected this session.\");\n return \"ready\";\n };\n void check().then(setStatus).catch(() => { if (!controller.signal.aborted) setStatus(\"offline\"); });\n return () => controller.abort();\n }, []);\n if (status === \"local\" || status === \"ready\") return children;\n return (\n <main className=\"grid min-h-dvh place-items-center bg-background px-6 text-foreground\">\n <div className=\"max-w-lg space-y-4\">\n <p className=\"font-mono text-xs tracking-[0.22em] text-muted-foreground\">YTDB</p>\n <h1 className=\"text-2xl font-semibold tracking-tight\">{status === \"checking\" ? \"Connecting to YTDB…\" : \"Start the local YTDB bridge\"}</h1>\n {status !== \"checking\" && <><p className=\"text-sm leading-6 text-muted-foreground\">Your database connection stays on this computer. Run the command below and use the browser tab it opens.</p><pre className=\"w-fit rounded-md border bg-muted px-4 py-3 font-mono text-sm\">npx ytdb</pre>{status === \"offline\" && <p className=\"text-sm text-muted-foreground\">This tab has an expired bridge session. Restart the command to create a new one.</p>}</>}\n </div>\n </main>\n );\n}\n","\"use client\";\n\nimport { useLayoutEffect, type ReactNode } from \"react\";\nimport { useThemeStore } from \"@/lib/store/theme\";\nimport { applyTheme } from \"@/lib/themes\";\n\nexport function ThemeProvider({ children }: { children: ReactNode }) {\n const theme = useThemeStore((state) => state.theme);\n\n useLayoutEffect(() => {\n if (!useThemeStore.persist.hasHydrated()) return;\n applyTheme(theme);\n }, [theme]);\n\n useLayoutEffect(() => {\n return useThemeStore.persist.onFinishHydration((state) => {\n applyTheme(state.theme);\n });\n }, []);\n\n return children;\n}\n"],"names":["lookup","Uint8Array","revLookup","length","len","Arr","code","i","b64","Error","charCodeAt","validLen","placeHoldersLen","getLens","indexOf","lens","_b64","_byteLength","byteLength","tmp","arr","toByteArray","curByte","num","end","uint8","output","start","len2","encodeChunk","tripletToBase64","push","parts","maxChunkLength","join","fromByteArrayUrlSafeNoPadding","fromByteArray","extraBytes","replace","LocalBridgeGate","children","status","setStatus","controller","AbortController","check","response","signal","ok","then","catch","aborted","abort","className","ThemeProvider","theme","state","persist","hasHydrated","onFinishHydration"],"mappings":"2CgBYI,EmBPJ,IAAK,I/BDD,EAAI,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