gemi 0.122.0 → 0.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/App.d.ts +9 -0
  4. package/dist/app/App.d.ts.map +1 -1
  5. package/dist/app/index.js +1 -1
  6. package/dist/auth/AuthController.d.ts.map +1 -1
  7. package/dist/bin/gemi.js +4 -1
  8. package/dist/bin/gemi.js.map +3 -3
  9. package/dist/bun/plugin.js +1 -1
  10. package/dist/bun/preload.js +1 -1
  11. package/dist/{chunk-7ftj43vp.js → chunk-019wz697.js} +2 -2
  12. package/dist/{chunk-7ftj43vp.js.map → chunk-019wz697.js.map} +1 -1
  13. package/dist/{chunk-s5k3yq6t.js → chunk-121p4g9j.js} +2 -2
  14. package/dist/{chunk-s5k3yq6t.js.map → chunk-121p4g9j.js.map} +1 -1
  15. package/dist/{chunk-tewhms9w.js → chunk-17dndh5z.js} +2 -2
  16. package/dist/{chunk-3gsv1vv1.js.map → chunk-17dndh5z.js.map} +1 -1
  17. package/dist/{chunk-r01aqf0q.js → chunk-1qwhty9p.js} +2 -2
  18. package/dist/{chunk-r01aqf0q.js.map → chunk-1qwhty9p.js.map} +1 -1
  19. package/dist/{chunk-471htqmz.js → chunk-1rnh9qrp.js} +2 -2
  20. package/dist/{chunk-471htqmz.js.map → chunk-1rnh9qrp.js.map} +1 -1
  21. package/dist/{chunk-dedqr5wb.js → chunk-2affxmkn.js} +2 -2
  22. package/dist/{chunk-dedqr5wb.js.map → chunk-2affxmkn.js.map} +1 -1
  23. package/dist/{chunk-19dpzp4y.js → chunk-2n4490pk.js} +3 -3
  24. package/dist/{chunk-19dpzp4y.js.map → chunk-2n4490pk.js.map} +1 -1
  25. package/dist/{chunk-9xyxbxgk.js → chunk-30xxc6r7.js} +2 -2
  26. package/dist/{chunk-9xyxbxgk.js.map → chunk-30xxc6r7.js.map} +1 -1
  27. package/dist/{chunk-vx7hvyvq.js → chunk-34fkx6kb.js} +2 -2
  28. package/dist/{chunk-vx7hvyvq.js.map → chunk-34fkx6kb.js.map} +1 -1
  29. package/dist/{chunk-5nj94s66.js → chunk-3hqwz48c.js} +4 -4
  30. package/dist/{chunk-5nj94s66.js.map → chunk-3hqwz48c.js.map} +1 -1
  31. package/dist/{chunk-dhbgrv58.js → chunk-3j6s5bmx.js} +1 -1
  32. package/dist/{chunk-cskqet01.js → chunk-3y294mb8.js} +2 -2
  33. package/dist/{chunk-cskqet01.js.map → chunk-3y294mb8.js.map} +1 -1
  34. package/dist/{chunk-qsz9241c.js → chunk-4drnyymm.js} +2 -2
  35. package/dist/{chunk-qsz9241c.js.map → chunk-4drnyymm.js.map} +1 -1
  36. package/dist/{chunk-zg6hmc48.js → chunk-5e22tm7m.js} +1 -1
  37. package/dist/chunk-5j50q4g8.js +57 -0
  38. package/dist/{chunk-3s21p9n2.js.map → chunk-5j50q4g8.js.map} +19 -9
  39. package/dist/{chunk-0k02tza1.js → chunk-65s834td.js} +1 -1
  40. package/dist/{chunk-7mmw0jr2.js → chunk-675kzd7z.js} +2 -2
  41. package/dist/{chunk-7mmw0jr2.js.map → chunk-675kzd7z.js.map} +1 -1
  42. package/dist/{chunk-gy81nd9a.js → chunk-6bgb1nhq.js} +2 -2
  43. package/dist/{chunk-gy81nd9a.js.map → chunk-6bgb1nhq.js.map} +1 -1
  44. package/dist/chunk-70nnh0y7.js +5 -0
  45. package/dist/{chunk-htgmy3x7.js.map → chunk-70nnh0y7.js.map} +1 -1
  46. package/dist/{chunk-er8acmch.js → chunk-75ewjc4a.js} +2 -2
  47. package/dist/{chunk-er8acmch.js.map → chunk-75ewjc4a.js.map} +1 -1
  48. package/dist/{chunk-2c0s0561.js → chunk-7gfdts60.js} +2 -2
  49. package/dist/{chunk-2c0s0561.js.map → chunk-7gfdts60.js.map} +1 -1
  50. package/dist/{chunk-zefs2b6h.js → chunk-8m2htvjn.js} +2 -2
  51. package/dist/{chunk-zefs2b6h.js.map → chunk-8m2htvjn.js.map} +1 -1
  52. package/dist/{chunk-dwedx1jb.js → chunk-92sk56n0.js} +3 -3
  53. package/dist/{chunk-dwedx1jb.js.map → chunk-92sk56n0.js.map} +1 -1
  54. package/dist/{chunk-yds7zwc3.js → chunk-96a1459v.js} +2 -2
  55. package/dist/{chunk-yds7zwc3.js.map → chunk-96a1459v.js.map} +1 -1
  56. package/dist/{chunk-c7qs1xp3.js → chunk-9tr92nwy.js} +2 -2
  57. package/dist/{chunk-c7qs1xp3.js.map → chunk-9tr92nwy.js.map} +1 -1
  58. package/dist/{chunk-1wnnkde0.js → chunk-a3g7y70h.js} +3 -3
  59. package/dist/{chunk-1wnnkde0.js.map → chunk-a3g7y70h.js.map} +1 -1
  60. package/dist/{chunk-zrcd9hxr.js → chunk-b5afy6k9.js} +2 -2
  61. package/dist/{chunk-zrcd9hxr.js.map → chunk-b5afy6k9.js.map} +1 -1
  62. package/dist/{chunk-c0v61fp5.js → chunk-bnt8kx6x.js} +2 -2
  63. package/dist/{chunk-c0v61fp5.js.map → chunk-bnt8kx6x.js.map} +1 -1
  64. package/dist/{chunk-5tdxbwzg.js → chunk-bt9qv2jj.js} +3 -3
  65. package/dist/{chunk-5tdxbwzg.js.map → chunk-bt9qv2jj.js.map} +1 -1
  66. package/dist/{chunk-y6wt5b6t.js → chunk-c4jnxmf2.js} +1 -1
  67. package/dist/{chunk-ep0baa9g.js → chunk-cfdwsvtx.js} +2 -2
  68. package/dist/{chunk-ep0baa9g.js.map → chunk-cfdwsvtx.js.map} +1 -1
  69. package/dist/{chunk-51w5ktv2.js → chunk-dxfhhw5h.js} +2 -2
  70. package/dist/{chunk-51w5ktv2.js.map → chunk-dxfhhw5h.js.map} +1 -1
  71. package/dist/{chunk-pn2x59ge.js → chunk-f29pktad.js} +3 -3
  72. package/dist/{chunk-pn2x59ge.js.map → chunk-f29pktad.js.map} +1 -1
  73. package/dist/chunk-f4cmz31h.js +58 -0
  74. package/dist/{chunk-3rvn9a76.js.map → chunk-f4cmz31h.js.map} +3 -3
  75. package/dist/{chunk-0ejjgzwc.js → chunk-fn2qfwgx.js} +2 -2
  76. package/dist/{chunk-0ejjgzwc.js.map → chunk-fn2qfwgx.js.map} +1 -1
  77. package/dist/{chunk-pemhmjzp.js → chunk-fvrmptd0.js} +3 -3
  78. package/dist/{chunk-pemhmjzp.js.map → chunk-fvrmptd0.js.map} +1 -1
  79. package/dist/{chunk-qy8c0gzr.js → chunk-fw7ds23a.js} +2 -2
  80. package/dist/{chunk-qy8c0gzr.js.map → chunk-fw7ds23a.js.map} +1 -1
  81. package/dist/{chunk-fenc5tpv.js → chunk-h3p8qzft.js} +2 -2
  82. package/dist/{chunk-fenc5tpv.js.map → chunk-h3p8qzft.js.map} +1 -1
  83. package/dist/{chunk-wjkh2gem.js → chunk-j7v7dft7.js} +1 -1
  84. package/dist/chunk-jctb7v53.js +4 -0
  85. package/dist/chunk-jctb7v53.js.map +10 -0
  86. package/dist/{chunk-wqe47c0j.js → chunk-jys8y39p.js} +2 -2
  87. package/dist/{chunk-wqe47c0j.js.map → chunk-jys8y39p.js.map} +1 -1
  88. package/dist/{chunk-m83zm86m.js → chunk-kc924zjz.js} +2 -2
  89. package/dist/{chunk-m83zm86m.js.map → chunk-kc924zjz.js.map} +1 -1
  90. package/dist/{chunk-32n8t8x6.js → chunk-kzsjyvvc.js} +2 -2
  91. package/dist/{chunk-32n8t8x6.js.map → chunk-kzsjyvvc.js.map} +1 -1
  92. package/dist/{chunk-meg8rtr6.js → chunk-mqtfaqx5.js} +2 -2
  93. package/dist/{chunk-meg8rtr6.js.map → chunk-mqtfaqx5.js.map} +1 -1
  94. package/dist/{chunk-7g649j8h.js → chunk-mrswc6qw.js} +2 -2
  95. package/dist/{chunk-7g649j8h.js.map → chunk-mrswc6qw.js.map} +1 -1
  96. package/dist/{chunk-gc2dz11k.js → chunk-mvkz22p4.js} +2 -2
  97. package/dist/{chunk-gc2dz11k.js.map → chunk-mvkz22p4.js.map} +1 -1
  98. package/dist/{chunk-4acpw92g.js → chunk-n0r5xyk2.js} +3 -3
  99. package/dist/{chunk-4acpw92g.js.map → chunk-n0r5xyk2.js.map} +1 -1
  100. package/dist/{chunk-cca0grq3.js → chunk-n1a2zj5z.js} +2 -2
  101. package/dist/{chunk-cca0grq3.js.map → chunk-n1a2zj5z.js.map} +1 -1
  102. package/dist/{chunk-d5f1m3d2.js → chunk-nkzmk7v3.js} +2 -2
  103. package/dist/{chunk-d5f1m3d2.js.map → chunk-nkzmk7v3.js.map} +1 -1
  104. package/dist/{chunk-3gsv1vv1.js → chunk-nn2jeat2.js} +2 -2
  105. package/dist/{chunk-tewhms9w.js.map → chunk-nn2jeat2.js.map} +1 -1
  106. package/dist/chunk-nnarmbjv.js +5 -0
  107. package/dist/chunk-nnarmbjv.js.map +10 -0
  108. package/dist/{chunk-h43jp8ws.js → chunk-pe46a5a5.js} +2 -2
  109. package/dist/{chunk-h43jp8ws.js.map → chunk-pe46a5a5.js.map} +1 -1
  110. package/dist/{chunk-6yhpprzs.js → chunk-pmyh33v5.js} +2 -2
  111. package/dist/{chunk-6yhpprzs.js.map → chunk-pmyh33v5.js.map} +1 -1
  112. package/dist/{chunk-mr94nfp1.js → chunk-pya4rqm2.js} +3 -3
  113. package/dist/{chunk-mr94nfp1.js.map → chunk-pya4rqm2.js.map} +1 -1
  114. package/dist/{chunk-jaa6xkeh.js → chunk-qdj8ek8z.js} +2 -2
  115. package/dist/{chunk-jaa6xkeh.js.map → chunk-qdj8ek8z.js.map} +1 -1
  116. package/dist/{chunk-0yj0s1pn.js → chunk-qhz0x97z.js} +2 -2
  117. package/dist/{chunk-0yj0s1pn.js.map → chunk-qhz0x97z.js.map} +1 -1
  118. package/dist/chunk-qycwjzsv.js +9 -0
  119. package/dist/chunk-qycwjzsv.js.map +10 -0
  120. package/dist/{chunk-nz8z8jr1.js → chunk-rpyczdta.js} +3 -3
  121. package/dist/{chunk-nz8z8jr1.js.map → chunk-rpyczdta.js.map} +1 -1
  122. package/dist/{chunk-9rr5h818.js → chunk-rtawbqec.js} +3 -3
  123. package/dist/{chunk-9rr5h818.js.map → chunk-rtawbqec.js.map} +1 -1
  124. package/dist/{chunk-3wnghdsx.js → chunk-rttrpjqk.js} +2 -2
  125. package/dist/{chunk-3wnghdsx.js.map → chunk-rttrpjqk.js.map} +1 -1
  126. package/dist/{chunk-m53fgf20.js → chunk-s5jxc63j.js} +3 -3
  127. package/dist/{chunk-m53fgf20.js.map → chunk-s5jxc63j.js.map} +1 -1
  128. package/dist/{chunk-48gmyaxc.js → chunk-sd0c2001.js} +2 -2
  129. package/dist/{chunk-48gmyaxc.js.map → chunk-sd0c2001.js.map} +1 -1
  130. package/dist/chunk-skf89vrv.js +5 -0
  131. package/dist/chunk-skf89vrv.js.map +10 -0
  132. package/dist/chunk-szn2n976.js +24 -0
  133. package/dist/{chunk-2yw4yezc.js.map → chunk-szn2n976.js.map} +3 -3
  134. package/dist/{chunk-gemzbw7f.js → chunk-v2ggafz1.js} +2 -2
  135. package/dist/{chunk-gemzbw7f.js.map → chunk-v2ggafz1.js.map} +1 -1
  136. package/dist/{chunk-rhek27sj.js → chunk-v8v5qfnh.js} +3 -3
  137. package/dist/{chunk-rhek27sj.js.map → chunk-v8v5qfnh.js.map} +1 -1
  138. package/dist/{chunk-d2c3947c.js → chunk-w3812s34.js} +2 -2
  139. package/dist/{chunk-d2c3947c.js.map → chunk-w3812s34.js.map} +1 -1
  140. package/dist/{chunk-tk135gmj.js → chunk-w4z6x54b.js} +3 -3
  141. package/dist/{chunk-tk135gmj.js.map → chunk-w4z6x54b.js.map} +1 -1
  142. package/dist/{chunk-65beps2q.js → chunk-w61sphn5.js} +3 -3
  143. package/dist/{chunk-65beps2q.js.map → chunk-w61sphn5.js.map} +1 -1
  144. package/dist/{chunk-cvr5624r.js → chunk-wbg2tza5.js} +1 -1
  145. package/dist/{chunk-9d2d08qm.js → chunk-y434jc1c.js} +2 -2
  146. package/dist/{chunk-9d2d08qm.js.map → chunk-y434jc1c.js.map} +1 -1
  147. package/dist/{chunk-shfe0b22.js → chunk-ykz38t0t.js} +2 -2
  148. package/dist/{chunk-shfe0b22.js.map → chunk-ykz38t0t.js.map} +1 -1
  149. package/dist/{chunk-krk7mcgm.js → chunk-yzhv93b0.js} +3 -3
  150. package/dist/{chunk-krk7mcgm.js.map → chunk-yzhv93b0.js.map} +1 -1
  151. package/dist/{chunk-rhvc1axc.js → chunk-z5jydj5r.js} +2 -2
  152. package/dist/{chunk-rhvc1axc.js.map → chunk-z5jydj5r.js.map} +1 -1
  153. package/dist/chunk-zmf3vhex.js +10 -0
  154. package/dist/{chunk-dyp0wg9e.js.map → chunk-zmf3vhex.js.map} +8 -4
  155. package/dist/{chunk-sx340k85.js → chunk-zsfwcdqn.js} +2 -2
  156. package/dist/{chunk-sx340k85.js.map → chunk-zsfwcdqn.js.map} +1 -1
  157. package/dist/{chunk-4fx8p02c.js → chunk-zsvav1dk.js} +2 -2
  158. package/dist/{chunk-4fx8p02c.js.map → chunk-zsvav1dk.js.map} +1 -1
  159. package/dist/chunks/{ThemeProvider-BLI4zpLu.js → ThemeProvider-CbOx8IRl.js} +581 -2
  160. package/dist/chunks/ThemeProvider-CbOx8IRl.js.map +1 -0
  161. package/dist/client/auth/useEmailCode.d.ts.map +1 -1
  162. package/dist/client/auth/useSignIn.d.ts.map +1 -1
  163. package/dist/client/auth/useSignOut.d.ts.map +1 -1
  164. package/dist/client/index.d.ts +5 -1
  165. package/dist/client/index.d.ts.map +1 -1
  166. package/dist/client/index.js +216 -8
  167. package/dist/client/index.js.map +1 -1
  168. package/dist/client/init.d.ts +8 -0
  169. package/dist/client/init.d.ts.map +1 -1
  170. package/dist/client/realtime/FakeSocket.d.ts +47 -0
  171. package/dist/client/realtime/FakeSocket.d.ts.map +1 -0
  172. package/dist/client/realtime/RealtimeClient.d.ts +169 -0
  173. package/dist/client/realtime/RealtimeClient.d.ts.map +1 -0
  174. package/dist/client/realtime/RealtimeContext.d.ts +8 -0
  175. package/dist/client/realtime/RealtimeContext.d.ts.map +1 -0
  176. package/dist/client/realtime/useChannelSubscription.d.ts +32 -0
  177. package/dist/client/realtime/useChannelSubscription.d.ts.map +1 -0
  178. package/dist/client/rpc.d.ts +11 -0
  179. package/dist/client/rpc.d.ts.map +1 -1
  180. package/dist/client/useChannel.d.ts +87 -0
  181. package/dist/client/useChannel.d.ts.map +1 -0
  182. package/dist/client/useMutation.d.ts.map +1 -1
  183. package/dist/client/useQuery.d.ts +13 -0
  184. package/dist/client/useQuery.d.ts.map +1 -1
  185. package/dist/config/index.js +1 -1
  186. package/dist/console/run.js +2 -2
  187. package/dist/console/run.js.map +1 -1
  188. package/dist/container/index.js +2 -2
  189. package/dist/container/index.js.map +1 -1
  190. package/dist/database/index.js +2 -2
  191. package/dist/database/index.js.map +1 -1
  192. package/dist/email/index.js +2 -2
  193. package/dist/email/index.js.map +1 -1
  194. package/dist/facades/Broadcast.d.ts +68 -0
  195. package/dist/facades/Broadcast.d.ts.map +1 -0
  196. package/dist/facades/index.d.ts +1 -0
  197. package/dist/facades/index.d.ts.map +1 -1
  198. package/dist/facades/index.js +2 -2
  199. package/dist/facades/index.js.map +1 -1
  200. package/dist/foundation/index.js +2 -2
  201. package/dist/foundation/index.js.map +1 -1
  202. package/dist/gemi.d.ts +19 -6
  203. package/dist/http/ChannelRouter.d.ts +171 -0
  204. package/dist/http/ChannelRouter.d.ts.map +1 -0
  205. package/dist/http/index.d.ts +1 -0
  206. package/dist/http/index.d.ts.map +1 -1
  207. package/dist/http/index.js +2 -2
  208. package/dist/http/index.js.map +1 -1
  209. package/dist/i18n/dictionaryRuntime.js +2 -2
  210. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  211. package/dist/i18n/index.js +2 -2
  212. package/dist/i18n/index.js.map +2 -2
  213. package/dist/kernel/Kernel.d.ts +6 -0
  214. package/dist/kernel/Kernel.d.ts.map +1 -1
  215. package/dist/kernel/index.js +3 -3
  216. package/dist/kernel/index.js.map +5 -6
  217. package/dist/kernel/providers.d.ts +2 -2
  218. package/dist/kernel/providers.d.ts.map +1 -1
  219. package/dist/orm/context.d.ts.map +1 -1
  220. package/dist/orm/index.js +2 -2
  221. package/dist/orm/index.js.map +1 -1
  222. package/dist/server/Server.d.ts.map +1 -1
  223. package/dist/server/httpDev.d.ts +1 -2
  224. package/dist/server/httpDev.d.ts.map +1 -1
  225. package/dist/server/httpProd.d.ts +1 -1
  226. package/dist/server/httpProd.d.ts.map +1 -1
  227. package/dist/server/index.js +2 -2
  228. package/dist/server/index.js.map +3 -3
  229. package/dist/server/shutdown.d.ts +9 -0
  230. package/dist/server/shutdown.d.ts.map +1 -1
  231. package/dist/services/broadcast/BroadcastDriver.d.ts +75 -0
  232. package/dist/services/broadcast/BroadcastDriver.d.ts.map +1 -0
  233. package/dist/services/broadcast/BroadcastEvent.d.ts +67 -0
  234. package/dist/services/broadcast/BroadcastEvent.d.ts.map +1 -0
  235. package/dist/services/broadcast/BroadcastManager.d.ts +148 -0
  236. package/dist/services/broadcast/BroadcastManager.d.ts.map +1 -0
  237. package/dist/services/broadcast/BroadcastServiceProvider.d.ts +26 -0
  238. package/dist/services/broadcast/BroadcastServiceProvider.d.ts.map +1 -0
  239. package/dist/services/broadcast/FakeBroadcastManager.d.ts +45 -0
  240. package/dist/services/broadcast/FakeBroadcastManager.d.ts.map +1 -0
  241. package/dist/services/broadcast/MemoryBroadcastDriver.d.ts +23 -0
  242. package/dist/services/broadcast/MemoryBroadcastDriver.d.ts.map +1 -0
  243. package/dist/services/broadcast/RedisBroadcastDriver.d.ts +155 -0
  244. package/dist/services/broadcast/RedisBroadcastDriver.d.ts.map +1 -0
  245. package/dist/services/broadcast/SocketHub.d.ts +201 -0
  246. package/dist/services/broadcast/SocketHub.d.ts.map +1 -0
  247. package/dist/services/broadcast/brand.d.ts +16 -0
  248. package/dist/services/broadcast/brand.d.ts.map +1 -0
  249. package/dist/services/broadcast/channels.d.ts +77 -0
  250. package/dist/services/broadcast/channels.d.ts.map +1 -0
  251. package/dist/services/broadcast/config.d.ts +106 -0
  252. package/dist/services/broadcast/config.d.ts.map +1 -0
  253. package/dist/services/broadcast/protocol.d.ts +123 -0
  254. package/dist/services/broadcast/protocol.d.ts.map +1 -0
  255. package/dist/services/broadcast/socketTag.d.ts +17 -0
  256. package/dist/services/broadcast/socketTag.d.ts.map +1 -0
  257. package/dist/services/broadcast/types.d.ts +27 -0
  258. package/dist/services/broadcast/types.d.ts.map +1 -0
  259. package/dist/services/broadcast/wire.d.ts +35 -0
  260. package/dist/services/broadcast/wire.d.ts.map +1 -0
  261. package/dist/services/broadcast/workerWarning.d.ts +10 -0
  262. package/dist/services/broadcast/workerWarning.d.ts.map +1 -0
  263. package/dist/services/events/EventManager.d.ts +6 -0
  264. package/dist/services/events/EventManager.d.ts.map +1 -1
  265. package/dist/services/index.d.ts +10 -0
  266. package/dist/services/index.d.ts.map +1 -1
  267. package/dist/services/index.js +9 -9
  268. package/dist/services/index.js.map +4 -3
  269. package/dist/services/queue/WorkerProcess.d.ts.map +1 -1
  270. package/dist/services/queue/work.js +2 -2
  271. package/dist/services/queue/work.js.map +5 -4
  272. package/dist/services/router/config.d.ts +7 -0
  273. package/dist/services/router/config.d.ts.map +1 -1
  274. package/dist/stats/route-table.js +1 -1
  275. package/dist/support/index.js +2 -2
  276. package/dist/support/index.js.map +1 -1
  277. package/dist/testing/Page.d.ts +8 -0
  278. package/dist/testing/Page.d.ts.map +1 -1
  279. package/dist/testing/index.d.ts +2 -0
  280. package/dist/testing/index.d.ts.map +1 -1
  281. package/dist/testing/index.js +174 -8
  282. package/dist/testing/index.js.map +1 -1
  283. package/dist/vitest/index.js +1 -1
  284. package/package.json +1 -1
  285. package/skills/gemi-react-best-practices/SKILL.md +3 -1
  286. package/skills/gemi-react-best-practices/rules/query-live-over-polling.md +56 -0
  287. package/dist/chunk-2n3pgfnb.js +0 -5
  288. package/dist/chunk-2n3pgfnb.js.map +0 -10
  289. package/dist/chunk-2yw4yezc.js +0 -24
  290. package/dist/chunk-3rvn9a76.js +0 -58
  291. package/dist/chunk-3s21p9n2.js +0 -57
  292. package/dist/chunk-dyp0wg9e.js +0 -10
  293. package/dist/chunk-htgmy3x7.js +0 -5
  294. package/dist/chunk-krtybgz1.js +0 -4
  295. package/dist/chunk-krtybgz1.js.map +0 -10
  296. package/dist/chunk-s07v65x6.js +0 -9
  297. package/dist/chunk-s07v65x6.js.map +0 -10
  298. package/dist/chunks/ThemeProvider-BLI4zpLu.js.map +0 -1
  299. /package/dist/{chunk-dhbgrv58.js.map → chunk-3j6s5bmx.js.map} +0 -0
  300. /package/dist/{chunk-zg6hmc48.js.map → chunk-5e22tm7m.js.map} +0 -0
  301. /package/dist/{chunk-0k02tza1.js.map → chunk-65s834td.js.map} +0 -0
  302. /package/dist/{chunk-y6wt5b6t.js.map → chunk-c4jnxmf2.js.map} +0 -0
  303. /package/dist/{chunk-wjkh2gem.js.map → chunk-j7v7dft7.js.map} +0 -0
  304. /package/dist/{chunk-cvr5624r.js.map → chunk-wbg2tza5.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Q as I}from"./chunk-0ejjgzwc.js";import{_ as A}from"./chunk-zrcd9hxr.js";import"./chunk-s5k3yq6t.js";import{aa as f}from"./chunk-32n8t8x6.js";import{ij as t,mj as T}from"./chunk-tewhms9w.js";var N=t(I(),1),a=t(f(),1),d=t(A(),1);import{readFileSync as g}from"fs";var c=(e)=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:r,webIdentityToken:i,providerId:n,policyArns:m,policy:S,durationSeconds:l}=e,{roleAssumerWithWebIdentity:E}=e;if(!E){let{getDefaultRoleAssumerWithWebIdentity:p}=await import("./chunk-jaa6xkeh.js").then((m)=>t(m.default,1));E=p({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return E({RoleArn:o,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:n,PolicyArns:m,Policy:S,DurationSeconds:l})};var _="AWS_WEB_IDENTITY_TOKEN_FILE",O="AWS_ROLE_ARN",k="AWS_ROLE_SESSION_NAME",L=(e={})=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[_],r=e?.roleArn??process.env[O],i=e?.roleSessionName??process.env[k];if(!o||!r)throw new a.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});let n=await c({...e,webIdentityToken:d.externalDataInterceptor?.getTokenRecord?.()[o]??g(o,{encoding:"ascii"}),roleArn:r,roleSessionName:i})(s);if(o===process.env[_])N.setCredentialFeature(n,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h");return n};export{c as fromWebToken,L as fromTokenFile};
2
+ import{Q as I}from"./chunk-fn2qfwgx.js";import{_ as A}from"./chunk-b5afy6k9.js";import"./chunk-121p4g9j.js";import{aa as f}from"./chunk-kzsjyvvc.js";import{Jj as t,Nj as T}from"./chunk-17dndh5z.js";var N=t(I(),1),a=t(f(),1),d=t(A(),1);import{readFileSync as g}from"fs";var c=(e)=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:r,webIdentityToken:i,providerId:n,policyArns:m,policy:S,durationSeconds:l}=e,{roleAssumerWithWebIdentity:E}=e;if(!E){let{getDefaultRoleAssumerWithWebIdentity:p}=await import("./chunk-qdj8ek8z.js").then((m)=>t(m.default,1));E=p({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return E({RoleArn:o,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:n,PolicyArns:m,Policy:S,DurationSeconds:l})};var _="AWS_WEB_IDENTITY_TOKEN_FILE",O="AWS_ROLE_ARN",k="AWS_ROLE_SESSION_NAME",L=(e={})=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[_],r=e?.roleArn??process.env[O],i=e?.roleSessionName??process.env[k];if(!o||!r)throw new a.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});let n=await c({...e,webIdentityToken:d.externalDataInterceptor?.getTokenRecord?.()[o]??g(o,{encoding:"ascii"}),roleArn:r,roleSessionName:i})(s);if(o===process.env[_])N.setCredentialFeature(n,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h");return n};export{c as fromWebToken,L as fromTokenFile};
3
3
 
4
- //# debugId=FE3397C062FD3E1564756E2164756E21
4
+ //# debugId=3E5A0D44A9F1FE0F64756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "export const fromWebToken = (init) => async (awsIdentityProperties) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-web-identity - fromWebToken\");\n const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;\n let { roleAssumerWithWebIdentity } = init;\n if (!roleAssumerWithWebIdentity) {\n const { getDefaultRoleAssumerWithWebIdentity } = await import(\"@aws-sdk/nested-clients/sts\");\n roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({\n ...init.clientConfig,\n credentialProviderLogger: init.logger,\n parentClientConfig: {\n ...awsIdentityProperties?.callerClientConfig,\n ...init.parentClientConfig,\n },\n }, init.clientPlugins);\n }\n return roleAssumerWithWebIdentity({\n RoleArn: roleArn,\n RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,\n WebIdentityToken: webIdentityToken,\n ProviderId: providerId,\n PolicyArns: policyArns,\n Policy: policy,\n DurationSeconds: durationSeconds,\n });\n};\n"
7
7
  ],
