@access-dlsu/leapify 0.260505.5 → 0.260506.1

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 (195) hide show
  1. package/dist/app.d.ts +15 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/auth/auth.d.ts +99 -0
  4. package/dist/auth/auth.d.ts.map +1 -0
  5. package/dist/auth/middleware.d.ts +20 -0
  6. package/dist/auth/middleware.d.ts.map +1 -0
  7. package/dist/auth/types.d.ts +17 -0
  8. package/dist/auth/types.d.ts.map +1 -0
  9. package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js +160 -0
  10. package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js.map +1 -0
  11. package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs +162 -0
  12. package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs.map +1 -0
  13. package/dist/chunk-4DPT2KQR.cjs +467 -0
  14. package/dist/chunk-4DPT2KQR.cjs.map +1 -0
  15. package/dist/chunk-57ANXUP7.cjs +6191 -0
  16. package/dist/chunk-57ANXUP7.cjs.map +1 -0
  17. package/dist/chunk-5JKLV7IE.cjs +2962 -0
  18. package/dist/chunk-5JKLV7IE.cjs.map +1 -0
  19. package/dist/{chunk-FLR7TNLN.js → chunk-63CUZGSZ.js} +4 -12
  20. package/dist/chunk-63CUZGSZ.js.map +1 -0
  21. package/dist/chunk-ANNHE3PZ.js +2285 -0
  22. package/dist/chunk-ANNHE3PZ.js.map +1 -0
  23. package/dist/chunk-DPPGYCX3.cjs +72 -0
  24. package/dist/chunk-DPPGYCX3.cjs.map +1 -0
  25. package/dist/chunk-EGRHWZRV.js +3 -0
  26. package/dist/chunk-EGRHWZRV.js.map +1 -0
  27. package/dist/chunk-EIF2O2BG.js +6187 -0
  28. package/dist/chunk-EIF2O2BG.js.map +1 -0
  29. package/dist/chunk-EMMSS5I5.cjs +37 -0
  30. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  31. package/dist/chunk-FTSMZYD7.js +3025 -0
  32. package/dist/chunk-FTSMZYD7.js.map +1 -0
  33. package/dist/chunk-G3PMV62Z.js +33 -0
  34. package/dist/chunk-G3PMV62Z.js.map +1 -0
  35. package/dist/chunk-GNRL67OU.js +2949 -0
  36. package/dist/chunk-GNRL67OU.js.map +1 -0
  37. package/dist/chunk-HHNEB7YR.js +8 -0
  38. package/dist/chunk-HHNEB7YR.js.map +1 -0
  39. package/dist/chunk-IQEWVHLM.js +889 -0
  40. package/dist/chunk-IQEWVHLM.js.map +1 -0
  41. package/dist/chunk-JPVIXCF5.cjs +10 -0
  42. package/dist/chunk-JPVIXCF5.cjs.map +1 -0
  43. package/dist/chunk-MNEW2V4T.js +447 -0
  44. package/dist/chunk-MNEW2V4T.js.map +1 -0
  45. package/dist/chunk-NKIQRCOM.cjs +4 -0
  46. package/dist/chunk-NKIQRCOM.cjs.map +1 -0
  47. package/dist/chunk-QARF2YFF.cjs +2296 -0
  48. package/dist/chunk-QARF2YFF.cjs.map +1 -0
  49. package/dist/chunk-RFP2X2FA.cjs +903 -0
  50. package/dist/chunk-RFP2X2FA.cjs.map +1 -0
  51. package/dist/chunk-SXBTHGIL.js +7138 -0
  52. package/dist/chunk-SXBTHGIL.js.map +1 -0
  53. package/dist/chunk-UWXYXU7J.cjs +7166 -0
  54. package/dist/chunk-UWXYXU7J.cjs.map +1 -0
  55. package/dist/chunk-XY4KBWXT.cjs +3066 -0
  56. package/dist/chunk-XY4KBWXT.cjs.map +1 -0
  57. package/dist/{chunk-3ZWIJNZG.cjs → chunk-YFJBE3AU.cjs} +4 -12
  58. package/dist/chunk-YFJBE3AU.cjs.map +1 -0
  59. package/dist/chunk-ZYHBHSSO.js +68 -0
  60. package/dist/chunk-ZYHBHSSO.js.map +1 -0
  61. package/dist/client/{index.d.cts → auth.d.ts} +140 -394
  62. package/dist/client/auth.d.ts.map +1 -0
  63. package/dist/client/index.cjs +840 -48
  64. package/dist/client/index.cjs.map +1 -1
  65. package/dist/client/index.d.ts +34 -1134
  66. package/dist/client/index.d.ts.map +1 -0
  67. package/dist/client/index.js +839 -47
  68. package/dist/client/index.js.map +1 -1
  69. package/dist/client/pow.d.ts +28 -0
  70. package/dist/client/pow.d.ts.map +1 -0
  71. package/dist/client/session.d.ts +29 -0
  72. package/dist/client/session.d.ts.map +1 -0
  73. package/dist/client/types.d.ts +25 -23
  74. package/dist/client/types.d.ts.map +1 -0
  75. package/dist/cron/batch-release.d.ts +9 -0
  76. package/dist/cron/batch-release.d.ts.map +1 -0
  77. package/dist/cron/lifecycle-check.d.ts +10 -0
  78. package/dist/cron/lifecycle-check.d.ts.map +1 -0
  79. package/dist/cron/reconcile-slots.d.ts +10 -0
  80. package/dist/cron/reconcile-slots.d.ts.map +1 -0
  81. package/dist/cron/reminder-emails.d.ts +9 -0
  82. package/dist/cron/reminder-emails.d.ts.map +1 -0
  83. package/dist/cron/renew-watches.d.ts +9 -0
  84. package/dist/cron/renew-watches.d.ts.map +1 -0
  85. package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js +122 -0
  86. package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js.map +1 -0
  87. package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs +124 -0
  88. package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs.map +1 -0
  89. package/dist/db/index.d.ts +7 -0
  90. package/dist/db/index.d.ts.map +1 -0
  91. package/dist/db/migrate.d.ts +23 -0
  92. package/dist/db/migrate.d.ts.map +1 -0
  93. package/dist/db/schema/auth.d.ts +649 -0
  94. package/dist/db/schema/auth.d.ts.map +1 -0
  95. package/dist/db/schema/bookmarks.d.ts +88 -0
  96. package/dist/db/schema/bookmarks.d.ts.map +1 -0
  97. package/dist/db/schema/events.d.ts +539 -0
  98. package/dist/db/schema/events.d.ts.map +1 -0
  99. package/dist/db/schema/faqs.d.ts +154 -0
  100. package/dist/db/schema/faqs.d.ts.map +1 -0
  101. package/dist/db/schema/index.d.ts +8 -0
  102. package/dist/db/schema/index.d.ts.map +1 -0
  103. package/dist/db/schema/site-config.d.ts +64 -0
  104. package/dist/db/schema/site-config.d.ts.map +1 -0
  105. package/dist/db/schema/themes.d.ts +123 -0
  106. package/dist/db/schema/themes.d.ts.map +1 -0
  107. package/dist/{types-lTjxCp88.d.cts → db/schema/users.d.ts} +11 -96
  108. package/dist/db/schema/users.d.ts.map +1 -0
  109. package/dist/dist-DZHA5VYX.cjs +260 -0
  110. package/dist/dist-DZHA5VYX.cjs.map +1 -0
  111. package/dist/dist-RRQUBLLO.js +258 -0
  112. package/dist/dist-RRQUBLLO.js.map +1 -0
  113. package/dist/index.cjs +36987 -781
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.ts +23 -1818
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +36846 -642
  118. package/dist/index.js.map +1 -1
  119. package/dist/kysely-adapter-5ZCECLNV.cjs +27 -0
  120. package/dist/kysely-adapter-5ZCECLNV.cjs.map +1 -0
  121. package/dist/kysely-adapter-6CZEASJQ.js +10 -0
  122. package/dist/kysely-adapter-6CZEASJQ.js.map +1 -0
  123. package/dist/lib/errors.d.ts +15 -0
  124. package/dist/lib/errors.d.ts.map +1 -0
  125. package/dist/lib/middleware/cors.d.ts +3 -0
  126. package/dist/lib/middleware/cors.d.ts.map +1 -0
  127. package/dist/lib/middleware/error-handler.d.ts +3 -0
  128. package/dist/lib/middleware/error-handler.d.ts.map +1 -0
  129. package/dist/lib/middleware/pow-challenge.cjs +7 -7
  130. package/dist/lib/middleware/pow-challenge.d.ts +29 -18
  131. package/dist/lib/middleware/pow-challenge.d.ts.map +1 -0
  132. package/dist/lib/middleware/pow-challenge.js +2 -2
  133. package/dist/lib/middleware/rate-limit.d.ts +48 -0
  134. package/dist/lib/middleware/rate-limit.d.ts.map +1 -0
  135. package/dist/lib/middleware/referer-guard.d.ts +18 -0
  136. package/dist/lib/middleware/referer-guard.d.ts.map +1 -0
  137. package/dist/lib/retry.d.ts +12 -0
  138. package/dist/lib/retry.d.ts.map +1 -0
  139. package/dist/node-sqlite-dialect-HEMUZ4B2.js +160 -0
  140. package/dist/node-sqlite-dialect-HEMUZ4B2.js.map +1 -0
  141. package/dist/node-sqlite-dialect-QUBEEKKU.cjs +162 -0
  142. package/dist/node-sqlite-dialect-QUBEEKKU.cjs.map +1 -0
  143. package/dist/queues/handlers.d.ts +13 -0
  144. package/dist/queues/handlers.d.ts.map +1 -0
  145. package/dist/queues/jobs.d.ts +42 -0
  146. package/dist/queues/jobs.d.ts.map +1 -0
  147. package/dist/routes/events.d.ts +4 -0
  148. package/dist/routes/events.d.ts.map +1 -0
  149. package/dist/routes/faqs.d.ts +4 -0
  150. package/dist/routes/faqs.d.ts.map +1 -0
  151. package/dist/routes/health.d.ts +4 -0
  152. package/dist/routes/health.d.ts.map +1 -0
  153. package/dist/routes/internal/gforms-webhook.d.ts +4 -0
  154. package/dist/routes/internal/gforms-webhook.d.ts.map +1 -0
  155. package/dist/routes/site-config.d.ts +4 -0
  156. package/dist/routes/site-config.d.ts.map +1 -0
  157. package/dist/routes/themes.d.ts +4 -0
  158. package/dist/routes/themes.d.ts.map +1 -0
  159. package/dist/routes/uploads.d.ts +4 -0
  160. package/dist/routes/uploads.d.ts.map +1 -0
  161. package/dist/routes/users.d.ts +4 -0
  162. package/dist/routes/users.d.ts.map +1 -0
  163. package/dist/services/cache.d.ts +22 -0
  164. package/dist/services/cache.d.ts.map +1 -0
  165. package/dist/services/contentful-management.d.ts +53 -0
  166. package/dist/services/contentful-management.d.ts.map +1 -0
  167. package/dist/services/contentful.d.ts +97 -0
  168. package/dist/services/contentful.d.ts.map +1 -0
  169. package/dist/services/email.d.ts +75 -0
  170. package/dist/services/email.d.ts.map +1 -0
  171. package/dist/services/gforms.d.ts +60 -0
  172. package/dist/services/gforms.d.ts.map +1 -0
  173. package/dist/services/resend.d.ts +34 -0
  174. package/dist/services/resend.d.ts.map +1 -0
  175. package/dist/services/ses.d.ts +58 -0
  176. package/dist/services/ses.d.ts.map +1 -0
  177. package/dist/services/slots.d.ts +48 -0
  178. package/dist/services/slots.d.ts.map +1 -0
  179. package/dist/services/snapshot.d.ts +90 -0
  180. package/dist/services/snapshot.d.ts.map +1 -0
  181. package/dist/types.d.ts +66 -0
  182. package/dist/types.d.ts.map +1 -0
  183. package/dist/worker-handler.d.ts +64 -0
  184. package/dist/worker-handler.d.ts.map +1 -0
  185. package/dist/worker.d.ts +36 -0
  186. package/dist/worker.d.ts.map +1 -0
  187. package/dist/worker.js +2195 -2553
  188. package/dist/worker.js.map +1 -1
  189. package/package.json +152 -152
  190. package/dist/chunk-3ZWIJNZG.cjs.map +0 -1
  191. package/dist/chunk-FLR7TNLN.js.map +0 -1
  192. package/dist/client/types.d.cts +0 -192
  193. package/dist/index.d.cts +0 -1879
  194. package/dist/lib/middleware/pow-challenge.d.cts +0 -47
  195. package/dist/types-lTjxCp88.d.ts +0 -208
