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