hypervibes 0.0.0-stage → 0.4.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 (362) hide show
  1. package/.build/client/assets/_authenticated-C87LKvH0.js +1 -0
  2. package/.build/client/assets/_authenticated.account-D-nTh_fC.js +1 -0
  3. package/.build/client/assets/_authenticated.agents-HwcveLyB.js +1 -0
  4. package/.build/client/assets/_authenticated.agents._agentId-DuE8Lv62.js +1 -0
  5. package/.build/client/assets/_authenticated.agents._agentId.chart-Bb_XkvQx.js +4 -0
  6. package/.build/client/assets/_authenticated.agents._agentId.chat-ClMMKw_N.js +1 -0
  7. package/.build/client/assets/_authenticated.agents._agentId.index-DNJwBwn9.js +1 -0
  8. package/.build/client/assets/_authenticated.agents._agentId.indicators-BmVjLtRI.js +1 -0
  9. package/.build/client/assets/_authenticated.agents._agentId.indicators_._indicatorId-CMqaaFQf.js +2 -0
  10. package/.build/client/assets/_authenticated.agents._agentId.indicators_._indicatorId-DtgkoNV5.js +6 -0
  11. package/.build/client/assets/_authenticated.agents._agentId.memories-O-4f6a4G.js +1 -0
  12. package/.build/client/assets/_authenticated.agents._agentId.memories_._memoryRef-BUPtUcj3.js +1 -0
  13. package/.build/client/assets/_authenticated.agents._agentId.notifications-2lyhXCSk.js +1 -0
  14. package/.build/client/assets/_authenticated.agents._agentId.notifications_._notificationId-Da3ZVT4v.js +1 -0
  15. package/.build/client/assets/_authenticated.agents._agentId.settings-C5cWHoYw.js +1 -0
  16. package/.build/client/assets/_authenticated.agents._agentId.sub-agents-HwcveLyB.js +1 -0
  17. package/.build/client/assets/_authenticated.agents._agentId.sub-agents._subagentId-CZ4MeRy4.js +1 -0
  18. package/.build/client/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-dVbo5kMU.js +3 -0
  19. package/.build/client/assets/_authenticated.agents._agentId.sub-agents.index-DeWTOYJD.js +1 -0
  20. package/.build/client/assets/_authenticated.agents._agentId.sub-agents.new-D02TflCE.js +37 -0
  21. package/.build/client/assets/_authenticated.agents._agentId.transactions-D3a8Glgj.js +1 -0
  22. package/.build/client/assets/_authenticated.agents.index-CEqeDEgP.js +1 -0
  23. package/.build/client/assets/_authenticated.agents.new-DLRWK5Uk.js +1 -0
  24. package/.build/client/assets/_authenticated.providers-D0iPLXra.js +1 -0
  25. package/.build/client/assets/agent-chat-page-C5eYFgxw.js +1 -0
  26. package/.build/client/assets/agent-enablement-control-CUzOp9ce.js +1 -0
  27. package/.build/client/assets/agent-events-DC8eDZf3.js +1 -0
  28. package/.build/client/assets/agent-input-aolvZ47U.js +1 -0
  29. package/.build/client/assets/agent-notifications-page-B0mr-Zz8.js +1 -0
  30. package/.build/client/assets/agent-queries-CNMBImun.js +1 -0
  31. package/.build/client/assets/app-DjmsvbUC.css +2 -0
  32. package/.build/client/assets/artifact-content-COO4VTSZ.js +1 -0
  33. package/.build/client/assets/auth-client-K13li9H1.js +3 -0
  34. package/.build/client/assets/call-DxlGie4_.js +31 -0
  35. package/.build/client/assets/ccip-BgPlVPYP.js +1 -0
  36. package/.build/client/assets/chart-contracts-Cr5SFCbE.js +1 -0
  37. package/.build/client/assets/chart-queries-Bpvrgd0-.js +1 -0
  38. package/.build/client/assets/chat-bubble-CAJkT-vL.js +1 -0
  39. package/.build/client/assets/config-dialog-C9x9gKW9.js +1 -0
  40. package/.build/client/assets/contracts-HhAL7Tt7.js +1 -0
  41. package/.build/client/assets/createServerFn-DfZIp2Fu.js +3 -0
  42. package/.build/client/assets/custom-BeqXuIIS.js +5 -0
  43. package/.build/client/assets/decimal-B0DEG-1V.js +1 -0
  44. package/.build/client/assets/esm-BTb2nBdW.js +1 -0
  45. package/.build/client/assets/identicon-Lb9pS4O1.js +1 -0
  46. package/.build/client/assets/index-B4hvjMmI.js +10 -0
  47. package/.build/client/assets/indicator-input-fields-CtmrfVfS.js +1 -0
  48. package/.build/client/assets/indicator-queries-CzZ6u1Mh.js +1 -0
  49. package/.build/client/assets/indicator-renderer-CfccsIt2.js +1 -0
  50. package/.build/client/assets/instrument-label-BZYlWXR5.js +1 -0
  51. package/.build/client/assets/instrument-picker-DLPpryOm.js +1 -0
  52. package/.build/client/assets/journal-decimal-DBvd_Ibi.js +1 -0
  53. package/.build/client/assets/jsx-runtime-CIazjfqY.js +1 -0
  54. package/.build/client/assets/lazyRouteComponent-CJgUa7_r.js +1 -0
  55. package/.build/client/assets/lightweight-charts.production-BiBiFZSH.js +1 -0
  56. package/.build/client/assets/login-MNgYxCOY.js +3 -0
  57. package/.build/client/assets/memory-badge-BbN-DJQi.js +1 -0
  58. package/.build/client/assets/memory-contracts-Doi_Q1XJ.js +1 -0
  59. package/.build/client/assets/memory-queries-BttL580R.js +1 -0
  60. package/.build/client/assets/model-picker-YCQNNmyw.js +1 -0
  61. package/.build/client/assets/notification-queries-B12DG3aS.js +1 -0
  62. package/.build/client/assets/preload-helper-Czpn1I53.js +1 -0
  63. package/.build/client/assets/provider-logo-Ddb77aBD.js +1 -0
  64. package/.build/client/assets/provider-queries-DxPwhDOU.js +1 -0
  65. package/.build/client/assets/query-nvK_95Jo.js +1 -0
  66. package/.build/client/assets/random-uuid-DJR3ygJS.js +1 -0
  67. package/.build/client/assets/react-dom-C6bOPxes.js +1 -0
  68. package/.build/client/assets/risk-queries-D_6PHwus.js +1 -0
  69. package/.build/client/assets/run-subagent-dialog-B4yQe9T9.js +1 -0
  70. package/.build/client/assets/secp256k1-BbZnIgDP.js +1 -0
  71. package/.build/client/assets/setup-checklist-CUW-K484.js +1 -0
  72. package/.build/client/assets/sha2-hT-Q4pur.js +1 -0
  73. package/.build/client/assets/subagent-enabled-toggle-Bk5wfScg.js +1 -0
  74. package/.build/client/assets/subagent-input-TQke90I1.js +1 -0
  75. package/.build/client/assets/subagent-mutations-DfsDbmFu.js +1 -0
  76. package/.build/client/assets/subagent-queries-DVv5JCfs.js +1 -0
  77. package/.build/client/assets/subagent-run-history-D55Uh5VK.js +1 -0
  78. package/.build/client/assets/toggle-timestamp-B50FTPmA.js +1 -0
  79. package/.build/client/assets/useBaseQuery-Bxruo_mV.js +1 -0
  80. package/.build/client/assets/useMutation-DrF53EQG.js +1 -0
  81. package/.build/client/assets/useQuery-BMSU16jY.js +1 -0
  82. package/.build/client/assets/useRouter-c0I1aURm.js +1 -0
  83. package/.build/client/assets/useSelector-ERD9RroG.js +2 -0
  84. package/.build/client/assets/useSuspenseQuery-vODFwDb8.js +1 -0
  85. package/.build/client/assets/utils-Bpv4vmSW.js +1 -0
  86. package/.build/client/assets/worker-triggers-DtXyn40O.js +1 -0
  87. package/.build/server/assets/_authenticated-Bch0_2QH.js +264 -0
  88. package/.build/server/assets/_authenticated-DGV5cZYE.js +22 -0
  89. package/.build/server/assets/_authenticated.account-6qu6oQ1y.js +685 -0
  90. package/.build/server/assets/_authenticated.agents-DYDnQxli.js +5 -0
  91. package/.build/server/assets/_authenticated.agents._agentId-4HvB3mhd.js +17 -0
  92. package/.build/server/assets/_authenticated.agents._agentId-Cl608F1T.js +260 -0
  93. package/.build/server/assets/_authenticated.agents._agentId-G2jAHjma.js +15 -0
  94. package/.build/server/assets/_authenticated.agents._agentId.chart-BIA8wy73.js +2644 -0
  95. package/.build/server/assets/_authenticated.agents._agentId.chart-D4aj8Qy9.js +22 -0
  96. package/.build/server/assets/_authenticated.agents._agentId.chat-ClsVle4g.js +13 -0
  97. package/.build/server/assets/_authenticated.agents._agentId.chat-JV3FDsTp.js +18 -0
  98. package/.build/server/assets/_authenticated.agents._agentId.index-Ct4kbu2f.js +1044 -0
  99. package/.build/server/assets/_authenticated.agents._agentId.index-DJgrupvW.js +18 -0
  100. package/.build/server/assets/_authenticated.agents._agentId.indicators-DrKd0aP5.js +184 -0
  101. package/.build/server/assets/_authenticated.agents._agentId.indicators-wiVaY8fW.js +18 -0
  102. package/.build/server/assets/_authenticated.agents._agentId.indicators_._indicatorId-C4Ox2R-a.js +25 -0
  103. package/.build/server/assets/_authenticated.agents._agentId.indicators_._indicatorId-D8Q0hCW0.js +489 -0
  104. package/.build/server/assets/_authenticated.agents._agentId.memories-BUTyVLYy.js +42 -0
  105. package/.build/server/assets/_authenticated.agents._agentId.memories-E8-nSEMT.js +362 -0
  106. package/.build/server/assets/_authenticated.agents._agentId.memories_._memoryRef-C-SC6wzq.js +14 -0
  107. package/.build/server/assets/_authenticated.agents._agentId.memories_._memoryRef-ZCrdrc8C.js +490 -0
  108. package/.build/server/assets/_authenticated.agents._agentId.notifications-DQeQqTzh.js +14 -0
  109. package/.build/server/assets/_authenticated.agents._agentId.notifications-DlFyYyHh.js +16 -0
  110. package/.build/server/assets/_authenticated.agents._agentId.notifications_._notificationId-B0RosY_R.js +15 -0
  111. package/.build/server/assets/_authenticated.agents._agentId.notifications_._notificationId-C1NikQ9e.js +13 -0
  112. package/.build/server/assets/_authenticated.agents._agentId.settings-DDwjT3Ui.js +42 -0
  113. package/.build/server/assets/_authenticated.agents._agentId.settings-PEzEvOfo.js +751 -0
  114. package/.build/server/assets/_authenticated.agents._agentId.sub-agents-z34-J3Tu.js +5 -0
  115. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId-D-6TOi1U.js +1371 -0
  116. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId-DipzVdnr.js +13 -0
  117. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-BZR3VLV7.js +610 -0
  118. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-DsYJKfGm.js +12 -0
  119. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.index-BF8Cuzcr.js +231 -0
  120. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.index-D2x0qCnt.js +12 -0
  121. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.new-CYm_vuDD.js +13 -0
  122. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.new-CiVShIka.js +497 -0
  123. package/.build/server/assets/_authenticated.agents._agentId.transactions-BC_XfGqw.js +95 -0
  124. package/.build/server/assets/_authenticated.agents._agentId.transactions-WtBW3xmh.js +495 -0
  125. package/.build/server/assets/_authenticated.agents.index-C8zmu8T8.js +78 -0
  126. package/.build/server/assets/_authenticated.agents.new-Bt-tBR47.js +302 -0
  127. package/.build/server/assets/_authenticated.providers-C0pb-ujV.js +672 -0
  128. package/.build/server/assets/_tanstack-start-manifest_v-Baw5u9sk.js +354 -0
  129. package/.build/server/assets/account-XvMwzRXh.js +66 -0
  130. package/.build/server/assets/account-queries-AJJVkLAV.js +32 -0
  131. package/.build/server/assets/agent-chat-page-DChiz8KQ.js +686 -0
  132. package/.build/server/assets/agent-enablement-control-C90f0uIb.js +143 -0
  133. package/.build/server/assets/agent-events-DK9Yz5__.js +217 -0
  134. package/.build/server/assets/agent-notifications-page-BdyKAyds.js +276 -0
  135. package/.build/server/assets/agent-queries-Cmx8RiUx.js +51 -0
  136. package/.build/server/assets/agents-CZq-0mna.js +106 -0
  137. package/.build/server/assets/agents-CfjmtW7A.js +278 -0
  138. package/.build/server/assets/artifact-content-B6uHmPz7.js +35 -0
  139. package/.build/server/assets/artifacts-HtLwHs8q.js +42 -0
  140. package/.build/server/assets/auth-DTikZAVz.js +12 -0
  141. package/.build/server/assets/auth-client-Vb3O0v7P.js +1897 -0
  142. package/.build/server/assets/auth-user-DkLo8ojH.js +108 -0
  143. package/.build/server/assets/chart-queries-Bc3AfsEb.js +109 -0
  144. package/.build/server/assets/charts-C4dKuwTJ.js +130 -0
  145. package/.build/server/assets/chat-bubble-ik3itVbx.js +109 -0
  146. package/.build/server/assets/config-dialog-9gSAjwwT.js +55 -0
  147. package/.build/server/assets/contracts-CG-nZuYJ.js +155 -0
  148. package/.build/server/assets/createServerRpc-DNqhdU4z.js +12 -0
  149. package/.build/server/assets/decimal-BthtZ77w.js +97 -0
  150. package/.build/server/assets/empty-plugin-adapters-MOWBbCMw.js +5 -0
  151. package/.build/server/assets/errors-DaZqUftX.js +151 -0
  152. package/.build/server/assets/gateway-CHkruO_a.js +193 -0
  153. package/.build/server/assets/identicon-CyawcVnx.js +41 -0
  154. package/.build/server/assets/indicator-input-fields-bzuhIh6t.js +75 -0
  155. package/.build/server/assets/indicator-queries-4dY1-LXx.js +171 -0
  156. package/.build/server/assets/indicator-renderer-B2muPS-8.js +395 -0
  157. package/.build/server/assets/indicators-ENxAHN42.js +192 -0
  158. package/.build/server/assets/insight-contracts-B5rmUDfO.js +14 -0
  159. package/.build/server/assets/instrument-label-C-tTGGsD.js +40 -0
  160. package/.build/server/assets/instrument-picker-CRroLwVq.js +381 -0
  161. package/.build/server/assets/journal-9aE-um9f.js +107 -0
  162. package/.build/server/assets/journal-decimal-Bh9EL029.js +66 -0
  163. package/.build/server/assets/login-BsEFUvTX.js +125 -0
  164. package/.build/server/assets/memories-2WF2fW1G.js +100 -0
  165. package/.build/server/assets/memory-badge-DVYLTtRR.js +53 -0
  166. package/.build/server/assets/memory-contracts-DQGN2IKV.js +22 -0
  167. package/.build/server/assets/memory-queries--4RbPRrk.js +92 -0
  168. package/.build/server/assets/model-picker-CA1uYb--.js +225 -0
  169. package/.build/server/assets/notification-queries-0CJUkBt9.js +52 -0
  170. package/.build/server/assets/notifications-Cn7BiCyw.js +72 -0
  171. package/.build/server/assets/provider-logo-BRdbOr9I.js +32 -0
  172. package/.build/server/assets/provider-queries-BaZWLw8J.js +78 -0
  173. package/.build/server/assets/providers-CyoN_jgW.js +89 -0
  174. package/.build/server/assets/risk-Bqrb6hKQ.js +34 -0
  175. package/.build/server/assets/risk-queries-JQpByHT2.js +18 -0
  176. package/.build/server/assets/router-Hkr5TH_I.js +419 -0
  177. package/.build/server/assets/run-subagent-dialog-C7iUOZa-.js +59 -0
  178. package/.build/server/assets/setup-DqMlwgNr.js +30 -0
  179. package/.build/server/assets/setup-checklist-BICTmBo2.js +60 -0
  180. package/.build/server/assets/start-C-GPoWRt.js +4 -0
  181. package/.build/server/assets/subagent-enabled-toggle-Djte00oo.js +22 -0
  182. package/.build/server/assets/subagent-input-BHQKs2cW.js +57 -0
  183. package/.build/server/assets/subagent-mutations-dUo3B_SG.js +32 -0
  184. package/.build/server/assets/subagent-queries-sAwBjFxC.js +146 -0
  185. package/.build/server/assets/subagent-run-history-C_xmucO-.js +186 -0
  186. package/.build/server/assets/subagents-CIoilC66.js +180 -0
  187. package/.build/server/assets/toggle-timestamp-CToUVn67.js +28 -0
  188. package/.build/server/assets/trading-contracts-zWq1Hxnb.js +26 -0
  189. package/.build/server/assets/validation-BX-krL0i.js +33 -0
  190. package/.build/server/assets/worker-triggers-CJF5HWzR.js +51 -0
  191. package/.build/server/server.js +7501 -0
  192. package/LICENSE +661 -0
  193. package/README.md +145 -2
  194. package/bin/hypervibes.js +24 -0
  195. package/dist/agents/agent-enablement.js +10 -0
  196. package/dist/agents/agent-input.js +38 -0
  197. package/dist/agents/agent-service.js +1004 -0
  198. package/dist/agents/cancel-task-scope.js +52 -0
  199. package/dist/agents/candle-intervals.js +1 -0
  200. package/dist/agents/default-subagents.js +36 -0
  201. package/dist/agents/execution-context-contracts.js +1 -0
  202. package/dist/agents/execution-context.js +206 -0
  203. package/dist/agents/execution-warnings.js +33 -0
  204. package/dist/agents/orchestrator-insights.js +14 -0
  205. package/dist/agents/run-inspection.js +99 -0
  206. package/dist/agents/subagent-dashboard.js +1 -0
  207. package/dist/agents/subagent-extension.js +156 -0
  208. package/dist/agents/subagent-history.js +5 -0
  209. package/dist/agents/subagent-input.js +73 -0
  210. package/dist/agents/subagent-service.js +1177 -0
  211. package/dist/agents/subagent-templates.js +20 -0
  212. package/dist/agents/template-manifest.js +34 -0
  213. package/dist/agents/templates/basic-analysis.json +40 -0
  214. package/dist/agents/templates/basic-review.json +48 -0
  215. package/dist/agents/templates/basic-trading.json +45 -0
  216. package/dist/agents/templates/indicator-developer.json +16 -0
  217. package/dist/agents/time-guidance.js +29 -0
  218. package/dist/agents/worker-events.js +18 -0
  219. package/dist/agents/worker-inbox.js +28 -0
  220. package/dist/agents/worker-triggers.js +23 -0
  221. package/dist/auth-options.js +98 -0
  222. package/dist/auth-user.js +15 -0
  223. package/dist/auth.js +28 -0
  224. package/dist/cache/svg-logo-cache.js +155 -0
  225. package/dist/canonical.js +13 -0
  226. package/dist/charts/chart-service.js +236 -0
  227. package/dist/charts/contracts.js +118 -0
  228. package/dist/charts/durable-extension.js +27 -0
  229. package/dist/charts/trading-contracts.js +14 -0
  230. package/dist/config.js +85 -0
  231. package/dist/db/agent-schema.js +26 -0
  232. package/dist/db/auth-schema.js +122 -0
  233. package/dist/db/database.js +31 -0
  234. package/dist/db/exchange-schema.js +23 -0
  235. package/dist/db/gateway-schema.js +24 -0
  236. package/dist/db/indicator-schema.js +19 -0
  237. package/dist/db/migrations/20261015221717_auth/migration.sql +62 -0
  238. package/dist/db/migrations/20261015231224_agents/migration.sql +35 -0
  239. package/dist/db/migrations/20261016040641_provider_connections/migration.sql +19 -0
  240. package/dist/db/migrations/20261016061831_trade_journal/migration.sql +48 -0
  241. package/dist/db/migrations/20261016080320_order_execution/migration.sql +62 -0
  242. package/dist/db/migrations/20261016181110_subagents/migration.sql +51 -0
  243. package/dist/db/migrations/20261017222959_research_artifacts/migration.sql +37 -0
  244. package/dist/db/migrations/20261018061531_memories_and_insights/migration.sql +162 -0
  245. package/dist/db/migrations/20261020091156_worker_event_inbox/migration.sql +54 -0
  246. package/dist/db/migrations/20261021051229_chart_workspace/migration.sql +33 -0
  247. package/dist/db/migrations/20261021222116_gateways/migration.sql +15 -0
  248. package/dist/db/migrations/20261022015813_pine_indicators/migration.sql +43 -0
  249. package/dist/db/migrations/20261022101559_notifications/migration.sql +51 -0
  250. package/dist/db/migrations.js +12 -0
  251. package/dist/db/order-provenance-schema.js +17 -0
  252. package/dist/db/order-schema.js +32 -0
  253. package/dist/db/profile-lock.js +12 -0
  254. package/dist/db/provider-schema.js +16 -0
  255. package/dist/db/shared-database.js +128 -0
  256. package/dist/db/subagent-schema.js +79 -0
  257. package/dist/gateway/bridge-service.js +223 -0
  258. package/dist/gateway/gateway-store.js +77 -0
  259. package/dist/gateway/handlers.js +122 -0
  260. package/dist/gateway/telegram/connector.js +115 -0
  261. package/dist/gateway/telegram/transport.js +96 -0
  262. package/dist/hyperliquid/account-info.js +117 -0
  263. package/dist/hyperliquid/account-status.js +64 -0
  264. package/dist/hyperliquid/agent-dashboard.js +56 -0
  265. package/dist/hyperliquid/chart-contracts.js +9 -0
  266. package/dist/hyperliquid/constants.js +25 -0
  267. package/dist/hyperliquid/crypto.js +29 -0
  268. package/dist/hyperliquid/currency-logo.js +7 -0
  269. package/dist/hyperliquid/decimal.js +98 -0
  270. package/dist/hyperliquid/durable-extension.js +39 -0
  271. package/dist/hyperliquid/errors.js +8 -0
  272. package/dist/hyperliquid/exchange.js +118 -0
  273. package/dist/hyperliquid/journal-decimal.js +48 -0
  274. package/dist/hyperliquid/journal-model.js +167 -0
  275. package/dist/hyperliquid/journal-service.js +648 -0
  276. package/dist/hyperliquid/live-dashboard.js +245 -0
  277. package/dist/hyperliquid/logo-cache.js +27 -0
  278. package/dist/hyperliquid/market-charts.js +242 -0
  279. package/dist/hyperliquid/market-snapshot.js +45 -0
  280. package/dist/hyperliquid/orders/order-contracts.js +42 -0
  281. package/dist/hyperliquid/orders/order-math.js +89 -0
  282. package/dist/hyperliquid/orders/order-outcomes.js +74 -0
  283. package/dist/hyperliquid/orders/order-prepare.js +109 -0
  284. package/dist/hyperliquid/orders/order-service.js +432 -0
  285. package/dist/hyperliquid/orders/order-store.js +134 -0
  286. package/dist/hyperliquid/orders/order-tools.js +40 -0
  287. package/dist/hyperliquid/orders/protection.js +35 -0
  288. package/dist/hyperliquid/orders/risk-settings.js +44 -0
  289. package/dist/hyperliquid/orders/trade-admission.js +117 -0
  290. package/dist/hyperliquid/orders/trade-planning.js +60 -0
  291. package/dist/hyperliquid/service.js +529 -0
  292. package/dist/hyperliquid/shared-feeds.js +40 -0
  293. package/dist/hyperliquid/signing.js +89 -0
  294. package/dist/indicators/builtin-catalog.js +59 -0
  295. package/dist/indicators/builtins/adx.pine +22 -0
  296. package/dist/indicators/builtins/atr.pine +11 -0
  297. package/dist/indicators/builtins/bollinger.pine +10 -0
  298. package/dist/indicators/builtins/ema.pine +5 -0
  299. package/dist/indicators/builtins/macd.pine +18 -0
  300. package/dist/indicators/builtins/rsi.pine +18 -0
  301. package/dist/indicators/builtins/sma.pine +5 -0
  302. package/dist/indicators/candle-window.js +36 -0
  303. package/dist/indicators/chart-contracts.js +64 -0
  304. package/dist/indicators/contracts.js +14 -0
  305. package/dist/indicators/durable-extension.js +32 -0
  306. package/dist/indicators/indicator-service.js +300 -0
  307. package/dist/indicators/indicator-store.js +137 -0
  308. package/dist/indicators/normalize.js +149 -0
  309. package/dist/indicators/result-schema.js +79 -0
  310. package/dist/indicators/runtime-wrapper.js +52 -0
  311. package/dist/indicators/runtime.js +201 -0
  312. package/dist/indicators/validation.js +124 -0
  313. package/dist/indicators/worker-queue.js +48 -0
  314. package/dist/initialize-config.js +160 -0
  315. package/dist/main.js +59 -0
  316. package/dist/memory/decision-audit.js +47 -0
  317. package/dist/memory/durable-extension.js +40 -0
  318. package/dist/memory/execution-audit.js +83 -0
  319. package/dist/memory/insight-contracts.js +33 -0
  320. package/dist/memory/insight-service.js +117 -0
  321. package/dist/memory/memory-contracts.js +113 -0
  322. package/dist/memory/memory-service.js +179 -0
  323. package/dist/memory/operations.js +46 -0
  324. package/dist/memory/tool-schemas.js +44 -0
  325. package/dist/memory/validation.js +42 -0
  326. package/dist/notifications/contracts.js +1 -0
  327. package/dist/notifications/delivery.js +11 -0
  328. package/dist/notifications/durable-extension.js +20 -0
  329. package/dist/notifications/notification-service.js +324 -0
  330. package/dist/providers/credential-store.js +86 -0
  331. package/dist/providers/ollama-cloud.js +148 -0
  332. package/dist/providers/provider-logo-url.js +18 -0
  333. package/dist/providers/provider-logo.js +31 -0
  334. package/dist/providers/provider-service.js +295 -0
  335. package/dist/research/artifacts.js +151 -0
  336. package/dist/research/call-queue.js +43 -0
  337. package/dist/research/contracts.js +37 -0
  338. package/dist/research/evidence.js +43 -0
  339. package/dist/research/journal.js +30 -0
  340. package/dist/research/research-service.js +191 -0
  341. package/dist/research/tool-activity.js +49 -0
  342. package/dist/research/tool-response.js +25 -0
  343. package/dist/runtime.js +145 -0
  344. package/dist/web/agent-events.js +418 -0
  345. package/dist/web/app.js +206 -0
  346. package/dist/web/artifact-downloads.js +23 -0
  347. package/dist/web/middleware.js +25 -0
  348. package/dist/web/random-uuid.js +14 -0
  349. package/dist/web/start.js +56 -0
  350. package/package.json +93 -3
  351. package/scripts/check-node.mjs +24 -0
  352. package/static/android-chrome-192x192.png +0 -0
  353. package/static/android-chrome-512x512.png +0 -0
  354. package/static/apple-touch-icon.png +0 -0
  355. package/static/favicon-16x16.png +0 -0
  356. package/static/favicon-32x32.png +0 -0
  357. package/static/favicon.ico +0 -0
  358. package/static/github.svg +3 -0
  359. package/static/hypervibes.png +0 -0
  360. package/static/logo.png +0 -0
  361. package/static/site.webmanifest +1 -0
  362. package/static/telegram.svg +1 -0