@@ -1,11 +1,803 @@
1
1
  'use strict';
2
2
 
3
- require('../chunk-Q7SFCCGT.cjs');
4
- var client = require('better-auth/client');
3
+ var chunkRFP2X2FA_cjs = require('../chunk-RFP2X2FA.cjs');
4
+ var chunkJPVIXCF5_cjs = require('../chunk-JPVIXCF5.cjs');
5
+ require('../chunk-NKIQRCOM.cjs');
6
+ require('../chunk-4DPT2KQR.cjs');
7
+ require('../chunk-EMMSS5I5.cjs');
5
8
 
9
+ // node_modules/better-auth/dist/client/broadcast-channel.mjs
10
+ var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
11
+ var now = () => Math.floor(Date.now() / 1e3);
12
+ var WindowBroadcastChannel = class {
13
+ listeners = /* @__PURE__ */ new Set();
14
+ name;
15
+ constructor(name = "better-auth.message") {
16
+ this.name = name;
17
+ }
18
+ subscribe(listener) {
19
+ this.listeners.add(listener);
20
+ return () => {
21
+ this.listeners.delete(listener);
22
+ };
23
+ }
24
+ post(message) {
25
+ if (typeof window === "undefined") return;
26
+ try {
27
+ localStorage.setItem(this.name, JSON.stringify({
28
+ ...message,
29
+ timestamp: now()
30
+ }));
31
+ } catch {
32
+ }
33
+ }
34
+ setup() {
35
+ if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {
36
+ };
37
+ const handler = (event) => {
38
+ if (event.key !== this.name) return;
39
+ const message = JSON.parse(event.newValue ?? "{}");
40
+ if (message?.event !== "session" || !message?.data) return;
41
+ this.listeners.forEach((listener) => listener(message));
42
+ };
43
+ window.addEventListener("storage", handler);
44
+ return () => {
45
+ window.removeEventListener("storage", handler);
46
+ };
47
+ }
48
+ };
49
+ function getGlobalBroadcastChannel(name = "better-auth.message") {
50
+ if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
51
+ return globalThis[kBroadcastChannel];
52
+ }
53
+
54
+ // node_modules/better-auth/dist/client/focus-manager.mjs
55
+ var kFocusManager = Symbol.for("better-auth:focus-manager");
56
+ var WindowFocusManager = class {
57
+ listeners = /* @__PURE__ */ new Set();
58
+ subscribe(listener) {
59
+ this.listeners.add(listener);
60
+ return () => {
61
+ this.listeners.delete(listener);
62
+ };
63
+ }
64
+ setFocused(focused) {
65
+ this.listeners.forEach((listener) => listener(focused));
66
+ }
67
+ setup() {
68
+ if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {
69
+ };
70
+ const visibilityHandler = () => {
71
+ if (document.visibilityState === "visible") this.setFocused(true);
72
+ };
73
+ document.addEventListener("visibilitychange", visibilityHandler, false);
74
+ return () => {
75
+ document.removeEventListener("visibilitychange", visibilityHandler, false);
76
+ };
77
+ }
78
+ };
79
+ function getGlobalFocusManager() {
80
+ if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
81
+ return globalThis[kFocusManager];
82
+ }
83
+
84
+ // node_modules/better-auth/dist/client/online-manager.mjs
85
+ var kOnlineManager = Symbol.for("better-auth:online-manager");
86
+ var WindowOnlineManager = class {
87
+ listeners = /* @__PURE__ */ new Set();
88
+ isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
89
+ subscribe(listener) {
90
+ this.listeners.add(listener);
91
+ return () => {
92
+ this.listeners.delete(listener);
93
+ };
94
+ }
95
+ setOnline(online) {
96
+ this.isOnline = online;
97
+ this.listeners.forEach((listener) => listener(online));
98
+ }
99
+ setup() {
100
+ if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {
101
+ };
102
+ const onOnline = () => this.setOnline(true);
103
+ const onOffline = () => this.setOnline(false);
104
+ window.addEventListener("online", onOnline, false);
105
+ window.addEventListener("offline", onOffline, false);
106
+ return () => {
107
+ window.removeEventListener("online", onOnline, false);
108
+ window.removeEventListener("offline", onOffline, false);
109
+ };
110
+ }
111
+ };
112
+ function getGlobalOnlineManager() {
113
+ if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
114
+ return globalThis[kOnlineManager];
115
+ }
116
+
117
+ // node_modules/better-auth/dist/client/parser.mjs
118
+ var PROTO_POLLUTION_PATTERNS = {
119
+ 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*:/,
120
+ 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*:/,
121
+ protoShort: /"__proto__"\s*:/,
122
+ constructorShort: /"constructor"\s*:/
123
+ };
124
+ var JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
125
+ var SPECIAL_VALUES = {
126
+ true: true,
127
+ false: false,
128
+ null: null,
129
+ undefined: void 0,
130
+ nan: NaN,
131
+ infinity: Number.POSITIVE_INFINITY,
132
+ "-infinity": Number.NEGATIVE_INFINITY
133
+ };
134
+ 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}))$/;
135
+ function isValidDate(date) {
136
+ return date instanceof Date && !isNaN(date.getTime());
137
+ }
138
+ function parseISODate(value) {
139
+ const match = ISO_DATE_REGEX.exec(value);
140
+ if (!match) return null;
141
+ const [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;
142
+ 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));
143
+ if (offsetSign) {
144
+ const offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === "+" ? -1 : 1);
145
+ date.setUTCMinutes(date.getUTCMinutes() + offset);
146
+ }
147
+ return isValidDate(date) ? date : null;
148
+ }
149
+ function betterJSONParse(value, options = {}) {
150
+ const { strict = false, warnings = false, reviver, parseDates = true } = options;
151
+ if (typeof value !== "string") return value;
152
+ const trimmed = value.trim();
153
+ if (trimmed.length > 0 && trimmed[0] === '"' && trimmed.endsWith('"') && !trimmed.slice(1, -1).includes('"')) return trimmed.slice(1, -1);
154
+ const lowerValue = trimmed.toLowerCase();
155
+ if (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];
156
+ if (!JSON_SIGNATURE.test(trimmed)) {
157
+ if (strict) throw new SyntaxError("[better-json] Invalid JSON");
158
+ return value;
159
+ }
160
+ if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
161
+ const matches = pattern.test(trimmed);
162
+ if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
163
+ return matches;
164
+ }) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
165
+ try {
166
+ const secureReviver = (key, value2) => {
167
+ if (key === "__proto__" || key === "constructor" && value2 && typeof value2 === "object" && "prototype" in value2) {
168
+ if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
169
+ return;
170
+ }
171
+ if (parseDates && typeof value2 === "string") {
172
+ const date = parseISODate(value2);
173
+ if (date) return date;
174
+ }
175
+ return reviver ? reviver(key, value2) : value2;
176
+ };
177
+ return JSON.parse(trimmed, secureReviver);
178
+ } catch (error) {
179
+ if (strict) throw error;
180
+ return value;
181
+ }
182
+ }
183
+ function parseJSON(value, options = { strict: true }) {
184
+ return betterJSONParse(value, options);
185
+ }
186
+
187
+ // node_modules/nanostores/clean-stores/index.js
188
+ var clean = Symbol("clean");
189
+
190
+ // node_modules/nanostores/atom/index.js
191
+ var listenerQueue = [];
192
+ var lqIndex = 0;
193
+ var QUEUE_ITEMS_PER_LISTENER = 4;
194
+ var nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
195
+ var atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
196
+ let listeners = [];
197
+ let $atom = {
198
+ get() {
199
+ if (!$atom.lc) {
200
+ $atom.listen(() => {
201
+ })();
202
+ }
203
+ return $atom.value;
204
+ },
205
+ init: initialValue,
206
+ lc: 0,
207
+ listen(listener) {
208
+ $atom.lc = listeners.push(listener);
209
+ return () => {
210
+ for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length; ) {
211
+ if (listenerQueue[i] === listener) {
212
+ listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
213
+ } else {
214
+ i += QUEUE_ITEMS_PER_LISTENER;
215
+ }
216
+ }
217
+ let index = listeners.indexOf(listener);
218
+ if (~index) {
219
+ listeners.splice(index, 1);
220
+ if (!--$atom.lc) $atom.off();
221
+ }
222
+ };
223
+ },
224
+ notify(oldValue, changedKey) {
225
+ nanostoresGlobal.epoch++;
226
+ let runListenerQueue = !listenerQueue.length;
227
+ for (let listener of listeners) {
228
+ listenerQueue.push(listener, $atom.value, oldValue, changedKey);
229
+ }
230
+ if (runListenerQueue) {
231
+ for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) {
232
+ listenerQueue[lqIndex](
233
+ listenerQueue[lqIndex + 1],
234
+ listenerQueue[lqIndex + 2],
235
+ listenerQueue[lqIndex + 3]
236
+ );
237
+ }
238
+ listenerQueue.length = 0;
239
+ }
240
+ },
241
+ /* It will be called on last listener unsubscribing.
242
+ We will redefine it in onMount and onStop. */
243
+ off() {
244
+ },
245
+ set(newValue) {
246
+ let oldValue = $atom.value;
247
+ if (oldValue !== newValue) {
248
+ $atom.value = newValue;
249
+ $atom.notify(oldValue);
250
+ }
251
+ },
252
+ subscribe(listener) {
253
+ let unbind = $atom.listen(listener);
254
+ listener($atom.value);
255
+ return unbind;
256
+ },
257
+ value: initialValue
258
+ };
259
+ {
260
+ $atom[clean] = () => {
261
+ listeners = [];
262
+ $atom.lc = 0;
263
+ $atom.off();
264
+ };
265
+ }
266
+ return $atom;
267
+ };
268
+
269
+ // node_modules/nanostores/lifecycle/index.js
270
+ var MOUNT = 5;
271
+ var UNMOUNT = 6;
272
+ var REVERT_MUTATION = 10;
273
+ var on = (object, listener, eventKey, mutateStore) => {
274
+ object.events = object.events || {};
275
+ if (!object.events[eventKey + REVERT_MUTATION]) {
276
+ object.events[eventKey + REVERT_MUTATION] = mutateStore((eventProps) => {
277
+ object.events[eventKey].reduceRight((event, l) => (l(event), event), {
278
+ shared: {},
279
+ ...eventProps
280
+ });
281
+ });
282
+ }
283
+ object.events[eventKey] = object.events[eventKey] || [];
284
+ object.events[eventKey].push(listener);
285
+ return () => {
286
+ let currentListeners = object.events[eventKey];
287
+ let index = currentListeners.indexOf(listener);
288
+ currentListeners.splice(index, 1);
289
+ if (!currentListeners.length) {
290
+ delete object.events[eventKey];
291
+ object.events[eventKey + REVERT_MUTATION]();
292
+ delete object.events[eventKey + REVERT_MUTATION];
293
+ }
294
+ };
295
+ };
296
+ var STORE_UNMOUNT_DELAY = 1e3;
297
+ var onMount = ($store, initialize) => {
298
+ let listener = (payload) => {
299
+ let destroy = initialize(payload);
300
+ if (destroy) $store.events[UNMOUNT].push(destroy);
301
+ };
302
+ return on($store, listener, MOUNT, (runListeners) => {
303
+ let originListen = $store.listen;
304
+ $store.listen = (...args) => {
305
+ if (!$store.lc && !$store.active) {
306
+ $store.active = true;
307
+ runListeners();
308
+ }
309
+ return originListen(...args);
310
+ };
311
+ let originOff = $store.off;
312
+ $store.events[UNMOUNT] = [];
313
+ $store.off = () => {
314
+ originOff();
315
+ setTimeout(() => {
316
+ if ($store.active && !$store.lc) {
317
+ $store.active = false;
318
+ for (let destroy of $store.events[UNMOUNT]) destroy();
319
+ $store.events[UNMOUNT] = [];
320
+ }
321
+ }, STORE_UNMOUNT_DELAY);
322
+ };
323
+ {
324
+ let originClean = $store[clean];
325
+ $store[clean] = () => {
326
+ for (let destroy of $store.events[UNMOUNT]) destroy();
327
+ $store.events[UNMOUNT] = [];
328
+ $store.active = false;
329
+ originClean();
330
+ };
331
+ }
332
+ return () => {
333
+ $store.listen = originListen;
334
+ $store.off = originOff;
335
+ };
336
+ });
337
+ };
338
+
339
+ // node_modules/better-auth/dist/client/query.mjs
340
+ var isServer = () => typeof window === "undefined";
341
+ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
342
+ const value = atom({
343
+ data: null,
344
+ error: null,
345
+ isPending: true,
346
+ isRefetching: false,
347
+ refetch: (queryParams) => fn(queryParams)
348
+ });
349
+ const fn = async (queryParams) => {
350
+ return new Promise((resolve) => {
351
+ const opts = typeof options === "function" ? options({
352
+ data: value.get().data,
353
+ error: value.get().error,
354
+ isPending: value.get().isPending
355
+ }) : options;
356
+ $fetch(path, {
357
+ ...opts,
358
+ query: {
359
+ ...opts?.query,
360
+ ...queryParams?.query
361
+ },
362
+ async onSuccess(context) {
363
+ value.set({
364
+ data: context.data,
365
+ error: null,
366
+ isPending: false,
367
+ isRefetching: false,
368
+ refetch: value.value.refetch
369
+ });
370
+ await opts?.onSuccess?.(context);
371
+ },
372
+ async onError(context) {
373
+ const { request } = context;
374
+ const retryAttempts = typeof request.retry === "number" ? request.retry : request.retry?.attempts;
375
+ const retryAttempt = request.retryAttempt || 0;
376
+ if (retryAttempts && retryAttempt < retryAttempts) return;
377
+ const isUnauthorized = context.error.status === 401;
378
+ value.set({
379
+ error: context.error,
380
+ data: isUnauthorized ? null : value.get().data,
381
+ isPending: false,
382
+ isRefetching: false,
383
+ refetch: value.value.refetch
384
+ });
385
+ await opts?.onError?.(context);
386
+ },
387
+ async onRequest(context) {
388
+ const currentValue = value.get();
389
+ value.set({
390
+ isPending: currentValue.data === null,
391
+ data: currentValue.data,
392
+ error: null,
393
+ isRefetching: true,
394
+ refetch: value.value.refetch
395
+ });
396
+ await opts?.onRequest?.(context);
397
+ }
398
+ }).catch((error) => {
399
+ value.set({
400
+ error,
401
+ data: value.get().data,
402
+ isPending: false,
403
+ isRefetching: false,
404
+ refetch: value.value.refetch
405
+ });
406
+ }).finally(() => {
407
+ resolve(void 0);
408
+ });
409
+ });
410
+ };
411
+ initializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];
412
+ let isInitialized = false;
413
+ for (const initAtom of initializedAtom) initAtom.subscribe(async () => {
414
+ if (isServer()) return;
415
+ if (isInitialized) await fn();
416
+ else onMount(value, () => {
417
+ const timeoutId = setTimeout(async () => {
418
+ if (!isInitialized) {
419
+ isInitialized = true;
420
+ await fn();
421
+ }
422
+ }, 0);
423
+ return () => {
424
+ value.off();
425
+ initAtom.off();
426
+ clearTimeout(timeoutId);
427
+ };
428
+ });
429
+ });
430
+ return value;
431
+ };
432
+
433
+ // node_modules/better-auth/dist/client/session-refresh.mjs
434
+ var now2 = () => Math.floor(Date.now() / 1e3);
435
+ function normalizeSessionResponse(res) {
436
+ if (typeof res === "object" && res !== null && "data" in res && "error" in res) return res;
437
+ return {
438
+ data: res,
439
+ error: null
440
+ };
441
+ }
442
+ var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
443
+ function createSessionRefreshManager(opts) {
444
+ const { sessionAtom, sessionSignal, $fetch, options = {} } = opts;
445
+ const refetchInterval = options.sessionOptions?.refetchInterval ?? 0;
446
+ const refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;
447
+ const refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;
448
+ const state = {
449
+ lastSync: 0,
450
+ lastSessionRequest: 0,
451
+ cachedSession: void 0
452
+ };
453
+ const shouldRefetch = () => {
454
+ return refetchWhenOffline || getGlobalOnlineManager().isOnline;
455
+ };
456
+ const triggerRefetch = (event) => {
457
+ if (!shouldRefetch()) return;
458
+ if (event?.event === "storage") {
459
+ state.lastSync = now2();
460
+ sessionSignal.set(!sessionSignal.get());
461
+ return;
462
+ }
463
+ const currentSession = sessionAtom.get();
464
+ const fetchSessionWithRefresh = () => {
465
+ state.lastSessionRequest = now2();
466
+ $fetch("/get-session").then(async (res) => {
467
+ let { data, error } = normalizeSessionResponse(res);
468
+ if (data?.needsRefresh) try {
469
+ const refreshRes = await $fetch("/get-session", { method: "POST" });
470
+ ({ data, error } = normalizeSessionResponse(refreshRes));
471
+ } catch {
472
+ }
473
+ const sessionData = data?.session && data?.user ? data : null;
474
+ sessionAtom.set({
475
+ ...currentSession,
476
+ data: sessionData,
477
+ error
478
+ });
479
+ state.lastSync = now2();
480
+ sessionSignal.set(!sessionSignal.get());
481
+ }).catch(() => {
482
+ });
483
+ };
484
+ if (event?.event === "poll") {
485
+ fetchSessionWithRefresh();
486
+ return;
487
+ }
488
+ if (event?.event === "visibilitychange") {
489
+ if (now2() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;
490
+ state.lastSessionRequest = now2();
491
+ }
492
+ if (event?.event === "visibilitychange") {
493
+ fetchSessionWithRefresh();
494
+ return;
495
+ }
496
+ if (currentSession?.data === null || currentSession?.data === void 0) {
497
+ state.lastSync = now2();
498
+ sessionSignal.set(!sessionSignal.get());
499
+ }
500
+ };
501
+ const broadcastSessionUpdate = (trigger) => {
502
+ getGlobalBroadcastChannel().post({
503
+ event: "session",
504
+ data: { trigger },
505
+ clientId: Math.random().toString(36).substring(7)
506
+ });
507
+ };
508
+ const setupPolling = () => {
509
+ if (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {
510
+ if (sessionAtom.get()?.data) triggerRefetch({ event: "poll" });
511
+ }, refetchInterval * 1e3);
512
+ };
513
+ const setupBroadcast = () => {
514
+ state.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {
515
+ triggerRefetch({ event: "storage" });
516
+ });
517
+ };
518
+ const setupFocusRefetch = () => {
519
+ if (!refetchOnWindowFocus) return;
520
+ state.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {
521
+ triggerRefetch({ event: "visibilitychange" });
522
+ });
523
+ };
524
+ const setupOnlineRefetch = () => {
525
+ state.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {
526
+ if (online) triggerRefetch({ event: "visibilitychange" });
527
+ });
528
+ };
529
+ const init = () => {
530
+ setupPolling();
531
+ setupBroadcast();
532
+ setupFocusRefetch();
533
+ setupOnlineRefetch();
534
+ getGlobalBroadcastChannel().setup();
535
+ getGlobalFocusManager().setup();
536
+ getGlobalOnlineManager().setup();
537
+ };
538
+ const cleanup = () => {
539
+ if (state.pollInterval) {
540
+ clearInterval(state.pollInterval);
541
+ state.pollInterval = void 0;
542
+ }
543
+ if (state.unsubscribeBroadcast) {
544
+ state.unsubscribeBroadcast();
545
+ state.unsubscribeBroadcast = void 0;
546
+ }
547
+ if (state.unsubscribeFocus) {
548
+ state.unsubscribeFocus();
549
+ state.unsubscribeFocus = void 0;
550
+ }
551
+ if (state.unsubscribeOnline) {
552
+ state.unsubscribeOnline();
553
+ state.unsubscribeOnline = void 0;
554
+ }
555
+ state.lastSync = 0;
556
+ state.lastSessionRequest = 0;
557
+ state.cachedSession = void 0;
558
+ };
559
+ return {
560
+ init,
561
+ cleanup,
562
+ triggerRefetch,
563
+ broadcastSessionUpdate
564
+ };
565
+ }
566
+
567
+ // node_modules/better-auth/dist/client/fetch-plugins.mjs
568
+ var redirectPlugin = {
569
+ id: "redirect",
570
+ name: "Redirect",
571
+ hooks: { onSuccess(context) {
572
+ if (context.data?.url && context.data?.redirect) {
573
+ if (typeof window !== "undefined" && window.location) {
574
+ if (window.location) try {
575
+ window.location.href = context.data.url;
576
+ } catch {
577
+ }
578
+ }
579
+ }
580
+ } }
581
+ };
582
+
583
+ // node_modules/better-auth/dist/client/session-atom.mjs
584
+ function getSessionAtom($fetch, options) {
585
+ const $signal = atom(false);
586
+ const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
587
+ let broadcastSessionUpdate = () => {
588
+ };
589
+ onMount(session, () => {
590
+ const refreshManager = createSessionRefreshManager({
591
+ sessionAtom: session,
592
+ sessionSignal: $signal,
593
+ $fetch,
594
+ options
595
+ });
596
+ refreshManager.init();
597
+ broadcastSessionUpdate = refreshManager.broadcastSessionUpdate;
598
+ return () => {
599
+ refreshManager.cleanup();
600
+ };
601
+ });
602
+ return {
603
+ session,
604
+ $sessionSignal: $signal,
605
+ broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
606
+ };
607
+ }
608
+
609
+ // node_modules/better-auth/dist/client/config.mjs
610
+ var resolvePublicAuthUrl = (basePath) => {
611
+ if (typeof process === "undefined") return void 0;
612
+ const path = basePath ?? "/api/auth";
613
+ if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
614
+ if (typeof window === "undefined") {
615
+ if (process.env.NEXTAUTH_URL) try {
616
+ return process.env.NEXTAUTH_URL;
617
+ } catch {
618
+ }
619
+ if (process.env.VERCEL_URL) try {
620
+ const protocol = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
621
+ return `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;
622
+ } catch {
623
+ }
624
+ }
625
+ };
626
+ var getClientConfig = (options, loadEnv) => {
627
+ const isCredentialsSupported = "credentials" in Request.prototype;
628
+ const baseURL = chunkRFP2X2FA_cjs.getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
629
+ const pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];
630
+ const lifeCyclePlugin = {
631
+ id: "lifecycle-hooks",
632
+ name: "lifecycle-hooks",
633
+ hooks: {
634
+ onSuccess: options?.fetchOptions?.onSuccess,
635
+ onError: options?.fetchOptions?.onError,
636
+ onRequest: options?.fetchOptions?.onRequest,
637
+ onResponse: options?.fetchOptions?.onResponse
638
+ }
639
+ };
640
+ const { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};
641
+ const $fetch = chunkRFP2X2FA_cjs.createFetch({
642
+ baseURL,
643
+ ...isCredentialsSupported ? { credentials: "include" } : {},
644
+ method: "GET",
645
+ jsonParser(text) {
646
+ if (!text) return null;
647
+ return parseJSON(text, { strict: false });
648
+ },
649
+ customFetchImpl: fetch,
650
+ ...restOfFetchOptions,
651
+ plugins: [
652
+ lifeCyclePlugin,
653
+ ...restOfFetchOptions.plugins || [],
654
+ ...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
655
+ ...pluginsFetchPlugins
656
+ ]
657
+ });
658
+ const { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);
659
+ const plugins = options?.plugins || [];
660
+ let pluginsActions = {};
661
+ const pluginsAtoms = {
662
+ $sessionSignal,
663
+ session
664
+ };
665
+ const pluginPathMethods = {
666
+ "/sign-out": "POST",
667
+ "/revoke-sessions": "POST",
668
+ "/revoke-other-sessions": "POST",
669
+ "/delete-user": "POST"
670
+ };
671
+ const atomListeners = [{
672
+ signal: "$sessionSignal",
673
+ matcher(path) {
674
+ return 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";
675
+ },
676
+ callback(path) {
677
+ if (path === "/sign-out") broadcastSessionUpdate("signout");
678
+ else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
679
+ }
680
+ }];
681
+ for (const plugin of plugins) {
682
+ if (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));
683
+ if (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);
684
+ if (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);
685
+ }
686
+ const $store = {
687
+ notify: (signal) => {
688
+ pluginsAtoms[signal].set(!pluginsAtoms[signal].get());
689
+ },
690
+ listen: (signal, listener) => {
691
+ pluginsAtoms[signal].subscribe(listener);
692
+ },
693
+ atoms: pluginsAtoms
694
+ };
695
+ for (const plugin of plugins) if (plugin.getActions) pluginsActions = chunkRFP2X2FA_cjs.defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
696
+ return {
697
+ get baseURL() {
698
+ return baseURL;
699
+ },
700
+ pluginsActions,
701
+ pluginsAtoms,
702
+ pluginPathMethods,
703
+ atomListeners,
704
+ $fetch,
705
+ $store
706
+ };
707
+ };
708
+
709
+ // node_modules/better-auth/dist/utils/is-atom.mjs
710
+ function isAtom(value) {
711
+ return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
712
+ }
713
+
714
+ // node_modules/better-auth/dist/client/proxy.mjs
715
+ function getMethod(path, knownPathMethods, args) {
716
+ const method = knownPathMethods[path];
717
+ const { fetchOptions, query: _query, ...body } = args || {};
718
+ if (method) return method;
719
+ if (fetchOptions?.method) return fetchOptions.method;
720
+ if (body && Object.keys(body).length > 0) return "POST";
721
+ return "GET";
722
+ }
723
+ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
724
+ function createProxy(path = []) {
725
+ return new Proxy(function() {
726
+ }, {
727
+ get(_, prop) {
728
+ if (typeof prop !== "string") return;
729
+ if (prop === "then" || prop === "catch" || prop === "finally") return;
730
+ const fullPath = [...path, prop];
731
+ let current = routes;
732
+ for (const segment of fullPath) if (current && typeof current === "object" && segment in current) current = current[segment];
733
+ else {
734
+ current = void 0;
735
+ break;
736
+ }
737
+ if (typeof current === "function") return current;
738
+ if (isAtom(current)) return current;
739
+ return createProxy(fullPath);
740
+ },
741
+ apply: async (_, __, args) => {
742
+ const routePath = "/" + path.map((segment) => segment.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)).join("/");
743
+ const arg = args[0] || {};
744
+ const fetchOptions = args[1] || {};
745
+ const { query, fetchOptions: argFetchOptions, ...body } = arg;
746
+ const options = {
747
+ ...fetchOptions,
748
+ ...argFetchOptions
749
+ };
750
+ const method = getMethod(routePath, knownPathMethods, arg);
751
+ return await client(routePath, {
752
+ ...options,
753
+ body: method === "GET" ? void 0 : {
754
+ ...body,
755
+ ...options?.body || {}
756
+ },
757
+ query: query || options?.query,
758
+ method,
759
+ async onSuccess(context) {
760
+ await options?.onSuccess?.(context);
761
+ if (!atomListeners || options.disableSignal) return;
762
+ const matches = atomListeners.filter((s) => s.matcher(routePath));
763
+ if (!matches.length) return;
764
+ const visited = /* @__PURE__ */ new Set();
765
+ for (const match of matches) {
766
+ const signal = atoms[match.signal];
767
+ if (!signal) return;
768
+ if (visited.has(match.signal)) continue;
769
+ visited.add(match.signal);
770
+ const val = signal.get();
771
+ setTimeout(() => {
772
+ signal.set(!val);
773
+ }, 10);
774
+ match.callback?.(routePath);
775
+ }
776
+ }
777
+ });
778
+ }
779
+ });
780
+ }
781
+ return createProxy();
782
+ }
783
+
784
+ // node_modules/better-auth/dist/client/vanilla.mjs
785
+ function createAuthClient(options) {
786
+ const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
787
+ const resolvedHooks = {};
788
+ for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${chunkJPVIXCF5_cjs.capitalizeFirstLetter(key)}`] = value;
789
+ return createDynamicPathProxy({
790
+ ...pluginsActions,
791
+ ...resolvedHooks,
792
+ $fetch,
793
+ $store
794
+ }, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
795
+ }
796
+
797
+ // src/client/auth.ts
6
798
  var AUTH_TOKEN_KEY = "better-auth.session_token";
7
799
  function createLeapifyAuthClient(baseUrl) {
8
- return client.createAuthClient({
800
+ return createAuthClient({
9
801
  baseURL: baseUrl,
10
802
  fetchOptions: {
11
803
  auth: {
@@ -57,7 +849,7 @@ async function solvePowChallenge(baseUrl) {
57
849
  const base = baseUrl?.replace(/\/$/, "") ?? "";
58
850
  let html;
59
851
  try {
60
- const res = await fetch(`${base}/events`, { credentials: "include" });
852
+ const res = await fetch(`${base}/api/events`, { credentials: "include" });
61
853
  const ct = res.headers.get("content-type") || "";
62
854
  if (!ct.includes("text/html")) {
63
855
  return false;
@@ -98,7 +890,7 @@ async function initializeSession(baseUrl, getToken) {
98
890
  const token = await getToken();
99
891
  if (!token) return null;
100
892
  const base = baseUrl.replace(/\/$/, "");
101
- const res = await fetch(`${base}/users/me`, {
893
+ const res = await fetch(`${base}/api/users/me`, {
102
894
  headers: { Authorization: `Bearer ${token}` }
103
895
  });
104
896
  if (!res.ok) return null;
@@ -107,7 +899,7 @@ async function initializeSession(baseUrl, getToken) {
107
899
  }
108
900
 
109
901
  // src/client/index.ts
110
- function getClientConfig() {
902
+ function getClientConfig2() {
111
903
  if (typeof window === "undefined") return null;
112
904
  const config = window.__CONFIG__;
113
905
  if (!config || typeof config !== "object") return null;
@@ -207,163 +999,163 @@ function createLeapifyClient(baseUrl, getToken) {
207
999
  * Use `now` (server unix epoch) for timestamp comparisons.
208
1000
  */
209
1001
  getConfig() {
210
- return get("/config");
1002
+ return get("/api/config");
211
1003
  },
212
1004
  /**
213
- * PATCH /config/:key — admin only.
1005
+ * PATCH /api/config/:key — admin only.
214
1006
  * Upserts a site config value. Requires admin or super_admin role.
215
1007
  */
216
1008
  updateConfig(key, value) {
217
- return patch(`/config/${encodeURIComponent(key)}`, { value });
1009
+ return patch(`/api/config/${encodeURIComponent(key)}`, { value });
218
1010
  },
219
1011
  // ── Events ─────────────────────────────────────────────────────────────
220
1012
  /**
221
- * GET /events
1013
+ * GET /api/events
222
1014
  * Returns all published events. Response is ETag-cached for 7 days.
223
1015
  */
224
1016
  getEvents() {
225
- return get("/events");
1017
+ return get("/api/events");
226
1018
  },
227
1019
  /**
228
- * GET /events/:slug
1020
+ * GET /api/events/:slug
229
1021
  * Returns a single published event by slug.
230
1022
  */
231
1023
  getEvent(slug) {
232
- return get(`/events/${encodeURIComponent(slug)}`);
1024
+ return get(`/api/events/${encodeURIComponent(slug)}`);
233
1025
  },
234
1026
  /**
235
- * GET /events/:slug/slots
1027
+ * GET /api/events/:slug/slots
236
1028
  * Returns real-time slot availability. CF edge caches this for 5 seconds.
237
1029
  * Poll every 8–10 seconds on event detail pages.
238
1030
  */
239
1031
  getSlots(slug) {
240
- return get(`/events/${encodeURIComponent(slug)}/slots`);
1032
+ return get(`/api/events/${encodeURIComponent(slug)}/slots`);
241
1033
  },
242
1034
  /**
243
- * POST /events — admin only.
1035
+ * POST /api/events — admin only.
244
1036
  * Creates a new event. Auto-generates slug from title.
245
1037
  */
246
1038
  createEvent(data) {
247
- return post("/events", data);
1039
+ return post("/api/events", data);
248
1040
  },
249
1041
  /**
250
- * PATCH /events/:slug — admin only.
1042
+ * PATCH /api/events/:slug — admin only.
251
1043
  * Updates an existing event by slug.
252
1044
  */
253
1045
  updateEvent(slug, data) {
254
- return patch(`/events/${encodeURIComponent(slug)}`, data);
1046
+ return patch(`/api/events/${encodeURIComponent(slug)}`, data);
255
1047
  },
256
1048
  // ── Themes ─────────────────────────────────────────────────────────────
257
1049
  /**
258
- * GET /themes
1050
+ * GET /api/themes
259
1051
  * Returns all themes.
260
1052
  */
261
1053
  getThemes() {
262
- return get("/themes");
1054
+ return get("/api/themes");
263
1055
  },
264
1056
  /**
265
- * POST /themes — admin only.
1057
+ * POST /api/themes — admin only.
266
1058
  */
267
1059
  createTheme(data) {
268
- return post("/themes", data);
1060
+ return post("/api/themes", data);
269
1061
  },
270
1062
  /**
271
- * PATCH /themes/:id — admin only.
1063
+ * PATCH /api/themes/:id — admin only.
272
1064
  */
273
1065
  updateTheme(id, data) {
274
- return patch(`/themes/${encodeURIComponent(id)}`, data);
1066
+ return patch(`/api/themes/${encodeURIComponent(id)}`, data);
275
1067
  },
276
1068
  /**
277
- * DELETE /themes/:id — admin only.
1069
+ * DELETE /api/themes/:id — admin only.
278
1070
  */
279
1071
  deleteTheme(id) {
280
- return del(`/themes/${encodeURIComponent(id)}`);
1072
+ return del(`/api/themes/${encodeURIComponent(id)}`);
281
1073
  },
282
1074
  // ── Users ──────────────────────────────────────────────────────────────
283
1075
  /**
284
- * GET /users/me
1076
+ * GET /api/users/me
285
1077
  * Returns the authenticated user's profile, or null for guests.
286
1078
  * Use `profile.role` to gate admin UI.
287
1079
  */
288
1080
  getMe() {
289
- return get("/users/me");
1081
+ return get("/api/users/me");
290
1082
  },
291
1083
  // ── Bookmarks ──────────────────────────────────────────────────────────
292
1084
  /**
293
- * GET /users/me/bookmarks
1085
+ * GET /api/users/me/bookmarks
294
1086
  * Returns the authenticated user's bookmarked events.
295
1087
  * Returns an empty array for unauthenticated users.
296
1088
  */
297
1089
  getBookmarks() {
298
- return get("/users/me/bookmarks");
1090
+ return get("/api/users/me/bookmarks");
299
1091
  },
300
1092
  /**
301
- * POST /users/me/bookmarks/:eventId
1093
+ * POST /api/users/me/bookmarks/:eventId
302
1094
  * Toggles a bookmark on/off. Requires authentication.
303
1095
  * Returns `{ bookmarked: true }` (201) on add, `{ bookmarked: false }` (200) on remove.
304
1096
  */
305
1097
  toggleBookmark(eventId) {
306
1098
  return post(
307
- `/users/me/bookmarks/${encodeURIComponent(eventId)}`
1099
+ `/api/users/me/bookmarks/${encodeURIComponent(eventId)}`
308
1100
  );
309
1101
  },
310
1102
  /**
311
- * DELETE /users/me/bookmarks/:eventId
1103
+ * DELETE /api/users/me/bookmarks/:eventId
312
1104
  * Removes a bookmark. Requires authentication.
313
1105
  */
314
1106
  deleteBookmark(eventId) {
315
1107
  return del(
316
- `/users/me/bookmarks/${encodeURIComponent(eventId)}`
1108
+ `/api/users/me/bookmarks/${encodeURIComponent(eventId)}`
317
1109
  );
318
1110
  },
319
1111
  // ── FAQs ───────────────────────────────────────────────────────────────
320
1112
  /**
321
- * GET /faqs
1113
+ * GET /api/faqs
322
1114
  * Returns all active FAQs. Cached in KV for 10 minutes.
323
1115
  * The `answer` field is markdown — render with a markdown library.
324
1116
  */
325
1117
  getFaqs() {
326
- return get("/faqs");
1118
+ return get("/api/faqs");
327
1119
  },
328
1120
  /**
329
- * POST /faqs — admin only.
1121
+ * POST /api/faqs — admin only.
330
1122
  * Creates a new FAQ item.
331
1123
  */
332
1124
  createFaq(data) {
333
- return post("/faqs", data);
1125
+ return post("/api/faqs", data);
334
1126
  },
335
1127
  /**
336
- * PATCH /faqs/:id — admin only.
1128
+ * PATCH /api/faqs/:id — admin only.
337
1129
  * Updates an existing FAQ item.
338
1130
  */
339
1131
  updateFaq(id, data) {
340
- return patch(`/faqs/${encodeURIComponent(id)}`, data);
1132
+ return patch(`/api/faqs/${encodeURIComponent(id)}`, data);
341
1133
  },
342
1134
  /**
343
- * DELETE /faqs/:id — admin only.
1135
+ * DELETE /api/faqs/:id — admin only.
344
1136
  * Soft-deletes a FAQ (sets isActive: false).
345
1137
  */
346
1138
  deleteFaq(id) {
347
- return del(`/faqs/${encodeURIComponent(id)}`);
1139
+ return del(`/api/faqs/${encodeURIComponent(id)}`);
348
1140
  },
349
1141
  // ── Uploads ────────────────────────────────────────────────────────────
350
1142
  /**
351
- * POST /uploads/images — admin only.
1143
+ * POST /api/uploads/images — admin only.
352
1144
  * Uploads an image file to R2. Accepts multipart/form-data.
353
1145
  * Returns the public URL, storage key, size, and content type.
354
1146
  */
355
1147
  uploadImage(file) {
356
1148
  const formData = new FormData();
357
1149
  formData.append("file", file);
358
- return postFormData("/uploads/images", formData);
1150
+ return postFormData("/api/uploads/images", formData);
359
1151
  },
360
1152
  // ── Content Sync ───────────────────────────────────────────────────────
361
1153
  /**
362
- * POST /config/sync-content — admin only.
1154
+ * POST /api/config/sync-content — admin only.
363
1155
  * Pushes all D1 content to Contentful. Auto-generates content types if missing.
364
1156
  */
365
1157
  syncContent() {
366
- return post("/config/sync-content");
1158
+ return post("/api/config/sync-content");
367
1159
  },
368
1160
  // ── Health ─────────────────────────────────────────────────────────────
369
1161
  /**
@@ -380,7 +1172,7 @@ exports.LEAPIFY_ERROR_CODES = LEAPIFY_ERROR_CODES;
380
1172
  exports.LeapifyApiError = LeapifyApiError;
381
1173
  exports.createLeapifyAuthClient = createLeapifyAuthClient;
382
1174
  exports.createLeapifyClient = createLeapifyClient;
383
- exports.getClientConfig = getClientConfig;
1175
+ exports.getClientConfig = getClientConfig2;
384
1176
  exports.getLeapifyToken = getLeapifyToken;
385
1177
  exports.initializeSession = initializeSession;
386
1178
  exports.signInWithGoogleRedirect = signInWithGoogleRedirect;