8
8
  "mappings": ";8NAAA,SACA,KACA,KACA,iBAAS,WCHF,IAAM,EAAe,CAAC,IAAS,MAAO,IAA0B,CACnE,EAAK,QAAQ,MAAM,0DAA0D,EAC7E,IAAQ,UAAS,kBAAiB,mBAAkB,aAAY,aAAY,SAAQ,mBAAoB,GAClG,8BAA+B,EACrC,GAAI,CAAC,EAA4B,CAC7B,IAAQ,wCAAyC,KAAa,yDAC9D,EAA6B,EAAqC,IAC3D,EAAK,aACR,yBAA0B,EAAK,OAC/B,mBAAoB,IACb,GAAuB,sBACvB,EAAK,kBACZ,CACJ,EAAG,EAAK,aAAa,EAEzB,OAAO,EAA2B,CAC9B,QAAS,EACT,gBAAiB,GAAmB,sBAAsB,KAAK,IAAI,IACnE,iBAAkB,EAClB,WAAY,EACZ,WAAY,EACZ,OAAQ,EACR,gBAAiB,CACrB,CAAC,GDlBL,IAAM,EAAiB,8BACjB,EAAe,eACf,EAAwB,wBACjB,EAAgB,CAAC,EAAO,CAAC,IAAM,MAAO,IAA0B,CACzE,EAAK,QAAQ,MAAM,2DAA2D,EAC9E,IAAM,EAAuB,GAAM,sBAAwB,QAAQ,IAAI,GACjE,EAAU,GAAM,SAAW,QAAQ,IAAI,GACvC,EAAkB,GAAM,iBAAmB,QAAQ,IAAI,GAC7D,GAAI,CAAC,GAAwB,CAAC,EAC1B,MAAM,IAAI,2BAAyB,2CAA4C,CAC3E,OAAQ,EAAK,MACjB,CAAC,EAEL,IAAM,EAAc,MAAM,EAAa,IAChC,EACH,iBAAkB,2BAAyB,iBAAiB,EAAE,IAC1D,EAAa,EAAsB,CAAE,SAAU,OAAQ,CAAC,EAC5D,UACA,iBACJ,CAAC,EAAE,CAAqB,EACxB,GAAI,IAAyB,QAAQ,IAAI,GACrC,uBAAqB,EAAa,wCAAyC,GAAG,EAElF,OAAO",
