@kevisual/api 0.0.42 → 0.0.44

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.
@@ -0,0 +1,1734 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
+
21
+ // node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js
22
+ var require_core = __commonJS((exports, module) => {
23
+ (function(root, factory) {
24
+ if (typeof exports === "object") {
25
+ module.exports = exports = factory();
26
+ } else if (typeof define === "function" && define.amd) {
27
+ define([], factory);
28
+ } else {
29
+ root.CryptoJS = factory();
30
+ }
31
+ })(exports, function() {
32
+ var CryptoJS = CryptoJS || function(Math2, undefined2) {
33
+ var crypto;
34
+ if (typeof window !== "undefined" && window.crypto) {
35
+ crypto = window.crypto;
36
+ }
37
+ if (typeof self !== "undefined" && self.crypto) {
38
+ crypto = self.crypto;
39
+ }
40
+ if (typeof globalThis !== "undefined" && globalThis.crypto) {
41
+ crypto = globalThis.crypto;
42
+ }
43
+ if (!crypto && typeof window !== "undefined" && window.msCrypto) {
44
+ crypto = window.msCrypto;
45
+ }
46
+ if (!crypto && typeof global !== "undefined" && global.crypto) {
47
+ crypto = global.crypto;
48
+ }
49
+ if (!crypto && true) {
50
+ try {
51
+ crypto = __require("crypto");
52
+ } catch (err) {}
53
+ }
54
+ var cryptoSecureRandomInt = function() {
55
+ if (crypto) {
56
+ if (typeof crypto.getRandomValues === "function") {
57
+ try {
58
+ return crypto.getRandomValues(new Uint32Array(1))[0];
59
+ } catch (err) {}
60
+ }
61
+ if (typeof crypto.randomBytes === "function") {
62
+ try {
63
+ return crypto.randomBytes(4).readInt32LE();
64
+ } catch (err) {}
65
+ }
66
+ }
67
+ throw new Error("Native crypto module could not be used to get secure random number.");
68
+ };
69
+ var create = Object.create || function() {
70
+ function F() {}
71
+ return function(obj) {
72
+ var subtype;
73
+ F.prototype = obj;
74
+ subtype = new F;
75
+ F.prototype = null;
76
+ return subtype;
77
+ };
78
+ }();
79
+ var C = {};
80
+ var C_lib = C.lib = {};
81
+ var Base = C_lib.Base = function() {
82
+ return {
83
+ extend: function(overrides) {
84
+ var subtype = create(this);
85
+ if (overrides) {
86
+ subtype.mixIn(overrides);
87
+ }
88
+ if (!subtype.hasOwnProperty("init") || this.init === subtype.init) {
89
+ subtype.init = function() {
90
+ subtype.$super.init.apply(this, arguments);
91
+ };
92
+ }
93
+ subtype.init.prototype = subtype;
94
+ subtype.$super = this;
95
+ return subtype;
96
+ },
97
+ create: function() {
98
+ var instance = this.extend();
99
+ instance.init.apply(instance, arguments);
100
+ return instance;
101
+ },
102
+ init: function() {},
103
+ mixIn: function(properties) {
104
+ for (var propertyName in properties) {
105
+ if (properties.hasOwnProperty(propertyName)) {
106
+ this[propertyName] = properties[propertyName];
107
+ }
108
+ }
109
+ if (properties.hasOwnProperty("toString")) {
110
+ this.toString = properties.toString;
111
+ }
112
+ },
113
+ clone: function() {
114
+ return this.init.prototype.extend(this);
115
+ }
116
+ };
117
+ }();
118
+ var WordArray = C_lib.WordArray = Base.extend({
119
+ init: function(words, sigBytes) {
120
+ words = this.words = words || [];
121
+ if (sigBytes != undefined2) {
122
+ this.sigBytes = sigBytes;
123
+ } else {
124
+ this.sigBytes = words.length * 4;
125
+ }
126
+ },
127
+ toString: function(encoder) {
128
+ return (encoder || Hex).stringify(this);
129
+ },
130
+ concat: function(wordArray) {
131
+ var thisWords = this.words;
132
+ var thatWords = wordArray.words;
133
+ var thisSigBytes = this.sigBytes;
134
+ var thatSigBytes = wordArray.sigBytes;
135
+ this.clamp();
136
+ if (thisSigBytes % 4) {
137
+ for (var i = 0;i < thatSigBytes; i++) {
138
+ var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 255;
139
+ thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
140
+ }
141
+ } else {
142
+ for (var j = 0;j < thatSigBytes; j += 4) {
143
+ thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2];
144
+ }
145
+ }
146
+ this.sigBytes += thatSigBytes;
147
+ return this;
148
+ },
149
+ clamp: function() {
150
+ var words = this.words;
151
+ var sigBytes = this.sigBytes;
152
+ words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
153
+ words.length = Math2.ceil(sigBytes / 4);
154
+ },
155
+ clone: function() {
156
+ var clone = Base.clone.call(this);
157
+ clone.words = this.words.slice(0);
158
+ return clone;
159
+ },
160
+ random: function(nBytes) {
161
+ var words = [];
162
+ for (var i = 0;i < nBytes; i += 4) {
163
+ words.push(cryptoSecureRandomInt());
164
+ }
165
+ return new WordArray.init(words, nBytes);
166
+ }
167
+ });
168
+ var C_enc = C.enc = {};
169
+ var Hex = C_enc.Hex = {
170
+ stringify: function(wordArray) {
171
+ var words = wordArray.words;
172
+ var sigBytes = wordArray.sigBytes;
173
+ var hexChars = [];
174
+ for (var i = 0;i < sigBytes; i++) {
175
+ var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
176
+ hexChars.push((bite >>> 4).toString(16));
177
+ hexChars.push((bite & 15).toString(16));
178
+ }
179
+ return hexChars.join("");
180
+ },
181
+ parse: function(hexStr) {
182
+ var hexStrLength = hexStr.length;
183
+ var words = [];
184
+ for (var i = 0;i < hexStrLength; i += 2) {
185
+ words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
186
+ }
187
+ return new WordArray.init(words, hexStrLength / 2);
188
+ }
189
+ };
190
+ var Latin1 = C_enc.Latin1 = {
191
+ stringify: function(wordArray) {
192
+ var words = wordArray.words;
193
+ var sigBytes = wordArray.sigBytes;
194
+ var latin1Chars = [];
195
+ for (var i = 0;i < sigBytes; i++) {
196
+ var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
197
+ latin1Chars.push(String.fromCharCode(bite));
198
+ }
199
+ return latin1Chars.join("");
200
+ },
201
+ parse: function(latin1Str) {
202
+ var latin1StrLength = latin1Str.length;
203
+ var words = [];
204
+ for (var i = 0;i < latin1StrLength; i++) {
205
+ words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
206
+ }
207
+ return new WordArray.init(words, latin1StrLength);
208
+ }
209
+ };
210
+ var Utf8 = C_enc.Utf8 = {
211
+ stringify: function(wordArray) {
212
+ try {
213
+ return decodeURIComponent(escape(Latin1.stringify(wordArray)));
214
+ } catch (e) {
215
+ throw new Error("Malformed UTF-8 data");
216
+ }
217
+ },
218
+ parse: function(utf8Str) {
219
+ return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
220
+ }
221
+ };
222
+ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
223
+ reset: function() {
224
+ this._data = new WordArray.init;
225
+ this._nDataBytes = 0;
226
+ },
227
+ _append: function(data) {
228
+ if (typeof data == "string") {
229
+ data = Utf8.parse(data);
230
+ }
231
+ this._data.concat(data);
232
+ this._nDataBytes += data.sigBytes;
233
+ },
234
+ _process: function(doFlush) {
235
+ var processedWords;
236
+ var data = this._data;
237
+ var dataWords = data.words;
238
+ var dataSigBytes = data.sigBytes;
239
+ var blockSize = this.blockSize;
240
+ var blockSizeBytes = blockSize * 4;
241
+ var nBlocksReady = dataSigBytes / blockSizeBytes;
242
+ if (doFlush) {
243
+ nBlocksReady = Math2.ceil(nBlocksReady);
244
+ } else {
245
+ nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0);
246
+ }
247
+ var nWordsReady = nBlocksReady * blockSize;
248
+ var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes);
249
+ if (nWordsReady) {
250
+ for (var offset = 0;offset < nWordsReady; offset += blockSize) {
251
+ this._doProcessBlock(dataWords, offset);
252
+ }
253
+ processedWords = dataWords.splice(0, nWordsReady);
254
+ data.sigBytes -= nBytesReady;
255
+ }
256
+ return new WordArray.init(processedWords, nBytesReady);
257
+ },
258
+ clone: function() {
259
+ var clone = Base.clone.call(this);
260
+ clone._data = this._data.clone();
261
+ return clone;
262
+ },
263
+ _minBufferSize: 0
264
+ });
265
+ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
266
+ cfg: Base.extend(),
267
+ init: function(cfg) {
268
+ this.cfg = this.cfg.extend(cfg);
269
+ this.reset();
270
+ },
271
+ reset: function() {
272
+ BufferedBlockAlgorithm.reset.call(this);
273
+ this._doReset();
274
+ },
275
+ update: function(messageUpdate) {
276
+ this._append(messageUpdate);
277
+ this._process();
278
+ return this;
279
+ },
280
+ finalize: function(messageUpdate) {
281
+ if (messageUpdate) {
282
+ this._append(messageUpdate);
283
+ }
284
+ var hash = this._doFinalize();
285
+ return hash;
286
+ },
287
+ blockSize: 512 / 32,
288
+ _createHelper: function(hasher) {
289
+ return function(message, cfg) {
290
+ return new hasher.init(cfg).finalize(message);
291
+ };
292
+ },
293
+ _createHmacHelper: function(hasher) {
294
+ return function(message, key) {
295
+ return new C_algo.HMAC.init(hasher, key).finalize(message);
296
+ };
297
+ }
298
+ });
299
+ var C_algo = C.algo = {};
300
+ return C;
301
+ }(Math);
302
+ return CryptoJS;
303
+ });
304
+ });
305
+
306
+ // node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js
307
+ var require_md5 = __commonJS((exports, module) => {
308
+ (function(root, factory) {
309
+ if (typeof exports === "object") {
310
+ module.exports = exports = factory(require_core());
311
+ } else if (typeof define === "function" && define.amd) {
312
+ define(["./core"], factory);
313
+ } else {
314
+ factory(root.CryptoJS);
315
+ }
316
+ })(exports, function(CryptoJS) {
317
+ (function(Math2) {
318
+ var C = CryptoJS;
319
+ var C_lib = C.lib;
320
+ var WordArray = C_lib.WordArray;
321
+ var Hasher = C_lib.Hasher;
322
+ var C_algo = C.algo;
323
+ var T = [];
324
+ (function() {
325
+ for (var i = 0;i < 64; i++) {
326
+ T[i] = Math2.abs(Math2.sin(i + 1)) * 4294967296 | 0;
327
+ }
328
+ })();
329
+ var MD5 = C_algo.MD5 = Hasher.extend({
330
+ _doReset: function() {
331
+ this._hash = new WordArray.init([
332
+ 1732584193,
333
+ 4023233417,
334
+ 2562383102,
335
+ 271733878
336
+ ]);
337
+ },
338
+ _doProcessBlock: function(M, offset) {
339
+ for (var i = 0;i < 16; i++) {
340
+ var offset_i = offset + i;
341
+ var M_offset_i = M[offset_i];
342
+ M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 16711935 | (M_offset_i << 24 | M_offset_i >>> 8) & 4278255360;
343
+ }
344
+ var H = this._hash.words;
345
+ var M_offset_0 = M[offset + 0];
346
+ var M_offset_1 = M[offset + 1];
347
+ var M_offset_2 = M[offset + 2];
348
+ var M_offset_3 = M[offset + 3];
349
+ var M_offset_4 = M[offset + 4];
350
+ var M_offset_5 = M[offset + 5];
351
+ var M_offset_6 = M[offset + 6];
352
+ var M_offset_7 = M[offset + 7];
353
+ var M_offset_8 = M[offset + 8];
354
+ var M_offset_9 = M[offset + 9];
355
+ var M_offset_10 = M[offset + 10];
356
+ var M_offset_11 = M[offset + 11];
357
+ var M_offset_12 = M[offset + 12];
358
+ var M_offset_13 = M[offset + 13];
359
+ var M_offset_14 = M[offset + 14];
360
+ var M_offset_15 = M[offset + 15];
361
+ var a = H[0];
362
+ var b = H[1];
363
+ var c = H[2];
364
+ var d = H[3];
365
+ a = FF(a, b, c, d, M_offset_0, 7, T[0]);
366
+ d = FF(d, a, b, c, M_offset_1, 12, T[1]);
367
+ c = FF(c, d, a, b, M_offset_2, 17, T[2]);
368
+ b = FF(b, c, d, a, M_offset_3, 22, T[3]);
369
+ a = FF(a, b, c, d, M_offset_4, 7, T[4]);
370
+ d = FF(d, a, b, c, M_offset_5, 12, T[5]);
371
+ c = FF(c, d, a, b, M_offset_6, 17, T[6]);
372
+ b = FF(b, c, d, a, M_offset_7, 22, T[7]);
373
+ a = FF(a, b, c, d, M_offset_8, 7, T[8]);
374
+ d = FF(d, a, b, c, M_offset_9, 12, T[9]);
375
+ c = FF(c, d, a, b, M_offset_10, 17, T[10]);
376
+ b = FF(b, c, d, a, M_offset_11, 22, T[11]);
377
+ a = FF(a, b, c, d, M_offset_12, 7, T[12]);
378
+ d = FF(d, a, b, c, M_offset_13, 12, T[13]);
379
+ c = FF(c, d, a, b, M_offset_14, 17, T[14]);
380
+ b = FF(b, c, d, a, M_offset_15, 22, T[15]);
381
+ a = GG(a, b, c, d, M_offset_1, 5, T[16]);
382
+ d = GG(d, a, b, c, M_offset_6, 9, T[17]);
383
+ c = GG(c, d, a, b, M_offset_11, 14, T[18]);
384
+ b = GG(b, c, d, a, M_offset_0, 20, T[19]);
385
+ a = GG(a, b, c, d, M_offset_5, 5, T[20]);
386
+ d = GG(d, a, b, c, M_offset_10, 9, T[21]);
387
+ c = GG(c, d, a, b, M_offset_15, 14, T[22]);
388
+ b = GG(b, c, d, a, M_offset_4, 20, T[23]);
389
+ a = GG(a, b, c, d, M_offset_9, 5, T[24]);
390
+ d = GG(d, a, b, c, M_offset_14, 9, T[25]);
391
+ c = GG(c, d, a, b, M_offset_3, 14, T[26]);
392
+ b = GG(b, c, d, a, M_offset_8, 20, T[27]);
393
+ a = GG(a, b, c, d, M_offset_13, 5, T[28]);
394
+ d = GG(d, a, b, c, M_offset_2, 9, T[29]);
395
+ c = GG(c, d, a, b, M_offset_7, 14, T[30]);
396
+ b = GG(b, c, d, a, M_offset_12, 20, T[31]);
397
+ a = HH(a, b, c, d, M_offset_5, 4, T[32]);
398
+ d = HH(d, a, b, c, M_offset_8, 11, T[33]);
399
+ c = HH(c, d, a, b, M_offset_11, 16, T[34]);
400
+ b = HH(b, c, d, a, M_offset_14, 23, T[35]);
401
+ a = HH(a, b, c, d, M_offset_1, 4, T[36]);
402
+ d = HH(d, a, b, c, M_offset_4, 11, T[37]);
403
+ c = HH(c, d, a, b, M_offset_7, 16, T[38]);
404
+ b = HH(b, c, d, a, M_offset_10, 23, T[39]);
405
+ a = HH(a, b, c, d, M_offset_13, 4, T[40]);
406
+ d = HH(d, a, b, c, M_offset_0, 11, T[41]);
407
+ c = HH(c, d, a, b, M_offset_3, 16, T[42]);
408
+ b = HH(b, c, d, a, M_offset_6, 23, T[43]);
409
+ a = HH(a, b, c, d, M_offset_9, 4, T[44]);
410
+ d = HH(d, a, b, c, M_offset_12, 11, T[45]);
411
+ c = HH(c, d, a, b, M_offset_15, 16, T[46]);
412
+ b = HH(b, c, d, a, M_offset_2, 23, T[47]);
413
+ a = II(a, b, c, d, M_offset_0, 6, T[48]);
414
+ d = II(d, a, b, c, M_offset_7, 10, T[49]);
415
+ c = II(c, d, a, b, M_offset_14, 15, T[50]);
416
+ b = II(b, c, d, a, M_offset_5, 21, T[51]);
417
+ a = II(a, b, c, d, M_offset_12, 6, T[52]);
418
+ d = II(d, a, b, c, M_offset_3, 10, T[53]);
419
+ c = II(c, d, a, b, M_offset_10, 15, T[54]);
420
+ b = II(b, c, d, a, M_offset_1, 21, T[55]);
421
+ a = II(a, b, c, d, M_offset_8, 6, T[56]);
422
+ d = II(d, a, b, c, M_offset_15, 10, T[57]);
423
+ c = II(c, d, a, b, M_offset_6, 15, T[58]);
424
+ b = II(b, c, d, a, M_offset_13, 21, T[59]);
425
+ a = II(a, b, c, d, M_offset_4, 6, T[60]);
426
+ d = II(d, a, b, c, M_offset_11, 10, T[61]);
427
+ c = II(c, d, a, b, M_offset_2, 15, T[62]);
428
+ b = II(b, c, d, a, M_offset_9, 21, T[63]);
429
+ H[0] = H[0] + a | 0;
430
+ H[1] = H[1] + b | 0;
431
+ H[2] = H[2] + c | 0;
432
+ H[3] = H[3] + d | 0;
433
+ },
434
+ _doFinalize: function() {
435
+ var data = this._data;
436
+ var dataWords = data.words;
437
+ var nBitsTotal = this._nDataBytes * 8;
438
+ var nBitsLeft = data.sigBytes * 8;
439
+ dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
440
+ var nBitsTotalH = Math2.floor(nBitsTotal / 4294967296);
441
+ var nBitsTotalL = nBitsTotal;
442
+ dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 16711935 | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 4278255360;
443
+ dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 16711935 | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 4278255360;
444
+ data.sigBytes = (dataWords.length + 1) * 4;
445
+ this._process();
446
+ var hash = this._hash;
447
+ var H = hash.words;
448
+ for (var i = 0;i < 4; i++) {
449
+ var H_i = H[i];
450
+ H[i] = (H_i << 8 | H_i >>> 24) & 16711935 | (H_i << 24 | H_i >>> 8) & 4278255360;
451
+ }
452
+ return hash;
453
+ },
454
+ clone: function() {
455
+ var clone = Hasher.clone.call(this);
456
+ clone._hash = this._hash.clone();
457
+ return clone;
458
+ }
459
+ });
460
+ function FF(a, b, c, d, x, s, t) {
461
+ var n = a + (b & c | ~b & d) + x + t;
462
+ return (n << s | n >>> 32 - s) + b;
463
+ }
464
+ function GG(a, b, c, d, x, s, t) {
465
+ var n = a + (b & d | c & ~d) + x + t;
466
+ return (n << s | n >>> 32 - s) + b;
467
+ }
468
+ function HH(a, b, c, d, x, s, t) {
469
+ var n = a + (b ^ c ^ d) + x + t;
470
+ return (n << s | n >>> 32 - s) + b;
471
+ }
472
+ function II(a, b, c, d, x, s, t) {
473
+ var n = a + (c ^ (b | ~d)) + x + t;
474
+ return (n << s | n >>> 32 - s) + b;
475
+ }
476
+ C.MD5 = Hasher._createHelper(MD5);
477
+ C.HmacMD5 = Hasher._createHmacHelper(MD5);
478
+ })(Math);
479
+ return CryptoJS.MD5;
480
+ });
481
+ });
482
+
483
+ // node_modules/.pnpm/spark-md5@3.0.2/node_modules/spark-md5/spark-md5.js
484
+ var require_spark_md5 = __commonJS((exports, module) => {
485
+ (function(factory) {
486
+ if (typeof exports === "object") {
487
+ module.exports = factory();
488
+ } else if (typeof define === "function" && define.amd) {
489
+ define(factory);
490
+ } else {
491
+ var glob;
492
+ try {
493
+ glob = window;
494
+ } catch (e) {
495
+ glob = self;
496
+ }
497
+ glob.SparkMD5 = factory();
498
+ }
499
+ })(function(undefined2) {
500
+ var add32 = function(a, b) {
501
+ return a + b & 4294967295;
502
+ }, hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
503
+ function cmn(q, a, b, x, s, t) {
504
+ a = add32(add32(a, q), add32(x, t));
505
+ return add32(a << s | a >>> 32 - s, b);
506
+ }
507
+ function md5cycle(x, k) {
508
+ var a = x[0], b = x[1], c = x[2], d = x[3];
509
+ a += (b & c | ~b & d) + k[0] - 680876936 | 0;
510
+ a = (a << 7 | a >>> 25) + b | 0;
511
+ d += (a & b | ~a & c) + k[1] - 389564586 | 0;
512
+ d = (d << 12 | d >>> 20) + a | 0;
513
+ c += (d & a | ~d & b) + k[2] + 606105819 | 0;
514
+ c = (c << 17 | c >>> 15) + d | 0;
515
+ b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
516
+ b = (b << 22 | b >>> 10) + c | 0;
517
+ a += (b & c | ~b & d) + k[4] - 176418897 | 0;
518
+ a = (a << 7 | a >>> 25) + b | 0;
519
+ d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
520
+ d = (d << 12 | d >>> 20) + a | 0;
521
+ c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
522
+ c = (c << 17 | c >>> 15) + d | 0;
523
+ b += (c & d | ~c & a) + k[7] - 45705983 | 0;
524
+ b = (b << 22 | b >>> 10) + c | 0;
525
+ a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
526
+ a = (a << 7 | a >>> 25) + b | 0;
527
+ d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
528
+ d = (d << 12 | d >>> 20) + a | 0;
529
+ c += (d & a | ~d & b) + k[10] - 42063 | 0;
530
+ c = (c << 17 | c >>> 15) + d | 0;
531
+ b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
532
+ b = (b << 22 | b >>> 10) + c | 0;
533
+ a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
534
+ a = (a << 7 | a >>> 25) + b | 0;
535
+ d += (a & b | ~a & c) + k[13] - 40341101 | 0;
536
+ d = (d << 12 | d >>> 20) + a | 0;
537
+ c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
538
+ c = (c << 17 | c >>> 15) + d | 0;
539
+ b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
540
+ b = (b << 22 | b >>> 10) + c | 0;
541
+ a += (b & d | c & ~d) + k[1] - 165796510 | 0;
542
+ a = (a << 5 | a >>> 27) + b | 0;
543
+ d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
544
+ d = (d << 9 | d >>> 23) + a | 0;
545
+ c += (d & b | a & ~b) + k[11] + 643717713 | 0;
546
+ c = (c << 14 | c >>> 18) + d | 0;
547
+ b += (c & a | d & ~a) + k[0] - 373897302 | 0;
548
+ b = (b << 20 | b >>> 12) + c | 0;
549
+ a += (b & d | c & ~d) + k[5] - 701558691 | 0;
550
+ a = (a << 5 | a >>> 27) + b | 0;
551
+ d += (a & c | b & ~c) + k[10] + 38016083 | 0;
552
+ d = (d << 9 | d >>> 23) + a | 0;
553
+ c += (d & b | a & ~b) + k[15] - 660478335 | 0;
554
+ c = (c << 14 | c >>> 18) + d | 0;
555
+ b += (c & a | d & ~a) + k[4] - 405537848 | 0;
556
+ b = (b << 20 | b >>> 12) + c | 0;
557
+ a += (b & d | c & ~d) + k[9] + 568446438 | 0;
558
+ a = (a << 5 | a >>> 27) + b | 0;
559
+ d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
560
+ d = (d << 9 | d >>> 23) + a | 0;
561
+ c += (d & b | a & ~b) + k[3] - 187363961 | 0;
562
+ c = (c << 14 | c >>> 18) + d | 0;
563
+ b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
564
+ b = (b << 20 | b >>> 12) + c | 0;
565
+ a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
566
+ a = (a << 5 | a >>> 27) + b | 0;
567
+ d += (a & c | b & ~c) + k[2] - 51403784 | 0;
568
+ d = (d << 9 | d >>> 23) + a | 0;
569
+ c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
570
+ c = (c << 14 | c >>> 18) + d | 0;
571
+ b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
572
+ b = (b << 20 | b >>> 12) + c | 0;
573
+ a += (b ^ c ^ d) + k[5] - 378558 | 0;
574
+ a = (a << 4 | a >>> 28) + b | 0;
575
+ d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
576
+ d = (d << 11 | d >>> 21) + a | 0;
577
+ c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
578
+ c = (c << 16 | c >>> 16) + d | 0;
579
+ b += (c ^ d ^ a) + k[14] - 35309556 | 0;
580
+ b = (b << 23 | b >>> 9) + c | 0;
581
+ a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
582
+ a = (a << 4 | a >>> 28) + b | 0;
583
+ d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
584
+ d = (d << 11 | d >>> 21) + a | 0;
585
+ c += (d ^ a ^ b) + k[7] - 155497632 | 0;
586
+ c = (c << 16 | c >>> 16) + d | 0;
587
+ b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
588
+ b = (b << 23 | b >>> 9) + c | 0;
589
+ a += (b ^ c ^ d) + k[13] + 681279174 | 0;
590
+ a = (a << 4 | a >>> 28) + b | 0;
591
+ d += (a ^ b ^ c) + k[0] - 358537222 | 0;
592
+ d = (d << 11 | d >>> 21) + a | 0;
593
+ c += (d ^ a ^ b) + k[3] - 722521979 | 0;
594
+ c = (c << 16 | c >>> 16) + d | 0;
595
+ b += (c ^ d ^ a) + k[6] + 76029189 | 0;
596
+ b = (b << 23 | b >>> 9) + c | 0;
597
+ a += (b ^ c ^ d) + k[9] - 640364487 | 0;
598
+ a = (a << 4 | a >>> 28) + b | 0;
599
+ d += (a ^ b ^ c) + k[12] - 421815835 | 0;
600
+ d = (d << 11 | d >>> 21) + a | 0;
601
+ c += (d ^ a ^ b) + k[15] + 530742520 | 0;
602
+ c = (c << 16 | c >>> 16) + d | 0;
603
+ b += (c ^ d ^ a) + k[2] - 995338651 | 0;
604
+ b = (b << 23 | b >>> 9) + c | 0;
605
+ a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
606
+ a = (a << 6 | a >>> 26) + b | 0;
607
+ d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
608
+ d = (d << 10 | d >>> 22) + a | 0;
609
+ c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
610
+ c = (c << 15 | c >>> 17) + d | 0;
611
+ b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
612
+ b = (b << 21 | b >>> 11) + c | 0;
613
+ a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
614
+ a = (a << 6 | a >>> 26) + b | 0;
615
+ d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
616
+ d = (d << 10 | d >>> 22) + a | 0;
617
+ c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
618
+ c = (c << 15 | c >>> 17) + d | 0;
619
+ b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
620
+ b = (b << 21 | b >>> 11) + c | 0;
621
+ a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
622
+ a = (a << 6 | a >>> 26) + b | 0;
623
+ d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
624
+ d = (d << 10 | d >>> 22) + a | 0;
625
+ c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
626
+ c = (c << 15 | c >>> 17) + d | 0;
627
+ b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
628
+ b = (b << 21 | b >>> 11) + c | 0;
629
+ a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
630
+ a = (a << 6 | a >>> 26) + b | 0;
631
+ d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
632
+ d = (d << 10 | d >>> 22) + a | 0;
633
+ c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
634
+ c = (c << 15 | c >>> 17) + d | 0;
635
+ b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
636
+ b = (b << 21 | b >>> 11) + c | 0;
637
+ x[0] = a + x[0] | 0;
638
+ x[1] = b + x[1] | 0;
639
+ x[2] = c + x[2] | 0;
640
+ x[3] = d + x[3] | 0;
641
+ }
642
+ function md5blk(s) {
643
+ var md5blks = [], i;
644
+ for (i = 0;i < 64; i += 4) {
645
+ md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
646
+ }
647
+ return md5blks;
648
+ }
649
+ function md5blk_array(a) {
650
+ var md5blks = [], i;
651
+ for (i = 0;i < 64; i += 4) {
652
+ md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
653
+ }
654
+ return md5blks;
655
+ }
656
+ function md51(s) {
657
+ var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i, length, tail, tmp, lo, hi;
658
+ for (i = 64;i <= n; i += 64) {
659
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
660
+ }
661
+ s = s.substring(i - 64);
662
+ length = s.length;
663
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
664
+ for (i = 0;i < length; i += 1) {
665
+ tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
666
+ }
667
+ tail[i >> 2] |= 128 << (i % 4 << 3);
668
+ if (i > 55) {
669
+ md5cycle(state, tail);
670
+ for (i = 0;i < 16; i += 1) {
671
+ tail[i] = 0;
672
+ }
673
+ }
674
+ tmp = n * 8;
675
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
676
+ lo = parseInt(tmp[2], 16);
677
+ hi = parseInt(tmp[1], 16) || 0;
678
+ tail[14] = lo;
679
+ tail[15] = hi;
680
+ md5cycle(state, tail);
681
+ return state;
682
+ }
683
+ function md51_array(a) {
684
+ var n = a.length, state = [1732584193, -271733879, -1732584194, 271733878], i, length, tail, tmp, lo, hi;
685
+ for (i = 64;i <= n; i += 64) {
686
+ md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
687
+ }
688
+ a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);
689
+ length = a.length;
690
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
691
+ for (i = 0;i < length; i += 1) {
692
+ tail[i >> 2] |= a[i] << (i % 4 << 3);
693
+ }
694
+ tail[i >> 2] |= 128 << (i % 4 << 3);
695
+ if (i > 55) {
696
+ md5cycle(state, tail);
697
+ for (i = 0;i < 16; i += 1) {
698
+ tail[i] = 0;
699
+ }
700
+ }
701
+ tmp = n * 8;
702
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
703
+ lo = parseInt(tmp[2], 16);
704
+ hi = parseInt(tmp[1], 16) || 0;
705
+ tail[14] = lo;
706
+ tail[15] = hi;
707
+ md5cycle(state, tail);
708
+ return state;
709
+ }
710
+ function rhex(n) {
711
+ var s = "", j;
712
+ for (j = 0;j < 4; j += 1) {
713
+ s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
714
+ }
715
+ return s;
716
+ }
717
+ function hex(x) {
718
+ var i;
719
+ for (i = 0;i < x.length; i += 1) {
720
+ x[i] = rhex(x[i]);
721
+ }
722
+ return x.join("");
723
+ }
724
+ if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") {
725
+ add32 = function(x, y) {
726
+ var lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16);
727
+ return msw << 16 | lsw & 65535;
728
+ };
729
+ }
730
+ if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
731
+ (function() {
732
+ function clamp(val, length) {
733
+ val = val | 0 || 0;
734
+ if (val < 0) {
735
+ return Math.max(val + length, 0);
736
+ }
737
+ return Math.min(val, length);
738
+ }
739
+ ArrayBuffer.prototype.slice = function(from, to) {
740
+ var length = this.byteLength, begin = clamp(from, length), end = length, num, target, targetArray, sourceArray;
741
+ if (to !== undefined2) {
742
+ end = clamp(to, length);
743
+ }
744
+ if (begin > end) {
745
+ return new ArrayBuffer(0);
746
+ }
747
+ num = end - begin;
748
+ target = new ArrayBuffer(num);
749
+ targetArray = new Uint8Array(target);
750
+ sourceArray = new Uint8Array(this, begin, num);
751
+ targetArray.set(sourceArray);
752
+ return target;
753
+ };
754
+ })();
755
+ }
756
+ function toUtf8(str) {
757
+ if (/[\u0080-\uFFFF]/.test(str)) {
758
+ str = unescape(encodeURIComponent(str));
759
+ }
760
+ return str;
761
+ }
762
+ function utf8Str2ArrayBuffer(str, returnUInt8Array) {
763
+ var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i;
764
+ for (i = 0;i < length; i += 1) {
765
+ arr[i] = str.charCodeAt(i);
766
+ }
767
+ return returnUInt8Array ? arr : buff;
768
+ }
769
+ function arrayBuffer2Utf8Str(buff) {
770
+ return String.fromCharCode.apply(null, new Uint8Array(buff));
771
+ }
772
+ function concatenateArrayBuffers(first, second, returnUInt8Array) {
773
+ var result = new Uint8Array(first.byteLength + second.byteLength);
774
+ result.set(new Uint8Array(first));
775
+ result.set(new Uint8Array(second), first.byteLength);
776
+ return returnUInt8Array ? result : result.buffer;
777
+ }
778
+ function hexToBinaryString(hex2) {
779
+ var bytes = [], length = hex2.length, x;
780
+ for (x = 0;x < length - 1; x += 2) {
781
+ bytes.push(parseInt(hex2.substr(x, 2), 16));
782
+ }
783
+ return String.fromCharCode.apply(String, bytes);
784
+ }
785
+ function SparkMD5() {
786
+ this.reset();
787
+ }
788
+ SparkMD5.prototype.append = function(str) {
789
+ this.appendBinary(toUtf8(str));
790
+ return this;
791
+ };
792
+ SparkMD5.prototype.appendBinary = function(contents) {
793
+ this._buff += contents;
794
+ this._length += contents.length;
795
+ var length = this._buff.length, i;
796
+ for (i = 64;i <= length; i += 64) {
797
+ md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
798
+ }
799
+ this._buff = this._buff.substring(i - 64);
800
+ return this;
801
+ };
802
+ SparkMD5.prototype.end = function(raw) {
803
+ var buff = this._buff, length = buff.length, i, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret;
804
+ for (i = 0;i < length; i += 1) {
805
+ tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);
806
+ }
807
+ this._finish(tail, length);
808
+ ret = hex(this._hash);
809
+ if (raw) {
810
+ ret = hexToBinaryString(ret);
811
+ }
812
+ this.reset();
813
+ return ret;
814
+ };
815
+ SparkMD5.prototype.reset = function() {
816
+ this._buff = "";
817
+ this._length = 0;
818
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
819
+ return this;
820
+ };
821
+ SparkMD5.prototype.getState = function() {
822
+ return {
823
+ buff: this._buff,
824
+ length: this._length,
825
+ hash: this._hash.slice()
826
+ };
827
+ };
828
+ SparkMD5.prototype.setState = function(state) {
829
+ this._buff = state.buff;
830
+ this._length = state.length;
831
+ this._hash = state.hash;
832
+ return this;
833
+ };
834
+ SparkMD5.prototype.destroy = function() {
835
+ delete this._hash;
836
+ delete this._buff;
837
+ delete this._length;
838
+ };
839
+ SparkMD5.prototype._finish = function(tail, length) {
840
+ var i = length, tmp, lo, hi;
841
+ tail[i >> 2] |= 128 << (i % 4 << 3);
842
+ if (i > 55) {
843
+ md5cycle(this._hash, tail);
844
+ for (i = 0;i < 16; i += 1) {
845
+ tail[i] = 0;
846
+ }
847
+ }
848
+ tmp = this._length * 8;
849
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
850
+ lo = parseInt(tmp[2], 16);
851
+ hi = parseInt(tmp[1], 16) || 0;
852
+ tail[14] = lo;
853
+ tail[15] = hi;
854
+ md5cycle(this._hash, tail);
855
+ };
856
+ SparkMD5.hash = function(str, raw) {
857
+ return SparkMD5.hashBinary(toUtf8(str), raw);
858
+ };
859
+ SparkMD5.hashBinary = function(content, raw) {
860
+ var hash = md51(content), ret = hex(hash);
861
+ return raw ? hexToBinaryString(ret) : ret;
862
+ };
863
+ SparkMD5.ArrayBuffer = function() {
864
+ this.reset();
865
+ };
866
+ SparkMD5.ArrayBuffer.prototype.append = function(arr) {
867
+ var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i;
868
+ this._length += arr.byteLength;
869
+ for (i = 64;i <= length; i += 64) {
870
+ md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
871
+ }
872
+ this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
873
+ return this;
874
+ };
875
+ SparkMD5.ArrayBuffer.prototype.end = function(raw) {
876
+ var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i, ret;
877
+ for (i = 0;i < length; i += 1) {
878
+ tail[i >> 2] |= buff[i] << (i % 4 << 3);
879
+ }
880
+ this._finish(tail, length);
881
+ ret = hex(this._hash);
882
+ if (raw) {
883
+ ret = hexToBinaryString(ret);
884
+ }
885
+ this.reset();
886
+ return ret;
887
+ };
888
+ SparkMD5.ArrayBuffer.prototype.reset = function() {
889
+ this._buff = new Uint8Array(0);
890
+ this._length = 0;
891
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
892
+ return this;
893
+ };
894
+ SparkMD5.ArrayBuffer.prototype.getState = function() {
895
+ var state = SparkMD5.prototype.getState.call(this);
896
+ state.buff = arrayBuffer2Utf8Str(state.buff);
897
+ return state;
898
+ };
899
+ SparkMD5.ArrayBuffer.prototype.setState = function(state) {
900
+ state.buff = utf8Str2ArrayBuffer(state.buff, true);
901
+ return SparkMD5.prototype.setState.call(this, state);
902
+ };
903
+ SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
904
+ SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
905
+ SparkMD5.ArrayBuffer.hash = function(arr, raw) {
906
+ var hash = md51_array(new Uint8Array(arr)), ret = hex(hash);
907
+ return raw ? hexToBinaryString(ret) : ret;
908
+ };
909
+ return SparkMD5;
910
+ });
911
+ });
912
+
913
+ // node_modules/.pnpm/@kevisual+query@0.0.39/node_modules/@kevisual/query/dist/query-browser.js
914
+ var isTextForContentType = (contentType) => {
915
+ if (!contentType)
916
+ return false;
917
+ const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md"];
918
+ return textTypes.some((type) => contentType.includes(type));
919
+ };
920
+ var adapter = async (opts = {}, overloadOpts) => {
921
+ const controller = new AbortController;
922
+ const signal = controller.signal;
923
+ const isPostFile = opts.isPostFile || false;
924
+ let responseType = opts.responseType || "json";
925
+ if (opts.isBlob) {
926
+ responseType = "blob";
927
+ } else if (opts.isText) {
928
+ responseType = "text";
929
+ }
930
+ const timeout = opts.timeout || 60000 * 3;
931
+ const timer = setTimeout(() => {
932
+ controller.abort();
933
+ }, timeout);
934
+ let method = overloadOpts?.method || opts?.method || "POST";
935
+ let headers = { ...opts?.headers, ...overloadOpts?.headers };
936
+ let origin = "";
937
+ let url;
938
+ if (opts?.url?.startsWith("http")) {
939
+ url = new URL(opts.url);
940
+ } else {
941
+ origin = window?.location?.origin || "http://localhost:51515";
942
+ url = new URL(opts.url, origin);
943
+ }
944
+ const isGet = method === "GET";
945
+ const oldSearchParams = url.searchParams;
946
+ if (isGet) {
947
+ let searchParams = new URLSearchParams({ ...Object.fromEntries(oldSearchParams), ...opts.body });
948
+ url.search = searchParams.toString();
949
+ } else {
950
+ const params = {
951
+ ...Object.fromEntries(oldSearchParams),
952
+ ...opts.params
953
+ };
954
+ const searchParams = new URLSearchParams(params);
955
+ if (typeof opts.body === "object" && opts.body !== null) {
956
+ let body2 = opts.body || {};
957
+ if (!params.path && body2?.path) {
958
+ searchParams.set("path", body2.path);
959
+ if (body2?.key) {
960
+ searchParams.set("key", body2.key);
961
+ }
962
+ }
963
+ }
964
+ url.search = searchParams.toString();
965
+ }
966
+ let body = undefined;
967
+ if (isGet) {
968
+ body = undefined;
969
+ } else if (isPostFile) {
970
+ body = opts.body;
971
+ } else {
972
+ headers = {
973
+ "Content-Type": "application/json",
974
+ ...headers
975
+ };
976
+ body = JSON.stringify(opts.body);
977
+ }
978
+ return fetch(url, {
979
+ method: method.toUpperCase(),
980
+ signal,
981
+ body,
982
+ ...overloadOpts,
983
+ headers
984
+ }).then(async (response) => {
985
+ const contentType = response.headers.get("Content-Type");
986
+ if (responseType === "blob") {
987
+ return await response.blob();
988
+ }
989
+ const isText = responseType === "text";
990
+ const isJson = contentType && contentType.includes("application/json");
991
+ if (isJson && !isText) {
992
+ return await response.json();
993
+ } else if (isTextForContentType(contentType)) {
994
+ return {
995
+ code: response.status,
996
+ status: response.status,
997
+ data: await response.text()
998
+ };
999
+ } else {
1000
+ return response;
1001
+ }
1002
+ }).catch((err) => {
1003
+ if (err.name === "AbortError") {
1004
+ return {
1005
+ code: 408,
1006
+ message: "请求超时"
1007
+ };
1008
+ }
1009
+ return {
1010
+ code: 500,
1011
+ message: err.message || "网络错误"
1012
+ };
1013
+ }).finally(() => {
1014
+ clearTimeout(timer);
1015
+ });
1016
+ };
1017
+
1018
+ // node_modules/.pnpm/path-browserify-esm@1.0.6/node_modules/path-browserify-esm/index.esm.js
1019
+ function assertPath(path) {
1020
+ if (typeof path !== "string") {
1021
+ throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
1022
+ }
1023
+ }
1024
+ function normalizeStringPosix(path, allowAboveRoot) {
1025
+ var res = "";
1026
+ var lastSegmentLength = 0;
1027
+ var lastSlash = -1;
1028
+ var dots = 0;
1029
+ var code;
1030
+ for (var i = 0;i <= path.length; ++i) {
1031
+ if (i < path.length)
1032
+ code = path.charCodeAt(i);
1033
+ else if (code === 47)
1034
+ break;
1035
+ else
1036
+ code = 47;
1037
+ if (code === 47) {
1038
+ if (lastSlash === i - 1 || dots === 1) {} else if (lastSlash !== i - 1 && dots === 2) {
1039
+ if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
1040
+ if (res.length > 2) {
1041
+ var lastSlashIndex = res.lastIndexOf("/");
1042
+ if (lastSlashIndex !== res.length - 1) {
1043
+ if (lastSlashIndex === -1) {
1044
+ res = "";
1045
+ lastSegmentLength = 0;
1046
+ } else {
1047
+ res = res.slice(0, lastSlashIndex);
1048
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1049
+ }
1050
+ lastSlash = i;
1051
+ dots = 0;
1052
+ continue;
1053
+ }
1054
+ } else if (res.length === 2 || res.length === 1) {
1055
+ res = "";
1056
+ lastSegmentLength = 0;
1057
+ lastSlash = i;
1058
+ dots = 0;
1059
+ continue;
1060
+ }
1061
+ }
1062
+ if (allowAboveRoot) {
1063
+ if (res.length > 0)
1064
+ res += "/..";
1065
+ else
1066
+ res = "..";
1067
+ lastSegmentLength = 2;
1068
+ }
1069
+ } else {
1070
+ if (res.length > 0)
1071
+ res += "/" + path.slice(lastSlash + 1, i);
1072
+ else
1073
+ res = path.slice(lastSlash + 1, i);
1074
+ lastSegmentLength = i - lastSlash - 1;
1075
+ }
1076
+ lastSlash = i;
1077
+ dots = 0;
1078
+ } else if (code === 46 && dots !== -1) {
1079
+ ++dots;
1080
+ } else {
1081
+ dots = -1;
1082
+ }
1083
+ }
1084
+ return res;
1085
+ }
1086
+ function _format(sep, pathObject) {
1087
+ var dir = pathObject.dir || pathObject.root;
1088
+ var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
1089
+ if (!dir) {
1090
+ return base;
1091
+ }
1092
+ if (dir === pathObject.root) {
1093
+ return dir + base;
1094
+ }
1095
+ return dir + sep + base;
1096
+ }
1097
+ var posix = {
1098
+ process_cwd: "",
1099
+ setCWD: function setCWD(_cwd) {
1100
+ posix.process_cwd = _cwd;
1101
+ },
1102
+ resolve: function resolve() {
1103
+ var resolvedPath = "";
1104
+ var resolvedAbsolute = false;
1105
+ var cwd;
1106
+ for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
1107
+ var path;
1108
+ if (i >= 0)
1109
+ path = arguments[i];
1110
+ else {
1111
+ if (cwd === undefined)
1112
+ cwd = posix.process_cwd;
1113
+ path = cwd;
1114
+ }
1115
+ assertPath(path);
1116
+ if (path.length === 0) {
1117
+ continue;
1118
+ }
1119
+ if (path + "/" === resolvedPath) {
1120
+ continue;
1121
+ }
1122
+ resolvedPath = path + "/" + resolvedPath;
1123
+ resolvedAbsolute = path.charCodeAt(0) === 47;
1124
+ }
1125
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
1126
+ if (resolvedAbsolute) {
1127
+ if (resolvedPath.length > 0)
1128
+ return "/" + resolvedPath;
1129
+ else
1130
+ return "/";
1131
+ } else if (resolvedPath.length > 0) {
1132
+ return resolvedPath;
1133
+ } else {
1134
+ return ".";
1135
+ }
1136
+ },
1137
+ normalize: function normalize(path) {
1138
+ assertPath(path);
1139
+ if (path.length === 0)
1140
+ return ".";
1141
+ var isAbsolute2 = path.charCodeAt(0) === 47;
1142
+ var trailingSeparator = path.charCodeAt(path.length - 1) === 47;
1143
+ path = normalizeStringPosix(path, !isAbsolute2);
1144
+ if (path.length === 0 && !isAbsolute2)
1145
+ path = ".";
1146
+ if (path.length > 0 && trailingSeparator)
1147
+ path += "/";
1148
+ if (isAbsolute2)
1149
+ return "/" + path;
1150
+ return path;
1151
+ },
1152
+ isAbsolute: function isAbsolute(path) {
1153
+ assertPath(path);
1154
+ return path.length > 0 && path.charCodeAt(0) === 47;
1155
+ },
1156
+ join: function join() {
1157
+ if (arguments.length === 0)
1158
+ return ".";
1159
+ var joined;
1160
+ for (var i = 0;i < arguments.length; ++i) {
1161
+ var arg = arguments[i];
1162
+ assertPath(arg);
1163
+ if (arg.length > 0) {
1164
+ if (joined === undefined)
1165
+ joined = arg;
1166
+ else
1167
+ joined += "/" + arg;
1168
+ }
1169
+ }
1170
+ if (joined === undefined)
1171
+ return ".";
1172
+ return posix.normalize(joined);
1173
+ },
1174
+ relative: function relative(from, to) {
1175
+ assertPath(from);
1176
+ assertPath(to);
1177
+ if (from === to)
1178
+ return "";
1179
+ const from2 = from.replaceAll("\\", "/");
1180
+ const to2 = to.replaceAll("\\", "/");
1181
+ if (from2 != from && to2 != to) {
1182
+ return posix.relative(from2, to2).replaceAll("/", "\\");
1183
+ } else if (from2 != from) {
1184
+ return posix.relative(from2, to).replaceAll("/", "\\");
1185
+ } else if (to2 != to) {
1186
+ return posix.relative(from, to2);
1187
+ }
1188
+ from = posix.resolve(from);
1189
+ to = posix.resolve(to);
1190
+ if (from === to)
1191
+ return "";
1192
+ var fromStart = 1;
1193
+ for (;fromStart < from.length; ++fromStart) {
1194
+ if (from.charCodeAt(fromStart) !== 47)
1195
+ break;
1196
+ }
1197
+ var fromEnd = from.length;
1198
+ var fromLen = fromEnd - fromStart;
1199
+ var toStart = 1;
1200
+ for (;toStart < to.length; ++toStart) {
1201
+ if (to.charCodeAt(toStart) !== 47)
1202
+ break;
1203
+ }
1204
+ var toEnd = to.length;
1205
+ var toLen = toEnd - toStart;
1206
+ var length = fromLen < toLen ? fromLen : toLen;
1207
+ var lastCommonSep = -1;
1208
+ var i = 0;
1209
+ for (;i <= length; ++i) {
1210
+ if (i === length) {
1211
+ if (toLen > length) {
1212
+ if (to.charCodeAt(toStart + i) === 47) {
1213
+ return to.slice(toStart + i + 1);
1214
+ } else if (i === 0) {
1215
+ return to.slice(toStart + i);
1216
+ }
1217
+ } else if (fromLen > length) {
1218
+ if (from.charCodeAt(fromStart + i) === 47) {
1219
+ lastCommonSep = i;
1220
+ } else if (i === 0) {
1221
+ lastCommonSep = 0;
1222
+ }
1223
+ }
1224
+ break;
1225
+ }
1226
+ var fromCode = from.charCodeAt(fromStart + i);
1227
+ var toCode = to.charCodeAt(toStart + i);
1228
+ if (fromCode !== toCode)
1229
+ break;
1230
+ else if (fromCode === 47)
1231
+ lastCommonSep = i;
1232
+ }
1233
+ var out = "";
1234
+ for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i) {
1235
+ if (i === fromEnd || from.charCodeAt(i) === 47) {
1236
+ if (out.length === 0)
1237
+ out += "..";
1238
+ else
1239
+ out += "/..";
1240
+ }
1241
+ }
1242
+ if (out.length > 0)
1243
+ return out + to.slice(toStart + lastCommonSep);
1244
+ else {
1245
+ toStart += lastCommonSep;
1246
+ if (to.charCodeAt(toStart) === 47)
1247
+ ++toStart;
1248
+ return to.slice(toStart);
1249
+ }
1250
+ },
1251
+ _makeLong: function _makeLong(path) {
1252
+ return path;
1253
+ },
1254
+ dirname: function dirname(path) {
1255
+ assertPath(path);
1256
+ if (path.length === 0)
1257
+ return ".";
1258
+ var code = path.charCodeAt(0);
1259
+ var hasRoot = code === 47;
1260
+ var end = -1;
1261
+ var matchedSlash = true;
1262
+ for (var i = path.length - 1;i >= 1; --i) {
1263
+ code = path.charCodeAt(i);
1264
+ if (code === 47) {
1265
+ if (!matchedSlash) {
1266
+ end = i;
1267
+ break;
1268
+ }
1269
+ } else {
1270
+ matchedSlash = false;
1271
+ }
1272
+ }
1273
+ if (end === -1)
1274
+ return hasRoot ? "/" : ".";
1275
+ if (hasRoot && end === 1)
1276
+ return "//";
1277
+ return path.slice(0, end);
1278
+ },
1279
+ basename: function basename(path, ext) {
1280
+ if (ext !== undefined && typeof ext !== "string")
1281
+ throw new TypeError('"ext" argument must be a string');
1282
+ assertPath(path);
1283
+ var start = 0;
1284
+ var end = -1;
1285
+ var matchedSlash = true;
1286
+ var i;
1287
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
1288
+ if (ext.length === path.length && ext === path)
1289
+ return "";
1290
+ var extIdx = ext.length - 1;
1291
+ var firstNonSlashEnd = -1;
1292
+ for (i = path.length - 1;i >= 0; --i) {
1293
+ var code = path.charCodeAt(i);
1294
+ if (code === 47) {
1295
+ if (!matchedSlash) {
1296
+ start = i + 1;
1297
+ break;
1298
+ }
1299
+ } else {
1300
+ if (firstNonSlashEnd === -1) {
1301
+ matchedSlash = false;
1302
+ firstNonSlashEnd = i + 1;
1303
+ }
1304
+ if (extIdx >= 0) {
1305
+ if (code === ext.charCodeAt(extIdx)) {
1306
+ if (--extIdx === -1) {
1307
+ end = i;
1308
+ }
1309
+ } else {
1310
+ extIdx = -1;
1311
+ end = firstNonSlashEnd;
1312
+ }
1313
+ }
1314
+ }
1315
+ }
1316
+ if (start === end)
1317
+ end = firstNonSlashEnd;
1318
+ else if (end === -1)
1319
+ end = path.length;
1320
+ return path.slice(start, end);
1321
+ } else {
1322
+ for (i = path.length - 1;i >= 0; --i) {
1323
+ if (path.charCodeAt(i) === 47) {
1324
+ if (!matchedSlash) {
1325
+ start = i + 1;
1326
+ break;
1327
+ }
1328
+ } else if (end === -1) {
1329
+ matchedSlash = false;
1330
+ end = i + 1;
1331
+ }
1332
+ }
1333
+ if (end === -1)
1334
+ return "";
1335
+ return path.slice(start, end);
1336
+ }
1337
+ },
1338
+ extname: function extname(path) {
1339
+ assertPath(path);
1340
+ var startDot = -1;
1341
+ var startPart = 0;
1342
+ var end = -1;
1343
+ var matchedSlash = true;
1344
+ var preDotState = 0;
1345
+ for (var i = path.length - 1;i >= 0; --i) {
1346
+ var code = path.charCodeAt(i);
1347
+ if (code === 47) {
1348
+ if (!matchedSlash) {
1349
+ startPart = i + 1;
1350
+ break;
1351
+ }
1352
+ continue;
1353
+ }
1354
+ if (end === -1) {
1355
+ matchedSlash = false;
1356
+ end = i + 1;
1357
+ }
1358
+ if (code === 46) {
1359
+ if (startDot === -1)
1360
+ startDot = i;
1361
+ else if (preDotState !== 1)
1362
+ preDotState = 1;
1363
+ } else if (startDot !== -1) {
1364
+ preDotState = -1;
1365
+ }
1366
+ }
1367
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
1368
+ return "";
1369
+ }
1370
+ return path.slice(startDot, end);
1371
+ },
1372
+ format: function format(pathObject) {
1373
+ if (pathObject === null || typeof pathObject !== "object") {
1374
+ throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
1375
+ }
1376
+ return _format("/", pathObject);
1377
+ },
1378
+ parse: function parse(path) {
1379
+ assertPath(path);
1380
+ var ret = { root: "", dir: "", base: "", ext: "", name: "" };
1381
+ if (path.length === 0)
1382
+ return ret;
1383
+ var code = path.charCodeAt(0);
1384
+ var isAbsolute2 = code === 47;
1385
+ var start;
1386
+ if (isAbsolute2) {
1387
+ ret.root = "/";
1388
+ start = 1;
1389
+ } else {
1390
+ start = 0;
1391
+ }
1392
+ var startDot = -1;
1393
+ var startPart = 0;
1394
+ var end = -1;
1395
+ var matchedSlash = true;
1396
+ var i = path.length - 1;
1397
+ var preDotState = 0;
1398
+ for (;i >= start; --i) {
1399
+ code = path.charCodeAt(i);
1400
+ if (code === 47) {
1401
+ if (!matchedSlash) {
1402
+ startPart = i + 1;
1403
+ break;
1404
+ }
1405
+ continue;
1406
+ }
1407
+ if (end === -1) {
1408
+ matchedSlash = false;
1409
+ end = i + 1;
1410
+ }
1411
+ if (code === 46) {
1412
+ if (startDot === -1)
1413
+ startDot = i;
1414
+ else if (preDotState !== 1)
1415
+ preDotState = 1;
1416
+ } else if (startDot !== -1) {
1417
+ preDotState = -1;
1418
+ }
1419
+ }
1420
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
1421
+ if (end !== -1) {
1422
+ if (startPart === 0 && isAbsolute2)
1423
+ ret.base = ret.name = path.slice(1, end);
1424
+ else
1425
+ ret.base = ret.name = path.slice(startPart, end);
1426
+ }
1427
+ } else {
1428
+ if (startPart === 0 && isAbsolute2) {
1429
+ ret.name = path.slice(1, startDot);
1430
+ ret.base = path.slice(1, end);
1431
+ } else {
1432
+ ret.name = path.slice(startPart, startDot);
1433
+ ret.base = path.slice(startPart, end);
1434
+ }
1435
+ ret.ext = path.slice(startDot, end);
1436
+ }
1437
+ if (startPart > 0)
1438
+ ret.dir = path.slice(0, startPart - 1);
1439
+ else if (isAbsolute2)
1440
+ ret.dir = "/";
1441
+ return ret;
1442
+ },
1443
+ sep: "/",
1444
+ delimiter: ":",
1445
+ win32: null,
1446
+ posix: null
1447
+ };
1448
+ posix.posix = posix;
1449
+
1450
+ // query/query-resources/utils.ts
1451
+ var import_md5 = __toESM(require_md5(), 1);
1452
+ var import_spark_md5 = __toESM(require_spark_md5(), 1);
1453
+ var hashContent = (str) => {
1454
+ if (typeof str === "string") {
1455
+ return import_md5.default(str).toString();
1456
+ } else if (str instanceof Blob) {
1457
+ return hashBlob(str);
1458
+ } else if (Buffer.isBuffer(str)) {
1459
+ return import_md5.default(str.toString()).toString();
1460
+ }
1461
+ console.error("hashContent error: input must be a string, Blob, or Buffer");
1462
+ return "";
1463
+ };
1464
+ var hashBlob = (blob) => {
1465
+ return new Promise(async (resolve2, reject) => {
1466
+ try {
1467
+ const spark = new import_spark_md5.default.ArrayBuffer;
1468
+ spark.append(await blob.arrayBuffer());
1469
+ resolve2(spark.end());
1470
+ } catch (error) {
1471
+ console.error("hashBlob error", error);
1472
+ reject(error);
1473
+ }
1474
+ });
1475
+ };
1476
+
1477
+ // query/query-resources/index.ts
1478
+ class QueryResources {
1479
+ prefix;
1480
+ storage;
1481
+ onProcess;
1482
+ constructor(opts) {
1483
+ if (opts.username) {
1484
+ this.prefix = `/${opts.username}/resources/`;
1485
+ } else {
1486
+ this.prefix = opts.prefix || "";
1487
+ }
1488
+ this.storage = opts.storage || localStorage;
1489
+ this.onProcess = opts.onProcess || (() => {});
1490
+ }
1491
+ setUsername(username) {
1492
+ this.prefix = `/${username}/resources/`;
1493
+ }
1494
+ setPrefix(prefix) {
1495
+ this.prefix = prefix;
1496
+ }
1497
+ header(headers, json = true) {
1498
+ const token = this.storage.getItem("token");
1499
+ const _headers = {
1500
+ "Content-Type": "application/json",
1501
+ ...headers
1502
+ };
1503
+ if (!json) {
1504
+ delete _headers["Content-Type"];
1505
+ }
1506
+ if (!token) {
1507
+ return _headers;
1508
+ }
1509
+ return {
1510
+ ..._headers,
1511
+ Authorization: `Bearer ${token}`
1512
+ };
1513
+ }
1514
+ async get(data, opts) {
1515
+ return adapter({
1516
+ url: opts.url,
1517
+ method: "GET",
1518
+ body: data,
1519
+ ...opts,
1520
+ headers: this.header(opts?.headers)
1521
+ });
1522
+ }
1523
+ async getList(prefix, data, opts) {
1524
+ return this.get(data, {
1525
+ url: `${this.prefix}${prefix}`,
1526
+ body: data,
1527
+ ...opts
1528
+ });
1529
+ }
1530
+ async fetchFile(filepath, opts) {
1531
+ const url = `${this.prefix}${filepath}`;
1532
+ return this.get({}, { url, method: "GET", ...opts, headers: this.header(opts?.headers, false), isText: true });
1533
+ }
1534
+ async uploadFile(filepath, content, opts) {
1535
+ const pathname = `${this.prefix}${filepath}`;
1536
+ const filename = posix.basename(pathname);
1537
+ const type = getContentType(filename);
1538
+ const url = new URL(pathname, window.location.origin);
1539
+ const hashResult = hashContent(content);
1540
+ const hash = hashResult instanceof Promise ? await hashResult : hashResult;
1541
+ url.searchParams.set("hash", hash);
1542
+ const { chunkSize, maxSize, ...restOpts } = opts || {};
1543
+ const isBlob = content instanceof Blob;
1544
+ const fileSize = isBlob ? content.size : new Blob([content]).size;
1545
+ const CHUNK_THRESHOLD = maxSize ?? 20 * 1024 * 1024;
1546
+ if (fileSize > CHUNK_THRESHOLD && isBlob) {
1547
+ return this.uploadChunkedFile(filepath, content, hash, { chunkSize, ...restOpts });
1548
+ }
1549
+ this.onProcess?.({ type: "uploadBegin", filename, size: fileSize, process: 0 });
1550
+ const formData = new FormData;
1551
+ if (isBlob) {
1552
+ formData.append("file", content);
1553
+ } else {
1554
+ formData.append("file", new Blob([content], { type }));
1555
+ }
1556
+ const res = await adapter({
1557
+ url: url.toString(),
1558
+ isPostFile: true,
1559
+ method: "POST",
1560
+ body: formData,
1561
+ timeout: 5 * 60 * 1000,
1562
+ ...restOpts,
1563
+ headers: { ...restOpts?.headers, ...this.header(restOpts?.headers, false) },
1564
+ params: {
1565
+ hash,
1566
+ ...restOpts?.params
1567
+ }
1568
+ });
1569
+ this.onProcess?.({ type: "uploadFinish", filename, size: fileSize, process: 100 });
1570
+ return res;
1571
+ }
1572
+ async uploadChunkedFile(filepath, file, hash, opts) {
1573
+ const pathname = `${this.prefix}${filepath}`;
1574
+ const filename = posix.basename(pathname);
1575
+ const url = new URL(pathname, window.location.origin);
1576
+ url.searchParams.set("hash", hash);
1577
+ url.searchParams.set("chunk", "1");
1578
+ console.log(`url,`, url, hash);
1579
+ const { chunkSize: _chunkSize, ...restOpts } = opts || {};
1580
+ const chunkSize = _chunkSize ?? 5 * 1024 * 1024;
1581
+ const totalChunks = Math.ceil(file.size / chunkSize);
1582
+ this.onProcess?.({ type: "uploadBegin", filename, size: file.size, process: 0 });
1583
+ for (let currentChunk = 0;currentChunk < totalChunks; currentChunk++) {
1584
+ this.onProcess?.({ type: "uploadChunkedFile", filename, size: file.size, process: 0, totalChunks, currentChunk: currentChunk + 1 });
1585
+ const start = currentChunk * chunkSize;
1586
+ const end = Math.min(start + chunkSize, file.size);
1587
+ const chunkBlob = file.slice(start, end);
1588
+ const chunkFile = new File([chunkBlob], filename, { type: file.type || "application/octet-stream" });
1589
+ const formData = new FormData;
1590
+ formData.append("file", chunkFile, filename);
1591
+ formData.append("chunkIndex", currentChunk.toString());
1592
+ formData.append("totalChunks", totalChunks.toString());
1593
+ console.log(`Uploading chunk ${currentChunk + 1}/${totalChunks}`, url.toString());
1594
+ try {
1595
+ const res = await adapter({
1596
+ url: url.toString(),
1597
+ isPostFile: true,
1598
+ method: "POST",
1599
+ body: formData,
1600
+ timeout: 5 * 60 * 1000,
1601
+ ...restOpts,
1602
+ headers: { ...restOpts?.headers, ...this.header(restOpts?.headers, false) },
1603
+ params: {
1604
+ hash,
1605
+ chunk: "1",
1606
+ chunkIndex: currentChunk,
1607
+ totalChunks,
1608
+ ...restOpts?.params
1609
+ }
1610
+ });
1611
+ if (res.code !== 200) {
1612
+ throw new Error(`Chunk 上传失败 code ${res.code}, 错误信息是: ${res.message}`);
1613
+ }
1614
+ console.log(`Chunk ${currentChunk + 1}/${totalChunks} uploaded`, res);
1615
+ this.onProcess?.({ type: "uploadChunkedFile", filename, size: file.size, process: Math.round((currentChunk + 1) / totalChunks * 100), totalChunks, currentChunk: currentChunk + 1 });
1616
+ } catch (error) {
1617
+ console.error(`Error uploading chunk ${currentChunk + 1}/${totalChunks}`, error);
1618
+ return { code: 500, message: `分块上传失败: ${error.message}` };
1619
+ }
1620
+ }
1621
+ this.onProcess?.({ type: "uploadFinish", filename, size: file.size, process: 100 });
1622
+ return { code: 200, message: "上传成功" };
1623
+ }
1624
+ async getStat(filepath, opts) {
1625
+ const url = `${this.prefix}${filepath}`;
1626
+ return adapter({
1627
+ url,
1628
+ params: {
1629
+ stat: "1"
1630
+ },
1631
+ method: "GET",
1632
+ headers: this.header(opts?.headers)
1633
+ });
1634
+ }
1635
+ async getState(filepath, opts) {
1636
+ return this.getStat(filepath, opts);
1637
+ }
1638
+ async createFolder(folderpath, opts) {
1639
+ const filepath = folderpath.endsWith("/") ? `${folderpath}keep.txt` : `${folderpath}/keep.txt`;
1640
+ return this.uploadFile(filepath, "文件夹占位,其他文件不存在,文件夹不存在,如果有其他文件夹,删除当前文件夹占位文件即可", opts);
1641
+ }
1642
+ async rename(oldpath, newpath, opts) {
1643
+ const pathname = `${this.prefix}${oldpath}`;
1644
+ const newName = `${this.prefix}${newpath}`;
1645
+ const params = {
1646
+ newName
1647
+ };
1648
+ const url = pathname;
1649
+ return adapter({
1650
+ url,
1651
+ method: "PUT",
1652
+ headers: this.header(opts?.headers),
1653
+ params
1654
+ });
1655
+ }
1656
+ async deleteFile(filepath, opts) {
1657
+ const url = `${this.prefix}${filepath}`;
1658
+ return adapter({
1659
+ url,
1660
+ method: "DELETE",
1661
+ headers: this.header(opts?.headers)
1662
+ });
1663
+ }
1664
+ }
1665
+ var getContentType = (filename) => {
1666
+ const ext = posix.extname(filename);
1667
+ let type = "text/plain";
1668
+ switch (ext) {
1669
+ case "":
1670
+ type = "application/octet-stream";
1671
+ break;
1672
+ case ".json":
1673
+ type = "application/json";
1674
+ break;
1675
+ case ".txt":
1676
+ type = "text/plain";
1677
+ break;
1678
+ case ".csv":
1679
+ type = "text/csv";
1680
+ break;
1681
+ case ".md":
1682
+ type = "text/markdown";
1683
+ break;
1684
+ case ".html":
1685
+ case ".htm":
1686
+ type = "text/html";
1687
+ break;
1688
+ case ".xml":
1689
+ type = "application/xml";
1690
+ break;
1691
+ case ".js":
1692
+ type = "application/javascript";
1693
+ break;
1694
+ case ".css":
1695
+ type = "text/css";
1696
+ break;
1697
+ case ".ts":
1698
+ type = "application/typescript";
1699
+ break;
1700
+ case ".pdf":
1701
+ type = "application/pdf";
1702
+ break;
1703
+ case ".zip":
1704
+ type = "application/zip";
1705
+ break;
1706
+ case ".docx":
1707
+ type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
1708
+ break;
1709
+ case ".xlsx":
1710
+ type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1711
+ break;
1712
+ case ".mp3":
1713
+ type = "audio/mpeg";
1714
+ break;
1715
+ case ".mp4":
1716
+ type = "video/mp4";
1717
+ break;
1718
+ case ".png":
1719
+ case ".jpg":
1720
+ case ".jpeg":
1721
+ case ".gif":
1722
+ case ".webp":
1723
+ type = `image/${ext.slice(1)}`;
1724
+ break;
1725
+ case ".svg":
1726
+ type = "image/svg+xml";
1727
+ break;
1728
+ }
1729
+ return type;
1730
+ };
1731
+ export {
1732
+ getContentType,
1733
+ QueryResources
1734
+ };