@@ -0,0 +1,1897 @@
1
+ import { useCallback, useRef, useSyncExternalStore } from "react";
2
+ //#endregion
3
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/version.mjs
4
+ var PACKAGE_VERSION = "1.7.10";
5
+ //#endregion
6
+ //#region node_modules/.pnpm/better-call@1.4.2_zod@4.6.7/node_modules/better-call/dist/error.mjs
7
+ function isErrorStackTraceLimitWritable() {
8
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
9
+ if (desc === void 0) return Object.isExtensible(Error);
10
+ return Object.prototype.hasOwnProperty.call(desc, "writable") ? desc.writable : desc.set !== void 0;
11
+ }
12
+ /**
13
+ * Hide internal stack frames from the error stack trace.
14
+ */
15
+ function hideInternalStackFrames(stack) {
16
+ const lines = stack.split("\n at ");
17
+ if (lines.length <= 1) return stack;
18
+ lines.splice(1, 1);
19
+ return lines.join("\n at ");
20
+ }
21
+ /**
22
+ * Creates a custom error class that hides stack frames.
23
+ */
24
+ function makeErrorForHideStackFrame(Base, clazz) {
25
+ class HideStackFramesError extends Base {
26
+ #hiddenStack;
27
+ constructor(...args) {
28
+ if (isErrorStackTraceLimitWritable()) {
29
+ const limit = Error.stackTraceLimit;
30
+ Error.stackTraceLimit = 0;
31
+ super(...args);
32
+ Error.stackTraceLimit = limit;
33
+ } else super(...args);
34
+ const stack = (/* @__PURE__ */ new Error()).stack;
35
+ if (stack) this.#hiddenStack = hideInternalStackFrames(stack.replace(/^Error/, this.name));
36
+ }
37
+ get errorStack() {
38
+ return this.#hiddenStack;
39
+ }
40
+ }
41
+ Object.defineProperty(HideStackFramesError.prototype, "constructor", {
42
+ get() {
43
+ return clazz;
44
+ },
45
+ enumerable: false,
46
+ configurable: true
47
+ });
48
+ return HideStackFramesError;
49
+ }
50
+ var statusCodes = {
51
+ OK: 200,
52
+ CREATED: 201,
53
+ ACCEPTED: 202,
54
+ NO_CONTENT: 204,
55
+ MULTIPLE_CHOICES: 300,
56
+ MOVED_PERMANENTLY: 301,
57
+ FOUND: 302,
58
+ SEE_OTHER: 303,
59
+ NOT_MODIFIED: 304,
60
+ TEMPORARY_REDIRECT: 307,
61
+ BAD_REQUEST: 400,
62
+ UNAUTHORIZED: 401,
63
+ PAYMENT_REQUIRED: 402,
64
+ FORBIDDEN: 403,
65
+ NOT_FOUND: 404,
66
+ METHOD_NOT_ALLOWED: 405,
67
+ NOT_ACCEPTABLE: 406,
68
+ PROXY_AUTHENTICATION_REQUIRED: 407,
69
+ REQUEST_TIMEOUT: 408,
70
+ CONFLICT: 409,
71
+ GONE: 410,
72
+ LENGTH_REQUIRED: 411,
73
+ PRECONDITION_FAILED: 412,
74
+ PAYLOAD_TOO_LARGE: 413,
75
+ URI_TOO_LONG: 414,
76
+ UNSUPPORTED_MEDIA_TYPE: 415,
77
+ RANGE_NOT_SATISFIABLE: 416,
78
+ EXPECTATION_FAILED: 417,
79
+ "I'M_A_TEAPOT": 418,
80
+ MISDIRECTED_REQUEST: 421,
81
+ UNPROCESSABLE_ENTITY: 422,
82
+ LOCKED: 423,
83
+ FAILED_DEPENDENCY: 424,
84
+ TOO_EARLY: 425,
85
+ UPGRADE_REQUIRED: 426,
86
+ PRECONDITION_REQUIRED: 428,
87
+ TOO_MANY_REQUESTS: 429,
88
+ REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
89
+ UNAVAILABLE_FOR_LEGAL_REASONS: 451,
90
+ INTERNAL_SERVER_ERROR: 500,
91
+ NOT_IMPLEMENTED: 501,
92
+ BAD_GATEWAY: 502,
93
+ SERVICE_UNAVAILABLE: 503,
94
+ GATEWAY_TIMEOUT: 504,
95
+ HTTP_VERSION_NOT_SUPPORTED: 505,
96
+ VARIANT_ALSO_NEGOTIATES: 506,
97
+ INSUFFICIENT_STORAGE: 507,
98
+ LOOP_DETECTED: 508,
99
+ NOT_EXTENDED: 510,
100
+ NETWORK_AUTHENTICATION_REQUIRED: 511
101
+ };
102
+ var InternalAPIError = class extends Error {
103
+ status;
104
+ body;
105
+ headers;
106
+ statusCode;
107
+ constructor(status = "INTERNAL_SERVER_ERROR", body = void 0, headers = {}, statusCode = typeof status === "number" ? status : statusCodes[status]) {
108
+ super(body?.message, body?.cause ? { cause: body.cause } : void 0);
109
+ this.status = status;
110
+ this.body = body;
111
+ this.headers = headers;
112
+ this.statusCode = statusCode;
113
+ this.name = "APIError";
114
+ this.status = status;
115
+ this.headers = headers;
116
+ this.statusCode = statusCode;
117
+ this.body = body;
118
+ }
119
+ };
120
+ makeErrorForHideStackFrame(InternalAPIError, Error);
121
+ //#endregion
122
+ //#region node_modules/.pnpm/@better-auth+core@1.7.10_@better-auth+utils@0.5.0_@better-fetch+fetch@1.3.2_better-call_224edc5ffd7528388e80ea9fb390ec1e/node_modules/@better-auth/core/dist/error/index.mjs
123
+ var BetterAuthError = class extends Error {
124
+ constructor(message, options) {
125
+ super(message, options);
126
+ this.name = "BetterAuthError";
127
+ this.message = message;
128
+ this.stack = "";
129
+ }
130
+ };
131
+ //#endregion
132
+ //#region node_modules/.pnpm/@better-auth+core@1.7.10_@better-auth+utils@0.5.0_@better-fetch+fetch@1.3.2_better-call_224edc5ffd7528388e80ea9fb390ec1e/node_modules/@better-auth/core/dist/env/env-impl.mjs
133
+ var _envShim = Object.create(null);
134
+ var _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
135
+ var env = new Proxy(_envShim, {
136
+ get(_, prop) {
137
+ return _getEnv()[prop] ?? _envShim[prop];
138
+ },
139
+ has(_, prop) {
140
+ return prop in _getEnv() || prop in _envShim;
141
+ },
142
+ set(_, prop, value) {
143
+ const env = _getEnv(true);
144
+ env[prop] = value;
145
+ return true;
146
+ },
147
+ deleteProperty(_, prop) {
148
+ if (!prop) return false;
149
+ const env = _getEnv(true);
150
+ delete env[prop];
151
+ return true;
152
+ },
153
+ ownKeys() {
154
+ const env = _getEnv(true);
155
+ return Object.keys(env);
156
+ }
157
+ });
158
+ env.NODE_ENV;
159
+ /**
160
+ * Get environment variable with fallback
161
+ */
162
+ function getEnvVar(key, fallback) {
163
+ if (typeof process !== "undefined" && process.env) return process.env[key] ?? fallback;
164
+ if (typeof Deno !== "undefined") return Deno.env.get(key) ?? fallback;
165
+ if (typeof Bun !== "undefined") return Bun.env[key] ?? fallback;
166
+ return fallback;
167
+ }
168
+ Object.freeze({
169
+ get BETTER_AUTH_SECRET() {
170
+ return getEnvVar("BETTER_AUTH_SECRET");
171
+ },
172
+ get AUTH_SECRET() {
173
+ return getEnvVar("AUTH_SECRET");
174
+ },
175
+ get BETTER_AUTH_TELEMETRY() {
176
+ return getEnvVar("BETTER_AUTH_TELEMETRY");
177
+ },
178
+ get BETTER_AUTH_TELEMETRY_ID() {
179
+ return getEnvVar("BETTER_AUTH_TELEMETRY_ID");
180
+ },
181
+ get NODE_ENV() {
182
+ return getEnvVar("NODE_ENV", "development");
183
+ },
184
+ get PACKAGE_VERSION() {
185
+ return getEnvVar("PACKAGE_VERSION", "0.0.0");
186
+ },
187
+ get BETTER_AUTH_TELEMETRY_ENDPOINT() {
188
+ return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
189
+ }
190
+ });
191
+ //#endregion
192
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/utils/url.mjs
193
+ var SLASH_CHAR_CODE = "/".charCodeAt(0);
194
+ function trimTrailingSlashes(value) {
195
+ let end = value.length;
196
+ while (end > 0 && value.charCodeAt(end - 1) === SLASH_CHAR_CODE) end--;
197
+ return end === value.length ? value : value.slice(0, end);
198
+ }
199
+ function checkHasPath(url) {
200
+ try {
201
+ return (trimTrailingSlashes(new URL(url).pathname) || "/") !== "/";
202
+ } catch {
203
+ throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);
204
+ }
205
+ }
206
+ function assertHasProtocol(url) {
207
+ try {
208
+ const parsedUrl = new URL(url);
209
+ if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") throw new BetterAuthError(`Invalid base URL: ${url}. URL must include 'http://' or 'https://'`);
210
+ } catch (error) {
211
+ if (error instanceof BetterAuthError) throw error;
212
+ throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`, { cause: error });
213
+ }
214
+ }
215
+ function withPath(url, path = "/api/auth") {
216
+ assertHasProtocol(url);
217
+ if (checkHasPath(url)) return url;
218
+ const trimmedUrl = trimTrailingSlashes(url);
219
+ if (!path || path === "/") return trimmedUrl;
220
+ path = path.startsWith("/") ? path : `/${path}`;
221
+ return `${trimmedUrl}${path}`;
222
+ }
223
+ function validateProxyHeader(header, type) {
224
+ if (!header || header.trim() === "") return false;
225
+ if (type === "proto") return header === "http" || header === "https";
226
+ if (type === "host") {
227
+ if ([
228
+ /\.\./,
229
+ /\0/,
230
+ /[\s]/,
231
+ /^[.]/,
232
+ /[<>'"]/,
233
+ /javascript:/i,
234
+ /file:/i,
235
+ /data:/i
236
+ ].some((pattern) => pattern.test(header))) return false;
237
+ return /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(header) || /^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(header) || /^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(header) || /^localhost(:[0-9]{1,5})?$/i.test(header);
238
+ }
239
+ return false;
240
+ }
241
+ function getBaseURL(url, path, request, loadEnv, trustedProxyHeaders) {
242
+ if (url) return withPath(url, path);
243
+ if (loadEnv !== false) {
244
+ const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
245
+ if (fromEnv) return withPath(fromEnv, path);
246
+ }
247
+ const fromRequest = request?.headers.get("x-forwarded-host");
248
+ const fromRequestProto = request?.headers.get("x-forwarded-proto");
249
+ if (fromRequest && fromRequestProto && trustedProxyHeaders) {
250
+ if (validateProxyHeader(fromRequestProto, "proto") && validateProxyHeader(fromRequest, "host")) try {
251
+ return withPath(`${fromRequestProto}://${fromRequest}`, path);
252
+ } catch (_error) {}
253
+ }
254
+ if (request) {
255
+ const url = getOrigin(request.url);
256
+ if (!url) throw new BetterAuthError("Could not get origin from request. Please provide a valid base URL.");
257
+ return withPath(url, path);
258
+ }
259
+ if (typeof window !== "undefined" && window.location) return withPath(window.location.origin, path);
260
+ }
261
+ function getOrigin(url) {
262
+ try {
263
+ const parsedUrl = new URL(url);
264
+ return parsedUrl.origin === "null" ? null : parsedUrl.origin;
265
+ } catch {
266
+ return null;
267
+ }
268
+ }
269
+ //#endregion
270
+ //#region node_modules/.pnpm/@better-auth+core@1.7.10_@better-auth+utils@0.5.0_@better-fetch+fetch@1.3.2_better-call_224edc5ffd7528388e80ea9fb390ec1e/node_modules/@better-auth/core/dist/utils/url.mjs
271
+ /**
272
+ * Schemes that execute or embed code when navigated to or accepted as a
273
+ * redirect target. These are never safe as an OAuth `redirect_uri` or as a
274
+ * client-side navigation target (`window.location.href`, `location.assign`, ...).
275
+ */
276
+ var DANGEROUS_URL_SCHEMES = [
277
+ "javascript:",
278
+ "data:",
279
+ "vbscript:"
280
+ ];
281
+ /**
282
+ * Returns `false` only when `value` is an absolute URL using a dangerous scheme
283
+ * (`javascript:`, `data:`, `vbscript:`). Relative URLs (e.g. `/dashboard`) and
284
+ * safe absolute schemes (`http`, `https`, custom app schemes such as
285
+ * `myapp://`) return `true`.
286
+ *
287
+ * Use this to guard browser navigation sinks and any redirect target that may
288
+ * originate from untrusted input. It is intentionally narrow: it blocks code
289
+ * execution schemes without rejecting relative paths or mobile deep links.
290
+ */
291
+ function isSafeUrlScheme(value) {
292
+ let parsed;
293
+ try {
294
+ parsed = new URL(value);
295
+ } catch {
296
+ return true;
297
+ }
298
+ return !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);
299
+ }
300
+ //#endregion
301
+ //#region node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.js
302
+ var listenerQueue = [];
303
+ var lqIndex = 0;
304
+ var batchSeen = null;
305
+ var QUEUE_ITEMS_PER_LISTENER = 4;
306
+ var nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
307
+ var drainQueue = () => {
308
+ let thrown;
309
+ let i;
310
+ while (lqIndex < listenerQueue.length) {
311
+ i = lqIndex;
312
+ lqIndex += QUEUE_ITEMS_PER_LISTENER;
313
+ let pendingStores = batchSeen?.get(listenerQueue[i]);
314
+ if (pendingStores) {
315
+ if (!pendingStores.has(listenerQueue[i + 1])) continue;
316
+ pendingStores.clear();
317
+ }
318
+ try {
319
+ listenerQueue[i](listenerQueue[i + 1].value, listenerQueue[i + 2], listenerQueue[i + 3]);
320
+ } catch (e) {
321
+ thrown = e;
322
+ }
323
+ }
324
+ listenerQueue.length = lqIndex = 0;
325
+ if (thrown) throw thrown;
326
+ };
327
+ var atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
328
+ let listeners = [];
329
+ let $atom = {
330
+ eq: Object.is,
331
+ get() {
332
+ if (!$atom.lc) $atom.listen(() => {})();
333
+ return $atom.value;
334
+ },
335
+ init: initialValue,
336
+ lc: 0,
337
+ listen(listener) {
338
+ $atom.lc = listeners.push(listener);
339
+ return () => {
340
+ batchSeen?.get(listener)?.delete($atom);
341
+ for (let i = lqIndex; i < listenerQueue.length;) if (listenerQueue[i] === listener && listenerQueue[i + 1] === $atom) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
342
+ else i += QUEUE_ITEMS_PER_LISTENER;
343
+ let index = listeners.indexOf(listener);
344
+ if (~index) {
345
+ listeners.splice(index, 1);
346
+ if (!--$atom.lc) $atom.off();
347
+ }
348
+ };
349
+ },
350
+ notify(oldValue, changedKey) {
351
+ nanostoresGlobal.epoch++;
352
+ let runListenerQueue = !listenerQueue.length && !batchSeen;
353
+ for (let listener of listeners) {
354
+ if (batchSeen) {
355
+ let pendingStores = batchSeen.get(listener);
356
+ if (!pendingStores) batchSeen.set(listener, pendingStores = /* @__PURE__ */ new Set());
357
+ if (pendingStores.has($atom)) continue;
358
+ pendingStores.add($atom);
359
+ }
360
+ listenerQueue.push(listener, $atom, oldValue, batchSeen ? void 0 : changedKey);
361
+ }
362
+ if (runListenerQueue) drainQueue();
363
+ },
364
+ off() {},
365
+ set(newValue) {
366
+ let oldValue = $atom.value;
367
+ if (!$atom.eq(oldValue, newValue)) {
368
+ $atom.value = newValue;
369
+ $atom.notify(oldValue);
370
+ }
371
+ },
372
+ subscribe(listener) {
373
+ let unbind = $atom.listen(listener);
374
+ listener($atom.value);
375
+ return unbind;
376
+ },
377
+ value: initialValue
378
+ };
379
+ return $atom;
380
+ };
381
+ //#endregion
382
+ //#region node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js
383
+ var SET = 2;
384
+ var MOUNT = 5;
385
+ var UNMOUNT = 6;
386
+ var REVERT_MUTATION = 10;
387
+ var on = (object, listener, eventKey, mutateStore) => {
388
+ object.events = object.events || {};
389
+ if (!object.events[eventKey + REVERT_MUTATION]) object.events[eventKey + REVERT_MUTATION] = mutateStore((eventProps) => {
390
+ object.events[eventKey].reduceRight((event, l) => (l(event), event), {
391
+ shared: {},
392
+ ...eventProps
393
+ });
394
+ });
395
+ object.events[eventKey] = object.events[eventKey] || [];
396
+ object.events[eventKey].push(listener);
397
+ return () => {
398
+ let currentListeners = object.events[eventKey];
399
+ let index = currentListeners.indexOf(listener);
400
+ if (~index) {
401
+ currentListeners.splice(index, 1);
402
+ if (!currentListeners.length) {
403
+ object.events[eventKey + REVERT_MUTATION]();
404
+ delete object.events[eventKey + REVERT_MUTATION];
405
+ }
406
+ }
407
+ };
408
+ };
409
+ var onSet = ($store, listener) => on($store, listener, SET, (runListeners) => {
410
+ let originSet = $store.set;
411
+ let originSetKey = $store.setKey;
412
+ if ($store.setKey) $store.setKey = (changed, changedValue) => {
413
+ let isAborted;
414
+ let abort = () => {
415
+ isAborted = true;
416
+ };
417
+ runListeners({
418
+ abort,
419
+ changed,
420
+ newValue: {
421
+ ...$store.value,
422
+ [changed]: changedValue
423
+ }
424
+ });
425
+ if (!isAborted) return originSetKey(changed, changedValue);
426
+ };
427
+ $store.set = (newValue) => {
428
+ let isAborted;
429
+ let abort = () => {
430
+ isAborted = true;
431
+ };
432
+ runListeners({
433
+ abort,
434
+ newValue
435
+ });
436
+ if (!isAborted) return originSet(newValue);
437
+ };
438
+ return () => {
439
+ $store.set = originSet;
440
+ $store.setKey = originSetKey;
441
+ };
442
+ });
443
+ var STORE_UNMOUNT_DELAY = 1e3;
444
+ var onMount = ($store, initialize) => {
445
+ let listener = (payload) => {
446
+ let destroy = initialize(payload);
447
+ if (destroy) $store.events[UNMOUNT].push(destroy);
448
+ };
449
+ return on($store, listener, MOUNT, (runListeners) => {
450
+ let originListen = $store.listen;
451
+ $store.listen = (...args) => {
452
+ if (!$store.lc && !$store.active) {
453
+ $store.active = true;
454
+ runListeners();
455
+ }
456
+ return originListen(...args);
457
+ };
458
+ let originOff = $store.off;
459
+ $store.events[UNMOUNT] = [];
460
+ $store.off = () => {
461
+ originOff();
462
+ setTimeout(() => {
463
+ if ($store.active && !$store.lc) {
464
+ $store.active = false;
465
+ for (let destroy of $store.events[UNMOUNT]) destroy();
466
+ $store.events[UNMOUNT] = [];
467
+ }
468
+ }, STORE_UNMOUNT_DELAY);
469
+ };
470
+ return () => {
471
+ $store.listen = originListen;
472
+ $store.off = originOff;
473
+ };
474
+ });
475
+ };
476
+ //#endregion
477
+ //#region node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/deep-map/path.js
478
+ function getPath(obj, path) {
479
+ let allKeys = getAllKeysFromPath(path);
480
+ let res = obj;
481
+ for (let key of allKeys) {
482
+ if (res == null) return;
483
+ res = res[key];
484
+ }
485
+ return res;
486
+ }
487
+ var ARRAY_INDEX = /(.*)\[(\d+)\]/;
488
+ function getAllKeysFromPath(path) {
489
+ return path.split(".").flatMap((key) => getKeyAndIndicesFromKey(key));
490
+ }
491
+ function getKeyAndIndicesFromKey(key) {
492
+ if (ARRAY_INDEX.test(key)) {
493
+ let [, keyPart, index] = key.match(ARRAY_INDEX);
494
+ return [...getKeyAndIndicesFromKey(keyPart), index];
495
+ }
496
+ return [key];
497
+ }
498
+ //#endregion
499
+ //#region node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/listen-keys/index.js
500
+ function listenKeys($store, keys, listener) {
501
+ let keysSet = new Set(keys);
502
+ return $store.listen((value, oldValue, changed) => {
503
+ let pathChanged = (key) => !Object.is(getPath(value, key), getPath(oldValue, key));
504
+ if (changed === void 0 ? keys.some((key) => oldValue === void 0 || ($store.eqKey ? !$store.eqKey(oldValue[key], value[key], key) : pathChanged(key))) : keysSet.has(changed) || typeof changed === "string" && (keysSet.has(changed.split(/\.|\[/)[0]) || !$store.eqKey && oldValue !== void 0 && keys.some(pathChanged))) listener(value, oldValue, changed);
505
+ });
506
+ }
507
+ //#endregion
508
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/equality.mjs
509
+ function isPlainObject$1(value) {
510
+ if (typeof value !== "object" || value === null) return false;
511
+ const prototype = Object.getPrototypeOf(value);
512
+ return prototype === Object.prototype || prototype === null;
513
+ }
514
+ /**
515
+ * Deep structural equality for JSON-serializable values.
516
+ * Handles: primitives, null, arrays, and plain objects.
517
+ * Short-circuits on referential equality at every recursion level.
518
+ */
519
+ function isJsonEqual(a, b) {
520
+ if (a === b) return true;
521
+ if (Array.isArray(a) && Array.isArray(b)) {
522
+ if (a.length !== b.length) return false;
523
+ for (let i = 0; i < a.length; i++) if (!isJsonEqual(a[i], b[i])) return false;
524
+ return true;
525
+ }
526
+ if (isPlainObject$1(a) && isPlainObject$1(b)) {
527
+ const keysA = Object.keys(a);
528
+ const keysB = Object.keys(b);
529
+ if (keysA.length !== keysB.length) return false;
530
+ for (const key of keysA) if (!(key in b) || !isJsonEqual(a[key], b[key])) return false;
531
+ return true;
532
+ }
533
+ return false;
534
+ }
535
+ /**
536
+ * Attach an equality gate to a nanostores atom via `onSet`.
537
+ * When `isEqual(currentValue, newValue)` returns true, the `set()` call
538
+ * is aborted: no listeners fire, no framework re-renders occur.
539
+ *
540
+ * Returns the unsubscribe function from `onSet`.
541
+ */
542
+ function withEquality(store, isEqual) {
543
+ return onSet(store, ({ newValue, abort }) => {
544
+ if (isEqual(store.value, newValue)) abort();
545
+ });
546
+ }
547
+ //#endregion
548
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/query-atom.mjs
549
+ var kAuthQuery = Symbol.for("better-auth:auth-query");
550
+ function isAuthQueryStore(store) {
551
+ return kAuthQuery in store && store[kAuthQuery] === true;
552
+ }
553
+ function createAuthQueryAtom(initialValue) {
554
+ const queryAtom = /* @__PURE__ */ atom(initialValue);
555
+ Object.defineProperty(queryAtom, kAuthQuery, { value: true });
556
+ return queryAtom;
557
+ }
558
+ //#endregion
559
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/parser.mjs
560
+ var PROTO_POLLUTION_PATTERNS = {
561
+ proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
562
+ constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
563
+ protoShort: /"__proto__"\s*:/,
564
+ constructorShort: /"constructor"\s*:/
565
+ };
566
+ var JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
567
+ var SPECIAL_VALUES = {
568
+ true: true,
569
+ false: false,
570
+ null: null,
571
+ undefined: void 0,
572
+ nan: NaN,
573
+ infinity: Number.POSITIVE_INFINITY,
574
+ "-infinity": Number.NEGATIVE_INFINITY
575
+ };
576
+ var ISO_DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
577
+ function isValidDate(date) {
578
+ return date instanceof Date && !isNaN(date.getTime());
579
+ }
580
+ function parseISODate(value) {
581
+ const match = ISO_DATE_REGEX.exec(value);
582
+ if (!match) return null;
583
+ const [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;
584
+ const date = new Date(Date.UTC(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10), parseInt(hour, 10), parseInt(minute, 10), parseInt(second, 10), ms ? parseInt(ms.padEnd(3, "0"), 10) : 0));
585
+ if (offsetSign) {
586
+ const offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === "+" ? -1 : 1);
587
+ date.setUTCMinutes(date.getUTCMinutes() + offset);
588
+ }
589
+ return isValidDate(date) ? date : null;
590
+ }
591
+ function betterJSONParse(value, options = {}) {
592
+ const { strict = false, warnings = false, reviver, parseDates = true } = options;
593
+ if (typeof value !== "string") return value;
594
+ const trimmed = value.trim();
595
+ const lowerValue = trimmed.toLowerCase();
596
+ if (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];
597
+ if (!JSON_SIGNATURE.test(trimmed)) {
598
+ if (strict) throw new SyntaxError("[better-json] Invalid JSON");
599
+ return value;
600
+ }
601
+ if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
602
+ const matches = pattern.test(trimmed);
603
+ if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
604
+ return matches;
605
+ }) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
606
+ try {
607
+ const secureReviver = (key, value) => {
608
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
609
+ if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
610
+ return;
611
+ }
612
+ if (parseDates && typeof value === "string") {
613
+ const date = parseISODate(value);
614
+ if (date) return date;
615
+ }
616
+ return reviver ? reviver(key, value) : value;
617
+ };
618
+ return JSON.parse(trimmed, secureReviver);
619
+ } catch (error) {
620
+ if (strict) throw error;
621
+ return value;
622
+ }
623
+ }
624
+ function parseJSON(value, options = { strict: true }) {
625
+ return betterJSONParse(value, options);
626
+ }
627
+ //#endregion
628
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/fetch-plugins.mjs
629
+ var redirectPlugin = {
630
+ id: "redirect",
631
+ name: "Redirect",
632
+ hooks: { onSuccess(context) {
633
+ if (context.data?.url && context.data?.redirect && isSafeUrlScheme(context.data.url)) {
634
+ if (typeof window !== "undefined" && window.location) {
635
+ if (window.location) try {
636
+ window.location.href = context.data.url;
637
+ } catch {}
638
+ }
639
+ }
640
+ } }
641
+ };
642
+ //#endregion
643
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/broadcast-channel.mjs
644
+ var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
645
+ var now$1 = () => Math.floor(Date.now() / 1e3);
646
+ var WindowBroadcastChannel = class {
647
+ listeners = /* @__PURE__ */ new Set();
648
+ name;
649
+ constructor(name = "better-auth.message") {
650
+ this.name = name;
651
+ }
652
+ subscribe(listener) {
653
+ this.listeners.add(listener);
654
+ return () => {
655
+ this.listeners.delete(listener);
656
+ };
657
+ }
658
+ post(message) {
659
+ if (typeof window === "undefined") return;
660
+ try {
661
+ localStorage.setItem(this.name, JSON.stringify({
662
+ ...message,
663
+ timestamp: now$1()
664
+ }));
665
+ } catch {}
666
+ }
667
+ setup() {
668
+ if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
669
+ const handler = (event) => {
670
+ if (event.key !== this.name) return;
671
+ const message = JSON.parse(event.newValue ?? "{}");
672
+ if (message?.event !== "session" || !message?.data) return;
673
+ this.listeners.forEach((listener) => listener(message));
674
+ };
675
+ window.addEventListener("storage", handler);
676
+ return () => {
677
+ window.removeEventListener("storage", handler);
678
+ };
679
+ }
680
+ };
681
+ function getGlobalBroadcastChannel(name = "better-auth.message") {
682
+ if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
683
+ return globalThis[kBroadcastChannel];
684
+ }
685
+ //#endregion
686
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/focus-manager.mjs
687
+ var kFocusManager = Symbol.for("better-auth:focus-manager");
688
+ var WindowFocusManager = class {
689
+ listeners = /* @__PURE__ */ new Set();
690
+ subscribe(listener) {
691
+ this.listeners.add(listener);
692
+ return () => {
693
+ this.listeners.delete(listener);
694
+ };
695
+ }
696
+ setFocused(focused) {
697
+ this.listeners.forEach((listener) => listener(focused));
698
+ }
699
+ setup() {
700
+ if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {};
701
+ const visibilityHandler = () => {
702
+ if (document.visibilityState === "visible") this.setFocused(true);
703
+ };
704
+ document.addEventListener("visibilitychange", visibilityHandler, false);
705
+ return () => {
706
+ document.removeEventListener("visibilitychange", visibilityHandler, false);
707
+ };
708
+ }
709
+ };
710
+ function getGlobalFocusManager() {
711
+ if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
712
+ return globalThis[kFocusManager];
713
+ }
714
+ //#endregion
715
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/online-manager.mjs
716
+ var kOnlineManager = Symbol.for("better-auth:online-manager");
717
+ var WindowOnlineManager = class {
718
+ listeners = /* @__PURE__ */ new Set();
719
+ isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
720
+ subscribe(listener) {
721
+ this.listeners.add(listener);
722
+ return () => {
723
+ this.listeners.delete(listener);
724
+ };
725
+ }
726
+ setOnline(online) {
727
+ this.isOnline = online;
728
+ this.listeners.forEach((listener) => listener(online));
729
+ }
730
+ setup() {
731
+ if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
732
+ const onOnline = () => this.setOnline(true);
733
+ const onOffline = () => this.setOnline(false);
734
+ window.addEventListener("online", onOnline, false);
735
+ window.addEventListener("offline", onOffline, false);
736
+ return () => {
737
+ window.removeEventListener("online", onOnline, false);
738
+ window.removeEventListener("offline", onOffline, false);
739
+ };
740
+ }
741
+ };
742
+ function getGlobalOnlineManager() {
743
+ if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
744
+ return globalThis[kOnlineManager];
745
+ }
746
+ //#endregion
747
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/session-refresh.mjs
748
+ var now = () => Math.floor(Date.now() / 1e3);
749
+ /**
750
+ * Rate limit: don't refetch on focus if a session request was made within this many seconds
751
+ */
752
+ var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
753
+ function createSessionRefreshManager(opts) {
754
+ const { fetchSession, shouldPollSession = () => true, sessionSignal, options = {} } = opts;
755
+ const refetchInterval = options.sessionOptions?.refetchInterval ?? 0;
756
+ const refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;
757
+ const refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;
758
+ const state = {
759
+ isInitialized: false,
760
+ lastSessionRequest: 0
761
+ };
762
+ const shouldRefetch = () => {
763
+ return refetchWhenOffline || getGlobalOnlineManager().isOnline;
764
+ };
765
+ const triggerRefetch = (event) => {
766
+ if (!shouldRefetch()) return;
767
+ if (event?.event === "storage") {
768
+ fetchSession();
769
+ return;
770
+ }
771
+ if (event?.event === "poll") {
772
+ state.lastSessionRequest = now();
773
+ fetchSession();
774
+ return;
775
+ }
776
+ if (event?.event === "visibilitychange") {
777
+ if (now() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;
778
+ state.lastSessionRequest = now();
779
+ fetchSession();
780
+ return;
781
+ }
782
+ fetchSession();
783
+ };
784
+ const broadcastSessionUpdate = (trigger) => {
785
+ getGlobalBroadcastChannel().post({
786
+ event: "session",
787
+ data: { trigger },
788
+ clientId: Math.random().toString(36).substring(7)
789
+ });
790
+ };
791
+ const setupPolling = () => {
792
+ if (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {
793
+ if (shouldPollSession()) triggerRefetch({ event: "poll" });
794
+ }, refetchInterval * 1e3);
795
+ };
796
+ const setupBroadcast = () => {
797
+ state.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {
798
+ triggerRefetch({ event: "storage" });
799
+ });
800
+ };
801
+ const setupFocusRefetch = () => {
802
+ if (!refetchOnWindowFocus) return;
803
+ state.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {
804
+ triggerRefetch({ event: "visibilitychange" });
805
+ });
806
+ };
807
+ const setupOnlineRefetch = () => {
808
+ state.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {
809
+ if (online) triggerRefetch({ event: "visibilitychange" });
810
+ });
811
+ };
812
+ const setupSignalSubscription = () => {
813
+ state.unsubscribeSignal = sessionSignal.listen(() => {
814
+ fetchSession();
815
+ });
816
+ };
817
+ const init = () => {
818
+ if (state.isInitialized) return;
819
+ state.isInitialized = true;
820
+ setupPolling();
821
+ setupBroadcast();
822
+ setupFocusRefetch();
823
+ setupOnlineRefetch();
824
+ setupSignalSubscription();
825
+ state.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();
826
+ state.cleanupFocusSetup = getGlobalFocusManager().setup();
827
+ state.cleanupOnlineSetup = getGlobalOnlineManager().setup();
828
+ };
829
+ const cleanup = () => {
830
+ if (!state.isInitialized) return;
831
+ if (state.pollInterval) {
832
+ clearInterval(state.pollInterval);
833
+ state.pollInterval = void 0;
834
+ }
835
+ if (state.unsubscribeBroadcast) {
836
+ state.unsubscribeBroadcast();
837
+ state.unsubscribeBroadcast = void 0;
838
+ }
839
+ if (state.unsubscribeFocus) {
840
+ state.unsubscribeFocus();
841
+ state.unsubscribeFocus = void 0;
842
+ }
843
+ if (state.unsubscribeOnline) {
844
+ state.unsubscribeOnline();
845
+ state.unsubscribeOnline = void 0;
846
+ }
847
+ if (state.unsubscribeSignal) {
848
+ state.unsubscribeSignal();
849
+ state.unsubscribeSignal = void 0;
850
+ }
851
+ if (state.cleanupBroadcastSetup) {
852
+ state.cleanupBroadcastSetup();
853
+ state.cleanupBroadcastSetup = void 0;
854
+ }
855
+ if (state.cleanupFocusSetup) {
856
+ state.cleanupFocusSetup();
857
+ state.cleanupFocusSetup = void 0;
858
+ }
859
+ if (state.cleanupOnlineSetup) {
860
+ state.cleanupOnlineSetup();
861
+ state.cleanupOnlineSetup = void 0;
862
+ }
863
+ state.isInitialized = false;
864
+ state.lastSessionRequest = 0;
865
+ };
866
+ return {
867
+ init,
868
+ cleanup,
869
+ triggerRefetch,
870
+ broadcastSessionUpdate
871
+ };
872
+ }
873
+ //#endregion
874
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/session-atom.mjs
875
+ var isServer = () => typeof window === "undefined";
876
+ var SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
877
+ function hydrateSessionAtom(sessionAtom, session) {
878
+ if (typeof window === "undefined") return;
879
+ const currentSession = sessionAtom.get();
880
+ if (currentSession.data !== null || session === null) return;
881
+ sessionAtom.set({
882
+ ...currentSession,
883
+ data: session,
884
+ error: null,
885
+ isPending: false
886
+ });
887
+ }
888
+ /**
889
+ * Normalize $fetch response: `throw: true` returns data directly,
890
+ * otherwise `{ data, error }`.
891
+ */
892
+ function normalizeSessionResponse(res) {
893
+ if (typeof res === "object" && res !== null && "data" in res && "error" in res) return res;
894
+ return {
895
+ data: res,
896
+ error: null
897
+ };
898
+ }
899
+ function normalizeSessionData(data) {
900
+ if (!data) return null;
901
+ if (data.session === null && data.user === null) return null;
902
+ return data;
903
+ }
904
+ function isSessionAtomEqual(a, b) {
905
+ return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
906
+ }
907
+ function getSessionAtom($fetch, options) {
908
+ const $signal = /* @__PURE__ */ atom(false);
909
+ let flight;
910
+ let freshUntil = 0;
911
+ let sessionRevision = 0;
912
+ $signal.listen(() => {
913
+ sessionRevision++;
914
+ freshUntil = 0;
915
+ });
916
+ const refetch = (queryParams) => fetchSession(queryParams);
917
+ const session = createAuthQueryAtom({
918
+ data: null,
919
+ error: null,
920
+ isPending: true,
921
+ isRefetching: false,
922
+ refetch
923
+ });
924
+ withEquality(session, isSessionAtomEqual);
925
+ const executeSessionFetch = async (signal, queryParams) => {
926
+ const current = session.value;
927
+ session.set({
928
+ ...current,
929
+ isPending: current.data === null,
930
+ isRefetching: true,
931
+ error: null,
932
+ refetch
933
+ });
934
+ if (signal.aborted) return "aborted";
935
+ try {
936
+ const res = await $fetch("/get-session", {
937
+ method: "GET",
938
+ query: queryParams?.query,
939
+ signal
940
+ });
941
+ if (signal.aborted) return "aborted";
942
+ let { data, error } = normalizeSessionResponse(res);
943
+ let outcome = "fresh";
944
+ if (data?.needsRefresh) try {
945
+ const refreshRes = await $fetch("/get-session", {
946
+ method: "POST",
947
+ signal
948
+ });
949
+ if (signal.aborted) return "aborted";
950
+ ({data, error} = normalizeSessionResponse(refreshRes));
951
+ } catch {
952
+ if (signal.aborted) return "aborted";
953
+ outcome = "stale";
954
+ }
955
+ if (error) {
956
+ const latest = session.value;
957
+ const isUnauthorized = error?.status === 401;
958
+ session.set({
959
+ data: isUnauthorized ? null : latest.data,
960
+ error,
961
+ isPending: false,
962
+ isRefetching: false,
963
+ refetch
964
+ });
965
+ return "failed";
966
+ }
967
+ const sessionData = normalizeSessionData(data);
968
+ const current = session.value;
969
+ const stableData = current.data != null && sessionData != null && isJsonEqual(current.data, sessionData) ? current.data : sessionData;
970
+ session.set({
971
+ data: stableData,
972
+ error: null,
973
+ isPending: false,
974
+ isRefetching: false,
975
+ refetch
976
+ });
977
+ return outcome;
978
+ } catch (fetchError) {
979
+ if (signal.aborted) return "aborted";
980
+ const latest = session.value;
981
+ session.set({
982
+ data: latest.data,
983
+ error: fetchError,
984
+ isPending: false,
985
+ isRefetching: false,
986
+ refetch
987
+ });
988
+ return "failed";
989
+ }
990
+ };
991
+ const getFreshUntil = () => {
992
+ const expiresAt = session.value.data?.session?.expiresAt;
993
+ const sessionExpiresAt = expiresAt instanceof Date ? expiresAt.getTime() : Number.POSITIVE_INFINITY;
994
+ return Math.min(Date.now() + SESSION_MOUNT_DEDUPE_INTERVAL, sessionExpiresAt);
995
+ };
996
+ const fetchSession = (queryParams) => {
997
+ freshUntil = 0;
998
+ flight?.cancel();
999
+ const controller = new AbortController();
1000
+ const request = {
1001
+ cancel: () => controller.abort(),
1002
+ promise: Promise.resolve().then(() => {
1003
+ if (controller.signal.aborted) return "aborted";
1004
+ return executeSessionFetch(controller.signal, queryParams);
1005
+ }),
1006
+ revision: sessionRevision
1007
+ };
1008
+ flight = request;
1009
+ const settleFlight = (outcome) => {
1010
+ if (flight !== request) return;
1011
+ flight = void 0;
1012
+ if (outcome === "fresh" && request.revision === sessionRevision) freshUntil = getFreshUntil();
1013
+ };
1014
+ request.promise.then(settleFlight, () => settleFlight("failed"));
1015
+ return request.promise.then(() => void 0);
1016
+ };
1017
+ const fetchSessionOnMount = () => {
1018
+ if (flight?.revision === sessionRevision) return flight.promise.then(() => void 0);
1019
+ if (Date.now() < freshUntil) return Promise.resolve();
1020
+ return fetchSession();
1021
+ };
1022
+ let broadcastSessionUpdate = () => {};
1023
+ onMount(session, () => {
1024
+ let timeoutId;
1025
+ if (!isServer()) timeoutId = setTimeout(() => {
1026
+ fetchSessionOnMount();
1027
+ }, 0);
1028
+ const refreshManager = createSessionRefreshManager({
1029
+ fetchSession,
1030
+ shouldPollSession: () => session.value.data != null,
1031
+ sessionSignal: $signal,
1032
+ options
1033
+ });
1034
+ refreshManager.init();
1035
+ broadcastSessionUpdate = refreshManager.broadcastSessionUpdate;
1036
+ return () => {
1037
+ if (timeoutId) clearTimeout(timeoutId);
1038
+ refreshManager.cleanup();
1039
+ };
1040
+ });
1041
+ return {
1042
+ session,
1043
+ $sessionSignal: $signal,
1044
+ broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
1045
+ };
1046
+ }
1047
+ //#endregion
1048
+ //#region node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1049
+ function isPlainObject(value) {
1050
+ if (value === null || typeof value !== "object") return false;
1051
+ const prototype = Object.getPrototypeOf(value);
1052
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
1053
+ if (Symbol.iterator in value) return false;
1054
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
1055
+ return true;
1056
+ }
1057
+ function _defu(baseObject, defaults, namespace = ".", merger) {
1058
+ if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
1059
+ const object = { ...defaults };
1060
+ for (const key of Object.keys(baseObject)) {
1061
+ if (key === "__proto__" || key === "constructor") continue;
1062
+ const value = baseObject[key];
1063
+ if (value === null || value === void 0) continue;
1064
+ if (merger && merger(object, key, value, namespace)) continue;
1065
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
1066
+ else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
1067
+ else object[key] = value;
1068
+ }
1069
+ return object;
1070
+ }
1071
+ function createDefu(merger) {
1072
+ return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
1073
+ }
1074
+ var defu = createDefu();
1075
+ //#endregion
1076
+ //#region node_modules/.pnpm/@better-fetch+fetch@1.3.2/node_modules/@better-fetch/fetch/dist/index.js
1077
+ var BetterFetchError = class extends Error {
1078
+ constructor(status, statusText, error) {
1079
+ super(statusText || status.toString(), { cause: error });
1080
+ this.status = status;
1081
+ this.statusText = statusText;
1082
+ this.error = error;
1083
+ Error.captureStackTrace(this, this.constructor);
1084
+ }
1085
+ };
1086
+ var initializePlugins = async (url, options) => {
1087
+ let opts = options || {};
1088
+ const hooks = {
1089
+ onRequest: [options === null || options === void 0 ? void 0 : options.onRequest],
1090
+ onResponse: [options === null || options === void 0 ? void 0 : options.onResponse],
1091
+ onSuccess: [options === null || options === void 0 ? void 0 : options.onSuccess],
1092
+ onError: [options === null || options === void 0 ? void 0 : options.onError],
1093
+ onRetry: [options === null || options === void 0 ? void 0 : options.onRetry]
1094
+ };
1095
+ if (!options || !(options === null || options === void 0 ? void 0 : options.plugins)) return {
1096
+ url,
1097
+ options: opts,
1098
+ hooks
1099
+ };
1100
+ for (const plugin of (options === null || options === void 0 ? void 0 : options.plugins) || []) {
1101
+ var _plugin$hooks, _plugin$hooks2, _plugin$hooks3, _plugin$hooks4, _plugin$hooks5;
1102
+ if (plugin.init) {
1103
+ var _plugin$init;
1104
+ const pluginRes = await ((_plugin$init = plugin.init) === null || _plugin$init === void 0 ? void 0 : _plugin$init.call(plugin, url.toString(), opts));
1105
+ opts = pluginRes.options || opts;
1106
+ url = pluginRes.url;
1107
+ }
1108
+ hooks.onRequest.push((_plugin$hooks = plugin.hooks) === null || _plugin$hooks === void 0 ? void 0 : _plugin$hooks.onRequest);
1109
+ hooks.onResponse.push((_plugin$hooks2 = plugin.hooks) === null || _plugin$hooks2 === void 0 ? void 0 : _plugin$hooks2.onResponse);
1110
+ hooks.onSuccess.push((_plugin$hooks3 = plugin.hooks) === null || _plugin$hooks3 === void 0 ? void 0 : _plugin$hooks3.onSuccess);
1111
+ hooks.onError.push((_plugin$hooks4 = plugin.hooks) === null || _plugin$hooks4 === void 0 ? void 0 : _plugin$hooks4.onError);
1112
+ hooks.onRetry.push((_plugin$hooks5 = plugin.hooks) === null || _plugin$hooks5 === void 0 ? void 0 : _plugin$hooks5.onRetry);
1113
+ }
1114
+ return {
1115
+ url,
1116
+ options: opts,
1117
+ hooks
1118
+ };
1119
+ };
1120
+ var LinearRetryStrategy = class {
1121
+ constructor(options) {
1122
+ this.options = options;
1123
+ }
1124
+ shouldAttemptRetry(attempt, response) {
1125
+ if (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));
1126
+ return Promise.resolve(attempt < this.options.attempts);
1127
+ }
1128
+ getDelay() {
1129
+ return this.options.delay;
1130
+ }
1131
+ };
1132
+ var ExponentialRetryStrategy = class {
1133
+ constructor(options) {
1134
+ this.options = options;
1135
+ }
1136
+ shouldAttemptRetry(attempt, response) {
1137
+ if (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));
1138
+ return Promise.resolve(attempt < this.options.attempts);
1139
+ }
1140
+ getDelay(attempt) {
1141
+ return Math.min(this.options.maxDelay, this.options.baseDelay * 2 ** attempt);
1142
+ }
1143
+ };
1144
+ function createRetryStrategy(options) {
1145
+ if (typeof options === "number") return new LinearRetryStrategy({
1146
+ type: "linear",
1147
+ attempts: options,
1148
+ delay: 1e3
1149
+ });
1150
+ switch (options.type) {
1151
+ case "linear": return new LinearRetryStrategy(options);
1152
+ case "exponential": return new ExponentialRetryStrategy(options);
1153
+ default: throw new Error("Invalid retry strategy");
1154
+ }
1155
+ }
1156
+ var methods = [
1157
+ "get",
1158
+ "post",
1159
+ "put",
1160
+ "patch",
1161
+ "delete"
1162
+ ];
1163
+ function parseMethodModifier(path) {
1164
+ if (!path.startsWith("@")) return {
1165
+ method: void 0,
1166
+ path
1167
+ };
1168
+ const separator = path.indexOf("/");
1169
+ const method = path.slice(1, separator === -1 ? void 0 : separator);
1170
+ if (!methods.includes(method)) return {
1171
+ method: void 0,
1172
+ path
1173
+ };
1174
+ return {
1175
+ method,
1176
+ path: separator === -1 ? path : path.slice(separator + 1)
1177
+ };
1178
+ }
1179
+ var isReservedPathSegment = (value) => value === "." || value === "..";
1180
+ var encodeLiteralPathSegment = (segment) => segment.split(":").map((part) => encodeURIComponent(part)).join(":");
1181
+ function resolvePathSegment(segment, pathParams) {
1182
+ const pathParam = pathParams.get(segment);
1183
+ if (pathParam === void 0) return encodeLiteralPathSegment(segment);
1184
+ if (isReservedPathSegment(pathParam)) throw new TypeError("Path parameters cannot be reserved path segments");
1185
+ return encodeURIComponent(pathParam);
1186
+ }
1187
+ /**
1188
+ * Normalize URL
1189
+ */
1190
+ function getURL$1(url, option) {
1191
+ const { baseURL, params, query } = option || {
1192
+ query: {},
1193
+ params: {},
1194
+ baseURL: ""
1195
+ };
1196
+ let basePath = url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL || "";
1197
+ const { path: requestPath } = parseMethodModifier(url);
1198
+ if (requestPath !== url) url = `/${requestPath}`;
1199
+ if (!basePath.endsWith("/")) basePath += "/";
1200
+ let [path, urlQuery] = url.replace(basePath, "").split("?");
1201
+ const queryParams = new URLSearchParams(urlQuery);
1202
+ for (const [key, value] of Object.entries(query || {})) {
1203
+ if (value == null) continue;
1204
+ let serializedValue;
1205
+ if (typeof value === "string") serializedValue = value;
1206
+ else if (Array.isArray(value)) {
1207
+ for (const val of value) queryParams.append(key, val);
1208
+ continue;
1209
+ } else serializedValue = JSON.stringify(value);
1210
+ queryParams.set(key, serializedValue);
1211
+ }
1212
+ const pathParams = /* @__PURE__ */ new Map();
1213
+ if (params) if (Array.isArray(params)) {
1214
+ const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
1215
+ for (const [index, key] of paramPaths.entries()) {
1216
+ const value = params[index];
1217
+ pathParams.set(key, String(value));
1218
+ }
1219
+ } else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
1220
+ path = path.split("/").map((segment) => resolvePathSegment(segment, pathParams)).join("/");
1221
+ path = path.replace(/^\/+/, "");
1222
+ let queryParamString = queryParams.toString();
1223
+ queryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
1224
+ if (!basePath.startsWith("http")) return `${basePath}${path}${queryParamString}`;
1225
+ return new URL(`${path}${queryParamString}`, basePath);
1226
+ }
1227
+ var getAuthHeader = async (options) => {
1228
+ const headers = {};
1229
+ const getValue = async (value) => typeof value === "function" ? await value() : value;
1230
+ if (options === null || options === void 0 ? void 0 : options.auth) {
1231
+ if (options.auth.type === "Bearer") {
1232
+ const token = await getValue(options.auth.token);
1233
+ if (!token) return headers;
1234
+ headers["authorization"] = `Bearer ${token}`;
1235
+ } else if (options.auth.type === "Basic") {
1236
+ const [username, password] = await Promise.all([getValue(options.auth.username), getValue(options.auth.password)]);
1237
+ if (!username || !password) return headers;
1238
+ headers["authorization"] = `Basic ${btoa(`${username}:${password}`)}`;
1239
+ } else if (options.auth.type === "Custom") {
1240
+ const [prefix, value] = await Promise.all([getValue(options.auth.prefix), getValue(options.auth.value)]);
1241
+ if (!value) return headers;
1242
+ headers["authorization"] = `${prefix !== null && prefix !== void 0 ? prefix : ""} ${value}`;
1243
+ }
1244
+ }
1245
+ return headers;
1246
+ };
1247
+ var JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
1248
+ function detectResponseType(request) {
1249
+ const _contentType = request.headers.get("content-type");
1250
+ const textTypes = /* @__PURE__ */ new Set([
1251
+ "image/svg",
1252
+ "application/xml",
1253
+ "application/xhtml",
1254
+ "application/html"
1255
+ ]);
1256
+ if (!_contentType) return "json";
1257
+ const contentType = _contentType.split(";").shift() || "";
1258
+ if (JSON_RE.test(contentType)) return "json";
1259
+ if (textTypes.has(contentType) || contentType.startsWith("text/")) return "text";
1260
+ return "blob";
1261
+ }
1262
+ function isJSONParsable(value) {
1263
+ try {
1264
+ JSON.parse(value);
1265
+ return true;
1266
+ } catch (error) {
1267
+ return false;
1268
+ }
1269
+ }
1270
+ function isJSONSerializable(value) {
1271
+ if (value === void 0) return false;
1272
+ const t = typeof value;
1273
+ if (t === "string" || t === "number" || t === "boolean" || t === null) return true;
1274
+ if (t !== "object") return false;
1275
+ if (Array.isArray(value)) return true;
1276
+ if (value.buffer) return false;
1277
+ return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
1278
+ }
1279
+ function jsonParse(text) {
1280
+ try {
1281
+ return JSON.parse(text);
1282
+ } catch (error) {
1283
+ return text;
1284
+ }
1285
+ }
1286
+ function isFunction(value) {
1287
+ return typeof value === "function";
1288
+ }
1289
+ function getFetch(options) {
1290
+ if (options === null || options === void 0 ? void 0 : options.customFetchImpl) return options.customFetchImpl;
1291
+ if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) return globalThis.fetch;
1292
+ if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch;
1293
+ throw new Error("No fetch implementation found");
1294
+ }
1295
+ function mergeHeaders(...sources) {
1296
+ const merged = {};
1297
+ for (const source of sources) {
1298
+ if (!source) continue;
1299
+ if (source instanceof Headers) source.forEach((value, key) => {
1300
+ merged[key] = value;
1301
+ });
1302
+ else {
1303
+ const entries = Array.isArray(source) ? source : Object.entries(source);
1304
+ for (const [key, value] of entries) if (value !== null && value !== void 0) merged[key] = value;
1305
+ }
1306
+ }
1307
+ return merged;
1308
+ }
1309
+ async function getHeaders(opts) {
1310
+ const headers = new Headers(mergeHeaders(opts === null || opts === void 0 ? void 0 : opts.headers, await getAuthHeader(opts)));
1311
+ if (!headers.has("content-type")) {
1312
+ const contentType = detectContentType(opts === null || opts === void 0 ? void 0 : opts.body);
1313
+ if (contentType) headers.set("content-type", contentType);
1314
+ }
1315
+ return headers;
1316
+ }
1317
+ function detectContentType(body) {
1318
+ if (isJSONSerializable(body)) return "application/json";
1319
+ return null;
1320
+ }
1321
+ function getMediaType(headers) {
1322
+ const contentType = headers.get("content-type");
1323
+ return contentType ? contentType.split(";")[0].trim().toLowerCase() : null;
1324
+ }
1325
+ function getBody(options, headers) {
1326
+ const { body } = options;
1327
+ if (!body) return null;
1328
+ if (!isJSONSerializable(body)) return body;
1329
+ if (typeof body === "string") return body;
1330
+ if (getMediaType(headers) === "application/x-www-form-urlencoded") return new URLSearchParams(body).toString();
1331
+ return JSON.stringify(body);
1332
+ }
1333
+ function getMethod$1(url, options) {
1334
+ if (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();
1335
+ const { method } = parseMethodModifier(url);
1336
+ if (method) return method.toUpperCase();
1337
+ return (options === null || options === void 0 ? void 0 : options.body) ? "POST" : "GET";
1338
+ }
1339
+ function getTimeout(options, controller) {
1340
+ let abortTimeout;
1341
+ if (!(options === null || options === void 0 ? void 0 : options.signal) && (options === null || options === void 0 ? void 0 : options.timeout)) abortTimeout = setTimeout(() => controller === null || controller === void 0 ? void 0 : controller.abort(), options === null || options === void 0 ? void 0 : options.timeout);
1342
+ return {
1343
+ abortTimeout,
1344
+ clearTimeout: () => {
1345
+ if (abortTimeout) clearTimeout(abortTimeout);
1346
+ }
1347
+ };
1348
+ }
1349
+ var ValidationError = class ValidationError extends Error {
1350
+ constructor(issues, message) {
1351
+ super(message || JSON.stringify(issues, null, 2));
1352
+ this.issues = issues;
1353
+ Object.setPrototypeOf(this, ValidationError.prototype);
1354
+ }
1355
+ };
1356
+ async function parseStandardSchema(schema, input) {
1357
+ const result = await schema["~standard"].validate(input);
1358
+ if (result.issues) throw new ValidationError(result.issues);
1359
+ return result.value;
1360
+ }
1361
+ function _typeof(o) {
1362
+ "@babel/helpers - typeof";
1363
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1364
+ return typeof o;
1365
+ } : function(o) {
1366
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1367
+ }, _typeof(o);
1368
+ }
1369
+ function toPrimitive(t, r) {
1370
+ if ("object" != _typeof(t) || !t) return t;
1371
+ var e = t[Symbol.toPrimitive];
1372
+ if (void 0 !== e) {
1373
+ var i = e.call(t, r || "default");
1374
+ if ("object" != _typeof(i)) return i;
1375
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1376
+ }
1377
+ return ("string" === r ? String : Number)(t);
1378
+ }
1379
+ function toPropertyKey(t) {
1380
+ var i = toPrimitive(t, "string");
1381
+ return "symbol" == _typeof(i) ? i : i + "";
1382
+ }
1383
+ function _defineProperty(e, r, t) {
1384
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1385
+ value: t,
1386
+ enumerable: !0,
1387
+ configurable: !0,
1388
+ writable: !0
1389
+ }) : e[r] = t, e;
1390
+ }
1391
+ function ownKeys(e, r) {
1392
+ var t = Object.keys(e);
1393
+ if (Object.getOwnPropertySymbols) {
1394
+ var o = Object.getOwnPropertySymbols(e);
1395
+ r && (o = o.filter(function(r) {
1396
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
1397
+ })), t.push.apply(t, o);
1398
+ }
1399
+ return t;
1400
+ }
1401
+ function _objectSpread2(e) {
1402
+ for (var r = 1; r < arguments.length; r++) {
1403
+ var t = null != arguments[r] ? arguments[r] : {};
1404
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
1405
+ _defineProperty(e, r, t[r]);
1406
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
1407
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
1408
+ });
1409
+ }
1410
+ return e;
1411
+ }
1412
+ var betterFetch = async (url, options) => {
1413
+ var _opts$signal, _options$body, _options$jsonParser;
1414
+ const { hooks, url: __url, options: opts } = await initializePlugins(url, options);
1415
+ const fetch = getFetch(opts);
1416
+ const controller = new AbortController();
1417
+ const signal = (_opts$signal = opts.signal) !== null && _opts$signal !== void 0 ? _opts$signal : controller.signal;
1418
+ const _url = getURL$1(__url, opts);
1419
+ const headers = await getHeaders(opts);
1420
+ const body = getBody(opts, headers);
1421
+ const method = getMethod$1(__url, opts);
1422
+ const context = _objectSpread2(_objectSpread2({}, opts), {}, {
1423
+ url: _url,
1424
+ headers,
1425
+ body,
1426
+ method,
1427
+ signal
1428
+ });
1429
+ /**
1430
+ * Run all on request hooks
1431
+ */
1432
+ for (const onRequest of hooks.onRequest) if (onRequest) {
1433
+ const res = await onRequest(context);
1434
+ if (typeof res === "object" && res !== null) Object.assign(context, res);
1435
+ }
1436
+ if ("pipeTo" in context && typeof context.pipeTo === "function" || typeof (options === null || options === void 0 || (_options$body = options.body) === null || _options$body === void 0 ? void 0 : _options$body.pipe) === "function") {
1437
+ if (!("duplex" in context)) context.duplex = "half";
1438
+ }
1439
+ const { clearTimeout } = getTimeout(opts, controller);
1440
+ let response = await fetch(context.url, context);
1441
+ clearTimeout();
1442
+ const responseContext = {
1443
+ response,
1444
+ request: context
1445
+ };
1446
+ for (const onResponse of hooks.onResponse) if (onResponse) {
1447
+ var _options$hookOptions;
1448
+ const r = await onResponse(_objectSpread2(_objectSpread2({}, responseContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions = options.hookOptions) === null || _options$hookOptions === void 0 ? void 0 : _options$hookOptions.cloneResponse) ? response.clone() : response }));
1449
+ if (r instanceof Response) response = r;
1450
+ else if (typeof r === "object" && r !== null) response = r.response;
1451
+ }
1452
+ /**
1453
+ * OK Branch
1454
+ */
1455
+ if (response.ok) {
1456
+ if (!(context.method !== "HEAD")) return {
1457
+ data: "",
1458
+ error: null
1459
+ };
1460
+ const responseType = detectResponseType(response);
1461
+ const successContext = {
1462
+ data: null,
1463
+ response,
1464
+ request: context
1465
+ };
1466
+ if (responseType === "json" || responseType === "text") {
1467
+ var _context$jsonParser;
1468
+ const text = await response.text();
1469
+ successContext.data = await ((_context$jsonParser = context.jsonParser) !== null && _context$jsonParser !== void 0 ? _context$jsonParser : jsonParse)(text);
1470
+ } else successContext.data = await response[responseType]();
1471
+ /**
1472
+ * Parse the data if the output schema is defined
1473
+ */
1474
+ if (context === null || context === void 0 ? void 0 : context.output) {
1475
+ if (context.output && !context.disableValidation) successContext.data = await parseStandardSchema(context.output, successContext.data);
1476
+ }
1477
+ for (const onSuccess of hooks.onSuccess) if (onSuccess) {
1478
+ var _options$hookOptions2;
1479
+ await onSuccess(_objectSpread2(_objectSpread2({}, successContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions2 = options.hookOptions) === null || _options$hookOptions2 === void 0 ? void 0 : _options$hookOptions2.cloneResponse) ? response.clone() : response }));
1480
+ }
1481
+ if (options === null || options === void 0 ? void 0 : options.throw) return successContext.data;
1482
+ return {
1483
+ data: successContext.data,
1484
+ error: null
1485
+ };
1486
+ }
1487
+ const parser = (_options$jsonParser = options === null || options === void 0 ? void 0 : options.jsonParser) !== null && _options$jsonParser !== void 0 ? _options$jsonParser : jsonParse;
1488
+ const responseText = await response.text();
1489
+ const isJSONResponse = isJSONParsable(responseText);
1490
+ const errorObject = isJSONResponse ? await parser(responseText) : null;
1491
+ /**
1492
+ * Error Branch
1493
+ */
1494
+ const errorContext = {
1495
+ response,
1496
+ responseText,
1497
+ request: context,
1498
+ error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
1499
+ status: response.status,
1500
+ statusText: response.statusText
1501
+ })
1502
+ };
1503
+ for (const onError of hooks.onError) if (onError) {
1504
+ var _options$hookOptions3;
1505
+ await onError(_objectSpread2(_objectSpread2({}, errorContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions3 = options.hookOptions) === null || _options$hookOptions3 === void 0 ? void 0 : _options$hookOptions3.cloneResponse) ? response.clone() : response }));
1506
+ }
1507
+ if (options === null || options === void 0 ? void 0 : options.retry) {
1508
+ var _options$retryAttempt;
1509
+ const retryStrategy = createRetryStrategy(options.retry);
1510
+ const _retryAttempt = (_options$retryAttempt = options.retryAttempt) !== null && _options$retryAttempt !== void 0 ? _options$retryAttempt : 0;
1511
+ if (await retryStrategy.shouldAttemptRetry(_retryAttempt, response)) {
1512
+ for (const onRetry of hooks.onRetry) if (onRetry) await onRetry(responseContext);
1513
+ const delay = retryStrategy.getDelay(_retryAttempt);
1514
+ await new Promise((resolve) => setTimeout(resolve, delay));
1515
+ return await betterFetch(url, _objectSpread2(_objectSpread2({}, options), {}, { retryAttempt: _retryAttempt + 1 }));
1516
+ }
1517
+ }
1518
+ if (options === null || options === void 0 ? void 0 : options.throw) throw new BetterFetchError(response.status, response.statusText, isJSONResponse ? errorObject : responseText);
1519
+ return {
1520
+ data: null,
1521
+ error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
1522
+ status: response.status,
1523
+ statusText: response.statusText
1524
+ })
1525
+ };
1526
+ };
1527
+ var applySchemaPlugin = (config) => ({
1528
+ id: "apply-schema",
1529
+ name: "Apply Schema",
1530
+ version: "1.0.0",
1531
+ async init(url, options) {
1532
+ var _config$plugins;
1533
+ let opts = _objectSpread2(_objectSpread2({}, options), config.query !== void 0 && { query: _objectSpread2(_objectSpread2({}, config.query), options === null || options === void 0 ? void 0 : options.query) });
1534
+ const schema = ((_config$plugins = config.plugins) === null || _config$plugins === void 0 || (_config$plugins = _config$plugins.find((plugin) => {
1535
+ var _plugin$schema;
1536
+ return ((_plugin$schema = plugin.schema) === null || _plugin$schema === void 0 ? void 0 : _plugin$schema.config) ? url.startsWith(plugin.schema.config.baseURL || "") || url.startsWith(plugin.schema.config.prefix || "") : false;
1537
+ })) === null || _config$plugins === void 0 ? void 0 : _config$plugins.schema) || config.schema;
1538
+ if (schema) {
1539
+ var _schema$config, _schema$config2;
1540
+ let urlKey = url;
1541
+ if ((_schema$config = schema.config) === null || _schema$config === void 0 ? void 0 : _schema$config.prefix) {
1542
+ if (urlKey.startsWith(schema.config.prefix)) {
1543
+ urlKey = urlKey.replace(schema.config.prefix, "");
1544
+ if (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);
1545
+ }
1546
+ }
1547
+ if ((_schema$config2 = schema.config) === null || _schema$config2 === void 0 ? void 0 : _schema$config2.baseURL) {
1548
+ if (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, "");
1549
+ }
1550
+ if (urlKey.startsWith("/") && urlKey.charAt(1) === "@") urlKey = urlKey.substring(1);
1551
+ const keySchema = schema.schema[urlKey];
1552
+ if (keySchema) {
1553
+ var _keySchema$method;
1554
+ const { method: schemaMethod, path } = parseMethodModifier(urlKey);
1555
+ if (schemaMethod) url = url.slice(0, url.length - urlKey.length) + path;
1556
+ let validatedHeaders = options === null || options === void 0 ? void 0 : options.headers;
1557
+ if (keySchema.headers && !(options === null || options === void 0 ? void 0 : options.disableValidation)) {
1558
+ const normalizedHeaders = {};
1559
+ if (options === null || options === void 0 ? void 0 : options.headers) {
1560
+ if (options.headers instanceof Headers) options.headers.forEach((value, key) => {
1561
+ normalizedHeaders[key.toLowerCase()] = value;
1562
+ });
1563
+ else if (typeof options.headers === "object") {
1564
+ for (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;
1565
+ }
1566
+ }
1567
+ const validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);
1568
+ const finalHeaders = {};
1569
+ for (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;
1570
+ validatedHeaders = finalHeaders;
1571
+ }
1572
+ const method = (_keySchema$method = keySchema.method) !== null && _keySchema$method !== void 0 ? _keySchema$method : schemaMethod;
1573
+ opts = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, opts), method !== void 0 && { method }), keySchema.output !== void 0 && { output: keySchema.output }), validatedHeaders !== void 0 && { headers: validatedHeaders });
1574
+ if (!(options === null || options === void 0 ? void 0 : options.disableValidation)) {
1575
+ if (keySchema.query) {
1576
+ opts.query = await parseStandardSchema(keySchema.query, options === null || options === void 0 ? void 0 : options.query);
1577
+ if (opts.query !== null && typeof opts.query === "object") {
1578
+ const defaults = _objectSpread2({}, config.query);
1579
+ for (const key of Object.keys(defaults)) if ((options === null || options === void 0 ? void 0 : options.query) && Object.prototype.hasOwnProperty.call(options.query, key)) defaults[key] = options.query[key];
1580
+ opts.query = _objectSpread2(_objectSpread2({}, defaults), opts.query);
1581
+ }
1582
+ }
1583
+ opts = _objectSpread2(_objectSpread2({}, opts), {}, {
1584
+ body: keySchema.input ? await parseStandardSchema(keySchema.input, options === null || options === void 0 ? void 0 : options.body) : options === null || options === void 0 ? void 0 : options.body,
1585
+ params: keySchema.params ? await parseStandardSchema(keySchema.params, options === null || options === void 0 ? void 0 : options.params) : options === null || options === void 0 ? void 0 : options.params
1586
+ });
1587
+ }
1588
+ return {
1589
+ url,
1590
+ options: opts
1591
+ };
1592
+ }
1593
+ }
1594
+ return _objectSpread2({ url }, (options !== void 0 || config.query !== void 0) && { options: opts });
1595
+ }
1596
+ });
1597
+ var createFetch = (config) => {
1598
+ async function $fetch(url, options) {
1599
+ const opts = _objectSpread2(_objectSpread2(_objectSpread2({}, config), options), {}, {
1600
+ headers: mergeHeaders(config === null || config === void 0 ? void 0 : config.headers, options === null || options === void 0 ? void 0 : options.headers),
1601
+ plugins: [
1602
+ ...(config === null || config === void 0 ? void 0 : config.plugins) || [],
1603
+ applySchemaPlugin(config || {}),
1604
+ ...(options === null || options === void 0 ? void 0 : options.plugins) || []
1605
+ ]
1606
+ });
1607
+ if (config === null || config === void 0 ? void 0 : config.catchAllError) try {
1608
+ return await betterFetch(url, opts);
1609
+ } catch (error) {
1610
+ return {
1611
+ data: null,
1612
+ error: {
1613
+ status: 500,
1614
+ statusText: "Fetch Error",
1615
+ message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
1616
+ error
1617
+ }
1618
+ };
1619
+ }
1620
+ return await betterFetch(url, opts);
1621
+ }
1622
+ return $fetch;
1623
+ };
1624
+ //#endregion
1625
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/config.mjs
1626
+ var resolvePublicAuthUrl = (basePath) => {
1627
+ if (typeof process === "undefined") return void 0;
1628
+ const path = basePath ?? "/api/auth";
1629
+ if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
1630
+ if (typeof window === "undefined") {
1631
+ if (process.env.NEXTAUTH_URL) try {
1632
+ return process.env.NEXTAUTH_URL;
1633
+ } catch {}
1634
+ if (process.env.VERCEL_URL) try {
1635
+ const protocol = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
1636
+ return `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;
1637
+ } catch {}
1638
+ }
1639
+ };
1640
+ var matchesSessionSignal = (path) => path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
1641
+ var getClientConfig = (options, loadEnv) => {
1642
+ const isCredentialsSupported = "credentials" in Request.prototype;
1643
+ const baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
1644
+ const pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];
1645
+ const lifeCyclePlugin = {
1646
+ id: "lifecycle-hooks",
1647
+ name: "lifecycle-hooks",
1648
+ hooks: {
1649
+ onSuccess: options?.fetchOptions?.onSuccess,
1650
+ onError: options?.fetchOptions?.onError,
1651
+ onRequest: options?.fetchOptions?.onRequest,
1652
+ onResponse: options?.fetchOptions?.onResponse
1653
+ }
1654
+ };
1655
+ const { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};
1656
+ const $fetch = createFetch({
1657
+ baseURL,
1658
+ ...isCredentialsSupported ? { credentials: "include" } : {},
1659
+ method: "GET",
1660
+ jsonParser(text) {
1661
+ if (!text) return null;
1662
+ return parseJSON(text, { strict: false });
1663
+ },
1664
+ customFetchImpl: fetch,
1665
+ ...restOfFetchOptions,
1666
+ plugins: [
1667
+ lifeCyclePlugin,
1668
+ ...restOfFetchOptions.plugins || [],
1669
+ ...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
1670
+ ...pluginsFetchPlugins
1671
+ ]
1672
+ });
1673
+ const { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);
1674
+ let hasHydrated = false;
1675
+ const hydrateSession = (sessionData) => {
1676
+ if (hasHydrated || sessionData === null) return;
1677
+ hasHydrated = true;
1678
+ hydrateSessionAtom(session, sessionData);
1679
+ };
1680
+ const plugins = options?.plugins || [];
1681
+ let pluginsActions = {};
1682
+ const pluginsAtoms = {
1683
+ $sessionSignal,
1684
+ session
1685
+ };
1686
+ const pluginPathMethods = {
1687
+ "/sign-out": "POST",
1688
+ "/revoke-sessions": "POST",
1689
+ "/revoke-other-sessions": "POST",
1690
+ "/delete-user": "POST"
1691
+ };
1692
+ const atomListeners = [{
1693
+ signal: "$sessionSignal",
1694
+ matcher: matchesSessionSignal,
1695
+ callback(path) {
1696
+ if (path === "/sign-out") broadcastSessionUpdate("signout");
1697
+ else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
1698
+ }
1699
+ }];
1700
+ for (const plugin of plugins) {
1701
+ if (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));
1702
+ if (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);
1703
+ if (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);
1704
+ }
1705
+ const $store = {
1706
+ notify: (signal) => {
1707
+ pluginsAtoms[signal].set(!pluginsAtoms[signal].get());
1708
+ },
1709
+ listen: (signal, listener) => {
1710
+ pluginsAtoms[signal].subscribe(listener);
1711
+ },
1712
+ atoms: pluginsAtoms
1713
+ };
1714
+ for (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
1715
+ return {
1716
+ get baseURL() {
1717
+ return baseURL;
1718
+ },
1719
+ pluginsActions,
1720
+ pluginsAtoms,
1721
+ pluginPathMethods,
1722
+ atomListeners,
1723
+ hydrateSession,
1724
+ $sessionSignal,
1725
+ $fetch,
1726
+ $store
1727
+ };
1728
+ };
1729
+ //#endregion
1730
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/plugins/siwe/client.mjs
1731
+ var siweClient = () => {
1732
+ return {
1733
+ id: "siwe",
1734
+ version: PACKAGE_VERSION,
1735
+ $InferServerPlugin: {},
1736
+ pathMethods: {
1737
+ "/siwe/nonce": "POST",
1738
+ "/siwe/get-nonce": "POST"
1739
+ }
1740
+ };
1741
+ };
1742
+ //#endregion
1743
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/utils/is-atom.mjs
1744
+ function isAtom(value) {
1745
+ return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
1746
+ }
1747
+ //#endregion
1748
+ //#region node_modules/.pnpm/@better-auth+core@1.7.10_@better-auth+utils@0.5.0_@better-fetch+fetch@1.3.2_better-call_224edc5ffd7528388e80ea9fb390ec1e/node_modules/@better-auth/core/dist/utils/string.mjs
1749
+ function capitalizeFirstLetter(str) {
1750
+ return str.charAt(0).toUpperCase() + str.slice(1);
1751
+ }
1752
+ var WORD_PATTERN = /[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu;
1753
+ var APOSTROPHE_PATTERN = /['\u2019]/g;
1754
+ function splitWords(input) {
1755
+ return input.replace(APOSTROPHE_PATTERN, "").match(WORD_PATTERN) ?? [];
1756
+ }
1757
+ function toKebabCase(input) {
1758
+ return splitWords(input).map((word) => word.toLowerCase()).join("-");
1759
+ }
1760
+ //#endregion
1761
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/proxy.mjs
1762
+ function getMethod(path, knownPathMethods, args) {
1763
+ const method = knownPathMethods[path];
1764
+ const { fetchOptions, query: _query, ...body } = args || {};
1765
+ if (method) return method;
1766
+ if (fetchOptions?.method) return fetchOptions.method;
1767
+ if (body && Object.keys(body).length > 0) return "POST";
1768
+ return "GET";
1769
+ }
1770
+ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
1771
+ function createProxy(path = []) {
1772
+ return new Proxy(function() {}, {
1773
+ get(_, prop) {
1774
+ if (typeof prop !== "string") return;
1775
+ if (prop === "then" || prop === "catch" || prop === "finally") return;
1776
+ const fullPath = [...path, prop];
1777
+ let current = routes;
1778
+ for (const segment of fullPath) if (current && typeof current === "object" && segment in current) current = current[segment];
1779
+ else {
1780
+ current = void 0;
1781
+ break;
1782
+ }
1783
+ if (typeof current === "function") return current;
1784
+ if (isAtom(current)) return current;
1785
+ return createProxy(fullPath);
1786
+ },
1787
+ apply: async (_, __, args) => {
1788
+ const routePath = "/" + path.map(toKebabCase).join("/");
1789
+ const arg = args[0] || {};
1790
+ const fetchOptions = args[1] || {};
1791
+ const { query, fetchOptions: argFetchOptions, ...body } = arg;
1792
+ const options = {
1793
+ ...fetchOptions,
1794
+ ...argFetchOptions
1795
+ };
1796
+ const method = getMethod(routePath, knownPathMethods, arg);
1797
+ return await client(routePath, {
1798
+ ...options,
1799
+ body: method === "GET" ? void 0 : {
1800
+ ...body,
1801
+ ...options?.body || {}
1802
+ },
1803
+ query: query || options?.query,
1804
+ method,
1805
+ async onSuccess(context) {
1806
+ await options?.onSuccess?.(context);
1807
+ if (!atomListeners || options.disableSignal) return;
1808
+ /**
1809
+ * We trigger listeners
1810
+ */
1811
+ const matches = atomListeners.filter((s) => s.matcher(routePath));
1812
+ if (!matches.length) return;
1813
+ const visited = /* @__PURE__ */ new Set();
1814
+ for (const match of matches) {
1815
+ const signal = atoms[match.signal];
1816
+ if (!signal) return;
1817
+ if (visited.has(match.signal)) continue;
1818
+ visited.add(match.signal);
1819
+ /**
1820
+ * To avoid race conditions we set the signal in a setTimeout
1821
+ */
1822
+ const val = signal.get();
1823
+ setTimeout(() => {
1824
+ signal.set(!val);
1825
+ }, 10);
1826
+ match.callback?.(routePath);
1827
+ }
1828
+ }
1829
+ });
1830
+ }
1831
+ });
1832
+ }
1833
+ return createProxy();
1834
+ }
1835
+ //#endregion
1836
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/react/react-store.mjs
1837
+ /**
1838
+ * Subscribe to store changes and get store's value.
1839
+ *
1840
+ * Can be used with store builder too.
1841
+ *
1842
+ * ```js
1843
+ * import { useStore } from 'nanostores/react'
1844
+ *
1845
+ * import { router } from '../store/router'
1846
+ *
1847
+ * export const Layout = () => {
1848
+ * let page = useStore(router)
1849
+ * if (page.route === 'home') {
1850
+ * return <HomePage />
1851
+ * } else {
1852
+ * return <Error404 />
1853
+ * }
1854
+ * }
1855
+ * ```
1856
+ *
1857
+ * @param store Store instance.
1858
+ * @returns Store value.
1859
+ */
1860
+ function useStore(store, options = {}) {
1861
+ const snapshotRef = useRef(store.get());
1862
+ const { keys, deps = [store, keys] } = options;
1863
+ const subscribe = useCallback((onChange) => {
1864
+ const emitChange = (value) => {
1865
+ if (snapshotRef.current === value) return;
1866
+ snapshotRef.current = value;
1867
+ onChange();
1868
+ };
1869
+ emitChange(store.value);
1870
+ if (keys?.length) return listenKeys(store, keys, emitChange);
1871
+ return store.listen(emitChange);
1872
+ }, deps);
1873
+ const get = () => snapshotRef.current;
1874
+ return useSyncExternalStore(subscribe, get, isAuthQueryStore(store) ? () => store.init : get);
1875
+ }
1876
+ //#endregion
1877
+ //#region node_modules/.pnpm/better-auth@1.7.10_@tanstack+react-start@1.169.2_esbuild@0.28.2_react-dom@19.3.1_react@_221d1c007cf5d81fa22655b7538eb644/node_modules/better-auth/dist/client/react/index.mjs
1878
+ function getAtomKey(str) {
1879
+ return `use${capitalizeFirstLetter(str)}`;
1880
+ }
1881
+ function createAuthClient(options) {
1882
+ const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, $store, atomListeners } = getClientConfig(options);
1883
+ const resolvedHooks = {};
1884
+ for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
1885
+ return createDynamicPathProxy({
1886
+ ...pluginsActions,
1887
+ ...resolvedHooks,
1888
+ hydrateSession,
1889
+ $fetch,
1890
+ $store
1891
+ }, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
1892
+ }
1893
+ //#endregion
1894
+ //#region src/web/auth-client.ts
1895
+ var authClient = createAuthClient({ plugins: [siweClient()] });
1896
+ //#endregion
1897
+ export { authClient as t };