@authup/client-auth-console 1.0.0-beta.59
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/LICENSE +661 -0
- package/README.md +28 -0
- package/dist/client/.vite/ssr-manifest.json +62048 -0
- package/dist/client/assets/asap-latin-400-normal-Dc37g3Il.woff +0 -0
- package/dist/client/assets/asap-latin-400-normal-DnZ1MOsG.woff2 +0 -0
- package/dist/client/assets/asap-latin-700-normal-Dqcopq14.woff +0 -0
- package/dist/client/assets/asap-latin-700-normal-l2Y8pi-F.woff2 +0 -0
- package/dist/client/assets/asap-latin-ext-400-normal-C-fcRdtE.woff +0 -0
- package/dist/client/assets/asap-latin-ext-400-normal-DwYtpHbV.woff2 +0 -0
- package/dist/client/assets/asap-latin-ext-700-normal-D00OESsZ.woff +0 -0
- package/dist/client/assets/asap-latin-ext-700-normal-y8bo5aW5.woff2 +0 -0
- package/dist/client/assets/asap-vietnamese-400-normal-DGyJlJLT.woff2 +0 -0
- package/dist/client/assets/asap-vietnamese-400-normal-lfLaoF2x.woff +0 -0
- package/dist/client/assets/asap-vietnamese-700-normal-B-e19ug5.woff +0 -0
- package/dist/client/assets/asap-vietnamese-700-normal-D-SxY94i.woff2 +0 -0
- package/dist/client/assets/index-C2Zi1oPt.css +2 -0
- package/dist/client/assets/index-C52wdgf0.js +106 -0
- package/dist/client/assets/nunito-cyrillic-300-normal-BPQV259B.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-300-normal-g5qSsvc0.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-400-normal-D1j0u8EH.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-400-normal-xAOo5cBP.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-600-normal-BUjmtIuu.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-600-normal-DJGQ2h05.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-700-normal-DP36NgGt.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-700-normal-DfHRUDv-.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-300-normal-BDHtqmCR.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-300-normal-ChMQLIrm.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-400-normal-CuPM9foi.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-400-normal-xaE7D4Sw.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-600-normal-CWPPjBOD.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-600-normal-vnfu4DTE.woff +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-700-normal-BuR0mlCG.woff2 +0 -0
- package/dist/client/assets/nunito-cyrillic-ext-700-normal-DfoqN4Gs.woff +0 -0
- package/dist/client/assets/nunito-latin-300-normal-C3ZIKvzv.woff +0 -0
- package/dist/client/assets/nunito-latin-300-normal-COoPE5VN.woff2 +0 -0
- package/dist/client/assets/nunito-latin-400-normal-DKg4f3fz.woff +0 -0
- package/dist/client/assets/nunito-latin-400-normal-r8SDr6Up.woff2 +0 -0
- package/dist/client/assets/nunito-latin-600-normal-Br8yIETf.woff2 +0 -0
- package/dist/client/assets/nunito-latin-600-normal-Cd0eNu1l.woff +0 -0
- package/dist/client/assets/nunito-latin-700-normal-Dort48En.woff2 +0 -0
- package/dist/client/assets/nunito-latin-700-normal-OcDqTBcA.woff +0 -0
- package/dist/client/assets/nunito-latin-ext-300-normal-D1SyVuPt.woff2 +0 -0
- package/dist/client/assets/nunito-latin-ext-300-normal-DfqbmdMl.woff +0 -0
- package/dist/client/assets/nunito-latin-ext-400-normal-CjMJVfGn.woff +0 -0
- package/dist/client/assets/nunito-latin-ext-400-normal-i-8OOpdj.woff2 +0 -0
- package/dist/client/assets/nunito-latin-ext-600-normal-BKUpuB78.woff +0 -0
- package/dist/client/assets/nunito-latin-ext-600-normal-Dd9Zuxh1.woff2 +0 -0
- package/dist/client/assets/nunito-latin-ext-700-normal-BWeMsAzO.woff2 +0 -0
- package/dist/client/assets/nunito-latin-ext-700-normal-D4woHhbd.woff +0 -0
- package/dist/client/assets/nunito-vietnamese-300-normal-DATld5Vw.woff +0 -0
- package/dist/client/assets/nunito-vietnamese-300-normal-mLneKULB.woff2 +0 -0
- package/dist/client/assets/nunito-vietnamese-400-normal-BHkVbP3T.woff2 +0 -0
- package/dist/client/assets/nunito-vietnamese-400-normal-DtOtW02z.woff +0 -0
- package/dist/client/assets/nunito-vietnamese-600-normal-BY8O6Cug.woff2 +0 -0
- package/dist/client/assets/nunito-vietnamese-600-normal-DO1RqFw5.woff +0 -0
- package/dist/client/assets/nunito-vietnamese-700-normal-C9SQsXvj.woff +0 -0
- package/dist/client/assets/nunito-vietnamese-700-normal-Ch8EUCfz.woff2 +0 -0
- package/dist/client/index.html +21 -0
- package/dist/server/assets/multipart-parser-BCMy8Xwv.js +181 -0
- package/dist/server/assets/multipart-parser-BVY8pIV2.js +176 -0
- package/dist/server/server.js +149266 -0
- package/package.json +87 -0
- package/src/contract.ts +67 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
~ Copyright (c) 2025.
|
|
3
|
+
~ Author Peter Placzek (tada5hi)
|
|
4
|
+
~ For the full copyright and license information,
|
|
5
|
+
~ view the LICENSE file that was distributed with this source code.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
<!doctype html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="UTF-8" />
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
13
|
+
<title>Authup</title>
|
|
14
|
+
<!--preload-links-->
|
|
15
|
+
<script type="module" crossorigin src="/public/assets/index-C52wdgf0.js"></script>
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/public/assets/index-C2Zi1oPt.css">
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<div id="app"><!--app-html--></div>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { a as __commonJSMin, n as require_node_fetch_native_DhEqb06g, o as __require, t as require_node } from "../server.js";
|
|
2
|
+
//#region ../../node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
|
|
3
|
+
var require_multipart_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
+
var y = Object.defineProperty;
|
|
5
|
+
var c = (R, o) => y(R, "name", {
|
|
6
|
+
value: o,
|
|
7
|
+
configurable: !0
|
|
8
|
+
});
|
|
9
|
+
var node = require_node();
|
|
10
|
+
__require("node:http"), __require("node:https"), __require("node:zlib"), __require("node:stream"), __require("node:buffer"), __require("node:util"), require_node_fetch_native_DhEqb06g(), __require("node:url"), __require("node:net"), __require("node:fs"), __require("node:path");
|
|
11
|
+
var s = 0;
|
|
12
|
+
var S = {
|
|
13
|
+
START_BOUNDARY: s++,
|
|
14
|
+
HEADER_FIELD_START: s++,
|
|
15
|
+
HEADER_FIELD: s++,
|
|
16
|
+
HEADER_VALUE_START: s++,
|
|
17
|
+
HEADER_VALUE: s++,
|
|
18
|
+
HEADER_VALUE_ALMOST_DONE: s++,
|
|
19
|
+
HEADERS_ALMOST_DONE: s++,
|
|
20
|
+
PART_DATA_START: s++,
|
|
21
|
+
PART_DATA: s++,
|
|
22
|
+
END: s++
|
|
23
|
+
};
|
|
24
|
+
var f = 1;
|
|
25
|
+
var F = {
|
|
26
|
+
PART_BOUNDARY: f,
|
|
27
|
+
LAST_BOUNDARY: f *= 2
|
|
28
|
+
};
|
|
29
|
+
var LF = 10;
|
|
30
|
+
var CR = 13;
|
|
31
|
+
var SPACE = 32;
|
|
32
|
+
var HYPHEN = 45;
|
|
33
|
+
var COLON = 58;
|
|
34
|
+
var A = 97;
|
|
35
|
+
var Z = 122;
|
|
36
|
+
var lower = c((R) => R | 32, "lower");
|
|
37
|
+
var noop = c(() => {}, "noop");
|
|
38
|
+
var g = class g {
|
|
39
|
+
constructor(o) {
|
|
40
|
+
this.index = 0, this.flags = 0, this.onHeaderEnd = noop, this.onHeaderField = noop, this.onHeadersEnd = noop, this.onHeaderValue = noop, this.onPartBegin = noop, this.onPartData = noop, this.onPartEnd = noop, this.boundaryChars = {}, o = `\r
|
|
41
|
+
--` + o;
|
|
42
|
+
const t = new Uint8Array(o.length);
|
|
43
|
+
for (let n = 0; n < o.length; n++) t[n] = o.charCodeAt(n), this.boundaryChars[t[n]] = !0;
|
|
44
|
+
this.boundary = t, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = S.START_BOUNDARY;
|
|
45
|
+
}
|
|
46
|
+
write(o) {
|
|
47
|
+
let t = 0;
|
|
48
|
+
const n = o.length;
|
|
49
|
+
let E = this.index, { lookbehind: l, boundary: h, boundaryChars: H, index: e, state: a, flags: d } = this;
|
|
50
|
+
const b = this.boundary.length, m = b - 1, O = o.length;
|
|
51
|
+
let r, P;
|
|
52
|
+
const u = c((D) => {
|
|
53
|
+
this[D + "Mark"] = t;
|
|
54
|
+
}, "mark"), i = c((D) => {
|
|
55
|
+
delete this[D + "Mark"];
|
|
56
|
+
}, "clear"), T = c((D, p, _, N) => {
|
|
57
|
+
(p === void 0 || p !== _) && this[D](N && N.subarray(p, _));
|
|
58
|
+
}, "callback"), L = c((D, p) => {
|
|
59
|
+
const _ = D + "Mark";
|
|
60
|
+
_ in this && (p ? (T(D, this[_], t, o), delete this[_]) : (T(D, this[_], o.length, o), this[_] = 0));
|
|
61
|
+
}, "dataCallback");
|
|
62
|
+
for (t = 0; t < n; t++) switch (r = o[t], a) {
|
|
63
|
+
case S.START_BOUNDARY:
|
|
64
|
+
if (e === h.length - 2) {
|
|
65
|
+
if (r === HYPHEN) d |= F.LAST_BOUNDARY;
|
|
66
|
+
else if (r !== CR) return;
|
|
67
|
+
e++;
|
|
68
|
+
break;
|
|
69
|
+
} else if (e - 1 === h.length - 2) {
|
|
70
|
+
if (d & F.LAST_BOUNDARY && r === HYPHEN) a = S.END, d = 0;
|
|
71
|
+
else if (!(d & F.LAST_BOUNDARY) && r === LF) e = 0, T("onPartBegin"), a = S.HEADER_FIELD_START;
|
|
72
|
+
else return;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
r !== h[e + 2] && (e = -2), r === h[e + 2] && e++;
|
|
76
|
+
break;
|
|
77
|
+
case S.HEADER_FIELD_START: a = S.HEADER_FIELD, u("onHeaderField"), e = 0;
|
|
78
|
+
case S.HEADER_FIELD:
|
|
79
|
+
if (r === CR) {
|
|
80
|
+
i("onHeaderField"), a = S.HEADERS_ALMOST_DONE;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (e++, r === HYPHEN) break;
|
|
84
|
+
if (r === COLON) {
|
|
85
|
+
if (e === 1) return;
|
|
86
|
+
L("onHeaderField", !0), a = S.HEADER_VALUE_START;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (P = lower(r), P < A || P > Z) return;
|
|
90
|
+
break;
|
|
91
|
+
case S.HEADER_VALUE_START:
|
|
92
|
+
if (r === SPACE) break;
|
|
93
|
+
u("onHeaderValue"), a = S.HEADER_VALUE;
|
|
94
|
+
case S.HEADER_VALUE:
|
|
95
|
+
r === CR && (L("onHeaderValue", !0), T("onHeaderEnd"), a = S.HEADER_VALUE_ALMOST_DONE);
|
|
96
|
+
break;
|
|
97
|
+
case S.HEADER_VALUE_ALMOST_DONE:
|
|
98
|
+
if (r !== LF) return;
|
|
99
|
+
a = S.HEADER_FIELD_START;
|
|
100
|
+
break;
|
|
101
|
+
case S.HEADERS_ALMOST_DONE:
|
|
102
|
+
if (r !== LF) return;
|
|
103
|
+
T("onHeadersEnd"), a = S.PART_DATA_START;
|
|
104
|
+
break;
|
|
105
|
+
case S.PART_DATA_START: a = S.PART_DATA, u("onPartData");
|
|
106
|
+
case S.PART_DATA:
|
|
107
|
+
if (E = e, e === 0) {
|
|
108
|
+
for (t += m; t < O && !(o[t] in H);) t += b;
|
|
109
|
+
t -= m, r = o[t];
|
|
110
|
+
}
|
|
111
|
+
if (e < h.length) h[e] === r ? (e === 0 && L("onPartData", !0), e++) : e = 0;
|
|
112
|
+
else if (e === h.length) e++, r === CR ? d |= F.PART_BOUNDARY : r === HYPHEN ? d |= F.LAST_BOUNDARY : e = 0;
|
|
113
|
+
else if (e - 1 === h.length) if (d & F.PART_BOUNDARY) {
|
|
114
|
+
if (e = 0, r === LF) {
|
|
115
|
+
d &= ~F.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), a = S.HEADER_FIELD_START;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
} else d & F.LAST_BOUNDARY && r === HYPHEN ? (T("onPartEnd"), a = S.END, d = 0) : e = 0;
|
|
119
|
+
if (e > 0) l[e - 1] = r;
|
|
120
|
+
else if (E > 0) {
|
|
121
|
+
const D = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
|
|
122
|
+
T("onPartData", 0, E, D), E = 0, u("onPartData"), t--;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case S.END: break;
|
|
126
|
+
default: throw new Error(`Unexpected state entered: ${a}`);
|
|
127
|
+
}
|
|
128
|
+
L("onHeaderField"), L("onHeaderValue"), L("onPartData"), this.index = e, this.state = a, this.flags = d;
|
|
129
|
+
}
|
|
130
|
+
end() {
|
|
131
|
+
if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
|
|
132
|
+
else if (this.state !== S.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
c(g, "MultipartParser");
|
|
136
|
+
var MultipartParser = g;
|
|
137
|
+
function _fileName(R) {
|
|
138
|
+
const o = R.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
139
|
+
if (!o) return;
|
|
140
|
+
const t = o[2] || o[3] || "";
|
|
141
|
+
let n = t.slice(t.lastIndexOf("\\") + 1);
|
|
142
|
+
return n = n.replace(/%22/g, "\""), n = n.replace(/&#(\d{4});/g, (E, l) => String.fromCharCode(l)), n;
|
|
143
|
+
}
|
|
144
|
+
c(_fileName, "_fileName");
|
|
145
|
+
async function toFormData(R, o) {
|
|
146
|
+
if (!/multipart/i.test(o)) throw new TypeError("Failed to fetch");
|
|
147
|
+
const t = o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
148
|
+
if (!t) throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
149
|
+
const n = new MultipartParser(t[1] || t[2]);
|
|
150
|
+
let E, l, h, H, e, a;
|
|
151
|
+
const d = [], b = new node.FormData(), m = c((i) => {
|
|
152
|
+
h += u.decode(i, { stream: !0 });
|
|
153
|
+
}, "onPartData"), O = c((i) => {
|
|
154
|
+
d.push(i);
|
|
155
|
+
}, "appendToFile"), r = c(() => {
|
|
156
|
+
const i = new node.File(d, a, { type: e });
|
|
157
|
+
b.append(H, i);
|
|
158
|
+
}, "appendFileToFormData"), P = c(() => {
|
|
159
|
+
b.append(H, h);
|
|
160
|
+
}, "appendEntryToFormData"), u = new TextDecoder("utf-8");
|
|
161
|
+
u.decode(), n.onPartBegin = function() {
|
|
162
|
+
n.onPartData = m, n.onPartEnd = P, E = "", l = "", h = "", H = "", e = "", a = null, d.length = 0;
|
|
163
|
+
}, n.onHeaderField = function(i) {
|
|
164
|
+
E += u.decode(i, { stream: !0 });
|
|
165
|
+
}, n.onHeaderValue = function(i) {
|
|
166
|
+
l += u.decode(i, { stream: !0 });
|
|
167
|
+
}, n.onHeaderEnd = function() {
|
|
168
|
+
if (l += u.decode(), E = E.toLowerCase(), E === "content-disposition") {
|
|
169
|
+
const i = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
170
|
+
i && (H = i[2] || i[3] || ""), a = _fileName(l), a && (n.onPartData = O, n.onPartEnd = r);
|
|
171
|
+
} else E === "content-type" && (e = l);
|
|
172
|
+
l = "", E = "";
|
|
173
|
+
};
|
|
174
|
+
for await (const i of R) n.write(i);
|
|
175
|
+
return n.end(), b;
|
|
176
|
+
}
|
|
177
|
+
c(toFormData, "toFormData"), exports.toFormData = toFormData;
|
|
178
|
+
}));
|
|
179
|
+
//#endregion
|
|
180
|
+
export default require_multipart_parser();
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { i as qn, r as br } from "../server.js";
|
|
2
|
+
//#region ../../node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs
|
|
3
|
+
var B = Object.defineProperty;
|
|
4
|
+
var E = (u, a) => B(u, "name", {
|
|
5
|
+
value: a,
|
|
6
|
+
configurable: !0
|
|
7
|
+
});
|
|
8
|
+
var D = 0;
|
|
9
|
+
var t = {
|
|
10
|
+
START_BOUNDARY: D++,
|
|
11
|
+
HEADER_FIELD_START: D++,
|
|
12
|
+
HEADER_FIELD: D++,
|
|
13
|
+
HEADER_VALUE_START: D++,
|
|
14
|
+
HEADER_VALUE: D++,
|
|
15
|
+
HEADER_VALUE_ALMOST_DONE: D++,
|
|
16
|
+
HEADERS_ALMOST_DONE: D++,
|
|
17
|
+
PART_DATA_START: D++,
|
|
18
|
+
PART_DATA: D++,
|
|
19
|
+
END: D++
|
|
20
|
+
};
|
|
21
|
+
var w = 1;
|
|
22
|
+
var R = {
|
|
23
|
+
PART_BOUNDARY: w,
|
|
24
|
+
LAST_BOUNDARY: w *= 2
|
|
25
|
+
};
|
|
26
|
+
var g = 10;
|
|
27
|
+
var N = 13;
|
|
28
|
+
var x = 32;
|
|
29
|
+
var P = 45;
|
|
30
|
+
var C = 58;
|
|
31
|
+
var I = 97;
|
|
32
|
+
var M = 122;
|
|
33
|
+
var $ = E((u) => u | 32, "lower");
|
|
34
|
+
var m = E(() => {}, "noop");
|
|
35
|
+
var F = class F {
|
|
36
|
+
constructor(a) {
|
|
37
|
+
this.index = 0, this.flags = 0, this.onHeaderEnd = m, this.onHeaderField = m, this.onHeadersEnd = m, this.onHeaderValue = m, this.onPartBegin = m, this.onPartData = m, this.onPartEnd = m, this.boundaryChars = {}, a = `\r
|
|
38
|
+
--` + a;
|
|
39
|
+
const n = new Uint8Array(a.length);
|
|
40
|
+
for (let r = 0; r < a.length; r++) n[r] = a.charCodeAt(r), this.boundaryChars[n[r]] = !0;
|
|
41
|
+
this.boundary = n, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = t.START_BOUNDARY;
|
|
42
|
+
}
|
|
43
|
+
write(a) {
|
|
44
|
+
let n = 0;
|
|
45
|
+
const r = a.length;
|
|
46
|
+
let d = this.index, { lookbehind: l, boundary: c, boundaryChars: p, index: e, state: i, flags: A } = this;
|
|
47
|
+
const H = this.boundary.length, O = H - 1, y = a.length;
|
|
48
|
+
let o, L;
|
|
49
|
+
const f = E((h) => {
|
|
50
|
+
this[h + "Mark"] = n;
|
|
51
|
+
}, "mark"), s = E((h) => {
|
|
52
|
+
delete this[h + "Mark"];
|
|
53
|
+
}, "clear"), T = E((h, S, _, U) => {
|
|
54
|
+
(S === void 0 || S !== _) && this[h](U && U.subarray(S, _));
|
|
55
|
+
}, "callback"), b = E((h, S) => {
|
|
56
|
+
const _ = h + "Mark";
|
|
57
|
+
_ in this && (S ? (T(h, this[_], n, a), delete this[_]) : (T(h, this[_], a.length, a), this[_] = 0));
|
|
58
|
+
}, "dataCallback");
|
|
59
|
+
for (n = 0; n < r; n++) switch (o = a[n], i) {
|
|
60
|
+
case t.START_BOUNDARY:
|
|
61
|
+
if (e === c.length - 2) {
|
|
62
|
+
if (o === P) A |= R.LAST_BOUNDARY;
|
|
63
|
+
else if (o !== N) return;
|
|
64
|
+
e++;
|
|
65
|
+
break;
|
|
66
|
+
} else if (e - 1 === c.length - 2) {
|
|
67
|
+
if (A & R.LAST_BOUNDARY && o === P) i = t.END, A = 0;
|
|
68
|
+
else if (!(A & R.LAST_BOUNDARY) && o === g) e = 0, T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
69
|
+
else return;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
o !== c[e + 2] && (e = -2), o === c[e + 2] && e++;
|
|
73
|
+
break;
|
|
74
|
+
case t.HEADER_FIELD_START: i = t.HEADER_FIELD, f("onHeaderField"), e = 0;
|
|
75
|
+
case t.HEADER_FIELD:
|
|
76
|
+
if (o === N) {
|
|
77
|
+
s("onHeaderField"), i = t.HEADERS_ALMOST_DONE;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
if (e++, o === P) break;
|
|
81
|
+
if (o === C) {
|
|
82
|
+
if (e === 1) return;
|
|
83
|
+
b("onHeaderField", !0), i = t.HEADER_VALUE_START;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (L = $(o), L < I || L > M) return;
|
|
87
|
+
break;
|
|
88
|
+
case t.HEADER_VALUE_START:
|
|
89
|
+
if (o === x) break;
|
|
90
|
+
f("onHeaderValue"), i = t.HEADER_VALUE;
|
|
91
|
+
case t.HEADER_VALUE:
|
|
92
|
+
o === N && (b("onHeaderValue", !0), T("onHeaderEnd"), i = t.HEADER_VALUE_ALMOST_DONE);
|
|
93
|
+
break;
|
|
94
|
+
case t.HEADER_VALUE_ALMOST_DONE:
|
|
95
|
+
if (o !== g) return;
|
|
96
|
+
i = t.HEADER_FIELD_START;
|
|
97
|
+
break;
|
|
98
|
+
case t.HEADERS_ALMOST_DONE:
|
|
99
|
+
if (o !== g) return;
|
|
100
|
+
T("onHeadersEnd"), i = t.PART_DATA_START;
|
|
101
|
+
break;
|
|
102
|
+
case t.PART_DATA_START: i = t.PART_DATA, f("onPartData");
|
|
103
|
+
case t.PART_DATA:
|
|
104
|
+
if (d = e, e === 0) {
|
|
105
|
+
for (n += O; n < y && !(a[n] in p);) n += H;
|
|
106
|
+
n -= O, o = a[n];
|
|
107
|
+
}
|
|
108
|
+
if (e < c.length) c[e] === o ? (e === 0 && b("onPartData", !0), e++) : e = 0;
|
|
109
|
+
else if (e === c.length) e++, o === N ? A |= R.PART_BOUNDARY : o === P ? A |= R.LAST_BOUNDARY : e = 0;
|
|
110
|
+
else if (e - 1 === c.length) if (A & R.PART_BOUNDARY) {
|
|
111
|
+
if (e = 0, o === g) {
|
|
112
|
+
A &= ~R.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
} else A & R.LAST_BOUNDARY && o === P ? (T("onPartEnd"), i = t.END, A = 0) : e = 0;
|
|
116
|
+
if (e > 0) l[e - 1] = o;
|
|
117
|
+
else if (d > 0) {
|
|
118
|
+
const h = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
|
|
119
|
+
T("onPartData", 0, d, h), d = 0, f("onPartData"), n--;
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case t.END: break;
|
|
123
|
+
default: throw new Error(`Unexpected state entered: ${i}`);
|
|
124
|
+
}
|
|
125
|
+
b("onHeaderField"), b("onHeaderValue"), b("onPartData"), this.index = e, this.state = i, this.flags = A;
|
|
126
|
+
}
|
|
127
|
+
end() {
|
|
128
|
+
if (this.state === t.HEADER_FIELD_START && this.index === 0 || this.state === t.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
|
|
129
|
+
else if (this.state !== t.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
E(F, "MultipartParser");
|
|
133
|
+
var k = F;
|
|
134
|
+
function v(u) {
|
|
135
|
+
const a = u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
136
|
+
if (!a) return;
|
|
137
|
+
const n = a[2] || a[3] || "";
|
|
138
|
+
let r = n.slice(n.lastIndexOf("\\") + 1);
|
|
139
|
+
return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (d, l) => String.fromCharCode(l)), r;
|
|
140
|
+
}
|
|
141
|
+
E(v, "_fileName");
|
|
142
|
+
async function Z(u, a) {
|
|
143
|
+
if (!/multipart/i.test(a)) throw new TypeError("Failed to fetch");
|
|
144
|
+
const n = a.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
145
|
+
if (!n) throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
146
|
+
const r = new k(n[1] || n[2]);
|
|
147
|
+
let d, l, c, p, e, i;
|
|
148
|
+
const A = [], H = new br(), O = E((s) => {
|
|
149
|
+
c += f.decode(s, { stream: !0 });
|
|
150
|
+
}, "onPartData"), y = E((s) => {
|
|
151
|
+
A.push(s);
|
|
152
|
+
}, "appendToFile"), o = E(() => {
|
|
153
|
+
const s = new qn(A, i, { type: e });
|
|
154
|
+
H.append(p, s);
|
|
155
|
+
}, "appendFileToFormData"), L = E(() => {
|
|
156
|
+
H.append(p, c);
|
|
157
|
+
}, "appendEntryToFormData"), f = new TextDecoder("utf-8");
|
|
158
|
+
f.decode(), r.onPartBegin = function() {
|
|
159
|
+
r.onPartData = O, r.onPartEnd = L, d = "", l = "", c = "", p = "", e = "", i = null, A.length = 0;
|
|
160
|
+
}, r.onHeaderField = function(s) {
|
|
161
|
+
d += f.decode(s, { stream: !0 });
|
|
162
|
+
}, r.onHeaderValue = function(s) {
|
|
163
|
+
l += f.decode(s, { stream: !0 });
|
|
164
|
+
}, r.onHeaderEnd = function() {
|
|
165
|
+
if (l += f.decode(), d = d.toLowerCase(), d === "content-disposition") {
|
|
166
|
+
const s = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
167
|
+
s && (p = s[2] || s[3] || ""), i = v(l), i && (r.onPartData = y, r.onPartEnd = o);
|
|
168
|
+
} else d === "content-type" && (e = l);
|
|
169
|
+
l = "", d = "";
|
|
170
|
+
};
|
|
171
|
+
for await (const s of u) r.write(s);
|
|
172
|
+
return r.end(), H;
|
|
173
|
+
}
|
|
174
|
+
E(Z, "toFormData");
|
|
175
|
+
//#endregion
|
|
176
|
+
export { Z as toFormData };
|