qjutil 0.0.12 → 0.0.13

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/dist/index.d.ts CHANGED
@@ -20,28 +20,9 @@ declare namespace bagUtil {
20
20
  export { bagUtil_combineBagRes as combineBagRes, bagUtil_deleteBagRes as deleteBagRes };
21
21
  }
22
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
23
  declare const qjUtil: {
42
24
  sign: typeof sign;
43
25
  bagUtil: typeof bagUtil;
44
- zip: typeof zip$1;
45
26
  };
46
27
 
47
- export { bagUtil, qjUtil as default, sign, zip$1 as zip };
28
+ export { bagUtil, qjUtil as default, sign };
@@ -1 +1 @@
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);})();
1
+ "use strict";var qjutil=(()=>{var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var _=(o,i)=>{for(var n in i)d(o,n,{get:i[n],enumerable:!0})},y=(o,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of p(i))!g.call(o,t)&&t!==n&&d(o,t,{get:()=>i[t],enumerable:!(s=b(i,t))||s.enumerable});return o};var m=o=>y(d({},"__esModule",{value:!0}),o);var C={};_(C,{bagUtil:()=>l,default:()=>L,sign:()=>c});var c={};_(c,{md5:()=>x,raw:()=>F});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 x(o){return h.hashStr(o)}function F(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={};_(l,{combineBagRes:()=>w,deleteBagRes:()=>S});function w(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 S(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 A={sign:c,bagUtil:l},L=A;return m(C);})();
package/dist/index.js CHANGED
@@ -1 +1 @@
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});
1
+ "use strict";var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var m=(e,o)=>{for(var i in o)d(e,i,{get:o[i],enumerable:!0})},b=(e,o,i,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of p(o))!x.call(e,n)&&n!==i&&d(e,n,{get:()=>o[n],enumerable:!(s=g(o,n))||s.enumerable});return e};var h=e=>b(d({},"__esModule",{value:!0}),e);var w={};m(w,{bagUtil:()=>l,default:()=>R,sign:()=>f});module.exports=h(w);var f={};m(f,{md5:()=>O,raw:()=>C});var y=require("ts-md5");function O(e){return y.Md5.hashStr(e)}function C(e){let o=Object.keys(e);o=o.sort();let i={};o.forEach(function(n){if(typeof e[n]=="object"){let c=e[n],u=Object.keys(c);u=u.sort();let t={};for(let r of u)t[r]=c[r];i[n]=JSON.stringify(t)}else e[n]!==void 0&&e[n]!==""&&n!=="sign"&&(i[n]=e[n])});let s="";for(let n in i)s+="&"+n+"="+i[n];return s=s.substr(1),s}var l={};m(l,{combineBagRes:()=>S,deleteBagRes:()=>J});function S(e,o,i,s){let n=JSON.parse(JSON.stringify(e)),c=JSON.parse(JSON.stringify(i)),u=!0;for(let t of c)if(t.maxCount=s[t.id].maxCount,t.maxCount===1)if(n.length+t.count>=o){u=!1;break}else{n.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 a of n)if(a.id===t.id){if(a.count===t.maxCount)continue;a.count+t.count<=t.maxCount?(a.count+=t.count,t.count=0,r=!0):(t.count-=t.maxCount-a.count,a.count=t.maxCount,r=!1)}if(!r){for(;e.length<o&&t.count>0;)t.count<t.maxCount?(n.push({id:t.id,count:t.count}),t.count=0):(n.push({id:t.id,count:t.maxCount}),t.count-=t.maxCount),u=!0;if(t.count>0){u=!1;break}}}return{status:u,target:n,origin:c.filter(t=>t.count>0)}}function J(e,o){let i=JSON.parse(JSON.stringify(e));return JSON.parse(JSON.stringify(o)).forEach(n=>{let c=n.count,u=i.filter(t=>t.id===n.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 N={sign:f,bagUtil:l},R=N;0&&(module.exports={bagUtil,sign});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qjutil",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -9,11 +9,10 @@
9
9
  "scripts": {
10
10
  "build": "tsup src/index.ts --format cjs,iife --global-name qjutil --dts --out-dir dist --minify",
11
11
  "prepublishOnly": "npm run build",
12
- "publish": "npm publish --access public"
12
+ "publishOnly": "npm publish --access public"
13
13
  },
14
14
  "dependencies": {
15
- "ts-md5": "^1.2.7",
16
- "zlib": "^1.0.5"
15
+ "ts-md5": "^1.2.7"
17
16
  },
18
17
  "devDependencies": {
19
18
  "@types/node": "^25.0.3",