9
- "debugId": "FE3397C062FD3E1564756E2164756E21",
9
+ "debugId": "3E5A0D44A9F1FE0F64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  class A extends Error{constructor(p,q){super(`Target [${p}] is not bound in the container.`+(q.length>0?` Bound tokens: ${q.join(", ")}.`:" No tokens are bound \u2014 was the application booted?"));this.name="BindingResolutionError"}}class C{bindings=new Map;instances=new Map;bind(p,q){this.bindings.set(p.token,{factory:q,shared:!1}),this.instances.delete(p.token)}singleton(p,q){this.bindings.set(p.token,{factory:q,shared:!0}),this.instances.delete(p.token)}instance(p,q){return this.instances.set(p.token,q),q}bound(p){return this.bindings.has(p.token)||this.instances.has(p.token)}resolved(p){return this.instances.has(p.token)}make(p){let q=p.token;if(this.instances.has(q))return this.instances.get(q);let v=this.bindings.get(q);if(!v)throw new A(q,this.keys());let x=v.factory(this);if(v.shared)this.instances.set(q,x);return x}forget(p){this.instances.delete(p.token)}keys(){return[...new Set([...this.bindings.keys(),...this.instances.keys()])]}flush(){this.bindings.clear(),this.instances.clear()}}
3
- export{A as Qi,C as Ri};
3
+ export{A as pj,C as qj};
4
4
 
