qjutil 0.0.10 → 0.0.11

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.txt ADDED
@@ -0,0 +1 @@
1
+ 随便提点什么
package/dist/index.d.ts CHANGED
@@ -7,8 +7,41 @@ declare namespace sign {
7
7
  export { sign_md5 as md5, sign_raw as raw };
8
8
  }
9
9
 
10
- declare const qjutil: {
10
+ declare function combineBagRes(targetBagRes: any, targetMaxCount: any, originBagRes: any, itemDic: any): {
11
+ status: boolean;
12
+ target: any;
13
+ origin: any;
14
+ };
15
+ declare function deleteBagRes(targetBagRes: any[], items: any): any;
16
+
17
+ declare const bagUtil_combineBagRes: typeof combineBagRes;
18
+ declare const bagUtil_deleteBagRes: typeof deleteBagRes;
19
+ declare namespace bagUtil {
20
+ export { bagUtil_combineBagRes as combineBagRes, bagUtil_deleteBagRes as deleteBagRes };
21
+ }
22
+
23
+ /**
24
+ * 压缩
25
+ * @param data
26
+ */
27
+ declare function zip(data: any): string;
28
+ /**
29
+ * 解压
30
+ * @param data
31
+ * @return 返回值已执行JSON.parse
32
+ */
33
+ declare function unzip(data: any): any;
34
+
35
+ declare const zip$1_unzip: typeof unzip;
36
+ declare const zip$1_zip: typeof zip;
37
+ declare namespace zip$1 {
38
+ export { zip$1_unzip as unzip, zip$1_zip as zip };
39
+ }
40
+
41
+ declare const qjUtil: {
11
42
  sign: typeof sign;
43
+ bagUtil: typeof bagUtil;
44
+ zip: typeof zip$1;
12
45
  };
13
46
 
14
- export { qjutil as default, sign };
47
+ export { bagUtil, qjUtil as default, sign, zip$1 as zip };
@@ -1,422 +1 @@
1
- "use strict";
2
- var qjutil = (() => {
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- default: () => index_default,
25
- sign: () => sign_exports
26
- });
27
-
28
- // src/util/sign.ts
29
- var sign_exports = {};
30
- __export(sign_exports, {
31
- md5: () => md5,
32
- raw: () => raw
33
- });
34
-
35
- // node_modules/ts-md5/dist/esm/md5.js
36
- var Md5 = class _Md5 {
37
- constructor() {
38
- this._dataLength = 0;
39
- this._bufferLength = 0;
40
- this._state = new Int32Array(4);
41
- this._buffer = new ArrayBuffer(68);
42
- this._buffer8 = new Uint8Array(this._buffer, 0, 68);
43
- this._buffer32 = new Uint32Array(this._buffer, 0, 17);
44
- this.start();
45
- }
46
- static hashStr(str, raw2 = false) {
47
- return this.onePassHasher.start().appendStr(str).end(raw2);
48
- }
49
- static hashAsciiStr(str, raw2 = false) {
50
- return this.onePassHasher.start().appendAsciiStr(str).end(raw2);
51
- }
52
- static _hex(x) {
53
- const hc = _Md5.hexChars;
54
- const ho = _Md5.hexOut;
55
- let n;
56
- let offset;
57
- let j;
58
- let i;
59
- for (i = 0; i < 4; i += 1) {
60
- offset = i * 8;
61
- n = x[i];
62
- for (j = 0; j < 8; j += 2) {
63
- ho[offset + 1 + j] = hc.charAt(n & 15);
64
- n >>>= 4;
65
- ho[offset + 0 + j] = hc.charAt(n & 15);
66
- n >>>= 4;
67
- }
68
- }
69
- return ho.join("");
70
- }
71
- static _md5cycle(x, k) {
72
- let a = x[0];
73
- let b = x[1];
74
- let c = x[2];
75
- let d = x[3];
76
- a += (b & c | ~b & d) + k[0] - 680876936 | 0;
77
- a = (a << 7 | a >>> 25) + b | 0;
78
- d += (a & b | ~a & c) + k[1] - 389564586 | 0;
79
- d = (d << 12 | d >>> 20) + a | 0;
80
- c += (d & a | ~d & b) + k[2] + 606105819 | 0;
81
- c = (c << 17 | c >>> 15) + d | 0;
82
- b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
83
- b = (b << 22 | b >>> 10) + c | 0;
84
- a += (b & c | ~b & d) + k[4] - 176418897 | 0;
85
- a = (a << 7 | a >>> 25) + b | 0;
86
- d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
87
- d = (d << 12 | d >>> 20) + a | 0;
88
- c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
89
- c = (c << 17 | c >>> 15) + d | 0;
90
- b += (c & d | ~c & a) + k[7] - 45705983 | 0;
91
- b = (b << 22 | b >>> 10) + c | 0;
92
- a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
93
- a = (a << 7 | a >>> 25) + b | 0;
94
- d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
95
- d = (d << 12 | d >>> 20) + a | 0;
96
- c += (d & a | ~d & b) + k[10] - 42063 | 0;
97
- c = (c << 17 | c >>> 15) + d | 0;
98
- b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
99
- b = (b << 22 | b >>> 10) + c | 0;
100
- a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
101
- a = (a << 7 | a >>> 25) + b | 0;
102
- d += (a & b | ~a & c) + k[13] - 40341101 | 0;
103
- d = (d << 12 | d >>> 20) + a | 0;
104
- c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
105
- c = (c << 17 | c >>> 15) + d | 0;
106
- b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
107
- b = (b << 22 | b >>> 10) + c | 0;
108
- a += (b & d | c & ~d) + k[1] - 165796510 | 0;
109
- a = (a << 5 | a >>> 27) + b | 0;
110
- d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
111
- d = (d << 9 | d >>> 23) + a | 0;
112
- c += (d & b | a & ~b) + k[11] + 643717713 | 0;
113
- c = (c << 14 | c >>> 18) + d | 0;
114
- b += (c & a | d & ~a) + k[0] - 373897302 | 0;
115
- b = (b << 20 | b >>> 12) + c | 0;
116
- a += (b & d | c & ~d) + k[5] - 701558691 | 0;
117
- a = (a << 5 | a >>> 27) + b | 0;
118
- d += (a & c | b & ~c) + k[10] + 38016083 | 0;
119
- d = (d << 9 | d >>> 23) + a | 0;
120
- c += (d & b | a & ~b) + k[15] - 660478335 | 0;
121
- c = (c << 14 | c >>> 18) + d | 0;
122
- b += (c & a | d & ~a) + k[4] - 405537848 | 0;
123
- b = (b << 20 | b >>> 12) + c | 0;
124
- a += (b & d | c & ~d) + k[9] + 568446438 | 0;
125
- a = (a << 5 | a >>> 27) + b | 0;
126
- d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
127
- d = (d << 9 | d >>> 23) + a | 0;
128
- c += (d & b | a & ~b) + k[3] - 187363961 | 0;
129
- c = (c << 14 | c >>> 18) + d | 0;
130
- b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
131
- b = (b << 20 | b >>> 12) + c | 0;
132
- a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
133
- a = (a << 5 | a >>> 27) + b | 0;
134
- d += (a & c | b & ~c) + k[2] - 51403784 | 0;
135
- d = (d << 9 | d >>> 23) + a | 0;
136
- c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
137
- c = (c << 14 | c >>> 18) + d | 0;
138
- b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
139
- b = (b << 20 | b >>> 12) + c | 0;
140
- a += (b ^ c ^ d) + k[5] - 378558 | 0;
141
- a = (a << 4 | a >>> 28) + b | 0;
142
- d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
143
- d = (d << 11 | d >>> 21) + a | 0;
144
- c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
145
- c = (c << 16 | c >>> 16) + d | 0;
146
- b += (c ^ d ^ a) + k[14] - 35309556 | 0;
147
- b = (b << 23 | b >>> 9) + c | 0;
148
- a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
149
- a = (a << 4 | a >>> 28) + b | 0;
150
- d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
151
- d = (d << 11 | d >>> 21) + a | 0;
152
- c += (d ^ a ^ b) + k[7] - 155497632 | 0;
153
- c = (c << 16 | c >>> 16) + d | 0;
154
- b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
155
- b = (b << 23 | b >>> 9) + c | 0;
156
- a += (b ^ c ^ d) + k[13] + 681279174 | 0;
157
- a = (a << 4 | a >>> 28) + b | 0;
158
- d += (a ^ b ^ c) + k[0] - 358537222 | 0;
159
- d = (d << 11 | d >>> 21) + a | 0;
160
- c += (d ^ a ^ b) + k[3] - 722521979 | 0;
161
- c = (c << 16 | c >>> 16) + d | 0;
162
- b += (c ^ d ^ a) + k[6] + 76029189 | 0;
163
- b = (b << 23 | b >>> 9) + c | 0;
164
- a += (b ^ c ^ d) + k[9] - 640364487 | 0;
165
- a = (a << 4 | a >>> 28) + b | 0;
166
- d += (a ^ b ^ c) + k[12] - 421815835 | 0;
167
- d = (d << 11 | d >>> 21) + a | 0;
168
- c += (d ^ a ^ b) + k[15] + 530742520 | 0;
169
- c = (c << 16 | c >>> 16) + d | 0;
170
- b += (c ^ d ^ a) + k[2] - 995338651 | 0;
171
- b = (b << 23 | b >>> 9) + c | 0;
172
- a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
173
- a = (a << 6 | a >>> 26) + b | 0;
174
- d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
175
- d = (d << 10 | d >>> 22) + a | 0;
176
- c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
177
- c = (c << 15 | c >>> 17) + d | 0;
178
- b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
179
- b = (b << 21 | b >>> 11) + c | 0;
180
- a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
181
- a = (a << 6 | a >>> 26) + b | 0;
182
- d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
183
- d = (d << 10 | d >>> 22) + a | 0;
184
- c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
185
- c = (c << 15 | c >>> 17) + d | 0;
186
- b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
187
- b = (b << 21 | b >>> 11) + c | 0;
188
- a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
189
- a = (a << 6 | a >>> 26) + b | 0;
190
- d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
191
- d = (d << 10 | d >>> 22) + a | 0;
192
- c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
193
- c = (c << 15 | c >>> 17) + d | 0;
194
- b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
195
- b = (b << 21 | b >>> 11) + c | 0;
196
- a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
197
- a = (a << 6 | a >>> 26) + b | 0;
198
- d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
199
- d = (d << 10 | d >>> 22) + a | 0;
200
- c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
201
- c = (c << 15 | c >>> 17) + d | 0;
202
- b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
203
- b = (b << 21 | b >>> 11) + c | 0;
204
- x[0] = a + x[0] | 0;
205
- x[1] = b + x[1] | 0;
206
- x[2] = c + x[2] | 0;
207
- x[3] = d + x[3] | 0;
208
- }
209
- /**
210
- * Initialise buffer to be hashed
211
- */
212
- start() {
213
- this._dataLength = 0;
214
- this._bufferLength = 0;
215
- this._state.set(_Md5.stateIdentity);
216
- return this;
217
- }
218
- // Char to code point to to array conversion:
219
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
220
- // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
221
- /**
222
- * Append a UTF-8 string to the hash buffer
223
- * @param str String to append
224
- */
225
- appendStr(str) {
226
- const buf8 = this._buffer8;
227
- const buf32 = this._buffer32;
228
- let bufLen = this._bufferLength;
229
- let code;
230
- let i;
231
- for (i = 0; i < str.length; i += 1) {
232
- code = str.charCodeAt(i);
233
- if (code < 128) {
234
- buf8[bufLen++] = code;
235
- } else if (code < 2048) {
236
- buf8[bufLen++] = (code >>> 6) + 192;
237
- buf8[bufLen++] = code & 63 | 128;
238
- } else if (code < 55296 || code > 56319) {
239
- buf8[bufLen++] = (code >>> 12) + 224;
240
- buf8[bufLen++] = code >>> 6 & 63 | 128;
241
- buf8[bufLen++] = code & 63 | 128;
242
- } else {
243
- code = (code - 55296) * 1024 + (str.charCodeAt(++i) - 56320) + 65536;
244
- if (code > 1114111) {
245
- throw new Error("Unicode standard supports code points up to U+10FFFF");
246
- }
247
- buf8[bufLen++] = (code >>> 18) + 240;
248
- buf8[bufLen++] = code >>> 12 & 63 | 128;
249
- buf8[bufLen++] = code >>> 6 & 63 | 128;
250
- buf8[bufLen++] = code & 63 | 128;
251
- }
252
- if (bufLen >= 64) {
253
- this._dataLength += 64;
254
- _Md5._md5cycle(this._state, buf32);
255
- bufLen -= 64;
256
- buf32[0] = buf32[16];
257
- }
258
- }
259
- this._bufferLength = bufLen;
260
- return this;
261
- }
262
- /**
263
- * Append an ASCII string to the hash buffer
264
- * @param str String to append
265
- */
266
- appendAsciiStr(str) {
267
- const buf8 = this._buffer8;
268
- const buf32 = this._buffer32;
269
- let bufLen = this._bufferLength;
270
- let i;
271
- let j = 0;
272
- for (; ; ) {
273
- i = Math.min(str.length - j, 64 - bufLen);
274
- while (i--) {
275
- buf8[bufLen++] = str.charCodeAt(j++);
276
- }
277
- if (bufLen < 64) {
278
- break;
279
- }
280
- this._dataLength += 64;
281
- _Md5._md5cycle(this._state, buf32);
282
- bufLen = 0;
283
- }
284
- this._bufferLength = bufLen;
285
- return this;
286
- }
287
- /**
288
- * Append a byte array to the hash buffer
289
- * @param input array to append
290
- */
291
- appendByteArray(input) {
292
- const buf8 = this._buffer8;
293
- const buf32 = this._buffer32;
294
- let bufLen = this._bufferLength;
295
- let i;
296
- let j = 0;
297
- for (; ; ) {
298
- i = Math.min(input.length - j, 64 - bufLen);
299
- while (i--) {
300
- buf8[bufLen++] = input[j++];
301
- }
302
- if (bufLen < 64) {
303
- break;
304
- }
305
- this._dataLength += 64;
306
- _Md5._md5cycle(this._state, buf32);
307
- bufLen = 0;
308
- }
309
- this._bufferLength = bufLen;
310
- return this;
311
- }
312
- /**
313
- * Get the state of the hash buffer
314
- */
315
- getState() {
316
- const s = this._state;
317
- return {
318
- buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),
319
- buflen: this._bufferLength,
320
- length: this._dataLength,
321
- state: [s[0], s[1], s[2], s[3]]
322
- };
323
- }
324
- /**
325
- * Override the current state of the hash buffer
326
- * @param state New hash buffer state
327
- */
328
- setState(state) {
329
- const buf = state.buffer;
330
- const x = state.state;
331
- const s = this._state;
332
- let i;
333
- this._dataLength = state.length;
334
- this._bufferLength = state.buflen;
335
- s[0] = x[0];
336
- s[1] = x[1];
337
- s[2] = x[2];
338
- s[3] = x[3];
339
- for (i = 0; i < buf.length; i += 1) {
340
- this._buffer8[i] = buf.charCodeAt(i);
341
- }
342
- }
343
- /**
344
- * Hash the current state of the hash buffer and return the result
345
- * @param raw Whether to return the value as an `Int32Array`
346
- */
347
- end(raw2 = false) {
348
- const bufLen = this._bufferLength;
349
- const buf8 = this._buffer8;
350
- const buf32 = this._buffer32;
351
- const i = (bufLen >> 2) + 1;
352
- this._dataLength += bufLen;
353
- const dataBitsLen = this._dataLength * 8;
354
- buf8[bufLen] = 128;
355
- buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0;
356
- buf32.set(_Md5.buffer32Identity.subarray(i), i);
357
- if (bufLen > 55) {
358
- _Md5._md5cycle(this._state, buf32);
359
- buf32.set(_Md5.buffer32Identity);
360
- }
361
- if (dataBitsLen <= 4294967295) {
362
- buf32[14] = dataBitsLen;
363
- } else {
364
- const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
365
- if (matches === null) {
366
- return;
367
- }
368
- const lo = parseInt(matches[2], 16);
369
- const hi = parseInt(matches[1], 16) || 0;
370
- buf32[14] = lo;
371
- buf32[15] = hi;
372
- }
373
- _Md5._md5cycle(this._state, buf32);
374
- return raw2 ? this._state : _Md5._hex(this._state);
375
- }
376
- };
377
- Md5.stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
378
- Md5.buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
379
- Md5.hexChars = "0123456789abcdef";
380
- Md5.hexOut = [];
381
- Md5.onePassHasher = new Md5();
382
- if (Md5.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592") {
383
- throw new Error("Md5 self test failed.");
384
- }
385
-
386
- // src/util/sign.ts
387
- function md5(str) {
388
- return Md5.hashStr(str);
389
- }
390
- function raw(args) {
391
- let keys = Object.keys(args);
392
- keys = keys.sort();
393
- let newArgs = {};
394
- keys.forEach(function(key) {
395
- if (typeof args[key] === "object") {
396
- let mArgs = args[key];
397
- let mKey = Object.keys(mArgs);
398
- mKey = mKey.sort();
399
- let newObj = {};
400
- for (let iKey of mKey) {
401
- newObj[iKey] = mArgs[iKey];
402
- }
403
- newArgs[key] = JSON.stringify(newObj);
404
- } else if (args[key] !== void 0 && args[key] !== "" && key !== "sign") {
405
- newArgs[key] = args[key];
406
- }
407
- });
408
- let string = "";
409
- for (let k in newArgs) {
410
- string += "&" + k + "=" + newArgs[k];
411
- }
412
- string = string.substr(1);
413
- return string;
414
- }
415
-
416
- // src/index.ts
417
- var qjutil = {
418
- sign: sign_exports
419
- };
420
- var index_default = qjutil;
421
- return __toCommonJS(index_exports);
422
- })();
1
+ "use strict";var qjutil=(()=>{var y=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var w=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(i,n)=>(typeof require!="undefined"?require:i)[n]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var l=(o,i)=>{for(var n in i)c(o,n,{get:i[n],enumerable:!0})},g=(o,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of x(i))!F.call(o,t)&&t!==n&&c(o,t,{get:()=>i[t],enumerable:!(s=m(i,t))||s.enumerable});return o};var A=(o,i,n)=>(n=o!=null?y(S(o)):{},g(i||!o||!o.__esModule?c(n,"default",{value:o,enumerable:!0}):n,o)),L=o=>g(c({},"__esModule",{value:!0}),o);var B={};l(B,{bagUtil:()=>_,default:()=>j,sign:()=>d,zip:()=>p});var d={};l(d,{md5:()=>C,raw:()=>z});var h=class o{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(i,n=!1){return this.onePassHasher.start().appendStr(i).end(n)}static hashAsciiStr(i,n=!1){return this.onePassHasher.start().appendAsciiStr(i).end(n)}static _hex(i){let n=o.hexChars,s=o.hexOut,t,e,r,a;for(a=0;a<4;a+=1)for(e=a*8,t=i[a],r=0;r<8;r+=2)s[e+1+r]=n.charAt(t&15),t>>>=4,s[e+0+r]=n.charAt(t&15),t>>>=4;return s.join("")}static _md5cycle(i,n){let s=i[0],t=i[1],e=i[2],r=i[3];s+=(t&e|~t&r)+n[0]-680876936|0,s=(s<<7|s>>>25)+t|0,r+=(s&t|~s&e)+n[1]-389564586|0,r=(r<<12|r>>>20)+s|0,e+=(r&s|~r&t)+n[2]+606105819|0,e=(e<<17|e>>>15)+r|0,t+=(e&r|~e&s)+n[3]-1044525330|0,t=(t<<22|t>>>10)+e|0,s+=(t&e|~t&r)+n[4]-176418897|0,s=(s<<7|s>>>25)+t|0,r+=(s&t|~s&e)+n[5]+1200080426|0,r=(r<<12|r>>>20)+s|0,e+=(r&s|~r&t)+n[6]-1473231341|0,e=(e<<17|e>>>15)+r|0,t+=(e&r|~e&s)+n[7]-45705983|0,t=(t<<22|t>>>10)+e|0,s+=(t&e|~t&r)+n[8]+1770035416|0,s=(s<<7|s>>>25)+t|0,r+=(s&t|~s&e)+n[9]-1958414417|0,r=(r<<12|r>>>20)+s|0,e+=(r&s|~r&t)+n[10]-42063|0,e=(e<<17|e>>>15)+r|0,t+=(e&r|~e&s)+n[11]-1990404162|0,t=(t<<22|t>>>10)+e|0,s+=(t&e|~t&r)+n[12]+1804603682|0,s=(s<<7|s>>>25)+t|0,r+=(s&t|~s&e)+n[13]-40341101|0,r=(r<<12|r>>>20)+s|0,e+=(r&s|~r&t)+n[14]-1502002290|0,e=(e<<17|e>>>15)+r|0,t+=(e&r|~e&s)+n[15]+1236535329|0,t=(t<<22|t>>>10)+e|0,s+=(t&r|e&~r)+n[1]-165796510|0,s=(s<<5|s>>>27)+t|0,r+=(s&e|t&~e)+n[6]-1069501632|0,r=(r<<9|r>>>23)+s|0,e+=(r&t|s&~t)+n[11]+643717713|0,e=(e<<14|e>>>18)+r|0,t+=(e&s|r&~s)+n[0]-373897302|0,t=(t<<20|t>>>12)+e|0,s+=(t&r|e&~r)+n[5]-701558691|0,s=(s<<5|s>>>27)+t|0,r+=(s&e|t&~e)+n[10]+38016083|0,r=(r<<9|r>>>23)+s|0,e+=(r&t|s&~t)+n[15]-660478335|0,e=(e<<14|e>>>18)+r|0,t+=(e&s|r&~s)+n[4]-405537848|0,t=(t<<20|t>>>12)+e|0,s+=(t&r|e&~r)+n[9]+568446438|0,s=(s<<5|s>>>27)+t|0,r+=(s&e|t&~e)+n[14]-1019803690|0,r=(r<<9|r>>>23)+s|0,e+=(r&t|s&~t)+n[3]-187363961|0,e=(e<<14|e>>>18)+r|0,t+=(e&s|r&~s)+n[8]+1163531501|0,t=(t<<20|t>>>12)+e|0,s+=(t&r|e&~r)+n[13]-1444681467|0,s=(s<<5|s>>>27)+t|0,r+=(s&e|t&~e)+n[2]-51403784|0,r=(r<<9|r>>>23)+s|0,e+=(r&t|s&~t)+n[7]+1735328473|0,e=(e<<14|e>>>18)+r|0,t+=(e&s|r&~s)+n[12]-1926607734|0,t=(t<<20|t>>>12)+e|0,s+=(t^e^r)+n[5]-378558|0,s=(s<<4|s>>>28)+t|0,r+=(s^t^e)+n[8]-2022574463|0,r=(r<<11|r>>>21)+s|0,e+=(r^s^t)+n[11]+1839030562|0,e=(e<<16|e>>>16)+r|0,t+=(e^r^s)+n[14]-35309556|0,t=(t<<23|t>>>9)+e|0,s+=(t^e^r)+n[1]-1530992060|0,s=(s<<4|s>>>28)+t|0,r+=(s^t^e)+n[4]+1272893353|0,r=(r<<11|r>>>21)+s|0,e+=(r^s^t)+n[7]-155497632|0,e=(e<<16|e>>>16)+r|0,t+=(e^r^s)+n[10]-1094730640|0,t=(t<<23|t>>>9)+e|0,s+=(t^e^r)+n[13]+681279174|0,s=(s<<4|s>>>28)+t|0,r+=(s^t^e)+n[0]-358537222|0,r=(r<<11|r>>>21)+s|0,e+=(r^s^t)+n[3]-722521979|0,e=(e<<16|e>>>16)+r|0,t+=(e^r^s)+n[6]+76029189|0,t=(t<<23|t>>>9)+e|0,s+=(t^e^r)+n[9]-640364487|0,s=(s<<4|s>>>28)+t|0,r+=(s^t^e)+n[12]-421815835|0,r=(r<<11|r>>>21)+s|0,e+=(r^s^t)+n[15]+530742520|0,e=(e<<16|e>>>16)+r|0,t+=(e^r^s)+n[2]-995338651|0,t=(t<<23|t>>>9)+e|0,s+=(e^(t|~r))+n[0]-198630844|0,s=(s<<6|s>>>26)+t|0,r+=(t^(s|~e))+n[7]+1126891415|0,r=(r<<10|r>>>22)+s|0,e+=(s^(r|~t))+n[14]-1416354905|0,e=(e<<15|e>>>17)+r|0,t+=(r^(e|~s))+n[5]-57434055|0,t=(t<<21|t>>>11)+e|0,s+=(e^(t|~r))+n[12]+1700485571|0,s=(s<<6|s>>>26)+t|0,r+=(t^(s|~e))+n[3]-1894986606|0,r=(r<<10|r>>>22)+s|0,e+=(s^(r|~t))+n[10]-1051523|0,e=(e<<15|e>>>17)+r|0,t+=(r^(e|~s))+n[1]-2054922799|0,t=(t<<21|t>>>11)+e|0,s+=(e^(t|~r))+n[8]+1873313359|0,s=(s<<6|s>>>26)+t|0,r+=(t^(s|~e))+n[15]-30611744|0,r=(r<<10|r>>>22)+s|0,e+=(s^(r|~t))+n[6]-1560198380|0,e=(e<<15|e>>>17)+r|0,t+=(r^(e|~s))+n[13]+1309151649|0,t=(t<<21|t>>>11)+e|0,s+=(e^(t|~r))+n[4]-145523070|0,s=(s<<6|s>>>26)+t|0,r+=(t^(s|~e))+n[11]-1120210379|0,r=(r<<10|r>>>22)+s|0,e+=(s^(r|~t))+n[2]+718787259|0,e=(e<<15|e>>>17)+r|0,t+=(r^(e|~s))+n[9]-343485551|0,t=(t<<21|t>>>11)+e|0,i[0]=s+i[0]|0,i[1]=t+i[1]|0,i[2]=e+i[2]|0,i[3]=r+i[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(o.stateIdentity),this}appendStr(i){let n=this._buffer8,s=this._buffer32,t=this._bufferLength,e,r;for(r=0;r<i.length;r+=1){if(e=i.charCodeAt(r),e<128)n[t++]=e;else if(e<2048)n[t++]=(e>>>6)+192,n[t++]=e&63|128;else if(e<55296||e>56319)n[t++]=(e>>>12)+224,n[t++]=e>>>6&63|128,n[t++]=e&63|128;else{if(e=(e-55296)*1024+(i.charCodeAt(++r)-56320)+65536,e>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[t++]=(e>>>18)+240,n[t++]=e>>>12&63|128,n[t++]=e>>>6&63|128,n[t++]=e&63|128}t>=64&&(this._dataLength+=64,o._md5cycle(this._state,s),t-=64,s[0]=s[16])}return this._bufferLength=t,this}appendAsciiStr(i){let n=this._buffer8,s=this._buffer32,t=this._bufferLength,e,r=0;for(;;){for(e=Math.min(i.length-r,64-t);e--;)n[t++]=i.charCodeAt(r++);if(t<64)break;this._dataLength+=64,o._md5cycle(this._state,s),t=0}return this._bufferLength=t,this}appendByteArray(i){let n=this._buffer8,s=this._buffer32,t=this._bufferLength,e,r=0;for(;;){for(e=Math.min(i.length-r,64-t);e--;)n[t++]=i[r++];if(t<64)break;this._dataLength+=64,o._md5cycle(this._state,s),t=0}return this._bufferLength=t,this}getState(){let i=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[i[0],i[1],i[2],i[3]]}}setState(i){let n=i.buffer,s=i.state,t=this._state,e;for(this._dataLength=i.length,this._bufferLength=i.buflen,t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],e=0;e<n.length;e+=1)this._buffer8[e]=n.charCodeAt(e)}end(i=!1){let n=this._bufferLength,s=this._buffer8,t=this._buffer32,e=(n>>2)+1;this._dataLength+=n;let r=this._dataLength*8;if(s[n]=128,s[n+1]=s[n+2]=s[n+3]=0,t.set(o.buffer32Identity.subarray(e),e),n>55&&(o._md5cycle(this._state,t),t.set(o.buffer32Identity)),r<=4294967295)t[14]=r;else{let a=r.toString(16).match(/(.*?)(.{0,8})$/);if(a===null)return;let f=parseInt(a[2],16),u=parseInt(a[1],16)||0;t[14]=f,t[15]=u}return o._md5cycle(this._state,t),i?this._state:o._hex(this._state)}};h.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);h.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);h.hexChars="0123456789abcdef";h.hexOut=[];h.onePassHasher=new h;if(h.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");function C(o){return h.hashStr(o)}function z(o){let i=Object.keys(o);i=i.sort();let n={};i.forEach(function(t){if(typeof o[t]=="object"){let e=o[t],r=Object.keys(e);r=r.sort();let a={};for(let f of r)a[f]=e[f];n[t]=JSON.stringify(a)}else o[t]!==void 0&&o[t]!==""&&t!=="sign"&&(n[t]=o[t])});let s="";for(let t in n)s+="&"+t+"="+n[t];return s=s.substr(1),s}var _={};l(_,{combineBagRes:()=>O,deleteBagRes:()=>I});function O(o,i,n,s){let t=JSON.parse(JSON.stringify(o)),e=JSON.parse(JSON.stringify(n)),r=!0;for(let a of e)if(a.maxCount=s[a.id].maxCount,a.maxCount===1)if(t.length+a.count>=i){r=!1;break}else{t.push(...new Array(a.count).fill({id:a.id,equipId:a.equipId,durability:a.durability,durabilityMax:a.durabilityMax,count:1}));continue}else{let f=!1;for(let u of t)if(u.id===a.id){if(u.count===a.maxCount)continue;u.count+a.count<=a.maxCount?(u.count+=a.count,a.count=0,f=!0):(a.count-=a.maxCount-u.count,u.count=a.maxCount,f=!1)}if(!f){for(;o.length<i&&a.count>0;)a.count<a.maxCount?(t.push({id:a.id,count:a.count}),a.count=0):(t.push({id:a.id,count:a.maxCount}),a.count-=a.maxCount),r=!0;if(a.count>0){r=!1;break}}}return{status:r,target:t,origin:e.filter(a=>a.count>0)}}function I(o,i){let n=JSON.parse(JSON.stringify(o));return JSON.parse(JSON.stringify(i)).forEach(t=>{let e=t.count,r=n.filter(a=>a.id===t.id).sort((a,f)=>f.count-a.count);for(let a=r.length-1;a>=0;a--){let f=r[a];if(e<f.count){f.count-=e,e=0;break}else e-=f.count,f.count=0}for(let a=n.length-1;a>=0;a--)n[a].count<=0&&n.splice(a,1)}),n}var p={};l(p,{unzip:()=>R,zip:()=>N});var b=A(w("zlib"));function N(o){let i=Buffer.from(JSON.stringify(o));return b.gzipSync(i).toString("hex")}function R(o){let i=Buffer.from(o,"hex");return JSON.parse(b.unzipSync(i).toString())}var J={sign:d,bagUtil:_,zip:p},j=J;return L(B);})();
package/dist/index.js CHANGED
@@ -1,72 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- default: () => index_default,
24
- sign: () => sign_exports
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
- // src/util/sign.ts
29
- var sign_exports = {};
30
- __export(sign_exports, {
31
- md5: () => md5,
32
- raw: () => raw
33
- });
34
- var import_ts_md5 = require("ts-md5");
35
- function md5(str) {
36
- return import_ts_md5.Md5.hashStr(str);
37
- }
38
- function raw(args) {
39
- let keys = Object.keys(args);
40
- keys = keys.sort();
41
- let newArgs = {};
42
- keys.forEach(function(key) {
43
- if (typeof args[key] === "object") {
44
- let mArgs = args[key];
45
- let mKey = Object.keys(mArgs);
46
- mKey = mKey.sort();
47
- let newObj = {};
48
- for (let iKey of mKey) {
49
- newObj[iKey] = mArgs[iKey];
50
- }
51
- newArgs[key] = JSON.stringify(newObj);
52
- } else if (args[key] !== void 0 && args[key] !== "" && key !== "sign") {
53
- newArgs[key] = args[key];
54
- }
55
- });
56
- let string = "";
57
- for (let k in newArgs) {
58
- string += "&" + k + "=" + newArgs[k];
59
- }
60
- string = string.substr(1);
61
- return string;
62
- }
63
-
64
- // src/index.ts
65
- var qjutil = {
66
- sign: sign_exports
67
- };
68
- var index_default = qjutil;
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- sign
72
- });
1
+ "use strict";var b=Object.create;var a=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)a(n,i,{get:e[i],enumerable:!0})},g=(n,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!J.call(n,o)&&o!==i&&a(n,o,{get:()=>e[o],enumerable:!(s=S(e,o))||s.enumerable});return n};var N=(n,e,i)=>(i=n!=null?b(O(n)):{},g(e||!n||!n.__esModule?a(i,"default",{value:n,enumerable:!0}):i,n)),C=n=>g(a({},"__esModule",{value:!0}),n);var E={};l(E,{bagUtil:()=>m,default:()=>B,sign:()=>p,zip:()=>y});module.exports=C(E);var p={};l(p,{md5:()=>z,raw:()=>R});var x=require("ts-md5");function z(n){return x.Md5.hashStr(n)}function R(n){let e=Object.keys(n);e=e.sort();let i={};e.forEach(function(o){if(typeof n[o]=="object"){let c=n[o],u=Object.keys(c);u=u.sort();let t={};for(let r of u)t[r]=c[r];i[o]=JSON.stringify(t)}else n[o]!==void 0&&n[o]!==""&&o!=="sign"&&(i[o]=n[o])});let s="";for(let o in i)s+="&"+o+"="+i[o];return s=s.substr(1),s}var m={};l(m,{combineBagRes:()=>w,deleteBagRes:()=>j});function w(n,e,i,s){let o=JSON.parse(JSON.stringify(n)),c=JSON.parse(JSON.stringify(i)),u=!0;for(let t of c)if(t.maxCount=s[t.id].maxCount,t.maxCount===1)if(o.length+t.count>=e){u=!1;break}else{o.push(...new Array(t.count).fill({id:t.id,equipId:t.equipId,durability:t.durability,durabilityMax:t.durabilityMax,count:1}));continue}else{let r=!1;for(let f of o)if(f.id===t.id){if(f.count===t.maxCount)continue;f.count+t.count<=t.maxCount?(f.count+=t.count,t.count=0,r=!0):(t.count-=t.maxCount-f.count,f.count=t.maxCount,r=!1)}if(!r){for(;n.length<e&&t.count>0;)t.count<t.maxCount?(o.push({id:t.id,count:t.count}),t.count=0):(o.push({id:t.id,count:t.maxCount}),t.count-=t.maxCount),u=!0;if(t.count>0){u=!1;break}}}return{status:u,target:o,origin:c.filter(t=>t.count>0)}}function j(n,e){let i=JSON.parse(JSON.stringify(n));return JSON.parse(JSON.stringify(e)).forEach(o=>{let c=o.count,u=i.filter(t=>t.id===o.id).sort((t,r)=>r.count-t.count);for(let t=u.length-1;t>=0;t--){let r=u[t];if(c<r.count){r.count-=c,c=0;break}else c-=r.count,r.count=0}for(let t=i.length-1;t>=0;t--)i[t].count<=0&&i.splice(t,1)}),i}var y={};l(y,{unzip:()=>q,zip:()=>I});var d=N(require("zlib"));function I(n){let e=Buffer.from(JSON.stringify(n));return d.gzipSync(e).toString("hex")}function q(n){let e=Buffer.from(n,"hex");return JSON.parse(d.unzipSync(e).toString())}var A={sign:p,bagUtil:m,zip:y},B=A;0&&(module.exports={bagUtil,sign,zip});
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
- {
2
- "name": "qjutil",
3
- "version": "0.0.10",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "files": ["dist"],
7
- "scripts": {
8
- "build": "tsup src/index.ts --format cjs,iife --global-name qjutil --dts --out-dir dist",
9
- "prepublishOnly": "npm run build",
10
- "publish": "npm publish --access public"
11
- },
12
- "dependencies": {
13
- "ts-md5": "^1.2.7"
14
- },
15
- "devDependencies": {
16
- "tsup": "^8.5.1",
17
- "typescript": "^5.9.3",
18
- "@types/node": "^25.0.3"
19
- }
20
- }
1
+ {
2
+ "name": "qjutil",
3
+ "version": "0.0.11",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "scripts": {
10
+ "build": "tsup src/index.ts --format cjs,iife --global-name qjutil --dts --out-dir dist --minify",
11
+ "prepublishOnly": "npm run build",
12
+ "publish": "npm publish --access public"
13
+ },
14
+ "dependencies": {
15
+ "ts-md5": "^1.2.7",
16
+ "zlib": "^1.0.5"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "^25.0.3",
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
22
+ }
23
+ }
package/dist/index.d.mts DELETED
@@ -1,14 +0,0 @@
1
- declare function md5(str: string): string;
2
- declare function raw(args: Record<string, any>): string;
3
-
4
- declare const sign_md5: typeof md5;
5
- declare const sign_raw: typeof raw;
6
- declare namespace sign {
7
- export { sign_md5 as md5, sign_raw as raw };
8
- }
9
-
10
- declare const _default: {
11
- sign: typeof sign;
12
- };
13
-
14
- export { _default as default, sign };
package/dist/index.mjs DELETED
@@ -1,50 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/util/sign.ts
8
- var sign_exports = {};
9
- __export(sign_exports, {
10
- md5: () => md5,
11
- raw: () => raw
12
- });
13
- import { Md5 } from "ts-md5";
14
- function md5(str) {
15
- return Md5.hashStr(str);
16
- }
17
- function raw(args) {
18
- let keys = Object.keys(args);
19
- keys = keys.sort();
20
- let newArgs = {};
21
- keys.forEach(function(key) {
22
- if (typeof args[key] === "object") {
23
- let mArgs = args[key];
24
- let mKey = Object.keys(mArgs);
25
- mKey = mKey.sort();
26
- let newObj = {};
27
- for (let iKey of mKey) {
28
- newObj[iKey] = mArgs[iKey];
29
- }
30
- newArgs[key] = JSON.stringify(newObj);
31
- } else if (args[key] !== void 0 && args[key] !== "" && key !== "sign") {
32
- newArgs[key] = args[key];
33
- }
34
- });
35
- let string = "";
36
- for (let k in newArgs) {
37
- string += "&" + k + "=" + newArgs[k];
38
- }
39
- string = string.substr(1);
40
- return string;
41
- }
42
-
43
- // src/index.ts
44
- var index_default = {
45
- sign: sign_exports
46
- };
47
- export {
48
- index_default as default,
49
- sign_exports as sign
50
- };