@backmatter/studio 0.0.17 → 0.0.19
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-D7vllRQE.js → UiKitApp-B1ANqCac.js} +528 -481
- package/dist/chunks/{WorkspaceRoutes-DH1LD-2Q.js → WorkspaceRoutes-BHNGrf-j.js} +24955 -24119
- package/dist/chunks/{dashboard-Dsaeud2x.js → dashboard-b-W6dGm5.js} +586 -565
- package/dist/chunks/{index-CGMqw2NH.js → index-HYioDjux.js} +104 -104
- package/dist/dashboard.js +2 -2
- package/dist/index.js +166 -159
- package/dist/site-widget.css +25 -6
- package/dist/site-widget.js +6925 -6840
- package/dist/studio.css +171 -42
- package/package.json +2 -2
- package/src/api.ts +44 -1
- package/src/chat/ChatMessage.tsx +4 -4
- package/src/chat/ChatProvider.tsx +6 -0
- package/src/chat/chat-helpers.ts +54 -2
- package/src/chrome/CommandPalette.tsx +3 -3
- package/src/chrome/ContentExplorerSidebar.tsx +421 -74
- package/src/chrome/WorkspaceStatusBar.tsx +24 -24
- package/src/chrome/commit-error.ts +48 -60
- package/src/chrome/commit-failure.tsx +2 -2
- package/src/chrome/content-path-tree.ts +4 -0
- package/src/chrome/explorer-row-menu.ts +28 -0
- package/src/chrome/folder-create-context.ts +14 -0
- package/src/chrome/use-publish-check.ts +75 -0
- package/src/{pages/code-session-routes.ts → content-routes.ts} +6 -6
- package/src/fields/FieldControl.tsx +198 -64
- package/src/fields/LinkFieldInput.tsx +315 -0
- package/src/fields/choose-field-input.ts +5 -0
- package/src/fields/link-targets.ts +60 -0
- package/src/host-path.ts +13 -0
- package/src/pages/CodeSessionPage.tsx +6 -241
- package/src/pages/DocEditorPage.tsx +121 -178
- package/src/pages/EmbedPublishPage.tsx +13 -5
- package/src/pages/GithubConnectPage.tsx +1 -1
- package/src/pages/LoginPage.tsx +67 -5
- package/src/pages/MediaFieldInput.tsx +712 -37
- package/src/pages/MediaGalleryPage.tsx +69 -5
- package/src/pages/PreviewAddress.tsx +293 -0
- package/src/pages/WorkspaceHomePage.tsx +1 -1
- package/src/pages/code-session-boot.ts +0 -12
- package/src/pages/media-selection.ts +79 -0
- package/src/pages/ui-kit/colors.tsx +2 -0
- package/src/pages/ui-kit/fields.tsx +60 -0
- package/src/styles/themes.ts +2 -0
- package/src/styles/tokens.stylex.ts +1 -0
- package/src/ui/Button.tsx +14 -0
- package/src/ui/Field.tsx +12 -1
- package/src/ui/Input.tsx +191 -97
- package/src/ui/popup.ts +13 -6
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as k, jsx as o, Fragment as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import {
|
|
1
|
+
var Xe = Object.defineProperty;
|
|
2
|
+
var Ye = (e, t, n) => t in e ? Xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var H = (e, t, n) => Ye(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsxs as k, jsx as o, Fragment as me } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as Qe, useCallback as Ze, useSyncExternalStore as et, useState as S, useEffect as V, lazy as tt, Suspense as nt } from "react";
|
|
6
|
+
import { X as rt, an as be, ao as st, V as R, ap as it, k as at, aq as ot, ar as Ce, as as Ie, at as qe, au as lt, av as ct, P as ze, aw as ut, ax as ie, ah as J, Z as Be, ay as dt, az as Fe, ai as ft, ak as re, aa as Q, ab as Z, Y as ae, aA as ht, W as B, aB as pt, J as we, aC as ee, aj as gt, aD as mt, aE as xt, aF as yt, f as vt, aG as bt, a6 as wt, aH as kt, aI as St, z as Et, B as Rt, I as _t, aJ as Ot, aK as Tt, aL as Pt, K as jt, aM as Lt, R as At, L as Nt, M as Ut, N as Ct, O as F, Q as It, U as qt } from "./WorkspaceRoutes-BHNGrf-j.js";
|
|
7
7
|
const te = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
8
8
|
var t, n;
|
|
9
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
|
-
},
|
|
10
|
+
}, z = new Proxy(te, {
|
|
11
11
|
get(e, t) {
|
|
12
12
|
return W()[t] ?? te[t];
|
|
13
13
|
},
|
|
@@ -28,21 +28,21 @@ const te = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
|
28
28
|
return Object.keys(e);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
z.NODE_ENV;
|
|
32
32
|
var ne = class extends Error {
|
|
33
33
|
constructor(e, t) {
|
|
34
34
|
super(e, t), this.name = "BetterAuthError", this.message = e, this.stack = "";
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
const
|
|
38
|
-
function
|
|
37
|
+
const zt = 47;
|
|
38
|
+
function Me(e) {
|
|
39
39
|
let t = e.length;
|
|
40
|
-
for (; t > 0 && e.charCodeAt(t - 1) ===
|
|
40
|
+
for (; t > 0 && e.charCodeAt(t - 1) === zt; ) t--;
|
|
41
41
|
return t === e.length ? e : e.slice(0, t);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Bt(e) {
|
|
44
44
|
try {
|
|
45
|
-
return (
|
|
45
|
+
return (Me(new URL(e).pathname) || "/") !== "/";
|
|
46
46
|
} catch {
|
|
47
47
|
throw new ne(`Invalid base URL: ${e}. Please provide a valid base URL.`);
|
|
48
48
|
}
|
|
@@ -56,24 +56,24 @@ function Ft(e) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function oe(e, t = "/api/auth") {
|
|
59
|
-
if (Ft(e),
|
|
60
|
-
const n =
|
|
59
|
+
if (Ft(e), Bt(e)) return e;
|
|
60
|
+
const n = Me(e);
|
|
61
61
|
return !t || t === "/" ? n : (t = t.startsWith("/") ? t : `/${t}`, `${n}${t}`);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Mt(e, t, n, r, s) {
|
|
64
64
|
if (e) return oe(e, t);
|
|
65
65
|
{
|
|
66
|
-
const i =
|
|
66
|
+
const i = z.BETTER_AUTH_URL || z.NEXT_PUBLIC_BETTER_AUTH_URL || z.PUBLIC_BETTER_AUTH_URL || z.NUXT_PUBLIC_BETTER_AUTH_URL || z.NUXT_PUBLIC_AUTH_URL || (z.BASE_URL !== "/" ? z.BASE_URL : void 0);
|
|
67
67
|
if (i) return oe(i, t);
|
|
68
68
|
}
|
|
69
69
|
if (typeof window < "u" && window.location) return oe(window.location.origin, t);
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const Dt = {
|
|
72
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*:/,
|
|
73
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*:/,
|
|
74
74
|
protoShort: /"__proto__"\s*:/,
|
|
75
75
|
constructorShort: /"constructor"\s*:/
|
|
76
|
-
},
|
|
76
|
+
}, Ht = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, ke = {
|
|
77
77
|
true: !0,
|
|
78
78
|
false: !1,
|
|
79
79
|
null: null,
|
|
@@ -81,30 +81,30 @@ const Mt = {
|
|
|
81
81
|
nan: NaN,
|
|
82
82
|
infinity: Number.POSITIVE_INFINITY,
|
|
83
83
|
"-infinity": Number.NEGATIVE_INFINITY
|
|
84
|
-
},
|
|
85
|
-
function
|
|
84
|
+
}, Wt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
|
|
85
|
+
function $t(e) {
|
|
86
86
|
return e instanceof Date && !isNaN(e.getTime());
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const t =
|
|
88
|
+
function Gt(e) {
|
|
89
|
+
const t = Wt.exec(e);
|
|
90
90
|
if (!t) return null;
|
|
91
|
-
const [, n, r, s, i, l, d, a, u, c,
|
|
91
|
+
const [, n, r, s, i, l, d, a, u, c, g] = t, h = 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));
|
|
92
92
|
if (u) {
|
|
93
|
-
const
|
|
94
|
-
|
|
93
|
+
const p = (parseInt(c, 10) * 60 + parseInt(g, 10)) * (u === "+" ? -1 : 1);
|
|
94
|
+
h.setUTCMinutes(h.getUTCMinutes() + p);
|
|
95
95
|
}
|
|
96
|
-
return
|
|
96
|
+
return $t(h) ? h : null;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Jt(e, t = {}) {
|
|
99
99
|
const { strict: n = !1, warnings: r = !1, reviver: s, parseDates: i = !0 } = t;
|
|
100
100
|
if (typeof e != "string") return e;
|
|
101
101
|
const l = e.trim(), d = l.toLowerCase();
|
|
102
|
-
if (d.length <= 9 && d in
|
|
103
|
-
if (!
|
|
102
|
+
if (d.length <= 9 && d in ke) return ke[d];
|
|
103
|
+
if (!Ht.test(l)) {
|
|
104
104
|
if (n) throw new SyntaxError("[better-json] Invalid JSON");
|
|
105
105
|
return e;
|
|
106
106
|
}
|
|
107
|
-
if (Object.entries(
|
|
107
|
+
if (Object.entries(Dt).some(([a, u]) => {
|
|
108
108
|
const c = u.test(l);
|
|
109
109
|
return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${a} pattern`), c;
|
|
110
110
|
}) && n) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
@@ -115,8 +115,8 @@ function Gt(e, t = {}) {
|
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
if (i && typeof c == "string") {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
118
|
+
const g = Gt(c);
|
|
119
|
+
if (g) return g;
|
|
120
120
|
}
|
|
121
121
|
return s ? s(u, c) : c;
|
|
122
122
|
});
|
|
@@ -125,54 +125,54 @@ function Gt(e, t = {}) {
|
|
|
125
125
|
return e;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
128
|
+
function Vt(e, t = { strict: !0 }) {
|
|
129
|
+
return Jt(e, t);
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const Kt = [
|
|
132
132
|
"javascript:",
|
|
133
133
|
"data:",
|
|
134
134
|
"vbscript:"
|
|
135
135
|
];
|
|
136
|
-
function
|
|
136
|
+
function Xt(e) {
|
|
137
137
|
let t;
|
|
138
138
|
try {
|
|
139
139
|
t = new URL(e);
|
|
140
140
|
} catch {
|
|
141
141
|
return !0;
|
|
142
142
|
}
|
|
143
|
-
return !
|
|
143
|
+
return !Kt.includes(t.protocol);
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const Yt = {
|
|
146
146
|
id: "redirect",
|
|
147
147
|
name: "Redirect",
|
|
148
148
|
hooks: { onSuccess(e) {
|
|
149
149
|
var t, n;
|
|
150
|
-
if ((t = e.data) != null && t.url && ((n = e.data) != null && n.redirect) &&
|
|
150
|
+
if ((t = e.data) != null && t.url && ((n = e.data) != null && n.redirect) && Xt(e.data.url) && typeof window < "u" && window.location && window.location)
|
|
151
151
|
try {
|
|
152
152
|
window.location.href = e.data.url;
|
|
153
153
|
} catch {
|
|
154
154
|
}
|
|
155
155
|
} }
|
|
156
156
|
};
|
|
157
|
-
let
|
|
158
|
-
const
|
|
159
|
-
let
|
|
157
|
+
let U = [], $ = 0;
|
|
158
|
+
const xe = 4, Qt = globalThis.nanostoresGlobal || (globalThis.nanostoresGlobal = { epoch: 0 });
|
|
159
|
+
let Zt = () => {
|
|
160
160
|
let e, t;
|
|
161
|
-
for (; $ <
|
|
162
|
-
t = $, $ +=
|
|
161
|
+
for (; $ < U.length; ) {
|
|
162
|
+
t = $, $ += xe;
|
|
163
163
|
try {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
U[t](
|
|
165
|
+
U[t + 1].value,
|
|
166
|
+
U[t + 2],
|
|
167
|
+
U[t + 3]
|
|
168
168
|
);
|
|
169
169
|
} catch (n) {
|
|
170
170
|
e = n;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
if (
|
|
173
|
+
if (U.length = $ = 0, e) throw e;
|
|
174
174
|
};
|
|
175
|
-
const
|
|
175
|
+
const Se = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
176
176
|
let t = [], n = {
|
|
177
177
|
eq: Object.is,
|
|
178
178
|
get() {
|
|
@@ -183,23 +183,23 @@ const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
|
183
183
|
lc: 0,
|
|
184
184
|
listen(r) {
|
|
185
185
|
return n.lc = t.push(r), () => {
|
|
186
|
-
for (let i = $; i <
|
|
187
|
-
|
|
186
|
+
for (let i = $; i < U.length; )
|
|
187
|
+
U[i] === r ? U.splice(i, xe) : i += xe;
|
|
188
188
|
let s = t.indexOf(r);
|
|
189
189
|
~s && (t.splice(s, 1), --n.lc || n.off());
|
|
190
190
|
};
|
|
191
191
|
},
|
|
192
192
|
notify(r, s) {
|
|
193
|
-
|
|
194
|
-
let i = !
|
|
193
|
+
Qt.epoch++;
|
|
194
|
+
let i = !U.length && !0;
|
|
195
195
|
for (let l of t)
|
|
196
|
-
|
|
196
|
+
U.push(
|
|
197
197
|
l,
|
|
198
198
|
n,
|
|
199
199
|
r,
|
|
200
200
|
s
|
|
201
201
|
);
|
|
202
|
-
i &&
|
|
202
|
+
i && Zt();
|
|
203
203
|
},
|
|
204
204
|
/* It will be called on last listener unsubscribing.
|
|
205
205
|
We will redefine it in onMount and onStop. */
|
|
@@ -216,8 +216,8 @@ const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
|
216
216
|
value: e
|
|
217
217
|
};
|
|
218
218
|
return n;
|
|
219
|
-
},
|
|
220
|
-
let
|
|
219
|
+
}, en = 2, tn = 5, X = 6, Y = 10;
|
|
220
|
+
let De = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.events[n + Y] = r((s) => {
|
|
221
221
|
e.events[n].reduceRight((i, l) => (l(i), i), {
|
|
222
222
|
shared: {},
|
|
223
223
|
...s
|
|
@@ -225,7 +225,7 @@ let Me = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.event
|
|
|
225
225
|
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
226
226
|
let s = e.events[n], i = s.indexOf(t);
|
|
227
227
|
~i && (s.splice(i, 1), s.length || (e.events[n + Y](), delete e.events[n + Y]));
|
|
228
|
-
}),
|
|
228
|
+
}), nn = (e, t) => De(e, t, en, (n) => {
|
|
229
229
|
let r = e.set, s = e.setKey;
|
|
230
230
|
return e.setKey && (e.setKey = (i, l) => {
|
|
231
231
|
let d;
|
|
@@ -245,11 +245,11 @@ let Me = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.event
|
|
|
245
245
|
e.set = r, e.setKey = s;
|
|
246
246
|
};
|
|
247
247
|
});
|
|
248
|
-
const
|
|
249
|
-
let
|
|
248
|
+
const He = 1e3;
|
|
249
|
+
let rn = (e, t) => De(e, (r) => {
|
|
250
250
|
let s = t(r);
|
|
251
251
|
s && e.events[X].push(s);
|
|
252
|
-
},
|
|
252
|
+
}, tn, (r) => {
|
|
253
253
|
let s = e.listen;
|
|
254
254
|
e.listen = (...l) => (!e.lc && !e.active && (e.active = !0, r()), s(...l));
|
|
255
255
|
let i = e.off;
|
|
@@ -260,13 +260,13 @@ let nn = (e, t) => Me(e, (r) => {
|
|
|
260
260
|
for (let l of e.events[X]) l();
|
|
261
261
|
e.events[X] = [];
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, He);
|
|
264
264
|
}, () => {
|
|
265
265
|
e.listen = s, e.off = i;
|
|
266
266
|
};
|
|
267
267
|
});
|
|
268
|
-
function
|
|
269
|
-
let n =
|
|
268
|
+
function Ee(e, t) {
|
|
269
|
+
let n = sn(t), r = e;
|
|
270
270
|
for (let s of n) {
|
|
271
271
|
if (r == null)
|
|
272
272
|
return;
|
|
@@ -274,29 +274,29 @@ function Se(e, t) {
|
|
|
274
274
|
}
|
|
275
275
|
return r;
|
|
276
276
|
}
|
|
277
|
-
const
|
|
278
|
-
function
|
|
279
|
-
return e.split(".").flatMap((t) =>
|
|
277
|
+
const Re = /(.*)\[(\d+)\]/;
|
|
278
|
+
function sn(e) {
|
|
279
|
+
return e.split(".").flatMap((t) => We(t));
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
if (
|
|
283
|
-
let [, t, n] = e.match(
|
|
284
|
-
return [...
|
|
281
|
+
function We(e) {
|
|
282
|
+
if (Re.test(e)) {
|
|
283
|
+
let [, t, n] = e.match(Re);
|
|
284
|
+
return [...We(t), n];
|
|
285
285
|
}
|
|
286
286
|
return [e];
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function an(e, t, n) {
|
|
289
289
|
let r = new Set(t);
|
|
290
290
|
return e.listen((s, i, l) => {
|
|
291
291
|
(l === void 0 ? t.some(
|
|
292
292
|
(d) => i === void 0 || // `map` keys are plain properties, but a `deepMap` key is a path into
|
|
293
293
|
// the value, where a plain lookup would compare undefined to undefined
|
|
294
294
|
// and never report a change.
|
|
295
|
-
s[d] !== i[d] ||
|
|
295
|
+
s[d] !== i[d] || Ee(s, d) !== Ee(i, d)
|
|
296
296
|
) : r.has(l) || r.has(l.split(/\.|\[/)[0])) && n(s, i, l);
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function _e(e) {
|
|
300
300
|
if (typeof e != "object" || e === null) return !1;
|
|
301
301
|
const t = Object.getPrototypeOf(e);
|
|
302
302
|
return t === Object.prototype || t === null;
|
|
@@ -308,7 +308,7 @@ function se(e, t) {
|
|
|
308
308
|
for (let n = 0; n < e.length; n++) if (!se(e[n], t[n])) return !1;
|
|
309
309
|
return !0;
|
|
310
310
|
}
|
|
311
|
-
if (
|
|
311
|
+
if (_e(e) && _e(t)) {
|
|
312
312
|
const n = Object.keys(e), r = Object.keys(t);
|
|
313
313
|
if (n.length !== r.length) return !1;
|
|
314
314
|
for (const s of n) if (!(s in t) || !se(e[s], t[s])) return !1;
|
|
@@ -316,16 +316,16 @@ function se(e, t) {
|
|
|
316
316
|
}
|
|
317
317
|
return !1;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
return
|
|
319
|
+
function on(e, t) {
|
|
320
|
+
return nn(e, ({ newValue: n, abort: r }) => {
|
|
321
321
|
t(e.value, n) && r();
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
-
const le = Symbol.for("better-auth:broadcast-channel"),
|
|
325
|
-
var
|
|
324
|
+
const le = Symbol.for("better-auth:broadcast-channel"), ln = () => Math.floor(Date.now() / 1e3);
|
|
325
|
+
var cn = class {
|
|
326
326
|
constructor(e = "better-auth.message") {
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
H(this, "listeners", /* @__PURE__ */ new Set());
|
|
328
|
+
H(this, "name");
|
|
329
329
|
this.name = e;
|
|
330
330
|
}
|
|
331
331
|
subscribe(e) {
|
|
@@ -338,7 +338,7 @@ var ln = class {
|
|
|
338
338
|
try {
|
|
339
339
|
localStorage.setItem(this.name, JSON.stringify({
|
|
340
340
|
...e,
|
|
341
|
-
timestamp:
|
|
341
|
+
timestamp: ln()
|
|
342
342
|
}));
|
|
343
343
|
} catch {
|
|
344
344
|
}
|
|
@@ -357,12 +357,12 @@ var ln = class {
|
|
|
357
357
|
}
|
|
358
358
|
};
|
|
359
359
|
function ce(e = "better-auth.message") {
|
|
360
|
-
return globalThis[le] || (globalThis[le] = new
|
|
360
|
+
return globalThis[le] || (globalThis[le] = new cn(e)), globalThis[le];
|
|
361
361
|
}
|
|
362
362
|
const ue = Symbol.for("better-auth:focus-manager");
|
|
363
|
-
var
|
|
363
|
+
var un = class {
|
|
364
364
|
constructor() {
|
|
365
|
-
|
|
365
|
+
H(this, "listeners", /* @__PURE__ */ new Set());
|
|
366
366
|
}
|
|
367
367
|
subscribe(e) {
|
|
368
368
|
return this.listeners.add(e), () => {
|
|
@@ -383,14 +383,14 @@ var cn = class {
|
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
385
|
};
|
|
386
|
-
function
|
|
387
|
-
return globalThis[ue] || (globalThis[ue] = new
|
|
386
|
+
function Oe() {
|
|
387
|
+
return globalThis[ue] || (globalThis[ue] = new un()), globalThis[ue];
|
|
388
388
|
}
|
|
389
389
|
const de = Symbol.for("better-auth:online-manager");
|
|
390
|
-
var
|
|
390
|
+
var dn = class {
|
|
391
391
|
constructor() {
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
H(this, "listeners", /* @__PURE__ */ new Set());
|
|
393
|
+
H(this, "isOnline", typeof navigator < "u" ? navigator.onLine : !0);
|
|
394
394
|
}
|
|
395
395
|
subscribe(e) {
|
|
396
396
|
return this.listeners.add(e), () => {
|
|
@@ -410,52 +410,52 @@ var un = class {
|
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
412
|
function fe() {
|
|
413
|
-
return globalThis[de] || (globalThis[de] = new
|
|
413
|
+
return globalThis[de] || (globalThis[de] = new dn()), globalThis[de];
|
|
414
414
|
}
|
|
415
|
-
const he = () => Math.floor(Date.now() / 1e3),
|
|
416
|
-
function
|
|
417
|
-
var
|
|
418
|
-
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((
|
|
415
|
+
const he = () => Math.floor(Date.now() / 1e3), fn = 5;
|
|
416
|
+
function hn(e) {
|
|
417
|
+
var T, y, _;
|
|
418
|
+
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((T = s.sessionOptions) == null ? void 0 : T.refetchInterval) ?? 0, l = ((y = s.sessionOptions) == null ? void 0 : y.refetchOnWindowFocus) ?? !0, d = ((_ = s.sessionOptions) == null ? void 0 : _.refetchWhenOffline) ?? !1, a = {
|
|
419
419
|
isInitialized: !1,
|
|
420
420
|
lastSessionRequest: 0
|
|
421
|
-
}, u = () => d || fe().isOnline, c = (
|
|
421
|
+
}, u = () => d || fe().isOnline, c = (m) => {
|
|
422
422
|
if (u()) {
|
|
423
|
-
if ((
|
|
423
|
+
if ((m == null ? void 0 : m.event) === "storage") {
|
|
424
424
|
t();
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
|
-
if ((
|
|
427
|
+
if ((m == null ? void 0 : m.event) === "poll") {
|
|
428
428
|
a.lastSessionRequest = he(), t();
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
|
-
if ((
|
|
432
|
-
if (he() - a.lastSessionRequest <
|
|
431
|
+
if ((m == null ? void 0 : m.event) === "visibilitychange") {
|
|
432
|
+
if (he() - a.lastSessionRequest < fn) return;
|
|
433
433
|
a.lastSessionRequest = he(), t();
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
436
|
t();
|
|
437
437
|
}
|
|
438
|
-
},
|
|
438
|
+
}, g = (m) => {
|
|
439
439
|
ce().post({
|
|
440
440
|
event: "session",
|
|
441
|
-
data: { trigger:
|
|
441
|
+
data: { trigger: m },
|
|
442
442
|
clientId: Math.random().toString(36).substring(7)
|
|
443
443
|
});
|
|
444
|
-
},
|
|
444
|
+
}, h = () => {
|
|
445
445
|
i && i > 0 && (a.pollInterval = setInterval(() => {
|
|
446
446
|
n() && c({ event: "poll" });
|
|
447
447
|
}, i * 1e3));
|
|
448
|
-
},
|
|
448
|
+
}, p = () => {
|
|
449
449
|
a.unsubscribeBroadcast = ce().subscribe(() => {
|
|
450
450
|
c({ event: "storage" });
|
|
451
451
|
});
|
|
452
|
-
},
|
|
453
|
-
l && (a.unsubscribeFocus =
|
|
452
|
+
}, v = () => {
|
|
453
|
+
l && (a.unsubscribeFocus = Oe().subscribe(() => {
|
|
454
454
|
c({ event: "visibilitychange" });
|
|
455
455
|
}));
|
|
456
|
-
},
|
|
457
|
-
a.unsubscribeOnline = fe().subscribe((
|
|
458
|
-
|
|
456
|
+
}, b = () => {
|
|
457
|
+
a.unsubscribeOnline = fe().subscribe((m) => {
|
|
458
|
+
m && c({ event: "visibilitychange" });
|
|
459
459
|
});
|
|
460
460
|
}, x = () => {
|
|
461
461
|
a.unsubscribeSignal = r.listen(() => {
|
|
@@ -464,17 +464,17 @@ function fn(e) {
|
|
|
464
464
|
};
|
|
465
465
|
return {
|
|
466
466
|
init: () => {
|
|
467
|
-
a.isInitialized || (a.isInitialized = !0,
|
|
467
|
+
a.isInitialized || (a.isInitialized = !0, h(), p(), v(), b(), x(), a.cleanupBroadcastSetup = ce().setup(), a.cleanupFocusSetup = Oe().setup(), a.cleanupOnlineSetup = fe().setup());
|
|
468
468
|
},
|
|
469
469
|
cleanup: () => {
|
|
470
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);
|
|
471
471
|
},
|
|
472
472
|
triggerRefetch: c,
|
|
473
|
-
broadcastSessionUpdate:
|
|
473
|
+
broadcastSessionUpdate: g
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
-
const
|
|
477
|
-
function
|
|
476
|
+
const pn = () => typeof window > "u", gn = He;
|
|
477
|
+
function mn(e, t) {
|
|
478
478
|
if (typeof window > "u") return;
|
|
479
479
|
const n = e.get();
|
|
480
480
|
n.data !== null || t === null || e.set({
|
|
@@ -484,83 +484,83 @@ function gn(e, t) {
|
|
|
484
484
|
isPending: !1
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Te(e) {
|
|
488
488
|
return typeof e == "object" && e !== null && "data" in e && "error" in e ? e : {
|
|
489
489
|
data: e,
|
|
490
490
|
error: null
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function xn(e) {
|
|
494
494
|
return !e || e.session === null && e.user === null ? null : e;
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function yn(e, t) {
|
|
497
497
|
return se(e.data, t.data) && e.error === t.error && e.isPending === t.isPending && e.isRefetching === t.isRefetching && e.refetch === t.refetch;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
const n = /* @__PURE__ */
|
|
499
|
+
function vn(e, t) {
|
|
500
|
+
const n = /* @__PURE__ */ Se(!1);
|
|
501
501
|
let r, s = 0, i = 0;
|
|
502
502
|
n.listen(() => {
|
|
503
503
|
i++, s = 0;
|
|
504
504
|
});
|
|
505
|
-
const l = (
|
|
505
|
+
const l = (p) => c(p), d = /* @__PURE__ */ Se({
|
|
506
506
|
data: null,
|
|
507
507
|
error: null,
|
|
508
508
|
isPending: !0,
|
|
509
509
|
isRefetching: !1,
|
|
510
510
|
refetch: l
|
|
511
511
|
});
|
|
512
|
-
|
|
513
|
-
const a = async (
|
|
514
|
-
const
|
|
512
|
+
on(d, yn);
|
|
513
|
+
const a = async (p, v) => {
|
|
514
|
+
const b = d.value;
|
|
515
515
|
if (d.set({
|
|
516
|
-
...
|
|
517
|
-
isPending:
|
|
516
|
+
...b,
|
|
517
|
+
isPending: b.data === null,
|
|
518
518
|
isRefetching: !0,
|
|
519
519
|
error: null,
|
|
520
520
|
refetch: l
|
|
521
|
-
}),
|
|
521
|
+
}), p.aborted) return "aborted";
|
|
522
522
|
try {
|
|
523
523
|
const x = await e("/get-session", {
|
|
524
524
|
method: "GET",
|
|
525
|
-
query:
|
|
526
|
-
signal:
|
|
525
|
+
query: v == null ? void 0 : v.query,
|
|
526
|
+
signal: p
|
|
527
527
|
});
|
|
528
|
-
if (
|
|
529
|
-
let { data:
|
|
530
|
-
if (
|
|
531
|
-
const
|
|
528
|
+
if (p.aborted) return "aborted";
|
|
529
|
+
let { data: E, error: P } = Te(x), T = "fresh";
|
|
530
|
+
if (E != null && E.needsRefresh) try {
|
|
531
|
+
const O = await e("/get-session", {
|
|
532
532
|
method: "POST",
|
|
533
|
-
signal:
|
|
533
|
+
signal: p
|
|
534
534
|
});
|
|
535
|
-
if (
|
|
536
|
-
({ data:
|
|
535
|
+
if (p.aborted) return "aborted";
|
|
536
|
+
({ data: E, error: P } = Te(O));
|
|
537
537
|
} catch {
|
|
538
|
-
if (
|
|
539
|
-
|
|
538
|
+
if (p.aborted) return "aborted";
|
|
539
|
+
T = "stale";
|
|
540
540
|
}
|
|
541
|
-
if (
|
|
542
|
-
const
|
|
541
|
+
if (P) {
|
|
542
|
+
const O = d.value, L = (P == null ? void 0 : P.status) === 401;
|
|
543
543
|
return d.set({
|
|
544
|
-
data:
|
|
545
|
-
error:
|
|
544
|
+
data: L ? null : O.data,
|
|
545
|
+
error: P,
|
|
546
546
|
isPending: !1,
|
|
547
547
|
isRefetching: !1,
|
|
548
548
|
refetch: l
|
|
549
549
|
}), "failed";
|
|
550
550
|
}
|
|
551
|
-
const
|
|
551
|
+
const y = xn(E), _ = d.value, m = _.data != null && y != null && se(_.data, y) ? _.data : y;
|
|
552
552
|
return d.set({
|
|
553
|
-
data:
|
|
553
|
+
data: m,
|
|
554
554
|
error: null,
|
|
555
555
|
isPending: !1,
|
|
556
556
|
isRefetching: !1,
|
|
557
557
|
refetch: l
|
|
558
|
-
}),
|
|
558
|
+
}), T;
|
|
559
559
|
} catch (x) {
|
|
560
|
-
if (
|
|
561
|
-
const
|
|
560
|
+
if (p.aborted) return "aborted";
|
|
561
|
+
const E = d.value;
|
|
562
562
|
return d.set({
|
|
563
|
-
data:
|
|
563
|
+
data: E.data,
|
|
564
564
|
error: x,
|
|
565
565
|
isPending: !1,
|
|
566
566
|
isRefetching: !1,
|
|
@@ -568,44 +568,44 @@ function yn(e, t) {
|
|
|
568
568
|
}), "failed";
|
|
569
569
|
}
|
|
570
570
|
}, u = () => {
|
|
571
|
-
var
|
|
572
|
-
const
|
|
573
|
-
return Math.min(Date.now() +
|
|
574
|
-
}, c = (
|
|
571
|
+
var b, x;
|
|
572
|
+
const p = (x = (b = d.value.data) == null ? void 0 : b.session) == null ? void 0 : x.expiresAt, v = p instanceof Date ? p.getTime() : Number.POSITIVE_INFINITY;
|
|
573
|
+
return Math.min(Date.now() + gn, v);
|
|
574
|
+
}, c = (p) => {
|
|
575
575
|
s = 0, r == null || r.cancel();
|
|
576
|
-
const
|
|
577
|
-
cancel: () =>
|
|
578
|
-
promise: Promise.resolve().then(() =>
|
|
576
|
+
const v = new AbortController(), b = {
|
|
577
|
+
cancel: () => v.abort(),
|
|
578
|
+
promise: Promise.resolve().then(() => v.signal.aborted ? "aborted" : a(v.signal, p)),
|
|
579
579
|
revision: i
|
|
580
580
|
};
|
|
581
|
-
r =
|
|
582
|
-
const x = (
|
|
583
|
-
r ===
|
|
581
|
+
r = b;
|
|
582
|
+
const x = (E) => {
|
|
583
|
+
r === b && (r = void 0, E === "fresh" && b.revision === i && (s = u()));
|
|
584
584
|
};
|
|
585
|
-
return
|
|
585
|
+
return b.promise.then(x, () => x("failed")), b.promise.then(() => {
|
|
586
586
|
});
|
|
587
|
-
},
|
|
587
|
+
}, g = () => (r == null ? void 0 : r.revision) === i ? r.promise.then(() => {
|
|
588
588
|
}) : Date.now() < s ? Promise.resolve() : c();
|
|
589
|
-
let
|
|
589
|
+
let h = () => {
|
|
590
590
|
};
|
|
591
|
-
return
|
|
592
|
-
let
|
|
593
|
-
|
|
594
|
-
|
|
591
|
+
return rn(d, () => {
|
|
592
|
+
let p;
|
|
593
|
+
pn() || (p = setTimeout(() => {
|
|
594
|
+
g();
|
|
595
595
|
}, 0));
|
|
596
|
-
const
|
|
596
|
+
const v = hn({
|
|
597
597
|
fetchSession: c,
|
|
598
598
|
shouldPollSession: () => d.value.data != null,
|
|
599
599
|
sessionSignal: n,
|
|
600
600
|
options: t
|
|
601
601
|
});
|
|
602
|
-
return
|
|
603
|
-
|
|
602
|
+
return v.init(), h = v.broadcastSessionUpdate, () => {
|
|
603
|
+
p && clearTimeout(p), v.cleanup();
|
|
604
604
|
};
|
|
605
605
|
}), {
|
|
606
606
|
session: d,
|
|
607
607
|
$sessionSignal: n,
|
|
608
|
-
broadcastSessionUpdate: (
|
|
608
|
+
broadcastSessionUpdate: (p) => h(p)
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
611
|
function pe(e) {
|
|
@@ -614,15 +614,15 @@ function pe(e) {
|
|
|
614
614
|
const t = Object.getPrototypeOf(e);
|
|
615
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;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function ye(e, t, n = ".", r) {
|
|
618
618
|
if (!pe(t))
|
|
619
|
-
return
|
|
619
|
+
return ye(e, {}, n, r);
|
|
620
620
|
const s = { ...t };
|
|
621
621
|
for (const i of Object.keys(e)) {
|
|
622
622
|
if (i === "__proto__" || i === "constructor")
|
|
623
623
|
continue;
|
|
624
624
|
const l = e[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] =
|
|
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] = ye(
|
|
626
626
|
l,
|
|
627
627
|
s[i],
|
|
628
628
|
(n ? `${n}.` : "") + i.toString(),
|
|
@@ -631,27 +631,27 @@ function xe(e, t, n = ".", r) {
|
|
|
631
631
|
}
|
|
632
632
|
return s;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function bn(e) {
|
|
635
635
|
return (...t) => (
|
|
636
636
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
637
|
-
t.reduce((n, r) =>
|
|
637
|
+
t.reduce((n, r) => ye(n, r, "", e), {})
|
|
638
638
|
);
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
var
|
|
640
|
+
const wn = bn();
|
|
641
|
+
var kn = Object.defineProperty, Sn = Object.defineProperties, En = Object.getOwnPropertyDescriptors, Pe = Object.getOwnPropertySymbols, Rn = Object.prototype.hasOwnProperty, _n = Object.prototype.propertyIsEnumerable, je = (e, t, n) => t in e ? kn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, N = (e, t) => {
|
|
642
642
|
for (var n in t || (t = {}))
|
|
643
|
-
|
|
644
|
-
if (
|
|
645
|
-
for (var n of
|
|
646
|
-
|
|
643
|
+
Rn.call(t, n) && je(e, n, t[n]);
|
|
644
|
+
if (Pe)
|
|
645
|
+
for (var n of Pe(t))
|
|
646
|
+
_n.call(t, n) && je(e, n, t[n]);
|
|
647
647
|
return e;
|
|
648
|
-
},
|
|
648
|
+
}, C = (e, t) => Sn(e, En(t)), On = class extends Error {
|
|
649
649
|
constructor(e, t, n) {
|
|
650
650
|
super(t || e.toString(), {
|
|
651
651
|
cause: n
|
|
652
652
|
}), this.status = e, this.statusText = t, this.error = n, Error.captureStackTrace(this, this.constructor);
|
|
653
653
|
}
|
|
654
|
-
},
|
|
654
|
+
}, Tn = async (e, t) => {
|
|
655
655
|
var n, r, s, i, l, d;
|
|
656
656
|
let a = t || {};
|
|
657
657
|
const u = {
|
|
@@ -669,8 +669,8 @@ var wn = Object.defineProperty, kn = Object.defineProperties, Sn = Object.getOwn
|
|
|
669
669
|
};
|
|
670
670
|
for (const c of (t == null ? void 0 : t.plugins) || []) {
|
|
671
671
|
if (c.init) {
|
|
672
|
-
const
|
|
673
|
-
a =
|
|
672
|
+
const g = await ((n = c.init) == null ? void 0 : n.call(c, e.toString(), t));
|
|
673
|
+
a = g.options || a, e = g.url;
|
|
674
674
|
}
|
|
675
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);
|
|
676
676
|
}
|
|
@@ -679,7 +679,7 @@ var wn = Object.defineProperty, kn = Object.defineProperties, Sn = Object.getOwn
|
|
|
679
679
|
options: a,
|
|
680
680
|
hooks: u
|
|
681
681
|
};
|
|
682
|
-
},
|
|
682
|
+
}, Le = class {
|
|
683
683
|
constructor(e) {
|
|
684
684
|
this.options = e;
|
|
685
685
|
}
|
|
@@ -691,7 +691,7 @@ var wn = Object.defineProperty, kn = Object.defineProperties, Sn = Object.getOwn
|
|
|
691
691
|
getDelay() {
|
|
692
692
|
return this.options.delay;
|
|
693
693
|
}
|
|
694
|
-
},
|
|
694
|
+
}, Pn = class {
|
|
695
695
|
constructor(e) {
|
|
696
696
|
this.options = e;
|
|
697
697
|
}
|
|
@@ -707,23 +707,23 @@ var wn = Object.defineProperty, kn = Object.defineProperties, Sn = Object.getOwn
|
|
|
707
707
|
);
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
|
-
function
|
|
710
|
+
function jn(e) {
|
|
711
711
|
if (typeof e == "number")
|
|
712
|
-
return new
|
|
712
|
+
return new Le({
|
|
713
713
|
type: "linear",
|
|
714
714
|
attempts: e,
|
|
715
715
|
delay: 1e3
|
|
716
716
|
});
|
|
717
717
|
switch (e.type) {
|
|
718
718
|
case "linear":
|
|
719
|
-
return new
|
|
719
|
+
return new Le(e);
|
|
720
720
|
case "exponential":
|
|
721
|
-
return new
|
|
721
|
+
return new Pn(e);
|
|
722
722
|
default:
|
|
723
723
|
throw new Error("Invalid retry strategy");
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
var
|
|
726
|
+
var Ln = async (e) => {
|
|
727
727
|
const t = {}, n = async (r) => typeof r == "function" ? await r() : r;
|
|
728
728
|
if (e != null && e.auth) {
|
|
729
729
|
if (e.auth.type === "Bearer") {
|
|
@@ -750,8 +750,8 @@ var jn = async (e) => {
|
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
return t;
|
|
753
|
-
},
|
|
754
|
-
function
|
|
753
|
+
}, An = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
754
|
+
function Nn(e) {
|
|
755
755
|
const t = e.headers.get("content-type"), n = /* @__PURE__ */ new Set([
|
|
756
756
|
"image/svg",
|
|
757
757
|
"application/xml",
|
|
@@ -761,7 +761,7 @@ function An(e) {
|
|
|
761
761
|
if (!t)
|
|
762
762
|
return "json";
|
|
763
763
|
const r = t.split(";").shift() || "";
|
|
764
|
-
return
|
|
764
|
+
return An.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
|
|
765
765
|
}
|
|
766
766
|
function Un(e) {
|
|
767
767
|
try {
|
|
@@ -770,32 +770,32 @@ function Un(e) {
|
|
|
770
770
|
return !1;
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function $e(e) {
|
|
774
774
|
if (e === void 0)
|
|
775
775
|
return !1;
|
|
776
776
|
const t = typeof e;
|
|
777
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";
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Ae(e) {
|
|
780
780
|
try {
|
|
781
781
|
return JSON.parse(e);
|
|
782
782
|
} catch {
|
|
783
783
|
return e;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Ne(e) {
|
|
787
787
|
return typeof e == "function";
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function Cn(e) {
|
|
790
790
|
if (e != null && e.customFetchImpl)
|
|
791
791
|
return e.customFetchImpl;
|
|
792
|
-
if (typeof globalThis < "u" &&
|
|
792
|
+
if (typeof globalThis < "u" && Ne(globalThis.fetch))
|
|
793
793
|
return globalThis.fetch;
|
|
794
|
-
if (typeof window < "u" &&
|
|
794
|
+
if (typeof window < "u" && Ne(window.fetch))
|
|
795
795
|
return window.fetch;
|
|
796
796
|
throw new Error("No fetch implementation found");
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function Ge(...e) {
|
|
799
799
|
const t = {};
|
|
800
800
|
for (const n of e)
|
|
801
801
|
if (n)
|
|
@@ -810,24 +810,24 @@ function $e(...e) {
|
|
|
810
810
|
}
|
|
811
811
|
return t;
|
|
812
812
|
}
|
|
813
|
-
async function
|
|
814
|
-
const t = new Headers(
|
|
813
|
+
async function In(e) {
|
|
814
|
+
const t = new Headers(Ge(e == null ? void 0 : e.headers, await Ln(e)));
|
|
815
815
|
if (!t.has("content-type")) {
|
|
816
|
-
const n =
|
|
816
|
+
const n = qn(e == null ? void 0 : e.body);
|
|
817
817
|
n && t.set("content-type", n);
|
|
818
818
|
}
|
|
819
819
|
return t;
|
|
820
820
|
}
|
|
821
|
-
function In(e) {
|
|
822
|
-
return We(e) ? "application/json" : null;
|
|
823
|
-
}
|
|
824
821
|
function qn(e) {
|
|
822
|
+
return $e(e) ? "application/json" : null;
|
|
823
|
+
}
|
|
824
|
+
function zn(e) {
|
|
825
825
|
const t = e.get("content-type");
|
|
826
826
|
return t ? t.split(";")[0].trim().toLowerCase() : null;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function Bn(e, t) {
|
|
829
829
|
const { body: n } = e;
|
|
830
|
-
return n ?
|
|
830
|
+
return n ? !$e(n) || typeof n == "string" ? n : zn(t) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n) : null;
|
|
831
831
|
}
|
|
832
832
|
function Fn(e, t) {
|
|
833
833
|
var n;
|
|
@@ -835,11 +835,11 @@ function Fn(e, t) {
|
|
|
835
835
|
return t.method.toUpperCase();
|
|
836
836
|
if (e.startsWith("@")) {
|
|
837
837
|
const r = (n = e.split("@")[1]) == null ? void 0 : n.split("/")[0];
|
|
838
|
-
return
|
|
838
|
+
return Ve.includes(r) ? r.toUpperCase() : t != null && t.body ? "POST" : "GET";
|
|
839
839
|
}
|
|
840
840
|
return t != null && t.body ? "POST" : "GET";
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Mn(e, t) {
|
|
843
843
|
let n;
|
|
844
844
|
return !(e != null && e.signal) && (e != null && e.timeout) && (n = setTimeout(() => t == null ? void 0 : t.abort(), e == null ? void 0 : e.timeout)), {
|
|
845
845
|
abortTimeout: n,
|
|
@@ -848,18 +848,18 @@ function Bn(e, t) {
|
|
|
848
848
|
}
|
|
849
849
|
};
|
|
850
850
|
}
|
|
851
|
-
var
|
|
851
|
+
var Dn = class Je extends Error {
|
|
852
852
|
constructor(t, n) {
|
|
853
|
-
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, Je.prototype);
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
856
|
async function G(e, t) {
|
|
857
857
|
const n = await e["~standard"].validate(t);
|
|
858
858
|
if (n.issues)
|
|
859
|
-
throw new
|
|
859
|
+
throw new Dn(n.issues);
|
|
860
860
|
return n.value;
|
|
861
861
|
}
|
|
862
|
-
var
|
|
862
|
+
var Ve = ["get", "post", "put", "patch", "delete"], Hn = (e) => ({
|
|
863
863
|
id: "apply-schema",
|
|
864
864
|
name: "Apply Schema",
|
|
865
865
|
version: "1.0.0",
|
|
@@ -878,36 +878,36 @@ var Je = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
878
878
|
if (u) {
|
|
879
879
|
let c = n == null ? void 0 : n.headers;
|
|
880
880
|
if (u.headers && !(n != null && n.disableValidation)) {
|
|
881
|
-
const
|
|
881
|
+
const h = {};
|
|
882
882
|
if (n != null && n.headers) {
|
|
883
883
|
if (n.headers instanceof Headers)
|
|
884
|
-
n.headers.forEach((
|
|
885
|
-
|
|
884
|
+
n.headers.forEach((b, x) => {
|
|
885
|
+
h[x.toLowerCase()] = b;
|
|
886
886
|
});
|
|
887
887
|
else if (typeof n.headers == "object")
|
|
888
|
-
for (const [
|
|
889
|
-
x != null && (
|
|
888
|
+
for (const [b, x] of Object.entries(n.headers))
|
|
889
|
+
x != null && (h[b.toLowerCase()] = x);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const p = await G(
|
|
892
892
|
u.headers,
|
|
893
|
-
|
|
894
|
-
),
|
|
895
|
-
for (const [
|
|
896
|
-
|
|
897
|
-
c =
|
|
893
|
+
h
|
|
894
|
+
), v = {};
|
|
895
|
+
for (const [b, x] of Object.entries(p))
|
|
896
|
+
v[b.toLowerCase()] = x;
|
|
897
|
+
c = v;
|
|
898
898
|
}
|
|
899
|
-
let
|
|
899
|
+
let g = C(N({}, n), {
|
|
900
900
|
method: u.method,
|
|
901
901
|
output: u.output,
|
|
902
902
|
headers: c
|
|
903
903
|
});
|
|
904
|
-
return n != null && n.disableValidation || (
|
|
904
|
+
return n != null && n.disableValidation || (g = C(N({}, g), {
|
|
905
905
|
body: u.input ? await G(u.input, n == null ? void 0 : n.body) : n == null ? void 0 : n.body,
|
|
906
906
|
params: u.params ? await G(u.params, n == null ? void 0 : n.params) : n == null ? void 0 : n.params,
|
|
907
907
|
query: u.query ? await G(u.query, n == null ? void 0 : n.query) : n == null ? void 0 : n.query
|
|
908
908
|
})), {
|
|
909
909
|
url: t,
|
|
910
|
-
options:
|
|
910
|
+
options: g
|
|
911
911
|
};
|
|
912
912
|
}
|
|
913
913
|
}
|
|
@@ -916,15 +916,15 @@ var Je = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
916
916
|
options: n
|
|
917
917
|
};
|
|
918
918
|
}
|
|
919
|
-
}),
|
|
919
|
+
}), Wn = (e) => {
|
|
920
920
|
async function t(n, r) {
|
|
921
|
-
const s = N(
|
|
922
|
-
headers:
|
|
923
|
-
plugins: [...(e == null ? void 0 : e.plugins) || [],
|
|
921
|
+
const s = C(N(N({}, e), r), {
|
|
922
|
+
headers: Ge(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
|
|
923
|
+
plugins: [...(e == null ? void 0 : e.plugins) || [], Hn(e || {}), ...(r == null ? void 0 : r.plugins) || []]
|
|
924
924
|
});
|
|
925
925
|
if (e != null && e.catchAllError)
|
|
926
926
|
try {
|
|
927
|
-
return await
|
|
927
|
+
return await ve(n, s);
|
|
928
928
|
} catch (i) {
|
|
929
929
|
return {
|
|
930
930
|
data: null,
|
|
@@ -936,19 +936,19 @@ var Je = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
|
|
|
936
936
|
}
|
|
937
937
|
};
|
|
938
938
|
}
|
|
939
|
-
return await
|
|
939
|
+
return await ve(n, s);
|
|
940
940
|
}
|
|
941
941
|
return t;
|
|
942
|
-
},
|
|
943
|
-
function
|
|
942
|
+
}, $n = (e) => e === "." || e === "..";
|
|
943
|
+
function Gn(e, t) {
|
|
944
944
|
let n = e;
|
|
945
945
|
for (const [r, s] of t)
|
|
946
946
|
n = n.replace(r, s);
|
|
947
|
-
if (
|
|
947
|
+
if ($n(n))
|
|
948
948
|
throw new TypeError("Path parameters cannot be reserved path segments");
|
|
949
949
|
return encodeURIComponent(n);
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Jn(e, t) {
|
|
952
952
|
const { baseURL: n, params: r, query: s } = t || {
|
|
953
953
|
query: {},
|
|
954
954
|
params: {},
|
|
@@ -956,141 +956,141 @@ function Gn(e, t) {
|
|
|
956
956
|
};
|
|
957
957
|
let i = e.startsWith("http") ? e.split("/").slice(0, 3).join("/") : n || "";
|
|
958
958
|
if (e.startsWith("@")) {
|
|
959
|
-
const
|
|
960
|
-
|
|
959
|
+
const h = e.toString().split("@")[1].split("/")[0];
|
|
960
|
+
Ve.includes(h) && (e = e.replace(`@${h}/`, "/"));
|
|
961
961
|
}
|
|
962
962
|
i.endsWith("/") || (i += "/");
|
|
963
963
|
let [l, d] = e.replace(i, "").split("?");
|
|
964
964
|
const a = new URLSearchParams(d);
|
|
965
|
-
for (const [
|
|
966
|
-
if (
|
|
967
|
-
let
|
|
968
|
-
if (typeof
|
|
969
|
-
|
|
970
|
-
else if (Array.isArray(
|
|
971
|
-
for (const
|
|
972
|
-
a.append(
|
|
965
|
+
for (const [h, p] of Object.entries(s || {})) {
|
|
966
|
+
if (p == null) continue;
|
|
967
|
+
let v;
|
|
968
|
+
if (typeof p == "string")
|
|
969
|
+
v = p;
|
|
970
|
+
else if (Array.isArray(p)) {
|
|
971
|
+
for (const b of p)
|
|
972
|
+
a.append(h, b);
|
|
973
973
|
continue;
|
|
974
974
|
} else
|
|
975
|
-
|
|
976
|
-
a.set(
|
|
975
|
+
v = JSON.stringify(p);
|
|
976
|
+
a.set(h, v);
|
|
977
977
|
}
|
|
978
978
|
const u = /* @__PURE__ */ new Map();
|
|
979
979
|
if (r)
|
|
980
980
|
if (Array.isArray(r)) {
|
|
981
|
-
const
|
|
982
|
-
for (const [
|
|
983
|
-
const
|
|
984
|
-
u.set(
|
|
981
|
+
const h = l.split("/").filter((p) => p.startsWith(":"));
|
|
982
|
+
for (const [p, v] of h.entries()) {
|
|
983
|
+
const b = r[p];
|
|
984
|
+
u.set(v, String(b));
|
|
985
985
|
}
|
|
986
986
|
} else
|
|
987
|
-
for (const [
|
|
988
|
-
u.set(`:${
|
|
989
|
-
l = l.split("/").map((
|
|
987
|
+
for (const [h, p] of Object.entries(r))
|
|
988
|
+
u.set(`:${h}`, String(p));
|
|
989
|
+
l = l.split("/").map((h) => Gn(h, u)).join("/"), l = l.replace(/^\/+/, "");
|
|
990
990
|
let c = a.toString();
|
|
991
991
|
return c = c.length > 0 ? `?${c}`.replace(/\+/g, "%20") : "", i.startsWith("http") ? new URL(`${l}${c}`, i) : `${i}${l}${c}`;
|
|
992
992
|
}
|
|
993
|
-
var
|
|
993
|
+
var ve = async (e, t) => {
|
|
994
994
|
var n, r, s, i, l, d, a, u;
|
|
995
995
|
const {
|
|
996
996
|
hooks: c,
|
|
997
|
-
url:
|
|
998
|
-
options:
|
|
999
|
-
} = await
|
|
997
|
+
url: g,
|
|
998
|
+
options: h
|
|
999
|
+
} = await Tn(e, t), p = Cn(h), v = new AbortController(), b = (n = h.signal) != null ? n : v.signal, x = Jn(g, h), E = await In(h), P = Bn(h, E), T = Fn(g, h), y = C(N({}, h), {
|
|
1000
1000
|
url: x,
|
|
1001
|
-
headers:
|
|
1002
|
-
body:
|
|
1003
|
-
method:
|
|
1004
|
-
signal:
|
|
1001
|
+
headers: E,
|
|
1002
|
+
body: P,
|
|
1003
|
+
method: T,
|
|
1004
|
+
signal: b
|
|
1005
1005
|
});
|
|
1006
|
-
for (const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
typeof
|
|
1006
|
+
for (const j of c.onRequest)
|
|
1007
|
+
if (j) {
|
|
1008
|
+
const f = await j(y);
|
|
1009
|
+
typeof f == "object" && f !== null && Object.assign(y, f);
|
|
1010
1010
|
}
|
|
1011
|
-
("pipeTo" in
|
|
1012
|
-
const { clearTimeout:
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1015
|
-
const
|
|
1016
|
-
response:
|
|
1017
|
-
request:
|
|
1011
|
+
("pipeTo" in y && typeof y.pipeTo == "function" || typeof ((r = t == null ? void 0 : t.body) == null ? void 0 : r.pipe) == "function") && ("duplex" in y || (y.duplex = "half"));
|
|
1012
|
+
const { clearTimeout: _ } = Mn(h, v);
|
|
1013
|
+
let m = await p(y.url, y);
|
|
1014
|
+
_();
|
|
1015
|
+
const O = {
|
|
1016
|
+
response: m,
|
|
1017
|
+
request: y
|
|
1018
1018
|
};
|
|
1019
|
-
for (const
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
-
response: (s = t == null ? void 0 : t.hookOptions) != null && s.cloneResponse ?
|
|
1019
|
+
for (const j of c.onResponse)
|
|
1020
|
+
if (j) {
|
|
1021
|
+
const f = await j(C(N({}, O), {
|
|
1022
|
+
response: (s = t == null ? void 0 : t.hookOptions) != null && s.cloneResponse ? m.clone() : m
|
|
1023
1023
|
}));
|
|
1024
|
-
|
|
1024
|
+
f instanceof Response ? m = f : typeof f == "object" && f !== null && (m = f.response);
|
|
1025
1025
|
}
|
|
1026
|
-
if (
|
|
1027
|
-
if (!(
|
|
1026
|
+
if (m.ok) {
|
|
1027
|
+
if (!(y.method !== "HEAD"))
|
|
1028
1028
|
return {
|
|
1029
1029
|
data: "",
|
|
1030
1030
|
error: null
|
|
1031
1031
|
};
|
|
1032
|
-
const
|
|
1032
|
+
const f = Nn(m), A = {
|
|
1033
1033
|
data: null,
|
|
1034
|
-
response:
|
|
1035
|
-
request:
|
|
1034
|
+
response: m,
|
|
1035
|
+
request: y
|
|
1036
1036
|
};
|
|
1037
|
-
if (
|
|
1038
|
-
const I = await
|
|
1039
|
-
|
|
1037
|
+
if (f === "json" || f === "text") {
|
|
1038
|
+
const I = await m.text(), Ke = (i = y.jsonParser) != null ? i : Ae;
|
|
1039
|
+
A.data = await Ke(I);
|
|
1040
1040
|
} else
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1041
|
+
A.data = await m[f]();
|
|
1042
|
+
y != null && y.output && y.output && !y.disableValidation && (A.data = await G(
|
|
1043
|
+
y.output,
|
|
1044
|
+
A.data
|
|
1045
1045
|
));
|
|
1046
1046
|
for (const I of c.onSuccess)
|
|
1047
|
-
I && await I(N(
|
|
1048
|
-
response: (l = t == null ? void 0 : t.hookOptions) != null && l.cloneResponse ?
|
|
1047
|
+
I && await I(C(N({}, A), {
|
|
1048
|
+
response: (l = t == null ? void 0 : t.hookOptions) != null && l.cloneResponse ? m.clone() : m
|
|
1049
1049
|
}));
|
|
1050
|
-
return t != null && t.throw ?
|
|
1051
|
-
data:
|
|
1050
|
+
return t != null && t.throw ? A.data : {
|
|
1051
|
+
data: A.data,
|
|
1052
1052
|
error: null
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
const
|
|
1056
|
-
response:
|
|
1057
|
-
responseText:
|
|
1058
|
-
request:
|
|
1059
|
-
error: N(
|
|
1060
|
-
status:
|
|
1061
|
-
statusText:
|
|
1055
|
+
const L = (d = t == null ? void 0 : t.jsonParser) != null ? d : Ae, w = await m.text(), q = Un(w), D = q ? await L(w) : null, K = {
|
|
1056
|
+
response: m,
|
|
1057
|
+
responseText: w,
|
|
1058
|
+
request: y,
|
|
1059
|
+
error: C(N({}, D), {
|
|
1060
|
+
status: m.status,
|
|
1061
|
+
statusText: m.statusText
|
|
1062
1062
|
})
|
|
1063
1063
|
};
|
|
1064
|
-
for (const
|
|
1065
|
-
|
|
1066
|
-
response: (a = t == null ? void 0 : t.hookOptions) != null && a.cloneResponse ?
|
|
1064
|
+
for (const j of c.onError)
|
|
1065
|
+
j && await j(C(N({}, K), {
|
|
1066
|
+
response: (a = t == null ? void 0 : t.hookOptions) != null && a.cloneResponse ? m.clone() : m
|
|
1067
1067
|
}));
|
|
1068
1068
|
if (t != null && t.retry) {
|
|
1069
|
-
const
|
|
1070
|
-
if (await
|
|
1069
|
+
const j = jn(t.retry), f = (u = t.retryAttempt) != null ? u : 0;
|
|
1070
|
+
if (await j.shouldAttemptRetry(f, m)) {
|
|
1071
1071
|
for (const I of c.onRetry)
|
|
1072
|
-
I && await I(
|
|
1073
|
-
const
|
|
1074
|
-
return await new Promise((I) => setTimeout(I,
|
|
1075
|
-
retryAttempt:
|
|
1072
|
+
I && await I(O);
|
|
1073
|
+
const A = j.getDelay(f);
|
|
1074
|
+
return await new Promise((I) => setTimeout(I, A)), await ve(e, C(N({}, t), {
|
|
1075
|
+
retryAttempt: f + 1
|
|
1076
1076
|
}));
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
if (t != null && t.throw)
|
|
1080
|
-
throw new
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1080
|
+
throw new On(
|
|
1081
|
+
m.status,
|
|
1082
|
+
m.statusText,
|
|
1083
|
+
q ? D : w
|
|
1084
1084
|
);
|
|
1085
1085
|
return {
|
|
1086
1086
|
data: null,
|
|
1087
|
-
error: N(
|
|
1088
|
-
status:
|
|
1089
|
-
statusText:
|
|
1087
|
+
error: C(N({}, D), {
|
|
1088
|
+
status: m.status,
|
|
1089
|
+
statusText: m.statusText
|
|
1090
1090
|
})
|
|
1091
1091
|
};
|
|
1092
1092
|
};
|
|
1093
|
-
const
|
|
1093
|
+
const Vn = (e) => {
|
|
1094
1094
|
if (typeof process > "u") return;
|
|
1095
1095
|
const t = e ?? "/api/auth";
|
|
1096
1096
|
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
@@ -1105,99 +1105,99 @@ const Jn = (e) => {
|
|
|
1105
1105
|
} catch {
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
},
|
|
1109
|
-
var
|
|
1110
|
-
const n = "credentials" in Request.prototype, r =
|
|
1108
|
+
}, Kn = (e, t) => {
|
|
1109
|
+
var O, L, w, q, D, K, j;
|
|
1110
|
+
const n = "credentials" in Request.prototype, r = Mt(e == null ? void 0 : e.baseURL, e == null ? void 0 : e.basePath) ?? Vn(e == null ? void 0 : e.basePath) ?? "/api/auth", s = ((O = e == null ? void 0 : e.plugins) == null ? void 0 : O.flatMap((f) => f.fetchPlugins).filter((f) => f !== void 0)) || [], i = {
|
|
1111
1111
|
id: "lifecycle-hooks",
|
|
1112
1112
|
name: "lifecycle-hooks",
|
|
1113
1113
|
hooks: {
|
|
1114
|
-
onSuccess: (
|
|
1115
|
-
onError: (
|
|
1116
|
-
onRequest: (
|
|
1117
|
-
onResponse: (
|
|
1114
|
+
onSuccess: (L = e == null ? void 0 : e.fetchOptions) == null ? void 0 : L.onSuccess,
|
|
1115
|
+
onError: (w = e == null ? void 0 : e.fetchOptions) == null ? void 0 : w.onError,
|
|
1116
|
+
onRequest: (q = e == null ? void 0 : e.fetchOptions) == null ? void 0 : q.onRequest,
|
|
1117
|
+
onResponse: (D = e == null ? void 0 : e.fetchOptions) == null ? void 0 : D.onResponse
|
|
1118
1118
|
}
|
|
1119
|
-
}, { onSuccess: l, onError: d, onRequest: a, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {},
|
|
1119
|
+
}, { onSuccess: l, onError: d, onRequest: a, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {}, g = Wn({
|
|
1120
1120
|
baseURL: r,
|
|
1121
1121
|
...n ? { credentials: "include" } : {},
|
|
1122
1122
|
method: "GET",
|
|
1123
|
-
jsonParser(
|
|
1124
|
-
return
|
|
1123
|
+
jsonParser(f) {
|
|
1124
|
+
return f ? Vt(f, { strict: !1 }) : null;
|
|
1125
1125
|
},
|
|
1126
1126
|
customFetchImpl: fetch,
|
|
1127
1127
|
...c,
|
|
1128
1128
|
plugins: [
|
|
1129
1129
|
i,
|
|
1130
1130
|
...c.plugins || [],
|
|
1131
|
-
...e != null && e.disableDefaultFetchPlugins ? [] : [
|
|
1131
|
+
...e != null && e.disableDefaultFetchPlugins ? [] : [Yt],
|
|
1132
1132
|
...s
|
|
1133
1133
|
]
|
|
1134
|
-
}), { $sessionSignal:
|
|
1135
|
-
let
|
|
1136
|
-
const x = (
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1139
|
-
let
|
|
1140
|
-
const
|
|
1141
|
-
$sessionSignal:
|
|
1142
|
-
session:
|
|
1143
|
-
},
|
|
1134
|
+
}), { $sessionSignal: h, session: p, broadcastSessionUpdate: v } = vn(g, e);
|
|
1135
|
+
let b = !1;
|
|
1136
|
+
const x = (f) => {
|
|
1137
|
+
b || f === null || (b = !0, mn(p, f));
|
|
1138
|
+
}, E = (e == null ? void 0 : e.plugins) || [];
|
|
1139
|
+
let P = {};
|
|
1140
|
+
const T = {
|
|
1141
|
+
$sessionSignal: h,
|
|
1142
|
+
session: p
|
|
1143
|
+
}, y = {
|
|
1144
1144
|
"/sign-out": "POST",
|
|
1145
1145
|
"/revoke-sessions": "POST",
|
|
1146
1146
|
"/revoke-other-sessions": "POST",
|
|
1147
1147
|
"/delete-user": "POST"
|
|
1148
|
-
},
|
|
1148
|
+
}, _ = [{
|
|
1149
1149
|
signal: "$sessionSignal",
|
|
1150
|
-
matcher(
|
|
1151
|
-
return
|
|
1150
|
+
matcher(f) {
|
|
1151
|
+
return f === "/sign-out" || f === "/update-user" || f === "/update-session" || f === "/sign-up/email" || f === "/sign-in/email" || f === "/delete-user" || f === "/verify-email" || f === "/revoke-sessions" || f === "/revoke-session" || f === "/revoke-other-sessions" || f === "/change-email" || f === "/change-password";
|
|
1152
1152
|
},
|
|
1153
|
-
callback(
|
|
1154
|
-
|
|
1153
|
+
callback(f) {
|
|
1154
|
+
f === "/sign-out" ? v("signout") : (f === "/update-user" || f === "/update-session") && v("updateUser");
|
|
1155
1155
|
}
|
|
1156
1156
|
}];
|
|
1157
|
-
for (const
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
notify: (
|
|
1161
|
-
|
|
1157
|
+
for (const f of E)
|
|
1158
|
+
f.getAtoms && Object.assign(T, (K = f.getAtoms) == null ? void 0 : K.call(f, g)), f.pathMethods && Object.assign(y, f.pathMethods), f.atomListeners && _.push(...f.atomListeners);
|
|
1159
|
+
const m = {
|
|
1160
|
+
notify: (f) => {
|
|
1161
|
+
T[f].set(!T[f].get());
|
|
1162
1162
|
},
|
|
1163
|
-
listen: (
|
|
1164
|
-
|
|
1163
|
+
listen: (f, A) => {
|
|
1164
|
+
T[f].subscribe(A);
|
|
1165
1165
|
},
|
|
1166
|
-
atoms:
|
|
1166
|
+
atoms: T
|
|
1167
1167
|
};
|
|
1168
|
-
for (const
|
|
1168
|
+
for (const f of E) f.getActions && (P = wn(((j = f.getActions) == null ? void 0 : j.call(f, g, m, e)) ?? {}, P));
|
|
1169
1169
|
return {
|
|
1170
1170
|
get baseURL() {
|
|
1171
1171
|
return r;
|
|
1172
1172
|
},
|
|
1173
|
-
pluginsActions:
|
|
1174
|
-
pluginsAtoms:
|
|
1175
|
-
pluginPathMethods:
|
|
1176
|
-
atomListeners:
|
|
1173
|
+
pluginsActions: P,
|
|
1174
|
+
pluginsAtoms: T,
|
|
1175
|
+
pluginPathMethods: y,
|
|
1176
|
+
atomListeners: _,
|
|
1177
1177
|
hydrateSession: x,
|
|
1178
|
-
$sessionSignal:
|
|
1179
|
-
$fetch:
|
|
1180
|
-
$store:
|
|
1178
|
+
$sessionSignal: h,
|
|
1179
|
+
$fetch: g,
|
|
1180
|
+
$store: m
|
|
1181
1181
|
};
|
|
1182
1182
|
};
|
|
1183
|
-
function
|
|
1183
|
+
function Xn(e) {
|
|
1184
1184
|
return typeof e == "object" && e !== null && "get" in e && typeof e.get == "function" && "lc" in e && typeof e.lc == "number";
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function Yn(e) {
|
|
1187
1187
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1190
|
-
function Zn(e) {
|
|
1191
|
-
return e.replace(Qn, "").match(Yn) ?? [];
|
|
1192
|
-
}
|
|
1189
|
+
const Qn = new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+", "gu"), Zn = /['\u2019]/g;
|
|
1193
1190
|
function er(e) {
|
|
1194
|
-
return
|
|
1191
|
+
return e.replace(Zn, "").match(Qn) ?? [];
|
|
1195
1192
|
}
|
|
1196
|
-
function tr(e
|
|
1193
|
+
function tr(e) {
|
|
1194
|
+
return er(e).map((t) => t.toLowerCase()).join("-");
|
|
1195
|
+
}
|
|
1196
|
+
function nr(e, t, n) {
|
|
1197
1197
|
const r = t[e], { fetchOptions: s, query: i, ...l } = n || {};
|
|
1198
1198
|
return r || (s != null && s.method ? s.method : l && Object.keys(l).length > 0 ? "POST" : "GET");
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function rr(e, t, n, r, s) {
|
|
1201
1201
|
function i(l = []) {
|
|
1202
1202
|
return new Proxy(function() {
|
|
1203
1203
|
}, {
|
|
@@ -1205,41 +1205,41 @@ function nr(e, t, n, r, s) {
|
|
|
1205
1205
|
if (typeof a != "string" || a === "then" || a === "catch" || a === "finally") return;
|
|
1206
1206
|
const u = [...l, a];
|
|
1207
1207
|
let c = e;
|
|
1208
|
-
for (const
|
|
1208
|
+
for (const g of u) if (c && typeof c == "object" && g in c) c = c[g];
|
|
1209
1209
|
else {
|
|
1210
1210
|
c = void 0;
|
|
1211
1211
|
break;
|
|
1212
1212
|
}
|
|
1213
|
-
return typeof c == "function" ||
|
|
1213
|
+
return typeof c == "function" || Xn(c) ? c : i(u);
|
|
1214
1214
|
},
|
|
1215
1215
|
apply: async (d, a, u) => {
|
|
1216
|
-
const c = "/" + l.map(
|
|
1217
|
-
...
|
|
1218
|
-
...
|
|
1219
|
-
},
|
|
1216
|
+
const c = "/" + l.map(tr).join("/"), g = u[0] || {}, h = u[1] || {}, { query: p, fetchOptions: v, ...b } = g, x = {
|
|
1217
|
+
...h,
|
|
1218
|
+
...v
|
|
1219
|
+
}, E = nr(c, n, g);
|
|
1220
1220
|
return await t(c, {
|
|
1221
1221
|
...x,
|
|
1222
|
-
body:
|
|
1223
|
-
...
|
|
1222
|
+
body: E === "GET" ? void 0 : {
|
|
1223
|
+
...b,
|
|
1224
1224
|
...(x == null ? void 0 : x.body) || {}
|
|
1225
1225
|
},
|
|
1226
|
-
query:
|
|
1227
|
-
method:
|
|
1228
|
-
async onSuccess(
|
|
1229
|
-
var
|
|
1230
|
-
if (await ((
|
|
1231
|
-
const
|
|
1232
|
-
if (!
|
|
1233
|
-
const
|
|
1234
|
-
for (const
|
|
1235
|
-
const
|
|
1236
|
-
if (!
|
|
1237
|
-
if (
|
|
1238
|
-
|
|
1239
|
-
const
|
|
1226
|
+
query: p || (x == null ? void 0 : x.query),
|
|
1227
|
+
method: E,
|
|
1228
|
+
async onSuccess(P) {
|
|
1229
|
+
var _, m;
|
|
1230
|
+
if (await ((_ = x == null ? void 0 : x.onSuccess) == null ? void 0 : _.call(x, P)), !s || x.disableSignal) return;
|
|
1231
|
+
const T = s.filter((O) => O.matcher(c));
|
|
1232
|
+
if (!T.length) return;
|
|
1233
|
+
const y = /* @__PURE__ */ new Set();
|
|
1234
|
+
for (const O of T) {
|
|
1235
|
+
const L = r[O.signal];
|
|
1236
|
+
if (!L) return;
|
|
1237
|
+
if (y.has(O.signal)) continue;
|
|
1238
|
+
y.add(O.signal);
|
|
1239
|
+
const w = L.get();
|
|
1240
1240
|
setTimeout(() => {
|
|
1241
|
-
|
|
1242
|
-
}, 10), (
|
|
1241
|
+
L.set(!w);
|
|
1242
|
+
}, 10), (m = O.callback) == null || m.call(O, c);
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
});
|
|
@@ -1248,22 +1248,22 @@ function nr(e, t, n, r, s) {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
return i();
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
const n =
|
|
1251
|
+
function sr(e, t = {}) {
|
|
1252
|
+
const n = Qe(e.get()), { keys: r, deps: s = [e, r] } = t, i = Ze((d) => {
|
|
1253
1253
|
const a = (u) => {
|
|
1254
1254
|
n.current !== u && (n.current = u, d());
|
|
1255
1255
|
};
|
|
1256
|
-
return a(e.value), r != null && r.length ?
|
|
1256
|
+
return a(e.value), r != null && r.length ? an(e, r, a) : e.listen(a);
|
|
1257
1257
|
}, s), l = () => n.current;
|
|
1258
|
-
return
|
|
1259
|
-
}
|
|
1260
|
-
function sr(e) {
|
|
1261
|
-
return `use${Xn(e)}`;
|
|
1258
|
+
return et(i, l, l);
|
|
1262
1259
|
}
|
|
1263
1260
|
function ir(e) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1261
|
+
return `use${Yn(e)}`;
|
|
1262
|
+
}
|
|
1263
|
+
function ar(e) {
|
|
1264
|
+
const { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, hydrateSession: s, $fetch: i, $store: l, atomListeners: d } = Kn(e), a = {};
|
|
1265
|
+
for (const [u, c] of Object.entries(r)) a[ir(u)] = () => sr(c);
|
|
1266
|
+
return rr({
|
|
1267
1267
|
...n,
|
|
1268
1268
|
...a,
|
|
1269
1269
|
hydrateSession: s,
|
|
@@ -1271,78 +1271,99 @@ function ir(e) {
|
|
|
1271
1271
|
$store: l
|
|
1272
1272
|
}, i, t, r, d);
|
|
1273
1273
|
}
|
|
1274
|
-
var
|
|
1275
|
-
const
|
|
1274
|
+
var or = "1.7.3";
|
|
1275
|
+
const lr = or, cr = () => ({
|
|
1276
1276
|
id: "magic-link",
|
|
1277
|
-
version:
|
|
1277
|
+
version: lr,
|
|
1278
1278
|
$InferServerPlugin: {}
|
|
1279
1279
|
});
|
|
1280
1280
|
let Ue = null;
|
|
1281
|
-
function
|
|
1282
|
-
return Ue ?? (Ue =
|
|
1283
|
-
baseURL:
|
|
1284
|
-
plugins: [
|
|
1281
|
+
function M() {
|
|
1282
|
+
return Ue ?? (Ue = ar({
|
|
1283
|
+
baseURL: rt(),
|
|
1284
|
+
plugins: [cr()]
|
|
1285
1285
|
})), Ue;
|
|
1286
1286
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1287
|
+
const ge = {
|
|
1288
|
+
terms: "https://backmatter.app/legal/terms",
|
|
1289
|
+
privacy: "https://backmatter.app/legal/privacy",
|
|
1290
|
+
dpa: "https://backmatter.app/legal/dpa"
|
|
1291
|
+
};
|
|
1292
|
+
function ur() {
|
|
1293
|
+
const [e] = be(), [t, n] = S(null), [r, s] = S(null), [i, l] = S(!1), [d, a] = S(null), u = e.get("token") ? e.get("email") ?? "" : "", [c, g] = S(u || (e.get("email") ?? "")), [h, p] = S(""), [v, b] = S(""), [x, E] = S("signin"), [P, T] = S(!1), y = x === "signup" && !P;
|
|
1289
1294
|
V(() => {
|
|
1290
|
-
|
|
1295
|
+
st().then((w) => a(w.github)).catch(() => a(!1));
|
|
1291
1296
|
}, []);
|
|
1292
|
-
const
|
|
1293
|
-
async function
|
|
1297
|
+
const _ = window.location.href;
|
|
1298
|
+
async function m() {
|
|
1294
1299
|
l(!0), n(null);
|
|
1295
1300
|
try {
|
|
1296
|
-
await
|
|
1301
|
+
await M().signIn.social({
|
|
1297
1302
|
provider: "github",
|
|
1298
|
-
callbackURL:
|
|
1303
|
+
callbackURL: _
|
|
1299
1304
|
});
|
|
1300
|
-
} catch (
|
|
1301
|
-
n(
|
|
1305
|
+
} catch (w) {
|
|
1306
|
+
n(w instanceof Error ? w.message : "GitHub sign-in failed"), l(!1);
|
|
1302
1307
|
}
|
|
1303
1308
|
}
|
|
1304
|
-
async function
|
|
1309
|
+
async function O() {
|
|
1305
1310
|
l(!0), n(null), s(null);
|
|
1306
|
-
const
|
|
1311
|
+
const w = await M().signIn.magicLink({
|
|
1307
1312
|
email: c,
|
|
1308
|
-
callbackURL:
|
|
1313
|
+
callbackURL: _
|
|
1309
1314
|
});
|
|
1310
|
-
if (l(!1),
|
|
1311
|
-
n(
|
|
1315
|
+
if (l(!1), w.error) {
|
|
1316
|
+
n(w.error.message ?? "Could not send the magic link");
|
|
1312
1317
|
return;
|
|
1313
1318
|
}
|
|
1314
1319
|
s("Check your email for a sign-in link.");
|
|
1315
1320
|
}
|
|
1316
|
-
async function
|
|
1317
|
-
|
|
1318
|
-
const
|
|
1321
|
+
async function L(w) {
|
|
1322
|
+
w.preventDefault(), l(!0), n(null);
|
|
1323
|
+
const q = x === "signup" ? await M().signUp.email({
|
|
1319
1324
|
email: c,
|
|
1320
|
-
password:
|
|
1321
|
-
name:
|
|
1322
|
-
callbackURL:
|
|
1323
|
-
}) : await
|
|
1325
|
+
password: h,
|
|
1326
|
+
name: v,
|
|
1327
|
+
callbackURL: _
|
|
1328
|
+
}) : await M().signIn.email({
|
|
1324
1329
|
email: c,
|
|
1325
|
-
password:
|
|
1326
|
-
callbackURL:
|
|
1330
|
+
password: h,
|
|
1331
|
+
callbackURL: _
|
|
1327
1332
|
});
|
|
1328
|
-
if (
|
|
1329
|
-
n(
|
|
1333
|
+
if (q.error) {
|
|
1334
|
+
n(q.error.message ?? "Sign-in failed"), l(!1);
|
|
1330
1335
|
return;
|
|
1331
1336
|
}
|
|
1332
|
-
window.location.assign(
|
|
1337
|
+
window.location.assign(_);
|
|
1333
1338
|
}
|
|
1334
|
-
return /* @__PURE__ */ k("main", { ...
|
|
1339
|
+
return /* @__PURE__ */ k("main", { ...at(ot, fr.main), children: [
|
|
1335
1340
|
/* @__PURE__ */ o("div", { className: "x10l6tqk x10a8y8t x47corl x87ps6o xlxt4rd", "aria-hidden": !0 }),
|
|
1336
1341
|
/* @__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(
|
|
1342
|
+
/* @__PURE__ */ o("div", { className: "xrvj5dj x1ku5rj1 x1useyqa xsdox4t x1y5o9j5 x1n0nidx", children: /* @__PURE__ */ o(dr, {}) }),
|
|
1338
1343
|
/* @__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(
|
|
1344
|
+
/* @__PURE__ */ o("div", { className: "x1g7u8ds", children: /* @__PURE__ */ o(R, { 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
1345
|
/* @__PURE__ */ k("div", { className: "x78zum5 xh8yej3 x1tfhste xdt5ytf x6s0dn4 x11cgr9k", children: [
|
|
1341
|
-
t ? /* @__PURE__ */ o(
|
|
1342
|
-
r ? /* @__PURE__ */ o(
|
|
1343
|
-
/* @__PURE__ */ k("
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
+
t ? /* @__PURE__ */ o(R, { tone: "danger", children: t }) : null,
|
|
1347
|
+
r ? /* @__PURE__ */ o(R, { tone: "muted", children: r }) : null,
|
|
1348
|
+
/* @__PURE__ */ k("p", { className: "x1ghz6dp x1vrk1b5 x1evy7pa x111yfic xdpxx8g", children: [
|
|
1349
|
+
"By continuing you agree to the",
|
|
1350
|
+
" ",
|
|
1351
|
+
/* @__PURE__ */ o("a", { href: ge.terms, className: "xqjzbou xrys4gj", children: "Terms" }),
|
|
1352
|
+
" and the",
|
|
1353
|
+
" ",
|
|
1354
|
+
/* @__PURE__ */ o("a", { href: ge.dpa, className: "xqjzbou xrys4gj", children: "Data Processing Agreement" }),
|
|
1355
|
+
", and you acknowledge the",
|
|
1356
|
+
" ",
|
|
1357
|
+
/* @__PURE__ */ o("a", { href: ge.privacy, className: "xqjzbou xrys4gj", children: "Privacy policy" }),
|
|
1358
|
+
". A consumer who asks us to start the service now loses the 14-day right of withdrawal once it has begun."
|
|
1359
|
+
] }),
|
|
1360
|
+
x === "signup" ? /* @__PURE__ */ k("label", { className: "x78zum5 xh8yej3 x3smv4v x1cy8zhl x1gg8mnh xdpxx8g x1vrk1b5 x1evy7pa xqjzbou x1ypdohk", children: [
|
|
1361
|
+
/* @__PURE__ */ o("input", { type: "checkbox", checked: P, onChange: (w) => T(w.target.checked), className: "x1xp8n7a xmix8c7 xr9ek0c x2lah0s x1kb3qnp" }),
|
|
1362
|
+
/* @__PURE__ */ o("span", { children: "I agree, and I ask Backmatter to start the service now." })
|
|
1363
|
+
] }) : null,
|
|
1364
|
+
/* @__PURE__ */ k("form", { onSubmit: (w) => void L(w), className: "x78zum5 xh8yej3 xdt5ytf x1ndbd79", children: [
|
|
1365
|
+
x === "signup" ? /* @__PURE__ */ o("input", { required: !0, value: v, onChange: (w) => b(w.target.value), placeholder: "Name", autoComplete: "name", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }) : null,
|
|
1366
|
+
/* @__PURE__ */ o("input", { required: !0, type: "email", value: c, onChange: (w) => g(w.target.value), placeholder: "Email", autoComplete: "email", readOnly: !!u, ...{
|
|
1346
1367
|
0: {
|
|
1347
1368
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d"
|
|
1348
1369
|
},
|
|
@@ -1350,48 +1371,48 @@ function cr() {
|
|
|
1350
1371
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x1l3a84d x10jjolp"
|
|
1351
1372
|
}
|
|
1352
1373
|
}[!!u << 0] }),
|
|
1353
|
-
/* @__PURE__ */ o("input", { required: !0, type: "password", value:
|
|
1354
|
-
/* @__PURE__ */ o("button", { type: "submit", disabled: i, ...{
|
|
1374
|
+
/* @__PURE__ */ o("input", { required: !0, type: "password", value: h, onChange: (w) => p(w.target.value), placeholder: "Password", autoComplete: x === "signup" ? "new-password" : "current-password", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }),
|
|
1375
|
+
/* @__PURE__ */ o("button", { type: "submit", disabled: i || y, ...{
|
|
1355
1376
|
0: {
|
|
1356
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"
|
|
1357
1378
|
},
|
|
1358
1379
|
1: {
|
|
1359
1380
|
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"
|
|
1360
1381
|
}
|
|
1361
|
-
}[!!i << 0], children: x === "signup" ? "Create account" : "Sign in" })
|
|
1382
|
+
}[!!(i || y) << 0], children: x === "signup" ? "Create account" : "Sign in" })
|
|
1362
1383
|
] }),
|
|
1363
|
-
/* @__PURE__ */ o("button", { type: "button", disabled: i || !c, onClick: () => void
|
|
1384
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i || !c || y, onClick: () => void O(), ...{
|
|
1364
1385
|
0: {
|
|
1365
1386
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk"
|
|
1366
1387
|
},
|
|
1367
1388
|
1: {
|
|
1368
1389
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 xwq05k6 x1h6gzvc x47corl"
|
|
1369
1390
|
}
|
|
1370
|
-
}[!!(i || !c) << 0], children: "Email me a magic link" }),
|
|
1371
|
-
/* @__PURE__ */ o("button", { type: "button", disabled: i, onClick: () =>
|
|
1372
|
-
/* @__PURE__ */ k("button", { type: "button", disabled: i || d !== !0, onClick: () => void
|
|
1391
|
+
}[!!(i || !c || y) << 0], children: "Email me a magic link" }),
|
|
1392
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i, onClick: () => E(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" }),
|
|
1393
|
+
/* @__PURE__ */ k("button", { type: "button", disabled: i || d !== !0 || y, onClick: () => void m(), ...{
|
|
1373
1394
|
0: {
|
|
1374
1395
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1375
1396
|
},
|
|
1376
1397
|
1: {
|
|
1377
1398
|
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"
|
|
1378
1399
|
}
|
|
1379
|
-
}[!!(i || d !== !0) << 0], children: [
|
|
1380
|
-
/* @__PURE__ */ o(
|
|
1400
|
+
}[!!(i || d !== !0 || y) << 0], children: [
|
|
1401
|
+
/* @__PURE__ */ o(it, { size: 18 }),
|
|
1381
1402
|
"Continue with GitHub"
|
|
1382
1403
|
] })
|
|
1383
1404
|
] })
|
|
1384
1405
|
] })
|
|
1385
1406
|
] });
|
|
1386
1407
|
}
|
|
1387
|
-
function
|
|
1408
|
+
function dr() {
|
|
1388
1409
|
return /* @__PURE__ */ k("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
|
|
1389
1410
|
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "18.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.28" }),
|
|
1390
1411
|
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "11.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.55" }),
|
|
1391
1412
|
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "4", fill: "currentColor" })
|
|
1392
1413
|
] });
|
|
1393
1414
|
}
|
|
1394
|
-
const
|
|
1415
|
+
const fr = {
|
|
1395
1416
|
main: {
|
|
1396
1417
|
kVAEAm: "x1n2onr6",
|
|
1397
1418
|
k1xSpc: "x78zum5",
|
|
@@ -1408,47 +1429,47 @@ const dr = {
|
|
|
1408
1429
|
$$css: !0
|
|
1409
1430
|
}
|
|
1410
1431
|
};
|
|
1411
|
-
function
|
|
1432
|
+
function hr() {
|
|
1412
1433
|
var s;
|
|
1413
|
-
const { userId: e } =
|
|
1414
|
-
return r === "/workspaces" && n &&
|
|
1434
|
+
const { userId: e } = Ce(), t = Ie(), n = qe(e), r = lt(n, ((s = t.control) == null ? void 0 : s.workspaces) ?? []);
|
|
1435
|
+
return r === "/workspaces" && n && ct(e), /* @__PURE__ */ o(ze, { to: r, replace: !0 });
|
|
1415
1436
|
}
|
|
1416
|
-
function
|
|
1437
|
+
function pr({
|
|
1417
1438
|
to: e,
|
|
1418
1439
|
title: t,
|
|
1419
1440
|
meta: n,
|
|
1420
1441
|
trailing: r
|
|
1421
1442
|
}) {
|
|
1422
|
-
const s = /* @__PURE__ */ k(
|
|
1443
|
+
const s = /* @__PURE__ */ k(me, { children: [
|
|
1423
1444
|
/* @__PURE__ */ k("span", { className: "x78zum5 xeuugli xdt5ytf x195vfkc", children: [
|
|
1424
1445
|
/* @__PURE__ */ o("span", { className: "x17tv04q xk50ysn", children: t }),
|
|
1425
1446
|
n ? /* @__PURE__ */ o("span", { className: "x1vrk1b5 x111yfic", children: n }) : null
|
|
1426
1447
|
] }),
|
|
1427
1448
|
r ? /* @__PURE__ */ o("span", { className: "x2lah0s x1vrk1b5 x111yfic", children: r }) : null
|
|
1428
1449
|
] });
|
|
1429
|
-
return e ? /* @__PURE__ */ o(
|
|
1450
|
+
return e ? /* @__PURE__ */ o(ut, { to: e, className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb", children: s }) : /* @__PURE__ */ o("div", { className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb xt0e3qv", children: s });
|
|
1430
1451
|
}
|
|
1431
|
-
function
|
|
1452
|
+
function gr({
|
|
1432
1453
|
children: e
|
|
1433
1454
|
}) {
|
|
1434
1455
|
return /* @__PURE__ */ o("div", { className: "x78zum5 xdt5ytf xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xb3r6kr", children: e });
|
|
1435
1456
|
}
|
|
1436
|
-
function
|
|
1457
|
+
function mr() {
|
|
1437
1458
|
var t;
|
|
1438
|
-
const e = ((t =
|
|
1459
|
+
const e = ((t = Ie().control) == null ? void 0 : t.workspaces) ?? [];
|
|
1439
1460
|
return /* @__PURE__ */ k(ie, { centered: !0, children: [
|
|
1440
1461
|
/* @__PURE__ */ o(
|
|
1441
1462
|
J,
|
|
1442
1463
|
{
|
|
1443
1464
|
title: "Workspaces",
|
|
1444
1465
|
description: "Each workspace is a site and a team.",
|
|
1445
|
-
action: /* @__PURE__ */ o(
|
|
1466
|
+
action: /* @__PURE__ */ o(Be, { to: "/workspaces/new", children: "New workspace" })
|
|
1446
1467
|
}
|
|
1447
1468
|
),
|
|
1448
|
-
e.length === 0 ? /* @__PURE__ */ o(
|
|
1449
|
-
|
|
1469
|
+
e.length === 0 ? /* @__PURE__ */ o(R, { tone: "muted", children: "No workspaces yet." }) : /* @__PURE__ */ o(gr, { children: e.map((n) => /* @__PURE__ */ o(
|
|
1470
|
+
pr,
|
|
1450
1471
|
{
|
|
1451
|
-
to:
|
|
1472
|
+
to: dt(n.slug),
|
|
1452
1473
|
title: n.name,
|
|
1453
1474
|
meta: n.role
|
|
1454
1475
|
},
|
|
@@ -1456,13 +1477,13 @@ function gr() {
|
|
|
1456
1477
|
)) })
|
|
1457
1478
|
] });
|
|
1458
1479
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const e = Fe(), [t, n] =
|
|
1480
|
+
function xr() {
|
|
1481
|
+
const e = Fe(), [t, n] = S(""), [r, s] = S(null), [i, l] = S(!1);
|
|
1461
1482
|
async function d(a) {
|
|
1462
1483
|
a.preventDefault(), l(!0), s(null);
|
|
1463
1484
|
try {
|
|
1464
|
-
const { workspace: u } = await
|
|
1465
|
-
c &&
|
|
1485
|
+
const { workspace: u } = await ht(t), c = B.getState().control;
|
|
1486
|
+
c && B.applyControl({
|
|
1466
1487
|
...c,
|
|
1467
1488
|
workspaces: [
|
|
1468
1489
|
...c.workspaces,
|
|
@@ -1484,7 +1505,7 @@ function mr() {
|
|
|
1484
1505
|
/* @__PURE__ */ o(
|
|
1485
1506
|
J,
|
|
1486
1507
|
{
|
|
1487
|
-
kicker: /* @__PURE__ */ o(
|
|
1508
|
+
kicker: /* @__PURE__ */ o(ft, { to: "/workspaces", children: "← Workspaces" }),
|
|
1488
1509
|
title: "Create workspace"
|
|
1489
1510
|
}
|
|
1490
1511
|
),
|
|
@@ -1498,12 +1519,12 @@ function mr() {
|
|
|
1498
1519
|
placeholder: "Docs site"
|
|
1499
1520
|
}
|
|
1500
1521
|
) }),
|
|
1501
|
-
r ? /* @__PURE__ */ o(
|
|
1522
|
+
r ? /* @__PURE__ */ o(R, { tone: "danger", children: r }) : null,
|
|
1502
1523
|
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "submit", disabled: i, children: i ? "Creating…" : "Create workspace" }) })
|
|
1503
1524
|
] }) })
|
|
1504
1525
|
] });
|
|
1505
1526
|
}
|
|
1506
|
-
function
|
|
1527
|
+
function yr(e, t) {
|
|
1507
1528
|
switch (e) {
|
|
1508
1529
|
case "invite_expired":
|
|
1509
1530
|
return "This invite has expired. Ask for a new one.";
|
|
@@ -1519,56 +1540,56 @@ function xr(e, t) {
|
|
|
1519
1540
|
return t;
|
|
1520
1541
|
}
|
|
1521
1542
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const [e] =
|
|
1543
|
+
function vr() {
|
|
1544
|
+
const [e] = be(), t = Fe(), n = e.get("token") ?? "", r = e.get("email") ?? "", [s, i] = S(null), [l, d] = S(null), [a, u] = S(!1);
|
|
1524
1545
|
V(() => {
|
|
1525
1546
|
if (!n) {
|
|
1526
1547
|
i("This invite link is missing a token.");
|
|
1527
1548
|
return;
|
|
1528
1549
|
}
|
|
1529
|
-
let
|
|
1530
|
-
return
|
|
1531
|
-
|
|
1532
|
-
}).catch(async (
|
|
1533
|
-
if (
|
|
1534
|
-
const
|
|
1535
|
-
if (
|
|
1536
|
-
const
|
|
1537
|
-
if (
|
|
1538
|
-
d((
|
|
1550
|
+
let g = !1;
|
|
1551
|
+
return pt(n).then((h) => {
|
|
1552
|
+
g || t(`/${h.slug}`, { replace: !0 });
|
|
1553
|
+
}).catch(async (h) => {
|
|
1554
|
+
if (g) return;
|
|
1555
|
+
const p = h && typeof h == "object" && "code" in h ? h.code : void 0;
|
|
1556
|
+
if (p === "invite_email_mismatch" || p === "unauthorized") {
|
|
1557
|
+
const b = await we().catch(() => null);
|
|
1558
|
+
if (g) return;
|
|
1559
|
+
d((b == null ? void 0 : b.user.email) ?? null), u(!0);
|
|
1539
1560
|
return;
|
|
1540
1561
|
}
|
|
1541
|
-
const
|
|
1542
|
-
i(
|
|
1562
|
+
const v = h instanceof Error ? h.message : "Could not accept invite";
|
|
1563
|
+
i(yr(p, v));
|
|
1543
1564
|
}), () => {
|
|
1544
|
-
|
|
1565
|
+
g = !0;
|
|
1545
1566
|
};
|
|
1546
1567
|
}, [t, n]);
|
|
1547
1568
|
async function c() {
|
|
1548
|
-
await
|
|
1549
|
-
}), ee(),
|
|
1569
|
+
await M().signOut().catch(() => {
|
|
1570
|
+
}), ee(), B.wipe(), window.location.assign(window.location.href);
|
|
1550
1571
|
}
|
|
1551
1572
|
return /* @__PURE__ */ k(ie, { centered: !0, children: [
|
|
1552
1573
|
/* @__PURE__ */ o(J, { title: "Accept invite" }),
|
|
1553
1574
|
a ? /* @__PURE__ */ k(re, { children: [
|
|
1554
|
-
/* @__PURE__ */ o(
|
|
1555
|
-
/* @__PURE__ */ o(
|
|
1575
|
+
/* @__PURE__ */ o(R, { children: l ? `You're signed in as ${l}. This invite is for ${r || "someone else"}.` : `Sign in as ${r || "the invited email"} to join.` }),
|
|
1576
|
+
/* @__PURE__ */ o(R, { size: "sm", tone: "muted", children: "Password and GitHub stay on the next screen. A magic link sends one more email to that address." }),
|
|
1556
1577
|
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "button", variant: "secondary", onClick: () => void c(), children: r ? `Sign in as ${r}` : "Sign in to continue" }) })
|
|
1557
|
-
] }) : s ? /* @__PURE__ */ o(
|
|
1578
|
+
] }) : s ? /* @__PURE__ */ o(R, { tone: "danger", children: s }) : /* @__PURE__ */ o(R, { tone: "muted", children: "Joining workspace…" })
|
|
1558
1579
|
] });
|
|
1559
1580
|
}
|
|
1560
|
-
function
|
|
1561
|
-
const { email: e, userId: t } =
|
|
1581
|
+
function br() {
|
|
1582
|
+
const { email: e, userId: t } = Ce(), [n, r] = S(""), [s, i] = S(null), [l, d] = S(null), [a, u] = S(!1);
|
|
1562
1583
|
V(() => {
|
|
1563
|
-
|
|
1564
|
-
|
|
1584
|
+
we().then((g) => {
|
|
1585
|
+
g != null && g.user.name && r(g.user.name);
|
|
1565
1586
|
});
|
|
1566
1587
|
}, []);
|
|
1567
|
-
async function c(
|
|
1568
|
-
|
|
1569
|
-
const
|
|
1570
|
-
if (u(!1),
|
|
1571
|
-
d(
|
|
1588
|
+
async function c(g) {
|
|
1589
|
+
g.preventDefault(), u(!0), d(null), i(null);
|
|
1590
|
+
const h = await M().updateUser({ name: n });
|
|
1591
|
+
if (u(!1), h.error) {
|
|
1592
|
+
d(h.error.message ?? "Could not save name");
|
|
1572
1593
|
return;
|
|
1573
1594
|
}
|
|
1574
1595
|
i("Name saved. New publishes will use it.");
|
|
@@ -1582,9 +1603,9 @@ function vr() {
|
|
|
1582
1603
|
}
|
|
1583
1604
|
),
|
|
1584
1605
|
/* @__PURE__ */ k(re, { gap: "lg", children: [
|
|
1585
|
-
/* @__PURE__ */ o(
|
|
1586
|
-
/* @__PURE__ */ o(
|
|
1587
|
-
/* @__PURE__ */ o(Q, { label: "Name", children: /* @__PURE__ */ o(Z, { value: n, onChange: (
|
|
1606
|
+
/* @__PURE__ */ o(gt, { children: /* @__PURE__ */ o("form", { onSubmit: (g) => void c(g), children: /* @__PURE__ */ k(re, { children: [
|
|
1607
|
+
/* @__PURE__ */ o(R, { as: "h2", size: "lg", weight: "medium", children: "Account" }),
|
|
1608
|
+
/* @__PURE__ */ o(Q, { label: "Name", children: /* @__PURE__ */ o(Z, { value: n, onChange: (g) => r(g.target.value), autoComplete: "name" }) }),
|
|
1588
1609
|
/* @__PURE__ */ o(Q, { label: "Email", children: /* @__PURE__ */ o(
|
|
1589
1610
|
Z,
|
|
1590
1611
|
{
|
|
@@ -1604,8 +1625,8 @@ function vr() {
|
|
|
1604
1625
|
spellCheck: !1
|
|
1605
1626
|
}
|
|
1606
1627
|
) }),
|
|
1607
|
-
l ? /* @__PURE__ */ o(
|
|
1608
|
-
s ? /* @__PURE__ */ o(
|
|
1628
|
+
l ? /* @__PURE__ */ o(R, { tone: "danger", children: l }) : null,
|
|
1629
|
+
s ? /* @__PURE__ */ o(R, { tone: "muted", children: s }) : null,
|
|
1609
1630
|
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ae, { type: "submit", disabled: a, children: a ? "Saving…" : "Save name" }) })
|
|
1610
1631
|
] }) }) }),
|
|
1611
1632
|
/* @__PURE__ */ k("div", { children: [
|
|
@@ -1617,39 +1638,39 @@ function vr() {
|
|
|
1617
1638
|
compact: !0
|
|
1618
1639
|
}
|
|
1619
1640
|
),
|
|
1620
|
-
/* @__PURE__ */ o(
|
|
1641
|
+
/* @__PURE__ */ o(mt, { scope: "user", canEdit: !0 })
|
|
1621
1642
|
] })
|
|
1622
1643
|
] })
|
|
1623
1644
|
] });
|
|
1624
1645
|
}
|
|
1625
|
-
function
|
|
1646
|
+
function wr({
|
|
1626
1647
|
email: e
|
|
1627
1648
|
}) {
|
|
1628
|
-
const [t] =
|
|
1649
|
+
const [t] = be(), n = t.get("id") ?? "", [r, s] = S("idle"), [i, l] = S(null);
|
|
1629
1650
|
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: [
|
|
1630
|
-
/* @__PURE__ */ o(
|
|
1631
|
-
/* @__PURE__ */ k(
|
|
1651
|
+
/* @__PURE__ */ o(R, { as: "h1", size: "xl", weight: "medium", children: "Allow the CLI" }),
|
|
1652
|
+
/* @__PURE__ */ k(R, { tone: "muted", children: [
|
|
1632
1653
|
"This signs the CLI in as ",
|
|
1633
1654
|
e,
|
|
1634
1655
|
". It can act in any workspace you belong to. It does not pick one."
|
|
1635
1656
|
] }),
|
|
1636
|
-
r === "done" ? /* @__PURE__ */ o(
|
|
1637
|
-
i ? /* @__PURE__ */ o(
|
|
1657
|
+
r === "done" ? /* @__PURE__ */ o(R, { children: "You can return to the terminal." }) : null,
|
|
1658
|
+
i ? /* @__PURE__ */ o(R, { tone: "danger", children: i }) : null,
|
|
1638
1659
|
r === "done" ? null : /* @__PURE__ */ o(ae, { disabled: !n, onClick: () => {
|
|
1639
|
-
l(null),
|
|
1660
|
+
l(null), xt(n).then(() => s("done")).catch((d) => {
|
|
1640
1661
|
s("error"), l(d instanceof Error ? d.message : "Could not approve");
|
|
1641
1662
|
});
|
|
1642
1663
|
}, children: "Allow" })
|
|
1643
1664
|
] }) });
|
|
1644
1665
|
}
|
|
1645
|
-
function
|
|
1666
|
+
function kr({
|
|
1646
1667
|
userId: e
|
|
1647
1668
|
}) {
|
|
1648
|
-
const [t, n] =
|
|
1669
|
+
const [t, n] = S({
|
|
1649
1670
|
kind: "working"
|
|
1650
1671
|
});
|
|
1651
1672
|
return V(() => {
|
|
1652
|
-
const r =
|
|
1673
|
+
const r = yt(window.location.search);
|
|
1653
1674
|
if (!r) {
|
|
1654
1675
|
n({
|
|
1655
1676
|
kind: "error",
|
|
@@ -1662,7 +1683,7 @@ function wr({
|
|
|
1662
1683
|
try {
|
|
1663
1684
|
const {
|
|
1664
1685
|
workspace: i
|
|
1665
|
-
} = await
|
|
1686
|
+
} = await vt(r.workspaceId), l = bt(r.returnUrl, i.siteUrls);
|
|
1666
1687
|
if (!l) {
|
|
1667
1688
|
n({
|
|
1668
1689
|
kind: "error",
|
|
@@ -1672,12 +1693,12 @@ function wr({
|
|
|
1672
1693
|
}
|
|
1673
1694
|
const {
|
|
1674
1695
|
ticket: d
|
|
1675
|
-
} = await
|
|
1696
|
+
} = await wt(i.id, {
|
|
1676
1697
|
redirect: l.redirect,
|
|
1677
1698
|
tree: e
|
|
1678
1699
|
});
|
|
1679
1700
|
if (s) return;
|
|
1680
|
-
window.location.replace(
|
|
1701
|
+
window.location.replace(kt(l.origin, d));
|
|
1681
1702
|
} catch (i) {
|
|
1682
1703
|
if (s) return;
|
|
1683
1704
|
n({
|
|
@@ -1688,71 +1709,71 @@ function wr({
|
|
|
1688
1709
|
})(), () => {
|
|
1689
1710
|
s = !0;
|
|
1690
1711
|
};
|
|
1691
|
-
}, [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(
|
|
1692
|
-
/* @__PURE__ */ o(
|
|
1693
|
-
/* @__PURE__ */ o(
|
|
1694
|
-
] }) : /* @__PURE__ */ k(
|
|
1695
|
-
/* @__PURE__ */ o(
|
|
1696
|
-
/* @__PURE__ */ o(
|
|
1697
|
-
/* @__PURE__ */ o(
|
|
1712
|
+
}, [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(me, { children: [
|
|
1713
|
+
/* @__PURE__ */ o(R, { size: "lg", weight: "medium", children: "Opening your site…" }),
|
|
1714
|
+
/* @__PURE__ */ o(R, { tone: "muted", children: "Setting up editing on the site and sending you back." })
|
|
1715
|
+
] }) : /* @__PURE__ */ k(me, { children: [
|
|
1716
|
+
/* @__PURE__ */ o(R, { size: "lg", weight: "medium", children: "Could not open the site" }),
|
|
1717
|
+
/* @__PURE__ */ o(R, { tone: "muted", children: t.message }),
|
|
1718
|
+
/* @__PURE__ */ o(Be, { to: "/", variant: "secondary", children: "Back to the dashboard" })
|
|
1698
1719
|
] }) }) });
|
|
1699
1720
|
}
|
|
1700
|
-
function
|
|
1701
|
-
if (!
|
|
1721
|
+
function Sr(e) {
|
|
1722
|
+
if (!St()) return !1;
|
|
1702
1723
|
const t = e.replace(/\/$/, "") || "/";
|
|
1703
1724
|
return t === "/__ui" || /^\/__ui\/[^/]+$/.test(t);
|
|
1704
1725
|
}
|
|
1705
|
-
const
|
|
1726
|
+
const Er = tt(() => import("./UiKitApp-B1ANqCac.js").then((e) => ({
|
|
1706
1727
|
default: e.UiKitApp
|
|
1707
1728
|
})));
|
|
1708
|
-
function
|
|
1709
|
-
return /* @__PURE__ */ o(
|
|
1729
|
+
function jr() {
|
|
1730
|
+
return /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o(Rt, { children: /* @__PURE__ */ o(Rr, {}) }) });
|
|
1710
1731
|
}
|
|
1711
|
-
function
|
|
1712
|
-
const e =
|
|
1713
|
-
const r =
|
|
1732
|
+
function Rr() {
|
|
1733
|
+
const e = _t(), [t, n] = S(() => {
|
|
1734
|
+
const r = Ot();
|
|
1714
1735
|
return r ? {
|
|
1715
1736
|
user: r
|
|
1716
1737
|
} : "loading";
|
|
1717
1738
|
});
|
|
1718
1739
|
return V(() => {
|
|
1719
|
-
|
|
1740
|
+
we().then((r) => {
|
|
1720
1741
|
if (!(r != null && r.user)) {
|
|
1721
|
-
ee(),
|
|
1742
|
+
ee(), B.wipe(), n(null);
|
|
1722
1743
|
return;
|
|
1723
1744
|
}
|
|
1724
|
-
if (
|
|
1745
|
+
if (Tt(r.user), n({
|
|
1725
1746
|
user: {
|
|
1726
1747
|
id: r.user.id,
|
|
1727
1748
|
email: r.user.email
|
|
1728
1749
|
}
|
|
1729
|
-
}),
|
|
1730
|
-
const s =
|
|
1731
|
-
|
|
1750
|
+
}), B.getState().sessionUserId !== r.user.id) {
|
|
1751
|
+
const s = Pt(window.location.pathname);
|
|
1752
|
+
B.hydrate(r.user.id, s ?? qe(r.user.id));
|
|
1732
1753
|
}
|
|
1733
1754
|
}).catch(() => {
|
|
1734
|
-
ee(),
|
|
1755
|
+
ee(), B.wipe(), n(null);
|
|
1735
1756
|
});
|
|
1736
|
-
}, []),
|
|
1737
|
-
ee(),
|
|
1757
|
+
}, []), Sr(e.pathname) ? /* @__PURE__ */ o(nt, { fallback: /* @__PURE__ */ o("div", { className: "x1y5dg2c", children: /* @__PURE__ */ o(R, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ o(Er, {}) }) : t === "loading" ? /* @__PURE__ */ o(jt, {}) : t ? e.pathname.replace(/\/$/, "") === "/enter" ? /* @__PURE__ */ o(kr, { userId: t.user.id }) : Lt(e.pathname) ? /* @__PURE__ */ o(wr, { email: t.user.email }) : /* @__PURE__ */ o(At, { user: t.user, children: /* @__PURE__ */ o(Nt, { children: /* @__PURE__ */ o(Ut, { userId: t.user.id, email: t.user.email, onLogout: () => {
|
|
1758
|
+
ee(), B.wipe(), M().signOut().then(() => {
|
|
1738
1759
|
n(null);
|
|
1739
1760
|
}).catch(() => {
|
|
1740
1761
|
n(null);
|
|
1741
1762
|
});
|
|
1742
|
-
}, children: /* @__PURE__ */ k(
|
|
1743
|
-
/* @__PURE__ */ o(F, { path: "/", element: /* @__PURE__ */ o(
|
|
1744
|
-
/* @__PURE__ */ o(F, { path: "/workspaces", element: /* @__PURE__ */ o(
|
|
1745
|
-
/* @__PURE__ */ o(F, { path: "/workspaces/new", element: /* @__PURE__ */ o(
|
|
1746
|
-
/* @__PURE__ */ o(F, { path: "/invite", element: /* @__PURE__ */ o(
|
|
1747
|
-
/* @__PURE__ */ o(F, { path: "/account", element: /* @__PURE__ */ o(
|
|
1748
|
-
/* @__PURE__ */ o(F, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ o(
|
|
1749
|
-
|
|
1750
|
-
/* @__PURE__ */ o(F, { path: "*", element: /* @__PURE__ */ o(
|
|
1751
|
-
] }) }) }) }) : /* @__PURE__ */ o(
|
|
1763
|
+
}, children: /* @__PURE__ */ k(Ct, { children: [
|
|
1764
|
+
/* @__PURE__ */ o(F, { path: "/", element: /* @__PURE__ */ o(hr, {}) }),
|
|
1765
|
+
/* @__PURE__ */ o(F, { path: "/workspaces", element: /* @__PURE__ */ o(mr, {}) }),
|
|
1766
|
+
/* @__PURE__ */ o(F, { path: "/workspaces/new", element: /* @__PURE__ */ o(xr, {}) }),
|
|
1767
|
+
/* @__PURE__ */ o(F, { path: "/invite", element: /* @__PURE__ */ o(vr, {}) }),
|
|
1768
|
+
/* @__PURE__ */ o(F, { path: "/account", element: /* @__PURE__ */ o(br, {}) }),
|
|
1769
|
+
/* @__PURE__ */ o(F, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ o(It, {}) }),
|
|
1770
|
+
qt(),
|
|
1771
|
+
/* @__PURE__ */ o(F, { path: "*", element: /* @__PURE__ */ o(ze, { to: "/", replace: !0 }) })
|
|
1772
|
+
] }) }) }) }) : /* @__PURE__ */ o(ur, {});
|
|
1752
1773
|
}
|
|
1753
1774
|
export {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1775
|
+
jr as A,
|
|
1776
|
+
gr as L,
|
|
1777
|
+
pr as a,
|
|
1778
|
+
Sr as i
|
|
1758
1779
|
};
|