5
- //# debugId=03048F32BC0020A364756E2164756E21
5
+ //# debugId=E4DACAD868710DAF64756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "/**\n * Tokens are the service classes themselves, so `make(MailManager)` is typed\n * `MailManager` without a cast. The container keys its bindings off the class's\n * `static token` string rather than the constructor object: the built binary\n * (`dist/bin/gemi.js`) bundles its own copy of gemi while the app resolves\n * `gemi/*` to source, so the same service is two distinct class objects across\n * that boundary. A string survives it. Laravel binds both `'mail'` and\n * `MailManager::class` for the same reason.\n */\nexport type ServiceToken<T> = (abstract new (...args: any[]) => T) & {\n token: string;\n};\n\nexport type Factory<T> = (app: Container) => T;\n\ninterface Binding {\n factory: Factory<any>;\n shared: boolean;\n}\n\nexport class BindingResolutionError extends Error {\n constructor(token: string, known: string[]) {\n super(\n `Target [${token}] is not bound in the container.` +\n (known.length > 0\n ? ` Bound tokens: ${known.join(\", \")}.`\n : \" No tokens are bound — was the application booted?\"),\n );\n this.name = \"BindingResolutionError\";\n }\n}\n\nexport class Container {\n private bindings = new Map<string, Binding>();\n private instances = new Map<string, any>();\n\n bind<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: false });\n this.instances.delete(token.token);\n }\n\n /**\n * Lazy by design — `factory` is not called until the first `make()`.\n */\n singleton<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: true });\n this.instances.delete(token.token);\n }\n\n instance<T>(token: ServiceToken<T>, object: T): T {\n this.instances.set(token.token, object);\n return object;\n }\n\n bound<T>(token: ServiceToken<T>): boolean {\n return (\n this.bindings.has(token.token) || this.instances.has(token.token)\n );\n }\n\n resolved<T>(token: ServiceToken<T>): boolean {\n return this.instances.has(token.token);\n }\n\n make<T>(token: ServiceToken<T>): T {\n const key = token.token;\n\n if (this.instances.has(key)) {\n return this.instances.get(key) as T;\n }\n\n const binding = this.bindings.get(key);\n if (!binding) {\n throw new BindingResolutionError(key, this.keys());\n }\n\n const object = binding.factory(this) as T;\n if (binding.shared) {\n this.instances.set(key, object);\n }\n return object;\n }\n\n forget<T>(token: ServiceToken<T>) {\n this.instances.delete(token.token);\n }\n\n keys(): string[] {\n return [\n ...new Set([...this.bindings.keys(), ...this.instances.keys()]),\n ];\n }\n\n flush() {\n this.bindings.clear();\n this.instances.clear();\n }\n}\n"
6
6
  ],
