@fkn/lib 0.3.8 → 0.3.10
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/{background-DWzRqH12.cjs → background-D-gZyvaP.cjs} +1 -1
- package/{background-_3_Cnyol.js → background-DCdL9DVK.js} +2 -2
- package/index.cjs +6 -8
- package/index.d.ts +27 -30
- package/index.js +266 -1748
- package/locator-Bz_60Zup.cjs +53 -0
- package/{locator-1wWrCOyE.js → locator-fXEVniGP.js} +358 -92
- package/package.json +3 -4
- package/_redirects +0 -5
- package/locator-DHsqhrFb.cjs +0 -31
- package/logo.png +0 -0
- package/logo.svg +0 -7
package/index.js
CHANGED
|
@@ -1,1725 +1,236 @@
|
|
|
1
|
-
import { d as e, f as t, g as n, i as r, l as i, m as a, p as o, r as s, t as c, u as l } from "./locator-
|
|
2
|
-
import { createTypedEventTarget as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (typeof
|
|
1
|
+
import { d as e, f as t, g as n, i as r, l as i, m as a, p as o, r as s, t as c, u as l } from "./locator-fXEVniGP.js";
|
|
2
|
+
import { createTypedEventTarget as ee, expose as te, relay as ne } from "osra";
|
|
3
|
+
import { Stream as u } from "stream";
|
|
4
|
+
import { EventEmitter as d } from "events";
|
|
5
|
+
import { Address4 as f, Address6 as p } from "ip-address";
|
|
6
|
+
import { Buffer as m } from "buffer";
|
|
7
|
+
//#region src/lib/overlay.ts
|
|
8
|
+
var re = 32, ie = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), ae = (e) => {
|
|
9
|
+
let t = e.style;
|
|
10
|
+
t.setProperty("display", "block", "important"), t.setProperty("position", "fixed", "important"), t.setProperty("top", "0", "important"), t.setProperty("left", "0", "important"), t.setProperty("width", "100%", "important"), t.setProperty("height", "100%", "important"), t.setProperty("border", "none", "important"), t.setProperty("clip-path", "inset(100%)", "important"), t.setProperty("background", "transparent"), t.setProperty("color-scheme", "normal"), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
|
|
11
|
+
}, oe = ({ x: e, y: t, width: n, height: r }) => `M${e} ${t}h${n}v${r}h${-n}Z`, se = (e, { modal: t, rects: n }) => {
|
|
12
|
+
if (!ie) {
|
|
13
|
+
let r = t || n.length > 0;
|
|
14
|
+
e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let r = t ? "none" : n.length === 0 ? "inset(100%)" : `path('${n.map(oe).join("")}')`, i = r === "none" || CSS.supports("clip-path", r) ? r : "inset(100%)";
|
|
18
|
+
e.style.setProperty("clip-path", i, "important");
|
|
19
|
+
}, ce = (e) => {
|
|
20
|
+
if (typeof e != "object" || !e) return null;
|
|
21
|
+
let { x: t, y: n, width: r, height: i } = e;
|
|
22
|
+
if (![
|
|
23
|
+
t,
|
|
24
|
+
n,
|
|
25
|
+
r,
|
|
26
|
+
i
|
|
27
|
+
].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
|
|
28
|
+
let a = window.innerWidth, o = window.innerHeight, s = Math.max(0, Math.min(Math.round(t), a)), c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(s, Math.min(Math.round(t + r), a)), ee = Math.max(c, Math.min(Math.round(n + i), o));
|
|
29
|
+
return {
|
|
30
|
+
x: s,
|
|
31
|
+
y: c,
|
|
32
|
+
width: l - s,
|
|
33
|
+
height: ee - c
|
|
34
|
+
};
|
|
35
|
+
}, le = (e) => {
|
|
36
|
+
if (typeof e != "object" || !e) return null;
|
|
37
|
+
let t = e, n = (Array.isArray(t.rects) ? t.rects.slice(0, re) : []).map(ce).filter((e) => e !== null && e.width > 0 && e.height > 0);
|
|
38
|
+
return {
|
|
39
|
+
modal: t.modal === !0,
|
|
40
|
+
rects: n
|
|
41
|
+
};
|
|
42
|
+
}, h = null, ue = () => h !== null, de = (e) => {
|
|
43
|
+
ae(e), se(e, {
|
|
44
|
+
modal: !1,
|
|
45
|
+
rects: []
|
|
46
|
+
}), h = e;
|
|
47
|
+
}, fe = (e) => {
|
|
48
|
+
if (!h) return;
|
|
49
|
+
let t = le(e);
|
|
50
|
+
t && se(h, t);
|
|
51
|
+
}, g = "https://fkn.app", _ = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, v = _?.querySelector(`iframe[src="${g}/api"]`) ?? null, y = _?.createElement("iframe") ?? null;
|
|
52
|
+
!v && y && _ && (y.src = `${g}/api`, _.body.appendChild(y));
|
|
53
|
+
var b = v ?? y, x = b?.contentWindow ?? null;
|
|
54
|
+
b && _ && de(b);
|
|
55
|
+
var S = (() => {
|
|
56
|
+
if (typeof window < "u") return x ? {
|
|
21
57
|
receive: window,
|
|
22
|
-
emit:
|
|
58
|
+
emit: x
|
|
23
59
|
} : void 0;
|
|
24
60
|
if (typeof self < "u") return {
|
|
25
61
|
receive: self,
|
|
26
62
|
emit: self
|
|
27
63
|
};
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}).then((e) => {
|
|
39
|
-
clearTimeout(a), t(e);
|
|
40
|
-
}).catch((e) => {
|
|
41
|
-
clearTimeout(a), n(e);
|
|
42
|
-
});
|
|
43
|
-
}), ue = (e = 50) => le(e).then((e) => e).catch((t) => {
|
|
44
|
-
if (t.message === "Timeout waiting for api to be exposed") return ue(Math.min(e * 2, 500));
|
|
45
|
-
throw t;
|
|
46
|
-
}), E = ue(), de = (e, t) => E.then((n) => n.proxyFetch(e, t)), fe = "https://fkn.app", pe = (e, t) => {
|
|
64
|
+
})(), C = S ? te({}, {
|
|
65
|
+
key: "fkn-api",
|
|
66
|
+
transport: S
|
|
67
|
+
}) : new Promise(() => {});
|
|
68
|
+
C.then((e) => {
|
|
69
|
+
ue() && e.setOverlayHost(fe);
|
|
70
|
+
}, () => {});
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/lib/proxy.ts
|
|
73
|
+
var pe = (e, t) => C.then((n) => n.proxyFetch(e, t)), me = "https://fkn.app", he = (e, t) => {
|
|
47
74
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
48
|
-
if (!
|
|
49
|
-
|
|
75
|
+
if (!b?.contentWindow) throw Error("FKN @fkn/lib: relayWorker called before the FKN iframe was injected");
|
|
76
|
+
ne({
|
|
50
77
|
receive: window,
|
|
51
|
-
emit:
|
|
78
|
+
emit: b.contentWindow
|
|
52
79
|
}, e, {
|
|
53
80
|
key: "fkn-api",
|
|
54
|
-
originA: t?.originA ??
|
|
81
|
+
originA: t?.originA ?? me,
|
|
55
82
|
originB: t?.originB ?? "*",
|
|
56
83
|
unregisterSignal: t?.unregisterSignal
|
|
57
84
|
});
|
|
58
|
-
},
|
|
59
|
-
typeof document < "u" && document.addEventListener(
|
|
60
|
-
|
|
85
|
+
}, ge = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", _e = "fknExtension", w = ee();
|
|
86
|
+
typeof document < "u" && document.addEventListener(ge, (e) => {
|
|
87
|
+
w.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: e.detail.enabled } }));
|
|
61
88
|
});
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
if (
|
|
89
|
+
var T = () => document.documentElement.dataset[_e] === "true", E = null, D = (e) => {
|
|
90
|
+
E = e;
|
|
91
|
+
}, O = (e = 1e3) => new Promise((t, n) => {
|
|
92
|
+
if (T()) return t();
|
|
66
93
|
let r = (e) => {
|
|
67
94
|
clearTimeout(s), a.disconnect(), document.removeEventListener("readystatechange", o), e();
|
|
68
95
|
}, i = () => r(async () => {
|
|
69
|
-
if (
|
|
96
|
+
if (E && (await E().catch(() => {}), T())) return t();
|
|
70
97
|
n(/* @__PURE__ */ Error("The FKN WebExtension is not installed, enabled or not exposed on this page."));
|
|
71
98
|
}), a = new MutationObserver(() => {
|
|
72
|
-
|
|
99
|
+
T() && r(t);
|
|
73
100
|
}), o = () => {
|
|
74
|
-
document.readyState === "complete" && !
|
|
101
|
+
document.readyState === "complete" && !T() && i();
|
|
75
102
|
}, s = setTimeout(i, e);
|
|
76
103
|
if (document.readyState === "complete") return i();
|
|
77
104
|
a.observe(document.documentElement, {
|
|
78
105
|
attributes: !0,
|
|
79
106
|
attributeFilter: ["data-fkn-extension"]
|
|
80
|
-
}), document.addEventListener("readystatechange", o),
|
|
81
|
-
}),
|
|
82
|
-
await
|
|
107
|
+
}), document.addEventListener("readystatechange", o), T() && r(t);
|
|
108
|
+
}), k, A = new Proxy({}, { get: (e, t) => async (...e) => {
|
|
109
|
+
await O(), k ??= te({}, {
|
|
83
110
|
transport: window,
|
|
84
111
|
revivableModules: i
|
|
85
112
|
});
|
|
86
|
-
let n = (await
|
|
113
|
+
let n = (await k)[t];
|
|
87
114
|
return n(...e);
|
|
88
|
-
} }),
|
|
115
|
+
} }), ve = {
|
|
89
116
|
scope: "network.fetch",
|
|
90
117
|
category: "network",
|
|
91
118
|
severity: 0,
|
|
92
119
|
title: "Fetch data from other sites",
|
|
93
120
|
description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
|
|
94
|
-
},
|
|
121
|
+
}, ye = {
|
|
95
122
|
scope: "network.fetchCredentialed",
|
|
96
123
|
category: "network",
|
|
97
124
|
severity: 3,
|
|
98
125
|
unsafe: !0,
|
|
99
126
|
title: "Fetch from other sites — signed in as you",
|
|
100
127
|
description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
|
|
101
|
-
},
|
|
128
|
+
}, be = ["origin", "referer"], xe = (e) => {
|
|
102
129
|
if (!e?.headers) return;
|
|
103
|
-
let t = new Headers(e.headers), n =
|
|
130
|
+
let t = new Headers(e.headers), n = be.map((e) => {
|
|
104
131
|
let n = t.get(e);
|
|
105
132
|
return n === null ? void 0 : [e, n];
|
|
106
133
|
}).filter((e) => e !== void 0);
|
|
107
134
|
return n.length ? n : void 0;
|
|
108
|
-
},
|
|
135
|
+
}, Se = async (e, t) => {
|
|
109
136
|
let n = new Request(e, t), r = n.body ? await n.arrayBuffer() : null;
|
|
110
|
-
return
|
|
137
|
+
return A.proxyFetch({
|
|
111
138
|
url: n.url,
|
|
112
139
|
method: n.method,
|
|
113
140
|
headers: [...n.headers],
|
|
114
141
|
body: r,
|
|
115
142
|
credentials: t?.credentials === "include" ? "include" : "omit",
|
|
116
143
|
redirect: n.redirect,
|
|
117
|
-
unsafeHeaders:
|
|
144
|
+
unsafeHeaders: xe(t),
|
|
118
145
|
reason: t?.reason,
|
|
119
146
|
signal: t?.signal ?? void 0
|
|
120
147
|
});
|
|
121
|
-
},
|
|
148
|
+
}, Ce = {
|
|
122
149
|
scope: "network.readCookie",
|
|
123
150
|
category: "network",
|
|
124
151
|
severity: 3,
|
|
125
152
|
unsafe: !0,
|
|
126
153
|
title: "Read a site’s cookie",
|
|
127
154
|
description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
|
|
128
|
-
},
|
|
155
|
+
}, we = { get: (e) => A.getCookie(e) }, Te = {
|
|
129
156
|
scope: "network.modifyRequestHeaders",
|
|
130
157
|
category: "network",
|
|
131
158
|
severity: 2,
|
|
132
159
|
unsafe: !0,
|
|
133
160
|
title: "Rewrite request headers to other sites",
|
|
134
161
|
description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
|
|
135
|
-
},
|
|
162
|
+
}, Ee = (e) => A.setRequestHeaderRule(e), De = (e) => A.removeRequestHeaderRule({ ruleId: e });
|
|
136
163
|
(() => {
|
|
137
164
|
let e = {}, t = [...c.selectorModules, ...r.selectorModules];
|
|
138
165
|
for (let n of t) n.render && !(n.type in e) && (e[n.type] = n.render);
|
|
139
166
|
return e;
|
|
140
167
|
})();
|
|
141
168
|
//#endregion
|
|
142
|
-
//#region
|
|
143
|
-
var
|
|
169
|
+
//#region node_modules/@mfkn/web-extension/lib/lib/frame.js
|
|
170
|
+
var j = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", M = (e) => {
|
|
171
|
+
if (!e || e === "about:blank") return !1;
|
|
172
|
+
let t;
|
|
173
|
+
try {
|
|
174
|
+
t = new URL(e, location.href);
|
|
175
|
+
} catch {
|
|
176
|
+
return !1;
|
|
177
|
+
}
|
|
178
|
+
if (t.protocol === "chrome-extension:" || t.protocol === "moz-extension:") return !0;
|
|
179
|
+
if (t.protocol === "about:") return !1;
|
|
180
|
+
let n = t.hostname;
|
|
181
|
+
return n === "fkn.app" || n.endsWith(".fkn.app");
|
|
182
|
+
}, N = (e) => {
|
|
183
|
+
if (M(e)) throw Error("attachFrame: refusing to target the extension's own pages or fkn.app");
|
|
184
|
+
}, Oe = {
|
|
144
185
|
scope: "embed.iframe",
|
|
145
186
|
category: "embed",
|
|
146
187
|
severity: 0,
|
|
147
188
|
title: "Load another website inside this app",
|
|
148
189
|
description: "Lets the app embed external pages directly inside its own view."
|
|
149
|
-
},
|
|
190
|
+
}, ke = {
|
|
150
191
|
scope: "embed.open",
|
|
151
192
|
category: "embed",
|
|
152
193
|
severity: 0,
|
|
153
194
|
title: "Open a website inside this app",
|
|
154
195
|
description: "Lets the app navigate to another site without leaving its window."
|
|
155
|
-
},
|
|
196
|
+
}, Ae = async ({ iframe: e, domains: t = [] }) => {
|
|
156
197
|
let n = crypto.randomUUID();
|
|
157
|
-
if (await
|
|
158
|
-
e.dispatchEvent(new CustomEvent(
|
|
159
|
-
let { executeLocator: r, ensureLocatorPermission: i, goto: a } = await
|
|
198
|
+
if (N(e.src), await O(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
199
|
+
e.dispatchEvent(new CustomEvent(j, { detail: n }));
|
|
200
|
+
let { executeLocator: r, ensureLocatorPermission: i, goto: a } = await A.attachFrame({
|
|
160
201
|
marker: n,
|
|
161
202
|
domains: t
|
|
162
|
-
}), o = s(r, i), c = (e, t = {}) => a({
|
|
203
|
+
}), o = s(r, i), c = (e, t = {}) => (N(e), a({
|
|
163
204
|
url: e,
|
|
164
205
|
...t
|
|
165
|
-
}), l = () => e.src;
|
|
206
|
+
})), l = () => e.src;
|
|
166
207
|
return {
|
|
167
208
|
...o,
|
|
168
209
|
goto: c,
|
|
169
210
|
url: l
|
|
170
211
|
};
|
|
171
|
-
},
|
|
212
|
+
}, je = { request: (e) => A.requestPermissions(e.map((e) => ({
|
|
172
213
|
key: e.key,
|
|
173
214
|
scope: e.scope ?? "",
|
|
174
215
|
reason: e.reason
|
|
175
|
-
}))) },
|
|
216
|
+
}))) }, P = async (e) => {
|
|
176
217
|
if (typeof window > "u") return !1;
|
|
177
|
-
if (
|
|
178
|
-
let t = await
|
|
218
|
+
if (T()) return !0;
|
|
219
|
+
let t = await C, n = null, r = new Promise((e) => {
|
|
179
220
|
n = () => {
|
|
180
|
-
|
|
181
|
-
},
|
|
221
|
+
T() && e(!0);
|
|
222
|
+
}, w.addEventListener("statuschange", n);
|
|
182
223
|
}), i = t.showInstallPrompt(e).then(() => !1), a = await Promise.race([r, i]);
|
|
183
|
-
return n &&
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}),
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region node_modules/preact/hooks/dist/hooks.module.js
|
|
190
|
-
var A, Le, Re, ze = [], j = g, Be = j.__b, Ve = j.__r, He = j.diffed, Ue = j.__c, We = j.unmount, Ge = j.__;
|
|
191
|
-
function Ke() {
|
|
192
|
-
for (var e; e = ze.shift();) if (e.__P && e.__H) try {
|
|
193
|
-
e.__H.__h.forEach(M), e.__H.__h.forEach(Ye), e.__H.__h = [];
|
|
194
|
-
} catch (t) {
|
|
195
|
-
e.__H.__h = [], j.__e(t, e.__v);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
j.__b = function(e) {
|
|
199
|
-
A = null, Be && Be(e);
|
|
200
|
-
}, j.__ = function(e, t) {
|
|
201
|
-
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ge && Ge(e, t);
|
|
202
|
-
}, j.__r = function(e) {
|
|
203
|
-
Ve && Ve(e);
|
|
204
|
-
var t = (A = e.__c).__H;
|
|
205
|
-
t && (Le === A ? (t.__h = [], A.__h = [], t.__.forEach(function(e) {
|
|
206
|
-
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
|
|
207
|
-
})) : (t.__h.forEach(M), t.__h.forEach(Ye), t.__h = [])), Le = A;
|
|
208
|
-
}, j.diffed = function(e) {
|
|
209
|
-
He && He(e);
|
|
210
|
-
var t = e.__c;
|
|
211
|
-
t && t.__H && (t.__H.__h.length && (ze.push(t) !== 1 && Re === j.requestAnimationFrame || ((Re = j.requestAnimationFrame) || Je)(Ke)), t.__H.__.forEach(function(e) {
|
|
212
|
-
e.u && (e.__H = e.u), e.u = void 0;
|
|
213
|
-
})), Le = A = null;
|
|
214
|
-
}, j.__c = function(e, t) {
|
|
215
|
-
t.some(function(e) {
|
|
216
|
-
try {
|
|
217
|
-
e.__h.forEach(M), e.__h = e.__h.filter(function(e) {
|
|
218
|
-
return !e.__ || Ye(e);
|
|
219
|
-
});
|
|
220
|
-
} catch (n) {
|
|
221
|
-
t.some(function(e) {
|
|
222
|
-
e.__h &&= [];
|
|
223
|
-
}), t = [], j.__e(n, e.__v);
|
|
224
|
-
}
|
|
225
|
-
}), Ue && Ue(e, t);
|
|
226
|
-
}, j.unmount = function(e) {
|
|
227
|
-
We && We(e);
|
|
228
|
-
var t, n = e.__c;
|
|
229
|
-
n && n.__H && (n.__H.__.forEach(function(e) {
|
|
230
|
-
try {
|
|
231
|
-
M(e);
|
|
232
|
-
} catch (e) {
|
|
233
|
-
t = e;
|
|
234
|
-
}
|
|
235
|
-
}), n.__H = void 0, t && j.__e(t, n.__v));
|
|
236
|
-
};
|
|
237
|
-
var qe = typeof requestAnimationFrame == "function";
|
|
238
|
-
function Je(e) {
|
|
239
|
-
var t, n = function() {
|
|
240
|
-
clearTimeout(r), qe && cancelAnimationFrame(t), setTimeout(e);
|
|
241
|
-
}, r = setTimeout(n, 35);
|
|
242
|
-
qe && (t = requestAnimationFrame(n));
|
|
243
|
-
}
|
|
244
|
-
function M(e) {
|
|
245
|
-
var t = A, n = e.__c;
|
|
246
|
-
typeof n == "function" && (e.__c = void 0, n()), A = t;
|
|
247
|
-
}
|
|
248
|
-
function Ye(e) {
|
|
249
|
-
var t = A;
|
|
250
|
-
e.__c = e.__(), A = t;
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
//#region node_modules/preact/compat/dist/compat.module.js
|
|
254
|
-
function Xe(e, t) {
|
|
255
|
-
for (var n in t) e[n] = t[n];
|
|
256
|
-
return e;
|
|
257
|
-
}
|
|
258
|
-
function Ze(e, t) {
|
|
259
|
-
for (var n in e) if (n !== "__source" && !(n in t)) return !0;
|
|
260
|
-
for (var r in t) if (r !== "__source" && e[r] !== t[r]) return !0;
|
|
261
|
-
return !1;
|
|
262
|
-
}
|
|
263
|
-
function Qe(e, t) {
|
|
264
|
-
this.props = e, this.context = t;
|
|
265
|
-
}
|
|
266
|
-
(Qe.prototype = new p()).isPureReactComponent = !0, Qe.prototype.shouldComponentUpdate = function(e, t) {
|
|
267
|
-
return Ze(this.props, e) || Ze(this.state, t);
|
|
268
|
-
};
|
|
269
|
-
var $e = g.__b;
|
|
270
|
-
g.__b = function(e) {
|
|
271
|
-
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), $e && $e(e);
|
|
272
|
-
}, typeof Symbol < "u" && Symbol.for;
|
|
273
|
-
var et = g.__e;
|
|
274
|
-
g.__e = function(e, t, n, r) {
|
|
275
|
-
if (e.then) {
|
|
276
|
-
for (var i, a = t; a = a.__;) if ((i = a.__c) && i.__c) return t.__e ?? (t.__e = n.__e, t.__k = n.__k), i.__c(e, t);
|
|
277
|
-
}
|
|
278
|
-
et(e, t, n, r);
|
|
279
|
-
};
|
|
280
|
-
var tt = g.unmount;
|
|
281
|
-
function nt(e, t, n) {
|
|
282
|
-
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(e) {
|
|
283
|
-
typeof e.__c == "function" && e.__c();
|
|
284
|
-
}), e.__c.__H = null), (e = Xe({}, e)).__c != null && (e.__c.__P === n && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(e) {
|
|
285
|
-
return nt(e, t, n);
|
|
286
|
-
})), e;
|
|
287
|
-
}
|
|
288
|
-
function rt(e, t, n) {
|
|
289
|
-
return e && n && (e.__v = null, e.__k = e.__k && e.__k.map(function(e) {
|
|
290
|
-
return rt(e, t, n);
|
|
291
|
-
}), e.__c && e.__c.__P === t && (e.__e && n.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = n)), e;
|
|
292
|
-
}
|
|
293
|
-
function it() {
|
|
294
|
-
this.__u = 0, this.o = null, this.__b = null;
|
|
295
|
-
}
|
|
296
|
-
function at(e) {
|
|
297
|
-
if (!e.__) return null;
|
|
298
|
-
var t = e.__.__c;
|
|
299
|
-
return t && t.__a && t.__a(e);
|
|
300
|
-
}
|
|
301
|
-
function N() {
|
|
302
|
-
this.i = null, this.l = null;
|
|
303
|
-
}
|
|
304
|
-
g.unmount = function(e) {
|
|
305
|
-
var t = e.__c;
|
|
306
|
-
t && (t.__z = !0), t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), tt && tt(e);
|
|
307
|
-
}, (it.prototype = new p()).__c = function(e, t) {
|
|
308
|
-
var n = t.__c, r = this;
|
|
309
|
-
r.o ??= [], r.o.push(n);
|
|
310
|
-
var i = at(r.__v), a = !1, o = function() {
|
|
311
|
-
a || r.__z || (a = !0, n.__R = null, i ? i(c) : c());
|
|
312
|
-
};
|
|
313
|
-
n.__R = o;
|
|
314
|
-
var s = n.__P;
|
|
315
|
-
n.__P = null;
|
|
316
|
-
var c = function() {
|
|
317
|
-
if (!--r.__u) {
|
|
318
|
-
if (r.state.__a) {
|
|
319
|
-
var e = r.state.__a;
|
|
320
|
-
r.__v.__k[0] = rt(e, e.__c.__P, e.__c.__O);
|
|
321
|
-
}
|
|
322
|
-
var t;
|
|
323
|
-
for (r.setState({ __a: r.__b = null }); t = r.o.pop();) t.__P = s, t.forceUpdate();
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), e.then(o, o);
|
|
327
|
-
}, it.prototype.componentWillUnmount = function() {
|
|
328
|
-
this.o = [];
|
|
329
|
-
}, it.prototype.render = function(e, t) {
|
|
330
|
-
if (this.__b) {
|
|
331
|
-
if (this.__v.__k) {
|
|
332
|
-
var n = document.createElement("div"), r = this.__v.__k[0].__c;
|
|
333
|
-
this.__v.__k[0] = nt(this.__b, n, r.__O = r.__P);
|
|
334
|
-
}
|
|
335
|
-
this.__b = null;
|
|
336
|
-
}
|
|
337
|
-
var i = t.__a && h(m, null, e.fallback);
|
|
338
|
-
return i && (i.__u &= -33), [h(m, null, t.__a ? null : e.children), i];
|
|
339
|
-
};
|
|
340
|
-
var ot = function(e, t, n) {
|
|
341
|
-
if (++n[1] === n[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (n = e.i; n;) {
|
|
342
|
-
for (; n.length > 3;) n.pop()();
|
|
343
|
-
if (n[1] < n[0]) break;
|
|
344
|
-
e.i = n = n[2];
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
(N.prototype = new p()).__a = function(e) {
|
|
348
|
-
var t = this, n = at(t.__v), r = t.l.get(e);
|
|
349
|
-
return r[0]++, function(i) {
|
|
350
|
-
var a = function() {
|
|
351
|
-
t.props.revealOrder ? (r.push(i), ot(t, e, r)) : i();
|
|
352
|
-
};
|
|
353
|
-
n ? n(a) : a();
|
|
354
|
-
};
|
|
355
|
-
}, N.prototype.render = function(e) {
|
|
356
|
-
this.i = null, this.l = /* @__PURE__ */ new Map();
|
|
357
|
-
var t = _(e.children);
|
|
358
|
-
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
|
|
359
|
-
for (var n = t.length; n--;) this.l.set(t[n], this.i = [
|
|
360
|
-
1,
|
|
361
|
-
0,
|
|
362
|
-
this.i
|
|
363
|
-
]);
|
|
364
|
-
return e.children;
|
|
365
|
-
}, N.prototype.componentDidUpdate = N.prototype.componentDidMount = function() {
|
|
366
|
-
var e = this;
|
|
367
|
-
this.l.forEach(function(t, n) {
|
|
368
|
-
ot(e, n, t);
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
var st = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, ct = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, lt = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, ut = /[A-Z0-9]/g, dt = typeof document < "u", ft = function(e) {
|
|
372
|
-
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
|
|
373
|
-
};
|
|
374
|
-
p.prototype.isReactComponent = {}, [
|
|
375
|
-
"componentWillMount",
|
|
376
|
-
"componentWillReceiveProps",
|
|
377
|
-
"componentWillUpdate"
|
|
378
|
-
].forEach(function(e) {
|
|
379
|
-
Object.defineProperty(p.prototype, e, {
|
|
380
|
-
configurable: !0,
|
|
381
|
-
get: function() {
|
|
382
|
-
return this["UNSAFE_" + e];
|
|
383
|
-
},
|
|
384
|
-
set: function(t) {
|
|
385
|
-
Object.defineProperty(this, e, {
|
|
386
|
-
configurable: !0,
|
|
387
|
-
writable: !0,
|
|
388
|
-
value: t
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
var pt = g.event;
|
|
394
|
-
function mt() {}
|
|
395
|
-
function ht() {
|
|
396
|
-
return this.cancelBubble;
|
|
397
|
-
}
|
|
398
|
-
function gt() {
|
|
399
|
-
return this.defaultPrevented;
|
|
400
|
-
}
|
|
401
|
-
g.event = function(e) {
|
|
402
|
-
return pt && (e = pt(e)), e.persist = mt, e.isPropagationStopped = ht, e.isDefaultPrevented = gt, e.nativeEvent = e;
|
|
403
|
-
};
|
|
404
|
-
var _t = {
|
|
405
|
-
enumerable: !1,
|
|
406
|
-
configurable: !0,
|
|
407
|
-
get: function() {
|
|
408
|
-
return this.class;
|
|
409
|
-
}
|
|
410
|
-
}, vt = g.vnode;
|
|
411
|
-
g.vnode = function(e) {
|
|
412
|
-
typeof e.type == "string" && function(e) {
|
|
413
|
-
var t = e.props, n = e.type, r = {}, i = n.indexOf("-") === -1;
|
|
414
|
-
for (var a in t) {
|
|
415
|
-
var o = t[a];
|
|
416
|
-
if (!(a === "value" && "defaultValue" in t && o == null || dt && a === "children" && n === "noscript" || a === "class" || a === "className")) {
|
|
417
|
-
var s = a.toLowerCase();
|
|
418
|
-
a === "defaultValue" && "value" in t && t.value == null ? a = "value" : a === "download" && !0 === o ? o = "" : s === "translate" && o === "no" ? o = !1 : s[0] === "o" && s[1] === "n" ? s === "ondoubleclick" ? a = "ondblclick" : s !== "onchange" || n !== "input" && n !== "textarea" || ft(t.type) ? s === "onfocus" ? a = "onfocusin" : s === "onblur" ? a = "onfocusout" : lt.test(a) && (a = s) : s = a = "oninput" : i && ct.test(a) ? a = a.replace(ut, "-$&").toLowerCase() : o === null && (o = void 0), s === "oninput" && r[a = s] && (a = "oninputCapture"), r[a] = o;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
n == "select" && r.multiple && Array.isArray(r.value) && (r.value = _(t.children).forEach(function(e) {
|
|
422
|
-
e.props.selected = r.value.indexOf(e.props.value) != -1;
|
|
423
|
-
})), n == "select" && r.defaultValue != null && (r.value = _(t.children).forEach(function(e) {
|
|
424
|
-
e.props.selected = r.multiple ? r.defaultValue.indexOf(e.props.value) != -1 : r.defaultValue == e.props.value;
|
|
425
|
-
})), t.class && !t.className ? (r.class = t.class, Object.defineProperty(r, "className", _t)) : (t.className && !t.class || t.class && t.className) && (r.class = r.className = t.className), e.props = r;
|
|
426
|
-
}(e), e.$$typeof = st, vt && vt(e);
|
|
427
|
-
};
|
|
428
|
-
var yt = g.__r;
|
|
429
|
-
g.__r = function(e) {
|
|
430
|
-
yt && yt(e), e.__c;
|
|
431
|
-
};
|
|
432
|
-
var bt = g.diffed;
|
|
433
|
-
g.diffed = function(e) {
|
|
434
|
-
bt && bt(e);
|
|
435
|
-
var t = e.props, n = e.__e;
|
|
436
|
-
n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value);
|
|
437
|
-
};
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
440
|
-
var xt = Symbol.for("better-auth:broadcast-channel"), St = () => Math.floor(Date.now() / 1e3), Ct = class {
|
|
441
|
-
listeners = /* @__PURE__ */ new Set();
|
|
442
|
-
name;
|
|
443
|
-
constructor(e = "better-auth.message") {
|
|
444
|
-
this.name = e;
|
|
445
|
-
}
|
|
446
|
-
subscribe(e) {
|
|
447
|
-
return this.listeners.add(e), () => {
|
|
448
|
-
this.listeners.delete(e);
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
post(e) {
|
|
452
|
-
if (!(typeof window > "u")) try {
|
|
453
|
-
localStorage.setItem(this.name, JSON.stringify({
|
|
454
|
-
...e,
|
|
455
|
-
timestamp: St()
|
|
456
|
-
}));
|
|
457
|
-
} catch {}
|
|
458
|
-
}
|
|
459
|
-
setup() {
|
|
460
|
-
if (typeof window > "u" || window.addEventListener === void 0) return () => {};
|
|
461
|
-
let e = (e) => {
|
|
462
|
-
if (e.key !== this.name) return;
|
|
463
|
-
let t = JSON.parse(e.newValue ?? "{}");
|
|
464
|
-
t?.event !== "session" || !t?.data || this.listeners.forEach((e) => e(t));
|
|
465
|
-
};
|
|
466
|
-
return window.addEventListener("storage", e), () => {
|
|
467
|
-
window.removeEventListener("storage", e);
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
function wt(e = "better-auth.message") {
|
|
472
|
-
return globalThis[xt] || (globalThis[xt] = new Ct(e)), globalThis[xt];
|
|
473
|
-
}
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region node_modules/better-auth/dist/client/focus-manager.mjs
|
|
476
|
-
var Tt = Symbol.for("better-auth:focus-manager"), Et = class {
|
|
477
|
-
listeners = /* @__PURE__ */ new Set();
|
|
478
|
-
subscribe(e) {
|
|
479
|
-
return this.listeners.add(e), () => {
|
|
480
|
-
this.listeners.delete(e);
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
setFocused(e) {
|
|
484
|
-
this.listeners.forEach((t) => t(e));
|
|
485
|
-
}
|
|
486
|
-
setup() {
|
|
487
|
-
if (typeof window > "u" || typeof document > "u" || window.addEventListener === void 0) return () => {};
|
|
488
|
-
let e = () => {
|
|
489
|
-
document.visibilityState === "visible" && this.setFocused(!0);
|
|
490
|
-
};
|
|
491
|
-
return document.addEventListener("visibilitychange", e, !1), () => {
|
|
492
|
-
document.removeEventListener("visibilitychange", e, !1);
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
function Dt() {
|
|
497
|
-
return globalThis[Tt] || (globalThis[Tt] = new Et()), globalThis[Tt];
|
|
498
|
-
}
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region node_modules/better-auth/dist/client/online-manager.mjs
|
|
501
|
-
var Ot = Symbol.for("better-auth:online-manager"), kt = class {
|
|
502
|
-
listeners = /* @__PURE__ */ new Set();
|
|
503
|
-
isOnline = typeof navigator < "u" ? navigator.onLine : !0;
|
|
504
|
-
subscribe(e) {
|
|
505
|
-
return this.listeners.add(e), () => {
|
|
506
|
-
this.listeners.delete(e);
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
setOnline(e) {
|
|
510
|
-
this.isOnline = e, this.listeners.forEach((t) => t(e));
|
|
511
|
-
}
|
|
512
|
-
setup() {
|
|
513
|
-
if (typeof window > "u" || window.addEventListener === void 0) return () => {};
|
|
514
|
-
let e = () => this.setOnline(!0), t = () => this.setOnline(!1);
|
|
515
|
-
return window.addEventListener("online", e, !1), window.addEventListener("offline", t, !1), () => {
|
|
516
|
-
window.removeEventListener("online", e, !1), window.removeEventListener("offline", t, !1);
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
function At() {
|
|
521
|
-
return globalThis[Ot] || (globalThis[Ot] = new kt()), globalThis[Ot];
|
|
522
|
-
}
|
|
523
|
-
//#endregion
|
|
524
|
-
//#region node_modules/better-auth/dist/client/parser.mjs
|
|
525
|
-
var jt = {
|
|
526
|
-
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*:/,
|
|
527
|
-
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*:/,
|
|
528
|
-
protoShort: /"__proto__"\s*:/,
|
|
529
|
-
constructorShort: /"constructor"\s*:/
|
|
530
|
-
}, Mt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, Nt = {
|
|
531
|
-
true: !0,
|
|
532
|
-
false: !1,
|
|
533
|
-
null: null,
|
|
534
|
-
undefined: void 0,
|
|
535
|
-
nan: NaN,
|
|
536
|
-
infinity: Infinity,
|
|
537
|
-
"-infinity": -Infinity
|
|
538
|
-
}, Pt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
|
|
539
|
-
function Ft(e) {
|
|
540
|
-
return e instanceof Date && !isNaN(e.getTime());
|
|
541
|
-
}
|
|
542
|
-
function It(e) {
|
|
543
|
-
let t = Pt.exec(e);
|
|
544
|
-
if (!t) return null;
|
|
545
|
-
let [, n, r, i, a, o, s, c, l, u, d] = t, f = new Date(Date.UTC(parseInt(n, 10), parseInt(r, 10) - 1, parseInt(i, 10), parseInt(a, 10), parseInt(o, 10), parseInt(s, 10), c ? parseInt(c.padEnd(3, "0"), 10) : 0));
|
|
546
|
-
if (l) {
|
|
547
|
-
let e = (parseInt(u, 10) * 60 + parseInt(d, 10)) * (l === "+" ? -1 : 1);
|
|
548
|
-
f.setUTCMinutes(f.getUTCMinutes() + e);
|
|
549
|
-
}
|
|
550
|
-
return Ft(f) ? f : null;
|
|
551
|
-
}
|
|
552
|
-
function Lt(e, t = {}) {
|
|
553
|
-
let { strict: n = !1, warnings: r = !1, reviver: i, parseDates: a = !0 } = t;
|
|
554
|
-
if (typeof e != "string") return e;
|
|
555
|
-
let o = e.trim(), s = o.toLowerCase();
|
|
556
|
-
if (s.length <= 9 && s in Nt) return Nt[s];
|
|
557
|
-
if (!Mt.test(o)) {
|
|
558
|
-
if (n) throw SyntaxError("[better-json] Invalid JSON");
|
|
559
|
-
return e;
|
|
560
|
-
}
|
|
561
|
-
if (Object.entries(jt).some(([e, t]) => {
|
|
562
|
-
let n = t.test(o);
|
|
563
|
-
return n && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`), n;
|
|
564
|
-
}) && n) throw Error("[better-json] Potential prototype pollution attempt detected");
|
|
565
|
-
try {
|
|
566
|
-
return JSON.parse(o, (e, t) => {
|
|
567
|
-
if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) {
|
|
568
|
-
r && console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (a && typeof t == "string") {
|
|
572
|
-
let e = It(t);
|
|
573
|
-
if (e) return e;
|
|
574
|
-
}
|
|
575
|
-
return i ? i(e, t) : t;
|
|
576
|
-
});
|
|
577
|
-
} catch (t) {
|
|
578
|
-
if (n) throw t;
|
|
579
|
-
return e;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
function Rt(e, t = { strict: !0 }) {
|
|
583
|
-
return Lt(e, t);
|
|
584
|
-
}
|
|
585
|
-
//#endregion
|
|
586
|
-
//#region node_modules/nanostores/atom/index.js
|
|
587
|
-
var P = [], F = 0, I = 4, zt = globalThis.nanostoresGlobal ||= { epoch: 0 }, Bt = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
588
|
-
let t = [], n = {
|
|
589
|
-
get() {
|
|
590
|
-
return n.lc || n.listen(() => {})(), n.value;
|
|
591
|
-
},
|
|
592
|
-
init: e,
|
|
593
|
-
lc: 0,
|
|
594
|
-
listen(e) {
|
|
595
|
-
return n.lc = t.push(e), () => {
|
|
596
|
-
for (let t = F + I; t < P.length;) P[t] === e ? P.splice(t, I) : t += I;
|
|
597
|
-
let r = t.indexOf(e);
|
|
598
|
-
~r && (t.splice(r, 1), --n.lc || n.off());
|
|
599
|
-
};
|
|
600
|
-
},
|
|
601
|
-
notify(e, r) {
|
|
602
|
-
zt.epoch++;
|
|
603
|
-
let i = !P.length;
|
|
604
|
-
for (let i of t) P.push(i, n.value, e, r);
|
|
605
|
-
if (i) {
|
|
606
|
-
for (F = 0; F < P.length; F += I) P[F](P[F + 1], P[F + 2], P[F + 3]);
|
|
607
|
-
P.length = 0;
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
off() {},
|
|
611
|
-
set(e) {
|
|
612
|
-
let t = n.value;
|
|
613
|
-
t !== e && (n.value = e, n.notify(t));
|
|
614
|
-
},
|
|
615
|
-
subscribe(e) {
|
|
616
|
-
let t = n.listen(e);
|
|
617
|
-
return e(n.value), t;
|
|
618
|
-
},
|
|
619
|
-
value: e
|
|
620
|
-
};
|
|
621
|
-
return n;
|
|
622
|
-
}, Vt = 5, L = 6, R = 10, Ht = (e, t, n, r) => (e.events = e.events || {}, e.events[n + R] || (e.events[n + R] = r((t) => {
|
|
623
|
-
e.events[n].reduceRight((e, t) => (t(e), e), {
|
|
624
|
-
shared: {},
|
|
625
|
-
...t
|
|
626
|
-
});
|
|
627
|
-
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
628
|
-
let r = e.events[n], i = r.indexOf(t);
|
|
629
|
-
r.splice(i, 1), r.length || (delete e.events[n], e.events[n + R](), delete e.events[n + R]);
|
|
630
|
-
}), Ut = 1e3, Wt = (e, t) => Ht(e, (n) => {
|
|
631
|
-
let r = t(n);
|
|
632
|
-
r && e.events[L].push(r);
|
|
633
|
-
}, Vt, (t) => {
|
|
634
|
-
let n = e.listen;
|
|
635
|
-
e.listen = (...r) => (!e.lc && !e.active && (e.active = !0, t()), n(...r));
|
|
636
|
-
let r = e.off;
|
|
637
|
-
return e.events[L] = [], e.off = () => {
|
|
638
|
-
r(), setTimeout(() => {
|
|
639
|
-
if (e.active && !e.lc) {
|
|
640
|
-
e.active = !1;
|
|
641
|
-
for (let t of e.events[L]) t();
|
|
642
|
-
e.events[L] = [];
|
|
643
|
-
}
|
|
644
|
-
}, Ut);
|
|
645
|
-
}, () => {
|
|
646
|
-
e.listen = n, e.off = r;
|
|
647
|
-
};
|
|
648
|
-
}), Gt = () => typeof window > "u", Kt = (e, t, n, r) => {
|
|
649
|
-
let i = /* @__PURE__ */ Bt({
|
|
650
|
-
data: null,
|
|
651
|
-
error: null,
|
|
652
|
-
isPending: !0,
|
|
653
|
-
isRefetching: !1,
|
|
654
|
-
refetch: (e) => a(e)
|
|
655
|
-
}), a = async (e) => new Promise((a) => {
|
|
656
|
-
let o = typeof r == "function" ? r({
|
|
657
|
-
data: i.get().data,
|
|
658
|
-
error: i.get().error,
|
|
659
|
-
isPending: i.get().isPending
|
|
660
|
-
}) : r;
|
|
661
|
-
n(t, {
|
|
662
|
-
...o,
|
|
663
|
-
query: {
|
|
664
|
-
...o?.query,
|
|
665
|
-
...e?.query
|
|
666
|
-
},
|
|
667
|
-
async onSuccess(e) {
|
|
668
|
-
i.set({
|
|
669
|
-
data: e.data,
|
|
670
|
-
error: null,
|
|
671
|
-
isPending: !1,
|
|
672
|
-
isRefetching: !1,
|
|
673
|
-
refetch: i.value.refetch
|
|
674
|
-
}), await o?.onSuccess?.(e);
|
|
675
|
-
},
|
|
676
|
-
async onError(e) {
|
|
677
|
-
let { request: t } = e, n = typeof t.retry == "number" ? t.retry : t.retry?.attempts, r = t.retryAttempt || 0;
|
|
678
|
-
if (n && r < n) return;
|
|
679
|
-
let a = e.error.status === 401;
|
|
680
|
-
i.set({
|
|
681
|
-
error: e.error,
|
|
682
|
-
data: a ? null : i.get().data,
|
|
683
|
-
isPending: !1,
|
|
684
|
-
isRefetching: !1,
|
|
685
|
-
refetch: i.value.refetch
|
|
686
|
-
}), await o?.onError?.(e);
|
|
687
|
-
},
|
|
688
|
-
async onRequest(e) {
|
|
689
|
-
let t = i.get();
|
|
690
|
-
i.set({
|
|
691
|
-
isPending: t.data === null,
|
|
692
|
-
data: t.data,
|
|
693
|
-
error: null,
|
|
694
|
-
isRefetching: !0,
|
|
695
|
-
refetch: i.value.refetch
|
|
696
|
-
}), await o?.onRequest?.(e);
|
|
697
|
-
}
|
|
698
|
-
}).catch((e) => {
|
|
699
|
-
i.set({
|
|
700
|
-
error: e,
|
|
701
|
-
data: i.get().data,
|
|
702
|
-
isPending: !1,
|
|
703
|
-
isRefetching: !1,
|
|
704
|
-
refetch: i.value.refetch
|
|
705
|
-
});
|
|
706
|
-
}).finally(() => {
|
|
707
|
-
a(void 0);
|
|
708
|
-
});
|
|
709
|
-
});
|
|
710
|
-
e = Array.isArray(e) ? e : [e];
|
|
711
|
-
let o = !1;
|
|
712
|
-
for (let t of e) t.subscribe(async () => {
|
|
713
|
-
Gt() || (o ? await a() : Wt(i, () => {
|
|
714
|
-
let e = setTimeout(async () => {
|
|
715
|
-
o || (o = !0, await a());
|
|
716
|
-
}, 0);
|
|
717
|
-
return () => {
|
|
718
|
-
i.off(), t.off(), clearTimeout(e);
|
|
719
|
-
};
|
|
720
|
-
}));
|
|
721
|
-
});
|
|
722
|
-
return i;
|
|
723
|
-
}, z = () => Math.floor(Date.now() / 1e3);
|
|
724
|
-
function qt(e) {
|
|
725
|
-
return typeof e == "object" && e && "data" in e && "error" in e ? e : {
|
|
726
|
-
data: e,
|
|
727
|
-
error: null
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
var Jt = 5;
|
|
731
|
-
function Yt(e) {
|
|
732
|
-
let { sessionAtom: t, sessionSignal: n, $fetch: r, options: i = {} } = e, a = i.sessionOptions?.refetchInterval ?? 0, o = i.sessionOptions?.refetchOnWindowFocus ?? !0, s = i.sessionOptions?.refetchWhenOffline ?? !1, c = {
|
|
733
|
-
lastSync: 0,
|
|
734
|
-
lastSessionRequest: 0,
|
|
735
|
-
cachedSession: void 0
|
|
736
|
-
}, l = () => s || At().isOnline, u = (e) => {
|
|
737
|
-
if (!l()) return;
|
|
738
|
-
if (e?.event === "storage") {
|
|
739
|
-
c.lastSync = z(), n.set(!n.get());
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
let i = t.get(), a = () => {
|
|
743
|
-
c.lastSessionRequest = z(), r("/get-session").then(async (e) => {
|
|
744
|
-
let { data: a, error: o } = qt(e);
|
|
745
|
-
if (a?.needsRefresh) try {
|
|
746
|
-
let e = await r("/get-session", { method: "POST" });
|
|
747
|
-
({data: a, error: o} = qt(e));
|
|
748
|
-
} catch {}
|
|
749
|
-
let s = a?.session && a?.user ? a : null;
|
|
750
|
-
t.set({
|
|
751
|
-
...i,
|
|
752
|
-
data: s,
|
|
753
|
-
error: o
|
|
754
|
-
}), c.lastSync = z(), n.set(!n.get());
|
|
755
|
-
}).catch(() => {});
|
|
756
|
-
};
|
|
757
|
-
if (e?.event === "poll") {
|
|
758
|
-
a();
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
if (e?.event === "visibilitychange") {
|
|
762
|
-
if (z() - c.lastSessionRequest < Jt) return;
|
|
763
|
-
c.lastSessionRequest = z();
|
|
764
|
-
}
|
|
765
|
-
if (e?.event === "visibilitychange") {
|
|
766
|
-
a();
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
(i?.data === null || i?.data === void 0) && (c.lastSync = z(), n.set(!n.get()));
|
|
770
|
-
}, d = (e) => {
|
|
771
|
-
wt().post({
|
|
772
|
-
event: "session",
|
|
773
|
-
data: { trigger: e },
|
|
774
|
-
clientId: Math.random().toString(36).substring(7)
|
|
775
|
-
});
|
|
776
|
-
}, f = () => {
|
|
777
|
-
a && a > 0 && (c.pollInterval = setInterval(() => {
|
|
778
|
-
t.get()?.data && u({ event: "poll" });
|
|
779
|
-
}, a * 1e3));
|
|
780
|
-
}, p = () => {
|
|
781
|
-
c.unsubscribeBroadcast = wt().subscribe(() => {
|
|
782
|
-
u({ event: "storage" });
|
|
783
|
-
});
|
|
784
|
-
}, m = () => {
|
|
785
|
-
o && (c.unsubscribeFocus = Dt().subscribe(() => {
|
|
786
|
-
u({ event: "visibilitychange" });
|
|
787
|
-
}));
|
|
788
|
-
}, h = () => {
|
|
789
|
-
c.unsubscribeOnline = At().subscribe((e) => {
|
|
790
|
-
e && u({ event: "visibilitychange" });
|
|
791
|
-
});
|
|
792
|
-
};
|
|
793
|
-
return {
|
|
794
|
-
init: () => {
|
|
795
|
-
f(), p(), m(), h(), wt().setup(), Dt().setup(), At().setup();
|
|
796
|
-
},
|
|
797
|
-
cleanup: () => {
|
|
798
|
-
c.pollInterval &&= (clearInterval(c.pollInterval), void 0), c.unsubscribeBroadcast &&= (c.unsubscribeBroadcast(), void 0), c.unsubscribeFocus &&= (c.unsubscribeFocus(), void 0), c.unsubscribeOnline &&= (c.unsubscribeOnline(), void 0), c.lastSync = 0, c.lastSessionRequest = 0, c.cachedSession = void 0;
|
|
799
|
-
},
|
|
800
|
-
triggerRefetch: u,
|
|
801
|
-
broadcastSessionUpdate: d
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
//#endregion
|
|
805
|
-
//#region node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
806
|
-
var B = Object.create(null), V = (e) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? B : globalThis), H = new Proxy(B, {
|
|
807
|
-
get(e, t) {
|
|
808
|
-
return V()[t] ?? B[t];
|
|
809
|
-
},
|
|
810
|
-
has(e, t) {
|
|
811
|
-
return t in V() || t in B;
|
|
812
|
-
},
|
|
813
|
-
set(e, t, n) {
|
|
814
|
-
let r = V(!0);
|
|
815
|
-
return r[t] = n, !0;
|
|
816
|
-
},
|
|
817
|
-
deleteProperty(e, t) {
|
|
818
|
-
if (!t) return !1;
|
|
819
|
-
let n = V(!0);
|
|
820
|
-
return delete n[t], !0;
|
|
821
|
-
},
|
|
822
|
-
ownKeys() {
|
|
823
|
-
let e = V(!0);
|
|
824
|
-
return Object.keys(e);
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
typeof process < "u" && process.env;
|
|
828
|
-
function U(e, t) {
|
|
829
|
-
return typeof process < "u" && process.env ? process.env[e] ?? t : typeof Deno < "u" ? Deno.env.get(e) ?? t : typeof Bun < "u" ? Bun.env[e] ?? t : t;
|
|
830
|
-
}
|
|
831
|
-
Object.freeze({
|
|
832
|
-
get BETTER_AUTH_SECRET() {
|
|
833
|
-
return U("BETTER_AUTH_SECRET");
|
|
834
|
-
},
|
|
835
|
-
get AUTH_SECRET() {
|
|
836
|
-
return U("AUTH_SECRET");
|
|
837
|
-
},
|
|
838
|
-
get BETTER_AUTH_TELEMETRY() {
|
|
839
|
-
return U("BETTER_AUTH_TELEMETRY");
|
|
840
|
-
},
|
|
841
|
-
get BETTER_AUTH_TELEMETRY_ID() {
|
|
842
|
-
return U("BETTER_AUTH_TELEMETRY_ID");
|
|
843
|
-
},
|
|
844
|
-
get NODE_ENV() {
|
|
845
|
-
return U("NODE_ENV", "development");
|
|
846
|
-
},
|
|
847
|
-
get PACKAGE_VERSION() {
|
|
848
|
-
return U("PACKAGE_VERSION", "0.0.0");
|
|
849
|
-
},
|
|
850
|
-
get BETTER_AUTH_TELEMETRY_ENDPOINT() {
|
|
851
|
-
return U("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
|
|
852
|
-
}
|
|
853
|
-
});
|
|
854
|
-
//#endregion
|
|
855
|
-
//#region node_modules/better-call/dist/error.mjs
|
|
856
|
-
function Xt() {
|
|
857
|
-
let e = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
858
|
-
return e === void 0 ? Object.isExtensible(Error) : Object.prototype.hasOwnProperty.call(e, "writable") ? e.writable : e.set !== void 0;
|
|
859
|
-
}
|
|
860
|
-
function Zt(e) {
|
|
861
|
-
let t = e.split("\n at ");
|
|
862
|
-
return t.length <= 1 ? e : (t.splice(1, 1), t.join("\n at "));
|
|
863
|
-
}
|
|
864
|
-
function Qt(e, t) {
|
|
865
|
-
class n extends e {
|
|
866
|
-
#e;
|
|
867
|
-
constructor(...e) {
|
|
868
|
-
if (Xt()) {
|
|
869
|
-
let t = Error.stackTraceLimit;
|
|
870
|
-
Error.stackTraceLimit = 0, super(...e), Error.stackTraceLimit = t;
|
|
871
|
-
} else super(...e);
|
|
872
|
-
let t = (/* @__PURE__ */ Error()).stack;
|
|
873
|
-
t && (this.#e = Zt(t.replace(/^Error/, this.name)));
|
|
874
|
-
}
|
|
875
|
-
get errorStack() {
|
|
876
|
-
return this.#e;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
return Object.defineProperty(n.prototype, "constructor", {
|
|
880
|
-
get() {
|
|
881
|
-
return t;
|
|
882
|
-
},
|
|
883
|
-
enumerable: !1,
|
|
884
|
-
configurable: !0
|
|
885
|
-
}), n;
|
|
886
|
-
}
|
|
887
|
-
var $t = {
|
|
888
|
-
OK: 200,
|
|
889
|
-
CREATED: 201,
|
|
890
|
-
ACCEPTED: 202,
|
|
891
|
-
NO_CONTENT: 204,
|
|
892
|
-
MULTIPLE_CHOICES: 300,
|
|
893
|
-
MOVED_PERMANENTLY: 301,
|
|
894
|
-
FOUND: 302,
|
|
895
|
-
SEE_OTHER: 303,
|
|
896
|
-
NOT_MODIFIED: 304,
|
|
897
|
-
TEMPORARY_REDIRECT: 307,
|
|
898
|
-
BAD_REQUEST: 400,
|
|
899
|
-
UNAUTHORIZED: 401,
|
|
900
|
-
PAYMENT_REQUIRED: 402,
|
|
901
|
-
FORBIDDEN: 403,
|
|
902
|
-
NOT_FOUND: 404,
|
|
903
|
-
METHOD_NOT_ALLOWED: 405,
|
|
904
|
-
NOT_ACCEPTABLE: 406,
|
|
905
|
-
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
906
|
-
REQUEST_TIMEOUT: 408,
|
|
907
|
-
CONFLICT: 409,
|
|
908
|
-
GONE: 410,
|
|
909
|
-
LENGTH_REQUIRED: 411,
|
|
910
|
-
PRECONDITION_FAILED: 412,
|
|
911
|
-
PAYLOAD_TOO_LARGE: 413,
|
|
912
|
-
URI_TOO_LONG: 414,
|
|
913
|
-
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
914
|
-
RANGE_NOT_SATISFIABLE: 416,
|
|
915
|
-
EXPECTATION_FAILED: 417,
|
|
916
|
-
"I'M_A_TEAPOT": 418,
|
|
917
|
-
MISDIRECTED_REQUEST: 421,
|
|
918
|
-
UNPROCESSABLE_ENTITY: 422,
|
|
919
|
-
LOCKED: 423,
|
|
920
|
-
FAILED_DEPENDENCY: 424,
|
|
921
|
-
TOO_EARLY: 425,
|
|
922
|
-
UPGRADE_REQUIRED: 426,
|
|
923
|
-
PRECONDITION_REQUIRED: 428,
|
|
924
|
-
TOO_MANY_REQUESTS: 429,
|
|
925
|
-
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
|
|
926
|
-
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
|
|
927
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
928
|
-
NOT_IMPLEMENTED: 501,
|
|
929
|
-
BAD_GATEWAY: 502,
|
|
930
|
-
SERVICE_UNAVAILABLE: 503,
|
|
931
|
-
GATEWAY_TIMEOUT: 504,
|
|
932
|
-
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
933
|
-
VARIANT_ALSO_NEGOTIATES: 506,
|
|
934
|
-
INSUFFICIENT_STORAGE: 507,
|
|
935
|
-
LOOP_DETECTED: 508,
|
|
936
|
-
NOT_EXTENDED: 510,
|
|
937
|
-
NETWORK_AUTHENTICATION_REQUIRED: 511
|
|
938
|
-
};
|
|
939
|
-
Qt(class extends Error {
|
|
940
|
-
constructor(e = "INTERNAL_SERVER_ERROR", t = void 0, n = {}, r = typeof e == "number" ? e : $t[e]) {
|
|
941
|
-
super(t?.message, t?.cause ? { cause: t.cause } : void 0), this.status = e, this.body = t, this.headers = n, this.statusCode = r, this.name = "APIError", this.status = e, this.headers = n, this.statusCode = r, this.body = t;
|
|
942
|
-
}
|
|
943
|
-
}, Error);
|
|
944
|
-
//#endregion
|
|
945
|
-
//#region node_modules/@better-auth/core/dist/error/index.mjs
|
|
946
|
-
var W = class extends Error {
|
|
947
|
-
constructor(e, t) {
|
|
948
|
-
super(e, t), this.name = "BetterAuthError", this.message = e, this.stack = "";
|
|
949
|
-
}
|
|
950
|
-
}, en = 47;
|
|
951
|
-
function tn(e) {
|
|
952
|
-
let t = e.length;
|
|
953
|
-
for (; t > 0 && e.charCodeAt(t - 1) === en;) t--;
|
|
954
|
-
return t === e.length ? e : e.slice(0, t);
|
|
955
|
-
}
|
|
956
|
-
function nn(e) {
|
|
957
|
-
try {
|
|
958
|
-
return (tn(new URL(e).pathname) || "/") !== "/";
|
|
959
|
-
} catch {
|
|
960
|
-
throw new W(`Invalid base URL: ${e}. Please provide a valid base URL.`);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
function rn(e) {
|
|
964
|
-
try {
|
|
965
|
-
let t = new URL(e);
|
|
966
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") throw new W(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`);
|
|
967
|
-
} catch (t) {
|
|
968
|
-
throw t instanceof W ? t : new W(`Invalid base URL: ${e}. Please provide a valid base URL.`, { cause: t });
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
function G(e, t = "/api/auth") {
|
|
972
|
-
if (rn(e), nn(e)) return e;
|
|
973
|
-
let n = tn(e);
|
|
974
|
-
return !t || t === "/" ? n : (t = t.startsWith("/") ? t : `/${t}`, `${n}${t}`);
|
|
975
|
-
}
|
|
976
|
-
function an(e, t) {
|
|
977
|
-
return !e || e.trim() === "" ? !1 : t === "proto" ? e === "http" || e === "https" : t === "host" ? [
|
|
978
|
-
/\.\./,
|
|
979
|
-
/\0/,
|
|
980
|
-
/[\s]/,
|
|
981
|
-
/^[.]/,
|
|
982
|
-
/[<>'"]/,
|
|
983
|
-
/javascript:/i,
|
|
984
|
-
/file:/i,
|
|
985
|
-
/data:/i
|
|
986
|
-
].some((t) => t.test(e)) ? !1 : /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e) || /^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e) || /^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e) || /^localhost(:[0-9]{1,5})?$/i.test(e) : !1;
|
|
987
|
-
}
|
|
988
|
-
function on(e, t, n, r, i) {
|
|
989
|
-
if (e) return G(e, t);
|
|
990
|
-
if (r !== !1) {
|
|
991
|
-
let e = H.BETTER_AUTH_URL || H.NEXT_PUBLIC_BETTER_AUTH_URL || H.PUBLIC_BETTER_AUTH_URL || H.NUXT_PUBLIC_BETTER_AUTH_URL || H.NUXT_PUBLIC_AUTH_URL || (H.BASE_URL === "/" ? void 0 : H.BASE_URL);
|
|
992
|
-
if (e) return G(e, t);
|
|
993
|
-
}
|
|
994
|
-
let a = n?.headers.get("x-forwarded-host"), o = n?.headers.get("x-forwarded-proto");
|
|
995
|
-
if (a && o && i && an(o, "proto") && an(a, "host")) try {
|
|
996
|
-
return G(`${o}://${a}`, t);
|
|
997
|
-
} catch {}
|
|
998
|
-
if (n) {
|
|
999
|
-
let e = sn(n.url);
|
|
1000
|
-
if (!e) throw new W("Could not get origin from request. Please provide a valid base URL.");
|
|
1001
|
-
return G(e, t);
|
|
1002
|
-
}
|
|
1003
|
-
if (typeof window < "u" && window.location) return G(window.location.origin, t);
|
|
1004
|
-
}
|
|
1005
|
-
function sn(e) {
|
|
1006
|
-
try {
|
|
1007
|
-
let t = new URL(e);
|
|
1008
|
-
return t.origin === "null" ? null : t.origin;
|
|
1009
|
-
} catch {
|
|
1010
|
-
return null;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
//#endregion
|
|
1014
|
-
//#region node_modules/@better-auth/core/dist/utils/url.mjs
|
|
1015
|
-
var cn = [
|
|
1016
|
-
"javascript:",
|
|
1017
|
-
"data:",
|
|
1018
|
-
"vbscript:"
|
|
1019
|
-
];
|
|
1020
|
-
function ln(e) {
|
|
1021
|
-
let t;
|
|
1022
|
-
try {
|
|
1023
|
-
t = new URL(e);
|
|
1024
|
-
} catch {
|
|
1025
|
-
return !0;
|
|
1026
|
-
}
|
|
1027
|
-
return !cn.includes(t.protocol);
|
|
1028
|
-
}
|
|
1029
|
-
//#endregion
|
|
1030
|
-
//#region node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
1031
|
-
var un = {
|
|
1032
|
-
id: "redirect",
|
|
1033
|
-
name: "Redirect",
|
|
1034
|
-
hooks: { onSuccess(e) {
|
|
1035
|
-
if (e.data?.url && e.data?.redirect && ln(e.data.url) && typeof window < "u" && window.location && window.location) try {
|
|
1036
|
-
window.location.href = e.data.url;
|
|
1037
|
-
} catch {}
|
|
1038
|
-
} }
|
|
1039
|
-
};
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region node_modules/better-auth/dist/client/session-atom.mjs
|
|
1042
|
-
function dn(e, t) {
|
|
1043
|
-
let n = /* @__PURE__ */ Bt(!1), r = Kt(n, "/get-session", e, { method: "GET" }), i = () => {};
|
|
1044
|
-
return Wt(r, () => {
|
|
1045
|
-
let a = Yt({
|
|
1046
|
-
sessionAtom: r,
|
|
1047
|
-
sessionSignal: n,
|
|
1048
|
-
$fetch: e,
|
|
1049
|
-
options: t
|
|
1050
|
-
});
|
|
1051
|
-
return a.init(), i = a.broadcastSessionUpdate, () => {
|
|
1052
|
-
a.cleanup();
|
|
1053
|
-
};
|
|
1054
|
-
}), {
|
|
1055
|
-
session: r,
|
|
1056
|
-
$sessionSignal: n,
|
|
1057
|
-
broadcastSessionUpdate: (e) => i(e)
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
//#endregion
|
|
1061
|
-
//#region node_modules/defu/dist/defu.mjs
|
|
1062
|
-
function fn(e) {
|
|
1063
|
-
if (typeof e != "object" || !e) return !1;
|
|
1064
|
-
let t = Object.getPrototypeOf(e);
|
|
1065
|
-
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;
|
|
1066
|
-
}
|
|
1067
|
-
function pn(e, t, n = ".", r) {
|
|
1068
|
-
if (!fn(t)) return pn(e, {}, n, r);
|
|
1069
|
-
let i = { ...t };
|
|
1070
|
-
for (let t of Object.keys(e)) {
|
|
1071
|
-
if (t === "__proto__" || t === "constructor") continue;
|
|
1072
|
-
let a = e[t];
|
|
1073
|
-
a != null && (r && r(i, t, a, n) || (Array.isArray(a) && Array.isArray(i[t]) ? i[t] = [...a, ...i[t]] : fn(a) && fn(i[t]) ? i[t] = pn(a, i[t], (n ? `${n}.` : "") + t.toString(), r) : i[t] = a));
|
|
1074
|
-
}
|
|
1075
|
-
return i;
|
|
1076
|
-
}
|
|
1077
|
-
function mn(e) {
|
|
1078
|
-
return (...t) => t.reduce((t, n) => pn(t, n, "", e), {});
|
|
1079
|
-
}
|
|
1080
|
-
var hn = mn(), gn = Object.defineProperty, _n = Object.defineProperties, vn = Object.getOwnPropertyDescriptors, yn = Object.getOwnPropertySymbols, bn = Object.prototype.hasOwnProperty, xn = Object.prototype.propertyIsEnumerable, Sn = (e, t, n) => t in e ? gn(e, t, {
|
|
1081
|
-
enumerable: !0,
|
|
1082
|
-
configurable: !0,
|
|
1083
|
-
writable: !0,
|
|
1084
|
-
value: n
|
|
1085
|
-
}) : e[t] = n, K = (e, t) => {
|
|
1086
|
-
for (var n in t ||= {}) bn.call(t, n) && Sn(e, n, t[n]);
|
|
1087
|
-
if (yn) for (var n of yn(t)) xn.call(t, n) && Sn(e, n, t[n]);
|
|
1088
|
-
return e;
|
|
1089
|
-
}, q = (e, t) => _n(e, vn(t)), Cn = class extends Error {
|
|
1090
|
-
constructor(e, t, n) {
|
|
1091
|
-
super(t || e.toString(), { cause: n }), this.status = e, this.statusText = t, this.error = n, Error.captureStackTrace(this, this.constructor);
|
|
1092
|
-
}
|
|
1093
|
-
}, wn = async (e, t) => {
|
|
1094
|
-
let n = t || {}, r = {
|
|
1095
|
-
onRequest: [t?.onRequest],
|
|
1096
|
-
onResponse: [t?.onResponse],
|
|
1097
|
-
onSuccess: [t?.onSuccess],
|
|
1098
|
-
onError: [t?.onError],
|
|
1099
|
-
onRetry: [t?.onRetry]
|
|
1100
|
-
};
|
|
1101
|
-
if (!t || !t?.plugins) return {
|
|
1102
|
-
url: e,
|
|
1103
|
-
options: n,
|
|
1104
|
-
hooks: r
|
|
1105
|
-
};
|
|
1106
|
-
for (let i of t?.plugins || []) {
|
|
1107
|
-
if (i.init) {
|
|
1108
|
-
let r = await i.init?.call(i, e.toString(), t);
|
|
1109
|
-
n = r.options || n, e = r.url;
|
|
1110
|
-
}
|
|
1111
|
-
r.onRequest.push(i.hooks?.onRequest), r.onResponse.push(i.hooks?.onResponse), r.onSuccess.push(i.hooks?.onSuccess), r.onError.push(i.hooks?.onError), r.onRetry.push(i.hooks?.onRetry);
|
|
1112
|
-
}
|
|
1113
|
-
return {
|
|
1114
|
-
url: e,
|
|
1115
|
-
options: n,
|
|
1116
|
-
hooks: r
|
|
1117
|
-
};
|
|
1118
|
-
}, Tn = class {
|
|
1119
|
-
constructor(e) {
|
|
1120
|
-
this.options = e;
|
|
1121
|
-
}
|
|
1122
|
-
shouldAttemptRetry(e, t) {
|
|
1123
|
-
return this.options.shouldRetry ? Promise.resolve(e < this.options.attempts && this.options.shouldRetry(t)) : Promise.resolve(e < this.options.attempts);
|
|
1124
|
-
}
|
|
1125
|
-
getDelay() {
|
|
1126
|
-
return this.options.delay;
|
|
1127
|
-
}
|
|
1128
|
-
}, En = class {
|
|
1129
|
-
constructor(e) {
|
|
1130
|
-
this.options = e;
|
|
1131
|
-
}
|
|
1132
|
-
shouldAttemptRetry(e, t) {
|
|
1133
|
-
return this.options.shouldRetry ? Promise.resolve(e < this.options.attempts && this.options.shouldRetry(t)) : Promise.resolve(e < this.options.attempts);
|
|
1134
|
-
}
|
|
1135
|
-
getDelay(e) {
|
|
1136
|
-
return Math.min(this.options.maxDelay, this.options.baseDelay * 2 ** e);
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
function Dn(e) {
|
|
1140
|
-
if (typeof e == "number") return new Tn({
|
|
1141
|
-
type: "linear",
|
|
1142
|
-
attempts: e,
|
|
1143
|
-
delay: 1e3
|
|
1144
|
-
});
|
|
1145
|
-
switch (e.type) {
|
|
1146
|
-
case "linear": return new Tn(e);
|
|
1147
|
-
case "exponential": return new En(e);
|
|
1148
|
-
default: throw Error("Invalid retry strategy");
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
var On = async (e) => {
|
|
1152
|
-
let t = {}, n = async (e) => typeof e == "function" ? await e() : e;
|
|
1153
|
-
if (e?.auth) {
|
|
1154
|
-
if (e.auth.type === "Bearer") {
|
|
1155
|
-
let r = await n(e.auth.token);
|
|
1156
|
-
if (!r) return t;
|
|
1157
|
-
t.authorization = `Bearer ${r}`;
|
|
1158
|
-
} else if (e.auth.type === "Basic") {
|
|
1159
|
-
let [r, i] = await Promise.all([n(e.auth.username), n(e.auth.password)]);
|
|
1160
|
-
if (!r || !i) return t;
|
|
1161
|
-
t.authorization = `Basic ${btoa(`${r}:${i}`)}`;
|
|
1162
|
-
} else if (e.auth.type === "Custom") {
|
|
1163
|
-
let [r, i] = await Promise.all([n(e.auth.prefix), n(e.auth.value)]);
|
|
1164
|
-
if (!i) return t;
|
|
1165
|
-
t.authorization = `${r ?? ""} ${i}`;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
return t;
|
|
1169
|
-
}, kn = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
1170
|
-
function An(e) {
|
|
1171
|
-
let t = e.headers.get("content-type"), n = /* @__PURE__ */ new Set([
|
|
1172
|
-
"image/svg",
|
|
1173
|
-
"application/xml",
|
|
1174
|
-
"application/xhtml",
|
|
1175
|
-
"application/html"
|
|
1176
|
-
]);
|
|
1177
|
-
if (!t) return "json";
|
|
1178
|
-
let r = t.split(";").shift() || "";
|
|
1179
|
-
return kn.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
|
|
1180
|
-
}
|
|
1181
|
-
function jn(e) {
|
|
1182
|
-
try {
|
|
1183
|
-
return JSON.parse(e), !0;
|
|
1184
|
-
} catch {
|
|
1185
|
-
return !1;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
function Mn(e) {
|
|
1189
|
-
if (e === void 0) return !1;
|
|
1190
|
-
let t = typeof e;
|
|
1191
|
-
return t === "string" || t === "number" || t === "boolean" || t === null ? !0 : t === "object" ? Array.isArray(e) ? !0 : e.buffer ? !1 : e.constructor && e.constructor.name === "Object" || typeof e.toJSON == "function" : !1;
|
|
1192
|
-
}
|
|
1193
|
-
function Nn(e) {
|
|
1194
|
-
try {
|
|
1195
|
-
return JSON.parse(e);
|
|
1196
|
-
} catch {
|
|
1197
|
-
return e;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
function Pn(e) {
|
|
1201
|
-
return typeof e == "function";
|
|
1202
|
-
}
|
|
1203
|
-
function Fn(e) {
|
|
1204
|
-
if (e?.customFetchImpl) return e.customFetchImpl;
|
|
1205
|
-
if (typeof globalThis < "u" && Pn(globalThis.fetch)) return globalThis.fetch;
|
|
1206
|
-
if (typeof window < "u" && Pn(window.fetch)) return window.fetch;
|
|
1207
|
-
throw Error("No fetch implementation found");
|
|
1208
|
-
}
|
|
1209
|
-
async function In(e) {
|
|
1210
|
-
let t = new Headers(e?.headers), n = await On(e);
|
|
1211
|
-
for (let [e, r] of Object.entries(n || {})) t.set(e, r);
|
|
1212
|
-
if (!t.has("content-type")) {
|
|
1213
|
-
let n = Ln(e?.body);
|
|
1214
|
-
n && t.set("content-type", n);
|
|
1215
|
-
}
|
|
1216
|
-
return t;
|
|
1217
|
-
}
|
|
1218
|
-
function Ln(e) {
|
|
1219
|
-
return Mn(e) ? "application/json" : null;
|
|
1220
|
-
}
|
|
1221
|
-
function Rn(e) {
|
|
1222
|
-
if (!e?.body) return null;
|
|
1223
|
-
let t = new Headers(e?.headers);
|
|
1224
|
-
if (Mn(e.body) && !t.has("content-type")) {
|
|
1225
|
-
for (let [t, n] of Object.entries(e?.body)) n instanceof Date && (e.body[t] = n.toISOString());
|
|
1226
|
-
return JSON.stringify(e.body);
|
|
1227
|
-
}
|
|
1228
|
-
return t.has("content-type") && t.get("content-type") === "application/x-www-form-urlencoded" && Mn(e.body) ? new URLSearchParams(e.body).toString() : e.body;
|
|
1229
|
-
}
|
|
1230
|
-
function zn(e, t) {
|
|
1231
|
-
if (t?.method) return t.method.toUpperCase();
|
|
1232
|
-
if (e.startsWith("@")) {
|
|
1233
|
-
let n = e.split("@")[1]?.split("/")[0];
|
|
1234
|
-
return Hn.includes(n) ? n.toUpperCase() : t?.body ? "POST" : "GET";
|
|
1235
|
-
}
|
|
1236
|
-
return t?.body ? "POST" : "GET";
|
|
1237
|
-
}
|
|
1238
|
-
function Bn(e, t) {
|
|
1239
|
-
let n;
|
|
1240
|
-
return !e?.signal && e?.timeout && (n = setTimeout(() => t?.abort(), e?.timeout)), {
|
|
1241
|
-
abortTimeout: n,
|
|
1242
|
-
clearTimeout: () => {
|
|
1243
|
-
n && clearTimeout(n);
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
var Vn = class e extends Error {
|
|
1248
|
-
constructor(t, n) {
|
|
1249
|
-
super(n || JSON.stringify(t, null, 2)), this.issues = t, Object.setPrototypeOf(this, e.prototype);
|
|
1250
|
-
}
|
|
1251
|
-
};
|
|
1252
|
-
async function J(e, t) {
|
|
1253
|
-
let n = await e["~standard"].validate(t);
|
|
1254
|
-
if (n.issues) throw new Vn(n.issues);
|
|
1255
|
-
return n.value;
|
|
1256
|
-
}
|
|
1257
|
-
var Hn = [
|
|
1258
|
-
"get",
|
|
1259
|
-
"post",
|
|
1260
|
-
"put",
|
|
1261
|
-
"patch",
|
|
1262
|
-
"delete"
|
|
1263
|
-
], Un = (e) => ({
|
|
1264
|
-
id: "apply-schema",
|
|
1265
|
-
name: "Apply Schema",
|
|
1266
|
-
version: "1.0.0",
|
|
1267
|
-
async init(t, n) {
|
|
1268
|
-
let r = e.plugins?.find((e) => e.schema?.config ? t.startsWith(e.schema.config.baseURL || "") || t.startsWith(e.schema.config.prefix || "") : !1)?.schema || e.schema;
|
|
1269
|
-
if (r) {
|
|
1270
|
-
let e = t;
|
|
1271
|
-
r.config?.prefix && e.startsWith(r.config.prefix) && (e = e.replace(r.config.prefix, ""), r.config.baseURL && (t = t.replace(r.config.prefix, r.config.baseURL))), r.config?.baseURL && e.startsWith(r.config.baseURL) && (e = e.replace(r.config.baseURL, ""));
|
|
1272
|
-
let i = r.schema[e];
|
|
1273
|
-
if (i) {
|
|
1274
|
-
let e = q(K({}, n), {
|
|
1275
|
-
method: i.method,
|
|
1276
|
-
output: i.output
|
|
1277
|
-
});
|
|
1278
|
-
return n?.disableValidation || (e = q(K({}, e), {
|
|
1279
|
-
body: i.input ? await J(i.input, n?.body) : n?.body,
|
|
1280
|
-
params: i.params ? await J(i.params, n?.params) : n?.params,
|
|
1281
|
-
query: i.query ? await J(i.query, n?.query) : n?.query
|
|
1282
|
-
})), {
|
|
1283
|
-
url: t,
|
|
1284
|
-
options: e
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
return {
|
|
1289
|
-
url: t,
|
|
1290
|
-
options: n
|
|
1291
|
-
};
|
|
1292
|
-
}
|
|
1293
|
-
}), Wn = (e) => {
|
|
1294
|
-
async function t(t, n) {
|
|
1295
|
-
let r = q(K(K({}, e), n), { plugins: [
|
|
1296
|
-
...e?.plugins || [],
|
|
1297
|
-
Un(e || {}),
|
|
1298
|
-
...n?.plugins || []
|
|
1299
|
-
] });
|
|
1300
|
-
if (e?.catchAllError) try {
|
|
1301
|
-
return await Kn(t, r);
|
|
1302
|
-
} catch (e) {
|
|
1303
|
-
return {
|
|
1304
|
-
data: null,
|
|
1305
|
-
error: {
|
|
1306
|
-
status: 500,
|
|
1307
|
-
statusText: "Fetch Error",
|
|
1308
|
-
message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
|
|
1309
|
-
error: e
|
|
1310
|
-
}
|
|
1311
|
-
};
|
|
1312
|
-
}
|
|
1313
|
-
return await Kn(t, r);
|
|
1314
|
-
}
|
|
1315
|
-
return t;
|
|
1316
|
-
};
|
|
1317
|
-
function Gn(e, t) {
|
|
1318
|
-
let { baseURL: n, params: r, query: i } = t || {
|
|
1319
|
-
query: {},
|
|
1320
|
-
params: {},
|
|
1321
|
-
baseURL: ""
|
|
1322
|
-
}, a = e.startsWith("http") ? e.split("/").slice(0, 3).join("/") : n || "";
|
|
1323
|
-
if (e.startsWith("@")) {
|
|
1324
|
-
let t = e.toString().split("@")[1].split("/")[0];
|
|
1325
|
-
Hn.includes(t) && (e = e.replace(`@${t}/`, "/"));
|
|
1326
|
-
}
|
|
1327
|
-
a.endsWith("/") || (a += "/");
|
|
1328
|
-
let [o, s] = e.replace(a, "").split("?"), c = new URLSearchParams(s);
|
|
1329
|
-
for (let [e, t] of Object.entries(i || {})) {
|
|
1330
|
-
if (t == null) continue;
|
|
1331
|
-
let n;
|
|
1332
|
-
if (typeof t == "string") n = t;
|
|
1333
|
-
else if (Array.isArray(t)) {
|
|
1334
|
-
for (let n of t) c.append(e, n);
|
|
1335
|
-
continue;
|
|
1336
|
-
} else n = JSON.stringify(t);
|
|
1337
|
-
c.set(e, n);
|
|
1338
|
-
}
|
|
1339
|
-
if (r) if (Array.isArray(r)) {
|
|
1340
|
-
let e = o.split("/").filter((e) => e.startsWith(":"));
|
|
1341
|
-
for (let [t, n] of e.entries()) {
|
|
1342
|
-
let e = r[t];
|
|
1343
|
-
o = o.replace(n, e);
|
|
1344
|
-
}
|
|
1345
|
-
} else for (let [e, t] of Object.entries(r)) o = o.replace(`:${e}`, String(t));
|
|
1346
|
-
o = o.split("/").map(encodeURIComponent).join("/"), o.startsWith("/") && (o = o.slice(1));
|
|
1347
|
-
let l = c.toString();
|
|
1348
|
-
return l = l.length > 0 ? `?${l}`.replace(/\+/g, "%20") : "", a.startsWith("http") ? new URL(`${o}${l}`, a) : `${a}${o}${l}`;
|
|
1349
|
-
}
|
|
1350
|
-
var Kn = async (e, t) => {
|
|
1351
|
-
let { hooks: n, url: r, options: i } = await wn(e, t), a = Fn(i), o = new AbortController(), s = i.signal ?? o.signal, c = Gn(r, i), l = Rn(i), u = await In(i), d = zn(r, i), f = q(K({}, i), {
|
|
1352
|
-
url: c,
|
|
1353
|
-
headers: u,
|
|
1354
|
-
body: l,
|
|
1355
|
-
method: d,
|
|
1356
|
-
signal: s
|
|
1357
|
-
});
|
|
1358
|
-
for (let e of n.onRequest) if (e) {
|
|
1359
|
-
let t = await e(f);
|
|
1360
|
-
typeof t == "object" && t && (f = t);
|
|
1361
|
-
}
|
|
1362
|
-
("pipeTo" in f && typeof f.pipeTo == "function" || typeof t?.body?.pipe == "function") && ("duplex" in f || (f.duplex = "half"));
|
|
1363
|
-
let { clearTimeout: p } = Bn(i, o), m = await a(f.url, f);
|
|
1364
|
-
p();
|
|
1365
|
-
let h = {
|
|
1366
|
-
response: m,
|
|
1367
|
-
request: f
|
|
1368
|
-
};
|
|
1369
|
-
for (let e of n.onResponse) if (e) {
|
|
1370
|
-
let n = await e(q(K({}, h), { response: t?.hookOptions?.cloneResponse ? m.clone() : m }));
|
|
1371
|
-
n instanceof Response ? m = n : typeof n == "object" && n && (m = n.response);
|
|
1372
|
-
}
|
|
1373
|
-
if (m.ok) {
|
|
1374
|
-
if (f.method === "HEAD") return {
|
|
1375
|
-
data: "",
|
|
1376
|
-
error: null
|
|
1377
|
-
};
|
|
1378
|
-
let e = An(m), r = {
|
|
1379
|
-
data: null,
|
|
1380
|
-
response: m,
|
|
1381
|
-
request: f
|
|
1382
|
-
};
|
|
1383
|
-
if (e === "json" || e === "text") {
|
|
1384
|
-
let e = await m.text();
|
|
1385
|
-
r.data = await (f.jsonParser ?? Nn)(e);
|
|
1386
|
-
} else r.data = await m[e]();
|
|
1387
|
-
f?.output && f.output && !f.disableValidation && (r.data = await J(f.output, r.data));
|
|
1388
|
-
for (let e of n.onSuccess) e && await e(q(K({}, r), { response: t?.hookOptions?.cloneResponse ? m.clone() : m }));
|
|
1389
|
-
return t?.throw ? r.data : {
|
|
1390
|
-
data: r.data,
|
|
1391
|
-
error: null
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
|
-
let g = t?.jsonParser ?? Nn, _ = await m.text(), v = jn(_), y = v ? await g(_) : null, b = {
|
|
1395
|
-
response: m,
|
|
1396
|
-
responseText: _,
|
|
1397
|
-
request: f,
|
|
1398
|
-
error: q(K({}, y), {
|
|
1399
|
-
status: m.status,
|
|
1400
|
-
statusText: m.statusText
|
|
1401
|
-
})
|
|
1402
|
-
};
|
|
1403
|
-
for (let e of n.onError) e && await e(q(K({}, b), { response: t?.hookOptions?.cloneResponse ? m.clone() : m }));
|
|
1404
|
-
if (t?.retry) {
|
|
1405
|
-
let r = Dn(t.retry), i = t.retryAttempt ?? 0;
|
|
1406
|
-
if (await r.shouldAttemptRetry(i, m)) {
|
|
1407
|
-
for (let e of n.onRetry) e && await e(h);
|
|
1408
|
-
let a = r.getDelay(i);
|
|
1409
|
-
return await new Promise((e) => setTimeout(e, a)), await Kn(e, q(K({}, t), { retryAttempt: i + 1 }));
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
if (t?.throw) throw new Cn(m.status, m.statusText, v ? y : _);
|
|
1413
|
-
return {
|
|
1414
|
-
data: null,
|
|
1415
|
-
error: q(K({}, y), {
|
|
1416
|
-
status: m.status,
|
|
1417
|
-
statusText: m.statusText
|
|
1418
|
-
})
|
|
1419
|
-
};
|
|
1420
|
-
}, qn = (e) => {
|
|
1421
|
-
if (typeof process > "u") return;
|
|
1422
|
-
let t = e ?? "/api/auth";
|
|
1423
|
-
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
1424
|
-
if (typeof window > "u") {
|
|
1425
|
-
if (process.env.NEXTAUTH_URL) try {
|
|
1426
|
-
return process.env.NEXTAUTH_URL;
|
|
1427
|
-
} catch {}
|
|
1428
|
-
if (process.env.VERCEL_URL) try {
|
|
1429
|
-
let e = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
|
|
1430
|
-
return `${new URL(`${e}${process.env.VERCEL_URL}`).origin}${t}`;
|
|
1431
|
-
} catch {}
|
|
1432
|
-
}
|
|
1433
|
-
}, Jn = (e, t) => {
|
|
1434
|
-
let n = "credentials" in Request.prototype, r = on(e?.baseURL, e?.basePath, void 0, t) ?? qn(e?.basePath) ?? "/api/auth", i = e?.plugins?.flatMap((e) => e.fetchPlugins).filter((e) => e !== void 0) || [], a = {
|
|
1435
|
-
id: "lifecycle-hooks",
|
|
1436
|
-
name: "lifecycle-hooks",
|
|
1437
|
-
hooks: {
|
|
1438
|
-
onSuccess: e?.fetchOptions?.onSuccess,
|
|
1439
|
-
onError: e?.fetchOptions?.onError,
|
|
1440
|
-
onRequest: e?.fetchOptions?.onRequest,
|
|
1441
|
-
onResponse: e?.fetchOptions?.onResponse
|
|
1442
|
-
}
|
|
1443
|
-
}, { onSuccess: o, onError: s, onRequest: c, onResponse: l, ...u } = e?.fetchOptions || {}, d = Wn({
|
|
1444
|
-
baseURL: r,
|
|
1445
|
-
...n ? { credentials: "include" } : {},
|
|
1446
|
-
method: "GET",
|
|
1447
|
-
jsonParser(e) {
|
|
1448
|
-
return e ? Rt(e, { strict: !1 }) : null;
|
|
1449
|
-
},
|
|
1450
|
-
customFetchImpl: fetch,
|
|
1451
|
-
...u,
|
|
1452
|
-
plugins: [
|
|
1453
|
-
a,
|
|
1454
|
-
...u.plugins || [],
|
|
1455
|
-
...e?.disableDefaultFetchPlugins ? [] : [un],
|
|
1456
|
-
...i
|
|
1457
|
-
]
|
|
1458
|
-
}), { $sessionSignal: f, session: p, broadcastSessionUpdate: m } = dn(d, e), h = e?.plugins || [], g = {}, _ = {
|
|
1459
|
-
$sessionSignal: f,
|
|
1460
|
-
session: p
|
|
1461
|
-
}, v = {
|
|
1462
|
-
"/sign-out": "POST",
|
|
1463
|
-
"/revoke-sessions": "POST",
|
|
1464
|
-
"/revoke-other-sessions": "POST",
|
|
1465
|
-
"/delete-user": "POST"
|
|
1466
|
-
}, y = [{
|
|
1467
|
-
signal: "$sessionSignal",
|
|
1468
|
-
matcher(e) {
|
|
1469
|
-
return e === "/sign-out" || e === "/update-user" || e === "/update-session" || e === "/sign-up/email" || e === "/sign-in/email" || e === "/delete-user" || e === "/verify-email" || e === "/revoke-sessions" || e === "/revoke-session" || e === "/revoke-other-sessions" || e === "/change-email" || e === "/change-password";
|
|
1470
|
-
},
|
|
1471
|
-
callback(e) {
|
|
1472
|
-
e === "/sign-out" ? m("signout") : (e === "/update-user" || e === "/update-session") && m("updateUser");
|
|
1473
|
-
}
|
|
1474
|
-
}];
|
|
1475
|
-
for (let e of h) e.getAtoms && Object.assign(_, e.getAtoms?.(d)), e.pathMethods && Object.assign(v, e.pathMethods), e.atomListeners && y.push(...e.atomListeners);
|
|
1476
|
-
let b = {
|
|
1477
|
-
notify: (e) => {
|
|
1478
|
-
_[e].set(!_[e].get());
|
|
1479
|
-
},
|
|
1480
|
-
listen: (e, t) => {
|
|
1481
|
-
_[e].subscribe(t);
|
|
1482
|
-
},
|
|
1483
|
-
atoms: _
|
|
1484
|
-
};
|
|
1485
|
-
for (let t of h) t.getActions && (g = hn(t.getActions?.(d, b, e) ?? {}, g));
|
|
1486
|
-
return {
|
|
1487
|
-
get baseURL() {
|
|
1488
|
-
return r;
|
|
1489
|
-
},
|
|
1490
|
-
pluginsActions: g,
|
|
1491
|
-
pluginsAtoms: _,
|
|
1492
|
-
pluginPathMethods: v,
|
|
1493
|
-
atomListeners: y,
|
|
1494
|
-
$fetch: d,
|
|
1495
|
-
$store: b
|
|
1496
|
-
};
|
|
1497
|
-
};
|
|
1498
|
-
//#endregion
|
|
1499
|
-
//#region node_modules/better-auth/dist/utils/is-atom.mjs
|
|
1500
|
-
function Yn(e) {
|
|
1501
|
-
return typeof e == "object" && !!e && "get" in e && typeof e.get == "function" && "lc" in e && typeof e.lc == "number";
|
|
1502
|
-
}
|
|
224
|
+
return n && w.removeEventListener("statuschange", n), await t.hideInstallPrompt().catch(() => {}), a;
|
|
225
|
+
}, F = null;
|
|
226
|
+
D(() => (F ||= P().then(() => void 0).finally(() => {
|
|
227
|
+
F = null;
|
|
228
|
+
}), F));
|
|
1503
229
|
//#endregion
|
|
1504
|
-
//#region
|
|
1505
|
-
|
|
1506
|
-
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1507
|
-
}
|
|
1508
|
-
var Zn = /[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu, Qn = /['\u2019]/g;
|
|
1509
|
-
function $n(e) {
|
|
1510
|
-
return e.replace(Qn, "").match(Zn) ?? [];
|
|
1511
|
-
}
|
|
1512
|
-
function er(e) {
|
|
1513
|
-
return $n(e).map((e) => e.toLowerCase()).join("-");
|
|
1514
|
-
}
|
|
1515
|
-
//#endregion
|
|
1516
|
-
//#region node_modules/better-auth/dist/client/proxy.mjs
|
|
1517
|
-
function tr(e, t, n) {
|
|
1518
|
-
let r = t[e], { fetchOptions: i, query: a, ...o } = n || {};
|
|
1519
|
-
return r || (i?.method ? i.method : o && Object.keys(o).length > 0 ? "POST" : "GET");
|
|
1520
|
-
}
|
|
1521
|
-
function nr(e, t, n, r, i) {
|
|
1522
|
-
function a(o = []) {
|
|
1523
|
-
return new Proxy(function() {}, {
|
|
1524
|
-
get(t, n) {
|
|
1525
|
-
if (typeof n != "string" || n === "then" || n === "catch" || n === "finally") return;
|
|
1526
|
-
let r = [...o, n], i = e;
|
|
1527
|
-
for (let e of r) if (i && typeof i == "object" && e in i) i = i[e];
|
|
1528
|
-
else {
|
|
1529
|
-
i = void 0;
|
|
1530
|
-
break;
|
|
1531
|
-
}
|
|
1532
|
-
return typeof i == "function" || Yn(i) ? i : a(r);
|
|
1533
|
-
},
|
|
1534
|
-
apply: async (e, a, s) => {
|
|
1535
|
-
let c = "/" + o.map(er).join("/"), l = s[0] || {}, u = s[1] || {}, { query: d, fetchOptions: f, ...p } = l, m = {
|
|
1536
|
-
...u,
|
|
1537
|
-
...f
|
|
1538
|
-
}, h = tr(c, n, l);
|
|
1539
|
-
return await t(c, {
|
|
1540
|
-
...m,
|
|
1541
|
-
body: h === "GET" ? void 0 : {
|
|
1542
|
-
...p,
|
|
1543
|
-
...m?.body || {}
|
|
1544
|
-
},
|
|
1545
|
-
query: d || m?.query,
|
|
1546
|
-
method: h,
|
|
1547
|
-
async onSuccess(e) {
|
|
1548
|
-
if (await m?.onSuccess?.(e), !i || m.disableSignal) return;
|
|
1549
|
-
let t = i.filter((e) => e.matcher(c));
|
|
1550
|
-
if (!t.length) return;
|
|
1551
|
-
let n = /* @__PURE__ */ new Set();
|
|
1552
|
-
for (let e of t) {
|
|
1553
|
-
let t = r[e.signal];
|
|
1554
|
-
if (!t) return;
|
|
1555
|
-
if (n.has(e.signal)) continue;
|
|
1556
|
-
n.add(e.signal);
|
|
1557
|
-
let i = t.get();
|
|
1558
|
-
setTimeout(() => {
|
|
1559
|
-
t.set(!i);
|
|
1560
|
-
}, 10), e.callback?.(c);
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
return a();
|
|
1568
|
-
}
|
|
1569
|
-
//#endregion
|
|
1570
|
-
//#region node_modules/better-auth/dist/client/vanilla.mjs
|
|
1571
|
-
function rr(e) {
|
|
1572
|
-
let { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, $fetch: i, atomListeners: a, $store: o } = Jn(e), s = {};
|
|
1573
|
-
for (let [e, t] of Object.entries(r)) s[`use${Xn(e)}`] = t;
|
|
1574
|
-
return nr({
|
|
1575
|
-
...n,
|
|
1576
|
-
...s,
|
|
1577
|
-
$fetch: i,
|
|
1578
|
-
$store: o
|
|
1579
|
-
}, i, t, r, a);
|
|
1580
|
-
}
|
|
1581
|
-
//#endregion
|
|
1582
|
-
//#region src/lib/auth-client.ts
|
|
1583
|
-
var ir = "https://api.fkn.app", ar = ir, { signIn: or, signUp: sr, signOut: cr } = rr({ baseURL: ir }), lr = (e) => {
|
|
1584
|
-
let t = "";
|
|
1585
|
-
for (let n of e) t += String.fromCharCode(n);
|
|
1586
|
-
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1587
|
-
}, ur = (e) => {
|
|
1588
|
-
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
|
|
1589
|
-
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
1590
|
-
return r;
|
|
1591
|
-
}, dr = "fkn-e2e", fr = "keys", pr = "dek", mr = () => new Promise((e, t) => {
|
|
1592
|
-
let n = indexedDB.open(dr, 1);
|
|
1593
|
-
n.onupgradeneeded = () => {
|
|
1594
|
-
n.result.createObjectStore(fr);
|
|
1595
|
-
}, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
|
|
1596
|
-
}), hr = async (e, t) => {
|
|
1597
|
-
let n = await mr();
|
|
1598
|
-
return new Promise((r, i) => {
|
|
1599
|
-
let a = n.transaction(fr, e), o = t(a.objectStore(fr));
|
|
1600
|
-
o.onsuccess = () => r(o.result), o.onerror = () => i(o.error), a.oncomplete = () => n.close();
|
|
1601
|
-
});
|
|
1602
|
-
}, gr = () => hr("readonly", (e) => e.get(pr)), _r = async (e, t) => {
|
|
1603
|
-
let n = await gr();
|
|
1604
|
-
if (!n) throw Error("no_dek");
|
|
1605
|
-
let r = crypto.getRandomValues(new Uint8Array(12)), i = {
|
|
1606
|
-
name: "AES-GCM",
|
|
1607
|
-
iv: r
|
|
1608
|
-
};
|
|
1609
|
-
t && (i.additionalData = t);
|
|
1610
|
-
let a = new Uint8Array(await crypto.subtle.encrypt(i, n, e)), o = new Uint8Array(r.length + a.length);
|
|
1611
|
-
return o.set(r), o.set(a, r.length), o;
|
|
1612
|
-
}, vr = async (e, t) => {
|
|
1613
|
-
let n = await gr();
|
|
1614
|
-
if (!n) throw Error("no_dek");
|
|
1615
|
-
let r = e.slice(0, 12), i = e.slice(12), a = {
|
|
1616
|
-
name: "AES-GCM",
|
|
1617
|
-
iv: r
|
|
1618
|
-
};
|
|
1619
|
-
return t && (a.additionalData = t), new Uint8Array(await crypto.subtle.decrypt(a, n, i));
|
|
1620
|
-
}, yr = `${ar}/api/v1/storage`, br = new TextEncoder(), xr = (e, t) => br.encode(`${e}\0${t}`), Y = async () => {
|
|
1621
|
-
if (!await gr()) throw Error("no_dek");
|
|
1622
|
-
}, X = (e, t) => fetch(`${yr}${e}`, {
|
|
1623
|
-
credentials: "include",
|
|
1624
|
-
...t
|
|
1625
|
-
}), Z = async (e) => {
|
|
1626
|
-
let t = await e.json().catch(() => null);
|
|
1627
|
-
if (!e.ok || !t) throw Error(t?.error ?? `storage_request_failed_${e.status}`);
|
|
1628
|
-
return t;
|
|
1629
|
-
}, Sr = {
|
|
1630
|
-
set: async (e, t, n) => {
|
|
1631
|
-
await Y();
|
|
1632
|
-
let r = await _r(n, xr(e, t));
|
|
1633
|
-
await Z(await X("/set", {
|
|
1634
|
-
method: "POST",
|
|
1635
|
-
headers: { "content-type": "application/json" },
|
|
1636
|
-
body: JSON.stringify({
|
|
1637
|
-
namespace: e,
|
|
1638
|
-
key: t,
|
|
1639
|
-
value: lr(r)
|
|
1640
|
-
})
|
|
1641
|
-
}));
|
|
1642
|
-
},
|
|
1643
|
-
get: async (e, t) => {
|
|
1644
|
-
await Y();
|
|
1645
|
-
let n = await X(`/get?namespace=${encodeURIComponent(e)}&key=${encodeURIComponent(t)}`, { method: "GET" });
|
|
1646
|
-
if (n.status === 404) return null;
|
|
1647
|
-
let { value: r } = await Z(n);
|
|
1648
|
-
return vr(ur(r), xr(e, t));
|
|
1649
|
-
},
|
|
1650
|
-
list: async (e, t) => (await Y(), Z(await X("/list", {
|
|
1651
|
-
method: "POST",
|
|
1652
|
-
headers: { "content-type": "application/json" },
|
|
1653
|
-
body: JSON.stringify({
|
|
1654
|
-
namespace: e,
|
|
1655
|
-
limit: t?.limit,
|
|
1656
|
-
cursor: t?.cursor
|
|
1657
|
-
})
|
|
1658
|
-
}))),
|
|
1659
|
-
remove: async (e, t) => {
|
|
1660
|
-
await Y(), await Z(await X("/delete", {
|
|
1661
|
-
method: "DELETE",
|
|
1662
|
-
headers: { "content-type": "application/json" },
|
|
1663
|
-
body: JSON.stringify({
|
|
1664
|
-
namespace: e,
|
|
1665
|
-
key: t
|
|
1666
|
-
})
|
|
1667
|
-
}));
|
|
1668
|
-
}
|
|
1669
|
-
}, Cr = "fkn-premium", Q = "premium-tokens", wr = () => new Promise((e, t) => {
|
|
1670
|
-
let n = indexedDB.open(Cr, 1);
|
|
1671
|
-
n.onupgradeneeded = () => {
|
|
1672
|
-
n.result.createObjectStore(Q, { autoIncrement: !0 });
|
|
1673
|
-
}, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
|
|
1674
|
-
}), Tr = async (e, t) => {
|
|
1675
|
-
let n = await wr();
|
|
1676
|
-
return new Promise((r, i) => {
|
|
1677
|
-
let a = n.transaction(Q, e), o = t(a.objectStore(Q));
|
|
1678
|
-
o.onsuccess = () => r(o.result), o.onerror = () => i(o.error), a.oncomplete = () => n.close();
|
|
1679
|
-
});
|
|
1680
|
-
}, Er = async (e) => {
|
|
1681
|
-
let t = await wr();
|
|
1682
|
-
await new Promise((n, r) => {
|
|
1683
|
-
let i = t.transaction(Q, "readwrite"), a = i.objectStore(Q);
|
|
1684
|
-
for (let t of e) a.add(t);
|
|
1685
|
-
i.oncomplete = () => {
|
|
1686
|
-
t.close(), n();
|
|
1687
|
-
}, i.onerror = () => r(i.error);
|
|
1688
|
-
});
|
|
1689
|
-
}, Dr = () => Tr("readonly", (e) => e.count()), Or = () => Tr("readwrite", (e) => e.clear()), kr = new v({
|
|
1690
|
-
name: "RSABSSA-SHA256-PSS-Deterministic",
|
|
1691
|
-
hash: "SHA-256",
|
|
1692
|
-
saltLength: 32,
|
|
1693
|
-
prepareType: 0,
|
|
1694
|
-
supportsRSARAW: !1
|
|
1695
|
-
}), Ar = 10, jr = 3, Mr = `${ar}/api/v1/tokens`, Nr = (e) => ur(e.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").replace(/\s+/g, "").replace(/\+/g, "-").replace(/\//g, "_")), Pr = async (e) => crypto.subtle.importKey("spki", Nr(e), {
|
|
1696
|
-
name: "RSA-PSS",
|
|
1697
|
-
hash: "SHA-256"
|
|
1698
|
-
}, !0, ["verify"]), Fr = async () => {
|
|
1699
|
-
let e = await fetch(`${Mr}/pubkey`, { credentials: "include" }), t = await e.json().catch(() => null);
|
|
1700
|
-
if (!e.ok || !t?.publicKey) throw Error(t?.error ?? `pubkey_failed_${e.status}`);
|
|
1701
|
-
return Pr(t.publicKey);
|
|
1702
|
-
}, Ir = async (e) => {
|
|
1703
|
-
let t = Array.from({ length: Ar }, () => ({ message: kr.prepare(crypto.getRandomValues(new Uint8Array(32))) })), n = await Promise.all(t.map(({ message: t }) => kr.blind(e, t))), r = await fetch(Mr, {
|
|
1704
|
-
method: "POST",
|
|
1705
|
-
credentials: "include",
|
|
1706
|
-
headers: { "content-type": "application/json" },
|
|
1707
|
-
body: JSON.stringify({ blinded: n.map(({ blindedMsg: e }) => lr(e)) })
|
|
1708
|
-
}), i = await r.json().catch(() => null);
|
|
1709
|
-
if (!r.ok || !i?.signatures) throw Error(i?.error ?? `issue_failed_${r.status}`);
|
|
1710
|
-
let a = i.signatures;
|
|
1711
|
-
return Promise.all(t.map(async ({ message: t }, r) => {
|
|
1712
|
-
let i = ur(a[r] ?? "");
|
|
1713
|
-
return {
|
|
1714
|
-
message: t,
|
|
1715
|
-
signature: await kr.finalize(e, t, i, n[r].inv)
|
|
1716
|
-
};
|
|
1717
|
-
}));
|
|
1718
|
-
}, Lr = async () => {
|
|
1719
|
-
await Dr() >= jr || await Er(await Ir(await Fr()));
|
|
1720
|
-
}, Rr = new TextEncoder();
|
|
230
|
+
//#region src/lib/webvpn/utils.ts
|
|
231
|
+
var Me = new TextEncoder();
|
|
1721
232
|
new TextDecoder();
|
|
1722
|
-
var
|
|
233
|
+
var I = (e) => f.isValid(e), L = (e) => p.isValid(e), Ne = (e) => I(e) ? 4 : L(e) ? 6 : 0, Pe = (...e) => {
|
|
1723
234
|
if (typeof e[0] == "string") throw Error("FKN WebVPN does not support IPC connections");
|
|
1724
235
|
let t = typeof e.at(-1) == "function" ? e.at(-1) : void 0;
|
|
1725
236
|
return e[0] && typeof e[0] == "object" ? {
|
|
@@ -1730,7 +241,7 @@ var zr = (e) => x.isValid(e), Br = (e) => S.isValid(e), Vr = (e) => zr(e) ? 4 :
|
|
|
1730
241
|
host: typeof e[1] == "string" ? e[1] : void 0,
|
|
1731
242
|
callback: t
|
|
1732
243
|
};
|
|
1733
|
-
},
|
|
244
|
+
}, Fe = (...e) => {
|
|
1734
245
|
let t = typeof e.at(-1) == "function" ? e.at(-1) : void 0, n = e[0] ?? 0, r = typeof e[1] == "string" ? e[1] : void 0;
|
|
1735
246
|
return typeof e[0] == "object" ? {
|
|
1736
247
|
...e[0],
|
|
@@ -1742,7 +253,7 @@ var zr = (e) => x.isValid(e), Br = (e) => S.isValid(e), Vr = (e) => zr(e) ? 4 :
|
|
|
1742
253
|
port: n,
|
|
1743
254
|
callback: t
|
|
1744
255
|
};
|
|
1745
|
-
},
|
|
256
|
+
}, Ie = (...e) => {
|
|
1746
257
|
let t = typeof e.at(-1) == "function" ? e.at(-1) : void 0, n = e[0];
|
|
1747
258
|
if (typeof e[2] == "number") return {
|
|
1748
259
|
message: n,
|
|
@@ -1767,18 +278,18 @@ var zr = (e) => x.isValid(e), Br = (e) => S.isValid(e), Vr = (e) => zr(e) ? 4 :
|
|
|
1767
278
|
new TextEncoder(), new TextDecoder();
|
|
1768
279
|
//#endregion
|
|
1769
280
|
//#region src/lib/webvpn/net.ts
|
|
1770
|
-
var
|
|
1771
|
-
Server: () =>
|
|
1772
|
-
Socket: () =>
|
|
1773
|
-
_default: () =>
|
|
1774
|
-
connect: () =>
|
|
1775
|
-
createConnection: () =>
|
|
1776
|
-
createServer: () =>
|
|
1777
|
-
default: () =>
|
|
1778
|
-
isIP: () =>
|
|
1779
|
-
isIPv4: () =>
|
|
1780
|
-
isIPv6: () =>
|
|
1781
|
-
}),
|
|
281
|
+
var Le = /* @__PURE__ */ n({
|
|
282
|
+
Server: () => z,
|
|
283
|
+
Socket: () => R,
|
|
284
|
+
_default: () => Ve,
|
|
285
|
+
connect: () => Re,
|
|
286
|
+
createConnection: () => ze,
|
|
287
|
+
createServer: () => Be,
|
|
288
|
+
default: () => Ve,
|
|
289
|
+
isIP: () => Ne,
|
|
290
|
+
isIPv4: () => I,
|
|
291
|
+
isIPv6: () => L
|
|
292
|
+
}), R = class extends u.Duplex {
|
|
1782
293
|
_localAddress;
|
|
1783
294
|
_remoteAddress;
|
|
1784
295
|
_webVPNTcpSocketPromise;
|
|
@@ -1838,7 +349,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
1838
349
|
}).catch(n);
|
|
1839
350
|
}
|
|
1840
351
|
connect(...e) {
|
|
1841
|
-
let t =
|
|
352
|
+
let t = Pe(...e), n = this.__webvpn_tcp_socket_init__(C.then((e) => e.webVpnTcpSocket({
|
|
1842
353
|
remoteAddress: t.host ?? "localhost",
|
|
1843
354
|
remotePort: t.port
|
|
1844
355
|
})));
|
|
@@ -1901,6 +412,13 @@ var Gr = /* @__PURE__ */ n({
|
|
|
1901
412
|
value: e
|
|
1902
413
|
}), this;
|
|
1903
414
|
}
|
|
415
|
+
_typeOfService;
|
|
416
|
+
getTypeOfService() {
|
|
417
|
+
return this._typeOfService ?? 0;
|
|
418
|
+
}
|
|
419
|
+
setTypeOfService(e) {
|
|
420
|
+
return this._typeOfService = e, this;
|
|
421
|
+
}
|
|
1904
422
|
_setTcpOption(e) {
|
|
1905
423
|
if (!this._webVPNTcpSocketPromise) {
|
|
1906
424
|
this.emit("error", /* @__PURE__ */ Error("Cannot set socket option before connect"));
|
|
@@ -1958,7 +476,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
1958
476
|
return this._remoteAddress.family;
|
|
1959
477
|
}
|
|
1960
478
|
timeout;
|
|
1961
|
-
},
|
|
479
|
+
}, z = class extends d {
|
|
1962
480
|
_localAddress;
|
|
1963
481
|
_webVPNTcpSocketListenerPromise;
|
|
1964
482
|
constructor(e, t) {
|
|
@@ -1976,10 +494,10 @@ var Gr = /* @__PURE__ */ n({
|
|
|
1976
494
|
}), this._webVPNTcpSocketListenerPromise;
|
|
1977
495
|
}
|
|
1978
496
|
listen(...e) {
|
|
1979
|
-
let t =
|
|
1980
|
-
let t = new
|
|
497
|
+
let t = Pe(...e), n = (e) => {
|
|
498
|
+
let t = new R({ connection: Promise.resolve(e) });
|
|
1981
499
|
this.emit("connection", t);
|
|
1982
|
-
}, r = (e) =>
|
|
500
|
+
}, r = (e) => C.then((r) => r.webVpnTcpSocketListener({
|
|
1983
501
|
localAddress: e,
|
|
1984
502
|
localPort: t.port,
|
|
1985
503
|
onConnection: n
|
|
@@ -2013,23 +531,23 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2013
531
|
connections;
|
|
2014
532
|
listening;
|
|
2015
533
|
async [Symbol.asyncDispose]() {}
|
|
2016
|
-
},
|
|
534
|
+
}, Re = (e, t) => new R().connect(e, t), ze = (e, t) => new R().connect(e, t), Be = (e, t) => {
|
|
2017
535
|
typeof e == "function" && (t = e, e = void 0);
|
|
2018
|
-
let n = new
|
|
536
|
+
let n = new z(e);
|
|
2019
537
|
return t && n.on("connection", t), n;
|
|
2020
|
-
},
|
|
2021
|
-
Socket:
|
|
2022
|
-
Server:
|
|
2023
|
-
connect:
|
|
2024
|
-
createConnection:
|
|
2025
|
-
createServer:
|
|
2026
|
-
isIP:
|
|
2027
|
-
isIPv4:
|
|
2028
|
-
isIPv6:
|
|
2029
|
-
},
|
|
2030
|
-
Socket: () =>
|
|
2031
|
-
createSocket: () =>
|
|
2032
|
-
}),
|
|
538
|
+
}, Ve = {
|
|
539
|
+
Socket: R,
|
|
540
|
+
Server: z,
|
|
541
|
+
connect: Re,
|
|
542
|
+
createConnection: ze,
|
|
543
|
+
createServer: Be,
|
|
544
|
+
isIP: Ne,
|
|
545
|
+
isIPv4: I,
|
|
546
|
+
isIPv6: L
|
|
547
|
+
}, He = /* @__PURE__ */ n({
|
|
548
|
+
Socket: () => Ue,
|
|
549
|
+
createSocket: () => Ge
|
|
550
|
+
}), Ue = class extends d {
|
|
2033
551
|
_type;
|
|
2034
552
|
_localAddress;
|
|
2035
553
|
_remoteAddress;
|
|
@@ -2057,8 +575,8 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2057
575
|
});
|
|
2058
576
|
}
|
|
2059
577
|
addMembership(e, t) {
|
|
2060
|
-
if (
|
|
2061
|
-
let n =
|
|
578
|
+
if (f.isValid(e)) {
|
|
579
|
+
let n = B(e), r = t && f.isValid(t) ? B(t) : new Uint8Array([
|
|
2062
580
|
0,
|
|
2063
581
|
0,
|
|
2064
582
|
0,
|
|
@@ -2069,8 +587,8 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2069
587
|
group: n,
|
|
2070
588
|
interface: r
|
|
2071
589
|
});
|
|
2072
|
-
} else if (
|
|
2073
|
-
let t =
|
|
590
|
+
} else if (p.isValid(e)) {
|
|
591
|
+
let t = We(e);
|
|
2074
592
|
this._setUdpOption({
|
|
2075
593
|
type: 7,
|
|
2076
594
|
group: t,
|
|
@@ -2083,15 +601,15 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2083
601
|
return this._localAddress;
|
|
2084
602
|
}
|
|
2085
603
|
bind(...e) {
|
|
2086
|
-
let t =
|
|
2087
|
-
return this._webVPNUdpSocketPromise =
|
|
604
|
+
let t = Fe(...e), n = this._type === "udp6" ? "::" : "0.0.0.0";
|
|
605
|
+
return this._webVPNUdpSocketPromise = C.then((e) => e.webVpnUdpSocket({
|
|
2088
606
|
type: this._type,
|
|
2089
607
|
address: t.address ?? n,
|
|
2090
608
|
port: t.port
|
|
2091
609
|
})).then((e) => {
|
|
2092
610
|
let t = e.dataReadableStream.getReader(), n = async () => {
|
|
2093
611
|
let { value: e, done: r } = await t.read();
|
|
2094
|
-
r || (this.emit("message",
|
|
612
|
+
r || (this.emit("message", m.from(e.data), {
|
|
2095
613
|
address: e.address,
|
|
2096
614
|
family: e.family,
|
|
2097
615
|
port: e.port,
|
|
@@ -2144,8 +662,8 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2144
662
|
});
|
|
2145
663
|
}
|
|
2146
664
|
dropMembership(e, t) {
|
|
2147
|
-
if (
|
|
2148
|
-
let n =
|
|
665
|
+
if (f.isValid(e)) {
|
|
666
|
+
let n = B(e), r = t && f.isValid(t) ? B(t) : new Uint8Array([
|
|
2149
667
|
0,
|
|
2150
668
|
0,
|
|
2151
669
|
0,
|
|
@@ -2156,8 +674,8 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2156
674
|
group: n,
|
|
2157
675
|
interface: r
|
|
2158
676
|
});
|
|
2159
|
-
} else if (
|
|
2160
|
-
let t =
|
|
677
|
+
} else if (p.isValid(e)) {
|
|
678
|
+
let t = We(e);
|
|
2161
679
|
this._setUdpOption({
|
|
2162
680
|
type: 8,
|
|
2163
681
|
group: t,
|
|
@@ -2190,11 +708,11 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2190
708
|
}
|
|
2191
709
|
send(...e) {
|
|
2192
710
|
this._webVPNUdpSocketPromise || this.bind();
|
|
2193
|
-
let t =
|
|
711
|
+
let t = Ie(...e), n = this._type === "udp6" ? "::1" : "127.0.0.1";
|
|
2194
712
|
if (!this._webVPNUdpSocketPromise) throw Error("Socket not bound");
|
|
2195
713
|
this._webVPNUdpSocketPromise.then((e) => {
|
|
2196
714
|
if (!e) throw Error("Socket not bound");
|
|
2197
|
-
let r = typeof t.message == "string" ?
|
|
715
|
+
let r = typeof t.message == "string" ? Me.encode(t.message) : t.message;
|
|
2198
716
|
e.send({
|
|
2199
717
|
...t,
|
|
2200
718
|
address: t.address ?? n,
|
|
@@ -2252,33 +770,33 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2252
770
|
this.close(e);
|
|
2253
771
|
});
|
|
2254
772
|
}
|
|
2255
|
-
},
|
|
773
|
+
}, B = (e) => {
|
|
2256
774
|
let t = e.split(".").map((e) => parseInt(e, 10));
|
|
2257
775
|
if (t.length !== 4 || t.some((e) => Number.isNaN(e) || e < 0 || e > 255)) throw Error(`Invalid IPv4 address: ${e}`);
|
|
2258
776
|
return new Uint8Array(t);
|
|
2259
|
-
},
|
|
2260
|
-
let t = new
|
|
777
|
+
}, We = (e) => {
|
|
778
|
+
let t = new p(e).getBitsBase16(0, 128).match(/.{2}/g);
|
|
2261
779
|
if (!t || t.length !== 16) throw Error(`Invalid IPv6 address: ${e}`);
|
|
2262
780
|
return new Uint8Array(t.map((e) => parseInt(e, 16)));
|
|
2263
|
-
},
|
|
2264
|
-
let n = new
|
|
781
|
+
}, Ge = (e, t) => {
|
|
782
|
+
let n = new Ue(typeof e == "string" ? { type: e } : e);
|
|
2265
783
|
return t && n.on("message", t), n;
|
|
2266
|
-
},
|
|
2267
|
-
Agent: () =>
|
|
2268
|
-
ClientRequest: () =>
|
|
2269
|
-
HTTPParser: () =>
|
|
2270
|
-
IncomingMessage: () =>
|
|
2271
|
-
METHODS: () =>
|
|
2272
|
-
STATUS_CODES: () =>
|
|
2273
|
-
Server: () =>
|
|
2274
|
-
ServerResponse: () =>
|
|
2275
|
-
_default: () =>
|
|
2276
|
-
createServer: () =>
|
|
2277
|
-
default: () =>
|
|
2278
|
-
get: () =>
|
|
2279
|
-
globalAgent: () =>
|
|
2280
|
-
request: () =>
|
|
2281
|
-
}),
|
|
784
|
+
}, Ke = /* @__PURE__ */ n({
|
|
785
|
+
Agent: () => Q,
|
|
786
|
+
ClientRequest: () => X,
|
|
787
|
+
HTTPParser: () => G,
|
|
788
|
+
IncomingMessage: () => q,
|
|
789
|
+
METHODS: () => Je,
|
|
790
|
+
STATUS_CODES: () => V,
|
|
791
|
+
Server: () => Z,
|
|
792
|
+
ServerResponse: () => Y,
|
|
793
|
+
_default: () => it,
|
|
794
|
+
createServer: () => rt,
|
|
795
|
+
default: () => it,
|
|
796
|
+
get: () => nt,
|
|
797
|
+
globalAgent: () => tt,
|
|
798
|
+
request: () => $
|
|
799
|
+
}), qe = new TextDecoder("latin1"), Je = /* @__PURE__ */ "ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE".split("."), V = {
|
|
2282
800
|
100: "Continue",
|
|
2283
801
|
101: "Switching Protocols",
|
|
2284
802
|
102: "Processing",
|
|
@@ -2342,7 +860,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2342
860
|
509: "Bandwidth Limit Exceeded",
|
|
2343
861
|
510: "Not Extended",
|
|
2344
862
|
511: "Network Authentication Required"
|
|
2345
|
-
},
|
|
863
|
+
}, Ye = new Set([
|
|
2346
864
|
"content-type",
|
|
2347
865
|
"content-length",
|
|
2348
866
|
"user-agent",
|
|
@@ -2361,18 +879,18 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2361
879
|
"server",
|
|
2362
880
|
"age",
|
|
2363
881
|
"expires"
|
|
2364
|
-
]),
|
|
882
|
+
]), H = 13, U = 10, Xe = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/, W = (e, t) => (e.code = t, e), Ze = (e, t) => {
|
|
2365
883
|
if (e.length === 0) return t;
|
|
2366
884
|
if (t.length === 0) return e;
|
|
2367
885
|
let n = new Uint8Array(e.length + t.length);
|
|
2368
886
|
return n.set(e, 0), n.set(t, e.length), n;
|
|
2369
|
-
},
|
|
2370
|
-
for (let n = t; n + 1 < e.length; n++) if (e[n] ===
|
|
887
|
+
}, Qe = (e, t) => {
|
|
888
|
+
for (let n = t; n + 1 < e.length; n++) if (e[n] === H && e[n + 1] === U) return n;
|
|
2371
889
|
return -1;
|
|
2372
|
-
},
|
|
2373
|
-
for (let t = 0; t + 3 < e.length; t++) if (e[t] ===
|
|
890
|
+
}, $e = (e) => {
|
|
891
|
+
for (let t = 0; t + 3 < e.length; t++) if (e[t] === H && e[t + 1] === U && e[t + 2] === H && e[t + 3] === U) return t;
|
|
2374
892
|
return -1;
|
|
2375
|
-
},
|
|
893
|
+
}, G = class {
|
|
2376
894
|
buf = new Uint8Array();
|
|
2377
895
|
state = "HEAD";
|
|
2378
896
|
framing = "none";
|
|
@@ -2383,10 +901,10 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2383
901
|
this.mode = e, this.handlers = t;
|
|
2384
902
|
}
|
|
2385
903
|
execute(e) {
|
|
2386
|
-
this.buf =
|
|
904
|
+
this.buf = Ze(this.buf, e);
|
|
2387
905
|
let t = !0;
|
|
2388
906
|
for (; t;) if (t = !1, this.state === "HEAD") {
|
|
2389
|
-
let e =
|
|
907
|
+
let e = $e(this.buf);
|
|
2390
908
|
if (e === -1) return;
|
|
2391
909
|
let n = this.buf.subarray(0, e);
|
|
2392
910
|
this.buf = this.buf.subarray(e + 4);
|
|
@@ -2401,7 +919,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2401
919
|
this.state = "HEAD", this.framing = "none", this.bodyRemaining = 0, this.chunkState = "size", this.skipBody = !1;
|
|
2402
920
|
}
|
|
2403
921
|
parseHead(e) {
|
|
2404
|
-
let t =
|
|
922
|
+
let t = qe.decode(e).split("\r\n"), n = t.shift() ?? "", r = [];
|
|
2405
923
|
for (let e of t) (e.startsWith(" ") || e.startsWith(" ")) && r.length > 0 ? r[r.length - 1] += " " + e.trim() : r.push(e);
|
|
2406
924
|
let i = [], a = {};
|
|
2407
925
|
for (let e of r) {
|
|
@@ -2439,7 +957,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2439
957
|
return;
|
|
2440
958
|
}
|
|
2441
959
|
let i = e[r];
|
|
2442
|
-
i === void 0 ? e[r] = n :
|
|
960
|
+
i === void 0 ? e[r] = n : Ye.has(r) || (e[r] = `${i}, ${n}`);
|
|
2443
961
|
}
|
|
2444
962
|
setupBody(e) {
|
|
2445
963
|
if (this.skipBody) {
|
|
@@ -2472,9 +990,9 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2472
990
|
}
|
|
2473
991
|
consumeChunked() {
|
|
2474
992
|
for (;;) if (this.chunkState === "size") {
|
|
2475
|
-
let e =
|
|
993
|
+
let e = Qe(this.buf, 0);
|
|
2476
994
|
if (e === -1) return !1;
|
|
2477
|
-
let t =
|
|
995
|
+
let t = qe.decode(this.buf.subarray(0, e)), n = parseInt(t.split(";")[0].trim(), 16);
|
|
2478
996
|
if (this.buf = this.buf.subarray(e + 2), Number.isNaN(n)) return !0;
|
|
2479
997
|
n === 0 ? this.chunkState = "trailer" : (this.bodyRemaining = n, this.chunkState = "data");
|
|
2480
998
|
} else if (this.chunkState === "data") {
|
|
@@ -2485,13 +1003,13 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2485
1003
|
if (this.buf.length < 2) return !1;
|
|
2486
1004
|
this.buf = this.buf.subarray(2), this.chunkState = "size";
|
|
2487
1005
|
} else {
|
|
2488
|
-
let e =
|
|
1006
|
+
let e = Qe(this.buf, 0);
|
|
2489
1007
|
if (e === -1) return !1;
|
|
2490
1008
|
let t = e === 0;
|
|
2491
1009
|
if (this.buf = this.buf.subarray(e + 2), t) return !0;
|
|
2492
1010
|
}
|
|
2493
1011
|
}
|
|
2494
|
-
},
|
|
1012
|
+
}, K = (e, t) => m.isBuffer(e) ? e : typeof e == "string" ? m.from(e, t ?? "utf8") : e instanceof Uint8Array ? m.from(e) : e instanceof ArrayBuffer ? m.from(new Uint8Array(e)) : m.from(String(e)), q = class extends u.Readable {
|
|
2495
1013
|
httpVersion = "1.1";
|
|
2496
1014
|
httpVersionMajor = 1;
|
|
2497
1015
|
httpVersionMinor = 1;
|
|
@@ -2518,16 +1036,16 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2518
1036
|
setTimeout(e, t) {
|
|
2519
1037
|
return this.socket.setTimeout(e, t), this;
|
|
2520
1038
|
}
|
|
2521
|
-
},
|
|
1039
|
+
}, J = class extends u.Writable {
|
|
2522
1040
|
_headerStore = /* @__PURE__ */ new Map();
|
|
2523
1041
|
headersSent = !1;
|
|
2524
1042
|
chunkedEncoding = !1;
|
|
2525
1043
|
finished = !1;
|
|
2526
1044
|
_bodyWritten = !1;
|
|
2527
1045
|
setHeader(e, t) {
|
|
2528
|
-
if (this.headersSent) throw
|
|
2529
|
-
if (typeof e != "string" || !
|
|
2530
|
-
if (t === void 0) throw
|
|
1046
|
+
if (this.headersSent) throw W(/* @__PURE__ */ Error("Cannot set headers after they are sent to the client"), "ERR_HTTP_HEADERS_SENT");
|
|
1047
|
+
if (typeof e != "string" || !Xe.test(e)) throw W(/* @__PURE__ */ TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`), "ERR_INVALID_HTTP_TOKEN");
|
|
1048
|
+
if (t === void 0) throw W(/* @__PURE__ */ TypeError(`Invalid value "undefined" for header "${e}"`), "ERR_HTTP_INVALID_HEADER_VALUE");
|
|
2531
1049
|
return this._headerStore.set(e.toLowerCase(), [e, Array.isArray(t) ? [...t] : t]), this;
|
|
2532
1050
|
}
|
|
2533
1051
|
getHeader(e) {
|
|
@@ -2567,30 +1085,30 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2567
1085
|
return this._bodyWritten = !0, super.write(e, t, n);
|
|
2568
1086
|
}
|
|
2569
1087
|
_write(e, t, n) {
|
|
2570
|
-
let r =
|
|
2571
|
-
if (this.headersSent ||= (this._implicitHeader(), i.push(
|
|
1088
|
+
let r = K(e), i = [];
|
|
1089
|
+
if (this.headersSent ||= (this._implicitHeader(), i.push(m.from(this._headBlock, "latin1")), !0), this.chunkedEncoding ? r.length > 0 && (i.push(m.from(`${r.length.toString(16)}\r\n`, "latin1")), i.push(r), i.push(m.from("\r\n", "latin1"))) : i.push(r), i.length === 0) {
|
|
2572
1090
|
n();
|
|
2573
1091
|
return;
|
|
2574
1092
|
}
|
|
2575
|
-
this._writeToSocket(
|
|
1093
|
+
this._writeToSocket(m.concat(i), n);
|
|
2576
1094
|
}
|
|
2577
1095
|
_final(e) {
|
|
2578
1096
|
let t = [];
|
|
2579
|
-
if (this.headersSent ||= (!this.chunkedEncoding && !this.hasHeader("content-length") && this.setHeader("Content-Length", 0), this._implicitHeader(), t.push(
|
|
1097
|
+
if (this.headersSent ||= (!this.chunkedEncoding && !this.hasHeader("content-length") && this.setHeader("Content-Length", 0), this._implicitHeader(), t.push(m.from(this._headBlock, "latin1")), !0), this.chunkedEncoding && t.push(m.from("0\r\n\r\n", "latin1")), this.finished = !0, t.length === 0) {
|
|
2580
1098
|
e();
|
|
2581
1099
|
return;
|
|
2582
1100
|
}
|
|
2583
|
-
this._writeToSocket(
|
|
1101
|
+
this._writeToSocket(m.concat(t), e);
|
|
2584
1102
|
}
|
|
2585
1103
|
end(e, t, n) {
|
|
2586
1104
|
if (e != null && typeof e != "function" && !this._bodyWritten && !this.headersSent && !this.chunkedEncoding && !this.hasHeader("content-length")) {
|
|
2587
1105
|
let n = typeof t == "string" ? t : void 0;
|
|
2588
|
-
this.setHeader("Content-Length",
|
|
1106
|
+
this.setHeader("Content-Length", K(e, n).length);
|
|
2589
1107
|
}
|
|
2590
1108
|
return super.end(e, t, n);
|
|
2591
1109
|
}
|
|
2592
1110
|
_headBlock;
|
|
2593
|
-
},
|
|
1111
|
+
}, Y = class extends J {
|
|
2594
1112
|
statusCode = 200;
|
|
2595
1113
|
statusMessage;
|
|
2596
1114
|
_writeHeadCalled = !1;
|
|
@@ -2607,7 +1125,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2607
1125
|
return !(e >= 100 && e < 200 || e === 204 || e === 304);
|
|
2608
1126
|
}
|
|
2609
1127
|
writeHead(e, t, n) {
|
|
2610
|
-
if (this._writeHeadCalled || this.headersSent) throw
|
|
1128
|
+
if (this._writeHeadCalled || this.headersSent) throw W(/* @__PURE__ */ Error("Cannot render headers after they are sent to the client"), "ERR_HTTP_HEADERS_SENT");
|
|
2611
1129
|
this._writeHeadCalled = !0, this.statusCode = e;
|
|
2612
1130
|
let r = n;
|
|
2613
1131
|
if (typeof t == "string" ? this.statusMessage = t : t != null && (r = t), Array.isArray(r)) {
|
|
@@ -2625,16 +1143,16 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2625
1143
|
}
|
|
2626
1144
|
}
|
|
2627
1145
|
_implicitHeader() {
|
|
2628
|
-
let e = this.statusMessage ??
|
|
1146
|
+
let e = this.statusMessage ?? V[this.statusCode] ?? "unknown";
|
|
2629
1147
|
this.sendDate && !this.hasHeader("date") && this.setHeader("Date", (/* @__PURE__ */ new Date()).toUTCString()), this.hasHeader("connection") || this.setHeader("Connection", this._keepAlive ? "keep-alive" : "close"), this._headBlock = this._storeHeader(`HTTP/1.1 ${this.statusCode} ${e}`);
|
|
2630
1148
|
}
|
|
2631
1149
|
writeContinue() {
|
|
2632
|
-
this._writeToSocket(
|
|
1150
|
+
this._writeToSocket(m.from("HTTP/1.1 100 Continue\r\n\r\n", "latin1"), () => {});
|
|
2633
1151
|
}
|
|
2634
1152
|
setTimeout(e, t) {
|
|
2635
1153
|
return this.socket?.setTimeout(e, t), this;
|
|
2636
1154
|
}
|
|
2637
|
-
},
|
|
1155
|
+
}, et = (...e) => {
|
|
2638
1156
|
let t = {}, n = {}, r, i = [...e], a = i.shift();
|
|
2639
1157
|
if (typeof a == "string" || a instanceof URL) {
|
|
2640
1158
|
let e = typeof a == "string" ? new URL(a) : a;
|
|
@@ -2656,7 +1174,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2656
1174
|
},
|
|
2657
1175
|
callback: r
|
|
2658
1176
|
};
|
|
2659
|
-
},
|
|
1177
|
+
}, X = class extends J {
|
|
2660
1178
|
method;
|
|
2661
1179
|
path;
|
|
2662
1180
|
host;
|
|
@@ -2678,7 +1196,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2678
1196
|
let e = this.protocol === "https:" && r === 443 || this.protocol !== "https:" && r === 80;
|
|
2679
1197
|
this.setHeader("Host", e ? n : `${n}:${r}`);
|
|
2680
1198
|
}
|
|
2681
|
-
e.auth && !this.hasHeader("authorization") && this.setHeader("Authorization", `Basic ${
|
|
1199
|
+
e.auth && !this.hasHeader("authorization") && this.setHeader("Authorization", `Basic ${m.from(e.auth).toString("base64")}`), this.socket = new R(), this.emit("socket", this.socket), this.socket.on("error", (e) => {
|
|
2682
1200
|
this._aborted || this.emit("error", e);
|
|
2683
1201
|
}), this._attachResponseParser(), this.socket.connect({
|
|
2684
1202
|
host: n,
|
|
@@ -2694,12 +1212,12 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2694
1212
|
this._headBlock = this._storeHeader(`${this.method} ${this.path} HTTP/1.1`);
|
|
2695
1213
|
}
|
|
2696
1214
|
_attachResponseParser() {
|
|
2697
|
-
let e = new
|
|
1215
|
+
let e = new q(this.socket), t = new G("response", {
|
|
2698
1216
|
onHeaders: (n) => {
|
|
2699
1217
|
e._applyHead(n), this.method === "HEAD" && (t.skipBody = !0), this.res = e, this.emit("response", e);
|
|
2700
1218
|
},
|
|
2701
1219
|
onBody: (t) => {
|
|
2702
|
-
e.push(
|
|
1220
|
+
e.push(m.from(t));
|
|
2703
1221
|
},
|
|
2704
1222
|
onComplete: () => {
|
|
2705
1223
|
e.complete = !0, e.push(null);
|
|
@@ -2738,22 +1256,22 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2738
1256
|
setSocketKeepAlive(e, t) {
|
|
2739
1257
|
this.socket.setKeepAlive(e, t);
|
|
2740
1258
|
}
|
|
2741
|
-
},
|
|
1259
|
+
}, Z = new Proxy(class extends z {
|
|
2742
1260
|
constructor(e, t) {
|
|
2743
1261
|
let n = {}, r = t;
|
|
2744
1262
|
typeof e == "function" ? r = e : e && (n = e), super(n), r && this.on("request", r), this.on("connection", (e) => this._handleConnection(e));
|
|
2745
1263
|
}
|
|
2746
1264
|
_handleConnection(e) {
|
|
2747
|
-
let t = null, n = new
|
|
1265
|
+
let t = null, n = new G("request", {
|
|
2748
1266
|
onHeaders: (r) => {
|
|
2749
|
-
t = new
|
|
2750
|
-
let i = new
|
|
1267
|
+
t = new q(e), t._applyHead(r), r.method === "HEAD" && (n.skipBody = !0);
|
|
1268
|
+
let i = new Y(t), a = String(r.headers.connection ?? "").toLowerCase();
|
|
2751
1269
|
i._keepAlive = r.httpVersionMinor >= 1 ? a !== "close" : a === "keep-alive", i.on("finish", () => {
|
|
2752
1270
|
i._keepAlive || e.end();
|
|
2753
1271
|
}), this.emit("request", t, i);
|
|
2754
1272
|
},
|
|
2755
1273
|
onBody: (e) => {
|
|
2756
|
-
t?.push(
|
|
1274
|
+
t?.push(m.from(e));
|
|
2757
1275
|
},
|
|
2758
1276
|
onComplete: () => {
|
|
2759
1277
|
t && (t.complete = !0, t.push(null)), t = null;
|
|
@@ -2763,7 +1281,7 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2763
1281
|
n.finish(), t && t.push(null);
|
|
2764
1282
|
}), e.on("error", (t) => this.emit("clientError", t, e));
|
|
2765
1283
|
}
|
|
2766
|
-
}, { apply: (e, t, n) => new e(...n) }),
|
|
1284
|
+
}, { apply: (e, t, n) => new e(...n) }), Q = class {
|
|
2767
1285
|
maxSockets;
|
|
2768
1286
|
maxFreeSockets;
|
|
2769
1287
|
keepAlive;
|
|
@@ -2775,25 +1293,25 @@ var Gr = /* @__PURE__ */ n({
|
|
|
2775
1293
|
return `${e.host ?? "localhost"}:${e.port ?? ""}:${e.localAddress ?? ""}`;
|
|
2776
1294
|
}
|
|
2777
1295
|
destroy() {}
|
|
2778
|
-
},
|
|
2779
|
-
let { options: t, callback: n } =
|
|
2780
|
-
return new
|
|
2781
|
-
},
|
|
2782
|
-
let t =
|
|
1296
|
+
}, tt = new Q(), $ = (...e) => {
|
|
1297
|
+
let { options: t, callback: n } = et(...e);
|
|
1298
|
+
return new X(t, n);
|
|
1299
|
+
}, nt = (...e) => {
|
|
1300
|
+
let t = $(...e);
|
|
2783
1301
|
return t.end(), t;
|
|
2784
|
-
},
|
|
2785
|
-
METHODS:
|
|
2786
|
-
STATUS_CODES:
|
|
2787
|
-
Agent:
|
|
2788
|
-
globalAgent:
|
|
2789
|
-
Server:
|
|
2790
|
-
ServerResponse:
|
|
2791
|
-
IncomingMessage:
|
|
2792
|
-
ClientRequest:
|
|
2793
|
-
OutgoingMessage:
|
|
2794
|
-
createServer:
|
|
2795
|
-
request:
|
|
2796
|
-
get:
|
|
1302
|
+
}, rt = (e, t) => new Z(e, t), it = {
|
|
1303
|
+
METHODS: Je,
|
|
1304
|
+
STATUS_CODES: V,
|
|
1305
|
+
Agent: Q,
|
|
1306
|
+
globalAgent: tt,
|
|
1307
|
+
Server: Z,
|
|
1308
|
+
ServerResponse: Y,
|
|
1309
|
+
IncomingMessage: q,
|
|
1310
|
+
ClientRequest: X,
|
|
1311
|
+
OutgoingMessage: J,
|
|
1312
|
+
createServer: rt,
|
|
1313
|
+
request: $,
|
|
1314
|
+
get: nt
|
|
2797
1315
|
};
|
|
2798
1316
|
//#endregion
|
|
2799
|
-
export {
|
|
1317
|
+
export { j as ATTACH_FRAME_EVENT_KEY, N as assertAttachableFrameUrl, Ae as attachFrame, Oe as attachFramePermission, l as box, we as cookies, e as createVideoElementHandle, He as dgram, w as extension, Se as fetch, ye as fetchCredentialedPermission, ve as fetchPermission, ke as gotoPermission, i as handleRevivableModules, Ke as http, M as isBlockedFrameUrl, T as isExtensionExposed, t as isType, Te as modifyRequestHeadersPermission, Le as net, je as permissions, P as promptInstall, Ce as readCookiePermission, he as relayWorker, De as removeRequestHeaderRule, o as revive, pe as serverProxyFetch, D as setMissingExtensionHandler, Ee as setRequestHeaderRule, a as type, O as waitForExtensionExposure };
|