@backmatter/studio 0.0.8 → 0.0.9
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.
- package/dist/chunks/UiKitApp-b8qFsmA-.js +2401 -0
- package/dist/chunks/WorkspaceRoutes-BKKEkAq7.js +90126 -0
- package/dist/chunks/{dashboard-bNp6AbKE.js → dashboard-BNUcbYU0.js} +380 -382
- package/dist/chunks/{index-DoDE-hwB.js → index-laWAz5_p.js} +111 -112
- package/dist/dashboard.js +2 -2
- package/dist/index.js +287 -146
- package/dist/site-widget.css +1615 -0
- package/dist/site-widget.js +30896 -630
- package/dist/studio.css +268 -67
- package/package.json +4 -4
- package/src/App.tsx +12 -29
- package/src/api.ts +55 -0
- package/src/chat/ChangeCard.tsx +2 -0
- package/src/chat/ChatMessage.tsx +73 -62
- package/src/chat/ChatPanel.tsx +110 -15
- package/src/chat/DocListCard.tsx +2 -0
- package/src/chat/LiveStatus.tsx +78 -8
- package/src/chat/Reveal.tsx +34 -0
- package/src/chat/Shimmer.tsx +65 -23
- package/src/chat/chat-helpers.ts +35 -0
- package/src/chat/motion.ts +73 -0
- package/src/chat/useStickToBottom.ts +129 -14
- package/src/chrome/ContentExplorerSidebar.tsx +23 -8
- package/src/chrome/content-tree-visibility.ts +55 -0
- package/src/devbar-state.ts +125 -0
- package/src/index.css +3 -131
- package/src/pages/CliAuthorizePage.tsx +61 -28
- package/src/pages/MediaGalleryPage.tsx +74 -11
- package/src/pages/MediaLightbox.tsx +93 -1
- package/src/pages/SettingsUsagePage.tsx +23 -1
- package/src/pages/media-grid.ts +13 -0
- package/src/pages/ui-kit/UiKitApp.tsx +164 -0
- package/src/pages/ui-kit/buttons.tsx +30 -0
- package/src/pages/ui-kit/catalog.tsx +41 -0
- package/src/pages/ui-kit/colors.tsx +95 -0
- package/src/pages/ui-kit/devbar.tsx +160 -0
- package/src/pages/ui-kit/feedback.tsx +39 -0
- package/src/pages/ui-kit/fields.tsx +47 -0
- package/src/pages/ui-kit/lists.tsx +19 -0
- package/src/pages/ui-kit/overlays.tsx +39 -0
- package/src/pages/ui-kit/path.ts +9 -0
- package/src/pages/ui-kit/sections.tsx +32 -0
- package/src/pages/ui-kit/surfaces.tsx +121 -0
- package/src/pages/ui-kit/topic.tsx +112 -0
- package/src/pages/ui-kit/topics.ts +71 -0
- package/src/pages/ui-kit/type.tsx +55 -0
- package/src/preview-frame-radius.ts +51 -0
- package/src/preview-frame.tsx +93 -49
- package/src/shell-resets.css +155 -0
- package/src/site-bar.tsx +1791 -425
- package/src/site-dashboard-href.ts +21 -0
- package/src/site-devbar-overlay-inject.ts +15 -0
- package/src/site-devbar-overlay.css +217 -0
- package/src/site-pointer.ts +1 -1
- package/src/site-publish-menu.tsx +33 -0
- package/src/site-widget-styles.ts +7 -0
- package/src/site-widget.tsx +61 -21
- package/src/studio-prose-ui.css +39 -0
- package/src/theme/ThemeProvider.tsx +4 -1
- package/src/workspace-path.ts +10 -6
- package/dist/chunks/EmbedPublishPage-CtIlaeGO.js +0 -149
- package/dist/chunks/UiKitPage-DcnSQ-Hf.js +0 -173
- package/dist/chunks/WorkspaceRoutes-DVpUOaMV.js +0 -59550
- package/dist/chunks/status-bar-action-C0fsAWvD.js +0 -30618
- package/src/pages/UiKitPage.tsx +0 -331
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var D = (e, t, n) =>
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const re = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
1
|
+
var Ke = Object.defineProperty;
|
|
2
|
+
var Xe = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var D = (e, t, n) => Xe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsxs as k, jsx as o, Fragment as be } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as Ye, useCallback as Qe, useSyncExternalStore as Ze, useState as w, useEffect as V, lazy as et, Suspense as tt } from "react";
|
|
6
|
+
import { O as nt, ag as ye, ah as rt, K as _, ai as st, p as it, aj as at, ak as Ne, al as Ce, am as Ie, an as ot, ao as lt, N as qe, ap as ct, aq as ie, aa as J, Q as ze, ar as ut, as as Fe, ab as dt, ad as re, a4 as Q, a5 as Z, P as ae, at as ft, M as z, au as ht, z as ve, av as ee, ac as pt, aw as gt, ax as mt, ay as xt, f as yt, az as vt, a0 as bt, aA as wt, aB as kt, q as St, B as Et, y as Rt, aC as _t, aD as Ot, aE as Tt, A as Pt, aF as Lt, R as At, F as jt, G as Ut, H as Nt, I as F, L as Ct, J as It } from "./WorkspaceRoutes-BKKEkAq7.js";
|
|
7
|
+
const te = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
9
8
|
var t, n;
|
|
10
|
-
return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ?
|
|
11
|
-
},
|
|
9
|
+
return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ? te : globalThis);
|
|
10
|
+
}, q = new Proxy(te, {
|
|
12
11
|
get(e, t) {
|
|
13
|
-
return W()[t] ??
|
|
12
|
+
return W()[t] ?? te[t];
|
|
14
13
|
},
|
|
15
14
|
has(e, t) {
|
|
16
|
-
return t in W() || t in
|
|
15
|
+
return t in W() || t in te;
|
|
17
16
|
},
|
|
18
17
|
set(e, t, n) {
|
|
19
18
|
const r = W(!0);
|
|
@@ -29,52 +28,52 @@ const re = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
|
29
28
|
return Object.keys(e);
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
31
|
+
q.NODE_ENV;
|
|
32
|
+
var ne = class extends Error {
|
|
34
33
|
constructor(e, t) {
|
|
35
34
|
super(e, t), this.name = "BetterAuthError", this.message = e, this.stack = "";
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
const qt = 47;
|
|
39
|
-
function
|
|
38
|
+
function Be(e) {
|
|
40
39
|
let t = e.length;
|
|
41
40
|
for (; t > 0 && e.charCodeAt(t - 1) === qt; ) t--;
|
|
42
41
|
return t === e.length ? e : e.slice(0, t);
|
|
43
42
|
}
|
|
44
43
|
function zt(e) {
|
|
45
44
|
try {
|
|
46
|
-
return (
|
|
45
|
+
return (Be(new URL(e).pathname) || "/") !== "/";
|
|
47
46
|
} catch {
|
|
48
|
-
throw new
|
|
47
|
+
throw new ne(`Invalid base URL: ${e}. Please provide a valid base URL.`);
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
function
|
|
50
|
+
function Ft(e) {
|
|
52
51
|
try {
|
|
53
52
|
const t = new URL(e);
|
|
54
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") throw new
|
|
53
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") throw new ne(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`);
|
|
55
54
|
} catch (t) {
|
|
56
|
-
throw t instanceof
|
|
55
|
+
throw t instanceof ne ? t : new ne(`Invalid base URL: ${e}. Please provide a valid base URL.`, { cause: t });
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
const n =
|
|
58
|
+
function oe(e, t = "/api/auth") {
|
|
59
|
+
if (Ft(e), zt(e)) return e;
|
|
60
|
+
const n = Be(e);
|
|
62
61
|
return !t || t === "/" ? n : (t = t.startsWith("/") ? t : `/${t}`, `${n}${t}`);
|
|
63
62
|
}
|
|
64
|
-
function
|
|
65
|
-
if (e) return
|
|
63
|
+
function Bt(e, t, n, r, s) {
|
|
64
|
+
if (e) return oe(e, t);
|
|
66
65
|
{
|
|
67
|
-
const i =
|
|
68
|
-
if (i) return
|
|
66
|
+
const i = q.BETTER_AUTH_URL || q.NEXT_PUBLIC_BETTER_AUTH_URL || q.PUBLIC_BETTER_AUTH_URL || q.NUXT_PUBLIC_BETTER_AUTH_URL || q.NUXT_PUBLIC_AUTH_URL || (q.BASE_URL !== "/" ? q.BASE_URL : void 0);
|
|
67
|
+
if (i) return oe(i, t);
|
|
69
68
|
}
|
|
70
|
-
if (typeof window < "u" && window.location) return
|
|
69
|
+
if (typeof window < "u" && window.location) return oe(window.location.origin, t);
|
|
71
70
|
}
|
|
72
71
|
const Mt = {
|
|
73
72
|
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*:/,
|
|
74
73
|
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*:/,
|
|
75
74
|
protoShort: /"__proto__"\s*:/,
|
|
76
75
|
constructorShort: /"constructor"\s*:/
|
|
77
|
-
}, Dt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,
|
|
76
|
+
}, Dt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, we = {
|
|
78
77
|
true: !0,
|
|
79
78
|
false: !1,
|
|
80
79
|
null: null,
|
|
@@ -89,7 +88,7 @@ function Wt(e) {
|
|
|
89
88
|
function $t(e) {
|
|
90
89
|
const t = Ht.exec(e);
|
|
91
90
|
if (!t) return null;
|
|
92
|
-
const [, n, r, s, i, l, d,
|
|
91
|
+
const [, n, r, s, i, l, d, a, u, c, m] = t, p = new Date(Date.UTC(parseInt(n, 10), parseInt(r, 10) - 1, parseInt(s, 10), parseInt(i, 10), parseInt(l, 10), parseInt(d, 10), a ? parseInt(a.padEnd(3, "0"), 10) : 0));
|
|
93
92
|
if (u) {
|
|
94
93
|
const g = (parseInt(c, 10) * 60 + parseInt(m, 10)) * (u === "+" ? -1 : 1);
|
|
95
94
|
p.setUTCMinutes(p.getUTCMinutes() + g);
|
|
@@ -100,14 +99,14 @@ function Gt(e, t = {}) {
|
|
|
100
99
|
const { strict: n = !1, warnings: r = !1, reviver: s, parseDates: i = !0 } = t;
|
|
101
100
|
if (typeof e != "string") return e;
|
|
102
101
|
const l = e.trim(), d = l.toLowerCase();
|
|
103
|
-
if (d.length <= 9 && d in
|
|
102
|
+
if (d.length <= 9 && d in we) return we[d];
|
|
104
103
|
if (!Dt.test(l)) {
|
|
105
104
|
if (n) throw new SyntaxError("[better-json] Invalid JSON");
|
|
106
105
|
return e;
|
|
107
106
|
}
|
|
108
|
-
if (Object.entries(Mt).some(([
|
|
107
|
+
if (Object.entries(Mt).some(([a, u]) => {
|
|
109
108
|
const c = u.test(l);
|
|
110
|
-
return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${
|
|
109
|
+
return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${a} pattern`), c;
|
|
111
110
|
}) && n) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
112
111
|
try {
|
|
113
112
|
return JSON.parse(l, (u, c) => {
|
|
@@ -121,15 +120,15 @@ function Gt(e, t = {}) {
|
|
|
121
120
|
}
|
|
122
121
|
return s ? s(u, c) : c;
|
|
123
122
|
});
|
|
124
|
-
} catch (
|
|
125
|
-
if (n) throw
|
|
123
|
+
} catch (a) {
|
|
124
|
+
if (n) throw a;
|
|
126
125
|
return e;
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
|
-
function
|
|
128
|
+
function Jt(e, t = { strict: !0 }) {
|
|
130
129
|
return Gt(e, t);
|
|
131
130
|
}
|
|
132
|
-
const
|
|
131
|
+
const Vt = [
|
|
133
132
|
"javascript:",
|
|
134
133
|
"data:",
|
|
135
134
|
"vbscript:"
|
|
@@ -141,7 +140,7 @@ function Kt(e) {
|
|
|
141
140
|
} catch {
|
|
142
141
|
return !0;
|
|
143
142
|
}
|
|
144
|
-
return !
|
|
143
|
+
return !Vt.includes(t.protocol);
|
|
145
144
|
}
|
|
146
145
|
const Xt = {
|
|
147
146
|
id: "redirect",
|
|
@@ -155,25 +154,25 @@ const Xt = {
|
|
|
155
154
|
}
|
|
156
155
|
} }
|
|
157
156
|
};
|
|
158
|
-
let
|
|
159
|
-
const
|
|
157
|
+
let j = [], $ = 0;
|
|
158
|
+
const ge = 4, Yt = globalThis.nanostoresGlobal || (globalThis.nanostoresGlobal = { epoch: 0 });
|
|
160
159
|
let Qt = () => {
|
|
161
160
|
let e, t;
|
|
162
|
-
for (; $ <
|
|
163
|
-
t = $, $ +=
|
|
161
|
+
for (; $ < j.length; ) {
|
|
162
|
+
t = $, $ += ge;
|
|
164
163
|
try {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
j[t](
|
|
165
|
+
j[t + 1].value,
|
|
166
|
+
j[t + 2],
|
|
167
|
+
j[t + 3]
|
|
169
168
|
);
|
|
170
169
|
} catch (n) {
|
|
171
170
|
e = n;
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
|
-
if (
|
|
173
|
+
if (j.length = $ = 0, e) throw e;
|
|
175
174
|
};
|
|
176
|
-
const
|
|
175
|
+
const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
177
176
|
let t = [], n = {
|
|
178
177
|
eq: Object.is,
|
|
179
178
|
get() {
|
|
@@ -184,17 +183,17 @@ const Ee = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
|
184
183
|
lc: 0,
|
|
185
184
|
listen(r) {
|
|
186
185
|
return n.lc = t.push(r), () => {
|
|
187
|
-
for (let i = $; i <
|
|
188
|
-
|
|
186
|
+
for (let i = $; i < j.length; )
|
|
187
|
+
j[i] === r ? j.splice(i, ge) : i += ge;
|
|
189
188
|
let s = t.indexOf(r);
|
|
190
189
|
~s && (t.splice(s, 1), --n.lc || n.off());
|
|
191
190
|
};
|
|
192
191
|
},
|
|
193
192
|
notify(r, s) {
|
|
194
193
|
Yt.epoch++;
|
|
195
|
-
let i = !
|
|
194
|
+
let i = !j.length && !0;
|
|
196
195
|
for (let l of t)
|
|
197
|
-
|
|
196
|
+
j.push(
|
|
198
197
|
l,
|
|
199
198
|
n,
|
|
200
199
|
r,
|
|
@@ -217,16 +216,16 @@ const Ee = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
|
217
216
|
value: e
|
|
218
217
|
};
|
|
219
218
|
return n;
|
|
220
|
-
}, Zt = 2, en = 5,
|
|
221
|
-
let
|
|
219
|
+
}, Zt = 2, en = 5, X = 6, Y = 10;
|
|
220
|
+
let Me = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.events[n + Y] = r((s) => {
|
|
222
221
|
e.events[n].reduceRight((i, l) => (l(i), i), {
|
|
223
222
|
shared: {},
|
|
224
223
|
...s
|
|
225
224
|
});
|
|
226
225
|
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
227
226
|
let s = e.events[n], i = s.indexOf(t);
|
|
228
|
-
~i && (s.splice(i, 1), s.length || (e.events[n +
|
|
229
|
-
}), tn = (e, t) =>
|
|
227
|
+
~i && (s.splice(i, 1), s.length || (e.events[n + Y](), delete e.events[n + Y]));
|
|
228
|
+
}), tn = (e, t) => Me(e, t, Zt, (n) => {
|
|
230
229
|
let r = e.set, s = e.setKey;
|
|
231
230
|
return e.setKey && (e.setKey = (i, l) => {
|
|
232
231
|
let d;
|
|
@@ -246,27 +245,27 @@ let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Q] || (e.event
|
|
|
246
245
|
e.set = r, e.setKey = s;
|
|
247
246
|
};
|
|
248
247
|
});
|
|
249
|
-
const
|
|
250
|
-
let nn = (e, t) =>
|
|
248
|
+
const De = 1e3;
|
|
249
|
+
let nn = (e, t) => Me(e, (r) => {
|
|
251
250
|
let s = t(r);
|
|
252
|
-
s && e.events[
|
|
251
|
+
s && e.events[X].push(s);
|
|
253
252
|
}, en, (r) => {
|
|
254
253
|
let s = e.listen;
|
|
255
254
|
e.listen = (...l) => (!e.lc && !e.active && (e.active = !0, r()), s(...l));
|
|
256
255
|
let i = e.off;
|
|
257
|
-
return e.events[
|
|
256
|
+
return e.events[X] = [], e.off = () => {
|
|
258
257
|
i(), setTimeout(() => {
|
|
259
258
|
if (e.active && !e.lc) {
|
|
260
259
|
e.active = !1;
|
|
261
|
-
for (let l of e.events[
|
|
262
|
-
e.events[
|
|
260
|
+
for (let l of e.events[X]) l();
|
|
261
|
+
e.events[X] = [];
|
|
263
262
|
}
|
|
264
|
-
},
|
|
263
|
+
}, De);
|
|
265
264
|
}, () => {
|
|
266
265
|
e.listen = s, e.off = i;
|
|
267
266
|
};
|
|
268
267
|
});
|
|
269
|
-
function
|
|
268
|
+
function Se(e, t) {
|
|
270
269
|
let n = rn(t), r = e;
|
|
271
270
|
for (let s of n) {
|
|
272
271
|
if (r == null)
|
|
@@ -275,14 +274,14 @@ function Re(e, t) {
|
|
|
275
274
|
}
|
|
276
275
|
return r;
|
|
277
276
|
}
|
|
278
|
-
const
|
|
277
|
+
const Ee = /(.*)\[(\d+)\]/;
|
|
279
278
|
function rn(e) {
|
|
280
|
-
return e.split(".").flatMap((t) =>
|
|
279
|
+
return e.split(".").flatMap((t) => He(t));
|
|
281
280
|
}
|
|
282
|
-
function
|
|
283
|
-
if (
|
|
284
|
-
let [, t, n] = e.match(
|
|
285
|
-
return [...
|
|
281
|
+
function He(e) {
|
|
282
|
+
if (Ee.test(e)) {
|
|
283
|
+
let [, t, n] = e.match(Ee);
|
|
284
|
+
return [...He(t), n];
|
|
286
285
|
}
|
|
287
286
|
return [e];
|
|
288
287
|
}
|
|
@@ -293,36 +292,36 @@ function sn(e, t, n) {
|
|
|
293
292
|
(d) => i === void 0 || // `map` keys are plain properties, but a `deepMap` key is a path into
|
|
294
293
|
// the value, where a plain lookup would compare undefined to undefined
|
|
295
294
|
// and never report a change.
|
|
296
|
-
s[d] !== i[d] ||
|
|
295
|
+
s[d] !== i[d] || Se(s, d) !== Se(i, d)
|
|
297
296
|
) : r.has(l) || r.has(l.split(/\.|\[/)[0])) && n(s, i, l);
|
|
298
297
|
});
|
|
299
298
|
}
|
|
300
|
-
function
|
|
299
|
+
function Re(e) {
|
|
301
300
|
if (typeof e != "object" || e === null) return !1;
|
|
302
301
|
const t = Object.getPrototypeOf(e);
|
|
303
302
|
return t === Object.prototype || t === null;
|
|
304
303
|
}
|
|
305
|
-
function
|
|
304
|
+
function se(e, t) {
|
|
306
305
|
if (e === t) return !0;
|
|
307
306
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
308
307
|
if (e.length !== t.length) return !1;
|
|
309
|
-
for (let n = 0; n < e.length; n++) if (!
|
|
308
|
+
for (let n = 0; n < e.length; n++) if (!se(e[n], t[n])) return !1;
|
|
310
309
|
return !0;
|
|
311
310
|
}
|
|
312
|
-
if (
|
|
311
|
+
if (Re(e) && Re(t)) {
|
|
313
312
|
const n = Object.keys(e), r = Object.keys(t);
|
|
314
313
|
if (n.length !== r.length) return !1;
|
|
315
|
-
for (const s of n) if (!(s in t) || !
|
|
314
|
+
for (const s of n) if (!(s in t) || !se(e[s], t[s])) return !1;
|
|
316
315
|
return !0;
|
|
317
316
|
}
|
|
318
317
|
return !1;
|
|
319
318
|
}
|
|
320
|
-
function
|
|
319
|
+
function an(e, t) {
|
|
321
320
|
return tn(e, ({ newValue: n, abort: r }) => {
|
|
322
321
|
t(e.value, n) && r();
|
|
323
322
|
});
|
|
324
323
|
}
|
|
325
|
-
const
|
|
324
|
+
const le = Symbol.for("better-auth:broadcast-channel"), on = () => Math.floor(Date.now() / 1e3);
|
|
326
325
|
var ln = class {
|
|
327
326
|
constructor(e = "better-auth.message") {
|
|
328
327
|
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -339,7 +338,7 @@ var ln = class {
|
|
|
339
338
|
try {
|
|
340
339
|
localStorage.setItem(this.name, JSON.stringify({
|
|
341
340
|
...e,
|
|
342
|
-
timestamp:
|
|
341
|
+
timestamp: on()
|
|
343
342
|
}));
|
|
344
343
|
} catch {
|
|
345
344
|
}
|
|
@@ -357,10 +356,10 @@ var ln = class {
|
|
|
357
356
|
};
|
|
358
357
|
}
|
|
359
358
|
};
|
|
360
|
-
function
|
|
361
|
-
return globalThis[
|
|
359
|
+
function ce(e = "better-auth.message") {
|
|
360
|
+
return globalThis[le] || (globalThis[le] = new ln(e)), globalThis[le];
|
|
362
361
|
}
|
|
363
|
-
const
|
|
362
|
+
const ue = Symbol.for("better-auth:focus-manager");
|
|
364
363
|
var cn = class {
|
|
365
364
|
constructor() {
|
|
366
365
|
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -384,10 +383,10 @@ var cn = class {
|
|
|
384
383
|
};
|
|
385
384
|
}
|
|
386
385
|
};
|
|
387
|
-
function
|
|
388
|
-
return globalThis[
|
|
386
|
+
function _e() {
|
|
387
|
+
return globalThis[ue] || (globalThis[ue] = new cn()), globalThis[ue];
|
|
389
388
|
}
|
|
390
|
-
const
|
|
389
|
+
const de = Symbol.for("better-auth:online-manager");
|
|
391
390
|
var un = class {
|
|
392
391
|
constructor() {
|
|
393
392
|
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -410,71 +409,71 @@ var un = class {
|
|
|
410
409
|
};
|
|
411
410
|
}
|
|
412
411
|
};
|
|
413
|
-
function
|
|
414
|
-
return globalThis[
|
|
412
|
+
function fe() {
|
|
413
|
+
return globalThis[de] || (globalThis[de] = new un()), globalThis[de];
|
|
415
414
|
}
|
|
416
|
-
const
|
|
415
|
+
const he = () => Math.floor(Date.now() / 1e3), dn = 5;
|
|
417
416
|
function fn(e) {
|
|
418
417
|
var O, b, T;
|
|
419
|
-
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((O = s.sessionOptions) == null ? void 0 : O.refetchInterval) ?? 0, l = ((b = s.sessionOptions) == null ? void 0 : b.refetchOnWindowFocus) ?? !0, d = ((T = s.sessionOptions) == null ? void 0 : T.refetchWhenOffline) ?? !1,
|
|
418
|
+
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((O = s.sessionOptions) == null ? void 0 : O.refetchInterval) ?? 0, l = ((b = s.sessionOptions) == null ? void 0 : b.refetchOnWindowFocus) ?? !0, d = ((T = s.sessionOptions) == null ? void 0 : T.refetchWhenOffline) ?? !1, a = {
|
|
420
419
|
isInitialized: !1,
|
|
421
420
|
lastSessionRequest: 0
|
|
422
|
-
}, u = () => d ||
|
|
421
|
+
}, u = () => d || fe().isOnline, c = (f) => {
|
|
423
422
|
if (u()) {
|
|
424
423
|
if ((f == null ? void 0 : f.event) === "storage") {
|
|
425
424
|
t();
|
|
426
425
|
return;
|
|
427
426
|
}
|
|
428
427
|
if ((f == null ? void 0 : f.event) === "poll") {
|
|
429
|
-
|
|
428
|
+
a.lastSessionRequest = he(), t();
|
|
430
429
|
return;
|
|
431
430
|
}
|
|
432
431
|
if ((f == null ? void 0 : f.event) === "visibilitychange") {
|
|
433
|
-
if (
|
|
434
|
-
|
|
432
|
+
if (he() - a.lastSessionRequest < dn) return;
|
|
433
|
+
a.lastSessionRequest = he(), t();
|
|
435
434
|
return;
|
|
436
435
|
}
|
|
437
436
|
t();
|
|
438
437
|
}
|
|
439
438
|
}, m = (f) => {
|
|
440
|
-
|
|
439
|
+
ce().post({
|
|
441
440
|
event: "session",
|
|
442
441
|
data: { trigger: f },
|
|
443
442
|
clientId: Math.random().toString(36).substring(7)
|
|
444
443
|
});
|
|
445
444
|
}, p = () => {
|
|
446
|
-
i && i > 0 && (
|
|
445
|
+
i && i > 0 && (a.pollInterval = setInterval(() => {
|
|
447
446
|
n() && c({ event: "poll" });
|
|
448
447
|
}, i * 1e3));
|
|
449
448
|
}, g = () => {
|
|
450
|
-
|
|
449
|
+
a.unsubscribeBroadcast = ce().subscribe(() => {
|
|
451
450
|
c({ event: "storage" });
|
|
452
451
|
});
|
|
453
452
|
}, y = () => {
|
|
454
|
-
l && (
|
|
453
|
+
l && (a.unsubscribeFocus = _e().subscribe(() => {
|
|
455
454
|
c({ event: "visibilitychange" });
|
|
456
455
|
}));
|
|
457
456
|
}, v = () => {
|
|
458
|
-
|
|
457
|
+
a.unsubscribeOnline = fe().subscribe((f) => {
|
|
459
458
|
f && c({ event: "visibilitychange" });
|
|
460
459
|
});
|
|
461
460
|
}, x = () => {
|
|
462
|
-
|
|
461
|
+
a.unsubscribeSignal = r.listen(() => {
|
|
463
462
|
t();
|
|
464
463
|
});
|
|
465
464
|
};
|
|
466
465
|
return {
|
|
467
466
|
init: () => {
|
|
468
|
-
|
|
467
|
+
a.isInitialized || (a.isInitialized = !0, p(), g(), y(), v(), x(), a.cleanupBroadcastSetup = ce().setup(), a.cleanupFocusSetup = _e().setup(), a.cleanupOnlineSetup = fe().setup());
|
|
469
468
|
},
|
|
470
469
|
cleanup: () => {
|
|
471
|
-
|
|
470
|
+
a.isInitialized && (a.pollInterval && (clearInterval(a.pollInterval), a.pollInterval = void 0), a.unsubscribeBroadcast && (a.unsubscribeBroadcast(), a.unsubscribeBroadcast = void 0), a.unsubscribeFocus && (a.unsubscribeFocus(), a.unsubscribeFocus = void 0), a.unsubscribeOnline && (a.unsubscribeOnline(), a.unsubscribeOnline = void 0), a.unsubscribeSignal && (a.unsubscribeSignal(), a.unsubscribeSignal = void 0), a.cleanupBroadcastSetup && (a.cleanupBroadcastSetup(), a.cleanupBroadcastSetup = void 0), a.cleanupFocusSetup && (a.cleanupFocusSetup(), a.cleanupFocusSetup = void 0), a.cleanupOnlineSetup && (a.cleanupOnlineSetup(), a.cleanupOnlineSetup = void 0), a.isInitialized = !1, a.lastSessionRequest = 0);
|
|
472
471
|
},
|
|
473
472
|
triggerRefetch: c,
|
|
474
473
|
broadcastSessionUpdate: m
|
|
475
474
|
};
|
|
476
475
|
}
|
|
477
|
-
const hn = () => typeof window > "u", pn =
|
|
476
|
+
const hn = () => typeof window > "u", pn = De;
|
|
478
477
|
function gn(e, t) {
|
|
479
478
|
if (typeof window > "u") return;
|
|
480
479
|
const n = e.get();
|
|
@@ -485,7 +484,7 @@ function gn(e, t) {
|
|
|
485
484
|
isPending: !1
|
|
486
485
|
});
|
|
487
486
|
}
|
|
488
|
-
function
|
|
487
|
+
function Oe(e) {
|
|
489
488
|
return typeof e == "object" && e !== null && "data" in e && "error" in e ? e : {
|
|
490
489
|
data: e,
|
|
491
490
|
error: null
|
|
@@ -495,23 +494,23 @@ function mn(e) {
|
|
|
495
494
|
return !e || e.session === null && e.user === null ? null : e;
|
|
496
495
|
}
|
|
497
496
|
function xn(e, t) {
|
|
498
|
-
return
|
|
497
|
+
return se(e.data, t.data) && e.error === t.error && e.isPending === t.isPending && e.isRefetching === t.isRefetching && e.refetch === t.refetch;
|
|
499
498
|
}
|
|
500
499
|
function yn(e, t) {
|
|
501
|
-
const n = /* @__PURE__ */
|
|
500
|
+
const n = /* @__PURE__ */ ke(!1);
|
|
502
501
|
let r, s = 0, i = 0;
|
|
503
502
|
n.listen(() => {
|
|
504
503
|
i++, s = 0;
|
|
505
504
|
});
|
|
506
|
-
const l = (g) => c(g), d = /* @__PURE__ */
|
|
505
|
+
const l = (g) => c(g), d = /* @__PURE__ */ ke({
|
|
507
506
|
data: null,
|
|
508
507
|
error: null,
|
|
509
508
|
isPending: !0,
|
|
510
509
|
isRefetching: !1,
|
|
511
510
|
refetch: l
|
|
512
511
|
});
|
|
513
|
-
|
|
514
|
-
const
|
|
512
|
+
an(d, xn);
|
|
513
|
+
const a = async (g, y) => {
|
|
515
514
|
const v = d.value;
|
|
516
515
|
if (d.set({
|
|
517
516
|
...v,
|
|
@@ -527,29 +526,29 @@ function yn(e, t) {
|
|
|
527
526
|
signal: g
|
|
528
527
|
});
|
|
529
528
|
if (g.aborted) return "aborted";
|
|
530
|
-
let { data:
|
|
531
|
-
if (
|
|
529
|
+
let { data: S, error: E } = Oe(x), O = "fresh";
|
|
530
|
+
if (S != null && S.needsRefresh) try {
|
|
532
531
|
const R = await e("/get-session", {
|
|
533
532
|
method: "POST",
|
|
534
533
|
signal: g
|
|
535
534
|
});
|
|
536
535
|
if (g.aborted) return "aborted";
|
|
537
|
-
({ data:
|
|
536
|
+
({ data: S, error: E } = Oe(R));
|
|
538
537
|
} catch {
|
|
539
538
|
if (g.aborted) return "aborted";
|
|
540
539
|
O = "stale";
|
|
541
540
|
}
|
|
542
541
|
if (E) {
|
|
543
|
-
const R = d.value,
|
|
542
|
+
const R = d.value, U = (E == null ? void 0 : E.status) === 401;
|
|
544
543
|
return d.set({
|
|
545
|
-
data:
|
|
544
|
+
data: U ? null : R.data,
|
|
546
545
|
error: E,
|
|
547
546
|
isPending: !1,
|
|
548
547
|
isRefetching: !1,
|
|
549
548
|
refetch: l
|
|
550
549
|
}), "failed";
|
|
551
550
|
}
|
|
552
|
-
const b = mn(
|
|
551
|
+
const b = mn(S), T = d.value, f = T.data != null && b != null && se(T.data, b) ? T.data : b;
|
|
553
552
|
return d.set({
|
|
554
553
|
data: f,
|
|
555
554
|
error: null,
|
|
@@ -559,9 +558,9 @@ function yn(e, t) {
|
|
|
559
558
|
}), O;
|
|
560
559
|
} catch (x) {
|
|
561
560
|
if (g.aborted) return "aborted";
|
|
562
|
-
const
|
|
561
|
+
const S = d.value;
|
|
563
562
|
return d.set({
|
|
564
|
-
data:
|
|
563
|
+
data: S.data,
|
|
565
564
|
error: x,
|
|
566
565
|
isPending: !1,
|
|
567
566
|
isRefetching: !1,
|
|
@@ -576,12 +575,12 @@ function yn(e, t) {
|
|
|
576
575
|
s = 0, r == null || r.cancel();
|
|
577
576
|
const y = new AbortController(), v = {
|
|
578
577
|
cancel: () => y.abort(),
|
|
579
|
-
promise: Promise.resolve().then(() => y.signal.aborted ? "aborted" :
|
|
578
|
+
promise: Promise.resolve().then(() => y.signal.aborted ? "aborted" : a(y.signal, g)),
|
|
580
579
|
revision: i
|
|
581
580
|
};
|
|
582
581
|
r = v;
|
|
583
|
-
const x = (
|
|
584
|
-
r === v && (r = void 0,
|
|
582
|
+
const x = (S) => {
|
|
583
|
+
r === v && (r = void 0, S === "fresh" && v.revision === i && (s = u()));
|
|
585
584
|
};
|
|
586
585
|
return v.promise.then(x, () => x("failed")), v.promise.then(() => {
|
|
587
586
|
});
|
|
@@ -609,21 +608,21 @@ function yn(e, t) {
|
|
|
609
608
|
broadcastSessionUpdate: (g) => p(g)
|
|
610
609
|
};
|
|
611
610
|
}
|
|
612
|
-
function
|
|
611
|
+
function pe(e) {
|
|
613
612
|
if (e === null || typeof e != "object")
|
|
614
613
|
return !1;
|
|
615
614
|
const t = Object.getPrototypeOf(e);
|
|
616
615
|
return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
|
|
617
616
|
}
|
|
618
|
-
function
|
|
619
|
-
if (!
|
|
620
|
-
return
|
|
617
|
+
function me(e, t, n = ".", r) {
|
|
618
|
+
if (!pe(t))
|
|
619
|
+
return me(e, {}, n, r);
|
|
621
620
|
const s = { ...t };
|
|
622
621
|
for (const i of Object.keys(e)) {
|
|
623
622
|
if (i === "__proto__" || i === "constructor")
|
|
624
623
|
continue;
|
|
625
624
|
const l = e[i];
|
|
626
|
-
l != null && (r && r(s, i, l, n) || (Array.isArray(l) && Array.isArray(s[i]) ? s[i] = [...l, ...s[i]] :
|
|
625
|
+
l != null && (r && r(s, i, l, n) || (Array.isArray(l) && Array.isArray(s[i]) ? s[i] = [...l, ...s[i]] : pe(l) && pe(s[i]) ? s[i] = me(
|
|
627
626
|
l,
|
|
628
627
|
s[i],
|
|
629
628
|
(n ? `${n}.` : "") + i.toString(),
|
|
@@ -635,18 +634,18 @@ function xe(e, t, n = ".", r) {
|
|
|
635
634
|
function vn(e) {
|
|
636
635
|
return (...t) => (
|
|
637
636
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
638
|
-
t.reduce((n, r) =>
|
|
637
|
+
t.reduce((n, r) => me(n, r, "", e), {})
|
|
639
638
|
);
|
|
640
639
|
}
|
|
641
640
|
const bn = vn();
|
|
642
|
-
var wn = Object.defineProperty,
|
|
641
|
+
var wn = Object.defineProperty, kn = Object.defineProperties, Sn = Object.getOwnPropertyDescriptors, Te = Object.getOwnPropertySymbols, En = Object.prototype.hasOwnProperty, Rn = Object.prototype.propertyIsEnumerable, Pe = (e, t, n) => t in e ? wn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, A = (e, t) => {
|
|
643
642
|
for (var n in t || (t = {}))
|
|
644
|
-
En.call(t, n) &&
|
|
645
|
-
if (
|
|
646
|
-
for (var n of
|
|
647
|
-
Rn.call(t, n) &&
|
|
643
|
+
En.call(t, n) && Pe(e, n, t[n]);
|
|
644
|
+
if (Te)
|
|
645
|
+
for (var n of Te(t))
|
|
646
|
+
Rn.call(t, n) && Pe(e, n, t[n]);
|
|
648
647
|
return e;
|
|
649
|
-
}, N = (e, t) =>
|
|
648
|
+
}, N = (e, t) => kn(e, Sn(t)), _n = class extends Error {
|
|
650
649
|
constructor(e, t, n) {
|
|
651
650
|
super(t || e.toString(), {
|
|
652
651
|
cause: n
|
|
@@ -654,7 +653,7 @@ var wn = Object.defineProperty, Sn = Object.defineProperties, kn = Object.getOwn
|
|
|
654
653
|
}
|
|
655
654
|
}, On = async (e, t) => {
|
|
656
655
|
var n, r, s, i, l, d;
|
|
657
|
-
let
|
|
656
|
+
let a = t || {};
|
|
658
657
|
const u = {
|
|
659
658
|
onRequest: [t == null ? void 0 : t.onRequest],
|
|
660
659
|
onResponse: [t == null ? void 0 : t.onResponse],
|
|
@@ -665,22 +664,22 @@ var wn = Object.defineProperty, Sn = Object.defineProperties, kn = Object.getOwn
|
|
|
665
664
|
if (!t || !(t != null && t.plugins))
|
|
666
665
|
return {
|
|
667
666
|
url: e,
|
|
668
|
-
options:
|
|
667
|
+
options: a,
|
|
669
668
|
hooks: u
|
|
670
669
|
};
|
|
671
670
|
for (const c of (t == null ? void 0 : t.plugins) || []) {
|
|
672
671
|
if (c.init) {
|
|
673
672
|
const m = await ((n = c.init) == null ? void 0 : n.call(c, e.toString(), t));
|
|
674
|
-
|
|
673
|
+
a = m.options || a, e = m.url;
|
|
675
674
|
}
|
|
676
675
|
u.onRequest.push((r = c.hooks) == null ? void 0 : r.onRequest), u.onResponse.push((s = c.hooks) == null ? void 0 : s.onResponse), u.onSuccess.push((i = c.hooks) == null ? void 0 : i.onSuccess), u.onError.push((l = c.hooks) == null ? void 0 : l.onError), u.onRetry.push((d = c.hooks) == null ? void 0 : d.onRetry);
|
|
677
676
|
}
|
|
678
677
|
return {
|
|
679
678
|
url: e,
|
|
680
|
-
options:
|
|
679
|
+
options: a,
|
|
681
680
|
hooks: u
|
|
682
681
|
};
|
|
683
|
-
},
|
|
682
|
+
}, Le = class {
|
|
684
683
|
constructor(e) {
|
|
685
684
|
this.options = e;
|
|
686
685
|
}
|
|
@@ -710,14 +709,14 @@ var wn = Object.defineProperty, Sn = Object.defineProperties, kn = Object.getOwn
|
|
|
710
709
|
};
|
|
711
710
|
function Pn(e) {
|
|
712
711
|
if (typeof e == "number")
|
|
713
|
-
return new
|
|
712
|
+
return new Le({
|
|
714
713
|
type: "linear",
|
|
715
714
|
attempts: e,
|
|
716
715
|
delay: 1e3
|
|
717
716
|
});
|
|
718
717
|
switch (e.type) {
|
|
719
718
|
case "linear":
|
|
720
|
-
return new
|
|
719
|
+
return new Le(e);
|
|
721
720
|
case "exponential":
|
|
722
721
|
return new Tn(e);
|
|
723
722
|
default:
|
|
@@ -751,8 +750,8 @@ var Ln = async (e) => {
|
|
|
751
750
|
}
|
|
752
751
|
}
|
|
753
752
|
return t;
|
|
754
|
-
},
|
|
755
|
-
function
|
|
753
|
+
}, An = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
754
|
+
function jn(e) {
|
|
756
755
|
const t = e.headers.get("content-type"), n = /* @__PURE__ */ new Set([
|
|
757
756
|
"image/svg",
|
|
758
757
|
"application/xml",
|
|
@@ -762,41 +761,41 @@ function An(e) {
|
|
|
762
761
|
if (!t)
|
|
763
762
|
return "json";
|
|
764
763
|
const r = t.split(";").shift() || "";
|
|
765
|
-
return
|
|
764
|
+
return An.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
|
|
766
765
|
}
|
|
767
|
-
function
|
|
766
|
+
function Un(e) {
|
|
768
767
|
try {
|
|
769
768
|
return JSON.parse(e), !0;
|
|
770
769
|
} catch {
|
|
771
770
|
return !1;
|
|
772
771
|
}
|
|
773
772
|
}
|
|
774
|
-
function
|
|
773
|
+
function We(e) {
|
|
775
774
|
if (e === void 0)
|
|
776
775
|
return !1;
|
|
777
776
|
const t = typeof e;
|
|
778
777
|
return t === "string" || t === "number" || t === "boolean" || t === null ? !0 : t !== "object" ? !1 : Array.isArray(e) ? !0 : e.buffer ? !1 : e.constructor && e.constructor.name === "Object" || typeof e.toJSON == "function";
|
|
779
778
|
}
|
|
780
|
-
function
|
|
779
|
+
function Ae(e) {
|
|
781
780
|
try {
|
|
782
781
|
return JSON.parse(e);
|
|
783
782
|
} catch {
|
|
784
783
|
return e;
|
|
785
784
|
}
|
|
786
785
|
}
|
|
787
|
-
function
|
|
786
|
+
function je(e) {
|
|
788
787
|
return typeof e == "function";
|
|
789
788
|
}
|
|
790
789
|
function Nn(e) {
|
|
791
790
|
if (e != null && e.customFetchImpl)
|
|
792
791
|
return e.customFetchImpl;
|
|
793
|
-
if (typeof globalThis < "u" &&
|
|
792
|
+
if (typeof globalThis < "u" && je(globalThis.fetch))
|
|
794
793
|
return globalThis.fetch;
|
|
795
|
-
if (typeof window < "u" &&
|
|
794
|
+
if (typeof window < "u" && je(window.fetch))
|
|
796
795
|
return window.fetch;
|
|
797
796
|
throw new Error("No fetch implementation found");
|
|
798
797
|
}
|
|
799
|
-
function
|
|
798
|
+
function $e(...e) {
|
|
800
799
|
const t = {};
|
|
801
800
|
for (const n of e)
|
|
802
801
|
if (n)
|
|
@@ -812,7 +811,7 @@ function Je(...e) {
|
|
|
812
811
|
return t;
|
|
813
812
|
}
|
|
814
813
|
async function Cn(e) {
|
|
815
|
-
const t = new Headers(
|
|
814
|
+
const t = new Headers($e(e == null ? void 0 : e.headers, await Ln(e)));
|
|
816
815
|
if (!t.has("content-type")) {
|
|
817
816
|
const n = In(e == null ? void 0 : e.body);
|
|
818
817
|
n && t.set("content-type", n);
|
|
@@ -820,7 +819,7 @@ async function Cn(e) {
|
|
|
820
819
|
return t;
|
|
821
820
|
}
|
|
822
821
|
function In(e) {
|
|
823
|
-
return
|
|
822
|
+
return We(e) ? "application/json" : null;
|
|
824
823
|
}
|
|
825
824
|
function qn(e) {
|
|
826
825
|
const t = e.get("content-type");
|
|
@@ -828,19 +827,19 @@ function qn(e) {
|
|
|
828
827
|
}
|
|
829
828
|
function zn(e, t) {
|
|
830
829
|
const { body: n } = e;
|
|
831
|
-
return n ? !
|
|
830
|
+
return n ? !We(n) || typeof n == "string" ? n : qn(t) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n) : null;
|
|
832
831
|
}
|
|
833
|
-
function
|
|
832
|
+
function Fn(e, t) {
|
|
834
833
|
var n;
|
|
835
834
|
if (t != null && t.method)
|
|
836
835
|
return t.method.toUpperCase();
|
|
837
836
|
if (e.startsWith("@")) {
|
|
838
837
|
const r = (n = e.split("@")[1]) == null ? void 0 : n.split("/")[0];
|
|
839
|
-
return
|
|
838
|
+
return Je.includes(r) ? r.toUpperCase() : t != null && t.body ? "POST" : "GET";
|
|
840
839
|
}
|
|
841
840
|
return t != null && t.body ? "POST" : "GET";
|
|
842
841
|
}
|
|
843
|
-
function
|
|
842
|
+
function Bn(e, t) {
|
|
844
843
|
let n;
|
|
845
844
|
return !(e != null && e.signal) && (e != null && e.timeout) && (n = setTimeout(() => t == null ? void 0 : t.abort(), e == null ? void 0 : e.timeout)), {
|
|
846
845
|
abortTimeout: n,
|
|
@@ -849,9 +848,9 @@ function Fn(e, t) {
|
|
|
849
848
|
}
|
|
850
849
|
};
|
|
851
850
|
}
|
|
852
|
-
var Mn = class
|
|
851
|
+
var Mn = class Ge extends Error {
|
|
853
852
|
constructor(t, n) {
|
|
854
|
-
super(n || JSON.stringify(t, null, 2)), this.issues = t, Object.setPrototypeOf(this,
|
|
853
|
+
super(n || JSON.stringify(t, null, 2)), this.issues = t, Object.setPrototypeOf(this, Ge.prototype);
|
|
855
854
|
}
|
|
856
855
|
};
|
|
857
856
|
async function G(e, t) {
|
|
@@ -860,22 +859,22 @@ async function G(e, t) {
|
|
|
860
859
|
throw new Mn(n.issues);
|
|
861
860
|
return n.value;
|
|
862
861
|
}
|
|
863
|
-
var
|
|
862
|
+
var Je = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
864
863
|
id: "apply-schema",
|
|
865
864
|
name: "Apply Schema",
|
|
866
865
|
version: "1.0.0",
|
|
867
866
|
async init(t, n) {
|
|
868
867
|
var r, s, i, l;
|
|
869
868
|
const d = ((s = (r = e.plugins) == null ? void 0 : r.find(
|
|
870
|
-
(
|
|
869
|
+
(a) => {
|
|
871
870
|
var u;
|
|
872
|
-
return (u =
|
|
871
|
+
return (u = a.schema) != null && u.config ? t.startsWith(a.schema.config.baseURL || "") || t.startsWith(a.schema.config.prefix || "") : !1;
|
|
873
872
|
}
|
|
874
873
|
)) == null ? void 0 : s.schema) || e.schema;
|
|
875
874
|
if (d) {
|
|
876
|
-
let
|
|
877
|
-
(i = d.config) != null && i.prefix &&
|
|
878
|
-
const u = d.schema[
|
|
875
|
+
let a = t;
|
|
876
|
+
(i = d.config) != null && i.prefix && a.startsWith(d.config.prefix) && (a = a.replace(d.config.prefix, ""), d.config.baseURL && (t = t.replace(d.config.prefix, d.config.baseURL))), (l = d.config) != null && l.baseURL && a.startsWith(d.config.baseURL) && (a = a.replace(d.config.baseURL, "")), a.startsWith("/") && a.charAt(1) === "@" && (a = a.substring(1));
|
|
877
|
+
const u = d.schema[a];
|
|
879
878
|
if (u) {
|
|
880
879
|
let c = n == null ? void 0 : n.headers;
|
|
881
880
|
if (u.headers && !(n != null && n.disableValidation)) {
|
|
@@ -897,12 +896,12 @@ var Xe = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
897
896
|
y[v.toLowerCase()] = x;
|
|
898
897
|
c = y;
|
|
899
898
|
}
|
|
900
|
-
let m = N(
|
|
899
|
+
let m = N(A({}, n), {
|
|
901
900
|
method: u.method,
|
|
902
901
|
output: u.output,
|
|
903
902
|
headers: c
|
|
904
903
|
});
|
|
905
|
-
return n != null && n.disableValidation || (m = N(
|
|
904
|
+
return n != null && n.disableValidation || (m = N(A({}, m), {
|
|
906
905
|
body: u.input ? await G(u.input, n == null ? void 0 : n.body) : n == null ? void 0 : n.body,
|
|
907
906
|
params: u.params ? await G(u.params, n == null ? void 0 : n.params) : n == null ? void 0 : n.params,
|
|
908
907
|
query: u.query ? await G(u.query, n == null ? void 0 : n.query) : n == null ? void 0 : n.query
|
|
@@ -919,13 +918,13 @@ var Xe = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
919
918
|
}
|
|
920
919
|
}), Hn = (e) => {
|
|
921
920
|
async function t(n, r) {
|
|
922
|
-
const s = N(
|
|
923
|
-
headers:
|
|
921
|
+
const s = N(A(A({}, e), r), {
|
|
922
|
+
headers: $e(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
|
|
924
923
|
plugins: [...(e == null ? void 0 : e.plugins) || [], Dn(e || {}), ...(r == null ? void 0 : r.plugins) || []]
|
|
925
924
|
});
|
|
926
925
|
if (e != null && e.catchAllError)
|
|
927
926
|
try {
|
|
928
|
-
return await
|
|
927
|
+
return await xe(n, s);
|
|
929
928
|
} catch (i) {
|
|
930
929
|
return {
|
|
931
930
|
data: null,
|
|
@@ -937,7 +936,7 @@ var Xe = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
937
936
|
}
|
|
938
937
|
};
|
|
939
938
|
}
|
|
940
|
-
return await
|
|
939
|
+
return await xe(n, s);
|
|
941
940
|
}
|
|
942
941
|
return t;
|
|
943
942
|
}, Wn = (e) => e === "." || e === "..";
|
|
@@ -958,11 +957,11 @@ function Gn(e, t) {
|
|
|
958
957
|
let i = e.startsWith("http") ? e.split("/").slice(0, 3).join("/") : n || "";
|
|
959
958
|
if (e.startsWith("@")) {
|
|
960
959
|
const p = e.toString().split("@")[1].split("/")[0];
|
|
961
|
-
|
|
960
|
+
Je.includes(p) && (e = e.replace(`@${p}/`, "/"));
|
|
962
961
|
}
|
|
963
962
|
i.endsWith("/") || (i += "/");
|
|
964
963
|
let [l, d] = e.replace(i, "").split("?");
|
|
965
|
-
const
|
|
964
|
+
const a = new URLSearchParams(d);
|
|
966
965
|
for (const [p, g] of Object.entries(s || {})) {
|
|
967
966
|
if (g == null) continue;
|
|
968
967
|
let y;
|
|
@@ -970,11 +969,11 @@ function Gn(e, t) {
|
|
|
970
969
|
y = g;
|
|
971
970
|
else if (Array.isArray(g)) {
|
|
972
971
|
for (const v of g)
|
|
973
|
-
|
|
972
|
+
a.append(p, v);
|
|
974
973
|
continue;
|
|
975
974
|
} else
|
|
976
975
|
y = JSON.stringify(g);
|
|
977
|
-
|
|
976
|
+
a.set(p, y);
|
|
978
977
|
}
|
|
979
978
|
const u = /* @__PURE__ */ new Map();
|
|
980
979
|
if (r)
|
|
@@ -988,18 +987,18 @@ function Gn(e, t) {
|
|
|
988
987
|
for (const [p, g] of Object.entries(r))
|
|
989
988
|
u.set(`:${p}`, String(g));
|
|
990
989
|
l = l.split("/").map((p) => $n(p, u)).join("/"), l = l.replace(/^\/+/, "");
|
|
991
|
-
let c =
|
|
990
|
+
let c = a.toString();
|
|
992
991
|
return c = c.length > 0 ? `?${c}`.replace(/\+/g, "%20") : "", i.startsWith("http") ? new URL(`${l}${c}`, i) : `${i}${l}${c}`;
|
|
993
992
|
}
|
|
994
|
-
var
|
|
995
|
-
var n, r, s, i, l, d,
|
|
993
|
+
var xe = async (e, t) => {
|
|
994
|
+
var n, r, s, i, l, d, a, u;
|
|
996
995
|
const {
|
|
997
996
|
hooks: c,
|
|
998
997
|
url: m,
|
|
999
998
|
options: p
|
|
1000
|
-
} = await On(e, t), g = Nn(p), y = new AbortController(), v = (n = p.signal) != null ? n : y.signal, x = Gn(m, p),
|
|
999
|
+
} = await On(e, t), g = Nn(p), y = new AbortController(), v = (n = p.signal) != null ? n : y.signal, x = Gn(m, p), S = await Cn(p), E = zn(p, S), O = Fn(m, p), b = N(A({}, p), {
|
|
1001
1000
|
url: x,
|
|
1002
|
-
headers:
|
|
1001
|
+
headers: S,
|
|
1003
1002
|
body: E,
|
|
1004
1003
|
method: O,
|
|
1005
1004
|
signal: v
|
|
@@ -1010,7 +1009,7 @@ var ye = async (e, t) => {
|
|
|
1010
1009
|
typeof h == "object" && h !== null && Object.assign(b, h);
|
|
1011
1010
|
}
|
|
1012
1011
|
("pipeTo" in b && typeof b.pipeTo == "function" || typeof ((r = t == null ? void 0 : t.body) == null ? void 0 : r.pipe) == "function") && ("duplex" in b || (b.duplex = "half"));
|
|
1013
|
-
const { clearTimeout: T } =
|
|
1012
|
+
const { clearTimeout: T } = Bn(p, y);
|
|
1014
1013
|
let f = await g(b.url, b);
|
|
1015
1014
|
T();
|
|
1016
1015
|
const R = {
|
|
@@ -1019,7 +1018,7 @@ var ye = async (e, t) => {
|
|
|
1019
1018
|
};
|
|
1020
1019
|
for (const P of c.onResponse)
|
|
1021
1020
|
if (P) {
|
|
1022
|
-
const h = await P(N(
|
|
1021
|
+
const h = await P(N(A({}, R), {
|
|
1023
1022
|
response: (s = t == null ? void 0 : t.hookOptions) != null && s.cloneResponse ? f.clone() : f
|
|
1024
1023
|
}));
|
|
1025
1024
|
h instanceof Response ? f = h : typeof h == "object" && h !== null && (f = h.response);
|
|
@@ -1030,14 +1029,14 @@ var ye = async (e, t) => {
|
|
|
1030
1029
|
data: "",
|
|
1031
1030
|
error: null
|
|
1032
1031
|
};
|
|
1033
|
-
const h =
|
|
1032
|
+
const h = jn(f), L = {
|
|
1034
1033
|
data: null,
|
|
1035
1034
|
response: f,
|
|
1036
1035
|
request: b
|
|
1037
1036
|
};
|
|
1038
1037
|
if (h === "json" || h === "text") {
|
|
1039
|
-
const I = await f.text(),
|
|
1040
|
-
L.data = await
|
|
1038
|
+
const I = await f.text(), Ve = (i = b.jsonParser) != null ? i : Ae;
|
|
1039
|
+
L.data = await Ve(I);
|
|
1041
1040
|
} else
|
|
1042
1041
|
L.data = await f[h]();
|
|
1043
1042
|
b != null && b.output && b.output && !b.disableValidation && (L.data = await G(
|
|
@@ -1045,7 +1044,7 @@ var ye = async (e, t) => {
|
|
|
1045
1044
|
L.data
|
|
1046
1045
|
));
|
|
1047
1046
|
for (const I of c.onSuccess)
|
|
1048
|
-
I && await I(N(
|
|
1047
|
+
I && await I(N(A({}, L), {
|
|
1049
1048
|
response: (l = t == null ? void 0 : t.hookOptions) != null && l.cloneResponse ? f.clone() : f
|
|
1050
1049
|
}));
|
|
1051
1050
|
return t != null && t.throw ? L.data : {
|
|
@@ -1053,18 +1052,18 @@ var ye = async (e, t) => {
|
|
|
1053
1052
|
error: null
|
|
1054
1053
|
};
|
|
1055
1054
|
}
|
|
1056
|
-
const
|
|
1055
|
+
const U = (d = t == null ? void 0 : t.jsonParser) != null ? d : Ae, C = await f.text(), H = Un(C), M = H ? await U(C) : null, K = {
|
|
1057
1056
|
response: f,
|
|
1058
1057
|
responseText: C,
|
|
1059
1058
|
request: b,
|
|
1060
|
-
error: N(
|
|
1059
|
+
error: N(A({}, M), {
|
|
1061
1060
|
status: f.status,
|
|
1062
1061
|
statusText: f.statusText
|
|
1063
1062
|
})
|
|
1064
1063
|
};
|
|
1065
1064
|
for (const P of c.onError)
|
|
1066
|
-
P && await P(N(
|
|
1067
|
-
response: (
|
|
1065
|
+
P && await P(N(A({}, K), {
|
|
1066
|
+
response: (a = t == null ? void 0 : t.hookOptions) != null && a.cloneResponse ? f.clone() : f
|
|
1068
1067
|
}));
|
|
1069
1068
|
if (t != null && t.retry) {
|
|
1070
1069
|
const P = Pn(t.retry), h = (u = t.retryAttempt) != null ? u : 0;
|
|
@@ -1072,7 +1071,7 @@ var ye = async (e, t) => {
|
|
|
1072
1071
|
for (const I of c.onRetry)
|
|
1073
1072
|
I && await I(R);
|
|
1074
1073
|
const L = P.getDelay(h);
|
|
1075
|
-
return await new Promise((I) => setTimeout(I, L)), await
|
|
1074
|
+
return await new Promise((I) => setTimeout(I, L)), await xe(e, N(A({}, t), {
|
|
1076
1075
|
retryAttempt: h + 1
|
|
1077
1076
|
}));
|
|
1078
1077
|
}
|
|
@@ -1085,13 +1084,13 @@ var ye = async (e, t) => {
|
|
|
1085
1084
|
);
|
|
1086
1085
|
return {
|
|
1087
1086
|
data: null,
|
|
1088
|
-
error: N(
|
|
1087
|
+
error: N(A({}, M), {
|
|
1089
1088
|
status: f.status,
|
|
1090
1089
|
statusText: f.statusText
|
|
1091
1090
|
})
|
|
1092
1091
|
};
|
|
1093
1092
|
};
|
|
1094
|
-
const
|
|
1093
|
+
const Jn = (e) => {
|
|
1095
1094
|
if (typeof process > "u") return;
|
|
1096
1095
|
const t = e ?? "/api/auth";
|
|
1097
1096
|
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
@@ -1106,23 +1105,23 @@ const Vn = (e) => {
|
|
|
1106
1105
|
} catch {
|
|
1107
1106
|
}
|
|
1108
1107
|
}
|
|
1109
|
-
},
|
|
1110
|
-
var R,
|
|
1111
|
-
const n = "credentials" in Request.prototype, r =
|
|
1108
|
+
}, Vn = (e, t) => {
|
|
1109
|
+
var R, U, C, H, M, K, P;
|
|
1110
|
+
const n = "credentials" in Request.prototype, r = Bt(e == null ? void 0 : e.baseURL, e == null ? void 0 : e.basePath) ?? Jn(e == null ? void 0 : e.basePath) ?? "/api/auth", s = ((R = e == null ? void 0 : e.plugins) == null ? void 0 : R.flatMap((h) => h.fetchPlugins).filter((h) => h !== void 0)) || [], i = {
|
|
1112
1111
|
id: "lifecycle-hooks",
|
|
1113
1112
|
name: "lifecycle-hooks",
|
|
1114
1113
|
hooks: {
|
|
1115
|
-
onSuccess: (
|
|
1114
|
+
onSuccess: (U = e == null ? void 0 : e.fetchOptions) == null ? void 0 : U.onSuccess,
|
|
1116
1115
|
onError: (C = e == null ? void 0 : e.fetchOptions) == null ? void 0 : C.onError,
|
|
1117
1116
|
onRequest: (H = e == null ? void 0 : e.fetchOptions) == null ? void 0 : H.onRequest,
|
|
1118
1117
|
onResponse: (M = e == null ? void 0 : e.fetchOptions) == null ? void 0 : M.onResponse
|
|
1119
1118
|
}
|
|
1120
|
-
}, { onSuccess: l, onError: d, onRequest:
|
|
1119
|
+
}, { onSuccess: l, onError: d, onRequest: a, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {}, m = Hn({
|
|
1121
1120
|
baseURL: r,
|
|
1122
1121
|
...n ? { credentials: "include" } : {},
|
|
1123
1122
|
method: "GET",
|
|
1124
1123
|
jsonParser(h) {
|
|
1125
|
-
return h ?
|
|
1124
|
+
return h ? Jt(h, { strict: !1 }) : null;
|
|
1126
1125
|
},
|
|
1127
1126
|
customFetchImpl: fetch,
|
|
1128
1127
|
...c,
|
|
@@ -1136,7 +1135,7 @@ const Vn = (e) => {
|
|
|
1136
1135
|
let v = !1;
|
|
1137
1136
|
const x = (h) => {
|
|
1138
1137
|
v || h === null || (v = !0, gn(g, h));
|
|
1139
|
-
},
|
|
1138
|
+
}, S = (e == null ? void 0 : e.plugins) || [];
|
|
1140
1139
|
let E = {};
|
|
1141
1140
|
const O = {
|
|
1142
1141
|
$sessionSignal: p,
|
|
@@ -1155,8 +1154,8 @@ const Vn = (e) => {
|
|
|
1155
1154
|
h === "/sign-out" ? y("signout") : (h === "/update-user" || h === "/update-session") && y("updateUser");
|
|
1156
1155
|
}
|
|
1157
1156
|
}];
|
|
1158
|
-
for (const h of
|
|
1159
|
-
h.getAtoms && Object.assign(O, (
|
|
1157
|
+
for (const h of S)
|
|
1158
|
+
h.getAtoms && Object.assign(O, (K = h.getAtoms) == null ? void 0 : K.call(h, m)), h.pathMethods && Object.assign(b, h.pathMethods), h.atomListeners && T.push(...h.atomListeners);
|
|
1160
1159
|
const f = {
|
|
1161
1160
|
notify: (h) => {
|
|
1162
1161
|
O[h].set(!O[h].get());
|
|
@@ -1166,7 +1165,7 @@ const Vn = (e) => {
|
|
|
1166
1165
|
},
|
|
1167
1166
|
atoms: O
|
|
1168
1167
|
};
|
|
1169
|
-
for (const h of
|
|
1168
|
+
for (const h of S) h.getActions && (E = bn(((P = h.getActions) == null ? void 0 : P.call(h, m, f, e)) ?? {}, E));
|
|
1170
1169
|
return {
|
|
1171
1170
|
get baseURL() {
|
|
1172
1171
|
return r;
|
|
@@ -1202,9 +1201,9 @@ function nr(e, t, n, r, s) {
|
|
|
1202
1201
|
function i(l = []) {
|
|
1203
1202
|
return new Proxy(function() {
|
|
1204
1203
|
}, {
|
|
1205
|
-
get(d,
|
|
1206
|
-
if (typeof
|
|
1207
|
-
const u = [...l,
|
|
1204
|
+
get(d, a) {
|
|
1205
|
+
if (typeof a != "string" || a === "then" || a === "catch" || a === "finally") return;
|
|
1206
|
+
const u = [...l, a];
|
|
1208
1207
|
let c = e;
|
|
1209
1208
|
for (const m of u) if (c && typeof c == "object" && m in c) c = c[m];
|
|
1210
1209
|
else {
|
|
@@ -1213,19 +1212,19 @@ function nr(e, t, n, r, s) {
|
|
|
1213
1212
|
}
|
|
1214
1213
|
return typeof c == "function" || Kn(c) ? c : i(u);
|
|
1215
1214
|
},
|
|
1216
|
-
apply: async (d,
|
|
1215
|
+
apply: async (d, a, u) => {
|
|
1217
1216
|
const c = "/" + l.map(er).join("/"), m = u[0] || {}, p = u[1] || {}, { query: g, fetchOptions: y, ...v } = m, x = {
|
|
1218
1217
|
...p,
|
|
1219
1218
|
...y
|
|
1220
|
-
},
|
|
1219
|
+
}, S = tr(c, n, m);
|
|
1221
1220
|
return await t(c, {
|
|
1222
1221
|
...x,
|
|
1223
|
-
body:
|
|
1222
|
+
body: S === "GET" ? void 0 : {
|
|
1224
1223
|
...v,
|
|
1225
1224
|
...(x == null ? void 0 : x.body) || {}
|
|
1226
1225
|
},
|
|
1227
1226
|
query: g || (x == null ? void 0 : x.query),
|
|
1228
|
-
method:
|
|
1227
|
+
method: S,
|
|
1229
1228
|
async onSuccess(E) {
|
|
1230
1229
|
var T, f;
|
|
1231
1230
|
if (await ((T = x == null ? void 0 : x.onSuccess) == null ? void 0 : T.call(x, E)), !s || x.disableSignal) return;
|
|
@@ -1233,13 +1232,13 @@ function nr(e, t, n, r, s) {
|
|
|
1233
1232
|
if (!O.length) return;
|
|
1234
1233
|
const b = /* @__PURE__ */ new Set();
|
|
1235
1234
|
for (const R of O) {
|
|
1236
|
-
const
|
|
1237
|
-
if (!
|
|
1235
|
+
const U = r[R.signal];
|
|
1236
|
+
if (!U) return;
|
|
1238
1237
|
if (b.has(R.signal)) continue;
|
|
1239
1238
|
b.add(R.signal);
|
|
1240
|
-
const C =
|
|
1239
|
+
const C = U.get();
|
|
1241
1240
|
setTimeout(() => {
|
|
1242
|
-
|
|
1241
|
+
U.set(!C);
|
|
1243
1242
|
}, 10), (f = R.callback) == null || f.call(R, c);
|
|
1244
1243
|
}
|
|
1245
1244
|
}
|
|
@@ -1250,51 +1249,51 @@ function nr(e, t, n, r, s) {
|
|
|
1250
1249
|
return i();
|
|
1251
1250
|
}
|
|
1252
1251
|
function rr(e, t = {}) {
|
|
1253
|
-
const n =
|
|
1254
|
-
const
|
|
1252
|
+
const n = Ye(e.get()), { keys: r, deps: s = [e, r] } = t, i = Qe((d) => {
|
|
1253
|
+
const a = (u) => {
|
|
1255
1254
|
n.current !== u && (n.current = u, d());
|
|
1256
1255
|
};
|
|
1257
|
-
return
|
|
1256
|
+
return a(e.value), r != null && r.length ? sn(e, r, a) : e.listen(a);
|
|
1258
1257
|
}, s), l = () => n.current;
|
|
1259
|
-
return
|
|
1258
|
+
return Ze(i, l, l);
|
|
1260
1259
|
}
|
|
1261
1260
|
function sr(e) {
|
|
1262
1261
|
return `use${Xn(e)}`;
|
|
1263
1262
|
}
|
|
1264
1263
|
function ir(e) {
|
|
1265
|
-
const { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, hydrateSession: s, $fetch: i, $store: l, atomListeners: d } =
|
|
1266
|
-
for (const [u, c] of Object.entries(r))
|
|
1264
|
+
const { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, hydrateSession: s, $fetch: i, $store: l, atomListeners: d } = Vn(e), a = {};
|
|
1265
|
+
for (const [u, c] of Object.entries(r)) a[sr(u)] = () => rr(c);
|
|
1267
1266
|
return nr({
|
|
1268
1267
|
...n,
|
|
1269
|
-
...
|
|
1268
|
+
...a,
|
|
1270
1269
|
hydrateSession: s,
|
|
1271
1270
|
$fetch: i,
|
|
1272
1271
|
$store: l
|
|
1273
1272
|
}, i, t, r, d);
|
|
1274
1273
|
}
|
|
1275
|
-
var
|
|
1276
|
-
const
|
|
1274
|
+
var ar = "1.7.3";
|
|
1275
|
+
const or = ar, lr = () => ({
|
|
1277
1276
|
id: "magic-link",
|
|
1278
|
-
version:
|
|
1277
|
+
version: or,
|
|
1279
1278
|
$InferServerPlugin: {}
|
|
1280
1279
|
});
|
|
1281
|
-
let
|
|
1282
|
-
function
|
|
1283
|
-
return
|
|
1284
|
-
baseURL:
|
|
1280
|
+
let Ue = null;
|
|
1281
|
+
function B() {
|
|
1282
|
+
return Ue ?? (Ue = ir({
|
|
1283
|
+
baseURL: nt(),
|
|
1285
1284
|
plugins: [lr()]
|
|
1286
|
-
})),
|
|
1285
|
+
})), Ue;
|
|
1287
1286
|
}
|
|
1288
1287
|
function cr() {
|
|
1289
|
-
const [e] =
|
|
1290
|
-
|
|
1291
|
-
|
|
1288
|
+
const [e] = ye(), [t, n] = w(null), [r, s] = w(null), [i, l] = w(!1), [d, a] = w(null), u = e.get("token") ? e.get("email") ?? "" : "", [c, m] = w(u || (e.get("email") ?? "")), [p, g] = w(""), [y, v] = w(""), [x, S] = w("signin");
|
|
1289
|
+
V(() => {
|
|
1290
|
+
rt().then((f) => a(f.github)).catch(() => a(!1));
|
|
1292
1291
|
}, []);
|
|
1293
1292
|
const E = window.location.href;
|
|
1294
1293
|
async function O() {
|
|
1295
1294
|
l(!0), n(null);
|
|
1296
1295
|
try {
|
|
1297
|
-
await
|
|
1296
|
+
await B().signIn.social({
|
|
1298
1297
|
provider: "github",
|
|
1299
1298
|
callbackURL: E
|
|
1300
1299
|
});
|
|
@@ -1304,7 +1303,7 @@ function cr() {
|
|
|
1304
1303
|
}
|
|
1305
1304
|
async function b() {
|
|
1306
1305
|
l(!0), n(null), s(null);
|
|
1307
|
-
const f = await
|
|
1306
|
+
const f = await B().signIn.magicLink({
|
|
1308
1307
|
email: c,
|
|
1309
1308
|
callbackURL: E
|
|
1310
1309
|
});
|
|
@@ -1316,12 +1315,12 @@ function cr() {
|
|
|
1316
1315
|
}
|
|
1317
1316
|
async function T(f) {
|
|
1318
1317
|
f.preventDefault(), l(!0), n(null);
|
|
1319
|
-
const R = x === "signup" ? await
|
|
1318
|
+
const R = x === "signup" ? await B().signUp.email({
|
|
1320
1319
|
email: c,
|
|
1321
1320
|
password: p,
|
|
1322
1321
|
name: y,
|
|
1323
1322
|
callbackURL: E
|
|
1324
|
-
}) : await
|
|
1323
|
+
}) : await B().signIn.email({
|
|
1325
1324
|
email: c,
|
|
1326
1325
|
password: p,
|
|
1327
1326
|
callbackURL: E
|
|
@@ -1332,18 +1331,18 @@ function cr() {
|
|
|
1332
1331
|
}
|
|
1333
1332
|
window.location.assign(E);
|
|
1334
1333
|
}
|
|
1335
|
-
return /* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
/* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
t ? /* @__PURE__ */
|
|
1343
|
-
r ? /* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
x === "signup" ? /* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1334
|
+
return /* @__PURE__ */ k("main", { ...it(at, dr.main), children: [
|
|
1335
|
+
/* @__PURE__ */ o("div", { className: "x10l6tqk x10a8y8t x47corl x87ps6o xlxt4rd", "aria-hidden": !0 }),
|
|
1336
|
+
/* @__PURE__ */ k("div", { className: "x1n2onr6 x78zum5 xh8yej3 xxc7z9f xdt5ytf x6s0dn4 x2b8uid", children: [
|
|
1337
|
+
/* @__PURE__ */ o("div", { className: "xrvj5dj x1ku5rj1 x1useyqa xsdox4t x1y5o9j5 x1n0nidx", children: /* @__PURE__ */ o(ur, {}) }),
|
|
1338
|
+
/* @__PURE__ */ o("h1", { className: "x1ghz6dp xqjzbou xneq65o x1s688f x1b4dsll x1u7k74 x1w2vvpw", children: u ? "Join this workspace" : "Welcome back" }),
|
|
1339
|
+
/* @__PURE__ */ o("div", { className: "x1g7u8ds", children: /* @__PURE__ */ o(_, { tone: "muted", children: u ? `Sign in as ${u}. A password or GitHub stays on this page. A magic link sends one more email.` : "Sign in with email or GitHub." }) }),
|
|
1340
|
+
/* @__PURE__ */ k("div", { className: "x78zum5 xh8yej3 x1tfhste xdt5ytf x6s0dn4 x11cgr9k", children: [
|
|
1341
|
+
t ? /* @__PURE__ */ o(_, { tone: "danger", children: t }) : null,
|
|
1342
|
+
r ? /* @__PURE__ */ o(_, { tone: "muted", children: r }) : null,
|
|
1343
|
+
/* @__PURE__ */ k("form", { onSubmit: (f) => void T(f), className: "x78zum5 xh8yej3 xdt5ytf x1ndbd79", children: [
|
|
1344
|
+
x === "signup" ? /* @__PURE__ */ o("input", { required: !0, value: y, onChange: (f) => v(f.target.value), placeholder: "Name", autoComplete: "name", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }) : null,
|
|
1345
|
+
/* @__PURE__ */ o("input", { required: !0, type: "email", value: c, onChange: (f) => m(f.target.value), placeholder: "Email", autoComplete: "email", readOnly: !!u, ...{
|
|
1347
1346
|
0: {
|
|
1348
1347
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d"
|
|
1349
1348
|
},
|
|
@@ -1351,8 +1350,8 @@ function cr() {
|
|
|
1351
1350
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x1l3a84d x10jjolp"
|
|
1352
1351
|
}
|
|
1353
1352
|
}[!!u << 0] }),
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ o("input", { required: !0, type: "password", value: p, onChange: (f) => g(f.target.value), placeholder: "Password", autoComplete: x === "signup" ? "new-password" : "current-password", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }),
|
|
1354
|
+
/* @__PURE__ */ o("button", { type: "submit", disabled: i, ...{
|
|
1356
1355
|
0: {
|
|
1357
1356
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1358
1357
|
},
|
|
@@ -1361,7 +1360,7 @@ function cr() {
|
|
|
1361
1360
|
}
|
|
1362
1361
|
}[!!i << 0], children: x === "signup" ? "Create account" : "Sign in" })
|
|
1363
1362
|
] }),
|
|
1364
|
-
/* @__PURE__ */
|
|
1363
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i || !c, onClick: () => void b(), ...{
|
|
1365
1364
|
0: {
|
|
1366
1365
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk"
|
|
1367
1366
|
},
|
|
@@ -1369,8 +1368,8 @@ function cr() {
|
|
|
1369
1368
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 xwq05k6 x1h6gzvc x47corl"
|
|
1370
1369
|
}
|
|
1371
1370
|
}[!!(i || !c) << 0], children: "Email me a magic link" }),
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i, onClick: () => S(x === "signup" ? "signin" : "signup"), className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk", children: x === "signup" ? "I already have an account" : "Create an account" }),
|
|
1372
|
+
/* @__PURE__ */ k("button", { type: "button", disabled: i || d !== !0, onClick: () => void O(), ...{
|
|
1374
1373
|
0: {
|
|
1375
1374
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1376
1375
|
},
|
|
@@ -1378,7 +1377,7 @@ function cr() {
|
|
|
1378
1377
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig xwq05k6 x1h6gzvc x47corl"
|
|
1379
1378
|
}
|
|
1380
1379
|
}[!!(i || d !== !0) << 0], children: [
|
|
1381
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ o(st, { size: 18 }),
|
|
1382
1381
|
"Continue with GitHub"
|
|
1383
1382
|
] })
|
|
1384
1383
|
] })
|
|
@@ -1386,10 +1385,10 @@ function cr() {
|
|
|
1386
1385
|
] });
|
|
1387
1386
|
}
|
|
1388
1387
|
function ur() {
|
|
1389
|
-
return /* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */
|
|
1391
|
-
/* @__PURE__ */
|
|
1392
|
-
/* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ k("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
|
|
1389
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "18.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.28" }),
|
|
1390
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "11.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.55" }),
|
|
1391
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "4", fill: "currentColor" })
|
|
1393
1392
|
] });
|
|
1394
1393
|
}
|
|
1395
1394
|
const dr = {
|
|
@@ -1411,8 +1410,8 @@ const dr = {
|
|
|
1411
1410
|
};
|
|
1412
1411
|
function fr() {
|
|
1413
1412
|
var s;
|
|
1414
|
-
const { userId: e } =
|
|
1415
|
-
return r === "/workspaces" && n &&
|
|
1413
|
+
const { userId: e } = Ne(), t = Ce(), n = Ie(e), r = ot(n, ((s = t.control) == null ? void 0 : s.workspaces) ?? []);
|
|
1414
|
+
return r === "/workspaces" && n && lt(e), /* @__PURE__ */ o(qe, { to: r, replace: !0 });
|
|
1416
1415
|
}
|
|
1417
1416
|
function hr({
|
|
1418
1417
|
to: e,
|
|
@@ -1420,32 +1419,32 @@ function hr({
|
|
|
1420
1419
|
meta: n,
|
|
1421
1420
|
trailing: r
|
|
1422
1421
|
}) {
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
n ? /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ k(ct, { to: e, className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb", children: [
|
|
1423
|
+
/* @__PURE__ */ k("span", { className: "x78zum5 xeuugli xdt5ytf x195vfkc", children: [
|
|
1424
|
+
/* @__PURE__ */ o("span", { className: "x17tv04q xk50ysn", children: t }),
|
|
1425
|
+
n ? /* @__PURE__ */ o("span", { className: "x1vrk1b5 x111yfic", children: n }) : null
|
|
1427
1426
|
] }),
|
|
1428
|
-
r ? /* @__PURE__ */
|
|
1427
|
+
r ? /* @__PURE__ */ o("span", { className: "x2lah0s x1vrk1b5 x111yfic", children: r }) : null
|
|
1429
1428
|
] });
|
|
1430
1429
|
}
|
|
1431
1430
|
function pr({
|
|
1432
1431
|
children: e
|
|
1433
1432
|
}) {
|
|
1434
|
-
return /* @__PURE__ */
|
|
1433
|
+
return /* @__PURE__ */ o("div", { className: "x78zum5 xdt5ytf xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xb3r6kr", children: e });
|
|
1435
1434
|
}
|
|
1436
1435
|
function gr() {
|
|
1437
1436
|
var t;
|
|
1438
|
-
const e = ((t =
|
|
1439
|
-
return /* @__PURE__ */
|
|
1440
|
-
/* @__PURE__ */
|
|
1441
|
-
|
|
1437
|
+
const e = ((t = Ce().control) == null ? void 0 : t.workspaces) ?? [];
|
|
1438
|
+
return /* @__PURE__ */ k(ie, { centered: !0, children: [
|
|
1439
|
+
/* @__PURE__ */ o(
|
|
1440
|
+
J,
|
|
1442
1441
|
{
|
|
1443
1442
|
title: "Workspaces",
|
|
1444
1443
|
description: "Each workspace is a site and a team.",
|
|
1445
|
-
action: /* @__PURE__ */
|
|
1444
|
+
action: /* @__PURE__ */ o(ze, { to: "/workspaces/new", children: "New workspace" })
|
|
1446
1445
|
}
|
|
1447
1446
|
),
|
|
1448
|
-
e.length === 0 ? /* @__PURE__ */
|
|
1447
|
+
e.length === 0 ? /* @__PURE__ */ o(_, { tone: "muted", children: "No workspaces yet." }) : /* @__PURE__ */ o(pr, { children: e.map((n) => /* @__PURE__ */ o(
|
|
1449
1448
|
hr,
|
|
1450
1449
|
{
|
|
1451
1450
|
to: ut(n.slug),
|
|
@@ -1457,12 +1456,12 @@ function gr() {
|
|
|
1457
1456
|
] });
|
|
1458
1457
|
}
|
|
1459
1458
|
function mr() {
|
|
1460
|
-
const e =
|
|
1461
|
-
async function d(
|
|
1462
|
-
|
|
1459
|
+
const e = Fe(), [t, n] = w(""), [r, s] = w(null), [i, l] = w(!1);
|
|
1460
|
+
async function d(a) {
|
|
1461
|
+
a.preventDefault(), l(!0), s(null);
|
|
1463
1462
|
try {
|
|
1464
|
-
const { workspace: u } = await
|
|
1465
|
-
c &&
|
|
1463
|
+
const { workspace: u } = await ft(t), c = z.getState().control;
|
|
1464
|
+
c && z.applyControl({
|
|
1466
1465
|
...c,
|
|
1467
1466
|
workspaces: [
|
|
1468
1467
|
...c.workspaces,
|
|
@@ -1480,26 +1479,26 @@ function mr() {
|
|
|
1480
1479
|
l(!1);
|
|
1481
1480
|
}
|
|
1482
1481
|
}
|
|
1483
|
-
return /* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
|
|
1482
|
+
return /* @__PURE__ */ k(ie, { children: [
|
|
1483
|
+
/* @__PURE__ */ o(
|
|
1484
|
+
J,
|
|
1486
1485
|
{
|
|
1487
|
-
kicker: /* @__PURE__ */
|
|
1486
|
+
kicker: /* @__PURE__ */ o(dt, { to: "/workspaces", children: "← Workspaces" }),
|
|
1488
1487
|
title: "Create workspace"
|
|
1489
1488
|
}
|
|
1490
1489
|
),
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
|
|
1490
|
+
/* @__PURE__ */ o("form", { onSubmit: d, children: /* @__PURE__ */ k(re, { children: [
|
|
1491
|
+
/* @__PURE__ */ o(Q, { label: "Name", children: /* @__PURE__ */ o(
|
|
1492
|
+
Z,
|
|
1494
1493
|
{
|
|
1495
1494
|
required: !0,
|
|
1496
1495
|
value: t,
|
|
1497
|
-
onChange: (
|
|
1496
|
+
onChange: (a) => n(a.target.value),
|
|
1498
1497
|
placeholder: "Docs site"
|
|
1499
1498
|
}
|
|
1500
1499
|
) }),
|
|
1501
|
-
r ? /* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1500
|
+
r ? /* @__PURE__ */ o(_, { tone: "danger", children: r }) : null,
|
|
1501
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "submit", disabled: i, children: i ? "Creating…" : "Create workspace" }) })
|
|
1503
1502
|
] }) })
|
|
1504
1503
|
] });
|
|
1505
1504
|
}
|
|
@@ -1520,20 +1519,20 @@ function xr(e, t) {
|
|
|
1520
1519
|
}
|
|
1521
1520
|
}
|
|
1522
1521
|
function yr() {
|
|
1523
|
-
const [e] =
|
|
1524
|
-
|
|
1522
|
+
const [e] = ye(), t = Fe(), n = e.get("token") ?? "", r = e.get("email") ?? "", [s, i] = w(null), [l, d] = w(null), [a, u] = w(!1);
|
|
1523
|
+
V(() => {
|
|
1525
1524
|
if (!n) {
|
|
1526
1525
|
i("This invite link is missing a token.");
|
|
1527
1526
|
return;
|
|
1528
1527
|
}
|
|
1529
1528
|
let m = !1;
|
|
1530
|
-
return
|
|
1529
|
+
return ht(n).then((p) => {
|
|
1531
1530
|
m || t(`/${p.slug}`, { replace: !0 });
|
|
1532
1531
|
}).catch(async (p) => {
|
|
1533
1532
|
if (m) return;
|
|
1534
1533
|
const g = p && typeof p == "object" && "code" in p ? p.code : void 0;
|
|
1535
1534
|
if (g === "invite_email_mismatch" || g === "unauthorized") {
|
|
1536
|
-
const v = await
|
|
1535
|
+
const v = await ve().catch(() => null);
|
|
1537
1536
|
if (m) return;
|
|
1538
1537
|
d((v == null ? void 0 : v.user.email) ?? null), u(!0);
|
|
1539
1538
|
return;
|
|
@@ -1545,48 +1544,48 @@ function yr() {
|
|
|
1545
1544
|
};
|
|
1546
1545
|
}, [t, n]);
|
|
1547
1546
|
async function c() {
|
|
1548
|
-
await
|
|
1549
|
-
}),
|
|
1547
|
+
await B().signOut().catch(() => {
|
|
1548
|
+
}), ee(), z.wipe(), window.location.assign(window.location.href);
|
|
1550
1549
|
}
|
|
1551
|
-
return /* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
] }) : s ? /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ k(ie, { centered: !0, children: [
|
|
1551
|
+
/* @__PURE__ */ o(J, { title: "Accept invite" }),
|
|
1552
|
+
a ? /* @__PURE__ */ k(re, { children: [
|
|
1553
|
+
/* @__PURE__ */ o(_, { children: l ? `You're signed in as ${l}. This invite is for ${r || "someone else"}.` : `Sign in as ${r || "the invited email"} to join.` }),
|
|
1554
|
+
/* @__PURE__ */ o(_, { size: "sm", tone: "muted", children: "Password and GitHub stay on the next screen. A magic link sends one more email to that address." }),
|
|
1555
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "button", variant: "secondary", onClick: () => void c(), children: r ? `Sign in as ${r}` : "Sign in to continue" }) })
|
|
1556
|
+
] }) : s ? /* @__PURE__ */ o(_, { tone: "danger", children: s }) : /* @__PURE__ */ o(_, { tone: "muted", children: "Joining workspace…" })
|
|
1558
1557
|
] });
|
|
1559
1558
|
}
|
|
1560
1559
|
function vr() {
|
|
1561
|
-
const { email: e, userId: t } =
|
|
1562
|
-
|
|
1563
|
-
|
|
1560
|
+
const { email: e, userId: t } = Ne(), [n, r] = w(""), [s, i] = w(null), [l, d] = w(null), [a, u] = w(!1);
|
|
1561
|
+
V(() => {
|
|
1562
|
+
ve().then((m) => {
|
|
1564
1563
|
m != null && m.user.name && r(m.user.name);
|
|
1565
1564
|
});
|
|
1566
1565
|
}, []);
|
|
1567
1566
|
async function c(m) {
|
|
1568
1567
|
m.preventDefault(), u(!0), d(null), i(null);
|
|
1569
|
-
const p = await
|
|
1568
|
+
const p = await B().updateUser({ name: n });
|
|
1570
1569
|
if (u(!1), p.error) {
|
|
1571
1570
|
d(p.error.message ?? "Could not save name");
|
|
1572
1571
|
return;
|
|
1573
1572
|
}
|
|
1574
1573
|
i("Name saved. New publishes will use it.");
|
|
1575
1574
|
}
|
|
1576
|
-
return /* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
|
|
1575
|
+
return /* @__PURE__ */ k(ie, { children: [
|
|
1576
|
+
/* @__PURE__ */ o(
|
|
1577
|
+
J,
|
|
1579
1578
|
{
|
|
1580
1579
|
title: "User settings",
|
|
1581
1580
|
description: "Your account on this Backmatter instance."
|
|
1582
1581
|
}
|
|
1583
1582
|
),
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
|
|
1583
|
+
/* @__PURE__ */ k(re, { gap: "lg", children: [
|
|
1584
|
+
/* @__PURE__ */ o(pt, { children: /* @__PURE__ */ o("form", { onSubmit: (m) => void c(m), children: /* @__PURE__ */ k(re, { children: [
|
|
1585
|
+
/* @__PURE__ */ o(_, { as: "h2", size: "lg", weight: "medium", children: "Account" }),
|
|
1586
|
+
/* @__PURE__ */ o(Q, { label: "Name", children: /* @__PURE__ */ o(Z, { value: n, onChange: (m) => r(m.target.value), autoComplete: "name" }) }),
|
|
1587
|
+
/* @__PURE__ */ o(Q, { label: "Email", children: /* @__PURE__ */ o(
|
|
1588
|
+
Z,
|
|
1590
1589
|
{
|
|
1591
1590
|
type: "email",
|
|
1592
1591
|
value: e,
|
|
@@ -1595,8 +1594,8 @@ function vr() {
|
|
|
1595
1594
|
spellCheck: !1
|
|
1596
1595
|
}
|
|
1597
1596
|
) }),
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
|
|
1597
|
+
/* @__PURE__ */ o(Q, { label: "User ID", hint: "Stable id for this account.", children: /* @__PURE__ */ o(
|
|
1598
|
+
Z,
|
|
1600
1599
|
{
|
|
1601
1600
|
value: t,
|
|
1602
1601
|
readOnly: !0,
|
|
@@ -1604,44 +1603,43 @@ function vr() {
|
|
|
1604
1603
|
spellCheck: !1
|
|
1605
1604
|
}
|
|
1606
1605
|
) }),
|
|
1607
|
-
l ? /* @__PURE__ */
|
|
1608
|
-
s ? /* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
1606
|
+
l ? /* @__PURE__ */ o(_, { tone: "danger", children: l }) : null,
|
|
1607
|
+
s ? /* @__PURE__ */ o(_, { tone: "muted", children: s }) : null,
|
|
1608
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "submit", disabled: a, children: a ? "Saving…" : "Save name" }) })
|
|
1610
1609
|
] }) }) }),
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1613
|
-
|
|
1610
|
+
/* @__PURE__ */ k("div", { children: [
|
|
1611
|
+
/* @__PURE__ */ o(
|
|
1612
|
+
J,
|
|
1614
1613
|
{
|
|
1615
1614
|
title: "Connectors",
|
|
1616
1615
|
description: "Personal MCP servers that follow you across workspaces.",
|
|
1617
1616
|
compact: !0
|
|
1618
1617
|
}
|
|
1619
1618
|
),
|
|
1620
|
-
/* @__PURE__ */
|
|
1619
|
+
/* @__PURE__ */ o(gt, { scope: "user", canEdit: !0 })
|
|
1621
1620
|
] })
|
|
1622
1621
|
] })
|
|
1623
1622
|
] });
|
|
1624
1623
|
}
|
|
1625
|
-
function br(
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
] });
|
|
1624
|
+
function br({
|
|
1625
|
+
email: e
|
|
1626
|
+
}) {
|
|
1627
|
+
const [t] = ye(), n = t.get("id") ?? "", [r, s] = w("idle"), [i, l] = w(null);
|
|
1628
|
+
return /* @__PURE__ */ o("main", { className: "x78zum5 x9f619 xh8yej3 x1ov3xa9 x6s0dn4 xl56j7k x1y5dg2c x86kjsi xqjzbou", children: /* @__PURE__ */ k("div", { className: "x78zum5 xh8yej3 x1va8c73 xdt5ytf x1cy8zhl x11cgr9k x9f619 xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb x1y5dg2c x1vrk1b5", children: [
|
|
1629
|
+
/* @__PURE__ */ o(_, { as: "h1", size: "xl", weight: "medium", children: "Allow the CLI" }),
|
|
1630
|
+
/* @__PURE__ */ k(_, { tone: "muted", children: [
|
|
1631
|
+
"This signs the CLI in as ",
|
|
1632
|
+
e,
|
|
1633
|
+
". It can act in any workspace you belong to. It does not pick one."
|
|
1634
|
+
] }),
|
|
1635
|
+
r === "done" ? /* @__PURE__ */ o(_, { children: "You can return to the terminal." }) : null,
|
|
1636
|
+
i ? /* @__PURE__ */ o(_, { tone: "danger", children: i }) : null,
|
|
1637
|
+
r === "done" ? null : /* @__PURE__ */ o(ae, { disabled: !n, onClick: () => {
|
|
1638
|
+
l(null), mt(n).then(() => s("done")).catch((d) => {
|
|
1639
|
+
s("error"), l(d instanceof Error ? d.message : "Could not approve");
|
|
1640
|
+
});
|
|
1641
|
+
}, children: "Allow" })
|
|
1642
|
+
] }) });
|
|
1645
1643
|
}
|
|
1646
1644
|
function wr({
|
|
1647
1645
|
userId: e
|
|
@@ -1649,8 +1647,8 @@ function wr({
|
|
|
1649
1647
|
const [t, n] = w({
|
|
1650
1648
|
kind: "working"
|
|
1651
1649
|
});
|
|
1652
|
-
return
|
|
1653
|
-
const r =
|
|
1650
|
+
return V(() => {
|
|
1651
|
+
const r = xt(window.location.search);
|
|
1654
1652
|
if (!r) {
|
|
1655
1653
|
n({
|
|
1656
1654
|
kind: "error",
|
|
@@ -1663,7 +1661,7 @@ function wr({
|
|
|
1663
1661
|
try {
|
|
1664
1662
|
const {
|
|
1665
1663
|
workspace: i
|
|
1666
|
-
} = await
|
|
1664
|
+
} = await yt(r.workspaceId), l = vt(r.returnUrl, i.siteUrls);
|
|
1667
1665
|
if (!l) {
|
|
1668
1666
|
n({
|
|
1669
1667
|
kind: "error",
|
|
@@ -1673,12 +1671,12 @@ function wr({
|
|
|
1673
1671
|
}
|
|
1674
1672
|
const {
|
|
1675
1673
|
ticket: d
|
|
1676
|
-
} = await
|
|
1674
|
+
} = await bt(i.id, {
|
|
1677
1675
|
redirect: l.redirect,
|
|
1678
1676
|
tree: e
|
|
1679
1677
|
});
|
|
1680
1678
|
if (s) return;
|
|
1681
|
-
window.location.replace(
|
|
1679
|
+
window.location.replace(wt(l.origin, d));
|
|
1682
1680
|
} catch (i) {
|
|
1683
1681
|
if (s) return;
|
|
1684
1682
|
n({
|
|
@@ -1689,71 +1687,71 @@ function wr({
|
|
|
1689
1687
|
})(), () => {
|
|
1690
1688
|
s = !0;
|
|
1691
1689
|
};
|
|
1692
|
-
}, [e]), /* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
] }) : /* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1690
|
+
}, [e]), /* @__PURE__ */ o("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ o("div", { className: "x78zum5 xdt5ytf x1ndbd79 x1lr1uin x1t7e3gq x4pepcl x1d0qn7y", children: t.kind === "working" ? /* @__PURE__ */ k(be, { children: [
|
|
1691
|
+
/* @__PURE__ */ o(_, { size: "lg", weight: "medium", children: "Opening your site…" }),
|
|
1692
|
+
/* @__PURE__ */ o(_, { tone: "muted", children: "Setting up editing on the site and sending you back." })
|
|
1693
|
+
] }) : /* @__PURE__ */ k(be, { children: [
|
|
1694
|
+
/* @__PURE__ */ o(_, { size: "lg", weight: "medium", children: "Could not open the site" }),
|
|
1695
|
+
/* @__PURE__ */ o(_, { tone: "muted", children: t.message }),
|
|
1696
|
+
/* @__PURE__ */ o(ze, { to: "/", variant: "secondary", children: "Back to the dashboard" })
|
|
1699
1697
|
] }) }) });
|
|
1700
1698
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
return Be() && e.replace(/\/$/, "") === "/__ui";
|
|
1699
|
+
function kr(e) {
|
|
1700
|
+
if (!kt()) return !1;
|
|
1701
|
+
const t = e.replace(/\/$/, "") || "/";
|
|
1702
|
+
return t === "/__ui" || /^\/__ui\/[^/]+$/.test(t);
|
|
1706
1703
|
}
|
|
1704
|
+
const Sr = et(() => import("./UiKitApp-b8qFsmA-.js").then((e) => ({
|
|
1705
|
+
default: e.UiKitApp
|
|
1706
|
+
})));
|
|
1707
1707
|
function Pr() {
|
|
1708
|
-
return /* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ o(St, { children: /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o(Er, {}) }) });
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
const e =
|
|
1712
|
-
const r =
|
|
1710
|
+
function Er() {
|
|
1711
|
+
const e = Rt(), [t, n] = w(() => {
|
|
1712
|
+
const r = _t();
|
|
1713
1713
|
return r ? {
|
|
1714
1714
|
user: r
|
|
1715
1715
|
} : "loading";
|
|
1716
1716
|
});
|
|
1717
|
-
return
|
|
1718
|
-
|
|
1717
|
+
return V(() => {
|
|
1718
|
+
ve().then((r) => {
|
|
1719
1719
|
if (!(r != null && r.user)) {
|
|
1720
|
-
|
|
1720
|
+
ee(), z.wipe(), n(null);
|
|
1721
1721
|
return;
|
|
1722
1722
|
}
|
|
1723
|
-
if (
|
|
1723
|
+
if (Ot(r.user), n({
|
|
1724
1724
|
user: {
|
|
1725
1725
|
id: r.user.id,
|
|
1726
1726
|
email: r.user.email
|
|
1727
1727
|
}
|
|
1728
|
-
}),
|
|
1729
|
-
const s =
|
|
1730
|
-
|
|
1728
|
+
}), z.getState().sessionUserId !== r.user.id) {
|
|
1729
|
+
const s = Tt(window.location.pathname);
|
|
1730
|
+
z.hydrate(r.user.id, s ?? Ie(r.user.id));
|
|
1731
1731
|
}
|
|
1732
1732
|
}).catch(() => {
|
|
1733
|
-
|
|
1733
|
+
ee(), z.wipe(), n(null);
|
|
1734
1734
|
});
|
|
1735
|
-
}, []),
|
|
1736
|
-
|
|
1735
|
+
}, []), kr(e.pathname) ? /* @__PURE__ */ o(tt, { fallback: /* @__PURE__ */ o("div", { className: "x1y5dg2c", children: /* @__PURE__ */ o(_, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ o(Sr, {}) }) : t === "loading" ? /* @__PURE__ */ o(Pt, {}) : t ? e.pathname.replace(/\/$/, "") === "/enter" ? /* @__PURE__ */ o(wr, { userId: t.user.id }) : Lt(e.pathname) ? /* @__PURE__ */ o(br, { email: t.user.email }) : /* @__PURE__ */ o(At, { user: t.user, children: /* @__PURE__ */ o(jt, { children: /* @__PURE__ */ o(Ut, { userId: t.user.id, email: t.user.email, onLogout: () => {
|
|
1736
|
+
ee(), z.wipe(), B().signOut().then(() => {
|
|
1737
1737
|
n(null);
|
|
1738
1738
|
}).catch(() => {
|
|
1739
1739
|
n(null);
|
|
1740
1740
|
});
|
|
1741
|
-
}, children: /* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */ a(q, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ a(Ct, {}) }),
|
|
1741
|
+
}, children: /* @__PURE__ */ k(Nt, { children: [
|
|
1742
|
+
/* @__PURE__ */ o(F, { path: "/", element: /* @__PURE__ */ o(fr, {}) }),
|
|
1743
|
+
/* @__PURE__ */ o(F, { path: "/workspaces", element: /* @__PURE__ */ o(gr, {}) }),
|
|
1744
|
+
/* @__PURE__ */ o(F, { path: "/workspaces/new", element: /* @__PURE__ */ o(mr, {}) }),
|
|
1745
|
+
/* @__PURE__ */ o(F, { path: "/invite", element: /* @__PURE__ */ o(yr, {}) }),
|
|
1746
|
+
/* @__PURE__ */ o(F, { path: "/account", element: /* @__PURE__ */ o(vr, {}) }),
|
|
1747
|
+
/* @__PURE__ */ o(F, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ o(Ct, {}) }),
|
|
1749
1748
|
It(),
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
] }) }) }) }) : /* @__PURE__ */ a(cr, {});
|
|
1749
|
+
/* @__PURE__ */ o(F, { path: "*", element: /* @__PURE__ */ o(qe, { to: "/", replace: !0 }) })
|
|
1750
|
+
] }) }) }) }) : /* @__PURE__ */ o(cr, {});
|
|
1753
1751
|
}
|
|
1754
1752
|
export {
|
|
1755
1753
|
Pr as A,
|
|
1756
1754
|
pr as L,
|
|
1757
1755
|
hr as a,
|
|
1758
|
-
|
|
1756
|
+
kr as i
|
|
1759
1757
|
};
|