7
7
  "mappings": ";AAoBO,MAAM,UAA+B,KAAM,CAChD,WAAW,CAAC,EAAe,EAAiB,CAC1C,MACE,WAAW,qCACR,EAAM,OAAS,EACZ,kBAAkB,EAAM,KAAK,IAAI,KACjC,0DACR,EACA,KAAK,KAAO,yBAEhB,CAEO,MAAM,CAAU,CACb,SAAW,IAAI,IACf,UAAY,IAAI,IAExB,IAAO,CAAC,EAAwB,EAAqB,CACnD,KAAK,SAAS,IAAI,EAAM,MAAO,CAAE,UAAS,OAAQ,EAAM,CAAC,EACzD,KAAK,UAAU,OAAO,EAAM,KAAK,EAMnC,SAAY,CAAC,EAAwB,EAAqB,CACxD,KAAK,SAAS,IAAI,EAAM,MAAO,CAAE,UAAS,OAAQ,EAAK,CAAC,EACxD,KAAK,UAAU,OAAO,EAAM,KAAK,EAGnC,QAAW,CAAC,EAAwB,EAAc,CAEhD,OADA,KAAK,UAAU,IAAI,EAAM,MAAO,CAAM,EAC/B,EAGT,KAAQ,CAAC,EAAiC,CACxC,OACE,KAAK,SAAS,IAAI,EAAM,KAAK,GAAK,KAAK,UAAU,IAAI,EAAM,KAAK,EAIpE,QAAW,CAAC,EAAiC,CAC3C,OAAO,KAAK,UAAU,IAAI,EAAM,KAAK,EAGvC,IAAO,CAAC,EAA2B,CACjC,IAAM,EAAM,EAAM,MAElB,GAAI,KAAK,UAAU,IAAI,CAAG,EACxB,OAAO,KAAK,UAAU,IAAI,CAAG,EAG/B,IAAM,EAAU,KAAK,SAAS,IAAI,CAAG,EACrC,GAAI,CAAC,EACH,MAAM,IAAI,EAAuB,EAAK,KAAK,KAAK,CAAC,EAGnD,IAAM,EAAS,EAAQ,QAAQ,IAAI,EACnC,GAAI,EAAQ,OACV,KAAK,UAAU,IAAI,EAAK,CAAM,EAEhC,OAAO,EAGT,MAAS,CAAC,EAAwB,CAChC,KAAK,UAAU,OAAO,EAAM,KAAK,EAGnC,IAAI,EAAa,CACf,MAAO,CACL,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,KAAK,EAAG,GAAG,KAAK,UAAU,KAAK,CAAC,CAAC,CAChE,EAGF,KAAK,EAAG,CACN,KAAK,SAAS,MAAM,EACpB,KAAK,UAAU,MAAM,EAEzB",
8
- "debugId": "03048F32BC0020A364756E2164756E21",
8
+ "debugId": "E4DACAD868710DAF64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -726,6 +726,585 @@ function toVariantKey(search) {
726
726
  return searchParams.toString();
727
727
  }
728
728
  //#endregion
