tiny-oss 0.5.0 → 1.0.0
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/README.md +459 -52
- package/UPGRADING.md +151 -0
- package/dist/aws.d.ts +208 -0
- package/dist/azure.d.ts +204 -0
- package/dist/cos.d.ts +208 -0
- package/dist/index.d.ts +209 -0
- package/dist/obs.d.ts +208 -0
- package/dist/protocol.d.ts +271 -0
- package/dist/tiny-oss.aws.es.js +1052 -0
- package/dist/tiny-oss.aws.es.js.map +1 -0
- package/dist/tiny-oss.azure.es.js +882 -0
- package/dist/tiny-oss.azure.es.js.map +1 -0
- package/dist/tiny-oss.cos.es.js +984 -0
- package/dist/tiny-oss.cos.es.js.map +1 -0
- package/dist/tiny-oss.es.js +965 -0
- package/dist/tiny-oss.es.js.map +1 -0
- package/dist/tiny-oss.obs.es.js +1048 -0
- package/dist/tiny-oss.obs.es.js.map +1 -0
- package/dist/tiny-oss.protocol.es.js +588 -0
- package/dist/tiny-oss.protocol.es.js.map +1 -0
- package/package.json +78 -64
- package/dist/tiny-oss.js +0 -1642
- package/dist/tiny-oss.js.map +0 -1
- package/dist/tiny-oss.min.js +0 -35
- package/dist/tiny-oss.min.js.map +0 -1
- package/es/TinyOSS.js +0 -209
- package/es/index.js +0 -1
- package/es/utils/ajax.js +0 -61
- package/es/utils/index.js +0 -188
- package/lib/TinyOSS.js +0 -218
- package/lib/index.js +0 -3
- package/lib/utils/ajax.js +0 -66
- package/lib/utils/index.js +0 -203
- package/types/index.d.ts +0 -89
- package/vendor/digest.js +0 -390
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
var we = Object.defineProperty, xe = Object.defineProperties;
|
|
2
|
+
var ve = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var X = Object.getOwnPropertySymbols;
|
|
4
|
+
var Se = Object.prototype.hasOwnProperty, Te = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var J = (t, s, e) => s in t ? we(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e, C = (t, s) => {
|
|
6
|
+
for (var e in s || (s = {}))
|
|
7
|
+
Se.call(s, e) && J(t, e, s[e]);
|
|
8
|
+
if (X)
|
|
9
|
+
for (var e of X(s))
|
|
10
|
+
Te.call(s, e) && J(t, e, s[e]);
|
|
11
|
+
return t;
|
|
12
|
+
}, Q = (t, s) => xe(t, ve(s));
|
|
13
|
+
var z = (t, s, e) => new Promise((o, a) => {
|
|
14
|
+
var l = (p) => {
|
|
15
|
+
try {
|
|
16
|
+
i(e.next(p));
|
|
17
|
+
} catch (r) {
|
|
18
|
+
a(r);
|
|
19
|
+
}
|
|
20
|
+
}, h = (p) => {
|
|
21
|
+
try {
|
|
22
|
+
i(e.throw(p));
|
|
23
|
+
} catch (r) {
|
|
24
|
+
a(r);
|
|
25
|
+
}
|
|
26
|
+
}, i = (p) => p.done ? o(p.value) : Promise.resolve(p.value).then(l, h);
|
|
27
|
+
i((e = e.apply(t, s)).next());
|
|
28
|
+
});
|
|
29
|
+
function be(t, s) {
|
|
30
|
+
return new Promise((e, o) => {
|
|
31
|
+
const {
|
|
32
|
+
method: a = "get",
|
|
33
|
+
data: l = null,
|
|
34
|
+
headers: h = {},
|
|
35
|
+
timeout: i = 0,
|
|
36
|
+
onprogress: p
|
|
37
|
+
} = s, r = new XMLHttpRequest();
|
|
38
|
+
let n;
|
|
39
|
+
i && (n = setTimeout(() => {
|
|
40
|
+
o(new Error(`the request timeout ${i}ms`));
|
|
41
|
+
}, i)), r.onerror = () => {
|
|
42
|
+
o(new Error("unknown error"));
|
|
43
|
+
}, r.upload && p && (r.upload.onprogress = (u) => {
|
|
44
|
+
p({ loaded: u.loaded, total: u.total, lengthComputable: u.lengthComputable });
|
|
45
|
+
}), r.onreadystatechange = () => {
|
|
46
|
+
if (r.readyState === 4)
|
|
47
|
+
if (i && clearTimeout(n), r.status >= 200 && r.status < 300) {
|
|
48
|
+
const u = {}, c = r.getAllResponseHeaders();
|
|
49
|
+
c && c.trim().split(/[\r\n]+/).forEach((d) => {
|
|
50
|
+
const g = d.split(": "), y = g.shift(), m = g.join(": ");
|
|
51
|
+
y && (u[y.toLowerCase()] = m);
|
|
52
|
+
}), e({
|
|
53
|
+
data: r.responseText,
|
|
54
|
+
headers: u,
|
|
55
|
+
status: r.status,
|
|
56
|
+
statusText: r.statusText
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
const u = new Error(`the request is error: ${r.status} ${r.statusText} ${r.responseText || ""}`);
|
|
60
|
+
o(u);
|
|
61
|
+
}
|
|
62
|
+
}, r.open(a, t, !0), Object.keys(h).forEach((u) => {
|
|
63
|
+
r.setRequestHeader(u, h[u]);
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
r.send(l);
|
|
67
|
+
} catch (u) {
|
|
68
|
+
o(u);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
let ae = be;
|
|
73
|
+
function lt(t) {
|
|
74
|
+
ae = t;
|
|
75
|
+
}
|
|
76
|
+
function Ue() {
|
|
77
|
+
return ae;
|
|
78
|
+
}
|
|
79
|
+
function ie(t) {
|
|
80
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
81
|
+
}
|
|
82
|
+
var _ = { exports: {} }, j = { exports: {} }, Y;
|
|
83
|
+
function Ce() {
|
|
84
|
+
return Y || (Y = 1, (function() {
|
|
85
|
+
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = {
|
|
86
|
+
// Bit-wise rotation left
|
|
87
|
+
rotl: function(e, o) {
|
|
88
|
+
return e << o | e >>> 32 - o;
|
|
89
|
+
},
|
|
90
|
+
// Bit-wise rotation right
|
|
91
|
+
rotr: function(e, o) {
|
|
92
|
+
return e << 32 - o | e >>> o;
|
|
93
|
+
},
|
|
94
|
+
// Swap big-endian to little-endian and vice versa
|
|
95
|
+
endian: function(e) {
|
|
96
|
+
if (e.constructor == Number)
|
|
97
|
+
return s.rotl(e, 8) & 16711935 | s.rotl(e, 24) & 4278255360;
|
|
98
|
+
for (var o = 0; o < e.length; o++)
|
|
99
|
+
e[o] = s.endian(e[o]);
|
|
100
|
+
return e;
|
|
101
|
+
},
|
|
102
|
+
// Generate an array of any length of random bytes
|
|
103
|
+
randomBytes: function(e) {
|
|
104
|
+
for (var o = []; e > 0; e--)
|
|
105
|
+
o.push(Math.floor(Math.random() * 256));
|
|
106
|
+
return o;
|
|
107
|
+
},
|
|
108
|
+
// Convert a byte array to big-endian 32-bit words
|
|
109
|
+
bytesToWords: function(e) {
|
|
110
|
+
for (var o = [], a = 0, l = 0; a < e.length; a++, l += 8)
|
|
111
|
+
o[l >>> 5] |= e[a] << 24 - l % 32;
|
|
112
|
+
return o;
|
|
113
|
+
},
|
|
114
|
+
// Convert big-endian 32-bit words to a byte array
|
|
115
|
+
wordsToBytes: function(e) {
|
|
116
|
+
for (var o = [], a = 0; a < e.length * 32; a += 8)
|
|
117
|
+
o.push(e[a >>> 5] >>> 24 - a % 32 & 255);
|
|
118
|
+
return o;
|
|
119
|
+
},
|
|
120
|
+
// Convert a byte array to a hex string
|
|
121
|
+
bytesToHex: function(e) {
|
|
122
|
+
for (var o = [], a = 0; a < e.length; a++)
|
|
123
|
+
o.push((e[a] >>> 4).toString(16)), o.push((e[a] & 15).toString(16));
|
|
124
|
+
return o.join("");
|
|
125
|
+
},
|
|
126
|
+
// Convert a hex string to a byte array
|
|
127
|
+
hexToBytes: function(e) {
|
|
128
|
+
for (var o = [], a = 0; a < e.length; a += 2)
|
|
129
|
+
o.push(parseInt(e.substr(a, 2), 16));
|
|
130
|
+
return o;
|
|
131
|
+
},
|
|
132
|
+
// Convert a byte array to a base-64 string
|
|
133
|
+
bytesToBase64: function(e) {
|
|
134
|
+
for (var o = [], a = 0; a < e.length; a += 3)
|
|
135
|
+
for (var l = e[a] << 16 | e[a + 1] << 8 | e[a + 2], h = 0; h < 4; h++)
|
|
136
|
+
a * 8 + h * 6 <= e.length * 8 ? o.push(t.charAt(l >>> 6 * (3 - h) & 63)) : o.push("=");
|
|
137
|
+
return o.join("");
|
|
138
|
+
},
|
|
139
|
+
// Convert a base-64 string to a byte array
|
|
140
|
+
base64ToBytes: function(e) {
|
|
141
|
+
e = e.replace(/[^A-Z0-9+\/]/ig, "");
|
|
142
|
+
for (var o = [], a = 0, l = 0; a < e.length; l = ++a % 4)
|
|
143
|
+
l != 0 && o.push((t.indexOf(e.charAt(a - 1)) & Math.pow(2, -2 * l + 8) - 1) << l * 2 | t.indexOf(e.charAt(a)) >>> 6 - l * 2);
|
|
144
|
+
return o;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
j.exports = s;
|
|
148
|
+
})()), j.exports;
|
|
149
|
+
}
|
|
150
|
+
var N, Z;
|
|
151
|
+
function ee() {
|
|
152
|
+
if (Z) return N;
|
|
153
|
+
Z = 1;
|
|
154
|
+
var t = {
|
|
155
|
+
// UTF-8 encoding
|
|
156
|
+
utf8: {
|
|
157
|
+
// Convert a string to a byte array
|
|
158
|
+
stringToBytes: function(s) {
|
|
159
|
+
return t.bin.stringToBytes(unescape(encodeURIComponent(s)));
|
|
160
|
+
},
|
|
161
|
+
// Convert a byte array to a string
|
|
162
|
+
bytesToString: function(s) {
|
|
163
|
+
return decodeURIComponent(escape(t.bin.bytesToString(s)));
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
// Binary encoding
|
|
167
|
+
bin: {
|
|
168
|
+
// Convert a string to a byte array
|
|
169
|
+
stringToBytes: function(s) {
|
|
170
|
+
for (var e = [], o = 0; o < s.length; o++)
|
|
171
|
+
e.push(s.charCodeAt(o) & 255);
|
|
172
|
+
return e;
|
|
173
|
+
},
|
|
174
|
+
// Convert a byte array to a string
|
|
175
|
+
bytesToString: function(s) {
|
|
176
|
+
for (var e = [], o = 0; o < s.length; o++)
|
|
177
|
+
e.push(String.fromCharCode(s[o]));
|
|
178
|
+
return e.join("");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return N = t, N;
|
|
183
|
+
}
|
|
184
|
+
var W, te;
|
|
185
|
+
function Be() {
|
|
186
|
+
if (te) return W;
|
|
187
|
+
te = 1, W = function(e) {
|
|
188
|
+
return e != null && (t(e) || s(e) || !!e._isBuffer);
|
|
189
|
+
};
|
|
190
|
+
function t(e) {
|
|
191
|
+
return !!e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
|
|
192
|
+
}
|
|
193
|
+
function s(e) {
|
|
194
|
+
return typeof e.readFloatLE == "function" && typeof e.slice == "function" && t(e.slice(0, 0));
|
|
195
|
+
}
|
|
196
|
+
return W;
|
|
197
|
+
}
|
|
198
|
+
var re;
|
|
199
|
+
function Ee() {
|
|
200
|
+
return re || (re = 1, (function() {
|
|
201
|
+
var t = Ce(), s = ee().utf8, e = Be(), o = ee().bin, a = function(l, h) {
|
|
202
|
+
l.constructor == String ? h && h.encoding === "binary" ? l = o.stringToBytes(l) : l = s.stringToBytes(l) : e(l) ? l = Array.prototype.slice.call(l, 0) : !Array.isArray(l) && l.constructor !== Uint8Array && (l = l.toString());
|
|
203
|
+
for (var i = t.bytesToWords(l), p = l.length * 8, r = 1732584193, n = -271733879, u = -1732584194, c = 271733878, f = 0; f < i.length; f++)
|
|
204
|
+
i[f] = (i[f] << 8 | i[f] >>> 24) & 16711935 | (i[f] << 24 | i[f] >>> 8) & 4278255360;
|
|
205
|
+
i[p >>> 5] |= 128 << p % 32, i[(p + 64 >>> 9 << 4) + 14] = p;
|
|
206
|
+
for (var d = a._ff, g = a._gg, y = a._hh, m = a._ii, f = 0; f < i.length; f += 16) {
|
|
207
|
+
var A = r, w = n, v = u, x = c;
|
|
208
|
+
r = d(r, n, u, c, i[f + 0], 7, -680876936), c = d(c, r, n, u, i[f + 1], 12, -389564586), u = d(u, c, r, n, i[f + 2], 17, 606105819), n = d(n, u, c, r, i[f + 3], 22, -1044525330), r = d(r, n, u, c, i[f + 4], 7, -176418897), c = d(c, r, n, u, i[f + 5], 12, 1200080426), u = d(u, c, r, n, i[f + 6], 17, -1473231341), n = d(n, u, c, r, i[f + 7], 22, -45705983), r = d(r, n, u, c, i[f + 8], 7, 1770035416), c = d(c, r, n, u, i[f + 9], 12, -1958414417), u = d(u, c, r, n, i[f + 10], 17, -42063), n = d(n, u, c, r, i[f + 11], 22, -1990404162), r = d(r, n, u, c, i[f + 12], 7, 1804603682), c = d(c, r, n, u, i[f + 13], 12, -40341101), u = d(u, c, r, n, i[f + 14], 17, -1502002290), n = d(n, u, c, r, i[f + 15], 22, 1236535329), r = g(r, n, u, c, i[f + 1], 5, -165796510), c = g(c, r, n, u, i[f + 6], 9, -1069501632), u = g(u, c, r, n, i[f + 11], 14, 643717713), n = g(n, u, c, r, i[f + 0], 20, -373897302), r = g(r, n, u, c, i[f + 5], 5, -701558691), c = g(c, r, n, u, i[f + 10], 9, 38016083), u = g(u, c, r, n, i[f + 15], 14, -660478335), n = g(n, u, c, r, i[f + 4], 20, -405537848), r = g(r, n, u, c, i[f + 9], 5, 568446438), c = g(c, r, n, u, i[f + 14], 9, -1019803690), u = g(u, c, r, n, i[f + 3], 14, -187363961), n = g(n, u, c, r, i[f + 8], 20, 1163531501), r = g(r, n, u, c, i[f + 13], 5, -1444681467), c = g(c, r, n, u, i[f + 2], 9, -51403784), u = g(u, c, r, n, i[f + 7], 14, 1735328473), n = g(n, u, c, r, i[f + 12], 20, -1926607734), r = y(r, n, u, c, i[f + 5], 4, -378558), c = y(c, r, n, u, i[f + 8], 11, -2022574463), u = y(u, c, r, n, i[f + 11], 16, 1839030562), n = y(n, u, c, r, i[f + 14], 23, -35309556), r = y(r, n, u, c, i[f + 1], 4, -1530992060), c = y(c, r, n, u, i[f + 4], 11, 1272893353), u = y(u, c, r, n, i[f + 7], 16, -155497632), n = y(n, u, c, r, i[f + 10], 23, -1094730640), r = y(r, n, u, c, i[f + 13], 4, 681279174), c = y(c, r, n, u, i[f + 0], 11, -358537222), u = y(u, c, r, n, i[f + 3], 16, -722521979), n = y(n, u, c, r, i[f + 6], 23, 76029189), r = y(r, n, u, c, i[f + 9], 4, -640364487), c = y(c, r, n, u, i[f + 12], 11, -421815835), u = y(u, c, r, n, i[f + 15], 16, 530742520), n = y(n, u, c, r, i[f + 2], 23, -995338651), r = m(r, n, u, c, i[f + 0], 6, -198630844), c = m(c, r, n, u, i[f + 7], 10, 1126891415), u = m(u, c, r, n, i[f + 14], 15, -1416354905), n = m(n, u, c, r, i[f + 5], 21, -57434055), r = m(r, n, u, c, i[f + 12], 6, 1700485571), c = m(c, r, n, u, i[f + 3], 10, -1894986606), u = m(u, c, r, n, i[f + 10], 15, -1051523), n = m(n, u, c, r, i[f + 1], 21, -2054922799), r = m(r, n, u, c, i[f + 8], 6, 1873313359), c = m(c, r, n, u, i[f + 15], 10, -30611744), u = m(u, c, r, n, i[f + 6], 15, -1560198380), n = m(n, u, c, r, i[f + 13], 21, 1309151649), r = m(r, n, u, c, i[f + 4], 6, -145523070), c = m(c, r, n, u, i[f + 11], 10, -1120210379), u = m(u, c, r, n, i[f + 2], 15, 718787259), n = m(n, u, c, r, i[f + 9], 21, -343485551), r = r + A >>> 0, n = n + w >>> 0, u = u + v >>> 0, c = c + x >>> 0;
|
|
209
|
+
}
|
|
210
|
+
return t.endian([r, n, u, c]);
|
|
211
|
+
};
|
|
212
|
+
a._ff = function(l, h, i, p, r, n, u) {
|
|
213
|
+
var c = l + (h & i | ~h & p) + (r >>> 0) + u;
|
|
214
|
+
return (c << n | c >>> 32 - n) + h;
|
|
215
|
+
}, a._gg = function(l, h, i, p, r, n, u) {
|
|
216
|
+
var c = l + (h & p | i & ~p) + (r >>> 0) + u;
|
|
217
|
+
return (c << n | c >>> 32 - n) + h;
|
|
218
|
+
}, a._hh = function(l, h, i, p, r, n, u) {
|
|
219
|
+
var c = l + (h ^ i ^ p) + (r >>> 0) + u;
|
|
220
|
+
return (c << n | c >>> 32 - n) + h;
|
|
221
|
+
}, a._ii = function(l, h, i, p, r, n, u) {
|
|
222
|
+
var c = l + (i ^ (h | ~p)) + (r >>> 0) + u;
|
|
223
|
+
return (c << n | c >>> 32 - n) + h;
|
|
224
|
+
}, a._blocksize = 16, a._digestsize = 16, _.exports = function(l, h) {
|
|
225
|
+
if (l == null)
|
|
226
|
+
throw new Error("Illegal argument " + l);
|
|
227
|
+
var i = t.wordsToBytes(a(l, h));
|
|
228
|
+
return h && h.asBytes ? i : h && h.asString ? o.bytesToString(i) : t.bytesToHex(i);
|
|
229
|
+
};
|
|
230
|
+
})()), _.exports;
|
|
231
|
+
}
|
|
232
|
+
var Le = Ee();
|
|
233
|
+
const ke = /* @__PURE__ */ ie(Le);
|
|
234
|
+
var H = {}, ne;
|
|
235
|
+
function Pe() {
|
|
236
|
+
if (ne) return H;
|
|
237
|
+
ne = 1, H.byteLength = i, H.toByteArray = r, H.fromByteArray = c;
|
|
238
|
+
for (var t = [], s = [], e = typeof Uint8Array != "undefined" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, l = o.length; a < l; ++a)
|
|
239
|
+
t[a] = o[a], s[o.charCodeAt(a)] = a;
|
|
240
|
+
s[45] = 62, s[95] = 63;
|
|
241
|
+
function h(f) {
|
|
242
|
+
var d = f.length;
|
|
243
|
+
if (d % 4 > 0)
|
|
244
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
245
|
+
var g = f.indexOf("=");
|
|
246
|
+
g === -1 && (g = d);
|
|
247
|
+
var y = g === d ? 0 : 4 - g % 4;
|
|
248
|
+
return [g, y];
|
|
249
|
+
}
|
|
250
|
+
function i(f) {
|
|
251
|
+
var d = h(f), g = d[0], y = d[1];
|
|
252
|
+
return (g + y) * 3 / 4 - y;
|
|
253
|
+
}
|
|
254
|
+
function p(f, d, g) {
|
|
255
|
+
return (d + g) * 3 / 4 - g;
|
|
256
|
+
}
|
|
257
|
+
function r(f) {
|
|
258
|
+
var d, g = h(f), y = g[0], m = g[1], A = new e(p(f, y, m)), w = 0, v = m > 0 ? y - 4 : y, x;
|
|
259
|
+
for (x = 0; x < v; x += 4)
|
|
260
|
+
d = s[f.charCodeAt(x)] << 18 | s[f.charCodeAt(x + 1)] << 12 | s[f.charCodeAt(x + 2)] << 6 | s[f.charCodeAt(x + 3)], A[w++] = d >> 16 & 255, A[w++] = d >> 8 & 255, A[w++] = d & 255;
|
|
261
|
+
return m === 2 && (d = s[f.charCodeAt(x)] << 2 | s[f.charCodeAt(x + 1)] >> 4, A[w++] = d & 255), m === 1 && (d = s[f.charCodeAt(x)] << 10 | s[f.charCodeAt(x + 1)] << 4 | s[f.charCodeAt(x + 2)] >> 2, A[w++] = d >> 8 & 255, A[w++] = d & 255), A;
|
|
262
|
+
}
|
|
263
|
+
function n(f) {
|
|
264
|
+
return t[f >> 18 & 63] + t[f >> 12 & 63] + t[f >> 6 & 63] + t[f & 63];
|
|
265
|
+
}
|
|
266
|
+
function u(f, d, g) {
|
|
267
|
+
for (var y, m = [], A = d; A < g; A += 3)
|
|
268
|
+
y = (f[A] << 16 & 16711680) + (f[A + 1] << 8 & 65280) + (f[A + 2] & 255), m.push(n(y));
|
|
269
|
+
return m.join("");
|
|
270
|
+
}
|
|
271
|
+
function c(f) {
|
|
272
|
+
for (var d, g = f.length, y = g % 3, m = [], A = 16383, w = 0, v = g - y; w < v; w += A)
|
|
273
|
+
m.push(u(f, w, w + A > v ? v : w + A));
|
|
274
|
+
return y === 1 ? (d = f[g - 1], m.push(
|
|
275
|
+
t[d >> 2] + t[d << 4 & 63] + "=="
|
|
276
|
+
)) : y === 2 && (d = (f[g - 2] << 8) + f[g - 1], m.push(
|
|
277
|
+
t[d >> 10] + t[d >> 4 & 63] + t[d << 2 & 63] + "="
|
|
278
|
+
)), m.join("");
|
|
279
|
+
}
|
|
280
|
+
return H;
|
|
281
|
+
}
|
|
282
|
+
var $e = Pe();
|
|
283
|
+
const Fe = /* @__PURE__ */ ie($e);
|
|
284
|
+
ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = function(t, s) {
|
|
285
|
+
const e = new Uint8Array(this), o = s === void 0 ? e.length : s, a = new ArrayBuffer(o - t), l = new Uint8Array(a);
|
|
286
|
+
for (let h = 0; h < l.length; h++)
|
|
287
|
+
l[h] = e[h + t];
|
|
288
|
+
return a;
|
|
289
|
+
});
|
|
290
|
+
function Me(t) {
|
|
291
|
+
const s = new ArrayBuffer(t.length), e = new Uint8Array(s);
|
|
292
|
+
for (let o = 0; o < t.length; o++)
|
|
293
|
+
e[o] = t.charCodeAt(o);
|
|
294
|
+
return e;
|
|
295
|
+
}
|
|
296
|
+
function ze(t) {
|
|
297
|
+
const s = new ArrayBuffer(1), e = new Uint8Array(s);
|
|
298
|
+
return e[0] = t, e;
|
|
299
|
+
}
|
|
300
|
+
function O(t) {
|
|
301
|
+
if (t instanceof Uint8Array)
|
|
302
|
+
return t;
|
|
303
|
+
if (t instanceof ArrayBuffer)
|
|
304
|
+
return new Uint8Array(t);
|
|
305
|
+
if (typeof t == "string")
|
|
306
|
+
return Me(t);
|
|
307
|
+
if (typeof t == "number") {
|
|
308
|
+
if (t > 255)
|
|
309
|
+
throw new Error("For more than one byte, use an array buffer");
|
|
310
|
+
if (t < 0)
|
|
311
|
+
throw new Error("Input value must be positive");
|
|
312
|
+
return ze(t);
|
|
313
|
+
} else
|
|
314
|
+
throw new Error("Unsupported type");
|
|
315
|
+
}
|
|
316
|
+
function ue(t) {
|
|
317
|
+
const s = function(a) {
|
|
318
|
+
let l = a.length, h = 0;
|
|
319
|
+
for (; l > 0; ) {
|
|
320
|
+
let i = this.blockLen - this.inLen;
|
|
321
|
+
i > l && (i = l);
|
|
322
|
+
const p = a.subarray(h, h + i);
|
|
323
|
+
this.inbuf.set(p, this.inLen), h += i, l -= i, this.inLen += i, this.inLen === this.blockLen && (this.processBlock(this.inbuf), this.inLen = 0);
|
|
324
|
+
}
|
|
325
|
+
}, e = function() {
|
|
326
|
+
const a = this.doPadding();
|
|
327
|
+
this.update(a);
|
|
328
|
+
const l = this.getDigest();
|
|
329
|
+
return this.reset(), l;
|
|
330
|
+
}, o = new t();
|
|
331
|
+
return o.inbuf = new Uint8Array(new ArrayBuffer(o.blockLen)), o.reset(), o.update = s, o.finalize = e, {
|
|
332
|
+
update(a) {
|
|
333
|
+
o.update(O(a));
|
|
334
|
+
},
|
|
335
|
+
finalize() {
|
|
336
|
+
return o.finalize();
|
|
337
|
+
},
|
|
338
|
+
digest(a) {
|
|
339
|
+
return o.update(O(a)), o.finalize();
|
|
340
|
+
},
|
|
341
|
+
reset() {
|
|
342
|
+
o.reset();
|
|
343
|
+
},
|
|
344
|
+
digestLength() {
|
|
345
|
+
return o.digestLen;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function Ie(t) {
|
|
350
|
+
let s = !1, e, o, a;
|
|
351
|
+
const l = function() {
|
|
352
|
+
if (s)
|
|
353
|
+
return;
|
|
354
|
+
if (e === void 0)
|
|
355
|
+
throw new Error("MAC key is not defined");
|
|
356
|
+
let r;
|
|
357
|
+
e.byteLength > 64 ? r = new Uint8Array(t.digest(e)) : r = new Uint8Array(e), o = new Uint8Array(new ArrayBuffer(64));
|
|
358
|
+
for (let n = 0; n < r.length; n++)
|
|
359
|
+
o[n] = 54 ^ r[n];
|
|
360
|
+
for (let n = r.length; n < 64; n++)
|
|
361
|
+
o[n] = 54;
|
|
362
|
+
a = new Uint8Array(new ArrayBuffer(64));
|
|
363
|
+
for (let n = 0; n < r.length; n++)
|
|
364
|
+
a[n] = 92 ^ r[n];
|
|
365
|
+
for (let n = r.length; n < 64; n++)
|
|
366
|
+
a[n] = 92;
|
|
367
|
+
s = !0, t.update(o.buffer);
|
|
368
|
+
}, h = function() {
|
|
369
|
+
s = !1, e = void 0, o = void 0, a = void 0, t.reset();
|
|
370
|
+
}, i = function() {
|
|
371
|
+
const r = t.finalize();
|
|
372
|
+
t.reset(), t.update(a.buffer), t.update(new Uint8Array(r));
|
|
373
|
+
const n = t.finalize();
|
|
374
|
+
return h(), n;
|
|
375
|
+
}, p = function(r) {
|
|
376
|
+
e = r;
|
|
377
|
+
};
|
|
378
|
+
return {
|
|
379
|
+
setKey(r) {
|
|
380
|
+
p(O(r)), l();
|
|
381
|
+
},
|
|
382
|
+
update(r) {
|
|
383
|
+
t.update(O(r));
|
|
384
|
+
},
|
|
385
|
+
finalize() {
|
|
386
|
+
return i();
|
|
387
|
+
},
|
|
388
|
+
mac(r) {
|
|
389
|
+
return this.update(r), this.finalize();
|
|
390
|
+
},
|
|
391
|
+
reset() {
|
|
392
|
+
h();
|
|
393
|
+
},
|
|
394
|
+
hmacLength() {
|
|
395
|
+
return t.digestLength();
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function Re(t) {
|
|
400
|
+
const s = new Uint8Array(t.length * 4);
|
|
401
|
+
let e = 0;
|
|
402
|
+
for (let o = 0; o < t.length; o++) {
|
|
403
|
+
let a = t.charCodeAt(o);
|
|
404
|
+
if (a >= 55296 && a <= 56319 && o + 1 < t.length) {
|
|
405
|
+
const l = t.charCodeAt(o + 1);
|
|
406
|
+
l >= 56320 && l <= 57343 && (a = (a - 55296) * 1024 + (l - 56320) + 65536, o += 1);
|
|
407
|
+
}
|
|
408
|
+
a < 128 ? s[e++] = a : a < 2048 ? (s[e++] = 192 | a >> 6, s[e++] = 128 | a & 63) : a < 65536 ? (s[e++] = 224 | a >> 12, s[e++] = 128 | a >> 6 & 63, s[e++] = 128 | a & 63) : (s[e++] = 240 | a >> 18, s[e++] = 128 | a >> 12 & 63, s[e++] = 128 | a >> 6 & 63, s[e++] = 128 | a & 63);
|
|
409
|
+
}
|
|
410
|
+
return s.subarray(0, e);
|
|
411
|
+
}
|
|
412
|
+
const oe = typeof TextEncoder != "undefined" ? new TextEncoder() : null;
|
|
413
|
+
function I(t) {
|
|
414
|
+
return oe ? oe.encode(t) : Re(t);
|
|
415
|
+
}
|
|
416
|
+
function ce(t) {
|
|
417
|
+
return typeof t == "string" ? Promise.resolve(I(t)) : t instanceof ArrayBuffer ? Promise.resolve(new Uint8Array(t)) : ArrayBuffer.isView(t) ? Promise.resolve(new Uint8Array(t.buffer, t.byteOffset, t.byteLength)) : t.arrayBuffer().then((s) => new Uint8Array(s));
|
|
418
|
+
}
|
|
419
|
+
function He(t) {
|
|
420
|
+
const { accessKeyId: s, accessKeySecret: e, bucket: o, endpoint: a } = t;
|
|
421
|
+
if (!s) throw new Error("need accessKeyId");
|
|
422
|
+
if (!e) throw new Error("need accessKeySecret");
|
|
423
|
+
if (!o && !a) throw new Error("need bucket or endpoint");
|
|
424
|
+
}
|
|
425
|
+
function qe(t) {
|
|
426
|
+
const s = [];
|
|
427
|
+
for (let e = 0; e < t.length; e += 2)
|
|
428
|
+
s.push(parseInt(t[e] + t[e + 1], 16));
|
|
429
|
+
return Uint8Array.from(s);
|
|
430
|
+
}
|
|
431
|
+
function G(t) {
|
|
432
|
+
const s = Array.prototype.slice.call(t, 0), e = qe(ke(s));
|
|
433
|
+
return Fe.fromByteArray(e);
|
|
434
|
+
}
|
|
435
|
+
const De = {
|
|
436
|
+
region: "oss-cn-hangzhou",
|
|
437
|
+
internal: !1,
|
|
438
|
+
cname: !1,
|
|
439
|
+
secure: !1,
|
|
440
|
+
timeout: 6e4
|
|
441
|
+
};
|
|
442
|
+
function fe(t = {}, s = De) {
|
|
443
|
+
return He(t), Object.assign({}, s, t);
|
|
444
|
+
}
|
|
445
|
+
function Ke(t, s) {
|
|
446
|
+
const e = s || t.timeout;
|
|
447
|
+
return typeof e == "string" ? parseInt(e, 10) : e;
|
|
448
|
+
}
|
|
449
|
+
function Oe(t) {
|
|
450
|
+
if (t != null) {
|
|
451
|
+
if (typeof t == "string") return I(t).length;
|
|
452
|
+
if (t instanceof Blob) return t.size;
|
|
453
|
+
if (t instanceof ArrayBuffer || ArrayBuffer.isView(t)) return t.byteLength;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
class le {
|
|
457
|
+
constructor() {
|
|
458
|
+
this.current = new Uint32Array(new ArrayBuffer(32)), this.currentLen = 0, this.inLen = 0, this.inbuf = new Uint8Array(new ArrayBuffer(64)), this.blockLen = 64, this.digestLen = 32, this.reset();
|
|
459
|
+
}
|
|
460
|
+
processBlock(s) {
|
|
461
|
+
let e = this.current[0], o = this.current[1], a = this.current[2], l = this.current[3], h = this.current[4], i = this.current[5], p = this.current[6], r = this.current[7];
|
|
462
|
+
const n = new Array(64);
|
|
463
|
+
for (let u = 0; u < 16; u++) {
|
|
464
|
+
const c = u * 4;
|
|
465
|
+
n[u] = s[c] << 24 | s[c + 1] << 16 | s[c + 2] << 8 | s[c + 3];
|
|
466
|
+
}
|
|
467
|
+
for (let u = 16; u < 64; u++) {
|
|
468
|
+
const c = n[u - 15], f = n[u - 2], d = (c >>> 7 | c << 25) ^ (c >>> 18 | c << 14) ^ c >>> 3, g = (f >>> 17 | f << 15) ^ (f >>> 19 | f << 13) ^ f >>> 10;
|
|
469
|
+
n[u] = g + n[u - 7] + d + n[u - 16] | 0;
|
|
470
|
+
}
|
|
471
|
+
for (let u = 0; u < 64; u++) {
|
|
472
|
+
const c = (h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7), f = h & i ^ ~h & p, d = r + c + f + _e[u] + n[u] | 0, g = (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10), y = e & o ^ e & a ^ o & a, m = g + y | 0;
|
|
473
|
+
r = p, p = i, i = h, h = l + d | 0, l = a, a = o, o = e, e = d + m | 0;
|
|
474
|
+
}
|
|
475
|
+
this.current[0] = this.current[0] + e | 0, this.current[1] = this.current[1] + o | 0, this.current[2] = this.current[2] + a | 0, this.current[3] = this.current[3] + l | 0, this.current[4] = this.current[4] + h | 0, this.current[5] = this.current[5] + i | 0, this.current[6] = this.current[6] + p | 0, this.current[7] = this.current[7] + r | 0, this.currentLen += 64;
|
|
476
|
+
}
|
|
477
|
+
doPadding() {
|
|
478
|
+
const s = (this.inLen + this.currentLen) * 8, e = 0, o = s & 4294967295, a = this.inLen <= 55 ? 55 - this.inLen : 119 - this.inLen, l = new Uint8Array(new ArrayBuffer(a + 1 + 8));
|
|
479
|
+
return l[0] = 128, l[l.length - 1] = o & 255, l[l.length - 2] = o >>> 8 & 255, l[l.length - 3] = o >>> 16 & 255, l[l.length - 4] = o >>> 24 & 255, l[l.length - 5] = e & 255, l[l.length - 6] = e >>> 8 & 255, l[l.length - 7] = e >>> 16 & 255, l[l.length - 8] = e >>> 24 & 255, l;
|
|
480
|
+
}
|
|
481
|
+
getDigest() {
|
|
482
|
+
const s = new Uint8Array(new ArrayBuffer(32));
|
|
483
|
+
for (let e = 0; e < 8; e++) {
|
|
484
|
+
const o = this.current[e], a = e * 4;
|
|
485
|
+
s[a] = o >>> 24 & 255, s[a + 1] = o >>> 16 & 255, s[a + 2] = o >>> 8 & 255, s[a + 3] = o & 255;
|
|
486
|
+
}
|
|
487
|
+
return s.buffer;
|
|
488
|
+
}
|
|
489
|
+
reset() {
|
|
490
|
+
this.currentLen = 0, this.inLen = 0, this.current[0] = 1779033703, this.current[1] = 3144134277, this.current[2] = 1013904242, this.current[3] = 2773480762, this.current[4] = 1359893119, this.current[5] = 2600822924, this.current[6] = 528734635, this.current[7] = 1541459225;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
const _e = new Uint32Array([
|
|
494
|
+
1116352408,
|
|
495
|
+
1899447441,
|
|
496
|
+
3049323471,
|
|
497
|
+
3921009573,
|
|
498
|
+
961987163,
|
|
499
|
+
1508970993,
|
|
500
|
+
2453635748,
|
|
501
|
+
2870763221,
|
|
502
|
+
3624381080,
|
|
503
|
+
310598401,
|
|
504
|
+
607225278,
|
|
505
|
+
1426881987,
|
|
506
|
+
1925078388,
|
|
507
|
+
2162078206,
|
|
508
|
+
2614888103,
|
|
509
|
+
3248222580,
|
|
510
|
+
3835390401,
|
|
511
|
+
4022224774,
|
|
512
|
+
264347078,
|
|
513
|
+
604807628,
|
|
514
|
+
770255983,
|
|
515
|
+
1249150122,
|
|
516
|
+
1555081692,
|
|
517
|
+
1996064986,
|
|
518
|
+
2554220882,
|
|
519
|
+
2821834349,
|
|
520
|
+
2952996808,
|
|
521
|
+
3210313671,
|
|
522
|
+
3336571891,
|
|
523
|
+
3584528711,
|
|
524
|
+
113926993,
|
|
525
|
+
338241895,
|
|
526
|
+
666307205,
|
|
527
|
+
773529912,
|
|
528
|
+
1294757372,
|
|
529
|
+
1396182291,
|
|
530
|
+
1695183700,
|
|
531
|
+
1986661051,
|
|
532
|
+
2177026350,
|
|
533
|
+
2456956037,
|
|
534
|
+
2730485921,
|
|
535
|
+
2820302411,
|
|
536
|
+
3259730800,
|
|
537
|
+
3345764771,
|
|
538
|
+
3516065817,
|
|
539
|
+
3600352804,
|
|
540
|
+
4094571909,
|
|
541
|
+
275423344,
|
|
542
|
+
430227734,
|
|
543
|
+
506948616,
|
|
544
|
+
659060556,
|
|
545
|
+
883997877,
|
|
546
|
+
958139571,
|
|
547
|
+
1322822218,
|
|
548
|
+
1537002063,
|
|
549
|
+
1747873779,
|
|
550
|
+
1955562222,
|
|
551
|
+
2024104815,
|
|
552
|
+
2227730452,
|
|
553
|
+
2361852424,
|
|
554
|
+
2428436474,
|
|
555
|
+
2756734187,
|
|
556
|
+
3204031479,
|
|
557
|
+
3329325298
|
|
558
|
+
]);
|
|
559
|
+
function je() {
|
|
560
|
+
return ue(le);
|
|
561
|
+
}
|
|
562
|
+
function Ne() {
|
|
563
|
+
return Ie(ue(le));
|
|
564
|
+
}
|
|
565
|
+
function K(t) {
|
|
566
|
+
return encodeURIComponent(t).replace(/\*/g, "%2A");
|
|
567
|
+
}
|
|
568
|
+
function he(t) {
|
|
569
|
+
return t.split("/").map(K).join("/");
|
|
570
|
+
}
|
|
571
|
+
function de(t) {
|
|
572
|
+
let s = "";
|
|
573
|
+
for (let e = 0; e < t.length; e++)
|
|
574
|
+
s += t[e].toString(16).padStart(2, "0");
|
|
575
|
+
return s;
|
|
576
|
+
}
|
|
577
|
+
function We(t) {
|
|
578
|
+
return de(new Uint8Array(je().digest(I(t))));
|
|
579
|
+
}
|
|
580
|
+
function q(t, s) {
|
|
581
|
+
const e = Ne();
|
|
582
|
+
return e.setKey(t instanceof Uint8Array ? t : I(t)), e.update(I(s)), de(new Uint8Array(e.finalize()));
|
|
583
|
+
}
|
|
584
|
+
function D(t) {
|
|
585
|
+
const s = new Uint8Array(t.length / 2);
|
|
586
|
+
for (let e = 0; e < s.length; e++)
|
|
587
|
+
s[e] = parseInt(t.substr(e * 2, 2), 16);
|
|
588
|
+
return s;
|
|
589
|
+
}
|
|
590
|
+
const Ge = [
|
|
591
|
+
"authorization",
|
|
592
|
+
"content-type",
|
|
593
|
+
"content-length",
|
|
594
|
+
"user-agent",
|
|
595
|
+
"presigned-expires",
|
|
596
|
+
"expect",
|
|
597
|
+
"x-amzn-trace-id"
|
|
598
|
+
];
|
|
599
|
+
function pe(t) {
|
|
600
|
+
return Object.keys(t).sort().map((s) => {
|
|
601
|
+
const e = t[s], o = K(s);
|
|
602
|
+
return e == null ? `${o}=` : Array.isArray(e) ? `${o}=${e.map((a) => K(String(a))).sort().join(`&${o}=`)}` : `${o}=${K(String(e))}`;
|
|
603
|
+
}).join("&");
|
|
604
|
+
}
|
|
605
|
+
function ge(t) {
|
|
606
|
+
const { method: s, pathname: e, headers: o, accessKeyId: a, secretAccessKey: l, region: h } = t;
|
|
607
|
+
if (!a) throw new Error("need accessKeyId");
|
|
608
|
+
if (!l) throw new Error("need accessKeySecret");
|
|
609
|
+
const i = t.service || "s3", p = t.date || V(/* @__PURE__ */ new Date()), r = p.substr(0, 8), n = `${r}/${h}/${i}/aws4_request`, u = t.payloadHash || "UNSIGNED-PAYLOAD", c = [], f = [];
|
|
610
|
+
Object.keys(o).sort((T, B) => T.toLowerCase() < B.toLowerCase() ? -1 : 1).forEach((T) => {
|
|
611
|
+
const B = T.toLowerCase();
|
|
612
|
+
(B.indexOf("x-amz-") === 0 || Ge.indexOf(B) < 0) && (f.push(B), c.push(`${B}:${String(o[T]).replace(/\s+/g, " ").trim()}`));
|
|
613
|
+
});
|
|
614
|
+
const d = f.join(";"), g = [
|
|
615
|
+
s,
|
|
616
|
+
e,
|
|
617
|
+
pe(t.query || {}),
|
|
618
|
+
`${c.join(`
|
|
619
|
+
`)}
|
|
620
|
+
`,
|
|
621
|
+
d,
|
|
622
|
+
u
|
|
623
|
+
].join(`
|
|
624
|
+
`), y = [
|
|
625
|
+
"AWS4-HMAC-SHA256",
|
|
626
|
+
p,
|
|
627
|
+
n,
|
|
628
|
+
We(g)
|
|
629
|
+
].join(`
|
|
630
|
+
`), m = q(`AWS4${l}`, r), A = q(D(m), h), w = q(D(A), i), v = q(D(w), "aws4_request"), x = q(D(v), y);
|
|
631
|
+
return { amzDate: p, credentialScope: n, signedHeaders: d, signature: x };
|
|
632
|
+
}
|
|
633
|
+
function V(t) {
|
|
634
|
+
return t.toISOString().replace(/[:-]|\.\d{3}/g, "");
|
|
635
|
+
}
|
|
636
|
+
function ye(t) {
|
|
637
|
+
const { bucket: s, region: e, endpoint: o, pathStyle: a } = t;
|
|
638
|
+
if (o) return o;
|
|
639
|
+
const l = e === "us-east-1" ? "s3.amazonaws.com" : `s3.${e}.amazonaws.com`;
|
|
640
|
+
return a ? l : `${s}.${l}`;
|
|
641
|
+
}
|
|
642
|
+
const Ve = {
|
|
643
|
+
region: "us-east-1",
|
|
644
|
+
secure: !1,
|
|
645
|
+
timeout: 6e4
|
|
646
|
+
};
|
|
647
|
+
function Xe(t, s) {
|
|
648
|
+
const e = fe(t, Ve), { accessKeyId: o, accessKeySecret: a, stsToken: l, bucket: h, secure: i, region: p, pathStyle: r } = e, n = ye(e), u = C({
|
|
649
|
+
host: n,
|
|
650
|
+
"x-amz-date": V(/* @__PURE__ */ new Date()),
|
|
651
|
+
"x-amz-content-sha256": "UNSIGNED-PAYLOAD"
|
|
652
|
+
}, s.headers);
|
|
653
|
+
l && (u["x-amz-security-token"] = l);
|
|
654
|
+
const c = `/${he(s.objectName)}`, f = r && h ? `/${h}${c}` : c, { signature: d, credentialScope: g, signedHeaders: y } = ge({
|
|
655
|
+
method: s.verb,
|
|
656
|
+
pathname: f,
|
|
657
|
+
query: s.subResource,
|
|
658
|
+
headers: u,
|
|
659
|
+
accessKeyId: o,
|
|
660
|
+
secretAccessKey: a,
|
|
661
|
+
region: p
|
|
662
|
+
});
|
|
663
|
+
u.Authorization = `AWS4-HMAC-SHA256 Credential=${o}/${g}, SignedHeaders=${y}, Signature=${d}`;
|
|
664
|
+
let A = `${i ? "https" : "http"}://${n}${f}`;
|
|
665
|
+
if (s.subResource) {
|
|
666
|
+
const w = Object.keys(s.subResource).map((v) => {
|
|
667
|
+
const x = s.subResource[v];
|
|
668
|
+
return x === "" || x == null ? v : `${v}=${encodeURIComponent(x)}`;
|
|
669
|
+
}).join("&");
|
|
670
|
+
w && (A += `?${w}`);
|
|
671
|
+
}
|
|
672
|
+
return Ue()(A, {
|
|
673
|
+
method: s.verb,
|
|
674
|
+
headers: u,
|
|
675
|
+
data: s.data,
|
|
676
|
+
timeout: s.timeout == null ? Ke(e) : s.timeout,
|
|
677
|
+
onprogress: s.onprogress,
|
|
678
|
+
total: Oe(s.data)
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
const Je = {
|
|
682
|
+
region: "us-east-1",
|
|
683
|
+
secure: !1,
|
|
684
|
+
timeout: 6e4
|
|
685
|
+
};
|
|
686
|
+
function Qe(t, s, e = {}) {
|
|
687
|
+
const { expires: o = 1800, method: a, response: l } = e, h = fe(t, Je), { accessKeyId: i, accessKeySecret: p, stsToken: r, bucket: n, secure: u, region: c, pathStyle: f } = h, d = {};
|
|
688
|
+
l && Object.keys(l).forEach((E) => {
|
|
689
|
+
const U = `response-${E.toLowerCase()}`;
|
|
690
|
+
d[U] = l[E];
|
|
691
|
+
}), Object.keys(e).forEach((E) => {
|
|
692
|
+
const U = E.toLowerCase(), P = e[E];
|
|
693
|
+
U.indexOf("x-amz-") === 0 ? d[U] = P : U === "content-md5" ? d["Content-MD5"] = P : U !== "expires" && U !== "response" && U !== "process" && U !== "method" && (d[U] = P);
|
|
694
|
+
});
|
|
695
|
+
const g = e["security-token"] || r, y = ye(h), m = `/${he(s)}`, A = f && n ? `/${n}${m}` : m, w = V(/* @__PURE__ */ new Date()), v = {
|
|
696
|
+
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
|
|
697
|
+
"X-Amz-Credential": `${i}/${w.substr(0, 8)}/${c}/s3/aws4_request`,
|
|
698
|
+
"X-Amz-Date": w,
|
|
699
|
+
"X-Amz-Expires": String(o),
|
|
700
|
+
"X-Amz-SignedHeaders": "host"
|
|
701
|
+
};
|
|
702
|
+
g && (v["X-Amz-Security-Token"] = g), Object.keys(d).forEach((E) => {
|
|
703
|
+
v[E] = d[E];
|
|
704
|
+
});
|
|
705
|
+
const { signature: x } = ge({
|
|
706
|
+
method: a || "GET",
|
|
707
|
+
pathname: A,
|
|
708
|
+
query: v,
|
|
709
|
+
headers: { host: y },
|
|
710
|
+
accessKeyId: i,
|
|
711
|
+
secretAccessKey: p,
|
|
712
|
+
region: c,
|
|
713
|
+
date: w
|
|
714
|
+
}), T = u ? "https" : "http", B = pe(Q(C({}, v), { "X-Amz-Signature": x }));
|
|
715
|
+
return `${T}://${y}${A}?${B}`;
|
|
716
|
+
}
|
|
717
|
+
function Ye(t) {
|
|
718
|
+
return function(e, o, a, l = {}) {
|
|
719
|
+
return ce(a).then((h) => {
|
|
720
|
+
const i = G(h), p = typeof a == "string" ? "text/plain; charset=utf-8" : a instanceof Blob ? a.type : "application/octet-stream", r = {
|
|
721
|
+
"Content-Md5": i,
|
|
722
|
+
"Content-Type": p
|
|
723
|
+
};
|
|
724
|
+
return t.request(e, {
|
|
725
|
+
verb: "PUT",
|
|
726
|
+
objectName: o,
|
|
727
|
+
contentMd5: i,
|
|
728
|
+
headers: r,
|
|
729
|
+
// Strings are already encoded to bytes for the MD5; send those
|
|
730
|
+
// bytes to avoid encoding twice and to give the transport a size.
|
|
731
|
+
data: typeof a == "string" ? h : a,
|
|
732
|
+
onprogress: l.onprogress
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function b(t, s) {
|
|
738
|
+
const e = new RegExp(`<${s}>([\\s\\S]*?)</${s}>`).exec(t);
|
|
739
|
+
return e ? e[1] : "";
|
|
740
|
+
}
|
|
741
|
+
function me(t, s) {
|
|
742
|
+
const e = new RegExp(`<${s}>[\\s\\S]*?</${s}>`, "g"), o = [];
|
|
743
|
+
let a;
|
|
744
|
+
for (; (a = e.exec(t)) !== null; )
|
|
745
|
+
o.push(a[0]);
|
|
746
|
+
return o;
|
|
747
|
+
}
|
|
748
|
+
function Ze(t) {
|
|
749
|
+
return function(e, o, a = {}) {
|
|
750
|
+
const l = C({}, a.headers);
|
|
751
|
+
return t.request(e, {
|
|
752
|
+
verb: "POST",
|
|
753
|
+
objectName: o,
|
|
754
|
+
headers: l,
|
|
755
|
+
subResource: { uploads: "" },
|
|
756
|
+
timeout: a.timeout
|
|
757
|
+
}).then((h) => {
|
|
758
|
+
const i = b(h.data, "UploadId");
|
|
759
|
+
return {
|
|
760
|
+
name: o,
|
|
761
|
+
uploadId: i,
|
|
762
|
+
res: h.data
|
|
763
|
+
};
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
function et(t) {
|
|
768
|
+
return function(n, u, c, f, d, g, y) {
|
|
769
|
+
return z(this, arguments, function* (e, o, a, l, h, i, p, r = {}) {
|
|
770
|
+
const m = ArrayBuffer.isView(h) && !(h instanceof DataView) ? h.subarray(i, p) : h.slice(i, p), A = yield ce(m), w = G(A), v = m instanceof Blob && m.type || "application/octet-stream", x = C({
|
|
771
|
+
"Content-Md5": w,
|
|
772
|
+
"Content-Type": v
|
|
773
|
+
}, r.headers);
|
|
774
|
+
return t.request(e, {
|
|
775
|
+
verb: "PUT",
|
|
776
|
+
objectName: o,
|
|
777
|
+
contentMd5: w,
|
|
778
|
+
headers: x,
|
|
779
|
+
subResource: { uploadId: a, partNumber: l.toString() },
|
|
780
|
+
data: m,
|
|
781
|
+
timeout: r.timeout
|
|
782
|
+
}).then((T) => ({
|
|
783
|
+
name: o,
|
|
784
|
+
etag: T.headers.etag || "",
|
|
785
|
+
res: T.data
|
|
786
|
+
}));
|
|
787
|
+
});
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
function tt(t) {
|
|
791
|
+
return function(i, p, r, n) {
|
|
792
|
+
return z(this, arguments, function* (e, o, a, l, h = {}) {
|
|
793
|
+
const c = `<?xml version="1.0" encoding="UTF-8"?>
|
|
794
|
+
<CompleteMultipartUpload>
|
|
795
|
+
${l.sort((y, m) => y.number - m.number).map((y) => ` <Part><PartNumber>${y.number}</PartNumber><ETag>${y.etag}</ETag></Part>`).join(`
|
|
796
|
+
`)}
|
|
797
|
+
</CompleteMultipartUpload>`, f = I(c), d = G(f), g = C({
|
|
798
|
+
"Content-Md5": d,
|
|
799
|
+
"Content-Type": "application/xml"
|
|
800
|
+
}, h.headers);
|
|
801
|
+
return t.request(e, {
|
|
802
|
+
verb: "POST",
|
|
803
|
+
objectName: o,
|
|
804
|
+
contentMd5: d,
|
|
805
|
+
headers: g,
|
|
806
|
+
subResource: { uploadId: a },
|
|
807
|
+
data: f,
|
|
808
|
+
timeout: h.timeout
|
|
809
|
+
}).then((y) => {
|
|
810
|
+
const m = b(y.data, "ETag");
|
|
811
|
+
return {
|
|
812
|
+
name: o,
|
|
813
|
+
etag: m,
|
|
814
|
+
bucket: e.bucket,
|
|
815
|
+
res: y.data
|
|
816
|
+
};
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
function rt(t) {
|
|
822
|
+
return function(e, o, a, l = {}) {
|
|
823
|
+
return t.request(e, {
|
|
824
|
+
verb: "DELETE",
|
|
825
|
+
objectName: o,
|
|
826
|
+
headers: C({}, l.headers),
|
|
827
|
+
subResource: { uploadId: a },
|
|
828
|
+
timeout: l.timeout
|
|
829
|
+
}).then(() => {
|
|
830
|
+
});
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
function nt(t) {
|
|
834
|
+
return function(e, o, a, l = {}, h = {}) {
|
|
835
|
+
const i = { uploadId: a };
|
|
836
|
+
return l["max-parts"] && (i["max-parts"] = l["max-parts"].toString()), l["part-number-marker"] && (i["part-number-marker"] = l["part-number-marker"].toString()), t.request(e, {
|
|
837
|
+
verb: "GET",
|
|
838
|
+
objectName: o,
|
|
839
|
+
headers: C({}, h.headers),
|
|
840
|
+
subResource: i,
|
|
841
|
+
timeout: h.timeout
|
|
842
|
+
}).then((p) => {
|
|
843
|
+
const r = p.data, n = b(r, "IsTruncated") === "true", u = parseInt(b(r, "NextPartNumberMarker") || "0", 10), c = me(r, "Part").map((f) => ({
|
|
844
|
+
PartNumber: parseInt(b(f, "PartNumber") || "0", 10),
|
|
845
|
+
LastModified: b(f, "LastModified"),
|
|
846
|
+
ETag: b(f, "ETag"),
|
|
847
|
+
Size: parseInt(b(f, "Size") || "0", 10)
|
|
848
|
+
}));
|
|
849
|
+
return {
|
|
850
|
+
isTruncated: n,
|
|
851
|
+
nextPartNumberMarker: u,
|
|
852
|
+
parts: c,
|
|
853
|
+
res: p.data
|
|
854
|
+
};
|
|
855
|
+
});
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
function ot(t) {
|
|
859
|
+
return function(e, o = {}, a = {}) {
|
|
860
|
+
const l = { uploads: "" };
|
|
861
|
+
return o.prefix && (l.prefix = o.prefix), o.marker && (l[t.listUploadsMarkerKey] = o.marker), o["max-uploads"] && (l["max-uploads"] = o["max-uploads"].toString()), o["upload-id-marker"] && (l["upload-id-marker"] = o["upload-id-marker"]), t.request(e, {
|
|
862
|
+
verb: "GET",
|
|
863
|
+
objectName: "",
|
|
864
|
+
headers: C({}, a.headers),
|
|
865
|
+
subResource: l,
|
|
866
|
+
timeout: a.timeout
|
|
867
|
+
}).then((h) => {
|
|
868
|
+
const i = h.data, p = b(i, "IsTruncated") === "true", r = b(i, "NextKeyMarker") || void 0, n = b(i, "NextUploadIdMarker") || void 0;
|
|
869
|
+
return {
|
|
870
|
+
uploads: me(i, "Upload").map((c) => ({
|
|
871
|
+
uploadId: b(c, "UploadId"),
|
|
872
|
+
name: b(c, "Key"),
|
|
873
|
+
initiated: b(c, "Initiated")
|
|
874
|
+
})),
|
|
875
|
+
isTruncated: p,
|
|
876
|
+
nextKeyMarker: r,
|
|
877
|
+
nextUploadIdMarker: n,
|
|
878
|
+
res: h.data
|
|
879
|
+
};
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function st(t) {
|
|
884
|
+
return function(e, o, a, l, h, i, p = {}) {
|
|
885
|
+
const r = e.bucket, u = `/${i.sourceBucket || r}/${encodeURIComponent(i.sourceKey)}`, c = C({
|
|
886
|
+
[t.copySourceHeader]: u,
|
|
887
|
+
[t.copySourceRangeHeader]: h
|
|
888
|
+
}, p.headers);
|
|
889
|
+
return t.request(e, {
|
|
890
|
+
verb: "PUT",
|
|
891
|
+
objectName: o,
|
|
892
|
+
headers: c,
|
|
893
|
+
subResource: { uploadId: a, partNumber: l.toString() },
|
|
894
|
+
timeout: p.timeout
|
|
895
|
+
}).then((f) => {
|
|
896
|
+
const d = b(f.data, "ETag"), g = b(f.data, "LastModified");
|
|
897
|
+
return {
|
|
898
|
+
etag: d,
|
|
899
|
+
lastModified: g,
|
|
900
|
+
res: f.data
|
|
901
|
+
};
|
|
902
|
+
});
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function se(t) {
|
|
906
|
+
return typeof t == "string" ? I(t).length : t instanceof Blob ? t.size : t.byteLength;
|
|
907
|
+
}
|
|
908
|
+
function at(t, s) {
|
|
909
|
+
return function(i, p, r) {
|
|
910
|
+
return z(this, arguments, function* (o, a, l, h = {}) {
|
|
911
|
+
const {
|
|
912
|
+
parallel: n = 5,
|
|
913
|
+
partSize: u = 1024 * 1024,
|
|
914
|
+
// default 1MB
|
|
915
|
+
checkpoint: c,
|
|
916
|
+
progress: f,
|
|
917
|
+
meta: d,
|
|
918
|
+
mime: g,
|
|
919
|
+
headers: y = {}
|
|
920
|
+
} = h;
|
|
921
|
+
let m, A = [], w = Math.max(u, 100 * 1024);
|
|
922
|
+
const v = se(l);
|
|
923
|
+
if (v === 0)
|
|
924
|
+
throw new Error("multipart upload requires a non-empty file");
|
|
925
|
+
if (c && c.uploadId && se(c.file) === v)
|
|
926
|
+
m = c.uploadId, A = c.doneParts || [], c.partSize && (w = c.partSize);
|
|
927
|
+
else {
|
|
928
|
+
const S = C({}, y);
|
|
929
|
+
g && (S["Content-Type"] = g), d && Object.keys(d).forEach((L) => {
|
|
930
|
+
S[`${t.metaPrefix}${L}`] = d[L];
|
|
931
|
+
}), m = (yield s.initMultipartUpload(o, a, { headers: S })).uploadId;
|
|
932
|
+
}
|
|
933
|
+
const x = Math.ceil(v / w), T = {
|
|
934
|
+
file: l,
|
|
935
|
+
name: a,
|
|
936
|
+
uploadId: m,
|
|
937
|
+
partSize: w,
|
|
938
|
+
parts: [],
|
|
939
|
+
doneParts: [...A]
|
|
940
|
+
};
|
|
941
|
+
for (let S = 1; S <= x; S++)
|
|
942
|
+
A.some((L) => L.number === S) || T.parts.push({ number: S, etag: "" });
|
|
943
|
+
const B = (S, $, L) => z(null, null, function* () {
|
|
944
|
+
const F = () => z(null, null, function* () {
|
|
945
|
+
const R = yield s.uploadPart(o, a, m, S, l, $, L);
|
|
946
|
+
if (!R.etag)
|
|
947
|
+
throw new Error("cannot read the ETag of the uploaded part; make sure the bucket CORS rule exposes the ETag response header");
|
|
948
|
+
return R;
|
|
949
|
+
});
|
|
950
|
+
let M;
|
|
951
|
+
try {
|
|
952
|
+
M = yield F();
|
|
953
|
+
} catch (R) {
|
|
954
|
+
M = yield F();
|
|
955
|
+
}
|
|
956
|
+
if (T.doneParts.push({ number: S, etag: M.etag }), f) {
|
|
957
|
+
const R = T.doneParts.length / x;
|
|
958
|
+
f(R, T, M);
|
|
959
|
+
}
|
|
960
|
+
return { number: S, etag: M.etag };
|
|
961
|
+
}), E = T.parts.filter((S) => !A.some(($) => $.number === S.number)), U = [], P = [];
|
|
962
|
+
for (const S of E) {
|
|
963
|
+
const $ = (S.number - 1) * w, L = Math.min(S.number * w, v), F = B(S.number, $, L);
|
|
964
|
+
U.push(F), P.push(F), F.finally(() => {
|
|
965
|
+
const M = P.indexOf(F);
|
|
966
|
+
M > -1 && P.splice(M, 1);
|
|
967
|
+
}), P.length >= n && (yield Promise.race(P));
|
|
968
|
+
}
|
|
969
|
+
yield Promise.all(U);
|
|
970
|
+
const Ae = [...A, ...T.doneParts].filter((S, $, L) => L.findIndex((F) => F.number === S.number) === $);
|
|
971
|
+
return s.completeMultipartUpload(o, a, m, Ae);
|
|
972
|
+
});
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
function ht(t, s) {
|
|
976
|
+
const { method: e, headers: o, data: a, timeout: l, onprogress: h, total: i } = s, p = new AbortController();
|
|
977
|
+
let r;
|
|
978
|
+
return l && (r = setTimeout(() => p.abort(), l)), h && i && h({ loaded: 0, total: i, lengthComputable: !1 }), fetch(t, {
|
|
979
|
+
method: e,
|
|
980
|
+
headers: o,
|
|
981
|
+
body: a,
|
|
982
|
+
signal: p.signal
|
|
983
|
+
}).then((n) => z(null, null, function* () {
|
|
984
|
+
const u = yield n.text();
|
|
985
|
+
if (n.status < 200 || n.status >= 300)
|
|
986
|
+
throw new Error(`the request is error: ${n.status} ${n.statusText} ${u}`);
|
|
987
|
+
h && i && h({ loaded: i, total: i, lengthComputable: !1 });
|
|
988
|
+
const c = {};
|
|
989
|
+
return n.headers.forEach((f, d) => {
|
|
990
|
+
c[d] = f;
|
|
991
|
+
}), {
|
|
992
|
+
data: u,
|
|
993
|
+
headers: c,
|
|
994
|
+
status: n.status,
|
|
995
|
+
statusText: n.statusText
|
|
996
|
+
};
|
|
997
|
+
})).finally(() => {
|
|
998
|
+
r && clearTimeout(r);
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
function dt(t, s) {
|
|
1002
|
+
const { method: e, headers: o, data: a, timeout: l, onprogress: h, total: i } = s;
|
|
1003
|
+
return typeof wx == "undefined" ? Promise.reject(new Error("wxRequestTransport requires the WeChat mini program runtime")) : (h && i && h({ loaded: 0, total: i, lengthComputable: !1 }), new Promise((p, r) => {
|
|
1004
|
+
wx.request({
|
|
1005
|
+
url: t,
|
|
1006
|
+
method: e,
|
|
1007
|
+
header: o,
|
|
1008
|
+
data: a instanceof Uint8Array ? a.buffer : a,
|
|
1009
|
+
timeout: l,
|
|
1010
|
+
success: (n) => {
|
|
1011
|
+
h && i && h({ loaded: i, total: i, lengthComputable: !1 }), p({ data: n.data, headers: n.header, status: n.statusCode, statusText: "" });
|
|
1012
|
+
},
|
|
1013
|
+
fail: (n) => {
|
|
1014
|
+
r(n instanceof Error ? n : new Error(String(n)));
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
}));
|
|
1018
|
+
}
|
|
1019
|
+
function pt(t, s) {
|
|
1020
|
+
return (...e) => t(s, ...e);
|
|
1021
|
+
}
|
|
1022
|
+
const k = {
|
|
1023
|
+
request: Xe,
|
|
1024
|
+
metaPrefix: "x-amz-meta-",
|
|
1025
|
+
copySourceHeader: "x-amz-copy-source",
|
|
1026
|
+
copySourceRangeHeader: "x-amz-copy-source-range",
|
|
1027
|
+
listUploadsMarkerKey: "key-marker",
|
|
1028
|
+
supportsSymlink: !1,
|
|
1029
|
+
signUrl: Qe
|
|
1030
|
+
}, gt = Ye(k), it = Ze(k), ut = et(k), ct = tt(k), yt = at(k, {
|
|
1031
|
+
initMultipartUpload: it,
|
|
1032
|
+
uploadPart: ut,
|
|
1033
|
+
completeMultipartUpload: ct
|
|
1034
|
+
}), mt = rt(k), At = nt(k), wt = ot(k), xt = st(k), vt = k.signUrl;
|
|
1035
|
+
export {
|
|
1036
|
+
mt as abortMultipartUpload,
|
|
1037
|
+
pt as bindOptions,
|
|
1038
|
+
ct as completeMultipartUpload,
|
|
1039
|
+
ht as fetchTransport,
|
|
1040
|
+
Ue as getTransport,
|
|
1041
|
+
it as initMultipartUpload,
|
|
1042
|
+
At as listParts,
|
|
1043
|
+
wt as listUploads,
|
|
1044
|
+
yt as multipartUpload,
|
|
1045
|
+
gt as put,
|
|
1046
|
+
lt as setTransport,
|
|
1047
|
+
vt as signatureUrl,
|
|
1048
|
+
ut as uploadPart,
|
|
1049
|
+
xt as uploadPartCopy,
|
|
1050
|
+
dt as wxRequestTransport
|
|
1051
|
+
};
|
|
1052
|
+
//# sourceMappingURL=tiny-oss.aws.es.js.map
|