729
+ //#region services/broadcast/protocol.ts
730
+ /**
731
+ * The `gemi.v1` WebSocket protocol, shared by the server transport
732
+ * (`SocketHub`) and the browser client (`gemi/client`'s connection manager).
733
+ * Types and constants only: this module is imported by the browser bundle, so
734
+ * it must never import a server module.
735
+ *
736
+ * Every frame is a JSON text frame. Binary frames are refused.
737
+ *
738
+ * From the client:
739
+ *
740
+ * - `{op:"sub", id, ch, p?}`: subscribe `id` (chosen by the client, unique per
741
+ * socket) to the channel pattern `ch` with params `p`. The server builds
742
+ * the topic and authorizes it.
743
+ * - `{op:"unsub", id}`
744
+ * - `{op:"ping"}`: answered with `pong`. The client sends one every
745
+ * `heartbeatMs` and reconnects when it hears nothing for twice that.
746
+ *
747
+ * From the server:
748
+ *
749
+ * - `{op:"hello", socketId, tag, heartbeatMs}`: the first frame. `socketId`
750
+ * goes in the `X-Gemi-Socket` header of the client's own requests (for
751
+ * `Broadcast.toOthers`); it is never shown to anyone else. `tag` is what
752
+ * an event frame's `x` carries when it skips this socket.
753
+ * - `{op:"subscribed", id, t}`: `id` joined topic `t`. Sent only once this
754
+ * process receives the topic's events, so the resync the client runs on it
755
+ * cannot miss one.
756
+ * - `{op:"denied", id, code}`: `id` was refused, or later revoked.
757
+ * - `{op:"ev", t, ev, d?, x?}`: an event on topic `t`. Dropped by the socket
758
+ * whose `tag` is `x`.
759
+ * - `{op:"gap"}`: events may have been lost for this socket; resync all.
760
+ * - `{op:"pong"}`
761
+ * - `{op:"bye", code, retryAfter}`: the server is going away (a restart).
762
+ * Reconnect after `retryAfter` ms.
763
+ */
764
+ /** The WebSocket subprotocol. */
765
+ var BROADCAST_PROTOCOL = "gemi.v1";
766
+ /** The request header a client sends its socket id in, for `toOthers`. */
767
+ var SOCKET_ID_HEADER = "x-gemi-socket";
768
+ /**
769
+ * Close codes the server uses. 1012 and 1013 are the standard "restart" and
770
+ * "try again later"; the 4xxx ones are gemi's own.
771
+ */
772
+ var CloseCode = {
773
+ /** The client went away (tab closed, socket released). */
774
+ Normal: 1e3,
775
+ /** A frame that was not JSON text, or not a known op. */
776
+ UnsupportedData: 1003,
777
+ /** Too many frames, or a frame over the size limit. */
778
+ PolicyViolation: 1008,
779
+ /** The server is restarting; `bye` said when to come back. */
780
+ Restart: 1012,
781
+ /** The socket fell too far behind; reconnect and resync. */
782
+ TryAgainLater: 1013,
783
+ /** The socket's user was signed out or its access revoked. */
784
+ Revoked: 4001
785
+ };
786
+ /**
787
+ * Whether a refusal is final for this socket's session: resubscribing will
788
+ * get the same answer, so the client does not retry it on its own.
789
+ */
790
+ function isPermanentDenial(code) {
791
+ return code === "unknown_channel" || code === "invalid_params" || code === "invalid";
792
+ }
793
+ //#endregion
794
+ //#region client/realtime/RealtimeClient.ts
795
+ /** The minimum gap between two resyncs of one subscription. */
796
+ var RESYNC_COALESCE_MS = 2e3;
797
+ /** How long the socket stays open after its last subscription goes. */
798
+ var IDLE_CLOSE_MS = 5e3;
799
+ /**
800
+ * How long a subscription outlives its last listener. A hook that remounts
801
+ * within it (StrictMode's double mount, a route change back, a list that
802
+ * re-renders its rows) picks the same subscription up again: no `unsub`, no
803
+ * new `sub`, nothing counted against the server's rate limit.
804
+ */
805
+ var RELEASE_LINGER_MS = 1500;
806
+ /** The least wait before resending a `sub` denied with `rate_limited`. */
807
+ var RATE_LIMITED_RETRY_MS = 5e3;
808
+ var MIN_BACKOFF_MS = 1e3;
809
+ var MAX_BACKOFF_MS = 3e4;
810
+ var DEFAULT_HEARTBEAT_MS = 25e3;
811
+ var DEFAULT_HIDDEN_DISCONNECT_MS = 6e4;
812
+ /** `pattern` and its params, canonical: two hooks on one channel share a `sub`. */
813
+ function channelKey(pattern, params) {
814
+ const sorted = Object.keys(params).sort().map((key) => [key, String(params[key])]);
815
+ return `${pattern}\u0000${JSON.stringify(sorted)}`;
816
+ }
817
+ /**
818
+ * The tab's one WebSocket to the app (`gemi.v1`), multiplexing every channel
819
+ * the mounted hooks subscribe to.
820
+ *
821
+ * Opened by the first subscription and closed a few seconds after the last
822
+ * one goes. Reconnects with full-jitter backoff (1 to 30 s), or after the
823
+ * server's `bye.retryAfter`, at once on `online`; resubscribes everything
824
+ * then. A tab hidden for `hiddenDisconnectMs` disconnects, and reconnects
825
+ * when shown. Every `subscribed` ack and every `gap` resyncs the
826
+ * subscription (coalesced to one per 2 s), because events are volatile: a
827
+ * client that may have missed one refetches over HTTP.
828
+ */
829
+ var RealtimeClient = class {
830
+ options;
831
+ internals;
832
+ ws = null;
833
+ entries = /* @__PURE__ */ new Map();
834
+ byId = /* @__PURE__ */ new Map();
835
+ topics = /* @__PURE__ */ new Map();
836
+ nextId = 1;
837
+ attempt = 0;
838
+ tag = null;
839
+ socketIdValue = null;
840
+ heartbeatMs = DEFAULT_HEARTBEAT_MS;
841
+ reconnectTimer = null;
842
+ idleTimer = null;
843
+ hiddenTimer = null;
844
+ pingTimer = null;
845
+ livenessTimer = null;
846
+ retryAfter = null;
847
+ revoked = false;
848
+ pausedWhileHidden = false;
849
+ listening = false;
850
+ constructor(options = {}, internals = {}) {
851
+ this.options = withDefaults(options);
852
+ this.internals = internals;
853
+ }
854
+ configure(options) {
855
+ this.options = withDefaults({
856
+ ...this.options,
857
+ ...options
858
+ });
859
+ }
860
+ /** The id to send as `X-Gemi-Socket`, while the socket is open. */
861
+ get socketId() {
862
+ return this.socketIdValue;
863
+ }
864
+ subscribe(pattern, params, listener) {
865
+ const key = channelKey(pattern, params);
866
+ let entry = this.entries.get(key);
867
+ if (!entry) {
868
+ entry = {
869
+ key,
870
+ id: String(this.nextId++),
871
+ pattern,
872
+ params: { ...params },
873
+ listeners: /* @__PURE__ */ new Set(),
874
+ status: "closed",
875
+ code: null,
876
+ permanent: false,
877
+ topic: null,
878
+ lastResyncAt: 0,
879
+ resyncTimer: null,
880
+ lingerTimer: null,
881
+ retryTimer: null,
882
+ retries: 0
883
+ };
884
+ this.entries.set(key, entry);
885
+ this.byId.set(entry.id, entry);
886
+ if (this.isOpen()) this.sendSub(entry);
887
+ }
888
+ if (entry.lingerTimer) {
889
+ clearTimeout(entry.lingerTimer);
890
+ entry.lingerTimer = null;
891
+ }
892
+ entry.listeners.add(listener);
893
+ listener.onStatus?.(entry.status, entry.code);
894
+ this.cancelIdleClose();
895
+ this.listen();
896
+ if (!this.ws && !this.reconnectTimer && !this.pausedWhileHidden) this.connect();
897
+ let released = false;
898
+ return () => {
899
+ if (released) return;
900
+ released = true;
901
+ this.release(entry, listener);
902
+ };
903
+ }
904
+ release(entry, listener) {
905
+ entry.listeners.delete(listener);
906
+ if (entry.listeners.size > 0 || entry.lingerTimer) return;
907
+ entry.lingerTimer = setTimeout(() => {
908
+ entry.lingerTimer = null;
909
+ if (entry.listeners.size === 0) this.drop(entry);
910
+ }, RELEASE_LINGER_MS);
911
+ }
912
+ drop(entry) {
913
+ if (entry.resyncTimer) clearTimeout(entry.resyncTimer);
914
+ this.clearRetry(entry);
915
+ this.entries.delete(entry.key);
916
+ this.byId.delete(entry.id);
917
+ this.dropTopic(entry);
918
+ if (this.isOpen() && (entry.status === "open" || entry.status === "connecting")) this.send({
919
+ op: "unsub",
920
+ id: entry.id
921
+ });
922
+ if (this.entries.size === 0) this.scheduleIdleClose();
923
+ }
924
+ isOpen() {
925
+ return this.ws !== null && this.ws.readyState === 1;
926
+ }
927
+ connect() {
928
+ if (typeof window === "undefined") return;
929
+ if (this.entries.size === 0) return;
930
+ const Impl = this.internals.WebSocket ?? globalThis.WebSocket;
931
+ if (!Impl) return;
932
+ this.clearReconnect();
933
+ let ws;
934
+ try {
935
+ ws = new Impl(this.url(), [BROADCAST_PROTOCOL]);
936
+ } catch {
937
+ this.scheduleReconnect();
938
+ return;
939
+ }
940
+ this.ws = ws;
941
+ for (const entry of this.entries.values()) if (!entry.permanent) this.setStatus(entry, "connecting", null);
942
+ ws.onopen = () => {
943
+ if (this.ws !== ws) return;
944
+ this.touch();
945
+ for (const entry of this.entries.values()) {
946
+ if (entry.permanent) continue;
947
+ entry.retries = 0;
948
+ this.sendSub(entry);
949
+ }
950
+ };
951
+ ws.onmessage = (event) => {
952
+ if (this.ws !== ws) return;
953
+ this.touch();
954
+ let frame;
955
+ try {
956
+ frame = JSON.parse(String(event.data));
957
+ } catch {
958
+ return;
959
+ }
960
+ this.handle(frame);
961
+ };
962
+ ws.onclose = (event) => {
963
+ if (this.ws !== ws) return;
964
+ this.onClosed(event.code);
965
+ };
966
+ ws.onerror = () => {};
967
+ }
968
+ url() {
969
+ if (this.internals.url) return this.internals.url;
970
+ const { protocol, host } = window.location;
971
+ return `${protocol === "https:" ? "wss:" : "ws:"}//${host}${this.options.path}`;
972
+ }
973
+ sendSub(entry) {
974
+ this.setStatus(entry, "connecting", null);
975
+ const frame = {
976
+ op: "sub",
977
+ id: entry.id,
978
+ ch: entry.pattern
979
+ };
980
+ if (Object.keys(entry.params).length > 0) frame.p = entry.params;
981
+ this.send(frame);
982
+ }
983
+ send(frame) {
984
+ if (!this.isOpen()) return;
985
+ try {
986
+ this.ws.send(JSON.stringify(frame));
987
+ } catch {}
988
+ }
989
+ handle(frame) {
990
+ switch (frame.op) {
991
+ case "hello":
992
+ this.socketIdValue = frame.socketId;
993
+ this.tag = frame.tag;
994
+ this.attempt = 0;
995
+ this.revoked = false;
996
+ if (frame.heartbeatMs > 0) this.heartbeatMs = frame.heartbeatMs;
997
+ this.startHeartbeat();
998
+ return;
999
+ case "subscribed": {
1000
+ const entry = this.byId.get(frame.id);
1001
+ if (!entry) return;
1002
+ this.dropTopic(entry);
1003
+ entry.topic = frame.t;
1004
+ let ids = this.topics.get(frame.t);
1005
+ if (!ids) this.topics.set(frame.t, ids = /* @__PURE__ */ new Set());
1006
+ ids.add(entry.id);
1007
+ this.clearRetry(entry);
1008
+ entry.retries = 0;
1009
+ this.setStatus(entry, "open", null);
1010
+ this.resync(entry);
1011
+ return;
1012
+ }
1013
+ case "denied": {
1014
+ const entry = this.byId.get(frame.id);
1015
+ if (!entry) return;
1016
+ this.dropTopic(entry);
1017
+ entry.permanent = isPermanentDenial(frame.code);
1018
+ this.setStatus(entry, "denied", frame.code);
1019
+ this.scheduleRetry(entry, frame.code);
1020
+ return;
1021
+ }
1022
+ case "ev": {
1023
+ if (frame.x !== void 0 && frame.x === this.tag) return;
1024
+ const ids = this.topics.get(frame.t);
1025
+ if (!ids) return;
1026
+ for (const id of Array.from(ids)) {
1027
+ const entry = this.byId.get(id);
1028
+ if (!entry) continue;
1029
+ for (const listener of Array.from(entry.listeners)) try {
1030
+ listener.onEvent?.(frame.ev, frame.d);
1031
+ } catch (error) {
1032
+ reportListenerError(error);
1033
+ }
1034
+ }
1035
+ return;
1036
+ }
1037
+ case "gap":
1038
+ for (const entry of this.entries.values()) if (entry.status === "open") this.resync(entry);
1039
+ return;
1040
+ case "bye":
1041
+ this.retryAfter = Math.max(0, Number(frame.retryAfter) || 0);
1042
+ return;
1043
+ case "pong": return;
1044
+ }
1045
+ }
1046
+ onClosed(code) {
1047
+ this.ws = null;
1048
+ this.socketIdValue = null;
1049
+ this.tag = null;
1050
+ this.stopHeartbeat();
1051
+ this.topics.clear();
1052
+ for (const entry of this.entries.values()) {
1053
+ entry.topic = null;
1054
+ this.clearRetry(entry);
1055
+ if (!entry.permanent) this.setStatus(entry, "closed", null);
1056
+ }
1057
+ if (code === CloseCode.Revoked) this.revoked = true;
1058
+ if (this.entries.size > 0 && !this.pausedWhileHidden) this.scheduleReconnect();
1059
+ }
1060
+ scheduleReconnect() {
1061
+ this.clearReconnect();
1062
+ let delay;
1063
+ if (this.retryAfter !== null) {
1064
+ delay = this.retryAfter;
1065
+ this.retryAfter = null;
1066
+ } else if (this.revoked) {
1067
+ this.revoked = false;
1068
+ delay = Math.floor(this.random() * 500);
1069
+ } else delay = backoffDelay(this.attempt, this.random());
1070
+ this.attempt++;
1071
+ this.reconnectTimer = setTimeout(() => {
1072
+ this.reconnectTimer = null;
1073
+ this.connect();
1074
+ }, delay);
1075
+ }
1076
+ clearReconnect() {
1077
+ if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
1078
+ this.reconnectTimer = null;
1079
+ }
1080
+ random() {
1081
+ return (this.internals.random ?? Math.random)();
1082
+ }
1083
+ startHeartbeat() {
1084
+ this.stopHeartbeat();
1085
+ this.pingTimer = setInterval(() => this.send({ op: "ping" }), this.heartbeatMs);
1086
+ this.touch();
1087
+ }
1088
+ stopHeartbeat() {
1089
+ if (this.pingTimer) clearInterval(this.pingTimer);
1090
+ if (this.livenessTimer) clearTimeout(this.livenessTimer);
1091
+ this.pingTimer = null;
1092
+ this.livenessTimer = null;
1093
+ }
1094
+ /** Anything from the server proves the socket alive. */
1095
+ touch() {
1096
+ if (this.livenessTimer) clearTimeout(this.livenessTimer);
1097
+ const ws = this.ws;
1098
+ this.livenessTimer = setTimeout(() => {
1099
+ if (this.ws !== ws || !ws) return;
1100
+ try {
1101
+ ws.close();
1102
+ } catch {}
1103
+ this.onClosed(1006);
1104
+ }, this.heartbeatMs * 2);
1105
+ }
1106
+ setStatus(entry, status, code) {
1107
+ if (entry.status === status && entry.code === code) return;
1108
+ entry.status = status;
1109
+ entry.code = code;
1110
+ for (const listener of Array.from(entry.listeners)) try {
1111
+ listener.onStatus?.(status, code);
1112
+ } catch (error) {
1113
+ reportListenerError(error);
1114
+ }
1115
+ }
1116
+ /** At most one resync per subscription per 2 s; a later one is deferred, not dropped. */
1117
+ resync(entry) {
1118
+ if (entry.resyncTimer) return;
1119
+ const now = Date.now();
1120
+ const wait = entry.lastResyncAt + RESYNC_COALESCE_MS - now;
1121
+ const fire = () => {
1122
+ entry.resyncTimer = null;
1123
+ entry.lastResyncAt = Date.now();
1124
+ for (const listener of Array.from(entry.listeners)) try {
1125
+ listener.onResync?.();
1126
+ } catch (error) {
1127
+ reportListenerError(error);
1128
+ }
1129
+ };
1130
+ if (entry.lastResyncAt === 0 || wait <= 0) fire();
1131
+ else entry.resyncTimer = setTimeout(fire, wait);
1132
+ }
1133
+ /**
1134
+ * A transient denial (`rate_limited`, `error`, `limit`) is retried on the
1135
+ * same socket, with backoff: a healthy socket may never reconnect. `denied`
1136
+ * and `revoked` are the channel's answer for this session, so they wait for
1137
+ * the next connection (a sign-in reconnects), and a permanent one is never
1138
+ * resent. `limit` gives up after `MAX_LIMIT_RETRIES` on one socket.
1139
+ */
1140
+ scheduleRetry(entry, code) {
1141
+ if (code !== "rate_limited" && code !== "error" && code !== "limit") return;
1142
+ if (code === "limit" && entry.retries >= 5) return;
1143
+ this.clearRetry(entry);
1144
+ const delay = Math.max(code === "rate_limited" ? RATE_LIMITED_RETRY_MS : MIN_BACKOFF_MS, backoffDelay(entry.retries, this.random()));
1145
+ entry.retries++;
1146
+ entry.retryTimer = setTimeout(() => {
1147
+ entry.retryTimer = null;
1148
+ if (this.entries.get(entry.key) !== entry || entry.status !== "denied") return;
1149
+ if (this.isOpen()) this.sendSub(entry);
1150
+ }, delay);
1151
+ }
1152
+ clearRetry(entry) {
1153
+ if (entry.retryTimer) clearTimeout(entry.retryTimer);
1154
+ entry.retryTimer = null;
1155
+ }
1156
+ dropTopic(entry) {
1157
+ if (!entry.topic) return;
1158
+ const ids = this.topics.get(entry.topic);
1159
+ ids?.delete(entry.id);
1160
+ if (ids && ids.size === 0) this.topics.delete(entry.topic);
1161
+ entry.topic = null;
1162
+ }
1163
+ scheduleIdleClose() {
1164
+ this.cancelIdleClose();
1165
+ this.idleTimer = setTimeout(() => {
1166
+ this.idleTimer = null;
1167
+ if (this.entries.size > 0) return;
1168
+ this.clearReconnect();
1169
+ this.close();
1170
+ }, IDLE_CLOSE_MS);
1171
+ }
1172
+ cancelIdleClose() {
1173
+ if (this.idleTimer) clearTimeout(this.idleTimer);
1174
+ this.idleTimer = null;
1175
+ }
1176
+ /** Closes the socket without reconnecting. */
1177
+ close() {
1178
+ const ws = this.ws;
1179
+ if (!ws) return;
1180
+ this.ws = null;
1181
+ try {
1182
+ ws.close(CloseCode.Normal);
1183
+ } catch {}
1184
+ this.onClosed(CloseCode.Normal);
1185
+ }
1186
+ listen() {
1187
+ if (this.listening || typeof window === "undefined") return;
1188
+ this.listening = true;
1189
+ window.addEventListener("online", this.onOnline);
1190
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", this.onVisibility);
1191
+ }
1192
+ onOnline = () => {
1193
+ if (this.entries.size === 0 || this.ws || this.pausedWhileHidden) return;
1194
+ this.attempt = 0;
1195
+ this.connect();
1196
+ };
1197
+ onVisibility = () => {
1198
+ if (document.visibilityState === "hidden") {
1199
+ if (this.hiddenTimer) return;
1200
+ this.hiddenTimer = setTimeout(() => {
1201
+ this.hiddenTimer = null;
1202
+ if (document.visibilityState !== "hidden") return;
1203
+ this.pausedWhileHidden = true;
1204
+ this.clearReconnect();
1205
+ this.close();
1206
+ }, this.options.hiddenDisconnectMs);
1207
+ return;
1208
+ }
1209
+ if (this.hiddenTimer) clearTimeout(this.hiddenTimer);
1210
+ this.hiddenTimer = null;
1211
+ if (this.pausedWhileHidden) {
1212
+ this.pausedWhileHidden = false;
1213
+ this.attempt = 0;
1214
+ this.connect();
1215
+ }
1216
+ };
1217
+ /**
1218
+ * Drops the socket and opens a new one at once, when anything is
1219
+ * subscribed. A socket keeps the session it was opened with (the upgrade's
1220
+ * cookies), so signing in or out in this tab reconnects it: every channel
1221
+ * is then authorized as the new session, and the acks resync.
1222
+ */
1223
+ reconnect() {
1224
+ this.close();
1225
+ this.clearReconnect();
1226
+ this.attempt = 0;
1227
+ if (this.entries.size > 0 && !this.pausedWhileHidden) this.connect();
1228
+ }
1229
+ /** For tests: drops the socket, timers and listeners. */
1230
+ dispose() {
1231
+ this.clearReconnect();
1232
+ this.cancelIdleClose();
1233
+ if (this.hiddenTimer) clearTimeout(this.hiddenTimer);
1234
+ for (const entry of this.entries.values()) {
1235
+ if (entry.resyncTimer) clearTimeout(entry.resyncTimer);
1236
+ if (entry.lingerTimer) clearTimeout(entry.lingerTimer);
1237
+ this.clearRetry(entry);
1238
+ }
1239
+ this.entries.clear();
1240
+ this.byId.clear();
1241
+ this.close();
1242
+ if (this.listening && typeof window !== "undefined") {
1243
+ window.removeEventListener("online", this.onOnline);
1244
+ document?.removeEventListener("visibilitychange", this.onVisibility);
1245
+ this.listening = false;
1246
+ }
1247
+ }
1248
+ };
1249
+ /** Full jitter, 1 to 30 s: `max(1 s, random × min(30 s, 1 s × 2^attempt))`. */
1250
+ function backoffDelay(attempt, random) {
1251
+ const cap = Math.min(MAX_BACKOFF_MS, MIN_BACKOFF_MS * 2 ** Math.min(attempt, 10));
1252
+ return Math.max(MIN_BACKOFF_MS, Math.floor(random * cap));
1253
+ }
1254
+ function withDefaults(options) {
1255
+ return {
1256
+ path: options.path ?? "/__gemi/socket",
1257
+ hiddenDisconnectMs: options.hiddenDisconnectMs ?? DEFAULT_HIDDEN_DISCONNECT_MS
1258
+ };
1259
+ }
1260
+ function reportListenerError(error) {
1261
+ setTimeout(() => {
1262
+ throw error;
1263
+ });
1264
+ }
1265
+ var configured = {};
1266
+ var instance = null;
1267
+ /**
1268
+ * Sets the socket options (`init({ realtime })` calls it). Takes effect on
1269
+ * the next connection.
1270
+ */
1271
+ function configureRealtime(options = {}) {
1272
+ configured = {
1273
+ ...configured,
1274
+ ...options
1275
+ };
1276
+ instance?.configure(configured);
1277
+ }
1278
+ /** The tab's client, created on first use. `null` on the server. */
1279
+ function getRealtimeClient() {
1280
+ if (typeof window === "undefined") return null;
1281
+ instance ??= new RealtimeClient(configured);
1282
+ return instance;
1283
+ }
1284
+ /**
1285
+ * Reconnects the tab's socket, if it has one, so its channels are authorized
1286
+ * as the current session. The auth hooks call it after signing in or out.
1287
+ * Never creates the client.
1288
+ */
1289
+ function reconnectRealtime() {
1290
+ instance?.reconnect();
1291
+ }
1292
+ /**
1293
+ * The open socket's id, for the `X-Gemi-Socket` header, or `null`. Never
1294
+ * creates the client.
1295
+ */
1296
+ function currentSocketId() {
1297
+ return instance?.socketId ?? null;
1298
+ }
1299
+ //#endregion
1300
+ //#region client/realtime/RealtimeContext.ts
1301
+ /**
1302
+ * The socket the channel hooks subscribe through. `null` (the default) is the
1303
+ * tab's own `RealtimeClient`, created on first use in the browser; `<Page>`
1304
+ * in `gemi/testing` provides a `FakeSocket`.
1305
+ */
1306
+ var RealtimeContext = createContext(null);
1307
+ //#endregion
729
1308
  //#region ../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js
730
1309
  function _extends() {
731
1310
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
@@ -3408,6 +3987,6 @@ function useTheme() {
3408
3987
  return context;
3409
3988
  }
3410
3989
  //#endregion
3411
- export { useLocation as A, QueryManagerProvider as B, useRoute as C, I18nProvider as D, I18nContext as E, createMemoryHistory as F, retryDelayFor as G, pickDefined as H, toVariantKey as I, Subject as J, shouldRetryQuery as K, applyParams as L, isAbsoluteUrl as M, ProgressManager as N, ServerDataContext as O, Action as P, QueryConfigContext as R, routeDataUrl as S, useNavigate as T, DEFAULT_STALE_TIME as U, USER_QUERY_CONFIG_KEYS as V, isRetryableQueryError as W, loadDictionary as _, useRouteTransition as a, setActiveLocale as b, ComponentsContext as c, loadViewModule as d, subscribeViewModules as f, recoverFromChunkLoadError as g, isChunkLoadError as h, RouteTransitionProvider as i, domainUrl as j, ServerDataProvider as k, ComponentsProvider as l, configureChunkLoadRecovery as m, useTheme as n, ClientRouterContext as o, CHUNK_RELOAD_MARKER as p, QueryError as q, m as r, ClientRouterProvider as s, ThemeProvider as t, initialViewModulesReady as u, loadDictionaryForRender as v, useSearchParams as w, readRoutePayload as x, registerDictionary as y, QueryManagerContext as z };
3990
+ export { shouldRetryQuery as $, useLocation as A, getRealtimeClient as B, useRoute as C, I18nProvider as D, I18nContext as E, createMemoryHistory as F, QueryConfigContext as G, SOCKET_ID_HEADER as H, RealtimeContext as I, USER_QUERY_CONFIG_KEYS as J, QueryManagerContext as K, channelKey as L, isAbsoluteUrl as M, ProgressManager as N, ServerDataContext as O, Action as P, retryDelayFor as Q, configureRealtime as R, routeDataUrl as S, useNavigate as T, toVariantKey as U, reconnectRealtime as V, applyParams as W, DEFAULT_STALE_TIME as X, pickDefined as Y, isRetryableQueryError as Z, loadDictionary as _, useRouteTransition as a, setActiveLocale as b, ComponentsContext as c, loadViewModule as d, QueryError as et, subscribeViewModules as f, recoverFromChunkLoadError as g, isChunkLoadError as h, RouteTransitionProvider as i, domainUrl as j, ServerDataProvider as k, ComponentsProvider as l, configureChunkLoadRecovery as m, useTheme as n, ClientRouterContext as o, CHUNK_RELOAD_MARKER as p, QueryManagerProvider as q, m as r, ClientRouterProvider as s, ThemeProvider as t, Subject as tt, initialViewModulesReady as u, loadDictionaryForRender as v, useSearchParams as w, readRoutePayload as x, registerDictionary as y, currentSocketId as z };
3412
3991
 
3413
- //# sourceMappingURL=ThemeProvider-BLI4zpLu.js.map
3992
+ //# sourceMappingURL=ThemeProvider-CbOx8IRl.js.map